aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build11
-rw-r--r--sway/input/cursor.c2
-rw-r--r--sway/ipc-server.c13
-rw-r--r--sway/tree/container.c13
4 files changed, 24 insertions, 15 deletions
diff --git a/meson.build b/meson.build
index 253a4e96..76eaff20 100644
--- a/meson.build
+++ b/meson.build
@@ -22,6 +22,10 @@ datadir = get_option('datadir')
sysconfdir = get_option('sysconfdir')
prefix = get_option('prefix')
+if is_freebsd
+ add_project_arguments('-D_C11_SOURCE', language: 'c')
+endif
+
swayidle_deps = []
jsonc = dependency('json-c', version: '>=0.13')
@@ -40,7 +44,7 @@ gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: false)
pixman = dependency('pixman-1')
libcap = dependency('libcap', required: false)
libinput = dependency('libinput', version: '>=1.6.0')
-libpam = cc.find_library('pam')
+libpam = cc.find_library('pam', required: false)
systemd = dependency('libsystemd', required: false)
elogind = dependency('libelogind', required: false)
math = cc.find_library('m')
@@ -133,10 +137,13 @@ subdir('swaymsg')
subdir('client')
subdir('swaybg')
subdir('swaybar')
-subdir('swaylock')
subdir('swayidle')
subdir('swaynag')
+if libpam.found()
+ subdir('swaylock')
+endif
+
config = configuration_data()
config.set('sysconfdir', join_paths(prefix, sysconfdir))
config.set('datadir', join_paths(prefix, datadir))
diff --git a/sway/input/cursor.c b/sway/input/cursor.c
index 5111e8e5..aa0e07f5 100644
--- a/sway/input/cursor.c
+++ b/sway/input/cursor.c
@@ -897,7 +897,7 @@ void dispatch_cursor_button(struct sway_cursor *cursor,
// Handle moving a tiling container
if (config->tiling_drag && mod_pressed && state == WLR_BUTTON_PRESSED &&
- !is_floating_or_child && !cont->is_fullscreen) {
+ !is_floating_or_child && cont && !cont->is_fullscreen) {
seat_pointer_notify_button(seat, time_msec, button, state);
seat_begin_move_tiling(seat, cont, button);
return;
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index 99959c97..2d915502 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -1,8 +1,5 @@
// See https://i3wm.org/docs/ipc.html for protocol information
-#ifndef __FreeBSD__
-// Any value will hide SOCK_CLOEXEC on FreeBSD (__BSD_VISIBLE=0)
-#define _XOPEN_SOURCE 700
-#endif
+#define _POSIX_C_SOURCE 200112L
#ifdef __linux__
#include <linux/input-event-codes.h>
#elif __FreeBSD__
@@ -89,10 +86,16 @@ static void handle_display_destroy(struct wl_listener *listener, void *data) {
}
void ipc_init(struct sway_server *server) {
- ipc_socket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
+ ipc_socket = socket(AF_UNIX, SOCK_STREAM, 0);
if (ipc_socket == -1) {
sway_abort("Unable to create IPC socket");
}
+ if (fcntl(ipc_socket, F_SETFD, FD_CLOEXEC) == -1) {
+ sway_abort("Unable to set CLOEXEC on IPC socket");
+ }
+ if (fcntl(ipc_socket, F_SETFL, O_NONBLOCK) == -1) {
+ sway_abort("Unable to set NONBLOCK on IPC socket");
+ }
ipc_sockaddr = ipc_user_sockaddr();
diff --git a/sway/tree/container.c b/sway/tree/container.c
index 53b127b7..baaa82fd 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -67,12 +67,10 @@ void container_destroy(struct sway_container *con) {
list_free(con->outputs);
if (con->view) {
- struct sway_view *view = con->view;
- view->container = NULL;
- free(view->title_format);
- view->title_format = NULL;
-
- if (view->destroying) {
+ if (con->view->container == con) {
+ con->view->container = NULL;
+ }
+ if (con->view->destroying) {
view_destroy(con->view);
}
}
@@ -985,7 +983,8 @@ void container_discover_outputs(struct sway_container *con) {
}
}
struct sway_output *new_output = container_get_effective_output(con);
- double old_scale = old_output ? old_output->wlr_output->scale : -1;
+ double old_scale = old_output && old_output->enabled ?
+ old_output->wlr_output->scale : -1;
double new_scale = new_output ? new_output->wlr_output->scale : -1;
if (old_scale != new_scale) {
container_update_title_textures(con);