Initially focus the lock surface that has the current output focus

This commit is contained in:
Erik Reider 2025-09-15 15:27:04 +02:00
parent f769203238
commit 1737a58b01

View file

@ -8,6 +8,7 @@
#include "sway/layers.h"
#include "sway/output.h"
#include "sway/server.h"
#include "sway/tree/workspace.h"
#include "sway/lock.h"
struct sway_session_lock_output {
@ -78,7 +79,15 @@ void sway_session_lock_focus_output(struct sway_session_lock *lock,
static void handle_surface_map(struct wl_listener *listener, void *data) {
struct sway_session_lock_output *surf = wl_container_of(listener, surf, surface_map);
if (surf->lock->focused == NULL) {
struct sway_seat *seat = input_manager_current_seat();
struct sway_workspace *focused_ws = seat_get_focused_workspace(seat);
struct sway_output *focused_output = NULL;
if (focused_ws != NULL) {
focused_output = focused_ws->output;
}
if (surf->lock->focused == NULL || focused_output == surf->output) {
focus_surface(surf->lock, surf->surface->surface);
}
cursor_rebase_all();