mirror of
https://github.com/brl/mutter.git
synced 2024-11-27 02:20:43 -05:00
wayland: Check there is valid pointer or keyboard focus for events
This commit is contained in:
parent
de933213b7
commit
61dc824c91
@ -74,9 +74,14 @@ clutter_wayland_handle_motion (void *data,
|
|||||||
wl_fixed_t x, wl_fixed_t y)
|
wl_fixed_t x, wl_fixed_t y)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceWayland *device = data;
|
ClutterInputDeviceWayland *device = data;
|
||||||
ClutterStageCogl *stage_cogl = device->pointer_focus;
|
ClutterStageCogl *stage_cogl;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
|
||||||
|
if (!device->pointer_focus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stage_cogl = device->pointer_focus;
|
||||||
|
|
||||||
event = clutter_event_new (CLUTTER_MOTION);
|
event = clutter_event_new (CLUTTER_MOTION);
|
||||||
event->motion.stage = stage_cogl->wrapper;
|
event->motion.stage = stage_cogl->wrapper;
|
||||||
event->motion.device = CLUTTER_INPUT_DEVICE (device);
|
event->motion.device = CLUTTER_INPUT_DEVICE (device);
|
||||||
@ -98,10 +103,15 @@ clutter_wayland_handle_button (void *data,
|
|||||||
uint32_t button, uint32_t state)
|
uint32_t button, uint32_t state)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceWayland *device = data;
|
ClutterInputDeviceWayland *device = data;
|
||||||
ClutterStageCogl *stage_cogl = device->pointer_focus;
|
ClutterStageCogl *stage_cogl;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
ClutterEventType type;
|
ClutterEventType type;
|
||||||
|
|
||||||
|
if (!device->pointer_focus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stage_cogl = device->pointer_focus;
|
||||||
|
|
||||||
if (state)
|
if (state)
|
||||||
type = CLUTTER_BUTTON_PRESS;
|
type = CLUTTER_BUTTON_PRESS;
|
||||||
else
|
else
|
||||||
@ -140,10 +150,14 @@ clutter_wayland_handle_axis (void *data,
|
|||||||
wl_fixed_t value)
|
wl_fixed_t value)
|
||||||
{
|
{
|
||||||
ClutterInputDeviceWayland *device = data;
|
ClutterInputDeviceWayland *device = data;
|
||||||
ClutterStageCogl *stage_cogl = device->pointer_focus;
|
ClutterStageCogl *stage_cogl;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
gdouble delta_x, delta_y;
|
gdouble delta_x, delta_y;
|
||||||
|
|
||||||
|
if (!device->pointer_focus)
|
||||||
|
return;
|
||||||
|
|
||||||
|
stage_cogl = device->pointer_focus;
|
||||||
event = clutter_event_new (CLUTTER_SCROLL);
|
event = clutter_event_new (CLUTTER_SCROLL);
|
||||||
event->scroll.time = _clutter_wayland_get_time();
|
event->scroll.time = _clutter_wayland_get_time();
|
||||||
event->scroll.stage = stage_cogl->wrapper;
|
event->scroll.stage = stage_cogl->wrapper;
|
||||||
@ -272,6 +286,8 @@ clutter_wayland_handle_key (void *data,
|
|||||||
ClutterStageCogl *stage_cogl = device->keyboard_focus;
|
ClutterStageCogl *stage_cogl = device->keyboard_focus;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
|
||||||
|
if (!device->keyboard_focus)
|
||||||
|
return;
|
||||||
if (!device->xkb)
|
if (!device->xkb)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user