Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Ufimtsev2018-01-18 01:45:53 +0000
committerAlexander Kurtakov2018-01-18 10:00:34 +0000
commit5282e51a49c640f347e112faa9b2305ff5ed4111 (patch)
tree94269df599f1c3a7989ed232128095ecf2684fa9 /features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
parent0f594b4f96e383e0f8802a000fe4bfabfead093e (diff)
downloadrt.equinox.framework-5282e51a49c640f347e112faa9b2305ff5ed4111.tar.gz
rt.equinox.framework-5282e51a49c640f347e112faa9b2305ff5ed4111.tar.xz
rt.equinox.framework-5282e51a49c640f347e112faa9b2305ff5ed4111.zip
Bug 528414 (swtWaylandLauncher) Part 2: Replace x11 with gdbus
eclipseGtk.c overhaul replacing x11 machinery with gio's gdbus for wayland support. Results: - Launcher works on wayland - All x11 is gone (at least for gtk3). - Files no longer separated via colons. - Verified on Wayland (and x11). - Also added a makefile to accelerate future development efforts and make it more obvious on how to test launcher. Technical notes: - Old machinery used to set windowProperty via x11 atoms, files were separated via colons ':'. This had issues with local urls'. - New machinery checks if there is a session on: org.eclipse.swt and if so, it passes files via a gdbus array with each file being a separate item. (I.e, colons not used anymore). - The mutex/launcher window stuff was all related to x11. gdbus doesn't use that anymore, locks are internall to gtk/glib. - A few additional minor fixes/patches (code style etc...). Test Strategy: - Below were done on both Wayland and X11: - Fedora 27, Gtk3.22. (Probably works on gtk2, but not tested). 1) Open eclipse with file(s) : ./eclipse /tmp/myfile1 [OK] ./eclipse /tmp/myfile1 /tmp/myfile2 [OK] 2) Open multiple eclipses at the same time: [OK] ./eclipse /tmp/myfile1 /tmp/myfile2 & ./eclipse /tmp/myfile3 /tmp/myfile3 3) Open eclipse. Once opened, run launcher again to pass files. [OK] ./eclipse ... ./eclipse /tmp/myfile 4) Open eclipse with launcher flag: ./eclipse --launcher.openFile /tmp/myfile1 Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=528414 Change-Id: I73ab1e8b603deee803693f022f0c4c90ea3c43c9 Signed-off-by: Leo Ufimtsev <lufimtse@redhat.com>
Diffstat (limited to 'features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c')
-rw-r--r--features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c46
1 files changed, 26 insertions, 20 deletions
diff --git a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
index ccfea8b54..25bcf14f4 100644
--- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
+++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2016 IBM Corporation and others.
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -49,11 +49,25 @@ static FN_TABLE gtkFunctions[] = {
/* functions from libgdk-x11-2.0 or libgdk-3.so.0*/
static FN_TABLE gdkFunctions[] = {
FN_TABLE_ENTRY(gdk_display_get_default, 1),
- FN_TABLE_ENTRY(gdk_x11_display_get_xdisplay, 1),
FN_TABLE_ENTRY(gdk_screen_get_default, 1),
FN_TABLE_ENTRY(gdk_screen_get_resolution, 1),
{ NULL, NULL }
};
+/* functions from libgio-2.0.so.0*/
+static FN_TABLE gioFunctions[] = {
+ FN_TABLE_ENTRY(g_dbus_proxy_new_for_bus_sync, 1),
+ FN_TABLE_ENTRY(g_dbus_proxy_call_sync, 1),
+ { NULL, NULL }
+};
+/* functions from libglib-2.0.so.0*/
+static FN_TABLE glibFunctions[] = {
+ FN_TABLE_ENTRY(g_variant_builder_new, 1),
+ FN_TABLE_ENTRY(g_variant_builder_add, 1),
+ FN_TABLE_ENTRY(g_variant_new, 1),
+ FN_TABLE_ENTRY(g_variant_builder_unref, 1),
+ FN_TABLE_ENTRY(g_variant_unref, 1),
+ { NULL, NULL }
+};
/* functions from libgdk_pixbuf-2.0 */
static FN_TABLE pixFunctions[] = {
FN_TABLE_ENTRY(gdk_pixbuf_new_from_file, 1),
@@ -69,25 +83,13 @@ static FN_TABLE gobjFunctions[] = {
FN_TABLE_ENTRY(g_object_unref, 1),
FN_TABLE_ENTRY(g_timeout_add, 1),
FN_TABLE_ENTRY(g_error_free, 1),
+ FN_TABLE_ENTRY(g_type_init, 1),
#ifdef SOLARIS
FN_TABLE_ENTRY(g_string_insert_c, 1),
#endif
{ NULL, NULL }
};
-/* functions from libX11 */
-static FN_TABLE x11Functions[] = {
- FN_TABLE_ENTRY(XGetSelectionOwner, 1),
- FN_TABLE_ENTRY(XSetSelectionOwner, 1),
- FN_TABLE_ENTRY(XCreateWindow, 1),
- FN_TABLE_ENTRY(XChangeProperty, 1),
- FN_TABLE_ENTRY(XSync, 1),
- FN_TABLE_ENTRY(XRootWindow, 1),
- FN_TABLE_ENTRY(XDefaultScreen, 1),
- FN_TABLE_ENTRY(XInternAtom, 1),
- { NULL, NULL }
-};
-
static int loadGtkSymbols( void * library, FN_TABLE * table) {
int i = 0;
void * fn;
@@ -122,7 +124,7 @@ int loadGtk() {
/* Disable GTK scaling*/
setenv("GDK_SCALE", "1", 1);
- void *gdkLib = NULL, *gtkLib = NULL, *objLib = NULL, *pixLib = NULL, *x11Lib = NULL;
+ void *gioLib = NULL, *glibLib = NULL, *gdkLib = NULL, *gtkLib = NULL, *objLib = NULL, *pixLib = NULL;
char *gtk3 = getenv("SWT_GTK3");
if (gtk3 == NULL || strcmp(gtk3,"1") == 0) {
@@ -167,15 +169,17 @@ int loadGtk() {
objLib = dlopen(GOBJ_LIB, DLFLAGS);
pixLib = dlopen(PIXBUF_LIB, DLFLAGS);
- x11Lib = dlopen(X11_LIB, DLFLAGS);
+ gioLib = dlopen(GIO_LIB, DLFLAGS);
+ glibLib= dlopen(GLIB_LIB, DLFLAGS);
memset(&gtk, 0, sizeof(struct GTK_PTRS));
if ( gtkLib == NULL || loadGtkSymbols(gtkLib, gtkFunctions) != 0) return -1;
if ( gdkLib == NULL || loadGtkSymbols(gdkLib, gdkFunctions) != 0) return -1;
+ if ( gioLib == NULL || loadGtkSymbols(gdkLib, gioFunctions) != 0) return -1;
+ if ( glibLib == NULL || loadGtkSymbols(gdkLib, glibFunctions) != 0) return -1;
if ( pixLib == NULL || loadGtkSymbols(pixLib, pixFunctions) != 0) return -1;
if ( objLib == NULL || loadGtkSymbols(objLib, gobjFunctions) != 0) return -1;
- if ( x11Lib == NULL || loadGtkSymbols(x11Lib, x11Functions) != 0) return -1;
/* Initialize GTK. */
if (gtk.gtk_init_with_args) {
@@ -205,16 +209,18 @@ int loadGtk() {
objLib = dlopen(GOBJ_LIB, DLFLAGS);
pixLib = dlopen(PIXBUF_LIB, DLFLAGS);
- x11Lib = dlopen(X11_LIB, DLFLAGS);
+ gioLib = dlopen(GIO_LIB, DLFLAGS);
+ glibLib= dlopen(GLIB_LIB, DLFLAGS);
/* initialize ptr struct to 0's */
memset(&gtk, 0, sizeof(struct GTK_PTRS));
if ( gtkLib == NULL || loadGtkSymbols(gtkLib, gtkFunctions) != 0) return -1;
if ( gdkLib == NULL || loadGtkSymbols(gdkLib, gdkFunctions) != 0) return -1;
+ if ( gioLib == NULL || loadGtkSymbols(gdkLib, gioFunctions) != 0) return -1;
+ if ( glibLib == NULL || loadGtkSymbols(gdkLib, glibFunctions) != 0) return -1;
if ( pixLib == NULL || loadGtkSymbols(pixLib, pixFunctions) != 0) return -1;
if ( objLib == NULL || loadGtkSymbols(objLib, gobjFunctions) != 0) return -1;
- if ( x11Lib == NULL || loadGtkSymbols(x11Lib, x11Functions) != 0) return -1;
return 0;
}

Back to the top