mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-09-23 07:39:08 +00:00
don't send pointer events to clients while locked
This commit is contained in:
@@ -211,6 +211,7 @@ struct Monitor {
|
||||
struct wl_listener frame;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener request_state;
|
||||
struct wl_listener commit_lock_surface;
|
||||
struct wl_listener destroy_lock_surface;
|
||||
struct wlr_session_lock_surface_v1 *lock_surface;
|
||||
struct wlr_box m; /* monitor area, layout-relative */
|
||||
@@ -276,6 +277,7 @@ static void cleanupmon(struct wl_listener *listener, void *data);
|
||||
static void cleanuplisteners(void);
|
||||
static void closemon(Monitor *m);
|
||||
static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
|
||||
static void commitlocksurface(struct wl_listener *listener, void *data);
|
||||
static void commitnotify(struct wl_listener *listener, void *data);
|
||||
static void commitpopup(struct wl_listener *listener, void *data);
|
||||
static void createdecoration(struct wl_listener *listener, void *data);
|
||||
@@ -953,6 +955,20 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
|
||||
arrangelayers(l->mon);
|
||||
}
|
||||
|
||||
void
|
||||
commitlocksurface(struct wl_listener *listener, void *data)
|
||||
{
|
||||
Monitor *m = wl_container_of(listener, m, commit_lock_surface);
|
||||
|
||||
if (!m->lock_surface->surface->mapped)
|
||||
return;
|
||||
|
||||
wl_list_remove(&m->commit_lock_surface.link);
|
||||
wl_list_init(&m->commit_lock_surface.link);
|
||||
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
void
|
||||
commitnotify(struct wl_listener *listener, void *data)
|
||||
{
|
||||
@@ -1130,6 +1146,7 @@ createlocksurface(struct wl_listener *listener, void *data)
|
||||
wlr_session_lock_surface_v1_configure(lock_surface, m->m.width, m->m.height);
|
||||
|
||||
LISTEN(&lock_surface->events.destroy, &m->destroy_lock_surface, destroylocksurface);
|
||||
LISTEN(&lock_surface->surface->events.commit, &m->commit_lock_surface, commitlocksurface);
|
||||
|
||||
if (m == selmon)
|
||||
client_notify_enter(lock_surface->surface, wlr_seat_get_keyboard(seat));
|
||||
@@ -1411,6 +1428,7 @@ destroylocksurface(struct wl_listener *listener, void *data)
|
||||
|
||||
m->lock_surface = NULL;
|
||||
wl_list_remove(&m->destroy_lock_surface.link);
|
||||
wl_list_remove(&m->commit_lock_surface.link);
|
||||
|
||||
if (lock_surface->surface != seat->keyboard_state.focused_surface)
|
||||
return;
|
||||
@@ -1854,6 +1872,12 @@ locksession(struct wl_listener *listener, void *data)
|
||||
cur_lock = lock->lock = session_lock;
|
||||
locked = 1;
|
||||
|
||||
/* Cancel any interactive move/resize and take the pointer focus away
|
||||
* from the clients below the lock screen */
|
||||
cursor_mode = CurNormal;
|
||||
grabc = NULL;
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
|
||||
LISTEN(&session_lock->events.new_surface, &lock->new_surface, createlocksurface);
|
||||
LISTEN(&session_lock->events.destroy, &lock->destroy, destroysessionlock);
|
||||
LISTEN(&session_lock->events.unlock, &lock->unlock, unlocksession);
|
||||
@@ -3223,7 +3247,7 @@ xytonode(double x, double y, struct wlr_surface **psurface,
|
||||
struct wlr_surface *surface = NULL;
|
||||
int layer;
|
||||
|
||||
for (layer = NUM_LAYERS - 1; !surface && layer >= 0; layer--) {
|
||||
for (layer = NUM_LAYERS - 1; !surface && layer >= (locked ? LyrBlock : 0); layer--) {
|
||||
if (layer == LyrIMPopup ||
|
||||
!(node = wlr_scene_node_at(&layers[layer]->node, x, y, nx, ny)))
|
||||
continue;
|
||||
|
||||
Reference in New Issue
Block a user