mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-26 00:45:57 +01:00
input: force focus on movefocus
This commit is contained in:
parent
9f72d508ae
commit
baf81cdc5d
3 changed files with 16 additions and 8 deletions
|
@ -983,7 +983,9 @@ void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
g_pCompositor->focusWindow(PWINDOWTOCHANGETO);
|
g_pCompositor->focusWindow(PWINDOWTOCHANGETO);
|
||||||
Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f;
|
Vector2D middle = PWINDOWTOCHANGETO->m_vRealPosition.goalv() + PWINDOWTOCHANGETO->m_vRealSize.goalv() / 2.f;
|
||||||
g_pCompositor->warpCursorTo(middle);
|
g_pCompositor->warpCursorTo(middle);
|
||||||
|
g_pInputManager->m_pForcedFocus = PWINDOWTOCHANGETO;
|
||||||
g_pInputManager->simulateMouseMovement();
|
g_pInputManager->simulateMouseMovement();
|
||||||
|
g_pInputManager->m_pForcedFocus = nullptr;
|
||||||
|
|
||||||
if (PLASTWINDOW->m_iMonitorID != PWINDOWTOCHANGETO->m_iMonitorID) {
|
if (PLASTWINDOW->m_iMonitorID != PWINDOWTOCHANGETO->m_iMonitorID) {
|
||||||
// event
|
// event
|
||||||
|
|
|
@ -98,6 +98,12 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
if (*PZOOMFACTOR != 1.f)
|
if (*PZOOMFACTOR != 1.f)
|
||||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||||
|
|
||||||
|
if (m_pForcedFocus) {
|
||||||
|
pFoundWindow = m_pForcedFocus;
|
||||||
|
surfacePos = pFoundWindow->m_vRealPosition.vec();
|
||||||
|
foundSurface = m_pForcedFocus->m_pWLSurface.wlr();
|
||||||
|
}
|
||||||
|
|
||||||
// constraints
|
// constraints
|
||||||
// All constraints TODO: multiple mice?
|
// All constraints TODO: multiple mice?
|
||||||
if (g_pCompositor->m_sSeat.mouse && g_pCompositor->m_sSeat.mouse->currentConstraint && !g_pCompositor->m_sSeat.exclusiveClient && !g_pSessionLockManager->isSessionLocked()) {
|
if (g_pCompositor->m_sSeat.mouse && g_pCompositor->m_sSeat.mouse->currentConstraint && !g_pCompositor->m_sSeat.exclusiveClient && !g_pSessionLockManager->isSessionLocked()) {
|
||||||
|
|
|
@ -7,21 +7,18 @@
|
||||||
#include "../../helpers/Timer.hpp"
|
#include "../../helpers/Timer.hpp"
|
||||||
#include "InputMethodRelay.hpp"
|
#include "InputMethodRelay.hpp"
|
||||||
|
|
||||||
enum eClickBehaviorMode
|
enum eClickBehaviorMode {
|
||||||
{
|
|
||||||
CLICKMODE_DEFAULT = 0,
|
CLICKMODE_DEFAULT = 0,
|
||||||
CLICKMODE_KILL
|
CLICKMODE_KILL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eMouseBindMode
|
enum eMouseBindMode {
|
||||||
{
|
|
||||||
MBIND_INVALID = -1,
|
MBIND_INVALID = -1,
|
||||||
MBIND_MOVE = 0,
|
MBIND_MOVE = 0,
|
||||||
MBIND_RESIZE
|
MBIND_RESIZE
|
||||||
};
|
};
|
||||||
|
|
||||||
enum eBorderIconDirection
|
enum eBorderIconDirection {
|
||||||
{
|
|
||||||
BORDERICON_NONE,
|
BORDERICON_NONE,
|
||||||
BORDERICON_UP,
|
BORDERICON_UP,
|
||||||
BORDERICON_DOWN,
|
BORDERICON_DOWN,
|
||||||
|
@ -111,8 +108,11 @@ class CInputManager {
|
||||||
STouchData m_sTouchData;
|
STouchData m_sTouchData;
|
||||||
|
|
||||||
// for dragging floating windows
|
// for dragging floating windows
|
||||||
CWindow* currentlyDraggedWindow = nullptr;
|
CWindow* currentlyDraggedWindow = nullptr;
|
||||||
eMouseBindMode dragMode = MBIND_INVALID;
|
eMouseBindMode dragMode = MBIND_INVALID;
|
||||||
|
|
||||||
|
// for refocus to be forced
|
||||||
|
CWindow* m_pForcedFocus = nullptr;
|
||||||
|
|
||||||
SDrag m_sDrag;
|
SDrag m_sDrag;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue