diff options
-rw-r--r-- | src/core/constraints.c | 4 | ||||
-rw-r--r-- | src/core/place.c | 26 | ||||
-rw-r--r-- | src/core/window-private.h | 3 | ||||
-rw-r--r-- | src/core/window.c | 25 |
4 files changed, 37 insertions, 21 deletions
diff --git a/src/core/constraints.c b/src/core/constraints.c index cf1b9c91..167958ce 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -673,8 +673,8 @@ update_onscreen_requirements (MetaWindow *window, { MetaRectangle titlebar_rect; - titlebar_rect = info->current; - titlebar_rect.height = info->borders->visible.top; + meta_window_get_titlebar_rect (window, &titlebar_rect); + old = window->require_titlebar_visible; window->require_titlebar_visible = meta_rectangle_overlaps_with_region (info->usable_screen_region, diff --git a/src/core/place.c b/src/core/place.c index 8eb6f3a6..d70cdd42 100644 --- a/src/core/place.c +++ b/src/core/place.c @@ -98,6 +98,7 @@ find_next_cascade (MetaWindow *window, GList *tmp; GList *sorted; int cascade_x, cascade_y; + MetaRectangle titlebar_rect; int x_threshold, y_threshold; int window_width, window_height; int cascade_stage; @@ -117,16 +118,9 @@ find_next_cascade (MetaWindow *window, * manually cascade. */ #define CASCADE_FUZZ 15 - if (borders) - { - x_threshold = MAX (borders->visible.left, CASCADE_FUZZ); - y_threshold = MAX (borders->visible.top, CASCADE_FUZZ); - } - else - { - x_threshold = CASCADE_FUZZ; - y_threshold = CASCADE_FUZZ; - } + meta_window_get_titlebar_rect (window, &titlebar_rect); + x_threshold = MAX (titlebar_rect.x, CASCADE_FUZZ); + y_threshold = MAX (titlebar_rect.y, CASCADE_FUZZ); /* Find furthest-SE origin of all workspaces. * cascade_x, cascade_y are the target position @@ -168,13 +162,11 @@ find_next_cascade (MetaWindow *window, if (ABS (wx - cascade_x) < x_threshold && ABS (wy - cascade_y) < y_threshold) { - /* This window is "in the way", move to next cascade - * point. The new window frame should go at the origin - * of the client window we're stacking above. - */ - meta_window_get_position (w, &wx, &wy); - cascade_x = wx; - cascade_y = wy; + meta_window_get_titlebar_rect (w, &titlebar_rect); + + /* Cascade the window evenly by the titlebar height; this isn't a typo. */ + cascade_x = wx + titlebar_rect.height; + cascade_y = wy + titlebar_rect.height; /* If we go off the screen, start over with a new cascade */ if (((cascade_x + window_width) > diff --git a/src/core/window-private.h b/src/core/window-private.h index f76bf6e5..1f201bee 100644 --- a/src/core/window-private.h +++ b/src/core/window-private.h @@ -666,4 +666,7 @@ void meta_window_update_icon_now (MetaWindow *window); gboolean meta_window_can_tile_side_by_side (MetaWindow *window); gboolean meta_window_is_client_decorated (MetaWindow *window); +void meta_window_get_titlebar_rect (MetaWindow *window, + MetaRectangle *titlebar_rect); + #endif diff --git a/src/core/window.c b/src/core/window.c index 35906276..128746de 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -4201,6 +4201,28 @@ meta_window_end_wireframe (MetaWindow *window) window->display->grab_wireframe_last_display_height); } +void +meta_window_get_titlebar_rect (MetaWindow *window, + MetaRectangle *rect) +{ + meta_window_get_outer_rect (window, rect); + + /* The returned rectangle is relative to the frame rect. */ + rect->x = 0; + rect->y = 0; + + if (window->frame) + { + rect->height = window->frame->child_y; + } + else + { + /* Pick an arbitrary height for a titlebar. We might want to + * eventually have CSD windows expose their borders to us. */ + rect->height = 50; + } +} + const char* meta_window_get_startup_id (MetaWindow *window) { @@ -6860,8 +6882,7 @@ meta_window_titlebar_is_onscreen (MetaWindow *window) return FALSE; /* Get the rectangle corresponding to the titlebar */ - meta_window_get_outer_rect (window, &titlebar_rect); - titlebar_rect.height = window->frame->child_y; + meta_window_get_titlebar_rect (window, &titlebar_rect); /* Run through the spanning rectangles for the screen and see if one of * them overlaps with the titlebar sufficiently to consider it onscreen. |