aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.builds/alpine.yml38
-rw-r--r--.builds/archlinux.yml (renamed from .build.yml)18
-rw-r--r--.builds/freebsd.yml53
-rw-r--r--sway/commands/layout.c6
-rw-r--r--sway/config/output.c36
5 files changed, 129 insertions, 22 deletions
diff --git a/.builds/alpine.yml b/.builds/alpine.yml
new file mode 100644
index 00000000..328625a5
--- /dev/null
+++ b/.builds/alpine.yml
@@ -0,0 +1,38 @@
+image: alpine/edge
+packages:
+ - cairo-dev
+ - eudev-dev
+ - gdk-pixbuf-dev
+ - json-c-dev
+ - libevdev-dev
+ - libinput-dev
+ - libxcb-dev
+ - libxkbcommon-dev
+ - mesa-dev
+ - meson
+ - pango-dev
+ - pixman-dev
+ - scdoc
+ - wayland-dev
+ - wayland-protocols
+ - xcb-util-image-dev
+ - xorg-server-xwayland
+sources:
+ - https://github.com/swaywm/sway
+ - https://github.com/swaywm/wlroots
+tasks:
+ - wlroots: |
+ cd wlroots
+ meson --prefix=/usr build -Drootston=false -Dexamples=false
+ ninja -C build
+ sudo ninja -C build install
+ - setup: |
+ cd sway
+ meson build
+ - build: |
+ cd sway
+ ninja -C build
+ - build-no-xwayland: |
+ cd sway
+ meson configure build -Dxwayland=disabled
+ ninja -C build
diff --git a/.build.yml b/.builds/archlinux.yml
index 14433311..c8f116e0 100644
--- a/.build.yml
+++ b/.builds/archlinux.yml
@@ -1,25 +1,25 @@
-# vim: ft=yaml ts=2 sw=2 et :
image: archlinux
packages:
- - meson
- - xorg-server-xwayland
- - xcb-util-image
- - json-c
- - pango
- cairo
- - wayland
- - wayland-protocols
- gdk-pixbuf2
+ - json-c
- libinput
+ - libxcb
- libxkbcommon
+ - meson
+ - pango
- scdoc
+ - wayland
+ - wayland-protocols
+ - xcb-util-image
+ - xorg-server-xwayland
sources:
- https://github.com/swaywm/sway
- https://github.com/swaywm/wlroots
tasks:
- wlroots: |
cd wlroots
- meson --prefix=/usr build
+ meson --prefix=/usr build -Drootston=false -Dexamples=false
ninja -C build
sudo ninja -C build install
- setup: |
diff --git a/.builds/freebsd.yml b/.builds/freebsd.yml
new file mode 100644
index 00000000..8fa76025
--- /dev/null
+++ b/.builds/freebsd.yml
@@ -0,0 +1,53 @@
+image: freebsd/latest
+packages:
+- devel/json-c
+- devel/libevdev
+- devel/meson
+- devel/pkgconf
+- graphics/cairo
+- graphics/gdk-pixbuf2
+- graphics/wayland
+- graphics/wayland-protocols
+- textproc/scdoc
+- x11-toolkits/pango
+- x11/libxcb
+- x11/libxkbcommon
+# wlroots dependencies
+- devel/evdev-proto
+- devel/libepoll-shim
+- devel/libudev-devd
+- graphics/libdrm
+- graphics/mesa-libs
+- x11/libinput
+- x11/libX11
+- x11/pixman
+- x11/xcb-util-wm
+sources:
+- https://github.com/swaywm/sway
+- https://github.com/swaywm/wlroots
+tasks:
+- fixup_epoll: |
+ cat << 'EOF' | sudo tee /usr/local/libdata/pkgconfig/epoll-shim.pc
+ prefix=/usr/local
+ exec_prefix=\$\{\$prefix\}
+ libdir=${prefix}/lib
+ sharedlibdir=${prefix}/lib
+ includedir=${prefix}/include/libepoll-shim
+ Name: epoll-shim
+ Description: epoll shim implemented using kevent
+ Version: 0
+ Requires:
+ Libs: -L${libdir} -L${sharedlibdir} -lepoll-shim
+ Libs.private: -pthread -lrt
+ Cflags: -I${includedir}
+ EOF
+- setup: |
+ cd sway
+ mkdir subprojects
+ cd subprojects
+ ln -s ../../wlroots wlroots
+ cd ..
+ meson build
+- build: |
+ cd sway
+ ninja -C build
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index 2aca31dc..7d61c3be 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -111,10 +111,8 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
"Unable to change layout of floating windows");
}
- // Typically we change the layout of the current container, but if the
- // current container is a view (it usually is) then we'll change the layout
- // of the parent instead, as it doesn't make sense for views to have layout.
- if (container && container->view) {
+ // Operate on parent container, like i3.
+ if (container) {
container = container->parent;
}
diff --git a/sway/config/output.c b/sway/config/output.c
index 513d03e0..e7fbad83 100644
--- a/sway/config/output.c
+++ b/sway/config/output.c
@@ -175,12 +175,33 @@ static void handle_swaybg_client_destroy(struct wl_listener *listener,
output->swaybg_client = NULL;
}
+static bool set_cloexec(int fd, bool cloexec) {
+ int flags = fcntl(fd, F_GETFD);
+ if (flags == -1) {
+ sway_log_errno(SWAY_ERROR, "fcntl failed");
+ return false;
+ }
+ if (cloexec) {
+ flags = flags | FD_CLOEXEC;
+ } else {
+ flags = flags & ~FD_CLOEXEC;
+ }
+ if (fcntl(fd, F_SETFD, flags) == -1) {
+ sway_log_errno(SWAY_ERROR, "fcntl failed");
+ return false;
+ }
+ return true;
+}
+
static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) {
int sockets[2];
- if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sockets) != 0) {
+ if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) != 0) {
sway_log_errno(SWAY_ERROR, "socketpair failed");
return false;
}
+ if (!set_cloexec(sockets[0], true) || !set_cloexec(sockets[1], true)) {
+ return false;
+ }
output->swaybg_client = wl_client_create(server.wl_display, sockets[0]);
if (output->swaybg_client == NULL) {
@@ -202,14 +223,7 @@ static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) {
sway_log_errno(SWAY_ERROR, "fork failed");
exit(EXIT_FAILURE);
} else if (pid == 0) {
- // Remove the CLOEXEC flag
- int flags = fcntl(sockets[1], F_GETFD);
- if (flags == -1) {
- sway_log_errno(SWAY_ERROR, "fcntl() failed");
- exit(EXIT_FAILURE);
- }
- if (fcntl(sockets[1], F_SETFD, flags & ~FD_CLOEXEC) == -1) {
- sway_log_errno(SWAY_ERROR, "fcntl() failed");
+ if (!set_cloexec(sockets[1], false)) {
exit(EXIT_FAILURE);
}
@@ -225,6 +239,10 @@ static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) {
exit(EXIT_SUCCESS);
}
+ if (close(sockets[1]) != 0) {
+ sway_log_errno(SWAY_ERROR, "close failed");
+ return false;
+ }
if (waitpid(pid, NULL, 0) < 0) {
sway_log_errno(SWAY_ERROR, "waitpid failed");
return false;