obs-browser: Fix key mapping on linux #206
No reviewers
Labels
No labels
area/accessibility
area/dependency
Confirmed
Crash Report
Delayed
Design Issue
Duplicate
Feedback required
Good first issue
kind/bug
kind/cleanup
kind/enhancement
platform/linux
platform/macos
platform/windows
priority/high
Question
Request for Comments
Seeking Other Contributors
Seeking Testers
Won't Fix / By Design
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-obsproject/obs-browser!206
Loading…
Reference in a new issue
No description provided.
Delete branch "master"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
The fix maps, only for Linux systems, XKB keycodes (that are provided to the SendKeyClick function) to the Javascript ones. The fix also add the native_scancode as value for the native_vkey, that seems to make the fix work also on Windows. (thanks to WizardCM for the collab)
Motivation and Context
The keypress event was inusable on obs-browser. This seems to fully fix this
Fixes #200
How Has This Been Tested?
Tested on Slackware-current, using CEF build 3809. As long as I tested, all seems to work fine
Types of changes
Bug fix (non-breaking change which fixes an issue)
Checklist:
Please add the appropriate library search in cmake along with adding the appropriate include dirs (but without linking since we do not actually need the library).
You can see a good example of a simple find module at
https://github.com/obsproject/obs-studio/blob/master/cmake/Modules/FindX11_XCB.cmake
Adding a module searching pkg-config for
x11(case matters) will get you the PKG_X11_LIBRARIES and PKG_X11_INCLUDE_DIR and follow the pattern in the above file for filling out the variables.Like with findCef just drop it in the root of this package https://github.com/obsproject/obs-browser/blob/master/FindCEF.cmake
Then in the CMakeLists.txt you can simply
find_package(X11)and use the X11_INCLUDE_DIR in aninclude_directories($X11_INCLUDE_DIR)in some Linux specificifblock.I don't know if this is right, I think is how it should work
libX11-xcb is separate from libX11. The module for it is an example that is relatively simple. You should replace xcb references with plain x11 references. And change the header being searched for from the xcb header
X11/Xlib-xcb.hto the X11 header you are usingX11/keysym.h.You can run
cmaketo test it. If running cmake with this commit didnt fail on your system you must already have an existing FindX11.cmake in your system module path that found it.this seems to go well. I also passed the files through clang-format
This seems unrelated to the PR. Did you mean to add this change?
woops, that was unintended. I corrected it
@ -294,13 +298,19 @@ void BrowserSource::SendKeyClick(const struct obs_key_event *event, bool key_up){If you are going to copy and paste code from chromium at least document it so we know where to go to find updated versions.
For example this entire function is out of date with chromium head and noted that it only sort of works correctly on US layouts.
https://chromium.googlesource.com/chromium/src/+/lkgr/ui/events/keycodes/keyboard_code_conversion_x.cc
@ -294,13 +298,19 @@ void BrowserSource::SendKeyClick(const struct obs_key_event *event, bool key_up){well, that was the only mapping that I found that worked on both italian and US layouts (the two I had). If you want to suggest a modification in particular, can you do a pull request to my repo and I'll merge it