mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 12:45:59 +01:00
add dragging hint on rounded corners
This commit is contained in:
parent
821b849218
commit
fae6610b3c
1 changed files with 24 additions and 9 deletions
|
@ -198,31 +198,46 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
} else {
|
} else {
|
||||||
pFoundWindow = g_pCompositor->vectorToWindowIdeal(mouseCoords);
|
pFoundWindow = g_pCompositor->vectorToWindowIdeal(mouseCoords);
|
||||||
|
|
||||||
|
// TODO check if is being dragged, skip setting cursor icon if so
|
||||||
if (*PRESIZEONBORDER) {
|
if (*PRESIZEONBORDER) {
|
||||||
|
const auto CORNER = *PROUNDING + *PBORDERSIZE + 10;
|
||||||
wlr_box box = {pFoundWindow->m_vRealPosition.vec().x, pFoundWindow->m_vRealPosition.vec().y, pFoundWindow->m_vRealSize.vec().x, pFoundWindow->m_vRealSize.vec().y};
|
wlr_box box = {pFoundWindow->m_vRealPosition.vec().x, pFoundWindow->m_vRealPosition.vec().y, pFoundWindow->m_vRealSize.vec().x, pFoundWindow->m_vRealSize.vec().y};
|
||||||
if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) {
|
if (wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y)) {
|
||||||
|
if (pFoundWindow->isInCurvedCorner(mouseCoords.x, mouseCoords.y)) {
|
||||||
|
if (mouseCoords.y < box.y + CORNER) {
|
||||||
|
if (mouseCoords.x < box.x + CORNER)
|
||||||
|
setCursorImageUntilUnset("top_left_corner");
|
||||||
|
else
|
||||||
|
setCursorImageUntilUnset("top_right_corner");
|
||||||
|
} else {
|
||||||
|
if (mouseCoords.x < box.x + CORNER)
|
||||||
|
setCursorImageUntilUnset("bottom_left_corner");
|
||||||
|
else
|
||||||
|
setCursorImageUntilUnset("bottom_right_corner");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
unsetCursorImage();
|
unsetCursorImage();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// give a small leeway (10 px) for corner icon
|
// give a small leeway (10 px) for corner icon
|
||||||
auto corner = *PROUNDING + *PBORDERSIZE + 10;
|
if (mouseCoords.y < box.y + CORNER) {
|
||||||
if (mouseCoords.y < box.y + corner) {
|
if (mouseCoords.x < box.x + CORNER)
|
||||||
if (mouseCoords.x < box.x + corner)
|
|
||||||
setCursorImageUntilUnset("top_left_corner");
|
setCursorImageUntilUnset("top_left_corner");
|
||||||
else if (mouseCoords.x > box.x + box.width - corner)
|
else if (mouseCoords.x > box.x + box.width - CORNER)
|
||||||
setCursorImageUntilUnset("top_right_corner");
|
setCursorImageUntilUnset("top_right_corner");
|
||||||
else
|
else
|
||||||
setCursorImageUntilUnset("top_side");
|
setCursorImageUntilUnset("top_side");
|
||||||
} else if (mouseCoords.y > box.y + box.height - corner) {
|
} else if (mouseCoords.y > box.y + box.height - CORNER) {
|
||||||
if (mouseCoords.x < box.x)
|
if (mouseCoords.x < box.x)
|
||||||
setCursorImageUntilUnset("bottom_left_corner");
|
setCursorImageUntilUnset("bottom_left_corner");
|
||||||
else if (mouseCoords.x > box.x + box.width - corner)
|
else if (mouseCoords.x > box.x + box.width - CORNER)
|
||||||
setCursorImageUntilUnset("bottom_right_corner");
|
setCursorImageUntilUnset("bottom_right_corner");
|
||||||
else
|
else
|
||||||
setCursorImageUntilUnset("bottom_side");
|
setCursorImageUntilUnset("bottom_side");
|
||||||
} else {
|
} else {
|
||||||
if (mouseCoords.x < box.x + corner)
|
if (mouseCoords.x < box.x + CORNER)
|
||||||
setCursorImageUntilUnset("left_side");
|
setCursorImageUntilUnset("left_side");
|
||||||
else if (mouseCoords.x > box.x + box.width - corner)
|
else if (mouseCoords.x > box.x + box.width - CORNER)
|
||||||
setCursorImageUntilUnset("right_side");
|
setCursorImageUntilUnset("right_side");
|
||||||
else {
|
else {
|
||||||
// unreachable
|
// unreachable
|
||||||
|
|
Loading…
Reference in a new issue