mirror of
https://github.com/hyprwm/Hyprland.git
synced 2024-12-24 16:22:27 +03:00
Merge branch 'main' into scaling
This commit is contained in:
commit
6c437763f6
@ -40,7 +40,7 @@ stdenv.mkDerivation rec {
|
|||||||
installPhase = ''
|
installPhase = ''
|
||||||
cd ../
|
cd ../
|
||||||
mkdir -p $out/share/wayland-sessions
|
mkdir -p $out/share/wayland-sessions
|
||||||
cp ./example/hyprland.desktop $out/share/wayland-sessions/
|
cp ./example/hyprland.desktop $out/share/wayland-sessions
|
||||||
mkdir -p $out/bin
|
mkdir -p $out/bin
|
||||||
cp ./build/Hyprland $out/bin
|
cp ./build/Hyprland $out/bin
|
||||||
cp ./hyprctl/hyprctl $out/bin
|
cp ./hyprctl/hyprctl $out/bin
|
||||||
@ -50,6 +50,8 @@ stdenv.mkDerivation rec {
|
|||||||
cp ./assets/wall_8K.png $out/share/hyprland
|
cp ./assets/wall_8K.png $out/share/hyprland
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
passthru.providedSessions = [ "hyprland" ];
|
||||||
|
|
||||||
meta = with lib; {
|
meta = with lib; {
|
||||||
homepage = "https://github.com/vaxerski/Hyprland";
|
homepage = "https://github.com/vaxerski/Hyprland";
|
||||||
description =
|
description =
|
||||||
|
69
flake.lock
69
flake.lock
@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"cachix": {
|
"cachix": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651865313,
|
"lastModified": 1652530570,
|
||||||
"narHash": "sha256-fLnmcBaVpJukNIzXZETxtJKLSSTf4LnBCWa/DwyGJBU=",
|
"narHash": "sha256-GWRrbUv9l1GSyBkj39s9AqNLX1l3rzVOwvnuG4WYM+E=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "ad667404474314806d8071eec4c8ec0db95c17e4",
|
"rev": "4c560cc7ee57e1fb28e6fd7bdacdf01f948f8a91",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -34,11 +34,11 @@
|
|||||||
},
|
},
|
||||||
"flake-utils": {
|
"flake-utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1649676176,
|
"lastModified": 1652557277,
|
||||||
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
|
"narHash": "sha256-jSes9DaIVMdmwBB78KkFUVrlDzawmD62vrUg0GS2500=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
|
"rev": "12806d31a381e7cd169a6bac35590e7b36dc5fe5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -53,11 +53,11 @@
|
|||||||
"nixpkgs-lib": "nixpkgs-lib"
|
"nixpkgs-lib": "nixpkgs-lib"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1652011770,
|
"lastModified": 1652616584,
|
||||||
"narHash": "sha256-ZX+aDa9db1lNbLI44KK0EjTV2X6gyIqpcuN9RUCy9iI=",
|
"narHash": "sha256-9Uc/k/t08QsJ8rl1n/cbT8L/JrCoDuE7TmsE+F1OiS8=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "lib-aggregate",
|
"repo": "lib-aggregate",
|
||||||
"rev": "89056ca8a9c74ea4440dc53bebcd9c74fc0e1f15",
|
"rev": "81165c2e94b56afcb9486b82dc91d92dfb503a6b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -68,11 +68,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651927509,
|
"lastModified": 1652659998,
|
||||||
"narHash": "sha256-fGVGUdEsriuAL1vkUh29FlOQmEkPRnSfRGImWYaVjos=",
|
"narHash": "sha256-FqNrXC1EE6U2RACwXBlsAvg1lqQGLYpuYb6+W3DL9vA=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "2fdb6f2e08e7989b03a2a1aa8538d99e3eeea881",
|
"rev": "1d7db1b9e4cf1ee075a9f52e5c36f7b9f4207502",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -84,11 +84,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs-lib": {
|
"nixpkgs-lib": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651970744,
|
"lastModified": 1652576347,
|
||||||
"narHash": "sha256-3X/96C8I5alTCP0FHEx01/YOIvVmjkYoUPX/1Y4Bdsw=",
|
"narHash": "sha256-52Wu7hkcIRcS4UenSSrt01J2sAbbQ6YqxZIDpuEPL/c=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs.lib",
|
"repo": "nixpkgs.lib",
|
||||||
"rev": "da23418cffc1763e30dba3383eac541afe3e4e70",
|
"rev": "bdf553800c9c34ed00641785b02038f67f44d671",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -105,11 +105,11 @@
|
|||||||
"nixpkgs": "nixpkgs_2"
|
"nixpkgs": "nixpkgs_2"
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1652015544,
|
"lastModified": 1652618007,
|
||||||
"narHash": "sha256-YFjSavZSf6NZFRt2QB5mBccPYd8wrJGKHVH9p75vZtM=",
|
"narHash": "sha256-eOH21ElHKORg1kd8Z/qX9naZElAOpCt5fPq26AxMQSw=",
|
||||||
"owner": "nix-community",
|
"owner": "nix-community",
|
||||||
"repo": "nixpkgs-wayland",
|
"repo": "nixpkgs-wayland",
|
||||||
"rev": "2d9bc7f3261cc1c2a46d121f94ed483f35d194c2",
|
"rev": "4588213f577661d37a42c7b6bba04c138c02d78f",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -120,11 +120,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs_2": {
|
"nixpkgs_2": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1651726670,
|
"lastModified": 1652467128,
|
||||||
"narHash": "sha256-dSGdzB49SEvdOJvrQWfQYkAefewXraHIV08Vz6iDXWQ=",
|
"narHash": "sha256-1wuQ7QgPQ3tugYcoVMJ3pUzl4wVdBzKZr9qtJAgA4VI=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c777cdf5c564015d5f63b09cc93bef4178b19b01",
|
"rev": "fb222e008681fce4608e94f2d1dfdf3d03a364c4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -138,16 +138,17 @@
|
|||||||
"inputs": {
|
"inputs": {
|
||||||
"nixpkgs": "nixpkgs",
|
"nixpkgs": "nixpkgs",
|
||||||
"nixpkgs-wayland": "nixpkgs-wayland",
|
"nixpkgs-wayland": "nixpkgs-wayland",
|
||||||
"utils": "utils"
|
"utils": "utils",
|
||||||
|
"wlroots-git": "wlroots-git"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"utils": {
|
"utils": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1649676176,
|
"lastModified": 1652557277,
|
||||||
"narHash": "sha256-OWKJratjt2RW151VUlJPRALb7OU2S5s+f0vLj4o1bHM=",
|
"narHash": "sha256-jSes9DaIVMdmwBB78KkFUVrlDzawmD62vrUg0GS2500=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"rev": "a4b154ebbdc88c8498a5c7b01589addc9e9cb678",
|
"rev": "12806d31a381e7cd169a6bac35590e7b36dc5fe5",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -155,6 +156,24 @@
|
|||||||
"repo": "flake-utils",
|
"repo": "flake-utils",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"wlroots-git": {
|
||||||
|
"flake": false,
|
||||||
|
"locked": {
|
||||||
|
"host": "gitlab.freedesktop.org",
|
||||||
|
"lastModified": 1652629480,
|
||||||
|
"narHash": "sha256-4mouFPYB2VwgPi92trvAk8JAGjvkYm+DX72sUzljCXA=",
|
||||||
|
"owner": "wlroots",
|
||||||
|
"repo": "wlroots",
|
||||||
|
"rev": "8fe3aa29da56be16faa73aca947647bd60cd4a94",
|
||||||
|
"type": "gitlab"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"host": "gitlab.freedesktop.org",
|
||||||
|
"owner": "wlroots",
|
||||||
|
"repo": "wlroots",
|
||||||
|
"type": "gitlab"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"root": "root",
|
"root": "root",
|
||||||
|
26
flake.nix
26
flake.nix
@ -3,25 +3,41 @@
|
|||||||
description =
|
description =
|
||||||
"Hyprland is a dynamic tiling Wayland compositor that doesn't sacrifice on its looks.";
|
"Hyprland is a dynamic tiling Wayland compositor that doesn't sacrifice on its looks.";
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-21.11";
|
||||||
utils.url = "github:numtide/flake-utils";
|
utils.url = "github:numtide/flake-utils";
|
||||||
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
nixpkgs-wayland.url = "github:nix-community/nixpkgs-wayland";
|
||||||
|
wlroots-git = {
|
||||||
|
url = "gitlab:wlroots/wlroots?host=gitlab.freedesktop.org";
|
||||||
|
flake = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
outputs = { self, nixpkgs, utils, nixpkgs-wayland }:
|
outputs = { self, nixpkgs, utils, nixpkgs-wayland, wlroots-git }:
|
||||||
utils.lib.eachDefaultSystem (system:
|
{
|
||||||
|
overlay = final: prev: {
|
||||||
|
hyprland = prev.callPackage self {
|
||||||
|
src = self;
|
||||||
|
wlroots = (nixpkgs-wayland.overlays.default final prev).wlroots.overrideAttrs (prev: rec {
|
||||||
|
src = wlroots-git;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
overlays.default = self.overlay;
|
||||||
|
} // utils.lib.eachSystem [ "aarch64-linux" "x86_64-linux" ] (system:
|
||||||
let pkgs = nixpkgs.legacyPackages.${system};
|
let pkgs = nixpkgs.legacyPackages.${system};
|
||||||
in rec {
|
in rec {
|
||||||
packages = {
|
packages = {
|
||||||
hyprland = pkgs.callPackage self {
|
hyprland = pkgs.callPackage self {
|
||||||
src = self;
|
src = self;
|
||||||
inherit (nixpkgs-wayland.packages.${system}) wlroots;
|
wlroots = nixpkgs-wayland.packages.${system}.wlroots.overrideAttrs (prev: rec {
|
||||||
|
src = wlroots-git;
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
defaultPackage = packages.hyprland;
|
defaultPackage = packages.hyprland;
|
||||||
apps.hyprland = utils.lib.mkApp { drv = packages.hyprland; };
|
apps.hyprland = utils.lib.mkApp { drv = packages.hyprland; };
|
||||||
defaultApp = apps.hyprland;
|
defaultApp = apps.hyprland;
|
||||||
apps.default =
|
apps.default =
|
||||||
utils.lib.mkApp { drv = self.packages."${system}".default; };
|
utils.lib.mkApp { drv = self.packages.${system}.hyprland; };
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -662,8 +662,8 @@ void CCompositor::cleanupFadingOut() {
|
|||||||
g_pHyprOpenGL->m_mLayerFramebuffers[ls].release();
|
g_pHyprOpenGL->m_mLayerFramebuffers[ls].release();
|
||||||
g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls);
|
g_pHyprOpenGL->m_mLayerFramebuffers.erase(ls);
|
||||||
|
|
||||||
m_lSurfacesFadingOut.remove(ls);
|
|
||||||
delete ls;
|
delete ls;
|
||||||
|
m_lSurfacesFadingOut.remove(ls);
|
||||||
|
|
||||||
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
Debug::log(LOG, "Cleanup: destroyed a layersurface");
|
||||||
|
|
||||||
|
@ -42,6 +42,7 @@ void CConfigManager::setDefaultVars() {
|
|||||||
configValues["decoration:blur_passes"].intValue = 1;
|
configValues["decoration:blur_passes"].intValue = 1;
|
||||||
configValues["decoration:active_opacity"].floatValue = 1;
|
configValues["decoration:active_opacity"].floatValue = 1;
|
||||||
configValues["decoration:inactive_opacity"].floatValue = 1;
|
configValues["decoration:inactive_opacity"].floatValue = 1;
|
||||||
|
configValues["decoration:fullscreen_opacity"].floatValue = 1;
|
||||||
|
|
||||||
configValues["dwindle:pseudotile"].intValue = 0;
|
configValues["dwindle:pseudotile"].intValue = 0;
|
||||||
configValues["dwindle:col.group_border"].intValue = 0x66777700;
|
configValues["dwindle:col.group_border"].intValue = 0x66777700;
|
||||||
@ -700,7 +701,7 @@ void CConfigManager::tick() {
|
|||||||
const std::string CONFIGPATH = ENVHOME + (ISDEBUG ? (std::string) "/.config/hypr/hyprlandd.conf" : (std::string) "/.config/hypr/hyprland.conf");
|
const std::string CONFIGPATH = ENVHOME + (ISDEBUG ? (std::string) "/.config/hypr/hyprlandd.conf" : (std::string) "/.config/hypr/hyprland.conf");
|
||||||
|
|
||||||
if (!std::filesystem::exists(CONFIGPATH)) {
|
if (!std::filesystem::exists(CONFIGPATH)) {
|
||||||
loadConfigLoadVars();
|
Debug::log(ERR, "Config doesn't exist??");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -59,28 +59,11 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
|
|||||||
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
|
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
|
||||||
|
|
||||||
if (!layersurface->fadingOut) {
|
if (!layersurface->fadingOut) {
|
||||||
if (layersurface->layerSurface->mapped) {
|
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
||||||
Debug::log(LOG, "LayerSurface wasn't unmapped, making a snapshot now!");
|
layersurface->alpha.setValueAndWarp(0.f);
|
||||||
|
layersurface->fadingOut = true;
|
||||||
// make a snapshot and start fade
|
|
||||||
// layersurfaces aren't required to unmap before destroy
|
|
||||||
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
|
|
||||||
layersurface->alpha = 0.f;
|
|
||||||
|
|
||||||
layersurface->fadingOut = true;
|
|
||||||
} else {
|
|
||||||
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
|
|
||||||
layersurface->alpha.setValueAndWarp(0.f);
|
|
||||||
layersurface->fadingOut = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layersurface->layerSurface->mapped)
|
|
||||||
layersurface->layerSurface->mapped = false;
|
|
||||||
|
|
||||||
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
|
|
||||||
g_pCompositor->m_pLastFocus = nullptr;
|
|
||||||
|
|
||||||
layersurface->hyprListener_commitLayerSurface.removeCallback();
|
layersurface->hyprListener_commitLayerSurface.removeCallback();
|
||||||
layersurface->hyprListener_destroyLayerSurface.removeCallback();
|
layersurface->hyprListener_destroyLayerSurface.removeCallback();
|
||||||
layersurface->hyprListener_mapLayerSurface.removeCallback();
|
layersurface->hyprListener_mapLayerSurface.removeCallback();
|
||||||
|
@ -60,8 +60,8 @@ float CBezierCurve::getYForPoint(float x) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// in the name of performance i shall make a hack
|
// in the name of performance i shall make a hack
|
||||||
const auto LOWERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * lowerT)];
|
const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, 199)];
|
||||||
const auto UPPERPOINT = &m_aPointsBaked[(int)((float)BAKEDPOINTS * upperT)];
|
const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, 199)];
|
||||||
|
|
||||||
const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x);
|
const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x);
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#include "MiscFunctions.hpp"
|
#include "MiscFunctions.hpp"
|
||||||
#include "../defines.hpp"
|
#include "../defines.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include "../Compositor.hpp"
|
||||||
|
|
||||||
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
|
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
|
||||||
ASSERT(pSignal);
|
ASSERT(pSignal);
|
||||||
@ -121,3 +122,22 @@ bool isNumber(const std::string& str) {
|
|||||||
bool isDirection(const std::string& arg) {
|
bool isDirection(const std::string& arg) {
|
||||||
return arg == "l" || arg == "r" || arg == "u" || arg == "d" || arg == "t" || arg == "b";
|
return arg == "l" || arg == "r" || arg == "u" || arg == "d" || arg == "t" || arg == "b";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||||
|
int result = INT_MAX;
|
||||||
|
if (in.find("name:") == 0) {
|
||||||
|
const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1);
|
||||||
|
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
|
||||||
|
if (!WORKSPACE) {
|
||||||
|
result = g_pCompositor->getNextAvailableNamedWorkspace();
|
||||||
|
} else {
|
||||||
|
result = WORKSPACE->m_iID;
|
||||||
|
}
|
||||||
|
outName = WORKSPACENAME;
|
||||||
|
} else {
|
||||||
|
result = std::clamp((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1, INT_MAX);
|
||||||
|
outName = std::to_string(result);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
@ -9,5 +9,6 @@ void scaleBox(wlr_box*, float);
|
|||||||
std::string removeBeginEndSpacesTabs(std::string);
|
std::string removeBeginEndSpacesTabs(std::string);
|
||||||
bool isNumber(const std::string&);
|
bool isNumber(const std::string&);
|
||||||
bool isDirection(const std::string&);
|
bool isDirection(const std::string&);
|
||||||
|
int getWorkspaceIDFromString(const std::string&, std::string&);
|
||||||
|
|
||||||
float getPlusMinusKeywordResult(std::string in, float relative);
|
float getPlusMinusKeywordResult(std::string in, float relative);
|
@ -54,6 +54,9 @@ struct SRenderData {
|
|||||||
|
|
||||||
// for alpha settings
|
// for alpha settings
|
||||||
float alpha = 1.f;
|
float alpha = 1.f;
|
||||||
|
|
||||||
|
// for decorations (border)
|
||||||
|
bool decorate = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SKeyboard {
|
struct SKeyboard {
|
||||||
|
@ -23,6 +23,9 @@ CWorkspace::CWorkspace(int monitorID) {
|
|||||||
|
|
||||||
m_vRenderOffset.m_pWorkspace = this;
|
m_vRenderOffset.m_pWorkspace = this;
|
||||||
m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||||
|
m_fAlpha.m_pWorkspace = this;
|
||||||
|
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
|
||||||
|
m_fAlpha.setValueAndWarp(255.f);
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorkspace::~CWorkspace() {
|
CWorkspace::~CWorkspace() {
|
||||||
@ -34,3 +37,31 @@ CWorkspace::~CWorkspace() {
|
|||||||
m_pWlrHandle = nullptr;
|
m_pWlrHandle = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CWorkspace::startAnim(bool in, bool left) {
|
||||||
|
const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style");
|
||||||
|
|
||||||
|
if (ANIMSTYLE == "fade") {
|
||||||
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
|
||||||
|
|
||||||
|
if (in) {
|
||||||
|
m_fAlpha.setValueAndWarp(0.f);
|
||||||
|
m_fAlpha = 255.f;
|
||||||
|
} else {
|
||||||
|
m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
m_fAlpha = 0.f;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// fallback is slide
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
|
|
||||||
|
m_fAlpha.setValueAndWarp(255.f); // fix a bug, if switching from fade -> slide.
|
||||||
|
|
||||||
|
if (in) {
|
||||||
|
m_vRenderOffset.setValueAndWarp(Vector2D(left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
||||||
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
|
} else {
|
||||||
|
m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -21,4 +21,7 @@ public:
|
|||||||
|
|
||||||
// for animations
|
// for animations
|
||||||
CAnimatedVariable m_vRenderOffset;
|
CAnimatedVariable m_vRenderOffset;
|
||||||
|
CAnimatedVariable m_fAlpha;
|
||||||
|
|
||||||
|
void startAnim(bool in, bool left);
|
||||||
};
|
};
|
@ -176,7 +176,7 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
|||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
|
||||||
|
|
||||||
// Populate the node with our window's data
|
// Populate the node with our window's data
|
||||||
PNODE->workspaceID = PMONITOR->activeWorkspace;
|
PNODE->workspaceID = pWindow->m_iWorkspaceID;
|
||||||
PNODE->pWindow = pWindow;
|
PNODE->pWindow = pWindow;
|
||||||
PNODE->isNode = false;
|
PNODE->isNode = false;
|
||||||
PNODE->layout = this;
|
PNODE->layout = this;
|
||||||
@ -184,7 +184,7 @@ void CHyprDwindleLayout::onWindowCreated(CWindow* pWindow) {
|
|||||||
SDwindleNodeData* OPENINGON;
|
SDwindleNodeData* OPENINGON;
|
||||||
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
|
const auto MONFROMCURSOR = g_pCompositor->getMonitorFromCursor();
|
||||||
|
|
||||||
if (PMONITOR->ID == MONFROMCURSOR->ID)
|
if (PMONITOR->ID == MONFROMCURSOR->ID && PNODE->workspaceID == PMONITOR->activeWorkspace)
|
||||||
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
OPENINGON = getNodeFromWindow(g_pCompositor->vectorToWindowTiled(g_pInputManager->getMouseCoordsInternal()));
|
||||||
else
|
else
|
||||||
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
|
OPENINGON = getFirstNodeOnWorkspace(PMONITOR->activeWorkspace);
|
||||||
|
@ -152,17 +152,17 @@ void CAnimationManager::tick() {
|
|||||||
const auto ROUNDINGSIZE = g_pConfigManager->getInt("decoration:rounding") + 1;
|
const auto ROUNDINGSIZE = g_pConfigManager->getInt("decoration:rounding") + 1;
|
||||||
|
|
||||||
// damage for old box
|
// damage for old box
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width, BORDERSIZE + ROUNDINGSIZE); // top
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height); // left
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x - BORDERSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // left
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x + WLRBOXPREV.width - ROUNDINGSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height); // right
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x + WLRBOXPREV.width - ROUNDINGSIZE, WLRBOXPREV.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXPREV.height + 2 * BORDERSIZE); // right
|
||||||
g_pHyprRenderer->damageBox(WLRBOXPREV.x, WLRBOXPREV.y + WLRBOXPREV.height - ROUNDINGSIZE, WLRBOXPREV.width, BORDERSIZE + ROUNDINGSIZE); // bottom
|
g_pHyprRenderer->damageBox(WLRBOXPREV.x, WLRBOXPREV.y + WLRBOXPREV.height - ROUNDINGSIZE, WLRBOXPREV.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||||
|
|
||||||
// damage for new box
|
// damage for new box
|
||||||
const wlr_box WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
|
const wlr_box WLRBOXNEW = {PWINDOW->m_vRealPosition.vec().x, PWINDOW->m_vRealPosition.vec().y, PWINDOW->m_vRealSize.vec().x, PWINDOW->m_vRealSize.vec().y};
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width, BORDERSIZE + ROUNDINGSIZE); // top
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // top
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height); // left
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x - BORDERSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // left
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height); // right
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x + WLRBOXNEW.width - ROUNDINGSIZE, WLRBOXNEW.y - BORDERSIZE, BORDERSIZE + ROUNDINGSIZE, WLRBOXNEW.height + 2 * BORDERSIZE); // right
|
||||||
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width, BORDERSIZE + ROUNDINGSIZE); // bottom
|
g_pHyprRenderer->damageBox(WLRBOXNEW.x, WLRBOXNEW.y + WLRBOXNEW.height - ROUNDINGSIZE, WLRBOXNEW.width + 2 * BORDERSIZE, BORDERSIZE + ROUNDINGSIZE); // bottom
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -3,20 +3,21 @@
|
|||||||
CKeybindManager::CKeybindManager() {
|
CKeybindManager::CKeybindManager() {
|
||||||
// initialize all dispatchers
|
// initialize all dispatchers
|
||||||
|
|
||||||
m_mDispatchers["exec"] = spawn;
|
m_mDispatchers["exec"] = spawn;
|
||||||
m_mDispatchers["killactive"] = killActive;
|
m_mDispatchers["killactive"] = killActive;
|
||||||
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
m_mDispatchers["togglefloating"] = toggleActiveFloating;
|
||||||
m_mDispatchers["workspace"] = changeworkspace;
|
m_mDispatchers["workspace"] = changeworkspace;
|
||||||
m_mDispatchers["fullscreen"] = fullscreenActive;
|
m_mDispatchers["fullscreen"] = fullscreenActive;
|
||||||
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
m_mDispatchers["movetoworkspace"] = moveActiveToWorkspace;
|
||||||
m_mDispatchers["pseudo"] = toggleActivePseudo;
|
m_mDispatchers["movetoworkspacesilent"] = moveActiveToWorkspaceSilent;
|
||||||
m_mDispatchers["movefocus"] = moveFocusTo;
|
m_mDispatchers["pseudo"] = toggleActivePseudo;
|
||||||
m_mDispatchers["movewindow"] = moveActiveTo;
|
m_mDispatchers["movefocus"] = moveFocusTo;
|
||||||
m_mDispatchers["togglegroup"] = toggleGroup;
|
m_mDispatchers["movewindow"] = moveActiveTo;
|
||||||
m_mDispatchers["changegroupactive"] = changeGroupActive;
|
m_mDispatchers["togglegroup"] = toggleGroup;
|
||||||
m_mDispatchers["togglesplit"] = toggleSplit;
|
m_mDispatchers["changegroupactive"] = changeGroupActive;
|
||||||
m_mDispatchers["splitratio"] = alterSplitRatio;
|
m_mDispatchers["togglesplit"] = toggleSplit;
|
||||||
m_mDispatchers["focusmonitor"] = focusMonitor;
|
m_mDispatchers["splitratio"] = alterSplitRatio;
|
||||||
|
m_mDispatchers["focusmonitor"] = focusMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CKeybindManager::addKeybind(SKeybind kb) {
|
void CKeybindManager::addKeybind(SKeybind kb) {
|
||||||
@ -167,19 +168,7 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
int workspaceToChangeTo = 0;
|
int workspaceToChangeTo = 0;
|
||||||
std::string workspaceName = "";
|
std::string workspaceName = "";
|
||||||
|
|
||||||
if (args.find("name:") == 0) {
|
workspaceToChangeTo = getWorkspaceIDFromString(args, workspaceName);
|
||||||
const auto WORKSPACENAME = args.substr(args.find_first_of(':') + 1);
|
|
||||||
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
|
|
||||||
if (!WORKSPACE) {
|
|
||||||
workspaceToChangeTo = g_pCompositor->getNextAvailableNamedWorkspace();
|
|
||||||
} else {
|
|
||||||
workspaceToChangeTo = WORKSPACE->m_iID;
|
|
||||||
}
|
|
||||||
workspaceName = WORKSPACENAME;
|
|
||||||
} else {
|
|
||||||
workspaceToChangeTo = std::clamp((int)getPlusMinusKeywordResult(args, g_pCompositor->m_pLastMonitor->activeWorkspace), 1, INT_MAX);
|
|
||||||
workspaceName = std::to_string(workspaceToChangeTo);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (workspaceToChangeTo == INT_MAX) {
|
if (workspaceToChangeTo == INT_MAX) {
|
||||||
Debug::log(ERR, "Error in changeworkspace, invalid value");
|
Debug::log(ERR, "Error in changeworkspace, invalid value");
|
||||||
@ -209,11 +198,10 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACEID;
|
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACEID;
|
||||||
|
|
||||||
// start anim on old workspace
|
// start anim on old workspace
|
||||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACEID)->m_vRenderOffset = Vector2D(ANIMTOLEFT ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
g_pCompositor->getWorkspaceByID(OLDWORKSPACEID)->startAnim(false, ANIMTOLEFT);
|
||||||
|
|
||||||
// start anim on new workspace
|
// start anim on new workspace
|
||||||
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset.setValueAndWarp(Vector2D(ANIMTOLEFT ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->startAnim(true, ANIMTOLEFT);
|
||||||
g_pCompositor->getWorkspaceByID(workspaceToChangeTo)->m_vRenderOffset = Vector2D(0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -250,14 +238,13 @@ void CKeybindManager::changeworkspace(std::string args) {
|
|||||||
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACE;
|
const auto ANIMTOLEFT = workspaceToChangeTo > OLDWORKSPACE;
|
||||||
|
|
||||||
// start anim on old workspace
|
// start anim on old workspace
|
||||||
g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->m_vRenderOffset = Vector2D(ANIMTOLEFT ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
|
g_pCompositor->getWorkspaceByID(OLDWORKSPACE)->startAnim(false, ANIMTOLEFT);
|
||||||
|
|
||||||
g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID);
|
g_pCompositor->m_lWorkspaces.emplace_back(PMONITOR->ID);
|
||||||
const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
const auto PWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
|
||||||
|
|
||||||
// start anim on new workspace
|
// start anim on new workspace
|
||||||
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(ANIMTOLEFT ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x, 0));
|
PWORKSPACE->startAnim(true, ANIMTOLEFT);
|
||||||
PWORKSPACE->m_vRenderOffset = Vector2D(0, 0);
|
|
||||||
|
|
||||||
// We are required to set the name here immediately
|
// We are required to set the name here immediately
|
||||||
wlr_ext_workspace_handle_v1_set_name(PWORKSPACE->m_pWlrHandle, workspaceName.c_str());
|
wlr_ext_workspace_handle_v1_set_name(PWORKSPACE->m_pWlrHandle, workspaceName.c_str());
|
||||||
@ -351,6 +338,58 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CKeybindManager::moveActiveToWorkspaceSilent(std::string args) {
|
||||||
|
// hacky, but works lol
|
||||||
|
|
||||||
|
int workspaceToMoveTo = 0;
|
||||||
|
std::string workspaceName = "";
|
||||||
|
|
||||||
|
workspaceToMoveTo = getWorkspaceIDFromString(args, workspaceName);
|
||||||
|
|
||||||
|
if (workspaceToMoveTo == INT_MAX) {
|
||||||
|
Debug::log(ERR, "Error in moveActiveToWorkspaceSilent, invalid value");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto PWINDOW = g_pCompositor->m_pLastWindow;
|
||||||
|
|
||||||
|
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||||
|
return;
|
||||||
|
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||||
|
|
||||||
|
if (workspaceToMoveTo == PMONITOR->activeWorkspace)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// may be null until later!
|
||||||
|
auto PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToMoveTo);
|
||||||
|
|
||||||
|
const auto PMONITORNEW = PWORKSPACE ? g_pCompositor->getMonitorFromID(PWORKSPACE->m_iMonitorID) : PMONITOR;
|
||||||
|
|
||||||
|
const auto OLDWORKSPACEIDONMONITOR = PMONITORNEW->activeWorkspace;
|
||||||
|
const auto OLDWORKSPACEIDRETURN = PMONITOR->activeWorkspace;
|
||||||
|
|
||||||
|
const auto POLDWORKSPACEONMON = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDONMONITOR);
|
||||||
|
const auto POLDWORKSPACEIDRETURN = g_pCompositor->getWorkspaceByID(OLDWORKSPACEIDRETURN);
|
||||||
|
|
||||||
|
moveActiveToWorkspace(args);
|
||||||
|
|
||||||
|
PWORKSPACE = g_pCompositor->getWorkspaceByID(workspaceToMoveTo);
|
||||||
|
|
||||||
|
changeworkspace(std::to_string(OLDWORKSPACEIDONMONITOR));
|
||||||
|
changeworkspace(std::to_string(OLDWORKSPACEIDRETURN));
|
||||||
|
|
||||||
|
// revert animations
|
||||||
|
PWORKSPACE->m_vRenderOffset.setValueAndWarp(Vector2D(0,0));
|
||||||
|
PWORKSPACE->m_fAlpha.setValueAndWarp(0.f);
|
||||||
|
|
||||||
|
POLDWORKSPACEIDRETURN->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
|
POLDWORKSPACEIDRETURN->m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
|
||||||
|
POLDWORKSPACEONMON->m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
|
POLDWORKSPACEONMON->m_fAlpha.setValueAndWarp(255.f);
|
||||||
|
}
|
||||||
|
|
||||||
void CKeybindManager::moveFocusTo(std::string args) {
|
void CKeybindManager::moveFocusTo(std::string args) {
|
||||||
char arg = args[0];
|
char arg = args[0];
|
||||||
|
|
||||||
|
@ -38,6 +38,7 @@ private:
|
|||||||
static void changeworkspace(std::string);
|
static void changeworkspace(std::string);
|
||||||
static void fullscreenActive(std::string);
|
static void fullscreenActive(std::string);
|
||||||
static void moveActiveToWorkspace(std::string);
|
static void moveActiveToWorkspace(std::string);
|
||||||
|
static void moveActiveToWorkspaceSilent(std::string);
|
||||||
static void moveFocusTo(std::string);
|
static void moveFocusTo(std::string);
|
||||||
static void moveActiveTo(std::string);
|
static void moveActiveTo(std::string);
|
||||||
static void toggleGroup(std::string);
|
static void toggleGroup(std::string);
|
||||||
|
@ -30,6 +30,7 @@ CHyprOpenGLImpl::CHyprOpenGLImpl() {
|
|||||||
m_shQUAD.proj = glGetUniformLocation(prog, "proj");
|
m_shQUAD.proj = glGetUniformLocation(prog, "proj");
|
||||||
m_shQUAD.color = glGetUniformLocation(prog, "color");
|
m_shQUAD.color = glGetUniformLocation(prog, "color");
|
||||||
m_shQUAD.posAttrib = glGetAttribLocation(prog, "pos");
|
m_shQUAD.posAttrib = glGetAttribLocation(prog, "pos");
|
||||||
|
m_shQUAD.texAttrib = glGetAttribLocation(prog, "texcoord");
|
||||||
|
|
||||||
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBA);
|
prog = createProgram(TEXVERTSRC, TEXFRAGSRCRGBA);
|
||||||
m_shRGBA.program = prog;
|
m_shRGBA.program = prog;
|
||||||
@ -225,13 +226,10 @@ void CHyprOpenGLImpl::scissor(const int x, const int y, const int w, const int h
|
|||||||
scissor(&box);
|
scissor(&box);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col) {
|
void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col, int round) {
|
||||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
||||||
|
|
||||||
// TODO: respect damage
|
|
||||||
scissor((wlr_box*)nullptr);
|
|
||||||
|
|
||||||
float matrix[9];
|
float matrix[9];
|
||||||
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
||||||
|
|
||||||
@ -241,23 +239,42 @@ void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col) {
|
|||||||
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
wlr_matrix_transpose(glMatrix, glMatrix);
|
||||||
|
|
||||||
if (col.a == 255.f)
|
glEnable(GL_BLEND);
|
||||||
glDisable(GL_BLEND);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
else
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
glUseProgram(m_shQUAD.program);
|
glUseProgram(m_shQUAD.program);
|
||||||
|
|
||||||
glUniformMatrix3fv(m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
glUniformMatrix3fv(m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
||||||
glUniform4f(m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
glUniform4f(m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
||||||
|
|
||||||
|
const auto TOPLEFT = Vector2D(round, round);
|
||||||
|
const auto BOTTOMRIGHT = Vector2D(box->width - round, box->height - round);
|
||||||
|
const auto FULLSIZE = Vector2D(box->width, box->height);
|
||||||
|
|
||||||
|
// Rounded corners
|
||||||
|
glUniform2f(glGetUniformLocation(m_shQUAD.program, "topLeft"), (float)TOPLEFT.x, (float)TOPLEFT.y);
|
||||||
|
glUniform2f(glGetUniformLocation(m_shQUAD.program, "bottomRight"), (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
|
||||||
|
glUniform2f(glGetUniformLocation(m_shQUAD.program, "fullSize"), (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||||
|
glUniform1f(glGetUniformLocation(m_shQUAD.program, "radius"), round);
|
||||||
|
|
||||||
glVertexAttribPointer(m_shQUAD.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
glVertexAttribPointer(m_shQUAD.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||||
|
glVertexAttribPointer(m_shQUAD.texAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||||
|
|
||||||
glEnableVertexAttribArray(m_shQUAD.posAttrib);
|
glEnableVertexAttribArray(m_shQUAD.posAttrib);
|
||||||
|
glEnableVertexAttribArray(m_shQUAD.texAttrib);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
||||||
|
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
||||||
|
const auto RECT = RECTSARR[i];
|
||||||
|
scissor(&RECT);
|
||||||
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
glDisableVertexAttribArray(m_shQUAD.posAttrib);
|
glDisableVertexAttribArray(m_shQUAD.posAttrib);
|
||||||
|
glDisableVertexAttribArray(m_shQUAD.texAttrib);
|
||||||
|
|
||||||
|
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, wlr_box* pBox, float alpha, int round) {
|
void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, wlr_box* pBox, float alpha, int round) {
|
||||||
@ -266,15 +283,15 @@ void CHyprOpenGLImpl::renderTexture(wlr_texture* tex, wlr_box* pBox, float alpha
|
|||||||
renderTexture(CTexture(tex), pBox, alpha, round);
|
renderTexture(CTexture(tex), pBox, alpha, round);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float alpha, int round, bool discardopaque) {
|
void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float alpha, int round, bool discardopaque, bool border) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||||
|
|
||||||
renderTextureInternalWithDamage(tex, pBox, alpha, m_RenderData.pDamage, round, discardopaque);
|
renderTextureInternalWithDamage(tex, pBox, alpha, m_RenderData.pDamage, round, discardopaque, border);
|
||||||
|
|
||||||
scissor((wlr_box*)nullptr);
|
scissor((wlr_box*)nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque) {
|
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque, bool border) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||||
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
||||||
|
|
||||||
@ -472,11 +489,11 @@ CFramebuffer* CHyprOpenGLImpl::blurMainFramebufferWithDamage(float a, wlr_box* p
|
|||||||
return currentRenderToFB;
|
return currentRenderToFB;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, float a, wlr_surface* pSurface, int round) {
|
void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox, float a, wlr_surface* pSurface, int round, bool border) {
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render texture with blur without begin()!");
|
||||||
|
|
||||||
if (g_pConfigManager->getInt("decoration:blur") == 0) {
|
if (g_pConfigManager->getInt("decoration:blur") == 0) {
|
||||||
renderTexture(tex, pBox, a, round);
|
renderTexture(tex, pBox, a, round, false, border);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -530,18 +547,33 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
|||||||
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
|
wlr_box MONITORBOX = {0, 0, m_RenderData.pMonitor->vecPixelSize.x, m_RenderData.pMonitor->vecPixelSize.y};
|
||||||
if (pixman_region32_not_empty(&damage)) {
|
if (pixman_region32_not_empty(&damage)) {
|
||||||
// render our great blurred FB
|
// render our great blurred FB
|
||||||
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, 255.f, &damage); // 255.f because we adjusted blur strength to a
|
renderTextureInternalWithDamage(POUTFB->m_cTex, &MONITORBOX, a, &damage);
|
||||||
|
|
||||||
// render the window, but disable stencil for it
|
// render the window, but clear stencil
|
||||||
// because stencil has ignoreopaque
|
glClearStencil(0);
|
||||||
glDisable(GL_STENCIL_TEST);
|
glClear(GL_STENCIL_BUFFER_BIT);
|
||||||
|
|
||||||
|
// and write to it
|
||||||
|
glStencilFunc(GL_ALWAYS, 1, -1);
|
||||||
|
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
|
|
||||||
renderTextureInternalWithDamage(tex, pBox, a, &damage, round);
|
renderTextureInternalWithDamage(tex, pBox, a, &damage, round);
|
||||||
|
|
||||||
|
// then stop
|
||||||
|
glStencilFunc(GL_EQUAL, 1, -1);
|
||||||
|
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||||
|
}
|
||||||
|
|
||||||
|
// disable the stencil (if no border), finalize everything
|
||||||
|
if (!border) {
|
||||||
|
glStencilMask(-1);
|
||||||
|
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
||||||
|
} else {
|
||||||
|
auto BORDERCOL = m_pCurrentWindow->m_cRealBorderColor.col();
|
||||||
|
BORDERCOL.a *= a / 255.f;
|
||||||
|
renderBorder(pBox, BORDERCOL, g_pConfigManager->getInt("general:border_size"), round);
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable the stencil, finalize everything
|
|
||||||
glStencilMask(-1);
|
|
||||||
glStencilFunc(GL_ALWAYS, 1, 0xFF);
|
|
||||||
glDisable(GL_STENCIL_TEST);
|
glDisable(GL_STENCIL_TEST);
|
||||||
pixman_region32_fini(&damage);
|
pixman_region32_fini(&damage);
|
||||||
scissor((wlr_box*)nullptr);
|
scissor((wlr_box*)nullptr);
|
||||||
@ -554,98 +586,23 @@ void pushVert2D(float x, float y, float* arr, int& counter, wlr_box* box) {
|
|||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int thick, int radius) {
|
void CHyprOpenGLImpl::renderBorder(wlr_box* box, const CColor& col, int thick, int round) {
|
||||||
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
RASSERT((box->width > 0 && box->height > 0), "Tried to render rect with width/height < 0!");
|
||||||
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
RASSERT(m_RenderData.pMonitor, "Tried to render rect without begin()!");
|
||||||
|
|
||||||
scaleBox(box, m_RenderData.pMonitor->scale);
|
// this method assumes a set stencil and scaled box
|
||||||
|
box->x -= thick;
|
||||||
|
box->y -= thick;
|
||||||
|
box->width += 2 * thick;
|
||||||
|
box->height += 2 * thick;
|
||||||
|
|
||||||
float matrix[9];
|
round += thick; // cuz yeah
|
||||||
wlr_matrix_project_box(matrix, box, WL_OUTPUT_TRANSFORM_NORMAL, 0, m_RenderData.pMonitor->output->transform_matrix); // TODO: write own, don't use WLR here
|
|
||||||
|
|
||||||
float glMatrix[9];
|
// only draw on non-stencild.
|
||||||
wlr_matrix_multiply(glMatrix, m_RenderData.projection, matrix);
|
glStencilFunc(GL_NOTEQUAL, 1, -1);
|
||||||
wlr_matrix_multiply(glMatrix, matrixFlip180, glMatrix);
|
|
||||||
|
|
||||||
wlr_matrix_transpose(glMatrix, glMatrix);
|
// draw a rounded rect
|
||||||
|
renderRect(box, col, round);
|
||||||
if (col.a == 255.f)
|
|
||||||
glDisable(GL_BLEND);
|
|
||||||
else
|
|
||||||
glEnable(GL_BLEND);
|
|
||||||
|
|
||||||
glUseProgram(m_shQUAD.program);
|
|
||||||
|
|
||||||
glUniformMatrix3fv(m_shQUAD.proj, 1, GL_FALSE, glMatrix);
|
|
||||||
glUniform4f(m_shQUAD.color, col.r / 255.f, col.g / 255.f, col.b / 255.f, col.a / 255.f);
|
|
||||||
|
|
||||||
// Sides are ONLY for corners meaning they have to be divisible by 4.
|
|
||||||
// 32 sides shouldn't be taxing at all on the performance.
|
|
||||||
const int SIDES = 32; // sides
|
|
||||||
const int SIDES34 = 24; // 3/4th of the sides
|
|
||||||
float verts[(SIDES + 8 + 1) * 4]; // 8 for the connections and 1 because last is doubled (begin/end)
|
|
||||||
int vertNo = 0;
|
|
||||||
|
|
||||||
// start from 0,0 tex coord space
|
|
||||||
float x = 0, y = 0, w = box->width, h = box->height;
|
|
||||||
|
|
||||||
pushVert2D(x + radius, y + h, verts, vertNo, box);
|
|
||||||
pushVert2D(x + w - radius, y + h, verts, vertNo, box);
|
|
||||||
|
|
||||||
float x1 = x + w - radius;
|
|
||||||
float y1 = y + h - radius;
|
|
||||||
|
|
||||||
for (int i = 0; i <= SIDES / 4; i++) {
|
|
||||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Right Line
|
|
||||||
pushVert2D(x + w, y + radius, verts, vertNo, box);
|
|
||||||
|
|
||||||
x1 = x + w - radius;
|
|
||||||
y1 = y + radius;
|
|
||||||
|
|
||||||
for (int i = SIDES / 4; i <= SIDES / 2; i++) {
|
|
||||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Top Line
|
|
||||||
pushVert2D(x + radius, y, verts, vertNo, box);
|
|
||||||
|
|
||||||
x1 = x + radius;
|
|
||||||
y1 = y + radius;
|
|
||||||
|
|
||||||
for (int i = SIDES / 2; i <= SIDES34; i++) {
|
|
||||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Left Line
|
|
||||||
pushVert2D(x, y + h - radius, verts, vertNo, box);
|
|
||||||
|
|
||||||
x1 = x + radius;
|
|
||||||
y1 = y + h - radius;
|
|
||||||
|
|
||||||
for (int i = SIDES34; i <= SIDES; i++) {
|
|
||||||
pushVert2D(x1 + (sin((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), y1 + (cos((i * (360.f / (float)SIDES) * 3.141526f / 180)) * radius), verts, vertNo, box);
|
|
||||||
}
|
|
||||||
|
|
||||||
glVertexAttribPointer(m_shQUAD.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, verts);
|
|
||||||
|
|
||||||
glEnableVertexAttribArray(m_shQUAD.posAttrib);
|
|
||||||
|
|
||||||
glLineWidth(thick);
|
|
||||||
|
|
||||||
// draw with damage
|
|
||||||
if (pixman_region32_not_empty(m_RenderData.pDamage)) {
|
|
||||||
PIXMAN_DAMAGE_FOREACH(m_RenderData.pDamage) {
|
|
||||||
const auto RECT = RECTSARR[i];
|
|
||||||
scissor(&RECT);
|
|
||||||
|
|
||||||
glDrawArrays(GL_LINE_STRIP, 0, 41);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
glDisableVertexAttribArray(m_shQUAD.posAttrib);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
|
void CHyprOpenGLImpl::makeWindowSnapshot(CWindow* pWindow) {
|
||||||
|
@ -53,11 +53,10 @@ public:
|
|||||||
void begin(SMonitor*, pixman_region32_t*, bool fake = false);
|
void begin(SMonitor*, pixman_region32_t*, bool fake = false);
|
||||||
void end();
|
void end();
|
||||||
|
|
||||||
void renderRect(wlr_box*, const CColor&);
|
void renderRect(wlr_box*, const CColor&, int round = 0);
|
||||||
void renderTexture(wlr_texture*, wlr_box*, float a, int round = 0);
|
void renderTexture(wlr_texture*, wlr_box*, float a, int round = 0);
|
||||||
void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardOpaque = false);
|
void renderTexture(const CTexture&, wlr_box*, float a, int round = 0, bool discardOpaque = false, bool border = false);
|
||||||
void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0);
|
void renderTextureWithBlur(const CTexture&, wlr_box*, float a, wlr_surface* pSurface, int round = 0, bool border = false);
|
||||||
void renderBorder(wlr_box*, const CColor&, int thick = 1, int round = 0);
|
|
||||||
|
|
||||||
void makeWindowSnapshot(CWindow*);
|
void makeWindowSnapshot(CWindow*);
|
||||||
void makeLayerSnapshot(SLayerSurface*);
|
void makeLayerSnapshot(SLayerSurface*);
|
||||||
@ -77,6 +76,8 @@ public:
|
|||||||
GLint m_iCurrentOutputFb = 0;
|
GLint m_iCurrentOutputFb = 0;
|
||||||
GLint m_iWLROutputFb = 0;
|
GLint m_iWLROutputFb = 0;
|
||||||
|
|
||||||
|
CWindow* m_pCurrentWindow = nullptr; // hack to get the current rendered window
|
||||||
|
|
||||||
pixman_region32_t m_rOriginalDamageRegion; // used for storing the pre-expanded region
|
pixman_region32_t m_rOriginalDamageRegion; // used for storing the pre-expanded region
|
||||||
|
|
||||||
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
std::unordered_map<CWindow*, CFramebuffer> m_mWindowFramebuffers;
|
||||||
@ -109,9 +110,8 @@ private:
|
|||||||
// returns the out FB, can be either Mirror or MirrorSwap
|
// returns the out FB, can be either Mirror or MirrorSwap
|
||||||
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
CFramebuffer* blurMainFramebufferWithDamage(float a, wlr_box* pBox, pixman_region32_t* damage);
|
||||||
|
|
||||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false);
|
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool border = false);
|
||||||
void renderTextureWithBlurInternal(const CTexture&, wlr_box*, float a, int round = 0);
|
void renderBorder(wlr_box*, const CColor&, int thick = 1, int round = 0);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CHyprOpenGLImpl> g_pHyprOpenGL;
|
inline std::unique_ptr<CHyprOpenGLImpl> g_pHyprOpenGL;
|
@ -20,9 +20,9 @@ void renderSurface(struct wlr_surface* surface, int x, int y, void* data) {
|
|||||||
scaleBox(&windowBox, RDATA->output->scale);
|
scaleBox(&windowBox, RDATA->output->scale);
|
||||||
|
|
||||||
if (RDATA->surface && surface == RDATA->surface)
|
if (RDATA->surface && surface == RDATA->surface)
|
||||||
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
|
g_pHyprOpenGL->renderTextureWithBlur(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, surface, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"), RDATA->decorate);
|
||||||
else
|
else
|
||||||
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"));
|
g_pHyprOpenGL->renderTexture(TEXTURE, &windowBox, RDATA->fadeAlpha * RDATA->alpha, RDATA->dontRound ? 0 : g_pConfigManager->getInt("decoration:rounding"), false, RDATA->decorate);
|
||||||
|
|
||||||
wlr_surface_send_frame_done(surface, RDATA->when);
|
wlr_surface_send_frame_done(surface, RDATA->when);
|
||||||
|
|
||||||
@ -41,7 +41,7 @@ bool shouldRenderWindow(CWindow* pWindow, SMonitor* pMonitor) {
|
|||||||
|
|
||||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(pWindow->m_iWorkspaceID);
|
||||||
// if not, check if it maybe is active on a different monitor. vvv might be animation in progress
|
// if not, check if it maybe is active on a different monitor. vvv might be animation in progress
|
||||||
if (g_pCompositor->isWorkspaceVisible(pWindow->m_iWorkspaceID) || (PWORKSPACE && PWORKSPACE->m_iMonitorID == pMonitor->ID && PWORKSPACE->m_vRenderOffset.isBeingAnimated()))
|
if (g_pCompositor->isWorkspaceVisible(pWindow->m_iWorkspaceID) || (PWORKSPACE && PWORKSPACE->m_iMonitorID == pMonitor->ID && (PWORKSPACE->m_vRenderOffset.isBeingAnimated() || PWORKSPACE->m_fAlpha.isBeingAnimated())))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -96,17 +96,16 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
|||||||
renderdata.w = pWindow->m_vRealSize.vec().x;
|
renderdata.w = pWindow->m_vRealSize.vec().x;
|
||||||
renderdata.h = pWindow->m_vRealSize.vec().y;
|
renderdata.h = pWindow->m_vRealSize.vec().y;
|
||||||
renderdata.dontRound = pWindow->m_bIsFullscreen;
|
renderdata.dontRound = pWindow->m_bIsFullscreen;
|
||||||
renderdata.fadeAlpha = pWindow->m_fAlpha.fl();
|
renderdata.fadeAlpha = pWindow->m_fAlpha.fl() * (PWORKSPACE->m_fAlpha.fl() / 255.f);
|
||||||
renderdata.alpha = pWindow == g_pCompositor->m_pLastWindow ? g_pConfigManager->getFloat("decoration:active_opacity") : g_pConfigManager->getFloat("decoration:inactive_opacity");
|
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;
|
||||||
|
|
||||||
// apply window special data
|
// apply window special data
|
||||||
renderdata.alpha *= pWindow->m_sSpecialRenderData.alpha;
|
renderdata.alpha *= pWindow->m_sSpecialRenderData.alpha;
|
||||||
|
|
||||||
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
g_pHyprOpenGL->m_pCurrentWindow = pWindow;
|
||||||
|
|
||||||
// border
|
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(pWindow), renderSurface, &renderdata);
|
||||||
if (decorate && !pWindow->m_bX11DoesntWantBorders)
|
|
||||||
drawBorderForWindow(pWindow, pMonitor, pWindow->m_fAlpha.fl() * renderdata.alpha, PWORKSPACE->m_vRenderOffset.vec());
|
|
||||||
|
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
if (pWindow->m_uSurface.xwayland->surface) {
|
if (pWindow->m_uSurface.xwayland->surface) {
|
||||||
@ -118,6 +117,8 @@ void CHyprRenderer::renderWindow(CWindow* pWindow, SMonitor* pMonitor, timespec*
|
|||||||
renderdata.pMonitor = pMonitor;
|
renderdata.pMonitor = pMonitor;
|
||||||
wlr_xdg_surface_for_each_popup_surface(pWindow->m_uSurface.xdg, renderSurface, &renderdata);
|
wlr_xdg_surface_for_each_popup_surface(pWindow->m_uSurface.xdg, renderSurface, &renderdata);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_pHyprOpenGL->m_pCurrentWindow = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, SMonitor* pMonitor, timespec* time) {
|
void CHyprRenderer::renderLayer(SLayerSurface* pLayer, SMonitor* pMonitor, timespec* time) {
|
||||||
@ -437,23 +438,6 @@ void CHyprRenderer::arrangeLayersForMonitor(const int& monitor) {
|
|||||||
Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y, PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
Debug::log(LOG, "Monitor %s layers arranged: reserved: %f %f %f %f", PMONITOR->szName.c_str(), PMONITOR->vecReservedTopLeft.x, PMONITOR->vecReservedTopLeft.y, PMONITOR->vecReservedBottomRight.x, PMONITOR->vecReservedBottomRight.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprRenderer::drawBorderForWindow(CWindow* pWindow, SMonitor* pMonitor, float alpha, const Vector2D& offset) {
|
|
||||||
const auto BORDERSIZE = g_pConfigManager->getInt("general:border_size");
|
|
||||||
|
|
||||||
if (BORDERSIZE < 1)
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto BORDERCOL = pWindow->m_cRealBorderColor.col();
|
|
||||||
BORDERCOL.a *= (alpha / 255.f);
|
|
||||||
|
|
||||||
Vector2D correctPos = pWindow->m_vRealPosition.vec() - pMonitor->vecPosition;
|
|
||||||
Vector2D correctSize = pWindow->m_vRealSize.vec();
|
|
||||||
|
|
||||||
// top
|
|
||||||
wlr_box border = {correctPos.x - BORDERSIZE / 2.f + offset.x, correctPos.y - BORDERSIZE / 2.f + offset.y, pWindow->m_vRealSize.vec().x + BORDERSIZE, pWindow->m_vRealSize.vec().y + BORDERSIZE};
|
|
||||||
g_pHyprOpenGL->renderBorder(&border, BORDERCOL, BORDERSIZE, g_pConfigManager->getInt("decoration:rounding"));
|
|
||||||
}
|
|
||||||
|
|
||||||
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
void CHyprRenderer::damageSurface(wlr_surface* pSurface, double x, double y) {
|
||||||
if (!pSurface)
|
if (!pSurface)
|
||||||
return; // wut?
|
return; // wut?
|
||||||
|
@ -34,7 +34,6 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void arrangeLayerArray(SMonitor*, const std::list<SLayerSurface*>&, bool, wlr_box*);
|
void arrangeLayerArray(SMonitor*, const std::list<SLayerSurface*>&, bool, wlr_box*);
|
||||||
void drawBorderForWindow(CWindow*, SMonitor*, float a = 255.f, const Vector2D& offset = Vector2D(0,0));
|
|
||||||
void renderWorkspaceWithFullscreenWindow(SMonitor*, CWorkspace*, timespec*);
|
void renderWorkspaceWithFullscreenWindow(SMonitor*, CWorkspace*, timespec*);
|
||||||
void renderWindow(CWindow*, SMonitor*, timespec*, bool);
|
void renderWindow(CWindow*, SMonitor*, timespec*, bool);
|
||||||
void renderLayer(SLayerSurface*, SMonitor*, timespec*);
|
void renderLayer(SLayerSurface*, SMonitor*, timespec*);
|
||||||
|
@ -7,6 +7,7 @@ struct SQuad {
|
|||||||
GLint proj;
|
GLint proj;
|
||||||
GLint color;
|
GLint color;
|
||||||
GLint posAttrib;
|
GLint posAttrib;
|
||||||
|
GLint texAttrib;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CShader {
|
class CShader {
|
||||||
|
@ -21,8 +21,53 @@ precision mediump float;
|
|||||||
varying vec4 v_color;
|
varying vec4 v_color;
|
||||||
varying vec2 v_texcoord;
|
varying vec2 v_texcoord;
|
||||||
|
|
||||||
|
uniform vec2 topLeft;
|
||||||
|
uniform vec2 bottomRight;
|
||||||
|
uniform vec2 fullSize;
|
||||||
|
uniform float radius;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
gl_FragColor = v_color;
|
if (radius == 0.0) {
|
||||||
|
gl_FragColor = v_color;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
vec2 pixCoord = fullSize * v_texcoord;
|
||||||
|
|
||||||
|
if (pixCoord[0] < topLeft[0]) {
|
||||||
|
// we're close left
|
||||||
|
if (pixCoord[1] < topLeft[1]) {
|
||||||
|
// top
|
||||||
|
if (distance(topLeft, pixCoord) > radius) {
|
||||||
|
discard;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (pixCoord[1] > bottomRight[1]) {
|
||||||
|
// bottom
|
||||||
|
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord) > radius) {
|
||||||
|
discard;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (pixCoord[0] > bottomRight[0]) {
|
||||||
|
// we're close right
|
||||||
|
if (pixCoord[1] < topLeft[1]) {
|
||||||
|
// top
|
||||||
|
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord) > radius) {
|
||||||
|
discard;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (pixCoord[1] > bottomRight[1]) {
|
||||||
|
// bottom
|
||||||
|
if (distance(bottomRight, pixCoord) > radius) {
|
||||||
|
discard;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
gl_FragColor = v_color;
|
||||||
})#";
|
})#";
|
||||||
|
|
||||||
inline const std::string TEXVERTSRC = R"#(
|
inline const std::string TEXVERTSRC = R"#(
|
||||||
|
Loading…
Reference in New Issue
Block a user