Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 508599 - [GTK3] Widget.setRegion not supported under Linux
Summary: [GTK3] Widget.setRegion not supported under Linux
Status: CLOSED DUPLICATE of bug 529431
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 4.7   Edit
Hardware: PC Linux
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-02 06:44 EST by Lars Vogel CLA
Modified: 2018-01-30 14:45 EST (History)
8 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2016-12-02 06:44:17 EST
Snippet294 is supposed to create a non-rectangular button. Works fine on Windows but not on Linux.
Comment 1 Ian Pun CLA 2017-03-01 16:05:45 EST
Upon investigation, this bug only happens in GTK3, and not GTK2.

However, the reasoning behind why this doesn't work anymore is actually a design change by the GTK+ library. Currently, setRegion() calls use gtk_widget_shape_combine_region() to grab the GDKWindow that the button is drawing to and add the region layer on it, changing the shape. GTK3 has so that widgets are not drawn on the GDKWindow layer anymore, meaning the  gdk_window_shape_combine_region() call is not working.

After some discussion with the GTK team, we should not be changing the GTKButton shape in the first place as GTK3 focus is for us to use CSS for any styling. CSS has big limitations to what we can do, especially changing what a buttons shape is. In order to do so, we would have to create a custom widget instead to support setRegion for buttons, which is not an easy or quick task to do for which otherwise our current implementation of button is working fine. I don't believe this is a big enough problem to proportion time into re-implementing unfortunately.
Comment 2 Andrey Loskutov CLA 2017-03-01 16:20:20 EST
(In reply to Ian Pun from comment #1)
> After some discussion with the GTK team, we should not be changing the
> GTKButton shape in the first place 

I *love* to read such statements from GTK team, they always know better what is good for all their clients.

> as GTK3 focus is for us to use CSS for
> any styling.

Do you mean GTK3 CSS or e4 CSS? I guess GTK3 one, which will add even more code working only with a specific GTK3 version, sometimes, may be, on some Linux distros, until the next minor GTK3 version...

> CSS has big limitations to what we can do, especially changing
> what a buttons shape is. In order to do so, we would have to create a custom
> widget instead to support setRegion for buttons, which is not an easy or
> quick task to do for which otherwise our current implementation of button is
> working fine. I don't believe this is a big enough problem to proportion
> time into re-implementing unfortunately.

Sad to hear that. SWT and cross-platform development is becoming really hard. I know that this is not your fault, and that resources are limited, it is just really disappointing to see all that GTK3 issues.
Comment 3 Lars Vogel CLA 2017-03-09 05:57:29 EST
Looks to me that Labels have the same issue. Ian is this a general issue for all widgets running under GTK?
Comment 4 Ian Pun CLA 2017-03-09 11:06:45 EST
(In reply to Lars Vogel from comment #3)
> Looks to me that Labels have the same issue. Ian is this a general issue for
> all widgets running under GTK?

Yes it is unfortunately. All widgets in GTK3 have moved away on drawing on GDKWindow so, in that effect, it doesnt work.
Comment 5 Lars Vogel CLA 2017-03-10 05:20:24 EST
IMHO this is a major issue, as it affects cross-platform development. It is also a regression as it worked with GTK2.
Comment 6 Ian Pun CLA 2017-03-14 11:54:07 EDT
(In reply to Lars Vogel from comment #5)
> IMHO this is a major issue, as it affects cross-platform development. It is
> also a regression as it worked with GTK2.

I think this is a pretty big issue, but it's very difficult to fix as we are heavily limited by the changes in the new GTK3 libraries. Lars, do you have any suggestions at what we could do to resupport this besides building more custom widgets?
Comment 7 Eric Williams CLA 2018-01-30 14:45:37 EST

*** This bug has been marked as a duplicate of bug 529431 ***