View | Details | Raw Unified | Return to bug 62431
Collapse All | Expand All

(-)Eclipse SWT PI/gtk/library/make_linux.mak (-1 / +20 lines)
Lines 28-33 Link Here
28
XULRUNNER_PREFIX = swt-xulrunner
28
XULRUNNER_PREFIX = swt-xulrunner
29
XPCOMINIT_PREFIX = swt-xpcominit
29
XPCOMINIT_PREFIX = swt-xpcominit
30
GLX_PREFIX = swt-glx
30
GLX_PREFIX = swt-glx
31
IME_PREFIX = swt-ime
31
32
32
SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
33
SWT_LIB = lib$(SWT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
33
CDE_LIB = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
34
CDE_LIB = lib$(CDE_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
Lines 40-45 Link Here
40
XULRUNNER_LIB = lib$(XULRUNNER_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
41
XULRUNNER_LIB = lib$(XULRUNNER_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
41
XPCOMINIT_LIB = lib$(XPCOMINIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
42
XPCOMINIT_LIB = lib$(XPCOMINIT_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
42
GLX_LIB = lib$(GLX_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
43
GLX_LIB = lib$(GLX_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
44
IME_LIB = lib$(IME_PREFIX)-$(WS_PREFIX)-$(SWT_VERSION).so
43
45
44
CAIROCFLAGS = `pkg-config --cflags cairo`
46
CAIROCFLAGS = `pkg-config --cflags cairo`
45
CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo
47
CAIROLIBS = `pkg-config --libs-only-L cairo` -lcairo
Lines 61-66 Link Here
61
GLXCFLAGS = 
63
GLXCFLAGS = 
62
GLXLIBS = -shared -fPIC -L/usr/X11R6/lib -lGL -lGLU -lm
64
GLXLIBS = -shared -fPIC -L/usr/X11R6/lib -lGL -lGLU -lm
63
65
66
IMECFLAGS =
67
# -I/usr/include 
68
64
# Uncomment for Native Stats tool
69
# Uncomment for Native Stats tool
65
#NATIVE_STATS = -DNATIVE_STATS
70
#NATIVE_STATS = -DNATIVE_STATS
66
71
Lines 91-96 Link Here
91
XULRUNNER_OBJECTS = swt.o xpcomxul.o xpcomxul_custom.o xpcomxul_structs.o xpcomxul_stats.o
96
XULRUNNER_OBJECTS = swt.o xpcomxul.o xpcomxul_custom.o xpcomxul_structs.o xpcomxul_stats.o
92
XPCOMINIT_OBJECTS = swt.o xpcominit.o xpcominit_structs.o xpcominit_stats.o
97
XPCOMINIT_OBJECTS = swt.o xpcominit.o xpcominit_structs.o xpcominit_stats.o
93
GLX_OBJECTS = swt.o glx.o glx_structs.o glx_stats.o
98
GLX_OBJECTS = swt.o glx.o glx_structs.o glx_stats.o
99
IME_OBJECTS = swt.o ime_custom.o
94
100
95
CFLAGS = -O -Wall \
101
CFLAGS = -O -Wall \
96
		-DSWT_VERSION=$(SWT_VERSION) \
102
		-DSWT_VERSION=$(SWT_VERSION) \
Lines 108-114 Link Here
108
	LIBS := $(LIBS) -s
114
	LIBS := $(LIBS) -s
109
endif
115
endif
110
116
111
all: make_swt make_atk make_gnome make_glx
117
all: make_swt make_atk make_gnome make_glx make_ime
112
118
113
#
119
#
114
# SWT libs
120
# SWT libs
Lines 276-281 Link Here
276
	$(CC) $(CFLAGS) $(GLXCFLAGS) -c glx_stats.c
282
	$(CC) $(CFLAGS) $(GLXCFLAGS) -c glx_stats.c
277
283
278
#
284
#
285
# IME lib
286
#
287
make_ime: $(IME_LIB)
288
289
$(IME_LIB): $(IME_OBJECTS)
290
	$(CC) $(LIBS) -o $(IME_LIB) $(IME_OBJECTS)
291
#	$(CXX) $(LIBS) -o $(IME_LIB) $(IME_OBJECTS)
292
293
ime.o: ime_custom.c
294
	$(CC) $(CFLAGS) $(IMECFLAGS) -c ime_custom.c
295
#	$(CXX) $(CFLAGS) $(IMECFLAGS) -c ime.cpp
296
297
#
279
# Install
298
# Install
280
#
299
#
281
install: all
300
install: all
(-)Eclipse SWT/emulated/bidi/org/eclipse/swt/internal/BidiUtil.java (+43 lines)
Lines 11-17 Link Here
11
package org.eclipse.swt.internal;
11
package org.eclipse.swt.internal;
12
12
13
import org.eclipse.swt.graphics.GC;
13
import org.eclipse.swt.graphics.GC;
14
import org.eclipse.swt.internal.gtk.IME;
15
import org.eclipse.swt.internal.gtk.OS;
14
import org.eclipse.swt.widgets.Control;
16
import org.eclipse.swt.widgets.Control;
17
import org.eclipse.swt.widgets.Widget;
15
18
16
/*
19
/*
17
 * This class is supplied so that the StyledText code that supports bidi text (supported
20
 * This class is supplied so that the StyledText code that supports bidi text (supported
Lines 39-44 Link Here
39
	public static final int LIGATE = 0;
42
	public static final int LIGATE = 0;
40
	public static final int GLYPHSHAPE = 0;
43
	public static final int GLYPHSHAPE = 0;
41
44
45
	private static final int NONE = 0;
46
	private static final int USE_XKB = 1;
47
	private static final int USE_KXKB = 2;
48
	private static final int USE_XMODMAP = 3;
49
	private static int status = NONE;
50
42
/*
51
/*
43
 * Not implemented.
52
 * Not implemented.
44
 */
53
 */
Lines 90-95 Link Here
90
public static int getKeyboardLanguage() {
99
public static int getKeyboardLanguage() {
91
	return 0;
100
	return 0;
92
}
101
}
102
public static String /*int*/ [] getKeyboardLanguageList(Widget widget) {
103
	if (!OS.IsLinux) return null;
104
 
105
 	int display = init(widget);
106
	if (display == 0) return null;
107
108
	int[] languageArray = new int[] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
109
	int nLanguages = IME.GetKeyboardLanguages(display, languageArray);
110
	if (nLanguages <= 0) return null;
111
112
	String languageList[] = new String[nLanguages];
113
114
	for (int i = 0; i < nLanguages && languageArray[i] != 0; i++) {
115
		int size = OS.strlen(languageArray[i]);
116
		byte[] language = new byte[size];
117
		OS.memmove(language, languageArray[i], size);
118
		OS.free(languageArray[i]);
119
		languageList[i] = new String(language);
120
		System.out.println(languageList[i]);
121
	}
122
	return languageList;
123
}
124
125
private static /*long*/ int init(Widget widget) {
126
	int /*long*/ display = widget == null ? OS.GDK_DISPLAY()
127
			: OS.gdk_x11_drawable_get_xdisplay(OS.GTK_WIDGET_WINDOW(widget.handle));
128
129
	if (display == 0 || status != NONE)
130
		return display;
131
132
	// TODO: Init status
133
134
	return display;
135
}
93
/*
136
/*
94
 * Not implemented.
137
 * Not implemented.
95
 */
138
 */
(-)Eclipse (+102 lines)
Added Link Here
1
/*******************************************************************************
2
* Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
3
* The contents of this file are made available under the terms
4
* of the GNU Lesser General Public License (LGPL) Version 2.1 that
5
* accompanies this distribution (lgpl-v21.txt).  The LGPL is also
6
* available at http://www.gnu.org/licenses/lgpl.html.  If the version
7
* of the LGPL at http://www.gnu.org is different to the version of
8
* the LGPL accompanying this distribution and there is any conflict
9
* between the two license versions, the terms of the LGPL accompanying
10
* this distribution shall govern.
11
*
12
* Contributors:
13
*     IBM Corporation - initial API and implementation
14
*******************************************************************************/
15
16
#include "swt.h"
17
#include "ime.h"
18
19
#define OS_NATIVE(func) Java_org_eclipse_swt_internal_gtk_IME_##func
20
21
#ifndef NO__1GetKeyboardLanguages
22
JNIEXPORT jint JNICALL OS_NATIVE(_1GetKeyboardLanguages)
23
	(JNIEnv *env, jclass that, jint arg0, jintArray arg1)
24
{
25
	jint *lparg1 = NULL;
26
	jint rc = -1;
27
	OS_NATIVE_ENTER(env, that, _1GetKeyboardLanguages_FUNC);
28
#ifndef NO_IME
29
	if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
30
	{
31
		/* For now, execute series of commmands */
32
		int i = 0;
33
		char* p = NULL;
34
		char file_name[] = "/tmp/bidiXXX.tmp";
35
		char command[100] = "dcop kxkb kxkb getLayoutsList > ";
36
		FILE* tmp_file = NULL;
37
		mkstemp(file_name);
38
		freopen("/dev/null", "w", stderr);
39
		system(strcat(command, file_name));
40
		if ((tmp_file = fopen(file_name, "r+"))) {
41
			do {
42
				++rc;
43
				char* lang = (char*)malloc(20);
44
				if (!fgets(lang, 19, tmp_file)) {
45
					free(lang);
46
					break;
47
				}
48
				if ((p = strchr(lang, '\n')))
49
					*p = '\0';
50
				lparg1[i++] = (int)lang;
51
			}
52
			while (rc < 10);
53
			fclose(tmp_file);
54
		}
55
		remove(file_name);
56
	}
57
	if (rc <= 0) {
58
		static int initialized = 0;
59
		static void *handle = NULL;
60
		typedef Status (*FPTR)(Display*, unsigned long, XkbDescPtr);
61
		typedef void (*FPTR2)(XkbDescPtr, unsigned int, Bool);
62
		typedef Status (*FPTR3)(Display*, Atom*, int, char**);
63
		static FPTR fXkbGetControls = NULL;
64
		static FPTR2 fXkbFreeControls = NULL;
65
		static FPTR fXkbGetNames = NULL;
66
		static FPTR2 fXkbFreeNames = NULL;
67
		static FPTR3 fXGetAtomNames = NULL;
68
		if (!initialized) {
69
			/* TODO: Add XkbQueryExtension */
70
			if (!handle) handle = dlopen(XKB_LIB, RTLD_LAZY);
71
			if (handle) {
72
				fXkbGetControls = (FPTR)dlsym(handle, "XkbGetControls");
73
				fXkbFreeControls = (FPTR2)dlsym(handle, "XkbFreeControls");
74
				fXkbGetNames = (FPTR)dlsym(handle, "XkbGetNames");
75
				fXkbFreeNames = (FPTR2)dlsym(handle, "XkbFreeNames");
76
				fXGetAtomNames = (FPTR3)dlsym(handle, "XGetAtomNames");
77
			}
78
			initialized = 1;
79
		}
80
		if (fXkbGetControls && fXkbFreeControls && fXkbGetNames && fXkbFreeNames && fXGetAtomNames) {
81
			Display* dpy = (Display*)arg0;
82
			XkbDescRec desc;
83
			memset(&desc, 0, sizeof(desc));
84
			desc.device_spec = XkbUseCoreKbd;
85
			desc.dpy = dpy;
86
			if ((*fXkbGetControls)(dpy, XkbGroupsWrapMask, &desc) == Success) {
87
				rc = desc.ctrls->num_groups;
88
				(*fXkbGetNames)(dpy, XkbGroupNamesMask, &desc);
89
				(*fXGetAtomNames)(dpy, desc.names->groups, rc, (char**)lparg1);
90
				(*fXkbFreeNames)(&desc, XkbGroupNamesMask, 1);
91
			}
92
			(*fXkbFreeControls)(&desc, XkbGroupsWrapMask, 1);
93
		}
94
	}
95
	fail:
96
		if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
97
#endif /* ifndef NO_IME */
98
		OS_NATIVE_EXIT(env, that, _1GetKeyboardLanguages_FUNC);
99
		return rc;
100
}
101
#endif /* ifndef NO__1GetKeyboardLanguages */
102
(-)Eclipse (+33 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others. All rights reserved.
3
 * The contents of this file are made available under the terms
4
 * of the GNU Lesser General Public License (LGPL) Version 2.1 that
5
 * accompanies this distribution (lgpl-v21.txt).  The LGPL is also
6
 * available at http://www.gnu.org/licenses/lgpl.html.  If the version
7
 * of the LGPL at http://www.gnu.org is different to the version of
8
 * the LGPL accompanying this distribution and there is any conflict
9
 * between the two license versions, the terms of the LGPL accompanying
10
 * this distribution shall govern.
11
 *
12
 * Contributors:
13
 *     IBM Corporation - initial API and implementation
14
 *******************************************************************************/
15
16
#ifndef INC_ime_H
17
#define INC_ime_H
18
19
#define NDEBUG
20
21
#ifndef NO_IME
22
23
#include <memory.h>
24
#include <stdlib.h>
25
#include <dlfcn.h>
26
#include <X11/XKBlib.h>
27
28
/* Libraries for dynamic loaded functions */
29
#define XKB_LIB "libX11.so"
30
31
#endif
32
33
#endif /* INC_os_H */
(-)Eclipse (+30 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2000, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     IBM Corporation - initial API and implementation
10
 *******************************************************************************/
11
package org.eclipse.swt.internal.gtk;
12
13
import org.eclipse.swt.internal.*;
14
15
public class IME extends C {
16
	static {
17
		Library.loadLibrary ("swt-ime"); //$NON-NLS-1$
18
	}
19
20
	/** IME natives */
21
	public static final native int _GetKeyboardLanguages(int /*long*/ display, int /*long*/ [] languages);
22
	public static final int GetKeyboardLanguages(int /*long*/ display, int /*long*/ [] languages) {
23
		lock.lock();
24
		try {
25
			return _GetKeyboardLanguages(display, languages);
26
		} finally {
27
			lock.unlock();
28
		}
29
	}
30
}

Return to bug 62431