Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 42431

Summary: PaintListener for Table gets misalligned GC in paintControl().
Product: [Eclipse Project] Platform Reporter: Dave Steinberg <davidms>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED DUPLICATE QA Contact:
Severity: normal    
Priority: P3    
Version: 2.1.1   
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard:
Attachments:
Description Flags
Screen capture of a TableTree showing (0,0) on the GC. none

Description Dave Steinberg CLA 2003-09-02 23:51:45 EDT
I'm adding a PaintListener to the Table underlying a TableTree, and seeing a
problem in paintControl() on GTK.  There seems to be a misallignment between the
bounds of the PaintEvent's gc and the bounds of its widget (the Table).

For example, see the attached screen capture.  On it, I've just drawn two lines,
to show the top-left corner:

  event.gc.drawLine(0, 0, 0, 15);
  event.gc.drawLine(0, 0, 15, 0);

On other platforms, (0,0) is at the top of the header, but here, it's under
it.  Since I'm using the bounds of the items to figure out where to draw,
I've got a problem.  For example, if I getBounds() on the first item, it reports
x=1, y=31, which clearly doesn't line up with the GC like it does on other
platforms.

The Table available from event.widget has bounds just like on other platforms:
x=0, y=0.
Comment 1 Dave Steinberg CLA 2003-09-02 23:56:54 EDT
Created attachment 5951 [details]
Screen capture of a TableTree showing (0,0) on the GC.

In paintControl(), the origin appears under the Table's header.
Comment 2 Dave Steinberg CLA 2003-09-04 09:47:33 EDT
Investigating further, it seems that it's not just the GC that's misaligned, but
also the PaintEvent's x, y, width, and height values.

For example, my Table's height is 115, according to getBounds(), but when the
whole thing is repainting, the PaintEvent has y=0 and height=84.
Comment 3 Grant Gayed CLA 2003-09-04 14:07:11 EDT

*** This bug has been marked as a duplicate of 42416 ***