mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-15 06:25:59 +01:00
feat: drag the window when the cursor starts moving
This commit is contained in:
parent
b57086aa43
commit
a8b7779365
3 changed files with 18 additions and 5 deletions
|
@ -1073,6 +1073,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{false},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "misc:drag_window_when_cursor_move",
|
||||
.description = "When the user click on the window but don't drag the window, the window still there and not float",
|
||||
.type = CONFIG_OPTION_BOOL,
|
||||
.data = SConfigOptionDescription::SBoolData{true},
|
||||
},
|
||||
|
||||
/*
|
||||
* binds:
|
||||
|
|
|
@ -373,6 +373,8 @@ CConfigManager::CConfigManager() {
|
|||
m_pConfig->addConfigValue("misc:middle_click_paste", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("misc:render_unfocused_fps", Hyprlang::INT{15});
|
||||
m_pConfig->addConfigValue("misc:disable_xdg_env_checks", Hyprlang::INT{0});
|
||||
m_pConfig->addConfigValue("misc:drag_window_when_cursor_move", Hyprlang::INT{0});
|
||||
|
||||
|
||||
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
||||
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
||||
|
|
|
@ -247,14 +247,19 @@ void IHyprLayout::onBeginDragWindow() {
|
|||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||
|
||||
m_vDraggingWindowOriginalFloatSize = DRAGGINGWINDOW->m_vLastFloatingSize;
|
||||
|
||||
|
||||
static auto drag_window_when_cursor_move = CConfigValue<Hyprlang::INT>("misc:drag_window_when_cursor_move");
|
||||
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
||||
if (g_pInputManager->dragMode == MBIND_MOVE) {
|
||||
if (*drag_window_when_cursor_move) {
|
||||
DRAGGINGWINDOW->m_bIsFloating = false;
|
||||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||
} else {
|
||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||
DRAGGINGWINDOW->m_bIsFloating = true;
|
||||
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
||||
}
|
||||
DRAGGINGWINDOW->m_vLastFloatingSize = (DRAGGINGWINDOW->m_vRealSize.goal() * 0.8489).clamp(Vector2D{5, 5}, Vector2D{}).floor();
|
||||
changeWindowFloatingMode(DRAGGINGWINDOW);
|
||||
DRAGGINGWINDOW->m_bIsFloating = true;
|
||||
DRAGGINGWINDOW->m_bDraggingTiled = true;
|
||||
|
||||
DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize.goal() / 2.f;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue