mirror of
https://github.com/hyprwm/Hyprland
synced 2024-12-23 05:49:48 +01:00
fix possible crash in cinputmanager
This commit is contained in:
parent
9fcef41d66
commit
3832720273
1 changed files with 9 additions and 6 deletions
|
@ -344,9 +344,7 @@ Vector2D CInputManager::getMouseCoordsInternal() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
||||||
m_lKeyboards.push_back(SKeyboard());
|
const auto PNEWKEYBOARD = &m_lKeyboards.emplace_back();
|
||||||
|
|
||||||
const auto PNEWKEYBOARD = &m_lKeyboards.back();
|
|
||||||
|
|
||||||
PNEWKEYBOARD->keyboard = keyboard;
|
PNEWKEYBOARD->keyboard = keyboard;
|
||||||
|
|
||||||
|
@ -385,10 +383,15 @@ void CInputManager::applyConfigToKeyboard(SKeyboard* pKeyboard) {
|
||||||
const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
|
const auto VARIANT = g_pConfigManager->getString("input:kb_variant");
|
||||||
const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
|
const auto OPTIONS = g_pConfigManager->getString("input:kb_options");
|
||||||
|
|
||||||
if (RULES != "" && RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout && VARIANT == pKeyboard->currentRules.variant && OPTIONS == pKeyboard->currentRules.options) {
|
try {
|
||||||
|
if (RULES != "" && RULES == std::string(pKeyboard->currentRules.rules) && MODEL == std::string(pKeyboard->currentRules.model) && LAYOUT == std::string(pKeyboard->currentRules.layout) && VARIANT == std::string(pKeyboard->currentRules.variant) && OPTIONS == std::string(pKeyboard->currentRules.options)) {
|
||||||
Debug::log(LOG, "Not applying config to keyboard, it did not change.");
|
Debug::log(LOG, "Not applying config to keyboard, it did not change.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} catch (std::exception& e) {
|
||||||
|
// can be libc errors for null std::string
|
||||||
|
// we can ignore those and just apply
|
||||||
|
}
|
||||||
|
|
||||||
xkb_rule_names rules = {
|
xkb_rule_names rules = {
|
||||||
.rules = RULES.c_str(),
|
.rules = RULES.c_str(),
|
||||||
|
|
Loading…
Reference in a new issue