diff options
| author | Felix Ernst <[email protected]> | 2025-01-04 18:58:22 +0100 |
|---|---|---|
| committer | Felix Ernst <[email protected]> | 2025-01-06 15:09:14 +0000 |
| commit | bfeeb46c3ae0b6e933b0381cc10eebad38a2b8c0 (patch) | |
| tree | dcaf65988ce4738e4dcee13aa23d2fb54526bd45 /src/dolphindockwidget.cpp | |
| parent | 738a51dddd410ef0a639a8eddd5dc26b30dbfe48 (diff) | |
Fix focus changing when unminimising on X11
In f220e3b0783a24a6c7195f170297cf4b12a29d85 I made the keyboard
focus move to the places and terminal panel whenever they are
toggled visible. Unfortunately the QDockWidget::visibilityChanged()
signal is also emitted (at least on X11) simply when the window
containing that panel is minimized or restored. This commit
overrides the QDockWidget::event() method to ignore such
spontaneous show or hide events so QDockWidget won't emit the
visibilityChanged() signal then.
BUG: 497803
Diffstat (limited to 'src/dolphindockwidget.cpp')
| -rw-r--r-- | src/dolphindockwidget.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/dolphindockwidget.cpp b/src/dolphindockwidget.cpp index 930c38e35..5e79e0316 100644 --- a/src/dolphindockwidget.cpp +++ b/src/dolphindockwidget.cpp @@ -6,6 +6,7 @@ #include "dolphindockwidget.h" +#include <QEvent> #include <QStyle> namespace @@ -77,5 +78,21 @@ bool DolphinDockWidget::isLocked() const return m_locked; } +bool DolphinDockWidget::event(QEvent *event) +{ + switch (event->type()) { + case QEvent::Show: + case QEvent::Hide: + if (event->spontaneous()) { + // The Dolphin window has been minimized or restored. We do not want this to be interpreted like a user was toggling the visibility of this widget. + // We return here so no QDockWidget::visibilityChanged() signal is emitted. This does not seem to happen either way on Wayland. + return true; + } + [[fallthrough]]; + default: + return QDockWidget::event(event); + } +} + #include "dolphindockwidget.moc" #include "moc_dolphindockwidget.cpp" |
