mirror of
https://github.com/brl/mutter.git
synced 2024-11-26 10:00:45 -05:00
compositor: Add MetaWindowDrag API to add a hint on the grab coordinates
This is added as a hint so that the caller can optionally use it, e.g. in the case that a window drag is driven by the mouse. This will be used to more accurately follow the drag position, other than starting at the current pointer position. Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/3546>
This commit is contained in:
parent
4fa2706b9b
commit
e4542a6495
@ -56,6 +56,8 @@ struct _MetaWindowDrag {
|
||||
MetaGrabOp grab_op;
|
||||
ClutterGrab *grab;
|
||||
|
||||
graphene_point_t pos_hint;
|
||||
|
||||
ClutterInputDevice *leading_device;
|
||||
ClutterEventSequence *leading_touch_sequence;
|
||||
double anchor_rel_x;
|
||||
@ -79,6 +81,7 @@ struct _MetaWindowDrag {
|
||||
|
||||
guint tile_preview_timeout_id;
|
||||
guint preview_tile_mode : 2;
|
||||
guint pos_hint_set : 1;
|
||||
};
|
||||
|
||||
G_DEFINE_FINAL_TYPE (MetaWindowDrag, meta_window_drag, G_TYPE_OBJECT)
|
||||
@ -1781,6 +1784,11 @@ meta_window_drag_begin (MetaWindowDrag *window_drag,
|
||||
{
|
||||
warp_grab_pointer (window_drag, window, grab_op, &root_x, &root_y);
|
||||
}
|
||||
else if (window_drag->pos_hint_set)
|
||||
{
|
||||
root_x = window_drag->pos_hint.x;
|
||||
root_y = window_drag->pos_hint.y;
|
||||
}
|
||||
else
|
||||
{
|
||||
ClutterBackend *clutter_backend = meta_backend_get_clutter_backend (backend);
|
||||
@ -1917,3 +1925,12 @@ meta_window_drag_update_edges (MetaWindowDrag *window_drag)
|
||||
{
|
||||
meta_window_drag_edge_resistance_cleanup (window_drag);
|
||||
}
|
||||
|
||||
void
|
||||
meta_window_drag_set_position_hint (MetaWindowDrag *window_drag,
|
||||
graphene_point_t *pos_hint)
|
||||
{
|
||||
window_drag->pos_hint_set = pos_hint != NULL;
|
||||
if (pos_hint)
|
||||
window_drag->pos_hint = *pos_hint;
|
||||
}
|
||||
|
@ -43,3 +43,6 @@ MetaWindow * meta_window_drag_get_window (MetaWindowDrag *window_drag);
|
||||
MetaGrabOp meta_window_drag_get_grab_op (MetaWindowDrag *window_drag);
|
||||
|
||||
void meta_window_drag_update_edges (MetaWindowDrag *window_drag);
|
||||
|
||||
void meta_window_drag_set_position_hint (MetaWindowDrag *window_drag,
|
||||
graphene_point_t *pos_hint);
|
||||
|
Loading…
Reference in New Issue
Block a user