diff options
Diffstat (limited to 'bundles/org.eclipse.equinox.executable/library/motif')
5 files changed, 71 insertions, 10 deletions
diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h index 92fa13d3a..26b807b8a 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotif.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2009 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 @@ -45,6 +45,9 @@ struct MOTIF_PTRS { Boolean (*XtDispatchEvent) (XEvent*); void (*XtGetValues) (Widget, ArgList, Cardinal); Widget (*XtInitialize) (String, String, XrmOptionDescRec*, Cardinal, int*, char**); +#ifdef AIX + Widget (*eclipseXtInitialize) (String, String, XrmOptionDescRec*, Cardinal, int*, char**); +#endif Boolean (*XtIsManaged) (Widget); void (*XtManageChild) (Widget); int (*XtMapWidget) (Widget); diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c index 041450dd0..93f21cbd3 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifCommon.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2006 IBM Corporation and others. + * Copyright (c) 2006, 2009 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 @@ -50,6 +50,7 @@ void displayMessage( char* title, char* message ) if ( displayName == NULL || strlen(displayName) == 0 || (topWindow == 0 && initWindowSystem( &saveArgc, saveArgv, 1 ) != 0) ) { + printf("%s:\n%s\n", title, message); return; } msg = motif.XmStringGenerate( message, NULL, XmCHARSET_TEXT, NULL ); @@ -107,7 +108,7 @@ int initWindowSystem( int* pArgc, char* argv[], int showSplash ) to initialize the application. */ #ifdef AIX - topWindow = XtInitialize(NULL, officialName, NULL, 0, pArgc, argv); + topWindow = motif.eclipseXtInitialize(NULL, officialName, NULL, 0, pArgc, argv); #else topWindow = motif.XtInitialize(NULL, officialName, NULL, 0, pArgc, argv); #endif diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c index 794342221..84e7295f9 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifInit.c @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2007 IBM Corporation and others. + * Copyright (c) 2007, 2009 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 @@ -62,6 +62,10 @@ static FN_TABLE xtFunctions[] = { FN_TABLE_ENTRY(XtAddCallback), { NULL, NULL } }; +#ifdef AIX +static FN_TABLE shimFunctions[] = { FN_TABLE_ENTRY(eclipseXtInitialize), {NULL, NULL} }; +#endif + /* functions from libX11 */ static FN_TABLE x11Functions[] = { FN_TABLE_ENTRY(XDefaultScreenOfDisplay), FN_TABLE_ENTRY(XFree), @@ -93,8 +97,31 @@ static int loadMotifSymbols( void * library, FN_TABLE * table) { return 0; } +#ifdef AIX +void * loadMotifShimLibrary() { + if (eclipseLibrary != NULL) { + /* library is the normal eclipse_<ver>.so, look for libeclipse-motif.so beside it */ + _TCHAR* eclipseMotifLib = _T_ECLIPSE("libeclipse-motif.so"); + _TCHAR* path = strdup(eclipseLibrary); + _TCHAR* c = strrchr(path, '/'); + if (c == NULL) + return NULL; + + *c = 0; + c = malloc((strlen(path) + 2 + strlen(eclipseMotifLib)) * sizeof(char)); + _stprintf(c, _T_ECLIPSE("%s/%s"), path, eclipseMotifLib); + + return dlopen(c, RTLD_LAZY); + } + return 0; +} +#endif + int loadMotif() { void * xmLib = NULL, *xtLib = NULL, *x11Lib = NULL, *xinLib = NULL; +#ifdef AIX + void * motifShim = NULL; +#endif char * path = getProgramDir(); int dlFlags = RTLD_LAZY; @@ -111,7 +138,10 @@ int loadMotif() { } #else dlFlags |= RTLD_MEMBER; -#endif + motifShim = loadMotifShimLibrary(); + if (motifShim == NULL) + return -1; +#endif if (xmLib == NULL) { xmLib = dlopen(XM_LIB, dlFlags); @@ -139,6 +169,9 @@ int loadMotif() { if (loadMotifSymbols(xmLib, xmFunctions) != 0) return -1; if (loadMotifSymbols(xtLib, xtFunctions) != 0) return -1; if (loadMotifSymbols(x11Lib, x11Functions) != 0) return -1; +#ifdef AIX + if (loadMotifSymbols(motifShim, shimFunctions) !=0) return -1; +#endif return 0; } diff --git a/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifShim.c b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifShim.c new file mode 100644 index 000000000..2648ec65e --- /dev/null +++ b/bundles/org.eclipse.equinox.executable/library/motif/eclipseMotifShim.c @@ -0,0 +1,17 @@ +/******************************************************************************* + * Copyright (c) 2009 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 <X11/X.h> +#include <X11/Xlib.h> +#include <Xm/XmAll.h> + +Widget eclipseXtInitialize(String shellName, String appClass, XrmOptionDescRec* options, Cardinal numOptions, int* argc, char** argv) { + return XtInitialize(shellName, appClass, options, numOptions, argc, argv); +} 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 26fcad1aa..1d4689e1c 100644 --- a/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak +++ b/bundles/org.eclipse.equinox.executable/library/motif/make_aix.mak @@ -1,5 +1,5 @@ #******************************************************************************* -# Copyright (c) 2000, 2005 IBM Corporation and others. +# Copyright (c) 2000, 2009 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 @@ -25,17 +25,20 @@ include ../make_version.mak PROGRAM_OUTPUT=eclipse PROGRAM_LIBRARY=eclipse_$(LIB_VERSION).so +SHIM=libeclipse-motif.so CC = gcc # Define the object modules to be compiled and flags. MAIN_OBJS = eclipseMain.o +SHIM_OBJS = eclipseMotifShim.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 -ldl -lXm -lXt -lX11 +LIBS = -L$(MOTIF_HOME)/lib -ldl +SHIM_LIBS = -L$(MOTIF_HOME)/lib -lXm -lXt -lX11 MOTIF_LIBS = -DXM_LIB="\"libXm.a(shr_32.o)\"" -DXT_LIB="\"libXt.a(shr4.o)\"" -DX11_LIB="\"libX11.a(shr4.o)\"" LFLAGS = -G -bnoentry -bexpall -lm -lc_r -lC_r CFLAGS = -O -s \ @@ -51,7 +54,7 @@ CFLAGS = -O -s \ -I$(MOTIF_HOME)/include \ -I/usr/java5/include -all: $(EXEC) $(DLL) +all: $(EXEC) $(DLL) $(SHIM) .c.o: $(CC) $(CFLAGS) -c $< -o $@ @@ -86,12 +89,16 @@ $(EXEC): $(MAIN_OBJS) $(COMMON_OBJS) $(DLL): $(DLL_OBJS) $(COMMON_OBJS) ld $(LFLAGS) -o $(DLL) $(DLL_OBJS) $(COMMON_OBJS) $(LIBS) - + +$(SHIM): $(SHIM_OBJS) + ld $(LFLAGS) -o $(SHIM) $(SHIM_OBJS) $(SHIM_LIBS) + install: all cp $(EXEC) $(OUTPUT_DIR) + cp $(SHIM) $(OUTPUT_DIR) cp $(DLL) $(LIBRARY_DIR) rm -f $(EXEC) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS) clean: - rm -f $(EXEC) $(DLL) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS) + rm -f $(EXEC) $(DLL) $(SHIM) $(SHIM_OBJS) $(MAIN_OBJS) $(COMMON_OBJS) $(DLL_OBJS) |