summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorAnatoly Spektor2012-10-05 14:43:48 (EDT)
committer Alexander Kurtakov2012-10-05 15:08:46 (EDT)
commit077815f21f4c006f679f782063ec7af635ece7f2 (patch)
treea2d29b2f11e773f6a8a04d6151f0d4fad9bcb14f
parent62c688e769f9a74f3b48ecff0633da531ba422d6 (diff)
downloadeclipse.platform.swt-077815f21f4c006f679f782063ec7af635ece7f2.zip
eclipse.platform.swt-077815f21f4c006f679f782063ec7af635ece7f2.tar.gz
eclipse.platform.swt-077815f21f4c006f679f782063ec7af635ece7f2.tar.bz2
Use gtk_render_focus instead of gtk_paint_focus for GTK+ 3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c102
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java60
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java17
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java18
9 files changed, 212 insertions, 5 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 8772232..ed75fb0 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
@@ -11466,7 +11466,15 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1paint_1focus)
OS_NATIVE_ENTER(env, that, _1gtk_1paint_1focus_FUNC);
if (arg3) if ((lparg3 = getGdkRectangleFields(env, arg3, &_arg3)) == NULL) goto fail;
if (arg5) if ((lparg5 = (*env)->GetByteArrayElements(env, arg5, NULL)) == NULL) goto fail;
- gtk_paint_focus((GtkStyle *)arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8, arg9);
+/*
+ gtk_paint_focus(arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8, arg9);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_paint_focus)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, GdkWindow *, jint, GdkRectangle *, GtkWidget *, const gchar *, jint, jint, jint, jint))fp)(arg0, (GdkWindow *)arg1, arg2, lparg3, (GtkWidget *)arg4, (const gchar *)lparg5, arg6, arg7, arg8, arg9);
+ }
+ }
fail:
if (arg5 && lparg5) (*env)->ReleaseByteArrayElements(env, arg5, lparg5, 0);
OS_NATIVE_EXIT(env, that, _1gtk_1paint_1focus_FUNC);
@@ -12860,6 +12868,24 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1background)
}
#endif
+#ifndef NO__1gtk_1render_1focus
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1focus)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1render_1focus_FUNC);
+/*
+ gtk_render_focus(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_render_focus)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong, gdouble, gdouble, gdouble, gdouble))fp)(arg0, arg1, (gdouble)arg2, (gdouble)arg3, (gdouble)arg4, (gdouble)arg5);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1render_1focus_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1render_1frame
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1render_1frame)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jdouble arg2, jdouble arg3, jdouble arg4, jdouble arg5)
@@ -13553,6 +13579,60 @@ JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1status_1icon_1set_1visible)
}
#endif
+#ifndef NO__1gtk_1style_1context_1restore
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1restore)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1style_1context_1restore_FUNC);
+/*
+ gtk_style_context_restore(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_style_context_restore)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1style_1context_1restore_FUNC);
+}
+#endif
+
+#ifndef NO__1gtk_1style_1context_1save
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1save)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1style_1context_1save_FUNC);
+/*
+ gtk_style_context_save(arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_style_context_save)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong))fp)(arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1style_1context_1save_FUNC);
+}
+#endif
+
+#ifndef NO__1gtk_1style_1context_1set_1state
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1context_1set_1state)
+ (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1style_1context_1set_1state_FUNC);
+/*
+ gtk_style_context_set_state(arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_style_context_set_state)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(jintLong, jintLong))fp)(arg0, arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1style_1context_1set_1state_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1style_1get_1base
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1style_1get_1base)
(JNIEnv *env, jclass that, jintLong arg0, jint arg1, jobject arg2)
@@ -16511,6 +16591,26 @@ fail:
}
#endif
+#ifndef NO__1gtk_1widget_1get_1state_1flags
+JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1state_1flags)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1state_1flags_FUNC);
+/*
+ rc = (jintLong)gtk_widget_get_state_flags((GtkWidget *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_get_state_flags)
+ if (fp) {
+ rc = (jintLong)((jintLong (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1state_1flags_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1widget_1get_1style
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1style)
(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 4ec00c8..fc3c7a8 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
@@ -216,6 +216,9 @@
#define gtk_scrolled_window_get_hscrollbar_LIB LIB_GTK
#define gtk_scrolled_window_get_vscrollbar_LIB LIB_GTK
#define gtk_scale_new_LIB LIB_GTK
+#define gtk_style_context_restore_LIB LIB_GTK
+#define gtk_style_context_save_LIB LIB_GTK
+#define gtk_style_context_set_state_LIB LIB_GTK
#define gtk_hscale_new_LIB LIB_GTK
#define gtk_vscale_new_LIB LIB_GTK
#define gtk_status_icon_get_geometry_LIB LIB_GTK
@@ -246,6 +249,7 @@
#define gtk_widget_get_style_context_LIB LIB_GTK
#define gtk_widget_get_tooltip_text_LIB LIB_GTK
#define gtk_widget_get_visible_LIB LIB_GTK
+#define gtk_widget_get_state_flags_LIB LIB_GTK
#define gtk_widget_has_focus_LIB LIB_GTK
#define gtk_widget_has_default_LIB LIB_GTK
#define gtk_widget_set_tooltip_text_LIB LIB_GTK
@@ -306,6 +310,7 @@
#define gtk_paint_box_LIB LIB_GTK
#define gtk_paint_box_gap_LIB LIB_GTK
#define gtk_paint_handle_LIB LIB_GTK
+#define gtk_paint_focus_LIB LIB_GTK
#define gtk_paint_hline_LIB LIB_GTK
#define gtk_paint_vline_LIB LIB_GTK
#define gtk_paint_flat_box_LIB LIB_GTK
@@ -382,6 +387,7 @@
#define gtk_printer_is_default_LIB LIB_GTK
#define gtk_render_handle_LIB LIB_GTK
#define gtk_render_line_LIB LIB_GTK
+#define gtk_render_focus_LIB LIB_GTK
#define gtk_render_frame_LIB LIB_GTK
#define gtk_render_frame_gap_LIB LIB_GTK
#define gtk_render_background_LIB LIB_GTK
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 b67091f..8fb7a15 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
@@ -953,6 +953,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1rc_1style_1set_1fg",
"_1gtk_1rc_1style_1set_1text",
"_1gtk_1render_1background",
+ "_1gtk_1render_1focus",
"_1gtk_1render_1frame",
"_1gtk_1render_1frame_1gap",
"_1gtk_1render_1handle",
@@ -1001,6 +1002,9 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1status_1icon_1set_1from_1pixbuf",
"_1gtk_1status_1icon_1set_1tooltip",
"_1gtk_1status_1icon_1set_1visible",
+ "_1gtk_1style_1context_1restore",
+ "_1gtk_1style_1context_1save",
+ "_1gtk_1style_1context_1set_1state",
"_1gtk_1style_1get_1base",
"_1gtk_1style_1get_1bg",
"_1gtk_1style_1get_1bg_1gc",
@@ -1262,6 +1266,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1get_1realized",
"_1gtk_1widget_1get_1sensitive",
"_1gtk_1widget_1get_1size_1request",
+ "_1gtk_1widget_1get_1state_1flags",
"_1gtk_1widget_1get_1style",
"_1gtk_1widget_1get_1style_1context",
"_1gtk_1widget_1get_1tooltip_1text",
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 17673d3..78c729d 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
@@ -963,6 +963,7 @@ typedef enum {
_1gtk_1rc_1style_1set_1fg_FUNC,
_1gtk_1rc_1style_1set_1text_FUNC,
_1gtk_1render_1background_FUNC,
+ _1gtk_1render_1focus_FUNC,
_1gtk_1render_1frame_FUNC,
_1gtk_1render_1frame_1gap_FUNC,
_1gtk_1render_1handle_FUNC,
@@ -1011,6 +1012,9 @@ typedef enum {
_1gtk_1status_1icon_1set_1from_1pixbuf_FUNC,
_1gtk_1status_1icon_1set_1tooltip_FUNC,
_1gtk_1status_1icon_1set_1visible_FUNC,
+ _1gtk_1style_1context_1restore_FUNC,
+ _1gtk_1style_1context_1save_FUNC,
+ _1gtk_1style_1context_1set_1state_FUNC,
_1gtk_1style_1get_1base_FUNC,
_1gtk_1style_1get_1bg_FUNC,
_1gtk_1style_1get_1bg_1gc_FUNC,
@@ -1272,6 +1276,7 @@ typedef enum {
_1gtk_1widget_1get_1realized_FUNC,
_1gtk_1widget_1get_1sensitive_FUNC,
_1gtk_1widget_1get_1size_1request_FUNC,
+ _1gtk_1widget_1get_1state_1flags_FUNC,
_1gtk_1widget_1get_1style_FUNC,
_1gtk_1widget_1get_1style_1context_FUNC,
_1gtk_1widget_1get_1tooltip_1text_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 6e8f2d0..adb834e 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
@@ -8648,7 +8648,7 @@ public static final void gtk_paint_flat_box(long /*int*/ style, long /*int*/ win
}
}
/**
- * @param style cast=(GtkStyle *)
+ * @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param area flags=no_out
* @param widget cast=(GtkWidget *)
@@ -8664,6 +8664,22 @@ public static final void gtk_paint_focus(long /*int*/ style, long /*int*/ window
}
}
/**
+* @method flags=dynamic
+* @param x cast=(gdouble)
+* @param y cast=(gdouble)
+* @param width cast=(gdouble)
+* @param height cast=(gdouble)
+*/
+public static final native void _gtk_render_focus(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height);
+public static final void gtk_render_focus(long /*int*/ context, long /*int*/ cr, double x , double y, double width, double height) {
+ lock.lock();
+ try {
+ _gtk_render_focus(context, cr, x, y, width, height);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @method flags=dynamic
* @param window cast=(GdkWindow *)
* @param widget cast=(GtkWidget *)
@@ -10079,6 +10095,48 @@ public static final void gtk_style_get_base(long /*int*/ style, int index, GdkCo
lock.unlock();
}
}
+/** @method flags=dynamic */
+public static final native void _gtk_style_context_save(long /*int*/ self);
+public static final void gtk_style_context_save(long /*int*/ self) {
+ lock.lock();
+ try {
+ _gtk_style_context_save(self);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
+public static final native void _gtk_style_context_restore(long /*int*/ context);
+public static final void gtk_style_context_restore(long /*int*/ context) {
+ lock.lock();
+ try {
+ _gtk_style_context_restore(context);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic
+ * @param self cast=(GtkWidget *)
+ * */
+public static final native long /*int*/ _gtk_widget_get_state_flags(long /*int*/ self);
+public static final long /*int*/ gtk_widget_get_state_flags(long /*int*/ self) {
+ lock.lock();
+ try {
+ return _gtk_widget_get_state_flags(self);
+ } finally {
+ lock.unlock();
+ }
+}
+/** @method flags=dynamic */
+public static final native void _gtk_style_context_set_state(long /*int*/ context, long /*int*/ flags);
+public static final void gtk_style_context_set_state(long /*int*/ context, long /*int*/ flags) {
+ lock.lock();
+ try {
+ _gtk_style_context_set_state(context,flags);
+ } finally {
+ lock.unlock();
+ }
+}
/**
* @param style cast=(GtkStyle *)
* @param color flags=no_in
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java
index a414103..10a43a5 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ButtonDrawData.java
@@ -204,7 +204,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
y += child_displacement_y;
}
- OS.gtk_paint_focus(gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
+ gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
}
if (clientArea != null) {
clientArea.x = bounds.x + border_width;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
index 7156184..0888aaf 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/DrawData.java
@@ -224,4 +224,21 @@ void gtk_render_layout (long /*int*/ style, long /*int*/ window, int state_type,
}
}
+void gtk_render_focus (long /*int*/ style, long /*int*/ window, int state_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int x , int y, int width, int height) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ long /*int*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_style_context_save (context);
+ OS.gtk_style_context_set_state (context, OS.gtk_widget_get_state_flags (widget));
+ Cairo.cairo_save (cairo);
+ OS.gtk_render_focus(context, cairo, x, y, width, height);
+ Cairo.cairo_restore (cairo);
+ OS.gtk_style_context_restore (context);
+ Cairo.cairo_destroy (cairo);
+
+ } else {
+ OS.gtk_paint_focus (style, window, state_type, area, widget, detail, x, y, width, height);
+ }
+}
+
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java
index a590c4b..adb13f8 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT Theme/gtk/org/eclipse/swt/internal/theme/ToolItemDrawData.java
@@ -157,7 +157,7 @@ void draw(Theme theme, GC gc, Rectangle bounds) {
y += child_displacement_y;
}
- OS.gtk_paint_focus(gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
+ gtk_render_focus (gtkStyle, drawable, state_type, null, buttonHandle, detail, x, y, width, height);
}
}
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 d1963ec..f2e4407 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
@@ -803,7 +803,7 @@ public void drawFocus(int x, int y, int width, int height) {
Cairo.cairo_restore(cairo);
return;
}
- OS.gtk_paint_focus(style, data.drawable, OS.GTK_STATE_NORMAL, null, data.device.shellHandle, new byte[1], x, y, width, height);
+ gtk_render_focus (style, data.drawable, OS.GTK_STATE_NORMAL, null, data.device.shellHandle, new byte[1], x, y, width, height);
}
/**
@@ -4204,4 +4204,20 @@ public String toString () {
return "GC {" + handle + "}";
}
+void gtk_render_focus (long /*int*/ style, long /*int*/ window, int state_type, GdkRectangle area, long /*int*/ widget, byte[] detail, int x , int y, int width, int height) {
+ if (OS.GTK_VERSION >= OS.VERSION(3, 2, 0)) {
+ long /*int*/ cairo = OS.gdk_cairo_create (window);
+ long /*int*/ context = OS.gtk_widget_get_style_context (style);
+ OS.gtk_style_context_save (context);
+ OS.gtk_style_context_set_state (context, OS.gtk_widget_get_state_flags (widget));
+ Cairo.cairo_save (cairo);
+ OS.gtk_render_focus(context, cairo, x, y, width, height);
+ Cairo.cairo_restore (cairo);
+ OS.gtk_style_context_restore (context);
+ Cairo.cairo_destroy(cairo);
+
+ } else {
+ OS.gtk_paint_focus (style, window, state_type, area, widget, detail, x, y, width, height);
+ }
+}
}