diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 00000000..acf28c69 --- /dev/null +++ b/.gitlab-ci.yml @@ -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 diff --git a/debian/.debhelper/generated/swayfx/dh_installchangelogs.dch.trimmed b/debian/.debhelper/generated/swayfx/dh_installchangelogs.dch.trimmed new file mode 100644 index 00000000..bf5bd238 --- /dev/null +++ b/debian/.debhelper/generated/swayfx/dh_installchangelogs.dch.trimmed @@ -0,0 +1,11 @@ +swayfx (0.4-1) unstable; urgency=medium + + * new upstream release + + -- Penelope Gwen Wed, 22 May 2024 17:24:28 -0600 + +swayfx (0.3.2-1) unstable; urgency=medium + + * Compiled deb from upstream source + + -- Penelope Gwen Mon, 22 Apr 2024 19:41:11 -0600 diff --git a/debian/.debhelper/generated/swayfx/installed-by-dh_install b/debian/.debhelper/generated/swayfx/installed-by-dh_install new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/swayfx/installed-by-dh_installdocs b/debian/.debhelper/generated/swayfx/installed-by-dh_installdocs new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/swayfx/installed-by-dh_installexamples b/debian/.debhelper/generated/swayfx/installed-by-dh_installexamples new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/swayfx/installed-by-dh_installinfo b/debian/.debhelper/generated/swayfx/installed-by-dh_installinfo new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/swayfx/installed-by-dh_installman b/debian/.debhelper/generated/swayfx/installed-by-dh_installman new file mode 100644 index 00000000..e69de29b diff --git a/debian/.debhelper/generated/swayfx/triggers b/debian/.debhelper/generated/swayfx/triggers new file mode 100644 index 00000000..9ebf80db --- /dev/null +++ b/debian/.debhelper/generated/swayfx/triggers @@ -0,0 +1,2 @@ +# Triggers added by dh_makeshlibs/13.15.3 +activate-noawait ldconfig diff --git a/debian/.pc/.quilt_patches b/debian/.pc/.quilt_patches new file mode 100644 index 00000000..4baccb8e --- /dev/null +++ b/debian/.pc/.quilt_patches @@ -0,0 +1 @@ +patches diff --git a/debian/.pc/.quilt_series b/debian/.pc/.quilt_series new file mode 100644 index 00000000..c2067066 --- /dev/null +++ b/debian/.pc/.quilt_series @@ -0,0 +1 @@ +series diff --git a/debian/.pc/.version b/debian/.pc/.version new file mode 100644 index 00000000..0cfbf088 --- /dev/null +++ b/debian/.pc/.version @@ -0,0 +1 @@ +2 diff --git a/debian/README.Debian b/debian/README.Debian new file mode 100644 index 00000000..cae73224 --- /dev/null +++ b/debian/README.Debian @@ -0,0 +1,6 @@ +swayfx for Debian +---------------- + + + + -- Penelope Gwen Mon, 22 Apr 2024 19:41:11 -0600 diff --git a/debian/README.source b/debian/README.source new file mode 100644 index 00000000..88c2cde0 --- /dev/null +++ b/debian/README.source @@ -0,0 +1,10 @@ +swayfx for Debian +---------------- + + + + + + -- Penelope Gwen Mon, 22 Apr 2024 19:41:11 -0600 + diff --git a/debian/changelog b/debian/changelog new file mode 100644 index 00000000..91c05d92 --- /dev/null +++ b/debian/changelog @@ -0,0 +1,17 @@ +swayfx (0.4-2) unstable; urgency=medium + + * built on cleaner source + + -- Penelope Gwen Sat, 15 Jun 2024 15:13:48 -0600 + +swayfx (0.4-1) unstable; urgency=medium + + * new upstream release + + -- Penelope Gwen Wed, 22 May 2024 17:24:28 -0600 + +swayfx (0.3.2-1) unstable; urgency=medium + + * Compiled deb from upstream source + + -- Penelope Gwen Mon, 22 Apr 2024 19:41:11 -0600 diff --git a/debian/config.d/50-systemd-user.conf b/debian/config.d/50-systemd-user.conf new file mode 100644 index 00000000..af204fb6 --- /dev/null +++ b/debian/config.d/50-systemd-user.conf @@ -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 diff --git a/debian/control b/debian/control new file mode 100644 index 00000000..6395f191 --- /dev/null +++ b/debian/control @@ -0,0 +1,43 @@ +Source: swayfx +Section: x11 +Priority: optional +Maintainer: Penelope Gwen +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. diff --git a/debian/copyright b/debian/copyright new file mode 100644 index 00000000..961670f2 --- /dev/null +++ b/debian/copyright @@ -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 +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 + © 2018-2024 Birger Schacht +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. diff --git a/debian/debhelper-build-stamp b/debian/debhelper-build-stamp new file mode 100644 index 00000000..3b911500 --- /dev/null +++ b/debian/debhelper-build-stamp @@ -0,0 +1 @@ +swayfx diff --git a/debian/files b/debian/files new file mode 100644 index 00000000..c1693cdc --- /dev/null +++ b/debian/files @@ -0,0 +1,2 @@ +swayfx_0.4-1_amd64.buildinfo x11 optional +swayfx_0.4-1_amd64.deb x11 optional diff --git a/debian/gbp.conf b/debian/gbp.conf new file mode 100644 index 00000000..a54b60ec --- /dev/null +++ b/debian/gbp.conf @@ -0,0 +1,3 @@ +[DEFAULT] +pristine-tar = True +debian-branch = debian/sid diff --git a/debian/gitlab-ci.yml b/debian/gitlab-ci.yml new file mode 100644 index 00000000..4c4ceef0 --- /dev/null +++ b/debian/gitlab-ci.yml @@ -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" diff --git a/debian/rules b/debian/rules new file mode 100755 index 00000000..3570b27f --- /dev/null +++ b/debian/rules @@ -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 + diff --git a/debian/source/format b/debian/source/format new file mode 100644 index 00000000..163aaf8d --- /dev/null +++ b/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/debian/source/include-binaries b/debian/source/include-binaries new file mode 100644 index 00000000..7a114abc --- /dev/null +++ b/debian/source/include-binaries @@ -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 diff --git a/debian/sway-backgrounds/usr/share/doc/sway-backgrounds/changelog.Debian.gz b/debian/sway-backgrounds/usr/share/doc/sway-backgrounds/changelog.Debian.gz new file mode 100644 index 00000000..1554e591 Binary files /dev/null and b/debian/sway-backgrounds/usr/share/doc/sway-backgrounds/changelog.Debian.gz differ diff --git a/debian/sway-backgrounds/usr/share/doc/sway-backgrounds/copyright b/debian/sway-backgrounds/usr/share/doc/sway-backgrounds/copyright new file mode 100644 index 00000000..961670f2 --- /dev/null +++ b/debian/sway-backgrounds/usr/share/doc/sway-backgrounds/copyright @@ -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 +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 + © 2018-2024 Birger Schacht +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. diff --git a/debian/sway-portals.conf b/debian/sway-portals.conf new file mode 100644 index 00000000..3155127f --- /dev/null +++ b/debian/sway-portals.conf @@ -0,0 +1,2 @@ +[preferred] +default=wlr;gtk; diff --git a/debian/sway.maintscript b/debian/sway.maintscript new file mode 100644 index 00000000..f3e17763 --- /dev/null +++ b/debian/sway.maintscript @@ -0,0 +1 @@ +rm_conffile /etc/sway/config-vars.d/00-set-term-foot.conf 1.5-7~ diff --git a/debian/swayfx-docs.docs b/debian/swayfx-docs.docs new file mode 100644 index 00000000..73190411 --- /dev/null +++ b/debian/swayfx-docs.docs @@ -0,0 +1,2 @@ +README.source +README.Debian diff --git a/debian/swayfx.debhelper.log b/debian/swayfx.debhelper.log new file mode 100644 index 00000000..96d27ac9 --- /dev/null +++ b/debian/swayfx.debhelper.log @@ -0,0 +1 @@ +dh_missing diff --git a/debian/swayfx.substvars b/debian/swayfx.substvars new file mode 100644 index 00000000..64a87cd4 --- /dev/null +++ b/debian/swayfx.substvars @@ -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= diff --git a/debian/swayfx/DEBIAN/conffiles b/debian/swayfx/DEBIAN/conffiles new file mode 100644 index 00000000..078df1a7 --- /dev/null +++ b/debian/swayfx/DEBIAN/conffiles @@ -0,0 +1 @@ +/etc/sway/config diff --git a/debian/swayfx/DEBIAN/control b/debian/swayfx/DEBIAN/control new file mode 100644 index 00000000..68e4b092 --- /dev/null +++ b/debian/swayfx/DEBIAN/control @@ -0,0 +1,18 @@ +Package: swayfx +Version: 0.4-1 +Architecture: amd64 +Maintainer: Penelope Gwen +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. diff --git a/debian/swayfx/DEBIAN/md5sums b/debian/swayfx/DEBIAN/md5sums new file mode 100644 index 00000000..b9a301c4 --- /dev/null +++ b/debian/swayfx/DEBIAN/md5sums @@ -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 diff --git a/debian/swayfx/DEBIAN/shlibs b/debian/swayfx/DEBIAN/shlibs new file mode 100644 index 00000000..dd135e92 --- /dev/null +++ b/debian/swayfx/DEBIAN/shlibs @@ -0,0 +1 @@ +libscenefx 1 swayfx (>= 0.4) diff --git a/debian/swayfx/DEBIAN/triggers b/debian/swayfx/DEBIAN/triggers new file mode 100644 index 00000000..9ebf80db --- /dev/null +++ b/debian/swayfx/DEBIAN/triggers @@ -0,0 +1,2 @@ +# Triggers added by dh_makeshlibs/13.15.3 +activate-noawait ldconfig diff --git a/debian/swayfx/etc/sway/config b/debian/swayfx/etc/sway/config new file mode 100644 index 00000000..5a0f5e79 --- /dev/null +++ b/debian/swayfx/etc/sway/config @@ -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/* diff --git a/debian/swayfx/usr/include/scenefx/render/fx_renderer/fx_effect_framebuffers.h b/debian/swayfx/usr/include/scenefx/render/fx_renderer/fx_effect_framebuffers.h new file mode 100644 index 00000000..2a11a21e --- /dev/null +++ b/debian/swayfx/usr/include/scenefx/render/fx_renderer/fx_effect_framebuffers.h @@ -0,0 +1,32 @@ +#ifndef _FX_EFFECT_FRAMEBUFFERS_H +#define _FX_EFFECT_FRAMEBUFFERS_H + +#include +#include + +/** + * 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 diff --git a/debian/swayfx/usr/include/scenefx/render/fx_renderer/fx_renderer.h b/debian/swayfx/usr/include/scenefx/render/fx_renderer/fx_renderer.h new file mode 100644 index 00000000..5529f0ec --- /dev/null +++ b/debian/swayfx/usr/include/scenefx/render/fx_renderer/fx_renderer.h @@ -0,0 +1,35 @@ +#ifndef SCENEFX_FX_OPENGL_H +#define SCENEFX_FX_OPENGL_H + +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/scenefx/render/pass.h b/debian/swayfx/usr/include/scenefx/render/pass.h new file mode 100644 index 00000000..d005c375 --- /dev/null +++ b/debian/swayfx/usr/include/scenefx/render/pass.h @@ -0,0 +1,126 @@ +#ifndef SCENE_FX_RENDER_PASS_H +#define SCENE_FX_RENDER_PASS_H + +#include +#include +#include +#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 diff --git a/debian/swayfx/usr/include/scenefx/types/fx/blur_data.h b/debian/swayfx/usr/include/scenefx/types/fx/blur_data.h new file mode 100644 index 00000000..e6a7c295 --- /dev/null +++ b/debian/swayfx/usr/include/scenefx/types/fx/blur_data.h @@ -0,0 +1,24 @@ +#ifndef TYPES_FX_BLUR_DATA_H +#define TYPES_FX_BLUR_DATA_H + +#include +#include + +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 diff --git a/debian/swayfx/usr/include/scenefx/types/fx/shadow_data.h b/debian/swayfx/usr/include/scenefx/types/fx/shadow_data.h new file mode 100644 index 00000000..c3078716 --- /dev/null +++ b/debian/swayfx/usr/include/scenefx/types/fx/shadow_data.h @@ -0,0 +1,20 @@ +#ifndef TYPES_DECORATION_DATA +#define TYPES_DECORATION_DATA + +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/scenefx/types/wlr_scene.h b/debian/swayfx/usr/include/scenefx/types/wlr_scene.h new file mode 100644 index 00000000..59259317 --- /dev/null +++ b/debian/swayfx/usr/include/scenefx/types/wlr_scene.h @@ -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 +#include "scenefx/types/fx/shadow_data.h" +#include +#include +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/backend.h b/debian/swayfx/usr/include/wlr/backend.h new file mode 100644 index 00000000..9a8a2d87 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/backend/headless.h b/debian/swayfx/usr/include/wlr/backend/headless.h new file mode 100644 index 00000000..2516f3a6 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/headless.h @@ -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 +#include + +/** + * 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 diff --git a/debian/swayfx/usr/include/wlr/backend/interface.h b/debian/swayfx/usr/include/wlr/backend/interface.h new file mode 100644 index 00000000..da57cae9 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/interface.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/backend/libinput.h b/debian/swayfx/usr/include/wlr/backend/libinput.h new file mode 100644 index 00000000..83d281f9 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/libinput.h @@ -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 +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/backend/multi.h b/debian/swayfx/usr/include/wlr/backend/multi.h new file mode 100644 index 00000000..09000ac2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/multi.h @@ -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 + +/** + * 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 diff --git a/debian/swayfx/usr/include/wlr/backend/session.h b/debian/swayfx/usr/include/wlr/backend/session.h new file mode 100644 index 00000000..3583b317 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/session.h @@ -0,0 +1,120 @@ +#ifndef WLR_BACKEND_SESSION_H +#define WLR_BACKEND_SESSION_H + +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/backend/wayland.h b/debian/swayfx/usr/include/wlr/backend/wayland.h new file mode 100644 index 00000000..a30bac25 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/wayland.h @@ -0,0 +1,70 @@ +#ifndef WLR_BACKEND_WAYLAND_H +#define WLR_BACKEND_WAYLAND_H +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/backend/x11.h b/debian/swayfx/usr/include/wlr/backend/x11.h new file mode 100644 index 00000000..54d91c75 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/backend/x11.h @@ -0,0 +1,51 @@ +#ifndef WLR_BACKEND_X11_H +#define WLR_BACKEND_X11_H + +#include + +#include + +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/config.h b/debian/swayfx/usr/include/wlr/config.h new file mode 100644 index 00000000..4d3e082d --- /dev/null +++ b/debian/swayfx/usr/include/wlr/config.h @@ -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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_buffer.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_buffer.h new file mode 100644 index 00000000..820300f6 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_buffer.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_keyboard.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_keyboard.h new file mode 100644 index 00000000..2ec7c8cf --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_keyboard.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_output.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_output.h new file mode 100644 index 00000000..a5131297 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_output.h @@ -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 +#include +#include + +/** + * 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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_pointer.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_pointer.h new file mode 100644 index 00000000..74e0feaf --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_pointer.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_switch.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_switch.h new file mode 100644 index 00000000..793ed25c --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_switch.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_tablet_pad.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_tablet_pad.h new file mode 100644 index 00000000..f4a422f2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_tablet_pad.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_tablet_tool.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_tablet_tool.h new file mode 100644 index 00000000..68bf8cf7 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_tablet_tool.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/interfaces/wlr_touch.h b/debian/swayfx/usr/include/wlr/interfaces/wlr_touch.h new file mode 100644 index 00000000..e48a92f2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/interfaces/wlr_touch.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/render/allocator.h b/debian/swayfx/usr/include/wlr/render/allocator.h new file mode 100644 index 00000000..f5bb7522 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/allocator.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/render/dmabuf.h b/debian/swayfx/usr/include/wlr/render/dmabuf.h new file mode 100644 index 00000000..62f8e021 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/dmabuf.h @@ -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 +#include + +#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 + uint64_t modifier; // see DRM_FORMAT_MOD_* in + + 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 diff --git a/debian/swayfx/usr/include/wlr/render/drm_format_set.h b/debian/swayfx/usr/include/wlr/render/drm_format_set.h new file mode 100644 index 00000000..cc38bbd2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/drm_format_set.h @@ -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 +#include +#include + +/** 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 diff --git a/debian/swayfx/usr/include/wlr/render/egl.h b/debian/swayfx/usr/include/wlr/render/egl.h new file mode 100644 index 00000000..9bf1b801 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/egl.h @@ -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 + +#include +#include +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/render/gles2.h b/debian/swayfx/usr/include/wlr/render/gles2.h new file mode 100644 index 00000000..daf6aab3 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/gles2.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/render/interface.h b/debian/swayfx/usr/include/wlr/render/interface.h new file mode 100644 index 00000000..06f4083f --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/interface.h @@ -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 +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/render/pass.h b/debian/swayfx/usr/include/wlr/render/pass.h new file mode 100644 index 00000000..d1b3eb15 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/pass.h @@ -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 +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/render/pixman.h b/debian/swayfx/usr/include/wlr/render/pixman.h new file mode 100644 index 00000000..7e19fa4e --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/pixman.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/render/swapchain.h b/debian/swayfx/usr/include/wlr/render/swapchain.h new file mode 100644 index 00000000..8bb8afc9 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/swapchain.h @@ -0,0 +1,50 @@ +#ifndef WLR_RENDER_SWAPCHAIN_H +#define WLR_RENDER_SWAPCHAIN_H + +#include +#include +#include + +#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 diff --git a/debian/swayfx/usr/include/wlr/render/wlr_renderer.h b/debian/swayfx/usr/include/wlr/render/wlr_renderer.h new file mode 100644 index 00000000..450d61e2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/wlr_renderer.h @@ -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 +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/render/wlr_texture.h b/debian/swayfx/usr/include/wlr/render/wlr_texture.h new file mode 100644 index 00000000..87ed993f --- /dev/null +++ b/debian/swayfx/usr/include/wlr/render/wlr_texture.h @@ -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 +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_buffer.h b/debian/swayfx/usr/include/wlr/types/wlr_buffer.h new file mode 100644 index 00000000..de3aeec3 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_buffer.h @@ -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 +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_compositor.h b/debian/swayfx/usr/include/wlr/types/wlr_compositor.h new file mode 100644 index 00000000..53e663fd --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_compositor.h @@ -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 +#include +#include +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_content_type_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_content_type_v1.h new file mode 100644 index 00000000..6fa13d9b --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_content_type_v1.h @@ -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 +#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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_cursor.h b/debian/swayfx/usr/include/wlr/types/wlr_cursor.h new file mode 100644 index 00000000..004be0f1 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_cursor.h @@ -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 +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_cursor_shape_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_cursor_shape_v1.h new file mode 100644 index 00000000..2fef1e04 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_cursor_shape_v1.h @@ -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 +#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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_damage_ring.h b/debian/swayfx/usr/include/wlr/types/wlr_damage_ring.h new file mode 100644 index 00000000..d503a502 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_damage_ring.h @@ -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 +#include +#include +#include + +/* 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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_data_control_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_data_control_v1.h new file mode 100644 index 00000000..4435f14a --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_data_control_v1.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_data_device.h b/debian/swayfx/usr/include/wlr/types/wlr_data_device.h new file mode 100644 index 00000000..85d661a7 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_data_device.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_drm.h b/debian/swayfx/usr/include/wlr/types/wlr_drm.h new file mode 100644 index 00000000..d28c7b8f --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_drm.h @@ -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 +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_export_dmabuf_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_export_dmabuf_v1.h new file mode 100644 index 00000000..ba2d8bd8 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_export_dmabuf_v1.h @@ -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 +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_foreign_toplevel_management_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_foreign_toplevel_management_v1.h new file mode 100644 index 00000000..c4abcb3d --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_foreign_toplevel_management_v1.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_fractional_scale_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_fractional_scale_v1.h new file mode 100644 index 00000000..9126360d --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_fractional_scale_v1.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_fullscreen_shell_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_fullscreen_shell_v1.h new file mode 100644 index 00000000..4e5b2cfe --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_fullscreen_shell_v1.h @@ -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 +#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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_gamma_control_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_gamma_control_v1.h new file mode 100644 index 00000000..48fce09f --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_gamma_control_v1.h @@ -0,0 +1,50 @@ +#ifndef WLR_TYPES_WLR_GAMMA_CONTROL_V1_H +#define WLR_TYPES_WLR_GAMMA_CONTROL_V1_H + +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_idle_inhibit_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_idle_inhibit_v1.h new file mode 100644 index 00000000..596fbe88 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_idle_inhibit_v1.h @@ -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 + +/* 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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_idle_notify_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_idle_notify_v1.h new file mode 100644 index 00000000..7bc11cb7 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_idle_notify_v1.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_input_device.h b/debian/swayfx/usr/include/wlr/types/wlr_input_device.h new file mode 100644 index 00000000..0bbf517b --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_input_device.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_input_inhibitor.h b/debian/swayfx/usr/include/wlr/types/wlr_input_inhibitor.h new file mode 100644 index 00000000..49bc3ac2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_input_inhibitor.h @@ -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 + +/* + * 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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_input_method_v2.h b/debian/swayfx/usr/include/wlr/types/wlr_input_method_v2.h new file mode 100644 index 00000000..fd299cc8 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_input_method_v2.h @@ -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 +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_keyboard.h b/debian/swayfx/usr/include/wlr/types/wlr_keyboard.h new file mode 100644 index 00000000..abc4edf6 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_keyboard.h @@ -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 +#include +#include +#include +#include +#include + +#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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_keyboard_group.h b/debian/swayfx/usr/include/wlr/types/wlr_keyboard_group.h new file mode 100644 index 00000000..0d5c6a2a --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_keyboard_group.h @@ -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 +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h new file mode 100644 index 00000000..946e75f4 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h @@ -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 +#include + +/* 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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_layer_shell_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_layer_shell_v1.h new file mode 100644 index 00000000..df2107c5 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_layer_shell_v1.h @@ -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 +#include +#include +#include +#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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_linux_dmabuf_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_linux_dmabuf_v1.h new file mode 100644 index 00000000..e39c0993 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_linux_dmabuf_v1.h @@ -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 +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_matrix.h b/debian/swayfx/usr/include/wlr/types/wlr_matrix.h new file mode 100644 index 00000000..043cf6d3 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_matrix.h @@ -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 + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_output.h b/debian/swayfx/usr/include/wlr/types/wlr_output.h new file mode 100644 index 00000000..9de8dffb --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_output.h @@ -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 +#include +#include +#include +#include +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_output_layer.h b/debian/swayfx/usr/include/wlr/types/wlr_output_layer.h new file mode 100644 index 00000000..f4aef058 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_output_layer.h @@ -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 +#include +#include +#include + +/** + * 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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_output_layout.h b/debian/swayfx/usr/include/wlr/types/wlr_output_layout.h new file mode 100644 index 00000000..26bb79b0 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_output_layout.h @@ -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 +#include +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_output_management_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_output_management_v1.h new file mode 100644 index 00000000..f1cd5ec5 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_output_management_v1.h @@ -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 +#include +#include + +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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_output_power_management_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_output_power_management_v1.h new file mode 100644 index 00000000..688e37a4 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_output_power_management_v1.h @@ -0,0 +1,41 @@ +#ifndef WLR_TYPES_WLR_OUTPUT_POWER_MANAGEMENT_V1_H +#define WLR_TYPES_WLR_OUTPUT_POWER_MANAGEMENT_V1_H + +#include +#include "wlr-output-power-management-unstable-v1-protocol.h" + +struct wlr_output_power_manager_v1 { + struct wl_global *global; + struct wl_list output_powers; // wlr_output_power_v1.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal set_mode; // struct wlr_output_power_v1_set_mode_event + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_output_power_v1 { + struct wl_resource *resource; + struct wlr_output *output; + struct wlr_output_power_manager_v1 *manager; + struct wl_list link; // wlr_output_power_manager_v1.output_powers + + struct wl_listener output_destroy_listener; + struct wl_listener output_commit_listener; + + void *data; +}; + +struct wlr_output_power_v1_set_mode_event { + struct wlr_output *output; + enum zwlr_output_power_v1_mode mode; +}; + +struct wlr_output_power_manager_v1 *wlr_output_power_manager_v1_create( + struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_pointer.h b/debian/swayfx/usr/include/wlr/types/wlr_pointer.h new file mode 100644 index 00000000..16aed1dc --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_pointer.h @@ -0,0 +1,158 @@ +/* + * 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_POINTER_H +#define WLR_TYPES_WLR_POINTER_H + +#include +#include +#include +#include + +struct wlr_pointer_impl; + +struct wlr_pointer { + struct wlr_input_device base; + + const struct wlr_pointer_impl *impl; + + char *output_name; + + struct { + struct wl_signal motion; // struct wlr_pointer_motion_event + struct wl_signal motion_absolute; // struct wlr_pointer_motion_absolute_event + struct wl_signal button; // struct wlr_pointer_button_event + struct wl_signal axis; // struct wlr_pointer_axis_event + struct wl_signal frame; + + struct wl_signal swipe_begin; // struct wlr_pointer_swipe_begin_event + struct wl_signal swipe_update; // struct wlr_pointer_swipe_update_event + struct wl_signal swipe_end; // struct wlr_pointer_swipe_end_event + + struct wl_signal pinch_begin; // struct wlr_pointer_pinch_begin_event + struct wl_signal pinch_update; // struct wlr_pointer_pinch_update_event + struct wl_signal pinch_end; // struct wlr_pointer_pinch_end_event + + struct wl_signal hold_begin; // struct wlr_pointer_hold_begin_event + struct wl_signal hold_end; // struct wlr_pointer_hold_end_event + } events; + + void *data; +}; + +struct wlr_pointer_motion_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + double delta_x, delta_y; + double unaccel_dx, unaccel_dy; +}; + +struct wlr_pointer_motion_absolute_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + // From 0..1 + double x, y; +}; + +struct wlr_pointer_button_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + uint32_t button; + enum wlr_button_state state; +}; + +enum wlr_axis_source { + WLR_AXIS_SOURCE_WHEEL, + WLR_AXIS_SOURCE_FINGER, + WLR_AXIS_SOURCE_CONTINUOUS, + WLR_AXIS_SOURCE_WHEEL_TILT, +}; + +enum wlr_axis_orientation { + WLR_AXIS_ORIENTATION_VERTICAL, + WLR_AXIS_ORIENTATION_HORIZONTAL, +}; + +#define WLR_POINTER_AXIS_DISCRETE_STEP 120 + +struct wlr_pointer_axis_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + enum wlr_axis_source source; + enum wlr_axis_orientation orientation; + double delta; + int32_t delta_discrete; +}; + +struct wlr_pointer_swipe_begin_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + uint32_t fingers; +}; + +struct wlr_pointer_swipe_update_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + uint32_t fingers; + // Relative coordinates of the logical center of the gesture + // compared to the previous event. + double dx, dy; +}; + +struct wlr_pointer_swipe_end_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + bool cancelled; +}; + +struct wlr_pointer_pinch_begin_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + uint32_t fingers; +}; + +struct wlr_pointer_pinch_update_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + uint32_t fingers; + // Relative coordinates of the logical center of the gesture + // compared to the previous event. + double dx, dy; + // Absolute scale compared to the begin event + double scale; + // Relative angle in degrees clockwise compared to the previous event. + double rotation; +}; + +struct wlr_pointer_pinch_end_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + bool cancelled; +}; + +struct wlr_pointer_hold_begin_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + uint32_t fingers; +}; + +struct wlr_pointer_hold_end_event { + struct wlr_pointer *pointer; + uint32_t time_msec; + bool cancelled; +}; + +/** + * Get a struct wlr_pointer from a struct wlr_input_device. + * + * Asserts that the input device is a pointer. + */ +struct wlr_pointer *wlr_pointer_from_input_device( + struct wlr_input_device *input_device); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_pointer_constraints_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_pointer_constraints_v1.h new file mode 100644 index 00000000..21280ff2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_pointer_constraints_v1.h @@ -0,0 +1,104 @@ +/* + * 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_POINTER_CONSTRAINTS_V1_H +#define WLR_TYPES_WLR_POINTER_CONSTRAINTS_V1_H + +#include +#include +#include +#include +#include "pointer-constraints-unstable-v1-protocol.h" + +struct wlr_seat; + +enum wlr_pointer_constraint_v1_type { + WLR_POINTER_CONSTRAINT_V1_LOCKED, + WLR_POINTER_CONSTRAINT_V1_CONFINED, +}; + +enum wlr_pointer_constraint_v1_state_field { + WLR_POINTER_CONSTRAINT_V1_STATE_REGION = 1 << 0, + WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT = 1 << 1, +}; + +struct wlr_pointer_constraint_v1_state { + uint32_t committed; // enum wlr_pointer_constraint_v1_state_field + pixman_region32_t region; + + // only valid for locked_pointer + struct { + double x, y; + } cursor_hint; +}; + +struct wlr_pointer_constraint_v1 { + struct wlr_pointer_constraints_v1 *pointer_constraints; + + struct wl_resource *resource; + struct wlr_surface *surface; + struct wlr_seat *seat; + enum zwp_pointer_constraints_v1_lifetime lifetime; + enum wlr_pointer_constraint_v1_type type; + pixman_region32_t region; + + struct wlr_pointer_constraint_v1_state current, pending; + + struct wl_listener surface_commit; + struct wl_listener surface_destroy; + struct wl_listener seat_destroy; + + struct wl_list link; // wlr_pointer_constraints_v1.constraints + + struct { + /** + * Called when a pointer constraint's region is updated, + * post-surface-commit. + */ + struct wl_signal set_region; + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_pointer_constraints_v1 { + struct wl_global *global; + struct wl_list constraints; // wlr_pointer_constraint_v1.link + + struct { + /** + * Called when a new pointer constraint is created. + * + * The data pointer is a struct wlr_pointer_constraint_v1. + */ + struct wl_signal new_constraint; + } events; + + struct wl_listener display_destroy; + + void *data; +}; + +struct wlr_pointer_constraints_v1 *wlr_pointer_constraints_v1_create( + struct wl_display *display); + +struct wlr_pointer_constraint_v1 * + wlr_pointer_constraints_v1_constraint_for_surface( + struct wlr_pointer_constraints_v1 *pointer_constraints, + struct wlr_surface *surface, struct wlr_seat *seat); + +void wlr_pointer_constraint_v1_send_activated( + struct wlr_pointer_constraint_v1 *constraint); +/** + * Deactivate the constraint. May destroy the constraint. + */ +void wlr_pointer_constraint_v1_send_deactivated( + struct wlr_pointer_constraint_v1 *constraint); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_pointer_gestures_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_pointer_gestures_v1.h new file mode 100644 index 00000000..5510ce21 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_pointer_gestures_v1.h @@ -0,0 +1,82 @@ +/* + * 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_POINTER_GESTURES_V1_H +#define WLR_TYPES_WLR_POINTER_GESTURES_V1_H + +#include +#include + +struct wlr_surface; + +struct wlr_pointer_gestures_v1 { + struct wl_global *global; + struct wl_list swipes; // wl_resource_get_link() + struct wl_list pinches; // wl_resource_get_link() + struct wl_list holds; // wl_resource_get_link() + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_pointer_gestures_v1 *wlr_pointer_gestures_v1_create( + struct wl_display *display); + +void wlr_pointer_gestures_v1_send_swipe_begin( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + uint32_t fingers); +void wlr_pointer_gestures_v1_send_swipe_update( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + double dx, + double dy); +void wlr_pointer_gestures_v1_send_swipe_end( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + bool cancelled); + +void wlr_pointer_gestures_v1_send_pinch_begin( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + uint32_t fingers); +void wlr_pointer_gestures_v1_send_pinch_update( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + double dx, + double dy, + double scale, + double rotation); +void wlr_pointer_gestures_v1_send_pinch_end( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + bool cancelled); + +void wlr_pointer_gestures_v1_send_hold_begin( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + uint32_t fingers); +void wlr_pointer_gestures_v1_send_hold_end( + struct wlr_pointer_gestures_v1 *gestures, + struct wlr_seat *seat, + uint32_t time_msec, + bool cancelled); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_presentation_time.h b/debian/swayfx/usr/include/wlr/types/wlr_presentation_time.h new file mode 100644 index 00000000..9543cff6 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_presentation_time.h @@ -0,0 +1,108 @@ +/* + * 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_PRESENTATION_TIME_H +#define WLR_TYPES_WLR_PRESENTATION_TIME_H + +#include +#include +#include +#include + +struct wlr_surface; + +struct wlr_output; +struct wlr_output_event_present; + +struct wlr_presentation { + struct wl_global *global; + + struct { + struct wl_signal destroy; + } events; + + struct wl_listener display_destroy; +}; + +struct wlr_presentation_feedback { + struct wl_list resources; // wl_resource_get_link() + + // Only when the wlr_presentation_surface_textured_on_output() or + // wlr_presentation_surface_scanned_out_on_output() helper has been called. + struct wlr_output *output; + bool output_committed; + uint32_t output_commit_seq; + bool zero_copy; + + struct wl_listener output_commit; + struct wl_listener output_present; + struct wl_listener output_destroy; +}; + +struct wlr_presentation_event { + struct wlr_output *output; + uint64_t tv_sec; + uint32_t tv_nsec; + uint32_t refresh; + uint64_t seq; + uint32_t flags; // enum wp_presentation_feedback_kind +}; + +struct wlr_backend; + +struct wlr_presentation *wlr_presentation_create(struct wl_display *display, + struct wlr_backend *backend); +/** + * Mark the current surface's buffer as sampled. + * + * The compositor must call this function when it uses the surface's current + * contents (e.g. when rendering the surface's current texture, when + * referencing its current buffer, or when directly scanning out its current + * buffer). A wlr_presentation_feedback is returned. The compositor should call + * wlr_presentation_feedback_send_presented() if this content has been displayed, + * then wlr_presentation_feedback_destroy(). + * + * NULL is returned if the client hasn't requested presentation feedback for + * this surface. + */ +struct wlr_presentation_feedback *wlr_presentation_surface_sampled( + struct wlr_presentation *presentation, struct wlr_surface *surface); +void wlr_presentation_feedback_send_presented( + struct wlr_presentation_feedback *feedback, + const struct wlr_presentation_event *event); +void wlr_presentation_feedback_destroy( + struct wlr_presentation_feedback *feedback); + +/** + * Fill a wlr_presentation_event from a struct wlr_output_event_present. + */ +void wlr_presentation_event_from_output(struct wlr_presentation_event *event, + const struct wlr_output_event_present *output_event); + +/** + * Mark the current surface's buffer as textured on the given output. + * + * Instead of calling wlr_presentation_surface_sampled() and managing the + * struct wlr_presentation_feedback itself, the compositor can call this function + * before a wlr_output_commit() call to indicate that the surface's current + * contents have been copied to a buffer which will be displayed on the output. + */ +void wlr_presentation_surface_textured_on_output( + struct wlr_presentation *presentation, struct wlr_surface *surface, + struct wlr_output *output); +/** + * Mark the current surface's buffer as scanned out on the given output. + * + * Same as wlr_presentation_surface_textured_on_output(), but indicates direct + * scan-out. + */ +void wlr_presentation_surface_scanned_out_on_output( + struct wlr_presentation *presentation, struct wlr_surface *surface, + struct wlr_output *output); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_primary_selection.h b/debian/swayfx/usr/include/wlr/types/wlr_primary_selection.h new file mode 100644 index 00000000..af3d4849 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_primary_selection.h @@ -0,0 +1,68 @@ +/* + * 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_PRIMARY_SELECTION_H +#define WLR_TYPES_WLR_PRIMARY_SELECTION_H + +#include +#include + +struct wlr_primary_selection_source; + +/** + * A data source implementation. Only the `send` function is mandatory. + */ +struct wlr_primary_selection_source_impl { + void (*send)(struct wlr_primary_selection_source *source, + const char *mime_type, int fd); + void (*destroy)(struct wlr_primary_selection_source *source); +}; + +/** + * A source is the sending side of a selection. + */ +struct wlr_primary_selection_source { + const struct wlr_primary_selection_source_impl *impl; + + // source metadata + struct wl_array mime_types; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +void wlr_primary_selection_source_init( + struct wlr_primary_selection_source *source, + const struct wlr_primary_selection_source_impl *impl); +void wlr_primary_selection_source_destroy( + struct wlr_primary_selection_source *source); +void wlr_primary_selection_source_send( + struct wlr_primary_selection_source *source, const char *mime_type, + int fd); + +/** + * Request setting the primary selection. If `client` is not null, then the + * serial will be checked against the set of serials sent to the client on that + * seat. + */ +void wlr_seat_request_set_primary_selection(struct wlr_seat *seat, + struct wlr_seat_client *client, + struct wlr_primary_selection_source *source, uint32_t serial); +/** + * Sets the current primary 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_primary_selection(struct wlr_seat *seat, + struct wlr_primary_selection_source *source, uint32_t serial); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_primary_selection_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_primary_selection_v1.h new file mode 100644 index 00000000..78b542a0 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_primary_selection_v1.h @@ -0,0 +1,49 @@ +/* + * 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_PRIMARY_SELECTION_V1_H +#define WLR_TYPES_WLR_PRIMARY_SELECTION_V1_H + +#include +#include + +struct wlr_primary_selection_v1_device_manager { + struct wl_global *global; + struct wl_list devices; // wlr_primary_selection_v1_device.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +/** + * A device is a per-seat object used to set and get the current selection. + */ +struct wlr_primary_selection_v1_device { + struct wlr_primary_selection_v1_device_manager *manager; + struct wlr_seat *seat; + struct wl_list link; // wlr_primary_selection_v1_device_manager.devices + struct wl_list resources; // wl_resource_get_link() + + struct wl_list offers; // wl_resource_get_link() + + struct wl_listener seat_destroy; + struct wl_listener seat_focus_change; + struct wl_listener seat_set_primary_selection; + + void *data; +}; + +struct wlr_primary_selection_v1_device_manager * + wlr_primary_selection_v1_device_manager_create(struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_region.h b/debian/swayfx/usr/include/wlr/types/wlr_region.h new file mode 100644 index 00000000..62ac85c0 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_region.h @@ -0,0 +1,30 @@ +/* + * 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_REGION_H +#define WLR_TYPES_WLR_REGION_H + +#include + +struct wl_resource; + +/** + * Obtain a Pixman region from a wl_region resource. + * + * To allow clients to create wl_region objects, call wlr_compositor_create(). + */ +const pixman_region32_t *wlr_region_from_resource(struct wl_resource *resource); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_relative_pointer_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_relative_pointer_v1.h new file mode 100644 index 00000000..fcd44d52 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_relative_pointer_v1.h @@ -0,0 +1,78 @@ +/* + * 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_RELATIVE_POINTER_V1_H +#define WLR_TYPES_WLR_RELATIVE_POINTER_V1_H + +#include + +/** + * This protocol specifies a set of interfaces used for making clients able to + * receive relative pointer events not obstructed by barriers (such as the + * monitor edge or pointer constraints). + */ + +/** + * A global interface used for getting the relative pointer object for a given + * pointer. + */ +struct wlr_relative_pointer_manager_v1 { + struct wl_global *global; + struct wl_list relative_pointers; // wlr_relative_pointer_v1.link + + struct { + struct wl_signal destroy; + struct wl_signal new_relative_pointer; // struct wlr_relative_pointer_v1 + } events; + + struct wl_listener display_destroy_listener; + + void *data; +}; + +/** + * A wp_relative_pointer object is an extension to the wl_pointer interface + * used for emitting relative pointer events. It shares the same focus as + * wl_pointer objects of the same seat and will only emit events when it has + * focus. + */ +struct wlr_relative_pointer_v1 { + struct wl_resource *resource; + struct wl_resource *pointer_resource; + struct wlr_seat *seat; + struct wl_list link; // wlr_relative_pointer_manager_v1.relative_pointers + + struct { + struct wl_signal destroy; + } events; + + struct wl_listener seat_destroy; + struct wl_listener pointer_destroy; + + void *data; +}; + +struct wlr_relative_pointer_manager_v1 *wlr_relative_pointer_manager_v1_create( + struct wl_display *display); + +/** + * Send a relative motion event to the seat. Time is given in microseconds + * (unlike wl_pointer which uses milliseconds). + */ +void wlr_relative_pointer_manager_v1_send_relative_motion( + struct wlr_relative_pointer_manager_v1 *manager, struct wlr_seat *seat, + uint64_t time_usec, double dx, double dy, + double dx_unaccel, double dy_unaccel); + +/** + * Get a relative pointer from its resource. Returns NULL if inert. + */ +struct wlr_relative_pointer_v1 *wlr_relative_pointer_v1_from_resource( + struct wl_resource *resource); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_scene.h b/debian/swayfx/usr/include/wlr/types/wlr_scene.h new file mode 100644 index 00000000..dc8d6fef --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_scene.h @@ -0,0 +1,597 @@ +/* + * 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 +#include +#include +#include +#include +#include +#include +#include + +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; + 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); + +/** + * 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 diff --git a/debian/swayfx/usr/include/wlr/types/wlr_screencopy_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_screencopy_v1.h new file mode 100644 index 00000000..c1e990fa --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_screencopy_v1.h @@ -0,0 +1,63 @@ +/* + * 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_SCREENCOPY_V1_H +#define WLR_TYPES_WLR_SCREENCOPY_V1_H + +#include +#include +#include +#include + +struct wlr_screencopy_manager_v1 { + struct wl_global *global; + struct wl_list frames; // wlr_screencopy_frame_v1.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_screencopy_v1_client { + int ref; + struct wlr_screencopy_manager_v1 *manager; + struct wl_list damages; +}; + +struct wlr_screencopy_frame_v1 { + struct wl_resource *resource; + struct wlr_screencopy_v1_client *client; + struct wl_list link; // wlr_screencopy_manager_v1.frames + + uint32_t shm_format, dmabuf_format; // DRM format codes + struct wlr_box box; + int shm_stride; + + bool overlay_cursor, cursor_locked; + + bool with_damage; + + enum wlr_buffer_cap buffer_cap; + struct wlr_buffer *buffer; + + struct wlr_output *output; + struct wl_listener output_commit; + struct wl_listener output_destroy; + struct wl_listener output_enable; + + void *data; +}; + +struct wlr_screencopy_manager_v1 *wlr_screencopy_manager_v1_create( + struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_seat.h b/debian/swayfx/usr/include/wlr/types/wlr_seat.h new file mode 100644 index 00000000..70cc0782 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_seat.h @@ -0,0 +1,749 @@ +/* + * 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_SEAT_H +#define WLR_TYPES_WLR_SEAT_H + +#include +#include +#include +#include +#include + +struct wlr_surface; + +#define WLR_SERIAL_RINGSET_SIZE 128 + +struct wlr_serial_range { + uint32_t min_incl; + uint32_t max_incl; +}; +struct wlr_serial_ringset { + struct wlr_serial_range data[WLR_SERIAL_RINGSET_SIZE]; + int end; + int count; +}; + +/** + * Contains state for a single client's bound wl_seat resource and can be used + * to issue input events to that client. The lifetime of these objects is + * managed by struct wlr_seat; some may be NULL. + */ +struct wlr_seat_client { + struct wl_client *client; + struct wlr_seat *seat; + struct wl_list link; + + // lists of wl_resource + struct wl_list resources; + struct wl_list pointers; + struct wl_list keyboards; + struct wl_list touches; + struct wl_list data_devices; + + struct { + struct wl_signal destroy; + } events; + + // set of serials which were sent to the client on this seat + // for use by wlr_seat_client_{next_serial,validate_event_serial} + struct wlr_serial_ringset serials; + bool needs_touch_frame; + + // When the client doesn't support high-resolution scroll, accumulate deltas + // until we can notify a discrete event. + // Some mice have a free spinning wheel, making possible to lock the wheel + // when the accumulator value is not 0. To avoid synchronization issues + // between the mouse wheel and the accumulators, store the last delta and + // when the scroll direction changes, reset the accumulator. + // Indexed by wlr_axis_orientation. + struct { + int32_t acc_discrete[2]; + int32_t last_discrete[2]; + double acc_axis[2]; + } value120; +}; + +struct wlr_touch_point { + int32_t touch_id; + struct wlr_surface *surface; // may be NULL if destroyed + struct wlr_seat_client *client; + + struct wlr_surface *focus_surface; + struct wlr_seat_client *focus_client; + double sx, sy; + + struct wl_listener surface_destroy; + struct wl_listener focus_surface_destroy; + struct wl_listener client_destroy; + + struct { + struct wl_signal destroy; + } events; + + struct wl_list link; +}; + +struct wlr_seat_pointer_grab; + +struct wlr_pointer_grab_interface { + void (*enter)(struct wlr_seat_pointer_grab *grab, + struct wlr_surface *surface, double sx, double sy); + void (*clear_focus)(struct wlr_seat_pointer_grab *grab); + void (*motion)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec, + double sx, double sy); + uint32_t (*button)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec, + uint32_t button, enum wlr_button_state state); + void (*axis)(struct wlr_seat_pointer_grab *grab, uint32_t time_msec, + enum wlr_axis_orientation orientation, double value, + int32_t value_discrete, enum wlr_axis_source source); + void (*frame)(struct wlr_seat_pointer_grab *grab); + void (*cancel)(struct wlr_seat_pointer_grab *grab); +}; + +struct wlr_seat_keyboard_grab; + +struct wlr_keyboard_grab_interface { + void (*enter)(struct wlr_seat_keyboard_grab *grab, + struct wlr_surface *surface, const uint32_t keycodes[], + size_t num_keycodes, const struct wlr_keyboard_modifiers *modifiers); + void (*clear_focus)(struct wlr_seat_keyboard_grab *grab); + void (*key)(struct wlr_seat_keyboard_grab *grab, uint32_t time_msec, + uint32_t key, uint32_t state); + void (*modifiers)(struct wlr_seat_keyboard_grab *grab, + const struct wlr_keyboard_modifiers *modifiers); + void (*cancel)(struct wlr_seat_keyboard_grab *grab); +}; + +struct wlr_seat_touch_grab; + +struct wlr_touch_grab_interface { + uint32_t (*down)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, + struct wlr_touch_point *point); + void (*up)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, + struct wlr_touch_point *point); + void (*motion)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, + struct wlr_touch_point *point); + void (*enter)(struct wlr_seat_touch_grab *grab, uint32_t time_msec, + struct wlr_touch_point *point); + void (*frame)(struct wlr_seat_touch_grab *grab); + // Cancel grab + void (*cancel)(struct wlr_seat_touch_grab *grab); + // Send wl_touch.cancel + void (*wl_cancel)(struct wlr_seat_touch_grab *grab, + struct wlr_surface *surface); +}; + +/** + * Passed to wlr_seat_touch_start_grab() to start a grab of the touch device. + * The grabber is responsible for handling touch events for the seat. + */ +struct wlr_seat_touch_grab { + const struct wlr_touch_grab_interface *interface; + struct wlr_seat *seat; + void *data; +}; + +/** + * Passed to wlr_seat_keyboard_start_grab() to start a grab of the keyboard. + * The grabber is responsible for handling keyboard events for the seat. + */ +struct wlr_seat_keyboard_grab { + const struct wlr_keyboard_grab_interface *interface; + struct wlr_seat *seat; + void *data; +}; + +/** + * Passed to wlr_seat_pointer_start_grab() to start a grab of the pointer. The + * grabber is responsible for handling pointer events for the seat. + */ +struct wlr_seat_pointer_grab { + const struct wlr_pointer_grab_interface *interface; + struct wlr_seat *seat; + void *data; +}; + +#define WLR_POINTER_BUTTONS_CAP 16 + +struct wlr_seat_pointer_state { + struct wlr_seat *seat; + struct wlr_seat_client *focused_client; + struct wlr_surface *focused_surface; + double sx, sy; + + struct wlr_seat_pointer_grab *grab; + struct wlr_seat_pointer_grab *default_grab; + + bool sent_axis_source; + enum wlr_axis_source cached_axis_source; + + uint32_t buttons[WLR_POINTER_BUTTONS_CAP]; + size_t button_count; + uint32_t grab_button; + uint32_t grab_serial; + uint32_t grab_time; + + struct wl_listener surface_destroy; + + struct { + struct wl_signal focus_change; // struct wlr_seat_pointer_focus_change_event + } events; +}; + +struct wlr_seat_keyboard_state { + struct wlr_seat *seat; + struct wlr_keyboard *keyboard; + + struct wlr_seat_client *focused_client; + struct wlr_surface *focused_surface; + + struct wl_listener keyboard_destroy; + struct wl_listener keyboard_keymap; + struct wl_listener keyboard_repeat_info; + + struct wl_listener surface_destroy; + + struct wlr_seat_keyboard_grab *grab; + struct wlr_seat_keyboard_grab *default_grab; + + struct { + struct wl_signal focus_change; // struct wlr_seat_keyboard_focus_change_event + } events; +}; + +struct wlr_seat_touch_state { + struct wlr_seat *seat; + struct wl_list touch_points; // wlr_touch_point.link + + uint32_t grab_serial; + uint32_t grab_id; + + struct wlr_seat_touch_grab *grab; + struct wlr_seat_touch_grab *default_grab; +}; + +struct wlr_primary_selection_source; + +struct wlr_seat { + struct wl_global *global; + struct wl_display *display; + struct wl_list clients; + + char *name; + uint32_t capabilities; + uint32_t accumulated_capabilities; + struct timespec last_event; + + struct wlr_data_source *selection_source; + uint32_t selection_serial; + struct wl_list selection_offers; // wlr_data_offer.link + + struct wlr_primary_selection_source *primary_selection_source; + uint32_t primary_selection_serial; + + // `drag` goes away before `drag_source`, when the implicit grab ends + struct wlr_drag *drag; + struct wlr_data_source *drag_source; + uint32_t drag_serial; + struct wl_list drag_offers; // wlr_data_offer.link + + struct wlr_seat_pointer_state pointer_state; + struct wlr_seat_keyboard_state keyboard_state; + struct wlr_seat_touch_state touch_state; + + struct wl_listener display_destroy; + struct wl_listener selection_source_destroy; + struct wl_listener primary_selection_source_destroy; + struct wl_listener drag_source_destroy; + + struct { + struct wl_signal pointer_grab_begin; + struct wl_signal pointer_grab_end; + + struct wl_signal keyboard_grab_begin; + struct wl_signal keyboard_grab_end; + + struct wl_signal touch_grab_begin; + struct wl_signal touch_grab_end; + + // struct wlr_seat_pointer_request_set_cursor_event + struct wl_signal request_set_cursor; + + // Called when an application _wants_ to set the selection (user copies some data). + // Compositors should listen to this event and call wlr_seat_set_selection() + // if they want to accept the client's request. + struct wl_signal request_set_selection; // struct wlr_seat_request_set_selection_event + // Called after the data source is set for the selection. + struct wl_signal set_selection; + + // Called when an application _wants_ to set the primary selection (user selects some data). + // Compositors should listen to this event and call wlr_seat_set_primary_selection() + // if they want to accept the client's request. + struct wl_signal request_set_primary_selection; // struct wlr_seat_request_set_primary_selection_event + // Called after the primary selection source object is set. + struct wl_signal set_primary_selection; + + // struct wlr_seat_request_start_drag_event + struct wl_signal request_start_drag; + struct wl_signal start_drag; // struct wlr_drag + + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_seat_pointer_request_set_cursor_event { + struct wlr_seat_client *seat_client; + struct wlr_surface *surface; + uint32_t serial; + int32_t hotspot_x, hotspot_y; +}; + +struct wlr_seat_request_set_selection_event { + struct wlr_data_source *source; + uint32_t serial; +}; + +struct wlr_seat_request_set_primary_selection_event { + struct wlr_primary_selection_source *source; + uint32_t serial; +}; + +struct wlr_seat_request_start_drag_event { + struct wlr_drag *drag; + struct wlr_surface *origin; + uint32_t serial; +}; + +struct wlr_seat_pointer_focus_change_event { + struct wlr_seat *seat; + struct wlr_surface *old_surface, *new_surface; + double sx, sy; +}; + +struct wlr_seat_keyboard_focus_change_event { + struct wlr_seat *seat; + struct wlr_surface *old_surface, *new_surface; +}; + +/** + * Allocates a new struct wlr_seat and adds a wl_seat global to the display. + */ +struct wlr_seat *wlr_seat_create(struct wl_display *display, const char *name); +/** + * Destroys a seat, removes its wl_seat global and clears focus for all + * devices belonging to the seat. + */ +void wlr_seat_destroy(struct wlr_seat *wlr_seat); +/** + * Gets a struct wlr_seat_client for the specified client, or returns NULL if no + * client is bound for that client. + */ +struct wlr_seat_client *wlr_seat_client_for_wl_client(struct wlr_seat *wlr_seat, + struct wl_client *wl_client); +/** + * Updates the capabilities available on this seat. + * Will automatically send them to all clients. + */ +void wlr_seat_set_capabilities(struct wlr_seat *wlr_seat, + uint32_t capabilities); +/** + * Updates the name of this seat. + * Will automatically send it to all clients. + */ +void wlr_seat_set_name(struct wlr_seat *wlr_seat, const char *name); + +/** + * Whether or not the surface has pointer focus + */ +bool wlr_seat_pointer_surface_has_focus(struct wlr_seat *wlr_seat, + struct wlr_surface *surface); + +/** + * Send a pointer enter event to the given surface and consider it to be the + * focused surface for the pointer. This will send a leave event to the last + * surface that was entered. Coordinates for the enter event are surface-local. + * This function does not respect pointer grabs: you probably want + * wlr_seat_pointer_notify_enter() instead. + */ +void wlr_seat_pointer_enter(struct wlr_seat *wlr_seat, + struct wlr_surface *surface, double sx, double sy); + +/** + * Clear the focused surface for the pointer and leave all entered surfaces. + * This function does not respect pointer grabs: you probably want + * wlr_seat_pointer_notify_clear_focus() instead. + */ +void wlr_seat_pointer_clear_focus(struct wlr_seat *wlr_seat); + +/** + * Send a motion event to the surface with pointer focus. Coordinates for the + * motion event are surface-local. This function does not respect pointer grabs: + * you probably want wlr_seat_pointer_notify_motion() instead. + */ +void wlr_seat_pointer_send_motion(struct wlr_seat *wlr_seat, uint32_t time_msec, + double sx, double sy); + +/** + * Send a button event to the surface with pointer focus. Coordinates for the + * button event are surface-local. Returns the serial. This function does not + * respect pointer grabs: you probably want wlr_seat_pointer_notify_button() + * instead. + */ +uint32_t wlr_seat_pointer_send_button(struct wlr_seat *wlr_seat, + uint32_t time_msec, uint32_t button, enum wlr_button_state state); + +/** + * Send an axis event to the surface with pointer focus. This function does not + * respect pointer grabs: you probably want wlr_seat_pointer_notify_axis() + * instead. + */ +void wlr_seat_pointer_send_axis(struct wlr_seat *wlr_seat, uint32_t time_msec, + enum wlr_axis_orientation orientation, double value, + int32_t value_discrete, enum wlr_axis_source source); + +/** + * Send a frame event to the surface with pointer focus. This function does not + * respect pointer grabs: you probably want wlr_seat_pointer_notify_frame() + * instead. + */ +void wlr_seat_pointer_send_frame(struct wlr_seat *wlr_seat); + +/** + * Notify the seat of a pointer enter event to the given surface and request it + * to be the focused surface for the pointer. Pass surface-local coordinates + * where the enter occurred. This will send a leave event to the currently- + * focused surface. Defers to any grab of the pointer. + */ +void wlr_seat_pointer_notify_enter(struct wlr_seat *wlr_seat, + struct wlr_surface *surface, double sx, double sy); + +/** + * Notify the seat of a pointer leave event to the currently-focused surface. + * Defers to any grab of the pointer. + */ +void wlr_seat_pointer_notify_clear_focus(struct wlr_seat *wlr_seat); + +/** + * Warp the pointer of this seat to the given surface-local coordinates, without + * generating motion events. + */ +void wlr_seat_pointer_warp(struct wlr_seat *wlr_seat, double sx, double sy); + +/** + * Notify the seat of motion over the given surface. Pass surface-local + * coordinates where the pointer motion occurred. Defers to any grab of the + * pointer. + */ +void wlr_seat_pointer_notify_motion(struct wlr_seat *wlr_seat, + uint32_t time_msec, double sx, double sy); + +/** + * Notify the seat that a button has been pressed. Returns the serial of the + * button press or zero if no button press was sent. Defers to any grab of the + * pointer. + */ +uint32_t wlr_seat_pointer_notify_button(struct wlr_seat *wlr_seat, + uint32_t time_msec, uint32_t button, enum wlr_button_state state); + +/** + * Notify the seat of an axis event. Defers to any grab of the pointer. + */ +void wlr_seat_pointer_notify_axis(struct wlr_seat *wlr_seat, uint32_t time_msec, + enum wlr_axis_orientation orientation, double value, + int32_t value_discrete, enum wlr_axis_source source); + +/** + * Notify the seat of a frame event. Frame events are sent to end a group of + * events that logically belong together. Motion, button and axis events should + * all be followed by a frame event. Defers to any grab of the pointer. + */ +void wlr_seat_pointer_notify_frame(struct wlr_seat *wlr_seat); + +/** + * Start a grab of the pointer of this seat. The grabber is responsible for + * handling all pointer events until the grab ends. + */ +void wlr_seat_pointer_start_grab(struct wlr_seat *wlr_seat, + struct wlr_seat_pointer_grab *grab); + +/** + * End the grab of the pointer of this seat. This reverts the grab back to the + * default grab for the pointer. + */ +void wlr_seat_pointer_end_grab(struct wlr_seat *wlr_seat); + +/** + * Whether or not the pointer has a grab other than the default grab. + */ +bool wlr_seat_pointer_has_grab(struct wlr_seat *seat); + +/** + * Set this keyboard as the active keyboard for the seat. + */ +void wlr_seat_set_keyboard(struct wlr_seat *seat, struct wlr_keyboard *keyboard); + +/** + * Get the active keyboard for the seat. + */ +struct wlr_keyboard *wlr_seat_get_keyboard(struct wlr_seat *seat); + +/** + * Send the keyboard key to focused keyboard resources. This function does not + * respect keyboard grabs: you probably want wlr_seat_keyboard_notify_key() + * instead. + */ +void wlr_seat_keyboard_send_key(struct wlr_seat *seat, uint32_t time_msec, + uint32_t key, uint32_t state); + +/** + * Send the modifier state to focused keyboard resources. This function does + * not respect keyboard grabs: you probably want + * wlr_seat_keyboard_notify_modifiers() instead. + */ +void wlr_seat_keyboard_send_modifiers(struct wlr_seat *seat, + const struct wlr_keyboard_modifiers *modifiers); + +/** + * Send a keyboard enter event to the given surface and consider it to be the + * focused surface for the keyboard. This will send a leave event to the last + * surface that was entered. This function does not respect keyboard grabs: you + * probably want wlr_seat_keyboard_notify_enter() instead. + */ +void wlr_seat_keyboard_enter(struct wlr_seat *seat, + struct wlr_surface *surface, const uint32_t keycodes[], size_t num_keycodes, + const struct wlr_keyboard_modifiers *modifiers); + +/** + * Clear the focused surface for the keyboard and leave all entered surfaces. + * This function does not respect keyboard grabs: you probably want + * wlr_seat_keyboard_notify_clear_focus() instead. + */ +void wlr_seat_keyboard_clear_focus(struct wlr_seat *wlr_seat); + +/** + * Notify the seat that a key has been pressed on the keyboard. Defers to any + * keyboard grabs. + */ +void wlr_seat_keyboard_notify_key(struct wlr_seat *seat, uint32_t time_msec, + uint32_t key, uint32_t state); + +/** + * Notify the seat that the modifiers for the keyboard have changed. Defers to + * any keyboard grabs. + */ +void wlr_seat_keyboard_notify_modifiers(struct wlr_seat *seat, + const struct wlr_keyboard_modifiers *modifiers); + +/** + * Notify the seat that the keyboard focus has changed and request it to be the + * focused surface for this keyboard. Defers to any current grab of the seat's + * keyboard. + */ +void wlr_seat_keyboard_notify_enter(struct wlr_seat *seat, + struct wlr_surface *surface, const uint32_t keycodes[], size_t num_keycodes, + const struct wlr_keyboard_modifiers *modifiers); + +/** + * Notify the seat of a keyboard leave event to the currently-focused surface. + * Defers to any keyboard grabs. + */ +void wlr_seat_keyboard_notify_clear_focus(struct wlr_seat *wlr_seat); + +/** + * Start a grab of the keyboard of this seat. The grabber is responsible for + * handling all keyboard events until the grab ends. + */ +void wlr_seat_keyboard_start_grab(struct wlr_seat *wlr_seat, + struct wlr_seat_keyboard_grab *grab); + +/** + * End the grab of the keyboard of this seat. This reverts the grab back to the + * default grab for the keyboard. + */ +void wlr_seat_keyboard_end_grab(struct wlr_seat *wlr_seat); + +/** + * Whether or not the keyboard has a grab other than the default grab + */ +bool wlr_seat_keyboard_has_grab(struct wlr_seat *seat); + +/** + * Get the active touch point with the given `touch_id`. If the touch point does + * not exist or is no longer active, returns NULL. + */ +struct wlr_touch_point *wlr_seat_touch_get_point(struct wlr_seat *seat, + int32_t touch_id); + +/** + * Notify the seat that the touch point given by `touch_id` has entered a new + * surface. The surface is required. To clear focus, use + * wlr_seat_touch_point_clear_focus(). + */ +void wlr_seat_touch_point_focus(struct wlr_seat *seat, + struct wlr_surface *surface, uint32_t time_msec, + int32_t touch_id, double sx, double sy); + +/** + * Clear the focused surface for the touch point given by `touch_id`. + */ +void wlr_seat_touch_point_clear_focus(struct wlr_seat *seat, uint32_t time_msec, + int32_t touch_id); + +/** + * Send a touch down event to the client of the given surface. All future touch + * events for this point will go to this surface. If the touch down is valid, + * this will add a new touch point with the given `touch_id`. The touch down may + * not be valid if the surface seat client does not accept touch input. + * Coordinates are surface-local. This function does not respect touch grabs: + * you probably want wlr_seat_touch_notify_down() instead. + */ +uint32_t wlr_seat_touch_send_down(struct wlr_seat *seat, + struct wlr_surface *surface, uint32_t time_msec, + int32_t touch_id, double sx, double sy); + +/** + * Send a touch up event for the touch point given by the `touch_id`. The event + * will go to the client for the surface given in the corresponding touch down + * event. This will remove the touch point. This function does not respect touch + * grabs: you probably want wlr_seat_touch_notify_up() instead. + */ +void wlr_seat_touch_send_up(struct wlr_seat *seat, uint32_t time_msec, + int32_t touch_id); + +/** + * Send a touch motion event for the touch point given by the `touch_id`. The + * event will go to the client for the surface given in the corresponding touch + * down event. This function does not respect touch grabs: you probably want + * wlr_seat_touch_notify_motion() instead. + */ +void wlr_seat_touch_send_motion(struct wlr_seat *seat, uint32_t time_msec, + int32_t touch_id, double sx, double sy); + +/** + * Notify the seat that this is a global gesture and the client should cancel + * processing it. The event will go to the client for the surface given. + * This function does not respect touch grabs: you probably want + * wlr_seat_touch_notify_cancel() instead. + */ +void wlr_seat_touch_send_cancel(struct wlr_seat *seat, struct wlr_surface *surface); + +void wlr_seat_touch_send_frame(struct wlr_seat *seat); + +/** + * Notify the seat of a touch down on the given surface. Defers to any grab of + * the touch device. + */ +uint32_t wlr_seat_touch_notify_down(struct wlr_seat *seat, + struct wlr_surface *surface, uint32_t time_msec, + int32_t touch_id, double sx, double sy); + +/** + * Notify the seat that the touch point given by `touch_id` is up. Defers to any + * grab of the touch device. + */ +void wlr_seat_touch_notify_up(struct wlr_seat *seat, uint32_t time_msec, + int32_t touch_id); + +/** + * Notify the seat that the touch point given by `touch_id` has moved. Defers to + * any grab of the touch device. The seat should be notified of touch motion + * even if the surface is not the owner of the touch point for processing by + * grabs. + */ +void wlr_seat_touch_notify_motion(struct wlr_seat *seat, uint32_t time_msec, + int32_t touch_id, double sx, double sy); + +/** + * Notify the seat that this is a global gesture and the client should + * cancel processing it. Defers to any grab of the touch device. + */ +void wlr_seat_touch_notify_cancel(struct wlr_seat *seat, + struct wlr_surface *surface); + +void wlr_seat_touch_notify_frame(struct wlr_seat *seat); + +/** + * How many touch points are currently down for the seat. + */ +int wlr_seat_touch_num_points(struct wlr_seat *seat); + +/** + * Start a grab of the touch device of this seat. The grabber is responsible for + * handling all touch events until the grab ends. + */ +void wlr_seat_touch_start_grab(struct wlr_seat *wlr_seat, + struct wlr_seat_touch_grab *grab); + +/** + * End the grab of the touch device of this seat. This reverts the grab back to + * the default grab for the touch device. + */ +void wlr_seat_touch_end_grab(struct wlr_seat *wlr_seat); + +/** + * Whether or not the seat has a touch grab other than the default grab. + */ +bool wlr_seat_touch_has_grab(struct wlr_seat *seat); + +/** + * Check whether this serial is valid to start a pointer grab action. + */ +bool wlr_seat_validate_pointer_grab_serial(struct wlr_seat *seat, + struct wlr_surface *origin, uint32_t serial); + +/** + * Check whether this serial is valid to start a touch grab action. If it's the + * case and point_ptr is non-NULL, `*point_ptr` is set to the touch point matching + * the serial. + */ +bool wlr_seat_validate_touch_grab_serial(struct wlr_seat *seat, + struct wlr_surface *origin, uint32_t serial, + struct wlr_touch_point **point_ptr); + +/** + * Return a new serial (from wl_display_serial_next()) for the client, and + * update the seat client's set of valid serials. Use this for all input + * events; otherwise wlr_seat_client_validate_event_serial() may fail when + * handed a correctly functioning client's request serials. + */ +uint32_t wlr_seat_client_next_serial(struct wlr_seat_client *client); + +/** + * Return true if the serial number could have been produced by + * wlr_seat_client_next_serial() and is "older" (by less than UINT32_MAX/2) than + * the current display serial value. + * + * This function should have no false negatives, and the only false positive + * responses allowed are for elements that are still "older" than the current + * display serial value and also older than all serial values remaining in + * the seat client's serial ring buffer, if that buffer is also full. + */ +bool wlr_seat_client_validate_event_serial(struct wlr_seat_client *client, + uint32_t serial); + +/** + * Get a seat client from a seat resource. Returns NULL if inert. + */ +struct wlr_seat_client *wlr_seat_client_from_resource( + struct wl_resource *resource); + +/** + * Get a seat client from a pointer resource. Returns NULL if inert. + */ +struct wlr_seat_client *wlr_seat_client_from_pointer_resource( + struct wl_resource *resource); + +/** + * Check whether a surface has bound to touch events. + */ +bool wlr_surface_accepts_touch(struct wlr_seat *wlr_seat, struct wlr_surface *surface); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_security_context_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_security_context_v1.h new file mode 100644 index 00000000..028e9bdd --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_security_context_v1.h @@ -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_TYPES_WLR_SECURITY_CONTEXT_V1_H +#define WLR_TYPES_WLR_SECURITY_CONTEXT_V1_H + +#include + +/** + * An implementation of the security context protocol. + * + * Compositors can create this manager, setup a filter for Wayland globals via + * wl_display_set_global_filter(), and inside the filter query the security + * context state via wlr_security_context_manager_v1_lookup_client(). + */ +struct wlr_security_context_manager_v1 { + struct wl_global *global; + + struct { + struct wl_signal destroy; + struct wl_signal commit; // struct wlr_security_context_v1_commit_event + } events; + + void *data; + + // private state + + struct wl_list contexts; // wlr_security_context_v1.link + + struct wl_listener display_destroy; +}; + +struct wlr_security_context_v1_state { + char *sandbox_engine; // may be NULL + char *app_id; // may be NULL + char *instance_id; // may be NULL +}; + +struct wlr_security_context_v1_commit_event { + const struct wlr_security_context_v1_state *state; + // Client which created the security context + struct wl_client *parent_client; +}; + +struct wlr_security_context_manager_v1 *wlr_security_context_manager_v1_create( + struct wl_display *display); +const struct wlr_security_context_v1_state *wlr_security_context_manager_v1_lookup_client( + struct wlr_security_context_manager_v1 *manager, struct wl_client *client); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_server_decoration.h b/debian/swayfx/usr/include/wlr/types/wlr_server_decoration.h new file mode 100644 index 00000000..7e78c5f2 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_server_decoration.h @@ -0,0 +1,84 @@ +/* + * This protocol is obsolete and will be removed in a future version. The + * recommended replacement is xdg-decoration. + */ + +/* + * 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_SERVER_DECORATION_H +#define WLR_TYPES_WLR_SERVER_DECORATION_H + +#include + +/** + * Possible values to use in request_mode and the event mode. Same as + * org_kde_kwin_server_decoration_manager_mode. + */ +enum wlr_server_decoration_manager_mode { + /** + * Undecorated: The surface is not decorated at all, neither server nor + * client-side. An example is a popup surface which should not be + * decorated. + */ + WLR_SERVER_DECORATION_MANAGER_MODE_NONE = 0, + /** + * Client-side decoration: The decoration is part of the surface and the + * client. + */ + WLR_SERVER_DECORATION_MANAGER_MODE_CLIENT = 1, + /** + * Server-side decoration: The server embeds the surface into a decoration + * frame. + */ + WLR_SERVER_DECORATION_MANAGER_MODE_SERVER = 2, +}; + +/** + * A decoration negotiation interface which implements the KDE protocol. + */ +struct wlr_server_decoration_manager { + struct wl_global *global; + struct wl_list resources; // wl_resource_get_link() + struct wl_list decorations; // wlr_server_decoration.link + + uint32_t default_mode; // enum wlr_server_decoration_manager_mode + + struct wl_listener display_destroy; + + struct { + struct wl_signal new_decoration; + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_server_decoration { + struct wl_resource *resource; + struct wlr_surface *surface; + struct wl_list link; + + uint32_t mode; // enum wlr_server_decoration_manager_mode + + struct { + struct wl_signal destroy; + struct wl_signal mode; + } events; + + struct wl_listener surface_destroy_listener; + + void *data; +}; + +struct wlr_server_decoration_manager *wlr_server_decoration_manager_create( + struct wl_display *display); +void wlr_server_decoration_manager_set_default_mode( + struct wlr_server_decoration_manager *manager, uint32_t default_mode); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_session_lock_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_session_lock_v1.h new file mode 100644 index 00000000..981e2240 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_session_lock_v1.h @@ -0,0 +1,105 @@ +/* + * 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_SESSION_LOCK_H +#define WLR_TYPES_WLR_SESSION_LOCK_H + +#include +#include +#include + +struct wlr_session_lock_manager_v1 { + struct wl_global *global; + + struct { + struct wl_signal new_lock; // struct wlr_session_lock_v1 + struct wl_signal destroy; + } events; + + void *data; + + // private state + + struct wl_listener display_destroy; +}; + +struct wlr_session_lock_v1 { + struct wl_resource *resource; + + struct wl_list surfaces; // struct wlr_session_lock_surface_v1.link + + struct { + struct wl_signal new_surface; // struct wlr_session_lock_surface_v1 + struct wl_signal unlock; + struct wl_signal destroy; + } events; + + void *data; + + // private state + + bool locked_sent; +}; + +struct wlr_session_lock_surface_v1_state { + uint32_t width, height; + uint32_t configure_serial; +}; + +struct wlr_session_lock_surface_v1_configure { + struct wl_list link; // wlr_session_lock_surface_v1.configure_list + uint32_t serial; + + uint32_t width, height; +}; + +struct wlr_session_lock_surface_v1 { + struct wl_resource *resource; + struct wl_list link; // wlr_session_lock_v1.surfaces + + struct wlr_output *output; + struct wlr_surface *surface; + + bool configured; + + struct wl_list configure_list; // wlr_session_lock_surface_v1_configure.link + + struct wlr_session_lock_surface_v1_state current; + struct wlr_session_lock_surface_v1_state pending; + + struct { + struct wl_signal destroy; + } events; + + void *data; + + // private state + + struct wl_listener output_destroy; +}; + +struct wlr_session_lock_manager_v1 *wlr_session_lock_manager_v1_create( + struct wl_display *display); + +void wlr_session_lock_v1_send_locked(struct wlr_session_lock_v1 *lock); +void wlr_session_lock_v1_destroy(struct wlr_session_lock_v1 *lock); + +uint32_t wlr_session_lock_surface_v1_configure( + struct wlr_session_lock_surface_v1 *lock_surface, + uint32_t width, uint32_t height); + +/** + * Get a struct wlr_session_lock_surface_v1 from a struct wlr_surface. + * + * Returns NULL if the surface has a different role or if the lock surface + * has been destroyed. + */ +struct wlr_session_lock_surface_v1 *wlr_session_lock_surface_v1_try_from_wlr_surface( + struct wlr_surface *surface); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_shm.h b/debian/swayfx/usr/include/wlr/types/wlr_shm.h new file mode 100644 index 00000000..396fc831 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_shm.h @@ -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_SHM_H +#define WLR_TYPES_WLR_SHM_H + +#include + +struct wlr_renderer; + +/** + * Shared memory buffer interface. + * + * The buffers created via this interface are not safe to use from different + * threads. + * + * Currently, accessing two buffers concurrently via + * wlr_buffer_begin_data_ptr_access() will return an error. + */ +struct wlr_shm; + +/** + * Create the wl_shm global. + * + * Compositors using struct wlr_renderer should use wlr_shm_create_with_renderer() + * instead. + */ +struct wlr_shm *wlr_shm_create(struct wl_display *display, uint32_t version, + const uint32_t *formats, size_t formats_len); + +/** + * Create the wl_shm global. + * + * The pixel formats advertised to clients are taken from the struct wlr_renderer. + */ +struct wlr_shm *wlr_shm_create_with_renderer(struct wl_display *display, + uint32_t version, struct wlr_renderer *renderer); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_single_pixel_buffer_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_single_pixel_buffer_v1.h new file mode 100644 index 00000000..747d2a6b --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_single_pixel_buffer_v1.h @@ -0,0 +1,19 @@ +/* + * 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_SINGLE_PIXEL_BUFFER_V1_H +#define WLR_TYPES_WLR_SINGLE_PIXEL_BUFFER_V1_H + +#include + +struct wlr_single_pixel_buffer_manager_v1; + +struct wlr_single_pixel_buffer_manager_v1 *wlr_single_pixel_buffer_manager_v1_create( + struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_subcompositor.h b/debian/swayfx/usr/include/wlr/types/wlr_subcompositor.h new file mode 100644 index 00000000..d20fef94 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_subcompositor.h @@ -0,0 +1,73 @@ +/* + * 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_SUBCOMPOSITOR_H +#define WLR_TYPES_WLR_SUBCOMPOSITOR_H + +#include +#include +#include + +struct wlr_surface; + +/** + * The sub-surface state describing the sub-surface's relationship with its + * parent. Contrary to other states, this one is not applied on surface commit. + * Instead, it's applied on parent surface commit. + */ +struct wlr_subsurface_parent_state { + int32_t x, y; + struct wl_list link; +}; + +struct wlr_subsurface { + struct wl_resource *resource; + struct wlr_surface *surface; + struct wlr_surface *parent; + + struct wlr_subsurface_parent_state current, pending; + + uint32_t cached_seq; + bool has_cache; + + bool synchronized; + bool reordered; + bool added; + + struct wl_listener surface_client_commit; + struct wl_listener parent_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_subcompositor { + struct wl_global *global; + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; +}; + +/** + * Get a struct wlr_subsurface from a struct wlr_surface. + * + * Returns NULL if the surface doesn't have the subsurface role or if + * the subsurface has been destroyed. + */ +struct wlr_subsurface *wlr_subsurface_try_from_wlr_surface( + struct wlr_surface *surface); + +struct wlr_subcompositor *wlr_subcompositor_create(struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_switch.h b/debian/swayfx/usr/include/wlr/types/wlr_switch.h new file mode 100644 index 00000000..b560f0ba --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_switch.h @@ -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_SWITCH_H +#define WLR_TYPES_WLR_SWITCH_H + +#include +#include +#include + +struct wlr_switch_impl; + +struct wlr_switch { + struct wlr_input_device base; + + const struct wlr_switch_impl *impl; + + struct { + struct wl_signal toggle; + } events; + + void *data; +}; + +enum wlr_switch_type { + WLR_SWITCH_TYPE_LID, + WLR_SWITCH_TYPE_TABLET_MODE, +}; + +enum wlr_switch_state { + WLR_SWITCH_STATE_OFF = 0, + WLR_SWITCH_STATE_ON, +}; + +struct wlr_switch_toggle_event { + uint32_t time_msec; + enum wlr_switch_type switch_type; + enum wlr_switch_state switch_state; +}; + +/** + * Get a struct wlr_switch from a struct wlr_input_device. + * + * Asserts that the input device is a switch. + */ +struct wlr_switch *wlr_switch_from_input_device( + struct wlr_input_device *input_device); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_tablet_pad.h b/debian/swayfx/usr/include/wlr/types/wlr_tablet_pad.h new file mode 100644 index 00000000..f19505a9 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_tablet_pad.h @@ -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_TABLET_PAD_H +#define WLR_TYPES_WLR_TABLET_PAD_H + +#include +#include +#include + +/* + * NOTE: the wlr tablet pad implementation does not currently support tablets + * with more than one mode. I don't own any such hardware so I cannot test it + * and it is too complicated to make a meaningful implementation of blindly. + */ + +struct wlr_tablet_pad_impl; + +struct wlr_tablet_pad { + struct wlr_input_device base; + + const struct wlr_tablet_pad_impl *impl; + + struct { + struct wl_signal button; + struct wl_signal ring; + struct wl_signal strip; + struct wl_signal attach_tablet; // struct wlr_tablet_tool + } events; + + size_t button_count; + size_t ring_count; + size_t strip_count; + + struct wl_list groups; // wlr_tablet_pad_group.link + struct wl_array paths; // char * + + void *data; +}; + +struct wlr_tablet_pad_group { + struct wl_list link; + + size_t button_count; + unsigned int *buttons; + + size_t strip_count; + unsigned int *strips; + + size_t ring_count; + unsigned int *rings; + + unsigned int mode_count; +}; + +struct wlr_tablet_pad_button_event { + uint32_t time_msec; + uint32_t button; + enum wlr_button_state state; + unsigned int mode; + unsigned int group; +}; + +enum wlr_tablet_pad_ring_source { + WLR_TABLET_PAD_RING_SOURCE_UNKNOWN, + WLR_TABLET_PAD_RING_SOURCE_FINGER, +}; + +struct wlr_tablet_pad_ring_event { + uint32_t time_msec; + enum wlr_tablet_pad_ring_source source; + uint32_t ring; + double position; + unsigned int mode; +}; + +enum wlr_tablet_pad_strip_source { + WLR_TABLET_PAD_STRIP_SOURCE_UNKNOWN, + WLR_TABLET_PAD_STRIP_SOURCE_FINGER, +}; + +struct wlr_tablet_pad_strip_event { + uint32_t time_msec; + enum wlr_tablet_pad_strip_source source; + uint32_t strip; + double position; + unsigned int mode; +}; + +/** + * Get a struct wlr_tablet_pad from a struct wlr_input_device. + * + * Asserts that the input device is a tablet pad. + */ +struct wlr_tablet_pad *wlr_tablet_pad_from_input_device( + struct wlr_input_device *); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_tablet_tool.h b/debian/swayfx/usr/include/wlr/types/wlr_tablet_tool.h new file mode 100644 index 00000000..41d637f0 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_tablet_tool.h @@ -0,0 +1,155 @@ +/* + * 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_TABLET_TOOL_H +#define WLR_TYPES_TABLET_TOOL_H + +#include +#include +#include + +/* + * Copy+Paste from libinput, but this should neither use libinput, nor + * tablet-unstable-v2 headers, so we can't include them + */ +enum wlr_tablet_tool_type { + /** A generic pen */ + WLR_TABLET_TOOL_TYPE_PEN = 1, + /** Eraser */ + WLR_TABLET_TOOL_TYPE_ERASER, + /** A paintbrush-like tool */ + WLR_TABLET_TOOL_TYPE_BRUSH, + /** Physical drawing tool, e.g. Wacom Inking Pen */ + WLR_TABLET_TOOL_TYPE_PENCIL, + /** An airbrush-like tool */ + WLR_TABLET_TOOL_TYPE_AIRBRUSH, + /** A mouse bound to the tablet */ + WLR_TABLET_TOOL_TYPE_MOUSE, + /** A mouse tool with a lens */ + WLR_TABLET_TOOL_TYPE_LENS, + /** A rotary device with positional and rotation data */ + WLR_TABLET_TOOL_TYPE_TOTEM, + +}; + +struct wlr_tablet_tool { + enum wlr_tablet_tool_type type; + uint64_t hardware_serial; + uint64_t hardware_wacom; + + // Capabilities + bool tilt; + bool pressure; + bool distance; + bool rotation; + bool slider; + bool wheel; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_tablet_impl; + +struct wlr_tablet { + struct wlr_input_device base; + + const struct wlr_tablet_impl *impl; + + double width_mm, height_mm; + + struct { + struct wl_signal axis; + struct wl_signal proximity; + struct wl_signal tip; + struct wl_signal button; + } events; + + struct wl_array paths; // char * + + void *data; +}; + +enum wlr_tablet_tool_axes { + WLR_TABLET_TOOL_AXIS_X = 1 << 0, + WLR_TABLET_TOOL_AXIS_Y = 1 << 1, + WLR_TABLET_TOOL_AXIS_DISTANCE = 1 << 2, + WLR_TABLET_TOOL_AXIS_PRESSURE = 1 << 3, + WLR_TABLET_TOOL_AXIS_TILT_X = 1 << 4, + WLR_TABLET_TOOL_AXIS_TILT_Y = 1 << 5, + WLR_TABLET_TOOL_AXIS_ROTATION = 1 << 6, + WLR_TABLET_TOOL_AXIS_SLIDER = 1 << 7, + WLR_TABLET_TOOL_AXIS_WHEEL = 1 << 8, +}; + +struct wlr_tablet_tool_axis_event { + struct wlr_tablet *tablet; + struct wlr_tablet_tool *tool; + + uint32_t time_msec; + uint32_t updated_axes; + // From 0..1 + double x, y; + // Relative to last event + double dx, dy; + double pressure; + double distance; + double tilt_x, tilt_y; + double rotation; + double slider; + double wheel_delta; +}; + +enum wlr_tablet_tool_proximity_state { + WLR_TABLET_TOOL_PROXIMITY_OUT, + WLR_TABLET_TOOL_PROXIMITY_IN, +}; + +struct wlr_tablet_tool_proximity_event { + struct wlr_tablet *tablet; + struct wlr_tablet_tool *tool; + uint32_t time_msec; + // From 0..1 + double x, y; + enum wlr_tablet_tool_proximity_state state; +}; + +enum wlr_tablet_tool_tip_state { + WLR_TABLET_TOOL_TIP_UP, + WLR_TABLET_TOOL_TIP_DOWN, +}; + +struct wlr_tablet_tool_tip_event { + struct wlr_tablet *tablet; + struct wlr_tablet_tool *tool; + uint32_t time_msec; + // From 0..1 + double x, y; + enum wlr_tablet_tool_tip_state state; +}; + +struct wlr_tablet_tool_button_event { + struct wlr_tablet *tablet; + struct wlr_tablet_tool *tool; + uint32_t time_msec; + uint32_t button; + enum wlr_button_state state; +}; + +/** + * Get a struct wlr_tablet from a struct wlr_input_device. + * + * Asserts that the input device is a tablet tool. + */ +struct wlr_tablet *wlr_tablet_from_input_device( + struct wlr_input_device *input_device); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_tablet_v2.h b/debian/swayfx/usr/include/wlr/types/wlr_tablet_v2.h new file mode 100644 index 00000000..54828244 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_tablet_v2.h @@ -0,0 +1,332 @@ +/* + * 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_TABLET_V2_H +#define WLR_TYPES_WLR_TABLET_V2_H + +#include +#include + +#include "tablet-unstable-v2-protocol.h" + +/* This can probably be even lower,the tools don't have a lot of buttons */ +#define WLR_TABLET_V2_TOOL_BUTTONS_CAP 16 + +struct wlr_input_device; + +struct wlr_tablet_pad_v2_grab_interface; + +struct wlr_tablet_pad_v2_grab { + const struct wlr_tablet_pad_v2_grab_interface *interface; + struct wlr_tablet_v2_tablet_pad *pad; + void *data; +}; + +struct wlr_tablet_tool_v2_grab_interface; + +struct wlr_tablet_tool_v2_grab { + const struct wlr_tablet_tool_v2_grab_interface *interface; + struct wlr_tablet_v2_tablet_tool *tool; + void *data; +}; + +struct wlr_tablet_client_v2; +struct wlr_tablet_tool_client_v2; +struct wlr_tablet_pad_client_v2; + +struct wlr_tablet_manager_v2 { + struct wl_global *wl_global; + struct wl_list clients; // wlr_tablet_manager_client_v2.link + struct wl_list seats; // wlr_tablet_seat_v2.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_tablet_v2_tablet { + struct wl_list link; // wlr_tablet_seat_v2.tablets + struct wlr_tablet *wlr_tablet; + struct wlr_input_device *wlr_device; + struct wl_list clients; // wlr_tablet_client_v2.tablet_link + + struct wl_listener tool_destroy; + + struct wlr_tablet_client_v2 *current_client; +}; + +struct wlr_tablet_v2_tablet_tool { + struct wl_list link; // wlr_tablet_seat_v2.tablets + struct wlr_tablet_tool *wlr_tool; + struct wl_list clients; // wlr_tablet_tool_client_v2.tool_link + + struct wl_listener tool_destroy; + + struct wlr_tablet_tool_client_v2 *current_client; + struct wlr_surface *focused_surface; + struct wl_listener surface_destroy; + + struct wlr_tablet_tool_v2_grab *grab; + struct wlr_tablet_tool_v2_grab default_grab; + + uint32_t proximity_serial; + bool is_down; + uint32_t down_serial; + size_t num_buttons; + uint32_t pressed_buttons[WLR_TABLET_V2_TOOL_BUTTONS_CAP]; + uint32_t pressed_serials[WLR_TABLET_V2_TOOL_BUTTONS_CAP]; + + struct { + struct wl_signal set_cursor; // struct wlr_tablet_v2_event_cursor + } events; +}; + +struct wlr_tablet_v2_tablet_pad { + struct wl_list link; // wlr_tablet_seat_v2.pads + struct wlr_tablet_pad *wlr_pad; + struct wlr_input_device *wlr_device; + struct wl_list clients; // wlr_tablet_pad_client_v2.pad_link + + size_t group_count; + uint32_t *groups; + + struct wl_listener pad_destroy; + + struct wlr_tablet_pad_client_v2 *current_client; + struct wlr_tablet_pad_v2_grab *grab; + struct wlr_tablet_pad_v2_grab default_grab; + + struct { + struct wl_signal button_feedback; // struct wlr_tablet_v2_event_feedback + struct wl_signal strip_feedback; // struct wlr_tablet_v2_event_feedback + struct wl_signal ring_feedback; // struct wlr_tablet_v2_event_feedback + } events; +}; + +struct wlr_tablet_v2_event_cursor { + struct wlr_surface *surface; + uint32_t serial; + int32_t hotspot_x; + int32_t hotspot_y; + struct wlr_seat_client *seat_client; +}; + +struct wlr_tablet_v2_event_feedback { + const char *description; + size_t index; + uint32_t serial; +}; + +struct wlr_tablet_v2_tablet *wlr_tablet_create( + struct wlr_tablet_manager_v2 *manager, + struct wlr_seat *wlr_seat, + struct wlr_input_device *wlr_device); + +struct wlr_tablet_v2_tablet_pad *wlr_tablet_pad_create( + struct wlr_tablet_manager_v2 *manager, + struct wlr_seat *wlr_seat, + struct wlr_input_device *wlr_device); + +struct wlr_tablet_v2_tablet_tool *wlr_tablet_tool_create( + struct wlr_tablet_manager_v2 *manager, + struct wlr_seat *wlr_seat, + struct wlr_tablet_tool *wlr_tool); + +struct wlr_tablet_manager_v2 *wlr_tablet_v2_create(struct wl_display *display); + +void wlr_send_tablet_v2_tablet_tool_proximity_in( + struct wlr_tablet_v2_tablet_tool *tool, + struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); + +void wlr_send_tablet_v2_tablet_tool_down(struct wlr_tablet_v2_tablet_tool *tool); +void wlr_send_tablet_v2_tablet_tool_up(struct wlr_tablet_v2_tablet_tool *tool); + +void wlr_send_tablet_v2_tablet_tool_motion( + struct wlr_tablet_v2_tablet_tool *tool, double x, double y); + +void wlr_send_tablet_v2_tablet_tool_pressure( + struct wlr_tablet_v2_tablet_tool *tool, double pressure); + +void wlr_send_tablet_v2_tablet_tool_distance( + struct wlr_tablet_v2_tablet_tool *tool, double distance); + +void wlr_send_tablet_v2_tablet_tool_tilt( + struct wlr_tablet_v2_tablet_tool *tool, double x, double y); + +void wlr_send_tablet_v2_tablet_tool_rotation( + struct wlr_tablet_v2_tablet_tool *tool, double degrees); + +void wlr_send_tablet_v2_tablet_tool_slider( + struct wlr_tablet_v2_tablet_tool *tool, double position); + +void wlr_send_tablet_v2_tablet_tool_wheel( + struct wlr_tablet_v2_tablet_tool *tool, double degrees, int32_t clicks); + +void wlr_send_tablet_v2_tablet_tool_proximity_out( + struct wlr_tablet_v2_tablet_tool *tool); + +void wlr_send_tablet_v2_tablet_tool_button( + struct wlr_tablet_v2_tablet_tool *tool, uint32_t button, + enum zwp_tablet_pad_v2_button_state state); + + + +void wlr_tablet_v2_tablet_tool_notify_proximity_in( + struct wlr_tablet_v2_tablet_tool *tool, + struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); + +void wlr_tablet_v2_tablet_tool_notify_down(struct wlr_tablet_v2_tablet_tool *tool); +void wlr_tablet_v2_tablet_tool_notify_up(struct wlr_tablet_v2_tablet_tool *tool); + +void wlr_tablet_v2_tablet_tool_notify_motion( + struct wlr_tablet_v2_tablet_tool *tool, double x, double y); + +void wlr_tablet_v2_tablet_tool_notify_pressure( + struct wlr_tablet_v2_tablet_tool *tool, double pressure); + +void wlr_tablet_v2_tablet_tool_notify_distance( + struct wlr_tablet_v2_tablet_tool *tool, double distance); + +void wlr_tablet_v2_tablet_tool_notify_tilt( + struct wlr_tablet_v2_tablet_tool *tool, double x, double y); + +void wlr_tablet_v2_tablet_tool_notify_rotation( + struct wlr_tablet_v2_tablet_tool *tool, double degrees); + +void wlr_tablet_v2_tablet_tool_notify_slider( + struct wlr_tablet_v2_tablet_tool *tool, double position); + +void wlr_tablet_v2_tablet_tool_notify_wheel( + struct wlr_tablet_v2_tablet_tool *tool, double degrees, int32_t clicks); + +void wlr_tablet_v2_tablet_tool_notify_proximity_out( + struct wlr_tablet_v2_tablet_tool *tool); + +void wlr_tablet_v2_tablet_tool_notify_button( + struct wlr_tablet_v2_tablet_tool *tool, uint32_t button, + enum zwp_tablet_pad_v2_button_state state); + + +struct wlr_tablet_tool_v2_grab_interface { + void (*proximity_in)( + struct wlr_tablet_tool_v2_grab *grab, + struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); + + void (*down)(struct wlr_tablet_tool_v2_grab *grab); + void (*up)(struct wlr_tablet_tool_v2_grab *grab); + + void (*motion)(struct wlr_tablet_tool_v2_grab *grab, double x, double y); + + void (*pressure)(struct wlr_tablet_tool_v2_grab *grab, double pressure); + + void (*distance)(struct wlr_tablet_tool_v2_grab *grab, double distance); + + void (*tilt)(struct wlr_tablet_tool_v2_grab *grab, double x, double y); + + void (*rotation)(struct wlr_tablet_tool_v2_grab *grab, double degrees); + + void (*slider)(struct wlr_tablet_tool_v2_grab *grab, double position); + + void (*wheel)(struct wlr_tablet_tool_v2_grab *grab, double degrees, int32_t clicks); + + void (*proximity_out)(struct wlr_tablet_tool_v2_grab *grab); + + void (*button)( + struct wlr_tablet_tool_v2_grab *grab, uint32_t button, + enum zwp_tablet_pad_v2_button_state state); + void (*cancel)(struct wlr_tablet_tool_v2_grab *grab); +}; + +void wlr_tablet_tool_v2_start_grab(struct wlr_tablet_v2_tablet_tool *tool, struct wlr_tablet_tool_v2_grab *grab); +void wlr_tablet_tool_v2_end_grab(struct wlr_tablet_v2_tablet_tool *tool); + +void wlr_tablet_tool_v2_start_implicit_grab(struct wlr_tablet_v2_tablet_tool *tool); + +bool wlr_tablet_tool_v2_has_implicit_grab( + struct wlr_tablet_v2_tablet_tool *tool); + +uint32_t wlr_send_tablet_v2_tablet_pad_enter( + struct wlr_tablet_v2_tablet_pad *pad, + struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); + +void wlr_send_tablet_v2_tablet_pad_button( + struct wlr_tablet_v2_tablet_pad *pad, size_t button, + uint32_t time, enum zwp_tablet_pad_v2_button_state state); + +void wlr_send_tablet_v2_tablet_pad_strip(struct wlr_tablet_v2_tablet_pad *pad, + uint32_t strip, double position, bool finger, uint32_t time); +void wlr_send_tablet_v2_tablet_pad_ring(struct wlr_tablet_v2_tablet_pad *pad, + uint32_t ring, double position, bool finger, uint32_t time); + +uint32_t wlr_send_tablet_v2_tablet_pad_leave(struct wlr_tablet_v2_tablet_pad *pad, + struct wlr_surface *surface); + +uint32_t wlr_send_tablet_v2_tablet_pad_mode(struct wlr_tablet_v2_tablet_pad *pad, + size_t group, uint32_t mode, uint32_t time); + + +uint32_t wlr_tablet_v2_tablet_pad_notify_enter( + struct wlr_tablet_v2_tablet_pad *pad, + struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); + +void wlr_tablet_v2_tablet_pad_notify_button( + struct wlr_tablet_v2_tablet_pad *pad, size_t button, + uint32_t time, enum zwp_tablet_pad_v2_button_state state); + +void wlr_tablet_v2_tablet_pad_notify_strip( + struct wlr_tablet_v2_tablet_pad *pad, + uint32_t strip, double position, bool finger, uint32_t time); +void wlr_tablet_v2_tablet_pad_notify_ring( + struct wlr_tablet_v2_tablet_pad *pad, + uint32_t ring, double position, bool finger, uint32_t time); + +uint32_t wlr_tablet_v2_tablet_pad_notify_leave( + struct wlr_tablet_v2_tablet_pad *pad, struct wlr_surface *surface); + +uint32_t wlr_tablet_v2_tablet_pad_notify_mode( + struct wlr_tablet_v2_tablet_pad *pad, + size_t group, uint32_t mode, uint32_t time); + +struct wlr_tablet_pad_v2_grab_interface { + uint32_t (*enter)( + struct wlr_tablet_pad_v2_grab *grab, + struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); + + void (*button)(struct wlr_tablet_pad_v2_grab *grab,size_t button, + uint32_t time, enum zwp_tablet_pad_v2_button_state state); + + void (*strip)(struct wlr_tablet_pad_v2_grab *grab, + uint32_t strip, double position, bool finger, uint32_t time); + void (*ring)(struct wlr_tablet_pad_v2_grab *grab, + uint32_t ring, double position, bool finger, uint32_t time); + + uint32_t (*leave)(struct wlr_tablet_pad_v2_grab *grab, + struct wlr_surface *surface); + + uint32_t (*mode)(struct wlr_tablet_pad_v2_grab *grab, + size_t group, uint32_t mode, uint32_t time); + + void (*cancel)(struct wlr_tablet_pad_v2_grab *grab); +}; + +void wlr_tablet_v2_end_grab(struct wlr_tablet_v2_tablet_pad *pad); +void wlr_tablet_v2_start_grab(struct wlr_tablet_v2_tablet_pad *pad, struct wlr_tablet_pad_v2_grab *grab); + +bool wlr_surface_accepts_tablet_v2(struct wlr_tablet_v2_tablet *tablet, + struct wlr_surface *surface); +#endif /* WLR_TYPES_WLR_TABLET_V2_H */ diff --git a/debian/swayfx/usr/include/wlr/types/wlr_tearing_control_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_tearing_control_v1.h new file mode 100644 index 00000000..31cc5bef --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_tearing_control_v1.h @@ -0,0 +1,60 @@ +/* + * 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_TEARING_CONTROL_MANAGER_V1_H +#define WLR_TYPES_WLR_TEARING_CONTROL_MANAGER_V1_H + +#include +#include +#include +#include + +#include "tearing-control-v1-protocol.h" + +struct wlr_tearing_control_v1 { + uint32_t hint; + struct wl_client *client; + struct wl_list link; + struct wl_resource *resource; + + struct { + struct wl_signal set_hint; + struct wl_signal destroy; + } events; + + struct wlr_surface *surface; + + struct wlr_addon addon; +}; + +struct wlr_tearing_control_manager_v1 { + struct wl_global *global; + + struct wl_list surface_hints; // wlr_tearing_control_v1.link + + struct wl_listener display_destroy; + struct { + struct wl_signal new_object; // struct wlr_tearing_control_v1* + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_tearing_control_manager_v1 *wlr_tearing_control_manager_v1_create( + struct wl_display *display, uint32_t version); + +/** + * Returns the tearing hint for a given surface + */ +enum wp_tearing_control_v1_presentation_hint +wlr_tearing_control_manager_v1_surface_hint_from_surface( + struct wlr_tearing_control_manager_v1 *manager, + struct wlr_surface *surface); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_text_input_v3.h b/debian/swayfx/usr/include/wlr/types/wlr_text_input_v3.h new file mode 100644 index 00000000..37397c1f --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_text_input_v3.h @@ -0,0 +1,99 @@ +/* + * 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_TEXT_INPUT_V3_H +#define WLR_TYPES_WLR_TEXT_INPUT_V3_H + +#include +#include +#include + +struct wlr_surface; + +enum wlr_text_input_v3_features { + WLR_TEXT_INPUT_V3_FEATURE_SURROUNDING_TEXT = 1 << 0, + WLR_TEXT_INPUT_V3_FEATURE_CONTENT_TYPE = 1 << 1, + WLR_TEXT_INPUT_V3_FEATURE_CURSOR_RECTANGLE = 1 << 2, +}; + +struct wlr_text_input_v3_state { + struct { + char *text; // NULL is allowed and equivalent to empty string + uint32_t cursor; + uint32_t anchor; + } surrounding; + + uint32_t text_change_cause; + + struct { + uint32_t hint; + uint32_t purpose; + } content_type; + + struct wlr_box cursor_rectangle; + + // Tracks which features were used in the current commit. + // Useful in the enabling commit, where usage means support. + uint32_t features; // bitfield of enum wlr_text_input_v3_features +}; + +struct wlr_text_input_v3 { + struct wlr_seat *seat; // becomes null when seat destroyed + struct wl_resource *resource; + struct wlr_surface *focused_surface; + struct wlr_text_input_v3_state pending; + struct wlr_text_input_v3_state current; + uint32_t current_serial; // next in line to send + bool pending_enabled; + bool current_enabled; + // supported in the current text input, more granular than surface + uint32_t active_features; // bitfield of enum wlr_text_input_v3_features + + struct wl_list link; + + struct wl_listener surface_destroy; + struct wl_listener seat_destroy; + + struct { + struct wl_signal enable; // struct wlr_text_input_v3 + struct wl_signal commit; // struct wlr_text_input_v3 + struct wl_signal disable; // struct wlr_text_input_v3 + struct wl_signal destroy; // struct wlr_text_input_v3 + } events; +}; + +struct wlr_text_input_manager_v3 { + struct wl_global *global; + struct wl_list text_inputs; // struct wlr_text_input_v3.resource.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal text_input; // struct wlr_text_input_v3 + struct wl_signal destroy; // struct wlr_input_method_manager_v3 + } events; +}; + +struct wlr_text_input_manager_v3 *wlr_text_input_manager_v3_create( + struct wl_display *wl_display); + +// Sends enter to the surface and saves it +void wlr_text_input_v3_send_enter(struct wlr_text_input_v3 *text_input, + struct wlr_surface *wlr_surface); +// Sends leave to the currently focused surface and clears it +void wlr_text_input_v3_send_leave(struct wlr_text_input_v3 *text_input); +void wlr_text_input_v3_send_preedit_string(struct wlr_text_input_v3 *text_input, + const char *text, int32_t cursor_begin, int32_t cursor_end); +void wlr_text_input_v3_send_commit_string(struct wlr_text_input_v3 *text_input, + const char *text); +void wlr_text_input_v3_send_delete_surrounding_text( + struct wlr_text_input_v3 *text_input, uint32_t before_length, + uint32_t after_length); +void wlr_text_input_v3_send_done(struct wlr_text_input_v3 *text_input); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_touch.h b/debian/swayfx/usr/include/wlr/types/wlr_touch.h new file mode 100644 index 00000000..82c4b861 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_touch.h @@ -0,0 +1,73 @@ +/* + * 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_TOUCH_H +#define WLR_TYPES_WLR_TOUCH_H + +#include +#include +#include + +struct wlr_touch_impl; + +struct wlr_touch { + struct wlr_input_device base; + + const struct wlr_touch_impl *impl; + + char *output_name; + double width_mm, height_mm; + + struct { + struct wl_signal down; // struct wlr_touch_down_event + struct wl_signal up; // struct wlr_touch_up_event + struct wl_signal motion; // struct wlr_touch_motion_event + struct wl_signal cancel; // struct wlr_touch_cancel_event + struct wl_signal frame; + } events; + + void *data; +}; + +struct wlr_touch_down_event { + struct wlr_touch *touch; + uint32_t time_msec; + int32_t touch_id; + // From 0..1 + double x, y; +}; + +struct wlr_touch_up_event { + struct wlr_touch *touch; + uint32_t time_msec; + int32_t touch_id; +}; + +struct wlr_touch_motion_event { + struct wlr_touch *touch; + uint32_t time_msec; + int32_t touch_id; + // From 0..1 + double x, y; +}; + +struct wlr_touch_cancel_event { + struct wlr_touch *touch; + uint32_t time_msec; + int32_t touch_id; +}; + +/** + * Get a struct wlr_touch from a struct wlr_input_device. + * + * Asserts that the input device is a touch device. + */ +struct wlr_touch *wlr_touch_from_input_device( + struct wlr_input_device *input_device); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_viewporter.h b/debian/swayfx/usr/include/wlr/types/wlr_viewporter.h new file mode 100644 index 00000000..8a179367 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_viewporter.h @@ -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_WLR_VIEWPORTER_H +#define WLR_TYPES_WLR_VIEWPORTER_H + +#include + +/** + * Implementation for the viewporter protocol. + * + * When enabling viewporter, compositors need to update their rendering logic: + * + * - The size of the surface texture may not match the surface size anymore. + * Compositors must use the surface size only. + * - Compositors must call wlr_render_subtexture_with_matrix() when rendering a + * surface texture with the source box returned by + * wlr_surface_get_buffer_source_box(). + */ +struct wlr_viewporter { + struct wl_global *global; + + struct { + struct wl_signal destroy; + } events; + + struct wl_listener display_destroy; +}; + +struct wlr_viewporter *wlr_viewporter_create(struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_virtual_keyboard_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_virtual_keyboard_v1.h new file mode 100644 index 00000000..cb0bb982 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_virtual_keyboard_v1.h @@ -0,0 +1,42 @@ +/* + * 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_VIRTUAL_KEYBOARD_V1_H +#define WLR_TYPES_WLR_VIRTUAL_KEYBOARD_V1_H + +#include +#include + +struct wlr_virtual_keyboard_manager_v1 { + struct wl_global *global; + struct wl_list virtual_keyboards; // wlr_virtual_keyboard_v1.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal new_virtual_keyboard; // struct wlr_virtual_keyboard_v1 + struct wl_signal destroy; + } events; +}; + +struct wlr_virtual_keyboard_v1 { + struct wlr_keyboard keyboard; + struct wl_resource *resource; + struct wlr_seat *seat; + bool has_keymap; + + struct wl_list link; // wlr_virtual_keyboard_manager_v1.virtual_keyboards +}; + +struct wlr_virtual_keyboard_manager_v1* wlr_virtual_keyboard_manager_v1_create( + struct wl_display *display); + +struct wlr_virtual_keyboard_v1 *wlr_input_device_get_virtual_keyboard( + struct wlr_input_device *wlr_dev); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_virtual_pointer_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_virtual_pointer_v1.h new file mode 100644 index 00000000..a0526854 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_virtual_pointer_v1.h @@ -0,0 +1,50 @@ +/* + * 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_VIRTUAL_POINTER_V1_H +#define WLR_TYPES_WLR_VIRTUAL_POINTER_V1_H + +#include +#include +#include +#include + +struct wlr_virtual_pointer_manager_v1 { + struct wl_global *global; + struct wl_list virtual_pointers; // wlr_virtual_pointer_v1.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal new_virtual_pointer; // struct wlr_virtual_pointer_v1_new_pointer_event + struct wl_signal destroy; + } events; +}; + +struct wlr_virtual_pointer_v1 { + struct wlr_pointer pointer; + struct wl_resource *resource; + /* Vertical and horizontal */ + struct wlr_pointer_axis_event axis_event[2]; + enum wl_pointer_axis axis; + bool axis_valid[2]; + + struct wl_list link; // wlr_virtual_pointer_manager_v1.virtual_pointers +}; + +struct wlr_virtual_pointer_v1_new_pointer_event { + struct wlr_virtual_pointer_v1 *new_pointer; + /** Suggested by client; may be NULL. */ + struct wlr_seat *suggested_seat; + struct wlr_output *suggested_output; +}; + +struct wlr_virtual_pointer_manager_v1* wlr_virtual_pointer_manager_v1_create( + struct wl_display *display); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xcursor_manager.h b/debian/swayfx/usr/include/wlr/types/wlr_xcursor_manager.h new file mode 100644 index 00000000..53993159 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xcursor_manager.h @@ -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_XCURSOR_MANAGER_H +#define WLR_TYPES_WLR_XCURSOR_MANAGER_H + +#include +#include + +/** + * An XCursor theme at a particular scale factor of the base size. + */ +struct wlr_xcursor_manager_theme { + float scale; + struct wlr_xcursor_theme *theme; + struct wl_list link; +}; + +/** + * struct wlr_xcursor_manager dynamically loads xcursor themes at sizes necessary + * for use on outputs at arbitrary scale factors. You should call + * wlr_xcursor_manager_load() for each output you will show your cursor on, with + * the scale factor parameter set to that output's scale factor. + */ +struct wlr_xcursor_manager { + char *name; + uint32_t size; + struct wl_list scaled_themes; // wlr_xcursor_manager_theme.link +}; + +/** + * Creates a new XCursor manager with the given xcursor theme name and base size + * (for use when scale=1). + */ +struct wlr_xcursor_manager *wlr_xcursor_manager_create(const char *name, + uint32_t size); + +void wlr_xcursor_manager_destroy(struct wlr_xcursor_manager *manager); + +/** + * Ensures an xcursor theme at the given scale factor is loaded in the manager. + */ +bool wlr_xcursor_manager_load(struct wlr_xcursor_manager *manager, + float scale); + +/** + * Retrieves a wlr_xcursor reference for the given cursor name at the given + * scale factor, or NULL if this struct wlr_xcursor_manager has not loaded a + * cursor theme at the requested scale. + */ +struct wlr_xcursor *wlr_xcursor_manager_get_xcursor( + struct wlr_xcursor_manager *manager, const char *name, float scale); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_activation_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_activation_v1.h new file mode 100644 index 00000000..f7b038b8 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_activation_v1.h @@ -0,0 +1,89 @@ +/* + * 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_XDG_ACTIVATION_V1 +#define WLR_TYPES_WLR_XDG_ACTIVATION_V1 + +#include + +struct wlr_xdg_activation_token_v1 { + struct wlr_xdg_activation_v1 *activation; + // The source surface that created the token. + struct wlr_surface *surface; // can be NULL + struct wlr_seat *seat; // can be NULL + // The serial for the input event that created the token. + uint32_t serial; // invalid if seat is NULL + // The application ID to be activated. This is just a hint. + char *app_id; // can be NULL + struct wl_list link; // wlr_xdg_activation_v1.tokens + + void *data; + + struct { + struct wl_signal destroy; + } events; + + // private state + + char *token; + struct wl_resource *resource; // can be NULL + struct wl_event_source *timeout; // can be NULL + + struct wl_listener seat_destroy; + struct wl_listener surface_destroy; +}; + +struct wlr_xdg_activation_v1 { + uint32_t token_timeout_msec; // token timeout in milliseconds (0 to disable) + + struct wl_list tokens; // wlr_xdg_activation_token_v1.link + + struct { + struct wl_signal destroy; + struct wl_signal request_activate; // struct wlr_xdg_activation_v1_request_activate_event + struct wl_signal new_token; // struct wlr_xdg_activation_token_v1 + } events; + + // private state + + struct wl_display *display; + + struct wl_global *global; + + struct wl_listener display_destroy; +}; + +struct wlr_xdg_activation_v1_request_activate_event { + struct wlr_xdg_activation_v1 *activation; + // The token used to request activation. + struct wlr_xdg_activation_token_v1 *token; + // The surface requesting for activation. + struct wlr_surface *surface; +}; + +struct wlr_xdg_activation_v1 *wlr_xdg_activation_v1_create( + struct wl_display *display); + +struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_token_v1_create( + struct wlr_xdg_activation_v1 *activation); + +void wlr_xdg_activation_token_v1_destroy( + struct wlr_xdg_activation_token_v1 *token); + +struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_v1_find_token( + struct wlr_xdg_activation_v1 *activation, const char *token_str); + +// Get a string suitable for exporting to launched clients +const char *wlr_xdg_activation_token_v1_get_name( + struct wlr_xdg_activation_token_v1 *token); + +// Add a token to the pool of known tokens +struct wlr_xdg_activation_token_v1 *wlr_xdg_activation_v1_add_token( + struct wlr_xdg_activation_v1 *activation, const char *token_str); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_decoration_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_decoration_v1.h new file mode 100644 index 00000000..61ce4bc1 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_decoration_v1.h @@ -0,0 +1,72 @@ +#ifndef WLR_TYPES_WLR_XDG_DECORATION_V1 +#define WLR_TYPES_WLR_XDG_DECORATION_V1 + +#include +#include + +enum wlr_xdg_toplevel_decoration_v1_mode { + WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_NONE = 0, + WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_CLIENT_SIDE = 1, + WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE = 2, +}; + +struct wlr_xdg_decoration_manager_v1 { + struct wl_global *global; + struct wl_list decorations; // wlr_xdg_toplevel_decoration.link + + struct wl_listener display_destroy; + + struct { + struct wl_signal new_toplevel_decoration; // struct wlr_xdg_toplevel_decoration + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_xdg_toplevel_decoration_v1_configure { + struct wl_list link; // wlr_xdg_toplevel_decoration.configure_list + struct wlr_xdg_surface_configure *surface_configure; + enum wlr_xdg_toplevel_decoration_v1_mode mode; +}; + +struct wlr_xdg_toplevel_decoration_v1_state { + enum wlr_xdg_toplevel_decoration_v1_mode mode; +}; + +struct wlr_xdg_toplevel_decoration_v1 { + struct wl_resource *resource; + struct wlr_xdg_toplevel * toplevel; + struct wlr_xdg_decoration_manager_v1 *manager; + struct wl_list link; // wlr_xdg_decoration_manager_v1.link + + struct wlr_xdg_toplevel_decoration_v1_state current, pending; + + enum wlr_xdg_toplevel_decoration_v1_mode scheduled_mode; + enum wlr_xdg_toplevel_decoration_v1_mode requested_mode; + + bool added; + + struct wl_list configure_list; // wlr_xdg_toplevel_decoration_v1_configure.link + + struct { + struct wl_signal destroy; + struct wl_signal request_mode; + } events; + + struct wl_listener surface_destroy; + struct wl_listener surface_configure; + struct wl_listener surface_ack_configure; + struct wl_listener surface_commit; + + void *data; +}; + +struct wlr_xdg_decoration_manager_v1 * + wlr_xdg_decoration_manager_v1_create(struct wl_display *display); + +uint32_t wlr_xdg_toplevel_decoration_v1_set_mode( + struct wlr_xdg_toplevel_decoration_v1 *decoration, + enum wlr_xdg_toplevel_decoration_v1_mode mode); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_registry.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_registry.h new file mode 100644 index 00000000..54c91e4d --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_registry.h @@ -0,0 +1,75 @@ +/* + * 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_XDG_FOREIGN_REGISTRY_H +#define WLR_TYPES_WLR_XDG_FOREIGN_REGISTRY_H + +#include + +#define WLR_XDG_FOREIGN_HANDLE_SIZE 37 + +/** + * struct wlr_xdg_foreign_registry is used for storing a list of exported + * surfaces with the xdg-foreign family of protocols. + * + * It can be used to allow interoperability between clients using different + * versions of the protocol (if all versions use the same registry). + */ +struct wlr_xdg_foreign_registry { + struct wl_list exported_surfaces; // struct wlr_xdg_foreign_exported_surface + + struct wl_listener display_destroy; + struct { + struct wl_signal destroy; + } events; +}; + +struct wlr_xdg_foreign_exported { + struct wl_list link; // wlr_xdg_foreign_registry.exported_surfaces + struct wlr_xdg_foreign_registry *registry; + + struct wlr_surface *surface; + + char handle[WLR_XDG_FOREIGN_HANDLE_SIZE]; + + struct { + struct wl_signal destroy; + } events; +}; + +/** + * Create an empty struct wlr_xdg_foreign_registry. + * + * It will be destroyed when the associated display is destroyed. + */ +struct wlr_xdg_foreign_registry *wlr_xdg_foreign_registry_create( + struct wl_display *display); + +/** + * Add the given exported surface to the registry and assign it a unique handle. + * The caller is responsible for removing the exported surface from the repository + * if it is destroyed. + * + * Returns true if the initialization was successful. + */ +bool wlr_xdg_foreign_exported_init(struct wlr_xdg_foreign_exported *surface, + struct wlr_xdg_foreign_registry *registry); + +/** + * Find an exported surface with the given handle, or NULL if such a surface + * does not exist. + */ +struct wlr_xdg_foreign_exported *wlr_xdg_foreign_registry_find_by_handle( + struct wlr_xdg_foreign_registry *registry, const char *handle); + +/** + * Remove the given surface from the registry it was previously added in. + */ +void wlr_xdg_foreign_exported_finish(struct wlr_xdg_foreign_exported *surface); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_v1.h new file mode 100644 index 00000000..45f060df --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_v1.h @@ -0,0 +1,64 @@ +/* + * 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_XDG_FOREIGN_V1_H +#define WLR_TYPES_WLR_XDG_FOREIGN_V1_H + +#include +#include + +struct wlr_xdg_foreign_v1 { + struct { + struct wl_global *global; + struct wl_list objects; // wlr_xdg_exported_v1.link or wlr_xdg_imported_v1.link + } exporter, importer; + + struct wl_listener foreign_registry_destroy; + struct wl_listener display_destroy; + + struct wlr_xdg_foreign_registry *registry; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_xdg_exported_v1 { + struct wlr_xdg_foreign_exported base; + + struct wl_resource *resource; + struct wl_listener xdg_surface_destroy; + + struct wl_list link; // wlr_xdg_foreign_v1.exporter.objects +}; + +struct wlr_xdg_imported_v1 { + struct wlr_xdg_foreign_exported *exported; + struct wl_listener exported_destroyed; + + struct wl_resource *resource; + struct wl_list link; // wlr_xdg_foreign_v1.importer.objects + struct wl_list children; +}; + +struct wlr_xdg_imported_child_v1 { + struct wlr_xdg_imported_v1 *imported; + struct wlr_surface *surface; + + struct wl_list link; // wlr_xdg_imported_v1.children + + struct wl_listener xdg_surface_destroy; + struct wl_listener xdg_toplevel_set_parent; +}; + +struct wlr_xdg_foreign_v1 *wlr_xdg_foreign_v1_create( + struct wl_display *display, struct wlr_xdg_foreign_registry *registry); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_v2.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_v2.h new file mode 100644 index 00000000..b091b459 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_foreign_v2.h @@ -0,0 +1,64 @@ +/* + * 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_XDG_FOREIGN_V2_H +#define WLR_TYPES_WLR_XDG_FOREIGN_V2_H + +#include +#include + +struct wlr_xdg_foreign_v2 { + struct { + struct wl_global *global; + struct wl_list objects; // wlr_xdg_exported_v2.link or wlr_xdg_imported_v2.link + } exporter, importer; + + struct wl_listener foreign_registry_destroy; + struct wl_listener display_destroy; + + struct wlr_xdg_foreign_registry *registry; + + struct { + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_xdg_exported_v2 { + struct wlr_xdg_foreign_exported base; + + struct wl_resource *resource; + struct wl_listener xdg_surface_destroy; + + struct wl_list link; // wlr_xdg_foreign_v2.exporter.objects +}; + +struct wlr_xdg_imported_v2 { + struct wlr_xdg_foreign_exported *exported; + struct wl_listener exported_destroyed; + + struct wl_resource *resource; + struct wl_list link; // wlr_xdg_foreign_v2.importer.objects + struct wl_list children; +}; + +struct wlr_xdg_imported_child_v2 { + struct wlr_xdg_imported_v2 *imported; + struct wlr_surface *surface; + + struct wl_list link; // wlr_xdg_imported_v2.children + + struct wl_listener xdg_surface_destroy; + struct wl_listener xdg_toplevel_set_parent; +}; + +struct wlr_xdg_foreign_v2 *wlr_xdg_foreign_v2_create( + struct wl_display *display, struct wlr_xdg_foreign_registry *registry); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_output_v1.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_output_v1.h new file mode 100644 index 00000000..340252dd --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_output_v1.h @@ -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_XDG_OUTPUT_V1_H +#define WLR_TYPES_WLR_XDG_OUTPUT_V1_H +#include +#include + +struct wlr_xdg_output_v1 { + struct wlr_xdg_output_manager_v1 *manager; + struct wl_list resources; + struct wl_list link; + + struct wlr_output_layout_output *layout_output; + + int32_t x, y; + int32_t width, height; + + struct wl_listener destroy; + struct wl_listener description; +}; + +struct wlr_xdg_output_manager_v1 { + struct wl_global *global; + struct wlr_output_layout *layout; + + struct wl_list outputs; + + struct { + struct wl_signal destroy; + } events; + + struct wl_listener display_destroy; + struct wl_listener layout_add; + struct wl_listener layout_change; + struct wl_listener layout_destroy; +}; + +struct wlr_xdg_output_manager_v1 *wlr_xdg_output_manager_v1_create( + struct wl_display *display, struct wlr_output_layout *layout); + +#endif diff --git a/debian/swayfx/usr/include/wlr/types/wlr_xdg_shell.h b/debian/swayfx/usr/include/wlr/types/wlr_xdg_shell.h new file mode 100644 index 00000000..29ced596 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/types/wlr_xdg_shell.h @@ -0,0 +1,541 @@ +/* + * 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_XDG_SHELL_H +#define WLR_TYPES_WLR_XDG_SHELL_H + +#include +#include +#include +#include +#include "xdg-shell-protocol.h" + +struct wlr_xdg_shell { + struct wl_global *global; + uint32_t version; + struct wl_list clients; + struct wl_list popup_grabs; + uint32_t ping_timeout; + + struct wl_listener display_destroy; + + struct { + struct wl_signal new_surface; // struct wlr_xdg_surface + struct wl_signal destroy; + } events; + + void *data; +}; + +struct wlr_xdg_client { + struct wlr_xdg_shell *shell; + struct wl_resource *resource; + struct wl_client *client; + struct wl_list surfaces; + + struct wl_list link; // wlr_xdg_shell.clients + + uint32_t ping_serial; + struct wl_event_source *ping_timer; +}; + +struct wlr_xdg_positioner_rules { + struct wlr_box anchor_rect; + enum xdg_positioner_anchor anchor; + enum xdg_positioner_gravity gravity; + enum xdg_positioner_constraint_adjustment constraint_adjustment; + + bool reactive; + + bool has_parent_configure_serial; + uint32_t parent_configure_serial; + + struct { + int32_t width, height; + } size, parent_size; + + struct { + int32_t x, y; + } offset; +}; + +struct wlr_xdg_positioner { + struct wl_resource *resource; + struct wlr_xdg_positioner_rules rules; +}; + +struct wlr_xdg_popup_state { + // Position of the popup relative to the upper left corner of + // the window geometry of the parent surface + struct wlr_box geometry; + + bool reactive; +}; + +enum wlr_xdg_popup_configure_field { + WLR_XDG_POPUP_CONFIGURE_REPOSITION_TOKEN = 1 << 0, +}; + +struct wlr_xdg_popup_configure { + uint32_t fields; // enum wlr_xdg_popup_configure_field + struct wlr_box geometry; + struct wlr_xdg_positioner_rules rules; + uint32_t reposition_token; +}; + +struct wlr_xdg_popup { + struct wlr_xdg_surface *base; + struct wl_list link; + + struct wl_resource *resource; + bool sent_initial_configure; + struct wlr_surface *parent; + struct wlr_seat *seat; + + struct wlr_xdg_popup_configure scheduled; + + struct wlr_xdg_popup_state current, pending; + + struct { + struct wl_signal reposition; + } events; + + struct wl_list grab_link; // wlr_xdg_popup_grab.popups +}; + +// each seat gets a popup grab +struct wlr_xdg_popup_grab { + struct wl_client *client; + struct wlr_seat_pointer_grab pointer_grab; + struct wlr_seat_keyboard_grab keyboard_grab; + struct wlr_seat_touch_grab touch_grab; + struct wlr_seat *seat; + struct wl_list popups; + struct wl_list link; // wlr_xdg_shell.popup_grabs + struct wl_listener seat_destroy; +}; + +enum wlr_xdg_surface_role { + WLR_XDG_SURFACE_ROLE_NONE, + WLR_XDG_SURFACE_ROLE_TOPLEVEL, + WLR_XDG_SURFACE_ROLE_POPUP, +}; + +struct wlr_xdg_toplevel_state { + bool maximized, fullscreen, resizing, activated, suspended; + uint32_t tiled; // enum wlr_edges + int32_t width, height; + int32_t max_width, max_height; + int32_t min_width, min_height; +}; + +enum wlr_xdg_toplevel_wm_capabilities { + WLR_XDG_TOPLEVEL_WM_CAPABILITIES_WINDOW_MENU = 1 << 0, + WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE = 1 << 1, + WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN = 1 << 2, + WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE = 1 << 3, +}; + +enum wlr_xdg_toplevel_configure_field { + WLR_XDG_TOPLEVEL_CONFIGURE_BOUNDS = 1 << 0, + WLR_XDG_TOPLEVEL_CONFIGURE_WM_CAPABILITIES = 1 << 1, +}; + +struct wlr_xdg_toplevel_configure { + uint32_t fields; // enum wlr_xdg_toplevel_configure_field + bool maximized, fullscreen, resizing, activated, suspended; + uint32_t tiled; // enum wlr_edges + int32_t width, height; + struct { + int32_t width, height; + } bounds; + uint32_t wm_capabilities; // enum wlr_xdg_toplevel_wm_capabilities +}; + +struct wlr_xdg_toplevel_requested { + bool maximized, minimized, fullscreen; + struct wlr_output *fullscreen_output; + struct wl_listener fullscreen_output_destroy; +}; + +struct wlr_xdg_toplevel { + struct wl_resource *resource; + struct wlr_xdg_surface *base; + + struct wlr_xdg_toplevel *parent; + struct wl_listener parent_unmap; + + struct wlr_xdg_toplevel_state current, pending; + + // Properties to be sent to the client in the next configure event. + struct wlr_xdg_toplevel_configure scheduled; + + // Properties that the client has requested. Intended to be checked + // by the compositor on surface map and state change requests (such as + // xdg_toplevel.set_fullscreen) and handled accordingly. + struct wlr_xdg_toplevel_requested requested; + + char *title; + char *app_id; + + struct { + // Note: as per xdg-shell protocol, the compositor has to + // handle state requests by sending a configure event, + // even if it didn't actually change the state. Therefore, + // every compositor implementing xdg-shell support *must* + // listen to these signals and schedule a configure event + // immediately or at some time in the future; not doing so + // is a protocol violation. + struct wl_signal request_maximize; + struct wl_signal request_fullscreen; + + struct wl_signal request_minimize; + struct wl_signal request_move; + struct wl_signal request_resize; + struct wl_signal request_show_window_menu; + struct wl_signal set_parent; + struct wl_signal set_title; + struct wl_signal set_app_id; + } events; +}; + +struct wlr_xdg_surface_configure { + struct wlr_xdg_surface *surface; + struct wl_list link; // wlr_xdg_surface.configure_list + uint32_t serial; + + union { + struct wlr_xdg_toplevel_configure *toplevel_configure; + struct wlr_xdg_popup_configure *popup_configure; + }; +}; + +struct wlr_xdg_surface_state { + uint32_t configure_serial; + struct wlr_box geometry; +}; + +/** + * An xdg-surface is a user interface element requiring management by the + * compositor. An xdg-surface alone isn't useful, a role should be assigned to + * it in order to map it. + */ +struct wlr_xdg_surface { + struct wlr_xdg_client *client; + struct wl_resource *resource; + struct wlr_surface *surface; + struct wl_list link; // wlr_xdg_client.surfaces + + /** + * The lifetime-bound role of the xdg_surface. WLR_XDG_SURFACE_ROLE_NONE + * if the role was never set. + */ + enum wlr_xdg_surface_role role; + /** + * The role object representing the role. NULL if the object was destroyed. + */ + struct wl_resource *role_resource; + + // NULL if the role resource is inert + union { + struct wlr_xdg_toplevel *toplevel; + struct wlr_xdg_popup *popup; + }; + + struct wl_list popups; // wlr_xdg_popup.link + + bool added, configured; + struct wl_event_source *configure_idle; + uint32_t scheduled_serial; + struct wl_list configure_list; + + struct wlr_xdg_surface_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 { + struct wl_signal destroy; + struct wl_signal ping_timeout; + struct wl_signal new_popup; + + // for protocol extensions + struct wl_signal configure; // struct wlr_xdg_surface_configure + struct wl_signal ack_configure; // struct wlr_xdg_surface_configure + } events; + + void *data; + + // private state + + struct wl_listener role_resource_destroy; +}; + +struct wlr_xdg_toplevel_move_event { + struct wlr_xdg_toplevel *toplevel; + struct wlr_seat_client *seat; + uint32_t serial; +}; + +struct wlr_xdg_toplevel_resize_event { + struct wlr_xdg_toplevel *toplevel; + struct wlr_seat_client *seat; + uint32_t serial; + uint32_t edges; +}; + +struct wlr_xdg_toplevel_show_window_menu_event { + struct wlr_xdg_toplevel *toplevel; + struct wlr_seat_client *seat; + uint32_t serial; + int32_t x, y; +}; + +/** + * Create the xdg_wm_base global with the specified version. + */ +struct wlr_xdg_shell *wlr_xdg_shell_create(struct wl_display *display, + uint32_t version); + +/** Get the corresponding struct wlr_xdg_surface from a resource. + * + * Aborts if the resource doesn't have the correct type. Returns NULL if the + * resource is inert. + */ +struct wlr_xdg_surface *wlr_xdg_surface_from_resource( + struct wl_resource *resource); + +/** Get the corresponding struct wlr_xdg_popup from a resource. + * + * Aborts if the resource doesn't have the correct type. Returns NULL if the + * resource is inert. + */ +struct wlr_xdg_popup *wlr_xdg_popup_from_resource( + struct wl_resource *resource); + +/** Get the corresponding struct wlr_xdg_toplevel from a resource. + * + * Aborts if the resource doesn't have the correct type. Returns NULL if the + * resource is inert. + */ +struct wlr_xdg_toplevel *wlr_xdg_toplevel_from_resource( + struct wl_resource *resource); + +/** Get the corresponding struct wlr_xdg_positioner from a resource. + * + * Aborts if the resource doesn't have the correct type. + */ +struct wlr_xdg_positioner *wlr_xdg_positioner_from_resource( + struct wl_resource *resource); + +/** + * Send a ping to the surface. If the surface does not respond in a reasonable + * amount of time, the ping_timeout event will be emitted. + */ +void wlr_xdg_surface_ping(struct wlr_xdg_surface *surface); + +/** + * Request that this toplevel surface be the given size. Returns the associated + * configure serial. + */ +uint32_t wlr_xdg_toplevel_set_size(struct wlr_xdg_toplevel *toplevel, + int32_t width, int32_t height); + +/** + * Request that this toplevel show itself in an activated or deactivated + * state. Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_activated(struct wlr_xdg_toplevel *toplevel, + bool activated); + +/** + * Request that this toplevel consider itself maximized or not + * maximized. Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_maximized(struct wlr_xdg_toplevel *toplevel, + bool maximized); + +/** + * Request that this toplevel consider itself fullscreen or not + * fullscreen. Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_fullscreen(struct wlr_xdg_toplevel *toplevel, + bool fullscreen); + +/** + * Request that this toplevel consider itself to be resizing or not + * resizing. Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_resizing(struct wlr_xdg_toplevel *toplevel, + bool resizing); + +/** + * Request that this toplevel consider itself in a tiled layout and some + * edges are adjacent to another part of the tiling grid. `tiled_edges` is a + * bitfield of enum wlr_edges. Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_tiled(struct wlr_xdg_toplevel *toplevel, + uint32_t tiled_edges); + +/** + * Configure the recommended bounds for the client's window geometry size. + * Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_bounds(struct wlr_xdg_toplevel *toplevel, + int32_t width, int32_t height); + +/** + * Configure the window manager capabilities for this toplevel. `caps` is a + * bitfield of `enum wlr_xdg_toplevel_wm_capabilities`. Returns the associated + * configure serial. + */ +uint32_t wlr_xdg_toplevel_set_wm_capabilities(struct wlr_xdg_toplevel *toplevel, + uint32_t caps); + +/** + * Request that this toplevel consider itself suspended or not + * suspended. Returns the associated configure serial. + */ +uint32_t wlr_xdg_toplevel_set_suspended(struct wlr_xdg_toplevel *toplevel, + bool suspended); + +/** + * Request that this toplevel closes. + */ +void wlr_xdg_toplevel_send_close(struct wlr_xdg_toplevel *toplevel); + +/** + * Sets the parent of this toplevel. Parent can be NULL. + * + * Returns true on success, false if setting the parent would create a loop. + */ +bool wlr_xdg_toplevel_set_parent(struct wlr_xdg_toplevel *toplevel, + struct wlr_xdg_toplevel *parent); + +/** + * Notify the client that the popup has been dismissed and destroy the + * struct wlr_xdg_popup, rendering the resource inert. + */ +void wlr_xdg_popup_destroy(struct wlr_xdg_popup *popup); + +/** + * Get the position for this popup in the surface parent's coordinate system. + */ +void wlr_xdg_popup_get_position(struct wlr_xdg_popup *popup, + double *popup_sx, double *popup_sy); + +/** + * Get the geometry based on positioner rules. + */ +void wlr_xdg_positioner_rules_get_geometry( + const struct wlr_xdg_positioner_rules *rules, struct wlr_box *box); + +/** + * Unconstrain the box from the constraint area according to positioner rules. + */ +void wlr_xdg_positioner_rules_unconstrain_box( + const struct wlr_xdg_positioner_rules *rules, + const struct wlr_box *constraint, struct wlr_box *box); + +/** + * Convert the given coordinates in the popup coordinate system to the toplevel + * surface coordinate system. + */ +void wlr_xdg_popup_get_toplevel_coords(struct wlr_xdg_popup *popup, + int popup_sx, int popup_sy, int *toplevel_sx, int *toplevel_sy); + +/** + * Set the geometry of this popup to unconstrain it according to its + * xdg-positioner rules. The box should be in the popup's root toplevel parent + * surface coordinate system. + */ +void wlr_xdg_popup_unconstrain_from_box(struct wlr_xdg_popup *popup, + const struct wlr_box *toplevel_space_box); + +/** + * Find a surface within this xdg-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_xdg_surface_surface_at( + struct wlr_xdg_surface *surface, double sx, double sy, + double *sub_x, double *sub_y); + +/** + * Find a surface within this xdg-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_xdg_surface_popup_surface_at( + struct wlr_xdg_surface *surface, double sx, double sy, + double *sub_x, double *sub_y); + +/** + * Get a struct wlr_xdg_surface from a struct wlr_surface. + * + * Returns NULL if the surface doesn't have the xdg_surface role or + * if the xdg_surface has been destroyed. + */ +struct wlr_xdg_surface *wlr_xdg_surface_try_from_wlr_surface(struct wlr_surface *surface); + +/** + * Get a struct wlr_xdg_toplevel from a struct wlr_surface. + * + * Returns NULL if the surface doesn't have the xdg_surface role, the + * xdg_surface is not a toplevel, or the xdg_surface/xdg_toplevel objects have + * been destroyed. + */ +struct wlr_xdg_toplevel *wlr_xdg_toplevel_try_from_wlr_surface(struct wlr_surface *surface); + +/** + * Get a struct wlr_xdg_popup from a struct wlr_surface. + * + * Returns NULL if the surface doesn't have the xdg_surface role, the + * xdg_surface is not a popup, or the xdg_surface/xdg_popup objects have + * been destroyed. + */ +struct wlr_xdg_popup *wlr_xdg_popup_try_from_wlr_surface(struct wlr_surface *surface); + +/** + * Get the surface geometry. + * + * This is either the geometry as set by the client, or defaulted to the bounds + * of the surface + the subsurfaces (as specified by the protocol). + * + * The x and y value can be < 0. + */ +void wlr_xdg_surface_get_geometry(struct wlr_xdg_surface *surface, + struct wlr_box *box); + +/** + * Call `iterator` on each mapped surface and popup in the xdg-surface tree + * (whether or not this xdg-surface is mapped), with the surface's position + * relative to the root xdg-surface. The function is called from root to leaves + * (in rendering order). + */ +void wlr_xdg_surface_for_each_surface(struct wlr_xdg_surface *surface, + wlr_surface_iterator_func_t iterator, void *user_data); + +/** + * Call `iterator` on each mapped popup's surface and popup's subsurface in the + * xdg-surface tree (whether or not this xdg-surface is mapped), with the + * surfaces's position relative to the root xdg-surface. The function is called + * from root to leaves (in rendering order). + */ +void wlr_xdg_surface_for_each_popup_surface(struct wlr_xdg_surface *surface, + wlr_surface_iterator_func_t iterator, void *user_data); + +/** + * Schedule a surface configuration. This should only be called by protocols + * extending the shell. + */ +uint32_t wlr_xdg_surface_schedule_configure(struct wlr_xdg_surface *surface); + +#endif diff --git a/debian/swayfx/usr/include/wlr/util/addon.h b/debian/swayfx/usr/include/wlr/util/addon.h new file mode 100644 index 00000000..c64200cf --- /dev/null +++ b/debian/swayfx/usr/include/wlr/util/addon.h @@ -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_UTIL_ADDON_H +#define WLR_UTIL_ADDON_H + +#include + +struct wlr_addon_set { + // private state + struct wl_list addons; +}; + +struct wlr_addon; + +struct wlr_addon_interface { + const char *name; + // Has to call wlr_addon_finish() + void (*destroy)(struct wlr_addon *addon); +}; + +struct wlr_addon { + const struct wlr_addon_interface *impl; + // private state + const void *owner; + struct wl_list link; +}; + +void wlr_addon_set_init(struct wlr_addon_set *set); +void wlr_addon_set_finish(struct wlr_addon_set *set); + +void wlr_addon_init(struct wlr_addon *addon, struct wlr_addon_set *set, + const void *owner, const struct wlr_addon_interface *impl); +void wlr_addon_finish(struct wlr_addon *addon); + +struct wlr_addon *wlr_addon_find(struct wlr_addon_set *set, const void *owner, + const struct wlr_addon_interface *impl); + +#endif diff --git a/debian/swayfx/usr/include/wlr/util/box.h b/debian/swayfx/usr/include/wlr/util/box.h new file mode 100644 index 00000000..e866b1df --- /dev/null +++ b/debian/swayfx/usr/include/wlr/util/box.h @@ -0,0 +1,114 @@ +/* +* 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_UTIL_BOX_H +#define WLR_UTIL_BOX_H + +#include +#include + +/** + * A box representing a rectangle region in a 2D space. + * + * The x and y coordinates are inclusive, and the width and height lengths are + * exclusive. In other words, the box starts from the coordinates (x, y), and + * goes up to but not including (x + width, y + height). + */ +struct wlr_box { + int x, y; + int width, height; +}; + +/** + * A floating-point box representing a rectangle region in a 2D space. + * + * struct wlr_fbox has the same semantics as struct wlr_box. + */ +struct wlr_fbox { + double x, y; + double width, height; +}; + +/** + * Functions below accept NULL where a box is expected, which is treated + * the same as an empty box. + */ + +/** + * Finds the closest point within the box bounds. + * + * Returns NAN if the box is empty. + */ +void wlr_box_closest_point(const struct wlr_box *box, double x, double y, + double *dest_x, double *dest_y); + +/** + * Gives the intersecting box between two struct wlr_box. + * + * Returns an empty box if the provided boxes don't intersect. + */ +bool wlr_box_intersection(struct wlr_box *dest, const struct wlr_box *box_a, + const struct wlr_box *box_b); + +/** + * Verifies if a point is contained within the bounds of a given struct wlr_box. + * + * For example: + * + * - A point at (100, 50) is not contained in the box (0, 0, 100, 50). + * - A point at (10, 10) is contained in the box (10, 0, 50, 50). + */ +bool wlr_box_contains_point(const struct wlr_box *box, double x, double y); + +/** + * Checks whether a box is empty or not. + * + * A box is considered empty if its width and/or height is zero or negative. + */ +bool wlr_box_empty(const struct wlr_box *box); + +/** + * Transforms a box inside a (0, 0, width, height) box. + */ +void wlr_box_transform(struct wlr_box *dest, const struct wlr_box *box, + enum wl_output_transform transform, int width, int height); + +/** + * Checks whether a box is empty or not. + * + * A box is considered empty if its width and/or height is zero or negative. + */ +bool wlr_fbox_empty(const struct wlr_fbox *box); + +/** + * Transforms a floating-point box inside a (0, 0, width, height) box. + */ +void wlr_fbox_transform(struct wlr_fbox *dest, const struct wlr_fbox *box, + enum wl_output_transform transform, double width, double height); + +#ifdef WLR_USE_UNSTABLE + +/** + * Returns true if the two boxes are equal, false otherwise. + */ +bool wlr_box_equal(const struct wlr_box *a, const struct wlr_box *b); + +/** + * Returns true if the two boxes are equal, false otherwise. + */ +bool wlr_fbox_equal(const struct wlr_fbox *a, const struct wlr_fbox *b); + +#endif + +#endif diff --git a/debian/swayfx/usr/include/wlr/util/edges.h b/debian/swayfx/usr/include/wlr/util/edges.h new file mode 100644 index 00000000..be405562 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/util/edges.h @@ -0,0 +1,27 @@ +/* + * 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_UTIL_EDGES_H +#define WLR_UTIL_EDGES_H + +enum wlr_edges { + WLR_EDGE_NONE = 0, + WLR_EDGE_TOP = 1 << 0, + WLR_EDGE_BOTTOM = 1 << 1, + WLR_EDGE_LEFT = 1 << 2, + WLR_EDGE_RIGHT = 1 << 3, +}; + +#endif diff --git a/debian/swayfx/usr/include/wlr/util/log.h b/debian/swayfx/usr/include/wlr/util/log.h new file mode 100644 index 00000000..587104cc --- /dev/null +++ b/debian/swayfx/usr/include/wlr/util/log.h @@ -0,0 +1,76 @@ +/* + * 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_UTIL_LOG_H +#define WLR_UTIL_LOG_H + +#include +#include +#include +#include + +enum wlr_log_importance { + WLR_SILENT = 0, + WLR_ERROR = 1, + WLR_INFO = 2, + WLR_DEBUG = 3, + WLR_LOG_IMPORTANCE_LAST, +}; + +typedef void (*wlr_log_func_t)(enum wlr_log_importance importance, + const char *fmt, va_list args); + +/** + * Set the log verbosity and callback. + * + * Only messages less than or equal to the supplied verbosity will be logged. + * If the callback is NULL, the default logger is used. + * + * This function can be called multiple times to update the verbosity or + * callback function. + */ +void wlr_log_init(enum wlr_log_importance verbosity, wlr_log_func_t callback); + +/** + * Get the current log verbosity configured by wlr_log_init(). + */ +enum wlr_log_importance wlr_log_get_verbosity(void); + +#ifdef __GNUC__ +#define _WLR_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end))) +#else +#define _WLR_ATTRIB_PRINTF(start, end) +#endif + +void _wlr_log(enum wlr_log_importance verbosity, const char *format, ...) _WLR_ATTRIB_PRINTF(2, 3); +void _wlr_vlog(enum wlr_log_importance verbosity, const char *format, va_list args) _WLR_ATTRIB_PRINTF(2, 0); + +#ifdef _WLR_REL_SRC_DIR +// strip prefix from __FILE__, leaving the path relative to the project root +#define _WLR_FILENAME ((const char *)__FILE__ + sizeof(_WLR_REL_SRC_DIR) - 1) +#else +#define _WLR_FILENAME __FILE__ +#endif + +#define wlr_log(verb, fmt, ...) \ + _wlr_log(verb, "[%s:%d] " fmt, _WLR_FILENAME, __LINE__, ##__VA_ARGS__) + +#define wlr_vlog(verb, fmt, args) \ + _wlr_vlog(verb, "[%s:%d] " fmt, _WLR_FILENAME, __LINE__, args) + +#define wlr_log_errno(verb, fmt, ...) \ + wlr_log(verb, fmt ": %s", ##__VA_ARGS__, strerror(errno)) + +#endif diff --git a/debian/swayfx/usr/include/wlr/util/region.h b/debian/swayfx/usr/include/wlr/util/region.h new file mode 100644 index 00000000..948307a1 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/util/region.h @@ -0,0 +1,58 @@ +/* + * 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_UTIL_REGION_H +#define WLR_UTIL_REGION_H + +#include +#include +#include + +/** + * Scales a region, ie. multiplies all its coordinates by `scale`. + * + * The resulting coordinates are rounded up or down so that the new region is + * at least as big as the original one. + */ +void wlr_region_scale(pixman_region32_t *dst, const pixman_region32_t *src, + float scale); + +void wlr_region_scale_xy(pixman_region32_t *dst, const pixman_region32_t *src, + float scale_x, float scale_y); + +/** + * Applies a transform to a region inside a box of size `width` x `height`. + */ +void wlr_region_transform(pixman_region32_t *dst, const pixman_region32_t *src, + enum wl_output_transform transform, int width, int height); + +/** + * Expands the region by distance on both axis. distance must be + * a non-negative number. + */ +void wlr_region_expand(pixman_region32_t *dst, const pixman_region32_t *src, + int distance); + +/* + * Builds the smallest possible region that contains the region rotated about + * the point (ox, oy). + */ +void wlr_region_rotated_bounds(pixman_region32_t *dst, const pixman_region32_t *src, + float rotation, int ox, int oy); + +bool wlr_region_confine(const pixman_region32_t *region, double x1, double y1, double x2, + double y2, double *x2_out, double *y2_out); + +#endif diff --git a/debian/swayfx/usr/include/wlr/version.h b/debian/swayfx/usr/include/wlr/version.h new file mode 100644 index 00000000..395dc1ab --- /dev/null +++ b/debian/swayfx/usr/include/wlr/version.h @@ -0,0 +1,12 @@ +#ifndef WLR_VERSION_H +#define WLR_VERSION_H + +#define WLR_VERSION_STR "0.17.3" + +#define WLR_VERSION_MAJOR 0 +#define WLR_VERSION_MINOR 17 +#define WLR_VERSION_MICRO 3 + +#define WLR_VERSION_NUM ((WLR_VERSION_MAJOR << 16) | (WLR_VERSION_MINOR << 8) | WLR_VERSION_MICRO) + +#endif diff --git a/debian/swayfx/usr/include/wlr/xcursor.h b/debian/swayfx/usr/include/wlr/xcursor.h new file mode 100644 index 00000000..bb75119b --- /dev/null +++ b/debian/swayfx/usr/include/wlr/xcursor.h @@ -0,0 +1,127 @@ +/* + * Copyright © 2012 Intel Corporation + * + * 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 (including the + * next paragraph) 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. + */ + +/* + * 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_XCURSOR_H +#define WLR_XCURSOR_H + +#include +#include + +/** + * A still cursor image. + * + * The buffer contains pixels layed out in a packed DRM_FORMAT_ARGB8888 format. + */ +struct wlr_xcursor_image { + uint32_t width; /* actual width */ + uint32_t height; /* actual height */ + uint32_t hotspot_x; /* hot-spot x (must be inside image) */ + uint32_t hotspot_y; /* hot-spot y (must be inside image) */ + uint32_t delay; /* animation delay to next frame (ms) */ + uint8_t *buffer; /* pixel data */ +}; + +/** + * A cursor. + * + * If the cursor is animated, it may contain more than a single image. + */ +struct wlr_xcursor { + unsigned int image_count; + struct wlr_xcursor_image **images; + char *name; + uint32_t total_delay; /* total duration of the animation in ms */ +}; + +/** + * Container for an Xcursor theme. + */ +struct wlr_xcursor_theme { + unsigned int cursor_count; + struct wlr_xcursor **cursors; + char *name; + int size; +}; + +/** + * Loads the named Xcursor theme. + * + * This is useful if you need cursor images for your compositor to use when a + * client-side cursor is not available or you wish to override client-side + * cursors for a particular UI interaction (such as using a grab cursor when + * moving a window around). + * + * The size is given in pixels. + * + * If a cursor theme with the given name couldn't be loaded, a fallback theme + * is loaded. + * + * On error, NULL is returned. + */ +struct wlr_xcursor_theme *wlr_xcursor_theme_load(const char *name, int size); + +/** + * Destroy a cursor theme. + * + * This implicitly destroys all child cursors and cursor images. + */ +void wlr_xcursor_theme_destroy(struct wlr_xcursor_theme *theme); + +/** + * Obtain a cursor for the specified name (e.g. "default"). + * + * If the cursor could not be found, NULL is returned. + */ +struct wlr_xcursor *wlr_xcursor_theme_get_cursor( + struct wlr_xcursor_theme *theme, const char *name); + +/** + * Find the frame for a given elapsed time in a cursor animation. + * + * This function converts a timestamp (in ms) to a cursor image index. + */ +int wlr_xcursor_frame(struct wlr_xcursor *cursor, uint32_t time); + +/** + * Get the name of the resize cursor for the given edges. + */ +const char *wlr_xcursor_get_resize_name(enum wlr_edges edges); + +#endif diff --git a/debian/swayfx/usr/include/wlr/xwayland/server.h b/debian/swayfx/usr/include/wlr/xwayland/server.h new file mode 100644 index 00000000..fa16a3b0 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/xwayland/server.h @@ -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_XWAYLAND_SERVER_H +#define WLR_XWAYLAND_SERVER_H + +#include +#include +#include +#include + +struct wlr_xwayland_server_options { + bool lazy; + bool enable_wm; + bool no_touch_pointer_emulation; + bool force_xrandr_emulation; + int terminate_delay; // in seconds, 0 to terminate immediately +}; + +struct wlr_xwayland_server { + pid_t pid; + struct wl_client *client; + struct wl_event_source *pipe_source; + int wm_fd[2], wl_fd[2]; + bool ready; + + time_t server_start; + + /* Anything above display is reset on Xwayland restart, rest is conserved */ + + int display; + char display_name[16]; + int x_fd[2]; + struct wl_event_source *x_fd_read_event[2]; + struct wlr_xwayland_server_options options; + + struct wl_display *wl_display; + struct wl_event_source *idle_source; + + struct { + struct wl_signal start; + struct wl_signal ready; + struct wl_signal destroy; + } events; + + struct wl_listener client_destroy; + struct wl_listener display_destroy; + + void *data; +}; + +struct wlr_xwayland_server_ready_event { + struct wlr_xwayland_server *server; + int wm_fd; +}; + +struct wlr_xwayland_server *wlr_xwayland_server_create( + struct wl_display *display, struct wlr_xwayland_server_options *options); +void wlr_xwayland_server_destroy(struct wlr_xwayland_server *server); + +#endif diff --git a/debian/swayfx/usr/include/wlr/xwayland/shell.h b/debian/swayfx/usr/include/wlr/xwayland/shell.h new file mode 100644 index 00000000..da5cb990 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/xwayland/shell.h @@ -0,0 +1,80 @@ +/* + * 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_XWAYLAND_SHELL_H +#define WLR_XWAYLAND_SHELL_H + +#include +#include + +/** + * The Xwayland shell. + * + * This is a shell only exposed to Xwayland. + */ +struct wlr_xwayland_shell_v1 { + struct wl_global *global; + + struct { + struct wl_signal destroy; + struct wl_signal new_surface; // struct wlr_xwayland_surface_v1 + } events; + + // private state + + struct wl_client *client; + struct wl_list surfaces; // wlr_xwayland_surface_v1.link + + struct wl_listener display_destroy; + struct wl_listener client_destroy; +}; + +/** + * An Xwayland shell surface. + */ +struct wlr_xwayland_surface_v1 { + struct wlr_surface *surface; + uint64_t serial; + + // private state + + struct wl_resource *resource; + struct wl_list link; + struct wlr_xwayland_shell_v1 *shell; + bool added; +}; + +/** + * Create the xwayland_shell_v1 global. + * + * Compositors should add a global filter (see wl_display_set_global_filter()) + * to only expose this global to Xwayland clients. + */ +struct wlr_xwayland_shell_v1 *wlr_xwayland_shell_v1_create( + struct wl_display *display, uint32_t version); + +/** + * Destroy the xwayland_shell_v1 global. + */ +void wlr_xwayland_shell_v1_destroy(struct wlr_xwayland_shell_v1 *shell); + +/** + * Allow a client to bind to the xwayland_shell_v1 global. + */ +void wlr_xwayland_shell_v1_set_client(struct wlr_xwayland_shell_v1 *shell, + struct wl_client *client); + +/** + * Get a Wayland surface from an xwayland_shell_v1 serial. + * + * Returns NULL if the serial hasn't been associated with any surface. + */ +struct wlr_surface *wlr_xwayland_shell_v1_surface_from_serial( + struct wlr_xwayland_shell_v1 *shell, uint64_t serial); + +#endif diff --git a/debian/swayfx/usr/include/wlr/xwayland/xwayland.h b/debian/swayfx/usr/include/wlr/xwayland/xwayland.h new file mode 100644 index 00000000..cb9e35f0 --- /dev/null +++ b/debian/swayfx/usr/include/wlr/xwayland/xwayland.h @@ -0,0 +1,299 @@ +/* + * 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_XWAYLAND_XWAYLAND_H +#define WLR_XWAYLAND_XWAYLAND_H + +#include +#include +#include +#include +#include +#include + +struct wlr_box; +struct wlr_xwm; +struct wlr_data_source; +struct wlr_drag; + +struct wlr_xwayland { + struct wlr_xwayland_server *server; + bool own_server; + struct wlr_xwm *xwm; + struct wlr_xwayland_shell_v1 *shell_v1; + struct wlr_xwayland_cursor *cursor; + + const char *display_name; + + struct wl_display *wl_display; + struct wlr_compositor *compositor; + struct wlr_seat *seat; + + struct { + struct wl_signal ready; + struct wl_signal new_surface; // struct wlr_xwayland_surface + struct wl_signal remove_startup_info; // struct wlr_xwayland_remove_startup_info_event + } events; + + /** + * Add a custom event handler to xwayland. Return 1 if the event was + * handled or 0 to use the default wlr-xwayland handler. wlr-xwayland will + * free the event. + */ + int (*user_event_handler)(struct wlr_xwm *xwm, xcb_generic_event_t *event); + + struct wl_listener server_start; + struct wl_listener server_ready; + struct wl_listener server_destroy; + struct wl_listener seat_destroy; + struct wl_listener shell_destroy; + + void *data; +}; + +enum wlr_xwayland_surface_decorations { + WLR_XWAYLAND_SURFACE_DECORATIONS_ALL = 0, + WLR_XWAYLAND_SURFACE_DECORATIONS_NO_BORDER = 1, + WLR_XWAYLAND_SURFACE_DECORATIONS_NO_TITLE = 2, +}; + +/** + * This represents the input focus described as follows: + * + * https://www.x.org/releases/X11R7.6/doc/xorg-docs/specs/ICCCM/icccm.html#input_focus + */ +enum wlr_xwayland_icccm_input_model { + WLR_ICCCM_INPUT_MODEL_NONE = 0, + WLR_ICCCM_INPUT_MODEL_PASSIVE = 1, + WLR_ICCCM_INPUT_MODEL_LOCAL = 2, + WLR_ICCCM_INPUT_MODEL_GLOBAL = 3, +}; + +/** + * An Xwayland user interface component. It has an absolute position in + * layout-local coordinates. + * + * The inner struct wlr_surface is valid once the associate event is emitted. + * Compositors can set up e.g. map and unmap listeners at this point. The + * struct wlr_surface becomes invalid when the dissociate event is emitted. + */ +struct wlr_xwayland_surface { + xcb_window_t window_id; + struct wlr_xwm *xwm; + uint32_t surface_id; + uint64_t serial; + + struct wl_list link; + struct wl_list stack_link; + struct wl_list unpaired_link; + + struct wlr_surface *surface; + struct wlr_addon surface_addon; + struct wl_listener surface_commit; + struct wl_listener surface_map; + struct wl_listener surface_unmap; + + int16_t x, y; + uint16_t width, height; + uint16_t saved_width, saved_height; + bool override_redirect; + + char *title; + char *class; + char *instance; + char *role; + char *startup_id; + pid_t pid; + bool has_utf8_title; + + struct wl_list children; // wlr_xwayland_surface.parent_link + struct wlr_xwayland_surface *parent; + struct wl_list parent_link; // wlr_xwayland_surface.children + + xcb_atom_t *window_type; + size_t window_type_len; + + xcb_atom_t *protocols; + size_t protocols_len; + + uint32_t decorations; + xcb_icccm_wm_hints_t *hints; + xcb_size_hints_t *size_hints; + /* + * _NET_WM_STRUT_PARTIAL (used by e.g. XWayland panels). + * Note that right/bottom values are offsets from the lower + * right corner of the X11 screen, and the exact relation + * between X11 screen coordinates and the wlr_output_layout + * depends on the XWayland implementation. + */ + xcb_ewmh_wm_strut_partial_t *strut_partial; + + bool pinging; + struct wl_event_source *ping_timer; + + // _NET_WM_STATE + bool modal; + bool fullscreen; + bool maximized_vert, maximized_horz; + bool minimized; + bool withdrawn; + + bool has_alpha; + + struct { + struct wl_signal destroy; + struct wl_signal request_configure; // struct wlr_xwayland_surface_configure_event + struct wl_signal request_move; + struct wl_signal request_resize; // struct wlr_xwayland_resize_event + struct wl_signal request_minimize; // struct wlr_xwayland_minimize_event + struct wl_signal request_maximize; + struct wl_signal request_fullscreen; + struct wl_signal request_activate; + + struct wl_signal associate; + struct wl_signal dissociate; + + struct wl_signal set_title; + struct wl_signal set_class; + struct wl_signal set_role; + struct wl_signal set_parent; + struct wl_signal set_startup_id; + struct wl_signal set_window_type; + struct wl_signal set_hints; + struct wl_signal set_decorations; + struct wl_signal set_strut_partial; + struct wl_signal set_override_redirect; + struct wl_signal set_geometry; + struct wl_signal ping_timeout; + } events; + + void *data; +}; + +struct wlr_xwayland_surface_configure_event { + struct wlr_xwayland_surface *surface; + int16_t x, y; + uint16_t width, height; + uint16_t mask; // xcb_config_window_t +}; + +struct wlr_xwayland_remove_startup_info_event { + const char *id; + xcb_window_t window; +}; + +struct wlr_xwayland_resize_event { + struct wlr_xwayland_surface *surface; + uint32_t edges; +}; + +struct wlr_xwayland_minimize_event { + struct wlr_xwayland_surface *surface; + bool minimize; +}; + +/** Create an Xwayland server and XWM. + * + * The server supports a lazy mode in which Xwayland is only started when a + * client tries to connect. + */ +struct wlr_xwayland *wlr_xwayland_create(struct wl_display *wl_display, + struct wlr_compositor *compositor, bool lazy); + +/** + * Create an XWM from an existing Xwayland server. + */ +struct wlr_xwayland *wlr_xwayland_create_with_server(struct wl_display *display, + struct wlr_compositor *compositor, struct wlr_xwayland_server *server); + +void wlr_xwayland_destroy(struct wlr_xwayland *wlr_xwayland); + +void wlr_xwayland_set_cursor(struct wlr_xwayland *wlr_xwayland, + uint8_t *pixels, uint32_t stride, uint32_t width, uint32_t height, + int32_t hotspot_x, int32_t hotspot_y); + +void wlr_xwayland_surface_activate(struct wlr_xwayland_surface *surface, + bool activated); + +/** + * Restack surface relative to sibling. + * If sibling is NULL, then the surface is moved to the top or the bottom + * of the stack (depending on the mode). + */ +void wlr_xwayland_surface_restack(struct wlr_xwayland_surface *surface, + struct wlr_xwayland_surface *sibling, enum xcb_stack_mode_t mode); + +void wlr_xwayland_surface_configure(struct wlr_xwayland_surface *surface, + int16_t x, int16_t y, uint16_t width, uint16_t height); + +void wlr_xwayland_surface_close(struct wlr_xwayland_surface *surface); + +void wlr_xwayland_surface_set_withdrawn(struct wlr_xwayland_surface *surface, + bool withdrawn); + +void wlr_xwayland_surface_set_minimized(struct wlr_xwayland_surface *surface, + bool minimized); + +void wlr_xwayland_surface_set_maximized(struct wlr_xwayland_surface *surface, + bool maximized); + +void wlr_xwayland_surface_set_fullscreen(struct wlr_xwayland_surface *surface, + bool fullscreen); + +void wlr_xwayland_set_seat(struct wlr_xwayland *xwayland, + struct wlr_seat *seat); + +/** + * Get a struct wlr_xwayland_surface from a struct wlr_surface. + * + * If the surface hasn't been created by Xwayland or has no X11 window + * associated, NULL is returned. + */ +struct wlr_xwayland_surface *wlr_xwayland_surface_try_from_wlr_surface( + struct wlr_surface *surface); + +void wlr_xwayland_surface_ping(struct wlr_xwayland_surface *surface); + +/** Metric to guess if an OR window should "receive" focus + * + * In the pure X setups, window managers usually straight up ignore override + * redirect windows, and never touch them. (we have to handle them for mapping) + * + * When such a window wants to receive keyboard input (e.g. rofi/dzen) it will + * use mechanics we don't support (sniffing/grabbing input). + * [Sadly this is unrelated to xwayland-keyboard-grab] + * + * To still support these windows, while keeping general OR semantics as is, we + * need to hand a subset of windows focus. + * The dirty truth is, we need to hand focus to any Xwayland window, though + * pretending this window has focus makes it easier to handle unmap. + * + * This function provides a handy metric based on the window type to guess if + * the OR window wants focus. + * It's probably not perfect, nor exactly intended but works in practice. + * + * Returns: true if the window should receive focus + * false if it should be ignored + */ +bool wlr_xwayland_or_surface_wants_focus( + const struct wlr_xwayland_surface *xsurface); + +enum wlr_xwayland_icccm_input_model wlr_xwayland_icccm_input_model( + const struct wlr_xwayland_surface *xsurface); + +/** + * Sets the _NET_WORKAREA root window property. The compositor should set + * one workarea per virtual desktop. This indicates the usable geometry + * (relative to the virtual desktop viewport) that is not covered by + * panels, docks, etc. Unfortunately, it is not possible to specify + * per-output workareas. + */ +void wlr_xwayland_set_workareas(struct wlr_xwayland *wlr_xwayland, + const struct wlr_box *workareas, size_t num_workareas); + +#endif diff --git a/debian/swayfx/usr/lib/x86_64-linux-gnu/libscenefx.so b/debian/swayfx/usr/lib/x86_64-linux-gnu/libscenefx.so new file mode 120000 index 00000000..b588d427 --- /dev/null +++ b/debian/swayfx/usr/lib/x86_64-linux-gnu/libscenefx.so @@ -0,0 +1 @@ +libscenefx.so.1 \ No newline at end of file diff --git a/debian/swayfx/usr/lib/x86_64-linux-gnu/libscenefx.so.1 b/debian/swayfx/usr/lib/x86_64-linux-gnu/libscenefx.so.1 new file mode 100644 index 00000000..5858ff01 Binary files /dev/null and b/debian/swayfx/usr/lib/x86_64-linux-gnu/libscenefx.so.1 differ diff --git a/debian/swayfx/usr/lib/x86_64-linux-gnu/pkgconfig/scenefx.pc b/debian/swayfx/usr/lib/x86_64-linux-gnu/pkgconfig/scenefx.pc new file mode 100644 index 00000000..f9419bd2 --- /dev/null +++ b/debian/swayfx/usr/lib/x86_64-linux-gnu/pkgconfig/scenefx.pc @@ -0,0 +1,11 @@ +prefix=/usr +includedir=${prefix}/include +libdir=${prefix}/lib/x86_64-linux-gnu + +Name: scenefx +Description: Wlroots effects library +Version: 0.1 +Requires.private: wlroots, wayland-server >= 1.22, libdrm >= 2.4.114, xkbcommon, pixman-1 >= 0.42.0, egl, gbm, glesv2, libudev, libseat >= 0.2.0, libinput >= 1.14.0, xcb, xcb-dri3, xcb-present, xcb-render, xcb-renderutil, xcb-shm, xcb-xfixes, xcb-xinput, wayland-client +Libs: -L${libdir} -lscenefx +Libs.private: -lm -lrt +Cflags: -I${includedir} diff --git a/debian/swayfx/usr/lib/x86_64-linux-gnu/pkgconfig/wlroots.pc b/debian/swayfx/usr/lib/x86_64-linux-gnu/pkgconfig/wlroots.pc new file mode 100644 index 00000000..c39aaa59 --- /dev/null +++ b/debian/swayfx/usr/lib/x86_64-linux-gnu/pkgconfig/wlroots.pc @@ -0,0 +1,20 @@ +prefix=/usr +includedir=${prefix}/include +libdir=${prefix}/lib/x86_64-linux-gnu + +have_drm_backend=false +have_x11_backend=true +have_libinput_backend=true +have_xwayland=false +have_gles2_renderer=true +have_vulkan_renderer=false +have_gbm_allocator=true +have_session=true + +Name: wlroots +Description: Wayland compositor library +URL: https://gitlab.freedesktop.org/wlroots/wlroots +Version: 0.17.3 +Requires: wayland-server >= 1.22, libdrm >= 2.4.114, xkbcommon, pixman-1 >= 0.42.0, egl, gbm, glesv2, libudev, libseat >= 0.2.0, libinput >= 1.14.0, xcb, xcb-dri3, xcb-present, xcb-render, xcb-renderutil, xcb-shm, xcb-xfixes, xcb-xinput, wayland-client +Libs: -L${libdir} -lwlroots -lm -lrt +Cflags: -I${includedir} diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640.png new file mode 100644 index 00000000..fdab9971 Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640_Portrait.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640_Portrait.png new file mode 100644 index 00000000..669e76fd Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1136x640_Portrait.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1366x768.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1366x768.png new file mode 100644 index 00000000..9128406f Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1366x768.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png new file mode 100644 index 00000000..034f0040 Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536.png new file mode 100644 index 00000000..bcb36c0d Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536_Portrait.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536_Portrait.png new file mode 100644 index 00000000..087d5d72 Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_2048x1536_Portrait.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024.png new file mode 100644 index 00000000..cc05bb9e Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024.png differ diff --git a/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024_Portrait.png b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024_Portrait.png new file mode 100644 index 00000000..6af90536 Binary files /dev/null and b/debian/swayfx/usr/share/backgrounds/sway/Sway_Wallpaper_Blue_768x1024_Portrait.png differ diff --git a/debian/swayfx/usr/share/bash-completion/completions/sway b/debian/swayfx/usr/share/bash-completion/completions/sway new file mode 100644 index 00000000..01b20073 --- /dev/null +++ b/debian/swayfx/usr/share/bash-completion/completions/sway @@ -0,0 +1,46 @@ +# sway(1) completion + +_sway() +{ + local cur prev short long + _get_comp_words_by_ref cur prev + + short=( + -h + -c + -C + -d + -v + -V + ) + + long=( + --help + --config + --validate + --debug + --version + --verbose + --get-socketpath + ) + + case $prev in + -c|--config) + _filedir + return + ;; + esac + + if [[ $cur == --* ]]; then + COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) + elif [[ $cur == -* ]]; then + COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) + COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) + else + COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) + COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) + COMPREPLY+=($(compgen -c -- "$cur")) + fi + +} && +complete -F _sway sway diff --git a/debian/swayfx/usr/share/bash-completion/completions/swaybar b/debian/swayfx/usr/share/bash-completion/completions/swaybar new file mode 100644 index 00000000..3709d4f9 --- /dev/null +++ b/debian/swayfx/usr/share/bash-completion/completions/swaybar @@ -0,0 +1,44 @@ +# swaybar(1) completion + +_swaybar() +{ + local cur prev short long + _get_comp_words_by_ref cur prev + + short=( + -h + -v + -s + -b + -d + ) + + long=( + --help + --version + --socket + --bar_id + --debug + ) + + case $prev in + -s|--socket) + _filedir + return + ;; + -b|--bar_id) + bars=($(swaymsg -t get_bar_config | jq -r '.[]')) + COMPREPLY=($(compgen -W "${bars[*]}" -- "$cur")) + return + ;; + esac + + if [[ $cur == --* ]]; then + COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) + else + COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) + COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) + fi + +} && +complete -F _swaybar swaybar diff --git a/debian/swayfx/usr/share/bash-completion/completions/swaymsg b/debian/swayfx/usr/share/bash-completion/completions/swaymsg new file mode 100644 index 00000000..30457751 --- /dev/null +++ b/debian/swayfx/usr/share/bash-completion/completions/swaymsg @@ -0,0 +1,65 @@ +# swaymsg(1) completion + +_swaymsg() +{ + local cur prev types short long + _get_comp_words_by_ref cur prev + + types=( + 'get_workspaces' + 'get_seats' + 'get_inputs' + 'get_outputs' + 'get_tree' + 'get_marks' + 'get_bar_config' + 'get_version' + 'get_binding_modes' + 'get_binding_state' + 'get_config' + 'send_tick' + 'subscribe' + ) + + short=( + -h + -m + -p + -q + -r + -s + -t + -v + ) + + long=( + --help + --monitor + --pretty + --quiet + --raw + --socket + --type + --version + ) + + case $prev in + -s|--socket) + _filedir + return + ;; + -t|--type) + COMPREPLY=($(compgen -W "${types[*]}" -- "$cur")) + return + ;; + esac + + if [[ $cur == --* ]]; then + COMPREPLY=($(compgen -W "${long[*]}" -- "$cur")) + else + COMPREPLY=($(compgen -W "${short[*]}" -- "$cur")) + COMPREPLY+=($(compgen -W "${long[*]}" -- "$cur")) + fi + +} && +complete -F _swaymsg swaymsg diff --git a/debian/swayfx/usr/share/doc/swayfx/README.Debian b/debian/swayfx/usr/share/doc/swayfx/README.Debian new file mode 100644 index 00000000..cae73224 --- /dev/null +++ b/debian/swayfx/usr/share/doc/swayfx/README.Debian @@ -0,0 +1,6 @@ +swayfx for Debian +---------------- + + + + -- Penelope Gwen Mon, 22 Apr 2024 19:41:11 -0600 diff --git a/debian/swayfx/usr/share/doc/swayfx/changelog.Debian.gz b/debian/swayfx/usr/share/doc/swayfx/changelog.Debian.gz new file mode 100644 index 00000000..1554e591 Binary files /dev/null and b/debian/swayfx/usr/share/doc/swayfx/changelog.Debian.gz differ diff --git a/debian/swayfx/usr/share/doc/swayfx/copyright b/debian/swayfx/usr/share/doc/swayfx/copyright new file mode 100644 index 00000000..961670f2 --- /dev/null +++ b/debian/swayfx/usr/share/doc/swayfx/copyright @@ -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 +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 + © 2018-2024 Birger Schacht +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. diff --git a/debian/swayfx/usr/share/fish/vendor_completions.d/sway.fish b/debian/swayfx/usr/share/fish/vendor_completions.d/sway.fish new file mode 100644 index 00000000..444fd273 --- /dev/null +++ b/debian/swayfx/usr/share/fish/vendor_completions.d/sway.fish @@ -0,0 +1,11 @@ +# sway(1) completion + +complete -f -c sway +complete -c sway -s h -l help --description "Show help message and quit." +complete -c sway -s c -l config --description "Specifies a config file." -r +complete -c sway -s C -l validate --description "Check the validity of the config file, then exit." +complete -c sway -s d -l debug --description "Enables full logging, including debug information." +complete -c sway -s v -l version --description "Show the version number and quit." +complete -c sway -s V -l verbose --description "Enables more verbose logging." +complete -c sway -l get-socketpath --description "Gets the IPC socket path and prints it, then exits." + diff --git a/debian/swayfx/usr/share/fish/vendor_completions.d/swaymsg.fish b/debian/swayfx/usr/share/fish/vendor_completions.d/swaymsg.fish new file mode 100644 index 00000000..5ee7dcc0 --- /dev/null +++ b/debian/swayfx/usr/share/fish/vendor_completions.d/swaymsg.fish @@ -0,0 +1,25 @@ +# swaymsg(1) completion + +complete -f -c swaymsg +complete -c swaymsg -s h -l help --description "Show help message and quit." +complete -c swaymsg -s m -l monitor --description "Monitor subscribed events until killed." +complete -c swaymsg -s p -l pretty --description "Use pretty output even when not using a tty." +complete -c swaymsg -s q -l quiet --description "Sends the IPC message but does not print the response from sway." +complete -c swaymsg -s r -l raw --description "Use raw output even if using tty." +complete -c swaymsg -s s -l socket -r --description "Use the specified socket path. Otherwise, swaymsg will ask where the socket is (which is the value of $SWAYSOCK, then of $I3SOCK)." +complete -c swaymsg -s v -l version --description "Print the version (of swaymsg) and quit." + +complete -c swaymsg -s t -l type -fr --description "Specify the type of IPC message." +complete -c swaymsg -s t -l type -fra 'get_workspaces' --description "Gets a JSON-encoded list of workspaces and their status." +complete -c swaymsg -s t -l type -fra 'get_inputs' --description "Gets a JSON-encoded list of current inputs." +complete -c swaymsg -s t -l type -fra 'get_outputs' --description "Gets a JSON-encoded list of current outputs." +complete -c swaymsg -s t -l type -fra 'get_tree' --description "Gets a JSON-encoded layout tree of all open windows, containers, outputs, workspaces, and so on." +complete -c swaymsg -s t -l type -fra 'get_marks' --description "Get a JSON-encoded list of marks." +complete -c swaymsg -s t -l type -fra 'get_bar_config' --description "Get a JSON-encoded configuration for swaybar." +complete -c swaymsg -s t -l type -fra 'get_version' --description "Get JSON-encoded version information for the running instance of sway." +complete -c swaymsg -s t -l type -fra 'get_binding_modes' --description "Gets a JSON-encoded list of currently configured binding modes." +complete -c swaymsg -s t -l type -fra 'get_binding_state' --description "Get JSON-encoded info about the current binding state." +complete -c swaymsg -s t -l type -fra 'get_config' --description "Gets a JSON-encoded copy of the current configuration." +complete -c swaymsg -s t -l type -fra 'get_seats' --description "Gets a JSON-encoded list of all seats, its properties and all assigned devices." +complete -c swaymsg -s t -l type -fra 'send_tick' --description "Sends a tick event to all subscribed clients." +complete -c swaymsg -s t -l type -fra 'subscribe' --description "Subscribe to a list of event types." diff --git a/debian/swayfx/usr/share/fish/vendor_completions.d/swaynag.fish b/debian/swayfx/usr/share/fish/vendor_completions.d/swaynag.fish new file mode 100644 index 00000000..7015d5e3 --- /dev/null +++ b/debian/swayfx/usr/share/fish/vendor_completions.d/swaynag.fish @@ -0,0 +1,30 @@ +# swaynag +complete -f -c swaynag +complete -c swaynag -s C -l config -r --description 'The config file to use. Default: $HOME/.swaynag/config, $XDG_CONFIG_HOME/swaynag/config, and SYSCONFDIR/swaynag/config.' +complete -c swaynag -s d -l debug --description 'Enable debugging.' +complete -c swaynag -s e -l edge -fr --description 'Set the edge to use: top or bottom' +complete -c swaynag -s f -l font -r --description 'Set the font to use.' +complete -c swaynag -s h -l help --description 'Show help message and quit.' +complete -c swaynag -s b -l button -fr --description 'Create a button with a text and an action which is executed when pressed. Multiple buttons can be defined by providing the flag multiple times.' +complete -c swaynag -s l -l detailed-message --description 'Read a detailed message from stdin. A button to toggle details will be added. Details are shown in a scrollable multi-line text area.' +complete -c swaynag -s L -l detailed-button -fr --description 'Set the text for the button that toggles details. This has no effect if there is not a detailed message. The default is "Toggle details".' +complete -c swaynag -s m -l message -fr --description 'Set the message text.' +complete -c swaynag -s o -l output -fr --description 'Set the output to use.' +complete -c swaynag -s s -l dismiss-button -fr --description 'Sets the text for the dismiss nagbar button. The default is "X".' +complete -c swaynag -s t -l type -fr --description 'Set the message type. Two types are created by default "error" and "warning". Custom types can be defined in the config file.' +complete -c swaynag -s v -l version --description 'Show the version number and quit.' + +# Appearance +complete -c swaynag -l background -fr --description 'Set the color of the background.' +complete -c swaynag -l border -fr --description 'Set the color of the border.' +complete -c swaynag -l border-bottom -fr --description 'Set the color of the bottom border.' +complete -c swaynag -l button-background -fr --description 'Set the color for the background for buttons.' +complete -c swaynag -l text -fr --description 'Set the text color.' +complete -c swaynag -l border-bottom-size -fr --description 'Set the thickness of the bottom border.' +complete -c swaynag -l message-padding -fr --description 'Set the padding for the message.' +complete -c swaynag -l details-border-size -fr --description 'Set the thickness for the details border.' +complete -c swaynag -l button-border-size -fr --description 'Set the thickness for the button border.' +complete -c swaynag -l button-gap -fr --description 'Set the size of the gap between buttons.' +complete -c swaynag -l button-dismiss-gap -fr --description 'Set the size of the gap between the dismiss button and another button.' +complete -c swaynag -l button-margin-right -fr --description 'Set the margin from the right of the dismiss button to edge.' +complete -c swaynag -l button-padding -fr --description 'Set the padding for the button text.' diff --git a/debian/swayfx/usr/share/man/man1/sway.1.gz b/debian/swayfx/usr/share/man/man1/sway.1.gz new file mode 100644 index 00000000..8c7119bf Binary files /dev/null and b/debian/swayfx/usr/share/man/man1/sway.1.gz differ diff --git a/debian/swayfx/usr/share/man/man1/swaymsg.1.gz b/debian/swayfx/usr/share/man/man1/swaymsg.1.gz new file mode 100644 index 00000000..eab4a1b0 Binary files /dev/null and b/debian/swayfx/usr/share/man/man1/swaymsg.1.gz differ diff --git a/debian/swayfx/usr/share/man/man1/swaynag.1.gz b/debian/swayfx/usr/share/man/man1/swaynag.1.gz new file mode 100644 index 00000000..6a42e4e6 Binary files /dev/null and b/debian/swayfx/usr/share/man/man1/swaynag.1.gz differ diff --git a/debian/swayfx/usr/share/man/man5/sway-bar.5.gz b/debian/swayfx/usr/share/man/man5/sway-bar.5.gz new file mode 100644 index 00000000..395f954f Binary files /dev/null and b/debian/swayfx/usr/share/man/man5/sway-bar.5.gz differ diff --git a/debian/swayfx/usr/share/man/man5/sway-input.5.gz b/debian/swayfx/usr/share/man/man5/sway-input.5.gz new file mode 100644 index 00000000..1175ab9c Binary files /dev/null and b/debian/swayfx/usr/share/man/man5/sway-input.5.gz differ diff --git a/debian/swayfx/usr/share/man/man5/sway-output.5.gz b/debian/swayfx/usr/share/man/man5/sway-output.5.gz new file mode 100644 index 00000000..f2ab229a Binary files /dev/null and b/debian/swayfx/usr/share/man/man5/sway-output.5.gz differ diff --git a/debian/swayfx/usr/share/man/man5/sway.5.gz b/debian/swayfx/usr/share/man/man5/sway.5.gz new file mode 100644 index 00000000..c17988d0 Binary files /dev/null and b/debian/swayfx/usr/share/man/man5/sway.5.gz differ diff --git a/debian/swayfx/usr/share/man/man5/swaynag.5.gz b/debian/swayfx/usr/share/man/man5/swaynag.5.gz new file mode 100644 index 00000000..161cea4d Binary files /dev/null and b/debian/swayfx/usr/share/man/man5/swaynag.5.gz differ diff --git a/debian/swayfx/usr/share/man/man7/sway-ipc.7.gz b/debian/swayfx/usr/share/man/man7/sway-ipc.7.gz new file mode 100644 index 00000000..60b59c0e Binary files /dev/null and b/debian/swayfx/usr/share/man/man7/sway-ipc.7.gz differ diff --git a/debian/swayfx/usr/share/man/man7/swaybar-protocol.7.gz b/debian/swayfx/usr/share/man/man7/swaybar-protocol.7.gz new file mode 100644 index 00000000..f3924d99 Binary files /dev/null and b/debian/swayfx/usr/share/man/man7/swaybar-protocol.7.gz differ diff --git a/debian/swayfx/usr/share/wayland-sessions/sway.desktop b/debian/swayfx/usr/share/wayland-sessions/sway.desktop new file mode 100644 index 00000000..9f33bcff --- /dev/null +++ b/debian/swayfx/usr/share/wayland-sessions/sway.desktop @@ -0,0 +1,5 @@ +[Desktop Entry] +Name=SwayFX +Comment=An i3-compatible Wayland compositor +Exec=sway +Type=Application diff --git a/debian/swayfx/usr/share/zsh/site-functions/_sway b/debian/swayfx/usr/share/zsh/site-functions/_sway new file mode 100644 index 00000000..a7f55cc5 --- /dev/null +++ b/debian/swayfx/usr/share/zsh/site-functions/_sway @@ -0,0 +1,22 @@ +#compdef sway +#------------ +# Description +# ----------- +# +# Completion script for the sway window manager (http://swaywm.org) +# +# --------------------------------------------- +# Author +# ------- +# +# * Seth Barberee +# +# ------------------------------- +_arguments -s \ + '(-v --version)'{-v,--version}'[Show the version number and quit]' \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ + '(-c --config)'{-c,--config}'[Specify a config file]:files:_files' \ + '(-C --validate)'{-C,--validate}'[Check validity of the config file, then exit]' \ + '(-d --debug)'{-d,--debug}'[Enables full logging, including debug information]' \ + '(-V --verbose)'{-V,--verbose}'[Enables more verbose logging]' \ + '(--get-socketpath)'--get-socketpath'[Gets the IPC socket path and prints it, then exits]' diff --git a/debian/swayfx/usr/share/zsh/site-functions/_swaymsg b/debian/swayfx/usr/share/zsh/site-functions/_swaymsg new file mode 100644 index 00000000..106f3d9d --- /dev/null +++ b/debian/swayfx/usr/share/zsh/site-functions/_swaymsg @@ -0,0 +1,40 @@ +#compdef swaymsg +#----------------- +# Description +# ----------- +# +# Completion script for swaymsg in sway wm (http://swaywm.org) +# +# ------------------------------------------------------ +# Author +# -------- +# +# * Seth Barberee +# +# ------------------------------------------- + +types=( +'get_workspaces' +'get_seats' +'get_inputs' +'get_outputs' +'get_tree' +'get_marks' +'get_bar_config' +'get_version' +'get_binding_modes' +'get_binding_state' +'get_config' +'send_tick' +'subscribe' +) + +_arguments -s \ + '(-h --help)'{-h,--help}'[Show help message and quit]' \ + '(-m --monitor)'{-m,--monitor}'[Monitor until killed (-t SUBSCRIBE only)]' \ + '(-p --pretty)'{-p,--pretty}'[Use pretty output even when not using a tty]' \ + '(-q --quiet)'{-q,--quiet}'[Be quiet]' \ + '(-r --raw)'{-r,--raw}'[Use raw output even if using a tty]' \ + '(-s --socket)'{-s,--socket}'[Use the specified socket path]:files:_files' \ + '(-t --type)'{-t,--type}'[Specify the message type]:type:{_describe "type" types}' \ + '(-v --version)'{-v,--version}'[Show the version number and quit]' diff --git a/debian/upstream/metadata.ex b/debian/upstream/metadata.ex new file mode 100644 index 00000000..b6a4a668 --- /dev/null +++ b/debian/upstream/metadata.ex @@ -0,0 +1,10 @@ +# Example file for upstream/metadata. +# See https://wiki.debian.org/UpstreamMetadata for more info/fields. +# Below an example based on a github project. + +# Bug-Database: https://github.com//swayfx/issues +# Bug-Submit: https://github.com//swayfx/issues/new +# Changelog: https://github.com//swayfx/blob/master/CHANGES +# Documentation: https://github.com//swayfx/wiki +# Repository-Browse: https://github.com//swayfx +# Repository: https://github.com//swayfx.git diff --git a/debian/watch b/debian/watch new file mode 100644 index 00000000..609a1639 --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=4 +opts="mode=git,pgpmode=gittag,uversionmangle=s/(\d)[_\.\-\+]?((rc|beta|alpha)[\d.]*)$/$1~$2/," \ + https://github.com/swaywm/sway refs/tags/v?(\d\S+)