Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java31
1 files changed, 15 insertions, 16 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index 495b1d5563..5f41ce8f18 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -2305,20 +2305,19 @@ long /*int*/ gtk_expand_collapse_cursor_row (long /*int*/ widget, long /*int*/ l
return 0;
}
-void drawInheritedBackground (long /*int*/ eventPtr, long /*int*/ cairo) {
+void drawInheritedBackground (long /*int*/ cairo) {
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
Control control = findBackgroundControl ();
if (control != null) {
- long /*int*/ window = GTK.gtk_tree_view_get_bin_window (handle);
- long /*int*/ rgn = 0;
- if (eventPtr != 0) {
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, eventPtr, GdkEventExpose.sizeof);
- if (window != gdkEvent.window) return;
- rgn = gdkEvent.region;
- }
int [] width = new int [1], height = new int [1];
- gdk_window_get_size (window, width, height);
+ long /*int*/ gdkResource;
+ if (GTK.GTK4) {
+ gdkResource = gtk_widget_get_surface(handle);
+ gdk_surface_get_size (gdkResource, width, height);
+ } else {
+ gdkResource = GTK.gtk_tree_view_get_bin_window (handle);
+ gdk_window_get_size (gdkResource, width, height);
+ }
long /*int*/ parent = 0;
int itemCount = GTK.gtk_tree_model_iter_n_children (modelHandle, parent);
GdkRectangle rect = new GdkRectangle ();
@@ -2336,7 +2335,7 @@ void drawInheritedBackground (long /*int*/ eventPtr, long /*int*/ cairo) {
}
if (parent != 0) OS.g_free (parent);
if (height [0] > (rect.y + rect.height)) {
- drawBackground (control, window, cairo, rgn, 0, rect.y + rect.height, width [0], height [0] - (rect.y + rect.height));
+ drawBackground (control, gdkResource, cairo, 0, 0, rect.y + rect.height, width [0], height [0] - (rect.y + rect.height));
}
}
}
@@ -2360,7 +2359,7 @@ long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
GTK.gtk_widget_queue_draw(handle);
return 0;
}
- drawInheritedBackground (0, cairo);
+ drawInheritedBackground (cairo);
return super.gtk_draw (widget, cairo);
}
@@ -4134,11 +4133,11 @@ long /*int*/ windowProc (long /*int*/ handle, long /*int*/ arg0, long /*int*/ us
if ((state & PARENT_BACKGROUND) != 0 || backgroundImage != null) {
Control control = findBackgroundControl ();
if (control != null) {
- GdkEventExpose gdkEvent = new GdkEventExpose ();
- OS.memmove (gdkEvent, arg0, GdkEventExpose.sizeof);
long /*int*/ window = GTK.gtk_tree_view_get_bin_window (handle);
- if (window == gdkEvent.window) {
- drawBackground (control, window, gdkEvent.region, gdkEvent.area_x, gdkEvent.area_y, gdkEvent.area_width, gdkEvent.area_height);
+ if (window == GTK.gtk_widget_get_window(handle)) {
+ GdkRectangle rect = new GdkRectangle ();
+ GDK.gdk_cairo_get_clip_rectangle (arg0, rect);
+ drawBackground (control, window, arg0, 0, rect.x, rect.y, rect.width, rect.height);
}
}
}

Back to the top