mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-07 19:45:59 +01:00
fix some swipe issues
This commit is contained in:
parent
6dc8c4b310
commit
3e6abaf680
3 changed files with 25 additions and 15 deletions
|
@ -193,7 +193,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const std::string&
|
||||||
return found;
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint32_t& doesntHaveCode) {
|
void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const int& doesntHaveCode) {
|
||||||
// shadow disables keybinds after one has been triggered
|
// shadow disables keybinds after one has been triggered
|
||||||
|
|
||||||
for (auto& k : m_lKeybinds) {
|
for (auto& k : m_lKeybinds) {
|
||||||
|
@ -215,7 +215,7 @@ void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint3
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto& pk : m_dPressedKeycodes) {
|
for (auto& pk : m_dPressedKeycodes) {
|
||||||
if (pk == (unsigned int)k.keycode) {
|
if (pk == k.keycode) {
|
||||||
shadow = true;
|
shadow = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,14 +31,14 @@ public:
|
||||||
void removeKeybind(uint32_t, const std::string&);
|
void removeKeybind(uint32_t, const std::string&);
|
||||||
uint32_t stringToModMask(std::string);
|
uint32_t stringToModMask(std::string);
|
||||||
void clearKeybinds();
|
void clearKeybinds();
|
||||||
void shadowKeybinds(const xkb_keysym_t& doesntHave = 0, const uint32_t& doesntHaveCode = 0);
|
void shadowKeybinds(const xkb_keysym_t& doesntHave = 0, const int& doesntHaveCode = 0);
|
||||||
|
|
||||||
std::unordered_map<std::string, std::function<void(std::string)>> m_mDispatchers;
|
std::unordered_map<std::string, std::function<void(std::string)>> m_mDispatchers;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::list<SKeybind> m_lKeybinds;
|
std::list<SKeybind> m_lKeybinds;
|
||||||
std::deque<xkb_keysym_t> m_dPressedKeysyms;
|
std::deque<xkb_keysym_t> m_dPressedKeysyms;
|
||||||
std::deque<uint32_t> m_dPressedKeycodes;
|
std::deque<int> m_dPressedKeycodes;
|
||||||
|
|
||||||
inline static std::string m_szCurrentSelectedSubmap = "";
|
inline static std::string m_szCurrentSelectedSubmap = "";
|
||||||
|
|
||||||
|
|
|
@ -41,15 +41,21 @@ void CInputManager::onSwipeEnd(wlr_pointer_swipe_end_event* e) {
|
||||||
|
|
||||||
if ((abs(m_sActiveSwipe.delta) < *PSWIPEDIST * *PSWIPEPERC && (*PSWIPEFORC == 0 || (*PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < *PSWIPEFORC))) || abs(m_sActiveSwipe.delta) < 2) {
|
if ((abs(m_sActiveSwipe.delta) < *PSWIPEDIST * *PSWIPEPERC && (*PSWIPEFORC == 0 || (*PSWIPEFORC != 0 && m_sActiveSwipe.avgSpeed < *PSWIPEFORC))) || abs(m_sActiveSwipe.delta) < 2) {
|
||||||
// revert
|
// revert
|
||||||
if (m_sActiveSwipe.delta < 0) {
|
if (abs(m_sActiveSwipe.delta) < 2) {
|
||||||
// to left
|
PWORKSPACEL->m_vRenderOffset.setValueAndWarp(Vector2D(0,0));
|
||||||
PWORKSPACEL->m_vRenderOffset = Vector2D({-m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
PWORKSPACER->m_vRenderOffset.setValueAndWarp(Vector2D(0,0));
|
||||||
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(0,0));
|
||||||
} else {
|
} else {
|
||||||
// to right
|
if (m_sActiveSwipe.delta < 0) {
|
||||||
PWORKSPACER->m_vRenderOffset = Vector2D({m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
// to left
|
||||||
}
|
PWORKSPACEL->m_vRenderOffset = Vector2D({-m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
||||||
|
} else {
|
||||||
|
// to right
|
||||||
|
PWORKSPACER->m_vRenderOffset = Vector2D({m_sActiveSwipe.pMonitor->vecSize.x, 0});
|
||||||
|
}
|
||||||
|
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset = Vector2D();
|
||||||
|
}
|
||||||
} else if (m_sActiveSwipe.delta < 0) {
|
} else if (m_sActiveSwipe.delta < 0) {
|
||||||
// switch to left
|
// switch to left
|
||||||
const auto RENDEROFFSET = PWORKSPACEL->m_vRenderOffset.vec();
|
const auto RENDEROFFSET = PWORKSPACEL->m_vRenderOffset.vec();
|
||||||
|
@ -122,9 +128,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
||||||
|
|
||||||
PWORKSPACE->m_bForceRendering = true;
|
PWORKSPACE->m_bForceRendering = true;
|
||||||
|
|
||||||
const auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
|
if (workspaceIDLeft != workspaceIDRight) {
|
||||||
|
const auto PWORKSPACER = g_pCompositor->getWorkspaceByID(workspaceIDRight);
|
||||||
|
|
||||||
PWORKSPACER->m_bForceRendering = true;
|
PWORKSPACER->m_bForceRendering = false;
|
||||||
|
}
|
||||||
|
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x - m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x - m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
|
@ -140,9 +148,11 @@ void CInputManager::onSwipeUpdate(wlr_pointer_swipe_update_event* e) {
|
||||||
|
|
||||||
PWORKSPACE->m_bForceRendering = true;
|
PWORKSPACE->m_bForceRendering = true;
|
||||||
|
|
||||||
const auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
|
if (workspaceIDLeft != workspaceIDRight) {
|
||||||
|
const auto PWORKSPACEL = g_pCompositor->getWorkspaceByID(workspaceIDLeft);
|
||||||
|
|
||||||
PWORKSPACEL->m_bForceRendering = true;
|
PWORKSPACEL->m_bForceRendering = false;
|
||||||
|
}
|
||||||
|
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x + m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x + m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
m_sActiveSwipe.pWorkspaceBegin->m_vRenderOffset.setValueAndWarp(Vector2D(((- m_sActiveSwipe.delta) / *PSWIPEDIST) * m_sActiveSwipe.pMonitor->vecSize.x, 0));
|
||||||
|
|
Loading…
Reference in a new issue