From 12b95b0365aea7f6d766a5dc08a84582c91f02d5 Mon Sep 17 00:00:00 2001 From: Jan Dolinar Date: Sun, 21 Nov 2021 17:03:13 +0100 Subject: Bug [#2296] Fix multi-monitor widget positioning on wayland --- gtk/PlatGTK.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'gtk') diff --git a/gtk/PlatGTK.cxx b/gtk/PlatGTK.cxx index 770334a92..97b345bac 100755 --- a/gtk/PlatGTK.cxx +++ b/gtk/PlatGTK.cxx @@ -23,6 +23,9 @@ #include #include #include +#if defined(GDK_WINDOWING_WAYLAND) +#include +#endif #include "ScintillaTypes.h" #include "ScintillaMessages.h" @@ -1181,6 +1184,14 @@ GdkRectangle MonitorRectangleForWidget(GtkWidget *wid) noexcept { GdkDisplay *pdisplay = gtk_widget_get_display(wid); GdkMonitor *monitor = gdk_display_get_monitor_at_window(pdisplay, wnd); gdk_monitor_get_geometry(monitor, &rcScreen); +#if defined(GDK_WINDOWING_WAYLAND) + if (GDK_IS_WAYLAND_DISPLAY(pdisplay)) { + // The GDK behavior on Wayland is not self-consistent, we must correct the display coordinates to match + // the coordinate space used in gtk_window_move. See also https://sourceforge.net/p/scintilla/bugs/2296/ + rcScreen.x = 0; + rcScreen.y = 0; + } +#endif #else GdkScreen *screen = gtk_widget_get_screen(wid); const gint monitor_num = gdk_screen_get_monitor_at_window(screen, wnd); -- cgit v1.2.3