<table><tr><td style="">zzag created this revision.<br />zzag added a reviewer: KWin.<br />Herald added a project: KWin.<br />Herald added a subscriber: kwin.<br />zzag requested review of this revision.
</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/D27861">View Revision</a></tr></table><br /><div><strong>REVISION SUMMARY</strong><div><p>First of all, sorry for the big patch.</p>
<p>Currently, we implement Wayland protocol wrappers in KWayland and then<br />
add necessary "glue" code here in KWin. Because KWayland is a KF library,<br />
we are not able to change existing API in ways that may break API or<br />
ABI compatibility. So, if some particular wrapper has been implemented<br />
incorrectly, we can't do that much about it except maybe leaving<br />
comments that look like "// TODO KF6".</p>
<p>Another problem with KWayland is that we try to build abstractions over<br />
something that is unstable. We do this in the name of the "don't repeat<br />
yourself" mantra. While it is a good approach to keep the amount of<br />
duplicated code as low as possible, we basically ask for trouble. If a<br />
new version of an unstable protocol comes along with dramatic changes,<br />
we are screwed.</p>
<p>The current xdg-shell wrappers in KWayland were designed for xdg-shell<br />
v5, which didn't have objects such as xdg-toplevel or xdg-positioner.<br />
Unfortunately, we can't change existing classes because of the API and<br />
ABI compatibility promises we made.</p>
<p>This change splits the XdgShellClient class to better match existing<br />
abstractions in the xdg-shell protocol. Unfortunately, since xdg-shell<br />
wrappers in KWayland weren't designed for xdg-shell v6+, I had to<br />
re-implement them here in KWin. The new wrappers weren't implemented in<br />
KWayland because I cannot guarantee that the future versions of the<br />
wrappers will be API compatible.</p>
<p>The XdgSurface{V6}Client class is concerned mainly about things such as<br />
mapped/unmapped state and geometry, while XdgToplevel{V6}Client and<br />
XdgPopup{V6}Client are concerned about role-specific things, for example<br />
the window state, etc.</p>
<p>In the new client classes, configure events are handled differently.<br />
Instead of blocking configure events, we try to send them as late as<br />
possible. Delaying configure events will let us merge changeMaximize()<br />
for X11 clients and Wayland clients and it also fixes the bug where<br />
we don't send the final configure event when user has finished resizing<br />
a window.</p>
<p>Given that configure events are not sent immediately, XdgSurfaceClient<br />
and XdgSurfaceV6Client keep the last requested frame geometry and the<br />
last requested client geometry.</p>
<p>This change doesn't intend to fix all things that are currently broken<br />
in the xdg-shell wrappers and the XdgShellClient class. For example,<br />
we don't reset XdgSurfaceInterface when the wl_surface is unmapped, we<br />
handle xdg-popup grabs poorly, etc. Instead, this change lays the<br />
foundation for the future improvements.</p></div></div><br /><div><strong>TEST PLAN</strong><div><p>Tests pass.</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R108 KWin</div></div></div><br /><div><strong>BRANCH</strong><div><div>split-xdg-shell-client-2</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D27861">https://phabricator.kde.org/D27861</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>CMakeLists.txt<br />
autotests/integration/maximize_test.cpp<br />
autotests/integration/move_resize_window_test.cpp<br />
autotests/integration/quick_tiling_test.cpp<br />
autotests/integration/xdgshellclient_rules_test.cpp<br />
autotests/integration/xdgshellclient_test.cpp<br />
cmake/modules/FindWaylandProtocols.cmake<br />
deleted.cpp<br />
effects.cpp<br />
placement.cpp<br />
shellsurfaceclient.cpp<br />
shellsurfaceclient.h<br />
subsurfacetreemonitor.cpp<br />
subsurfacetreemonitor.h<br />
wayland_server.cpp<br />
wayland_server.h<br />
xdgdecorationv1interface.cpp<br />
xdgdecorationv1interface.h<br />
xdgdecorationv1interface_p.h<br />
xdgshellclient.cpp<br />
xdgshellclient.h<br />
xdgshellinterface.cpp<br />
xdgshellinterface.h<br />
xdgshellinterface_p.h<br />
xdgshellv6client.cpp<br />
xdgshellv6client.h<br />
xdgshellv6interface.cpp<br />
xdgshellv6interface.h<br />
xdgshellv6interface_p.h</div></div></div><br /><div><strong>To: </strong>zzag, KWin<br /><strong>Cc: </strong>kwin, Orage, LeGast00n, The-Feren-OS-Dev, cblack, jraleigh, zachus, fbampaloukas, GB_2, mkulinski, ragreen, jackyalcine, iodelay, crozbo, bwowk, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, hardening, romangg, jensreuterberg, abetts, sebas, apol, ahiemstra, mart<br /></div>