mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 16:10:41 -05:00
wayland: Implement support for 'cursor-visible' stage property
This will allow clutter Wayland clients to either not draw any pointer cursor or draw its own. Signed-off-by: Jonas Ådahl <jadahl@gmail.com> https://bugzilla.gnome.org/show_bug.cgi?id=709590
This commit is contained in:
parent
ef7ad913da
commit
7c2b88f73b
@ -62,6 +62,8 @@ struct _ClutterBackendWayland
|
|||||||
GTimer *event_timer;
|
GTimer *event_timer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void _clutter_backend_wayland_ensure_cursor (ClutterBackendWayland *backend_wayland);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __CLUTTER_BACKEND_WAYLAND_PRIV_H__ */
|
#endif /* __CLUTTER_BACKEND_WAYLAND_PRIV_H__ */
|
||||||
|
@ -63,8 +63,6 @@ G_DEFINE_TYPE (ClutterBackendWayland, clutter_backend_wayland, CLUTTER_TYPE_BACK
|
|||||||
static struct wl_display *_foreign_display = NULL;
|
static struct wl_display *_foreign_display = NULL;
|
||||||
static gboolean _no_event_dispatch = FALSE;
|
static gboolean _no_event_dispatch = FALSE;
|
||||||
|
|
||||||
static void clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland);
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_backend_wayland_dispose (GObject *gobject)
|
clutter_backend_wayland_dispose (GObject *gobject)
|
||||||
{
|
{
|
||||||
@ -224,9 +222,6 @@ clutter_backend_wayland_post_parse (ClutterBackend *backend,
|
|||||||
backend_wayland->wayland_shell))
|
backend_wayland->wayland_shell))
|
||||||
wl_display_roundtrip (backend_wayland->wayland_display);
|
wl_display_roundtrip (backend_wayland->wayland_display);
|
||||||
|
|
||||||
/* We need the shm object before we can create the cursor */
|
|
||||||
clutter_backend_wayland_load_cursor (backend_wayland);
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -296,8 +291,8 @@ clutter_backend_wayland_class_init (ClutterBackendWaylandClass *klass)
|
|||||||
backend_class->get_display = clutter_backend_wayland_get_display;
|
backend_class->get_display = clutter_backend_wayland_get_display;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
void
|
||||||
clutter_backend_wayland_load_cursor (ClutterBackendWayland *backend_wayland)
|
_clutter_backend_wayland_ensure_cursor (ClutterBackendWayland *backend_wayland)
|
||||||
{
|
{
|
||||||
struct wl_cursor *cursor;
|
struct wl_cursor *cursor;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
#include "clutter-backend-wayland.h"
|
#include "clutter-backend-wayland.h"
|
||||||
#include "clutter-backend-wayland-priv.h"
|
#include "clutter-backend-wayland-priv.h"
|
||||||
#include "clutter-stage-private.h"
|
#include "clutter-stage-private.h"
|
||||||
|
#include "clutter-stage-wayland.h"
|
||||||
#include "clutter-wayland.h"
|
#include "clutter-wayland.h"
|
||||||
|
|
||||||
#include "cogl/clutter-stage-cogl.h"
|
#include "cogl/clutter-stage-cogl.h"
|
||||||
@ -351,15 +352,17 @@ clutter_wayland_handle_pointer_enter (void *data,
|
|||||||
wl_fixed_t x, wl_fixed_t y)
|
wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceWayland *device = data;
|
ClutterInputDeviceWayland *device = data;
|
||||||
|
ClutterStageWayland *stage_wayland;
|
||||||
ClutterStageCogl *stage_cogl;
|
ClutterStageCogl *stage_cogl;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
ClutterBackend *backend;
|
ClutterBackend *backend;
|
||||||
ClutterBackendWayland *backend_wayland;
|
ClutterBackendWayland *backend_wayland;
|
||||||
|
|
||||||
if (!CLUTTER_IS_STAGE_COGL (wl_surface_get_user_data (surface)))
|
stage_wayland = wl_surface_get_user_data (surface);
|
||||||
return;
|
|
||||||
|
|
||||||
stage_cogl = wl_surface_get_user_data (surface);
|
if (!CLUTTER_IS_STAGE_COGL (stage_wayland))
|
||||||
|
return;
|
||||||
|
stage_cogl = CLUTTER_STAGE_COGL (stage_wayland);
|
||||||
|
|
||||||
device->pointer_focus = stage_cogl;
|
device->pointer_focus = stage_cogl;
|
||||||
_clutter_input_device_set_stage (CLUTTER_INPUT_DEVICE (device),
|
_clutter_input_device_set_stage (CLUTTER_INPUT_DEVICE (device),
|
||||||
@ -378,26 +381,35 @@ clutter_wayland_handle_pointer_enter (void *data,
|
|||||||
|
|
||||||
_clutter_event_push (event, FALSE);
|
_clutter_event_push (event, FALSE);
|
||||||
|
|
||||||
/* Set the cursor to the cursor loaded at backend initialisation */
|
if (stage_wayland->cursor_visible)
|
||||||
backend = clutter_get_default_backend ();
|
{
|
||||||
backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
/* Set the cursor to the cursor loaded at backend initialisation */
|
||||||
|
backend = clutter_get_default_backend ();
|
||||||
|
backend_wayland = CLUTTER_BACKEND_WAYLAND (backend);
|
||||||
|
|
||||||
wl_pointer_set_cursor (pointer,
|
_clutter_backend_wayland_ensure_cursor (backend_wayland);
|
||||||
serial,
|
|
||||||
backend_wayland->cursor_surface,
|
|
||||||
backend_wayland->cursor_x,
|
|
||||||
backend_wayland->cursor_y);
|
|
||||||
wl_surface_attach (backend_wayland->cursor_surface,
|
|
||||||
backend_wayland->cursor_buffer,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
wl_surface_damage (backend_wayland->cursor_surface,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
32, /* XXX: FFS */
|
|
||||||
32);
|
|
||||||
|
|
||||||
wl_surface_commit (backend_wayland->cursor_surface);
|
wl_pointer_set_cursor (pointer,
|
||||||
|
serial,
|
||||||
|
backend_wayland->cursor_surface,
|
||||||
|
backend_wayland->cursor_x,
|
||||||
|
backend_wayland->cursor_y);
|
||||||
|
wl_surface_attach (backend_wayland->cursor_surface,
|
||||||
|
backend_wayland->cursor_buffer,
|
||||||
|
0,
|
||||||
|
0);
|
||||||
|
wl_surface_damage (backend_wayland->cursor_surface,
|
||||||
|
0,
|
||||||
|
0,
|
||||||
|
32, /* XXX: FFS */
|
||||||
|
32);
|
||||||
|
|
||||||
|
wl_surface_commit (backend_wayland->cursor_surface);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wl_pointer_set_cursor (pointer, serial, NULL, 0, 0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -153,6 +153,15 @@ clutter_stage_wayland_show (ClutterStageWindow *stage_window,
|
|||||||
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage_cogl->wrapper));
|
clutter_actor_queue_redraw (CLUTTER_ACTOR (stage_cogl->wrapper));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
clutter_stage_wayland_set_cursor_visible (ClutterStageWindow *stage_window,
|
||||||
|
gboolean cursor_visible)
|
||||||
|
{
|
||||||
|
ClutterStageWayland *stage_wayland = CLUTTER_STAGE_WAYLAND (stage_window);
|
||||||
|
|
||||||
|
stage_wayland->cursor_visible = cursor_visible;
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
clutter_stage_wayland_set_fullscreen (ClutterStageWindow *stage_window,
|
clutter_stage_wayland_set_fullscreen (ClutterStageWindow *stage_window,
|
||||||
gboolean fullscreen)
|
gboolean fullscreen)
|
||||||
@ -223,6 +232,7 @@ clutter_stage_wayland_resize (ClutterStageWindow *stage_window,
|
|||||||
static void
|
static void
|
||||||
clutter_stage_wayland_init (ClutterStageWayland *stage_wayland)
|
clutter_stage_wayland_init (ClutterStageWayland *stage_wayland)
|
||||||
{
|
{
|
||||||
|
stage_wayland->cursor_visible = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -233,6 +243,7 @@ clutter_stage_window_iface_init (ClutterStageWindowIface *iface)
|
|||||||
iface->realize = clutter_stage_wayland_realize;
|
iface->realize = clutter_stage_wayland_realize;
|
||||||
iface->show = clutter_stage_wayland_show;
|
iface->show = clutter_stage_wayland_show;
|
||||||
iface->set_fullscreen = clutter_stage_wayland_set_fullscreen;
|
iface->set_fullscreen = clutter_stage_wayland_set_fullscreen;
|
||||||
|
iface->set_cursor_visible = clutter_stage_wayland_set_cursor_visible;
|
||||||
iface->resize = clutter_stage_wayland_resize;
|
iface->resize = clutter_stage_wayland_resize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ struct _ClutterStageWayland
|
|||||||
gboolean fullscreen;
|
gboolean fullscreen;
|
||||||
gboolean foreign_wl_surface;
|
gboolean foreign_wl_surface;
|
||||||
gboolean shown;
|
gboolean shown;
|
||||||
|
gboolean cursor_visible;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _ClutterStageWaylandClass
|
struct _ClutterStageWaylandClass
|
||||||
|
Loading…
Reference in New Issue
Block a user