mirror of
https://github.com/hyprwm/Hyprland.git
synced 2025-07-31 12:11:56 -07:00
Compare commits
59 Commits
v0.2.2beta
...
v0.4.0beta
Author | SHA1 | Date | |
---|---|---|---|
|
b62e530fdb | ||
|
663fba76ae | ||
|
d73e05cc68 | ||
|
066ea296ff | ||
|
72c967aa89 | ||
|
c474e8253a | ||
|
20936ad2a4 | ||
|
d743ac7bb1 | ||
|
322a495412 | ||
|
63d6c594b9 | ||
|
09e77bf844 | ||
|
3d4832990c | ||
|
84a0fa0f34 | ||
|
2cd2f8b5b5 | ||
|
172d6cd498 | ||
|
02269af777 | ||
|
e2592522d3 | ||
|
d76c982d2e | ||
|
ef855440c6 | ||
|
246aa000f5 | ||
|
1a93b2a756 | ||
|
10c2bd0686 | ||
|
f99ad521a4 | ||
|
9486a230c7 | ||
|
6f3b004199 | ||
|
19b17b590c | ||
|
f9c8a72e46 | ||
|
e11cb8b328 | ||
|
7b568d7ad8 | ||
|
a2f718059b | ||
|
feb0499597 | ||
|
601abc7e92 | ||
|
7451890fd7 | ||
|
f5cdb5b95e | ||
|
7afcf656bd | ||
|
6daa866beb | ||
|
9447fcd603 | ||
|
9acf15efd7 | ||
|
b5a100379e | ||
|
4f76d5d8d7 | ||
|
8d850b0ce1 | ||
|
0f28d2ae55 | ||
|
d2451aea4b | ||
|
680705ff91 | ||
|
300fc2ab0f | ||
|
02210d3d96 | ||
|
879345c1e9 | ||
|
1e3bea5e70 | ||
|
f64cae2b7f | ||
|
c433b14e3d | ||
|
8d1c495878 | ||
|
4264a0b08d | ||
|
40ab062a3c | ||
|
35bcea38e3 | ||
|
1ccb944509 | ||
|
c600249aee | ||
|
6d6e967a8d | ||
|
f6b8a96621 | ||
|
8e8d5a99c2 |
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
12
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -7,12 +7,6 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
|
||||
|
||||
**Images/videos/anything that would help**
|
||||
|
||||
|
||||
Please attach a log (it's in /tmp/hypr/hyprland.log) and, if crashing, a crashdump (coredumpctl, then coredumpctl info <pid>)
|
||||
|
||||
*Please do NOT attach coredumps from any packaged version of Hyprland (AUR, etc.). Compile manually, and THEN attach a coredump of that.*
|
||||
Please consult the issue guidelines at
|
||||
https://github.com/vaxerski/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md
|
||||
BEFORE submitting.
|
||||
|
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
4
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -7,4 +7,6 @@ assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe in detail your idea.**
|
||||
Please consult the issue guidelines at
|
||||
https://github.com/vaxerski/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md
|
||||
BEFORE submitting.
|
||||
|
7
.github/workflows/nix-update.yaml
vendored
7
.github/workflows/nix-update.yaml
vendored
@@ -1,9 +1,6 @@
|
||||
name: "Nix: update lockfile"
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 */14 * *'
|
||||
workflow_dispatch:
|
||||
on: [push, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
update:
|
||||
@@ -19,7 +16,7 @@ jobs:
|
||||
auto-optimise-store = true
|
||||
experimental-features = nix-command flakes
|
||||
- name: Update lockfile
|
||||
run: nix flake update
|
||||
run: nix/update-inputs.sh
|
||||
- uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "[gha] bump flake inputs"
|
||||
|
@@ -37,10 +37,9 @@ For Hyprland without the `land` part, see [Hypr], the Xorg window manager.
|
||||
|
||||
# Notice
|
||||
|
||||
This project is still in its early development, expect bugs.
|
||||
|
||||
Once you get it working though, it's pretty stable.<br/>
|
||||
Hyprland is still in pretty early development compared to some other Wayland compositors.
|
||||
|
||||
Although Hyprland is pretty stable, it may have some bugs.
|
||||
|
||||
### Help Wanted
|
||||
|
||||
@@ -55,6 +54,8 @@ Try it out and report bugs / suggestions!
|
||||
- wlr_ext workspaces protocol support
|
||||
- Dual Kawase blur
|
||||
- Fully dynamic workspaces
|
||||
- Closely follows wlroots-git
|
||||
- Bundled wlroots
|
||||
- Window / layer fade in / out
|
||||
- Tiling / floating / fullscreen windows
|
||||
- Special Workspace (Scratchpad)
|
||||
|
47
aur/PKGBUILD
47
aur/PKGBUILD
@@ -2,20 +2,59 @@
|
||||
|
||||
_pkgname="hyprland"
|
||||
pkgname="${_pkgname}"
|
||||
pkgver="0.1.1beta"
|
||||
pkgver="0.3.0beta"
|
||||
pkgrel=2
|
||||
pkgdesc="Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks."
|
||||
arch=(any)
|
||||
url="https://github.com/vaxerski/Hyprland"
|
||||
license=('BSD')
|
||||
depends=(libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols wlroots-git cairo pango)
|
||||
makedepends=(git cmake ninja gcc gdb)
|
||||
depends=(
|
||||
libxcb
|
||||
xcb-proto
|
||||
xcb-util
|
||||
xcb-util-keysyms
|
||||
libxfixes
|
||||
libx11
|
||||
libxcomposite
|
||||
xorg-xinput
|
||||
libxrender
|
||||
pixman
|
||||
wayland-protocols
|
||||
cairo
|
||||
pango
|
||||
polkit
|
||||
glslang
|
||||
libinput
|
||||
libxcb
|
||||
libxkbcommon
|
||||
opengl-driver
|
||||
pixman
|
||||
wayland
|
||||
xcb-util-errors
|
||||
xcb-util-renderutil
|
||||
xcb-util-wm
|
||||
seatd
|
||||
vulkan-icd-loader
|
||||
vulkan-validation-layers
|
||||
xorg-xwayland)
|
||||
makedepends=(
|
||||
git
|
||||
cmake
|
||||
ninja
|
||||
gcc
|
||||
gdb
|
||||
meson
|
||||
vulkan-headers
|
||||
wayland-protocols
|
||||
xorgproto)
|
||||
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/vaxerski/hyprland/archive/v${pkgver}.tar.gz")
|
||||
sha256sums=('SKIP')
|
||||
sha256sums=('46ba9b61570f3385673dfd27a3d1dc5a084236f138bca1c2537335e0cdce9e78')
|
||||
conflicts=("${_pkgname}-git" "${_pkgname}" "${_pkgname}-bin")
|
||||
options=(!makeflags !buildflags)
|
||||
|
||||
build() {
|
||||
cd "$srcdir/Hyprland-$pkgver"
|
||||
git submodule update --init
|
||||
make all
|
||||
}
|
||||
|
||||
|
55
aur/PKGBUILD-bin
Normal file
55
aur/PKGBUILD-bin
Normal file
@@ -0,0 +1,55 @@
|
||||
# Maintainer: ThatOneCalculator <kainoa@t1c.dev>
|
||||
|
||||
_pkgname="hyprland"
|
||||
pkgname="${_pkgname}-bin"
|
||||
pkgver="0.3.0beta"
|
||||
pkgrel=2
|
||||
pkgdesc="Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks."
|
||||
arch=(any)
|
||||
url="https://github.com/vaxerski/Hyprland"
|
||||
license=('BSD')
|
||||
depends=(
|
||||
libxcb
|
||||
xcb-proto
|
||||
xcb-util
|
||||
xcb-util-keysyms
|
||||
libxfixes
|
||||
libx11
|
||||
libxcomposite
|
||||
xorg-xinput
|
||||
libxrender
|
||||
pixman
|
||||
wayland-protocols
|
||||
cairo
|
||||
pango
|
||||
polkit
|
||||
glslang
|
||||
libinput
|
||||
libxcb
|
||||
libxkbcommon
|
||||
opengl-driver
|
||||
pixman
|
||||
wayland
|
||||
xcb-util-errors
|
||||
xcb-util-renderutil
|
||||
xcb-util-wm
|
||||
seatd
|
||||
vulkan-icd-loader
|
||||
vulkan-validation-layers
|
||||
xorg-xwayland)
|
||||
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/vaxerski/Hyprland/releases/download/v${pkgver}/v${pkgver}.tar.gz")
|
||||
sha256sums=('46ba9b61570f3385673dfd27a3d1dc5a084236f138bca1c2537335e0cdce9e78')
|
||||
conflicts=("${_pkgname}-git" "${_pkgname}" "${_pkgname}-bin")
|
||||
|
||||
package() {
|
||||
cd "$srcdir/Hyprland-$pkgver"
|
||||
mkdir -p "${pkgdir}/usr/share/wayland-sessions"
|
||||
mkdir -p "${pkgdir}/usr/share/hyprland"
|
||||
install -Dm755 ./Hyprland -t "${pkgdir}/usr/bin"
|
||||
install -Dm755 ./hyprctl -t "${pkgdir}/usr/bin"
|
||||
install -Dm755 ./libwlroots.so.11032 -t "${pkgdir}/usr/lib"
|
||||
install -Dm644 assets/*.png -t "${pkgdir}/usr/share/hyprland"
|
||||
install -Dm644 example/hyprland.desktop -t "${pkgdir}/usr/share/wayland-sessions"
|
||||
install -Dm644 example/hyprland.conf -t "${pkgdir}/usr/share/hyprland"
|
||||
install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${_pkgname}"
|
||||
}
|
@@ -2,15 +2,53 @@
|
||||
|
||||
_pkgname="hyprland"
|
||||
pkgname="${_pkgname}-git"
|
||||
pkgver=r568.g632d00c
|
||||
pkgver=r655.gef85544
|
||||
pkgrel=1
|
||||
pkgdesc="Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks."
|
||||
arch=(any)
|
||||
url="https://github.com/vaxerski/Hyprland"
|
||||
license=('BSD')
|
||||
depends=(libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols wlroots-git cairo pango)
|
||||
makedepends=(git cmake ninja gcc gdb)
|
||||
depends=(
|
||||
libxcb
|
||||
xcb-proto
|
||||
xcb-util
|
||||
xcb-util-keysyms
|
||||
libxfixes
|
||||
libx11
|
||||
libxcomposite
|
||||
xorg-xinput
|
||||
libxrender
|
||||
pixman
|
||||
wayland-protocols
|
||||
cairo
|
||||
pango
|
||||
polkit
|
||||
glslang
|
||||
libinput
|
||||
libxcb
|
||||
libxkbcommon
|
||||
opengl-driver
|
||||
pixman
|
||||
wayland
|
||||
xcb-util-errors
|
||||
xcb-util-renderutil
|
||||
xcb-util-wm
|
||||
seatd
|
||||
vulkan-icd-loader
|
||||
vulkan-validation-layers
|
||||
xorg-xwayland)
|
||||
makedepends=(
|
||||
git
|
||||
cmake
|
||||
ninja
|
||||
gcc
|
||||
gdb
|
||||
meson
|
||||
vulkan-headers
|
||||
wayland-protocols
|
||||
xorgproto)
|
||||
source=("${_pkgname}::git+https://github.com/vaxerski/Hyprland.git")
|
||||
conflicts=("${_pkgname}-git" "${_pkgname}" "${_pkgname}-bin")
|
||||
sha256sums=('SKIP')
|
||||
options=(!makeflags !buildflags)
|
||||
|
||||
@@ -24,6 +62,7 @@ pkgver() {
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${_pkgname}"
|
||||
git submodule update --init
|
||||
make all
|
||||
}
|
||||
|
||||
|
@@ -1,32 +0,0 @@
|
||||
|
||||
# Contributing
|
||||
|
||||
*Thank you for considering contributing to Hyprland.*
|
||||
|
||||
## Development
|
||||
|
||||
Check the [Wiki] for debugging instructions.
|
||||
|
||||
Afterwards, pick yourself an [Issue] or implement your own suggestion.
|
||||
|
||||
An good place to search for things to contribute is the [Projects Page]
|
||||
|
||||
*As Hyprland is still in its early stages of development, I'd recommend you stick to bug fixes first.*
|
||||
|
||||
## Pull Requests
|
||||
|
||||
- Please follow the code style
|
||||
|
||||
- Code must be readable
|
||||
|
||||
- Features should be useful
|
||||
|
||||
- Test your changes!
|
||||
|
||||
*Run it on bare metal and check if everything works.*
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
|
||||
[Issue]: https://github.com/vaxerski/Hyprland/issues
|
||||
[Wiki]: https://github.com/vaxerski/Hyprland/wiki/Contributing-&-Debugging
|
||||
[Projects page]: https://github.com/vaxerski/Hyprland/projects?type=beta
|
56
docs/ISSUE_GUIDELINES.md
Normal file
56
docs/ISSUE_GUIDELINES.md
Normal file
@@ -0,0 +1,56 @@
|
||||
# Issue Guidelines
|
||||
|
||||
First of all, please remember to:
|
||||
- Check that your issue is not a duplicate
|
||||
- Read the [FAQ](https://github.com/vaxerski/Hyprland/wiki/FAQ)
|
||||
- Read the [Configuring Page](https://github.com/vaxerski/Hyprland/wiki/Configuring-Hyprland)
|
||||
|
||||
<br/>
|
||||
|
||||
# Reporting suggestions
|
||||
Suggestions are welcome.
|
||||
|
||||
Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://github.com/vaxerski/Hyprland/wiki/IPC). Please do not suggest features that can be implemented as such.
|
||||
|
||||
<br/>
|
||||
|
||||
# Reporting bugs
|
||||
|
||||
All bug reports should have the following:
|
||||
- Steps to reproduce
|
||||
- Expected outcome
|
||||
- Noted outcome
|
||||
|
||||
If your bug is one that doesn't crash Hyprland, but feels like invalid behavior, that's all you need to say.
|
||||
|
||||
If your bug crashes Hyprland, append additionally:
|
||||
- The Hyprland log
|
||||
- Coredump / Coredump analysis (with a stacktrace)
|
||||
|
||||
## Obtaining the Hyprland log
|
||||
If you are in a TTY, and the hyprland session that crashed was the last one you launched, the log will be printed with
|
||||
```
|
||||
cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 1)/hyprland.log
|
||||
```
|
||||
feel free to send it to a file, save, copy, etc.
|
||||
|
||||
if you are in a Hyprland session, and you want the log of the last session, use
|
||||
```
|
||||
cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 2 | tail -n 1)/hyprland.log
|
||||
```
|
||||
|
||||
basically, directories in /tmp/hypr are your sessions.
|
||||
|
||||
## Obtaining the Hyprland coredump
|
||||
If you are on systemd, you can simply use
|
||||
```
|
||||
coredumpctl
|
||||
```
|
||||
then go to the end (press END on your keyboard) and remember the PID of the last `Hyprland` occurrence. It's the first number after the time, for example `2891`.
|
||||
|
||||
exit coredumpctl (ctrl+c) and use
|
||||
```
|
||||
coredumpctl info [PID]
|
||||
```
|
||||
where `[PID]` is the PID you remembered.
|
||||
|
@@ -1,35 +0,0 @@
|
||||
|
||||
# Installation
|
||||
|
||||
## Packages
|
||||
|
||||
*I do not maintain any packages, but some kind people have made them for me.*
|
||||
|
||||
**If I missed any, please let me know.**
|
||||
|
||||
## Notice
|
||||
|
||||
Since I am not the maintainer, I cannot guarantee that those packages will always work and be up to date.
|
||||
|
||||
***Use at your own disclosure.*** <br>
|
||||
*If they don't work, try building manually.*
|
||||
|
||||
#### Arch ( AUR / -git )
|
||||
|
||||
```sh
|
||||
yay -S hyprland-git
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
|
||||
## Building / No XWayland / other
|
||||
|
||||
If your distro doesn't have **Hyprland** in its repositories, you want to modify it, or use custom build flags, please refer to the **[Wiki Page][Install]** for the installation instructions.
|
||||
|
||||
|
||||
<!----------------------------------------------------------------------------->
|
||||
|
||||
[Install]: https://github.com/vaxerski/Hyprland/wiki/Installation
|
||||
|
||||
|
12
flake.lock
generated
12
flake.lock
generated
@@ -2,11 +2,11 @@
|
||||
"nodes": {
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1653581809,
|
||||
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
|
||||
"lastModified": 1653931853,
|
||||
"narHash": "sha256-O3wncIouj9x7gBPntzHeK/Hkmm9M1SGlYq7JI7saTAE=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
|
||||
"rev": "f1c167688a6f81f4a51ab542e5f476c8c595e457",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -26,11 +26,11 @@
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"host": "gitlab.freedesktop.org",
|
||||
"lastModified": 1653733431,
|
||||
"narHash": "sha256-0JwNH2E9XlMVa7ZCsqxazpKwpZ2rW5QQjbk0DdZxa48=",
|
||||
"lastModified": 1653658290,
|
||||
"narHash": "sha256-zZaona39DOZNL93A1KG3zAi8vDttJBirxacq24hWCn4=",
|
||||
"owner": "wlroots",
|
||||
"repo": "wlroots",
|
||||
"rev": "93ee4c7684050807e959bb3b6d57826a72fba8c2",
|
||||
"rev": "75d31509db8c28e8379fe9570118ef8c82284581",
|
||||
"type": "gitlab"
|
||||
},
|
||||
"original": {
|
||||
|
@@ -33,18 +33,18 @@
|
||||
in {
|
||||
packages = genSystems (system: {
|
||||
wlroots = pkgsFor.${system}.wlroots.overrideAttrs (prev: {
|
||||
version = mkVersion inputs.wlroots.lastModifiedDate;
|
||||
version = mkVersion (toString (inputs.wlroots.lastModifiedDate or inputs.wlroots.lastModified or "19700101"));
|
||||
src = inputs.wlroots;
|
||||
});
|
||||
default = pkgsFor.${system}.callPackage ./default.nix {
|
||||
version = mkVersion self.lastModifiedDate;
|
||||
default = pkgsFor.${system}.callPackage ./nix/default.nix {
|
||||
version = mkVersion (toString (self.lastModifiedDate or self.lastModified or "19700101"));
|
||||
inherit (self.packages.${system}) wlroots;
|
||||
};
|
||||
});
|
||||
|
||||
formatter = genSystems (system: pkgsFor.${system}.alejandra);
|
||||
|
||||
nixosModules.default = import ./module.nix self;
|
||||
nixosModules.default = import ./nix/module.nix self;
|
||||
|
||||
# Deprecated
|
||||
overlays.default = _: prev: {
|
||||
|
@@ -23,6 +23,7 @@ usage: hyprctl [command] [(opt)args]
|
||||
clients
|
||||
activewindow
|
||||
layers
|
||||
devices
|
||||
dispatch
|
||||
keyword
|
||||
version
|
||||
@@ -44,12 +45,25 @@ void request(std::string arg) {
|
||||
return;
|
||||
}
|
||||
|
||||
// get the instance signature
|
||||
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
|
||||
|
||||
if (!instanceSig) {
|
||||
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
|
||||
return;
|
||||
}
|
||||
|
||||
std::string instanceSigStr = std::string(instanceSig);
|
||||
|
||||
sockaddr_un serverAddress = {0};
|
||||
serverAddress.sun_family = AF_UNIX;
|
||||
strcpy(serverAddress.sun_path, "/tmp/hypr/.socket.sock");
|
||||
|
||||
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
|
||||
|
||||
strcpy(serverAddress.sun_path, socketPath.c_str());
|
||||
|
||||
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
||||
std::cout << "Couldn't connect to /tmp/hypr/.socket.sock. (3) Is Hyprland running?";
|
||||
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -117,6 +131,7 @@ int main(int argc, char** argv) {
|
||||
else if (!strcmp(argv[1], "activewindow")) request("activewindow");
|
||||
else if (!strcmp(argv[1], "layers")) request("layers");
|
||||
else if (!strcmp(argv[1], "version")) request("version");
|
||||
else if (!strcmp(argv[1], "devices")) request("devices");
|
||||
else if (!strcmp(argv[1], "reload")) request("reload");
|
||||
else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
|
||||
else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv);
|
||||
|
@@ -24,7 +24,7 @@
|
||||
stdenv.mkDerivation {
|
||||
pname = "hyprland";
|
||||
inherit version;
|
||||
src = ./.;
|
||||
src = ../.;
|
||||
|
||||
nativeBuildInputs = [
|
||||
cmake
|
||||
@@ -52,8 +52,12 @@ stdenv.mkDerivation {
|
||||
["-DCMAKE_BUILD_TYPE=Release"]
|
||||
++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";
|
||||
|
||||
# enables building with nix-supplied wlroots instead of submodule
|
||||
prePatch = ''
|
||||
make config
|
||||
sed -Ei 's/"\.\.\/wlroots\/include\/([a-zA-Z0-9./_-]+)"/<\1>/g' src/includes.hpp
|
||||
'';
|
||||
postPatch = ''
|
||||
make protocols
|
||||
'';
|
||||
|
||||
postBuild = ''
|
19
nix/update-inputs.sh
Executable file
19
nix/update-inputs.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#moreutils nixpkgs#jq -c bash
|
||||
|
||||
# get wlroots revision from submodule
|
||||
SUB_REV=$(git submodule status | awk '{ print substr($1,2)}')
|
||||
# and from lockfile
|
||||
CRT_REV=$(jq < flake.lock '.nodes.wlroots.locked.rev' -r)
|
||||
|
||||
if [ $SUB_REV != $CRT_REV ]; then
|
||||
# update nixpkgs to latest version
|
||||
nix flake lock --update-input nixpkgs
|
||||
|
||||
# update wlroots to submodule revision
|
||||
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
|
||||
|
||||
# remove "dirty" mark from lockfile
|
||||
jq < flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
|
||||
else
|
||||
echo "wlroots is up to date!"
|
||||
fi
|
@@ -1,11 +1,16 @@
|
||||
#include "Compositor.hpp"
|
||||
|
||||
CCompositor::CCompositor() {
|
||||
unlink("/tmp/hypr/hyprland.log");
|
||||
unlink("/tmp/hypr/hyprlandd.log");
|
||||
unlink("/tmp/hypr/.hyprlandrq");
|
||||
m_szInstanceSignature = GIT_COMMIT_HASH + std::string("_") + std::to_string(time(NULL));
|
||||
|
||||
system("mkdir -p /tmp/hypr");
|
||||
Debug::init(m_szInstanceSignature);
|
||||
|
||||
Debug::log(LOG, "Instance Signature: %s", m_szInstanceSignature.c_str());
|
||||
|
||||
setenv("HYPRLAND_INSTANCE_SIGNATURE", m_szInstanceSignature.c_str(), true);
|
||||
|
||||
const auto INSTANCEPATH = "/tmp/hypr/" + m_szInstanceSignature;
|
||||
mkdir(INSTANCEPATH.c_str(), S_IRWXU | S_IRWXG);
|
||||
|
||||
m_sWLDisplay = wl_display_create();
|
||||
|
||||
@@ -137,6 +142,7 @@ void CCompositor::initAllSignals() {
|
||||
addWLSignal(&m_sWLRPointerConstraints->events.new_constraint, &Events::listen_newConstraint, m_sWLRPointerConstraints, "PointerConstraints");
|
||||
addWLSignal(&m_sWLRXDGDecoMgr->events.new_toplevel_decoration, &Events::listen_NewXDGDeco, m_sWLRXDGDecoMgr, "XDGDecoMgr");
|
||||
addWLSignal(&m_sWLRVirtPtrMgr->events.new_virtual_pointer, &Events::listen_newVirtPtr, m_sWLRVirtPtrMgr, "VirtPtrMgr");
|
||||
addWLSignal(&m_sWLRRenderer->events.destroy, &Events::listen_RendererDestroy, m_sWLRRenderer, "WLRRenderer");
|
||||
|
||||
signal(SIGINT, handleCritSignal);
|
||||
signal(SIGTERM, handleCritSignal);
|
||||
|
@@ -63,6 +63,7 @@ public:
|
||||
|
||||
|
||||
const char* m_szWLDisplaySocket;
|
||||
std::string m_szInstanceSignature = "";
|
||||
|
||||
std::list<SMonitor> m_lMonitors;
|
||||
std::list<CWindow> m_lWindows;
|
||||
|
@@ -45,12 +45,14 @@ void CConfigManager::setDefaultVars() {
|
||||
configValues["decoration:active_opacity"].floatValue = 1;
|
||||
configValues["decoration:inactive_opacity"].floatValue = 1;
|
||||
configValues["decoration:fullscreen_opacity"].floatValue = 1;
|
||||
configValues["decoration:multisample_edges"].intValue = 0;
|
||||
|
||||
configValues["dwindle:pseudotile"].intValue = 0;
|
||||
configValues["dwindle:col.group_border"].intValue = 0x66777700;
|
||||
configValues["dwindle:col.group_border_active"].intValue = 0x66ffff00;
|
||||
configValues["dwindle:force_split"].intValue = 0;
|
||||
configValues["dwindle:preserve_split"].intValue = 0;
|
||||
configValues["dwindle:special_scale_factor"].floatValue = 0.8f;
|
||||
|
||||
configValues["animations:enabled"].intValue = 1;
|
||||
configValues["animations:speed"].floatValue = 7.f;
|
||||
@@ -80,6 +82,8 @@ void CConfigManager::setDefaultVars() {
|
||||
configValues["input:repeat_rate"].intValue = 25;
|
||||
configValues["input:repeat_delay"].intValue = 600;
|
||||
configValues["input:natural_scroll"].intValue = 0;
|
||||
configValues["input:numlock_by_default"].intValue = 0;
|
||||
configValues["input:force_no_accel"].intValue = 0;
|
||||
configValues["input:touchpad:disable_while_typing"].intValue = 1;
|
||||
|
||||
configValues["input:follow_mouse"].intValue = 1;
|
||||
|
@@ -26,8 +26,9 @@ std::string monitorsRequest() {
|
||||
std::string clientsRequest() {
|
||||
std::string result = "";
|
||||
for (auto& w : g_pCompositor->m_lWindows) {
|
||||
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\n",
|
||||
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str()), (int)w.m_bIsFloating, w.m_iMonitorID);
|
||||
if (w.m_bIsMapped)
|
||||
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\n",
|
||||
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str() : std::string("Invalid workspace " + std::to_string(w.m_iWorkspaceID)).c_str()), (int)w.m_bIsFloating, w.m_iMonitorID, g_pXWaylandManager->getAppIDClass(&w).c_str());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -47,8 +48,8 @@ std::string activeWindowRequest() {
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return "Invalid";
|
||||
|
||||
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\n",
|
||||
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating, (int)PWINDOW->m_iMonitorID);
|
||||
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\n",
|
||||
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating, (int)PWINDOW->m_iMonitorID, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
|
||||
}
|
||||
|
||||
std::string layersRequest() {
|
||||
@@ -72,6 +73,24 @@ std::string layersRequest() {
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string devicesRequest() {
|
||||
std::string result = "";
|
||||
|
||||
result += "mice:\n";
|
||||
|
||||
for (auto& m : g_pInputManager->m_lMice) {
|
||||
result += getFormat("\tMouse at %x:\n\t\t%s\n", &m, m.mouse->name);
|
||||
}
|
||||
|
||||
result += "\n\nKeyboards:\n";
|
||||
|
||||
for (auto& k : g_pInputManager->m_lKeyboards) {
|
||||
result += getFormat("\tKeyboard at %x:\n\t\t%s\n", &k, k.keyboard->name);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
std::string versionRequest() {
|
||||
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" + GIT_COMMIT_MESSAGE + ").\nflags: (if any)\n";
|
||||
|
||||
@@ -186,6 +205,8 @@ std::string getReply(std::string request) {
|
||||
return versionRequest();
|
||||
else if (request == "reload")
|
||||
return reloadRequest();
|
||||
else if (request == "devices")
|
||||
return devicesRequest();
|
||||
else if (request.find("dispatch") == 0)
|
||||
return dispatchRequest(request);
|
||||
else if (request.find("keyword") == 0)
|
||||
@@ -246,11 +267,11 @@ void HyprCtl::startHyprCtlSocket() {
|
||||
return;
|
||||
}
|
||||
|
||||
unlink("/tmp/hypr/.socket.sock");
|
||||
|
||||
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
|
||||
|
||||
strcpy(SERVERADDRESS.sun_path, "/tmp/hypr/.socket.sock");
|
||||
std::string socketPath = "/tmp/hypr/" + g_pCompositor->m_szInstanceSignature + "/.socket.sock";
|
||||
|
||||
strcpy(SERVERADDRESS.sun_path, socketPath.c_str());
|
||||
|
||||
bind(SOCKET, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
|
||||
|
||||
@@ -262,7 +283,7 @@ void HyprCtl::startHyprCtlSocket() {
|
||||
|
||||
char readBuffer[1024] = {0};
|
||||
|
||||
Debug::log(LOG, "Hypr socket started.");
|
||||
Debug::log(LOG, "Hypr socket started at %s", socketPath.c_str());
|
||||
|
||||
while(1) {
|
||||
const auto ACCEPTEDCONNECTION = accept(SOCKET, (sockaddr*)&clientAddress, &clientSize);
|
||||
|
@@ -1,15 +1,22 @@
|
||||
#include "Log.hpp"
|
||||
#include "../defines.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
|
||||
void Debug::init(std::string IS) {
|
||||
if (ISDEBUG)
|
||||
logFile = "/tmp/hypr/" + IS + "/hyprlandd.log";
|
||||
else
|
||||
logFile = "/tmp/hypr/" + IS + "/hyprland.log";
|
||||
}
|
||||
|
||||
void Debug::log(LogLevel level, const char* fmt, ...) {
|
||||
|
||||
// log to a file
|
||||
const std::string DEBUGPATH = ISDEBUG ? "/tmp/hypr/hyprlandd.log" : "/tmp/hypr/hyprland.log";
|
||||
std::ofstream ofs;
|
||||
ofs.open(DEBUGPATH, std::ios::out | std::ios::app);
|
||||
ofs.open(logFile, std::ios::out | std::ios::app);
|
||||
|
||||
switch (level) {
|
||||
case LOG:
|
||||
|
@@ -12,5 +12,8 @@ enum LogLevel {
|
||||
};
|
||||
|
||||
namespace Debug {
|
||||
void init(std::string IS);
|
||||
void log(LogLevel level, const char* fmt, ...);
|
||||
|
||||
inline std::string logFile;
|
||||
};
|
@@ -109,4 +109,7 @@ namespace Events {
|
||||
|
||||
// Deco XDG
|
||||
LISTENER(NewXDGDeco);
|
||||
|
||||
// Renderer destroy
|
||||
LISTENER(RendererDestroy);
|
||||
};
|
@@ -160,6 +160,12 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
|
||||
|
||||
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
geomFixed = {layersurface->geometry.x + (int)PMONITOR->vecPosition.x, layersurface->geometry.y + (int)PMONITOR->vecPosition.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
|
||||
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
|
||||
}
|
||||
|
||||
void Events::listener_commitLayerSurface(void* owner, void* data) {
|
||||
|
@@ -153,4 +153,8 @@ void Events::listener_InhibitDeactivate(wl_listener* listener, void* data) {
|
||||
|
||||
g_pCompositor->m_sSeat.exclusiveClient = nullptr;
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
|
||||
void Events::listener_RendererDestroy(wl_listener* listener, void* data) {
|
||||
Debug::log(LOG, "!!Renderer destroyed!!");
|
||||
}
|
@@ -65,6 +65,10 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
|
||||
if (monitorRule.disabled) {
|
||||
wlr_output_enable(OUTPUT, 0);
|
||||
wlr_output_commit(OUTPUT);
|
||||
|
||||
if (const auto PMONITOR = g_pCompositor->getMonitorFromName(std::string(OUTPUT->name)); PMONITOR) {
|
||||
listener_monitorDestroy(nullptr, PMONITOR->output);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -176,9 +180,14 @@ void Events::listener_monitorFrame(void* owner, void* data) {
|
||||
g_pConfigManager->performMonitorReload();
|
||||
}
|
||||
|
||||
if (PMONITOR->needsFrameSkip) {
|
||||
PMONITOR->needsFrameSkip = false;
|
||||
wlr_output_schedule_frame(PMONITOR->output);
|
||||
if (PMONITOR->framesToSkip > 0) {
|
||||
PMONITOR->framesToSkip -= 1;
|
||||
|
||||
if (!PMONITOR->noFrameSchedule)
|
||||
wlr_output_schedule_frame(PMONITOR->output);
|
||||
else {
|
||||
Debug::log(LOG, "NoFrameSchedule hit for %s.", PMONITOR->szName.c_str());
|
||||
}
|
||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
|
||||
return;
|
||||
}
|
||||
|
@@ -35,6 +35,9 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
|
||||
PWINDOW->m_fAlpha = 255.f;
|
||||
|
||||
// Set all windows tiled regardless of anything
|
||||
g_pXWaylandManager->setWindowStyleTiled(PWINDOW, WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM);
|
||||
|
||||
// Foreign Toplevel
|
||||
PWINDOW->m_phForeignToplevel = wlr_foreign_toplevel_handle_v1_create(g_pCompositor->m_sWLRToplevelMgr);
|
||||
// TODO: handle foreign events (requests)
|
||||
@@ -73,16 +76,23 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
|
||||
// window rules
|
||||
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(PWINDOW);
|
||||
std::string requestedWorkspace = "";
|
||||
bool workspaceSilent = false;
|
||||
|
||||
for (auto& r : WINDOWRULES) {
|
||||
if (r.szRule.find("monitor") == 0) {
|
||||
try {
|
||||
const long int MONITOR = std::stoi(r.szRule.substr(r.szRule.find(" ")));
|
||||
const auto MONITORSTR = r.szRule.substr(r.szRule.find(" "));
|
||||
|
||||
if (MONITOR >= (long int)g_pCompositor->m_lMonitors.size() || MONITOR < (long int)0)
|
||||
PWINDOW->m_iMonitorID = 0;
|
||||
else
|
||||
PWINDOW->m_iMonitorID = MONITOR;
|
||||
if (MONITORSTR == "unset") {
|
||||
PWINDOW->m_iMonitorID = PMONITOR->ID;
|
||||
} else {
|
||||
const long int MONITOR = std::stoi(MONITORSTR);
|
||||
if (MONITOR >= (long int)g_pCompositor->m_lMonitors.size() || MONITOR < (long int)0)
|
||||
PWINDOW->m_iMonitorID = 0;
|
||||
else
|
||||
PWINDOW->m_iMonitorID = MONITOR;
|
||||
}
|
||||
|
||||
PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace;
|
||||
|
||||
@@ -91,11 +101,14 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
Debug::log(ERR, "Rule monitor failed, rule: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what());
|
||||
}
|
||||
} else if (r.szRule.find("workspace") == 0) {
|
||||
// switch to workspace
|
||||
g_pKeybindManager->m_mDispatchers["workspace"](r.szRule.substr(r.szRule.find_first_of(' ') + 1));
|
||||
// check if it isnt unset
|
||||
const auto WORKSPACERQ = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
|
||||
|
||||
PWINDOW->m_iMonitorID = g_pCompositor->m_pLastMonitor->ID;
|
||||
PWINDOW->m_iWorkspaceID = g_pCompositor->m_pLastMonitor->activeWorkspace;
|
||||
if (WORKSPACERQ == "unset") {
|
||||
requestedWorkspace = "";
|
||||
} else {
|
||||
requestedWorkspace = WORKSPACERQ;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Rule workspace matched by window %x, %s applied.", PWINDOW, r.szValue.c_str());
|
||||
} else if (r.szRule.find("float") == 0) {
|
||||
@@ -132,6 +145,25 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
}
|
||||
}
|
||||
|
||||
if (requestedWorkspace != "") {
|
||||
// process requested workspace
|
||||
if (requestedWorkspace.find_first_of(' ') != std::string::npos) {
|
||||
// check for silent
|
||||
if (requestedWorkspace.find("silent") != std::string::npos) {
|
||||
workspaceSilent = true;
|
||||
}
|
||||
|
||||
requestedWorkspace = requestedWorkspace.substr(0, requestedWorkspace.find_first_of(' '));
|
||||
}
|
||||
|
||||
if (!workspaceSilent) {
|
||||
g_pKeybindManager->m_mDispatchers["workspace"](requestedWorkspace);
|
||||
|
||||
PWINDOW->m_iMonitorID = g_pCompositor->m_pLastMonitor->ID;
|
||||
PWINDOW->m_iWorkspaceID = g_pCompositor->m_pLastMonitor->activeWorkspace;
|
||||
}
|
||||
}
|
||||
|
||||
if (PWINDOW->m_bIsFloating) {
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(PWINDOW);
|
||||
PWINDOW->m_bCreatedOverFullscreen = true;
|
||||
@@ -205,6 +237,15 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
||||
// do the animation thing
|
||||
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false);
|
||||
|
||||
if (workspaceSilent) {
|
||||
// move the window
|
||||
if (g_pCompositor->m_pLastWindow == PWINDOW) {
|
||||
g_pKeybindManager->m_mDispatchers["movetoworkspacesilent"](requestedWorkspace);
|
||||
} else {
|
||||
Debug::log(ERR, "Tried to set workspace silent rule to a nofocus window!");
|
||||
}
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
|
||||
}
|
||||
|
||||
|
@@ -46,16 +46,35 @@ void wlr_signal_emit_safe(struct wl_signal *signal, void *data) {
|
||||
}
|
||||
|
||||
std::string getFormat(const char *fmt, ...) {
|
||||
char buf[2048] = "";
|
||||
char buf[LOGMESSAGESIZE] = "";
|
||||
char* outputStr;
|
||||
int logLen;
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
|
||||
vsprintf(buf, fmt, args);
|
||||
|
||||
logLen = vsnprintf(buf, sizeof buf, fmt, args);
|
||||
va_end(args);
|
||||
|
||||
return std::string(buf);
|
||||
if ((long unsigned int)logLen < sizeof buf) {
|
||||
outputStr = strdup(buf);
|
||||
} else {
|
||||
outputStr = (char*)malloc(logLen + 1);
|
||||
|
||||
if (!outputStr) {
|
||||
printf("CRITICAL: Cannot alloc size %d for log! (Out of memory?)", logLen + 1);
|
||||
return "";
|
||||
}
|
||||
|
||||
va_start(args, fmt);
|
||||
vsnprintf(outputStr, logLen + 1U, fmt, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
std::string output = std::string(outputStr);
|
||||
|
||||
free(outputStr);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
void scaleBox(wlr_box* box, float scale) {
|
||||
@@ -116,7 +135,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
|
||||
}
|
||||
|
||||
bool isNumber(const std::string& str) {
|
||||
return std::ranges::all_of(str.begin(), str.end(), [](char c) { return isdigit(c) != 0; });
|
||||
return std::ranges::all_of(str.begin(), str.end(), [](char c) { return isdigit(c) != 0 || c == '-'; });
|
||||
}
|
||||
|
||||
bool isDirection(const std::string& arg) {
|
||||
@@ -172,7 +191,7 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
|
||||
searchID = lowestID;
|
||||
}
|
||||
|
||||
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE) {
|
||||
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE && PWORKSPACE->m_iID != SPECIAL_WORKSPACE_ID) {
|
||||
if (PWORKSPACE->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID) {
|
||||
currentID = PWORKSPACE->m_iID;
|
||||
|
||||
|
@@ -27,7 +27,8 @@ struct SMonitor {
|
||||
wlr_output* output = nullptr;
|
||||
float refreshRate = 60;
|
||||
wlr_output_damage* damage = nullptr;
|
||||
bool needsFrameSkip = false;
|
||||
int framesToSkip = 0;
|
||||
bool noFrameSchedule = false;
|
||||
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||
|
||||
// for the special workspace
|
||||
|
@@ -89,6 +89,20 @@ void SubsurfaceTree::destroySurfaceTree(SSurfaceTreeNode* pNode) {
|
||||
pNode->hyprListener_destroy.removeCallback();
|
||||
pNode->hyprListener_newSubsurface.removeCallback();
|
||||
|
||||
// damage
|
||||
if (pNode->pSurface) {
|
||||
wlr_box extents = {};
|
||||
wlr_surface_get_extends(pNode->pSurface, &extents);
|
||||
|
||||
int lx = 0, ly = 0;
|
||||
addSurfaceGlobalOffset(pNode, &lx, &ly);
|
||||
|
||||
extents.x += lx;
|
||||
extents.y += ly;
|
||||
|
||||
g_pHyprRenderer->damageBox(&extents);
|
||||
}
|
||||
|
||||
surfaceTreeNodes.remove(*pNode);
|
||||
|
||||
Debug::log(LOG, "SurfaceTree Node removed");
|
||||
@@ -162,6 +176,8 @@ void Events::listener_unmapSubsurface(void* owner, void* data) {
|
||||
extents.x += lx;
|
||||
extents.y += ly;
|
||||
|
||||
g_pHyprRenderer->damageBox(&extents);
|
||||
|
||||
SubsurfaceTree::destroySurfaceTree(subsurface->pChild);
|
||||
subsurface->pChild = nullptr;
|
||||
}
|
||||
|
@@ -69,6 +69,8 @@ struct SKeyboard {
|
||||
DYNLISTENER(keyboardKey);
|
||||
DYNLISTENER(keyboardDestroy);
|
||||
|
||||
bool active = false;
|
||||
|
||||
// For the list lookup
|
||||
bool operator==(const SKeyboard& rhs) {
|
||||
return keyboard == rhs.keyboard;
|
||||
|
@@ -57,7 +57,7 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||
m_fAlpha.setValueAndWarp(255.f);
|
||||
m_fAlpha = 0.f;
|
||||
}
|
||||
} else if ("slidevert") {
|
||||
} else if (ANIMSTYLE == "slidevert") {
|
||||
// fallback is slide
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||
|
||||
|
@@ -164,10 +164,12 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode) {
|
||||
|
||||
if (PWORKSPACE->m_bIsSpecialWorkspace) {
|
||||
// if special, we adjust the coords a bit
|
||||
PWINDOW->m_vRealPosition = calcPos + (calcSize - calcSize * 0.8f) / 2.f;
|
||||
PWINDOW->m_vRealSize = calcSize * 0.8f;
|
||||
static auto *const PSCALEFACTOR = &g_pConfigManager->getConfigValuePtr("dwindle:special_scale_factor")->floatValue;
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize * 0.8f);
|
||||
PWINDOW->m_vRealPosition = calcPos + (calcSize - calcSize * *PSCALEFACTOR) / 2.f;
|
||||
PWINDOW->m_vRealSize = calcSize * *PSCALEFACTOR;
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, calcSize * *PSCALEFACTOR);
|
||||
} else {
|
||||
PWINDOW->m_vRealSize = calcSize;
|
||||
PWINDOW->m_vRealPosition = calcPos;
|
||||
@@ -452,6 +454,13 @@ void CHyprDwindleLayout::onBeginDragWindow() {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(DRAGGINGWINDOW->m_iWorkspaceID);
|
||||
|
||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||
Debug::log(LOG, "Rejecting drag on a fullscreen workspace.");
|
||||
return;
|
||||
}
|
||||
|
||||
DRAGGINGWINDOW->m_bDraggingTiled = false;
|
||||
|
||||
if (!DRAGGINGWINDOW->m_bIsFloating) {
|
||||
@@ -508,80 +517,7 @@ void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) {
|
||||
|
||||
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv());
|
||||
} else {
|
||||
// we need to adjust the splitratio
|
||||
|
||||
// get some data about our window
|
||||
const auto PNODE = getNodeFromWindow(DRAGGINGWINDOW);
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(DRAGGINGWINDOW->m_iMonitorID);
|
||||
const bool DISPLAYLEFT = STICKS(DRAGGINGWINDOW->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x);
|
||||
const bool DISPLAYRIGHT = STICKS(DRAGGINGWINDOW->m_vPosition.x + DRAGGINGWINDOW->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x);
|
||||
const bool DISPLAYTOP = STICKS(DRAGGINGWINDOW->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
||||
const bool DISPLAYBOTTOM = STICKS(DRAGGINGWINDOW->m_vPosition.y + DRAGGINGWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
||||
|
||||
// construct allowed movement
|
||||
Vector2D allowedMovement = TICKDELTA;
|
||||
if (DISPLAYLEFT && DISPLAYRIGHT)
|
||||
allowedMovement.x = 0;
|
||||
|
||||
if (DISPLAYBOTTOM && DISPLAYTOP)
|
||||
allowedMovement.y = 0;
|
||||
|
||||
// get the correct containers to apply splitratio to
|
||||
const auto PPARENT = PNODE->pParent;
|
||||
|
||||
if (!PPARENT)
|
||||
return; // the only window on a workspace, ignore
|
||||
|
||||
const bool PARENTSIDEBYSIDE = !PPARENT->splitTop;
|
||||
|
||||
// Get the parent's parent
|
||||
auto PPARENT2 = PPARENT->pParent;
|
||||
|
||||
// No parent means we have only 2 windows, and thus one axis of freedom
|
||||
if (!PPARENT2) {
|
||||
if (PARENTSIDEBYSIDE) {
|
||||
allowedMovement.x *= 2.f / PPARENT->size.x;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
} else {
|
||||
allowedMovement.y *= 2.f / PPARENT->size.y;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get first parent with other split
|
||||
while(PPARENT2 && PPARENT2->splitTop == !PARENTSIDEBYSIDE)
|
||||
PPARENT2 = PPARENT2->pParent;
|
||||
|
||||
// no parent, one axis of freedom
|
||||
if (!PPARENT2) {
|
||||
if (PARENTSIDEBYSIDE) {
|
||||
allowedMovement.x *= 2.f / PPARENT->size.x;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
} else {
|
||||
allowedMovement.y *= 2.f / PPARENT->size.y;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 2 axes of freedom
|
||||
const auto SIDECONTAINER = PARENTSIDEBYSIDE ? PPARENT : PPARENT2;
|
||||
const auto TOPCONTAINER = PARENTSIDEBYSIDE ? PPARENT2 : PPARENT;
|
||||
|
||||
allowedMovement.x *= 2.f / SIDECONTAINER->size.x;
|
||||
allowedMovement.y *= 2.f / TOPCONTAINER->size.y;
|
||||
|
||||
SIDECONTAINER->splitRatio = std::clamp(SIDECONTAINER->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||
TOPCONTAINER->splitRatio = std::clamp(TOPCONTAINER->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||
SIDECONTAINER->recalcSizePosRecursive();
|
||||
TOPCONTAINER->recalcSizePosRecursive();
|
||||
resizeActiveWindow(TICKDELTA, DRAGGINGWINDOW);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -599,6 +535,97 @@ void CHyprDwindleLayout::onMouseMove(const Vector2D& mousePos) {
|
||||
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
|
||||
}
|
||||
|
||||
void CHyprDwindleLayout::resizeActiveWindow(const Vector2D& pixResize, CWindow* pWindow) {
|
||||
|
||||
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
|
||||
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
const auto PNODE = getNodeFromWindow(PWINDOW);
|
||||
|
||||
if (!PNODE) {
|
||||
PWINDOW->m_vRealSize.setValueAndWarp(PWINDOW->m_vRealSize.goalv() + pixResize);
|
||||
PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(std::clamp(PWINDOW->m_vRealSize.vec().x, (double)20, (double)999999), std::clamp(PWINDOW->m_vRealSize.vec().y, (double)20, (double)999999)));
|
||||
|
||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// get some data about our window
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
|
||||
const bool DISPLAYLEFT = STICKS(PWINDOW->m_vPosition.x, PMONITOR->vecPosition.x + PMONITOR->vecReservedTopLeft.x);
|
||||
const bool DISPLAYRIGHT = STICKS(PWINDOW->m_vPosition.x + PWINDOW->m_vSize.x, PMONITOR->vecPosition.x + PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x);
|
||||
const bool DISPLAYTOP = STICKS(PWINDOW->m_vPosition.y, PMONITOR->vecPosition.y + PMONITOR->vecReservedTopLeft.y);
|
||||
const bool DISPLAYBOTTOM = STICKS(PWINDOW->m_vPosition.y + PWINDOW->m_vSize.y, PMONITOR->vecPosition.y + PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y);
|
||||
|
||||
// construct allowed movement
|
||||
Vector2D allowedMovement = pixResize;
|
||||
if (DISPLAYLEFT && DISPLAYRIGHT)
|
||||
allowedMovement.x = 0;
|
||||
|
||||
if (DISPLAYBOTTOM && DISPLAYTOP)
|
||||
allowedMovement.y = 0;
|
||||
|
||||
// get the correct containers to apply splitratio to
|
||||
const auto PPARENT = PNODE->pParent;
|
||||
|
||||
if (!PPARENT)
|
||||
return; // the only window on a workspace, ignore
|
||||
|
||||
const bool PARENTSIDEBYSIDE = !PPARENT->splitTop;
|
||||
|
||||
// Get the parent's parent
|
||||
auto PPARENT2 = PPARENT->pParent;
|
||||
|
||||
// No parent means we have only 2 windows, and thus one axis of freedom
|
||||
if (!PPARENT2) {
|
||||
if (PARENTSIDEBYSIDE) {
|
||||
allowedMovement.x *= 2.f / PPARENT->size.x;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
} else {
|
||||
allowedMovement.y *= 2.f / PPARENT->size.y;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Get first parent with other split
|
||||
while (PPARENT2 && PPARENT2->splitTop == !PARENTSIDEBYSIDE)
|
||||
PPARENT2 = PPARENT2->pParent;
|
||||
|
||||
// no parent, one axis of freedom
|
||||
if (!PPARENT2) {
|
||||
if (PARENTSIDEBYSIDE) {
|
||||
allowedMovement.x *= 2.f / PPARENT->size.x;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
} else {
|
||||
allowedMovement.y *= 2.f / PPARENT->size.y;
|
||||
PPARENT->splitRatio = std::clamp(PPARENT->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||
PPARENT->recalcSizePosRecursive();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 2 axes of freedom
|
||||
const auto SIDECONTAINER = PARENTSIDEBYSIDE ? PPARENT : PPARENT2;
|
||||
const auto TOPCONTAINER = PARENTSIDEBYSIDE ? PPARENT2 : PPARENT;
|
||||
|
||||
allowedMovement.x *= 2.f / SIDECONTAINER->size.x;
|
||||
allowedMovement.y *= 2.f / TOPCONTAINER->size.y;
|
||||
|
||||
SIDECONTAINER->splitRatio = std::clamp(SIDECONTAINER->splitRatio + allowedMovement.x, (double)0.1f, (double)1.9f);
|
||||
TOPCONTAINER->splitRatio = std::clamp(TOPCONTAINER->splitRatio + allowedMovement.y, (double)0.1f, (double)1.9f);
|
||||
SIDECONTAINER->recalcSizePosRecursive();
|
||||
TOPCONTAINER->recalcSizePosRecursive();
|
||||
}
|
||||
|
||||
void CHyprDwindleLayout::onWindowCreatedFloating(CWindow* pWindow) {
|
||||
wlr_box desiredGeometry = {0};
|
||||
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
|
||||
|
@@ -48,6 +48,7 @@ public:
|
||||
virtual void recalculateWindow(CWindow*);
|
||||
virtual void changeWindowFloatingMode(CWindow*);
|
||||
virtual void onBeginDragWindow();
|
||||
virtual void resizeActiveWindow(const Vector2D&, CWindow* pWindow = nullptr);
|
||||
virtual void onEndDragWindow();
|
||||
virtual void onMouseMove(const Vector2D&);
|
||||
virtual void onWindowCreatedFloating(CWindow*);
|
||||
|
@@ -49,6 +49,12 @@ public:
|
||||
as.
|
||||
*/
|
||||
virtual void onBeginDragWindow() = 0;
|
||||
/*
|
||||
Called when a user requests a resize of the current window by a vec
|
||||
Vector2D holds pixel values
|
||||
Optional pWindow for a specific window
|
||||
*/
|
||||
virtual void resizeActiveWindow(const Vector2D&, CWindow* pWindow = nullptr) = 0;
|
||||
/*
|
||||
Called when a window is ended being dragged
|
||||
(mouse up)
|
||||
|
11
src/main.cpp
11
src/main.cpp
@@ -3,6 +3,7 @@
|
||||
#include "Compositor.hpp"
|
||||
#include "config/ConfigManager.hpp"
|
||||
#include "init/initHelpers.hpp"
|
||||
#include <iostream>
|
||||
|
||||
// I am a bad bad boy and have used some global vars here,
|
||||
// just for this file
|
||||
@@ -19,17 +20,19 @@ int main(int argc, char** argv) {
|
||||
ignoreSudo = true;
|
||||
}
|
||||
|
||||
system("mkdir -p /tmp/hypr");
|
||||
|
||||
if (!ignoreSudo) {
|
||||
if (Init::isSudo()) {
|
||||
Debug::log(CRIT, "Hyprland shall not be run as the root user. If you really want to, use the --i-am-really-stupid flag.");
|
||||
return 1;
|
||||
std::cout << "Hyprland shall not be run as the root user. If you really want to, use the --i-am-really-stupid flag.\n";
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
Debug::log(WARN, "Running with ignored root checks, I surely hope you know what you're doing.");
|
||||
std::cout << "Running with ignored root checks, I surely hope you know what you're doing.\n";
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Welcome to Hyprland!");
|
||||
std::cout << "Welcome to Hyprland!\n";
|
||||
|
||||
// let's init the compositor.
|
||||
// it initializes basic Wayland stuff in the constructor.
|
||||
|
@@ -1,4 +1,5 @@
|
||||
#include "EventManager.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
@@ -26,10 +27,9 @@ void CEventManager::startThread() {
|
||||
return;
|
||||
}
|
||||
|
||||
unlink("/tmp/hypr/.socket2.sock");
|
||||
|
||||
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
|
||||
strcpy(SERVERADDRESS.sun_path, "/tmp/hypr/.socket2.sock");
|
||||
std::string socketPath = "/tmp/hypr/" + g_pCompositor->m_szInstanceSignature + "/.socket2.sock";
|
||||
strcpy(SERVERADDRESS.sun_path, socketPath.c_str());
|
||||
|
||||
bind(SOCKET, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
|
||||
|
||||
@@ -41,7 +41,7 @@ void CEventManager::startThread() {
|
||||
sockaddr_in clientAddress;
|
||||
socklen_t clientSize = sizeof(clientAddress);
|
||||
|
||||
Debug::log(LOG, "Hypr socket 2 started.");
|
||||
Debug::log(LOG, "Hypr socket 2 started at %s", socketPath.c_str());
|
||||
|
||||
// set the socket nonblock
|
||||
int flags = fcntl(SOCKET, F_GETFL, 0);
|
||||
|
@@ -5,12 +5,14 @@ void CInputManager::onMouseMoved(wlr_pointer_motion_event* e) {
|
||||
|
||||
float sensitivity = g_pConfigManager->getFloat("general:sensitivity");
|
||||
|
||||
if (g_pConfigManager->getInt("general:apply_sens_to_raw") == 1)
|
||||
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, e->delta_x * sensitivity, e->delta_y * sensitivity, e->unaccel_dx * sensitivity, e->unaccel_dy * sensitivity);
|
||||
else
|
||||
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, e->delta_x, e->delta_y, e->unaccel_dx, e->unaccel_dy);
|
||||
const auto DELTA = g_pConfigManager->getInt("input:force_no_accel") == 1 ? Vector2D(e->unaccel_dx, e->unaccel_dy) : Vector2D(e->delta_x, e->delta_y);
|
||||
|
||||
wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, e->delta_x * sensitivity, e->delta_y * sensitivity);
|
||||
if (g_pConfigManager->getInt("general:apply_sens_to_raw") == 1)
|
||||
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x * sensitivity, DELTA.y * sensitivity, e->unaccel_dx * sensitivity, e->unaccel_dy * sensitivity);
|
||||
else
|
||||
wlr_relative_pointer_manager_v1_send_relative_motion(g_pCompositor->m_sWLRRelPointerMgr, g_pCompositor->m_sSeat.seat, (uint64_t)e->time_msec * 1000, DELTA.x, DELTA.y, e->unaccel_dx, e->unaccel_dy);
|
||||
|
||||
wlr_cursor_move(g_pCompositor->m_sWLRCursor, &e->pointer->base, DELTA.x * sensitivity, DELTA.y * sensitivity);
|
||||
|
||||
mouseMoveUnified(e->time_msec);
|
||||
}
|
||||
@@ -236,28 +238,24 @@ void CInputManager::newKeyboard(wlr_input_device* keyboard) {
|
||||
|
||||
PNEWKEYBOARD->keyboard = keyboard;
|
||||
|
||||
xkb_rule_names rules;
|
||||
|
||||
const auto CONTEXT = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
const auto KEYMAP = xkb_keymap_new_from_names(CONTEXT, &rules, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
|
||||
const auto REPEATRATE = g_pConfigManager->getInt("input:repeat_rate");
|
||||
const auto REPEATDELAY = g_pConfigManager->getInt("input:repeat_delay");
|
||||
|
||||
wlr_keyboard_set_keymap(keyboard->keyboard, KEYMAP);
|
||||
xkb_keymap_unref(KEYMAP);
|
||||
xkb_context_unref(CONTEXT);
|
||||
wlr_keyboard_set_repeat_info(keyboard->keyboard, std::max(0, REPEATRATE), std::max(0, REPEATDELAY));
|
||||
|
||||
PNEWKEYBOARD->hyprListener_keyboardMod.initCallback(&keyboard->keyboard->events.modifiers, &Events::listener_keyboardMod, PNEWKEYBOARD, "Keyboard");
|
||||
PNEWKEYBOARD->hyprListener_keyboardKey.initCallback(&keyboard->keyboard->events.key, &Events::listener_keyboardKey, PNEWKEYBOARD, "Keyboard");
|
||||
PNEWKEYBOARD->hyprListener_keyboardDestroy.initCallback(&keyboard->events.destroy, &Events::listener_keyboardDestroy, PNEWKEYBOARD, "Keyboard");
|
||||
|
||||
if (m_pActiveKeyboard)
|
||||
m_pActiveKeyboard->active = false;
|
||||
m_pActiveKeyboard = PNEWKEYBOARD;
|
||||
|
||||
setKeyboardLayout();
|
||||
|
||||
wlr_seat_set_keyboard(g_pCompositor->m_sSeat.seat, keyboard->keyboard);
|
||||
|
||||
Debug::log(LOG, "New keyboard created, pointers Hypr: %x and WLR: %x", PNEWKEYBOARD, keyboard);
|
||||
|
||||
setKeyboardLayout();
|
||||
}
|
||||
|
||||
void CInputManager::setKeyboardLayout() {
|
||||
@@ -285,9 +283,31 @@ void CInputManager::setKeyboardLayout() {
|
||||
return;
|
||||
}
|
||||
|
||||
// TODO: configure devices one by one
|
||||
for (auto& k : m_lKeyboards)
|
||||
wlr_keyboard_set_keymap(k.keyboard->keyboard, KEYMAP);
|
||||
const auto PLASTKEEB = m_pActiveKeyboard->keyboard->keyboard;
|
||||
|
||||
if (!PLASTKEEB) {
|
||||
xkb_keymap_unref(KEYMAP);
|
||||
xkb_context_unref(CONTEXT);
|
||||
|
||||
Debug::log(ERR, "No Seat Keyboard???");
|
||||
return;
|
||||
}
|
||||
|
||||
wlr_keyboard_set_keymap(PLASTKEEB, KEYMAP);
|
||||
|
||||
wlr_keyboard_modifiers wlrMods = {0};
|
||||
|
||||
if (g_pConfigManager->getInt("input:numlock_by_default") == 1) {
|
||||
// lock numlock
|
||||
const auto IDX = xkb_map_mod_get_index(KEYMAP, XKB_MOD_NAME_NUM);
|
||||
|
||||
if (IDX != XKB_MOD_INVALID)
|
||||
wlrMods.locked |= (uint32_t)1 << IDX;
|
||||
}
|
||||
|
||||
if (wlrMods.locked != 0) {
|
||||
wlr_seat_keyboard_notify_modifiers(g_pCompositor->m_sSeat.seat, &wlrMods);
|
||||
}
|
||||
|
||||
xkb_keymap_unref(KEYMAP);
|
||||
xkb_context_unref(CONTEXT);
|
||||
@@ -330,6 +350,17 @@ void CInputManager::destroyKeyboard(SKeyboard* pKeyboard) {
|
||||
pKeyboard->hyprListener_keyboardMod.removeCallback();
|
||||
pKeyboard->hyprListener_keyboardKey.removeCallback();
|
||||
|
||||
if (pKeyboard->active) {
|
||||
m_lKeyboards.remove(*pKeyboard);
|
||||
|
||||
if (m_lKeyboards.size() > 0) {
|
||||
m_pActiveKeyboard = &m_lKeyboards.back();
|
||||
m_pActiveKeyboard->active = true;
|
||||
} else {
|
||||
m_pActiveKeyboard = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
m_lKeyboards.remove(*pKeyboard);
|
||||
}
|
||||
|
||||
|
@@ -36,12 +36,13 @@ public:
|
||||
|
||||
SDrag m_sDrag;
|
||||
|
||||
std::list<SConstraint> m_lConstraints;
|
||||
std::list<SConstraint> m_lConstraints;
|
||||
std::list<SKeyboard> m_lKeyboards;
|
||||
std::list<SMouse> m_lMice;
|
||||
|
||||
private:
|
||||
SKeyboard* m_pActiveKeyboard = nullptr;
|
||||
|
||||
std::list<SKeyboard> m_lKeyboards;
|
||||
std::list<SMouse> m_lMice;
|
||||
private:
|
||||
|
||||
void mouseMoveUnified(uint32_t, bool refocus = false);
|
||||
};
|
||||
|
@@ -24,6 +24,8 @@ CKeybindManager::CKeybindManager() {
|
||||
m_mDispatchers["movecurrentworkspacetomonitor"] = moveCurrentWorkspaceToMonitor;
|
||||
m_mDispatchers["moveworkspacetomonitor"] = moveWorkspaceToMonitor;
|
||||
m_mDispatchers["togglespecialworkspace"] = toggleSpecialWorkspace;
|
||||
m_mDispatchers["forcerendererreload"] = forceRendererReload;
|
||||
m_mDispatchers["resizeactive"] = resizeActive;
|
||||
}
|
||||
|
||||
void CKeybindManager::addKeybind(SKeybind kb) {
|
||||
@@ -109,8 +111,17 @@ bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
|
||||
|
||||
const auto PSESSION = wlr_backend_get_session(g_pCompositor->m_sWLRBackend);
|
||||
if (PSESSION) {
|
||||
const auto TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||
const int TTY = keysym - XKB_KEY_XF86Switch_VT_1 + 1;
|
||||
wlr_session_change_vt(PSESSION, TTY);
|
||||
|
||||
for (auto& m : g_pCompositor->m_lMonitors) {
|
||||
g_pHyprOpenGL->destroyMonitorResources(&m); // mark resources as unusable anymore
|
||||
m.noFrameSchedule = true;
|
||||
m.framesToSkip = 2;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "Switched to VT %i, destroyed all render data, frames to skip for each: 2", TTY);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -337,14 +348,19 @@ void CKeybindManager::moveActiveToWorkspace(std::string args) {
|
||||
if (!g_pCompositor->windowValidMapped(PWINDOW))
|
||||
return;
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
|
||||
|
||||
const auto OLDWORKSPACE = g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID);
|
||||
|
||||
// hack
|
||||
std::string unusedName;
|
||||
const auto WORKSPACEID = getWorkspaceIDFromString(args, unusedName);
|
||||
|
||||
if (WORKSPACEID == PWINDOW->m_iWorkspaceID) {
|
||||
Debug::log(LOG, "Not moving to workspace because it didn't change.");
|
||||
return;
|
||||
}
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(PWINDOW);
|
||||
|
||||
g_pKeybindManager->changeworkspace(args);
|
||||
|
||||
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
|
||||
@@ -749,6 +765,8 @@ void CKeybindManager::moveCurrentWorkspaceToMonitor(std::string args) {
|
||||
}
|
||||
|
||||
void CKeybindManager::moveWorkspaceToMonitor(std::string args) {
|
||||
if (args.find_first_of(' ') == std::string::npos)
|
||||
return;
|
||||
|
||||
std::string workspace = args.substr(0, args.find_first_of(' '));
|
||||
std::string monitor = args.substr(args.find_first_of(' ') + 1);
|
||||
@@ -821,4 +839,29 @@ void CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
||||
}
|
||||
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
|
||||
void CKeybindManager::forceRendererReload(std::string args) {
|
||||
for (auto& m : g_pCompositor->m_lMonitors) {
|
||||
auto rule = g_pConfigManager->getMonitorRuleFor(m.szName);
|
||||
g_pHyprRenderer->applyMonitorRule(&m, &rule, true);
|
||||
}
|
||||
}
|
||||
|
||||
void CKeybindManager::resizeActive(std::string args) {
|
||||
if (args.find_first_of(' ') == std::string::npos)
|
||||
return;
|
||||
|
||||
std::string x = args.substr(0, args.find_first_of(' '));
|
||||
std::string y = args.substr(args.find_first_of(' ') + 1);
|
||||
|
||||
if (!isNumber(x) || !isNumber(y)) {
|
||||
Debug::log(ERR, "resizeTiledWindow: args not numbers");
|
||||
return;
|
||||
}
|
||||
|
||||
const int X = std::stoi(x);
|
||||
const int Y = std::stoi(y);
|
||||
|
||||
g_pLayoutManager->getCurrentLayout()->resizeActiveWindow(Vector2D(X, Y));
|
||||
}
|
@@ -54,6 +54,8 @@ private:
|
||||
static void moveCurrentWorkspaceToMonitor(std::string);
|
||||
static void moveWorkspaceToMonitor(std::string);
|
||||
static void toggleSpecialWorkspace(std::string);
|
||||
static void forceRendererReload(std::string);
|
||||
static void resizeActive(std::string);
|
||||
|
||||
friend class CCompositor;
|
||||
};
|
||||
|
@@ -94,6 +94,9 @@ std::string CHyprXWaylandManager::getAppIDClass(CWindow* pWindow) {
|
||||
try {
|
||||
if (pWindow->m_bIsX11) {
|
||||
if (pWindow->m_uSurface.xwayland) {
|
||||
if (!pWindow->m_bMappedX11 || !pWindow->m_bIsMapped)
|
||||
return "unmanaged X11";
|
||||
|
||||
return std::string(pWindow->m_uSurface.xwayland->_class);
|
||||
}
|
||||
} else if (pWindow->m_uSurface.xdg) {
|
||||
@@ -123,9 +126,10 @@ void CHyprXWaylandManager::setWindowSize(CWindow* pWindow, const Vector2D& size)
|
||||
wlr_xwayland_surface_configure(pWindow->m_uSurface.xwayland, pWindow->m_vRealPosition.vec().x, pWindow->m_vRealPosition.vec().y, size.x, size.y);
|
||||
else {
|
||||
// I don't know if this is fucking correct, but the fucking idea of putting shadows into a window's surface is borderline criminal.
|
||||
const auto XDELTA = pWindow->m_uSurface.xdg->surface->current.width - pWindow->m_uSurface.xdg->current.geometry.width;
|
||||
const auto YDELTA = pWindow->m_uSurface.xdg->surface->current.height - pWindow->m_uSurface.xdg->current.geometry.height;
|
||||
|
||||
|
||||
const auto XDELTA = pWindow->m_uSurface.xdg->current.geometry.width && pWindow->m_uSurface.xdg->current.geometry.height ? pWindow->m_uSurface.xdg->surface->current.width - pWindow->m_uSurface.xdg->current.geometry.width : 0;
|
||||
const auto YDELTA = pWindow->m_uSurface.xdg->current.geometry.width && pWindow->m_uSurface.xdg->current.geometry.height ? pWindow->m_uSurface.xdg->surface->current.height - pWindow->m_uSurface.xdg->current.geometry.height : 0;
|
||||
|
||||
wlr_xdg_toplevel_set_size(pWindow->m_uSurface.xdg->toplevel, size.x - XDELTA, size.y - YDELTA);
|
||||
}
|
||||
}
|
||||
|
@@ -269,6 +269,7 @@ void CHyprOpenGLImpl::renderRect(wlr_box* box, const CColor& col, int round) {
|
||||
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);
|
||||
glUniform1i(glGetUniformLocation(m_shQUAD.program, "primitiveMultisample"), (int)(g_pConfigManager->getInt("decoration:multisample_edges") == 1 && round != 0));
|
||||
|
||||
glVertexAttribPointer(m_shQUAD.posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||
glVertexAttribPointer(m_shQUAD.texAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||
@@ -304,7 +305,7 @@ void CHyprOpenGLImpl::renderTexture(const CTexture& tex, wlr_box* pBox, float al
|
||||
scissor((wlr_box*)nullptr);
|
||||
}
|
||||
|
||||
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque, bool border) {
|
||||
void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_box* pBox, float alpha, pixman_region32_t* damage, int round, bool discardOpaque, bool border, bool noAA) {
|
||||
RASSERT(m_RenderData.pMonitor, "Tried to render texture without begin()!");
|
||||
RASSERT((tex.m_iTexID > 0), "Attempted to draw NULL texture!");
|
||||
|
||||
@@ -362,6 +363,7 @@ void CHyprOpenGLImpl::renderTextureInternalWithDamage(const CTexture& tex, wlr_b
|
||||
glUniform2f(glGetUniformLocation(shader->program, "bottomRight"), (float)BOTTOMRIGHT.x, (float)BOTTOMRIGHT.y);
|
||||
glUniform2f(glGetUniformLocation(shader->program, "fullSize"), (float)FULLSIZE.x, (float)FULLSIZE.y);
|
||||
glUniform1f(glGetUniformLocation(shader->program, "radius"), round);
|
||||
glUniform1i(glGetUniformLocation(shader->program, "primitiveMultisample"), (int)(g_pConfigManager->getInt("decoration:multisample_edges") == 1 && round != 0 && !border && !noAA));
|
||||
|
||||
glVertexAttribPointer(shader->posAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||
glVertexAttribPointer(shader->texAttrib, 2, GL_FLOAT, GL_FALSE, 0, fullVerts);
|
||||
@@ -598,7 +600,7 @@ void CHyprOpenGLImpl::renderTextureWithBlur(const CTexture& tex, wlr_box* pBox,
|
||||
glStencilFunc(GL_ALWAYS, 1, -1);
|
||||
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
|
||||
|
||||
renderTextureInternalWithDamage(tex, pBox, a, &damage, round);
|
||||
renderTextureInternalWithDamage(tex, pBox, a, &damage, round, false, false, true);
|
||||
|
||||
// then stop
|
||||
glStencilFunc(GL_EQUAL, 1, -1);
|
||||
|
@@ -110,7 +110,7 @@ private:
|
||||
// returns the out FB, can be either Mirror or MirrorSwap
|
||||
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, bool border = false);
|
||||
void renderTextureInternalWithDamage(const CTexture&, wlr_box* pBox, float a, pixman_region32_t* damage, int round = 0, bool discardOpaque = false, bool border = false, bool noAA = false);
|
||||
void renderBorder(wlr_box*, const CColor&, int thick = 1, int round = 0);
|
||||
};
|
||||
|
||||
|
@@ -717,5 +717,5 @@ void CHyprRenderer::applyMonitorRule(SMonitor* pMonitor, SMonitorRule* pMonitorR
|
||||
arrangeLayersForMonitor(pMonitor->ID);
|
||||
|
||||
// frame skip
|
||||
pMonitor->needsFrameSkip = true;
|
||||
pMonitor->framesToSkip = 1;
|
||||
}
|
||||
|
@@ -2,6 +2,147 @@
|
||||
|
||||
#include <string>
|
||||
|
||||
inline static constexpr auto ROUNDED_SHADER_FUNC = [](const std::string colorVarName) -> std::string {
|
||||
return R"#(
|
||||
if (pixCoord[0] < topLeft[0]) {
|
||||
// we're close left
|
||||
if (pixCoord[1] < topLeft[1]) {
|
||||
// top
|
||||
|
||||
if (ignoreCorners == 1) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
float topLeftDistance = distance(topLeft, pixCoord);
|
||||
|
||||
if (topLeftDistance > radius - 1.0) {
|
||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
||||
discard;
|
||||
return;
|
||||
} else if (primitiveMultisample == 1) {
|
||||
float distances = 0.0;
|
||||
if (distance(topLeft, pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(topLeft, pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(topLeft, pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(topLeft, pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
|
||||
if (distances == 0.0) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
distances = distances / 4.0;
|
||||
|
||||
gl_FragColor = )#" + colorVarName + R"#( * distances;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (pixCoord[1] > bottomRight[1]) {
|
||||
// bottom
|
||||
|
||||
if (ignoreCorners == 1) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
float topLeftDistance = distance(vec2(topLeft[0], bottomRight[1]), pixCoord);
|
||||
|
||||
if (topLeftDistance > radius - 1.0) {
|
||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
||||
discard;
|
||||
return;
|
||||
} else if (primitiveMultisample == 1) {
|
||||
float distances = 0.0;
|
||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(vec2(topLeft[0], bottomRight[1]), pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
|
||||
if (distances == 0.0) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
distances = distances / 4.0;
|
||||
|
||||
gl_FragColor = )#" + colorVarName + R"#( * distances;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (pixCoord[0] > bottomRight[0]) {
|
||||
// we're close right
|
||||
if (pixCoord[1] < topLeft[1]) {
|
||||
// top
|
||||
|
||||
if (ignoreCorners == 1) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
float topLeftDistance = distance(vec2(bottomRight[0], topLeft[1]), pixCoord);
|
||||
|
||||
if (topLeftDistance > radius - 1.0) {
|
||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
||||
discard;
|
||||
return;
|
||||
} else if (primitiveMultisample == 1) {
|
||||
float distances = 0.0;
|
||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(vec2(bottomRight[0], topLeft[1]), pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
|
||||
if (distances == 0.0) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
distances = distances / 4.0;
|
||||
|
||||
gl_FragColor = )#" + colorVarName + R"#( * distances;
|
||||
return;
|
||||
}
|
||||
}
|
||||
} else if (pixCoord[1] > bottomRight[1]) {
|
||||
// bottom
|
||||
|
||||
if (ignoreCorners == 1) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
float topLeftDistance = distance(bottomRight, pixCoord);
|
||||
|
||||
if (topLeftDistance > radius - 1.0) {
|
||||
if (primitiveMultisample == 0 && topLeftDistance > radius) {
|
||||
discard;
|
||||
return;
|
||||
} else if (primitiveMultisample == 1) {
|
||||
float distances = 0.0;
|
||||
if (distance(bottomRight, pixCoord + vec2(0.25, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(bottomRight, pixCoord + vec2(0.75, 0.25)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(bottomRight, pixCoord + vec2(0.25, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
if (distance(bottomRight, pixCoord + vec2(0.75, 0.75)) < radius) { distances = distances + 1.0; }
|
||||
|
||||
if (distances == 0.0) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
distances = distances / 4.0;
|
||||
|
||||
gl_FragColor = )#" + colorVarName + R"#( * distances;
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
)#";
|
||||
};
|
||||
|
||||
inline const std::string QUADVERTSRC = R"#(
|
||||
uniform mat3 proj;
|
||||
uniform vec4 color;
|
||||
@@ -26,6 +167,9 @@ uniform vec2 bottomRight;
|
||||
uniform vec2 fullSize;
|
||||
uniform float radius;
|
||||
|
||||
uniform int primitiveMultisample;
|
||||
uniform int ignoreCorners;
|
||||
|
||||
void main() {
|
||||
if (radius == 0.0) {
|
||||
gl_FragColor = v_color;
|
||||
@@ -34,38 +178,7 @@ void main() {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
)#" + ROUNDED_SHADER_FUNC("v_color") + R"#(
|
||||
|
||||
gl_FragColor = v_color;
|
||||
})#";
|
||||
@@ -94,6 +207,9 @@ uniform float radius;
|
||||
|
||||
uniform int discardOpaque;
|
||||
|
||||
uniform int primitiveMultisample;
|
||||
uniform int ignoreCorners;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 pixColor = texture2D(tex, v_texcoord);
|
||||
@@ -105,38 +221,8 @@ void main() {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") +
|
||||
R"#(
|
||||
|
||||
gl_FragColor = pixColor * alpha;
|
||||
})#";
|
||||
@@ -154,49 +240,23 @@ uniform float radius;
|
||||
|
||||
uniform int discardOpaque;
|
||||
|
||||
uniform int primitiveMultisample;
|
||||
uniform int ignoreCorners;
|
||||
|
||||
void main() {
|
||||
|
||||
if (discardOpaque == 1 && alpha == 1.0) {
|
||||
discard;
|
||||
return;
|
||||
}
|
||||
|
||||
vec4 pixColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0);
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
|
||||
gl_FragColor = vec4(texture2D(tex, v_texcoord).rgb, 1.0) * alpha;
|
||||
gl_FragColor = pixColor * alpha;
|
||||
})#";
|
||||
|
||||
inline const std::string FRAGBLUR1 = R"#(
|
||||
@@ -261,6 +321,9 @@ uniform float radius;
|
||||
|
||||
uniform int discardOpaque;
|
||||
|
||||
uniform int primitiveMultisample;
|
||||
uniform int ignoreCorners;
|
||||
|
||||
void main() {
|
||||
|
||||
vec4 pixColor = texture2D(texture0, v_texcoord);
|
||||
@@ -272,38 +335,7 @@ void main() {
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
)#" + ROUNDED_SHADER_FUNC("pixColor") + R"#(
|
||||
|
||||
gl_FragColor = pixColor * alpha;
|
||||
})#";
|
||||
|
Reference in New Issue
Block a user