summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorvaxerski <vaxry@vaxry.net>2022-08-06 22:26:32 +0200
committervaxerski <vaxry@vaxry.net>2022-08-06 22:26:32 +0200
commit9564a4cd127d2d24324fc8a9adb6096960248ec8 (patch)
treeb093268a515be1b0ffdda359055e914c31a784dd /src
parent64e80991ca335c4ef7da736bb5582747caca284a (diff)
added misc:always_follow_on_dnd
Diffstat (limited to 'src')
-rw-r--r--src/config/ConfigManager.cpp1
-rw-r--r--src/events/Misc.cpp12
-rw-r--r--src/managers/input/InputManager.cpp15
-rw-r--r--src/managers/input/InputManager.hpp2
4 files changed, 25 insertions, 5 deletions
diff --git a/src/config/ConfigManager.cpp b/src/config/ConfigManager.cpp
index 5128a4c3..3889177a 100644
--- a/src/config/ConfigManager.cpp
+++ b/src/config/ConfigManager.cpp
@@ -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;
diff --git a/src/events/Misc.cpp b/src/events/Misc.cpp
index 38219e57..e6e29f11 100644
--- a/src/events/Misc.cpp
+++ b/src/events/Misc.cpp
@@ -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) {
diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp
index cf381cbd..ed7623d6 100644
--- a/src/managers/input/InputManager.cpp
+++ b/src/managers/input/InputManager.cpp
@@ -29,7 +29,8 @@ 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 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:
diff --git a/src/managers/input/InputManager.hpp b/src/managers/input/InputManager.hpp
index ed3940d6..cb0bd722 100644
--- a/src/managers/input/InputManager.hpp
+++ b/src/managers/input/InputManager.hpp
@@ -84,6 +84,8 @@ public:
// for shared mods
uint32_t accumulateModsFromAllKBs();
+ CWindow* m_pFollowOnDnDBegin = nullptr;
+
private:
// for click behavior override