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

Bug 345004

Summary: coordinate mapping problem happens with recent GTK versions
Product: [Eclipse Project] Platform Reporter: Grant Gayed <grant_gayed>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: ericwill, overholt, pwebster
Version: 3.7Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux-GTK   
Whiteboard: stalebug

Description Grant Gayed CLA 2011-05-06 13:33:41 EDT
3.7M7

- run the snippet below, which draws a small rectangle beside its Spinner
- this works fine on Windows and Cocoa, and also on RHEL4 (gtk 2.4.13)
- however it draws the rectangle far to the right on Fedora Core 15, and apparently on Ubuntu 10.10 as well

public static void main(String[] args) {
    final Display display = new Display();
    Shell shell = new Shell(display);
    shell.setSize(450, 300);
    shell.setLayout(new FillLayout());
    Canvas composite = new Canvas(shell, SWT.NONE);
    composite.setLayout(new GridLayout());
    final Spinner spinner = new Spinner(composite, SWT.BORDER);
    spinner.setLayoutData(new GridData(150, SWT.DEFAULT));
    composite.addPaintListener(new PaintListener() {
        public void paintControl(PaintEvent e) {
            Rectangle ibounds = new Rectangle(10, 10, 10, 10);
            Rectangle sbounds = spinner.getBounds();
            Point rel = spinner.toDisplay(sbounds.width, 0);
            Point p = spinner.getParent().toControl(rel);
            e.gc.drawRectangle(p.x, p.y, ibounds.width, ibounds.height);
        }
    });
    shell.open();
    while (!shell.isDisposed()) {
        if (!display.readAndDispatch()) {
            display.sleep();
        }
    }
    display.dispose();
}
Comment 1 Eric Williams CLA 2018-07-06 13:45:43 EDT
Still reproducible on GTK3.22, SWT master as of today, and Fedora 28.
Comment 2 Eclipse Genie CLA 2020-08-13 17:39:21 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.