keyboard: do not set numlock by default

Only force on|off if users specifically requests it in the config file.

Related-to: #2463
This commit is contained in:
Johan Malm 2024-12-31 15:25:31 +00:00 committed by Johan Malm
parent 6457cbccda
commit a5973c3b48
5 changed files with 20 additions and 7 deletions

View file

@ -6,6 +6,7 @@
#include <wlr/backend/session.h>
#include <wlr/interfaces/wlr_keyboard.h>
#include "action.h"
#include "common/three-state.h"
#include "idle.h"
#include "input/ime.h"
#include "input/keyboard.h"
@ -672,6 +673,10 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
void
keyboard_set_numlock(struct wlr_keyboard *keyboard)
{
if (rc.kb_numlock_enable == LAB_STATE_UNSPECIFIED) {
return;
}
xkb_mod_index_t num_idx =
xkb_map_mod_get_index(keyboard->keymap, XKB_MOD_NAME_NUM);
if (num_idx == XKB_MOD_INVALID) {
@ -680,9 +685,9 @@ keyboard_set_numlock(struct wlr_keyboard *keyboard)
}
xkb_mod_mask_t locked = keyboard->modifiers.locked;
if (rc.kb_numlock_enable) {
if (rc.kb_numlock_enable == LAB_STATE_ENABLED) {
locked |= (xkb_mod_mask_t)1 << num_idx;
} else {
} else if (rc.kb_numlock_enable == LAB_STATE_DISABLED) {
locked &= ~((xkb_mod_mask_t)1 << num_idx);
}