Changeset View
Changeset View
Standalone View
Standalone View
src/client/plasmashell.cpp
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Line(s) | 42 | public: | |||
---|---|---|---|---|---|
47 | WaylandPointer<org_kde_plasma_surface, org_kde_plasma_surface_destroy> surface; | 47 | WaylandPointer<org_kde_plasma_surface, org_kde_plasma_surface_destroy> surface; | ||
48 | QSize size; | 48 | QSize size; | ||
49 | QPointer<Surface> parentSurface; | 49 | QPointer<Surface> parentSurface; | ||
50 | PlasmaShellSurface::Role role; | 50 | PlasmaShellSurface::Role role; | ||
51 | 51 | | |||
52 | static PlasmaShellSurface *get(Surface *surface); | 52 | static PlasmaShellSurface *get(Surface *surface); | ||
53 | 53 | | |||
54 | private: | 54 | private: | ||
55 | static void autoHidingPanelHiddenCallback(void *data, org_kde_plasma_surface *org_kde_plasma_surface); | ||||
56 | static void autoHidingPanelShownCallback(void *data, org_kde_plasma_surface *org_kde_plasma_surface); | ||||
57 | | ||||
55 | PlasmaShellSurface *q; | 58 | PlasmaShellSurface *q; | ||
56 | static QVector<Private*> s_surfaces; | 59 | static QVector<Private*> s_surfaces; | ||
60 | static const org_kde_plasma_surface_listener s_listener; | ||||
57 | }; | 61 | }; | ||
58 | 62 | | |||
59 | QVector<PlasmaShellSurface::Private*> PlasmaShellSurface::Private::s_surfaces; | 63 | QVector<PlasmaShellSurface::Private*> PlasmaShellSurface::Private::s_surfaces; | ||
60 | 64 | | |||
61 | PlasmaShell::PlasmaShell(QObject *parent) | 65 | PlasmaShell::PlasmaShell(QObject *parent) | ||
62 | : QObject(parent) | 66 | : QObject(parent) | ||
63 | , d(new Private) | 67 | , d(new Private) | ||
64 | { | 68 | { | ||
▲ Show 20 Lines • Show All 105 Lines • ▼ Show 20 Line(s) | 165 | { | |||
170 | return nullptr; | 174 | return nullptr; | ||
171 | } | 175 | } | ||
172 | 176 | | |||
173 | void PlasmaShellSurface::Private::setup(org_kde_plasma_surface *s) | 177 | void PlasmaShellSurface::Private::setup(org_kde_plasma_surface *s) | ||
174 | { | 178 | { | ||
175 | Q_ASSERT(s); | 179 | Q_ASSERT(s); | ||
176 | Q_ASSERT(!surface); | 180 | Q_ASSERT(!surface); | ||
177 | surface.setup(s); | 181 | surface.setup(s); | ||
182 | org_kde_plasma_surface_add_listener(surface, &s_listener, this); | ||||
183 | } | ||||
184 | | ||||
185 | const org_kde_plasma_surface_listener PlasmaShellSurface::Private::s_listener = { | ||||
186 | autoHidingPanelHiddenCallback, | ||||
187 | autoHidingPanelShownCallback | ||||
188 | }; | ||||
189 | | ||||
190 | void PlasmaShellSurface::Private::autoHidingPanelHiddenCallback(void *data, org_kde_plasma_surface *org_kde_plasma_surface) | ||||
191 | { | ||||
192 | auto p = reinterpret_cast<PlasmaShellSurface::Private*>(data); | ||||
193 | Q_ASSERT(p->surface == org_kde_plasma_surface); | ||||
194 | emit p->q->autoHidePanelHidden(); | ||||
195 | } | ||||
196 | | ||||
197 | void PlasmaShellSurface::Private::autoHidingPanelShownCallback(void *data, org_kde_plasma_surface *org_kde_plasma_surface) | ||||
198 | { | ||||
199 | auto p = reinterpret_cast<PlasmaShellSurface::Private*>(data); | ||||
200 | Q_ASSERT(p->surface == org_kde_plasma_surface); | ||||
201 | emit p->q->autoHidePanelShown(); | ||||
178 | } | 202 | } | ||
179 | 203 | | |||
180 | PlasmaShellSurface::PlasmaShellSurface(QObject *parent) | 204 | PlasmaShellSurface::PlasmaShellSurface(QObject *parent) | ||
181 | : QObject(parent) | 205 | : QObject(parent) | ||
182 | , d(new Private(this)) | 206 | , d(new Private(this)) | ||
183 | { | 207 | { | ||
184 | } | 208 | } | ||
185 | 209 | | |||
▲ Show 20 Lines • Show All 107 Lines • ▼ Show 20 Line(s) | 297 | { | |||
293 | org_kde_plasma_surface_set_panel_behavior(d->surface, wlRole); | 317 | org_kde_plasma_surface_set_panel_behavior(d->surface, wlRole); | ||
294 | } | 318 | } | ||
295 | 319 | | |||
296 | void PlasmaShellSurface::setSkipTaskbar(bool skip) | 320 | void PlasmaShellSurface::setSkipTaskbar(bool skip) | ||
297 | { | 321 | { | ||
298 | org_kde_plasma_surface_set_skip_taskbar(d->surface, skip); | 322 | org_kde_plasma_surface_set_skip_taskbar(d->surface, skip); | ||
299 | } | 323 | } | ||
300 | 324 | | |||
325 | void PlasmaShellSurface::requestHideAutoHidingPanel() | ||||
326 | { | ||||
327 | org_kde_plasma_surface_panel_auto_hide_hide(d->surface); | ||||
328 | } | ||||
329 | | ||||
330 | void PlasmaShellSurface::requestShowAutoHidingPanel() | ||||
331 | { | ||||
332 | org_kde_plasma_surface_panel_auto_hide_show(d->surface); | ||||
333 | } | ||||
334 | | ||||
301 | } | 335 | } | ||
302 | } | 336 | } |