Skip to content

Commit

Permalink
feat: support configurable whether to redefine the window content whe…
Browse files Browse the repository at this point in the history
…n dxcb is turned on

Change-Id: I1f925640f11a579e184a1b7e7f85ff89b43764aa
  • Loading branch information
zccrs committed Jan 31, 2018
1 parent b4f5f4b commit 1cdf42f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/widgets/dplatformwindowhandle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ DWIDGET_BEGIN_NAMESPACE
#define DEFINE_CONST_CHAR(Name) const char _##Name[] = "_d_" #Name

DEFINE_CONST_CHAR(useDxcb);
DEFINE_CONST_CHAR(redirectContent);
DEFINE_CONST_CHAR(netWmStates);
DEFINE_CONST_CHAR(windowRadius);
DEFINE_CONST_CHAR(borderWidth);
Expand Down Expand Up @@ -158,6 +159,24 @@ void DPlatformWindowHandle::enableDXcbForWindow(QWindow *window)
}
}

void DPlatformWindowHandle::enableDXcbForWindow(QWidget *widget, bool redirectContent)
{
enableDXcbForWindow(widget);

if (isEnabledDXcb(widget)) {
widget->windowHandle()->setProperty(_redirectContent, redirectContent);
}
}

void DPlatformWindowHandle::enableDXcbForWindow(QWindow *window, bool redirectContent)
{
enableDXcbForWindow(window);

if (isEnabledDXcb(window)) {
window->setProperty(_redirectContent, redirectContent);
}
}

bool DPlatformWindowHandle::isEnabledDXcb(const QWidget *widget)
{
return widget->windowHandle() && widget->windowHandle()->property(_useDxcb).toBool();
Expand Down
2 changes: 2 additions & 0 deletions src/widgets/dplatformwindowhandle.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ class DPlatformWindowHandle : public QObject

static void enableDXcbForWindow(QWidget *widget);
static void enableDXcbForWindow(QWindow *window);
static void enableDXcbForWindow(QWidget *widget, bool redirectContent);
static void enableDXcbForWindow(QWindow *window, bool redirectContent);
static bool isEnabledDXcb(const QWidget *widget);
static bool isEnabledDXcb(const QWindow *window);

Expand Down

0 comments on commit 1cdf42f

Please sign in to comment.