mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Trace input focus grabbing
This commit is contained in:
@@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic
|
||||
Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
### Changed
|
||||
|
||||
- Added more tracing for input focus handling when using the `+editor`
|
||||
`YABRIDGE_DEBUG_LEVEL` flag.
|
||||
|
||||
## [3.5.0] - 2021-06-23
|
||||
|
||||
### Added
|
||||
|
||||
@@ -753,6 +753,21 @@ void Editor::set_input_focus(bool grab) const {
|
||||
if (current_focus == focus_target ||
|
||||
(grab && is_child_window_or_same(*x11_connection, current_focus,
|
||||
focus_target))) {
|
||||
logger.log_editor_trace([&]() {
|
||||
std::string reason = "unknown reason";
|
||||
if (current_focus == focus_target) {
|
||||
reason = "already focused";
|
||||
} else if (grab &&
|
||||
is_child_window_or_same(*x11_connection, current_focus,
|
||||
focus_target)) {
|
||||
reason = "current focus " + std::to_string(current_focus) +
|
||||
" is a child of " + std::to_string(focus_target);
|
||||
}
|
||||
|
||||
return "DEBUG: Not grabbing input focus for window " +
|
||||
std::to_string(focus_target) + "(" + reason + ")";
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -770,6 +785,11 @@ void Editor::set_input_focus(bool grab) const {
|
||||
// `IPlugView::onKey{Down,Up}` should handle all keyboard events. But
|
||||
// in practice a lot of hosts don't use that, so we still need to grab
|
||||
// focus ourselves.
|
||||
logger.log_editor_trace([&]() {
|
||||
return "DEBUG: Setting input focus to window " +
|
||||
std::to_string(focus_target);
|
||||
});
|
||||
|
||||
xcb_set_input_focus(x11_connection.get(), XCB_INPUT_FOCUS_PARENT,
|
||||
focus_target, XCB_CURRENT_TIME);
|
||||
xcb_flush(x11_connection.get());
|
||||
|
||||
Reference in New Issue
Block a user