Compare commits

..

2 commits

Author SHA1 Message Date
9f40dc905e fix: chase hl on various pointer changes
1309b59f2c
efc51eb7d1
5f60fc7d00
2025-03-18 19:09:13 +01:00
Gilang ramadhan
c6473ac2db
fix: failed build with eventfd changes
6ffde36466

---------

Co-authored-by: Virt <41426325+VirtCode@users.noreply.github.com>
2025-03-18 17:56:07 +01:00
6 changed files with 25 additions and 20 deletions

View file

@ -14,6 +14,9 @@ commit_pins = [
["788ae588979c2a1ff8a660f16e3c502ef5796755", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.0 ["788ae588979c2a1ff8a660f16e3c502ef5796755", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.0
["254fc2bc6000075f660b4b8ed818a6af544d1d64", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.1 ["254fc2bc6000075f660b4b8ed818a6af544d1d64", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.1
["0bd541f2fd902dbfa04c3ea2ccf679395e316887", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.2 ["0bd541f2fd902dbfa04c3ea2ccf679395e316887", "111669a699f998b5eb5a0d5610b5fcb748aab038"], # v0.46.2
["04ac46c54357278fc68f0a95d26347ea0db99496", "261bc1668f7de45b48ba6a40d5d727025575390b"], # v0.47.0
["75dff7205f6d2bd437abfb4196f700abee92581a", "261bc1668f7de45b48ba6a40d5d727025575390b"], # v0.47.1
["882f7ad7d2bbfc7440d0ccaef93b1cdd78e8e3ff", "261bc1668f7de45b48ba6a40d5d727025575390b"], # v0.47.2
] ]
[dynamic-cursors] [dynamic-cursors]

View file

@ -6,6 +6,7 @@
#include <gbm.h> #include <gbm.h>
#include <hyprland/src/managers/eventLoop/EventLoopTimer.hpp> // required so we don't "unprivate" chrono #include <hyprland/src/managers/eventLoop/EventLoopTimer.hpp> // required so we don't "unprivate" chrono
#include <hyprutils/utils/ScopeGuard.hpp>
#define private public #define private public
#include <hyprland/src/managers/CursorManager.hpp> #include <hyprland/src/managers/CursorManager.hpp>
@ -127,8 +128,6 @@ void CDynamicCursors::renderSoftware(CPointerManager* pointers, SP<CMonitor> pMo
CCursorPassElement::SRenderData data; CCursorPassElement::SRenderData data;
data.tex = texture; data.tex = texture;
data.box = box; data.box = box;
data.syncTimeline = pointers->currentCursorImage.waitTimeline;
data.syncPoint = pointers->currentCursorImage.waitPoint;
data.hotspot = pointers->currentCursorImage.hotspot * state->monitor->scale * zoom; data.hotspot = pointers->currentCursorImage.hotspot * state->monitor->scale * zoom;
data.nearest = nearest; data.nearest = nearest;
data.stretchAngle = resultShown.stretch.angle; data.stretchAngle = resultShown.stretch.angle;
@ -203,8 +202,12 @@ SP<Aquamarine::IBuffer> CDynamicCursors::renderHardware(CPointerManager* pointer
if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || state->monitor->cursorSwapchain->currentOptions().length != 3) { if (!state->monitor->cursorSwapchain || maxSize != state->monitor->cursorSwapchain->currentOptions().size || state->monitor->cursorSwapchain->currentOptions().length != 3) {
if (!state->monitor->cursorSwapchain) if (!state->monitor->cursorSwapchain) {
state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(state->monitor->output->getBackend()->preferredAllocator(), state->monitor->output->getBackend()); auto backend = state->monitor->output->getBackend();
auto primary = backend->getPrimary();
state->monitor->cursorSwapchain = Aquamarine::CSwapchain::create(state->monitor->output->getBackend()->preferredAllocator(), primary ? primary.lock() : backend);
}
auto options = state->monitor->cursorSwapchain->currentOptions(); auto options = state->monitor->cursorSwapchain->currentOptions();
options.size = maxSize; options.size = maxSize;
@ -265,7 +268,7 @@ SP<Aquamarine::IBuffer> CDynamicCursors::renderHardware(CPointerManager* pointer
xbox.rot = resultShown.rotation; xbox.rot = resultShown.rotation;
// use our custom draw function // use our custom draw function
renderCursorTextureInternalWithDamage(texture, &xbox, damage, 1.F, pointers->currentCursorImage.waitTimeline, pointers->currentCursorImage.waitPoint, pointers->currentCursorImage.hotspot * state->monitor->scale * zoom, zoom > 1 && **PNEAREST, resultShown.stretch.angle, resultShown.stretch.magnitude); renderCursorTextureInternalWithDamage(texture, &xbox, damage, 1.F, pointers->currentCursorImage.hotspot * state->monitor->scale * zoom, zoom > 1 && **PNEAREST, resultShown.stretch.angle, resultShown.stretch.magnitude);
g_pHyprOpenGL->end(); g_pHyprOpenGL->end();
glFlush(); glFlush();
@ -303,8 +306,11 @@ bool CDynamicCursors::setHardware(CPointerManager* pointers, SP<CPointerManager:
state->cursorFrontBuffer = buf; state->cursorFrontBuffer = buf;
if (!state->monitor->shouldSkipScheduleFrameOnMouseEvent())
g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE); g_pCompositor->scheduleFrameForMonitor(state->monitor.lock(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE);
state->monitor->scanoutNeedsCursorUpdate = true;
return true; return true;
} }
@ -337,11 +343,18 @@ void CDynamicCursors::onCursorMoved(CPointerManager* pointers) {
recalc = true; recalc = true;
} }
if (state->hardwareFailed || !state->entered) if (!state->entered)
continue;
Hyprutils::Utils::CScopeGuard x([m] { m->onCursorMovedOnMonitor(); });
if (state->hardwareFailed)
continue; continue;
const auto CURSORPOS = pointers->getCursorPosForMonitor(m); const auto CURSORPOS = pointers->getCursorPosForMonitor(m);
m->output->moveCursor(CURSORPOS); m->output->moveCursor(CURSORPOS);
state->monitor->scanoutNeedsCursorUpdate = true;
} }
if (recalc) if (recalc)

View file

@ -17,8 +17,6 @@ void CCursorPassElement::draw(const CRegion& damage) {
&data.box, &data.box,
data.damage.empty() ? damage : data.damage, data.damage.empty() ? damage : data.damage,
1.F, 1.F,
data.syncTimeline,
data.syncPoint,
data.hotspot, data.hotspot,
data.nearest, data.nearest,
data.stretchAngle, data.stretchAngle,

View file

@ -13,8 +13,6 @@ class CCursorPassElement : public IPassElement {
SP<CTexture> tex; SP<CTexture> tex;
CBox box; CBox box;
CRegion damage; CRegion damage;
SP<CSyncTimeline> syncTimeline;
int64_t syncPoint = 0;
Vector2D hotspot; Vector2D hotspot;
bool nearest; bool nearest;

View file

@ -52,16 +52,9 @@ Mat3x3 projectCursorBox(CBox& box, eTransform transform, float rotation, const M
/* /*
This renders a texture with damage but rotates the texture around a given hotspot. This renders a texture with damage but rotates the texture around a given hotspot.
*/ */
void renderCursorTextureInternalWithDamage(SP<CTexture> tex, CBox* pBox, const CRegion& damage, float alpha, SP<CSyncTimeline> waitTimeline, uint64_t waitPoint, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch) { void renderCursorTextureInternalWithDamage(SP<CTexture> tex, CBox* pBox, const CRegion& damage, float alpha, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch) {
TRACY_GPU_ZONE("RenderDynamicCursor"); TRACY_GPU_ZONE("RenderDynamicCursor");
if (waitTimeline != nullptr) {
if (!g_pHyprOpenGL->waitForTimelinePoint(waitTimeline, waitPoint)) {
Debug::log(ERR, "renderTextureInternalWithDamage: failed to wait for explicit sync point {}", waitPoint);
return;
}
}
alpha = std::clamp(alpha, 0.f, 1.f); alpha = std::clamp(alpha, 0.f, 1.f);
if (damage.empty()) if (damage.empty())

View file

@ -1,4 +1,4 @@
#include <hyprland/src/render/OpenGL.hpp> #include <hyprland/src/render/OpenGL.hpp>
#include <hyprland/src/helpers/math/Math.hpp> #include <hyprland/src/helpers/math/Math.hpp>
void renderCursorTextureInternalWithDamage(SP<CTexture> tex, CBox* pBox, const CRegion& damage, float alpha, SP<CSyncTimeline> waitTimeline, uint64_t waitPoint, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch); void renderCursorTextureInternalWithDamage(SP<CTexture> tex, CBox* pBox, const CRegion& damage, float alpha, Vector2D hotspot, bool nearest, float stretchAngle, Vector2D stretch);