GNOME Bugzilla – Bug 335351
Support sibling from restacking ConfigureRequests
Last modified: 2011-01-19 14:10:15 UTC
Please describe the problem: From window.c: /* Handle stacking. We only handle raises/lowers, mostly because * stack.c really can't deal with anything else. I guess we'll fix * that if a client turns up that really requires it. If someone has the time I'd really like this feature. :) I know well behaved applications aren't supposed to fiddle with stacking order, but this is a bit different. What I'm doing is seamless windows support for rdesktop and as part of this there will be restacking events from the other end. Currently, if I ask metacity to place window A behind B, then it gets moved to the very back of the z order. Very annoying. :/ Steps to reproduce: Actual results: Expected results: Does this happen every time? Other information:
Yeah, it'd be good to have this implemented for completeness; there's a FIXME-like comment in metacity/src/window.c about this: * I'm pretty sure no interesting client uses TopIf, BottomIf, or * Opposite anyway, so the only possible missing thing is * Above/Below with a sibling set. For now we just pretend there's * never a sibling set and always do the full raise/lower instead of * the raise-just-above/below-sibling. So obviously, it's time to do the sibling thing (i.e. honor event->xconfigurerequest.above). Shouldn't be too hard. We have very similar code in meta_window_stack_just_below() that could be useful; also the part of bug 150615 comment 7 about stacking should help out as well.
I would like to fix this but I am not so sure about the right way of doing it. This is how I imagine it might be supposed to be done: switch (event->xconfigurerequest.detail) { case Above: if (event->xconfigurerequest.value_mask & CWSibling) { MetaWindow *sibling = event->xconfigrequest.above; meta_window_stack_just_above (window, sibling); } else meta_window_raise (window); break; case Below: if (event->xconfigurerequest.value_mask & CWSibling) { MetaWindow *sibling = event->xconfigrequest.above; meta_window_stack_just_below (window, sibling); } else meta_window_lower (window); break; case ... ... } And then of cause add meta_window_stack_just_above(). This may be very wrong as I am just starting to understand metacity (and window managers in general even) And to be honest I'm not even sure where event->xconfigrequest.above and .value_mask gets set. But I assume these are given from the client? But how would it know the pointer to the sibling???
Created attachment 98749 [details] [review] _NET_RESTACK_WINDOW and sibling-relative stacking I've needed this for a project I'm working on, so I added support for both sibling-relative restacking and proper support for the _NET_RESTACK_WINDOW hint (which, according to the EMWH spec, allows windows to be stacked in the order given by the calling application without the restrictions given in XConfigureWindow, intended for pagers). This is my first patch for Metacity but I tried to keep the code style consistent with the rest of the codebase. I've been using this successfully in my project. I've written a test case (which I'm slowly developing to allow for easily testing what features window managers support), available via SVN at: https://view.svn.sourceforge.net/svnroot/view/trunk/wm-test-suite/
Review of attachment 98749 [details] [review]: I really have to apologise for leaving this bug untouched for so long. Serves me right that I had a lot of working around code rot to do. The patch seems fine, it adds something we need to support, and it all appears to work. Nice work on getting our coding style. Nicer on including a test case. Checked into master.
FIXED.