Compare commits
6 Commits
nix
...
scale-work
Author | SHA1 | Date | |
---|---|---|---|
|
85917a40b0 | ||
|
d3e26652d6 | ||
|
276652b44e | ||
|
746f804568 | ||
|
00319c01d4 | ||
|
b509273759 |
11
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -2,13 +2,12 @@ name: Bug Report
|
|||||||
description: Something is not working right
|
description: Something is not working right
|
||||||
labels: ["bug"]
|
labels: ["bug"]
|
||||||
body:
|
body:
|
||||||
- type: checkboxes
|
- type: markdown
|
||||||
attributes:
|
attributes:
|
||||||
label: Already reported ? *
|
value: |
|
||||||
description: Before opening a new bug report, please take a moment to search through the current open and closed issues to check if it already exists.
|
## Before opening a new issue, please take a moment to search through the current open and closed issues to check if it already exists.
|
||||||
options:
|
|
||||||
- label: I have searched the existing open and closed issues.
|
---
|
||||||
required: true
|
|
||||||
|
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
id: type
|
id: type
|
||||||
|
15
.github/workflows/nix-build.yml
vendored
@@ -1,5 +1,3 @@
|
|||||||
name: Nix (Build)
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
secrets:
|
secrets:
|
||||||
@@ -16,12 +14,17 @@ jobs:
|
|||||||
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: DeterminateSystems/nix-installer-action@main
|
- name: Clone repository
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
ref: ${{ github.ref }}
|
||||||
|
submodules: recursive
|
||||||
|
|
||||||
|
- uses: cachix/install-nix-action@v27
|
||||||
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
- uses: cachix/cachix-action@v15
|
- uses: cachix/cachix-action@v15
|
||||||
with:
|
with:
|
||||||
name: hyprland
|
name: hyprland
|
||||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||||
|
|
||||||
- run: nix build 'git+https://github.com/hyprwm/Hyprland?ref=${{ github.ref }}&submodules=1#${{ matrix.package }}' -L --extra-substituters "https://hyprland.cachix.org"
|
- run: nix build '.?submodules=1#${{ matrix.package }}' -L --extra-substituters "https://hyprland.cachix.org"
|
||||||
|
7
.github/workflows/nix-ci.yml
vendored
@@ -1,14 +1,15 @@
|
|||||||
name: Nix (CI)
|
name: Nix
|
||||||
|
|
||||||
on: [push, pull_request, workflow_dispatch]
|
on: [push, pull_request, workflow_dispatch]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-inputs:
|
update-inputs:
|
||||||
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
|
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
||||||
uses: ./.github/workflows/nix-update-inputs.yml
|
uses: ./.github/workflows/nix-update-inputs.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
|
||||||
build:
|
build:
|
||||||
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
|
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork) && !contains(needs.*.result, 'failure')
|
||||||
|
needs: update-inputs
|
||||||
uses: ./.github/workflows/nix-build.yml
|
uses: ./.github/workflows/nix-build.yml
|
||||||
secrets: inherit
|
secrets: inherit
|
||||||
|
3
.github/workflows/nix-update-inputs.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: Nix (Update Inputs)
|
name: Nix
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
@@ -8,7 +8,6 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update:
|
update:
|
||||||
if: github.repository == 'hyprwm/Hyprland'
|
|
||||||
name: inputs
|
name: inputs
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
8
.github/workflows/stale.yml
vendored
@@ -7,12 +7,12 @@ name: Mark stale issues and pull requests
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "7 */4 * * *"
|
- cron: '7 */4 * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stale:
|
stale:
|
||||||
if: github.repository == 'hyprwm/Hyprland'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
issues: write
|
issues: write
|
||||||
@@ -22,7 +22,7 @@ jobs:
|
|||||||
- uses: actions/stale@v5
|
- uses: actions/stale@v5
|
||||||
with:
|
with:
|
||||||
repo-token: ${{ secrets.STALEBOT_PAT }}
|
repo-token: ${{ secrets.STALEBOT_PAT }}
|
||||||
stale-issue-label: "stale"
|
stale-issue-label: 'stale'
|
||||||
stale-pr-label: "stale"
|
stale-pr-label: 'stale'
|
||||||
operations-per-run: 40
|
operations-per-run: 40
|
||||||
days-before-close: -1
|
days-before-close: -1
|
||||||
|
@@ -1,4 +1,4 @@
|
|||||||
cmake_minimum_required(VERSION 3.30)
|
cmake_minimum_required(VERSION 3.27)
|
||||||
|
|
||||||
# Get version
|
# Get version
|
||||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
||||||
@@ -91,17 +91,16 @@ find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION})
|
|||||||
|
|
||||||
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.1)
|
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.1)
|
||||||
|
|
||||||
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine)
|
|
||||||
|
|
||||||
add_compile_definitions(AQUAMARINE_VERSION="${aquamarine_dep_VERSION}")
|
|
||||||
|
|
||||||
pkg_check_modules(
|
pkg_check_modules(
|
||||||
deps
|
deps
|
||||||
REQUIRED
|
REQUIRED
|
||||||
IMPORTED_TARGET
|
IMPORTED_TARGET
|
||||||
|
aquamarine
|
||||||
xkbcommon
|
xkbcommon
|
||||||
uuid
|
uuid
|
||||||
wayland-server
|
wayland-server
|
||||||
|
wayland-client
|
||||||
|
wayland-cursor
|
||||||
wayland-protocols
|
wayland-protocols
|
||||||
cairo
|
cairo
|
||||||
pango
|
pango
|
||||||
@@ -110,11 +109,16 @@ pkg_check_modules(
|
|||||||
xcursor
|
xcursor
|
||||||
libdrm
|
libdrm
|
||||||
libinput
|
libinput
|
||||||
|
hwdata
|
||||||
|
libseat
|
||||||
|
libdisplay-info
|
||||||
|
libliftoff
|
||||||
|
libudev
|
||||||
gbm
|
gbm
|
||||||
gio-2.0
|
gio-2.0
|
||||||
hyprlang>=0.3.2
|
hyprlang>=0.3.2
|
||||||
hyprcursor>=0.1.7
|
hyprcursor>=0.1.7
|
||||||
hyprutils>=0.2.2)
|
hyprutils>=0.2.1)
|
||||||
|
|
||||||
find_package(hyprwayland-scanner 0.3.10 REQUIRED)
|
find_package(hyprwayland-scanner 0.3.10 REQUIRED)
|
||||||
|
|
||||||
@@ -196,11 +200,14 @@ else()
|
|||||||
REQUIRED
|
REQUIRED
|
||||||
IMPORTED_TARGET
|
IMPORTED_TARGET
|
||||||
xcb
|
xcb
|
||||||
|
xwayland
|
||||||
|
xcb-util
|
||||||
xcb-render
|
xcb-render
|
||||||
xcb-xfixes
|
xcb-xfixes
|
||||||
xcb-icccm
|
xcb-icccm
|
||||||
xcb-composite
|
xcb-composite
|
||||||
xcb-res
|
xcb-res
|
||||||
|
xcb-ewmh
|
||||||
xcb-errors)
|
xcb-errors)
|
||||||
target_link_libraries(Hyprland PkgConfig::xdeps)
|
target_link_libraries(Hyprland PkgConfig::xdeps)
|
||||||
endif()
|
endif()
|
||||||
@@ -216,17 +223,14 @@ set(CPACK_PROJECT_NAME ${PROJECT_NAME})
|
|||||||
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
|
||||||
include(CPack)
|
include(CPack)
|
||||||
|
|
||||||
if(CMAKE_DISABLE_PRECOMPILE_HEADERS)
|
message(STATUS "Setting precompiled headers")
|
||||||
message(STATUS "Not using precompiled headers")
|
|
||||||
else()
|
target_precompile_headers(Hyprland PRIVATE
|
||||||
message(STATUS "Setting precompiled headers")
|
|
||||||
target_precompile_headers(Hyprland PRIVATE
|
|
||||||
$<$<COMPILE_LANGUAGE:CXX>:src/pch/pch.hpp>)
|
$<$<COMPILE_LANGUAGE:CXX>:src/pch/pch.hpp>)
|
||||||
endif()
|
|
||||||
|
|
||||||
message(STATUS "Setting link libraries")
|
message(STATUS "Setting link libraries")
|
||||||
|
|
||||||
target_link_libraries(Hyprland rt PkgConfig::aquamarine_dep PkgConfig::deps)
|
target_link_libraries(Hyprland rt PkgConfig::deps)
|
||||||
|
|
||||||
# used by `make installheaders`, to ensure the headers are generated
|
# used by `make installheaders`, to ensure the headers are generated
|
||||||
add_custom_target(generate-protocol-headers)
|
add_custom_target(generate-protocol-headers)
|
||||||
@@ -262,7 +266,7 @@ function(protocolWayland)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads
|
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads
|
||||||
libudis86)
|
libudis86 uuid)
|
||||||
|
|
||||||
protocolnew("subprojects/hyprland-protocols/protocols"
|
protocolnew("subprojects/hyprland-protocols/protocols"
|
||||||
"hyprland-global-shortcuts-v1" true)
|
"hyprland-global-shortcuts-v1" true)
|
||||||
@@ -311,7 +315,6 @@ protocolnew("stable/viewporter" "viewporter" false)
|
|||||||
protocolnew("stable/linux-dmabuf" "linux-dmabuf-v1" false)
|
protocolnew("stable/linux-dmabuf" "linux-dmabuf-v1" false)
|
||||||
protocolnew("staging/drm-lease" "drm-lease-v1" false)
|
protocolnew("staging/drm-lease" "drm-lease-v1" false)
|
||||||
protocolnew("staging/linux-drm-syncobj" "linux-drm-syncobj-v1" false)
|
protocolnew("staging/linux-drm-syncobj" "linux-drm-syncobj-v1" false)
|
||||||
protocolnew("staging/xdg-dialog" "xdg-dialog-v1" false)
|
|
||||||
|
|
||||||
protocolwayland()
|
protocolwayland()
|
||||||
|
|
||||||
@@ -333,14 +336,12 @@ install(
|
|||||||
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop
|
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions)
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions)
|
||||||
|
|
||||||
# allow Hyprland to find assets
|
# allow Hyprland to find wallpapers
|
||||||
add_compile_definitions(DATAROOTDIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}")
|
add_compile_definitions(DATAROOTDIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}")
|
||||||
|
|
||||||
# installable assets
|
# wallpapers
|
||||||
file(GLOB_RECURSE INSTALLABLE_ASSETS "assets/install/*")
|
file(GLOB_RECURSE WALLPAPERS "assets/wall*")
|
||||||
list(FILTER INSTALLABLE_ASSETS EXCLUDE REGEX "meson.build")
|
install(FILES ${WALLPAPERS} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr)
|
||||||
install(FILES ${INSTALLABLE_ASSETS}
|
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr)
|
|
||||||
|
|
||||||
# default config
|
# default config
|
||||||
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.conf
|
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.conf
|
||||||
|
24
Makefile
@@ -1,24 +1,28 @@
|
|||||||
PREFIX = /usr/local
|
PREFIX = /usr/local
|
||||||
|
|
||||||
legacyrenderer:
|
legacyrenderer:
|
||||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./buildZ
|
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
|
||||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
cmake --build ./build --config Release --target all
|
||||||
|
chmod -R 777 ./build
|
||||||
|
|
||||||
legacyrendererdebug:
|
legacyrendererdebug:
|
||||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build
|
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
|
||||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
cmake --build ./build --config Release --target all
|
||||||
|
chmod -R 777 ./build
|
||||||
|
|
||||||
release:
|
release:
|
||||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build
|
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja
|
||||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
cmake --build ./build --config Release --target all
|
||||||
|
chmod -R 777 ./build
|
||||||
|
|
||||||
debug:
|
debug:
|
||||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build
|
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja
|
||||||
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
cmake --build ./build --config Debug --target all
|
||||||
|
chmod -R 777 ./build
|
||||||
|
|
||||||
nopch:
|
nopch:
|
||||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build
|
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build -G Ninja
|
||||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
cmake --build ./build --config Release --target all
|
||||||
|
|
||||||
clear:
|
clear:
|
||||||
rm -rf build
|
rm -rf build
|
||||||
|
Before Width: | Height: | Size: 110 KiB |
Before Width: | Height: | Size: 48 KiB |
@@ -1,10 +0,0 @@
|
|||||||
globber = run_command('sh', '-c', 'find . -type f -not -name "*.build"', check: true)
|
|
||||||
files = globber.stdout().strip().split('\n')
|
|
||||||
|
|
||||||
foreach file : files
|
|
||||||
install_data(
|
|
||||||
file,
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'hypr'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
)
|
|
||||||
endforeach
|
|
@@ -1,7 +1,7 @@
|
|||||||
install_data(
|
wallpapers = ['0', '1', '2']
|
||||||
'hyprland-portals.conf',
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
)
|
|
||||||
|
|
||||||
subdir('install')
|
foreach type : wallpapers
|
||||||
|
install_data(f'wall@type@.png', install_dir: join_paths(get_option('datadir'), 'hypr'), install_tag: 'runtime')
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
install_data('hyprland-portals.conf', install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal'), install_tag: 'runtime')
|
||||||
|
Before Width: | Height: | Size: 14 MiB After Width: | Height: | Size: 14 MiB |
Before Width: | Height: | Size: 5.9 MiB After Width: | Height: | Size: 5.9 MiB |
Before Width: | Height: | Size: 27 MiB After Width: | Height: | Size: 27 MiB |
@@ -10,8 +10,8 @@ Hyprland - Dynamic tiling Wayland compositor
|
|||||||
\f[B]Hyprland\f[R] [\f[I]arg [...]\f[R]].
|
\f[B]Hyprland\f[R] [\f[I]arg [...]\f[R]].
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
\f[B]Hyprland\f[R] is an independent, highly customizable, dynamic
|
\f[B]Hyprland\f[R] is a dynamic tiling Wayland compositor based on
|
||||||
tiling Wayland compositor that doesn\[aq]t sacrifice on its looks.
|
wlroots that doesn\[aq]t sacrifice on its looks.
|
||||||
.PP
|
.PP
|
||||||
You can launch Hyprland by either going into a TTY and executing
|
You can launch Hyprland by either going into a TTY and executing
|
||||||
\f[B]Hyprland\f[R], or with a login manager.
|
\f[B]Hyprland\f[R], or with a login manager.
|
||||||
|
@@ -14,8 +14,8 @@ SYNOPSIS
|
|||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
===========
|
===========
|
||||||
|
|
||||||
**Hyprland** is an independent, highly customizable,
|
**Hyprland** is a dynamic tiling Wayland compositor based on
|
||||||
dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
|
wlroots that doesn't sacrifice on its looks.
|
||||||
|
|
||||||
You can launch Hyprland by either going into a TTY and
|
You can launch Hyprland by either going into a TTY and
|
||||||
executing **Hyprland**, or with a login manager.
|
executing **Hyprland**, or with a login manager.
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
install_man('Hyprland.1')
|
install_man ('Hyprland.1')
|
||||||
install_man('hyprctl.1')
|
install_man ('hyprctl.1')
|
||||||
|
@@ -228,19 +228,6 @@ bind = $mainMod, mouse_up, workspace, e-1
|
|||||||
bindm = $mainMod, mouse:272, movewindow
|
bindm = $mainMod, mouse:272, movewindow
|
||||||
bindm = $mainMod, mouse:273, resizewindow
|
bindm = $mainMod, mouse:273, resizewindow
|
||||||
|
|
||||||
# Laptop multimedia keys for volume and LCD brightness
|
|
||||||
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
|
|
||||||
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
|
||||||
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
|
||||||
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
|
||||||
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
|
|
||||||
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
|
||||||
|
|
||||||
# Requires playerctl
|
|
||||||
bindl = , XF86AudioNext, exec, playerctl next
|
|
||||||
bindl = , XF86AudioPause, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
### WINDOWS AND WORKSPACES ###
|
### WINDOWS AND WORKSPACES ###
|
||||||
|
@@ -1,10 +1,2 @@
|
|||||||
install_data(
|
install_data('hyprland.conf', install_dir: join_paths(get_option('datadir'), 'hypr'), install_tag: 'runtime')
|
||||||
'hyprland.conf',
|
install_data('hyprland.desktop', install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), install_tag: 'runtime')
|
||||||
install_dir: join_paths(get_option('datadir'), 'hypr'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
)
|
|
||||||
install_data(
|
|
||||||
'hyprland.desktop',
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'wayland-sessions'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
)
|
|
||||||
|
42
flake.lock
generated
@@ -16,11 +16,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726665257,
|
"lastModified": 1724273991,
|
||||||
"narHash": "sha256-rEzEZtd3iyVo5RJ1OGujOlnywNf3gsrOnjAn1NLciD4=",
|
"narHash": "sha256-+aUSOXKGpS5CRm1oTitgNAr05ThQNbKIXalZHl3nC6Y=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "aquamarine",
|
"repo": "aquamarine",
|
||||||
"rev": "752d0fbd141fabb5a1e7f865199b80e6e76f8d8e",
|
"rev": "9a3161ad4c78dc420d1cbb3aae638222608c7de4",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -93,11 +93,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1725997860,
|
"lastModified": 1724174162,
|
||||||
"narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=",
|
"narHash": "sha256-fOOBLwil6M9QWMCiSULwjMQzrXhHXUnEqmjHX5ZHeVI=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprlang",
|
"repo": "hyprlang",
|
||||||
"rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876",
|
"rev": "16e5c9465f04477d8a3dd48a0a26bf437986336c",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -116,11 +116,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726874949,
|
"lastModified": 1722869141,
|
||||||
"narHash": "sha256-PNnIpwGqpTvMU3N2r0wMQwK1E+t4Bb5fbJwblQvr+80=",
|
"narHash": "sha256-0KU4qhyMp441qfwbirNg3+wbm489KnEjXOz2I/RbeFs=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprutils",
|
"repo": "hyprutils",
|
||||||
"rev": "d97af4f6bd068c03a518b597675e598f57ea2291",
|
"rev": "0252fd13e78e60fb0da512a212e56007515a49f7",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -139,11 +139,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726840673,
|
"lastModified": 1721324119,
|
||||||
"narHash": "sha256-HIPEXyRRVZoqD6U+lFS1B0tsIU7p83FaB9m7KT/x6mQ=",
|
"narHash": "sha256-SOOqIT27/X792+vsLSeFdrNTF+OSRp5qXv6Te+fb2Qg=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "hyprwayland-scanner",
|
"repo": "hyprwayland-scanner",
|
||||||
"rev": "b68dab23fc922eae99306988133ee80a40b39ca5",
|
"rev": "a048a6cb015340bd82f97c1f40a4b595ca85cc30",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -154,11 +154,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726755586,
|
"lastModified": 1724224976,
|
||||||
"narHash": "sha256-PmUr/2GQGvFTIJ6/Tvsins7Q43KTMvMFhvG6oaYK+Wk=",
|
"narHash": "sha256-Z/ELQhrSd7bMzTO8r7NZgi9g5emh+aRKoCdaAv5fiO0=",
|
||||||
"owner": "NixOS",
|
"owner": "NixOS",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "c04d5652cfa9742b1d519688f65d1bbccea9eb7e",
|
"rev": "c374d94f1536013ca8e92341b540eba4c22f9c62",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@@ -201,12 +201,6 @@
|
|||||||
"hyprlang": [
|
"hyprlang": [
|
||||||
"hyprlang"
|
"hyprlang"
|
||||||
],
|
],
|
||||||
"hyprutils": [
|
|
||||||
"hyprutils"
|
|
||||||
],
|
|
||||||
"hyprwayland-scanner": [
|
|
||||||
"hyprwayland-scanner"
|
|
||||||
],
|
|
||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
@@ -215,11 +209,11 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1726851729,
|
"lastModified": 1724073926,
|
||||||
"narHash": "sha256-1z0esr5lBeUMlrPZ9gZmqZT8oTQekxJi53HAW4cH0Ms=",
|
"narHash": "sha256-nWlUL43jOFHf+KW6Hqrx+W/r1XdXuDyb0wC/SrHsOu4=",
|
||||||
"owner": "hyprwm",
|
"owner": "hyprwm",
|
||||||
"repo": "xdg-desktop-portal-hyprland",
|
"repo": "xdg-desktop-portal-hyprland",
|
||||||
"rev": "73b8c4f1150040644cf678aa8bbf2cec48a433cf",
|
"rev": "a08ecbbf33598924e93542f737fc6169a26b481e",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@@ -46,8 +46,6 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
inputs.systems.follows = "systems";
|
inputs.systems.follows = "systems";
|
||||||
inputs.hyprlang.follows = "hyprlang";
|
inputs.hyprlang.follows = "hyprlang";
|
||||||
inputs.hyprutils.follows = "hyprutils";
|
|
||||||
inputs.hyprwayland-scanner.follows = "hyprwayland-scanner";
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -97,9 +95,13 @@
|
|||||||
devShells = eachSystem (system: {
|
devShells = eachSystem (system: {
|
||||||
default =
|
default =
|
||||||
pkgsFor.${system}.mkShell.override {
|
pkgsFor.${system}.mkShell.override {
|
||||||
inherit (self.packages.${system}.default) stdenv;
|
stdenv = pkgsFor.${system}.gcc14Stdenv;
|
||||||
} {
|
} {
|
||||||
name = "hyprland-shell";
|
name = "hyprland-shell";
|
||||||
|
nativeBuildInputs = with pkgsFor.${system}; [
|
||||||
|
expat
|
||||||
|
libxml2
|
||||||
|
];
|
||||||
hardeningDisable = ["fortify"];
|
hardeningDisable = ["fortify"];
|
||||||
inputsFrom = [pkgsFor.${system}.hyprland];
|
inputsFrom = [pkgsFor.${system}.hyprland];
|
||||||
packages = [pkgsFor.${system}.clang-tools];
|
packages = [pkgsFor.${system}.clang-tools];
|
||||||
|
@@ -287,12 +287,12 @@ void instancesRequest(bool json) {
|
|||||||
std::vector<SInstanceData> inst = instances();
|
std::vector<SInstanceData> inst = instances();
|
||||||
|
|
||||||
if (!json) {
|
if (!json) {
|
||||||
for (auto const& el : inst) {
|
for (auto& el : inst) {
|
||||||
result += std::format("instance {}:\n\ttime: {}\n\tpid: {}\n\twl socket: {}\n\n", el.id, el.time, el.pid, el.wlSocket);
|
result += std::format("instance {}:\n\ttime: {}\n\tpid: {}\n\twl socket: {}\n\n", el.id, el.time, el.pid, el.wlSocket);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
result += '[';
|
result += '[';
|
||||||
for (auto const& el : inst) {
|
for (auto& el : inst) {
|
||||||
result += std::format(R"#(
|
result += std::format(R"#(
|
||||||
{{
|
{{
|
||||||
"instance": "{}",
|
"instance": "{}",
|
||||||
|
@@ -1,26 +1,10 @@
|
|||||||
executable(
|
executable('hyprctl', 'main.cpp',
|
||||||
'hyprctl',
|
|
||||||
'main.cpp',
|
|
||||||
dependencies: [
|
dependencies: [
|
||||||
dependency('hyprutils', version: '>= 0.1.1'),
|
dependency('hyprutils', version: '>= 0.1.1'),
|
||||||
],
|
],
|
||||||
install: true,
|
install: true
|
||||||
)
|
)
|
||||||
|
|
||||||
install_data(
|
install_data('hyprctl.bash', install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'), install_tag: 'runtime', rename: 'hyprctl')
|
||||||
'hyprctl.bash',
|
install_data('hyprctl.fish', install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'), install_tag: 'runtime')
|
||||||
install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'),
|
install_data('hyprctl.zsh', install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'), install_tag: 'runtime', rename: '_hyprctl')
|
||||||
install_tag: 'runtime',
|
|
||||||
rename: 'hyprctl',
|
|
||||||
)
|
|
||||||
install_data(
|
|
||||||
'hyprctl.fish',
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
)
|
|
||||||
install_data(
|
|
||||||
'hyprctl.zsh',
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
rename: '_hyprctl',
|
|
||||||
)
|
|
||||||
|
@@ -49,7 +49,7 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) {
|
|||||||
{"rev", repo.rev}
|
{"rev", repo.rev}
|
||||||
}}
|
}}
|
||||||
};
|
};
|
||||||
for (auto const& p : repo.plugins) {
|
for (auto& p : repo.plugins) {
|
||||||
// copy .so to the good place
|
// copy .so to the good place
|
||||||
if (std::filesystem::exists(p.filename))
|
if (std::filesystem::exists(p.filename))
|
||||||
std::filesystem::copy_file(p.filename, PATH + "/" + p.name + ".so");
|
std::filesystem::copy_file(p.filename, PATH + "/" + p.name + ".so");
|
||||||
|
@@ -6,7 +6,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
|
|||||||
auto manifest = toml::parse_file(path);
|
auto manifest = toml::parse_file(path);
|
||||||
|
|
||||||
if (type == MANIFEST_HYPRLOAD) {
|
if (type == MANIFEST_HYPRLOAD) {
|
||||||
for (auto const& [key, val] : manifest) {
|
for (auto& [key, val] : manifest) {
|
||||||
if (key.str().ends_with(".build"))
|
if (key.str().ends_with(".build"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -63,7 +63,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& [key, val] : manifest) {
|
for (auto& [key, val] : manifest) {
|
||||||
if (key.str() == "repository")
|
if (key.str() == "repository")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -204,9 +204,9 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
|||||||
|
|
||||||
progress.m_iSteps = 2;
|
progress.m_iSteps = 2;
|
||||||
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " parsed manifest, found " + std::to_string(pManifest->m_vPlugins.size()) + " plugins:");
|
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " parsed manifest, found " + std::to_string(pManifest->m_vPlugins.size()) + " plugins:");
|
||||||
for (auto const& pl : pManifest->m_vPlugins) {
|
for (auto& pl : pManifest->m_vPlugins) {
|
||||||
std::string message = std::string{Colors::RESET} + " → " + pl.name + " by ";
|
std::string message = std::string{Colors::RESET} + " → " + pl.name + " by ";
|
||||||
for (auto const& a : pl.authors) {
|
for (auto& a : pl.authors) {
|
||||||
message += a + ", ";
|
message += a + ", ";
|
||||||
}
|
}
|
||||||
if (pl.authors.size() > 0) {
|
if (pl.authors.size() > 0) {
|
||||||
@@ -222,7 +222,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
|||||||
|
|
||||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
|
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
|
||||||
|
|
||||||
for (auto const& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
for (auto& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
||||||
if (hl != HLVER.hash)
|
if (hl != HLVER.hash)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -264,7 +264,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
|||||||
|
|
||||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
|
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
|
||||||
|
|
||||||
for (auto const& bs : p.buildSteps) {
|
for (auto& bs : p.buildSteps) {
|
||||||
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
||||||
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
|||||||
repo.url = url;
|
repo.url = url;
|
||||||
repo.rev = rev;
|
repo.rev = rev;
|
||||||
repo.hash = repohash;
|
repo.hash = repohash;
|
||||||
for (auto const& p : pManifest->m_vPlugins) {
|
for (auto& p : pManifest->m_vPlugins) {
|
||||||
repo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, false, p.failed});
|
repo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, false, p.failed});
|
||||||
}
|
}
|
||||||
DataState::addNewPluginRepo(repo);
|
DataState::addNewPluginRepo(repo);
|
||||||
@@ -579,7 +579,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
|||||||
const std::string USERNAME = getpwuid(getuid())->pw_name;
|
const std::string USERNAME = getpwuid(getuid())->pw_name;
|
||||||
m_szWorkingPluginDirectory = "/tmp/hyprpm/" + USERNAME;
|
m_szWorkingPluginDirectory = "/tmp/hyprpm/" + USERNAME;
|
||||||
|
|
||||||
for (auto const& repo : REPOS) {
|
for (auto& repo : REPOS) {
|
||||||
bool update = forceUpdateAll;
|
bool update = forceUpdateAll;
|
||||||
|
|
||||||
progress.m_iSteps++;
|
progress.m_iSteps++;
|
||||||
@@ -658,7 +658,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
|||||||
|
|
||||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
|
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
|
||||||
|
|
||||||
for (auto const& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
for (auto& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
||||||
if (hl != HLVER.hash)
|
if (hl != HLVER.hash)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -679,7 +679,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
|||||||
|
|
||||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
|
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
|
||||||
|
|
||||||
for (auto const& bs : p.buildSteps) {
|
for (auto& bs : p.buildSteps) {
|
||||||
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
||||||
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
||||||
}
|
}
|
||||||
@@ -709,7 +709,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
|||||||
if (repohash.length() > 0)
|
if (repohash.length() > 0)
|
||||||
repohash.pop_back();
|
repohash.pop_back();
|
||||||
newrepo.hash = repohash;
|
newrepo.hash = repohash;
|
||||||
for (auto const& p : pManifest->m_vPlugins) {
|
for (auto& p : pManifest->m_vPlugins) {
|
||||||
const auto OLDPLUGINIT = std::find_if(repo.plugins.begin(), repo.plugins.end(), [&](const auto& other) { return other.name == p.name; });
|
const auto OLDPLUGINIT = std::find_if(repo.plugins.begin(), repo.plugins.end(), [&](const auto& other) { return other.name == p.name; });
|
||||||
newrepo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, OLDPLUGINIT != repo.plugins.end() ? OLDPLUGINIT->enabled : false});
|
newrepo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, OLDPLUGINIT != repo.plugins.end() ? OLDPLUGINIT->enabled : false});
|
||||||
}
|
}
|
||||||
@@ -794,8 +794,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
|||||||
const auto REPOS = DataState::getAllRepositories();
|
const auto REPOS = DataState::getAllRepositories();
|
||||||
|
|
||||||
auto enabled = [REPOS](const std::string& plugin) -> bool {
|
auto enabled = [REPOS](const std::string& plugin) -> bool {
|
||||||
for (auto const& r : REPOS) {
|
for (auto& r : REPOS) {
|
||||||
for (auto const& p : r.plugins) {
|
for (auto& p : r.plugins) {
|
||||||
if (p.name == plugin && p.enabled)
|
if (p.name == plugin && p.enabled)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -805,8 +805,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto repoForName = [REPOS](const std::string& name) -> std::string {
|
auto repoForName = [REPOS](const std::string& name) -> std::string {
|
||||||
for (auto const& r : REPOS) {
|
for (auto& r : REPOS) {
|
||||||
for (auto const& p : r.plugins) {
|
for (auto& p : r.plugins) {
|
||||||
if (p.name == name)
|
if (p.name == name)
|
||||||
return r.name;
|
return r.name;
|
||||||
}
|
}
|
||||||
@@ -816,7 +816,7 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// unload disabled plugins
|
// unload disabled plugins
|
||||||
for (auto const& p : loadedPlugins) {
|
for (auto& p : loadedPlugins) {
|
||||||
if (!enabled(p)) {
|
if (!enabled(p)) {
|
||||||
// unload
|
// unload
|
||||||
loadUnloadPlugin(HYPRPMPATH + repoForName(p) + "/" + p + ".so", false);
|
loadUnloadPlugin(HYPRPMPATH + repoForName(p) + "/" + p + ".so", false);
|
||||||
@@ -825,8 +825,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load enabled plugins
|
// load enabled plugins
|
||||||
for (auto const& r : REPOS) {
|
for (auto& r : REPOS) {
|
||||||
for (auto const& p : r.plugins) {
|
for (auto& p : r.plugins) {
|
||||||
if (!p.enabled)
|
if (!p.enabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -855,10 +855,10 @@ bool CPluginManager::loadUnloadPlugin(const std::string& path, bool load) {
|
|||||||
void CPluginManager::listAllPlugins() {
|
void CPluginManager::listAllPlugins() {
|
||||||
const auto REPOS = DataState::getAllRepositories();
|
const auto REPOS = DataState::getAllRepositories();
|
||||||
|
|
||||||
for (auto const& r : REPOS) {
|
for (auto& r : REPOS) {
|
||||||
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
|
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
|
||||||
|
|
||||||
for (auto const& p : r.plugins) {
|
for (auto& p : r.plugins) {
|
||||||
|
|
||||||
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name;
|
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name;
|
||||||
|
|
||||||
@@ -904,9 +904,9 @@ std::string CPluginManager::headerErrorShort(const eHeadersErrors err) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CPluginManager::hasDeps() {
|
bool CPluginManager::hasDeps() {
|
||||||
std::vector<std::string> deps = {"meson", "cpio", "cmake", "pkg-config"};
|
std::vector<std::string> deps = {"meson", "cpio", "cmake"};
|
||||||
for (auto const& d : deps) {
|
for (auto& d : deps) {
|
||||||
if (!execAndGet("command -v " + d).contains("/"))
|
if (!execAndGet("which " + d + " 2>&1").contains("/"))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,31 +1,15 @@
|
|||||||
globber = run_command('sh', '-c', 'find . -name "*.cpp" | sort', check: true)
|
globber = run_command('sh', '-c', 'find . -name "*.cpp" | sort', check: true)
|
||||||
src = globber.stdout().strip().split('\n')
|
src = globber.stdout().strip().split('\n')
|
||||||
|
|
||||||
executable(
|
executable('hyprpm', src,
|
||||||
'hyprpm',
|
|
||||||
src,
|
|
||||||
dependencies: [
|
dependencies: [
|
||||||
dependency('hyprutils', version: '>= 0.1.1'),
|
dependency('hyprutils', version: '>= 0.1.1'),
|
||||||
dependency('threads'),
|
dependency('threads'),
|
||||||
dependency('tomlplusplus'),
|
dependency('tomlplusplus')
|
||||||
],
|
],
|
||||||
install: true,
|
install : true
|
||||||
)
|
)
|
||||||
|
|
||||||
install_data(
|
install_data('../hyprpm.bash', install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'), install_tag: 'runtime', rename: 'hyprpm')
|
||||||
'../hyprpm.bash',
|
install_data('../hyprpm.fish', install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'), install_tag: 'runtime')
|
||||||
install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'),
|
install_data('../hyprpm.zsh', install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'), install_tag: 'runtime', rename: '_hyprpm')
|
||||||
install_tag: 'runtime',
|
|
||||||
rename: 'hyprpm',
|
|
||||||
)
|
|
||||||
install_data(
|
|
||||||
'../hyprpm.fish',
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
)
|
|
||||||
install_data(
|
|
||||||
'../hyprpm.zsh',
|
|
||||||
install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'),
|
|
||||||
install_tag: 'runtime',
|
|
||||||
rename: '_hyprpm',
|
|
||||||
)
|
|
||||||
|
29
meson.build
@@ -1,17 +1,13 @@
|
|||||||
project(
|
project('Hyprland', 'cpp', 'c',
|
||||||
'Hyprland',
|
version : run_command('cat', join_paths(meson.source_root(), 'VERSION'), check: true).stdout().strip(),
|
||||||
'cpp',
|
default_options : [
|
||||||
'c',
|
|
||||||
version: run_command('cat', join_paths(meson.project_source_root(), 'VERSION'), check: true).stdout().strip(),
|
|
||||||
default_options: [
|
|
||||||
'warning_level=2',
|
'warning_level=2',
|
||||||
'default_library=static',
|
'default_library=static',
|
||||||
'optimization=3',
|
'optimization=3',
|
||||||
'buildtype=release',
|
'buildtype=release',
|
||||||
'debug=false',
|
'debug=false',
|
||||||
'cpp_std=c++26',
|
'cpp_std=c++26',
|
||||||
],
|
])
|
||||||
)
|
|
||||||
|
|
||||||
datarootdir = '-DDATAROOTDIR="' + get_option('prefix') / get_option('datadir') + '"'
|
datarootdir = '-DDATAROOTDIR="' + get_option('prefix') / get_option('datadir') + '"'
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
@@ -20,19 +16,16 @@ add_project_arguments(
|
|||||||
'-Wno-unused-value',
|
'-Wno-unused-value',
|
||||||
'-Wno-missing-field-initializers',
|
'-Wno-missing-field-initializers',
|
||||||
'-Wno-narrowing',
|
'-Wno-narrowing',
|
||||||
'-Wno-pointer-arith', datarootdir,
|
'-Wno-pointer-arith',
|
||||||
|
datarootdir,
|
||||||
],
|
],
|
||||||
language: 'cpp',
|
language: 'cpp')
|
||||||
)
|
|
||||||
|
|
||||||
cpp_compiler = meson.get_compiler('cpp')
|
cpp_compiler = meson.get_compiler('cpp')
|
||||||
if cpp_compiler.check_header('execinfo.h')
|
if cpp_compiler.check_header('execinfo.h')
|
||||||
add_project_arguments('-DHAS_EXECINFO', language: 'cpp')
|
add_project_arguments('-DHAS_EXECINFO', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
aquamarine = dependency('aquamarine')
|
|
||||||
add_project_arguments(['-DAQUAMARINE_VERSION="@0@"'.format(aquamarine.version())], language: 'cpp')
|
|
||||||
|
|
||||||
xcb_dep = dependency('xcb', required: get_option('xwayland'))
|
xcb_dep = dependency('xcb', required: get_option('xwayland'))
|
||||||
xcb_composite_dep = dependency('xcb-composite', required: get_option('xwayland'))
|
xcb_composite_dep = dependency('xcb-composite', required: get_option('xwayland'))
|
||||||
xcb_errors_dep = dependency('xcb-errors', required: get_option('xwayland'))
|
xcb_errors_dep = dependency('xcb-errors', required: get_option('xwayland'))
|
||||||
@@ -41,7 +34,7 @@ xcb_render_dep = dependency('xcb-render', required: get_option('xwayland'))
|
|||||||
xcb_res_dep = dependency('xcb-res', required: get_option('xwayland'))
|
xcb_res_dep = dependency('xcb-res', required: get_option('xwayland'))
|
||||||
xcb_xfixes_dep = dependency('xcb-xfixes', required: get_option('xwayland'))
|
xcb_xfixes_dep = dependency('xcb-xfixes', required: get_option('xwayland'))
|
||||||
|
|
||||||
gio_dep = dependency('gio-2.0', required: true)
|
gio_dep = dependency('gio-2.0', required:true)
|
||||||
|
|
||||||
cmake = import('cmake')
|
cmake = import('cmake')
|
||||||
udis = cmake.subproject('udis86')
|
udis = cmake.subproject('udis86')
|
||||||
@@ -54,7 +47,6 @@ endif
|
|||||||
backtrace_dep = cpp_compiler.find_library('execinfo', required: false)
|
backtrace_dep = cpp_compiler.find_library('execinfo', required: false)
|
||||||
epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs
|
epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs
|
||||||
|
|
||||||
# Handle options
|
|
||||||
if get_option('systemd').enabled()
|
if get_option('systemd').enabled()
|
||||||
add_project_arguments('-DUSES_SYSTEMD', language: 'cpp')
|
add_project_arguments('-DUSES_SYSTEMD', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
@@ -67,10 +59,8 @@ if get_option('buildtype') == 'debug'
|
|||||||
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
|
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Generate hyprland version and populate version.h
|
version_h = run_command('sh', '-c', 'scripts/generateVersion.sh', check: true)
|
||||||
run_command('sh', '-c', 'scripts/generateVersion.sh', check: true)
|
|
||||||
|
|
||||||
# Install headers
|
|
||||||
globber = run_command('find', 'src', '-name', '*.h*', check: true)
|
globber = run_command('find', 'src', '-name', '*.h*', check: true)
|
||||||
headers = globber.stdout().strip().split('\n')
|
headers = globber.stdout().strip().split('\n')
|
||||||
foreach file : headers
|
foreach file : headers
|
||||||
@@ -85,7 +75,6 @@ subdir('assets')
|
|||||||
subdir('example')
|
subdir('example')
|
||||||
subdir('docs')
|
subdir('docs')
|
||||||
|
|
||||||
# Generate hyprland.pc
|
|
||||||
pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')
|
pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')
|
||||||
|
|
||||||
import('pkgconfig').generate(
|
import('pkgconfig').generate(
|
||||||
|
@@ -1,10 +0,0 @@
|
|||||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
|
||||||
index 6fdf98db..d8424d91 100644
|
|
||||||
--- a/CMakeLists.txt
|
|
||||||
+++ b/CMakeLists.txt
|
|
||||||
@@ -1,4 +1,4 @@
|
|
||||||
-cmake_minimum_required(VERSION 3.30)
|
|
||||||
+cmake_minimum_required(VERSION 3.27)
|
|
||||||
|
|
||||||
# Get version
|
|
||||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
|
@@ -1,30 +1,41 @@
|
|||||||
{
|
{
|
||||||
lib,
|
lib,
|
||||||
stdenv,
|
stdenv,
|
||||||
stdenvAdapters,
|
|
||||||
pkg-config,
|
pkg-config,
|
||||||
pkgconf,
|
pkgconf,
|
||||||
makeWrapper,
|
makeWrapper,
|
||||||
cmake,
|
cmake,
|
||||||
|
ninja,
|
||||||
aquamarine,
|
aquamarine,
|
||||||
binutils,
|
binutils,
|
||||||
cairo,
|
cairo,
|
||||||
|
expat,
|
||||||
|
fribidi,
|
||||||
git,
|
git,
|
||||||
|
hwdata,
|
||||||
hyprcursor,
|
hyprcursor,
|
||||||
hyprlang,
|
hyprlang,
|
||||||
hyprutils,
|
hyprutils,
|
||||||
hyprwayland-scanner,
|
hyprwayland-scanner,
|
||||||
jq,
|
jq,
|
||||||
libGL,
|
libGL,
|
||||||
|
libdatrie,
|
||||||
|
libdisplay-info,
|
||||||
libdrm,
|
libdrm,
|
||||||
libexecinfo,
|
libexecinfo,
|
||||||
libinput,
|
libinput,
|
||||||
libxkbcommon,
|
libliftoff,
|
||||||
|
libselinux,
|
||||||
|
libsepol,
|
||||||
|
libthai,
|
||||||
libuuid,
|
libuuid,
|
||||||
|
libxkbcommon,
|
||||||
mesa,
|
mesa,
|
||||||
pango,
|
pango,
|
||||||
pciutils,
|
pciutils,
|
||||||
|
pcre2,
|
||||||
python3,
|
python3,
|
||||||
|
seatd,
|
||||||
systemd,
|
systemd,
|
||||||
tomlplusplus,
|
tomlplusplus,
|
||||||
wayland,
|
wayland,
|
||||||
@@ -39,47 +50,30 @@
|
|||||||
wrapRuntimeDeps ? true,
|
wrapRuntimeDeps ? true,
|
||||||
version ? "git",
|
version ? "git",
|
||||||
commit,
|
commit,
|
||||||
revCount,
|
|
||||||
date,
|
date,
|
||||||
# deprecated flags
|
# deprecated flags
|
||||||
enableNvidiaPatches ? false,
|
enableNvidiaPatches ? false,
|
||||||
nvidiaPatches ? false,
|
nvidiaPatches ? false,
|
||||||
hidpiXWayland ? false,
|
hidpiXWayland ? false,
|
||||||
}: let
|
}:
|
||||||
inherit (builtins) baseNameOf foldl';
|
assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
||||||
inherit (lib.asserts) assertMsg;
|
assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
|
||||||
inherit (lib.lists) flatten concatLists optional optionals;
|
stdenv.mkDerivation {
|
||||||
inherit (lib.sources) cleanSourceWith cleanSource;
|
pname = "hyprland${lib.optionalString debug "-debug"}";
|
||||||
inherit (lib.strings) cmakeBool hasSuffix makeBinPath optionalString;
|
|
||||||
|
|
||||||
adapters = flatten [
|
|
||||||
stdenvAdapters.useMoldLinker
|
|
||||||
];
|
|
||||||
|
|
||||||
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
|
|
||||||
in
|
|
||||||
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
|
||||||
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
|
||||||
assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
|
|
||||||
customStdenv.mkDerivation {
|
|
||||||
pname = "hyprland${optionalString debug "-debug"}";
|
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
src = cleanSourceWith {
|
src = lib.cleanSourceWith {
|
||||||
filter = name: type: let
|
filter = name: type: let
|
||||||
baseName = baseNameOf (toString name);
|
baseName = baseNameOf (toString name);
|
||||||
in
|
in
|
||||||
! (hasSuffix ".nix" baseName);
|
! (lib.hasSuffix ".nix" baseName);
|
||||||
src = cleanSource ../.;
|
src = lib.cleanSource ../.;
|
||||||
};
|
};
|
||||||
|
|
||||||
patches = [
|
patches = [
|
||||||
# forces GCC to use -std=c++26
|
# forces GCC to use -std=c++26
|
||||||
./stdcxx.patch
|
./stdcxx.patch
|
||||||
|
|
||||||
# Nix does not have CMake 3.30 yet, so override the minimum version
|
|
||||||
./cmake-version.patch
|
|
||||||
];
|
];
|
||||||
|
|
||||||
postPatch = ''
|
postPatch = ''
|
||||||
@@ -90,23 +84,21 @@ in
|
|||||||
sed -i "s#@PREFIX@/##g" hyprland.pc.in
|
sed -i "s#@PREFIX@/##g" hyprland.pc.in
|
||||||
'';
|
'';
|
||||||
|
|
||||||
COMMITS = revCount;
|
COMMITS = commit;
|
||||||
DATE = date;
|
DATE = date;
|
||||||
DIRTY = optionalString (commit == "") "dirty";
|
DIRTY = lib.optionalString (commit == "") "dirty";
|
||||||
HASH = commit;
|
HASH = commit;
|
||||||
|
|
||||||
depsBuildBuild = [
|
|
||||||
pkg-config
|
|
||||||
];
|
|
||||||
|
|
||||||
nativeBuildInputs = [
|
nativeBuildInputs = [
|
||||||
hyprwayland-scanner
|
hyprwayland-scanner
|
||||||
jq
|
jq
|
||||||
makeWrapper
|
makeWrapper
|
||||||
cmake
|
cmake
|
||||||
|
ninja
|
||||||
pkg-config
|
pkg-config
|
||||||
python3 # for udis86
|
python3 # for udis86
|
||||||
wayland-scanner
|
# re-add after https://github.com/NixOS/nixpkgs/pull/214906 hits nixos-unstable
|
||||||
|
# wayland-scanner
|
||||||
];
|
];
|
||||||
|
|
||||||
outputs = [
|
outputs = [
|
||||||
@@ -115,37 +107,49 @@ in
|
|||||||
"dev"
|
"dev"
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = concatLists [
|
buildInputs = lib.concatLists [
|
||||||
[
|
[
|
||||||
aquamarine
|
aquamarine
|
||||||
cairo
|
cairo
|
||||||
|
expat
|
||||||
|
fribidi
|
||||||
git
|
git
|
||||||
|
hwdata
|
||||||
hyprcursor
|
hyprcursor
|
||||||
hyprlang
|
hyprlang
|
||||||
hyprutils
|
hyprutils
|
||||||
|
libdatrie
|
||||||
|
libdisplay-info
|
||||||
libdrm
|
libdrm
|
||||||
libGL
|
libGL
|
||||||
libinput
|
libinput
|
||||||
|
libliftoff
|
||||||
|
libselinux
|
||||||
|
libsepol
|
||||||
|
libthai
|
||||||
libuuid
|
libuuid
|
||||||
libxkbcommon
|
libxkbcommon
|
||||||
mesa
|
mesa
|
||||||
pango
|
pango
|
||||||
pciutils
|
pciutils
|
||||||
|
pcre2
|
||||||
|
seatd
|
||||||
tomlplusplus
|
tomlplusplus
|
||||||
wayland
|
wayland
|
||||||
wayland-protocols
|
wayland-protocols
|
||||||
xorg.libXcursor
|
xorg.libXcursor
|
||||||
]
|
]
|
||||||
(optionals customStdenv.hostPlatform.isMusl [libexecinfo])
|
(lib.optionals stdenv.hostPlatform.isMusl [libexecinfo])
|
||||||
(optionals enableXWayland [
|
(lib.optionals enableXWayland [
|
||||||
xorg.libxcb
|
xorg.libxcb
|
||||||
xorg.libXdmcp
|
xorg.libXdmcp
|
||||||
|
xorg.xcbutil
|
||||||
xorg.xcbutilerrors
|
xorg.xcbutilerrors
|
||||||
xorg.xcbutilrenderutil
|
xorg.xcbutilrenderutil
|
||||||
xorg.xcbutilwm
|
xorg.xcbutilwm
|
||||||
xwayland
|
xwayland
|
||||||
])
|
])
|
||||||
(optional withSystemd systemd)
|
(lib.optionals withSystemd [systemd])
|
||||||
];
|
];
|
||||||
|
|
||||||
cmakeBuildType =
|
cmakeBuildType =
|
||||||
@@ -156,17 +160,16 @@ in
|
|||||||
# we want as much debug info as possible
|
# we want as much debug info as possible
|
||||||
dontStrip = debug;
|
dontStrip = debug;
|
||||||
|
|
||||||
cmakeFlags = mapAttrsToList cmakeBool {
|
cmakeFlags = [
|
||||||
"NO_XWAYLAND" = !enableXWayland;
|
(lib.cmakeBool "NO_XWAYLAND" (!enableXWayland))
|
||||||
"LEGACY_RENDERER" = legacyRenderer;
|
(lib.cmakeBool "LEGACY_RENDERER" legacyRenderer)
|
||||||
"NO_SYSTEMD" = !withSystemd;
|
(lib.cmakeBool "NO_SYSTEMD" (!withSystemd))
|
||||||
"CMAKE_DISABLE_PRECOMPILE_HEADERS" = true;
|
];
|
||||||
};
|
|
||||||
|
|
||||||
postInstall = ''
|
postInstall = ''
|
||||||
${optionalString wrapRuntimeDeps ''
|
${lib.optionalString wrapRuntimeDeps ''
|
||||||
wrapProgram $out/bin/Hyprland \
|
wrapProgram $out/bin/Hyprland \
|
||||||
--suffix PATH : ${makeBinPath [
|
--suffix PATH : ${lib.makeBinPath [
|
||||||
binutils
|
binutils
|
||||||
pciutils
|
pciutils
|
||||||
pkgconf
|
pkgconf
|
||||||
|
@@ -34,7 +34,6 @@ in {
|
|||||||
stdenv = final.gcc14Stdenv;
|
stdenv = final.gcc14Stdenv;
|
||||||
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
|
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
|
||||||
commit = self.rev or "";
|
commit = self.rev or "";
|
||||||
revCount = self.sourceInfo.revCount or "";
|
|
||||||
inherit date;
|
inherit date;
|
||||||
};
|
};
|
||||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||||
|
@@ -1,75 +1,76 @@
|
|||||||
wayland_protos = dependency(
|
wayland_protos = dependency('wayland-protocols',
|
||||||
'wayland-protocols',
|
|
||||||
version: '>=1.32',
|
version: '>=1.32',
|
||||||
fallback: 'wayland-protocols',
|
fallback: 'wayland-protocols',
|
||||||
default_options: ['tests=false'],
|
default_options: ['tests=false'],
|
||||||
)
|
)
|
||||||
|
|
||||||
hyprland_protos = dependency(
|
hyprland_protos = dependency('hyprland-protocols',
|
||||||
'hyprland-protocols',
|
|
||||||
version: '>=0.2',
|
version: '>=0.2',
|
||||||
fallback: 'hyprland-protocols',
|
fallback: 'hyprland-protocols',
|
||||||
)
|
)
|
||||||
|
|
||||||
wayland_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
||||||
hyprland_protocol_dir = hyprland_protos.get_variable('pkgdatadir')
|
hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir')
|
||||||
|
|
||||||
hyprwayland_scanner_dep = dependency('hyprwayland-scanner', version: '>=0.3.10', native: true)
|
hyprwayland_scanner_dep = dependency('hyprwayland-scanner', version: '>=0.3.8', native: true)
|
||||||
hyprwayland_scanner = find_program(
|
hyprwayland_scanner = find_program(
|
||||||
hyprwayland_scanner_dep.get_variable('hyprwayland_scanner'),
|
hyprwayland_scanner_dep.get_variable('hyprwayland_scanner'),
|
||||||
native: true,
|
native: true,
|
||||||
)
|
)
|
||||||
|
|
||||||
protocols = [
|
new_protocols = [
|
||||||
'wlr-gamma-control-unstable-v1.xml',
|
['wlr-gamma-control-unstable-v1.xml'],
|
||||||
'wlr-foreign-toplevel-management-unstable-v1.xml',
|
['wlr-foreign-toplevel-management-unstable-v1.xml'],
|
||||||
'wlr-output-power-management-unstable-v1.xml',
|
['wlr-output-power-management-unstable-v1.xml'],
|
||||||
'input-method-unstable-v2.xml',
|
['input-method-unstable-v2.xml'],
|
||||||
'virtual-keyboard-unstable-v1.xml',
|
['virtual-keyboard-unstable-v1.xml'],
|
||||||
'wlr-virtual-pointer-unstable-v1.xml',
|
['wlr-virtual-pointer-unstable-v1.xml'],
|
||||||
'wlr-output-management-unstable-v1.xml',
|
['wlr-output-management-unstable-v1.xml'],
|
||||||
'kde-server-decoration.xml',
|
['kde-server-decoration.xml'],
|
||||||
'wlr-layer-shell-unstable-v1.xml',
|
['wlr-layer-shell-unstable-v1.xml'],
|
||||||
'wayland-drm.xml',
|
['wayland-drm.xml'],
|
||||||
'wlr-data-control-unstable-v1.xml',
|
['wlr-data-control-unstable-v1.xml'],
|
||||||
'wlr-screencopy-unstable-v1.xml',
|
['wlr-screencopy-unstable-v1.xml'],
|
||||||
hyprland_protocol_dir / 'protocols/hyprland-global-shortcuts-v1.xml',
|
[hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml'],
|
||||||
hyprland_protocol_dir / 'protocols/hyprland-toplevel-export-v1.xml',
|
[hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml'],
|
||||||
hyprland_protocol_dir / 'protocols/hyprland-focus-grab-v1.xml',
|
[hl_protocol_dir, 'protocols/hyprland-focus-grab-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/tearing-control/tearing-control-v1.xml',
|
[wl_protocol_dir, 'staging/tearing-control/tearing-control-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/fractional-scale/fractional-scale-v1.xml',
|
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
[wl_protocol_dir, 'staging/cursor-shape/cursor-shape-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/relative-pointer/relative-pointer-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/alpha-modifier/alpha-modifier-v1.xml',
|
[wl_protocol_dir, 'staging/alpha-modifier/alpha-modifier-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml',
|
[wl_protocol_dir, 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/text-input/text-input-unstable-v3.xml',
|
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v3.xml'],
|
||||||
wayland_protocol_dir / 'unstable/text-input/text-input-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/xdg-activation/xdg-activation-v1.xml',
|
[wl_protocol_dir, 'staging/xdg-activation/xdg-activation-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/ext-idle-notify/ext-idle-notify-v1.xml',
|
[wl_protocol_dir, 'staging/ext-idle-notify/ext-idle-notify-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/ext-session-lock/ext-session-lock-v1.xml',
|
[wl_protocol_dir, 'staging/ext-session-lock/ext-session-lock-v1.xml'],
|
||||||
wayland_protocol_dir / 'stable/tablet/tablet-v2.xml',
|
[wl_protocol_dir, 'stable/tablet/tablet-v2.xml'],
|
||||||
wayland_protocol_dir / 'stable/presentation-time/presentation-time.xml',
|
[wl_protocol_dir, 'stable/presentation-time/presentation-time.xml'],
|
||||||
wayland_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
|
||||||
wayland_protocol_dir / 'unstable/primary-selection/primary-selection-unstable-v1.xml',
|
[wl_protocol_dir, 'unstable/primary-selection/primary-selection-unstable-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/xwayland-shell/xwayland-shell-v1.xml',
|
[wl_protocol_dir, 'staging/xwayland-shell/xwayland-shell-v1.xml'],
|
||||||
wayland_protocol_dir / 'stable/viewporter/viewporter.xml',
|
[wl_protocol_dir, 'stable/viewporter/viewporter.xml'],
|
||||||
wayland_protocol_dir / 'stable/linux-dmabuf/linux-dmabuf-v1.xml',
|
[wl_protocol_dir, 'stable/linux-dmabuf/linux-dmabuf-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/drm-lease/drm-lease-v1.xml',
|
[wl_protocol_dir, 'staging/drm-lease/drm-lease-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml',
|
[wl_protocol_dir, 'staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml'],
|
||||||
wayland_protocol_dir / 'staging/xdg-dialog/xdg-dialog-v1.xml',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
wl_protocols = []
|
wl_protos_src = []
|
||||||
foreach protocol : protocols
|
wl_protos_headers = []
|
||||||
wl_protocols += custom_target(
|
|
||||||
protocol.underscorify(),
|
new_wl_protos = []
|
||||||
input: protocol,
|
foreach p : new_protocols
|
||||||
|
xml = join_paths(p)
|
||||||
|
new_wl_protos += custom_target(
|
||||||
|
xml.underscorify(),
|
||||||
|
input: xml,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')],
|
install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')],
|
||||||
output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
|
output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
|
||||||
@@ -77,26 +78,31 @@ foreach protocol : protocols
|
|||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
# wayland.xml generation
|
wayland_server_dep = dependency('wayland-server', version: '>=1.20.0')
|
||||||
wayland_scanner = dependency('wayland-scanner')
|
wayland_server_dir = wayland_server_dep.get_variable('pkgdatadir')
|
||||||
wayland_scanner_datadir = wayland_scanner.get_variable('pkgdatadir')
|
|
||||||
|
|
||||||
wayland_xml = wayland_scanner_datadir / 'wayland.xml'
|
wl_server_protos = [
|
||||||
wayland_protocol = custom_target(
|
wayland_server_dir / 'wayland.xml'
|
||||||
wayland_xml.underscorify(),
|
]
|
||||||
input: wayland_xml,
|
wl_server_protos_gen = []
|
||||||
|
foreach p : wl_server_protos
|
||||||
|
wl_server_protos_gen += custom_target(
|
||||||
|
p.underscorify(),
|
||||||
|
input: p,
|
||||||
install: true,
|
install: true,
|
||||||
install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')],
|
install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')],
|
||||||
output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
|
output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
|
||||||
command: [hyprwayland_scanner, '--wayland-enums', '@INPUT@', '@OUTDIR@'],
|
command: [hyprwayland_scanner, '--wayland-enums', '@INPUT@', '@OUTDIR@'],
|
||||||
)
|
)
|
||||||
|
endforeach
|
||||||
|
|
||||||
lib_server_protos = static_library(
|
lib_server_protos = static_library(
|
||||||
'server_protos',
|
'server_protos',
|
||||||
wl_protocols + wayland_protocol,
|
wl_protos_src + wl_protos_headers + new_wl_protos + wl_server_protos_gen,
|
||||||
|
dependencies: wayland_server_dep.partial_dependency(compile_args: true),
|
||||||
)
|
)
|
||||||
|
|
||||||
server_protos = declare_dependency(
|
server_protos = declare_dependency(
|
||||||
link_with: lib_server_protos,
|
link_with: lib_server_protos,
|
||||||
sources: wl_protocols + wayland_protocol,
|
sources: wl_protos_headers + new_wl_protos,
|
||||||
)
|
)
|
||||||
|
@@ -314,7 +314,7 @@ void CCompositor::initServer(std::string socketName, int socketFd) {
|
|||||||
|
|
||||||
initManagers(STAGE_LATE);
|
initManagers(STAGE_LATE);
|
||||||
|
|
||||||
for (auto const& o : pendingOutputs) {
|
for (auto& o : pendingOutputs) {
|
||||||
onNewMonitor(o);
|
onNewMonitor(o);
|
||||||
}
|
}
|
||||||
pendingOutputs.clear();
|
pendingOutputs.clear();
|
||||||
@@ -391,7 +391,7 @@ void CCompositor::initAllSignals() {
|
|||||||
|
|
||||||
m_bSessionActive = true;
|
m_bSessionActive = true;
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
scheduleFrameForMonitor(m.get());
|
scheduleFrameForMonitor(m.get());
|
||||||
g_pHyprRenderer->applyMonitorRule(m.get(), &m->activeMonitorRule, true);
|
g_pHyprRenderer->applyMonitorRule(m.get(), &m->activeMonitorRule, true);
|
||||||
}
|
}
|
||||||
@@ -403,7 +403,7 @@ void CCompositor::initAllSignals() {
|
|||||||
|
|
||||||
m_bSessionActive = false;
|
m_bSessionActive = false;
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
m->noFrameSchedule = true;
|
m->noFrameSchedule = true;
|
||||||
m->framesToSkip = 1;
|
m->framesToSkip = 1;
|
||||||
}
|
}
|
||||||
@@ -477,7 +477,7 @@ void CCompositor::cleanup() {
|
|||||||
m_vWorkspaces.clear();
|
m_vWorkspaces.clear();
|
||||||
m_vWindows.clear();
|
m_vWindows.clear();
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
g_pHyprOpenGL->destroyMonitorResources(m.get());
|
g_pHyprOpenGL->destroyMonitorResources(m.get());
|
||||||
|
|
||||||
m->output->state->setEnabled(false);
|
m->output->state->setEnabled(false);
|
||||||
@@ -615,7 +615,7 @@ void CCompositor::initManagers(eManagersInitStage stage) {
|
|||||||
g_pCursorManager = std::make_unique<CCursorManager>();
|
g_pCursorManager = std::make_unique<CCursorManager>();
|
||||||
|
|
||||||
Debug::log(LOG, "Starting XWayland");
|
Debug::log(LOG, "Starting XWayland");
|
||||||
g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bEnableXwayland);
|
g_pXWayland = std::make_unique<CXWayland>();
|
||||||
} break;
|
} break;
|
||||||
default: UNREACHABLE();
|
default: UNREACHABLE();
|
||||||
}
|
}
|
||||||
@@ -641,7 +641,7 @@ void CCompositor::removeLockFile() {
|
|||||||
void CCompositor::prepareFallbackOutput() {
|
void CCompositor::prepareFallbackOutput() {
|
||||||
// create a backup monitor
|
// create a backup monitor
|
||||||
SP<Aquamarine::IBackendImplementation> headless;
|
SP<Aquamarine::IBackendImplementation> headless;
|
||||||
for (auto const& impl : m_pAqBackend->getImplementations()) {
|
for (auto& impl : m_pAqBackend->getImplementations()) {
|
||||||
if (impl->type() == Aquamarine::AQ_BACKEND_HEADLESS) {
|
if (impl->type() == Aquamarine::AQ_BACKEND_HEADLESS) {
|
||||||
headless = impl;
|
headless = impl;
|
||||||
break;
|
break;
|
||||||
@@ -698,7 +698,7 @@ void CCompositor::startCompositor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromID(const MONITORID& id) {
|
CMonitor* CCompositor::getMonitorFromID(const MONITORID& id) {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->ID == id) {
|
if (m->ID == id) {
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
@@ -708,7 +708,7 @@ CMonitor* CCompositor::getMonitorFromID(const MONITORID& id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->szName == name) {
|
if (m->szName == name) {
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
@@ -717,7 +717,7 @@ CMonitor* CCompositor::getMonitorFromName(const std::string& name) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromDesc(const std::string& desc) {
|
CMonitor* CCompositor::getMonitorFromDesc(const std::string& desc) {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->szDescription.starts_with(desc))
|
if (m->szDescription.starts_with(desc))
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
@@ -730,7 +730,7 @@ CMonitor* CCompositor::getMonitorFromCursor() {
|
|||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
||||||
SP<CMonitor> mon;
|
SP<CMonitor> mon;
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (CBox{m->vecPosition, m->vecSize}.containsPoint(point)) {
|
if (CBox{m->vecPosition, m->vecSize}.containsPoint(point)) {
|
||||||
mon = m;
|
mon = m;
|
||||||
break;
|
break;
|
||||||
@@ -741,7 +741,7 @@ CMonitor* CCompositor::getMonitorFromVector(const Vector2D& point) {
|
|||||||
float bestDistance = 0.f;
|
float bestDistance = 0.f;
|
||||||
SP<CMonitor> pBestMon;
|
SP<CMonitor> pBestMon;
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize);
|
float dist = vecToRectDistanceSquared(point, m->vecPosition, m->vecPosition + m->vecSize);
|
||||||
|
|
||||||
if (dist < bestDistance || !pBestMon) {
|
if (dist < bestDistance || !pBestMon) {
|
||||||
@@ -771,7 +771,7 @@ void CCompositor::removeWindowFromVectorSafe(PHLWINDOW pWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::monitorExists(CMonitor* pMonitor) {
|
bool CCompositor::monitorExists(CMonitor* pMonitor) {
|
||||||
for (auto const& m : m_vRealMonitors) {
|
for (auto& m : m_vRealMonitors) {
|
||||||
if (m.get() == pMonitor)
|
if (m.get() == pMonitor)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -789,9 +789,9 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||||||
|
|
||||||
// pinned windows on top of floating regardless
|
// pinned windows on top of floating regardless
|
||||||
if (properties & ALLOW_FLOATING) {
|
if (properties & ALLOW_FLOATING) {
|
||||||
for (auto const& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
const auto BB = w->getWindowBoxUnified(properties);
|
const auto BB = w->getWindowBoxUnified(properties);
|
||||||
CBox box = BB.copy().expand(!w->isX11OverrideRedirect() ? BORDER_GRAB_AREA : 0);
|
CBox box = BB.copy().expand(w->m_iX11Type != 2 ? BORDER_GRAB_AREA : 0);
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() &&
|
if (w->m_bIsFloating && w->m_bIsMapped && !w->isHidden() && !w->m_bX11ShouldntFocus && w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() &&
|
||||||
w != pIgnoreWindow) {
|
w != pIgnoreWindow) {
|
||||||
if (box.containsPoint(g_pPointerManager->position()))
|
if (box.containsPoint(g_pPointerManager->position()))
|
||||||
@@ -807,7 +807,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||||||
|
|
||||||
auto windowForWorkspace = [&](bool special) -> PHLWINDOW {
|
auto windowForWorkspace = [&](bool special) -> PHLWINDOW {
|
||||||
auto floating = [&](bool aboveFullscreen) -> PHLWINDOW {
|
auto floating = [&](bool aboveFullscreen) -> PHLWINDOW {
|
||||||
for (auto const& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
|
|
||||||
if (special && !w->onSpecialWorkspace()) // because special floating may creep up into regular
|
if (special && !w->onSpecialWorkspace()) // because special floating may creep up into regular
|
||||||
continue;
|
continue;
|
||||||
@@ -821,16 +821,16 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||||||
BB.x + BB.width <= PWINDOWMONITOR->vecPosition.x + PWINDOWMONITOR->vecSize.x && BB.y + BB.height <= PWINDOWMONITOR->vecPosition.y + PWINDOWMONITOR->vecSize.y)
|
BB.x + BB.width <= PWINDOWMONITOR->vecPosition.x + PWINDOWMONITOR->vecSize.x && BB.y + BB.height <= PWINDOWMONITOR->vecPosition.y + PWINDOWMONITOR->vecSize.y)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
CBox box = BB.copy().expand(!w->isX11OverrideRedirect() ? BORDER_GRAB_AREA : 0);
|
CBox box = BB.copy().expand(w->m_iX11Type != 2 ? BORDER_GRAB_AREA : 0);
|
||||||
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() &&
|
if (w->m_bIsFloating && w->m_bIsMapped && isWorkspaceVisible(w->m_pWorkspace) && !w->isHidden() && !w->m_bPinned && !w->m_sWindowData.noFocus.valueOrDefault() &&
|
||||||
w != pIgnoreWindow && (!aboveFullscreen || w->m_bCreatedOverFullscreen)) {
|
w != pIgnoreWindow && (!aboveFullscreen || w->m_bCreatedOverFullscreen)) {
|
||||||
// OR windows should add focus to parent
|
// OR windows should add focus to parent
|
||||||
if (w->m_bX11ShouldntFocus && !w->isX11OverrideRedirect())
|
if (w->m_bX11ShouldntFocus && w->m_iX11Type != 2)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (box.containsPoint(g_pPointerManager->position())) {
|
if (box.containsPoint(g_pPointerManager->position())) {
|
||||||
|
|
||||||
if (w->m_bIsX11 && w->isX11OverrideRedirect() && !w->m_pXWaylandSurface->wantsFocus()) {
|
if (w->m_bIsX11 && w->m_iX11Type == 2 && !w->m_pXWaylandSurface->wantsFocus()) {
|
||||||
// Override Redirect
|
// Override Redirect
|
||||||
return g_pCompositor->m_pLastWindow.lock(); // we kinda trick everything here.
|
return g_pCompositor->m_pLastWindow.lock(); // we kinda trick everything here.
|
||||||
// TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases.
|
// TODO: this is wrong, we should focus the parent, but idk how to get it considering it's nullptr in most cases.
|
||||||
@@ -870,7 +870,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||||||
return found;
|
return found;
|
||||||
|
|
||||||
// for windows, we need to check their extensions too, first.
|
// for windows, we need to check their extensions too, first.
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (special != w->onSpecialWorkspace())
|
if (special != w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -881,7 +881,7 @@ PHLWINDOW CCompositor::vectorToWindowUnified(const Vector2D& pos, uint8_t proper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (special != w->onSpecialWorkspace())
|
if (special != w->onSpecialWorkspace())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -963,7 +963,7 @@ Vector2D CCompositor::vectorToSurfaceLocal(const Vector2D& vec, PHLWINDOW pWindo
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CCompositor::getMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
CMonitor* CCompositor::getMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m->output == out) {
|
if (m->output == out) {
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
@@ -973,7 +973,7 @@ CMonitor* CCompositor::getMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CCompositor::getRealMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
CMonitor* CCompositor::getRealMonitorFromOutput(SP<Aquamarine::IOutput> out) {
|
||||||
for (auto const& m : m_vRealMonitors) {
|
for (auto& m : m_vRealMonitors) {
|
||||||
if (m->output == out) {
|
if (m->output == out) {
|
||||||
return m.get();
|
return m.get();
|
||||||
}
|
}
|
||||||
@@ -997,7 +997,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow && pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect() && !pWindow->m_pXWaylandSurface->wantsFocus())
|
if (pWindow && pWindow->m_bIsX11 && pWindow->m_iX11Type == 2 && !pWindow->m_pXWaylandSurface->wantsFocus())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->bringWindowToTop(pWindow);
|
g_pLayoutManager->getCurrentLayout()->bringWindowToTop(pWindow);
|
||||||
@@ -1071,7 +1071,7 @@ void CCompositor::focusWindow(PHLWINDOW pWindow, SP<CWLSurfaceResource> pSurface
|
|||||||
|
|
||||||
updateWindowAnimatedDecorationValues(PLASTWINDOW);
|
updateWindowAnimatedDecorationValues(PLASTWINDOW);
|
||||||
|
|
||||||
if (!pWindow->m_bIsX11 || !pWindow->isX11OverrideRedirect())
|
if (!pWindow->m_bIsX11 || pWindow->m_iX11Type == 1)
|
||||||
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
g_pXWaylandManager->activateWindow(PLASTWINDOW, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1117,7 +1117,7 @@ void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindo
|
|||||||
if (g_pSeatManager->state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->state.keyboardFocus == pWindowOwner->m_pWLSurface->resource()))
|
if (g_pSeatManager->state.keyboardFocus == pSurface || (pWindowOwner && g_pSeatManager->state.keyboardFocus == pWindowOwner->m_pWLSurface->resource()))
|
||||||
return; // Don't focus when already focused on this.
|
return; // Don't focus when already focused on this.
|
||||||
|
|
||||||
if (g_pSessionLockManager->isSessionLocked() && pSurface && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
if (g_pSessionLockManager->isSessionLocked() && !g_pSessionLockManager->isSurfaceSessionLock(pSurface))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (g_pSeatManager->seatGrab && !g_pSeatManager->seatGrab->accepts(pSurface)) {
|
if (g_pSeatManager->seatGrab && !g_pSeatManager->seatGrab->accepts(pSurface)) {
|
||||||
@@ -1164,8 +1164,8 @@ void CCompositor::focusSurface(SP<CWLSurfaceResource> pSurface, PHLWINDOW pWindo
|
|||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonitor* monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& pos, CMonitor* monitor, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||||
for (auto const& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
for (auto& lsl : monitor->m_aLayerSurfaceLayers | std::views::reverse) {
|
||||||
for (auto const& ls : lsl | std::views::reverse) {
|
for (auto& ls : lsl | std::views::reverse) {
|
||||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha.value() == 0.f)
|
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->mapped) || ls->alpha.value() == 0.f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1183,7 +1183,7 @@ SP<CWLSurfaceResource> CCompositor::vectorToLayerPopupSurface(const Vector2D& po
|
|||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
SP<CWLSurfaceResource> CCompositor::vectorToLayerSurface(const Vector2D& pos, std::vector<PHLLSREF>* layerSurfaces, Vector2D* sCoords, PHLLS* ppLayerSurfaceFound) {
|
||||||
for (auto const& ls : *layerSurfaces | std::views::reverse) {
|
for (auto& ls : *layerSurfaces | std::views::reverse) {
|
||||||
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.value() == 0.f)
|
if (ls->fadingOut || !ls->layerSurface || (ls->layerSurface && !ls->layerSurface->surface->mapped) || ls->alpha.value() == 0.f)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1212,7 +1212,7 @@ PHLWINDOW CCompositor::getWindowFromSurface(SP<CWLSurfaceResource> pSurface) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
|
PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if ((uint32_t)(((uint64_t)w.get()) & 0xFFFFFFFF) == handle) {
|
if ((uint32_t)(((uint64_t)w.get()) & 0xFFFFFFFF) == handle) {
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -1222,7 +1222,7 @@ PHLWINDOW CCompositor::getWindowFromHandle(uint32_t handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::getFullscreenWindowOnWorkspace(const WORKSPACEID& ID) {
|
PHLWINDOW CCompositor::getFullscreenWindowOnWorkspace(const WORKSPACEID& ID) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == ID && w->isFullscreen())
|
if (w->workspaceID() == ID && w->isFullscreen())
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -1246,7 +1246,7 @@ bool CCompositor::isWorkspaceVisibleNotCovered(PHLWORKSPACE w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWORKSPACE CCompositor::getWorkspaceByID(const WORKSPACEID& id) {
|
PHLWORKSPACE CCompositor::getWorkspaceByID(const WORKSPACEID& id) {
|
||||||
for (auto const& w : m_vWorkspaces) {
|
for (auto& w : m_vWorkspaces) {
|
||||||
if (w->m_iID == id && !w->inert())
|
if (w->m_iID == id && !w->inert())
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -1271,7 +1271,7 @@ void CCompositor::sanityCheckWorkspaces() {
|
|||||||
|
|
||||||
int CCompositor::getWindowsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled, std::optional<bool> onlyVisible) {
|
int CCompositor::getWindowsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled, std::optional<bool> onlyVisible) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() != id || !w->m_bIsMapped)
|
if (w->workspaceID() != id || !w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
if (onlyTiled.has_value() && w->m_bIsFloating == onlyTiled.value())
|
if (onlyTiled.has_value() && w->m_bIsFloating == onlyTiled.value())
|
||||||
@@ -1286,7 +1286,7 @@ int CCompositor::getWindowsOnWorkspace(const WORKSPACEID& id, std::optional<bool
|
|||||||
|
|
||||||
int CCompositor::getGroupsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled, std::optional<bool> onlyVisible) {
|
int CCompositor::getGroupsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled, std::optional<bool> onlyVisible) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() != id || !w->m_bIsMapped)
|
if (w->workspaceID() != id || !w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
if (!w->m_sGroupData.head)
|
if (!w->m_sGroupData.head)
|
||||||
@@ -1301,7 +1301,7 @@ int CCompositor::getGroupsOnWorkspace(const WORKSPACEID& id, std::optional<bool>
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::getUrgentWindow() {
|
PHLWINDOW CCompositor::getUrgentWindow() {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_bIsMapped && w->m_bIsUrgent)
|
if (w->m_bIsMapped && w->m_bIsUrgent)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -1310,7 +1310,7 @@ PHLWINDOW CCompositor::getUrgentWindow() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::hasUrgentWindowOnWorkspace(const WORKSPACEID& id) {
|
bool CCompositor::hasUrgentWindowOnWorkspace(const WORKSPACEID& id) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == id && w->m_bIsMapped && w->m_bIsUrgent)
|
if (w->workspaceID() == id && w->m_bIsMapped && w->m_bIsUrgent)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1319,7 +1319,7 @@ bool CCompositor::hasUrgentWindowOnWorkspace(const WORKSPACEID& id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::getFirstWindowOnWorkspace(const WORKSPACEID& id) {
|
PHLWINDOW CCompositor::getFirstWindowOnWorkspace(const WORKSPACEID& id) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == id && w->m_bIsMapped && !w->isHidden())
|
if (w->workspaceID() == id && w->m_bIsMapped && !w->isHidden())
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -1335,7 +1335,7 @@ PHLWINDOW CCompositor::getTopLeftWindowOnWorkspace(const WORKSPACEID& id) {
|
|||||||
|
|
||||||
const auto PMONITOR = getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
const auto PMONITOR = getMonitorFromID(PWORKSPACE->m_iMonitorID);
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() != id || !w->m_bIsMapped || w->isHidden())
|
if (w->workspaceID() != id || !w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1400,7 +1400,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
|
|||||||
else
|
else
|
||||||
toMove.emplace_front(pw);
|
toMove.emplace_front(pw);
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw && w != pw && std::find(toMove.begin(), toMove.end(), w) == toMove.end()) {
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsX11 && w->X11TransientFor() == pw && w != pw && std::find(toMove.begin(), toMove.end(), w) == toMove.end()) {
|
||||||
x11Stack(w, top, x11Stack);
|
x11Stack(w, top, x11Stack);
|
||||||
}
|
}
|
||||||
@@ -1416,7 +1416,7 @@ void CCompositor::changeWindowZOrder(PHLWINDOW pWindow, bool top) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::cleanupFadingOut(const MONITORID& monid) {
|
void CCompositor::cleanupFadingOut(const MONITORID& monid) {
|
||||||
for (auto const& ww : m_vWindowsFadingOut) {
|
for (auto& ww : m_vWindowsFadingOut) {
|
||||||
|
|
||||||
auto w = ww.lock();
|
auto w = ww.lock();
|
||||||
|
|
||||||
@@ -1441,7 +1441,7 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
|
|||||||
|
|
||||||
bool layersDirty = false;
|
bool layersDirty = false;
|
||||||
|
|
||||||
for (auto const& lsr : m_vSurfacesFadingOut) {
|
for (auto& lsr : m_vSurfacesFadingOut) {
|
||||||
|
|
||||||
auto ls = lsr.lock();
|
auto ls = lsr.lock();
|
||||||
|
|
||||||
@@ -1458,7 +1458,7 @@ void CCompositor::cleanupFadingOut(const MONITORID& monid) {
|
|||||||
g_pHyprOpenGL->markBlurDirtyForMonitor(getMonitorFromID(monid));
|
g_pHyprOpenGL->markBlurDirtyForMonitor(getMonitorFromID(monid));
|
||||||
|
|
||||||
if (ls->fadingOut && ls->readyToDelete && ls->isFadedOut()) {
|
if (ls->fadingOut && ls->readyToDelete && ls->isFadedOut()) {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
for (auto& lsl : m->m_aLayerSurfaceLayers) {
|
for (auto& lsl : m->m_aLayerSurfaceLayers) {
|
||||||
if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](auto& other) { return other == ls; }) != lsl.end()) {
|
if (!lsl.empty() && std::find_if(lsl.begin(), lsl.end(), [&](auto& other) { return other == ls; }) != lsl.end()) {
|
||||||
std::erase_if(lsl, [&](auto& other) { return other == ls || !other; });
|
std::erase_if(lsl, [&](auto& other) { return other == ls || !other; });
|
||||||
@@ -1530,7 +1530,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
|||||||
if (!pWindow->m_bIsFloating) {
|
if (!pWindow->m_bIsFloating) {
|
||||||
|
|
||||||
// for tiled windows, we calc edges
|
// for tiled windows, we calc edges
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1622,7 +1622,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
|||||||
float bestAngleAbs = 2.0 * M_PI;
|
float bestAngleAbs = 2.0 * M_PI;
|
||||||
constexpr float THRESHOLD = 0.3 * M_PI;
|
constexpr float THRESHOLD = 0.3 * M_PI;
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && !w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
if (w == pWindow || !w->m_bIsMapped || w->isHidden() || (!w->isFullscreen() && !w->m_bIsFloating) || !isWorkspaceVisible(w->m_pWorkspace))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1660,7 +1660,7 @@ PHLWINDOW CCompositor::getWindowInDirection(PHLWINDOW pWindow, char dir) {
|
|||||||
|
|
||||||
PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
|
PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
|
||||||
bool gotToWindow = false;
|
bool gotToWindow = false;
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w != pWindow && !gotToWindow)
|
if (w != pWindow && !gotToWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1676,7 +1676,7 @@ PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1689,7 +1689,7 @@ PHLWINDOW CCompositor::getNextWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
|
|||||||
|
|
||||||
PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
|
PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusableOnly, std::optional<bool> floating) {
|
||||||
bool gotToWindow = false;
|
bool gotToWindow = false;
|
||||||
for (auto const& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
if (w != pWindow && !gotToWindow)
|
if (w != pWindow && !gotToWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1705,7 +1705,7 @@ PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
|
|||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : m_vWindows | std::views::reverse) {
|
for (auto& w : m_vWindows | std::views::reverse) {
|
||||||
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
if (floating.has_value() && w->m_bIsFloating != floating.value())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1718,7 +1718,7 @@ PHLWINDOW CCompositor::getPrevWindowOnWorkspace(PHLWINDOW pWindow, bool focusabl
|
|||||||
|
|
||||||
WORKSPACEID CCompositor::getNextAvailableNamedWorkspace() {
|
WORKSPACEID CCompositor::getNextAvailableNamedWorkspace() {
|
||||||
WORKSPACEID lowest = -1337 + 1;
|
WORKSPACEID lowest = -1337 + 1;
|
||||||
for (auto const& w : m_vWorkspaces) {
|
for (auto& w : m_vWorkspaces) {
|
||||||
if (w->m_iID < -1 && w->m_iID < lowest)
|
if (w->m_iID < -1 && w->m_iID < lowest)
|
||||||
lowest = w->m_iID;
|
lowest = w->m_iID;
|
||||||
}
|
}
|
||||||
@@ -1727,7 +1727,7 @@ WORKSPACEID CCompositor::getNextAvailableNamedWorkspace() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWORKSPACE CCompositor::getWorkspaceByName(const std::string& name) {
|
PHLWORKSPACE CCompositor::getWorkspaceByName(const std::string& name) {
|
||||||
for (auto const& w : m_vWorkspaces) {
|
for (auto& w : m_vWorkspaces) {
|
||||||
if (w->m_szName == name && !w->inert())
|
if (w->m_szName == name && !w->inert())
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -1748,7 +1748,7 @@ PHLWORKSPACE CCompositor::getWorkspaceByString(const std::string& str) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CCompositor::isPointOnAnyMonitor(const Vector2D& point) {
|
bool CCompositor::isPointOnAnyMonitor(const Vector2D& point) {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (VECINRECT(point, m->vecPosition.x, m->vecPosition.y, m->vecSize.x + m->vecPosition.x, m->vecSize.y + m->vecPosition.y))
|
if (VECINRECT(point, m->vecPosition.x, m->vecPosition.y, m->vecSize.x + m->vecPosition.x, m->vecSize.y + m->vecPosition.y))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1779,7 +1779,7 @@ CMonitor* CCompositor::getMonitorInDirection(CMonitor* pSourceMonitor, const cha
|
|||||||
auto longestIntersect = -1;
|
auto longestIntersect = -1;
|
||||||
CMonitor* longestIntersectMonitor = nullptr;
|
CMonitor* longestIntersectMonitor = nullptr;
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (m == m_pLastMonitor)
|
if (m == m_pLastMonitor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1834,7 +1834,7 @@ CMonitor* CCompositor::getMonitorInDirection(CMonitor* pSourceMonitor, const cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::updateAllWindowsAnimatedDecorationValues() {
|
void CCompositor::updateAllWindowsAnimatedDecorationValues() {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped)
|
if (!w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1843,7 +1843,7 @@ void CCompositor::updateAllWindowsAnimatedDecorationValues() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::updateWorkspaceWindows(const int64_t& id) {
|
void CCompositor::updateWorkspaceWindows(const int64_t& id) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->workspaceID() != id)
|
if (!w->m_bIsMapped || w->workspaceID() != id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1888,8 +1888,6 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
|
|||||||
pWindow->m_fBorderFadeAnimationProgress = 1.f;
|
pWindow->m_fBorderFadeAnimationProgress = 1.f;
|
||||||
};
|
};
|
||||||
|
|
||||||
const bool IS_SHADOWED_BY_MODAL = pWindow->m_pXDGSurface && pWindow->m_pXDGSurface->toplevel && pWindow->m_pXDGSurface->toplevel->anyChildModal();
|
|
||||||
|
|
||||||
// border
|
// border
|
||||||
const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow);
|
const auto RENDERDATA = g_pLayoutManager->getCurrentLayout()->requestRenderHints(pWindow);
|
||||||
if (RENDERDATA.isBorderGradient)
|
if (RENDERDATA.isBorderGradient)
|
||||||
@@ -1923,19 +1921,14 @@ void CCompositor::updateWindowAnimatedDecorationValues(PHLWINDOW pWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// dim
|
// dim
|
||||||
float goalDim = 1.F;
|
if (pWindow == m_pLastWindow.lock() || pWindow->m_sWindowData.noDim.valueOrDefault() || !*PDIMENABLED) {
|
||||||
if (pWindow == m_pLastWindow.lock() || pWindow->m_sWindowData.noDim.valueOrDefault() || !*PDIMENABLED)
|
pWindow->m_fDimPercent = 0;
|
||||||
goalDim = 0;
|
} else {
|
||||||
else
|
pWindow->m_fDimPercent = *PDIMSTRENGTH;
|
||||||
goalDim = *PDIMSTRENGTH;
|
}
|
||||||
|
|
||||||
if (IS_SHADOWED_BY_MODAL)
|
|
||||||
goalDim += (1.F - goalDim) / 2.F;
|
|
||||||
|
|
||||||
pWindow->m_fDimPercent = goalDim;
|
|
||||||
|
|
||||||
// shadow
|
// shadow
|
||||||
if (!pWindow->isX11OverrideRedirect() && !pWindow->m_bX11DoesntWantBorders) {
|
if (pWindow->m_iX11Type != 2 && !pWindow->m_bX11DoesntWantBorders) {
|
||||||
if (pWindow == m_pLastWindow) {
|
if (pWindow == m_pLastWindow) {
|
||||||
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL);
|
pWindow->m_cRealShadowColor = CColor(*PSHADOWCOL);
|
||||||
} else {
|
} else {
|
||||||
@@ -1975,7 +1968,7 @@ void CCompositor::swapActiveWorkspaces(CMonitor* pMonitorA, CMonitor* pMonitorB)
|
|||||||
PWORKSPACEA->m_iMonitorID = pMonitorB->ID;
|
PWORKSPACEA->m_iMonitorID = pMonitorB->ID;
|
||||||
PWORKSPACEA->moveToMonitor(pMonitorB->ID);
|
PWORKSPACEA->moveToMonitor(pMonitorB->ID);
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_pWorkspace == PWORKSPACEA) {
|
if (w->m_pWorkspace == PWORKSPACEA) {
|
||||||
if (w->m_bPinned) {
|
if (w->m_bPinned) {
|
||||||
w->m_pWorkspace = PWORKSPACEB;
|
w->m_pWorkspace = PWORKSPACEB;
|
||||||
@@ -2000,7 +1993,7 @@ void CCompositor::swapActiveWorkspaces(CMonitor* pMonitorA, CMonitor* pMonitorB)
|
|||||||
PWORKSPACEB->m_iMonitorID = pMonitorA->ID;
|
PWORKSPACEB->m_iMonitorID = pMonitorA->ID;
|
||||||
PWORKSPACEB->moveToMonitor(pMonitorA->ID);
|
PWORKSPACEB->moveToMonitor(pMonitorA->ID);
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_pWorkspace == PWORKSPACEB) {
|
if (w->m_pWorkspace == PWORKSPACEB) {
|
||||||
if (w->m_bPinned) {
|
if (w->m_bPinned) {
|
||||||
w->m_pWorkspace = PWORKSPACEA;
|
w->m_pWorkspace = PWORKSPACEA;
|
||||||
@@ -2115,7 +2108,7 @@ CMonitor* CCompositor::getMonitorFromString(const std::string& name) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
if (!m->output)
|
if (!m->output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2146,7 +2139,7 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, CMonitor* pMon
|
|||||||
if (!SWITCHINGISACTIVE)
|
if (!SWITCHINGISACTIVE)
|
||||||
nextWorkspaceOnMonitorID = pWorkspace->m_iID;
|
nextWorkspaceOnMonitorID = pWorkspace->m_iID;
|
||||||
else {
|
else {
|
||||||
for (auto const& w : m_vWorkspaces) {
|
for (auto& w : m_vWorkspaces) {
|
||||||
if (w->m_iMonitorID == POLDMON->ID && w->m_iID != pWorkspace->m_iID && !w->m_bIsSpecialWorkspace) {
|
if (w->m_iMonitorID == POLDMON->ID && w->m_iID != pWorkspace->m_iID && !w->m_bIsSpecialWorkspace) {
|
||||||
nextWorkspaceOnMonitorID = w->m_iID;
|
nextWorkspaceOnMonitorID = w->m_iID;
|
||||||
break;
|
break;
|
||||||
@@ -2175,7 +2168,7 @@ void CCompositor::moveWorkspaceToMonitor(PHLWORKSPACE pWorkspace, CMonitor* pMon
|
|||||||
pWorkspace->m_iMonitorID = pMonitor->ID;
|
pWorkspace->m_iMonitorID = pMonitor->ID;
|
||||||
pWorkspace->moveToMonitor(pMonitor->ID);
|
pWorkspace->moveToMonitor(pMonitor->ID);
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_pWorkspace == pWorkspace) {
|
if (w->m_pWorkspace == pWorkspace) {
|
||||||
if (w->m_bPinned) {
|
if (w->m_bPinned) {
|
||||||
w->m_pWorkspace = g_pCompositor->getWorkspaceByID(nextWorkspaceOnMonitorID);
|
w->m_pWorkspace = g_pCompositor->getWorkspaceByID(nextWorkspaceOnMonitorID);
|
||||||
@@ -2244,7 +2237,7 @@ bool CCompositor::workspaceIDOutOfBounds(const WORKSPACEID& id) {
|
|||||||
WORKSPACEID lowestID = INT64_MAX;
|
WORKSPACEID lowestID = INT64_MAX;
|
||||||
WORKSPACEID highestID = INT64_MIN;
|
WORKSPACEID highestID = INT64_MIN;
|
||||||
|
|
||||||
for (auto const& w : m_vWorkspaces) {
|
for (auto& w : m_vWorkspaces) {
|
||||||
if (w->m_bIsSpecialWorkspace)
|
if (w->m_bIsSpecialWorkspace)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2262,7 +2255,7 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {
|
|||||||
|
|
||||||
const auto FULLSCREEN = pWorkspace->m_bHasFullscreenWindow;
|
const auto FULLSCREEN = pWorkspace->m_bHasFullscreenWindow;
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_pWorkspace == pWorkspace) {
|
if (w->m_pWorkspace == pWorkspace) {
|
||||||
|
|
||||||
if (w->m_bFadingOut || w->m_bPinned || w->isFullscreen())
|
if (w->m_bFadingOut || w->m_bPinned || w->isFullscreen())
|
||||||
@@ -2278,7 +2271,7 @@ void CCompositor::updateFullscreenFadeOnWorkspace(PHLWORKSPACE pWorkspace) {
|
|||||||
const auto PMONITOR = getMonitorFromID(pWorkspace->m_iMonitorID);
|
const auto PMONITOR = getMonitorFromID(pWorkspace->m_iMonitorID);
|
||||||
|
|
||||||
if (pWorkspace->m_iID == PMONITOR->activeWorkspaceID() || pWorkspace->m_iID == PMONITOR->activeSpecialWorkspaceID()) {
|
if (pWorkspace->m_iID == PMONITOR->activeWorkspaceID() || pWorkspace->m_iID == PMONITOR->activeSpecialWorkspaceID()) {
|
||||||
for (auto const& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
for (auto& ls : PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
|
||||||
if (!ls->fadingOut)
|
if (!ls->fadingOut)
|
||||||
ls->alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
ls->alpha = FULLSCREEN && pWorkspace->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||||
}
|
}
|
||||||
@@ -2354,7 +2347,7 @@ void CCompositor::setWindowFullscreenState(const PHLWINDOW PWINDOW, sFullscreenS
|
|||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->m_iMonitorID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PWINDOW->m_iMonitorID);
|
||||||
|
|
||||||
// make all windows on the same workspace under the fullscreen window
|
// make all windows on the same workspace under the fullscreen window
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->m_pWorkspace == PWORKSPACE && !w->isFullscreen() && !w->m_bFadingOut && !w->m_bPinned)
|
if (w->m_pWorkspace == PWORKSPACE && !w->isFullscreen() && !w->m_bFadingOut && !w->m_bPinned)
|
||||||
w->m_bCreatedOverFullscreen = false;
|
w->m_bCreatedOverFullscreen = false;
|
||||||
}
|
}
|
||||||
@@ -2383,7 +2376,7 @@ PHLWINDOW CCompositor::getX11Parent(PHLWINDOW pWindow) {
|
|||||||
if (!pWindow->m_bIsX11)
|
if (!pWindow->m_bIsX11)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsX11)
|
if (!w->m_bIsX11)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2395,7 +2388,7 @@ PHLWINDOW CCompositor::getX11Parent(PHLWINDOW pWindow) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::updateWorkspaceWindowDecos(const WORKSPACEID& id) {
|
void CCompositor::updateWorkspaceWindowDecos(const WORKSPACEID& id) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() != id)
|
if (w->workspaceID() != id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2407,7 +2400,7 @@ void CCompositor::updateWorkspaceWindowData(const WORKSPACEID& id) {
|
|||||||
const auto PWORKSPACE = getWorkspaceByID(id);
|
const auto PWORKSPACE = getWorkspaceByID(id);
|
||||||
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
const auto WORKSPACERULE = PWORKSPACE ? g_pConfigManager->getWorkspaceRuleFor(PWORKSPACE) : SWorkspaceRule{};
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() != id)
|
if (w->workspaceID() != id)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2460,7 +2453,7 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp) {
|
|||||||
|
|
||||||
const bool FLOAT = regexp.starts_with("floating");
|
const bool FLOAT = regexp.starts_with("floating");
|
||||||
|
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bIsFloating != FLOAT || w->m_pWorkspace != m_pLastWindow->m_pWorkspace || w->isHidden())
|
if (!w->m_bIsMapped || w->m_bIsFloating != FLOAT || w->m_pWorkspace != m_pLastWindow->m_pWorkspace || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2470,7 +2463,7 @@ PHLWINDOW CCompositor::getWindowByRegex(const std::string& regexp) {
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w)))
|
if (!w->m_bIsMapped || (w->isHidden() && !g_pLayoutManager->getCurrentLayout()->isWindowReachable(w)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2550,7 +2543,7 @@ void CCompositor::closeWindow(PHLWINDOW pWindow) {
|
|||||||
PHLLS CCompositor::getLayerSurfaceFromSurface(SP<CWLSurfaceResource> pSurface) {
|
PHLLS CCompositor::getLayerSurfaceFromSurface(SP<CWLSurfaceResource> pSurface) {
|
||||||
std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false};
|
std::pair<SP<CWLSurfaceResource>, bool> result = {pSurface, false};
|
||||||
|
|
||||||
for (auto const& ls : m_vLayers) {
|
for (auto& ls : m_vLayers) {
|
||||||
if (ls->layerSurface && ls->layerSurface->surface == pSurface)
|
if (ls->layerSurface && ls->layerSurface->surface == pSurface)
|
||||||
return ls;
|
return ls;
|
||||||
|
|
||||||
@@ -2624,14 +2617,14 @@ Vector2D CCompositor::parseWindowVectorArgsRelative(const std::string& args, con
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::forceReportSizesToWindowsOnWorkspace(const WORKSPACEID& wid) {
|
void CCompositor::forceReportSizesToWindowsOnWorkspace(const WORKSPACEID& wid) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w->workspaceID() == wid && w->m_bIsMapped && !w->isHidden()) {
|
if (w->workspaceID() == wid && w->m_bIsMapped && !w->isHidden()) {
|
||||||
g_pXWaylandManager->setWindowSize(w, w->m_vRealSize.value(), true);
|
g_pXWaylandManager->setWindowSize(w, w->m_vRealSize.value(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLWORKSPACE CCompositor::createNewWorkspace(const WORKSPACEID& id, const MONITORID& monid, const std::string& name, bool isEmpty) {
|
PHLWORKSPACE CCompositor::createNewWorkspace(const WORKSPACEID& id, const MONITORID& monid, const std::string& name, bool isEmtpy) {
|
||||||
const auto NAME = name == "" ? std::to_string(id) : name;
|
const auto NAME = name == "" ? std::to_string(id) : name;
|
||||||
auto monID = monid;
|
auto monID = monid;
|
||||||
|
|
||||||
@@ -2642,7 +2635,7 @@ PHLWORKSPACE CCompositor::createNewWorkspace(const WORKSPACEID& id, const MONITO
|
|||||||
|
|
||||||
const bool SPECIAL = id >= SPECIAL_WORKSPACE_START && id <= -2;
|
const bool SPECIAL = id >= SPECIAL_WORKSPACE_START && id <= -2;
|
||||||
|
|
||||||
const auto PWORKSPACE = m_vWorkspaces.emplace_back(CWorkspace::create(id, monID, NAME, SPECIAL, isEmpty));
|
const auto PWORKSPACE = m_vWorkspaces.emplace_back(CWorkspace::create(id, monID, NAME, SPECIAL, isEmtpy));
|
||||||
|
|
||||||
PWORKSPACE->m_fAlpha.setValueAndWarp(0);
|
PWORKSPACE->m_fAlpha.setValueAndWarp(0);
|
||||||
|
|
||||||
@@ -2686,7 +2679,7 @@ bool CCompositor::isWorkspaceSpecial(const WORKSPACEID& id) {
|
|||||||
|
|
||||||
WORKSPACEID CCompositor::getNewSpecialID() {
|
WORKSPACEID CCompositor::getNewSpecialID() {
|
||||||
WORKSPACEID highest = SPECIAL_WORKSPACE_START;
|
WORKSPACEID highest = SPECIAL_WORKSPACE_START;
|
||||||
for (auto const& ws : m_vWorkspaces) {
|
for (auto& ws : m_vWorkspaces) {
|
||||||
if (ws->m_bIsSpecialWorkspace && ws->m_iID > highest) {
|
if (ws->m_bIsSpecialWorkspace && ws->m_iID > highest) {
|
||||||
highest = ws->m_iID;
|
highest = ws->m_iID;
|
||||||
}
|
}
|
||||||
@@ -2696,17 +2689,7 @@ WORKSPACEID CCompositor::getNewSpecialID() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::performUserChecks() {
|
void CCompositor::performUserChecks() {
|
||||||
static auto PNOCHECKXDG = CConfigValue<Hyprlang::INT>("misc:disable_xdg_env_checks");
|
; // intentional
|
||||||
|
|
||||||
if (!*PNOCHECKXDG) {
|
|
||||||
const auto CURRENT_DESKTOP_ENV = getenv("XDG_CURRENT_DESKTOP");
|
|
||||||
if (!CURRENT_DESKTOP_ENV || std::string{CURRENT_DESKTOP_ENV} != "Hyprland") {
|
|
||||||
g_pHyprNotificationOverlay->addNotification(
|
|
||||||
std::format("Your XDG_CURRENT_DESKTOP environment seems to be managed externally, and the current value is {}.\nThis might cause issues unless it's intentional.",
|
|
||||||
CURRENT_DESKTOP_ENV ? CURRENT_DESKTOP_ENV : "unset"),
|
|
||||||
CColor{}, 15000, ICON_WARNING);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace) {
|
void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace) {
|
||||||
@@ -2761,7 +2744,7 @@ void CCompositor::moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWor
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::getForceFocus() {
|
PHLWINDOW CCompositor::getForceFocus() {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace))
|
if (!w->m_bIsMapped || w->isHidden() || !isWorkspaceVisible(w->m_pWorkspace))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2780,7 +2763,7 @@ void CCompositor::arrangeMonitors() {
|
|||||||
std::vector<CMonitor*> toArrange;
|
std::vector<CMonitor*> toArrange;
|
||||||
std::vector<CMonitor*> arranged;
|
std::vector<CMonitor*> arranged;
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors)
|
for (auto& m : m_vMonitors)
|
||||||
toArrange.push_back(m.get());
|
toArrange.push_back(m.get());
|
||||||
|
|
||||||
Debug::log(LOG, "arrangeMonitors: {} to arrange", toArrange.size());
|
Debug::log(LOG, "arrangeMonitors: {} to arrange", toArrange.size());
|
||||||
@@ -2812,7 +2795,7 @@ void CCompositor::arrangeMonitors() {
|
|||||||
int maxYOffsetDown = 0;
|
int maxYOffsetDown = 0;
|
||||||
|
|
||||||
// Finds the max and min values of explicitely placed monitors.
|
// Finds the max and min values of explicitely placed monitors.
|
||||||
for (auto const& m : arranged) {
|
for (auto& m : arranged) {
|
||||||
if (m->vecPosition.x + m->vecSize.x > maxXOffsetRight)
|
if (m->vecPosition.x + m->vecSize.x > maxXOffsetRight)
|
||||||
maxXOffsetRight = m->vecPosition.x + m->vecSize.x;
|
maxXOffsetRight = m->vecPosition.x + m->vecSize.x;
|
||||||
if (m->vecPosition.x < maxXOffsetLeft)
|
if (m->vecPosition.x < maxXOffsetLeft)
|
||||||
@@ -2824,7 +2807,7 @@ void CCompositor::arrangeMonitors() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Iterates through all non-explicitly placed monitors.
|
// Iterates through all non-explicitly placed monitors.
|
||||||
for (auto const& m : toArrange) {
|
for (auto& m : toArrange) {
|
||||||
// Moves the monitor to their appropriate position on the x/y axis and
|
// Moves the monitor to their appropriate position on the x/y axis and
|
||||||
// increments/decrements the corresponding max offset.
|
// increments/decrements the corresponding max offset.
|
||||||
Vector2D newPosition = {0, 0};
|
Vector2D newPosition = {0, 0};
|
||||||
@@ -2855,7 +2838,7 @@ void CCompositor::arrangeMonitors() {
|
|||||||
// reset maxXOffsetRight (reuse)
|
// reset maxXOffsetRight (reuse)
|
||||||
// and set xwayland positions aka auto for all
|
// and set xwayland positions aka auto for all
|
||||||
maxXOffsetRight = 0;
|
maxXOffsetRight = 0;
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {}]", m->szName, maxXOffsetRight, 0);
|
Debug::log(LOG, "arrangeMonitors: {} xwayland [{}, {}]", m->szName, maxXOffsetRight, 0);
|
||||||
m->vecXWaylandPosition = {maxXOffsetRight, 0};
|
m->vecXWaylandPosition = {maxXOffsetRight, 0};
|
||||||
maxXOffsetRight += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x);
|
maxXOffsetRight += (*PXWLFORCESCALEZERO ? m->vecTransformedSize.x : m->vecSize.x);
|
||||||
@@ -2890,7 +2873,7 @@ void CCompositor::leaveUnsafeState() {
|
|||||||
m_bUnsafeState = false;
|
m_bUnsafeState = false;
|
||||||
|
|
||||||
CMonitor* pNewMonitor = nullptr;
|
CMonitor* pNewMonitor = nullptr;
|
||||||
for (auto const& pMonitor : m_vMonitors) {
|
for (auto& pMonitor : m_vMonitors) {
|
||||||
if (pMonitor->output != m_pUnsafeOutput->output) {
|
if (pMonitor->output != m_pUnsafeOutput->output) {
|
||||||
pNewMonitor = pMonitor.get();
|
pNewMonitor = pMonitor.get();
|
||||||
break;
|
break;
|
||||||
@@ -2902,7 +2885,7 @@ void CCompositor::leaveUnsafeState() {
|
|||||||
if (m_pUnsafeOutput->m_bEnabled)
|
if (m_pUnsafeOutput->m_bEnabled)
|
||||||
m_pUnsafeOutput->onDisconnect();
|
m_pUnsafeOutput->onDisconnect();
|
||||||
|
|
||||||
for (auto const& m : m_vMonitors) {
|
for (auto& m : m_vMonitors) {
|
||||||
scheduleFrameForMonitor(m.get());
|
scheduleFrameForMonitor(m.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2934,7 +2917,7 @@ void CCompositor::setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurfac
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CCompositor::updateSuspendedStates() {
|
void CCompositor::updateSuspendedStates() {
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped)
|
if (!w->m_bIsMapped)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2943,7 +2926,7 @@ void CCompositor::updateSuspendedStates() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CCompositor::windowForCPointer(CWindow* pWindow) {
|
PHLWINDOW CCompositor::windowForCPointer(CWindow* pWindow) {
|
||||||
for (auto const& w : m_vWindows) {
|
for (auto& w : m_vWindows) {
|
||||||
if (w.get() != pWindow)
|
if (w.get() != pWindow)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2953,38 +2936,6 @@ PHLWINDOW CCompositor::windowForCPointer(CWindow* pWindow) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
static void checkDefaultCursorWarp(SP<CMonitor> monitor) {
|
|
||||||
static auto PCURSORMONITOR = CConfigValue<std::string>("cursor:default_monitor");
|
|
||||||
static bool cursorDefaultDone = false;
|
|
||||||
static bool firstLaunch = true;
|
|
||||||
|
|
||||||
const auto POS = monitor->middle();
|
|
||||||
|
|
||||||
// by default, cursor should be set to first monitor detected
|
|
||||||
// this is needed as a default if the monitor given in config above doesn't exist
|
|
||||||
if (firstLaunch) {
|
|
||||||
firstLaunch = false;
|
|
||||||
g_pCompositor->warpCursorTo(POS, true);
|
|
||||||
g_pInputManager->refocus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!cursorDefaultDone && *PCURSORMONITOR != STRVAL_EMPTY) {
|
|
||||||
if (*PCURSORMONITOR == monitor->szName) {
|
|
||||||
cursorDefaultDone = true;
|
|
||||||
g_pCompositor->warpCursorTo(POS, true);
|
|
||||||
g_pInputManager->refocus();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// modechange happend check if cursor is on that monitor and warp it to middle to not place it out of bounds if resolution changed.
|
|
||||||
if (g_pCompositor->getMonitorFromCursor() == monitor.get()) {
|
|
||||||
g_pCompositor->warpCursorTo(POS, true);
|
|
||||||
g_pInputManager->refocus();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
|
void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
|
||||||
// add it to real
|
// add it to real
|
||||||
auto PNEWMONITOR = g_pCompositor->m_vRealMonitors.emplace_back(makeShared<CMonitor>(output));
|
auto PNEWMONITOR = g_pCompositor->m_vRealMonitors.emplace_back(makeShared<CMonitor>(output));
|
||||||
@@ -3019,9 +2970,7 @@ void CCompositor::onNewMonitor(SP<Aquamarine::IOutput> output) {
|
|||||||
g_pConfigManager->m_bWantsMonitorReload = true;
|
g_pConfigManager->m_bWantsMonitorReload = true;
|
||||||
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR.get(), IOutput::AQ_SCHEDULE_NEW_MONITOR);
|
g_pCompositor->scheduleFrameForMonitor(PNEWMONITOR.get(), IOutput::AQ_SCHEDULE_NEW_MONITOR);
|
||||||
|
|
||||||
checkDefaultCursorWarp(PNEWMONITOR);
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (w->m_iMonitorID == PNEWMONITOR->ID) {
|
if (w->m_iMonitorID == PNEWMONITOR->ID) {
|
||||||
w->m_iLastSurfaceMonitorID = MONITOR_INVALID;
|
w->m_iLastSurfaceMonitorID = MONITOR_INVALID;
|
||||||
w->updateSurfaceScaleTransformDetails();
|
w->updateSurfaceScaleTransformDetails();
|
||||||
|
@@ -91,9 +91,7 @@ class CCompositor {
|
|||||||
bool m_bNextIsUnsafe = false;
|
bool m_bNextIsUnsafe = false;
|
||||||
CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state
|
CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state
|
||||||
bool m_bIsShuttingDown = false;
|
bool m_bIsShuttingDown = false;
|
||||||
bool m_bFinalRequests = false;
|
|
||||||
bool m_bDesktopEnvSet = false;
|
bool m_bDesktopEnvSet = false;
|
||||||
bool m_bEnableXwayland = true;
|
|
||||||
|
|
||||||
// ------------------------------------------------- //
|
// ------------------------------------------------- //
|
||||||
|
|
||||||
@@ -167,7 +165,7 @@ class CCompositor {
|
|||||||
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
||||||
void forceReportSizesToWindowsOnWorkspace(const WORKSPACEID&);
|
void forceReportSizesToWindowsOnWorkspace(const WORKSPACEID&);
|
||||||
PHLWORKSPACE createNewWorkspace(const WORKSPACEID&, const MONITORID&, const std::string& name = "",
|
PHLWORKSPACE createNewWorkspace(const WORKSPACEID&, const MONITORID&, const std::string& name = "",
|
||||||
bool isEmpty = true); // will be deleted next frame if left empty and unfocused!
|
bool isEmtpy = true); // will be deleted next frame if left empty and unfocused!
|
||||||
void renameWorkspace(const WORKSPACEID&, const std::string& name = "");
|
void renameWorkspace(const WORKSPACEID&, const std::string& name = "");
|
||||||
void setActiveMonitor(CMonitor*);
|
void setActiveMonitor(CMonitor*);
|
||||||
bool isWorkspaceSpecial(const WORKSPACEID&);
|
bool isWorkspaceSpecial(const WORKSPACEID&);
|
||||||
|
@@ -742,12 +742,6 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
},
|
},
|
||||||
SConfigOptionDescription{
|
|
||||||
.value = "group:merge_groups_on_drag",
|
|
||||||
.description = "whether window groups can be dragged into other groups",
|
|
||||||
.type = CONFIG_OPTION_BOOL,
|
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
|
||||||
},
|
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "general:col.border_active",
|
.value = "general:col.border_active",
|
||||||
.description = "border color for inactive windows",
|
.description = "border color for inactive windows",
|
||||||
@@ -1043,18 +1037,6 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||||||
.type = CONFIG_OPTION_BOOL,
|
.type = CONFIG_OPTION_BOOL,
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
.data = SConfigOptionDescription::SBoolData{true},
|
||||||
},
|
},
|
||||||
SConfigOptionDescription{
|
|
||||||
.value = "misc:render_unfocused_fps",
|
|
||||||
.description = "the maximum limit for renderunfocused windows' fps in the background",
|
|
||||||
.type = CONFIG_OPTION_INT,
|
|
||||||
.data = SConfigOptionDescription::SRangeData{15, 1, 120},
|
|
||||||
},
|
|
||||||
SConfigOptionDescription{
|
|
||||||
.value = "misc:disable_xdg_env_checks",
|
|
||||||
.description = "disable the warning if XDG environment is externally managed",
|
|
||||||
.type = CONFIG_OPTION_BOOL,
|
|
||||||
.data = SConfigOptionDescription::SBoolData{false},
|
|
||||||
},
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* binds:
|
* binds:
|
||||||
@@ -1127,12 +1109,6 @@ inline static const std::vector<SConfigOptionDescription> CONFIG_OPTIONS = {
|
|||||||
* xwayland:
|
* xwayland:
|
||||||
*/
|
*/
|
||||||
|
|
||||||
SConfigOptionDescription{
|
|
||||||
.value = "xwayland:enabled",
|
|
||||||
.description = "allow running applications using X11",
|
|
||||||
.type = CONFIG_OPTION_BOOL,
|
|
||||||
.data = SConfigOptionDescription::SBoolData{true},
|
|
||||||
},
|
|
||||||
SConfigOptionDescription{
|
SConfigOptionDescription{
|
||||||
.value = "xwayland:use_nearest_neighbor",
|
.value = "xwayland:use_nearest_neighbor",
|
||||||
.description = "uses the nearest neighbor filtering for xwayland apps, making them pixelated rather than blurry",
|
.description = "uses the nearest neighbor filtering for xwayland apps, making them pixelated rather than blurry",
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include "config/ConfigValue.hpp"
|
#include "config/ConfigValue.hpp"
|
||||||
#include "helpers/varlist/VarList.hpp"
|
#include "helpers/varlist/VarList.hpp"
|
||||||
#include "../protocols/LayerShell.hpp"
|
#include "../protocols/LayerShell.hpp"
|
||||||
#include "../xwayland/XWayland.hpp"
|
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@@ -46,7 +45,7 @@ static Hyprlang::CParseResult configHandleGradientSet(const char* VALUE, void**
|
|||||||
|
|
||||||
std::string parseError = "";
|
std::string parseError = "";
|
||||||
|
|
||||||
for (auto const& var : varlist) {
|
for (auto& var : varlist) {
|
||||||
if (var.find("deg") != std::string::npos) {
|
if (var.find("deg") != std::string::npos) {
|
||||||
// last arg
|
// last arg
|
||||||
try {
|
try {
|
||||||
@@ -141,18 +140,6 @@ static Hyprlang::CParseResult handleExecOnce(const char* c, const char* v) {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Hyprlang::CParseResult handleExecShutdown(const char* c, const char* v) {
|
|
||||||
const std::string VALUE = v;
|
|
||||||
const std::string COMMAND = c;
|
|
||||||
|
|
||||||
const auto RESULT = g_pConfigManager->handleExecShutdown(COMMAND, VALUE);
|
|
||||||
|
|
||||||
Hyprlang::CParseResult result;
|
|
||||||
if (RESULT.has_value())
|
|
||||||
result.setError(RESULT.value().c_str());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
static Hyprlang::CParseResult handleMonitor(const char* c, const char* v) {
|
static Hyprlang::CParseResult handleMonitor(const char* c, const char* v) {
|
||||||
const std::string VALUE = v;
|
const std::string VALUE = v;
|
||||||
const std::string COMMAND = c;
|
const std::string COMMAND = c;
|
||||||
@@ -370,12 +357,9 @@ CConfigManager::CConfigManager() {
|
|||||||
m_pConfig->addConfigValue("misc:exit_window_retains_fullscreen", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("misc:exit_window_retains_fullscreen", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("misc:initial_workspace_tracking", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("misc:initial_workspace_tracking", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("misc:middle_click_paste", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("misc:middle_click_paste", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("misc:render_unfocused_fps", Hyprlang::INT{15});
|
|
||||||
m_pConfig->addConfigValue("misc:disable_xdg_env_checks", Hyprlang::INT{0});
|
|
||||||
|
|
||||||
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:insert_after_current", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:focus_removed_window", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:merge_groups_on_drag", Hyprlang::INT{1});
|
|
||||||
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("group:groupbar:enabled", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
|
m_pConfig->addConfigValue("group:groupbar:font_family", {STRVAL_EMPTY});
|
||||||
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
|
m_pConfig->addConfigValue("group:groupbar:font_size", Hyprlang::INT{8});
|
||||||
@@ -538,7 +522,6 @@ CConfigManager::CConfigManager() {
|
|||||||
m_pConfig->addConfigValue("gestures:workspace_swipe_touch", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("gestures:workspace_swipe_touch", Hyprlang::INT{0});
|
||||||
m_pConfig->addConfigValue("gestures:workspace_swipe_touch_invert", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("gestures:workspace_swipe_touch_invert", Hyprlang::INT{0});
|
||||||
|
|
||||||
m_pConfig->addConfigValue("xwayland:enabled", Hyprlang::INT{1});
|
|
||||||
m_pConfig->addConfigValue("xwayland:use_nearest_neighbor", Hyprlang::INT{1});
|
m_pConfig->addConfigValue("xwayland:use_nearest_neighbor", Hyprlang::INT{1});
|
||||||
m_pConfig->addConfigValue("xwayland:force_zero_scaling", Hyprlang::INT{0});
|
m_pConfig->addConfigValue("xwayland:force_zero_scaling", Hyprlang::INT{0});
|
||||||
|
|
||||||
@@ -622,7 +605,6 @@ CConfigManager::CConfigManager() {
|
|||||||
// keywords
|
// keywords
|
||||||
m_pConfig->registerHandler(&::handleRawExec, "exec", {false});
|
m_pConfig->registerHandler(&::handleRawExec, "exec", {false});
|
||||||
m_pConfig->registerHandler(&::handleExecOnce, "exec-once", {false});
|
m_pConfig->registerHandler(&::handleExecOnce, "exec-once", {false});
|
||||||
m_pConfig->registerHandler(&::handleExecShutdown, "exec-shutdown", {false});
|
|
||||||
m_pConfig->registerHandler(&::handleMonitor, "monitor", {false});
|
m_pConfig->registerHandler(&::handleMonitor, "monitor", {false});
|
||||||
m_pConfig->registerHandler(&::handleBind, "bind", {true});
|
m_pConfig->registerHandler(&::handleBind, "bind", {true});
|
||||||
m_pConfig->registerHandler(&::handleUnbind, "unbind", {false});
|
m_pConfig->registerHandler(&::handleUnbind, "unbind", {false});
|
||||||
@@ -759,8 +741,6 @@ void CConfigManager::setDefaultAnimationVars() {
|
|||||||
INITANIMCFG("fadeShadow");
|
INITANIMCFG("fadeShadow");
|
||||||
INITANIMCFG("fadeDim");
|
INITANIMCFG("fadeDim");
|
||||||
|
|
||||||
// border
|
|
||||||
|
|
||||||
// workspaces
|
// workspaces
|
||||||
INITANIMCFG("workspaces");
|
INITANIMCFG("workspaces");
|
||||||
INITANIMCFG("workspacesIn");
|
INITANIMCFG("workspacesIn");
|
||||||
@@ -795,6 +775,12 @@ void CConfigManager::setDefaultAnimationVars() {
|
|||||||
CREATEANIMCFG("fadeLayers", "fade");
|
CREATEANIMCFG("fadeLayers", "fade");
|
||||||
CREATEANIMCFG("fadeLayersIn", "fadeLayers");
|
CREATEANIMCFG("fadeLayersIn", "fadeLayers");
|
||||||
CREATEANIMCFG("fadeLayersOut", "fadeLayers");
|
CREATEANIMCFG("fadeLayersOut", "fadeLayers");
|
||||||
|
CREATEANIMCFG("fadeWorkspaces", "fade");
|
||||||
|
CREATEANIMCFG("fadeWorkspacesIn", "fadeWorkspaces");
|
||||||
|
CREATEANIMCFG("fadeWorkspacesOut", "fadeWorkspaces");
|
||||||
|
CREATEANIMCFG("fadeSpecialWorkspace", "fadeWorkspaces");
|
||||||
|
CREATEANIMCFG("fadeSpecialWorkspaceIn", "fadeSpecialWorkspace");
|
||||||
|
CREATEANIMCFG("fadeSpecialWorkspaceOut", "fadeSpecialWorkspace");
|
||||||
|
|
||||||
CREATEANIMCFG("workspacesIn", "workspaces");
|
CREATEANIMCFG("workspacesIn", "workspaces");
|
||||||
CREATEANIMCFG("workspacesOut", "workspaces");
|
CREATEANIMCFG("workspacesOut", "workspaces");
|
||||||
@@ -815,7 +801,6 @@ std::optional<std::string> CConfigManager::resetHLConfig() {
|
|||||||
m_vDeclaredPlugins.clear();
|
m_vDeclaredPlugins.clear();
|
||||||
m_dLayerRules.clear();
|
m_dLayerRules.clear();
|
||||||
m_vFailedPluginConfigValues.clear();
|
m_vFailedPluginConfigValues.clear();
|
||||||
finalExecRequests.clear();
|
|
||||||
|
|
||||||
// paths
|
// paths
|
||||||
configPaths.clear();
|
configPaths.clear();
|
||||||
@@ -832,11 +817,11 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||||||
static const auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
|
static const auto PENABLEEXPLICIT = CConfigValue<Hyprlang::INT>("render:explicit_sync");
|
||||||
static int prevEnabledExplicit = *PENABLEEXPLICIT;
|
static int prevEnabledExplicit = *PENABLEEXPLICIT;
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
w->uncacheWindowDecos();
|
w->uncacheWindowDecos();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
|
|
||||||
// Update the keyboard layout to the cfg'd one if this is not the first launch
|
// Update the keyboard layout to the cfg'd one if this is not the first launch
|
||||||
@@ -878,34 +863,11 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||||||
ensureVRR();
|
ensureVRR();
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_XWAYLAND
|
|
||||||
const auto PENABLEXWAYLAND = std::any_cast<Hyprlang::INT>(m_pConfig->getConfigValue("xwayland:enabled"));
|
|
||||||
// enable/disable xwayland usage
|
|
||||||
if (!isFirstLaunch) {
|
|
||||||
bool prevEnabledXwayland = g_pCompositor->m_bEnableXwayland;
|
|
||||||
if (PENABLEXWAYLAND != prevEnabledXwayland) {
|
|
||||||
g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND;
|
|
||||||
if (PENABLEXWAYLAND) {
|
|
||||||
Debug::log(LOG, "xwayland has been enabled");
|
|
||||||
} else {
|
|
||||||
Debug::log(LOG, "xwayland has been disabled, cleaning up...");
|
|
||||||
for (auto& w : g_pCompositor->m_vWindows) {
|
|
||||||
if (w->m_pXDGSurface || !w->m_bIsX11)
|
|
||||||
continue;
|
|
||||||
g_pCompositor->closeWindow(w);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
g_pXWayland = std::make_unique<CXWayland>(g_pCompositor->m_bEnableXwayland);
|
|
||||||
}
|
|
||||||
} else
|
|
||||||
g_pCompositor->m_bEnableXwayland = PENABLEXWAYLAND;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!isFirstLaunch && !g_pCompositor->m_bUnsafeState)
|
if (!isFirstLaunch && !g_pCompositor->m_bUnsafeState)
|
||||||
refreshGroupBarGradients();
|
refreshGroupBarGradients();
|
||||||
|
|
||||||
// Updates dynamic window and workspace rules
|
// Updates dynamic window and workspace rules
|
||||||
for (auto const& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
if (w->inert())
|
if (w->inert())
|
||||||
continue;
|
continue;
|
||||||
g_pCompositor->updateWorkspaceWindows(w->m_iID);
|
g_pCompositor->updateWorkspaceWindows(w->m_iID);
|
||||||
@@ -933,7 +895,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||||||
|
|
||||||
Debug::coloredLogs = reinterpret_cast<int64_t* const*>(m_pConfig->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
|
Debug::coloredLogs = reinterpret_cast<int64_t* const*>(m_pConfig->getConfigValuePtr("debug:colored_stdout_logs")->getDataStaticPtr());
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
// mark blur dirty
|
// mark blur dirty
|
||||||
g_pHyprOpenGL->markBlurDirtyForMonitor(m.get());
|
g_pHyprOpenGL->markBlurDirtyForMonitor(m.get());
|
||||||
|
|
||||||
@@ -943,7 +905,7 @@ void CConfigManager::postConfigReload(const Hyprlang::CParseResult& result) {
|
|||||||
m->forceFullFrames = 2;
|
m->forceFullFrames = 2;
|
||||||
|
|
||||||
// also force mirrors, as the aspect ratio could've changed
|
// also force mirrors, as the aspect ratio could've changed
|
||||||
for (auto const& mirror : m->mirrors)
|
for (auto& mirror : m->mirrors)
|
||||||
mirror->forceFullFrames = 3;
|
mirror->forceFullFrames = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -982,7 +944,7 @@ std::string CConfigManager::parseKeyword(const std::string& COMMAND, const std::
|
|||||||
|
|
||||||
// invalidate layouts if they changed
|
// invalidate layouts if they changed
|
||||||
if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
|
if (COMMAND == "monitor" || COMMAND.contains("gaps_") || COMMAND.starts_with("dwindle:") || COMMAND.starts_with("master:")) {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1020,7 +982,7 @@ void CConfigManager::tick() {
|
|||||||
|
|
||||||
bool parse = false;
|
bool parse = false;
|
||||||
|
|
||||||
for (auto const& cf : configPaths) {
|
for (auto& cf : configPaths) {
|
||||||
struct stat fileStat;
|
struct stat fileStat;
|
||||||
int err = stat(cf.c_str(), &fileStat);
|
int err = stat(cf.c_str(), &fileStat);
|
||||||
if (err != 0) {
|
if (err != 0) {
|
||||||
@@ -1076,7 +1038,7 @@ std::string CConfigManager::getDeviceString(const std::string& dev, const std::s
|
|||||||
}
|
}
|
||||||
|
|
||||||
SMonitorRule CConfigManager::getMonitorRuleFor(const CMonitor& PMONITOR) {
|
SMonitorRule CConfigManager::getMonitorRuleFor(const CMonitor& PMONITOR) {
|
||||||
for (auto const& r : m_dMonitorRules | std::views::reverse) {
|
for (auto& r : m_dMonitorRules | std::views::reverse) {
|
||||||
if (PMONITOR.matchesStaticSelector(r.name)) {
|
if (PMONITOR.matchesStaticSelector(r.name)) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -1084,7 +1046,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const CMonitor& PMONITOR) {
|
|||||||
|
|
||||||
Debug::log(WARN, "No rule found for {}, trying to use the first.", PMONITOR.szName);
|
Debug::log(WARN, "No rule found for {}, trying to use the first.", PMONITOR.szName);
|
||||||
|
|
||||||
for (auto const& r : m_dMonitorRules) {
|
for (auto& r : m_dMonitorRules) {
|
||||||
if (r.name.empty()) {
|
if (r.name.empty()) {
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
@@ -1101,7 +1063,7 @@ SMonitorRule CConfigManager::getMonitorRuleFor(const CMonitor& PMONITOR) {
|
|||||||
|
|
||||||
SWorkspaceRule CConfigManager::getWorkspaceRuleFor(PHLWORKSPACE pWorkspace) {
|
SWorkspaceRule CConfigManager::getWorkspaceRuleFor(PHLWORKSPACE pWorkspace) {
|
||||||
SWorkspaceRule mergedRule{};
|
SWorkspaceRule mergedRule{};
|
||||||
for (auto const& rule : m_dWorkspaceRules) {
|
for (auto& rule : m_dWorkspaceRules) {
|
||||||
if (!pWorkspace->matchesStaticSelector(rule.workspaceString))
|
if (!pWorkspace->matchesStaticSelector(rule.workspaceString))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1174,7 +1136,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
|
|||||||
// local tags for dynamic tag rule match
|
// local tags for dynamic tag rule match
|
||||||
auto tags = pWindow->m_tags;
|
auto tags = pWindow->m_tags;
|
||||||
|
|
||||||
for (auto const& rule : m_dWindowRules) {
|
for (auto& rule : m_dWindowRules) {
|
||||||
// check if we have a matching rule
|
// check if we have a matching rule
|
||||||
if (!rule.v2) {
|
if (!rule.v2) {
|
||||||
try {
|
try {
|
||||||
@@ -1339,7 +1301,7 @@ std::vector<SWindowRule> CConfigManager::getMatchingRules(PHLWINDOW pWindow, boo
|
|||||||
|
|
||||||
bool anyExecFound = false;
|
bool anyExecFound = false;
|
||||||
|
|
||||||
for (auto const& er : execRequestedRules) {
|
for (auto& er : execRequestedRules) {
|
||||||
if (std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == er.iPid; })) {
|
if (std::ranges::any_of(PIDs, [&](const auto& pid) { return pid == er.iPid; })) {
|
||||||
returns.push_back({er.szRule, "execRule"});
|
returns.push_back({er.szRule, "execRule"});
|
||||||
anyExecFound = true;
|
anyExecFound = true;
|
||||||
@@ -1359,7 +1321,7 @@ std::vector<SLayerRule> CConfigManager::getMatchingRules(PHLLS pLS) {
|
|||||||
if (!pLS->layerSurface || pLS->fadingOut)
|
if (!pLS->layerSurface || pLS->fadingOut)
|
||||||
return returns;
|
return returns;
|
||||||
|
|
||||||
for (auto const& lr : m_dLayerRules) {
|
for (auto& lr : m_dLayerRules) {
|
||||||
if (lr.targetNamespace.starts_with("address:0x")) {
|
if (lr.targetNamespace.starts_with("address:0x")) {
|
||||||
if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr.targetNamespace)
|
if (std::format("address:0x{:x}", (uintptr_t)pLS.get()) != lr.targetNamespace)
|
||||||
continue;
|
continue;
|
||||||
@@ -1396,7 +1358,7 @@ void CConfigManager::dispatchExecOnce() {
|
|||||||
firstExecDispatched = true;
|
firstExecDispatched = true;
|
||||||
isLaunchingExecOnce = true;
|
isLaunchingExecOnce = true;
|
||||||
|
|
||||||
for (auto const& c : firstExecRequests) {
|
for (auto& c : firstExecRequests) {
|
||||||
handleRawExec("", c);
|
handleRawExec("", c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1413,24 +1375,6 @@ void CConfigManager::dispatchExecOnce() {
|
|||||||
g_pCompositor->performUserChecks();
|
g_pCompositor->performUserChecks();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::dispatchExecShutdown() {
|
|
||||||
if (finalExecRequests.empty()) {
|
|
||||||
g_pCompositor->m_bFinalRequests = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pCompositor->m_bFinalRequests = true;
|
|
||||||
|
|
||||||
for (auto const& c : finalExecRequests) {
|
|
||||||
handleExecShutdown("", c);
|
|
||||||
}
|
|
||||||
|
|
||||||
finalExecRequests.clear();
|
|
||||||
|
|
||||||
// Actually exit now
|
|
||||||
handleExecShutdown("", "hyprctl dispatch exit");
|
|
||||||
}
|
|
||||||
|
|
||||||
void CConfigManager::appendMonitorRule(const SMonitorRule& r) {
|
void CConfigManager::appendMonitorRule(const SMonitorRule& r) {
|
||||||
m_dMonitorRules.emplace_back(r);
|
m_dMonitorRules.emplace_back(r);
|
||||||
}
|
}
|
||||||
@@ -1451,7 +1395,7 @@ void CConfigManager::performMonitorReload() {
|
|||||||
|
|
||||||
bool overAgain = false;
|
bool overAgain = false;
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
if (!m->output || m->isUnsafeFallback)
|
if (!m->output || m->isUnsafeFallback)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1498,7 +1442,7 @@ bool CConfigManager::deviceConfigExists(const std::string& dev) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
||||||
for (auto const& bls : m_dBlurLSNamespaces) {
|
for (auto& bls : m_dBlurLSNamespaces) {
|
||||||
if (bls == ns) {
|
if (bls == ns) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1508,7 +1452,7 @@ bool CConfigManager::shouldBlurLS(const std::string& ns) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::ensureMonitorStatus() {
|
void CConfigManager::ensureMonitorStatus() {
|
||||||
for (auto const& rm : g_pCompositor->m_vRealMonitors) {
|
for (auto& rm : g_pCompositor->m_vRealMonitors) {
|
||||||
if (!rm->output || rm->isUnsafeFallback)
|
if (!rm->output || rm->isUnsafeFallback)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1591,7 +1535,7 @@ void CConfigManager::ensureVRR(CMonitor* pMonitor) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
ensureVRRForDisplay(m.get());
|
ensureVRRForDisplay(m.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1613,7 +1557,7 @@ CMonitor* CConfigManager::getBoundMonitorForWS(const std::string& wsname) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname) {
|
std::string CConfigManager::getBoundMonitorStringForWS(const std::string& wsname) {
|
||||||
for (auto const& wr : m_dWorkspaceRules) {
|
for (auto& wr : m_dWorkspaceRules) {
|
||||||
const auto WSNAME = wr.workspaceName.starts_with("name:") ? wr.workspaceName.substr(5) : wr.workspaceName;
|
const auto WSNAME = wr.workspaceName.starts_with("name:") ? wr.workspaceName.substr(5) : wr.workspaceName;
|
||||||
|
|
||||||
if (WSNAME == wsname)
|
if (WSNAME == wsname)
|
||||||
@@ -1684,7 +1628,7 @@ void CConfigManager::addPluginKeyword(HANDLE handle, const std::string& name, Hy
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CConfigManager::removePluginConfig(HANDLE handle) {
|
void CConfigManager::removePluginConfig(HANDLE handle) {
|
||||||
for (auto const& k : pluginKeywords) {
|
for (auto& k : pluginKeywords) {
|
||||||
if (k.handle != handle)
|
if (k.handle != handle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1692,7 +1636,7 @@ void CConfigManager::removePluginConfig(HANDLE handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::erase_if(pluginKeywords, [&](const auto& other) { return other.handle == handle; });
|
std::erase_if(pluginKeywords, [&](const auto& other) { return other.handle == handle; });
|
||||||
for (auto const& [h, n] : pluginVariables) {
|
for (auto& [h, n] : pluginVariables) {
|
||||||
if (h != handle)
|
if (h != handle)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1707,7 +1651,7 @@ std::string CConfigManager::getDefaultWorkspaceFor(const std::string& name) {
|
|||||||
if (other->monitor == name)
|
if (other->monitor == name)
|
||||||
return other->workspaceString;
|
return other->workspaceString;
|
||||||
if (other->monitor.substr(0, 5) == "desc:") {
|
if (other->monitor.substr(0, 5) == "desc:") {
|
||||||
auto const monitor = g_pCompositor->getMonitorFromDesc(other->monitor.substr(5));
|
auto monitor = g_pCompositor->getMonitorFromDesc(other->monitor.substr(5));
|
||||||
if (monitor && monitor->szName == name)
|
if (monitor && monitor->szName == name)
|
||||||
return other->workspaceString;
|
return other->workspaceString;
|
||||||
}
|
}
|
||||||
@@ -1733,16 +1677,6 @@ std::optional<std::string> CConfigManager::handleExecOnce(const std::string& com
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
std::optional<std::string> CConfigManager::handleExecShutdown(const std::string& command, const std::string& args) {
|
|
||||||
if (g_pCompositor->m_bFinalRequests) {
|
|
||||||
g_pKeybindManager->spawn(args);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
finalExecRequests.push_back(args);
|
|
||||||
return {};
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
|
static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
|
||||||
auto args = CVarList(modeline, 0, 's');
|
auto args = CVarList(modeline, 0, 's');
|
||||||
|
|
||||||
@@ -1790,7 +1724,7 @@ static bool parseModeLine(const std::string& modeline, drmModeModeInfo& mode) {
|
|||||||
if (it != flagsmap.end())
|
if (it != flagsmap.end())
|
||||||
mode.flags |= it->second;
|
mode.flags |= it->second;
|
||||||
else
|
else
|
||||||
Debug::log(ERR, "invalid flag {} in modeline", key);
|
Debug::log(ERR, "invalid flag {} in modeline", it->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(mode.name, sizeof(mode.name), "%dx%d@%d", mode.hdisplay, mode.vdisplay, mode.vrefresh / 1000);
|
snprintf(mode.name, sizeof(mode.name), "%dx%d@%d", mode.hdisplay, mode.vdisplay, mode.vrefresh / 1000);
|
||||||
@@ -2114,7 +2048,7 @@ std::optional<std::string> CConfigManager::handleBind(const std::string& command
|
|||||||
bool dontInhibit = false;
|
bool dontInhibit = false;
|
||||||
const auto BINDARGS = command.substr(4);
|
const auto BINDARGS = command.substr(4);
|
||||||
|
|
||||||
for (auto const& arg : BINDARGS) {
|
for (auto& arg : BINDARGS) {
|
||||||
if (arg == 'l') {
|
if (arg == 'l') {
|
||||||
locked = true;
|
locked = true;
|
||||||
} else if (arg == 'r') {
|
} else if (arg == 'r') {
|
||||||
@@ -2225,7 +2159,7 @@ std::optional<std::string> CConfigManager::handleUnbind(const std::string& comma
|
|||||||
|
|
||||||
bool windowRuleValid(const std::string& RULE) {
|
bool windowRuleValid(const std::string& RULE) {
|
||||||
static const auto rules = std::unordered_set<std::string>{
|
static const auto rules = std::unordered_set<std::string>{
|
||||||
"float", "fullscreen", "maximize", "noinitialfocus", "pin", "stayfocused", "tile", "renderunfocused",
|
"float", "fullscreen", "maximize", "noinitialfocus", "pin", "stayfocused", "tile",
|
||||||
};
|
};
|
||||||
static const auto rulesPrefix = std::vector<std::string>{
|
static const auto rulesPrefix = std::vector<std::string>{
|
||||||
"animation", "bordercolor", "bordersize", "center", "fullscreenstate", "group", "idleinhibit", "maxsize", "minsize", "monitor",
|
"animation", "bordercolor", "bordersize", "center", "fullscreenstate", "group", "idleinhibit", "maxsize", "minsize", "monitor",
|
||||||
@@ -2240,7 +2174,7 @@ bool windowRuleValid(const std::string& RULE) {
|
|||||||
|
|
||||||
bool layerRuleValid(const std::string& RULE) {
|
bool layerRuleValid(const std::string& RULE) {
|
||||||
static const auto rules = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"};
|
static const auto rules = std::unordered_set<std::string>{"noanim", "blur", "blurpopups", "dimaround"};
|
||||||
static const auto rulesPrefix = std::vector<std::string>{"ignorealpha", "ignorezero", "xray", "animation", "order"};
|
static const auto rulesPrefix = std::vector<std::string>{"ignorealpha", "ignorezero", "xray", "animation"};
|
||||||
|
|
||||||
return rules.contains(RULE) || std::any_of(rulesPrefix.begin(), rulesPrefix.end(), [&RULE](auto prefix) { return RULE.starts_with(prefix); });
|
return rules.contains(RULE) || std::any_of(rulesPrefix.begin(), rulesPrefix.end(), [&RULE](auto prefix) { return RULE.starts_with(prefix); });
|
||||||
}
|
}
|
||||||
@@ -2292,9 +2226,9 @@ std::optional<std::string> CConfigManager::handleLayerRule(const std::string& co
|
|||||||
|
|
||||||
m_dLayerRules.push_back({VALUE, RULE});
|
m_dLayerRules.push_back({VALUE, RULE});
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
for (auto const& lsl : m->m_aLayerSurfaceLayers)
|
for (auto& lsl : m->m_aLayerSurfaceLayers)
|
||||||
for (auto const& ls : lsl)
|
for (auto& ls : lsl)
|
||||||
ls->applyRules();
|
ls->applyRules();
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
@@ -2493,9 +2427,9 @@ void CConfigManager::updateBlurredLS(const std::string& name, const bool forceBl
|
|||||||
matchName = matchName.substr(8);
|
matchName = matchName.substr(8);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
for (auto const& lsl : m->m_aLayerSurfaceLayers) {
|
for (auto& lsl : m->m_aLayerSurfaceLayers) {
|
||||||
for (auto const& ls : lsl) {
|
for (auto& ls : lsl) {
|
||||||
if (BYADDRESS) {
|
if (BYADDRESS) {
|
||||||
if (std::format("0x{:x}", (uintptr_t)ls.get()) == matchName)
|
if (std::format("0x{:x}", (uintptr_t)ls.get()) == matchName)
|
||||||
ls->forceBlur = forceBlur;
|
ls->forceBlur = forceBlur;
|
||||||
@@ -2604,7 +2538,7 @@ std::optional<std::string> CConfigManager::handleWorkspaceRules(const std::strin
|
|||||||
};
|
};
|
||||||
|
|
||||||
CVarList rulesList{rules, 0, ',', true};
|
CVarList rulesList{rules, 0, ',', true};
|
||||||
for (auto const& r : rulesList) {
|
for (auto& r : rulesList) {
|
||||||
const auto R = assignRule(r);
|
const auto R = assignRule(r);
|
||||||
if (R.has_value())
|
if (R.has_value())
|
||||||
return R;
|
return R;
|
||||||
|
@@ -192,7 +192,6 @@ class CConfigManager {
|
|||||||
|
|
||||||
// no-op when done.
|
// no-op when done.
|
||||||
void dispatchExecOnce();
|
void dispatchExecOnce();
|
||||||
void dispatchExecShutdown();
|
|
||||||
|
|
||||||
void performMonitorReload();
|
void performMonitorReload();
|
||||||
void appendMonitorRule(const SMonitorRule&);
|
void appendMonitorRule(const SMonitorRule&);
|
||||||
@@ -214,7 +213,6 @@ class CConfigManager {
|
|||||||
// keywords
|
// keywords
|
||||||
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
|
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
|
||||||
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
|
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
|
||||||
std::optional<std::string> handleExecShutdown(const std::string&, const std::string&);
|
|
||||||
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
|
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
|
||||||
std::optional<std::string> handleBind(const std::string&, const std::string&);
|
std::optional<std::string> handleBind(const std::string&, const std::string&);
|
||||||
std::optional<std::string> handleUnbind(const std::string&, const std::string&);
|
std::optional<std::string> handleUnbind(const std::string&, const std::string&);
|
||||||
@@ -291,7 +289,6 @@ class CConfigManager {
|
|||||||
bool firstExecDispatched = false;
|
bool firstExecDispatched = false;
|
||||||
bool m_bManualCrashInitiated = false;
|
bool m_bManualCrashInitiated = false;
|
||||||
std::deque<std::string> firstExecRequests;
|
std::deque<std::string> firstExecRequests;
|
||||||
std::deque<std::string> finalExecRequests;
|
|
||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
||||||
std::string m_szConfigErrors = "";
|
std::string m_szConfigErrors = "";
|
||||||
|
@@ -241,19 +241,6 @@ bind = $mainMod, mouse_up, workspace, e-1
|
|||||||
bindm = $mainMod, mouse:272, movewindow
|
bindm = $mainMod, mouse:272, movewindow
|
||||||
bindm = $mainMod, mouse:273, resizewindow
|
bindm = $mainMod, mouse:273, resizewindow
|
||||||
|
|
||||||
# Laptop multimedia keys for volume and LCD brightness
|
|
||||||
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
|
|
||||||
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
|
||||||
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
|
||||||
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
|
||||||
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
|
|
||||||
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
|
||||||
|
|
||||||
# Requires playerctl
|
|
||||||
bindl = , XF86AudioNext, exec, playerctl next
|
|
||||||
bindl = , XF86AudioPause, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
|
||||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
|
||||||
|
|
||||||
##############################
|
##############################
|
||||||
### WINDOWS AND WORKSPACES ###
|
### WINDOWS AND WORKSPACES ###
|
||||||
|
@@ -57,7 +57,7 @@ static std::string formatToString(uint32_t drmFormat) {
|
|||||||
static std::string availableModesForOutput(CMonitor* pMonitor, eHyprCtlOutputFormat format) {
|
static std::string availableModesForOutput(CMonitor* pMonitor, eHyprCtlOutputFormat format) {
|
||||||
std::string result;
|
std::string result;
|
||||||
|
|
||||||
for (auto const& m : pMonitor->output->modes) {
|
for (auto& m : pMonitor->output->modes) {
|
||||||
if (format == FORMAT_NORMAL)
|
if (format == FORMAT_NORMAL)
|
||||||
result += std::format("{}x{}@{:.2f}Hz ", m->pixelSize.x, m->pixelSize.y, m->refreshRate / 1000.0);
|
result += std::format("{}x{}@{:.2f}Hz ", m->pixelSize.x, m->pixelSize.y, m->refreshRate / 1000.0);
|
||||||
else
|
else
|
||||||
@@ -146,7 +146,7 @@ std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
|
||||||
for (auto const& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
|
for (auto& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
|
||||||
result += CHyprCtl::getMonitorData(m, format);
|
result += CHyprCtl::getMonitorData(m, format);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +154,7 @@ std::string monitorsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto const& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
|
for (auto& m : allMonitors ? g_pCompositor->m_vRealMonitors : g_pCompositor->m_vMonitors) {
|
||||||
if (!m->output || m->ID == -1)
|
if (!m->output || m->ID == -1)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -272,7 +272,7 @@ std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -283,7 +283,7 @@ std::string clientsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
if (!w->m_bIsMapped && !g_pHyprCtl->m_sCurrentRequestParams.all)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -381,7 +381,7 @@ std::string workspacesRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
|
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
for (auto const& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
result += CHyprCtl::getWorkspaceData(w, format);
|
result += CHyprCtl::getWorkspaceData(w, format);
|
||||||
result += ",";
|
result += ",";
|
||||||
}
|
}
|
||||||
@@ -389,7 +389,7 @@ std::string workspacesRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
trimTrailingComma(result);
|
trimTrailingComma(result);
|
||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto const& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
result += CHyprCtl::getWorkspaceData(w, format);
|
result += CHyprCtl::getWorkspaceData(w, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -401,7 +401,7 @@ std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::string reque
|
|||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
for (auto const& r : g_pConfigManager->getAllWorkspaceRules()) {
|
for (auto& r : g_pConfigManager->getAllWorkspaceRules()) {
|
||||||
result += getWorkspaceRuleData(r, format);
|
result += getWorkspaceRuleData(r, format);
|
||||||
result += ",";
|
result += ",";
|
||||||
}
|
}
|
||||||
@@ -409,7 +409,7 @@ std::string workspaceRulesRequest(eHyprCtlOutputFormat format, std::string reque
|
|||||||
trimTrailingComma(result);
|
trimTrailingComma(result);
|
||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
for (auto const& r : g_pConfigManager->getAllWorkspaceRules()) {
|
for (auto& r : g_pConfigManager->getAllWorkspaceRules()) {
|
||||||
result += getWorkspaceRuleData(r, format);
|
result += getWorkspaceRuleData(r, format);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -437,7 +437,7 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "{\n";
|
result += "{\n";
|
||||||
|
|
||||||
for (auto const& mon : g_pCompositor->m_vMonitors) {
|
for (auto& mon : g_pCompositor->m_vMonitors) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#("{}": {{
|
R"#("{}": {{
|
||||||
"levels": {{
|
"levels": {{
|
||||||
@@ -445,13 +445,13 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
escapeJSONStrings(mon->szName));
|
escapeJSONStrings(mon->szName));
|
||||||
|
|
||||||
int layerLevel = 0;
|
int layerLevel = 0;
|
||||||
for (auto const& level : mon->m_aLayerSurfaceLayers) {
|
for (auto& level : mon->m_aLayerSurfaceLayers) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#(
|
R"#(
|
||||||
"{}": [
|
"{}": [
|
||||||
)#",
|
)#",
|
||||||
layerLevel);
|
layerLevel);
|
||||||
for (auto const& layer : level) {
|
for (auto& layer : level) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -484,14 +484,14 @@ std::string layersRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
result += "\n}\n";
|
result += "\n}\n";
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
for (auto const& mon : g_pCompositor->m_vMonitors) {
|
for (auto& mon : g_pCompositor->m_vMonitors) {
|
||||||
result += std::format("Monitor {}:\n", mon->szName);
|
result += std::format("Monitor {}:\n", mon->szName);
|
||||||
int layerLevel = 0;
|
int layerLevel = 0;
|
||||||
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
|
static const std::array<std::string, 4> levelNames = {"background", "bottom", "top", "overlay"};
|
||||||
for (auto const& level : mon->m_aLayerSurfaceLayers) {
|
for (auto& level : mon->m_aLayerSurfaceLayers) {
|
||||||
result += std::format("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel]);
|
result += std::format("\tLayer level {} ({}):\n", layerLevel, levelNames[layerLevel]);
|
||||||
|
|
||||||
for (auto const& layer : level) {
|
for (auto& layer : level) {
|
||||||
result += std::format("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}\n", (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
|
result += std::format("\t\tLayer {:x}: xywh: {} {} {} {}, namespace: {}\n", (uintptr_t)layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width,
|
||||||
layer->geometry.height, layer->szNamespace);
|
layer->geometry.height, layer->szNamespace);
|
||||||
}
|
}
|
||||||
@@ -510,7 +510,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
|
|
||||||
for (auto const& m : g_pLayoutManager->getAllLayoutNames()) {
|
for (auto& m : g_pLayoutManager->getAllLayoutNames()) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#(
|
R"#(
|
||||||
"{}",)#",
|
"{}",)#",
|
||||||
@@ -520,7 +520,7 @@ std::string layoutsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "\n]\n";
|
result += "\n]\n";
|
||||||
} else {
|
} else {
|
||||||
for (auto const& m : g_pLayoutManager->getAllLayoutNames()) {
|
for (auto& m : g_pLayoutManager->getAllLayoutNames()) {
|
||||||
result += std::format("{}\n", m);
|
result += std::format("{}\n", m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -557,7 +557,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
result += "{\n";
|
result += "{\n";
|
||||||
result += "\"mice\": [\n";
|
result += "\"mice\": [\n";
|
||||||
|
|
||||||
for (auto const& m : g_pInputManager->m_vPointers) {
|
for (auto& m : g_pInputManager->m_vPointers) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -572,7 +572,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
result += "\n],\n";
|
result += "\n],\n";
|
||||||
|
|
||||||
result += "\"keyboards\": [\n";
|
result += "\"keyboards\": [\n";
|
||||||
for (auto const& k : g_pInputManager->m_vKeyboards) {
|
for (auto& k : g_pInputManager->m_vKeyboards) {
|
||||||
const auto KM = k->getActiveLayout();
|
const auto KM = k->getActiveLayout();
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
@@ -596,7 +596,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "\"tablets\": [\n";
|
result += "\"tablets\": [\n";
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTabletPads) {
|
for (auto& d : g_pInputManager->m_vTabletPads) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -609,7 +609,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
(uintptr_t)d.get(), (uintptr_t)d->parent.get(), escapeJSONStrings(d->parent ? d->parent->hlName : ""));
|
(uintptr_t)d.get(), (uintptr_t)d->parent.get(), escapeJSONStrings(d->parent ? d->parent->hlName : ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTablets) {
|
for (auto& d : g_pInputManager->m_vTablets) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -618,7 +618,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
(uintptr_t)d.get(), escapeJSONStrings(d->hlName));
|
(uintptr_t)d.get(), escapeJSONStrings(d->hlName));
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTabletTools) {
|
for (auto& d : g_pInputManager->m_vTabletTools) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -632,7 +632,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "\"touch\": [\n";
|
result += "\"touch\": [\n";
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTouches) {
|
for (auto& d : g_pInputManager->m_vTouches) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -646,7 +646,7 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "\"switches\": [\n";
|
result += "\"switches\": [\n";
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_lSwitches) {
|
for (auto& d : g_pInputManager->m_lSwitches) {
|
||||||
result += std::format(
|
result += std::format(
|
||||||
R"#( {{
|
R"#( {{
|
||||||
"address": "0x{:x}",
|
"address": "0x{:x}",
|
||||||
@@ -663,14 +663,14 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
} else {
|
} else {
|
||||||
result += "mice:\n";
|
result += "mice:\n";
|
||||||
|
|
||||||
for (auto const& m : g_pInputManager->m_vPointers) {
|
for (auto& m : g_pInputManager->m_vPointers) {
|
||||||
result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", (uintptr_t)m.get(), m->hlName,
|
result += std::format("\tMouse at {:x}:\n\t\t{}\n\t\t\tdefault speed: {:.5f}\n", (uintptr_t)m.get(), m->hlName,
|
||||||
(m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f));
|
(m->aq() && m->aq()->getLibinputHandle() ? libinput_device_config_accel_get_default_speed(m->aq()->getLibinputHandle()) : 0.f));
|
||||||
}
|
}
|
||||||
|
|
||||||
result += "\n\nKeyboards:\n";
|
result += "\n\nKeyboards:\n";
|
||||||
|
|
||||||
for (auto const& k : g_pInputManager->m_vKeyboards) {
|
for (auto& k : g_pInputManager->m_vKeyboards) {
|
||||||
const auto KM = k->getActiveLayout();
|
const auto KM = k->getActiveLayout();
|
||||||
result += std::format("\tKeyboard at {:x}:\n\t\t{}\n\t\t\trules: r \"{}\", m \"{}\", l \"{}\", v \"{}\", o \"{}\"\n\t\t\tactive keymap: {}\n\t\t\tmain: {}\n",
|
result += std::format("\tKeyboard at {:x}:\n\t\t{}\n\t\t\trules: r \"{}\", m \"{}\", l \"{}\", v \"{}\", o \"{}\"\n\t\t\tactive keymap: {}\n\t\t\tmain: {}\n",
|
||||||
(uintptr_t)k.get(), k->hlName, k->currentRules.rules, k->currentRules.model, k->currentRules.layout, k->currentRules.variant,
|
(uintptr_t)k.get(), k->hlName, k->currentRules.rules, k->currentRules.model, k->currentRules.layout, k->currentRules.variant,
|
||||||
@@ -679,27 +679,27 @@ std::string devicesRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
result += "\n\nTablets:\n";
|
result += "\n\nTablets:\n";
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTabletPads) {
|
for (auto& d : g_pInputManager->m_vTabletPads) {
|
||||||
result += std::format("\tTablet Pad at {:x} (belongs to {:x} -> {})\n", (uintptr_t)d.get(), (uintptr_t)d->parent.get(), d->parent ? d->parent->hlName : "");
|
result += std::format("\tTablet Pad at {:x} (belongs to {:x} -> {})\n", (uintptr_t)d.get(), (uintptr_t)d->parent.get(), d->parent ? d->parent->hlName : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTablets) {
|
for (auto& d : g_pInputManager->m_vTablets) {
|
||||||
result += std::format("\tTablet at {:x}:\n\t\t{}\n\t\t\tsize: {}x{}mm\n", (uintptr_t)d.get(), d->hlName, d->aq()->physicalSize.x, d->aq()->physicalSize.y);
|
result += std::format("\tTablet at {:x}:\n\t\t{}\n\t\t\tsize: {}x{}mm\n", (uintptr_t)d.get(), d->hlName, d->aq()->physicalSize.x, d->aq()->physicalSize.y);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTabletTools) {
|
for (auto& d : g_pInputManager->m_vTabletTools) {
|
||||||
result += std::format("\tTablet Tool at {:x}\n", (uintptr_t)d.get());
|
result += std::format("\tTablet Tool at {:x}\n", (uintptr_t)d.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
result += "\n\nTouch:\n";
|
result += "\n\nTouch:\n";
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_vTouches) {
|
for (auto& d : g_pInputManager->m_vTouches) {
|
||||||
result += std::format("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)d.get(), d->hlName);
|
result += std::format("\tTouch Device at {:x}:\n\t\t{}\n", (uintptr_t)d.get(), d->hlName);
|
||||||
}
|
}
|
||||||
|
|
||||||
result += "\n\nSwitches:\n";
|
result += "\n\nSwitches:\n";
|
||||||
|
|
||||||
for (auto const& d : g_pInputManager->m_lSwitches) {
|
for (auto& d : g_pInputManager->m_lSwitches) {
|
||||||
result += std::format("\tSwitch Device at {:x}:\n\t\t{}\n", (uintptr_t)&d, d.pDevice ? d.pDevice->getName() : "");
|
result += std::format("\tSwitch Device at {:x}:\n\t\t{}\n", (uintptr_t)&d, d.pDevice ? d.pDevice->getName() : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -712,21 +712,21 @@ std::string animationsRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
ret += "animations:\n";
|
ret += "animations:\n";
|
||||||
|
|
||||||
for (auto const& ac : g_pConfigManager->getAnimationConfig()) {
|
for (auto& ac : g_pConfigManager->getAnimationConfig()) {
|
||||||
ret += std::format("\n\tname: {}\n\t\toverriden: {}\n\t\tbezier: {}\n\t\tenabled: {}\n\t\tspeed: {:.2f}\n\t\tstyle: {}\n", ac.first, (int)ac.second.overridden,
|
ret += std::format("\n\tname: {}\n\t\toverriden: {}\n\t\tbezier: {}\n\t\tenabled: {}\n\t\tspeed: {:.2f}\n\t\tstyle: {}\n", ac.first, (int)ac.second.overridden,
|
||||||
ac.second.internalBezier, ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle);
|
ac.second.internalBezier, ac.second.internalEnabled, ac.second.internalSpeed, ac.second.internalStyle);
|
||||||
}
|
}
|
||||||
|
|
||||||
ret += "beziers:\n";
|
ret += "beziers:\n";
|
||||||
|
|
||||||
for (auto const& bz : g_pAnimationManager->getAllBeziers()) {
|
for (auto& bz : g_pAnimationManager->getAllBeziers()) {
|
||||||
ret += std::format("\n\tname: {}\n", bz.first);
|
ret += std::format("\n\tname: {}\n", bz.first);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// json
|
// json
|
||||||
|
|
||||||
ret += "[[";
|
ret += "[[";
|
||||||
for (auto const& ac : g_pConfigManager->getAnimationConfig()) {
|
for (auto& ac : g_pConfigManager->getAnimationConfig()) {
|
||||||
ret += std::format(R"#(
|
ret += std::format(R"#(
|
||||||
{{
|
{{
|
||||||
"name": "{}",
|
"name": "{}",
|
||||||
@@ -744,7 +744,7 @@ std::string animationsRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
|
|
||||||
ret += ",\n[";
|
ret += ",\n[";
|
||||||
|
|
||||||
for (auto const& bz : g_pAnimationManager->getAllBeziers()) {
|
for (auto& bz : g_pAnimationManager->getAllBeziers()) {
|
||||||
ret += std::format(R"#(
|
ret += std::format(R"#(
|
||||||
{{
|
{{
|
||||||
"name": "{}"
|
"name": "{}"
|
||||||
@@ -778,11 +778,11 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
|
|||||||
std::string ret = "";
|
std::string ret = "";
|
||||||
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
|
const auto SHORTCUTS = PROTO::globalShortcuts->getAllShortcuts();
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
for (auto const& sh : SHORTCUTS)
|
for (auto& sh : SHORTCUTS)
|
||||||
ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description);
|
ret += std::format("{}:{} -> {}\n", sh.appid, sh.id, sh.description);
|
||||||
} else {
|
} else {
|
||||||
ret += "[";
|
ret += "[";
|
||||||
for (auto const& sh : SHORTCUTS) {
|
for (auto& sh : SHORTCUTS) {
|
||||||
ret += std::format(R"#(
|
ret += std::format(R"#(
|
||||||
{{
|
{{
|
||||||
"name": "{}",
|
"name": "{}",
|
||||||
@@ -800,7 +800,7 @@ std::string globalShortcutsRequest(eHyprCtlOutputFormat format, std::string requ
|
|||||||
std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
|
std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
|
||||||
std::string ret = "";
|
std::string ret = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
for (auto const& kb : g_pKeybindManager->m_lKeybinds) {
|
for (auto& kb : g_pKeybindManager->m_lKeybinds) {
|
||||||
ret += "bind";
|
ret += "bind";
|
||||||
if (kb.locked)
|
if (kb.locked)
|
||||||
ret += "l";
|
ret += "l";
|
||||||
@@ -821,7 +821,7 @@ std::string bindsRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
} else {
|
} else {
|
||||||
// json
|
// json
|
||||||
ret += "[";
|
ret += "[";
|
||||||
for (auto const& kb : g_pKeybindManager->m_lKeybinds) {
|
for (auto& kb : g_pKeybindManager->m_lKeybinds) {
|
||||||
ret += std::format(
|
ret += std::format(
|
||||||
R"#(
|
R"#(
|
||||||
{{
|
{{
|
||||||
@@ -858,8 +858,7 @@ std::string versionRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
|
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) {
|
||||||
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg +
|
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg +
|
||||||
").\nDate: " + GIT_COMMIT_DATE + "\nTag: " + GIT_TAG + ", commits: " + GIT_COMMITS + std::string{"\nbuilt against aquamarine "} + AQUAMARINE_VERSION + "\n" +
|
").\nDate: " + GIT_COMMIT_DATE + "\nTag: " + GIT_TAG + ", commits: " + GIT_COMMITS + "\n\nflags: (if any)\n";
|
||||||
"\n\nflags: (if any)\n";
|
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "legacyrenderer\n";
|
result += "legacyrenderer\n";
|
||||||
@@ -882,10 +881,8 @@ std::string versionRequest(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
"commit_date": "{}",
|
"commit_date": "{}",
|
||||||
"tag": "{}",
|
"tag": "{}",
|
||||||
"commits": "{}",
|
"commits": "{}",
|
||||||
"buildAquamarine": "{}",
|
|
||||||
"flags": [)#",
|
"flags": [)#",
|
||||||
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg), GIT_COMMIT_DATE, GIT_TAG, GIT_COMMITS,
|
GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), escapeJSONStrings(commitMsg), GIT_COMMIT_DATE, GIT_TAG, GIT_COMMITS);
|
||||||
AQUAMARINE_VERSION);
|
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
#ifdef LEGACY_RENDERER
|
||||||
result += "\"legacyrenderer\",";
|
result += "\"legacyrenderer\",";
|
||||||
@@ -938,7 +935,7 @@ std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
result += "os-release: " + execAndGet("cat /etc/os-release") + "\n\n";
|
||||||
|
|
||||||
result += "plugins:\n";
|
result += "plugins:\n";
|
||||||
for (auto const& pl : g_pPluginSystem->getAllPlugins()) {
|
for (auto& pl : g_pPluginSystem->getAllPlugins()) {
|
||||||
result += std::format(" {} by {} ver {}\n", pl->name, pl->author, pl->version);
|
result += std::format(" {} by {} ver {}\n", pl->name, pl->author, pl->version);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -973,26 +970,12 @@ std::string dispatchRequest(eHyprCtlOutputFormat format, std::string in) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
|
std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
|
||||||
// Find the first space to strip the keyword keyword
|
// get rid of the keyword keyword
|
||||||
auto const firstSpacePos = in.find_first_of(' ');
|
in = in.substr(in.find_first_of(' ') + 1);
|
||||||
if (firstSpacePos == std::string::npos) // Handle the case where there's no space found (invalid input)
|
|
||||||
return "Invalid input: no space found";
|
|
||||||
|
|
||||||
// Strip the keyword
|
const auto COMMAND = in.substr(0, in.find_first_of(' '));
|
||||||
in = in.substr(firstSpacePos + 1);
|
|
||||||
|
|
||||||
// Find the next space for the COMMAND and VALUE
|
const auto VALUE = in.substr(in.find_first_of(' ') + 1);
|
||||||
auto const secondSpacePos = in.find_first_of(' ');
|
|
||||||
if (secondSpacePos == std::string::npos) // Handle the case where there's no second space (invalid input)
|
|
||||||
return "Invalid input: command and value not properly formatted";
|
|
||||||
|
|
||||||
// Extract COMMAND and VALUE
|
|
||||||
const auto COMMAND = in.substr(0, secondSpacePos);
|
|
||||||
const auto VALUE = in.substr(secondSpacePos + 1);
|
|
||||||
|
|
||||||
// If COMMAND is empty, handle accordingly
|
|
||||||
if (COMMAND.empty())
|
|
||||||
return "Invalid input: command is empty";
|
|
||||||
|
|
||||||
std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE);
|
std::string retval = g_pConfigManager->parseKeyword(COMMAND, VALUE);
|
||||||
|
|
||||||
@@ -1023,7 +1006,7 @@ std::string dispatchKeyword(eHyprCtlOutputFormat format, std::string in) {
|
|||||||
|
|
||||||
// decorations will probably need a repaint
|
// decorations will probably need a repaint
|
||||||
if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source") {
|
if (COMMAND.contains("decoration:") || COMMAND.contains("border") || COMMAND == "workspace" || COMMAND.contains("zoom_factor") || COMMAND == "source") {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
g_pHyprRenderer->damageMonitor(m.get());
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
}
|
}
|
||||||
@@ -1144,9 +1127,15 @@ std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string requ
|
|||||||
const auto KB = vars[1];
|
const auto KB = vars[1];
|
||||||
const auto CMD = vars[2];
|
const auto CMD = vars[2];
|
||||||
|
|
||||||
SP<IKeyboard> pKeyboard;
|
// get kb
|
||||||
|
const auto PKEYBOARD = std::find_if(g_pInputManager->m_vKeyboards.begin(), g_pInputManager->m_vKeyboards.end(),
|
||||||
|
[&](const auto& other) { return other->hlName == g_pInputManager->deviceNameToInternalString(KB); });
|
||||||
|
|
||||||
|
if (PKEYBOARD == g_pInputManager->m_vKeyboards.end())
|
||||||
|
return "device not found";
|
||||||
|
|
||||||
|
const auto KEEB = *PKEYBOARD;
|
||||||
|
|
||||||
auto updateKeyboard = [](const SP<IKeyboard> KEEB, const std::string& CMD) -> std::optional<std::string> {
|
|
||||||
const auto LAYOUTS = xkb_keymap_num_layouts(KEEB->xkbKeymap);
|
const auto LAYOUTS = xkb_keymap_num_layouts(KEEB->xkbKeymap);
|
||||||
xkb_layout_index_t activeLayout = 0;
|
xkb_layout_index_t activeLayout = 0;
|
||||||
while (activeLayout < LAYOUTS) {
|
while (activeLayout < LAYOUTS) {
|
||||||
@@ -1173,43 +1162,6 @@ std::string switchXKBLayoutRequest(eHyprCtlOutputFormat format, std::string requ
|
|||||||
KEEB->updateModifiers(KEEB->modifiersState.depressed, KEEB->modifiersState.latched, KEEB->modifiersState.locked, requestedLayout);
|
KEEB->updateModifiers(KEEB->modifiersState.depressed, KEEB->modifiersState.latched, KEEB->modifiersState.locked, requestedLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
return std::nullopt;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (KB == "main" || KB == "active" || KB == "current") {
|
|
||||||
for (auto const& k : g_pInputManager->m_vKeyboards) {
|
|
||||||
if (!k->active)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
pKeyboard = k;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else if (KB == "all") {
|
|
||||||
std::string result = "";
|
|
||||||
for (auto const& k : g_pInputManager->m_vKeyboards) {
|
|
||||||
auto res = updateKeyboard(k, CMD);
|
|
||||||
if (res.has_value())
|
|
||||||
result += *res + "\n";
|
|
||||||
}
|
|
||||||
return result.empty() ? "ok" : result;
|
|
||||||
} else {
|
|
||||||
auto k = std::find_if(g_pInputManager->m_vKeyboards.begin(), g_pInputManager->m_vKeyboards.end(),
|
|
||||||
[&](const auto& other) { return other->hlName == g_pInputManager->deviceNameToInternalString(KB); });
|
|
||||||
|
|
||||||
if (k == g_pInputManager->m_vKeyboards.end())
|
|
||||||
return "device not found";
|
|
||||||
|
|
||||||
pKeyboard = *k;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!pKeyboard)
|
|
||||||
return "no device";
|
|
||||||
|
|
||||||
auto result = updateKeyboard(pKeyboard, CMD);
|
|
||||||
|
|
||||||
if (result.has_value())
|
|
||||||
return *result;
|
|
||||||
|
|
||||||
return "ok";
|
return "ok";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1334,7 +1286,7 @@ std::string dispatchSetProp(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
|
|
||||||
return "ok";
|
return "ok";
|
||||||
@@ -1407,7 +1359,7 @@ std::string decorationRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
std::string result = "";
|
std::string result = "";
|
||||||
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
if (format == eHyprCtlOutputFormat::FORMAT_JSON) {
|
||||||
result += "[";
|
result += "[";
|
||||||
for (auto const& wd : PWINDOW->m_dWindowDecorations) {
|
for (auto& wd : PWINDOW->m_dWindowDecorations) {
|
||||||
result += "{\n\"decorationName\": \"" + wd->getDisplayName() + "\",\n\"priority\": " + std::to_string(wd->getPositioningInfo().priority) + "\n},";
|
result += "{\n\"decorationName\": \"" + wd->getDisplayName() + "\",\n\"priority\": " + std::to_string(wd->getPositioningInfo().priority) + "\n},";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1415,7 +1367,7 @@ std::string decorationRequest(eHyprCtlOutputFormat format, std::string request)
|
|||||||
result += "]";
|
result += "]";
|
||||||
} else {
|
} else {
|
||||||
result = +"Decoration\tPriority\n";
|
result = +"Decoration\tPriority\n";
|
||||||
for (auto const& wd : PWINDOW->m_dWindowDecorations) {
|
for (auto& wd : PWINDOW->m_dWindowDecorations) {
|
||||||
result += wd->getDisplayName() + "\t" + std::to_string(wd->getPositioningInfo().priority) + "\n";
|
result += wd->getDisplayName() + "\t" + std::to_string(wd->getPositioningInfo().priority) + "\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1434,7 +1386,7 @@ std::string dispatchOutput(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
bool added = false;
|
bool added = false;
|
||||||
|
|
||||||
if (!vars[3].empty()) {
|
if (!vars[3].empty()) {
|
||||||
for (auto const& m : g_pCompositor->m_vRealMonitors) {
|
for (auto& m : g_pCompositor->m_vRealMonitors) {
|
||||||
if (m->szName == vars[3])
|
if (m->szName == vars[3])
|
||||||
return "Name already taken";
|
return "Name already taken";
|
||||||
}
|
}
|
||||||
@@ -1444,7 +1396,7 @@ std::string dispatchOutput(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
if (g_pCompositor->getMonitorFromName(vars[3]))
|
if (g_pCompositor->getMonitorFromName(vars[3]))
|
||||||
return "A real monitor already uses that name.";
|
return "A real monitor already uses that name.";
|
||||||
|
|
||||||
for (auto const& impl : g_pCompositor->m_pAqBackend->getImplementations() | std::views::reverse) {
|
for (auto& impl : g_pCompositor->m_pAqBackend->getImplementations() | std::views::reverse) {
|
||||||
auto type = impl->type();
|
auto type = impl->type();
|
||||||
|
|
||||||
if (type == Aquamarine::AQ_BACKEND_HEADLESS && (vars[2] == "headless" || vars[2] == "auto")) {
|
if (type == Aquamarine::AQ_BACKEND_HEADLESS && (vars[2] == "headless" || vars[2] == "auto")) {
|
||||||
@@ -1512,7 +1464,7 @@ std::string dispatchPlugin(eHyprCtlOutputFormat format, std::string request) {
|
|||||||
return "no plugins loaded";
|
return "no plugins loaded";
|
||||||
|
|
||||||
std::string list = "";
|
std::string list = "";
|
||||||
for (auto const& p : PLUGINS) {
|
for (auto& p : PLUGINS) {
|
||||||
list += std::format("\nPlugin {} by {}:\n\tHandle: {:x}\n\tVersion: {}\n\tDescription: {}\n", p->name, p->author, (uintptr_t)p->m_pHandle, p->version, p->description);
|
list += std::format("\nPlugin {} by {}:\n\tHandle: {:x}\n\tVersion: {}\n\tDescription: {}\n", p->name, p->author, (uintptr_t)p->m_pHandle, p->version, p->description);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1721,7 +1673,7 @@ std::string CHyprCtl::getReply(std::string request) {
|
|||||||
std::string result = "";
|
std::string result = "";
|
||||||
|
|
||||||
// parse exact cmds first, then non-exact.
|
// parse exact cmds first, then non-exact.
|
||||||
for (auto const& cmd : m_vCommands) {
|
for (auto& cmd : m_vCommands) {
|
||||||
if (!cmd->exact)
|
if (!cmd->exact)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1732,7 +1684,7 @@ std::string CHyprCtl::getReply(std::string request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (result.empty())
|
if (result.empty())
|
||||||
for (auto const& cmd : m_vCommands) {
|
for (auto& cmd : m_vCommands) {
|
||||||
if (cmd->exact)
|
if (cmd->exact)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1763,7 +1715,7 @@ std::string CHyprCtl::getReply(std::string request) {
|
|||||||
rd.blurFBDirty = true;
|
rd.blurFBDirty = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
g_pHyprRenderer->damageMonitor(m.get());
|
||||||
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(m->ID);
|
||||||
}
|
}
|
||||||
|
@@ -57,7 +57,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
float avgFrametime = 0;
|
float avgFrametime = 0;
|
||||||
float maxFrametime = 0;
|
float maxFrametime = 0;
|
||||||
float minFrametime = 9999;
|
float minFrametime = 9999;
|
||||||
for (auto const& ft : m_dLastFrametimes) {
|
for (auto& ft : m_dLastFrametimes) {
|
||||||
if (ft > maxFrametime)
|
if (ft > maxFrametime)
|
||||||
maxFrametime = ft;
|
maxFrametime = ft;
|
||||||
if (ft < minFrametime)
|
if (ft < minFrametime)
|
||||||
@@ -70,7 +70,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
float avgRenderTime = 0;
|
float avgRenderTime = 0;
|
||||||
float maxRenderTime = 0;
|
float maxRenderTime = 0;
|
||||||
float minRenderTime = 9999;
|
float minRenderTime = 9999;
|
||||||
for (auto const& rt : m_dLastRenderTimes) {
|
for (auto& rt : m_dLastRenderTimes) {
|
||||||
if (rt > maxRenderTime)
|
if (rt > maxRenderTime)
|
||||||
maxRenderTime = rt;
|
maxRenderTime = rt;
|
||||||
if (rt < minRenderTime)
|
if (rt < minRenderTime)
|
||||||
@@ -83,7 +83,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
float avgRenderTimeNoOverlay = 0;
|
float avgRenderTimeNoOverlay = 0;
|
||||||
float maxRenderTimeNoOverlay = 0;
|
float maxRenderTimeNoOverlay = 0;
|
||||||
float minRenderTimeNoOverlay = 9999;
|
float minRenderTimeNoOverlay = 9999;
|
||||||
for (auto const& rt : m_dLastRenderTimesNoOverlay) {
|
for (auto& rt : m_dLastRenderTimesNoOverlay) {
|
||||||
if (rt > maxRenderTimeNoOverlay)
|
if (rt > maxRenderTimeNoOverlay)
|
||||||
maxRenderTimeNoOverlay = rt;
|
maxRenderTimeNoOverlay = rt;
|
||||||
if (rt < minRenderTimeNoOverlay)
|
if (rt < minRenderTimeNoOverlay)
|
||||||
@@ -96,7 +96,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
|||||||
float avgAnimMgrTick = 0;
|
float avgAnimMgrTick = 0;
|
||||||
float maxAnimMgrTick = 0;
|
float maxAnimMgrTick = 0;
|
||||||
float minAnimMgrTick = 9999;
|
float minAnimMgrTick = 9999;
|
||||||
for (auto const& at : m_dLastAnimationTicks) {
|
for (auto& at : m_dLastAnimationTicks) {
|
||||||
if (at > maxAnimMgrTick)
|
if (at > maxAnimMgrTick)
|
||||||
maxAnimMgrTick = at;
|
maxAnimMgrTick = at;
|
||||||
if (at < minAnimMgrTick)
|
if (at < minAnimMgrTick)
|
||||||
@@ -217,7 +217,7 @@ void CHyprDebugOverlay::draw() {
|
|||||||
|
|
||||||
// draw the things
|
// draw the things
|
||||||
int offsetY = 0;
|
int offsetY = 0;
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
offsetY += m_mMonitorOverlays[m.get()].draw(offsetY);
|
offsetY += m_mMonitorOverlays[m.get()].draw(offsetY);
|
||||||
offsetY += 5; // for padding between mons
|
offsetY += 5; // for padding between mons
|
||||||
}
|
}
|
||||||
|
@@ -44,7 +44,7 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CC
|
|||||||
PNOTIF->icon = icon;
|
PNOTIF->icon = icon;
|
||||||
PNOTIF->fontSize = fontSize;
|
PNOTIF->fontSize = fontSize;
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
g_pCompositor->scheduleFrameForMonitor(m.get());
|
g_pCompositor->scheduleFrameForMonitor(m.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -87,7 +87,7 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
|
|||||||
const auto iconBackendID = iconBackendFromLayout(layout);
|
const auto iconBackendID = iconBackendFromLayout(layout);
|
||||||
const auto PBEZIER = g_pAnimationManager->getBezier("default");
|
const auto PBEZIER = g_pAnimationManager->getBezier("default");
|
||||||
|
|
||||||
for (auto const& notif : m_dNotifications) {
|
for (auto& notif : m_dNotifications) {
|
||||||
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
|
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
|
||||||
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);
|
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);
|
||||||
|
|
||||||
|
@@ -55,8 +55,7 @@ namespace Debug {
|
|||||||
// print date and time to the ofs
|
// print date and time to the ofs
|
||||||
if (disableTime && !**disableTime) {
|
if (disableTime && !**disableTime) {
|
||||||
#ifndef _LIBCPP_VERSION
|
#ifndef _LIBCPP_VERSION
|
||||||
static auto current_zone = std::chrono::current_zone();
|
const auto zt = std::chrono::zoned_time{std::chrono::current_zone(), std::chrono::system_clock::now()};
|
||||||
const auto zt = std::chrono::zoned_time{current_zone, std::chrono::system_clock::now()};
|
|
||||||
const auto hms = std::chrono::hh_mm_ss{zt.get_local_time() - std::chrono::floor<std::chrono::days>(zt.get_local_time())};
|
const auto hms = std::chrono::hh_mm_ss{zt.get_local_time() - std::chrono::floor<std::chrono::days>(zt.get_local_time())};
|
||||||
#else
|
#else
|
||||||
// TODO: current clang 17 does not support `zoned_time`, remove this once clang 19 is ready
|
// TODO: current clang 17 does not support `zoned_time`, remove this once clang 19 is ready
|
||||||
|
@@ -72,7 +72,7 @@ CLayerSurface::~CLayerSurface() {
|
|||||||
g_pHyprRenderer->makeEGLCurrent();
|
g_pHyprRenderer->makeEGLCurrent();
|
||||||
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == self.lock(); });
|
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == self.lock(); });
|
||||||
|
|
||||||
for (auto const& mon : g_pCompositor->m_vRealMonitors) {
|
for (auto& mon : g_pCompositor->m_vRealMonitors) {
|
||||||
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
|
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
|
||||||
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
|
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
|
||||||
}
|
}
|
||||||
@@ -366,7 +366,7 @@ void CLayerSurface::applyRules() {
|
|||||||
xray = -1;
|
xray = -1;
|
||||||
animationStyle.reset();
|
animationStyle.reset();
|
||||||
|
|
||||||
for (auto const& rule : g_pConfigManager->getMatchingRules(self.lock())) {
|
for (auto& rule : g_pConfigManager->getMatchingRules(self.lock())) {
|
||||||
if (rule.rule == "noanim")
|
if (rule.rule == "noanim")
|
||||||
noAnimations = true;
|
noAnimations = true;
|
||||||
else if (rule.rule == "blur")
|
else if (rule.rule == "blur")
|
||||||
@@ -394,11 +394,6 @@ void CLayerSurface::applyRules() {
|
|||||||
} else if (rule.rule.starts_with("animation")) {
|
} else if (rule.rule.starts_with("animation")) {
|
||||||
CVarList vars{rule.rule, 2, 's'};
|
CVarList vars{rule.rule, 2, 's'};
|
||||||
animationStyle = vars[1];
|
animationStyle = vars[1];
|
||||||
} else if (rule.rule.starts_with("order")) {
|
|
||||||
CVarList vars{rule.rule, 2, 's'};
|
|
||||||
try {
|
|
||||||
order = std::stoi(vars[1]);
|
|
||||||
} catch (...) { Debug::log(ERR, "Invalid value passed to order"); }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -55,7 +55,6 @@ class CLayerSurface {
|
|||||||
bool ignoreAlpha = false;
|
bool ignoreAlpha = false;
|
||||||
float ignoreAlphaValue = 0.f;
|
float ignoreAlphaValue = 0.f;
|
||||||
bool dimAround = false;
|
bool dimAround = false;
|
||||||
int64_t order = 0;
|
|
||||||
|
|
||||||
std::optional<std::string> animationStyle;
|
std::optional<std::string> animationStyle;
|
||||||
|
|
||||||
|
@@ -202,13 +202,6 @@ void CPopup::reposition() {
|
|||||||
m_pResource->applyPositioning(box, COORDS);
|
m_pResource->applyPositioning(box, COORDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
SP<CWLSurface> CPopup::getT1Owner() {
|
|
||||||
if (m_pWindowOwner)
|
|
||||||
return m_pWindowOwner->m_pWLSurface;
|
|
||||||
else
|
|
||||||
return m_pLayerOwner->surface;
|
|
||||||
}
|
|
||||||
|
|
||||||
Vector2D CPopup::coordsRelativeToParent() {
|
Vector2D CPopup::coordsRelativeToParent() {
|
||||||
Vector2D offset;
|
Vector2D offset;
|
||||||
|
|
||||||
@@ -258,7 +251,7 @@ void CPopup::recheckTree() {
|
|||||||
|
|
||||||
void CPopup::recheckChildrenRecursive() {
|
void CPopup::recheckChildrenRecursive() {
|
||||||
auto cpy = m_vChildren;
|
auto cpy = m_vChildren;
|
||||||
for (auto const& c : cpy) {
|
for (auto& c : cpy) {
|
||||||
c->onCommit(true);
|
c->onCommit(true);
|
||||||
c->recheckChildrenRecursive();
|
c->recheckChildrenRecursive();
|
||||||
}
|
}
|
||||||
@@ -289,14 +282,14 @@ bool CPopup::visible() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPopup::bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data) {
|
void CPopup::bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data) {
|
||||||
for (auto const& n : nodes) {
|
for (auto& n : nodes) {
|
||||||
fn(n, data);
|
fn(n, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CPopup*> nodes2;
|
std::vector<CPopup*> nodes2;
|
||||||
|
|
||||||
for (auto const& n : nodes) {
|
for (auto& n : nodes) {
|
||||||
for (auto const& c : n->m_vChildren) {
|
for (auto& c : n->m_vChildren) {
|
||||||
nodes2.push_back(c.get());
|
nodes2.push_back(c.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -315,7 +308,7 @@ CPopup* CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
|||||||
std::vector<CPopup*> popups;
|
std::vector<CPopup*> popups;
|
||||||
breadthfirst([](CPopup* popup, void* data) { ((std::vector<CPopup*>*)data)->push_back(popup); }, &popups);
|
breadthfirst([](CPopup* popup, void* data) { ((std::vector<CPopup*>*)data)->push_back(popup); }, &popups);
|
||||||
|
|
||||||
for (auto const& p : popups | std::views::reverse) {
|
for (auto& p : popups | std::views::reverse) {
|
||||||
if (!p->m_pResource)
|
if (!p->m_pResource)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -18,7 +18,6 @@ class CPopup {
|
|||||||
|
|
||||||
~CPopup();
|
~CPopup();
|
||||||
|
|
||||||
SP<CWLSurface> getT1Owner();
|
|
||||||
Vector2D coordsRelativeToParent();
|
Vector2D coordsRelativeToParent();
|
||||||
Vector2D coordsGlobal();
|
Vector2D coordsGlobal();
|
||||||
|
|
||||||
|
@@ -65,7 +65,7 @@ void CSubsurface::checkSiblingDamage() {
|
|||||||
|
|
||||||
const double SCALE = m_pWindowParent.lock() && m_pWindowParent->m_bIsX11 ? 1.0 / m_pWindowParent->m_fX11SurfaceScaledBy : 1.0;
|
const double SCALE = m_pWindowParent.lock() && m_pWindowParent->m_bIsX11 ? 1.0 / m_pWindowParent->m_fX11SurfaceScaledBy : 1.0;
|
||||||
|
|
||||||
for (auto const& n : m_pParent->m_vChildren) {
|
for (auto& n : m_pParent->m_vChildren) {
|
||||||
if (n.get() == this)
|
if (n.get() == this)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ void CSubsurface::checkSiblingDamage() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CSubsurface::recheckDamageForSubsurfaces() {
|
void CSubsurface::recheckDamageForSubsurfaces() {
|
||||||
for (auto const& n : m_vChildren) {
|
for (auto& n : m_vChildren) {
|
||||||
const auto COORDS = n->coordsGlobal();
|
const auto COORDS = n->coordsGlobal();
|
||||||
g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y);
|
g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y);
|
||||||
}
|
}
|
||||||
@@ -183,7 +183,7 @@ Vector2D CSubsurface::coordsGlobal() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
|
void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
|
||||||
for (auto const& s : pSurface->subsurfaces) {
|
for (auto& s : pSurface->subsurfaces) {
|
||||||
if (!s || s->surface->hlSurface /* already assigned */)
|
if (!s || s->surface->hlSurface /* already assigned */)
|
||||||
continue;
|
continue;
|
||||||
onNewSubsurface(s.lock());
|
onNewSubsurface(s.lock());
|
||||||
|
@@ -21,6 +21,7 @@ PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
|
|||||||
|
|
||||||
pWindow->m_pSelf = pWindow;
|
pWindow->m_pSelf = pWindow;
|
||||||
pWindow->m_bIsX11 = true;
|
pWindow->m_bIsX11 = true;
|
||||||
|
pWindow->m_iX11Type = surface->overrideRedirect ? 2 : 1;
|
||||||
|
|
||||||
pWindow->m_vRealPosition.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
pWindow->m_vRealPosition.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
pWindow->m_vRealSize.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
pWindow->m_vRealSize.create(g_pConfigManager->getAnimationPropertyConfig("windowsIn"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
@@ -30,7 +31,6 @@ PHLWINDOW CWindow::create(SP<CXWaylandSurface> surface) {
|
|||||||
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||||
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
pWindow->m_fMovingToWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
|
|
||||||
|
|
||||||
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
||||||
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
||||||
@@ -52,7 +52,6 @@ PHLWINDOW CWindow::create(SP<CXDGSurfaceResource> resource) {
|
|||||||
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
pWindow->m_fActiveInactiveAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
pWindow->m_cRealShadowColor.create(g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), pWindow, AVARDAMAGE_SHADOW);
|
||||||
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
pWindow->m_fDimPercent.create(g_pConfigManager->getAnimationPropertyConfig("fadeDim"), pWindow, AVARDAMAGE_ENTIRE);
|
||||||
pWindow->m_fMovingToWorkspaceAlpha.create(g_pConfigManager->getAnimationPropertyConfig("fadeOut"), pWindow, AVARDAMAGE_ENTIRE);
|
|
||||||
|
|
||||||
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
pWindow->addWindowDeco(std::make_unique<CHyprDropShadowDecoration>(pWindow));
|
||||||
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
pWindow->addWindowDeco(std::make_unique<CHyprBorderDecoration>(pWindow));
|
||||||
@@ -253,7 +252,7 @@ void CWindow::updateWindowDecos() {
|
|||||||
if (!m_bIsMapped || isHidden())
|
if (!m_bIsMapped || isHidden())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& wd : m_vDecosToRemove) {
|
for (auto& wd : m_vDecosToRemove) {
|
||||||
for (auto it = m_dWindowDecorations.begin(); it != m_dWindowDecorations.end(); it++) {
|
for (auto it = m_dWindowDecorations.begin(); it != m_dWindowDecorations.end(); it++) {
|
||||||
if (it->get() == wd) {
|
if (it->get() == wd) {
|
||||||
g_pDecorationPositioner->uncacheDecoration(it->get());
|
g_pDecorationPositioner->uncacheDecoration(it->get());
|
||||||
@@ -271,11 +270,11 @@ void CWindow::updateWindowDecos() {
|
|||||||
// make a copy because updateWindow can remove decos.
|
// make a copy because updateWindow can remove decos.
|
||||||
std::vector<IHyprWindowDecoration*> decos;
|
std::vector<IHyprWindowDecoration*> decos;
|
||||||
|
|
||||||
for (auto const& wd : m_dWindowDecorations) {
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
decos.push_back(wd.get());
|
decos.push_back(wd.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& wd : decos) {
|
for (auto& wd : decos) {
|
||||||
if (std::find_if(m_dWindowDecorations.begin(), m_dWindowDecorations.end(), [wd](const auto& other) { return other.get() == wd; }) == m_dWindowDecorations.end())
|
if (std::find_if(m_dWindowDecorations.begin(), m_dWindowDecorations.end(), [wd](const auto& other) { return other.get() == wd; }) == m_dWindowDecorations.end())
|
||||||
continue;
|
continue;
|
||||||
wd->updateWindow(m_pSelf.lock());
|
wd->updateWindow(m_pSelf.lock());
|
||||||
@@ -297,7 +296,7 @@ void CWindow::removeWindowDeco(IHyprWindowDecoration* deco) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::uncacheWindowDecos() {
|
void CWindow::uncacheWindowDecos() {
|
||||||
for (auto const& wd : m_dWindowDecorations) {
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
g_pDecorationPositioner->uncacheDecoration(wd.get());
|
g_pDecorationPositioner->uncacheDecoration(wd.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -306,7 +305,7 @@ bool CWindow::checkInputOnDecos(const eInputType type, const Vector2D& mouseCoor
|
|||||||
if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords))
|
if (type != INPUT_TYPE_DRAG_END && hasPopupAt(mouseCoords))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto const& wd : m_dWindowDecorations) {
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -338,7 +337,7 @@ pid_t CWindow::getPID() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) {
|
IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) {
|
||||||
for (auto const& wd : m_dWindowDecorations) {
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
if (wd->getDecorationType() == type)
|
if (wd->getDecorationType() == type)
|
||||||
return wd.get();
|
return wd.get();
|
||||||
}
|
}
|
||||||
@@ -408,11 +407,6 @@ void CWindow::moveToWorkspace(PHLWORKSPACE pWorkspace) {
|
|||||||
|
|
||||||
const auto OLDWORKSPACE = m_pWorkspace;
|
const auto OLDWORKSPACE = m_pWorkspace;
|
||||||
|
|
||||||
m_iMonitorMovedFrom = OLDWORKSPACE ? OLDWORKSPACE->m_iMonitorID : -1;
|
|
||||||
m_fMovingToWorkspaceAlpha.setValueAndWarp(1.F);
|
|
||||||
m_fMovingToWorkspaceAlpha = 0.F;
|
|
||||||
m_fMovingToWorkspaceAlpha.setCallbackOnEnd([this](void* thisptr) { m_iMonitorMovedFrom = -1; });
|
|
||||||
|
|
||||||
m_pWorkspace = pWorkspace;
|
m_pWorkspace = pWorkspace;
|
||||||
|
|
||||||
setAnimationsToMove();
|
setAnimationsToMove();
|
||||||
@@ -460,7 +454,7 @@ PHLWINDOW CWindow::X11TransientFor() {
|
|||||||
s = s->parent;
|
s = s->parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_pXWaylandSurface != s)
|
if (w->m_pXWaylandSurface != s)
|
||||||
continue;
|
continue;
|
||||||
return w;
|
return w;
|
||||||
@@ -470,7 +464,7 @@ PHLWINDOW CWindow::X11TransientFor() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CWindow::removeDecorationByType(eDecorationType type) {
|
void CWindow::removeDecorationByType(eDecorationType type) {
|
||||||
for (auto const& wd : m_dWindowDecorations) {
|
for (auto& wd : m_dWindowDecorations) {
|
||||||
if (wd->getDecorationType() == type)
|
if (wd->getDecorationType() == type)
|
||||||
m_vDecosToRemove.push_back(wd.get());
|
m_vDecosToRemove.push_back(wd.get());
|
||||||
}
|
}
|
||||||
@@ -508,7 +502,6 @@ void CWindow::onUnmap() {
|
|||||||
m_fAlpha.setCallbackOnEnd(unregisterVar);
|
m_fAlpha.setCallbackOnEnd(unregisterVar);
|
||||||
m_cRealShadowColor.setCallbackOnEnd(unregisterVar);
|
m_cRealShadowColor.setCallbackOnEnd(unregisterVar);
|
||||||
m_fDimPercent.setCallbackOnEnd(unregisterVar);
|
m_fDimPercent.setCallbackOnEnd(unregisterVar);
|
||||||
m_fMovingToWorkspaceAlpha.setCallbackOnEnd(unregisterVar);
|
|
||||||
|
|
||||||
m_vRealSize.setCallbackOnBegin(nullptr);
|
m_vRealSize.setCallbackOnBegin(nullptr);
|
||||||
|
|
||||||
@@ -549,7 +542,6 @@ void CWindow::onMap() {
|
|||||||
m_fAlpha.resetAllCallbacks();
|
m_fAlpha.resetAllCallbacks();
|
||||||
m_cRealShadowColor.resetAllCallbacks();
|
m_cRealShadowColor.resetAllCallbacks();
|
||||||
m_fDimPercent.resetAllCallbacks();
|
m_fDimPercent.resetAllCallbacks();
|
||||||
m_fMovingToWorkspaceAlpha.resetAllCallbacks();
|
|
||||||
|
|
||||||
m_vRealPosition.registerVar();
|
m_vRealPosition.registerVar();
|
||||||
m_vRealSize.registerVar();
|
m_vRealSize.registerVar();
|
||||||
@@ -559,7 +551,6 @@ void CWindow::onMap() {
|
|||||||
m_fAlpha.registerVar();
|
m_fAlpha.registerVar();
|
||||||
m_cRealShadowColor.registerVar();
|
m_cRealShadowColor.registerVar();
|
||||||
m_fDimPercent.registerVar();
|
m_fDimPercent.registerVar();
|
||||||
m_fMovingToWorkspaceAlpha.registerVar();
|
|
||||||
|
|
||||||
m_fBorderAngleAnimationProgress.setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false);
|
m_fBorderAngleAnimationProgress.setCallbackOnEnd([&](void* ptr) { onBorderAngleAnimEnd(ptr); }, false);
|
||||||
|
|
||||||
@@ -626,7 +617,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
|||||||
|
|
||||||
int opacityIDX = 0;
|
int opacityIDX = 0;
|
||||||
|
|
||||||
for (auto const& r : vars) {
|
for (auto& r : vars) {
|
||||||
if (r == "opacity")
|
if (r == "opacity")
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -675,7 +666,7 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& token : colorsAndAngles) {
|
for (auto& token : colorsAndAngles) {
|
||||||
// The first angle, or an explicit "0deg", splits the two gradients
|
// The first angle, or an explicit "0deg", splits the two gradients
|
||||||
if (active && token.contains("deg")) {
|
if (active && token.contains("deg")) {
|
||||||
activeBorderGradient.m_fAngle = std::stoi(token.substr(0, token.size() - 3)) * (PI / 180.0);
|
activeBorderGradient.m_fAngle = std::stoi(token.substr(0, token.size() - 3)) * (PI / 180.0);
|
||||||
@@ -757,9 +748,6 @@ void CWindow::applyDynamicRule(const SWindowRule& r) {
|
|||||||
if (m_sGroupData.pNextWindow.expired())
|
if (m_sGroupData.pNextWindow.expired())
|
||||||
setHidden(false);
|
setHidden(false);
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
} catch (std::exception& e) { Debug::log(ERR, "minsize rule \"{}\" failed with: {}", r.szRule, e.what()); }
|
||||||
} else if (r.szRule == "renderunfocused") {
|
|
||||||
m_sWindowData.renderUnfocused = CWindowOverridableVar(true, priority);
|
|
||||||
g_pHyprRenderer->addWindowToRenderUnfocused(m_pSelf.lock());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -777,14 +765,12 @@ void CWindow::updateDynamicRules() {
|
|||||||
m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE);
|
m_sWindowData.activeBorderColor.unset(PRIORITY_WINDOW_RULE);
|
||||||
m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE);
|
m_sWindowData.inactiveBorderColor.unset(PRIORITY_WINDOW_RULE);
|
||||||
|
|
||||||
m_sWindowData.renderUnfocused.unset(PRIORITY_WINDOW_RULE);
|
|
||||||
|
|
||||||
m_eIdleInhibitMode = IDLEINHIBIT_NONE;
|
m_eIdleInhibitMode = IDLEINHIBIT_NONE;
|
||||||
|
|
||||||
m_tags.removeDynamicTags();
|
m_tags.removeDynamicTags();
|
||||||
|
|
||||||
m_vMatchedRules = g_pConfigManager->getMatchingRules(m_pSelf.lock());
|
m_vMatchedRules = g_pConfigManager->getMatchingRules(m_pSelf.lock());
|
||||||
for (auto const& r : m_vMatchedRules) {
|
for (auto& r : m_vMatchedRules) {
|
||||||
applyDynamicRule(r);
|
applyDynamicRule(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -895,7 +881,7 @@ void CWindow::destroyGroup() {
|
|||||||
addresses += std::format("{:x},", (uintptr_t)curr.get());
|
addresses += std::format("{:x},", (uintptr_t)curr.get());
|
||||||
} while (curr.get() != this);
|
} while (curr.get() != this);
|
||||||
|
|
||||||
for (auto const& w : members) {
|
for (auto& w : members) {
|
||||||
if (w->m_sGroupData.head)
|
if (w->m_sGroupData.head)
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(curr);
|
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(curr);
|
||||||
w->m_sGroupData.head = false;
|
w->m_sGroupData.head = false;
|
||||||
@@ -903,7 +889,7 @@ void CWindow::destroyGroup() {
|
|||||||
|
|
||||||
const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
|
const bool GROUPSLOCKEDPREV = g_pKeybindManager->m_bGroupsLocked;
|
||||||
g_pKeybindManager->m_bGroupsLocked = true;
|
g_pKeybindManager->m_bGroupsLocked = true;
|
||||||
for (auto const& w : members) {
|
for (auto& w : members) {
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(w);
|
g_pLayoutManager->getCurrentLayout()->onWindowCreated(w);
|
||||||
w->updateWindowDecos();
|
w->updateWindowDecos();
|
||||||
}
|
}
|
||||||
@@ -951,16 +937,12 @@ int CWindow::getGroupSize() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
bool CWindow::canBeGroupedInto(PHLWINDOW pWindow) {
|
||||||
static auto ALLOWGROUPMERGE = CConfigValue<Hyprlang::INT>("group:merge_groups_on_drag");
|
|
||||||
bool isGroup = m_sGroupData.pNextWindow;
|
|
||||||
bool disallowDragIntoGroup = g_pInputManager->m_bWasDraggingWindow && isGroup && !bool(*ALLOWGROUPMERGE);
|
|
||||||
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
return !g_pKeybindManager->m_bGroupsLocked // global group lock disengaged
|
||||||
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
&& ((m_eGroupRules & GROUP_INVADE && m_bFirstMap) // window ignore local group locks, or
|
||||||
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
|| (!pWindow->getGroupHead()->m_sGroupData.locked // target unlocked
|
||||||
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
&& !(m_sGroupData.pNextWindow.lock() && getGroupHead()->m_sGroupData.locked))) // source unlocked or isn't group
|
||||||
&& !m_sGroupData.deny // source is not denied entry
|
&& !m_sGroupData.deny // source is not denied entry
|
||||||
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap) // group rule doesn't prevent adding window
|
&& !(m_eGroupRules & GROUP_BARRED && m_bFirstMap); // group rule doesn't prevent adding window
|
||||||
&& !disallowDragIntoGroup; // config allows groups to be merged
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
PHLWINDOW CWindow::getGroupWindowByIndex(int index) {
|
||||||
@@ -991,7 +973,7 @@ void CWindow::setGroupCurrent(PHLWINDOW pWindow) {
|
|||||||
const auto PCURRENT = getGroupCurrent();
|
const auto PCURRENT = getGroupCurrent();
|
||||||
const bool FULLSCREEN = PCURRENT->isFullscreen();
|
const bool FULLSCREEN = PCURRENT->isFullscreen();
|
||||||
const auto WORKSPACE = PCURRENT->m_pWorkspace;
|
const auto WORKSPACE = PCURRENT->m_pWorkspace;
|
||||||
const auto MODE = PCURRENT->m_sFullscreenState.internal;
|
const auto MODE = PCURRENT->m_sFullscreenState.client;
|
||||||
|
|
||||||
const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goal();
|
const auto PWINDOWSIZE = PCURRENT->m_vRealSize.goal();
|
||||||
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goal();
|
const auto PWINDOWPOS = PCURRENT->m_vRealPosition.goal();
|
||||||
@@ -1300,7 +1282,7 @@ std::unordered_map<std::string, std::string> CWindow::getEnv() {
|
|||||||
|
|
||||||
CVarList envs(std::string{buffer.data(), buffer.size() - 1}, 0, '\n', true);
|
CVarList envs(std::string{buffer.data(), buffer.size() - 1}, 0, '\n', true);
|
||||||
|
|
||||||
for (auto const& e : envs) {
|
for (auto& e : envs) {
|
||||||
if (!e.contains('='))
|
if (!e.contains('='))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1325,11 +1307,6 @@ void CWindow::activate(bool force) {
|
|||||||
if (!force && (!m_sWindowData.focusOnActivate.valueOr(*PFOCUSONACTIVATE) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE)))
|
if (!force && (!m_sWindowData.focusOnActivate.valueOr(*PFOCUSONACTIVATE) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE_FOCUSONLY) || (m_eSuppressedEvents & SUPPRESS_ACTIVATE)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!m_bIsMapped) {
|
|
||||||
Debug::log(LOG, "Ignoring CWindow::activate focus/warp, window is not mapped yet.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_bIsFloating)
|
if (m_bIsFloating)
|
||||||
g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true);
|
g_pCompositor->changeWindowZOrder(m_pSelf.lock(), true);
|
||||||
|
|
||||||
@@ -1534,7 +1511,7 @@ PHLWINDOW CWindow::getSwallower() {
|
|||||||
if (!currentPid)
|
if (!currentPid)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->isHidden())
|
if (!w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1559,7 +1536,7 @@ PHLWINDOW CWindow::getSwallower() {
|
|||||||
return candidates.at(0);
|
return candidates.at(0);
|
||||||
|
|
||||||
// walk up the focus history and find the last focused
|
// walk up the focus history and find the last focused
|
||||||
for (auto const& w : g_pCompositor->m_vWindowFocusHistory) {
|
for (auto& w : g_pCompositor->m_vWindowFocusHistory) {
|
||||||
if (!w)
|
if (!w)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1579,11 +1556,3 @@ void CWindow::unsetWindowData(eOverridePriority priority) {
|
|||||||
element.second(m_pSelf.lock())->unset(priority);
|
element.second(m_pSelf.lock())->unset(priority);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CWindow::isX11OverrideRedirect() {
|
|
||||||
return m_pXWaylandSurface && m_pXWaylandSurface->overrideRedirect;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool CWindow::isModal() {
|
|
||||||
return (m_pXWaylandSurface && m_pXWaylandSurface->modal);
|
|
||||||
}
|
|
||||||
|
@@ -174,7 +174,6 @@ struct SWindowData {
|
|||||||
CWindowOverridableVar<bool> syncFullscreen = true;
|
CWindowOverridableVar<bool> syncFullscreen = true;
|
||||||
CWindowOverridableVar<bool> tearing = false;
|
CWindowOverridableVar<bool> tearing = false;
|
||||||
CWindowOverridableVar<bool> xray = false;
|
CWindowOverridableVar<bool> xray = false;
|
||||||
CWindowOverridableVar<bool> renderUnfocused = false;
|
|
||||||
|
|
||||||
CWindowOverridableVar<int> rounding;
|
CWindowOverridableVar<int> rounding;
|
||||||
CWindowOverridableVar<int> borderSize;
|
CWindowOverridableVar<int> borderSize;
|
||||||
@@ -289,6 +288,8 @@ class CWindow {
|
|||||||
// XWayland stuff
|
// XWayland stuff
|
||||||
bool m_bIsX11 = false;
|
bool m_bIsX11 = false;
|
||||||
PHLWINDOWREF m_pX11Parent;
|
PHLWINDOWREF m_pX11Parent;
|
||||||
|
uint64_t m_iX11Type = 0;
|
||||||
|
bool m_bIsModal = false;
|
||||||
bool m_bX11DoesntWantBorders = false;
|
bool m_bX11DoesntWantBorders = false;
|
||||||
bool m_bX11ShouldntFocus = false;
|
bool m_bX11ShouldntFocus = false;
|
||||||
float m_fX11SurfaceScaledBy = 1.f;
|
float m_fX11SurfaceScaledBy = 1.f;
|
||||||
@@ -351,10 +352,6 @@ class CWindow {
|
|||||||
// animated tint
|
// animated tint
|
||||||
CAnimatedVariable<float> m_fDimPercent;
|
CAnimatedVariable<float> m_fDimPercent;
|
||||||
|
|
||||||
// animate moving to an invisible workspace
|
|
||||||
int m_iMonitorMovedFrom = -1; // -1 means not moving
|
|
||||||
CAnimatedVariable<float> m_fMovingToWorkspaceAlpha;
|
|
||||||
|
|
||||||
// swallowing
|
// swallowing
|
||||||
PHLWINDOWREF m_pSwallowed;
|
PHLWINDOWREF m_pSwallowed;
|
||||||
|
|
||||||
@@ -467,8 +464,6 @@ class CWindow {
|
|||||||
void warpCursor();
|
void warpCursor();
|
||||||
PHLWINDOW getSwallower();
|
PHLWINDOW getSwallower();
|
||||||
void unsetWindowData(eOverridePriority priority);
|
void unsetWindowData(eOverridePriority priority);
|
||||||
bool isX11OverrideRedirect();
|
|
||||||
bool isModal();
|
|
||||||
|
|
||||||
// listeners
|
// listeners
|
||||||
void onAck(uint32_t serial);
|
void onAck(uint32_t serial);
|
||||||
|
@@ -5,18 +5,18 @@
|
|||||||
#include <hyprutils/string/String.hpp>
|
#include <hyprutils/string/String.hpp>
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
|
|
||||||
PHLWORKSPACE CWorkspace::create(WORKSPACEID id, MONITORID monitorID, std::string name, bool special, bool isEmpty) {
|
PHLWORKSPACE CWorkspace::create(WORKSPACEID id, MONITORID monitorID, std::string name, bool special, bool isEmtpy) {
|
||||||
PHLWORKSPACE workspace = makeShared<CWorkspace>(id, monitorID, name, special, isEmpty);
|
PHLWORKSPACE workspace = makeShared<CWorkspace>(id, monitorID, name, special, isEmtpy);
|
||||||
workspace->init(workspace);
|
workspace->init(workspace);
|
||||||
return workspace;
|
return workspace;
|
||||||
}
|
}
|
||||||
|
|
||||||
CWorkspace::CWorkspace(WORKSPACEID id, MONITORID monitorID, std::string name, bool special, bool isEmpty) {
|
CWorkspace::CWorkspace(WORKSPACEID id, MONITORID monitorID, std::string name, bool special, bool isEmtpy) {
|
||||||
m_iMonitorID = monitorID;
|
m_iMonitorID = monitorID;
|
||||||
m_iID = id;
|
m_iID = id;
|
||||||
m_szName = name;
|
m_szName = name;
|
||||||
m_bIsSpecialWorkspace = special;
|
m_bIsSpecialWorkspace = special;
|
||||||
m_bWasCreatedEmpty = isEmpty;
|
m_bWasCreatedEmtpy = isEmtpy;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CWorkspace::init(PHLWORKSPACE self) {
|
void CWorkspace::init(PHLWORKSPACE self) {
|
||||||
@@ -26,12 +26,18 @@ void CWorkspace::init(PHLWORKSPACE self) {
|
|||||||
g_pConfigManager->getAnimationPropertyConfig("workspacesIn"),
|
g_pConfigManager->getAnimationPropertyConfig("workspacesIn"),
|
||||||
self, AVARDAMAGE_ENTIRE);
|
self, AVARDAMAGE_ENTIRE);
|
||||||
m_fAlpha.create(AVARTYPE_FLOAT,
|
m_fAlpha.create(AVARTYPE_FLOAT,
|
||||||
m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspaceIn") : g_pConfigManager->getAnimationPropertyConfig("workspacesIn"), self,
|
m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("fadeSpecialWorkspaceIn") :
|
||||||
AVARDAMAGE_ENTIRE);
|
g_pConfigManager->getAnimationPropertyConfig("fadeWorkspacesIn"),
|
||||||
|
self, AVARDAMAGE_ENTIRE);
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
m_fAlpha.setValueAndWarp(1.f);
|
||||||
|
m_fScaleClients.create(
|
||||||
|
AVARTYPE_FLOAT, m_bIsSpecialWorkspace ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspaceIn") : g_pConfigManager->getAnimationPropertyConfig("workspacesIn"),
|
||||||
|
self, AVARDAMAGE_ENTIRE);
|
||||||
|
m_fScaleClients.setValueAndWarp(1.f);
|
||||||
|
|
||||||
m_vRenderOffset.registerVar();
|
m_vRenderOffset.registerVar();
|
||||||
m_fAlpha.registerVar();
|
m_fAlpha.registerVar();
|
||||||
|
m_fScaleClients.registerVar();
|
||||||
|
|
||||||
const auto RULEFORTHIS = g_pConfigManager->getWorkspaceRuleFor(self);
|
const auto RULEFORTHIS = g_pConfigManager->getWorkspaceRuleFor(self);
|
||||||
if (RULEFORTHIS.defaultName.has_value())
|
if (RULEFORTHIS.defaultName.has_value())
|
||||||
@@ -49,9 +55,9 @@ void CWorkspace::init(PHLWORKSPACE self) {
|
|||||||
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(self);
|
const auto WORKSPACERULE = g_pConfigManager->getWorkspaceRuleFor(self);
|
||||||
m_bPersistent = WORKSPACERULE.isPersistent;
|
m_bPersistent = WORKSPACERULE.isPersistent;
|
||||||
|
|
||||||
if (self->m_bWasCreatedEmpty)
|
if (self->m_bWasCreatedEmtpy)
|
||||||
if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
|
if (auto cmd = WORKSPACERULE.onCreatedEmptyRunCmd)
|
||||||
g_pKeybindManager->spawnWithRules(*cmd, self);
|
g_pKeybindManager->spawn(*cmd);
|
||||||
|
|
||||||
g_pEventManager->postEvent({"createworkspace", m_szName});
|
g_pEventManager->postEvent({"createworkspace", m_szName});
|
||||||
g_pEventManager->postEvent({"createworkspacev2", std::format("{},{}", m_iID, m_szName)});
|
g_pEventManager->postEvent({"createworkspacev2", std::format("{},{}", m_iID, m_szName)});
|
||||||
@@ -84,17 +90,19 @@ CWorkspace::~CWorkspace() {
|
|||||||
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
||||||
if (!instant) {
|
if (!instant) {
|
||||||
const std::string ANIMNAME = std::format("{}{}", m_bIsSpecialWorkspace ? "specialWorkspace" : "workspaces", in ? "In" : "Out");
|
const std::string ANIMNAME = std::format("{}{}", m_bIsSpecialWorkspace ? "specialWorkspace" : "workspaces", in ? "In" : "Out");
|
||||||
|
const std::string ANIMNAME2 = std::format("fade{}{}", m_bIsSpecialWorkspace ? "SpecialWorkspace" : "Workspaces", in ? "In" : "Out");
|
||||||
|
|
||||||
m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME);
|
m_fAlpha.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME2);
|
||||||
m_vRenderOffset.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME);
|
m_vRenderOffset.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME);
|
||||||
|
m_fScaleClients.m_pConfig = g_pConfigManager->getAnimationPropertyConfig(ANIMNAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
|
const auto ANIMSTYLE = m_vRenderOffset.m_pConfig->pValues->internalStyle;
|
||||||
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
static auto PWORKSPACEGAP = CConfigValue<Hyprlang::INT>("general:gaps_workspaces");
|
||||||
|
|
||||||
// set floating windows offset callbacks
|
// set floating windows offset callbacks
|
||||||
m_vRenderOffset.setUpdateCallback([&](void*) {
|
m_vRenderOffset.setUpdateCallback([&](void*) {
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!validMapped(w) || w->workspaceID() != m_iID)
|
if (!validMapped(w) || w->workspaceID() != m_iID)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -102,95 +110,73 @@ void CWorkspace::startAnim(bool in, bool left, bool instant) {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
if (ANIMSTYLE.starts_with("slidefade")) {
|
m_fAlpha.setValueAndWarp(in ? 0.F : 1.F);
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
m_fAlpha = in ? 1.F : 0.F;
|
||||||
float movePerc = 100.f;
|
|
||||||
|
// handle animation styles for the movement one
|
||||||
|
if (m_vRenderOffset.m_pConfig->pValues->internalEnabled) {
|
||||||
|
if (ANIMSTYLE.starts_with("slide") && ANIMSTYLE.contains("%")) {
|
||||||
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
|
float movePerc = 0.F;
|
||||||
|
|
||||||
if (ANIMSTYLE.find("%") != std::string::npos) {
|
|
||||||
try {
|
try {
|
||||||
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
||||||
movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
movePerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||||
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
||||||
}
|
|
||||||
|
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
|
m_fScaleClients.setValueAndWarp(1.F);
|
||||||
|
|
||||||
if (ANIMSTYLE.starts_with("slidefadevert")) {
|
if (ANIMSTYLE.starts_with("slidevert")) {
|
||||||
if (in) {
|
if (in) {
|
||||||
m_fAlpha.setValueAndWarp(0.f);
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, (left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y) * (movePerc / 100.f)));
|
||||||
m_fAlpha = 1.f;
|
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
} else {
|
} else
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
|
||||||
m_fAlpha = 0.f;
|
|
||||||
m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
m_vRenderOffset = Vector2D(0.0, (left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y) * (movePerc / 100.f));
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (in) {
|
if (in) {
|
||||||
m_fAlpha.setValueAndWarp(0.f);
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
m_vRenderOffset.setValueAndWarp(Vector2D((left ? PMONITOR->vecSize.x : -PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0));
|
||||||
m_fAlpha = 1.f;
|
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
} else {
|
} else
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
|
||||||
m_fAlpha = 0.f;
|
|
||||||
m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
m_vRenderOffset = Vector2D((left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x) * (movePerc / 100.f), 0.0);
|
||||||
}
|
}
|
||||||
}
|
} else if (ANIMSTYLE.starts_with("popin")) {
|
||||||
} else if (ANIMSTYLE == "fade") {
|
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0));
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
|
|
||||||
|
float startPerc = 0.F;
|
||||||
|
|
||||||
|
try {
|
||||||
|
auto percstr = ANIMSTYLE.substr(ANIMSTYLE.find_last_of(' ') + 1);
|
||||||
|
startPerc = std::stoi(percstr.substr(0, percstr.length() - 1));
|
||||||
|
} catch (std::exception& e) { Debug::log(ERR, "Error in startAnim: invalid percentage"); }
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
m_fAlpha.setValueAndWarp(0.f);
|
m_fScaleClients.setValueAndWarp(startPerc / 100.F);
|
||||||
m_fAlpha = 1.f;
|
m_fScaleClients = 1.F;
|
||||||
} else {
|
} else {
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
m_fScaleClients.setValueAndWarp(1.F);
|
||||||
m_fAlpha = 0.f;
|
m_fScaleClients = startPerc / 100.F;
|
||||||
}
|
|
||||||
} else if (ANIMSTYLE == "slidevert") {
|
|
||||||
// fallback is slide
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
|
||||||
const auto YDISTANCE = PMONITOR->vecSize.y + *PWORKSPACEGAP;
|
|
||||||
|
|
||||||
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
|
||||||
|
|
||||||
if (in) {
|
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(0.0, left ? YDISTANCE : -YDISTANCE));
|
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
|
||||||
} else {
|
|
||||||
m_vRenderOffset = Vector2D(0.0, left ? -YDISTANCE : YDISTANCE);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// fallback is slide
|
// fallback is slide
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
|
||||||
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
|
const auto XDISTANCE = PMONITOR->vecSize.x + *PWORKSPACEGAP;
|
||||||
|
|
||||||
m_fAlpha.setValueAndWarp(1.f); // fix a bug, if switching from fade -> slide.
|
m_fScaleClients.setValueAndWarp(1.F);
|
||||||
|
|
||||||
if (in) {
|
if (in) {
|
||||||
m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
|
m_vRenderOffset.setValueAndWarp(Vector2D(left ? XDISTANCE : -XDISTANCE, 0.0));
|
||||||
m_vRenderOffset = Vector2D(0, 0);
|
m_vRenderOffset = Vector2D(0, 0);
|
||||||
} else {
|
} else
|
||||||
m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0.0);
|
m_vRenderOffset = Vector2D(left ? -XDISTANCE : XDISTANCE, 0.0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_bIsSpecialWorkspace) {
|
|
||||||
// required for open/close animations
|
|
||||||
if (in) {
|
|
||||||
m_fAlpha.setValueAndWarp(0.f);
|
|
||||||
m_fAlpha = 1.f;
|
|
||||||
} else {
|
|
||||||
m_fAlpha.setValueAndWarp(1.f);
|
|
||||||
m_fAlpha = 0.f;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (instant) {
|
if (instant) {
|
||||||
m_vRenderOffset.warp();
|
m_vRenderOffset.warp();
|
||||||
m_fAlpha.warp();
|
m_fAlpha.warp();
|
||||||
|
m_fScaleClients.warp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -386,7 +372,7 @@ bool CWorkspace::matchesStaticSelector(const std::string& selector_) {
|
|||||||
bool wantsCountVisible = false;
|
bool wantsCountVisible = false;
|
||||||
|
|
||||||
int flagCount = 0;
|
int flagCount = 0;
|
||||||
for (auto const& flag : prop) {
|
for (auto& flag : prop) {
|
||||||
if (flag == 't' && wantsOnlyTiled == -1) {
|
if (flag == 't' && wantsOnlyTiled == -1) {
|
||||||
wantsOnlyTiled = 1;
|
wantsOnlyTiled = 1;
|
||||||
flagCount++;
|
flagCount++;
|
||||||
|
@@ -17,7 +17,7 @@ class CWindow;
|
|||||||
|
|
||||||
class CWorkspace {
|
class CWorkspace {
|
||||||
public:
|
public:
|
||||||
static PHLWORKSPACE create(WORKSPACEID id, MONITORID monitorID, std::string name, bool special = false, bool isEmpty = true);
|
static PHLWORKSPACE create(WORKSPACEID id, MONITORID monitorID, std::string name, bool special = false, bool isEmtpy = true);
|
||||||
// use create() don't use this
|
// use create() don't use this
|
||||||
CWorkspace(WORKSPACEID id, MONITORID monitorID, std::string name, bool special = false, bool isEmpty = true);
|
CWorkspace(WORKSPACEID id, MONITORID monitorID, std::string name, bool special = false, bool isEmpty = true);
|
||||||
~CWorkspace();
|
~CWorkspace();
|
||||||
@@ -39,6 +39,7 @@ class CWorkspace {
|
|||||||
// for animations
|
// for animations
|
||||||
CAnimatedVariable<Vector2D> m_vRenderOffset;
|
CAnimatedVariable<Vector2D> m_vRenderOffset;
|
||||||
CAnimatedVariable<float> m_fAlpha;
|
CAnimatedVariable<float> m_fAlpha;
|
||||||
|
CAnimatedVariable<float> m_fScaleClients;
|
||||||
bool m_bForceRendering = false;
|
bool m_bForceRendering = false;
|
||||||
|
|
||||||
// allows damage to propagate.
|
// allows damage to propagate.
|
||||||
@@ -57,7 +58,7 @@ class CWorkspace {
|
|||||||
// last monitor (used on reconnect)
|
// last monitor (used on reconnect)
|
||||||
std::string m_szLastMonitor = "";
|
std::string m_szLastMonitor = "";
|
||||||
|
|
||||||
bool m_bWasCreatedEmpty = true;
|
bool m_bWasCreatedEmtpy = true;
|
||||||
|
|
||||||
bool m_bPersistent = false;
|
bool m_bPersistent = false;
|
||||||
|
|
||||||
|
@@ -120,7 +120,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
PWINDOW->m_bRequestsFloat = true;
|
PWINDOW->m_bRequestsFloat = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
PWINDOW->m_bX11ShouldntFocus = PWINDOW->m_bX11ShouldntFocus || (PWINDOW->m_bIsX11 && PWINDOW->isX11OverrideRedirect() && !PWINDOW->m_pXWaylandSurface->wantsFocus());
|
PWINDOW->m_bX11ShouldntFocus = PWINDOW->m_bX11ShouldntFocus || (PWINDOW->m_bIsX11 && PWINDOW->m_iX11Type == 2 && !PWINDOW->m_pXWaylandSurface->wantsFocus());
|
||||||
|
|
||||||
if (PWORKSPACE->m_bDefaultFloating)
|
if (PWORKSPACE->m_bDefaultFloating)
|
||||||
PWINDOW->m_bIsFloating = true;
|
PWINDOW->m_bIsFloating = true;
|
||||||
@@ -139,7 +139,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
if (PWINDOW->m_bWantsInitialFullscreen || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->fullscreen))
|
if (PWINDOW->m_bWantsInitialFullscreen || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->fullscreen))
|
||||||
requestedClientFSMode = FSMODE_FULLSCREEN;
|
requestedClientFSMode = FSMODE_FULLSCREEN;
|
||||||
|
|
||||||
for (auto const& r : PWINDOW->m_vMatchedRules) {
|
for (auto& r : PWINDOW->m_vMatchedRules) {
|
||||||
if (r.szRule.starts_with("monitor")) {
|
if (r.szRule.starts_with("monitor")) {
|
||||||
try {
|
try {
|
||||||
const auto MONITORSTR = trim(r.szRule.substr(r.szRule.find(' ')));
|
const auto MONITORSTR = trim(r.szRule.substr(r.szRule.find(' ')));
|
||||||
@@ -326,7 +326,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
PWINDOW->m_bCreatedOverFullscreen = true;
|
PWINDOW->m_bCreatedOverFullscreen = true;
|
||||||
|
|
||||||
// size and move rules
|
// size and move rules
|
||||||
for (auto const& r : PWINDOW->m_vMatchedRules) {
|
for (auto& r : PWINDOW->m_vMatchedRules) {
|
||||||
if (r.szRule.starts_with("size")) {
|
if (r.szRule.starts_with("size")) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
@@ -345,7 +345,6 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
Debug::log(LOG, "Rule size, applying to {}", PWINDOW);
|
Debug::log(LOG, "Rule size, applying to {}", PWINDOW);
|
||||||
|
|
||||||
PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
|
PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
|
||||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal();
|
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
PWINDOW->setHidden(false);
|
||||||
@@ -450,35 +449,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
} else {
|
} else {
|
||||||
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
|
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
|
||||||
|
|
||||||
bool setPseudo = false;
|
// Set the pseudo size here too so that it doesnt end up being 0x0
|
||||||
|
|
||||||
for (auto const& r : PWINDOW->m_vMatchedRules) {
|
|
||||||
if (r.szRule.starts_with("size")) {
|
|
||||||
try {
|
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
|
||||||
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(' '));
|
|
||||||
const auto SIZEYSTR = VALUE.substr(VALUE.find(' ') + 1);
|
|
||||||
|
|
||||||
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW);
|
|
||||||
|
|
||||||
const auto SIZEX = SIZEXSTR == "max" ?
|
|
||||||
std::clamp(MAXSIZE.x, 20.0, PMONITOR->vecSize.x) :
|
|
||||||
(!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stof(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
|
|
||||||
const auto SIZEY = SIZEYSTR == "max" ?
|
|
||||||
std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) :
|
|
||||||
(!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stof(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
|
|
||||||
|
|
||||||
Debug::log(LOG, "Rule size (tiled), applying to {}", PWINDOW);
|
|
||||||
|
|
||||||
setPseudo = true;
|
|
||||||
PWINDOW->m_vPseudoSize = Vector2D(SIZEX, SIZEY);
|
|
||||||
|
|
||||||
PWINDOW->setHidden(false);
|
|
||||||
} catch (...) { Debug::log(LOG, "Rule size failed, rule: {} -> {}", r.szRule, r.szValue); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!setPseudo)
|
|
||||||
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
|
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goal() - Vector2D(10, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +477,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!PWINDOW->m_sWindowData.noFocus.valueOrDefault() && !PWINDOW->m_bNoInitialFocus &&
|
if (!PWINDOW->m_sWindowData.noFocus.valueOrDefault() && !PWINDOW->m_bNoInitialFocus &&
|
||||||
(!PWINDOW->isX11OverrideRedirect() || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) &&
|
(PWINDOW->m_iX11Type != 2 || (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface->wantsFocus())) && !workspaceSilent && (!PFORCEFOCUS || PFORCEFOCUS == PWINDOW) &&
|
||||||
!g_pInputManager->isConstrained()) {
|
!g_pInputManager->isConstrained()) {
|
||||||
g_pCompositor->focusWindow(PWINDOW);
|
g_pCompositor->focusWindow(PWINDOW);
|
||||||
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA);
|
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA);
|
||||||
@@ -606,7 +577,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
|
|||||||
|
|
||||||
g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID());
|
g_pCompositor->updateWorkspaceWindows(PWINDOW->workspaceID());
|
||||||
|
|
||||||
if (PMONITOR && PWINDOW->isX11OverrideRedirect())
|
if (PMONITOR && PWINDOW->m_iX11Type == 2)
|
||||||
PWINDOW->m_fX11SurfaceScaledBy = PMONITOR->scale;
|
PWINDOW->m_fX11SurfaceScaledBy = PMONITOR->scale;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -845,7 +816,7 @@ void Events::listener_activateX11(void* owner, void* data) {
|
|||||||
|
|
||||||
Debug::log(LOG, "X11 Activate request for window {}", PWINDOW);
|
Debug::log(LOG, "X11 Activate request for window {}", PWINDOW);
|
||||||
|
|
||||||
if (PWINDOW->isX11OverrideRedirect()) {
|
if (PWINDOW->m_iX11Type == 2) {
|
||||||
|
|
||||||
Debug::log(LOG, "Unmanaged X11 {} requests activate", PWINDOW);
|
Debug::log(LOG, "Unmanaged X11 {} requests activate", PWINDOW);
|
||||||
|
|
||||||
|
@@ -12,7 +12,7 @@ void CBezierCurve::setup(std::vector<Vector2D>* pVec) {
|
|||||||
|
|
||||||
m_dPoints.emplace_back(Vector2D(0, 0));
|
m_dPoints.emplace_back(Vector2D(0, 0));
|
||||||
|
|
||||||
for (auto const& p : *pVec) {
|
for (auto& p : *pVec) {
|
||||||
m_dPoints.push_back(p);
|
m_dPoints.push_back(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -252,7 +252,7 @@ DRMFormat FormatUtils::shmToDRM(SHMFormat shm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) {
|
const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) {
|
||||||
for (auto const& fmt : GLES3_FORMATS) {
|
for (auto& fmt : GLES3_FORMATS) {
|
||||||
if (fmt.drmFormat == drm)
|
if (fmt.drmFormat == drm)
|
||||||
return &fmt;
|
return &fmt;
|
||||||
}
|
}
|
||||||
@@ -261,7 +261,7 @@ const SPixelFormat* FormatUtils::getPixelFormatFromDRM(DRMFormat drm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const SPixelFormat* FormatUtils::getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha) {
|
const SPixelFormat* FormatUtils::getPixelFormatFromGL(uint32_t glFormat, uint32_t glType, bool alpha) {
|
||||||
for (auto const& fmt : GLES3_FORMATS) {
|
for (auto& fmt : GLES3_FORMATS) {
|
||||||
if (fmt.glFormat == (int)glFormat && fmt.glType == (int)glType && fmt.withAlpha == alpha)
|
if (fmt.glFormat == (int)glFormat && fmt.glType == (int)glType && fmt.withAlpha == alpha)
|
||||||
return &fmt;
|
return &fmt;
|
||||||
}
|
}
|
||||||
|
@@ -180,7 +180,7 @@ void handleNoop(struct wl_listener* listener, void* data) {
|
|||||||
|
|
||||||
std::string escapeJSONStrings(const std::string& str) {
|
std::string escapeJSONStrings(const std::string& str) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
for (auto const& c : str) {
|
for (auto& c : str) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case '"': oss << "\\\""; break;
|
case '"': oss << "\\\""; break;
|
||||||
case '\\': oss << "\\\\"; break;
|
case '\\': oss << "\\\\"; break;
|
||||||
@@ -251,7 +251,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
|
|
||||||
std::set<WORKSPACEID> invalidWSes;
|
std::set<WORKSPACEID> invalidWSes;
|
||||||
if (same_mon) {
|
if (same_mon) {
|
||||||
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
for (auto& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
|
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
|
||||||
if (PMONITOR && (PMONITOR->ID != g_pCompositor->m_pLastMonitor->ID))
|
if (PMONITOR && (PMONITOR->ID != g_pCompositor->m_pLastMonitor->ID))
|
||||||
invalidWSes.insert(rule.workspaceId);
|
invalidWSes.insert(rule.workspaceId);
|
||||||
@@ -301,13 +301,13 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
std::set<WORKSPACEID> invalidWSes;
|
std::set<WORKSPACEID> invalidWSes;
|
||||||
|
|
||||||
// Collect all the workspaces we can't jump to.
|
// Collect all the workspaces we can't jump to.
|
||||||
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)) {
|
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)) {
|
||||||
// Can't jump to this workspace
|
// Can't jump to this workspace
|
||||||
invalidWSes.insert(ws->m_iID);
|
invalidWSes.insert(ws->m_iID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (auto const& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
for (auto& rule : g_pConfigManager->getAllWorkspaceRules()) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
|
const auto PMONITOR = g_pCompositor->getMonitorFromName(rule.monitor);
|
||||||
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_pLastMonitor->ID) {
|
if (!PMONITOR || PMONITOR->ID == g_pCompositor->m_pLastMonitor->ID) {
|
||||||
// Can't be invalid
|
// Can't be invalid
|
||||||
@@ -319,7 +319,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
|
|
||||||
// Prepare all named workspaces in case when we need them
|
// Prepare all named workspaces in case when we need them
|
||||||
std::vector<WORKSPACEID> namedWSes;
|
std::vector<WORKSPACEID> namedWSes;
|
||||||
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) || ws->m_iID >= 0)
|
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID) || ws->m_iID >= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -353,13 +353,13 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
char walkDir = in[1];
|
char walkDir = in[1];
|
||||||
|
|
||||||
// sanitize. 0 means invalid oob in -
|
// sanitize. 0 means invalid oob in -
|
||||||
predictedWSID = std::max(predictedWSID, static_cast<int64_t>(0));
|
predictedWSID = std::max(predictedWSID, 0L);
|
||||||
|
|
||||||
// Count how many invalidWSes are in between (how bad the prediction was)
|
// Count how many invalidWSes are in between (how bad the prediction was)
|
||||||
WORKSPACEID beginID = in[1] == '+' ? activeWSID + 1 : predictedWSID;
|
WORKSPACEID beginID = in[1] == '+' ? activeWSID + 1 : predictedWSID;
|
||||||
WORKSPACEID endID = in[1] == '+' ? predictedWSID : activeWSID;
|
WORKSPACEID endID = in[1] == '+' ? predictedWSID : activeWSID;
|
||||||
auto begin = invalidWSes.upper_bound(beginID - 1); // upper_bound is >, we want >=
|
auto begin = invalidWSes.upper_bound(beginID - 1); // upper_bound is >, we want >=
|
||||||
for (auto it = begin; it != invalidWSes.end() && *it <= endID; it++) {
|
for (auto it = begin; *it <= endID && it != invalidWSes.end(); it++) {
|
||||||
remainingWSes++;
|
remainingWSes++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,7 +376,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
currentItem += remains;
|
currentItem += remains;
|
||||||
currentItem = std::max(currentItem, static_cast<size_t>(0));
|
currentItem = std::max(currentItem, 0UL);
|
||||||
if (currentItem >= namedWSes.size()) {
|
if (currentItem >= namedWSes.size()) {
|
||||||
// At the seam between namedWSes and normal WSes. Behave like r+[diff] at imaginary ws 0
|
// At the seam between namedWSes and normal WSes. Behave like r+[diff] at imaginary ws 0
|
||||||
size_t diff = currentItem - (namedWSes.size() - 1);
|
size_t diff = currentItem - (namedWSes.size() - 1);
|
||||||
@@ -384,7 +384,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
WORKSPACEID beginID = 1;
|
WORKSPACEID beginID = 1;
|
||||||
WORKSPACEID endID = predictedWSID;
|
WORKSPACEID endID = predictedWSID;
|
||||||
auto begin = invalidWSes.upper_bound(beginID - 1); // upper_bound is >, we want >=
|
auto begin = invalidWSes.upper_bound(beginID - 1); // upper_bound is >, we want >=
|
||||||
for (auto it = begin; it != invalidWSes.end() && *it <= endID; it++) {
|
for (auto it = begin; *it <= endID && it != invalidWSes.end(); it++) {
|
||||||
remainingWSes++;
|
remainingWSes++;
|
||||||
}
|
}
|
||||||
walkDir = '+';
|
walkDir = '+';
|
||||||
@@ -413,7 +413,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
// Need remainingWSes more
|
// Need remainingWSes more
|
||||||
auto namedWSIdx = namedWSes.size() - remainingWSes;
|
auto namedWSIdx = namedWSes.size() - remainingWSes;
|
||||||
// Sanitze
|
// Sanitze
|
||||||
namedWSIdx = std::clamp(namedWSIdx, static_cast<size_t>(0), namedWSes.size() - static_cast<size_t>(1));
|
namedWSIdx = std::clamp(namedWSIdx, 0UL, namedWSes.size() - 1);
|
||||||
finalWSID = namedWSes[namedWSIdx];
|
finalWSID = namedWSes[namedWSIdx];
|
||||||
} else {
|
} else {
|
||||||
// Couldn't find valid workspace in negative direction, search last first one back up positive direction
|
// Couldn't find valid workspace in negative direction, search last first one back up positive direction
|
||||||
@@ -463,7 +463,7 @@ SWorkspaceIDName getWorkspaceIDNameFromString(const std::string& in) {
|
|||||||
int remains = (int)result.id;
|
int remains = (int)result.id;
|
||||||
|
|
||||||
std::vector<WORKSPACEID> validWSes;
|
std::vector<WORKSPACEID> validWSes;
|
||||||
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID && !onAllMonitors))
|
if (ws->m_bIsSpecialWorkspace || (ws->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID && !onAllMonitors))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -2,6 +2,7 @@
|
|||||||
#include "MiscFunctions.hpp"
|
#include "MiscFunctions.hpp"
|
||||||
#include "math/Math.hpp"
|
#include "math/Math.hpp"
|
||||||
#include "sync/SyncReleaser.hpp"
|
#include "sync/SyncReleaser.hpp"
|
||||||
|
#include "ScopeGuard.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../protocols/GammaControl.hpp"
|
#include "../protocols/GammaControl.hpp"
|
||||||
@@ -16,9 +17,7 @@
|
|||||||
#include "sync/SyncTimeline.hpp"
|
#include "sync/SyncTimeline.hpp"
|
||||||
#include <aquamarine/output/Output.hpp>
|
#include <aquamarine/output/Output.hpp>
|
||||||
#include <hyprutils/string/String.hpp>
|
#include <hyprutils/string/String.hpp>
|
||||||
#include <hyprutils/utils/ScopeGuard.hpp>
|
|
||||||
using namespace Hyprutils::String;
|
using namespace Hyprutils::String;
|
||||||
using namespace Hyprutils::Utils;
|
|
||||||
|
|
||||||
int ratHandler(void* data) {
|
int ratHandler(void* data) {
|
||||||
g_pHyprRenderer->renderMonitor((CMonitor*)data);
|
g_pHyprRenderer->renderMonitor((CMonitor*)data);
|
||||||
@@ -48,7 +47,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
|
|
||||||
listeners.presented = output->events.present.registerListener([this](std::any d) {
|
listeners.presented = output->events.present.registerListener([this](std::any d) {
|
||||||
auto E = std::any_cast<Aquamarine::IOutput::SPresentEvent>(d);
|
auto E = std::any_cast<Aquamarine::IOutput::SPresentEvent>(d);
|
||||||
PROTO::presentation->onPresented(self.lock(), E.when, E.refresh, E.seq, E.flags);
|
PROTO::presentation->onPresented(this, E.when, E.refresh, E.seq, E.flags);
|
||||||
});
|
});
|
||||||
|
|
||||||
listeners.destroy = output->events.destroy.registerListener([this](std::any d) {
|
listeners.destroy = output->events.destroy.registerListener([this](std::any d) {
|
||||||
@@ -172,7 +171,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
|
|
||||||
setupDefaultWS(monitorRule);
|
setupDefaultWS(monitorRule);
|
||||||
|
|
||||||
for (auto const& ws : g_pCompositor->m_vWorkspaces) {
|
for (auto& ws : g_pCompositor->m_vWorkspaces) {
|
||||||
if (!valid(ws))
|
if (!valid(ws))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -193,6 +192,10 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
if (!activeMonitorRule.mirrorOf.empty())
|
if (!activeMonitorRule.mirrorOf.empty())
|
||||||
setMirror(activeMonitorRule.mirrorOf);
|
setMirror(activeMonitorRule.mirrorOf);
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitoraddedv2", std::format("{},{},{}", ID, szName, szShortDescription)});
|
||||||
|
EMIT_HOOK_EVENT("monitorAdded", this);
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
|
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
|
||||||
g_pCompositor->setActiveMonitor(this);
|
g_pCompositor->setActiveMonitor(this);
|
||||||
|
|
||||||
@@ -204,7 +207,7 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
|
|
||||||
// verify last mon valid
|
// verify last mon valid
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m == g_pCompositor->m_pLastMonitor) {
|
if (m == g_pCompositor->m_pLastMonitor) {
|
||||||
found = true;
|
found = true;
|
||||||
break;
|
break;
|
||||||
@@ -221,10 +224,6 @@ void CMonitor::onConnect(bool noRule) {
|
|||||||
PROTO::gamma->applyGammaToState(this);
|
PROTO::gamma->applyGammaToState(this);
|
||||||
|
|
||||||
events.connect.emit();
|
events.connect.emit();
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitoraddedv2", std::format("{},{},{}", ID, szName, szShortDescription)});
|
|
||||||
EMIT_HOOK_EVENT("monitorAdded", this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::onDisconnect(bool destroy) {
|
void CMonitor::onDisconnect(bool destroy) {
|
||||||
@@ -243,7 +242,7 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
|
|
||||||
// Cleanup everything. Move windows back, snap cursor, shit.
|
// Cleanup everything. Move windows back, snap cursor, shit.
|
||||||
CMonitor* BACKUPMON = nullptr;
|
CMonitor* BACKUPMON = nullptr;
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m.get() != this) {
|
if (m.get() != this) {
|
||||||
BACKUPMON = m.get();
|
BACKUPMON = m.get();
|
||||||
break;
|
break;
|
||||||
@@ -260,7 +259,7 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!mirrors.empty()) {
|
if (!mirrors.empty()) {
|
||||||
for (auto const& m : mirrors) {
|
for (auto& m : mirrors) {
|
||||||
m->setMirror("");
|
m->setMirror("");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -273,7 +272,7 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
listeners.commit.reset();
|
listeners.commit.reset();
|
||||||
|
|
||||||
for (size_t i = 0; i < 4; ++i) {
|
for (size_t i = 0; i < 4; ++i) {
|
||||||
for (auto const& ls : m_aLayerSurfaceLayers[i]) {
|
for (auto& ls : m_aLayerSurfaceLayers[i]) {
|
||||||
if (ls->layerSurface && !ls->fadingOut)
|
if (ls->layerSurface && !ls->fadingOut)
|
||||||
ls->layerSurface->sendClosed();
|
ls->layerSurface->sendClosed();
|
||||||
}
|
}
|
||||||
@@ -282,6 +281,9 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
|
|
||||||
Debug::log(LOG, "Removed monitor {}!", szName);
|
Debug::log(LOG, "Removed monitor {}!", szName);
|
||||||
|
|
||||||
|
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
|
||||||
|
EMIT_HOOK_EVENT("monitorRemoved", this);
|
||||||
|
|
||||||
if (!BACKUPMON) {
|
if (!BACKUPMON) {
|
||||||
Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
|
Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
|
||||||
g_pCompositor->enterUnsafeState();
|
g_pCompositor->enterUnsafeState();
|
||||||
@@ -296,13 +298,13 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
|
|
||||||
// move workspaces
|
// move workspaces
|
||||||
std::deque<PHLWORKSPACE> wspToMove;
|
std::deque<PHLWORKSPACE> wspToMove;
|
||||||
for (auto const& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
if (w->m_iMonitorID == ID || !g_pCompositor->getMonitorFromID(w->m_iMonitorID)) {
|
if (w->m_iMonitorID == ID || !g_pCompositor->getMonitorFromID(w->m_iMonitorID)) {
|
||||||
wspToMove.push_back(w);
|
wspToMove.push_back(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : wspToMove) {
|
for (auto& w : wspToMove) {
|
||||||
w->m_szLastMonitor = szName;
|
w->m_szLastMonitor = szName;
|
||||||
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
||||||
w->startAnim(true, true, true);
|
w->startAnim(true, true, true);
|
||||||
@@ -330,7 +332,7 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
int mostHz = 0;
|
int mostHz = 0;
|
||||||
CMonitor* pMonitorMostHz = nullptr;
|
CMonitor* pMonitorMostHz = nullptr;
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->refreshRate > mostHz && m.get() != this) {
|
if (m->refreshRate > mostHz && m.get() != this) {
|
||||||
pMonitorMostHz = m.get();
|
pMonitorMostHz = m.get();
|
||||||
mostHz = m->refreshRate;
|
mostHz = m->refreshRate;
|
||||||
@@ -340,9 +342,6 @@ void CMonitor::onDisconnect(bool destroy) {
|
|||||||
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
g_pHyprRenderer->m_pMostHzMonitor = pMonitorMostHz;
|
||||||
}
|
}
|
||||||
std::erase_if(g_pCompositor->m_vMonitors, [&](SP<CMonitor>& el) { return el.get() == this; });
|
std::erase_if(g_pCompositor->m_vMonitors, [&](SP<CMonitor>& el) { return el.get() == this; });
|
||||||
|
|
||||||
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
|
|
||||||
EMIT_HOOK_EVENT("monitorRemoved", this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
void CMonitor::addDamage(const pixman_region32_t* rg) {
|
||||||
@@ -517,7 +516,7 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||||||
g_pHyprRenderer->applyMonitorRule(this, (SMonitorRule*)&RULE, true); // will apply the offset and stuff
|
g_pHyprRenderer->applyMonitorRule(this, (SMonitorRule*)&RULE, true); // will apply the offset and stuff
|
||||||
} else {
|
} else {
|
||||||
CMonitor* BACKUPMON = nullptr;
|
CMonitor* BACKUPMON = nullptr;
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m.get() != this) {
|
if (m.get() != this) {
|
||||||
BACKUPMON = m.get();
|
BACKUPMON = m.get();
|
||||||
break;
|
break;
|
||||||
@@ -526,13 +525,13 @@ void CMonitor::setMirror(const std::string& mirrorOf) {
|
|||||||
|
|
||||||
// move all the WS
|
// move all the WS
|
||||||
std::deque<PHLWORKSPACE> wspToMove;
|
std::deque<PHLWORKSPACE> wspToMove;
|
||||||
for (auto const& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
if (w->m_iMonitorID == ID) {
|
if (w->m_iMonitorID == ID) {
|
||||||
wspToMove.push_back(w);
|
wspToMove.push_back(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& w : wspToMove) {
|
for (auto& w : wspToMove) {
|
||||||
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
|
||||||
w->startAnim(true, true, true);
|
w->startAnim(true, true, true);
|
||||||
}
|
}
|
||||||
@@ -606,7 +605,7 @@ void CMonitor::changeWorkspace(const PHLWORKSPACE& pWorkspace, bool internal, bo
|
|||||||
pWorkspace->startAnim(true, ANIMTOLEFT);
|
pWorkspace->startAnim(true, ANIMTOLEFT);
|
||||||
|
|
||||||
// move pinned windows
|
// move pinned windows
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_pWorkspace == POLDWORKSPACE && w->m_bPinned)
|
if (w->m_pWorkspace == POLDWORKSPACE && w->m_bPinned)
|
||||||
w->moveToWorkspace(pWorkspace);
|
w->moveToWorkspace(pWorkspace);
|
||||||
}
|
}
|
||||||
@@ -715,14 +714,14 @@ void CMonitor::setSpecialWorkspace(const PHLWORKSPACE& pWorkspace) {
|
|||||||
if (animate)
|
if (animate)
|
||||||
pWorkspace->startAnim(true, true);
|
pWorkspace->startAnim(true, true);
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_pWorkspace == pWorkspace) {
|
if (w->m_pWorkspace == pWorkspace) {
|
||||||
w->m_iMonitorID = ID;
|
w->m_iMonitorID = ID;
|
||||||
w->updateSurfaceScaleTransformDetails();
|
w->updateSurfaceScaleTransformDetails();
|
||||||
w->setAnimationsToMove();
|
w->setAnimationsToMove();
|
||||||
|
|
||||||
const auto MIDDLE = w->middle();
|
const auto MIDDLE = w->middle();
|
||||||
if (w->m_bIsFloating && !VECINRECT(MIDDLE, vecPosition.x, vecPosition.y, vecPosition.x + vecSize.x, vecPosition.y + vecSize.y) && !w->isX11OverrideRedirect()) {
|
if (w->m_bIsFloating && !VECINRECT(MIDDLE, vecPosition.x, vecPosition.y, vecPosition.x + vecSize.x, vecPosition.y + vecSize.y) && w->m_iX11Type != 2) {
|
||||||
// if it's floating and the middle isnt on the current mon, move it to the center
|
// if it's floating and the middle isnt on the current mon, move it to the center
|
||||||
const auto PMONFROMMIDDLE = g_pCompositor->getMonitorFromVector(MIDDLE);
|
const auto PMONFROMMIDDLE = g_pCompositor->getMonitorFromVector(MIDDLE);
|
||||||
Vector2D pos = w->m_vRealPosition.goal();
|
Vector2D pos = w->m_vRealPosition.goal();
|
||||||
@@ -833,21 +832,6 @@ bool CMonitor::attemptDirectScanout() {
|
|||||||
|
|
||||||
// FIXME: make sure the buffer actually follows the available scanout dmabuf formats
|
// FIXME: make sure the buffer actually follows the available scanout dmabuf formats
|
||||||
// and comes from the appropriate device. This may implode on multi-gpu!!
|
// and comes from the appropriate device. This may implode on multi-gpu!!
|
||||||
|
|
||||||
const auto params = PSURFACE->current.buffer->buffer->dmabuf();
|
|
||||||
// scanout buffer isn't dmabuf, so no scanout
|
|
||||||
if (!params.success)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// entering into scanout, so save monitor format
|
|
||||||
if (lastScanout.expired())
|
|
||||||
prevDrmFormat = drmFormat;
|
|
||||||
|
|
||||||
if (drmFormat != params.format) {
|
|
||||||
output->state->setFormat(params.format);
|
|
||||||
drmFormat = params.format;
|
|
||||||
}
|
|
||||||
|
|
||||||
output->state->setBuffer(PSURFACE->current.buffer->buffer.lock());
|
output->state->setBuffer(PSURFACE->current.buffer->buffer.lock());
|
||||||
output->state->setPresentationMode(tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
|
output->state->setPresentationMode(tearingState.activelyTearing ? Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_IMMEDIATE :
|
||||||
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);
|
Aquamarine::eOutputPresentationMode::AQ_OUTPUT_PRESENTATION_VSYNC);
|
||||||
@@ -877,7 +861,7 @@ bool CMonitor::attemptDirectScanout() {
|
|||||||
|
|
||||||
timespec now;
|
timespec now;
|
||||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||||
PSURFACE->presentFeedback(&now, self.lock());
|
PSURFACE->presentFeedback(&now, this);
|
||||||
|
|
||||||
output->state->addDamage(CBox{{}, vecPixelSize});
|
output->state->addDamage(CBox{{}, vecPixelSize});
|
||||||
output->state->resetExplicitFences();
|
output->state->resetExplicitFences();
|
||||||
@@ -931,20 +915,17 @@ CMonitorState::~CMonitorState() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CMonitorState::ensureBufferPresent() {
|
void CMonitorState::ensureBufferPresent() {
|
||||||
const auto STATE = m_pOwner->output->state->state();
|
if (!m_pOwner->output->state->state().enabled) {
|
||||||
if (!STATE.enabled) {
|
|
||||||
Debug::log(TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
|
Debug::log(TRACE, "CMonitorState::ensureBufferPresent: Ignoring, monitor is not enabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (STATE.buffer) {
|
if (m_pOwner->output->state->state().buffer)
|
||||||
if (const auto params = STATE.buffer->dmabuf(); params.success && params.format == m_pOwner->drmFormat)
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
// this is required for modesetting being possible and might be missing in case of first tests in the renderer
|
// this is required for modesetting being possible and might be missing in case of first tests in the renderer
|
||||||
// where we test modes and buffers
|
// where we test modes and buffers
|
||||||
Debug::log(LOG, "CMonitorState::ensureBufferPresent: no buffer or mismatched format, attaching one from the swapchain for modeset being possible");
|
Debug::log(LOG, "CMonitorState::ensureBufferPresent: no buffer, attaching one from the swapchain for modeset being possible");
|
||||||
m_pOwner->output->state->setBuffer(m_pOwner->output->swapchain->next(nullptr));
|
m_pOwner->output->state->setBuffer(m_pOwner->output->swapchain->next(nullptr));
|
||||||
m_pOwner->output->swapchain->rollback(); // restore the counter, don't advance the swapchain
|
m_pOwner->output->swapchain->rollback(); // restore the counter, don't advance the swapchain
|
||||||
}
|
}
|
||||||
|
@@ -101,7 +101,6 @@ class CMonitor {
|
|||||||
SP<Aquamarine::SOutputMode> currentMode;
|
SP<Aquamarine::SOutputMode> currentMode;
|
||||||
SP<Aquamarine::CSwapchain> cursorSwapchain;
|
SP<Aquamarine::CSwapchain> cursorSwapchain;
|
||||||
uint32_t drmFormat = DRM_FORMAT_INVALID;
|
uint32_t drmFormat = DRM_FORMAT_INVALID;
|
||||||
uint32_t prevDrmFormat = DRM_FORMAT_INVALID;
|
|
||||||
|
|
||||||
bool dpmsStatus = true;
|
bool dpmsStatus = true;
|
||||||
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
bool vrrActive = false; // this can be TRUE even if VRR is not active in the case that this display does not support it.
|
||||||
|
10
src/helpers/ScopeGuard.cpp
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
#include "ScopeGuard.hpp"
|
||||||
|
|
||||||
|
CScopeGuard::CScopeGuard(const std::function<void()>& fn_) : fn(fn_) {
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
CScopeGuard::~CScopeGuard() {
|
||||||
|
if (fn)
|
||||||
|
fn();
|
||||||
|
}
|
13
src/helpers/ScopeGuard.hpp
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
|
// calls a function when it goes out of scope
|
||||||
|
class CScopeGuard {
|
||||||
|
public:
|
||||||
|
CScopeGuard(const std::function<void()>& fn_);
|
||||||
|
~CScopeGuard();
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::function<void()> fn;
|
||||||
|
};
|
@@ -49,7 +49,7 @@ void SDwindleNodeData::getAllChildrenRecursive(std::deque<SDwindleNodeData*>* pD
|
|||||||
|
|
||||||
int CHyprDwindleLayout::getNodesOnWorkspace(const WORKSPACEID& id) {
|
int CHyprDwindleLayout::getNodesOnWorkspace(const WORKSPACEID& id) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
for (auto const& n : m_lDwindleNodesData) {
|
for (auto& n : m_lDwindleNodesData) {
|
||||||
if (n.workspaceID == id && n.valid)
|
if (n.workspaceID == id && n.valid)
|
||||||
++no;
|
++no;
|
||||||
}
|
}
|
||||||
@@ -104,7 +104,7 @@ void CHyprDwindleLayout::applyNodeDataToWindow(SDwindleNodeData* pNode, bool for
|
|||||||
CMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
|
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
|
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
|
||||||
PMONITOR = m.get();
|
PMONITOR = m.get();
|
||||||
break;
|
break;
|
||||||
@@ -1075,7 +1075,7 @@ std::string CHyprDwindleLayout::getLayoutName() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CHyprDwindleLayout::onEnable() {
|
void CHyprDwindleLayout::onEnable() {
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -104,7 +104,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||||||
pWindow->m_vRealSize = PWINDOWSURFACE->current.size;
|
pWindow->m_vRealSize = PWINDOWSURFACE->current.size;
|
||||||
|
|
||||||
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 &&
|
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 &&
|
||||||
pWindow->isX11OverrideRedirect()) { // XDG windows should be fine. TODO: check for weird atoms?
|
pWindow->m_iX11Type == 2) { // XDG windows should be fine. TODO: check for weird atoms?
|
||||||
pWindow->setHidden(true);
|
pWindow->setHidden(true);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -113,7 +113,7 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||||||
if (pWindow->m_vRealSize.goal().x <= 5 || pWindow->m_vRealSize.goal().y <= 5)
|
if (pWindow->m_vRealSize.goal().x <= 5 || pWindow->m_vRealSize.goal().y <= 5)
|
||||||
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
|
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
|
||||||
|
|
||||||
if (pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect()) {
|
if (pWindow->m_bIsX11 && pWindow->m_iX11Type == 2) {
|
||||||
|
|
||||||
if (pWindow->m_pXWaylandSurface->geometry.x != 0 && pWindow->m_pXWaylandSurface->geometry.y != 0)
|
if (pWindow->m_pXWaylandSurface->geometry.x != 0 && pWindow->m_pXWaylandSurface->geometry.y != 0)
|
||||||
pWindow->m_vRealPosition = g_pXWaylandManager->xwaylandToWaylandCoords(pWindow->m_pXWaylandSurface->geometry.pos());
|
pWindow->m_vRealPosition = g_pXWaylandManager->xwaylandToWaylandCoords(pWindow->m_pXWaylandSurface->geometry.pos());
|
||||||
@@ -163,12 +163,12 @@ void IHyprLayout::onWindowCreatedFloating(PHLWINDOW pWindow) {
|
|||||||
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11)
|
if (*PXWLFORCESCALEZERO && pWindow->m_bIsX11)
|
||||||
pWindow->m_vRealSize = pWindow->m_vRealSize.goal() / PMONITOR->scale;
|
pWindow->m_vRealSize = pWindow->m_vRealSize.goal() / PMONITOR->scale;
|
||||||
|
|
||||||
if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->isX11OverrideRedirect())) {
|
if (pWindow->m_bX11DoesntWantBorders || (pWindow->m_bIsX11 && pWindow->m_iX11Type == 2)) {
|
||||||
pWindow->m_vRealPosition.warp();
|
pWindow->m_vRealPosition.warp();
|
||||||
pWindow->m_vRealSize.warp();
|
pWindow->m_vRealSize.warp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pWindow->isX11OverrideRedirect()) {
|
if (pWindow->m_iX11Type != 2) {
|
||||||
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goal());
|
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goal());
|
||||||
|
|
||||||
g_pCompositor->changeWindowZOrder(pWindow, true);
|
g_pCompositor->changeWindowZOrder(pWindow, true);
|
||||||
@@ -591,8 +591,8 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
|||||||
if (pWindow->m_bIsFloating) {
|
if (pWindow->m_bIsFloating) {
|
||||||
|
|
||||||
// find whether there is a floating window below this one
|
// find whether there is a floating window below this one
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && !w->isX11OverrideRedirect() && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) {
|
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow) {
|
||||||
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
if (VECINRECT((pWindow->m_vSize / 2.f + pWindow->m_vPosition), w->m_vPosition.x, w->m_vPosition.y, w->m_vPosition.x + w->m_vSize.x,
|
||||||
w->m_vPosition.y + w->m_vSize.y)) {
|
w->m_vPosition.y + w->m_vSize.y)) {
|
||||||
@@ -611,8 +611,8 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
|||||||
return PWINDOWCANDIDATE;
|
return PWINDOWCANDIDATE;
|
||||||
|
|
||||||
// if not, floating window
|
// if not, floating window
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && !w->isX11OverrideRedirect() && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
if (w->m_bIsMapped && !w->isHidden() && w->m_bIsFloating && w->m_iX11Type != 2 && w->m_pWorkspace == pWindow->m_pWorkspace && !w->m_bX11ShouldntFocus &&
|
||||||
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow)
|
!w->m_sWindowData.noFocus.valueOrDefault() && w != pWindow)
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
@@ -631,7 +631,7 @@ PHLWINDOW IHyprLayout::getNextWindowCandidate(PHLWINDOW pWindow) {
|
|||||||
pWindowCandidate = g_pCompositor->getFirstWindowOnWorkspace(pWindow->workspaceID());
|
pWindowCandidate = g_pCompositor->getFirstWindowOnWorkspace(pWindow->workspaceID());
|
||||||
|
|
||||||
if (!pWindowCandidate || pWindow == pWindowCandidate || !pWindowCandidate->m_bIsMapped || pWindowCandidate->isHidden() || pWindowCandidate->m_bX11ShouldntFocus ||
|
if (!pWindowCandidate || pWindow == pWindowCandidate || !pWindowCandidate->m_bIsMapped || pWindowCandidate->isHidden() || pWindowCandidate->m_bX11ShouldntFocus ||
|
||||||
pWindowCandidate->isX11OverrideRedirect() || pWindowCandidate->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
|
pWindowCandidate->m_iX11Type == 2 || pWindowCandidate->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
return pWindowCandidate;
|
return pWindowCandidate;
|
||||||
@@ -660,7 +660,7 @@ void IHyprLayout::requestFocusForWindow(PHLWINDOW pWindow) {
|
|||||||
Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
|
Vector2D IHyprLayout::predictSizeForNewWindowFloating(PHLWINDOW pWindow) { // get all rules, see if we have any size overrides.
|
||||||
Vector2D sizeOverride = {};
|
Vector2D sizeOverride = {};
|
||||||
if (g_pCompositor->m_pLastMonitor) {
|
if (g_pCompositor->m_pLastMonitor) {
|
||||||
for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
|
for (auto& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
|
||||||
if (r.szRule.starts_with("size")) {
|
if (r.szRule.starts_with("size")) {
|
||||||
try {
|
try {
|
||||||
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
const auto VALUE = r.szRule.substr(r.szRule.find(' ') + 1);
|
||||||
@@ -691,7 +691,7 @@ Vector2D IHyprLayout::predictSizeForNewWindow(PHLWINDOW pWindow) {
|
|||||||
bool shouldBeFloated = g_pXWaylandManager->shouldBeFloated(pWindow, true);
|
bool shouldBeFloated = g_pXWaylandManager->shouldBeFloated(pWindow, true);
|
||||||
|
|
||||||
if (!shouldBeFloated) {
|
if (!shouldBeFloated) {
|
||||||
for (auto const& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
|
for (auto& r : g_pConfigManager->getMatchingRules(pWindow, true, true)) {
|
||||||
if (r.szRule.starts_with("float")) {
|
if (r.szRule.starts_with("float")) {
|
||||||
shouldBeFloated = true;
|
shouldBeFloated = true;
|
||||||
break;
|
break;
|
||||||
|
@@ -16,7 +16,7 @@ SMasterNodeData* CHyprMasterLayout::getNodeFromWindow(PHLWINDOW pWindow) {
|
|||||||
|
|
||||||
int CHyprMasterLayout::getNodesOnWorkspace(const WORKSPACEID& ws) {
|
int CHyprMasterLayout::getNodesOnWorkspace(const WORKSPACEID& ws) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
for (auto const& n : m_lMasterNodesData) {
|
for (auto& n : m_lMasterNodesData) {
|
||||||
if (n.workspaceID == ws)
|
if (n.workspaceID == ws)
|
||||||
no++;
|
no++;
|
||||||
}
|
}
|
||||||
@@ -26,7 +26,7 @@ int CHyprMasterLayout::getNodesOnWorkspace(const WORKSPACEID& ws) {
|
|||||||
|
|
||||||
int CHyprMasterLayout::getMastersOnWorkspace(const WORKSPACEID& ws) {
|
int CHyprMasterLayout::getMastersOnWorkspace(const WORKSPACEID& ws) {
|
||||||
int no = 0;
|
int no = 0;
|
||||||
for (auto const& n : m_lMasterNodesData) {
|
for (auto& n : m_lMasterNodesData) {
|
||||||
if (n.workspaceID == ws && n.isMaster)
|
if (n.workspaceID == ws && n.isMaster)
|
||||||
no++;
|
no++;
|
||||||
}
|
}
|
||||||
@@ -172,7 +172,7 @@ void CHyprMasterLayout::onWindowCreatedTiling(PHLWINDOW pWindow, eDirection dire
|
|||||||
} else if (WINDOWSONWORKSPACE == 2) {
|
} else if (WINDOWSONWORKSPACE == 2) {
|
||||||
// when dropping as the second tiled window in the workspace,
|
// when dropping as the second tiled window in the workspace,
|
||||||
// make it the master only if the cursor is on the master side of the screen
|
// make it the master only if the cursor is on the master side of the screen
|
||||||
for (auto const& nd : m_lMasterNodesData) {
|
for (auto& nd : m_lMasterNodesData) {
|
||||||
if (nd.isMaster && nd.workspaceID == PNODE->workspaceID) {
|
if (nd.isMaster && nd.workspaceID == PNODE->workspaceID) {
|
||||||
switch (orientation) {
|
switch (orientation) {
|
||||||
case ORIENTATION_LEFT:
|
case ORIENTATION_LEFT:
|
||||||
@@ -381,7 +381,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
|||||||
if (*PSMARTRESIZING) {
|
if (*PSMARTRESIZING) {
|
||||||
// check the total width and height so that later
|
// check the total width and height so that later
|
||||||
// if larger/smaller than screen size them down/up
|
// if larger/smaller than screen size them down/up
|
||||||
for (auto const& nd : m_lMasterNodesData) {
|
for (auto& nd : m_lMasterNodesData) {
|
||||||
if (nd.workspaceID == pWorkspace->m_iID) {
|
if (nd.workspaceID == pWorkspace->m_iID) {
|
||||||
if (nd.isMaster)
|
if (nd.isMaster)
|
||||||
masterAccumulatedSize += totalSize / MASTERS * nd.percSize;
|
masterAccumulatedSize += totalSize / MASTERS * nd.percSize;
|
||||||
@@ -552,7 +552,7 @@ void CHyprMasterLayout::calculateWorkspace(PHLWORKSPACE pWorkspace) {
|
|||||||
float slaveAccumulatedHeightL = 0;
|
float slaveAccumulatedHeightL = 0;
|
||||||
float slaveAccumulatedHeightR = 0;
|
float slaveAccumulatedHeightR = 0;
|
||||||
if (*PSMARTRESIZING) {
|
if (*PSMARTRESIZING) {
|
||||||
for (auto const& nd : m_lMasterNodesData) {
|
for (auto& nd : m_lMasterNodesData) {
|
||||||
if (nd.workspaceID != pWorkspace->m_iID || nd.isMaster)
|
if (nd.workspaceID != pWorkspace->m_iID || nd.isMaster)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -619,7 +619,7 @@ void CHyprMasterLayout::applyNodeDataToWindow(SMasterNodeData* pNode) {
|
|||||||
CMonitor* PMONITOR = nullptr;
|
CMonitor* PMONITOR = nullptr;
|
||||||
|
|
||||||
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
|
if (g_pCompositor->isWorkspaceSpecial(pNode->workspaceID)) {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
|
if (m->activeSpecialWorkspaceID() == pNode->workspaceID) {
|
||||||
PMONITOR = m.get();
|
PMONITOR = m.get();
|
||||||
break;
|
break;
|
||||||
@@ -1106,7 +1106,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
|||||||
const auto NEWFOCUS = newFocusToChild ? NEWCHILD : NEWMASTER;
|
const auto NEWFOCUS = newFocusToChild ? NEWCHILD : NEWMASTER;
|
||||||
switchToWindow(NEWFOCUS);
|
switchToWindow(NEWFOCUS);
|
||||||
} else {
|
} else {
|
||||||
for (auto const& n : m_lMasterNodesData) {
|
for (auto& n : m_lMasterNodesData) {
|
||||||
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
||||||
const auto NEWMASTER = n.pWindow.lock();
|
const auto NEWMASTER = n.pWindow.lock();
|
||||||
switchWindows(NEWMASTER, NEWCHILD);
|
switchWindows(NEWMASTER, NEWCHILD);
|
||||||
@@ -1141,7 +1141,7 @@ std::any CHyprMasterLayout::layoutMessage(SLayoutMessageHeader header, std::stri
|
|||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
// if master is focused keep master focused (don't do anything)
|
// if master is focused keep master focused (don't do anything)
|
||||||
for (auto const& n : m_lMasterNodesData) {
|
for (auto& n : m_lMasterNodesData) {
|
||||||
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
if (n.workspaceID == PMASTER->workspaceID && !n.isMaster) {
|
||||||
switchToWindow(n.pWindow.lock());
|
switchToWindow(n.pWindow.lock());
|
||||||
break;
|
break;
|
||||||
@@ -1469,7 +1469,7 @@ Vector2D CHyprMasterLayout::predictSizeForNewWindowTiled() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CHyprMasterLayout::onEnable() {
|
void CHyprMasterLayout::onEnable() {
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
if (w->m_bIsFloating || !w->m_bIsMapped || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
23
src/main.cpp
@@ -4,9 +4,6 @@
|
|||||||
#include "config/ConfigManager.hpp"
|
#include "config/ConfigManager.hpp"
|
||||||
#include "init/initHelpers.hpp"
|
#include "init/initHelpers.hpp"
|
||||||
|
|
||||||
#include <hyprutils/string/String.hpp>
|
|
||||||
using namespace Hyprutils::String;
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
@@ -23,7 +20,6 @@ void help() {
|
|||||||
std::cout << " --socket NAME - Sets the Wayland socket name (for Wayland socket handover)\n";
|
std::cout << " --socket NAME - Sets the Wayland socket name (for Wayland socket handover)\n";
|
||||||
std::cout << " --wayland-fd FD - Sets the Wayland socket fd (for Wayland socket handover)\n";
|
std::cout << " --wayland-fd FD - Sets the Wayland socket fd (for Wayland socket handover)\n";
|
||||||
std::cout << " --i-am-really-stupid - Omits root user privileges check (why would you do that?)\n";
|
std::cout << " --i-am-really-stupid - Omits root user privileges check (why would you do that?)\n";
|
||||||
std::cout << " --version -v - Print this binary's version\n";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char** argv) {
|
int main(int argc, char** argv) {
|
||||||
@@ -113,25 +109,6 @@ int main(int argc, char** argv) {
|
|||||||
} else if (it->compare("-h") == 0 || it->compare("--help") == 0) {
|
} else if (it->compare("-h") == 0 || it->compare("--help") == 0) {
|
||||||
help();
|
help();
|
||||||
|
|
||||||
return 0;
|
|
||||||
} else if (it->compare("-v") == 0 || it->compare("--version") == 0) {
|
|
||||||
auto commitMsg = trim(GIT_COMMIT_MESSAGE);
|
|
||||||
std::replace(commitMsg.begin(), commitMsg.end(), '#', ' ');
|
|
||||||
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + " " + GIT_DIRTY + " (" + commitMsg +
|
|
||||||
").\nDate: " + GIT_COMMIT_DATE + "\nTag: " + GIT_TAG + ", commits: " + GIT_COMMITS + std::string{"\nbuilt against aquamarine "} + AQUAMARINE_VERSION + "\n" +
|
|
||||||
"\n\nflags: (if any)\n";
|
|
||||||
|
|
||||||
#ifdef LEGACY_RENDERER
|
|
||||||
result += "legacyrenderer\n";
|
|
||||||
#endif
|
|
||||||
#ifndef ISDEBUG
|
|
||||||
result += "debug\n";
|
|
||||||
#endif
|
|
||||||
#ifdef NO_XWAYLAND
|
|
||||||
result += "no xwayland\n";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::cout << result;
|
|
||||||
return 0;
|
return 0;
|
||||||
} else {
|
} else {
|
||||||
std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n";
|
std::cerr << "[ ERROR ] Unknown option '" << it->c_str() << "'!\n";
|
||||||
|
@@ -70,7 +70,7 @@ void CAnimationManager::tick() {
|
|||||||
|
|
||||||
std::vector<CBaseAnimatedVariable*> animationEndedVars;
|
std::vector<CBaseAnimatedVariable*> animationEndedVars;
|
||||||
|
|
||||||
for (auto const& av : m_vActiveAnimatedVariables) {
|
for (auto& av : m_vActiveAnimatedVariables) {
|
||||||
|
|
||||||
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
|
if (av->m_eDamagePolicy == AVARDAMAGE_SHADOW && !*PSHADOWSENABLED) {
|
||||||
av->warp(false);
|
av->warp(false);
|
||||||
@@ -113,7 +113,7 @@ void CAnimationManager::tick() {
|
|||||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||||
|
|
||||||
// TODO: just make this into a damn callback already vax...
|
// TODO: just make this into a damn callback already vax...
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
|
if (!w->m_bIsMapped || w->isHidden() || w->m_pWorkspace != PWORKSPACE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -131,7 +131,7 @@ void CAnimationManager::tick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// damage any workspace window that is on any monitor
|
// damage any workspace window that is on any monitor
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE || w->m_bPinned)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -194,7 +194,7 @@ void CAnimationManager::tick() {
|
|||||||
default: UNREACHABLE();
|
default: UNREACHABLE();
|
||||||
}
|
}
|
||||||
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
// set size and pos if valid, but only if damage policy entire (dont if border for example)
|
||||||
if (validMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && !PWINDOW->isX11OverrideRedirect())
|
if (validMapped(PWINDOW) && av->m_eDamagePolicy == AVARDAMAGE_ENTIRE && PWINDOW->m_iX11Type != 2)
|
||||||
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goal());
|
||||||
|
|
||||||
// check if we did not finish animating. If so, trigger onAnimationEnd.
|
// check if we did not finish animating. If so, trigger onAnimationEnd.
|
||||||
@@ -214,7 +214,7 @@ void CAnimationManager::tick() {
|
|||||||
PWINDOW->updateWindowDecos();
|
PWINDOW->updateWindowDecos();
|
||||||
g_pHyprRenderer->damageWindow(PWINDOW);
|
g_pHyprRenderer->damageWindow(PWINDOW);
|
||||||
} else if (PWORKSPACE) {
|
} else if (PWORKSPACE) {
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
|
if (!validMapped(w) || w->m_pWorkspace != PWORKSPACE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -263,7 +263,7 @@ void CAnimationManager::tick() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// do it here, because if this alters the animation vars deque we would be in trouble above.
|
// do it here, because if this alters the animation vars deque we would be in trouble above.
|
||||||
for (auto const& ave : animationEndedVars) {
|
for (auto& ave : animationEndedVars) {
|
||||||
ave->onAnimationEnd();
|
ave->onAnimationEnd();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -293,7 +293,7 @@ bool CAnimationManager::deltazero(const CColor& a, const CColor& b) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CAnimationManager::bezierExists(const std::string& bezier) {
|
bool CAnimationManager::bezierExists(const std::string& bezier) {
|
||||||
for (auto const& [bc, bz] : m_mBezierCurves) {
|
for (auto& [bc, bz] : m_mBezierCurves) {
|
||||||
if (bc == bezier)
|
if (bc == bezier)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -472,9 +472,9 @@ std::string CAnimationManager::styleValidInConfigVar(const std::string& config,
|
|||||||
|
|
||||||
return "unknown style";
|
return "unknown style";
|
||||||
} else if (config.starts_with("workspaces") || config.starts_with("specialWorkspace")) {
|
} else if (config.starts_with("workspaces") || config.starts_with("specialWorkspace")) {
|
||||||
if (style == "slide" || style == "slidevert" || style == "fade")
|
if (style == "slide" || style == "slidevert")
|
||||||
return "";
|
return "";
|
||||||
else if (style.starts_with("slidefade")) {
|
else if (style.starts_with("slide") || style.starts_with("popin")) {
|
||||||
// try parsing
|
// try parsing
|
||||||
float movePerc = 0.f;
|
float movePerc = 0.f;
|
||||||
if (style.find("%") != std::string::npos) {
|
if (style.find("%") != std::string::npos) {
|
||||||
|
@@ -193,7 +193,7 @@ void CCursorManager::setCursorFromName(const std::string& name) {
|
|||||||
// fallback to a default if available
|
// fallback to a default if available
|
||||||
constexpr const std::array<const char*, 3> fallbackShapes = {"default", "left_ptr", "left-ptr"};
|
constexpr const std::array<const char*, 3> fallbackShapes = {"default", "left_ptr", "left-ptr"};
|
||||||
|
|
||||||
for (auto const& s : fallbackShapes) {
|
for (auto& s : fallbackShapes) {
|
||||||
m_sCurrentCursorShapeData = m_pHyprcursor->getShape(s, m_sCurrentStyleInfo);
|
m_sCurrentCursorShapeData = m_pHyprcursor->getShape(s, m_sCurrentStyleInfo);
|
||||||
|
|
||||||
if (m_sCurrentCursorShapeData.images.size() > 0)
|
if (m_sCurrentCursorShapeData.images.size() > 0)
|
||||||
@@ -288,7 +288,7 @@ void CCursorManager::updateTheme() {
|
|||||||
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
|
static auto PUSEHYPRCURSOR = CConfigValue<Hyprlang::INT>("cursor:enable_hyprcursor");
|
||||||
float highestScale = 1.0;
|
float highestScale = 1.0;
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->scale > highestScale)
|
if (m->scale > highestScale)
|
||||||
highestScale = m->scale;
|
highestScale = m->scale;
|
||||||
}
|
}
|
||||||
@@ -307,7 +307,7 @@ void CCursorManager::updateTheme() {
|
|||||||
|
|
||||||
setCursorFromName("left_ptr");
|
setCursorFromName("left_ptr");
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
m->forceFullFrames = 5;
|
m->forceFullFrames = 5;
|
||||||
g_pCompositor->scheduleFrameForMonitor(m.get(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE);
|
g_pCompositor->scheduleFrameForMonitor(m.get(), Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_SHAPE);
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
|
|||||||
std::vector<HANDLE> faultyHandles;
|
std::vector<HANDLE> faultyHandles;
|
||||||
volatile bool needsDeadCleanup = false;
|
volatile bool needsDeadCleanup = false;
|
||||||
|
|
||||||
for (auto const& cb : *callbacks) {
|
for (auto& cb : *callbacks) {
|
||||||
|
|
||||||
m_bCurrentEventPlugin = false;
|
m_bCurrentEventPlugin = false;
|
||||||
|
|
||||||
@@ -70,7 +70,7 @@ void CHookSystemManager::emit(std::vector<SCallbackFNPtr>* const callbacks, SCal
|
|||||||
std::erase_if(*callbacks, [](const auto& fn) { return !fn.fn.lock(); });
|
std::erase_if(*callbacks, [](const auto& fn) { return !fn.fn.lock(); });
|
||||||
|
|
||||||
if (!faultyHandles.empty()) {
|
if (!faultyHandles.empty()) {
|
||||||
for (auto const& h : faultyHandles)
|
for (auto& h : faultyHandles)
|
||||||
g_pPluginSystem->unloadPlugin(g_pPluginSystem->getPluginByHandle(h), true);
|
g_pPluginSystem->unloadPlugin(g_pPluginSystem->getPluginByHandle(h), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -34,7 +34,7 @@ using namespace Hyprutils::String;
|
|||||||
#include <sys/consio.h>
|
#include <sys/consio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHLWORKSPACE pInitialWorkspace) {
|
static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv() {
|
||||||
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
static auto PINITIALWSTRACKING = CConfigValue<Hyprlang::INT>("misc:initial_workspace_tracking");
|
||||||
|
|
||||||
if (!*PINITIALWSTRACKING || g_pConfigManager->isLaunchingExecOnce)
|
if (!*PINITIALWSTRACKING || g_pConfigManager->isLaunchingExecOnce)
|
||||||
@@ -46,15 +46,11 @@ static std::vector<std::pair<std::string, std::string>> getHyprlandLaunchEnv(PHL
|
|||||||
|
|
||||||
std::vector<std::pair<std::string, std::string>> result;
|
std::vector<std::pair<std::string, std::string>> result;
|
||||||
|
|
||||||
if (!pInitialWorkspace) {
|
result.push_back(std::make_pair<>(
|
||||||
if (PMONITOR->activeSpecialWorkspace)
|
"HL_INITIAL_WORKSPACE_TOKEN",
|
||||||
pInitialWorkspace = PMONITOR->activeSpecialWorkspace;
|
g_pTokenManager->registerNewToken(
|
||||||
else
|
SInitialWorkspaceToken{{}, PMONITOR->activeSpecialWorkspace ? PMONITOR->activeSpecialWorkspace->getConfigName() : PMONITOR->activeWorkspace->getConfigName()},
|
||||||
pInitialWorkspace = PMONITOR->activeWorkspace;
|
std::chrono::months(1337))));
|
||||||
}
|
|
||||||
|
|
||||||
result.push_back(std::make_pair<>("HL_INITIAL_WORKSPACE_TOKEN",
|
|
||||||
g_pTokenManager->registerNewToken(SInitialWorkspaceToken{{}, pInitialWorkspace->getConfigName()}, std::chrono::months(1337))));
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -376,7 +372,7 @@ bool CKeybindManager::onKeyEvent(std::any event, SP<IKeyboard> pKeyboard) {
|
|||||||
|
|
||||||
const auto KEYCODE = e.keycode + 8; // Because to xkbcommon it's +8 from libinput
|
const auto KEYCODE = e.keycode + 8; // Because to xkbcommon it's +8 from libinput
|
||||||
|
|
||||||
const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->resolveBindsBySym ? pKeyboard->xkbState : m_pXKBTranslationState, KEYCODE);
|
const xkb_keysym_t keysym = xkb_state_key_get_one_sym(pKeyboard->resolveBindsBySym ? pKeyboard->xkbStaticState : m_pXKBTranslationState, KEYCODE);
|
||||||
const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->xkbState, KEYCODE);
|
const xkb_keysym_t internalKeysym = xkb_state_key_get_one_sym(pKeyboard->xkbState, KEYCODE);
|
||||||
|
|
||||||
if (handleInternalKeybinds(internalKeysym))
|
if (handleInternalKeybinds(internalKeysym))
|
||||||
@@ -769,7 +765,7 @@ void CKeybindManager::shadowKeybinds(const xkb_keysym_t& doesntHave, const uint3
|
|||||||
const auto KBKEY = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
|
const auto KBKEY = xkb_keysym_from_name(k.key.c_str(), XKB_KEYSYM_CASE_INSENSITIVE);
|
||||||
const auto KBKEYUPPER = xkb_keysym_to_upper(KBKEY);
|
const auto KBKEYUPPER = xkb_keysym_to_upper(KBKEY);
|
||||||
|
|
||||||
for (auto const& pk : m_dPressedKeys) {
|
for (auto& pk : m_dPressedKeys) {
|
||||||
if ((pk.keysym != 0 && (pk.keysym == KBKEY || pk.keysym == KBKEYUPPER))) {
|
if ((pk.keysym != 0 && (pk.keysym == KBKEY || pk.keysym == KBKEYUPPER))) {
|
||||||
shadow = true;
|
shadow = true;
|
||||||
|
|
||||||
@@ -850,12 +846,8 @@ bool CKeybindManager::handleInternalKeybinds(xkb_keysym_t keysym) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Dispatchers
|
// Dispatchers
|
||||||
SDispatchResult CKeybindManager::spawn(std::string args) {
|
|
||||||
const uint64_t PROC = spawnWithRules(args, nullptr);
|
|
||||||
return {.success = PROC > 0, .error = std::format("Failed to start process {}", args)};
|
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t CKeybindManager::spawnWithRules(std::string args, PHLWORKSPACE pInitialWorkspace) {
|
SDispatchResult CKeybindManager::spawn(std::string args) {
|
||||||
|
|
||||||
args = trim(args);
|
args = trim(args);
|
||||||
|
|
||||||
@@ -867,30 +859,30 @@ uint64_t CKeybindManager::spawnWithRules(std::string args, PHLWORKSPACE pInitial
|
|||||||
args = args.substr(args.find_first_of(']') + 1);
|
args = args.substr(args.find_first_of(']') + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64_t PROC = spawnRawProc(args, pInitialWorkspace);
|
const uint64_t PROC = spawnRawProc(args);
|
||||||
|
|
||||||
if (!RULES.empty()) {
|
if (!RULES.empty()) {
|
||||||
const auto RULESLIST = CVarList(RULES, 0, ';');
|
const auto RULESLIST = CVarList(RULES, 0, ';');
|
||||||
|
|
||||||
for (auto const& r : RULESLIST) {
|
for (auto& r : RULESLIST) {
|
||||||
g_pConfigManager->addExecRule({r, (unsigned long)PROC});
|
g_pConfigManager->addExecRule({r, (unsigned long)PROC});
|
||||||
}
|
}
|
||||||
|
|
||||||
Debug::log(LOG, "Applied {} rule arguments for exec.", RULESLIST.size());
|
Debug::log(LOG, "Applied {} rule arguments for exec.", RULESLIST.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
return PROC;
|
|
||||||
}
|
|
||||||
|
|
||||||
SDispatchResult CKeybindManager::spawnRaw(std::string args) {
|
|
||||||
const uint64_t PROC = spawnRawProc(args, nullptr);
|
|
||||||
return {.success = PROC > 0, .error = std::format("Failed to start process {}", args)};
|
return {.success = PROC > 0, .error = std::format("Failed to start process {}", args)};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWorkspace) {
|
SDispatchResult CKeybindManager::spawnRaw(std::string args) {
|
||||||
|
const uint64_t PROC = spawnRawProc(args);
|
||||||
|
return {.success = PROC > 0, .error = std::format("Failed to start process {}", args)};
|
||||||
|
}
|
||||||
|
|
||||||
|
uint64_t CKeybindManager::spawnRawProc(std::string args) {
|
||||||
Debug::log(LOG, "Executing {}", args);
|
Debug::log(LOG, "Executing {}", args);
|
||||||
|
|
||||||
const auto HLENV = getHyprlandLaunchEnv(pInitialWorkspace);
|
const auto HLENV = getHyprlandLaunchEnv();
|
||||||
|
|
||||||
int socket[2];
|
int socket[2];
|
||||||
if (pipe(socket) != 0) {
|
if (pipe(socket) != 0) {
|
||||||
@@ -916,7 +908,7 @@ uint64_t CKeybindManager::spawnRawProc(std::string args, PHLWORKSPACE pInitialWo
|
|||||||
grandchild = fork();
|
grandchild = fork();
|
||||||
if (grandchild == 0) {
|
if (grandchild == 0) {
|
||||||
// run in grandchild
|
// run in grandchild
|
||||||
for (auto const& e : HLENV) {
|
for (auto& e : HLENV) {
|
||||||
setenv(e.first.c_str(), e.second.c_str(), 1);
|
setenv(e.first.c_str(), e.second.c_str(), 1);
|
||||||
}
|
}
|
||||||
setenv("WAYLAND_DISPLAY", g_pCompositor->m_szWLDisplaySocket.c_str(), 1);
|
setenv("WAYLAND_DISPLAY", g_pCompositor->m_szWLDisplaySocket.c_str(), 1);
|
||||||
@@ -1716,7 +1708,7 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||||||
PWORKSPACE->m_bDefaultPseudo = !PWORKSPACE->m_bDefaultPseudo;
|
PWORKSPACE->m_bDefaultPseudo = !PWORKSPACE->m_bDefaultPseudo;
|
||||||
|
|
||||||
// apply
|
// apply
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE)
|
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1728,10 +1720,10 @@ SDispatchResult CKeybindManager::workspaceOpt(std::string args) {
|
|||||||
|
|
||||||
// we make a copy because changeWindowFloatingMode might invalidate the iterator
|
// we make a copy because changeWindowFloatingMode might invalidate the iterator
|
||||||
std::deque<PHLWINDOW> ptrs;
|
std::deque<PHLWINDOW> ptrs;
|
||||||
for (auto const& w : g_pCompositor->m_vWindows)
|
for (auto& w : g_pCompositor->m_vWindows)
|
||||||
ptrs.push_back(w);
|
ptrs.push_back(w);
|
||||||
|
|
||||||
for (auto const& w : ptrs) {
|
for (auto& w : ptrs) {
|
||||||
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
|
if (!w->m_bIsMapped || w->m_pWorkspace != PWORKSPACE || w->isHidden())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1781,11 +1773,6 @@ SDispatchResult CKeybindManager::renameWorkspace(std::string args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SDispatchResult CKeybindManager::exitHyprland(std::string argz) {
|
SDispatchResult CKeybindManager::exitHyprland(std::string argz) {
|
||||||
g_pConfigManager->dispatchExecShutdown();
|
|
||||||
|
|
||||||
if (g_pCompositor->m_bFinalRequests)
|
|
||||||
return {}; // Exiting deferred until requests complete
|
|
||||||
|
|
||||||
g_pCompositor->stopCompositor();
|
g_pCompositor->stopCompositor();
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
@@ -1908,7 +1895,7 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
|||||||
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
|
||||||
auto specialOpenOnMonitor = PMONITOR->activeSpecialWorkspaceID();
|
auto specialOpenOnMonitor = PMONITOR->activeSpecialWorkspaceID();
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->activeSpecialWorkspaceID() == workspaceID) {
|
if (m->activeSpecialWorkspaceID() == workspaceID) {
|
||||||
requestedWorkspaceIsAlreadyOpen = true;
|
requestedWorkspaceIsAlreadyOpen = true;
|
||||||
break;
|
break;
|
||||||
@@ -1935,7 +1922,7 @@ SDispatchResult CKeybindManager::toggleSpecialWorkspace(std::string args) {
|
|||||||
SDispatchResult CKeybindManager::forceRendererReload(std::string args) {
|
SDispatchResult CKeybindManager::forceRendererReload(std::string args) {
|
||||||
bool overAgain = false;
|
bool overAgain = false;
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (!m->output)
|
if (!m->output)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -2142,7 +2129,7 @@ SDispatchResult CKeybindManager::setSubmap(std::string submap) {
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& k : g_pKeybindManager->m_lKeybinds) {
|
for (auto& k : g_pKeybindManager->m_lKeybinds) {
|
||||||
if (k.submap == submap) {
|
if (k.submap == submap) {
|
||||||
m_szCurrentSelectedSubmap = submap;
|
m_szCurrentSelectedSubmap = submap;
|
||||||
Debug::log(LOG, "Changed keybind submap to {}", submap);
|
Debug::log(LOG, "Changed keybind submap to {}", submap);
|
||||||
@@ -2362,8 +2349,6 @@ SDispatchResult CKeybindManager::sendshortcut(std::string args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pSeatManager->sendKeyboardMods(0, 0, 0, 0);
|
|
||||||
|
|
||||||
if (!PWINDOW)
|
if (!PWINDOW)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
@@ -2405,7 +2390,7 @@ SDispatchResult CKeybindManager::dpms(std::string arg) {
|
|||||||
if (arg.find_first_of(' ') != std::string::npos)
|
if (arg.find_first_of(' ') != std::string::npos)
|
||||||
port = arg.substr(arg.find_first_of(' ') + 1);
|
port = arg.substr(arg.find_first_of(' ') + 1);
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
|
||||||
if (!port.empty() && m->szName != port)
|
if (!port.empty() && m->szName != port)
|
||||||
continue;
|
continue;
|
||||||
@@ -2456,7 +2441,7 @@ SDispatchResult CKeybindManager::swapnext(std::string arg) {
|
|||||||
// sometimes we may come back to ourselves.
|
// sometimes we may come back to ourselves.
|
||||||
if (toSwap == PLASTWINDOW) {
|
if (toSwap == PLASTWINDOW) {
|
||||||
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
|
if (arg == "last" || arg == "l" || arg == "prev" || arg == "p")
|
||||||
toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW, true);
|
toSwap = g_pCompositor->getPrevWindowOnWorkspace(PLASTWINDOW), true;
|
||||||
else
|
else
|
||||||
toSwap = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true);
|
toSwap = g_pCompositor->getNextWindowOnWorkspace(PLASTWINDOW, true);
|
||||||
}
|
}
|
||||||
@@ -2730,7 +2715,7 @@ SDispatchResult CKeybindManager::moveIntoGroup(std::string args) {
|
|||||||
|
|
||||||
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
const auto PWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||||
|
|
||||||
if (!PWINDOW || PWINDOW->m_sGroupData.deny)
|
if (!PWINDOW || PWINDOW->m_bIsFloating || PWINDOW->m_sGroupData.deny)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
auto PWINDOWINDIR = g_pCompositor->getWindowInDirection(PWINDOW, arg);
|
||||||
|
@@ -149,8 +149,7 @@ class CKeybindManager {
|
|||||||
static void moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir = "");
|
static void moveWindowOutOfGroup(PHLWINDOW pWindow, const std::string& dir = "");
|
||||||
static void moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection);
|
static void moveWindowIntoGroup(PHLWINDOW pWindow, PHLWINDOW pWindowInDirection);
|
||||||
static void switchToWindow(PHLWINDOW PWINDOWTOCHANGETO);
|
static void switchToWindow(PHLWINDOW PWINDOWTOCHANGETO);
|
||||||
static uint64_t spawnRawProc(std::string, PHLWORKSPACE pInitialWorkspace);
|
static uint64_t spawnRawProc(std::string);
|
||||||
static uint64_t spawnWithRules(std::string, PHLWORKSPACE pInitialWorkspace);
|
|
||||||
|
|
||||||
// -------------- Dispatchers -------------- //
|
// -------------- Dispatchers -------------- //
|
||||||
static SDispatchResult killActive(std::string);
|
static SDispatchResult killActive(std::string);
|
||||||
@@ -221,7 +220,6 @@ class CKeybindManager {
|
|||||||
friend class CInputManager;
|
friend class CInputManager;
|
||||||
friend class CConfigManager;
|
friend class CConfigManager;
|
||||||
friend class CWorkspace;
|
friend class CWorkspace;
|
||||||
friend class CPointerManager;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|
inline std::unique_ptr<CKeybindManager> g_pKeybindManager;
|
||||||
|
@@ -3,7 +3,6 @@
|
|||||||
#include "../config/ConfigValue.hpp"
|
#include "../config/ConfigValue.hpp"
|
||||||
#include "../protocols/PointerGestures.hpp"
|
#include "../protocols/PointerGestures.hpp"
|
||||||
#include "../protocols/FractionalScale.hpp"
|
#include "../protocols/FractionalScale.hpp"
|
||||||
#include "../protocols/IdleNotify.hpp"
|
|
||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../protocols/core/Compositor.hpp"
|
||||||
#include "../protocols/core/Seat.hpp"
|
#include "../protocols/core/Seat.hpp"
|
||||||
#include "eventLoop/EventLoopManager.hpp"
|
#include "eventLoop/EventLoopManager.hpp"
|
||||||
@@ -18,7 +17,13 @@ CPointerManager::CPointerManager() {
|
|||||||
onMonitorLayoutChange();
|
onMonitorLayoutChange();
|
||||||
|
|
||||||
PMONITOR->events.modeChanged.registerStaticListener(
|
PMONITOR->events.modeChanged.registerStaticListener(
|
||||||
[this, PMONITOR](void* owner, std::any data) { g_pEventLoopManager->doLater([this, PMONITOR]() { onMonitorLayoutChange(); }); }, nullptr);
|
[this, PMONITOR](void* owner, std::any data) {
|
||||||
|
g_pEventLoopManager->doLater([this, PMONITOR]() {
|
||||||
|
onMonitorLayoutChange();
|
||||||
|
checkDefaultCursorWarp(PMONITOR, PMONITOR->output->name);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
nullptr);
|
||||||
PMONITOR->events.disconnect.registerStaticListener(
|
PMONITOR->events.disconnect.registerStaticListener(
|
||||||
[this, PMONITOR](void* owner, std::any data) { g_pEventLoopManager->doLater([this, PMONITOR]() { onMonitorLayoutChange(); }); }, nullptr);
|
[this, PMONITOR](void* owner, std::any data) { g_pEventLoopManager->doLater([this, PMONITOR]() { onMonitorLayoutChange(); }); }, nullptr);
|
||||||
PMONITOR->events.destroy.registerStaticListener(
|
PMONITOR->events.destroy.registerStaticListener(
|
||||||
@@ -38,22 +43,54 @@ CPointerManager::CPointerManager() {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CPointerManager::checkDefaultCursorWarp(SP<CMonitor> monitor, std::string monitorName) {
|
||||||
|
static auto PCURSORMONITOR = CConfigValue<std::string>("cursor:default_monitor");
|
||||||
|
static bool cursorDefaultDone = false;
|
||||||
|
static bool firstLaunch = true;
|
||||||
|
|
||||||
|
const auto POS = monitor->middle();
|
||||||
|
|
||||||
|
// by default, cursor should be set to first monitor detected
|
||||||
|
// this is needed as a default if the monitor given in config above doesn't exist
|
||||||
|
if (firstLaunch) {
|
||||||
|
firstLaunch = false;
|
||||||
|
g_pCompositor->warpCursorTo(POS, true);
|
||||||
|
g_pInputManager->refocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!cursorDefaultDone && *PCURSORMONITOR != STRVAL_EMPTY) {
|
||||||
|
if (*PCURSORMONITOR == monitorName) {
|
||||||
|
cursorDefaultDone = true;
|
||||||
|
g_pCompositor->warpCursorTo(POS, true);
|
||||||
|
g_pInputManager->refocus();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// modechange happend check if cursor is on that monitor and warp it to middle to not place it out of bounds if resolution changed.
|
||||||
|
if (g_pCompositor->getMonitorFromCursor() == monitor.get()) {
|
||||||
|
g_pCompositor->warpCursorTo(POS, true);
|
||||||
|
g_pInputManager->refocus();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CPointerManager::lockSoftwareAll() {
|
void CPointerManager::lockSoftwareAll() {
|
||||||
for (auto const& state : monitorStates)
|
for (auto& state : monitorStates)
|
||||||
state->softwareLocks++;
|
state->softwareLocks++;
|
||||||
|
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::unlockSoftwareAll() {
|
void CPointerManager::unlockSoftwareAll() {
|
||||||
for (auto const& state : monitorStates)
|
for (auto& state : monitorStates)
|
||||||
state->softwareLocks--;
|
state->softwareLocks--;
|
||||||
|
|
||||||
updateCursorBackend();
|
updateCursorBackend();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::lockSoftwareForMonitor(CMonitor* Monitor) {
|
void CPointerManager::lockSoftwareForMonitor(CMonitor* Monitor) {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->ID == Monitor->ID) {
|
if (m->ID == Monitor->ID) {
|
||||||
lockSoftwareForMonitor(m);
|
lockSoftwareForMonitor(m);
|
||||||
return;
|
return;
|
||||||
@@ -70,7 +107,7 @@ void CPointerManager::lockSoftwareForMonitor(SP<CMonitor> mon) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::unlockSoftwareForMonitor(CMonitor* Monitor) {
|
void CPointerManager::unlockSoftwareForMonitor(CMonitor* Monitor) {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->ID == Monitor->ID) {
|
if (m->ID == Monitor->ID) {
|
||||||
unlockSoftwareForMonitor(m);
|
unlockSoftwareForMonitor(m);
|
||||||
return;
|
return;
|
||||||
@@ -188,7 +225,7 @@ void CPointerManager::recheckEnteredOutputs() {
|
|||||||
|
|
||||||
auto box = getCursorBoxGlobal();
|
auto box = getCursorBoxGlobal();
|
||||||
|
|
||||||
for (auto const& s : monitorStates) {
|
for (auto& s : monitorStates) {
|
||||||
if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_bEnabled)
|
if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_bEnabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -208,8 +245,9 @@ void CPointerManager::recheckEnteredOutputs() {
|
|||||||
|
|
||||||
// if we are using hw cursors, prevent
|
// if we are using hw cursors, prevent
|
||||||
// the cursor from being stuck at the last point.
|
// the cursor from being stuck at the last point.
|
||||||
|
// if we are leaving it, move it to narnia.
|
||||||
if (!s->hardwareFailed && (s->monitor->output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER))
|
if (!s->hardwareFailed && (s->monitor->output->getBackend()->capabilities() & Aquamarine::IBackendImplementation::eBackendCapabilities::AQ_BACKEND_CAPABILITY_POINTER))
|
||||||
setHWCursorBuffer(s, nullptr);
|
s->monitor->output->moveCursor({-1337, -420});
|
||||||
|
|
||||||
if (!currentCursorImage.surface)
|
if (!currentCursorImage.surface)
|
||||||
continue;
|
continue;
|
||||||
@@ -223,7 +261,7 @@ void CPointerManager::resetCursorImage(bool apply) {
|
|||||||
damageIfSoftware();
|
damageIfSoftware();
|
||||||
|
|
||||||
if (currentCursorImage.surface) {
|
if (currentCursorImage.surface) {
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
currentCursorImage.surface->resource()->leave(m);
|
currentCursorImage.surface->resource()->leave(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,7 +279,7 @@ void CPointerManager::resetCursorImage(bool apply) {
|
|||||||
currentCursorImage.scale = 1.F;
|
currentCursorImage.scale = 1.F;
|
||||||
currentCursorImage.hotspot = {0, 0};
|
currentCursorImage.hotspot = {0, 0};
|
||||||
|
|
||||||
for (auto const& s : monitorStates) {
|
for (auto& s : monitorStates) {
|
||||||
if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_bEnabled)
|
if (s->monitor.expired() || s->monitor->isMirror() || !s->monitor->m_bEnabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -251,7 +289,7 @@ void CPointerManager::resetCursorImage(bool apply) {
|
|||||||
if (!apply)
|
if (!apply)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& ms : monitorStates) {
|
for (auto& ms : monitorStates) {
|
||||||
if (!ms->monitor || !ms->monitor->m_bEnabled || !ms->monitor->dpmsStatus) {
|
if (!ms->monitor || !ms->monitor->m_bEnabled || !ms->monitor->dpmsStatus) {
|
||||||
Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display");
|
Debug::log(TRACE, "Not updating hw cursors: disabled / dpms off display");
|
||||||
continue;
|
continue;
|
||||||
@@ -268,9 +306,7 @@ void CPointerManager::resetCursorImage(bool apply) {
|
|||||||
void CPointerManager::updateCursorBackend() {
|
void CPointerManager::updateCursorBackend() {
|
||||||
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
|
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
|
||||||
|
|
||||||
const auto CURSORBOX = getCursorBoxGlobal();
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
|
||||||
auto state = stateFor(m);
|
auto state = stateFor(m);
|
||||||
|
|
||||||
if (!m->m_bEnabled || !m->dpmsStatus) {
|
if (!m->m_bEnabled || !m->dpmsStatus) {
|
||||||
@@ -278,15 +314,6 @@ void CPointerManager::updateCursorBackend() {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty();
|
|
||||||
|
|
||||||
if (!CROSSES) {
|
|
||||||
if (state->cursorFrontBuffer)
|
|
||||||
setHWCursorBuffer(state, nullptr);
|
|
||||||
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state->softwareLocks > 0 || *PNOHW || !attemptHardwareCursor(state)) {
|
if (state->softwareLocks > 0 || *PNOHW || !attemptHardwareCursor(state)) {
|
||||||
Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName);
|
Debug::log(TRACE, "Output {} rejected hardware cursors, falling back to sw", m->szName);
|
||||||
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
|
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
|
||||||
@@ -307,34 +334,17 @@ void CPointerManager::onCursorMoved() {
|
|||||||
if (!hasCursor())
|
if (!hasCursor())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const auto CURSORBOX = getCursorBoxGlobal();
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
bool recalc = false;
|
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
|
||||||
auto state = stateFor(m);
|
auto state = stateFor(m);
|
||||||
|
|
||||||
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
|
state->box = getCursorBoxLogicalForMonitor(state->monitor.lock());
|
||||||
|
|
||||||
auto CROSSES = !m->logicalBox().intersection(CURSORBOX).empty();
|
|
||||||
|
|
||||||
if (!CROSSES && state->cursorFrontBuffer) {
|
|
||||||
Debug::log(TRACE, "onCursorMoved for output {}: cursor left the viewport, removing it from the backend", m->szName);
|
|
||||||
setHWCursorBuffer(state, nullptr);
|
|
||||||
continue;
|
|
||||||
} else if (CROSSES && !state->cursorFrontBuffer) {
|
|
||||||
Debug::log(TRACE, "onCursorMoved for output {}: cursor entered the output, but no front buffer, forcing recalc", m->szName);
|
|
||||||
recalc = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (state->hardwareFailed || !state->entered)
|
if (state->hardwareFailed || !state->entered)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
const auto CURSORPOS = getCursorPosForMonitor(m);
|
const auto CURSORPOS = getCursorPosForMonitor(m);
|
||||||
m->output->moveCursor(CURSORPOS);
|
m->output->moveCursor(CURSORPOS);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recalc)
|
|
||||||
updateCursorBackend();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerState> state) {
|
bool CPointerManager::attemptHardwareCursor(SP<CPointerManager::SMonitorPointerState> state) {
|
||||||
@@ -590,7 +600,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
|
|||||||
|
|
||||||
//
|
//
|
||||||
static auto INSIDE_LAYOUT = [this](const CBox& box) -> bool {
|
static auto INSIDE_LAYOUT = [this](const CBox& box) -> bool {
|
||||||
for (auto const& b : currentMonitorLayout.monitorBoxes) {
|
for (auto& b : currentMonitorLayout.monitorBoxes) {
|
||||||
if (box.inside(b))
|
if (box.inside(b))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -598,7 +608,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static auto INSIDE_LAYOUT_COORD = [this](const Vector2D& vec) -> bool {
|
static auto INSIDE_LAYOUT_COORD = [this](const Vector2D& vec) -> bool {
|
||||||
for (auto const& b : currentMonitorLayout.monitorBoxes) {
|
for (auto& b : currentMonitorLayout.monitorBoxes) {
|
||||||
if (b.containsPoint(vec))
|
if (b.containsPoint(vec))
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -609,7 +619,7 @@ Vector2D CPointerManager::closestValid(const Vector2D& pos) {
|
|||||||
Vector2D leader;
|
Vector2D leader;
|
||||||
float distanceSq = __FLT_MAX__;
|
float distanceSq = __FLT_MAX__;
|
||||||
|
|
||||||
for (auto const& b : currentMonitorLayout.monitorBoxes) {
|
for (auto& b : currentMonitorLayout.monitorBoxes) {
|
||||||
auto p = b.closestPoint(vec);
|
auto p = b.closestPoint(vec);
|
||||||
auto distSq = p.distanceSq(vec);
|
auto distSq = p.distanceSq(vec);
|
||||||
|
|
||||||
@@ -663,8 +673,8 @@ void CPointerManager::damageIfSoftware() {
|
|||||||
|
|
||||||
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
|
static auto PNOHW = CConfigValue<Hyprlang::INT>("cursor:no_hardware_cursors");
|
||||||
|
|
||||||
for (auto const& mw : monitorStates) {
|
for (auto& mw : monitorStates) {
|
||||||
if (mw->monitor.expired() || !mw->monitor->output)
|
if (mw->monitor.expired())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((mw->softwareLocks > 0 || mw->hardwareFailed || *PNOHW) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
|
if ((mw->softwareLocks > 0 || mw->hardwareFailed || *PNOHW) && b.overlaps({mw->monitor->vecPosition, mw->monitor->vecSize})) {
|
||||||
@@ -738,7 +748,7 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
|||||||
if (POINTER->boundOutput == "entire") {
|
if (POINTER->boundOutput == "entire") {
|
||||||
// find x and y size of the entire space
|
// find x and y size of the entire space
|
||||||
Vector2D bottomRight = {-9999999, -9999999}, topLeft = {9999999, 9999999};
|
Vector2D bottomRight = {-9999999, -9999999}, topLeft = {9999999, 9999999};
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
const auto EXTENT = m->logicalBox().extent();
|
const auto EXTENT = m->logicalBox().extent();
|
||||||
const auto POS = m->logicalBox().pos();
|
const auto POS = m->logicalBox().pos();
|
||||||
if (EXTENT.x > bottomRight.x)
|
if (EXTENT.x > bottomRight.x)
|
||||||
@@ -777,8 +787,8 @@ void CPointerManager::warpAbsolute(Vector2D abs, SP<IHID> dev) {
|
|||||||
|
|
||||||
void CPointerManager::onMonitorLayoutChange() {
|
void CPointerManager::onMonitorLayoutChange() {
|
||||||
currentMonitorLayout.monitorBoxes.clear();
|
currentMonitorLayout.monitorBoxes.clear();
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
if (m->isMirror() || !m->m_bEnabled || !m->output)
|
if (m->isMirror() || !m->m_bEnabled)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
currentMonitorLayout.monitorBoxes.emplace_back(CBox{m->vecPosition, m->vecSize});
|
currentMonitorLayout.monitorBoxes.emplace_back(CBox{m->vecPosition, m->vecSize});
|
||||||
@@ -810,9 +820,6 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||||||
if (!pointer)
|
if (!pointer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
|
|
||||||
|
|
||||||
//
|
|
||||||
auto listener = pointerListeners.emplace_back(makeShared<SPointerListener>());
|
auto listener = pointerListeners.emplace_back(makeShared<SPointerListener>());
|
||||||
|
|
||||||
listener->pointer = pointer;
|
listener->pointer = pointer;
|
||||||
@@ -826,38 +833,24 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||||||
auto E = std::any_cast<IPointer::SMotionEvent>(e);
|
auto E = std::any_cast<IPointer::SMotionEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onMouseMoved(E);
|
g_pInputManager->onMouseMoved(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->motionAbsolute = pointer->pointerEvents.motionAbsolute.registerListener([this] (std::any e) {
|
listener->motionAbsolute = pointer->pointerEvents.motionAbsolute.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SMotionAbsoluteEvent>(e);
|
auto E = std::any_cast<IPointer::SMotionAbsoluteEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onMouseWarp(E);
|
g_pInputManager->onMouseWarp(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->button = pointer->pointerEvents.button.registerListener([this] (std::any e) {
|
listener->button = pointer->pointerEvents.button.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SButtonEvent>(e);
|
auto E = std::any_cast<IPointer::SButtonEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onMouseButton(E);
|
g_pInputManager->onMouseButton(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->axis = pointer->pointerEvents.axis.registerListener([this] (std::any e) {
|
listener->axis = pointer->pointerEvents.axis.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SAxisEvent>(e);
|
auto E = std::any_cast<IPointer::SAxisEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onMouseWheel(E);
|
g_pInputManager->onMouseWheel(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->frame = pointer->pointerEvents.frame.registerListener([this] (std::any e) {
|
listener->frame = pointer->pointerEvents.frame.registerListener([this] (std::any e) {
|
||||||
@@ -868,70 +861,48 @@ void CPointerManager::attachPointer(SP<IPointer> pointer) {
|
|||||||
auto E = std::any_cast<IPointer::SSwipeBeginEvent>(e);
|
auto E = std::any_cast<IPointer::SSwipeBeginEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onSwipeBegin(E);
|
g_pInputManager->onSwipeBegin(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->swipeEnd = pointer->pointerEvents.swipeEnd.registerListener([this] (std::any e) {
|
listener->swipeEnd = pointer->pointerEvents.swipeEnd.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SSwipeEndEvent>(e);
|
auto E = std::any_cast<IPointer::SSwipeEndEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onSwipeEnd(E);
|
g_pInputManager->onSwipeEnd(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->swipeUpdate = pointer->pointerEvents.swipeUpdate.registerListener([this] (std::any e) {
|
listener->swipeUpdate = pointer->pointerEvents.swipeUpdate.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SSwipeUpdateEvent>(e);
|
auto E = std::any_cast<IPointer::SSwipeUpdateEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onSwipeUpdate(E);
|
g_pInputManager->onSwipeUpdate(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->pinchBegin = pointer->pointerEvents.pinchBegin.registerListener([this] (std::any e) {
|
listener->pinchBegin = pointer->pointerEvents.pinchBegin.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SPinchBeginEvent>(e);
|
auto E = std::any_cast<IPointer::SPinchBeginEvent>(e);
|
||||||
|
|
||||||
PROTO::pointerGestures->pinchBegin(E.timeMs, E.fingers);
|
PROTO::pointerGestures->pinchBegin(E.timeMs, E.fingers);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->pinchEnd = pointer->pointerEvents.pinchEnd.registerListener([this] (std::any e) {
|
listener->pinchEnd = pointer->pointerEvents.pinchEnd.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SPinchEndEvent>(e);
|
auto E = std::any_cast<IPointer::SPinchEndEvent>(e);
|
||||||
|
|
||||||
PROTO::pointerGestures->pinchEnd(E.timeMs, E.cancelled);
|
PROTO::pointerGestures->pinchEnd(E.timeMs, E.cancelled);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->pinchUpdate = pointer->pointerEvents.pinchUpdate.registerListener([this] (std::any e) {
|
listener->pinchUpdate = pointer->pointerEvents.pinchUpdate.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SPinchUpdateEvent>(e);
|
auto E = std::any_cast<IPointer::SPinchUpdateEvent>(e);
|
||||||
|
|
||||||
PROTO::pointerGestures->pinchUpdate(E.timeMs, E.delta, E.scale, E.rotation);
|
PROTO::pointerGestures->pinchUpdate(E.timeMs, E.delta, E.scale, E.rotation);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->holdBegin = pointer->pointerEvents.holdBegin.registerListener([this] (std::any e) {
|
listener->holdBegin = pointer->pointerEvents.holdBegin.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SHoldBeginEvent>(e);
|
auto E = std::any_cast<IPointer::SHoldBeginEvent>(e);
|
||||||
|
|
||||||
PROTO::pointerGestures->holdBegin(E.timeMs, E.fingers);
|
PROTO::pointerGestures->holdBegin(E.timeMs, E.fingers);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->holdEnd = pointer->pointerEvents.holdEnd.registerListener([this] (std::any e) {
|
listener->holdEnd = pointer->pointerEvents.holdEnd.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<IPointer::SHoldEndEvent>(e);
|
auto E = std::any_cast<IPointer::SHoldEndEvent>(e);
|
||||||
|
|
||||||
PROTO::pointerGestures->holdEnd(E.timeMs, E.cancelled);
|
PROTO::pointerGestures->holdEnd(E.timeMs, E.cancelled);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@@ -942,9 +913,6 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||||||
if (!touch)
|
if (!touch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
|
|
||||||
|
|
||||||
//
|
|
||||||
auto listener = touchListeners.emplace_back(makeShared<STouchListener>());
|
auto listener = touchListeners.emplace_back(makeShared<STouchListener>());
|
||||||
|
|
||||||
listener->touch = touch;
|
listener->touch = touch;
|
||||||
@@ -958,27 +926,18 @@ void CPointerManager::attachTouch(SP<ITouch> touch) {
|
|||||||
auto E = std::any_cast<ITouch::SDownEvent>(e);
|
auto E = std::any_cast<ITouch::SDownEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTouchDown(E);
|
g_pInputManager->onTouchDown(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->up = touch->touchEvents.up.registerListener([this] (std::any e) {
|
listener->up = touch->touchEvents.up.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<ITouch::SUpEvent>(e);
|
auto E = std::any_cast<ITouch::SUpEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTouchUp(E);
|
g_pInputManager->onTouchUp(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->motion = touch->touchEvents.motion.registerListener([this] (std::any e) {
|
listener->motion = touch->touchEvents.motion.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
auto E = std::any_cast<ITouch::SMotionEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTouchMove(E);
|
g_pInputManager->onTouchMove(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->cancel = touch->touchEvents.cancel.registerListener([this] (std::any e) {
|
listener->cancel = touch->touchEvents.cancel.registerListener([this] (std::any e) {
|
||||||
@@ -997,9 +956,6 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||||||
if (!tablet)
|
if (!tablet)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
|
|
||||||
|
|
||||||
//
|
|
||||||
auto listener = tabletListeners.emplace_back(makeShared<STabletListener>());
|
auto listener = tabletListeners.emplace_back(makeShared<STabletListener>());
|
||||||
|
|
||||||
listener->tablet = tablet;
|
listener->tablet = tablet;
|
||||||
@@ -1013,38 +969,24 @@ void CPointerManager::attachTablet(SP<CTablet> tablet) {
|
|||||||
auto E = std::any_cast<CTablet::SAxisEvent>(e);
|
auto E = std::any_cast<CTablet::SAxisEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTabletAxis(E);
|
g_pInputManager->onTabletAxis(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->proximity = tablet->tabletEvents.proximity.registerListener([this] (std::any e) {
|
listener->proximity = tablet->tabletEvents.proximity.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<CTablet::SProximityEvent>(e);
|
auto E = std::any_cast<CTablet::SProximityEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTabletProximity(E);
|
g_pInputManager->onTabletProximity(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->tip = tablet->tabletEvents.tip.registerListener([this] (std::any e) {
|
listener->tip = tablet->tabletEvents.tip.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<CTablet::STipEvent>(e);
|
auto E = std::any_cast<CTablet::STipEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTabletTip(E);
|
g_pInputManager->onTabletTip(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listener->button = tablet->tabletEvents.button.registerListener([this] (std::any e) {
|
listener->button = tablet->tabletEvents.button.registerListener([this] (std::any e) {
|
||||||
auto E = std::any_cast<CTablet::SButtonEvent>(e);
|
auto E = std::any_cast<CTablet::SButtonEvent>(e);
|
||||||
|
|
||||||
g_pInputManager->onTabletButton(E);
|
g_pInputManager->onTabletButton(E);
|
||||||
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
});
|
});
|
||||||
// clang-format on
|
// clang-format on
|
||||||
|
|
||||||
@@ -1064,7 +1006,7 @@ void CPointerManager::detachTablet(SP<CTablet> tablet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPointerManager::damageCursor(SP<CMonitor> pMonitor) {
|
void CPointerManager::damageCursor(SP<CMonitor> pMonitor) {
|
||||||
for (auto const& mw : monitorStates) {
|
for (auto& mw : monitorStates) {
|
||||||
if (mw->monitor != pMonitor)
|
if (mw->monitor != pMonitor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -26,6 +26,7 @@ class CPointerManager {
|
|||||||
public:
|
public:
|
||||||
CPointerManager();
|
CPointerManager();
|
||||||
|
|
||||||
|
void checkDefaultCursorWarp(SP<CMonitor> monitor, std::string monitorName);
|
||||||
void attachPointer(SP<IPointer> pointer);
|
void attachPointer(SP<IPointer> pointer);
|
||||||
void attachTouch(SP<ITouch> touch);
|
void attachTouch(SP<ITouch> touch);
|
||||||
void attachTablet(SP<CTablet> tablet);
|
void attachTablet(SP<CTablet> tablet);
|
||||||
|
@@ -43,7 +43,6 @@
|
|||||||
#include "../protocols/ToplevelExport.hpp"
|
#include "../protocols/ToplevelExport.hpp"
|
||||||
#include "../protocols/TextInputV1.hpp"
|
#include "../protocols/TextInputV1.hpp"
|
||||||
#include "../protocols/GlobalShortcuts.hpp"
|
#include "../protocols/GlobalShortcuts.hpp"
|
||||||
#include "../protocols/XDGDialog.hpp"
|
|
||||||
|
|
||||||
#include "../protocols/core/Seat.hpp"
|
#include "../protocols/core/Seat.hpp"
|
||||||
#include "../protocols/core/DataDevice.hpp"
|
#include "../protocols/core/DataDevice.hpp"
|
||||||
@@ -151,9 +150,8 @@ CProtocolManager::CProtocolManager() {
|
|||||||
PROTO::screencopy = std::make_unique<CScreencopyProtocol>(&zwlr_screencopy_manager_v1_interface, 3, "Screencopy");
|
PROTO::screencopy = std::make_unique<CScreencopyProtocol>(&zwlr_screencopy_manager_v1_interface, 3, "Screencopy");
|
||||||
PROTO::toplevelExport = std::make_unique<CToplevelExportProtocol>(&hyprland_toplevel_export_manager_v1_interface, 2, "ToplevelExport");
|
PROTO::toplevelExport = std::make_unique<CToplevelExportProtocol>(&hyprland_toplevel_export_manager_v1_interface, 2, "ToplevelExport");
|
||||||
PROTO::globalShortcuts = std::make_unique<CGlobalShortcutsProtocol>(&hyprland_global_shortcuts_manager_v1_interface, 1, "GlobalShortcuts");
|
PROTO::globalShortcuts = std::make_unique<CGlobalShortcutsProtocol>(&hyprland_global_shortcuts_manager_v1_interface, 1, "GlobalShortcuts");
|
||||||
PROTO::xdgDialog = std::make_unique<CXDGDialogProtocol>(&xdg_dialog_v1_interface, 1, "XDGDialog");
|
|
||||||
|
|
||||||
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
for (auto& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||||
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -221,7 +219,6 @@ CProtocolManager::~CProtocolManager() {
|
|||||||
PROTO::screencopy.reset();
|
PROTO::screencopy.reset();
|
||||||
PROTO::toplevelExport.reset();
|
PROTO::toplevelExport.reset();
|
||||||
PROTO::globalShortcuts.reset();
|
PROTO::globalShortcuts.reset();
|
||||||
PROTO::xdgDialog.reset();
|
|
||||||
|
|
||||||
PROTO::lease.reset();
|
PROTO::lease.reset();
|
||||||
PROTO::sync.reset();
|
PROTO::sync.reset();
|
||||||
|
@@ -6,7 +6,6 @@
|
|||||||
#include "../protocols/core/Compositor.hpp"
|
#include "../protocols/core/Compositor.hpp"
|
||||||
#include "../Compositor.hpp"
|
#include "../Compositor.hpp"
|
||||||
#include "../devices/IKeyboard.hpp"
|
#include "../devices/IKeyboard.hpp"
|
||||||
#include "wlr-layer-shell-unstable-v1.hpp"
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ranges>
|
#include <ranges>
|
||||||
|
|
||||||
@@ -25,7 +24,7 @@ void CSeatManager::onNewSeatResource(SP<CWLSeatResource> resource) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
SP<CSeatManager::SSeatResourceContainer> CSeatManager::containerForResource(SP<CWLSeatResource> seatResource) {
|
SP<CSeatManager::SSeatResourceContainer> CSeatManager::containerForResource(SP<CWLSeatResource> seatResource) {
|
||||||
for (auto const& c : seatResources) {
|
for (auto& c : seatResources) {
|
||||||
if (c->resource == seatResource)
|
if (c->resource == seatResource)
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
@@ -113,11 +112,11 @@ void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) {
|
|||||||
|
|
||||||
if (state.keyboardFocusResource) {
|
if (state.keyboardFocusResource) {
|
||||||
auto client = state.keyboardFocusResource->client();
|
auto client = state.keyboardFocusResource->client();
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != client)
|
if (s->resource->client() != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& k : s->resource->keyboards) {
|
for (auto& k : s->resource->keyboards) {
|
||||||
if (!k)
|
if (!k)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -135,12 +134,12 @@ void CSeatManager::setKeyboardFocus(SP<CWLSurfaceResource> surf) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto client = surf->client();
|
auto client = surf->client();
|
||||||
for (auto const& r : seatResources | std::views::reverse) {
|
for (auto& r : seatResources | std::views::reverse) {
|
||||||
if (r->resource->client() != client)
|
if (r->resource->client() != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
state.keyboardFocusResource = r->resource;
|
state.keyboardFocusResource = r->resource;
|
||||||
for (auto const& k : r->resource->keyboards) {
|
for (auto& k : r->resource->keyboards) {
|
||||||
if (!k)
|
if (!k)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -158,11 +157,11 @@ void CSeatManager::sendKeyboardKey(uint32_t timeMs, uint32_t key, wl_keyboard_ke
|
|||||||
if (!state.keyboardFocusResource)
|
if (!state.keyboardFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.keyboardFocusResource->client())
|
if (s->resource->client() != state.keyboardFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& k : s->resource->keyboards) {
|
for (auto& k : s->resource->keyboards) {
|
||||||
if (!k)
|
if (!k)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -175,11 +174,11 @@ void CSeatManager::sendKeyboardMods(uint32_t depressed, uint32_t latched, uint32
|
|||||||
if (!state.keyboardFocusResource)
|
if (!state.keyboardFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.keyboardFocusResource->client())
|
if (s->resource->client() != state.keyboardFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& k : s->resource->keyboards) {
|
for (auto& k : s->resource->keyboards) {
|
||||||
if (!k)
|
if (!k)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -206,11 +205,11 @@ void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D&
|
|||||||
|
|
||||||
if (state.pointerFocusResource) {
|
if (state.pointerFocusResource) {
|
||||||
auto client = state.pointerFocusResource->client();
|
auto client = state.pointerFocusResource->client();
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != client)
|
if (s->resource->client() != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& p : s->resource->pointers) {
|
for (auto& p : s->resource->pointers) {
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -231,12 +230,12 @@ void CSeatManager::setPointerFocus(SP<CWLSurfaceResource> surf, const Vector2D&
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto client = surf->client();
|
auto client = surf->client();
|
||||||
for (auto const& r : seatResources | std::views::reverse) {
|
for (auto& r : seatResources | std::views::reverse) {
|
||||||
if (r->resource->client() != client)
|
if (r->resource->client() != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
state.pointerFocusResource = r->resource;
|
state.pointerFocusResource = r->resource;
|
||||||
for (auto const& p : r->resource->pointers) {
|
for (auto& p : r->resource->pointers) {
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -258,11 +257,11 @@ void CSeatManager::sendPointerMotion(uint32_t timeMs, const Vector2D& local) {
|
|||||||
if (!state.pointerFocusResource)
|
if (!state.pointerFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.pointerFocusResource->client())
|
if (s->resource->client() != state.pointerFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& p : s->resource->pointers) {
|
for (auto& p : s->resource->pointers) {
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -277,11 +276,11 @@ void CSeatManager::sendPointerButton(uint32_t timeMs, uint32_t key, wl_pointer_b
|
|||||||
if (!state.pointerFocusResource)
|
if (!state.pointerFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.pointerFocusResource->client())
|
if (s->resource->client() != state.pointerFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& p : s->resource->pointers) {
|
for (auto& p : s->resource->pointers) {
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -301,11 +300,11 @@ void CSeatManager::sendPointerFrame(WP<CWLSeatResource> pResource) {
|
|||||||
if (!pResource)
|
if (!pResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != pResource->client())
|
if (s->resource->client() != pResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& p : s->resource->pointers) {
|
for (auto& p : s->resource->pointers) {
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -319,11 +318,11 @@ void CSeatManager::sendPointerAxis(uint32_t timeMs, wl_pointer_axis axis, double
|
|||||||
if (!state.pointerFocusResource)
|
if (!state.pointerFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.pointerFocusResource->client())
|
if (s->resource->client() != state.pointerFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& p : s->resource->pointers) {
|
for (auto& p : s->resource->pointers) {
|
||||||
if (!p)
|
if (!p)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -347,12 +346,12 @@ void CSeatManager::sendTouchDown(SP<CWLSurfaceResource> surf, uint32_t timeMs, i
|
|||||||
state.touchFocus = surf;
|
state.touchFocus = surf;
|
||||||
|
|
||||||
auto client = surf->client();
|
auto client = surf->client();
|
||||||
for (auto const& r : seatResources | std::views::reverse) {
|
for (auto& r : seatResources | std::views::reverse) {
|
||||||
if (r->resource->client() != client)
|
if (r->resource->client() != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
state.touchFocusResource = r->resource;
|
state.touchFocusResource = r->resource;
|
||||||
for (auto const& t : r->resource->touches) {
|
for (auto& t : r->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -373,12 +372,12 @@ void CSeatManager::sendTouchUp(uint32_t timeMs, int32_t id) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
auto client = state.touchFocusResource->client();
|
auto client = state.touchFocusResource->client();
|
||||||
for (auto const& r : seatResources | std::views::reverse) {
|
for (auto& r : seatResources | std::views::reverse) {
|
||||||
if (r->resource->client() != client)
|
if (r->resource->client() != client)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
state.touchFocusResource = r->resource;
|
state.touchFocusResource = r->resource;
|
||||||
for (auto const& t : r->resource->touches) {
|
for (auto& t : r->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -396,11 +395,11 @@ void CSeatManager::sendTouchMotion(uint32_t timeMs, int32_t id, const Vector2D&
|
|||||||
if (!state.touchFocusResource)
|
if (!state.touchFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.touchFocusResource->client())
|
if (s->resource->client() != state.touchFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& t : s->resource->touches) {
|
for (auto& t : s->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -413,11 +412,11 @@ void CSeatManager::sendTouchFrame() {
|
|||||||
if (!state.touchFocusResource)
|
if (!state.touchFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.touchFocusResource->client())
|
if (s->resource->client() != state.touchFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& t : s->resource->touches) {
|
for (auto& t : s->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -430,11 +429,11 @@ void CSeatManager::sendTouchCancel() {
|
|||||||
if (!state.touchFocusResource)
|
if (!state.touchFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.touchFocusResource->client())
|
if (s->resource->client() != state.touchFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& t : s->resource->touches) {
|
for (auto& t : s->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -447,11 +446,11 @@ void CSeatManager::sendTouchShape(int32_t id, const Vector2D& shape) {
|
|||||||
if (!state.touchFocusResource)
|
if (!state.touchFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.touchFocusResource->client())
|
if (s->resource->client() != state.touchFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& t : s->resource->touches) {
|
for (auto& t : s->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -464,11 +463,11 @@ void CSeatManager::sendTouchOrientation(int32_t id, double angle) {
|
|||||||
if (!state.touchFocusResource)
|
if (!state.touchFocusResource)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& s : seatResources) {
|
for (auto& s : seatResources) {
|
||||||
if (s->resource->client() != state.touchFocusResource->client())
|
if (s->resource->client() != state.touchFocusResource->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (auto const& t : s->resource->touches) {
|
for (auto& t : s->resource->touches) {
|
||||||
if (!t)
|
if (!t)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -484,7 +483,7 @@ void CSeatManager::refocusGrab() {
|
|||||||
if (seatGrab->surfs.size() > 0) {
|
if (seatGrab->surfs.size() > 0) {
|
||||||
// try to find a surf in focus first
|
// try to find a surf in focus first
|
||||||
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
|
const auto MOUSE = g_pInputManager->getMouseCoordsInternal();
|
||||||
for (auto const& s : seatGrab->surfs) {
|
for (auto& s : seatGrab->surfs) {
|
||||||
auto hlSurf = CWLSurface::fromResource(s.lock());
|
auto hlSurf = CWLSurface::fromResource(s.lock());
|
||||||
if (!hlSurf)
|
if (!hlSurf)
|
||||||
continue;
|
continue;
|
||||||
@@ -585,36 +584,6 @@ void CSeatManager::setGrab(SP<CSeatGrab> grab) {
|
|||||||
auto oldGrab = seatGrab;
|
auto oldGrab = seatGrab;
|
||||||
seatGrab.reset();
|
seatGrab.reset();
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
auto currentFocus = state.keyboardFocus.lock();
|
|
||||||
auto refocus = !currentFocus;
|
|
||||||
|
|
||||||
SP<CWLSurface> surf;
|
|
||||||
PHLLS layer;
|
|
||||||
|
|
||||||
if (!refocus) {
|
|
||||||
surf = CWLSurface::fromResource(currentFocus);
|
|
||||||
layer = surf->getLayer();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!refocus && !layer) {
|
|
||||||
auto popup = surf->getPopup();
|
|
||||||
if (popup) {
|
|
||||||
auto parent = popup->getT1Owner();
|
|
||||||
layer = parent->getLayer();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!refocus && layer)
|
|
||||||
refocus = layer->interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
|
||||||
|
|
||||||
if (refocus) {
|
|
||||||
auto candidate = g_pCompositor->m_pLastWindow.lock();
|
|
||||||
|
|
||||||
if (candidate)
|
|
||||||
g_pCompositor->focusWindow(candidate);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (oldGrab->onEnd)
|
if (oldGrab->onEnd)
|
||||||
oldGrab->onEnd();
|
oldGrab->onEnd();
|
||||||
}
|
}
|
||||||
|
@@ -4,7 +4,6 @@
|
|||||||
#include "../protocols/FractionalScale.hpp"
|
#include "../protocols/FractionalScale.hpp"
|
||||||
#include "../protocols/SessionLock.hpp"
|
#include "../protocols/SessionLock.hpp"
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <ranges>
|
|
||||||
|
|
||||||
SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : surface(surface_) {
|
SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : surface(surface_) {
|
||||||
pWlrSurface = surface->surface();
|
pWlrSurface = surface->surface();
|
||||||
@@ -30,9 +29,6 @@ SSessionLockSurface::SSessionLockSurface(SP<CSessionLockSurface> surface_) : sur
|
|||||||
listeners.commit = surface_->events.commit.registerListener([this](std::any data) {
|
listeners.commit = surface_->events.commit.registerListener([this](std::any data) {
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(iMonitorID);
|
const auto PMONITOR = g_pCompositor->getMonitorFromID(iMonitorID);
|
||||||
|
|
||||||
if (mapped && pWlrSurface != g_pCompositor->m_pLastFocus)
|
|
||||||
g_pInputManager->simulateMouseMovement();
|
|
||||||
|
|
||||||
if (PMONITOR)
|
if (PMONITOR)
|
||||||
g_pHyprRenderer->damageMonitor(PMONITOR);
|
g_pHyprRenderer->damageMonitor(PMONITOR);
|
||||||
});
|
});
|
||||||
@@ -71,7 +67,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
|||||||
m_pSessionLock.reset();
|
m_pSessionLock.reset();
|
||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
g_pHyprRenderer->damageMonitor(m.get());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -79,7 +75,7 @@ void CSessionLockManager::onNewSessionLock(SP<CSessionLock> pLock) {
|
|||||||
m_pSessionLock.reset();
|
m_pSessionLock.reset();
|
||||||
g_pCompositor->focusSurface(nullptr);
|
g_pCompositor->focusSurface(nullptr);
|
||||||
|
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors)
|
for (auto& m : g_pCompositor->m_vMonitors)
|
||||||
g_pHyprRenderer->damageMonitor(m.get());
|
g_pHyprRenderer->damageMonitor(m.get());
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -94,7 +90,7 @@ SSessionLockSurface* CSessionLockManager::getSessionLockSurfaceForMonitor(uint64
|
|||||||
if (!m_pSessionLock)
|
if (!m_pSessionLock)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
|
for (auto& sls : m_pSessionLock->vSessionLockSurfaces) {
|
||||||
if (sls->iMonitorID == id) {
|
if (sls->iMonitorID == id) {
|
||||||
if (sls->mapped)
|
if (sls->mapped)
|
||||||
return sls.get();
|
return sls.get();
|
||||||
@@ -141,7 +137,7 @@ bool CSessionLockManager::isSurfaceSessionLock(SP<CWLSurfaceResource> pSurface)
|
|||||||
if (!m_pSessionLock)
|
if (!m_pSessionLock)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
|
for (auto& sls : m_pSessionLock->vSessionLockSurfaces) {
|
||||||
if (sls->surface->surface() == pSurface)
|
if (sls->surface->surface() == pSurface)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -158,7 +154,7 @@ void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) {
|
|||||||
if (g_pCompositor->m_pLastFocus)
|
if (g_pCompositor->m_pLastFocus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& sls : m_pSessionLock->vSessionLockSurfaces) {
|
for (auto& sls : m_pSessionLock->vSessionLockSurfaces) {
|
||||||
if (!sls->mapped)
|
if (!sls->mapped)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -170,7 +166,3 @@ void CSessionLockManager::removeSessionLockSurface(SSessionLockSurface* pSLS) {
|
|||||||
bool CSessionLockManager::isSessionLockPresent() {
|
bool CSessionLockManager::isSessionLockPresent() {
|
||||||
return m_pSessionLock && !m_pSessionLock->vSessionLockSurfaces.empty();
|
return m_pSessionLock && !m_pSessionLock->vSessionLockSurfaces.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CSessionLockManager::anySessionLockSurfacesPresent() {
|
|
||||||
return m_pSessionLock && std::ranges::any_of(m_pSessionLock->vSessionLockSurfaces, [](const auto& surf) { return surf->mapped; });
|
|
||||||
}
|
|
||||||
|
@@ -55,7 +55,6 @@ class CSessionLockManager {
|
|||||||
bool isSessionLocked();
|
bool isSessionLocked();
|
||||||
bool isSessionLockPresent();
|
bool isSessionLockPresent();
|
||||||
bool isSurfaceSessionLock(SP<CWLSurfaceResource>);
|
bool isSurfaceSessionLock(SP<CWLSurfaceResource>);
|
||||||
bool anySessionLockSurfacesPresent();
|
|
||||||
|
|
||||||
void removeSessionLockSurface(SSessionLockSurface*);
|
void removeSessionLockSurface(SSessionLockSurface*);
|
||||||
|
|
||||||
|
@@ -1,4 +1,3 @@
|
|||||||
#include <algorithm>
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <dirent.h>
|
#include <dirent.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
@@ -305,7 +304,7 @@ std::unordered_set<std::string> CXCursorManager::themePaths(std::string const& t
|
|||||||
scanTheme(theme);
|
scanTheme(theme);
|
||||||
while (!inherits.empty()) {
|
while (!inherits.empty()) {
|
||||||
auto oldInherits = inherits;
|
auto oldInherits = inherits;
|
||||||
for (auto const& i : oldInherits)
|
for (auto& i : oldInherits)
|
||||||
scanTheme(i);
|
scanTheme(i);
|
||||||
|
|
||||||
if (oldInherits.size() == inherits.size())
|
if (oldInherits.size() == inherits.size())
|
||||||
|
@@ -28,26 +28,24 @@ void CHyprXWaylandManager::activateSurface(SP<CWLSurfaceResource> pSurface, bool
|
|||||||
if (!pSurface)
|
if (!pSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
auto HLSurface = CWLSurface::fromResource(pSurface);
|
// TODO:
|
||||||
if (!HLSurface) {
|
// this cannot be nicely done until we rewrite wlr_surface
|
||||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-desktop surface, ignoring");
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
return;
|
if (!w->m_bIsMapped)
|
||||||
}
|
continue;
|
||||||
|
|
||||||
const auto PWINDOW = HLSurface->getWindow();
|
if (w->m_pWLSurface->resource() != pSurface)
|
||||||
if (!PWINDOW) {
|
continue;
|
||||||
Debug::log(TRACE, "CHyprXWaylandManager::activateSurface on non-window surface, ignoring");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PWINDOW->m_bIsX11 && PWINDOW->m_pXWaylandSurface) {
|
if (w->m_bIsX11) {
|
||||||
if (activate) {
|
if (activate) {
|
||||||
PWINDOW->m_pXWaylandSurface->setMinimized(false);
|
w->m_pXWaylandSurface->setMinimized(false);
|
||||||
PWINDOW->m_pXWaylandSurface->restackToTop();
|
w->m_pXWaylandSurface->restackToTop();
|
||||||
|
}
|
||||||
|
w->m_pXWaylandSurface->activate(activate);
|
||||||
|
} else
|
||||||
|
w->m_pXDGSurface->toplevel->setActive(activate);
|
||||||
}
|
}
|
||||||
PWINDOW->m_pXWaylandSurface->activate(activate);
|
|
||||||
} else if (!PWINDOW->m_bIsX11 && PWINDOW->m_pXDGSurface)
|
|
||||||
PWINDOW->m_pXDGSurface->toplevel->setActive(activate);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
||||||
@@ -56,7 +54,7 @@ void CHyprXWaylandManager::activateWindow(PHLWINDOW pWindow, bool activate) {
|
|||||||
|
|
||||||
if (activate) {
|
if (activate) {
|
||||||
pWindow->m_pXWaylandSurface->setMinimized(false);
|
pWindow->m_pXWaylandSurface->setMinimized(false);
|
||||||
if (!pWindow->isX11OverrideRedirect())
|
if (pWindow->m_iX11Type != 2)
|
||||||
pWindow->m_pXWaylandSurface->restackToTop();
|
pWindow->m_pXWaylandSurface->restackToTop();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,7 +75,7 @@ void CHyprXWaylandManager::getGeometryForWindow(PHLWINDOW pWindow, CBox* pbox) {
|
|||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
const auto SIZEHINTS = pWindow->m_pXWaylandSurface->sizeHints.get();
|
const auto SIZEHINTS = pWindow->m_pXWaylandSurface->sizeHints.get();
|
||||||
|
|
||||||
if (SIZEHINTS && !pWindow->isX11OverrideRedirect()) {
|
if (SIZEHINTS && pWindow->m_iX11Type != 2) {
|
||||||
// WM_SIZE_HINTS' x,y,w,h is deprecated it seems.
|
// WM_SIZE_HINTS' x,y,w,h is deprecated it seems.
|
||||||
// Source: https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#wm_normal_hints_property
|
// Source: https://x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#wm_normal_hints_property
|
||||||
pbox->x = pWindow->m_pXWaylandSurface->geometry.x;
|
pbox->x = pWindow->m_pXWaylandSurface->geometry.x;
|
||||||
@@ -144,7 +142,7 @@ void CHyprXWaylandManager::setWindowSize(PHLWINDOW pWindow, Vector2D size, bool
|
|||||||
|
|
||||||
bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
|
bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
|
||||||
if (pWindow->m_bIsX11) {
|
if (pWindow->m_bIsX11) {
|
||||||
for (auto const& a : pWindow->m_pXWaylandSurface->atoms)
|
for (auto& a : pWindow->m_pXWaylandSurface->atoms)
|
||||||
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"] ||
|
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DIALOG"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLBAR"] ||
|
||||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] ||
|
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_UTILITY"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] ||
|
||||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] ||
|
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DOCK"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] ||
|
||||||
@@ -157,8 +155,10 @@ bool CHyprXWaylandManager::shouldBeFloated(PHLWINDOW pWindow, bool pending) {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow->isModal())
|
if (pWindow->m_pXWaylandSurface->modal) {
|
||||||
|
pWindow->m_bIsModal = true;
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (pWindow->m_pXWaylandSurface->transient)
|
if (pWindow->m_pXWaylandSurface->transient)
|
||||||
return true;
|
return true;
|
||||||
@@ -188,7 +188,7 @@ void CHyprXWaylandManager::checkBorders(PHLWINDOW pWindow) {
|
|||||||
if (!pWindow->m_bIsX11)
|
if (!pWindow->m_bIsX11)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& a : pWindow->m_pXWaylandSurface->atoms) {
|
for (auto& a : pWindow->m_pXWaylandSurface->atoms) {
|
||||||
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
if (a == HYPRATOMS["_NET_WM_WINDOW_TYPE_POPUP_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_NOTIFICATION"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"] ||
|
||||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_COMBO"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_MENU"] || a == HYPRATOMS["_NET_WM_WINDOW_TYPE_SPLASH"] ||
|
||||||
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) {
|
a == HYPRATOMS["_NET_WM_WINDOW_TYPE_TOOLTIP"]) {
|
||||||
@@ -198,8 +198,9 @@ void CHyprXWaylandManager::checkBorders(PHLWINDOW pWindow) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pWindow->isX11OverrideRedirect())
|
if (pWindow->m_iX11Type == 2) {
|
||||||
pWindow->m_bX11DoesntWantBorders = true;
|
pWindow->m_bX11DoesntWantBorders = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscreen) {
|
void CHyprXWaylandManager::setWindowFullscreen(PHLWINDOW pWindow, bool fullscreen) {
|
||||||
@@ -249,7 +250,7 @@ Vector2D CHyprXWaylandManager::xwaylandToWaylandCoords(const Vector2D& coord) {
|
|||||||
|
|
||||||
CMonitor* pMonitor = nullptr;
|
CMonitor* pMonitor = nullptr;
|
||||||
double bestDistance = __FLT_MAX__;
|
double bestDistance = __FLT_MAX__;
|
||||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||||
const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize;
|
const auto SIZ = *PXWLFORCESCALEZERO ? m->vecTransformedSize : m->vecSize;
|
||||||
|
|
||||||
double distance =
|
double distance =
|
||||||
|
@@ -19,7 +19,7 @@ CEventLoopManager::CEventLoopManager(wl_display* display, wl_event_loop* wlEvent
|
|||||||
}
|
}
|
||||||
|
|
||||||
CEventLoopManager::~CEventLoopManager() {
|
CEventLoopManager::~CEventLoopManager() {
|
||||||
for (auto const& eventSource : m_sWayland.aqEventSources) {
|
for (auto& eventSource : m_sWayland.aqEventSources) {
|
||||||
wl_event_source_remove(eventSource);
|
wl_event_source_remove(eventSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ void CEventLoopManager::enterLoop() {
|
|||||||
m_sWayland.eventSource = wl_event_loop_add_fd(m_sWayland.loop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr);
|
m_sWayland.eventSource = wl_event_loop_add_fd(m_sWayland.loop, m_sTimers.timerfd, WL_EVENT_READABLE, timerWrite, nullptr);
|
||||||
|
|
||||||
aqPollFDs = g_pCompositor->m_pAqBackend->getPollFDs();
|
aqPollFDs = g_pCompositor->m_pAqBackend->getPollFDs();
|
||||||
for (auto const& fd : aqPollFDs) {
|
for (auto& fd : aqPollFDs) {
|
||||||
m_sWayland.aqEventSources.emplace_back(wl_event_loop_add_fd(m_sWayland.loop, fd->fd, WL_EVENT_READABLE, aquamarineFDWrite, fd.get()));
|
m_sWayland.aqEventSources.emplace_back(wl_event_loop_add_fd(m_sWayland.loop, fd->fd, WL_EVENT_READABLE, aquamarineFDWrite, fd.get()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,7 +56,7 @@ void CEventLoopManager::enterLoop() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CEventLoopManager::onTimerFire() {
|
void CEventLoopManager::onTimerFire() {
|
||||||
for (auto const& t : m_sTimers.timers) {
|
for (auto& t : m_sTimers.timers) {
|
||||||
if (t.strongRef() > 1 /* if it's 1, it was lost. Don't call it. */ && t->passed() && !t->cancelled())
|
if (t.strongRef() > 1 /* if it's 1, it was lost. Don't call it. */ && t->passed() && !t->cancelled())
|
||||||
t->call(t);
|
t->call(t);
|
||||||
}
|
}
|
||||||
@@ -93,7 +93,7 @@ void CEventLoopManager::nudgeTimers() {
|
|||||||
|
|
||||||
long nextTimerUs = 10 * 1000 * 1000; // 10s
|
long nextTimerUs = 10 * 1000 * 1000; // 10s
|
||||||
|
|
||||||
for (auto const& t : m_sTimers.timers) {
|
for (auto& t : m_sTimers.timers) {
|
||||||
if (const auto µs = t->leftUs(); µs < nextTimerUs)
|
if (const auto µs = t->leftUs(); µs < nextTimerUs)
|
||||||
nextTimerUs = µs;
|
nextTimerUs = µs;
|
||||||
}
|
}
|
||||||
@@ -122,7 +122,7 @@ void CEventLoopManager::doLater(const std::function<void()>& fn) {
|
|||||||
auto cpy = IDLE->fns;
|
auto cpy = IDLE->fns;
|
||||||
IDLE->fns.clear();
|
IDLE->fns.clear();
|
||||||
IDLE->eventSource = nullptr;
|
IDLE->eventSource = nullptr;
|
||||||
for (auto const& c : cpy) {
|
for (auto& c : cpy) {
|
||||||
if (c)
|
if (c)
|
||||||
c();
|
c();
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,3 @@ float CEventLoopTimer::leftUs() {
|
|||||||
|
|
||||||
return std::chrono::duration_cast<std::chrono::microseconds>(*expires - std::chrono::steady_clock::now()).count();
|
return std::chrono::duration_cast<std::chrono::microseconds>(*expires - std::chrono::steady_clock::now()).count();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CEventLoopTimer::armed() {
|
|
||||||
return expires.has_value();
|
|
||||||
}
|
|
||||||
|
@@ -16,7 +16,6 @@ class CEventLoopTimer {
|
|||||||
|
|
||||||
void cancel();
|
void cancel();
|
||||||
bool passed();
|
bool passed();
|
||||||
bool armed();
|
|
||||||
|
|
||||||
float leftUs();
|
float leftUs();
|
||||||
|
|
||||||
|
@@ -31,7 +31,7 @@ void CInputManager::newIdleInhibitor(std::any inhibitor) {
|
|||||||
|
|
||||||
void CInputManager::recheckIdleInhibitorStatus() {
|
void CInputManager::recheckIdleInhibitorStatus() {
|
||||||
|
|
||||||
for (auto const& ii : m_vIdleInhibitors) {
|
for (auto& ii : m_vIdleInhibitors) {
|
||||||
if (ii->nonDesktop) {
|
if (ii->nonDesktop) {
|
||||||
PROTO::idle->setInhibit(true);
|
PROTO::idle->setInhibit(true);
|
||||||
return;
|
return;
|
||||||
@@ -49,7 +49,7 @@ void CInputManager::recheckIdleInhibitorStatus() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// check manual user-set inhibitors
|
// check manual user-set inhibitors
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (w->m_eIdleInhibitMode == IDLEINHIBIT_NONE)
|
if (w->m_eIdleInhibitMode == IDLEINHIBIT_NONE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -28,7 +28,6 @@
|
|||||||
|
|
||||||
#include "../../managers/PointerManager.hpp"
|
#include "../../managers/PointerManager.hpp"
|
||||||
#include "../../managers/SeatManager.hpp"
|
#include "../../managers/SeatManager.hpp"
|
||||||
#include "../../managers/KeybindManager.hpp"
|
|
||||||
|
|
||||||
#include <aquamarine/input/Input.hpp>
|
#include <aquamarine/input/Input.hpp>
|
||||||
|
|
||||||
@@ -136,6 +135,7 @@ void CInputManager::sendMotionEventsToFocused() {
|
|||||||
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
||||||
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
static auto PFOLLOWMOUSE = CConfigValue<Hyprlang::INT>("input:follow_mouse");
|
||||||
static auto PMOUSEREFOCUS = CConfigValue<Hyprlang::INT>("input:mouse_refocus");
|
static auto PMOUSEREFOCUS = CConfigValue<Hyprlang::INT>("input:mouse_refocus");
|
||||||
|
static auto PMOUSEDPMS = CConfigValue<Hyprlang::INT>("misc:mouse_move_enables_dpms");
|
||||||
static auto PFOLLOWONDND = CConfigValue<Hyprlang::INT>("misc:always_follow_on_dnd");
|
static auto PFOLLOWONDND = CConfigValue<Hyprlang::INT>("misc:always_follow_on_dnd");
|
||||||
static auto PFLOATBEHAVIOR = CConfigValue<Hyprlang::INT>("input:float_switch_override_focus");
|
static auto PFLOATBEHAVIOR = CConfigValue<Hyprlang::INT>("input:float_switch_override_focus");
|
||||||
static auto PMOUSEFOCUSMON = CConfigValue<Hyprlang::INT>("misc:mouse_move_focuses_monitor");
|
static auto PMOUSEFOCUSMON = CConfigValue<Hyprlang::INT>("misc:mouse_move_focuses_monitor");
|
||||||
@@ -153,10 +153,16 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
Vector2D surfacePos = Vector2D(-1337, -1337);
|
Vector2D surfacePos = Vector2D(-1337, -1337);
|
||||||
PHLWINDOW pFoundWindow;
|
PHLWINDOW pFoundWindow;
|
||||||
PHLLS pFoundLayerSurface;
|
PHLLS pFoundLayerSurface;
|
||||||
|
SSessionLockSurface* pSessionLock = nullptr;
|
||||||
|
|
||||||
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
|
if (!g_pCompositor->m_bReadyToProcess || g_pCompositor->m_bIsShuttingDown || g_pCompositor->m_bUnsafeState)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!g_pCompositor->m_bDPMSStateON && *PMOUSEDPMS) {
|
||||||
|
// enable dpms
|
||||||
|
g_pKeybindManager->dpms("on");
|
||||||
|
}
|
||||||
|
|
||||||
Vector2D mouseCoords = getMouseCoordsInternal();
|
Vector2D mouseCoords = getMouseCoordsInternal();
|
||||||
const auto MOUSECOORDSFLOORED = mouseCoords.floor();
|
const auto MOUSECOORDSFLOORED = mouseCoords.floor();
|
||||||
|
|
||||||
@@ -165,6 +171,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
|
|
||||||
EMIT_HOOK_EVENT_CANCELLABLE("mouseMove", MOUSECOORDSFLOORED);
|
EMIT_HOOK_EVENT_CANCELLABLE("mouseMove", MOUSECOORDSFLOORED);
|
||||||
|
|
||||||
|
if (time)
|
||||||
|
PROTO::idle->onActivity();
|
||||||
|
|
||||||
m_vLastCursorPosFloored = MOUSECOORDSFLOORED;
|
m_vLastCursorPosFloored = MOUSECOORDSFLOORED;
|
||||||
|
|
||||||
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
|
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
|
||||||
@@ -181,6 +190,17 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
if (!PMONITOR->solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) && !skipFrameSchedule)
|
if (!PMONITOR->solitaryClient.lock() && g_pHyprRenderer->shouldRenderCursor() && g_pPointerManager->softwareLockedFor(PMONITOR->self.lock()) && !skipFrameSchedule)
|
||||||
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
|
g_pCompositor->scheduleFrameForMonitor(PMONITOR, Aquamarine::IOutput::AQ_SCHEDULE_CURSOR_MOVE);
|
||||||
|
|
||||||
|
PHLWINDOW forcedFocus = m_pForcedFocus.lock();
|
||||||
|
|
||||||
|
if (!forcedFocus)
|
||||||
|
forcedFocus = g_pCompositor->getForceFocus();
|
||||||
|
|
||||||
|
if (forcedFocus) {
|
||||||
|
pFoundWindow = forcedFocus;
|
||||||
|
surfacePos = pFoundWindow->m_vRealPosition.value();
|
||||||
|
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
||||||
|
}
|
||||||
|
|
||||||
// constraints
|
// constraints
|
||||||
if (!g_pSeatManager->mouse.expired() && isConstrained()) {
|
if (!g_pSeatManager->mouse.expired() && isConstrained()) {
|
||||||
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_pLastFocus.lock());
|
const auto SURF = CWLSurface::fromResource(g_pCompositor->m_pLastFocus.lock());
|
||||||
@@ -207,33 +227,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get());
|
Debug::log(ERR, "BUG THIS: Null SURF/CONSTRAINT in mouse refocus. Ignoring constraints. {:x} {:x}", (uintptr_t)SURF.get(), (uintptr_t)CONSTRAINT.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PMONITOR != g_pCompositor->m_pLastMonitor.get() && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
|
|
||||||
g_pCompositor->setActiveMonitor(PMONITOR);
|
|
||||||
|
|
||||||
if (g_pSessionLockManager->isSessionLocked()) {
|
|
||||||
const auto PSESSIONLOCKSURFACE = g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID);
|
|
||||||
surfacePos = PMONITOR->vecPosition;
|
|
||||||
|
|
||||||
foundSurface = PSESSIONLOCKSURFACE ? PSESSIONLOCKSURFACE->surface->surface() : nullptr;
|
|
||||||
g_pCompositor->focusSurface(foundSurface);
|
|
||||||
|
|
||||||
const auto SURFACELOCAL = mouseCoords - surfacePos;
|
|
||||||
g_pSeatManager->setPointerFocus(foundSurface, SURFACELOCAL);
|
|
||||||
g_pSeatManager->sendPointerMotion(time, SURFACELOCAL);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
PHLWINDOW forcedFocus = m_pForcedFocus.lock();
|
|
||||||
|
|
||||||
if (!forcedFocus)
|
|
||||||
forcedFocus = g_pCompositor->getForceFocus();
|
|
||||||
|
|
||||||
if (forcedFocus) {
|
|
||||||
pFoundWindow = forcedFocus;
|
|
||||||
surfacePos = pFoundWindow->m_vRealPosition.value();
|
|
||||||
foundSurface = pFoundWindow->m_pWLSurface->resource();
|
|
||||||
}
|
|
||||||
|
|
||||||
// if we are holding a pointer button,
|
// if we are holding a pointer button,
|
||||||
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
|
// and we're not dnd-ing, don't refocus. Keep focus on last surface.
|
||||||
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
|
if (!PROTO::data->dndActive() && !m_lCurrentlyHeldButtons.empty() && g_pCompositor->m_pLastFocus && g_pSeatManager->state.pointerFocus && !m_bHardInput) {
|
||||||
@@ -265,6 +258,19 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
|
|
||||||
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
g_pLayoutManager->getCurrentLayout()->onMouseMove(getMouseCoordsInternal());
|
||||||
|
|
||||||
|
if (PMONITOR && PMONITOR != g_pCompositor->m_pLastMonitor.get() && (*PMOUSEFOCUSMON || refocus) && m_pForcedFocus.expired())
|
||||||
|
g_pCompositor->setActiveMonitor(PMONITOR);
|
||||||
|
|
||||||
|
if (g_pSessionLockManager->isSessionLocked()) {
|
||||||
|
pSessionLock = PMONITOR ? g_pSessionLockManager->getSessionLockSurfaceForMonitor(PMONITOR->ID) : nullptr;
|
||||||
|
|
||||||
|
if (!pSessionLock)
|
||||||
|
return;
|
||||||
|
|
||||||
|
foundSurface = pSessionLock->surface->surface();
|
||||||
|
surfacePos = PMONITOR->vecPosition;
|
||||||
|
}
|
||||||
|
|
||||||
if (!foundSurface)
|
if (!foundSurface)
|
||||||
foundSurface = g_pCompositor->vectorToLayerPopupSurface(mouseCoords, PMONITOR, &surfaceCoords, &pFoundLayerSurface);
|
foundSurface = g_pCompositor->vectorToLayerPopupSurface(mouseCoords, PMONITOR, &surfaceCoords, &pFoundLayerSurface);
|
||||||
|
|
||||||
@@ -454,7 +460,9 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
restoreCursorIconToApp();
|
restoreCursorIconToApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pFoundWindow) {
|
if (pSessionLock != nullptr)
|
||||||
|
g_pCompositor->focusSurface(foundSurface);
|
||||||
|
else if (pFoundWindow) {
|
||||||
// change cursor icon if hovering over border
|
// change cursor icon if hovering over border
|
||||||
if (*PRESIZEONBORDER && *PRESIZECURSORICON) {
|
if (*PRESIZEONBORDER && *PRESIZECURSORICON) {
|
||||||
if (!pFoundWindow->isFullscreen() && !pFoundWindow->hasPopupAt(mouseCoords)) {
|
if (!pFoundWindow->isFullscreen() && !pFoundWindow->hasPopupAt(mouseCoords)) {
|
||||||
@@ -500,9 +508,6 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (g_pSeatManager->state.keyboardFocus == nullptr)
|
|
||||||
g_pCompositor->focusWindow(pFoundWindow, foundSurface);
|
|
||||||
|
|
||||||
m_bLastFocusOnLS = false;
|
m_bLastFocusOnLS = false;
|
||||||
} else {
|
} else {
|
||||||
if (*PRESIZEONBORDER && *PRESIZECURSORICON && m_eBorderIconDirection != BORDERICON_NONE) {
|
if (*PRESIZEONBORDER && *PRESIZECURSORICON && m_eBorderIconDirection != BORDERICON_NONE) {
|
||||||
@@ -526,6 +531,8 @@ void CInputManager::mouseMoveUnified(uint32_t time, bool refocus) {
|
|||||||
void CInputManager::onMouseButton(IPointer::SButtonEvent e) {
|
void CInputManager::onMouseButton(IPointer::SButtonEvent e) {
|
||||||
EMIT_HOOK_EVENT_CANCELLABLE("mouseButton", e);
|
EMIT_HOOK_EVENT_CANCELLABLE("mouseButton", e);
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
|
|
||||||
m_tmrLastCursorMovement.reset();
|
m_tmrLastCursorMovement.reset();
|
||||||
|
|
||||||
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
if (e.state == WL_POINTER_BUTTON_STATE_PRESSED) {
|
||||||
@@ -668,7 +675,7 @@ void CInputManager::processMouseDownNormal(const IPointer::SButtonEvent& e) {
|
|||||||
|
|
||||||
// clicking on border triggers resize
|
// clicking on border triggers resize
|
||||||
// TODO detect click on LS properly
|
// TODO detect click on LS properly
|
||||||
if (*PRESIZEONBORDER && !m_bLastFocusOnLS && e.state == WL_POINTER_BUTTON_STATE_PRESSED && (!w || !w->isX11OverrideRedirect())) {
|
if (*PRESIZEONBORDER && !m_bLastFocusOnLS && e.state == WL_POINTER_BUTTON_STATE_PRESSED && (!w || w->m_iX11Type != 2)) {
|
||||||
if (w && !w->isFullscreen()) {
|
if (w && !w->isFullscreen()) {
|
||||||
const CBox real = {w->m_vRealPosition.value().x, w->m_vRealPosition.value().y, w->m_vRealSize.value().x, w->m_vRealSize.value().y};
|
const CBox real = {w->m_vRealPosition.value().x, w->m_vRealPosition.value().y, w->m_vRealSize.value().x, w->m_vRealSize.value().y};
|
||||||
const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA};
|
const CBox grab = {real.x - BORDER_GRAB_AREA, real.y - BORDER_GRAB_AREA, real.width + 2 * BORDER_GRAB_AREA, real.height + 2 * BORDER_GRAB_AREA};
|
||||||
@@ -760,6 +767,8 @@ void CInputManager::onMouseWheel(IPointer::SAxisEvent e) {
|
|||||||
|
|
||||||
bool passEvent = g_pKeybindManager->onAxisEvent(e);
|
bool passEvent = g_pKeybindManager->onAxisEvent(e);
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
|
|
||||||
if (!passEvent)
|
if (!passEvent)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -849,8 +858,6 @@ void CInputManager::newVirtualKeyboard(SP<CVirtualKeyboardV1Resource> keyboard)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
||||||
static auto PDPMS = CConfigValue<Hyprlang::INT>("misc:key_press_enables_dpms");
|
|
||||||
|
|
||||||
m_vHIDs.push_back(keeb);
|
m_vHIDs.push_back(keeb);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -876,12 +883,6 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||||
|
|
||||||
onKeyboardKey(data, PKEEB);
|
onKeyboardKey(data, PKEEB);
|
||||||
|
|
||||||
if (PKEEB->enabled)
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_bDPMSStateON)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
},
|
},
|
||||||
keeb.get());
|
keeb.get());
|
||||||
|
|
||||||
@@ -890,12 +891,6 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||||||
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
auto PKEEB = ((IKeyboard*)owner)->self.lock();
|
||||||
|
|
||||||
onKeyboardMod(PKEEB);
|
onKeyboardMod(PKEEB);
|
||||||
|
|
||||||
if (PKEEB->enabled)
|
|
||||||
PROTO::idle->onActivity();
|
|
||||||
|
|
||||||
if (PKEEB->enabled && *PDPMS && !g_pCompositor->m_bDPMSStateON)
|
|
||||||
g_pKeybindManager->dpms("on");
|
|
||||||
},
|
},
|
||||||
keeb.get());
|
keeb.get());
|
||||||
|
|
||||||
@@ -924,7 +919,7 @@ void CInputManager::setupKeyboard(SP<IKeyboard> keeb) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setKeyboardLayout() {
|
void CInputManager::setKeyboardLayout() {
|
||||||
for (auto const& k : m_vKeyboards)
|
for (auto& k : m_vKeyboards)
|
||||||
applyConfigToKeyboard(k);
|
applyConfigToKeyboard(k);
|
||||||
|
|
||||||
g_pKeybindManager->updateXKBTranslationState();
|
g_pKeybindManager->updateXKBTranslationState();
|
||||||
@@ -1038,7 +1033,7 @@ void CInputManager::setupMouse(SP<IPointer> mauz) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setPointerConfigs() {
|
void CInputManager::setPointerConfigs() {
|
||||||
for (auto const& m : m_vPointers) {
|
for (auto& m : m_vPointers) {
|
||||||
auto devname = m->hlName;
|
auto devname = m->hlName;
|
||||||
|
|
||||||
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
const auto HASCONFIG = g_pConfigManager->deviceConfigExists(devname);
|
||||||
@@ -1202,7 +1197,7 @@ void CInputManager::destroyKeyboard(SP<IKeyboard> pKeyboard) {
|
|||||||
|
|
||||||
if (m_vKeyboards.size() > 0) {
|
if (m_vKeyboards.size() > 0) {
|
||||||
bool found = false;
|
bool found = false;
|
||||||
for (auto const& k : m_vKeyboards | std::views::reverse) {
|
for (auto& k : m_vKeyboards | std::views::reverse) {
|
||||||
if (!k)
|
if (!k)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1273,7 +1268,7 @@ void CInputManager::updateKeyboardsLeds(SP<IKeyboard> pKeyboard) {
|
|||||||
if (!leds.has_value())
|
if (!leds.has_value())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& k : m_vKeyboards) {
|
for (auto& k : m_vKeyboards) {
|
||||||
k->updateLEDs(leds.value());
|
k->updateLEDs(leds.value());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1287,10 +1282,18 @@ void CInputManager::onKeyboardKey(std::any event, SP<IKeyboard> pKeyboard) {
|
|||||||
const auto EMAP = std::unordered_map<std::string, std::any>{{"keyboard", pKeyboard}, {"event", event}};
|
const auto EMAP = std::unordered_map<std::string, std::any>{{"keyboard", pKeyboard}, {"event", event}};
|
||||||
EMIT_HOOK_EVENT_CANCELLABLE("keyPress", EMAP);
|
EMIT_HOOK_EVENT_CANCELLABLE("keyPress", EMAP);
|
||||||
|
|
||||||
|
static auto PDPMS = CConfigValue<Hyprlang::INT>("misc:key_press_enables_dpms");
|
||||||
|
if (*PDPMS && !g_pCompositor->m_bDPMSStateON) {
|
||||||
|
// enable dpms
|
||||||
|
g_pKeybindManager->dpms("on");
|
||||||
|
}
|
||||||
|
|
||||||
bool passEvent = DISALLOWACTION || g_pKeybindManager->onKeyEvent(event, pKeyboard);
|
bool passEvent = DISALLOWACTION || g_pKeybindManager->onKeyEvent(event, pKeyboard);
|
||||||
|
|
||||||
auto e = std::any_cast<IKeyboard::SKeyEvent>(event);
|
auto e = std::any_cast<IKeyboard::SKeyEvent>(event);
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
|
|
||||||
if (passEvent) {
|
if (passEvent) {
|
||||||
const auto IME = m_sIMERelay.m_pIME.lock();
|
const auto IME = m_sIMERelay.m_pIME.lock();
|
||||||
|
|
||||||
@@ -1399,7 +1402,7 @@ void CInputManager::unconstrainMouse() {
|
|||||||
if (g_pSeatManager->mouse.expired())
|
if (g_pSeatManager->mouse.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& c : m_vConstraints) {
|
for (auto& c : m_vConstraints) {
|
||||||
const auto C = c.lock();
|
const auto C = c.lock();
|
||||||
|
|
||||||
if (!C)
|
if (!C)
|
||||||
@@ -1413,7 +1416,7 @@ void CInputManager::unconstrainMouse() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool CInputManager::isConstrained() {
|
bool CInputManager::isConstrained() {
|
||||||
for (auto const& c : m_vConstraints) {
|
for (auto& c : m_vConstraints) {
|
||||||
const auto C = c.lock();
|
const auto C = c.lock();
|
||||||
|
|
||||||
if (!C)
|
if (!C)
|
||||||
@@ -1431,7 +1434,7 @@ bool CInputManager::isConstrained() {
|
|||||||
void CInputManager::updateCapabilities() {
|
void CInputManager::updateCapabilities() {
|
||||||
uint32_t caps = 0;
|
uint32_t caps = 0;
|
||||||
|
|
||||||
for (auto const& h : m_vHIDs) {
|
for (auto& h : m_vHIDs) {
|
||||||
if (h.expired())
|
if (h.expired())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1446,7 +1449,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
|
|||||||
|
|
||||||
uint32_t finalMask = 0;
|
uint32_t finalMask = 0;
|
||||||
|
|
||||||
for (auto const& kb : m_vKeyboards) {
|
for (auto& kb : m_vKeyboards) {
|
||||||
if (kb->isVirtual() && shouldIgnoreVirtualKeyboard(kb))
|
if (kb->isVirtual() && shouldIgnoreVirtualKeyboard(kb))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1461,7 +1464,7 @@ uint32_t CInputManager::accumulateModsFromAllKBs() {
|
|||||||
|
|
||||||
void CInputManager::disableAllKeyboards(bool virt) {
|
void CInputManager::disableAllKeyboards(bool virt) {
|
||||||
|
|
||||||
for (auto const& k : m_vKeyboards) {
|
for (auto& k : m_vKeyboards) {
|
||||||
if (k->isVirtual() != virt)
|
if (k->isVirtual() != virt)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -1537,13 +1540,13 @@ void CInputManager::setTouchDeviceConfigs(SP<ITouch> dev) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& m : m_vTouches) {
|
for (auto& m : m_vTouches) {
|
||||||
setConfig(m);
|
setConfig(m);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::setTabletConfigs() {
|
void CInputManager::setTabletConfigs() {
|
||||||
for (auto const& t : m_vTablets) {
|
for (auto& t : m_vTablets) {
|
||||||
if (t->aq()->getLibinputHandle()) {
|
if (t->aq()->getLibinputHandle()) {
|
||||||
const auto NAME = t->hlName;
|
const auto NAME = t->hlName;
|
||||||
const auto LIBINPUTDEV = t->aq()->getLibinputHandle();
|
const auto LIBINPUTDEV = t->aq()->getLibinputHandle();
|
||||||
@@ -1670,7 +1673,7 @@ void CInputManager::releaseAllMouseButtons() {
|
|||||||
if (PROTO::data->dndActive())
|
if (PROTO::data->dndActive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& mb : buttonsCopy) {
|
for (auto& mb : buttonsCopy) {
|
||||||
g_pSeatManager->sendPointerButton(0, mb, WL_POINTER_BUTTON_STATE_RELEASED);
|
g_pSeatManager->sendPointerButton(0, mb, WL_POINTER_BUTTON_STATE_RELEASED);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1685,7 +1688,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ignore X11 OR windows, they shouldn't be touched
|
// ignore X11 OR windows, they shouldn't be touched
|
||||||
if (w->m_bIsX11 && w->isX11OverrideRedirect())
|
if (w->m_bIsX11 && w->m_iX11Type == 2)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
static auto PEXTENDBORDERGRAB = CConfigValue<Hyprlang::INT>("general:extend_border_grab_area");
|
static auto PEXTENDBORDERGRAB = CConfigValue<Hyprlang::INT>("general:extend_border_grab_area");
|
||||||
@@ -1708,7 +1711,7 @@ void CInputManager::setCursorIconOnBorder(PHLWINDOW w) {
|
|||||||
|
|
||||||
bool onDeco = false;
|
bool onDeco = false;
|
||||||
|
|
||||||
for (auto const& wd : w->m_dWindowDecorations) {
|
for (auto& wd : w->m_dWindowDecorations) {
|
||||||
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
if (!(wd->getDecorationFlags() & DECORATION_ALLOWS_MOUSE_INPUT))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ void CInputMethodRelay::onNewIME(SP<CInputMethodV2> pIME) {
|
|||||||
if (!g_pCompositor->m_pLastFocus)
|
if (!g_pCompositor->m_pLastFocus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& ti : m_vTextInputs) {
|
for (auto& ti : m_vTextInputs) {
|
||||||
if (ti->client() != g_pCompositor->m_pLastFocus->client())
|
if (ti->client() != g_pCompositor->m_pLastFocus->client())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -80,7 +80,7 @@ CTextInput* CInputMethodRelay::getFocusedTextInput() {
|
|||||||
if (!g_pCompositor->m_pLastFocus)
|
if (!g_pCompositor->m_pLastFocus)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
for (auto const& ti : m_vTextInputs) {
|
for (auto& ti : m_vTextInputs) {
|
||||||
if (ti->focusedSurface() == g_pCompositor->m_pLastFocus)
|
if (ti->focusedSurface() == g_pCompositor->m_pLastFocus)
|
||||||
return ti.get();
|
return ti.get();
|
||||||
}
|
}
|
||||||
@@ -101,26 +101,24 @@ void CInputMethodRelay::removeTextInput(CTextInput* pInput) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CInputMethodRelay::updateAllPopups() {
|
void CInputMethodRelay::updateAllPopups() {
|
||||||
for (auto const& p : m_vIMEPopups) {
|
for (auto& p : m_vIMEPopups) {
|
||||||
p->onCommit();
|
p->onCommit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputMethodRelay::activateIME(CTextInput* pInput, bool shouldCommit) {
|
void CInputMethodRelay::activateIME(CTextInput* pInput) {
|
||||||
if (m_pIME.expired())
|
if (m_pIME.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_pIME->activate();
|
m_pIME->activate();
|
||||||
if (shouldCommit)
|
|
||||||
commitIMEState(pInput);
|
commitIMEState(pInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputMethodRelay::deactivateIME(CTextInput* pInput, bool shouldCommit) {
|
void CInputMethodRelay::deactivateIME(CTextInput* pInput) {
|
||||||
if (m_pIME.expired())
|
if (m_pIME.expired())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_pIME->deactivate();
|
m_pIME->deactivate();
|
||||||
if (shouldCommit)
|
|
||||||
commitIMEState(pInput);
|
commitIMEState(pInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -140,7 +138,7 @@ void CInputMethodRelay::onKeyboardFocus(SP<CWLSurfaceResource> pSurface) {
|
|||||||
|
|
||||||
m_pLastKbFocus = pSurface;
|
m_pLastKbFocus = pSurface;
|
||||||
|
|
||||||
for (auto const& ti : m_vTextInputs) {
|
for (auto& ti : m_vTextInputs) {
|
||||||
if (!ti->focusedSurface())
|
if (!ti->focusedSurface())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -150,7 +148,7 @@ void CInputMethodRelay::onKeyboardFocus(SP<CWLSurfaceResource> pSurface) {
|
|||||||
if (!pSurface)
|
if (!pSurface)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& ti : m_vTextInputs) {
|
for (auto& ti : m_vTextInputs) {
|
||||||
if (!ti->isV3())
|
if (!ti->isV3())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -162,7 +160,7 @@ void CInputMethodRelay::onKeyboardFocus(SP<CWLSurfaceResource> pSurface) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CInputPopup* CInputMethodRelay::popupFromCoords(const Vector2D& point) {
|
CInputPopup* CInputMethodRelay::popupFromCoords(const Vector2D& point) {
|
||||||
for (auto const& p : m_vIMEPopups) {
|
for (auto& p : m_vIMEPopups) {
|
||||||
if (p->isVecInPopup(point))
|
if (p->isVecInPopup(point))
|
||||||
return p.get();
|
return p.get();
|
||||||
}
|
}
|
||||||
@@ -171,7 +169,7 @@ CInputPopup* CInputMethodRelay::popupFromCoords(const Vector2D& point) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CInputPopup* CInputMethodRelay::popupFromSurface(const SP<CWLSurfaceResource> surface) {
|
CInputPopup* CInputMethodRelay::popupFromSurface(const SP<CWLSurfaceResource> surface) {
|
||||||
for (auto const& p : m_vIMEPopups) {
|
for (auto& p : m_vIMEPopups) {
|
||||||
if (p->getSurface() == surface)
|
if (p->getSurface() == surface)
|
||||||
return p.get();
|
return p.get();
|
||||||
}
|
}
|
||||||
|
@@ -21,8 +21,8 @@ class CInputMethodRelay {
|
|||||||
void onNewTextInput(WP<CTextInputV3> tiv3);
|
void onNewTextInput(WP<CTextInputV3> tiv3);
|
||||||
void onNewTextInput(WP<CTextInputV1> pTIV1);
|
void onNewTextInput(WP<CTextInputV1> pTIV1);
|
||||||
|
|
||||||
void activateIME(CTextInput* pInput, bool shouldCommit = true);
|
void activateIME(CTextInput* pInput);
|
||||||
void deactivateIME(CTextInput* pInput, bool shouldCommit = true);
|
void deactivateIME(CTextInput* pInput);
|
||||||
void commitIMEState(CTextInput* pInput);
|
void commitIMEState(CTextInput* pInput);
|
||||||
void removeTextInput(CTextInput* pInput);
|
void removeTextInput(CTextInput* pInput);
|
||||||
|
|
||||||
|
@@ -14,7 +14,7 @@ void CInputManager::onSwipeBegin(IPointer::SSwipeBeginEvent e) {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
int onMonitor = 0;
|
int onMonitor = 0;
|
||||||
for (auto const& w : g_pCompositor->m_vWorkspaces) {
|
for (auto& w : g_pCompositor->m_vWorkspaces) {
|
||||||
if (w->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID && !g_pCompositor->isWorkspaceSpecial(w->m_iID)) {
|
if (w->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID && !g_pCompositor->isWorkspaceSpecial(w->m_iID)) {
|
||||||
onMonitor++;
|
onMonitor++;
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,7 @@ void CInputManager::beginWorkspaceSwipe() {
|
|||||||
m_sActiveSwipe.speedPoints = 0;
|
m_sActiveSwipe.speedPoints = 0;
|
||||||
|
|
||||||
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
if (PWORKSPACE->m_bHasFullscreenWindow) {
|
||||||
for (auto const& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
||||||
ls->alpha = 1.f;
|
ls->alpha = 1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -193,7 +193,7 @@ void CInputManager::endWorkspaceSwipe() {
|
|||||||
g_pInputManager->refocus();
|
g_pInputManager->refocus();
|
||||||
|
|
||||||
// apply alpha
|
// apply alpha
|
||||||
for (auto const& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
for (auto& ls : g_pCompositor->m_pLastMonitor->m_aLayerSurfaceLayers[2]) {
|
||||||
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
ls->alpha = pSwitchedTo->m_bHasFullscreenWindow && pSwitchedTo->m_efFullscreenMode == FSMODE_FULLSCREEN ? 0.f : 1.f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
#include "InputManager.hpp"
|
#include "InputManager.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
|
#include "../../protocols/IdleNotify.hpp"
|
||||||
#include "../../protocols/Tablet.hpp"
|
#include "../../protocols/Tablet.hpp"
|
||||||
#include "../../devices/Tablet.hpp"
|
#include "../../devices/Tablet.hpp"
|
||||||
#include "../../managers/PointerManager.hpp"
|
#include "../../managers/PointerManager.hpp"
|
||||||
@@ -13,7 +14,7 @@ static void unfocusTool(SP<CTabletTool> tool) {
|
|||||||
tool->setSurface(nullptr);
|
tool->setSurface(nullptr);
|
||||||
if (tool->isDown)
|
if (tool->isDown)
|
||||||
PROTO::tablet->up(tool);
|
PROTO::tablet->up(tool);
|
||||||
for (auto const& b : tool->buttonsDown) {
|
for (auto& b : tool->buttonsDown) {
|
||||||
PROTO::tablet->buttonTool(tool, b, false);
|
PROTO::tablet->buttonTool(tool, b, false);
|
||||||
}
|
}
|
||||||
PROTO::tablet->proximityOut(tool);
|
PROTO::tablet->proximityOut(tool);
|
||||||
@@ -30,7 +31,7 @@ static void focusTool(SP<CTabletTool> tool, SP<CTablet> tablet, SP<CWLSurfaceRes
|
|||||||
PROTO::tablet->proximityIn(tool, tablet, surf);
|
PROTO::tablet->proximityIn(tool, tablet, surf);
|
||||||
if (tool->isDown)
|
if (tool->isDown)
|
||||||
PROTO::tablet->down(tool);
|
PROTO::tablet->down(tool);
|
||||||
for (auto const& b : tool->buttonsDown) {
|
for (auto& b : tool->buttonsDown) {
|
||||||
PROTO::tablet->buttonTool(tool, b, true);
|
PROTO::tablet->buttonTool(tool, b, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -154,6 +155,8 @@ void CInputManager::onTabletAxis(CTablet::SAxisEvent e) {
|
|||||||
|
|
||||||
if (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_Y))
|
if (e.updatedAxes & (CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_X | CTablet::eTabletToolAxes::HID_TABLET_TOOL_AXIS_TILT_Y))
|
||||||
PROTO::tablet->tilt(PTOOL, PTOOL->tilt);
|
PROTO::tablet->tilt(PTOOL, PTOOL->tilt);
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
||||||
@@ -168,6 +171,8 @@ void CInputManager::onTabletTip(CTablet::STipEvent e) {
|
|||||||
PROTO::tablet->up(PTOOL);
|
PROTO::tablet->up(PTOOL);
|
||||||
|
|
||||||
PTOOL->isDown = e.in;
|
PTOOL->isDown = e.in;
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onTabletButton(CTablet::SButtonEvent e) {
|
void CInputManager::onTabletButton(CTablet::SButtonEvent e) {
|
||||||
@@ -179,6 +184,8 @@ void CInputManager::onTabletButton(CTablet::SButtonEvent e) {
|
|||||||
PTOOL->buttonsDown.push_back(e.button);
|
PTOOL->buttonsDown.push_back(e.button);
|
||||||
else
|
else
|
||||||
std::erase(PTOOL->buttonsDown, e.button);
|
std::erase(PTOOL->buttonsDown, e.button);
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onTabletProximity(CTablet::SProximityEvent e) {
|
void CInputManager::onTabletProximity(CTablet::SProximityEvent e) {
|
||||||
@@ -194,6 +201,8 @@ void CInputManager::onTabletProximity(CTablet::SProximityEvent e) {
|
|||||||
simulateMouseMovement();
|
simulateMouseMovement();
|
||||||
refocusTablet(PTAB, PTOOL);
|
refocusTablet(PTAB, PTOOL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
|
void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
|
||||||
@@ -220,7 +229,7 @@ void CInputManager::newTablet(SP<Aquamarine::ITablet> pDevice) {
|
|||||||
|
|
||||||
SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletTool> pTool) {
|
SP<CTabletTool> CInputManager::ensureTabletToolPresent(SP<Aquamarine::ITabletTool> pTool) {
|
||||||
|
|
||||||
for (auto const& t : m_vTabletTools) {
|
for (auto& t : m_vTabletTools) {
|
||||||
if (t->aq() == pTool)
|
if (t->aq() == pTool)
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@@ -22,17 +22,12 @@ void CTextInput::initCallbacks() {
|
|||||||
listeners.enable = INPUT->events.enable.registerListener([this](std::any p) { onEnabled(); });
|
listeners.enable = INPUT->events.enable.registerListener([this](std::any p) { onEnabled(); });
|
||||||
listeners.disable = INPUT->events.disable.registerListener([this](std::any p) { onDisabled(); });
|
listeners.disable = INPUT->events.disable.registerListener([this](std::any p) { onDisabled(); });
|
||||||
listeners.commit = INPUT->events.onCommit.registerListener([this](std::any p) { onCommit(); });
|
listeners.commit = INPUT->events.onCommit.registerListener([this](std::any p) { onCommit(); });
|
||||||
listeners.reset = INPUT->events.reset.registerListener([this](std::any p) { onReset(); });
|
|
||||||
listeners.destroy = INPUT->events.destroy.registerListener([this](std::any p) {
|
listeners.destroy = INPUT->events.destroy.registerListener([this](std::any p) {
|
||||||
listeners.surfaceUnmap.reset();
|
const auto INPUT = pV3Input.lock();
|
||||||
listeners.surfaceDestroy.reset();
|
if (INPUT && INPUT->current.enabled && focusedSurface())
|
||||||
g_pInputManager->m_sIMERelay.removeTextInput(this);
|
|
||||||
if (!g_pInputManager->m_sIMERelay.getFocusedTextInput())
|
|
||||||
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
||||||
|
g_pInputManager->m_sIMERelay.removeTextInput(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!g_pCompositor->m_pLastFocus.expired() && g_pCompositor->m_pLastFocus->client() == INPUT->client())
|
|
||||||
enter(g_pCompositor->m_pLastFocus.lock());
|
|
||||||
} else {
|
} else {
|
||||||
const auto INPUT = pV1Input.lock();
|
const auto INPUT = pV1Input.lock();
|
||||||
|
|
||||||
@@ -42,13 +37,10 @@ void CTextInput::initCallbacks() {
|
|||||||
});
|
});
|
||||||
listeners.disable = INPUT->events.disable.registerListener([this](std::any p) { onDisabled(); });
|
listeners.disable = INPUT->events.disable.registerListener([this](std::any p) { onDisabled(); });
|
||||||
listeners.commit = INPUT->events.onCommit.registerListener([this](std::any p) { onCommit(); });
|
listeners.commit = INPUT->events.onCommit.registerListener([this](std::any p) { onCommit(); });
|
||||||
listeners.reset = INPUT->events.reset.registerListener([this](std::any p) { onReset(); });
|
|
||||||
listeners.destroy = INPUT->events.destroy.registerListener([this](std::any p) {
|
listeners.destroy = INPUT->events.destroy.registerListener([this](std::any p) {
|
||||||
listeners.surfaceUnmap.reset();
|
listeners.surfaceUnmap.reset();
|
||||||
listeners.surfaceDestroy.reset();
|
listeners.surfaceDestroy.reset();
|
||||||
g_pInputManager->m_sIMERelay.removeTextInput(this);
|
g_pInputManager->m_sIMERelay.removeTextInput(this);
|
||||||
if (!g_pInputManager->m_sIMERelay.getFocusedTextInput())
|
|
||||||
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,44 +71,25 @@ void CTextInput::onDisabled() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!focusedSurface())
|
||||||
|
return;
|
||||||
|
|
||||||
if (!isV3())
|
if (!isV3())
|
||||||
leave();
|
leave();
|
||||||
|
|
||||||
listeners.surfaceUnmap.reset();
|
listeners.surfaceUnmap.reset();
|
||||||
listeners.surfaceDestroy.reset();
|
listeners.surfaceDestroy.reset();
|
||||||
|
|
||||||
if (!focusedSurface())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto PFOCUSEDTI = g_pInputManager->m_sIMERelay.getFocusedTextInput();
|
|
||||||
if (!PFOCUSEDTI || PFOCUSEDTI != this)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTextInput::onReset() {
|
|
||||||
if (g_pInputManager->m_sIMERelay.m_pIME.expired())
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (!focusedSurface())
|
|
||||||
return;
|
|
||||||
|
|
||||||
const auto PFOCUSEDTI = g_pInputManager->m_sIMERelay.getFocusedTextInput();
|
|
||||||
if (!PFOCUSEDTI || PFOCUSEDTI != this)
|
|
||||||
return;
|
|
||||||
|
|
||||||
g_pInputManager->m_sIMERelay.deactivateIME(this, false);
|
|
||||||
g_pInputManager->m_sIMERelay.activateIME(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
void CTextInput::onCommit() {
|
void CTextInput::onCommit() {
|
||||||
if (g_pInputManager->m_sIMERelay.m_pIME.expired()) {
|
if (g_pInputManager->m_sIMERelay.m_pIME.expired()) {
|
||||||
// Debug::log(WARN, "Committing TextInput on no IME!");
|
// Debug::log(WARN, "Committing TextInput on no IME!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(isV3() ? pV3Input->current.enabled.value : pV1Input->active)) {
|
if (!(isV3() ? pV3Input->current.enabled : pV1Input->active)) {
|
||||||
Debug::log(WARN, "Disabled TextInput commit?");
|
Debug::log(WARN, "Disabled TextInput commit?");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -130,12 +103,12 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) {
|
|||||||
|
|
||||||
pFocusedSurface = pSurface;
|
pFocusedSurface = pSurface;
|
||||||
|
|
||||||
if (!pSurface)
|
|
||||||
return;
|
|
||||||
|
|
||||||
listeners.surfaceUnmap.reset();
|
listeners.surfaceUnmap.reset();
|
||||||
listeners.surfaceDestroy.reset();
|
listeners.surfaceDestroy.reset();
|
||||||
|
|
||||||
|
if (!pSurface)
|
||||||
|
return;
|
||||||
|
|
||||||
listeners.surfaceUnmap = pSurface->events.unmap.registerListener([this](std::any d) {
|
listeners.surfaceUnmap = pSurface->events.unmap.registerListener([this](std::any d) {
|
||||||
Debug::log(LOG, "Unmap TI owner1");
|
Debug::log(LOG, "Unmap TI owner1");
|
||||||
|
|
||||||
@@ -144,16 +117,6 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) {
|
|||||||
pFocusedSurface.reset();
|
pFocusedSurface.reset();
|
||||||
listeners.surfaceUnmap.reset();
|
listeners.surfaceUnmap.reset();
|
||||||
listeners.surfaceDestroy.reset();
|
listeners.surfaceDestroy.reset();
|
||||||
|
|
||||||
if (isV3() && !pV3Input.expired() && pV3Input->current.enabled.value) {
|
|
||||||
pV3Input->pending.enabled.value = false;
|
|
||||||
pV3Input->pending.enabled.isDisablePending = false;
|
|
||||||
pV3Input->pending.enabled.isEnablePending = false;
|
|
||||||
pV3Input->current.enabled.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g_pInputManager->m_sIMERelay.getFocusedTextInput())
|
|
||||||
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
listeners.surfaceDestroy = pSurface->events.destroy.registerListener([this](std::any d) {
|
listeners.surfaceDestroy = pSurface->events.destroy.registerListener([this](std::any d) {
|
||||||
@@ -164,16 +127,6 @@ void CTextInput::setFocusedSurface(SP<CWLSurfaceResource> pSurface) {
|
|||||||
pFocusedSurface.reset();
|
pFocusedSurface.reset();
|
||||||
listeners.surfaceUnmap.reset();
|
listeners.surfaceUnmap.reset();
|
||||||
listeners.surfaceDestroy.reset();
|
listeners.surfaceDestroy.reset();
|
||||||
|
|
||||||
if (isV3() && !pV3Input.expired() && pV3Input->current.enabled.value) {
|
|
||||||
pV3Input->pending.enabled.value = false;
|
|
||||||
pV3Input->pending.enabled.isDisablePending = false;
|
|
||||||
pV3Input->pending.enabled.isEnablePending = false;
|
|
||||||
pV3Input->current.enabled.value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!g_pInputManager->m_sIMERelay.getFocusedTextInput())
|
|
||||||
g_pInputManager->m_sIMERelay.deactivateIME(this);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,8 +141,10 @@ void CTextInput::enter(SP<CWLSurfaceResource> pSurface) {
|
|||||||
if (pSurface == focusedSurface())
|
if (pSurface == focusedSurface())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (focusedSurface())
|
if (focusedSurface()) {
|
||||||
leave();
|
leave();
|
||||||
|
setFocusedSurface(nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
enterLocks++;
|
enterLocks++;
|
||||||
if (enterLocks != 1) {
|
if (enterLocks != 1) {
|
||||||
@@ -217,10 +172,11 @@ void CTextInput::leave() {
|
|||||||
enterLocks = 0;
|
enterLocks = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isV3())
|
if (isV3() && focusedSurface())
|
||||||
pV3Input->leave(focusedSurface());
|
pV3Input->leave(focusedSurface());
|
||||||
else
|
else if (focusedSurface() && pV1Input) {
|
||||||
pV1Input->leave();
|
pV1Input->leave();
|
||||||
|
}
|
||||||
|
|
||||||
setFocusedSurface(nullptr);
|
setFocusedSurface(nullptr);
|
||||||
|
|
||||||
@@ -236,7 +192,7 @@ wl_client* CTextInput::client() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) {
|
void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) {
|
||||||
if (isV3() && !pV3Input.expired()) {
|
if (isV3()) {
|
||||||
const auto INPUT = pV3Input.lock();
|
const auto INPUT = pV3Input.lock();
|
||||||
|
|
||||||
if (INPUT->current.surrounding.updated)
|
if (INPUT->current.surrounding.updated)
|
||||||
@@ -246,7 +202,7 @@ void CTextInput::commitStateToIME(SP<CInputMethodV2> ime) {
|
|||||||
|
|
||||||
if (INPUT->current.contentType.updated)
|
if (INPUT->current.contentType.updated)
|
||||||
ime->textContentType(INPUT->current.contentType.hint, INPUT->current.contentType.purpose);
|
ime->textContentType(INPUT->current.contentType.hint, INPUT->current.contentType.purpose);
|
||||||
} else if (!pV1Input.expired()) {
|
} else {
|
||||||
const auto INPUT = pV1Input.lock();
|
const auto INPUT = pV1Input.lock();
|
||||||
|
|
||||||
if (INPUT->pendingSurrounding.isPending)
|
if (INPUT->pendingSurrounding.isPending)
|
||||||
@@ -285,7 +241,7 @@ void CTextInput::updateIMEState(SP<CInputMethodV2> ime) {
|
|||||||
INPUT->preeditStyling(0, std::string(ime->current.preeditString.string).length(), ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
|
INPUT->preeditStyling(0, std::string(ime->current.preeditString.string).length(), ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
|
||||||
INPUT->preeditString(pV1Input->serial, ime->current.preeditString.string.c_str(), "");
|
INPUT->preeditString(pV1Input->serial, ime->current.preeditString.string.c_str(), "");
|
||||||
} else {
|
} else {
|
||||||
INPUT->preeditCursor(0);
|
INPUT->preeditCursor(ime->current.preeditString.begin);
|
||||||
INPUT->preeditStyling(0, 0, ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
|
INPUT->preeditStyling(0, 0, ZWP_TEXT_INPUT_V1_PREEDIT_STYLE_HIGHLIGHT);
|
||||||
INPUT->preeditString(pV1Input->serial, "", "");
|
INPUT->preeditString(pV1Input->serial, "", "");
|
||||||
}
|
}
|
||||||
|
@@ -29,7 +29,6 @@ class CTextInput {
|
|||||||
void onEnabled(SP<CWLSurfaceResource> surfV1 = nullptr);
|
void onEnabled(SP<CWLSurfaceResource> surfV1 = nullptr);
|
||||||
void onDisabled();
|
void onDisabled();
|
||||||
void onCommit();
|
void onCommit();
|
||||||
void onReset();
|
|
||||||
|
|
||||||
bool hasCursorRectangle();
|
bool hasCursorRectangle();
|
||||||
CBox cursorBox();
|
CBox cursorBox();
|
||||||
@@ -48,7 +47,6 @@ class CTextInput {
|
|||||||
struct {
|
struct {
|
||||||
CHyprSignalListener enable;
|
CHyprSignalListener enable;
|
||||||
CHyprSignalListener disable;
|
CHyprSignalListener disable;
|
||||||
CHyprSignalListener reset;
|
|
||||||
CHyprSignalListener commit;
|
CHyprSignalListener commit;
|
||||||
CHyprSignalListener destroy;
|
CHyprSignalListener destroy;
|
||||||
CHyprSignalListener surfaceUnmap;
|
CHyprSignalListener surfaceUnmap;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
#include "InputManager.hpp"
|
#include "InputManager.hpp"
|
||||||
#include "../../Compositor.hpp"
|
#include "../../Compositor.hpp"
|
||||||
#include "../../config/ConfigValue.hpp"
|
#include "../../config/ConfigValue.hpp"
|
||||||
|
#include "../../protocols/IdleNotify.hpp"
|
||||||
#include "../../devices/ITouch.hpp"
|
#include "../../devices/ITouch.hpp"
|
||||||
#include "../SeatManager.hpp"
|
#include "../SeatManager.hpp"
|
||||||
|
|
||||||
@@ -77,6 +78,8 @@ void CInputManager::onTouchDown(ITouch::SDownEvent e) {
|
|||||||
return; // oops, nothing found.
|
return; // oops, nothing found.
|
||||||
|
|
||||||
g_pSeatManager->sendTouchDown(m_sTouchData.touchFocusSurface.lock(), e.timeMs, e.touchID, local);
|
g_pSeatManager->sendTouchDown(m_sTouchData.touchFocusSurface.lock(), e.timeMs, e.touchID, local);
|
||||||
|
|
||||||
|
PROTO::idle->onActivity();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CInputManager::onTouchUp(ITouch::SUpEvent e) {
|
void CInputManager::onTouchUp(ITouch::SUpEvent e) {
|
||||||
|
@@ -1,14 +1,12 @@
|
|||||||
globber = run_command('sh', '-c', 'find . -name "*.cpp" | sort', check: true)
|
globber = run_command('sh', '-c', 'find . -name "*.cpp" | sort', check: true)
|
||||||
src = globber.stdout().strip().split('\n')
|
src = globber.stdout().strip().split('\n')
|
||||||
|
|
||||||
executable(
|
executable('Hyprland', src,
|
||||||
'Hyprland',
|
|
||||||
src,
|
|
||||||
link_args: '-rdynamic',
|
link_args: '-rdynamic',
|
||||||
cpp_pch: 'pch/pch.hpp',
|
cpp_pch: 'pch/pch.hpp',
|
||||||
dependencies: [
|
dependencies: [
|
||||||
server_protos,
|
server_protos,
|
||||||
aquamarine,
|
dependency('aquamarine'),
|
||||||
dependency('gbm'),
|
dependency('gbm'),
|
||||||
dependency('xcursor'),
|
dependency('xcursor'),
|
||||||
dependency('wayland-server'),
|
dependency('wayland-server'),
|
||||||
@@ -40,5 +38,5 @@ executable(
|
|||||||
dependency('pangocairo'),
|
dependency('pangocairo'),
|
||||||
dependency('uuid'),
|
dependency('uuid'),
|
||||||
],
|
],
|
||||||
install: true,
|
install : true
|
||||||
)
|
)
|
||||||
|
@@ -81,7 +81,7 @@ CFunctionHook::SAssembly CFunctionHook::fixInstructionProbeRIPCalls(const SInstr
|
|||||||
std::vector<char> finalBytes;
|
std::vector<char> finalBytes;
|
||||||
finalBytes.resize(probe.len);
|
finalBytes.resize(probe.len);
|
||||||
|
|
||||||
for (auto const& len : probe.insSizes) {
|
for (auto& len : probe.insSizes) {
|
||||||
|
|
||||||
// copy original bytes to our finalBytes
|
// copy original bytes to our finalBytes
|
||||||
for (size_t i = 0; i < len; ++i) {
|
for (size_t i = 0; i < len; ++i) {
|
||||||
|
@@ -124,8 +124,8 @@ APICALL bool HyprlandAPI::removeWindowDecoration(HANDLE handle, IHyprWindowDecor
|
|||||||
if (!PLUGIN)
|
if (!PLUGIN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
for (auto const& d : w->m_dWindowDecorations) {
|
for (auto& d : w->m_dWindowDecorations) {
|
||||||
if (d.get() == pDecoration) {
|
if (d.get() == pDecoration) {
|
||||||
w->removeWindowDeco(pDecoration);
|
w->removeWindowDeco(pDecoration);
|
||||||
return true;
|
return true;
|
||||||
|
@@ -98,27 +98,27 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
|
|||||||
exitFunc();
|
exitFunc();
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& [k, v] : plugin->registeredCallbacks) {
|
for (auto& [k, v] : plugin->registeredCallbacks) {
|
||||||
if (const auto SHP = v.lock())
|
if (const auto SHP = v.lock())
|
||||||
g_pHookSystem->unhook(SHP);
|
g_pHookSystem->unhook(SHP);
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto ls = plugin->registeredLayouts;
|
const auto ls = plugin->registeredLayouts;
|
||||||
for (auto const& l : ls)
|
for (auto& l : ls)
|
||||||
g_pLayoutManager->removeLayout(l);
|
g_pLayoutManager->removeLayout(l);
|
||||||
|
|
||||||
g_pFunctionHookSystem->removeAllHooksFrom(plugin->m_pHandle);
|
g_pFunctionHookSystem->removeAllHooksFrom(plugin->m_pHandle);
|
||||||
|
|
||||||
const auto rd = plugin->registeredDecorations;
|
const auto rd = plugin->registeredDecorations;
|
||||||
for (auto const& d : rd)
|
for (auto& d : rd)
|
||||||
HyprlandAPI::removeWindowDecoration(plugin->m_pHandle, d);
|
HyprlandAPI::removeWindowDecoration(plugin->m_pHandle, d);
|
||||||
|
|
||||||
const auto rdi = plugin->registeredDispatchers;
|
const auto rdi = plugin->registeredDispatchers;
|
||||||
for (auto const& d : rdi)
|
for (auto& d : rdi)
|
||||||
HyprlandAPI::removeDispatcher(plugin->m_pHandle, d);
|
HyprlandAPI::removeDispatcher(plugin->m_pHandle, d);
|
||||||
|
|
||||||
const auto rhc = plugin->registeredHyprctlCommands;
|
const auto rhc = plugin->registeredHyprctlCommands;
|
||||||
for (auto const& c : rhc)
|
for (auto& c : rhc)
|
||||||
HyprlandAPI::unregisterHyprCtlCommand(plugin->m_pHandle, c);
|
HyprlandAPI::unregisterHyprCtlCommand(plugin->m_pHandle, c);
|
||||||
|
|
||||||
g_pConfigManager->removePluginConfig(plugin->m_pHandle);
|
g_pConfigManager->removePluginConfig(plugin->m_pHandle);
|
||||||
@@ -139,7 +139,7 @@ void CPluginSystem::unloadPlugin(const CPlugin* plugin, bool eject) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CPluginSystem::unloadAllPlugins() {
|
void CPluginSystem::unloadAllPlugins() {
|
||||||
for (auto const& p : m_vLoadedPlugins | std::views::reverse)
|
for (auto& p : m_vLoadedPlugins | std::views::reverse)
|
||||||
unloadPlugin(p.get(), false); // Unload remaining plugins gracefully
|
unloadPlugin(p.get(), false); // Unload remaining plugins gracefully
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
|
|||||||
std::vector<std::string> failures;
|
std::vector<std::string> failures;
|
||||||
|
|
||||||
// unload all plugins that are no longer present
|
// unload all plugins that are no longer present
|
||||||
for (auto const& p : m_vLoadedPlugins | std::views::reverse) {
|
for (auto& p : m_vLoadedPlugins | std::views::reverse) {
|
||||||
if (p->m_bLoadedWithConfig && std::find(plugins.begin(), plugins.end(), p->path) == plugins.end()) {
|
if (p->m_bLoadedWithConfig && std::find(plugins.begin(), plugins.end(), p->path) == plugins.end()) {
|
||||||
Debug::log(LOG, "Unloading plugin {} which is no longer present in config", p->path);
|
Debug::log(LOG, "Unloading plugin {} which is no longer present in config", p->path);
|
||||||
unloadPlugin(p.get(), false);
|
unloadPlugin(p.get(), false);
|
||||||
@@ -156,7 +156,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
|
|||||||
}
|
}
|
||||||
|
|
||||||
// load all new plugins
|
// load all new plugins
|
||||||
for (auto const& path : plugins) {
|
for (auto& path : plugins) {
|
||||||
if (std::find_if(m_vLoadedPlugins.begin(), m_vLoadedPlugins.end(), [&](const auto& other) { return other->path == path; }) == m_vLoadedPlugins.end()) {
|
if (std::find_if(m_vLoadedPlugins.begin(), m_vLoadedPlugins.end(), [&](const auto& other) { return other->path == path; }) == m_vLoadedPlugins.end()) {
|
||||||
Debug::log(LOG, "Loading plugin {} which is now present in config", path);
|
Debug::log(LOG, "Loading plugin {} which is now present in config", path);
|
||||||
const auto plugin = loadPlugin(path);
|
const auto plugin = loadPlugin(path);
|
||||||
@@ -173,7 +173,7 @@ std::vector<std::string> CPluginSystem::updateConfigPlugins(const std::vector<st
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPlugin* CPluginSystem::getPluginByPath(const std::string& path) {
|
CPlugin* CPluginSystem::getPluginByPath(const std::string& path) {
|
||||||
for (auto const& p : m_vLoadedPlugins) {
|
for (auto& p : m_vLoadedPlugins) {
|
||||||
if (p->path == path)
|
if (p->path == path)
|
||||||
return p.get();
|
return p.get();
|
||||||
}
|
}
|
||||||
@@ -182,7 +182,7 @@ CPlugin* CPluginSystem::getPluginByPath(const std::string& path) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CPlugin* CPluginSystem::getPluginByHandle(HANDLE handle) {
|
CPlugin* CPluginSystem::getPluginByHandle(HANDLE handle) {
|
||||||
for (auto const& p : m_vLoadedPlugins) {
|
for (auto& p : m_vLoadedPlugins) {
|
||||||
if (p->m_pHandle == handle)
|
if (p->m_pHandle == handle)
|
||||||
return p.get();
|
return p.get();
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,7 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||||||
parent = request->parent;
|
parent = request->parent;
|
||||||
requested = request->requested;
|
requested = request->requested;
|
||||||
|
|
||||||
for (auto const& m : requested) {
|
for (auto& m : requested) {
|
||||||
if (!m->monitor || m->monitor->isBeingLeased) {
|
if (!m->monitor || m->monitor->isBeingLeased) {
|
||||||
LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null"));
|
LOGM(ERR, "Rejecting lease: no monitor or monitor is being leased for {}", (m->monitor ? m->monitor->szName : "null"));
|
||||||
resource->sendFinished();
|
resource->sendFinished();
|
||||||
@@ -26,14 +26,14 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||||||
|
|
||||||
LOGM(LOG, "Leasing outputs: {}", [this]() {
|
LOGM(LOG, "Leasing outputs: {}", [this]() {
|
||||||
std::string roll;
|
std::string roll;
|
||||||
for (auto const& o : requested) {
|
for (auto& o : requested) {
|
||||||
roll += std::format("{} ", o->monitor->szName);
|
roll += std::format("{} ", o->monitor->szName);
|
||||||
}
|
}
|
||||||
return roll;
|
return roll;
|
||||||
}());
|
}());
|
||||||
|
|
||||||
std::vector<SP<Aquamarine::IOutput>> outputs;
|
std::vector<SP<Aquamarine::IOutput>> outputs;
|
||||||
for (auto const& m : requested) {
|
for (auto& m : requested) {
|
||||||
outputs.emplace_back(m->monitor->output);
|
outputs.emplace_back(m->monitor->output);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -50,12 +50,12 @@ CDRMLeaseResource::CDRMLeaseResource(SP<CWpDrmLeaseV1> resource_, SP<CDRMLeaseRe
|
|||||||
|
|
||||||
lease = aqlease;
|
lease = aqlease;
|
||||||
|
|
||||||
for (auto const& m : requested) {
|
for (auto& m : requested) {
|
||||||
m->monitor->isBeingLeased = true;
|
m->monitor->isBeingLeased = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
listeners.destroyLease = lease->events.destroy.registerListener([this](std::any d) {
|
listeners.destroyLease = lease->events.destroy.registerListener([this](std::any d) {
|
||||||
for (auto const& m : requested) {
|
for (auto& m : requested) {
|
||||||
if (m && m->monitor)
|
if (m && m->monitor)
|
||||||
m->monitor->isBeingLeased = false;
|
m->monitor->isBeingLeased = false;
|
||||||
}
|
}
|
||||||
@@ -184,7 +184,7 @@ CDRMLeaseDeviceResource::CDRMLeaseDeviceResource(SP<CWpDrmLeaseDeviceV1> resourc
|
|||||||
resource->sendDrmFd(fd);
|
resource->sendDrmFd(fd);
|
||||||
close(fd);
|
close(fd);
|
||||||
|
|
||||||
for (auto const& m : PROTO::lease->primaryDevice->offeredOutputs) {
|
for (auto& m : PROTO::lease->primaryDevice->offeredOutputs) {
|
||||||
sendConnector(m.lock());
|
sendConnector(m.lock());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -234,7 +234,7 @@ CDRMLeaseDevice::CDRMLeaseDevice(SP<Aquamarine::CDRMBackend> drmBackend) : backe
|
|||||||
}
|
}
|
||||||
|
|
||||||
CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CDRMLeaseProtocol::CDRMLeaseProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
for (auto const& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
for (auto& b : g_pCompositor->m_pAqBackend->getImplementations()) {
|
||||||
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
if (b->type() != Aquamarine::AQ_BACKEND_DRM)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ void CDRMLeaseProtocol::offer(SP<CMonitor> monitor) {
|
|||||||
|
|
||||||
primaryDevice->offeredOutputs.emplace_back(monitor);
|
primaryDevice->offeredOutputs.emplace_back(monitor);
|
||||||
|
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->sendConnector(monitor);
|
m->sendConnector(monitor);
|
||||||
m->resource->sendDone();
|
m->resource->sendDone();
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ void CWLRDataOffer::sendData() {
|
|||||||
if (!source)
|
if (!source)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (auto const& m : source->mimes()) {
|
for (auto& m : source->mimes()) {
|
||||||
resource->sendOffer(m.c_str());
|
resource->sendOffer(m.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,7 +133,7 @@ CWLRDataDevice::CWLRDataDevice(SP<CZwlrDataControlDeviceV1> resource_) : resourc
|
|||||||
auto source = sourceR ? CWLRDataSource::fromResource(sourceR) : CSharedPointer<CWLRDataSource>{};
|
auto source = sourceR ? CWLRDataSource::fromResource(sourceR) : CSharedPointer<CWLRDataSource>{};
|
||||||
if (!source) {
|
if (!source) {
|
||||||
LOGM(LOG, "wlr reset primary selection received");
|
LOGM(LOG, "wlr reset primary selection received");
|
||||||
g_pSeatManager->setCurrentPrimarySelection(nullptr);
|
g_pSeatManager->setCurrentSelection(nullptr);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,7 +191,7 @@ CWLRDataControlManagerResource::CWLRDataControlManagerResource(SP<CZwlrDataContr
|
|||||||
RESOURCE->self = RESOURCE;
|
RESOURCE->self = RESOURCE;
|
||||||
device = RESOURCE;
|
device = RESOURCE;
|
||||||
|
|
||||||
for (auto const& s : sources) {
|
for (auto& s : sources) {
|
||||||
if (!s)
|
if (!s)
|
||||||
continue;
|
continue;
|
||||||
s->device = RESOURCE;
|
s->device = RESOURCE;
|
||||||
@@ -291,7 +291,7 @@ void CDataDeviceWLRProtocol::sendSelectionToDevice(SP<CWLRDataDevice> dev, SP<ID
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary) {
|
void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary) {
|
||||||
for (auto const& o : m_vOffers) {
|
for (auto& o : m_vOffers) {
|
||||||
if (o->source && o->source->hasDnd())
|
if (o->source && o->source->hasDnd())
|
||||||
continue;
|
continue;
|
||||||
if (o->primary != primary)
|
if (o->primary != primary)
|
||||||
@@ -302,7 +302,7 @@ void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary)
|
|||||||
if (!source) {
|
if (!source) {
|
||||||
LOGM(LOG, "resetting {}selection", primary ? "primary " : " ");
|
LOGM(LOG, "resetting {}selection", primary ? "primary " : " ");
|
||||||
|
|
||||||
for (auto const& d : m_vDevices) {
|
for (auto& d : m_vDevices) {
|
||||||
sendSelectionToDevice(d, nullptr, primary);
|
sendSelectionToDevice(d, nullptr, primary);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -311,7 +311,7 @@ void CDataDeviceWLRProtocol::setSelection(SP<IDataSource> source, bool primary)
|
|||||||
|
|
||||||
LOGM(LOG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get());
|
LOGM(LOG, "New {}selection for data source {:x}", primary ? "primary" : "", (uintptr_t)source.get());
|
||||||
|
|
||||||
for (auto const& d : m_vDevices) {
|
for (auto& d : m_vDevices) {
|
||||||
sendSelectionToDevice(d, source, primary);
|
sendSelectionToDevice(d, source, primary);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -103,7 +103,7 @@ void CFocusGrab::refocusKeyboard() {
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
SP<CWLSurfaceResource> surface = nullptr;
|
SP<CWLSurfaceResource> surface = nullptr;
|
||||||
for (auto const& [surf, state] : m_mSurfaces) {
|
for (auto& [surf, state] : m_mSurfaces) {
|
||||||
if (state->state == CFocusGrabSurfaceState::Comitted) {
|
if (state->state == CFocusGrabSurfaceState::Comitted) {
|
||||||
surface = surf.lock();
|
surface = surf.lock();
|
||||||
break;
|
break;
|
||||||
|
@@ -30,7 +30,7 @@ CForeignToplevelList::CForeignToplevelList(SP<CExtForeignToplevelListV1> resourc
|
|||||||
LOGM(LOG, "CForeignToplevelList: finished");
|
LOGM(LOG, "CForeignToplevelList: finished");
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -112,19 +112,19 @@ bool CForeignToplevelList::good() {
|
|||||||
|
|
||||||
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CForeignToplevelProtocol::CForeignToplevelProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onMap(std::any_cast<PHLWINDOW>(data));
|
m->onMap(std::any_cast<PHLWINDOW>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onUnmap(std::any_cast<PHLWINDOW>(data));
|
m->onUnmap(std::any_cast<PHLWINDOW>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onTitle(std::any_cast<PHLWINDOW>(data));
|
m->onTitle(std::any_cast<PHLWINDOW>(data));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@@ -179,7 +179,7 @@ CForeignToplevelWlrManager::CForeignToplevelWlrManager(SP<CZwlrForeignToplevelMa
|
|||||||
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this);
|
PROTO::foreignToplevelWlr->onManagerResourceDestroy(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
for (auto const& w : g_pCompositor->m_vWindows) {
|
for (auto& w : g_pCompositor->m_vWindows) {
|
||||||
if (!w->m_bIsMapped || w->m_bFadingOut)
|
if (!w->m_bIsMapped || w->m_bFadingOut)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -313,42 +313,42 @@ bool CForeignToplevelWlrManager::good() {
|
|||||||
CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CForeignToplevelWlrProtocol::CForeignToplevelWlrProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P = g_pHookSystem->hookDynamic("openWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onMap(PWINDOW);
|
m->onMap(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P1 = g_pHookSystem->hookDynamic("closeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onUnmap(PWINDOW);
|
m->onUnmap(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P2 = g_pHookSystem->hookDynamic("windowTitle", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onTitle(PWINDOW);
|
m->onTitle(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P3 = g_pHookSystem->hookDynamic("activeWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onNewFocus(PWINDOW);
|
m->onNewFocus(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P4 = g_pHookSystem->hookDynamic("moveWindow", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0));
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(std::any_cast<std::vector<std::any>>(data).at(0));
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onMoveMonitor(PWINDOW);
|
m->onMoveMonitor(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
|
static auto P5 = g_pHookSystem->hookDynamic("fullscreen", [this](void* self, SCallbackInfo& info, std::any data) {
|
||||||
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
const auto PWINDOW = std::any_cast<PHLWINDOW>(data);
|
||||||
for (auto const& m : m_vManagers) {
|
for (auto& m : m_vManagers) {
|
||||||
m->onFullscreen(PWINDOW);
|
m->onFullscreen(PWINDOW);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -374,7 +374,7 @@ void CForeignToplevelWlrProtocol::destroyHandle(CForeignToplevelHandleWlr* handl
|
|||||||
}
|
}
|
||||||
|
|
||||||
PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
|
PHLWINDOW CForeignToplevelWlrProtocol::windowFromHandleResource(wl_resource* res) {
|
||||||
for (auto const& h : m_vHandles) {
|
for (auto& h : m_vHandles) {
|
||||||
if (h->res() != res)
|
if (h->res() != res)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@@ -24,7 +24,7 @@ void CFractionalScaleProtocol::onManagerResourceDestroy(wl_resource* res) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) {
|
void CFractionalScaleProtocol::onGetFractionalScale(CWpFractionalScaleManagerV1* pMgr, uint32_t id, SP<CWLSurfaceResource> surface) {
|
||||||
for (auto const& [k, v] : m_mAddons) {
|
for (auto& [k, v] : m_mAddons) {
|
||||||
if (k == surface) {
|
if (k == surface) {
|
||||||
LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get());
|
LOGM(ERR, "Surface {:x} already has a fractionalScale addon", (uintptr_t)surface.get());
|
||||||
pMgr->error(WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists");
|
pMgr->error(WP_FRACTIONAL_SCALE_MANAGER_V1_ERROR_FRACTIONAL_SCALE_EXISTS, "Fractional scale already exists");
|
||||||
|
@@ -17,15 +17,15 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
pMonitor = OUTPUTRES->monitor;
|
pMonitor = OUTPUTRES->monitor.get();
|
||||||
|
|
||||||
if (!pMonitor || !pMonitor->output) {
|
if (!pMonitor) {
|
||||||
LOGM(ERR, "No CMonitor");
|
LOGM(ERR, "No CMonitor");
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (auto const& g : PROTO::gamma->m_vGammaControllers) {
|
for (auto& g : PROTO::gamma->m_vGammaControllers) {
|
||||||
if (g->pMonitor == pMonitor) {
|
if (g->pMonitor == pMonitor) {
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
return;
|
return;
|
||||||
@@ -103,7 +103,7 @@ CGammaControl::CGammaControl(SP<CZwlrGammaControlV1> resource_, wl_resource* out
|
|||||||
resource->sendGammaSize(gammaSize);
|
resource->sendGammaSize(gammaSize);
|
||||||
|
|
||||||
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
listeners.monitorDestroy = pMonitor->events.destroy.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
||||||
listeners.monitorDisconnect = pMonitor->events.disconnect.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
listeners.monitorDisconnect = pMonitor->events.destroy.registerListener([this](std::any) { this->onMonitorDestroy(); });
|
||||||
}
|
}
|
||||||
|
|
||||||
CGammaControl::~CGammaControl() {
|
CGammaControl::~CGammaControl() {
|
||||||
@@ -119,7 +119,7 @@ bool CGammaControl::good() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CGammaControl::applyToMonitor() {
|
void CGammaControl::applyToMonitor() {
|
||||||
if (!pMonitor || !pMonitor->output)
|
if (!pMonitor)
|
||||||
return; // ??
|
return; // ??
|
||||||
|
|
||||||
LOGM(LOG, "setting to monitor {}", pMonitor->szName);
|
LOGM(LOG, "setting to monitor {}", pMonitor->szName);
|
||||||
@@ -136,16 +136,16 @@ void CGammaControl::applyToMonitor() {
|
|||||||
pMonitor->output->state->setGammaLut({});
|
pMonitor->output->state->setGammaLut({});
|
||||||
}
|
}
|
||||||
|
|
||||||
g_pHyprRenderer->damageMonitor(pMonitor.get());
|
g_pHyprRenderer->damageMonitor(pMonitor);
|
||||||
}
|
}
|
||||||
|
|
||||||
CMonitor* CGammaControl::getMonitor() {
|
CMonitor* CGammaControl::getMonitor() {
|
||||||
return pMonitor ? pMonitor.get() : nullptr;
|
return pMonitor;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CGammaControl::onMonitorDestroy() {
|
void CGammaControl::onMonitorDestroy() {
|
||||||
LOGM(LOG, "Destroying gamma control for {}", pMonitor->szName);
|
|
||||||
resource->sendFailed();
|
resource->sendFailed();
|
||||||
|
pMonitor = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CGammaControlProtocol::CGammaControlProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
CGammaControlProtocol::CGammaControlProtocol(const wl_interface* iface, const int& ver, const std::string& name) : IWaylandProtocol(iface, ver, name) {
|
||||||
@@ -180,7 +180,7 @@ void CGammaControlProtocol::onGetGammaControl(CZwlrGammaControlManagerV1* pMgr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) {
|
void CGammaControlProtocol::applyGammaToState(CMonitor* pMonitor) {
|
||||||
for (auto const& g : m_vGammaControllers) {
|
for (auto& g : m_vGammaControllers) {
|
||||||
if (g->getMonitor() != pMonitor)
|
if (g->getMonitor() != pMonitor)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|