window: Fix titlebar_is_onscreen() test

The titlebar rect is in window coordinates, while screen regions are
obviously not. Fix by translating into screen coordinates before
testing for overlaps.

https://bugzilla.gnome.org/show_bug.cgi?id=736915
This commit is contained in:
Florian Müllner 2014-09-18 16:29:50 +01:00
parent 790269db95
commit 73ca0efaeb

View File

@ -5385,7 +5385,7 @@ meta_window_shove_titlebar_onscreen (MetaWindow *window)
gboolean gboolean
meta_window_titlebar_is_onscreen (MetaWindow *window) meta_window_titlebar_is_onscreen (MetaWindow *window)
{ {
MetaRectangle titlebar_rect; MetaRectangle titlebar_rect, frame_rect;
GList *onscreen_region; GList *onscreen_region;
gboolean is_onscreen; gboolean is_onscreen;
@ -5400,6 +5400,11 @@ meta_window_titlebar_is_onscreen (MetaWindow *window)
/* Get the rectangle corresponding to the titlebar */ /* Get the rectangle corresponding to the titlebar */
meta_window_get_titlebar_rect (window, &titlebar_rect); meta_window_get_titlebar_rect (window, &titlebar_rect);
/* Translate into screen coordinates */
meta_window_get_frame_rect (window, &frame_rect);
titlebar_rect.x = frame_rect.x;
titlebar_rect.y = frame_rect.y;
/* Run through the spanning rectangles for the screen and see if one of /* Run through the spanning rectangles for the screen and see if one of
* them overlaps with the titlebar sufficiently to consider it onscreen. * them overlaps with the titlebar sufficiently to consider it onscreen.
*/ */