Changeset View
Changeset View
Standalone View
Standalone View
src/server/pointer_interface.cpp
Show All 12 Lines | |||||
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
15 | Lesser General Public License for more details. | 15 | Lesser General Public License for more details. | ||
16 | 16 | | |||
17 | You should have received a copy of the GNU Lesser General Public | 17 | You should have received a copy of the GNU Lesser General Public | ||
18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | 18 | License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
19 | *********************************************************************/ | 19 | *********************************************************************/ | ||
20 | #include "pointer_interface.h" | 20 | #include "pointer_interface.h" | ||
21 | #include "pointer_interface_p.h" | ||||
21 | #include "resource_p.h" | 22 | #include "resource_p.h" | ||
22 | #include "seat_interface.h" | 23 | #include "seat_interface.h" | ||
23 | #include "display.h" | 24 | #include "display.h" | ||
24 | #include "subcompositor_interface.h" | 25 | #include "subcompositor_interface.h" | ||
25 | #include "surface_interface.h" | 26 | #include "surface_interface.h" | ||
26 | // Wayland | 27 | // Wayland | ||
27 | #include <wayland-server.h> | 28 | #include <wayland-server.h> | ||
28 | 29 | | |||
29 | namespace KWayland | 30 | namespace KWayland | ||
30 | { | 31 | { | ||
31 | 32 | | |||
32 | namespace Server | 33 | namespace Server | ||
33 | { | 34 | { | ||
34 | 35 | | |||
35 | class PointerInterface::Private : public Resource::Private | | |||
36 | { | | |||
37 | public: | | |||
38 | Private(SeatInterface *parent, wl_resource *parentResource, PointerInterface *q); | | |||
39 | | ||||
40 | SeatInterface *seat; | | |||
41 | SurfaceInterface *focusedSurface = nullptr; | | |||
42 | QPointer<SurfaceInterface> focusedChildSurface; | | |||
43 | QMetaObject::Connection destroyConnection; | | |||
44 | Cursor *cursor = nullptr; | | |||
45 | | ||||
46 | void sendLeave(SurfaceInterface *surface, quint32 serial); | | |||
47 | void sendEnter(SurfaceInterface *surface, const QPointF &parentSurfacePosition, quint32 serial); | | |||
48 | | ||||
49 | private: | | |||
50 | PointerInterface *q_func() { | | |||
51 | return reinterpret_cast<PointerInterface *>(q); | | |||
52 | } | | |||
53 | void setCursor(quint32 serial, SurfaceInterface *surface, const QPoint &hotspot); | | |||
54 | // interface | | |||
55 | static void setCursorCallback(wl_client *client, wl_resource *resource, uint32_t serial, | | |||
56 | wl_resource *surface, int32_t hotspot_x, int32_t hotspot_y); | | |||
57 | // since version 3 | | |||
58 | static void releaseCallback(wl_client *client, wl_resource *resource); | | |||
59 | | ||||
60 | static const struct wl_pointer_interface s_interface; | | |||
61 | }; | | |||
62 | | ||||
63 | class Cursor::Private | 36 | class Cursor::Private | ||
64 | { | 37 | { | ||
65 | public: | 38 | public: | ||
66 | Private(Cursor *q, PointerInterface *pointer); | 39 | Private(Cursor *q, PointerInterface *pointer); | ||
67 | PointerInterface *pointer; | 40 | PointerInterface *pointer; | ||
68 | quint32 enteredSerial = 0; | 41 | quint32 enteredSerial = 0; | ||
69 | QPoint hotspot; | 42 | QPoint hotspot; | ||
70 | QPointer<SurfaceInterface> surface; | 43 | QPointer<SurfaceInterface> surface; | ||
▲ Show 20 Lines • Show All 246 Lines • Show Last 20 Lines |