From dd2aca966bc039ce9a2eb77aaa5738d3e28bb872 Mon Sep 17 00:00:00 2001 From: Alexander Kurtakov Date: Fri, 12 Jul 2013 21:55:27 +0300 Subject: Clean TrayItem from pre- GtkStatusIcon code. There is the nice side effect of less X specific code so let's call it first step towards wayland.--- .../Eclipse SWT PI/gtk/library/os.c | 80 --------------- .../Eclipse SWT PI/gtk/library/os_custom.h | 1 - .../Eclipse SWT PI/gtk/library/os_stats.c | 9 -- .../Eclipse SWT PI/gtk/library/os_stats.h | 9 -- .../Eclipse SWT PI/gtk/library/os_structs.c | 58 ----------- .../Eclipse SWT PI/gtk/library/os_structs.h | 14 +-- .../gtk/org/eclipse/swt/internal/gtk/OS.java | 46 --------- .../swt/internal/gtk/XClientMessageEvent.java | 28 ----- .../gtk/org/eclipse/swt/widgets/TrayItem.java | 114 +++------------------ 9 files changed, 17 insertions(+), 342 deletions(-) delete mode 100644 bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/XClientMessageEvent.java 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 34ca537b05..6c4ecc273b 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 @@ -1029,18 +1029,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(XAnyEvent_1sizeof) } #endif -#ifndef NO_XClientMessageEvent_1sizeof -JNIEXPORT jint JNICALL OS_NATIVE(XClientMessageEvent_1sizeof) - (JNIEnv *env, jclass that) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, XClientMessageEvent_1sizeof_FUNC); - rc = (jint)XClientMessageEvent_sizeof(); - OS_NATIVE_EXIT(env, that, XClientMessageEvent_1sizeof_FUNC); - return rc; -} -#endif - #ifndef NO_XCrossingEvent_1sizeof JNIEXPORT jint JNICALL OS_NATIVE(XCrossingEvent_1sizeof) (JNIEnv *env, jclass that) @@ -2107,18 +2095,6 @@ fail: } #endif -#ifndef NO__1XSendEvent -JNIEXPORT jint JNICALL OS_NATIVE(_1XSendEvent) - (JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jboolean arg2, jintLong arg3, jintLong arg4) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1XSendEvent_FUNC); - rc = (jint)XSendEvent((Display *)arg0, (Window)arg1, arg2, arg3, (XEvent *)arg4); - OS_NATIVE_EXIT(env, that, _1XSendEvent_FUNC); - return rc; -} -#endif - #ifndef NO__1XSetErrorHandler JNIEXPORT jintLong JNICALL OS_NATIVE(_1XSetErrorHandler) (JNIEnv *env, jclass that, jintLong arg0) @@ -6955,26 +6931,6 @@ JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1screen_1get_1n_1monitors) } #endif -#ifndef NO__1gdk_1screen_1get_1number -JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1screen_1get_1number) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jint rc = 0; - OS_NATIVE_ENTER(env, that, _1gdk_1screen_1get_1number_FUNC); -/* - rc = (jint)gdk_screen_get_number((GdkScreen *)arg0); -*/ - { - OS_LOAD_FUNCTION(fp, gdk_screen_get_number) - if (fp) { - rc = (jint)((jint (CALLING_CONVENTION*)(GdkScreen *))fp)((GdkScreen *)arg0); - } - } - OS_NATIVE_EXIT(env, that, _1gdk_1screen_1get_1number_FUNC); - return rc; -} -#endif - #ifndef NO__1gdk_1screen_1height JNIEXPORT jint JNICALL OS_NATIVE(_1gdk_1screen_1height) (JNIEnv *env, jclass that) @@ -13029,18 +12985,6 @@ fail: } #endif -#ifndef NO__1gtk_1plug_1get_1id -JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1plug_1get_1id) - (JNIEnv *env, jclass that, jintLong arg0) -{ - jintLong rc = 0; - OS_NATIVE_ENTER(env, that, _1gtk_1plug_1get_1id_FUNC); - rc = (jintLong)gtk_plug_get_id((GtkPlug *)arg0); - OS_NATIVE_EXIT(env, that, _1gtk_1plug_1get_1id_FUNC); - return rc; -} -#endif - #ifndef NO__1gtk_1plug_1new JNIEXPORT jintLong JNICALL OS_NATIVE(_1gtk_1plug_1new) (JNIEnv *env, jclass that, jintLong arg0) @@ -21555,30 +21499,6 @@ fail: } #endif -#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_XClientMessageEvent_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_XClientMessageEvent_2J) && defined(JNI64)) -#ifndef JNI64 -JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_XClientMessageEvent_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) -#else -JNIEXPORT void JNICALL OS_NATIVE(memmove__JLorg_eclipse_swt_internal_gtk_XClientMessageEvent_2J)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) -#endif -{ - XClientMessageEvent _arg1, *lparg1=NULL; -#ifndef JNI64 - OS_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_gtk_XClientMessageEvent_2I_FUNC); -#else - OS_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_gtk_XClientMessageEvent_2J_FUNC); -#endif - if (arg1) if ((lparg1 = getXClientMessageEventFields(env, arg1, &_arg1)) == NULL) goto fail; - memmove((void *)arg0, (const void *)lparg1, (size_t)arg2); -fail: -#ifndef JNI64 - OS_NATIVE_EXIT(env, that, memmove__ILorg_eclipse_swt_internal_gtk_XClientMessageEvent_2I_FUNC); -#else - OS_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_gtk_XClientMessageEvent_2J_FUNC); -#endif -} -#endif - #if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_XExposeEvent_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_XExposeEvent_2J) && defined(JNI64)) #ifndef JNI64 JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_XExposeEvent_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2) diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h index 369d98af87..d20fb59a8f 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.h @@ -276,7 +276,6 @@ #define gdk_screen_get_monitor_at_window_LIB LIB_GDK #define gdk_screen_get_monitor_geometry_LIB LIB_GDK #define gdk_screen_get_n_monitors_LIB LIB_GDK -#define gdk_screen_get_number_LIB LIB_GDK #define gdk_pixbuf_render_to_drawable_LIB LIB_GDK #define gdk_visual_get_depth_LIB LIB_GDK #define gtk_scrolled_window_get_hscrollbar_LIB LIB_GTK 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 a8572273ef..449e060be1 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 @@ -111,7 +111,6 @@ char * OS_nativeFunctionNames[] = { "RTLD_1LAZY", "RTLD_1NOW", "XAnyEvent_1sizeof", - "XClientMessageEvent_1sizeof", "XCrossingEvent_1sizeof", "XEvent_1sizeof", "XExposeEvent_1sizeof", @@ -189,7 +188,6 @@ char * OS_nativeFunctionNames[] = { "_1XRenderQueryVersion", "_1XRenderSetPictureClipRectangles", "_1XRenderSetPictureTransform", - "_1XSendEvent", "_1XSetErrorHandler", "_1XSetIOErrorHandler", "_1XSetInputFocus", @@ -542,7 +540,6 @@ char * OS_nativeFunctionNames[] = { "_1gdk_1screen_1get_1monitor_1at_1window", "_1gdk_1screen_1get_1monitor_1geometry", "_1gdk_1screen_1get_1n_1monitors", - "_1gdk_1screen_1get_1number", "_1gdk_1screen_1height", "_1gdk_1screen_1width", "_1gdk_1screen_1width_1mm", @@ -946,7 +943,6 @@ char * OS_nativeFunctionNames[] = { "_1gtk_1paper_1size_1new", "_1gtk_1paper_1size_1new_1custom", "_1gtk_1paper_1size_1new_1from_1ppd", - "_1gtk_1plug_1get_1id", "_1gtk_1plug_1new", "_1gtk_1print_1job_1get_1surface", "_1gtk_1print_1job_1new", @@ -1635,11 +1631,6 @@ char * OS_nativeFunctionNames[] = { #else "memmove__JLorg_eclipse_swt_internal_gtk_PangoAttribute_2J", #endif -#ifndef JNI64 - "memmove__ILorg_eclipse_swt_internal_gtk_XClientMessageEvent_2I", -#else - "memmove__JLorg_eclipse_swt_internal_gtk_XClientMessageEvent_2J", -#endif #ifndef JNI64 "memmove__ILorg_eclipse_swt_internal_gtk_XExposeEvent_2I", #else 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 804127cd5a..08f8b60564 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 @@ -121,7 +121,6 @@ typedef enum { RTLD_1LAZY_FUNC, RTLD_1NOW_FUNC, XAnyEvent_1sizeof_FUNC, - XClientMessageEvent_1sizeof_FUNC, XCrossingEvent_1sizeof_FUNC, XEvent_1sizeof_FUNC, XExposeEvent_1sizeof_FUNC, @@ -199,7 +198,6 @@ typedef enum { _1XRenderQueryVersion_FUNC, _1XRenderSetPictureClipRectangles_FUNC, _1XRenderSetPictureTransform_FUNC, - _1XSendEvent_FUNC, _1XSetErrorHandler_FUNC, _1XSetIOErrorHandler_FUNC, _1XSetInputFocus_FUNC, @@ -552,7 +550,6 @@ typedef enum { _1gdk_1screen_1get_1monitor_1at_1window_FUNC, _1gdk_1screen_1get_1monitor_1geometry_FUNC, _1gdk_1screen_1get_1n_1monitors_FUNC, - _1gdk_1screen_1get_1number_FUNC, _1gdk_1screen_1height_FUNC, _1gdk_1screen_1width_FUNC, _1gdk_1screen_1width_1mm_FUNC, @@ -956,7 +953,6 @@ typedef enum { _1gtk_1paper_1size_1new_FUNC, _1gtk_1paper_1size_1new_1custom_FUNC, _1gtk_1paper_1size_1new_1from_1ppd_FUNC, - _1gtk_1plug_1get_1id_FUNC, _1gtk_1plug_1new_FUNC, _1gtk_1print_1job_1get_1surface_FUNC, _1gtk_1print_1job_1new_FUNC, @@ -1645,11 +1641,6 @@ typedef enum { #else memmove__JLorg_eclipse_swt_internal_gtk_PangoAttribute_2J_FUNC, #endif -#ifndef JNI64 - memmove__ILorg_eclipse_swt_internal_gtk_XClientMessageEvent_2I_FUNC, -#else - memmove__JLorg_eclipse_swt_internal_gtk_XClientMessageEvent_2J_FUNC, -#endif #ifndef JNI64 memmove__ILorg_eclipse_swt_internal_gtk_XExposeEvent_2I_FUNC, #else diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c index 1fa8f1d9c1..75b244abb0 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c @@ -2127,64 +2127,6 @@ void setXAnyEventFields(JNIEnv *env, jobject lpObject, XAnyEvent *lpStruct) } #endif -#ifndef NO_XClientMessageEvent -typedef struct XClientMessageEvent_FID_CACHE { - int cached; - jclass clazz; - jfieldID type, serial, send_event, display, window, message_type, format, data; -} XClientMessageEvent_FID_CACHE; - -XClientMessageEvent_FID_CACHE XClientMessageEventFc; - -void cacheXClientMessageEventFields(JNIEnv *env, jobject lpObject) -{ - if (XClientMessageEventFc.cached) return; - XClientMessageEventFc.clazz = (*env)->GetObjectClass(env, lpObject); - XClientMessageEventFc.type = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "type", "I"); - XClientMessageEventFc.serial = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "serial", I_J); - XClientMessageEventFc.send_event = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "send_event", "Z"); - XClientMessageEventFc.display = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "display", I_J); - XClientMessageEventFc.window = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "window", I_J); - XClientMessageEventFc.message_type = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "message_type", I_J); - XClientMessageEventFc.format = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "format", "I"); - XClientMessageEventFc.data = (*env)->GetFieldID(env, XClientMessageEventFc.clazz, "data", I_JArray); - XClientMessageEventFc.cached = 1; -} - -XClientMessageEvent *getXClientMessageEventFields(JNIEnv *env, jobject lpObject, XClientMessageEvent *lpStruct) -{ - if (!XClientMessageEventFc.cached) cacheXClientMessageEventFields(env, lpObject); - lpStruct->type = (*env)->GetIntField(env, lpObject, XClientMessageEventFc.type); - lpStruct->serial = (*env)->GetIntLongField(env, lpObject, XClientMessageEventFc.serial); - lpStruct->send_event = (*env)->GetBooleanField(env, lpObject, XClientMessageEventFc.send_event); - lpStruct->display = (Display *)(*env)->GetIntLongField(env, lpObject, XClientMessageEventFc.display); - lpStruct->window = (Window)(*env)->GetIntLongField(env, lpObject, XClientMessageEventFc.window); - lpStruct->message_type = (Atom)(*env)->GetIntLongField(env, lpObject, XClientMessageEventFc.message_type); - lpStruct->format = (*env)->GetIntField(env, lpObject, XClientMessageEventFc.format); - { - jintLongArray lpObject1 = (jintLongArray)(*env)->GetObjectField(env, lpObject, XClientMessageEventFc.data); - (*env)->GetIntLongArrayRegion(env, lpObject1, 0, sizeof(lpStruct->data.l) / sizeof(jintLong), (jintLong *)lpStruct->data.l); - } - return lpStruct; -} - -void setXClientMessageEventFields(JNIEnv *env, jobject lpObject, XClientMessageEvent *lpStruct) -{ - if (!XClientMessageEventFc.cached) cacheXClientMessageEventFields(env, lpObject); - (*env)->SetIntField(env, lpObject, XClientMessageEventFc.type, (jint)lpStruct->type); - (*env)->SetIntLongField(env, lpObject, XClientMessageEventFc.serial, (jintLong)lpStruct->serial); - (*env)->SetBooleanField(env, lpObject, XClientMessageEventFc.send_event, (jboolean)lpStruct->send_event); - (*env)->SetIntLongField(env, lpObject, XClientMessageEventFc.display, (jintLong)lpStruct->display); - (*env)->SetIntLongField(env, lpObject, XClientMessageEventFc.window, (jintLong)lpStruct->window); - (*env)->SetIntLongField(env, lpObject, XClientMessageEventFc.message_type, (jintLong)lpStruct->message_type); - (*env)->SetIntField(env, lpObject, XClientMessageEventFc.format, (jint)lpStruct->format); - { - jintLongArray lpObject1 = (jintLongArray)(*env)->GetObjectField(env, lpObject, XClientMessageEventFc.data); - (*env)->SetIntLongArrayRegion(env, lpObject1, 0, sizeof(lpStruct->data.l) / sizeof(jintLong), (jintLong *)lpStruct->data.l); - } -} -#endif - #ifndef NO_XCrossingEvent typedef struct XCrossingEvent_FID_CACHE { int cached; diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h index cbea7c290f..66d638e0c9 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h +++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2012 IBM Corporation and others. All rights reserved. + * Copyright (c) 2000, 2013 IBM Corporation and others. All rights reserved. * The contents of this file are made available under the terms * of the GNU Lesser General Public License (LGPL) Version 2.1 that * accompanies this distribution (lgpl-v21.txt). The LGPL is also @@ -543,18 +543,6 @@ void setXAnyEventFields(JNIEnv *env, jobject lpObject, XAnyEvent *lpStruct); #define XAnyEvent_sizeof() 0 #endif -#ifndef NO_XClientMessageEvent -void cacheXClientMessageEventFields(JNIEnv *env, jobject lpObject); -XClientMessageEvent *getXClientMessageEventFields(JNIEnv *env, jobject lpObject, XClientMessageEvent *lpStruct); -void setXClientMessageEventFields(JNIEnv *env, jobject lpObject, XClientMessageEvent *lpStruct); -#define XClientMessageEvent_sizeof() sizeof(XClientMessageEvent) -#else -#define cacheXClientMessageEventFields(a,b) -#define getXClientMessageEventFields(a,b,c) NULL -#define setXClientMessageEventFields(a,b,c) -#define XClientMessageEvent_sizeof() 0 -#endif - #ifndef NO_XCrossingEvent void cacheXCrossingEventFields(JNIEnv *env, jobject lpObject); XCrossingEvent *getXCrossingEventFields(JNIEnv *env, jobject lpObject, XCrossingEvent *lpStruct); 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 41096a1de4..a731264a7f 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 @@ -694,7 +694,6 @@ public static final native int PangoLayoutRun_sizeof(); public static final native int PangoLogAttr_sizeof(); public static final native int PangoRectangle_sizeof(); public static final native int XAnyEvent_sizeof(); -public static final native int XClientMessageEvent_sizeof(); public static final native int XEvent_sizeof(); public static final native int XCrossingEvent_sizeof(); public static final native int XExposeEvent_sizeof(); @@ -783,7 +782,6 @@ public static final native long /*int*/ X_EVENT_WINDOW(long /*int*/ xevent); public static final int Above = 0; public static final int Below = 1; public static final int ButtonRelease = 5; -public static final int ClientMessage = 33; public static final int CurrentTime = 0; public static final int CWSibling = 0x20; public static final int CWStackMode = 0x40; @@ -810,7 +808,6 @@ public static final int RevertToParent = 2; public static final int VisibilityChangeMask = 1 << 16; public static final int VisibilityFullyObscured = 2; public static final int VisibilityNotify = 15; -public static final int SYSTEM_TRAY_REQUEST_DOCK = 0; public static final native int _Call(long /*int*/ proc, long /*int*/ arg1, long /*int*/ arg2); public static final int Call(long /*int*/ proc, long /*int*/ arg1, long /*int*/ arg2) { lock.lock(); @@ -1050,20 +1047,6 @@ public static final int XReconfigureWMWindow(long /*int*/ display, long /*int*/ lock.unlock(); } } -/** - * @param display cast=(Display *) - * @param w cast=(Window) - * @param event_send cast=(XEvent *) - */ -public static final native int _XSendEvent(long /*int*/ display, long /*int*/ w, boolean propogate, long /*int*/ event_mask, long /*int*/ event_send); -public static final int XSendEvent(long /*int*/ display, long /*int*/ w, boolean propogate, long /*int*/ event_mask, long /*int*/ event_send) { - lock.lock(); - try { - return _XSendEvent(display, w, propogate, event_mask, event_send); - } finally { - lock.unlock(); - } -} /** @param handler cast=(XIOErrorHandler) */ public static final native long /*int*/ _XSetIOErrorHandler(long /*int*/ handler); public static final long /*int*/ XSetIOErrorHandler(long /*int*/ handler) { @@ -1328,12 +1311,6 @@ public static final void gdk_window_remove_filter(long /*int*/ window, long /*in lock.unlock(); } } -/** - * @param dest cast=(void *) - * @param src cast=(const void *),flags=no_out - * @param size cast=(size_t) - */ -public static final native void memmove(long /*int*/ dest, XClientMessageEvent src, long /*int*/ size); /** * @param dest cast=(void *) * @param src cast=(const void *),flags=no_out @@ -5162,19 +5139,6 @@ public static final int gdk_screen_get_n_monitors(long /*int*/ screen) { lock.unlock(); } } -/** - * @method flags=dynamic - * @param screen cast=(GdkScreen *) - */ -public static final native int _gdk_screen_get_number(long /*int*/ screen); -public static final int gdk_screen_get_number(long /*int*/ screen) { - lock.lock(); - try { - return _gdk_screen_get_number(screen); - } finally { - lock.unlock(); - } -} public static final native int _gdk_screen_height(); public static final int gdk_screen_height() { lock.lock(); @@ -9696,16 +9660,6 @@ public static final boolean gtk_paper_size_is_custom(long /*int*/ size) { lock.unlock(); } } -/** @param plug cast=(GtkPlug *) */ -public static final native long /*int*/ _gtk_plug_get_id(long /*int*/ plug); -public static final long /*int*/ gtk_plug_get_id(long /*int*/ plug) { - lock.lock(); - try { - return _gtk_plug_get_id(plug); - } finally { - lock.unlock(); - } -} public static final native long /*int*/ _gtk_plug_new(long /*int*/ socket_id); public static final long /*int*/ gtk_plug_new(long /*int*/ socket_id) { lock.lock(); diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/XClientMessageEvent.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/XClientMessageEvent.java deleted file mode 100644 index 519817b423..0000000000 --- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/XClientMessageEvent.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2012 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 - *******************************************************************************/ -package org.eclipse.swt.internal.gtk; - - -public class XClientMessageEvent { - public int type; - public long /*int*/ serial; - public boolean send_event; - /** @field cast=(Display *) */ - public long /*int*/ display; - /** @field cast=(Window) */ - public long /*int*/ window; - /** @field cast=(Atom) */ - public long /*int*/ message_type; - public int format; - /** @field accessor=data.l,cast=(long *) */ - public long /*int*/[] data = new long /*int*/[5]; - public static final int sizeof = OS.XClientMessageEvent_sizeof(); -} diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java index ef14ca07a6..9669aefc95 100644 --- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java +++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java @@ -152,46 +152,10 @@ void createWidget (int index) { void createHandle (int index) { state |= HANDLE; - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - handle = OS.gtk_status_icon_new (); - if (handle == 0) error (SWT.ERROR_NO_HANDLES); - imageHandle = OS.gtk_image_new (); - OS.gtk_status_icon_set_visible (handle,true); - } else { - handle = OS.gtk_plug_new (0); - if (handle == 0) error (SWT.ERROR_NO_HANDLES); - imageHandle = OS.gtk_image_new (); - if (imageHandle == 0) error (SWT.ERROR_NO_HANDLES); - OS.gtk_container_add (handle, imageHandle); - OS.gtk_widget_show (handle); - OS.gtk_widget_show (imageHandle); - long /*int*/ id = OS.gtk_plug_get_id (handle); - int monitor = 0; - long /*int*/ screen = OS.gdk_screen_get_default (); - if (screen != 0) { - monitor = OS.gdk_screen_get_number (screen); - } - byte [] trayBuffer = Converter.wcsToMbcs (null, "_NET_SYSTEM_TRAY_S" + monitor, true); - long /*int*/ trayAtom = OS.gdk_atom_intern (trayBuffer, true); - long /*int*/ xTrayAtom = OS.gdk_x11_atom_to_xatom (trayAtom); - long /*int*/ xDisplay = OS.gdk_x11_display_get_xdisplay(OS.gdk_display_get_default()); - long /*int*/ trayWindow = OS.XGetSelectionOwner (xDisplay, xTrayAtom); - byte [] messageBuffer = Converter.wcsToMbcs (null, "_NET_SYSTEM_TRAY_OPCODE", true); - long /*int*/ messageAtom = OS.gdk_atom_intern (messageBuffer, true); - long /*int*/ xMessageAtom = OS.gdk_x11_atom_to_xatom (messageAtom); - XClientMessageEvent event = new XClientMessageEvent (); - event.type = OS.ClientMessage; - event.window = trayWindow; - event.message_type = xMessageAtom; - event.format = 32; - event.data [0] = OS.GDK_CURRENT_TIME; - event.data [1] = OS.SYSTEM_TRAY_REQUEST_DOCK; - event.data [2] = id; - long /*int*/ clientEvent = OS.g_malloc (XClientMessageEvent.sizeof); - OS.memmove (clientEvent, event, XClientMessageEvent.sizeof); - OS.XSendEvent (xDisplay, trayWindow, false, OS.NoEventMask, clientEvent); - OS.g_free (clientEvent); - } + handle = OS.gtk_status_icon_new (); + if (handle == 0) error (SWT.ERROR_NO_HANDLES); + imageHandle = OS.gtk_image_new (); + OS.gtk_status_icon_set_visible (handle,true); } void deregister () { @@ -363,15 +327,8 @@ long /*int*/ gtk_status_icon_popup_menu (long /*int*/ widget, long /*int*/ butto } void hookEvents () { - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.g_signal_connect_closure (handle, OS.activate, display.closures [ACTIVATE], false); - OS.g_signal_connect_closure (handle, OS.popup_menu, display.closures [STATUS_ICON_POPUP_MENU], false); - } else { - int eventMask = OS.GDK_BUTTON_PRESS_MASK; - OS.gtk_widget_add_events (handle, eventMask); - OS.g_signal_connect_closure_by_id (handle, display.signalIds [BUTTON_PRESS_EVENT], 0, display.closures [BUTTON_PRESS_EVENT], false); - OS.g_signal_connect_closure_by_id (imageHandle, display.signalIds [SIZE_ALLOCATE], 0, display.closures [SIZE_ALLOCATE], false); - } + OS.g_signal_connect_closure (handle, OS.activate, display.closures [ACTIVATE], false); + OS.g_signal_connect_closure (handle, OS.popup_menu, display.closures [STATUS_ICON_POPUP_MENU], false); } /** @@ -387,10 +344,7 @@ void hookEvents () { */ public boolean getVisible () { checkWidget (); - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - return OS.gtk_status_icon_get_visible (handle); - } - return gtk_widget_get_visible (handle); + return OS.gtk_status_icon_get_visible (handle); } void register () { @@ -400,11 +354,7 @@ void register () { void releaseHandle () { if (handle != 0) { - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.g_object_unref (handle); - } else { - OS.gtk_widget_destroy (handle); - } + OS.g_object_unref (handle); } handle = imageHandle = 0; super.releaseHandle (); @@ -520,24 +470,12 @@ public void setImage (Image image) { imageList.put (imageIndex, image); } long /*int*/ pixbuf = imageList.getPixbuf (imageIndex); - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.gtk_status_icon_set_from_pixbuf (handle, pixbuf); - OS.gtk_status_icon_set_visible (handle, true); - } else { - Rectangle rect = image.getBounds (); - OS.gtk_widget_set_size_request (handle, rect.width, rect.height); - OS.gtk_image_set_from_pixbuf (imageHandle, pixbuf); - OS.gtk_widget_show (imageHandle); - } + OS.gtk_status_icon_set_from_pixbuf (handle, pixbuf); + OS.gtk_status_icon_set_visible (handle, true); } else { OS.gtk_widget_set_size_request (handle, 1, 1); - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.gtk_status_icon_set_from_pixbuf (handle, 0); - OS.gtk_status_icon_set_visible (handle, false); - } else { - OS.gtk_image_set_from_pixbuf (imageHandle, 0); - OS.gtk_widget_hide (imageHandle); - } + OS.gtk_status_icon_set_from_pixbuf (handle, 0); + OS.gtk_status_icon_set_visible (handle, false); } } @@ -589,17 +527,7 @@ public void setToolTipText (String string) { if (string != null && string.length () > 0) { buffer = Converter.wcsToMbcs (null, string, true); } - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.gtk_status_icon_set_tooltip (handle, buffer); - } else { - if (tooltipsHandle == 0) { - tooltipsHandle = OS.gtk_tooltips_new (); - if (tooltipsHandle == 0) error (SWT.ERROR_NO_HANDLES); - OS.g_object_ref (tooltipsHandle); - OS.g_object_ref_sink (tooltipsHandle); - } - OS.gtk_tooltips_set_tip (tooltipsHandle, handle, buffer, null); - } + OS.gtk_status_icon_set_tooltip (handle, buffer); } /** @@ -615,11 +543,7 @@ public void setToolTipText (String string) { */ public void setVisible (boolean visible) { checkWidget (); - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - if(OS.gtk_status_icon_get_visible (handle) == visible) return; - } else { - if (gtk_widget_get_visible (handle) == visible) return; - } + if(OS.gtk_status_icon_get_visible (handle) == visible) return; if (visible) { /* * It is possible (but unlikely), that application @@ -628,15 +552,9 @@ public void setVisible (boolean visible) { */ sendEvent (SWT.Show); if (isDisposed ()) return; - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.gtk_status_icon_set_visible (handle, visible); - } else - OS.gtk_widget_show (handle); + OS.gtk_status_icon_set_visible (handle, visible); } else { - if (OS.GTK_VERSION >= OS.VERSION (2, 10, 0)) { - OS.gtk_status_icon_set_visible (handle, visible); - } else - OS.gtk_widget_hide (handle); + OS.gtk_status_icon_set_visible (handle, visible); sendEvent (SWT.Hide); } } -- cgit v1.2.3