Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2010-08-10 15:46:22 -0400
committerAndrew Niefer2010-08-10 15:46:22 -0400
commit5a8ec736bac349e5311d039b9567f95c1ea16529 (patch)
tree40666a5c3758fcaa57e827cf6d0a50cc6e1bb55c
parent156376585e76a8a4501bf23b8a022b4c8c92936a (diff)
downloadrt.equinox.framework-5a8ec736bac349e5311d039b9567f95c1ea16529.tar.gz
rt.equinox.framework-5a8ec736bac349e5311d039b9567f95c1ea16529.tar.xz
rt.equinox.framework-5a8ec736bac349e5311d039b9567f95c1ea16529.zip
bug 315746 - --launcher.openFile doesn't work on Solaris
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c19
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak2
2 files changed, 14 insertions, 7 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c
index 98605dc5c..9aeee5f37 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c
@@ -114,9 +114,16 @@ static void log_handler(const gchar* domain, GLogLevelFlags flags, const gchar*
/* nothing */
}
-/* Create the mutex name string, with optional suffix. Caller should free the memory when finished */
-static char * createMutexName(char * suffix) {
+/* Create a "SWT_Window_" + APP_NAME string with optional suffix.
+ * Caller should free the memory when finished */
+static char * createSWTWindowString(char * suffix, int semaphore) {
+#ifdef SOLARIS
+ /* solaris requires semaphore names to start with '/' */
+ char * prefix = semaphore != 0 ? _T_ECLIPSE("/SWT_Window_") : _T_ECLIPSE("SWT_Window_");
+#else
char * prefix = _T_ECLIPSE("SWT_Window_");
+#endif
+
char * result = malloc((_tcslen(prefix) + _tcslen(getOfficialName()) + (suffix != NULL ? _tcslen(suffix) : 0) + 1) * sizeof(char));
if (suffix != NULL)
_stprintf(result, _T_ECLIPSE("%s%s%s"), prefix, getOfficialName(), suffix);
@@ -152,7 +159,7 @@ static int setAppWindowPropertyFn() {
/* set the Application window property by executing _setWindowPropertyFn within a semaphore */
int setAppWindowProperty() {
int result;
- char * mutexName = createMutexName(NULL);
+ char * mutexName = createSWTWindowString(NULL, 1);
result = executeWithLock(mutexName, setAppWindowPropertyFn);
gtk.XSync(gtk_GDK_DISPLAY, False);
free(mutexName);
@@ -195,16 +202,16 @@ int reuseWorkbench(_TCHAR** filePath, int timeout) {
openFilePath = filePath;
//App name is defined in SWT as well. Values must be consistent.
- appName = createMutexName(NULL);
+ appName = createSWTWindowString(NULL, 0);
appWindowAtom = gtk.XInternAtom(gtk_GDK_DISPLAY, appName, FALSE);
free(appName);
//check if app is already running. Just set property if it is.
- if (setAppWindowProperty())
+ if (setAppWindowProperty() > 0)
return 1;
/* app is not running, create a launcher window to act as a mutex so we don't need to keep the semaphore locked */
- launcherName = createMutexName(_T_ECLIPSE("_Launcher"));
+ launcherName = createSWTWindowString(_T_ECLIPSE("_Launcher"), 1);
launcherWindowAtom = gtk.XInternAtom(gtk_GDK_DISPLAY, launcherName, FALSE);
result = executeWithLock(launcherName, createLauncherWindow);
free(launcherName);
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak b/bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak
index 5f0f13797..7b9b3f49e 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak
@@ -42,7 +42,7 @@ OPTFLAG = -O -s
EXEC = $(PROGRAM_OUTPUT)
DLL = $(PROGRAM_LIBRARY)
#LIBS = `pkg-config --libs-only-L gtk+-2.0` -lgtk-x11-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lgdk-x11-2.0 -lglib-2.0 -lthread -ldl -lc
-LIBS = -lthread -ldl -lc
+LIBS = -lthread -ldl -lc -lrt
GTK_LIBS = -DGTK_LIB="\"libgtk-x11-2.0.so.0\"" -DGDK_LIB="\"libgdk-x11-2.0.so.0\"" -DPIXBUF_LIB="\"libgdk_pixbuf-2.0.so.0\"" -DGOBJ_LIB="\"libgobject-2.0.so.0\"" -DX11_LIB="\"libX11.so.4\""
LFLAGS = -G
CFLAGS = $(OPTFLAG) \

Back to the top