opt: remove useless normalize keysym convert
This commit is contained in:
@@ -517,61 +517,6 @@ long int parse_color(const char *hex_str) {
|
||||
return hex_num;
|
||||
}
|
||||
|
||||
xkb_keysym_t normalize_keysym(xkb_keysym_t sym) {
|
||||
// 首先转换为小写(主要影响字母键)
|
||||
sym = xkb_keysym_to_lower(sym);
|
||||
|
||||
// 将数字小键盘键转换为普通数字键
|
||||
switch (sym) {
|
||||
// 小键盘数字转换
|
||||
case XKB_KEY_KP_0:
|
||||
return XKB_KEY_0;
|
||||
case XKB_KEY_KP_1:
|
||||
return XKB_KEY_1;
|
||||
case XKB_KEY_KP_2:
|
||||
return XKB_KEY_2;
|
||||
case XKB_KEY_KP_3:
|
||||
return XKB_KEY_3;
|
||||
case XKB_KEY_KP_4:
|
||||
return XKB_KEY_4;
|
||||
case XKB_KEY_KP_5:
|
||||
return XKB_KEY_5;
|
||||
case XKB_KEY_KP_6:
|
||||
return XKB_KEY_6;
|
||||
case XKB_KEY_KP_7:
|
||||
return XKB_KEY_7;
|
||||
case XKB_KEY_KP_8:
|
||||
return XKB_KEY_8;
|
||||
case XKB_KEY_KP_9:
|
||||
return XKB_KEY_9;
|
||||
|
||||
// 将 Shift+数字 的符号转换回基础数字
|
||||
case XKB_KEY_exclam:
|
||||
return XKB_KEY_1; // !
|
||||
case XKB_KEY_at:
|
||||
return XKB_KEY_2; // @
|
||||
case XKB_KEY_numbersign:
|
||||
return XKB_KEY_3; // #
|
||||
case XKB_KEY_dollar:
|
||||
return XKB_KEY_4; // $
|
||||
case XKB_KEY_percent:
|
||||
return XKB_KEY_5; // %
|
||||
case XKB_KEY_asciicircum:
|
||||
return XKB_KEY_6; // ^
|
||||
case XKB_KEY_ampersand:
|
||||
return XKB_KEY_7; // &
|
||||
case XKB_KEY_asterisk:
|
||||
return XKB_KEY_8; // *
|
||||
case XKB_KEY_parenleft:
|
||||
return XKB_KEY_9; // (
|
||||
case XKB_KEY_parenright:
|
||||
return XKB_KEY_0; // )
|
||||
|
||||
default:
|
||||
return sym;
|
||||
}
|
||||
}
|
||||
|
||||
// 辅助函数:检查字符串是否以指定的前缀开头(忽略大小写)
|
||||
static bool starts_with_ignore_case(const char *str, const char *prefix) {
|
||||
while (*prefix) {
|
||||
|
||||
@@ -971,7 +971,7 @@ int tag(const Arg *arg) {
|
||||
}
|
||||
|
||||
int tagmon(const Arg *arg) {
|
||||
Monitor *m = NULL,*cm = NULL;
|
||||
Monitor *m = NULL, *cm = NULL;
|
||||
Client *c = focustop(selmon);
|
||||
|
||||
if (!c)
|
||||
|
||||
@@ -3345,8 +3345,8 @@ keybinding(unsigned int state, bool locked, unsigned int mods, xkb_keysym_t sym,
|
||||
(strcmp(keymode.mode, k->mode) == 0)) &&
|
||||
CLEANMASK(mods) == CLEANMASK(k->mod) &&
|
||||
((k->keysymcode.type == KEY_TYPE_SYM &&
|
||||
normalize_keysym(sym) ==
|
||||
normalize_keysym(k->keysymcode.keysym)) ||
|
||||
xkb_keysym_to_lower(sym) ==
|
||||
xkb_keysym_to_lower(k->keysymcode.keysym)) ||
|
||||
(k->keysymcode.type == KEY_TYPE_CODE &&
|
||||
(keycode == k->keysymcode.keycode.keycode1 ||
|
||||
keycode == k->keysymcode.keycode.keycode2 ||
|
||||
|
||||
Reference in New Issue
Block a user