redo debian packaging

This commit is contained in:
Penelope Gwen 2024-06-15 15:14:44 -06:00
parent da559b3ea1
commit 6dfcc056b3
182 changed files with 12960 additions and 0 deletions

84
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,84 @@
# Is performed before the scripts in the stages step
before_script:
- source /etc/profile
# Defines stages which are to be executed
stages:
- build
- upload
- release
.setup_script: &setup_scripts
- apt-get update
- apt-get -y build-dep .
- apt-get -y install hwdata libpixman-1-dev libdrm-dev libegl-dev libgles2-mesa-dev libegl1-mesa-dev dpkg-dev xwayland
- mkdir -p subprojects/scenefx
- wget -qO- 'https://github.com/wlrfx/scenefx/archive/refs/tags/0.1.tar.gz' | tar -xz --strip-components=1 -C subprojects/scenefx
- mkdir -p subprojects/scenefx/subprojects/wlroots
- wget -qO- 'https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/0.17.3/downloads/wlroots-0.17.3.tar.gz' | tar -xz --strip-components=1 -C subprojects/scenefx/subprojects/wlroots
- sed -i 's/werror=true/werror=false/' meson.build
.compile: &compile
stage: compile
only:
- tags
script:
- *setup_scripts
- ls
- dpkg-buildpackage -b
- mkdir -p ./build/{release,debug}
- find ../ -name "*.deb" -not -name "*dbgsym*" -exec mv {} ./build/release/ \;
- find ../ -name "*dbgsym*.deb" -exec mv {} ./build/debug/ \;
artifacts:
paths:
- build/release/*
- build/debug/*
untracked: true
build:x86_64:
<<: *compile
stage: build
tags:
- x86_64
build:aarch64:
<<: *compile
stage: build
tags:
- aarch64
upload:
stage: upload
dependencies:
- build:x86_64
- build:aarch64
only:
- tags
script:
- find ./build/release -name "*.deb"
- debs=( $( find ./build/release -name "*.deb" ) )
- assets=""
- for d in ${debs[@]};do
- file=$( basename ${d} )
- url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/swayfx/${CI_COMMIT_TAG}/${file}"
- assets="${assets} --assets-link {\"name\":\"${file}\",\"url\":\"${url}\",\"link_type\":\"other\"} "
- "curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"${d}\" \"${url}\""
- done
- echo "ASSETS_ARG=${assets}" >> assets.env
artifacts:
reports:
dotenv: assets.env
tags:
- x86_64
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- tags
script:
- echo "making release!"
- echo ${ASSETS_ARG}
- release-cli create --name "Release ${CI_COMMIT_TAG}" --tag-name "${CI_COMMIT_TAG}" ${ASSETS_ARG}
tags:
- x86_64

View file

@ -0,0 +1,11 @@
swayfx (0.4-1) unstable; urgency=medium
* new upstream release
-- Penelope Gwen <support@pogmom.me> Wed, 22 May 2024 17:24:28 -0600
swayfx (0.3.2-1) unstable; urgency=medium
* Compiled deb from upstream source
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

View file

@ -0,0 +1,2 @@
# Triggers added by dh_makeshlibs/13.15.3
activate-noawait ldconfig

1
debian/.pc/.quilt_patches vendored Normal file
View file

@ -0,0 +1 @@
patches

1
debian/.pc/.quilt_series vendored Normal file
View file

@ -0,0 +1 @@
series

1
debian/.pc/.version vendored Normal file
View file

@ -0,0 +1 @@
2

6
debian/README.Debian vendored Normal file
View file

@ -0,0 +1,6 @@
swayfx for Debian
----------------
<Possible notes regarding this package - if none, delete this file.>
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

10
debian/README.source vendored Normal file
View file

@ -0,0 +1,10 @@
swayfx for Debian
----------------
<This file describes information about the source package, see Debian policy
manual section 4.14. You WILL either need to modify or delete this file.>
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

17
debian/changelog vendored Normal file
View file

@ -0,0 +1,17 @@
swayfx (0.4-2) unstable; urgency=medium
* built on cleaner source
-- Penelope Gwen <support@pogmom.me> Sat, 15 Jun 2024 15:13:48 -0600
swayfx (0.4-1) unstable; urgency=medium
* new upstream release
-- Penelope Gwen <support@pogmom.me> Wed, 22 May 2024 17:24:28 -0600
swayfx (0.3.2-1) unstable; urgency=medium
* Compiled deb from upstream source
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

9
debian/config.d/50-systemd-user.conf vendored Normal file
View file

@ -0,0 +1,9 @@
# import variables into system-user enviroment
# based on the instructions in the sway wiki
# see also https://github.com/swaywm/sway/issues/5732
# and https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

43
debian/control vendored Normal file
View file

@ -0,0 +1,43 @@
Source: swayfx
Section: x11
Priority: optional
Maintainer: Penelope Gwen <support@pogmom.me>
Build-Depends: debhelper-compat (= 13),
libcairo2-dev,
libcap-dev,
libdbus-1-dev (>= 1.10),
libevdev-dev,
libgdk-pixbuf-2.0-dev,
libinput-dev (>= 1.21.0),
libjson-c-dev (>= 0.13),
libpam0g-dev,
libpango1.0-dev,
libpcre2-dev,
libpixman-1-dev,
libseat-dev,
libsystemd-dev (>= 239) | libelogind-dev (>= 239),
libwayland-dev (>= 1.21.0),
libwayland-egl1,
libwlroots-dev (>= 0.17.0),
libxkbcommon-dev,
meson (>=0.60),
pkgconf,
scdoc (>= 1.9.2),
tree,
wayland-protocols (>= 1.24)
Standards-Version: 4.6.2
Homepage: https://github.com/WillPower3309/swayfx
Rules-Requires-Root: no
Package: swayfx
Architecture: any
Depends: libgl1-mesa-dri, swaybg, polkitd, ${misc:Depends}, ${shlibs:Depends}
Recommends: wmenu, foot
Suggests: swayidle, swaylock, xdg-desktop-portal-wlr, xdg-desktop-portal-gtk
Provides: sway, sway-backgrounds
Description: Sway, but with eye candy!
Sway is an incredible window manager, and certainly one of the most well
established wayland window managers. However, it is restricted to only
include the functionality that existed in i3. This fork ditches the simple
wlr_renderer, and replaces it with our fx_renderer, capable of rendering
with fancy GLES2 effects.

84
debian/copyright vendored Normal file
View file

@ -0,0 +1,84 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/swaywm/sway
Upstream-Name: sway
Files: *
Copyright: © 2016-2018 Drew DeVault <sir@cmpwn.com>
License: Expat
Files: protocols/wlr-layer-shell-unstable-v1.xml
Copyright: © 2017 Drew DeVault
License: MIT-like
Files: protocols/wlr-input-inhibitor-unstable-v1.xml
Copyright: © 2018 Drew DeVault
License: MIT-like
Files: protocols/idle.xml
Copyright: (C) 2015 Martin Gräßlin
License: LGPL-2.1+
Files: protocols/wlr-output-power-management-unstable-v1.xml
Copyright: (C) 2019 Purism SPC
License: Expat
Files: debian/*
Copyright: © 2018 Nicolas Braud-Santoni <nicolas@braud-santoni.eu>
© 2018-2024 Birger Schacht <birger@debian.org>
License: Expat
License: LGPL-2.1+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU Lesser General Public
License version 2.1 can be found in /usr/share/common-licenses/LGPL-2.1.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
License: MIT-like
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that the
above copyright notice appear in all copies and that both that copyright notice
and this permission notice appear in supporting documentation, and that the
name of the copyright holders not be used in advertising or publicity
pertaining to distribution of the software without specific, written prior
permission. The copyright holders make no representations about the suitability
of this software for any purpose. It is provided "as is" without express or
implied warranty.
.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

1
debian/debhelper-build-stamp vendored Normal file
View file

@ -0,0 +1 @@
swayfx

2
debian/files vendored Normal file
View file

@ -0,0 +1,2 @@
swayfx_0.4-1_amd64.buildinfo x11 optional
swayfx_0.4-1_amd64.deb x11 optional

3
debian/gbp.conf vendored Normal file
View file

@ -0,0 +1,3 @@
[DEFAULT]
pristine-tar = True
debian-branch = debian/sid

8
debian/gitlab-ci.yml vendored Normal file
View file

@ -0,0 +1,8 @@
---
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml
variables:
# For Salsa CI to also extract the upstream tarball when using the
# export-dir option, gbp buildpackage needs the --git-overlay option set.
SALSA_CI_GBP_BUILDPACKAGE_ARGS: "--git-overlay"

30
debian/rules vendored Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/make -f
# -*- makefile -*-
export DH_VERBOSE=1
export DH_OPTIONS=-v
include /usr/share/dpkg/pkg-info.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wno-error=deprecated-declarations
export DEB_BUILD_OPTIONS=noautodbgsym
%:
dh $@
.PHONY: override_dh_auto_configure
override_dh_auto_configure:
dh_auto_configure -- --libexecdir=lib
.PHONY: override_dh_missing
override_dh_missing:
dh_missing --fail-missing
.PHONY: override_dh_install
override_dh_install:
if ! dh_install; then \
tree debian; \
exit 1; \
fi

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (quilt)

4
debian/source/include-binaries vendored Normal file
View file

@ -0,0 +1,4 @@
orig/swayfx_0.4.orig.tar.gz
swayfx-build-deps_0.3.2-1_all.deb
assets/swayfx_mascot.png
assets/swayfx_screenshot.jpg

View file

@ -0,0 +1,84 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/swaywm/sway
Upstream-Name: sway
Files: *
Copyright: © 2016-2018 Drew DeVault <sir@cmpwn.com>
License: Expat
Files: protocols/wlr-layer-shell-unstable-v1.xml
Copyright: © 2017 Drew DeVault
License: MIT-like
Files: protocols/wlr-input-inhibitor-unstable-v1.xml
Copyright: © 2018 Drew DeVault
License: MIT-like
Files: protocols/idle.xml
Copyright: (C) 2015 Martin Gräßlin
License: LGPL-2.1+
Files: protocols/wlr-output-power-management-unstable-v1.xml
Copyright: (C) 2019 Purism SPC
License: Expat
Files: debian/*
Copyright: © 2018 Nicolas Braud-Santoni <nicolas@braud-santoni.eu>
© 2018-2024 Birger Schacht <birger@debian.org>
License: Expat
License: LGPL-2.1+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU Lesser General Public
License version 2.1 can be found in /usr/share/common-licenses/LGPL-2.1.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
License: MIT-like
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that the
above copyright notice appear in all copies and that both that copyright notice
and this permission notice appear in supporting documentation, and that the
name of the copyright holders not be used in advertising or publicity
pertaining to distribution of the software without specific, written prior
permission. The copyright holders make no representations about the suitability
of this software for any purpose. It is provided "as is" without express or
implied warranty.
.
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.

2
debian/sway-portals.conf vendored Normal file
View file

@ -0,0 +1,2 @@
[preferred]
default=wlr;gtk;

1
debian/sway.maintscript vendored Normal file
View file

@ -0,0 +1 @@
rm_conffile /etc/sway/config-vars.d/00-set-term-foot.conf 1.5-7~

2
debian/swayfx-docs.docs vendored Normal file
View file

@ -0,0 +1,2 @@
README.source
README.Debian

1
debian/swayfx.debhelper.log vendored Normal file
View file

@ -0,0 +1 @@
dh_missing

3
debian/swayfx.substvars vendored Normal file
View file

@ -0,0 +1,3 @@
shlibs:Depends=libc6 (>= 2.34), libcairo2 (>= 1.10.0), libdrm2 (>= 2.4.114), libegl1, libevdev2 (>= 0.9.1), libgbm1 (>= 21.1.0), libgdk-pixbuf-2.0-0 (>= 2.31.1), libgles2, libglib2.0-0t64 (>= 2.12.0), libinput10 (>= 1.21.0), libjson-c5 (>= 0.15), libpango-1.0-0 (>= 1.22.0), libpangocairo-1.0-0 (>= 1.22.0), libpcre2-8-0 (>= 10.22), libpixman-1-0 (>= 0.30.0), libseat1 (>= 0.5.0), libsystemd0 (>= 243), libudev1 (>= 183), libwayland-client0 (>= 1.21.0), libwayland-cursor0 (>= 1.21.0), libwayland-server0 (>= 1.21.0), libxcb-dri3-0 (>= 1.13), libxcb-present0, libxcb-render-util0, libxcb-render0, libxcb-shm0 (>= 1.10), libxcb-xfixes0, libxcb-xinput0 (>= 1.17.0), libxcb1, libxkbcommon0 (>= 0.7.0), swayfx (>= 0.4)
misc:Depends=
misc:Pre-Depends=

1
debian/swayfx/DEBIAN/conffiles vendored Normal file
View file

@ -0,0 +1 @@
/etc/sway/config

18
debian/swayfx/DEBIAN/control vendored Normal file
View file

@ -0,0 +1,18 @@
Package: swayfx
Version: 0.4-1
Architecture: amd64
Maintainer: Penelope Gwen <support@pogmom.me>
Installed-Size: 8901
Depends: libgl1-mesa-dri, swaybg, polkitd, libc6 (>= 2.34), libcairo2 (>= 1.10.0), libdrm2 (>= 2.4.114), libegl1, libevdev2 (>= 0.9.1), libgbm1 (>= 21.1.0), libgdk-pixbuf-2.0-0 (>= 2.31.1), libgles2, libglib2.0-0t64 (>= 2.12.0), libinput10 (>= 1.21.0), libjson-c5 (>= 0.15), libpango-1.0-0 (>= 1.22.0), libpangocairo-1.0-0 (>= 1.22.0), libpcre2-8-0 (>= 10.22), libpixman-1-0 (>= 0.30.0), libseat1 (>= 0.5.0), libsystemd0 (>= 243), libudev1 (>= 183), libwayland-client0 (>= 1.21.0), libwayland-cursor0 (>= 1.21.0), libwayland-server0 (>= 1.21.0), libxcb-dri3-0 (>= 1.13), libxcb-present0, libxcb-render-util0, libxcb-render0, libxcb-shm0 (>= 1.10), libxcb-xfixes0, libxcb-xinput0 (>= 1.17.0), libxcb1, libxkbcommon0 (>= 0.7.0)
Recommends: wmenu, foot
Suggests: swayidle, swaylock, xdg-desktop-portal-wlr, xdg-desktop-portal-gtk
Provides: sway, sway-backgrounds
Section: x11
Priority: optional
Homepage: https://github.com/WillPower3309/swayfx
Description: Sway, but with eye candy!
Sway is an incredible window manager, and certainly one of the most well
established wayland window managers. However, it is restricted to only
include the functionality that existed in i3. This fork ditches the simple
wlr_renderer, and replaces it with our fx_renderer, capable of rendering
with fancy GLES2 effects.

147
debian/swayfx/DEBIAN/md5sums vendored Normal file
View file

@ -0,0 +1,147 @@
f900936cdba8673d37cd3ff3b076fc5a usr/bin/sway
6d67a027ba16b78fcf7c65ffc7f89760 usr/bin/swaybar
f50462c8fb30effabf77ecba29095b34 usr/bin/swaymsg
86ca303e2e323a9d4abafc68854baf13 usr/bin/swaynag
a5c2949866d8a84d5ef95004bddea8eb usr/include/scenefx/render/fx_renderer/fx_effect_framebuffers.h
00b6239aaeabc6cfc61d2a9fa1bf756f usr/include/scenefx/render/fx_renderer/fx_renderer.h
a6168125ba62a570e6a73f02477df74b usr/include/scenefx/render/pass.h
267d019cd6e96aa65cbcb31bfda60d4a usr/include/scenefx/types/fx/blur_data.h
e2d2e65e3e7ff5e9c9316c4cbf6a85a5 usr/include/scenefx/types/fx/shadow_data.h
511e2c9156c7357c0782da78e4c6b9a3 usr/include/scenefx/types/wlr_scene.h
1c8cd922e6a4109f155d6ac04a000a8c usr/include/wlr/backend.h
e3337487372f9565985bb68c46bdd0b4 usr/include/wlr/backend/headless.h
582993959e874fa49136f8bebf543cc8 usr/include/wlr/backend/interface.h
fee46cf211357992e52b9df771c32510 usr/include/wlr/backend/libinput.h
e309b828b5742f2744462b19d1107d51 usr/include/wlr/backend/multi.h
7170932c9b25f2e889274105320b415b usr/include/wlr/backend/session.h
6f73384eb53f32a325b87bec546f54fc usr/include/wlr/backend/wayland.h
bab6e2cb676ed4fddc3836ae19f4e89a usr/include/wlr/backend/x11.h
e98e0931bd6840c7f3e4169910eca408 usr/include/wlr/config.h
85fac333dafdebe3b162ea056aea6eac usr/include/wlr/interfaces/wlr_buffer.h
2557958afd10aba883969eb5c5cb21bc usr/include/wlr/interfaces/wlr_keyboard.h
23e1eb3c71910ef1fcb6423ff31af409 usr/include/wlr/interfaces/wlr_output.h
3ff7921d485a9af675d958bf65a63c5b usr/include/wlr/interfaces/wlr_pointer.h
087cbc20bb7f6e8361ec2c8baed044da usr/include/wlr/interfaces/wlr_switch.h
4025c495222067b449ee090e78d802d6 usr/include/wlr/interfaces/wlr_tablet_pad.h
954d285627aeead6181397304a5d104d usr/include/wlr/interfaces/wlr_tablet_tool.h
c2013f68e64608b3c5a0bb1772ac1596 usr/include/wlr/interfaces/wlr_touch.h
6651cb2f378d9ab80afa8d7ec683b948 usr/include/wlr/render/allocator.h
b9e1c434919fc5a1c90f1d1992858daf usr/include/wlr/render/dmabuf.h
5df0aff8cd561fa0858fe66e1fe442c2 usr/include/wlr/render/drm_format_set.h
5a5c30fc286f3a5822a8217825a85960 usr/include/wlr/render/egl.h
69e72463b3da271dfcba404d642fee34 usr/include/wlr/render/gles2.h
cea4613ed940b8a71c817c6cebec230b usr/include/wlr/render/interface.h
d17f9e8d28bb524247361d7ce68199d4 usr/include/wlr/render/pass.h
45b77e789ca4257e1897eaecb55f874f usr/include/wlr/render/pixman.h
8a33de870595fe1809d49522e37b75cb usr/include/wlr/render/swapchain.h
853160c28c92f064ddeb4c75e9faf066 usr/include/wlr/render/wlr_renderer.h
36c389eeb0c927872918f960f924c30b usr/include/wlr/render/wlr_texture.h
46290d685625a1f746a0e89eb8b98ecb usr/include/wlr/types/wlr_buffer.h
c8ee56f2834ee12954823df1d31733fa usr/include/wlr/types/wlr_compositor.h
50e4d755e25311e7dc83eda98d6689fe usr/include/wlr/types/wlr_content_type_v1.h
49c0256899cff32980e4106b02fab7b5 usr/include/wlr/types/wlr_cursor.h
f1c40237d5feb5e6557c42d2cda533e5 usr/include/wlr/types/wlr_cursor_shape_v1.h
38705531e31d1a3a21bd36d72481ddc6 usr/include/wlr/types/wlr_damage_ring.h
6f93ae80560bc5c0ee423e558cc5a58a usr/include/wlr/types/wlr_data_control_v1.h
972272876d59f2711521f2b8d5e3c38a usr/include/wlr/types/wlr_data_device.h
cf7f3efb564c32bc102bb92d884b5721 usr/include/wlr/types/wlr_drm.h
dd27a4878a56560b81870016d12a3998 usr/include/wlr/types/wlr_export_dmabuf_v1.h
2f968758364413a538c1ae9a8245ef75 usr/include/wlr/types/wlr_foreign_toplevel_management_v1.h
c2fb9323de4c8cb045b4d046f666491a usr/include/wlr/types/wlr_fractional_scale_v1.h
646b7c9fbda45f4ad90ddd3070abba39 usr/include/wlr/types/wlr_fullscreen_shell_v1.h
12890ca476f4471aced0fc430ed062d3 usr/include/wlr/types/wlr_gamma_control_v1.h
68df76555e04d63f60b9b6bfee1a75cf usr/include/wlr/types/wlr_idle_inhibit_v1.h
23a4e2dca2f3c49e8cc754a5a3d16bad usr/include/wlr/types/wlr_idle_notify_v1.h
42aab975aed18c349bb305e8acc5eca7 usr/include/wlr/types/wlr_input_device.h
ec9a533bb078349e46d89da8208aeb67 usr/include/wlr/types/wlr_input_inhibitor.h
e57a2ea535b8db2dc3ea28f84bca636d usr/include/wlr/types/wlr_input_method_v2.h
01d1b680d013827669e313d36179a81b usr/include/wlr/types/wlr_keyboard.h
5d759e6c4ab296c0a9013c184b9274eb usr/include/wlr/types/wlr_keyboard_group.h
afc9b201b3447793011a9b8bbc9254c1 usr/include/wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h
a98ea109711e525c798ce6785896a466 usr/include/wlr/types/wlr_layer_shell_v1.h
57d1131f4aaad669b387b1b82f614fe3 usr/include/wlr/types/wlr_linux_dmabuf_v1.h
b59943e293ac414649a3613863a993a3 usr/include/wlr/types/wlr_matrix.h
416e4c511f1105e876927782a09e6160 usr/include/wlr/types/wlr_output.h
b42df3a558748118690f86a4b481c4c6 usr/include/wlr/types/wlr_output_layer.h
ffb7b61919df73c4c123e76ed5770842 usr/include/wlr/types/wlr_output_layout.h
c50bbd90e792ec59da3450d9a34d3292 usr/include/wlr/types/wlr_output_management_v1.h
fcb2e51efa236cbc19283026e8e94ad1 usr/include/wlr/types/wlr_output_power_management_v1.h
fb896d682971f04e7de57fbebb229ba9 usr/include/wlr/types/wlr_pointer.h
2c7980f95914601e568624e93e9a66a6 usr/include/wlr/types/wlr_pointer_constraints_v1.h
f3649341dc04a140b891a0e16f9d1459 usr/include/wlr/types/wlr_pointer_gestures_v1.h
bf68e0df761702dc2d75685f53c9ba26 usr/include/wlr/types/wlr_presentation_time.h
30321cf8f1ab1119717f1bce1bf3bf47 usr/include/wlr/types/wlr_primary_selection.h
26e927749687fae7b7cc91388574a95c usr/include/wlr/types/wlr_primary_selection_v1.h
08105de06fb80d3cec5c545217554f11 usr/include/wlr/types/wlr_region.h
b056c6b862f968dd7a28bafc6eb73256 usr/include/wlr/types/wlr_relative_pointer_v1.h
181dbea377aa0604b882cafb0ad03d70 usr/include/wlr/types/wlr_scene.h
4f59b33cd41a244c9fda9ace7594047b usr/include/wlr/types/wlr_screencopy_v1.h
e8c2251763b8f53711e82a0567a5d3ac usr/include/wlr/types/wlr_seat.h
4b48eb062125b284f7bcaa81256a0a29 usr/include/wlr/types/wlr_security_context_v1.h
58bba4b315387479a4de58ad82c0dd38 usr/include/wlr/types/wlr_server_decoration.h
d4320f6a4321e505aa029aa0e74fb24d usr/include/wlr/types/wlr_session_lock_v1.h
d9ae7483e1669b1bd5f54b9501f79fa0 usr/include/wlr/types/wlr_shm.h
3365734c728e3e89397b843c7fad75c8 usr/include/wlr/types/wlr_single_pixel_buffer_v1.h
0ca0e6f2277792cd5682e0f66900d550 usr/include/wlr/types/wlr_subcompositor.h
0908a1af93a90b30bba5ef94895a94dd usr/include/wlr/types/wlr_switch.h
bfbac746f841ec8c5e21a26af20362bc usr/include/wlr/types/wlr_tablet_pad.h
aa27e147d37d93f67b7544687d592b1d usr/include/wlr/types/wlr_tablet_tool.h
09513269cfed3ab8681d5d3bee20f713 usr/include/wlr/types/wlr_tablet_v2.h
1a59dbce6bf3e5ab12473b97d1a0b4b6 usr/include/wlr/types/wlr_tearing_control_v1.h
b24483ad1cba9708dd474af92e1cab2f usr/include/wlr/types/wlr_text_input_v3.h
f325682c78898adeb270e80a0e03a654 usr/include/wlr/types/wlr_touch.h
62d7db6f36af8e9f1f684dab1bbe7ac4 usr/include/wlr/types/wlr_viewporter.h
c5ea88ead69cc721afeeeba18e8b8ca3 usr/include/wlr/types/wlr_virtual_keyboard_v1.h
7fbe057cea60cc797960ab10724aaa30 usr/include/wlr/types/wlr_virtual_pointer_v1.h
68f77bc6d15cedd7101c9889e5446846 usr/include/wlr/types/wlr_xcursor_manager.h
60eae1e001e1111563aa65d85df405ed usr/include/wlr/types/wlr_xdg_activation_v1.h
10204fb88c8bba808788d2df84115093 usr/include/wlr/types/wlr_xdg_decoration_v1.h
9ee1f19a22ad1a68470b8140d37b96c8 usr/include/wlr/types/wlr_xdg_foreign_registry.h
3bc22209afdf3af03018f2be793f874a usr/include/wlr/types/wlr_xdg_foreign_v1.h
9156ad616a7a4ce24c49098921d22602 usr/include/wlr/types/wlr_xdg_foreign_v2.h
474196806963f6fcde9c8e311dd52f58 usr/include/wlr/types/wlr_xdg_output_v1.h
a3f01873d478dee5a78d99a11780de9b usr/include/wlr/types/wlr_xdg_shell.h
9b6e8bbe3275facd7da80b7b8a87667e usr/include/wlr/util/addon.h
1bdddf80259e293694735919813c0446 usr/include/wlr/util/box.h
2ed129bc367b6f86583c7f53b5e96c6f usr/include/wlr/util/edges.h
7a0bb50887e4365fc9dbc99b057f59d6 usr/include/wlr/util/log.h
6cfc6de8b712a88c03a575e539ee7000 usr/include/wlr/util/region.h
ff7bb5cea5e93963d540499829d1661a usr/include/wlr/version.h
f21f14eabb22e639b269ecd483ad256c usr/include/wlr/xcursor.h
6ba443c0a12671b1308d28722ea70587 usr/include/wlr/xwayland/server.h
c817173149ed59620fc0716673999805 usr/include/wlr/xwayland/shell.h
b4732e9dd075c064d16e64f5f0097d58 usr/include/wlr/xwayland/xwayland.h
14971f5d85bb4759d1b7d024f8c29afa usr/lib/x86_64-linux-gnu/libscenefx.so.1
c6680d62c73eafb7e0823c6eacbbf6c6 usr/lib/x86_64-linux-gnu/libwlroots.a
ae769e439ee5d0a7a1d092702dc0e381 usr/lib/x86_64-linux-gnu/pkgconfig/scenefx.pc
a41bc372e4be484f4e64ce35b6422b55 usr/lib/x86_64-linux-gnu/pkgconfig/wlroots.pc
3be0a87bfe00ca1e7902da714e8f95bd usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640.png
f8b3491b4939970bf5a99728973a9ddf usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640_Portrait.png
4ad5cfc0b2ecb717b1f7dbd9873278ad usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1366x768.png
2463984942186e737cb918f363eb1e6b usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png
f9653039bcd05e4e5f0a7a63ac314c6e usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536.png
be957992741d9019cb30e9090659a204 usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536_Portrait.png
4571700fe956744f98e2d888e132cea2 usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024.png
8256ef97d85ef6ba41a4f9a0a7e44290 usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024_Portrait.png
e681a38163b5e90ec1506316a2894f90 usr/share/bash-completion/completions/sway
b32efe2e3404af2e85194c51c8c54a1a usr/share/bash-completion/completions/swaybar
3f6671811599c988e77a7e97db33ee3f usr/share/bash-completion/completions/swaymsg
1d175a2504ccc1fc43eb4d9b7b60237f usr/share/doc/swayfx/README.Debian
d5a40d534b537fe3f40e6f15392ee5a7 usr/share/doc/swayfx/changelog.Debian.gz
d4e8b8798ca2a210b5a73903e9979c5d usr/share/doc/swayfx/copyright
8cbbfb9411158150dceae0fe07e1291d usr/share/fish/vendor_completions.d/sway.fish
ff47ad9f196876ef65b74d42e83e1feb usr/share/fish/vendor_completions.d/swaymsg.fish
e7448ff97732388ac543169208c86b84 usr/share/fish/vendor_completions.d/swaynag.fish
ccede143fe69cc8ff2278045653ac5e5 usr/share/man/man1/sway.1.gz
51bbae3d9f1642e2de06b2280786efad usr/share/man/man1/swaymsg.1.gz
0dfb853b2c9e05db2f943575fca93512 usr/share/man/man1/swaynag.1.gz
f79082571fdb6c002b5439486a180724 usr/share/man/man5/sway-bar.5.gz
d21b6bd192389d336ef4d626192fc519 usr/share/man/man5/sway-input.5.gz
cd3907f66c75b958234bcae6ba4776bf usr/share/man/man5/sway-output.5.gz
c6a76f8753ff5da22bf5297cebca3f68 usr/share/man/man5/sway.5.gz
5952c4baf721eeac54efeb0431023e3e usr/share/man/man5/swaynag.5.gz
c953060d762e219d71913458916f7ece usr/share/man/man7/sway-ipc.7.gz
2efa59110947b88011ef5cc1bc996ddd usr/share/man/man7/swaybar-protocol.7.gz
d6798e4415f9e78c1430798cb0c58fc8 usr/share/wayland-sessions/sway.desktop
48c584db21ab33a26bead50f5508e85d usr/share/zsh/site-functions/_sway
834b376980942626ca75f6368f83edd7 usr/share/zsh/site-functions/_swaymsg

1
debian/swayfx/DEBIAN/shlibs vendored Normal file
View file

@ -0,0 +1 @@
libscenefx 1 swayfx (>= 0.4)

2
debian/swayfx/DEBIAN/triggers vendored Normal file
View file

@ -0,0 +1,2 @@
# Triggers added by dh_makeshlibs/13.15.3
activate-noawait ldconfig

240
debian/swayfx/etc/sway/config vendored Normal file
View file

@ -0,0 +1,240 @@
# Default config for sway
#
# Copy this to ~/.config/sway/config and edit it to your liking.
#
# Read `man 5 sway` for a complete reference.
### Variables
#
# Logo key. Use Mod1 for Alt.
set $mod Mod4
# Home row direction keys, like vim
set $left h
set $down j
set $up k
set $right l
# Your preferred terminal emulator
set $term foot
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu dmenu_path | wmenu | xargs swaymsg exec --
### Appearance
# window corner radius in px
corner_radius 10
# Window background blur
blur off
blur_xray off
blur_passes 2
blur_radius 5
shadows off
shadows_on_csd off
shadow_blur_radius 20
shadow_color #0000007F
# inactive window fade amount. 0.0 = no dimming, 1.0 = fully dimmed
default_dim_inactive 0.0
dim_inactive_colors.unfocused #000000FF
dim_inactive_colors.urgent #900000FF
# Move minimized windows into Scratchpad (enable|disable)
scratchpad_minimize disable
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
# Example configuration:
#
# output HDMI-A-1 resolution 1920x1080 position 1920,0
#
# You can get the names of your outputs by running: swaymsg -t get_outputs
### Idle configuration
#
# Example configuration:
#
# exec swayidle -w \
# timeout 300 'swaylock -f -c 000000' \
# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
# before-sleep 'swaylock -f -c 000000'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
# your displays after another 300 seconds, and turn your screens back on when
# resumed. It will also lock your screen before your computer goes to sleep.
### Input configuration
#
# Example configuration:
#
# input "2:14:SynPS/2_Synaptics_TouchPad" {
# dwt enabled
# tap enabled
# natural_scroll enabled
# middle_emulation enabled
# }
#
# You can get the names of your inputs by running: swaymsg -t get_inputs
# Read `man 5 sway-input` for more information about this section.
### Key bindings
#
# Basics:
#
# Start a terminal
bindsym $mod+Return exec $term
# Kill focused window
bindsym $mod+Shift+q kill
# Start your launcher
bindsym $mod+d exec $menu
# Drag floating windows by holding down $mod and left mouse button.
# Resize them with right mouse button + $mod.
# Despite the name, also works for non-floating windows.
# Change normal to inverse to use left mouse button for resizing and right
# mouse button for dragging.
floating_modifier $mod normal
# Reload the configuration file
bindsym $mod+Shift+c reload
# Exit sway (logs you out of your Wayland session)
bindsym $mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end your Wayland session.' -B 'Yes, exit sway' 'swaymsg exit'
#
# Moving around:
#
# Move your focus around
bindsym $mod+$left focus left
bindsym $mod+$down focus down
bindsym $mod+$up focus up
bindsym $mod+$right focus right
# Or use $mod+[up|down|left|right]
bindsym $mod+Left focus left
bindsym $mod+Down focus down
bindsym $mod+Up focus up
bindsym $mod+Right focus right
# Move the focused window with the same, but add Shift
bindsym $mod+Shift+$left move left
bindsym $mod+Shift+$down move down
bindsym $mod+Shift+$up move up
bindsym $mod+Shift+$right move right
# Ditto, with arrow keys
bindsym $mod+Shift+Left move left
bindsym $mod+Shift+Down move down
bindsym $mod+Shift+Up move up
bindsym $mod+Shift+Right move right
#
# Workspaces:
#
# Switch to workspace
bindsym $mod+1 workspace number 1
bindsym $mod+2 workspace number 2
bindsym $mod+3 workspace number 3
bindsym $mod+4 workspace number 4
bindsym $mod+5 workspace number 5
bindsym $mod+6 workspace number 6
bindsym $mod+7 workspace number 7
bindsym $mod+8 workspace number 8
bindsym $mod+9 workspace number 9
bindsym $mod+0 workspace number 10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace number 1
bindsym $mod+Shift+2 move container to workspace number 2
bindsym $mod+Shift+3 move container to workspace number 3
bindsym $mod+Shift+4 move container to workspace number 4
bindsym $mod+Shift+5 move container to workspace number 5
bindsym $mod+Shift+6 move container to workspace number 6
bindsym $mod+Shift+7 move container to workspace number 7
bindsym $mod+Shift+8 move container to workspace number 8
bindsym $mod+Shift+9 move container to workspace number 9
bindsym $mod+Shift+0 move container to workspace number 10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.
#
# Layout stuff:
#
# You can "split" the current object of your focus with
# $mod+b or $mod+v, for horizontal and vertical splits
# respectively.
bindsym $mod+b splith
bindsym $mod+v splitv
# Switch the current container between different layout styles
bindsym $mod+s layout stacking
bindsym $mod+w layout tabbed
bindsym $mod+e layout toggle split
# Make the current focus fullscreen
bindsym $mod+f fullscreen
# Toggle the current focus between tiling and floating mode
bindsym $mod+Shift+space floating toggle
# Swap focus between the tiling area and the floating area
bindsym $mod+space focus mode_toggle
# Move focus to the parent container
bindsym $mod+a focus parent
#
# Scratchpad:
#
# Sway has a "scratchpad", which is a bag of holding for windows.
# You can send windows there and get them back later.
# Move the currently focused window to the scratchpad
bindsym $mod+Shift+minus move scratchpad
# Show the next scratchpad window or hide the focused scratchpad window.
# If there are multiple scratchpad windows, this command cycles through them.
bindsym $mod+minus scratchpad show
#
# Resizing containers:
#
mode "resize" {
# left will shrink the containers width
# right will grow the containers width
# up will shrink the containers height
# down will grow the containers height
bindsym $left resize shrink width 10px
bindsym $down resize grow height 10px
bindsym $up resize shrink height 10px
bindsym $right resize grow width 10px
# Ditto, with arrow keys
bindsym Left resize shrink width 10px
bindsym Down resize grow height 10px
bindsym Up resize shrink height 10px
bindsym Right resize grow width 10px
# Return to default mode
bindsym Return mode "default"
bindsym Escape mode "default"
}
bindsym $mod+r mode "resize"
#
# Status Bar:
#
# Read `man 5 sway-bar` for more information about this section.
bar {
position top
# When the status_command prints a new line to stdout, swaybar updates.
# The default just shows the current date and time.
status_command while date +'%Y-%m-%d %X'; do sleep 1; done
colors {
statusline #ffffff
background #323232
inactive_workspace #32323200 #32323200 #5c5c5c
}
}
include /etc/sway/config.d/*

View file

@ -0,0 +1,32 @@
#ifndef _FX_EFFECT_FRAMEBUFFERS_H
#define _FX_EFFECT_FRAMEBUFFERS_H
#include <wlr/types/wlr_output.h>
#include <wlr/util/addon.h>
/**
* Used to add effect framebuffers per output instead of every output sharing
* them.
*/
struct fx_effect_framebuffers {
struct wlr_addon addon;
// Contains the blurred background for tiled windows
struct fx_framebuffer *optimized_blur_buffer;
// Contains the original pixels to draw over the areas where artifact are visible
struct fx_framebuffer *blur_saved_pixels_buffer;
// Blur swaps between the two effects buffers everytime it scales the image
// Buffer used for effects
struct fx_framebuffer *effects_buffer;
// Swap buffer used for effects
struct fx_framebuffer *effects_buffer_swapped;
bool blur_buffer_dirty;
// The region where there's blur
pixman_region32_t blur_padding_region;
};
struct fx_effect_framebuffers *fx_effect_framebuffers_try_get(struct wlr_output *output);
#endif

View file

@ -0,0 +1,35 @@
#ifndef SCENEFX_FX_OPENGL_H
#define SCENEFX_FX_OPENGL_H
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <wlr/backend.h>
#include <wlr/render/interface.h>
#include <wlr/types/wlr_buffer.h>
struct fx_renderer;
struct wlr_renderer *fx_renderer_create_with_drm_fd(int drm_fd);
struct wlr_renderer *fx_renderer_create(struct wlr_backend *backend);
struct fx_renderer *fx_get_renderer(
struct wlr_renderer *wlr_renderer);
//
// fx_texture
//
struct fx_texture_attribs {
GLenum target; /* either GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES */
GLuint tex;
bool has_alpha;
};
struct wlr_texture *fx_texture_from_buffer(struct wlr_renderer *wlr_renderer,
struct wlr_buffer *buffer);
void fx_texture_get_attribs(struct wlr_texture *texture,
struct fx_texture_attribs *attribs);
#endif

View file

@ -0,0 +1,126 @@
#ifndef SCENE_FX_RENDER_PASS_H
#define SCENE_FX_RENDER_PASS_H
#include <stdbool.h>
#include <wlr/render/pass.h>
#include <wlr/render/interface.h>
#include "scenefx/types/fx/shadow_data.h"
struct fx_gles_render_pass {
struct wlr_render_pass base;
struct fx_framebuffer *buffer;
struct fx_effect_framebuffers *fx_effect_framebuffers;
struct wlr_output *output;
float projection_matrix[9];
struct fx_render_timer *timer;
};
enum corner_location { TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT, ALL };
/**
* Begin a new render pass with the supplied destination buffer.
*
* Callers must call wlr_render_pass_submit() once they are done with the
* render pass.
*/
struct fx_gles_render_pass *fx_renderer_begin_buffer_pass(struct wlr_renderer *wlr_renderer,
struct wlr_buffer *wlr_buffer, struct wlr_output *output,
const struct wlr_buffer_pass_options *options);
struct fx_render_texture_options {
struct wlr_render_texture_options base;
const struct wlr_box *clip_box; // Used to clip csd. Ignored if NULL
int corner_radius;
bool has_titlebar;
bool discard_transparent;
float dim;
struct wlr_render_color dim_color;
};
struct fx_render_rect_options {
struct wlr_render_rect_options base;
// TODO: Add effects here in the future
};
struct fx_render_box_shadow_options {
struct wlr_box shadow_box;
struct wlr_box clip_box;
/* Clip region, leave NULL to disable clipping */
const pixman_region32_t *clip;
struct shadow_data *shadow_data;
int corner_radius;
};
struct fx_render_rounded_rect_options {
struct wlr_render_rect_options base;
int corner_radius;
enum corner_location corner_location;
};
struct fx_render_rounded_border_corner_options {
struct wlr_render_rect_options base;
int corner_radius;
int border_thickness;
enum corner_location corner_location;
};
struct fx_render_blur_pass_options {
struct fx_render_texture_options tex_options;
pixman_region32_t *opaque_region;
struct fx_framebuffer *current_buffer;
struct blur_data *blur_data;
bool use_optimized_blur;
bool ignore_transparent;
};
/**
* Render a fx texture.
*/
void fx_render_pass_add_texture(struct fx_gles_render_pass *render_pass,
const struct fx_render_texture_options *options);
/**
* Render a rectangle.
*/
void fx_render_pass_add_rect(struct fx_gles_render_pass *render_pass,
const struct fx_render_rect_options *options);
/**
* Render a rounded rectangle.
*/
void fx_render_pass_add_rounded_rect(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_rect_options *options);
/**
* Render a border corner.
*/
void fx_render_pass_add_rounded_border_corner(struct fx_gles_render_pass *render_pass,
const struct fx_render_rounded_border_corner_options *options);
/**
* Render a box shadow.
*/
void fx_render_pass_add_box_shadow(struct fx_gles_render_pass *pass,
const struct fx_render_box_shadow_options *options);
/**
* Render blur.
*/
void fx_render_pass_add_blur(struct fx_gles_render_pass *pass,
struct fx_render_blur_pass_options *fx_options);
/**
* Render optimized blur.
*/
void fx_render_pass_add_optimized_blur(struct fx_gles_render_pass *pass,
struct fx_render_blur_pass_options *fx_options);
/**
* Render from one buffer to another
*/
void fx_renderer_read_to_buffer(struct fx_gles_render_pass *pass,
pixman_region32_t *region, struct fx_framebuffer *dst_buffer,
struct fx_framebuffer *src_buffer, bool transformed_region);
#endif

View file

@ -0,0 +1,24 @@
#ifndef TYPES_FX_BLUR_DATA_H
#define TYPES_FX_BLUR_DATA_H
#include <stdbool.h>
#include <wlr/util/addon.h>
struct blur_data {
int num_passes;
int radius;
float noise;
float brightness;
float contrast;
float saturation;
};
struct blur_data blur_data_get_default(void);
bool blur_data_should_parameters_blur_effects(struct blur_data *blur_data);
bool blur_data_cmp(struct blur_data *a, struct blur_data *b);
int blur_data_calc_size(struct blur_data *blur_data);
#endif

View file

@ -0,0 +1,20 @@
#ifndef TYPES_DECORATION_DATA
#define TYPES_DECORATION_DATA
#include <stdbool.h>
#include <wlr/util/addon.h>
#include <wlr/render/pass.h>
struct shadow_data {
bool enabled;
struct wlr_render_color color;
float blur_sigma;
float offset_x;
float offset_y;
};
struct shadow_data shadow_data_get_default(void);
bool scene_buffer_has_shadow(struct shadow_data *data);
#endif

View file

@ -0,0 +1,613 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_SCENE_H
#define WLR_TYPES_WLR_SCENE_H
/**
* The scene-graph API provides a declarative way to display surfaces. The
* compositor creates a scene, adds surfaces, then renders the scene on
* outputs.
*
* The scene-graph API only supports basic 2D composition operations (like the
* KMS API or the Wayland protocol does). For anything more complicated,
* compositors need to implement custom rendering logic.
*/
#include <pixman.h>
#include "scenefx/types/fx/shadow_data.h"
#include <time.h>
#include <wayland-server-core.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_damage_ring.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/util/addon.h>
#include <wlr/util/box.h>
struct wlr_output;
struct wlr_output_layout;
struct wlr_output_layout_output;
struct wlr_xdg_surface;
struct wlr_layer_surface_v1;
struct wlr_drag_icon;
struct wlr_surface;
struct wlr_scene_node;
struct wlr_scene_buffer;
struct wlr_scene_output_layout;
struct wlr_presentation;
struct wlr_linux_dmabuf_v1;
struct wlr_output_state;
typedef bool (*wlr_scene_buffer_point_accepts_input_func_t)(
struct wlr_scene_buffer *buffer, double *sx, double *sy);
typedef void (*wlr_scene_buffer_iterator_func_t)(
struct wlr_scene_buffer *buffer, int sx, int sy, void *user_data);
enum wlr_scene_node_type {
WLR_SCENE_NODE_TREE,
WLR_SCENE_NODE_RECT,
WLR_SCENE_NODE_BUFFER,
};
/** A node is an object in the scene. */
struct wlr_scene_node {
enum wlr_scene_node_type type;
struct wlr_scene_tree *parent;
struct wl_list link; // wlr_scene_tree.children
bool enabled;
int x, y; // relative to parent
struct {
struct wl_signal destroy;
} events;
void *data;
struct wlr_addon_set addons;
// private state
pixman_region32_t visible;
};
enum wlr_scene_debug_damage_option {
WLR_SCENE_DEBUG_DAMAGE_NONE,
WLR_SCENE_DEBUG_DAMAGE_RERENDER,
WLR_SCENE_DEBUG_DAMAGE_HIGHLIGHT
};
/** A sub-tree in the scene-graph. */
struct wlr_scene_tree {
struct wlr_scene_node node;
struct wl_list children; // wlr_scene_node.link
};
/** The root scene-graph node. */
struct wlr_scene {
struct wlr_scene_tree tree;
struct wl_list outputs; // wlr_scene_output.link
// May be NULL
struct wlr_presentation *presentation;
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
// private state
struct wl_listener presentation_destroy;
struct wl_listener linux_dmabuf_v1_destroy;
enum wlr_scene_debug_damage_option debug_damage_option;
bool direct_scanout;
bool calculate_visibility;
};
/** A scene-graph node displaying a single surface. */
struct wlr_scene_surface {
struct wlr_scene_buffer *buffer;
struct wlr_surface *surface;
// private state
struct wlr_box clip;
struct wlr_addon addon;
struct wl_listener outputs_update;
struct wl_listener output_enter;
struct wl_listener output_leave;
struct wl_listener output_sample;
struct wl_listener frame_done;
struct wl_listener surface_destroy;
struct wl_listener surface_commit;
};
/** A scene-graph node displaying a solid-colored rectangle */
struct wlr_scene_rect {
struct wlr_scene_node node;
int width, height;
float color[4];
};
struct wlr_scene_outputs_update_event {
struct wlr_scene_output **active;
size_t size;
};
struct wlr_scene_output_sample_event {
struct wlr_scene_output *output;
bool direct_scanout;
};
/** A scene-graph node displaying a buffer */
struct wlr_scene_buffer {
struct wlr_scene_node node;
// May be NULL
struct wlr_buffer *buffer;
struct {
struct wl_signal outputs_update; // struct wlr_scene_outputs_update_event
struct wl_signal output_enter; // struct wlr_scene_output
struct wl_signal output_leave; // struct wlr_scene_output
struct wl_signal output_sample; // struct wlr_scene_output_sample_event
struct wl_signal frame_done; // struct timespec
} events;
// May be NULL
wlr_scene_buffer_point_accepts_input_func_t point_accepts_input;
/**
* The output that the largest area of this buffer is displayed on.
* This may be NULL if the buffer is not currently displayed on any
* outputs. This is the output that should be used for frame callbacks,
* presentation feedback, etc.
*/
struct wlr_scene_output *primary_output;
float opacity;
int corner_radius;
struct shadow_data shadow_data;
enum wlr_scale_filter_mode filter_mode;
struct wlr_fbox src_box;
int dst_width, dst_height;
enum wl_output_transform transform;
pixman_region32_t opaque_region;
// private state
uint64_t active_outputs;
struct wlr_texture *texture;
struct wlr_linux_dmabuf_feedback_v1_init_options prev_feedback_options;
};
/** A viewport for an output in the scene-graph */
struct wlr_scene_output {
struct wlr_output *output;
struct wl_list link; // wlr_scene.outputs
struct wlr_scene *scene;
struct wlr_addon addon;
struct wlr_damage_ring damage_ring;
int x, y;
struct {
struct wl_signal destroy;
} events;
// private state
uint8_t index;
bool prev_scanout;
struct wl_listener output_commit;
struct wl_listener output_damage;
struct wl_listener output_needs_frame;
struct wl_list damage_highlight_regions;
struct wl_array render_list;
};
struct wlr_scene_timer {
int64_t pre_render_duration;
struct wlr_render_timer *render_timer;
};
/** A layer shell scene helper */
struct wlr_scene_layer_surface_v1 {
struct wlr_scene_tree *tree;
struct wlr_layer_surface_v1 *layer_surface;
// private state
struct wl_listener tree_destroy;
struct wl_listener layer_surface_destroy;
struct wl_listener layer_surface_map;
struct wl_listener layer_surface_unmap;
};
/**
* Immediately destroy the scene-graph node.
*/
void wlr_scene_node_destroy(struct wlr_scene_node *node);
/**
* Enable or disable this node. If a node is disabled, all of its children are
* implicitly disabled as well.
*/
void wlr_scene_node_set_enabled(struct wlr_scene_node *node, bool enabled);
/**
* Set the position of the node relative to its parent.
*/
void wlr_scene_node_set_position(struct wlr_scene_node *node, int x, int y);
/**
* Move the node right above the specified sibling.
* Asserts that node and sibling are distinct and share the same parent.
*/
void wlr_scene_node_place_above(struct wlr_scene_node *node,
struct wlr_scene_node *sibling);
/**
* Move the node right below the specified sibling.
* Asserts that node and sibling are distinct and share the same parent.
*/
void wlr_scene_node_place_below(struct wlr_scene_node *node,
struct wlr_scene_node *sibling);
/**
* Move the node above all of its sibling nodes.
*/
void wlr_scene_node_raise_to_top(struct wlr_scene_node *node);
/**
* Move the node below all of its sibling nodes.
*/
void wlr_scene_node_lower_to_bottom(struct wlr_scene_node *node);
/**
* Move the node to another location in the tree.
*/
void wlr_scene_node_reparent(struct wlr_scene_node *node,
struct wlr_scene_tree *new_parent);
/**
* Get the node's layout-local coordinates.
*
* True is returned if the node and all of its ancestors are enabled.
*/
bool wlr_scene_node_coords(struct wlr_scene_node *node, int *lx, int *ly);
/**
* Call `iterator` on each buffer in the scene-graph, with the buffer's
* position in layout coordinates. The function is called from root to leaves
* (in rendering order).
*/
void wlr_scene_node_for_each_buffer(struct wlr_scene_node *node,
wlr_scene_buffer_iterator_func_t iterator, void *user_data);
/**
* Find the topmost node in this scene-graph that contains the point at the
* given layout-local coordinates. (For surface nodes, this means accepting
* input events at that point.) Returns the node and coordinates relative to the
* returned node, or NULL if no node is found at that location.
*/
struct wlr_scene_node *wlr_scene_node_at(struct wlr_scene_node *node,
double lx, double ly, double *nx, double *ny);
/**
* Create a new scene-graph.
*/
struct wlr_scene *wlr_scene_create(void);
/**
* Handle presentation feedback for all surfaces in the scene, assuming that
* scene outputs and the scene rendering functions are used.
*
* Asserts that a struct wlr_presentation hasn't already been set for the scene.
*/
void wlr_scene_set_presentation(struct wlr_scene *scene,
struct wlr_presentation *presentation);
/**
* Handles linux_dmabuf_v1 feedback for all surfaces in the scene.
*
* Asserts that a struct wlr_linux_dmabuf_v1 hasn't already been set for the scene.
*/
void wlr_scene_set_linux_dmabuf_v1(struct wlr_scene *scene,
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1);
/**
* Add a node displaying nothing but its children.
*/
struct wlr_scene_tree *wlr_scene_tree_create(struct wlr_scene_tree *parent);
/**
* Add a node displaying a single surface to the scene-graph.
*
* The child sub-surfaces are ignored.
*
* wlr_surface_send_enter() and wlr_surface_send_leave() will be called
* automatically based on the position of the surface and outputs in
* the scene.
*/
struct wlr_scene_surface *wlr_scene_surface_create(struct wlr_scene_tree *parent,
struct wlr_surface *surface);
/**
* If this node represents a wlr_scene_buffer, that buffer will be returned. It
* is not legal to feed a node that does not represent a wlr_scene_buffer.
*/
struct wlr_scene_buffer *wlr_scene_buffer_from_node(struct wlr_scene_node *node);
/**
* If this node represents a wlr_scene_tree, that tree will be returned. It
* is not legal to feed a node that does not represent a wlr_scene_tree.
*/
struct wlr_scene_tree *wlr_scene_tree_from_node(struct wlr_scene_node *node);
/**
* If this node represents a wlr_scene_rect, that rect will be returned. It
* is not legal to feed a node that does not represent a wlr_scene_rect.
*/
struct wlr_scene_rect *wlr_scene_rect_from_node(struct wlr_scene_node *node);
/**
* If this buffer is backed by a surface, then the struct wlr_scene_surface is
* returned. If not, NULL will be returned.
*/
struct wlr_scene_surface *wlr_scene_surface_try_from_buffer(
struct wlr_scene_buffer *scene_buffer);
/**
* Add a node displaying a solid-colored rectangle to the scene-graph.
*/
struct wlr_scene_rect *wlr_scene_rect_create(struct wlr_scene_tree *parent,
int width, int height, const float color[static 4]);
/**
* Change the width and height of an existing rectangle node.
*/
void wlr_scene_rect_set_size(struct wlr_scene_rect *rect, int width, int height);
/**
* Change the color of an existing rectangle node.
*/
void wlr_scene_rect_set_color(struct wlr_scene_rect *rect, const float color[static 4]);
/**
* Add a node displaying a buffer to the scene-graph.
*
* If the buffer is NULL, this node will not be displayed.
*/
struct wlr_scene_buffer *wlr_scene_buffer_create(struct wlr_scene_tree *parent,
struct wlr_buffer *buffer);
/**
* Sets the buffer's backing buffer.
*
* If the buffer is NULL, the buffer node will not be displayed.
*/
void wlr_scene_buffer_set_buffer(struct wlr_scene_buffer *scene_buffer,
struct wlr_buffer *buffer);
/**
* Sets the buffer's backing buffer with a custom damage region.
*
* The damage region is in buffer-local coordinates. If the region is NULL,
* the whole buffer node will be damaged.
*/
void wlr_scene_buffer_set_buffer_with_damage(struct wlr_scene_buffer *scene_buffer,
struct wlr_buffer *buffer, const pixman_region32_t *region);
/**
* Sets the buffer's opaque region. This is an optimization hint used to
* determine if buffers which reside under this one need to be rendered or not.
*/
void wlr_scene_buffer_set_opaque_region(struct wlr_scene_buffer *scene_buffer,
const pixman_region32_t *region);
/**
* Set the source rectangle describing the region of the buffer which will be
* sampled to render this node. This allows cropping the buffer.
*
* If NULL, the whole buffer is sampled. By default, the source box is NULL.
*/
void wlr_scene_buffer_set_source_box(struct wlr_scene_buffer *scene_buffer,
const struct wlr_fbox *box);
/**
* Set the destination size describing the region of the scene-graph the buffer
* will be painted onto. This allows scaling the buffer.
*
* If zero, the destination size will be the buffer size. By default, the
* destination size is zero.
*/
void wlr_scene_buffer_set_dest_size(struct wlr_scene_buffer *scene_buffer,
int width, int height);
/**
* Set a transform which will be applied to the buffer.
*/
void wlr_scene_buffer_set_transform(struct wlr_scene_buffer *scene_buffer,
enum wl_output_transform transform);
/**
* Sets the opacity of this buffer
*/
void wlr_scene_buffer_set_opacity(struct wlr_scene_buffer *scene_buffer,
float opacity);
/**
* Sets the filter mode to use when scaling the buffer
*/
void wlr_scene_buffer_set_filter_mode(struct wlr_scene_buffer *scene_buffer,
enum wlr_scale_filter_mode filter_mode);
/**
* Sets the corner radius of this buffer
*/
void wlr_scene_buffer_set_corner_radius(struct wlr_scene_buffer *scene_buffer,
int radii);
/**
* Sets the shadow of this buffer
*/
void wlr_scene_buffer_set_shadow_data(struct wlr_scene_buffer *scene_buffer,
struct shadow_data shadow_data);
/**
* Calls the buffer's frame_done signal.
*/
void wlr_scene_buffer_send_frame_done(struct wlr_scene_buffer *scene_buffer,
struct timespec *now);
/**
* Add a viewport for the specified output to the scene-graph.
*
* An output can only be added once to the scene-graph.
*/
struct wlr_scene_output *wlr_scene_output_create(struct wlr_scene *scene,
struct wlr_output *output);
/**
* Destroy a scene-graph output.
*/
void wlr_scene_output_destroy(struct wlr_scene_output *scene_output);
/**
* Set the output's position in the scene-graph.
*/
void wlr_scene_output_set_position(struct wlr_scene_output *scene_output,
int lx, int ly);
struct wlr_scene_output_state_options {
struct wlr_scene_timer *timer;
};
/**
* Render and commit an output.
*/
bool wlr_scene_output_commit(struct wlr_scene_output *scene_output,
const struct wlr_scene_output_state_options *options);
/**
* Render and populate given output state.
*/
bool wlr_scene_output_build_state(struct wlr_scene_output *scene_output,
struct wlr_output_state *state, const struct wlr_scene_output_state_options *options);
/**
* Retrieve the duration in nanoseconds between the last wlr_scene_output_commit() call and the end
* of its operations, including those on the GPU that may have finished after the call returned.
*
* Returns -1 if the duration is unavailable.
*/
int64_t wlr_scene_timer_get_duration_ns(struct wlr_scene_timer *timer);
void wlr_scene_timer_finish(struct wlr_scene_timer *timer);
/**
* Call wlr_surface_send_frame_done() on all surfaces in the scene rendered by
* wlr_scene_output_commit() for which wlr_scene_surface.primary_output
* matches the given scene_output.
*/
void wlr_scene_output_send_frame_done(struct wlr_scene_output *scene_output,
struct timespec *now);
/**
* Call `iterator` on each buffer in the scene-graph visible on the output,
* with the buffer's position in layout coordinates. The function is called
* from root to leaves (in rendering order).
*/
void wlr_scene_output_for_each_buffer(struct wlr_scene_output *scene_output,
wlr_scene_buffer_iterator_func_t iterator, void *user_data);
/**
* Get a scene-graph output from a struct wlr_output.
*
* If the output hasn't been added to the scene-graph, returns NULL.
*/
struct wlr_scene_output *wlr_scene_get_scene_output(struct wlr_scene *scene,
struct wlr_output *output);
/**
* Attach an output layout to a scene.
*
* The resulting scene output layout allows to synchronize the positions of scene
* outputs with the positions of corresponding layout outputs.
*
* It is automatically destroyed when the scene or the output layout is destroyed.
*/
struct wlr_scene_output_layout *wlr_scene_attach_output_layout(struct wlr_scene *scene,
struct wlr_output_layout *output_layout);
/**
* Add an output to the scene output layout.
*
* When the layout output is repositioned, the scene output will be repositioned
* accordingly.
*/
void wlr_scene_output_layout_add_output(struct wlr_scene_output_layout *sol,
struct wlr_output_layout_output *lo, struct wlr_scene_output *so);
/**
* Add a node displaying a surface and all of its sub-surfaces to the
* scene-graph.
*/
struct wlr_scene_tree *wlr_scene_subsurface_tree_create(
struct wlr_scene_tree *parent, struct wlr_surface *surface);
/**
* Sets a cropping region for any subsurface trees that are children of this
* scene node. The clip coordinate space will be that of the root surface of
* the subsurface tree.
*
* A NULL or empty clip will disable clipping
*/
void wlr_scene_subsurface_tree_set_clip(struct wlr_scene_node *node,
struct wlr_box *clip);
/**
* Add a node displaying an xdg_surface and all of its sub-surfaces to the
* scene-graph.
*
* The origin of the returned scene-graph node will match the top-left corner
* of the xdg_surface window geometry.
*/
struct wlr_scene_tree *wlr_scene_xdg_surface_create(
struct wlr_scene_tree *parent, struct wlr_xdg_surface *xdg_surface);
/**
* Add a node displaying a layer_surface_v1 and all of its sub-surfaces to the
* scene-graph.
*
* The origin of the returned scene-graph node will match the top-left corner
* of the layer surface.
*/
struct wlr_scene_layer_surface_v1 *wlr_scene_layer_surface_v1_create(
struct wlr_scene_tree *parent, struct wlr_layer_surface_v1 *layer_surface);
/**
* Configure a layer_surface_v1, position its scene node in accordance to its
* current state, and update the remaining usable area.
*
* full_area represents the entire area that may be used by the layer surface
* if its exclusive_zone is -1, and is usually the output dimensions.
* usable_area represents what remains of full_area that can be used if
* exclusive_zone is >= 0. usable_area is updated if the surface has a positive
* exclusive_zone, so that it can be used for the next layer surface.
*/
void wlr_scene_layer_surface_v1_configure(
struct wlr_scene_layer_surface_v1 *scene_layer_surface,
const struct wlr_box *full_area, struct wlr_box *usable_area);
/**
* Add a node displaying a drag icon and all its sub-surfaces to the
* scene-graph.
*/
struct wlr_scene_tree *wlr_scene_drag_icon_create(
struct wlr_scene_tree *parent, struct wlr_drag_icon *drag_icon);
#endif

62
debian/swayfx/usr/include/wlr/backend.h vendored Normal file
View file

@ -0,0 +1,62 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_BACKEND_H
#define WLR_BACKEND_H
#include <wayland-server-core.h>
struct wlr_session;
struct wlr_backend_impl;
/**
* A backend provides a set of input and output devices.
*/
struct wlr_backend {
const struct wlr_backend_impl *impl;
struct {
/** Raised when destroyed */
struct wl_signal destroy;
/** Raised when new inputs are added, passed the struct wlr_input_device */
struct wl_signal new_input;
/** Raised when new outputs are added, passed the struct wlr_output */
struct wl_signal new_output;
} events;
};
/**
* Automatically initializes the most suitable backend given the environment.
* Will always return a multi-backend. The backend is created but not started.
* Returns NULL on failure.
*
* If session_ptr is not NULL, it's populated with the session which has been
* created with the backend, if any.
*/
struct wlr_backend *wlr_backend_autocreate(struct wl_display *display,
struct wlr_session **session_ptr);
/**
* Start the backend. This may signal new_input or new_output immediately, but
* may also wait until the display's event loop begins. Returns false on
* failure.
*/
bool wlr_backend_start(struct wlr_backend *backend);
/**
* Destroy the backend and clean up all of its resources. Normally called
* automatically when the struct wl_display is destroyed.
*/
void wlr_backend_destroy(struct wlr_backend *backend);
/**
* Returns the DRM node file descriptor used by the backend's underlying
* platform. Can be used by consumers for additional rendering operations.
* The consumer must not close the file descriptor since the backend continues
* to have ownership of it.
*/
int wlr_backend_get_drm_fd(struct wlr_backend *backend);
#endif

View file

@ -0,0 +1,31 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_BACKEND_HEADLESS_H
#define WLR_BACKEND_HEADLESS_H
#include <wlr/backend.h>
#include <wlr/types/wlr_output.h>
/**
* Creates a headless backend. A headless backend has no outputs or inputs by
* default.
*/
struct wlr_backend *wlr_headless_backend_create(struct wl_display *display);
/**
* Create a new headless output.
*
* The buffers presented on the output won't be displayed to the user.
*/
struct wlr_output *wlr_headless_add_output(struct wlr_backend *backend,
unsigned int width, unsigned int height);
bool wlr_backend_is_headless(struct wlr_backend *backend);
bool wlr_output_is_headless(struct wlr_output *output);
#endif

View file

@ -0,0 +1,33 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_BACKEND_INTERFACE_H
#define WLR_BACKEND_INTERFACE_H
#include <stdbool.h>
#include <wlr/backend.h>
struct wlr_backend_impl {
bool (*start)(struct wlr_backend *backend);
void (*destroy)(struct wlr_backend *backend);
int (*get_drm_fd)(struct wlr_backend *backend);
uint32_t (*get_buffer_caps)(struct wlr_backend *backend);
};
/**
* Initializes common state on a struct wlr_backend and sets the implementation
* to the provided struct wlr_backend_impl reference.
*/
void wlr_backend_init(struct wlr_backend *backend,
const struct wlr_backend_impl *impl);
/**
* Emit the destroy event and clean up common backend state.
*/
void wlr_backend_finish(struct wlr_backend *backend);
#endif

View file

@ -0,0 +1,30 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_BACKEND_LIBINPUT_H
#define WLR_BACKEND_LIBINPUT_H
#include <libinput.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/backend/session.h>
struct wlr_input_device;
struct wlr_backend *wlr_libinput_backend_create(struct wl_display *display,
struct wlr_session *session);
/**
* Gets the underlying struct libinput_device handle for the given input device.
*/
struct libinput_device *wlr_libinput_get_device_handle(
struct wlr_input_device *dev);
bool wlr_backend_is_libinput(struct wlr_backend *backend);
bool wlr_input_device_is_libinput(struct wlr_input_device *device);
#endif

View file

@ -0,0 +1,35 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_BACKEND_MULTI_H
#define WLR_BACKEND_MULTI_H
#include <wlr/backend.h>
/**
* Creates a multi-backend. Multi-backends wrap an arbitrary number of backends
* and aggregate their new_output/new_input signals.
*/
struct wlr_backend *wlr_multi_backend_create(struct wl_display *display);
/**
* Adds the given backend to the multi backend. This should be done before the
* new backend is started.
*/
bool wlr_multi_backend_add(struct wlr_backend *multi,
struct wlr_backend *backend);
void wlr_multi_backend_remove(struct wlr_backend *multi,
struct wlr_backend *backend);
bool wlr_backend_is_multi(struct wlr_backend *backend);
bool wlr_multi_is_empty(struct wlr_backend *backend);
void wlr_multi_for_each_backend(struct wlr_backend *backend,
void (*callback)(struct wlr_backend *backend, void *data), void *data);
#endif

View file

@ -0,0 +1,120 @@
#ifndef WLR_BACKEND_SESSION_H
#define WLR_BACKEND_SESSION_H
#include <stdbool.h>
#include <sys/types.h>
#include <wayland-server-core.h>
struct libseat;
struct wlr_device {
int fd;
int device_id;
dev_t dev;
struct wl_list link;
struct {
struct wl_signal change; // struct wlr_device_change_event
struct wl_signal remove;
} events;
};
struct wlr_session {
/*
* Signal for when the session becomes active/inactive.
* It's called when we swap virtual terminal.
*/
bool active;
/*
* 0 if virtual terminals are not supported
* i.e. seat != "seat0"
*/
unsigned vtnr;
char seat[256];
struct udev *udev;
struct udev_monitor *mon;
struct wl_event_source *udev_event;
struct libseat *seat_handle;
struct wl_event_source *libseat_event;
struct wl_list devices;
struct wl_display *display;
struct wl_listener display_destroy;
struct {
struct wl_signal active;
struct wl_signal add_drm_card; // struct wlr_session_add_event
struct wl_signal destroy;
} events;
};
struct wlr_session_add_event {
const char *path;
};
enum wlr_device_change_type {
WLR_DEVICE_HOTPLUG = 1,
WLR_DEVICE_LEASE,
};
struct wlr_device_hotplug_event {
uint32_t connector_id;
uint32_t prop_id;
};
struct wlr_device_change_event {
enum wlr_device_change_type type;
union {
struct wlr_device_hotplug_event hotplug;
};
};
/*
* Opens a session, taking control of the current virtual terminal.
* This should not be called if another program is already in control
* of the terminal (Xorg, another Wayland compositor, etc.).
*
* Returns NULL on error.
*/
struct wlr_session *wlr_session_create(struct wl_display *disp);
/*
* Closes a previously opened session and restores the virtual terminal.
* You should call wlr_session_close_file() on each files you opened
* with wlr_session_open_file() before you call this.
*/
void wlr_session_destroy(struct wlr_session *session);
/*
* Opens the file at path.
*
* This can only be used to open DRM or evdev (input) devices. Files opened via
* this function must be closed by calling wlr_session_close_file().
*
* When the session becomes inactive:
*
* - DRM files lose their DRM master status
* - evdev files become invalid and should be closed
*/
struct wlr_device *wlr_session_open_file(struct wlr_session *session,
const char *path);
/*
* Closes a file previously opened with wlr_session_open_file().
*/
void wlr_session_close_file(struct wlr_session *session,
struct wlr_device *device);
/*
* Changes the virtual terminal.
*/
bool wlr_session_change_vt(struct wlr_session *session, unsigned vt);
ssize_t wlr_session_find_gpus(struct wlr_session *session,
size_t ret_len, struct wlr_device **ret);
#endif

View file

@ -0,0 +1,70 @@
#ifndef WLR_BACKEND_WAYLAND_H
#define WLR_BACKEND_WAYLAND_H
#include <stdbool.h>
#include <wayland-client.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_output.h>
struct wlr_input_device;
/**
* Creates a new Wayland backend. This backend will be created with no outputs;
* you must use wlr_wl_output_create() to add them.
*
* The remote_display argument is an existing libwayland-client struct wl_display
* to use. Leave it NULL to create a new connection to the compositor.
*/
struct wlr_backend *wlr_wl_backend_create(struct wl_display *display,
struct wl_display *remote_display);
/**
* Returns the remote struct wl_display used by the Wayland backend.
*/
struct wl_display *wlr_wl_backend_get_remote_display(struct wlr_backend *backend);
/**
* Adds a new output to this backend.
*
* This creates a new xdg_toplevel in the parent Wayland compositor.
*
* You may remove outputs by destroying them.
*
* Note that if called before initializing the backend, this will return NULL
* and your outputs will be created during initialization (and given to you via
* the new_output signal).
*/
struct wlr_output *wlr_wl_output_create(struct wlr_backend *backend);
/**
* Create a new output from an existing struct wl_surface.
*/
struct wlr_output *wlr_wl_output_create_from_surface(struct wlr_backend *backend,
struct wl_surface *surface);
/**
* Check whether the provided backend is a Wayland backend.
*/
bool wlr_backend_is_wl(struct wlr_backend *backend);
/**
* Check whether the provided input device is a Wayland input device.
*/
bool wlr_input_device_is_wl(struct wlr_input_device *device);
/**
* Check whether the provided output device is a Wayland output device.
*/
bool wlr_output_is_wl(struct wlr_output *output);
/**
* Sets the title of a struct wlr_output which is a Wayland toplevel.
*/
void wlr_wl_output_set_title(struct wlr_output *output, const char *title);
/**
* Returns the remote struct wl_surface used by the Wayland output.
*/
struct wl_surface *wlr_wl_output_get_surface(struct wlr_output *output);
#endif

View file

@ -0,0 +1,51 @@
#ifndef WLR_BACKEND_X11_H
#define WLR_BACKEND_X11_H
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_output.h>
struct wlr_input_device;
/**
* Creates a new X11 backend. This backend will be created with no outputs;
* you must use wlr_x11_output_create() to add them.
*
* The `x11_display` argument is the name of the X Display socket. Set
* to NULL for the default behaviour of XOpenDisplay().
*/
struct wlr_backend *wlr_x11_backend_create(struct wl_display *display,
const char *x11_display);
/**
* Adds a new output to this backend. You may remove outputs by destroying them.
* Note that if called before initializing the backend, this will return NULL
* and your outputs will be created during initialization (and given to you via
* the new_output signal).
*/
struct wlr_output *wlr_x11_output_create(struct wlr_backend *backend);
/**
* Check whether this backend is an X11 backend.
*/
bool wlr_backend_is_x11(struct wlr_backend *backend);
/**
* Check whether this input device is an X11 input device.
*/
bool wlr_input_device_is_x11(struct wlr_input_device *device);
/**
* Check whether this output device is an X11 output device.
*/
bool wlr_output_is_x11(struct wlr_output *output);
/**
* Sets the title of a struct wlr_output which is an X11 window.
*/
void wlr_x11_output_set_title(struct wlr_output *output, const char *title);
#endif

17
debian/swayfx/usr/include/wlr/config.h vendored Normal file
View file

@ -0,0 +1,17 @@
#ifndef WLR_CONFIG_H
#define WLR_CONFIG_H
#define WLR_HAS_DRM_BACKEND 0
#define WLR_HAS_LIBINPUT_BACKEND 1
#define WLR_HAS_X11_BACKEND 1
#define WLR_HAS_GLES2_RENDERER 1
#define WLR_HAS_VULKAN_RENDERER 0
#define WLR_HAS_GBM_ALLOCATOR 1
#define WLR_HAS_XWAYLAND 0
#define WLR_HAS_SESSION 1
#endif

View file

@ -0,0 +1,48 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_BUFFER_H
#define WLR_INTERFACES_WLR_BUFFER_H
#include <wlr/types/wlr_buffer.h>
struct wlr_buffer_impl {
void (*destroy)(struct wlr_buffer *buffer);
bool (*get_dmabuf)(struct wlr_buffer *buffer,
struct wlr_dmabuf_attributes *attribs);
bool (*get_shm)(struct wlr_buffer *buffer,
struct wlr_shm_attributes *attribs);
bool (*begin_data_ptr_access)(struct wlr_buffer *buffer, uint32_t flags,
void **data, uint32_t *format, size_t *stride);
void (*end_data_ptr_access)(struct wlr_buffer *buffer);
};
struct wlr_buffer_resource_interface {
const char *name;
bool (*is_instance)(struct wl_resource *resource);
struct wlr_buffer *(*from_resource)(struct wl_resource *resource);
};
/**
* Initialize a buffer. This function should be called by producers. The
* initialized buffer is referenced: once the producer is done with the buffer
* they should call wlr_buffer_drop().
*/
void wlr_buffer_init(struct wlr_buffer *buffer,
const struct wlr_buffer_impl *impl, int width, int height);
/**
* Allows the registration of a struct wl_resource implementation.
*
* The matching function will be called for the struct wl_resource when creating
* a struct wlr_buffer from a struct wl_resource.
*/
void wlr_buffer_register_resource_interface(
const struct wlr_buffer_resource_interface *iface);
#endif

View file

@ -0,0 +1,34 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_KEYBOARD_H
#define WLR_INTERFACES_WLR_KEYBOARD_H
#include <stdint.h>
#include <wlr/types/wlr_keyboard.h>
struct wlr_keyboard_impl {
const char *name;
void (*led_update)(struct wlr_keyboard *keyboard, uint32_t leds);
};
void wlr_keyboard_init(struct wlr_keyboard *keyboard,
const struct wlr_keyboard_impl *impl, const char *name);
/**
* Cleans up all of the resources owned by the struct wlr_keyboard.
*/
void wlr_keyboard_finish(struct wlr_keyboard *keyboard);
void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
struct wlr_keyboard_key_event *event);
void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
uint32_t group);
#endif

View file

@ -0,0 +1,130 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_OUTPUT_H
#define WLR_INTERFACES_WLR_OUTPUT_H
#include <stdbool.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_output.h>
/**
* Output state fields that don't require backend support. Backends can ignore
* them without breaking the API contract.
*/
#define WLR_OUTPUT_STATE_BACKEND_OPTIONAL \
(WLR_OUTPUT_STATE_DAMAGE | \
WLR_OUTPUT_STATE_SCALE | \
WLR_OUTPUT_STATE_TRANSFORM | \
WLR_OUTPUT_STATE_RENDER_FORMAT | \
WLR_OUTPUT_STATE_SUBPIXEL | \
WLR_OUTPUT_STATE_LAYERS)
/**
* A backend implementation of struct wlr_output.
*
* The commit function is mandatory. Other functions are optional.
*/
struct wlr_output_impl {
/**
* Set the output cursor plane image.
*
* If buffer is NULL, the cursor should be hidden.
*
* The hotspot indicates the offset that needs to be applied to the
* top-left corner of the image to match the cursor position. In other
* words, the image should be displayed at (x - hotspot_x, y - hotspot_y).
* The hotspot is given in the buffer's coordinate space.
*/
bool (*set_cursor)(struct wlr_output *output, struct wlr_buffer *buffer,
int hotspot_x, int hotspot_y);
/**
* Set the output cursor plane position.
*
* The position is relative to the cursor hotspot, see set_cursor.
*/
bool (*move_cursor)(struct wlr_output *output, int x, int y);
/**
* Cleanup backend-specific resources tied to the output.
*/
void (*destroy)(struct wlr_output *output);
/**
* Check that the supplied output state is a valid configuration.
*
* If this function returns true, commit can only fail due to a runtime
* error.
*/
bool (*test)(struct wlr_output *output, const struct wlr_output_state *state);
/**
* Commit the supplied output state.
*
* If a buffer has been attached, a frame event is scheduled.
*/
bool (*commit)(struct wlr_output *output, const struct wlr_output_state *state);
/**
* Get the maximum number of gamma LUT elements for each channel.
*
* Zero can be returned if the output doesn't support gamma LUTs.
*/
size_t (*get_gamma_size)(struct wlr_output *output);
/**
* Get the list of formats suitable for the cursor, assuming a buffer with
* the specified capabilities.
*
* If unimplemented, the cursor buffer has no format constraint. If NULL is
* returned, no format is suitable.
*/
const struct wlr_drm_format_set *(*get_cursor_formats)(
struct wlr_output *output, uint32_t buffer_caps);
/**
* Get the size suitable for the cursor buffer. Attempts to use a different
* size for the cursor may fail.
*/
void (*get_cursor_size)(struct wlr_output *output, int *width, int *height);
/**
* Get the list of DRM formats suitable for the primary buffer,
* assuming a buffer with the specified capabilities.
*
* If unimplemented, the primary buffer has no format constraint. If NULL
* is returned, no format is suitable.
*/
const struct wlr_drm_format_set *(*get_primary_formats)(
struct wlr_output *output, uint32_t buffer_caps);
};
/**
* Initialize a new output.
*/
void wlr_output_init(struct wlr_output *output, struct wlr_backend *backend,
const struct wlr_output_impl *impl, struct wl_display *display,
const struct wlr_output_state *state);
/**
* Notify compositors that they need to submit a new frame in order to apply
* output changes.
*/
void wlr_output_update_needs_frame(struct wlr_output *output);
/**
* Send a frame event.
*
* See wlr_output.events.frame.
*/
void wlr_output_send_frame(struct wlr_output *output);
/**
* Send a present event.
*
* See wlr_output.events.present.
*/
void wlr_output_send_present(struct wlr_output *output,
struct wlr_output_event_present *event);
/**
* Request the compositor to apply new state.
*/
void wlr_output_send_request_state(struct wlr_output *output,
const struct wlr_output_state *state);
#endif

View file

@ -0,0 +1,22 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_POINTER_H
#define WLR_INTERFACES_WLR_POINTER_H
#include <wlr/types/wlr_pointer.h>
struct wlr_pointer_impl {
const char *name;
};
void wlr_pointer_init(struct wlr_pointer *pointer,
const struct wlr_pointer_impl *impl, const char *name);
void wlr_pointer_finish(struct wlr_pointer *pointer);
#endif

View file

@ -0,0 +1,22 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_SWITCH_H
#define WLR_INTERFACES_WLR_SWITCH_H
#include <wlr/types/wlr_switch.h>
struct wlr_switch_impl {
const char *name;
};
void wlr_switch_init(struct wlr_switch *switch_device,
const struct wlr_switch_impl *impl, const char *name);
void wlr_switch_finish(struct wlr_switch *switch_device);
#endif

View file

@ -0,0 +1,30 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_TABLET_PAD_H
#define WLR_INTERFACES_WLR_TABLET_PAD_H
#include <wlr/types/wlr_tablet_pad.h>
struct wlr_tablet_pad_impl {
const char *name;
};
void wlr_tablet_pad_init(struct wlr_tablet_pad *pad,
const struct wlr_tablet_pad_impl *impl, const char *name);
/**
* Cleans up the resources owned by a struct wlr_tablet_pad.
*
* This function will not clean the memory allocated by
* struct wlr_tablet_pad_group, it's the responsibility of the caller to clean
* it.
*/
void wlr_tablet_pad_finish(struct wlr_tablet_pad *pad);
#endif

View file

@ -0,0 +1,22 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_TABLET_TOOL_H
#define WLR_INTERFACES_WLR_TABLET_TOOL_H
#include <wlr/types/wlr_tablet_tool.h>
struct wlr_tablet_impl {
const char *name;
};
void wlr_tablet_init(struct wlr_tablet *tablet,
const struct wlr_tablet_impl *impl, const char *name);
void wlr_tablet_finish(struct wlr_tablet *tablet);
#endif

View file

@ -0,0 +1,22 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_INTERFACES_WLR_TOUCH_H
#define WLR_INTERFACES_WLR_TOUCH_H
#include <wlr/types/wlr_touch.h>
struct wlr_touch_impl {
const char *name;
};
void wlr_touch_init(struct wlr_touch *touch,
const struct wlr_touch_impl *impl, const char *name);
void wlr_touch_finish(struct wlr_touch *touch);
#endif

View file

@ -0,0 +1,70 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_ALLOCATOR_H
#define WLR_ALLOCATOR_H
#include <wayland-server-core.h>
struct wlr_allocator;
struct wlr_backend;
struct wlr_drm_format;
struct wlr_renderer;
struct wlr_allocator_interface {
struct wlr_buffer *(*create_buffer)(struct wlr_allocator *alloc,
int width, int height, const struct wlr_drm_format *format);
void (*destroy)(struct wlr_allocator *alloc);
};
void wlr_allocator_init(struct wlr_allocator *alloc,
const struct wlr_allocator_interface *impl, uint32_t buffer_caps);
struct wlr_allocator {
const struct wlr_allocator_interface *impl;
// Capabilities of the buffers created with this allocator
uint32_t buffer_caps;
struct {
struct wl_signal destroy;
} events;
};
/**
* Creates the adequate struct wlr_allocator given a backend and a renderer.
*/
struct wlr_allocator *wlr_allocator_autocreate(struct wlr_backend *backend,
struct wlr_renderer *renderer);
/**
* Destroy the allocator.
*/
void wlr_allocator_destroy(struct wlr_allocator *alloc);
/**
* Allocate a new buffer.
*
* When the caller is done with it, they must unreference it by calling
* wlr_buffer_drop().
*
* The `format` passed in indicates the format to use and the list of
* acceptable modifiers. The order in which modifiers are listed is not
* significant.
*
* When running with legacy drivers which don't support explicit modifiers, the
* allocator must recognize two modifiers: INVALID (for implicit tiling and/or
* compression) and LINEAR.
*
* The allocator must return a buffer using one of the modifiers listed. In
* particular, allocators must not return a buffer with an implicit modifier
* unless the user has allowed it by passing INVALID in the modifier list.
*/
struct wlr_buffer *wlr_allocator_create_buffer(struct wlr_allocator *alloc,
int width, int height, const struct wlr_drm_format *format);
#endif

View file

@ -0,0 +1,55 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_DMABUF_H
#define WLR_RENDER_DMABUF_H
#include <stdbool.h>
#include <stdint.h>
#define WLR_DMABUF_MAX_PLANES 4
/**
* A Linux DMA-BUF pixel buffer.
*
* If the buffer was allocated with explicit modifiers enabled, the `modifier`
* field must not be INVALID.
*
* If the buffer was allocated with explicit modifiers disabled (either because
* the driver doesn't support it, or because the user didn't specify a valid
* modifier list), the `modifier` field can have two values: INVALID means that
* an implicit vendor-defined modifier is in use, LINEAR means that the buffer
* is linear. The `modifier` field must not have any other value.
*
* When importing a DMA-BUF, users must not ignore the modifier unless it's
* INVALID or LINEAR. In particular, users must not import a DMA-BUF to a
* legacy API which doesn't support specifying an explicit modifier unless the
* modifier is set to INVALID or LINEAR.
*/
struct wlr_dmabuf_attributes {
int32_t width, height;
uint32_t format; // FourCC code, see DRM_FORMAT_* in <drm_fourcc.h>
uint64_t modifier; // see DRM_FORMAT_MOD_* in <drm_fourcc.h>
int n_planes;
uint32_t offset[WLR_DMABUF_MAX_PLANES];
uint32_t stride[WLR_DMABUF_MAX_PLANES];
int fd[WLR_DMABUF_MAX_PLANES];
};
/**
* Closes all file descriptors in the DMA-BUF attributes.
*/
void wlr_dmabuf_attributes_finish(struct wlr_dmabuf_attributes *attribs);
/**
* Clones the DMA-BUF attributes.
*/
bool wlr_dmabuf_attributes_copy(struct wlr_dmabuf_attributes *dst,
const struct wlr_dmabuf_attributes *src);
#endif

View file

@ -0,0 +1,97 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_DRM_FORMAT_SET_H
#define WLR_RENDER_DRM_FORMAT_SET_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
/** A single DRM format, with a set of modifiers attached. */
struct wlr_drm_format {
// The actual DRM format, from `drm_fourcc.h`
uint32_t format;
// The number of modifiers
size_t len;
// The capacity of the array; do not use.
size_t capacity;
// The actual modifiers
uint64_t *modifiers;
};
/**
* Free all resources allocated to this DRM format.
*/
void wlr_drm_format_finish(struct wlr_drm_format *format);
/**
* A set of DRM formats and modifiers.
*
* This is used to describe the supported format + modifier combinations. For
* instance, backends will report the set they can display, and renderers will
* report the set they can render to. For a more general overview of formats
* and modifiers, see:
* https://www.kernel.org/doc/html/next/userspace-api/dma-buf-alloc-exchange.html#formats-and-modifiers
*
* For compatibility with legacy drivers which don't support explicit
* modifiers, the special modifier DRM_FORMAT_MOD_INVALID is used to indicate
* that implicit modifiers are supported. Legacy drivers can also support the
* DRM_FORMAT_MOD_LINEAR modifier, which forces the buffer to have a linear
* layout.
*
* Users must not assume that implicit modifiers are supported unless INVALID
* is listed in the modifier list.
*/
struct wlr_drm_format_set {
// The number of formats
size_t len;
// The capacity of the array; private to wlroots
size_t capacity;
// A pointer to an array of `struct wlr_drm_format *` of length `len`.
struct wlr_drm_format *formats;
};
/**
* Free all of the DRM formats in the set, making the set empty.
*/
void wlr_drm_format_set_finish(struct wlr_drm_format_set *set);
/**
* Return a pointer to a member of this struct wlr_drm_format_set of format
* `format`, or NULL if none exists.
*/
const struct wlr_drm_format *wlr_drm_format_set_get(
const struct wlr_drm_format_set *set, uint32_t format);
bool wlr_drm_format_set_has(const struct wlr_drm_format_set *set,
uint32_t format, uint64_t modifier);
bool wlr_drm_format_set_add(struct wlr_drm_format_set *set, uint32_t format,
uint64_t modifier);
/**
* Intersect two DRM format sets `a` and `b`, storing in the destination set
* `dst` the format + modifier pairs which are in both source sets. The `dst`
* must either be zeroed or initialized with other state to be replaced.
*
* Returns false on failure or when the intersection is empty.
*/
bool wlr_drm_format_set_intersect(struct wlr_drm_format_set *dst,
const struct wlr_drm_format_set *a, const struct wlr_drm_format_set *b);
/**
* Unions DRM format set `a` and `b`, storing in the destination set
* `dst`. The `dst` must either be zeroed or initialized with other state
* to be replaced.
*
* Returns false on failure.
*/
bool wlr_drm_format_set_union(struct wlr_drm_format_set *dst,
const struct wlr_drm_format_set *a, const struct wlr_drm_format_set *b);
#endif

View file

@ -0,0 +1,56 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_EGL_H
#define WLR_RENDER_EGL_H
#ifndef EGL_NO_X11
#define EGL_NO_X11
#endif
#ifndef EGL_NO_PLATFORM_SPECIFIC_TYPES
#define EGL_NO_PLATFORM_SPECIFIC_TYPES
#endif
#include <wlr/config.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <pixman.h>
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
#include <wlr/render/drm_format_set.h>
struct wlr_egl;
/**
* Create a struct wlr_egl with an existing EGL display and context.
*
* This is typically used by compositors which want to customize EGL
* initialization.
*/
struct wlr_egl *wlr_egl_create_with_context(EGLDisplay display,
EGLContext context);
/**
* Get the EGL display used by the struct wlr_egl.
*
* This is typically used by compositors which need to perform custom OpenGL
* operations.
*/
EGLDisplay wlr_egl_get_display(struct wlr_egl *egl);
/**
* Get the EGL context used by the struct wlr_egl.
*
* This is typically used by compositors which need to perform custom OpenGL
* operations.
*/
EGLContext wlr_egl_get_context(struct wlr_egl *egl);
#endif

View file

@ -0,0 +1,41 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_GLES2_H
#define WLR_RENDER_GLES2_H
#include <GLES2/gl2.h>
#include <wlr/render/wlr_renderer.h>
struct wlr_egl;
struct wlr_renderer *wlr_gles2_renderer_create_with_drm_fd(int drm_fd);
struct wlr_renderer *wlr_gles2_renderer_create(struct wlr_egl *egl);
struct wlr_egl *wlr_gles2_renderer_get_egl(struct wlr_renderer *renderer);
bool wlr_gles2_renderer_check_ext(struct wlr_renderer *renderer,
const char *ext);
/**
* Returns the OpenGL FBO of current buffer.
*/
GLuint wlr_gles2_renderer_get_current_fbo(struct wlr_renderer *wlr_renderer);
struct wlr_gles2_texture_attribs {
GLenum target; /* either GL_TEXTURE_2D or GL_TEXTURE_EXTERNAL_OES */
GLuint tex;
bool has_alpha;
};
bool wlr_renderer_is_gles2(struct wlr_renderer *wlr_renderer);
bool wlr_render_timer_is_gles2(struct wlr_render_timer *timer);
bool wlr_texture_is_gles2(struct wlr_texture *texture);
void wlr_gles2_texture_get_attribs(struct wlr_texture *texture,
struct wlr_gles2_texture_attribs *attribs);
#endif

View file

@ -0,0 +1,101 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_INTERFACE_H
#define WLR_RENDER_INTERFACE_H
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_output.h>
#include <wlr/render/dmabuf.h>
struct wlr_box;
struct wlr_fbox;
struct wlr_renderer_impl {
bool (*bind_buffer)(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);
bool (*begin)(struct wlr_renderer *renderer, uint32_t width,
uint32_t height);
void (*end)(struct wlr_renderer *renderer);
void (*clear)(struct wlr_renderer *renderer, const float color[static 4]);
void (*scissor)(struct wlr_renderer *renderer, struct wlr_box *box);
bool (*render_subtexture_with_matrix)(struct wlr_renderer *renderer,
struct wlr_texture *texture, const struct wlr_fbox *box,
const float matrix[static 9], float alpha);
void (*render_quad_with_matrix)(struct wlr_renderer *renderer,
const float color[static 4], const float matrix[static 9]);
const uint32_t *(*get_shm_texture_formats)(
struct wlr_renderer *renderer, size_t *len);
const struct wlr_drm_format_set *(*get_dmabuf_texture_formats)(
struct wlr_renderer *renderer);
const struct wlr_drm_format_set *(*get_render_formats)(
struct wlr_renderer *renderer);
uint32_t (*preferred_read_format)(struct wlr_renderer *renderer);
bool (*read_pixels)(struct wlr_renderer *renderer, uint32_t fmt,
uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y,
void *data);
void (*destroy)(struct wlr_renderer *renderer);
int (*get_drm_fd)(struct wlr_renderer *renderer);
uint32_t (*get_render_buffer_caps)(struct wlr_renderer *renderer);
struct wlr_texture *(*texture_from_buffer)(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);
struct wlr_render_pass *(*begin_buffer_pass)(struct wlr_renderer *renderer,
struct wlr_buffer *buffer, const struct wlr_buffer_pass_options *options);
struct wlr_render_timer *(*render_timer_create)(struct wlr_renderer *renderer);
};
void wlr_renderer_init(struct wlr_renderer *renderer,
const struct wlr_renderer_impl *impl);
struct wlr_texture_impl {
bool (*update_from_buffer)(struct wlr_texture *texture,
struct wlr_buffer *buffer, const pixman_region32_t *damage);
void (*destroy)(struct wlr_texture *texture);
};
void wlr_texture_init(struct wlr_texture *texture, struct wlr_renderer *rendener,
const struct wlr_texture_impl *impl, uint32_t width, uint32_t height);
struct wlr_render_pass {
const struct wlr_render_pass_impl *impl;
};
void wlr_render_pass_init(struct wlr_render_pass *pass,
const struct wlr_render_pass_impl *impl);
struct wlr_render_pass_impl {
bool (*submit)(struct wlr_render_pass *pass);
void (*add_texture)(struct wlr_render_pass *pass,
const struct wlr_render_texture_options *options);
/* Implementers are also guaranteed that options->box is nonempty */
void (*add_rect)(struct wlr_render_pass *pass,
const struct wlr_render_rect_options *options);
};
struct wlr_render_timer {
const struct wlr_render_timer_impl *impl;
};
struct wlr_render_timer_impl {
int (*get_duration_ns)(struct wlr_render_timer *timer);
void (*destroy)(struct wlr_render_timer *timer);
};
void wlr_render_texture_options_get_src_box(const struct wlr_render_texture_options *options,
struct wlr_fbox *box);
void wlr_render_texture_options_get_dst_box(const struct wlr_render_texture_options *options,
struct wlr_box *box);
float wlr_render_texture_options_get_alpha(const struct wlr_render_texture_options *options);
void wlr_render_rect_options_get_box(const struct wlr_render_rect_options *options,
const struct wlr_buffer *buffer, struct wlr_box *box);
#endif

View file

@ -0,0 +1,123 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_PASS_H
#define WLR_RENDER_PASS_H
#include <pixman.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wlr/util/box.h>
struct wlr_renderer;
struct wlr_buffer;
/**
* A render pass accumulates drawing operations until submitted to the GPU.
*/
struct wlr_render_pass;
/**
* An object that can be queried after a render to get the duration of the render.
*/
struct wlr_render_timer;
struct wlr_buffer_pass_options {
/* Timer to measure the duration of the render pass */
struct wlr_render_timer *timer;
};
/**
* Begin a new render pass with the supplied destination buffer.
*
* Callers must call wlr_render_pass_submit() once they are done with the
* render pass.
*/
struct wlr_render_pass *wlr_renderer_begin_buffer_pass(struct wlr_renderer *renderer,
struct wlr_buffer *buffer, const struct wlr_buffer_pass_options *options);
/**
* Submit the render pass.
*
* The render pass cannot be used after this function is called.
*/
bool wlr_render_pass_submit(struct wlr_render_pass *render_pass);
/**
* Blend modes.
*/
enum wlr_render_blend_mode {
/* Pre-multiplied alpha (default) */
WLR_RENDER_BLEND_MODE_PREMULTIPLIED,
/* Blending is disabled */
WLR_RENDER_BLEND_MODE_NONE,
};
/**
* Filter modes.
*/
enum wlr_scale_filter_mode {
/* bilinear texture filtering (default) */
WLR_SCALE_FILTER_BILINEAR,
/* nearest texture filtering */
WLR_SCALE_FILTER_NEAREST,
};
struct wlr_render_texture_options {
/* Source texture */
struct wlr_texture *texture;
/* Source coordinates, leave empty to render the whole texture */
struct wlr_fbox src_box;
/* Destination coordinates, width/height default to the texture size */
struct wlr_box dst_box;
/* Opacity between 0 (transparent) and 1 (opaque), leave NULL for opaque */
const float *alpha;
/* Clip region, leave NULL to disable clipping */
const pixman_region32_t *clip;
/* Transform applied to the source texture */
enum wl_output_transform transform;
/* Filtering */
enum wlr_scale_filter_mode filter_mode;
/* Blend mode */
enum wlr_render_blend_mode blend_mode;
};
/**
* Render a texture.
*/
void wlr_render_pass_add_texture(struct wlr_render_pass *render_pass,
const struct wlr_render_texture_options *options);
/**
* A color value.
*
* Each channel has values between 0 and 1 inclusive. The R, G, B
* channels need to be pre-multiplied by A.
*/
struct wlr_render_color {
float r, g, b, a;
};
struct wlr_render_rect_options {
/* Rectangle coordinates */
struct wlr_box box;
/* Source color */
struct wlr_render_color color;
/* Clip region, leave NULL to disable clipping */
const pixman_region32_t *clip;
/* Blend mode */
enum wlr_render_blend_mode blend_mode;
};
/**
* Render a rectangle.
*/
void wlr_render_pass_add_rect(struct wlr_render_pass *render_pass,
const struct wlr_render_rect_options *options);
#endif

View file

@ -0,0 +1,26 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_PIXMAN_H
#define WLR_RENDER_PIXMAN_H
#include <pixman.h>
#include <wlr/render/wlr_renderer.h>
struct wlr_renderer *wlr_pixman_renderer_create(void);
/**
* Returns the image of current buffer.
*/
pixman_image_t *wlr_pixman_renderer_get_current_image(
struct wlr_renderer *wlr_renderer);
bool wlr_renderer_is_pixman(struct wlr_renderer *wlr_renderer);
bool wlr_texture_is_pixman(struct wlr_texture *texture);
pixman_image_t *wlr_pixman_texture_get_image(struct wlr_texture *wlr_texture);
#endif

View file

@ -0,0 +1,50 @@
#ifndef WLR_RENDER_SWAPCHAIN_H
#define WLR_RENDER_SWAPCHAIN_H
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/render/drm_format_set.h>
#define WLR_SWAPCHAIN_CAP 4
struct wlr_swapchain_slot {
struct wlr_buffer *buffer;
bool acquired; // waiting for release
int age;
struct wl_listener release;
};
struct wlr_swapchain {
struct wlr_allocator *allocator; // NULL if destroyed
int width, height;
struct wlr_drm_format format;
struct wlr_swapchain_slot slots[WLR_SWAPCHAIN_CAP];
struct wl_listener allocator_destroy;
};
struct wlr_swapchain *wlr_swapchain_create(
struct wlr_allocator *alloc, int width, int height,
const struct wlr_drm_format *format);
void wlr_swapchain_destroy(struct wlr_swapchain *swapchain);
/**
* Acquire a buffer from the swap chain.
*
* The returned buffer is locked. When the caller is done with it, they must
* unlock it by calling wlr_buffer_unlock.
*/
struct wlr_buffer *wlr_swapchain_acquire(struct wlr_swapchain *swapchain,
int *age);
/**
* Mark the buffer as submitted for presentation. This needs to be called by
* swap chain users on frame boundaries.
*
* If the buffer hasn't been created via the swap chain, the call is ignored.
*/
void wlr_swapchain_set_buffer_submitted(struct wlr_swapchain *swapchain,
struct wlr_buffer *buffer);
#endif

View file

@ -0,0 +1,177 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_WLR_RENDERER_H
#define WLR_RENDER_WLR_RENDERER_H
#include <stdint.h>
#include <wayland-server-core.h>
#include <wlr/render/pass.h>
#include <wlr/render/wlr_texture.h>
#include <wlr/util/box.h>
struct wlr_backend;
struct wlr_renderer_impl;
struct wlr_drm_format_set;
struct wlr_buffer;
struct wlr_box;
struct wlr_fbox;
/**
* A renderer for basic 2D operations.
*/
struct wlr_renderer {
struct {
struct wl_signal destroy;
/**
* Emitted when the GPU is lost, e.g. on GPU reset.
*
* Compositors should destroy the renderer and re-create it.
*/
struct wl_signal lost;
} events;
// private state
const struct wlr_renderer_impl *impl;
bool rendering;
bool rendering_with_buffer;
};
/**
* Automatically create a new renderer.
*
* Selects an appropriate renderer type to use depending on the backend,
* platform, environment, etc.
*/
struct wlr_renderer *wlr_renderer_autocreate(struct wlr_backend *backend);
/**
* Start a render pass with the provided viewport.
*
* This should be called after wlr_output_attach_render(). Compositors must call
* wlr_renderer_end() when they are done.
*
* Returns false on failure, in which case compositors shouldn't try rendering.
*/
bool wlr_renderer_begin(struct wlr_renderer *r, uint32_t width, uint32_t height);
/**
* Start a render pass on the provided struct wlr_buffer.
*
* Compositors must call wlr_renderer_end() when they are done.
*/
bool wlr_renderer_begin_with_buffer(struct wlr_renderer *r,
struct wlr_buffer *buffer);
/**
* End a render pass.
*/
void wlr_renderer_end(struct wlr_renderer *r);
/**
* Clear the viewport with the provided color.
*/
void wlr_renderer_clear(struct wlr_renderer *r, const float color[static 4]);
/**
* Defines a scissor box. Only pixels that lie within the scissor box can be
* modified by drawing functions. Providing a NULL `box` disables the scissor
* box.
*/
void wlr_renderer_scissor(struct wlr_renderer *r, struct wlr_box *box);
/**
* Renders the requested texture.
*/
bool wlr_render_texture(struct wlr_renderer *r, struct wlr_texture *texture,
const float projection[static 9], int x, int y, float alpha);
/**
* Renders the requested texture using the provided matrix.
*/
bool wlr_render_texture_with_matrix(struct wlr_renderer *r,
struct wlr_texture *texture, const float matrix[static 9], float alpha);
/**
* Renders the requested texture using the provided matrix, after cropping it
* to the provided rectangle.
*/
bool wlr_render_subtexture_with_matrix(struct wlr_renderer *r,
struct wlr_texture *texture, const struct wlr_fbox *box,
const float matrix[static 9], float alpha);
/**
* Renders a solid rectangle in the specified color.
*/
void wlr_render_rect(struct wlr_renderer *r, const struct wlr_box *box,
const float color[static 4], const float projection[static 9]);
/**
* Renders a solid quadrangle in the specified color with the specified matrix.
*/
void wlr_render_quad_with_matrix(struct wlr_renderer *r,
const float color[static 4], const float matrix[static 9]);
/**
* Get the shared-memory formats supporting import usage. Buffers allocated
* with a format from this list may be imported via wlr_texture_from_pixels().
*/
const uint32_t *wlr_renderer_get_shm_texture_formats(
struct wlr_renderer *r, size_t *len);
/**
* Get the DMA-BUF formats supporting sampling usage. Buffers allocated with
* a format from this list may be imported via wlr_texture_from_dmabuf().
*/
const struct wlr_drm_format_set *wlr_renderer_get_dmabuf_texture_formats(
struct wlr_renderer *renderer);
/**
* Reads out of pixels of the currently bound surface into data. `stride` is in
* bytes.
*/
bool wlr_renderer_read_pixels(struct wlr_renderer *r, uint32_t fmt,
uint32_t stride, uint32_t width, uint32_t height,
uint32_t src_x, uint32_t src_y, uint32_t dst_x, uint32_t dst_y, void *data);
/**
* Initializes wl_shm, linux-dmabuf and other buffer factory protocols.
*
* Returns false on failure.
*/
bool wlr_renderer_init_wl_display(struct wlr_renderer *r,
struct wl_display *wl_display);
/**
* Initializes wl_shm on the provided struct wl_display.
*/
bool wlr_renderer_init_wl_shm(struct wlr_renderer *r,
struct wl_display *wl_display);
/**
* Obtains the FD of the DRM device used for rendering, or -1 if unavailable.
*
* The caller doesn't have ownership of the FD, it must not close it.
*/
int wlr_renderer_get_drm_fd(struct wlr_renderer *r);
/**
* Destroys the renderer.
*
* Textures must be destroyed separately.
*/
void wlr_renderer_destroy(struct wlr_renderer *renderer);
/**
* Allocate and initialise a new render timer.
*/
struct wlr_render_timer *wlr_render_timer_create(struct wlr_renderer *renderer);
/**
* Get the render duration in nanoseconds from the timer.
*
* Returns -1 if the duration is unavailable.
*/
int wlr_render_timer_get_duration_ns(struct wlr_render_timer *timer);
/**
* Destroy the render timer.
*/
void wlr_render_timer_destroy(struct wlr_render_timer *timer);
#endif

View file

@ -0,0 +1,66 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_RENDER_WLR_TEXTURE_H
#define WLR_RENDER_WLR_TEXTURE_H
#include <pixman.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
struct wlr_buffer;
struct wlr_renderer;
struct wlr_texture_impl;
struct wlr_texture {
const struct wlr_texture_impl *impl;
uint32_t width, height;
struct wlr_renderer *renderer;
};
/**
* Create a new texture from raw pixel data. `stride` is in bytes. The returned
* texture is mutable.
*/
struct wlr_texture *wlr_texture_from_pixels(struct wlr_renderer *renderer,
uint32_t fmt, uint32_t stride, uint32_t width, uint32_t height,
const void *data);
/**
* Create a new texture from a DMA-BUF. The returned texture is immutable.
*/
struct wlr_texture *wlr_texture_from_dmabuf(struct wlr_renderer *renderer,
struct wlr_dmabuf_attributes *attribs);
/**
* Update a texture with a struct wlr_buffer's contents.
*
* The update might be rejected (in case the texture is immutable, the buffer
* has an unsupported type/format, etc), so callers must be prepared to fall
* back to re-creating the texture from scratch via wlr_texture_from_buffer().
*
* The damage can be used by the renderer as an optimization: only the supplied
* region needs to be updated.
*/
bool wlr_texture_update_from_buffer(struct wlr_texture *texture,
struct wlr_buffer *buffer, const pixman_region32_t *damage);
/**
* Destroys the texture.
*/
void wlr_texture_destroy(struct wlr_texture *texture);
/**
* Create a new texture from a buffer.
*/
struct wlr_texture *wlr_texture_from_buffer(struct wlr_renderer *renderer,
struct wlr_buffer *buffer);
#endif

View file

@ -0,0 +1,164 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_BUFFER_H
#define WLR_TYPES_WLR_BUFFER_H
#include <pixman.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
#include <wlr/util/addon.h>
struct wlr_buffer;
struct wlr_renderer;
struct wlr_shm_attributes {
int fd;
uint32_t format;
int width, height, stride;
off_t offset;
};
/**
* Buffer capabilities.
*
* These bits indicate the features supported by a struct wlr_buffer. There is
* one bit per function in struct wlr_buffer_impl.
*/
enum wlr_buffer_cap {
WLR_BUFFER_CAP_DATA_PTR = 1 << 0,
WLR_BUFFER_CAP_DMABUF = 1 << 1,
WLR_BUFFER_CAP_SHM = 1 << 2,
};
/**
* A buffer containing pixel data.
*
* A buffer has a single producer (the party who created the buffer) and
* multiple consumers (parties reading the buffer). When all consumers are done
* with the buffer, it gets released and can be re-used by the producer. When
* the producer and all consumers are done with the buffer, it gets destroyed.
*/
struct wlr_buffer {
const struct wlr_buffer_impl *impl;
int width, height;
bool dropped;
size_t n_locks;
bool accessing_data_ptr;
struct {
struct wl_signal destroy;
struct wl_signal release;
} events;
struct wlr_addon_set addons;
};
/**
* Unreference the buffer. This function should be called by producers when
* they are done with the buffer.
*/
void wlr_buffer_drop(struct wlr_buffer *buffer);
/**
* Lock the buffer. This function should be called by consumers to make
* sure the buffer can be safely read from. Once the consumer is done with the
* buffer, they should call wlr_buffer_unlock().
*/
struct wlr_buffer *wlr_buffer_lock(struct wlr_buffer *buffer);
/**
* Unlock the buffer. This function should be called by consumers once they are
* done with the buffer.
*/
void wlr_buffer_unlock(struct wlr_buffer *buffer);
/**
* Reads the DMA-BUF attributes of the buffer. If this buffer isn't a DMA-BUF,
* returns false.
*
* The returned DMA-BUF attributes are valid for the lifetime of the
* struct wlr_buffer. The caller isn't responsible for cleaning up the DMA-BUF
* attributes.
*/
bool wlr_buffer_get_dmabuf(struct wlr_buffer *buffer,
struct wlr_dmabuf_attributes *attribs);
/**
* Read shared memory attributes of the buffer. If this buffer isn't shared
* memory, returns false.
*
* The returned shared memory attributes are valid for the lifetime of the
* struct wlr_buffer. The caller isn't responsible for cleaning up the shared
* memory attributes.
*/
bool wlr_buffer_get_shm(struct wlr_buffer *buffer,
struct wlr_shm_attributes *attribs);
/**
* Transforms a struct wl_resource into a struct wlr_buffer and locks it. Once
* the caller is done with the buffer, they must call wlr_buffer_unlock().
*
* The provided struct wl_resource must be a wl_buffer.
*/
struct wlr_buffer *wlr_buffer_try_from_resource(struct wl_resource *resource);
/**
* Buffer data pointer access flags.
*/
enum wlr_buffer_data_ptr_access_flag {
/**
* The buffer contents can be read back.
*/
WLR_BUFFER_DATA_PTR_ACCESS_READ = 1 << 0,
/**
* The buffer contents can be written to.
*/
WLR_BUFFER_DATA_PTR_ACCESS_WRITE = 1 << 1,
};
/**
* Get a pointer to a region of memory referring to the buffer's underlying
* storage. The format and stride can be used to interpret the memory region
* contents.
*
* The returned pointer should be pointing to a valid memory region for the
* operations specified in the flags. The returned pointer is only valid up to
* the next wlr_buffer_end_data_ptr_access() call.
*/
bool wlr_buffer_begin_data_ptr_access(struct wlr_buffer *buffer, uint32_t flags,
void **data, uint32_t *format, size_t *stride);
void wlr_buffer_end_data_ptr_access(struct wlr_buffer *buffer);
/**
* A client buffer.
*/
struct wlr_client_buffer {
struct wlr_buffer base;
/**
* The buffer's texture, if any. A buffer will not have a texture if the
* client destroys the buffer before it has been released.
*/
struct wlr_texture *texture;
/**
* The buffer this client buffer was created from. NULL if destroyed.
*/
struct wlr_buffer *source;
// private state
struct wl_listener source_destroy;
size_t n_ignore_locks;
};
/**
* Get a client buffer from a generic buffer. If the buffer isn't a client
* buffer, returns NULL.
*/
struct wlr_client_buffer *wlr_client_buffer_get(struct wlr_buffer *buffer);
#endif

View file

@ -0,0 +1,427 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_COMPOSITOR_H
#define WLR_TYPES_WLR_COMPOSITOR_H
#include <pixman.h>
#include <stdbool.h>
#include <stdint.h>
#include <time.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_output.h>
#include <wlr/util/addon.h>
#include <wlr/util/box.h>
enum wlr_surface_state_field {
WLR_SURFACE_STATE_BUFFER = 1 << 0,
WLR_SURFACE_STATE_SURFACE_DAMAGE = 1 << 1,
WLR_SURFACE_STATE_BUFFER_DAMAGE = 1 << 2,
WLR_SURFACE_STATE_OPAQUE_REGION = 1 << 3,
WLR_SURFACE_STATE_INPUT_REGION = 1 << 4,
WLR_SURFACE_STATE_TRANSFORM = 1 << 5,
WLR_SURFACE_STATE_SCALE = 1 << 6,
WLR_SURFACE_STATE_FRAME_CALLBACK_LIST = 1 << 7,
WLR_SURFACE_STATE_VIEWPORT = 1 << 8,
WLR_SURFACE_STATE_OFFSET = 1 << 9,
};
struct wlr_surface_state {
uint32_t committed; // enum wlr_surface_state_field
// Sequence number of the surface state. Incremented on each commit, may
// overflow.
uint32_t seq;
struct wlr_buffer *buffer;
int32_t dx, dy; // relative to previous position
pixman_region32_t surface_damage, buffer_damage; // clipped to bounds
pixman_region32_t opaque, input;
enum wl_output_transform transform;
int32_t scale;
struct wl_list frame_callback_list; // wl_resource
int width, height; // in surface-local coordinates
int buffer_width, buffer_height;
struct wl_list subsurfaces_below;
struct wl_list subsurfaces_above;
/**
* The viewport is applied after the surface transform and scale.
*
* If has_src is true, the surface content is cropped to the provided
* rectangle. If has_dst is true, the surface content is scaled to the
* provided rectangle.
*/
struct {
bool has_src, has_dst;
// In coordinates after scale/transform are applied, but before the
// destination rectangle is applied
struct wlr_fbox src;
int dst_width, dst_height; // in surface-local coordinates
} viewport;
// Number of locks that prevent this surface state from being committed.
size_t cached_state_locks;
struct wl_list cached_state_link; // wlr_surface.cached
};
struct wlr_surface_role {
const char *name;
/**
* If true, the role isn't represented by any object.
* For example, this applies to cursor surfaces.
*/
bool no_object;
/**
* Called when a new surface state is committed. May be NULL.
*
* If the role is represented by an object, this is only called if
* such object exists.
*/
void (*commit)(struct wlr_surface *surface);
/**
* Called when the surface is unmapped. May be NULL.
*
* If the role is represented by an object, this is only called if
* such object exists.
*/
void (*unmap)(struct wlr_surface *surface);
/**
* Called when the object representing the role is destroyed. May be NULL.
*/
void (*destroy)(struct wlr_surface *surface);
};
struct wlr_surface_output {
struct wlr_surface *surface;
struct wlr_output *output;
struct wl_list link; // wlr_surface.current_outputs
struct wl_listener bind;
struct wl_listener destroy;
};
struct wlr_surface {
struct wl_resource *resource;
struct wlr_renderer *renderer; // may be NULL
/**
* The surface's buffer, if any. A surface has an attached buffer when it
* commits with a non-null buffer in its pending state. A surface will not
* have a buffer if it has never committed one, has committed a null buffer,
* or something went wrong with uploading the buffer.
*/
struct wlr_client_buffer *buffer;
/**
* The last commit's buffer damage, in buffer-local coordinates. This
* contains both the damage accumulated by the client via
* `wlr_surface_state.surface_damage` and `wlr_surface_state.buffer_damage`.
* If the buffer has been resized, the whole buffer is damaged.
*
* This region needs to be scaled and transformed into output coordinates,
* just like the buffer's texture. In addition, if the buffer has shrunk the
* old size needs to be damaged and if the buffer has moved the old and new
* positions need to be damaged.
*/
pixman_region32_t buffer_damage;
/**
* The last commit's damage caused by surface and its subsurfaces'
* movement, in surface-local coordinates.
*/
pixman_region32_t external_damage;
/**
* The current opaque region, in surface-local coordinates. It is clipped to
* the surface bounds. If the surface's buffer is using a fully opaque
* format, this is set to the whole surface.
*/
pixman_region32_t opaque_region;
/**
* The current input region, in surface-local coordinates. It is clipped to
* the surface bounds.
*
* If the protocol states that the input region is ignored, this is empty.
*/
pixman_region32_t input_region;
/**
* `current` contains the current, committed surface state. `pending`
* accumulates state changes from the client between commits and shouldn't
* be accessed by the compositor directly.
*/
struct wlr_surface_state current, pending;
struct wl_list cached; // wlr_surface_state.cached_link
/**
* Whether the surface is ready to be displayed.
*/
bool mapped;
/**
* The lifetime-bound role of the surface. NULL if the role was never set.
*/
const struct wlr_surface_role *role;
/**
* The role object representing the role. NULL if the role isn't
* represented by any object or the object was destroyed.
*/
struct wl_resource *role_resource;
struct {
struct wl_signal client_commit;
struct wl_signal precommit; // const struct wlr_surface_state *
struct wl_signal commit;
/**
* The `map` event signals that the surface has a non-null buffer
* committed and is ready to be displayed.
*/
struct wl_signal map;
/**
* The `unmap` event signals that the surface shouldn't be displayed
* anymore. This can happen when a null buffer is committed,
* the associated role object is destroyed, or when the role-specific
* conditions for the surface to be mapped no longer apply.
*/
struct wl_signal unmap;
struct wl_signal new_subsurface;
struct wl_signal destroy;
} events;
struct wl_list current_outputs; // wlr_surface_output.link
struct wlr_addon_set addons;
void *data;
// private state
struct wl_listener renderer_destroy;
struct wl_listener role_resource_destroy;
struct {
int32_t scale;
enum wl_output_transform transform;
int width, height;
int buffer_width, buffer_height;
} previous;
bool unmap_commit;
bool opaque;
bool has_buffer;
int32_t preferred_buffer_scale;
bool preferred_buffer_transform_sent;
enum wl_output_transform preferred_buffer_transform;
};
struct wlr_renderer;
struct wlr_compositor {
struct wl_global *global;
struct wlr_renderer *renderer; // may be NULL
struct wl_listener display_destroy;
struct {
struct wl_signal new_surface;
struct wl_signal destroy;
} events;
};
typedef void (*wlr_surface_iterator_func_t)(struct wlr_surface *surface,
int sx, int sy, void *data);
/**
* Set the lifetime role for this surface.
*
* If the surface already has a different role and/or has a role object set,
* the function fails and sends an error to the client.
*
* Returns true on success, false otherwise.
*/
bool wlr_surface_set_role(struct wlr_surface *surface, const struct wlr_surface_role *role,
struct wl_resource *error_resource, uint32_t error_code);
/**
* Set the role object for this surface. The surface must have a role and
* no already set role object.
*
* When the resource is destroyed, the surface is unmapped,
* wlr_surface_role.destroy is called and the role object is unset.
*/
void wlr_surface_set_role_object(struct wlr_surface *surface, struct wl_resource *role_resource);
/**
* Map the surface. If the surface is already mapped, this is no-op.
*
* This function must only be used by surface role implementations.
*/
void wlr_surface_map(struct wlr_surface *surface);
/**
* Unmap the surface. If the surface is already unmapped, this is no-op.
*
* This function must only be used by surface role implementations.
*/
void wlr_surface_unmap(struct wlr_surface *surface);
/**
* Whether or not this surface currently has an attached buffer. A surface has
* an attached buffer when it commits with a non-null buffer in its pending
* state. A surface will not have a buffer if it has never committed one, has
* committed a null buffer, or something went wrong with uploading the buffer.
*/
bool wlr_surface_has_buffer(struct wlr_surface *surface);
/**
* Get the texture of the buffer currently attached to this surface. Returns
* NULL if no buffer is currently attached or if something went wrong with
* uploading the buffer.
*/
struct wlr_texture *wlr_surface_get_texture(struct wlr_surface *surface);
/**
* Get the root of the subsurface tree for this surface. Can return NULL if
* a surface in the tree has been destroyed.
*/
struct wlr_surface *wlr_surface_get_root_surface(struct wlr_surface *surface);
/**
* Check if the surface accepts input events at the given surface-local
* coordinates. Does not check the surface's subsurfaces.
*/
bool wlr_surface_point_accepts_input(struct wlr_surface *surface,
double sx, double sy);
/**
* Find a surface in this surface's tree that accepts input events and has all
* parents mapped (except this surface, which can be unmapped) at the given
* surface-local coordinates. Returns the surface and coordinates in the leaf
* surface coordinate system or NULL if no surface is found at that location.
*/
struct wlr_surface *wlr_surface_surface_at(struct wlr_surface *surface,
double sx, double sy, double *sub_x, double *sub_y);
/**
* Notify the client that the surface has entered an output.
*
* This is a no-op if the surface has already entered the output.
*/
void wlr_surface_send_enter(struct wlr_surface *surface,
struct wlr_output *output);
/**
* Notify the client that the surface has left an output.
*
* This is a no-op if the surface has already left the output.
*/
void wlr_surface_send_leave(struct wlr_surface *surface,
struct wlr_output *output);
/**
* Complete the queued frame callbacks for this surface.
*
* This will send an event to the client indicating that now is a good time to
* draw its next frame.
*/
void wlr_surface_send_frame_done(struct wlr_surface *surface,
const struct timespec *when);
/**
* Get the bounding box that contains the surface and all subsurfaces in
* surface coordinates.
* X and y may be negative, if there are subsurfaces with negative position.
*/
void wlr_surface_get_extends(struct wlr_surface *surface, struct wlr_box *box);
/**
* Get the struct wlr_surface corresponding to a wl_surface resource.
*
* This asserts that the resource is a valid wl_surface resource created by
* wlroots and will never return NULL.
*/
struct wlr_surface *wlr_surface_from_resource(struct wl_resource *resource);
/**
* Call `iterator` on each mapped surface in the surface tree (whether or not
* this surface is mapped), with the surface's position relative to the root
* surface. The function is called from root to leaves (in rendering order).
*/
void wlr_surface_for_each_surface(struct wlr_surface *surface,
wlr_surface_iterator_func_t iterator, void *user_data);
/**
* Get the effective surface damage in surface-local coordinate space. Besides
* buffer damage, this includes damage induced by resizing and moving the
* surface and its subsurfaces. The resulting damage is not expected to be
* bounded by the surface itself.
*/
void wlr_surface_get_effective_damage(struct wlr_surface *surface,
pixman_region32_t *damage);
/**
* Get the source rectangle describing the region of the buffer that needs to
* be sampled to render this surface's current state. The box is in
* buffer-local coordinates.
*
* If the viewport's source rectangle is unset, the position is zero and the
* size is the buffer's.
*/
void wlr_surface_get_buffer_source_box(struct wlr_surface *surface,
struct wlr_fbox *box);
/**
* Acquire a lock for the pending surface state.
*
* The state won't be committed before the caller releases the lock. Instead,
* the state becomes cached. The caller needs to use wlr_surface_unlock_cached()
* to release the lock.
*
* Returns a surface commit sequence number for the cached state.
*/
uint32_t wlr_surface_lock_pending(struct wlr_surface *surface);
/**
* Release a lock for a cached state.
*
* Callers should not assume that the cached state will immediately be
* committed. Another caller may still have an active lock.
*/
void wlr_surface_unlock_cached(struct wlr_surface *surface, uint32_t seq);
/**
* Set the preferred buffer scale for the surface.
*
* This sends an event to the client indicating the preferred scale to use for
* buffers attached to this surface.
*/
void wlr_surface_set_preferred_buffer_scale(struct wlr_surface *surface,
int32_t scale);
/**
* Set the preferred buffer transform for the surface.
*
* This sends an event to the client indicating the preferred transform to use
* for buffers attached to this surface.
*/
void wlr_surface_set_preferred_buffer_transform(struct wlr_surface *surface,
enum wl_output_transform transform);
/**
* Create the wl_compositor global, which can be used by clients to create
* surfaces and regions.
*
* If a renderer is supplied, the compositor will create struct wlr_texture
* objects from client buffers on surface commit.
*/
struct wlr_compositor *wlr_compositor_create(struct wl_display *display,
uint32_t version, struct wlr_renderer *renderer);
#endif

View file

@ -0,0 +1,36 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_CONTENT_TYPE_V1_H
#define WLR_TYPES_WLR_CONTENT_TYPE_V1_H
#include <wayland-server-core.h>
#include "content-type-v1-protocol.h"
struct wlr_surface;
struct wlr_content_type_manager_v1 {
struct wl_global *global;
struct {
struct wl_signal destroy;
} events;
void *data;
// private state
struct wl_listener display_destroy;
};
struct wlr_content_type_manager_v1 *wlr_content_type_manager_v1_create(
struct wl_display *display, uint32_t version);
enum wp_content_type_v1_type wlr_surface_get_content_type_v1(
struct wlr_content_type_manager_v1 *manager, struct wlr_surface *surface);
#endif

View file

@ -0,0 +1,218 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_CURSOR_H
#define WLR_TYPES_WLR_CURSOR_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_output_layout.h>
#include <wlr/types/wlr_output.h>
struct wlr_input_device;
struct wlr_xcursor_manager;
/**
* wlr_cursor implements the behavior of the "cursor", that is, the image on the
* screen typically moved about with a mouse or so. It provides tracking for
* this in global coordinates, and integrates with struct wlr_output,
* struct wlr_output_layout, and struct wlr_input_device. You can use it to
* abstract multiple input devices over a single cursor, constrain cursor
* movement to the usable area of a struct wlr_output_layout and communicate
* position updates to the hardware cursor, constrain specific input devices to
* specific outputs or regions of the screen, and so on.
*/
struct wlr_box;
struct wlr_cursor_state;
struct wlr_cursor {
struct wlr_cursor_state *state;
double x, y;
/**
* The interpretation of these signals is the responsibility of the
* compositor, but some helpers are provided for your benefit. If you
* receive a relative motion event, for example, you may want to call
* wlr_cursor_move(). If you receive an absolute event, call
* wlr_cursor_warp_absolute(). If you pass an input device into these
* functions, it will apply the region/output constraints associated with
* that device to the resulting cursor motion. If an output layout is
* attached, these functions will constrain the resulting cursor motion to
* within the usable space of the output layout.
*
* Re-broadcasting these signals to, for example, a struct wlr_seat, is also
* your responsibility.
*/
struct {
struct wl_signal motion;
struct wl_signal motion_absolute;
struct wl_signal button;
struct wl_signal axis;
struct wl_signal frame;
struct wl_signal swipe_begin;
struct wl_signal swipe_update;
struct wl_signal swipe_end;
struct wl_signal pinch_begin;
struct wl_signal pinch_update;
struct wl_signal pinch_end;
struct wl_signal hold_begin;
struct wl_signal hold_end;
struct wl_signal touch_up;
struct wl_signal touch_down;
struct wl_signal touch_motion;
struct wl_signal touch_cancel;
struct wl_signal touch_frame;
struct wl_signal tablet_tool_axis;
struct wl_signal tablet_tool_proximity;
struct wl_signal tablet_tool_tip;
struct wl_signal tablet_tool_button;
} events;
void *data;
};
struct wlr_cursor *wlr_cursor_create(void);
void wlr_cursor_destroy(struct wlr_cursor *cur);
/**
* Warp the cursor to the given x and y in layout coordinates. If x and y are
* out of the layout boundaries or constraints, no warp will happen.
*
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
* device mapping constraints will be ignored.
*
* Returns true when the cursor warp was successful.
*/
bool wlr_cursor_warp(struct wlr_cursor *cur, struct wlr_input_device *dev,
double lx, double ly);
/**
* Convert absolute 0..1 coordinates to layout coordinates.
*
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
* device mapping constraints will be ignored.
*/
void wlr_cursor_absolute_to_layout_coords(struct wlr_cursor *cur,
struct wlr_input_device *dev, double x, double y, double *lx, double *ly);
/**
* Warp the cursor to the given x and y coordinates. If the given point is out
* of the layout boundaries or constraints, the closest point will be used.
* If one coordinate is NAN, it will be ignored.
*
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
* device mapping constraints will be ignored.
*/
void wlr_cursor_warp_closest(struct wlr_cursor *cur,
struct wlr_input_device *dev, double x, double y);
/**
* Warp the cursor to the given x and y in absolute 0..1 coordinates. If the
* given point is out of the layout boundaries or constraints, the closest point
* will be used. If one coordinate is NAN, it will be ignored.
*
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
* device mapping constraints will be ignored.
*/
void wlr_cursor_warp_absolute(struct wlr_cursor *cur,
struct wlr_input_device *dev, double x, double y);
/**
* Move the cursor in the direction of the given x and y layout coordinates. If
* one coordinate is NAN, it will be ignored.
*
* `dev` may be passed to respect device mapping constraints. If `dev` is NULL,
* device mapping constraints will be ignored.
*/
void wlr_cursor_move(struct wlr_cursor *cur, struct wlr_input_device *dev,
double delta_x, double delta_y);
/**
* Set the cursor buffer.
*
* The buffer is used on all outputs and is scaled accordingly. The hotspot is
* expressed in logical coordinates. A NULL buffer hides the cursor.
*/
void wlr_cursor_set_buffer(struct wlr_cursor *cur, struct wlr_buffer *buffer,
int32_t hotspot_x, int32_t hotspot_y, float scale);
/**
* Hide the cursor image.
*/
void wlr_cursor_unset_image(struct wlr_cursor *cur);
/**
* Set the cursor image from an XCursor theme.
*
* The image will be loaded from the struct wlr_xcursor_manager.
*/
void wlr_cursor_set_xcursor(struct wlr_cursor *cur,
struct wlr_xcursor_manager *manager, const char *name);
/**
* Set the cursor surface. The surface can be committed to update the cursor
* image. The surface position is subtracted from the hotspot. A NULL surface
* commit hides the cursor.
*/
void wlr_cursor_set_surface(struct wlr_cursor *cur, struct wlr_surface *surface,
int32_t hotspot_x, int32_t hotspot_y);
/**
* Attaches this input device to this cursor. The input device must be one of:
*
* - WLR_INPUT_DEVICE_POINTER
* - WLR_INPUT_DEVICE_TOUCH
* - WLR_INPUT_DEVICE_TABLET_TOOL
*/
void wlr_cursor_attach_input_device(struct wlr_cursor *cur,
struct wlr_input_device *dev);
void wlr_cursor_detach_input_device(struct wlr_cursor *cur,
struct wlr_input_device *dev);
/**
* Uses the given layout to establish the boundaries and movement semantics of
* this cursor. Cursors without an output layout allow infinite movement in any
* direction and do not support absolute input events.
*/
void wlr_cursor_attach_output_layout(struct wlr_cursor *cur,
struct wlr_output_layout *l);
/**
* Attaches this cursor to the given output, which must be among the outputs in
* the current output_layout for this cursor. This call is invalid for a cursor
* without an associated output layout.
*/
void wlr_cursor_map_to_output(struct wlr_cursor *cur,
struct wlr_output *output);
/**
* Maps all input from a specific input device to a given output. The input
* device must be attached to this cursor and the output must be among the
* outputs in the attached output layout.
*/
void wlr_cursor_map_input_to_output(struct wlr_cursor *cur,
struct wlr_input_device *dev, struct wlr_output *output);
/**
* Maps this cursor to an arbitrary region on the associated
* struct wlr_output_layout.
*/
void wlr_cursor_map_to_region(struct wlr_cursor *cur, const struct wlr_box *box);
/**
* Maps inputs from this input device to an arbitrary region on the associated
* struct wlr_output_layout.
*/
void wlr_cursor_map_input_to_region(struct wlr_cursor *cur,
struct wlr_input_device *dev, const struct wlr_box *box);
#endif

View file

@ -0,0 +1,58 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_CURSOR_SHAPE_V1_H
#define WLR_TYPES_WLR_CURSOR_SHAPE_V1_H
#include <wayland-server-core.h>
#include "cursor-shape-v1-protocol.h"
/**
* Manager for the cursor-shape-v1 protocol.
*
* Compositors should listen to the request_set_shape event and handle it in
* the same way as wlr_seat.events.request_set_cursor.
*/
struct wlr_cursor_shape_manager_v1 {
struct wl_global *global;
struct {
struct wl_signal request_set_shape; // struct wlr_cursor_shape_manager_v1_request_set_shape_event
struct wl_signal destroy;
} events;
void *data;
// private state
struct wl_listener display_destroy;
};
enum wlr_cursor_shape_manager_v1_device_type {
WLR_CURSOR_SHAPE_MANAGER_V1_DEVICE_TYPE_POINTER,
WLR_CURSOR_SHAPE_MANAGER_V1_DEVICE_TYPE_TABLET_TOOL,
};
struct wlr_cursor_shape_manager_v1_request_set_shape_event {
struct wlr_seat_client *seat_client;
enum wlr_cursor_shape_manager_v1_device_type device_type;
uint32_t serial;
enum wp_cursor_shape_device_v1_shape shape;
};
struct wlr_cursor_shape_manager_v1 *wlr_cursor_shape_manager_v1_create(
struct wl_display *display, uint32_t version);
/**
* Get the name of a cursor shape.
*
* The name can be used to load a cursor from an XCursor theme.
*/
const char *wlr_cursor_shape_v1_name(enum wp_cursor_shape_device_v1_shape shape);
#endif

View file

@ -0,0 +1,84 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_DAMAGE_RING_H
#define WLR_TYPES_WLR_DAMAGE_RING_H
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <pixman.h>
/* For triple buffering, a history of two frames is required. */
#define WLR_DAMAGE_RING_PREVIOUS_LEN 2
struct wlr_box;
struct wlr_damage_ring {
int32_t width, height;
// Difference between the current buffer and the previous one
pixman_region32_t current;
// private state
pixman_region32_t previous[WLR_DAMAGE_RING_PREVIOUS_LEN];
size_t previous_idx;
};
void wlr_damage_ring_init(struct wlr_damage_ring *ring);
void wlr_damage_ring_finish(struct wlr_damage_ring *ring);
/**
* Set ring bounds and damage the ring fully.
*
* Next time damage will be added, it will be cropped to the ring bounds.
* If at least one of the dimensions is 0, bounds are removed.
*
* By default, a damage ring doesn't have bounds.
*/
void wlr_damage_ring_set_bounds(struct wlr_damage_ring *ring,
int32_t width, int32_t height);
/**
* Add a region to the current damage.
*
* Returns true if the region intersects the ring bounds, false otherwise.
*/
bool wlr_damage_ring_add(struct wlr_damage_ring *ring,
const pixman_region32_t *damage);
/**
* Add a box to the current damage.
*
* Returns true if the box intersects the ring bounds, false otherwise.
*/
bool wlr_damage_ring_add_box(struct wlr_damage_ring *ring,
const struct wlr_box *box);
/**
* Damage the ring fully.
*/
void wlr_damage_ring_add_whole(struct wlr_damage_ring *ring);
/**
* Rotate the damage ring. This needs to be called after using the accumulated
* damage, e.g. after rendering to an output's back buffer.
*/
void wlr_damage_ring_rotate(struct wlr_damage_ring *ring);
/**
* Get accumulated damage, which is the difference between the current buffer
* and the buffer with age of buffer_age; in context of rendering, this is
* the region that needs to be redrawn.
*/
void wlr_damage_ring_get_buffer_damage(struct wlr_damage_ring *ring,
int buffer_age, pixman_region32_t *damage);
#endif

View file

@ -0,0 +1,47 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_DATA_CONTROL_V1_H
#define WLR_TYPES_WLR_DATA_CONTROL_V1_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h>
struct wlr_data_control_manager_v1 {
struct wl_global *global;
struct wl_list devices; // wlr_data_control_device_v1.link
struct {
struct wl_signal destroy;
struct wl_signal new_device; // wlr_data_control_device_v1
} events;
struct wl_listener display_destroy;
};
struct wlr_data_control_device_v1 {
struct wl_resource *resource;
struct wlr_data_control_manager_v1 *manager;
struct wl_list link; // wlr_data_control_manager_v1.devices
struct wlr_seat *seat;
struct wl_resource *selection_offer_resource; // current selection offer
struct wl_resource *primary_selection_offer_resource; // current primary selection offer
struct wl_listener seat_destroy;
struct wl_listener seat_set_selection;
struct wl_listener seat_set_primary_selection;
};
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1_create(
struct wl_display *display);
void wlr_data_control_device_v1_destroy(
struct wlr_data_control_device_v1 *device);
#endif

View file

@ -0,0 +1,255 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_DATA_DEVICE_H
#define WLR_TYPES_WLR_DATA_DEVICE_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h>
struct wlr_data_device_manager {
struct wl_global *global;
struct wl_list data_sources;
struct wl_listener display_destroy;
struct {
struct wl_signal destroy;
} events;
void *data;
};
enum wlr_data_offer_type {
WLR_DATA_OFFER_SELECTION,
WLR_DATA_OFFER_DRAG,
};
struct wlr_data_offer {
struct wl_resource *resource;
struct wlr_data_source *source;
enum wlr_data_offer_type type;
struct wl_list link; // wlr_seat.{selection_offers,drag_offers}
uint32_t actions;
enum wl_data_device_manager_dnd_action preferred_action;
bool in_ask;
struct wl_listener source_destroy;
};
/**
* A data source implementation. Only the `send` function is mandatory. Refer to
* the matching `wlr_data_source_*` functions documentation to know what they do.
*/
struct wlr_data_source_impl {
void (*send)(struct wlr_data_source *source, const char *mime_type,
int32_t fd);
void (*accept)(struct wlr_data_source *source, uint32_t serial,
const char *mime_type);
void (*destroy)(struct wlr_data_source *source);
void (*dnd_drop)(struct wlr_data_source *source);
void (*dnd_finish)(struct wlr_data_source *source);
void (*dnd_action)(struct wlr_data_source *source,
enum wl_data_device_manager_dnd_action action);
};
struct wlr_data_source {
const struct wlr_data_source_impl *impl;
// source metadata
struct wl_array mime_types;
int32_t actions;
// source status
bool accepted;
// drag'n'drop status
enum wl_data_device_manager_dnd_action current_dnd_action;
uint32_t compositor_action;
struct {
struct wl_signal destroy;
} events;
};
struct wlr_drag;
struct wlr_drag_icon {
struct wlr_drag *drag;
struct wlr_surface *surface;
struct {
struct wl_signal destroy;
} events;
struct wl_listener surface_destroy;
void *data;
};
enum wlr_drag_grab_type {
WLR_DRAG_GRAB_KEYBOARD,
WLR_DRAG_GRAB_KEYBOARD_POINTER,
WLR_DRAG_GRAB_KEYBOARD_TOUCH,
};
struct wlr_drag {
enum wlr_drag_grab_type grab_type;
struct wlr_seat_keyboard_grab keyboard_grab;
struct wlr_seat_pointer_grab pointer_grab;
struct wlr_seat_touch_grab touch_grab;
struct wlr_seat *seat;
struct wlr_seat_client *seat_client;
struct wlr_seat_client *focus_client;
struct wlr_drag_icon *icon; // can be NULL
struct wlr_surface *focus; // can be NULL
struct wlr_data_source *source; // can be NULL
bool started, dropped, cancelling;
int32_t grab_touch_id, touch_id; // if WLR_DRAG_GRAB_TOUCH
struct {
struct wl_signal focus;
struct wl_signal motion; // struct wlr_drag_motion_event
struct wl_signal drop; // struct wlr_drag_drop_event
struct wl_signal destroy;
} events;
struct wl_listener source_destroy;
struct wl_listener seat_client_destroy;
struct wl_listener icon_destroy;
void *data;
};
struct wlr_drag_motion_event {
struct wlr_drag *drag;
uint32_t time;
double sx, sy;
};
struct wlr_drag_drop_event {
struct wlr_drag *drag;
uint32_t time;
};
/**
* Create a wl_data_device_manager global for this display.
*/
struct wlr_data_device_manager *wlr_data_device_manager_create(
struct wl_display *display);
/**
* Requests a selection to be set for the seat. If the request comes from
* a client, then set `client` to be the matching seat client so that this
* function can verify that the serial provided was once sent to the client
* on this seat.
*/
void wlr_seat_request_set_selection(struct wlr_seat *seat,
struct wlr_seat_client *client, struct wlr_data_source *source,
uint32_t serial);
/**
* Sets the current selection for the seat. NULL can be provided to clear it.
* This removes the previous one if there was any. In case the selection doesn't
* come from a client, wl_display_next_serial() can be used to generate a
* serial.
*/
void wlr_seat_set_selection(struct wlr_seat *seat,
struct wlr_data_source *source, uint32_t serial);
/**
* Creates a new drag. To request to start the drag, call
* wlr_seat_request_start_drag().
*/
struct wlr_drag *wlr_drag_create(struct wlr_seat_client *seat_client,
struct wlr_data_source *source, struct wlr_surface *icon_surface);
/**
* Requests a drag to be started on the seat.
*/
void wlr_seat_request_start_drag(struct wlr_seat *seat, struct wlr_drag *drag,
struct wlr_surface *origin, uint32_t serial);
/**
* Starts a drag on the seat. This starts an implicit keyboard grab, but doesn't
* start a pointer or a touch grab.
*/
void wlr_seat_start_drag(struct wlr_seat *seat, struct wlr_drag *drag,
uint32_t serial);
/**
* Starts a pointer drag on the seat. This starts implicit keyboard and pointer
* grabs.
*/
void wlr_seat_start_pointer_drag(struct wlr_seat *seat, struct wlr_drag *drag,
uint32_t serial);
/**
* Starts a touch drag on the seat. This starts implicit keyboard and touch
* grabs.
*/
void wlr_seat_start_touch_drag(struct wlr_seat *seat, struct wlr_drag *drag,
uint32_t serial, struct wlr_touch_point *point);
/**
* Initializes the data source with the provided implementation.
*/
void wlr_data_source_init(struct wlr_data_source *source,
const struct wlr_data_source_impl *impl);
/**
* Sends the data as the specified MIME type over the passed file descriptor,
* then close it.
*/
void wlr_data_source_send(struct wlr_data_source *source, const char *mime_type,
int32_t fd);
/**
* Notifies the data source that a target accepts one of the offered MIME types.
* If a target doesn't accept any of the offered types, `mime_type` is NULL.
*/
void wlr_data_source_accept(struct wlr_data_source *source, uint32_t serial,
const char *mime_type);
/**
* Notifies the data source it is no longer valid and should be destroyed. That
* destroys immediately the data source.
*/
void wlr_data_source_destroy(struct wlr_data_source *source);
/**
* Notifies the data source that the drop operation was performed. This does not
* indicate acceptance.
*
* The data source may still be used in the future and should not be destroyed
* here.
*/
void wlr_data_source_dnd_drop(struct wlr_data_source *source);
/**
* Notifies the data source that the drag-and-drop operation concluded. That
* potentially destroys immediately the data source.
*/
void wlr_data_source_dnd_finish(struct wlr_data_source *source);
/**
* Notifies the data source that a target accepts the drag with the specified
* action.
*
* This shouldn't be called after wlr_data_source_dnd_drop() unless the
* drag-and-drop operation ended in an "ask" action.
*/
void wlr_data_source_dnd_action(struct wlr_data_source *source,
enum wl_data_device_manager_dnd_action action);
#endif

View file

@ -0,0 +1,54 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_DRM_H
#define WLR_TYPES_WLR_DRM_H
#include <wayland-server-protocol.h>
#include <wlr/render/drm_format_set.h>
#include <wlr/types/wlr_buffer.h>
struct wlr_renderer;
struct wlr_drm_buffer {
struct wlr_buffer base;
struct wl_resource *resource; // can be NULL if the client destroyed it
struct wlr_dmabuf_attributes dmabuf;
struct wl_listener release;
};
/**
* A stub implementation of Mesa's wl_drm protocol.
*
* It only implements the minimum necessary for modern clients to behave
* properly. In particular, flink handles are left unimplemented.
*/
struct wlr_drm {
struct wl_global *global;
struct {
struct wl_signal destroy;
} events;
// private state
char *node_name;
struct wlr_drm_format_set formats;
struct wl_listener display_destroy;
};
struct wlr_drm_buffer *wlr_drm_buffer_try_from_resource(
struct wl_resource *resource);
struct wlr_drm *wlr_drm_create(struct wl_display *display,
struct wlr_renderer *renderer);
#endif

View file

@ -0,0 +1,43 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_EXPORT_DMABUF_V1_H
#define WLR_TYPES_WLR_EXPORT_DMABUF_V1_H
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/render/dmabuf.h>
struct wlr_export_dmabuf_manager_v1 {
struct wl_global *global;
struct wl_list frames; // wlr_export_dmabuf_frame_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal destroy;
} events;
};
struct wlr_export_dmabuf_frame_v1 {
struct wl_resource *resource;
struct wlr_export_dmabuf_manager_v1 *manager;
struct wl_list link; // wlr_export_dmabuf_manager_v1.frames
struct wlr_output *output;
bool cursor_locked;
struct wl_listener output_commit;
struct wl_listener output_destroy;
};
struct wlr_export_dmabuf_manager_v1 *wlr_export_dmabuf_manager_v1_create(
struct wl_display *display);
#endif

View file

@ -0,0 +1,153 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_FOREIGN_TOPLEVEL_MANAGEMENT_V1_H
#define WLR_TYPES_WLR_FOREIGN_TOPLEVEL_MANAGEMENT_V1_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_output.h>
struct wlr_foreign_toplevel_manager_v1 {
struct wl_event_loop *event_loop;
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link()
struct wl_list toplevels; // wlr_foreign_toplevel_handle_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal destroy;
} events;
void *data;
};
enum wlr_foreign_toplevel_handle_v1_state {
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MAXIMIZED = (1 << 0),
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_MINIMIZED = (1 << 1),
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_ACTIVATED = (1 << 2),
WLR_FOREIGN_TOPLEVEL_HANDLE_V1_STATE_FULLSCREEN = (1 << 3),
};
struct wlr_foreign_toplevel_handle_v1_output {
struct wl_list link; // wlr_foreign_toplevel_handle_v1.outputs
struct wlr_output *output;
struct wlr_foreign_toplevel_handle_v1 *toplevel;
// private state
struct wl_listener output_bind;
struct wl_listener output_destroy;
};
struct wlr_foreign_toplevel_handle_v1 {
struct wlr_foreign_toplevel_manager_v1 *manager;
struct wl_list resources;
struct wl_list link;
struct wl_event_source *idle_source;
char *title;
char *app_id;
struct wlr_foreign_toplevel_handle_v1 *parent;
struct wl_list outputs; // wlr_foreign_toplevel_v1_output.link
uint32_t state; // enum wlr_foreign_toplevel_v1_state
struct {
// struct wlr_foreign_toplevel_handle_v1_maximized_event
struct wl_signal request_maximize;
// struct wlr_foreign_toplevel_handle_v1_minimized_event
struct wl_signal request_minimize;
// struct wlr_foreign_toplevel_handle_v1_activated_event
struct wl_signal request_activate;
// struct wlr_foreign_toplevel_handle_v1_fullscreen_event
struct wl_signal request_fullscreen;
struct wl_signal request_close;
// struct wlr_foreign_toplevel_handle_v1_set_rectangle_event
struct wl_signal set_rectangle;
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_foreign_toplevel_handle_v1_maximized_event {
struct wlr_foreign_toplevel_handle_v1 *toplevel;
bool maximized;
};
struct wlr_foreign_toplevel_handle_v1_minimized_event {
struct wlr_foreign_toplevel_handle_v1 *toplevel;
bool minimized;
};
struct wlr_foreign_toplevel_handle_v1_activated_event {
struct wlr_foreign_toplevel_handle_v1 *toplevel;
struct wlr_seat *seat;
};
struct wlr_foreign_toplevel_handle_v1_fullscreen_event {
struct wlr_foreign_toplevel_handle_v1 *toplevel;
bool fullscreen;
struct wlr_output *output;
};
struct wlr_foreign_toplevel_handle_v1_set_rectangle_event {
struct wlr_foreign_toplevel_handle_v1 *toplevel;
struct wlr_surface *surface;
int32_t x, y, width, height;
};
struct wlr_foreign_toplevel_manager_v1 *wlr_foreign_toplevel_manager_v1_create(
struct wl_display *display);
struct wlr_foreign_toplevel_handle_v1 *wlr_foreign_toplevel_handle_v1_create(
struct wlr_foreign_toplevel_manager_v1 *manager);
/**
* Destroy the given toplevel handle, sending the closed event to any
* client. Also, if the destroyed toplevel is set as a parent of any
* other valid toplevel, clients still holding a handle to both are
* sent a parent signal with NULL parent. If this is not desired, the
* caller should ensure that any child toplevels are destroyed before
* the parent.
*/
void wlr_foreign_toplevel_handle_v1_destroy(
struct wlr_foreign_toplevel_handle_v1 *toplevel);
void wlr_foreign_toplevel_handle_v1_set_title(
struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *title);
void wlr_foreign_toplevel_handle_v1_set_app_id(
struct wlr_foreign_toplevel_handle_v1 *toplevel, const char *app_id);
void wlr_foreign_toplevel_handle_v1_output_enter(
struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output);
void wlr_foreign_toplevel_handle_v1_output_leave(
struct wlr_foreign_toplevel_handle_v1 *toplevel, struct wlr_output *output);
void wlr_foreign_toplevel_handle_v1_set_maximized(
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool maximized);
void wlr_foreign_toplevel_handle_v1_set_minimized(
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool minimized);
void wlr_foreign_toplevel_handle_v1_set_activated(
struct wlr_foreign_toplevel_handle_v1 *toplevel, bool activated);
void wlr_foreign_toplevel_handle_v1_set_fullscreen(
struct wlr_foreign_toplevel_handle_v1* toplevel, bool fullscreen);
/**
* Set the parent of a toplevel. If the parent changed from its previous
* value, also sends a parent event to all clients that hold handles to
* both toplevel and parent (no message is sent to clients that have
* previously destroyed their parent handle). NULL is allowed as the
* parent, meaning no parent exists.
*/
void wlr_foreign_toplevel_handle_v1_set_parent(
struct wlr_foreign_toplevel_handle_v1 *toplevel,
struct wlr_foreign_toplevel_handle_v1 *parent);
#endif

View file

@ -0,0 +1,34 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_FRACTIONAL_SCALE_V1_H
#define WLR_TYPES_WLR_FRACTIONAL_SCALE_V1_H
#include <wayland-server-core.h>
struct wlr_surface;
struct wlr_fractional_scale_manager_v1 {
struct wl_global *global;
struct {
struct wl_signal destroy;
} events;
// private state
struct wl_listener display_destroy;
};
void wlr_fractional_scale_v1_notify_scale(
struct wlr_surface *surface, double scale);
struct wlr_fractional_scale_manager_v1 *wlr_fractional_scale_manager_v1_create(
struct wl_display *display, uint32_t version);
#endif

View file

@ -0,0 +1,39 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_FULLSCREEN_SHELL_V1_H
#define WLR_TYPES_WLR_FULLSCREEN_SHELL_V1_H
#include <wayland-server-core.h>
#include "fullscreen-shell-unstable-v1-protocol.h"
struct wlr_fullscreen_shell_v1 {
struct wl_global *global;
struct {
struct wl_signal destroy;
// struct wlr_fullscreen_shell_v1_present_surface_event
struct wl_signal present_surface;
} events;
struct wl_listener display_destroy;
void *data;
};
struct wlr_fullscreen_shell_v1_present_surface_event {
struct wl_client *client;
struct wlr_surface *surface; // can be NULL
enum zwp_fullscreen_shell_v1_present_method method;
struct wlr_output *output; // can be NULL
};
struct wlr_fullscreen_shell_v1 *wlr_fullscreen_shell_v1_create(
struct wl_display *display);
#endif

View file

@ -0,0 +1,50 @@
#ifndef WLR_TYPES_WLR_GAMMA_CONTROL_V1_H
#define WLR_TYPES_WLR_GAMMA_CONTROL_V1_H
#include <wayland-server-core.h>
struct wlr_output;
struct wlr_output_state;
struct wlr_gamma_control_manager_v1 {
struct wl_global *global;
struct wl_list controls; // wlr_gamma_control_v1.link
struct wl_listener display_destroy;
struct {
struct wl_signal destroy;
struct wl_signal set_gamma; // struct wlr_gamma_control_manager_v1_set_gamma_event
} events;
void *data;
};
struct wlr_gamma_control_manager_v1_set_gamma_event {
struct wlr_output *output;
struct wlr_gamma_control_v1 *control; // may be NULL
};
struct wlr_gamma_control_v1 {
struct wl_resource *resource;
struct wlr_output *output;
struct wlr_gamma_control_manager_v1 *manager;
struct wl_list link;
uint16_t *table;
size_t ramp_size;
struct wl_listener output_destroy_listener;
void *data;
};
struct wlr_gamma_control_manager_v1 *wlr_gamma_control_manager_v1_create(
struct wl_display *display);
struct wlr_gamma_control_v1 *wlr_gamma_control_manager_v1_get_control(
struct wlr_gamma_control_manager_v1 *manager, struct wlr_output *output);
bool wlr_gamma_control_v1_apply(struct wlr_gamma_control_v1 *gamma_control,
struct wlr_output_state *output_state);
void wlr_gamma_control_v1_send_failed_and_destroy(struct wlr_gamma_control_v1 *gamma_control);
#endif

View file

@ -0,0 +1,56 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_IDLE_INHIBIT_V1_H
#define WLR_TYPES_WLR_IDLE_INHIBIT_V1_H
#include <wayland-server-core.h>
/* This interface permits clients to inhibit the idle behavior such as
* screenblanking, locking, and screensaving.
*
* This allows clients to ensure they stay visible instead of being hidden by
* power-saving.
*
* Inhibitors are created for surfaces. They should only be in effect, while
* this surface is visible.
* The effect could also be limited to outputs it is displayed on (e.g.
* dimm/dpms off outputs, except the one a video is displayed on).
*/
struct wlr_idle_inhibit_manager_v1 {
struct wl_list inhibitors; // wlr_idle_inhibit_inhibitor_v1.link
struct wl_global *global;
struct wl_listener display_destroy;
struct {
struct wl_signal new_inhibitor; // struct wlr_idle_inhibitor_v1
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_idle_inhibitor_v1 {
struct wlr_surface *surface;
struct wl_resource *resource;
struct wl_listener surface_destroy;
struct wl_list link; // wlr_idle_inhibit_manager_v1.inhibitors
struct {
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_idle_inhibit_manager_v1 *wlr_idle_inhibit_v1_create(struct wl_display *display);
#endif

View file

@ -0,0 +1,44 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_IDLE_NOTIFY_H
#define WLR_TYPES_WLR_IDLE_NOTIFY_H
#include <wayland-server-core.h>
struct wlr_seat;
/**
* An idle notifier, implementing the ext-idle-notify-v1 protocol.
*/
struct wlr_idle_notifier_v1;
/**
* Create the ext_idle_notifier_v1 global.
*/
struct wlr_idle_notifier_v1 *wlr_idle_notifier_v1_create(struct wl_display *display);
/**
* Inhibit idle.
*
* Compositors should call this function when the idle state is disabled, e.g.
* because a visible client is using the idle-inhibit protocol.
*/
void wlr_idle_notifier_v1_set_inhibited(struct wlr_idle_notifier_v1 *notifier,
bool inhibited);
/**
* Notify for user activity on a seat.
*
* Compositors should call this function whenever an input event is triggered
* on a seat.
*/
void wlr_idle_notifier_v1_notify_activity(struct wlr_idle_notifier_v1 *notifier,
struct wlr_seat *seat);
#endif

View file

@ -0,0 +1,40 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_INPUT_DEVICE_H
#define WLR_TYPES_WLR_INPUT_DEVICE_H
#include <wayland-server-core.h>
enum wlr_button_state {
WLR_BUTTON_RELEASED,
WLR_BUTTON_PRESSED,
};
enum wlr_input_device_type {
WLR_INPUT_DEVICE_KEYBOARD,
WLR_INPUT_DEVICE_POINTER,
WLR_INPUT_DEVICE_TOUCH,
WLR_INPUT_DEVICE_TABLET_TOOL,
WLR_INPUT_DEVICE_TABLET_PAD,
WLR_INPUT_DEVICE_SWITCH,
};
struct wlr_input_device {
enum wlr_input_device_type type;
unsigned int vendor, product;
char *name;
struct {
struct wl_signal destroy;
} events;
void *data;
};
#endif

View file

@ -0,0 +1,37 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_INPUT_INHIBITOR_H
#define WLR_TYPES_INPUT_INHIBITOR_H
#include <wayland-server-core.h>
/*
* NOTE: Following the protocol deprecation, wlr/types/wlr_input_inhibitor.h is
* deprecated and will be removed in the next release.
*/
struct wlr_input_inhibit_manager {
struct wl_global *global;
struct wl_client *active_client;
struct wl_resource *active_inhibitor;
struct wl_listener display_destroy;
struct {
struct wl_signal activate; // struct wlr_input_inhibit_manager
struct wl_signal deactivate; // struct wlr_input_inhibit_manager
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_input_inhibit_manager *wlr_input_inhibit_manager_create(
struct wl_display *display);
#endif

View file

@ -0,0 +1,144 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_INPUT_METHOD_V2_H
#define WLR_TYPES_WLR_INPUT_METHOD_V2_H
#include <stdint.h>
#include <stdlib.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/util/box.h>
struct wlr_input_method_v2_preedit_string {
char *text;
int32_t cursor_begin;
int32_t cursor_end;
};
struct wlr_input_method_v2_delete_surrounding_text {
uint32_t before_length;
uint32_t after_length;
};
struct wlr_input_method_v2_state {
struct wlr_input_method_v2_preedit_string preedit;
char *commit_text;
struct wlr_input_method_v2_delete_surrounding_text delete;
};
struct wlr_input_method_v2 {
struct wl_resource *resource;
struct wlr_seat *seat;
struct wlr_seat_client *seat_client;
struct wlr_input_method_v2_state pending;
struct wlr_input_method_v2_state current;
bool active; // pending compositor-side state
bool client_active; // state known to the client
uint32_t current_serial; // received in last commit call
struct wl_list popup_surfaces;
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab;
struct wl_list link;
struct wl_listener seat_client_destroy;
struct {
struct wl_signal commit; // struct wlr_input_method_v2
struct wl_signal new_popup_surface; // struct wlr_input_popup_surface_v2
struct wl_signal grab_keyboard; // struct wlr_input_method_keyboard_grab_v2
struct wl_signal destroy; // struct wlr_input_method_v2
} events;
};
struct wlr_input_popup_surface_v2 {
struct wl_resource *resource;
struct wlr_input_method_v2 *input_method;
struct wl_list link;
struct wlr_surface *surface;
struct {
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_input_method_keyboard_grab_v2 {
struct wl_resource *resource;
struct wlr_input_method_v2 *input_method;
struct wlr_keyboard *keyboard;
struct wl_listener keyboard_keymap;
struct wl_listener keyboard_repeat_info;
struct wl_listener keyboard_destroy;
struct {
struct wl_signal destroy; // struct wlr_input_method_keyboard_grab_v2
} events;
};
struct wlr_input_method_manager_v2 {
struct wl_global *global;
struct wl_list input_methods; // struct wlr_input_method_v2.link
struct wl_listener display_destroy;
struct {
struct wl_signal input_method; // struct wlr_input_method_v2
struct wl_signal destroy; // struct wlr_input_method_manager_v2
} events;
};
struct wlr_input_method_manager_v2 *wlr_input_method_manager_v2_create(
struct wl_display *display);
void wlr_input_method_v2_send_activate(
struct wlr_input_method_v2 *input_method);
void wlr_input_method_v2_send_deactivate(
struct wlr_input_method_v2 *input_method);
void wlr_input_method_v2_send_surrounding_text(
struct wlr_input_method_v2 *input_method, const char *text,
uint32_t cursor, uint32_t anchor);
void wlr_input_method_v2_send_content_type(
struct wlr_input_method_v2 *input_method, uint32_t hint,
uint32_t purpose);
void wlr_input_method_v2_send_text_change_cause(
struct wlr_input_method_v2 *input_method, uint32_t cause);
void wlr_input_method_v2_send_done(struct wlr_input_method_v2 *input_method);
void wlr_input_method_v2_send_unavailable(
struct wlr_input_method_v2 *input_method);
/**
* Get a struct wlr_input_popup_surface_v2 from a struct wlr_surface.
*
* Returns NULL if the surface has a different role or if the input popup
* surface has been destroyed.
*/
struct wlr_input_popup_surface_v2 *wlr_input_popup_surface_v2_try_from_wlr_surface(
struct wlr_surface *surface);
void wlr_input_popup_surface_v2_send_text_input_rectangle(
struct wlr_input_popup_surface_v2 *popup_surface, struct wlr_box *sbox);
void wlr_input_method_keyboard_grab_v2_send_key(
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab,
uint32_t time, uint32_t key, uint32_t state);
void wlr_input_method_keyboard_grab_v2_send_modifiers(
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab,
struct wlr_keyboard_modifiers *modifiers);
void wlr_input_method_keyboard_grab_v2_set_keyboard(
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab,
struct wlr_keyboard *keyboard);
void wlr_input_method_keyboard_grab_v2_destroy(
struct wlr_input_method_keyboard_grab_v2 *keyboard_grab);
#endif

View file

@ -0,0 +1,142 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_KEYBOARD_H
#define WLR_TYPES_WLR_KEYBOARD_H
#include <stdbool.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wayland-server-protocol.h>
#include <wlr/types/wlr_input_device.h>
#include <xkbcommon/xkbcommon.h>
#define WLR_LED_COUNT 3
enum wlr_keyboard_led {
WLR_LED_NUM_LOCK = 1 << 0,
WLR_LED_CAPS_LOCK = 1 << 1,
WLR_LED_SCROLL_LOCK = 1 << 2,
};
#define WLR_MODIFIER_COUNT 8
enum wlr_keyboard_modifier {
WLR_MODIFIER_SHIFT = 1 << 0,
WLR_MODIFIER_CAPS = 1 << 1,
WLR_MODIFIER_CTRL = 1 << 2,
WLR_MODIFIER_ALT = 1 << 3,
WLR_MODIFIER_MOD2 = 1 << 4,
WLR_MODIFIER_MOD3 = 1 << 5,
WLR_MODIFIER_LOGO = 1 << 6,
WLR_MODIFIER_MOD5 = 1 << 7,
};
#define WLR_KEYBOARD_KEYS_CAP 32
struct wlr_keyboard_impl;
struct wlr_keyboard_modifiers {
xkb_mod_mask_t depressed;
xkb_mod_mask_t latched;
xkb_mod_mask_t locked;
xkb_mod_mask_t group;
};
struct wlr_keyboard {
struct wlr_input_device base;
const struct wlr_keyboard_impl *impl;
struct wlr_keyboard_group *group;
char *keymap_string;
size_t keymap_size;
int keymap_fd;
struct xkb_keymap *keymap;
struct xkb_state *xkb_state;
xkb_led_index_t led_indexes[WLR_LED_COUNT];
xkb_mod_index_t mod_indexes[WLR_MODIFIER_COUNT];
uint32_t leds;
uint32_t keycodes[WLR_KEYBOARD_KEYS_CAP];
size_t num_keycodes;
struct wlr_keyboard_modifiers modifiers;
struct {
int32_t rate;
int32_t delay;
} repeat_info;
struct {
/**
* The `key` event signals with a struct wlr_keyboard_key_event that a
* key has been pressed or released on the keyboard. This event is
* emitted before the xkb state of the keyboard has been updated
* (including modifiers).
*/
struct wl_signal key;
/**
* The `modifiers` event signals that the modifier state of the
* struct wlr_keyboard has been updated. At this time, you can read the
* modifier state of the struct wlr_keyboard and handle the updated
* state by sending it to clients.
*/
struct wl_signal modifiers;
struct wl_signal keymap;
struct wl_signal repeat_info;
} events;
void *data;
};
struct wlr_keyboard_key_event {
uint32_t time_msec;
uint32_t keycode;
bool update_state; // if backend doesn't update modifiers on its own
enum wl_keyboard_key_state state;
};
/**
* Get a struct wlr_keyboard from a struct wlr_input_device.
*
* Asserts that the input device is a keyboard.
*/
struct wlr_keyboard *wlr_keyboard_from_input_device(
struct wlr_input_device *input_device);
bool wlr_keyboard_set_keymap(struct wlr_keyboard *kb,
struct xkb_keymap *keymap);
bool wlr_keyboard_keymaps_match(struct xkb_keymap *km1, struct xkb_keymap *km2);
/**
* Set the keyboard repeat info.
*
* rate is in key repeats/second and delay is in milliseconds.
*/
void wlr_keyboard_set_repeat_info(struct wlr_keyboard *kb, int32_t rate_hz,
int32_t delay_ms);
/**
* Update the LEDs on the device, if any.
*
* leds is a bitmask of enum wlr_keyboard_led.
*
* If the device doesn't have the provided LEDs, this function is a no-op.
*/
void wlr_keyboard_led_update(struct wlr_keyboard *keyboard, uint32_t leds);
/**
* Get the set of currently depressed or latched modifiers.
*
* A bitmask of enum wlr_keyboard_modifier is returned.
*/
uint32_t wlr_keyboard_get_modifiers(struct wlr_keyboard *keyboard);
#endif

View file

@ -0,0 +1,59 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_KEYBOARD_GROUP_H
#define WLR_TYPES_WLR_KEYBOARD_GROUP_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_keyboard.h>
struct wlr_keyboard_group {
struct wlr_keyboard keyboard;
struct wl_list devices; // keyboard_group_device.link
struct wl_list keys; // keyboard_group_key.link
struct {
/**
* Sent when a keyboard has entered the group with keys currently
* pressed that are not pressed by any other keyboard in the group. The
* data for this signal will be a struct wl_array containing the key
* codes. This should be used to update the compositor's internal state.
* Bindings should not be triggered based off of these key codes and
* they should also not notify any surfaces of the key press.
*/
struct wl_signal enter;
/**
* Sent when a keyboard has left the group with keys currently pressed
* that are not pressed by any other keyboard in the group. The data for
* this signal will be a struct wl_array containing the key codes. This
* should be used to update the compositor's internal state. Bindings
* should not be triggered based off of these key codes. Additionally,
* surfaces should only be notified if they received a corresponding key
* press for the key code.
*/
struct wl_signal leave;
} events;
void *data;
};
struct wlr_keyboard_group *wlr_keyboard_group_create(void);
struct wlr_keyboard_group *wlr_keyboard_group_from_wlr_keyboard(
struct wlr_keyboard *keyboard);
bool wlr_keyboard_group_add_keyboard(struct wlr_keyboard_group *group,
struct wlr_keyboard *keyboard);
void wlr_keyboard_group_remove_keyboard(struct wlr_keyboard_group *group,
struct wlr_keyboard *keyboard);
void wlr_keyboard_group_destroy(struct wlr_keyboard_group *group);
#endif

View file

@ -0,0 +1,85 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_KEYBOARD_SHORTCUTS_INHIBIT_V1_H
#define WLR_TYPES_WLR_KEYBOARD_SHORTCUTS_INHIBIT_V1_H
#include <wayland-server-core.h>
#include <wlr/types/wlr_seat.h>
/* This interface permits clients to inhibit keyboard shortcut processing by
* the compositor.
*
* This allows clients to pass them on to e.g. remote desktops or virtual
* machine guests.
*
* Inhibitors are created for surfaces and seats. They should only be in effect
* while this surface has focus.
*/
struct wlr_keyboard_shortcuts_inhibit_manager_v1 {
// wlr_keyboard_shortcuts_inhibitor_v1.link
struct wl_list inhibitors;
struct wl_global *global;
struct wl_listener display_destroy;
struct {
struct wl_signal new_inhibitor; // struct wlr_keyboard_shortcuts_inhibitor_v1
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_keyboard_shortcuts_inhibitor_v1 {
struct wlr_surface *surface;
struct wlr_seat *seat;
bool active;
struct wl_resource *resource;
struct wl_listener surface_destroy;
struct wl_listener seat_destroy;
// wlr_keyboard_shortcuts_inhibit_manager_v1.inhibitors
struct wl_list link;
struct {
struct wl_signal destroy;
} events;
void *data;
};
/*
* A compositor creating a manager will handle the new_inhibitor event and call
* wlr_keyboard_shortcuts_inhibitor_v1_activate() if it decides to honour the
* inhibitor. This will send the active event to the client, confirming
* activation of the inhibitor. From then on the compositor should respect the
* inhibitor until it calls wlr_keyboard_shortcuts_inhibitor_v1_deactivate() to
* suspend the inhibitor with an inactive event to the client or receives the
* destroy signal from wlroots, telling it that the inhibitor has been
* destroyed.
*
* Not sending the active event to the client is the only way under the
* protocol to let the client know that the compositor will not be honouring an
* inhibitor. It's the client's job to somehow deal with not receiving the
* event, i.e. not assume that shortcuts are inhibited and maybe destroy the
* pending and request a new inhibitor after a timeout.
*/
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *
wlr_keyboard_shortcuts_inhibit_v1_create(struct wl_display *display);
void wlr_keyboard_shortcuts_inhibitor_v1_activate(
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor);
void wlr_keyboard_shortcuts_inhibitor_v1_deactivate(
struct wlr_keyboard_shortcuts_inhibitor_v1 *inhibitor);
#endif

View file

@ -0,0 +1,184 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_LAYER_SHELL_V1_H
#define WLR_TYPES_WLR_LAYER_SHELL_V1_H
#include <stdbool.h>
#include <stdint.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_compositor.h>
#include "wlr-layer-shell-unstable-v1-protocol.h"
/**
* wlr_layer_shell_v1 allows clients to arrange themselves in "layers" on the
* desktop in accordance with the wlr-layer-shell protocol. When a client is
* added, the new_surface signal will be raised and passed a reference to our
* struct wlr_layer_surface_v1. At this time, the client will have configured the
* surface as it desires, including information like desired anchors and
* margins. The compositor should use this information to decide how to arrange
* the layer on-screen, then determine the dimensions of the layer and call
* wlr_layer_surface_v1_configure(). The client will then attach a buffer and
* commit the surface, at which point the wlr_layer_surface_v1 map signal is
* raised and the compositor should begin rendering the surface.
*/
struct wlr_layer_shell_v1 {
struct wl_global *global;
struct wl_listener display_destroy;
struct {
// Note: the output may be NULL. In this case, it is your
// responsibility to assign an output before returning.
struct wl_signal new_surface; // struct wlr_layer_surface_v1
struct wl_signal destroy;
} events;
void *data;
};
enum wlr_layer_surface_v1_state_field {
WLR_LAYER_SURFACE_V1_STATE_DESIRED_SIZE = 1 << 0,
WLR_LAYER_SURFACE_V1_STATE_ANCHOR = 1 << 1,
WLR_LAYER_SURFACE_V1_STATE_EXCLUSIVE_ZONE = 1 << 2,
WLR_LAYER_SURFACE_V1_STATE_MARGIN = 1 << 3,
WLR_LAYER_SURFACE_V1_STATE_KEYBOARD_INTERACTIVITY = 1 << 4,
WLR_LAYER_SURFACE_V1_STATE_LAYER = 1 << 5,
};
struct wlr_layer_surface_v1_state {
uint32_t committed; // enum wlr_layer_surface_v1_state_field
uint32_t anchor;
int32_t exclusive_zone;
struct {
int32_t top, right, bottom, left;
} margin;
enum zwlr_layer_surface_v1_keyboard_interactivity keyboard_interactive;
uint32_t desired_width, desired_height;
enum zwlr_layer_shell_v1_layer layer;
uint32_t configure_serial;
uint32_t actual_width, actual_height;
};
struct wlr_layer_surface_v1_configure {
struct wl_list link; // wlr_layer_surface_v1.configure_list
uint32_t serial;
uint32_t width, height;
};
struct wlr_layer_surface_v1 {
struct wlr_surface *surface;
struct wlr_output *output;
struct wl_resource *resource;
struct wlr_layer_shell_v1 *shell;
struct wl_list popups; // wlr_xdg_popup.link
char *namespace;
bool added, configured;
struct wl_list configure_list;
struct wlr_layer_surface_v1_state current, pending;
// Whether the surface is ready to receive configure events
bool initialized;
// Whether the latest commit is an initial commit
bool initial_commit;
struct {
/**
* The destroy signal indicates that the struct wlr_layer_surface is
* about to be freed. It is guaranteed that the unmap signal is raised
* before the destroy signal if the layer surface is destroyed while
* mapped.
*/
struct wl_signal destroy;
/**
* The new_popup signal is raised when a new popup is created. The data
* parameter passed to the listener is a pointer to the new
* struct wlr_xdg_popup.
*/
struct wl_signal new_popup;
} events;
void *data;
};
struct wlr_layer_shell_v1 *wlr_layer_shell_v1_create(struct wl_display *display,
uint32_t version);
/**
* Notifies the layer surface to configure itself with this width/height. The
* layer_surface will signal its map event when the surface is ready to assume
* this size. Returns the associated configure serial.
*/
uint32_t wlr_layer_surface_v1_configure(struct wlr_layer_surface_v1 *surface,
uint32_t width, uint32_t height);
/**
* Notify the client that the surface has been closed and destroy the
* struct wlr_layer_surface_v1, rendering the resource inert.
*/
void wlr_layer_surface_v1_destroy(struct wlr_layer_surface_v1 *surface);
/**
* Get a struct wlr_layer_surface from a struct wlr_surface.
*
* Returns NULL if the surface doesn't have the layer surface role or if
* the layer surface has been destroyed.
*/
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_try_from_wlr_surface(
struct wlr_surface *surface);
/**
* Calls the iterator function for each mapped sub-surface and popup of this
* surface (whether or not this surface is mapped).
*/
void wlr_layer_surface_v1_for_each_surface(struct wlr_layer_surface_v1 *surface,
wlr_surface_iterator_func_t iterator, void *user_data);
/**
* Call `iterator` on each popup's surface and popup's subsurface in the
* layer surface's tree, with the surfaces's position relative to the root
* layer surface. The function is called from root to leaves (in rendering
* order).
*/
void wlr_layer_surface_v1_for_each_popup_surface(
struct wlr_layer_surface_v1 *surface,
wlr_surface_iterator_func_t iterator, void *user_data);
/**
* Find a surface within this layer-surface tree at the given surface-local
* coordinates. Returns the surface and coordinates in the leaf surface
* coordinate system or NULL if no surface is found at that location.
*/
struct wlr_surface *wlr_layer_surface_v1_surface_at(
struct wlr_layer_surface_v1 *surface, double sx, double sy,
double *sub_x, double *sub_y);
/**
* Find a surface within this layer-surface's popup tree at the given
* surface-local coordinates. Returns the surface and coordinates in the leaf
* surface coordinate system or NULL if no surface is found at that location.
*/
struct wlr_surface *wlr_layer_surface_v1_popup_surface_at(
struct wlr_layer_surface_v1 *surface, double sx, double sy,
double *sub_x, double *sub_y);
/**
* Get the corresponding struct wlr_layer_surface_v1 from a resource.
*
* Aborts if the resource doesn't have the correct type.
*/
struct wlr_layer_surface_v1 *wlr_layer_surface_v1_from_resource(
struct wl_resource *resource);
#endif

View file

@ -0,0 +1,125 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_LINUX_DMABUF_H
#define WLR_TYPES_WLR_LINUX_DMABUF_H
#include <stdint.h>
#include <sys/stat.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/render/dmabuf.h>
#include <wlr/render/drm_format_set.h>
struct wlr_surface;
struct wlr_dmabuf_v1_buffer {
struct wlr_buffer base;
struct wl_resource *resource; // can be NULL if the client destroyed it
struct wlr_dmabuf_attributes attributes;
// private state
struct wl_listener release;
};
/**
* Returns the struct wlr_dmabuf_buffer if the given resource was created
* via the linux-dmabuf buffer protocol or NULL otherwise.
*/
struct wlr_dmabuf_v1_buffer *wlr_dmabuf_v1_buffer_try_from_buffer_resource(
struct wl_resource *buffer_resource);
struct wlr_linux_dmabuf_feedback_v1 {
dev_t main_device;
struct wl_array tranches; // struct wlr_linux_dmabuf_feedback_v1_tranche
};
struct wlr_linux_dmabuf_feedback_v1_tranche {
dev_t target_device;
uint32_t flags; // bitfield of enum zwp_linux_dmabuf_feedback_v1_tranche_flags
struct wlr_drm_format_set formats;
};
/* the protocol interface */
struct wlr_linux_dmabuf_v1 {
struct wl_global *global;
struct {
struct wl_signal destroy;
} events;
// private state
struct wlr_linux_dmabuf_feedback_v1_compiled *default_feedback;
struct wlr_drm_format_set default_formats; // for legacy clients
struct wl_list surfaces; // wlr_linux_dmabuf_v1_surface.link
int main_device_fd; // to sanity check FDs sent by clients, -1 if unavailable
struct wl_listener display_destroy;
};
/**
* Create the linux-dmabuf-unstable-v1 global.
*
* Compositors using struct wlr_renderer should use
* wlr_linux_dmabuf_v1_create_with_renderer() instead.
*/
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create(struct wl_display *display,
uint32_t version, const struct wlr_linux_dmabuf_feedback_v1 *default_feedback);
/**
* Create the linux-dmabuf-unstable-v1 global.
*
* The default DMA-BUF feedback is initialized from the struct wlr_renderer.
*/
struct wlr_linux_dmabuf_v1 *wlr_linux_dmabuf_v1_create_with_renderer(struct wl_display *display,
uint32_t version, struct wlr_renderer *renderer);
/**
* Set a surface's DMA-BUF feedback.
*
* Passing a NULL feedback resets it to the default feedback.
*/
bool wlr_linux_dmabuf_v1_set_surface_feedback(
struct wlr_linux_dmabuf_v1 *linux_dmabuf, struct wlr_surface *surface,
const struct wlr_linux_dmabuf_feedback_v1 *feedback);
/**
* Append a tranche at the end of the DMA-BUF feedback list.
*
* Tranches must be added with decreasing priority.
*/
struct wlr_linux_dmabuf_feedback_v1_tranche *wlr_linux_dmabuf_feedback_add_tranche(
struct wlr_linux_dmabuf_feedback_v1 *feedback);
/**
* Release resources allocated by a DMA-BUF feedback object.
*/
void wlr_linux_dmabuf_feedback_v1_finish(struct wlr_linux_dmabuf_feedback_v1 *feedback);
struct wlr_linux_dmabuf_feedback_v1_init_options {
// Main renderer used by the compositor
struct wlr_renderer *main_renderer;
// Output on which direct scan-out is possible on the primary plane, or NULL
struct wlr_output *scanout_primary_output;
// Output layer feedback event, or NULL
const struct wlr_output_layer_feedback_event *output_layer_feedback_event;
};
/**
* Initialize a DMA-BUF feedback object with the provided options.
*
* The caller is responsible for calling wlr_linux_dmabuf_feedback_v1_finish() after use.
*/
bool wlr_linux_dmabuf_feedback_v1_init_with_options(struct wlr_linux_dmabuf_feedback_v1 *feedback,
const struct wlr_linux_dmabuf_feedback_v1_init_options *options);
#endif

View file

@ -0,0 +1,54 @@
/*
* This is a stable interface of wlroots. Future changes will be limited to:
*
* - New functions
* - New struct members
* - New enum members
*
* Note that wlroots does not make an ABI compatibility promise - in the future,
* the layout and size of structs used by wlroots may change, requiring code
* depending on this header to be recompiled (but not edited).
*
* Breaking changes are announced in the release notes and follow a 1-year
* deprecation schedule.
*/
#ifndef WLR_TYPES_WLR_MATRIX_H
#define WLR_TYPES_WLR_MATRIX_H
#include <wayland-server-protocol.h>
struct wlr_box;
/** Writes the identity matrix into mat */
void wlr_matrix_identity(float mat[static 9]);
/** mat ← a × b */
void wlr_matrix_multiply(float mat[static 9], const float a[static 9],
const float b[static 9]);
void wlr_matrix_transpose(float mat[static 9], const float a[static 9]);
/** Writes a 2D translation matrix to mat of magnitude (x, y) */
void wlr_matrix_translate(float mat[static 9], float x, float y);
/** Writes a 2D scale matrix to mat of magnitude (x, y) */
void wlr_matrix_scale(float mat[static 9], float x, float y);
/** Writes a 2D rotation matrix to mat at an angle of rad radians */
void wlr_matrix_rotate(float mat[static 9], float rad);
/** Writes a transformation matrix which applies the specified
* wl_output_transform to mat */
void wlr_matrix_transform(float mat[static 9],
enum wl_output_transform transform);
/** Shortcut for the various matrix operations involved in projecting the
* specified wlr_box onto a given orthographic projection with a given
* rotation. The result is written to mat, which can be applied to each
* coordinate of the box to get a new coordinate from [-1,1]. */
void wlr_matrix_project_box(float mat[static 9], const struct wlr_box *box,
enum wl_output_transform transform, float rotation,
const float projection[static 9]);
#endif

View file

@ -0,0 +1,747 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_OUTPUT_H
#define WLR_TYPES_WLR_OUTPUT_H
#include <pixman.h>
#include <stdbool.h>
#include <time.h>
#include <wayland-server-protocol.h>
#include <wayland-util.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_buffer.h>
#include <wlr/util/addon.h>
enum wlr_output_mode_aspect_ratio {
WLR_OUTPUT_MODE_ASPECT_RATIO_NONE,
WLR_OUTPUT_MODE_ASPECT_RATIO_4_3,
WLR_OUTPUT_MODE_ASPECT_RATIO_16_9,
WLR_OUTPUT_MODE_ASPECT_RATIO_64_27,
WLR_OUTPUT_MODE_ASPECT_RATIO_256_135,
};
struct wlr_output_mode {
int32_t width, height;
int32_t refresh; // mHz
bool preferred;
enum wlr_output_mode_aspect_ratio picture_aspect_ratio;
struct wl_list link;
};
struct wlr_output_cursor {
struct wlr_output *output;
double x, y;
bool enabled;
bool visible;
uint32_t width, height;
struct wlr_fbox src_box;
enum wl_output_transform transform;
int32_t hotspot_x, hotspot_y;
struct wlr_texture *texture;
bool own_texture;
struct wl_list link;
};
enum wlr_output_adaptive_sync_status {
WLR_OUTPUT_ADAPTIVE_SYNC_DISABLED,
WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED,
};
enum wlr_output_state_field {
WLR_OUTPUT_STATE_BUFFER = 1 << 0,
WLR_OUTPUT_STATE_DAMAGE = 1 << 1,
WLR_OUTPUT_STATE_MODE = 1 << 2,
WLR_OUTPUT_STATE_ENABLED = 1 << 3,
WLR_OUTPUT_STATE_SCALE = 1 << 4,
WLR_OUTPUT_STATE_TRANSFORM = 1 << 5,
WLR_OUTPUT_STATE_ADAPTIVE_SYNC_ENABLED = 1 << 6,
WLR_OUTPUT_STATE_GAMMA_LUT = 1 << 7,
WLR_OUTPUT_STATE_RENDER_FORMAT = 1 << 8,
WLR_OUTPUT_STATE_SUBPIXEL = 1 << 9,
WLR_OUTPUT_STATE_LAYERS = 1 << 10,
};
enum wlr_output_state_mode_type {
WLR_OUTPUT_STATE_MODE_FIXED,
WLR_OUTPUT_STATE_MODE_CUSTOM,
};
/**
* Holds the double-buffered output state.
*/
struct wlr_output_state {
uint32_t committed; // enum wlr_output_state_field
// Set to true to allow output reconfiguration to occur which may result
// in temporary output disruptions and content misrepresentations.
bool allow_reconfiguration;
pixman_region32_t damage; // output-buffer-local coordinates
bool enabled;
float scale;
enum wl_output_transform transform;
bool adaptive_sync_enabled;
uint32_t render_format;
enum wl_output_subpixel subpixel;
struct wlr_buffer *buffer;
/* Request a tearing page-flip. When enabled, this may cause the output to
* display a part of the previous buffer and a part of the current buffer at
* the same time. The backend may reject the commit if a tearing page-flip
* cannot be performed, in which case the caller should fall back to a
* regular page-flip at the next wlr_output.frame event. */
bool tearing_page_flip;
enum wlr_output_state_mode_type mode_type;
struct wlr_output_mode *mode;
struct {
int32_t width, height;
int32_t refresh; // mHz, may be zero
} custom_mode;
uint16_t *gamma_lut;
size_t gamma_lut_size;
struct wlr_output_layer_state *layers;
size_t layers_len;
};
struct wlr_output_impl;
struct wlr_render_pass;
/**
* A compositor output region. This typically corresponds to a monitor that
* displays part of the compositor space.
*
* The `frame` event will be emitted when it is a good time for the compositor
* to submit a new frame.
*
* To render a new frame, compositors should call wlr_output_attach_render(),
* render and call wlr_output_commit(). No rendering should happen outside a
* `frame` event handler or before wlr_output_attach_render().
*/
struct wlr_output {
const struct wlr_output_impl *impl;
struct wlr_backend *backend;
struct wl_display *display;
struct wl_global *global;
struct wl_list resources;
char *name;
char *description; // may be NULL
char *make, *model, *serial; // may be NULL
int32_t phys_width, phys_height; // mm
// Note: some backends may have zero modes
struct wl_list modes; // wlr_output_mode.link
struct wlr_output_mode *current_mode;
int32_t width, height;
int32_t refresh; // mHz, may be zero
bool enabled;
float scale;
enum wl_output_subpixel subpixel;
enum wl_output_transform transform;
enum wlr_output_adaptive_sync_status adaptive_sync_status;
uint32_t render_format;
bool needs_frame;
// damage for cursors and fullscreen surface, in output-local coordinates
bool frame_pending;
float transform_matrix[9];
// true for example with VR headsets
bool non_desktop;
struct wlr_output_state pending;
// Commit sequence number. Incremented on each commit, may overflow.
uint32_t commit_seq;
struct {
// Request to render a frame
struct wl_signal frame;
// Emitted when software cursors or backend-specific logic damage the
// output
struct wl_signal damage; // struct wlr_output_event_damage
// Emitted when a new frame needs to be committed (because of
// backend-specific logic)
struct wl_signal needs_frame;
// Emitted right before commit
struct wl_signal precommit; // struct wlr_output_event_precommit
// Emitted right after commit
struct wl_signal commit; // struct wlr_output_event_commit
// Emitted right after a commit has been presented to the user for
// enabled outputs
struct wl_signal present; // struct wlr_output_event_present
// Emitted after a client bound the wl_output global
struct wl_signal bind; // struct wlr_output_event_bind
struct wl_signal description;
struct wl_signal request_state; // struct wlr_output_event_request_state
struct wl_signal destroy;
} events;
struct wl_event_source *idle_frame;
struct wl_event_source *idle_done;
int attach_render_locks; // number of locks forcing rendering
struct wl_list cursors; // wlr_output_cursor.link
struct wlr_output_cursor *hardware_cursor;
struct wlr_swapchain *cursor_swapchain;
struct wlr_buffer *cursor_front_buffer;
int software_cursor_locks; // number of locks forcing software cursors
struct wl_list layers; // wlr_output_layer.link
struct wlr_allocator *allocator;
struct wlr_renderer *renderer;
struct wlr_swapchain *swapchain;
struct wlr_buffer *back_buffer;
struct wl_listener display_destroy;
struct wlr_addon_set addons;
void *data;
};
struct wlr_output_event_damage {
struct wlr_output *output;
const pixman_region32_t *damage; // output-buffer-local coordinates
};
struct wlr_output_event_precommit {
struct wlr_output *output;
struct timespec *when;
const struct wlr_output_state *state;
};
struct wlr_output_event_commit {
struct wlr_output *output;
struct timespec *when;
const struct wlr_output_state *state;
};
enum wlr_output_present_flag {
// The presentation was synchronized to the "vertical retrace" by the
// display hardware such that tearing does not happen.
WLR_OUTPUT_PRESENT_VSYNC = 0x1,
// The display hardware provided measurements that the hardware driver
// converted into a presentation timestamp.
WLR_OUTPUT_PRESENT_HW_CLOCK = 0x2,
// The display hardware signalled that it started using the new image
// content.
WLR_OUTPUT_PRESENT_HW_COMPLETION = 0x4,
// The presentation of this update was done zero-copy.
WLR_OUTPUT_PRESENT_ZERO_COPY = 0x8,
};
struct wlr_output_event_present {
struct wlr_output *output;
// Frame submission for which this presentation event is for (see
// wlr_output.commit_seq).
uint32_t commit_seq;
// Whether the frame was presented at all.
bool presented;
// Time when the content update turned into light the first time.
struct timespec *when;
// Vertical retrace counter. Zero if unavailable.
unsigned seq;
// Prediction of how many nanoseconds after `when` the very next output
// refresh may occur. Zero if unknown.
int refresh; // nsec
uint32_t flags; // enum wlr_output_present_flag
};
struct wlr_output_event_bind {
struct wlr_output *output;
struct wl_resource *resource;
};
struct wlr_output_event_request_state {
struct wlr_output *output;
const struct wlr_output_state *state;
};
struct wlr_surface;
/**
* Enables or disables the output. A disabled output is turned off and doesn't
* emit `frame` events.
*
* Whether an output is enabled is double-buffered state, see
* wlr_output_commit().
*/
void wlr_output_enable(struct wlr_output *output, bool enable);
void wlr_output_create_global(struct wlr_output *output);
void wlr_output_destroy_global(struct wlr_output *output);
/**
* Initialize the output's rendering subsystem with the provided allocator and
* renderer. After initialization, this function may invoked again to reinitialize
* the allocator and renderer to different values.
*
* Call this function prior to any call to wlr_output_attach_render(),
* wlr_output_commit() or wlr_output_cursor_create().
*
* The buffer capabilities of the provided must match the capabilities of the
* output's backend. Returns false otherwise.
*/
bool wlr_output_init_render(struct wlr_output *output,
struct wlr_allocator *allocator, struct wlr_renderer *renderer);
/**
* Returns the preferred mode for this output. If the output doesn't support
* modes, returns NULL.
*/
struct wlr_output_mode *wlr_output_preferred_mode(struct wlr_output *output);
/**
* Sets the output mode. The output needs to be enabled.
*
* Mode is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode);
/**
* Sets a custom mode on the output.
*
* When the output advertises fixed modes, custom modes are not guaranteed to
* work correctly, they may result in visual artifacts. If a suitable fixed mode
* is available, compositors should prefer it and use wlr_output_set_mode()
* instead of custom modes.
*
* Setting `refresh` to zero lets the backend pick a preferred value. The
* output needs to be enabled.
*
* Custom mode is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,
int32_t height, int32_t refresh);
/**
* Sets a transform for the output.
*
* Transform is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_transform(struct wlr_output *output,
enum wl_output_transform transform);
/**
* Enables or disables adaptive sync (ie. variable refresh rate) on this
* output. On some backends, this is just a hint and may be ignored.
* Compositors can inspect `wlr_output.adaptive_sync_status` to query the
* effective status. Backends that don't support adaptive sync will reject
* the output commit.
*
* When enabled, compositors can submit frames a little bit later than the
* deadline without dropping a frame.
*
* Adaptive sync is double-buffered state, see wlr_output_commit().
*/
void wlr_output_enable_adaptive_sync(struct wlr_output *output, bool enabled);
/**
* Set the output buffer render format. Default value: DRM_FORMAT_XRGB8888
*
* While high bit depth render formats are necessary for a monitor to receive
* useful high bit data, they do not guarantee it; a DRM_FORMAT_XBGR2101010
* buffer will only lead to sending 10-bpc image data to the monitor if
* hardware and software permit this.
*
* This only affects the format of the output buffer used when rendering,
* as with wlr_output_attach_render(). It has no impact on the cursor buffer
* format, or on the formats supported for direct scan-out (see also
* wlr_output_attach_buffer()).
*
* This format is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_render_format(struct wlr_output *output, uint32_t format);
/**
* Sets a scale for the output.
*
* Scale is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_scale(struct wlr_output *output, float scale);
void wlr_output_set_subpixel(struct wlr_output *output,
enum wl_output_subpixel subpixel);
/**
* Set the output name.
*
* Output names are subject to the following rules:
*
* - Each output name must be unique.
* - The name cannot change after the output has been advertised to clients.
*
* For more details, see the protocol documentation for wl_output.name.
*/
void wlr_output_set_name(struct wlr_output *output, const char *name);
void wlr_output_set_description(struct wlr_output *output, const char *desc);
/**
* Schedule a done event.
*
* This is intended to be used by wl_output add-on interfaces.
*/
void wlr_output_schedule_done(struct wlr_output *output);
void wlr_output_destroy(struct wlr_output *output);
/**
* Computes the transformed output resolution.
*/
void wlr_output_transformed_resolution(struct wlr_output *output,
int *width, int *height);
/**
* Computes the transformed and scaled output resolution.
*/
void wlr_output_effective_resolution(struct wlr_output *output,
int *width, int *height);
/**
* Attach the renderer's buffer to the output. Compositors must call this
* function before rendering. After they are done rendering, they should call
* wlr_output_commit() to submit the new frame. The output needs to be
* enabled.
*
* If non-NULL, `buffer_age` is set to the drawing buffer age in number of
* frames or -1 if unknown. This is useful for damage tracking.
*
* If the compositor decides not to render after calling this function, it
* must call wlr_output_rollback().
*/
bool wlr_output_attach_render(struct wlr_output *output, int *buffer_age);
/**
* Attach a buffer to the output. Compositors should call wlr_output_commit()
* to submit the new frame. The output needs to be enabled.
*
* Not all backends support direct scan-out on all buffers. Compositors can
* check whether a buffer is supported by calling wlr_output_test().
*/
void wlr_output_attach_buffer(struct wlr_output *output,
struct wlr_buffer *buffer);
/**
* Get the preferred format for reading pixels.
* This function might change the current rendering context.
*/
uint32_t wlr_output_preferred_read_format(struct wlr_output *output);
/**
* Set the damage region for the frame to be submitted. This is the region of
* the screen that has changed since the last frame.
*
* Compositors implementing damage tracking should call this function with the
* damaged region in output-buffer-local coordinates.
*
* This region is not to be confused with the renderer's buffer damage, ie. the
* region compositors need to repaint. Compositors usually need to repaint more
* than what changed since last frame since multiple render buffers are used.
*/
void wlr_output_set_damage(struct wlr_output *output,
const pixman_region32_t *damage);
/**
* Set the output layers state.
*
* See struct wlr_output_layer for more details on output layers.
*
* This state is double-buffered, see wlr_output_commit(). The layers array
* must remain valid until the wlr_output_test() or wlr_output_commit() call.
*/
void wlr_output_set_layers(struct wlr_output *output,
struct wlr_output_layer_state *layers, size_t layers_len);
/**
* Test whether the pending output state would be accepted by the backend. If
* this function returns true, wlr_output_commit() can only fail due to a
* runtime error.
*
* This function doesn't mutate the pending state.
*/
bool wlr_output_test(struct wlr_output *output);
/**
* Commit the pending output state. If wlr_output_attach_render() has been
* called, the pending frame will be submitted for display and a `frame` event
* will be scheduled.
*
* On failure, the pending changes are rolled back.
*/
bool wlr_output_commit(struct wlr_output *output);
/**
* Discard the pending output state.
*/
void wlr_output_rollback(struct wlr_output *output);
/**
* Test whether this output state would be accepted by the backend. If this
* function returns true, wlr_output_commit_state() will only fail due to a
* runtime error. This function does not change the current state of the
* output.
*/
bool wlr_output_test_state(struct wlr_output *output,
const struct wlr_output_state *state);
/**
* Attempts to apply the state to this output. This function may fail for any
* reason and return false. If failed, none of the state would have been applied,
* this function is atomic. If the commit succeeded, true is returned.
*
* Note: wlr_output_state_finish() would typically be called after the state
* has been committed.
*/
bool wlr_output_commit_state(struct wlr_output *output,
const struct wlr_output_state *state);
/**
* Manually schedules a `frame` event. If a `frame` event is already pending,
* it is a no-op.
*/
void wlr_output_schedule_frame(struct wlr_output *output);
/**
* Returns the maximum length of each gamma ramp, or 0 if unsupported.
*/
size_t wlr_output_get_gamma_size(struct wlr_output *output);
/**
* Sets the gamma table for this output. `r`, `g` and `b` are gamma ramps for
* red, green and blue. `size` is the length of the ramps and must not exceed
* the value returned by wlr_output_get_gamma_size().
*
* Providing zero-sized ramps resets the gamma table.
*
* The gamma table is double-buffered state, see wlr_output_commit().
*/
void wlr_output_set_gamma(struct wlr_output *output, size_t size,
const uint16_t *r, const uint16_t *g, const uint16_t *b);
/**
* Returns the wlr_output matching the provided wl_output resource. If the
* resource isn't a wl_output, it aborts. If the resource is inert (because the
* wlr_output has been destroyed), NULL is returned.
*/
struct wlr_output *wlr_output_from_resource(struct wl_resource *resource);
/**
* Locks the output to only use rendering instead of direct scan-out. This is
* useful if direct scan-out needs to be temporarily disabled (e.g. during
* screen capture). There must be as many unlocks as there have been locks to
* restore the original state. There should never be an unlock before a lock.
*/
void wlr_output_lock_attach_render(struct wlr_output *output, bool lock);
/**
* Locks the output to only use software cursors instead of hardware cursors.
* This is useful if hardware cursors need to be temporarily disabled (e.g.
* during screen capture). There must be as many unlocks as there have been
* locks to restore the original state. There should never be an unlock before
* a lock.
*/
void wlr_output_lock_software_cursors(struct wlr_output *output, bool lock);
/**
* Renders software cursors. This is a utility function that can be called when
* compositors render.
*/
void wlr_output_render_software_cursors(struct wlr_output *output,
const pixman_region32_t *damage);
/**
* Render software cursors.
*
* This is a utility function that can be called when compositors render.
*/
void wlr_output_add_software_cursors_to_render_pass(struct wlr_output *output,
struct wlr_render_pass *render_pass, const pixman_region32_t *damage);
/**
* Get the set of DRM formats suitable for the primary buffer, assuming a
* buffer with the specified capabilities.
*
* NULL is returned if the backend doesn't have any format constraint, ie. all
* formats are supported. An empty set is returned if the backend doesn't
* support any format.
*/
const struct wlr_drm_format_set *wlr_output_get_primary_formats(
struct wlr_output *output, uint32_t buffer_caps);
/**
* Check whether direct scan-out is allowed on the output.
*
* Direct scan-out is typically disallowed when there are software cursors or
* during screen capture.
*/
bool wlr_output_is_direct_scanout_allowed(struct wlr_output *output);
struct wlr_output_cursor *wlr_output_cursor_create(struct wlr_output *output);
bool wlr_output_cursor_set_buffer(struct wlr_output_cursor *cursor,
struct wlr_buffer *buffer, int32_t hotspot_x, int32_t hotspot_y);
bool wlr_output_cursor_move(struct wlr_output_cursor *cursor,
double x, double y);
void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor);
/**
* Initialize an output state.
*/
void wlr_output_state_init(struct wlr_output_state *state);
/**
* Releases all resources associated with an output state.
*/
void wlr_output_state_finish(struct wlr_output_state *state);
/**
* Enables or disables an output. A disabled output is turned off and doesn't
* emit `frame` events.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_enabled(struct wlr_output_state *state,
bool enabled);
/**
* Sets the output mode of an output. An output mode will specify the resolution
* and refresh rate, among other things.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_mode(struct wlr_output_state *state,
struct wlr_output_mode *mode);
/**
* Sets a custom output mode for an output. See wlr_output_state_set_mode()
* for details.
*
* When the output advertises fixed modes, custom modes are not guaranteed to
* work correctly, they may result in visual artifacts. If a suitable fixed mode
* is available, compositors should prefer it and use wlr_output_state_set_mode()
* instead of custom modes.
*
* Setting `refresh` to zero lets the backend pick a preferred value. The
* output needs to be enabled.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_custom_mode(struct wlr_output_state *state,
int32_t width, int32_t height, int32_t refresh);
/**
* Sets the scale of an output. The scale is used to increase the size of UI
* elements to aid users who use high DPI outputs.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_scale(struct wlr_output_state *state, float scale);
/**
* Sets the transform of an output. The transform is used to rotate or flip
* the contents of the screen.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_transform(struct wlr_output_state *state,
enum wl_output_transform transform);
/**
* Enables or disable adaptive sync for an output (ie. variable refresh rate).
* Compositors can inspect `wlr_output.adaptive_sync_status` to query the
* effective status. Backends that don't support adaptive sync will reject the
* output commit.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_adaptive_sync_enabled(struct wlr_output_state *state,
bool enabled);
/**
* Sets the render format for an output.
*
* The default value is DRM_FORMAT_XRGB8888.
*
* While high bit depth render formats are necessary for a monitor to receive
* useful high bit data, they do not guarantee it; a DRM_FORMAT_XBGR2101010
* buffer will only lead to sending 10-bpc image data to the monitor if
* hardware and software permit this.
*
* This only affects the format of the output buffer used when rendering using
* the output's own swapchain as with wlr_output_begin_render_pass(). It has no
* impact on the cursor buffer format, or on the formats supported for direct
* scan-out (see also wlr_output_state_set_buffer()).
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_render_format(struct wlr_output_state *state,
uint32_t format);
/**
* Sets the subpixel layout hint for an output. Note that this is only a hint
* and may be ignored. The default value depends on the backend.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_subpixel(struct wlr_output_state *state,
enum wl_output_subpixel subpixel);
/**
* Sets the buffer for an output. The buffer contains the contents of the
* screen. If the compositor wishes to present a new frame, they must commit
* with a buffer.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_buffer(struct wlr_output_state *state,
struct wlr_buffer *buffer);
/**
* Sets the gamma table for an output. `r`, `g` and `b` are gamma ramps for
* red, green and blue. `size` is the length of the ramps and must not exceed
* the value returned by wlr_output_get_gamma_size().
*
* Providing zero-sized ramps resets the gamma table.
*
* This state will be applied once wlr_output_commit_state() is called.
*/
bool wlr_output_state_set_gamma_lut(struct wlr_output_state *state,
size_t ramp_size, const uint16_t *r, const uint16_t *g, const uint16_t *b);
/**
* Sets the damage region for an output. This is used as a hint to the backend
* and can be used to reduce power consumption or increase performance on some
* devices.
*
* This should be called in along with wlr_output_state_set_buffer().
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_damage(struct wlr_output_state *state,
const pixman_region32_t *damage);
/**
* Set the output layers for an output. Output layers are used to try and take
* advantage of backend features that may reduce the amount of things that
* need to be composited.
*
* The array must be kept valid by the caller until wlr_output_state_finish()
* and all copies of the state have been finished as well.
* This state will be applied once wlr_output_commit_state() is called.
*/
void wlr_output_state_set_layers(struct wlr_output_state *state,
struct wlr_output_layer_state *layers, size_t layers_len);
/**
* Copies the output state from src to dst. It is safe to then
* wlr_output_state_finish() src and have dst still be valid.
*
* Note: The lifetime of the output layers inside the state are not managed. It
* is the responsibility of the constructor of the output layers to make sure
* they remain valid for the output state and all copies made.
*/
bool wlr_output_state_copy(struct wlr_output_state *dst,
const struct wlr_output_state *src);
/**
* Re-configure the swapchain as required for the output's primary buffer.
*
* If a NULL swapchain is passed in, a new swapchain is allocated. If the
* swapchain is already suitable for the output's primary buffer, this function
* is a no-op.
*
* The state describes the output changes the swapchain's buffers will be
* committed with. A NULL state indicates no change.
*/
bool wlr_output_configure_primary_swapchain(struct wlr_output *output,
const struct wlr_output_state *state, struct wlr_swapchain **swapchain);
/**
* Begin a render pass on this output.
*
* Same as wlr_output_attach_render(), but returns a struct wlr_render_pass.
*/
struct wlr_render_pass *wlr_output_begin_render_pass(struct wlr_output *output,
struct wlr_output_state *state, int *buffer_age, struct wlr_render_timer *timer);
/**
* Returns the transform that, when composed with `tr`, gives
* `WL_OUTPUT_TRANSFORM_NORMAL`.
*/
enum wl_output_transform wlr_output_transform_invert(
enum wl_output_transform tr);
/**
* Returns a transform that, when applied, has the same effect as applying
* sequentially `tr_a` and `tr_b`.
*/
enum wl_output_transform wlr_output_transform_compose(
enum wl_output_transform tr_a, enum wl_output_transform tr_b);
#endif

View file

@ -0,0 +1,103 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_OUTPUT_LAYER_H
#define WLR_TYPES_WLR_OUTPUT_LAYER_H
#include <wlr/render/drm_format_set.h>
#include <wlr/types/wlr_output.h>
#include <wlr/util/box.h>
#include <wlr/util/addon.h>
/**
* An output layer.
*
* Output layers are displayed between the output primary buffer (see
* wlr_output_attach_buffer() and wlr_output_attach_render()) and the cursor
* buffer. They can offload some rendering work to the backend.
*
* To configure output layers, callers should call wlr_output_layer_create() to
* create layers, attach struct wlr_output_layer_state onto
* struct wlr_output_state via wlr_output_set_layers() to describe their new
* state, and commit the output via wlr_output_commit().
*
* Backends may have arbitrary limitations when it comes to displaying output
* layers. Backends indicate whether or not a layer can be displayed via
* wlr_output_layer_state.accepted after wlr_output_test() or
* wlr_output_commit() is called. Compositors using the output layers API
* directly are expected to setup layers, call wlr_output_test(), paint the
* layers that the backend rejected with the renderer, then call
* wlr_output_commit().
*
* Callers are responsible for disabling output layers when they need the full
* output contents to be composited onto a single buffer, e.g. during screen
* capture.
*
* Callers must always include the state for all layers on output test/commit.
*/
struct wlr_output_layer {
struct wl_list link; // wlr_output.layers
struct wlr_addon_set addons;
struct {
struct wl_signal feedback; // struct wlr_output_layer_feedback_event
} events;
void *data;
// private state
struct wlr_fbox src_box;
struct wlr_box dst_box;
};
/**
* State for an output layer.
*/
struct wlr_output_layer_state {
struct wlr_output_layer *layer;
// Buffer to display, or NULL to disable the layer
struct wlr_buffer *buffer;
// Source box, leave empty to use the whole buffer
struct wlr_fbox src_box;
// Destination box in output-buffer-local coordinates
struct wlr_box dst_box;
// Damaged region since last commit in buffer-local coordinates. Leave NULL
// to damage the whole buffer.
const pixman_region32_t *damage;
// Populated by the backend after wlr_output_test() and wlr_output_commit(),
// indicates whether the backend has acknowledged and will take care of
// displaying the layer
bool accepted;
};
/**
* Feedback for an output layer.
*
* After an output commit, if the backend is not able to display a layer, it
* can send feedback events. These events can be used to re-allocate the
* layer's buffers so that they have a higher chance to get displayed.
*/
struct wlr_output_layer_feedback_event {
dev_t target_device;
const struct wlr_drm_format_set *formats;
};
/**
* Create a new output layer.
*/
struct wlr_output_layer *wlr_output_layer_create(struct wlr_output *output);
/**
* Destroy an output layer.
*/
void wlr_output_layer_destroy(struct wlr_output_layer *layer);
#endif

View file

@ -0,0 +1,161 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_OUTPUT_LAYOUT_H
#define WLR_TYPES_WLR_OUTPUT_LAYOUT_H
#include <stdbool.h>
#include <wayland-util.h>
#include <wlr/types/wlr_output.h>
#include <wlr/util/addon.h>
struct wlr_box;
/**
* Helper to arrange outputs in a 2D coordinate space. The output effective
* resolution is used, see wlr_output_effective_resolution().
*
* Outputs added to the output layout are automatically exposed to clients (see
* wlr_output_create_global()). They are no longer exposed when removed from the
* layout.
*/
struct wlr_output_layout {
struct wl_list outputs;
struct {
struct wl_signal add; // struct wlr_output_layout_output
struct wl_signal change;
struct wl_signal destroy;
} events;
void *data;
};
struct wlr_output_layout_output {
struct wlr_output_layout *layout;
struct wlr_output *output;
int x, y;
struct wl_list link;
bool auto_configured;
struct {
struct wl_signal destroy;
} events;
// private state
struct wlr_addon addon;
struct wl_listener commit;
};
struct wlr_output_layout *wlr_output_layout_create(void);
void wlr_output_layout_destroy(struct wlr_output_layout *layout);
/**
* Get the output layout for the specified output. Returns NULL if no output
* matches.
*/
struct wlr_output_layout_output *wlr_output_layout_get(
struct wlr_output_layout *layout, struct wlr_output *reference);
/**
* Get the output at the specified layout coordinates. Returns NULL if no
* output matches the coordinates.
*/
struct wlr_output *wlr_output_layout_output_at(
struct wlr_output_layout *layout, double lx, double ly);
/**
* Add the output to the layout at the specified coordinates. If the output is
* already a part of the output layout, it will become manually configured and
* will be moved to the specified coordinates.
*
* Returns true on success, false on a memory allocation error.
*/
struct wlr_output_layout_output *wlr_output_layout_add(struct wlr_output_layout *layout,
struct wlr_output *output, int lx, int ly);
/**
* Add the output to the layout as automatically configured. This will place
* the output in a sensible location in the layout. The coordinates of
* the output in the layout will be adjusted dynamically when the layout
* changes. If the output is already a part of the layout, it will become
* automatically configured.
*
* Returns true on success, false on a memory allocation error.
*/
struct wlr_output_layout_output *wlr_output_layout_add_auto(struct wlr_output_layout *layout,
struct wlr_output *output);
/**
* Remove the output from the layout. If the output is already not a part of
* the layout, this function is a no-op.
*/
void wlr_output_layout_remove(struct wlr_output_layout *layout,
struct wlr_output *output);
/**
* Given x and y in layout coordinates, adjusts them to local output
* coordinates relative to the given reference output.
*/
void wlr_output_layout_output_coords(struct wlr_output_layout *layout,
struct wlr_output *reference, double *lx, double *ly);
bool wlr_output_layout_contains_point(struct wlr_output_layout *layout,
struct wlr_output *reference, int lx, int ly);
bool wlr_output_layout_intersects(struct wlr_output_layout *layout,
struct wlr_output *reference, const struct wlr_box *target_lbox);
/**
* Get the closest point on this layout from the given point from the reference
* output. If reference is NULL, gets the closest point from the entire layout.
* If the layout is empty, the result is the given point itself.
*/
void wlr_output_layout_closest_point(struct wlr_output_layout *layout,
struct wlr_output *reference, double lx, double ly,
double *dest_lx, double *dest_ly);
/**
* Get the box of the layout for the given reference output in layout
* coordinates. If `reference` is NULL, the box will be for the extents of the
* entire layout. If the output isn't in the layout, the box will be empty.
*/
void wlr_output_layout_get_box(struct wlr_output_layout *layout,
struct wlr_output *reference, struct wlr_box *dest_box);
/**
* Get the output closest to the center of the layout extents.
*/
struct wlr_output *wlr_output_layout_get_center_output(
struct wlr_output_layout *layout);
enum wlr_direction {
WLR_DIRECTION_UP = 1 << 0,
WLR_DIRECTION_DOWN = 1 << 1,
WLR_DIRECTION_LEFT = 1 << 2,
WLR_DIRECTION_RIGHT = 1 << 3,
};
/**
* Get the closest adjacent output to the reference output from the reference
* point in the given direction.
*/
struct wlr_output *wlr_output_layout_adjacent_output(
struct wlr_output_layout *layout, enum wlr_direction direction,
struct wlr_output *reference, double ref_lx, double ref_ly);
struct wlr_output *wlr_output_layout_farthest_output(
struct wlr_output_layout *layout, enum wlr_direction direction,
struct wlr_output *reference, double ref_lx, double ref_ly);
#endif

View file

@ -0,0 +1,157 @@
/*
* This an unstable interface of wlroots. No guarantees are made regarding the
* future consistency of this API.
*/
#ifndef WLR_USE_UNSTABLE
#error "Add -DWLR_USE_UNSTABLE to enable unstable wlroots features"
#endif
#ifndef WLR_TYPES_WLR_OUTPUT_MANAGEMENT_V1_H
#define WLR_TYPES_WLR_OUTPUT_MANAGEMENT_V1_H
#include <stdbool.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_output.h>
struct wlr_output_manager_v1 {
struct wl_display *display;
struct wl_global *global;
struct wl_list resources; // wl_resource_get_link()
struct wl_list heads; // wlr_output_head_v1.link
uint32_t serial;
bool current_configuration_dirty;
struct {
/**
* The `apply` and `test` events are emitted when a client requests a
* configuration to be applied or tested. The compositor should send
* feedback with `wlr_output_configuration_v1_send_succeeded` xor
* `wlr_output_configuration_v1_send_failed`.
*
* The compositor gains ownership over the configuration (passed as the
* event data). That is, the compositor is responsible for destroying
* the configuration.
*/
struct wl_signal apply; // struct wlr_output_configuration_v1
struct wl_signal test; // struct wlr_output_configuration_v1
struct wl_signal destroy;
} events;
struct wl_listener display_destroy;
void *data;
};
struct wlr_output_head_v1_state {
struct wlr_output *output;
bool enabled;
struct wlr_output_mode *mode;
struct {
int32_t width, height;
int32_t refresh;
} custom_mode;
int32_t x, y;
enum wl_output_transform transform;
float scale;
bool adaptive_sync_enabled;
};
struct wlr_output_head_v1 {
struct wlr_output_head_v1_state state;
struct wlr_output_manager_v1 *manager;
struct wl_list link; // wlr_output_manager_v1.heads
struct wl_list resources; // wl_resource_get_link()
struct wl_list mode_resources; // wl_resource_get_link()
struct wl_listener output_destroy;
};
struct wlr_output_configuration_v1 {
struct wl_list heads; // wlr_output_configuration_head_v1.link
// client state
struct wlr_output_manager_v1 *manager;
uint32_t serial;
bool finalized; // client has requested to apply the config
bool finished; // feedback has been sent by the compositor
struct wl_resource *resource; // can be NULL if destroyed early
};
struct wlr_output_configuration_head_v1 {
struct wlr_output_head_v1_state state;
struct wlr_output_configuration_v1 *config;
struct wl_list link; // wlr_output_configuration_v1.heads
// client state
struct wl_resource *resource; // can be NULL if finalized or disabled
struct wl_listener output_destroy;
};
/**
* Create a new output manager. The compositor is responsible for calling
* wlr_output_manager_v1_set_configuration() whenever the current output
* configuration changes.
*/
struct wlr_output_manager_v1 *wlr_output_manager_v1_create(
struct wl_display *display);
/**
* Updates the output manager's current configuration. This will broadcast any
* changes to all clients.
*
* This function takes ownership over `config`. That is, the compositor must not
* access the configuration anymore.
*/
void wlr_output_manager_v1_set_configuration(
struct wlr_output_manager_v1 *manager,
struct wlr_output_configuration_v1 *config);
/**
* Create a new, empty output configuration. Compositors should add current head
* status with wlr_output_configuration_head_v1_create(). They can then call
* wlr_output_manager_v1_set_configuration().
*/
struct wlr_output_configuration_v1 *wlr_output_configuration_v1_create(void);
void wlr_output_configuration_v1_destroy(
struct wlr_output_configuration_v1 *config);
/**
* If the configuration comes from a client request, this sends positive
* feedback to the client (configuration has been applied).
*/
void wlr_output_configuration_v1_send_succeeded(
struct wlr_output_configuration_v1 *config);
/**
* If the configuration comes from a client request, this sends negative
* feedback to the client (configuration has not been applied).
*/
void wlr_output_configuration_v1_send_failed(
struct wlr_output_configuration_v1 *config);
/**
* Create a new configuration head for the given output. This adds the head to
* the provided output configuration.
*
* The configuration head will be pre-filled with data from `output`. The
* compositor should adjust this data according to its current internal state.
*/
struct wlr_output_configuration_head_v1 *
wlr_output_configuration_head_v1_create(
struct wlr_output_configuration_v1 *config, struct wlr_output *output);
/**
* Apply the head state on the supplied struct wlr_output_state.
*
* Compositors can then pass the resulting struct wlr_output_state to
* wlr_output_commit_state() or wlr_output_test_state().
*
* The position needs to be applied manually by the caller.
*/
void wlr_output_head_v1_state_apply(
const struct wlr_output_head_v1_state *head_state,
struct wlr_output_state *output_state);
#endif

Some files were not shown because too many files have changed in this diff Show more