mirror of
https://github.com/brl/mutter.git
synced 2024-11-24 17:10:40 -05:00
backends/native: Implement ClutterSeat::query_state() vmethod
https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1403
This commit is contained in:
parent
4766e2f858
commit
292b4dd605
@ -2762,6 +2762,54 @@ meta_seat_native_warp_pointer (ClutterSeat *seat,
|
||||
meta_cursor_tracker_update_position (cursor_tracker, x, y);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
meta_seat_native_query_state (ClutterSeat *seat,
|
||||
ClutterInputDevice *device,
|
||||
ClutterEventSequence *sequence,
|
||||
graphene_point_t *coords,
|
||||
ClutterModifierType *modifiers)
|
||||
{
|
||||
MetaSeatNative *seat_native = META_SEAT_NATIVE (seat);
|
||||
|
||||
if (sequence)
|
||||
{
|
||||
MetaTouchState *touch_state;
|
||||
int slot;
|
||||
|
||||
slot = meta_event_native_sequence_get_slot (sequence);
|
||||
touch_state = meta_seat_native_lookup_touch_state (seat_native, slot);
|
||||
if (!touch_state)
|
||||
return FALSE;
|
||||
|
||||
if (coords)
|
||||
{
|
||||
coords->x = touch_state->coords.x;
|
||||
coords->y = touch_state->coords.y;
|
||||
}
|
||||
|
||||
if (modifiers)
|
||||
*modifiers = meta_xkb_translate_modifiers (seat_native->xkb, 0);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (coords)
|
||||
{
|
||||
coords->x = device->current_x;
|
||||
coords->y = device->current_y;
|
||||
}
|
||||
|
||||
if (modifiers)
|
||||
{
|
||||
*modifiers = meta_xkb_translate_modifiers (seat_native->xkb,
|
||||
seat_native->button_state);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
{
|
||||
@ -2787,6 +2835,7 @@ meta_seat_native_class_init (MetaSeatNativeClass *klass)
|
||||
seat_class->compress_motion = meta_seat_native_compress_motion;
|
||||
seat_class->warp_pointer = meta_seat_native_warp_pointer;
|
||||
seat_class->handle_device_event = meta_seat_native_handle_device_event;
|
||||
seat_class->query_state = meta_seat_native_query_state;
|
||||
|
||||
props[PROP_SEAT_ID] =
|
||||
g_param_spec_string ("seat-id",
|
||||
|
@ -106,3 +106,10 @@ meta_xkb_translate_state (ClutterEvent *event,
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_LOCKED),
|
||||
xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE) | button_state);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
meta_xkb_translate_modifiers (struct xkb_state *state,
|
||||
uint32_t button_state)
|
||||
{
|
||||
return xkb_state_serialize_mods (state, XKB_STATE_MODS_EFFECTIVE) | button_state;
|
||||
}
|
||||
|
@ -35,5 +35,7 @@ ClutterEvent * meta_key_event_new_from_evdev (ClutterInputDevice *device,
|
||||
void meta_xkb_translate_state (ClutterEvent *event,
|
||||
struct xkb_state *xkb_state,
|
||||
uint32_t button_state);
|
||||
uint32_t meta_xkb_translate_modifiers (struct xkb_state *state,
|
||||
uint32_t button_state);
|
||||
|
||||
#endif /* META_XKB_UTILS_H */
|
||||
|
Loading…
Reference in New Issue
Block a user