Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-01-21 20:20:50 +0000
committerEric Williams2019-01-21 20:23:08 +0000
commit4cf23b394103bc16d4d5b7ccafec7133ba93664d (patch)
tree6fc94a8784b389a568924da2e13ea242de4891c2
parenta65c9d6b2c5e601ef4408fead79d294fa472a577 (diff)
downloadeclipse.platform.swt-4cf23b394103bc16d4d5b7ccafec7133ba93664d.tar.gz
eclipse.platform.swt-4cf23b394103bc16d4d5b7ccafec7133ba93664d.tar.xz
eclipse.platform.swt-4cf23b394103bc16d4d5b7ccafec7133ba93664d.zip
Bug 541650: [GTK4] GdkEvents are private and can no longer be created
Handle GdkEventScroll cases. Change-Id: I04f4d377fda7f719d00691e349f00e385c8b3f18 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c54
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.c63
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_structs.h14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java14
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventScroll.java40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java10
11 files changed, 58 insertions, 192 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 a1d7e43c12..cbaa2a9053 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
@@ -144,18 +144,6 @@ JNIEXPORT jint JNICALL GDK_NATIVE(GdkEventMotion_1sizeof)
}
#endif
-#ifndef NO_GdkEventScroll_1sizeof
-JNIEXPORT jint JNICALL GDK_NATIVE(GdkEventScroll_1sizeof)
- (JNIEnv *env, jclass that)
-{
- jint rc = 0;
- GDK_NATIVE_ENTER(env, that, GdkEventScroll_1sizeof_FUNC);
- rc = (jint)GdkEventScroll_sizeof();
- GDK_NATIVE_EXIT(env, that, GdkEventScroll_1sizeof_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_GdkEventWindowState_1sizeof
JNIEXPORT jint JNICALL GDK_NATIVE(GdkEventWindowState_1sizeof)
(JNIEnv *env, jclass that)
@@ -1131,6 +1119,22 @@ fail:
}
#endif
+#ifndef NO__1gdk_1event_1get_1scroll_1direction
+JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1event_1get_1scroll_1direction)
+ (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
+{
+ jint *lparg1=NULL;
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1event_1get_1scroll_1direction_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ rc = (jboolean)gdk_event_get_scroll_direction((const GdkEvent *)arg0, (GdkScrollDirection *)lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1event_1get_1scroll_1direction_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1event_1get_1seat
JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1event_1get_1seat)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -18826,32 +18830,6 @@ fail:
}
#endif
-#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#else
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#endif
-{
- GdkEventScroll _arg0, *lparg0=NULL;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ_FUNC);
-#endif
- if (!arg0) goto fail;
- if ((lparg0 = &_arg0) == NULL) goto fail;
- memmove((void *)lparg0, (const void *)arg1, (size_t)arg2);
-fail:
- if (arg0 && lparg0) setGdkEventScrollFields(env, arg0, lparg0);
-#ifndef JNI64
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ_FUNC);
-#endif
-}
-#endif
-
#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2JJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
index 4b9e6a9b74..d1f09f7100 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h
@@ -217,10 +217,6 @@
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2JJ
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2II
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2JJ
-#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEventScroll_2I
-#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEventScroll_2J
-#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II
-#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ
#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEventWindowState_2I
#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEventWindowState_2J
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2II
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 232f90ece2..4b5964e794 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
@@ -32,7 +32,6 @@ char * GDK_nativeFunctionNames[] = {
"GdkEventFocus_1sizeof",
"GdkEventKey_1sizeof",
"GdkEventMotion_1sizeof",
- "GdkEventScroll_1sizeof",
"GdkEventWindowState_1sizeof",
"GdkEvent_1sizeof",
"GdkGeometry_1sizeof",
@@ -112,6 +111,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1event_1get_1keyval",
"_1gdk_1event_1get_1root_1coords",
"_1gdk_1event_1get_1scroll_1deltas",
+ "_1gdk_1event_1get_1scroll_1direction",
"_1gdk_1event_1get_1seat",
"_1gdk_1event_1get_1state",
"_1gdk_1event_1get_1string",
@@ -1822,11 +1822,6 @@ char * OS_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2JJ",
#endif
#ifndef JNI64
- "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II",
-#else
- "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ",
-#endif
-#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2II",
#else
"memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2JJ",
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 680d4ea74e..7ad9719ce8 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
@@ -42,7 +42,6 @@ typedef enum {
GdkEventFocus_1sizeof_FUNC,
GdkEventKey_1sizeof_FUNC,
GdkEventMotion_1sizeof_FUNC,
- GdkEventScroll_1sizeof_FUNC,
GdkEventWindowState_1sizeof_FUNC,
GdkEvent_1sizeof_FUNC,
GdkGeometry_1sizeof_FUNC,
@@ -122,6 +121,7 @@ typedef enum {
_1gdk_1event_1get_1keyval_FUNC,
_1gdk_1event_1get_1root_1coords_FUNC,
_1gdk_1event_1get_1scroll_1deltas_FUNC,
+ _1gdk_1event_1get_1scroll_1direction_FUNC,
_1gdk_1event_1get_1seat_FUNC,
_1gdk_1event_1get_1state_FUNC,
_1gdk_1event_1get_1string_FUNC,
@@ -1796,11 +1796,6 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_gtk_GdkEventMotion_2JJ_FUNC,
#endif
#ifndef JNI64
- memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2II_FUNC,
-#else
- memmove__Lorg_eclipse_swt_internal_gtk_GdkEventScroll_2JJ_FUNC,
-#endif
-#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2II_FUNC,
#else
memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2JJ_FUNC,
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 7ab62ec7d3..ed4049dac9 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2018 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2019 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
@@ -622,67 +622,6 @@ void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEventMotion *lpSt
}
#endif
-#ifndef NO_GdkEventScroll
-typedef struct GdkEventScroll_FID_CACHE {
- int cached;
- jclass clazz;
- jfieldID window, send_event, time, x, y, state, direction, device, x_root, y_root;
-} GdkEventScroll_FID_CACHE;
-
-GdkEventScroll_FID_CACHE GdkEventScrollFc;
-
-void cacheGdkEventScrollFields(JNIEnv *env, jobject lpObject)
-{
- if (GdkEventScrollFc.cached) return;
- cacheGdkEventFields(env, lpObject);
- GdkEventScrollFc.clazz = (*env)->GetObjectClass(env, lpObject);
- GdkEventScrollFc.window = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "window", I_J);
- GdkEventScrollFc.send_event = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "send_event", "B");
- GdkEventScrollFc.time = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "time", "I");
- GdkEventScrollFc.x = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "x", "D");
- GdkEventScrollFc.y = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "y", "D");
- GdkEventScrollFc.state = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "state", "I");
- GdkEventScrollFc.direction = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "direction", "I");
- GdkEventScrollFc.device = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "device", I_J);
- GdkEventScrollFc.x_root = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "x_root", "D");
- GdkEventScrollFc.y_root = (*env)->GetFieldID(env, GdkEventScrollFc.clazz, "y_root", "D");
- GdkEventScrollFc.cached = 1;
-}
-
-GdkEventScroll *getGdkEventScrollFields(JNIEnv *env, jobject lpObject, GdkEventScroll *lpStruct)
-{
- if (!GdkEventScrollFc.cached) cacheGdkEventScrollFields(env, lpObject);
- getGdkEventFields(env, lpObject, (GdkEvent *)lpStruct);
- lpStruct->window = (GdkWindow *)(*env)->GetIntLongField(env, lpObject, GdkEventScrollFc.window);
- lpStruct->send_event = (gint8)(*env)->GetByteField(env, lpObject, GdkEventScrollFc.send_event);
- lpStruct->time = (guint32)(*env)->GetIntField(env, lpObject, GdkEventScrollFc.time);
- lpStruct->x = (gdouble)(*env)->GetDoubleField(env, lpObject, GdkEventScrollFc.x);
- lpStruct->y = (gdouble)(*env)->GetDoubleField(env, lpObject, GdkEventScrollFc.y);
- lpStruct->state = (guint)(*env)->GetIntField(env, lpObject, GdkEventScrollFc.state);
- lpStruct->direction = (GdkScrollDirection)(*env)->GetIntField(env, lpObject, GdkEventScrollFc.direction);
- lpStruct->device = (GdkDevice *)(*env)->GetIntLongField(env, lpObject, GdkEventScrollFc.device);
- lpStruct->x_root = (gdouble)(*env)->GetDoubleField(env, lpObject, GdkEventScrollFc.x_root);
- lpStruct->y_root = (gdouble)(*env)->GetDoubleField(env, lpObject, GdkEventScrollFc.y_root);
- return lpStruct;
-}
-
-void setGdkEventScrollFields(JNIEnv *env, jobject lpObject, GdkEventScroll *lpStruct)
-{
- if (!GdkEventScrollFc.cached) cacheGdkEventScrollFields(env, lpObject);
- setGdkEventFields(env, lpObject, (GdkEvent *)lpStruct);
- (*env)->SetIntLongField(env, lpObject, GdkEventScrollFc.window, (jintLong)lpStruct->window);
- (*env)->SetByteField(env, lpObject, GdkEventScrollFc.send_event, (jbyte)lpStruct->send_event);
- (*env)->SetIntField(env, lpObject, GdkEventScrollFc.time, (jint)lpStruct->time);
- (*env)->SetDoubleField(env, lpObject, GdkEventScrollFc.x, (jdouble)lpStruct->x);
- (*env)->SetDoubleField(env, lpObject, GdkEventScrollFc.y, (jdouble)lpStruct->y);
- (*env)->SetIntField(env, lpObject, GdkEventScrollFc.state, (jint)lpStruct->state);
- (*env)->SetIntField(env, lpObject, GdkEventScrollFc.direction, (jint)lpStruct->direction);
- (*env)->SetIntLongField(env, lpObject, GdkEventScrollFc.device, (jintLong)lpStruct->device);
- (*env)->SetDoubleField(env, lpObject, GdkEventScrollFc.x_root, (jdouble)lpStruct->x_root);
- (*env)->SetDoubleField(env, lpObject, GdkEventScrollFc.y_root, (jdouble)lpStruct->y_root);
-}
-#endif
-
#ifndef NO_GdkEventWindowState
typedef struct GdkEventWindowState_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 58e4ab6084..a208b737b7 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, 2018 IBM Corporation and others. All rights reserved.
+ * Copyright (c) 2000, 2019 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
@@ -162,18 +162,6 @@ void setGdkEventMotionFields(JNIEnv *env, jobject lpObject, GdkEventMotion *lpSt
#define GdkEventMotion_sizeof() 0
#endif
-#ifndef NO_GdkEventScroll
-void cacheGdkEventScrollFields(JNIEnv *env, jobject lpObject);
-GdkEventScroll *getGdkEventScrollFields(JNIEnv *env, jobject lpObject, GdkEventScroll *lpStruct);
-void setGdkEventScrollFields(JNIEnv *env, jobject lpObject, GdkEventScroll *lpStruct);
-#define GdkEventScroll_sizeof() sizeof(GdkEventScroll)
-#else
-#define cacheGdkEventScrollFields(a,b)
-#define getGdkEventScrollFields(a,b,c) NULL
-#define setGdkEventScrollFields(a,b,c)
-#define GdkEventScroll_sizeof() 0
-#endif
-
#ifndef NO_GdkEventWindowState
void cacheGdkEventWindowStateFields(JNIEnv *env, jobject lpObject);
GdkEventWindowState *getGdkEventWindowStateFields(JNIEnv *env, jobject lpObject, GdkEventWindowState *lpStruct);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
index 32067e48e7..3e69853a92 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java
@@ -268,7 +268,6 @@ public class GDK extends OS {
public static final native int GdkEventFocus_sizeof();
public static final native int GdkEventKey_sizeof();
public static final native int GdkEventMotion_sizeof();
- public static final native int GdkEventScroll_sizeof();
public static final native int GdkEventWindowState_sizeof();
public static final native int GdkGeometry_sizeof();
public static final native int GdkRectangle_sizeof();
@@ -1107,6 +1106,19 @@ public class GDK extends OS {
}
}
/**
+ * @param event cast=(const GdkEvent *)
+ * @param direction cast=(GdkScrollDirection *)
+ */
+ public static final native boolean _gdk_event_get_scroll_direction(long /*int*/ event, int [] direction);
+ public static final boolean gdk_event_get_scroll_direction(long /*int*/ event, int [] direction) {
+ lock.lock();
+ try {
+ return _gdk_event_get_scroll_direction(event, direction);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
* @method flags=dynamic
*/
public static final native long /*int*/ _gdk_event_get_seat(long /*int*/ event);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventScroll.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventScroll.java
deleted file mode 100644
index 39eeba93bb..0000000000
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GdkEventScroll.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2012 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
- * available at http://www.gnu.org/licenses/lgpl.html. If the version
- * of the LGPL at http://www.gnu.org is different to the version of
- * the LGPL accompanying this distribution and there is any conflict
- * between the two license versions, the terms of the LGPL accompanying
- * this distribution shall govern.
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.swt.internal.gtk;
-
-
-public class GdkEventScroll extends GdkEvent {
- /** @field cast=(GdkWindow *) */
- public long /*int*/ window;
- /** @field cast=(gint8) */
- public byte send_event;
- /** @field cast=(guint32) */
- public int time;
- /** @field cast=(gdouble) */
- public double x;
- /** @field cast=(gdouble) */
- public double y;
- /** @field cast=(guint) */
- public int state;
- /** @field cast=(GdkScrollDirection) */
- public int direction;
- /** @field cast=(GdkDevice *) */
- public long /*int*/ device;
- /** @field cast=(gdouble) */
- public double x_root;
- /** @field cast=(gdouble) */
- public double y_root;
- public static final int sizeof = GDK.GdkEventScroll_sizeof();
-}
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 7ae2b69c78..e1873bf0dd 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
@@ -2957,12 +2957,6 @@ public static final native void memmove(GdkEventMotion dest, long /*int*/ src, l
* @param src cast=(const void *)
* @param size cast=(size_t)
*/
-public static final native void memmove(GdkEventScroll dest, long /*int*/ src, long /*int*/ size);
-/**
- * @param dest cast=(void *),flags=no_in
- * @param src cast=(const void *)
- * @param size cast=(size_t)
- */
public static final native void memmove(GdkEventWindowState dest, long /*int*/ src, long /*int*/ size);
public static final native void memmove(long /*int*/ dest, GtkCellRendererClass src);
public static final native void memmove(GtkCellRendererClass dest, long /*int*/ src);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
index f1d1d8c23b..7673768e94 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java
@@ -3903,29 +3903,38 @@ long /*int*/ gtk_realize (long /*int*/ widget) {
@Override
long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) {
- GdkEventScroll gdkEvent = new GdkEventScroll ();
- OS.memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof);
- lastInput.x = (int) gdkEvent.x;
- lastInput.y = (int) gdkEvent.y;
+ double [] eventX = new double[1];
+ double [] eventY = new double[1];
+ GDK.gdk_event_get_coords(eventPtr, eventX, eventY);
+ double [] eventRX = new double[1];
+ double [] eventRY = new double[1];
+ GDK.gdk_event_get_root_coords(eventPtr, eventRX, eventRY);
+ int time = GDK.gdk_event_get_time(eventPtr);
+ int [] state = new int[1];
+ GDK.gdk_event_get_state(eventPtr, state);
+ lastInput.x = (int) eventX[0];
+ lastInput.y = (int) eventY[0];
+ int [] direction = new int[1];
+ GDK.gdk_event_get_scroll_direction(eventPtr, direction);
if (containedInRegion(lastInput.x, lastInput.y)) return 0;
- switch (gdkEvent.direction) {
+ switch (direction[0]) {
case GDK.GDK_SCROLL_UP:
- return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ return sendMouseEvent (SWT.MouseWheel, 0, 3, SWT.SCROLL_LINE, true, time, eventRX[0], eventRY[0], false, state[0]) ? 0 : 1;
case GDK.GDK_SCROLL_DOWN:
- return sendMouseEvent (SWT.MouseWheel, 0, -3, SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ return sendMouseEvent (SWT.MouseWheel, 0, -3, SWT.SCROLL_LINE, true, time, eventRX[0], eventRY[0], false, state[0]) ? 0 : 1;
case GDK.GDK_SCROLL_LEFT:
- return sendMouseEvent (SWT.MouseHorizontalWheel, 0, 3, 0, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ return sendMouseEvent (SWT.MouseHorizontalWheel, 0, 3, 0, true, time, eventRX[0], eventRY[0], false, state[0]) ? 0 : 1;
case GDK.GDK_SCROLL_RIGHT:
- return sendMouseEvent (SWT.MouseHorizontalWheel, 0, -3, 0, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ return sendMouseEvent (SWT.MouseHorizontalWheel, 0, -3, 0, true, time, eventRX[0], eventRY[0], false, state[0]) ? 0 : 1;
case GDK.GDK_SCROLL_SMOOTH:
long /*int*/ result = 0;
double[] delta_x = new double[1], delta_y = new double [1];
if (GDK.gdk_event_get_scroll_deltas (eventPtr, delta_x, delta_y)) {
if (delta_x [0] != 0) {
- result = (sendMouseEvent (SWT.MouseHorizontalWheel, 0, (int)(-3 * delta_x [0]), 0, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1);
+ result = (sendMouseEvent (SWT.MouseHorizontalWheel, 0, (int)(-3 * delta_x [0]), 0, true, time, eventRX[0], eventRY[0], false, state[0]) ? 0 : 1);
}
if (delta_y [0] != 0) {
- result = (sendMouseEvent (SWT.MouseWheel, 0, (int)(-3 * delta_y [0]), SWT.SCROLL_LINE, true, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1);
+ result = (sendMouseEvent (SWT.MouseWheel, 0, (int)(-3 * delta_y [0]), SWT.SCROLL_LINE, true, time, eventRX[0], eventRY[0], false, state[0]) ? 0 : 1);
}
}
return result;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 3e2825f5ee..2458651512 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -312,9 +312,9 @@ long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) {
*/
if ((state & CANVAS) != 0) {
ScrollBar scrollBar;
- GdkEventScroll gdkEvent = new GdkEventScroll ();
- OS.memmove (gdkEvent, eventPtr, GdkEventScroll.sizeof);
- if (gdkEvent.direction == GDK.GDK_SCROLL_SMOOTH) {
+ int [] direction = new int[1];
+ GDK.gdk_event_get_scroll_direction(eventPtr, direction);
+ if (direction[0] == GDK.GDK_SCROLL_SMOOTH) {
double[] delta_x = new double[1], delta_y = new double [1];
if (GDK.gdk_event_get_scroll_deltas (eventPtr, delta_x, delta_y)) {
if (delta_x [0] != 0) {
@@ -343,7 +343,7 @@ long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) {
}
}
} else {
- if (gdkEvent.direction == GDK.GDK_SCROLL_UP || gdkEvent.direction == GDK.GDK_SCROLL_DOWN) {
+ if (direction[0] == GDK.GDK_SCROLL_UP || direction[0] == GDK.GDK_SCROLL_DOWN) {
scrollBar = verticalBar;
} else {
scrollBar = horizontalBar;
@@ -353,7 +353,7 @@ long /*int*/ gtk_scroll_event (long /*int*/ widget, long /*int*/ eventPtr) {
gtk_adjustment_get (scrollBar.adjustmentHandle, adjustment);
/* Calculate wheel delta to match GTK+ 2.4 and higher */
int wheel_delta = (int) Math.pow(adjustment.page_size, 2.0 / 3.0);
- if (gdkEvent.direction == GDK.GDK_SCROLL_UP || gdkEvent.direction == GDK.GDK_SCROLL_LEFT)
+ if (direction[0] == GDK.GDK_SCROLL_UP || direction[0] == GDK.GDK_SCROLL_LEFT)
wheel_delta = -wheel_delta;
int value = (int) Math.max(adjustment.lower,
Math.min(adjustment.upper - adjustment.page_size, adjustment.value + wheel_delta));

Back to the top