mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 04:19:59 +02:00
Directly focus wine_window while holding Shift
This lets you type spaces in Bitwig, and it also allows you to interact with the settings/license popup dialogs in Voxengo plugins in a normal way.
This commit is contained in:
@@ -785,7 +785,17 @@ void Editor::fix_local_coordinates() const {
|
||||
}
|
||||
|
||||
void Editor::set_input_focus(bool grab) const {
|
||||
const xcb_window_t focus_target = grab ? parent_window : host_window;
|
||||
// NOTE: When grabbing focus, you can hold down the shift key to focus the
|
||||
// Wine window directly. This allows you to use the space key in
|
||||
// plugin GUIs in Bitwig when necessary (e.g. for naming presets) but
|
||||
// still allow space to pause/resume the transport when it's not
|
||||
// needed. It's also needed for dialogs in Voxengo plugins to function
|
||||
// properly, as they don't grab input focus themselves.
|
||||
const xcb_window_t focus_target =
|
||||
grab ? (get_active_modifiers().value_or(0) & XCB_MOD_MASK_SHIFT
|
||||
? wine_window
|
||||
: parent_window)
|
||||
: host_window;
|
||||
|
||||
xcb_generic_error_t* error = nullptr;
|
||||
const xcb_get_input_focus_cookie_t focus_cookie =
|
||||
@@ -865,6 +875,11 @@ std::optional<uint16_t> Editor::get_active_modifiers() const noexcept {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
logger.log_editor_trace([&]() {
|
||||
return "DEBUG: Active keyboard modifiers: " +
|
||||
std::to_string(query_pointer_reply->mask);
|
||||
});
|
||||
|
||||
return query_pointer_reply->mask;
|
||||
}
|
||||
|
||||
|
||||
@@ -242,6 +242,16 @@ class Editor {
|
||||
* is calling `SetFocus()`. See the comment inside of this function for more
|
||||
* details on when this is used.
|
||||
*
|
||||
* NOTE: There's a little bit of special behaviour in here. When the shift
|
||||
* key is held while grabbing input focus, then we'll focus
|
||||
* `wine_window` directly instead of focussing `wrapper_window`. This
|
||||
* allows you to temporarily override the default focus grabbing
|
||||
* behaviour, allowing you to use the space key in plugins GUIs in
|
||||
* Bitwig and to enter text in Voxengo settings and license dialogs.
|
||||
* This can also help with plugins that use popups but still rely on
|
||||
* the parent window's keyboard events to come up to control those
|
||||
* popups.
|
||||
*
|
||||
* @param grab Whether to grab input focus (if `true`) or to give back input
|
||||
* focus to `host_window` (if `false`).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user