mirror of
https://github.com/brl/mutter.git
synced 2024-11-22 08:00:42 -05:00
backends: Use ClutterEvent getter methods
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3153>
This commit is contained in:
parent
64490c3489
commit
8f3e503c04
@ -1032,10 +1032,13 @@ update_last_device_from_event (MetaBackend *backend,
|
||||
ClutterEvent *event)
|
||||
{
|
||||
ClutterInputDevice *source;
|
||||
ClutterEventType event_type;
|
||||
|
||||
event_type = clutter_event_type (event);
|
||||
|
||||
/* Handled elsewhere */
|
||||
if (event->type == CLUTTER_DEVICE_ADDED ||
|
||||
event->type == CLUTTER_DEVICE_REMOVED)
|
||||
if (event_type == CLUTTER_DEVICE_ADDED ||
|
||||
event_type == CLUTTER_DEVICE_REMOVED)
|
||||
return;
|
||||
|
||||
source = clutter_event_get_source_device (event);
|
||||
@ -1097,7 +1100,7 @@ dispatch_clutter_event (MetaBackend *backend)
|
||||
if (event)
|
||||
{
|
||||
g_warn_if_fail (!priv->in_init ||
|
||||
event->type == CLUTTER_DEVICE_ADDED);
|
||||
clutter_event_type (event) == CLUTTER_DEVICE_ADDED);
|
||||
|
||||
clutter_stage_handle_event (stage, event);
|
||||
meta_backend_update_from_event (backend, event);
|
||||
|
@ -1385,15 +1385,20 @@ gboolean
|
||||
meta_input_capture_session_process_event (MetaInputCaptureSession *session,
|
||||
const ClutterEvent *event)
|
||||
{
|
||||
switch (event->type)
|
||||
double dx, dy, dx_constrained, dy_constrained;
|
||||
|
||||
switch (clutter_event_type (event))
|
||||
{
|
||||
case CLUTTER_MOTION:
|
||||
if (!session->eis_pointer)
|
||||
return TRUE;
|
||||
|
||||
clutter_event_get_relative_motion (event, &dx, &dy, NULL, NULL,
|
||||
&dx_constrained, &dy_constrained);
|
||||
|
||||
eis_device_pointer_motion (session->eis_pointer,
|
||||
event->motion.dx - event->motion.dx_constrained,
|
||||
event->motion.dy - event->motion.dy_constrained);
|
||||
dx - dx_constrained,
|
||||
dy - dy_constrained);
|
||||
eis_device_frame (session->eis_pointer, eis_now (session->eis));
|
||||
break;
|
||||
case CLUTTER_BUTTON_PRESS:
|
||||
@ -1420,6 +1425,7 @@ meta_input_capture_session_process_event (MetaInputCaptureSession *session,
|
||||
break;
|
||||
case CLUTTER_SCROLL:
|
||||
{
|
||||
ClutterScrollFinishFlags finish_flags;
|
||||
const double factor = 10.0;
|
||||
bool stop_x = false, stop_y = false;
|
||||
double dx, dy;
|
||||
@ -1427,9 +1433,11 @@ meta_input_capture_session_process_event (MetaInputCaptureSession *session,
|
||||
if (!session->eis_pointer)
|
||||
return TRUE;
|
||||
|
||||
if ((event->scroll.finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL))
|
||||
finish_flags = clutter_event_get_scroll_finish_flags (event);
|
||||
|
||||
if ((finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL))
|
||||
stop_x = true;
|
||||
if ((event->scroll.finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL))
|
||||
if ((finish_flags & CLUTTER_SCROLL_FINISHED_HORIZONTAL))
|
||||
stop_y = true;
|
||||
|
||||
if (stop_x || stop_y)
|
||||
|
Loading…
Reference in New Issue
Block a user