<AWT Dev> Some Window OverrideRedirect patches for Metacity

Mark Wielaard mwielaard at redhat.com
Mon May 26 02:36:14 PDT 2008


There are a couple of bug reports because the Metacity window manager
doesn't obey the polite requests of the xawt peers to override the
default window placement and ordering. There is actually already code to
handle this in the xawt peers. The following patches activate that code
in some circumstances.

This bug report is about jpopupmenus not being placed exactly where
requested if something (like the gnome panel) is in the way. The way to
resolve this is to set OverrideRedirect on Windows that request it in
the name. java.swing.Popup already sets the name hint. And if we were
using motif this would be enough (see MWindowPeer_pCreate in
awt_TopLevel.c). For the awt X peers one little change is necessary to
pick up the hint and set the OverrideRedirect parameter. Patch attached.

Windows (not Frames or Dialogs) should be handled somewhat specially
(they don't have decorations). There is an issue when trying toBack() or
toFront() on a Window when another window has the Focus. Metacity won't
do this. There is actually code to override the window manager similar
to the above popup menu solution. In XWindowPeer there is special code
to handle toFront() and toBack() when OverrideRedirect is set. For olwm
this is explicitly enabled, so we do the same for metacity. This is a
bit of a sledgehammer. But is does seem to work if we want to force this
behavior for bare Windows. And it is relatively safe since
isOverrideRedirect() is overridden in the XDecoratedPeer (which is used
for normal Frames) to always return false. Patch attached.

I added the combined patch (also attached) to IcedTea to give it some
wider exposure. Since both the above behaviors are somewhat
controversial, but apparently what ClosedJDK6 does, or at least what
people seem to expect it to do, I have attached them separately for
comments. I think the JPopupMenu one is the right thing to do since you
always want popup menus to show up on top and where the application
expects them to popup. The explicit Window OverrideRedirect for Metacity
is a bit more controversial. It seems to implement the behavior of what
might be expected from an top-level awt/swing Window without decoration
(as used for splash-screens, etc). But it is fairly user hostile because
it overrides the default behavior of the window manager and users might
not like the "sticky" nature of such Windows.

Comments much appreciated.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: jpopup-override.patch
Type: text/x-patch
Size: 819 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20080526/e017daa0/jpopup-override.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: window-override.patch
Type: text/x-patch
Size: 477 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20080526/e017daa0/window-override.patch 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: window-override-redirect-metacity.patch
Type: text/x-patch
Size: 2141 bytes
Desc: not available
Url : http://mail.openjdk.java.net/pipermail/awt-dev/attachments/20080526/e017daa0/window-override-redirect-metacity.patch 

More information about the awt-dev mailing list