2018-04-30 06:03:31 -04:00
|
|
|
/*
|
|
|
|
* Copyright 2015, 2018 Red Hat, Inc.
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License as
|
|
|
|
* published by the Free Software Foundation; either version 2 of the
|
|
|
|
* License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
|
|
|
|
#include "wayland/meta-cursor-sprite-wayland.h"
|
|
|
|
|
|
|
|
struct _MetaCursorSpriteWayland
|
|
|
|
{
|
|
|
|
MetaCursorSprite parent;
|
2018-05-02 06:27:02 -04:00
|
|
|
|
|
|
|
MetaWaylandSurface *surface;
|
2021-07-05 09:50:06 -04:00
|
|
|
gboolean invalidated;
|
2018-04-30 06:03:31 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
G_DEFINE_TYPE (MetaCursorSpriteWayland,
|
|
|
|
meta_cursor_sprite_wayland,
|
|
|
|
META_TYPE_CURSOR_SPRITE)
|
|
|
|
|
2021-07-05 09:47:58 -04:00
|
|
|
static gboolean
|
2018-04-30 06:03:31 -04:00
|
|
|
meta_cursor_sprite_wayland_realize_texture (MetaCursorSprite *sprite)
|
|
|
|
{
|
2021-07-05 09:50:06 -04:00
|
|
|
MetaCursorSpriteWayland *sprite_wayland;
|
|
|
|
|
|
|
|
sprite_wayland = META_CURSOR_SPRITE_WAYLAND (sprite);
|
|
|
|
|
|
|
|
if (sprite_wayland->invalidated)
|
|
|
|
{
|
|
|
|
sprite_wayland->invalidated = FALSE;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
2018-04-30 06:03:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
meta_cursor_sprite_wayland_is_animated (MetaCursorSprite *sprite)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2021-07-05 09:50:06 -04:00
|
|
|
static void
|
|
|
|
meta_cursor_sprite_wayland_invalidate (MetaCursorSprite *sprite)
|
|
|
|
{
|
|
|
|
MetaCursorSpriteWayland *sprite_wayland;
|
|
|
|
|
|
|
|
sprite_wayland = META_CURSOR_SPRITE_WAYLAND (sprite);
|
|
|
|
sprite_wayland->invalidated = TRUE;
|
|
|
|
}
|
|
|
|
|
2018-04-30 06:03:31 -04:00
|
|
|
MetaCursorSpriteWayland *
|
2021-11-15 08:24:53 -05:00
|
|
|
meta_cursor_sprite_wayland_new (MetaWaylandSurface *surface,
|
|
|
|
MetaCursorTracker *cursor_tracker)
|
2018-05-02 06:27:02 -04:00
|
|
|
{
|
|
|
|
MetaCursorSpriteWayland *sprite_wayland;
|
|
|
|
|
2021-11-15 08:24:53 -05:00
|
|
|
sprite_wayland = g_object_new (META_TYPE_CURSOR_SPRITE_WAYLAND,
|
|
|
|
"cursor-tracker", cursor_tracker,
|
|
|
|
NULL);
|
2018-05-02 06:27:02 -04:00
|
|
|
sprite_wayland->surface = surface;
|
|
|
|
|
|
|
|
return sprite_wayland;
|
|
|
|
}
|
|
|
|
|
|
|
|
MetaWaylandBuffer *
|
|
|
|
meta_cursor_sprite_wayland_get_buffer (MetaCursorSpriteWayland *sprite_wayland)
|
2018-04-30 06:03:31 -04:00
|
|
|
{
|
2018-05-02 06:27:02 -04:00
|
|
|
return meta_wayland_surface_get_buffer (sprite_wayland->surface);
|
2018-04-30 06:03:31 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_cursor_sprite_wayland_init (MetaCursorSpriteWayland *sprite_wayland)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
meta_cursor_sprite_wayland_class_init (MetaCursorSpriteWaylandClass *klass)
|
|
|
|
{
|
|
|
|
MetaCursorSpriteClass *cursor_sprite_class = META_CURSOR_SPRITE_CLASS (klass);
|
|
|
|
|
|
|
|
cursor_sprite_class->realize_texture =
|
|
|
|
meta_cursor_sprite_wayland_realize_texture;
|
2021-07-05 09:50:06 -04:00
|
|
|
cursor_sprite_class->invalidate =
|
|
|
|
meta_cursor_sprite_wayland_invalidate;
|
2018-04-30 06:03:31 -04:00
|
|
|
cursor_sprite_class->is_animated = meta_cursor_sprite_wayland_is_animated;
|
|
|
|
}
|