core: Use ClutterEvent getter methods

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
Carlos Garnacho 2023-08-04 12:29:27 +02:00
parent 440c249031
commit 17191d5a6c
6 changed files with 173 additions and 118 deletions

View File

@ -2480,7 +2480,7 @@ meta_display_accelerator_activate (MetaDisplay *display,
g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED], 0, g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED], 0,
action, action,
clutter_event_get_source_device ((const ClutterEvent *) event), clutter_event_get_source_device ((const ClutterEvent *) event),
event->time); clutter_event_get_time ((const ClutterEvent *) event));
} }
gboolean gboolean

View File

@ -46,16 +46,16 @@
#include "wayland/meta-wayland-private.h" #include "wayland/meta-wayland-private.h"
#endif #endif
#define IS_GESTURE_EVENT(e) ((e)->type == CLUTTER_TOUCHPAD_SWIPE || \ #define IS_GESTURE_EVENT(et) ((et) == CLUTTER_TOUCHPAD_SWIPE || \
(e)->type == CLUTTER_TOUCHPAD_PINCH || \ (et) == CLUTTER_TOUCHPAD_PINCH || \
(e)->type == CLUTTER_TOUCHPAD_HOLD || \ (et) == CLUTTER_TOUCHPAD_HOLD || \
(e)->type == CLUTTER_TOUCH_BEGIN || \ (et) == CLUTTER_TOUCH_BEGIN || \
(e)->type == CLUTTER_TOUCH_UPDATE || \ (et) == CLUTTER_TOUCH_UPDATE || \
(e)->type == CLUTTER_TOUCH_END || \ (et) == CLUTTER_TOUCH_END || \
(e)->type == CLUTTER_TOUCH_CANCEL) (et) == CLUTTER_TOUCH_CANCEL)
#define IS_KEY_EVENT(e) ((e)->type == CLUTTER_KEY_PRESS || \ #define IS_KEY_EVENT(et) ((et) == CLUTTER_KEY_PRESS || \
(e)->type == CLUTTER_KEY_RELEASE) (et) == CLUTTER_KEY_RELEASE)
typedef enum typedef enum
{ {
@ -99,7 +99,7 @@ get_window_for_event (MetaDisplay *display,
return NULL; return NULL;
/* Always use the key focused window for key events. */ /* Always use the key focused window for key events. */
if (IS_KEY_EVENT (event)) if (IS_KEY_EVENT (clutter_event_type (event)))
{ {
return stage_has_key_focus (display) ? display->focus_window return stage_has_key_focus (display) ? display->focus_window
: NULL; : NULL;
@ -119,13 +119,18 @@ handle_idletime_for_event (MetaDisplay *display,
MetaContext *context = meta_display_get_context (display); MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context); MetaBackend *backend = meta_context_get_backend (context);
MetaIdleManager *idle_manager; MetaIdleManager *idle_manager;
ClutterEventType event_type;
ClutterEventFlags flags;
if (clutter_event_get_device (event) == NULL) if (clutter_event_get_device (event) == NULL)
return; return;
if (event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC || flags = clutter_event_get_flags (event);
event->type == CLUTTER_ENTER || event_type = clutter_event_type (event);
event->type == CLUTTER_LEAVE)
if (flags & CLUTTER_EVENT_FLAG_SYNTHETIC ||
event_type == CLUTTER_ENTER ||
event_type == CLUTTER_LEAVE)
return; return;
idle_manager = meta_backend_get_idle_manager (backend); idle_manager = meta_backend_get_idle_manager (backend);
@ -164,7 +169,7 @@ sequence_is_pointer_emulated (MetaDisplay *display,
tracker = meta_display_get_gesture_tracker (display); tracker = meta_display_get_gesture_tracker (display);
if (event->type == CLUTTER_TOUCH_BEGIN && if (clutter_event_type (event) == CLUTTER_TOUCH_BEGIN &&
meta_gesture_tracker_get_n_current_touches (tracker) == 0) meta_gesture_tracker_get_n_current_touches (tracker) == 0)
return TRUE; return TRUE;
} }
@ -183,8 +188,9 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
Display *xdisplay; Display *xdisplay;
int event_mode; int event_mode;
int device_id; int device_id;
uint32_t time_ms;
if (event->type != CLUTTER_BUTTON_PRESS) if (clutter_event_type (event) != CLUTTER_BUTTON_PRESS)
return; return;
if (!META_IS_BACKEND_X11 (backend)) if (!META_IS_BACKEND_X11 (backend))
@ -192,17 +198,18 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
device = clutter_event_get_device (event); device = clutter_event_get_device (event);
device_id = meta_input_device_x11_get_device_id (device); device_id = meta_input_device_x11_get_device_id (device);
time_ms = clutter_event_get_time (event);
switch (unfreeze_method) switch (unfreeze_method)
{ {
case EVENTS_UNFREEZE_SYNC: case EVENTS_UNFREEZE_SYNC:
event_mode = XISyncDevice; event_mode = XISyncDevice;
meta_verbose ("Syncing events time %u device %i", meta_verbose ("Syncing events time %u device %i",
(unsigned int) event->button.time, device_id); (unsigned int) time_ms, device_id);
break; break;
case EVENTS_UNFREEZE_REPLAY: case EVENTS_UNFREEZE_REPLAY:
event_mode = XIReplayDevice; event_mode = XIReplayDevice;
meta_verbose ("Replaying events time %u device %i", meta_verbose ("Replaying events time %u device %i",
(unsigned int) event->button.time, device_id); (unsigned int) time_ms, device_id);
break; break;
default: default:
g_assert_not_reached (); g_assert_not_reached ();
@ -210,7 +217,7 @@ maybe_unfreeze_pointer_events (MetaBackend *backend,
} }
xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
XIAllowEvents (xdisplay, device_id, event_mode, event->button.time); XIAllowEvents (xdisplay, device_id, event_mode, time_ms);
} }
#endif #endif
@ -228,7 +235,9 @@ meta_display_handle_event (MetaDisplay *display,
G_GNUC_UNUSED gboolean bypass_wayland = FALSE; G_GNUC_UNUSED gboolean bypass_wayland = FALSE;
MetaGestureTracker *gesture_tracker; MetaGestureTracker *gesture_tracker;
ClutterEventSequence *sequence; ClutterEventSequence *sequence;
ClutterEventType event_type;
gboolean has_grab; gboolean has_grab;
uint32_t time_ms;
#ifdef HAVE_WAYLAND #ifdef HAVE_WAYLAND
MetaWaylandCompositor *wayland_compositor; MetaWaylandCompositor *wayland_compositor;
MetaWaylandTextInput *wayland_text_input = NULL; MetaWaylandTextInput *wayland_text_input = NULL;
@ -262,6 +271,10 @@ meta_display_handle_event (MetaDisplay *display,
} }
} }
sequence = clutter_event_get_event_sequence (event);
event_type = clutter_event_type (event);
time_ms = clutter_event_get_time (event);
if (meta_display_process_captured_input (display, event)) if (meta_display_process_captured_input (display, event))
{ {
bypass_clutter = TRUE; bypass_clutter = TRUE;
@ -272,10 +285,8 @@ meta_display_handle_event (MetaDisplay *display,
device = clutter_event_get_device (event); device = clutter_event_get_device (event);
clutter_input_pointer_a11y_update (device, event); clutter_input_pointer_a11y_update (device, event);
sequence = clutter_event_get_event_sequence (event);
/* Set the pointer emulating sequence on touch begin, if eligible */ /* Set the pointer emulating sequence on touch begin, if eligible */
if (event->type == CLUTTER_TOUCH_BEGIN) if (event_type == CLUTTER_TOUCH_BEGIN)
{ {
if (sequence_is_pointer_emulated (display, event)) if (sequence_is_pointer_emulated (display, event))
{ {
@ -309,16 +320,16 @@ meta_display_handle_event (MetaDisplay *display,
meta_wayland_compositor_update (wayland_compositor, event); meta_wayland_compositor_update (wayland_compositor, event);
#endif #endif
if (event->type == CLUTTER_PAD_BUTTON_PRESS || if (event_type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE || event_type == CLUTTER_PAD_BUTTON_RELEASE ||
event->type == CLUTTER_PAD_RING || event_type == CLUTTER_PAD_RING ||
event->type == CLUTTER_PAD_STRIP) event_type == CLUTTER_PAD_STRIP)
{ {
gboolean handle_pad_event; gboolean handle_pad_event;
gboolean is_mode_switch = FALSE; gboolean is_mode_switch = FALSE;
if (event->type == CLUTTER_PAD_BUTTON_PRESS || if (event_type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE) event_type == CLUTTER_PAD_BUTTON_RELEASE)
{ {
ClutterInputDevice *pad; ClutterInputDevice *pad;
uint32_t button; uint32_t button;
@ -340,11 +351,11 @@ meta_display_handle_event (MetaDisplay *display,
} }
} }
if (event->type != CLUTTER_DEVICE_ADDED && if (event_type != CLUTTER_DEVICE_ADDED &&
event->type != CLUTTER_DEVICE_REMOVED) event_type != CLUTTER_DEVICE_REMOVED)
handle_idletime_for_event (display, event); handle_idletime_for_event (display, event);
if (event->type == CLUTTER_MOTION) if (event_type == CLUTTER_MOTION)
{ {
ClutterInputDevice *device; ClutterInputDevice *device;
@ -372,12 +383,12 @@ meta_display_handle_event (MetaDisplay *display,
window = get_window_for_event (display, event, event_actor); window = get_window_for_event (display, event, event_actor);
display->current_time = event->any.time; display->current_time = time_ms;
if (window && !window->override_redirect && if (window && !window->override_redirect &&
(event->type == CLUTTER_KEY_PRESS || (event_type == CLUTTER_KEY_PRESS ||
event->type == CLUTTER_BUTTON_PRESS || event_type == CLUTTER_BUTTON_PRESS ||
event->type == CLUTTER_TOUCH_BEGIN)) event_type == CLUTTER_TOUCH_BEGIN))
{ {
if (META_CURRENT_TIME == display->current_time) if (META_CURRENT_TIME == display->current_time)
{ {
@ -426,7 +437,7 @@ meta_display_handle_event (MetaDisplay *display,
*/ */
if (!has_grab) if (!has_grab)
{ {
if (IS_KEY_EVENT (event) && !stage_has_key_focus (display)) if (IS_KEY_EVENT (event_type) && !stage_has_key_focus (display))
{ {
bypass_wayland = TRUE; bypass_wayland = TRUE;
goto out; goto out;
@ -434,7 +445,7 @@ meta_display_handle_event (MetaDisplay *display,
} }
if (meta_is_wayland_compositor () && if (meta_is_wayland_compositor () &&
event->type == CLUTTER_SCROLL && event_type == CLUTTER_SCROLL &&
meta_prefs_get_mouse_button_mods () > 0) meta_prefs_get_mouse_button_mods () > 0)
{ {
ClutterModifierType grab_mods; ClutterModifierType grab_mods;
@ -478,7 +489,7 @@ meta_display_handle_event (MetaDisplay *display,
* - CLUTTER_TOUCHPAD_* events over windows. These can likewise * - CLUTTER_TOUCHPAD_* events over windows. These can likewise
* trigger ::captured-event handlers along the way. * trigger ::captured-event handlers along the way.
*/ */
bypass_clutter = !IS_GESTURE_EVENT (event); bypass_clutter = !IS_GESTURE_EVENT (event_type);
bypass_wayland = meta_window_has_modals (window); bypass_wayland = meta_window_has_modals (window);
if ( if (
@ -537,9 +548,9 @@ meta_display_handle_event (MetaDisplay *display,
if (wayland_compositor && !bypass_wayland) if (wayland_compositor && !bypass_wayland)
{ {
if (window && event->type == CLUTTER_MOTION && if (window && event_type == CLUTTER_MOTION &&
event->any.time != CLUTTER_CURRENT_TIME) time_ms != CLUTTER_CURRENT_TIME)
meta_window_check_alive_on_event (window, event->any.time); meta_window_check_alive_on_event (window, time_ms);
if (meta_wayland_compositor_handle_event (wayland_compositor, event)) if (meta_wayland_compositor_handle_event (wayland_compositor, event))
bypass_clutter = TRUE; bypass_clutter = TRUE;

View File

@ -1902,15 +1902,18 @@ process_event (MetaDisplay *display,
ClutterKeyEvent *event) ClutterKeyEvent *event)
{ {
MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBindingManager *keys = &display->key_binding_manager;
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode; xkb_keycode_t keycode =
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 }; MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
MetaKeyBinding *binding; MetaKeyBinding *binding;
/* we used to have release-based bindings but no longer. */ /* we used to have release-based bindings but no longer. */
if (event->type == CLUTTER_KEY_RELEASE) if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
return FALSE; return FALSE;
resolved_combo.mask = mask_from_event_params (keys, event->modifier_state); resolved_combo.mask =
mask_from_event_params (keys,
clutter_event_get_state ((ClutterEvent *) event));
binding = get_keybinding (keys, &resolved_combo); binding = get_keybinding (keys, &resolved_combo);
@ -1945,7 +1948,7 @@ process_event (MetaDisplay *display,
if (meta_compositor_filter_keybinding (display->compositor, binding)) if (meta_compositor_filter_keybinding (display->compositor, binding))
goto not_found; goto not_found;
if (event->flags & CLUTTER_EVENT_FLAG_REPEATED && if (clutter_event_get_flags ((ClutterEvent *) event) & CLUTTER_EVENT_FLAG_REPEATED &&
binding->flags & META_KEY_BINDING_IGNORE_AUTOREPEAT) binding->flags & META_KEY_BINDING_IGNORE_AUTOREPEAT)
{ {
meta_topic (META_DEBUG_KEYBINDINGS, meta_topic (META_DEBUG_KEYBINDINGS,
@ -1978,6 +1981,10 @@ process_special_modifier_key (MetaDisplay *display,
{ {
MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBindingManager *keys = &display->key_binding_manager;
MetaBackend *backend = keys->backend; MetaBackend *backend = keys->backend;
ClutterInputDevice *device;
ClutterModifierType modifiers;
uint32_t time_ms;
uint32_t hardware_keycode;
Display *xdisplay; Display *xdisplay;
if (META_IS_BACKEND_X11 (backend)) if (META_IS_BACKEND_X11 (backend))
@ -1985,10 +1992,14 @@ process_special_modifier_key (MetaDisplay *display,
else else
xdisplay = NULL; xdisplay = NULL;
hardware_keycode = clutter_event_get_key_code ((ClutterEvent *) event);
time_ms = clutter_event_get_time ((ClutterEvent *) event);
device = clutter_event_get_device ((ClutterEvent *) event);
modifiers = clutter_event_get_state ((ClutterEvent *) event);
if (*modifier_press_only) if (*modifier_press_only)
{ {
if (! resolved_key_combo_has_keycode (resolved_key_combo, if (! resolved_key_combo_has_keycode (resolved_key_combo, hardware_keycode))
event->hardware_keycode))
{ {
*modifier_press_only = FALSE; *modifier_press_only = FALSE;
@ -2019,21 +2030,25 @@ process_special_modifier_key (MetaDisplay *display,
* windows */ * windows */
if (xdisplay) if (xdisplay)
{
XIAllowEvents (xdisplay, XIAllowEvents (xdisplay,
meta_input_device_x11_get_device_id (event->device), meta_input_device_x11_get_device_id (device),
XIAsyncDevice, event->time); XIAsyncDevice, time_ms);
}
} }
else else
{ {
/* Replay the event so it gets delivered to our /* Replay the event so it gets delivered to our
* per-window key bindings or to the application */ * per-window key bindings or to the application */
if (xdisplay) if (xdisplay)
{
XIAllowEvents (xdisplay, XIAllowEvents (xdisplay,
meta_input_device_x11_get_device_id (event->device), meta_input_device_x11_get_device_id (device),
XIReplayDevice, event->time); XIReplayDevice, time_ms);
} }
} }
else if (event->type == CLUTTER_KEY_RELEASE) }
else if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
{ {
MetaKeyBinding *binding; MetaKeyBinding *binding;
@ -2042,9 +2057,11 @@ process_special_modifier_key (MetaDisplay *display,
/* We want to unfreeze events, but keep the grab so that if the user /* We want to unfreeze events, but keep the grab so that if the user
* starts typing into the overlay we get all the keys */ * starts typing into the overlay we get all the keys */
if (xdisplay) if (xdisplay)
{
XIAllowEvents (xdisplay, XIAllowEvents (xdisplay,
meta_input_device_x11_get_device_id (event->device), meta_input_device_x11_get_device_id (device),
XIAsyncDevice, event->time); XIAsyncDevice, time_ms);
}
binding = get_keybinding (keys, resolved_key_combo); binding = get_keybinding (keys, resolved_key_combo);
if (binding && if (binding &&
@ -2067,25 +2084,28 @@ process_special_modifier_key (MetaDisplay *display,
* https://bugzilla.gnome.org/show_bug.cgi?id=666101 * https://bugzilla.gnome.org/show_bug.cgi?id=666101
*/ */
if (xdisplay) if (xdisplay)
{
XIAllowEvents (xdisplay, XIAllowEvents (xdisplay,
meta_input_device_x11_get_device_id (event->device), meta_input_device_x11_get_device_id (device),
XIAsyncDevice, event->time); XIAsyncDevice, time_ms);
}
} }
return TRUE; return TRUE;
} }
else if (event->type == CLUTTER_KEY_PRESS && else if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_PRESS &&
((event->modifier_state & ~(IGNORED_MODIFIERS)) & CLUTTER_MODIFIER_MASK) == 0 && ((modifiers & ~(IGNORED_MODIFIERS)) & CLUTTER_MODIFIER_MASK) == 0 &&
resolved_key_combo_has_keycode (resolved_key_combo, resolved_key_combo_has_keycode (resolved_key_combo, hardware_keycode))
event->hardware_keycode))
{ {
*modifier_press_only = TRUE; *modifier_press_only = TRUE;
/* We keep the keyboard frozen - this allows us to use ReplayKeyboard /* We keep the keyboard frozen - this allows us to use ReplayKeyboard
* on the next event if it's not the release of the modifier key */ * on the next event if it's not the release of the modifier key */
if (xdisplay) if (xdisplay)
{
XIAllowEvents (xdisplay, XIAllowEvents (xdisplay,
meta_input_device_x11_get_device_id (event->device), meta_input_device_x11_get_device_id (device),
XISyncDevice, event->time); XISyncDevice, time_ms);
}
return TRUE; return TRUE;
} }
@ -2145,15 +2165,17 @@ process_iso_next_group (MetaDisplay *display,
{ {
MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBindingManager *keys = &display->key_binding_manager;
gboolean activate; gboolean activate;
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode; xkb_keycode_t keycode =
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
xkb_mod_mask_t mask; xkb_mod_mask_t mask;
int i, j; int i, j;
if (event->type == CLUTTER_KEY_RELEASE) if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
return FALSE; return FALSE;
activate = FALSE; activate = FALSE;
mask = mask_from_event_params (keys, event->modifier_state); mask = mask_from_event_params (keys,
clutter_event_get_state ((ClutterEvent *) event));
for (i = 0; i < keys->n_iso_next_group_combos; ++i) for (i = 0; i < keys->n_iso_next_group_combos; ++i)
{ {
@ -2166,7 +2188,8 @@ process_iso_next_group (MetaDisplay *display,
remain frozen. It's the signal handler's responsibility remain frozen. It's the signal handler's responsibility
to unfreeze it. */ to unfreeze it. */
if (!meta_display_modifiers_accelerator_activate (display)) if (!meta_display_modifiers_accelerator_activate (display))
meta_display_unfreeze_keyboard (display, event->time); meta_display_unfreeze_keyboard (display,
clutter_event_get_time ((ClutterEvent *) event));
activate = TRUE; activate = TRUE;
break; break;
} }
@ -2193,13 +2216,16 @@ process_key_event (MetaDisplay *display,
{ {
MetaContext *context = meta_display_get_context (display); MetaContext *context = meta_display_get_context (display);
MetaBackend *backend = meta_context_get_backend (context); MetaBackend *backend = meta_context_get_backend (context);
ClutterInputDevice *device;
if (META_IS_BACKEND_X11 (backend)) if (META_IS_BACKEND_X11 (backend))
{ {
Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend));
device = clutter_event_get_device ((ClutterEvent *) event);
XIAllowEvents (xdisplay, XIAllowEvents (xdisplay,
meta_input_device_x11_get_device_id (event->device), meta_input_device_x11_get_device_id (device),
XIAsyncDevice, event->time); XIAsyncDevice,
clutter_event_get_time ((ClutterEvent *) event));
} }
} }
@ -2228,7 +2254,7 @@ meta_keybindings_process_event (MetaDisplay *display,
{ {
MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBindingManager *keys = &display->key_binding_manager;
switch (event->type) switch (clutter_event_type (event))
{ {
case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_PRESS:
case CLUTTER_BUTTON_RELEASE: case CLUTTER_BUTTON_RELEASE:
@ -2258,7 +2284,9 @@ handle_switch_to_last_workspace (MetaDisplay *display,
MetaWorkspaceManager *workspace_manager = display->workspace_manager; MetaWorkspaceManager *workspace_manager = display->workspace_manager;
gint target = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1; gint target = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1;
MetaWorkspace *workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, target); MetaWorkspace *workspace = meta_workspace_manager_get_workspace_by_index (workspace_manager, target);
meta_workspace_activate (workspace, event->time);
meta_workspace_activate (workspace,
clutter_event_get_time ((ClutterEvent *) event));
} }
static void static void
@ -2288,7 +2316,8 @@ handle_switch_to_workspace (MetaDisplay *display,
if (workspace) if (workspace)
{ {
meta_workspace_activate (workspace, event->time); meta_workspace_activate (workspace,
clutter_event_get_time ((ClutterEvent *) event));
} }
else else
{ {
@ -2516,10 +2545,13 @@ handle_show_desktop (MetaDisplay *display,
meta_workspace_manager_unshow_desktop (workspace_manager); meta_workspace_manager_unshow_desktop (workspace_manager);
meta_workspace_focus_default_window (workspace_manager->active_workspace, meta_workspace_focus_default_window (workspace_manager->active_workspace,
NULL, NULL,
event->time); clutter_event_get_time ((ClutterEvent *) event));
} }
else else
meta_workspace_manager_show_desktop (workspace_manager, event->time); {
meta_workspace_manager_show_desktop (workspace_manager,
clutter_event_get_time ((ClutterEvent *) event));
}
} }
static void static void
@ -2568,7 +2600,10 @@ do_choose_window (MetaDisplay *display,
backward); backward);
if (window) if (window)
meta_window_activate (window, event->time); {
meta_window_activate (window,
clutter_event_get_time ((ClutterEvent *) event));
}
} }
static void static void
@ -2690,7 +2725,10 @@ handle_close (MetaDisplay *display,
gpointer user_data) gpointer user_data)
{ {
if (window->has_close_func) if (window->has_close_func)
meta_window_delete (window, event->time); {
meta_window_delete (window,
clutter_event_get_time ((ClutterEvent *) event));
}
} }
static void static void
@ -2724,7 +2762,7 @@ handle_begin_move (MetaDisplay *display,
META_GRAB_OP_KEYBOARD_MOVING | META_GRAB_OP_KEYBOARD_MOVING |
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED, META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
device, NULL, device, NULL,
event->time); clutter_event_get_time ((ClutterEvent *) event));
} }
} }
@ -2748,7 +2786,7 @@ handle_begin_resize (MetaDisplay *display,
META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN | META_GRAB_OP_KEYBOARD_RESIZING_UNKNOWN |
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED, META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
device, NULL, device, NULL,
event->time); clutter_event_get_time ((ClutterEvent *) event));
} }
} }
@ -2831,7 +2869,7 @@ handle_move_to_workspace (MetaDisplay *display,
meta_display_clear_mouse_mode (workspace->display); meta_display_clear_mouse_mode (workspace->display);
meta_workspace_activate_with_focus (workspace, meta_workspace_activate_with_focus (workspace,
window, window,
event->time); clutter_event_get_time ((ClutterEvent *) event));
} }
} }
else else
@ -3914,14 +3952,17 @@ process_keybinding_key_event (MetaDisplay *display,
const ClutterKeyEvent *event) const ClutterKeyEvent *event)
{ {
MetaKeyBindingManager *keys = &display->key_binding_manager; MetaKeyBindingManager *keys = &display->key_binding_manager;
xkb_keycode_t keycode = (xkb_keycode_t) event->hardware_keycode; xkb_keycode_t keycode =
(xkb_keycode_t) clutter_event_get_key_code ((ClutterEvent *) event);
MetaResolvedKeyCombo resolved_combo = { &keycode, 1 }; MetaResolvedKeyCombo resolved_combo = { &keycode, 1 };
MetaKeyBinding *binding; MetaKeyBinding *binding;
if (event->type == CLUTTER_KEY_RELEASE) if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE)
return FALSE; return FALSE;
resolved_combo.mask = mask_from_event_params (keys, event->modifier_state); resolved_combo.mask =
mask_from_event_params (keys,
clutter_event_get_state ((ClutterEvent *) event));
binding = get_keybinding (keys, &resolved_combo); binding = get_keybinding (keys, &resolved_combo);
if (!binding) if (!binding)
@ -3948,7 +3989,7 @@ meta_display_process_keybinding_event (MetaDisplay *display,
if (!handler) if (!handler)
return FALSE; return FALSE;
switch (event->type) switch (clutter_event_type (event))
{ {
case CLUTTER_KEY_PRESS: case CLUTTER_KEY_PRESS:
case CLUTTER_KEY_RELEASE: case CLUTTER_KEY_RELEASE:

View File

@ -201,7 +201,7 @@ meta_sequence_info_new (MetaGestureTracker *tracker,
info = g_new0 (MetaSequenceInfo, 1); info = g_new0 (MetaSequenceInfo, 1);
info->tracker = tracker; info->tracker = tracker;
info->sequence = event->touch.sequence; info->sequence = clutter_event_get_event_sequence (event);
info->state = META_SEQUENCE_NONE; info->state = META_SEQUENCE_NONE;
info->autodeny_timeout_id = g_timeout_add (ms, autodeny_sequence, info); info->autodeny_timeout_id = g_timeout_add (ms, autodeny_sequence, info);
@ -437,7 +437,7 @@ meta_gesture_tracker_handle_event (MetaGestureTracker *tracker,
priv = meta_gesture_tracker_get_instance_private (tracker); priv = meta_gesture_tracker_get_instance_private (tracker);
switch (event->type) switch (clutter_event_type (event))
{ {
case CLUTTER_TOUCH_BEGIN: case CLUTTER_TOUCH_BEGIN:
if (g_hash_table_size (priv->sequences) == 0) if (g_hash_table_size (priv->sequences) == 0)

View File

@ -535,22 +535,22 @@ meta_pad_action_mapper_emulate_keybinding (MetaPadActionMapper *mapper,
static gboolean static gboolean
meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper, meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper,
ClutterInputDevice *pad, ClutterInputDevice *pad,
const ClutterPadButtonEvent *event) const ClutterEvent *event)
{ {
GDesktopPadButtonAction action; GDesktopPadButtonAction action;
int button, group, mode, n_modes = 0; int group, n_modes = 0;
gboolean is_press; gboolean is_press;
GSettings *settings; GSettings *settings;
char *accel; char *accel;
uint32_t button, mode;
g_return_val_if_fail (META_IS_PAD_ACTION_MAPPER (mapper), FALSE); g_return_val_if_fail (META_IS_PAD_ACTION_MAPPER (mapper), FALSE);
g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS || g_return_val_if_fail (clutter_event_type (event) == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE, FALSE); clutter_event_type (event) == CLUTTER_PAD_BUTTON_RELEASE, FALSE);
button = event->button; clutter_event_get_pad_details (event, &button, &mode, NULL, NULL);
mode = event->mode;
group = clutter_input_device_get_mode_switch_button_group (pad, button); group = clutter_input_device_get_mode_switch_button_group (pad, button);
is_press = event->type == CLUTTER_PAD_BUTTON_PRESS; is_press = clutter_event_type (event) == CLUTTER_PAD_BUTTON_PRESS;
if (group >= 0) if (group >= 0)
n_modes = clutter_input_device_get_group_n_modes (pad, group); n_modes = clutter_input_device_get_group_n_modes (pad, group);
@ -610,22 +610,20 @@ meta_pad_action_mapper_get_action_direction (MetaPadActionMapper *mapper,
MetaPadFeatureType pad_feature; MetaPadFeatureType pad_feature;
gboolean has_direction = FALSE; gboolean has_direction = FALSE;
MetaPadDirection inc_dir, dec_dir; MetaPadDirection inc_dir, dec_dir;
guint number; uint32_t number;
double value; double value;
switch (event->type) switch (clutter_event_type (event))
{ {
case CLUTTER_PAD_RING: case CLUTTER_PAD_RING:
pad_feature = META_PAD_FEATURE_RING; pad_feature = META_PAD_FEATURE_RING;
number = event->pad_ring.ring_number; clutter_event_get_pad_details (event, &number, NULL, NULL, &value);
value = event->pad_ring.angle;
inc_dir = META_PAD_DIRECTION_CW; inc_dir = META_PAD_DIRECTION_CW;
dec_dir = META_PAD_DIRECTION_CCW; dec_dir = META_PAD_DIRECTION_CCW;
break; break;
case CLUTTER_PAD_STRIP: case CLUTTER_PAD_STRIP:
pad_feature = META_PAD_FEATURE_STRIP; pad_feature = META_PAD_FEATURE_STRIP;
number = event->pad_strip.strip_number; clutter_event_get_pad_details (event, &number, NULL, NULL, &value);
value = event->pad_strip.value;
inc_dir = META_PAD_DIRECTION_DOWN; inc_dir = META_PAD_DIRECTION_DOWN;
dec_dir = META_PAD_DIRECTION_UP; dec_dir = META_PAD_DIRECTION_UP;
break; break;
@ -712,25 +710,25 @@ meta_pad_action_mapper_handle_event (MetaPadActionMapper *mapper,
const ClutterEvent *event) const ClutterEvent *event)
{ {
ClutterInputDevice *pad; ClutterInputDevice *pad;
uint32_t number, mode;
pad = clutter_event_get_source_device ((ClutterEvent *) event); pad = clutter_event_get_source_device ((ClutterEvent *) event);
switch (event->type) switch (clutter_event_type (event))
{ {
case CLUTTER_PAD_BUTTON_PRESS: case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE: case CLUTTER_PAD_BUTTON_RELEASE:
return meta_pad_action_mapper_handle_button (mapper, pad, return meta_pad_action_mapper_handle_button (mapper, pad, event);
&event->pad_button);
case CLUTTER_PAD_RING: case CLUTTER_PAD_RING:
clutter_event_get_pad_details (event, &number, &mode, NULL, NULL);
return meta_pad_action_mapper_handle_action (mapper, pad, event, return meta_pad_action_mapper_handle_action (mapper, pad, event,
META_PAD_FEATURE_RING, META_PAD_FEATURE_RING,
event->pad_ring.ring_number, number, mode);
event->pad_ring.mode);
case CLUTTER_PAD_STRIP: case CLUTTER_PAD_STRIP:
clutter_event_get_pad_details (event, &number, &mode, NULL, NULL);
return meta_pad_action_mapper_handle_action (mapper, pad, event, return meta_pad_action_mapper_handle_action (mapper, pad, event,
META_PAD_FEATURE_STRIP, META_PAD_FEATURE_STRIP,
event->pad_strip.strip_number, number, mode);
event->pad_strip.mode);
default: default:
return FALSE; return FALSE;
} }

View File

@ -7512,17 +7512,22 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
gboolean is_window_button_grab_allowed; gboolean is_window_button_grab_allowed;
ClutterModifierType grab_mods, event_mods; ClutterModifierType grab_mods, event_mods;
ClutterInputDevice *source; ClutterInputDevice *source;
ClutterEventType event_type;
uint32_t time_ms;
gfloat x, y; gfloat x, y;
guint button; guint button;
if (window->unmanaging) if (window->unmanaging)
return; return;
if (event->type != CLUTTER_BUTTON_PRESS && event_type = clutter_event_type (event);
event->type != CLUTTER_TOUCH_BEGIN) time_ms = clutter_event_get_time (event);
if (event_type != CLUTTER_BUTTON_PRESS &&
event_type != CLUTTER_TOUCH_BEGIN)
return; return;
if (event->type == CLUTTER_TOUCH_BEGIN) if (event_type == CLUTTER_TOUCH_BEGIN)
{ {
ClutterEventSequence *sequence; ClutterEventSequence *sequence;
@ -7549,8 +7554,8 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
meta_topic (META_DEBUG_FOCUS, meta_topic (META_DEBUG_FOCUS,
"Focusing %s due to button %u press (display.c)", "Focusing %s due to button %u press (display.c)",
window->desc, button); window->desc, button);
meta_window_focus (window, event->any.time); meta_window_focus (window, time_ms);
meta_window_check_alive (window, event->any.time); meta_window_check_alive (window, time_ms);
} }
/* We have three passive button grabs: /* We have three passive button grabs:
@ -7624,7 +7629,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
op, op,
clutter_event_get_device (event), clutter_event_get_device (event),
clutter_event_get_event_sequence (event), clutter_event_get_event_sequence (event),
event->any.time); time_ms);
} }
} }
} }
@ -7645,7 +7650,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window,
META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED, META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED,
clutter_event_get_device (event), clutter_event_get_device (event),
clutter_event_get_event_sequence (event), clutter_event_get_event_sequence (event),
event->any.time); time_ms);
} }
} }
} }