From 86b52477702ae03bb8096d8329eac8f1c841fc68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Wed, 24 Oct 2018 11:39:09 +0200 Subject: [PATCH] constraints: Only get parent rect once when placement rule constraining We got it in a switch case, then again when finalizing. Only get it once instead. https://gitlab.gnome.org/GNOME/mutter/merge_requests/496 --- src/core/constraints.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/core/constraints.c b/src/core/constraints.c index cf039a580..d468c2d92 100644 --- a/src/core/constraints.c +++ b/src/core/constraints.c @@ -821,13 +821,14 @@ constrain_custom_rule (MetaWindow *window, adjusted_unconstrained = info->current; + parent = meta_window_get_transient_for (window); + meta_window_get_frame_rect (parent, &parent_rect); + switch (window->placement_state) { case META_PLACEMENT_STATE_UNCONSTRAINED: break; case META_PLACEMENT_STATE_CONSTRAINED: - parent = meta_window_get_transient_for (window); - meta_window_get_frame_rect (parent, &parent_rect); adjusted_unconstrained.x = parent_rect.x + window->constrained_placement_rule_offset_x; adjusted_unconstrained.y = @@ -948,8 +949,6 @@ constrain_custom_rule (MetaWindow *window, done: window->placement_state = META_PLACEMENT_STATE_CONSTRAINED; - parent = meta_window_get_transient_for (window); - meta_window_get_frame_rect (parent, &parent_rect); window->constrained_placement_rule_offset_x = info->current.x - parent_rect.x; window->constrained_placement_rule_offset_y = info->current.y - parent_rect.y;