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 702831 - Shaped GDK windows do not work
Shaped GDK windows do not work
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: X11
3.9.x
Other Linux
: Normal major
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-06-21 18:15 UTC by mod-oss
Modified: 2013-07-01 13:34 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
simple demo--for maximum clarity disable compositing managers under X (1.21 KB, text/plain)
2013-06-21 18:15 UTC, mod-oss
  Details
gdk: Fix shaped toplevels (1020 bytes, patch)
2013-07-01 13:34 UTC, Alexander Larsson
committed Details | Review

Description mod-oss 2013-06-21 18:15:07 UTC
Created attachment 247479 [details]
simple demo--for maximum clarity disable compositing managers under X

This problem is clearly present but a little complex in how it's manifested:

Under the X11 backend, calls to gdk_window_shape_combine_region never result in a call to XShapeCombineRectangles (i.e. they are no-ops from the windowing-system perspective), and drawing with GDK is not always cropped to the shape region. Calls to gdk_window_input_shape_combine_region work fine under X11. The former problem is not necessarily easy to see when using GTK, as it seems to limit its drawing and stay within the region. Disabling any compositing managers and then minimizing and unminimizing a window helps with this, as it will leave bad contents in the window's "shaped-away" regions.

Under the Wayland backend, the input mask is not set by calls to gdk_window_shape_combine_region *or* gdk_window_input_shape_combine_region. The pertinent functions in gdk/wayland/gdkwindow-wayland.c are empty.

This is a regression from GTK2, where shaping windows via a call to gdk_window_shape_combine_region always bounds the contents and sets the input region.

The expected behavior is that calls to gdk_window_shape_combine_region will bound the input and output regions--the X call looks like it should set the Bounding region, which has these semantics (modulo some X11 window-border nonsense). Calls to gdk_window_input_shape_combine_region should (presumably, based on X Shape semantics) intersect with the region from gdk_window_shape_combine_region to determine the effective input region.

Attached is a demo program that can be used to contrast GTK2 and GTK3 behavior.
Comment 1 mod-oss 2013-06-21 21:19:24 UTC
I've found a patch that seems to fix the bulk of the problem locally by comparing the GTK2 and GTK3 codebases. Commit a60ccd3672467efb454b121993febc36f33cbc79 removed the lines:

  if (gdk_window_has_impl (window) &&
      !should_apply_clip_as_shape (window))
    apply_shape (window, window->shape);

from gdk_window_shape_combine_region in gdkwindow.c. Restoring them (like GTK2 has) makes the output shape update properly under X11. Apparently Wayland is just lacking implementations so I expect once those are written things will work okay on that end as well.
Comment 2 Alexander Larsson 2013-07-01 13:34:16 UTC
Created attachment 248142 [details] [review]
gdk: Fix shaped toplevels

We need to apply the shape for toplevels that have a shape.
Comment 3 Alexander Larsson 2013-07-01 13:34:51 UTC
Attachment 248142 [details] pushed as 09a975a - gdk: Fix shaped toplevels