Added fullscreen

This commit is contained in:
vaxerski 2022-03-21 19:18:33 +01:00
parent 1b50377a5a
commit 295a0c4a69
12 changed files with 210 additions and 40 deletions

View file

@ -20,15 +20,30 @@ void CInputManager::onMouseWarp(wlr_event_pointer_motion_absolute* e) {
void CInputManager::mouseMoveUnified(uint32_t time) {
// first top layers
wlr_surface* foundSurface = nullptr;
Vector2D mouseCoords = getMouseCoordsInternal();
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
Vector2D surfacePos;
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY], &surfacePos);
// first, we check if the workspace doesnt have a fullscreen window
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
if (PWORKSPACE->hasFullscreenWindow) {
const auto PFULLSCREENWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->ID);
// should never ever happen but who knows
if (PFULLSCREENWINDOW) {
foundSurface = g_pXWaylandManager->getWindowSurface(PFULLSCREENWINDOW);
if (foundSurface)
surfacePos = PFULLSCREENWINDOW->m_vRealPosition;
}
}
// then surfaces on top
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_OVERLAY], &surfacePos);
if (!foundSurface)
foundSurface = g_pCompositor->vectorToLayerSurface(mouseCoords, &PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP], &surfacePos);
// then windows
if (!foundSurface && g_pCompositor->vectorToWindowIdeal(mouseCoords)) {
@ -79,6 +94,8 @@ void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
dragButton = e->button;
g_pLayoutManager->getCurrentLayout()->onBeginDragWindow();
return;
}
break;
case WLR_BUTTON_RELEASED:
@ -87,8 +104,6 @@ void CInputManager::onMouseButton(wlr_event_pointer_button* e) {
break;
}
g_pCompositor->focusWindow(g_pCompositor->vectorToWindowIdeal(Vector2D(g_pCompositor->m_sWLRCursor->x, g_pCompositor->m_sWLRCursor->y)));
// notify app if we didnt handle it
wlr_seat_pointer_notify_button(g_pCompositor->m_sWLRSeat, e->time_msec, e->button, e->state);
}

View file

@ -44,6 +44,7 @@ bool CKeybindManager::handleKeybinds(const uint32_t& modmask, const xkb_keysym_t
else if (k.handler == "killactive") { killActive(k.arg); }
else if (k.handler == "togglefloating") { toggleActiveFloating(k.arg); }
else if (k.handler == "workspace") { changeworkspace(k.arg); }
else if (k.handler == "fullscreen") { fullscreenActive(k.arg); }
found = true;
}
@ -143,4 +144,13 @@ void CKeybindManager::changeworkspace(std::string args) {
// we need to move XWayland windows to narnia or otherwise they will still process our cursor and shit
// and that'd be annoying as hell
g_pCompositor->fixXWaylandWindowsOnWorkspace(OLDWORKSPACE);
}
void CKeybindManager::fullscreenActive(std::string args) {
const auto PWINDOW = g_pCompositor->getWindowFromSurface(g_pCompositor->m_pLastFocus);
if (!g_pCompositor->windowValidMapped(PWINDOW))
return;
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW);
}

View file

@ -27,6 +27,7 @@ private:
void spawn(std::string);
void toggleActiveFloating(std::string);
void changeworkspace(std::string);
void fullscreenActive(std::string);
};
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;