<html>
<body>
<div style="font-family: Verdana, Arial, Helvetica, Sans-Serif;">
<table bgcolor="#f9f3c9" width="100%" cellpadding="12" style="border: 1px #c9c399 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
This is an automatically generated e-mail. To reply, visit:
<a href="https://git.reviewboard.kde.org/r/126287/">https://git.reviewboard.kde.org/r/126287/</a>
</td>
</tr>
</table>
<br />
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<p style="margin-top: 0;">On December 11th, 2015, 9:11 a.m. CET, <b>Martin Gräßlin</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The problem is not the OSD, the problem is the global shortcut.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Take for example:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">sleep 5 && qdbus org.kde.plasmashell /org/kde/osdService brightnessChanged 100</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">It doesn't expose the problem. But when pressing a global shortcut a keyboard grab is performed and for comparison please see: http://commits.kde.org/kwin/fab806df9297d901625edf03eccd8f4a77875ac9</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Now I even more think that we need to properly fix this and not try to workaround in the applications (as it affects all</p></pre>
</blockquote>
<p>On December 11th, 2015, 9:28 a.m. CET, <b>Martin Gräßlin</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Checking X spec for GrabKeyboard: "This request generates FocusIn and FocusOut events". Which explains why there is a QEvent::WindowDeactivate and QEvent::WindowActivate events in the app.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I'll try whether I can work around inside Qt by delaying the events.</p></pre>
</blockquote>
<p>On December 11th, 2015, 9:38 a.m. CET, <b>Martin Gräßlin</b> wrote:</p>
<blockquote style="margin-left: 1em; border-left: 2px solid #d0d0d0; padding-left: 10px;">
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><blockquote style="text-rendering: inherit;padding: 0 0 0 1em;border-left: 1px solid #bbb;white-space: normal;margin: 0 0 0 0.5em;line-height: inherit;">
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I'll try whether I can work around inside Qt by delaying the events.</p>
</blockquote>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">Ah Qt has wonderful code there. On a FocusOut event it only handles if there is no FocusIn in the current event queue. So actually it should work(TM).</p></pre>
</blockquote>
</blockquote>
<pre style="white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">proof of concept patch against Qt
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index a20d957..debe18f 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -1631,6 +1631,8 @@ void QXcbConnection::processXcbEvents()
}
m_reader->unlock();
handleXcbEvent(event);
+ if (!m_peekFuncs.isEmpty() && i+1 == eventqueue->size())
+ QThread::msleep(100);
m_reader->lock();
}</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">The idea is to give the xcb event reader thread enough time to get the event. Qt is too performant!</p></pre>
<br />
<p>- Martin</p>
<br />
<p>On December 9th, 2015, 6:03 a.m. CET, Martin Klapetek wrote:</p>
<table bgcolor="#fefadf" width="100%" cellspacing="0" cellpadding="12" style="border: 1px #888a85 solid; border-radius: 6px; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
<tr>
<td>
<div>Review request for Telepathy and Martin Gräßlin.</div>
<div>By Martin Klapetek.</div>
<p style="color: grey;"><i>Updated Dec. 9, 2015, 6:03 a.m.</i></p>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Bugs: </b>
<a href="http://bugs.kde.org/show_bug.cgi?id=356220">356220</a>
</div>
<div style="margin-top: 1.5em;">
<b style="color: #575012; font-size: 10pt;">Repository: </b>
ktp-text-ui
</div>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Description </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">So it turns out that with text-ui's "remember layout per tab" feature
and Plasma's OSD, there's a problem when activating the global keyboard
layout change shortcut. It triggers the OSD and in turn that causes
QEvent::WindowDeactivate and QEvent::WindowActivate events in the app,
leading to text-ui immediately setting the old keyboard layout, making
it look like it's actualy blocking the changes.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">While checking KWindowSystem::activeWindowChanged I noticed that the
active window actually does not change. So I've moved setting the kbd
layout to KWindowSystem::activeWindowChanged slot rather than in the
event() handler. Seems to work perfectly.</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">I think this is the same bug that is causing the hidden panel to raise
on OSD/notifications and the one that is showing the "plasma" task in
task manager for split second, these two:</p>
<p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">https://bugs.kde.org/show_bug.cgi?id=352278
https://bugs.kde.org/show_bug.cgi?id=332024</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Testing </h1>
<table width="100%" bgcolor="#ffffff" cellspacing="0" cellpadding="10" style="border: 1px solid #b8b5a0">
<tr>
<td>
<pre style="margin: 0; padding: 0; white-space: pre-wrap; white-space: -moz-pre-wrap; white-space: -pre-wrap; white-space: -o-pre-wrap; word-wrap: break-word;"><p style="padding: 0;text-rendering: inherit;margin: 0;line-height: inherit;white-space: inherit;">With "remember keyboard layout per tab" I can now successfully change
keyboard layout from text-ui and the keyboard layout is properly restored
when switching to the window.</p></pre>
</td>
</tr>
</table>
<h1 style="color: #575012; font-size: 10pt; margin-top: 1.5em;">Diffs</b> </h1>
<ul style="margin-left: 3em; padding-left: 0;">
<li>app/chat-window.h <span style="color: grey">(0d1e0bb)</span></li>
<li>app/chat-window.cpp <span style="color: grey">(fdde18d)</span></li>
</ul>
<p><a href="https://git.reviewboard.kde.org/r/126287/diff/" style="margin-left: 3em;">View Diff</a></p>
</td>
</tr>
</table>
</div>
</body>
</html>