layers: fix wonky focus on multimon

This commit is contained in:
vaxerski 2023-05-09 17:01:18 +01:00
parent cc4ccfdbfd
commit 7fde80f38e
2 changed files with 8 additions and 4 deletions

View file

@ -111,7 +111,7 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
layersurface->layerSurface->mapped = true; layersurface->layerSurface->mapped = true;
layersurface->mapped = true; layersurface->mapped = true;
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive;
layersurface->surface = layersurface->layerSurface->surface; layersurface->surface = layersurface->layerSurface->surface;
// anim // anim
@ -325,7 +325,7 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if (layersurface->layerSurface->current.keyboard_interactive && if (layersurface->layerSurface->current.keyboard_interactive &&
(!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) // don't focus if constrained (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) // don't focus if constrained
&& g_pCompositor->m_pLastFocus != layersurface->layerSurface->surface) { && !layersurface->keyboardExclusive) {
g_pCompositor->focusSurface(layersurface->layerSurface->surface); g_pCompositor->focusSurface(layersurface->layerSurface->surface);
const auto LOCAL = const auto LOCAL =
@ -333,10 +333,12 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y); wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y); wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
} else if (!layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) && } else if (!layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint) &&
g_pCompositor->m_pLastFocus == layersurface->layerSurface->surface) { layersurface->keyboardExclusive) {
g_pInputManager->refocus(); g_pInputManager->refocus();
} }
layersurface->keyboardExclusive = layersurface->layerSurface->current.keyboard_interactive;
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y); g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale); g_pProtocolManager->m_pFractionalScaleProtocolManager->setPreferredScaleForSurface(layersurface->layerSurface->surface, PMONITOR->scale);

View file

@ -21,6 +21,8 @@ struct SLayerSurface {
wlr_layer_surface_v1* layerSurface; wlr_layer_surface_v1* layerSurface;
wl_list link; wl_list link;
bool keyboardExclusive = false;
CWLSurface surface; CWLSurface surface;
std::list<CWLSurface> popupSurfaces; std::list<CWLSurface> popupSurfaces;