mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 15:05:59 +01:00
fixed layersurface coord mapping
This commit is contained in:
parent
2bc29f32ec
commit
118006e876
3 changed files with 22 additions and 18 deletions
|
@ -467,5 +467,5 @@ void CCompositor::fixXWaylandWindowsOnWorkspace(const int& id) {
|
|||
}
|
||||
|
||||
bool CCompositor::doesSeatAcceptInput(wlr_surface* surface) {
|
||||
return !m_sSeat.exclusiveClient || m_sSeat.exclusiveClient == wl_resource_get_client(surface->resource);
|
||||
return !m_sSeat.exclusiveClient || (surface && m_sSeat.exclusiveClient == wl_resource_get_client(surface->resource));
|
||||
}
|
|
@ -51,7 +51,7 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
|||
WLRLAYERSURFACE->data = layerSurface;
|
||||
layerSurface->monitorID = PMONITOR->ID;
|
||||
|
||||
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
|
||||
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
|
||||
}
|
||||
|
||||
void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
||||
|
@ -70,6 +70,8 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
|||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
|
||||
|
||||
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
|
||||
|
||||
// remove the layersurface as it's not used anymore
|
||||
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
|
||||
delete layersurface;
|
||||
|
@ -79,9 +81,6 @@ void Events::listener_destroyLayerSurface(wl_listener* listener, void* data) {
|
|||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
|
||||
}
|
||||
|
||||
|
||||
Debug::log(LOG, "LayerSurface %x destroyed", layersurface);
|
||||
}
|
||||
|
||||
void Events::listener_mapLayerSurface(wl_listener* listener, void* data) {
|
||||
|
@ -105,10 +104,10 @@ void Events::listener_mapLayerSurface(wl_listener* listener, void* data) {
|
|||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
|
||||
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY)
|
||||
if (layersurface->layerSurface->current.keyboard_interactive)
|
||||
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
|
||||
|
||||
Debug::log(LOG, "LayerSurface %x mapped", layersurface);
|
||||
Debug::log(LOG, "LayerSurface %x mapped", layersurface->layerSurface);
|
||||
}
|
||||
|
||||
void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) {
|
||||
|
@ -120,7 +119,7 @@ void Events::listener_unmapLayerSurface(wl_listener* listener, void* data) {
|
|||
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
|
||||
g_pCompositor->m_pLastFocus = nullptr;
|
||||
|
||||
Debug::log(LOG, "LayerSurface %x unmapped", layersurface);
|
||||
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
|
||||
}
|
||||
|
||||
void Events::listener_commitLayerSurface(wl_listener* listener, void* data) {
|
||||
|
|
|
@ -23,6 +23,7 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
|||
wlr_surface* foundSurface = nullptr;
|
||||
Vector2D mouseCoords = getMouseCoordsInternal();
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
|
||||
Vector2D surfaceCoords;
|
||||
Vector2D surfacePos;
|
||||
|
||||
// first, we check if the workspace doesnt have a fullscreen window
|
||||
|
@ -40,10 +41,10 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
|||
|
||||
// then surfaces on top
|
||||
if (!foundSurface)
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfacePos);
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfaceCoords);
|
||||
|
||||
if (!foundSurface)
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfacePos);
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfaceCoords);
|
||||
|
||||
// then windows
|
||||
const auto PWINDOWIDEAL = g_pCompositor->vectorToWindowIdeal(mouseCoords);
|
||||
|
@ -55,10 +56,10 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
|||
|
||||
// then surfaces below
|
||||
if (!foundSurface)
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfacePos);
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM], &surfaceCoords);
|
||||
|
||||
if (!foundSurface)
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfacePos);
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND], &surfaceCoords);
|
||||
|
||||
|
||||
if (!foundSurface) {
|
||||
|
@ -72,14 +73,14 @@ void CInputManager::mouseMoveUnified(uint32_t time) {
|
|||
if (time)
|
||||
wlr_idle_notify_activity(g_pCompositor->m_sWLRIdle, g_pCompositor->m_sSeat.seat);
|
||||
|
||||
g_pCompositor->focusSurface(foundSurface);
|
||||
|
||||
Vector2D surfaceLocal = Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y) - surfacePos;
|
||||
Vector2D surfaceLocal = surfacePos == Vector2D() ? surfaceCoords : Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y) - surfacePos;
|
||||
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, foundSurface, surfaceLocal.x, surfaceLocal.y);
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, time, surfaceLocal.x, surfaceLocal.y);
|
||||
|
||||
g_pCompositor->m_pLastMonitor = g_pCompositor->getMonitorFromCursor();
|
||||
g_pCompositor->focusSurface(foundSurface);
|
||||
|
||||
g_pCompositor->m_pLastMonitor = PMONITOR;
|
||||
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
||||
}
|
||||
|
||||
|
@ -105,10 +106,14 @@ void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
|
|||
break;
|
||||
}
|
||||
|
||||
refocus();
|
||||
|
||||
// notify app if we didnt handle it
|
||||
const auto PWINDOW = g_pCompositor->vectorToWindow(getMouseCoordsInternal());
|
||||
if (g_pCompositor->windowValidMapped(PWINDOW) && g_pCompositor->doesSeatAcceptInput(g_pXWaylandManager->getWindowSurface(PWINDOW)))
|
||||
if (g_pCompositor->doesSeatAcceptInput(g_pCompositor->m_pLastFocus)) {
|
||||
wlr_seat_pointer_notify_button(g_pCompositor->m_sSeat.seat, e->time_msec, e->button, e->state);
|
||||
Debug::log(LOG, "Seat notified of button %i (state %i) on surface %x", e->button, e->state, g_pCompositor->m_pLastFocus);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Vector2D CInputManager::getMouseCoordsInternal() {
|
||||
|
|
Loading…
Reference in a new issue