Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.swt')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c38
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h2
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java18
7 files changed, 87 insertions, 3 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 fbf6860c3d..c894731cfe 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
@@ -18731,6 +18731,26 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1name)
}
#endif
+#ifndef NO__1gtk_1widget_1get_1opacity
+JNIEXPORT jdouble JNICALL OS_NATIVE(_1gtk_1widget_1get_1opacity)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jdouble rc = 0;
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1get_1opacity_FUNC);
+/*
+ rc = (jdouble)gtk_widget_get_opacity((GtkWidget *)arg0);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_get_opacity)
+ if (fp) {
+ rc = (jdouble)((jdouble (CALLING_CONVENTION*)(GtkWidget *))fp)((GtkWidget *)arg0);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1get_1opacity_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gtk_1widget_1get_1pango_1context
JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1widget_1get_1pango_1context)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -19558,6 +19578,24 @@ fail:
}
#endif
+#ifndef NO__1gtk_1widget_1set_1opacity
+JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1opacity)
+ (JNIEnv *env, jclass that, jintLong arg0, jdouble arg1)
+{
+ OS_NATIVE_ENTER(env, that, _1gtk_1widget_1set_1opacity_FUNC);
+/*
+ gtk_widget_set_opacity((GtkWidget *)arg0, arg1);
+*/
+ {
+ OS_LOAD_FUNCTION(fp, gtk_widget_set_opacity)
+ if (fp) {
+ ((void (CALLING_CONVENTION*)(GtkWidget *, jdouble))fp)((GtkWidget *)arg0, arg1);
+ }
+ }
+ OS_NATIVE_EXIT(env, that, _1gtk_1widget_1set_1opacity_FUNC);
+}
+#endif
+
#ifndef NO__1gtk_1widget_1set_1parent_1window
JNIEXPORT void JNICALL OS_NATIVE(_1gtk_1widget_1set_1parent_1window)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index a4f40497f5..23fd7e824b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -190,6 +190,8 @@
#define NO__1gdk_1rgba_1to_1string
#define NO__1gdk_1rgba_1parse
#define NO__1gtk_1scrollable_1get_1vadjustment
+#define NO__1gtk_1widget_1set_1opacity
+#define NO__1gtk_1widget_1get_1opacity
#define NO__1g_1object_1set__I_3BLorg_eclipse_swt_internal_gtk_GdkRGBA_2I
#define NO__1g_1object_1set__J_3BLorg_eclipse_swt_internal_gtk_GdkRGBA_2J
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 8bbc233da8..f590863e3a 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
@@ -117,6 +117,8 @@
#define g_variant_new_uint64_LIB LIB_GIO
#define g_variant_n_children_LIB LIB_GIO
#define gtk_widget_set_allocation_LIB LIB_GTK
+#define gtk_widget_set_opacity_LIB LIB_GTK
+#define gtk_widget_get_opacity_LIB LIB_GTK
#define gtk_adjustment_configure_LIB LIB_GTK
#define gtk_adjustment_get_lower_LIB LIB_GTK
#define gtk_adjustment_get_page_increment_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 27d4353863..b686351946 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
@@ -1395,6 +1395,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1get_1mapped",
"_1gtk_1widget_1get_1modifier_1style",
"_1gtk_1widget_1get_1name",
+ "_1gtk_1widget_1get_1opacity",
"_1gtk_1widget_1get_1pango_1context",
"_1gtk_1widget_1get_1parent",
"_1gtk_1widget_1get_1parent_1window",
@@ -1445,6 +1446,7 @@ char * OS_nativeFunctionNames[] = {
"_1gtk_1widget_1set_1has_1window",
"_1gtk_1widget_1set_1mapped",
"_1gtk_1widget_1set_1name",
+ "_1gtk_1widget_1set_1opacity",
"_1gtk_1widget_1set_1parent_1window",
"_1gtk_1widget_1set_1receives_1default",
"_1gtk_1widget_1set_1redraw_1on_1allocate",
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 47ec1d6f8a..bbe3647672 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
@@ -1405,6 +1405,7 @@ typedef enum {
_1gtk_1widget_1get_1mapped_FUNC,
_1gtk_1widget_1get_1modifier_1style_FUNC,
_1gtk_1widget_1get_1name_FUNC,
+ _1gtk_1widget_1get_1opacity_FUNC,
_1gtk_1widget_1get_1pango_1context_FUNC,
_1gtk_1widget_1get_1parent_FUNC,
_1gtk_1widget_1get_1parent_1window_FUNC,
@@ -1455,6 +1456,7 @@ typedef enum {
_1gtk_1widget_1set_1has_1window_FUNC,
_1gtk_1widget_1set_1mapped_FUNC,
_1gtk_1widget_1set_1name_FUNC,
+ _1gtk_1widget_1set_1opacity_FUNC,
_1gtk_1widget_1set_1parent_1window_FUNC,
_1gtk_1widget_1set_1receives_1default_FUNC,
_1gtk_1widget_1set_1redraw_1on_1allocate_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 9d8a8f3840..7686bedad7 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
@@ -15027,6 +15027,32 @@ public static final void gtk_widget_set_name(long /*int*/ widget, byte[] name) {
}
}
/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ */
+public static final native void _gtk_widget_set_opacity(long /*int*/ widget, double opacity);
+public static final void gtk_widget_set_opacity(long /*int*/ widget, double opacity) {
+ lock.lock();
+ try {
+ _gtk_widget_set_opacity(widget, opacity);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
+ * @method flags=dynamic
+ * @param widget cast=(GtkWidget *)
+ */
+public static final native double _gtk_widget_get_opacity(long /*int*/ widget);
+public static final double gtk_widget_get_opacity(long /*int*/ widget) {
+ lock.lock();
+ try {
+ return _gtk_widget_get_opacity(widget);
+ } finally {
+ lock.unlock();
+ }
+}
+/**
* @param widget cast=(GtkWidget *)
* @param redraw cast=(gboolean)
*/
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index 823de0a1b0..6dc94bb5af 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1011,7 +1011,11 @@ void forceResize (int width, int height) {
public int getAlpha () {
checkWidget ();
if (OS.gtk_widget_is_composited (shellHandle)) {
- return (int) (OS.gtk_window_get_opacity (shellHandle) * 255);
+ /*
+ * Feature in GTK: gtk_window_get_opacity() is deprecated on GTK3.8
+ * onward. Use gtk_widget_get_opacity() instead.
+ */
+ return (int) (OS.GTK_VERSION > OS.VERSION (3, 8, 0) ? OS.gtk_widget_get_opacity(shellHandle) * 255 : OS.gtk_window_get_opacity (shellHandle) * 255);
}
return 255;
}
@@ -1839,8 +1843,16 @@ void setActiveControl (Control control, int type) {
public void setAlpha (int alpha) {
checkWidget ();
if (OS.gtk_widget_is_composited (shellHandle)) {
- alpha &= 0xFF;
- OS.gtk_window_set_opacity (shellHandle, alpha / 255f);
+ /*
+ * Feature in GTK: gtk_window_set_opacity() is deprecated on GTK3.8
+ * onward. Use gtk_widget_set_opacity() instead.
+ */
+ if (OS.GTK_VERSION > OS.VERSION (3, 8, 0)) {
+ OS.gtk_widget_set_opacity (shellHandle, (double) alpha / 255);
+ } else {
+ alpha &= 0xFF;
+ OS.gtk_window_set_opacity (shellHandle, alpha / 255f);
+ }
}
}

Back to the top