mirror of
https://codeberg.org/dwl/dwl.git
synced 2026-06-21 14:42:44 +00:00
Compare commits
48 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74e45c4014 | |||
| 464dddc110 | |||
| cb01023db6 | |||
| 5bbb0ab404 | |||
| ed74960373 | |||
| cc622d4dd5 | |||
| 3256ae0679 | |||
| e3f1aab770 | |||
| 57153fd557 | |||
| a9bcdff683 | |||
| bd59573f07 | |||
| 0060e1922d | |||
| c709b09e10 | |||
| efe10ea655 | |||
| 9a962ce136 | |||
| 0761fd0691 | |||
| 12b44421c8 | |||
| 5d73134e33 | |||
| baedf7f791 | |||
| 4cf1d604b8 | |||
| a8403d7b4d | |||
| 57b5e41063 | |||
| f4b6b429ec | |||
| bf81a128ec | |||
| 3b1f0a8a88 | |||
| bb73481662 | |||
| 72e2ce8b00 | |||
| a0117eea76 | |||
| 7b3eb70501 | |||
| c215e8a3e1 | |||
| 8e0b5baf8e | |||
| 5fec98b17a | |||
| 4043fc3093 | |||
| b3f33e9147 | |||
| f136aa088a | |||
| 1c3aaa70ba | |||
| facbe57fcb | |||
| 668022bc90 | |||
| c222468887 | |||
| 05c263de45 | |||
| bf35e77811 | |||
| bf5a6be73c | |||
| 126a333354 | |||
| 0de7d1aa71 | |||
| bab5c0185a | |||
| 70c5fcc23d | |||
| 3fe3581a59 | |||
| 057d50af8c |
+26
-1
@@ -1,10 +1,35 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
* [0.7](#0.7)
|
||||||
* [0.6](#0.6)
|
* [0.6](#0.6)
|
||||||
* [0.5](#0.5)
|
* [0.5](#0.5)
|
||||||
|
|
||||||
|
|
||||||
## Unreleased
|
## 0.7
|
||||||
|
|
||||||
|
See also [0.6](#0.6) release notes. 0.7 builds against wlroots 0.18.x.
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
* Add support for the alpha-modifier-v1 protocol ([wlroots!4616][wlroots!4616]).
|
||||||
|
* dwl now will survive GPU resets ([#601][601]).
|
||||||
|
|
||||||
|
[wlroots!4616]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4616
|
||||||
|
[601]: https://codeberg.org/dwl/dwl/issues/601
|
||||||
|
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
* Crash when re-mapping unmapped clients.
|
||||||
|
|
||||||
|
|
||||||
|
### Contributors
|
||||||
|
|
||||||
|
Guido Cella
|
||||||
|
Lennart Jablonka
|
||||||
|
|
||||||
|
|
||||||
|
## 0.6
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement \
|
|||||||
-Wfloat-conversion
|
-Wfloat-conversion
|
||||||
|
|
||||||
# CFLAGS / LDFLAGS
|
# CFLAGS / LDFLAGS
|
||||||
PKGS = wlroots wayland-server xkbcommon libinput $(XLIBS)
|
PKGS = wlroots-0.18 wayland-server xkbcommon libinput $(XLIBS)
|
||||||
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
||||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
|
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
|
||||||
|
|
||||||
@@ -31,13 +31,13 @@ WAYLAND_SCANNER = `$(PKG_CONFIG) --variable=wayland_scanner wayland-scanner`
|
|||||||
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
WAYLAND_PROTOCOLS = `$(PKG_CONFIG) --variable=pkgdatadir wayland-protocols`
|
||||||
|
|
||||||
cursor-shape-v1-protocol.h:
|
cursor-shape-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/staging/cursor-shape/cursor-shape-v1.xml $@
|
||||||
pointer-constraints-unstable-v1-protocol.h:
|
pointer-constraints-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
$(WAYLAND_PROTOCOLS)/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml $@
|
||||||
wlr-layer-shell-unstable-v1-protocol.h:
|
wlr-layer-shell-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) enum-header \
|
||||||
protocols/wlr-layer-shell-unstable-v1.xml $@
|
protocols/wlr-layer-shell-unstable-v1.xml $@
|
||||||
wlr-output-power-management-unstable-v1-protocol.h:
|
wlr-output-power-management-unstable-v1-protocol.h:
|
||||||
$(WAYLAND_SCANNER) server-header \
|
$(WAYLAND_SCANNER) server-header \
|
||||||
|
|||||||
@@ -5,21 +5,134 @@ Or on our [Discord server].
|
|||||||
|
|
||||||
dwl is a compact, hackable compositor for [Wayland] based on [wlroots]. It is
|
dwl is a compact, hackable compositor for [Wayland] based on [wlroots]. It is
|
||||||
intended to fill the same space in the Wayland world that dwm does in X11,
|
intended to fill the same space in the Wayland world that dwm does in X11,
|
||||||
primarily in terms of functionality, and secondarily in terms of philosophy.
|
primarily in terms of functionality, and secondarily in terms of
|
||||||
Like dwm, dwl is:
|
philosophy. Like dwm, dwl is:
|
||||||
|
|
||||||
- Easy to understand, hack on, and extend with patches
|
- Easy to understand, hack on, and extend with patches
|
||||||
- One C source file (or a very small number) configurable via `config.h`
|
- One C source file (or a very small number) configurable via `config.h`
|
||||||
- Tied to as few external dependencies as possible
|
- Tied to as few external dependencies as possible
|
||||||
|
|
||||||
|
## Getting Started:
|
||||||
|
|
||||||
|
### **dwl branch 0.7 and releases based upon 0.7 build against [wlroots] 0.18**
|
||||||
|
|
||||||
|
### Latest semi-stable [release]
|
||||||
|
This is probably where you want to start. This builds against the dependent
|
||||||
|
packages' versions currently shipping in major distributions. If your
|
||||||
|
distribution's wlroots version is older, use an earlier dwl [release] or [0.x
|
||||||
|
branch].
|
||||||
|
|
||||||
|
### Development branch [main]
|
||||||
|
Active development progresses on the `main` branch. The `main` branch is built
|
||||||
|
against a late (and often changing) git commit of wlroots. While the adventurous
|
||||||
|
are welcome to use `main`, it is a rocky road. Using `main` requires that the
|
||||||
|
user be willing to chase git commits of wlroots. Testing development pull
|
||||||
|
requests may involve merging unmerged pull requests in [wlroots]' git repository
|
||||||
|
and/or git commits of wayland.
|
||||||
|
|
||||||
|
### Building dwl
|
||||||
|
dwl has the following dependencies:
|
||||||
|
- libinput
|
||||||
|
- wayland
|
||||||
|
- wlroots (compiled with the libinput backend)
|
||||||
|
- xkbcommon
|
||||||
|
- wayland-protocols (compile-time only)
|
||||||
|
- pkg-config (compile-time only)
|
||||||
|
|
||||||
|
dwl has the following additional dependencies if XWayland support is enabled:
|
||||||
|
- libxcb
|
||||||
|
- libxcb-wm
|
||||||
|
- wlroots (compiled with X11 support)
|
||||||
|
- Xwayland (runtime only)
|
||||||
|
|
||||||
|
Install these (and their `-devel` versions if your distro has separate
|
||||||
|
development packages) and run `make`. If you wish to build against a released
|
||||||
|
version of wlroots (*you probably do*), use a [release] or a [0.x branch]. If
|
||||||
|
you want to use the unstable development `main` branch, you need to use the git
|
||||||
|
version of [wlroots].
|
||||||
|
|
||||||
|
To enable XWayland, you should uncomment its flags in `config.mk`.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
All configuration is done by editing `config.h` and recompiling, in the same
|
||||||
|
manner as dwm. There is no way to separately restart the window manager in
|
||||||
|
Wayland without restarting the entire display server, so any changes will take
|
||||||
|
effect the next time dwl is executed.
|
||||||
|
|
||||||
|
As in the dwm community, we encourage users to share patches they have
|
||||||
|
created. Check out the [dwl-patches] repository!
|
||||||
|
|
||||||
|
## Running dwl
|
||||||
|
|
||||||
|
dwl can be run on any of the backends supported by wlroots. This means you can
|
||||||
|
run it as a separate window inside either an X11 or Wayland session, as well as
|
||||||
|
directly from a VT console. Depending on your distro's setup, you may need to
|
||||||
|
add your user to the `video` and `input` groups before you can run dwl on a
|
||||||
|
VT. If you are using `elogind` or `systemd-logind` you need to install polkit;
|
||||||
|
otherwise you need to add yourself in the `seat` group and enable/start the
|
||||||
|
seatd daemon.
|
||||||
|
|
||||||
|
When dwl is run with no arguments, it will launch the server and begin handling
|
||||||
|
any shortcuts configured in `config.h`. There is no status bar or other
|
||||||
|
decoration initially; these are instead clients that can be run within the
|
||||||
|
Wayland session. Do note that the default background color is black. This can be
|
||||||
|
modified in `config.h`.
|
||||||
|
|
||||||
|
If you would like to run a script or command automatically at startup, you can
|
||||||
|
specify the command using the `-s` option. This command will be executed as a
|
||||||
|
shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`,
|
||||||
|
but differs in that the display server will not shut down when this process
|
||||||
|
terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait
|
||||||
|
for it to terminate (if it hasn't already). This makes it ideal for execing into
|
||||||
|
a user service manager like [s6], [anopa], [runit], [dinit], or [`systemd
|
||||||
|
--user`].
|
||||||
|
|
||||||
|
Note: The `-s` command is run as a *child process* of dwl, which means that it
|
||||||
|
does not have the ability to affect the environment of dwl or of any processes
|
||||||
|
that it spawns. If you need to set environment variables that affect the entire
|
||||||
|
dwl session, these must be set prior to running dwl. For example, Wayland
|
||||||
|
requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager
|
||||||
|
such as `elogind` or `systemd-logind`. If your system doesn't do this
|
||||||
|
automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
||||||
|
|
||||||
|
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-$(id -u)
|
||||||
|
mkdir -p $XDG_RUNTIME_DIR
|
||||||
|
dwl
|
||||||
|
|
||||||
|
### Status information
|
||||||
|
|
||||||
|
Information about selected layouts, current window title, app-id, and
|
||||||
|
selected/occupied/urgent tags is written to the stdin of the `-s` command (see
|
||||||
|
the `printstatus()` function for details). This information can be used to
|
||||||
|
populate an external status bar with a script that parses the
|
||||||
|
information. Failing to read this information will cause dwl to block, so if you
|
||||||
|
do want to run a startup command that does not consume the status information,
|
||||||
|
you can close standard input with the `<&-` shell redirection, for example:
|
||||||
|
|
||||||
|
dwl -s 'foot --server <&-'
|
||||||
|
|
||||||
|
If your startup command is a shell script, you can achieve the same inside the
|
||||||
|
script with the line
|
||||||
|
|
||||||
|
exec <&-
|
||||||
|
|
||||||
|
To get a list of status bars that work with dwl consult our [wiki].
|
||||||
|
|
||||||
|
## Replacements for X applications
|
||||||
|
|
||||||
|
You can find a [list of useful resources on our wiki].
|
||||||
|
|
||||||
|
## Background
|
||||||
|
|
||||||
dwl is not meant to provide every feature under the sun. Instead, like dwm, it
|
dwl is not meant to provide every feature under the sun. Instead, like dwm, it
|
||||||
sticks to features which are necessary, simple, and straightforward to implement
|
sticks to features which are necessary, simple, and straightforward to implement
|
||||||
given the base on which it is built. Implemented default features are:
|
given the base on which it is built. Implemented default features are:
|
||||||
|
|
||||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings,
|
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings,
|
||||||
client rules, mouse move/resize. Providing a built-in status bar is an
|
client rules, mouse move/resize. Providing a built-in status bar is an
|
||||||
exception to this goal, to avoid dependencies on font rendering and/or
|
exception to this goal, to avoid dependencies on font rendering and/or drawing
|
||||||
drawing libraries when an external bar could work well.
|
libraries when an external bar could work well.
|
||||||
- Configurable multi-monitor layout support, including position and rotation
|
- Configurable multi-monitor layout support, including position and rotation
|
||||||
- Configurable HiDPI/multi-DPI support
|
- Configurable HiDPI/multi-DPI support
|
||||||
- Idle-inhibit protocol which lets applications such as mpv disable idle
|
- Idle-inhibit protocol which lets applications such as mpv disable idle
|
||||||
@@ -53,100 +166,6 @@ Feature *non-goals* for the main codebase include:
|
|||||||
be done through the compositor
|
be done through the compositor
|
||||||
- Animations and visual effects
|
- Animations and visual effects
|
||||||
|
|
||||||
## Building dwl
|
|
||||||
|
|
||||||
dwl has the following dependencies:
|
|
||||||
```
|
|
||||||
libinput
|
|
||||||
wayland
|
|
||||||
wlroots (compiled with the libinput backend)
|
|
||||||
xkbcommon
|
|
||||||
wayland-protocols (compile-time only)
|
|
||||||
pkg-config (compile-time only)
|
|
||||||
```
|
|
||||||
If you enable X11 support:
|
|
||||||
```
|
|
||||||
libxcb
|
|
||||||
libxcb-wm
|
|
||||||
wlroots (compiled with X11 support)
|
|
||||||
Xwayland (runtime only)
|
|
||||||
```
|
|
||||||
|
|
||||||
Simply install these (and their `-devel` versions if your distro has separate
|
|
||||||
development packages) and run `make`. If you wish to build against a Git
|
|
||||||
version of wlroots, check out the [wlroots-next branch].
|
|
||||||
|
|
||||||
To enable XWayland, you should uncomment its flags in `config.mk`.
|
|
||||||
|
|
||||||
## Configuration
|
|
||||||
|
|
||||||
All configuration is done by editing `config.h` and recompiling, in the same
|
|
||||||
manner as dwm. There is no way to separately restart the window manager in
|
|
||||||
Wayland without restarting the entire display server, so any changes will take
|
|
||||||
effect the next time dwl is executed.
|
|
||||||
|
|
||||||
As in the dwm community, we encourage users to share patches they have created.
|
|
||||||
Check out the dwl [patches repository]!
|
|
||||||
|
|
||||||
## Running dwl
|
|
||||||
|
|
||||||
dwl can be run on any of the backends supported by wlroots. This means you can
|
|
||||||
run it as a separate window inside either an X11 or Wayland session, as well
|
|
||||||
as directly from a VT console. Depending on your distro's setup, you may need
|
|
||||||
to add your user to the `video` and `input` groups before you can run dwl on
|
|
||||||
a VT. If you are using `elogind` or `systemd-logind` you need to install
|
|
||||||
polkit; otherwise you need to add yourself in the `seat` group and
|
|
||||||
enable/start the seatd daemon.
|
|
||||||
|
|
||||||
When dwl is run with no arguments, it will launch the server and begin handling
|
|
||||||
any shortcuts configured in `config.h`. There is no status bar or other
|
|
||||||
decoration initially; these are instead clients that can be run within
|
|
||||||
the Wayland session.
|
|
||||||
Do note that the background color is black.
|
|
||||||
|
|
||||||
If you would like to run a script or command automatically at startup, you can
|
|
||||||
specify the command using the `-s` option. This command will be executed as a
|
|
||||||
shell command using `/bin/sh -c`. It serves a similar function to `.xinitrc`,
|
|
||||||
but differs in that the display server will not shut down when this process
|
|
||||||
terminates. Instead, dwl will send this process a SIGTERM at shutdown and wait
|
|
||||||
for it to terminate (if it hasn't already). This makes it ideal for execing into
|
|
||||||
a user service manager like [s6], [anopa], [runit], [dinit], or [`systemd --user`].
|
|
||||||
|
|
||||||
Note: The `-s` command is run as a *child process* of dwl, which means that it
|
|
||||||
does not have the ability to affect the environment of dwl or of any processes
|
|
||||||
that it spawns. If you need to set environment variables that affect the entire
|
|
||||||
dwl session, these must be set prior to running dwl. For example, Wayland
|
|
||||||
requires a valid `XDG_RUNTIME_DIR`, which is usually set up by a session manager
|
|
||||||
such as `elogind` or `systemd-logind`. If your system doesn't do this
|
|
||||||
automatically, you will need to configure it prior to launching `dwl`, e.g.:
|
|
||||||
|
|
||||||
export XDG_RUNTIME_DIR=/tmp/xdg-runtime-$(id -u)
|
|
||||||
mkdir -p $XDG_RUNTIME_DIR
|
|
||||||
dwl
|
|
||||||
|
|
||||||
### Status information
|
|
||||||
|
|
||||||
Information about selected layouts, current window title, app-id, and
|
|
||||||
selected/occupied/urgent tags is written to the stdin of the `-s` command (see
|
|
||||||
the `printstatus()` function for details). This information can be used to
|
|
||||||
populate an external status bar with a script that parses the information.
|
|
||||||
Failing to read this information will cause dwl to block, so if you do want to
|
|
||||||
run a startup command that does not consume the status information, you can
|
|
||||||
close standard input with the `<&-` shell redirection, for example:
|
|
||||||
|
|
||||||
dwl -s 'foot --server <&-'
|
|
||||||
|
|
||||||
If your startup command is a shell script, you can achieve the same inside the
|
|
||||||
script with the line
|
|
||||||
|
|
||||||
exec <&-
|
|
||||||
|
|
||||||
To get a list of status bars that work with dwl consult our [wiki].
|
|
||||||
|
|
||||||
## Replacements for X applications
|
|
||||||
|
|
||||||
You can find a [list of useful resources on our wiki].
|
|
||||||
|
|
||||||
## Acknowledgements
|
## Acknowledgements
|
||||||
|
|
||||||
dwl began by extending the TinyWL example provided (CC0) by the sway/wlroots
|
dwl began by extending the TinyWL example provided (CC0) by the sway/wlroots
|
||||||
@@ -164,17 +183,19 @@ inspiration, and to the various contributors to the project, including:
|
|||||||
- Stivvo for output management and fullscreen support, and patch maintenance
|
- Stivvo for output management and fullscreen support, and patch maintenance
|
||||||
|
|
||||||
|
|
||||||
[Discord server]: https://discord.gg/jJxZnrGPWN
|
|
||||||
[#dwl on Libera Chat]: https://web.libera.chat/?channels=#dwl
|
|
||||||
[Wayland]: https://wayland.freedesktop.org/
|
|
||||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots/
|
|
||||||
[wlroots-next branch]: https://codeberg.org/dwl/dwl/src/branch/wlroots-next
|
|
||||||
[patches repository]: https://codeberg.org/dwl/dwl-patches
|
|
||||||
[s6]: https://skarnet.org/software/s6/
|
|
||||||
[anopa]: https://jjacky.com/anopa/
|
|
||||||
[runit]: http://smarden.org/runit/faq.html#userservices
|
|
||||||
[dinit]: https://davmac.org/projects/dinit/
|
|
||||||
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
|
[`systemd --user`]: https://wiki.archlinux.org/title/Systemd/User
|
||||||
|
[#dwl on Libera Chat]: https://web.libera.chat/?channels=#dwl
|
||||||
|
[0.7-rc1]: https://codeberg.org/dwl/dwl/releases/tag/v0.7-rc1
|
||||||
|
[0.x branch]: https://codeberg.org/dwl/dwl/branches
|
||||||
|
[anopa]: https://jjacky.com/anopa/
|
||||||
|
[dinit]: https://davmac.org/projects/dinit/
|
||||||
|
[dwl-patches]: https://codeberg.org/dwl/dwl-patches
|
||||||
|
[list of useful resources on our wiki]: https://codeberg.org/dwl/dwl/wiki/Home#migrating-from-x
|
||||||
|
[main]: https://codeberg.org/dwl/dwl/src/branch/main
|
||||||
|
[release]: https://codeberg.org/dwl/dwl/releases
|
||||||
|
[runit]: http://smarden.org/runit/faq.html#userservices
|
||||||
|
[s6]: https://skarnet.org/software/s6/
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots/
|
||||||
[wiki]: https://codeberg.org/dwl/dwl/wiki/Home#compatible-status-bars
|
[wiki]: https://codeberg.org/dwl/dwl/wiki/Home#compatible-status-bars
|
||||||
[list of useful resources on our wiki]:
|
[Discord server]: https://discord.gg/jJxZnrGPWN
|
||||||
https://codeberg.org/dwl/dwl/wiki/Home#migrating-from-x
|
[Wayland]: https://wayland.freedesktop.org/
|
||||||
|
|||||||
@@ -183,6 +183,18 @@ client_get_parent(Client *c)
|
|||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int
|
||||||
|
client_has_children(Client *c)
|
||||||
|
{
|
||||||
|
#ifdef XWAYLAND
|
||||||
|
if (client_is_x11(c))
|
||||||
|
return !wl_list_empty(&c->surface.xwayland->children);
|
||||||
|
#endif
|
||||||
|
/* surface.xdg->link is never empty because it always contains at least the
|
||||||
|
* surface itself. */
|
||||||
|
return wl_list_length(&c->surface.xdg->link) > 1;
|
||||||
|
}
|
||||||
|
|
||||||
static inline const char *
|
static inline const char *
|
||||||
client_get_title(Client *c)
|
client_get_title(Client *c)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
_VERSION = 0.6
|
_VERSION = 0.7
|
||||||
VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
|
VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
|
||||||
|
|
||||||
PKG_CONFIG = pkg-config
|
PKG_CONFIG = pkg-config
|
||||||
|
|||||||
@@ -140,7 +140,7 @@ server.
|
|||||||
Start
|
Start
|
||||||
.Nm
|
.Nm
|
||||||
with s6 in the background:
|
with s6 in the background:
|
||||||
.Dl dwl -s 's6-svscan <&-'
|
.Dl dwl \-s \(aqs6\-svscan <&\-\(aq
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr foot 1 ,
|
.Xr foot 1 ,
|
||||||
.Xr wmenu 1 ,
|
.Xr wmenu 1 ,
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
#include <wlr/backend/libinput.h>
|
#include <wlr/backend/libinput.h>
|
||||||
#include <wlr/render/allocator.h>
|
#include <wlr/render/allocator.h>
|
||||||
#include <wlr/render/wlr_renderer.h>
|
#include <wlr/render/wlr_renderer.h>
|
||||||
|
#include <wlr/types/wlr_alpha_modifier_v1.h>
|
||||||
#include <wlr/types/wlr_compositor.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_cursor.h>
|
#include <wlr/types/wlr_cursor.h>
|
||||||
#include <wlr/types/wlr_cursor_shape_v1.h>
|
#include <wlr/types/wlr_cursor_shape_v1.h>
|
||||||
@@ -257,6 +258,7 @@ static void cleanupmon(struct wl_listener *listener, void *data);
|
|||||||
static void closemon(Monitor *m);
|
static void closemon(Monitor *m);
|
||||||
static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
|
static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
|
||||||
static void commitnotify(struct wl_listener *listener, void *data);
|
static void commitnotify(struct wl_listener *listener, void *data);
|
||||||
|
static void commitpopup(struct wl_listener *listener, void *data);
|
||||||
static void createdecoration(struct wl_listener *listener, void *data);
|
static void createdecoration(struct wl_listener *listener, void *data);
|
||||||
static void createidleinhibitor(struct wl_listener *listener, void *data);
|
static void createidleinhibitor(struct wl_listener *listener, void *data);
|
||||||
static void createkeyboard(struct wlr_keyboard *keyboard);
|
static void createkeyboard(struct wlr_keyboard *keyboard);
|
||||||
@@ -267,6 +269,7 @@ static void createmon(struct wl_listener *listener, void *data);
|
|||||||
static void createnotify(struct wl_listener *listener, void *data);
|
static void createnotify(struct wl_listener *listener, void *data);
|
||||||
static void createpointer(struct wlr_pointer *pointer);
|
static void createpointer(struct wlr_pointer *pointer);
|
||||||
static void createpointerconstraint(struct wl_listener *listener, void *data);
|
static void createpointerconstraint(struct wl_listener *listener, void *data);
|
||||||
|
static void createpopup(struct wl_listener *listener, void *data);
|
||||||
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
static void cursorconstrain(struct wlr_pointer_constraint_v1 *constraint);
|
||||||
static void cursorframe(struct wl_listener *listener, void *data);
|
static void cursorframe(struct wl_listener *listener, void *data);
|
||||||
static void cursorwarptohint(void);
|
static void cursorwarptohint(void);
|
||||||
@@ -287,6 +290,7 @@ static void focusmon(const Arg *arg);
|
|||||||
static void focusstack(const Arg *arg);
|
static void focusstack(const Arg *arg);
|
||||||
static Client *focustop(Monitor *m);
|
static Client *focustop(Monitor *m);
|
||||||
static void fullscreennotify(struct wl_listener *listener, void *data);
|
static void fullscreennotify(struct wl_listener *listener, void *data);
|
||||||
|
static void gpureset(struct wl_listener *listener, void *data);
|
||||||
static void handlesig(int signo);
|
static void handlesig(int signo);
|
||||||
static void incnmaster(const Arg *arg);
|
static void incnmaster(const Arg *arg);
|
||||||
static void inputdevice(struct wl_listener *listener, void *data);
|
static void inputdevice(struct wl_listener *listener, void *data);
|
||||||
@@ -358,6 +362,7 @@ static pid_t child_pid = -1;
|
|||||||
static int locked;
|
static int locked;
|
||||||
static void *exclusive_focus;
|
static void *exclusive_focus;
|
||||||
static struct wl_display *dpy;
|
static struct wl_display *dpy;
|
||||||
|
static struct wl_event_loop *event_loop;
|
||||||
static struct wlr_backend *backend;
|
static struct wlr_backend *backend;
|
||||||
static struct wlr_scene *scene;
|
static struct wlr_scene *scene;
|
||||||
static struct wlr_scene_tree *layers[NUM_LAYERS];
|
static struct wlr_scene_tree *layers[NUM_LAYERS];
|
||||||
@@ -499,7 +504,7 @@ arrange(Monitor *m)
|
|||||||
/* We move all clients (except fullscreen and unmanaged) to LyrTile while
|
/* We move all clients (except fullscreen and unmanaged) to LyrTile while
|
||||||
* in floating layout to avoid "real" floating clients be always on top */
|
* in floating layout to avoid "real" floating clients be always on top */
|
||||||
wl_list_for_each(c, &clients, link) {
|
wl_list_for_each(c, &clients, link) {
|
||||||
if (c->mon != m || c->isfullscreen)
|
if (c->mon != m || c->scene->node.parent == layers[LyrFS])
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
wlr_scene_node_reparent(&c->scene->node,
|
wlr_scene_node_reparent(&c->scene->node,
|
||||||
@@ -587,7 +592,7 @@ axisnotify(struct wl_listener *listener, void *data)
|
|||||||
/* Notify the client with pointer focus of the axis event. */
|
/* Notify the client with pointer focus of the axis event. */
|
||||||
wlr_seat_pointer_notify_axis(seat,
|
wlr_seat_pointer_notify_axis(seat,
|
||||||
event->time_msec, event->orientation, event->delta,
|
event->time_msec, event->orientation, event->delta,
|
||||||
event->delta_discrete, event->source);
|
event->delta_discrete, event->source, event->relative_direction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -602,7 +607,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
|||||||
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
wlr_idle_notifier_v1_notify_activity(idle_notifier, seat);
|
||||||
|
|
||||||
switch (event->state) {
|
switch (event->state) {
|
||||||
case WLR_BUTTON_PRESSED:
|
case WL_POINTER_BUTTON_STATE_PRESSED:
|
||||||
cursor_mode = CurPressed;
|
cursor_mode = CurPressed;
|
||||||
selmon = xytomon(cursor->x, cursor->y);
|
selmon = xytomon(cursor->x, cursor->y);
|
||||||
if (locked)
|
if (locked)
|
||||||
@@ -623,7 +628,7 @@ buttonpress(struct wl_listener *listener, void *data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case WLR_BUTTON_RELEASED:
|
case WL_POINTER_BUTTON_STATE_RELEASED:
|
||||||
/* If you released any buttons, we exit interactive move/resize mode. */
|
/* If you released any buttons, we exit interactive move/resize mode. */
|
||||||
/* TODO should reset to the pointer focus's current setcursor */
|
/* TODO should reset to the pointer focus's current setcursor */
|
||||||
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
if (!locked && cursor_mode != CurNormal && cursor_mode != CurPressed) {
|
||||||
@@ -681,10 +686,13 @@ cleanup(void)
|
|||||||
waitpid(child_pid, NULL, 0);
|
waitpid(child_pid, NULL, 0);
|
||||||
}
|
}
|
||||||
wlr_xcursor_manager_destroy(cursor_mgr);
|
wlr_xcursor_manager_destroy(cursor_mgr);
|
||||||
wlr_output_layout_destroy(output_layout);
|
|
||||||
|
|
||||||
destroykeyboardgroup(&kb_group->destroy, NULL);
|
destroykeyboardgroup(&kb_group->destroy, NULL);
|
||||||
|
|
||||||
|
/* If it's not destroyed manually it will cause a use-after-free of wlr_seat.
|
||||||
|
* Destroy it until it's fixed in the wlroots side */
|
||||||
|
wlr_backend_destroy(backend);
|
||||||
|
|
||||||
wl_display_destroy(dpy);
|
wl_display_destroy(dpy);
|
||||||
/* Destroy after the wayland display (when the monitors are already destroyed)
|
/* Destroy after the wayland display (when the monitors are already destroyed)
|
||||||
to avoid destroying them with an invalid scene output. */
|
to avoid destroying them with an invalid scene output. */
|
||||||
@@ -752,6 +760,20 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
|
|||||||
LayerSurface *l = wl_container_of(listener, l, surface_commit);
|
LayerSurface *l = wl_container_of(listener, l, surface_commit);
|
||||||
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
||||||
struct wlr_scene_tree *scene_layer = layers[layermap[layer_surface->current.layer]];
|
struct wlr_scene_tree *scene_layer = layers[layermap[layer_surface->current.layer]];
|
||||||
|
struct wlr_layer_surface_v1_state old_state;
|
||||||
|
|
||||||
|
if (l->layer_surface->initial_commit) {
|
||||||
|
wlr_fractional_scale_v1_notify_scale(layer_surface->surface, l->mon->wlr_output->scale);
|
||||||
|
wlr_surface_set_preferred_buffer_scale(layer_surface->surface, (int32_t)ceilf(l->mon->wlr_output->scale));
|
||||||
|
|
||||||
|
/* Temporarily set the layer's current state to pending
|
||||||
|
* so that we can easily arrange it */
|
||||||
|
old_state = l->layer_surface->current;
|
||||||
|
l->layer_surface->current = l->layer_surface->pending;
|
||||||
|
arrangelayers(l->mon);
|
||||||
|
l->layer_surface->current = old_state;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (layer_surface->current.committed == 0 && l->mapped == layer_surface->surface->mapped)
|
if (layer_surface->current.committed == 0 && l->mapped == layer_surface->surface->mapped)
|
||||||
return;
|
return;
|
||||||
@@ -784,6 +806,12 @@ commitnotify(struct wl_listener *listener, void *data)
|
|||||||
wlr_surface_set_preferred_buffer_scale(client_surface(c), (int)ceilf(c->mon->wlr_output->scale));
|
wlr_surface_set_preferred_buffer_scale(client_surface(c), (int)ceilf(c->mon->wlr_output->scale));
|
||||||
wlr_fractional_scale_v1_notify_scale(client_surface(c), c->mon->wlr_output->scale);
|
wlr_fractional_scale_v1_notify_scale(client_surface(c), c->mon->wlr_output->scale);
|
||||||
setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */
|
setmon(c, NULL, 0); /* Make sure to reapply rules in mapnotify() */
|
||||||
|
|
||||||
|
wlr_xdg_toplevel_set_wm_capabilities(c->surface.xdg->toplevel, WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
||||||
|
wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, 0, 0);
|
||||||
|
if (c->decoration)
|
||||||
|
requestdecorationmode(&c->set_decoration_mode, c->decoration);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (client_surface(c)->mapped && c->mon)
|
if (client_surface(c)->mapped && c->mon)
|
||||||
@@ -794,6 +822,33 @@ commitnotify(struct wl_listener *listener, void *data)
|
|||||||
c->resize = 0;
|
c->resize = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
commitpopup(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct wlr_surface *surface = data;
|
||||||
|
struct wlr_xdg_popup *popup = wlr_xdg_popup_try_from_wlr_surface(surface);
|
||||||
|
LayerSurface *l = NULL;
|
||||||
|
Client *c = NULL;
|
||||||
|
struct wlr_box box;
|
||||||
|
int type = -1;
|
||||||
|
|
||||||
|
if (!popup->base->initial_commit)
|
||||||
|
return;
|
||||||
|
|
||||||
|
type = toplevel_from_wlr_surface(popup->base->surface, &c, &l);
|
||||||
|
if (!popup->parent || type < 0)
|
||||||
|
return;
|
||||||
|
popup->base->surface->data = wlr_scene_xdg_surface_create(
|
||||||
|
popup->parent->data, popup->base);
|
||||||
|
if ((l && !l->mon) || (c && !c->mon))
|
||||||
|
return;
|
||||||
|
box = type == LayerShell ? l->mon->m : c->mon->w;
|
||||||
|
box.x -= (type == LayerShell ? l->geom.x : c->geom.x);
|
||||||
|
box.y -= (type == LayerShell ? l->geom.y : c->geom.y);
|
||||||
|
wlr_xdg_popup_unconstrain_from_box(popup, &box);
|
||||||
|
wl_list_remove(&listener->link);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
createdecoration(struct wl_listener *listener, void *data)
|
createdecoration(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
@@ -852,8 +907,7 @@ createkeyboardgroup(void)
|
|||||||
LISTEN(&group->wlr_group->keyboard.events.key, &group->key, keypress);
|
LISTEN(&group->wlr_group->keyboard.events.key, &group->key, keypress);
|
||||||
LISTEN(&group->wlr_group->keyboard.events.modifiers, &group->modifiers, keypressmod);
|
LISTEN(&group->wlr_group->keyboard.events.modifiers, &group->modifiers, keypressmod);
|
||||||
|
|
||||||
group->key_repeat_source = wl_event_loop_add_timer(
|
group->key_repeat_source = wl_event_loop_add_timer(event_loop, keyrepeat, group);
|
||||||
wl_display_get_event_loop(dpy), keyrepeat, group);
|
|
||||||
|
|
||||||
/* A seat can only have one keyboard, but this is a limitation of the
|
/* A seat can only have one keyboard, but this is a limitation of the
|
||||||
* Wayland protocol - not wlroots. We assign all connected keyboards to the
|
* Wayland protocol - not wlroots. We assign all connected keyboards to the
|
||||||
@@ -871,7 +925,6 @@ createlayersurface(struct wl_listener *listener, void *data)
|
|||||||
LayerSurface *l;
|
LayerSurface *l;
|
||||||
struct wlr_surface *surface = layer_surface->surface;
|
struct wlr_surface *surface = layer_surface->surface;
|
||||||
struct wlr_scene_tree *scene_layer = layers[layermap[layer_surface->pending.layer]];
|
struct wlr_scene_tree *scene_layer = layers[layermap[layer_surface->pending.layer]];
|
||||||
struct wlr_layer_surface_v1_state old_state;
|
|
||||||
|
|
||||||
if (!layer_surface->output
|
if (!layer_surface->output
|
||||||
&& !(layer_surface->output = selmon ? selmon->wlr_output : NULL)) {
|
&& !(layer_surface->output = selmon ? selmon->wlr_output : NULL)) {
|
||||||
@@ -895,17 +948,6 @@ createlayersurface(struct wl_listener *listener, void *data)
|
|||||||
|
|
||||||
wl_list_insert(&l->mon->layers[layer_surface->pending.layer],&l->link);
|
wl_list_insert(&l->mon->layers[layer_surface->pending.layer],&l->link);
|
||||||
wlr_surface_send_enter(surface, layer_surface->output);
|
wlr_surface_send_enter(surface, layer_surface->output);
|
||||||
wlr_fractional_scale_v1_notify_scale(surface, l->mon->wlr_output->scale);
|
|
||||||
wlr_surface_set_preferred_buffer_scale(surface, (int32_t)ceilf(l->mon->wlr_output->scale));
|
|
||||||
|
|
||||||
/* Temporarily set the layer's current state to pending
|
|
||||||
* so that we can easily arrange it
|
|
||||||
*/
|
|
||||||
old_state = layer_surface->current;
|
|
||||||
layer_surface->current = layer_surface->pending;
|
|
||||||
l->mapped = 1;
|
|
||||||
arrangelayers(l->mon);
|
|
||||||
layer_surface->current = old_state;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1011,49 +1053,22 @@ createmon(struct wl_listener *listener, void *data)
|
|||||||
void
|
void
|
||||||
createnotify(struct wl_listener *listener, void *data)
|
createnotify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* This event is raised when wlr_xdg_shell receives a new xdg surface from a
|
/* This event is raised when a client creates a new toplevel (application window). */
|
||||||
* client, either a toplevel (application window) or popup,
|
struct wlr_xdg_toplevel *toplevel = data;
|
||||||
* or when wlr_layer_shell receives a new popup from a layer.
|
|
||||||
* If you want to do something tricky with popups you should check if
|
|
||||||
* its parent is wlr_xdg_shell or wlr_layer_shell */
|
|
||||||
struct wlr_xdg_surface *xdg_surface = data;
|
|
||||||
Client *c = NULL;
|
Client *c = NULL;
|
||||||
LayerSurface *l = NULL;
|
|
||||||
|
|
||||||
if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_POPUP) {
|
|
||||||
struct wlr_xdg_popup *popup = xdg_surface->popup;
|
|
||||||
struct wlr_box box;
|
|
||||||
if (toplevel_from_wlr_surface(popup->base->surface, &c, &l) < 0)
|
|
||||||
return;
|
|
||||||
popup->base->surface->data = wlr_scene_xdg_surface_create(
|
|
||||||
popup->parent->data, popup->base);
|
|
||||||
if ((l && !l->mon) || (c && !c->mon))
|
|
||||||
return;
|
|
||||||
box = l ? l->mon->m : c->mon->w;
|
|
||||||
box.x -= (l ? l->geom.x : c->geom.x);
|
|
||||||
box.y -= (l ? l->geom.y : c->geom.y);
|
|
||||||
wlr_xdg_popup_unconstrain_from_box(popup, &box);
|
|
||||||
return;
|
|
||||||
} else if (xdg_surface->role == WLR_XDG_SURFACE_ROLE_NONE)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Allocate a Client for this surface */
|
/* Allocate a Client for this surface */
|
||||||
c = xdg_surface->data = ecalloc(1, sizeof(*c));
|
c = toplevel->base->data = ecalloc(1, sizeof(*c));
|
||||||
c->surface.xdg = xdg_surface;
|
c->surface.xdg = toplevel->base;
|
||||||
c->bw = borderpx;
|
c->bw = borderpx;
|
||||||
|
|
||||||
wlr_xdg_toplevel_set_wm_capabilities(xdg_surface->toplevel,
|
LISTEN(&toplevel->base->surface->events.commit, &c->commit, commitnotify);
|
||||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
LISTEN(&toplevel->base->surface->events.map, &c->map, mapnotify);
|
||||||
|
LISTEN(&toplevel->base->surface->events.unmap, &c->unmap, unmapnotify);
|
||||||
LISTEN(&xdg_surface->events.destroy, &c->destroy, destroynotify);
|
LISTEN(&toplevel->events.destroy, &c->destroy, destroynotify);
|
||||||
LISTEN(&xdg_surface->surface->events.commit, &c->commit, commitnotify);
|
LISTEN(&toplevel->events.request_fullscreen, &c->fullscreen, fullscreennotify);
|
||||||
LISTEN(&xdg_surface->surface->events.map, &c->map, mapnotify);
|
LISTEN(&toplevel->events.request_maximize, &c->maximize, maximizenotify);
|
||||||
LISTEN(&xdg_surface->surface->events.unmap, &c->unmap, unmapnotify);
|
LISTEN(&toplevel->events.set_title, &c->set_title, updatetitle);
|
||||||
LISTEN(&xdg_surface->toplevel->events.request_fullscreen, &c->fullscreen,
|
|
||||||
fullscreennotify);
|
|
||||||
LISTEN(&xdg_surface->toplevel->events.request_maximize, &c->maximize,
|
|
||||||
maximizenotify);
|
|
||||||
LISTEN(&xdg_surface->toplevel->events.set_title, &c->set_title, updatetitle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1109,6 +1124,15 @@ createpointerconstraint(struct wl_listener *listener, void *data)
|
|||||||
&pointer_constraint->destroy, destroypointerconstraint);
|
&pointer_constraint->destroy, destroypointerconstraint);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
createpopup(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
/* This event is raised when a client (either xdg-shell or layer-shell)
|
||||||
|
* creates a new popup. */
|
||||||
|
struct wlr_xdg_popup *popup = data;
|
||||||
|
LISTEN_STATIC(&popup->base->surface->events.commit, commitpopup);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
|
cursorconstrain(struct wlr_pointer_constraint_v1 *constraint)
|
||||||
{
|
{
|
||||||
@@ -1141,8 +1165,7 @@ cursorwarptohint(void)
|
|||||||
double sy = active_constraint->current.cursor_hint.y;
|
double sy = active_constraint->current.cursor_hint.y;
|
||||||
|
|
||||||
toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);
|
toplevel_from_wlr_surface(active_constraint->surface, &c, NULL);
|
||||||
/* TODO: wlroots 0.18: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4478 */
|
if (c && active_constraint->current.cursor_hint.enabled) {
|
||||||
if (c && (active_constraint->current.committed & WLR_POINTER_CONSTRAINT_V1_STATE_CURSOR_HINT )) {
|
|
||||||
wlr_cursor_warp(cursor, NULL, sx + c->geom.x + c->bw, sy + c->geom.y + c->bw);
|
wlr_cursor_warp(cursor, NULL, sx + c->geom.x + c->bw, sy + c->geom.y + c->bw);
|
||||||
wlr_seat_pointer_warp(active_constraint->seat, sx, sy);
|
wlr_seat_pointer_warp(active_constraint->seat, sx, sy);
|
||||||
}
|
}
|
||||||
@@ -1152,6 +1175,7 @@ void
|
|||||||
destroydecoration(struct wl_listener *listener, void *data)
|
destroydecoration(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
Client *c = wl_container_of(listener, c, destroy_decoration);
|
Client *c = wl_container_of(listener, c, destroy_decoration);
|
||||||
|
c->decoration = NULL;
|
||||||
|
|
||||||
wl_list_remove(&c->destroy_decoration.link);
|
wl_list_remove(&c->destroy_decoration.link);
|
||||||
wl_list_remove(&c->set_decoration_mode.link);
|
wl_list_remove(&c->set_decoration_mode.link);
|
||||||
@@ -1404,7 +1428,7 @@ focusstack(const Arg *arg)
|
|||||||
{
|
{
|
||||||
/* Focus the next or previous client (in tiling order) on selmon */
|
/* Focus the next or previous client (in tiling order) on selmon */
|
||||||
Client *c, *sel = focustop(selmon);
|
Client *c, *sel = focustop(selmon);
|
||||||
if (!sel || sel->isfullscreen)
|
if (!sel || (sel->isfullscreen && !client_has_children(sel)))
|
||||||
return;
|
return;
|
||||||
if (arg->i > 0) {
|
if (arg->i > 0) {
|
||||||
wl_list_for_each(c, &sel->link, link) {
|
wl_list_for_each(c, &sel->link, link) {
|
||||||
@@ -1446,6 +1470,30 @@ fullscreennotify(struct wl_listener *listener, void *data)
|
|||||||
setfullscreen(c, client_wants_fullscreen(c));
|
setfullscreen(c, client_wants_fullscreen(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gpureset(struct wl_listener *listener, void *data)
|
||||||
|
{
|
||||||
|
struct wlr_renderer *old_drw = drw;
|
||||||
|
struct wlr_allocator *old_alloc = alloc;
|
||||||
|
struct Monitor *m;
|
||||||
|
if (!(drw = wlr_renderer_autocreate(backend)))
|
||||||
|
die("couldn't recreate renderer");
|
||||||
|
|
||||||
|
if (!(alloc = wlr_allocator_autocreate(backend, drw)))
|
||||||
|
die("couldn't recreate allocator");
|
||||||
|
|
||||||
|
LISTEN_STATIC(&drw->events.lost, gpureset);
|
||||||
|
|
||||||
|
wlr_compositor_set_renderer(compositor, drw);
|
||||||
|
|
||||||
|
wl_list_for_each(m, &mons, link) {
|
||||||
|
wlr_output_init_render(m->wlr_output, alloc, drw);
|
||||||
|
}
|
||||||
|
|
||||||
|
wlr_allocator_destroy(old_alloc);
|
||||||
|
wlr_renderer_destroy(old_drw);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handlesig(int signo)
|
handlesig(int signo)
|
||||||
{
|
{
|
||||||
@@ -1638,7 +1686,8 @@ void
|
|||||||
mapnotify(struct wl_listener *listener, void *data)
|
mapnotify(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
/* Called when the surface is mapped, or ready to display on-screen. */
|
/* Called when the surface is mapped, or ready to display on-screen. */
|
||||||
Client *p, *w, *c = wl_container_of(listener, c, map);
|
Client *p = NULL;
|
||||||
|
Client *w, *c = wl_container_of(listener, c, map);
|
||||||
Monitor *m;
|
Monitor *m;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@@ -1694,7 +1743,7 @@ mapnotify(struct wl_listener *listener, void *data)
|
|||||||
unset_fullscreen:
|
unset_fullscreen:
|
||||||
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
|
m = c->mon ? c->mon : xytomon(c->geom.x, c->geom.y);
|
||||||
wl_list_for_each(w, &clients, link) {
|
wl_list_for_each(w, &clients, link) {
|
||||||
if (w != c && w->isfullscreen && m == w->mon && (w->tags & c->tags))
|
if (w != c && w != p && w->isfullscreen && m == w->mon && (w->tags & c->tags))
|
||||||
setfullscreen(w, 0);
|
setfullscreen(w, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1711,7 +1760,8 @@ maximizenotify(struct wl_listener *listener, void *data)
|
|||||||
* protocol version
|
* protocol version
|
||||||
* wlr_xdg_surface_schedule_configure() is used to send an empty reply. */
|
* wlr_xdg_surface_schedule_configure() is used to send an empty reply. */
|
||||||
Client *c = wl_container_of(listener, c, maximize);
|
Client *c = wl_container_of(listener, c, maximize);
|
||||||
if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
|
if (c->surface.xdg->initialized
|
||||||
|
&& wl_resource_get_version(c->surface.xdg->toplevel->resource)
|
||||||
< XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION)
|
< XDG_TOPLEVEL_WM_CAPABILITIES_SINCE_VERSION)
|
||||||
wlr_xdg_surface_schedule_configure(c->surface.xdg);
|
wlr_xdg_surface_schedule_configure(c->surface.xdg);
|
||||||
}
|
}
|
||||||
@@ -2102,6 +2152,7 @@ void
|
|||||||
requestdecorationmode(struct wl_listener *listener, void *data)
|
requestdecorationmode(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
Client *c = wl_container_of(listener, c, set_decoration_mode);
|
Client *c = wl_container_of(listener, c, set_decoration_mode);
|
||||||
|
if (c->surface.xdg->initialized)
|
||||||
wlr_xdg_toplevel_decoration_v1_set_mode(c->decoration,
|
wlr_xdg_toplevel_decoration_v1_set_mode(c->decoration,
|
||||||
WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
|
||||||
}
|
}
|
||||||
@@ -2132,7 +2183,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
|||||||
struct wlr_box *bbox;
|
struct wlr_box *bbox;
|
||||||
struct wlr_box clip;
|
struct wlr_box clip;
|
||||||
|
|
||||||
if (!c->mon || !c->scene)
|
if (!c->mon || !client_surface(c)->mapped)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bbox = interact ? &sgeom : &c->mon->w;
|
bbox = interact ? &sgeom : &c->mon->w;
|
||||||
@@ -2255,12 +2306,14 @@ setcursorshape(struct wl_listener *listener, void *data)
|
|||||||
void
|
void
|
||||||
setfloating(Client *c, int floating)
|
setfloating(Client *c, int floating)
|
||||||
{
|
{
|
||||||
|
Client *p = client_get_parent(c);
|
||||||
c->isfloating = floating;
|
c->isfloating = floating;
|
||||||
/* If in floating layout do not change the client's layer */
|
/* If in floating layout do not change the client's layer */
|
||||||
if (!c->mon || !client_surface(c)->mapped || !c->mon->lt[c->mon->sellt]->arrange)
|
if (!c->mon || !client_surface(c)->mapped || !c->mon->lt[c->mon->sellt]->arrange)
|
||||||
return;
|
return;
|
||||||
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen
|
wlr_scene_node_reparent(&c->scene->node, layers[c->isfullscreen ||
|
||||||
? LyrFS : c->isfloating ? LyrFloat : LyrTile]);
|
(p && p->isfullscreen) ? LyrFS
|
||||||
|
: c->isfloating ? LyrFloat : LyrTile]);
|
||||||
arrange(c->mon);
|
arrange(c->mon);
|
||||||
printstatus();
|
printstatus();
|
||||||
}
|
}
|
||||||
@@ -2388,12 +2441,13 @@ setup(void)
|
|||||||
/* The Wayland display is managed by libwayland. It handles accepting
|
/* The Wayland display is managed by libwayland. It handles accepting
|
||||||
* clients from the Unix socket, manging Wayland globals, and so on. */
|
* clients from the Unix socket, manging Wayland globals, and so on. */
|
||||||
dpy = wl_display_create();
|
dpy = wl_display_create();
|
||||||
|
event_loop = wl_display_get_event_loop(dpy);
|
||||||
|
|
||||||
/* The backend is a wlroots feature which abstracts the underlying input and
|
/* The backend is a wlroots feature which abstracts the underlying input and
|
||||||
* output hardware. The autocreate option will choose the most suitable
|
* output hardware. The autocreate option will choose the most suitable
|
||||||
* backend based on the current environment, such as opening an X11 window
|
* backend based on the current environment, such as opening an X11 window
|
||||||
* if an X11 server is running. */
|
* if an X11 server is running. */
|
||||||
if (!(backend = wlr_backend_autocreate(dpy, &session)))
|
if (!(backend = wlr_backend_autocreate(event_loop, &session)))
|
||||||
die("couldn't create backend");
|
die("couldn't create backend");
|
||||||
|
|
||||||
/* Initialize the scene graph used to lay out windows */
|
/* Initialize the scene graph used to lay out windows */
|
||||||
@@ -2410,6 +2464,7 @@ setup(void)
|
|||||||
* supports for shared memory, this configures that for clients. */
|
* supports for shared memory, this configures that for clients. */
|
||||||
if (!(drw = wlr_renderer_autocreate(backend)))
|
if (!(drw = wlr_renderer_autocreate(backend)))
|
||||||
die("couldn't create renderer");
|
die("couldn't create renderer");
|
||||||
|
LISTEN_STATIC(&drw->events.lost, gpureset);
|
||||||
|
|
||||||
/* Create shm, drm and linux_dmabuf interfaces by ourselves.
|
/* Create shm, drm and linux_dmabuf interfaces by ourselves.
|
||||||
* The simplest way is call:
|
* The simplest way is call:
|
||||||
@@ -2418,10 +2473,10 @@ setup(void)
|
|||||||
* with wlr_scene. */
|
* with wlr_scene. */
|
||||||
wlr_renderer_init_wl_shm(drw, dpy);
|
wlr_renderer_init_wl_shm(drw, dpy);
|
||||||
|
|
||||||
if (wlr_renderer_get_dmabuf_texture_formats(drw)) {
|
if (wlr_renderer_get_texture_formats(drw, WLR_BUFFER_CAP_DMABUF)) {
|
||||||
wlr_drm_create(dpy, drw);
|
wlr_drm_create(dpy, drw);
|
||||||
wlr_scene_set_linux_dmabuf_v1(scene,
|
wlr_scene_set_linux_dmabuf_v1(scene,
|
||||||
wlr_linux_dmabuf_v1_create_with_renderer(dpy, 4, drw));
|
wlr_linux_dmabuf_v1_create_with_renderer(dpy, 5, drw));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Autocreates an allocator for us.
|
/* Autocreates an allocator for us.
|
||||||
@@ -2447,6 +2502,8 @@ setup(void)
|
|||||||
wlr_viewporter_create(dpy);
|
wlr_viewporter_create(dpy);
|
||||||
wlr_single_pixel_buffer_manager_v1_create(dpy);
|
wlr_single_pixel_buffer_manager_v1_create(dpy);
|
||||||
wlr_fractional_scale_manager_v1_create(dpy, 1);
|
wlr_fractional_scale_manager_v1_create(dpy, 1);
|
||||||
|
wlr_presentation_create(dpy, backend);
|
||||||
|
wlr_alpha_modifier_v1_create(dpy);
|
||||||
|
|
||||||
/* Initializes the interface used to implement urgency hints */
|
/* Initializes the interface used to implement urgency hints */
|
||||||
activation = wlr_xdg_activation_v1_create(dpy);
|
activation = wlr_xdg_activation_v1_create(dpy);
|
||||||
@@ -2460,7 +2517,7 @@ setup(void)
|
|||||||
|
|
||||||
/* Creates an output layout, which a wlroots utility for working with an
|
/* Creates an output layout, which a wlroots utility for working with an
|
||||||
* arrangement of screens in a physical layout. */
|
* arrangement of screens in a physical layout. */
|
||||||
output_layout = wlr_output_layout_create();
|
output_layout = wlr_output_layout_create(dpy);
|
||||||
LISTEN_STATIC(&output_layout->events.change, updatemons);
|
LISTEN_STATIC(&output_layout->events.change, updatemons);
|
||||||
wlr_xdg_output_manager_v1_create(dpy, output_layout);
|
wlr_xdg_output_manager_v1_create(dpy, output_layout);
|
||||||
|
|
||||||
@@ -2479,7 +2536,8 @@ setup(void)
|
|||||||
wl_list_init(&fstack);
|
wl_list_init(&fstack);
|
||||||
|
|
||||||
xdg_shell = wlr_xdg_shell_create(dpy, 6);
|
xdg_shell = wlr_xdg_shell_create(dpy, 6);
|
||||||
LISTEN_STATIC(&xdg_shell->events.new_surface, createnotify);
|
LISTEN_STATIC(&xdg_shell->events.new_toplevel, createnotify);
|
||||||
|
LISTEN_STATIC(&xdg_shell->events.new_popup, createpopup);
|
||||||
|
|
||||||
layer_shell = wlr_layer_shell_v1_create(dpy, 3);
|
layer_shell = wlr_layer_shell_v1_create(dpy, 3);
|
||||||
LISTEN_STATIC(&layer_shell->events.new_surface, createlayersurface);
|
LISTEN_STATIC(&layer_shell->events.new_surface, createlayersurface);
|
||||||
@@ -2567,8 +2625,6 @@ setup(void)
|
|||||||
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
|
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
|
||||||
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
|
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
|
||||||
|
|
||||||
wlr_scene_set_presentation(scene, wlr_presentation_create(dpy, backend));
|
|
||||||
|
|
||||||
/* Make sure XWayland clients don't connect to the parent X server,
|
/* Make sure XWayland clients don't connect to the parent X server,
|
||||||
* e.g when running in the x11 backend or the wayland backend and the
|
* e.g when running in the x11 backend or the wayland backend and the
|
||||||
* compositor has Xwayland support */
|
* compositor has Xwayland support */
|
||||||
@@ -2920,11 +2976,11 @@ void
|
|||||||
virtualpointer(struct wl_listener *listener, void *data)
|
virtualpointer(struct wl_listener *listener, void *data)
|
||||||
{
|
{
|
||||||
struct wlr_virtual_pointer_v1_new_pointer_event *event = data;
|
struct wlr_virtual_pointer_v1_new_pointer_event *event = data;
|
||||||
struct wlr_pointer pointer = event->new_pointer->pointer;
|
struct wlr_input_device *device = &event->new_pointer->pointer.base;
|
||||||
|
|
||||||
wlr_cursor_attach_input_device(cursor, &pointer.base);
|
wlr_cursor_attach_input_device(cursor, device);
|
||||||
if (event->suggested_output)
|
if (event->suggested_output)
|
||||||
wlr_cursor_map_input_to_output(cursor, &pointer.base, event->suggested_output);
|
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
Monitor *
|
Monitor *
|
||||||
|
|||||||
Reference in New Issue
Block a user