mirror of https://github.com/hyprwm/Hyprland
Merge 712916a450
into ac11771348
This commit is contained in:
commit
927231a117
|
@ -525,7 +525,7 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("cursor:no_hardware_cursors", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("cursor:no_break_fs_vrr", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("cursor:min_refresh_rate", Hyprlang::INT{24});
|
||||
m_pConfig->addConfigValue("cursor:hotspot_padding", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("cursor:hotspot_padding", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("cursor:inactive_timeout", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("cursor:no_warps", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("cursor:persistent_warps", Hyprlang::INT{0});
|
||||
|
|
|
@ -612,7 +612,7 @@ CBox CPointerManager::getCursorBoxGlobal() {
|
|||
Vector2D CPointerManager::closestValid(const Vector2D& pos) {
|
||||
static auto PADDING = CConfigValue<Hyprlang::INT>("cursor:hotspot_padding");
|
||||
|
||||
auto CURSOR_PADDING = std::clamp((int)*PADDING, 1, 100); // 1px
|
||||
auto CURSOR_PADDING = std::clamp((int)*PADDING, 0, 100);
|
||||
CBox hotBox = {{pos.x - CURSOR_PADDING, pos.y - CURSOR_PADDING}, {2 * CURSOR_PADDING, 2 * CURSOR_PADDING}};
|
||||
|
||||
//
|
||||
|
@ -637,7 +637,13 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
|
|||
float distanceSq = __FLT_MAX__;
|
||||
|
||||
for (auto& b : currentMonitorLayout.monitorBoxes) {
|
||||
auto p = b.closestPoint(vec);
|
||||
auto p = b.closestPoint(vec);
|
||||
|
||||
auto maxPoint = Vector2D{std::nextafter(b.x + b.w, -INFINITY), std::nextafter(b.y + b.h, -INFINITY)};
|
||||
|
||||
// because closestPoint clamps up to x + w and y + h
|
||||
p = Vector2D{std::clamp(p.x, b.x, maxPoint.x), std::clamp(p.y, b.y, maxPoint.y)};
|
||||
|
||||
auto distSq = p.distanceSq(vec);
|
||||
|
||||
if (distSq < distanceSq) {
|
||||
|
|
Loading…
Reference in New Issue