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 793194 - gdk_window_shape_combine_region() doesn't work on GTK3.10+
gdk_window_shape_combine_region() doesn't work on GTK3.10+
Status: RESOLVED OBSOLETE
Product: gtk+
Classification: Platform
Component: .General
3.22.x
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2018-02-05 16:32 UTC by Eric Williams
Modified: 2018-05-02 19:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Sample snippet to reproduce the issue (30.00 KB, application/gzip)
2018-02-05 16:32 UTC, Eric Williams
Details
Pure GTK snippet (no custom container) (1.86 KB, text/x-csrc)
2018-03-19 14:55 UTC, Eric Williams
Details

Description Eric Williams 2018-02-05 16:32:51 UTC
Created attachment 367924 [details]
Sample snippet to reproduce the issue

I am trying to change the shape of a GtkButton widget using a cairo region and gdk_window_shape_combine_region(). 

On GTK3.8 this worked fine. However as of GTK3.10+ it no longer works as expected. I bisected and found the commit that broke it: https://github.com/GNOME/gtk/commit/d22fd7223c75f4720ddb982c659efb0d8d7543c4

I've attached a sample snippet, including our custom container. Just extract the archive, make, and then run the snippet "simple_button_app".

On 3.10+ the button is fully visible but the area that should be obscured is not clickable. This affects both the Wayland and X11 backends. I've found a workaround whereby I call gdk_window_ensure_native() before gdk_window_shape_combine_region() -- this works on X11. On Wayland it makes the whole button transparent, so I'm not sure this workaround is a good one.
Comment 1 Daniel Boles 2018-03-18 17:31:21 UTC
Are you able to distill this down to a minimal, single-file example? i.e. does the report depend on your SwtFixed widget in any way, or can you demonstrate it without that?
Comment 2 Eric Williams 2018-03-19 14:55:34 UTC
Created attachment 369869 [details]
Pure GTK snippet (no custom container)

(In reply to Daniel Boles from comment #1)
> Are you able to distill this down to a minimal, single-file example? i.e.
> does the report depend on your SwtFixed widget in any way, or can you
> demonstrate it without that?

Yes, I've attached a snippet.

I did speak to Benjamin about this issue on IRC and he said it's basically WONTFIX, as the bug stems from a fundamental change in the drawing model. I've worked around the issue by using cairo_clip(), but that doesn't solve the problem of the input handling: clicking the button in the shaped region shouldn't trigger events like "clicked" (this was the behaviour on GTK3.8).

I don't mind using cairo_clip(), but if there are any suggestions on how to block the input handling I would love to hear them. :)
Comment 3 GNOME Infrastructure Team 2018-05-02 19:50:09 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/gtk/issues/1026.