Only update surface spec when there is no spec change pending
This commit is contained in:
parent
5a8af1af75
commit
6dfb554558
@ -86,6 +86,7 @@ struct _GdkMirWindowImpl
|
|||||||
/* TRUE if cursor is inside this window */
|
/* TRUE if cursor is inside this window */
|
||||||
gboolean cursor_inside;
|
gboolean cursor_inside;
|
||||||
|
|
||||||
|
gboolean pending_spec_update;
|
||||||
gint output_scale;
|
gint output_scale;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -117,6 +118,8 @@ _gdk_mir_window_impl_new (GdkDisplay *display, GdkWindow *window, GdkWindowAttr
|
|||||||
if (attributes && attributes_mask & GDK_WA_TYPE_HINT)
|
if (attributes && attributes_mask & GDK_WA_TYPE_HINT)
|
||||||
impl->type_hint = attributes->type_hint;
|
impl->type_hint = attributes->type_hint;
|
||||||
|
|
||||||
|
impl->pending_spec_update = TRUE;
|
||||||
|
|
||||||
return (GdkWindowImpl *) impl;
|
return (GdkWindowImpl *) impl;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,12 +177,18 @@ static void
|
|||||||
set_surface_state (GdkMirWindowImpl *impl,
|
set_surface_state (GdkMirWindowImpl *impl,
|
||||||
MirSurfaceState state)
|
MirSurfaceState state)
|
||||||
{
|
{
|
||||||
|
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
||||||
if (impl->surface_state == state)
|
if (impl->surface_state == state)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
impl->surface_state = state;
|
impl->surface_state = state;
|
||||||
if (impl->surface)
|
if (impl->surface && !impl->pending_spec_update)
|
||||||
mir_surface_set_state (impl->surface, state);
|
{
|
||||||
|
MirSurfaceSpec *spec = mir_connection_create_spec_for_changes (connection);
|
||||||
|
mir_surface_spec_set_state (spec, state);
|
||||||
|
mir_surface_apply_spec (impl->surface, spec);
|
||||||
|
mir_surface_spec_release (spec);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -328,6 +337,7 @@ update_surface_spec (GdkWindow *window)
|
|||||||
|
|
||||||
mir_surface_apply_spec (impl->surface, spec);
|
mir_surface_apply_spec (impl->surface, spec);
|
||||||
mir_surface_spec_release (spec);
|
mir_surface_spec_release (spec);
|
||||||
|
impl->pending_spec_update = FALSE;
|
||||||
impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
|
impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -385,7 +395,11 @@ ensure_surface_full (GdkWindow *window,
|
|||||||
MirSurfaceSpec *spec;
|
MirSurfaceSpec *spec;
|
||||||
|
|
||||||
if (impl->surface)
|
if (impl->surface)
|
||||||
|
{
|
||||||
|
if (impl->pending_spec_update)
|
||||||
|
update_surface_spec(window);
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* no destroy notify -- we must leak for now
|
/* no destroy notify -- we must leak for now
|
||||||
* https://bugs.launchpad.net/mir/+bug/1324100
|
* https://bugs.launchpad.net/mir/+bug/1324100
|
||||||
@ -398,6 +412,8 @@ ensure_surface_full (GdkWindow *window,
|
|||||||
impl->surface = mir_surface_create_sync (spec);
|
impl->surface = mir_surface_create_sync (spec);
|
||||||
|
|
||||||
mir_surface_spec_release(spec);
|
mir_surface_spec_release(spec);
|
||||||
|
|
||||||
|
impl->pending_spec_update = FALSE;
|
||||||
impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
|
impl->buffer_stream = mir_surface_get_buffer_stream (impl->surface);
|
||||||
|
|
||||||
/* FIXME: can't make an initial resize event */
|
/* FIXME: can't make an initial resize event */
|
||||||
@ -470,6 +486,10 @@ send_buffer (GdkWindow *window)
|
|||||||
|
|
||||||
/* The Cairo context is no longer valid */
|
/* The Cairo context is no longer valid */
|
||||||
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
|
g_clear_pointer (&impl->cairo_surface, cairo_surface_destroy);
|
||||||
|
if (impl->pending_spec_update)
|
||||||
|
update_surface_spec (window);
|
||||||
|
|
||||||
|
impl->pending_spec_update = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static cairo_surface_t *
|
static cairo_surface_t *
|
||||||
@ -689,6 +709,7 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
|
|||||||
/* We accept any resize */
|
/* We accept any resize */
|
||||||
window->width = width;
|
window->width = width;
|
||||||
window->height = height;
|
window->height = height;
|
||||||
|
impl->pending_spec_update = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Transient windows can move wherever they want */
|
/* Transient windows can move wherever they want */
|
||||||
@ -699,6 +720,7 @@ gdk_mir_window_impl_move_resize (GdkWindow *window,
|
|||||||
impl->has_rect = FALSE;
|
impl->has_rect = FALSE;
|
||||||
impl->transient_x = x;
|
impl->transient_x = x;
|
||||||
impl->transient_y = y;
|
impl->transient_y = y;
|
||||||
|
if (!impl->pending_spec_update && impl->surface)
|
||||||
update_surface_spec (window);
|
update_surface_spec (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -973,6 +995,7 @@ gdk_mir_window_impl_set_type_hint (GdkWindow *window,
|
|||||||
if (hint != impl->type_hint)
|
if (hint != impl->type_hint)
|
||||||
{
|
{
|
||||||
impl->type_hint = hint;
|
impl->type_hint = hint;
|
||||||
|
if (impl->surface && !impl->pending_spec_update)
|
||||||
update_surface_spec (window);
|
update_surface_spec (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1056,6 +1079,9 @@ gdk_mir_window_impl_set_transient_for (GdkWindow *window,
|
|||||||
|
|
||||||
/* Link this window to the parent */
|
/* Link this window to the parent */
|
||||||
impl->transient_for = parent;
|
impl->transient_for = parent;
|
||||||
|
|
||||||
|
if (impl->surface && !impl->pending_spec_update)
|
||||||
|
update_surface_spec (window);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user