mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 15:40:41 -05:00
window: Put placement related fields in a anynomous struct
To organize things a bit better, put the fields related to the placement rule state in its own anonymous struct inside MetaWindow. While at it, rename the somewhat oddly named variable that in practice means the current relative window position. https://gitlab.gnome.org/GNOME/mutter/merge_requests/705
This commit is contained in:
parent
d22f947bf5
commit
05e9d6ab9e
@ -490,14 +490,14 @@ place_window_if_needed(MetaWindow *window,
|
||||
|
||||
orig_rect = info->orig;
|
||||
|
||||
if (window->placement_rule)
|
||||
if (window->placement.rule)
|
||||
{
|
||||
MetaWindow *parent = meta_window_get_transient_for (window);
|
||||
MetaRectangle parent_rect;
|
||||
int rel_x, rel_y;
|
||||
|
||||
meta_window_process_placement (window,
|
||||
window->placement_rule,
|
||||
window->placement.rule,
|
||||
&rel_x, &rel_y);
|
||||
meta_window_get_frame_rect (parent, &parent_rect);
|
||||
|
||||
@ -831,15 +831,15 @@ constrain_custom_rule (MetaWindow *window,
|
||||
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:
|
||||
break;
|
||||
case META_PLACEMENT_STATE_CONSTRAINED:
|
||||
adjusted_unconstrained.x =
|
||||
parent_rect.x + window->constrained_placement_rule_offset_x;
|
||||
parent->rect.x + window->placement.current.rel_x;
|
||||
adjusted_unconstrained.y =
|
||||
parent_rect.y + window->constrained_placement_rule_offset_y;
|
||||
parent->rect.y + window->placement.current.rel_y;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -857,7 +857,7 @@ constrain_custom_rule (MetaWindow *window,
|
||||
|
||||
current_rule = *placement_rule;
|
||||
|
||||
switch (window->placement_state)
|
||||
switch (window->placement.state)
|
||||
{
|
||||
case META_PLACEMENT_STATE_CONSTRAINED:
|
||||
info->current = adjusted_unconstrained;
|
||||
@ -965,10 +965,10 @@ constrain_custom_rule (MetaWindow *window,
|
||||
}
|
||||
|
||||
done:
|
||||
window->placement_state = META_PLACEMENT_STATE_CONSTRAINED;
|
||||
window->placement.state = META_PLACEMENT_STATE_CONSTRAINED;
|
||||
|
||||
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->placement.current.rel_x = info->current.x - parent_rect.x;
|
||||
window->placement.current.rel_y = info->current.y - parent_rect.y;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -671,7 +671,7 @@ meta_window_place (MetaWindow *window,
|
||||
|
||||
meta_topic (META_DEBUG_PLACEMENT, "Placing window %s\n", window->desc);
|
||||
|
||||
g_return_if_fail (!window->placement_rule);
|
||||
g_return_if_fail (!window->placement.rule);
|
||||
|
||||
switch (window->type)
|
||||
{
|
||||
|
@ -534,10 +534,15 @@ struct _MetaWindow
|
||||
/* Bypass compositor hints */
|
||||
guint bypass_compositor;
|
||||
|
||||
MetaPlacementRule *placement_rule;
|
||||
MetaPlacementState placement_state;
|
||||
int constrained_placement_rule_offset_x;
|
||||
int constrained_placement_rule_offset_y;
|
||||
struct {
|
||||
MetaPlacementRule *rule;
|
||||
MetaPlacementState state;
|
||||
|
||||
struct {
|
||||
int rel_x;
|
||||
int rel_y;
|
||||
} current;
|
||||
} placement;
|
||||
|
||||
guint unmanage_idle_id;
|
||||
};
|
||||
|
@ -344,7 +344,7 @@ meta_window_finalize (GObject *object)
|
||||
g_free (window->gtk_window_object_path);
|
||||
g_free (window->gtk_app_menu_object_path);
|
||||
g_free (window->gtk_menubar_object_path);
|
||||
g_free (window->placement_rule);
|
||||
g_free (window->placement.rule);
|
||||
|
||||
G_OBJECT_CLASS (meta_window_parent_class)->finalize (object);
|
||||
}
|
||||
@ -8523,7 +8523,7 @@ meta_window_emit_size_changed (MetaWindow *window)
|
||||
MetaPlacementRule *
|
||||
meta_window_get_placement_rule (MetaWindow *window)
|
||||
{
|
||||
return window->placement_rule;
|
||||
return window->placement.rule;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -324,7 +324,7 @@ meta_window_wayland_move_resize_internal (MetaWindow *window,
|
||||
constrained_rect.height == 1)
|
||||
return;
|
||||
|
||||
if (window->placement_rule)
|
||||
if (window->placement.rule)
|
||||
{
|
||||
MetaWindow *parent = meta_window_get_transient_for (window);
|
||||
int rel_x, rel_y;
|
||||
@ -913,9 +913,9 @@ void
|
||||
meta_window_place_with_placement_rule (MetaWindow *window,
|
||||
MetaPlacementRule *placement_rule)
|
||||
{
|
||||
g_clear_pointer (&window->placement_rule, g_free);
|
||||
window->placement_rule = g_new0 (MetaPlacementRule, 1);
|
||||
*window->placement_rule = *placement_rule;
|
||||
g_clear_pointer (&window->placement.rule, g_free);
|
||||
window->placement.rule = g_new0 (MetaPlacementRule, 1);
|
||||
*window->placement.rule = *placement_rule;
|
||||
|
||||
window->unconstrained_rect.width = placement_rule->width;
|
||||
window->unconstrained_rect.height = placement_rule->height;
|
||||
|
Loading…
Reference in New Issue
Block a user