Skip to content
Open
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
1 change: 1 addition & 0 deletions .agents/skills/logging-guidelines/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ waylib
│ ├── waylib.qtquick.surface lcWlSurface
│ ├── waylib.qtquick.texture lcWlQtQuickTexture
│ ├── waylib.renderer lcWlRenderer
│ ├── waylib.renderer.damage lcWlDamage
│ └── waylib.qtquick.bufferitem lcWlBufferItem
├── Utils
│ ├── waylib.utils.imagecapture lcWlImageCapture
Expand Down
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ ColumnLimit: 100
# Disable reflow of some specific comments
# qdoc comments: indentation rules are different.
# Translation comments and SPDX license identifiers are also excluded.
# REUSE-IgnoreStart
CommentPragmas: "^!|^:|^ SPDX-License-Identifier:"
# REUSE-IgnoreEnd

PointerAlignment: Right

Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,6 @@ Testing/Temporary/

# codegraph index
.codegraph/

# generated damage playground dumps
waylib/tests/manual/damage/reports/
5 changes: 4 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ ctest --preset ci
- Avoid complex lambdas; if a lambda body grows beyond a few lines, extract it into a named member function.
- Keep diffs minimal: touch only task-related files and symbols.
- Avoid broad refactors, unrelated renames, and unrelated reformatting.
- New source files must include an SPDX line consistent with this repo, typically `SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only`.
- New source files must include an SPDX line consistent with this repo, typically:
<!-- REUSE-IgnoreStart -->
`SPDX-License-Identifier: Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only`.
<!-- REUSE-IgnoreEnd -->
- Logging changes must use `.agents/skills/logging-guidelines/SKILL.md`.
- If real task work shows that a repo-local skill is wrong, outdated, or incomplete, update the skill proactively instead of preserving known-bad guidance.

Expand Down
1 change: 1 addition & 0 deletions debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ Build-Depends: cmake (>= 3.25.0),
libxcb-xfixes0-dev,
libxcb-xinput-dev,
pkg-config,
qml6-module-qtquick-controls,
qml6-module-qtquick-templates,
qml6-module-qtquick-effects,
qt6-base-dev (>= 6.8.0),
Expand Down
18 changes: 17 additions & 1 deletion src/core/qml/Effects/Blur.qml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,25 @@ RenderBufferBlitter {
property Item effectContent: contentLoader
property bool contentOffscreen: false
property bool effectEnabled: true
// Geometric slope cap fed to the glass shader (refractionMaxTan) and to
// damageExpansion below. Single source so the two can never desync.
property real refractionMaxTan: 3.3

z: parent.z ? parent.z - 1 : -1
anchors.fill: parent
// Worst-case backdrop margin: the full MultiEffect pyramid radius at
// blur 1.0 (blurMax scaled by blurMultiplier) plus the Liquid Glass
// refraction reach min(bezel * 0.85, thickness * 0.75), capped at 48px
// (maxDisp in liquidglass.frag). blurAmount animates, so the margin must
// not shrink with it; glass refracts even at blurAmount 0.
damageExpansion: (blurMax > 0
? Math.ceil(blurMax * (1 + Math.max(multiplier, 0)))
: 0)
+ (glassEnabled
? Math.max(2, Math.ceil(Math.min(Math.min(Helper.config.glassBezel * 0.85,
Helper.config.glassThickness * 0.75),
48) * Math.max(refractionMaxTan / 2.75, 1)))
: 0)

// Dispatch between Liquid Glass and traditional blur via a Loader so only
// the active branch is instantiated. Toggling the DConfig key unloads one
Expand Down Expand Up @@ -60,7 +76,7 @@ RenderBufferBlitter {
saturation: blitter.saturation
contentEdgePull: 0.0
contentRampEnd: 0.0
refractionMaxTan: 3.3
refractionMaxTan: blitter.refractionMaxTan
profilePower: Helper.config.glassProfilePower
innerShadow: 0.0
}
Expand Down
18 changes: 18 additions & 0 deletions src/core/qml/OutputMenuBar.qml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,24 @@ Item {
color: "red"
}

ToolButton {
text: "Damage"
onClicked: damageMenu.popup()

Menu {
id: damageMenu

MenuItem {
text: "Off"
onClicked: Helper.setDamageVisual("off")
}
MenuItem {
text: "Highlight"
onClicked: Helper.setDamageVisual("highlight")
}
}
}

ToolButton {
text: "Output"

Expand Down
2 changes: 2 additions & 0 deletions src/plugins/lockscreen/qml/ControlAction.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ RowLayout {
}

background: RoundBlur {
objectName: "sessionItemBlur"
radius: parent.width / 2
color: Qt.rgba(1.0, 1.0, 1.0, 0.3)
}
Expand Down Expand Up @@ -143,6 +144,7 @@ RowLayout {
anchors.centerIn: parent

background: RoundBlur {
objectName: actionItem.iconName + "Blur"
radius: parent.width / 2
color: Qt.rgba(1.0, 1.0, 1.0, 0.3)
}
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/lockscreen/qml/ShutdownButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ Button {

background: Item {
RoundBlur {
objectName: "shutdownBtnBlur"
anchors.fill: parent
radius: btn.width / 2
color: root.D.ColorSelector.backgroundColor
Expand Down Expand Up @@ -83,6 +84,7 @@ Button {
background: Item {
visible: root.pressed || root.hovered || root.activeFocus
RoundBlur {
objectName: "shutdownLabelBlur"
anchors.fill: parent
radius: 6
color: root.D.ColorSelector.backgroundColor
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/lockscreen/qml/UserInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ Item {
}

background: RoundBlur {
objectName: "passwordBlur"
color: Qt.rgba(1, 1, 1, 0.4)
radius: 6
}
Expand Down Expand Up @@ -270,6 +271,7 @@ Item {
enabled: passwordField.length != 0
font: D.DTK.fontManager.t8
background: RoundBlur {
objectName: "loginBtnBlur"
anchors.fill: parent
color: Qt.rgba(1.0, 1.0, 1.0, 0.4)
radius: parent.height / 2
Expand Down
29 changes: 29 additions & 0 deletions src/seat/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3366,6 +3366,35 @@ bool Helper::toggleDebugMenuBar()
return ok;
}

QString Helper::damageVisual() const
{
if (!m_renderWindow)
return QStringLiteral("off");
switch (m_renderWindow->damageVisual()) {
case WOutputRenderWindow::DamageVisual::Highlight:
return QStringLiteral("highlight");
case WOutputRenderWindow::DamageVisual::Off:
break;
}
return QStringLiteral("off");
}

bool Helper::setDamageVisual(const QString &mode)
{
if (!m_renderWindow)
return false;
const QString v = mode.trimmed().toLower();
WOutputRenderWindow::DamageVisual visual = WOutputRenderWindow::DamageVisual::Off;
if (v == QLatin1String("highlight") || v == QLatin1String("1")
|| v == QLatin1String("true") || v == QLatin1String("on"))
visual = WOutputRenderWindow::DamageVisual::Highlight;
else if (v != QLatin1String("off") && v != QLatin1String("none")
&& v != QLatin1String("0") && v != QLatin1String("false"))
return false;
m_renderWindow->setDamageVisual(visual);
return true;
}

ShowDesktopInterfaceV1::State Helper::showDesktopState() const
{
return m_showDesktop;
Expand Down
2 changes: 2 additions & 0 deletions src/seat/helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,8 @@ class Helper : public WSeatEventFilter, public WAYLIB_SERVER_NAMESPACE::WObject
void setCursorPosition(const QPointF &position);

bool toggleDebugMenuBar();
Q_INVOKABLE QString damageVisual() const;
Q_INVOKABLE bool setDamageVisual(const QString &mode);

ShowDesktopInterfaceV1::State showDesktopState() const;

Expand Down
7 changes: 6 additions & 1 deletion tests/protocols/drm/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include "seat/helper.h"
#include "surface/surfacewrapper.h"
#include "workspace/workspace.h"
#include "output/output.h"

#include <QEventLoop>
#include <QFutureWatcher>
Expand All @@ -17,6 +18,7 @@
#include <woutputrenderwindow.h>
#include <wsurfaceitem.h>
#include <wtextureproviderprovider.h>
#include <woutputviewport.h>

namespace {
SurfaceWrapper *g_wrapper = nullptr;
Expand Down Expand Up @@ -58,7 +60,10 @@ extern "C" void drm_read_render_state(void *data)
return;
}

renderWindow->render();
for (auto *output : Helper::instance()->rootSurfaceContainer()->outputs()) {
if (auto *vp = output->screenViewport())
vp->render(true);
}
WTextureCapturer capturer(content);
QFutureWatcher<QImage> watcher;
QEventLoop loop;
Expand Down
12 changes: 10 additions & 2 deletions tests/protocols/treeland-capture-desktop-v1/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@
#include "surface/surfacewrapper.h"
#include "treeland-capture-desktop-v1.h"
#include "workspace/workspace.h"
#include "output/output.h"

#include <wbackend.h>
#include <woutputrenderwindow.h>
#include <wsurfaceitem.h>
#include <woutputviewport.h>

namespace {
SurfaceWrapper *g_wrapper = nullptr;
Expand Down Expand Up @@ -72,7 +74,10 @@ extern "C" void capture_desktop_select_mapped_surface(void *data)

// Select the verified mapped production surface through the selector's
// production selection entry point.
helper->window()->render();
for (auto *output : helper->rootSurfaceContainer()->outputs()) {
if (auto *vp = output->screenViewport())
vp->render(true);
}
selector->selectSurface(content);
g_state.hovered_mapped_content = 1;

Expand All @@ -91,7 +96,10 @@ extern "C" void capture_desktop_select_mapped_surface(void *data)
extern "C" void capture_desktop_render_selected_source(void *data)
{
auto *helper = Helper::instance();
helper->window()->render();
for (auto *output : helper->rootSurfaceContainer()->outputs()) {
if (auto *vp = output->screenViewport())
vp->render(true);
}
g_state.render_requested = 1;
copyState(data);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@
#include "surface/surfacewrapper.h"
#include "treeland-foreign-toplevel-manager-v2.h"
#include "workspace/workspace.h"
#include "output/output.h"

#include <wbackend.h>
#include <woutputrenderwindow.h>
#include <woutputviewport.h>

#include <QEventLoop>
#include <QQuickItem>
Expand Down Expand Up @@ -107,7 +109,10 @@ extern "C" void ftm_render_and_settle(void *)
// The protocol request can be queued until the next scene-graph frame.
// Render first, then inspect the wrapper so we do not miss an animation
// created while processing that frame.
helper->window()->render();
for (auto *output : helper->rootSurfaceContainer()->outputs()) {
if (auto *vp = output->screenViewport())
vp->render(true);
}
if (!g_wrapper->isAnimationRunning())
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
#include "surface/surfacewrapper.h"
#include "wlr-foreign-toplevel-management-unstable-v1.h"
#include "workspace/workspace.h"
#include "output/output.h"

#include <woutputrenderwindow.h>
#include <woutputviewport.h>
#include <wbackend.h>
#include <wforeigntoplevelv1.h>

Expand Down Expand Up @@ -76,7 +78,10 @@ extern "C" void foreign_toplevel_render(void *)
if (!g_wrapper)
return;
auto *helper = Helper::instance();
helper->window()->render();
for (auto *output : helper->rootSurfaceContainer()->outputs()) {
if (auto *vp = output->screenViewport())
vp->render(true);
}
if (!g_wrapper->isAnimationRunning())
return;

Expand Down
2 changes: 2 additions & 0 deletions waylib/debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ Build-Depends: cmake,
libpixman-1-dev (>= 0.43.0),
libxcb-ewmh-dev,
pkg-config,
qml6-module-qtquick-controls,
qml6-module-qtquick-effects,
qml6-module-qtquick-templates,
qt6-base-dev-tools (>= 6.6.0),
qt6-base-private-dev (>= 6.6.0),
Expand Down
21 changes: 21 additions & 0 deletions waylib/src/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,15 @@ set(SOURCES
qtquick/private/wqmlhelper.cpp
qtquick/private/wbufferrenderer.cpp
qtquick/private/wrenderbuffernode.cpp
qtquick/scenegraph/wsgbatchrenderer.cpp
qtquick/scenegraph/wsgrhivisualizer.cpp
qtquick/scenegraph/wsgcontext.cpp
qtquick/scenegraph/wsgimagenode.cpp
qtquick/scenegraph/wsgdamagetracker.cpp
qtquick/scenegraph/wsgviewport.cpp
qtquick/scenegraph/wsgdamagenode.cpp
qtquick/scenegraph/wsgdamagelog.cpp
qtquick/wregionhighlightitem.cpp

${WAYLAND_PROTOCOLS_OUTPUTDIR}/text-input-unstable-v1-protocol.c
${WAYLAND_PROTOCOLS_OUTPUTDIR}/text-input-unstable-v2-protocol.c
Expand All @@ -170,6 +179,7 @@ set(SOURCES
${WAYLAND_PROTOCOLS_OUTPUTDIR}/xdg-shell-protocol.c

utils/wtools.cpp
utils/wpixmanregion.cpp
utils/wthreadutils.cpp
utils/wimagebuffer.cpp
utils/wcursorimage.cpp
Expand Down Expand Up @@ -277,6 +287,7 @@ set(HEADERS
qtquick/wsgtextureprovider.h
qtquick/wtextureproviderprovider.h
qtquick/wbufferitem.h
utils/wpixmanregion.h

utils/wtools.h
utils/wthreadutils.h
Expand Down Expand Up @@ -356,6 +367,14 @@ set(PRIVATE_HEADERS
qtquick/private/wbufferrenderer_p.h
qtquick/private/wrenderbuffernode_p.h
qtquick/private/wsurfaceitem_p.h
qtquick/scenegraph/wsgbatchrenderer_p.h
qtquick/scenegraph/wsgrhivisualizer_p.h
qtquick/scenegraph/wsgcontext_p.h
qtquick/scenegraph/wsgimagenode_p.h
qtquick/scenegraph/wsgdamagelog_p.h
qtquick/scenegraph/wsgdamagenode_p.h
qtquick/scenegraph/wsgdamagetracker_p.h
qtquick/scenegraph/wsgviewport_p.h

${WAYLAND_PROTOCOLS_OUTPUTDIR}/text-input-unstable-v1-protocol.h
${WAYLAND_PROTOCOLS_OUTPUTDIR}/text-input-unstable-v2-protocol.h
Expand Down Expand Up @@ -458,13 +477,15 @@ target_include_directories(${TARGET}
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/kernel>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/qtquick>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/qtquick/private>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/qtquick/scenegraph>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/utils>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/protocols>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/protocols/private>
${WAYLIB_WLROOTS_INCLUDE_DIRS}
$<INSTALL_INTERFACE:${WAYLIB_INCLUDE_INSTALL_DIR}>
PRIVATE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/qtquick/scenegraph>
${Qt6Gui_PRIVATE_INCLUDE_DIRS}
${Qt6Quick_PRIVATE_INCLUDE_DIRS}
${Qt6EglSupport_PRIVATE_INCLUDE_DIRS}
Expand Down
Loading
Loading