mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 00:29:49 +01:00
parent
f26d7aa58d
commit
e3373669e5
6 changed files with 42 additions and 0 deletions
|
@ -307,6 +307,7 @@ void CCompositor::initAllSignals() {
|
|||
addWLSignal(&m_sWLRGammaCtrlMgr->events.set_gamma, &Events::listen_setGamma, m_sWLRGammaCtrlMgr, "GammaCtrlMgr");
|
||||
addWLSignal(&m_sWLRCursorShapeMgr->events.request_set_shape, &Events::listen_setCursorShape, m_sWLRCursorShapeMgr, "CursorShapeMgr");
|
||||
addWLSignal(&m_sWLRTearingControlMgr->events.new_object, &Events::listen_newTearingHint, m_sWLRTearingControlMgr, "TearingControlMgr");
|
||||
addWLSignal(&m_sWLRKbShInhibitMgr->events.new_inhibitor, &Events::listen_newShortcutInhibitor, m_sWLRKbShInhibitMgr, "ShortcutInhibitMgr");
|
||||
|
||||
if (m_sWRLDRMLeaseMgr)
|
||||
addWLSignal(&m_sWRLDRMLeaseMgr->events.request, &Events::listen_leaseRequest, &m_sWRLDRMLeaseMgr, "DRM");
|
||||
|
@ -360,6 +361,7 @@ void CCompositor::removeAllSignals() {
|
|||
removeWLSignal(&Events::listen_setGamma);
|
||||
removeWLSignal(&Events::listen_setCursorShape);
|
||||
removeWLSignal(&Events::listen_newTearingHint);
|
||||
removeWLSignal(&Events::listen_newShortcutInhibitor);
|
||||
|
||||
if (m_sWRLDRMLeaseMgr)
|
||||
removeWLSignal(&Events::listen_leaseRequest);
|
||||
|
|
|
@ -174,4 +174,7 @@ namespace Events {
|
|||
|
||||
// Tearing hints
|
||||
LISTENER(newTearingHint);
|
||||
|
||||
// Shortcut inhibitor
|
||||
LISTENER(newShortcutInhibitor);
|
||||
};
|
||||
|
|
|
@ -262,3 +262,20 @@ void Events::listener_newTearingHint(wl_listener* listener, void* data) {
|
|||
},
|
||||
NEWCTRL, "TearingController");
|
||||
}
|
||||
|
||||
void Events::listener_newShortcutInhibitor(wl_listener* listener, void* data) {
|
||||
const auto INHIBITOR = (wlr_keyboard_shortcuts_inhibitor_v1*)data;
|
||||
|
||||
const auto PINH = &g_pKeybindManager->m_lShortcutInhibitors.emplace_back();
|
||||
PINH->hyprListener_destroy.initCallback(
|
||||
&INHIBITOR->events.destroy,
|
||||
[](void* owner, void* data) {
|
||||
const auto OWNER = (SShortcutInhibitor*)owner;
|
||||
g_pKeybindManager->m_lShortcutInhibitors.remove(*OWNER);
|
||||
},
|
||||
PINH, "ShortcutInhibitor");
|
||||
|
||||
PINH->pWlrInhibitor = INHIBITOR;
|
||||
|
||||
Debug::log(LOG, "New shortcut inhibitor for surface {:x}", (uintptr_t)INHIBITOR->surface);
|
||||
}
|
||||
|
|
|
@ -412,3 +412,13 @@ struct STearingController {
|
|||
return pWlrHint == other.pWlrHint;
|
||||
}
|
||||
};
|
||||
|
||||
struct SShortcutInhibitor {
|
||||
wlr_keyboard_shortcuts_inhibitor_v1* pWlrInhibitor = nullptr;
|
||||
|
||||
DYNLISTENER(destroy);
|
||||
|
||||
bool operator==(const SShortcutInhibitor& other) {
|
||||
return pWlrInhibitor == other.pWlrInhibitor;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -497,6 +497,15 @@ bool CKeybindManager::handleKeybinds(const uint32_t modmask, const SPressedKeyWi
|
|||
if (g_pCompositor->m_sSeat.exclusiveClient)
|
||||
Debug::log(LOG, "Keybind handling only locked (inhibitor)");
|
||||
|
||||
if (!m_lShortcutInhibitors.empty()) {
|
||||
for (auto& i : m_lShortcutInhibitors) {
|
||||
if (i.pWlrInhibitor->surface == g_pCompositor->m_pLastFocus) {
|
||||
Debug::log(LOG, "Keybind handling is disabled due to an inhibitor for surface {:x}", (uintptr_t)i.pWlrInhibitor->surface);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& k : m_lKeybinds) {
|
||||
const bool SPECIALDISPATCHER = k.handler == "global" || k.handler == "pass" || k.handler == "mouse";
|
||||
const bool SPECIALTRIGGERED =
|
||||
|
|
|
@ -70,6 +70,7 @@ class CKeybindManager {
|
|||
bool m_bGroupsLocked = false;
|
||||
|
||||
std::list<SKeybind> m_lKeybinds;
|
||||
std::list<SShortcutInhibitor> m_lShortcutInhibitors;
|
||||
|
||||
private:
|
||||
std::deque<SPressedKeyWithMods> m_dPressedKeys;
|
||||
|
|
Loading…
Reference in a new issue