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
This commit is contained in:
Jonas Ådahl 2018-10-24 11:39:09 +02:00 committed by Florian Müllner
parent 23f31e518e
commit 86b5247770

View File

@ -821,13 +821,14 @@ constrain_custom_rule (MetaWindow *window,
adjusted_unconstrained = info->current; adjusted_unconstrained = info->current;
parent = meta_window_get_transient_for (window);
meta_window_get_frame_rect (parent, &parent_rect);
switch (window->placement_state) switch (window->placement_state)
{ {
case META_PLACEMENT_STATE_UNCONSTRAINED: case META_PLACEMENT_STATE_UNCONSTRAINED:
break; break;
case META_PLACEMENT_STATE_CONSTRAINED: case META_PLACEMENT_STATE_CONSTRAINED:
parent = meta_window_get_transient_for (window);
meta_window_get_frame_rect (parent, &parent_rect);
adjusted_unconstrained.x = adjusted_unconstrained.x =
parent_rect.x + window->constrained_placement_rule_offset_x; parent_rect.x + window->constrained_placement_rule_offset_x;
adjusted_unconstrained.y = adjusted_unconstrained.y =
@ -948,8 +949,6 @@ constrain_custom_rule (MetaWindow *window,
done: done:
window->placement_state = META_PLACEMENT_STATE_CONSTRAINED; 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_x = info->current.x - parent_rect.x;
window->constrained_placement_rule_offset_y = info->current.y - parent_rect.y; window->constrained_placement_rule_offset_y = info->current.y - parent_rect.y;