mirror of
https://github.com/brl/mutter.git
synced 2025-01-23 09:59:03 +00:00
meta_workspace_set_builtin_struts(): optimize out non-changes
meta_workspace_set_builtin_struts() is slightly expensive; it involves discarding all our cached computed information about the layout of the workspace. So catch calls to set_builtin_struts() that don't change anything. https://bugzilla.gnome.org/show_bug.cgi?id=609546
This commit is contained in:
parent
2a823ef3e4
commit
6ffe5f8343
@ -959,6 +959,23 @@ ensure_work_areas_validated (MetaWorkspace *workspace)
|
||||
}
|
||||
}
|
||||
|
||||
static gboolean
|
||||
strut_lists_equal (GSList *l,
|
||||
GSList *m)
|
||||
{
|
||||
for (; l && m; l = l->next, m = m->next)
|
||||
{
|
||||
MetaStrut *a = l->data;
|
||||
MetaStrut *b = m->data;
|
||||
|
||||
if (a->side != b->side ||
|
||||
!meta_rectangle_equal (&a->rect, &b->rect))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return l == NULL && m == NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* meta_workspace_set_builtin_struts:
|
||||
* @workspace: a #MetaWorkspace
|
||||
@ -972,6 +989,12 @@ void
|
||||
meta_workspace_set_builtin_struts (MetaWorkspace *workspace,
|
||||
GSList *struts)
|
||||
{
|
||||
/* Reordering doesn't actually matter, so we don't catch all
|
||||
* no-impact changes, but this is just a (possibly unnecessary
|
||||
* anyways) optimization */
|
||||
if (strut_lists_equal (struts, workspace->builtin_struts))
|
||||
return;
|
||||
|
||||
workspace_free_builtin_struts (workspace);
|
||||
workspace->builtin_struts = copy_strut_list (struts);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user