From 17191d5a6c84d0bdc6009f2397af2a1f0ee1585b Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Fri, 4 Aug 2023 12:29:27 +0200 Subject: [PATCH] core: Use ClutterEvent getter methods Part-of: --- src/core/display.c | 2 +- src/core/events.c | 91 +++++++++++--------- src/core/keybindings.c | 133 +++++++++++++++++++----------- src/core/meta-gesture-tracker.c | 4 +- src/core/meta-pad-action-mapper.c | 42 +++++----- src/core/window.c | 19 +++-- 6 files changed, 173 insertions(+), 118 deletions(-) diff --git a/src/core/display.c b/src/core/display.c index 09290f1a1..062e0fd13 100644 --- a/src/core/display.c +++ b/src/core/display.c @@ -2480,7 +2480,7 @@ meta_display_accelerator_activate (MetaDisplay *display, g_signal_emit (display, display_signals[ACCELERATOR_ACTIVATED], 0, action, clutter_event_get_source_device ((const ClutterEvent *) event), - event->time); + clutter_event_get_time ((const ClutterEvent *) event)); } gboolean diff --git a/src/core/events.c b/src/core/events.c index c5d7cecd9..3a60ee015 100644 --- a/src/core/events.c +++ b/src/core/events.c @@ -46,16 +46,16 @@ #include "wayland/meta-wayland-private.h" #endif -#define IS_GESTURE_EVENT(e) ((e)->type == CLUTTER_TOUCHPAD_SWIPE || \ - (e)->type == CLUTTER_TOUCHPAD_PINCH || \ - (e)->type == CLUTTER_TOUCHPAD_HOLD || \ - (e)->type == CLUTTER_TOUCH_BEGIN || \ - (e)->type == CLUTTER_TOUCH_UPDATE || \ - (e)->type == CLUTTER_TOUCH_END || \ - (e)->type == CLUTTER_TOUCH_CANCEL) +#define IS_GESTURE_EVENT(et) ((et) == CLUTTER_TOUCHPAD_SWIPE || \ + (et) == CLUTTER_TOUCHPAD_PINCH || \ + (et) == CLUTTER_TOUCHPAD_HOLD || \ + (et) == CLUTTER_TOUCH_BEGIN || \ + (et) == CLUTTER_TOUCH_UPDATE || \ + (et) == CLUTTER_TOUCH_END || \ + (et) == CLUTTER_TOUCH_CANCEL) -#define IS_KEY_EVENT(e) ((e)->type == CLUTTER_KEY_PRESS || \ - (e)->type == CLUTTER_KEY_RELEASE) +#define IS_KEY_EVENT(et) ((et) == CLUTTER_KEY_PRESS || \ + (et) == CLUTTER_KEY_RELEASE) typedef enum { @@ -99,7 +99,7 @@ get_window_for_event (MetaDisplay *display, return NULL; /* 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 : NULL; @@ -119,13 +119,18 @@ handle_idletime_for_event (MetaDisplay *display, MetaContext *context = meta_display_get_context (display); MetaBackend *backend = meta_context_get_backend (context); MetaIdleManager *idle_manager; + ClutterEventType event_type; + ClutterEventFlags flags; if (clutter_event_get_device (event) == NULL) return; - if (event->any.flags & CLUTTER_EVENT_FLAG_SYNTHETIC || - event->type == CLUTTER_ENTER || - event->type == CLUTTER_LEAVE) + flags = clutter_event_get_flags (event); + event_type = clutter_event_type (event); + + if (flags & CLUTTER_EVENT_FLAG_SYNTHETIC || + event_type == CLUTTER_ENTER || + event_type == CLUTTER_LEAVE) return; 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); - if (event->type == CLUTTER_TOUCH_BEGIN && + if (clutter_event_type (event) == CLUTTER_TOUCH_BEGIN && meta_gesture_tracker_get_n_current_touches (tracker) == 0) return TRUE; } @@ -183,8 +188,9 @@ maybe_unfreeze_pointer_events (MetaBackend *backend, Display *xdisplay; int event_mode; int device_id; + uint32_t time_ms; - if (event->type != CLUTTER_BUTTON_PRESS) + if (clutter_event_type (event) != CLUTTER_BUTTON_PRESS) return; if (!META_IS_BACKEND_X11 (backend)) @@ -192,17 +198,18 @@ maybe_unfreeze_pointer_events (MetaBackend *backend, device = clutter_event_get_device (event); device_id = meta_input_device_x11_get_device_id (device); + time_ms = clutter_event_get_time (event); switch (unfreeze_method) { case EVENTS_UNFREEZE_SYNC: event_mode = XISyncDevice; meta_verbose ("Syncing events time %u device %i", - (unsigned int) event->button.time, device_id); + (unsigned int) time_ms, device_id); break; case EVENTS_UNFREEZE_REPLAY: event_mode = XIReplayDevice; meta_verbose ("Replaying events time %u device %i", - (unsigned int) event->button.time, device_id); + (unsigned int) time_ms, device_id); break; default: g_assert_not_reached (); @@ -210,7 +217,7 @@ maybe_unfreeze_pointer_events (MetaBackend *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 @@ -228,7 +235,9 @@ meta_display_handle_event (MetaDisplay *display, G_GNUC_UNUSED gboolean bypass_wayland = FALSE; MetaGestureTracker *gesture_tracker; ClutterEventSequence *sequence; + ClutterEventType event_type; gboolean has_grab; + uint32_t time_ms; #ifdef HAVE_WAYLAND MetaWaylandCompositor *wayland_compositor; 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)) { bypass_clutter = TRUE; @@ -272,10 +285,8 @@ meta_display_handle_event (MetaDisplay *display, device = clutter_event_get_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 */ - if (event->type == CLUTTER_TOUCH_BEGIN) + if (event_type == CLUTTER_TOUCH_BEGIN) { if (sequence_is_pointer_emulated (display, event)) { @@ -309,16 +320,16 @@ meta_display_handle_event (MetaDisplay *display, meta_wayland_compositor_update (wayland_compositor, event); #endif - if (event->type == CLUTTER_PAD_BUTTON_PRESS || - event->type == CLUTTER_PAD_BUTTON_RELEASE || - event->type == CLUTTER_PAD_RING || - event->type == CLUTTER_PAD_STRIP) + if (event_type == CLUTTER_PAD_BUTTON_PRESS || + event_type == CLUTTER_PAD_BUTTON_RELEASE || + event_type == CLUTTER_PAD_RING || + event_type == CLUTTER_PAD_STRIP) { gboolean handle_pad_event; gboolean is_mode_switch = FALSE; - if (event->type == CLUTTER_PAD_BUTTON_PRESS || - event->type == CLUTTER_PAD_BUTTON_RELEASE) + if (event_type == CLUTTER_PAD_BUTTON_PRESS || + event_type == CLUTTER_PAD_BUTTON_RELEASE) { ClutterInputDevice *pad; uint32_t button; @@ -340,11 +351,11 @@ meta_display_handle_event (MetaDisplay *display, } } - if (event->type != CLUTTER_DEVICE_ADDED && - event->type != CLUTTER_DEVICE_REMOVED) + if (event_type != CLUTTER_DEVICE_ADDED && + event_type != CLUTTER_DEVICE_REMOVED) handle_idletime_for_event (display, event); - if (event->type == CLUTTER_MOTION) + if (event_type == CLUTTER_MOTION) { ClutterInputDevice *device; @@ -372,12 +383,12 @@ meta_display_handle_event (MetaDisplay *display, 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 && - (event->type == CLUTTER_KEY_PRESS || - event->type == CLUTTER_BUTTON_PRESS || - event->type == CLUTTER_TOUCH_BEGIN)) + (event_type == CLUTTER_KEY_PRESS || + event_type == CLUTTER_BUTTON_PRESS || + event_type == CLUTTER_TOUCH_BEGIN)) { if (META_CURRENT_TIME == display->current_time) { @@ -426,7 +437,7 @@ meta_display_handle_event (MetaDisplay *display, */ 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; goto out; @@ -434,7 +445,7 @@ meta_display_handle_event (MetaDisplay *display, } if (meta_is_wayland_compositor () && - event->type == CLUTTER_SCROLL && + event_type == CLUTTER_SCROLL && meta_prefs_get_mouse_button_mods () > 0) { ClutterModifierType grab_mods; @@ -478,7 +489,7 @@ meta_display_handle_event (MetaDisplay *display, * - CLUTTER_TOUCHPAD_* events over windows. These can likewise * 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); if ( @@ -537,9 +548,9 @@ meta_display_handle_event (MetaDisplay *display, if (wayland_compositor && !bypass_wayland) { - if (window && event->type == CLUTTER_MOTION && - event->any.time != CLUTTER_CURRENT_TIME) - meta_window_check_alive_on_event (window, event->any.time); + if (window && event_type == CLUTTER_MOTION && + time_ms != CLUTTER_CURRENT_TIME) + meta_window_check_alive_on_event (window, time_ms); if (meta_wayland_compositor_handle_event (wayland_compositor, event)) bypass_clutter = TRUE; diff --git a/src/core/keybindings.c b/src/core/keybindings.c index 59d57fc88..086796d16 100644 --- a/src/core/keybindings.c +++ b/src/core/keybindings.c @@ -1902,15 +1902,18 @@ process_event (MetaDisplay *display, ClutterKeyEvent *event) { 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 }; MetaKeyBinding *binding; /* 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; - 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); @@ -1945,7 +1948,7 @@ process_event (MetaDisplay *display, if (meta_compositor_filter_keybinding (display->compositor, binding)) 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) { meta_topic (META_DEBUG_KEYBINDINGS, @@ -1978,6 +1981,10 @@ process_special_modifier_key (MetaDisplay *display, { MetaKeyBindingManager *keys = &display->key_binding_manager; MetaBackend *backend = keys->backend; + ClutterInputDevice *device; + ClutterModifierType modifiers; + uint32_t time_ms; + uint32_t hardware_keycode; Display *xdisplay; if (META_IS_BACKEND_X11 (backend)) @@ -1985,10 +1992,14 @@ process_special_modifier_key (MetaDisplay *display, else 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 (! resolved_key_combo_has_keycode (resolved_key_combo, - event->hardware_keycode)) + if (! resolved_key_combo_has_keycode (resolved_key_combo, hardware_keycode)) { *modifier_press_only = FALSE; @@ -2019,21 +2030,25 @@ process_special_modifier_key (MetaDisplay *display, * windows */ if (xdisplay) - XIAllowEvents (xdisplay, - meta_input_device_x11_get_device_id (event->device), - XIAsyncDevice, event->time); + { + XIAllowEvents (xdisplay, + meta_input_device_x11_get_device_id (device), + XIAsyncDevice, time_ms); + } } else { /* Replay the event so it gets delivered to our * per-window key bindings or to the application */ if (xdisplay) - XIAllowEvents (xdisplay, - meta_input_device_x11_get_device_id (event->device), - XIReplayDevice, event->time); + { + XIAllowEvents (xdisplay, + meta_input_device_x11_get_device_id (device), + XIReplayDevice, time_ms); + } } } - else if (event->type == CLUTTER_KEY_RELEASE) + else if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE) { 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 * starts typing into the overlay we get all the keys */ if (xdisplay) - XIAllowEvents (xdisplay, - meta_input_device_x11_get_device_id (event->device), - XIAsyncDevice, event->time); + { + XIAllowEvents (xdisplay, + meta_input_device_x11_get_device_id (device), + XIAsyncDevice, time_ms); + } binding = get_keybinding (keys, resolved_key_combo); if (binding && @@ -2067,25 +2084,28 @@ process_special_modifier_key (MetaDisplay *display, * https://bugzilla.gnome.org/show_bug.cgi?id=666101 */ if (xdisplay) - XIAllowEvents (xdisplay, - meta_input_device_x11_get_device_id (event->device), - XIAsyncDevice, event->time); + { + XIAllowEvents (xdisplay, + meta_input_device_x11_get_device_id (device), + XIAsyncDevice, time_ms); + } } return TRUE; } - else if (event->type == CLUTTER_KEY_PRESS && - ((event->modifier_state & ~(IGNORED_MODIFIERS)) & CLUTTER_MODIFIER_MASK) == 0 && - resolved_key_combo_has_keycode (resolved_key_combo, - event->hardware_keycode)) + else if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_PRESS && + ((modifiers & ~(IGNORED_MODIFIERS)) & CLUTTER_MODIFIER_MASK) == 0 && + resolved_key_combo_has_keycode (resolved_key_combo, hardware_keycode)) { *modifier_press_only = TRUE; /* 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 */ if (xdisplay) - XIAllowEvents (xdisplay, - meta_input_device_x11_get_device_id (event->device), - XISyncDevice, event->time); + { + XIAllowEvents (xdisplay, + meta_input_device_x11_get_device_id (device), + XISyncDevice, time_ms); + } return TRUE; } @@ -2145,15 +2165,17 @@ process_iso_next_group (MetaDisplay *display, { MetaKeyBindingManager *keys = &display->key_binding_manager; 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; int i, j; - if (event->type == CLUTTER_KEY_RELEASE) + if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE) return 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) { @@ -2166,7 +2188,8 @@ process_iso_next_group (MetaDisplay *display, remain frozen. It's the signal handler's responsibility to unfreeze it. */ 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; break; } @@ -2193,13 +2216,16 @@ process_key_event (MetaDisplay *display, { MetaContext *context = meta_display_get_context (display); MetaBackend *backend = meta_context_get_backend (context); + ClutterInputDevice *device; if (META_IS_BACKEND_X11 (backend)) { Display *xdisplay = meta_backend_x11_get_xdisplay (META_BACKEND_X11 (backend)); + device = clutter_event_get_device ((ClutterEvent *) event); XIAllowEvents (xdisplay, - meta_input_device_x11_get_device_id (event->device), - XIAsyncDevice, event->time); + meta_input_device_x11_get_device_id (device), + XIAsyncDevice, + clutter_event_get_time ((ClutterEvent *) event)); } } @@ -2228,7 +2254,7 @@ meta_keybindings_process_event (MetaDisplay *display, { MetaKeyBindingManager *keys = &display->key_binding_manager; - switch (event->type) + switch (clutter_event_type (event)) { case CLUTTER_BUTTON_PRESS: case CLUTTER_BUTTON_RELEASE: @@ -2258,7 +2284,9 @@ handle_switch_to_last_workspace (MetaDisplay *display, MetaWorkspaceManager *workspace_manager = display->workspace_manager; gint target = meta_workspace_manager_get_n_workspaces (workspace_manager) - 1; 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 @@ -2288,7 +2316,8 @@ handle_switch_to_workspace (MetaDisplay *display, if (workspace) { - meta_workspace_activate (workspace, event->time); + meta_workspace_activate (workspace, + clutter_event_get_time ((ClutterEvent *) event)); } else { @@ -2516,10 +2545,13 @@ handle_show_desktop (MetaDisplay *display, meta_workspace_manager_unshow_desktop (workspace_manager); meta_workspace_focus_default_window (workspace_manager->active_workspace, NULL, - event->time); + clutter_event_get_time ((ClutterEvent *) event)); } 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 @@ -2568,7 +2600,10 @@ do_choose_window (MetaDisplay *display, backward); if (window) - meta_window_activate (window, event->time); + { + meta_window_activate (window, + clutter_event_get_time ((ClutterEvent *) event)); + } } static void @@ -2690,7 +2725,10 @@ handle_close (MetaDisplay *display, gpointer user_data) { if (window->has_close_func) - meta_window_delete (window, event->time); + { + meta_window_delete (window, + clutter_event_get_time ((ClutterEvent *) event)); + } } static void @@ -2724,7 +2762,7 @@ handle_begin_move (MetaDisplay *display, META_GRAB_OP_KEYBOARD_MOVING | META_GRAB_OP_WINDOW_FLAG_UNCONSTRAINED, 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_WINDOW_FLAG_UNCONSTRAINED, 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_workspace_activate_with_focus (workspace, window, - event->time); + clutter_event_get_time ((ClutterEvent *) event)); } } else @@ -3914,14 +3952,17 @@ process_keybinding_key_event (MetaDisplay *display, const ClutterKeyEvent *event) { 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 }; MetaKeyBinding *binding; - if (event->type == CLUTTER_KEY_RELEASE) + if (clutter_event_type ((ClutterEvent *) event) == CLUTTER_KEY_RELEASE) 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); if (!binding) @@ -3948,7 +3989,7 @@ meta_display_process_keybinding_event (MetaDisplay *display, if (!handler) return FALSE; - switch (event->type) + switch (clutter_event_type (event)) { case CLUTTER_KEY_PRESS: case CLUTTER_KEY_RELEASE: diff --git a/src/core/meta-gesture-tracker.c b/src/core/meta-gesture-tracker.c index dd973d59b..3e18d27e8 100644 --- a/src/core/meta-gesture-tracker.c +++ b/src/core/meta-gesture-tracker.c @@ -201,7 +201,7 @@ meta_sequence_info_new (MetaGestureTracker *tracker, info = g_new0 (MetaSequenceInfo, 1); info->tracker = tracker; - info->sequence = event->touch.sequence; + info->sequence = clutter_event_get_event_sequence (event); info->state = META_SEQUENCE_NONE; 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); - switch (event->type) + switch (clutter_event_type (event)) { case CLUTTER_TOUCH_BEGIN: if (g_hash_table_size (priv->sequences) == 0) diff --git a/src/core/meta-pad-action-mapper.c b/src/core/meta-pad-action-mapper.c index 8f845f18f..648f60059 100644 --- a/src/core/meta-pad-action-mapper.c +++ b/src/core/meta-pad-action-mapper.c @@ -533,24 +533,24 @@ meta_pad_action_mapper_emulate_keybinding (MetaPadActionMapper *mapper, } static gboolean -meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper, - ClutterInputDevice *pad, - const ClutterPadButtonEvent *event) +meta_pad_action_mapper_handle_button (MetaPadActionMapper *mapper, + ClutterInputDevice *pad, + const ClutterEvent *event) { GDesktopPadButtonAction action; - int button, group, mode, n_modes = 0; + int group, n_modes = 0; gboolean is_press; GSettings *settings; char *accel; + uint32_t button, mode; g_return_val_if_fail (META_IS_PAD_ACTION_MAPPER (mapper), FALSE); - g_return_val_if_fail (event->type == CLUTTER_PAD_BUTTON_PRESS || - event->type == CLUTTER_PAD_BUTTON_RELEASE, FALSE); + g_return_val_if_fail (clutter_event_type (event) == CLUTTER_PAD_BUTTON_PRESS || + clutter_event_type (event) == CLUTTER_PAD_BUTTON_RELEASE, FALSE); - button = event->button; - mode = event->mode; + clutter_event_get_pad_details (event, &button, &mode, NULL, NULL); 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) 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; gboolean has_direction = FALSE; MetaPadDirection inc_dir, dec_dir; - guint number; + uint32_t number; double value; - switch (event->type) + switch (clutter_event_type (event)) { case CLUTTER_PAD_RING: pad_feature = META_PAD_FEATURE_RING; - number = event->pad_ring.ring_number; - value = event->pad_ring.angle; + clutter_event_get_pad_details (event, &number, NULL, NULL, &value); inc_dir = META_PAD_DIRECTION_CW; dec_dir = META_PAD_DIRECTION_CCW; break; case CLUTTER_PAD_STRIP: pad_feature = META_PAD_FEATURE_STRIP; - number = event->pad_strip.strip_number; - value = event->pad_strip.value; + clutter_event_get_pad_details (event, &number, NULL, NULL, &value); inc_dir = META_PAD_DIRECTION_DOWN; dec_dir = META_PAD_DIRECTION_UP; break; @@ -712,25 +710,25 @@ meta_pad_action_mapper_handle_event (MetaPadActionMapper *mapper, const ClutterEvent *event) { ClutterInputDevice *pad; + uint32_t number, mode; 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_RELEASE: - return meta_pad_action_mapper_handle_button (mapper, pad, - &event->pad_button); + return meta_pad_action_mapper_handle_button (mapper, pad, event); case CLUTTER_PAD_RING: + clutter_event_get_pad_details (event, &number, &mode, NULL, NULL); return meta_pad_action_mapper_handle_action (mapper, pad, event, META_PAD_FEATURE_RING, - event->pad_ring.ring_number, - event->pad_ring.mode); + number, mode); case CLUTTER_PAD_STRIP: + clutter_event_get_pad_details (event, &number, &mode, NULL, NULL); return meta_pad_action_mapper_handle_action (mapper, pad, event, META_PAD_FEATURE_STRIP, - event->pad_strip.strip_number, - event->pad_strip.mode); + number, mode); default: return FALSE; } diff --git a/src/core/window.c b/src/core/window.c index ec9f73e4e..aa886ffaf 100644 --- a/src/core/window.c +++ b/src/core/window.c @@ -7512,17 +7512,22 @@ meta_window_handle_ungrabbed_event (MetaWindow *window, gboolean is_window_button_grab_allowed; ClutterModifierType grab_mods, event_mods; ClutterInputDevice *source; + ClutterEventType event_type; + uint32_t time_ms; gfloat x, y; guint button; if (window->unmanaging) return; - if (event->type != CLUTTER_BUTTON_PRESS && - event->type != CLUTTER_TOUCH_BEGIN) + event_type = clutter_event_type (event); + time_ms = clutter_event_get_time (event); + + if (event_type != CLUTTER_BUTTON_PRESS && + event_type != CLUTTER_TOUCH_BEGIN) return; - if (event->type == CLUTTER_TOUCH_BEGIN) + if (event_type == CLUTTER_TOUCH_BEGIN) { ClutterEventSequence *sequence; @@ -7549,8 +7554,8 @@ meta_window_handle_ungrabbed_event (MetaWindow *window, meta_topic (META_DEBUG_FOCUS, "Focusing %s due to button %u press (display.c)", window->desc, button); - meta_window_focus (window, event->any.time); - meta_window_check_alive (window, event->any.time); + meta_window_focus (window, time_ms); + meta_window_check_alive (window, time_ms); } /* We have three passive button grabs: @@ -7624,7 +7629,7 @@ meta_window_handle_ungrabbed_event (MetaWindow *window, op, clutter_event_get_device (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, clutter_event_get_device (event), clutter_event_get_event_sequence (event), - event->any.time); + time_ms); } } }