diff --git a/src/debug/HyprCtl.cpp b/src/debug/HyprCtl.cpp index 49325887e..3e6a3f085 100644 --- a/src/debug/HyprCtl.cpp +++ b/src/debug/HyprCtl.cpp @@ -603,12 +603,12 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque std::string result = ""; auto getModState = [](SP keyboard, const char* xkbModName) -> bool { - auto IDX = xkb_keymap_mod_get_index(keyboard->xkbKeymap, xkbModName); + auto IDX = xkb_keymap_mod_get_index(keyboard->m_xkbKeymap, xkbModName); if (IDX == XKB_MOD_INVALID) return false; - return (keyboard->modifiersState.locked & (1 << IDX)) > 0; + return (keyboard->m_modifiersState.locked & (1 << IDX)) > 0; }; if (format == eHyprCtlOutputFormat::FORMAT_JSON) { @@ -622,7 +622,7 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque "name": "{}", "defaultSpeed": {:.5f} }},)#", - (uintptr_t)m.get(), escapeJSONStrings(m->hlName), + (uintptr_t)m.get(), escapeJSONStrings(m->m_hlName), m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f); } @@ -646,9 +646,9 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque "numLock": {}, "main": {} }},)#", - (uintptr_t)k.get(), escapeJSONStrings(k->hlName), escapeJSONStrings(k->currentRules.rules), escapeJSONStrings(k->currentRules.model), - escapeJSONStrings(k->currentRules.layout), escapeJSONStrings(k->currentRules.variant), escapeJSONStrings(k->currentRules.options), escapeJSONStrings(KM), - (getModState(k, XKB_MOD_NAME_CAPS) ? "true" : "false"), (getModState(k, XKB_MOD_NAME_NUM) ? "true" : "false"), (k->active ? "true" : "false")); + (uintptr_t)k.get(), escapeJSONStrings(k->m_hlName), escapeJSONStrings(k->m_currentRules.rules), escapeJSONStrings(k->m_currentRules.model), + escapeJSONStrings(k->m_currentRules.layout), escapeJSONStrings(k->m_currentRules.variant), escapeJSONStrings(k->m_currentRules.options), escapeJSONStrings(KM), + (getModState(k, XKB_MOD_NAME_CAPS) ? "true" : "false"), (getModState(k, XKB_MOD_NAME_NUM) ? "true" : "false"), (k->m_active ? "true" : "false")); } trimTrailingComma(result); @@ -666,7 +666,7 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque "name": "{}" }} }},)#", - (uintptr_t)d.get(), (uintptr_t)d->parent.get(), escapeJSONStrings(d->parent ? d->parent->hlName : "")); + (uintptr_t)d.get(), (uintptr_t)d->m_parent.get(), escapeJSONStrings(d->m_parent ? d->m_parent->m_hlName : "")); } for (auto const& d : g_pInputManager->m_vTablets) { @@ -675,7 +675,7 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque "address": "0x{:x}", "name": "{}" }},)#", - (uintptr_t)d.get(), escapeJSONStrings(d->hlName)); + (uintptr_t)d.get(), escapeJSONStrings(d->m_hlName)); } for (auto const& d : g_pInputManager->m_vTabletTools) { @@ -698,7 +698,7 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque "address": "0x{:x}", "name": "{}" }},)#", - (uintptr_t)d.get(), escapeJSONStrings(d->hlName)); + (uintptr_t)d.get(), escapeJSONStrings(d->m_hlName)); } trimTrailingComma(result); @@ -724,7 +724,7 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque result += "mice:\n"; for (auto const& m : g_pInputManager->m_vPointers) { - result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", (uintptr_t)m.get(), m->hlName, + result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", (uintptr_t)m.get(), m->m_hlName, (m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f)); } @@ -732,21 +732,21 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque for (auto const& k : g_pInputManager->m_vKeyboards) { const auto KM = k->getActiveLayout(); - result += - std::format("\tKeyboard at {:x}:\n\t\t{}\n\t\t\trules: r \"{}\", m \"{}\", l \"{}\", v \"{}\", o \"{}\"\n\t\t\tactive keymap: {}\n\t\t\tcapsLock: " - "{}\n\t\t\tnumLock: {}\n\t\t\tmain: {}\n", - (uintptr_t)k.get(), k->hlName, k->currentRules.rules, k->currentRules.model, k->currentRules.layout, k->currentRules.variant, k->currentRules.options, - KM, (getModState(k, XKB_MOD_NAME_CAPS) ? "yes" : "no"), (getModState(k, XKB_MOD_NAME_NUM) ? "yes" : "no"), (k->active ? "yes" : "no")); + result += std::format("\tKeyboard at {:x}:\n\t\t{}\n\t\t\trules: r \"{}\", m \"{}\", l \"{}\", v \"{}\", o \"{}\"\n\t\t\tactive keymap: {}\n\t\t\tcapsLock: " + "{}\n\t\t\tnumLock: {}\n\t\t\tmain: {}\n", + (uintptr_t)k.get(), k->m_hlName, k->m_currentRules.rules, k->m_currentRules.model, k->m_currentRules.layout, k->m_currentRules.variant, + k->m_currentRules.options, KM, (getModState(k, XKB_MOD_NAME_CAPS) ? "yes" : "no"), (getModState(k, XKB_MOD_NAME_NUM) ? "yes" : "no"), + (k->m_active ? "yes" : "no")); } result += "\n\nTablets:\n"; for (auto const& d : g_pInputManager->m_vTabletPads) { - result += std::format("\tTablet Pad at {:x} (belongs to {:x} -> {})\n", (uintptr_t)d.get(), (uintptr_t)d->parent.get(), d->parent ? d->parent->hlName : ""); + result += std::format("\tTablet Pad at {:x} (belongs to {:x} -> {})\n", (uintptr_t)d.get(), (uintptr_t)d->m_parent.get(), d->m_parent ? d->m_parent->m_hlName : ""); } for (auto const& d : g_pInputManager->m_vTablets) { - result += std::format("\tTablet at {:x}:\n\t\t{}\n\t\t\tsize: {}x{}mm\n", (uintptr_t)d.get(), d->hlName, d->aq()->physicalSize.x, d->aq()->physicalSize.y); + result += std::format("\tTablet at {:x}:\n\t\t{}\n\t\t\tsize: {}x{}mm\n", (uintptr_t)d.get(), d->m_hlName, d->aq()->physicalSize.x, d->aq()->physicalSize.y); } for (auto const& d : g_pInputManager->m_vTabletTools) { @@ -756,7 +756,7 @@ static std::string devicesRequest(eHyprCtlOutputFormat format, std::string reque result += "\n\nTouch:\n"; for (auto const& d : g_pInputManager->m_vTouches) { - result += std::format("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)d.get(), d->hlName); + result += std::format("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)d.get(), d->m_hlName); } result += "\n\nSwitches:\n"; @@ -1254,19 +1254,20 @@ static std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::stri SP pKeyboard; auto updateKeyboard = [](const SP KEEB, const std::string& CMD) -> std::optional { - const auto LAYOUTS = xkb_keymap_num_layouts(KEEB->xkbKeymap); + const auto LAYOUTS = xkb_keymap_num_layouts(KEEB->m_xkbKeymap); xkb_layout_index_t activeLayout = 0; while (activeLayout < LAYOUTS) { - if (xkb_state_layout_index_is_active(KEEB->xkbState, activeLayout, XKB_STATE_LAYOUT_EFFECTIVE) == 1) + if (xkb_state_layout_index_is_active(KEEB->m_xkbState, activeLayout, XKB_STATE_LAYOUT_EFFECTIVE) == 1) break; activeLayout++; } if (CMD == "next") - KEEB->updateModifiers(KEEB->modifiersState.depressed, KEEB->modifiersState.latched, KEEB->modifiersState.locked, activeLayout > LAYOUTS ? 0 : activeLayout + 1); + KEEB->updateModifiers(KEEB->m_modifiersState.depressed, KEEB->m_modifiersState.latched, KEEB->m_modifiersState.locked, activeLayout > LAYOUTS ? 0 : activeLayout + 1); else if (CMD == "prev") - KEEB->updateModifiers(KEEB->modifiersState.depressed, KEEB->modifiersState.latched, KEEB->modifiersState.locked, activeLayout == 0 ? LAYOUTS - 1 : activeLayout - 1); + KEEB->updateModifiers(KEEB->m_modifiersState.depressed, KEEB->m_modifiersState.latched, KEEB->m_modifiersState.locked, + activeLayout == 0 ? LAYOUTS - 1 : activeLayout - 1); else { int requestedLayout = 0; try { @@ -1277,7 +1278,7 @@ static std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::stri return "layout idx out of range of " + std::to_string(LAYOUTS); } - KEEB->updateModifiers(KEEB->modifiersState.depressed, KEEB->modifiersState.latched, KEEB->modifiersState.locked, requestedLayout); + KEEB->updateModifiers(KEEB->m_modifiersState.depressed, KEEB->m_modifiersState.latched, KEEB->m_modifiersState.locked, requestedLayout); } return std::nullopt; @@ -1285,7 +1286,7 @@ static std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::stri if (KB == "main" || KB == "active" || KB == "current") { for (auto const& k : g_pInputManager->m_vKeyboards) { - if (!k->active) + if (!k->m_active) continue; pKeyboard = k; @@ -1301,7 +1302,7 @@ static std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::stri return result.empty() ? "ok" : result; } else { auto k = std::find_if(g_pInputManager->m_vKeyboards.begin(), g_pInputManager->m_vKeyboards.end(), - [&](const auto& other) { return other->hlName == g_pInputManager->deviceNameToInternalString(KB); }); + [&](const auto& other) { return other->m_hlName == g_pInputManager->deviceNameToInternalString(KB); }); if (k == g_pInputManager->m_vKeyboards.end()) return "device not found"; diff --git a/src/devices/IHID.hpp b/src/devices/IHID.hpp index b9cc42129..4de5abe65 100644 --- a/src/devices/IHID.hpp +++ b/src/devices/IHID.hpp @@ -34,7 +34,8 @@ class IHID { struct { CSignal destroy; - } events; + } m_events; - std::string deviceName, hlName; + std::string m_deviceName; + std::string m_hlName; }; \ No newline at end of file diff --git a/src/devices/IKeyboard.cpp b/src/devices/IKeyboard.cpp index b8f9c7dde..597724a66 100644 --- a/src/devices/IKeyboard.cpp +++ b/src/devices/IKeyboard.cpp @@ -28,38 +28,38 @@ eHIDType IKeyboard::getType() { } IKeyboard::~IKeyboard() { - events.destroy.emit(); + m_events.destroy.emit(); clearManuallyAllocd(); } void IKeyboard::clearManuallyAllocd() { - if (xkbStaticState) - xkb_state_unref(xkbStaticState); + if (m_xkbStaticState) + xkb_state_unref(m_xkbStaticState); - if (xkbState) - xkb_state_unref(xkbState); + if (m_xkbState) + xkb_state_unref(m_xkbState); - if (xkbKeymap) - xkb_keymap_unref(xkbKeymap); + if (m_xkbKeymap) + xkb_keymap_unref(m_xkbKeymap); - if (xkbSymState) - xkb_state_unref(xkbSymState); + if (m_xkbSymState) + xkb_state_unref(m_xkbSymState); - xkbSymState = nullptr; - xkbKeymap = nullptr; - xkbState = nullptr; - xkbStaticState = nullptr; - xkbKeymapFD.reset(); + m_xkbSymState = nullptr; + m_xkbKeymap = nullptr; + m_xkbState = nullptr; + m_xkbStaticState = nullptr; + m_xkbKeymapFD.reset(); } void IKeyboard::setKeymap(const SStringRuleNames& rules) { - if (keymapOverridden) { + if (m_keymapOverridden) { Debug::log(LOG, "Ignoring setKeymap: keymap is overridden"); return; } - currentRules = rules; + m_currentRules = rules; xkb_rule_names XKBRULES = { .rules = rules.rules.c_str(), .model = rules.model.c_str(), @@ -80,21 +80,21 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) { Debug::log(LOG, "Attempting to create a keymap for layout {} with variant {} (rules: {}, model: {}, options: {})", rules.layout, rules.variant, rules.rules, rules.model, rules.options); - if (!xkbFilePath.empty()) { - auto path = absolutePath(xkbFilePath, g_pConfigManager->m_configCurrentPath); + if (!m_xkbFilePath.empty()) { + auto path = absolutePath(m_xkbFilePath, g_pConfigManager->m_configCurrentPath); if (FILE* const KEYMAPFILE = fopen(path.c_str(), "r"); !KEYMAPFILE) Debug::log(ERR, "Cannot open input:kb_file= file for reading"); else { - xkbKeymap = xkb_keymap_new_from_file(CONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); + m_xkbKeymap = xkb_keymap_new_from_file(CONTEXT, KEYMAPFILE, XKB_KEYMAP_FORMAT_TEXT_V1, XKB_KEYMAP_COMPILE_NO_FLAGS); fclose(KEYMAPFILE); } } - if (!xkbKeymap) - xkbKeymap = xkb_keymap_new_from_names(CONTEXT, &XKBRULES, XKB_KEYMAP_COMPILE_NO_FLAGS); + if (!m_xkbKeymap) + m_xkbKeymap = xkb_keymap_new_from_names(CONTEXT, &XKBRULES, XKB_KEYMAP_COMPILE_NO_FLAGS); - if (!xkbKeymap) { + if (!m_xkbKeymap) { g_pConfigManager->addParseError("Invalid keyboard layout passed. ( rules: " + rules.rules + ", model: " + rules.model + ", variant: " + rules.variant + ", options: " + rules.options + ", layout: " + rules.layout + " )"); @@ -102,38 +102,38 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) { rules.options); memset(&XKBRULES, 0, sizeof(XKBRULES)); - currentRules.rules = ""; - currentRules.model = ""; - currentRules.variant = ""; - currentRules.options = ""; - currentRules.layout = "us"; + m_currentRules.rules = ""; + m_currentRules.model = ""; + m_currentRules.variant = ""; + m_currentRules.options = ""; + m_currentRules.layout = "us"; - xkbKeymap = xkb_keymap_new_from_names(CONTEXT, &XKBRULES, XKB_KEYMAP_COMPILE_NO_FLAGS); + m_xkbKeymap = xkb_keymap_new_from_names(CONTEXT, &XKBRULES, XKB_KEYMAP_COMPILE_NO_FLAGS); } - updateXKBTranslationState(xkbKeymap); + updateXKBTranslationState(m_xkbKeymap); - const auto NUMLOCKON = g_pConfigManager->getDeviceInt(hlName, "numlock_by_default", "input:numlock_by_default"); + const auto NUMLOCKON = g_pConfigManager->getDeviceInt(m_hlName, "numlock_by_default", "input:numlock_by_default"); if (NUMLOCKON == 1) { // lock numlock - const auto IDX = xkb_map_mod_get_index(xkbKeymap, XKB_MOD_NAME_NUM); + const auto IDX = xkb_map_mod_get_index(m_xkbKeymap, XKB_MOD_NAME_NUM); if (IDX != XKB_MOD_INVALID) - modifiersState.locked |= (uint32_t)1 << IDX; + m_modifiersState.locked |= (uint32_t)1 << IDX; // 0 to avoid mods getting stuck if depressed during reload - updateModifiers(0, 0, modifiersState.locked, modifiersState.group); + updateModifiers(0, 0, m_modifiersState.locked, m_modifiersState.group); } - for (size_t i = 0; i < std::min(LEDNAMES.size(), ledIndexes.size()); ++i) { - ledIndexes[i] = xkb_map_led_get_index(xkbKeymap, LEDNAMES[i]); - Debug::log(LOG, "xkb: LED index {} (name {}) got index {}", i, LEDNAMES[i], ledIndexes[i]); + for (size_t i = 0; i < std::min(LEDNAMES.size(), m_ledIndexes.size()); ++i) { + m_ledIndexes[i] = xkb_map_led_get_index(m_xkbKeymap, LEDNAMES[i]); + Debug::log(LOG, "xkb: LED index {} (name {}) got index {}", i, LEDNAMES[i], m_ledIndexes[i]); } - for (size_t i = 0; i < std::min(MODNAMES.size(), modIndexes.size()); ++i) { - modIndexes[i] = xkb_map_mod_get_index(xkbKeymap, MODNAMES[i]); - Debug::log(LOG, "xkb: Mod index {} (name {}) got index {}", i, MODNAMES[i], modIndexes[i]); + for (size_t i = 0; i < std::min(MODNAMES.size(), m_modIndexes.size()); ++i) { + m_modIndexes[i] = xkb_map_mod_get_index(m_xkbKeymap, MODNAMES[i]); + Debug::log(LOG, "xkb: Mod index {} (name {}) got index {}", i, MODNAMES[i], m_modIndexes[i]); } updateKeymapFD(); @@ -144,59 +144,59 @@ void IKeyboard::setKeymap(const SStringRuleNames& rules) { } void IKeyboard::updateKeymapFD() { - Debug::log(LOG, "Updating keymap fd for keyboard {}", deviceName); + Debug::log(LOG, "Updating keymap fd for keyboard {}", m_deviceName); - if (xkbKeymapFD.isValid()) - xkbKeymapFD.reset(); + if (m_xkbKeymapFD.isValid()) + m_xkbKeymapFD.reset(); - auto cKeymapStr = xkb_keymap_get_as_string(xkbKeymap, XKB_KEYMAP_FORMAT_TEXT_V1); - xkbKeymapString = cKeymapStr; + auto cKeymapStr = xkb_keymap_get_as_string(m_xkbKeymap, XKB_KEYMAP_FORMAT_TEXT_V1); + m_xkbKeymapString = cKeymapStr; free(cKeymapStr); CFileDescriptor rw, ro; - if (!allocateSHMFilePair(xkbKeymapString.length() + 1, rw, ro)) + if (!allocateSHMFilePair(m_xkbKeymapString.length() + 1, rw, ro)) Debug::log(ERR, "IKeyboard: failed to allocate shm pair for the keymap"); else { - auto keymapFDDest = mmap(nullptr, xkbKeymapString.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, rw.get(), 0); + auto keymapFDDest = mmap(nullptr, m_xkbKeymapString.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, rw.get(), 0); rw.reset(); if (keymapFDDest == MAP_FAILED) { Debug::log(ERR, "IKeyboard: failed to mmap a shm pair for the keymap"); ro.reset(); } else { - memcpy(keymapFDDest, xkbKeymapString.c_str(), xkbKeymapString.length()); - munmap(keymapFDDest, xkbKeymapString.length() + 1); - xkbKeymapFD = std::move(ro); + memcpy(keymapFDDest, m_xkbKeymapString.c_str(), m_xkbKeymapString.length()); + munmap(keymapFDDest, m_xkbKeymapString.length() + 1); + m_xkbKeymapFD = std::move(ro); } } - Debug::log(LOG, "Updated keymap fd to {}", xkbKeymapFD.get()); + Debug::log(LOG, "Updated keymap fd to {}", m_xkbKeymapFD.get()); } void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) { - if (xkbStaticState) - xkb_state_unref(xkbStaticState); + if (m_xkbStaticState) + xkb_state_unref(m_xkbStaticState); - if (xkbState) - xkb_state_unref(xkbState); + if (m_xkbState) + xkb_state_unref(m_xkbState); - if (xkbSymState) - xkb_state_unref(xkbSymState); + if (m_xkbSymState) + xkb_state_unref(m_xkbSymState); - xkbState = nullptr; - xkbStaticState = nullptr; - xkbSymState = nullptr; + m_xkbState = nullptr; + m_xkbStaticState = nullptr; + m_xkbSymState = nullptr; if (keymap) { Debug::log(LOG, "Updating keyboard {:x}'s translation state from a provided keymap", (uintptr_t)this); - xkbStaticState = xkb_state_new(keymap); - xkbState = xkb_state_new(keymap); - xkbSymState = xkb_state_new(keymap); + m_xkbStaticState = xkb_state_new(keymap); + m_xkbState = xkb_state_new(keymap); + m_xkbSymState = xkb_state_new(keymap); return; } - const auto KEYMAP = xkbKeymap; - const auto STATE = xkbState; + const auto KEYMAP = m_xkbKeymap; + const auto STATE = m_xkbState; const auto LAYOUTSNUM = xkb_keymap_num_layouts(KEYMAP); const auto PCONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS); @@ -205,9 +205,9 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) { if (xkb_state_layout_index_is_active(STATE, i, XKB_STATE_LAYOUT_EFFECTIVE) == 1) { Debug::log(LOG, "Updating keyboard {:x}'s translation state from an active index {}", (uintptr_t)this, i); - CVarList keyboardLayouts(currentRules.layout, 0, ','); - CVarList keyboardModels(currentRules.model, 0, ','); - CVarList keyboardVariants(currentRules.variant, 0, ','); + CVarList keyboardLayouts(m_currentRules.layout, 0, ','); + CVarList keyboardModels(m_currentRules.model, 0, ','); + CVarList keyboardVariants(m_currentRules.variant, 0, ','); xkb_rule_names rules = {.rules = "", .model = "", .layout = "", .variant = "", .options = ""}; @@ -235,9 +235,9 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) { KEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); } - xkbState = xkb_state_new(KEYMAP); - xkbStaticState = xkb_state_new(KEYMAP); - xkbSymState = xkb_state_new(KEYMAP); + m_xkbState = xkb_state_new(KEYMAP); + m_xkbStaticState = xkb_state_new(KEYMAP); + m_xkbSymState = xkb_state_new(KEYMAP); xkb_keymap_unref(KEYMAP); xkb_context_unref(PCONTEXT); @@ -249,26 +249,26 @@ void IKeyboard::updateXKBTranslationState(xkb_keymap* const keymap) { Debug::log(LOG, "Updating keyboard {:x}'s translation state from an unknown index", (uintptr_t)this); xkb_rule_names rules = { - .rules = currentRules.rules.c_str(), - .model = currentRules.model.c_str(), - .layout = currentRules.layout.c_str(), - .variant = currentRules.variant.c_str(), - .options = currentRules.options.c_str(), + .rules = m_currentRules.rules.c_str(), + .model = m_currentRules.model.c_str(), + .layout = m_currentRules.layout.c_str(), + .variant = m_currentRules.variant.c_str(), + .options = m_currentRules.options.c_str(), }; const auto NEWKEYMAP = xkb_keymap_new_from_names(PCONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS); - xkbState = xkb_state_new(NEWKEYMAP); - xkbStaticState = xkb_state_new(NEWKEYMAP); - xkbSymState = xkb_state_new(NEWKEYMAP); + m_xkbState = xkb_state_new(NEWKEYMAP); + m_xkbStaticState = xkb_state_new(NEWKEYMAP); + m_xkbSymState = xkb_state_new(NEWKEYMAP); xkb_keymap_unref(NEWKEYMAP); xkb_context_unref(PCONTEXT); } std::string IKeyboard::getActiveLayout() { - const auto KEYMAP = xkbKeymap; - const auto STATE = xkbState; + const auto KEYMAP = m_xkbKeymap; + const auto STATE = m_xkbState; const auto LAYOUTSNUM = xkb_keymap_num_layouts(KEYMAP); for (uint32_t i = 0; i < LAYOUTSNUM; ++i) { @@ -285,12 +285,12 @@ std::string IKeyboard::getActiveLayout() { } std::optional IKeyboard::getLEDs() { - if (xkbState == nullptr) + if (m_xkbState == nullptr) return {}; uint32_t leds = 0; - for (uint32_t i = 0; i < std::min((size_t)LED_COUNT, ledIndexes.size()); ++i) { - if (xkb_state_led_index_is_active(xkbState, ledIndexes[i])) + for (uint32_t i = 0; i < std::min((size_t)LED_COUNT, m_ledIndexes.size()); ++i) { + if (xkb_state_led_index_is_active(m_xkbState, m_ledIndexes[i])) leds |= (1 << i); } @@ -307,10 +307,10 @@ void IKeyboard::updateLEDs() { } void IKeyboard::updateLEDs(uint32_t leds) { - if (!xkbState) + if (!m_xkbState) return; - if (isVirtual() && g_pInputManager->shouldIgnoreVirtualKeyboard(self.lock())) + if (isVirtual() && g_pInputManager->shouldIgnoreVirtualKeyboard(m_self.lock())) return; if (!aq()) @@ -320,13 +320,13 @@ void IKeyboard::updateLEDs(uint32_t leds) { } uint32_t IKeyboard::getModifiers() { - uint32_t modMask = modifiersState.depressed | modifiersState.latched; + uint32_t modMask = m_modifiersState.depressed | m_modifiersState.latched; uint32_t mods = 0; - for (size_t i = 0; i < modIndexes.size(); ++i) { - if (modIndexes[i] == XKB_MOD_INVALID) + for (size_t i = 0; i < m_modIndexes.size(); ++i) { + if (m_modIndexes[i] == XKB_MOD_INVALID) continue; - if (!(modMask & (1 << modIndexes[i]))) + if (!(modMask & (1 << m_modIndexes[i]))) continue; mods |= (1 << i); @@ -336,50 +336,50 @@ uint32_t IKeyboard::getModifiers() { } void IKeyboard::updateModifiers(uint32_t depressed, uint32_t latched, uint32_t locked, uint32_t group) { - if (!xkbState) + if (!m_xkbState) return; - xkb_state_update_mask(xkbState, depressed, latched, locked, 0, 0, group); + xkb_state_update_mask(m_xkbState, depressed, latched, locked, 0, 0, group); - if (xkbSymState) - xkb_state_update_mask(xkbSymState, 0, 0, 0, 0, 0, group); + if (m_xkbSymState) + xkb_state_update_mask(m_xkbSymState, 0, 0, 0, 0, 0, group); if (!updateModifiersState()) return; - keyboardEvents.modifiers.emit(SModifiersEvent{ - .depressed = modifiersState.depressed, - .latched = modifiersState.latched, - .locked = modifiersState.locked, - .group = modifiersState.group, + m_keyboardEvents.modifiers.emit(SModifiersEvent{ + .depressed = m_modifiersState.depressed, + .latched = m_modifiersState.latched, + .locked = m_modifiersState.locked, + .group = m_modifiersState.group, }); updateLEDs(); } bool IKeyboard::updateModifiersState() { - if (!xkbState) + if (!m_xkbState) return false; - auto depressed = xkb_state_serialize_mods(xkbState, XKB_STATE_MODS_DEPRESSED); - auto latched = xkb_state_serialize_mods(xkbState, XKB_STATE_MODS_LATCHED); - auto locked = xkb_state_serialize_mods(xkbState, XKB_STATE_MODS_LOCKED); - auto group = xkb_state_serialize_layout(xkbState, XKB_STATE_LAYOUT_EFFECTIVE); + auto depressed = xkb_state_serialize_mods(m_xkbState, XKB_STATE_MODS_DEPRESSED); + auto latched = xkb_state_serialize_mods(m_xkbState, XKB_STATE_MODS_LATCHED); + auto locked = xkb_state_serialize_mods(m_xkbState, XKB_STATE_MODS_LOCKED); + auto group = xkb_state_serialize_layout(m_xkbState, XKB_STATE_LAYOUT_EFFECTIVE); - if (depressed == modifiersState.depressed && latched == modifiersState.latched && locked == modifiersState.locked && group == modifiersState.group) + if (depressed == m_modifiersState.depressed && latched == m_modifiersState.latched && locked == m_modifiersState.locked && group == m_modifiersState.group) return false; - modifiersState.depressed = depressed; - modifiersState.latched = latched; - modifiersState.locked = locked; - modifiersState.group = group; + m_modifiersState.depressed = depressed; + m_modifiersState.latched = latched; + m_modifiersState.locked = locked; + m_modifiersState.group = group; return true; } void IKeyboard::updateXkbStateWithKey(uint32_t xkbKey, bool pressed) { - const auto contains = std::find(pressedXKB.begin(), pressedXKB.end(), xkbKey) != pressedXKB.end(); + const auto contains = std::find(m_pressedXKB.begin(), m_pressedXKB.end(), xkbKey) != m_pressedXKB.end(); if (contains && pressed) return; @@ -387,21 +387,21 @@ void IKeyboard::updateXkbStateWithKey(uint32_t xkbKey, bool pressed) { return; if (contains) - std::erase(pressedXKB, xkbKey); + std::erase(m_pressedXKB, xkbKey); else - pressedXKB.emplace_back(xkbKey); + m_pressedXKB.emplace_back(xkbKey); - xkb_state_update_key(xkbState, xkbKey, pressed ? XKB_KEY_DOWN : XKB_KEY_UP); + xkb_state_update_key(m_xkbState, xkbKey, pressed ? XKB_KEY_DOWN : XKB_KEY_UP); if (updateModifiersState()) { - if (xkbSymState) - xkb_state_update_mask(xkbSymState, 0, 0, 0, 0, 0, modifiersState.group); + if (m_xkbSymState) + xkb_state_update_mask(m_xkbSymState, 0, 0, 0, 0, 0, m_modifiersState.group); - keyboardEvents.modifiers.emit(SModifiersEvent{ - .depressed = modifiersState.depressed, - .latched = modifiersState.latched, - .locked = modifiersState.locked, - .group = modifiersState.group, + m_keyboardEvents.modifiers.emit(SModifiersEvent{ + .depressed = m_modifiersState.depressed, + .latched = m_modifiersState.latched, + .locked = m_modifiersState.locked, + .group = m_modifiersState.group, }); } } diff --git a/src/devices/IKeyboard.hpp b/src/devices/IKeyboard.hpp index 7ac71172a..3d7b2dd1a 100644 --- a/src/devices/IKeyboard.hpp +++ b/src/devices/IKeyboard.hpp @@ -52,7 +52,7 @@ class IKeyboard : public IHID { CSignal modifiers; CSignal keymap; CSignal repeatInfo; - } keyboardEvents; + } m_keyboardEvents; struct SStringRuleNames { std::string layout = ""; @@ -74,42 +74,46 @@ class IKeyboard : public IHID { void updateXkbStateWithKey(uint32_t xkbKey, bool pressed); void updateKeymapFD(); - bool active = false; - bool enabled = true; - bool allowBinds = true; + bool m_active = false; + bool m_enabled = true; + bool m_allowBinds = true; // if the keymap is overridden by the implementation, // don't try to set keyboard rules anymore, to avoid overwriting the requested one. // e.g. Virtual keyboards with custom maps. - bool keymapOverridden = false; + bool m_keymapOverridden = false; - xkb_layout_index_t activeLayout = 0; - xkb_state * xkbState = nullptr, *xkbStaticState /* Static state: never gets modifiers or layout changes sent, used for keybinds. */ = nullptr, - *xkbSymState = nullptr /* Same as static but gets layouts */; - xkb_keymap* xkbKeymap = nullptr; + xkb_layout_index_t m_activeLayout = 0; + xkb_state* m_xkbState = nullptr; + + // never gets modifiers or layout changes sent, used for keybinds + xkb_state* m_xkbStaticState = nullptr; + xkb_state* m_xkbSymState = nullptr; // same as static but gets layouts + + xkb_keymap* m_xkbKeymap = nullptr; struct { uint32_t depressed = 0, latched = 0, locked = 0, group = 0; - } modifiersState; + } m_modifiersState; - std::array ledIndexes = {XKB_MOD_INVALID}; - std::array modIndexes = {XKB_MOD_INVALID}; - uint32_t leds = 0; + std::array m_ledIndexes = {XKB_MOD_INVALID}; + std::array m_modIndexes = {XKB_MOD_INVALID}; + uint32_t m_leds = 0; - std::string xkbFilePath = ""; - std::string xkbKeymapString = ""; - Hyprutils::OS::CFileDescriptor xkbKeymapFD; + std::string m_xkbFilePath = ""; + std::string m_xkbKeymapString = ""; + Hyprutils::OS::CFileDescriptor m_xkbKeymapFD; - SStringRuleNames currentRules; - int repeatRate = 0; - int repeatDelay = 0; - int numlockOn = -1; - bool resolveBindsBySym = false; + SStringRuleNames m_currentRules; + int m_repeatRate = 0; + int m_repeatDelay = 0; + int m_numlockOn = -1; + bool m_resolveBindsBySym = false; - WP self; + WP m_self; private: void clearManuallyAllocd(); - std::vector pressedXKB; + std::vector m_pressedXKB; }; diff --git a/src/devices/IPointer.hpp b/src/devices/IPointer.hpp index d55412225..993095e00 100644 --- a/src/devices/IPointer.hpp +++ b/src/devices/IPointer.hpp @@ -106,13 +106,13 @@ class IPointer : public IHID { CSignal holdBegin; CSignal holdEnd; - } pointerEvents; + } m_pointerEvents; - bool connected = false; // means connected to the cursor - std::string boundOutput = ""; - bool flipX = false; // decide to invert horizontal movement - bool flipY = false; // decide to invert vertical movement - bool isTouchpad = false; + bool m_connected = false; // means connected to the cursor + std::string m_boundOutput = ""; + bool m_flipX = false; // decide to invert horizontal movement + bool m_flipY = false; // decide to invert vertical movement + bool m_isTouchpad = false; - WP self; + WP m_self; }; diff --git a/src/devices/ITouch.hpp b/src/devices/ITouch.hpp index 766c0510b..e52303946 100644 --- a/src/devices/ITouch.hpp +++ b/src/devices/ITouch.hpp @@ -42,9 +42,9 @@ class ITouch : public IHID { CSignal motion; CSignal cancel; CSignal frame; - } touchEvents; + } m_touchEvents; - std::string boundOutput = ""; + std::string m_boundOutput = ""; - WP self; + WP m_self; }; \ No newline at end of file diff --git a/src/devices/Keyboard.cpp b/src/devices/Keyboard.cpp index 191cc6b24..70abe54d6 100644 --- a/src/devices/Keyboard.cpp +++ b/src/devices/Keyboard.cpp @@ -6,7 +6,7 @@ SP CKeyboard::create(SP keeb) { SP pKeeb = SP(new CKeyboard(keeb)); - pKeeb->self = pKeeb; + pKeeb->m_self = pKeeb; return pKeeb; } @@ -16,22 +16,22 @@ bool CKeyboard::isVirtual() { } SP CKeyboard::aq() { - return keyboard.lock(); + return m_keyboard.lock(); } -CKeyboard::CKeyboard(SP keeb) : keyboard(keeb) { +CKeyboard::CKeyboard(SP keeb) : m_keyboard(keeb) { if (!keeb) return; - listeners.destroy = keeb->events.destroy.registerListener([this](std::any d) { - keyboard.reset(); - events.destroy.emit(); + m_listeners.destroy = keeb->events.destroy.registerListener([this](std::any d) { + m_keyboard.reset(); + m_events.destroy.emit(); }); - listeners.key = keeb->events.key.registerListener([this](std::any d) { + m_listeners.key = keeb->events.key.registerListener([this](std::any d) { auto E = std::any_cast(d); - keyboardEvents.key.emit(SKeyEvent{ + m_keyboardEvents.key.emit(SKeyEvent{ .timeMs = E.timeMs, .keycode = E.key, .state = E.pressed ? WL_KEYBOARD_KEY_STATE_PRESSED : WL_KEYBOARD_KEY_STATE_RELEASED, @@ -40,16 +40,16 @@ CKeyboard::CKeyboard(SP keeb) : keyboard(keeb) { updateXkbStateWithKey(E.key + 8, E.pressed); }); - listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) { + m_listeners.modifiers = keeb->events.modifiers.registerListener([this](std::any d) { updateModifiersState(); - keyboardEvents.modifiers.emit(SModifiersEvent{ - .depressed = modifiersState.depressed, - .latched = modifiersState.latched, - .locked = modifiersState.locked, - .group = modifiersState.group, + m_keyboardEvents.modifiers.emit(SModifiersEvent{ + .depressed = m_modifiersState.depressed, + .latched = m_modifiersState.latched, + .locked = m_modifiersState.locked, + .group = m_modifiersState.group, }); }); - deviceName = keeb->getName(); + m_deviceName = keeb->getName(); } diff --git a/src/devices/Keyboard.hpp b/src/devices/Keyboard.hpp index f6de43cb5..2ba4626d0 100644 --- a/src/devices/Keyboard.hpp +++ b/src/devices/Keyboard.hpp @@ -12,11 +12,11 @@ class CKeyboard : public IKeyboard { private: CKeyboard(SP keeb); - WP keyboard; + WP m_keyboard; struct { CHyprSignalListener destroy; CHyprSignalListener key; CHyprSignalListener modifiers; - } listeners; + } m_listeners; }; \ No newline at end of file diff --git a/src/devices/Mouse.cpp b/src/devices/Mouse.cpp index 600ae5a89..539aecf7e 100644 --- a/src/devices/Mouse.cpp +++ b/src/devices/Mouse.cpp @@ -5,51 +5,51 @@ SP CMouse::create(SP mouse) { SP pMouse = SP(new CMouse(mouse)); - pMouse->self = pMouse; + pMouse->m_self = pMouse; return pMouse; } -CMouse::CMouse(SP mouse_) : mouse(mouse_) { - if (!mouse) +CMouse::CMouse(SP mouse_) : m_mouse(mouse_) { + if (!m_mouse) return; - if (auto handle = mouse->getLibinputHandle()) { + if (auto handle = m_mouse->getLibinputHandle()) { double w = 0, h = 0; - isTouchpad = libinput_device_has_capability(handle, LIBINPUT_DEVICE_CAP_POINTER) && libinput_device_get_size(handle, &w, &h) == 0; + m_isTouchpad = libinput_device_has_capability(handle, LIBINPUT_DEVICE_CAP_POINTER) && libinput_device_get_size(handle, &w, &h) == 0; } - listeners.destroy = mouse->events.destroy.registerListener([this](std::any d) { - mouse.reset(); - events.destroy.emit(); + m_listeners.destroy = m_mouse->events.destroy.registerListener([this](std::any d) { + m_mouse.reset(); + m_events.destroy.emit(); }); - listeners.motion = mouse->events.move.registerListener([this](std::any d) { + m_listeners.motion = m_mouse->events.move.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.motion.emit(SMotionEvent{ + m_pointerEvents.motion.emit(SMotionEvent{ .timeMs = E.timeMs, .delta = E.delta, .unaccel = E.unaccel, .mouse = true, - .device = self.lock(), + .device = m_self.lock(), }); }); - listeners.motionAbsolute = mouse->events.warp.registerListener([this](std::any d) { + m_listeners.motionAbsolute = m_mouse->events.warp.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.motionAbsolute.emit(SMotionAbsoluteEvent{ + m_pointerEvents.motionAbsolute.emit(SMotionAbsoluteEvent{ .timeMs = E.timeMs, .absolute = E.absolute, - .device = self.lock(), + .device = m_self.lock(), }); }); - listeners.button = mouse->events.button.registerListener([this](std::any d) { + m_listeners.button = m_mouse->events.button.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.button.emit(SButtonEvent{ + m_pointerEvents.button.emit(SButtonEvent{ .timeMs = E.timeMs, .button = E.button, .state = E.pressed ? WL_POINTER_BUTTON_STATE_PRESSED : WL_POINTER_BUTTON_STATE_RELEASED, @@ -57,10 +57,10 @@ CMouse::CMouse(SP mouse_) : mouse(mouse_) { }); }); - listeners.axis = mouse->events.axis.registerListener([this](std::any d) { + m_listeners.axis = m_mouse->events.axis.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.axis.emit(SAxisEvent{ + m_pointerEvents.axis.emit(SAxisEvent{ .timeMs = E.timeMs, .source = (wl_pointer_axis_source)E.source, .axis = (wl_pointer_axis)E.axis, @@ -71,58 +71,58 @@ CMouse::CMouse(SP mouse_) : mouse(mouse_) { }); }); - listeners.frame = mouse->events.frame.registerListener([this](std::any d) { pointerEvents.frame.emit(); }); + m_listeners.frame = m_mouse->events.frame.registerListener([this](std::any d) { m_pointerEvents.frame.emit(); }); - listeners.swipeBegin = mouse->events.swipeBegin.registerListener([this](std::any d) { + m_listeners.swipeBegin = m_mouse->events.swipeBegin.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.swipeBegin.emit(SSwipeBeginEvent{ + m_pointerEvents.swipeBegin.emit(SSwipeBeginEvent{ .timeMs = E.timeMs, .fingers = E.fingers, }); }); - listeners.swipeEnd = mouse->events.swipeEnd.registerListener([this](std::any d) { + m_listeners.swipeEnd = m_mouse->events.swipeEnd.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.swipeEnd.emit(SSwipeEndEvent{ + m_pointerEvents.swipeEnd.emit(SSwipeEndEvent{ .timeMs = E.timeMs, .cancelled = E.cancelled, }); }); - listeners.swipeUpdate = mouse->events.swipeUpdate.registerListener([this](std::any d) { + m_listeners.swipeUpdate = m_mouse->events.swipeUpdate.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.swipeUpdate.emit(SSwipeUpdateEvent{ + m_pointerEvents.swipeUpdate.emit(SSwipeUpdateEvent{ .timeMs = E.timeMs, .fingers = E.fingers, .delta = E.delta, }); }); - listeners.pinchBegin = mouse->events.pinchBegin.registerListener([this](std::any d) { + m_listeners.pinchBegin = m_mouse->events.pinchBegin.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.pinchBegin.emit(SPinchBeginEvent{ + m_pointerEvents.pinchBegin.emit(SPinchBeginEvent{ .timeMs = E.timeMs, .fingers = E.fingers, }); }); - listeners.pinchEnd = mouse->events.pinchEnd.registerListener([this](std::any d) { + m_listeners.pinchEnd = m_mouse->events.pinchEnd.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.pinchEnd.emit(SPinchEndEvent{ + m_pointerEvents.pinchEnd.emit(SPinchEndEvent{ .timeMs = E.timeMs, .cancelled = E.cancelled, }); }); - listeners.pinchUpdate = mouse->events.pinchUpdate.registerListener([this](std::any d) { + m_listeners.pinchUpdate = m_mouse->events.pinchUpdate.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.pinchUpdate.emit(SPinchUpdateEvent{ + m_pointerEvents.pinchUpdate.emit(SPinchUpdateEvent{ .timeMs = E.timeMs, .fingers = E.fingers, .delta = E.delta, @@ -131,25 +131,25 @@ CMouse::CMouse(SP mouse_) : mouse(mouse_) { }); }); - listeners.holdBegin = mouse->events.holdBegin.registerListener([this](std::any d) { + m_listeners.holdBegin = m_mouse->events.holdBegin.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.holdBegin.emit(SHoldBeginEvent{ + m_pointerEvents.holdBegin.emit(SHoldBeginEvent{ .timeMs = E.timeMs, .fingers = E.fingers, }); }); - listeners.holdEnd = mouse->events.holdEnd.registerListener([this](std::any d) { + m_listeners.holdEnd = m_mouse->events.holdEnd.registerListener([this](std::any d) { auto E = std::any_cast(d); - pointerEvents.holdEnd.emit(SHoldEndEvent{ + m_pointerEvents.holdEnd.emit(SHoldEndEvent{ .timeMs = E.timeMs, .cancelled = E.cancelled, }); }); - deviceName = mouse->getName(); + m_deviceName = m_mouse->getName(); } bool CMouse::isVirtual() { @@ -157,5 +157,5 @@ bool CMouse::isVirtual() { } SP CMouse::aq() { - return mouse.lock(); + return m_mouse.lock(); } diff --git a/src/devices/Mouse.hpp b/src/devices/Mouse.hpp index 2b51fbe94..f99b663e2 100644 --- a/src/devices/Mouse.hpp +++ b/src/devices/Mouse.hpp @@ -12,7 +12,7 @@ class CMouse : public IPointer { private: CMouse(SP mouse); - WP mouse; + WP m_mouse; struct { CHyprSignalListener destroy; @@ -33,5 +33,5 @@ class CMouse : public IPointer { CHyprSignalListener holdBegin; CHyprSignalListener holdEnd; - } listeners; + } m_listeners; }; diff --git a/src/devices/Tablet.cpp b/src/devices/Tablet.cpp index 99e436fb3..e4c399c99 100644 --- a/src/devices/Tablet.cpp +++ b/src/devices/Tablet.cpp @@ -7,7 +7,7 @@ SP CTablet::create(SP tablet) { SP pTab = SP(new CTablet(tablet)); - pTab->self = pTab; + pTab->m_self = pTab; PROTO::tablet->registerDevice(pTab); @@ -17,7 +17,7 @@ SP CTablet::create(SP tablet) { SP CTabletTool::create(SP tablet) { SP pTab = SP(new CTabletTool(tablet)); - pTab->self = pTab; + pTab->m_self = pTab; PROTO::tablet->registerDevice(pTab); @@ -27,7 +27,7 @@ SP CTabletTool::create(SP tablet) { SP CTabletPad::create(SP tablet) { SP pTab = SP(new CTabletPad(tablet)); - pTab->self = pTab; + pTab->m_self = pTab; PROTO::tablet->registerDevice(pTab); @@ -62,24 +62,24 @@ uint32_t CTablet::getCapabilities() { } SP CTablet::aq() { - return tablet.lock(); + return m_tablet.lock(); } -CTablet::CTablet(SP tablet_) : tablet(tablet_) { - if (!tablet) +CTablet::CTablet(SP tablet_) : m_tablet(tablet_) { + if (!m_tablet) return; - listeners.destroy = tablet->events.destroy.registerListener([this](std::any d) { - tablet.reset(); - events.destroy.emit(); + m_listeners.destroy = m_tablet->events.destroy.registerListener([this](std::any d) { + m_tablet.reset(); + m_events.destroy.emit(); }); - listeners.axis = tablet->events.axis.registerListener([this](std::any d) { + m_listeners.axis = m_tablet->events.axis.registerListener([this](std::any d) { auto E = std::any_cast(d); - tabletEvents.axis.emit(SAxisEvent{ + m_tabletEvents.axis.emit(SAxisEvent{ .tool = E.tool, - .tablet = self.lock(), + .tablet = m_self.lock(), .timeMs = E.timeMs, .updatedAxes = aqUpdateToHl(E.updatedAxes), .axis = E.absolute, @@ -93,43 +93,43 @@ CTablet::CTablet(SP tablet_) : tablet(tablet_) { }); }); - listeners.proximity = tablet->events.proximity.registerListener([this](std::any d) { + m_listeners.proximity = m_tablet->events.proximity.registerListener([this](std::any d) { auto E = std::any_cast(d); - tabletEvents.proximity.emit(SProximityEvent{ + m_tabletEvents.proximity.emit(SProximityEvent{ .tool = E.tool, - .tablet = self.lock(), + .tablet = m_self.lock(), .timeMs = E.timeMs, .proximity = E.absolute, .in = E.in, }); }); - listeners.tip = tablet->events.tip.registerListener([this](std::any d) { + m_listeners.tip = m_tablet->events.tip.registerListener([this](std::any d) { auto E = std::any_cast(d); - tabletEvents.tip.emit(STipEvent{ + m_tabletEvents.tip.emit(STipEvent{ .tool = E.tool, - .tablet = self.lock(), + .tablet = m_self.lock(), .timeMs = E.timeMs, .tip = E.absolute, .in = E.down, }); }); - listeners.button = tablet->events.button.registerListener([this](std::any d) { + m_listeners.button = m_tablet->events.button.registerListener([this](std::any d) { auto E = std::any_cast(d); - tabletEvents.button.emit(SButtonEvent{ + m_tabletEvents.button.emit(SButtonEvent{ .tool = E.tool, - .tablet = self.lock(), + .tablet = m_self.lock(), .timeMs = E.timeMs, .button = E.button, .down = E.down, }); }); - deviceName = tablet->getName(); + m_deviceName = m_tablet->getName(); } CTablet::~CTablet() { @@ -145,26 +145,26 @@ uint32_t CTabletPad::getCapabilities() { } SP CTabletPad::aq() { - return pad.lock(); + return m_pad.lock(); } eHIDType CTabletPad::getType() { return HID_TYPE_TABLET_PAD; } -CTabletPad::CTabletPad(SP pad_) : pad(pad_) { - if (!pad) +CTabletPad::CTabletPad(SP pad_) : m_pad(pad_) { + if (!m_pad) return; - listeners.destroy = pad->events.destroy.registerListener([this](std::any d) { - pad.reset(); - events.destroy.emit(); + m_listeners.destroy = m_pad->events.destroy.registerListener([this](std::any d) { + m_pad.reset(); + m_events.destroy.emit(); }); - listeners.button = pad->events.button.registerListener([this](std::any d) { + m_listeners.button = m_pad->events.button.registerListener([this](std::any d) { auto E = std::any_cast(d); - padEvents.button.emit(SButtonEvent{ + m_padEvents.button.emit(SButtonEvent{ .timeMs = E.timeMs, .button = E.button, .down = E.down, @@ -173,10 +173,10 @@ CTabletPad::CTabletPad(SP pad_) : pad(pad_) { }); }); - listeners.ring = pad->events.ring.registerListener([this](std::any d) { + m_listeners.ring = m_pad->events.ring.registerListener([this](std::any d) { auto E = std::any_cast(d); - padEvents.ring.emit(SRingEvent{ + m_padEvents.ring.emit(SRingEvent{ .timeMs = E.timeMs, .finger = E.source == Aquamarine::ITabletPad::AQ_TABLET_PAD_RING_SOURCE_FINGER, .ring = E.ring, @@ -185,10 +185,10 @@ CTabletPad::CTabletPad(SP pad_) : pad(pad_) { }); }); - listeners.strip = pad->events.strip.registerListener([this](std::any d) { + m_listeners.strip = m_pad->events.strip.registerListener([this](std::any d) { auto E = std::any_cast(d); - padEvents.strip.emit(SStripEvent{ + m_padEvents.strip.emit(SStripEvent{ .timeMs = E.timeMs, .finger = E.source == Aquamarine::ITabletPad::AQ_TABLET_PAD_STRIP_SOURCE_FINGER, .strip = E.strip, @@ -197,11 +197,11 @@ CTabletPad::CTabletPad(SP pad_) : pad(pad_) { }); }); - listeners.attach = pad->events.attach.registerListener([](std::any d) { + m_listeners.attach = m_pad->events.attach.registerListener([](std::any d) { ; // TODO: this doesn't do anything in aq atm }); - deviceName = pad->getName(); + m_deviceName = m_pad->getName(); } CTabletPad::~CTabletPad() { @@ -213,36 +213,36 @@ uint32_t CTabletTool::getCapabilities() { } SP CTabletTool::aq() { - return tool.lock(); + return m_tool.lock(); } eHIDType CTabletTool::getType() { return HID_TYPE_TABLET_TOOL; } -CTabletTool::CTabletTool(SP tool_) : tool(tool_) { - if (!tool) +CTabletTool::CTabletTool(SP tool_) : m_tool(tool_) { + if (!m_tool) return; - listeners.destroyTool = tool->events.destroy.registerListener([this](std::any d) { - tool.reset(); - events.destroy.emit(); + m_listeners.destroyTool = m_tool->events.destroy.registerListener([this](std::any d) { + m_tool.reset(); + m_events.destroy.emit(); }); - if (tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_TILT) - toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_TILT; - if (tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_PRESSURE) - toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_PRESSURE; - if (tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_DISTANCE) - toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_DISTANCE; - if (tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_ROTATION) - toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_ROTATION; - if (tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_SLIDER) - toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_SLIDER; - if (tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_WHEEL) - toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_WHEEL; + if (m_tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_TILT) + m_toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_TILT; + if (m_tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_PRESSURE) + m_toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_PRESSURE; + if (m_tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_DISTANCE) + m_toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_DISTANCE; + if (m_tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_ROTATION) + m_toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_ROTATION; + if (m_tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_SLIDER) + m_toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_SLIDER; + if (m_tool->capabilities & Aquamarine::ITabletTool::AQ_TABLET_TOOL_CAPABILITY_WHEEL) + m_toolCapabilities |= HID_TABLET_TOOL_CAPABILITY_WHEEL; - deviceName = std::format("{:x}-{:x}", tool->serial, tool->id); + m_deviceName = std::format("{:x}-{:x}", m_tool->serial, m_tool->id); } CTabletTool::~CTabletTool() { @@ -250,25 +250,25 @@ CTabletTool::~CTabletTool() { } SP CTabletTool::getSurface() { - return pSurface.lock(); + return m_surface.lock(); } void CTabletTool::setSurface(SP surf) { - if (surf == pSurface) + if (surf == m_surface) return; - if (pSurface) { - listeners.destroySurface.reset(); - pSurface.reset(); + if (m_surface) { + m_listeners.destroySurface.reset(); + m_surface.reset(); } - pSurface = surf; + m_surface = surf; if (surf) { - listeners.destroySurface = surf->events.destroy.registerListener([this](std::any d) { - PROTO::tablet->proximityOut(self.lock()); - pSurface.reset(); - listeners.destroySurface.reset(); + m_listeners.destroySurface = surf->events.destroy.registerListener([this](std::any d) { + PROTO::tablet->proximityOut(m_self.lock()); + m_surface.reset(); + m_listeners.destroySurface.reset(); }); } } diff --git a/src/devices/Tablet.hpp b/src/devices/Tablet.hpp index c3a9a2c91..b98c7f85f 100644 --- a/src/devices/Tablet.hpp +++ b/src/devices/Tablet.hpp @@ -86,20 +86,20 @@ class CTablet : public IHID { CSignal proximity; CSignal tip; CSignal button; - } tabletEvents; + } m_tabletEvents; - WP self; + WP m_self; - bool relativeInput = false; - bool absolutePos = false; - std::string boundOutput = ""; - CBox activeArea; - CBox boundBox; + bool m_relativeInput = false; + bool m_absolutePos = false; + std::string m_boundOutput = ""; + CBox m_activeArea; + CBox m_boundBox; private: CTablet(SP tablet); - WP tablet; + WP m_tablet; struct { CHyprSignalListener destroy; @@ -107,7 +107,7 @@ class CTablet : public IHID { CHyprSignalListener proximity; CHyprSignalListener tip; CHyprSignalListener button; - } listeners; + } m_listeners; }; class CTabletPad : public IHID { @@ -148,15 +148,15 @@ class CTabletPad : public IHID { CSignal ring; CSignal strip; CSignal attach; - } padEvents; + } m_padEvents; - WP self; - WP parent; + WP m_self; + WP m_parent; private: CTabletPad(SP pad); - WP pad; + WP m_pad; struct { CHyprSignalListener destroy; @@ -164,7 +164,7 @@ class CTabletPad : public IHID { CHyprSignalListener strip; CHyprSignalListener button; CHyprSignalListener attach; - } listeners; + } m_listeners; }; class CTabletTool : public IHID { @@ -198,23 +198,23 @@ class CTabletTool : public IHID { SP getSurface(); void setSurface(SP); - WP self; - Vector2D tilt; - bool active = false; // true if in proximity - uint32_t toolCapabilities = 0; + WP m_self; + Vector2D m_tilt; + bool m_active = false; // true if in proximity + uint32_t m_toolCapabilities = 0; - bool isDown = false; - std::vector buttonsDown; - Vector2D absolutePos; // last known absolute position. + bool m_isDown = false; + std::vector m_buttonsDown; + Vector2D m_absolutePos; // last known absolute position. private: CTabletTool(SP tool); - WP pSurface; - WP tool; + WP m_surface; + WP m_tool; struct { CHyprSignalListener destroySurface; CHyprSignalListener destroyTool; - } listeners; + } m_listeners; }; \ No newline at end of file diff --git a/src/devices/TouchDevice.cpp b/src/devices/TouchDevice.cpp index 25b7b503b..c2ff4d6f0 100644 --- a/src/devices/TouchDevice.cpp +++ b/src/devices/TouchDevice.cpp @@ -5,62 +5,62 @@ SP CTouchDevice::create(SP touch) { SP pTouch = SP(new CTouchDevice(touch)); - pTouch->self = pTouch; + pTouch->m_self = pTouch; return pTouch; } -CTouchDevice::CTouchDevice(SP touch_) : touch(touch_) { - if (!touch) +CTouchDevice::CTouchDevice(SP touch_) : m_touch(touch_) { + if (!m_touch) return; - listeners.destroy = touch->events.destroy.registerListener([this](std::any d) { - events.destroy.emit(); - touch.reset(); + m_listeners.destroy = m_touch->events.destroy.registerListener([this](std::any d) { + m_events.destroy.emit(); + m_touch.reset(); }); - listeners.down = touch->events.down.registerListener([this](std::any d) { + m_listeners.down = m_touch->events.down.registerListener([this](std::any d) { auto E = std::any_cast(d); - touchEvents.down.emit(SDownEvent{ + m_touchEvents.down.emit(SDownEvent{ .timeMs = E.timeMs, .touchID = E.touchID, .pos = E.pos, - .device = self.lock(), + .device = m_self.lock(), }); }); - listeners.up = touch->events.up.registerListener([this](std::any d) { + m_listeners.up = m_touch->events.up.registerListener([this](std::any d) { auto E = std::any_cast(d); - touchEvents.up.emit(SUpEvent{ + m_touchEvents.up.emit(SUpEvent{ .timeMs = E.timeMs, .touchID = E.touchID, }); }); - listeners.motion = touch->events.move.registerListener([this](std::any d) { + m_listeners.motion = m_touch->events.move.registerListener([this](std::any d) { auto E = std::any_cast(d); - touchEvents.motion.emit(SMotionEvent{ + m_touchEvents.motion.emit(SMotionEvent{ .timeMs = E.timeMs, .touchID = E.touchID, .pos = E.pos, }); }); - listeners.cancel = touch->events.cancel.registerListener([this](std::any d) { + m_listeners.cancel = m_touch->events.cancel.registerListener([this](std::any d) { auto E = std::any_cast(d); - touchEvents.cancel.emit(SCancelEvent{ + m_touchEvents.cancel.emit(SCancelEvent{ .timeMs = E.timeMs, .touchID = E.touchID, }); }); - listeners.frame = touch->events.frame.registerListener([this](std::any d) { touchEvents.frame.emit(); }); + m_listeners.frame = m_touch->events.frame.registerListener([this](std::any d) { m_touchEvents.frame.emit(); }); - deviceName = touch->getName(); + m_deviceName = m_touch->getName(); } bool CTouchDevice::isVirtual() { @@ -68,5 +68,5 @@ bool CTouchDevice::isVirtual() { } SP CTouchDevice::aq() { - return touch.lock(); + return m_touch.lock(); } diff --git a/src/devices/TouchDevice.hpp b/src/devices/TouchDevice.hpp index b18df2d01..9b32077d0 100644 --- a/src/devices/TouchDevice.hpp +++ b/src/devices/TouchDevice.hpp @@ -12,7 +12,7 @@ class CTouchDevice : public ITouch { private: CTouchDevice(SP touch); - WP touch; + WP m_touch; struct { CHyprSignalListener destroy; @@ -21,5 +21,5 @@ class CTouchDevice : public ITouch { CHyprSignalListener motion; CHyprSignalListener cancel; CHyprSignalListener frame; - } listeners; + } m_listeners; }; \ No newline at end of file diff --git a/src/devices/VirtualKeyboard.cpp b/src/devices/VirtualKeyboard.cpp index 548711c25..4fb25b5bd 100644 --- a/src/devices/VirtualKeyboard.cpp +++ b/src/devices/VirtualKeyboard.cpp @@ -5,43 +5,43 @@ SP CVirtualKeyboard::create(SP keeb) { SP pKeeb = SP(new CVirtualKeyboard(keeb)); - pKeeb->self = pKeeb; + pKeeb->m_self = pKeeb; return pKeeb; } -CVirtualKeyboard::CVirtualKeyboard(SP keeb_) : keyboard(keeb_) { +CVirtualKeyboard::CVirtualKeyboard(SP keeb_) : m_keyboard(keeb_) { if (!keeb_) return; - listeners.destroy = keeb_->events.destroy.registerListener([this](std::any d) { - keyboard.reset(); - events.destroy.emit(); + m_listeners.destroy = keeb_->events.destroy.registerListener([this](std::any d) { + m_keyboard.reset(); + m_events.destroy.emit(); }); - listeners.key = keeb_->events.key.registerListener([this](std::any d) { keyboardEvents.key.emit(d); }); - listeners.modifiers = keeb_->events.modifiers.registerListener([this](std::any d) { + m_listeners.key = keeb_->events.key.registerListener([this](std::any d) { m_keyboardEvents.key.emit(d); }); + m_listeners.modifiers = keeb_->events.modifiers.registerListener([this](std::any d) { auto E = std::any_cast(d); updateModifiers(E.depressed, E.latched, E.locked, E.group); - keyboardEvents.modifiers.emit(SModifiersEvent{ - .depressed = modifiersState.depressed, - .latched = modifiersState.latched, - .locked = modifiersState.locked, - .group = modifiersState.group, + m_keyboardEvents.modifiers.emit(SModifiersEvent{ + .depressed = m_modifiersState.depressed, + .latched = m_modifiersState.latched, + .locked = m_modifiersState.locked, + .group = m_modifiersState.group, }); }); - listeners.keymap = keeb_->events.keymap.registerListener([this](std::any d) { + m_listeners.keymap = keeb_->events.keymap.registerListener([this](std::any d) { auto E = std::any_cast(d); - if (xkbKeymap) - xkb_keymap_unref(xkbKeymap); - xkbKeymap = xkb_keymap_ref(E.keymap); - keymapOverridden = true; - updateXKBTranslationState(xkbKeymap); + if (m_xkbKeymap) + xkb_keymap_unref(m_xkbKeymap); + m_xkbKeymap = xkb_keymap_ref(E.keymap); + m_keymapOverridden = true; + updateXKBTranslationState(m_xkbKeymap); updateKeymapFD(); - keyboardEvents.keymap.emit(d); + m_keyboardEvents.keymap.emit(d); }); - deviceName = keeb_->name; + m_deviceName = keeb_->name; } bool CVirtualKeyboard::isVirtual() { @@ -53,7 +53,7 @@ SP CVirtualKeyboard::aq() { } wl_client* CVirtualKeyboard::getClient() { - if (keyboard.expired()) + if (m_keyboard.expired()) return nullptr; - return keyboard->client(); + return m_keyboard->client(); } diff --git a/src/devices/VirtualKeyboard.hpp b/src/devices/VirtualKeyboard.hpp index 12a3907c9..05e0a2552 100644 --- a/src/devices/VirtualKeyboard.hpp +++ b/src/devices/VirtualKeyboard.hpp @@ -16,12 +16,12 @@ class CVirtualKeyboard : public IKeyboard { private: CVirtualKeyboard(SP keeb); - WP keyboard; + WP m_keyboard; struct { CHyprSignalListener destroy; CHyprSignalListener key; CHyprSignalListener modifiers; CHyprSignalListener keymap; - } listeners; + } m_listeners; }; diff --git a/src/devices/VirtualPointer.cpp b/src/devices/VirtualPointer.cpp index e98acd04f..1aaf8b10c 100644 --- a/src/devices/VirtualPointer.cpp +++ b/src/devices/VirtualPointer.cpp @@ -5,46 +5,46 @@ SP CVirtualPointer::create(SP resource) { SP pPointer = SP(new CVirtualPointer(resource)); - pPointer->self = pPointer; + pPointer->m_self = pPointer; return pPointer; } -CVirtualPointer::CVirtualPointer(SP resource) : pointer(resource) { +CVirtualPointer::CVirtualPointer(SP resource) : m_pointer(resource) { if UNLIKELY (!resource->good()) return; - listeners.destroy = pointer->events.destroy.registerListener([this](std::any d) { - pointer.reset(); - events.destroy.emit(); + m_listeners.destroy = m_pointer->events.destroy.registerListener([this](std::any d) { + m_pointer.reset(); + m_events.destroy.emit(); }); - listeners.motion = pointer->events.move.registerListener([this](std::any d) { + m_listeners.motion = m_pointer->events.move.registerListener([this](std::any d) { auto E = std::any_cast(d); - E.device = self.lock(); - pointerEvents.motion.emit(E); + E.device = m_self.lock(); + m_pointerEvents.motion.emit(E); }); - listeners.motionAbsolute = pointer->events.warp.registerListener([this](std::any d) { + m_listeners.motionAbsolute = m_pointer->events.warp.registerListener([this](std::any d) { // we need to unpack the event and add our device here because it's required to calculate the position correctly auto E = std::any_cast(d); - E.device = self.lock(); - pointerEvents.motionAbsolute.emit(E); + E.device = m_self.lock(); + m_pointerEvents.motionAbsolute.emit(E); }); - listeners.button = pointer->events.button.registerListener([this](std::any d) { pointerEvents.button.emit(d); }); - listeners.axis = pointer->events.axis.registerListener([this](std::any d) { pointerEvents.axis.emit(d); }); - listeners.frame = pointer->events.frame.registerListener([this](std::any d) { pointerEvents.frame.emit(); }); - listeners.swipeBegin = pointer->events.swipeBegin.registerListener([this](std::any d) { pointerEvents.swipeBegin.emit(d); }); - listeners.swipeEnd = pointer->events.swipeEnd.registerListener([this](std::any d) { pointerEvents.swipeEnd.emit(d); }); - listeners.swipeUpdate = pointer->events.swipeUpdate.registerListener([this](std::any d) { pointerEvents.swipeUpdate.emit(d); }); - listeners.pinchBegin = pointer->events.pinchBegin.registerListener([this](std::any d) { pointerEvents.pinchBegin.emit(d); }); - listeners.pinchEnd = pointer->events.pinchEnd.registerListener([this](std::any d) { pointerEvents.pinchEnd.emit(d); }); - listeners.pinchUpdate = pointer->events.pinchUpdate.registerListener([this](std::any d) { pointerEvents.pinchUpdate.emit(d); }); - listeners.holdBegin = pointer->events.holdBegin.registerListener([this](std::any d) { pointerEvents.holdBegin.emit(d); }); - listeners.holdEnd = pointer->events.holdEnd.registerListener([this](std::any d) { pointerEvents.holdEnd.emit(d); }); + m_listeners.button = m_pointer->events.button.registerListener([this](std::any d) { m_pointerEvents.button.emit(d); }); + m_listeners.axis = m_pointer->events.axis.registerListener([this](std::any d) { m_pointerEvents.axis.emit(d); }); + m_listeners.frame = m_pointer->events.frame.registerListener([this](std::any d) { m_pointerEvents.frame.emit(); }); + m_listeners.swipeBegin = m_pointer->events.swipeBegin.registerListener([this](std::any d) { m_pointerEvents.swipeBegin.emit(d); }); + m_listeners.swipeEnd = m_pointer->events.swipeEnd.registerListener([this](std::any d) { m_pointerEvents.swipeEnd.emit(d); }); + m_listeners.swipeUpdate = m_pointer->events.swipeUpdate.registerListener([this](std::any d) { m_pointerEvents.swipeUpdate.emit(d); }); + m_listeners.pinchBegin = m_pointer->events.pinchBegin.registerListener([this](std::any d) { m_pointerEvents.pinchBegin.emit(d); }); + m_listeners.pinchEnd = m_pointer->events.pinchEnd.registerListener([this](std::any d) { m_pointerEvents.pinchEnd.emit(d); }); + m_listeners.pinchUpdate = m_pointer->events.pinchUpdate.registerListener([this](std::any d) { m_pointerEvents.pinchUpdate.emit(d); }); + m_listeners.holdBegin = m_pointer->events.holdBegin.registerListener([this](std::any d) { m_pointerEvents.holdBegin.emit(d); }); + m_listeners.holdEnd = m_pointer->events.holdEnd.registerListener([this](std::any d) { m_pointerEvents.holdEnd.emit(d); }); - boundOutput = resource->boundOutput ? resource->boundOutput->szName : ""; + m_boundOutput = resource->boundOutput ? resource->boundOutput->szName : ""; - deviceName = pointer->name; + m_deviceName = m_pointer->name; } bool CVirtualPointer::isVirtual() { diff --git a/src/devices/VirtualPointer.hpp b/src/devices/VirtualPointer.hpp index 1ecfd8426..9eacbd5f8 100644 --- a/src/devices/VirtualPointer.hpp +++ b/src/devices/VirtualPointer.hpp @@ -14,7 +14,7 @@ class CVirtualPointer : public IPointer { private: CVirtualPointer(SP); - WP pointer; + WP m_pointer; struct { CHyprSignalListener destroy; @@ -35,5 +35,5 @@ class CVirtualPointer : public IPointer { CHyprSignalListener holdBegin; CHyprSignalListener holdEnd; - } listeners; + } m_listeners; }; \ No newline at end of file diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp index 7f0045e0c..7d07a7176 100644 --- a/src/managers/KeybindManager.cpp +++ b/src/managers/KeybindManager.cpp @@ -151,7 +151,7 @@ CKeybindManager::CKeybindManager() { return; const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock(); - if (!PACTIVEKEEB->allowBinds) + if (!PACTIVEKEEB->m_allowBinds) return; const auto DISPATCHER = g_pKeybindManager->m_mDispatchers.find(m_pLastLongPressKeybind->handler); @@ -168,7 +168,7 @@ CKeybindManager::CKeybindManager() { return; const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock(); - if (!PACTIVEKEEB->allowBinds) + if (!PACTIVEKEEB->m_allowBinds) return; for (const auto& k : m_vActiveKeybinds) { @@ -178,7 +178,7 @@ CKeybindManager::CKeybindManager() { DISPATCHER->second(k->arg); } - self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->repeatRate)); + self->updateTimeout(std::chrono::milliseconds(1000 / PACTIVEKEEB->m_repeatRate)); }, nullptr); @@ -431,7 +431,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP pKeyboard) { return true; } - if (!pKeyboard->allowBinds) + if (!pKeyboard->m_allowBinds) return true; if (!m_pXKBTranslationState) { @@ -446,8 +446,8 @@ bool CKeybindManager::onKeyEvent(std::any event, SP pKeyboard) { const auto KEYCODE = e.keycode + 8; // Because to xkbcommon it's +8 from libinput - const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->resolveBindsBySym ? pKeyboard->xkbSymState : m_pXKBTranslationState, KEYCODE); - const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->xkbState, KEYCODE); + const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->m_resolveBindsBySym ? pKeyboard->m_xkbSymState : m_pXKBTranslationState, KEYCODE); + const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->m_xkbState, KEYCODE); if (keysym == XKB_KEY_Escape || internalKeysym == XKB_KEY_Escape) PROTO::data->abortDndIfPresent(); @@ -764,7 +764,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP if (k->longPress) { const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock(); - m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay)); + m_pLongPressTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay)); m_pLastLongPressKeybind = k; continue; @@ -804,7 +804,7 @@ SDispatchResult CKeybindManager::handleKeybinds(const uint32_t modmask, const SP const auto PACTIVEKEEB = g_pSeatManager->keyboard.lock(); m_vActiveKeybinds.emplace_back(k); - m_pRepeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->repeatDelay)); + m_pRepeatKeyTimer->updateTimeout(std::chrono::milliseconds(PACTIVEKEEB->m_repeatDelay)); } if (!k->nonConsuming) @@ -2541,8 +2541,8 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) { const auto KEYPAIRSTRING = std::format("{}{}", (uintptr_t)KB.get(), KEY); if (!g_pKeybindManager->m_mKeyToCodeCache.contains(KEYPAIRSTRING)) { - xkb_keymap* km = KB->xkbKeymap; - xkb_state* ks = KB->xkbState; + xkb_keymap* km = KB->m_xkbKeymap; + xkb_state* ks = KB->m_xkbState; xkb_keycode_t keycode_min, keycode_max; keycode_min = xkb_keymap_min_keycode(km); diff --git a/src/managers/PointerManager.cpp b/src/managers/PointerManager.cpp index e8d71e1ac..1c9036bff 100644 --- a/src/managers/PointerManager.cpp +++ b/src/managers/PointerManager.cpp @@ -805,31 +805,31 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP dev) { switch (dev->getType()) { case HID_TYPE_TABLET: { CTablet* TAB = reinterpret_cast(dev.get()); - if (!TAB->boundOutput.empty()) { - mappedArea = outputMappedArea(TAB->boundOutput); - mappedArea.translate(TAB->boundBox.pos()); - } else if (TAB->absolutePos) { - mappedArea.x = TAB->boundBox.x; - mappedArea.y = TAB->boundBox.y; + if (!TAB->m_boundOutput.empty()) { + mappedArea = outputMappedArea(TAB->m_boundOutput); + mappedArea.translate(TAB->m_boundBox.pos()); + } else if (TAB->m_absolutePos) { + mappedArea.x = TAB->m_boundBox.x; + mappedArea.y = TAB->m_boundBox.y; } else - mappedArea.translate(TAB->boundBox.pos()); + mappedArea.translate(TAB->m_boundBox.pos()); - if (!TAB->boundBox.empty()) { - mappedArea.w = TAB->boundBox.w; - mappedArea.h = TAB->boundBox.h; + if (!TAB->m_boundBox.empty()) { + mappedArea.w = TAB->m_boundBox.w; + mappedArea.h = TAB->m_boundBox.h; } break; } case HID_TYPE_TOUCH: { ITouch* TOUCH = reinterpret_cast(dev.get()); - if (!TOUCH->boundOutput.empty()) - mappedArea = outputMappedArea(TOUCH->boundOutput); + if (!TOUCH->m_boundOutput.empty()) + mappedArea = outputMappedArea(TOUCH->m_boundOutput); break; } case HID_TYPE_POINTER: { IPointer* POINTER = reinterpret_cast(dev.get()); - if (!POINTER->boundOutput.empty()) - mappedArea = outputMappedArea(POINTER->boundOutput); + if (!POINTER->m_boundOutput.empty()) + mappedArea = outputMappedArea(POINTER->m_boundOutput); break; } default: break; @@ -892,11 +892,11 @@ void CPointerManager::attachPointer(SP pointer) { listener->pointer = pointer; // clang-format off - listener->destroy = pointer->events.destroy.registerListener([this] (std::any d) { + listener->destroy = pointer->m_events.destroy.registerListener([this] (std::any d) { detachPointer(nullptr); }); - listener->motion = pointer->pointerEvents.motion.registerListener([] (std::any e) { + listener->motion = pointer->m_pointerEvents.motion.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onMouseMoved(E); @@ -907,7 +907,7 @@ void CPointerManager::attachPointer(SP pointer) { g_pKeybindManager->dpms("on"); }); - listener->motionAbsolute = pointer->pointerEvents.motionAbsolute.registerListener([] (std::any e) { + listener->motionAbsolute = pointer->m_pointerEvents.motionAbsolute.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onMouseWarp(E); @@ -918,7 +918,7 @@ void CPointerManager::attachPointer(SP pointer) { g_pKeybindManager->dpms("on"); }); - listener->button = pointer->pointerEvents.button.registerListener([] (std::any e) { + listener->button = pointer->m_pointerEvents.button.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onMouseButton(E); @@ -926,7 +926,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->axis = pointer->pointerEvents.axis.registerListener([] (std::any e) { + listener->axis = pointer->m_pointerEvents.axis.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onMouseWheel(E); @@ -934,7 +934,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->frame = pointer->pointerEvents.frame.registerListener([] (std::any e) { + listener->frame = pointer->m_pointerEvents.frame.registerListener([] (std::any e) { bool shouldSkip = false; if (!g_pSeatManager->mouse.expired() && g_pInputManager->isLocked()) { auto PMONITOR = g_pCompositor->m_lastMonitor.get(); @@ -945,7 +945,7 @@ void CPointerManager::attachPointer(SP pointer) { g_pSeatManager->sendPointerFrame(); }); - listener->swipeBegin = pointer->pointerEvents.swipeBegin.registerListener([] (std::any e) { + listener->swipeBegin = pointer->m_pointerEvents.swipeBegin.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onSwipeBegin(E); @@ -956,7 +956,7 @@ void CPointerManager::attachPointer(SP pointer) { g_pKeybindManager->dpms("on"); }); - listener->swipeEnd = pointer->pointerEvents.swipeEnd.registerListener([] (std::any e) { + listener->swipeEnd = pointer->m_pointerEvents.swipeEnd.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onSwipeEnd(E); @@ -964,7 +964,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->swipeUpdate = pointer->pointerEvents.swipeUpdate.registerListener([] (std::any e) { + listener->swipeUpdate = pointer->m_pointerEvents.swipeUpdate.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onSwipeUpdate(E); @@ -972,7 +972,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->pinchBegin = pointer->pointerEvents.pinchBegin.registerListener([] (std::any e) { + listener->pinchBegin = pointer->m_pointerEvents.pinchBegin.registerListener([] (std::any e) { auto E = std::any_cast(e); PROTO::pointerGestures->pinchBegin(E.timeMs, E.fingers); @@ -983,7 +983,7 @@ void CPointerManager::attachPointer(SP pointer) { g_pKeybindManager->dpms("on"); }); - listener->pinchEnd = pointer->pointerEvents.pinchEnd.registerListener([] (std::any e) { + listener->pinchEnd = pointer->m_pointerEvents.pinchEnd.registerListener([] (std::any e) { auto E = std::any_cast(e); PROTO::pointerGestures->pinchEnd(E.timeMs, E.cancelled); @@ -991,7 +991,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->pinchUpdate = pointer->pointerEvents.pinchUpdate.registerListener([] (std::any e) { + listener->pinchUpdate = pointer->m_pointerEvents.pinchUpdate.registerListener([] (std::any e) { auto E = std::any_cast(e); PROTO::pointerGestures->pinchUpdate(E.timeMs, E.delta, E.scale, E.rotation); @@ -999,7 +999,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->holdBegin = pointer->pointerEvents.holdBegin.registerListener([] (std::any e) { + listener->holdBegin = pointer->m_pointerEvents.holdBegin.registerListener([] (std::any e) { auto E = std::any_cast(e); PROTO::pointerGestures->holdBegin(E.timeMs, E.fingers); @@ -1007,7 +1007,7 @@ void CPointerManager::attachPointer(SP pointer) { PROTO::idle->onActivity(); }); - listener->holdEnd = pointer->pointerEvents.holdEnd.registerListener([] (std::any e) { + listener->holdEnd = pointer->m_pointerEvents.holdEnd.registerListener([] (std::any e) { auto E = std::any_cast(e); PROTO::pointerGestures->holdEnd(E.timeMs, E.cancelled); @@ -1016,7 +1016,7 @@ void CPointerManager::attachPointer(SP pointer) { }); // clang-format on - Debug::log(LOG, "Attached pointer {} to global", pointer->hlName); + Debug::log(LOG, "Attached pointer {} to global", pointer->m_hlName); } void CPointerManager::attachTouch(SP touch) { @@ -1031,11 +1031,11 @@ void CPointerManager::attachTouch(SP touch) { listener->touch = touch; // clang-format off - listener->destroy = touch->events.destroy.registerListener([this] (std::any d) { + listener->destroy = touch->m_events.destroy.registerListener([this] (std::any d) { detachTouch(nullptr); }); - listener->down = touch->touchEvents.down.registerListener([] (std::any e) { + listener->down = touch->m_touchEvents.down.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTouchDown(E); @@ -1046,7 +1046,7 @@ void CPointerManager::attachTouch(SP touch) { g_pKeybindManager->dpms("on"); }); - listener->up = touch->touchEvents.up.registerListener([] (std::any e) { + listener->up = touch->m_touchEvents.up.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTouchUp(E); @@ -1054,7 +1054,7 @@ void CPointerManager::attachTouch(SP touch) { PROTO::idle->onActivity(); }); - listener->motion = touch->touchEvents.motion.registerListener([] (std::any e) { + listener->motion = touch->m_touchEvents.motion.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTouchMove(E); @@ -1062,16 +1062,16 @@ void CPointerManager::attachTouch(SP touch) { PROTO::idle->onActivity(); }); - listener->cancel = touch->touchEvents.cancel.registerListener([] (std::any e) { + listener->cancel = touch->m_touchEvents.cancel.registerListener([] (std::any e) { // }); - listener->frame = touch->touchEvents.frame.registerListener([] (std::any e) { + listener->frame = touch->m_touchEvents.frame.registerListener([] (std::any e) { g_pSeatManager->sendTouchFrame(); }); // clang-format on - Debug::log(LOG, "Attached touch {} to global", touch->hlName); + Debug::log(LOG, "Attached touch {} to global", touch->m_hlName); } void CPointerManager::attachTablet(SP tablet) { @@ -1086,11 +1086,11 @@ void CPointerManager::attachTablet(SP tablet) { listener->tablet = tablet; // clang-format off - listener->destroy = tablet->events.destroy.registerListener([this] (std::any d) { + listener->destroy = tablet->m_events.destroy.registerListener([this] (std::any d) { detachTablet(nullptr); }); - listener->axis = tablet->tabletEvents.axis.registerListener([] (std::any e) { + listener->axis = tablet->m_tabletEvents.axis.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTabletAxis(E); @@ -1101,7 +1101,7 @@ void CPointerManager::attachTablet(SP tablet) { g_pKeybindManager->dpms("on"); }); - listener->proximity = tablet->tabletEvents.proximity.registerListener([] (std::any e) { + listener->proximity = tablet->m_tabletEvents.proximity.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTabletProximity(E); @@ -1109,7 +1109,7 @@ void CPointerManager::attachTablet(SP tablet) { PROTO::idle->onActivity(); }); - listener->tip = tablet->tabletEvents.tip.registerListener([] (std::any e) { + listener->tip = tablet->m_tabletEvents.tip.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTabletTip(E); @@ -1120,7 +1120,7 @@ void CPointerManager::attachTablet(SP tablet) { g_pKeybindManager->dpms("on"); }); - listener->button = tablet->tabletEvents.button.registerListener([] (std::any e) { + listener->button = tablet->m_tabletEvents.button.registerListener([] (std::any e) { auto E = std::any_cast(e); g_pInputManager->onTabletButton(E); @@ -1129,7 +1129,7 @@ void CPointerManager::attachTablet(SP tablet) { }); // clang-format on - Debug::log(LOG, "Attached tablet {} to global", tablet->hlName); + Debug::log(LOG, "Attached tablet {} to global", tablet->m_hlName); } void CPointerManager::detachPointer(SP pointer) { diff --git a/src/managers/SeatManager.cpp b/src/managers/SeatManager.cpp index 6ea441e82..3fe407b33 100644 --- a/src/managers/SeatManager.cpp +++ b/src/managers/SeatManager.cpp @@ -87,18 +87,18 @@ void CSeatManager::setKeyboard(SP KEEB) { return; if (keyboard) - keyboard->active = false; + keyboard->m_active = false; keyboard = KEEB; if (KEEB) - KEEB->active = true; + KEEB->m_active = true; updateActiveKeyboardData(); } void CSeatManager::updateActiveKeyboardData() { if (keyboard) - PROTO::seat->updateRepeatInfo(keyboard->repeatRate, keyboard->repeatDelay); + PROTO::seat->updateRepeatInfo(keyboard->m_repeatRate, keyboard->m_repeatDelay); PROTO::seat->updateKeymap(); } @@ -147,7 +147,7 @@ void CSeatManager::setKeyboardFocus(SP surf) { continue; k->sendEnter(surf); - k->sendMods(keyboard->modifiersState.depressed, keyboard->modifiersState.latched, keyboard->modifiersState.locked, keyboard->modifiersState.group); + k->sendMods(keyboard->m_modifiersState.depressed, keyboard->m_modifiersState.latched, keyboard->m_modifiersState.locked, keyboard->m_modifiersState.group); } } diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index 319196ee9..3c9c59b96 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -98,12 +98,12 @@ void CInputManager::onMouseMoved(IPointer::SMotionEvent e) { Vector2D unaccel = e.unaccel; if (e.device) { - if (e.device->isTouchpad) { - if (e.device->flipX) { + if (e.device->m_isTouchpad) { + if (e.device->m_flipX) { delta.x = -delta.x; unaccel.x = -unaccel.x; } - if (e.device->flipY) { + if (e.device->m_flipY) { delta.y = -delta.y; unaccel.y = -unaccel.y; } @@ -945,14 +945,14 @@ void CInputManager::setupKeyboard(SP keeb) { m_vHIDs.emplace_back(keeb); try { - keeb->hlName = getNameForNewDevice(keeb->deviceName); + keeb->m_hlName = getNameForNewDevice(keeb->m_deviceName); } catch (std::exception& e) { Debug::log(ERR, "Keyboard had no name???"); // logic error } - keeb->events.destroy.registerStaticListener( + keeb->m_events.destroy.registerStaticListener( [this](void* owner, std::any data) { - auto PKEEB = ((IKeyboard*)owner)->self.lock(); + auto PKEEB = ((IKeyboard*)owner)->m_self.lock(); if (!PKEEB) return; @@ -962,37 +962,37 @@ void CInputManager::setupKeyboard(SP keeb) { }, keeb.get()); - keeb->keyboardEvents.key.registerStaticListener( + keeb->m_keyboardEvents.key.registerStaticListener( [this](void* owner, std::any data) { - auto PKEEB = ((IKeyboard*)owner)->self.lock(); + auto PKEEB = ((IKeyboard*)owner)->m_self.lock(); onKeyboardKey(data, PKEEB); - if (PKEEB->enabled) + if (PKEEB->m_enabled) PROTO::idle->onActivity(); - if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn) + if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn) g_pKeybindManager->dpms("on"); }, keeb.get()); - keeb->keyboardEvents.modifiers.registerStaticListener( + keeb->m_keyboardEvents.modifiers.registerStaticListener( [this](void* owner, std::any data) { - auto PKEEB = ((IKeyboard*)owner)->self.lock(); + auto PKEEB = ((IKeyboard*)owner)->m_self.lock(); onKeyboardMod(PKEEB); - if (PKEEB->enabled) + if (PKEEB->m_enabled) PROTO::idle->onActivity(); - if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn) + if (PKEEB->m_enabled && *PDPMS && !g_pCompositor->m_dpmsStateOn) g_pKeybindManager->dpms("on"); }, keeb.get()); - keeb->keyboardEvents.keymap.registerStaticListener( + keeb->m_keyboardEvents.keymap.registerStaticListener( [](void* owner, std::any data) { - auto PKEEB = ((IKeyboard*)owner)->self.lock(); + auto PKEEB = ((IKeyboard*)owner)->m_self.lock(); const auto LAYOUT = PKEEB->getActiveLayout(); if (PKEEB == g_pSeatManager->keyboard) { @@ -1000,7 +1000,7 @@ void CInputManager::setupKeyboard(SP keeb) { g_pKeybindManager->m_mKeyToCodeCache.clear(); } - g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->hlName + "," + LAYOUT}); + g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", PKEEB->m_hlName + "," + LAYOUT}); EMIT_HOOK_EVENT("activeLayout", (std::vector{PKEEB, LAYOUT})); }, keeb.get()); @@ -1022,7 +1022,7 @@ void CInputManager::setKeyboardLayout() { } void CInputManager::applyConfigToKeyboard(SP pKeyboard) { - auto devname = pKeyboard->hlName; + auto devname = pKeyboard->m_hlName; const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname); @@ -1044,14 +1044,14 @@ void CInputManager::applyConfigToKeyboard(SP pKeyboard) { const auto ENABLED = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "enabled") : true; const auto ALLOWBINDS = HASCONFIG ? g_pConfigManager->getDeviceInt(devname, "keybinds") : true; - pKeyboard->enabled = ENABLED; - pKeyboard->resolveBindsBySym = RESOLVEBINDSBYSYM; - pKeyboard->allowBinds = ALLOWBINDS; + pKeyboard->m_enabled = ENABLED; + pKeyboard->m_resolveBindsBySym = RESOLVEBINDSBYSYM; + pKeyboard->m_allowBinds = ALLOWBINDS; try { - if (NUMLOCKON == pKeyboard->numlockOn && REPEATDELAY == pKeyboard->repeatDelay && REPEATRATE == pKeyboard->repeatRate && RULES != "" && - RULES == pKeyboard->currentRules.rules && MODEL == pKeyboard->currentRules.model && LAYOUT == pKeyboard->currentRules.layout && - VARIANT == pKeyboard->currentRules.variant && OPTIONS == pKeyboard->currentRules.options && FILEPATH == pKeyboard->xkbFilePath) { + if (NUMLOCKON == pKeyboard->m_numlockOn && REPEATDELAY == pKeyboard->m_repeatDelay && REPEATRATE == pKeyboard->m_repeatRate && RULES != "" && + RULES == pKeyboard->m_currentRules.rules && MODEL == pKeyboard->m_currentRules.model && LAYOUT == pKeyboard->m_currentRules.layout && + VARIANT == pKeyboard->m_currentRules.variant && OPTIONS == pKeyboard->m_currentRules.options && FILEPATH == pKeyboard->m_xkbFilePath) { Debug::log(LOG, "Not applying config to keyboard, it did not change."); return; } @@ -1060,19 +1060,20 @@ void CInputManager::applyConfigToKeyboard(SP pKeyboard) { // we can ignore those and just apply } - pKeyboard->repeatRate = std::max(0, REPEATRATE); - pKeyboard->repeatDelay = std::max(0, REPEATDELAY); - pKeyboard->numlockOn = NUMLOCKON; - pKeyboard->xkbFilePath = FILEPATH; + pKeyboard->m_repeatRate = std::max(0, REPEATRATE); + pKeyboard->m_repeatDelay = std::max(0, REPEATDELAY); + pKeyboard->m_numlockOn = NUMLOCKON; + pKeyboard->m_xkbFilePath = FILEPATH; pKeyboard->setKeymap(IKeyboard::SStringRuleNames{LAYOUT, MODEL, VARIANT, OPTIONS, RULES}); const auto LAYOUTSTR = pKeyboard->getActiveLayout(); - g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUTSTR}); + g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->m_hlName + "," + LAYOUTSTR}); EMIT_HOOK_EVENT("activeLayout", (std::vector{pKeyboard, LAYOUTSTR})); - Debug::log(LOG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", pKeyboard->currentRules.layout, pKeyboard->currentRules.variant, pKeyboard->hlName); + Debug::log(LOG, "Set the keyboard layout to {} and variant to {} for keyboard \"{}\"", pKeyboard->m_currentRules.layout, pKeyboard->m_currentRules.variant, + pKeyboard->m_hlName); } void CInputManager::newVirtualMouse(SP mouse) { @@ -1095,7 +1096,7 @@ void CInputManager::setupMouse(SP mauz) { m_vHIDs.emplace_back(mauz); try { - mauz->hlName = getNameForNewDevice(mauz->deviceName); + mauz->m_hlName = getNameForNewDevice(mauz->m_deviceName); } catch (std::exception& e) { Debug::log(ERR, "Mouse had no name???"); // logic error } @@ -1110,18 +1111,18 @@ void CInputManager::setupMouse(SP mauz) { g_pPointerManager->attachPointer(mauz); - mauz->connected = true; + mauz->m_connected = true; setPointerConfigs(); - mauz->events.destroy.registerStaticListener( + mauz->m_events.destroy.registerStaticListener( [this](void* mouse, std::any data) { const auto PMOUSE = (IPointer*)mouse; if (!PMOUSE) return; - destroyPointer(PMOUSE->self.lock()); + destroyPointer(PMOUSE->m_self.lock()); }, mauz.get()); @@ -1132,18 +1133,18 @@ void CInputManager::setupMouse(SP mauz) { void CInputManager::setPointerConfigs() { for (auto const& m : m_vPointers) { - auto devname = m->hlName; + auto devname = m->m_hlName; const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname); if (HASCONFIG) { const auto ENABLED = g_pConfigManager->getDeviceInt(devname, "enabled"); - if (ENABLED && !m->connected) { + if (ENABLED && !m->m_connected) { g_pPointerManager->attachPointer(m); - m->connected = true; - } else if (!ENABLED && m->connected) { + m->m_connected = true; + } else if (!ENABLED && m->m_connected) { g_pPointerManager->detachPointer(m); - m->connected = false; + m->m_connected = false; } } @@ -1227,8 +1228,8 @@ void CInputManager::setPointerConfigs() { const auto LIBINPUTSENS = std::clamp(g_pConfigManager->getDeviceFloat(devname, "sensitivity", "input:sensitivity"), -1.f, 1.f); libinput_device_config_accel_set_speed(LIBINPUTDEV, LIBINPUTSENS); - m->flipX = g_pConfigManager->getDeviceInt(devname, "flip_x", "input:touchpad:flip_x") != 0; - m->flipY = g_pConfigManager->getDeviceInt(devname, "flip_y", "input:touchpad:flip_y") != 0; + m->m_flipX = g_pConfigManager->getDeviceInt(devname, "flip_x", "input:touchpad:flip_x") != 0; + m->m_flipY = g_pConfigManager->getDeviceInt(devname, "flip_y", "input:touchpad:flip_y") != 0; const auto ACCELPROFILE = g_pConfigManager->getDeviceString(devname, "accel_profile", "input:accel_profile"); const auto SCROLLPOINTS = g_pConfigManager->getDeviceString(devname, "scroll_points", "input:scroll_points"); @@ -1281,7 +1282,7 @@ void CInputManager::setPointerConfigs() { libinput_device_config_scroll_set_button_lock(LIBINPUTDEV, SCROLLBUTTONLOCK == 0 ? LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_DISABLED : LIBINPUT_CONFIG_SCROLL_BUTTON_LOCK_ENABLED); - Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m->hlName, LIBINPUTSENS); + Debug::log(LOG, "Applied config to mouse {}, sens {:.2f}", m->m_hlName, LIBINPUTSENS); } } } @@ -1375,7 +1376,7 @@ void CInputManager::updateKeyboardsLeds(SP pKeyboard) { } void CInputManager::onKeyboardKey(std::any event, SP pKeyboard) { - if (!pKeyboard->enabled) + if (!pKeyboard->m_enabled) return; const bool DISALLOWACTION = pKeyboard->isVirtual() && shouldIgnoreVirtualKeyboard(pKeyboard); @@ -1403,14 +1404,14 @@ void CInputManager::onKeyboardKey(std::any event, SP pKeyboard) { } void CInputManager::onKeyboardMod(SP pKeyboard) { - if (!pKeyboard->enabled) + if (!pKeyboard->m_enabled) return; const bool DISALLOWACTION = pKeyboard->isVirtual() && shouldIgnoreVirtualKeyboard(pKeyboard); const auto ALLMODS = accumulateModsFromAllKBs(); - auto MODS = pKeyboard->modifiersState; + auto MODS = pKeyboard->m_modifiersState; MODS.depressed = ALLMODS; const auto IME = m_sIMERelay.m_pIME.lock(); @@ -1425,14 +1426,14 @@ void CInputManager::onKeyboardMod(SP pKeyboard) { updateKeyboardsLeds(pKeyboard); - if (pKeyboard->modifiersState.group != pKeyboard->activeLayout) { - pKeyboard->activeLayout = pKeyboard->modifiersState.group; + if (pKeyboard->m_modifiersState.group != pKeyboard->m_activeLayout) { + pKeyboard->m_activeLayout = pKeyboard->m_modifiersState.group; const auto LAYOUT = pKeyboard->getActiveLayout(); Debug::log(LOG, "LAYOUT CHANGED TO {} GROUP {}", LAYOUT, MODS.group); - g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->hlName + "," + LAYOUT}); + g_pEventManager->postEvent(SHyprIPCEvent{"activelayout", pKeyboard->m_hlName + "," + LAYOUT}); EMIT_HOOK_EVENT("activeLayout", (std::vector{pKeyboard, LAYOUT})); } } @@ -1556,7 +1557,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() { if (kb->isVirtual() && shouldIgnoreVirtualKeyboard(kb)) continue; - if (!kb->enabled) + if (!kb->m_enabled) continue; finalMask |= kb->getModifiers(); @@ -1571,7 +1572,7 @@ void CInputManager::disableAllKeyboards(bool virt) { if (k->isVirtual() != virt) continue; - k->active = false; + k->m_active = false; } } @@ -1580,7 +1581,7 @@ void CInputManager::newTouchDevice(SP pDevice) { m_vHIDs.emplace_back(PNEWDEV); try { - PNEWDEV->hlName = getNameForNewDevice(PNEWDEV->deviceName); + PNEWDEV->m_hlName = getNameForNewDevice(PNEWDEV->m_deviceName); } catch (std::exception& e) { Debug::log(ERR, "Touch Device had no name???"); // logic error } @@ -1588,9 +1589,9 @@ void CInputManager::newTouchDevice(SP pDevice) { setTouchDeviceConfigs(PNEWDEV); g_pPointerManager->attachTouch(PNEWDEV); - PNEWDEV->events.destroy.registerStaticListener( + PNEWDEV->m_events.destroy.registerStaticListener( [this](void* owner, std::any data) { - auto PDEV = ((ITouch*)owner)->self.lock(); + auto PDEV = ((ITouch*)owner)->m_self.lock(); if (!PDEV) return; @@ -1607,20 +1608,20 @@ void CInputManager::setTouchDeviceConfigs(SP dev) { if (PTOUCHDEV->aq() && PTOUCHDEV->aq()->getLibinputHandle()) { const auto LIBINPUTDEV = PTOUCHDEV->aq()->getLibinputHandle(); - const auto ENABLED = g_pConfigManager->getDeviceInt(PTOUCHDEV->hlName, "enabled", "input:touchdevice:enabled"); + const auto ENABLED = g_pConfigManager->getDeviceInt(PTOUCHDEV->m_hlName, "enabled", "input:touchdevice:enabled"); const auto mode = ENABLED ? LIBINPUT_CONFIG_SEND_EVENTS_ENABLED : LIBINPUT_CONFIG_SEND_EVENTS_DISABLED; if (libinput_device_config_send_events_get_mode(LIBINPUTDEV) != mode) libinput_device_config_send_events_set_mode(LIBINPUTDEV, mode); if (libinput_device_config_calibration_has_matrix(LIBINPUTDEV)) { - Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->hlName); + Debug::log(LOG, "Setting calibration matrix for device {}", PTOUCHDEV->m_hlName); // default value of transform being -1 means it's unset. - const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->hlName, "transform", "input:touchdevice:transform"), -1, 7); + const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(PTOUCHDEV->m_hlName, "transform", "input:touchdevice:transform"), -1, 7); if (ROTATION > -1) libinput_device_config_calibration_set_matrix(LIBINPUTDEV, MATRICES[ROTATION]); } - auto output = g_pConfigManager->getDeviceString(PTOUCHDEV->hlName, "output", "input:touchdevice:output"); + auto output = g_pConfigManager->getDeviceString(PTOUCHDEV->m_hlName, "output", "input:touchdevice:output"); bool bound = !output.empty() && output != STRVAL_EMPTY; const bool AUTODETECT = output == "[[Auto]]"; if (!bound && AUTODETECT) { @@ -1631,13 +1632,13 @@ void CInputManager::setTouchDeviceConfigs(SP dev) { // bound = true; // } } - PTOUCHDEV->boundOutput = bound ? output : ""; - const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr; + PTOUCHDEV->m_boundOutput = bound ? output : ""; + const auto PMONITOR = bound ? g_pCompositor->getMonitorFromName(output) : nullptr; if (PMONITOR) { - Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->hlName, PMONITOR->szName); + Debug::log(LOG, "Binding touch device {} to output {}", PTOUCHDEV->m_hlName, PMONITOR->szName); // wlr_cursor_map_input_to_output(g_pCompositor->m_sWLRCursor, &PTOUCHDEV->wlr()->base, PMONITOR->output); } else if (bound) - Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->hlName, output); + Debug::log(ERR, "Failed to bind touch device {} to output '{}': monitor not found", PTOUCHDEV->m_hlName, output); } }; @@ -1654,11 +1655,11 @@ void CInputManager::setTouchDeviceConfigs(SP dev) { void CInputManager::setTabletConfigs() { for (auto const& t : m_vTablets) { if (t->aq()->getLibinputHandle()) { - const auto NAME = t->hlName; + const auto NAME = t->m_hlName; const auto LIBINPUTDEV = t->aq()->getLibinputHandle(); const auto RELINPUT = g_pConfigManager->getDeviceInt(NAME, "relative_input", "input:tablet:relative_input"); - t->relativeInput = RELINPUT; + t->m_relativeInput = RELINPUT; const int ROTATION = std::clamp(g_pConfigManager->getDeviceInt(NAME, "transform", "input:tablet:transform"), -1, 7); Debug::log(LOG, "Setting calibration matrix for device {}", NAME); @@ -1673,22 +1674,22 @@ void CInputManager::setTabletConfigs() { const auto OUTPUT = g_pConfigManager->getDeviceString(NAME, "output", "input:tablet:output"); if (OUTPUT != STRVAL_EMPTY) { Debug::log(LOG, "Binding tablet {} to output {}", NAME, OUTPUT); - t->boundOutput = OUTPUT; + t->m_boundOutput = OUTPUT; } else - t->boundOutput = ""; + t->m_boundOutput = ""; const auto REGION_POS = g_pConfigManager->getDeviceVec(NAME, "region_position", "input:tablet:region_position"); const auto REGION_SIZE = g_pConfigManager->getDeviceVec(NAME, "region_size", "input:tablet:region_size"); - t->boundBox = {REGION_POS, REGION_SIZE}; + t->m_boundBox = {REGION_POS, REGION_SIZE}; const auto ABSOLUTE_REGION_POS = g_pConfigManager->getDeviceInt(NAME, "absolute_region_position", "input:tablet:absolute_region_position"); - t->absolutePos = ABSOLUTE_REGION_POS; + t->m_absolutePos = ABSOLUTE_REGION_POS; const auto ACTIVE_AREA_SIZE = g_pConfigManager->getDeviceVec(NAME, "active_area_size", "input:tablet:active_area_size"); const auto ACTIVE_AREA_POS = g_pConfigManager->getDeviceVec(NAME, "active_area_position", "input:tablet:active_area_position"); if (ACTIVE_AREA_SIZE.x != 0 || ACTIVE_AREA_SIZE.y != 0) { - t->activeArea = CBox{ACTIVE_AREA_POS.x / t->aq()->physicalSize.x, ACTIVE_AREA_POS.y / t->aq()->physicalSize.y, - (ACTIVE_AREA_POS.x + ACTIVE_AREA_SIZE.x) / t->aq()->physicalSize.x, (ACTIVE_AREA_POS.y + ACTIVE_AREA_SIZE.y) / t->aq()->physicalSize.y}; + t->m_activeArea = CBox{ACTIVE_AREA_POS.x / t->aq()->physicalSize.x, ACTIVE_AREA_POS.y / t->aq()->physicalSize.y, + (ACTIVE_AREA_POS.x + ACTIVE_AREA_SIZE.x) / t->aq()->physicalSize.x, (ACTIVE_AREA_POS.y + ACTIVE_AREA_SIZE.y) / t->aq()->physicalSize.y}; } } } @@ -1752,7 +1753,7 @@ std::string CInputManager::getNameForNewDevice(std::string internalName) { auto makeNewName = [&]() { return (proposedNewName.empty() ? "unknown-device" : proposedNewName) + (dupeno == 0 ? "" : ("-" + std::to_string(dupeno))); }; - while (std::find_if(m_vHIDs.begin(), m_vHIDs.end(), [&](const auto& other) { return other->hlName == makeNewName(); }) != m_vHIDs.end()) + while (std::find_if(m_vHIDs.begin(), m_vHIDs.end(), [&](const auto& other) { return other->m_hlName == makeNewName(); }) != m_vHIDs.end()) dupeno++; return makeNewName(); diff --git a/src/managers/input/Tablets.cpp b/src/managers/input/Tablets.cpp index 5cbfed462..347ea6c7e 100644 --- a/src/managers/input/Tablets.cpp +++ b/src/managers/input/Tablets.cpp @@ -11,9 +11,9 @@ static void unfocusTool(SP tool) { return; tool->setSurface(nullptr); - if (tool->isDown) + if (tool->m_isDown) PROTO::tablet->up(tool); - for (auto const& b : tool->buttonsDown) { + for (auto const& b : tool->m_buttonsDown) { PROTO::tablet->buttonTool(tool, b, false); } PROTO::tablet->proximityOut(tool); @@ -28,9 +28,9 @@ static void focusTool(SP tool, SP tablet, SPsetSurface(surf); PROTO::tablet->proximityIn(tool, tablet, surf); - if (tool->isDown) + if (tool->m_isDown) PROTO::tablet->down(tool); - for (auto const& b : tool->buttonsDown) { + for (auto const& b : tool->m_buttonsDown) { PROTO::tablet->buttonTool(tool, b, true); } } @@ -38,7 +38,7 @@ static void focusTool(SP tool, SP tablet, SP tab, SP tool, bool motion = false) { const auto LASTHLSURFACE = CWLSurface::fromResource(g_pSeatManager->state.pointerFocus.lock()); - if (!LASTHLSURFACE || !tool->active) { + if (!LASTHLSURFACE || !tool->m_active) { if (tool->getSurface()) unfocusTool(tool); @@ -69,9 +69,9 @@ static void refocusTablet(SP tab, SP tool, bool motion = f // yes, this technically ignores any regions set by the app. Too bad! if (LASTHLSURFACE->getWindow()) - local = tool->absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal(); + local = tool->m_absolutePos * LASTHLSURFACE->getWindow()->m_realSize->goal(); else - local = tool->absolutePos * BOX->size(); + local = tool->m_absolutePos * BOX->size(); if (LASTHLSURFACE->getWindow() && LASTHLSURFACE->getWindow()->m_isX11) local = local * LASTHLSURFACE->getWindow()->m_X11SurfaceScaledBy; @@ -106,7 +106,7 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) { const auto PTAB = e.tablet; const auto PTOOL = ensureTabletToolPresent(e.tool); - if (PTOOL->active && (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_Y))) { + if (PTOOL->m_active && (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_Y))) { double x = (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X) ? e.axis.x : NAN; double dx = (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_X) ? e.axisDelta.x : NAN; double y = (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_Y) ? e.axis.y : NAN; @@ -121,14 +121,14 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) { } default: { if (!std::isnan(x)) - PTOOL->absolutePos.x = x; + PTOOL->m_absolutePos.x = x; if (!std::isnan(y)) - PTOOL->absolutePos.y = y; + PTOOL->m_absolutePos.y = y; - if (PTAB->relativeInput) + if (PTAB->m_relativeInput) g_pPointerManager->move(delta); else - g_pPointerManager->warpAbsolute(transformToActiveRegion({x, y}, PTAB->activeArea), PTAB); + g_pPointerManager->warpAbsolute(transformToActiveRegion({x, y}, PTAB->m_activeArea), PTAB); break; } @@ -155,13 +155,13 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) { PROTO::tablet->wheel(PTOOL, e.wheelDelta); if (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_X) - PTOOL->tilt.x = e.tilt.x; + PTOOL->m_tilt.x = e.tilt.x; if (e.updatedAxes & CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_Y) - PTOOL->tilt.y = e.tilt.y; + PTOOL->m_tilt.y = e.tilt.y; if (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_Y)) - PROTO::tablet->tilt(PTOOL, PTOOL->tilt); + PROTO::tablet->tilt(PTOOL, PTOOL->m_tilt); } void CInputManager::onTabletTip(CTablet::STipEvent e) { @@ -169,10 +169,10 @@ void CInputManager::onTabletTip(CTablet::STipEvent e) { const auto PTOOL = ensureTabletToolPresent(e.tool); const auto POS = e.tip; - if (PTAB->relativeInput) + if (PTAB->m_relativeInput) g_pPointerManager->move({0, 0}); else - g_pPointerManager->warpAbsolute(transformToActiveRegion(POS, PTAB->activeArea), PTAB); + g_pPointerManager->warpAbsolute(transformToActiveRegion(POS, PTAB->m_activeArea), PTAB); if (e.in) refocus(); @@ -184,7 +184,7 @@ void CInputManager::onTabletTip(CTablet::STipEvent e) { else PROTO::tablet->up(PTOOL); - PTOOL->isDown = e.in; + PTOOL->m_isDown = e.in; } void CInputManager::onTabletButton(CTablet::SButtonEvent e) { @@ -196,16 +196,16 @@ void CInputManager::onTabletButton(CTablet::SButtonEvent e) { PROTO::tablet->buttonTool(PTOOL, e.button, e.down); if (e.down) - PTOOL->buttonsDown.push_back(e.button); + PTOOL->m_buttonsDown.push_back(e.button); else - std::erase(PTOOL->buttonsDown, e.button); + std::erase(PTOOL->m_buttonsDown, e.button); } void CInputManager::onTabletProximity(CTablet::SProximityEvent e) { const auto PTAB = e.tablet; const auto PTOOL = ensureTabletToolPresent(e.tool); - PTOOL->active = e.in; + PTOOL->m_active = e.in; if (!e.in) { if (PTOOL->getSurface()) @@ -221,16 +221,16 @@ void CInputManager::newTablet(SP pDevice) { m_vHIDs.emplace_back(PNEWTABLET); try { - PNEWTABLET->hlName = g_pInputManager->getNameForNewDevice(pDevice->getName()); + PNEWTABLET->m_hlName = g_pInputManager->getNameForNewDevice(pDevice->getName()); } catch (std::exception& e) { Debug::log(ERR, "Tablet had no name???"); // logic error } g_pPointerManager->attachTablet(PNEWTABLET); - PNEWTABLET->events.destroy.registerStaticListener( + PNEWTABLET->m_events.destroy.registerStaticListener( [this](void* owner, std::any d) { - auto TABLET = ((CTablet*)owner)->self; + auto TABLET = ((CTablet*)owner)->m_self; destroyTablet(TABLET.lock()); }, PNEWTABLET.get()); @@ -249,14 +249,14 @@ SP CInputManager::ensureTabletToolPresent(SPhlName = g_pInputManager->getNameForNewDevice(pTool->getName()); + PTOOL->m_hlName = g_pInputManager->getNameForNewDevice(pTool->getName()); } catch (std::exception& e) { Debug::log(ERR, "Tablet had no name???"); // logic error } - PTOOL->events.destroy.registerStaticListener( + PTOOL->m_events.destroy.registerStaticListener( [this](void* owner, std::any d) { - auto TOOL = ((CTabletTool*)owner)->self; + auto TOOL = ((CTabletTool*)owner)->m_self; destroyTabletTool(TOOL.lock()); }, PTOOL.get()); @@ -269,44 +269,44 @@ void CInputManager::newTabletPad(SP pDevice) { m_vHIDs.emplace_back(PNEWPAD); try { - PNEWPAD->hlName = g_pInputManager->getNameForNewDevice(pDevice->getName()); + PNEWPAD->m_hlName = g_pInputManager->getNameForNewDevice(pDevice->getName()); } catch (std::exception& e) { Debug::log(ERR, "Pad had no name???"); // logic error } // clang-format off - PNEWPAD->events.destroy.registerStaticListener([this](void* owner, std::any d) { - auto PAD = ((CTabletPad*)owner)->self; + PNEWPAD->m_events.destroy.registerStaticListener([this](void* owner, std::any d) { + auto PAD = ((CTabletPad*)owner)->m_self; destroyTabletPad(PAD.lock()); }, PNEWPAD.get()); - PNEWPAD->padEvents.button.registerStaticListener([](void* owner, std::any e) { + PNEWPAD->m_padEvents.button.registerStaticListener([](void* owner, std::any e) { const auto E = std::any_cast(e); - const auto PPAD = ((CTabletPad*)owner)->self.lock(); + const auto PPAD = ((CTabletPad*)owner)->m_self.lock(); PROTO::tablet->mode(PPAD, 0, E.mode, E.timeMs); PROTO::tablet->buttonPad(PPAD, E.button, E.timeMs, E.down); }, PNEWPAD.get()); - PNEWPAD->padEvents.strip.registerStaticListener([](void* owner, std::any e) { + PNEWPAD->m_padEvents.strip.registerStaticListener([](void* owner, std::any e) { const auto E = std::any_cast(e); - const auto PPAD = ((CTabletPad*)owner)->self.lock(); + const auto PPAD = ((CTabletPad*)owner)->m_self.lock(); PROTO::tablet->strip(PPAD, E.strip, E.position, E.finger, E.timeMs); }, PNEWPAD.get()); - PNEWPAD->padEvents.ring.registerStaticListener([](void* owner, std::any e) { + PNEWPAD->m_padEvents.ring.registerStaticListener([](void* owner, std::any e) { const auto E = std::any_cast(e); - const auto PPAD = ((CTabletPad*)owner)->self.lock(); + const auto PPAD = ((CTabletPad*)owner)->m_self.lock(); PROTO::tablet->ring(PPAD, E.ring, E.position, E.finger, E.timeMs); }, PNEWPAD.get()); - PNEWPAD->padEvents.attach.registerStaticListener([](void* owner, std::any e) { - const auto PPAD = ((CTabletPad*)owner)->self.lock(); + PNEWPAD->m_padEvents.attach.registerStaticListener([](void* owner, std::any e) { + const auto PPAD = ((CTabletPad*)owner)->m_self.lock(); const auto TOOL = std::any_cast>(e); - PPAD->parent = TOOL; + PPAD->m_parent = TOOL; }, PNEWPAD.get()); // clang-format on } diff --git a/src/managers/input/Touch.cpp b/src/managers/input/Touch.cpp index 71fd27d87..eab015286 100644 --- a/src/managers/input/Touch.cpp +++ b/src/managers/input/Touch.cpp @@ -23,7 +23,7 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) { static auto PSWIPEINVR = CConfigValue("gestures:workspace_swipe_touch_invert"); EMIT_HOOK_EVENT_CANCELLABLE("touchDown", e); - auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->boundOutput.empty() ? e.device->boundOutput : ""); + auto PMONITOR = g_pCompositor->getMonitorFromName(!e.device->m_boundOutput.empty() ? e.device->m_boundOutput : ""); PMONITOR = PMONITOR ? PMONITOR : g_pCompositor->m_lastMonitor.lock(); diff --git a/src/protocols/InputMethodV2.cpp b/src/protocols/InputMethodV2.cpp index db925757f..6b0226015 100644 --- a/src/protocols/InputMethodV2.cpp +++ b/src/protocols/InputMethodV2.cpp @@ -33,26 +33,26 @@ void CInputMethodKeyboardGrabV2::sendKeyboardData(SP keyboard) { pLastKeyboard = keyboard; - auto keymapFD = allocateSHMFile(keyboard->xkbKeymapString.length() + 1); + auto keymapFD = allocateSHMFile(keyboard->m_xkbKeymapString.length() + 1); if UNLIKELY (!keymapFD.isValid()) { LOGM(ERR, "Failed to create a keymap file for keyboard grab"); return; } - void* data = mmap(nullptr, keyboard->xkbKeymapString.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, keymapFD.get(), 0); + void* data = mmap(nullptr, keyboard->m_xkbKeymapString.length() + 1, PROT_READ | PROT_WRITE, MAP_SHARED, keymapFD.get(), 0); if UNLIKELY (data == MAP_FAILED) { LOGM(ERR, "Failed to mmap a keymap file for keyboard grab"); return; } - memcpy(data, keyboard->xkbKeymapString.c_str(), keyboard->xkbKeymapString.length()); - munmap(data, keyboard->xkbKeymapString.length() + 1); + memcpy(data, keyboard->m_xkbKeymapString.c_str(), keyboard->m_xkbKeymapString.length()); + munmap(data, keyboard->m_xkbKeymapString.length() + 1); - resource->sendKeymap(WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymapFD.get(), keyboard->xkbKeymapString.length() + 1); + resource->sendKeymap(WL_KEYBOARD_KEYMAP_FORMAT_XKB_V1, keymapFD.get(), keyboard->m_xkbKeymapString.length() + 1); - sendMods(keyboard->modifiersState.depressed, keyboard->modifiersState.latched, keyboard->modifiersState.locked, keyboard->modifiersState.group); + sendMods(keyboard->m_modifiersState.depressed, keyboard->m_modifiersState.latched, keyboard->m_modifiersState.locked, keyboard->m_modifiersState.group); - resource->sendRepeatInfo(keyboard->repeatRate, keyboard->repeatDelay); + resource->sendRepeatInfo(keyboard->m_repeatRate, keyboard->m_repeatDelay); } void CInputMethodKeyboardGrabV2::sendKey(uint32_t time, uint32_t key, wl_keyboard_key_state state) { diff --git a/src/protocols/Tablet.cpp b/src/protocols/Tablet.cpp index 843703f04..0aec67e12 100644 --- a/src/protocols/Tablet.cpp +++ b/src/protocols/Tablet.cpp @@ -139,7 +139,7 @@ bool CTabletV2Resource::good() { } void CTabletV2Resource::sendData() { - resource->sendName(tablet->deviceName.c_str()); + resource->sendName(tablet->m_deviceName.c_str()); resource->sendId(tablet->aq()->usbVendorID, tablet->aq()->usbProductID); for (auto const& p : tablet->aq()->paths) { @@ -191,17 +191,17 @@ void CTabletToolV2Resource::sendData() { resource->sendType(AQ_TYPE_TO_PROTO(tool->aq()->type)); resource->sendHardwareSerial(tool->aq()->serial >> 32, tool->aq()->serial & 0xFFFFFFFF); resource->sendHardwareIdWacom(tool->aq()->id >> 32, tool->aq()->id & 0xFFFFFFFF); - if (tool->toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_DISTANCE) + if (tool->m_toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_DISTANCE) resource->sendCapability(zwpTabletToolV2Capability::ZWP_TABLET_TOOL_V2_CAPABILITY_DISTANCE); - if (tool->toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_PRESSURE) + if (tool->m_toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_PRESSURE) resource->sendCapability(zwpTabletToolV2Capability::ZWP_TABLET_TOOL_V2_CAPABILITY_PRESSURE); - if (tool->toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_ROTATION) + if (tool->m_toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_ROTATION) resource->sendCapability(zwpTabletToolV2Capability::ZWP_TABLET_TOOL_V2_CAPABILITY_ROTATION); - if (tool->toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_SLIDER) + if (tool->m_toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_SLIDER) resource->sendCapability(zwpTabletToolV2Capability::ZWP_TABLET_TOOL_V2_CAPABILITY_SLIDER); - if (tool->toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_TILT) + if (tool->m_toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_TILT) resource->sendCapability(zwpTabletToolV2Capability::ZWP_TABLET_TOOL_V2_CAPABILITY_TILT); - if (tool->toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_WHEEL) + if (tool->m_toolCapabilities & CTabletTool::eTabletToolCapabilities::HID_TABLET_TOOL_CAPABILITY_WHEEL) resource->sendCapability(zwpTabletToolV2Capability::ZWP_TABLET_TOOL_V2_CAPABILITY_WHEEL); resource->sendDone(); } diff --git a/src/protocols/core/Seat.cpp b/src/protocols/core/Seat.cpp index 5faabedc2..5a7047172 100644 --- a/src/protocols/core/Seat.cpp +++ b/src/protocols/core/Seat.cpp @@ -303,7 +303,7 @@ CWLKeyboardResource::CWLKeyboardResource(SP resource_, SPkeyboard.lock()); - repeatInfo(g_pSeatManager->keyboard->repeatRate, g_pSeatManager->keyboard->repeatDelay); + repeatInfo(g_pSeatManager->keyboard->m_repeatRate, g_pSeatManager->keyboard->m_repeatDelay); if (g_pSeatManager->state.keyboardFocus && g_pSeatManager->state.keyboardFocus->client() == resource->client()) sendEnter(g_pSeatManager->state.keyboardFocus.lock()); @@ -320,9 +320,9 @@ void CWLKeyboardResource::sendKeymap(SP keyboard) { if (!(PROTO::seat->currentCaps & eHIDCapabilityType::HID_INPUT_CAPABILITY_KEYBOARD)) return; - std::string_view keymap = keyboard->xkbKeymapString; - Hyprutils::OS::CFileDescriptor& fd = keyboard->xkbKeymapFD; - uint32_t size = keyboard->xkbKeymapString.length() + 1; + std::string_view keymap = keyboard->m_xkbKeymapString; + Hyprutils::OS::CFileDescriptor& fd = keyboard->m_xkbKeymapFD; + uint32_t size = keyboard->m_xkbKeymapString.length() + 1; if (keymap == lastKeymap) return;