mirror of
https://gitlab.freedesktop.org/wayland/weston
synced 2024-07-01 07:14:39 +00:00
desktop-shell: Add session listener
And use it to perform keyboard activation on the currently focused window. Similar to what kiosk-shell does, with the note that we go over all seats in the system rather than picking the first one available. Signed-off-by: Marius Vlad <marius.vlad@collabora.com>
This commit is contained in:
parent
5b2f010c03
commit
4c100ca1d7
|
@ -4778,6 +4778,7 @@ shell_destroy(struct wl_listener *listener, void *data)
|
||||||
wl_list_remove(&shell->output_create_listener.link);
|
wl_list_remove(&shell->output_create_listener.link);
|
||||||
wl_list_remove(&shell->output_move_listener.link);
|
wl_list_remove(&shell->output_move_listener.link);
|
||||||
wl_list_remove(&shell->resized_listener.link);
|
wl_list_remove(&shell->resized_listener.link);
|
||||||
|
wl_list_remove(&shell->session_listener.link);
|
||||||
|
|
||||||
wl_list_for_each_safe(shseat, shseat_next, &shell->seat_list, link)
|
wl_list_for_each_safe(shseat, shseat_next, &shell->seat_list, link)
|
||||||
desktop_shell_destroy_seat(shseat);
|
desktop_shell_destroy_seat(shseat);
|
||||||
|
@ -4872,6 +4873,37 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
|
||||||
weston_install_debug_key_binding(ec, mod);
|
weston_install_debug_key_binding(ec, mod);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
desktop_shell_notify_session(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct desktop_shell *shell =
|
||||||
|
container_of(listener, struct desktop_shell, session_listener);
|
||||||
|
struct weston_compositor *compositor = data;
|
||||||
|
struct weston_seat *seat;
|
||||||
|
|
||||||
|
if (!compositor->session_active)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wl_list_for_each(seat, &shell->seat_list, link) {
|
||||||
|
struct shell_seat *shseat = get_shell_seat(seat);
|
||||||
|
|
||||||
|
if (!shseat)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (shseat->focused_surface) {
|
||||||
|
struct shell_surface *current_focus =
|
||||||
|
get_shell_surface(shseat->focused_surface);
|
||||||
|
|
||||||
|
if (!current_focus)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
weston_view_activate_input(current_focus->view,
|
||||||
|
shseat->seat,
|
||||||
|
WESTON_ACTIVATE_FLAG_NONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_seat_created(struct wl_listener *listener, void *data)
|
handle_seat_created(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
|
@ -4972,6 +5004,8 @@ wet_shell_init(struct weston_compositor *ec,
|
||||||
shell->resized_listener.notify = handle_output_resized;
|
shell->resized_listener.notify = handle_output_resized;
|
||||||
wl_signal_add(&ec->output_resized_signal, &shell->resized_listener);
|
wl_signal_add(&ec->output_resized_signal, &shell->resized_listener);
|
||||||
|
|
||||||
|
shell->session_listener.notify = desktop_shell_notify_session;
|
||||||
|
wl_signal_add(&ec->session_signal, &shell->session_listener);
|
||||||
screenshooter_create(ec);
|
screenshooter_create(ec);
|
||||||
|
|
||||||
shell_add_bindings(ec, shell);
|
shell_add_bindings(ec, shell);
|
||||||
|
|
|
@ -90,6 +90,7 @@ struct desktop_shell {
|
||||||
struct wl_listener show_input_panel_listener;
|
struct wl_listener show_input_panel_listener;
|
||||||
struct wl_listener hide_input_panel_listener;
|
struct wl_listener hide_input_panel_listener;
|
||||||
struct wl_listener update_input_panel_listener;
|
struct wl_listener update_input_panel_listener;
|
||||||
|
struct wl_listener session_listener;
|
||||||
|
|
||||||
struct weston_layer fullscreen_layer;
|
struct weston_layer fullscreen_layer;
|
||||||
struct weston_layer panel_layer;
|
struct weston_layer panel_layer;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user