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.
This commit is contained in:
Jasper St. Pierre 2014-08-19 13:54:30 -04:00
parent ac099343da
commit 6fd1de226b

View File

@ -5604,6 +5604,16 @@ update_move (MetaWindow *window,
display->grab_initial_window_pos.x = x - window->saved_rect.width * prop; 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.x = display->grab_initial_window_pos.x;
window->saved_rect.y = display->grab_initial_window_pos.y; window->saved_rect.y = display->grab_initial_window_pos.y;