mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-23 05:45:58 +01:00
minor mouse bind handling fixes
This commit is contained in:
parent
b4bcba935d
commit
8b11a2e1b1
2 changed files with 13 additions and 6 deletions
|
@ -129,17 +129,22 @@ void CKeybindManager::updateXKBTranslationState() {
|
||||||
m_pXKBTranslationState = xkb_state_new(PKEYMAP);
|
m_pXKBTranslationState = xkb_state_new(PKEYMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::ensureMouseBindState() {
|
bool CKeybindManager::ensureMouseBindState() {
|
||||||
if (!m_bIsMouseBindActive)
|
if (!m_bIsMouseBindActive)
|
||||||
return;
|
return false;
|
||||||
|
|
||||||
if (g_pInputManager->currentlyDraggedWindow) {
|
if (g_pInputManager->currentlyDraggedWindow) {
|
||||||
|
m_bIsMouseBindActive = false;
|
||||||
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
g_pLayoutManager->getCurrentLayout()->onEndDragWindow();
|
||||||
g_pInputManager->currentlyDraggedWindow = nullptr;
|
g_pInputManager->currentlyDraggedWindow = nullptr;
|
||||||
g_pInputManager->dragMode = MBIND_INVALID;
|
g_pInputManager->dragMode = MBIND_INVALID;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_bIsMouseBindActive = false;
|
m_bIsMouseBindActive = false;
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
|
bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard) {
|
||||||
|
@ -174,7 +179,7 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
|
||||||
m_uLastCode = KEYCODE;
|
m_uLastCode = KEYCODE;
|
||||||
m_uLastMouseCode = 0;
|
m_uLastMouseCode = 0;
|
||||||
|
|
||||||
ensureMouseBindState();
|
bool mouseBindWasActive = ensureMouseBindState();
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
|
@ -212,7 +217,7 @@ bool CKeybindManager::onKeyEvent(wlr_keyboard_key_event* e, SKeyboard* pKeyboard
|
||||||
shadowKeybinds();
|
shadowKeybinds();
|
||||||
}
|
}
|
||||||
|
|
||||||
return !found;
|
return !found && !mouseBindWasActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) {
|
bool CKeybindManager::onAxisEvent(wlr_pointer_axis_event* e) {
|
||||||
|
@ -251,6 +256,8 @@ bool CKeybindManager::onMouseEvent(wlr_pointer_button_event* e) {
|
||||||
m_uLastCode = 0;
|
m_uLastCode = 0;
|
||||||
m_uTimeLastMs = e->time_msec;
|
m_uTimeLastMs = e->time_msec;
|
||||||
|
|
||||||
|
bool mouseBindWasActive = ensureMouseBindState();
|
||||||
|
|
||||||
if (e->state == WLR_BUTTON_PRESSED) {
|
if (e->state == WLR_BUTTON_PRESSED) {
|
||||||
found = g_pKeybindManager->handleKeybinds(MODS, "mouse:" + std::to_string(e->button), 0, 0, true, 0);
|
found = g_pKeybindManager->handleKeybinds(MODS, "mouse:" + std::to_string(e->button), 0, 0, true, 0);
|
||||||
|
|
||||||
|
@ -262,7 +269,7 @@ bool CKeybindManager::onMouseEvent(wlr_pointer_button_event* e) {
|
||||||
shadowKeybinds();
|
shadowKeybinds();
|
||||||
}
|
}
|
||||||
|
|
||||||
return !found;
|
return !found && !mouseBindWasActive;
|
||||||
}
|
}
|
||||||
|
|
||||||
int repeatKeyHandler(void* data) {
|
int repeatKeyHandler(void* data) {
|
||||||
|
|
|
@ -78,7 +78,7 @@ private:
|
||||||
xkb_state* m_pXKBTranslationState = nullptr;
|
xkb_state* m_pXKBTranslationState = nullptr;
|
||||||
|
|
||||||
void updateXKBTranslationState();
|
void updateXKBTranslationState();
|
||||||
void ensureMouseBindState();
|
bool ensureMouseBindState();
|
||||||
|
|
||||||
// -------------- Dispatchers -------------- //
|
// -------------- Dispatchers -------------- //
|
||||||
static void killActive(std::string);
|
static void killActive(std::string);
|
||||||
|
|
Loading…
Reference in a new issue