From 2756946fea5a7a25a5c0abd23058268ae442fafb Mon Sep 17 00:00:00 2001 From: Aleksandar Kurtakov Date: Wed, 13 Aug 2025 18:32:56 +0300 Subject: [PATCH] [GTK] Fix gdk_monitor_get_scale_factor on Gtk 4 on X11 One more case of https://github.com/eclipse-platform/eclipse.platform.swt/pull/2396 --- .../Eclipse SWT/gtk/org/eclipse/swt/widgets/Shell.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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 0e46e1c5cec..fcf07c47119 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 @@ -2527,7 +2527,9 @@ void setInitialBounds() { long display = GDK.gdk_display_get_default(); if (display != 0) { long monitor = GDK.gdk_display_get_monitor_at_surface(display, paintSurface()); - GDK.gdk_monitor_get_geometry(monitor, dest); + if (monitor != 0) { + GDK.gdk_monitor_get_geometry(monitor, dest); + } width = (int) (dest.width * SHELL_TO_MONITOR_RATIO); height = (int) (dest.height * SHELL_TO_MONITOR_RATIO); }