set cursor to hand1 when moving a window

This commit is contained in:
Vaxry 2022-11-15 10:39:05 +00:00
parent e2da4ff257
commit d5eafe1926
3 changed files with 28 additions and 0 deletions

View file

@ -134,6 +134,8 @@ void IHyprLayout::onBeginDragWindow() {
return; return;
} }
g_pInputManager->setCursorImageUntilUnset("hand1");
DRAGGINGWINDOW->m_vRealPosition.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove")); DRAGGINGWINDOW->m_vRealPosition.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
DRAGGINGWINDOW->m_vRealSize.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove")); DRAGGINGWINDOW->m_vRealSize.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
@ -181,6 +183,8 @@ void IHyprLayout::onEndDragWindow() {
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW)) if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW))
return; return;
g_pInputManager->unsetCursorImage();
if (DRAGGINGWINDOW->m_bDraggingTiled) { if (DRAGGINGWINDOW->m_bDraggingTiled) {
DRAGGINGWINDOW->m_bIsFloating = false; DRAGGINGWINDOW->m_bIsFloating = false;
g_pInputManager->refocus(); g_pInputManager->refocus();

View file

@ -339,6 +339,10 @@ void CInputManager::processMouseRequest(wlr_seat_pointer_request_set_cursor_even
g_pHyprRenderer->m_bWindowRequestedCursorHide = false; g_pHyprRenderer->m_bWindowRequestedCursorHide = false;
} }
if (m_bCursorImageOverriden) {
return;
}
if (m_ecbClickBehavior == CLICKMODE_KILL) { if (m_ecbClickBehavior == CLICKMODE_KILL) {
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "crosshair", g_pCompositor->m_sWLRCursor); wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "crosshair", g_pCompositor->m_sWLRCursor);
return; return;
@ -1184,3 +1188,17 @@ void CInputManager::newSwitch(wlr_input_device* pDevice) {
void CInputManager::destroySwitch(SSwitchDevice* pDevice) { void CInputManager::destroySwitch(SSwitchDevice* pDevice) {
m_lSwitches.remove(*pDevice); m_lSwitches.remove(*pDevice);
} }
void CInputManager::setCursorImageUntilUnset(std::string name) {
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, name.c_str(), g_pCompositor->m_sWLRCursor);
m_bCursorImageOverriden = true;
}
void CInputManager::unsetCursorImage() {
if (!m_bCursorImageOverriden)
return;
m_bCursorImageOverriden = false;
if (!g_pHyprRenderer->m_bWindowRequestedCursorHide)
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
}

View file

@ -125,8 +125,14 @@ public:
// for virtual keyboards: whether we should respect them as normal ones // for virtual keyboards: whether we should respect them as normal ones
bool shouldIgnoreVirtualKeyboard(SKeyboard*); bool shouldIgnoreVirtualKeyboard(SKeyboard*);
// for special cursors that we choose
void setCursorImageUntilUnset(std::string);
void unsetCursorImage();
private: private:
bool m_bCursorImageOverriden = false;
// for click behavior override // for click behavior override
eClickBehaviorMode m_ecbClickBehavior = CLICKMODE_DEFAULT; eClickBehaviorMode m_ecbClickBehavior = CLICKMODE_DEFAULT;
bool m_bEmptyFocusCursorSet = false; bool m_bEmptyFocusCursorSet = false;