summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-22 00:34:19 +0300
committerAlberts Muktupāvels <alberts.muktupavels@gmail.com>2016-06-22 09:39:22 +0300
commit48245ac807d24194cd531d8c42d507c3173ef6e7 (patch)
tree406acefaa4a26dc992625db1c7f342a4c786942d
parent3f74985e02c0ab59b4bd64379a959d4b2532b88c (diff)
downloadmetacity-48245ac807d24194cd531d8c42d507c3173ef6e7.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.c16
-rw-r--r--src/core/window.c4
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 edc930df..adb2f4d4 100644
--- a/src/core/window.c
+++ b/src/core/window.c
@@ -4227,10 +4227,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;