mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-08 07:25:59 +01:00
Input: fix always_follow_on_dnd
This commit is contained in:
parent
60527ab180
commit
b88de63abb
3 changed files with 15 additions and 32 deletions
|
@ -116,20 +116,11 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
|
|||
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) {
|
||||
Debug::log(LOG, "Drag destroyed.");
|
||||
|
||||
static auto* const PFOLLOWMOUSE = &g_pConfigManager->getConfigValuePtr("input:follow_mouse")->intValue;
|
||||
|
||||
if (g_pInputManager->m_sDrag.drag && g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.dragIcon->surface)
|
||||
g_pHyprRenderer->damageBox(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);
|
||||
|
@ -137,13 +128,6 @@ void Events::listener_destroyDrag(void* owner, void* data) {
|
|||
g_pInputManager->m_sDrag.drag = nullptr;
|
||||
g_pInputManager->m_sDrag.dragIcon = nullptr;
|
||||
g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback();
|
||||
|
||||
g_pInputManager->refocus();
|
||||
|
||||
if (g_pInputManager->m_pFollowOnDnDBegin && *PFOLLOWMOUSE != 1)
|
||||
g_pCompositor->focusWindow(g_pInputManager->m_pFollowOnDnDBegin);
|
||||
|
||||
g_pInputManager->m_pFollowOnDnDBegin = nullptr;
|
||||
}
|
||||
|
||||
void Events::listener_mapDragIcon(void* owner, void* data) {
|
||||
|
|
|
@ -58,6 +58,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||
static auto* const PRESIZECURSORICON = &g_pConfigManager->getConfigValuePtr("general:hover_icon_on_border")->intValue;
|
||||
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0;
|
||||
|
||||
const auto FOLLOWMOUSE = *PFOLLOWONDND && m_sDrag.drag ? 1 : *PFOLLOWMOUSE;
|
||||
|
||||
m_pFoundSurfaceToFocus = nullptr;
|
||||
m_pFoundLSToFocus = nullptr;
|
||||
m_pFoundWindowToFocus = nullptr;
|
||||
|
@ -321,14 +323,14 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||
// }
|
||||
// }
|
||||
|
||||
if (*PFOLLOWMOUSE != 1 && !refocus) {
|
||||
if (FOLLOWMOUSE != 1 && !refocus) {
|
||||
if (pFoundWindow != g_pCompositor->m_pLastWindow && g_pCompositor->m_pLastWindow &&
|
||||
((pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR == 2) || (g_pCompositor->m_pLastWindow->m_bIsFloating != pFoundWindow->m_bIsFloating && *PFLOATBEHAVIOR != 0))) {
|
||||
// enter if change floating style
|
||||
if (*PFOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
||||
if (FOLLOWMOUSE != 3 && allowKeyboardRefocus)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
} else if (*PFOLLOWMOUSE == 2 || *PFOLLOWMOUSE == 3) {
|
||||
} else if (FOLLOWMOUSE == 2 || FOLLOWMOUSE == 3) {
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
}
|
||||
|
||||
|
@ -339,17 +341,13 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||
}
|
||||
}
|
||||
|
||||
if (*PFOLLOWONDND && m_sDrag.dragIcon) {
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
}
|
||||
|
||||
if (*PFOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow)
|
||||
if (FOLLOWMOUSE != 0 || pFoundWindow == g_pCompositor->m_pLastWindow)
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||
|
||||
m_bLastFocusOnLS = false;
|
||||
return; // don't enter any new surfaces
|
||||
} else {
|
||||
if ((*PFOLLOWMOUSE != 3 && allowKeyboardRefocus) || refocus)
|
||||
if ((FOLLOWMOUSE != 3 && allowKeyboardRefocus) || refocus)
|
||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||
}
|
||||
|
||||
|
@ -361,7 +359,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||
}
|
||||
|
||||
if (pFoundLayerSurface && (pFoundLayerSurface->layerSurface->current.keyboard_interactive || pFoundLayerSurface->layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) &&
|
||||
*PFOLLOWMOUSE != 3 && allowKeyboardRefocus) {
|
||||
FOLLOWMOUSE != 3 && allowKeyboardRefocus) {
|
||||
g_pCompositor->focusSurface(foundSurface);
|
||||
}
|
||||
|
||||
|
|
|
@ -7,18 +7,21 @@
|
|||
#include "../../helpers/Timer.hpp"
|
||||
#include "InputMethodRelay.hpp"
|
||||
|
||||
enum eClickBehaviorMode {
|
||||
enum eClickBehaviorMode
|
||||
{
|
||||
CLICKMODE_DEFAULT = 0,
|
||||
CLICKMODE_KILL
|
||||
};
|
||||
|
||||
enum eMouseBindMode {
|
||||
enum eMouseBindMode
|
||||
{
|
||||
MBIND_INVALID = -1,
|
||||
MBIND_MOVE = 0,
|
||||
MBIND_RESIZE
|
||||
};
|
||||
|
||||
enum eBorderIconDirection {
|
||||
enum eBorderIconDirection
|
||||
{
|
||||
BORDERICON_NONE,
|
||||
BORDERICON_UP,
|
||||
BORDERICON_DOWN,
|
||||
|
@ -154,8 +157,6 @@ class CInputManager {
|
|||
// for shared mods
|
||||
uint32_t accumulateModsFromAllKBs();
|
||||
|
||||
CWindow* m_pFollowOnDnDBegin = nullptr;
|
||||
|
||||
// for virtual keyboards: whether we should respect them as normal ones
|
||||
bool shouldIgnoreVirtualKeyboard(SKeyboard*);
|
||||
|
||||
|
|
Loading…
Reference in a new issue