core: Handle special actions associated to pad buttons in generic code

And remove the wayland-specific handling. This works for both Wayland and
X11 (provided the compositor receives pad events through a passive grab
there).

https://bugzilla.gnome.org/show_bug.cgi?id=773779
This commit is contained in:
Carlos Garnacho 2016-10-25 17:01:37 +02:00
parent 9abf6892c4
commit 1831a1dd9b
2 changed files with 16 additions and 32 deletions

View File

@ -217,6 +217,22 @@ meta_display_handle_event (MetaDisplay *display,
}
#endif
if (!display->current_pad_osd &&
(event->type == CLUTTER_PAD_BUTTON_PRESS ||
event->type == CLUTTER_PAD_BUTTON_RELEASE))
{
MetaBackend *backend = meta_get_backend ();
if (meta_input_settings_handle_pad_button (meta_backend_get_input_settings (backend),
clutter_event_get_source_device (event),
event->type == CLUTTER_PAD_BUTTON_PRESS,
event->pad_button.button))
{
bypass_wayland = bypass_clutter = TRUE;
goto out;
}
}
source = clutter_event_get_source_device (event);
if (source)

View File

@ -358,26 +358,6 @@ handle_pad_button_event (MetaWaylandTabletPad *pad,
return TRUE;
}
static void
meta_wayland_tablet_pad_update_action (MetaWaylandTabletPad *pad,
const ClutterEvent *event)
{
MetaInputSettings *input_settings;
ClutterInputDevice *device;
guint button;
button = event->pad_button.button;
device = clutter_event_get_source_device (event);
input_settings = meta_backend_get_input_settings (meta_get_backend ());
if (!input_settings)
return;
meta_input_settings_handle_pad_button (input_settings, device,
event->type == CLUTTER_PAD_BUTTON_PRESS,
button);
}
static gboolean
meta_wayland_tablet_pad_handle_event_action (MetaWaylandTabletPad *pad,
const ClutterEvent *event)
@ -566,18 +546,6 @@ meta_wayland_tablet_pad_update (MetaWaylandTabletPad *pad,
if (group)
meta_wayland_tablet_pad_group_update (group, event);
switch (event->type)
{
case CLUTTER_PAD_BUTTON_PRESS:
case CLUTTER_PAD_BUTTON_RELEASE:
meta_wayland_tablet_pad_update_action (pad, event);
break;
case CLUTTER_PAD_RING:
case CLUTTER_PAD_STRIP:
default:
break;
}
}
static gchar *