[nautilus/gnome-3-26: 1/2] eel: gtk-extensions: fix window position checking
- From: Ernestas Kulik <ernestask src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus/gnome-3-26: 1/2] eel: gtk-extensions: fix window position checking
- Date: Thu, 18 Jan 2018 12:52:34 +0000 (UTC)
commit 3fb716870ef706a74fd5d62a5e54e0364eaa5201
Author: Ernestas Kulik <ernestask gnome org>
Date: Wed Jan 10 17:02:16 2018 +0200
eel: gtk-extensions: fix window position checking
Currently, windows are confined to the geometry of the primary monitor
(minus a constant size) with the assumption that its position is (0, 0).
This breaks cases where the primary monitor is above or to the left of
the window. This commit fixes that by using a monitor nearest to the
stored position.
Fixes https://gitlab.gnome.org/GNOME/nautilus/issues/197.
eel/eel-gtk-extensions.c | 15 ++++++++++++---
1 file changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/eel/eel-gtk-extensions.c b/eel/eel-gtk-extensions.c
index 335aa01b1..5fc5293bd 100644
--- a/eel/eel-gtk-extensions.c
+++ b/eel/eel-gtk-extensions.c
@@ -82,12 +82,17 @@ static void
sanity_check_window_position (int *left,
int *top)
{
+ GdkDisplay *display;
+ GdkMonitor *monitor;
GdkRectangle geometry;
g_assert (left != NULL);
g_assert (top != NULL);
- gdk_monitor_get_geometry (gdk_display_get_monitor (gdk_display_get_default (), 0), &geometry);
+ display = gdk_display_get_default ();
+ monitor = gdk_display_get_monitor_at_point (display, *left, *top);
+
+ gdk_monitor_get_geometry (monitor, &geometry);
/* Make sure the top of the window is on screen, for
* draggability (might not be necessary with all window managers,
@@ -95,7 +100,9 @@ sanity_check_window_position (int *left,
* isn't off the bottom of the screen, or so close to the bottom
* that it might be obscured by the panel.
*/
- *top = CLAMP (*top, 0, geometry.height - MINIMUM_ON_SCREEN_HEIGHT);
+ *top = CLAMP (*top,
+ geometry.y,
+ geometry.y + geometry.height - MINIMUM_ON_SCREEN_HEIGHT);
/* FIXME bugzilla.eazel.com 669:
* If window has negative left coordinate, set_uposition sends it
@@ -108,7 +115,9 @@ sanity_check_window_position (int *left,
* the screen, or so close to the right edge that it might be
* obscured by the panel.
*/
- *left = CLAMP (*left, 0, geometry.width - MINIMUM_ON_SCREEN_WIDTH);
+ *left = CLAMP (*left,
+ geometry.x,
+ geometry.x + geometry.width - MINIMUM_ON_SCREEN_WIDTH);
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]