Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul D'Pong2020-08-26 19:40:55 +0000
committerAlexander Kurtakov2020-09-08 18:12:58 +0000
commit3326ba2329d9185a94e99b92c30b6eb0837c313b (patch)
tree798676f0182ce84b4cde1b42ffc11192282c47b8
parentcdc7bb695cbb6e6992e7772c18540fd7a8b240f7 (diff)
downloadeclipse.platform.swt-3326ba2329d9185a94e99b92c30b6eb0837c313b.tar.gz
eclipse.platform.swt-3326ba2329d9185a94e99b92c30b6eb0837c313b.tar.xz
eclipse.platform.swt-3326ba2329d9185a94e99b92c30b6eb0837c313b.zip
Bug 566017 - [GTK4] Get Snippet 1 to run - Finishing touches
In os_custom, removed out any uses of gtk_widget_set_has_surface and gtk_widget_get_has_surface No gtk_window_get_position in GTK4 Changed where getDeviceZoom() was called in Device initialization in order to allow for access to the underlying surface which is required to access the monitor in GTK4 Change-Id: I187e3c505ddc18d68d01ad5429dd56dce347522a Signed-off-by: Paul D'Pong <sdamrong@redhat.com>
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.c32
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c40
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.c3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_stats.h3
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java16
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java30
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Composite.java25
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Display.java7
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java12
-rw-r--r--bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/widgets/Widget.java4
11 files changed, 81 insertions, 94 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 ff6094c3dd..d0bc4a1e41 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
@@ -8870,6 +8870,16 @@ JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1scrolled_1window_1new__JJ)
}
#endif
+#ifndef NO_gtk_1scrolled_1window_1set_1child
+JNIEXPORT void JNICALL GTK_NATIVE(gtk_1scrolled_1window_1set_1child)
+ (JNIEnv *env, jclass that, jlong arg0, jlong arg1)
+{
+ GTK_NATIVE_ENTER(env, that, gtk_1scrolled_1window_1set_1child_FUNC);
+ gtk_scrolled_window_set_child((GtkScrolledWindow *)arg0, (GtkWidget *)arg1);
+ GTK_NATIVE_EXIT(env, that, gtk_1scrolled_1window_1set_1child_FUNC);
+}
+#endif
+
#ifndef NO_gtk_1scrolled_1window_1set_1has_1frame
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1scrolled_1window_1set_1has_1frame)
(JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
@@ -11955,18 +11965,6 @@ JNIEXPORT jlong JNICALL GTK_NATIVE(gtk_1widget_1get_1first_1child)
}
#endif
-#ifndef NO_gtk_1widget_1get_1has_1surface
-JNIEXPORT jboolean JNICALL GTK_NATIVE(gtk_1widget_1get_1has_1surface)
- (JNIEnv *env, jclass that, jlong arg0)
-{
- jboolean rc = 0;
- GTK_NATIVE_ENTER(env, that, gtk_1widget_1get_1has_1surface_FUNC);
- rc = (jboolean)gtk_widget_get_has_surface((GtkWidget *)arg0);
- GTK_NATIVE_EXIT(env, that, gtk_1widget_1get_1has_1surface_FUNC);
- return rc;
-}
-#endif
-
#ifndef NO_gtk_1widget_1get_1has_1window
JNIEXPORT jboolean JNICALL GTK_NATIVE(gtk_1widget_1get_1has_1window)
(JNIEnv *env, jclass that, jlong arg0)
@@ -12760,16 +12758,6 @@ JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1set_1halign)
}
#endif
-#ifndef NO_gtk_1widget_1set_1has_1surface
-JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1set_1has_1surface)
- (JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
-{
- GTK_NATIVE_ENTER(env, that, gtk_1widget_1set_1has_1surface_FUNC);
- gtk_widget_set_has_surface((GtkWidget *)arg0, (gboolean)arg1);
- GTK_NATIVE_EXIT(env, that, gtk_1widget_1set_1has_1surface_FUNC);
-}
-#endif
-
#ifndef NO_gtk_1widget_1set_1has_1window
JNIEXPORT void JNICALL GTK_NATIVE(gtk_1widget_1set_1has_1window)
(JNIEnv *env, jclass that, jlong arg0, jboolean arg1)
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 ff4c29ac76..fd7b43b694 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
@@ -506,8 +506,6 @@
#define NO_gtk_1drag_1get_1data__JJJ
// No GdkSurface on GTK3
-#define NO_gtk_1widget_1set_1has_1surface
-#define NO_gtk_1widget_1get_1has_1surface
#define NO_gtk_1widget_1set_1parent_1surface
#define NO_gdk_1surface_1create_1similar_1surface
#define NO_gdk_1surface_1destroy
@@ -621,6 +619,7 @@
// GtkScrollWindow
#define NO_gtk_1scrolled_1window_1set_1has_1frame
#define NO_gtk_1scrolled_1window_1get_1has_1frame
+#define NO_gtk_1scrolled_1window_1set_1child
// GtkTreeViewColumn
#define NO_gtk_1tree_1view_1column_1cell_1get_1size__J_3I_3I_3I_3I
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
index 958ee181f9..a26be9698f 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/library/os_custom.c
@@ -792,7 +792,7 @@ static void swt_fixed_init (SwtFixed *widget) {
priv->hadjustment = NULL;
priv->vadjustment = NULL;
- gtk_widget_set_has_surface(GTK_WIDGET(widget), FALSE);
+// gtk_widget_set_has_surface(GTK_WIDGET(widget), FALSE);
}
static void swt_fixed_finalize (GObject *object) {
@@ -862,24 +862,6 @@ static void swt_fixed_set_property (GObject *object, guint prop_id, const GValue
}
}
-/*
-static void swt_fixed_realize (GtkWidget *widget) {
- GtkAllocation allocation;
- GdkSurface *surface;
-
- if (!gtk_widget_get_has_surface (widget)) {
- GTK_WIDGET_CLASS (swt_fixed_parent_class)->realize (widget);
- return;
- }
-
- gtk_widget_get_allocation (widget, &allocation);
-
- surface = gdk_surface_new_child (gtk_widget_get_parent_surface (widget), &allocation);
- gtk_widget_set_surface(widget, surface);
- gdk_surface_set_user_data (surface, widget);
- return GTK_WIDGET_CLASS (swt_fixed_parent_class)->realize (widget);
-}*/
-
static void swt_fixed_map (GtkWidget *widget) {
SwtFixed *fixed = SWT_FIXED (widget);
SwtFixedPrivate *priv = fixed->priv;
@@ -894,16 +876,9 @@ static void swt_fixed_map (GtkWidget *widget) {
if (!gtk_widget_get_mapped (child)) gtk_widget_map (child);
}
}
- if (gtk_widget_get_has_surface (widget)) {
- //NOTE: contrary to most of GTK, swt_fixed_* container does not raise windows upon showing them.
- //This has the effect that widgets are drawn *beneath* the previous one.
- //E.g if this line is changed to gdk_window_show (..) then widgets are drawn on top of the previous one.
- //This affects mostly only the absolute layout with overlapping widgets, e.g minimizied panels that
- //pop-out in Eclipse (aka fast-view).
- //As such, be attentive to swt_fixed_forall(..); traversing children may need to be done in reverse in some
- //cases.
- gdk_surface_show_unraised (gtk_widget_get_surface (widget));
- }
+
+ //TODO: SWTFixed needs to show without raising. To have an effect that widgets are drawn beneath the previous one.
+
return GTK_WIDGET_CLASS (swt_fixed_parent_class)->map (widget);
}
@@ -941,9 +916,10 @@ static void swt_fixed_size_allocate (GtkWidget *widget, const GtkAllocation *all
GtkRequisition requisition;
gint w, h;
- if (gtk_widget_get_has_surface (widget)) {
+ GtkNative* native = gtk_widget_get_native(widget);
+ if (native != NULL) {
if (gtk_widget_get_realized (widget)) {
- gdk_surface_move_resize (gtk_widget_get_surface (widget), allocation->x, allocation->y, allocation->width, allocation->height);
+ //TODO: GTK4 no surface_resize need to use respective present functions to position
}
}
@@ -956,7 +932,7 @@ static void swt_fixed_size_allocate (GtkWidget *widget, const GtkAllocation *all
child_allocation.x = child_data->x;
child_allocation.y = child_data->y;
- if (!gtk_widget_get_has_surface (widget)) {
+ if (native == NULL) {
child_allocation.x += allocation->x;
child_allocation.y += allocation->y;
}
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 f5462c9390..a2aa310a6a 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
@@ -707,6 +707,7 @@ char * GTK_nativeFunctionNames[] = {
"gtk_1scrolled_1window_1get_1vscrollbar",
"gtk_1scrolled_1window_1new__",
"gtk_1scrolled_1window_1new__JJ",
+ "gtk_1scrolled_1window_1set_1child",
"gtk_1scrolled_1window_1set_1has_1frame",
"gtk_1scrolled_1window_1set_1policy",
"gtk_1scrolled_1window_1set_1shadow_1type",
@@ -945,7 +946,6 @@ char * GTK_nativeFunctionNames[] = {
"gtk_1widget_1get_1clip",
"gtk_1widget_1get_1events",
"gtk_1widget_1get_1first_1child",
- "gtk_1widget_1get_1has_1surface",
"gtk_1widget_1get_1has_1window",
"gtk_1widget_1get_1mapped",
"gtk_1widget_1get_1margin_1bottom",
@@ -999,7 +999,6 @@ char * GTK_nativeFunctionNames[] = {
"gtk_1widget_1set_1double_1buffered",
"gtk_1widget_1set_1focus_1on_1click",
"gtk_1widget_1set_1halign",
- "gtk_1widget_1set_1has_1surface",
"gtk_1widget_1set_1has_1window",
"gtk_1widget_1set_1hexpand",
"gtk_1widget_1set_1margin_1bottom",
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 6aeb1a48f9..eb21ffd584 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
@@ -705,6 +705,7 @@ typedef enum {
gtk_1scrolled_1window_1get_1vscrollbar_FUNC,
gtk_1scrolled_1window_1new___FUNC,
gtk_1scrolled_1window_1new__JJ_FUNC,
+ gtk_1scrolled_1window_1set_1child_FUNC,
gtk_1scrolled_1window_1set_1has_1frame_FUNC,
gtk_1scrolled_1window_1set_1policy_FUNC,
gtk_1scrolled_1window_1set_1shadow_1type_FUNC,
@@ -943,7 +944,6 @@ typedef enum {
gtk_1widget_1get_1clip_FUNC,
gtk_1widget_1get_1events_FUNC,
gtk_1widget_1get_1first_1child_FUNC,
- gtk_1widget_1get_1has_1surface_FUNC,
gtk_1widget_1get_1has_1window_FUNC,
gtk_1widget_1get_1mapped_FUNC,
gtk_1widget_1get_1margin_1bottom_FUNC,
@@ -997,7 +997,6 @@ typedef enum {
gtk_1widget_1set_1double_1buffered_FUNC,
gtk_1widget_1set_1focus_1on_1click_FUNC,
gtk_1widget_1set_1halign_FUNC,
- gtk_1widget_1set_1has_1surface_FUNC,
gtk_1widget_1set_1has_1window_FUNC,
gtk_1widget_1set_1hexpand_FUNC,
gtk_1widget_1set_1margin_1bottom_FUNC,
diff --git a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
index 1e51ba13e7..5cc30fe1a4 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT PI/gtk/org/eclipse/swt/internal/gtk/GTK.java
@@ -1231,12 +1231,6 @@ public class GTK extends OS {
public static final native void gtk_widget_set_has_window(long widget, boolean has_window);
/**
* @param widget cast=(GtkWidget *)
- * @param has_surface cast=(gboolean)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native void gtk_widget_set_has_surface(long widget, boolean has_surface);
- /**
- * @param widget cast=(GtkWidget *)
* @param expand cast=(gboolean)
*/
public static final native void gtk_widget_set_hexpand(long widget, boolean expand);
@@ -2205,6 +2199,11 @@ public class GTK extends OS {
public static final native void gtk_scrolled_window_set_has_frame(long scrolled_window, boolean has_frame);
/** @param scrolled_window cast=(GtkScrolledWindow *) */
public static final native boolean gtk_scrolled_window_get_has_frame(long scrolled_window);
+ /**
+ * @param scrolled_window cast=(GtkScrolledWindow *)
+ * @param child cast=(GtkWidget *)
+ * */
+ public static final native void gtk_scrolled_window_set_child(long scrolled_window, long child);
public static final native long gtk_settings_get_default();
@@ -3268,11 +3267,6 @@ public class GTK extends OS {
*/
/* [GTK3 only, if-def'd in os.h] */
public static final native boolean gtk_widget_get_has_window(long widget);
- /**
- * @param widget cast=(GtkWidget *)
- */
- /* [GTK4 only, if-def'd in os.h] */
- public static final native boolean gtk_widget_get_has_surface(long widget);
/** @param widget cast=(GtkWidget *) */
public static final native boolean gtk_widget_get_can_default(long widget);
/** @param widget cast=(GtkWidget *) */
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
index 95b5e18c83..08156d243b 100644
--- a/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/gtk/org/eclipse/swt/graphics/Device.java
@@ -506,9 +506,16 @@ public FontData[] getFontList (String faceName, boolean scalable) {
}
Point getScreenDPI () {
- long screen = GDK.gdk_screen_get_default();
- int dpi = (int) GDK.gdk_screen_get_resolution(screen);
- Point ptDPI = dpi == -1 ? new Point (96, 96) : new Point (dpi, dpi);
+ Point ptDPI;
+
+ if (GTK.GTK4) {
+ ptDPI = new Point (96, 96);
+ } else {
+ long screen = GDK.gdk_screen_get_default();
+ int dpi = (int) GDK.gdk_screen_get_resolution(screen);
+ ptDPI = dpi == -1 ? new Point (96, 96) : new Point (dpi, dpi);
+ }
+
return ptDPI;
}
@@ -608,9 +615,6 @@ public boolean getWarnings () {
* @see #create
*/
protected void init () {
- this.dpi = getDPI();
- DPIUtil.setDeviceZoom (getDeviceZoom ());
-
if (debug) {
if (xDisplay != 0) {
/* Create the warning and error callbacks */
@@ -680,6 +684,9 @@ protected void init () {
if (shellHandle == 0) SWT.error(SWT.ERROR_NO_HANDLES);
GTK.gtk_widget_realize(shellHandle);
+ this.dpi = getDPI();
+ DPIUtil.setDeviceZoom (getDeviceZoom ());
+
if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
double sx[] = new double[1];
double sy[] = new double[1];
@@ -1082,7 +1089,15 @@ protected int getDeviceZoom() {
int dpi = 96;
if (GTK.GTK_VERSION >= OS.VERSION(3, 22, 0)) {
long display = GDK.gdk_display_get_default();
- long monitor = GDK.gdk_display_get_monitor_at_point(display, 0, 0);
+ long monitor;
+
+ if (GTK.GTK4) {
+ long surface = GTK.gtk_native_get_surface(GTK.gtk_widget_get_native(shellHandle));
+ monitor = GDK.gdk_display_get_monitor_at_surface(display, surface);
+ } else {
+ monitor = GDK.gdk_display_get_monitor_at_point(display, 0, 0);
+ }
+
int scale = GDK.gdk_monitor_get_scale_factor(monitor);
dpi = dpi * scale;
} else {
@@ -1093,6 +1108,7 @@ protected int getDeviceZoom() {
int scale = GDK.gdk_screen_get_monitor_scale_factor (screen, monitor_num);
dpi = dpi * scale;
}
+
return DPIUtil.mapDPIToZoom (dpi);
}
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 0e5f7017d1..01095a695d 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
@@ -161,7 +161,8 @@ static int checkStyle (int style) {
Control [] _getChildren () {
long parentHandle = parentingHandle ();
- long list = GTK.gtk_container_get_children (parentHandle);
+ //TODO: GTK4 no GTKContainer, and GtkWidget has no get_children function
+ long list = GTK.GTK4 ? 0 : GTK.gtk_container_get_children (parentHandle);
if (list == 0) return new Control [0];
int count = OS.g_list_length (list);
Control [] children = new Control [count];
@@ -333,15 +334,19 @@ void createHandle (int index, boolean fixed, boolean scrolled) {
}
if (scrolled) {
if (fixed) GTK.gtk_container_add (fixedHandle, scrolledHandle);
- /*
- * Force the scrolledWindow to have a single child that is
- * not scrolled automatically. Calling gtk_container_add()
- * seems to add the child correctly but cause a warning.
- */
- boolean warnings = display.getWarnings ();
- display.setWarnings (false);
- GTK.gtk_container_add (scrolledHandle, handle);
- display.setWarnings (warnings);
+ if (GTK.GTK4) {
+ GTK.gtk_scrolled_window_set_child(scrolledHandle, handle);
+ } else {
+ /*
+ * Force the scrolledWindow to have a single child that is
+ * not scrolled automatically. Calling gtk_container_add()
+ * seems to add the child correctly but cause a warning.
+ */
+ boolean warnings = display.getWarnings ();
+ display.setWarnings (false);
+ GTK.gtk_container_add (scrolledHandle, handle);
+ display.setWarnings (warnings);
+ }
int hsp = (style & SWT.H_SCROLL) != 0 ? GTK.GTK_POLICY_ALWAYS : GTK.GTK_POLICY_NEVER;
int vsp = (style & SWT.V_SCROLL) != 0 ? GTK.GTK_POLICY_ALWAYS : GTK.GTK_POLICY_NEVER;
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 8b5a387839..d865b444ff 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
@@ -3058,8 +3058,11 @@ static int inversePremultipliedColor(int color, int alpha) {
* This is only important when top layer is semi-transparent.
*/
private static void renderAllBackgrounds(long styleContext, long cairo) {
- long parentStyleContext = GTK.gtk_style_context_get_parent (styleContext);
- if (parentStyleContext != 0) renderAllBackgrounds (parentStyleContext, cairo);
+ if (!GTK.GTK4) {
+ // GTK4 GtkStyleContext has no concept of parents
+ long parentStyleContext = GTK.gtk_style_context_get_parent (styleContext);
+ if (parentStyleContext != 0) renderAllBackgrounds (parentStyleContext, cairo);
+ }
GTK.gtk_render_background (styleContext, cairo, -50, -50, 100, 100);
}
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 7668c8c4a5..b957fa4421 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
@@ -1215,7 +1215,11 @@ Point getLocationInPixels () {
setLocationInPixels(oldX, oldY);
}
int [] x = new int [1], y = new int [1];
- GTK.gtk_window_get_position (shellHandle, x,y);
+ if (GTK.GTK4) {
+ // TODO: GTK4 GtkWindow no longer has the ability to get position
+ } else {
+ GTK.gtk_window_get_position (shellHandle, x, y);
+ }
return new Point (x [0], y [0]);
}
@@ -3204,7 +3208,11 @@ Rectangle getBoundsInPixels () {
checkWidget ();
int [] x = new int [1], y = new int [1];
if ((state & Widget.DISPOSE_SENT) == 0) {
- GTK.gtk_window_get_position (shellHandle, x, y);
+ if (GTK.GTK4) {
+ // TODO: GTK4 GtkWindow no longer has the ability to get position
+ } else {
+ GTK.gtk_window_get_position (shellHandle, x, y);
+ }
} else {
if (GTK.GTK4) {
/* TODO: GTK4 Coordinate system is now surface relative, therefore can no longer obtain
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 31bee721ab..bddc494c20 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
@@ -1949,7 +1949,7 @@ void gtk_widget_set_has_surface_or_window (long widget, boolean has) {
if (has && OS.G_OBJECT_TYPE(widget) == OS.swt_fixed_get_type()) {
return;
}
- GTK.gtk_widget_set_has_surface(widget, has);
+ //TODO: GTK4 no has_surface property
} else {
GTK.gtk_widget_set_has_window(widget, has);
}
@@ -1957,7 +1957,7 @@ void gtk_widget_set_has_surface_or_window (long widget, boolean has) {
boolean gtk_widget_get_has_surface_or_window (long widget) {
if (GTK.GTK4) {
- return GTK.gtk_widget_get_has_surface(widget);
+ return GTK.gtk_widget_get_native(widget) != 0;
} else {
return GTK.gtk_widget_get_has_window(widget);
}

Back to the top