window: Use event data getters in event handling code
This makes these functions more independent wrt touch vs pointer events https://bugzilla.gnome.org/show_bug.cgi?id=733631
This commit is contained in:
parent
029d69919b
commit
38e4906f72
@ -6073,9 +6073,13 @@ static void
|
|||||||
end_grab_op (MetaWindow *window,
|
end_grab_op (MetaWindow *window,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
meta_display_check_threshold_reached (window->display,
|
ClutterModifierType modifiers;
|
||||||
event->button.x,
|
gfloat x, y;
|
||||||
event->button.y);
|
|
||||||
|
clutter_event_get_coords (event, &x, &y);
|
||||||
|
modifiers = clutter_event_get_state (event);
|
||||||
|
meta_display_check_threshold_reached (window->display, x, y);
|
||||||
|
|
||||||
/* If the user was snap moving then ignore the button
|
/* If the user was snap moving then ignore the button
|
||||||
* release because they may have let go of shift before
|
* release because they may have let go of shift before
|
||||||
* releasing the mouse button and they almost certainly do
|
* releasing the mouse button and they almost certainly do
|
||||||
@ -6090,16 +6094,14 @@ end_grab_op (MetaWindow *window,
|
|||||||
meta_window_tile (window);
|
meta_window_tile (window);
|
||||||
else
|
else
|
||||||
update_move (window,
|
update_move (window,
|
||||||
event->button.modifier_state & CLUTTER_SHIFT_MASK,
|
modifiers & CLUTTER_SHIFT_MASK,
|
||||||
event->button.x,
|
x, y);
|
||||||
event->button.y);
|
|
||||||
}
|
}
|
||||||
else if (meta_grab_op_is_resizing (window->display->grab_op))
|
else if (meta_grab_op_is_resizing (window->display->grab_op))
|
||||||
{
|
{
|
||||||
update_resize (window,
|
update_resize (window,
|
||||||
event->button.modifier_state & CLUTTER_SHIFT_MASK,
|
modifiers & CLUTTER_SHIFT_MASK,
|
||||||
event->button.x,
|
x, y,
|
||||||
event->button.y,
|
|
||||||
TRUE);
|
TRUE);
|
||||||
|
|
||||||
/* If a tiled window has been dragged free with a
|
/* If a tiled window has been dragged free with a
|
||||||
@ -6112,13 +6114,16 @@ end_grab_op (MetaWindow *window,
|
|||||||
update_tile_mode (window);
|
update_tile_mode (window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
meta_display_end_grab_op (window->display, event->any.time);
|
meta_display_end_grab_op (window->display, clutter_event_get_time (event));
|
||||||
}
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
|
ClutterModifierType modifier_state;
|
||||||
|
gfloat x, y;
|
||||||
|
|
||||||
switch (event->type)
|
switch (event->type)
|
||||||
{
|
{
|
||||||
case CLUTTER_BUTTON_PRESS:
|
case CLUTTER_BUTTON_PRESS:
|
||||||
@ -6146,22 +6151,21 @@ meta_window_handle_mouse_grab_op_event (MetaWindow *window,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case CLUTTER_MOTION:
|
case CLUTTER_MOTION:
|
||||||
meta_display_check_threshold_reached (window->display,
|
modifier_state = clutter_event_get_state (event);
|
||||||
event->motion.x,
|
clutter_event_get_coords (event, &x, &y);
|
||||||
event->motion.y);
|
|
||||||
|
meta_display_check_threshold_reached (window->display, x, y);
|
||||||
if (meta_grab_op_is_moving (window->display->grab_op))
|
if (meta_grab_op_is_moving (window->display->grab_op))
|
||||||
{
|
{
|
||||||
update_move (window,
|
update_move (window,
|
||||||
event->button.modifier_state & CLUTTER_SHIFT_MASK,
|
modifier_state & CLUTTER_SHIFT_MASK,
|
||||||
event->motion.x,
|
x, y);
|
||||||
event->motion.y);
|
|
||||||
}
|
}
|
||||||
else if (meta_grab_op_is_resizing (window->display->grab_op))
|
else if (meta_grab_op_is_resizing (window->display->grab_op))
|
||||||
{
|
{
|
||||||
update_resize (window,
|
update_resize (window,
|
||||||
event->button.modifier_state & CLUTTER_SHIFT_MASK,
|
modifier_state & CLUTTER_SHIFT_MASK,
|
||||||
event->motion.x,
|
x, y,
|
||||||
event->motion.y,
|
|
||||||
FALSE);
|
FALSE);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
Loading…
Reference in New Issue
Block a user