[Bug 9538] New: java: Component#getLocationOnScreen returning incorrect coords

wine-bugs at winehq.org wine-bugs at winehq.org
Fri Aug 31 17:38:18 CDT 2007


http://bugs.winehq.org/show_bug.cgi?id=9538

           Summary: java: Component#getLocationOnScreen returning incorrect
                    coords
           Product: Wine
           Version: CVS/GIT
          Platform: Other
        OS/Version: other
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: wine-x11driver
        AssignedTo: wine-bugs at winehq.org
        ReportedBy: smckay at google.com
                CC: dank at kegel.com


Here's a short java program that behaves correctly on linux and windows, but
not under wine. The program exercises a small part of the java awt toolkit.

1. Create a file with the following contents:

import java.awt.Component;
import java.awt.Container;
import java.awt.Frame;
import java.awt.Point;

public class Bug {

  public static void main(String[] args) {
     Frame f = new Frame();
     Container cont = new Container();
     Component comp = new Component(){};
     f.add(cont);
     cont.add(comp);
     f.setSize(100, 100);
     f.setVisible(true);
     cont.setBounds(10, 10, 80, 80);
     comp.setBounds(10, 10, 60, 60);

     Point frameLoc = f.getLocationOnScreen();

     Point compLoc = comp.getLocationOnScreen();

     // The component now should have
     // (frameLoc.x + 20 + i.left, frameLoc.y + 20 + i.top).
     System.out.printf("a.x=%d, a.y=%d / b.x=%d, b.y=%d\n",
         compLoc.x, compLoc.y, frameLoc.x, frameLoc.y);

     f.dispose();
  } 
}


2. Compile it:

javac Bug.java

3. Download a JDK from java.sun.com and install it in Wine

4. Use it to run Bug.class, e.g.
    cd '.wine/drive_c/Program Files/Java/jre1.6.0_01'
    cp ~/Bug.class .
    wine bin/java.exe Bug

5. Returns inconsistent results under wine. Under linux and windows it
consistently returns "a.x=20, a.y=20 / b.x=0, b.y=0". Occasionally wine returns
correct results, but repeated invocations of the application should produce
inconsistent results (e.g. "a.x=16, a.y=-3 / b.x=-4, b.y=-23").


-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list