16#include "qwayland-server-cursor-shape-v1.h"
21static constexpr int s_version = 1;
50 : QtWaylandServer::wp_cursor_shape_manager_v1(*display, s_version)
56 wl_resource_destroy(resource->handle);
61 wl_resource *device = wl_resource_create(resource->client(), &wp_cursor_shape_device_v1_interface, resource->version(), cursor_shape_device);
63 wl_resource_post_no_memory(resource->handle);
71 wl_resource *device = wl_resource_create(resource->client(), &wp_cursor_shape_device_v1_interface, resource->version(), cursor_shape_device);
73 wl_resource_post_no_memory(resource->handle);
90 : QtWaylandServer::wp_cursor_shape_device_v1(resource)
96 : QtWaylandServer::wp_cursor_shape_device_v1(resource)
97 , tabletTool(tabletTool)
108 wl_resource_destroy(resource->handle);
111static QByteArray shapeName(uint32_t shape)
114 case QtWaylandServer::wp_cursor_shape_device_v1::shape_default:
115 return QByteArrayLiteral(
"default");
116 case QtWaylandServer::wp_cursor_shape_device_v1::shape_context_menu:
117 return QByteArrayLiteral(
"context-menu");
118 case QtWaylandServer::wp_cursor_shape_device_v1::shape_help:
119 return QByteArrayLiteral(
"help");
120 case QtWaylandServer::wp_cursor_shape_device_v1::shape_pointer:
121 return QByteArrayLiteral(
"pointer");
122 case QtWaylandServer::wp_cursor_shape_device_v1::shape_progress:
123 return QByteArrayLiteral(
"progress");
124 case QtWaylandServer::wp_cursor_shape_device_v1::shape_wait:
125 return QByteArrayLiteral(
"wait");
126 case QtWaylandServer::wp_cursor_shape_device_v1::shape_cell:
127 return QByteArrayLiteral(
"cell");
128 case QtWaylandServer::wp_cursor_shape_device_v1::shape_crosshair:
129 return QByteArrayLiteral(
"crosshair");
130 case QtWaylandServer::wp_cursor_shape_device_v1::shape_text:
131 return QByteArrayLiteral(
"text");
132 case QtWaylandServer::wp_cursor_shape_device_v1::shape_vertical_text:
133 return QByteArrayLiteral(
"vertical-text");
134 case QtWaylandServer::wp_cursor_shape_device_v1::shape_alias:
135 return QByteArrayLiteral(
"alias");
136 case QtWaylandServer::wp_cursor_shape_device_v1::shape_copy:
137 return QByteArrayLiteral(
"copy");
138 case QtWaylandServer::wp_cursor_shape_device_v1::shape_move:
139 return QByteArrayLiteral(
"move");
140 case QtWaylandServer::wp_cursor_shape_device_v1::shape_no_drop:
141 return QByteArrayLiteral(
"no-drop");
142 case QtWaylandServer::wp_cursor_shape_device_v1::shape_not_allowed:
143 return QByteArrayLiteral(
"not-allowed");
144 case QtWaylandServer::wp_cursor_shape_device_v1::shape_grab:
145 return QByteArrayLiteral(
"grab");
146 case QtWaylandServer::wp_cursor_shape_device_v1::shape_grabbing:
147 return QByteArrayLiteral(
"grabbing");
148 case QtWaylandServer::wp_cursor_shape_device_v1::shape_e_resize:
149 return QByteArrayLiteral(
"e-resize");
150 case QtWaylandServer::wp_cursor_shape_device_v1::shape_n_resize:
151 return QByteArrayLiteral(
"n-resize");
152 case QtWaylandServer::wp_cursor_shape_device_v1::shape_ne_resize:
153 return QByteArrayLiteral(
"ne-resize");
154 case QtWaylandServer::wp_cursor_shape_device_v1::shape_nw_resize:
155 return QByteArrayLiteral(
"nw-resize");
156 case QtWaylandServer::wp_cursor_shape_device_v1::shape_s_resize:
157 return QByteArrayLiteral(
"s-resize");
158 case QtWaylandServer::wp_cursor_shape_device_v1::shape_se_resize:
159 return QByteArrayLiteral(
"se-resize");
160 case QtWaylandServer::wp_cursor_shape_device_v1::shape_sw_resize:
161 return QByteArrayLiteral(
"sw-resize");
162 case QtWaylandServer::wp_cursor_shape_device_v1::shape_w_resize:
163 return QByteArrayLiteral(
"w-resize");
164 case QtWaylandServer::wp_cursor_shape_device_v1::shape_ew_resize:
165 return QByteArrayLiteral(
"ew-resize");
166 case QtWaylandServer::wp_cursor_shape_device_v1::shape_ns_resize:
167 return QByteArrayLiteral(
"ns-resize");
168 case QtWaylandServer::wp_cursor_shape_device_v1::shape_nesw_resize:
169 return QByteArrayLiteral(
"nesw-resize");
170 case QtWaylandServer::wp_cursor_shape_device_v1::shape_nwse_resize:
171 return QByteArrayLiteral(
"nwse-resize");
172 case QtWaylandServer::wp_cursor_shape_device_v1::shape_col_resize:
173 return QByteArrayLiteral(
"col-resize");
174 case QtWaylandServer::wp_cursor_shape_device_v1::shape_row_resize:
175 return QByteArrayLiteral(
"row-resize");
176 case QtWaylandServer::wp_cursor_shape_device_v1::shape_all_scroll:
177 return QByteArrayLiteral(
"all-scroll");
178 case QtWaylandServer::wp_cursor_shape_device_v1::shape_zoom_in:
179 return QByteArrayLiteral(
"zoom-in");
180 case QtWaylandServer::wp_cursor_shape_device_v1::shape_zoom_out:
181 return QByteArrayLiteral(
"zoom-out");
183 return QByteArrayLiteral(
"default");
189 if (shape < shape_default || shape > shape_zoom_out) {
190 wl_resource_post_error(resource->handle, error_invalid_shape,
"unknown cursor shape");
194 if (!
pointer->focusedSurface() ||
pointer->focusedSurface()->client()->client() != resource->client()) {
197 if (
pointer->focusedSerial() == serial) {
198 Q_EMIT
pointer->cursorChanged(shapeName(shape));
201 if (!
tabletTool->currentSurface() ||
tabletTool->currentSurface()->client()->client() != resource->client()) {
204 if (
tabletTool->proximitySerial() == serial) {
205 Q_EMIT
tabletTool->cursorChanged(shapeName(shape));
void wp_cursor_shape_device_v1_destroy(Resource *resource) override
QPointer< PointerInterface > pointer
void wp_cursor_shape_device_v1_set_shape(Resource *resource, uint32_t serial, uint32_t shape) override
void wp_cursor_shape_device_v1_destroy_resource(Resource *resource) override
CursorShapeDeviceV1Interface(PointerInterface *pointer, wl_resource *resource)
QPointer< TabletToolV2Interface > tabletTool
CursorShapeManagerV1Interface(Display *display, QObject *parent=nullptr)
~CursorShapeManagerV1Interface() override
CursorShapeManagerV1InterfacePrivate(Display *display)
void wp_cursor_shape_manager_v1_destroy(Resource *resource) override
void wp_cursor_shape_manager_v1_get_pointer(Resource *resource, uint32_t cursor_shape_device, struct ::wl_resource *pointer) override
void wp_cursor_shape_manager_v1_get_tablet_tool_v2(Resource *resource, uint32_t cursor_shape_device, struct ::wl_resource *tablet_tool) override
Class holding the Wayland server display loop.
static PointerInterface * get(wl_resource *native)