mirror of
https://github.com/kunkundi/crossdesk.git
synced 2026-11-12 03:28:20 +08:00
[fix] keep stream menus open while suspending remote input
This commit is contained in:
1 parent
69d4394717
commit
14fa95beeb
4 files changed
+52
-23
No files matched your search
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* @Author: DI JUNKUN
|
||||
* @Date: 2026-11-11
|
||||
* Copyright (c) 2026 by DI JUNKUN, All Rights Reserved.
|
||||
*/
|
||||
|
||||
#ifndef _STREAM_KEYBOARD_FOCUS_H_
|
||||
#define _STREAM_KEYBOARD_FOCUS_H_
|
||||
|
||||
namespace crossdesk {
|
||||
|
||||
// Native window focus and ownership of keyboard input are different: a local
|
||||
// menu keeps the window active while temporarily suspending remote input.
|
||||
// Publish the new state before releasing input, since UI callbacks can reenter.
|
||||
template <typename Release>
|
||||
void UpdateStreamKeyboardFocus(bool focused, bool local_input_active,
|
||||
bool& remote_focused, Release release) {
|
||||
focused = focused && !local_input_active;
|
||||
if (remote_focused == focused) return;
|
||||
remote_focused = focused;
|
||||
if (!focused) release(local_input_active);
|
||||
}
|
||||
|
||||
} // namespace crossdesk
|
||||
|
||||
#endif
|
||||
Reference in new issue
Block a user