mirror of
https://github.com/brl/mutter.git
synced 2024-12-23 19:42:05 +00:00
*/event: Never manipulate the event queue directly
Always use _clutter_event_push() instead.
This commit is contained in:
parent
400ecdfc81
commit
0f56abf569
@ -274,7 +274,7 @@ clutter_event_dispatch (GSource *source,
|
||||
clicked = FALSE;
|
||||
}
|
||||
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
/* Pop an event off the queue if any */
|
||||
|
@ -139,13 +139,10 @@ clutter_event_check (GSource *source)
|
||||
static void
|
||||
queue_event (ClutterEvent *event)
|
||||
{
|
||||
ClutterMainContext *context;
|
||||
|
||||
if (event == NULL)
|
||||
return;
|
||||
|
||||
context = _clutter_context_get_default ();
|
||||
g_queue_push_head (context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -74,7 +74,6 @@ clutter_backend_wayland_handle_motion (void *data,
|
||||
{
|
||||
ClutterInputDeviceWayland *device = data;
|
||||
ClutterStageWayland *stage_wayland = device->pointer_focus;
|
||||
ClutterMainContext *clutter_context;
|
||||
ClutterEvent *event;
|
||||
|
||||
event = clutter_event_new (CLUTTER_MOTION);
|
||||
@ -90,8 +89,7 @@ clutter_backend_wayland_handle_motion (void *data,
|
||||
device->x = x;
|
||||
device->y = y;
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -102,7 +100,6 @@ clutter_backend_wayland_handle_button (void *data,
|
||||
{
|
||||
ClutterInputDeviceWayland *device = data;
|
||||
ClutterStageWayland *stage_wayland = device->pointer_focus;
|
||||
ClutterMainContext *clutter_context;
|
||||
ClutterEvent *event;
|
||||
ClutterEventType type;
|
||||
|
||||
@ -132,8 +129,7 @@ clutter_backend_wayland_handle_button (void *data,
|
||||
break;
|
||||
}
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -144,7 +140,6 @@ clutter_backend_wayland_handle_key (void *data,
|
||||
{
|
||||
ClutterInputDeviceWayland *device = data;
|
||||
ClutterStageWayland *stage_wayland = device->keyboard_focus;
|
||||
ClutterMainContext *clutter_context;
|
||||
ClutterEvent *event;
|
||||
|
||||
event = _clutter_key_event_new_from_evdev ((ClutterInputDevice *) device,
|
||||
@ -153,8 +148,7 @@ clutter_backend_wayland_handle_key (void *data,
|
||||
_time, key, state,
|
||||
&device->modifier_state);
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -166,7 +160,6 @@ clutter_backend_wayland_handle_pointer_focus (void *data,
|
||||
{
|
||||
ClutterInputDeviceWayland *device = data;
|
||||
ClutterStageWayland *stage_wayland;
|
||||
ClutterMainContext *clutter_context;
|
||||
ClutterEvent *event;
|
||||
|
||||
if (device->pointer_focus)
|
||||
@ -181,8 +174,7 @@ clutter_backend_wayland_handle_pointer_focus (void *data,
|
||||
event->crossing.source = CLUTTER_ACTOR (stage_wayland->wrapper);
|
||||
event->crossing.device = CLUTTER_INPUT_DEVICE (device);
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
|
||||
device->pointer_focus = NULL;
|
||||
_clutter_input_device_set_stage (CLUTTER_INPUT_DEVICE (device), NULL);
|
||||
@ -204,8 +196,7 @@ clutter_backend_wayland_handle_pointer_focus (void *data,
|
||||
event->motion.source = CLUTTER_ACTOR (stage_wayland->wrapper);
|
||||
event->motion.device = CLUTTER_INPUT_DEVICE (device);
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
|
||||
device->surface_x = sx;
|
||||
device->surface_y = sy;
|
||||
@ -226,7 +217,6 @@ clutter_backend_wayland_handle_keyboard_focus (void *data,
|
||||
{
|
||||
ClutterInputDeviceWayland *device = data;
|
||||
ClutterStageWayland *stage_wayland;
|
||||
ClutterMainContext *clutter_context;
|
||||
ClutterEvent *event;
|
||||
uint32_t *k, *end;
|
||||
|
||||
@ -242,8 +232,7 @@ clutter_backend_wayland_handle_keyboard_focus (void *data,
|
||||
event->stage_state.changed_mask = CLUTTER_STAGE_STATE_ACTIVATED;
|
||||
event->stage_state.new_state = 0;
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
if (surface)
|
||||
@ -261,8 +250,7 @@ clutter_backend_wayland_handle_keyboard_focus (void *data,
|
||||
for (k = keys->data; k < end; k++)
|
||||
device->modifier_state |= device->xkb->map->modmap[*k];
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -207,14 +207,10 @@ get_modifier_state (WPARAM wparam)
|
||||
static void
|
||||
take_and_queue_event (ClutterEvent *event)
|
||||
{
|
||||
ClutterMainContext *clutter_context;
|
||||
|
||||
clutter_context = _clutter_context_get_default ();
|
||||
|
||||
/* The event is added directly to the queue instead of using
|
||||
clutter_event_put so that it can avoid a copy. This takes
|
||||
ownership of the event */
|
||||
g_queue_push_head (clutter_context->events_queue, event);
|
||||
_clutter_event_push (event, FALSE);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
Loading…
Reference in New Issue
Block a user