Trace input focus grabbing

This commit is contained in:
Robbert van der Helm
2021-07-26 12:38:17 +02:00
parent f5ada4469b
commit 890c534573
2 changed files with 27 additions and 0 deletions
+7
View File
@@ -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
+20
View File
@@ -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());