12#include <qwayland-server-plasma-shell.h>
18static const quint32 s_version = 8;
19static QList<PlasmaShellSurfaceInterface *> s_shellSurfaces;
27 void org_kde_plasma_shell_get_surface(Resource *resource, uint32_t
id, struct ::wl_resource *surface)
override;
32 : QtWaylandServer::org_kde_plasma_shell(*display, s_version)
54 void org_kde_plasma_surface_destroy_resource(Resource *resource)
override;
55 void org_kde_plasma_surface_destroy(Resource *resource)
override;
56 void org_kde_plasma_surface_set_output(Resource *resource, struct ::wl_resource *output)
override;
57 void org_kde_plasma_surface_set_position(Resource *resource, int32_t x, int32_t y)
override;
58 void org_kde_plasma_surface_set_role(Resource *resource, uint32_t role)
override;
59 void org_kde_plasma_surface_set_panel_behavior(Resource *resource, uint32_t flag)
override;
60 void org_kde_plasma_surface_set_skip_taskbar(Resource *resource, uint32_t skip)
override;
61 void org_kde_plasma_surface_panel_auto_hide_hide(Resource *resource)
override;
62 void org_kde_plasma_surface_panel_auto_hide_show(Resource *resource)
override;
63 void org_kde_plasma_surface_set_panel_takes_focus(Resource *resource, uint32_t takes_focus)
override;
64 void org_kde_plasma_surface_set_skip_switcher(Resource *resource, uint32_t skip)
override;
65 void org_kde_plasma_surface_open_under_cursor(Resource *resource)
override;
76void PlasmaShellInterfacePrivate::org_kde_plasma_shell_get_surface(QtWaylandServer::org_kde_plasma_shell::Resource *resource,
78 struct ::wl_resource *surface)
82 wl_resource_post_error(resource->handle, 0,
"Invalid surface");
87 wl_resource_post_error(resource->handle, 0,
"org_kde_plasma_shell_surface already exists");
91 wl_resource *shell_resource = wl_resource_create(resource->client(), &org_kde_plasma_surface_interface, resource->version(),
id);
93 auto shellSurface =
new PlasmaShellSurfaceInterface(s, shell_resource);
94 s_shellSurfaces.append(shellSurface);
96 QObject::connect(shellSurface, &QObject::destroyed, [shellSurface]() {
97 s_shellSurfaces.removeOne(shellSurface);
107 : QtWaylandServer::org_kde_plasma_surface(resource)
113PlasmaShellSurfaceInterface::PlasmaShellSurfaceInterface(
SurfaceInterface *surface, wl_resource *resource)
125void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_destroy(Resource *resource)
127 wl_resource_destroy(resource->handle);
130void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_destroy_resource(Resource *resource)
135void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_output(Resource *resource, struct ::wl_resource *output)
140void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_position(Resource *resource, int32_t x, int32_t y)
142 QPoint globalPos(x, y);
151void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_open_under_cursor(Resource *resource)
154 wl_resource_post_error(resource->handle, -1,
"open_under_cursor: surface has a buffer");
160void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_role(Resource *resource, uint32_t role)
170 case role_onscreendisplay:
173 case role_notification:
179 case role_criticalnotification:
182 case role_appletpopup:
197void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_panel_behavior(Resource *resource, uint32_t flag)
201 case panel_behavior_auto_hide:
204 case panel_behavior_windows_can_cover:
207 case panel_behavior_windows_go_below:
210 case panel_behavior_always_visible:
221void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_skip_taskbar(Resource *resource, uint32_t skip)
227void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_skip_switcher(Resource *resource, uint32_t skip)
233void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_panel_auto_hide_hide(Resource *resource)
238 wl_resource_post_error(resource->handle, error_panel_not_auto_hide,
"Not an auto hide panel");
244void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_panel_auto_hide_show(Resource *resource)
247 wl_resource_post_error(resource->handle, error_panel_not_auto_hide,
"Not an auto hide panel");
253void PlasmaShellSurfaceInterfacePrivate::org_kde_plasma_surface_set_panel_takes_focus(Resource *resource, uint32_t takesFocus)
264 return d->m_globalPos;
274 return d->m_positionSet;
279 return d->m_openUnderCursorRequested;
284 return d->m_panelBehavior;
289 return d->m_skipTaskbar;
294 return d->m_skipSwitcher;
299 d->send_auto_hidden_panel_hidden();
304 d->send_auto_hidden_panel_shown();
309 return d->m_panelTakesFocus;
314 if (
auto surfacePrivate = resource_cast<PlasmaShellSurfaceInterfacePrivate *>(native)) {
315 return surfacePrivate->q;
323 if (shellSurface->surface() ==
surface) {
332#include "moc_plasmashell.cpp"
Class holding the Wayland server display loop.
Global for the org_kde_plasma_shell interface.
virtual ~PlasmaShellInterface()
void surfaceCreated(KWin::PlasmaShellSurfaceInterface *)
PlasmaShellInterface(Display *display, QObject *parent)
PlasmaShellInterfacePrivate(PlasmaShellInterface *q, Display *display)
Resource for the org_kde_plasma_shell_surface interface.
void skipTaskbarChanged()
virtual ~PlasmaShellSurfaceInterface()
PanelBehavior panelBehavior() const
SurfaceInterface * surface() const
bool panelTakesFocus() const
bool wantsOpenUnderCursor() const
void panelBehaviorChanged()
bool skipSwitcher() const
void skipSwitcherChanged()
void openUnderCursorRequested()
static PlasmaShellSurfaceInterface * get(wl_resource *native)
bool isPositionSet() const
void panelTakesFocusChanged()
void panelAutoHideShowRequested()
void showAutoHidingPanel()
@ Desktop
The surface represents a desktop, normally stacked below all other surfaces.
@ CriticalNotification
The surface represents a critical notification, like battery is running out.
@ Normal
A normal surface.
@ Notification
The surface represents a notification.
@ Panel
The surface represents a panel (dock), normally stacked above normal surfaces.
@ OnScreenDisplay
The surface represents an on screen display, like a volume changed notification.
@ ToolTip
The surface represents a tooltip.
@ AppletPopup
The surface represents an applet popup window.
void hideAutoHidingPanel()
void panelAutoHideHideRequested()
@ WindowsGoBelow
Window are allowed to go below the panel.
@ AutoHide
The panel auto hides at a screen edge and returns on mouse press against edge.
@ WindowsCanCover
Windows are allowed to go above the panel, it raises on mouse press against screen edge.
@ AlwaysVisible
The panel should be always visible.
PlasmaShellSurfaceInterface * q
PlasmaShellSurfaceInterfacePrivate(PlasmaShellSurfaceInterface *q, SurfaceInterface *surface, wl_resource *resource)
QPointer< SurfaceInterface > surface
PlasmaShellSurfaceInterface::Role m_role
bool m_openUnderCursorRequested
PlasmaShellSurfaceInterface::PanelBehavior m_panelBehavior
Resource representing a wl_surface.
static SurfaceInterface * get(wl_resource *native)