Changeset View
Changeset View
Standalone View
Standalone View
src/server/plasmashell_interface.cpp
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Line(s) | 43 | private: | |||
---|---|---|---|---|---|
45 | void bind(wl_client *client, uint32_t version, uint32_t id) override; | 45 | void bind(wl_client *client, uint32_t version, uint32_t id) override; | ||
46 | void createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface, wl_resource *parentResource); | 46 | void createSurface(wl_client *client, uint32_t version, uint32_t id, SurfaceInterface *surface, wl_resource *parentResource); | ||
47 | 47 | | |||
48 | PlasmaShellInterface *q; | 48 | PlasmaShellInterface *q; | ||
49 | static const struct org_kde_plasma_shell_interface s_interface; | 49 | static const struct org_kde_plasma_shell_interface s_interface; | ||
50 | static const quint32 s_version; | 50 | static const quint32 s_version; | ||
51 | }; | 51 | }; | ||
52 | 52 | | |||
53 | const quint32 PlasmaShellInterface::Private::s_version = 3; | 53 | const quint32 PlasmaShellInterface::Private::s_version = 4; | ||
54 | 54 | | |||
55 | PlasmaShellInterface::Private::Private(PlasmaShellInterface *q, Display *d) | 55 | PlasmaShellInterface::Private::Private(PlasmaShellInterface *q, Display *d) | ||
56 | : Global::Private(d, &org_kde_plasma_shell_interface, s_version) | 56 | : Global::Private(d, &org_kde_plasma_shell_interface, s_version) | ||
57 | , q(q) | 57 | , q(q) | ||
58 | { | 58 | { | ||
59 | } | 59 | } | ||
60 | 60 | | |||
61 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | 61 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | ||
Show All 17 Lines | |||||
79 | 79 | | |||
80 | private: | 80 | private: | ||
81 | // interface callbacks | 81 | // interface callbacks | ||
82 | static void setOutputCallback(wl_client *client, wl_resource *resource, wl_resource *output); | 82 | static void setOutputCallback(wl_client *client, wl_resource *resource, wl_resource *output); | ||
83 | static void setPositionCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y); | 83 | static void setPositionCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y); | ||
84 | static void setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role); | 84 | static void setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role); | ||
85 | static void setPanelBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag); | 85 | static void setPanelBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag); | ||
86 | static void setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip); | 86 | static void setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip); | ||
87 | static void panelAutoHideHideCallback(wl_client *client, wl_resource *resource); | ||||
88 | static void panelAutoHideShowCallback(wl_client *client, wl_resource *resource); | ||||
87 | 89 | | |||
88 | void setPosition(const QPoint &globalPos); | 90 | void setPosition(const QPoint &globalPos); | ||
89 | void setRole(uint32_t role); | 91 | void setRole(uint32_t role); | ||
90 | void setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior); | 92 | void setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior); | ||
91 | 93 | | |||
92 | PlasmaShellSurfaceInterface *q_func() { | 94 | PlasmaShellSurfaceInterface *q_func() { | ||
93 | return reinterpret_cast<PlasmaShellSurfaceInterface *>(q); | 95 | return reinterpret_cast<PlasmaShellSurfaceInterface *>(q); | ||
94 | } | 96 | } | ||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | |||||
153 | 155 | | |||
154 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | 156 | #ifndef DOXYGEN_SHOULD_SKIP_THIS | ||
155 | const struct org_kde_plasma_surface_interface PlasmaShellSurfaceInterface::Private::s_interface = { | 157 | const struct org_kde_plasma_surface_interface PlasmaShellSurfaceInterface::Private::s_interface = { | ||
156 | resourceDestroyedCallback, | 158 | resourceDestroyedCallback, | ||
157 | setOutputCallback, | 159 | setOutputCallback, | ||
158 | setPositionCallback, | 160 | setPositionCallback, | ||
159 | setRoleCallback, | 161 | setRoleCallback, | ||
160 | setPanelBehaviorCallback, | 162 | setPanelBehaviorCallback, | ||
161 | setSkipTaskbarCallback | 163 | setSkipTaskbarCallback, | ||
164 | panelAutoHideHideCallback, | ||||
165 | panelAutoHideShowCallback | ||||
162 | }; | 166 | }; | ||
163 | #endif | 167 | #endif | ||
164 | 168 | | |||
165 | PlasmaShellSurfaceInterface::PlasmaShellSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource) | 169 | PlasmaShellSurfaceInterface::PlasmaShellSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource) | ||
166 | : Resource(new Private(this, shell, parent, parentResource)) | 170 | : Resource(new Private(this, shell, parent, parentResource)) | ||
167 | { | 171 | { | ||
168 | auto unsetSurface = [this] { | 172 | auto unsetSurface = [this] { | ||
169 | Q_D(); | 173 | Q_D(); | ||
▲ Show 20 Lines • Show All 95 Lines • ▼ Show 20 Line(s) | |||||
265 | void PlasmaShellSurfaceInterface::Private::setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip) | 269 | void PlasmaShellSurfaceInterface::Private::setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip) | ||
266 | { | 270 | { | ||
267 | auto s = cast<Private>(resource); | 271 | auto s = cast<Private>(resource); | ||
268 | Q_ASSERT(client == *s->client); | 272 | Q_ASSERT(client == *s->client); | ||
269 | s->m_skipTaskbar = (bool)skip; | 273 | s->m_skipTaskbar = (bool)skip; | ||
270 | emit s->q_func()->skipTaskbarChanged(); | 274 | emit s->q_func()->skipTaskbarChanged(); | ||
271 | } | 275 | } | ||
272 | 276 | | |||
277 | void PlasmaShellSurfaceInterface::Private::panelAutoHideHideCallback(wl_client *client, wl_resource *resource) | ||||
278 | { | ||||
279 | auto s = cast<Private>(resource); | ||||
280 | Q_ASSERT(client == *s->client); | ||||
281 | if (s->m_role != Role::Panel || s->m_panelBehavior != PanelBehavior::AutoHide) { | ||||
282 | wl_resource_post_error(s->resource, ORG_KDE_PLASMA_SURFACE_ERROR_PANEL_NOT_AUTO_HIDE, "Not an auto hide panel"); | ||||
283 | return; | ||||
284 | } | ||||
285 | emit s->q_func()->panelAutoHideHideRequested(); | ||||
286 | } | ||||
287 | | ||||
288 | void PlasmaShellSurfaceInterface::Private::panelAutoHideShowCallback(wl_client *client, wl_resource *resource) | ||||
289 | { | ||||
290 | auto s = cast<Private>(resource); | ||||
291 | Q_ASSERT(client == *s->client); | ||||
292 | if (s->m_role != Role::Panel || s->m_panelBehavior != PanelBehavior::AutoHide) { | ||||
293 | wl_resource_post_error(s->resource, ORG_KDE_PLASMA_SURFACE_ERROR_PANEL_NOT_AUTO_HIDE, "Not an auto hide panel"); | ||||
294 | return; | ||||
295 | } | ||||
296 | emit s->q_func()->panelAutoHideShowRequested(); | ||||
297 | } | ||||
298 | | ||||
273 | void PlasmaShellSurfaceInterface::Private::setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior) | 299 | void PlasmaShellSurfaceInterface::Private::setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior) | ||
274 | { | 300 | { | ||
275 | PanelBehavior newBehavior = PanelBehavior::AlwaysVisible; | 301 | PanelBehavior newBehavior = PanelBehavior::AlwaysVisible; | ||
276 | switch (behavior) { | 302 | switch (behavior) { | ||
277 | case ORG_KDE_PLASMA_SURFACE_PANEL_BEHAVIOR_AUTO_HIDE: | 303 | case ORG_KDE_PLASMA_SURFACE_PANEL_BEHAVIOR_AUTO_HIDE: | ||
278 | newBehavior = PanelBehavior::AutoHide; | 304 | newBehavior = PanelBehavior::AutoHide; | ||
279 | break; | 305 | break; | ||
280 | case ORG_KDE_PLASMA_SURFACE_PANEL_BEHAVIOR_WINDOWS_CAN_COVER: | 306 | case ORG_KDE_PLASMA_SURFACE_PANEL_BEHAVIOR_WINDOWS_CAN_COVER: | ||
Show All 39 Lines | |||||
320 | } | 346 | } | ||
321 | 347 | | |||
322 | bool PlasmaShellSurfaceInterface::skipTaskbar() const | 348 | bool PlasmaShellSurfaceInterface::skipTaskbar() const | ||
323 | { | 349 | { | ||
324 | Q_D(); | 350 | Q_D(); | ||
325 | return d->m_skipTaskbar; | 351 | return d->m_skipTaskbar; | ||
326 | } | 352 | } | ||
327 | 353 | | |||
354 | void PlasmaShellSurfaceInterface::hideAutoHidingPanel() | ||||
355 | { | ||||
356 | Q_D(); | ||||
357 | if (!d->resource) { | ||||
358 | return; | ||||
359 | } | ||||
360 | org_kde_plasma_surface_send_auto_hidden_panel_hidden(d->resource); | ||||
361 | } | ||||
362 | | ||||
363 | void PlasmaShellSurfaceInterface::showAutoHidingPanel() | ||||
364 | { | ||||
365 | Q_D(); | ||||
366 | if (!d->resource) { | ||||
367 | return; | ||||
368 | } | ||||
369 | org_kde_plasma_surface_send_auto_hidden_panel_shown(d->resource); | ||||
370 | } | ||||
371 | | ||||
328 | PlasmaShellSurfaceInterface *PlasmaShellSurfaceInterface::get(wl_resource *native) | 372 | PlasmaShellSurfaceInterface *PlasmaShellSurfaceInterface::get(wl_resource *native) | ||
329 | { | 373 | { | ||
330 | return Private::get<PlasmaShellSurfaceInterface>(native); | 374 | return Private::get<PlasmaShellSurfaceInterface>(native); | ||
331 | } | 375 | } | ||
332 | 376 | | |||
333 | } | 377 | } | ||
334 | } | 378 | } |