DtkGui
DTK Gui module
载入中...
搜索中...
未找到
dwindowmanagerhelper.h
1// SPDX-FileCopyrightText: 2022 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: LGPL-3.0-or-later
4
5#ifndef DWINDOWMANAGERHELPER_H
6#define DWINDOWMANAGERHELPER_H
7
8#include <dtkgui_global.h>
9#include <DObject>
10
11#include <QWindow>
12
13DGUI_BEGIN_NAMESPACE
14
15class DForeignWindow;
16class DWindowManagerHelperPrivate;
17class DWindowManagerHelper : public QObject, public DTK_CORE_NAMESPACE::DObject
18{
19 Q_OBJECT
20
21 Q_PROPERTY(bool hasBlurWindow READ hasBlurWindow NOTIFY hasBlurWindowChanged)
22 Q_PROPERTY(bool hasComposite READ hasComposite NOTIFY hasCompositeChanged)
23 Q_PROPERTY(bool hasNoTitlebar READ hasNoTitlebar NOTIFY hasNoTitlebarChanged)
24 Q_PROPERTY(bool hasWallpaperEffect READ hasWallpaperEffect NOTIFY hasWallpaperEffectChanged)
25
26public:
27 enum MotifFunction {
28 FUNC_RESIZE = (1L << 1),
29 FUNC_MOVE = (1L << 2),
30 FUNC_MINIMIZE = (1L << 3),
31 FUNC_MAXIMIZE = (1L << 4),
32 FUNC_CLOSE = (1L << 5),
33 FUNC_ALL = FUNC_RESIZE | FUNC_MOVE | FUNC_MINIMIZE | FUNC_MAXIMIZE | FUNC_CLOSE
34 };
35 Q_ENUM(MotifFunction)
36 Q_DECLARE_FLAGS(MotifFunctions, MotifFunction)
37 Q_FLAG(MotifFunctions)
38
39 enum MotifDecoration {
40 DECOR_BORDER = (1L << 1),
41 DECOR_RESIZEH = (1L << 2),
42 DECOR_TITLE = (1L << 3),
43 DECOR_MENU = (1L << 4),
44 DECOR_MINIMIZE = (1L << 5),
45 DECOR_MAXIMIZE = (1L << 6),
46 DECOR_ALL = DECOR_BORDER | DECOR_RESIZEH | DECOR_TITLE | DECOR_MENU | DECOR_MINIMIZE | DECOR_MAXIMIZE
47 };
48 Q_ENUM(MotifDecoration)
49 Q_DECLARE_FLAGS(MotifDecorations, MotifDecoration)
50 Q_FLAG(MotifDecorations)
51
52 enum WMName {
53 OtherWM,
54 DeepinWM,
55 KWinWM
56 };
57 Q_ENUM(WMName)
58
59 enum WmWindowType {
60 UnknowWindowType = 0x000000,
61 NormalType = 0x000001,
62 DesktopType = 0x000002,
63 DockType = 0x000004,
64 ToolbarType = 0x000008,
65 MenuType = 0x000010,
66 UtilityType = 0x000020,
67 SplashType = 0x000040,
68 DialogType = 0x000080,
69 DropDownMenuType = 0x000100,
70 PopupMenuType = 0x000200,
71 TooltipType = 0x000400,
72 NotificationType = 0x000800,
73 ComboType = 0x001000,
74 DndType = 0x002000,
75 KdeOverrideType = 0x004000
76 };
77 Q_ENUM(WmWindowType)
78 Q_DECLARE_FLAGS(WmWindowTypes, WmWindowType)
79 Q_FLAG(WmWindowTypes)
80
81 ~DWindowManagerHelper();
82
83 static DWindowManagerHelper *instance();
84
85 static void setMotifFunctions(const QWindow *window, MotifFunctions hints);
86 static MotifFunctions setMotifFunctions(const QWindow *window, MotifFunctions hints, bool on);
87 static MotifFunctions getMotifFunctions(const QWindow *window);
88 static void setMotifDecorations(const QWindow *window, MotifDecorations hints);
89 static MotifDecorations setMotifDecorations(const QWindow *window, MotifDecorations hints, bool on);
90 static MotifDecorations getMotifDecorations(const QWindow *window);
91 static void setWmWindowTypes(QWindow *window, WmWindowTypes types);
92 static void setWmClassName(const QByteArray &name);
93
94 static void popupSystemWindowMenu(const QWindow *window);
95
96 bool hasBlurWindow() const;
97 bool hasComposite() const;
98 bool hasNoTitlebar() const;
99 bool hasWallpaperEffect() const;
100 QString windowManagerNameString() const;
101 WMName windowManagerName() const;
102
103 QVector<quint32> allWindowIdList() const;
104 QVector<quint32> currentWorkspaceWindowIdList() const;
105 QList<DForeignWindow*> currentWorkspaceWindows() const;
106 quint32 windowFromPoint(const QPoint &p);
107
108Q_SIGNALS:
115 void windowMotifWMHintsChanged(quint32 winId);
116
117protected:
118 explicit DWindowManagerHelper(QObject *parent = 0);
119
120private:
121 D_DECLARE_PRIVATE(DWindowManagerHelper)
122};
123
124DGUI_END_NAMESPACE
125
126Q_DECLARE_OPERATORS_FOR_FLAGS(DTK_GUI_NAMESPACE::DWindowManagerHelper::MotifFunctions)
127Q_DECLARE_OPERATORS_FOR_FLAGS(DTK_GUI_NAMESPACE::DWindowManagerHelper::MotifDecorations)
128Q_DECLARE_OPERATORS_FOR_FLAGS(DTK_GUI_NAMESPACE::DWindowManagerHelper::WmWindowTypes)
129
130#endif // DWINDOWMANAGERHELPER_H
提供与窗口管理器交互的接口,同 DPlatformWindowHandle 依赖 dxcb 插件.
Definition dwindowmanagerhelper.h:18
void hasCompositeChanged()
信号会在 hasComposite 属性的值改变时被发送.
void windowMotifWMHintsChanged(quint32 winId)
信号会在窗口功能或修饰标志改变时被发送.
void hasWallpaperEffectChanged()
信号会在 hasWallpaperEffect 属性的值改变时被发送.
void windowListChanged()
信号会在当前环境本地窗口列表变化时被发送。包含打开新窗口、关闭窗口、改变窗口的 层叠顺序.
void windowManagerChanged()
信号会在当前环境窗口管理器变化时被发送.
void hasBlurWindowChanged()
信号会在 hasBlurWindow 属性的值改变时被发送.
void hasNoTitlebarChanged()
信号会在 hasNoTitlebar 属性的值改变时被发送.