summaryrefslogtreecommitdiffstats
path: root/bundles/org.eclipse.swt/Eclipse SWT/gtk
diff options
context:
space:
mode:
authorSilenio Quarti <silenio_quarti@ca.ibm.com>2012-12-06 12:09:00 -0500
committerSilenio Quarti <silenio_quarti@ca.ibm.com>2012-12-06 12:09:00 -0500
commit4863cf877cd1894e497640462c77762bca656d03 (patch)
treec4d577b663acd03d7994e4a21bfcd8e68dfcd6f1 /bundles/org.eclipse.swt/Eclipse SWT/gtk
parentbd8a9ab87a3ef6156a29a9504f7a31549bf3ba27 (diff)
downloadeclipse.platform.swt-4863cf877cd1894e497640462c77762bca656d03.tar.gz
eclipse.platform.swt-4863cf877cd1894e497640462c77762bca656d03.tar.xz
eclipse.platform.swt-4863cf877cd1894e497640462c77762bca656d03.zip
use gtk_icon_set_render_icon_pixbuf in GTK3
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT/gtk')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java16
2 files changed, 15 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index 8f61e8faf2..d7711423dc 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1065,11 +1065,15 @@ void createDisplay (DeviceData data) {
}
Image createImage (String name) {
- long /*int*/ style = OS.gtk_widget_get_default_style ();
byte[] buffer = Converter.wcsToMbcs (null, name, true);
- long /*int*/ pixbuf = OS.gtk_icon_set_render_icon (
- OS.gtk_icon_factory_lookup_default (buffer), style,
- OS.GTK_TEXT_DIR_NONE, OS.GTK_STATE_NORMAL, OS.GTK_ICON_SIZE_DIALOG, 0, 0);
+ long /*int*/ pixbuf, icon_set = OS.gtk_icon_factory_lookup_default (buffer);
+ if (OS.GTK3) {
+ pixbuf = OS.gtk_icon_set_render_icon_pixbuf(icon_set, OS.gtk_widget_get_style_context(shellHandle), OS.GTK_ICON_SIZE_DIALOG);
+ } else {
+ long /*int*/ style = OS.gtk_widget_get_default_style ();
+ pixbuf = OS.gtk_icon_set_render_icon (icon_set, style,
+ OS.GTK_TEXT_DIR_NONE, OS.GTK_STATE_NORMAL, OS.GTK_ICON_SIZE_DIALOG, 0, 0);
+ }
if (pixbuf == 0) return null;
int width = OS.gdk_pixbuf_get_width (pixbuf);
int height = OS.gdk_pixbuf_get_height (pixbuf);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
index 67662fd23e..56a4232c78 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolTip.java
@@ -513,15 +513,13 @@ void drawTooltip (long /*int*/ cr) {
case SWT.ICON_WARNING: buffer = Converter.wcsToMbcs (null, "gtk-dialog-warning", true); break;
}
if (buffer != null) {
- long /*int*/ style = OS.gtk_widget_get_default_style ();
- long /*int*/ pixbuf = OS.gtk_icon_set_render_icon (
- OS.gtk_icon_factory_lookup_default (buffer),
- style,
- OS.GTK_TEXT_DIR_NONE,
- OS.GTK_STATE_NORMAL,
- OS.GTK_ICON_SIZE_MENU,
- 0,
- 0);
+ long /*int*/ pixbuf, icon_set = OS.gtk_icon_factory_lookup_default (buffer);
+ if (OS.GTK3) {
+ pixbuf = OS.gtk_icon_set_render_icon_pixbuf(icon_set, OS.gtk_widget_get_style_context(handle), OS.GTK_ICON_SIZE_MENU);
+ } else {
+ long /*int*/ style = OS.gtk_widget_get_default_style ();
+ pixbuf = OS.gtk_icon_set_render_icon (icon_set, style, OS.GTK_TEXT_DIR_NONE, OS.GTK_STATE_NORMAL, OS.GTK_ICON_SIZE_MENU, 0, 0);
+ }
OS.gdk_cairo_set_source_pixbuf(cairo, pixbuf, x, y);
Cairo.cairo_paint (cairo);
OS.g_object_unref (pixbuf);