aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-05-29 15:44:30 +0200
committervaxerski <[email protected]>2022-05-29 15:44:30 +0200
commit9842730f570b118275191fd2b3e8910648ab7b05 (patch)
treee7e8d4e410ce41f0c1af00372dc45d0fa5ea09d0
parentd0ff0c0990db230999cc918f1d6230c4a18d08c8 (diff)
downloadHyprland-9842730f570b118275191fd2b3e8910648ab7b05.tar.gz
Hyprland-9842730f570b118275191fd2b3e8910648ab7b05.zip
Added fullscreen types, maximize and fulltransforms
-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.cpp6
-rw-r--r--src/render/Renderer.cpp11
9 files changed, 48 insertions, 16 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 40fc100c..118f902b 100644
--- a/src/render/OpenGL.cpp
+++ b/src/render/OpenGL.cpp
@@ -421,7 +421,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
glDisable(GL_STENCIL_TEST);
// get transforms for the full monitor
- const auto TRANSFORM = wlr_output_transform_invert(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform);
+ const auto TRANSFORM = wlr_output_transform_invert(WL_OUTPUT_TRANSFORM_NORMAL);
float matrix[9];
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
wlr_matrix_project_box(matrix, &MONITORBOX, TRANSFORM, 0, m_RenderData.pMonitor->output->transform_matrix);
@@ -547,7 +547,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);
@@ -585,7 +585,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 52a17808..02824920 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;