Merge branch 'hyprwm:main' into main

This commit is contained in:
Kaeeraa 2024-09-05 15:37:37 +03:00 committed by GitHub
commit 27266268ea
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 48 additions and 71 deletions

View file

@ -99,8 +99,6 @@ pkg_check_modules(
xkbcommon
uuid
wayland-server
wayland-client
wayland-cursor
wayland-protocols
cairo
pango
@ -109,11 +107,6 @@ pkg_check_modules(
xcursor
libdrm
libinput
hwdata
libseat
libdisplay-info
libliftoff
libudev
gbm
gio-2.0
hyprlang>=0.3.2
@ -200,14 +193,11 @@ else()
REQUIRED
IMPORTED_TARGET
xcb
xwayland
xcb-util
xcb-render
xcb-xfixes
xcb-icccm
xcb-composite
xcb-res
xcb-ewmh
xcb-errors)
target_link_libraries(Hyprland PkgConfig::xdeps)
endif()
@ -266,7 +256,7 @@ function(protocolWayland)
endfunction()
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads
libudis86 uuid)
libudis86)
protocolnew("subprojects/hyprland-protocols/protocols"
"hyprland-global-shortcuts-v1" true)

View file

@ -9,33 +9,22 @@
aquamarine,
binutils,
cairo,
expat,
fribidi,
git,
hwdata,
hyprcursor,
hyprlang,
hyprutils,
hyprwayland-scanner,
jq,
libGL,
libdatrie,
libdisplay-info,
libdrm,
libexecinfo,
libinput,
libliftoff,
libselinux,
libsepol,
libthai,
libuuid,
libxkbcommon,
libuuid,
mesa,
pango,
pciutils,
pcre2,
python3,
seatd,
systemd,
tomlplusplus,
wayland,
@ -114,29 +103,25 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
[
aquamarine
cairo
expat
fribidi
# expat
# fribidi
git
hwdata
hyprcursor
hyprlang
hyprutils
libdatrie
libdisplay-info
# libdatrie
libdrm
libGL
libinput
libliftoff
libselinux
libsepol
libthai
# libselinux
# libsepol
# libthai
libuuid
libxkbcommon
mesa
pango
pciutils
pcre2
seatd
# pcre2
tomlplusplus
wayland
wayland-protocols
@ -146,7 +131,6 @@ assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been remov
(lib.optionals enableXWayland [
xorg.libxcb
xorg.libXdmcp
xorg.xcbutil
xorg.xcbutilerrors
xorg.xcbutilrenderutil
xorg.xcbutilwm

View file

@ -1117,7 +1117,7 @@ void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindo
if (g_pSeatManager->state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->state.keyboardFocus == pWindowOwner->m_pWLSurface->resource()))
return; // Don't focus when already focused on this.
if (g_pSessionLockManager->isSessionLocked() && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
if (g_pSessionLockManager->isSessionLocked() && pSurface && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
return;
if (g_pSeatManager->seatGrab && !g_pSeatManager->seatGrab->accepts(pSurface)) {

View file

@ -30,6 +30,9 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
listeners.commit = surface_->events.commit.registerListener([this](std::any data) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(iMonitorID);
if (mapped && pWlrSurface != g_pCompositor->m_pLastFocus)
g_pInputManager->simulateMouseMovement();
if (PMONITOR)
g_pHyprRenderer->damageMonitor(PMONITOR);
});

View file

@ -111,7 +111,7 @@ void CInputManager::simulateMouseMovement() {
timespec now;
clock_gettime(CLOCK_MONOTONIC, &now);
m_vLastCursorPosFloored = m_vLastCursorPosFloored - Vector2D(1, 1); // hack: force the mouseMoveUnified to report without making this a refocus.
mouseMoveUnified(now.tv_sec * 1000 + now.tv_nsec / 10000000);
mouseMoveUnified(now.tv_sec * 1000 + now.tv_nsec / 10000000, false, true);
}
void CInputManager::sendMotionEventsToFocused() {
@ -132,7 +132,7 @@ void CInputManager::sendMotionEventsToFocused() {
g_pSeatManager->setPointerFocus(g_pCompositor->m_pLastFocus.lock(), LOCAL);
}
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool silent) {
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
static auto PMOUSEREFOCUS = CConfigValue<Hyprlang::INT>("input:mouse_refocus");
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
@ -153,7 +153,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
Vector2D surfacePos = Vector2D(-1337, -1337);
PHLWINDOW pFoundWindow;
PHLLS pFoundLayerSurface;
SSessionLockSurface* pSessionLock = nullptr;
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
return;
@ -171,7 +170,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
EMIT_HOOK_EVENT_CANCELLABLE("mouseMove", MOUSECOORDSFLOORED);
if (time)
if (time && !silent)
PROTO::idle->onActivity();
m_vLastCursorPosFloored = MOUSECOORDSFLOORED;
@ -190,17 +189,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (!PMONITOR->solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) && !skipFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
PHLWINDOW forcedFocus = m_pForcedFocus.lock();
if (!forcedFocus)
forcedFocus = g_pCompositor->getForceFocus();
if (forcedFocus) {
pFoundWindow = forcedFocus;
surfacePos = pFoundWindow->m_vRealPosition.value();
foundSurface = pFoundWindow->m_pWLSurface->resource();
}
// constraints
if (!g_pSeatManager->mouse.expired() && isConstrained()) {
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_pLastFocus.lock());
@ -227,6 +215,33 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get());
}
if (PMONITOR != g_pCompositor->m_pLastMonitor.get() && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
g_pCompositor->setActiveMonitor(PMONITOR);
if (g_pSessionLockManager->isSessionLocked()) {
const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID);
surfacePos = PMONITOR->vecPosition;
foundSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr;
g_pCompositor->focusSurface(foundSurface);
const auto SURFACELOCAL = mouseCoords - surfacePos;
g_pSeatManager->setPointerFocus(foundSurface, SURFACELOCAL);
g_pSeatManager->sendPointerMotion(time, SURFACELOCAL);
return;
}
PHLWINDOW forcedFocus = m_pForcedFocus.lock();
if (!forcedFocus)
forcedFocus = g_pCompositor->getForceFocus();
if (forcedFocus) {
pFoundWindow = forcedFocus;
surfacePos = pFoundWindow->m_vRealPosition.value();
foundSurface = pFoundWindow->m_pWLSurface->resource();
}
// if we are holding a pointer button,
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
@ -258,19 +273,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor.get() && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
g_pCompositor->setActiveMonitor(PMONITOR);
if (g_pSessionLockManager->isSessionLocked()) {
pSessionLock = PMONITOR ? g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID) : nullptr;
if (!pSessionLock)
return;
foundSurface = pSessionLock->surface->surface();
surfacePos = PMONITOR->vecPosition;
}
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerPopupSurface(mouseCoords, PMONITOR, &surfaceCoords, &pFoundLayerSurface);
@ -460,9 +462,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
restoreCursorIconToApp();
}
if (pSessionLock != nullptr)
g_pCompositor->focusSurface(foundSurface);
else if (pFoundWindow) {
if (pFoundWindow) {
// change cursor icon if hovering over border
if (*PRESIZEONBORDER && *PRESIZECURSORICON) {
if (!pFoundWindow->isFullscreen() && !pFoundWindow->hasPopupAt(mouseCoords)) {

View file

@ -237,7 +237,7 @@ class CInputManager {
uint32_t m_uiCapabilities = 0;
void mouseMoveUnified(uint32_t, bool refocus = false);
void mouseMoveUnified(uint32_t, bool refocus = false, bool silent = false);
SP<CTabletTool> ensureTabletToolPresent(SP<Aquamarine::ITabletTool>);

View file

@ -58,8 +58,8 @@ CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(SP<CWpLinuxDrmSyncobjSurf
if (!pending.acquireTimeline)
return;
// wait for the buffer to be released by the gpu before sending a commit to avoid lagging the desktop
auto materialized = pending.acquireTimeline->timeline->check(pending.acquirePoint, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE);
// wait for the acquire timeline to materialize
auto materialized = pending.acquireTimeline->timeline->check(pending.acquirePoint, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE);
if (!materialized.has_value()) {
LOGM(ERR, "Failed to check the acquire timeline");
resource->noMemory();
@ -70,7 +70,7 @@ CDRMSyncobjSurfaceResource::CDRMSyncobjSurfaceResource(SP<CWpLinuxDrmSyncobjSurf
return;
surface->lockPendingState();
pending.acquireTimeline->timeline->addWaiter([this]() { surface->unlockPendingState(); }, pending.acquirePoint, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_DEADLINE);
pending.acquireTimeline->timeline->addWaiter([this]() { surface->unlockPendingState(); }, pending.acquirePoint, DRM_SYNCOBJ_WAIT_FLAGS_WAIT_AVAILABLE);
});
listeners.surfaceCommit = surface->events.roleCommit.registerListener([this](std::any d) {