Skip to content

Commit

Permalink
louvre-views: Exclude cursor from zoomed view
Browse files Browse the repository at this point in the history
  • Loading branch information
ehopperdietzel committed Sep 7, 2024
1 parent 5d9b797 commit 99faf58
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 24 deletions.
7 changes: 0 additions & 7 deletions src/backends/graphic/DRM/LGraphicBackendDRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -318,13 +318,6 @@ void *LGraphicBackend::backendGetContextHandle()

bool LGraphicBackend::backendInitialize()
{
/* There seem to be issues with the atomic DRM API,
* especially when dealing with cursor planes. This could
* be due to drivers not handling multithreading properly.
* Since Louvre doesn't support overlay planes yet, let's
* fall back to using the legacy API by default. */
setenv("SRM_FORCE_LEGACY_API", "1", 0);

libseatEnabled = compositor()->seat()->imp()->initLibseat();

struct stat stat;
Expand Down
18 changes: 3 additions & 15 deletions src/examples/louvre-views/src/Output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ Output::Output(const void *params) noexcept : LOutput(params)
zoomScene.enableParentOffset(false);
zoomView.enableDstSize(true);
zoomView.setTranslucentRegion(&LRegion::EmptyRegion());
zoomCursor.enableParentOffset(false);
zoomCursor.enableDstSize(true);

workspacesContainer.enableParentOffset(false);
workspacesContainer.setPos(0, 0);
Expand Down Expand Up @@ -676,10 +674,9 @@ void Output::zoomedDrawBegin() noexcept
zoomScene.setSizeB(sizeB() * zoom);
zoomScene.setScale(scale());

LPointF cursorPos { floorf(cursor()->pos().x()), floorf(cursor()->pos().y()) };
LPointF outputRelativeCursorPos { cursorPos - LPointF(pos()) };
LPointF outputNormalizedCursorPos { outputRelativeCursorPos / LSizeF(size()) };
LPoint newPos { cursorPos - (LSizeF(zoomScene.nativeSize()) * outputNormalizedCursorPos) };
const LPointF outputRelativeCursorPos { cursor()->pos() - LPointF(pos()) };
const LPointF outputNormalizedCursorPos { outputRelativeCursorPos / LSizeF(size()) };
LPoint newPos { cursor()->pos() - (LSizeF(zoomScene.nativeSize()) * outputNormalizedCursorPos) };

/* Prevent capturing stuff outside the output */

Expand All @@ -697,14 +694,6 @@ void Output::zoomedDrawBegin() noexcept

/* Render views and the cursor manually into the zoom scene */
G::compositor()->rootView.setParent(&zoomScene);
cursor()->enable(this, false);
if (cursor()->visible())
{
zoomCursor.setTexture(cursor()->texture());
zoomCursor.setDstSize(cursor()->rect().size());
zoomCursor.setPos(cursor()->rect().pos());
zoomCursor.setParent(&zoomScene);
}
zoomScene.render();

/* Use an LTextureView to show the result scaled to the output size */
Expand All @@ -720,7 +709,6 @@ void Output::zoomedDrawEnd() noexcept
/* Return everything to its place */
G::compositor()->rootView.setParent(G::scene()->mainView());
zoomView.setParent(nullptr);
zoomCursor.setParent(nullptr);
zoomScene.setParent(nullptr);
G::scene()->enableAutoRepaint(true);
}
Expand Down
2 changes: 0 additions & 2 deletions src/examples/louvre-views/src/Output.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,6 @@ class Output final : public LOutput
Float32 zoom { 1.f };
LSceneView zoomScene { LSize(0, 0), 1.f };
LTextureView zoomView;
LTextureView zoomCursor;

};

#endif // OUTPUT_H
2 changes: 2 additions & 0 deletions src/examples/louvre-views/src/Toplevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ Toplevel::Toplevel(const void *params) : LToplevelRole(params),
captureView.setBufferScale(2);
captureView.enableParentOpacity(false);
captureView.enableDstSize(true);
captureView.enablePointerEvents(true);
captureView.setInputRegion(nullptr);

resizeSession().setMinSize(LSize(150, 150));
}
Expand Down

0 comments on commit 99faf58

Please sign in to comment.