Skip to content

Commit

Permalink
input: refocus on completed drags
Browse files Browse the repository at this point in the history
  • Loading branch information
vaxerski committed Feb 17, 2024
1 parent cdcc5ab commit 294e51a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/events/Misc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ 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_pCompositor->focusWindow(g_pCompositor->m_pLastWindow, g_pCompositor->m_pLastWindow ? g_pXWaylandManager->getWindowSurface(g_pCompositor->m_pLastWindow) : nullptr);
}

void Events::listener_mapDragIcon(void* owner, void* data) {
Expand Down
2 changes: 1 addition & 1 deletion src/managers/input/InputManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
return; // don't enter any new surfaces
} else {
if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus != pFoundWindow)) || refocus)) {
if (m_pLastMouseFocus != pFoundWindow || g_pCompositor->m_pLastWindow != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface) {
if (m_pLastMouseFocus != pFoundWindow || g_pCompositor->m_pLastWindow != pFoundWindow || g_pCompositor->m_pLastFocus != foundSurface || refocus) {
m_pLastMouseFocus = pFoundWindow;

// TODO: this looks wrong. When over a popup, it constantly is switching.
Expand Down

0 comments on commit 294e51a

Please sign in to comment.