From db53ed0dece0186f5ea1adad05151206f8f259ce Mon Sep 17 00:00:00 2001 From: Sravan Kumar Lakkimsetti Date: Fri, 22 May 2015 16:20:48 +0530 Subject: Bug 467991 - Enable GTK3 mode for eclipse on ppc64le platform - Modified GTK2 version check to match the ppc64le build platform(only on ppc64le) - Removed the code to force GTK2 execution eventhough GTK3 is available - Modified the code for the case where SWT_GTK3 flag is defined and no compatible gtk3 is available - Updated the patch based on review comments Change-Id: If66755fa938e3b57a464fa457756f97b1400a9ba Signed-off-by: Sravan Kumar Lakkimsetti --- .../library/eclipse.c | 7 ------- .../library/gtk/eclipseGtkInit.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 7 deletions(-) (limited to 'features') diff --git a/features/org.eclipse.equinox.executable.feature/library/eclipse.c b/features/org.eclipse.equinox.executable.feature/library/eclipse.c index c7663665e..444c89b88 100644 --- a/features/org.eclipse.equinox.executable.feature/library/eclipse.c +++ b/features/org.eclipse.equinox.executable.feature/library/eclipse.c @@ -525,13 +525,6 @@ static int _run(int argc, _TCHAR* argv[], _TCHAR* vmArgs[]) } } #endif -#endif - -#ifdef LINUX -#ifdef __ppc64le__ - /* set the swt gtk3 flag to 0 so that we use only GTK2 on ppc64le platform */ - setenv("SWT_GTK3","0",1); -#endif #endif /* try to open the specified file in an already running eclipse */ 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 8abe5d615..a615316ec 100644 --- a/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c +++ b/features/org.eclipse.equinox.executable.feature/library/gtk/eclipseGtkInit.c @@ -26,6 +26,11 @@ static _TCHAR* upgradeWarning2 = _T_ECLIPSE("\nor use an older version of Eclips static int minGtkMajorVersion = 2; static int minGtkMinorVersion = 18; static int minGtkMicroVersion = 0; +#ifdef __ppc64le__ +static int minGtk3MajorVersion = 3; +static int minGtk3MinorVersion = 10; +static int minGtk3MicroVersion = 9; +#endif /* tables to help initialize the function pointers */ /* functions from libgtk-x11-2.0 or libgtk-3.so.0*/ @@ -131,6 +136,23 @@ int loadGtk() { if (gdkCoreDeviceEvents == NULL) { setenv("GDK_CORE_DEVICE_EVENTS", "1", 0); } +#ifdef __ppc64le__ + if (gtkLib != NULL) { + const char * (*func)(int, int, int); + dlerror(); + *(void**) (&func) = dlsym(gtkLib, "gtk_check_version"); + if (dlerror() == NULL && func) { + const char *check = (*func)(minGtk3MajorVersion, minGtk3MinorVersion, minGtk3MicroVersion); + if (check != NULL) { + dlclose(gdkLib); + dlclose(gtkLib); + gdkLib = gtkLib = NULL; + setenv("SWT_GTK3","0",0); + } + } + } +#endif + } if (!gtkLib || !gdkLib) { //if GTK+ 2 gdkLib = dlopen(GDK_LIB, DLFLAGS); -- cgit v1.2.3