From 5de4fabd13b6c4c3a3caee7054f59168dbcbd3fe Mon Sep 17 00:00:00 2001 From: Henrik Klee Date: Sun, 22 Nov 2026 07:12:59 +0800 Subject: [PATCH] labwc 1:0.20.2-8: a key pressed on the lock screen gets its release too Home pressed while the session is locked went to the lock screen, but its release did not: labwc keeps the matched Home binding (on release, not allowed when locked) as the current one, and the release branch then swallows the release. The lock screen kept Home pressed and repeated it until focus moved, which kept an iPad 6 lit and hot for an hour. Upstream labwc master has the same code. Patch 0011 clears the current binding when the press goes to the client, so the release follows it. First written for omarchy-a's own labwc build (0195893, never merged) before labwc moved here. tests/test-locked-key-release.py reads the patched handler: it passes on the patched source and fails on the unpatched one; check() runs it. Assisted-by: LLM --- CHANGELOG.md | 6 +++++ packages/labwc/arch/PKGBUILD | 8 +++++-- .../patches/0011-locked-key-release.patch | 16 +++++++++++++ .../labwc/tests/test-locked-key-release.py | 23 +++++++++++++++++++ 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 packages/labwc/patches/0011-locked-key-release.patch create mode 100755 packages/labwc/tests/test-locked-key-release.py diff --git a/CHANGELOG.md b/CHANGELOG.md index 5d345af..3530cea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,12 @@ to `main` publishes every changed version at once, so when merging, rename ## Unreleased +### labwc 1:0.20.2-8 + +- Pressing Home on the lock screen no longer leaves it held down: the lock + screen gets the release too, so it stops repeating the key and keeping + the screen lit. + ### labwc 1:0.20.2-7 - In the overview, a long press on a window (a right click, the Menu key) diff --git a/packages/labwc/arch/PKGBUILD b/packages/labwc/arch/PKGBUILD index b181105..a6d7365 100644 --- a/packages/labwc/arch/PKGBUILD +++ b/packages/labwc/arch/PKGBUILD @@ -18,7 +18,7 @@ pkgname=labwc _commit=97f28877a343e062f3178d201f0248cd9c2610cf epoch=1 pkgver=0.20.2 -pkgrel=7 +pkgrel=8 pkgdesc='stacking wayland compositor with look and feel from openbox, with OrchardLinux tablet patches' url="https://github.com/labwc/labwc" arch=('aarch64' 'armv7h') @@ -67,6 +67,7 @@ _patches=( 0008-no-pointer-focus-while-cursor-hidden.patch 0009-bottom-swipe-ignore-namespace-list.patch 0010-overview-card-menu.patch + 0011-locked-key-release.patch ) source=("labwc-${_commit}.tar.gz::https://codeload.github.com/labwc/labwc/tar.gz/${_commit}" "${_patches[@]}") @@ -80,7 +81,8 @@ sha256sums=('022676dbcbf6b6206b97d7bac8a339c8a0203e3e99693107c15b5a6183e4b0ea' 'c767678e286a44bc35c18536f2ed7e9fe4d7d0c812dfe024aa30c0d524112283' 'd0bf697fb73e3cc6e3b3e90448b5bc03903e129477d68f691f0dec1542acfc68' 'cfaf13b54c712df2a41dc18d3b9a4358afeecb2384673b2ec44167a7186e9943' - 'f7e017810aa37f54c7db0f18bb92486ba1b7d40892377989d58d96e70c00b9c0') + 'f7e017810aa37f54c7db0f18bb92486ba1b7d40892377989d58d96e70c00b9c0' + '9fa24e24cd27558826344fa4a0b091b8def183d9d4e6975062a9b73d97487a0a') prepare() { local patch @@ -116,6 +118,8 @@ check() { python3 "${startdir}/test-swipe-ignore-list.py" "labwc-${_commit}" # A card's menu in the overview (0010). python3 "${startdir}/test-overview-menu.py" "labwc-${_commit}" + # A key pressed on the lock screen gets its release too (0011). + python3 "${startdir}/test-locked-key-release.py" "labwc-${_commit}" } package() { diff --git a/packages/labwc/patches/0011-locked-key-release.patch b/packages/labwc/patches/0011-locked-key-release.patch new file mode 100644 index 0000000..30a3436 --- /dev/null +++ b/packages/labwc/patches/0011-locked-key-release.patch @@ -0,0 +1,16 @@ +--- a/src/input/keyboard.c ++++ b/src/input/keyboard.c +@@ -588,6 +588,13 @@ + return LAB_KEY_HANDLED_TRUE; + } + ++ /* ++ * The press goes to the client, so its release must too. A binding ++ * that matched but does not apply while locked would otherwise stay ++ * current, and its on-release branch above would swallow the release: ++ * the lock screen keeps the key pressed and repeats it. ++ */ ++ cur_keybind = NULL; + return LAB_KEY_HANDLED_FALSE; + } + diff --git a/packages/labwc/tests/test-locked-key-release.py b/packages/labwc/tests/test-locked-key-release.py new file mode 100755 index 0000000..89d4e53 --- /dev/null +++ b/packages/labwc/tests/test-locked-key-release.py @@ -0,0 +1,23 @@ +#!/usr/bin/env python3 +"""A key press that goes to the client leaves no binding current (0011). + +Run by check(): test-locked-key-release.py SOURCE. With the session locked, +a key bound on release (Home) matches a binding that does not apply while +locked; the press goes to the lock screen. The release must follow it, so +the binding must not stay current for the release branch to swallow. +""" +from pathlib import Path +import re +import sys + +keyboard = (Path(sys.argv[1]) / 'src/input/keyboard.c').read_text() +start = keyboard.index('\nhandle_compositor_keybindings(') +body = keyboard[start:keyboard.index('\n}\n', start)] +# The release branch swallows the release of a current on-release binding. +assert re.search(r'if \(cur_keybind && cur_keybind->on_release\) \{', body), 'release branch' +# The press that is not the compositor's clears the binding before going on. +tail = body[body.rindex('cur_keybind = match_keybinding('):] +handled = tail.index('return LAB_KEY_HANDLED_TRUE;') +to_client = tail.rindex('return LAB_KEY_HANDLED_FALSE;') +assert 'cur_keybind = NULL;' in tail[handled:to_client], 'a press to the client clears the binding' +print('locked key release: ok')