mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-05-13 07:10:35 +01:00
Merge 33ef00383d
into da3583fd5e
This commit is contained in:
commit
0635c50222
5 changed files with 28 additions and 6 deletions
|
@ -869,7 +869,10 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||
static auto PBORDERSIZE = CConfigValue<Hyprlang::INT>("general:border_size");
|
||||
static auto PBORDERGRABEXTEND = CConfigValue<Hyprlang::INT>("general:extend_border_grab_area");
|
||||
static auto PSPECIALFALLTHRU = CConfigValue<Hyprlang::INT>("input:special_fallthrough");
|
||||
static auto PFOLLOWMSHRINK = CConfigValue<Hyprlang::INT>("input:follow_mouse_shrink");
|
||||
const auto BORDER_GRAB_AREA = *PRESIZEONBORDER ? *PBORDERSIZE + *PBORDERGRABEXTEND : 0;
|
||||
const auto HITBOX_SHRINK = *PFOLLOWMSHRINK;
|
||||
const auto LASTFOCUSED = m_lastWindow.lock();
|
||||
|
||||
// pinned windows on top of floating regardless
|
||||
if (properties & ALLOW_FLOATING) {
|
||||
|
@ -877,6 +880,10 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||
if (w->m_isFloating && w->m_isMapped && !w->isHidden() && !w->m_X11ShouldntFocus && w->m_pinned && !w->m_windowData.noFocus.valueOrDefault() && w != pIgnoreWindow) {
|
||||
const auto BB = w->getWindowBoxUnified(properties);
|
||||
CBox box = BB.copy().expand(!w->isX11OverrideRedirect() ? BORDER_GRAB_AREA : 0);
|
||||
|
||||
if (properties & FOLLOW_MOUSE_CHECK && HITBOX_SHRINK > 0 && w != LASTFOCUSED)
|
||||
box = box.copy().expand(-HITBOX_SHRINK);
|
||||
|
||||
if (box.containsPoint(g_pPointerManager->position()))
|
||||
return w;
|
||||
|
||||
|
@ -916,6 +923,10 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||
|
||||
const auto BB = w->getWindowBoxUnified(properties);
|
||||
CBox box = BB.copy().expand(!w->isX11OverrideRedirect() ? BORDER_GRAB_AREA : 0);
|
||||
|
||||
if (properties & FOLLOW_MOUSE_CHECK && HITBOX_SHRINK > 0 && w != LASTFOCUSED)
|
||||
box = box.copy().expand(-HITBOX_SHRINK);
|
||||
|
||||
if (box.containsPoint(g_pPointerManager->position())) {
|
||||
|
||||
if (w->m_isX11 && w->isX11OverrideRedirect() && !w->m_xwaylandSurface->wantsFocus()) {
|
||||
|
@ -982,6 +993,10 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||
if (!w->m_isFloating && w->m_isMapped && w->workspaceID() == WSPID && !w->isHidden() && !w->m_X11ShouldntFocus && !w->m_windowData.noFocus.valueOrDefault() &&
|
||||
w != pIgnoreWindow) {
|
||||
CBox box = (properties & USE_PROP_TILED) ? w->getWindowBoxUnified(properties) : CBox{w->m_position, w->m_size};
|
||||
|
||||
if (properties & FOLLOW_MOUSE_CHECK && HITBOX_SHRINK > 0 && w != LASTFOCUSED)
|
||||
box = box.copy().expand(-HITBOX_SHRINK);
|
||||
|
||||
if (box.containsPoint(pos))
|
||||
return w;
|
||||
}
|
||||
|
|
|
@ -519,6 +519,12 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||
.type = CONFIG_OPTION_FLOAT,
|
||||
.data = SConfigOptionDescription::SFloatData{},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "input:follow_mouse_shrink",
|
||||
.description = "Shrinks the inactive window hitboxes by the specified amount of pixels.",
|
||||
.type = CONFIG_OPTION_INT,
|
||||
.data = SConfigOptionDescription::SRangeData{0, 0, 300},
|
||||
},
|
||||
SConfigOptionDescription{
|
||||
.value = "input:focus_on_close",
|
||||
.description = "Controls the window focus behavior when a window is closed. When set to 0, focus will shift to the next window candidate. When set to 1, focus will shift "
|
||||
|
|
|
@ -614,6 +614,7 @@ CConfigManager::CConfigManager() {
|
|||
|
||||
registerConfigVar("input:follow_mouse", Hyprlang::INT{1});
|
||||
registerConfigVar("input:follow_mouse_threshold", Hyprlang::FLOAT{0});
|
||||
registerConfigVar("input:follow_mouse_shrink", Hyprlang::INT{0});
|
||||
registerConfigVar("input:focus_on_close", Hyprlang::INT{0});
|
||||
registerConfigVar("input:mouse_refocus", Hyprlang::INT{1});
|
||||
registerConfigVar("input:special_fallthrough", Hyprlang::INT{0});
|
||||
|
|
|
@ -51,6 +51,7 @@ enum eGetWindowProperties : uint8_t {
|
|||
ALLOW_FLOATING = 1 << 4,
|
||||
USE_PROP_TILED = 1 << 5,
|
||||
SKIP_FULLSCREEN_PRIORITY = 1 << 6,
|
||||
FOLLOW_MOUSE_CHECK = 1 << 7,
|
||||
};
|
||||
|
||||
enum eSuppressEvents : uint8_t {
|
||||
|
|
|
@ -359,7 +359,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
// then, we check if the workspace doesnt have a fullscreen window
|
||||
const auto PWORKSPACE = PMONITOR->m_activeWorkspace;
|
||||
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING | FOLLOW_MOUSE_CHECK);
|
||||
if (PWORKSPACE->m_hasFullscreenWindow && !foundSurface && PWORKSPACE->m_fullscreenMode == FSMODE_FULLSCREEN) {
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
||||
|
@ -389,11 +389,10 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
if (!foundSurface) {
|
||||
if (PMONITOR->m_activeSpecialWorkspace) {
|
||||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING | FOLLOW_MOUSE_CHECK);
|
||||
|
||||
if (pFoundWindow && !pFoundWindow->onSpecialWorkspace()) {
|
||||
if (pFoundWindow && !pFoundWindow->onSpecialWorkspace())
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
}
|
||||
} else {
|
||||
// if we have a maximized window, allow focusing on a bar or something if in reserved area.
|
||||
if (g_pCompositor->isPointOnReservedArea(mouseCoords, PMONITOR)) {
|
||||
|
@ -403,7 +402,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
if (!foundSurface) {
|
||||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING | FOLLOW_MOUSE_CHECK);
|
||||
|
||||
if (!(pFoundWindow && (pFoundWindow->m_isFloating && (pFoundWindow->m_createdOverFullscreen || pFoundWindow->m_pinned))))
|
||||
pFoundWindow = PWORKSPACE->getFullscreenWindow();
|
||||
|
@ -413,7 +412,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus, bool mouse) {
|
|||
|
||||
} else {
|
||||
if (pFoundWindow != PWINDOWIDEAL)
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING);
|
||||
pFoundWindow = g_pCompositor->vectorToWindowUnified(mouseCoords, RESERVED_EXTENTS | INPUT_EXTENTS | ALLOW_FLOATING | FOLLOW_MOUSE_CHECK);
|
||||
}
|
||||
|
||||
if (pFoundWindow) {
|
||||
|
|
Loading…
Reference in a new issue