mirror of
https://github.com/brl/mutter.git
synced 2025-02-02 23:03:00 +00:00
wayland: Don't access the cursor wl_buffer when updating the sprite
We may have released the wl_buffer already when doing this, which means we should not try to access the wl_buffer content. Regarding the cursor texture this is not an issue since we can just use the texture created in apply_pending_state(). The hw cursor however will only be realized if the surface is already using the the buffer (surface->using_buffer == true). This will, at the moment, effectively disable hardware cursors for SHM buffers. https://bugzilla.gnome.org/show_bug.cgi?id=762828
This commit is contained in:
parent
ceae5dceea
commit
96927b3415
@ -967,28 +967,25 @@ update_cursor_sprite_texture (MetaWaylandSurface *surface)
|
|||||||
MetaWaylandSurfaceRoleCursor *cursor_role =
|
MetaWaylandSurfaceRoleCursor *cursor_role =
|
||||||
META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role);
|
META_WAYLAND_SURFACE_ROLE_CURSOR (surface->role);
|
||||||
MetaCursorSprite *cursor_sprite = cursor_role->cursor_sprite;
|
MetaCursorSprite *cursor_sprite = cursor_role->cursor_sprite;
|
||||||
ClutterBackend *clutter_backend = clutter_get_default_backend ();
|
|
||||||
CoglContext *cogl_context =
|
g_return_if_fail (!surface->buffer || surface->buffer->texture);
|
||||||
clutter_backend_get_cogl_context (clutter_backend);
|
|
||||||
CoglTexture *texture;
|
|
||||||
|
|
||||||
if (surface->buffer)
|
if (surface->buffer)
|
||||||
{
|
{
|
||||||
struct wl_resource *buffer;
|
|
||||||
|
|
||||||
buffer = surface->buffer->resource;
|
|
||||||
texture = cogl_wayland_texture_2d_new_from_buffer (cogl_context,
|
|
||||||
buffer,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
meta_cursor_sprite_set_texture (cursor_sprite,
|
meta_cursor_sprite_set_texture (cursor_sprite,
|
||||||
texture,
|
surface->buffer->texture,
|
||||||
cursor_role->hot_x * surface->scale,
|
cursor_role->hot_x * surface->scale,
|
||||||
cursor_role->hot_y * surface->scale);
|
cursor_role->hot_y * surface->scale);
|
||||||
meta_cursor_renderer_realize_cursor_from_wl_buffer (cursor_renderer,
|
|
||||||
cursor_sprite,
|
if (surface->using_buffer)
|
||||||
buffer);
|
{
|
||||||
cogl_object_unref (texture);
|
struct wl_resource *buffer;
|
||||||
|
|
||||||
|
buffer = surface->buffer->resource;
|
||||||
|
meta_cursor_renderer_realize_cursor_from_wl_buffer (cursor_renderer,
|
||||||
|
cursor_sprite,
|
||||||
|
buffer);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user