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 = 5; | 53 | const quint32 PlasmaShellInterface::Private::s_version = 6; | ||
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 | ||
62 | const struct org_kde_plasma_shell_interface PlasmaShellInterface::Private::s_interface = { | 62 | const struct org_kde_plasma_shell_interface PlasmaShellInterface::Private::s_interface = { | ||
63 | createSurfaceCallback | 63 | createSurfaceCallback | ||
64 | }; | 64 | }; | ||
65 | #endif | 65 | #endif | ||
66 | 66 | | |||
67 | 67 | | |||
68 | class PlasmaShellSurfaceInterface::Private : public Resource::Private | 68 | class PlasmaShellSurfaceInterface::Private : public Resource::Private | ||
69 | { | 69 | { | ||
70 | public: | 70 | public: | ||
71 | Private(PlasmaShellSurfaceInterface *q, PlasmaShellInterface *shell, SurfaceInterface *surface, wl_resource *parentResource); | 71 | Private(PlasmaShellSurfaceInterface *q, PlasmaShellInterface *shell, SurfaceInterface *surface, wl_resource *parentResource); | ||
72 | 72 | | |||
73 | SurfaceInterface *surface; | 73 | SurfaceInterface *surface; | ||
74 | QPoint m_globalPos; | 74 | QPoint m_globalPos; | ||
75 | Role m_role = Role::Normal; | 75 | Role m_role = Role::Normal; | ||
76 | bool m_positionSet = false; | | |||
77 | PanelBehavior m_panelBehavior = PanelBehavior::AlwaysVisible; | 76 | PanelBehavior m_panelBehavior = PanelBehavior::AlwaysVisible; | ||
77 | PopupBehaviorFlags m_popupBehavior; | ||||
78 | bool m_positionSet = false; | ||||
78 | bool m_skipTaskbar = false; | 79 | bool m_skipTaskbar = false; | ||
79 | bool m_skipSwitcher = false; | 80 | bool m_skipSwitcher = false; | ||
80 | bool panelTakesFocus = false; | 81 | bool panelTakesFocus = false; | ||
81 | 82 | | |||
82 | private: | 83 | private: | ||
83 | // interface callbacks | 84 | // interface callbacks | ||
84 | static void setOutputCallback(wl_client *client, wl_resource *resource, wl_resource *output); | 85 | static void setOutputCallback(wl_client *client, wl_resource *resource, wl_resource *output); | ||
85 | static void setPositionCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y); | 86 | static void setPositionCallback(wl_client *client, wl_resource *resource, int32_t x, int32_t y); | ||
86 | static void setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role); | 87 | static void setRoleCallback(wl_client *client, wl_resource *resource, uint32_t role); | ||
87 | static void setPanelBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag); | 88 | static void setPanelBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag); | ||
88 | static void setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip); | 89 | static void setSkipTaskbarCallback(wl_client *client, wl_resource *resource, uint32_t skip); | ||
89 | static void setSkipSwitcherCallback(wl_client *client, wl_resource *resource, uint32_t skip); | 90 | static void setSkipSwitcherCallback(wl_client *client, wl_resource *resource, uint32_t skip); | ||
90 | static void panelAutoHideHideCallback(wl_client *client, wl_resource *resource); | 91 | static void panelAutoHideHideCallback(wl_client *client, wl_resource *resource); | ||
91 | static void panelAutoHideShowCallback(wl_client *client, wl_resource *resource); | 92 | static void panelAutoHideShowCallback(wl_client *client, wl_resource *resource); | ||
92 | static void panelTakesFocusCallback(wl_client *client, wl_resource *resource, uint32_t takesFocus); | 93 | static void panelTakesFocusCallback(wl_client *client, wl_resource *resource, uint32_t takesFocus); | ||
94 | static void setPopupBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag); | ||||
93 | 95 | | |||
94 | void setPosition(const QPoint &globalPos); | 96 | void setPosition(const QPoint &globalPos); | ||
95 | void setRole(uint32_t role); | 97 | void setRole(uint32_t role); | ||
96 | void setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior); | 98 | void setPanelBehavior(org_kde_plasma_surface_panel_behavior behavior); | ||
99 | void setPopupBehavior(uint32_t behavior); | ||||
97 | 100 | | |||
98 | PlasmaShellSurfaceInterface *q_func() { | 101 | PlasmaShellSurfaceInterface *q_func() { | ||
99 | return reinterpret_cast<PlasmaShellSurfaceInterface *>(q); | 102 | return reinterpret_cast<PlasmaShellSurfaceInterface *>(q); | ||
100 | } | 103 | } | ||
101 | 104 | | |||
102 | static const struct org_kde_plasma_surface_interface s_interface; | 105 | static const struct org_kde_plasma_surface_interface s_interface; | ||
103 | }; | 106 | }; | ||
104 | 107 | | |||
▲ Show 20 Lines • Show All 58 Lines • ▼ Show 20 Line(s) | 164 | const struct org_kde_plasma_surface_interface PlasmaShellSurfaceInterface::Private::s_interface = { | |||
163 | setOutputCallback, | 166 | setOutputCallback, | ||
164 | setPositionCallback, | 167 | setPositionCallback, | ||
165 | setRoleCallback, | 168 | setRoleCallback, | ||
166 | setPanelBehaviorCallback, | 169 | setPanelBehaviorCallback, | ||
167 | setSkipTaskbarCallback, | 170 | setSkipTaskbarCallback, | ||
168 | panelAutoHideHideCallback, | 171 | panelAutoHideHideCallback, | ||
169 | panelAutoHideShowCallback, | 172 | panelAutoHideShowCallback, | ||
170 | panelTakesFocusCallback, | 173 | panelTakesFocusCallback, | ||
171 | setSkipSwitcherCallback | 174 | setSkipSwitcherCallback, | ||
175 | setPopupBehaviorCallback, | ||||
172 | }; | 176 | }; | ||
173 | #endif | 177 | #endif | ||
174 | 178 | | |||
175 | PlasmaShellSurfaceInterface::PlasmaShellSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource) | 179 | PlasmaShellSurfaceInterface::PlasmaShellSurfaceInterface(PlasmaShellInterface *shell, SurfaceInterface *parent, wl_resource *parentResource) | ||
176 | : Resource(new Private(this, shell, parent, parentResource)) | 180 | : Resource(new Private(this, shell, parent, parentResource)) | ||
177 | { | 181 | { | ||
178 | auto unsetSurface = [this] { | 182 | auto unsetSurface = [this] { | ||
179 | Q_D(); | 183 | Q_D(); | ||
▲ Show 20 Lines • Show All 217 Lines • ▼ Show 20 Line(s) | |||||
397 | } | 401 | } | ||
398 | 402 | | |||
399 | bool PlasmaShellSurfaceInterface::panelTakesFocus() const | 403 | bool PlasmaShellSurfaceInterface::panelTakesFocus() const | ||
400 | { | 404 | { | ||
401 | Q_D(); | 405 | Q_D(); | ||
402 | return d->panelTakesFocus; | 406 | return d->panelTakesFocus; | ||
403 | } | 407 | } | ||
404 | 408 | | |||
409 | PlasmaShellSurfaceInterface::PopupBehaviorFlags PlasmaShellSurfaceInterface::popupBehavior() const | ||||
410 | { | ||||
411 | Q_D(); | ||||
412 | return d->m_popupBehavior; | ||||
413 | } | ||||
414 | | ||||
405 | PlasmaShellSurfaceInterface *PlasmaShellSurfaceInterface::get(wl_resource *native) | 415 | PlasmaShellSurfaceInterface *PlasmaShellSurfaceInterface::get(wl_resource *native) | ||
406 | { | 416 | { | ||
407 | return Private::get<PlasmaShellSurfaceInterface>(native); | 417 | return Private::get<PlasmaShellSurfaceInterface>(native); | ||
408 | } | 418 | } | ||
409 | 419 | | |||
420 | void PlasmaShellSurfaceInterface::Private::setPopupBehaviorCallback(wl_client *client, wl_resource *resource, uint32_t flag) | ||||
421 | { | ||||
422 | auto s = cast<Private>(resource); | ||||
423 | Q_ASSERT(client == *s->client); | ||||
424 | s->setPopupBehavior(flag); | ||||
425 | } | ||||
426 | | ||||
427 | | ||||
428 | void PlasmaShellSurfaceInterface::Private::setPopupBehavior(uint32_t behavior) | ||||
429 | { | ||||
430 | PopupBehaviorFlags newBehavior; | ||||
431 | if (behavior & ORG_KDE_PLASMA_SURFACE_POPUP_BEHAVIOR_ALWAYS_ON_TOP) { | ||||
432 | newBehavior |= PopupBehavior::AlwaysOnTop; | ||||
433 | } | ||||
434 | | ||||
435 | if (m_popupBehavior == newBehavior) { | ||||
436 | return; | ||||
437 | } | ||||
438 | m_popupBehavior = newBehavior; | ||||
439 | Q_Q(PlasmaShellSurfaceInterface); | ||||
440 | emit q->popupBehaviorChanged(); | ||||
441 | } | ||||
442 | | ||||
410 | } | 443 | } | ||
411 | } | 444 | } |