Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add mapping for non-numlocked numpad keys under Wayland #11606

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion libobs/obs-nix-wayland.c
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,24 @@ static obs_key_t obs_nix_wayland_key_from_virtual_key(int sym)
return OBS_KEY_NUM8;
case XKB_KEY_KP_9:
return OBS_KEY_NUM9;

case XKB_KEY_KP_Home:
return OBS_KEY_HOME;
case XKB_KEY_KP_Up:
return OBS_KEY_UP;
case XKB_KEY_KP_Prior:
return OBS_KEY_PAGEUP;
case XKB_KEY_KP_Left:
return OBS_KEY_LEFT;
case XKB_KEY_KP_Begin:
return OBS_KEY_CLEAR;
case XKB_KEY_KP_Right:
return OBS_KEY_RIGHT;
case XKB_KEY_KP_End:
return OBS_KEY_END;
case XKB_KEY_KP_Down:
return OBS_KEY_DOWN;
case XKB_KEY_KP_Next:
return OBS_KEY_PAGEDOWN;
case XKB_KEY_XF86AudioPlay:
return OBS_KEY_VK_MEDIA_PLAY_PAUSE;
case XKB_KEY_XF86AudioStop:
Expand Down
60 changes: 59 additions & 1 deletion libobs/obs-nix-x11.c
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,43 @@
#include <X11/Xlib-xcb.h>
#include <X11/XF86keysym.h>
#include <X11/Sunkeysym.h>
#include <X11/keysymdef.h>

#ifndef XKB_KEY_KP_Home
#define XKB_KEY_KP_Home XK_KP_Home
#endif

#ifndef XKB_KEY_KP_Up
#define XKB_KEY_KP_Up XK_KP_Up
#endif

#ifndef XKB_KEY_KP_Prior
#define XKB_KEY_KP_Prior XK_KP_Prior
#endif

#ifndef XKB_KEY_KP_Left
#define XKB_KEY_KP_Left XK_KP_Left
#endif

#ifndef XKB_KEY_KP_Begin
#define XKB_KEY_KP_Begin XK_KP_Begin
#endif

#ifndef XKB_KEY_KP_Right
#define XKB_KEY_KP_Right XK_KP_Right
#endif

#ifndef XKB_KEY_KP_End
#define XKB_KEY_KP_End XK_KP_End
#endif

#ifndef XKB_KEY_KP_Down
#define XKB_KEY_KP_Down XK_KP_Down
#endif

#ifndef XKB_KEY_KP_Next
#define XKB_KEY_KP_Next XK_KP_Next
#endif

void obs_nix_x11_log_info(void)
{
Expand Down Expand Up @@ -1254,7 +1291,28 @@ static obs_key_t obs_nix_x11_key_from_virtual_key(int sym)
}
}

return OBS_KEY_NONE;
switch (sym) {
case XKB_KEY_KP_Home:
return OBS_KEY_HOME;
case XKB_KEY_KP_Up:
return OBS_KEY_UP;
case XKB_KEY_KP_Prior:
return OBS_KEY_PAGEUP;
case XKB_KEY_KP_Left:
return OBS_KEY_LEFT;
case XKB_KEY_KP_Begin:
return OBS_KEY_CLEAR;
case XKB_KEY_KP_Right:
return OBS_KEY_RIGHT;
case XKB_KEY_KP_End:
return OBS_KEY_END;
case XKB_KEY_KP_Down:
return OBS_KEY_DOWN;
case XKB_KEY_KP_Next:
return OBS_KEY_PAGEDOWN;
default:
return OBS_KEY_NONE;
}
}

static int obs_nix_x11_key_to_virtual_key(obs_key_t key)
Expand Down
Loading