Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2007-10-05 18:22:41 +0000
committerAndrew Niefer2007-10-05 18:22:41 +0000
commit2cb8cc250a06e04d4e237eb33b60a2a07ec8d9e6 (patch)
tree379901e355918ff45335fdc49324d5870b9f34fd
parent4e3aa09c05ebda8375c36b7c0aed0312fc787520 (diff)
downloadrt.equinox.framework-2cb8cc250a06e04d4e237eb33b60a2a07ec8d9e6.tar.gz
rt.equinox.framework-2cb8cc250a06e04d4e237eb33b60a2a07ec8d9e6.tar.xz
rt.equinox.framework-2cb8cc250a06e04d4e237eb33b60a2a07ec8d9e6.zip
bug 201414
-rw-r--r--bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c6
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipse.c6
-rw-r--r--bundles/org.eclipse.equinox.executable/library/eclipseOS.h2
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/build.sh3
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c73
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.h66
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c49
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkInit.c95
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak14
-rw-r--r--bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak12
-rw-r--r--bundles/org.eclipse.equinox.executable/library/make_version.mak2
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgImage.c95
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/NgImage.h17
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c102
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h93
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c117
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c144
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak7
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak8
-rw-r--r--bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak6
-rw-r--r--bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c8
-rw-r--r--bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp9
-rw-r--r--bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java7
23 files changed, 723 insertions, 218 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
index 0b0f33cf1..eb89f4a50 100644
--- a/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/carbon/eclipseCarbonCommon.c
@@ -25,8 +25,6 @@ char pathSeparator = ':';
static CFBundleRef javaVMBundle = NULL;
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
-
int initialized = 0;
static void init() {
@@ -46,7 +44,7 @@ static void init() {
*
* Initialize Carbon.
*/
-void initWindowSystem( int* pArgc, char* argv[], int showSplash )
+int initWindowSystem( int* pArgc, char* argv[], int showSplash )
{
char *homeDir = getProgramDir();
/*debug("install dir: %s\n", homeDir);*/
@@ -55,6 +53,8 @@ void initWindowSystem( int* pArgc, char* argv[], int showSplash )
if (showSplash)
init();
+
+ return 0;
}
/* Display a Message */
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipse.c b/bundles/org.eclipse.equinox.executable/library/eclipse.c
index 86b58bf82..c5b9ecc48 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipse.c
+++ b/bundles/org.eclipse.equinox.executable/library/eclipse.c
@@ -362,9 +362,6 @@ JNIEXPORT int run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[])
/* Initialize official program name */
officialName = name != NULL ? _tcsdup( name ) : getDefaultOfficialName();
-
- /* Initialize the window system. */
- initWindowSystem( &argc, argv, !noSplash );
/* Find the directory where the Eclipse program is installed. */
programDir = getProgramDir();
@@ -951,7 +948,8 @@ _TCHAR* getProgramDir( )
{
_TCHAR* ch;
_TCHAR* programDir;
-
+ if (program == NULL)
+ return NULL;
programDir = malloc( (_tcslen( program ) + 1) * sizeof(_TCHAR) );
_tcscpy( programDir, program );
ch = lastDirSeparator( programDir );
diff --git a/bundles/org.eclipse.equinox.executable/library/eclipseOS.h b/bundles/org.eclipse.equinox.executable/library/eclipseOS.h
index d193c38d0..579692e8b 100644
--- a/bundles/org.eclipse.equinox.executable/library/eclipseOS.h
+++ b/bundles/org.eclipse.equinox.executable/library/eclipseOS.h
@@ -78,7 +78,7 @@ extern void displayMessage( _TCHAR* title, _TCHAR* message );
* The showSplash flag indicates the splash window will be displayed by
* this process (e.g., value will be zero for the main launcher).
*/
-extern void initWindowSystem( int* argc, _TCHAR* argv[], int showSplash );
+extern int initWindowSystem( int* argc, _TCHAR* argv[], int showSplash );
/** Show the Splash Window
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/build.sh b/bundles/org.eclipse.equinox.executable/library/gtk/build.sh
index a73d782d5..455c369b9 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/build.sh
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/build.sh
@@ -97,7 +97,8 @@ case $OS in
makefile="make_solaris.mak"
defaultOS="solaris"
OUTPUT_DIR="../../bin/$defaultWS/$defaultOS/$defaultOSArch"
- PATH=/usr/ccs/bin:/opt/SUNWspro/bin:$PATH
+ #PATH=/usr/ccs/bin:/opt/SUNWspro/bin:$PATH
+ PATH=/usr/ccs/bin:/export/home/SUNWspro/bin:$PATH
export PATH
if [ "$PROC" = "" ]; then
PROC=`uname -p`
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c
index 0d1b04a35..cbae915ba 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.c
@@ -15,6 +15,7 @@
#include "eclipseCommon.h"
#include "eclipseOS.h"
#include "eclipseUtil.h"
+#include "eclipseGtk.h"
#include <signal.h>
#include <unistd.h>
@@ -32,9 +33,6 @@
#include <string.h>
#include <locale.h>
-#include <gtk/gtk.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
/* Global Variables */
char* defaultVM = "java";
char* vmLibrary = "libjvm.so";
@@ -68,56 +66,59 @@ int showSplash( const char* featureImage )
if (initialArgv == NULL)
initialArgc = 0;
- initWindowSystem(&initialArgc, initialArgv, 1);
- shellHandle = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- gtk_window_set_decorated(GTK_WINDOW(shellHandle), FALSE);
- gtk_signal_connect(GTK_OBJECT(shellHandle), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &shellHandle);
- vboxHandle = gtk_vbox_new(FALSE, 0);
+ if( initWindowSystem(&initialArgc, initialArgv, 1) != 0)
+ return -1;
+
+ shellHandle = gtk.gtk_window_new(GTK_WINDOW_TOPLEVEL);
+ gtk.gtk_window_set_decorated((GtkWindow*)(shellHandle), FALSE);
+ gtk.gtk_signal_connect((GtkObject*)shellHandle, "destroy", (GtkSignalFunc)(gtk.gtk_widget_destroyed), &shellHandle);
+ vboxHandle = gtk.gtk_vbox_new(FALSE, 0);
if(vboxHandle == 0)
return -1;
- vadj = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 100, 1, 10, 10));
- hadj = GTK_ADJUSTMENT(gtk_adjustment_new(0, 0, 100, 1, 10, 10));
+ vadj = (GtkAdjustment*)gtk.gtk_adjustment_new(0, 0, 100, 1, 10, 10);
+ hadj = (GtkAdjustment*)gtk.gtk_adjustment_new(0, 0, 100, 1, 10, 10);
if (vadj == 0 || hadj == 0)
return -1;
- scrolledHandle = gtk_scrolled_window_new(hadj, vadj);
+ scrolledHandle = gtk.gtk_scrolled_window_new(hadj, vadj);
- gtk_container_add(GTK_CONTAINER(vboxHandle), scrolledHandle);
- gtk_box_set_child_packing(GTK_BOX(vboxHandle), scrolledHandle, TRUE, TRUE, 0, GTK_PACK_END);
- gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledHandle), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
+ gtk.gtk_container_add((GtkContainer*)(vboxHandle), scrolledHandle);
+ gtk.gtk_box_set_child_packing((GtkBox*)(vboxHandle), scrolledHandle, TRUE, TRUE, 0, GTK_PACK_END);
+ gtk.gtk_scrolled_window_set_policy((GtkScrolledWindow*)(scrolledHandle), GTK_POLICY_NEVER, GTK_POLICY_NEVER);
- handle = gtk_fixed_new();
- gtk_fixed_set_has_window(GTK_FIXED(handle), TRUE);
- GTK_WIDGET_SET_FLAGS(handle, GTK_CAN_FOCUS);
+ handle = gtk.gtk_fixed_new();
+ gtk.gtk_fixed_set_has_window((GtkFixed*)(handle), TRUE);
+ ((GtkObject*)handle)->flags |= GTK_CAN_FOCUS; /*GTK_WIDGET_SET_FLAGS(handle, GTK_CAN_FOCUS);*/
/* avoid gtk_scrolled_window_add warning */
- handlerId = g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, &log_handler, NULL);
- gtk_container_add(GTK_CONTAINER(scrolledHandle), handle);
- g_log_remove_handler("Gtk", handlerId);
+ handlerId = gtk.g_log_set_handler("Gtk", G_LOG_LEVEL_WARNING, &log_handler, NULL);
+ gtk.gtk_container_add((GtkContainer*)(scrolledHandle), handle);
+ gtk.g_log_remove_handler("Gtk", handlerId);
- gtk_container_add(GTK_CONTAINER(shellHandle), vboxHandle);
+ gtk.gtk_container_add((GtkContainer*)(shellHandle), vboxHandle);
- pixbuf = gdk_pixbuf_new_from_file(featureImage, NULL);
- image = gtk_image_new_from_pixbuf(pixbuf);
- gtk_signal_connect(GTK_OBJECT(image), "destroy", GTK_SIGNAL_FUNC(gtk_widget_destroyed), &image);
- gtk_container_add(GTK_CONTAINER(handle), image);
+ pixbuf = gtk.gdk_pixbuf_new_from_file(featureImage, NULL);
+ image = gtk.gtk_image_new_from_pixbuf(pixbuf);
+ gtk.gtk_signal_connect((GtkObject*)(image), "destroy", (GtkSignalFunc)(gtk.gtk_widget_destroyed), &image);
+ gtk.gtk_container_add((GtkContainer*)(handle), image);
- width = gdk_pixbuf_get_width(pixbuf);
- height = gdk_pixbuf_get_height(pixbuf);
- gtk_window_set_position(GTK_WINDOW(shellHandle), GTK_WIN_POS_CENTER);
+ width = gtk.gdk_pixbuf_get_width(pixbuf);
+ height = gtk.gdk_pixbuf_get_height(pixbuf);
+ gtk.gtk_window_set_position((GtkWindow*)(shellHandle), GTK_WIN_POS_CENTER);
if (getOfficialName() != NULL)
- gtk_window_set_title(GTK_WINDOW(shellHandle), getOfficialName());
- gtk_window_resize(GTK_WINDOW(shellHandle), width, height);
- gtk_widget_show_all(GTK_WIDGET(shellHandle));
- splashHandle = (long)G_OBJECT(shellHandle);
+ gtk.gtk_window_set_title((GtkWindow*)(shellHandle), getOfficialName());
+ gtk.gtk_window_resize((GtkWindow*)(shellHandle), width, height);
+ gtk.gtk_widget_show_all((GtkWidget*)(shellHandle));
+ splashHandle = (long)shellHandle;
dispatchMessages();
return 0;
}
void dispatchMessages() {
- while(g_main_context_iteration(0,0) != 0) {}
+ if (gtk.g_main_context_iteration != 0)
+ while(gtk.g_main_context_iteration(0,0) != 0) {}
}
jlong getSplashHandle() {
@@ -126,10 +127,10 @@ jlong getSplashHandle() {
void takeDownSplash() {
if(shellHandle != 0) {
- gtk_widget_destroy(shellHandle);
+ gtk.gtk_widget_destroy(shellHandle);
if (image != NULL) {
- gtk_widget_destroy(image);
- gdk_pixbuf_unref(pixbuf);
+ gtk.gtk_widget_destroy(image);
+ gtk.g_object_unref(pixbuf);
}
dispatchMessages();
splashHandle = 0;
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.h b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.h
new file mode 100644
index 000000000..b443196f9
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtk.h
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+#ifndef ECLIPSE_GTK_H
+#define ECLIPSE_GTK_H
+
+#include <gtk/gtk.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
+
+struct GTK_PTRS {
+ GtkObject* (*gtk_adjustment_new) (gdouble, gdouble, gdouble, gdouble, gdouble, gdouble);
+ void (*gtk_box_set_child_packing)(GtkBox*, GtkWidget*, gboolean, gboolean, guint, GtkPackType);
+ void (*gtk_container_add) (GtkContainer*, GtkWidget*);
+ gint (*gtk_dialog_run) (GtkDialog *);
+ GtkWidget* (*gtk_fixed_new) ();
+ void (*gtk_fixed_set_has_window) (GtkFixed *, gboolean);
+ GtkWidget* (*gtk_image_new_from_pixbuf)(GdkPixbuf*);
+ gboolean (*gtk_init_check) (int*, char***);
+ GtkWidget* (*gtk_message_dialog_new) (GtkWindow*, GtkDialogFlags, GtkMessageType, GtkButtonsType, const gchar*, ...);
+ void (*gtk_scrolled_window_set_policy)(GtkScrolledWindow*, GtkPolicyType, GtkPolicyType);
+ GtkWidget* (*gtk_scrolled_window_new) (GtkAdjustment*, GtkAdjustment*);
+ gchar* (*gtk_set_locale) ();
+ gulong (*gtk_signal_connect_full) (GtkObject*, const gchar*, GtkSignalFunc, GtkCallbackMarshal, gpointer, GtkDestroyNotify, gint, gint);
+ GtkWidget* (*gtk_vbox_new) (gboolean, gint);
+ void (*gtk_widget_destroy) (GtkWidget*);
+ void (*gtk_widget_destroyed) (GtkWidget*, GtkWidget**);
+ void (*gtk_widget_show_all) (GtkWidget*);
+ GtkWidget* (*gtk_window_new) (GtkWindowType);
+ void (*gtk_window_resize) (GtkWindow*, gint, gint);
+ void (*gtk_window_set_title) (GtkWindow*, const gchar*);
+ void (*gtk_window_set_decorated) (GtkWindow*, gboolean);
+ void (*gtk_window_set_position) (GtkWindow*, GtkWindowPosition);
+ guint (*g_log_set_handler) (const gchar*, GLogLevelFlags, GLogFunc, gpointer);
+ void (*g_log_remove_handler) (const gchar*, guint);
+ gboolean (*g_main_context_iteration) (GMainContext*, gboolean);
+ void (*g_object_unref) (gpointer);
+ GObject* (*g_object_new) (GType, const gchar*, ...);
+#ifdef SOLARIS
+ GString* (*g_string_insert_c) (GString *, gssize, gchar);
+#endif
+
+ GdkPixbuf* (*gdk_pixbuf_new_from_file) (const char*, GError **);
+ int (*gdk_pixbuf_get_width) (const GdkPixbuf*);
+ int (*gdk_pixbuf_get_height) (const GdkPixbuf*);
+ void (*gdk_set_program_class) (const char*);
+};
+
+extern struct GTK_PTRS gtk;
+
+#define FN_TABLE_ENTRY(fn) { (void**)& gtk.fn, #fn }
+typedef struct {
+ void ** fnPtr;
+ char * fnName;
+} FN_TABLE;
+
+/* load the gtk libraries and initialize the function pointers */
+extern int loadGtk();
+
+#endif
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c
index 62877e566..ba2c6e9f8 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkCommon.c
@@ -12,59 +12,61 @@
#include "eclipseCommon.h"
#include "eclipseOS.h"
+#include "eclipseGtk.h"
#include <locale.h>
#include <dlfcn.h>
#include <stdio.h>
-#include <gtk/gtk.h>
#define ECLIPSE_ICON 401
char dirSeparator = '/';
char pathSeparator = ':';
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
-
-/* Global Main Window*/
-/*#ifdef UNICODE
-extern HWND topWindow;
-#else
-HWND topWindow = 0;
-#endif*/
-
/* Define local variables for the main window. */
static int saveArgc = 0; /* arguments after they were parsed, for window system */
static char** saveArgv = 0;
gboolean gtkInitialized = FALSE;
+#ifdef SOLARIS
+/* a call to this function appears inline in glib/gstring.h on Solaris,
+ so provide a definition here and hook it up
+ */
+GString* g_string_insert_c (GString *string, gssize pos, gchar c) {
+ return gtk.g_string_insert_c(string, pos, c);
+}
+#endif
+
/* Display a Message */
void displayMessage(char* title, char* message)
{
GtkWidget* dialog;
/* If GTK has not been initialized yet, do it now. */
- if (!gtkInitialized)
- {
- initWindowSystem( &saveArgc, saveArgv, 1 );
- }
+ if (initWindowSystem( &saveArgc, saveArgv, 1 ) != 0)
+ return;
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
+ dialog = gtk.gtk_message_dialog_new(NULL, GTK_DIALOG_DESTROY_WITH_PARENT,
GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
"%s", message);
- gtk_window_set_title(GTK_WINDOW (dialog), title);
- gtk_dialog_run(GTK_DIALOG (dialog));
- gtk_widget_destroy(dialog);
+ gtk.gtk_window_set_title((GtkWindow*)dialog, title);
+ gtk.gtk_dialog_run((GtkDialog*)dialog);
+ gtk.gtk_widget_destroy(dialog);
}
/* Initialize the Window System */
-void initWindowSystem(int* pArgc, char* argv[], int showSplash)
+int initWindowSystem(int* pArgc, char* argv[], int showSplash)
{
int defaultArgc = 1;
char * defaultArgv [] = { "", 0 };
if(gtkInitialized)
- return;
+ return 0;
+
+ /* load the GTK libraries and initialize function pointers */
+ if (loadGtk() != 0)
+ return -1;
if (argv == NULL) {
/* gtk_init_check on Solaris 9 doesn't like NULL or empty argv */
@@ -80,10 +82,11 @@ void initWindowSystem(int* pArgc, char* argv[], int showSplash)
}
/* Initialize GTK. */
- gtk_set_locale();
- gtk_init_check(pArgc, &argv);
- gdk_set_program_class(getOfficialName());
+ gtk.gtk_set_locale();
+ gtk.gtk_init_check(pArgc, &argv);
+ /*_gdk_set_program_class(getOfficialName());*/
gtkInitialized = TRUE;
+ return 0;
}
/* Load the specified shared library
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkInit.c b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkInit.c
new file mode 100644
index 000000000..8f56e0e86
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/eclipseGtkInit.c
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "eclipseGtk.h"
+#include "eclipseCommon.h"
+#include <dlfcn.h>
+#include <string.h>
+
+struct GTK_PTRS gtk;
+
+/* tables to help initialize the function pointers */
+/* functions from libgtk-x11-2.0 */
+static FN_TABLE gtkFunctions[] = { FN_TABLE_ENTRY(gtk_adjustment_new),
+ FN_TABLE_ENTRY(gtk_box_set_child_packing),
+ FN_TABLE_ENTRY(gtk_container_add),
+ FN_TABLE_ENTRY(gtk_dialog_run),
+ FN_TABLE_ENTRY(gtk_fixed_new),
+ FN_TABLE_ENTRY(gtk_fixed_set_has_window),
+ FN_TABLE_ENTRY(gtk_image_new_from_pixbuf),
+ FN_TABLE_ENTRY(gtk_init_check),
+ FN_TABLE_ENTRY(gtk_message_dialog_new),
+ FN_TABLE_ENTRY(gtk_scrolled_window_set_policy),
+ FN_TABLE_ENTRY(gtk_scrolled_window_new),
+ FN_TABLE_ENTRY(gtk_set_locale),
+ FN_TABLE_ENTRY(gtk_signal_connect_full),
+ FN_TABLE_ENTRY(gtk_vbox_new),
+ FN_TABLE_ENTRY(gtk_widget_destroy),
+ FN_TABLE_ENTRY(gtk_widget_destroyed),
+ FN_TABLE_ENTRY(gtk_widget_show_all),
+ FN_TABLE_ENTRY(gtk_window_new),
+ FN_TABLE_ENTRY(gtk_window_resize),
+ FN_TABLE_ENTRY(gtk_window_set_title),
+ FN_TABLE_ENTRY(gtk_window_set_decorated),
+ FN_TABLE_ENTRY(gtk_window_set_position),
+ { NULL, NULL }
+ };
+/* functions from libgdk-x11-2.0 */
+static FN_TABLE gdkFunctions[] = { FN_TABLE_ENTRY(gdk_set_program_class),
+ { NULL, NULL }
+ };
+/* functions from libgdk_pixbuf-2.0 */
+static FN_TABLE pixFunctions[] = { FN_TABLE_ENTRY(gdk_pixbuf_new_from_file),
+ FN_TABLE_ENTRY(gdk_pixbuf_get_width),
+ FN_TABLE_ENTRY(gdk_pixbuf_get_height),
+ { NULL, NULL }
+ };
+/* functions from libgobject-2.0 */
+static FN_TABLE gobjFunctions[] = { FN_TABLE_ENTRY(g_log_set_handler),
+ FN_TABLE_ENTRY(g_log_remove_handler),
+ FN_TABLE_ENTRY(g_main_context_iteration),
+ FN_TABLE_ENTRY(g_object_unref),
+#ifdef SOLARIS
+ FN_TABLE_ENTRY(g_string_insert_c),
+#endif
+ { NULL, NULL }
+ };
+
+
+static int loadGtkSymbols( void * library, FN_TABLE * table) {
+ int i = 0;
+ void * fn;
+ for (i = 0; table[i].fnName != NULL; i++) {
+ fn = findSymbol(library, table[i].fnName);
+ if (fn != 0)
+ *(table[i].fnPtr) = fn;
+ else
+ return -1;
+ }
+ return 0;
+}
+
+int loadGtk() {
+ void * objLib = dlopen(GOBJ_LIB, RTLD_LAZY);
+ void * gdkLib = dlopen(GDK_LIB, RTLD_LAZY);
+ void * pixLib = dlopen(PIXBUF_LIB, RTLD_LAZY);
+ void * gtkLib = dlopen(GTK_LIB, RTLD_LAZY);
+
+ /* 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 ( pixLib == NULL || loadGtkSymbols(pixLib, pixFunctions) != 0) return -1;
+ if ( objLib == NULL || loadGtkSymbols(objLib, gobjFunctions) != 0) return -1;
+
+ return 0;
+}
diff --git a/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak b/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak
index 74014f522..297799839 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/make_linux.mak
@@ -36,14 +36,16 @@ endif
# Define the object modules to be compiled and flags.
CC=gcc
MAIN_OBJS = eclipseMain.o
-COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o eclipseGtkInit.o
DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseMozilla.o eclipseShm.o eclipseNix.o
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 -lpthread -ldl
+#LIBS = `pkg-config --libs-only-L gtk+-2.0` -lgtk-x11-2.0 -lgdk_pixbuf-2.0 -lgobject-2.0 -lgdk-x11-2.0 -lpthread -ldl
+LIBS = -lpthread -ldl
+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\""
LFLAGS = -shared -fpic -Wl,--export-dynamic
-CFLAGS = -O -s -Wall\
+CFLAGS = -g -s -Wall\
-fpic \
-DLINUX \
-DMOZILLA_FIX \
@@ -51,6 +53,7 @@ CFLAGS = -O -s -Wall\
-DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
-DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
-D$(DEFAULT_JAVA) \
+ $(GTK_LIBS) \
-I. \
-I.. \
-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux \
@@ -67,9 +70,12 @@ eclipseMain.o: ../eclipseUnicode.h ../eclipseCommon.h ../eclipseMain.c
eclipseCommon.o: ../eclipseCommon.h ../eclipseUnicode.h ../eclipseCommon.c
$(CC) $(CFLAGS) -c ../eclipseCommon.c
-eclipseGtkCommon.o: ../eclipseCommon.h ../eclipseOS.h eclipseGtkCommon.c
+eclipseGtkCommon.o: ../eclipseCommon.h ../eclipseOS.h eclipseGtk.h eclipseGtkCommon.c
$(CC) $(CFLAGS) -c eclipseGtkCommon.c -o eclipseGtkCommon.o
+eclipseGtkInit.o: ../eclipseCommon.h eclipseGtk.h eclipseGtkInit.c
+ $(CC) $(CFLAGS) -c eclipseGtkInit.c -o eclipseGtkInit.o
+
eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
$(CC) $(CFLAGS) -c ../eclipseUtil.c -o eclipseUtil.o
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 71f227e67..b2224a0b2 100644
--- a/bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak
+++ b/bundles/org.eclipse.equinox.executable/library/gtk/make_solaris.mak
@@ -32,7 +32,7 @@ PROGRAM_LIBRARY=$(PROGRAM_OUTPUT)_$(LIB_VERSION).so
# Define the object modules to be compiled and flags.
MAIN_OBJS = eclipseMain.o
-COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseGtkCommon.o eclipseGtkInit.o
DLL_OBJS = eclipse.o eclipseGtk.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o
PICFLAG = -K PIC
# Optimize and remove all debugging information by default
@@ -41,7 +41,9 @@ 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 = `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
+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\""
LFLAGS = -G
CFLAGS = $(OPTFLAG) \
-DSOLARIS \
@@ -49,6 +51,7 @@ CFLAGS = $(OPTFLAG) \
-DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
-DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
-DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ $(GTK_LIBS) \
-I. \
-I.. \
-I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/solaris \
@@ -65,9 +68,12 @@ eclipseMain.o: ../eclipseUnicode.h ../eclipseCommon.h ../eclipseMain.c
eclipseCommon.o: ../eclipseCommon.h ../eclipseUnicode.h ../eclipseCommon.c
$(CC) $(CFLAGS) -c ../eclipseCommon.c
-eclipseGtkCommon.o: ../eclipseCommon.h ../eclipseOS.h eclipseGtkCommon.c
+eclipseGtkCommon.o: ../eclipseCommon.h ../eclipseOS.h eclipseGtk.h eclipseGtkCommon.c
$(CC) $(CFLAGS) -c eclipseGtkCommon.c -o eclipseGtkCommon.o
+eclipseGtkInit.o: ../eclipseCommon.h eclipseGtk.h eclipseGtkInit.c
+ $(CC) $(CFLAGS) -c eclipseGtkInit.c -o eclipseGtkInit.o
+
eclipseUtil.o: ../eclipseUtil.c ../eclipseUtil.h ../eclipseOS.h
$(CC) $(CFLAGS) -c ../eclipseUtil.c -o eclipseUtil.o
diff --git a/bundles/org.eclipse.equinox.executable/library/make_version.mak b/bundles/org.eclipse.equinox.executable/library/make_version.mak
index 084f61ad1..75e700e75 100644
--- a/bundles/org.eclipse.equinox.executable/library/make_version.mak
+++ b/bundles/org.eclipse.equinox.executable/library/make_version.mak
@@ -10,5 +10,5 @@
#*******************************************************************************
maj_ver=1
-min_ver=102
+min_ver=103
LIB_VERSION = $(maj_ver)$(min_ver)
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c
index 04ffbe701..bd2abf2dd 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.c
@@ -13,13 +13,73 @@
#include "NgImageData.h"
#include "NgImage.h"
#include "NgWinBMPFileFormat.h"
+#include <dlfcn.h>
+struct NG_PTRS ng;
+
+#define FN_TABLE_ENTRY(fn) { (void**)&ng.fn, #fn }
+typedef struct {
+ void ** fnPtr;
+ char * fnName;
+} FN_TABLE;
+static FN_TABLE x11Functions[] = { FN_TABLE_ENTRY(XCreateGC),
+ FN_TABLE_ENTRY(XCreateImage),
+ FN_TABLE_ENTRY(XCreatePixmap),
+ FN_TABLE_ENTRY(XDefaultColormap),
+ FN_TABLE_ENTRY(XDefaultDepthOfScreen),
+ FN_TABLE_ENTRY(XDefaultRootWindow),
+ FN_TABLE_ENTRY(XDefaultScreen),
+ FN_TABLE_ENTRY(XDefaultScreenOfDisplay),
+ FN_TABLE_ENTRY(XDefaultVisual),
+ FN_TABLE_ENTRY(XFreeGC),
+ FN_TABLE_ENTRY(XFreePixmap),
+ FN_TABLE_ENTRY(XPutImage),
+ FN_TABLE_ENTRY(XQueryColor),
+ { NULL, NULL }
+ };
+
+static FN_TABLE xtFunctions[] = { FN_TABLE_ENTRY(XtMalloc), {NULL, NULL} };
+
+int NGImageInit() {
+ int i = 0;
+ void * fn;
+#ifdef AIX
+ void * x11Lib = dlopen(X11_LIB, RTLD_LAZY | RTLD_MEMBER);
+ void * xtLib = dlopen(XT_LIB, RTLD_LAZY | RTLD_MEMBER);
+#else
+ void * x11Lib = dlopen(X11_LIB, RTLD_LAZY);
+ void * xtLib = dlopen(XT_LIB, RTLD_LAZY);
+#endif
+ /* initialize ptr struct to 0's */
+ memset(&ng, 0, sizeof(struct NG_PTRS));
+
+
+ if (x11Lib == NULL || xtLib == NULL)
+ return -1;
+
+ for (i = 0; x11Functions[i].fnName != NULL; i++) {
+ fn = dlsym(x11Lib, x11Functions[i].fnName);
+ if (fn != 0)
+ *(x11Functions[i].fnPtr) = fn;
+ else
+ return -1;
+ }
+
+ for (i = 0; xtFunctions[i].fnName != NULL; i++) {
+ fn = dlsym(xtLib, xtFunctions[i].fnName);
+ if (fn != 0)
+ *(xtFunctions[i].fnPtr) = fn;
+ else
+ return -1;
+ }
+ return 0;
+}
/**
* Return the nbr of entries in the default color palette
*/
int getNbrColorsXPalette(Display *xDisplay)
{
- Visual *visual = XDefaultVisual (xDisplay, XDefaultScreen(xDisplay));
+ Visual *visual = ng.XDefaultVisual (xDisplay, ng.XDefaultScreen(xDisplay));
return visual->map_entries;
}
@@ -32,11 +92,11 @@ ng_err_t getXPalette (Display *xDisplay, int numColors, char* palette)
XColor color;
int i;
int index = 0;
- int colormap = XDefaultColormap (xDisplay, XDefaultScreen(xDisplay));
+ int colormap = ng.XDefaultColormap (xDisplay, ng.XDefaultScreen(xDisplay));
for (i = 0; i < numColors; i++)
{
color.pixel = i;
- XQueryColor (xDisplay, colormap, &color);
+ ng.XQueryColor (xDisplay, colormap, &color);
palette[index++] = ((color.red >> 8) & 0xFF);
palette[index++] = ((color.green >> 8) & 0xFF);
palette[index++] = ((color.blue >> 8) & 0xFF);
@@ -69,7 +129,7 @@ ng_err_t putImage(ng_bitmap_image_t *image, int srcX, int srcY, int srcWidth, in
numColors = getNbrColorsXPalette (xDisplay);
if (numColors == 0)
return NgError (ERR_NG, "Error pseudo-color mode detected, no colors available");
- numColors = 1 << XDefaultDepthOfScreen (XDefaultScreenOfDisplay (xDisplay));
+ numColors = 1 << ng.XDefaultDepthOfScreen (ng.XDefaultScreenOfDisplay (xDisplay));
screenDirect = 0;
} else
{
@@ -79,11 +139,11 @@ ng_err_t putImage(ng_bitmap_image_t *image, int srcX, int srcY, int srcWidth, in
screenDirect = 1;
}
- xImagePtr = XCreateImage(xDisplay, visual, screenDepth, ZPixmap, 0, 0, srcWidth, srcHeight, 32, 0);
+ xImagePtr = ng.XCreateImage(xDisplay, visual, screenDepth, ZPixmap, 0, 0, srcWidth, srcHeight, 32, 0);
if (xImagePtr == NULL) return NgError (ERR_NG, "Error XCreateImage failed");
bufSize = xImagePtr->bytes_per_line * srcHeight;
- xImagePtr->data = (char*) XtMalloc (bufSize);
+ xImagePtr->data = (char*) ng.XtMalloc (bufSize);
sbpp = NgBitmapImageBytesPerRow(image);
dbpp = xImagePtr->bytes_per_line;
@@ -104,11 +164,11 @@ ng_err_t putImage(ng_bitmap_image_t *image, int srcX, int srcY, int srcWidth, in
NgFree (palette);
}
- tempGC = XCreateGC (xDisplay, drawable, 0, NULL);
- XPutImage(xDisplay, drawable, tempGC, xImagePtr, 0, 0, 0, 0, srcWidth, srcHeight);
+ tempGC = ng.XCreateGC (xDisplay, drawable, 0, NULL);
+ ng.XPutImage(xDisplay, drawable, tempGC, xImagePtr, 0, 0, 0, 0, srcWidth, srcHeight);
XDestroyImage (xImagePtr);
- XFreeGC (xDisplay, tempGC);
+ ng.XFreeGC (xDisplay, tempGC);
return ERR_OK;
}
@@ -118,8 +178,8 @@ ng_err_t init(ng_bitmap_image_t *image, Display *xDisplay, int screenDepth, int
int width = (int)NgBitmapImageWidth(image);
int height = (int)NgBitmapImageHeight(image);
- Visual *visual = XDefaultVisual(xDisplay, XDefaultScreen(xDisplay));
- *pixmap = XCreatePixmap(xDisplay, drawable, width, height, screenDepth);
+ Visual *visual = ng.XDefaultVisual(xDisplay, ng.XDefaultScreen(xDisplay));
+ *pixmap = ng.XCreatePixmap(xDisplay, drawable, width, height, screenDepth);
if (*pixmap == 0)
{
return NgError (ERR_NG, "Error XCreatePixmap failed");
@@ -127,7 +187,7 @@ ng_err_t init(ng_bitmap_image_t *image, Display *xDisplay, int screenDepth, int
err = putImage(image, 0, 0, width, height, 0, 0, xDisplay, visual, screenDepth, *pixmap);
if (err != ERR_OK)
{
- XFreePixmap (xDisplay, *pixmap);
+ ng.XFreePixmap (xDisplay, *pixmap);
return NgError (err, "Error putImage failed");
}
@@ -145,15 +205,20 @@ ng_err_t init(ng_bitmap_image_t *image, Display *xDisplay, int screenDepth, int
* returned value: the pixmap newly created if successful. 0 otherwise.
*/
Pixmap loadBMPImage (Display *display, Screen *screen, char *bmpPathname) {
- Window drawable = XDefaultRootWindow (display);
+ Window drawable;
ng_stream_t in;
ng_bitmap_image_t image;
ng_err_t err = ERR_OK;
- int screenDepth = XDefaultDepthOfScreen (screen);
+ int screenDepth;
Pixmap pixmap;
+ /* this must be called before any X functions are used */
+ NGImageInit();
NgInit();
-
+
+ drawable = ng.XDefaultRootWindow (display);
+ screenDepth = ng.XDefaultDepthOfScreen (screen);
+
if (NgStreamInit (&in, bmpPathname) != ERR_OK)
{
NgError (ERR_NG, "Error can't open BMP file");
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h
index 9f1b1320a..c9c711d9d 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h
+++ b/bundles/org.eclipse.equinox.executable/library/motif/NgImage.h
@@ -17,6 +17,23 @@
#include <X11/Xos.h>
#include <X11/Intrinsic.h>
+struct NG_PTRS {
+ GC (*XCreateGC) (Display*, Drawable, unsigned long, XGCValues*);
+ XImage * (*XCreateImage) (Display*, Visual*, unsigned int, int, int, char*, unsigned int, unsigned int, int, int);
+ Pixmap (*XCreatePixmap) (Display*, Drawable, unsigned int, unsigned int, unsigned int);
+ Colormap (*XDefaultColormap) (Display*, int);
+ int (*XDefaultDepthOfScreen)(Screen*);
+ Window (*XDefaultRootWindow) (Display*);
+ int (*XDefaultScreen) (Display*);
+ Screen * (*XDefaultScreenOfDisplay)(Display*);
+ Visual * (*XDefaultVisual) (Display*, int);
+ int (*XFreeGC) (Display*, GC);
+ int (*XFreePixmap) (Display*, Pixmap);
+ int (*XPutImage) (Display*, Drawable, GC, XImage*, int, int, int, int, unsigned int, unsigned int);
+ int (*XQueryColor) (Display*, Colormap, XColor*);
+ char * (*XtMalloc) (Cardinal);
+};
+
/**
* loadBMPImage
* Create a pixmap representing the given BMP file, for the specified display and screen.
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
index c3cda9ce7..d962b6a4f 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.c
@@ -14,17 +14,11 @@
/* UNIX/Motif specific logic for displaying the splash screen. */
#include "eclipseCommon.h"
#include "eclipseMozilla.h"
+#include "eclipseMotif.h"
#include "eclipseOS.h"
#include "eclipseUtil.h"
#include "NgImage.h"
-#include <Xm/XmAll.h>
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/IntrinsicP.h>
-#include <X11/Intrinsic.h>
-#include <X11/Shell.h>
-
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/wait.h>
@@ -94,9 +88,13 @@ int showSplash( const char* featureImage )
if (initialArgv == NULL)
initialArgc = 0;
- initWindowSystem(&initialArgc, initialArgv, 1);
- xDisplay = XtDisplay(topWindow);
- screen = XDefaultScreenOfDisplay( xDisplay );
+
+ if (initWindowSystem(&initialArgc, initialArgv, 1) != 0) {
+ return -1;
+ }
+
+ xDisplay = motif_XtDisplay(topWindow);
+ screen = motif.XDefaultScreenOfDisplay( xDisplay );
if (featureImage != NULL)
{
splashPixmap = loadBMPImage(xDisplay, screen, (char*)featureImage);
@@ -105,7 +103,7 @@ int showSplash( const char* featureImage )
if (splashPixmap == 0)
return ENOENT;
- XGetGeometry (xDisplay, splashPixmap, &root, &x, &y, &width, &height, &border, &depth);
+ motif.XGetGeometry (xDisplay, splashPixmap, &root, &x, &y, &width, &height, &border, &depth);
/* make sure we never pass more than 20 args */
args = malloc(10 * sizeof(Arg));
@@ -113,50 +111,50 @@ int showSplash( const char* featureImage )
nArgs = 0;
/* Note that XtSetArg is a macro, and the 1st argument will be evaluated twice
* so increment nArgs on its own */
- XtSetArg(args[nArgs], XmNmwmDecorations, 0); nArgs++;
- XtSetArg(args[nArgs], XmNtitle, getOfficialName()); nArgs++;
- XtSetArg(args[nArgs], XmNwidth, width); nArgs++;
- XtSetArg(args[nArgs], XmNheight, height); nArgs++;
- shellHandle = XtAppCreateShell(getOfficialName(), "", applicationShellWidgetClass, xDisplay, args, nArgs);
- XtAddCallback(shellHandle, XmNdestroyCallback, (XtCallbackProc) takeDownSplashCB, NULL);
+ motif_XtSetArg(args[nArgs], XmNmwmDecorations, 0); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNtitle, getOfficialName()); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNwidth, width); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNheight, height); nArgs++;
+ shellHandle = motif.XtAppCreateShell(getOfficialName(), "", *motif.applicationShellWidgetClass, xDisplay, args, nArgs);
+ motif.XtAddCallback(shellHandle, XmNdestroyCallback, (XtCallbackProc) takeDownSplashCB, NULL);
nArgs = 0;
- XtSetArg(args[nArgs++], XmNancestorSensitive, 1);
- scrolledHandle = XmCreateMainWindow(shellHandle, NULL, args, nArgs);
+ motif_XtSetArg(args[nArgs++], XmNancestorSensitive, 1);
+ scrolledHandle = motif.XmCreateMainWindow(shellHandle, NULL, args, nArgs);
if(scrolledHandle == 0)
return -1;
- XtManageChild(scrolledHandle);
+ motif.XtManageChild(scrolledHandle);
nArgs = 0;
- XtSetArg(args[nArgs], XmNancestorSensitive, 1); nArgs++;
- XtSetArg(args[nArgs], XmNborderWidth, 0); nArgs++;
- /*XtSetArg(args[nArgs], XmNbackground, 0xFF00FF); nArgs++; */
- XtSetArg(args[nArgs], XmNmarginWidth, 0); nArgs++;
- XtSetArg(args[nArgs], XmNmarginHeight, 0); nArgs++;
- XtSetArg(args[nArgs], XmNresizePolicy, XmRESIZE_NONE); nArgs++;
- XtSetArg(args[nArgs], XmNtraversalOn, 1); nArgs++;
- drawingHandle = XmCreateDrawingArea(scrolledHandle, NULL, args, nArgs);
+ motif_XtSetArg(args[nArgs], XmNancestorSensitive, 1); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNborderWidth, 0); nArgs++;
+ /*motif_XtSetArg(args[nArgs], XmNbackground, 0xFF00FF); nArgs++; */
+ motif_XtSetArg(args[nArgs], XmNmarginWidth, 0); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNmarginHeight, 0); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNresizePolicy, XmRESIZE_NONE); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNtraversalOn, 1); nArgs++;
+ drawingHandle = motif.XmCreateDrawingArea(scrolledHandle, NULL, args, nArgs);
if(drawingHandle == 0)
return -1;
- XtManageChild(drawingHandle);
+ motif.XtManageChild(drawingHandle);
nArgs = 0;
- XtSetArg(args[nArgs], XmNlabelType, XmPIXMAP); nArgs++;
- XtSetArg(args[nArgs], XmNlabelPixmap, splashPixmap);nArgs++;
- XtSetArg(args[nArgs], XmNwidth, width); nArgs++;
- XtSetArg(args[nArgs], XmNheight, height); nArgs++;
- XtSetArg(args[nArgs], XmNmarginWidth, 0); nArgs++;
- XtSetArg(args[nArgs], XmNmarginHeight, 0); nArgs++;
- image = XmCreateLabelGadget ( drawingHandle, "", args, nArgs );
- XtManageChild( image );
+ motif_XtSetArg(args[nArgs], XmNlabelType, XmPIXMAP); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNlabelPixmap, splashPixmap); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNwidth, width); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNheight, height); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNmarginWidth, 0); nArgs++;
+ motif_XtSetArg(args[nArgs], XmNmarginHeight, 0); nArgs++;
+ image = motif.XmCreateLabelGadget ( drawingHandle, "", args, nArgs );
+ motif.XtManageChild( image );
- XtRealizeWidget(shellHandle);
- XtSetMappedWhenManaged(shellHandle, 1);
+ motif.XtRealizeWidget(shellHandle);
+ motif.XtSetMappedWhenManaged(shellHandle, 1);
- if(XtIsTopLevelShell(shellHandle))
- XtMapWidget(shellHandle);
+ if(motif_XtIsTopLevelShell(shellHandle))
+ motif_XtMapWidget(shellHandle);
else
- XtPopup(shellHandle, XtGrabNone);
+ motif.XtPopup(shellHandle, XtGrabNone);
/* Centre the splash screen and display it. */
centreShell( shellHandle, drawingHandle );
@@ -202,10 +200,10 @@ jlong getSplashHandle() {
void dispatchMessages() {
XtInputMask mask;
- if (appContext != NULL) {
+ if (appContext != NULL && motif.XtAppPending != 0) {
/* Process any outstanding messages */
- while ((mask = XtAppPending(appContext)) != 0) {
- XtAppProcessEvent(appContext, mask);
+ while ((mask = motif.XtAppPending(appContext)) != 0) {
+ motif.XtAppProcessEvent(appContext, mask);
}
}
}
@@ -214,7 +212,7 @@ void takeDownSplash()
{
if (shellHandle != 0)
{
- XtDestroyWidget( shellHandle );
+ motif.XtDestroyWidget( shellHandle );
/*XFlush( XtDisplay( shellHandle ) );*/
shellHandle = NULL;
}
@@ -287,6 +285,18 @@ int launchJavaVM( char* args[] )
fixEnvForMozilla();
#endif /* MOZILLA_FIX */
+ {
+ /* put the root of eclipse on the LD_LIBRARY_PATH */
+ char * ldPath = (char*)getenv(_T_ECLIPSE("LD_LIBRARY_PATH"));
+ char * root = getProgramDir();
+ if (root != NULL) {
+ char * newPath = malloc((strlen(root) + strlen(ldPath) + 2) * sizeof(char));
+ sprintf(newPath, "%s%c%s", root, pathSeparator, ldPath);
+ setenv("LD_LIBRARY_PATH", newPath, 1);
+ free(newPath);
+ }
+ }
+
/* Create a child process for the JVM. */
jvmProcess = fork();
if (jvmProcess == 0)
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h
new file mode 100644
index 000000000..92fa13d3a
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#ifndef ECLIPSE_MOTIF_H
+#define ECLIPSE_MOTIF_H
+
+#include <Xm/XmAll.h>
+#include <X11/X.h>
+#include <X11/Xlib.h>
+#include <X11/IntrinsicP.h>
+#include <X11/Intrinsic.h>
+#include <X11/Shell.h>
+
+#ifndef NO_XINERAMA_EXTENSIONS
+#include <X11/extensions/Xinerama.h>
+#endif
+
+struct MOTIF_PTRS {
+#ifndef NO_XINERAMA_EXTENSIONS
+ Bool (*XineramaIsActive) (Display*);
+ XineramaScreenInfo* (*XineramaQueryScreens) (Display*, int*);
+#endif
+ Widget (*XmCreateDrawingArea) (Widget, String, ArgList, Cardinal);
+ Widget (*XmCreateLabelGadget) (Widget, char *, Arg *, Cardinal);
+ Widget (*XmCreateMainWindow) (Widget, char *, ArgList, Cardinal);
+ Widget (*XmCreateMessageDialog)(Widget, String, ArgList, Cardinal);
+ Widget (*XmMessageBoxGetChild) (Widget, unsigned char);
+ void (*XmStringFree) (XmString);
+ XmString (*XmStringGenerate) (XtPointer, XmStringTag, XmTextType, XmStringTag);
+
+ void (*XtAddCallback) (Widget, String, XtCallbackProc, XtPointer);
+ Widget (*XtAppCreateShell) (String, String, WidgetClass, Display*, ArgList, Cardinal);
+ void (*XtAppNextEvent) (XtAppContext, XEvent*);
+ XtInputMask (*XtAppPending) (XtAppContext);
+ void (*XtAppProcessEvent) (XtAppContext, XtInputMask);
+ void (*XtDestroyWidget) (Widget);
+ Boolean (*XtDispatchEvent) (XEvent*);
+ void (*XtGetValues) (Widget, ArgList, Cardinal);
+ Widget (*XtInitialize) (String, String, XrmOptionDescRec*, Cardinal, int*, char**);
+ Boolean (*XtIsManaged) (Widget);
+ void (*XtManageChild) (Widget);
+ int (*XtMapWidget) (Widget);
+ void (*XtPopup) (Widget, XtGrabKind);
+ void (*XtRealizeWidget) (Widget);
+ Widget (*XtSetLanguageProc) (XtAppContext, XtLanguageProc, XtPointer);
+ void (*XtSetMappedWhenManaged)(Widget, Boolean);
+ void (*XtSetValues) (Widget, ArgList, Cardinal);
+ void (*XtUnmanageChild) (Widget);
+ XtAppContext (*XtWidgetToApplicationContext) (Widget);
+ Window (*XtWindowOfObject) (Widget);
+
+ Screen * (*XDefaultScreenOfDisplay)(Display*);
+ int (*XFree) (void*);
+ int (*XFlush) (Display*);
+ Status (*XGetGeometry) (Display*, Drawable, Window*, int*, int*, unsigned int*, unsigned int*, unsigned int*, unsigned int*);
+ int (*XMapWindow) (Display*, Window);
+
+ char * _XmStrings;
+ char * XtShellStrings;
+ char * XtStrings;
+ WidgetClass *applicationShellWidgetClass;
+};
+
+extern struct MOTIF_PTRS motif;
+
+#define motif_XtDisplay XtDisplay
+#define motif_XtSetArg XtSetArg
+#define motif_XtWindow XtWindow
+#define motif_XtIsTopLevelShell XtIsTopLevelShell
+#define motif_XtIsRealized(object) (motif.XtWindowOfObject(object) != None)
+#define motif_XtMapWidget(widget) motif.XMapWindow(XtDisplay(widget), XtWindow(widget))
+
+#define _XmStrings motif._XmStrings
+#define XtShellStrings motif.XtShellStrings
+#define XtStrings motif.XtStrings
+
+/* macro resolves to { (void**)&motif.foo, "foo" }, use it to initialize FN_TABLEs */
+#define FN_TABLE_ENTRY(fn) { (void**)&motif.fn, #fn }
+typedef struct {
+ void ** fnPtr;
+ char * fnName;
+} FN_TABLE;
+
+extern int loadMotif();
+#endif
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c
index b9a50d02c..998f53cb1 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c
@@ -12,20 +12,11 @@
#include "eclipseCommon.h"
#include "eclipseOS.h"
+#include "eclipseMotif.h"
#include <locale.h>
#include <dlfcn.h>
#include <stdlib.h>
-#include <Xm/XmAll.h>
-#include <X11/X.h>
-#include <X11/Xlib.h>
-#include <X11/IntrinsicP.h>
-#include <X11/Intrinsic.h>
-#include <X11/Shell.h>
-
-#ifndef NO_XINERAMA_EXTENSIONS
-#include <X11/extensions/Xinerama.h>
-#endif
#define ECLIPSE_ICON 401
@@ -33,7 +24,6 @@ char dirSeparator = '/';
char pathSeparator = ':';
void centreShell( Widget widget, Widget expose );
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
/* Global Variables */
XtAppContext appContext = 0;
@@ -55,53 +45,52 @@ void displayMessage( char* title, char* message )
int nArgs;
XEvent event;
- /* If there is no associated display, just print the error and return. */
+ /* If there is no associated display, or we fail to initialize Xt, just print the error and return. */
displayName = getenv("DISPLAY");
- if (displayName == NULL || strlen(displayName) == 0)
+ if ( displayName == NULL || strlen(displayName) == 0 ||
+ (topWindow == 0 && initWindowSystem( &saveArgc, saveArgv, 1 ) != 0) )
{
- printf( "%s: %s\n", title, message );
return;
}
-
- /* If Xt has not been initialized yet, do it now. */
- if (topWindow == 0)
- {
- initWindowSystem( &saveArgc, saveArgv, 1 );
- }
-
- msg = XmStringGenerate( message, NULL, XmCHARSET_TEXT, NULL );
+ msg = motif.XmStringGenerate( message, NULL, XmCHARSET_TEXT, NULL );
- /* Output a simple message box. */
+ /* Output a simple message box. */
nArgs = 0;
- XtSetArg( arg[ nArgs ], XmNdialogType, XmDIALOG_MESSAGE ); nArgs++;
- XtSetArg( arg[ nArgs ], XmNtitle, title ); nArgs++;
- XtSetArg( arg[ nArgs ], XmNmessageString, msg ); nArgs++;
- msgBox = XmCreateMessageDialog( topWindow, getOfficialName(), arg, nArgs );
- XtUnmanageChild( XmMessageBoxGetChild( msgBox, XmDIALOG_CANCEL_BUTTON ) );
- XtUnmanageChild( XmMessageBoxGetChild( msgBox, XmDIALOG_HELP_BUTTON ) );
- XtManageChild( msgBox );
+
+ motif_XtSetArg( arg[ nArgs ], XmNdialogType, XmDIALOG_MESSAGE ); nArgs++;
+ motif_XtSetArg( arg[ nArgs ], XmNtitle, title ); nArgs++;
+ motif_XtSetArg( arg[ nArgs ], XmNmessageString, msg ); nArgs++;
+ msgBox = motif.XmCreateMessageDialog( topWindow, getOfficialName(), arg, nArgs );
+
+ motif.XtUnmanageChild( motif.XmMessageBoxGetChild( msgBox, XmDIALOG_CANCEL_BUTTON ) );
+ motif.XtUnmanageChild( motif.XmMessageBoxGetChild( msgBox, XmDIALOG_HELP_BUTTON ) );
+ motif.XtManageChild( msgBox );
centreShell( msgBox, msgBox );
- if (msg != 0) XmStringFree (msg);
+ if (msg != 0) motif.XmStringFree (msg);
/* Wait for the OK button to be pressed. */
- while (XtIsRealized( msgBox ) && XtIsManaged( msgBox ))
+ while (motif_XtIsRealized( msgBox ) && motif.XtIsManaged( msgBox ))
{
- XtAppNextEvent( appContext, &event );
- XtDispatchEvent( &event );
+ motif.XtAppNextEvent( appContext, &event );
+ motif.XtDispatchEvent( &event );
}
- XtDestroyWidget( msgBox );
+ motif.XtDestroyWidget( msgBox );
}
/* Initialize Window System
*
* Initialize the Xt and Xlib.
*/
-void initWindowSystem( int* pArgc, char* argv[], int showSplash )
+int initWindowSystem( int* pArgc, char* argv[], int showSplash )
{
Arg arg[20];
if(motifInitialized == 1)
- return;
+ return 0;
+
+ if (loadMotif() != 0)
+ return -1;
+
/* Save the arguments in case displayMessage() is called in the main launcher. */
if (saveArgv == 0)
{
@@ -110,14 +99,20 @@ void initWindowSystem( int* pArgc, char* argv[], int showSplash )
}
/* Create the top level shell that will not be used other than
- to initialize the application. */
+ to initialize the application.
+ */
+#ifdef AIX
topWindow = XtInitialize(NULL, getOfficialName(), NULL, 0, pArgc, argv);
- appContext = XtWidgetToApplicationContext(topWindow);
- XtSetLanguageProc (appContext, NULL, NULL);
- XtSetArg( arg[ 0 ], XmNmappedWhenManaged, False );
- XtSetValues( topWindow, arg, 1 );
- XtRealizeWidget( topWindow );
+#else
+ topWindow = motif.XtInitialize(NULL, getOfficialName(), NULL, 0, pArgc, argv);
+#endif
+ appContext = motif.XtWidgetToApplicationContext(topWindow);
+ motif.XtSetLanguageProc (appContext, NULL, NULL);
+ motif_XtSetArg( arg[ 0 ], XmNmappedWhenManaged, False );
+ motif.XtSetValues( topWindow, arg, 1 );
+ motif.XtRealizeWidget( topWindow );
motifInitialized = 1;
+ return 0;
}
/* Centre the shell on the screen. */
@@ -140,27 +135,27 @@ void centreShell( Widget widget, Widget expose )
#endif
/* Realize the shell to calculate its width/height. */
- XtRealizeWidget( widget );
+ motif.XtRealizeWidget( widget );
/* Get the desired dimensions of the shell. */
nArgs = 0;
- XtSetArg( arg[ nArgs ], XmNwidth, &width ); nArgs++;
- XtSetArg( arg[ nArgs ], XmNheight, &height ); nArgs++;
- XtSetArg( arg[ nArgs ], XmNscreen, &screen ); nArgs++;
- XtGetValues( widget, arg, nArgs );
+ motif_XtSetArg( arg[ nArgs ], XmNwidth, &width ); nArgs++;
+ motif_XtSetArg( arg[ nArgs ], XmNheight, &height ); nArgs++;
+ motif_XtSetArg( arg[ nArgs ], XmNscreen, &screen ); nArgs++;
+ motif.XtGetValues( widget, arg, nArgs );
screenWidth = screen->width;
screenHeight = screen->height;
#ifndef NO_XINERAMA_EXTENSIONS
- display = XtDisplay( widget );
- if (XineramaIsActive( display )) {
- info = XineramaQueryScreens( display, &monitorCount );
+ display = motif_XtDisplay( widget );
+ if (motif.XineramaIsActive != 0 && motif.XineramaIsActive( display )) {
+ info = motif.XineramaQueryScreens( display, &monitorCount );
if (info != 0) {
if (monitorCount > 1) {
screenWidth = info->width;
screenHeight = info->height;
}
- XFree (info);
+ motif.XFree (info);
}
}
#endif
@@ -171,28 +166,28 @@ void centreShell( Widget widget, Widget expose )
/* Set the new shell position and display it. */
nArgs = 0;
- XtSetArg( arg[ nArgs ], XmNx, x ); nArgs++;
- XtSetArg( arg[ nArgs ], XmNy, y ); nArgs++;
- XtSetValues( widget, arg, nArgs );
- XtMapWidget( widget );
+ motif_XtSetArg( arg[ nArgs ], XmNx, x ); nArgs++;
+ motif_XtSetArg( arg[ nArgs ], XmNy, y ); nArgs++;
+ motif.XtSetValues( widget, arg, nArgs );
+ motif_XtMapWidget( widget );
/* Wait for an expose event on the desired widget. This wait loop is required when
* the startVM command fails and the message box is created before the splash
* window is displayed. Without this wait, the message box sometimes appears
* under the splash window and the user cannot see it.
*/
- context = XtWidgetToApplicationContext( widget );
+ context = motif.XtWidgetToApplicationContext( widget );
waiting = True;
while (waiting)
{
- XtAppNextEvent( context, &event );
- if (event.xany.type == Expose && event.xany.window == XtWindow( expose ))
+ motif.XtAppNextEvent( context, &event );
+ if (event.xany.type == Expose && event.xany.window == motif_XtWindow( expose ))
{
waiting = False;
}
- XtDispatchEvent( &event );
+ motif.XtDispatchEvent( &event );
}
- XFlush( XtDisplay( widget ) );
+ motif.XFlush( motif_XtDisplay( widget ) );
}
/* Load the specified shared library
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c
new file mode 100644
index 000000000..794342221
--- /dev/null
+++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+#include "eclipseMotif.h"
+#include "eclipseCommon.h"
+#include <dlfcn.h>
+#include <stdlib.h>
+
+struct MOTIF_PTRS motif;
+
+/* need to undef these so the FN_TABLE works ok */
+#undef _XmStrings
+#undef XtShellStrings
+#undef XtStrings
+
+/* functions from libXm */
+static FN_TABLE xmFunctions[] = { FN_TABLE_ENTRY(XmCreateDrawingArea),
+ FN_TABLE_ENTRY(XmCreateLabelGadget),
+ FN_TABLE_ENTRY(XmCreateMainWindow),
+ FN_TABLE_ENTRY(XmCreateMessageDialog),
+ FN_TABLE_ENTRY(XmMessageBoxGetChild),
+ FN_TABLE_ENTRY(XmStringFree),
+ FN_TABLE_ENTRY(XmStringGenerate),
+ FN_TABLE_ENTRY(_XmStrings), /* not a function */
+ { NULL, NULL }
+ };
+
+/* functions from libXt */
+static FN_TABLE xtFunctions[] = { FN_TABLE_ENTRY(XtAddCallback),
+ FN_TABLE_ENTRY(XtAppCreateShell),
+ FN_TABLE_ENTRY(XtAppNextEvent),
+ FN_TABLE_ENTRY(XtAppPending),
+ FN_TABLE_ENTRY(XtAppProcessEvent),
+ FN_TABLE_ENTRY(XtDestroyWidget),
+ FN_TABLE_ENTRY(XtDispatchEvent),
+ FN_TABLE_ENTRY(XtGetValues),
+#ifndef AIX
+ FN_TABLE_ENTRY(XtInitialize),
+#endif
+ FN_TABLE_ENTRY(XtIsManaged),
+ FN_TABLE_ENTRY(XtManageChild),
+ FN_TABLE_ENTRY(XtMapWidget),
+ FN_TABLE_ENTRY(XtPopup),
+ FN_TABLE_ENTRY(XtRealizeWidget),
+ FN_TABLE_ENTRY(XtSetLanguageProc),
+ FN_TABLE_ENTRY(XtSetMappedWhenManaged),
+ FN_TABLE_ENTRY(XtSetValues),
+ FN_TABLE_ENTRY(XtUnmanageChild),
+ FN_TABLE_ENTRY(XtWidgetToApplicationContext),
+ FN_TABLE_ENTRY(XtWindowOfObject),
+ FN_TABLE_ENTRY(XtShellStrings), /* not a function */
+ FN_TABLE_ENTRY(XtStrings), /* not a function */
+ FN_TABLE_ENTRY(applicationShellWidgetClass), /* not a function */
+ { NULL, NULL }
+ };
+
+/* functions from libX11 */
+static FN_TABLE x11Functions[] = { FN_TABLE_ENTRY(XDefaultScreenOfDisplay),
+ FN_TABLE_ENTRY(XFree),
+ FN_TABLE_ENTRY(XFlush),
+ FN_TABLE_ENTRY(XGetGeometry),
+ FN_TABLE_ENTRY(XMapWindow),
+ { NULL, NULL }
+ };
+
+#ifndef NO_XINERAMA_EXTENSIONS
+static FN_TABLE xinFunctions[] = { FN_TABLE_ENTRY(XineramaIsActive),
+ FN_TABLE_ENTRY(XineramaQueryScreens),
+ { NULL, NULL }
+ };
+#endif
+
+static int loadMotifSymbols( void * library, FN_TABLE * table) {
+ int i = 0;
+ void * fn;
+ for (i = 0; table[i].fnName != NULL; i++) {
+ fn = findSymbol(library, table[i].fnName);
+ if (fn != 0) {
+ *(table[i].fnPtr) = fn;
+ } else {
+ *(table[i].fnPtr) = 0;
+ return -1;
+ }
+ }
+ return 0;
+}
+
+int loadMotif() {
+ void * xmLib = NULL, *xtLib = NULL, *x11Lib = NULL, *xinLib = NULL;
+ char * path = getProgramDir();
+ int dlFlags = RTLD_LAZY;
+
+ /* initialize ptr struct to 0's */
+ memset(&motif, 0, sizeof(struct MOTIF_PTRS));
+
+#ifndef AIX
+ if (path != NULL) {
+ /* look for libXm first in the root of eclipse */
+ char * lib = malloc((strlen(path) + strlen(_T_ECLIPSE(XM_LIB)) + 2) * sizeof(char));
+ sprintf( lib, "%s%c%s", path, dirSeparator, XM_LIB);
+ xmLib = dlopen(lib, dlFlags);
+ free(lib);
+ }
+#else
+ dlFlags |= RTLD_MEMBER;
+#endif
+
+ if (xmLib == NULL) {
+ xmLib = dlopen(XM_LIB, dlFlags);
+ }
+
+ if (xmLib == NULL) {
+ /* bail now, don't load the others, libXm must be loaded first, so leave things for
+ * swt to do later */
+ return -1;
+ }
+
+ xtLib = dlopen(XT_LIB, dlFlags);
+ x11Lib = dlopen(X11_LIB, dlFlags);
+
+ /* printf("XmLib: %s: %x\nXtLib: %s: %x\nX11Lib:%s, %x\n", XM_LIB, xmLib, XT_LIB, xtLib, X11_LIB, x11Lib);*/
+#ifndef NO_XINERAMA_EXTENSIONS
+ /* don't fail without Xinerama */
+ xinLib = dlopen(XIN_LIB, dlFlags);
+ if (xinLib != NULL)
+ loadMotifSymbols(xinLib, xinFunctions);
+#endif
+ if( xtLib == NULL || x11Lib == NULL)
+ return -1;
+
+ if (loadMotifSymbols(xmLib, xmFunctions) != 0) return -1;
+ if (loadMotifSymbols(xtLib, xtFunctions) != 0) return -1;
+ if (loadMotifSymbols(x11Lib, x11Functions) != 0) return -1;
+
+ return 0;
+}
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak
index 4801f4157..4ec36125f 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak
@@ -29,13 +29,15 @@ PROGRAM_LIBRARY=eclipse_$(LIB_VERSION).so
CC = cc_r
# Define the object modules to be compiled and flags.
MAIN_OBJS = eclipseMain.o
-COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o eclipseMotifInit.o
DLL_OBJS = eclipse.o eclipseMotif.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o\
NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
EXEC = $(PROGRAM_OUTPUT)
DLL = $(PROGRAM_LIBRARY)
-LIBS = -L$(MOTIF_HOME)/lib -lXm -lXt -lX11
+LIBS = -L$(MOTIF_HOME)/lib -ldl -lXm -lXt -lX11
+MOTIF_LIBS = -DXM_LIB="\"libXm.a(shr_32.o)\"" -DXT_LIB="\"libXt.a(shr4.o)\"" -DX11_LIB="\"libX11.a(shr4.o)\""
+#MOTIF_LIBS = -DXM_LIB="NULL" -DXT_LIB="NULL" -DX11_LIB="NULL"
LFLAGS = -G -bnoentry -bexpall -lm -lc_r -lC_r
CFLAGS = -O -s \
-DMOTIF \
@@ -43,6 +45,7 @@ CFLAGS = -O -s \
-DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
-DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
-DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ $(MOTIF_LIBS) \
-DDEFAULT_JAVA_EXEC \
-DAIX \
-I./ \
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak
index 668ee436e..740a75986 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_linux.mak
@@ -36,21 +36,23 @@ endif
# Define the object modules to be compiled and flags.
CC=gcc
MAIN_OBJS = eclipseMain.o
-COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o eclipseMotifInit.o
DLL_OBJS = eclipse.o eclipseMotif.o eclipseUtil.o eclipseJNI.o eclipseMozilla.o eclipseShm.o eclipseNix.o \
NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
EXEC = $(PROGRAM_OUTPUT)
DLL = $(PROGRAM_LIBRARY)
-LIBS = -Xlinker -rpath -Xlinker . -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lXm -lXt -lX11 -lXinerama -lpthread
+LIBS = -Xlinker -rpath -Xlinker . -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lpthread -ldl
+MOTIF_LIBS = -DXM_LIB="\"libXm.so.2\"" -DXT_LIB="\"libXt.so.6\"" -DX11_LIB="\"libX11.so.6\"" -DXIN_LIB="\"libXinerama.so.1\""
LFLAGS = -shared -fpic -Wl,--export-dynamic
-CFLAGS = -O -s -Wall \
+CFLAGS = -g -s -Wall \
-DLINUX \
-DMOTIF \
-DMOZILLA_FIX \
-DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
-DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
-DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ $(MOTIF_LIBS) \
-D$(DEFAULT_JAVA)\
-fPIC \
-I./ \
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak b/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak
index d9be492bb..fad1e84a5 100644
--- a/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak
+++ b/bundles/org.eclipse.equinox.executable/library/motif/make_solaris.mak
@@ -31,7 +31,7 @@ PROGRAM_LIBRARY=eclipse_$(LIB_VERSION).so
# Define the object modules to be compiled and flags.
MAIN_OBJS = eclipseMain.o
-COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o
+COMMON_OBJS = eclipseConfig.o eclipseCommon.o eclipseMotifCommon.o eclipseMotifInit.o
DLL_OBJS = eclipse.o eclipseMotif.o eclipseUtil.o eclipseJNI.o eclipseShm.o eclipseNix.o\
NgCommon.o NgImage.o NgImageData.o NgWinBMPFileFormat.o
PICFLAG = -K PIC
@@ -41,7 +41,8 @@ OPTFLAG = -O -s
EXEC = $(PROGRAM_OUTPUT)
DLL = $(PROGRAM_LIBRARY)
-LIBS = -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lXm -lXt -lX11 -lintl -lthread -ldl -lc
+LIBS = -L$(MOTIF_HOME)/lib -L$(X11_HOME)/lib -lintl -lthread -ldl -lc
+MOTIF_LIBS = -DXM_LIB="\"libXm.so.4\"" -DXT_LIB="\"libXt.so.4\"" -DX11_LIB="\"libX11.so.4\"" -DXIN_LIB="\"libXinerama.so.1\""
#LFLAGS = -shared -Wl,--export-dynamic
LFLAGS = -G
CFLAGS =$(OPTFLAG) \
@@ -52,6 +53,7 @@ CFLAGS =$(OPTFLAG) \
-DDEFAULT_OS="\"$(DEFAULT_OS)\"" \
-DDEFAULT_OS_ARCH="\"$(DEFAULT_OS_ARCH)\"" \
-DDEFAULT_WS="\"$(DEFAULT_WS)\"" \
+ $(MOTIF_LIBS) \
-I./ \
-I../ \
-I$(MOTIF_HOME)/include \
diff --git a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c
index c33c5b761..23c0f2e04 100644
--- a/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c
+++ b/bundles/org.eclipse.equinox.executable/library/win32/eclipseWinCommon.c
@@ -22,9 +22,6 @@
_TCHAR dirSeparator = _T('\\');
_TCHAR pathSeparator = _T(';');
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
-/*static LRESULT WINAPI WndProc (HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);*/
-
/* Global Main Window*/
#ifdef UNICODE
extern HWND topWindow;
@@ -65,13 +62,13 @@ void displayMessage( _TCHAR* title, _TCHAR* message )
* Return the window handle as the data for the splash command.
*
*/
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
+int initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
{
HINSTANCE module = GetModuleHandle(NULL);
HICON icon = NULL;
if(initialized)
- return;
+ return 0;
/* Create a window that has no decorations. */
InitCommonControls();
@@ -97,6 +94,7 @@ void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
#endif
initialized = 1;
+ return 0;
}
/* Load the specified shared library
diff --git a/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp
index 0d86bad1f..a4aa8bf91 100644
--- a/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp
+++ b/bundles/org.eclipse.equinox.executable/library/wpf/eclipseWpfCommon.cpp
@@ -26,12 +26,8 @@ extern "C" {
_TCHAR dirSeparator = _T('\\');
_TCHAR pathSeparator = _T(';');
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash );
-void displayMessage( _TCHAR* title, _TCHAR* message );
-
static int initialized = 0;
-
/* Load the specified shared library
*/
void * loadLibrary( _TCHAR * library ){
@@ -81,10 +77,11 @@ void displayMessage( _TCHAR* title, _TCHAR* message )
* Return the window handle as the data for the splash command.
*
*/
-void initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
+int initWindowSystem( int* pArgc, _TCHAR* argv[], int showSplash )
{
if(initialized)
- return;
+ return 0;
initialized = 1;
+ return 0;
}
diff --git a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
index f8a7639a8..ab4b08f33 100644
--- a/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
+++ b/bundles/org.eclipse.equinox.launcher/src/org/eclipse/equinox/launcher/Main.java
@@ -99,7 +99,7 @@ public class Main {
private String splashLocation = null;
private String endSplash = null;
private boolean initialize = false;
- private boolean splashDown = false;
+ protected boolean splashDown = false;
public final class SplashHandler extends Thread {
public void run() {
@@ -107,7 +107,7 @@ public class Main {
}
public void updateSplash() {
- if (bridge != null) {
+ if (bridge != null && !splashDown) {
bridge.updateSplash();
}
}
@@ -1806,6 +1806,9 @@ public class Main {
System.getProperties().put(SPLASH_HANDLE, String.valueOf(handle));
System.getProperties().put(SPLASH_LOCATION, splashLocation);
bridge.updateSplash();
+ } else {
+ // couldn't show the splash screen for some reason
+ splashDown = true;
}
}

Back to the top