Bug 426719

Summary: konsole does not send FocusOut event to QPlatformInputContext->setFocusObject() with focus changes between tabs
Product: [Applications] konsole Reporter: fujiwara <fujiwara>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version: 19.12.2   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description fujiwara 2020-09-19 11:21:40 UTC
SUMMARY
IBus cannot receive the focus-out events when I switch tabs in konsole.

STEPS TO REPRODUCE
1. Install libibusplatforminputcontextplugin.so in qtbase
2. Run ibus-daemon in your Plasma desktop
3. Run env QT_IM_MODULE=ibus konsole
4. Type Ctrl-Shift-t and open a new tab in konsole
5. Click another tab to switch the input focus.

OBSERVED RESULT
QIBusPlatformInputContext::setFocusObject() always receives non-null objects which means tabs receive focus-in events only.

EXPECTED RESULT
QIBusPlatformInputContext::setFocusObject() receives null objects and non-null objects which means tabs receive focus-in and focus-out events.

When I change the focus between windows, E.g. konsole and kwrite, konsole can get focus-out events below.

#0  QIBusPlatformInputContext::setFocusObject (this=0x55616f656200, object=0x0)
    at qibusplatforminputcontext.cpp:265
#1  0x00007f5745f0c79c in QGuiApplicationPrivate::_q_updateFocusObject (
    this=0x55616f590dd0, object=0x0) at kernel/qguiapplication.cpp:4033
#2  0x00007f5745f06e5b in QGuiApplicationPrivate::processActivatedEvent (
    e=0x55616fb383e0) at kernel/qguiapplication.cpp:2332
#3  0x00007f5745f05223 in QGuiApplicationPrivate::processWindowSystemEvent (
    e=0x55616fb383e0) at kernel/qguiapplication.cpp:1860
#4  0x00007f5745eef1fb in QWindowSystemInterface::sendWindowSystemEvents (
    flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1148
#5  0x00007f573495bc8e in xcbSourceDispatch (source=<optimized out>)
    at qxcbeventdispatcher.cpp:105
#6  0x00007f57441b094d in g_main_dispatch (context=0x7f572c005010)
    at ../glib/gmain.c:3309
#7  0x00007f57441b188b in g_main_context_dispatch (context=0x7f572c005010)
    at ../glib/gmain.c:3974
#8  0x00007f57441b1a83 in g_main_context_iterate (context=0x7f572c005010,
    block=1, dispatch=1, self=0x7f572c004d60) at ../glib/gmain.c:4047
#9  0x00007f57441b1b63 in g_main_context_iteration (context=0x7f572c005010,
    may_block=1) at ../glib/gmain.c:4108
#10 0x00007f5745b9b6d6 in QEventDispatcherGlib::processEvents (
    this=0x55616f64a580, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#11 0x00007f5745b4afcb in QEventLoop::exec (this=0x7ffe5122d110, flags=...)

You can see object==null in the stack.


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: Fedora 32
(available in About System)
KDE Plasma Version: 5.18.4
KDE Frameworks Version: kf5-frameworkintegration-5.68.0
Qt Version: 5.13.2

ADDITIONAL INFORMATION