aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-05-29 15:44:30 +0200
committervaxerski <[email protected]>2022-05-29 15:45:51 +0200
commit227cbb0464bbf211f9d5ec7f6fa8e1bba0aecd12 (patch)
tree99e04d68d0fa6521201a7645a9b8c5ee83f6d736
parentfdb3f610e564c644ab0fc7fd154562258350084a (diff)
downloadHyprland-227cbb0464bbf211f9d5ec7f6fa8e1bba0aecd12.tar.gz
Hyprland-227cbb0464bbf211f9d5ec7f6fa8e1bba0aecd12.zip
Added fullscreen types, maximize and full
-rw-r--r--src/defines.hpp2
-rw-r--r--src/events/Windows.cpp6
-rw-r--r--src/helpers/Workspace.hpp6
-rw-r--r--src/layout/DwindleLayout.cpp22
-rw-r--r--src/layout/DwindleLayout.hpp3
-rw-r--r--src/layout/IHyprLayout.hpp6
-rw-r--r--src/managers/KeybindManager.cpp2
-rw-r--r--src/render/OpenGL.cpp4
-rw-r--r--src/render/Renderer.cpp11
9 files changed, 47 insertions, 15 deletions
diff --git a/src/defines.hpp b/src/defines.hpp
index 8c61a780..ebedd1a5 100644
--- a/src/defines.hpp
+++ b/src/defines.hpp
@@ -64,4 +64,4 @@
#endif
#ifndef GIT_DIRTY
#define GIT_DIRTY "?"
-#endif
+#endif \ No newline at end of file
diff --git a/src/events/Windows.cpp b/src/events/Windows.cpp
index 9c74572a..5d7a85d3 100644
--- a/src/events/Windows.cpp
+++ b/src/events/Windows.cpp
@@ -67,7 +67,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->m_bIsFloating) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
- g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PFULLWINDOW);
+ g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PFULLWINDOW, FULLSCREEN_FULL);
g_pXWaylandManager->setWindowFullscreen(PFULLWINDOW, PFULLWINDOW->m_bIsFullscreen);
}
@@ -325,9 +325,9 @@ void Events::listener_fullscreenWindow(void* owner, void* data) {
const auto REQUESTED = &PWINDOW->m_uSurface.xdg->toplevel->requested;
if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen)
- g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW);
+ g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL);
} else {
- g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW);
+ g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL);
}
Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen);
diff --git a/src/helpers/Workspace.hpp b/src/helpers/Workspace.hpp
index 683f03ae..c60eedfb 100644
--- a/src/helpers/Workspace.hpp
+++ b/src/helpers/Workspace.hpp
@@ -3,6 +3,11 @@
#include "../defines.hpp"
#include "AnimatedVariable.hpp"
+enum eFullscreenMode : uint8_t {
+ FULLSCREEN_FULL = 0,
+ FULLSCREEN_MAXIMIZED
+};
+
class CWorkspace {
public:
CWorkspace(int monitorID);
@@ -14,6 +19,7 @@ public:
std::string m_szName = "";
uint64_t m_iMonitorID = -1;
bool m_bHasFullscreenWindow = false;
+ eFullscreenMode m_efFullscreenMode = FULLSCREEN_FULL;
wlr_ext_workspace_handle_v1* m_pWlrHandle = nullptr;
diff --git a/src/layout/DwindleLayout.cpp b/src/layout/DwindleLayout.cpp
index 8117622c..79c08571 100644
--- a/src/layout/DwindleLayout.cpp
+++ b/src/layout/DwindleLayout.cpp
@@ -620,7 +620,7 @@ void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) {
g_pCompositor->moveWindowToTop(pWindow);
}
-void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
+void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow, eFullscreenMode fullscreenMode) {
if (!g_pCompositor->windowValidMapped(pWindow))
return;
@@ -650,6 +650,8 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
} else {
// if it now got fullscreen, make it fullscreen
+ PWORKSPACE->m_efFullscreenMode = fullscreenMode;
+
// save position and size if floating
if (pWindow->m_bIsFloating) {
pWindow->m_vPosition = pWindow->m_vRealPosition.vec();
@@ -657,8 +659,22 @@ void CHyprDwindleLayout::fullscreenRequestForWindow(CWindow* pWindow) {
}
// apply new pos and size being monitors' box
- pWindow->m_vRealPosition = PMONITOR->vecPosition;
- pWindow->m_vRealSize = PMONITOR->vecSize;
+ if (fullscreenMode == FULLSCREEN_FULL) {
+ pWindow->m_vRealPosition = PMONITOR->vecPosition;
+ pWindow->m_vRealSize = PMONITOR->vecSize;
+ } else {
+ // This is a massive hack.
+ // We make a fake "only" node and apply
+ // To keep consistent with the settings without C+P code
+
+ SDwindleNodeData fakeNode;
+ fakeNode.pWindow = pWindow;
+ fakeNode.position = PMONITOR->vecPosition + PMONITOR->vecReservedTopLeft;
+ fakeNode.size = PMONITOR->vecSize - PMONITOR->vecReservedTopLeft - PMONITOR->vecReservedBottomRight;
+ fakeNode.workspaceID = pWindow->m_iWorkspaceID;
+
+ applyNodeDataToWindow(&fakeNode);
+ }
}
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv());
diff --git a/src/layout/DwindleLayout.hpp b/src/layout/DwindleLayout.hpp
index 4abd04ef..492a52a3 100644
--- a/src/layout/DwindleLayout.hpp
+++ b/src/layout/DwindleLayout.hpp
@@ -6,6 +6,7 @@
#include "../render/decorations/CHyprGroupBarDecoration.hpp"
class CHyprDwindleLayout;
+enum eFullscreenMode : uint8_t;
struct SDwindleNodeData {
SDwindleNodeData* pParent = nullptr;
@@ -50,7 +51,7 @@ public:
virtual void onEndDragWindow();
virtual void onMouseMove(const Vector2D&);
virtual void onWindowCreatedFloating(CWindow*);
- virtual void fullscreenRequestForWindow(CWindow*);
+ virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode);
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
virtual void switchWindows(CWindow*, CWindow*);
diff --git a/src/layout/IHyprLayout.hpp b/src/layout/IHyprLayout.hpp
index 01e3e04a..e9cf2a15 100644
--- a/src/layout/IHyprLayout.hpp
+++ b/src/layout/IHyprLayout.hpp
@@ -12,6 +12,8 @@ struct SLayoutMessageHeader {
CWindow* pWindow = nullptr;
};
+enum eFullscreenMode : uint8_t;
+
interface IHyprLayout {
public:
@@ -66,11 +68,11 @@ public:
virtual void onWindowCreatedFloating(CWindow*) = 0;
/*
- Called when a window requests to toggle its' fullscreen state.
+ Called when a window / the user requests to toggle the fullscreen state of a window
The layout sets all the fullscreen flags.
It can either accept or ignore.
*/
- virtual void fullscreenRequestForWindow(CWindow*) = 0;
+ virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode) = 0;
/*
Called when a dispatcher requests a custom message
diff --git a/src/managers/KeybindManager.cpp b/src/managers/KeybindManager.cpp
index f2efb29b..85ba29bc 100644
--- a/src/managers/KeybindManager.cpp
+++ b/src/managers/KeybindManager.cpp
@@ -295,7 +295,7 @@ void CKeybindManager::fullscreenActive(std::string args) {
if (!g_pCompositor->windowValidMapped(PWINDOW))
return;
- g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW);
+ g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, args == "1" ? eFullscreenMode::FULLSCREEN_MAXIMIZED : eFullscreenMode::FULLSCREEN_FULL);
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen);
diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp
index e5a95ec1..78ffce14 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -534,7 +534,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
pixman_region32_t inverseOpaque;
pixman_region32_init(&inverseOpaque);
if (a == 255.f) {
- pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
+ pixman_box32_t monbox = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
pixman_region32_copy(&inverseOpaque, &pSurface->current.opaque);
pixman_region32_translate(&inverseOpaque, pBox->x, pBox->y);
pixman_region32_inverse(&inverseOpaque, &inverseOpaque, &monbox);
@@ -572,7 +572,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
// stencil done. Render everything.
- wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
+ wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecTransformedSize.x, m_RenderData.pMonitor->vecTransformedSize.y};
if (pixman_region32_not_empty(&damage)) {
// render our great blurred FB
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, g_pConfigManager->getInt("decoration:blur_ignore_opacity") ? 255.f : a, &damage);
diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp
index 86ab125d..68282ae2 100644
--- a/src/render/Renderer.cpp
+++ b/src/render/Renderer.cpp
@@ -57,7 +57,7 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWor
continue;
// found it!
- renderWindow(&w, pMonitor, time, false);
+ renderWindow(&w, pMonitor, time, pWorkspace->m_efFullscreenMode != FULLSCREEN_FULL);
pWorkspaceWindow = &w;
}
@@ -71,6 +71,13 @@ void CHyprRenderer::renderWorkspaceWithFullscreenWindow(SMonitor* pMonitor, CWor
}
// and the overlay layers
+ if (pWorkspace->m_efFullscreenMode != FULLSCREEN_FULL) {
+ // on non-full we draw the bar and shit
+ for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
+ renderLayer(ls, pMonitor, time);
+ }
+ }
+
for (auto& ls : pMonitor->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY]) {
renderLayer(ls, pMonitor, time);
}
@@ -98,7 +105,7 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
renderdata.surface = g_pXWaylandManager->getWindowSurface(pWindow);
renderdata.w = std::clamp(pWindow->m_vRealSize.vec().x, (double)5, (double)1337420); // clamp the size to min 5,
renderdata.h = std::clamp(pWindow->m_vRealSize.vec().y, (double)5, (double)1337420); // otherwise we'll have issues later with invalid boxes
- renderdata.dontRound = pWindow->m_bIsFullscreen;
+ renderdata.dontRound = pWindow->m_bIsFullscreen && PWORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL;
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (PWORKSPACE->m_fAlpha.fl() / 255.f);
renderdata.alpha = pWindow->m_bIsFullscreen ? g_pConfigManager->getFloat("decoration:fullscreen_opacity") : pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity");
renderdata.decorate = decorate && !pWindow->m_bX11DoesntWantBorders;