diff options
-rw-r--r-- | .builds/alpine.yml | 38 | ||||
-rw-r--r-- | .builds/archlinux.yml (renamed from .build.yml) | 18 | ||||
-rw-r--r-- | .builds/freebsd.yml | 53 | ||||
-rw-r--r-- | sway/commands/layout.c | 6 | ||||
-rw-r--r-- | sway/config/output.c | 36 |
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 @@ | |||
1 | image: alpine/edge | ||
2 | packages: | ||
3 | - cairo-dev | ||
4 | - eudev-dev | ||
5 | - gdk-pixbuf-dev | ||
6 | - json-c-dev | ||
7 | - libevdev-dev | ||
8 | - libinput-dev | ||
9 | - libxcb-dev | ||
10 | - libxkbcommon-dev | ||
11 | - mesa-dev | ||
12 | - meson | ||
13 | - pango-dev | ||
14 | - pixman-dev | ||
15 | - scdoc | ||
16 | - wayland-dev | ||
17 | - wayland-protocols | ||
18 | - xcb-util-image-dev | ||
19 | - xorg-server-xwayland | ||
20 | sources: | ||
21 | - https://github.com/swaywm/sway | ||
22 | - https://github.com/swaywm/wlroots | ||
23 | tasks: | ||
24 | - wlroots: | | ||
25 | cd wlroots | ||
26 | meson --prefix=/usr build -Drootston=false -Dexamples=false | ||
27 | ninja -C build | ||
28 | sudo ninja -C build install | ||
29 | - setup: | | ||
30 | cd sway | ||
31 | meson build | ||
32 | - build: | | ||
33 | cd sway | ||
34 | ninja -C build | ||
35 | - build-no-xwayland: | | ||
36 | cd sway | ||
37 | meson configure build -Dxwayland=disabled | ||
38 | 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 @@ | |||
1 | # vim: ft=yaml ts=2 sw=2 et : | ||
2 | image: archlinux | 1 | image: archlinux |
3 | packages: | 2 | packages: |
4 | - meson | ||
5 | - xorg-server-xwayland | ||
6 | - xcb-util-image | ||
7 | - json-c | ||
8 | - pango | ||
9 | - cairo | 3 | - cairo |
10 | - wayland | ||
11 | - wayland-protocols | ||
12 | - gdk-pixbuf2 | 4 | - gdk-pixbuf2 |
5 | - json-c | ||
13 | - libinput | 6 | - libinput |
7 | - libxcb | ||
14 | - libxkbcommon | 8 | - libxkbcommon |
9 | - meson | ||
10 | - pango | ||
15 | - scdoc | 11 | - scdoc |
12 | - wayland | ||
13 | - wayland-protocols | ||
14 | - xcb-util-image | ||
15 | - xorg-server-xwayland | ||
16 | sources: | 16 | sources: |
17 | - https://github.com/swaywm/sway | 17 | - https://github.com/swaywm/sway |
18 | - https://github.com/swaywm/wlroots | 18 | - https://github.com/swaywm/wlroots |
19 | tasks: | 19 | tasks: |
20 | - wlroots: | | 20 | - wlroots: | |
21 | cd wlroots | 21 | cd wlroots |
22 | meson --prefix=/usr build | 22 | meson --prefix=/usr build -Drootston=false -Dexamples=false |
23 | ninja -C build | 23 | ninja -C build |
24 | sudo ninja -C build install | 24 | sudo ninja -C build install |
25 | - setup: | | 25 | - 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 @@ | |||
1 | image: freebsd/latest | ||
2 | packages: | ||
3 | - devel/json-c | ||
4 | - devel/libevdev | ||
5 | - devel/meson | ||
6 | - devel/pkgconf | ||
7 | - graphics/cairo | ||
8 | - graphics/gdk-pixbuf2 | ||
9 | - graphics/wayland | ||
10 | - graphics/wayland-protocols | ||
11 | - textproc/scdoc | ||
12 | - x11-toolkits/pango | ||
13 | - x11/libxcb | ||
14 | - x11/libxkbcommon | ||
15 | # wlroots dependencies | ||
16 | - devel/evdev-proto | ||
17 | - devel/libepoll-shim | ||
18 | - devel/libudev-devd | ||
19 | - graphics/libdrm | ||
20 | - graphics/mesa-libs | ||
21 | - x11/libinput | ||
22 | - x11/libX11 | ||
23 | - x11/pixman | ||
24 | - x11/xcb-util-wm | ||
25 | sources: | ||
26 | - https://github.com/swaywm/sway | ||
27 | - https://github.com/swaywm/wlroots | ||
28 | tasks: | ||
29 | - fixup_epoll: | | ||
30 | cat << 'EOF' | sudo tee /usr/local/libdata/pkgconfig/epoll-shim.pc | ||
31 | prefix=/usr/local | ||
32 | exec_prefix=\$\{\$prefix\} | ||
33 | libdir=${prefix}/lib | ||
34 | sharedlibdir=${prefix}/lib | ||
35 | includedir=${prefix}/include/libepoll-shim | ||
36 | Name: epoll-shim | ||
37 | Description: epoll shim implemented using kevent | ||
38 | Version: 0 | ||
39 | Requires: | ||
40 | Libs: -L${libdir} -L${sharedlibdir} -lepoll-shim | ||
41 | Libs.private: -pthread -lrt | ||
42 | Cflags: -I${includedir} | ||
43 | EOF | ||
44 | - setup: | | ||
45 | cd sway | ||
46 | mkdir subprojects | ||
47 | cd subprojects | ||
48 | ln -s ../../wlroots wlroots | ||
49 | cd .. | ||
50 | meson build | ||
51 | - build: | | ||
52 | cd sway | ||
53 | 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) { | |||
111 | "Unable to change layout of floating windows"); | 111 | "Unable to change layout of floating windows"); |
112 | } | 112 | } |
113 | 113 | ||
114 | // Typically we change the layout of the current container, but if the | 114 | // Operate on parent container, like i3. |
115 | // current container is a view (it usually is) then we'll change the layout | 115 | if (container) { |
116 | // of the parent instead, as it doesn't make sense for views to have layout. | ||
117 | if (container && container->view) { | ||
118 | container = container->parent; | 116 | container = container->parent; |
119 | } | 117 | } |
120 | 118 | ||
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, | |||
175 | output->swaybg_client = NULL; | 175 | output->swaybg_client = NULL; |
176 | } | 176 | } |
177 | 177 | ||
178 | static bool set_cloexec(int fd, bool cloexec) { | ||
179 | int flags = fcntl(fd, F_GETFD); | ||
180 | if (flags == -1) { | ||
181 | sway_log_errno(SWAY_ERROR, "fcntl failed"); | ||
182 | return false; | ||
183 | } | ||
184 | if (cloexec) { | ||
185 | flags = flags | FD_CLOEXEC; | ||
186 | } else { | ||
187 | flags = flags & ~FD_CLOEXEC; | ||
188 | } | ||
189 | if (fcntl(fd, F_SETFD, flags) == -1) { | ||
190 | sway_log_errno(SWAY_ERROR, "fcntl failed"); | ||
191 | return false; | ||
192 | } | ||
193 | return true; | ||
194 | } | ||
195 | |||
178 | static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) { | 196 | static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) { |
179 | int sockets[2]; | 197 | int sockets[2]; |
180 | if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sockets) != 0) { | 198 | if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockets) != 0) { |
181 | sway_log_errno(SWAY_ERROR, "socketpair failed"); | 199 | sway_log_errno(SWAY_ERROR, "socketpair failed"); |
182 | return false; | 200 | return false; |
183 | } | 201 | } |
202 | if (!set_cloexec(sockets[0], true) || !set_cloexec(sockets[1], true)) { | ||
203 | return false; | ||
204 | } | ||
184 | 205 | ||
185 | output->swaybg_client = wl_client_create(server.wl_display, sockets[0]); | 206 | output->swaybg_client = wl_client_create(server.wl_display, sockets[0]); |
186 | if (output->swaybg_client == NULL) { | 207 | if (output->swaybg_client == NULL) { |
@@ -202,14 +223,7 @@ static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) { | |||
202 | sway_log_errno(SWAY_ERROR, "fork failed"); | 223 | sway_log_errno(SWAY_ERROR, "fork failed"); |
203 | exit(EXIT_FAILURE); | 224 | exit(EXIT_FAILURE); |
204 | } else if (pid == 0) { | 225 | } else if (pid == 0) { |
205 | // Remove the CLOEXEC flag | 226 | if (!set_cloexec(sockets[1], false)) { |
206 | int flags = fcntl(sockets[1], F_GETFD); | ||
207 | if (flags == -1) { | ||
208 | sway_log_errno(SWAY_ERROR, "fcntl() failed"); | ||
209 | exit(EXIT_FAILURE); | ||
210 | } | ||
211 | if (fcntl(sockets[1], F_SETFD, flags & ~FD_CLOEXEC) == -1) { | ||
212 | sway_log_errno(SWAY_ERROR, "fcntl() failed"); | ||
213 | exit(EXIT_FAILURE); | 227 | exit(EXIT_FAILURE); |
214 | } | 228 | } |
215 | 229 | ||
@@ -225,6 +239,10 @@ static bool spawn_swaybg(struct sway_output *output, char *const cmd[]) { | |||
225 | exit(EXIT_SUCCESS); | 239 | exit(EXIT_SUCCESS); |
226 | } | 240 | } |
227 | 241 | ||
242 | if (close(sockets[1]) != 0) { | ||
243 | sway_log_errno(SWAY_ERROR, "close failed"); | ||
244 | return false; | ||
245 | } | ||
228 | if (waitpid(pid, NULL, 0) < 0) { | 246 | if (waitpid(pid, NULL, 0) < 0) { |
229 | sway_log_errno(SWAY_ERROR, "waitpid failed"); | 247 | sway_log_errno(SWAY_ERROR, "waitpid failed"); |
230 | return false; | 248 | return false; |