Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk/org')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java23
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java19
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java65
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java10
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java61
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java8
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java8
11 files changed, 160 insertions, 88 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 08156d243b..f6a17ebcae 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -704,20 +704,31 @@ protected void init () {
/* Initialize the system font slot */
long [] defaultFontArray = new long [1];
- long defaultFont;
+ long defaultFont = 0;
long context = GTK.gtk_widget_get_style_context (shellHandle);
if ("ppc64le".equals(System.getProperty("os.arch"))) {
defaultFont = GTK.gtk_style_context_get_font (context, GTK.GTK_STATE_FLAG_NORMAL);
} else {
- GTK.gtk_style_context_save(context);
- GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL);
if (GTK.GTK4) {
- GTK.gtk_style_context_get(context, GTK.gtk_style_property_font, defaultFontArray, 0);
+ long[] fontPtr = new long[1];
+ long settings = GTK.gtk_settings_get_default ();
+ OS.g_object_get (settings, GTK.gtk_style_property_font, fontPtr, 0);
+ if (fontPtr[0] != 0) {
+ int length = C.strlen(fontPtr[0]);
+ if (length != 0) {
+ byte[] fontString = new byte [length + 1];
+ C.memmove(fontString, fontPtr[0], length);
+ OS.g_free(fontPtr[0]);
+ defaultFont = OS.pango_font_description_from_string(fontString);
+ }
+ }
} else {
+ GTK.gtk_style_context_save(context);
+ GTK.gtk_style_context_set_state(context, GTK.GTK_STATE_FLAG_NORMAL);
GTK.gtk_style_context_get(context, GTK.GTK_STATE_FLAG_NORMAL, GTK.gtk_style_property_font, defaultFontArray, 0);
+ GTK.gtk_style_context_restore(context);
+ defaultFont = defaultFontArray [0];
}
- GTK.gtk_style_context_restore(context);
- defaultFont = defaultFontArray [0];
}
defaultFont = OS.pango_font_description_copy (defaultFont);
Point dpi = getDPI(), screenDPI = getScreenDPI();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index 38f1f0e032..7c31f411c0 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -180,15 +180,27 @@ public GC(Drawable drawable, int style) {
if (drawable == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
GCData data = new GCData();
data.style = checkStyle(style);
- long gdkGC = drawable.internal_new_GC(data);
Device device = data.device;
if (device == null) device = Device.getDevice();
if (device == null) SWT.error(SWT.ERROR_NULL_ARGUMENT);
this.device = data.device = device;
+
+ long gdkGC = drawable.internal_new_GC(data);
init(drawable, data, gdkGC);
init();
}
+/**
+ * Ensure that the style specified is either LEFT_TO_RIGHT <b>or</b> RIGHT_TO_LEFT.
+ *
+ * @param style the SWT style bit string
+ * @return If only one style is specified, it is return unmodified. If both styles are specified, returns LEFT_TO_RIGHT
+ */
+int checkStyle(int style) {
+ if ((style & SWT.LEFT_TO_RIGHT) != 0) style &= ~SWT.RIGHT_TO_LEFT;
+ return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
+}
+
static void addCairoString(long cairo, String string, float x, float y, Font font) {
byte[] buffer = Converter.wcsToMbcs(string, true);
long layout = OS.pango_cairo_create_layout(cairo);
@@ -204,11 +216,6 @@ static void addCairoString(long cairo, String string, float x, float y, Font fon
OS.g_object_unref(layout);
}
-static int checkStyle (int style) {
- if ((style & SWT.LEFT_TO_RIGHT) != 0) style &= ~SWT.RIGHT_TO_LEFT;
- return style & (SWT.LEFT_TO_RIGHT | SWT.RIGHT_TO_LEFT);
-}
-
/**
* Convenience method that applies a region to the Control using cairo_clip.
*
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
index 287297a64d..b5ef710651 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Button.java
@@ -1065,13 +1065,18 @@ public void setImage (Image image) {
if ((style & SWT.ARROW) != 0) return;
if (imageList != null) imageList.dispose ();
imageList = null;
+
if (image != null) {
- if (image.isDisposed()) error (SWT.ERROR_INVALID_ARGUMENT);
- imageList = new ImageList ();
- imageList.add (image);
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
+ imageList = new ImageList();
+ int index = imageList.add(image);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(index));
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
}
this.image = image;
updateWidgetsVisibility();
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index fea3cbe312..2c0a9e0cd7 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -162,23 +162,6 @@ public Control (Composite parent, int style) {
createWidget (0);
}
-void connectPaint () {
- long paintHandle = paintHandle ();
- if (GTK.GTK4 && hooksPaint()) {
- long widgetClass = GTK.GTK_WIDGET_GET_CLASS(paintHandle);
- GtkWidgetClass widgetClassStruct = new GtkWidgetClass ();
- OS.memmove(widgetClassStruct, widgetClass);
- widgetClassStruct.snapshot = display.snapshotDrawProc;
- OS.memmove(widgetClass, widgetClassStruct);
- } else if (!GTK.GTK4) {
- int paintMask = GDK.GDK_EXPOSURE_MASK;
- GTK.gtk_widget_add_events (paintHandle, paintMask);
- OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (EXPOSE_EVENT_INVERSE), false);
- OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (DRAW), true);
- OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [STYLE_UPDATED], 0, display.getClosure (STYLE_UPDATED), false);
- }
-}
-
Font defaultFont () {
return display.getSystemFont ();
}
@@ -420,7 +403,7 @@ void hookEvents () {
hookKeyboardAndFocusSignals(focusHandle);
hookMouseSignals(eventHandle());
hookWidgetSignals(focusHandle);
- connectPaint();
+ hookPaintSignals();
connectIMSignals();
/*Connect gesture signals */
@@ -535,6 +518,25 @@ private void hookWidgetSignals(long focusHandle) {
}
}
+private void hookPaintSignals() {
+ long paintHandle = paintHandle();
+
+ if (GTK.GTK4) {
+ long widgetClass = GTK.GTK_WIDGET_GET_CLASS(paintHandle());
+ GtkWidgetClass widgetClassStruct = new GtkWidgetClass();
+
+ OS.memmove(widgetClassStruct, widgetClass);
+ widgetClassStruct.snapshot = display.snapshotDrawProc;
+ OS.memmove(widgetClass, widgetClassStruct);
+ } else {
+ int paintMask = GDK.GDK_EXPOSURE_MASK;
+ GTK.gtk_widget_add_events (paintHandle, paintMask);
+ OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (EXPOSE_EVENT_INVERSE), false);
+ OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [DRAW], 0, display.getClosure (DRAW), true);
+ OS.g_signal_connect_closure_by_id (paintHandle, display.signalIds [STYLE_UPDATED], 0, display.getClosure (STYLE_UPDATED), false);
+ }
+}
+
private void connectIMSignals() {
long imHandle = imHandle();
if (imHandle != 0) {
@@ -2132,10 +2134,10 @@ public void addMouseWheelListener (MouseWheelListener listener) {
*/
public void addPaintListener(PaintListener listener) {
checkWidget();
- if (listener == null) error (SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener (listener);
- addListener(SWT.Paint,typedListener);
- if (GTK.GTK4) connectPaint();
+ if (listener == null) error(SWT.ERROR_NULL_ARGUMENT);
+
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Paint, typedListener);
}
/**
@@ -3921,6 +3923,25 @@ void cairoClipRegion (long cairo) {
@Override
long gtk_draw (long widget, long cairo) {
+ if (GTK.GTK4) {
+ if (!hooksPaint()) return 0;
+
+ GCData data = new GCData();
+ data.cairo = cairo;
+ GC gc = GC.gtk_new(this, data);
+
+ Event event = new Event();
+ event.count = 1;
+ event.gc = gc;
+
+ drawWidget(gc);
+ sendEvent(SWT.Paint, event);
+ gc.dispose();
+ event.gc = null;
+
+ return 0;
+ }
+
if (checkScaleFactor) {
long surface = Cairo.cairo_get_target(cairo);
if (surface != 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
index 38b4eaab66..3261958b3f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ExpandItem.java
@@ -655,15 +655,20 @@ public void setImage (Image image) {
super.setImage (image);
if (imageList != null) imageList.dispose ();
imageList = null;
+
if (image != null) {
- if (image.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
- imageList = new ImageList ();
- imageList.add (image);
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ if (image.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
+ imageList = new ImageList();
+ int index = imageList.add(image);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(index));
if (text.length () == 0) GTK.gtk_widget_hide (labelHandle);
GTK.gtk_widget_show (imageHandle);
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
GTK.gtk_widget_show (labelHandle);
GTK.gtk_widget_hide (imageHandle);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
index 69234ad959..ea1cd2d017 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Label.java
@@ -632,12 +632,16 @@ public void setImage (Image image) {
imageList = null;
if (image != null) {
imageList = new ImageList ();
- imageList.add (image);
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ int index = imageList.add(image);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(index));
GTK.gtk_widget_hide (labelHandle);
GTK.gtk_widget_show (imageHandle);
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
GTK.gtk_widget_show (labelHandle);
GTK.gtk_widget_hide (imageHandle);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 6d21967ad0..cfd172aaa8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -324,39 +324,42 @@ public ScrollBar getVerticalBar () {
@Override
long gtk_draw (long widget, long cairo) {
- /*
- * Draw events destined for an SwtFixed instance will sometimes
- * only be redrawing the scrollbars attached to it. GTK will send many
- * draw events to an SwtFixed instance if:
- * 1) that instance has overlay scrollbars attached to it, and
- * 2) the mouse has just left (leave-notify) that SwtFixed widget.
- *
- * Such extra draw events cause extra SWT.Paint events to be sent and
- * reduce performance. The fix is to check if the dirty region in need
- * of a redraw is the same region that the scroll bars occupy, and ignore
- * draw events that target such cases. See bug 546248.
- */
- boolean overlayScrolling = !OS.GTK_OVERLAY_SCROLLING_DISABLED;
- if (overlayScrolling && OS.G_OBJECT_TYPE(widget) == OS.swt_fixed_get_type()) {
- if ((style & SWT.V_SCROLL) != 0 && verticalBar != null) {
- GtkAllocation verticalBarAlloc = new GtkAllocation();
- GTK.gtk_widget_get_allocation(verticalBar.handle, verticalBarAlloc);
- GdkRectangle rect = new GdkRectangle();
- GDK.gdk_cairo_get_clip_rectangle(cairo, rect);
- if (rect.width == verticalBarAlloc.width && rect.height == verticalBarAlloc.height) {
- return 0;
+ if (!GTK.GTK4) {
+ /*
+ * Draw events destined for an SwtFixed instance will sometimes
+ * only be redrawing the scrollbars attached to it. GTK will send many
+ * draw events to an SwtFixed instance if:
+ * 1) that instance has overlay scrollbars attached to it, and
+ * 2) the mouse has just left (leave-notify) that SwtFixed widget.
+ *
+ * Such extra draw events cause extra SWT.Paint events to be sent and
+ * reduce performance. The fix is to check if the dirty region in need
+ * of a redraw is the same region that the scroll bars occupy, and ignore
+ * draw events that target such cases. See bug 546248.
+ */
+ boolean overlayScrolling = !OS.GTK_OVERLAY_SCROLLING_DISABLED;
+ if (overlayScrolling && OS.G_OBJECT_TYPE(widget) == OS.swt_fixed_get_type()) {
+ if ((style & SWT.V_SCROLL) != 0 && verticalBar != null) {
+ GtkAllocation verticalBarAlloc = new GtkAllocation();
+ GTK.gtk_widget_get_allocation(verticalBar.handle, verticalBarAlloc);
+ GdkRectangle rect = new GdkRectangle();
+ GDK.gdk_cairo_get_clip_rectangle(cairo, rect);
+ if (rect.width == verticalBarAlloc.width && rect.height == verticalBarAlloc.height) {
+ return 0;
+ }
}
- }
- if ((style & SWT.H_SCROLL) != 0 && horizontalBar != null) {
- GtkAllocation horizontalBarAlloc = new GtkAllocation();
- GTK.gtk_widget_get_allocation(horizontalBar.handle, horizontalBarAlloc);
- GdkRectangle rect = new GdkRectangle();
- GDK.gdk_cairo_get_clip_rectangle(cairo, rect);
- if (rect.width == horizontalBarAlloc.width && rect.height == horizontalBarAlloc.height) {
- return 0;
+ if ((style & SWT.H_SCROLL) != 0 && horizontalBar != null) {
+ GtkAllocation horizontalBarAlloc = new GtkAllocation();
+ GTK.gtk_widget_get_allocation(horizontalBar.handle, horizontalBarAlloc);
+ GdkRectangle rect = new GdkRectangle();
+ GDK.gdk_cairo_get_clip_rectangle(cairo, rect);
+ if (rect.width == horizontalBarAlloc.width && rect.height == horizontalBarAlloc.height) {
+ return 0;
+ }
}
}
}
+
return super.gtk_draw(widget, cairo);
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
index d0e2ce581c..ce366a9a02 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TabItem.java
@@ -401,10 +401,14 @@ public void setImage (Image image) {
imageList.put (imageIndex, image);
}
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(imageIndex));
GTK.gtk_widget_show (imageHandle);
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
GTK.gtk_widget_hide (imageHandle);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
index 6ec17dc097..af77df1448 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
@@ -631,10 +631,14 @@ public void setImage (Image image) {
}
int imageIndex = headerImageList.indexOf (image);
if (imageIndex == -1) imageIndex = headerImageList.add (image);
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, headerImageList.getPixbuf(imageIndex));
GTK.gtk_widget_show (imageHandle);
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
GTK.gtk_widget_hide (imageHandle);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index cee52d9cae..39d04ce6fd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -718,9 +718,9 @@ long gtk_enter_notify_event (long widget, long event) {
if (drawHotImage) {
ImageList imageList = parent.imageList;
if (imageList != null) {
- int index = imageList.indexOf (hotImage);
+ int index = imageList.indexOf(hotImage);
if (index != -1 && imageHandle != 0) {
- GTK.gtk_image_set_from_surface(imageHandle, hotImage.surface);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(index));
}
}
}
@@ -775,9 +775,9 @@ long gtk_leave_notify_event (long widget, long event) {
if (image != null) {
ImageList imageList = parent.imageList;
if (imageList != null) {
- int index = imageList.indexOf (image);
+ int index = imageList.indexOf(image);
if (index != -1 && imageHandle != 0) {
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(index));
}
}
}
@@ -1201,9 +1201,13 @@ void _setImage (Image image) {
imageList.put (imageIndex, image);
}
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, imageList.getPixbuf(imageIndex));
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
}
/*
* If Text/Image of a tool-item changes, then it is
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
index 5b851e509f..094ef4f5e8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
@@ -601,10 +601,14 @@ public void setImage (Image image) {
}
int imageIndex = headerImageList.indexOf (image);
if (imageIndex == -1) imageIndex = headerImageList.add (image);
- GTK.gtk_image_set_from_surface(imageHandle, image.surface);
+ GTK.gtk_image_set_from_pixbuf(imageHandle, headerImageList.getPixbuf(imageIndex));
GTK.gtk_widget_show (imageHandle);
} else {
- GTK.gtk_image_set_from_surface(imageHandle, 0);
+ if (GTK.GTK4) {
+ GTK.gtk_image_clear(imageHandle);
+ } else {
+ GTK.gtk_image_set_from_surface(imageHandle, 0);
+ }
GTK.gtk_widget_hide (imageHandle);
}
}

Back to the top