From: Carsten W. <ca...@us...> - 2007-05-12 15:02:21
|
Update of /cvsroot/jake2/jake2/src/jake2/sys In directory sc8-pr-cvs6.sourceforge.net:/tmp/cvs-serv16651/src/jake2/sys Modified Files: JOGLKBD.java Log Message: bugfix: center the mouse correct, now really ;-) Index: JOGLKBD.java =================================================================== RCS file: /cvsroot/jake2/jake2/src/jake2/sys/JOGLKBD.java,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** JOGLKBD.java 12 May 2007 13:31:19 -0000 1.10 --- JOGLKBD.java 12 May 2007 15:02:18 -0000 1.11 *************** *** 57,60 **** --- 57,62 ---- mx = (((MouseEvent)event.ev).getX() - win_w2) * 2; my = (((MouseEvent)event.ev).getY() - win_h2) * 2; + System.out + .println(mx + " " + my); } else { mx = 0; *************** *** 89,99 **** win_x = 0; win_y = 0; ! win_w2 = c.getWidth() / 2; ! win_h2 = c.getHeight() / 2; while (c != null) { if (c instanceof Container) { Insets insets = ((Container)c).getInsets(); ! win_x += insets.left; ! win_y += insets.top; } win_x += c.getX(); --- 91,102 ---- win_x = 0; win_y = 0; ! win_w2 = (c.getWidth() + 1) / 2; ! win_h2 = (c.getHeight() + 1) / 2; ! int left = 0; int top = 0; while (c != null) { if (c instanceof Container) { Insets insets = ((Container)c).getInsets(); ! left += insets.left; ! top += insets.top; } win_x += c.getX(); *************** *** 101,104 **** --- 104,109 ---- c = c.getParent(); } + win_x += left; win_y += top; + win_w2 -= (left + 1) / 2; win_h2 -= (top + 1) / 2; break; } |