Changeset View
Changeset View
Standalone View
Standalone View
pointer_input.cpp
Show All 23 Lines | |||||
24 | #include "input_event_spy.h" | 24 | #include "input_event_spy.h" | ||
25 | #include "osd.h" | 25 | #include "osd.h" | ||
26 | #include "screens.h" | 26 | #include "screens.h" | ||
27 | #include "shell_client.h" | 27 | #include "shell_client.h" | ||
28 | #include "wayland_cursor_theme.h" | 28 | #include "wayland_cursor_theme.h" | ||
29 | #include "wayland_server.h" | 29 | #include "wayland_server.h" | ||
30 | #include "workspace.h" | 30 | #include "workspace.h" | ||
31 | #include "decorations/decoratedclient.h" | 31 | #include "decorations/decoratedclient.h" | ||
32 | #include "screens.h" | ||||
32 | // KDecoration | 33 | // KDecoration | ||
33 | #include <KDecoration2/Decoration> | 34 | #include <KDecoration2/Decoration> | ||
34 | // KWayland | 35 | // KWayland | ||
35 | #include <KWayland/Client/connection_thread.h> | 36 | #include <KWayland/Client/connection_thread.h> | ||
36 | #include <KWayland/Client/buffer.h> | 37 | #include <KWayland/Client/buffer.h> | ||
37 | #include <KWayland/Server/buffer_interface.h> | 38 | #include <KWayland/Server/buffer_interface.h> | ||
38 | #include <KWayland/Server/datadevice_interface.h> | 39 | #include <KWayland/Server/datadevice_interface.h> | ||
39 | #include <KWayland/Server/display.h> | 40 | #include <KWayland/Server/display.h> | ||
▲ Show 20 Lines • Show All 1172 Lines • ▼ Show 20 Line(s) | 1212 | if (!b) { | |||
1212 | return; | 1213 | return; | ||
1213 | } | 1214 | } | ||
1214 | waylandServer()->internalClientConection()->flush(); | 1215 | waylandServer()->internalClientConection()->flush(); | ||
1215 | waylandServer()->dispatch(); | 1216 | waylandServer()->dispatch(); | ||
1216 | auto buffer = KWayland::Server::BufferInterface::get(waylandServer()->internalConnection()->getResource(KWayland::Client::Buffer::getId(b))); | 1217 | auto buffer = KWayland::Server::BufferInterface::get(waylandServer()->internalConnection()->getResource(KWayland::Client::Buffer::getId(b))); | ||
1217 | if (!buffer) { | 1218 | if (!buffer) { | ||
1218 | return; | 1219 | return; | ||
1219 | } | 1220 | } | ||
1220 | it = decltype(it)(cursors.insert(shape, {buffer->data().copy(), QPoint(cursor->hotspot_x, cursor->hotspot_y)})); | 1221 | auto scale = screens()->maxScale(); | ||
1222 | int hotSpotX = qRound(cursor->hotspot_x / scale); | ||||
1223 | int hotSpotY = qRound(cursor->hotspot_y / scale); | ||||
1224 | QImage img = buffer->data().copy(); | ||||
1225 | img.setDevicePixelRatio(scale); | ||||
1226 | it = decltype(it)(cursors.insert(shape, {img, QPoint(hotSpotX, hotSpotY)})); | ||||
1221 | } | 1227 | } | ||
1222 | image->hotSpot = it.value().hotSpot; | 1228 | image->hotSpot = it.value().hotSpot; | ||
1223 | image->image = it.value().image; | 1229 | image->image = it.value().image; | ||
1224 | } | 1230 | } | ||
1225 | 1231 | | |||
1226 | void CursorImage::reevaluteSource() | 1232 | void CursorImage::reevaluteSource() | ||
1227 | { | 1233 | { | ||
1228 | if (waylandServer()->seat()->isDragPointer()) { | 1234 | if (waylandServer()->seat()->isDragPointer()) { | ||
▲ Show 20 Lines • Show All 89 Lines • Show Last 20 Lines |