[mutter] window: Add a hack to correct dragging from the top panel in gnome-shell
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [mutter] window: Add a hack to correct dragging from the top panel in gnome-shell
- Date: Tue, 19 Aug 2014 18:01:34 +0000 (UTC)
commit 6fd1de226b6de3d9f8fd58066d233e940571a620
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Tue Aug 19 13:54:30 2014 -0400
window: Add a hack to correct dragging from the top panel in gnome-shell
In gnome-shell, we have a feature where the user can unmaximize windows
by dragging them from the panel above the window. With accurate
anchoring, this looks really weird as the cursor is now "detached" from
the window. Detect this case and put the cursor in the middle of the
window titlebar instead.
src/core/window.c | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/core/window.c b/src/core/window.c
index 3ab453e..b626a5d 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -5604,6 +5604,16 @@ update_move (MetaWindow *window,
display->grab_initial_window_pos.x = x - window->saved_rect.width * prop;
+ /* If we started dragging the window from above the top of the window,
+ * pretend like we started dragging from the middle of the titlebar
+ * instead, as the "correct" anchoring looks wrong. */
+ if (display->grab_anchor_root_y < display->grab_initial_window_pos.y)
+ {
+ MetaRectangle titlebar_rect;
+ meta_window_get_titlebar_rect (window, &titlebar_rect);
+ display->grab_anchor_root_y = display->grab_initial_window_pos.y + titlebar_rect.height / 2;
+ }
+
window->saved_rect.x = display->grab_initial_window_pos.x;
window->saved_rect.y = display->grab_initial_window_pos.y;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]