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
17 changes: 5 additions & 12 deletions src/core/lockscreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

#ifdef EXT_SESSION_LOCK_V1
#include "rootsurfacecontainer.h"
#include "surfacewrapper.h"

Check warning on line 17 in src/core/lockscreen.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: "surfacewrapper.h" not found.

#include <wcursor.h>
#include <wsessionlock.h>

Check warning on line 19 in src/core/lockscreen.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wsessionlock.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <wsessionlocksurface.h>

Check warning on line 20 in src/core/lockscreen.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <wsessionlocksurface.h> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#endif

WAYLIB_SERVER_USE_NAMESPACE
Expand All @@ -37,12 +36,13 @@

// The global login view is lazily created when this container becomes
// visible (locked) and destroyed when it hides (unlocked). Track the
// cursor so the login UI follows the output the mouse is on.
// output under the cursor so the login UI follows the mouse without
// recomputing the output on every cursor motion.
connect(this, &QQuickItem::visibleChanged, this, &LockScreen::onLoginViewVisibleChanged);
connect(rootContainer()->cursor(),
&WCursor::positionChanged,
connect(rootContainer(),
&RootSurfaceContainer::cursorOutputChanged,
this,
&LockScreen::onCursorPositionChanged);
&LockScreen::repositionLoginView);
}

void LockScreen::lock()
Expand Down Expand Up @@ -243,13 +243,6 @@
m_loginView->setWidth(size.width());
m_loginView->setHeight(size.height());
}

void LockScreen::onCursorPositionChanged()
{
if (m_loginView) {
repositionLoginView();
}
}
#if EXT_SESSION_LOCK_V1
// ext_session_lock_v1 capabilities

Expand Down
1 change: 0 additions & 1 deletion src/core/lockscreen.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ private Q_SLOTS:
void createLoginView();
void destroyLoginView();
void repositionLoginView();
void onCursorPositionChanged();
Output *followerOutput() const;

ILockScreen *m_impl{ nullptr };
Expand Down
16 changes: 15 additions & 1 deletion src/core/rootsurfacecontainer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ void RootSurfaceContainer::init(WServer *server)
output->updatePositionFromLayout();
}
ensureCursorVisible();
// The layout may have moved/removed the output under the cursor, so
// refresh the cache even without a cursor motion event.
updateCursorOutput();

// for (auto s : m_surfaceContainer->surfaces()) {
// ensureSurfaceNormalPositionValid(s);
Expand All @@ -101,6 +104,7 @@ void RootSurfaceContainer::init(WServer *server)

QObject::connect(m_cursor, &WCursor::positionChanged, this, [this] {
m_dragSurfaceItem->setPosition(m_cursor->position());
updateCursorOutput();
});

QObject::connect(m_cursor, &WCursor::requestedDragSurfaceChanged, this, [this] {
Expand Down Expand Up @@ -387,7 +391,17 @@ WCursor *RootSurfaceContainer::cursor() const
Output *RootSurfaceContainer::cursorOutput() const
{
Q_ASSERT(m_cursor->layout() == m_outputLayout);
return outputAt(m_cursor->position());
return m_cursorOutput;
}

void RootSurfaceContainer::updateCursorOutput()
{
Output *output = outputAt(m_cursor->position());
if (output == m_cursorOutput)
return;

m_cursorOutput = output;
Q_EMIT cursorOutputChanged(output);
}

Output *RootSurfaceContainer::outputAt(const QPointF &pos) const
Expand Down
3 changes: 3 additions & 0 deletions src/core/rootsurfacecontainer.h
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ public Q_SLOTS:

Q_SIGNALS:
void primaryOutputChanged();
void cursorOutputChanged(Output *output);
void moveResizeFinised(SurfaceWrapper *surface);

private:
Expand All @@ -138,6 +139,7 @@ public Q_SLOTS:
[[maybe_unused]] SurfaceWrapper::State oldState) override;

void ensureCursorVisible();
void updateCursorOutput();
void updateSurfaceOutputs(SurfaceWrapper *surface);
QQuickItem *ensureEdgeTilePreview();
void onSeatAdded(WSeat *seat);
Expand All @@ -150,6 +152,7 @@ public Q_SLOTS:
std::unique_ptr<WAYLIB_SERVER_NAMESPACE::WListenerOwner> m_outputLayoutListenerOwner;
OutputListModel *m_outputModel = nullptr;
QPointer<Output> m_primaryOutput;
QPointer<Output> m_cursorOutput;
WCursor *m_cursor = nullptr;
WSurfaceItem *m_dragSurfaceItem = nullptr;
QPointer<QQuickItem> m_edgeTilePreview;
Expand Down
Loading