mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-02 14:26:00 +01:00
layershell: Fix greedy mouse grab from keyboard_interactive layer (#4401)
* Layer: Don't allow a keyboard-layer to steal focus from other layers * Input: Don't change keyboard focus on click if focus is locked
This commit is contained in:
parent
babb9c07b0
commit
c4da4b026d
2 changed files with 2 additions and 10 deletions
|
@ -1102,14 +1102,6 @@ wlr_surface* CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<
|
||||||
|
|
||||||
auto SURFACEAT = wlr_layer_surface_v1_surface_at(ls->layerSurface, pos.x - ls->geometry.x, pos.y - ls->geometry.y, &sCoords->x, &sCoords->y);
|
auto SURFACEAT = wlr_layer_surface_v1_surface_at(ls->layerSurface, pos.x - ls->geometry.x, pos.y - ls->geometry.y, &sCoords->x, &sCoords->y);
|
||||||
|
|
||||||
if (ls->layerSurface->current.keyboard_interactive && ls->layer >= ZWLR_LAYER_SHELL_V1_LAYER_TOP) {
|
|
||||||
if (!SURFACEAT)
|
|
||||||
SURFACEAT = ls->layerSurface->surface;
|
|
||||||
|
|
||||||
*ppLayerSurfaceFound = ls.get();
|
|
||||||
return SURFACEAT;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (SURFACEAT) {
|
if (SURFACEAT) {
|
||||||
if (!pixman_region32_not_empty(&SURFACEAT->input_region))
|
if (!pixman_region32_not_empty(&SURFACEAT->input_region))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -359,7 +359,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
|
|
||||||
bool allowKeyboardRefocus = true;
|
bool allowKeyboardRefocus = true;
|
||||||
|
|
||||||
if (!refocus && g_pCompositor->m_pLastFocus) {
|
if (g_pCompositor->m_pLastFocus) {
|
||||||
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus);
|
const auto PLS = g_pCompositor->getLayerSurfaceFromSurface(g_pCompositor->m_pLastFocus);
|
||||||
|
|
||||||
if (PLS && PLS->layerSurface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
if (PLS && PLS->layerSurface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||||
|
@ -421,7 +421,7 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
m_bLastFocusOnLS = false;
|
m_bLastFocusOnLS = false;
|
||||||
return; // don't enter any new surfaces
|
return; // don't enter any new surfaces
|
||||||
} else {
|
} else {
|
||||||
if (((FOLLOWMOUSE != 3 && allowKeyboardRefocus) && (*PMOUSEREFOCUS || m_pLastMouseFocus != pFoundWindow)) || refocus) {
|
if (allowKeyboardRefocus && ((FOLLOWMOUSE != 3 && (*PMOUSEREFOCUS || m_pLastMouseFocus != pFoundWindow)) || refocus)) {
|
||||||
m_pLastMouseFocus = pFoundWindow;
|
m_pLastMouseFocus = pFoundWindow;
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue