mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 18:25:59 +01:00
input tweaks
This commit is contained in:
parent
2e5435fe91
commit
221acebf2c
4 changed files with 14 additions and 8 deletions
|
@ -191,7 +191,7 @@ void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) {
|
||||||
void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
||||||
SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_commitLayerSurface);
|
SLayerSurface* layersurface = wl_container_of(listener, layersurface, listen_commitLayerSurface);
|
||||||
|
|
||||||
if (!layersurface->layerSurface->output)
|
if (!layersurface->layerSurface || !layersurface->layerSurface->output)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
|
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
|
||||||
|
|
|
@ -131,17 +131,18 @@ void CInputManager::onKeyboardKey(wlr_event_keyboard_key* e, SKeyboard* pKeyboar
|
||||||
|
|
||||||
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
|
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sWLRSeat);
|
||||||
|
|
||||||
|
bool found = false;
|
||||||
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
if (e->state == WL_KEYBOARD_KEY_STATE_PRESSED) {
|
||||||
for (int i = 0; i < syms; ++i)
|
for (int i = 0; i < syms; ++i)
|
||||||
g_pKeybindManager->handleKeybinds(MODS, keysyms[i]);
|
found = g_pKeybindManager->handleKeybinds(MODS, keysyms[i]) || found;
|
||||||
} else if (e->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
} else if (e->state == WL_KEYBOARD_KEY_STATE_RELEASED) {
|
||||||
// hee hee
|
// hee hee
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, pKeyboard->keyboard);
|
if (!found) {
|
||||||
wlr_seat_keyboard_notify_key(g_pCompositor->m_sWLRSeat, e->time_msec, e->keycode, e->state);
|
wlr_seat_set_keyboard(g_pCompositor->m_sWLRSeat, pKeyboard->keyboard);
|
||||||
|
wlr_seat_keyboard_notify_key(g_pCompositor->m_sWLRSeat, e->time_msec, e->keycode, e->state);
|
||||||
g_pCompositor->focusWindow(g_pCompositor->vectorToWindowIdeal(g_pInputManager->getMouseCoordsInternal()));
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
|
void CInputManager::onKeyboardMod(void* data, SKeyboard* pKeyboard) {
|
||||||
|
|
|
@ -26,7 +26,8 @@ uint32_t CKeybindManager::stringToModMask(std::string mods) {
|
||||||
return modMask;
|
return modMask;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t& key) {
|
bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t& key) {
|
||||||
|
bool found = false;
|
||||||
for (auto& k : m_dKeybinds) {
|
for (auto& k : m_dKeybinds) {
|
||||||
if (modmask != k.modmask)
|
if (modmask != k.modmask)
|
||||||
continue;
|
continue;
|
||||||
|
@ -41,7 +42,11 @@ void CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t
|
||||||
// yes.
|
// yes.
|
||||||
if (k.handler == "exec") { spawn(k.arg); }
|
if (k.handler == "exec") { spawn(k.arg); }
|
||||||
else if (k.handler == "killactive") { killActive(k.arg); }
|
else if (k.handler == "killactive") { killActive(k.arg); }
|
||||||
|
|
||||||
|
found = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return found;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatchers
|
// Dispatchers
|
||||||
|
|
|
@ -13,7 +13,7 @@ struct SKeybind {
|
||||||
|
|
||||||
class CKeybindManager {
|
class CKeybindManager {
|
||||||
public:
|
public:
|
||||||
void handleKeybinds(const uint32_t&, const xkb_keysym_t&);
|
bool handleKeybinds(const uint32_t&, const xkb_keysym_t&);
|
||||||
void addKeybind(SKeybind);
|
void addKeybind(SKeybind);
|
||||||
uint32_t stringToModMask(std::string);
|
uint32_t stringToModMask(std::string);
|
||||||
void clearKeybinds();
|
void clearKeybinds();
|
||||||
|
|
Loading…
Reference in a new issue