mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-09 23:05:59 +01:00
added misc:always_follow_on_dnd
This commit is contained in:
parent
64e80991ca
commit
9564a4cd12
4 changed files with 25 additions and 5 deletions
|
@ -54,6 +54,7 @@ void CConfigManager::setDefaultVars() {
|
|||
configValues["misc:no_vfr"].intValue = 1;
|
||||
configValues["misc:damage_entire_on_snapshot"].intValue = 0;
|
||||
configValues["misc:mouse_move_enables_dpms"].intValue = 0;
|
||||
configValues["misc:always_follow_on_dnd"].intValue = 1;
|
||||
|
||||
configValues["debug:int"].intValue = 0;
|
||||
configValues["debug:log_damage"].intValue = 0;
|
||||
|
|
|
@ -103,6 +103,13 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
|
|||
g_pInputManager->m_sDrag.hyprListener_destroyIcon.initCallback(&wlrDrag->icon->events.destroy, &Events::listener_destroyDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
||||
g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
|
||||
}
|
||||
|
||||
static auto *const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue;
|
||||
|
||||
if (*PFOLLOWONDND)
|
||||
g_pInputManager->m_pFollowOnDnDBegin = g_pCompositor->m_pLastWindow;
|
||||
else
|
||||
g_pInputManager->m_pFollowOnDnDBegin = nullptr;
|
||||
}
|
||||
|
||||
void Events::listener_destroyDrag(void* owner, void* data) {
|
||||
|
@ -113,6 +120,11 @@ void Events::listener_destroyDrag(void* owner, void* data) {
|
|||
g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback();
|
||||
|
||||
g_pInputManager->refocus();
|
||||
|
||||
if (g_pInputManager->m_pFollowOnDnDBegin)
|
||||
g_pCompositor->focusWindow(g_pInputManager->m_pFollowOnDnDBegin);
|
||||
|
||||
g_pInputManager->m_pFollowOnDnDBegin = nullptr;
|
||||
}
|
||||
|
||||
void Events::listener_mapDragIcon(void* owner, void* data) {
|
||||
|
|
|
@ -30,6 +30,7 @@ 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;
|
||||
|
||||
if (!g_pCompositor->m_bReadyToProcess)
|
||||
return;
|
||||
|
@ -246,6 +247,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
}
|
||||
|
||||
if (*PFOLLOWONDND && m_sDrag.dragIcon) {
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
}
|
||||
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||
return; // don't enter any new surfaces
|
||||
} else {
|
||||
|
@ -724,16 +729,16 @@ void CInputManager::refocus() {
|
|||
}
|
||||
|
||||
void CInputManager::updateDragIcon() {
|
||||
if (!g_pInputManager->m_sDrag.dragIcon)
|
||||
if (!m_sDrag.dragIcon)
|
||||
return;
|
||||
|
||||
switch (g_pInputManager->m_sDrag.dragIcon->drag->grab_type) {
|
||||
switch (m_sDrag.dragIcon->drag->grab_type) {
|
||||
case WLR_DRAG_GRAB_KEYBOARD:
|
||||
break;
|
||||
case WLR_DRAG_GRAB_KEYBOARD_POINTER: {
|
||||
wlr_box box = {g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4, g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4};
|
||||
wlr_box box = {m_sDrag.pos.x - 2, m_sDrag.pos.y - 2, m_sDrag.dragIcon->surface->current.width + 4, m_sDrag.dragIcon->surface->current.height + 4};
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
g_pInputManager->m_sDrag.pos = g_pInputManager->getMouseCoordsInternal();
|
||||
m_sDrag.pos = getMouseCoordsInternal();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
@ -84,6 +84,8 @@ public:
|
|||
// for shared mods
|
||||
uint32_t accumulateModsFromAllKBs();
|
||||
|
||||
CWindow* m_pFollowOnDnDBegin = nullptr;
|
||||
|
||||
private:
|
||||
|
||||
// for click behavior override
|
||||
|
|
Loading…
Reference in a new issue