From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 762 invoked by alias); 22 Jul 2010 08:39:58 -0000 Received: (qmail 752 invoked by uid 22791); 22 Jul 2010 08:39:55 -0000 X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,TW_DW X-Spam-Check-By: sourceware.org Received: from mail148.messagelabs.com (HELO mail148.messagelabs.com) (85.158.137.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Jul 2010 08:39:47 +0000 X-VirusChecked: Checked X-Env-Sender: richard.evans@datanomic.com X-Msg-Ref: server-9.tower-148.messagelabs.com!1279787973!18406898!6 X-StarScan-Version: 6.2.4; banners=-,-,- Received: (qmail 4627 invoked from network); 22 Jul 2010 08:39:41 -0000 Received: from hostedexchange.hostedservice.com (HELO outlook.hostedservice2.net) (217.28.130.38) by server-9.tower-148.messagelabs.com with RC4-SHA encrypted SMTP; 22 Jul 2010 08:39:41 -0000 Received: from THHS2EXBE5X.hostedservice2.net (192.168.33.160) by thhs2e12ht03.hostedservice2.net (192.168.16.113) with Microsoft SMTP Server id 8.2.254.0; Thu, 22 Jul 2010 09:39:31 +0100 Received: from THHS2EXBE1X.hostedservice2.net ([192.168.16.22]) by THHS2EXBE5X.hostedservice2.net with Microsoft SMTPSVC(6.0.3790.1830); Thu, 22 Jul 2010 09:39:31 +0100 Content-Class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Mouse offset when using java swing based gui applications Date: Thu, 22 Jul 2010 08:39:00 -0000 Message-ID: <974066EF77EEA44EB8AED6ADA05DBD0202038CEE@THHS2EXBE1X.hostedservice2.net> In-Reply-To: <4C474580.3090309@dronecode.org.uk> References: <4C3F0F49.5090506@dronecode.org.uk> <974066EF77EEA44EB8AED6ADA05DBD0201FFDEFB@THHS2EXBE1X.hostedservice2.net> <4C447495.5000707@dronecode.org.uk> <974066EF77EEA44EB8AED6ADA05DBD0201FFE516@THHS2EXBE1X.hostedservice2.net> <4C474580.3090309@dronecode.org.uk> From: Richard Evans To: , "Jon TURNEY" Mailing-List: contact cygwin-xfree-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-xfree-owner@cygwin.com Reply-To: cygwin-xfree@cygwin.com Mail-Followup-To: cygwin-xfree@cygwin.com X-SW-Source: 2010-07/txt/msg00081.txt.bz2 Yes, my experience is the same as yours. The menus test starts with the frame hidden off the top left, as before, but when I move the window, the menus _do_ work OK. Apps which set an initial location (add jframe.setLocation(400, 400); after the pack() call) appear correctly and the menus still work. Interestingly with the 1.7.3 XWin, the app would appear in the right place but would tend to snap back to the top left if you tried to resize the window. This does not seem to happen with the patched server. Richard -----Original Message----- From: Jon TURNEY [mailto:jon.turney@dronecode.org.uk]=20 Sent: 21 July 2010 20:08 To: cygwin-xfree@cygwin.com; Richard Evans Subject: Re: Mouse offset when using java swing based gui applications On 19/07/2010 17:27, Richard Evans wrote: > I've attached a small test case which shows the menu problems. Thanks very much, that was very helpful in investigating this problem. > This menu behaviour has been seen for all versions of JDK 1.6 as far as > I remember; it certainly happens with 1.6u3 and 1.6u4. Yes, I wasn't testing what I thought I was testing, and was completely wrong=20 when I said sun bug #6434227 was fixed in the JRE that it claims it's fixed in. It's fixed in JDK1.7 and OpenJDK, but that bug lies when it says the fix is in=20 1.6 as well. However, it does identify what's going wrong. The significant difference in=20 XDecoratedPeer.java between 1.6u21 and a fixed version is: ---=20 /opt/wip/jdk-1_6_0/j2se/src/solaris/classes/sun/awt/X11/XDecoratedPeer.j ava=20 2010-07-21 15:46:33.281250000 +0100 +++ /opt/wip/openjdk/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java 2010-06-21 22:15:43.000000000 +0100 @@ -752,79 +748,69 @@ Point newLocation =3D targetBounds.getLocation(); - if (xe.get_send_event()) { + if (xe.get_send_event() || runningWM =3D=3D XWM.NO_WM ||=20 XWM.isNonReparentingWM()) { // Location, Client size + insets newLocation =3D new Point(xe.get_x() - currentInsets.left,=20 xe.get_y() - currentInsets.top); } else { // CDE/MWM/Metacity/Sawfish bug: if shell is resized using // top or left border, we don't receive synthetic // ConfigureNotify, only the one from X with zero // coordinates. This is the workaround to get real // location, 6261336 - // Do the same for non-reparenting WMs (Compiz, Looking Glass) switch (XWM.getWMID()) { case XWM.CDE_WM: case XWM.MOTIF_WM: case XWM.METACITY_WM: case XWM.SAWFISH_WM: - case XWM.COMPIZ_WM: - case XWM.LG3D_WM: { Point xlocation =3D queryXLocation(); if (log.isLoggable(Level.FINE)) { log.log(Level.FINE, "New X location: {0}", new Object[]{String.valueOf(xlocation)}); } if (xlocation !=3D null) { newLocation =3D xlocation; } break; } default: break; } } Location updates from ConfigureNotify are not processed in the NO_WM case, presumably causing the menus behave as if the window was still located where=20 it was created. There are 2 possible workarounds which occur to me: (i) Lie and pretend we are a non-reparenting WM on the list that AWT knows=20 about, like LG3D. This one of the workarounds suggested in the manpage for=20 dwm (a non-reparenting, tiling WM) Unfortunately, we have to tell a more lies to get AWT to accept this lie, and=20 in particular, we have to claim to support EWMH, which the internal WM doesn't=20 really (although it should), so I'm not too keen on this approach. (ii) Alternatively, it's a straightforward workaround to add to the internal=20 WM to cause it to send synthetic ConfigureNotify for these windows when a=20 non-synthetic ConfigureNotify occurs. From a quick test, this approach seems to work ok. But the Java window still=20 appears with the frame off the top-left, rather than getting nudged away from=20 the origin so the frame is visible, which is rather mysterious. I've uploaded a build with this change at [1], patch to follow. Perhaps you=20 could try it out and see if it works for you? [1] ftp://cygwin.com/pub/cygwinx/XWin.20100721-git-2704058015f198ce.exe.bz2 --=20 Jon TURNEY Volunteer Cygwin/X X Server maintainer -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://x.cygwin.com/docs/ FAQ: http://x.cygwin.com/docs/faq/