mirror of
https://github.com/labwc/labwc.git
synced 2026-03-17 05:33:47 -04:00
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:
parent
6457cbccda
commit
a5973c3b48
5 changed files with 20 additions and 7 deletions
|
|
@ -565,7 +565,7 @@ extending outward from the snapped edge.
|
||||||
|
|
||||||
*<keyboard><numlock>* [on|off]
|
*<keyboard><numlock>* [on|off]
|
||||||
When recognizing a new keyboard enable or disable Num Lock.
|
When recognizing a new keyboard enable or disable Num Lock.
|
||||||
Default is off.
|
Default is unset.
|
||||||
|
|
||||||
*<keyboard layoutScope="">* [global|window]
|
*<keyboard layoutScope="">* [global|window]
|
||||||
Stores the keyboard layout either globally or per window and restores
|
Stores the keyboard layout either globally or per window and restores
|
||||||
|
|
|
||||||
|
|
@ -229,7 +229,10 @@
|
||||||
your favourite terminal or application launcher. See rc.xml for an example.
|
your favourite terminal or application launcher. See rc.xml for an example.
|
||||||
-->
|
-->
|
||||||
<keyboard>
|
<keyboard>
|
||||||
<numlock>off</numlock>
|
<!--
|
||||||
|
# Numlock is not set by default
|
||||||
|
<numlock>on|off</numlock>
|
||||||
|
-->
|
||||||
<layoutScope>global</layoutScope>
|
<layoutScope>global</layoutScope>
|
||||||
<repeatRate>25</repeatRate>
|
<repeatRate>25</repeatRate>
|
||||||
<repeatDelay>600</repeatDelay>
|
<repeatDelay>600</repeatDelay>
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,7 @@
|
||||||
#include "common/border.h"
|
#include "common/border.h"
|
||||||
#include "common/buf.h"
|
#include "common/buf.h"
|
||||||
#include "common/font.h"
|
#include "common/font.h"
|
||||||
|
#include "common/three-state.h"
|
||||||
#include "config/touch.h"
|
#include "config/touch.h"
|
||||||
#include "config/tablet.h"
|
#include "config/tablet.h"
|
||||||
#include "config/tablet-tool.h"
|
#include "config/tablet-tool.h"
|
||||||
|
|
@ -104,7 +105,7 @@ struct rcxml {
|
||||||
/* keyboard */
|
/* keyboard */
|
||||||
int repeat_rate;
|
int repeat_rate;
|
||||||
int repeat_delay;
|
int repeat_delay;
|
||||||
bool kb_numlock_enable;
|
enum three_state kb_numlock_enable;
|
||||||
bool kb_layout_per_window;
|
bool kb_layout_per_window;
|
||||||
struct wl_list keybinds; /* struct keybind.link */
|
struct wl_list keybinds; /* struct keybind.link */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,6 +24,7 @@
|
||||||
#include "common/parse-bool.h"
|
#include "common/parse-bool.h"
|
||||||
#include "common/parse-double.h"
|
#include "common/parse-double.h"
|
||||||
#include "common/string-helpers.h"
|
#include "common/string-helpers.h"
|
||||||
|
#include "common/three-state.h"
|
||||||
#include "config/default-bindings.h"
|
#include "config/default-bindings.h"
|
||||||
#include "config/keybind.h"
|
#include "config/keybind.h"
|
||||||
#include "config/libinput.h"
|
#include "config/libinput.h"
|
||||||
|
|
@ -1150,7 +1151,10 @@ entry(xmlNode *node, char *nodename, char *content)
|
||||||
} else if (!strcasecmp(nodename, "repeatDelay.keyboard")) {
|
} else if (!strcasecmp(nodename, "repeatDelay.keyboard")) {
|
||||||
rc.repeat_delay = atoi(content);
|
rc.repeat_delay = atoi(content);
|
||||||
} else if (!strcasecmp(nodename, "numlock.keyboard")) {
|
} else if (!strcasecmp(nodename, "numlock.keyboard")) {
|
||||||
set_bool(content, &rc.kb_numlock_enable);
|
bool value;
|
||||||
|
set_bool(content, &value);
|
||||||
|
rc.kb_numlock_enable = value ? LAB_STATE_ENABLED
|
||||||
|
: LAB_STATE_DISABLED;
|
||||||
} else if (!strcasecmp(nodename, "layoutScope.keyboard")) {
|
} else if (!strcasecmp(nodename, "layoutScope.keyboard")) {
|
||||||
/*
|
/*
|
||||||
* This can be changed to an enum later on
|
* This can be changed to an enum later on
|
||||||
|
|
@ -1497,7 +1501,7 @@ rcxml_init(void)
|
||||||
|
|
||||||
rc.repeat_rate = 25;
|
rc.repeat_rate = 25;
|
||||||
rc.repeat_delay = 600;
|
rc.repeat_delay = 600;
|
||||||
rc.kb_numlock_enable = false;
|
rc.kb_numlock_enable = LAB_STATE_UNSPECIFIED;
|
||||||
rc.kb_layout_per_window = false;
|
rc.kb_layout_per_window = false;
|
||||||
rc.screen_edge_strength = 20;
|
rc.screen_edge_strength = 20;
|
||||||
rc.window_edge_strength = 20;
|
rc.window_edge_strength = 20;
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@
|
||||||
#include <wlr/backend/session.h>
|
#include <wlr/backend/session.h>
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include "action.h"
|
#include "action.h"
|
||||||
|
#include "common/three-state.h"
|
||||||
#include "idle.h"
|
#include "idle.h"
|
||||||
#include "input/ime.h"
|
#include "input/ime.h"
|
||||||
#include "input/keyboard.h"
|
#include "input/keyboard.h"
|
||||||
|
|
@ -672,6 +673,10 @@ keyboard_key_notify(struct wl_listener *listener, void *data)
|
||||||
void
|
void
|
||||||
keyboard_set_numlock(struct wlr_keyboard *keyboard)
|
keyboard_set_numlock(struct wlr_keyboard *keyboard)
|
||||||
{
|
{
|
||||||
|
if (rc.kb_numlock_enable == LAB_STATE_UNSPECIFIED) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
xkb_mod_index_t num_idx =
|
xkb_mod_index_t num_idx =
|
||||||
xkb_map_mod_get_index(keyboard->keymap, XKB_MOD_NAME_NUM);
|
xkb_map_mod_get_index(keyboard->keymap, XKB_MOD_NAME_NUM);
|
||||||
if (num_idx == XKB_MOD_INVALID) {
|
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;
|
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;
|
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);
|
locked &= ~((xkb_mod_mask_t)1 << num_idx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue