obsproject / obs-studio

OBS Studio - Free and open source software for live streaming and screen recording

Home Page:https://obsproject.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-numlocked numpad keys cannot be assigned as hotkeys under Wayland

jonhoo opened this issue · comments

Operating System Info

Other

Other OS

Arch Linux

OBS Studio Version

Git

OBS Studio Version (Other)

ga4834efde

OBS Studio Log URL

Nothing relevant in logs

OBS Studio Crash Log URL

No response

Expected Behavior

The numpad End key is assigned to the chosen action.

Current Behavior

Nothing happens. The input field remains blank.

Steps to Reproduce

  1. Run a Wayland compositor (I'm using Hyprland)
  2. Turn off num-lock
  3. Run wev
  4. Press the "1" key on the numpad
  5. Notice that it records that the button KP_End was pressed (distinct from the End key)
  6. Close wev
  7. Open OBS
  8. Open Settings -> Hotkeys and select the input field for an unassigned action
  9. Press the "1" key on the numpad

Anything else we should know?

Numeric inputs from the numpad work just fine (like "1" with num lock turned on). The equivalent non-numpad keys work fine (like the regular "End" key).

It could be that Hyprland is doing something weird in how it handles num lock (see hyprwm/Hyprland#2682 for example), but given that wev produces the expected output I don't think this is related to Hyprland.

We dont map special keypad face buttons (see:

case XKB_KEY_KP_Equal:
)

Someone would need to add these or convince xkb to do the mapping back to the non-keypad versions.

Thanks for the pointer! So that means it would need to be added to:

OBS_HOTKEY(OBS_KEY_NUMEQUAL)
OBS_HOTKEY(OBS_KEY_NUMASTERISK)
OBS_HOTKEY(OBS_KEY_NUMPLUS)
OBS_HOTKEY(OBS_KEY_NUMCOMMA)
OBS_HOTKEY(OBS_KEY_NUMMINUS)
OBS_HOTKEY(OBS_KEY_NUMPERIOD)
OBS_HOTKEY(OBS_KEY_NUMSLASH)
OBS_HOTKEY(OBS_KEY_NUM0)
OBS_HOTKEY(OBS_KEY_NUM1)
OBS_HOTKEY(OBS_KEY_NUM2)
OBS_HOTKEY(OBS_KEY_NUM3)
OBS_HOTKEY(OBS_KEY_NUM4)
OBS_HOTKEY(OBS_KEY_NUM5)
OBS_HOTKEY(OBS_KEY_NUM6)
OBS_HOTKEY(OBS_KEY_NUM7)
OBS_HOTKEY(OBS_KEY_NUM8)
OBS_HOTKEY(OBS_KEY_NUM9)

case XKB_KEY_KP_Equal:
return OBS_KEY_NUMEQUAL;
case XKB_KEY_KP_Multiply:
return OBS_KEY_NUMASTERISK;
case XKB_KEY_KP_Add:
return OBS_KEY_NUMPLUS;
case XKB_KEY_KP_Separator:
return OBS_KEY_NUMCOMMA;
case XKB_KEY_KP_Subtract:
return OBS_KEY_NUMMINUS;
case XKB_KEY_KP_Decimal:
return OBS_KEY_NUMPERIOD;
case XKB_KEY_KP_Divide:
return OBS_KEY_NUMSLASH;
case XKB_KEY_KP_Enter:
return OBS_KEY_ENTER;
case XKB_KEY_KP_0:
return OBS_KEY_NUM0;
case XKB_KEY_KP_1:
return OBS_KEY_NUM1;
case XKB_KEY_KP_2:
return OBS_KEY_NUM2;
case XKB_KEY_KP_3:
return OBS_KEY_NUM3;
case XKB_KEY_KP_4:
return OBS_KEY_NUM4;
case XKB_KEY_KP_5:
return OBS_KEY_NUM5;
case XKB_KEY_KP_6:
return OBS_KEY_NUM6;
case XKB_KEY_KP_7:
return OBS_KEY_NUM7;
case XKB_KEY_KP_8:
return OBS_KEY_NUM8;
case XKB_KEY_KP_9:
return OBS_KEY_NUM9;

case OBS_KEY_NUMEQUAL:
return XK_KP_Equal;
case OBS_KEY_NUMASTERISK:
return XK_KP_Multiply;
case OBS_KEY_NUMPLUS:
return XK_KP_Add;
case OBS_KEY_NUMCOMMA:
return XK_KP_Separator;
case OBS_KEY_NUMMINUS:
return XK_KP_Subtract;
case OBS_KEY_NUMPERIOD:
return XK_KP_Decimal;
case OBS_KEY_NUMSLASH:
return XK_KP_Divide;
case OBS_KEY_NUM0:
return XK_KP_0;
case OBS_KEY_NUM1:
return XK_KP_1;
case OBS_KEY_NUM2:
return XK_KP_2;
case OBS_KEY_NUM3:
return XK_KP_3;
case OBS_KEY_NUM4:
return XK_KP_4;
case OBS_KEY_NUM5:
return XK_KP_5;
case OBS_KEY_NUM6:
return XK_KP_6;
case OBS_KEY_NUM7:
return XK_KP_7;
case OBS_KEY_NUM8:
return XK_KP_8;
case OBS_KEY_NUM9:
return XK_KP_9;

obs-studio/libobs/obs-hotkey.c

Lines 1353 to 1368 in 578dc46

#ifdef __APPLE__
const char *numpad_str = t.apple_keypad_num;
ADD_TRANSLATION(OBS_KEY_NUMSLASH, apple_keypad_divide);
ADD_TRANSLATION(OBS_KEY_NUMASTERISK, apple_keypad_multiply);
ADD_TRANSLATION(OBS_KEY_NUMMINUS, apple_keypad_minus);
ADD_TRANSLATION(OBS_KEY_NUMPLUS, apple_keypad_plus);
ADD_TRANSLATION(OBS_KEY_NUMPERIOD, apple_keypad_decimal);
ADD_TRANSLATION(OBS_KEY_NUMEQUAL, apple_keypad_equal);
#else
const char *numpad_str = t.numpad_num;
ADD_TRANSLATION(OBS_KEY_NUMSLASH, numpad_divide);
ADD_TRANSLATION(OBS_KEY_NUMASTERISK, numpad_multiply);
ADD_TRANSLATION(OBS_KEY_NUMMINUS, numpad_minus);
ADD_TRANSLATION(OBS_KEY_NUMPLUS, numpad_plus);
ADD_TRANSLATION(OBS_KEY_NUMPERIOD, numpad_decimal);
#endif

Anywhere else?

a964194 is the last addition of new keys.

Whether they should be their own keys or map into normal end/pgdn/etc im not sure. Id probably just map them to the normal keys and not add extra keys. You should probably see what occurs in windows/mac for the same keys.