Changeset View
Standalone View
xdgshellclient.cpp
Show All 34 Lines | |||||
35 | #include "workspace.h" | 35 | #include "workspace.h" | ||
36 | 36 | | |||
37 | #include <KDecoration2/DecoratedClient> | 37 | #include <KDecoration2/DecoratedClient> | ||
38 | #include <KDecoration2/Decoration> | 38 | #include <KDecoration2/Decoration> | ||
39 | #include <KWayland/Server/appmenu_interface.h> | 39 | #include <KWayland/Server/appmenu_interface.h> | ||
40 | #include <KWayland/Server/buffer_interface.h> | 40 | #include <KWayland/Server/buffer_interface.h> | ||
41 | #include <KWayland/Server/clientconnection.h> | 41 | #include <KWayland/Server/clientconnection.h> | ||
42 | #include <KWayland/Server/display.h> | 42 | #include <KWayland/Server/display.h> | ||
43 | #include <KWayland/Server/inputmethod_interface.h> | ||||
43 | #include <KWayland/Server/plasmashell_interface.h> | 44 | #include <KWayland/Server/plasmashell_interface.h> | ||
44 | #include <KWayland/Server/plasmawindowmanagement_interface.h> | 45 | #include <KWayland/Server/plasmawindowmanagement_interface.h> | ||
45 | #include <KWayland/Server/qtsurfaceextension_interface.h> | 46 | #include <KWayland/Server/qtsurfaceextension_interface.h> | ||
46 | #include <KWayland/Server/seat_interface.h> | 47 | #include <KWayland/Server/seat_interface.h> | ||
47 | #include <KWayland/Server/server_decoration_interface.h> | 48 | #include <KWayland/Server/server_decoration_interface.h> | ||
48 | #include <KWayland/Server/server_decoration_palette_interface.h> | 49 | #include <KWayland/Server/server_decoration_palette_interface.h> | ||
49 | #include <KWayland/Server/shadow_interface.h> | 50 | #include <KWayland/Server/shadow_interface.h> | ||
50 | #include <KWayland/Server/subcompositor_interface.h> | 51 | #include <KWayland/Server/subcompositor_interface.h> | ||
Show All 27 Lines | 78 | XdgShellClient::XdgShellClient(XdgShellPopupInterface *surface) | |||
78 | : AbstractClient() | 79 | : AbstractClient() | ||
79 | , m_xdgShellToplevel(nullptr) | 80 | , m_xdgShellToplevel(nullptr) | ||
80 | , m_xdgShellPopup(surface) | 81 | , m_xdgShellPopup(surface) | ||
81 | { | 82 | { | ||
82 | setSurface(surface->surface()); | 83 | setSurface(surface->surface()); | ||
83 | init(); | 84 | init(); | ||
84 | } | 85 | } | ||
85 | 86 | | |||
87 | XdgShellClient::XdgShellClient(InputPanelSurfaceInterface *panelSurface) | ||||
88 | : AbstractClient() | ||||
89 | , m_xdgShellToplevel(nullptr) | ||||
90 | , m_xdgShellPopup(nullptr) | ||||
91 | , m_inputPanelSurface(panelSurface) | ||||
zzag: Is `zwp_input_panel_surface_v1` yet another surface role, like `xdg_toplevel` or… | |||||
it's just an interface that provides us a surface and some information on how to place it on the screen. apol: it's just an interface that provides us a surface and some information on how to place it on… | |||||
I'm a little bit concerned about the case where one wants to get a zwp_input_panel_surface_v1 for a wl_surface which is also an xdg_toplevel or xdg_popup. In that case, the wl_surface will be represented by two XdgShellClient objects! Perhaps we need to install an InputPanelSurfaceInterface rather than create a new XdgShellClient for it. For what it's worth, that's how we handle plasma surfaces (org_kde_plasma_surface). void XdgShellClient::installInputPanelSurface(InputPanelSurfaceInterface *surface) { m_inputPanelSurface = surface; // a bunch of connects } zzag: I'm a little bit concerned about the case where one wants to get a zwp_input_panel_surface_v1… | |||||
I'm not sure that's a problem. I do know that at the moment the surfaces aren't created at all otherwise, be it from weston-keyboard or maliit (Qt). apol: I'm not sure that's a problem. I do know that at the moment the surfaces aren't created at all… | |||||
oh, no.... it seems like zwp_input_panel_surface_v1 is yet another surface role, which means it can't be represented by XdgShellClient. zzag: oh, no.... it seems like zwp_input_panel_surface_v1 is yet another surface role, which means it… | |||||
92 | { | ||||
93 | setSurface(panelSurface->surface()); | ||||
94 | init(); | ||||
95 | setSkipPager(true); | ||||
96 | setSkipTaskbar(true); | ||||
97 | setKeepAbove(true); | ||||
98 | | ||||
99 | setObjectName(QStringLiteral("Input Panel")); | ||||
100 | | ||||
101 | connect(panelSurface, &KWayland::Server::InputPanelSurfaceInterface::topLevel, this, [this, panelSurface] (OutputInterface *output, KWayland::Server::InputPanelSurfaceInterface::Position position) { | ||||
102 | const QSize panelSize = panelSurface->surface()->size(); | ||||
103 | QRect geo = {output->globalPosition(), panelSize}; | ||||
104 | if (position == KWayland::Server::InputPanelSurfaceInterface::CenterBottom) { | ||||
105 | geo.translate((output->pixelSize().width() - panelSize.width())/2, output->pixelSize().height() - panelSize.height()); | ||||
106 | } | ||||
107 | finishInit(); | ||||
108 | markAsMapped(); | ||||
109 | doSetGeometry(geo); | ||||
110 | }); | ||||
111 | connect(panelSurface, &KWayland::Server::InputPanelSurfaceInterface::overlayPanel, this, [this, panelSurface] () { | ||||
112 | finishInit(); | ||||
113 | markAsMapped(); | ||||
114 | | ||||
115 | auto focusedField = waylandServer()->findAbstractClient(waylandServer()->seat()->focusedTextInputSurface()); | ||||
116 | if (focusedField) { | ||||
117 | const QSize panelSize = panelSurface->surface()->size(); | ||||
118 | doSetGeometry({focusedField->pos(), panelSize}); | ||||
119 | } | ||||
120 | }); | ||||
121 | } | ||||
122 | | ||||
86 | XdgShellClient::~XdgShellClient() = default; | 123 | XdgShellClient::~XdgShellClient() = default; | ||
87 | 124 | | |||
88 | void XdgShellClient::init() | 125 | void XdgShellClient::init() | ||
89 | { | 126 | { | ||
90 | m_requestGeometryBlockCounter++; | 127 | m_requestGeometryBlockCounter++; | ||
91 | 128 | | |||
92 | connect(this, &XdgShellClient::desktopFileNameChanged, this, &XdgShellClient::updateIcon); | 129 | connect(this, &XdgShellClient::desktopFileNameChanged, this, &XdgShellClient::updateIcon); | ||
93 | createWindowId(); | 130 | createWindowId(); | ||
▲ Show 20 Lines • Show All 1975 Lines • Show Last 20 Lines |
Is zwp_input_panel_surface_v1 yet another surface role, like xdg_toplevel or wl_subsurface?