Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Williams2019-01-09 17:01:59 -0500
committerEric Williams2019-01-14 13:29:55 -0500
commit03522764fd5f22abd333b3fdffb2f75eee6ae8d2 (patch)
tree00bfe6a484389da7cc29c2be2d9568f9c18a2574
parenta004725d04eb6702b57a47e0a7b3d0c003b110b2 (diff)
downloadeclipse.platform.swt-03522764fd5f22abd333b3fdffb2f75eee6ae8d2.tar.gz
eclipse.platform.swt-03522764fd5f22abd333b3fdffb2f75eee6ae8d2.tar.xz
eclipse.platform.swt-03522764fd5f22abd333b3fdffb2f75eee6ae8d2.zip
Bug 541650: [GTK4] GdkEvents are private and can no longer be created
Handle GdkEventButton memmoves as well as some others. Stop using gdk_event_free() for results of gtk_get_current_event(). Added missing accessor functions for GdkEvent* fields. Change-Id: I894b86593e15e901609399b7871bc2bf1f4e7bb3 Signed-off-by: Eric Williams <ericwill@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c187
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GDK.java77
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/OS.java24
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java42
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java6
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Control.java120
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java48
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java66
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java13
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java11
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java4
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java67
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java26
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java27
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tracker.java5
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TrayItem.java15
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java67
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java31
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java22
26 files changed, 588 insertions, 415 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 354609c0e9..8b05e64a49 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
@@ -838,6 +838,18 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1get_1primary_1monitor)
}
#endif
+#ifndef NO__1gdk_1display_1peek_1event
+JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1display_1peek_1event)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1display_1peek_1event_FUNC);
+ rc = (jintLong)gdk_display_peek_event((GdkDisplay *)arg0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1display_1peek_1event_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1display_1supports_1cursor_1color
JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1display_1supports_1cursor_1color)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -962,6 +974,22 @@ JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1event_1get)
}
#endif
+#ifndef NO__1gdk_1event_1get_1button
+JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1event_1get_1button)
+ (JNIEnv *env, jclass that, jintLong arg0, jintArray arg1)
+{
+ jint *lparg1=NULL;
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1event_1get_1button_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ rc = (jboolean)gdk_event_get_button((GdkEvent *)arg0, (guint *)lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1event_1get_1button_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1event_1get_1coords
JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1event_1get_1coords)
(JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1, jdoubleArray arg2)
@@ -1001,6 +1029,41 @@ JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1event_1get_1event_1type)
}
#endif
+#ifndef NO__1gdk_1event_1get_1focus_1in
+JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1event_1get_1focus_1in)
+ (JNIEnv *env, jclass that, jintLong arg0, jbooleanArray arg1)
+{
+ jboolean *lparg1=NULL;
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1event_1get_1focus_1in_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetBooleanArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ rc = (jboolean)gdk_event_get_focus_in((GdkEvent *)arg0, (gboolean *)lparg1);
+fail:
+ if (arg1 && lparg1) (*env)->ReleaseBooleanArrayElements(env, arg1, lparg1, 0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1event_1get_1focus_1in_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO__1gdk_1event_1get_1root_1coords
+JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1event_1get_1root_1coords)
+ (JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1, jdoubleArray arg2)
+{
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1event_1get_1root_1coords_FUNC);
+ if (arg1) if ((lparg1 = (*env)->GetDoubleArrayElements(env, arg1, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ rc = (jboolean)gdk_event_get_root_coords((GdkEvent *)arg0, (gdouble *)lparg1, (gdouble *)lparg2);
+fail:
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1event_1get_1root_1coords_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1event_1get_1scroll_1deltas
JNIEXPORT jboolean JNICALL GDK_NATIVE(_1gdk_1event_1get_1scroll_1deltas)
(JNIEnv *env, jclass that, jintLong arg0, jdoubleArray arg1, jdoubleArray arg2)
@@ -1056,6 +1119,18 @@ fail:
}
#endif
+#ifndef NO__1gdk_1event_1get_1surface
+JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1event_1get_1surface)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1event_1get_1surface_FUNC);
+ rc = (jintLong)gdk_event_get_surface((GdkEvent *)arg0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1event_1get_1surface_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1event_1get_1time
JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1event_1get_1time)
(JNIEnv *env, jclass that, jintLong arg0)
@@ -1068,6 +1143,18 @@ JNIEXPORT jint JNICALL GDK_NATIVE(_1gdk_1event_1get_1time)
}
#endif
+#ifndef NO__1gdk_1event_1get_1window
+JNIEXPORT jintLong JNICALL GDK_NATIVE(_1gdk_1event_1get_1window)
+ (JNIEnv *env, jclass that, jintLong arg0)
+{
+ jintLong rc = 0;
+ GDK_NATIVE_ENTER(env, that, _1gdk_1event_1get_1window_FUNC);
+ rc = (jintLong)gdk_event_get_window((GdkEvent *)arg0);
+ GDK_NATIVE_EXIT(env, that, _1gdk_1event_1get_1window_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO__1gdk_1event_1handler_1set
JNIEXPORT void JNICALL GDK_NATIVE(_1gdk_1event_1handler_1set)
(JNIEnv *env, jclass that, jintLong arg0, jintLong arg1, jintLong arg2)
@@ -18286,30 +18373,6 @@ fail:
}
#endif
-#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
-#else
-JNIEXPORT void JNICALL OS_NATIVE(memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
-#endif
-{
- GdkEventExpose _arg1, *lparg1=NULL;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J_FUNC);
-#endif
- if (arg1) if ((lparg1 = getGdkEventExposeFields(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_GdkEventExpose_2I_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J_FUNC);
-#endif
-}
-#endif
-
#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventKey_2J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
@@ -18334,30 +18397,6 @@ fail:
}
#endif
-#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
-#else
-JNIEXPORT void JNICALL OS_NATIVE(memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
-#endif
-{
- GdkEventMotion _arg1, *lparg1=NULL;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J_FUNC);
-#endif
- if (arg1) if ((lparg1 = getGdkEventMotionFields(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_GdkEventMotion_2I_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J_FUNC);
-#endif
-}
-#endif
-
#if (!defined(NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I) && !defined(JNI64)) || (!defined(NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I)(JNIEnv *env, jclass that, jintLong arg0, jobject arg1, jintLong arg2)
@@ -18543,32 +18582,6 @@ fail:
}
#endif
-#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2JJ) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#else
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2JJ)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#endif
-{
- GdkEventAny _arg0, *lparg0=NULL;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_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) setGdkEventAnyFields(env, arg0, lparg0);
-#ifndef JNI64
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2JJ_FUNC);
-#endif
-}
-#endif
-
#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2JJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
@@ -18777,32 +18790,6 @@ fail:
}
#endif
-#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2JJ) && defined(JNI64))
-#ifndef JNI64
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#else
-JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2JJ)(JNIEnv *env, jclass that, jobject arg0, jintLong arg1, jintLong arg2)
-#endif
-{
- GdkEvent _arg0, *lparg0=NULL;
-#ifndef JNI64
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II_FUNC);
-#else
- OS_NATIVE_ENTER(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_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) setGdkEventFields(env, arg0, lparg0);
-#ifndef JNI64
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II_FUNC);
-#else
- OS_NATIVE_EXIT(env, that, memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2JJ_FUNC);
-#endif
-}
-#endif
-
#if (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_2II) && !defined(JNI64)) || (!defined(NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_2JJ) && defined(JNI64))
#ifndef JNI64
JNIEXPORT void JNICALL OS_NATIVE(memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_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 5ee41cf405..f3c369d7bb 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
@@ -195,12 +195,8 @@
#define NO_memmove__LLorg_eclipse_swt_internal_gtk_GtkTargetEntry_2JJ
#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEvent_2I
#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEvent_2J
-#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II
-#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2JJ
#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEventAny_2I
#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEventAny_2J
-#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II
-#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2JJ
#define NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventButton_2I
#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventButton_2J
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II
@@ -209,8 +205,6 @@
#define NO_memmove__Jorg_eclipse_swt_internal_gtk_GdkEventCrossing_2J
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventCrossing_2II
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventCrossing_2JJ
-#define NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I
-#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2II
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventExpose_2JJ
#define NO_memmove__Iorg_eclipse_swt_internal_gtk_GdkEventFocus_2I
@@ -221,8 +215,6 @@
#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventKey_2J
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2II
#define NO_memmove__Lorg_eclipse_swt_internal_gtk_GdkEventKey_2JJ
-#define NO_memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I
-#define NO_memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J
#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
@@ -362,6 +354,7 @@
#define NO__1gdk_1window_1show_1unraised
#define NO__1gdk_1device_1get_1window_1at_1position
#define NO__1gdk_1window_1set_1background_1pattern
+#define NO__1gdk_1event_1get_1window
// GdkDragContext removals
#define NO__1gdk_1drag_1context_1get_1dest_1window
@@ -432,6 +425,7 @@
#define NO__1gdk_1surface_1set_1functions
#define NO__1gdk_1surface_1get_1root_1origin
#define NO__1gdk_1surface_1invalidate_1region
+#define NO__1gdk_1event_1get_1surface
// No GtkSnapshot on GTK3
#define NO__1gtk_1snapshot_1append_1cairo
@@ -449,6 +443,9 @@
#define NO__1gdk_1cursor_1new_1from_1name___3BJ
#define NO__1gdk_1display_1get_1keymap
#define NO__1gtk_1style_1context_1add_1provider_1for_1display
+
+// GdkEvent functions which do not exist on GTK3
+#define NO__1gdk_1event_1get_1focus_1in
#endif
#include "os_custom.h"
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 77fdbb859f..9a650a8cad 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
@@ -92,6 +92,7 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1display_1get_1monitor_1at_1window",
"_1gdk_1display_1get_1n_1monitors",
"_1gdk_1display_1get_1primary_1monitor",
+ "_1gdk_1display_1peek_1event",
"_1gdk_1display_1supports_1cursor_1color",
"_1gdk_1drag_1context_1get_1actions",
"_1gdk_1drag_1context_1get_1dest_1window",
@@ -102,12 +103,17 @@ char * GDK_nativeFunctionNames[] = {
"_1gdk_1event_1copy",
"_1gdk_1event_1free",
"_1gdk_1event_1get",
+ "_1gdk_1event_1get_1button",
"_1gdk_1event_1get_1coords",
"_1gdk_1event_1get_1event_1type",
+ "_1gdk_1event_1get_1focus_1in",
+ "_1gdk_1event_1get_1root_1coords",
"_1gdk_1event_1get_1scroll_1deltas",
"_1gdk_1event_1get_1seat",
"_1gdk_1event_1get_1state",
+ "_1gdk_1event_1get_1surface",
"_1gdk_1event_1get_1time",
+ "_1gdk_1event_1get_1window",
"_1gdk_1event_1handler_1set",
"_1gdk_1event_1new",
"_1gdk_1event_1peek",
@@ -1735,21 +1741,11 @@ char * OS_nativeFunctionNames[] = {
"memmove__JLorg_eclipse_swt_internal_gtk_GdkEventButton_2J",
#endif
#ifndef JNI64
- "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I",
-#else
- "memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J",
-#endif
-#ifndef JNI64
"memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I",
#else
"memmove__JLorg_eclipse_swt_internal_gtk_GdkEventKey_2J",
#endif
#ifndef JNI64
- "memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I",
-#else
- "memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J",
-#endif
-#ifndef JNI64
"memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I",
#else
"memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J",
@@ -1790,11 +1786,6 @@ char * OS_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_gtk_GTypeQuery_2JJ",
#endif
#ifndef JNI64
- "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II",
-#else
- "memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2JJ",
-#endif
-#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II",
#else
"memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2JJ",
@@ -1835,11 +1826,6 @@ char * OS_nativeFunctionNames[] = {
"memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2JJ",
#endif
#ifndef JNI64
- "memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II",
-#else
- "memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2JJ",
-#endif
-#ifndef JNI64
"memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_2II",
#else
"memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_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 689686c448..1ca8451325 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
@@ -102,6 +102,7 @@ typedef enum {
_1gdk_1display_1get_1monitor_1at_1window_FUNC,
_1gdk_1display_1get_1n_1monitors_FUNC,
_1gdk_1display_1get_1primary_1monitor_FUNC,
+ _1gdk_1display_1peek_1event_FUNC,
_1gdk_1display_1supports_1cursor_1color_FUNC,
_1gdk_1drag_1context_1get_1actions_FUNC,
_1gdk_1drag_1context_1get_1dest_1window_FUNC,
@@ -112,12 +113,17 @@ typedef enum {
_1gdk_1event_1copy_FUNC,
_1gdk_1event_1free_FUNC,
_1gdk_1event_1get_FUNC,
+ _1gdk_1event_1get_1button_FUNC,
_1gdk_1event_1get_1coords_FUNC,
_1gdk_1event_1get_1event_1type_FUNC,
+ _1gdk_1event_1get_1focus_1in_FUNC,
+ _1gdk_1event_1get_1root_1coords_FUNC,
_1gdk_1event_1get_1scroll_1deltas_FUNC,
_1gdk_1event_1get_1seat_FUNC,
_1gdk_1event_1get_1state_FUNC,
+ _1gdk_1event_1get_1surface_FUNC,
_1gdk_1event_1get_1time_FUNC,
+ _1gdk_1event_1get_1window_FUNC,
_1gdk_1event_1handler_1set_FUNC,
_1gdk_1event_1new_FUNC,
_1gdk_1event_1peek_FUNC,
@@ -1709,21 +1715,11 @@ typedef enum {
memmove__JLorg_eclipse_swt_internal_gtk_GdkEventButton_2J_FUNC,
#endif
#ifndef JNI64
- memmove__ILorg_eclipse_swt_internal_gtk_GdkEventExpose_2I_FUNC,
-#else
- memmove__JLorg_eclipse_swt_internal_gtk_GdkEventExpose_2J_FUNC,
-#endif
-#ifndef JNI64
memmove__ILorg_eclipse_swt_internal_gtk_GdkEventKey_2I_FUNC,
#else
memmove__JLorg_eclipse_swt_internal_gtk_GdkEventKey_2J_FUNC,
#endif
#ifndef JNI64
- memmove__ILorg_eclipse_swt_internal_gtk_GdkEventMotion_2I_FUNC,
-#else
- memmove__JLorg_eclipse_swt_internal_gtk_GdkEventMotion_2J_FUNC,
-#endif
-#ifndef JNI64
memmove__ILorg_eclipse_swt_internal_gtk_GdkRGBA_2I_FUNC,
#else
memmove__JLorg_eclipse_swt_internal_gtk_GdkRGBA_2J_FUNC,
@@ -1764,11 +1760,6 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_gtk_GTypeQuery_2JJ_FUNC,
#endif
#ifndef JNI64
- memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2II_FUNC,
-#else
- memmove__Lorg_eclipse_swt_internal_gtk_GdkEventAny_2JJ_FUNC,
-#endif
-#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2II_FUNC,
#else
memmove__Lorg_eclipse_swt_internal_gtk_GdkEventButton_2JJ_FUNC,
@@ -1809,11 +1800,6 @@ typedef enum {
memmove__Lorg_eclipse_swt_internal_gtk_GdkEventWindowState_2JJ_FUNC,
#endif
#ifndef JNI64
- memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2II_FUNC,
-#else
- memmove__Lorg_eclipse_swt_internal_gtk_GdkEvent_2JJ_FUNC,
-#endif
-#ifndef JNI64
memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_2II_FUNC,
#else
memmove__Lorg_eclipse_swt_internal_gtk_GdkKeymapKey_2JJ_FUNC,
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 fcbf5dfc28..c52c19cd2e 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
@@ -986,6 +986,47 @@ public class GDK extends OS {
}
/**
* @param event cast=(GdkEvent *)
+ * @param button cast=(guint *)
+ */
+ public static final native boolean _gdk_event_get_button(long /*int*/ event, int[] button);
+ public static final boolean gdk_event_get_button(long /*int*/ event, int[] button) {
+ lock.lock();
+ try {
+ return _gdk_event_get_button(event, button);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @param event cast=(GdkEvent *)
+ * @param in cast=(gboolean *)
+ */
+ public static final native boolean _gdk_event_get_focus_in(long /*int*/ event, boolean [] in);
+ /** [GTK4 only, if-def'd in os.h] */
+ public static final boolean gdk_event_get_focus_in(long /*int*/ event, boolean [] in) {
+ lock.lock();
+ try {
+ return _gdk_event_get_focus_in(event, in);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @param event cast=(GdkEvent *)
+ * @param x cast=(gdouble *)
+ * @param y cast=(gdouble *)
+ */
+ public static final native boolean _gdk_event_get_root_coords(long /*int*/ event, double[] x, double[] y);
+ public static final boolean gdk_event_get_root_coords(long /*int*/ event, double[] x, double[] y) {
+ lock.lock();
+ try {
+ return _gdk_event_get_root_coords(event, x, y);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @param event cast=(GdkEvent *)
* @param pmod cast=(GdkModifierType *)
*/
public static final native boolean _gdk_event_get_state(long /*int*/ event, int[] pmod);
@@ -1023,6 +1064,32 @@ public class GDK extends OS {
lock.unlock();
}
}
+ /**
+ * @param event cast=(GdkEvent *)
+ */
+ public static final native long /*int*/ _gdk_event_get_surface(long /*int*/ event);
+ /** [GTK4 only, if-def'd in os.h] **/
+ public static final long /*int*/ gdk_event_get_surface(long /*int*/ event) {
+ lock.lock();
+ try {
+ return _gdk_event_get_surface(event);
+ } finally {
+ lock.unlock();
+ }
+ }
+ /**
+ * @param event cast=(GdkEvent *)
+ */
+ public static final native long /*int*/ _gdk_event_get_window(long /*int*/ event);
+ /** [GTK3 only, if-def'd in os.h] **/
+ public static final long /*int*/ gdk_event_get_window(long /*int*/ event) {
+ lock.lock();
+ try {
+ return _gdk_event_get_window(event);
+ } finally {
+ lock.unlock();
+ }
+ }
/** @param event cast=(GdkEvent *) */
public static final native int _gdk_event_get_time(long /*int*/ event);
public static final int gdk_event_get_time(long /*int*/ event) {
@@ -1743,6 +1810,16 @@ public class GDK extends OS {
lock.unlock();
}
}
+ /** @param display cast=(GdkDisplay *) */
+ public static final native long /*int*/ _gdk_display_peek_event(long /*int*/ display);
+ public static final long /*int*/ gdk_display_peek_event(long /*int*/ display) {
+ lock.lock();
+ try {
+ return _gdk_display_peek_event(display);
+ } finally {
+ lock.unlock();
+ }
+ }
/**
* @method flags=dynamic
* @param screen cast=(GdkScreen *)
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 2beb91700a..7ae2b69c78 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
@@ -2877,18 +2877,6 @@ public static final native void memmove(long /*int*/ dest, GdkEventButton src, l
* @param size cast=(size_t)
*/
public static final native void memmove(long /*int*/ dest, GdkEventKey src, long /*int*/ size);
-/**
- * @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, GdkEventExpose src, long /*int*/ size);
-/**
- * @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, GdkEventMotion src, long /*int*/ size);
/** @param src flags=no_out */
public static final native void memmove(long /*int*/ dest, GtkWidgetClass src);
/**
@@ -2933,18 +2921,6 @@ public static final native void memmove(GdkRGBA dest, long /*int*/ src, long /*i
* @param src cast=(const void *)
* @param size cast=(size_t)
*/
-public static final native void memmove(GdkEvent 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(GdkEventAny 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(GdkEventButton dest, long /*int*/ src, long /*int*/ size);
/**
* @param dest cast=(void *),flags=no_in
diff --git a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
index 3a72a52ae2..3c6d1b8f12 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT WebKit/gtk/org/eclipse/swt/browser/WebKit.java
@@ -2083,7 +2083,11 @@ boolean handleDOMEvent (long /*int*/ event, int type) {
keyEventState = gdkEvent.state;
break;
}
- GDK.gdk_event_free (eventPtr);
+ if (GTK.GTK4) {
+ OS.g_object_unref(eventPtr);
+ } else {
+ GDK.gdk_event_free (eventPtr);
+ }
}
int keyCode = (int)WebKitGTK.webkit_dom_ui_event_get_key_code (event);
int charCode = (int)WebKitGTK.webkit_dom_ui_event_get_char_code (event);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
index 6be8f47936..2a1213032e 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Combo.java
@@ -1312,9 +1312,10 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* the left mouse button event from being propagated. The fix is to
* send the mouse event from the event_after handler.
*/
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.type == GDK.GDK_BUTTON_PRESS && gdkEvent.button == 1) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ int eventType = GDK.gdk_event_get_event_type(event);
+ if (eventType == GDK.GDK_BUTTON_PRESS && eventButton[0] == 1) {
return gtk_button_press_event(widget, event, false);
}
return super.gtk_button_press_event (widget, event);
@@ -1361,7 +1362,7 @@ long /*int*/ gtk_changed (long /*int*/ widget) {
keyPress = true;
break;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
if (keyPress) {
postEvent (SWT.Modify);
@@ -1520,14 +1521,19 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
* user clicks on the drop down button focus is assigned to the text
* field.
*/
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_PRESS: {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 1) {
- if (!sendMouseEvent (SWT.MouseDown, gdkEventButton.button, display.clickCount, 0, false, gdkEventButton.time, gdkEventButton.x_root, gdkEventButton.y_root, false, gdkEventButton.state)) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ int eventTime = GDK.gdk_event_get_time(gdkEvent);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(gdkEvent, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(gdkEvent, eventState);
+ if (eventButton[0] == 1) {
+ if (!sendMouseEvent (SWT.MouseDown, eventButton[0], display.clickCount, 0, false, eventTime, eventRX[0], eventRY[0], false, eventState[0])) {
return 1;
}
if ((style & SWT.READ_ONLY) == 0 && widget == buttonHandle) {
@@ -1538,9 +1544,15 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
}
case GDK.GDK_FOCUS_CHANGE: {
if ((style & SWT.READ_ONLY) == 0) {
- GdkEventFocus gdkEventFocus = new GdkEventFocus ();
- OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
- if (gdkEventFocus.in != 0) {
+ boolean [] focusIn = new boolean [1];
+ if (GTK.GTK4) {
+ GDK.gdk_event_get_focus_in(gdkEvent, focusIn);
+ } else {
+ GdkEventFocus gdkEventFocus = new GdkEventFocus ();
+ OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
+ focusIn[0] = gdkEventFocus.in != 0;
+ }
+ if (focusIn[0]) {
if (GTK.GTK_VERSION >= OS.VERSION(3, 20, 0)) {
GTK.gtk_widget_set_focus_on_click(handle, false);
} else {
@@ -2599,7 +2611,7 @@ String verifyText (String string, int start, int end) {
setKeyState (event, gdkEvent);
break;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
/*
* It is possible (but unlikely), that application
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
index 89dfb9b4fa..a1b6f6718f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java
@@ -842,9 +842,9 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
if (result != 0) return result;
if ((state & CANVAS) != 0) {
if ((style & SWT.NO_FOCUS) == 0 && hooksKeys ()) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.button == 1) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ if (eventButton[0] == 1) {
if (getChildrenCount () == 0) setFocus ();
}
}
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 9f265d8c97..19aec1c21e 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
@@ -3308,12 +3308,24 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
mouseDown = true;
dragBegun = false;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- lastInput.x = (int) gdkEvent.x;
- lastInput.y = (int) gdkEvent.y;
+ // Event fields
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int eventType = GDK.gdk_event_get_event_type(event);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ int eventTime = GDK.gdk_event_get_time(event);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+
+ lastInput.x = (int) eventX[0];
+ lastInput.y = (int) eventY[0];
if (containedInRegion(lastInput.x, lastInput.y)) return 0;
- if (gdkEvent.type == GDK.GDK_3BUTTON_PRESS) return 0;
+ if (eventType == GDK.GDK_3BUTTON_PRESS) return 0;
/*
* When a shell is created with SWT.ON_TOP and SWT.NO_FOCUS,
@@ -3326,15 +3338,16 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
shell.forceActive();
}
long /*int*/ result = 0;
- if (gdkEvent.type == GDK.GDK_BUTTON_PRESS) {
+ if (eventType == GDK.GDK_BUTTON_PRESS) {
boolean dragging = false;
display.clickCount = 1;
- long /*int*/ nextEvent = GDK.gdk_event_peek ();
+ long /*int*/ defaultDisplay = GDK.gdk_display_get_default();
+ long /*int*/ nextEvent = GTK.GTK4 ? GDK.gdk_display_peek_event(defaultDisplay) : GDK.gdk_event_peek ();
if (nextEvent != 0) {
- int eventType = GDK.GDK_EVENT_TYPE (nextEvent);
- if (eventType == GDK.GDK_2BUTTON_PRESS) display.clickCount = 2;
- if (eventType == GDK.GDK_3BUTTON_PRESS) display.clickCount = 3;
- GDK.gdk_event_free (nextEvent);
+ int peekedEventType = GDK.GDK_EVENT_TYPE (nextEvent);
+ if (peekedEventType == GDK.GDK_2BUTTON_PRESS) display.clickCount = 2;
+ if (peekedEventType == GDK.GDK_3BUTTON_PRESS) display.clickCount = 3;
+ gdk_event_free (nextEvent);
}
/*
* Feature in GTK: DND detection for X.11 & Wayland support is done through motion notify event
@@ -3342,9 +3355,9 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
*/
if (OS.isX11()) { // Wayland
if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect)) {
- if (gdkEvent.button == 1) {
+ if (eventButton[0] == 1) {
boolean [] consume = new boolean [1];
- if (dragDetect ((int) gdkEvent.x, (int) gdkEvent.y, true, true, consume)) {
+ if (dragDetect ((int) eventX[0], (int) eventY[0], true, true, consume)) {
dragging = true;
if (consume [0]) result = 1;
}
@@ -3352,7 +3365,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
}
}
}
- if (sendMouseDown && !sendMouseEvent (SWT.MouseDown, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state)) {
+ if (sendMouseDown && !sendMouseEvent (SWT.MouseDown, eventButton[0], display.clickCount, 0, false, eventTime, eventRX[0], eventRY[0], false, eventState[0])) {
result = 1;
}
if (isDisposed ()) return 1;
@@ -3362,8 +3375,8 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
*/
if (OS.isX11()) { // Wayland
if (dragging) {
- Point scaledEvent = DPIUtil.autoScaleDown(new Point((int)gdkEvent.x, (int) gdkEvent.y));
- sendDragEvent (gdkEvent.button, gdkEvent.state, scaledEvent.x, scaledEvent.y, false);
+ Point scaledEvent = DPIUtil.autoScaleDown(new Point((int)eventX[0], (int) eventY[0]));
+ sendDragEvent (eventButton[0], eventState[0], scaledEvent.x, scaledEvent.y, false);
if (isDisposed ()) return 1;
}
}
@@ -3373,15 +3386,15 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
* operating system from displaying the menu if necessary.
*/
if ((state & MENU) != 0) {
- if (gdkEvent.button == 3) {
- if (showMenu ((int)gdkEvent.x_root, (int)gdkEvent.y_root)) {
+ if (eventButton[0] == 3) {
+ if (showMenu ((int)eventRX[0], (int)eventRY[0])) {
result = 1;
}
}
}
} else {
display.clickCount = 2;
- result = sendMouseEvent (SWT.MouseDoubleClick, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ result = sendMouseEvent (SWT.MouseDoubleClick, eventButton[0], display.clickCount, 0, false, eventTime, eventRX[0],eventRY[0], false, eventState[0]) ? 0 : 1;
if (isDisposed ()) return 1;
}
if (!shell.isDisposed ()) shell.setActiveControl (this, SWT.MouseDown);
@@ -3391,12 +3404,23 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event, bo
@Override
long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event) {
mouseDown = false;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- lastInput.x = (int) gdkEvent.x;
- lastInput.y = (int) gdkEvent.y;
+ // Event fields
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ int eventTime = GDK.gdk_event_get_time(event);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+
+ lastInput.x = (int) eventX[0];
+ lastInput.y = (int) eventY[0];
if (containedInRegion(lastInput.x, lastInput.y)) return 0;
- return sendMouseEvent (SWT.MouseUp, gdkEvent.button, display.clickCount, 0, false, gdkEvent.time, gdkEvent.x_root, gdkEvent.y_root, false, gdkEvent.state) ? 0 : 1;
+ return sendMouseEvent (SWT.MouseUp, eventButton[0], display.clickCount, 0, false, eventTime, eventRX[0], eventRY[0], false, eventState[0]) ? 0 : 1;
}
@Override
@@ -3460,9 +3484,8 @@ boolean checkSubwindow () {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_PRESS: {
if (widget != eventHandle ()) break;
/*
@@ -3471,18 +3494,27 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
* such as GtkTreeView to select items before a menu is shown.
*/
if ((state & MENU) == 0) {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 3) {
- showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(gdkEvent, eventRX, eventRY);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ if (eventButton[0] == 3) {
+ showMenu ((int) eventRX[0], (int) eventRY[0]);
}
}
break;
}
case GDK.GDK_FOCUS_CHANGE: {
if (!isFocusHandle (widget)) break;
- GdkEventFocus gdkEventFocus = new GdkEventFocus ();
- OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
+ boolean [] focusIn = new boolean [1];
+ if (GTK.GTK4) {
+ GDK.gdk_event_get_focus_in(gdkEvent, focusIn);
+ } else {
+ GdkEventFocus gdkEventFocus = new GdkEventFocus ();
+ OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
+ focusIn[0] = gdkEventFocus.in != 0;
+ }
/*
* Feature in GTK. The GTK combo box popup under some window managers
@@ -3494,7 +3526,7 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
* NOTE: This code runs for all menus.
*/
Display display = this.display;
- if (gdkEventFocus.in != 0) {
+ if (focusIn[0]) {
if (display.ignoreFocus) {
display.ignoreFocus = false;
break;
@@ -3510,7 +3542,7 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
}
}
- sendFocusEvent (gdkEventFocus.in != 0 ? SWT.FocusIn : SWT.FocusOut);
+ sendFocusEvent (focusIn[0] ? SWT.FocusIn : SWT.FocusOut);
break;
}
}
@@ -3729,7 +3761,7 @@ long /*int*/ gtk_mnemonic_activate (long /*int*/ widget, long /*int*/ arg1) {
}
result = 1;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
return result;
}
@@ -3762,11 +3794,17 @@ long /*int*/ gtk_motion_notify_event (long /*int*/ widget, long /*int*/ event) {
}
if (dragging) {
GTK.gtk_event_controller_handle_event(dragGesture,event);
- GdkEventButton gdkEvent1 = new GdkEventButton ();
- OS.memmove (gdkEvent1, event, GdkEventButton.sizeof);
- if (gdkEvent1.type == GDK.GDK_3BUTTON_PRESS) return 0;
- Point scaledEvent = DPIUtil.autoScaleDown(new Point((int)gdkEvent1.x, (int) gdkEvent1.y));
- if (sendDragEvent (gdkEvent1.button, gdkEvent1.state, scaledEvent.x, scaledEvent.y, false)){
+ int eventType = GDK.gdk_event_get_event_type(event);
+ if (eventType == GDK.GDK_3BUTTON_PRESS) return 0;
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ Point scaledEvent = DPIUtil.autoScaleDown(new Point((int)eventX[0], (int) eventY[0]));
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ if (sendDragEvent (eventButton[0], eventState[0], scaledEvent.x, scaledEvent.y, false)){
return 1;
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
index 8f98c9ab22..95c26a4de1 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Link.java
@@ -331,12 +331,16 @@ public String getText () {
long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
long /*int*/ result = super.gtk_button_press_event (widget, event);
if (result != 0) return result;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.button == 1 && gdkEvent.type == GDK.GDK_BUTTON_PRESS) {
+ int eventType = GDK.gdk_event_get_event_type(event);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ if (eventButton[0] == 1 && eventType == GDK.GDK_BUTTON_PRESS) {
if (focusIndex != -1) setFocus ();
- int x = (int) gdkEvent.x;
- int y = (int) gdkEvent.y;
+ int x = (int) eventX[0];
+ int y = (int) eventY[0];
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x;
int offset = DPIUtil.autoScaleUp(layout.getOffset (x, y, null));
int oldSelectionX = selection.x;
@@ -372,11 +376,14 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event)
long /*int*/ result = super.gtk_button_release_event (widget, event);
if (result != 0) return result;
if (focusIndex == -1) return result;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.button == 1) {
- int x = (int) gdkEvent.x;
- int y = (int) gdkEvent.y;
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ if (eventButton[0] == 1) {
+ int x = (int) eventX[0];
+ int y = (int) eventY[0];
if ((style & SWT.MIRRORED) != 0) x = getClientWidth () - x;
Rectangle [] rects = getRectanglesInPixels (focusIndex);
for (int i = 0; i < rects.length; i++) {
@@ -410,9 +417,8 @@ long /*int*/ gtk_draw (long /*int*/ widget, long /*int*/ cairo) {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
long /*int*/ result = super.gtk_event_after (widget, gdkEvent);
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_FOCUS_CHANGE:
redraw ();
break;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
index 095f4e5e23..aac3010759 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/List.java
@@ -796,22 +796,28 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* in GTK in the case that additional items aren't being added (CTRL_MASK or SHIFT_MASK) and the item being dragged is already
* selected, we can give the DnD handling to MOTION-NOTIFY. See Bug 503431
*/
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int eventType = GDK.gdk_event_get_event_type(event);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect) &&
- !OS.isX11() && gdkEvent.type == GDK.GDK_BUTTON_PRESS) { // Wayland
+ !OS.isX11() && eventType == GDK.GDK_BUTTON_PRESS) { // Wayland
// check to see if there is another event coming in that is not a double/triple click, this is to prevent Bug 514531
long /*int*/ nextEvent = GDK.gdk_event_peek ();
if (nextEvent == 0) {
long /*int*/ [] path = new long /*int*/ [1];
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null) &&
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null) &&
path[0] != 0) {
// selection count is used in the case of clicking an already selected item while holding Control
selectionCountOnPress = getSelectionCount();
if (GTK.gtk_tree_selection_path_is_selected (selection, path[0])) {
- if (((gdkEvent.state & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) ||
- ((gdkEvent.state & GDK.GDK_CONTROL_MASK) != 0)) {
+ if (((eventState[0] & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) ||
+ ((eventState[0] & GDK.GDK_CONTROL_MASK) != 0)) {
/**
* Disable selection on a mouse click if there are multiple items already selected. Also,
* if control is currently being held down, we will designate the selection logic over to release
@@ -837,10 +843,10 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* run the default handler when the item is already part of the current selection.
*/
- int button = gdkEvent.button;
- if (button == 3 && gdkEvent.type == GDK.GDK_BUTTON_PRESS) {
+ int button = eventButton[0];
+ if (button == 3 && eventType == GDK.GDK_BUTTON_PRESS) {
long /*int*/ [] path = new long /*int*/ [1];
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null)) {
if (path [0] != 0) {
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
if (GTK.gtk_tree_selection_path_is_selected (selection, path [0])) result = 1;
@@ -858,7 +864,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
*/
if ((style & SWT.SINGLE) != 0 && getSelectionCount () == 0) {
long /*int*/ [] path = new long /*int*/ [1];
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null)) {
if (path [0] != 0) {
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
@@ -876,7 +882,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* that 'row-activated' signal comes before double-click event. This prevents
* opening of the current highlighted item when double clicking on any expander arrow.
*/
- if (gdkEvent.type == GDK.GDK_2BUTTON_PRESS && rowActivated) {
+ if (eventType == GDK.GDK_2BUTTON_PRESS && rowActivated) {
sendTreeDefaultSelection ();
rowActivated = false;
}
@@ -902,9 +908,17 @@ long /*int*/ gtk_key_press_event (long /*int*/ widget, long /*int*/ event) {
@Override
long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.window != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ long /*int*/ eventGdkResource = GTK.GTK4 ? GDK.gdk_event_get_surface(event) : GDK.gdk_event_get_window(event);
+ if (GTK.GTK4) {
+ if (eventGdkResource != gtk_widget_get_surface (handle)) return 0;
+ } else {
+ if (eventGdkResource != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ }
/*
* Feature in GTK. In multi-select tree view there is a problem with using DnD operations while also selecting multiple items.
* When doing a DnD, GTK de-selects all other items except for the widget being dragged from. By disabling the selection function
@@ -917,15 +931,15 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event)
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
// free up the selection function on release.
GTK.gtk_tree_selection_set_select_function(selection,0,0,0);
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null) &&
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null) &&
path[0] != 0 && GTK.gtk_tree_selection_path_is_selected (selection, path[0])) {
selectionCountOnRelease = getSelectionCount();
- if ((gdkEvent.state & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) {
+ if ((eventState[0] & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) {
GTK.gtk_tree_view_set_cursor(handle, path[0], 0, false);
}
// Check to see if there has been a new tree item selected when holding Control in Path.
// If not, deselect the item.
- if ((gdkEvent.state & GDK.GDK_CONTROL_MASK) != 0 && selectionCountOnRelease == selectionCountOnPress) {
+ if ((eventState[0] & GDK.GDK_CONTROL_MASK) != 0 && selectionCountOnRelease == selectionCountOnPress) {
GTK.gtk_tree_selection_unselect_path (selection,path[0]);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
index d37b060359..a8b5edf7bd 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Sash.java
@@ -154,20 +154,27 @@ void drawBand (int x, int y, int width, int height) {
}
@Override
-long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ eventPtr) {
- long /*int*/ result = super.gtk_button_press_event (widget, eventPtr);
+long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
+ long /*int*/ result = super.gtk_button_press_event (widget, event);
if (result != 0) return result;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, eventPtr, GdkEventButton.sizeof);
- int button = gdkEvent.button;
+ // Event fields
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ int eventType = GDK.gdk_event_get_event_type(event);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int eventTime = GDK.gdk_event_get_time(event);
+
+ int button = eventButton[0];
if (button != 1) return 0;
- if (gdkEvent.type == GDK.GDK_2BUTTON_PRESS) return 0;
- if (gdkEvent.type == GDK.GDK_3BUTTON_PRESS) return 0;
+ if (eventType == GDK.GDK_2BUTTON_PRESS) return 0;
+ if (eventType == GDK.GDK_3BUTTON_PRESS) return 0;
long /*int*/ window = gtk_widget_get_window (widget);
int [] origin_x = new int [1], origin_y = new int [1];
GDK.gdk_window_get_origin (window, origin_x, origin_y);
- startX = (int) (gdkEvent.x_root - origin_x [0]);
- startY = (int) (gdkEvent.y_root - origin_y [0]);
+ startX = (int) (eventRX[0] - origin_x [0]);
+ startY = (int) (eventRY[0] - origin_y [0]);
GtkAllocation allocation = new GtkAllocation ();
GTK.gtk_widget_get_allocation(handle, allocation);
int x = allocation.x;
@@ -176,19 +183,19 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ eventPtr)
int height = allocation.height;
lastX = x;
lastY = y;
- Event event = new Event ();
- event.time = gdkEvent.time;
+ Event jEvent = new Event ();
+ jEvent.time = eventTime;
Rectangle eventRect = new Rectangle (lastX, lastY, width, height);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ jEvent.setBounds (DPIUtil.autoScaleDown (eventRect));
if ((style & SWT.SMOOTH) == 0) {
- event.detail = SWT.DRAG;
+ jEvent.detail = SWT.DRAG;
}
- if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - event.x;
- sendSelectionEvent (SWT.Selection, event, true);
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - jEvent.x;
+ sendSelectionEvent (SWT.Selection, jEvent, true);
if (isDisposed ()) return 0;
- if (event.doit) {
+ if (jEvent.doit) {
dragging = true;
- Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
+ Rectangle rect = DPIUtil.autoScaleUp (jEvent.getBounds ());
lastX = rect.x;
lastY = rect.y;
if ((parent.style & SWT.MIRRORED) != 0) lastX = parent.getClientWidth () - width - lastX;
@@ -203,12 +210,13 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ eventPtr)
}
@Override
-long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ eventPtr) {
- long /*int*/ result = super.gtk_button_release_event (widget, eventPtr);
+long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event) {
+ long /*int*/ result = super.gtk_button_release_event (widget, event);
if (result != 0) return result;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, eventPtr, GdkEventButton.sizeof);
- int button = gdkEvent.button;
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ int eventTime = GDK.gdk_event_get_time(event);
+ int button = eventButton[0];
if (button != 1) return 0;
if (!dragging) return 0;
dragging = false;
@@ -216,17 +224,17 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ eventPt
GTK.gtk_widget_get_allocation (handle, allocation);
int width = allocation.width;
int height = allocation.height;
- Event event = new Event ();
- event.time = gdkEvent.time;
+ Event jEvent = new Event ();
+ jEvent.time = eventTime;
Rectangle eventRect = new Rectangle (lastX, lastY, width, height);
- event.setBounds (DPIUtil.autoScaleDown (eventRect));
+ jEvent.setBounds (DPIUtil.autoScaleDown (eventRect));
drawBand (lastX, lastY, width, height);
- if ((parent.style & SWT.MIRRORED) != 0) event.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - event.x;
- sendSelectionEvent (SWT.Selection, event, true);
+ if ((parent.style & SWT.MIRRORED) != 0) jEvent.x = DPIUtil.autoScaleDown (parent.getClientWidth () - width) - jEvent.x;
+ sendSelectionEvent (SWT.Selection, jEvent, true);
if (isDisposed ()) return result;
- if (event.doit) {
+ if (jEvent.doit) {
if ((style & SWT.SMOOTH) != 0) {
- Rectangle rect = DPIUtil.autoScaleUp (event.getBounds ());
+ Rectangle rect = DPIUtil.autoScaleUp (jEvent.getBounds ());
setBoundsInPixels (rect.x, rect.y, width, height);
// widget could be disposed at this point
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
index 76ffd0d193..6aea071f21 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ScrollBar.java
@@ -551,13 +551,12 @@ long /*int*/ gtk_value_changed (long /*int*/ adjustment) {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
- GdkEvent gtkEvent = new GdkEvent ();
- OS.memmove (gtkEvent, gdkEvent, GdkEvent.sizeof);
- switch (gtkEvent.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_RELEASE: {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 1 && detail == GTK.GTK_SCROLL_JUMP) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ if (eventButton[0] == 1 && detail == GTK.GTK_SCROLL_JUMP) {
if (!dragSent) {
Event event = new Event ();
event.detail = SWT.DRAG;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
index c4afe111f1..4a3a4ab497 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java
@@ -1359,11 +1359,14 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
if (OS.isX11() && (style & SWT.ON_TOP) != 0 && (style & SWT.NO_FOCUS) == 0) {
forceActive ();
}
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.button == 1) {
- display.resizeLocationX = gdkEvent.x_root;
- display.resizeLocationY = gdkEvent.y_root;
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ if (eventButton[0] == 1) {
+ display.resizeLocationX = eventRX[0];
+ display.resizeLocationY = eventRY[0];
int [] x = new int [1], y = new int [1];
GTK.gtk_window_get_position (shellHandle, x, y);
display.resizeBoundsX = x [0];
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
index 880b48a143..86f1742aa2 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Slider.java
@@ -223,13 +223,12 @@ long /*int*/ gtk_value_changed (long /*int*/ adjustment) {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
- GdkEvent gtkEvent = new GdkEvent ();
- OS.memmove (gtkEvent, gdkEvent, GdkEvent.sizeof);
- switch (gtkEvent.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_RELEASE: {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 1 && detail == SWT.DRAG) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ if (eventButton[0] == 1 && detail == SWT.DRAG) {
if (!dragSent) {
Event event = new Event ();
event.detail = SWT.DRAG;
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
index 3e34ab592e..b2a2abe18b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Spinner.java
@@ -611,7 +611,7 @@ long /*int*/ gtk_changed (long /*int*/ widget) {
keyPress = true;
break;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
if (keyPress) {
postEvent (SWT.Modify);
@@ -1225,7 +1225,7 @@ String verifyText (String string, int start, int end) {
setKeyState (event, gdkEvent);
break;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
int index = 0;
if (GTK.gtk_spin_button_get_digits (handle) > 0) {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
index 4bbbf7f1a9..03a1fcb889 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Table.java
@@ -1984,9 +1984,23 @@ public int getTopIndex () {
@Override
long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.window != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int eventType = GDK.gdk_event_get_event_type(event);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ long /*int*/ eventGdkResource = GTK.GTK4 ? GDK.gdk_event_get_surface(event) : GDK.gdk_event_get_window(event);
+ if (GTK.GTK4) {
+ if (eventGdkResource != gtk_widget_get_surface (handle)) return 0;
+ } else {
+ if (eventGdkResource != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ }
long /*int*/ result = super.gtk_button_press_event (widget, event);
if (result != 0) return result;
/*
@@ -1996,19 +2010,19 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* selected, we can give the DnD handling to MOTION-NOTIFY. Seee Bug 503431
*/
if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect) &&
- !OS.isX11() && gdkEvent.type == GDK.GDK_BUTTON_PRESS) { // Wayland
+ !OS.isX11() && eventType == GDK.GDK_BUTTON_PRESS) { // Wayland
// check to see if there is another event coming in that is not a double/triple click, this is to prevent Bug 514531
long /*int*/ nextEvent = GDK.gdk_event_peek ();
if (nextEvent == 0) {
long /*int*/ [] path = new long /*int*/ [1];
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null) &&
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null) &&
path[0] != 0) {
// selection count is used in the case of clicking an already selected item while holding Control
selectionCountOnPress = getSelectionCount();
if (GTK.gtk_tree_selection_path_is_selected (selection, path[0])) {
- if (((gdkEvent.state & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) ||
- ((gdkEvent.state & GDK.GDK_CONTROL_MASK) != 0)) {
+ if (((eventState[0] & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) ||
+ ((eventState[0] & GDK.GDK_CONTROL_MASK) != 0)) {
/**
* Disable selection on a mouse click if there are multiple items already selected. Also,
* if control is currently being held down, we will designate the selection logic over to release
@@ -2033,10 +2047,10 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* an unwanted selection event. The workaround is to detect that case and not
* run the default handler when the item is already part of the current selection.
*/
- int button = gdkEvent.button;
- if (button == 3 && gdkEvent.type == GDK.GDK_BUTTON_PRESS) {
+ int button = eventButton[0];
+ if (button == 3 && eventType == GDK.GDK_BUTTON_PRESS) {
long /*int*/ [] path = new long /*int*/ [1];
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null)) {
if (path [0] != 0) {
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
if (GTK.gtk_tree_selection_path_is_selected (selection, path [0])) result = 1;
@@ -2054,7 +2068,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
*/
if ((style & SWT.SINGLE) != 0 && getSelectionCount () == 0) {
long /*int*/ [] path = new long /*int*/ [1];
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null)) {
if (path [0] != 0) {
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
@@ -2072,7 +2086,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* that 'row-activated' signal comes before double-click event. This prevents
* opening of the current highlighted item when double clicking on any expander arrow.
*/
- if (gdkEvent.type == GDK.GDK_2BUTTON_PRESS && rowActivated) {
+ if (eventType == GDK.GDK_2BUTTON_PRESS && rowActivated) {
sendTreeDefaultSelection ();
rowActivated = false;
}
@@ -2138,13 +2152,26 @@ void sendTreeDefaultSelection() {
@Override
long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ long /*int*/ eventGdkResource = GTK.GTK4 ? GDK.gdk_event_get_surface(event) : GDK.gdk_event_get_window(event);
+ if (GTK.GTK4) {
+ if (eventGdkResource != gtk_widget_get_surface (handle)) return 0;
+ } else {
+ if (eventGdkResource != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ }
// Check region since super.gtk_button_release_event() isn't called
- lastInput.x = (int) gdkEvent.x;
- lastInput.y = (int) gdkEvent.y;
+ lastInput.x = (int) eventX[0];
+ lastInput.y = (int) eventY[0];
if (containedInRegion(lastInput.x, lastInput.y)) return 0;
- if (gdkEvent.window != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
/*
* Feature in GTK. In multi-select tree view there is a problem with using DnD operations while also selecting multiple items.
* When doing a DnD, GTK de-selects all other items except for the widget being dragged from. By disabling the selection function
@@ -2157,15 +2184,15 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event)
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
// free up the selection function on release.
GTK.gtk_tree_selection_set_select_function(selection,0,0,0);
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null) &&
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null) &&
path[0] != 0 && GTK.gtk_tree_selection_path_is_selected (selection, path[0])) {
selectionCountOnRelease = getSelectionCount();
- if ((gdkEvent.state & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) {
+ if ((eventState[0] & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) {
GTK.gtk_tree_view_set_cursor(handle, path[0], 0, false);
}
// Check to see if there has been a new tree item selected when holding Control in Path.
// If not, deselect the item.
- if ((gdkEvent.state & GDK.GDK_CONTROL_MASK) != 0 && selectionCountOnRelease == selectionCountOnPress) {
+ if ((eventState[0] & GDK.GDK_CONTROL_MASK) != 0 && selectionCountOnRelease == selectionCountOnPress) {
GTK.gtk_tree_selection_unselect_path (selection,path[0]);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
index e05dd7d720..da4add2fad 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TableColumn.java
@@ -349,21 +349,22 @@ long /*int*/ gtk_clicked (long /*int*/ widget) {
boolean postEvent = true;
long /*int*/ eventPtr = GTK.gtk_get_current_event ();
if (eventPtr != 0) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, eventPtr, GdkEventButton.sizeof);
- GDK.gdk_event_free (eventPtr);
- switch (gdkEvent.type) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(eventPtr, eventButton);
+ int eventType = GDK.gdk_event_get_event_type(eventPtr);
+ int eventTime = GDK.gdk_event_get_time(eventPtr);
+ switch (eventType) {
case GDK.GDK_BUTTON_RELEASE: {
int clickTime = display.getDoubleClickTime ();
- int eventTime = gdkEvent.time, eventButton = gdkEvent.button;
- if (lastButton == eventButton && lastTime != 0 && Math.abs (lastTime - eventTime) <= clickTime) {
+ if (lastButton == eventButton[0] && lastTime != 0 && Math.abs (lastTime - eventTime) <= clickTime) {
doubleClick = true;
}
lastTime = eventTime == 0 ? 1: eventTime;
- lastButton = eventButton;
+ lastButton = eventButton[0];
break;
}
}
+ gdk_event_free (eventPtr);
}
if (postEvent) sendSelectionEvent (doubleClick ? SWT.DefaultSelection : SWT.Selection);
return 0;
@@ -371,14 +372,16 @@ long /*int*/ gtk_clicked (long /*int*/ widget) {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_PRESS: {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 3) {
- parent.showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ if (eventButton[0] == 3) {
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(gdkEvent, eventRX, eventRY);
+ parent.showMenu ((int) eventRX[0], (int) eventRY[0]);
}
break;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
index e6a2586b4e..b5120e546d 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Text.java
@@ -1454,10 +1454,9 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
long /*int*/ result;
result = super.gtk_button_press_event (widget, event);
if (result != 0) return result;
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+ int eventType = GDK.gdk_event_get_event_type(event);
if (!doubleClick) {
- switch (gdkEvent.type) {
+ switch (eventType) {
case GDK.GDK_2BUTTON_PRESS:
case GDK.GDK_3BUTTON_PRESS:
return 1;
@@ -1485,7 +1484,7 @@ long /*int*/ gtk_changed (long /*int*/ widget) {
keyPress = true;
break;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
if (keyPress) {
postEvent (SWT.Modify);
@@ -1635,13 +1634,18 @@ long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
* use the correct value.
*/
if ((style & SWT.SINGLE) != 0 && display.entrySelectOnFocus) {
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_FOCUS_CHANGE:
- GdkEventFocus gdkEventFocus = new GdkEventFocus ();
- OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
- if (gdkEventFocus.in == 0) {
+ boolean [] focusIn = new boolean [1];
+ if (GTK.GTK4) {
+ GDK.gdk_event_get_focus_in(gdkEvent, focusIn);
+ } else {
+ GdkEventFocus gdkEventFocus = new GdkEventFocus ();
+ OS.memmove (gdkEventFocus, gdkEvent, GdkEventFocus.sizeof);
+ focusIn[0] = gdkEventFocus.in != 0;
+ }
+ if (focusIn[0]) {
long /*int*/ settings = GTK.gtk_settings_get_default ();
OS.g_object_set (settings, GTK.gtk_entry_select_on_focus, true, 0);
}
@@ -2820,7 +2824,7 @@ String verifyText (String string, int start, int end) {
setKeyState (event, gdkEvent);
break;
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
/*
* It is possible (but unlikely), that application
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
index eea60be5a3..e56237571c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/ToolItem.java
@@ -470,6 +470,8 @@ int getWidthInPixels () {
@Override
long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
+ // TODO_GTK4: this method needs to be converted to use GTK4 GdkEvent API
+ // as all the event structs are sealed now.
GdkEventButton gdkEvent = new GdkEventButton ();
OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
GtkAllocation allocation = new GtkAllocation ();
@@ -486,6 +488,8 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
@Override
long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event) {
+ // TODO_GTK4: this method needs to be converted to use GTK4 GdkEvent API
+ // as all the event structs are sealed now.
GdkEventButton gdkEvent = new GdkEventButton ();
OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
GtkAllocation allocation = new GtkAllocation ();
@@ -506,10 +510,9 @@ long /*int*/ gtk_clicked (long /*int*/ widget) {
if ((style & SWT.DROP_DOWN) != 0) {
long /*int*/ eventPtr = GTK.gtk_get_current_event ();
if (eventPtr != 0) {
- GdkEvent gdkEvent = new GdkEvent ();
- OS.memmove (gdkEvent, eventPtr, GdkEvent.sizeof);
+ int eventType = GDK.gdk_event_get_event_type(eventPtr);
long /*int*/ topHandle = topHandle();
- switch (gdkEvent.type) {
+ switch (eventType) {
case GDK.GDK_KEY_RELEASE: //Fall Through..
case GDK.GDK_BUTTON_PRESS:
case GDK.GDK_2BUTTON_PRESS:
@@ -537,7 +540,7 @@ long /*int*/ gtk_clicked (long /*int*/ widget) {
break;
}
}
- GDK.gdk_event_free (eventPtr);
+ gdk_event_free (eventPtr);
}
}
if ((style & SWT.RADIO) != 0) {
@@ -662,14 +665,16 @@ long /*int*/ gtk_enter_notify_event (long /*int*/ widget, long /*int*/ event) {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_PRESS: {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 3) {
- parent.showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ if (eventButton[0] == 3) {
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(gdkEvent, eventRX, eventRY);
+ parent.showMenu ((int) eventRX[0], (int) eventRY[0]);
}
break;
}
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 aa5bad2424..86225614de 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
@@ -894,10 +894,9 @@ private void setTrackerBackground(boolean opaque) {
}
boolean processEvent (long /*int*/ eventPtr) {
- GdkEvent gdkEvent = new GdkEvent();
- OS.memmove (gdkEvent, eventPtr, GdkEvent.sizeof);
+ int eventType = GDK.gdk_event_get_event_type(eventPtr);
long /*int*/ widget = GTK.gtk_get_event_widget (eventPtr);
- switch (gdkEvent.type) {
+ switch (eventType) {
case GDK.GDK_MOTION_NOTIFY: gtk_motion_notify_event (widget, eventPtr); break;
case GDK.GDK_BUTTON_RELEASE: gtk_button_release_event (widget, eventPtr); break;
case GDK.GDK_KEY_PRESS: gtk_key_press_event (widget, eventPtr); break;
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 38f6f6ac1f..0e49decdae 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
@@ -261,7 +261,7 @@ long /*int*/ gtk_activate (long /*int*/ widget) {
int currEventType = 0;
if (currEvent != 0) {
currEventType = GDK.GDK_EVENT_TYPE (currEvent);
- GDK.gdk_event_free (currEvent);
+ gdk_event_free(currEvent);
}
GDK.gdk_event_free (nextEvent);
if (currEventType == GDK.GDK_BUTTON_PRESS && nextEventType == GDK.GDK_2BUTTON_PRESS) {
@@ -272,15 +272,16 @@ long /*int*/ gtk_activate (long /*int*/ widget) {
}
@Override
-long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ eventPtr) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, eventPtr, GdkEventButton.sizeof);
- if (gdkEvent.type == GDK.GDK_3BUTTON_PRESS) return 0;
- if (gdkEvent.button == 3 && gdkEvent.type == GDK.GDK_BUTTON_PRESS) {
+long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
+ int eventType = GDK.gdk_event_get_event_type(event);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ if (eventType == GDK.GDK_3BUTTON_PRESS) return 0;
+ if (eventButton[0] == 3 && eventType == GDK.GDK_BUTTON_PRESS) {
sendEvent (SWT.MenuDetect);
return 0;
}
- if (gdkEvent.type == GDK.GDK_2BUTTON_PRESS) {
+ if (eventType == GDK.GDK_2BUTTON_PRESS) {
sendSelectionEvent (SWT.DefaultSelection);
} else {
sendSelectionEvent (SWT.Selection);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
index dc3483db2a..8c5ecbe69c 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Tree.java
@@ -2050,9 +2050,23 @@ TreeItem _getCachedTopItem() {
@Override
long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
- if (gdkEvent.window != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int eventType = GDK.gdk_event_get_event_type(event);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ long /*int*/ eventGdkResource = GTK.GTK4 ? GDK.gdk_event_get_surface(event) : GDK.gdk_event_get_window(event);
+ if (GTK.GTK4) {
+ if (eventGdkResource != gtk_widget_get_surface (handle)) return 0;
+ } else {
+ if (eventGdkResource != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ }
long /*int*/ result = super.gtk_button_press_event (widget, event);
if (result != 0) return result;
/*
@@ -2062,19 +2076,19 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* selected, we can give the DnD handling to MOTION-NOTIFY. Seee Bug 503431
*/
if ((state & DRAG_DETECT) != 0 && hooks (SWT.DragDetect) &&
- !OS.isX11() && gdkEvent.type == GDK.GDK_BUTTON_PRESS) { // Wayland
+ !OS.isX11() && eventType == GDK.GDK_BUTTON_PRESS) { // Wayland
// check to see if there is another event coming in that is not a double/triple click, this is to prevent Bug 514531
long /*int*/ nextEvent = GDK.gdk_event_peek ();
if (nextEvent == 0) {
long /*int*/ [] path = new long /*int*/ [1];
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null) &&
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null) &&
path[0] != 0) {
// selection count is used in the case of clicking an already selected item while holding Control
selectionCountOnPress = getSelectionCount();
if (GTK.gtk_tree_selection_path_is_selected (selection, path[0])) {
- if (((gdkEvent.state & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) ||
- ((gdkEvent.state & GDK.GDK_CONTROL_MASK) != 0)) {
+ if (((eventState[0] & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) ||
+ ((eventState[0] & GDK.GDK_CONTROL_MASK) != 0)) {
/**
* Disable selection on a mouse click if there are multiple items already selected. Also,
* if control is currently being held down, we will designate the selection logic over to release
@@ -2099,10 +2113,10 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* an unwanted selection event. The workaround is to detect that case and not
* run the default handler when the item is already part of the current selection.
*/
- int button = gdkEvent.button;
- if (button == 3 && gdkEvent.type == GDK.GDK_BUTTON_PRESS) {
+ int button = eventButton[0];
+ if (button == 3 && eventType == GDK.GDK_BUTTON_PRESS) {
long /*int*/ [] path = new long /*int*/ [1];
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null)) {
if (path [0] != 0) {
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
if (GTK.gtk_tree_selection_path_is_selected (selection, path [0])) result = 1;
@@ -2120,7 +2134,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
*/
if ((style & SWT.SINGLE) != 0 && getSelectionCount () == 0) {
long /*int*/ [] path = new long /*int*/ [1];
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null)) {
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null)) {
if (path [0] != 0) {
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
OS.g_signal_handlers_block_matched (selection, OS.G_SIGNAL_MATCH_DATA, 0, 0, 0, 0, CHANGED);
@@ -2138,7 +2152,7 @@ long /*int*/ gtk_button_press_event (long /*int*/ widget, long /*int*/ event) {
* that 'row-activated' signal comes before double-click event. This prevents
* opening of the current highlighted item when double clicking on any expander arrow.
*/
- if (gdkEvent.type == GDK.GDK_2BUTTON_PRESS && rowActivated) {
+ if (eventType == GDK.GDK_2BUTTON_PRESS && rowActivated) {
sendTreeDefaultSelection ();
rowActivated = false;
}
@@ -2202,13 +2216,26 @@ void sendTreeDefaultSelection() {
@Override
long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, event, GdkEventButton.sizeof);
+ double [] eventX = new double [1];
+ double [] eventY = new double [1];
+ GDK.gdk_event_get_coords(event, eventX, eventY);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(event, eventButton);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(event, eventRX, eventRY);
+ int [] eventState = new int [1];
+ GDK.gdk_event_get_state(event, eventState);
+ long /*int*/ eventGdkResource = GTK.GTK4 ? GDK.gdk_event_get_surface(event) : GDK.gdk_event_get_window(event);
+ if (GTK.GTK4) {
+ if (eventGdkResource != gtk_widget_get_surface (handle)) return 0;
+ } else {
+ if (eventGdkResource != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
+ }
// Check region since super.gtk_button_release_event() isn't called
- lastInput.x = (int) gdkEvent.x;
- lastInput.y = (int) gdkEvent.y;
+ lastInput.x = (int) eventX[0];
+ lastInput.y = (int) eventY[0];
if (containedInRegion(lastInput.x, lastInput.y)) return 0;
- if (gdkEvent.window != GTK.gtk_tree_view_get_bin_window (handle)) return 0;
/*
* Feature in GTK. In multi-select tree view there is a problem with using DnD operations while also selecting multiple items.
* When doing a DnD, GTK de-selects all other items except for the widget being dragged from. By disabling the selection function
@@ -2221,15 +2248,15 @@ long /*int*/ gtk_button_release_event (long /*int*/ widget, long /*int*/ event)
long /*int*/ selection = GTK.gtk_tree_view_get_selection (handle);
// free up the selection function on release.
GTK.gtk_tree_selection_set_select_function(selection,0,0,0);
- if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)gdkEvent.x, (int)gdkEvent.y, path, null, null, null) &&
+ if (GTK.gtk_tree_view_get_path_at_pos (handle, (int)eventX[0], (int)eventY[0], path, null, null, null) &&
path[0] != 0 && GTK.gtk_tree_selection_path_is_selected (selection, path[0])) {
selectionCountOnRelease = getSelectionCount();
- if ((gdkEvent.state & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) {
+ if ((eventState[0] & (GDK.GDK_CONTROL_MASK|GDK.GDK_SHIFT_MASK)) == 0) {
GTK.gtk_tree_view_set_cursor(handle, path[0], 0, false);
}
// Check to see if there has been a new tree item selected when holding Control in Path.
// If not, deselect the item.
- if ((gdkEvent.state & GDK.GDK_CONTROL_MASK) != 0 && selectionCountOnRelease == selectionCountOnPress) {
+ if ((eventState[0] & GDK.GDK_CONTROL_MASK) != 0 && selectionCountOnRelease == selectionCountOnPress) {
GTK.gtk_tree_selection_unselect_path (selection,path[0]);
}
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
index c1fb6879fa..3f82e32523 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/TreeColumn.java
@@ -351,21 +351,22 @@ long /*int*/ gtk_clicked (long /*int*/ widget) {
boolean postEvent = true;
long /*int*/ eventPtr = GTK.gtk_get_current_event ();
if (eventPtr != 0) {
- GdkEventButton gdkEvent = new GdkEventButton ();
- OS.memmove (gdkEvent, eventPtr, GdkEventButton.sizeof);
- GDK.gdk_event_free (eventPtr);
- switch (gdkEvent.type) {
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(eventPtr, eventButton);
+ int eventType = GDK.gdk_event_get_event_type(eventPtr);
+ int eventTime = GDK.gdk_event_get_time(eventPtr);
+ switch (eventType) {
case GDK.GDK_BUTTON_RELEASE: {
int clickTime = display.getDoubleClickTime ();
- int eventTime = gdkEvent.time, eventButton = gdkEvent.button;
- if (lastButton == eventButton && lastTime != 0 && Math.abs (lastTime - eventTime) <= clickTime) {
+ if (lastButton == eventButton[0] && lastTime != 0 && Math.abs (lastTime - eventTime) <= clickTime) {
doubleClick = true;
}
lastTime = eventTime == 0 ? 1: eventTime;
- lastButton = eventButton;
+ lastButton = eventButton[0];
break;
}
}
+ gdk_event_free (eventPtr);
}
if (postEvent) sendSelectionEvent (doubleClick ? SWT.DefaultSelection : SWT.Selection);
return 0;
@@ -373,14 +374,16 @@ long /*int*/ gtk_clicked (long /*int*/ widget) {
@Override
long /*int*/ gtk_event_after (long /*int*/ widget, long /*int*/ gdkEvent) {
- GdkEvent event = new GdkEvent ();
- OS.memmove (event, gdkEvent, GdkEvent.sizeof);
- switch (event.type) {
+ int eventType = GDK.gdk_event_get_event_type(gdkEvent);
+ switch (eventType) {
case GDK.GDK_BUTTON_PRESS: {
- GdkEventButton gdkEventButton = new GdkEventButton ();
- OS.memmove (gdkEventButton, gdkEvent, GdkEventButton.sizeof);
- if (gdkEventButton.button == 3) {
- parent.showMenu ((int) gdkEventButton.x_root, (int) gdkEventButton.y_root);
+ int [] eventButton = new int [1];
+ GDK.gdk_event_get_button(gdkEvent, eventButton);
+ double [] eventRX = new double [1];
+ double [] eventRY = new double [1];
+ GDK.gdk_event_get_root_coords(gdkEvent, eventRX, eventRY);
+ if (eventButton[0] == 3) {
+ parent.showMenu ((int) eventRX[0], (int) eventRY[0]);
}
break;
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
index 535fdaf9b1..16c7246922 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java
@@ -1498,7 +1498,7 @@ char [] sendIMKeyEvent (int type, GdkEventKey keyEvent, char [] chars) {
* the key by returning null.
*/
if (isDisposed ()) {
- if (ptr != 0) GDK.gdk_event_free (ptr);
+ if (ptr != 0) gdk_event_free (ptr);
return null;
}
if (event.doit) chars [count++] = chars [index];
@@ -1525,9 +1525,8 @@ void sendSelectionEvent (int eventType, Event event, boolean send) {
if (event == null) event = new Event ();
long /*int*/ ptr = GTK.gtk_get_current_event ();
if (ptr != 0) {
- GdkEvent gdkEvent = new GdkEvent ();
- OS.memmove (gdkEvent, ptr, GdkEvent.sizeof);
- switch (gdkEvent.type) {
+ int currentEventType = GDK.gdk_event_get_event_type(ptr);
+ switch (currentEventType) {
case GDK.GDK_KEY_PRESS:
case GDK.GDK_KEY_RELEASE:
case GDK.GDK_BUTTON_PRESS:
@@ -1539,7 +1538,7 @@ void sendSelectionEvent (int eventType, Event event, boolean send) {
break;
}
}
- GDK.gdk_event_free (ptr);
+ gdk_event_free (ptr);
}
sendEvent (eventType, event, send);
}
@@ -1864,6 +1863,19 @@ void gdk_surface_get_size (long /*int*/ surface, int[] width, int[] height) {
height[0] = GDK.gdk_surface_get_height (surface);
}
+/**
+ * GTK4 does not hand out copies of events anymore, only references.
+ * Call gdk_event_free() on GTK3 and g_object_unref() on GTK4.
+ *
+ * @param event the event to be freed
+ */
+void gdk_event_free (long /*int*/ event) {
+ if (GTK.GTK4) {
+ OS.g_object_unref(event);
+ } else {
+ GDK.gdk_event_free(event);
+ }
+}
/**
* Wrapper function for gdk_event_get_state()

Back to the top