diff options
7 files changed, 61 insertions, 13 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 0e81dc1a78..2f94d5e6d7 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -10913,12 +10913,40 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1icon_1set_1render_1icon) { jintLong rc = 0; OS_NATIVE_ENTER(env, that, _1gtk_1icon_1set_1render_1icon_FUNC); +/* rc = (jintLong)gtk_icon_set_render_icon((GtkIconSet *)arg0, (GtkStyle *)arg1, (GtkTextDirection)arg2, (GtkStateType)arg3, (GtkIconSize)arg4, (GtkWidget *)arg5, (const char *)arg6); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_icon_set_render_icon) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkIconSet *, GtkStyle *, GtkTextDirection, GtkStateType, GtkIconSize, GtkWidget *, const char *))fp)((GtkIconSet *)arg0, (GtkStyle *)arg1, (GtkTextDirection)arg2, (GtkStateType)arg3, (GtkIconSize)arg4, (GtkWidget *)arg5, (const char *)arg6); + } + } OS_NATIVE_EXIT(env, that, _1gtk_1icon_1set_1render_1icon_FUNC); return rc; } #endif +#ifndef NO__1gtk_1icon_1set_1render_1icon_1pixbuf +JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1icon_1set_1render_1icon_1pixbuf) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1gtk_1icon_1set_1render_1icon_1pixbuf_FUNC); +/* + rc = (jintLong)gtk_icon_set_render_icon_pixbuf(arg0, arg1, arg2); +*/ + { + OS_LOAD_FUNCTION(fp, gtk_icon_set_render_icon_pixbuf) + if (fp) { + rc = (jintLong)((jintLong (CALLING_CONVENTION*)(jintLong, jintLong, jint))fp)(arg0, arg1, arg2); + } + } + OS_NATIVE_EXIT(env, that, _1gtk_1icon_1set_1render_1icon_1pixbuf_FUNC); + return rc; +} +#endif + #ifndef NO__1gtk_1icon_1source_1free JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1icon_1source_1free) (JNIEnv *env, jclass that, jintLong arg0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 1397d67831..b31bdcb80f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -160,6 +160,7 @@ #define gtk_label_set_line_wrap_mode_LIB LIB_GTK #define gtk_icon_info_load_icon_LIB LIB_GTK #define gtk_icon_info_free_LIB LIB_GTK +#define gtk_icon_set_render_icon_LIB LIB_GTK #define gtk_icon_theme_lookup_by_gicon_LIB LIB_GTK #define gdk_keyboard_ungrab_LIB LIB_GDK #define gtk_icon_theme_get_default_LIB LIB_GTK @@ -528,6 +529,7 @@ #define gdk_event_get_scroll_deltas_LIB LIB_GTK #define gtk_cell_renderer_set_fixed_size_LIB LIB_GTK #define gtk_cell_renderer_get_preferred_height_for_width_LIB LIB_GTK +#define gtk_icon_set_render_icon_pixbuf_LIB LIB_GTK /* Field accessors */ #if GTK_CHECK_VERSION(3,0,0) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index a92cc64691..6e2726097d 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -795,6 +795,7 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1icon_1info_1free", "_1gtk_1icon_1info_1load_1icon", "_1gtk_1icon_1set_1render_1icon", + "_1gtk_1icon_1set_1render_1icon_1pixbuf", "_1gtk_1icon_1source_1free", "_1gtk_1icon_1source_1new", "_1gtk_1icon_1source_1set_1pixbuf", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index 26abc01a06..f69c3663d1 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -805,6 +805,7 @@ typedef enum { _1gtk_1icon_1info_1free_FUNC, _1gtk_1icon_1info_1load_1icon_FUNC, _1gtk_1icon_1set_1render_1icon_FUNC, + _1gtk_1icon_1set_1render_1icon_1pixbuf_FUNC, _1gtk_1icon_1source_1free_FUNC, _1gtk_1icon_1source_1new_FUNC, _1gtk_1icon_1source_1set_1pixbuf_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 3a17218de7..617ecd5269 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -7965,6 +7965,7 @@ public static final void gtk_icon_source_set_pixbuf(long /*int*/ source, long /* } } /** + * @method flags=dynamic * @param icon_set cast=(GtkIconSet *) * @param style cast=(GtkStyle *) * @param direction cast=(GtkTextDirection) @@ -7982,6 +7983,19 @@ public static final long /*int*/ gtk_icon_set_render_icon(long /*int*/ icon_set, lock.unlock(); } } + +/** + * @method flags=dynamic + */ +public static final native long /*int*/ _gtk_icon_set_render_icon_pixbuf(long /*int*/ icon_set, long /*int*/ context, int size); +public static final long /*int*/ gtk_icon_set_render_icon_pixbuf(long /*int*/ icon_set, long /*int*/ context, int size) { + lock.lock(); + try { + return _gtk_icon_set_render_icon_pixbuf(icon_set, context, size); + } finally { + lock.unlock(); + } +} /** * @method flags=dynamic */ 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); |