mirror of
https://github.com/brl/mutter.git
synced 2024-11-23 00:20:42 -05:00
clutter/event: Set the constrained relative motion too
When a relative pointer motion gets constrained (e.g. a monitor edge or barrier), save the constrained relative motion delta too. This will later be used to send the remaining motion delta to input capture clients. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2628>
This commit is contained in:
parent
a170f2a82b
commit
38d1666049
@ -280,6 +280,8 @@ struct _ClutterMotionEvent
|
|||||||
double dy;
|
double dy;
|
||||||
double dx_unaccel;
|
double dx_unaccel;
|
||||||
double dy_unaccel;
|
double dy_unaccel;
|
||||||
|
double dx_constrained;
|
||||||
|
double dy_constrained;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -903,8 +903,9 @@ meta_seat_impl_notify_relative_motion_in_impl (MetaSeatImpl *seat_impl,
|
|||||||
float dx_unaccel,
|
float dx_unaccel,
|
||||||
float dy_unaccel)
|
float dy_unaccel)
|
||||||
{
|
{
|
||||||
float new_x, new_y;
|
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
|
float old_x, old_y;
|
||||||
|
double dx_constrained, dy_constrained;
|
||||||
|
|
||||||
meta_seat_impl_filter_relative_motion (seat_impl,
|
meta_seat_impl_filter_relative_motion (seat_impl,
|
||||||
input_device,
|
input_device,
|
||||||
@ -913,16 +914,23 @@ meta_seat_impl_notify_relative_motion_in_impl (MetaSeatImpl *seat_impl,
|
|||||||
&dx,
|
&dx,
|
||||||
&dy);
|
&dy);
|
||||||
|
|
||||||
new_x = seat_impl->pointer_x + dx;
|
old_x = seat_impl->pointer_x;
|
||||||
new_y = seat_impl->pointer_y + dy;
|
old_y = seat_impl->pointer_y;
|
||||||
event = new_absolute_motion_event (seat_impl, input_device,
|
event = new_absolute_motion_event (seat_impl, input_device,
|
||||||
time_us, new_x, new_y, NULL);
|
time_us,
|
||||||
|
old_x + dx,
|
||||||
|
old_y + dy,
|
||||||
|
NULL);
|
||||||
|
dx_constrained = event->motion.x - old_x;
|
||||||
|
dy_constrained = event->motion.y - old_y;
|
||||||
|
|
||||||
event->motion.flags |= CLUTTER_EVENT_FLAG_RELATIVE_MOTION;
|
event->motion.flags |= CLUTTER_EVENT_FLAG_RELATIVE_MOTION;
|
||||||
event->motion.dx = dx;
|
event->motion.dx = dx;
|
||||||
event->motion.dy = dy;
|
event->motion.dy = dy;
|
||||||
event->motion.dx_unaccel = dx_unaccel;
|
event->motion.dx_unaccel = dx_unaccel;
|
||||||
event->motion.dy_unaccel = dy_unaccel;
|
event->motion.dy_unaccel = dy_unaccel;
|
||||||
|
event->motion.dx_constrained = dx_constrained;
|
||||||
|
event->motion.dy_constrained = dy_constrained;
|
||||||
|
|
||||||
queue_event (seat_impl, event);
|
queue_event (seat_impl, event);
|
||||||
}
|
}
|
||||||
@ -1595,7 +1603,9 @@ notify_relative_tool_motion_in_impl (ClutterInputDevice *input_device,
|
|||||||
MetaInputDeviceNative *device_native;
|
MetaInputDeviceNative *device_native;
|
||||||
ClutterEvent *event;
|
ClutterEvent *event;
|
||||||
MetaSeatImpl *seat_impl;
|
MetaSeatImpl *seat_impl;
|
||||||
float x, y;
|
float old_x, old_y;
|
||||||
|
double dx_constrained, dy_constrained;
|
||||||
|
|
||||||
|
|
||||||
device_native = META_INPUT_DEVICE_NATIVE (input_device);
|
device_native = META_INPUT_DEVICE_NATIVE (input_device);
|
||||||
seat_impl = seat_impl_from_device (input_device);
|
seat_impl = seat_impl_from_device (input_device);
|
||||||
@ -1607,15 +1617,20 @@ notify_relative_tool_motion_in_impl (ClutterInputDevice *input_device,
|
|||||||
&dx,
|
&dx,
|
||||||
&dy);
|
&dy);
|
||||||
|
|
||||||
x = device_native->pointer_x + dx;
|
old_x = device_native->pointer_x;
|
||||||
y = device_native->pointer_y + dy;
|
old_y = device_native->pointer_y;
|
||||||
|
|
||||||
event = new_absolute_motion_event (seat_impl, input_device, time_us,
|
event = new_absolute_motion_event (seat_impl, input_device, time_us,
|
||||||
x, y, axes);
|
old_x + dx, old_y + dy, axes);
|
||||||
|
|
||||||
|
dx_constrained = event->motion.x - old_x;
|
||||||
|
dy_constrained = event->motion.y - old_y;
|
||||||
|
|
||||||
event->motion.flags |= CLUTTER_EVENT_FLAG_RELATIVE_MOTION;
|
event->motion.flags |= CLUTTER_EVENT_FLAG_RELATIVE_MOTION;
|
||||||
event->motion.dx = dx;
|
event->motion.dx = dx;
|
||||||
event->motion.dy = dy;
|
event->motion.dy = dy;
|
||||||
|
event->motion.dx_constrained = dx_constrained;
|
||||||
|
event->motion.dy_constrained = dy_constrained;
|
||||||
|
|
||||||
queue_event (seat_impl, event);
|
queue_event (seat_impl, event);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user