use static for retrieving config options

This commit is contained in:
Ching Pei Yang 2023-01-13 01:17:21 +01:00
parent a3723895ce
commit 2640dfa165
2 changed files with 12 additions and 8 deletions

View file

@ -560,8 +560,10 @@ void findExtensionForVector2D(wlr_surface* surface, int x, int y, void* data) {
}
CWindow* CCompositor::vectorToWindowIdeal(const Vector2D& pos) {
const auto PMONITOR = getMonitorFromVector(pos);
const auto FOCUS_EXTENT = g_pConfigManager->getConfigValuePtr("general:resize_on_borders")->intValue ? g_pConfigManager->getConfigValuePtr("general:border_size")->intValue : 0;
const auto PMONITOR = getMonitorFromVector(pos);
static auto* const PRESIZEONBORDER = &g_pConfigManager->getConfigValuePtr("general:resize_on_borders")->intValue;
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
const auto FOCUS_EXTENT = *PRESIZEONBORDER ? *PBORDERSIZE : 0;
// special workspace
if (PMONITOR->specialWorkspaceID) {

View file

@ -32,12 +32,14 @@ void CInputManager::onMouseWarp(wlr_pointer_motion_absolute_event* e) {
}
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue;
static auto* const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue;
static auto* const PHOGFOCUS = &g_pConfigManager->getConfigValuePtr("misc:layers_hog_keyboard_focus")->intValue;
static auto* const PFLOATBEHAVIOR = &g_pConfigManager->getConfigValuePtr("input:float_switch_override_focus")->intValue;
const auto FOCUS_EXTENT = g_pConfigManager->getConfigValuePtr("general:resize_on_borders")->intValue ? g_pConfigManager->getConfigValuePtr("general:border_size")->intValue : 0;
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
static auto* const PMOUSEDPMS = &g_pConfigManager->getConfigValuePtr("misc:mouse_move_enables_dpms")->intValue;
static auto* const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue;
static auto* const PHOGFOCUS = &g_pConfigManager->getConfigValuePtr("misc:layers_hog_keyboard_focus")->intValue;
static auto* const PFLOATBEHAVIOR = &g_pConfigManager->getConfigValuePtr("input:float_switch_override_focus")->intValue;
static auto* const PRESIZEONBORDER = &g_pConfigManager->getConfigValuePtr("general:resize_on_borders")->intValue;
static auto* const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
const auto FOCUS_EXTENT = *PRESIZEONBORDER ? *PBORDERSIZE : 0;
m_pFoundSurfaceToFocus = nullptr;
m_pFoundLSToFocus = nullptr;