mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 18:11:05 -05:00
wayland: Mark sprite as invalid after cursor changes
This will be used to hint the backend that the cursor surface might need uploading again. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1915>
This commit is contained in:
parent
508c08fa09
commit
5e93708d86
@ -25,6 +25,7 @@ struct _MetaCursorSpriteWayland
|
|||||||
MetaCursorSprite parent;
|
MetaCursorSprite parent;
|
||||||
|
|
||||||
MetaWaylandSurface *surface;
|
MetaWaylandSurface *surface;
|
||||||
|
gboolean invalidated;
|
||||||
};
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (MetaCursorSpriteWayland,
|
G_DEFINE_TYPE (MetaCursorSpriteWayland,
|
||||||
@ -34,7 +35,17 @@ G_DEFINE_TYPE (MetaCursorSpriteWayland,
|
|||||||
static gboolean
|
static gboolean
|
||||||
meta_cursor_sprite_wayland_realize_texture (MetaCursorSprite *sprite)
|
meta_cursor_sprite_wayland_realize_texture (MetaCursorSprite *sprite)
|
||||||
{
|
{
|
||||||
return TRUE;
|
MetaCursorSpriteWayland *sprite_wayland;
|
||||||
|
|
||||||
|
sprite_wayland = META_CURSOR_SPRITE_WAYLAND (sprite);
|
||||||
|
|
||||||
|
if (sprite_wayland->invalidated)
|
||||||
|
{
|
||||||
|
sprite_wayland->invalidated = FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
@ -43,6 +54,15 @@ meta_cursor_sprite_wayland_is_animated (MetaCursorSprite *sprite)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
meta_cursor_sprite_wayland_invalidate (MetaCursorSprite *sprite)
|
||||||
|
{
|
||||||
|
MetaCursorSpriteWayland *sprite_wayland;
|
||||||
|
|
||||||
|
sprite_wayland = META_CURSOR_SPRITE_WAYLAND (sprite);
|
||||||
|
sprite_wayland->invalidated = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
MetaCursorSpriteWayland *
|
MetaCursorSpriteWayland *
|
||||||
meta_cursor_sprite_wayland_new (MetaWaylandSurface *surface)
|
meta_cursor_sprite_wayland_new (MetaWaylandSurface *surface)
|
||||||
{
|
{
|
||||||
@ -72,5 +92,7 @@ meta_cursor_sprite_wayland_class_init (MetaCursorSpriteWaylandClass *klass)
|
|||||||
|
|
||||||
cursor_sprite_class->realize_texture =
|
cursor_sprite_class->realize_texture =
|
||||||
meta_cursor_sprite_wayland_realize_texture;
|
meta_cursor_sprite_wayland_realize_texture;
|
||||||
|
cursor_sprite_class->invalidate =
|
||||||
|
meta_cursor_sprite_wayland_invalidate;
|
||||||
cursor_sprite_class->is_animated = meta_cursor_sprite_wayland_is_animated;
|
cursor_sprite_class->is_animated = meta_cursor_sprite_wayland_is_animated;
|
||||||
}
|
}
|
||||||
|
@ -55,6 +55,7 @@
|
|||||||
#include "cogl/cogl.h"
|
#include "cogl/cogl.h"
|
||||||
#include "compositor/meta-surface-actor-wayland.h"
|
#include "compositor/meta-surface-actor-wayland.h"
|
||||||
#include "meta/meta-cursor-tracker.h"
|
#include "meta/meta-cursor-tracker.h"
|
||||||
|
#include "wayland/meta-cursor-sprite-wayland.h"
|
||||||
#include "wayland/meta-wayland-buffer.h"
|
#include "wayland/meta-wayland-buffer.h"
|
||||||
#include "wayland/meta-wayland-cursor-surface.h"
|
#include "wayland/meta-wayland-cursor-surface.h"
|
||||||
#include "wayland/meta-wayland-pointer.h"
|
#include "wayland/meta-wayland-pointer.h"
|
||||||
@ -1223,12 +1224,16 @@ pointer_set_cursor (struct wl_client *client,
|
|||||||
meta_backend_get_cursor_renderer_for_device (meta_get_backend (),
|
meta_backend_get_cursor_renderer_for_device (meta_get_backend (),
|
||||||
device);
|
device);
|
||||||
MetaWaylandCursorSurface *cursor_surface;
|
MetaWaylandCursorSurface *cursor_surface;
|
||||||
|
MetaCursorSprite *cursor_sprite;
|
||||||
|
|
||||||
cursor_surface = META_WAYLAND_CURSOR_SURFACE (surface->role);
|
cursor_surface = META_WAYLAND_CURSOR_SURFACE (surface->role);
|
||||||
meta_wayland_cursor_surface_set_renderer (cursor_surface,
|
meta_wayland_cursor_surface_set_renderer (cursor_surface,
|
||||||
cursor_renderer);
|
cursor_renderer);
|
||||||
meta_wayland_cursor_surface_set_hotspot (cursor_surface,
|
meta_wayland_cursor_surface_set_hotspot (cursor_surface,
|
||||||
hot_x, hot_y);
|
hot_x, hot_y);
|
||||||
|
|
||||||
|
cursor_sprite = meta_wayland_cursor_surface_get_sprite (cursor_surface);
|
||||||
|
meta_cursor_sprite_invalidate (cursor_sprite);
|
||||||
}
|
}
|
||||||
|
|
||||||
meta_wayland_pointer_set_cursor_surface (pointer, surface);
|
meta_wayland_pointer_set_cursor_surface (pointer, surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user