Fix PaintListener for GTK3 Table and Tree widgets #3291
Merged
akurtakov merged 1 commit intoeclipse-platform:masterfrom May 8, 2026
Merged
Fix PaintListener for GTK3 Table and Tree widgets #3291akurtakov merged 1 commit intoeclipse-platform:masterfrom
akurtakov merged 1 commit intoeclipse-platform:masterfrom
Conversation
GTK3 emits two draw-related signals: * EXPOSE_EVENT_INVERSE (after=false) → before GTK draws items * EXPOSE_EVENT (after=true) → after GTK draws items SWT historically dispatched SWT.Paint during EXPOSE_EVENT_INVERSE. For widgets like Table and Tree, GTK draws all rows/cells after this point. Result: anything drawn in a PaintListener was immediately overwritten.
There was a problem hiding this comment.
Pull request overview
This PR addresses GTK3-specific paint ordering for Table and Tree so that SWT.Paint listener drawing occurs after GTK has rendered rows/cells, preventing listener output from being overwritten (fixing #3285).
Changes:
- On GTK3, stop dispatching the inherited
gtk_draw()paint path forTable/Treeand instead defer SWT paint handling. - Invoke an explicit GTK3 paint dispatch (
gtk3_paintEvent(...)) fromwindowProc(...)onEXPOSE_EVENT(after GTK item drawing). - Add a shared-by-copy helper method in each widget to construct the
GCand fireSWT.Paintwith proper bounds/clipping.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java | Defers GTK3 SWT.Paint firing until after GTK renders tree items by adding an explicit paint dispatch in windowProc. |
| bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java | Defers GTK3 SWT.Paint firing until after GTK renders table items by adding an explicit paint dispatch in windowProc. |
Contributor
Member
Author
|
@tmssngr I would appreciate your testing of this one. |
Member
|
Regarding that |
Member
Author
Checking scale factor before returning without doing anything more totally doesn't make sense to me. |
Contributor
|
Looks good so far (I see my drawn text). |
Contributor
Member
Author
|
Calculating client area is totally different problem. I'm merging this one . |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


GTK3 emits two draw-related signals:
SWT historically dispatched SWT.Paint during EXPOSE_EVENT_INVERSE.
For widgets like Table and Tree, GTK draws all rows/cells after this point.
Result: anything drawn in a PaintListener was immediately overwritten.
Fixes #3285