-
Notifications
You must be signed in to change notification settings - Fork 187
[GTK] Don't invalidate style context when setting background color #2702 #2786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
This is definitely a risky change, but perhaps it inspires someone. |
|
@ptziegler can you explain why you think it is risky and what the invalidate do? Will it simply "repaint" the control somehow? From what you describe it seems one only want to process such invalidate after all events are processed, so maybe one should check if the event queue is empty and if not schedule it (again) async? |
By invalidating the style context asynchronously, I'm putting a lot of faith into the assumption that the context pointer is still valid at that point. The check whether the widget is disposed is just a workaround. Also as pointed out in #2702 (comment), invalidating the context asynchronously doesn't make much sense when it is automatically invalidated by GTK. So it will likely cause the same issues that were caused when the line was simply removed.
I'm really not an expert on GTK, but I think it simply "applies" the CSS style. Meaning updating the colors and bounds of the widget. In some of the tests that failed because of this, you got assertion errors like: Which sounds like the style was not updated in time.
At least as simple Perhaps styling should be done asynchronously after activation? But that probably introduces a completely different set of problems... |
|
I am more and more convinced that dropping invalidate (no immediate styling effect) in next cycle and see what(if anything) breaks. Gtk 4.x no longer even have the invalidate so there must be a way to work without it, and newer Gtk versions (since the time invalidate call was introduced) should be less fragile to styling. |
....tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Issue2702_DoubleClickBehavior.java
Show resolved
Hide resolved
…lipse-platform#2702 When setting the background color while inside an SWT.Activate event, pending events are not processed. The gtk_style_context_invalidate() method is deprecated in GTK3 and doesn't have a GTK4 counterpart, as GTK invalidates the style context automatically. With b7dee8a, this method call was already removed, but later reverted due to test failures in the Eclipse Platform. Rather than removing all references, this change only does so for the call to setBackground(). To reproduce, execute the Snippet388. When clicking on a tree/table item, the item should be selected. This is the current behavior on Windows and MacOS, but not on Linux. Closes eclipse-platform#2702
|
Merging so it has maximum amount of test period. |
When setting the background color while inside an SWT.Activate event, pending events are not processed.
The gtk_style_context_invalidate() method is deprecated in GTK3 and doesn't have a GTK4 counterpart, as GTK invalidates the style context automatically.
With b7dee8a, this method call was already removed, but later reverted due to test failures in the Eclipse Platform. Rather than removing all references, this change only does so for the call to setBackground().
To reproduce, execute the Snippet388. When clicking on a tree/table item, the item should be selected. This is the current behavior on Windows and MacOS, but not on Linux.
Closes #2702