From 2c86bff0ccd780b8da2fe82af2d174f534de6820 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 3 Aug 2023 12:46:35 +0200 Subject: [PATCH] backends/x11: Drop clutter_event_set_state_full() helpers Since the full decomposed modifier state is unused, and only the effective modifier mask matters to users, the new constructors take just this effective modifier mask. This means this helper went unused in the port to the new constructors, so can be now dropped. Part-of: --- src/backends/x11/meta-input-device-x11.c | 78 ------------------------ src/backends/x11/meta-input-device-x11.h | 4 -- 2 files changed, 82 deletions(-) diff --git a/src/backends/x11/meta-input-device-x11.c b/src/backends/x11/meta-input-device-x11.c index 5f0c582b1..eb1a838fb 100644 --- a/src/backends/x11/meta-input-device-x11.c +++ b/src/backends/x11/meta-input-device-x11.c @@ -379,84 +379,6 @@ meta_input_device_x11_init (MetaInputDeviceX11 *self) { } -static ClutterModifierType -get_modifier_for_button (int i) -{ - switch (i) - { - case 1: - return CLUTTER_BUTTON1_MASK; - case 2: - return CLUTTER_BUTTON2_MASK; - case 3: - return CLUTTER_BUTTON3_MASK; - case 4: - return CLUTTER_BUTTON4_MASK; - case 5: - return CLUTTER_BUTTON5_MASK; - default: - return 0; - } -} - -void -meta_input_device_x11_translate_state (ClutterEvent *event, - XIModifierState *modifiers_state, - XIButtonState *buttons_state, - XIGroupState *group_state) -{ - uint32_t button = 0; - uint32_t base = 0; - uint32_t latched = 0; - uint32_t locked = 0; - uint32_t effective; - - if (modifiers_state) - { - base = (uint32_t) modifiers_state->base; - latched = (uint32_t) modifiers_state->latched; - locked = (uint32_t) modifiers_state->locked; - } - - if (buttons_state) - { - int len, i; - - len = MIN (N_BUTTONS, buttons_state->mask_len * 8); - - for (i = 0; i < len; i++) - { - if (!XIMaskIsSet (buttons_state->mask, i)) - continue; - - button |= get_modifier_for_button (i); - } - } - - /* The XIButtonState sent in the event specifies the - * state of the buttons before the event. In order to - * get the current state of the buttons, we need to - * filter out the current button. - */ - switch (event->type) - { - case CLUTTER_BUTTON_PRESS: - button |= (get_modifier_for_button (event->button.button)); - break; - case CLUTTER_BUTTON_RELEASE: - button &= ~(get_modifier_for_button (event->button.button)); - break; - default: - break; - } - - effective = button | base | latched | locked; - if (group_state) - effective |= (group_state->effective) << 13; - - _clutter_event_set_state_full (event, button, base, latched, locked, effective); -} - void meta_input_device_x11_update_tool (ClutterInputDevice *device, ClutterInputDeviceTool *tool) diff --git a/src/backends/x11/meta-input-device-x11.h b/src/backends/x11/meta-input-device-x11.h index 1ea85aa14..1d563213f 100644 --- a/src/backends/x11/meta-input-device-x11.h +++ b/src/backends/x11/meta-input-device-x11.h @@ -42,10 +42,6 @@ typedef struct _MetaInputDeviceX11Class MetaInputDeviceX11Class; GType meta_input_device_x11_get_type (void) G_GNUC_CONST; -void meta_input_device_x11_translate_state (ClutterEvent *event, - XIModifierState *modifiers_state, - XIButtonState *buttons_state, - XIGroupState *group_state); void meta_input_device_x11_update_tool (ClutterInputDevice *device, ClutterInputDeviceTool *tool); ClutterInputDeviceTool * meta_input_device_x11_get_current_tool (ClutterInputDevice *device);