backends/x11: 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:36:05 +02:00
parent dbbfd03436
commit 60aa098e94
2 changed files with 18 additions and 16 deletions

View File

@ -80,7 +80,7 @@ meta_backend_x11_handle_event (MetaBackend *backend,
* two extra times to pump the enter/leave events through (otherwise they * two extra times to pump the enter/leave events through (otherwise they
* just get pushed down the queue and never processed). * just get pushed down the queue and never processed).
*/ */
if (event->type == CLUTTER_MOTION) if (clutter_event_type (event) == CLUTTER_MOTION)
spin += 2; spin += 2;
while (spin > 0 && (event = clutter_event_get ())) while (spin > 0 && (event = clutter_event_get ()))

View File

@ -813,10 +813,13 @@ meta_seat_x11_handle_event_post (ClutterSeat *seat,
MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat); MetaSeatX11 *seat_x11 = META_SEAT_X11 (seat);
ClutterInputDevice *device; ClutterInputDevice *device;
MetaInputSettings *input_settings; MetaInputSettings *input_settings;
ClutterEventType event_type;
gboolean is_touch; gboolean is_touch;
if (event->type != CLUTTER_DEVICE_ADDED && event_type = clutter_event_type (event);
event->type != CLUTTER_DEVICE_REMOVED)
if (event_type != CLUTTER_DEVICE_ADDED &&
event_type != CLUTTER_DEVICE_REMOVED)
return TRUE; return TRUE;
device = clutter_event_get_device (event); device = clutter_event_get_device (event);
@ -824,7 +827,7 @@ meta_seat_x11_handle_event_post (ClutterSeat *seat,
clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE; clutter_input_device_get_device_type (device) == CLUTTER_TOUCHSCREEN_DEVICE;
input_settings = meta_backend_get_input_settings (seat_x11->backend); input_settings = meta_backend_get_input_settings (seat_x11->backend);
switch (event->type) switch (event_type)
{ {
case CLUTTER_DEVICE_ADDED: case CLUTTER_DEVICE_ADDED:
meta_input_settings_add_device (input_settings, device); meta_input_settings_add_device (input_settings, device);
@ -2159,7 +2162,7 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
unicode_value); unicode_value);
g_debug ("%s: win:0x%x device:%d source:%d, key: %12s (%d)", g_debug ("%s: win:0x%x device:%d source:%d, key: %12s (%d)",
event->any.type == CLUTTER_KEY_PRESS clutter_event_type (event) == CLUTTER_KEY_PRESS
? "key press " ? "key press "
: "key release", : "key release",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
@ -2284,14 +2287,13 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
meta_input_device_x11_get_device_id (device), meta_input_device_x11_get_device_id (device),
clutter_input_device_get_device_name (device), clutter_input_device_get_device_name (device),
event->any.time, clutter_event_get_time (event),
event->scroll.direction == CLUTTER_SCROLL_UP ? "up" : scroll_direction == CLUTTER_SCROLL_UP ? "up" :
event->scroll.direction == CLUTTER_SCROLL_DOWN ? "down" : scroll_direction == CLUTTER_SCROLL_DOWN ? "down" :
event->scroll.direction == CLUTTER_SCROLL_LEFT ? "left" : scroll_direction == CLUTTER_SCROLL_LEFT ? "left" :
event->scroll.direction == CLUTTER_SCROLL_RIGHT ? "right" : scroll_direction == CLUTTER_SCROLL_RIGHT ? "right" :
"invalid", "invalid",
event->scroll.x, x, y,
event->scroll.y,
(xev->flags & XIPointerEmulated) ? "yes" : "no"); (xev->flags & XIPointerEmulated) ? "yes" : "no");
break; break;
@ -2401,8 +2403,8 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
g_debug ("smooth scroll: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, delta:%f, %f)", g_debug ("smooth scroll: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, delta:%f, %f)",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
meta_input_device_x11_get_device_id (event->scroll.device), meta_input_device_x11_get_device_id (source_device),
clutter_input_device_get_device_name (event->scroll.device), clutter_input_device_get_device_name (source_device),
x, y, x, y,
delta_x, delta_y); delta_x, delta_y);
break; break;
@ -2424,8 +2426,8 @@ meta_seat_x11_translate_event (MetaSeatX11 *seat,
g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)", g_debug ("motion: win:0x%x device:%d '%s' (x:%.2f, y:%.2f, axes:%s)",
(unsigned int) stage_x11->xwin, (unsigned int) stage_x11->xwin,
meta_input_device_x11_get_device_id (event->motion.device), meta_input_device_x11_get_device_id (source_device),
clutter_input_device_get_device_name (event->motion.device), clutter_input_device_get_device_name (source_device),
x, y, x, y,
axes != NULL ? "yes" : "no"); axes != NULL ? "yes" : "no");
} }