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 --- doc/ScintillaHistory.html | 6 ++++++ gtk/PlatGTK.cxx | 11 +++++++++++ 2 files changed, 17 insertions(+) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index 190820625..8d1d707f7 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -564,6 +564,7 @@ Michael Neuroth Arne Scheffler + Jan DolinĂ¡r

Releases

@@ -597,6 +598,11 @@ On Win32 prevent potential memory leaks for Korean language input. Bug #2295. +
  • + On GTK using Wayland, display autocompletion with window on a secondary monitor. + Bug #2296, + Bug #2261. +
  • Release 5.1.4 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