<table><tr><td style="">graesslin created this revision.<br />graesslin added reviewers: KWin, Plasma.<br />Restricted Application added a project: KWin.<br />Restricted Application added subscribers: kwin, plasma-devel.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D3723" rel="noreferrer">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>Recently we noticed that there are multiple areas where KWin needs to<br />
inform the user about how to operate. Examples are:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">Screenshot</li>
<li class="remarkup-list-item">ColorPicker</li>
<li class="remarkup-list-item">Pointer constraint enabled</li>
<li class="remarkup-list-item">Pointer constraint about to be removed</li>
<li class="remarkup-list-item">Kill Window</li>
</ul>
<p>For Screenshot and ColorPicker we used an EffectFrame to render it. But<br />
this is not an optimal solution as it's lacking many features we would<br />
need. We cannot properly use it from within KWin core, we cannot<br />
implement features like hide on mouse over, etc. etc.</p>
<p>This change introduces an OnScreenNotification which supports:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">showing an icon</li>
<li class="remarkup-list-item">showing a message</li>
<li class="remarkup-list-item">timeout</li>
</ul>
<p>It is Qml styled, so that it can be easily adjusted. This is a big<br />
improvement over the EffectFrame solution. The Qml file creates a Plasma<br />
Dialog of type OSD. Thus KWin places it like the normal OSD windows and<br />
also looks kind of similar. In the case of KWin the focus is more on the<br />
message, than an icon, so the icon is placed left of the text.</p>
<p>While the OnScreenNotification is supposed to be used like a singleton,<br />
it doesn't use the KWin singleton pattern. Instead a small wrapper<br />
namespace OSD is introduced which provides a convenient API for KWin<br />
internal areas to show/hide the notification. By not using the KWin<br />
singleton pattern, the OnScreenNotification does not depend on any other<br />
parts of KWin and can be easily unit-tested.</p>
<p>A few features are still missing and will be added in further commits:</p>
<ul class="remarkup-list">
<li class="remarkup-list-item">hide-out on mouse over</li>
<li class="remarkup-list-item">optional skip close animation (needed for screenshot)</li>
<li class="remarkup-list-item">X11 support (not that important as it's mostly for Wayland features)</li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>on-screen-notification</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D3723" rel="noreferrer">https://phabricator.kde.org/D3723</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
autotests/CMakeLists.txt<br />
autotests/onscreennotificationtest.cpp<br />
autotests/onscreennotificationtest.h<br />
onscreennotification.cpp<br />
onscreennotification.h<br />
osd.cpp<br />
osd.h<br />
qml/CMakeLists.txt<br />
qml/onscreennotification/plasma/dummydata/osd.qml<br />
qml/onscreennotification/plasma/main.qml</div></div></div><br /><div><strong>EMAIL PREFERENCES</strong><div><a href="https://phabricator.kde.org/settings/panel/emailpreferences/" rel="noreferrer">https://phabricator.kde.org/settings/panel/emailpreferences/</a></div></div><br /><div><strong>To: </strong>graesslin, KWin, Plasma<br /><strong>Cc: </strong>plasma-devel, kwin, lesliezhai, ali-mohamed, hardening, jensreuterberg, abetts, sebas<br /></div>