Skip to content

Commit 56a6c40

Browse files
committed
[GTK4] Skip drawing of fixedHandle
The fixedHandle does not have any drawable components, and as written today, what gtk4_draw does on fixedHandle is draw the whole Widget, then Display.snapshotDrawProc iterates through all the children, of which the normal handle will be one (at least in StyledText case) and gtk4_draw will be called again on the same widget. This fixes caret drawing, because on the first time through gtk4_draw the caret is drawn, but then on the second time the gtk4_draw draws over the freshly drawn caret. This is option 1 in #2812 (comment) Fixes #2812
1 parent a0d6ffc commit 56a6c40

File tree

1 file changed

+10
-0
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets

1 file changed

+10
-0
lines changed

bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3834,7 +3834,17 @@ void cairoClipRegion (long cairo) {
38343834
eventRegion = actualRegion;
38353835
}
38363836

3837+
@Override
3838+
void snapshotToDraw(long handle, long snapshot) {
3839+
if (GTK.GTK4 && handle == fixedHandle) {
3840+
// The fixedHandle has nothing to draw itself, so skip drawing on this handle
3841+
// and let Display.snapshotDrawProc call gtk_widget_snapshot_child on
3842+
// the child widgets
3843+
return;
3844+
}
38373845

3846+
super.snapshotToDraw(handle, snapshot);
3847+
}
38383848

38393849
@Override
38403850
void gtk4_draw(long widget, long cairo, Rectangle bounds) {

0 commit comments

Comments
 (0)