-
Notifications
You must be signed in to change notification settings - Fork 119
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
Global Hotkeys support for gtk2 for Windows #94
base: master
Are you sure you want to change the base?
Global Hotkeys support for gtk2 for Windows #94
Conversation
This would be really useful. I'm afraid I don't personally have time to give the code a good review right now. |
Thanks for initial positive response. I also tested on Linux to make sure it works there as before. About code review, is there anyone else? Otherwise I hope that you can manage some moment in future. Hopefully before next release. If you need some more information from me about why I did the things the way I did them, feel free to ask. And note that this is not the first PR from my side into Audacious. |
Hi, I'm belatedly getting to look at this.
|
Also please remove commented-out code and the |
50ba2ca
to
82e9bac
Compare
Done as you said. |
Is there a way to handle global hotkeys without referencing the main Audacious window? |
As far as my knowledge goes, no. Windows API function RegisterHotKey needs a window that is receiving messages. There may be a way to use some other window that is not "main Audacious window". The way I did it needed significant research, and this is the method that I managed to come up with. |
The documentation for RegisterHotKey says, "If this parameter [hWnd] is NULL, WM_HOTKEY messages are posted to the message queue of the calling thread and must be processed in the message loop." It looks like you would then retrieve those messages by passing hWnd = NULL again to GetMessage. Please look into that method. The code in its current state is too tightly coupled to a specific UI plugin. Searching for the main window by title is particularly bad. |
I'm pretty busy these days. So, I cannot promise anything. |
Just to be sure, the related code is the following?: bool WindowsWindow::is_main_window(bool allow_hidden) const
{
if (main_window_hidden_ && !allow_hidden)
return false;
bool returning =
(class_name_ == "gdkWindowToplevel" && [](const std::string & title) {
return title == N_("Audacious") ||
title.find(translated_title()) != std::string::npos ||
title == N_("Buffering ..."); // msgid "%s - Audacious"
}(win_header_));
if (returning)
{
kind_ = AudaciousWindowKind::MAIN_WINDOW;
}
return returning;
} |
That's part of it. The whole |
Hello, Sorry to necro. However I'd love this functionality too. Ideally using the media keys. With that, hopefully it'd be detected by KDE connect on my phone. |
Global Hotkeys support for gtk2 for Windows.
I have further ideas for improvements, hence some commented out experimental code. This is "checkpoint" state that works.
I am willing to keep supporting code of this plugin in future, in case other people have (and report) issues with it regarding my changes.