From 09d73bd1805c09a7b310e62c4937835db9518580 Mon Sep 17 00:00:00 2001 From: Anatoly Spektor Date: Thu, 5 Jul 2012 16:42:25 -0400 Subject: Tracker Widget Trying different ways to work around INCLUDE_INFERIORS --- .../Eclipse SWT PI/gtk/library/os.c | 58 ++++++++++++++++++++ .../Eclipse SWT PI/gtk/library/os_stats.c | 9 +++- .../Eclipse SWT PI/gtk/library/os_stats.h | 5 ++ .../gtk/org/eclipse/swt/internal/gtk/OS.java | 62 +++++++++++++++++++++- .../gtk/org/eclipse/swt/widgets/Tracker.java | 60 +++++++++++++++------ 5 files changed, 175 insertions(+), 19 deletions(-) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c index 1c8c5a54fb..25c2e915d6 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c @@ -1277,6 +1277,18 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1Call) } #endif +#ifndef NO__1DefaultDepth +JNIEXPORT jint JNICALL OS_NATIVE(_1DefaultDepth) + (JNIEnv *env, jclass that, jintLong arg0, jint arg1) +{ + jint rc = 0; + OS_NATIVE_ENTER(env, that, _1DefaultDepth_FUNC); + rc = (jint)DefaultDepth((Display *)arg0, arg1); + OS_NATIVE_EXIT(env, that, _1DefaultDepth_FUNC); + return rc; +} +#endif + #ifndef NO__1FcConfigAppFontAddFile JNIEXPORT jboolean JNICALL OS_NATIVE(_1FcConfigAppFontAddFile) (JNIEnv *env, jclass that, jintLong arg0, jbyteArray arg1) @@ -1861,6 +1873,28 @@ JNIEXPORT jboolean JNICALL OS_NATIVE(_1XCheckWindowEvent) } #endif +#ifndef NO__1XCloseDisplay +JNIEXPORT void JNICALL OS_NATIVE(_1XCloseDisplay) + (JNIEnv *env, jclass that, jintLong arg0) +{ + OS_NATIVE_ENTER(env, that, _1XCloseDisplay_FUNC); + XCloseDisplay((Display *)arg0); + OS_NATIVE_EXIT(env, that, _1XCloseDisplay_FUNC); +} +#endif + +#ifndef NO__1XCreateGC +JNIEXPORT jintLong JNICALL OS_NATIVE(_1XCreateGC) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2, jintLong arg3) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1XCreateGC_FUNC); + rc = (jintLong)XCreateGC((Display *)arg0, (Drawable)arg1, (unsigned long)arg2, (XGCValues *)arg3); + OS_NATIVE_EXIT(env, that, _1XCreateGC_FUNC); + return rc; +} +#endif + #ifndef NO__1XDefaultRootWindow JNIEXPORT jintLong JNICALL OS_NATIVE(_1XDefaultRootWindow) (JNIEnv *env, jclass that, jintLong arg0) @@ -1989,6 +2023,18 @@ fail: } #endif +#ifndef NO__1XOpenDisplay +JNIEXPORT jintLong JNICALL OS_NATIVE(_1XOpenDisplay) + (JNIEnv *env, jclass that, jintLong arg0) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1XOpenDisplay_FUNC); + rc = (jintLong)XOpenDisplay((char *)arg0); + OS_NATIVE_EXIT(env, that, _1XOpenDisplay_FUNC); + return rc; +} +#endif + #ifndef NO__1XQueryPointer JNIEXPORT jint JNICALL OS_NATIVE(_1XQueryPointer) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLongArray arg2, jintLongArray arg3, jintArray arg4, jintArray arg5, jintArray arg6, jintArray arg7, jintArray arg8) @@ -2320,6 +2366,18 @@ JNIEXPORT jintLong JNICALL OS_NATIVE(_1XSetSelectionOwner) } #endif +#ifndef NO__1XSetSubwindowMode +JNIEXPORT jintLong JNICALL OS_NATIVE(_1XSetSubwindowMode) + (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jint arg2) +{ + jintLong rc = 0; + OS_NATIVE_ENTER(env, that, _1XSetSubwindowMode_FUNC); + rc = (jintLong)XSetSubwindowMode((Display *)arg0, (GC)arg1, arg2); + OS_NATIVE_EXIT(env, that, _1XSetSubwindowMode_FUNC); + return rc; +} +#endif + #ifndef NO__1XSetTransientForHint JNIEXPORT jint JNICALL OS_NATIVE(_1XSetTransientForHint) (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c index f444a423e7..5265f025e4 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c @@ -18,8 +18,8 @@ #ifdef NATIVE_STATS -int OS_nativeFunctionCount = 1402; -int OS_nativeFunctionCallCount[1402]; +int OS_nativeFunctionCount = 1407; +int OS_nativeFunctionCallCount[1407]; char * OS_nativeFunctionNames[] = { #ifndef JNI64 "Call__IIII", @@ -134,6 +134,7 @@ char * OS_nativeFunctionNames[] = { "X_1EVENT_1TYPE", "X_1EVENT_1WINDOW", "_1Call", + "_1DefaultDepth", "_1FcConfigAppFontAddFile", "_1GDK_1PIXMAP_1XID", "_1GDK_1TYPE_1COLOR", @@ -182,6 +183,8 @@ char * OS_nativeFunctionNames[] = { "_1XCheckIfEvent", "_1XCheckMaskEvent", "_1XCheckWindowEvent", + "_1XCloseDisplay", + "_1XCreateGC", "_1XDefaultRootWindow", "_1XDefaultScreen", "_1XFlush", @@ -191,6 +194,7 @@ char * OS_nativeFunctionNames[] = { "_1XInternAtom", "_1XKeysymToKeycode", "_1XListProperties", + "_1XOpenDisplay", "_1XQueryPointer", "_1XQueryTree", "_1XReconfigureWMWindow", @@ -208,6 +212,7 @@ char * OS_nativeFunctionNames[] = { "_1XSetIOErrorHandler", "_1XSetInputFocus", "_1XSetSelectionOwner", + "_1XSetSubwindowMode", "_1XSetTransientForHint", "_1XSynchronize", "_1XTestFakeButtonEvent", diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h index f7321e2d6a..9ca99f7352 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h @@ -142,6 +142,7 @@ typedef enum { X_1EVENT_1TYPE_FUNC, X_1EVENT_1WINDOW_FUNC, _1Call_FUNC, + _1DefaultDepth_FUNC, _1FcConfigAppFontAddFile_FUNC, _1GDK_1PIXMAP_1XID_FUNC, _1GDK_1TYPE_1COLOR_FUNC, @@ -190,6 +191,8 @@ typedef enum { _1XCheckIfEvent_FUNC, _1XCheckMaskEvent_FUNC, _1XCheckWindowEvent_FUNC, + _1XCloseDisplay_FUNC, + _1XCreateGC_FUNC, _1XDefaultRootWindow_FUNC, _1XDefaultScreen_FUNC, _1XFlush_FUNC, @@ -199,6 +202,7 @@ typedef enum { _1XInternAtom_FUNC, _1XKeysymToKeycode_FUNC, _1XListProperties_FUNC, + _1XOpenDisplay_FUNC, _1XQueryPointer_FUNC, _1XQueryTree_FUNC, _1XReconfigureWMWindow_FUNC, @@ -216,6 +220,7 @@ typedef enum { _1XSetIOErrorHandler_FUNC, _1XSetInputFocus_FUNC, _1XSetSelectionOwner_FUNC, + _1XSetSubwindowMode_FUNC, _1XSetTransientForHint_FUNC, _1XSynchronize_FUNC, _1XTestFakeButtonEvent_FUNC, diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java index 8827bda6b3..c5e76a4738 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java @@ -885,6 +885,26 @@ public static final int /*long*/ XDefaultRootWindow(int /*long*/ display) { lock.unlock(); } } +/** @param display_name cast=(char *) */ +public static final native int /*long*/ _XOpenDisplay(int /*long*/ display_name); +public static final int /*long*/ XOpenDisplay(int /*long*/ display_name) { + lock.lock(); + try { + return _XOpenDisplay(display_name); + } finally { + lock.unlock(); + } +} +/** @param display cast=(Display *) */ +public static final native void _XCloseDisplay(int /*long*/ display); +public static final void XCloseDisplay(int /*long*/ display) { + lock.lock(); + try { + _XFlush(display); + } finally { + lock.unlock(); + } +} /** @param display cast=(Display *) */ public static final native void _XFlush(int /*long*/ display); public static final void XFlush(int /*long*/ display) { @@ -895,6 +915,19 @@ public static final void XFlush(int /*long*/ display) { lock.unlock(); } } +/** + * @param display cast=(Display *) + **/ +public static final native int _DefaultDepth(int /*long*/ display, int screen_number); +public static final int DefaultDepth(int /*long*/ display, int screen_number) { + lock.lock(); + try { + return DefaultDepth(display,screen_number); + } finally { + lock.unlock(); + } + } + /** @param address cast=(void *) */ public static final native void _XFree(int /*long*/ address); public static final void XFree(int /*long*/ address) { @@ -920,6 +953,34 @@ public static final int /*long*/ XSetSelectionOwner(int /*long*/ display, int /* lock.unlock(); } } +/** + * @param display cast=(Display *) + * @param d cast=(Drawable) + * @param valuemask cast=(unsigned long) + * @param values cast=(XGCValues *) + */ +public static final native int /*long*/ _XCreateGC(int /*long*/ display, int /*long*/ d, int /*long*/ valuemask, int /*long*/ values); +public static final int /*long*/ XCreateGC(int /*long*/ display, int /*long*/ d, int /*long*/ valuemask, int /*long*/ values) { + lock.lock(); + try { + return _XCreateGC(display, d, valuemask, values); + } finally { + lock.unlock(); + } +} +/** + * @param display cast=(Display *) + * @param gc cast=(GC) + */ +public static final native int /*long*/ _XSetSubwindowMode(int /*long*/ display, int /*long*/ gc, int subwindow_mode); +public static final int /*long*/ XSetSubwindowMode(int /*long*/ display, int /*long*/ gc, int subwindow_mode) { + lock.lock(); + try { + return _XSetSubwindowMode(display, gc, subwindow_mode); + } finally { + lock.unlock(); + } +} /** * @param display cast=(Display *) * @param selection cast=(Atom) @@ -933,7 +994,6 @@ public static final int /*long*/ XGetSelectionOwner(int /*long*/ display, int /* lock.unlock(); } } - /** * @param display cast=(Display *) * @param window cast=(Window) diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java index 701085c35a..5c88436263 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java @@ -313,24 +313,52 @@ void drawRectangles (Rectangle [] rects) { } if (window == 0) return; - if(OS.USE_CAIRO){ - int /*long*/ cairo = OS.gdk_cairo_create(window); - if (cairo == 0) error (SWT.ERROR_NO_HANDLES); - - Cairo.cairo_set_source_rgb(cairo, 1, 1, 1); - Cairo.cairo_set_line_width(cairo, 1); - Cairo.cairo_set_operator(cairo,Cairo.CAIRO_OPERATOR_DIFFERENCE); - Cairo.cairo_set_antialias(cairo, Cairo.CAIRO_ANTIALIAS_NONE); - - for (int i=0; i