summaryrefslogtreecommitdiff
path: root/src/managers
diff options
context:
space:
mode:
authorxDarksome <dev@darkso.me>2022-06-24 18:58:11 +0300
committerGitHub <noreply@github.com>2022-06-24 18:58:11 +0300
commitbe460ea9547691eb136bf8b600b67b778af47e3f (patch)
treeb74869ad39dd804aec31694d4dd429822c223644 /src/managers
parent776ca3baf269059e8c13ba8b625645215e71f78c (diff)
parente7467c60f9fe9e66c74dd8dc7c752a73ed4bc4db (diff)
Merge branch 'hyprwm:main' into main
Diffstat (limited to 'src/managers')
-rw-r--r--src/managers/EventManager.cpp8
-rw-r--r--src/managers/EventManager.hpp2
-rw-r--r--src/managers/KeybindManager.cpp122
-rw-r--r--src/managers/KeybindManager.hpp8
-rw-r--r--src/managers/XWaylandManager.cpp10
-rw-r--r--src/managers/input/InputManager.cpp95
-rw-r--r--src/managers/input/InputManager.hpp4
7 files changed, 184 insertions, 65 deletions
diff --git a/src/managers/EventManager.cpp b/src/managers/EventManager.cpp
index eed0e6e5..e42e87c2 100644
--- a/src/managers/EventManager.cpp
+++ b/src/managers/EventManager.cpp
@@ -105,9 +105,15 @@ void CEventManager::startThread() {
}
void CEventManager::postEvent(const SHyprIPCEvent event) {
+
+ if (m_bIgnoreEvents) {
+ Debug::log(WARN, "Suppressed (ignoreevents true) event of type %s, content: %s",event.event.c_str(), event.data.c_str());
+ return;
+ }
+
std::thread([&](const SHyprIPCEvent ev) {
eventQueueMutex.lock();
m_dQueuedEvents.push_back(ev);
eventQueueMutex.unlock();
}, event).detach();
-} \ No newline at end of file
+}
diff --git a/src/managers/EventManager.hpp b/src/managers/EventManager.hpp
index f8ec6afc..ae630ce8 100644
--- a/src/managers/EventManager.hpp
+++ b/src/managers/EventManager.hpp
@@ -19,6 +19,8 @@ public:
void startThread();
+ bool m_bIgnoreEvents = false;
+
private:
std::mutex eventQueueMutex;
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index 123e560c..85fb3919 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -28,8 +28,10 @@ CKeybindManager::CKeybindManager() {
m_mDispatchers["togglespecialworkspace"] = toggleSpecialWorkspace;
m_mDispatchers["forcerendererreload"] = forceRendererReload;
m_mDispatchers["resizeactive"] = resizeActive;
+ m_mDispatchers["moveactive"] = moveActive;
m_mDispatchers["cyclenext"] = circleNext;
m_mDispatchers["focuswindowbyclass"] = focusWindowByClass;
+ m_mDispatchers["submap"] = setSubmap;
}
void CKeybindManager::addKeybind(SKeybind kb) {
@@ -72,13 +74,11 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t
if (handleInternalKeybinds(key))
return true;
- if (g_pCompositor->m_sSeat.exclusiveClient){
- Debug::log(LOG, "Not handling keybinds due to there being an exclusive inhibited client.");
- return false;
- }
+ if (g_pCompositor->m_sSeat.exclusiveClient)
+ Debug::log(LOG, "Keybind handling only locked (inhibitor)");
for (auto& k : m_lKeybinds) {
- if (modmask != k.modmask)
+ if (modmask != k.modmask || (g_pCompositor->m_sSeat.exclusiveClient && !k.locked) || k.submap != m_szCurrentSelectedSubmap)
continue;
// oMg such performance hit!!11!
@@ -280,9 +280,7 @@ void CKeybindManager::changeworkspace(std::string args) {
// start anim on new workspace
PWORKSPACETOCHANGETO->startAnim(true, ANIMTOLEFT);
- // Event ONLY if workspace is actually "changed" and we arent just focusing
- if (!m_bSuppressWorkspaceChangeEvents)
- g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACETOCHANGETO->m_szName));
+ g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACETOCHANGETO->m_szName));
}
// If the monitor is not the one our cursor's at, warp to it.
@@ -291,9 +289,6 @@ void CKeybindManager::changeworkspace(std::string args) {
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, nullptr, middle.x, middle.y);
}
- // focus the first window
- g_pCompositor->focusWindow(g_pCompositor->getFirstWindowOnWorkspace(workspaceToChangeTo));
-
// set active and deactivate all other in wlr
g_pCompositor->deactivateAllWLRWorkspaces(PWORKSPACETOCHANGETO->m_pWlrHandle);
PWORKSPACETOCHANGETO->setActive(true);
@@ -360,8 +355,7 @@ void CKeybindManager::changeworkspace(std::string args) {
g_pInputManager->refocus();
// Event
- if (!m_bSuppressWorkspaceChangeEvents)
- g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACE->m_szName));
+ g_pEventManager->postEvent(SHyprIPCEvent("workspace", PWORKSPACE->m_szName));
Debug::log(LOG, "Changed to workspace %i", workspaceToChangeTo);
}
@@ -491,7 +485,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
const auto POLDWORKSPACEONMON = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDONMONITOR);
const auto POLDWORKSPACEIDRETURN = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDRETURN);
- m_bSuppressWorkspaceChangeEvents = true;
+ g_pEventManager->m_bIgnoreEvents = true;
moveActiveToWorkspace(args);
@@ -510,7 +504,7 @@ void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
POLDWORKSPACEONMON->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
POLDWORKSPACEONMON->m_fAlpha.setValueAndWarp(255.f);
- m_bSuppressWorkspaceChangeEvents = false;
+ g_pEventManager->m_bIgnoreEvents = false;
g_pInputManager->refocus();
}
@@ -899,6 +893,37 @@ void CKeybindManager::resizeActive(std::string args) {
std::string x = args.substr(0, args.find_first_of(' '));
std::string y = args.substr(args.find_first_of(' ') + 1);
+ if (x == "exact") {
+ std::string newX = y.substr(0, y.find_first_of(' '));
+ std::string newY = y.substr(y.find_first_of(' ') + 1);
+
+ if (!isNumber(newX) || !isNumber(newY)) {
+ Debug::log(ERR, "resizeTiledWindow: exact args not numbers");
+ return;
+ }
+
+ const int X = std::stoi(newX);
+ const int Y = std::stoi(newY);
+
+ if (X < 10 || Y < 10) {
+ Debug::log(ERR, "resizeTiledWindow: exact args cannot be < 10");
+ return;
+ }
+
+ // calc the delta
+ if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
+ return; // ignore
+
+ const auto PWINDOW = g_pCompositor->m_pLastWindow;
+
+ const int DX = X - PWINDOW->m_vRealSize.goalv().x;
+ const int DY = Y - PWINDOW->m_vRealSize.goalv().y;
+
+ g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(Vector2D(DX, DY));
+
+ return;
+ }
+
if (!isNumber(x) || !isNumber(y)) {
Debug::log(ERR, "resizeTiledWindow: args not numbers");
return;
@@ -910,6 +935,55 @@ void CKeybindManager::resizeActive(std::string args) {
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(Vector2D(X, Y));
}
+void CKeybindManager::moveActive(std::string args) {
+ if (args.find_first_of(' ') == std::string::npos)
+ return;
+
+ std::string x = args.substr(0, args.find_first_of(' '));
+ std::string y = args.substr(args.find_first_of(' ') + 1);
+
+ if (x == "exact") {
+ std::string newX = y.substr(0, y.find_first_of(' '));
+ std::string newY = y.substr(y.find_first_of(' ') + 1);
+
+ if (!isNumber(newX) || !isNumber(newY)) {
+ Debug::log(ERR, "moveActive: exact args not numbers");
+ return;
+ }
+
+ const int X = std::stoi(newX);
+ const int Y = std::stoi(newY);
+
+ if (X < 10 || Y < 10) {
+ Debug::log(ERR, "moveActive: exact args cannot be < 10");
+ return;
+ }
+
+ // calc the delta
+ if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
+ return; // ignore
+
+ const auto PWINDOW = g_pCompositor->m_pLastWindow;
+
+ const int DX = X - PWINDOW->m_vRealPosition.goalv().x;
+ const int DY = Y - PWINDOW->m_vRealPosition.goalv().y;
+
+ g_pLayoutManager->getCurrentLayout()->moveActiveWindow(Vector2D(DX, DY));
+
+ return;
+ }
+
+ if (!isNumber(x) || !isNumber(y)) {
+ Debug::log(ERR, "moveActive: args not numbers");
+ return;
+ }
+
+ const int X = std::stoi(x);
+ const int Y = std::stoi(y);
+
+ g_pLayoutManager->getCurrentLayout()->moveActiveWindow(Vector2D(X, Y));
+}
+
void CKeybindManager::circleNext(std::string) {
if (!g_pCompositor->windowValidMapped(g_pCompositor->m_pLastWindow))
return;
@@ -943,3 +1017,21 @@ void CKeybindManager::focusWindowByClass(std::string clazz) {
break;
}
}
+
+void CKeybindManager::setSubmap(std::string submap) {
+ if (submap == "reset" || submap == "") {
+ m_szCurrentSelectedSubmap = "";
+ Debug::log(LOG, "Reset active submap to the default one.");
+ return;
+ }
+
+ for (auto& k : g_pKeybindManager->m_lKeybinds) {
+ if (k.submap == submap) {
+ m_szCurrentSelectedSubmap = submap;
+ Debug::log(LOG, "Changed keybind submap to %s", submap.c_str());
+ return;
+ }
+ }
+
+ Debug::log(ERR, "Cannot set submap %s, submap doesn't exist (wasn't registered!)", submap.c_str());
+}
diff --git a/src/managers/KeybindManager.hpp b/src/managers/KeybindManager.hpp
index 782f2ead..c9132a11 100644
--- a/src/managers/KeybindManager.hpp
+++ b/src/managers/KeybindManager.hpp
@@ -11,6 +11,8 @@ struct SKeybind {
uint32_t modmask = 0;
std::string handler = "";
std::string arg = "";
+ bool locked = false;
+ std::string submap = "";
};
class CKeybindManager {
@@ -28,9 +30,9 @@ public:
private:
std::list<SKeybind> m_lKeybinds;
- bool handleInternalKeybinds(xkb_keysym_t);
+ inline static std::string m_szCurrentSelectedSubmap = "";
- inline static bool m_bSuppressWorkspaceChangeEvents = false;
+ bool handleInternalKeybinds(xkb_keysym_t);
// -------------- Dispatchers -------------- //
static void killActive(std::string);
@@ -56,8 +58,10 @@ private:
static void toggleSpecialWorkspace(std::string);
static void forceRendererReload(std::string);
static void resizeActive(std::string);
+ static void moveActive(std::string);
static void circleNext(std::string);
static void focusWindowByClass(std::string);
+ static void setSubmap(std::string);
friend class CCompositor;
};
diff --git a/src/managers/XWaylandManager.cpp b/src/managers/XWaylandManager.cpp
index 5927274e..65f5ddd8 100644
--- a/src/managers/XWaylandManager.cpp
+++ b/src/managers/XWaylandManager.cpp
@@ -124,14 +124,8 @@ void CHyprXWaylandManager::sendCloseWindow(CWindow* pWindow) {
void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size) {
if (pWindow->m_bIsX11)
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, size.x, size.y);
- else {
- // I don't know if this is fucking correct, but the fucking idea of putting shadows into a window's surface is borderline criminal.
-
- const auto XDELTA = pWindow->m_uSurface.xdg->current.geometry.width && pWindow->m_uSurface.xdg->current.geometry.height ? pWindow->m_uSurface.xdg->surface->current.width - pWindow->m_uSurface.xdg->current.geometry.width : 0;
- const auto YDELTA = pWindow->m_uSurface.xdg->current.geometry.width && pWindow->m_uSurface.xdg->current.geometry.height ? pWindow->m_uSurface.xdg->surface->current.height - pWindow->m_uSurface.xdg->current.geometry.height : 0;
-
- wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x - XDELTA, size.y - YDELTA);
- }
+ else
+ wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x, size.y);
}
void CHyprXWaylandManager::setWindowStyleTiled(CWindow* pWindow, uint32_t edgez) {
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index 826354f1..131be576 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -35,6 +35,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
Vector2D mouseCoords = getMouseCoordsInternal();
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
+ bool didConstraintOnCursor = false;
+
// constraints
// All constraints TODO: multiple mice?
if (g_pCompositor->m_sSeat.mouse->currentConstraint) {
@@ -50,23 +52,25 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
const auto CONSTRAINTPOS = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->x, CONSTRAINTWINDOW->m_uSurface.xwayland->y) : CONSTRAINTWINDOW->m_vRealPosition.vec();
const auto CONSTRAINTSIZE = CONSTRAINTWINDOW->m_bIsX11 ? Vector2D(CONSTRAINTWINDOW->m_uSurface.xwayland->width, CONSTRAINTWINDOW->m_uSurface.xwayland->height) : CONSTRAINTWINDOW->m_vRealSize.vec();
- if (!VECINRECT(mouseCoords, CONSTRAINTPOS.x, CONSTRAINTPOS.y, CONSTRAINTPOS.x + CONSTRAINTSIZE.x, CONSTRAINTPOS.y + CONSTRAINTSIZE.y)) {
+ if (!VECINRECT(mouseCoords, CONSTRAINTPOS.x, CONSTRAINTPOS.y, CONSTRAINTPOS.x + CONSTRAINTSIZE.x - 1.0, CONSTRAINTPOS.y + CONSTRAINTSIZE.y - 1.0)) {
if (g_pCompositor->m_sSeat.mouse->constraintActive) {
- Vector2D deltaToFit;
+ Vector2D newConstrainedCoords = mouseCoords;
if (mouseCoords.x < CONSTRAINTPOS.x)
- deltaToFit.x = CONSTRAINTPOS.x - mouseCoords.x;
- else if (mouseCoords.x > CONSTRAINTPOS.x + CONSTRAINTSIZE.x)
- deltaToFit.x = CONSTRAINTPOS.x + CONSTRAINTSIZE.x - mouseCoords.x;
+ newConstrainedCoords.x = CONSTRAINTPOS.x;
+ else if (mouseCoords.x >= CONSTRAINTPOS.x + CONSTRAINTSIZE.x)
+ newConstrainedCoords.x = CONSTRAINTPOS.x + CONSTRAINTSIZE.x - 1.0;
if (mouseCoords.y < CONSTRAINTPOS.y)
- deltaToFit.y = CONSTRAINTPOS.y - mouseCoords.y;
- else if (mouseCoords.y > CONSTRAINTPOS.y + CONSTRAINTSIZE.y)
- deltaToFit.y = CONSTRAINTPOS.y + CONSTRAINTSIZE.y - mouseCoords.y;
+ newConstrainedCoords.y = CONSTRAINTPOS.y;
+ else if (mouseCoords.y >= CONSTRAINTPOS.y + CONSTRAINTSIZE.y)
+ newConstrainedCoords.y = CONSTRAINTPOS.y + CONSTRAINTSIZE.y - 1.0;
+
+ wlr_cursor_warp_closest(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, newConstrainedCoords.x, newConstrainedCoords.y);
- wlr_cursor_move(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, deltaToFit.x, deltaToFit.y);
+ mouseCoords = newConstrainedCoords;
- mouseCoords = mouseCoords + deltaToFit;
+ didConstraintOnCursor = true;
}
} else {
if ((!CONSTRAINTWINDOW->m_bIsX11 && PMONITOR && CONSTRAINTWINDOW->m_iWorkspaceID == PMONITOR->activeWorkspace) || (CONSTRAINTWINDOW->m_bIsX11)) {
@@ -84,6 +88,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// focus
wlr_surface* foundSurface = nullptr;
+ if (didConstraintOnCursor)
+ return; // don't process when cursor constrained
+
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor) {
g_pCompositor->m_pLastMonitor = PMONITOR;
@@ -116,7 +123,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
wlr_box box = {w->m_vRealPosition.vec().x, w->m_vRealPosition.vec().y, w->m_vRealSize.vec().x, w->m_vRealSize.vec().y};
if (((w->m_bIsFloating && w->m_bIsMapped && w->m_bCreatedOverFullscreen) || (w->m_iWorkspaceID == SPECIAL_WORKSPACE_ID && PMONITOR->specialWorkspaceOpen)) && wlr_box_contains_point(&box, mouseCoords.x, mouseCoords.y) && g_pCompositor->isWorkspaceVisible(w->m_iWorkspaceID) && !w->m_bHidden) {
pFoundWindow = &(*w);
-
+
if (!pFoundWindow->m_bIsX11) {
foundSurface = g_pCompositor->vectorWindowToSurface(mouseCoords, pFoundWindow, surfaceCoords);
} else {
@@ -152,7 +159,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords);
-
if (!foundSurface) {
wlr_xcursor_manager_set_cursor_image(g_pCompositor->m_sWLRXCursorMgr, "left_ptr", g_pCompositor->m_sWLRCursor);
@@ -166,6 +172,14 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
Vector2D surfaceLocal = surfacePos == Vector2D(-1337, -1337) ? surfaceCoords : mouseCoords - surfacePos;
+ if (pFoundWindow && !pFoundWindow->m_bIsX11 && surfacePos != Vector2D(-1337, -1337)) {
+ // calc for oversized windows... fucking bullshit.
+ wlr_box geom;
+ wlr_xdg_surface_get_geometry(pFoundWindow->m_uSurface.xdg, &geom);
+
+ surfaceLocal = mouseCoords - surfacePos + Vector2D(geom.x, geom.y);
+ }
+
if (pFoundWindow) {
static auto *const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
if (*PFOLLOWMOUSE != 1 && !refocus) {
@@ -173,17 +187,15 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
// enter if change floating style
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
- }
- else if (*PFOLLOWMOUSE == 2) {
+ } else if (*PFOLLOWMOUSE == 2) {
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
}
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
- return; // don't enter any new surfaces
+ return; // don't enter any new surfaces
} else {
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
}
- }
- else
+ } else
g_pCompositor->focusSurface(foundSurface);
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
@@ -195,6 +207,11 @@ void CInputManager::onMouseButton(wlr_pointer_button_event* e) {
const auto PKEYBOARD = wlr_seat_get_keyboard(g_pCompositor->m_sSeat.seat);
+ if (!PKEYBOARD) { // ???
+ Debug::log(ERR, "No active keyboard in onMouseButton??");
+ return;
+ }
+
switch (e->state) {
case WLR_BUTTON_PRESSED:
if (!g_pCompositor->m_sSeat.mouse->currentConstraint)
@@ -280,41 +297,43 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
}
void CInputManager::setKeyboardLayout() {
+ for (auto& k : m_lKeyboards)
+ applyConfigToKeyboard(&k);
+}
+
+void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
- const auto RULES = g_pConfigManager->getString("input:kb_rules");
- const auto MODEL = g_pConfigManager->getString("input:kb_model");
- const auto LAYOUT = g_pConfigManager->getString("input:kb_layout");
- const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
- const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
+ ASSERT(pKeyboard);
+
+ const auto RULES = g_pConfigManager->getString("input:kb_rules");
+ const auto MODEL = g_pConfigManager->getString("input:kb_model");
+ const auto LAYOUT = g_pConfigManager->getString("input:kb_layout");
+ const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
+ const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
xkb_rule_names rules = {
.rules = RULES.c_str(),
.model = MODEL.c_str(),
.layout = LAYOUT.c_str(),
.variant = VARIANT.c_str(),
- .options = OPTIONS.c_str()
- };
+ .options = OPTIONS.c_str()};
const auto CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
- const auto KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
- if (!KEYMAP) {
- Debug::log(ERR, "Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model, rules.options);
- xkb_context_unref(CONTEXT);
+ if (!CONTEXT) {
+ Debug::log(ERR, "applyConfigToKeyboard: CONTEXT null??");
return;
}
- const auto PLASTKEEB = m_pActiveKeyboard->keyboard->keyboard;
+ const auto KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
- if (!PLASTKEEB) {
- xkb_keymap_unref(KEYMAP);
+ if (!KEYMAP) {
+ Debug::log(ERR, "Keyboard layout %s with variant %s (rules: %s, model: %s, options: %s) couldn't have been loaded.", rules.layout, rules.variant, rules.rules, rules.model, rules.options);
xkb_context_unref(CONTEXT);
-
- Debug::log(ERR, "No Seat Keyboard???");
return;
}
- wlr_keyboard_set_keymap(PLASTKEEB, KEYMAP);
+ wlr_keyboard_set_keymap(pKeyboard->keyboard->keyboard, KEYMAP);
wlr_keyboard_modifiers wlrMods = {0};
@@ -327,14 +346,14 @@ void CInputManager::setKeyboardLayout() {
}
if (wlrMods.locked != 0) {
- wlr_keyboard_notify_modifiers(g_pInputManager->m_pActiveKeyboard->keyboard->keyboard, 0, 0, wlrMods.locked, 0);
+ wlr_keyboard_notify_modifiers(pKeyboard->keyboard->keyboard, 0, 0, wlrMods.locked, 0);
}
xkb_keymap_unref(KEYMAP);
xkb_context_unref(CONTEXT);
- Debug::log(LOG, "Set the keyboard layout to %s and variant to %s", rules.layout, rules.variant);
-}
+ Debug::log(LOG, "Set the keyboard layout to %s and variant to %s for keyboard \"%s\"", rules.layout, rules.variant, pKeyboard->keyboard->name);
+}
void CInputManager::newMouse(wlr_input_device* mouse) {
m_lMice.emplace_back();
@@ -559,4 +578,4 @@ void CInputManager::updateCapabilities(wlr_input_device* pDev) {
}
wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, m_uiCapabilities);
-}
+} \ No newline at end of file
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index 7a3601bc..ef3a4eb4 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -53,13 +53,15 @@ public:
SKeyboard* m_pActiveKeyboard = nullptr;
- private:
+private:
uint32_t m_uiCapabilities = 0;
void mouseMoveUnified(uint32_t, bool refocus = false);
STabletTool* ensureTabletToolPresent(wlr_tablet_tool*);
+
+ void applyConfigToKeyboard(SKeyboard*);
};
inline std::unique_ptr<CInputManager> g_pInputManager; \ No newline at end of file