aboutsummaryrefslogtreecommitdiffhomepage
path: root/gtk/PlatGTK.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'gtk/PlatGTK.cxx')
-rwxr-xr-xgtk/PlatGTK.cxx11
1 files changed, 11 insertions, 0 deletions
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 <gdk/gdk.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
+#if defined(GDK_WINDOWING_WAYLAND)
+#include <gdk/gdkwayland.h>
+#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);