Bug 565064 - [GTK4] Adapt to GdkWindow API changes
GdkWindow has been changed to GdkSurface and creating children directly
is no longer possible but instead broken into toplevel & popups. Many
functions have been removed altogether and still require replacements. I
have added TODOs in place for now as the goal is to compile SWT in GTK4
then move on to making it work.
Added:
gdk_toplevel_focus to replace gdk_surface_focus/gdk_window_focus
gdk_surface_new_toplevel to replace gdk_surface_new_child
gdk_toplevel_present to replace gdk_surface_raise
gdk_toplevel_get_state
gdk_toplevel_lower
gdk_popup_get_parent to replace the need to set/get use surface
user_data
gdk_popup_present
gdk_popup_layout_new
Removed:
gdk_surface_get_frame_extent
gdk_surface_get_children
gdk_surface_get_root_origin
gdk_surface_invalidate_region
gdk_surface_move
gdk_surface_move_resize
gdk_surface_resize
gdk_surface_restack
gdk_surface_set_decorations
gdk_surface_set_functions
gdk_surface_show
gdk_surface_show_unraised
Renamed:
GDK_SURFACE_STATE_ICONIFIED -> GDK_SURFACE_STATE_MINIMIZED
Change-Id: I0ea9fb4b52a4f1e3a8171805e4620b20005f9b8e
Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
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 3f80da9..c543708 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
@@ -458,18 +458,18 @@
#ifndef NO_gdk_1device_1get_1surface_1at_1position
JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1device_1get_1surface_1at_1position)
- (JNIEnv *env, jclass that, jlong arg0, jintArray arg1, jintArray arg2)
+ (JNIEnv *env, jclass that, jlong arg0, jdoubleArray arg1, jdoubleArray arg2)
{
- jint *lparg1=NULL;
- jint *lparg2=NULL;
+ jdouble *lparg1=NULL;
+ jdouble *lparg2=NULL;
jlong rc = 0;
GDK_NATIVE_ENTER(env, that, gdk_1device_1get_1surface_1at_1position_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- rc = (jlong)gdk_device_get_surface_at_position((GdkDevice *)arg0, (gint *)lparg1, (gint *)lparg2);
+ 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 = (jlong)gdk_device_get_surface_at_position((GdkDevice *)arg0, lparg1, lparg2);
fail:
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
+ if (arg1 && lparg1) (*env)->ReleaseDoubleArrayElements(env, arg1, lparg1, 0);
GDK_NATIVE_EXIT(env, that, gdk_1device_1get_1surface_1at_1position_FUNC);
return rc;
}
@@ -1808,6 +1808,46 @@
}
#endif
+#ifndef NO_gdk_1popup_1get_1parent
+JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1popup_1get_1parent)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1popup_1get_1parent_FUNC);
+ rc = (jlong)gdk_popup_get_parent((GdkPopup *)arg0);
+ GDK_NATIVE_EXIT(env, that, gdk_1popup_1get_1parent_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_gdk_1popup_1layout_1new
+JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1popup_1layout_1new)
+ (JNIEnv *env, jclass that, jobject arg0, jint arg1, jint arg2)
+{
+ GdkRectangle _arg0, *lparg0=NULL;
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1popup_1layout_1new_FUNC);
+ if (arg0) if ((lparg0 = getGdkRectangleFields(env, arg0, &_arg0)) == NULL) goto fail;
+ rc = (jlong)gdk_popup_layout_new((const GdkRectangle *)lparg0, (GdkGravity)arg1, (GdkGravity)arg2);
+fail:
+ if (arg0 && lparg0) setGdkRectangleFields(env, arg0, lparg0);
+ GDK_NATIVE_EXIT(env, that, gdk_1popup_1layout_1new_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_gdk_1popup_1present
+JNIEXPORT jboolean JNICALL GDK_NATIVE(gdk_1popup_1present)
+ (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jlong arg3)
+{
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1popup_1present_FUNC);
+ rc = (jboolean)gdk_popup_present((GdkPopup *)arg0, arg1, arg2, (GdkPopupLayout *)arg3);
+ GDK_NATIVE_EXIT(env, that, gdk_1popup_1present_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_gdk_1property_1get
JNIEXPORT jboolean JNICALL GDK_NATIVE(gdk_1property_1get)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jlong arg2, jlong arg3, jlong arg4, jint arg5, jlongArray arg6, jintArray arg7, jintArray arg8, jlongArray arg9)
@@ -2252,47 +2292,23 @@
}
#endif
-#ifndef NO_gdk_1surface_1focus
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1focus)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1focus_FUNC);
- gdk_surface_focus((GdkSurface *)arg0, arg1);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1focus_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1get_1children
-JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1surface_1get_1children)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- jlong rc = 0;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1get_1children_FUNC);
- rc = (jlong)gdk_surface_get_children((GdkSurface *)arg0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1get_1children_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_gdk_1surface_1get_1device_1position
-JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1surface_1get_1device_1position)
- (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jintArray arg2, jintArray arg3, jintArray arg4)
+JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1get_1device_1position)
+ (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jdoubleArray arg2, jdoubleArray arg3, jintArray arg4)
{
- jint *lparg2=NULL;
- jint *lparg3=NULL;
+ jdouble *lparg2=NULL;
+ jdouble *lparg3=NULL;
jint *lparg4=NULL;
- jlong rc = 0;
GDK_NATIVE_ENTER(env, that, gdk_1surface_1get_1device_1position_FUNC);
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- if (arg3) if ((lparg3 = (*env)->GetIntArrayElements(env, arg3, NULL)) == NULL) goto fail;
+ if (arg2) if ((lparg2 = (*env)->GetDoubleArrayElements(env, arg2, NULL)) == NULL) goto fail;
+ if (arg3) if ((lparg3 = (*env)->GetDoubleArrayElements(env, arg3, NULL)) == NULL) goto fail;
if (arg4) if ((lparg4 = (*env)->GetIntArrayElements(env, arg4, NULL)) == NULL) goto fail;
- rc = (jlong)gdk_surface_get_device_position((GdkSurface *)arg0, (GdkDevice *)arg1, (gint *)lparg2, (gint *)lparg3, (GdkModifierType *)lparg4);
+ gdk_surface_get_device_position((GdkSurface *)arg0, (GdkDevice *)arg1, (double *)lparg2, (double *)lparg3, (GdkModifierType *)lparg4);
fail:
if (arg4 && lparg4) (*env)->ReleaseIntArrayElements(env, arg4, lparg4, 0);
- if (arg3 && lparg3) (*env)->ReleaseIntArrayElements(env, arg3, lparg3, 0);
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
+ if (arg3 && lparg3) (*env)->ReleaseDoubleArrayElements(env, arg3, lparg3, 0);
+ if (arg2 && lparg2) (*env)->ReleaseDoubleArrayElements(env, arg2, lparg2, 0);
GDK_NATIVE_EXIT(env, that, gdk_1surface_1get_1device_1position_FUNC);
- return rc;
}
#endif
@@ -2308,20 +2324,6 @@
}
#endif
-#ifndef NO_gdk_1surface_1get_1frame_1extents
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1get_1frame_1extents)
- (JNIEnv *env, jclass that, jlong arg0, jobject arg1)
-{
- GdkRectangle _arg1, *lparg1=NULL;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1get_1frame_1extents_FUNC);
- if (arg1) if ((lparg1 = &_arg1) == NULL) goto fail;
- gdk_surface_get_frame_extents((GdkSurface *)arg0, (GdkRectangle *)lparg1);
-fail:
- if (arg1 && lparg1) setGdkRectangleFields(env, arg1, lparg1);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1get_1frame_1extents_FUNC);
-}
-#endif
-
#ifndef NO_gdk_1surface_1get_1height
JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1surface_1get_1height)
(JNIEnv *env, jclass that, jlong arg0)
@@ -2353,49 +2355,6 @@
}
#endif
-#ifndef NO_gdk_1surface_1get_1root_1origin
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1get_1root_1origin)
- (JNIEnv *env, jclass that, jlong arg0, jintArray arg1, jintArray arg2)
-{
- jint *lparg1=NULL;
- jint *lparg2=NULL;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1get_1root_1origin_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetIntArrayElements(env, arg1, NULL)) == NULL) goto fail;
- if (arg2) if ((lparg2 = (*env)->GetIntArrayElements(env, arg2, NULL)) == NULL) goto fail;
- gdk_surface_get_root_origin((GdkSurface *)arg0, (gint *)lparg1, (gint *)lparg2);
-fail:
- if (arg2 && lparg2) (*env)->ReleaseIntArrayElements(env, arg2, lparg2, 0);
- if (arg1 && lparg1) (*env)->ReleaseIntArrayElements(env, arg1, lparg1, 0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1get_1root_1origin_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1get_1state
-JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1surface_1get_1state)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- jint rc = 0;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1get_1state_FUNC);
- rc = (jint)gdk_surface_get_state((GdkSurface *)arg0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1get_1state_FUNC);
- return rc;
-}
-#endif
-
-#ifndef NO_gdk_1surface_1get_1user_1data
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1get_1user_1data)
- (JNIEnv *env, jclass that, jlong arg0, jlongArray arg1)
-{
- jlong *lparg1=NULL;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1get_1user_1data_FUNC);
- if (arg1) if ((lparg1 = (*env)->GetLongArrayElements(env, arg1, NULL)) == NULL) goto fail;
- gdk_surface_get_user_data((GdkSurface *)arg0, (gpointer *)lparg1);
-fail:
- if (arg1 && lparg1) (*env)->ReleaseLongArrayElements(env, arg1, lparg1, 0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1get_1user_1data_FUNC);
-}
-#endif
-
#ifndef NO_gdk_1surface_1get_1width
JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1surface_1get_1width)
(JNIEnv *env, jclass that, jlong arg0)
@@ -2418,101 +2377,27 @@
}
#endif
-#ifndef NO_gdk_1surface_1invalidate_1rect
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1invalidate_1rect)
- (JNIEnv *env, jclass that, jlong arg0, jobject arg1)
+#ifndef NO_gdk_1surface_1new_1popup
+JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1surface_1new_1popup)
+ (JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
{
- GdkRectangle _arg1, *lparg1=NULL;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1invalidate_1rect_FUNC);
- if (arg1) if ((lparg1 = getGdkRectangleFields(env, arg1, &_arg1)) == NULL) goto fail;
- gdk_surface_invalidate_rect((GdkSurface *)arg0, (GdkRectangle *)lparg1);
-fail:
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1invalidate_1rect_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1invalidate_1region
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1invalidate_1region)
- (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1invalidate_1region_FUNC);
- gdk_surface_invalidate_region((GdkSurface *)arg0, (const cairo_region_t *)arg1);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1invalidate_1region_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1lower
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1lower)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1lower_FUNC);
- gdk_surface_lower((GdkSurface *)arg0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1lower_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1move
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1move)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1move_FUNC);
- gdk_surface_move((GdkSurface *)arg0, arg1, arg2);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1move_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1move_1resize
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1move_1resize)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jint arg3, jint arg4)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1move_1resize_FUNC);
- gdk_surface_move_resize((GdkSurface *)arg0, arg1, arg2, arg3, arg4);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1move_1resize_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1new_1child
-JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1surface_1new_1child)
- (JNIEnv *env, jclass that, jlong arg0, jobject arg1)
-{
- GdkRectangle _arg1, *lparg1=NULL;
jlong rc = 0;
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1new_1child_FUNC);
- if (arg1) if ((lparg1 = getGdkRectangleFields(env, arg1, &_arg1)) == NULL) goto fail;
- rc = (jlong)gdk_surface_new_child((GdkSurface *)arg0, lparg1);
-fail:
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1new_1child_FUNC);
+ GDK_NATIVE_ENTER(env, that, gdk_1surface_1new_1popup_FUNC);
+ rc = (jlong)gdk_surface_new_popup((GdkSurface *)arg0, arg1);
+ GDK_NATIVE_EXIT(env, that, gdk_1surface_1new_1popup_FUNC);
return rc;
}
#endif
-#ifndef NO_gdk_1surface_1raise
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1raise)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1raise_FUNC);
- gdk_surface_raise((GdkSurface *)arg0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1raise_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1resize
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1resize)
+#ifndef NO_gdk_1surface_1new_1toplevel
+JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1surface_1new_1toplevel)
(JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2)
{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1resize_FUNC);
- gdk_surface_resize((GdkSurface *)arg0, arg1, arg2);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1resize_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1restack
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1restack)
- (JNIEnv *env, jclass that, jlong arg0, jlong arg1, jboolean arg2)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1restack_FUNC);
- gdk_surface_restack((GdkSurface *)arg0, (GdkSurface *)arg1, (gboolean)arg2);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1restack_FUNC);
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1surface_1new_1toplevel_FUNC);
+ rc = (jlong)gdk_surface_new_toplevel((GdkDisplay *)arg0, arg1, arg2);
+ GDK_NATIVE_EXIT(env, that, gdk_1surface_1new_1toplevel_FUNC);
+ return rc;
}
#endif
@@ -2526,56 +2411,6 @@
}
#endif
-#ifndef NO_gdk_1surface_1set_1decorations
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1set_1decorations)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1set_1decorations_FUNC);
- gdk_surface_set_decorations((GdkSurface *)arg0, (GdkWMDecoration)arg1);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1set_1decorations_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1set_1functions
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1set_1functions)
- (JNIEnv *env, jclass that, jlong arg0, jint arg1)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1set_1functions_FUNC);
- gdk_surface_set_functions((GdkSurface *)arg0, (GdkWMFunction)arg1);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1set_1functions_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1set_1user_1data
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1set_1user_1data)
- (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1set_1user_1data_FUNC);
- gdk_surface_set_user_data((GdkSurface *)arg0, (gpointer)arg1);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1set_1user_1data_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1show
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1show)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1show_FUNC);
- gdk_surface_show((GdkSurface *)arg0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1show_FUNC);
-}
-#endif
-
-#ifndef NO_gdk_1surface_1show_1unraised
-JNIEXPORT void JNICALL GDK_NATIVE(gdk_1surface_1show_1unraised)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- GDK_NATIVE_ENTER(env, that, gdk_1surface_1show_1unraised_FUNC);
- gdk_surface_show_unraised((GdkSurface *)arg0);
- GDK_NATIVE_EXIT(env, that, gdk_1surface_1show_1unraised_FUNC);
-}
-#endif
-
#ifndef NO_gdk_1text_1property_1to_1utf8_1list_1for_1display
JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1text_1property_1to_1utf8_1list_1for_1display)
(JNIEnv *env, jclass that, jlong arg0, jlong arg1, jint arg2, jlong arg3, jint arg4, jlongArray arg5)
@@ -2614,6 +2449,80 @@
}
#endif
+#ifndef NO_gdk_1toplevel_1focus
+JNIEXPORT void JNICALL GDK_NATIVE(gdk_1toplevel_1focus)
+ (JNIEnv *env, jclass that, jlong arg0, jint arg1)
+{
+ GDK_NATIVE_ENTER(env, that, gdk_1toplevel_1focus_FUNC);
+ gdk_toplevel_focus((GdkToplevel *)arg0, arg1);
+ GDK_NATIVE_EXIT(env, that, gdk_1toplevel_1focus_FUNC);
+}
+#endif
+
+#ifndef NO_gdk_1toplevel_1get_1state
+JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1toplevel_1get_1state)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jint rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1toplevel_1get_1state_FUNC);
+ rc = (jint)gdk_toplevel_get_state((GdkToplevel *)arg0);
+ GDK_NATIVE_EXIT(env, that, gdk_1toplevel_1get_1state_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_gdk_1toplevel_1layout_1new
+JNIEXPORT jlong JNICALL GDK_NATIVE(gdk_1toplevel_1layout_1new)
+ (JNIEnv *env, jclass that, jint arg0, jint arg1)
+{
+ jlong rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1toplevel_1layout_1new_FUNC);
+/*
+ rc = (jlong)gdk_toplevel_layout_new(arg0, arg1);
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_toplevel_layout_new)
+ if (fp) {
+ rc = (jlong)((jlong (CALLING_CONVENTION*)(jint, jint))fp)(arg0, arg1);
+ }
+ }
+ GDK_NATIVE_EXIT(env, that, gdk_1toplevel_1layout_1new_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_gdk_1toplevel_1lower
+JNIEXPORT jboolean JNICALL GDK_NATIVE(gdk_1toplevel_1lower)
+ (JNIEnv *env, jclass that, jlong arg0)
+{
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1toplevel_1lower_FUNC);
+ rc = (jboolean)gdk_toplevel_lower((GdkToplevel *)arg0);
+ GDK_NATIVE_EXIT(env, that, gdk_1toplevel_1lower_FUNC);
+ return rc;
+}
+#endif
+
+#ifndef NO_gdk_1toplevel_1present
+JNIEXPORT jboolean JNICALL GDK_NATIVE(gdk_1toplevel_1present)
+ (JNIEnv *env, jclass that, jlong arg0, jint arg1, jint arg2, jlong arg3)
+{
+ jboolean rc = 0;
+ GDK_NATIVE_ENTER(env, that, gdk_1toplevel_1present_FUNC);
+/*
+ rc = (jboolean)gdk_toplevel_present((GdkToplevel *)arg0, arg1, arg2, (GdkToplevelLayout *)arg3);
+*/
+ {
+ GDK_LOAD_FUNCTION(fp, gdk_toplevel_present)
+ if (fp) {
+ rc = (jboolean)((jboolean (CALLING_CONVENTION*)(GdkToplevel *, jint, jint, GdkToplevelLayout *))fp)((GdkToplevel *)arg0, arg1, arg2, (GdkToplevelLayout *)arg3);
+ }
+ }
+ GDK_NATIVE_EXIT(env, that, gdk_1toplevel_1present_FUNC);
+ return rc;
+}
+#endif
+
#ifndef NO_gdk_1unicode_1to_1keyval
JNIEXPORT jint JNICALL GDK_NATIVE(gdk_1unicode_1to_1keyval)
(JNIEnv *env, jclass that, jint arg0)
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 d9aa5fb..0ccbeca 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
@@ -394,37 +394,28 @@
#define NO_gtk_1widget_1set_1parent_1surface
#define NO_gdk_1surface_1create_1similar_1surface
#define NO_gdk_1surface_1destroy
-#define NO_gdk_1surface_1focus
#define NO_gdk_1device_1get_1surface_1at_1position
-#define NO_gdk_1surface_1lower
-#define NO_gdk_1surface_1raise
-#define NO_gdk_1surface_1get_1children
-#define NO_gdk_1surface_1get_1user_1data
#define NO_gdk_1surface_1get_1origin
#define NO_gdk_1surface_1invalidate_1rect
#define NO_gdk_1surface_1get_1display
#define NO_gdk_1surface_1set_1cursor
-#define NO_gdk_1surface_1new_1child
-#define NO_gdk_1surface_1set_1user_1data
-#define NO_gdk_1surface_1restack
-#define NO_gdk_1surface_1show_1unraised
-#define NO_gdk_1surface_1show
+#define NO_gdk_1surface_1new_1toplevel
+#define NO_gdk_1surface_1new_1popup
#define NO_gdk_1surface_1get_1device_1position
#define NO_gdk_1display_1get_1monitor_1at_1surface
-#define NO_gdk_1surface_1get_1frame_1extents
#define NO_gdk_1surface_1get_1width
#define NO_gdk_1surface_1get_1height
-#define NO_gdk_1surface_1get_1state
-#define NO_gdk_1surface_1resize
-#define NO_gdk_1surface_1move
-#define NO_gdk_1surface_1move_1resize
#define NO_gdk_1surface_1hide
-#define NO_gdk_1surface_1set_1decorations
-#define NO_gdk_1surface_1set_1functions
#define NO_gdk_1surface_1get_1root_1origin
#define NO_gdk_1surface_1invalidate_1region
#define NO_gdk_1event_1get_1surface
+// No GdkToplevel on GTK3
+#define NO_gdk_1toplevel_1focus
+#define NO_gdk_1toplevel_1get_1state
+#define NO_gdk_1toplevel_1lower
+#define NO_gdk_1toplevel_1present
+
// No GdkClipboard on GTK3
#define NO_gdk_1clipboard_1set_1content
#define NO_gdk_1display_1get_1clipboard
@@ -479,6 +470,12 @@
// No GtkNative on GTK3
#define NO_gtk_1native_1get_1surface
+// No GdkPopup on GTK3
+#define NO_gdk_1popup_1get_1parent
+#define NO_gdk_1popup_1layout_1new
+#define NO_gdk_1popup_1present
+
+
#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 a777d58..a319cb7 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
@@ -145,6 +145,9 @@
"gdk_1pixbuf_1new_1from_1file",
"gdk_1pixbuf_1save_1to_1bufferv",
"gdk_1pixbuf_1scale_1simple",
+ "gdk_1popup_1get_1parent",
+ "gdk_1popup_1layout_1new",
+ "gdk_1popup_1present",
"gdk_1property_1get",
"gdk_1rgba_1free",
"gdk_1rgba_1parse",
@@ -171,36 +174,23 @@
"gdk_1set_1program_1class",
"gdk_1surface_1create_1similar_1surface",
"gdk_1surface_1destroy",
- "gdk_1surface_1focus",
- "gdk_1surface_1get_1children",
"gdk_1surface_1get_1device_1position",
"gdk_1surface_1get_1display",
- "gdk_1surface_1get_1frame_1extents",
"gdk_1surface_1get_1height",
"gdk_1surface_1get_1origin",
- "gdk_1surface_1get_1root_1origin",
- "gdk_1surface_1get_1state",
- "gdk_1surface_1get_1user_1data",
"gdk_1surface_1get_1width",
"gdk_1surface_1hide",
- "gdk_1surface_1invalidate_1rect",
- "gdk_1surface_1invalidate_1region",
- "gdk_1surface_1lower",
- "gdk_1surface_1move",
- "gdk_1surface_1move_1resize",
- "gdk_1surface_1new_1child",
- "gdk_1surface_1raise",
- "gdk_1surface_1resize",
- "gdk_1surface_1restack",
+ "gdk_1surface_1new_1popup",
+ "gdk_1surface_1new_1toplevel",
"gdk_1surface_1set_1cursor",
- "gdk_1surface_1set_1decorations",
- "gdk_1surface_1set_1functions",
- "gdk_1surface_1set_1user_1data",
- "gdk_1surface_1show",
- "gdk_1surface_1show_1unraised",
"gdk_1text_1property_1to_1utf8_1list_1for_1display",
"gdk_1texture_1new_1for_1pixbuf",
"gdk_1threads_1leave",
+ "gdk_1toplevel_1focus",
+ "gdk_1toplevel_1get_1state",
+ "gdk_1toplevel_1layout_1new",
+ "gdk_1toplevel_1lower",
+ "gdk_1toplevel_1present",
"gdk_1unicode_1to_1keyval",
"gdk_1utf8_1to_1string_1target",
"gdk_1visual_1get_1depth",
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 e272124..a6ab4b2 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
@@ -155,6 +155,9 @@
gdk_1pixbuf_1new_1from_1file_FUNC,
gdk_1pixbuf_1save_1to_1bufferv_FUNC,
gdk_1pixbuf_1scale_1simple_FUNC,
+ gdk_1popup_1get_1parent_FUNC,
+ gdk_1popup_1layout_1new_FUNC,
+ gdk_1popup_1present_FUNC,
gdk_1property_1get_FUNC,
gdk_1rgba_1free_FUNC,
gdk_1rgba_1parse_FUNC,
@@ -181,36 +184,23 @@
gdk_1set_1program_1class_FUNC,
gdk_1surface_1create_1similar_1surface_FUNC,
gdk_1surface_1destroy_FUNC,
- gdk_1surface_1focus_FUNC,
- gdk_1surface_1get_1children_FUNC,
gdk_1surface_1get_1device_1position_FUNC,
gdk_1surface_1get_1display_FUNC,
- gdk_1surface_1get_1frame_1extents_FUNC,
gdk_1surface_1get_1height_FUNC,
gdk_1surface_1get_1origin_FUNC,
- gdk_1surface_1get_1root_1origin_FUNC,
- gdk_1surface_1get_1state_FUNC,
- gdk_1surface_1get_1user_1data_FUNC,
gdk_1surface_1get_1width_FUNC,
gdk_1surface_1hide_FUNC,
- gdk_1surface_1invalidate_1rect_FUNC,
- gdk_1surface_1invalidate_1region_FUNC,
- gdk_1surface_1lower_FUNC,
- gdk_1surface_1move_FUNC,
- gdk_1surface_1move_1resize_FUNC,
- gdk_1surface_1new_1child_FUNC,
- gdk_1surface_1raise_FUNC,
- gdk_1surface_1resize_FUNC,
- gdk_1surface_1restack_FUNC,
+ gdk_1surface_1new_1popup_FUNC,
+ gdk_1surface_1new_1toplevel_FUNC,
gdk_1surface_1set_1cursor_FUNC,
- gdk_1surface_1set_1decorations_FUNC,
- gdk_1surface_1set_1functions_FUNC,
- gdk_1surface_1set_1user_1data_FUNC,
- gdk_1surface_1show_FUNC,
- gdk_1surface_1show_1unraised_FUNC,
gdk_1text_1property_1to_1utf8_1list_1for_1display_FUNC,
gdk_1texture_1new_1for_1pixbuf_FUNC,
gdk_1threads_1leave_FUNC,
+ gdk_1toplevel_1focus_FUNC,
+ gdk_1toplevel_1get_1state_FUNC,
+ gdk_1toplevel_1layout_1new_FUNC,
+ gdk_1toplevel_1lower_FUNC,
+ gdk_1toplevel_1present_FUNC,
gdk_1unicode_1to_1keyval_FUNC,
gdk_1utf8_1to_1string_1target_FUNC,
gdk_1visual_1get_1depth_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 b26bf6a..8f4db2b 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
@@ -199,7 +199,7 @@
public static final int GDK_SELECTION_NOTIFY = 19;
public static final int GDK_SELECTION_REQUEST = 18;
public static final int GDK_SHIFT_MASK = 0x1;
- public static final int GDK_SURFACE_STATE_ICONIFIED = 1 << 1;
+ public static final int GDK_SURFACE_STATE_MINIMIZED = 1 << 1;
public static final int GDK_SURFACE_STATE_MAXIMIZED = 1 << 2;
public static final int GDK_SURFACE_STATE_FULLSCREEN = 1 << 4;
public static final int GDK_Shift_L = 0xffe1;
@@ -349,10 +349,10 @@
/* [GTK4 only, if-def'd in os.h] */
public static final native int gdk_surface_get_width(long surface);
/**
- * @param surface cast=(GdkSurface *)
+ * @param toplevel cast=(GdkToplevel *)
*/
/* [GTK4 only, if-def'd in os.h] */
- public static final native int gdk_surface_get_state(long surface);
+ public static final native int gdk_toplevel_get_state(long toplevel);
/**
* @param window cast=(GdkWindow *)
*/
@@ -464,11 +464,9 @@
public static final native long gdk_device_get_window_at_position(long device, int[] win_x, int[] win_y);
/**
* @param device cast=(GdkDevice *)
- * @param win_x cast=(gint *)
- * @param win_y cast=(gint *)
*/
/* [GTK4 only] */
- public static final native long gdk_device_get_surface_at_position(long device, int[] win_x, int[] win_y);
+ public static final native long gdk_device_get_surface_at_position(long device, double[] win_x, double[] win_y);
/**
* @param display cast=(GdkDisplay *)
*/
@@ -1025,18 +1023,15 @@
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native long gdk_window_get_children(long window);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native long gdk_surface_get_children(long surface);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native int gdk_window_get_events(long window);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_focus(long window, int timestamp);
- /** @param surface cast=(GdkSurface *) */
+ /** @param surface cast=(GdkToplevel *) */
/* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_focus(long surface, int timestamp);
+ public static final native void gdk_toplevel_focus(long surface, int timestamp);
/**
* @param window cast=(GdkWindow *)
* @param rect cast=(GdkRectangle *),flags=no_in
@@ -1044,12 +1039,6 @@
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_get_frame_extents(long window, GdkRectangle rect);
/**
- * @param surface cast=(GdkSurface *)
- * @param rect cast=(GdkRectangle *),flags=no_in
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_get_frame_extents(long surface, GdkRectangle rect);
- /**
* @param window cast=(GdkWindow *)
* @param x cast=(gint *)
* @param y cast=(gint *)
@@ -1075,12 +1064,12 @@
/**
* @param surface cast=(GdkSurface *)
* @param device cast=(GdkDevice *)
- * @param x cast=(gint *)
- * @param y cast=(gint *)
+ * @param x cast=(double *)
+ * @param y cast=(double *)
* @param mask cast=(GdkModifierType *)
*/
/* [GTK4 only, if-def'd in os.h] */
- public static final native long gdk_surface_get_device_position(long surface, long device, int[] x, int[] y, int[] mask);
+ public static final native void gdk_surface_get_device_position(long surface, long device, double[] x, double[] y, int[] mask);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native long gdk_window_get_parent(long window);
@@ -1092,24 +1081,11 @@
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_get_root_origin(long window, int[] x, int[] y);
/**
- * @param surface cast=(GdkSurface *)
- * @param x cast=(gint *)
- * @param y cast=(gint *)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_get_root_origin(long surface, int[] x, int[] y);
- /**
* @param window cast=(GdkWindow *)
* @param data cast=(gpointer *)
*/
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_get_user_data(long window, long [] data);
- /**
- * @param surface cast=(GdkSurface *)
- * @param data cast=(gpointer *)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_get_user_data(long surface, long [] data);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_hide(long window);
@@ -1124,36 +1100,18 @@
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_invalidate_rect(long window, GdkRectangle rectangle, boolean invalidate_children);
/**
- * @param surface cast=(GdkSurface *)
- * @param rectangle cast=(GdkRectangle *),flags=no_out
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_invalidate_rect(long surface, GdkRectangle rectangle);
- /**
* @param window cast=(GdkWindow *)
* @param region cast=(const cairo_region_t *)
* @param invalidate_children cast=(gboolean)
*/
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_invalidate_region(long window, long region, boolean invalidate_children);
- /**
- * @param surface cast=(GdkSurface *)
- * @param region cast=(const cairo_region_t *)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_invalidate_region(long surface, long region);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_move(long window, int x, int y);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_move(long surface, int x, int y);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_move_resize(long window, int x, int y, int width, int height);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_move_resize(long surface, int x, int y, int width, int height);
/**
* @param parent cast=(GdkWindow *)
* @param attributes flags=no_out
@@ -1161,29 +1119,32 @@
/* [GTK3 only, if-def'd in os.h] */
public static final native long gdk_window_new(long parent, GdkWindowAttr attributes, int attributes_mask);
/**
- * @param surface cast=(GdkSurface *)
- * @param rect flags=no_out
+ * @param display cast=(GdkDisplay *)
*/
/* [GTK4 only, if-def'd in os.h] */
- public static final native long gdk_surface_new_child(long surface, GdkRectangle rect);
+ public static final native long gdk_surface_new_toplevel(long display, int width, int height);
+ /** @param parent cast=(GdkSurface *) */
+ /* [GTK4 only, if-def'd in os.h] */
+ public static final native long gdk_surface_new_popup(long parent, boolean autohide);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_lower(long window);
- /** @param surface cast=(GdkSurface *) */
+ /** @param toplevel cast=(GdkToplevel *) */
/* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_lower(long surface);
+ public static final native boolean gdk_toplevel_lower(long toplevel);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_raise(long window);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_raise(long surface);
+ /**
+ * @method flags=dynamic
+ * @param toplevel cast=(GdkToplevel *)
+ * @param layout cast=(GdkToplevelLayout *)
+ * */
+ /* [GTK4 only] */
+ public static final native boolean gdk_toplevel_present(long toplevel, int width, int height, long layout);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_resize(long window, int width, int height);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_resize(long surface, int width, int height);
/**
* @param window cast=(GdkWindow *)
* @param sibling cast=(GdkWindow *)
@@ -1192,13 +1153,6 @@
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_restack(long window, long sibling, boolean above);
/**
- * @param surface cast=(GdkSurface *)
- * @param sibling cast=(GdkSurface *)
- * @param above cast=(gboolean)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_restack(long surface, long sibling, boolean above);
- /**
* @param window cast=(GdkWindow *)
* @param pattern cast=(cairo_pattern_t *)
*/
@@ -1223,23 +1177,11 @@
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_set_decorations(long window, int decorations);
/**
- * @param surface cast=(GdkSurface *)
- * @param decorations cast=(GdkWMDecoration)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_set_decorations(long surface, int decorations);
- /**
* @param window cast=(GdkWindow *)
* @param functions cast=(GdkWMFunction)
*/
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_set_functions(long window, int functions);
- /**
- * @param surface cast=(GdkSurface *)
- * @param functions cast=(GdkWMFunction)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_set_functions(long surface, int functions);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_set_events(long window, int event_mask);
@@ -1255,29 +1197,37 @@
*/
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_set_user_data(long window, long user_data);
- /**
- * @param surface cast=(GdkSurface *)
- * @param user_data cast=(gpointer)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_set_user_data(long surface, long user_data);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_show(long window);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_show(long surface);
/** @param window cast=(GdkWindow *) */
/* [GTK3 only, if-def'd in os.h] */
public static final native void gdk_window_show_unraised(long window);
- /** @param surface cast=(GdkSurface *) */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gdk_surface_show_unraised(long surface);
+
+ /* GdkToplevelLayout [GTK4 only] */
+ /** @method flags=dynamic */
+ public static final native long gdk_toplevel_layout_new(int min_width, int min_height);
+
+ /* GdkPopup [GTK4 only] */
+ /** @param popup cast=(GdkPopup *) */
+ public static final native long gdk_popup_get_parent(long popup);
+ /**
+ * @param popup cast=(GdkPopup *)
+ * @param layout cast=(GdkPopupLayout *)
+ */
+ public static final native boolean gdk_popup_present(long popup, int width, int height, long layout);
+
+ /* GdkPopupLayout [GTK4 only] */
+ /**
+ * @param anchor_rect cast=(const GdkRectangle *)
+ * @param rect_anchor cast=(GdkGravity)
+ * @param surface_anchor cast=(GdkGravity)
+ */
+ public static final native long gdk_popup_layout_new(GdkRectangle anchor_rect, int rect_anchor, int surface_anchor);
public static long gdk_get_pointer (long display) {
long default_seat = GDK.gdk_display_get_default_seat(display);
return GDK.gdk_seat_get_pointer(default_seat);
}
-
}
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
index 5781c03..5d01245 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/GC.java
@@ -559,7 +559,8 @@
srcRect.height = height;
long invalidateRegion = Cairo.cairo_region_create_rectangle (srcRect);
if (GTK.GTK4) {
- GDK.gdk_surface_invalidate_region(drawable, invalidateRegion);
+ /* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
+ * invalid regions ourselves and do gdk_surface_queue_expose */
} else {
long visibleRegion = GDK.gdk_window_get_visible_region (drawable);
long copyRegion = Cairo.cairo_region_create_rectangle (srcRect);
@@ -582,7 +583,8 @@
rect.width = Math.max (0, width);
rect.height = Math.max (0, height);
if (GTK.GTK4) {
- GDK.gdk_surface_invalidate_rect (drawable, rect);
+ /* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
+ * invalid regions ourselves and do gdk_surface_queue_expose */
} else {
GDK.gdk_window_invalidate_rect (drawable, rect, false);
}
@@ -595,7 +597,8 @@
rect.width = Math.abs(deltaX);
rect.height = Math.max (0, height);
if (GTK.GTK4) {
- GDK.gdk_surface_invalidate_rect (drawable, rect);
+ /* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
+ * invalid regions ourselves and do gdk_surface_queue_expose */
} else {
GDK.gdk_window_invalidate_rect (drawable, rect, false);
}
@@ -608,7 +611,8 @@
rect.width = Math.max (0, width);
rect.height = Math.abs(deltaY);
if (GTK.GTK4) {
- GDK.gdk_surface_invalidate_rect (drawable, rect);
+ /* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
+ * invalid regions ourselves and do gdk_surface_queue_expose */
} else {
GDK.gdk_window_invalidate_rect (drawable, rect, false);
}
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 bd4fba9..909c4af 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
@@ -1820,17 +1820,7 @@
GTK.gtk_widget_realize (childHandle);
long surface = gtk_widget_get_surface (childHandle);
if ((style & SWT.READ_ONLY) != 0) return surface;
- long children = GDK.gdk_surface_get_children (surface);
- if (children != 0) {
- /*
- * The only direct child of GtkComboBox since 3.20 is GtkBox thus the children
- * have to be traversed to get to the entry one.
- */
- do {
- surface = OS.g_list_data (children);
- } while ((children = OS.g_list_next (children)) != 0);
- }
- OS.g_list_free (children);
+ /* TODO: GTK4 no access to children of the surface, for combobox may need to use gtk_combo_box_get_child () */
return surface;
}
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 3dd4747..6a7d669 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
@@ -630,24 +630,10 @@
if ((state & CANVAS) != 0) return;
long parentHandle = parentingHandle ();
if (GTK.GTK4) {
- long parentSurface = gtk_widget_get_surface (parentHandle);
- if (parentSurface == 0) return;
- long [] userData = new long [1];
- long surfaceList = GDK.gdk_surface_get_children (parentSurface);
- if (surfaceList != 0) {
- long surfaces = surfaceList;
- while (surfaces != 0) {
- long surface = OS.g_list_data (surfaces);
- if (surface != redrawSurface) {
- GDK.gdk_surface_get_user_data (surface, userData);
- if (userData [0] == 0 || OS.G_OBJECT_TYPE (userData [0]) != display.gtk_fixed_get_type ()) {
- GDK.gdk_surface_lower (surface);
- }
- }
- surfaces = OS.g_list_next (surfaces);
- }
- OS.g_list_free (surfaceList);
- }
+ /* TODO: GTK4 parent does not hold the list of children it has created (parent-children relationship can only be done
+ * with GdkPopup) Will need to consider if we can get children some other way or not have to do fixZOrder at all
+ * and use GdkPopup autohide feature.
+ */
} else {
long parentWindow = gtk_widget_get_window (parentHandle);
if (parentWindow == 0) return;
@@ -1315,9 +1301,9 @@
int clientWidth = getClientWidth ();
x = clientWidth - controlWidth - x;
if (GTK.GTK4) {
- if (child.enableSurface != 0) {
- GDK.gdk_surface_move (child.enableSurface, x, y);
- }
+ /* TODO: GTK4 gdk_surface_move replaced with gdk_toplevel_begin_move which is begins some
+ * interactive operation. Need to reconsider how this is implemented.
+ */
} else {
if (child.enableWindow != 0) {
GDK.gdk_window_move (child.enableWindow, x, y);
@@ -1443,7 +1429,7 @@
if (!childLowered) {
if (GTK.GTK4) {
long surface = gtk_widget_get_surface(child);
- GDK.gdk_surface_lower(surface);
+ GDK.gdk_toplevel_lower(surface);
} else {
long window = gtk_widget_get_window(child);
GDK.gdk_window_lower(window);
@@ -1454,7 +1440,10 @@
if (childLowered) {
if (GTK.GTK4) {
long surface = gtk_widget_get_surface(child);
- GDK.gdk_surface_raise(surface);
+ int width = GDK.gdk_surface_get_width(surface);
+ int height = GDK.gdk_surface_get_height(surface);
+ long layout = GDK.gdk_toplevel_layout_new(width, height);
+ GDK.gdk_toplevel_present(surface, width, height, layout);
} else {
long window = gtk_widget_get_window(child);
GDK.gdk_window_raise(window);
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 d621ae8..bd1fd33 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
@@ -1104,9 +1104,9 @@
sameOrigin = x == oldX && y == oldY;
if (!sameOrigin) {
if (GTK.GTK4) {
- if (enableSurface != 0) {
- GDK.gdk_surface_move (enableSurface, x, y);
- }
+ /* TODO: GTK4 gdk_surface_resize/move no longer exist & have been replaced with
+ * gdk_toplevel_begin_resize & gdk_toplevel_begin_move. These functions might change the
+ * design of resizing and moving in GTK4 */
} else {
if (enableWindow != 0) {
GDK.gdk_window_move (enableWindow, x, y);
@@ -1125,12 +1125,9 @@
int newWidth = Math.max (1, width);
int newHeight = Math.max (1, height);
if (GTK.GTK4) {
- if (redrawSurface != 0) {
- GDK.gdk_surface_resize (redrawSurface, newWidth, newHeight);
- }
- if (enableSurface != 0) {
- GDK.gdk_surface_resize (enableSurface, newWidth, newHeight);
- }
+ /* TODO: GTK4 gdk_surface_resize/move no longer exist & have been replaced with
+ * gdk_toplevel_begin_resize & gdk_toplevel_begin_move. These functions might change the
+ * design of resizing and moving in GTK4 */
} else {
if (redrawWindow != 0) {
GDK.gdk_window_resize (redrawWindow, newWidth, newHeight);
@@ -1209,7 +1206,8 @@
} else {
if ((state & HIDDEN) == 0) {
if (enableSurface != 0) {
- GDK.gdk_surface_show_unraised (enableSurface);
+ /* TODO: GTK4 no longer provides ability to change Z-order, only allow presenting
+ * need replacement for gdk_window_show_unraised */
}
GTK.gtk_widget_show (topHandle);
}
@@ -2749,7 +2747,10 @@
}
int [] newX = new int [1], newY = new int [1];
if (GTK.GTK4) {
- display.gdk_surface_get_device_position (gdkResource, newX, newY, null);
+ double [] newXDouble = new double [1], newYDouble = new double [1];
+ display.gdk_surface_get_device_position (gdkResource, newXDouble, newYDouble, null);
+ newX[0] = (int) newXDouble[0];
+ newY[0] = (int) newYDouble[0];
} else {
display.gdk_window_get_device_position (gdkResource, newX, newY, null);
}
@@ -4524,7 +4525,9 @@
rect.width = Math.max (0, width);
rect.height = Math.max (0, height);
}
- GDK.gdk_surface_invalidate_rect(surface, rect);
+ /* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
+ * invalid regions ourselves and do gdk_surface_queue_expose. Will need a different way to force redraws
+ * New "render" signal? */
} else {
long window = paintWindow ();
if (redrawAll) {
@@ -4589,7 +4592,6 @@
display.removeMouseHoverTimeout (handle);
if (GTK.GTK4) {
if (enableSurface != 0) {
- GDK.gdk_surface_set_user_data (enableSurface, 0);
GDK.gdk_surface_destroy (enableSurface);
enableSurface = 0;
}
@@ -4632,17 +4634,6 @@
GDK.gdk_window_restack (window, sibling, above);
}
-/**
- * GTK4 only, do not call on GTK3.
- * @param window a GdkSurface
- * @param sibling the sibling thereof, or 0
- * @param above a boolean setting for whether the surface
- * should be raised or lowered
- */
-void restackSurface (long surface, long sibling, boolean above) {
- GDK.gdk_surface_restack (surface, sibling, above);
-}
-
boolean sendDragEvent (int button, int stateMask, int x, int y, boolean isStateMask) {
Event event = new Event ();
event.button = button;
@@ -5215,20 +5206,21 @@
} else {
GTK.gtk_widget_realize (handle);
long parentHandle = parent.eventHandle ();
- long surface = parent.eventSurface ();
- long topHandle = topHandle ();
- GtkAllocation allocation = new GtkAllocation ();
- GTK.gtk_widget_get_allocation (topHandle, allocation);
- GdkRectangle rect = new GdkRectangle ();
- rect.x = allocation.x;
- rect.y = allocation.y;
- rect.width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
- rect.height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
- enableSurface = GDK.gdk_surface_new_child (surface, rect);
+
+ enableSurface = GDK.gdk_surface_new_popup(parentHandle, false);
if (enableSurface != 0) {
- GDK.gdk_surface_set_user_data (enableSurface, parentHandle);
- restackSurface (enableSurface, gtk_widget_get_surface (topHandle), true);
- if (GTK.gtk_widget_get_visible (topHandle)) GDK.gdk_surface_show_unraised (enableSurface);
+ long topHandle = topHandle ();
+ GtkAllocation allocation = new GtkAllocation ();
+ GTK.gtk_widget_get_allocation (topHandle, allocation);
+
+ GdkRectangle anchor = new GdkRectangle();
+ anchor.x = allocation.x;
+ anchor.y = allocation.y;
+ anchor.width = (state & ZERO_WIDTH) != 0 ? 0 : allocation.width;
+ anchor.height = (state & ZERO_HEIGHT) != 0 ? 0 : allocation.height;
+
+ long layout = GDK.gdk_popup_layout_new(anchor, GDK.GDK_GRAVITY_NORTH_WEST, GDK.GDK_GRAVITY_NORTH_WEST);
+ GDK.gdk_popup_present(enableSurface, anchor.width, anchor.height, layout);
}
}
} else {
@@ -5269,7 +5261,6 @@
}
void cleanupEnableSurface() {
- GDK.gdk_surface_set_user_data (enableSurface, 0);
GDK.gdk_surface_destroy (enableSurface);
enableSurface = 0;
}
@@ -5762,19 +5753,16 @@
} else {
if (drawCount++ == 0) {
if (GTK.gtk_widget_get_realized (handle)) {
- Rectangle rect = getBoundsInPixels ();
+ Rectangle bounds = getBoundsInPixels ();
if (GTK.GTK4) {
- long surface = paintSurface();
- GdkRectangle gdkRectangle = new GdkRectangle ();
- gdkRectangle.width = rect.width;
- gdkRectangle.height = rect.height;
- redrawSurface = GDK.gdk_surface_new_child(surface, gdkRectangle);
- GDK.gdk_surface_show(redrawSurface);
+ /* TODO: Need to reconsider whether a redrawSurface is a GdkToplevel or GdkPopup */
+ redrawSurface = GDK.gdk_surface_new_toplevel(GDK.gdk_display_get_default(), bounds.width, bounds.height);
+ /* TODO: GTK does not provide a gdk_surface_show, probably will require use of the present api */
} else {
long window = paintWindow ();
GdkWindowAttr attributes = new GdkWindowAttr ();
- attributes.width = rect.width;
- attributes.height = rect.height;
+ attributes.width = bounds.width;
+ attributes.height = bounds.height;
attributes.event_mask = GDK.GDK_EXPOSURE_MASK;
attributes.window_type = GDK.GDK_WINDOW_CHILD;
redrawWindow = GDK.gdk_window_new (window, attributes, 0);
@@ -5935,7 +5923,8 @@
state &= ~HIDDEN;
if ((state & (ZERO_WIDTH | ZERO_HEIGHT)) == 0) {
if (GTK.GTK4) {
- if (enableSurface != 0) GDK.gdk_surface_show_unraised (enableSurface);
+ /* TODO: GTK4 no longer provides ability to change Z-order, only allow presenting
+ * need replacement for gdk_window_show_unraised */
} else {
if (enableWindow != 0) GDK.gdk_window_show_unraised (enableWindow);
}
@@ -6028,21 +6017,20 @@
long redrawSurface = fixChildren ? parent.redrawSurface : 0;
if (!OS.isX11 () || (siblingSurface == 0 && (!above || redrawSurface == 0))) {
if (above) {
- GDK.gdk_surface_raise (surface);
- if (redrawSurface != 0) GDK.gdk_surface_raise (redrawSurface);
- if (enableSurface != 0) GDK.gdk_surface_raise (enableSurface);
+ int width = GDK.gdk_surface_get_width(surface);
+ int height = GDK.gdk_surface_get_height(surface);
+ long layout = GDK.gdk_toplevel_layout_new(width, height);
+ GDK.gdk_toplevel_present(surface, width, height, layout);
+
+ if (redrawSurface != 0) GDK.gdk_toplevel_present(redrawSurface, width, height, layout);
+ if (enableSurface != 0) GDK.gdk_toplevel_present(enableSurface, width, height, layout);
} else {
- if (enableSurface != 0) GDK.gdk_surface_lower (enableSurface);
- GDK.gdk_surface_lower (surface);
+ if (enableSurface != 0) GDK.gdk_toplevel_lower (enableSurface);
+ GDK.gdk_toplevel_lower (surface);
}
} else {
- long siblingS = siblingSurface != 0 ? siblingSurface : redrawSurface;
- boolean stack_mode = above;
- if (redrawSurface != 0 && siblingSurface == 0) stack_mode = false;
- restackSurface (surface, siblingS, stack_mode);
- if (enableSurface != 0) {
- restackSurface (enableSurface, surface, true);
- }
+ /* TODO: GTK4 no longer has ability for changing the Z-order of the windowing system directly.
+ * May need to find alternative way to do reorder (if required) */
}
}
} else {
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
index d7c2eae..c036366 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java
@@ -1795,13 +1795,16 @@
long [] user_data = new long [1];
long gdkResource;
if (GTK.GTK4) {
- gdkResource = gdk_device_get_surface_at_position (x,y);
+ double[] xDouble = new double [1], yDouble = new double [1];
+ gdkResource = gdk_device_get_surface_at_position (xDouble, yDouble);
+ x[0] = (int) xDouble[0];
+ y[0] = (int) yDouble[0];
} else {
gdkResource = gdk_device_get_window_at_position (x,y);
}
if (gdkResource != 0) {
if (GTK.GTK4) {
- GDK.gdk_surface_get_user_data (gdkResource, user_data);
+ user_data[0] = GDK.gdk_popup_get_parent(gdkResource);
} else {
GDK.gdk_window_get_user_data (gdkResource, user_data);
}
@@ -5972,13 +5975,13 @@
return GDK.gdk_window_get_device_position(window, pointer, x, y, mask);
}
-long gdk_surface_get_device_position (long surface, int[] x, int[] y, int[] mask) {
+void gdk_surface_get_device_position (long surface, double[] x, double[] y, int[] mask) {
long display = 0;
if (surface != 0) {
display = GDK.gdk_surface_get_display (surface);
}
long pointer = GDK.gdk_get_pointer(display);
- return GDK.gdk_surface_get_device_position(surface, pointer, x, y, mask);
+ GDK.gdk_surface_get_device_position(surface, pointer, x, y, mask);
}
long gdk_device_get_window_at_position (int[] win_x, int[] win_y) {
@@ -5987,7 +5990,7 @@
return GDK.gdk_device_get_window_at_position (device, win_x, win_y);
}
-long gdk_device_get_surface_at_position (int[] win_x, int[] win_y) {
+long gdk_device_get_surface_at_position (double[] win_x, double[] win_y) {
long display = GDK.gdk_display_get_default ();
long device = GDK.gdk_get_pointer(display);
return GDK.gdk_device_get_surface_at_position (device, win_x, win_y);
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
index 9b9d91c..26080a6 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Menu.java
@@ -1221,23 +1221,19 @@
*/
GTK.gtk_widget_get_preferred_height(handle, null, naturalHeight);
if (naturalHeight[0] > 0) {
-
- int width;
if (GTK.GTK4) {
- long topLevelNative = GTK.gtk_widget_get_native(handle);
- long topLevelSurface = GTK.gtk_native_get_surface(topLevelNative);
- width = GDK.gdk_surface_get_width(topLevelSurface);
- GDK.gdk_surface_resize(topLevelSurface, width, naturalHeight[0]);
+ /* TODO: GTK4 gdk_surface_resize/move no longer exist & have been replaced with
+ * gdk_toplevel_begin_resize & gdk_toplevel_begin_move. These functions might change the
+ * design of resizing and moving in GTK4 */
} else {
long topLevelWidget = GTK.gtk_widget_get_toplevel(handle);
long topLevelWindow = GTK.gtk_widget_get_window(topLevelWidget);
- width = GDK.gdk_window_get_width(topLevelWindow);
+ int width = GDK.gdk_window_get_width(topLevelWindow);
GDK.gdk_window_resize(topLevelWindow, width, naturalHeight[0]);
}
}
}
}
- return;
}
/**
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
index 2375f6f..d8c4158 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Scrollable.java
@@ -484,8 +484,9 @@
rect.height = Math.max (0, height);
}
if (GTK.GTK4) {
- long surface = gtk_widget_get_surface (topHandle);
- GDK.gdk_surface_invalidate_rect (surface, rect);
+ /* TODO: GTK4 no ability to invalidate surfaces, may need to keep track of
+ * invalid regions ourselves and do gdk_surface_queue_expose. Will need a different way to force redraws.
+ * New "render" signal? */
} else {
long window = gtk_widget_get_window (topHandle);
GDK.gdk_window_invalidate_rect (window, rect, all);
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 f820539..9777807 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
@@ -483,10 +483,8 @@
int width = allocation.width;
int height = allocation.height;
GdkRectangle rect = new GdkRectangle ();
- if (GTK.GTK4) {
- long surface = gtk_widget_get_surface(shellHandle);
- GDK.gdk_surface_get_frame_extents (surface, rect);
- } else {
+
+ if (!GTK.GTK4) {
long window = gtk_widget_get_window (shellHandle);
GDK.gdk_window_get_frame_extents (window, rect);
}
@@ -611,7 +609,7 @@
}
long seat = GDK.gdk_display_get_default_seat(gdkDisplay);
if (GTK.GTK4) {
- GDK.gdk_surface_show(gdkResource);
+ /* TODO: GTK does not provide a gdk_surface_show, probably will require use of the present api */
} else {
GDK.gdk_window_show(gdkResource);
}
@@ -627,7 +625,7 @@
}
} else {
if (GTK.GTK4) {
- GDK.gdk_surface_focus (gdkResource, display.lastUserEventTime);
+ GDK.gdk_toplevel_focus (gdkResource, display.lastUserEventTime);
} else {
GDK.gdk_window_focus (gdkResource, display.lastUserEventTime);
}
@@ -1675,7 +1673,9 @@
}
if (x != display.resizeBoundsX || y != display.resizeBoundsY) {
if (GTK.GTK4) {
- GDK.gdk_surface_move_resize (gtk_widget_get_surface (shellHandle), x, y, width, height);
+ /* TODO: GTK4 no longer exist, will probably need to us gdk_toplevel_begin_move &
+ * gdk_toplevel_begin_resize to provide this functionality
+ */
} else {
GDK.gdk_window_move_resize (gtk_widget_get_window (shellHandle), x, y, width, height);
}
@@ -1818,8 +1818,11 @@
if ((style & SWT.NO_MOVE) == 0) functions |= GDK.GDK_FUNC_MOVE;
}
if (GTK.GTK4) {
- GDK.gdk_surface_set_decorations (gdkResource, decorations);
- GDK.gdk_surface_set_functions(gdkResource, functions);
+ /*TODO: GTK4 no longer supports specifying hints for window management functions to be available on the window frame
+ * Usually window managers don't do anything with the hint anyways. */
+ /*TODO: GTK4 no longer supports specifying hints for window management decorations. There is no direct way to specify the
+ * decorations we want/don't want. May have to implement client-side decorations. Use gdk_toplevel_set_decorated to indicate.
+ * A replacement for SWT.CLOSE in GTK4 is gdk_toplevel_set_deletable */
} else {
GDK.gdk_window_set_decorations (gdkResource, decorations);
/*
@@ -1844,11 +1847,12 @@
if ((style & SWT.SHELL_TRIM) != SWT.SHELL_TRIM) {
updateDecorations(gdkResource);
} else if ((style & SWT.NO_MOVE) != 0) {
- // if the GDK_FUNC_ALL bit is present, all the other style
- // bits specified as a parameter will be removed from the window
if (GTK.GTK4) {
- GDK.gdk_surface_set_functions (gdkResource, GDK.GDK_FUNC_ALL | GDK.GDK_FUNC_MOVE);
+ /*TODO: GTK4 no longer supports specifying hints for window management functions to be available on the window frame
+ * Usually window managers don't do anything with the hint anyways. */
} else {
+ // if the GDK_FUNC_ALL bit is present, all the other style
+ // bits specified as a parameter will be removed from the window
GDK.gdk_window_set_functions (gdkResource, GDK.GDK_FUNC_ALL | GDK.GDK_FUNC_MOVE);
}
}
@@ -1879,11 +1883,11 @@
long notifyState (long object, long arg0) {
// GTK4 equivalent of gtk_window_state_event
assert GTK.GTK4;
- int gdkSurfaceState = GDK.gdk_surface_get_state (object);
- minimized = (gdkSurfaceState & GDK.GDK_SURFACE_STATE_ICONIFIED) != 0;
+ int gdkSurfaceState = GDK.gdk_toplevel_get_state (object);
+ minimized = (gdkSurfaceState & GDK.GDK_SURFACE_STATE_MINIMIZED) != 0;
maximized = (gdkSurfaceState & GDK.GDK_SURFACE_STATE_MAXIMIZED) != 0;
fullScreen = (gdkSurfaceState & GDK.GDK_SURFACE_STATE_FULLSCREEN) != 0;
- if ((gdkSurfaceState & GDK.GDK_SURFACE_STATE_ICONIFIED) != 0) {
+ if ((gdkSurfaceState & GDK.GDK_SURFACE_STATE_MINIMIZED) != 0) {
if (minimized) {
sendEvent (SWT.Iconify);
} else {
@@ -2137,12 +2141,10 @@
void resizeBounds (int width, int height, boolean notify) {
int border = gtk_container_get_border_width_or_margin (shellHandle);
if (GTK.GTK4) {
- if (redrawSurface != 0) {
- GDK.gdk_surface_resize (redrawSurface, width, height);
- }
- if (redrawSurface != 0) {
- GDK.gdk_surface_resize (redrawSurface, width, height);
- }
+ /* TODO: GTK4 gdk_surface_resize no longer exist & have been replaced with
+ * gdk_toplevel_begin_resize. These functions might change the
+ * design of resizing in GTK4 */
+
if (parent != null) {
GtkAllocation allocation = new GtkAllocation();
allocation.width = width;
@@ -2285,18 +2287,19 @@
} else {
long parentHandle = shellHandle;
GTK.gtk_widget_realize (parentHandle);
- long surface = gtk_widget_get_surface (parentHandle);
- Rectangle rect = getBoundsInPixels ();
- GdkRectangle gdkRectangle = new GdkRectangle ();
- gdkRectangle.width = rect.width;
- gdkRectangle.height = rect.height;
- enableSurface = GDK.gdk_surface_new_child (surface, gdkRectangle);
+ Rectangle bounds = getBoundsInPixels ();
+ enableSurface = GDK.gdk_surface_new_popup(parentHandle, false);
if (enableSurface != 0) {
if (cursor != null) {
GDK.gdk_surface_set_cursor (enableSurface, cursor.handle);
}
- GDK.gdk_surface_set_user_data (enableSurface, parentHandle);
- GDK.gdk_surface_show (enableSurface);
+
+ GdkRectangle anchor = new GdkRectangle();
+ anchor.width = bounds.width;
+ anchor.height = bounds.height;
+
+ long layout = GDK.gdk_popup_layout_new(anchor, GDK.GDK_GRAVITY_NORTH_WEST, GDK.GDK_GRAVITY_NORTH_WEST);
+ GDK.gdk_popup_present(enableSurface, bounds.width, bounds.height, layout);
}
}
} else {
@@ -2736,7 +2739,12 @@
* if it has editable fields and is running Wayland. Refer to bug 515773.
*/
if (GTK.GTK4) {
- if (enableSurface != 0) GDK.gdk_surface_raise (enableSurface);
+ if (enableSurface != 0) {
+ int width = GDK.gdk_surface_get_width(enableSurface);
+ int height = GDK.gdk_surface_get_height(enableSurface);
+ long layout = GDK.gdk_toplevel_layout_new(minWidth, minHeight);
+ GDK.gdk_toplevel_present(enableSurface, width, height, layout);
+ }
} else {
if (enableWindow != 0) GDK.gdk_window_raise (enableWindow);
}
@@ -3157,8 +3165,9 @@
GTK.gtk_window_get_position (shellHandle, x, y);
} else {
if (GTK.GTK4) {
- long surface = GTK.gtk_native_get_surface(GTK.gtk_widget_get_native (shellHandle));
- GDK.gdk_surface_get_root_origin(surface, x, y);
+ /* TODO: GTK4 Coordinate system is now surface relative, therefore can no longer obtain
+ * root coordinates. Ideas include using the popup GdkSurface which allows you to get
+ * parent relative x and y coords. */
} else {
GDK.gdk_window_get_root_origin(GTK.gtk_widget_get_window(shellHandle), x, y);
}
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 3ffbfa7..2bf4706 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
@@ -807,9 +807,7 @@
@Override
long paintSurface () {
long surface = super.paintSurface ();
- long children = GDK.gdk_surface_get_children (surface);
- if (children != 0) surface = OS.g_list_data (children);
- OS.g_list_free (children);
+ /* TODO: GTK4 no access to children of the surface. Need to find alternative, note that class hierarchy can change from GTK3 */
return surface;
}
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 47cf8f6..85c86db 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
@@ -775,24 +775,8 @@
if (width != 0) {
if (buttonHandle != 0) {
if (GTK.GTK4) {
- long surface = GTK.gtk_widget_get_parent_surface (buttonHandle);
- if (surface != 0) {
- long surfaceList = GDK.gdk_surface_get_children (surface);
- if (surfaceList != 0) {
- long surfaces = surfaceList;
- long [] userData = new long [1];
- while (surfaces != 0) {
- long child = OS.g_list_data (surfaces);
- GDK.gdk_surface_get_user_data (child, userData);
- if (userData[0] == buttonHandle) {
- GDK.gdk_surface_lower (child);
- break;
- }
- surfaces = OS.g_list_next (surfaces);
- }
- OS.g_list_free (surfaceList);
- }
- }
+ /* TODO: GTK4 Removed this for time being, as not confirm if this bug still exists. Has to be
+ * removed since the fix requires functions that no longer exist in GTK4. */
} else {
long window = GTK.gtk_widget_get_parent_window (buttonHandle);
if (window != 0) {
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 912d4b0..627e5af 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
@@ -211,7 +211,10 @@
int [] actualX = new int [1], actualY = new int [1], state = new int [1];
if (GTK.GTK4) {
- display.gdk_surface_get_device_position (surface, actualX, actualY, state);
+ double [] actualXDouble = new double [1], actualYDouble = new double [1];
+ display.gdk_surface_get_device_position (surface, actualXDouble, actualYDouble, state);
+ actualX[0] = (int) actualXDouble[0];
+ actualY[0] = (int) actualYDouble[0];
} else {
display.gdk_window_get_device_position (window, actualX, actualY, state);
}
@@ -248,7 +251,10 @@
*/
int [] actualX = new int [1], actualY = new int [1], state = new int [1];
if (GTK.GTK4) {
- display.gdk_surface_get_device_position (surface, actualX, actualY, state);
+ double [] actualXDouble = new double [1], actualYDouble = new double [1];
+ display.gdk_surface_get_device_position (surface, actualXDouble, actualYDouble, state);
+ actualX[0] = (int) actualXDouble[0];
+ actualY[0] = (int) actualYDouble[0];
} else {
display.gdk_window_get_device_position (window, actualX, actualY, state);
}
@@ -413,7 +419,7 @@
if (GTK.GTK4) {
long overlaySurface = GTK.gtk_native_get_surface(GTK.gtk_widget_get_native (overlay));
GDK.gdk_surface_hide (overlaySurface);
- GDK.gdk_surface_show (overlaySurface);
+ /* TODO: GTK does not provide a gdk_surface_show, probably will require use of the present api */
} else {
long overlayWindow = GTK.gtk_widget_get_window (overlay);
GDK.gdk_window_hide (overlayWindow);
@@ -631,7 +637,10 @@
long gtk_mouse (int eventType, long widget, long eventPtr) {
int [] newX = new int [1], newY = new int [1];
if (GTK.GTK4) {
- display.gdk_surface_get_device_position (surface, newX, newY, null);
+ double [] newXDouble = new double [1], newYDouble = new double [1];
+ display.gdk_surface_get_device_position (surface, newXDouble, newYDouble, null);
+ newX[0] = (int) newXDouble[0];
+ newY[0] = (int) newYDouble[0];
} else {
display.gdk_window_get_device_position (window, newX, newY, null);
}
@@ -779,7 +788,10 @@
tracking = true;
int [] oldX = new int [1], oldY = new int [1], state = new int [1];
if (GTK.GTK4) {
- display.gdk_surface_get_device_position (surface, oldX, oldY, state);
+ double [] oldXDouble = new double [1], oldYDouble = new double [1];
+ display.gdk_surface_get_device_position (surface, oldXDouble, oldYDouble, state);
+ oldX[0] = (int) oldXDouble[0];
+ oldY[0] = (int) oldYDouble[0];
} else {
display.gdk_window_get_device_position (window, oldX, oldY, state);
}
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 ec30bbe..7e595a1 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
@@ -747,24 +747,8 @@
if (width != 0) {
if (buttonHandle != 0) {
if (GTK.GTK4) {
- long surface = GTK.gtk_widget_get_parent_surface (buttonHandle);
- if (surface != 0) {
- long surfaceList = GDK.gdk_surface_get_children (surface);
- if (surfaceList != 0) {
- long surfaces = surfaceList;
- long [] userData = new long [1];
- while (surfaces != 0) {
- long child = OS.g_list_data (surfaces);
- GDK.gdk_surface_get_user_data (child, userData);
- if (userData[0] == buttonHandle) {
- GDK.gdk_surface_lower (child);
- break;
- }
- surfaces = OS.g_list_next (surfaces);
- }
- OS.g_list_free (surfaceList);
- }
- }
+ /* TODO: GTK4 Removed this for time being, as not confirm if this bug still exists. Has to be
+ * removed since the fix requires functions that no longer exist in GTK4. */
} else {
long window = GTK.gtk_widget_get_parent_window (buttonHandle);
if (window != 0) {
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 d037a87..7f4d595 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
@@ -2060,7 +2060,7 @@
static long GdkSeatGrabPrepareFunc (long gdkSeat, long gdkResource, long userData_gdkResource) {
if (userData_gdkResource != 0) {
if (GTK.GTK4) {
- GDK.gdk_surface_show(userData_gdkResource);
+ /* TODO: GTK does not provide a gdk_surface_show, probably will require use of the present api */
} else {
GDK.gdk_window_show(userData_gdkResource);
}