After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 786365 - Wrong Z-order by XReconfigureWMWindow() call
Wrong Z-order by XReconfigureWMWindow() call
Status: RESOLVED FIXED
Product: mutter
Classification: Core
Component: general
3.20.x
Other Linux
: Normal normal
: ---
Assigned To: mutter-maint
mutter-maint
Depends on:
Blocks:
 
 
Reported: 2017-08-16 12:08 UTC by Martin Schreiber
Modified: 2017-09-29 16:36 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Testprogram (1.66 KB, text/x-csrc)
2017-08-16 12:08 UTC, Martin Schreiber
  Details
x11/window: Respect XConfigureRequestEvent sibling (2.60 KB, patch)
2017-08-30 08:50 UTC, Vasilis Liaskovitis
none Details | Review
Testprogram 2 (1.66 KB, text/x-csrc)
2017-09-22 08:45 UTC, Martin Schreiber
  Details
x11/window: Implement _NET_RESTACK_WINDOW and XConfigureRequestEvent sibling (6.38 KB, patch)
2017-09-28 16:12 UTC, Vasilis Liaskovitis
none Details | Review
x11/window: Implement _NET_RESTACK_WINDOW and XConfigureRequestEvent sibling (6.64 KB, patch)
2017-09-29 15:03 UTC, Vasilis Liaskovitis
committed Details | Review

Description Martin Schreiber 2017-08-16 12:08:54 UTC
Created attachment 357718 [details]
Testprogram

While adapting MSEide+MSEgui
https://sourceforge.net/projects/mseide-msegui/
to Gnome I found on OpenSUSE Leap 42.2 that in XReconfigureWMWindow() call stackmode "Below" windows are placed at the bottom of the window stack instead just below the sibling, see test program. This makes it impossible for clients to reliably set the window stacking order.
https://tronche.com/gui/x/xlib/window/c ... dowChanges
"
If a sibling and a stack_mode are specified, the window is restacked as follows:

Above The window is placed just above the sibling.
Below The window is placed just below the sibling.
"
Comment 1 Martin Schreiber 2017-08-16 12:18:57 UTC
Fixed link:
https://tronche.com/gui/x/xlib/window/configure.html#XWindowChanges
Comment 2 Vasilis Liaskovitis 2017-08-30 08:50:08 UTC
Created attachment 358747 [details] [review]
x11/window: Respect XConfigureRequestEvent sibling

This patch requires patch of issue#786363 comment#4, which was already reviewed. I also cross-posted the patch in that bug as comment#6, as they are related.
Comment 3 Martin Schreiber 2017-09-22 08:45:55 UTC
Created attachment 360247 [details]
Testprogram 2

The first test program runs OK now, thanks.
There is another problem see zorder1.c.
The topleft black window should toggle Z-order between top and between the white and the other black window. That works on KDE, on Gnome the white window becomes the top level window.
Comment 4 Vasilis Liaskovitis 2017-09-28 16:12:00 UTC
Created attachment 360617 [details] [review]
x11/window: Implement _NET_RESTACK_WINDOW and XConfigureRequestEvent sibling

Updated patch with fix for the testcase of comment#3.

This patch covers both this bug and bug#786363. Posted to both bugs for completion.
Comment 5 Rui Matos 2017-09-29 13:14:51 UTC
Review of attachment 360617 [details] [review]:

looks mostly good, just a couple of comments:

::: src/x11/window-x11.c
@@ +2192,3 @@
+              display = meta_window_get_display (window);
+              sibling = meta_display_lookup_x_window (display,
+                                                event->xconfigurerequest.above);

meta_display_lookup_x_window() may fail and return NULL which will make us crash on the sibling->desc dereference below

if this happens I'd say we should return since the app is either buggy or malicious and so we should not restack it

@@ +2281,3 @@
+  if (window)
+    {
+      if (event->xclient.data.l[1])

the wm spec says "It should be used only by pagers, applications can use normal ConfigureRequests. The source indication field should be therefore set to 2" so I think we should enforce that here
Comment 6 Rui Matos 2017-09-29 13:15:57 UTC
*** Bug 786363 has been marked as a duplicate of this bug. ***
Comment 7 Vasilis Liaskovitis 2017-09-29 15:03:17 UTC
Created attachment 360670 [details] [review]
x11/window: Implement _NET_RESTACK_WINDOW and XConfigureRequestEvent sibling

Thanks for the review. New patch attached.

Changes:

- if sibling == NULL in meta_window_x11_configure_request(), simply return TRUE.
- ignore NET_RESTACK_WINDOW if event->xclient.data.l[0] != 2 i.e. if event
  is not coming from a pager
Comment 8 Rui Matos 2017-09-29 16:35:15 UTC
Review of attachment 360670 [details] [review]:

looks good, thanks for the patch, I'll push it with a few indentation fixes
Comment 9 Rui Matos 2017-09-29 16:36:38 UTC
Attachment 360670 [details] pushed as e3d5983 - x11/window: Implement _NET_RESTACK_WINDOW and XConfigureRequestEvent sibling