Compare commits
60 commits
stachelbee
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4456f4536a | ||
![]() |
e0f531d508 | ||
![]() |
aa69ed81b5 | ||
![]() |
d1c2f43498 | ||
![]() |
da13a95683 | ||
![]() |
9a9f67db1c | ||
![]() |
4e7e2999d4 | ||
![]() |
0925fe956a | ||
![]() |
26504f9a6f | ||
![]() |
6f34a6d3a6 | ||
![]() |
30f5063474 | ||
![]() |
1d08ade132 | ||
![]() |
84245764e2 | ||
![]() |
6ca87210d4 | ||
![]() |
002c7d2204 | ||
![]() |
8206cc8889 | ||
![]() |
54f207839f | ||
![]() |
9c05b9622c | ||
![]() |
d34be5d545 | ||
![]() |
c49312f084 | ||
![]() |
f899060965 | ||
![]() |
cc72df11d6 | ||
![]() |
0312720ae8 | ||
![]() |
6de87121e2 | ||
![]() |
bbc00d88a4 | ||
![]() |
54b546121b | ||
![]() |
43016bdad8 | ||
![]() |
b616476c85 | ||
![]() |
d4ad37354e | ||
![]() |
5db05e82bd | ||
![]() |
8ec5e52e06 | ||
![]() |
c5275ca571 | ||
![]() |
2c0b889f86 | ||
![]() |
554754c9a2 | ||
![]() |
0caa658276 | ||
![]() |
07aeef1f7e | ||
![]() |
e454f7ae81 | ||
![]() |
334bbe6f0f | ||
![]() |
1b805ddd38 | ||
![]() |
94f4ead7da | ||
![]() |
bb21ecda30 | ||
![]() |
b25717c939 | ||
![]() |
a4fa954616 | ||
![]() |
35951a8d7e | ||
![]() |
a634e3f527 | ||
![]() |
d136dadf45 | ||
![]() |
672b4c405d | ||
![]() |
b5abbc37d8 | ||
![]() |
986beef5be | ||
![]() |
487abc28ba | ||
![]() |
cd216908a7 | ||
![]() |
f2c5023a3a | ||
![]() |
4bbbb4907e | ||
![]() |
ea6a450121 | ||
![]() |
ad30ca910b | ||
![]() |
452a314faa | ||
![]() |
da6de7c4d7 | ||
![]() |
2553111aa3 | ||
![]() |
51881da27b | ||
![]() |
7328e5691c |
9 changed files with 397 additions and 340 deletions
3
.mailmap
Normal file
3
.mailmap
Normal file
|
@ -0,0 +1,3 @@
|
|||
Lennart Jablonka <humm@ljabl.com> <hummsmith42@gmail.com>
|
||||
Leonardo Hernández Hernández <leohdz172@proton.me> <leohdz172@outlook.com>
|
||||
Leonardo Hernández Hernández <leohdz172@proton.me> <leohdz172@protonmail.com>
|
23
CHANGELOG.md
23
CHANGELOG.md
|
@ -1,10 +1,33 @@
|
|||
# Changelog
|
||||
|
||||
* [Unreleased](#unreleased)
|
||||
* [0.7](#0.7)
|
||||
* [0.6](#0.6)
|
||||
* [0.5](#0.5)
|
||||
|
||||
|
||||
## Unreleased
|
||||
### Added
|
||||
|
||||
* Support for the linux-drm-syncobj-v1 protocol ([wlroots!4715][wlroots!4715], [#685][685])
|
||||
* Allow the use of non-system wlroots library ([#646][646])
|
||||
|
||||
[wlroots!4715]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4715
|
||||
[685]: https://codeberg.org/dwl/dwl/pulls/685
|
||||
[646]: https://codeberg.org/dwl/dwl/pulls/646
|
||||
|
||||
|
||||
### Changed
|
||||
### Deprecated
|
||||
### Removed
|
||||
### Fixed
|
||||
|
||||
* Crash when a client is created while all outputs are disabled.
|
||||
|
||||
### Security
|
||||
### Contributors
|
||||
|
||||
|
||||
## 0.7
|
||||
|
||||
This version is just 0.6 with wlroots 0.18 compatibility.
|
||||
|
|
9
Makefile
9
Makefile
|
@ -6,15 +6,15 @@ include config.mk
|
|||
# flags for compiling
|
||||
DWLCPPFLAGS = -I. -DWLR_USE_UNSTABLE -D_POSIX_C_SOURCE=200809L \
|
||||
-DVERSION=\"$(VERSION)\" $(XWAYLAND)
|
||||
DWLDEVCFLAGS = -g -pedantic -Wall -Wextra -Wdeclaration-after-statement \
|
||||
DWLDEVCFLAGS = -g -Wpedantic -Wall -Wextra -Wdeclaration-after-statement \
|
||||
-Wno-unused-parameter -Wshadow -Wunused-macros -Werror=strict-prototypes \
|
||||
-Werror=implicit -Werror=return-type -Werror=incompatible-pointer-types \
|
||||
-Wfloat-conversion
|
||||
|
||||
# CFLAGS / LDFLAGS
|
||||
PKGS = wlroots-0.18 wayland-server xkbcommon libinput $(XLIBS)
|
||||
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` -lm $(LIBS)
|
||||
PKGS = wayland-server xkbcommon libinput $(XLIBS)
|
||||
DWLCFLAGS = `$(PKG_CONFIG) --cflags $(PKGS)` $(WLR_INCS) $(DWLCPPFLAGS) $(DWLDEVCFLAGS) $(CFLAGS)
|
||||
LDLIBS = `$(PKG_CONFIG) --libs $(PKGS)` $(WLR_LIBS) -lm $(LIBS)
|
||||
|
||||
all: dwl
|
||||
dwl: dwl.o util.o
|
||||
|
@ -61,6 +61,7 @@ dist: clean
|
|||
|
||||
install: dwl
|
||||
mkdir -p $(DESTDIR)$(PREFIX)/bin
|
||||
rm -f $(DESTDIR)$(PREFIX)/bin/dwl
|
||||
cp -f dwl $(DESTDIR)$(PREFIX)/bin
|
||||
chmod 755 $(DESTDIR)$(PREFIX)/bin/dwl
|
||||
mkdir -p $(DESTDIR)$(MANDIR)/man1
|
||||
|
|
241
README.md
241
README.md
|
@ -1,25 +1,136 @@
|
|||
# dwl - dwm for Wayland
|
||||
|
||||
Join us on our IRC channel: [#dwl on Libera Chat]
|
||||
Or on our [Discord server].
|
||||
Or on the community-maintained [Discord server].
|
||||
|
||||
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,
|
||||
primarily in terms of functionality, and secondarily in terms of philosophy.
|
||||
Like dwm, dwl is:
|
||||
primarily in terms of functionality, and secondarily in terms of
|
||||
philosophy. Like dwm, dwl is:
|
||||
|
||||
- Easy to understand, hack on, and extend with patches
|
||||
- One C source file (or a very small number) configurable via `config.h`
|
||||
- Tied to as few external dependencies as possible
|
||||
|
||||
## Getting Started:
|
||||
|
||||
### 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
|
||||
sticks to features which are necessary, simple, and straightforward to implement
|
||||
given the base on which it is built. Implemented default features are:
|
||||
|
||||
- Any features provided by dwm/Xlib: simple window borders, tags, keybindings,
|
||||
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
|
||||
drawing libraries when an external bar could work well.
|
||||
exception to this goal, to avoid dependencies on font rendering and/or drawing
|
||||
libraries when an external bar could work well.
|
||||
- Configurable multi-monitor layout support, including position and rotation
|
||||
- Configurable HiDPI/multi-DPI support
|
||||
- Idle-inhibit protocol which lets applications such as mpv disable idle
|
||||
|
@ -53,100 +164,6 @@ Feature *non-goals* for the main codebase include:
|
|||
be done through the compositor
|
||||
- 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
|
||||
|
||||
dwl began by extending the TinyWL example provided (CC0) by the sway/wlroots
|
||||
|
@ -164,17 +181,19 @@ inspiration, and to the various contributors to the project, including:
|
|||
- 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
|
||||
[#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
|
||||
[list of useful resources on our wiki]:
|
||||
https://codeberg.org/dwl/dwl/wiki/Home#migrating-from-x
|
||||
[Discord server]: https://discord.gg/jJxZnrGPWN
|
||||
[Wayland]: https://wayland.freedesktop.org/
|
||||
|
|
56
client.h
56
client.h
|
@ -126,15 +126,14 @@ client_get_appid(Client *c)
|
|||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->class;
|
||||
return c->surface.xwayland->class ? c->surface.xwayland->class : "broken";
|
||||
#endif
|
||||
return c->surface.xdg->toplevel->app_id;
|
||||
return c->surface.xdg->toplevel->app_id ? c->surface.xdg->toplevel->app_id : "broken";
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_get_clip(Client *c, struct wlr_box *clip)
|
||||
{
|
||||
struct wlr_box xdg_geom = {0};
|
||||
*clip = (struct wlr_box){
|
||||
.x = 0,
|
||||
.y = 0,
|
||||
|
@ -147,9 +146,8 @@ client_get_clip(Client *c, struct wlr_box *clip)
|
|||
return;
|
||||
#endif
|
||||
|
||||
wlr_xdg_surface_get_geometry(c->surface.xdg, &xdg_geom);
|
||||
clip->x = xdg_geom.x;
|
||||
clip->y = xdg_geom.y;
|
||||
clip->x = c->surface.xdg->geometry.x;
|
||||
clip->y = c->surface.xdg->geometry.y;
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
@ -164,7 +162,7 @@ client_get_geometry(Client *c, struct wlr_box *geom)
|
|||
return;
|
||||
}
|
||||
#endif
|
||||
wlr_xdg_surface_get_geometry(c->surface.xdg, geom);
|
||||
*geom = c->surface.xdg->geometry;
|
||||
}
|
||||
|
||||
static inline Client *
|
||||
|
@ -200,9 +198,9 @@ client_get_title(Client *c)
|
|||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
return c->surface.xwayland->title;
|
||||
return c->surface.xwayland->title ? c->surface.xwayland->title : "broken";
|
||||
#endif
|
||||
return c->surface.xdg->toplevel->title;
|
||||
return c->surface.xdg->toplevel->title ? c->surface.xdg->toplevel->title : "broken";
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -215,16 +213,15 @@ client_is_float_type(Client *c)
|
|||
if (client_is_x11(c)) {
|
||||
struct wlr_xwayland_surface *surface = c->surface.xwayland;
|
||||
xcb_size_hints_t *size_hints = surface->size_hints;
|
||||
size_t i;
|
||||
if (surface->modal)
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < surface->window_type_len; i++)
|
||||
if (surface->window_type[i] == netatom[NetWMWindowTypeDialog]
|
||||
|| surface->window_type[i] == netatom[NetWMWindowTypeSplash]
|
||||
|| surface->window_type[i] == netatom[NetWMWindowTypeToolbar]
|
||||
|| surface->window_type[i] == netatom[NetWMWindowTypeUtility])
|
||||
return 1;
|
||||
if (wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_DIALOG)
|
||||
|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_SPLASH)
|
||||
|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_TOOLBAR)
|
||||
|| wlr_xwayland_surface_has_window_type(surface, WLR_XWAYLAND_NET_WM_WINDOW_TYPE_UTILITY)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return size_hints && size_hints->min_width > 0 && size_hints->min_height > 0
|
||||
&& (size_hints->max_width == size_hints->min_width
|
||||
|
@ -301,17 +298,6 @@ client_notify_enter(struct wlr_surface *s, struct wlr_keyboard *kb)
|
|||
wlr_seat_keyboard_notify_enter(seat, s, NULL, 0, NULL);
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_restack_surface(Client *c)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
wlr_xwayland_surface_restack(c->surface.xwayland, NULL,
|
||||
XCB_STACK_MODE_ABOVE);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_send_close(Client *c)
|
||||
{
|
||||
|
@ -344,6 +330,13 @@ client_set_fullscreen(Client *c, int fullscreen)
|
|||
wlr_xdg_toplevel_set_fullscreen(c->surface.xdg->toplevel, fullscreen);
|
||||
}
|
||||
|
||||
static inline void
|
||||
client_set_scale(struct wlr_surface *s, float scale)
|
||||
{
|
||||
wlr_fractional_scale_v1_notify_scale(s, scale);
|
||||
wlr_surface_set_preferred_buffer_scale(s, (int32_t)ceilf(scale));
|
||||
}
|
||||
|
||||
static inline uint32_t
|
||||
client_set_size(Client *c, uint32_t width, uint32_t height)
|
||||
{
|
||||
|
@ -364,8 +357,11 @@ static inline void
|
|||
client_set_tiled(Client *c, uint32_t edges)
|
||||
{
|
||||
#ifdef XWAYLAND
|
||||
if (client_is_x11(c))
|
||||
if (client_is_x11(c)) {
|
||||
wlr_xwayland_surface_set_maximized(c->surface.xwayland,
|
||||
edges != WLR_EDGE_NONE, edges != WLR_EDGE_NONE);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
if (wl_resource_get_version(c->surface.xdg->toplevel->resource)
|
||||
>= XDG_TOPLEVEL_STATE_TILED_RIGHT_SINCE_VERSION) {
|
||||
|
@ -391,8 +387,8 @@ client_wants_focus(Client *c)
|
|||
{
|
||||
#ifdef XWAYLAND
|
||||
return client_is_unmanaged(c)
|
||||
&& wlr_xwayland_or_surface_wants_focus(c->surface.xwayland)
|
||||
&& wlr_xwayland_icccm_input_model(c->surface.xwayland) != WLR_ICCCM_INPUT_MODEL_NONE;
|
||||
&& wlr_xwayland_surface_override_redirect_wants_focus(c->surface.xwayland)
|
||||
&& wlr_xwayland_surface_icccm_input_model(c->surface.xwayland) != WLR_ICCCM_INPUT_MODEL_NONE;
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
|
23
config.mk
23
config.mk
|
@ -1,4 +1,4 @@
|
|||
_VERSION = 0.7-rc1
|
||||
_VERSION = 0.8-dev
|
||||
VERSION = `git describe --tags --dirty 2>/dev/null || echo $(_VERSION)`
|
||||
|
||||
PKG_CONFIG = pkg-config
|
||||
|
@ -8,10 +8,29 @@ PREFIX = /usr/local
|
|||
MANDIR = $(PREFIX)/share/man
|
||||
DATADIR = $(PREFIX)/share
|
||||
|
||||
WLR_INCS = `$(PKG_CONFIG) --cflags wlroots-0.19`
|
||||
WLR_LIBS = `$(PKG_CONFIG) --libs wlroots-0.19`
|
||||
|
||||
# Allow using an alternative wlroots installations
|
||||
# This has to have all the includes required by wlroots, e.g:
|
||||
# Assuming wlroots git repo is "${PWD}/wlroots" and you only ran "meson setup build && ninja -C build"
|
||||
#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \
|
||||
# -I$(PWD)/wlroots/include
|
||||
# Set -rpath to avoid using the wrong library.
|
||||
#WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/build -L$(PWD)/wlroots/build -lwlroots-0.19
|
||||
|
||||
# Assuming you ran "meson setup --prefix ${PWD}/0.19 build && ninja -C build install"
|
||||
#WLR_INCS = -I/usr/include/pixman-1 -I/usr/include/elogind -I/usr/include/libdrm \
|
||||
# -I$(PWD)/wlroots/0.19/include/wlroots-0.19
|
||||
#WLR_LIBS = -Wl,-rpath,$(PWD)/wlroots/0.19/lib64 -L$(PWD)/wlroots/0.19/lib64 -lwlroots-0.19
|
||||
|
||||
XWAYLAND =
|
||||
XLIBS =
|
||||
# Uncomment to build XWayland support
|
||||
#XWAYLAND = -DXWAYLAND
|
||||
#XLIBS = xcb xcb-icccm
|
||||
|
||||
CC = gcc
|
||||
# dwl itself only uses C99 features, but wlroots' headers use anonymous unions (C11).
|
||||
# To avoid warnings about them, we do not use -std=c99 and instead of using the
|
||||
# gmake default 'CC=c99', we use cc.
|
||||
CC = cc
|
||||
|
|
2
dwl.1
2
dwl.1
|
@ -140,7 +140,7 @@ server.
|
|||
Start
|
||||
.Nm
|
||||
with s6 in the background:
|
||||
.Dl dwl -s 's6-svscan <&-'
|
||||
.Dl dwl \-s \(aqs6\-svscan <&\-\(aq
|
||||
.Sh SEE ALSO
|
||||
.Xr foot 1 ,
|
||||
.Xr wmenu 1 ,
|
||||
|
|
370
dwl.c
370
dwl.c
|
@ -33,6 +33,7 @@
|
|||
#include <wlr/types/wlr_keyboard_group.h>
|
||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||
#include <wlr/types/wlr_linux_dmabuf_v1.h>
|
||||
#include <wlr/types/wlr_linux_drm_syncobj_v1.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_output_management_v1.h>
|
||||
|
@ -78,16 +79,12 @@
|
|||
#define END(A) ((A) + LENGTH(A))
|
||||
#define TAGMASK ((1u << TAGCOUNT) - 1)
|
||||
#define LISTEN(E, L, H) wl_signal_add((E), ((L)->notify = (H), (L)))
|
||||
#define LISTEN_STATIC(E, H) do { static struct wl_listener _l = {.notify = (H)}; wl_signal_add((E), &_l); } while (0)
|
||||
#define LISTEN_STATIC(E, H) do { struct wl_listener *_l = ecalloc(1, sizeof(*_l)); _l->notify = (H); wl_signal_add((E), _l); } while (0)
|
||||
|
||||
/* enums */
|
||||
enum { CurNormal, CurPressed, CurMove, CurResize }; /* cursor */
|
||||
enum { XDGShell, LayerShell, X11 }; /* client types */
|
||||
enum { LyrBg, LyrBottom, LyrTile, LyrFloat, LyrTop, LyrFS, LyrOverlay, LyrBlock, NUM_LAYERS }; /* scene layers */
|
||||
#ifdef XWAYLAND
|
||||
enum { NetWMWindowTypeDialog, NetWMWindowTypeSplash, NetWMWindowTypeToolbar,
|
||||
NetWMWindowTypeUtility, NetLast }; /* EWMH atoms */
|
||||
#endif
|
||||
|
||||
typedef union {
|
||||
int i;
|
||||
|
@ -105,15 +102,18 @@ typedef struct {
|
|||
|
||||
typedef struct Monitor Monitor;
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
/* Must keep this field first */
|
||||
unsigned int type; /* XDGShell or X11* */
|
||||
struct wlr_box geom; /* layout-relative, includes border */
|
||||
|
||||
Monitor *mon;
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_rect *border[4]; /* top, bottom, left, right */
|
||||
struct wlr_scene_tree *scene_surface;
|
||||
struct wl_list link;
|
||||
struct wl_list flink;
|
||||
struct wlr_box geom; /* layout-relative, includes border */
|
||||
struct wlr_box prev; /* layout-relative, includes border */
|
||||
struct wlr_box bounds; /* only width and height are used */
|
||||
union {
|
||||
struct wlr_xdg_surface *xdg;
|
||||
struct wlr_xwayland_surface *xwayland;
|
||||
|
@ -128,8 +128,6 @@ typedef struct {
|
|||
struct wl_listener fullscreen;
|
||||
struct wl_listener set_decoration_mode;
|
||||
struct wl_listener destroy_decoration;
|
||||
struct wlr_box prev; /* layout-relative, includes border */
|
||||
struct wlr_box bounds;
|
||||
#ifdef XWAYLAND
|
||||
struct wl_listener activate;
|
||||
struct wl_listener associate;
|
||||
|
@ -151,7 +149,6 @@ typedef struct {
|
|||
} Key;
|
||||
|
||||
typedef struct {
|
||||
struct wl_list link;
|
||||
struct wlr_keyboard_group *wlr_group;
|
||||
|
||||
int nsyms;
|
||||
|
@ -165,9 +162,9 @@ typedef struct {
|
|||
} KeyboardGroup;
|
||||
|
||||
typedef struct {
|
||||
/* Must keep these three elements in this order */
|
||||
/* Must keep this field first */
|
||||
unsigned int type; /* LayerShell */
|
||||
struct wlr_box geom;
|
||||
|
||||
Monitor *mon;
|
||||
struct wlr_scene_tree *scene;
|
||||
struct wlr_scene_tree *popups;
|
||||
|
@ -255,6 +252,7 @@ static void chvt(const Arg *arg);
|
|||
static void checkidleinhibitor(struct wlr_surface *exclude);
|
||||
static void cleanup(void);
|
||||
static void cleanupmon(struct wl_listener *listener, void *data);
|
||||
static void cleanuplisteners(void);
|
||||
static void closemon(Monitor *m);
|
||||
static void commitlayersurfacenotify(struct wl_listener *listener, void *data);
|
||||
static void commitnotify(struct wl_listener *listener, void *data);
|
||||
|
@ -282,7 +280,6 @@ static void destroylocksurface(struct wl_listener *listener, void *data);
|
|||
static void destroynotify(struct wl_listener *listener, void *data);
|
||||
static void destroypointerconstraint(struct wl_listener *listener, void *data);
|
||||
static void destroysessionlock(struct wl_listener *listener, void *data);
|
||||
static void destroysessionmgr(struct wl_listener *listener, void *data);
|
||||
static void destroykeyboardgroup(struct wl_listener *listener, void *data);
|
||||
static Monitor *dirtomon(enum wlr_direction dir);
|
||||
static void focusclient(Client *c, int lift);
|
||||
|
@ -326,7 +323,6 @@ static void setcursor(struct wl_listener *listener, void *data);
|
|||
static void setcursorshape(struct wl_listener *listener, void *data);
|
||||
static void setfloating(Client *c, int floating);
|
||||
static void setfullscreen(Client *c, int fullscreen);
|
||||
static void setgamma(struct wl_listener *listener, void *data);
|
||||
static void setlayout(const Arg *arg);
|
||||
static void setmfact(const Arg *arg);
|
||||
static void setmon(Client *c, Monitor *m, uint32_t newtags);
|
||||
|
@ -357,7 +353,6 @@ static void xytonode(double x, double y, struct wlr_surface **psurface,
|
|||
static void zoom(const Arg *arg);
|
||||
|
||||
/* variables */
|
||||
static const char broken[] = "broken";
|
||||
static pid_t child_pid = -1;
|
||||
static int locked;
|
||||
static void *exclusive_focus;
|
||||
|
@ -383,7 +378,6 @@ static struct wlr_idle_notifier_v1 *idle_notifier;
|
|||
static struct wlr_idle_inhibit_manager_v1 *idle_inhibit_mgr;
|
||||
static struct wlr_layer_shell_v1 *layer_shell;
|
||||
static struct wlr_output_manager_v1 *output_mgr;
|
||||
static struct wlr_gamma_control_manager_v1 *gamma_control_mgr;
|
||||
static struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard_mgr;
|
||||
static struct wlr_virtual_pointer_manager_v1 *virtual_pointer_mgr;
|
||||
static struct wlr_cursor_shape_manager_v1 *cursor_shape_mgr;
|
||||
|
@ -400,7 +394,6 @@ static struct wlr_scene_rect *root_bg;
|
|||
static struct wlr_session_lock_manager_v1 *session_lock_mgr;
|
||||
static struct wlr_scene_rect *locked_bg;
|
||||
static struct wlr_session_lock_v1 *cur_lock;
|
||||
static struct wl_listener lock_listener = {.notify = locksession};
|
||||
|
||||
static struct wlr_seat *seat;
|
||||
static KeyboardGroup *kb_group;
|
||||
|
@ -413,17 +406,47 @@ static struct wlr_box sgeom;
|
|||
static struct wl_list mons;
|
||||
static Monitor *selmon;
|
||||
|
||||
/* global event handlers */
|
||||
static struct wl_listener cursor_axis = {.notify = axisnotify};
|
||||
static struct wl_listener cursor_button = {.notify = buttonpress};
|
||||
static struct wl_listener cursor_frame = {.notify = cursorframe};
|
||||
static struct wl_listener cursor_motion = {.notify = motionrelative};
|
||||
static struct wl_listener cursor_motion_absolute = {.notify = motionabsolute};
|
||||
static struct wl_listener gpu_reset = {.notify = gpureset};
|
||||
static struct wl_listener layout_change = {.notify = updatemons};
|
||||
static struct wl_listener new_idle_inhibitor = {.notify = createidleinhibitor};
|
||||
static struct wl_listener new_input_device = {.notify = inputdevice};
|
||||
static struct wl_listener new_virtual_keyboard = {.notify = virtualkeyboard};
|
||||
static struct wl_listener new_virtual_pointer = {.notify = virtualpointer};
|
||||
static struct wl_listener new_pointer_constraint = {.notify = createpointerconstraint};
|
||||
static struct wl_listener new_output = {.notify = createmon};
|
||||
static struct wl_listener new_xdg_toplevel = {.notify = createnotify};
|
||||
static struct wl_listener new_xdg_popup = {.notify = createpopup};
|
||||
static struct wl_listener new_xdg_decoration = {.notify = createdecoration};
|
||||
static struct wl_listener new_layer_surface = {.notify = createlayersurface};
|
||||
static struct wl_listener output_mgr_apply = {.notify = outputmgrapply};
|
||||
static struct wl_listener output_mgr_test = {.notify = outputmgrtest};
|
||||
static struct wl_listener output_power_mgr_set_mode = {.notify = powermgrsetmode};
|
||||
static struct wl_listener request_activate = {.notify = urgent};
|
||||
static struct wl_listener request_cursor = {.notify = setcursor};
|
||||
static struct wl_listener request_set_psel = {.notify = setpsel};
|
||||
static struct wl_listener request_set_sel = {.notify = setsel};
|
||||
static struct wl_listener request_set_cursor_shape = {.notify = setcursorshape};
|
||||
static struct wl_listener request_start_drag = {.notify = requeststartdrag};
|
||||
static struct wl_listener start_drag = {.notify = startdrag};
|
||||
static struct wl_listener new_session_lock = {.notify = locksession};
|
||||
|
||||
#ifdef XWAYLAND
|
||||
static void activatex11(struct wl_listener *listener, void *data);
|
||||
static void associatex11(struct wl_listener *listener, void *data);
|
||||
static void configurex11(struct wl_listener *listener, void *data);
|
||||
static void createnotifyx11(struct wl_listener *listener, void *data);
|
||||
static void dissociatex11(struct wl_listener *listener, void *data);
|
||||
static xcb_atom_t getatom(xcb_connection_t *xc, const char *name);
|
||||
static void sethints(struct wl_listener *listener, void *data);
|
||||
static void xwaylandready(struct wl_listener *listener, void *data);
|
||||
static struct wl_listener new_xwayland_surface = {.notify = createnotifyx11};
|
||||
static struct wl_listener xwayland_ready = {.notify = xwaylandready};
|
||||
static struct wlr_xwayland *xwayland;
|
||||
static xcb_atom_t netatom[NetLast];
|
||||
#endif
|
||||
|
||||
/* configuration, allows nested code to access above variables */
|
||||
|
@ -461,10 +484,8 @@ applyrules(Client *c)
|
|||
Monitor *mon = selmon, *m;
|
||||
|
||||
c->isfloating = client_is_float_type(c);
|
||||
if (!(appid = client_get_appid(c)))
|
||||
appid = broken;
|
||||
if (!(title = client_get_title(c)))
|
||||
title = broken;
|
||||
appid = client_get_appid(c);
|
||||
title = client_get_title(c);
|
||||
|
||||
for (r = rules; r < END(rules); r++) {
|
||||
if ((!r->title || strstr(title, r->title))
|
||||
|
@ -530,13 +551,14 @@ arrangelayer(Monitor *m, struct wl_list *list, struct wlr_box *usable_area, int
|
|||
wl_list_for_each(l, list, link) {
|
||||
struct wlr_layer_surface_v1 *layer_surface = l->layer_surface;
|
||||
|
||||
if (!layer_surface->initialized)
|
||||
continue;
|
||||
|
||||
if (exclusive != (layer_surface->current.exclusive_zone > 0))
|
||||
continue;
|
||||
|
||||
wlr_scene_layer_surface_v1_configure(l->scene_layer, &full_area, usable_area);
|
||||
wlr_scene_node_set_position(&l->popups->node, l->scene->node.x, l->scene->node.y);
|
||||
l->geom.x = l->scene->node.x;
|
||||
l->geom.y = l->scene->node.y;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -630,17 +652,17 @@ buttonpress(struct wl_listener *listener, void *data)
|
|||
break;
|
||||
case WL_POINTER_BUTTON_STATE_RELEASED:
|
||||
/* 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) {
|
||||
wlr_cursor_set_xcursor(cursor, cursor_mgr, "default");
|
||||
cursor_mode = CurNormal;
|
||||
/* Drop the window off on its new monitor */
|
||||
selmon = xytomon(cursor->x, cursor->y);
|
||||
setmon(grabc, selmon, 0);
|
||||
grabc = NULL;
|
||||
return;
|
||||
} else {
|
||||
cursor_mode = CurNormal;
|
||||
}
|
||||
cursor_mode = CurNormal;
|
||||
break;
|
||||
}
|
||||
/* If the event wasn't handled by the compositor, notify the client with
|
||||
|
@ -676,6 +698,7 @@ checkidleinhibitor(struct wlr_surface *exclude)
|
|||
void
|
||||
cleanup(void)
|
||||
{
|
||||
cleanuplisteners();
|
||||
#ifdef XWAYLAND
|
||||
wlr_xwayland_destroy(xwayland);
|
||||
xwayland = NULL;
|
||||
|
@ -725,6 +748,43 @@ cleanupmon(struct wl_listener *listener, void *data)
|
|||
free(m);
|
||||
}
|
||||
|
||||
void
|
||||
cleanuplisteners(void)
|
||||
{
|
||||
wl_list_remove(&cursor_axis.link);
|
||||
wl_list_remove(&cursor_button.link);
|
||||
wl_list_remove(&cursor_frame.link);
|
||||
wl_list_remove(&cursor_motion.link);
|
||||
wl_list_remove(&cursor_motion_absolute.link);
|
||||
wl_list_remove(&gpu_reset.link);
|
||||
wl_list_remove(&new_idle_inhibitor.link);
|
||||
wl_list_remove(&layout_change.link);
|
||||
wl_list_remove(&new_input_device.link);
|
||||
wl_list_remove(&new_virtual_keyboard.link);
|
||||
wl_list_remove(&new_virtual_pointer.link);
|
||||
wl_list_remove(&new_pointer_constraint.link);
|
||||
wl_list_remove(&new_output.link);
|
||||
wl_list_remove(&new_xdg_toplevel.link);
|
||||
wl_list_remove(&new_xdg_decoration.link);
|
||||
wl_list_remove(&new_xdg_popup.link);
|
||||
wl_list_remove(&new_layer_surface.link);
|
||||
wl_list_remove(&output_mgr_apply.link);
|
||||
wl_list_remove(&output_mgr_test.link);
|
||||
wl_list_remove(&output_power_mgr_set_mode.link);
|
||||
wl_list_remove(&request_activate.link);
|
||||
wl_list_remove(&request_cursor.link);
|
||||
wl_list_remove(&request_set_psel.link);
|
||||
wl_list_remove(&request_set_sel.link);
|
||||
wl_list_remove(&request_set_cursor_shape.link);
|
||||
wl_list_remove(&request_start_drag.link);
|
||||
wl_list_remove(&start_drag.link);
|
||||
wl_list_remove(&new_session_lock.link);
|
||||
#ifdef XWAYLAND
|
||||
wl_list_remove(&new_xwayland_surface.link);
|
||||
wl_list_remove(&xwayland_ready.link);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
closemon(Monitor *m)
|
||||
{
|
||||
|
@ -763,6 +823,8 @@ commitlayersurfacenotify(struct wl_listener *listener, void *data)
|
|||
struct wlr_layer_surface_v1_state old_state;
|
||||
|
||||
if (l->layer_surface->initial_commit) {
|
||||
client_set_scale(layer_surface->surface, 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;
|
||||
|
@ -800,19 +862,20 @@ commitnotify(struct wl_listener *listener, void *data)
|
|||
* a wrong monitor.
|
||||
*/
|
||||
applyrules(c);
|
||||
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);
|
||||
if (c->mon) {
|
||||
client_set_scale(client_surface(c), c->mon->wlr_output->scale);
|
||||
}
|
||||
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);
|
||||
wlr_xdg_toplevel_set_wm_capabilities(c->surface.xdg->toplevel,
|
||||
WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN);
|
||||
if (c->decoration)
|
||||
requestdecorationmode(&c->set_decoration_mode, c->decoration);
|
||||
wlr_xdg_toplevel_set_size(c->surface.xdg->toplevel, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
if (client_surface(c)->mapped && c->mon)
|
||||
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
|
||||
resize(c, c->geom, (c->isfloating && !c->isfullscreen));
|
||||
|
||||
/* mark a pending resize as completed */
|
||||
if (c->resize && c->resize <= c->surface.xdg->current.configure_serial)
|
||||
|
@ -837,13 +900,16 @@ commitpopup(struct wl_listener *listener, void *data)
|
|||
return;
|
||||
popup->base->surface->data = wlr_scene_xdg_surface_create(
|
||||
popup->parent->data, popup->base);
|
||||
if ((l && !l->mon) || (c && !c->mon))
|
||||
if ((l && !l->mon) || (c && !c->mon)) {
|
||||
wlr_xdg_popup_destroy(popup);
|
||||
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);
|
||||
box.x -= (type == LayerShell ? l->scene->node.x : c->geom.x);
|
||||
box.y -= (type == LayerShell ? l->scene->node.y : c->geom.y);
|
||||
wlr_xdg_popup_unconstrain_from_box(popup, &box);
|
||||
wl_list_remove(&listener->link);
|
||||
free(listener);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -945,8 +1011,6 @@ createlayersurface(struct wl_listener *listener, void *data)
|
|||
|
||||
wl_list_insert(&l->mon->layers[layer_surface->pending.layer],&l->link);
|
||||
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));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1097,10 +1161,10 @@ createpointer(struct wlr_pointer *pointer)
|
|||
libinput_device_config_middle_emulation_set_enabled(device, middle_button_emulation);
|
||||
|
||||
if (libinput_device_config_scroll_get_methods(device) != LIBINPUT_CONFIG_SCROLL_NO_SCROLL)
|
||||
libinput_device_config_scroll_set_method (device, scroll_method);
|
||||
libinput_device_config_scroll_set_method(device, scroll_method);
|
||||
|
||||
if (libinput_device_config_click_get_methods(device) != LIBINPUT_CONFIG_CLICK_METHOD_NONE)
|
||||
libinput_device_config_click_set_method (device, click_method);
|
||||
libinput_device_config_click_set_method(device, click_method);
|
||||
|
||||
if (libinput_device_config_send_events_get_modes(device))
|
||||
libinput_device_config_send_events_set_mode(device, send_events_mode);
|
||||
|
@ -1174,7 +1238,6 @@ void
|
|||
destroydecoration(struct wl_listener *listener, void *data)
|
||||
{
|
||||
Client *c = wl_container_of(listener, c, destroy_decoration);
|
||||
c->decoration = NULL;
|
||||
|
||||
wl_list_remove(&c->destroy_decoration.link);
|
||||
wl_list_remove(&c->set_decoration_mode.link);
|
||||
|
@ -1186,6 +1249,8 @@ destroydragicon(struct wl_listener *listener, void *data)
|
|||
/* Focus enter isn't sent during drag, so refocus the focused node. */
|
||||
focusclient(focustop(selmon), 1);
|
||||
motionnotify(0, NULL, 0, 0, 0, 0);
|
||||
wl_list_remove(&listener->link);
|
||||
free(listener);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1194,6 +1259,8 @@ destroyidleinhibitor(struct wl_listener *listener, void *data)
|
|||
/* `data` is the wlr_surface of the idle inhibitor being destroyed,
|
||||
* at this point the idle inhibitor is still in the list of the manager */
|
||||
checkidleinhibitor(wlr_surface_get_root_surface(data));
|
||||
wl_list_remove(&listener->link);
|
||||
free(listener);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1275,6 +1342,7 @@ destroynotify(struct wl_listener *listener, void *data)
|
|||
wl_list_remove(&c->commit.link);
|
||||
wl_list_remove(&c->map.link);
|
||||
wl_list_remove(&c->unmap.link);
|
||||
wl_list_remove(&c->maximize.link);
|
||||
}
|
||||
free(c);
|
||||
}
|
||||
|
@ -1300,22 +1368,15 @@ destroysessionlock(struct wl_listener *listener, void *data)
|
|||
destroylock(lock, 0);
|
||||
}
|
||||
|
||||
void
|
||||
destroysessionmgr(struct wl_listener *listener, void *data)
|
||||
{
|
||||
wl_list_remove(&lock_listener.link);
|
||||
wl_list_remove(&listener->link);
|
||||
}
|
||||
|
||||
void
|
||||
destroykeyboardgroup(struct wl_listener *listener, void *data)
|
||||
{
|
||||
KeyboardGroup *group = wl_container_of(listener, group, destroy);
|
||||
wl_event_source_remove(group->key_repeat_source);
|
||||
wlr_keyboard_group_destroy(group->wlr_group);
|
||||
wl_list_remove(&group->key.link);
|
||||
wl_list_remove(&group->modifiers.link);
|
||||
wl_list_remove(&group->destroy.link);
|
||||
wlr_keyboard_group_destroy(group->wlr_group);
|
||||
free(group);
|
||||
}
|
||||
|
||||
|
@ -1365,7 +1426,6 @@ focusclient(Client *c, int lift)
|
|||
wl_list_insert(&fstack, &c->flink);
|
||||
selmon = c->mon;
|
||||
c->isurgent = 0;
|
||||
client_restack_surface(c);
|
||||
|
||||
/* Don't change border color if there is an exclusive focus or we are
|
||||
* handling a drag operation */
|
||||
|
@ -1481,7 +1541,8 @@ gpureset(struct wl_listener *listener, void *data)
|
|||
if (!(alloc = wlr_allocator_autocreate(backend, drw)))
|
||||
die("couldn't recreate allocator");
|
||||
|
||||
LISTEN_STATIC(&drw->events.lost, gpureset);
|
||||
wl_list_remove(&gpu_reset.link);
|
||||
wl_signal_add(&drw->events.lost, &gpu_reset);
|
||||
|
||||
wlr_compositor_set_renderer(compositor, drw);
|
||||
|
||||
|
@ -1496,22 +1557,10 @@ gpureset(struct wl_listener *listener, void *data)
|
|||
void
|
||||
handlesig(int signo)
|
||||
{
|
||||
if (signo == SIGCHLD) {
|
||||
#ifdef XWAYLAND
|
||||
siginfo_t in;
|
||||
/* wlroots expects to reap the XWayland process itself, so we
|
||||
* use WNOWAIT to keep the child waitable until we know it's not
|
||||
* XWayland.
|
||||
*/
|
||||
while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid
|
||||
&& (!xwayland || in.si_pid != xwayland->server->pid))
|
||||
waitpid(in.si_pid, NULL, 0);
|
||||
#else
|
||||
if (signo == SIGCHLD)
|
||||
while (waitpid(-1, NULL, WNOHANG) > 0);
|
||||
#endif
|
||||
} else if (signo == SIGINT || signo == SIGTERM) {
|
||||
else if (signo == SIGINT || signo == SIGTERM)
|
||||
quit(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1692,7 +1741,8 @@ mapnotify(struct wl_listener *listener, void *data)
|
|||
|
||||
/* Create scene tree for this client and its border */
|
||||
c->scene = client_surface(c)->data = wlr_scene_tree_create(layers[LyrTile]);
|
||||
wlr_scene_node_set_enabled(&c->scene->node, c->type != XDGShell);
|
||||
/* Enabled later by a call to arrange() */
|
||||
wlr_scene_node_set_enabled(&c->scene->node, client_is_unmanaged(c));
|
||||
c->scene_surface = c->type == XDGShell
|
||||
? wlr_scene_xdg_surface_create(c->scene, c->surface.xdg)
|
||||
: wlr_scene_subsurface_tree_create(c->scene, client_surface(c));
|
||||
|
@ -1705,6 +1755,7 @@ mapnotify(struct wl_listener *listener, void *data)
|
|||
/* Unmanaged clients always are floating */
|
||||
wlr_scene_node_reparent(&c->scene->node, layers[LyrFloat]);
|
||||
wlr_scene_node_set_position(&c->scene->node, c->geom.x, c->geom.y);
|
||||
client_set_size(c, c->geom.width, c->geom.height);
|
||||
if (client_wants_focus(c)) {
|
||||
focusclient(c, 1);
|
||||
exclusive_focus = c;
|
||||
|
@ -1822,8 +1873,8 @@ motionnotify(uint32_t time, struct wlr_input_device *device, double dx, double d
|
|||
&& toplevel_from_wlr_surface(seat->pointer_state.focused_surface, &w, &l) >= 0) {
|
||||
c = w;
|
||||
surface = seat->pointer_state.focused_surface;
|
||||
sx = cursor->x - (l ? l->geom.x : w->geom.x);
|
||||
sy = cursor->y - (l ? l->geom.y : w->geom.y);
|
||||
sx = cursor->x - (l ? l->scene->node.x : w->geom.x);
|
||||
sy = cursor->y - (l ? l->scene->node.y : w->geom.y);
|
||||
}
|
||||
|
||||
/* time is 0 in internal calls meant to restore pointer focus. */
|
||||
|
@ -2037,7 +2088,6 @@ printstatus(void)
|
|||
Monitor *m = NULL;
|
||||
Client *c;
|
||||
uint32_t occ, urg, sel;
|
||||
const char *appid, *title;
|
||||
|
||||
wl_list_for_each(m, &mons, link) {
|
||||
occ = urg = 0;
|
||||
|
@ -2049,10 +2099,8 @@ printstatus(void)
|
|||
urg |= c->tags;
|
||||
}
|
||||
if ((c = focustop(m))) {
|
||||
title = client_get_title(c);
|
||||
appid = client_get_appid(c);
|
||||
printf("%s title %s\n", m->wlr_output->name, title ? title : broken);
|
||||
printf("%s appid %s\n", m->wlr_output->name, appid ? appid : broken);
|
||||
printf("%s title %s\n", m->wlr_output->name, client_get_title(c));
|
||||
printf("%s appid %s\n", m->wlr_output->name, client_get_appid(c));
|
||||
printf("%s fullscreen %d\n", m->wlr_output->name, c->isfullscreen);
|
||||
printf("%s floating %d\n", m->wlr_output->name, c->isfloating);
|
||||
sel = c->tags;
|
||||
|
@ -2087,6 +2135,7 @@ powermgrsetmode(struct wl_listener *listener, void *data)
|
|||
wlr_output_commit_state(m->wlr_output, &state);
|
||||
|
||||
m->asleep = !event->mode;
|
||||
updatemons(NULL, NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -2103,7 +2152,6 @@ rendermon(struct wl_listener *listener, void *data)
|
|||
Monitor *m = wl_container_of(listener, m, frame);
|
||||
Client *c;
|
||||
struct wlr_output_state pending = {0};
|
||||
struct wlr_gamma_control_v1 *gamma_control;
|
||||
struct timespec now;
|
||||
|
||||
/* Render if no XDG clients have an outstanding resize and are visible on
|
||||
|
@ -2113,32 +2161,7 @@ rendermon(struct wl_listener *listener, void *data)
|
|||
goto skip;
|
||||
}
|
||||
|
||||
/*
|
||||
* HACK: The "correct" way to set the gamma is to commit it together with
|
||||
* the rest of the state in one go, but to do that we would need to rewrite
|
||||
* wlr_scene_output_commit() in order to add the gamma to the pending
|
||||
* state before committing, instead try to commit the gamma in one frame,
|
||||
* and commit the rest of the state in the next one (or in the same frame if
|
||||
* the gamma can not be committed).
|
||||
*/
|
||||
if (m->gamma_lut_changed) {
|
||||
gamma_control
|
||||
= wlr_gamma_control_manager_v1_get_control(gamma_control_mgr, m->wlr_output);
|
||||
m->gamma_lut_changed = 0;
|
||||
|
||||
if (!wlr_gamma_control_v1_apply(gamma_control, &pending))
|
||||
goto commit;
|
||||
|
||||
if (!wlr_output_test_state(m->wlr_output, &pending)) {
|
||||
wlr_gamma_control_v1_send_failed_and_destroy(gamma_control);
|
||||
goto commit;
|
||||
}
|
||||
wlr_output_commit_state(m->wlr_output, &pending);
|
||||
wlr_output_schedule_frame(m->wlr_output);
|
||||
} else {
|
||||
commit:
|
||||
wlr_scene_output_commit(m->scene_output, NULL);
|
||||
}
|
||||
wlr_scene_output_commit(m->scene_output, NULL);
|
||||
|
||||
skip:
|
||||
/* Let clients know a frame has been rendered */
|
||||
|
@ -2182,7 +2205,7 @@ resize(Client *c, struct wlr_box geo, int interact)
|
|||
struct wlr_box *bbox;
|
||||
struct wlr_box clip;
|
||||
|
||||
if (!c->mon || !c->scene)
|
||||
if (!c->mon || !client_surface(c)->mapped)
|
||||
return;
|
||||
|
||||
bbox = interact ? &sgeom : &c->mon->w;
|
||||
|
@ -2340,17 +2363,6 @@ setfullscreen(Client *c, int fullscreen)
|
|||
printstatus();
|
||||
}
|
||||
|
||||
void
|
||||
setgamma(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct wlr_gamma_control_manager_v1_set_gamma_event *event = data;
|
||||
Monitor *m = event->output->data;
|
||||
if (!m)
|
||||
return;
|
||||
m->gamma_lut_changed = 1;
|
||||
wlr_output_schedule_frame(m->wlr_output);
|
||||
}
|
||||
|
||||
void
|
||||
setlayout(const Arg *arg)
|
||||
{
|
||||
|
@ -2428,7 +2440,7 @@ setsel(struct wl_listener *listener, void *data)
|
|||
void
|
||||
setup(void)
|
||||
{
|
||||
int i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
|
||||
int drm_fd, i, sig[] = {SIGCHLD, SIGINT, SIGTERM, SIGPIPE};
|
||||
struct sigaction sa = {.sa_flags = SA_RESTART, .sa_handler = handlesig};
|
||||
sigemptyset(&sa.sa_mask);
|
||||
|
||||
|
@ -2463,7 +2475,7 @@ setup(void)
|
|||
* supports for shared memory, this configures that for clients. */
|
||||
if (!(drw = wlr_renderer_autocreate(backend)))
|
||||
die("couldn't create renderer");
|
||||
LISTEN_STATIC(&drw->events.lost, gpureset);
|
||||
wl_signal_add(&drw->events.lost, &gpu_reset);
|
||||
|
||||
/* Create shm, drm and linux_dmabuf interfaces by ourselves.
|
||||
* The simplest way is call:
|
||||
|
@ -2478,6 +2490,10 @@ setup(void)
|
|||
wlr_linux_dmabuf_v1_create_with_renderer(dpy, 5, drw));
|
||||
}
|
||||
|
||||
if ((drm_fd = wlr_renderer_get_drm_fd(drw)) >= 0 && drw->features.timeline
|
||||
&& backend->features.timeline)
|
||||
wlr_linux_drm_syncobj_manager_v1_create(dpy, 1, drm_fd);
|
||||
|
||||
/* Autocreates an allocator for us.
|
||||
* The allocator is the bridge between the renderer and the backend. It
|
||||
* handles the buffer creation, allowing wlroots to render onto the
|
||||
|
@ -2501,29 +2517,29 @@ setup(void)
|
|||
wlr_viewporter_create(dpy);
|
||||
wlr_single_pixel_buffer_manager_v1_create(dpy);
|
||||
wlr_fractional_scale_manager_v1_create(dpy, 1);
|
||||
wlr_presentation_create(dpy, backend);
|
||||
wlr_presentation_create(dpy, backend, 2);
|
||||
wlr_alpha_modifier_v1_create(dpy);
|
||||
|
||||
/* Initializes the interface used to implement urgency hints */
|
||||
activation = wlr_xdg_activation_v1_create(dpy);
|
||||
LISTEN_STATIC(&activation->events.request_activate, urgent);
|
||||
wl_signal_add(&activation->events.request_activate, &request_activate);
|
||||
|
||||
gamma_control_mgr = wlr_gamma_control_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&gamma_control_mgr->events.set_gamma, setgamma);
|
||||
wlr_scene_set_gamma_control_manager_v1(scene, wlr_gamma_control_manager_v1_create(dpy));
|
||||
|
||||
power_mgr = wlr_output_power_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&power_mgr->events.set_mode, powermgrsetmode);
|
||||
wl_signal_add(&power_mgr->events.set_mode, &output_power_mgr_set_mode);
|
||||
|
||||
/* Creates an output layout, which a wlroots utility for working with an
|
||||
* arrangement of screens in a physical layout. */
|
||||
output_layout = wlr_output_layout_create(dpy);
|
||||
LISTEN_STATIC(&output_layout->events.change, updatemons);
|
||||
wlr_xdg_output_manager_v1_create(dpy, output_layout);
|
||||
wl_signal_add(&output_layout->events.change, &layout_change);
|
||||
|
||||
wlr_xdg_output_manager_v1_create(dpy, output_layout);
|
||||
|
||||
/* Configure a listener to be notified when new outputs are available on the
|
||||
* backend. */
|
||||
wl_list_init(&mons);
|
||||
LISTEN_STATIC(&backend->events.new_output, createmon);
|
||||
wl_signal_add(&backend->events.new_output, &new_output);
|
||||
|
||||
/* Set up our client lists, the xdg-shell and the layer-shell. The xdg-shell is a
|
||||
* Wayland protocol which is used for application windows. For more
|
||||
|
@ -2535,20 +2551,19 @@ setup(void)
|
|||
wl_list_init(&fstack);
|
||||
|
||||
xdg_shell = wlr_xdg_shell_create(dpy, 6);
|
||||
LISTEN_STATIC(&xdg_shell->events.new_toplevel, createnotify);
|
||||
LISTEN_STATIC(&xdg_shell->events.new_popup, createpopup);
|
||||
wl_signal_add(&xdg_shell->events.new_toplevel, &new_xdg_toplevel);
|
||||
wl_signal_add(&xdg_shell->events.new_popup, &new_xdg_popup);
|
||||
|
||||
layer_shell = wlr_layer_shell_v1_create(dpy, 3);
|
||||
LISTEN_STATIC(&layer_shell->events.new_surface, createlayersurface);
|
||||
wl_signal_add(&layer_shell->events.new_surface, &new_layer_surface);
|
||||
|
||||
idle_notifier = wlr_idle_notifier_v1_create(dpy);
|
||||
|
||||
idle_inhibit_mgr = wlr_idle_inhibit_v1_create(dpy);
|
||||
LISTEN_STATIC(&idle_inhibit_mgr->events.new_inhibitor, createidleinhibitor);
|
||||
wl_signal_add(&idle_inhibit_mgr->events.new_inhibitor, &new_idle_inhibitor);
|
||||
|
||||
session_lock_mgr = wlr_session_lock_manager_v1_create(dpy);
|
||||
wl_signal_add(&session_lock_mgr->events.new_lock, &lock_listener);
|
||||
LISTEN_STATIC(&session_lock_mgr->events.destroy, destroysessionmgr);
|
||||
wl_signal_add(&session_lock_mgr->events.new_lock, &new_session_lock);
|
||||
locked_bg = wlr_scene_rect_create(layers[LyrBlock], sgeom.width, sgeom.height,
|
||||
(float [4]){0.1f, 0.1f, 0.1f, 1.0f});
|
||||
wlr_scene_node_set_enabled(&locked_bg->node, 0);
|
||||
|
@ -2558,10 +2573,10 @@ setup(void)
|
|||
wlr_server_decoration_manager_create(dpy),
|
||||
WLR_SERVER_DECORATION_MANAGER_MODE_SERVER);
|
||||
xdg_decoration_mgr = wlr_xdg_decoration_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&xdg_decoration_mgr->events.new_toplevel_decoration, createdecoration);
|
||||
wl_signal_add(&xdg_decoration_mgr->events.new_toplevel_decoration, &new_xdg_decoration);
|
||||
|
||||
pointer_constraints = wlr_pointer_constraints_v1_create(dpy);
|
||||
LISTEN_STATIC(&pointer_constraints->events.new_constraint, createpointerconstraint);
|
||||
wl_signal_add(&pointer_constraints->events.new_constraint, &new_pointer_constraint);
|
||||
|
||||
relative_pointer_mgr = wlr_relative_pointer_manager_v1_create(dpy);
|
||||
|
||||
|
@ -2589,14 +2604,14 @@ setup(void)
|
|||
*
|
||||
* And more comments are sprinkled throughout the notify functions above.
|
||||
*/
|
||||
LISTEN_STATIC(&cursor->events.motion, motionrelative);
|
||||
LISTEN_STATIC(&cursor->events.motion_absolute, motionabsolute);
|
||||
LISTEN_STATIC(&cursor->events.button, buttonpress);
|
||||
LISTEN_STATIC(&cursor->events.axis, axisnotify);
|
||||
LISTEN_STATIC(&cursor->events.frame, cursorframe);
|
||||
wl_signal_add(&cursor->events.motion, &cursor_motion);
|
||||
wl_signal_add(&cursor->events.motion_absolute, &cursor_motion_absolute);
|
||||
wl_signal_add(&cursor->events.button, &cursor_button);
|
||||
wl_signal_add(&cursor->events.axis, &cursor_axis);
|
||||
wl_signal_add(&cursor->events.frame, &cursor_frame);
|
||||
|
||||
cursor_shape_mgr = wlr_cursor_shape_manager_v1_create(dpy, 1);
|
||||
LISTEN_STATIC(&cursor_shape_mgr->events.request_set_shape, setcursorshape);
|
||||
wl_signal_add(&cursor_shape_mgr->events.request_set_shape, &request_set_cursor_shape);
|
||||
|
||||
/*
|
||||
* Configures a seat, which is a single "seat" at which a user sits and
|
||||
|
@ -2604,25 +2619,27 @@ setup(void)
|
|||
* pointer, touch, and drawing tablet device. We also rig up a listener to
|
||||
* let us know when new input devices are available on the backend.
|
||||
*/
|
||||
LISTEN_STATIC(&backend->events.new_input, inputdevice);
|
||||
wl_signal_add(&backend->events.new_input, &new_input_device);
|
||||
virtual_keyboard_mgr = wlr_virtual_keyboard_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&virtual_keyboard_mgr->events.new_virtual_keyboard, virtualkeyboard);
|
||||
wl_signal_add(&virtual_keyboard_mgr->events.new_virtual_keyboard,
|
||||
&new_virtual_keyboard);
|
||||
virtual_pointer_mgr = wlr_virtual_pointer_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&virtual_pointer_mgr->events.new_virtual_pointer, virtualpointer);
|
||||
wl_signal_add(&virtual_pointer_mgr->events.new_virtual_pointer,
|
||||
&new_virtual_pointer);
|
||||
|
||||
seat = wlr_seat_create(dpy, "seat0");
|
||||
LISTEN_STATIC(&seat->events.request_set_cursor, setcursor);
|
||||
LISTEN_STATIC(&seat->events.request_set_selection, setsel);
|
||||
LISTEN_STATIC(&seat->events.request_set_primary_selection, setpsel);
|
||||
LISTEN_STATIC(&seat->events.request_start_drag, requeststartdrag);
|
||||
LISTEN_STATIC(&seat->events.start_drag, startdrag);
|
||||
wl_signal_add(&seat->events.request_set_cursor, &request_cursor);
|
||||
wl_signal_add(&seat->events.request_set_selection, &request_set_sel);
|
||||
wl_signal_add(&seat->events.request_set_primary_selection, &request_set_psel);
|
||||
wl_signal_add(&seat->events.request_start_drag, &request_start_drag);
|
||||
wl_signal_add(&seat->events.start_drag, &start_drag);
|
||||
|
||||
kb_group = createkeyboardgroup();
|
||||
wl_list_init(&kb_group->destroy.link);
|
||||
|
||||
output_mgr = wlr_output_manager_v1_create(dpy);
|
||||
LISTEN_STATIC(&output_mgr->events.apply, outputmgrapply);
|
||||
LISTEN_STATIC(&output_mgr->events.test, outputmgrtest);
|
||||
wl_signal_add(&output_mgr->events.apply, &output_mgr_apply);
|
||||
wl_signal_add(&output_mgr->events.test, &output_mgr_test);
|
||||
|
||||
/* 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
|
||||
|
@ -2634,8 +2651,8 @@ setup(void)
|
|||
* It will be started when the first X client is started.
|
||||
*/
|
||||
if ((xwayland = wlr_xwayland_create(dpy, compositor, 1))) {
|
||||
LISTEN_STATIC(&xwayland->events.ready, xwaylandready);
|
||||
LISTEN_STATIC(&xwayland->events.new_surface, createnotifyx11);
|
||||
wl_signal_add(&xwayland->events.ready, &xwayland_ready);
|
||||
wl_signal_add(&xwayland->events.new_surface, &new_xwayland_surface);
|
||||
|
||||
setenv("DISPLAY", xwayland->display_name, 1);
|
||||
} else {
|
||||
|
@ -2975,11 +2992,11 @@ void
|
|||
virtualpointer(struct wl_listener *listener, void *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)
|
||||
wlr_cursor_map_input_to_output(cursor, &pointer.base, event->suggested_output);
|
||||
wlr_cursor_map_input_to_output(cursor, device, event->suggested_output);
|
||||
}
|
||||
|
||||
Monitor *
|
||||
|
@ -3078,17 +3095,24 @@ configurex11(struct wl_listener *listener, void *data)
|
|||
{
|
||||
Client *c = wl_container_of(listener, c, configure);
|
||||
struct wlr_xwayland_surface_configure_event *event = data;
|
||||
/* TODO: figure out if there is another way to do this */
|
||||
if (!c->mon) {
|
||||
if (!client_surface(c) || !client_surface(c)->mapped) {
|
||||
wlr_xwayland_surface_configure(c->surface.xwayland,
|
||||
event->x, event->y, event->width, event->height);
|
||||
return;
|
||||
}
|
||||
if (c->isfloating || client_is_unmanaged(c))
|
||||
resize(c, (struct wlr_box){.x = event->x, .y = event->y,
|
||||
.width = event->width + c->bw * 2, .height = event->height + c->bw * 2}, 0);
|
||||
else
|
||||
if (client_is_unmanaged(c)) {
|
||||
wlr_scene_node_set_position(&c->scene->node, event->x, event->y);
|
||||
wlr_xwayland_surface_configure(c->surface.xwayland,
|
||||
event->x, event->y, event->width, event->height);
|
||||
return;
|
||||
}
|
||||
if ((c->isfloating && c != grabc) || !c->mon->lt[c->mon->sellt]->arrange) {
|
||||
resize(c, (struct wlr_box){.x = event->x - c->bw,
|
||||
.y = event->y - c->bw, .width = event->width + c->bw * 2,
|
||||
.height = event->height + c->bw * 2}, 0);
|
||||
} else {
|
||||
arrange(c->mon);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -3122,25 +3146,12 @@ dissociatex11(struct wl_listener *listener, void *data)
|
|||
wl_list_remove(&c->unmap.link);
|
||||
}
|
||||
|
||||
xcb_atom_t
|
||||
getatom(xcb_connection_t *xc, const char *name)
|
||||
{
|
||||
xcb_atom_t atom = 0;
|
||||
xcb_intern_atom_reply_t *reply;
|
||||
xcb_intern_atom_cookie_t cookie = xcb_intern_atom(xc, 0, strlen(name), name);
|
||||
if ((reply = xcb_intern_atom_reply(xc, cookie, NULL)))
|
||||
atom = reply->atom;
|
||||
free(reply);
|
||||
|
||||
return atom;
|
||||
}
|
||||
|
||||
void
|
||||
sethints(struct wl_listener *listener, void *data)
|
||||
{
|
||||
Client *c = wl_container_of(listener, c, set_hints);
|
||||
struct wlr_surface *surface = client_surface(c);
|
||||
if (c == focustop(selmon))
|
||||
if (c == focustop(selmon) || !c->surface.xwayland->hints)
|
||||
return;
|
||||
|
||||
c->isurgent = xcb_icccm_wm_hints_get_urgency(c->surface.xwayland->hints);
|
||||
|
@ -3154,19 +3165,6 @@ void
|
|||
xwaylandready(struct wl_listener *listener, void *data)
|
||||
{
|
||||
struct wlr_xcursor *xcursor;
|
||||
xcb_connection_t *xc = xcb_connect(xwayland->display_name, NULL);
|
||||
int err = xcb_connection_has_error(xc);
|
||||
if (err) {
|
||||
fprintf(stderr, "xcb_connect to X server failed with code %d\n. Continuing with degraded functionality.\n", err);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Collect atoms we are interested in. If getatom returns 0, we will
|
||||
* not detect that window type. */
|
||||
netatom[NetWMWindowTypeDialog] = getatom(xc, "_NET_WM_WINDOW_TYPE_DIALOG");
|
||||
netatom[NetWMWindowTypeSplash] = getatom(xc, "_NET_WM_WINDOW_TYPE_SPLASH");
|
||||
netatom[NetWMWindowTypeToolbar] = getatom(xc, "_NET_WM_WINDOW_TYPE_TOOLBAR");
|
||||
netatom[NetWMWindowTypeUtility] = getatom(xc, "_NET_WM_WINDOW_TYPE_UTILITY");
|
||||
|
||||
/* assign the one and only seat */
|
||||
wlr_xwayland_set_seat(xwayland, seat);
|
||||
|
@ -3177,8 +3175,6 @@ xwaylandready(struct wl_listener *listener, void *data)
|
|||
xcursor->images[0]->buffer, xcursor->images[0]->width * 4,
|
||||
xcursor->images[0]->width, xcursor->images[0]->height,
|
||||
xcursor->images[0]->hotspot_x, xcursor->images[0]->hotspot_y);
|
||||
|
||||
xcb_disconnect(xc);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
10
util.c
10
util.c
|
@ -38,14 +38,14 @@ ecalloc(size_t nmemb, size_t size)
|
|||
int
|
||||
fd_set_nonblock(int fd) {
|
||||
int flags = fcntl(fd, F_GETFL);
|
||||
if (flags < 0) {
|
||||
if (flags < 0) {
|
||||
perror("fcntl(F_GETFL):");
|
||||
return -1;
|
||||
}
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (fcntl(fd, F_SETFL, flags | O_NONBLOCK) < 0) {
|
||||
perror("fcntl(F_SETFL):");
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue