clutter: Move evdev evcode data to Clutter button/key events
We have this as platform-dependent data in the native backend, and a bunch of fallback code done in place in the evcode users. Stop making this platform-dependent data, and move it to the relevant ClutterEvents. The fallback code for the X11 backend case is about the same, but now it is done directly by the X11 backend. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/1623>
This commit is contained in:

committed by
Marge Bot

parent
09b956997c
commit
9f5c453fc7
@ -58,11 +58,6 @@
|
||||
#include "core/meta-anonymous-file.h"
|
||||
#include "wayland/meta-wayland-private.h"
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
#include "backends/native/meta-event-native.h"
|
||||
#endif
|
||||
|
||||
#define GSD_KEYBOARD_SCHEMA "org.gnome.settings-daemon.peripherals.keyboard"
|
||||
|
||||
G_DEFINE_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard,
|
||||
@ -70,7 +65,6 @@ G_DEFINE_TYPE (MetaWaylandKeyboard, meta_wayland_keyboard,
|
||||
|
||||
static void meta_wayland_keyboard_update_xkb_state (MetaWaylandKeyboard *keyboard);
|
||||
static void notify_modifiers (MetaWaylandKeyboard *keyboard);
|
||||
static guint evdev_code (const ClutterKeyEvent *event);
|
||||
|
||||
static void
|
||||
unbind_resource (struct wl_resource *resource)
|
||||
@ -491,21 +485,13 @@ default_grab_key (MetaWaylandKeyboardGrab *grab,
|
||||
MetaWaylandKeyboard *keyboard = grab->keyboard;
|
||||
gboolean is_press = event->type == CLUTTER_KEY_PRESS;
|
||||
guint32 code = 0;
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
#endif
|
||||
|
||||
/* Ignore autorepeat events, as autorepeat in Wayland is done on the client
|
||||
* side. */
|
||||
if (event->key.flags & CLUTTER_EVENT_FLAG_REPEATED)
|
||||
return FALSE;
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
if (META_IS_BACKEND_NATIVE (backend))
|
||||
code = meta_event_native_get_event_code (event);
|
||||
if (code == 0)
|
||||
#endif
|
||||
code = evdev_code (&event->key);
|
||||
code = clutter_event_get_event_code (event);
|
||||
|
||||
return meta_wayland_keyboard_broadcast_key (keyboard, event->key.time,
|
||||
code, is_press);
|
||||
@ -572,14 +558,6 @@ meta_wayland_keyboard_disable (MetaWaylandKeyboard *keyboard)
|
||||
g_clear_object (&keyboard->settings);
|
||||
}
|
||||
|
||||
static guint
|
||||
evdev_code (const ClutterKeyEvent *event)
|
||||
{
|
||||
/* clutter-xkb-utils.c adds a fixed offset of 8 to go into XKB's
|
||||
* range, so we do the reverse here. */
|
||||
return event->hardware_keycode - 8;
|
||||
}
|
||||
|
||||
void
|
||||
meta_wayland_keyboard_update (MetaWaylandKeyboard *keyboard,
|
||||
const ClutterKeyEvent *event)
|
||||
|
@ -377,36 +377,7 @@ meta_wayland_pointer_send_button (MetaWaylandPointer *pointer,
|
||||
uint32_t button;
|
||||
uint32_t serial;
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
if (META_IS_BACKEND_NATIVE (backend))
|
||||
button = meta_event_native_get_event_code (event);
|
||||
else
|
||||
#endif
|
||||
{
|
||||
button = clutter_event_get_button (event);
|
||||
switch (button)
|
||||
{
|
||||
case 1:
|
||||
button = BTN_LEFT;
|
||||
break;
|
||||
|
||||
/* The evdev input right and middle button numbers are swapped
|
||||
relative to how Clutter numbers them */
|
||||
case 2:
|
||||
button = BTN_MIDDLE;
|
||||
break;
|
||||
|
||||
case 3:
|
||||
button = BTN_RIGHT;
|
||||
break;
|
||||
|
||||
default:
|
||||
button = button + (BTN_LEFT - 1) + 4;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
button = clutter_event_get_event_code (event);
|
||||
time = clutter_event_get_time (event);
|
||||
serial = meta_wayland_input_device_next_serial (input_device);
|
||||
|
||||
|
@ -36,13 +36,6 @@
|
||||
#include "backends/meta-input-settings-private.h"
|
||||
#include "backends/meta-logical-monitor.h"
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
#include <linux/input-event-codes.h>
|
||||
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
#include "backends/native/meta-event-native.h"
|
||||
#endif
|
||||
|
||||
#include "tablet-unstable-v2-server-protocol.h"
|
||||
|
||||
#define TABLET_AXIS_MAX 65535
|
||||
@ -657,23 +650,9 @@ broadcast_button (MetaWaylandTabletTool *tool,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
struct wl_resource *resource;
|
||||
guint32 button;
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
MetaBackend *backend = meta_get_backend ();
|
||||
if (META_IS_BACKEND_NATIVE (backend))
|
||||
{
|
||||
button = meta_event_native_get_event_code (event);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
/* We can't do much better here, there's several
|
||||
* different BTN_ ranges to cover.
|
||||
*/
|
||||
button = event->button.button;
|
||||
}
|
||||
uint32_t button;
|
||||
|
||||
button = clutter_event_get_event_code (event);
|
||||
tool->button_serial = wl_display_next_serial (tool->seat->manager->wl_display);
|
||||
|
||||
wl_resource_for_each (resource, &tool->focus_resource_list)
|
||||
|
Reference in New Issue
Block a user