Skip to content

Commit e2eb09a

Browse files
committed
[GTK4] Fix Control.redraw
Control.redraw was not implemented due to no ability to invalidate a rectangle. This change marks the whole widget for redraw as this seems to be the only API that Gtk still provides. Fixes SWTChart scrolling.
1 parent 924aa75 commit e2eb09a

File tree

1 file changed

+3
-16
lines changed
  • bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets

1 file changed

+3
-16
lines changed

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

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4704,24 +4704,11 @@ void redrawChildren () {
47044704

47054705
void redrawWidget (int x, int y, int width, int height, boolean redrawAll, boolean all, boolean trim) {
47064706
if (!GTK.gtk_widget_get_realized(handle)) return;
4707-
GdkRectangle rect = new GdkRectangle ();
47084707
if (GTK.GTK4) {
4709-
long surface = paintSurface ();
4710-
if (redrawAll) {
4711-
int [] w = new int [1], h = new int [1];
4712-
gdk_surface_get_size (surface, w, h);
4713-
rect.width = w [0];
4714-
rect.height = h [0];
4715-
} else {
4716-
rect.x = x;
4717-
rect.y = y;
4718-
rect.width = Math.max (0, width);
4719-
rect.height = Math.max (0, height);
4720-
}
4721-
/* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
4722-
* invalid regions ourselves and do gdk_surface_queue_expose. Will need a different way to force redraws
4723-
* New "render" signal? */
4708+
// GTK4 has no ability to invalidate surfaces or regions/rectangle, mark the whole widget for redraw
4709+
GTK.gtk_widget_queue_draw(handle);
47244710
} else {
4711+
GdkRectangle rect = new GdkRectangle ();
47254712
long window = paintWindow ();
47264713
if (redrawAll) {
47274714
int [] w = new int [1], h = new int [1];

0 commit comments

Comments
 (0)