Skip to content

Commit

Permalink
louvre-views: Toplevel windows with subsurfaces are now hidden, and t…
Browse files Browse the repository at this point in the history
…heir captures are displayed immediately during fullscreen animations. This change prevents visual glitches caused by clients updating subsurface sizes before acknowledging the toplevel configuration
  • Loading branch information
ehopperdietzel committed Aug 2, 2024
1 parent e89abf2 commit 0161772
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 22 deletions.
13 changes: 13 additions & 0 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
Louvre (2.4.1-1)

# Bug Fixes & Security

* DRM Backend: Added missing SRM version checks to prevent symbol resolution issues with older versions, thanks to @Silitonix.
* Added missing pointer focus checks in the default pointer button event implementation to securely handle cases where users unset it from indirectly triggered events.
* louvre-views: Fixed bug causing occasional unminimizing of toplevel windows when switching to the main workspace of an output.
* louvre-views: Fix bug causing compositor to get stuck in an infinite loop when associating Wayland clients with application PIDs, thanks to @panaflexx.
* louvre-views: Toplevel windows with subsurfaces are now hidden, and their captures are displayed immediately during fullscreen animations. This change prevents visual glitches caused by clients updating subsurface sizes before acknowledging the toplevel configuration.

-- Eduardo Hopperdietzel <ehopperdietzel@gmail.com> Fri, 01 Aug 2024 22:30:46 -0400


Louvre (2.4.0-1)

# API Additions
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="Louvre is released under the MIT license." />
</a>
<a href="https://github.com/CuarzoSoftware/Louvre">
<img src="https://img.shields.io/badge/version-2.4.0-brightgreen" alt="Current Louvre version." />
<img src="https://img.shields.io/badge/version-2.4.1-brightgreen" alt="Current Louvre version." />
</a>
</p>

Expand Down Expand Up @@ -40,7 +40,7 @@ Fortunately, Louvre simplifies this intricate process by handling all the comple
* Painter API and Scene System
* Multi-GPU Support
* Multi-Session Support
* Single, Double or Triple Buffering
* Double and Triple Buffering
* Persistent Clipboard
* Rootful XWayland (rootless mode is not yet supported, however, interesting projects such as [Wayland Transpositor](https://github.com/wayland-transpositor/wprs), [Wayland Proxy Virtwl](https://github.com/talex5/wayland-proxy-virtwl), and [Xwayland Satellite](https://github.com/Supreeeme/xwayland-satellite) can provide a rootless experience).

Expand Down Expand Up @@ -158,8 +158,9 @@ Similarly as with CPU consumption, we can observe that Louvre uses fewer GPU res
* Idle Notify Protocol
* Cursor Shape Protocol
* DRM Overlay Planes Control
* Rootless XWayland
* DRM Synchronization Object
* DRM Lease Protocol
* Rootless XWayland
* Tablet Events Protocol
* Virtual Keyboard Protocol
* Input Methods Protocol
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.4.0
2.4.1
2 changes: 1 addition & 1 deletion doxygen/md/Downloads.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Louvre relies on the following libraries:
* **EGL** >= 1.5.0
* **GLES 2.0** >= 13.0.6
* **DRM** >= 2.4.85
* **SRM** >= 0.6.0
* **SRM** >= 0.7.0
* **GBM** >= 22.2.0
* **Evdev** >= 1.5.6
* **Libinput** >= 1.6.3
Expand Down
17 changes: 15 additions & 2 deletions src/examples/louvre-views/src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ void Output::setWorkspace(Workspace *ws, UInt32 animMs, Float64 curve, Float64 s
for (Output *o : G::outputs())
o->workspaces.front()->stealChildren();

workspaceAnimationInFirstFrame = true;
workspacesAnimation.start();
onWorkspacesAnimationUpdate(&workspacesAnimation);
}

void Output::updateWorkspacesPos()
Expand Down Expand Up @@ -433,12 +435,21 @@ void Output::onWorkspacesAnimationUpdate(LAnimation *anim) noexcept

if (tl->fullscreen())
{
/*
* Quick Reminder:
*
* - captureView: Displays a capture of the toplevel and subsurfaces before going fullscreen.
* - animScene: Blits the current state of the toplevel and subsurfaces into a texture (can change
* each frame, e.g., if it is a web browser displaying a video).
* - animView: Displays the animScene result.
*/

Float32 val = 1.f - pow(1.0 - linear, 4.0);
Float32 inv = 1.f - val;
tl->animView.enableSrcRect(false);
tl->animView.setVisible(true);

if (toplevelOrSubsurfacesHaveNewDamage(tl->surf()))
if (toplevelOrSubsurfacesHaveNewDamage(tl->surf()) || workspaceAnimationInFirstFrame)
tl->animScene->render();

tl->animView.setTexture(tl->animScene->texture());
Expand Down Expand Up @@ -474,7 +485,7 @@ void Output::onWorkspacesAnimationUpdate(LAnimation *anim) noexcept
else
tl->surf()->setPos(tl->windowGeometry().pos());

if (toplevelOrSubsurfacesHaveNewDamage(tl->surf()))
if (toplevelOrSubsurfacesHaveNewDamage(tl->surf()) || workspaceAnimationInFirstFrame)
tl->animScene->render();

LRegion transReg;
Expand All @@ -500,6 +511,8 @@ void Output::onWorkspacesAnimationUpdate(LAnimation *anim) noexcept
tl->decoratedView->updateGeometry();
}

workspaceAnimationInFirstFrame = false;

if (linear == 1.0)
anim->stop();
}
Expand Down
1 change: 1 addition & 0 deletions src/examples/louvre-views/src/Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ class Output final : public LOutput
Float64 animStartOffset { 0.0 };
Float64 animEasingCurve { 2.0 };
LWeak<Toplevel> animatedFullscreenToplevel;
bool workspaceAnimationInFirstFrame { true };
bool doingFingerWorkspaceSwipe { false };

Topbar topbar { this };
Expand Down
25 changes: 17 additions & 8 deletions src/examples/louvre-views/src/Toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -184,16 +184,14 @@ void Toplevel::maximizedChanged()

void Toplevel::setFullscreenRequest(LOutput *output)
{
Surface *surf = (Surface*)surface();

if (surf->firstMap)
if (surf()->firstMap)
{
requestedFullscreenOnFirstMap = true;
return;
}

// Already in fullscreen mode
if (animScene || fullscreen() || !surf)
if (animScene || fullscreen() || !surf())
return;

Output *dstOutput;
Expand Down Expand Up @@ -223,15 +221,26 @@ void Toplevel::setFullscreenRequest(LOutput *output)
configureSize(dstRect.size());
configureState(Activated | Fullscreen);

LBox box = surf->getView()->boundingBox();
LBox box = surf()->getView()->boundingBox();
prevBoundingRect = LRect(box.x1,
box.y1,
box.x2 - box.x1,
box.y2 - box.y1);

captureTexture.reset(surf->renderThumbnail(&captureTransRegion));
captureTexture.reset(surf()->renderThumbnail(&captureTransRegion));
captureView.setTexture(captureTexture.get());
captureView.setPos(- windowGeometry().pos().x(), - windowGeometry().pos().y());

if (!surf()->children().empty())
{
captureView.setPos(prevBoundingRect.pos());
captureView.setDstSize(prevBoundingRect.size());
captureView.setParent(&G::compositor()->overlayLayer);
captureView.setOpacity(1.f);
captureView.setVisible(true);
captureView.setTranslucentRegion(&captureTransRegion);
G::reparentWithSubsurfaces(surf(), nullptr, true);
surf()->requestNextFrame(false);
}
}

void Toplevel::unsetFullscreenRequest()
Expand Down Expand Up @@ -437,7 +446,7 @@ void Toplevel::unsetFullscreen()
if (decoratedView)
decoratedView->updateGeometry();

animScene = std::make_unique<LSceneView>(fullscreenOutput->sizeB() * 1.0, 1.0);//fullscreenOutput->scale());
animScene = std::make_unique<LSceneView>(fullscreenOutput->sizeB(), fullscreenOutput->scale());
animScene->setPos(fullscreenOutput->pos());
G::reparentWithSubsurfaces(surf(), animScene.get(), true);
fullscreenOutput->animatedFullscreenToplevel = this;
Expand Down
14 changes: 8 additions & 6 deletions src/examples/louvre-views/src/ToplevelView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,20 +378,22 @@ void ToplevelView::updateTitle()
return;

Int32 maxWidth = (toplevel->windowGeometry().w() - 128) * 2;
std::string newClippedTitle { G::font()->semibold->clipText(toplevel->title().c_str(), 28, maxWidth, unclippedTitleBufferSize).c_str() };
std::string newClippedTitle { G::font()->semibold->clipText(toplevel->title().c_str(), 28, maxWidth, unclippedTitleBufferSize) };

if (newClippedTitle == prevClippedTitle)
return;

prevClippedTitle = std::move(newClippedTitle);

if (title.texture())
LTexture *newTitle { G::font()->semibold->renderText(prevClippedTitle.c_str(), 28, -1) };

if (newTitle)
{
delete title.texture();
title.setTexture(G::font()->semibold->renderText(prevClippedTitle.c_str(), 28, -1));
if (title.texture())
delete title.texture();

title.setTexture(newTitle);
}
else
title.setTexture(G::font()->semibold->renderText(prevClippedTitle.c_str(), 28, -1));

updateGeometry();
}
Expand Down
2 changes: 1 addition & 1 deletion src/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ drm_dep = dependency('libdrm')
gbm_dep = dependency('gbm')
input_dep = dependency('libinput')
libseat_dep = dependency('libseat')
srm_dep = dependency('SRM', version : '>=0.6.1')
srm_dep = dependency('SRM', version : '>=0.7.0')
pthread_dep = cpp.find_library('pthread')
dl_dep = cpp.find_library('dl')

Expand Down

0 comments on commit 0161772

Please sign in to comment.