mirror of
https://github.com/swaywm/sway.git
synced 2025-04-06 04:17:45 +03:00
Compare commits
308 commits
Author | SHA1 | Date | |
---|---|---|---|
|
a25645a5a6 | ||
|
ab455bbada | ||
|
c2d6aff64c | ||
|
4b185a0fe0 | ||
|
d148560f50 | ||
|
30434b2beb | ||
|
3a49409dae | ||
|
2f5b3c0999 | ||
|
61cc08cf3c | ||
|
8238e5242b | ||
|
5d7b9a8320 | ||
|
9dcccf784b | ||
|
048e304b8a | ||
|
e3d9cc2aa5 | ||
|
962e1e70a6 | ||
|
8a60f30423 | ||
|
7fab75a7a6 | ||
|
0da0d37f3d | ||
|
38005bd854 | ||
|
10e50e6bf9 | ||
|
c1031d8465 | ||
|
4852087e61 | ||
|
851b8c6fb6 | ||
|
d093c2e358 | ||
|
3ff60987f3 | ||
|
8acb0482da | ||
|
30c858423d | ||
|
0b08dce08c | ||
|
f177d05441 | ||
|
3ab1f0ca3d | ||
|
60f06fc4f1 | ||
|
cff16d32f9 | ||
|
e3f0ba4cd9 | ||
|
3629a832e5 | ||
|
a6c0441ee0 | ||
|
c7c0a5a1b3 | ||
|
a1838c5522 | ||
|
0c60d1581f | ||
|
c55dff95bc | ||
|
801bc76ce3 | ||
|
f293418d9d | ||
|
4eb86fce07 | ||
|
1d783794b5 | ||
|
4faf0f9098 | ||
|
bbadf9b8b1 | ||
|
e2409aa496 | ||
|
5312376077 | ||
|
fec3da7d58 | ||
|
a2c73c9b8b | ||
|
6111297d91 | ||
|
96db66abf0 | ||
|
fdc4318ac6 | ||
|
463c4c9369 | ||
|
f23d100747 | ||
|
03483ff370 | ||
|
62fd8c4d01 | ||
|
78fa4e9856 | ||
|
4cfcb3643b | ||
|
d417a8fcd0 | ||
|
f38719f575 | ||
|
1e53007bc3 | ||
|
e7c972b04a | ||
|
839434abc0 | ||
|
015e357fce | ||
|
a63027245a | ||
|
17ecb9eb1d | ||
|
af0d4a048a | ||
|
7e0c0dda42 | ||
|
7d93652105 | ||
|
35d8adefc4 | ||
|
8363699f14 | ||
|
ce6b2db0f2 | ||
|
db76fefd0c | ||
|
dd063a0ef7 | ||
|
17e2e52c6d | ||
|
7f1cd0b73b | ||
|
f855b0898b | ||
|
c90cb37b2a | ||
|
9a9be01ad4 | ||
|
a2757e5f16 | ||
|
a0b3606f17 | ||
|
00e9a94152 | ||
|
63345977e2 | ||
|
cdff4f7c74 | ||
|
b73f54a966 | ||
|
b6da218974 | ||
|
861dde100a | ||
|
e9dd218231 | ||
|
74e507962e | ||
|
023f6b0a50 | ||
|
1537c9dae5 | ||
|
48069097ea | ||
|
266cd4515a | ||
|
e940acd374 | ||
|
9765c29be1 | ||
|
034d02f8a5 | ||
|
785a459a55 | ||
|
f957c7e658 | ||
|
d7a76d381b | ||
|
29b3f00e6f | ||
|
0496477f92 | ||
|
a0c0349934 | ||
|
fb5eadc363 | ||
|
c5ba7f23a5 | ||
|
f4a6b0395f | ||
|
14bff7b451 | ||
|
4f9ce4675c | ||
|
fc6b8d6af2 | ||
|
4fe054c6db | ||
|
cfb292cca7 | ||
|
af28ac04a4 | ||
|
6045ad9a02 | ||
|
b83e5aaa54 | ||
|
be840f730e | ||
|
980a4e0211 | ||
|
f2b2a81149 | ||
|
77b9ddabe2 | ||
|
f00f964abf | ||
|
7288f77bbe | ||
|
f9c0f043e5 | ||
|
ae7c1b139a | ||
|
c30c451907 | ||
|
c3279944fb | ||
|
5a3621460f | ||
|
6576b99c24 | ||
|
b44015578a | ||
|
9ba1beee58 | ||
|
f344e9d5a5 | ||
|
951a22c244 | ||
|
32e5e5232d | ||
|
3e956b9229 | ||
|
05e895c463 | ||
|
9a1c411abd | ||
|
b881c2e84c | ||
|
6e4ccb99c3 | ||
|
9bb45a4037 | ||
|
7e74a49142 | ||
|
4d4c88f0a7 | ||
|
3f327b3db0 | ||
|
a3a9ec1211 | ||
|
50073dc579 | ||
|
fc2796aee8 | ||
|
274a5fcb73 | ||
|
8c5b23e592 | ||
|
28fd73589d | ||
|
3d00552035 | ||
|
5be5a50051 | ||
|
818ea17389 | ||
|
d8c4a2d5fe | ||
|
fdcfe00781 | ||
|
5233a0bd2e | ||
|
a0a078f75e | ||
|
b04f4136bc | ||
|
e32bdaa7be | ||
|
4c3c060211 | ||
|
0386b2afcb | ||
|
dfbcd1fbaa | ||
|
4e38f93f36 | ||
|
1e0031781f | ||
|
5d237679f5 | ||
|
cdde0165da | ||
|
8f6bc5bb36 | ||
|
74cc02d60f | ||
|
fce8de0f67 | ||
|
5f15c5e91d | ||
|
cc34210769 | ||
|
40ca4150b2 | ||
|
2e9139df66 | ||
|
d0bd591ee7 | ||
|
df69367d92 | ||
|
700f4805bc | ||
|
a168b20299 | ||
|
9704152414 | ||
|
fd3b643d15 | ||
|
796898519b | ||
|
dcdb72757a | ||
|
30f5c3a911 | ||
|
b463957021 | ||
|
2686afb95c | ||
|
4c28916d68 | ||
|
ee5c4f38c9 | ||
|
646019cad9 | ||
|
ffcde7a70c | ||
|
087226d997 | ||
|
f11c5d562e | ||
|
1267e47de9 | ||
|
bc258a3be2 | ||
|
dcb142bf5e | ||
|
9e14651077 | ||
|
a4ef37752f | ||
|
26a9a6b479 | ||
|
c3fca26d30 | ||
|
9becff0ba5 | ||
|
56e97b7d60 | ||
|
3b419020a3 | ||
|
98be797356 | ||
|
923f642b70 | ||
|
3e03eb3a01 | ||
|
e2f3ebad8c | ||
|
125c74338a | ||
|
5a7477cb8f | ||
|
dc9f217307 | ||
|
9139da6149 | ||
|
3bc75221bc | ||
|
2b08e79061 | ||
|
2e951163c5 | ||
|
23389ebd1f | ||
|
3ef5abd405 | ||
|
4e6d7612ff | ||
|
f2a0e81b24 | ||
|
59f6292383 | ||
|
fd9ab9ee06 | ||
|
5e18ed3cf0 | ||
|
2058209a13 | ||
|
0b84d82b9a | ||
|
2867ef646b | ||
|
fca8474e9b | ||
|
469411d484 | ||
|
829c75b9c9 | ||
|
fc640d5f6c | ||
|
07b0598526 | ||
|
d6150b6bb0 | ||
|
7c11c463a3 | ||
|
d19810eba8 | ||
|
f6d22f8e68 | ||
|
541e6e260c | ||
|
ca40663d42 | ||
|
7a2ff7ba81 | ||
|
09c360d503 | ||
|
1846944f04 | ||
|
1dc661af17 | ||
|
1b5515400d | ||
|
88b2abf5f2 | ||
|
93d391651c | ||
|
f7a0f06dff | ||
|
ecfef1348a | ||
|
6b2aa83246 | ||
|
88e99fa84f | ||
|
ba427a469a | ||
|
c8676fad54 | ||
|
e39b0b816b | ||
|
f202bc84d2 | ||
|
a4e85332a1 | ||
|
e8c421e917 | ||
|
2c2625acd3 | ||
|
08a06a7b6b | ||
|
ae33f4eb37 | ||
|
5fc85c5066 | ||
|
7c635b61fe | ||
|
bab6b79af2 | ||
|
9da295c11f | ||
|
09e11dabb2 | ||
|
2e53de80bb | ||
|
5f0801b6f2 | ||
|
1e018e72b4 | ||
|
06ad734e70 | ||
|
ed2724bd6c | ||
|
6e5fc4c2aa | ||
|
b38ed8b479 | ||
|
08c484f46f | ||
|
6d7b1321db | ||
|
188811f808 | ||
|
5b8b505af5 | ||
|
946fc80945 | ||
|
869baff252 | ||
|
bac3ab5526 | ||
|
9a57966606 | ||
|
0639bde9fb | ||
|
c640c3015f | ||
|
9c17cba0b2 | ||
|
0e1a02bf0a | ||
|
1b09238645 | ||
|
1eb16d1367 | ||
|
dbd2fbf430 | ||
|
b4d7e84d38 | ||
|
2c69e19fd3 | ||
|
8d1b0cecd9 | ||
|
904d256581 | ||
|
c5fd8c050f | ||
|
7e69a7076f | ||
|
fa294a9094 | ||
|
95265fba59 | ||
|
0aceff7469 | ||
|
64d644f0da | ||
|
22d0dd8bde | ||
|
bbabb9aae8 | ||
|
c6edbb7e5a | ||
|
e8a0205607 | ||
|
607b8aed0c | ||
|
7ad8c80bfe | ||
|
dbd70faf2e | ||
|
a6ef12d968 | ||
|
ff07eab85b | ||
|
b81c4da494 | ||
|
255ff665c5 | ||
|
bf2b79b284 | ||
|
ae3acf26f8 | ||
|
f12023b1a2 | ||
|
2cd73a33c2 | ||
|
bc7d15d64d | ||
|
e633fe0b40 | ||
|
439122e887 | ||
|
39b9c0d6ba | ||
|
47e6a1164c | ||
|
128b6253a9 | ||
|
fd6d6f1d97 | ||
|
a946b1aecf | ||
|
4ad15a4015 |
191 changed files with 6038 additions and 6273 deletions
|
@ -4,6 +4,7 @@ packages:
|
||||||
- eudev-dev
|
- eudev-dev
|
||||||
- gdk-pixbuf-dev
|
- gdk-pixbuf-dev
|
||||||
- json-c-dev
|
- json-c-dev
|
||||||
|
- lcms2-dev
|
||||||
- libdisplay-info-dev
|
- libdisplay-info-dev
|
||||||
- libevdev-dev
|
- libevdev-dev
|
||||||
- libinput-dev
|
- libinput-dev
|
||||||
|
@ -24,7 +25,7 @@ packages:
|
||||||
- hwdata-dev
|
- hwdata-dev
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.17
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
@ -38,9 +39,14 @@ tasks:
|
||||||
cd sway
|
cd sway
|
||||||
ninja -C build
|
ninja -C build
|
||||||
- build-no-xwayland: |
|
- build-no-xwayland: |
|
||||||
cd sway
|
cd wlroots
|
||||||
meson configure build -Dxwayland=disabled
|
meson configure build -Dxwayland=disabled
|
||||||
ninja -C build
|
ninja -C build
|
||||||
|
sudo ninja -C build install
|
||||||
|
|
||||||
|
cd ../sway
|
||||||
|
meson configure build --clearcache
|
||||||
|
ninja -C build
|
||||||
- build-static: |
|
- build-static: |
|
||||||
cd sway
|
cd sway
|
||||||
mkdir subprojects
|
mkdir subprojects
|
||||||
|
|
|
@ -3,6 +3,7 @@ packages:
|
||||||
- cairo
|
- cairo
|
||||||
- gdk-pixbuf2
|
- gdk-pixbuf2
|
||||||
- json-c
|
- json-c
|
||||||
|
- lcms2
|
||||||
- libdisplay-info
|
- libdisplay-info
|
||||||
- libegl
|
- libegl
|
||||||
- libinput
|
- libinput
|
||||||
|
@ -21,7 +22,7 @@ packages:
|
||||||
- hwdata
|
- hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.17
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
tasks:
|
tasks:
|
||||||
- wlroots: |
|
- wlroots: |
|
||||||
cd wlroots
|
cd wlroots
|
||||||
|
|
|
@ -8,6 +8,7 @@ packages:
|
||||||
- devel/pkgconf
|
- devel/pkgconf
|
||||||
- graphics/cairo
|
- graphics/cairo
|
||||||
- graphics/gdk-pixbuf2
|
- graphics/gdk-pixbuf2
|
||||||
|
- graphics/lcms2
|
||||||
- graphics/wayland
|
- graphics/wayland
|
||||||
- graphics/wayland-protocols
|
- graphics/wayland-protocols
|
||||||
- textproc/scdoc
|
- textproc/scdoc
|
||||||
|
@ -26,11 +27,11 @@ packages:
|
||||||
- x11/libX11
|
- x11/libX11
|
||||||
- x11/pixman
|
- x11/pixman
|
||||||
- x11/xcb-util-wm
|
- x11/xcb-util-wm
|
||||||
- x11-servers/xwayland-devel
|
- x11-servers/xwayland
|
||||||
- misc/hwdata
|
- misc/hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git#0.17
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
tasks:
|
tasks:
|
||||||
- setup: |
|
- setup: |
|
||||||
cd sway
|
cd sway
|
||||||
|
|
11
README.cs.md
11
README.cs.md
|
@ -1,7 +1,5 @@
|
||||||
# sway
|
# sway
|
||||||
|
|
||||||
[English][en] - **[Česky][cs]** - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - [Svenska][sv] - [Ελληνικά][gr] - [हिन्दी][hi] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
|
||||||
|
|
||||||
sway je s [i3] kompatibilní [Wayland] kompozitor. Přečtěte si [FAQ]. Připojte se na
|
sway je s [i3] kompatibilní [Wayland] kompozitor. Přečtěte si [FAQ]. Připojte se na
|
||||||
[IRC kanál][IRC channel] \(#sway na irc.libera.chat).
|
[IRC kanál][IRC channel] \(#sway na irc.libera.chat).
|
||||||
|
|
||||||
|
@ -32,10 +30,11 @@ Nainstalujte závislosti:
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
* gdk-pixbuf2 (volitelné: oznamovací oblast)
|
* gdk-pixbuf2 (volitelné: oznamovací oblast)
|
||||||
|
* [swaybg] (volitelné: tapeta)
|
||||||
* [scdoc] (volitelné: manuálové stránky) \*
|
* [scdoc] (volitelné: manuálové stránky) \*
|
||||||
* git (volitelné: informace o verzi) \*
|
* git (volitelné: informace o verzi) \*
|
||||||
|
|
||||||
_\* Závislost pouze pro sestavení_
|
_\* Závislost pouze pro kompilaci_
|
||||||
|
|
||||||
Spusťte tyto příkazy:
|
Spusťte tyto příkazy:
|
||||||
|
|
||||||
|
@ -56,12 +55,13 @@ Spusťte `sway` z TTY. Některé správce zobrazení mohou fungovat, ale nejsou
|
||||||
podporovány sway (je známo, že gdm funguje docela dobře).
|
podporovány sway (je známo, že gdm funguje docela dobře).
|
||||||
|
|
||||||
[en]: https://github.com/swaywm/sway#readme
|
[en]: https://github.com/swaywm/sway#readme
|
||||||
|
[ar]: README.ar.md
|
||||||
[cs]: README.cs.md
|
[cs]: README.cs.md
|
||||||
[de]: README.de.md
|
[de]: README.de.md
|
||||||
[dk]: README.dk.md
|
[dk]: README.dk.md
|
||||||
[es]: README.es.md
|
[es]: README.es.md
|
||||||
[fr]: README.fr.md
|
[fr]: README.fr.md
|
||||||
[sv]: README.sv.md
|
[ge]: README.ge.md
|
||||||
[gr]: README.gr.md
|
[gr]: README.gr.md
|
||||||
[hi]: README.hi.md
|
[hi]: README.hi.md
|
||||||
[hu]: README.hu.md
|
[hu]: README.hu.md
|
||||||
|
@ -70,10 +70,12 @@ podporovány sway (je známo, že gdm funguje docela dobře).
|
||||||
[ja]: README.ja.md
|
[ja]: README.ja.md
|
||||||
[ko]: README.ko.md
|
[ko]: README.ko.md
|
||||||
[nl]: README.nl.md
|
[nl]: README.nl.md
|
||||||
|
[no]: README.no.md
|
||||||
[pl]: README.pl.md
|
[pl]: README.pl.md
|
||||||
[pt]: README.pt.md
|
[pt]: README.pt.md
|
||||||
[ro]: README.ro.md
|
[ro]: README.ro.md
|
||||||
[ru]: README.ru.md
|
[ru]: README.ru.md
|
||||||
|
[sv]: README.sv.md
|
||||||
[tr]: README.tr.md
|
[tr]: README.tr.md
|
||||||
[uk]: README.uk.md
|
[uk]: README.uk.md
|
||||||
[zh-CN]: README.zh-CN.md
|
[zh-CN]: README.zh-CN.md
|
||||||
|
@ -86,4 +88,5 @@ podporovány sway (je známo, že gdm funguje docela dobře).
|
||||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[swaybg]: https://github.com/swaywm/swaybg/
|
||||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||||
|
|
12
README.de.md
12
README.de.md
|
@ -2,13 +2,13 @@
|
||||||
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](https://web.libera.chat/gamja/?channels=#sway) bei (#sway on irc.libera.chat; Englisch).
|
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](https://web.libera.chat/gamja/?channels=#sway) bei (#sway on irc.libera.chat; Englisch).
|
||||||
|
|
||||||
## Signaturen
|
## Signaturen
|
||||||
Jedes Release wird mit dem PGP-Schlüssel [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) signiert und auf GitHub veröffentlicht.
|
Jedes Release wird mit dem PGP-Schlüssel [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) signiert und [auf GitHub](https://github.com/swaywm/sway/releases) veröffentlicht.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
### Mit der Paketverwaltung
|
|
||||||
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Das Paket sollte "sway" heißen. Falls es kein solches Paket gibt, kannst du im [Wiki](https://github.com/swaywm/sway/wiki/Unsupported-packages) (englisch) nach mehr Informationen bezüglich deiner Distribution suchen.
|
|
||||||
|
|
||||||
Falls du sway für deine eigene Distribution als Paket bereitstellen möchtest, solltest du die Entwickler per IRC oder E-Mail (sir@cmpwn.com) kontaktieren.
|
### Über die Paketverwaltung
|
||||||
|
|
||||||
|
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Versuche einfach das Packet "sway" zu installieren.
|
||||||
|
|
||||||
### Quellcode selbst kompilieren
|
### Quellcode selbst kompilieren
|
||||||
|
|
||||||
|
@ -23,8 +23,8 @@ sway benötigt die folgenden Pakete:
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
* gdk-pixbuf2 (Optional, wird für das Benachrichtigungsfeld (System Tray) benötigt)
|
* gdk-pixbuf2 (Optional, wird für das Benachrichtigungsfeld (System Tray) benötigt)
|
||||||
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc)\* (Optional, wird für die Dokumentation (Man Pages) benötigt)
|
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (Optional, wird für die Dokumentation (Man Pages) benötigt)\*
|
||||||
* git\*
|
* git (Optional: Versionsinfo)\*
|
||||||
|
|
||||||
_\*Werden nur während des Kompilierens benötigt_
|
_\*Werden nur während des Kompilierens benötigt_
|
||||||
|
|
||||||
|
|
14
README.hu.md
14
README.hu.md
|
@ -1,10 +1,10 @@
|
||||||
# sway
|
# sway
|
||||||
|
|
||||||
A Sway egy [i3]-kompatibilis [Wayland] kompozitor. Olvasd el a [Gyarkan Ismételt Kérdéseket][FAQ]. Csatlakozz az [IRC csatornához][IRC channel] \(`#sway` az `irc.libera.chat`-en).
|
A Sway egy [i3]-kompatibilis [Wayland]-kompozitor. Olvasd el a [Gyarkan Ismételt Kérdéseket][FAQ]. Csatlakozz az [IRC-csatornához][IRC channel] \(`#sway` az `irc.libera.chat`-en).
|
||||||
|
|
||||||
## Csomag aláírások
|
## Csomagaláírások
|
||||||
|
|
||||||
A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva és [GitHub-on][GitHub releases] publikálva.
|
A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva, és [GitHubon][GitHub releases] publikálva.
|
||||||
|
|
||||||
## Telepítés
|
## Telepítés
|
||||||
|
|
||||||
|
@ -13,12 +13,12 @@ A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva és [GitHub-on][GitHu
|
||||||
A Sway sok disztribúció csomagkezelőjéből elérhető, próbáld meg a "sway"
|
A Sway sok disztribúció csomagkezelőjéből elérhető, próbáld meg a "sway"
|
||||||
csomagot telepíteni az általad használt eszközzel.
|
csomagot telepíteni az általad használt eszközzel.
|
||||||
|
|
||||||
Ha szeretnél csomagot készíteni a saját disztribúciódhoz, ugorj be az IRC
|
Ha szeretnél csomagot készíteni a saját disztribúciódhoz, ugorj be az IRC-
|
||||||
csatornára, vagy küldj levelet a sir@cmpwn.com címre tanácsokért.
|
csatornára, vagy küldj levelet a sir@cmpwn.com címre tanácsokért.
|
||||||
|
|
||||||
### Fordítás forráskódból
|
### Fordítás forráskódból
|
||||||
|
|
||||||
Olvasd el [ezt a wiki oldalt][Development setup], ha szeretnéd tesztelési vagy
|
Olvasd el [ezt a wikioldalt][Development setup], ha szeretnéd tesztelési vagy
|
||||||
fejlesztési célokból lefordítani az aktuális (HEAD) állapotát a `sway`-nek és a
|
fejlesztési célokból lefordítani az aktuális (HEAD) állapotát a `sway`-nek és a
|
||||||
`wlroots`-nak.
|
`wlroots`-nak.
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ Futtasd ezeket a parancsokat:
|
||||||
|
|
||||||
## Konfiguráció
|
## Konfiguráció
|
||||||
|
|
||||||
Ha előzőleg i3-mat használtál, akkor átmásolhatod az i3 beállításaidat a
|
Ha előzőleg i3-at használtál, akkor átmásolhatod az i3-beállításaidat a
|
||||||
`~/.config/sway/config` file-ba és ugyanúgy működni fognak. Egyéb esetben másold
|
`~/.config/sway/config` file-ba és ugyanúgy működni fognak. Egyéb esetben másold
|
||||||
le kiindulási alapnak a mintát, ami általában az `etc/sway/config` elérési
|
le kiindulási alapnak a mintát, ami általában az `etc/sway/config` elérési
|
||||||
útvonalon található.
|
útvonalon található.
|
||||||
|
@ -55,7 +55,7 @@ kapcsolatban.
|
||||||
|
|
||||||
## Futtatás
|
## Futtatás
|
||||||
|
|
||||||
Futtasd a `sway` parancsot egy TTY felületről. Néhány bejelentkezéskezelő
|
Futtasd a `sway` parancsot egy TTY-felületről. Néhány bejelentkezéskezelő
|
||||||
(display manager) működhet, de alapvetően nem támogatottak a sway által. (A
|
(display manager) működhet, de alapvetően nem támogatottak a sway által. (A
|
||||||
gdm-ről ismeretes, hogy egész jól működik.)
|
gdm-ről ismeretes, hogy egész jól működik.)
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
# sway
|
# sway
|
||||||
|
|
||||||
[English][en] - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - **[Svenska][sv]** - [Ελληνικά][gr] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
|
||||||
|
|
||||||
sway är en [i3]-kompatibel [Wayland] compositor. Läs våran [FAQ]-sida. Gå med i vår
|
sway är en [i3]-kompatibel [Wayland] compositor. Läs våran [FAQ]-sida. Gå med i vår
|
||||||
[IRC-kanal] \(#sway på irc.libera.chat).
|
[IRC-kanal] \(#sway på irc.libera.chat).
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "gesture.h"
|
#include "gesture.h"
|
||||||
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200112L
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200112L
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
lib_sway_common = static_library(
|
lib_sway_common = static_library(
|
||||||
'sway-common',
|
'sway-common',
|
||||||
files(
|
files(
|
||||||
'background-image.c',
|
|
||||||
'cairo.c',
|
'cairo.c',
|
||||||
'gesture.c',
|
'gesture.c',
|
||||||
'ipc-client.c',
|
'ipc-client.c',
|
||||||
|
@ -14,7 +13,6 @@ lib_sway_common = static_library(
|
||||||
),
|
),
|
||||||
dependencies: [
|
dependencies: [
|
||||||
cairo,
|
cairo,
|
||||||
gdk_pixbuf,
|
|
||||||
pango,
|
pango,
|
||||||
pangocairo,
|
pangocairo,
|
||||||
wayland_client.partial_dependency(compile_args: true)
|
wayland_client.partial_dependency(compile_args: true)
|
||||||
|
|
|
@ -53,6 +53,8 @@ size_t escape_markup_text(const char *src, char *dest) {
|
||||||
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
|
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
|
||||||
const char *text, double scale, bool markup) {
|
const char *text, double scale, bool markup) {
|
||||||
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
||||||
|
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
|
||||||
|
|
||||||
PangoAttrList *attrs;
|
PangoAttrList *attrs;
|
||||||
if (markup) {
|
if (markup) {
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -104,6 +106,7 @@ void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width,
|
||||||
void get_text_metrics(const PangoFontDescription *description, int *height, int *baseline) {
|
void get_text_metrics(const PangoFontDescription *description, int *height, int *baseline) {
|
||||||
cairo_t *cairo = cairo_create(NULL);
|
cairo_t *cairo = cairo_create(NULL);
|
||||||
PangoContext *pango = pango_cairo_create_context(cairo);
|
PangoContext *pango = pango_cairo_create_context(cairo);
|
||||||
|
pango_context_set_round_glyph_positions(pango, false);
|
||||||
// When passing NULL as a language, pango uses the current locale.
|
// When passing NULL as a language, pango uses the current locale.
|
||||||
PangoFontMetrics *metrics = pango_context_get_metrics(pango, description, NULL);
|
PangoFontMetrics *metrics = pango_context_get_metrics(pango, description, NULL);
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -361,3 +360,7 @@ char *format_str(const char *fmt, ...) {
|
||||||
va_end(args);
|
va_end(args);
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool has_prefix(const char *str, const char *prefix) {
|
||||||
|
return strncmp(str, prefix, strlen(prefix)) == 0;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
17
config.in
17
config.in
|
@ -16,9 +16,7 @@ set $right l
|
||||||
# Your preferred terminal emulator
|
# Your preferred terminal emulator
|
||||||
set $term foot
|
set $term foot
|
||||||
# Your preferred application launcher
|
# Your preferred application launcher
|
||||||
# Note: pass the final command to swaymsg so that the resulting window can be opened
|
set $menu wmenu-run
|
||||||
# on the original workspace that the command was run on.
|
|
||||||
set $menu dmenu_path | wmenu | xargs swaymsg exec --
|
|
||||||
|
|
||||||
### Output configuration
|
### Output configuration
|
||||||
#
|
#
|
||||||
|
@ -195,6 +193,19 @@ mode "resize" {
|
||||||
bindsym Escape mode "default"
|
bindsym Escape mode "default"
|
||||||
}
|
}
|
||||||
bindsym $mod+r mode "resize"
|
bindsym $mod+r mode "resize"
|
||||||
|
#
|
||||||
|
# Utilities:
|
||||||
|
#
|
||||||
|
# Special keys to adjust volume via PulseAudio
|
||||||
|
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
|
||||||
|
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
|
||||||
|
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
|
||||||
|
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
|
||||||
|
# Special keys to adjust brightness via brightnessctl
|
||||||
|
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||||
|
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||||
|
# Special key to take a screenshot with grim
|
||||||
|
bindsym Print exec grim
|
||||||
|
|
||||||
#
|
#
|
||||||
# Status Bar:
|
# Status Bar:
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef _SWAY_BACKGROUND_IMAGE_H
|
|
||||||
#define _SWAY_BACKGROUND_IMAGE_H
|
|
||||||
#include "cairo_util.h"
|
|
||||||
|
|
||||||
enum background_mode {
|
|
||||||
BACKGROUND_MODE_STRETCH,
|
|
||||||
BACKGROUND_MODE_FILL,
|
|
||||||
BACKGROUND_MODE_FIT,
|
|
||||||
BACKGROUND_MODE_CENTER,
|
|
||||||
BACKGROUND_MODE_TILE,
|
|
||||||
BACKGROUND_MODE_SOLID_COLOR,
|
|
||||||
BACKGROUND_MODE_INVALID,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum background_mode parse_background_mode(const char *mode);
|
|
||||||
cairo_surface_t *load_background_image(const char *path);
|
|
||||||
void render_background_image(cairo_t *cairo, cairo_surface_t *image,
|
|
||||||
enum background_mode mode, int buffer_width, int buffer_height);
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -40,4 +40,6 @@ bool expand_path(char **path);
|
||||||
char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0);
|
char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0);
|
||||||
char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
|
char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
|
||||||
|
|
||||||
|
bool has_prefix(const char *str, const char *prefix);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -104,6 +104,7 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
|
||||||
sway_cmd cmd_exec_validate;
|
sway_cmd cmd_exec_validate;
|
||||||
sway_cmd cmd_exec_process;
|
sway_cmd cmd_exec_process;
|
||||||
|
|
||||||
|
sway_cmd cmd_allow_tearing;
|
||||||
sway_cmd cmd_assign;
|
sway_cmd cmd_assign;
|
||||||
sway_cmd cmd_bar;
|
sway_cmd cmd_bar;
|
||||||
sway_cmd cmd_bindcode;
|
sway_cmd cmd_bindcode;
|
||||||
|
@ -249,6 +250,7 @@ sway_cmd input_cmd_seat;
|
||||||
sway_cmd input_cmd_accel_profile;
|
sway_cmd input_cmd_accel_profile;
|
||||||
sway_cmd input_cmd_calibration_matrix;
|
sway_cmd input_cmd_calibration_matrix;
|
||||||
sway_cmd input_cmd_click_method;
|
sway_cmd input_cmd_click_method;
|
||||||
|
sway_cmd input_cmd_clickfinger_button_map;
|
||||||
sway_cmd input_cmd_drag;
|
sway_cmd input_cmd_drag;
|
||||||
sway_cmd input_cmd_drag_lock;
|
sway_cmd input_cmd_drag_lock;
|
||||||
sway_cmd input_cmd_dwt;
|
sway_cmd input_cmd_dwt;
|
||||||
|
@ -282,7 +284,9 @@ sway_cmd input_cmd_xkb_switch_layout;
|
||||||
sway_cmd input_cmd_xkb_variant;
|
sway_cmd input_cmd_xkb_variant;
|
||||||
|
|
||||||
sway_cmd output_cmd_adaptive_sync;
|
sway_cmd output_cmd_adaptive_sync;
|
||||||
|
sway_cmd output_cmd_allow_tearing;
|
||||||
sway_cmd output_cmd_background;
|
sway_cmd output_cmd_background;
|
||||||
|
sway_cmd output_cmd_color_profile;
|
||||||
sway_cmd output_cmd_disable;
|
sway_cmd output_cmd_disable;
|
||||||
sway_cmd output_cmd_dpms;
|
sway_cmd output_cmd_dpms;
|
||||||
sway_cmd output_cmd_enable;
|
sway_cmd output_cmd_enable;
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
#include <wlr/interfaces/wlr_switch.h>
|
#include <wlr/interfaces/wlr_switch.h>
|
||||||
#include <wlr/types/wlr_tablet_tool.h>
|
#include <wlr/types/wlr_tablet_tool.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
|
#include <wlr/render/color.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
|
@ -148,6 +149,7 @@ struct input_config {
|
||||||
int accel_profile;
|
int accel_profile;
|
||||||
struct calibration_matrix calibration_matrix;
|
struct calibration_matrix calibration_matrix;
|
||||||
int click_method;
|
int click_method;
|
||||||
|
int clickfinger_button_map;
|
||||||
int drag;
|
int drag;
|
||||||
int drag_lock;
|
int drag_lock;
|
||||||
int dwt;
|
int dwt;
|
||||||
|
@ -260,6 +262,7 @@ enum scale_filter_mode {
|
||||||
|
|
||||||
enum render_bit_depth {
|
enum render_bit_depth {
|
||||||
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
||||||
|
RENDER_BIT_DEPTH_6,
|
||||||
RENDER_BIT_DEPTH_8,
|
RENDER_BIT_DEPTH_8,
|
||||||
RENDER_BIT_DEPTH_10,
|
RENDER_BIT_DEPTH_10,
|
||||||
};
|
};
|
||||||
|
@ -285,6 +288,9 @@ struct output_config {
|
||||||
int max_render_time; // In milliseconds
|
int max_render_time; // In milliseconds
|
||||||
int adaptive_sync;
|
int adaptive_sync;
|
||||||
enum render_bit_depth render_bit_depth;
|
enum render_bit_depth render_bit_depth;
|
||||||
|
bool set_color_transform;
|
||||||
|
struct wlr_color_transform *color_transform;
|
||||||
|
int allow_tearing;
|
||||||
|
|
||||||
char *background;
|
char *background;
|
||||||
char *background_option;
|
char *background_option;
|
||||||
|
@ -680,22 +686,28 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt
|
||||||
|
|
||||||
struct output_config *new_output_config(const char *name);
|
struct output_config *new_output_config(const char *name);
|
||||||
|
|
||||||
void merge_output_config(struct output_config *dst, struct output_config *src);
|
bool apply_output_configs(struct output_config **ocs, size_t ocs_len,
|
||||||
|
bool test_only, bool degrade_to_off);
|
||||||
|
|
||||||
bool apply_output_config(struct output_config *oc, struct sway_output *output);
|
void apply_stored_output_configs(void);
|
||||||
|
|
||||||
bool test_output_config(struct output_config *oc, struct sway_output *output);
|
/**
|
||||||
|
* store_output_config stores a new output config. An output may be matched by
|
||||||
struct output_config *store_output_config(struct output_config *oc);
|
* three different config types, in order of precedence: Identifier, name and
|
||||||
|
* wildcard. When storing a config type of lower precedence, assume that the
|
||||||
|
* user wants the config to take immediate effect by superseding (clearing) the
|
||||||
|
* same values from higher presedence configuration.
|
||||||
|
*/
|
||||||
|
void store_output_config(struct output_config *oc);
|
||||||
|
|
||||||
struct output_config *find_output_config(struct sway_output *output);
|
struct output_config *find_output_config(struct sway_output *output);
|
||||||
|
|
||||||
void apply_output_config_to_outputs(struct output_config *oc);
|
|
||||||
|
|
||||||
void reset_outputs(void);
|
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc);
|
void free_output_config(struct output_config *oc);
|
||||||
|
|
||||||
|
void request_modeset(void);
|
||||||
|
void force_modeset(void);
|
||||||
|
bool modeset_is_pending(void);
|
||||||
|
|
||||||
bool spawn_swaybg(void);
|
bool spawn_swaybg(void);
|
||||||
|
|
||||||
int workspace_output_cmp_workspace(const void *a, const void *b);
|
int workspace_output_cmp_workspace(const void *a, const void *b);
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "tree/view.h"
|
#include "tree/view.h"
|
||||||
|
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
|
#include "sway/xwayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum criteria_type {
|
enum criteria_type {
|
||||||
CT_COMMAND = 1 << 0,
|
CT_COMMAND = 1 << 0,
|
||||||
CT_ASSIGN_OUTPUT = 1 << 1,
|
CT_ASSIGN_OUTPUT = 1 << 1,
|
||||||
|
@ -36,7 +40,7 @@ struct criteria {
|
||||||
struct pattern *app_id;
|
struct pattern *app_id;
|
||||||
struct pattern *con_mark;
|
struct pattern *con_mark;
|
||||||
uint32_t con_id; // internal ID
|
uint32_t con_id; // internal ID
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct pattern *class;
|
struct pattern *class;
|
||||||
uint32_t id; // X11 window ID
|
uint32_t id; // X11 window ID
|
||||||
struct pattern *instance;
|
struct pattern *instance;
|
||||||
|
@ -49,6 +53,9 @@ struct criteria {
|
||||||
char urgent; // 'l' for latest or 'o' for oldest
|
char urgent; // 'l' for latest or 'o' for oldest
|
||||||
struct pattern *workspace;
|
struct pattern *workspace;
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
struct pattern *sandbox_engine;
|
||||||
|
struct pattern *sandbox_app_id;
|
||||||
|
struct pattern *sandbox_instance_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool criteria_is_empty(struct criteria *criteria);
|
bool criteria_is_empty(struct criteria *criteria);
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#include <wlr/types/wlr_compositor.h>
|
|
||||||
|
|
||||||
struct sway_container;
|
|
||||||
struct sway_view;
|
|
||||||
|
|
||||||
void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
|
|
||||||
bool whole);
|
|
||||||
|
|
||||||
void desktop_damage_whole_container(struct sway_container *con);
|
|
||||||
|
|
||||||
void desktop_damage_box(struct wlr_box *box);
|
|
||||||
|
|
||||||
void desktop_damage_view(struct sway_view *view);
|
|
|
@ -3,14 +3,18 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
|
#include "sway/input/seat.h"
|
||||||
|
|
||||||
struct launcher_ctx {
|
struct launcher_ctx {
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
char *fallback_name;
|
char *fallback_name;
|
||||||
struct wlr_xdg_activation_token_v1 *token;
|
struct wlr_xdg_activation_token_v1 *token;
|
||||||
struct wl_listener token_destroy;
|
struct wl_listener token_destroy;
|
||||||
|
struct sway_seat *seat;
|
||||||
|
struct wl_listener seat_destroy;
|
||||||
|
|
||||||
bool activated;
|
bool activated;
|
||||||
|
bool had_focused_surface;
|
||||||
|
|
||||||
struct sway_node *node;
|
struct sway_node *node;
|
||||||
struct wl_listener node_destroy;
|
struct wl_listener node_destroy;
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _SWAY_TRANSACTION_H
|
#ifndef _SWAY_TRANSACTION_H
|
||||||
#define _SWAY_TRANSACTION_H
|
#define _SWAY_TRANSACTION_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transactions enable us to perform atomic layout updates.
|
* Transactions enable us to perform atomic layout updates.
|
||||||
|
@ -38,8 +40,11 @@ void transaction_commit_dirty_client(void);
|
||||||
* Notify the transaction system that a view is ready for the new layout.
|
* Notify the transaction system that a view is ready for the new layout.
|
||||||
*
|
*
|
||||||
* When all views in the transaction are ready, the layout will be applied.
|
* When all views in the transaction are ready, the layout will be applied.
|
||||||
|
*
|
||||||
|
* A success boolean is returned denoting that this part of the transaction is
|
||||||
|
* ready.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
bool transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
uint32_t serial);
|
uint32_t serial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,8 +52,13 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
* identifying the instruction by geometry rather than by serial.
|
* identifying the instruction by geometry rather than by serial.
|
||||||
*
|
*
|
||||||
* This is used by xwayland views, as they don't have serials.
|
* This is used by xwayland views, as they don't have serials.
|
||||||
|
*
|
||||||
|
* A success boolean is returned denoting that this part of the transaction is
|
||||||
|
* ready.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
double x, double y, int width, int height);
|
double x, double y, int width, int height);
|
||||||
|
|
||||||
|
void arrange_popups(struct wlr_scene_tree *popups);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -114,7 +114,7 @@ void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
|
||||||
|
|
||||||
void dispatch_cursor_button(struct sway_cursor *cursor,
|
void dispatch_cursor_button(struct sway_cursor *cursor,
|
||||||
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
|
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
|
||||||
enum wlr_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
|
|
||||||
void dispatch_cursor_axis(struct sway_cursor *cursor,
|
void dispatch_cursor_axis(struct sway_cursor *cursor,
|
||||||
struct wlr_pointer_axis_event *event);
|
struct wlr_pointer_axis_event *event);
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
|
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
|
||||||
#define _SWAY_INPUT_INPUT_MANAGER_H
|
#define _SWAY_INPUT_INPUT_MANAGER_H
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <wlr/types/wlr_input_inhibitor.h>
|
|
||||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||||
#include "sway/server.h"
|
#include <wlr/types/wlr_transient_seat_v1.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
struct sway_server;
|
||||||
|
|
||||||
struct sway_input_device {
|
struct sway_input_device {
|
||||||
char *identifier;
|
char *identifier;
|
||||||
struct wlr_input_device *wlr_device;
|
struct wlr_input_device *wlr_device;
|
||||||
|
@ -21,11 +22,11 @@ struct sway_input_manager {
|
||||||
struct wl_list devices;
|
struct wl_list devices;
|
||||||
struct wl_list seats;
|
struct wl_list seats;
|
||||||
|
|
||||||
struct wlr_input_inhibit_manager *inhibit;
|
|
||||||
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
||||||
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
||||||
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
||||||
struct wlr_pointer_gestures_v1 *pointer_gestures;
|
struct wlr_pointer_gestures_v1 *pointer_gestures;
|
||||||
|
struct wlr_transient_seat_manager_v1 *transient_seat_manager;
|
||||||
|
|
||||||
struct wl_listener new_input;
|
struct wl_listener new_input;
|
||||||
struct wl_listener inhibit_activate;
|
struct wl_listener inhibit_activate;
|
||||||
|
@ -33,6 +34,7 @@ struct sway_input_manager {
|
||||||
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
|
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
|
||||||
struct wl_listener virtual_keyboard_new;
|
struct wl_listener virtual_keyboard_new;
|
||||||
struct wl_listener virtual_pointer_new;
|
struct wl_listener virtual_pointer_new;
|
||||||
|
struct wl_listener transient_seat_create;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_input_manager *input_manager_create(struct sway_server *server);
|
struct sway_input_manager *input_manager_create(struct sway_server *server);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
#include <wlr/types/wlr_touch.h>
|
#include <wlr/types/wlr_touch.h>
|
||||||
#include <wlr/util/edges.h>
|
#include <wlr/util/edges.h>
|
||||||
|
@ -12,12 +13,11 @@
|
||||||
#include "sway/input/text_input.h"
|
#include "sway/input/text_input.h"
|
||||||
|
|
||||||
struct sway_seat;
|
struct sway_seat;
|
||||||
struct render_context;
|
|
||||||
|
|
||||||
struct sway_seatop_impl {
|
struct sway_seatop_impl {
|
||||||
void (*button)(struct sway_seat *seat, uint32_t time_msec,
|
void (*button)(struct sway_seat *seat, uint32_t time_msec,
|
||||||
struct wlr_input_device *device, uint32_t button,
|
struct wlr_input_device *device, uint32_t button,
|
||||||
enum wlr_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
|
void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
|
||||||
void (*pointer_axis)(struct sway_seat *seat,
|
void (*pointer_axis)(struct sway_seat *seat,
|
||||||
struct wlr_pointer_axis_event *event);
|
struct wlr_pointer_axis_event *event);
|
||||||
|
@ -52,7 +52,6 @@ struct sway_seatop_impl {
|
||||||
uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
|
uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
|
||||||
void (*end)(struct sway_seat *seat);
|
void (*end)(struct sway_seat *seat);
|
||||||
void (*unref)(struct sway_seat *seat, struct sway_container *con);
|
void (*unref)(struct sway_seat *seat, struct sway_container *con);
|
||||||
void (*render)(struct sway_seat *seat, struct render_context *ctx);
|
|
||||||
bool allow_set_cursor;
|
bool allow_set_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -75,20 +74,6 @@ struct sway_seat_node {
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_drag_icon {
|
|
||||||
struct sway_seat *seat;
|
|
||||||
struct wlr_drag_icon *wlr_drag_icon;
|
|
||||||
struct wl_list link; // sway_root::drag_icons
|
|
||||||
|
|
||||||
double x, y; // in layout-local coordinates
|
|
||||||
int dx, dy; // offset in surface-local coordinates
|
|
||||||
|
|
||||||
struct wl_listener surface_commit;
|
|
||||||
struct wl_listener map;
|
|
||||||
struct wl_listener unmap;
|
|
||||||
struct wl_listener destroy;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_drag {
|
struct sway_drag {
|
||||||
struct sway_seat *seat;
|
struct sway_seat *seat;
|
||||||
struct wlr_drag *wlr_drag;
|
struct wlr_drag *wlr_drag;
|
||||||
|
@ -99,6 +84,15 @@ struct sway_seat {
|
||||||
struct wlr_seat *wlr_seat;
|
struct wlr_seat *wlr_seat;
|
||||||
struct sway_cursor *cursor;
|
struct sway_cursor *cursor;
|
||||||
|
|
||||||
|
// Seat scene tree structure
|
||||||
|
// - scene_tree
|
||||||
|
// - drag icons
|
||||||
|
// - drag icon 1
|
||||||
|
// - drag icon 2
|
||||||
|
// - seatop specific stuff
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct wlr_scene_tree *drag_icons;
|
||||||
|
|
||||||
bool has_focus;
|
bool has_focus;
|
||||||
struct wl_list focus_stack; // list of containers in focus order
|
struct wl_list focus_stack; // list of containers in focus order
|
||||||
struct sway_workspace *workspace;
|
struct sway_workspace *workspace;
|
||||||
|
@ -108,9 +102,6 @@ struct sway_seat {
|
||||||
// If the exclusive layer is set, views cannot receive keyboard focus
|
// If the exclusive layer is set, views cannot receive keyboard focus
|
||||||
bool has_exclusive_layer;
|
bool has_exclusive_layer;
|
||||||
|
|
||||||
// If exclusive_client is set, no other clients will receive input events
|
|
||||||
struct wl_client *exclusive_client;
|
|
||||||
|
|
||||||
// Last touch point
|
// Last touch point
|
||||||
int32_t touch_id;
|
int32_t touch_id;
|
||||||
double touch_x, touch_y;
|
double touch_x, touch_y;
|
||||||
|
@ -133,6 +124,7 @@ struct sway_seat {
|
||||||
struct wl_listener start_drag;
|
struct wl_listener start_drag;
|
||||||
struct wl_listener request_set_selection;
|
struct wl_listener request_set_selection;
|
||||||
struct wl_listener request_set_primary_selection;
|
struct wl_listener request_set_primary_selection;
|
||||||
|
struct wl_listener destroy;
|
||||||
|
|
||||||
struct wl_list devices; // sway_seat_device::link
|
struct wl_list devices; // sway_seat_device::link
|
||||||
struct wl_list keyboard_groups; // sway_keyboard_group::link
|
struct wl_list keyboard_groups; // sway_keyboard_group::link
|
||||||
|
@ -201,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
|
||||||
void seat_set_focus_layer(struct sway_seat *seat,
|
void seat_set_focus_layer(struct sway_seat *seat,
|
||||||
struct wlr_layer_surface_v1 *layer);
|
struct wlr_layer_surface_v1 *layer);
|
||||||
|
|
||||||
void seat_set_exclusive_client(struct sway_seat *seat,
|
void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client);
|
||||||
struct wl_client *client);
|
|
||||||
|
|
||||||
struct sway_node *seat_get_focus(struct sway_seat *seat);
|
struct sway_node *seat_get_focus(struct sway_seat *seat);
|
||||||
|
|
||||||
|
@ -261,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat,
|
||||||
|
|
||||||
bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
|
bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
|
||||||
|
|
||||||
void drag_icon_update_position(struct sway_drag_icon *icon);
|
void drag_icons_update_position(struct sway_seat *seat);
|
||||||
|
|
||||||
enum wlr_edges find_resize_edge(struct sway_container *cont,
|
enum wlr_edges find_resize_edge(struct sway_container *cont,
|
||||||
struct wlr_surface *surface, struct sway_cursor *cursor);
|
struct wlr_surface *surface, struct sway_cursor *cursor);
|
||||||
|
@ -296,13 +287,13 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
|
||||||
struct sway_workspace *workspace);
|
struct sway_workspace *workspace);
|
||||||
|
|
||||||
void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
|
void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
|
||||||
uint32_t button, enum wlr_button_state state);
|
uint32_t button, enum wl_pointer_button_state state);
|
||||||
|
|
||||||
void seat_consider_warp_to_focus(struct sway_seat *seat);
|
void seat_consider_warp_to_focus(struct sway_seat *seat);
|
||||||
|
|
||||||
void seatop_button(struct sway_seat *seat, uint32_t time_msec,
|
void seatop_button(struct sway_seat *seat, uint32_t time_msec,
|
||||||
struct wlr_input_device *device, uint32_t button,
|
struct wlr_input_device *device, uint32_t button,
|
||||||
enum wlr_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
|
|
||||||
void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
|
void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
|
||||||
|
|
||||||
|
@ -361,12 +352,6 @@ void seatop_end(struct sway_seat *seat);
|
||||||
*/
|
*/
|
||||||
void seatop_unref(struct sway_seat *seat, struct sway_container *con);
|
void seatop_unref(struct sway_seat *seat, struct sway_container *con);
|
||||||
|
|
||||||
/**
|
|
||||||
* Instructs a seatop to render anything that it needs to render
|
|
||||||
* (eg. dropzone for move-tiling)
|
|
||||||
*/
|
|
||||||
void seatop_render(struct sway_seat *seat, struct render_context *ctx);
|
|
||||||
|
|
||||||
bool seatop_allows_set_cursor(struct sway_seat *seat);
|
bool seatop_allows_set_cursor(struct sway_seat *seat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -21,18 +21,21 @@ struct sway_input_method_relay {
|
||||||
struct sway_seat *seat;
|
struct sway_seat *seat;
|
||||||
|
|
||||||
struct wl_list text_inputs; // sway_text_input::link
|
struct wl_list text_inputs; // sway_text_input::link
|
||||||
|
struct wl_list input_popups; // sway_input_popup::link
|
||||||
struct wlr_input_method_v2 *input_method; // doesn't have to be present
|
struct wlr_input_method_v2 *input_method; // doesn't have to be present
|
||||||
|
|
||||||
struct wl_listener text_input_new;
|
struct wl_listener text_input_new;
|
||||||
|
|
||||||
struct wl_listener input_method_new;
|
struct wl_listener input_method_new;
|
||||||
struct wl_listener input_method_commit;
|
struct wl_listener input_method_commit;
|
||||||
|
struct wl_listener input_method_new_popup_surface;
|
||||||
struct wl_listener input_method_grab_keyboard;
|
struct wl_listener input_method_grab_keyboard;
|
||||||
struct wl_listener input_method_destroy;
|
struct wl_listener input_method_destroy;
|
||||||
|
|
||||||
struct wl_listener input_method_keyboard_grab_destroy;
|
struct wl_listener input_method_keyboard_grab_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct sway_text_input {
|
struct sway_text_input {
|
||||||
struct sway_input_method_relay *relay;
|
struct sway_input_method_relay *relay;
|
||||||
|
|
||||||
|
|
23
include/sway/input/text_input_popup.h
Normal file
23
include/sway/input/text_input_popup.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H
|
||||||
|
#define _SWAY_INPUT_TEXT_INPUT_POPUP_H
|
||||||
|
|
||||||
|
#include "sway/tree/view.h"
|
||||||
|
|
||||||
|
struct sway_input_popup {
|
||||||
|
struct sway_input_method_relay *relay;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct sway_popup_desc desc;
|
||||||
|
struct wlr_input_popup_surface_v2 *popup_surface;
|
||||||
|
struct wlr_output *fixed_output;
|
||||||
|
|
||||||
|
struct wl_list link;
|
||||||
|
|
||||||
|
struct wl_listener popup_destroy;
|
||||||
|
struct wl_listener popup_surface_commit;
|
||||||
|
struct wl_listener popup_surface_map;
|
||||||
|
struct wl_listener popup_surface_unmap;
|
||||||
|
|
||||||
|
struct wl_listener focused_surface_unmap;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -3,54 +3,34 @@
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
|
#include "sway/tree/view.h"
|
||||||
enum layer_parent {
|
|
||||||
LAYER_PARENT_LAYER,
|
|
||||||
LAYER_PARENT_POPUP,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_layer_surface {
|
struct sway_layer_surface {
|
||||||
struct wlr_layer_surface_v1 *layer_surface;
|
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
struct wl_listener destroy;
|
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener surface_commit;
|
struct wl_listener surface_commit;
|
||||||
struct wl_listener output_destroy;
|
struct wl_listener output_destroy;
|
||||||
|
struct wl_listener node_destroy;
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
struct wl_listener new_subsurface;
|
|
||||||
|
|
||||||
struct wlr_box geo;
|
|
||||||
bool mapped;
|
bool mapped;
|
||||||
struct wlr_box extent;
|
|
||||||
enum zwlr_layer_shell_v1_layer layer;
|
|
||||||
|
|
||||||
struct wl_list subsurfaces;
|
struct wlr_scene_tree *popups;
|
||||||
|
struct sway_popup_desc desc;
|
||||||
|
|
||||||
|
struct sway_output *output;
|
||||||
|
struct wlr_scene_layer_surface_v1 *scene;
|
||||||
|
struct wlr_scene_tree *tree;
|
||||||
|
struct wlr_layer_surface_v1 *layer_surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_layer_popup {
|
struct sway_layer_popup {
|
||||||
struct wlr_xdg_popup *wlr_popup;
|
struct wlr_xdg_popup *wlr_popup;
|
||||||
enum layer_parent parent_type;
|
struct wlr_scene_tree *scene;
|
||||||
union {
|
struct sway_layer_surface *toplevel;
|
||||||
struct sway_layer_surface *parent_layer;
|
|
||||||
struct sway_layer_popup *parent_popup;
|
|
||||||
};
|
|
||||||
struct wl_listener map;
|
|
||||||
struct wl_listener unmap;
|
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener commit;
|
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_layer_subsurface {
|
|
||||||
struct wlr_subsurface *wlr_subsurface;
|
|
||||||
struct sway_layer_surface *layer_surface;
|
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
struct wl_listener map;
|
|
||||||
struct wl_listener unmap;
|
|
||||||
struct wl_listener destroy;
|
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,7 +41,4 @@ struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
|
||||||
|
|
||||||
void arrange_layers(struct sway_output *output);
|
void arrange_layers(struct sway_output *output);
|
||||||
|
|
||||||
struct sway_layer_surface *layer_from_wlr_layer_surface_v1(
|
|
||||||
struct wlr_layer_surface_v1 *layer_surface);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
6
include/sway/lock.h
Normal file
6
include/sway/lock.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _SWAY_LOCK_H
|
||||||
|
#define _SWAY_LOCK_H
|
||||||
|
|
||||||
|
void arrange_locks(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -5,6 +5,7 @@
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/types/wlr_damage_ring.h>
|
#include <wlr/types/wlr_damage_ring.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
#include "sway/tree/view.h"
|
#include "sway/tree/view.h"
|
||||||
|
@ -19,44 +20,58 @@ struct sway_output_state {
|
||||||
|
|
||||||
struct sway_output {
|
struct sway_output {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *shell_background;
|
||||||
|
struct wlr_scene_tree *shell_bottom;
|
||||||
|
struct wlr_scene_tree *tiling;
|
||||||
|
struct wlr_scene_tree *fullscreen;
|
||||||
|
struct wlr_scene_tree *shell_top;
|
||||||
|
struct wlr_scene_tree *shell_overlay;
|
||||||
|
struct wlr_scene_tree *session_lock;
|
||||||
|
} layers;
|
||||||
|
|
||||||
|
// when a container is fullscreen, in case the fullscreen surface is
|
||||||
|
// translucent (can see behind) we must make sure that the background is a
|
||||||
|
// solid color in order to conform to the wayland protocol. This rect
|
||||||
|
// ensures that when looking through a surface, all that will be seen
|
||||||
|
// is black.
|
||||||
|
struct wlr_scene_rect *fullscreen_background;
|
||||||
|
|
||||||
struct wlr_output *wlr_output;
|
struct wlr_output *wlr_output;
|
||||||
|
struct wlr_scene_output *scene_output;
|
||||||
struct sway_server *server;
|
struct sway_server *server;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
struct wl_list layers[4]; // sway_layer_surface::link
|
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
|
||||||
struct timespec last_frame;
|
|
||||||
struct wlr_damage_ring damage_ring;
|
|
||||||
|
|
||||||
int lx, ly; // layout coords
|
int lx, ly; // layout coords
|
||||||
int width, height; // transformed buffer size
|
int width, height; // transformed buffer size
|
||||||
enum wl_output_subpixel detected_subpixel;
|
enum wl_output_subpixel detected_subpixel;
|
||||||
enum scale_filter_mode scale_filter;
|
enum scale_filter_mode scale_filter;
|
||||||
|
|
||||||
bool enabling, enabled;
|
bool enabled;
|
||||||
list_t *workspaces;
|
list_t *workspaces;
|
||||||
|
|
||||||
struct sway_output_state current;
|
struct sway_output_state current;
|
||||||
|
|
||||||
struct wl_listener layout_destroy;
|
struct wl_listener layout_destroy;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener commit;
|
|
||||||
struct wl_listener present;
|
struct wl_listener present;
|
||||||
struct wl_listener damage;
|
|
||||||
struct wl_listener frame;
|
struct wl_listener frame;
|
||||||
struct wl_listener needs_frame;
|
|
||||||
struct wl_listener request_state;
|
struct wl_listener request_state;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal disable;
|
struct wl_signal disable;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
|
struct wlr_color_transform *color_transform;
|
||||||
|
|
||||||
struct timespec last_presentation;
|
struct timespec last_presentation;
|
||||||
uint32_t refresh_nsec;
|
uint32_t refresh_nsec;
|
||||||
int max_render_time; // In milliseconds
|
int max_render_time; // In milliseconds
|
||||||
struct wl_event_source *repaint_timer;
|
struct wl_event_source *repaint_timer;
|
||||||
bool gamma_lut_changed;
|
bool allow_tearing;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_output_non_desktop {
|
struct sway_output_non_desktop {
|
||||||
|
@ -65,14 +80,6 @@ struct sway_output_non_desktop {
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct render_context {
|
|
||||||
struct sway_output *output;
|
|
||||||
struct wlr_renderer *renderer;
|
|
||||||
const pixman_region32_t *output_damage;
|
|
||||||
|
|
||||||
struct wlr_render_pass *pass;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_output *output_create(struct wlr_output *wlr_output);
|
struct sway_output *output_create(struct wlr_output *wlr_output);
|
||||||
|
|
||||||
void output_destroy(struct sway_output *output);
|
void output_destroy(struct sway_output *output);
|
||||||
|
@ -84,6 +91,9 @@ struct sway_output *output_from_wlr_output(struct wlr_output *output);
|
||||||
struct sway_output *output_get_in_direction(struct sway_output *reference,
|
struct sway_output *output_get_in_direction(struct sway_output *reference,
|
||||||
enum wlr_direction direction);
|
enum wlr_direction direction);
|
||||||
|
|
||||||
|
void output_configure_scene(struct sway_output *output,
|
||||||
|
struct wlr_scene_node *node, float opacity);
|
||||||
|
|
||||||
void output_add_workspace(struct sway_output *output,
|
void output_add_workspace(struct sway_output *output,
|
||||||
struct sway_workspace *workspace);
|
struct sway_workspace *workspace);
|
||||||
|
|
||||||
|
@ -91,19 +101,6 @@ typedef void (*sway_surface_iterator_func_t)(struct sway_output *output,
|
||||||
struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box,
|
struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
void output_damage_whole(struct sway_output *output);
|
|
||||||
|
|
||||||
void output_damage_surface(struct sway_output *output, double ox, double oy,
|
|
||||||
struct wlr_surface *surface, bool whole);
|
|
||||||
|
|
||||||
void output_damage_from_view(struct sway_output *output,
|
|
||||||
struct sway_view *view);
|
|
||||||
|
|
||||||
void output_damage_box(struct sway_output *output, struct wlr_box *box);
|
|
||||||
|
|
||||||
void output_damage_whole_container(struct sway_output *output,
|
|
||||||
struct sway_container *con);
|
|
||||||
|
|
||||||
bool output_match_name_or_id(struct sway_output *output,
|
bool output_match_name_or_id(struct sway_output *output,
|
||||||
const char *name_or_id);
|
const char *name_or_id);
|
||||||
|
|
||||||
|
@ -119,46 +116,8 @@ void output_enable(struct sway_output *output);
|
||||||
|
|
||||||
void output_disable(struct sway_output *output);
|
void output_disable(struct sway_output *output);
|
||||||
|
|
||||||
bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
|
|
||||||
|
|
||||||
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
|
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
|
||||||
|
|
||||||
void output_render(struct render_context *ctx);
|
|
||||||
|
|
||||||
void output_surface_for_each_surface(struct sway_output *output,
|
|
||||||
struct wlr_surface *surface, double ox, double oy,
|
|
||||||
sway_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
|
|
||||||
void output_view_for_each_surface(struct sway_output *output,
|
|
||||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_view_for_each_popup_surface(struct sway_output *output,
|
|
||||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_layer_for_each_surface(struct sway_output *output,
|
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_layer_for_each_toplevel_surface(struct sway_output *output,
|
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_layer_for_each_popup_surface(struct sway_output *output,
|
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
|
||||||
void output_unmanaged_for_each_surface(struct sway_output *output,
|
|
||||||
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void output_drag_icons_for_each_surface(struct sway_output *output,
|
|
||||||
struct wl_list *drag_icons, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_for_each_workspace(struct sway_output *output,
|
void output_for_each_workspace(struct sway_output *output,
|
||||||
void (*f)(struct sway_workspace *ws, void *data), void *data);
|
void (*f)(struct sway_workspace *ws, void *data), void *data);
|
||||||
|
|
||||||
|
@ -176,19 +135,8 @@ void output_get_box(struct sway_output *output, struct wlr_box *box);
|
||||||
enum sway_container_layout output_get_default_layout(
|
enum sway_container_layout output_get_default_layout(
|
||||||
struct sway_output *output);
|
struct sway_output *output);
|
||||||
|
|
||||||
void render_rect(struct render_context *ctx, const struct wlr_box *_box,
|
|
||||||
float color[static 4]);
|
|
||||||
|
|
||||||
void premultiply_alpha(float color[4], float opacity);
|
|
||||||
|
|
||||||
void scale_box(struct wlr_box *box, float scale);
|
|
||||||
|
|
||||||
enum wlr_direction opposite_direction(enum wlr_direction d);
|
enum wlr_direction opposite_direction(enum wlr_direction d);
|
||||||
|
|
||||||
void handle_output_layout_change(struct wl_listener *listener, void *data);
|
|
||||||
|
|
||||||
void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data);
|
|
||||||
|
|
||||||
void handle_output_manager_apply(struct wl_listener *listener, void *data);
|
void handle_output_manager_apply(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
void handle_output_manager_test(struct wl_listener *listener, void *data);
|
void handle_output_manager_test(struct wl_listener *listener, void *data);
|
||||||
|
@ -198,4 +146,6 @@ void handle_output_power_manager_set_mode(struct wl_listener *listener,
|
||||||
|
|
||||||
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
|
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
|
||||||
|
|
||||||
|
void update_output_manager_config(struct sway_server *server);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
33
include/sway/scene_descriptor.h
Normal file
33
include/sway/scene_descriptor.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* Across a wayland compositor, there are multiple shells: It can be
|
||||||
|
* a toplevel, or a layer_shell, or even something more meta like a drag
|
||||||
|
* icon or highlight indicators when dragging windows around.
|
||||||
|
*
|
||||||
|
* This object lets us store values that represent these modes of operation
|
||||||
|
* and keep track of what object is being represented.
|
||||||
|
*/
|
||||||
|
#ifndef _SWAY_SCENE_DESCRIPTOR_H
|
||||||
|
#define _SWAY_SCENE_DESCRIPTOR_H
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
||||||
|
enum sway_scene_descriptor_type {
|
||||||
|
SWAY_SCENE_DESC_BUFFER_TIMER,
|
||||||
|
SWAY_SCENE_DESC_NON_INTERACTIVE,
|
||||||
|
SWAY_SCENE_DESC_CONTAINER,
|
||||||
|
SWAY_SCENE_DESC_VIEW,
|
||||||
|
SWAY_SCENE_DESC_LAYER_SHELL,
|
||||||
|
SWAY_SCENE_DESC_XWAYLAND_UNMANAGED,
|
||||||
|
SWAY_SCENE_DESC_POPUP,
|
||||||
|
SWAY_SCENE_DESC_DRAG_ICON,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool scene_descriptor_assign(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type, void *data);
|
||||||
|
|
||||||
|
void *scene_descriptor_try_get(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type);
|
||||||
|
|
||||||
|
void scene_descriptor_destroy(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type);
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,32 +2,28 @@
|
||||||
#define _SWAY_SERVER_H
|
#define _SWAY_SERVER_H
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/backend.h>
|
|
||||||
#include <wlr/render/allocator.h>
|
|
||||||
#include <wlr/render/wlr_renderer.h>
|
|
||||||
#include <wlr/types/wlr_compositor.h>
|
|
||||||
#include <wlr/types/wlr_data_device.h>
|
|
||||||
#include <wlr/types/wlr_input_method_v2.h>
|
|
||||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
|
||||||
#include <wlr/types/wlr_output_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_output_power_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
|
||||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
|
||||||
#include <wlr/types/wlr_session_lock_v1.h>
|
|
||||||
#include <wlr/types/wlr_server_decoration.h>
|
|
||||||
#include <wlr/types/wlr_text_input_v3.h>
|
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "sway/desktop/idle_inhibit_v1.h"
|
#include "sway/desktop/idle_inhibit_v1.h"
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sway_transaction;
|
struct sway_transaction;
|
||||||
|
|
||||||
|
struct sway_session_lock {
|
||||||
|
struct wlr_session_lock_v1 *lock;
|
||||||
|
struct wlr_surface *focused;
|
||||||
|
bool abandoned;
|
||||||
|
|
||||||
|
struct wl_list outputs; // struct sway_session_lock_output
|
||||||
|
|
||||||
|
// invalid if the session is abandoned
|
||||||
|
struct wl_listener new_surface;
|
||||||
|
struct wl_listener unlock;
|
||||||
|
struct wl_listener destroy;
|
||||||
|
};
|
||||||
|
|
||||||
struct sway_server {
|
struct sway_server {
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
struct wl_event_loop *wl_event_loop;
|
struct wl_event_loop *wl_event_loop;
|
||||||
|
@ -41,7 +37,6 @@ struct sway_server {
|
||||||
struct wlr_allocator *allocator;
|
struct wlr_allocator *allocator;
|
||||||
|
|
||||||
struct wlr_compositor *compositor;
|
struct wlr_compositor *compositor;
|
||||||
struct wl_listener compositor_new_surface;
|
|
||||||
|
|
||||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
|
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
|
||||||
|
|
||||||
|
@ -50,7 +45,7 @@ struct sway_server {
|
||||||
struct sway_input_manager *input;
|
struct sway_input_manager *input;
|
||||||
|
|
||||||
struct wl_listener new_output;
|
struct wl_listener new_output;
|
||||||
struct wl_listener output_layout_change;
|
struct wl_listener renderer_lost;
|
||||||
|
|
||||||
struct wlr_idle_notifier_v1 *idle_notifier_v1;
|
struct wlr_idle_notifier_v1 *idle_notifier_v1;
|
||||||
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
|
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
|
||||||
|
@ -59,11 +54,11 @@ struct sway_server {
|
||||||
struct wl_listener layer_shell_surface;
|
struct wl_listener layer_shell_surface;
|
||||||
|
|
||||||
struct wlr_xdg_shell *xdg_shell;
|
struct wlr_xdg_shell *xdg_shell;
|
||||||
struct wl_listener xdg_shell_surface;
|
struct wl_listener xdg_shell_toplevel;
|
||||||
|
|
||||||
struct wlr_tablet_manager_v2 *tablet_v2;
|
struct wlr_tablet_manager_v2 *tablet_v2;
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct sway_xwayland xwayland;
|
struct sway_xwayland xwayland;
|
||||||
struct wl_listener xwayland_surface;
|
struct wl_listener xwayland_surface;
|
||||||
struct wl_listener xwayland_ready;
|
struct wl_listener xwayland_ready;
|
||||||
|
@ -82,11 +77,11 @@ struct sway_server {
|
||||||
struct wlr_drm_lease_v1_manager *drm_lease_manager;
|
struct wlr_drm_lease_v1_manager *drm_lease_manager;
|
||||||
struct wl_listener drm_lease_request;
|
struct wl_listener drm_lease_request;
|
||||||
|
|
||||||
struct wlr_presentation *presentation;
|
|
||||||
|
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints;
|
struct wlr_pointer_constraints_v1 *pointer_constraints;
|
||||||
struct wl_listener pointer_constraint;
|
struct wl_listener pointer_constraint;
|
||||||
|
|
||||||
|
struct wlr_xdg_output_manager_v1 *xdg_output_manager_v1;
|
||||||
|
|
||||||
struct wlr_output_manager_v1 *output_manager_v1;
|
struct wlr_output_manager_v1 *output_manager_v1;
|
||||||
struct wl_listener output_manager_apply;
|
struct wl_listener output_manager_apply;
|
||||||
struct wl_listener output_manager_test;
|
struct wl_listener output_manager_test;
|
||||||
|
@ -95,15 +90,9 @@ struct sway_server {
|
||||||
struct wl_listener gamma_control_set_gamma;
|
struct wl_listener gamma_control_set_gamma;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
bool locked;
|
struct sway_session_lock *lock;
|
||||||
struct wlr_session_lock_manager_v1 *manager;
|
struct wlr_session_lock_manager_v1 *manager;
|
||||||
|
|
||||||
struct wlr_session_lock_v1 *lock;
|
|
||||||
struct wlr_surface *focused;
|
|
||||||
struct wl_listener lock_new_surface;
|
|
||||||
struct wl_listener lock_unlock;
|
|
||||||
struct wl_listener lock_destroy;
|
|
||||||
|
|
||||||
struct wl_listener new_lock;
|
struct wl_listener new_lock;
|
||||||
struct wl_listener manager_destroy;
|
struct wl_listener manager_destroy;
|
||||||
} session_lock;
|
} session_lock;
|
||||||
|
@ -112,10 +101,13 @@ struct sway_server {
|
||||||
struct wl_listener output_power_manager_set_mode;
|
struct wl_listener output_power_manager_set_mode;
|
||||||
struct wlr_input_method_manager_v2 *input_method;
|
struct wlr_input_method_manager_v2 *input_method;
|
||||||
struct wlr_text_input_manager_v3 *text_input;
|
struct wlr_text_input_manager_v3 *text_input;
|
||||||
|
struct wlr_ext_foreign_toplevel_list_v1 *foreign_toplevel_list;
|
||||||
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
|
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
|
||||||
struct wlr_content_type_manager_v1 *content_type_manager_v1;
|
struct wlr_content_type_manager_v1 *content_type_manager_v1;
|
||||||
struct wlr_data_control_manager_v1 *data_control_manager_v1;
|
struct wlr_data_control_manager_v1 *wlr_data_control_manager_v1;
|
||||||
|
struct wlr_ext_data_control_manager_v1 *ext_data_control_manager_v1;
|
||||||
struct wlr_screencopy_manager_v1 *screencopy_manager_v1;
|
struct wlr_screencopy_manager_v1 *screencopy_manager_v1;
|
||||||
|
struct wlr_ext_image_copy_capture_manager_v1 *ext_image_copy_capture_manager_v1;
|
||||||
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
|
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
|
||||||
struct wlr_security_context_manager_v1 *security_context_manager_v1;
|
struct wlr_security_context_manager_v1 *security_context_manager_v1;
|
||||||
|
|
||||||
|
@ -125,6 +117,10 @@ struct sway_server {
|
||||||
|
|
||||||
struct wl_listener request_set_cursor_shape;
|
struct wl_listener request_set_cursor_shape;
|
||||||
|
|
||||||
|
struct wlr_tearing_control_manager_v1 *tearing_control_v1;
|
||||||
|
struct wl_listener tearing_control_new_object;
|
||||||
|
struct wl_list tearing_controllers; // sway_tearing_controller::link
|
||||||
|
|
||||||
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
|
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
|
||||||
|
|
||||||
// The timeout for transactions, after which a transaction is applied
|
// The timeout for transactions, after which a transaction is applied
|
||||||
|
@ -144,6 +140,8 @@ struct sway_server {
|
||||||
// Stores the nodes that have been marked as "dirty" and will be put into
|
// Stores the nodes that have been marked as "dirty" and will be put into
|
||||||
// the pending transaction.
|
// the pending transaction.
|
||||||
list_t *dirty_nodes;
|
list_t *dirty_nodes;
|
||||||
|
|
||||||
|
struct wl_event_source *delayed_modeset;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sway_server server;
|
extern struct sway_server server;
|
||||||
|
@ -152,32 +150,32 @@ struct sway_debug {
|
||||||
bool noatomic; // Ignore atomic layout updates
|
bool noatomic; // Ignore atomic layout updates
|
||||||
bool txn_timings; // Log verbose messages about transactions
|
bool txn_timings; // Log verbose messages about transactions
|
||||||
bool txn_wait; // Always wait for the timeout before applying
|
bool txn_wait; // Always wait for the timeout before applying
|
||||||
bool noscanout; // Disable direct scan-out
|
bool legacy_wl_drm; // Enable the legacy wl_drm interface
|
||||||
|
|
||||||
enum {
|
|
||||||
DAMAGE_DEFAULT, // Default behaviour
|
|
||||||
DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged
|
|
||||||
DAMAGE_RERENDER, // Render the full output when any damage occurs
|
|
||||||
} damage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sway_debug debug;
|
extern struct sway_debug debug;
|
||||||
|
|
||||||
|
extern bool allow_unsupported_gpu;
|
||||||
|
|
||||||
bool server_init(struct sway_server *server);
|
bool server_init(struct sway_server *server);
|
||||||
void server_fini(struct sway_server *server);
|
void server_fini(struct sway_server *server);
|
||||||
bool server_start(struct sway_server *server);
|
bool server_start(struct sway_server *server);
|
||||||
void server_run(struct sway_server *server);
|
void server_run(struct sway_server *server);
|
||||||
|
|
||||||
void restore_nofile_limit(void);
|
void restore_nofile_limit(void);
|
||||||
|
void restore_signals(void);
|
||||||
|
|
||||||
void handle_compositor_new_surface(struct wl_listener *listener, void *data);
|
|
||||||
void handle_new_output(struct wl_listener *listener, void *data);
|
void handle_new_output(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
|
void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
|
||||||
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
|
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
|
||||||
void sway_session_lock_init(void);
|
void sway_session_lock_init(void);
|
||||||
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
|
void sway_session_lock_add_output(struct sway_session_lock *lock,
|
||||||
#if HAVE_XWAYLAND
|
struct sway_output *output);
|
||||||
|
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
|
||||||
|
struct wlr_surface *surface);
|
||||||
|
void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||||
#endif
|
#endif
|
||||||
void handle_server_decoration(struct wl_listener *listener, void *data);
|
void handle_server_decoration(struct wl_listener *listener, void *data);
|
||||||
|
@ -190,4 +188,6 @@ void xdg_activation_v1_handle_new_token(struct wl_listener *listener,
|
||||||
|
|
||||||
void set_rr_scheduling(void);
|
void set_rr_scheduling(void);
|
||||||
|
|
||||||
|
void handle_new_tearing_hint(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
#ifndef _SWAY_SURFACE_H
|
|
||||||
#define _SWAY_SURFACE_H
|
|
||||||
#include <wlr/types/wlr_compositor.h>
|
|
||||||
|
|
||||||
struct sway_surface {
|
|
||||||
struct wlr_surface *wlr_surface;
|
|
||||||
|
|
||||||
struct wl_listener destroy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This timer can be used for issuing delayed frame done callbacks (for
|
|
||||||
* example, to improve presentation latency). Its handler is set to a
|
|
||||||
* function that issues a frame done callback to this surface.
|
|
||||||
*/
|
|
||||||
struct wl_event_source *frame_done_timer;
|
|
||||||
};
|
|
||||||
|
|
||||||
void surface_update_outputs(struct wlr_surface *surface);
|
|
||||||
void surface_enter_output(struct wlr_surface *surface,
|
|
||||||
struct sway_output *output);
|
|
||||||
void surface_leave_output(struct wlr_surface *surface,
|
|
||||||
struct sway_output *output);
|
|
||||||
|
|
||||||
#endif
|
|
28
include/sway/sway_text_node.h
Normal file
28
include/sway/sway_text_node.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef _SWAY_BUFFER_H
|
||||||
|
#define _SWAY_BUFFER_H
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
||||||
|
struct sway_text_node {
|
||||||
|
int width;
|
||||||
|
int max_width;
|
||||||
|
int height;
|
||||||
|
int baseline;
|
||||||
|
bool pango_markup;
|
||||||
|
float color[4];
|
||||||
|
float background[4];
|
||||||
|
|
||||||
|
struct wlr_scene_node *node;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent,
|
||||||
|
char *text, float color[4], bool pango_markup);
|
||||||
|
|
||||||
|
void sway_text_node_set_color(struct sway_text_node *node, float color[4]);
|
||||||
|
|
||||||
|
void sway_text_node_set_text(struct sway_text_node *node, char *text);
|
||||||
|
|
||||||
|
void sway_text_node_set_max_width(struct sway_text_node *node, int max_width);
|
||||||
|
|
||||||
|
void sway_text_node_set_background(struct sway_text_node *node, float background[4]);
|
||||||
|
|
||||||
|
#endif
|
|
@ -3,6 +3,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
|
|
||||||
|
@ -68,11 +69,41 @@ struct sway_container {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
struct sway_view *view;
|
struct sway_view *view;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *tree;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *border;
|
||||||
|
struct wlr_scene_tree *background;
|
||||||
|
|
||||||
|
struct sway_text_node *title_text;
|
||||||
|
struct sway_text_node *marks_text;
|
||||||
|
} title_bar;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *tree;
|
||||||
|
|
||||||
|
struct wlr_scene_rect *top;
|
||||||
|
struct wlr_scene_rect *bottom;
|
||||||
|
struct wlr_scene_rect *left;
|
||||||
|
struct wlr_scene_rect *right;
|
||||||
|
} border;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *content_tree;
|
||||||
|
struct wlr_scene_buffer *output_handler;
|
||||||
|
|
||||||
|
struct wl_listener output_enter;
|
||||||
|
struct wl_listener output_leave;
|
||||||
|
|
||||||
struct sway_container_state current;
|
struct sway_container_state current;
|
||||||
struct sway_container_state pending;
|
struct sway_container_state pending;
|
||||||
|
|
||||||
char *title; // The view's title (unformatted)
|
char *title; // The view's title (unformatted)
|
||||||
char *formatted_title; // The title displayed in the title bar
|
char *formatted_title; // The title displayed in the title bar
|
||||||
|
int title_width;
|
||||||
|
|
||||||
|
char *title_format;
|
||||||
|
|
||||||
enum sway_container_layout prev_split_layout;
|
enum sway_container_layout prev_split_layout;
|
||||||
|
|
||||||
|
@ -100,14 +131,6 @@ struct sway_container {
|
||||||
double child_total_width;
|
double child_total_width;
|
||||||
double child_total_height;
|
double child_total_height;
|
||||||
|
|
||||||
// In most cases this is the same as the content x and y, but if the view
|
|
||||||
// refuses to resize to the content dimensions then it can be smaller.
|
|
||||||
// These are in layout coordinates.
|
|
||||||
double surface_x, surface_y;
|
|
||||||
|
|
||||||
// Outputs currently being intersected
|
|
||||||
list_t *outputs; // struct sway_output
|
|
||||||
|
|
||||||
// Indicates that the container is a scratchpad container.
|
// Indicates that the container is a scratchpad container.
|
||||||
// Both hidden and visible scratchpad containers have scratchpad=true.
|
// Both hidden and visible scratchpad containers have scratchpad=true.
|
||||||
// Hidden scratchpad containers have a NULL parent.
|
// Hidden scratchpad containers have a NULL parent.
|
||||||
|
@ -120,18 +143,7 @@ struct sway_container {
|
||||||
|
|
||||||
float alpha;
|
float alpha;
|
||||||
|
|
||||||
struct wlr_texture *title_focused;
|
|
||||||
struct wlr_texture *title_focused_inactive;
|
|
||||||
struct wlr_texture *title_focused_tab_title;
|
|
||||||
struct wlr_texture *title_unfocused;
|
|
||||||
struct wlr_texture *title_urgent;
|
|
||||||
|
|
||||||
list_t *marks; // char *
|
list_t *marks; // char *
|
||||||
struct wlr_texture *marks_focused;
|
|
||||||
struct wlr_texture *marks_focused_inactive;
|
|
||||||
struct wlr_texture *marks_focused_tab_title;
|
|
||||||
struct wlr_texture *marks_unfocused;
|
|
||||||
struct wlr_texture *marks_urgent;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
@ -151,19 +163,6 @@ void container_begin_destroy(struct sway_container *con);
|
||||||
struct sway_container *container_find_child(struct sway_container *container,
|
struct sway_container *container_find_child(struct sway_container *container,
|
||||||
bool (*test)(struct sway_container *view, void *data), void *data);
|
bool (*test)(struct sway_container *view, void *data), void *data);
|
||||||
|
|
||||||
/**
|
|
||||||
* Find a container at the given coordinates. Returns the surface and
|
|
||||||
* surface-local coordinates of the given layout coordinates if the container
|
|
||||||
* is a view and the view contains a surface at those coordinates.
|
|
||||||
*/
|
|
||||||
struct sway_container *container_at(struct sway_workspace *workspace,
|
|
||||||
double lx, double ly, struct wlr_surface **surface,
|
|
||||||
double *sx, double *sy);
|
|
||||||
|
|
||||||
struct sway_container *tiling_container_at(
|
|
||||||
struct sway_node *parent, double lx, double ly,
|
|
||||||
struct wlr_surface **surface, double *sx, double *sy);
|
|
||||||
|
|
||||||
void container_for_each_child(struct sway_container *container,
|
void container_for_each_child(struct sway_container *container,
|
||||||
void (*f)(struct sway_container *container, void *data), void *data);
|
void (*f)(struct sway_container *container, void *data), void *data);
|
||||||
|
|
||||||
|
@ -178,15 +177,15 @@ struct sway_container *container_obstructing_fullscreen_container(struct sway_co
|
||||||
bool container_has_ancestor(struct sway_container *container,
|
bool container_has_ancestor(struct sway_container *container,
|
||||||
struct sway_container *ancestor);
|
struct sway_container *ancestor);
|
||||||
|
|
||||||
void container_update_textures_recursive(struct sway_container *con);
|
|
||||||
|
|
||||||
void container_damage_whole(struct sway_container *container);
|
|
||||||
|
|
||||||
void container_reap_empty(struct sway_container *con);
|
void container_reap_empty(struct sway_container *con);
|
||||||
|
|
||||||
struct sway_container *container_flatten(struct sway_container *container);
|
struct sway_container *container_flatten(struct sway_container *container);
|
||||||
|
|
||||||
void container_update_title_textures(struct sway_container *container);
|
void container_update_title_bar(struct sway_container *container);
|
||||||
|
|
||||||
|
void container_update_marks(struct sway_container *container);
|
||||||
|
|
||||||
|
size_t parse_title_format(struct sway_container *container, char *buffer);
|
||||||
|
|
||||||
size_t container_build_representation(enum sway_container_layout layout,
|
size_t container_build_representation(enum sway_container_layout layout,
|
||||||
list_t *children, char *buffer);
|
list_t *children, char *buffer);
|
||||||
|
@ -222,11 +221,6 @@ void container_set_geometry_from_content(struct sway_container *con);
|
||||||
*/
|
*/
|
||||||
bool container_is_floating(struct sway_container *container);
|
bool container_is_floating(struct sway_container *container);
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as above, but for current container state.
|
|
||||||
*/
|
|
||||||
bool container_is_current_floating(struct sway_container *container);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a container's box in layout coordinates.
|
* Get a container's box in layout coordinates.
|
||||||
*/
|
*/
|
||||||
|
@ -289,26 +283,12 @@ bool container_is_floating_or_child(struct sway_container *container);
|
||||||
*/
|
*/
|
||||||
bool container_is_fullscreen_or_child(struct sway_container *container);
|
bool container_is_fullscreen_or_child(struct sway_container *container);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the output which will be used for scale purposes.
|
|
||||||
* This is the most recently entered output.
|
|
||||||
* If the container is not on any output, return NULL.
|
|
||||||
*/
|
|
||||||
struct sway_output *container_get_effective_output(struct sway_container *con);
|
|
||||||
|
|
||||||
void container_discover_outputs(struct sway_container *con);
|
|
||||||
|
|
||||||
enum sway_container_layout container_parent_layout(struct sway_container *con);
|
enum sway_container_layout container_parent_layout(struct sway_container *con);
|
||||||
|
|
||||||
enum sway_container_layout container_current_parent_layout(
|
|
||||||
struct sway_container *con);
|
|
||||||
|
|
||||||
list_t *container_get_siblings(struct sway_container *container);
|
list_t *container_get_siblings(struct sway_container *container);
|
||||||
|
|
||||||
int container_sibling_index(struct sway_container *child);
|
int container_sibling_index(struct sway_container *child);
|
||||||
|
|
||||||
list_t *container_get_current_siblings(struct sway_container *container);
|
|
||||||
|
|
||||||
void container_handle_fullscreen_reparent(struct sway_container *con);
|
void container_handle_fullscreen_reparent(struct sway_container *con);
|
||||||
|
|
||||||
void container_add_child(struct sway_container *parent,
|
void container_add_child(struct sway_container *parent,
|
||||||
|
@ -356,8 +336,6 @@ bool container_has_mark(struct sway_container *container, char *mark);
|
||||||
|
|
||||||
void container_add_mark(struct sway_container *container, char *mark);
|
void container_add_mark(struct sway_container *container, char *mark);
|
||||||
|
|
||||||
void container_update_marks_textures(struct sway_container *container);
|
|
||||||
|
|
||||||
void container_raise_floating(struct sway_container *con);
|
void container_raise_floating(struct sway_container *con);
|
||||||
|
|
||||||
bool container_is_scratchpad_hidden(struct sway_container *con);
|
bool container_is_scratchpad_hidden(struct sway_container *con);
|
||||||
|
@ -381,4 +359,10 @@ bool container_is_sticky_or_child(struct sway_container *con);
|
||||||
*/
|
*/
|
||||||
int container_squash(struct sway_container *con);
|
int container_squash(struct sway_container *con);
|
||||||
|
|
||||||
|
void container_arrange_title_bar(struct sway_container *con);
|
||||||
|
|
||||||
|
void container_update(struct sway_container *con);
|
||||||
|
|
||||||
|
void container_update_itself_and_parents(struct sway_container *con);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _SWAY_NODE_H
|
#define _SWAY_NODE_H
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
#define MIN_SANE_W 100
|
#define MIN_SANE_W 100
|
||||||
|
@ -75,4 +76,15 @@ list_t *node_get_children(struct sway_node *node);
|
||||||
|
|
||||||
bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor);
|
bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor);
|
||||||
|
|
||||||
|
// when destroying a sway tree, it's not known which order the tree will be
|
||||||
|
// destroyed. To prevent freeing of scene_nodes recursing up the tree,
|
||||||
|
// let's use this helper function to disown them to the staging node.
|
||||||
|
void scene_node_disown_children(struct wlr_scene_tree *tree);
|
||||||
|
|
||||||
|
// a helper function used to allocate tree nodes. If an allocation failure
|
||||||
|
// occurs a flag is flipped that can be checked later to destroy a parent
|
||||||
|
// of this scene node preventing memory leaks.
|
||||||
|
struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent,
|
||||||
|
bool *failed);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
#define _SWAY_ROOT_H
|
#define _SWAY_ROOT_H
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/render/wlr_texture.h>
|
#include <wlr/render/wlr_texture.h>
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
#include "config.h"
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
extern struct sway_root *root;
|
extern struct sway_root *root;
|
||||||
|
@ -15,11 +16,43 @@ struct sway_root {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
struct wlr_output_layout *output_layout;
|
struct wlr_output_layout *output_layout;
|
||||||
|
|
||||||
struct wl_listener output_layout_change;
|
// scene node layout:
|
||||||
#if HAVE_XWAYLAND
|
// - root
|
||||||
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
// - staging
|
||||||
|
// - layer shell stuff
|
||||||
|
// - tiling
|
||||||
|
// - floating
|
||||||
|
// - fullscreen stuff
|
||||||
|
// - seat stuff
|
||||||
|
// - ext_session_lock
|
||||||
|
struct wlr_scene *root_scene;
|
||||||
|
|
||||||
|
// since wlr_scene nodes can't be orphaned and must always
|
||||||
|
// have a parent, use this staging scene_tree so that a
|
||||||
|
// node always have a valid parent. Nothing in this
|
||||||
|
// staging node will be visible.
|
||||||
|
struct wlr_scene_tree *staging;
|
||||||
|
|
||||||
|
// tree containing all layers the compositor will render. Cursor handling
|
||||||
|
// will end up iterating this tree.
|
||||||
|
struct wlr_scene_tree *layer_tree;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *shell_background;
|
||||||
|
struct wlr_scene_tree *shell_bottom;
|
||||||
|
struct wlr_scene_tree *tiling;
|
||||||
|
struct wlr_scene_tree *floating;
|
||||||
|
struct wlr_scene_tree *shell_top;
|
||||||
|
struct wlr_scene_tree *fullscreen;
|
||||||
|
struct wlr_scene_tree *fullscreen_global;
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
|
struct wlr_scene_tree *unmanaged;
|
||||||
#endif
|
#endif
|
||||||
struct wl_list drag_icons; // sway_drag_icon::link
|
struct wlr_scene_tree *shell_overlay;
|
||||||
|
struct wlr_scene_tree *popup;
|
||||||
|
struct wlr_scene_tree *seat;
|
||||||
|
struct wlr_scene_tree *session_lock;
|
||||||
|
} layers;
|
||||||
|
|
||||||
// Includes disabled outputs
|
// Includes disabled outputs
|
||||||
struct wl_list all_outputs; // sway_output::link
|
struct wl_list all_outputs; // sway_output::link
|
||||||
|
@ -41,7 +74,7 @@ struct sway_root {
|
||||||
} events;
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_root *root_create(void);
|
struct sway_root *root_create(struct wl_display *display);
|
||||||
|
|
||||||
void root_destroy(struct sway_root *root);
|
void root_destroy(struct sway_root *root);
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#ifndef _SWAY_VIEW_H
|
#ifndef _SWAY_VIEW_H
|
||||||
#define _SWAY_VIEW_H
|
#define _SWAY_VIEW_H
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
#include <wlr/types/wlr_tearing_control_v1.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#endif
|
#endif
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
@ -14,7 +17,7 @@ struct sway_xdg_decoration;
|
||||||
|
|
||||||
enum sway_view_type {
|
enum sway_view_type {
|
||||||
SWAY_VIEW_XDG_SHELL,
|
SWAY_VIEW_XDG_SHELL,
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
SWAY_VIEW_XWAYLAND,
|
SWAY_VIEW_XWAYLAND,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -26,12 +29,18 @@ enum sway_view_prop {
|
||||||
VIEW_PROP_INSTANCE,
|
VIEW_PROP_INSTANCE,
|
||||||
VIEW_PROP_WINDOW_TYPE,
|
VIEW_PROP_WINDOW_TYPE,
|
||||||
VIEW_PROP_WINDOW_ROLE,
|
VIEW_PROP_WINDOW_ROLE,
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
VIEW_PROP_X11_WINDOW_ID,
|
VIEW_PROP_X11_WINDOW_ID,
|
||||||
VIEW_PROP_X11_PARENT_ID,
|
VIEW_PROP_X11_PARENT_ID,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum sway_view_tearing_mode {
|
||||||
|
TEARING_OVERRIDE_FALSE,
|
||||||
|
TEARING_OVERRIDE_TRUE,
|
||||||
|
TEARING_WINDOW_HINT,
|
||||||
|
};
|
||||||
|
|
||||||
struct sway_view_impl {
|
struct sway_view_impl {
|
||||||
void (*get_constraints)(struct sway_view *view, double *min_width,
|
void (*get_constraints)(struct sway_view *view, double *min_width,
|
||||||
double *max_width, double *min_height, double *max_height);
|
double *max_width, double *min_height, double *max_height);
|
||||||
|
@ -45,10 +54,6 @@ struct sway_view_impl {
|
||||||
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
|
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
|
||||||
void (*set_resizing)(struct sway_view *view, bool resizing);
|
void (*set_resizing)(struct sway_view *view, bool resizing);
|
||||||
bool (*wants_floating)(struct sway_view *view);
|
bool (*wants_floating)(struct sway_view *view);
|
||||||
void (*for_each_surface)(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
void (*for_each_popup_surface)(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
bool (*is_transient_for)(struct sway_view *child,
|
bool (*is_transient_for)(struct sway_view *child,
|
||||||
struct sway_view *ancestor);
|
struct sway_view *ancestor);
|
||||||
void (*close)(struct sway_view *view);
|
void (*close)(struct sway_view *view);
|
||||||
|
@ -56,19 +61,14 @@ struct sway_view_impl {
|
||||||
void (*destroy)(struct sway_view *view);
|
void (*destroy)(struct sway_view *view);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_saved_buffer {
|
|
||||||
struct wlr_client_buffer *buffer;
|
|
||||||
int x, y;
|
|
||||||
int width, height;
|
|
||||||
enum wl_output_transform transform;
|
|
||||||
struct wlr_fbox source_box;
|
|
||||||
struct wl_list link; // sway_view::saved_buffers
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_view {
|
struct sway_view {
|
||||||
enum sway_view_type type;
|
enum sway_view_type type;
|
||||||
const struct sway_view_impl *impl;
|
const struct sway_view_impl *impl;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct wlr_scene_tree *content_tree;
|
||||||
|
struct wlr_scene_tree *saved_surface_tree;
|
||||||
|
|
||||||
struct sway_container *container; // NULL if unmapped and transactions finished
|
struct sway_container *container; // NULL if unmapped and transactions finished
|
||||||
struct wlr_surface *surface; // NULL for unmapped views
|
struct wlr_surface *surface; // NULL for unmapped views
|
||||||
struct sway_xdg_decoration *xdg_decoration;
|
struct sway_xdg_decoration *xdg_decoration;
|
||||||
|
@ -80,23 +80,17 @@ struct sway_view {
|
||||||
// Used when changing a view from tiled to floating.
|
// Used when changing a view from tiled to floating.
|
||||||
int natural_width, natural_height;
|
int natural_width, natural_height;
|
||||||
|
|
||||||
char *title_format;
|
|
||||||
|
|
||||||
bool using_csd;
|
bool using_csd;
|
||||||
|
|
||||||
struct timespec urgent;
|
struct timespec urgent;
|
||||||
bool allow_request_urgent;
|
bool allow_request_urgent;
|
||||||
struct wl_event_source *urgent_timer;
|
struct wl_event_source *urgent_timer;
|
||||||
|
|
||||||
struct wl_list saved_buffers; // sway_saved_buffer::link
|
|
||||||
|
|
||||||
// The geometry for whatever the client is committing, regardless of
|
// The geometry for whatever the client is committing, regardless of
|
||||||
// transaction state. Updated on every commit.
|
// transaction state. Updated on every commit.
|
||||||
struct wlr_box geometry;
|
struct wlr_box geometry;
|
||||||
|
|
||||||
// The "old" geometry during a transaction. Used to damage the old location
|
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
|
||||||
// when a transaction is applied.
|
|
||||||
struct wlr_box saved_geometry;
|
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
||||||
struct wl_listener foreign_activate_request;
|
struct wl_listener foreign_activate_request;
|
||||||
|
@ -110,7 +104,7 @@ struct sway_view {
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct wlr_xdg_toplevel *wlr_xdg_toplevel;
|
struct wlr_xdg_toplevel *wlr_xdg_toplevel;
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -119,11 +113,12 @@ struct sway_view {
|
||||||
struct wl_signal unmap;
|
struct wl_signal unmap;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
struct wl_listener surface_new_subsurface;
|
|
||||||
|
|
||||||
int max_render_time; // In milliseconds
|
int max_render_time; // In milliseconds
|
||||||
|
|
||||||
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
|
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
|
||||||
|
|
||||||
|
enum sway_view_tearing_mode tearing_mode;
|
||||||
|
enum wp_tearing_control_v1_presentation_hint tearing_hint;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_xdg_shell_view {
|
struct sway_xdg_shell_view {
|
||||||
|
@ -141,10 +136,12 @@ struct sway_xdg_shell_view {
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct sway_xwayland_view {
|
struct sway_xwayland_view {
|
||||||
struct sway_view view;
|
struct sway_view view;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *surface_tree;
|
||||||
|
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
struct wl_listener request_move;
|
struct wl_listener request_move;
|
||||||
struct wl_listener request_resize;
|
struct wl_listener request_resize;
|
||||||
|
@ -166,18 +163,18 @@ struct sway_xwayland_view {
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener override_redirect;
|
struct wl_listener override_redirect;
|
||||||
|
|
||||||
|
struct wl_listener surface_tree_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_xwayland_unmanaged {
|
struct sway_xwayland_unmanaged {
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
int lx, ly;
|
struct wlr_scene_surface *surface_scene;
|
||||||
|
|
||||||
struct wl_listener request_activate;
|
struct wl_listener request_activate;
|
||||||
struct wl_listener request_configure;
|
struct wl_listener request_configure;
|
||||||
struct wl_listener request_fullscreen;
|
struct wl_listener request_fullscreen;
|
||||||
struct wl_listener commit;
|
|
||||||
struct wl_listener set_geometry;
|
struct wl_listener set_geometry;
|
||||||
struct wl_listener associate;
|
struct wl_listener associate;
|
||||||
struct wl_listener dissociate;
|
struct wl_listener dissociate;
|
||||||
|
@ -187,46 +184,24 @@ struct sway_xwayland_unmanaged {
|
||||||
struct wl_listener override_redirect;
|
struct wl_listener override_redirect;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
struct sway_view_child;
|
|
||||||
|
|
||||||
struct sway_view_child_impl {
|
|
||||||
void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy);
|
|
||||||
void (*destroy)(struct sway_view_child *child);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A view child is a surface in the view tree, such as a subsurface or a popup.
|
|
||||||
*/
|
|
||||||
struct sway_view_child {
|
|
||||||
const struct sway_view_child_impl *impl;
|
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
|
struct sway_popup_desc {
|
||||||
|
struct wlr_scene_node *relative;
|
||||||
struct sway_view *view;
|
struct sway_view *view;
|
||||||
struct sway_view_child *parent;
|
|
||||||
struct wl_list children; // sway_view_child::link
|
|
||||||
struct wlr_surface *surface;
|
|
||||||
bool mapped;
|
|
||||||
|
|
||||||
struct wl_listener surface_commit;
|
|
||||||
struct wl_listener surface_new_subsurface;
|
|
||||||
struct wl_listener surface_map;
|
|
||||||
struct wl_listener surface_unmap;
|
|
||||||
struct wl_listener surface_destroy;
|
|
||||||
struct wl_listener view_unmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_subsurface {
|
|
||||||
struct sway_view_child child;
|
|
||||||
|
|
||||||
struct wl_listener destroy;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_xdg_popup {
|
struct sway_xdg_popup {
|
||||||
struct sway_view_child child;
|
struct sway_view *view;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct wlr_scene_tree *xdg_surface_tree;
|
||||||
struct wlr_xdg_popup *wlr_xdg_popup;
|
struct wlr_xdg_popup *wlr_xdg_popup;
|
||||||
|
|
||||||
|
struct sway_popup_desc desc;
|
||||||
|
|
||||||
|
struct wl_listener surface_commit;
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
|
struct wl_listener reposition;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -246,6 +221,12 @@ const char *view_get_window_role(struct sway_view *view);
|
||||||
|
|
||||||
uint32_t view_get_window_type(struct sway_view *view);
|
uint32_t view_get_window_type(struct sway_view *view);
|
||||||
|
|
||||||
|
const char *view_get_sandbox_engine(struct sway_view *view);
|
||||||
|
|
||||||
|
const char *view_get_sandbox_app_id(struct sway_view *view);
|
||||||
|
|
||||||
|
const char *view_get_sandbox_instance_id(struct sway_view *view);
|
||||||
|
|
||||||
const char *view_get_shell(struct sway_view *view);
|
const char *view_get_shell(struct sway_view *view);
|
||||||
|
|
||||||
void view_get_constraints(struct sway_view *view, double *min_width,
|
void view_get_constraints(struct sway_view *view, double *min_width,
|
||||||
|
@ -277,6 +258,11 @@ void view_set_activated(struct sway_view *view, bool activated);
|
||||||
*/
|
*/
|
||||||
void view_request_activate(struct sway_view *view, struct sway_seat *seat);
|
void view_request_activate(struct sway_view *view, struct sway_seat *seat);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called when the view requests urgent state
|
||||||
|
*/
|
||||||
|
void view_request_urgent(struct sway_view *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If possible, instructs the client to change their decoration mode.
|
* If possible, instructs the client to change their decoration mode.
|
||||||
*/
|
*/
|
||||||
|
@ -294,23 +280,9 @@ void view_close(struct sway_view *view);
|
||||||
|
|
||||||
void view_close_popups(struct sway_view *view);
|
void view_close_popups(struct sway_view *view);
|
||||||
|
|
||||||
void view_damage_from(struct sway_view *view);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate all surfaces of a view (toplevels + popups).
|
|
||||||
*/
|
|
||||||
void view_for_each_surface(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate all popup surfaces of a view.
|
|
||||||
*/
|
|
||||||
void view_for_each_popup_surface(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
|
|
||||||
// view implementation
|
// view implementation
|
||||||
|
|
||||||
void view_init(struct sway_view *view, enum sway_view_type type,
|
bool view_init(struct sway_view *view, enum sway_view_type type,
|
||||||
const struct sway_view_impl *impl);
|
const struct sway_view_impl *impl);
|
||||||
|
|
||||||
void view_destroy(struct sway_view *view);
|
void view_destroy(struct sway_view *view);
|
||||||
|
@ -332,23 +304,18 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
||||||
void view_unmap(struct sway_view *view);
|
void view_unmap(struct sway_view *view);
|
||||||
|
|
||||||
void view_update_size(struct sway_view *view);
|
void view_update_size(struct sway_view *view);
|
||||||
void view_center_surface(struct sway_view *view);
|
void view_center_and_clip_surface(struct sway_view *view);
|
||||||
|
|
||||||
void view_child_init(struct sway_view_child *child,
|
|
||||||
const struct sway_view_child_impl *impl, struct sway_view *view,
|
|
||||||
struct wlr_surface *surface);
|
|
||||||
|
|
||||||
void view_child_destroy(struct sway_view_child *child);
|
|
||||||
|
|
||||||
|
|
||||||
struct sway_view *view_from_wlr_xdg_surface(
|
struct sway_view *view_from_wlr_xdg_surface(
|
||||||
struct wlr_xdg_surface *xdg_surface);
|
struct wlr_xdg_surface *xdg_surface);
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct sway_view *view_from_wlr_xwayland_surface(
|
struct sway_view *view_from_wlr_xwayland_surface(
|
||||||
struct wlr_xwayland_surface *xsurface);
|
struct wlr_xwayland_surface *xsurface);
|
||||||
#endif
|
#endif
|
||||||
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
||||||
|
|
||||||
|
void view_update_app_id(struct sway_view *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-read the view's title property and update any relevant title bars.
|
* Re-read the view's title property and update any relevant title bars.
|
||||||
* The force argument makes it recreate the title bars even if the title hasn't
|
* The force argument makes it recreate the title bars even if the title hasn't
|
||||||
|
@ -380,4 +347,8 @@ bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
|
||||||
|
|
||||||
void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
|
void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
|
||||||
|
|
||||||
|
void view_send_frame_done(struct sway_view *view);
|
||||||
|
|
||||||
|
bool view_can_tear(struct sway_view *view);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
#define _SWAY_WORKSPACE_H
|
#define _SWAY_WORKSPACE_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
|
@ -23,6 +24,12 @@ struct sway_workspace_state {
|
||||||
|
|
||||||
struct sway_workspace {
|
struct sway_workspace {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *tiling;
|
||||||
|
struct wlr_scene_tree *fullscreen;
|
||||||
|
} layers;
|
||||||
|
|
||||||
struct sway_container *fullscreen;
|
struct sway_container *fullscreen;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
|
@ -16,4 +16,6 @@ struct sway_xdg_decoration {
|
||||||
struct sway_xdg_decoration *xdg_decoration_from_surface(
|
struct sway_xdg_decoration *xdg_decoration_from_surface(
|
||||||
struct wlr_surface *surface);
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
|
void set_xdg_decoration_mode(struct sway_xdg_decoration *deco);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
7
include/swaybar/image.h
Normal file
7
include/swaybar/image.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef _SWAYBAR_IMAGE_H
|
||||||
|
#define _SWAYBAR_IMAGE_H
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
|
cairo_surface_t *load_image(const char *path);
|
||||||
|
|
||||||
|
#endif
|
65
meson.build
65
meson.build
|
@ -1,9 +1,9 @@
|
||||||
project(
|
project(
|
||||||
'sway',
|
'sway',
|
||||||
'c',
|
'c',
|
||||||
version: '1.9-rc.2',
|
version: '1.10-dev',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.60.0',
|
meson_version: '>=1.3',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
'warning_level=2',
|
'warning_level=2',
|
||||||
|
@ -14,6 +14,7 @@ project(
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
[
|
[
|
||||||
'-DWLR_USE_UNSTABLE',
|
'-DWLR_USE_UNSTABLE',
|
||||||
|
'-D_POSIX_C_SOURCE=200809L',
|
||||||
|
|
||||||
'-Wno-unused-parameter',
|
'-Wno-unused-parameter',
|
||||||
'-Wno-unused-result',
|
'-Wno-unused-result',
|
||||||
|
@ -37,14 +38,14 @@ if is_freebsd
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Execute the wlroots subproject, if any
|
# Execute the wlroots subproject, if any
|
||||||
wlroots_version = ['>=0.17.0', '<0.18.0']
|
wlroots_version = ['>=0.19.0', '<0.20.0']
|
||||||
subproject(
|
subproject(
|
||||||
'wlroots',
|
'wlroots',
|
||||||
default_options: ['examples=false'],
|
default_options: ['examples=false'],
|
||||||
required: false,
|
required: false,
|
||||||
version: wlroots_version,
|
version: wlroots_version,
|
||||||
)
|
)
|
||||||
wlroots = dependency('wlroots', version: wlroots_version)
|
wlroots = dependency('wlroots-0.19', version: wlroots_version, fallback: 'wlroots')
|
||||||
wlroots_features = {
|
wlroots_features = {
|
||||||
'xwayland': false,
|
'xwayland': false,
|
||||||
'libinput_backend': false,
|
'libinput_backend': false,
|
||||||
|
@ -56,10 +57,6 @@ foreach name, _ : wlroots_features
|
||||||
wlroots_features += { name: have }
|
wlroots_features += { name: have }
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
|
|
||||||
error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
|
|
||||||
endif
|
|
||||||
|
|
||||||
null_dep = dependency('', required: false)
|
null_dep = dependency('', required: false)
|
||||||
|
|
||||||
jsonc = dependency('json-c', version: '>=0.13')
|
jsonc = dependency('json-c', version: '>=0.13')
|
||||||
|
@ -67,7 +64,7 @@ pcre2 = dependency('libpcre2-8')
|
||||||
wayland_server = dependency('wayland-server', version: '>=1.21.0')
|
wayland_server = dependency('wayland-server', version: '>=1.21.0')
|
||||||
wayland_client = dependency('wayland-client')
|
wayland_client = dependency('wayland-client')
|
||||||
wayland_cursor = dependency('wayland-cursor')
|
wayland_cursor = dependency('wayland-cursor')
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.24')
|
wayland_protos = dependency('wayland-protocols', version: '>=1.24', default_options: ['tests=false'])
|
||||||
xkbcommon = dependency('xkbcommon', version: '>=1.5.0')
|
xkbcommon = dependency('xkbcommon', version: '>=1.5.0')
|
||||||
cairo = dependency('cairo')
|
cairo = dependency('cairo')
|
||||||
pango = dependency('pango')
|
pango = dependency('pango')
|
||||||
|
@ -75,18 +72,15 @@ pangocairo = dependency('pangocairo')
|
||||||
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
||||||
pixman = dependency('pixman-1')
|
pixman = dependency('pixman-1')
|
||||||
libevdev = dependency('libevdev')
|
libevdev = dependency('libevdev')
|
||||||
libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.21.0') : null_dep
|
libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.26.0') : null_dep
|
||||||
xcb = dependency('xcb', required: get_option('xwayland'))
|
xcb = wlroots_features['xwayland'] ? dependency('xcb') : null_dep
|
||||||
drm_full = dependency('libdrm') # only needed for drm_fourcc.h
|
drm = dependency('libdrm')
|
||||||
drm = drm_full.partial_dependency(compile_args: true, includes: true)
|
|
||||||
libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep
|
libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep
|
||||||
math = cc.find_library('m')
|
math = cc.find_library('m')
|
||||||
rt = cc.find_library('rt')
|
rt = cc.find_library('rt')
|
||||||
xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland'))
|
xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep
|
||||||
threads = dependency('threads') # for pthread_setschedparam
|
threads = dependency('threads') # for pthread_setschedparam
|
||||||
|
|
||||||
have_xwayland = xcb.found() and xcb_icccm.found() and wlroots_features['xwayland']
|
|
||||||
|
|
||||||
if get_option('sd-bus-provider') == 'auto'
|
if get_option('sd-bus-provider') == 'auto'
|
||||||
if not get_option('tray').disabled()
|
if not get_option('tray').disabled()
|
||||||
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
||||||
|
@ -110,17 +104,14 @@ have_tray = (not get_option('tray').disabled()) and tray_deps_found
|
||||||
|
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
|
|
||||||
conf_data.set10('HAVE_XWAYLAND', have_xwayland)
|
|
||||||
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
||||||
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
|
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
|
||||||
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
|
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
|
||||||
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
|
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
|
||||||
conf_data.set10('HAVE_TRAY', have_tray)
|
conf_data.set10('HAVE_TRAY', have_tray)
|
||||||
conf_data.set10('HAVE_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', cc.has_header_symbol(
|
foreach sym : ['LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', 'LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY']
|
||||||
'libinput.h',
|
conf_data.set10('HAVE_' + sym, cc.has_header_symbol('libinput.h', sym, dependencies: libinput))
|
||||||
'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM',
|
endforeach
|
||||||
dependencies: libinput,
|
|
||||||
))
|
|
||||||
|
|
||||||
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
||||||
if scdoc.found()
|
if scdoc.found()
|
||||||
|
@ -167,8 +158,8 @@ add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir
|
||||||
version = '"@0@"'.format(meson.project_version())
|
version = '"@0@"'.format(meson.project_version())
|
||||||
git = find_program('git', native: true, required: false)
|
git = find_program('git', native: true, required: false)
|
||||||
if git.found()
|
if git.found()
|
||||||
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false)
|
git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
|
||||||
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
||||||
if git_commit.returncode() == 0 and git_branch.returncode() == 0
|
if git_commit.returncode() == 0 and git_branch.returncode() == 0
|
||||||
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
|
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
|
||||||
meson.project_version(),
|
meson.project_version(),
|
||||||
|
@ -179,31 +170,10 @@ if git.found()
|
||||||
endif
|
endif
|
||||||
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
||||||
|
|
||||||
# Compute the relative path used by compiler invocations.
|
fs = import('fs')
|
||||||
source_root = meson.current_source_dir().split('/')
|
|
||||||
build_root = meson.global_build_root().split('/')
|
|
||||||
relative_dir_parts = []
|
|
||||||
i = 0
|
|
||||||
in_prefix = true
|
|
||||||
foreach p : build_root
|
|
||||||
if i >= source_root.length() or not in_prefix or p != source_root[i]
|
|
||||||
in_prefix = false
|
|
||||||
relative_dir_parts += '..'
|
|
||||||
endif
|
|
||||||
i += 1
|
|
||||||
endforeach
|
|
||||||
i = 0
|
|
||||||
in_prefix = true
|
|
||||||
foreach p : source_root
|
|
||||||
if i >= build_root.length() or not in_prefix or build_root[i] != p
|
|
||||||
in_prefix = false
|
|
||||||
relative_dir_parts += p
|
|
||||||
endif
|
|
||||||
i += 1
|
|
||||||
endforeach
|
|
||||||
relative_dir = join_paths(relative_dir_parts) + '/'
|
|
||||||
|
|
||||||
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
||||||
|
relative_dir = fs.relative_to(meson.current_source_dir(), meson.global_build_root()) + '/'
|
||||||
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
||||||
|
@ -271,7 +241,6 @@ endif
|
||||||
subdir('completions')
|
subdir('completions')
|
||||||
|
|
||||||
summary({
|
summary({
|
||||||
'xwayland': have_xwayland,
|
|
||||||
'gdk-pixbuf': gdk_pixbuf.found(),
|
'gdk-pixbuf': gdk_pixbuf.found(),
|
||||||
'tray': have_tray,
|
'tray': have_tray,
|
||||||
'man-pages': scdoc.found(),
|
'man-pages': scdoc.found(),
|
||||||
|
|
|
@ -4,7 +4,6 @@ option('bash-completions', type: 'boolean', value: true, description: 'Install b
|
||||||
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
||||||
option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar')
|
option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar')
|
||||||
option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag')
|
option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag')
|
||||||
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
|
|
||||||
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
|
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
|
||||||
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray')
|
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray')
|
||||||
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
||||||
|
|
|
@ -7,16 +7,19 @@ wayland_scanner = find_program(
|
||||||
)
|
)
|
||||||
|
|
||||||
protocols = [
|
protocols = [
|
||||||
|
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
|
||||||
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
||||||
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
|
||||||
wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
|
|
||||||
wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml',
|
|
||||||
wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
|
||||||
wl_protocol_dir / 'staging/content-type/content-type-v1.xml',
|
wl_protocol_dir / 'staging/content-type/content-type-v1.xml',
|
||||||
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
||||||
|
wl_protocol_dir / 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml',
|
||||||
|
wl_protocol_dir / 'staging/ext-image-capture-source/ext-image-capture-source-v1.xml',
|
||||||
|
wl_protocol_dir / 'staging/ext-image-copy-capture/ext-image-copy-capture-v1.xml',
|
||||||
|
wl_protocol_dir / 'staging/tearing-control/tearing-control-v1.xml',
|
||||||
|
wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
||||||
|
wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
|
||||||
|
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
||||||
'wlr-layer-shell-unstable-v1.xml',
|
'wlr-layer-shell-unstable-v1.xml',
|
||||||
'idle.xml',
|
'idle.xml',
|
||||||
'wlr-input-inhibitor-unstable-v1.xml',
|
|
||||||
'wlr-output-power-management-unstable-v1.xml',
|
'wlr-output-power-management-unstable-v1.xml',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<protocol name="wlr_input_inhibit_unstable_v1">
|
|
||||||
<copyright>
|
|
||||||
Copyright © 2018 Drew DeVault
|
|
||||||
|
|
||||||
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.
|
|
||||||
</copyright>
|
|
||||||
|
|
||||||
<interface name="zwlr_input_inhibit_manager_v1" version="1">
|
|
||||||
<description summary="inhibits input events to other clients">
|
|
||||||
Clients can use this interface to prevent input events from being sent to
|
|
||||||
any surfaces but its own, which is useful for example in lock screen
|
|
||||||
software. It is assumed that access to this interface will be locked down
|
|
||||||
to whitelisted clients by the compositor.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="get_inhibitor">
|
|
||||||
<description summary="inhibit input to other clients">
|
|
||||||
Activates the input inhibitor. As long as the inhibitor is active, the
|
|
||||||
compositor will not send input events to other clients.
|
|
||||||
</description>
|
|
||||||
<arg name="id" type="new_id" interface="zwlr_input_inhibitor_v1"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<enum name="error">
|
|
||||||
<entry name="already_inhibited" value="0" summary="an input inhibitor is already in use on the compositor"/>
|
|
||||||
</enum>
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
<interface name="zwlr_input_inhibitor_v1" version="1">
|
|
||||||
<description summary="inhibits input to other clients">
|
|
||||||
While this resource exists, input to clients other than the owner of the
|
|
||||||
inhibitor resource will not receive input events. The client that owns
|
|
||||||
this resource will receive all input events normally. The compositor will
|
|
||||||
also disable all of its own input processing (such as keyboard shortcuts)
|
|
||||||
while the inhibitor is active.
|
|
||||||
|
|
||||||
The compositor may continue to send input events to selected clients,
|
|
||||||
such as an on-screen keyboard (via the input-method protocol).
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
|
||||||
<description summary="destroy the input inhibitor object">
|
|
||||||
Destroy the inhibitor and allow other clients to receive input.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
</interface>
|
|
||||||
</protocol>
|
|
32
release.sh
Executable file
32
release.sh
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh -eu
|
||||||
|
|
||||||
|
prev=$(git describe --tags --abbrev=0)
|
||||||
|
next=$(meson rewrite kwargs info project / | jq -r '.kwargs["project#/"].version')
|
||||||
|
|
||||||
|
case "$next" in
|
||||||
|
*-dev)
|
||||||
|
echo "This is a development version"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$prev" = "$next" ]; then
|
||||||
|
echo "Version not bumped in meson.build"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff-index --quiet HEAD -- meson.build; then
|
||||||
|
echo "meson.build not committed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
shortlog="$(git shortlog --no-merges "$prev..")"
|
||||||
|
(echo "sway $next"; echo ""; echo "$shortlog") | git tag "$next" -ase -F -
|
||||||
|
|
||||||
|
prefix=sway-$next
|
||||||
|
archive=$prefix.tar.gz
|
||||||
|
git archive --prefix="$prefix/" -o "$archive" "$next"
|
||||||
|
gpg --output "$archive".sig --detach-sig "$archive"
|
||||||
|
|
||||||
|
git push --follow-tags
|
||||||
|
gh release create "sway $next" -t "$next" -n "" -d "$archive" "$archive.sig"
|
|
@ -3,3 +3,4 @@ Name=Sway
|
||||||
Comment=An i3-compatible Wayland compositor
|
Comment=An i3-compatible Wayland compositor
|
||||||
Exec=sway
|
Exec=sway
|
||||||
Type=Application
|
Type=Application
|
||||||
|
DesktopNames=sway;wlroots
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -82,7 +81,6 @@ static const struct cmd_handler handlers[] = {
|
||||||
{ "no_focus", cmd_no_focus },
|
{ "no_focus", cmd_no_focus },
|
||||||
{ "output", cmd_output },
|
{ "output", cmd_output },
|
||||||
{ "popup_during_fullscreen", cmd_popup_during_fullscreen },
|
{ "popup_during_fullscreen", cmd_popup_during_fullscreen },
|
||||||
{ "primary_selection", cmd_primary_selection },
|
|
||||||
{ "seat", cmd_seat },
|
{ "seat", cmd_seat },
|
||||||
{ "set", cmd_set },
|
{ "set", cmd_set },
|
||||||
{ "show_marks", cmd_show_marks },
|
{ "show_marks", cmd_show_marks },
|
||||||
|
@ -105,6 +103,7 @@ static const struct cmd_handler handlers[] = {
|
||||||
static const struct cmd_handler config_handlers[] = {
|
static const struct cmd_handler config_handlers[] = {
|
||||||
{ "default_orientation", cmd_default_orientation },
|
{ "default_orientation", cmd_default_orientation },
|
||||||
{ "include", cmd_include },
|
{ "include", cmd_include },
|
||||||
|
{ "primary_selection", cmd_primary_selection },
|
||||||
{ "swaybg_command", cmd_swaybg_command },
|
{ "swaybg_command", cmd_swaybg_command },
|
||||||
{ "swaynag_command", cmd_swaynag_command },
|
{ "swaynag_command", cmd_swaynag_command },
|
||||||
{ "workspace_layout", cmd_workspace_layout },
|
{ "workspace_layout", cmd_workspace_layout },
|
||||||
|
@ -113,6 +112,7 @@ static const struct cmd_handler config_handlers[] = {
|
||||||
|
|
||||||
/* Runtime-only commands. Keep alphabetized */
|
/* Runtime-only commands. Keep alphabetized */
|
||||||
static const struct cmd_handler command_handlers[] = {
|
static const struct cmd_handler command_handlers[] = {
|
||||||
|
{ "allow_tearing", cmd_allow_tearing },
|
||||||
{ "border", cmd_border },
|
{ "border", cmd_border },
|
||||||
{ "create_output", cmd_create_output },
|
{ "create_output", cmd_create_output },
|
||||||
{ "exit", cmd_exit },
|
{ "exit", cmd_exit },
|
||||||
|
|
24
sway/commands/allow_tearing.c
Normal file
24
sway/commands/allow_tearing.c
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
#include <sway/commands.h>
|
||||||
|
#include "sway/config.h"
|
||||||
|
#include "sway/tree/view.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
struct cmd_results *cmd_allow_tearing(int argc, char **argv) {
|
||||||
|
struct cmd_results *error = NULL;
|
||||||
|
if ((error = checkarg(argc, "allow_tearing", EXPECTED_AT_LEAST, 1))) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct sway_container *container = config->handler_context.container;
|
||||||
|
if (!container || !container->view) {
|
||||||
|
return cmd_results_new(CMD_INVALID, "Tearing can only be allowed on views");
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wants_tearing = parse_boolean(argv[0], true);
|
||||||
|
|
||||||
|
struct sway_view *view = container->view;
|
||||||
|
view->tearing_mode = wants_tearing ? TEARING_OVERRIDE_TRUE :
|
||||||
|
TEARING_OVERRIDE_FALSE;
|
||||||
|
|
||||||
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
@ -24,7 +23,7 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
|
||||||
|
|
||||||
--argc; ++argv;
|
--argc; ++argv;
|
||||||
|
|
||||||
if (strncmp(*argv, "→", strlen("→")) == 0) {
|
if (has_prefix(*argv, "→")) {
|
||||||
if (argc < 2) {
|
if (argc < 2) {
|
||||||
free(criteria);
|
free(criteria);
|
||||||
return cmd_results_new(CMD_INVALID, "Missing workspace");
|
return cmd_results_new(CMD_INVALID, "Missing workspace");
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
@ -12,7 +11,7 @@ struct cmd_results *bar_cmd_font(int argc, char **argv) {
|
||||||
char *font = join_args(argv, argc);
|
char *font = join_args(argv, argc);
|
||||||
free(config->current_bar->font);
|
free(config->current_bar->font);
|
||||||
|
|
||||||
if (strncmp(font, "pango:", 6) == 0) {
|
if (has_prefix(font, "pango:")) {
|
||||||
if (config->current_bar->pango_markup == PANGO_MARKUP_DEFAULT) {
|
if (config->current_bar->pango_markup == PANGO_MARKUP_DEFAULT) {
|
||||||
config->current_bar->pango_markup = true;
|
config->current_bar->pango_markup = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <libevdev/libevdev.h>
|
#include <libevdev/libevdev.h>
|
||||||
#include <linux/input-event-codes.h>
|
#include <linux/input-event-codes.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -368,8 +367,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
||||||
}
|
}
|
||||||
} else if (strcmp("--exclude-titlebar", argv[0]) == 0) {
|
} else if (strcmp("--exclude-titlebar", argv[0]) == 0) {
|
||||||
exclude_titlebar = true;
|
exclude_titlebar = true;
|
||||||
} else if (strncmp("--input-device=", argv[0],
|
} else if (has_prefix(argv[0], "--input-device=")) {
|
||||||
strlen("--input-device=")) == 0) {
|
|
||||||
free(binding->input);
|
free(binding->input);
|
||||||
binding->input = strdup(argv[0] + strlen("--input-device="));
|
binding->input = strdup(argv[0] + strlen("--input-device="));
|
||||||
strip_quotes(binding->input);
|
strip_quotes(binding->input);
|
||||||
|
@ -400,7 +398,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
||||||
list_t *split = split_string(argv[0], "+");
|
list_t *split = split_string(argv[0], "+");
|
||||||
for (int i = 0; i < split->length; ++i) {
|
for (int i = 0; i < split->length; ++i) {
|
||||||
// Check for group
|
// Check for group
|
||||||
if (strncmp(split->items[i], "Group", strlen("Group")) == 0) {
|
if (has_prefix(split->items[i], "Group")) {
|
||||||
if (binding->group != XKB_LAYOUT_INVALID) {
|
if (binding->group != XKB_LAYOUT_INVALID) {
|
||||||
free_sway_binding(binding);
|
free_sway_binding(binding);
|
||||||
list_free_items_and_destroy(split);
|
list_free_items_and_destroy(split);
|
||||||
|
|
|
@ -5,9 +5,8 @@
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static void rebuild_textures_iterator(struct sway_container *con, void *data) {
|
static void container_update_iterator(struct sway_container *con, void *data) {
|
||||||
container_update_marks_textures(con);
|
container_update(con);
|
||||||
container_update_title_textures(con);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name,
|
static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name,
|
||||||
|
@ -51,12 +50,7 @@ static struct cmd_results *handle_command(int argc, char **argv, char *cmd_name,
|
||||||
memcpy(class, &colors, sizeof(struct border_colors));
|
memcpy(class, &colors, sizeof(struct border_colors));
|
||||||
|
|
||||||
if (config->active) {
|
if (config->active) {
|
||||||
root_for_each_container(rebuild_textures_iterator, NULL);
|
root_for_each_container(container_update_iterator, NULL);
|
||||||
|
|
||||||
for (int i = 0; i < root->outputs->length; ++i) {
|
|
||||||
struct sway_output *output = root->outputs->items[i];
|
|
||||||
output_damage_whole(output);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
@ -26,16 +25,6 @@ struct cmd_results *cmd_exec_validate(int argc, char **argv) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void export_xdga_token(struct launcher_ctx *ctx) {
|
|
||||||
const char *token = launcher_ctx_get_token_name(ctx);
|
|
||||||
setenv("XDG_ACTIVATION_TOKEN", token, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
static void export_startup_id(struct launcher_ctx *ctx) {
|
|
||||||
const char *token = launcher_ctx_get_token_name(ctx);
|
|
||||||
setenv("DESKTOP_STARTUP_ID", token, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
struct cmd_results *cmd_exec_process(int argc, char **argv) {
|
struct cmd_results *cmd_exec_process(int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
char *cmd = NULL;
|
char *cmd = NULL;
|
||||||
|
@ -57,67 +46,39 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) {
|
||||||
|
|
||||||
sway_log(SWAY_DEBUG, "Executing %s", cmd);
|
sway_log(SWAY_DEBUG, "Executing %s", cmd);
|
||||||
|
|
||||||
int fd[2];
|
|
||||||
if (pipe(fd) != 0) {
|
|
||||||
sway_log(SWAY_ERROR, "Unable to create pipe for fork");
|
|
||||||
}
|
|
||||||
|
|
||||||
pid_t pid, child;
|
|
||||||
struct launcher_ctx *ctx = launcher_ctx_create_internal();
|
struct launcher_ctx *ctx = launcher_ctx_create_internal();
|
||||||
|
|
||||||
// Fork process
|
// Fork process
|
||||||
if ((pid = fork()) == 0) {
|
pid_t child = fork();
|
||||||
// Fork child process again
|
if (child == 0) {
|
||||||
restore_nofile_limit();
|
restore_nofile_limit();
|
||||||
|
restore_signals();
|
||||||
setsid();
|
setsid();
|
||||||
sigset_t set;
|
|
||||||
sigemptyset(&set);
|
if (ctx) {
|
||||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
const char *token = launcher_ctx_get_token_name(ctx);
|
||||||
signal(SIGPIPE, SIG_DFL);
|
setenv("XDG_ACTIVATION_TOKEN", token, 1);
|
||||||
close(fd[0]);
|
if (!no_startup_id) {
|
||||||
if ((child = fork()) == 0) {
|
setenv("DESKTOP_STARTUP_ID", token, 1);
|
||||||
close(fd[1]);
|
|
||||||
if (ctx) {
|
|
||||||
export_xdga_token(ctx);
|
|
||||||
}
|
}
|
||||||
if (ctx && !no_startup_id) {
|
|
||||||
export_startup_id(ctx);
|
|
||||||
}
|
|
||||||
execlp("sh", "sh", "-c", cmd, (void *)NULL);
|
|
||||||
sway_log_errno(SWAY_ERROR, "execlp failed");
|
|
||||||
_exit(1);
|
|
||||||
}
|
}
|
||||||
ssize_t s = 0;
|
|
||||||
while ((size_t)s < sizeof(pid_t)) {
|
execlp("sh", "sh", "-c", cmd, (void*)NULL);
|
||||||
s += write(fd[1], ((uint8_t *)&child) + s, sizeof(pid_t) - s);
|
sway_log_errno(SWAY_ERROR, "execve failed");
|
||||||
}
|
|
||||||
close(fd[1]);
|
|
||||||
_exit(0); // Close child process
|
_exit(0); // Close child process
|
||||||
} else if (pid < 0) {
|
} else if (child < 0) {
|
||||||
|
launcher_ctx_destroy(ctx);
|
||||||
free(cmd);
|
free(cmd);
|
||||||
close(fd[0]);
|
|
||||||
close(fd[1]);
|
|
||||||
return cmd_results_new(CMD_FAILURE, "fork() failed");
|
return cmd_results_new(CMD_FAILURE, "fork() failed");
|
||||||
}
|
}
|
||||||
free(cmd);
|
|
||||||
close(fd[1]); // close write
|
sway_log(SWAY_DEBUG, "Child process created with pid %d", child);
|
||||||
ssize_t s = 0;
|
if (ctx != NULL) {
|
||||||
while ((size_t)s < sizeof(pid_t)) {
|
sway_log(SWAY_DEBUG, "Recording workspace for process %d", child);
|
||||||
s += read(fd[0], ((uint8_t *)&child) + s, sizeof(pid_t) - s);
|
ctx->pid = child;
|
||||||
}
|
|
||||||
close(fd[0]);
|
|
||||||
// cleanup child process
|
|
||||||
waitpid(pid, NULL, 0);
|
|
||||||
if (child > 0) {
|
|
||||||
sway_log(SWAY_DEBUG, "Child process created with pid %d", child);
|
|
||||||
if (ctx != NULL) {
|
|
||||||
sway_log(SWAY_DEBUG, "Recording workspace for process %d", child);
|
|
||||||
ctx->pid = child;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
launcher_ctx_destroy(ctx);
|
|
||||||
return cmd_results_new(CMD_FAILURE, "Second fork() failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(cmd);
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
@ -14,9 +13,9 @@ struct cmd_results *cmd_font(int argc, char **argv) {
|
||||||
char *font = join_args(argv, argc);
|
char *font = join_args(argv, argc);
|
||||||
free(config->font);
|
free(config->font);
|
||||||
|
|
||||||
if (strncmp(font, "pango:", 6) == 0) {
|
if (has_prefix(font, "pango:")) {
|
||||||
config->pango_markup = true;
|
config->pango_markup = true;
|
||||||
config->font = strdup(font + 6);
|
config->font = strdup(font + strlen("pango:"));
|
||||||
free(font);
|
free(font);
|
||||||
} else {
|
} else {
|
||||||
config->pango_markup = false;
|
config->pango_markup = false;
|
||||||
|
|
|
@ -215,15 +215,13 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool config_loading = !config->active || config->reloading;
|
|
||||||
|
|
||||||
if (argc == 2) {
|
if (argc == 2) {
|
||||||
return gaps_set_defaults(argc, argv);
|
return gaps_set_defaults(argc, argv);
|
||||||
}
|
}
|
||||||
if (argc == 4 && !config_loading) {
|
if (argc == 4 && !config->reading) {
|
||||||
return gaps_set_runtime(argc, argv);
|
return gaps_set_runtime(argc, argv);
|
||||||
}
|
}
|
||||||
if (config_loading) {
|
if (config->reading) {
|
||||||
return cmd_results_new(CMD_INVALID, "Expected %s", expected_defaults);
|
return cmd_results_new(CMD_INVALID, "Expected %s", expected_defaults);
|
||||||
}
|
}
|
||||||
return cmd_results_new(CMD_INVALID, "Expected %s or %s",
|
return cmd_results_new(CMD_INVALID, "Expected %s or %s",
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
|
||||||
#include "gesture.h"
|
#include "gesture.h"
|
||||||
|
@ -122,8 +121,7 @@ static struct cmd_results *cmd_bind_or_unbind_gesture(int argc, char **argv, boo
|
||||||
binding->flags |= BINDING_EXACT;
|
binding->flags |= BINDING_EXACT;
|
||||||
} else if (strcmp("--no-warn", argv[0]) == 0) {
|
} else if (strcmp("--no-warn", argv[0]) == 0) {
|
||||||
warn = false;
|
warn = false;
|
||||||
} else if (strncmp("--input-device=", argv[0],
|
} else if (has_prefix(argv[0], "--input-device=")) {
|
||||||
strlen("--input-device=")) == 0) {
|
|
||||||
free(binding->input);
|
free(binding->input);
|
||||||
binding->input = strdup(argv[0] + strlen("--input-device="));
|
binding->input = strdup(argv[0] + strlen("--input-device="));
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -3,12 +3,12 @@
|
||||||
|
|
||||||
struct cmd_results *cmd_include(int argc, char **argv) {
|
struct cmd_results *cmd_include(int argc, char **argv) {
|
||||||
struct cmd_results *error = NULL;
|
struct cmd_results *error = NULL;
|
||||||
if ((error = checkarg(argc, "include", EXPECTED_EQUAL_TO, 1))) {
|
if ((error = checkarg(argc, "include", EXPECTED_AT_LEAST, 1))) {
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
char *files = join_args(argv, argc);
|
||||||
// We don't care if the included config(s) fails to load.
|
// We don't care if the included config(s) fails to load.
|
||||||
load_include_configs(argv[0], config, &config->swaynag_config_errors);
|
load_include_configs(files, config, &config->swaynag_config_errors);
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ static const struct cmd_handler input_handlers[] = {
|
||||||
{ "accel_profile", input_cmd_accel_profile },
|
{ "accel_profile", input_cmd_accel_profile },
|
||||||
{ "calibration_matrix", input_cmd_calibration_matrix },
|
{ "calibration_matrix", input_cmd_calibration_matrix },
|
||||||
{ "click_method", input_cmd_click_method },
|
{ "click_method", input_cmd_click_method },
|
||||||
|
{ "clickfinger_button_map", input_cmd_clickfinger_button_map },
|
||||||
{ "drag", input_cmd_drag },
|
{ "drag", input_cmd_drag },
|
||||||
{ "drag_lock", input_cmd_drag_lock },
|
{ "drag_lock", input_cmd_drag_lock },
|
||||||
{ "dwt", input_cmd_dwt },
|
{ "dwt", input_cmd_dwt },
|
||||||
|
@ -93,7 +94,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!config->reloading) {
|
if (!config->reading) {
|
||||||
input_manager_apply_input_config(ic);
|
input_manager_apply_input_config(ic);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
|
27
sway/commands/input/clickfinger_button_map.c
Normal file
27
sway/commands/input/clickfinger_button_map.c
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
#include <string.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include "sway/config.h"
|
||||||
|
#include "sway/commands.h"
|
||||||
|
#include "sway/input/input-manager.h"
|
||||||
|
|
||||||
|
struct cmd_results *input_cmd_clickfinger_button_map(int argc, char **argv) {
|
||||||
|
struct cmd_results *error = NULL;
|
||||||
|
if ((error = checkarg(argc, "clickfinger_button_map", EXPECTED_AT_LEAST, 1))) {
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
struct input_config *ic = config->handler_context.input_config;
|
||||||
|
if (!ic) {
|
||||||
|
return cmd_results_new(CMD_FAILURE, "No input device defined.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcasecmp(argv[0], "lrm") == 0) {
|
||||||
|
ic->clickfinger_button_map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
|
||||||
|
} else if (strcasecmp(argv[0], "lmr") == 0) {
|
||||||
|
ic->clickfinger_button_map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
|
||||||
|
} else {
|
||||||
|
return cmd_results_new(CMD_INVALID,
|
||||||
|
"Expected 'clickfinger_button_map <lrm|lmr>'");
|
||||||
|
}
|
||||||
|
|
||||||
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
}
|
|
@ -15,6 +15,11 @@ struct cmd_results *input_cmd_drag_lock(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_FAILURE, "No input device defined.");
|
return cmd_results_new(CMD_FAILURE, "No input device defined.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
|
||||||
|
if (strcmp(argv[0], "enabled_sticky") == 0) {
|
||||||
|
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY;
|
||||||
|
} else
|
||||||
|
#endif
|
||||||
if (parse_boolean(argv[0], true)) {
|
if (parse_boolean(argv[0], true)) {
|
||||||
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED;
|
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
#include "sway/server.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
#if WLR_HAS_LIBINPUT_BACKEND
|
#if WLR_HAS_LIBINPUT_BACKEND
|
||||||
|
@ -85,7 +86,7 @@ static void toggle_select_send_events_for_device(struct input_config *ic,
|
||||||
static void toggle_send_events(int argc, char **argv) {
|
static void toggle_send_events(int argc, char **argv) {
|
||||||
struct input_config *ic = config->handler_context.input_config;
|
struct input_config *ic = config->handler_context.input_config;
|
||||||
bool wildcard = strcmp(ic->identifier, "*") == 0;
|
bool wildcard = strcmp(ic->identifier, "*") == 0;
|
||||||
const char *type = strncmp(ic->identifier, "type:", strlen("type:")) == 0
|
const char *type = has_prefix(ic->identifier, "type:")
|
||||||
? ic->identifier + strlen("type:") : NULL;
|
? ic->identifier + strlen("type:") : NULL;
|
||||||
struct sway_input_device *device = NULL;
|
struct sway_input_device *device = NULL;
|
||||||
wl_list_for_each(device, &server.input->devices, link) {
|
wl_list_for_each(device, &server.input->devices, link) {
|
||||||
|
@ -145,8 +146,7 @@ struct cmd_results *input_cmd_events(int argc, char **argv) {
|
||||||
|
|
||||||
toggle_send_events(argc - 1, argv + 1);
|
toggle_send_events(argc - 1, argv + 1);
|
||||||
|
|
||||||
if (strcmp(ic->identifier, "*") == 0 ||
|
if (strcmp(ic->identifier, "*") == 0 || has_prefix(ic->identifier, "type:")) {
|
||||||
strncmp(ic->identifier, "type:", strlen("type:")) == 0) {
|
|
||||||
// Update the device input configs and then reset the type/wildcard
|
// Update the device input configs and then reset the type/wildcard
|
||||||
// config send events mode so that is does not override the device
|
// config send events mode so that is does not override the device
|
||||||
// ones. The device ones will be applied when attempting to apply
|
// ones. The device ones will be applied when attempting to apply
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <wlr/interfaces/wlr_keyboard.h>
|
#include <wlr/interfaces/wlr_keyboard.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
#include "sway/server.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
struct xkb_switch_layout_action {
|
struct xkb_switch_layout_action {
|
||||||
|
@ -95,10 +95,18 @@ struct cmd_results *input_cmd_xkb_switch_layout(int argc, char **argv) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct wlr_keyboard *keyboard =
|
||||||
|
wlr_keyboard_from_input_device(dev->wlr_device);
|
||||||
|
if (keyboard->keymap == NULL && dev->is_virtual) {
|
||||||
|
// The `sway_keyboard_set_layout` function is by default skipped
|
||||||
|
// when configuring virtual keyboards.
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
struct xkb_switch_layout_action *action =
|
struct xkb_switch_layout_action *action =
|
||||||
&actions[actions_len++];
|
&actions[actions_len++];
|
||||||
|
action->keyboard = keyboard;
|
||||||
|
|
||||||
action->keyboard = wlr_keyboard_from_input_device(dev->wlr_device);
|
|
||||||
if (relative) {
|
if (relative) {
|
||||||
action->layout = get_layout_relative(action->keyboard, relative);
|
action->layout = get_layout_relative(action->keyboard, relative);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
@ -24,7 +23,7 @@ struct cmd_results *cmd_mark(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool add = false, toggle = false;
|
bool add = false, toggle = false;
|
||||||
while (argc > 0 && strncmp(*argv, "--", 2) == 0) {
|
while (argc > 0 && has_prefix(*argv, "--")) {
|
||||||
if (strcmp(*argv, "--add") == 0) {
|
if (strcmp(*argv, "--add") == 0) {
|
||||||
add = true;
|
add = true;
|
||||||
} else if (strcmp(*argv, "--replace") == 0) {
|
} else if (strcmp(*argv, "--replace") == 0) {
|
||||||
|
@ -59,7 +58,7 @@ struct cmd_results *cmd_mark(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
free(mark);
|
free(mark);
|
||||||
container_update_marks_textures(container);
|
container_update_marks(container);
|
||||||
if (container->view) {
|
if (container->view) {
|
||||||
view_execute_criteria(container->view);
|
view_execute_criteria(container->view);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
@ -12,6 +11,7 @@
|
||||||
#include "sway/input/seat.h"
|
#include "sway/input/seat.h"
|
||||||
#include "sway/ipc-server.h"
|
#include "sway/ipc-server.h"
|
||||||
#include "sway/output.h"
|
#include "sway/output.h"
|
||||||
|
#include "sway/server.h"
|
||||||
#include "sway/tree/arrange.h"
|
#include "sway/tree/arrange.h"
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "sway/tree/root.h"
|
#include "sway/tree/root.h"
|
||||||
|
@ -240,7 +240,6 @@ static void container_move_to_workspace(struct sway_container *container,
|
||||||
static void container_move_to_container(struct sway_container *container,
|
static void container_move_to_container(struct sway_container *container,
|
||||||
struct sway_container *destination) {
|
struct sway_container *destination) {
|
||||||
if (container == destination
|
if (container == destination
|
||||||
|| container_has_ancestor(container, destination)
|
|
||||||
|| container_has_ancestor(destination, container)) {
|
|| container_has_ancestor(destination, container)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -510,6 +509,7 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ws = workspace_create(NULL, ws_name);
|
ws = workspace_create(NULL, ws_name);
|
||||||
|
arrange_workspace(ws);
|
||||||
}
|
}
|
||||||
free(ws_name);
|
free(ws_name);
|
||||||
struct sway_container *dst = seat_get_focus_inactive_tiling(seat, ws);
|
struct sway_container *dst = seat_get_focus_inactive_tiling(seat, ws);
|
||||||
|
@ -770,15 +770,6 @@ static struct cmd_results *cmd_move_in_direction(
|
||||||
ipc_event_window(container, "move");
|
ipc_event_window(container, "move");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hack to re-focus container
|
|
||||||
seat_set_raw_focus(config->handler_context.seat, &new_ws->node);
|
|
||||||
seat_set_focus_container(config->handler_context.seat, container);
|
|
||||||
|
|
||||||
if (old_ws != new_ws) {
|
|
||||||
ipc_event_workspace(old_ws, new_ws, "focus");
|
|
||||||
workspace_detect_urgent(old_ws);
|
|
||||||
workspace_detect_urgent(new_ws);
|
|
||||||
}
|
|
||||||
container_end_mouse_operation(container);
|
container_end_mouse_operation(container);
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/tree/view.h"
|
#include "sway/tree/container.h"
|
||||||
|
#include "sway/output.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
struct cmd_results *cmd_opacity(int argc, char **argv) {
|
struct cmd_results *cmd_opacity(int argc, char **argv) {
|
||||||
|
@ -37,6 +38,8 @@ struct cmd_results *cmd_opacity(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
con->alpha = val;
|
con->alpha = val;
|
||||||
container_damage_whole(con);
|
output_configure_scene(NULL, &con->scene_tree->node, 1);
|
||||||
|
container_update(con);
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,8 +8,10 @@
|
||||||
// must be in order for the bsearch
|
// must be in order for the bsearch
|
||||||
static const struct cmd_handler output_handlers[] = {
|
static const struct cmd_handler output_handlers[] = {
|
||||||
{ "adaptive_sync", output_cmd_adaptive_sync },
|
{ "adaptive_sync", output_cmd_adaptive_sync },
|
||||||
|
{ "allow_tearing", output_cmd_allow_tearing },
|
||||||
{ "background", output_cmd_background },
|
{ "background", output_cmd_background },
|
||||||
{ "bg", output_cmd_background },
|
{ "bg", output_cmd_background },
|
||||||
|
{ "color_profile", output_cmd_color_profile },
|
||||||
{ "disable", output_cmd_disable },
|
{ "disable", output_cmd_disable },
|
||||||
{ "dpms", output_cmd_dpms },
|
{ "dpms", output_cmd_dpms },
|
||||||
{ "enable", output_cmd_enable },
|
{ "enable", output_cmd_enable },
|
||||||
|
@ -103,19 +105,18 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
||||||
|
|
||||||
bool background = output->background;
|
bool background = output->background;
|
||||||
|
|
||||||
output = store_output_config(output);
|
store_output_config(output);
|
||||||
|
|
||||||
// If reloading, the output configs will be applied after reading the
|
if (config->reading) {
|
||||||
// entire config and before the deferred commands so that an auto generated
|
// When reading the config file, we wait till the end to do a single
|
||||||
// workspace name is not given to re-enabled outputs.
|
// modeset and swaybg spawn.
|
||||||
if (!config->reloading && !config->validating) {
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
apply_output_config_to_outputs(output);
|
}
|
||||||
if (background) {
|
request_modeset();
|
||||||
if (!spawn_swaybg()) {
|
|
||||||
return cmd_results_new(CMD_FAILURE,
|
if (background && !spawn_swaybg()) {
|
||||||
"Failed to apply background configuration");
|
return cmd_results_new(CMD_FAILURE,
|
||||||
}
|
"Failed to apply background configuration");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
#include <strings.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
#include "sway/output.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
struct cmd_results *output_cmd_adaptive_sync(int argc, char **argv) {
|
struct cmd_results *output_cmd_adaptive_sync(int argc, char **argv) {
|
||||||
|
@ -10,12 +12,26 @@ struct cmd_results *output_cmd_adaptive_sync(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_INVALID, "Missing adaptive_sync argument");
|
return cmd_results_new(CMD_INVALID, "Missing adaptive_sync argument");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (parse_boolean(argv[0], true)) {
|
bool current_value = true;
|
||||||
config->handler_context.output_config->adaptive_sync = 1;
|
if (strcasecmp(argv[0], "toggle") == 0) {
|
||||||
} else {
|
const char *oc_name = config->handler_context.output_config->name;
|
||||||
config->handler_context.output_config->adaptive_sync = 0;
|
if (strcmp(oc_name, "*") == 0) {
|
||||||
|
return cmd_results_new(CMD_INVALID,
|
||||||
|
"Cannot apply toggle to all outputs");
|
||||||
|
}
|
||||||
|
|
||||||
|
struct sway_output *sway_output = all_output_by_name_or_id(oc_name);
|
||||||
|
if (!sway_output || !sway_output->wlr_output) {
|
||||||
|
return cmd_results_new(CMD_FAILURE,
|
||||||
|
"Cannot apply toggle to unknown output %s", oc_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
current_value =
|
||||||
|
sway_output->wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config->handler_context.output_config->adaptive_sync = parse_boolean(argv[0], current_value);
|
||||||
|
|
||||||
config->handler_context.leftovers.argc = argc - 1;
|
config->handler_context.leftovers.argc = argc - 1;
|
||||||
config->handler_context.leftovers.argv = argv + 1;
|
config->handler_context.leftovers.argv = argv + 1;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
23
sway/commands/output/allow_tearing.c
Normal file
23
sway/commands/output/allow_tearing.c
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#include "sway/commands.h"
|
||||||
|
#include "sway/config.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
|
struct cmd_results *output_cmd_allow_tearing(int argc, char **argv) {
|
||||||
|
if (!config->handler_context.output_config) {
|
||||||
|
return cmd_results_new(CMD_FAILURE, "Missing output config");
|
||||||
|
}
|
||||||
|
if (argc == 0) {
|
||||||
|
return cmd_results_new(CMD_INVALID, "Missing allow_tearing argument");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (parse_boolean(argv[0],
|
||||||
|
(config->handler_context.output_config->allow_tearing == 1))) {
|
||||||
|
config->handler_context.output_config->allow_tearing = 1;
|
||||||
|
} else {
|
||||||
|
config->handler_context.output_config->allow_tearing = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
config->handler_context.leftovers.argc = argc - 1;
|
||||||
|
config->handler_context.leftovers.argv = argv + 1;
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -1,13 +1,10 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <libgen.h>
|
#include <libgen.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/swaynag.h"
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "stringop.h"
|
#include "stringop.h"
|
||||||
|
|
||||||
|
@ -43,14 +40,14 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
struct output_config *output = config->handler_context.output_config;
|
struct output_config *output = config->handler_context.output_config;
|
||||||
|
char *src = NULL;
|
||||||
if (strcasecmp(argv[1], "solid_color") == 0) {
|
if (strcasecmp(argv[1], "solid_color") == 0) {
|
||||||
if (!validate_color(argv[0])) {
|
if (!validate_color(argv[0])) {
|
||||||
return cmd_results_new(CMD_INVALID,
|
return cmd_results_new(CMD_INVALID,
|
||||||
"Colors should be of the form #RRGGBB");
|
"Colors should be of the form #RRGGBB");
|
||||||
}
|
}
|
||||||
output->background = strdup(argv[0]);
|
if (!(output->background = strdup(argv[0]))) goto cleanup;
|
||||||
output->background_option = strdup("solid_color");
|
if (!(output->background_option = strdup("solid_color"))) goto cleanup;
|
||||||
output->background_fallback = NULL;
|
output->background_fallback = NULL;
|
||||||
argc -= 2; argv += 2;
|
argc -= 2; argv += 2;
|
||||||
} else {
|
} else {
|
||||||
|
@ -78,37 +75,25 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_INVALID, "Missing background file");
|
return cmd_results_new(CMD_INVALID, "Missing background file");
|
||||||
}
|
}
|
||||||
|
|
||||||
char *src = join_args(argv, j);
|
if (!(src = join_args(argv, j))) goto cleanup;
|
||||||
if (!expand_path(&src)) {
|
if (!expand_path(&src)) {
|
||||||
struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID,
|
struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID,
|
||||||
"Invalid syntax (%s)", src);
|
"Invalid syntax (%s)", src);
|
||||||
free(src);
|
free(src);
|
||||||
return cmd_res;
|
return cmd_res;
|
||||||
}
|
}
|
||||||
if (!src) {
|
|
||||||
sway_log(SWAY_ERROR, "Failed to allocate expanded path");
|
|
||||||
return cmd_results_new(CMD_FAILURE, "Unable to allocate resource");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (config->reading && *src != '/') {
|
if (config->reading && *src != '/') {
|
||||||
// src file is inside configuration dir
|
// src file is inside configuration dir
|
||||||
|
|
||||||
char *conf = strdup(config->current_config_path);
|
char *conf = strdup(config->current_config_path);
|
||||||
if (!conf) {
|
if (!conf) goto cleanup;
|
||||||
sway_log(SWAY_ERROR, "Failed to duplicate string");
|
|
||||||
free(src);
|
|
||||||
return cmd_results_new(CMD_FAILURE,
|
|
||||||
"Unable to allocate resources");
|
|
||||||
}
|
|
||||||
|
|
||||||
char *conf_path = dirname(conf);
|
char *conf_path = dirname(conf);
|
||||||
char *real_src = malloc(strlen(conf_path) + strlen(src) + 2);
|
char *real_src = malloc(strlen(conf_path) + strlen(src) + 2);
|
||||||
if (!real_src) {
|
if (!real_src) {
|
||||||
free(src);
|
|
||||||
free(conf);
|
free(conf);
|
||||||
sway_log(SWAY_ERROR, "Unable to allocate memory");
|
goto cleanup;
|
||||||
return cmd_results_new(CMD_FAILURE,
|
|
||||||
"Unable to allocate resources");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(real_src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, src);
|
snprintf(real_src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, src);
|
||||||
|
@ -118,40 +103,48 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool can_access = access(src, F_OK) != -1;
|
bool can_access = access(src, F_OK) != -1;
|
||||||
|
argc -= j + 1; argv += j + 1;
|
||||||
|
free(output->background_option);
|
||||||
|
free(output->background_fallback);
|
||||||
|
free(output->background);
|
||||||
|
output->background = output->background_option = output->background_fallback = NULL;
|
||||||
|
char *fallback = NULL;
|
||||||
|
|
||||||
|
if (argc && *argv[0] == '#') {
|
||||||
|
if (validate_color(argv[0])) {
|
||||||
|
if (!(fallback = strdup(argv[0]))) goto cleanup;
|
||||||
|
output->background_fallback = fallback;
|
||||||
|
} else {
|
||||||
|
sway_log(SWAY_ERROR, "fallback '%s' should be of the form #RRGGBB", argv[0]);
|
||||||
|
config_add_swaynag_warning("fallback '%s' should be of the form #RRGGBB\n", argv[0]);
|
||||||
|
}
|
||||||
|
argc--; argv++;
|
||||||
|
}
|
||||||
|
|
||||||
if (!can_access) {
|
if (!can_access) {
|
||||||
sway_log_errno(SWAY_ERROR, "Unable to access background file '%s'",
|
if (!fallback) {
|
||||||
src);
|
sway_log(SWAY_ERROR, "Unable to access background file '%s' "
|
||||||
config_add_swaynag_warning("Unable to access background file '%s'",
|
"and no valid fallback provided", src);
|
||||||
src);
|
struct cmd_results *res = cmd_results_new(CMD_FAILURE, "Unable to access "
|
||||||
struct cmd_results *result = cmd_results_new(CMD_FAILURE,
|
"background file '%s' and no valid fallback provided", src);
|
||||||
"unable to access background file '%s'", src);
|
free(src);
|
||||||
free(src);
|
return res;
|
||||||
return result;
|
}
|
||||||
|
sway_log(SWAY_DEBUG, "Cannot access file '%s', using fallback '%s'", src, fallback);
|
||||||
|
output->background = fallback;
|
||||||
|
if (!(output->background_option = strdup("solid_color"))) goto cleanup;
|
||||||
|
output->background_fallback = NULL;
|
||||||
} else {
|
} else {
|
||||||
output->background = src;
|
output->background = src;
|
||||||
output->background_option = strdup(mode);
|
if (!(output->background_option = strdup(mode))) goto cleanup;
|
||||||
}
|
|
||||||
argc -= j + 1; argv += j + 1;
|
|
||||||
|
|
||||||
output->background_fallback = NULL;
|
|
||||||
if (argc && *argv[0] == '#') {
|
|
||||||
if (!validate_color(argv[0])) {
|
|
||||||
return cmd_results_new(CMD_INVALID,
|
|
||||||
"fallback color should be of the form #RRGGBB");
|
|
||||||
}
|
|
||||||
|
|
||||||
output->background_fallback = strdup(argv[0]);
|
|
||||||
argc--; argv++;
|
|
||||||
|
|
||||||
if (!can_access) {
|
|
||||||
output->background = output->background_fallback;
|
|
||||||
output->background_option = strdup("solid_color");
|
|
||||||
output->background_fallback = NULL;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
config->handler_context.leftovers.argc = argc;
|
config->handler_context.leftovers.argc = argc;
|
||||||
config->handler_context.leftovers.argv = argv;
|
config->handler_context.leftovers.argv = argv;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
cleanup:
|
||||||
|
free(src);
|
||||||
|
sway_log(SWAY_ERROR, "Failed to allocate resources");
|
||||||
|
return cmd_results_new(CMD_FAILURE, "Unable to allocate resources");
|
||||||
}
|
}
|
||||||
|
|
113
sway/commands/output/color_profile.c
Normal file
113
sway/commands/output/color_profile.c
Normal file
|
@ -0,0 +1,113 @@
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <strings.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <wlr/render/color.h>
|
||||||
|
#include "sway/commands.h"
|
||||||
|
#include "sway/config.h"
|
||||||
|
#include "stringop.h"
|
||||||
|
|
||||||
|
static bool read_file_into_buf(const char *path, void **buf, size_t *size) {
|
||||||
|
/* Why not use fopen/fread directly? glibc will succesfully open directories,
|
||||||
|
* not just files, and supports seeking on them. Instead, we directly
|
||||||
|
* work with file descriptors and use the more consistent open/fstat/read. */
|
||||||
|
int fd = open(path, O_RDONLY | O_NOCTTY | O_CLOEXEC);
|
||||||
|
if (fd == -1) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
char *b = NULL;
|
||||||
|
struct stat info;
|
||||||
|
if (fstat(fd, &info) == -1) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
// only regular files, to avoid issues with e.g. opening pipes
|
||||||
|
if (!S_ISREG(info.st_mode)) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
off_t s = info.st_size;
|
||||||
|
if (s <= 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
b = calloc(1, s);
|
||||||
|
if (!b) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
size_t nread = 0;
|
||||||
|
while (nread < (size_t)s) {
|
||||||
|
size_t to_read = (size_t)s - nread;
|
||||||
|
ssize_t r = read(fd, b + nread, to_read);
|
||||||
|
if ((r == -1 && errno != EINTR) || r == 0) {
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
nread += (size_t)r;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
*buf = b;
|
||||||
|
*size = (size_t)s;
|
||||||
|
return true; // success
|
||||||
|
fail:
|
||||||
|
free(b);
|
||||||
|
close(fd);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct cmd_results *output_cmd_color_profile(int argc, char **argv) {
|
||||||
|
if (!config->handler_context.output_config) {
|
||||||
|
return cmd_results_new(CMD_FAILURE, "Missing output config");
|
||||||
|
}
|
||||||
|
if (!argc) {
|
||||||
|
return cmd_results_new(CMD_INVALID, "Missing color_profile first argument.");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(*argv, "srgb") == 0) {
|
||||||
|
wlr_color_transform_unref(config->handler_context.output_config->color_transform);
|
||||||
|
config->handler_context.output_config->color_transform = NULL;
|
||||||
|
config->handler_context.output_config->set_color_transform = true;
|
||||||
|
|
||||||
|
config->handler_context.leftovers.argc = argc - 1;
|
||||||
|
config->handler_context.leftovers.argv = argv + 1;
|
||||||
|
} else if (strcmp(*argv, "icc") == 0) {
|
||||||
|
if (argc < 2) {
|
||||||
|
return cmd_results_new(CMD_INVALID,
|
||||||
|
"Invalid color profile specification: icc type requires a file");
|
||||||
|
}
|
||||||
|
|
||||||
|
char *icc_path = strdup(argv[1]);
|
||||||
|
if (!expand_path(&icc_path)) {
|
||||||
|
struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID,
|
||||||
|
"Invalid color profile specification: invalid file path");
|
||||||
|
free(icc_path);
|
||||||
|
return cmd_res;
|
||||||
|
}
|
||||||
|
|
||||||
|
void *data = NULL;
|
||||||
|
size_t size = 0;
|
||||||
|
if (!read_file_into_buf(icc_path, &data, &size)) {
|
||||||
|
free(icc_path);
|
||||||
|
return cmd_results_new(CMD_FAILURE,
|
||||||
|
"Failed to load color profile: could not read ICC file");
|
||||||
|
}
|
||||||
|
free(icc_path);
|
||||||
|
|
||||||
|
struct wlr_color_transform *tmp =
|
||||||
|
wlr_color_transform_init_linear_to_icc(data, size);
|
||||||
|
if (!tmp) {
|
||||||
|
free(data);
|
||||||
|
return cmd_results_new(CMD_FAILURE,
|
||||||
|
"Failed to load color profile: failed to initialize transform from ICC");
|
||||||
|
}
|
||||||
|
free(data);
|
||||||
|
|
||||||
|
wlr_color_transform_unref(config->handler_context.output_config->color_transform);
|
||||||
|
config->handler_context.output_config->color_transform = tmp;
|
||||||
|
config->handler_context.output_config->set_color_transform = true;
|
||||||
|
|
||||||
|
config->handler_context.leftovers.argc = argc - 2;
|
||||||
|
config->handler_context.leftovers.argv = argv + 2;
|
||||||
|
} else {
|
||||||
|
return cmd_results_new(CMD_INVALID,
|
||||||
|
"Invalid color profile specification: first argument should be icc|srgb");
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
|
@ -11,7 +11,10 @@ struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
|
||||||
return cmd_results_new(CMD_INVALID, "Missing bit depth argument.");
|
return cmd_results_new(CMD_INVALID, "Missing bit depth argument.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(*argv, "8") == 0) {
|
if (strcmp(*argv, "6") == 0) {
|
||||||
|
config->handler_context.output_config->render_bit_depth =
|
||||||
|
RENDER_BIT_DEPTH_6;
|
||||||
|
} else if (strcmp(*argv, "8") == 0) {
|
||||||
config->handler_context.output_config->render_bit_depth =
|
config->handler_context.output_config->render_bit_depth =
|
||||||
RENDER_BIT_DEPTH_8;
|
RENDER_BIT_DEPTH_8;
|
||||||
} else if (strcmp(*argv, "10") == 0) {
|
} else if (strcmp(*argv, "10") == 0) {
|
||||||
|
@ -19,7 +22,7 @@ struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
|
||||||
RENDER_BIT_DEPTH_10;
|
RENDER_BIT_DEPTH_10;
|
||||||
} else {
|
} else {
|
||||||
return cmd_results_new(CMD_INVALID,
|
return cmd_results_new(CMD_INVALID,
|
||||||
"Invalid bit depth. Must be a value in (8|10).");
|
"Invalid bit depth. Must be a value in (6|8|10).");
|
||||||
}
|
}
|
||||||
|
|
||||||
config->handler_context.leftovers.argc = argc - 1;
|
config->handler_context.leftovers.argc = argc - 1;
|
||||||
|
|
|
@ -29,7 +29,7 @@ struct cmd_results *output_cmd_toggle(int argc, char **argv) {
|
||||||
config->handler_context.output_config->enabled = 1;
|
config->handler_context.output_config->enabled = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
free(oc);
|
free_output_config(oc);
|
||||||
config->handler_context.leftovers.argc = argc;
|
config->handler_context.leftovers.argc = argc;
|
||||||
config->handler_context.leftovers.argv = argv;
|
config->handler_context.leftovers.argv = argv;
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <wlr/util/transform.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
|
@ -12,12 +12,14 @@ struct cmd_results *cmd_primary_selection(int argc, char **argv) {
|
||||||
|
|
||||||
bool primary_selection = parse_boolean(argv[0], true);
|
bool primary_selection = parse_boolean(argv[0], true);
|
||||||
|
|
||||||
|
// config->primary_selection is reset to the previous value on reload in
|
||||||
|
// load_main_config()
|
||||||
if (config->reloading && config->primary_selection != primary_selection) {
|
if (config->reloading && config->primary_selection != primary_selection) {
|
||||||
return cmd_results_new(CMD_FAILURE,
|
return cmd_results_new(CMD_FAILURE,
|
||||||
"primary_selection can only be enabled/disabled at launch");
|
"primary_selection can only be enabled/disabled at launch");
|
||||||
}
|
}
|
||||||
|
|
||||||
config->primary_selection = parse_boolean(argv[0], true);
|
config->primary_selection = primary_selection;
|
||||||
|
|
||||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "sway/commands.h"
|
#include "sway/commands.h"
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
|
@ -9,9 +8,8 @@
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
|
|
||||||
static void rebuild_textures_iterator(struct sway_container *con, void *data) {
|
static void title_bar_update_iterator(struct sway_container *con, void *data) {
|
||||||
container_update_marks_textures(con);
|
container_update_title_bar(con);
|
||||||
container_update_title_textures(con);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void do_reload(void *data) {
|
static void do_reload(void *data) {
|
||||||
|
@ -48,7 +46,7 @@ static void do_reload(void *data) {
|
||||||
}
|
}
|
||||||
list_free_items_and_destroy(bar_ids);
|
list_free_items_and_destroy(bar_ids);
|
||||||
|
|
||||||
root_for_each_container(rebuild_textures_iterator, NULL);
|
root_for_each_container(title_bar_update_iterator, NULL);
|
||||||
|
|
||||||
arrange_root();
|
arrange_root();
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue