Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2018-01-16 21:46:55 +0000
committerLeo Ufimtsev2018-01-18 02:05:02 +0000
commitc335e1d1f3363d6b3668013e0b9897acb09559d1 (patch)
tree450182b361c63b6eaaad575b1fd4cf0bc82fa0f2 /bundles/org.eclipse.swt/Eclipse SWT PI/gtk
parentb2fae589b777bcddc3ad5602aa371895abd884e8 (diff)
downloadeclipse.platform.swt-c335e1d1f3363d6b3668013e0b9897acb09559d1.tar.gz
eclipse.platform.swt-c335e1d1f3363d6b3668013e0b9897acb09559d1.tar.xz
eclipse.platform.swt-c335e1d1f3363d6b3668013e0b9897acb09559d1.zip
Bug 528414 (swtWaylandLauncher) Part 1.2 : Polishing of SWT GDBus
Not a prereq to launcher patch, but nice to merge. - Mostly polish. No real functional change to existing functionality. - Clarified code that was confusing when there was an issue. - Added documentation with samples. - Added/tested support for Boolean and Integer to GDBus implementation, I initially was planning on using them for ping method, but later discovered that I could use DBus's standard Peer.Ping method. However, Boolean/Integer handling might come in handy in the future, since I developed/tested it, we might as well add it. - Minor bug-fixes here and there. Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=528414 Change-Id: I201ce2bfd71afb563d3463f2f8ce980422423a8d Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
Diffstat (limited to 'bundles/org.eclipse.swt/Eclipse SWT PI/gtk')
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h1
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java31
4 files changed, 44 insertions, 1 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 d6b860ef94..21535dfb98 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
@@ -3858,6 +3858,18 @@ JNIEXPORT jdouble JNICALL OS_NATIVE(_1g_1variant_1get_1double)
}
#endif
+#ifndef NO__1g_1variant_1get_1int32
+JNIEXPORT jint JNICALL OS_NATIVE(_1g_1variant_1get_1int32)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jint rc = 0;
+ OS_NATIVE_ENTER(env, that, _1g_1variant_1get_1int32_FUNC);
+ rc = (jint)g_variant_get_int32((GVariant *)arg0);
+ OS_NATIVE_EXIT(env, that, _1g_1variant_1get_1int32_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1g_1variant_1get_1string
JNIEXPORT jintLong JNICALL OS_NATIVE(_1g_1variant_1get_1string)
(JNIEnv *env, jclass that, jintLong arg0, jlongArray arg1)
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 f5bc1cc4c0..2e67575423 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
@@ -388,6 +388,7 @@ char * OS_nativeFunctionNames[] = {
"_1g_1variant_1get_1byte",
"_1g_1variant_1get_1child_1value",
"_1g_1variant_1get_1double",
+ "_1g_1variant_1get_1int32",
"_1g_1variant_1get_1string",
"_1g_1variant_1get_1type",
"_1g_1variant_1get_1type_1string",
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 41480bd6d2..61a1ca03e1 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
@@ -398,6 +398,7 @@ typedef enum {
_1g_1variant_1get_1byte_FUNC,
_1g_1variant_1get_1child_1value_FUNC,
_1g_1variant_1get_1double_FUNC,
+ _1g_1variant_1get_1int32_FUNC,
_1g_1variant_1get_1string_FUNC,
_1g_1variant_1get_1type_FUNC,
_1g_1variant_1get_1type_1string_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 db7a6fce50..126bad80b3 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
@@ -106,11 +106,19 @@ public class OS extends C {
}
}
+ public static final String GDBUS_SYSTEM_PROPERTY = "swt.dbus.init";
+
// Bug 519124
static {
String swt_lib_versions = getEnvironmentalVariable (OS.SWT_LIB_VERSIONS); // Note, this is read in multiple places.
if (swt_lib_versions != null && swt_lib_versions.equals("1")) {
- System.out.println("SWT_LIB_Gtk:"+gtk_major_version()+"."+gtk_minor_version()+"."+gtk_micro_version());
+ System.out.print("SWT_LIB_Gtk:"+gtk_major_version()+"."+gtk_minor_version()+"."+gtk_micro_version());
+ if (System.getProperty(GDBUS_SYSTEM_PROPERTY) != null) {
+ System.out.print(" (DBus enabled)");
+ } else {
+ System.out.print(" (DBus dissabled)");
+ }
+ System.out.print("\n");
}
}
@@ -587,6 +595,8 @@ public class OS extends C {
/** @category gdbus */
public static final String DBUS_TYPE_STRING_ARRAY = "as";
/** @category gdbus */
+ public static final String DBUS_TYPE_INT32 = "i";
+ /** @category gdbus */
public static final String DBUS_TYPE_DOUBLE = "d";
/** @category gdbus */
public static final String DBUS_TYPE_STRUCT = "r"; // Not used by Dbus, but implemented by GDBus.
@@ -608,6 +618,8 @@ public class OS extends C {
/** @category gdbus */
public static final byte[] G_VARIANT_TYPE_STRING = ascii(DBUS_TYPE_STRING);
/** @category gdbus */
+ public static final byte[] G_VARIANT_TYPE_IN32 = ascii(DBUS_TYPE_INT32);
+ /** @category gdbus */
public static final byte[] G_VARIANT_TYPE_DOUBLE = ascii(DBUS_TYPE_DOUBLE);
/** @category gdbus */
public static final byte[] G_VARIANT_TYPE_TUPLE = ascii(DBUS_TYPE_STRUCT);
@@ -16782,6 +16794,23 @@ public static final long /*int*/ g_variant_new_int32 (int intval) {
}
}
+
+/**
+ * @param gvariant cast=(GVariant *)
+ * @category gdbus
+ * @return int
+ */
+public static final native int _g_variant_get_int32 (long /*int*/ gvariant);
+/** @category gdbus */
+public static final int g_variant_get_int32 (long /*int*/ gvariant) {
+ lock.lock();
+ try {
+ return _g_variant_get_int32 (gvariant);
+ } finally {
+ lock.unlock();
+ }
+}
+
/**
* @param gvariant cast=(GVariant *)
* @category gdbus

Back to the top