internal: refactor to use empty() (#10599)

This commit is contained in:
Kamikadze
2025-05-31 23:49:50 +05:00
committed by GitHub
parent 4078e1d17c
commit 69c2b2926e
20 changed files with 57 additions and 57 deletions

View File

@@ -1082,7 +1082,7 @@ void CInputManager::applyConfigToKeyboard(SP<IKeyboard> pKeyboard) {
pKeyboard->m_allowed = PERM == PERMISSION_RULE_ALLOW_MODE_ALLOW;
try {
if (NUMLOCKON == pKeyboard->m_numlockOn && REPEATDELAY == pKeyboard->m_repeatDelay && REPEATRATE == pKeyboard->m_repeatRate && RULES != "" &&
if (NUMLOCKON == pKeyboard->m_numlockOn && REPEATDELAY == pKeyboard->m_repeatDelay && REPEATRATE == pKeyboard->m_repeatRate && !RULES.empty() &&
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.");
@@ -1205,7 +1205,7 @@ void CInputManager::setPointerConfigs() {
libinput_device_config_middle_emulation_set_enabled(LIBINPUTDEV, LIBINPUT_CONFIG_MIDDLE_EMULATION_DISABLED);
const auto TAP_MAP = g_pConfigManager->getDeviceString(devname, "tap_button_map", "input:touchpad:tap_button_map");
if (TAP_MAP == "" || TAP_MAP == "lrm")
if (TAP_MAP.empty() || TAP_MAP == "lrm")
libinput_device_config_tap_set_button_map(LIBINPUTDEV, LIBINPUT_CONFIG_TAP_MAP_LRM);
else if (TAP_MAP == "lmr")
libinput_device_config_tap_set_button_map(LIBINPUTDEV, LIBINPUT_CONFIG_TAP_MAP_LMR);
@@ -1214,7 +1214,7 @@ void CInputManager::setPointerConfigs() {
}
const auto SCROLLMETHOD = g_pConfigManager->getDeviceString(devname, "scroll_method", "input:scroll_method");
if (SCROLLMETHOD == "") {
if (SCROLLMETHOD.empty()) {
libinput_device_config_scroll_set_method(LIBINPUTDEV, libinput_device_config_scroll_get_default_method(LIBINPUTDEV));
} else if (SCROLLMETHOD == "no_scroll") {
libinput_device_config_scroll_set_method(LIBINPUTDEV, LIBINPUT_CONFIG_SCROLL_NO_SCROLL);
@@ -1330,7 +1330,7 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
std::erase_if(m_keyboards, [pKeyboard](const auto& other) { return other == pKeyboard; });
if (m_keyboards.size() > 0) {
if (!m_keyboards.empty()) {
bool found = false;
for (auto const& k : m_keyboards | std::views::reverse) {
if (!k)
@@ -1354,7 +1354,7 @@ void CInputManager::destroyPointer(SP<IPointer> mouse) {
std::erase_if(m_pointers, [mouse](const auto& other) { return other == mouse; });
g_pSeatManager->setMouse(m_pointers.size() > 0 ? m_pointers.front() : nullptr);
g_pSeatManager->setMouse(!m_pointers.empty() ? m_pointers.front() : nullptr);
if (!g_pSeatManager->m_mouse.expired())
unconstrainMouse();