Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/modules/ddm/ddminterfacev1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,21 @@ static void deactivateSession([[maybe_unused]] struct wl_client *client, [[maybe
Helper::instance()->deactivateSession();
}

static void enableRender([[maybe_unused]] struct wl_client *client, [[maybe_unused]] struct wl_resource *resource) {
Helper::instance()->enableRender();
}

static void disableRender([[maybe_unused]] struct wl_client *client, [[maybe_unused]] struct wl_resource *resource) {
Helper::instance()->disableRender();
}

static const struct treeland_ddm_interface treeland_ddm_impl {
.switch_to_greeter = switchToGreeter,
.switch_to_user = switchToUser,
.activate_session = activateSession,
.deactivate_session = deactivateSession,
.enable_render = enableRender,
Comment thread
calsys456 marked this conversation as resolved.
.disable_render = disableRender,
};

// wayland object binding
Expand Down
8 changes: 8 additions & 0 deletions src/seat/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2160,3 +2160,11 @@ void Helper::deactivateSession() {
if (m_backend->isSessionActive())
m_backend->deactivateSession();
}

void Helper::enableRender() {
m_renderWindow->setRenderEnabled(true);
}

void Helper::disableRender() {
m_renderWindow->setRenderEnabled(false);
}
2 changes: 2 additions & 0 deletions src/seat/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ class Helper : public WSeatEventFilter

void activateSession();
void deactivateSession();
void enableRender();
void disableRender();
public Q_SLOTS:
void activateSurface(SurfaceWrapper *wrapper, Qt::FocusReason reason = Qt::OtherFocusReason);
void forceActivateSurface(SurfaceWrapper *wrapper,
Expand Down
9 changes: 9 additions & 0 deletions waylib/src/server/qtquick/woutputrenderwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@ class Q_DECL_HIDDEN WOutputRenderWindowPrivate : public QQuickWindowPrivate

bool componentCompleted = true;
bool inRendering = false;
bool renderEnabled = true;

QPointer<qw_renderer> m_renderer;
QPointer<qw_allocator> m_allocator;
Expand Down Expand Up @@ -1475,6 +1476,9 @@ void WOutputRenderWindowPrivate::doRender(const QList<OutputHelper *> &outputs,
{
Q_ASSERT(rendererList.isEmpty());
Q_ASSERT(!inRendering);
if (!renderEnabled)
return;

inRendering = true;

W_Q(WOutputRenderWindow);
Expand Down Expand Up @@ -1816,6 +1820,11 @@ bool WOutputRenderWindow::inRendering() const
return d->inRendering;
}

void WOutputRenderWindow::setRenderEnabled(bool enabled) {
Q_D(WOutputRenderWindow);
d->renderEnabled = enabled;
}

QList<QPointer<QQuickItem>> WOutputRenderWindow::paintOrderItemList(QQuickItem *root, std::function<bool(QQuickItem*)> filter)
{
QStack<QQuickItem *> nodes;
Expand Down
2 changes: 2 additions & 0 deletions waylib/src/server/qtquick/woutputrenderwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ class WAYLIB_SERVER_EXPORT WOutputRenderWindow : public QQuickWindow, public QQm
WBufferRenderer *currentRenderer() const;
bool inRendering() const;

void setRenderEnabled(bool enabled);

static QList<QPointer<QQuickItem>> paintOrderItemList(QQuickItem *root, std::function<bool(QQuickItem*)> filter);

bool disableLayers() const;
Expand Down