Add option to disable/enable mouse window dragging animations (#1658)

This commit is contained in:
Dashie 2023-02-28 21:50:10 +01:00 committed by GitHub
parent 91fd854e3b
commit 7187ea443e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 18 deletions

View file

@ -60,6 +60,7 @@ void CConfigManager::setDefaultVars() {
configValues["misc:always_follow_on_dnd"].intValue = 1; configValues["misc:always_follow_on_dnd"].intValue = 1;
configValues["misc:layers_hog_keyboard_focus"].intValue = 1; configValues["misc:layers_hog_keyboard_focus"].intValue = 1;
configValues["misc:animate_manual_resizes"].intValue = 0; configValues["misc:animate_manual_resizes"].intValue = 0;
configValues["misc:animate_mouse_windowdragging"].intValue = 0;
configValues["misc:disable_autoreload"].intValue = 0; configValues["misc:disable_autoreload"].intValue = 0;
configValues["misc:enable_swallow"].intValue = 0; configValues["misc:enable_swallow"].intValue = 0;
configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY; configValues["misc:swallow_regex"].strValue = STRVAL_EMPTY;
@ -1837,3 +1838,4 @@ void CConfigManager::addPluginConfigVar(HANDLE handle, const std::string& name,
void CConfigManager::removePluginConfig(HANDLE handle) { void CConfigManager::removePluginConfig(HANDLE handle) {
std::erase_if(pluginConfigs, [&](const auto& other) { return other.first == handle; }); std::erase_if(pluginConfigs, [&](const auto& other) { return other.first == handle; });
} }

View file

@ -272,6 +272,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
const auto DELTA = Vector2D(mousePos.x - m_vBeginDragXY.x, mousePos.y - m_vBeginDragXY.y); const auto DELTA = Vector2D(mousePos.x - m_vBeginDragXY.x, mousePos.y - m_vBeginDragXY.y);
const auto TICKDELTA = Vector2D(mousePos.x - m_vLastDragXY.x, mousePos.y - m_vLastDragXY.y); const auto TICKDELTA = Vector2D(mousePos.x - m_vLastDragXY.x, mousePos.y - m_vLastDragXY.y);
const auto PANIMATEMOUSE = &g_pConfigManager->getConfigValuePtr("misc:animate_mouse_windowdragging")->intValue;
const auto PANIMATE = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue; const auto PANIMATE = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue;
if (abs(TICKDELTA.x) < 1.f && abs(TICKDELTA.y) < 1.f) if (abs(TICKDELTA.x) < 1.f && abs(TICKDELTA.y) < 1.f)
@ -283,7 +284,7 @@ void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
if (g_pInputManager->dragMode == MBIND_MOVE) { if (g_pInputManager->dragMode == MBIND_MOVE) {
if (*PANIMATE) { if (*PANIMATEMOUSE) {
DRAGGINGWINDOW->m_vRealPosition = m_vBeginDragPositionXY + DELTA; DRAGGINGWINDOW->m_vRealPosition = m_vBeginDragPositionXY + DELTA;
} else { } else {
DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(m_vBeginDragPositionXY + DELTA); DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(m_vBeginDragPositionXY + DELTA);