diff options
author | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-06-22 00:34:19 +0300 |
---|---|---|
committer | Alberts Muktupāvels <alberts.muktupavels@gmail.com> | 2016-06-22 00:34:19 +0300 |
commit | 967eebdd5bdf378e220f3856756745ea39f7415b (patch) | |
tree | 3dd169a0ffc1ade867df425591214d7151fed203 | |
parent | a0b8c85c4c0cfb9a378d7c5554af15fdd7703155 (diff) | |
download | metacity-967eebdd5bdf378e220f3856756745ea39f7415b.tar.gz |
window: fix meta_window_get_titlebar_rect
At least two places before 90b36abebdf69be0abaec4015d01e46296f6f5d6 commit
used screen coordinates. Update meta_window_get_titlebar_rect function to
return titlebar rectange in screen coordinates.
This also reverts first change in place.c that did not make any sense. x and
y in titlebar_rect always was 0 meaning that we always used CASCADE_FUZZ
value while previously visible border size was used.
https://bugs.launchpad.net/ubuntu/+source/metacity/+bugs/1509031
-rw-r--r-- | src/core/place.c | 16 | ||||
-rw-r--r-- | src/core/window.c | 4 |
2 files changed, 12 insertions, 8 deletions
diff --git a/src/core/place.c b/src/core/place.c index dc3ad1dc..d85ee851 100644 --- a/src/core/place.c +++ b/src/core/place.c @@ -98,7 +98,6 @@ 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; @@ -118,9 +117,16 @@ find_next_cascade (MetaWindow *window, * manually cascade. */ #define CASCADE_FUZZ 15 - meta_window_get_titlebar_rect (window, &titlebar_rect); - x_threshold = MAX (titlebar_rect.x, CASCADE_FUZZ); - y_threshold = MAX (titlebar_rect.y, CASCADE_FUZZ); + 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; + } /* Find furthest-SE origin of all workspaces. * cascade_x, cascade_y are the target position @@ -162,6 +168,8 @@ find_next_cascade (MetaWindow *window, if (ABS (wx - cascade_x) < x_threshold && ABS (wy - cascade_y) < y_threshold) { + MetaRectangle titlebar_rect; + meta_window_get_titlebar_rect (w, &titlebar_rect); /* Cascade the window evenly by the titlebar height; this isn't a typo. */ diff --git a/src/core/window.c b/src/core/window.c index 9b399764..690d67a4 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -4226,10 +4226,6 @@ meta_window_get_titlebar_rect (MetaWindow *window, { 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; |