libobs: Fix Wayland push to talk (sort of)#13387
libobs: Fix Wayland push to talk (sort of)#13387thomasza92 wants to merge 1 commit intoobsproject:masterfrom
Conversation
Querying global key state is sometimes unreliable, so unknown polling states should not be treated the same as a released hotkey. Added a pressed-state enum in order to distinguish between pressed, released, and unknown key states.
|
Possibly coflict with this: #13363. It completely refactored |
Sure! After further testing I've noticed at least two issues that persist.
There seems to be at least a few issues with hotkeys that could maybe be further identified / specified and then fixed in a more comprehensive PR? I am willing to do future contributions and perform testing across several different operating systems and architectures. |
|
Thank you for testing! Here I want to declare the background:
And There are my opinions about your two issues: FirstPTT behaves like this is something... as expected. Noticing there is a global variable As you said, After all: Since there is a forever true variable SecoundI believe different platforms have different keyboard event mechanicals. And OBS didn't do well about such thing for a long time. This PR do fix the issue on my machine. (Classic speaking.) We need to debug it more. And yes, since there are so many problems about hotkeys. I assume this part just happend to be usable. I mean, do you even understand how |
|
I'm free these days. If you wish, we can discuss this further. By the way, I don't know how do Linux and macOS deal with this. If you can help me test it, I'll be appreciate. P.S. I'm using UTC+8. |
|
Just when I'm typing here, I find PTT doesn't work when I'm playing Delta Force but work when I'm playing CS2. There are brunch of issues about hotkeys. |
|
I think we are tricked. Actually Qt will handle key events with My suggestion is that we must merge their hotkeys fuction someday. However it is so complicated - we cannot just remove Qt part because it is needed for some other shotcuts. (e.g. Alt + C to cancel. This may cause other issues.) Of course, there are many problems about cross-platform. |
Interesting... Thanks for all the comments and insights. I will have time to take a look some more this upcoming weekend. If you would like, feel free to send me an email and perhaps we could organize a time to work on this in real time. |
|
Note: OBS processes hotkeys in different way when the windows is in focus. In
Looks bad. Because |
Description
Querying global key state is sometimes unreliable, so unknown states should not be treated the same as a released hotkey.
Added a pressed-state enum in order to distinguish between pressed, released, and unknown key states.
Motivation and Context
I initially ran into this issue while trying to setup OBS with Arch using Wayland. I quickly found that I could not get push to talk working correctly. I checked the open issues and saw that there were at least two I could find which I believe were describing the same problem I was experiencing (#10701 #13169).
This comment is what I based my fix on: #10701 (comment)
While I was testing the fix I also ran into this same issue on macOS when building from source at the current latest commit (085a51a). Perhaps someone can further verify that this problem exists there. I originally planned to gate the changes behind checks for linux and wayland but since it was causing problems for me on macOS as well I opted for the following changes instead.
Note that this PR touches several different files and deals with some core functionality of OBS. That being said, I tried to keep the changes as minimal as possible. Any further discussion or suggestion on edits would be greatly appreciated.
How Has This Been Tested?
I tested this on Arch Linux, Windows 11, and macOS, all of which seemed to work fine, but I think more testing should definitely be done.
Types of changes
This PR does NOT fix the issue of hotkeys not working on Wayland when the window is not in focus!!
I believe the only way to fix that issue would be to integrate OBS with Global Shortcuts through XDG Desktop Portal. That is a much bigger change and is probably beyond my capabilities.
Checklist: