From ee9c202555b6edd2fcfefea245b9519993ff288a Mon Sep 17 00:00:00 2001 From: Vaxry Date: Fri, 5 Jul 2024 20:44:54 +0200 Subject: [PATCH] rid of wlr more --- .gitmodules | 4 ---- CMakeLists.txt | 1 - Makefile | 4 ---- README.md | 9 ++++---- hyprland.pc.in | 2 +- hyprpm/src/core/PluginManager.cpp | 7 +------ src/Compositor.hpp | 2 +- src/helpers/MiscFunctions.hpp | 1 - src/helpers/Monitor.hpp | 1 - src/helpers/X11Stubs.hpp | 7 ------- src/includes.hpp | 4 ---- src/managers/input/InputManager.cpp | 1 - src/protocols/MesaDRM.cpp | 1 - src/render/OpenGL.cpp | 32 ++++++++++++++--------------- src/render/Renderer.cpp | 26 ----------------------- src/render/Texture.cpp | 2 +- src/render/Texture.hpp | 1 - src/xwayland/XWM.cpp | 4 ++-- 18 files changed, 26 insertions(+), 83 deletions(-) delete mode 100644 src/helpers/X11Stubs.hpp diff --git a/.gitmodules b/.gitmodules index 37b48a5a..638f8ba9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -7,7 +7,3 @@ [submodule "subprojects/tracy"] path = subprojects/tracy url = https://github.com/wolfpld/tracy -[submodule "subprojects/wlroots-hyprland"] - path = subprojects/wlroots-hyprland - url = https://github.com/hyprwm/wlroots-hyprland - ignore = dirty diff --git a/CMakeLists.txt b/CMakeLists.txt index 643612d6..d647f9ec 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -72,7 +72,6 @@ include_directories( "subprojects/udis86/" "protocols/") set(CMAKE_CXX_STANDARD 23) -add_compile_definitions(WLR_USE_UNSTABLE) add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=) diff --git a/Makefile b/Makefile index aff2a25a..adf6fbe8 100644 --- a/Makefile +++ b/Makefile @@ -27,7 +27,6 @@ nopch: clear: rm -rf build rm -f ./protocols/*.h ./protocols/*.c ./protocols/*.cpp ./protocols/*.hpp - rm -rf ./subprojects/wlroots-hyprland/build all: $(MAKE) clear @@ -50,14 +49,11 @@ installheaders: rm -fr ${PREFIX}/include/hyprland mkdir -p ${PREFIX}/include/hyprland mkdir -p ${PREFIX}/include/hyprland/protocols - mkdir -p ${PREFIX}/include/hyprland/wlr mkdir -p ${PREFIX}/share/pkgconfig cmake --build ./build --config Release --target generate-protocol-headers find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland - cd subprojects/wlroots-hyprland/include/wlr && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlr && cd ../../../.. - cd subprojects/wlroots-hyprland/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlr && cd ../../../.. cp ./protocols/*.h* ${PREFIX}/include/hyprland/protocols cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi diff --git a/README.md b/README.md index ca44621d..fc2bd206 100644 --- a/README.md +++ b/README.md @@ -13,10 +13,10 @@
-Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks. +Hyprland is a 100% independent, dynamic tiling Wayland compositor that doesn't sacrifice on its looks. It provides the latest Wayland features, is highly customizable, has all the eyecandy, the most powerful plugins, -easy IPC, much more QoL stuff than other wlr-based compositors and more... +easy IPC, much more QoL stuff than other compositors and more...

@@ -37,7 +37,7 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more... - All of the eyecandy: gradient borders, blur, animations, shadows and much more - A lot of customization -- Much more QoL stuff than other wlr-based compositors +- 100% independent, no wlroots, no libweston, no kwin, no mutter. - Custom bezier curves for the best animations - Powerful plugin support - Built-in plugin manager @@ -48,7 +48,6 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more... - Config reloaded instantly upon saving - Fully dynamic workspaces - Two built-in layouts and more available as plugins -- Uses forked wlroots with QoL patches - Global keybinds passed to your apps of choice - Tiling/pseudotiling/floating/fullscreen windows - Special workspaces (scratchpads) @@ -86,7 +85,7 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more...
-**[wlroots]** - *For their amazing library* +**[wlroots]** - *For powering Hyprland in the past* **[tinywl]** - *For showing how 2 do stuff* diff --git a/hyprland.pc.in b/hyprland.pc.in index 382fb1e6..81a0ef11 100644 --- a/hyprland.pc.in +++ b/hyprland.pc.in @@ -4,4 +4,4 @@ Name: Hyprland URL: https://github.com/hyprwm/Hyprland Description: Hyprland header files Version: @HYPRLAND_VERSION@ -Cflags: -I${prefix} -I${prefix}/hyprland/protocols -I${prefix}/hyprland -I${prefix}/hyprland/wlr +Cflags: -I${prefix} -I${prefix}/hyprland/protocols -I${prefix}/hyprland diff --git a/hyprpm/src/core/PluginManager.cpp b/hyprpm/src/core/PluginManager.cpp index 848b9cab..7d7cc079 100644 --- a/hyprpm/src/core/PluginManager.cpp +++ b/hyprpm/src/core/PluginManager.cpp @@ -356,7 +356,7 @@ eHeadersErrors CPluginManager::headersValid() { else headers = ""; - if (PATH.ends_with("protocols") || PATH.ends_with("wlroots-hyprland")) + if (PATH.ends_with("protocols")) continue; verHeader = trim(PATH.substr(2)) + "/hyprland/src/version.h"; @@ -493,11 +493,6 @@ bool CPluginManager::updateHeaders(bool force) { return false; } - // le hack. Wlroots has to generate its build/include - ret = execAndGet("cd " + WORKINGDIR + "/subprojects/wlroots-hyprland && meson setup -Drenderers=gles2 -Dexamples=false build"); - if (m_bVerbose) - progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "meson returned: " + ret); - progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " configured Hyprland"); progress.m_iSteps = 4; progress.m_szCurrentMessage = "Installing sources"; diff --git a/src/Compositor.hpp b/src/Compositor.hpp index ee54a1d5..a437ccb3 100644 --- a/src/Compositor.hpp +++ b/src/Compositor.hpp @@ -87,7 +87,7 @@ class CCompositor { bool m_bSessionActive = true; bool m_bDPMSStateON = true; bool m_bUnsafeState = false; // unsafe state is when there is no monitors. - bool m_bNextIsUnsafe = false; // because wlroots + bool m_bNextIsUnsafe = false; CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state bool m_bExitTriggered = false; // For exit dispatcher bool m_bIsShuttingDown = false; diff --git a/src/helpers/MiscFunctions.hpp b/src/helpers/MiscFunctions.hpp index 33be7965..49e3bced 100644 --- a/src/helpers/MiscFunctions.hpp +++ b/src/helpers/MiscFunctions.hpp @@ -3,7 +3,6 @@ #include #include #include -#include #include "math/Math.hpp" #include #include diff --git a/src/helpers/Monitor.hpp b/src/helpers/Monitor.hpp index f14ec7d3..640eabe7 100644 --- a/src/helpers/Monitor.hpp +++ b/src/helpers/Monitor.hpp @@ -41,7 +41,6 @@ struct SMonitorRule { class CMonitor; -// Class for wrapping the wlr state class CMonitorState { public: CMonitorState(CMonitor* owner); diff --git a/src/helpers/X11Stubs.hpp b/src/helpers/X11Stubs.hpp deleted file mode 100644 index 19bea6f8..00000000 --- a/src/helpers/X11Stubs.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#pragma once - -inline bool wlr_backend_is_x11(void*) { - return false; -} - -inline void wlr_x11_output_create(void*) {} diff --git a/src/includes.hpp b/src/includes.hpp index 3a1bc4e3..8b3f3fad 100644 --- a/src/includes.hpp +++ b/src/includes.hpp @@ -27,10 +27,6 @@ #include #endif -#if !WLR_HAS_X11_BACKEND -#include "helpers/X11Stubs.hpp" -#endif - #ifdef NO_XWAYLAND #define XWAYLAND false #else diff --git a/src/managers/input/InputManager.cpp b/src/managers/input/InputManager.cpp index ec5a5535..490de450 100644 --- a/src/managers/input/InputManager.cpp +++ b/src/managers/input/InputManager.cpp @@ -1,6 +1,5 @@ #include "InputManager.hpp" #include "../../Compositor.hpp" -#include "wlr/types/wlr_switch.h" #include #include #include "../../config/ConfigValue.hpp" diff --git a/src/protocols/MesaDRM.cpp b/src/protocols/MesaDRM.cpp index e585dcec..8ceb24a6 100644 --- a/src/protocols/MesaDRM.cpp +++ b/src/protocols/MesaDRM.cpp @@ -2,7 +2,6 @@ #include #include #include "../Compositor.hpp" -#include #include "types/WLBuffer.hpp" #define LOGM PROTO::mesaDRM->protoLog diff --git a/src/render/OpenGL.cpp b/src/render/OpenGL.cpp index d003a32d..a88496cd 100644 --- a/src/render/OpenGL.cpp +++ b/src/render/OpenGL.cpp @@ -768,7 +768,7 @@ void CHyprOpenGLImpl::end() { TRACY_GPU_ZONE("RenderEnd"); - // end the render, copy the data to the WLR framebuffer + // end the render, copy the data to the main framebuffer if (m_bOffloadedFramebuffer) { m_RenderData.damage = m_RenderData.finalDamage; m_bEndFrame = true; @@ -1175,7 +1175,7 @@ void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion float matrix[9]; projectBox(matrix, newBox, wlTransformToHyprutils(invertTransform(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform)), newBox.rot, - m_RenderData.monitorProjection.data()); // TODO: write own, don't use WLR here + m_RenderData.monitorProjection.data()); float glMatrix[9]; matrixMultiply(glMatrix, m_RenderData.projection, matrix); @@ -1185,7 +1185,7 @@ void CHyprOpenGLImpl::renderRectWithDamage(CBox* box, const CColor& col, CRegion #ifndef GLES2 glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shQUAD.proj, 1, GL_FALSE, glMatrix); #endif @@ -1317,7 +1317,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(SP tex, CBox* pB #ifndef GLES2 glUniformMatrix3fv(shader->proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(shader->proj, 1, GL_FALSE, glMatrix); #endif glUniform1i(shader->tex, 0); @@ -1445,7 +1445,7 @@ void CHyprOpenGLImpl::renderTexturePrimitive(SP tex, CBox* pBox) { #ifndef GLES2 glUniformMatrix3fv(shader->proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(shader->proj, 1, GL_FALSE, glMatrix); #endif glUniform1i(shader->tex, 0); @@ -1496,7 +1496,7 @@ void CHyprOpenGLImpl::renderTextureMatte(SP tex, CBox* pBox, CFramebuf #ifndef GLES2 glUniformMatrix3fv(shader->proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(shader->proj, 1, GL_FALSE, glMatrix); #endif glUniform1i(shader->tex, 0); @@ -1584,7 +1584,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o #ifndef GLES2 glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURPREPARE.proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURPREPARE.proj, 1, GL_FALSE, glMatrix); #endif glUniform1f(m_RenderData.pCurrentMonData->m_shBLURPREPARE.contrast, *PBLURCONTRAST); @@ -1629,7 +1629,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o #ifndef GLES2 glUniformMatrix3fv(pShader->proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(pShader->proj, 1, GL_FALSE, glMatrix); #endif glUniform1f(pShader->radius, *PBLURSIZE * a); // this makes the blursize change with a @@ -1706,7 +1706,7 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, CRegion* o #ifndef GLES2 glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURFINISH.proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBLURFINISH.proj, 1, GL_FALSE, glMatrix); #endif glUniform1f(m_RenderData.pCurrentMonData->m_shBLURFINISH.noise, *PBLURNOISE); @@ -2038,7 +2038,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in float matrix[9]; projectBox(matrix, newBox, wlTransformToHyprutils(invertTransform(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform)), newBox.rot, - m_RenderData.monitorProjection.data()); // TODO: write own, don't use WLR here + m_RenderData.monitorProjection.data()); float glMatrix[9]; matrixMultiply(glMatrix, m_RenderData.projection, matrix); @@ -2051,7 +2051,7 @@ void CHyprOpenGLImpl::renderBorder(CBox* box, const CGradientValueData& grad, in #ifndef GLES2 glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBORDER1.proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shBORDER1.proj, 1, GL_FALSE, glMatrix); #endif @@ -2114,7 +2114,7 @@ void CHyprOpenGLImpl::makeRawWindowSnapshot(PHLWINDOW pWindow, CFramebuffer* pFr // we need to "damage" the entire monitor // so that we render the entire window - // this is temporary, doesnt mess with the actual wlr damage + // this is temporary, doesnt mess with the actual damage CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y}; g_pHyprRenderer->makeEGLCurrent(); @@ -2165,7 +2165,7 @@ void CHyprOpenGLImpl::makeWindowSnapshot(PHLWINDOW pWindow) { // we need to "damage" the entire monitor // so that we render the entire window - // this is temporary, doesnt mess with the actual wlr damage + // this is temporary, doesnt mess with the actual damage CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y}; PHLWINDOWREF ref{pWindow}; @@ -2214,7 +2214,7 @@ void CHyprOpenGLImpl::makeLayerSnapshot(PHLLS pLayer) { // we need to "damage" the entire monitor // so that we render the entire window - // this is temporary, doesnt mess with the actual wlr damage + // this is temporary, doesnt mess with the actual damage CRegion fakeDamage{0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y}; g_pHyprRenderer->makeEGLCurrent(); @@ -2344,7 +2344,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const float matrix[9]; projectBox(matrix, newBox, wlTransformToHyprutils(invertTransform(!m_bEndFrame ? WL_OUTPUT_TRANSFORM_NORMAL : m_RenderData.pMonitor->transform)), newBox.rot, - m_RenderData.monitorProjection.data()); // TODO: write own, don't use WLR here + m_RenderData.monitorProjection.data()); float glMatrix[9]; matrixMultiply(glMatrix, m_RenderData.projection, matrix); @@ -2356,7 +2356,7 @@ void CHyprOpenGLImpl::renderRoundedShadow(CBox* box, int round, int range, const #ifndef GLES2 glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shSHADOW.proj, 1, GL_TRUE, glMatrix); #else - wlr_matrix_transpose(glMatrix, glMatrix); + matrixTranspose(glMatrix, glMatrix); glUniformMatrix3fv(m_RenderData.pCurrentMonData->m_shSHADOW.proj, 1, GL_FALSE, glMatrix); #endif glUniform4f(m_RenderData.pCurrentMonData->m_shSHADOW.color, col.r, col.g, col.b, col.a * a); diff --git a/src/render/Renderer.cpp b/src/render/Renderer.cpp index 976cc5e2..b336a5f8 100644 --- a/src/render/Renderer.cpp +++ b/src/render/Renderer.cpp @@ -1490,31 +1490,6 @@ void CHyprRenderer::sendFrameEventsToWorkspace(CMonitor* pMonitor, PHLWORKSPACE void CHyprRenderer::setWindowScanoutMode(PHLWINDOW pWindow) { // FIXME: fix when moved to new impl - // if (!g_pCompositor->m_sWLRLinuxDMABuf || g_pSessionLockManager->isSessionLocked()) - // return; - - // if (!pWindow->m_bIsFullscreen) { - // wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface->resource(), nullptr); - // Debug::log(LOG, "Scanout mode OFF set for {}", pWindow); - // return; - // } - - // const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID); - - // const wlr_linux_dmabuf_feedback_v1_init_options INIT_OPTIONS = { - // .main_renderer = g_pCompositor->m_sWLRRenderer, - // .scanout_primary_output = PMONITOR->output, - // }; - - // wlr_linux_dmabuf_feedback_v1 feedback = {0}; - - // if (!wlr_linux_dmabuf_feedback_v1_init_with_options(&feedback, &INIT_OPTIONS)) - // return; - - // wlr_linux_dmabuf_v1_set_surface_feedback(g_pCompositor->m_sWLRLinuxDMABuf, pWindow->m_pWLSurface->resource(), &feedback); - // wlr_linux_dmabuf_feedback_v1_finish(&feedback); - - // Debug::log(LOG, "Scanout mode ON set for {}", pWindow); } // taken from Sway. @@ -2245,7 +2220,6 @@ bool CHyprRenderer::applyMonitorRule(CMonitor* pMonitor, SMonitorRule* pMonitorR if (WAS10B != pMonitor->enabled10bit || OLDRES != pMonitor->vecPixelSize) g_pHyprOpenGL->destroyMonitorResources(pMonitor); - // updato wlroots g_pCompositor->arrangeMonitors(); pMonitor->damage.setSize(pMonitor->vecTransformedSize); diff --git a/src/render/Texture.cpp b/src/render/Texture.cpp index ea8823b6..0f5b4c4c 100644 --- a/src/render/Texture.cpp +++ b/src/render/Texture.cpp @@ -9,7 +9,7 @@ CTexture::CTexture() { } CTexture::~CTexture() { - if (m_bNonOwning || !g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer) + if (!g_pCompositor || g_pCompositor->m_bIsShuttingDown || !g_pHyprRenderer) return; g_pHyprRenderer->makeEGLCurrent(); diff --git a/src/render/Texture.hpp b/src/render/Texture.hpp index a877acff..07156cc8 100644 --- a/src/render/Texture.hpp +++ b/src/render/Texture.hpp @@ -38,7 +38,6 @@ class CTexture { GLuint m_iTexID = 0; Vector2D m_vSize; void* m_pEglImage = nullptr; - bool m_bNonOwning = false; // wlr private: void createFromShm(uint32_t drmFormat, uint8_t* pixels, uint32_t stride, const Vector2D& size); diff --git a/src/xwayland/XWM.cpp b/src/xwayland/XWM.cpp index ea635ac0..b55df7fc 100644 --- a/src/xwayland/XWM.cpp +++ b/src/xwayland/XWM.cpp @@ -299,8 +299,8 @@ void CXWM::handleClientMessage(xcb_client_message_event_t* e) { auto id = e->data.data32[0]; auto resource = wl_client_get_object(g_pXWayland->pServer->xwaylandClient, id); if (resource) { - auto wlrSurface = CWLSurfaceResource::fromResource(resource); - associate(XSURF, wlrSurface); + auto surf = CWLSurfaceResource::fromResource(resource); + associate(XSURF, surf); } } else if (e->type == HYPRATOMS["WL_SURFACE_SERIAL"]) { if (XSURF->wlSerial) {