clutter: Add API for filtering relative motion events
Add an API that allows the owner of the clutter context to alter the relative motion events (so far relative pointer events). https://bugzilla.gnome.org/show_bug.cgi?id=778119
This commit is contained in:
parent
a77da353f3
commit
8f691c28f3
@ -102,6 +102,9 @@ struct _ClutterDeviceManagerEvdevPrivate
|
|||||||
gpointer constrain_data;
|
gpointer constrain_data;
|
||||||
GDestroyNotify constrain_data_notify;
|
GDestroyNotify constrain_data_notify;
|
||||||
|
|
||||||
|
ClutterRelativeMotionFilter relative_motion_filter;
|
||||||
|
gpointer relative_motion_filter_user_data;
|
||||||
|
|
||||||
ClutterStageManager *stage_manager;
|
ClutterStageManager *stage_manager;
|
||||||
guint stage_added_handler;
|
guint stage_added_handler;
|
||||||
guint stage_removed_handler;
|
guint stage_removed_handler;
|
||||||
@ -264,6 +267,22 @@ _clutter_device_manager_evdev_constrain_pointer (ClutterDeviceManagerEvdev *mana
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
_clutter_device_manager_evdev_filter_relative_motion (ClutterDeviceManagerEvdev *manager_evdev,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float *dx,
|
||||||
|
float *dy)
|
||||||
|
{
|
||||||
|
ClutterDeviceManagerEvdevPrivate *priv = manager_evdev->priv;
|
||||||
|
|
||||||
|
if (!priv->relative_motion_filter)
|
||||||
|
return;
|
||||||
|
|
||||||
|
priv->relative_motion_filter (device, x, y, dx, dy,
|
||||||
|
priv->relative_motion_filter_user_data);
|
||||||
|
}
|
||||||
|
|
||||||
static ClutterEvent *
|
static ClutterEvent *
|
||||||
new_absolute_motion_event (ClutterInputDevice *input_device,
|
new_absolute_motion_event (ClutterInputDevice *input_device,
|
||||||
@ -2661,6 +2680,23 @@ clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager *e
|
|||||||
priv->constrain_data_notify = user_data_notify;
|
priv->constrain_data_notify = user_data_notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
clutter_evdev_set_relative_motion_filter (ClutterDeviceManager *evdev,
|
||||||
|
ClutterRelativeMotionFilter filter,
|
||||||
|
gpointer user_data)
|
||||||
|
{
|
||||||
|
ClutterDeviceManagerEvdev *manager_evdev;
|
||||||
|
ClutterDeviceManagerEvdevPrivate *priv;
|
||||||
|
|
||||||
|
g_return_if_fail (CLUTTER_IS_DEVICE_MANAGER_EVDEV (evdev));
|
||||||
|
|
||||||
|
manager_evdev = CLUTTER_DEVICE_MANAGER_EVDEV (evdev);
|
||||||
|
priv = manager_evdev->priv;
|
||||||
|
|
||||||
|
priv->relative_motion_filter = filter;
|
||||||
|
priv->relative_motion_filter_user_data = user_data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* clutter_evdev_set_keyboard_repeat:
|
* clutter_evdev_set_keyboard_repeat:
|
||||||
* @evdev: the #ClutterDeviceManager created by the evdev backend
|
* @evdev: the #ClutterDeviceManager created by the evdev backend
|
||||||
|
@ -76,6 +76,13 @@ void _clutter_device_manager_evdev_constrain_pointer (ClutterDeviceManagerEvdev
|
|||||||
float *new_x,
|
float *new_x,
|
||||||
float *new_y);
|
float *new_y);
|
||||||
|
|
||||||
|
void _clutter_device_manager_evdev_filter_relative_motion (ClutterDeviceManagerEvdev *manager_evdev,
|
||||||
|
ClutterInputDevice *device,
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float *dx,
|
||||||
|
float *dy);
|
||||||
|
|
||||||
void _clutter_device_manager_evdev_dispatch (ClutterDeviceManagerEvdev *manager_evdev);
|
void _clutter_device_manager_evdev_dispatch (ClutterDeviceManagerEvdev *manager_evdev);
|
||||||
|
|
||||||
static inline guint64
|
static inline guint64
|
||||||
|
@ -97,6 +97,18 @@ void clutter_evdev_set_pointer_constrain_callback (ClutterDeviceManager
|
|||||||
gpointer user_data,
|
gpointer user_data,
|
||||||
GDestroyNotify user_data_notify);
|
GDestroyNotify user_data_notify);
|
||||||
|
|
||||||
|
typedef void (*ClutterRelativeMotionFilter) (ClutterInputDevice *device,
|
||||||
|
float x,
|
||||||
|
float y,
|
||||||
|
float *dx,
|
||||||
|
float *dy,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
|
CLUTTER_AVAILABLE_IN_MUTTER
|
||||||
|
void clutter_evdev_set_relative_motion_filter (ClutterDeviceManager *evdev,
|
||||||
|
ClutterRelativeMotionFilter filter,
|
||||||
|
gpointer user_data);
|
||||||
|
|
||||||
CLUTTER_AVAILABLE_IN_1_16
|
CLUTTER_AVAILABLE_IN_1_16
|
||||||
void clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev,
|
void clutter_evdev_set_keyboard_map (ClutterDeviceManager *evdev,
|
||||||
struct xkb_keymap *keymap);
|
struct xkb_keymap *keymap);
|
||||||
|
@ -405,6 +405,13 @@ clutter_seat_evdev_notify_relative_motion (ClutterSeatEvdev *seat,
|
|||||||
if (!_clutter_input_device_get_stage (input_device))
|
if (!_clutter_input_device_get_stage (input_device))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
_clutter_device_manager_evdev_filter_relative_motion (seat->manager_evdev,
|
||||||
|
input_device,
|
||||||
|
seat->pointer_x,
|
||||||
|
seat->pointer_y,
|
||||||
|
&dx,
|
||||||
|
&dy);
|
||||||
|
|
||||||
new_x = seat->pointer_x + dx;
|
new_x = seat->pointer_x + dx;
|
||||||
new_y = seat->pointer_y + dy;
|
new_y = seat->pointer_y + dy;
|
||||||
event = new_absolute_motion_event (seat, input_device,
|
event = new_absolute_motion_event (seat, input_device,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user