Debian Codegraph @

src/plugins/platform/xcb/dxcbplatformwindowinterface.cpp

raw
1 // SPDX-FileCopyrightText: 2024 UnionTech Software Technology Co., Ltd.
2 //
3 // SPDX-License-Identifier: LGPL-3.0-or-later
4
5 #include "dxcbplatformwindowinterface.h"
6 #include "dguiapplicationhelper.h"
7 #include "dplatformtheme.h"
8 #include "dwindowmanagerhelper.h"
9
10 #include <private/qwaylandwindow_p.h>
11
12 #include <QGuiApplication>
13 #include <QPlatformSurfaceEvent>
14 #include <QStyleHints>
15
16 DGUI_BEGIN_NAMESPACE
17
18 #define DXCB_PLUGIN_KEY "dxcb"
19 #define DXCB_PLUGIN_SYMBOLIC_PROPERTY "_d_isDxcb"
20
21 #define DEFINE_CONST_CHAR(Name) const char _##Name[] = "_d_" #Name
22
23 DEFINE_CONST_CHAR(useDxcb);
24 DEFINE_CONST_CHAR(redirectContent);
25 DEFINE_CONST_CHAR(netWmStates);
26 DEFINE_CONST_CHAR(windowRadius);
27 DEFINE_CONST_CHAR(borderWidth);
28 DEFINE_CONST_CHAR(borderColor);
29 DEFINE_CONST_CHAR(windowEffect);
30 DEFINE_CONST_CHAR(windowStartUpEffect);
31 DEFINE_CONST_CHAR(shadowRadius);
32 DEFINE_CONST_CHAR(shadowOffset);
33 DEFINE_CONST_CHAR(shadowColor);
34 DEFINE_CONST_CHAR(clipPath);
35 DEFINE_CONST_CHAR(frameMask);
36 DEFINE_CONST_CHAR(frameMargins);
37 DEFINE_CONST_CHAR(translucentBackground);
38 DEFINE_CONST_CHAR(enableSystemResize);
39 DEFINE_CONST_CHAR(enableSystemMove);
40 DEFINE_CONST_CHAR(enableBlurWindow);
41 DEFINE_CONST_CHAR(windowBlurAreas);
42 DEFINE_CONST_CHAR(windowBlurPaths);
43 DEFINE_CONST_CHAR(windowWallpaperParas);
44 DEFINE_CONST_CHAR(autoInputMaskByClipPath);
45
46 DEFINE_CONST_CHAR(resolve_mask);
47 enum PropRole {
48 WindowRadius,
49
50 // TO BE CONTINUE
51 };
52
53 // functions
54 DEFINE_CONST_CHAR(setWmBlurWindowBackgroundArea);
55 DEFINE_CONST_CHAR(setWmBlurWindowBackgroundPathList);
56 DEFINE_CONST_CHAR(setWmBlurWindowBackgroundMaskImage);
57 DEFINE_CONST_CHAR(setWmWallpaperParameter);
58 DEFINE_CONST_CHAR(setWindowProperty);
59 DEFINE_CONST_CHAR(pluginVersion);
60 DEFINE_CONST_CHAR(disableOverrideCursor);
61 DEFINE_CONST_CHAR(enableDxcb);
62 DEFINE_CONST_CHAR(isEnableDxcb);
63 DEFINE_CONST_CHAR(setEnableNoTitlebar);
64 DEFINE_CONST_CHAR(isEnableNoTitlebar);
65 DEFINE_CONST_CHAR(clientLeader);
66
67 static void resolve(QObject *obj, PropRole role)
68 {
69 int mask = obj->property(_resolve_mask).toInt();
70 obj->setProperty(_resolve_mask, (mask |= 1 << role));
71 }
72
73 static bool resolved(QObject *obj, PropRole role)
74 {
75 int mask = obj->property(_resolve_mask).toInt();
76 return mask & (1 << role);
77 }
78
79 static void setWindowProperty(QWindow *window, const char *name, const QVariant &value)
80 {
81 if (!window)
82 return;
83
84 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
85 static QFunctionPointer setWindowProperty = qApp->platformFunction(_setWindowProperty);
86 #else
87 constexpr QFunctionPointer setWindowProperty = nullptr;
88 #endif
89
90 if (!setWindowProperty) {
91 window->setProperty(name, value);
92
93 return;
94 }
95
96 reinterpret_cast<void(*)(QWindow *, const char *, const QVariant &)>(setWindowProperty)(window, name, value);
97 }
98
99 DXCBPlatformWindowInterface::DXCBPlatformWindowInterface(QWindow *window, DPlatformHandle *platformHandle, QObject *parent)
100 : QObject(parent)
101 , DPlatformWindowInterface(window, platformHandle)
102 {
103 if (window) {
104 window->installEventFilter(this);
105 }
106 }
107
108 DXCBPlatformWindowInterface::~DXCBPlatformWindowInterface()
109 {
110 }
111
112 QString DXCBPlatformWindowInterface::pluginVersion()
113 {
114 QFunctionPointer pv = 0;
115
116 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
117 pv = qApp->platformFunction(_pluginVersion);
118 #endif
119
120 if (Q_UNLIKELY(!pv))
121 return QString();
122
123 return reinterpret_cast<QString(*)()>(pv)();
124 }
125
126 bool DXCBPlatformWindowInterface::isDXcbPlatform()
127 {
128 if (!qApp)
129 return false;
130
131 static bool _is_dxcb = qApp->platformName() == DXCB_PLUGIN_KEY || qApp->property(DXCB_PLUGIN_SYMBOLIC_PROPERTY).toBool();
132
133 return _is_dxcb;
134 }
135
136 bool DXCBPlatformWindowInterface::connectWindowManagerChangedSignal(QObject *object, std::function<void ()> slot)
137 {
138 if (object) {
139 return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::windowManagerChanged, object, slot);
140 }
141
142 return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::windowManagerChanged, slot);
143 }
144
145 bool DXCBPlatformWindowInterface::connectHasBlurWindowChanged(QObject *object, std::function<void ()> slot)
146 {
147 if (object) {
148 return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasBlurWindowChanged, object, slot);
149 }
150
151 return QObject::connect(DWindowManagerHelper::instance(), &DWindowManagerHelper::hasBlurWindowChanged, slot);
152 }
153
154 WId DXCBPlatformWindowInterface::windowLeader()
155 {
156 QFunctionPointer clientLeader = Q_NULLPTR;
157
158 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
159 clientLeader = qApp->platformFunction(_clientLeader);
160 #endif
161
162 if (!clientLeader) {
163 return 0;
164 }
165
166 return reinterpret_cast<quint32(*)()>(clientLeader)();
167 }
168
169 void DXCBPlatformWindowInterface::setEnabled(bool enabled)
170 {
171 // 优先使用窗口管理器中实现的no titlebar接口实现自定义窗口修饰器的效果
172 if (setEnabledNoTitlebar(enabled)) {
173 return;
174 }
175
176 if (!isDXcbPlatform())
177 return;
178
179 QFunctionPointer enable_dxcb = nullptr;
180
181 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
182 enable_dxcb = qApp->platformFunction(_enableDxcb);
183 #endif
184
185 if (enable_dxcb) {
186 (*reinterpret_cast<bool(*)(QWindow*)>(enable_dxcb))(m_window);
187 } else if (m_window->handle()) {
188 Q_ASSERT_X(m_window->property(_useDxcb).toBool(), "DXCBPlatformWindowInterfacer:",
189 "Must be called before window handle has been created. See also QWindow::handle()");
190 } else {
191 m_window->setProperty(_useDxcb, enabled);
192 }
193 }
194
195 void DXCBPlatformWindowInterface::enableDXcb(bool redirectContent)
196 {
197 m_window->setProperty(_redirectContent, redirectContent);
198
199 setEnabled(true);
200 }
201
202 bool DXCBPlatformWindowInterface::isEnabled() const
203 {
204 if (isEnabledNoTitlebar())
205 return true;
206
207 QFunctionPointer is_enable_dxcb = nullptr;
208
209 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
210 is_enable_dxcb = qApp->platformFunction(_isEnableDxcb);
211 #endif
212
213 if (is_enable_dxcb) {
214 return (*reinterpret_cast<bool(*)(const QWindow*)>(is_enable_dxcb))(m_window);
215 }
216
217 return m_window->property(_useDxcb).toBool();
218 }
219
220 bool DXCBPlatformWindowInterface::eventFilter(QObject *obj, QEvent *event)
221 {
222 if (obj == m_window && m_platformHandle) {
223 if (event->type() == QEvent::DynamicPropertyChange) {
224 QDynamicPropertyChangeEvent *e = static_cast<QDynamicPropertyChangeEvent *>(event);
225
226 if (e->propertyName() == _windowRadius) {
227 Q_EMIT m_platformHandle->windowRadiusChanged();
228 } else if (e->propertyName() == _borderWidth) {
229 Q_EMIT m_platformHandle->borderWidthChanged();
230 } else if (e->propertyName() == _borderColor) {
231 Q_EMIT m_platformHandle->borderColorChanged();
232 } else if (e->propertyName() == _shadowRadius) {
233 Q_EMIT m_platformHandle->shadowRadiusChanged();
234 } else if (e->propertyName() == _shadowOffset) {
235 Q_EMIT m_platformHandle->shadowOffsetChanged();
236 } else if (e->propertyName() == _shadowColor) {
237 Q_EMIT m_platformHandle->shadowColorChanged();
238 } else if (e->propertyName() == _clipPath) {
239 Q_EMIT m_platformHandle->clipPathChanged();
240 } else if (e->propertyName() == _frameMask) {
241 Q_EMIT m_platformHandle->frameMaskChanged();
242 } else if (e->propertyName() == _frameMargins) {
243 Q_EMIT m_platformHandle->frameMarginsChanged();
244 } else if (e->propertyName() == _translucentBackground) {
245 Q_EMIT m_platformHandle->translucentBackgroundChanged();
246 } else if (e->propertyName() == _enableSystemResize) {
247 Q_EMIT m_platformHandle->enableSystemResizeChanged();
248 } else if (e->propertyName() == _enableSystemMove) {
249 Q_EMIT m_platformHandle->enableSystemMoveChanged();
250 } else if (e->propertyName() == _enableBlurWindow) {
251 Q_EMIT m_platformHandle->enableBlurWindowChanged();
252 } else if (e->propertyName() == _autoInputMaskByClipPath) {
253 Q_EMIT m_platformHandle->autoInputMaskByClipPathChanged();
254 }
255 }
256 }
257
258 return QObject::eventFilter(obj, event);
259 }
260
261 static void initWindowRadius(QWindow *window)
262 {
263 if (window->property(_windowRadius).isValid())
264 return;
265
266 auto theme = DGuiApplicationHelper::instance()->systemTheme();
267 int radius = theme->windowRadius(12); //###(zccrs): 暂时在此处给窗口默认设置为12px的圆角
268
269 setWindowProperty(window, _windowRadius, radius);
270 // Qt::UniqueConnection will report a warning
271 // to `unique connections require a pointer to member function of a QObject subclass`.
272 const char *uniqueueConnectionFlag("_d_uniqueueConnectionFlag");
273 bool connected = window->property(uniqueueConnectionFlag).toBool();
274 if (!connected) {
275 window->setProperty(uniqueueConnectionFlag, true);
276 window->connect(theme, &DPlatformTheme::windowRadiusChanged, window, [window] (int radius) {
277 if (!resolved(window, PropRole::WindowRadius))
278 setWindowProperty(window, _windowRadius, radius);
279 });
280 }
281 }
282
283 class Q_DECL_HIDDEN CreatorWindowEventFilter : public QObject {
284 public:
285 CreatorWindowEventFilter(QObject *par= nullptr): QObject(par){}
286
287 public:
288 bool eventFilter(QObject *watched, QEvent *event) override {
289 if (event->type() == QEvent::PlatformSurface) {
290 QPlatformSurfaceEvent *se = static_cast<QPlatformSurfaceEvent*>(event);
291 if (se->surfaceEventType() == QPlatformSurfaceEvent::SurfaceCreated) { // 若收到此信号, 则 WinID 已被创建
292 auto window = qobject_cast<QWindow *>(watched);
293 initWindowRadius(window);
294 }
295 }
296 return QObject::eventFilter(watched, event);
297 }
298 };
299
300 bool DXCBPlatformWindowInterface::isEnabledNoTitlebar() const
301 {
302 QFunctionPointer is_enable_no_titlebar = nullptr;
303
304 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
305 is_enable_no_titlebar = qApp->platformFunction(_isEnableNoTitlebar);
306 #endif
307
308 if (is_enable_no_titlebar) {
309 return (*reinterpret_cast<bool(*)(const QWindow*)>(is_enable_no_titlebar))(m_window);
310 }
311
312 return false;
313 }
314
315 bool DXCBPlatformWindowInterface::setEnabledNoTitlebar(bool enable)
316 {
317 if (isEnabledNoTitlebar() == enable)
318 return true;
319
320 QFunctionPointer enable_no_titlear = nullptr;
321
322 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
323 enable_no_titlear = qApp->platformFunction(_setEnableNoTitlebar);
324 #endif
325
326 if (enable_no_titlear) {
327 bool ok = (*reinterpret_cast<bool(*)(QWindow*, bool)>(enable_no_titlear))(m_window, enable);
328 if (ok && enable) {
329 if (m_window->handle()) {
330 initWindowRadius(m_window);
331 } else {
332 m_window->installEventFilter(new CreatorWindowEventFilter(m_window));
333 }
334 }
335
336 return ok;
337 }
338
339 return false;
340 }
341
342 inline DPlatformHandle::WMBlurArea operator *(const DPlatformHandle::WMBlurArea &area, qreal scale)
343 {
344 if (qFuzzyCompare(scale, 1.0))
345 return area;
346
347 DPlatformHandle::WMBlurArea new_area;
348
349 new_area.x = qRound64(area.x * scale);
350 new_area.y = qRound64(area.y * scale);
351 new_area.width = qRound64(area.width * scale);
352 new_area.height = qRound64(area.height * scale);
353 new_area.xRadius = qRound64(area.xRadius * scale);
354 new_area.yRaduis = qRound64(area.yRaduis * scale);
355
356 return new_area;
357 }
358
359 /*!
360 \brief DXCBPlatformWindowInterface::setWindowBlurAreaByWM
361 设置窗口背景的模糊区域,示例:
362 \code
363 QWindow w;
364 QVector<DXCBPlatformWindowInterface::WMBlurArea> area_list;
365 DXCBPlatformWindowInterface::WMBlurArea area;
366
367 area.x = 50;
368 area.y = 50;
369 area.width = 200;
370 area.height = 200;
371 area.xRadius = 10;
372 area.yRaduis = 10;
373 area_list.append(area);
374
375 DXCBPlatformWindowInterface::setWindowBlurAreaByWM(&w, area_list);
376
377 QSurfaceFormat format = w.format();
378 format.setAlphaBufferSize(8);
379
380 w.setFormat(format);
381 w.resize(300, 300);
382 w.show();
383
384 \endcode
385 \image blur_window_demo1.png
386 \a window 目标窗口对象
387 \a area 模糊区域,此区域范围内的窗口背景将填充为窗口后面内容模糊之后的图像
388 \return 如果设置成功则返回 true,否则返回 false
389 \note 对于需要显示模糊背景的窗口,需要将其 QSurfaceFormat 的 alpha 通道设置为8
390 \note 调用此接口设置窗口背景模糊区域后将覆盖之前所设置的区域,包括调用
391 setWindowBlurAreaByWM(QWindow *, const QList<QPainterPath> &)
392 所设置的区域
393 \note 建议使用 DBlurEffectWidget 实现窗口背景模糊效果
394 \note 此功能依赖于窗口管理器的实现,目前仅支持 deepin-wm 和 kwin 这两个窗口管理器
395 \sa Dtk::Widget::DBlurEffectWidget
396 \sa QSurfaceFormat::setAlphaBufferSize
397 \sa QWindow::setFormat
398 \sa DWindowManagerHelper::hasBlurWindow
399 \sa DXCBPlatformWindowInterface::setWindowBlurAreaByWM(QWindow *, const QList<QPainterPath> &)
400 */
401 bool DXCBPlatformWindowInterface::setWindowBlurArea(const QVector<DPlatformHandle::WMBlurArea> &area)
402 {
403 if (!m_window) {
404 return false;
405 }
406
407 if (isEnabled()) {
408 QVector<quint32> areas;
409 for (auto item : area)
410 areas << item.x << item.y << item.width << item.height << item.xRadius << item.yRaduis;
411 setWindowProperty(m_window, _windowBlurAreas, QVariant::fromValue(areas));
412 return true;
413 }
414
415 QFunctionPointer setWmBlurWindowBackgroundArea = Q_NULLPTR;
416
417 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
418 setWmBlurWindowBackgroundArea = qApp->platformFunction(_setWmBlurWindowBackgroundArea);
419 #endif
420
421 if (!setWmBlurWindowBackgroundArea) {
422 qWarning("setWindowBlurAreaByWM is not support");
423
424 return false;
425 }
426
427 QSurfaceFormat format = m_window->format();
428
429 format.setAlphaBufferSize(8);
430 m_window->setFormat(format);
431
432 const qreal device_ratio = m_window->devicePixelRatio();
433
434 if (qFuzzyCompare(device_ratio, 1.0)) {
435 return reinterpret_cast<bool(*)(const quint32, const QVector<DPlatformHandle::WMBlurArea>&)>(setWmBlurWindowBackgroundArea)(m_window->winId(), area);
436 }
437
438 QVector<DPlatformHandle::WMBlurArea> new_areas;
439
440 new_areas.reserve(area.size());
441
442 for (const DPlatformHandle::WMBlurArea &a : area) {
443 new_areas.append(a * device_ratio);
444 }
445
446 return reinterpret_cast<bool(*)(const quint32, const QVector<DPlatformHandle::WMBlurArea>&)>(setWmBlurWindowBackgroundArea)(m_window->winId(), new_areas);
447 }
448
449 inline QPainterPath operator *(const QPainterPath &path, qreal scale)
450 {
451 if (qFuzzyCompare(1.0, scale))
452 return path;
453
454 QPainterPath new_path = path;
455
456 for (int i = 0; i < path.elementCount(); ++i) {
457 const QPainterPath::Element &e = path.elementAt(i);
458
459 new_path.setElementPositionAt(i, qRound(e.x * scale), qRound(e.y * scale));
460 }
461
462 return new_path;
463 }
464
465 bool DXCBPlatformWindowInterface::setWindowBlurArea(const QList<QPainterPath> &paths)
466 {
467 if (!m_window) {
468 return false;
469 }
470
471 if (isEnabled()) {
472 setWindowProperty(m_window, _windowBlurPaths, QVariant::fromValue(paths));
473
474 return true;
475 }
476
477 QFunctionPointer setWmBlurWindowBackgroundPathList = Q_NULLPTR;
478
479 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
480 setWmBlurWindowBackgroundPathList = qApp->platformFunction(_setWmBlurWindowBackgroundPathList);
481 #endif
482
483 if (!setWmBlurWindowBackgroundPathList) {
484 qWarning("setWindowBlurAreaByWM is not support");
485
486 return false;
487 }
488
489 QSurfaceFormat format = m_window->format();
490
491 format.setAlphaBufferSize(8);
492 m_window->setFormat(format);
493
494 const qreal device_ratio = m_window->devicePixelRatio();
495
496 if (qFuzzyCompare(device_ratio, 1.0)) {
497 return reinterpret_cast<bool(*)(const quint32, const QList<QPainterPath>&)>(setWmBlurWindowBackgroundPathList)(m_window->winId(), paths);
498 }
499
500 QList<QPainterPath> new_paths;
501
502 new_paths.reserve(paths.size());
503
504 for (const QPainterPath &p : paths) {
505 new_paths.append(p * device_ratio);
506 }
507
508 return reinterpret_cast<bool(*)(const quint32, const QList<QPainterPath>&)>(setWmBlurWindowBackgroundPathList)(m_window->winId(), new_paths);
509 }
510
511 bool DXCBPlatformWindowInterface::setWindowWallpaperPara(const QRect &area, DPlatformHandle::WallpaperScaleMode sMode, DPlatformHandle::WallpaperFillMode fMode)
512 {
513 if (!m_window) {
514 return false;
515 }
516
517 QFunctionPointer setWmWallpaperParameter = Q_NULLPTR;
518
519 #if QT_VERSION >= QT_VERSION_CHECK(5, 4, 0)
520 setWmWallpaperParameter = qApp->platformFunction(_setWmWallpaperParameter);
521 #endif
522
523 if (!setWmWallpaperParameter) {
524 qWarning("setWindowWallpaperParaByWM is not support");
525
526 return false;
527 }
528
529 QSurfaceFormat format = m_window->format();
530
531 format.setAlphaBufferSize(8);
532 m_window->setFormat(format);
533
534 quint32 bMode = sMode | fMode;
535
536 // 激活 backing store
537 m_window->setProperty("_d_dxcb_wallpaper", QVariant::fromValue(QPair<QRect, int>(area, bMode)));
538
539 if (!m_window->handle()) {
540 return true;
541 } else {
542 qWarning() << "because the window handle has been created, so 2D mode will have no effect";
543 }
544
545 const qreal device_ratio = m_window->devicePixelRatio();
546 if (qFuzzyCompare(device_ratio, 1.0) || !area.isValid()) {
547 return reinterpret_cast<bool(*)(const quint32, const QRect&, const quint32)>(setWmWallpaperParameter)(m_window->winId(), area, bMode);
548 }
549
550 QRect new_area(area.x() * device_ratio,
551 area.y() * device_ratio,
552 area.width() * device_ratio,
553 area.height() * device_ratio);
554
555 return reinterpret_cast<bool(*)(const quint32, const QRect&, const quint32)>(setWmWallpaperParameter)(m_window->winId(), new_area, bMode);
556 }
557
558 void DXCBPlatformWindowInterface::setDisableWindowOverrideCursor(bool disable)
559 {
560 m_window->setProperty(_disableOverrideCursor, disable);
561 }
562
563 int DXCBPlatformWindowInterface::windowRadius() const
564 {
565 return m_window->property(_windowRadius).toInt();
566 }
567
568 void DXCBPlatformWindowInterface::setWindowRadius(int windowRadius)
569 {
570 setWindowProperty(m_window, _windowRadius, windowRadius);
571 resolve(m_window, PropRole::WindowRadius);
572 }
573
574 int DXCBPlatformWindowInterface::borderWidth() const
575 {
576 return m_window->property(_borderWidth).toInt();
577 }
578
579 void DXCBPlatformWindowInterface::setBorderWidth(int borderWidth)
580 {
581 setWindowProperty(m_window, _borderWidth, borderWidth);
582 }
583
584 QColor DXCBPlatformWindowInterface::borderColor() const
585 {
586 return qvariant_cast<QColor>(m_window->property(_borderColor));
587 }
588
589 void DXCBPlatformWindowInterface::setBorderColor(const QColor &borderColor)
590 {
591 setWindowProperty(m_window, _borderColor, QVariant::fromValue(borderColor));
592 }
593
594 int DXCBPlatformWindowInterface::shadowRadius() const
595 {
596 return m_window->property(_shadowRadius).toInt();
597 }
598
599 void DXCBPlatformWindowInterface::setShadowRadius(int shadowRadius)
600 {
601 setWindowProperty(m_window, _shadowRadius, shadowRadius);
602 }
603
604 QPoint DXCBPlatformWindowInterface::shadowOffset() const
605 {
606 return m_window->property(_shadowOffset).toPoint();
607 }
608
609 void DXCBPlatformWindowInterface::setShadowOffset(const QPoint &shadowOffset)
610 {
611 setWindowProperty(m_window, _shadowOffset, shadowOffset);
612 }
613
614 QColor DXCBPlatformWindowInterface::shadowColor() const
615 {
616 return qvariant_cast<QColor>(m_window->property(_shadowColor));
617 }
618
619 void DXCBPlatformWindowInterface::setShadowColor(const QColor &shadowColor)
620 {
621 setWindowProperty(m_window, _shadowColor, QVariant::fromValue(shadowColor));
622 }
623
624 DPlatformHandle::EffectScene DXCBPlatformWindowInterface::windowEffect()
625 {
626 return qvariant_cast<DPlatformHandle::EffectScene>(m_window->property(_windowEffect));
627 }
628
629 void DXCBPlatformWindowInterface::setWindowEffect(DPlatformHandle::EffectScenes effectScene)
630 {
631 setWindowProperty(m_window, _windowEffect, static_cast<quint32>(effectScene));
632 }
633
634 DPlatformHandle::EffectType DXCBPlatformWindowInterface::windowStartUpEffect()
635 {
636 return qvariant_cast<DPlatformHandle::EffectType>(m_window->property(_windowStartUpEffect));
637 }
638
639 void DXCBPlatformWindowInterface::setWindowStartUpEffect(DPlatformHandle::EffectTypes effectType)
640 {
641 setWindowProperty(m_window, _windowStartUpEffect, static_cast<quint32>(effectType));
642 }
643
644 QPainterPath DXCBPlatformWindowInterface::clipPath() const
645 {
646 return qvariant_cast<QPainterPath>(m_window->property(_clipPath));
647 }
648
649 void DXCBPlatformWindowInterface::setClipPath(const QPainterPath &clipPath)
650 {
651 setWindowProperty(m_window, _clipPath, QVariant::fromValue(clipPath));
652 }
653
654 QRegion DXCBPlatformWindowInterface::frameMask() const
655 {
656 return qvariant_cast<QRegion>(m_window->property(_frameMask));
657 }
658
659 void DXCBPlatformWindowInterface::setFrameMask(const QRegion &frameMask)
660 {
661 setWindowProperty(m_window, _frameMask, QVariant::fromValue(frameMask));
662 }
663
664 QMargins DXCBPlatformWindowInterface::frameMargins() const
665 {
666 return qvariant_cast<QMargins>(m_window->property(_frameMargins));
667 }
668
669 bool DXCBPlatformWindowInterface::translucentBackground() const
670 {
671 return m_window->property(_translucentBackground).toBool();
672 }
673
674 void DXCBPlatformWindowInterface::setTranslucentBackground(bool translucentBackground)
675 {
676 setWindowProperty(m_window, _translucentBackground, translucentBackground);
677 }
678
679 bool DXCBPlatformWindowInterface::enableSystemResize() const
680 {
681 return m_window->property(_enableSystemResize).toBool();
682 }
683
684 void DXCBPlatformWindowInterface::setEnableSystemResize(bool enableSystemResize)
685 {
686 setWindowProperty(m_window, _enableSystemResize, enableSystemResize);
687 }
688
689 bool DXCBPlatformWindowInterface::enableSystemMove() const
690 {
691 return m_window->property(_enableSystemMove).toBool();
692 }
693
694 void DXCBPlatformWindowInterface::setEnableSystemMove(bool enableSystemMove)
695 {
696 setWindowProperty(m_window, _enableSystemMove, enableSystemMove);
697 }
698
699 bool DXCBPlatformWindowInterface::enableBlurWindow() const
700 {
701 return m_window->property(_enableBlurWindow).toBool();
702 }
703
704 void DXCBPlatformWindowInterface::setEnableBlurWindow(bool enableBlurWindow)
705 {
706 setWindowProperty(m_window, _enableBlurWindow, enableBlurWindow);
707 }
708
709 bool DXCBPlatformWindowInterface::autoInputMaskByClipPath() const
710 {
711 return m_window->property(_autoInputMaskByClipPath).toBool();
712 }
713
714 void DXCBPlatformWindowInterface::setAutoInputMaskByClipPath(bool autoInputMaskByClipPath)
715 {
716 setWindowProperty(m_window, _autoInputMaskByClipPath, autoInputMaskByClipPath);
717 }
718
719 WId DXCBPlatformWindowInterface::realWindowId() const
720 {
721 return qvariant_cast<WId>(m_window->property("_d_real_content_window"));
722 }
723
724 DGUI_END_NAMESPACE