QWindowKit  1.5.1.0
Cross-platform window customization framework
Loading...
Searching...
No Matches
qwindowkit_linux.h
1// Copyright (C) 2021-2023 wangwenx190 (Yuhang Zhao)
2// Copyright (C) 2023-present Stdware Collections (https://www.github.com/stdware)
3// Copyright (C) 2025-2027 Wing-summer (wingsummer)
4// SPDX-License-Identifier: Apache-2.0
5
6#ifndef QWINDOWKIT_LINUX_H
7#define QWINDOWKIT_LINUX_H
8
9//
10// W A R N I N G !!!
11// -----------------
12//
13// This file is not part of the QWindowKit API. It is used purely as an
14// implementation detail. This header file may change from version to
15// version without notice, or may even be removed.
16//
17
18#include <QtCore/qglobal.h>
19
20#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
21#include <qguiapplication_platform.h>
22
23// some declarations about x11
24using Atom = unsigned long;
25using Bool = int;
26using XID = unsigned long;
27using Window = XID;
28
29union _XEvent;
30using XEvent = union _XEvent;
31
32// for wayland
33struct wl_proxy;
34
35namespace QWK {
36 namespace Private {
37 struct LinuxX11API {
38 LinuxX11API() = default;
39 Q_DISABLE_COPY(LinuxX11API)
40
41 using XInternAtomFn = Atom (*)(Display *, const char *, Bool);
42 using XSendEventFn = int (*)(Display *, Window, Bool, long, XEvent *);
43 using XFlushFn = int (*)(Display *);
44 using XUngrabPointerFn = int (*)(Display *, unsigned long);
45
46 XInternAtomFn XInternAtom = nullptr;
47 XSendEventFn XSendEvent = nullptr;
48 XFlushFn XFlush = nullptr;
49 XUngrabPointerFn XUngrabPointer = nullptr;
50
51 inline bool isValid() const {
52 return XInternAtom && XSendEvent && XFlush && XUngrabPointer;
53 }
54 };
55
56 struct LinuxWaylandAPI {
57 LinuxWaylandAPI() = default;
58 Q_DISABLE_COPY(LinuxWaylandAPI)
59
60 using wl_display_flush_fn = int (*)(struct wl_display *);
61 using wl_proxy_marshal_flags_fn = void (*)(struct wl_proxy *, uint32_t,
62 const struct wl_interface *, uint32_t,
63 uint32_t, ...);
64 using wl_proxy_get_version_fn = int (*)(struct wl_proxy *);
65
66 wl_display_flush_fn wl_display_flush = nullptr;
67 wl_proxy_marshal_flags_fn wl_proxy_marshal_flags = nullptr;
68 wl_proxy_get_version_fn wl_proxy_get_version = nullptr;
69
70 inline bool isValid() const {
71 return wl_display_flush && wl_proxy_marshal_flags && wl_proxy_get_version;
72 }
73 };
74
75
76 bool isWaylandPlatform();
77
78 bool isX11Platform();
79
80 const LinuxX11API &x11API();
81
82 const LinuxWaylandAPI &waylandAPI();
83 }
84}
85#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
86#endif // QWINDOWKIT_LINUX_H
QWindowKit namespace.
Definition abstractwindowcontext.cpp:13