mirror of
https://github.com/brl/mutter.git
synced 2024-12-25 12:32:05 +00:00
seat: Don't require an event to repick()
We always pass NULL, and anywhere where we want to pass an event should be handled internally.
This commit is contained in:
parent
e02bf13206
commit
a8d2dfd14f
@ -1544,7 +1544,7 @@ meta_display_sync_wayland_input_focus (MetaDisplay *display)
|
|||||||
|
|
||||||
meta_wayland_compositor_set_input_focus (compositor, focus_window);
|
meta_wayland_compositor_set_input_focus (compositor, focus_window);
|
||||||
|
|
||||||
meta_wayland_seat_repick (compositor->seat, NULL);
|
meta_wayland_seat_repick (compositor->seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -185,13 +185,52 @@ meta_wayland_seat_update (MetaWaylandSeat *seat,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
repick_for_event (MetaWaylandSeat *seat,
|
||||||
|
const ClutterEvent *for_event)
|
||||||
|
{
|
||||||
|
ClutterActor *actor = NULL;
|
||||||
|
MetaWaylandPointer *pointer = &seat->pointer;
|
||||||
|
MetaWaylandSurface *surface = NULL;
|
||||||
|
MetaDisplay *display = meta_get_display ();
|
||||||
|
|
||||||
|
if (meta_grab_op_should_block_wayland (display->grab_op))
|
||||||
|
{
|
||||||
|
meta_wayland_pointer_update_current_focus (pointer, NULL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (for_event)
|
||||||
|
{
|
||||||
|
actor = clutter_event_get_source (for_event);
|
||||||
|
}
|
||||||
|
else if (seat->current_stage)
|
||||||
|
{
|
||||||
|
ClutterStage *stage = CLUTTER_STAGE (seat->current_stage);
|
||||||
|
actor = clutter_stage_get_actor_at_pos (stage,
|
||||||
|
CLUTTER_PICK_REACTIVE,
|
||||||
|
wl_fixed_to_double (pointer->x),
|
||||||
|
wl_fixed_to_double (pointer->y));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (actor)
|
||||||
|
seat->current_stage = clutter_actor_get_stage (actor);
|
||||||
|
else
|
||||||
|
seat->current_stage = NULL;
|
||||||
|
|
||||||
|
if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
|
||||||
|
surface = meta_surface_actor_wayland_get_surface (META_SURFACE_ACTOR_WAYLAND (actor));
|
||||||
|
|
||||||
|
meta_wayland_pointer_update_current_focus (pointer, surface);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
notify_motion (MetaWaylandSeat *seat,
|
notify_motion (MetaWaylandSeat *seat,
|
||||||
const ClutterEvent *event)
|
const ClutterEvent *event)
|
||||||
{
|
{
|
||||||
MetaWaylandPointer *pointer = &seat->pointer;
|
MetaWaylandPointer *pointer = &seat->pointer;
|
||||||
|
|
||||||
meta_wayland_seat_repick (seat, event);
|
repick_for_event (seat, event);
|
||||||
|
|
||||||
pointer->grab->interface->motion (pointer->grab, event);
|
pointer->grab->interface->motion (pointer->grab, event);
|
||||||
}
|
}
|
||||||
@ -316,42 +355,9 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_seat_repick (MetaWaylandSeat *seat,
|
meta_wayland_seat_repick (MetaWaylandSeat *seat)
|
||||||
const ClutterEvent *for_event)
|
|
||||||
{
|
{
|
||||||
ClutterActor *actor = NULL;
|
repick_for_event (seat, NULL);
|
||||||
MetaWaylandPointer *pointer = &seat->pointer;
|
|
||||||
MetaWaylandSurface *surface = NULL;
|
|
||||||
MetaDisplay *display = meta_get_display ();
|
|
||||||
|
|
||||||
if (meta_grab_op_should_block_wayland (display->grab_op))
|
|
||||||
{
|
|
||||||
meta_wayland_pointer_update_current_focus (pointer, NULL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (for_event)
|
|
||||||
{
|
|
||||||
actor = clutter_event_get_source (for_event);
|
|
||||||
}
|
|
||||||
else if (seat->current_stage)
|
|
||||||
{
|
|
||||||
ClutterStage *stage = CLUTTER_STAGE (seat->current_stage);
|
|
||||||
actor = clutter_stage_get_actor_at_pos (stage,
|
|
||||||
CLUTTER_PICK_REACTIVE,
|
|
||||||
wl_fixed_to_double (pointer->x),
|
|
||||||
wl_fixed_to_double (pointer->y));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (actor)
|
|
||||||
seat->current_stage = clutter_actor_get_stage (actor);
|
|
||||||
else
|
|
||||||
seat->current_stage = NULL;
|
|
||||||
|
|
||||||
if (META_IS_SURFACE_ACTOR_WAYLAND (actor))
|
|
||||||
surface = meta_surface_actor_wayland_get_surface (META_SURFACE_ACTOR_WAYLAND (actor));
|
|
||||||
|
|
||||||
meta_wayland_pointer_update_current_focus (pointer, surface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -76,8 +76,7 @@ meta_wayland_seat_handle_event (MetaWaylandSeat *seat,
|
|||||||
const ClutterEvent *event);
|
const ClutterEvent *event);
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_seat_repick (MetaWaylandSeat *seat,
|
meta_wayland_seat_repick (MetaWaylandSeat *seat);
|
||||||
const ClutterEvent *for_event);
|
|
||||||
|
|
||||||
void
|
void
|
||||||
meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat);
|
meta_wayland_seat_update_cursor_surface (MetaWaylandSeat *seat);
|
||||||
|
@ -196,7 +196,7 @@ meta_wayland_compositor_set_input_focus (MetaWaylandCompositor *compositor,
|
|||||||
void
|
void
|
||||||
meta_wayland_compositor_repick (MetaWaylandCompositor *compositor)
|
meta_wayland_compositor_repick (MetaWaylandCompositor *compositor)
|
||||||
{
|
{
|
||||||
meta_wayland_seat_repick (compositor->seat, NULL);
|
meta_wayland_seat_repick (compositor->seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
Loading…
Reference in New Issue
Block a user