mirror of
https://github.com/brl/mutter.git
synced 2024-11-21 23:50:41 -05:00
wayland: Fetch pointer button event codes from the ClutterEvent
When running as a native compositor, we can just do that. However, the
previous code must stay for whenever it's run as a X11 client.
Additionally, the fallback switch{} that transforms clutter 1-indexed
buttons into input.h event codes had to be adapted to the change introduced
in clutter commit 83b738c0e
, where the 4-7 button range is kept clear for
compatibility with the X11 backend.
https://bugzilla.gnome.org/show_bug.cgi?id=758239
This commit is contained in:
parent
c16a5ec1cf
commit
7309b20c25
@ -63,7 +63,7 @@ MUTTER_PC_MODULES="
|
||||
pango >= 1.2.0
|
||||
cairo >= 1.10.0
|
||||
gsettings-desktop-schemas >= 3.15.92
|
||||
$CLUTTER_PACKAGE >= 1.23.4
|
||||
$CLUTTER_PACKAGE >= 1.25.1
|
||||
cogl-1.0 >= 1.17.1
|
||||
upower-glib >= 0.99.0
|
||||
gnome-desktop-3.0
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <clutter/clutter.h>
|
||||
#include <clutter/evdev/clutter-evdev.h>
|
||||
#include <cogl/cogl.h>
|
||||
#include <cogl/cogl-wayland-server.h>
|
||||
#include <linux/input.h>
|
||||
@ -62,6 +63,10 @@
|
||||
#include "backends/meta-cursor-tracker-private.h"
|
||||
#include "backends/meta-cursor-renderer.h"
|
||||
|
||||
#ifdef HAVE_NATIVE_BACKEND
|
||||
#include "backends/native/meta-backend-native.h"
|
||||
#endif
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define DEFAULT_AXIS_STEP_DISTANCE wl_fixed_from_int (10)
|
||||
@ -277,26 +282,37 @@ 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 = clutter_evdev_event_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;
|
||||
}
|
||||
}
|
||||
|
||||
time = clutter_event_get_time (event);
|
||||
|
||||
button = clutter_event_get_button (event);
|
||||
switch (button)
|
||||
{
|
||||
/* 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;
|
||||
break;
|
||||
}
|
||||
|
||||
serial = wl_display_next_serial (display);
|
||||
|
||||
wl_resource_for_each (resource, &pointer->focus_client->pointer_resources)
|
||||
|
Loading…
Reference in New Issue
Block a user