window: Don't queue move/resizes if the extents are the same

GTK+ sets the frame extents on every allocation, so don't bother doing
any extra work if things are the same.
This commit is contained in:
Jasper St. Pierre 2014-09-17 10:41:14 -06:00
parent 0cde7879d6
commit d87093fe29

View File

@ -338,17 +338,33 @@ reload_icon_geometry (MetaWindow *window,
} }
} }
static gboolean
gtk_border_equal (GtkBorder *a,
GtkBorder *b)
{
return (a->left == b->left &&
a->right == b->right &&
a->top == b->top &&
a->bottom == b->bottom);
}
static void static void
meta_window_set_custom_frame_extents (MetaWindow *window, meta_window_set_custom_frame_extents (MetaWindow *window,
GtkBorder *extents) GtkBorder *extents)
{ {
if (extents) if (extents)
{ {
if (window->has_custom_frame_extents && gtk_border_equal (&window->custom_frame_extents, extents))
return;
window->has_custom_frame_extents = TRUE; window->has_custom_frame_extents = TRUE;
window->custom_frame_extents = *extents; window->custom_frame_extents = *extents;
} }
else else
{ {
if (!window->has_custom_frame_extents)
return;
window->has_custom_frame_extents = FALSE; window->has_custom_frame_extents = FALSE;
memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents)); memset (&window->custom_frame_extents, 0, sizeof (window->custom_frame_extents));
} }
@ -382,9 +398,6 @@ reload_gtk_frame_extents (MetaWindow *window,
{ {
meta_window_set_custom_frame_extents (window, NULL); meta_window_set_custom_frame_extents (window, NULL);
} }
if (!initial)
meta_window_queue(window, META_QUEUE_MOVE_RESIZE);
} }
static void static void