aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt11
-rw-r--r--common/CMakeLists.txt7
-rw-r--r--common/ipc-client.c3
-rw-r--r--common/log.c1
-rw-r--r--common/stringop.c1
-rw-r--r--common/util.c1
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/assign.c1
-rw-r--r--sway/commands/bar.c1
-rw-r--r--sway/commands/bar/binding_mode_indicator.c1
-rw-r--r--sway/commands/bar/hidden_state.c2
-rw-r--r--sway/commands/bar/id.c1
-rw-r--r--sway/commands/bar/mode.c2
-rw-r--r--sway/commands/bar/output.c1
-rw-r--r--sway/commands/bar/pango_markup.c1
-rw-r--r--sway/commands/bar/position.c1
-rw-r--r--sway/commands/bar/separator_symbol.c1
-rw-r--r--sway/commands/bar/strip_workspace_numbers.c1
-rw-r--r--sway/commands/bar/tray_padding.c1
-rw-r--r--sway/commands/bar/workspace_buttons.c1
-rw-r--r--sway/commands/bar/wrap_scroll.c1
-rw-r--r--sway/commands/border.c1
-rw-r--r--sway/commands/debuglog.c1
-rw-r--r--sway/commands/exec_always.c1
-rw-r--r--sway/commands/floating.c1
-rw-r--r--sway/commands/floating_mod.c1
-rw-r--r--sway/commands/floating_scroll.c2
-rw-r--r--sway/commands/focus.c1
-rw-r--r--sway/commands/focus_follows_mouse.c1
-rw-r--r--sway/commands/font.c1
-rw-r--r--sway/commands/for_window.c1
-rw-r--r--sway/commands/force_focus_wrapping.c1
-rw-r--r--sway/commands/gaps.c1
-rw-r--r--sway/commands/hide_edge_borders.c1
-rw-r--r--sway/commands/input.c1
-rw-r--r--sway/commands/input/accel_profile.c1
-rw-r--r--sway/commands/input/click_method.c1
-rw-r--r--sway/commands/input/drag_lock.c1
-rw-r--r--sway/commands/input/dwt.c1
-rw-r--r--sway/commands/input/events.c1
-rw-r--r--sway/commands/input/left_handed.c1
-rw-r--r--sway/commands/input/middle_emulation.c1
-rw-r--r--sway/commands/input/natural_scroll.c1
-rw-r--r--sway/commands/input/scroll_method.c1
-rw-r--r--sway/commands/input/tap.c1
-rw-r--r--sway/commands/layout.c1
-rw-r--r--sway/commands/log_colors.c1
-rw-r--r--sway/commands/mode.c2
-rw-r--r--sway/commands/mouse_warping.c1
-rw-r--r--sway/commands/move.c1
-rw-r--r--sway/commands/new_float.c1
-rw-r--r--sway/commands/new_window.c1
-rw-r--r--sway/commands/orientation.c1
-rw-r--r--sway/commands/output.c2
-rw-r--r--sway/commands/resize.c1
-rw-r--r--sway/commands/scratchpad.c1
-rw-r--r--sway/commands/seamless_mouse.c1
-rw-r--r--sway/commands/set.c12
-rw-r--r--sway/commands/smart_gaps.c1
-rw-r--r--sway/commands/split.c1
-rw-r--r--sway/commands/workspace.c2
-rw-r--r--sway/commands/workspace_auto_back_and_forth.c1
-rw-r--r--sway/commands/workspace_layout.c1
-rw-r--r--sway/config.c14
-rw-r--r--sway/container.c2
-rw-r--r--sway/criteria.c1
-rw-r--r--sway/handlers.c2
-rw-r--r--sway/input.c1
-rw-r--r--sway/ipc-server.c7
-rw-r--r--sway/layout.c1
-rw-r--r--sway/main.c2
-rw-r--r--sway/security.c2
-rw-r--r--sway/workspace.c1
-rw-r--r--swaybar/bar.c2
-rw-r--r--swaybar/config.c2
-rw-r--r--swaybar/ipc.c2
-rw-r--r--swaybar/main.c1
-rw-r--r--swaybar/status_line.c1
-rw-r--r--swaygrab/json.c2
-rw-r--r--swaygrab/main.c2
-rw-r--r--swaylock/main.c9
-rw-r--r--swaymsg/main.c2
-rw-r--r--wayland/buffers.c1
-rw-r--r--wayland/registry.c1
84 files changed, 123 insertions, 33 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 685e8fc7..ec2c73a2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,9 +7,6 @@ set(CMAKE_C_STANDARD 99)
7set(CMAKE_C_EXTENSIONS OFF) 7set(CMAKE_C_EXTENSIONS OFF)
8set(CMAKE_POSITION_INDEPENDENT_CODE ON) 8set(CMAKE_POSITION_INDEPENDENT_CODE ON)
9set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) 9set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
10add_definitions(
11 -D_GNU_SOURCE
12 )
13set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") 10set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
14set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra") 11set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wextra")
15set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter") 12set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter")
@@ -70,14 +67,6 @@ find_package(PAM)
70 67
71find_package(LibInput REQUIRED) 68find_package(LibInput REQUIRED)
72 69
73find_package(Backtrace)
74if(Backtrace_FOUND)
75 include_directories("${Backtrace_INCLUDE_DIRS}")
76 add_definitions(-DSWAY_Backtrace_FOUND=1)
77 set(LINK_LIBRARIES, "${LINK_LIBRARIES} ${Backtrace_LIBRARIES}")
78 set(SWAY_Backtrace_HEADER "${Backtrace_HEADER}")
79endif()
80
81if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) 70if (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
82 find_package(EpollShim REQUIRED) 71 find_package(EpollShim REQUIRED)
83endif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD) 72endif (CMAKE_SYSTEM_NAME STREQUAL FreeBSD)
diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt
index 3d6e0fb9..11119eeb 100644
--- a/common/CMakeLists.txt
+++ b/common/CMakeLists.txt
@@ -13,10 +13,3 @@ add_library(sway-common STATIC
13 ) 13 )
14 14
15target_link_libraries(sway-common m) 15target_link_libraries(sway-common m)
16
17if(Backtrace_FOUND)
18 set_target_properties(sway-common
19 PROPERTIES
20 COMPILE_FLAGS "-include ${Backtrace_HEADER}"
21 )
22endif()
diff --git a/common/ipc-client.c b/common/ipc-client.c
index d011bd26..1ab6627b 100644
--- a/common/ipc-client.c
+++ b/common/ipc-client.c
@@ -1,5 +1,6 @@
1#include <stdint.h> 1#define _POSIX_C_SOURCE 2
2#include <stdio.h> 2#include <stdio.h>
3#include <stdint.h>
3#include <stdlib.h> 4#include <stdlib.h>
4#include <string.h> 5#include <string.h>
5#include <sys/socket.h> 6#include <sys/socket.h>
diff --git a/common/log.c b/common/log.c
index 825b176b..c3809c69 100644
--- a/common/log.c
+++ b/common/log.c
@@ -1,3 +1,4 @@
1#define _POSIX_C_SOURCE 1
1#include <errno.h> 2#include <errno.h>
2#include <libgen.h> 3#include <libgen.h>
3#include <signal.h> 4#include <signal.h>
diff --git a/common/stringop.c b/common/stringop.c
index 432bee7f..99e9636d 100644
--- a/common/stringop.c
+++ b/common/stringop.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <stdio.h> 3#include <stdio.h>
3#include <string.h> 4#include <string.h>
diff --git a/common/util.c b/common/util.c
index 73704afd..12ed0cdc 100644
--- a/common/util.c
+++ b/common/util.c
@@ -3,6 +3,7 @@
3#include <stdio.h> 3#include <stdio.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#include <string.h> 5#include <string.h>
6#include <strings.h>
6#include <wlc/wlc.h> 7#include <wlc/wlc.h>
7#include <xkbcommon/xkbcommon-names.h> 8#include <xkbcommon/xkbcommon-names.h>
8#include "log.h" 9#include "log.h"
diff --git a/sway/commands.c b/sway/commands.c
index 068e8866..dbb34705 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <xkbcommon/xkbcommon.h> 2#include <xkbcommon/xkbcommon.h>
2#include <xkbcommon/xkbcommon-names.h> 3#include <xkbcommon/xkbcommon-names.h>
3#include <wlc/wlc.h> 4#include <wlc/wlc.h>
diff --git a/sway/commands/assign.c b/sway/commands/assign.c
index 992b4692..ec262bb8 100644
--- a/sway/commands/assign.c
+++ b/sway/commands/assign.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdio.h> 2#include <stdio.h>
2#include <string.h> 3#include <string.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
diff --git a/sway/commands/bar.c b/sway/commands/bar.c
index e8d24084..04745a6e 100644
--- a/sway/commands/bar.c
+++ b/sway/commands/bar.c
@@ -1,5 +1,6 @@
1#include <stdio.h> 1#include <stdio.h>
2#include <string.h> 2#include <string.h>
3#include <strings.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/config.h" 5#include "sway/config.h"
5#include "log.h" 6#include "log.h"
diff --git a/sway/commands/bar/binding_mode_indicator.c b/sway/commands/bar/binding_mode_indicator.c
index 6f67e15d..64f5b84f 100644
--- a/sway/commands/bar/binding_mode_indicator.c
+++ b/sway/commands/bar/binding_mode_indicator.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/bar/hidden_state.c b/sway/commands/bar/hidden_state.c
index e52a123f..0b49aa6b 100644
--- a/sway/commands/bar/hidden_state.c
+++ b/sway/commands/bar/hidden_state.c
@@ -1,4 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
3#include <strings.h>
2#include "sway/commands.h" 4#include "sway/commands.h"
3#include "sway/config.h" 5#include "sway/config.h"
4#include "sway/ipc-server.h" 6#include "sway/ipc-server.h"
diff --git a/sway/commands/bar/id.c b/sway/commands/bar/id.c
index d62a0961..1221ebf6 100644
--- a/sway/commands/bar/id.c
+++ b/sway/commands/bar/id.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index 3fd6587f..36816b93 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -1,4 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
3#include <strings.h>
2#include "sway/commands.h" 4#include "sway/commands.h"
3#include "sway/config.h" 5#include "sway/config.h"
4#include "sway/ipc-server.h" 6#include "sway/ipc-server.h"
diff --git a/sway/commands/bar/output.c b/sway/commands/bar/output.c
index 01a23d9c..a5710bc0 100644
--- a/sway/commands/bar/output.c
+++ b/sway/commands/bar/output.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "list.h" 4#include "list.h"
diff --git a/sway/commands/bar/pango_markup.c b/sway/commands/bar/pango_markup.c
index 69213c7b..f69e882f 100644
--- a/sway/commands/bar/pango_markup.c
+++ b/sway/commands/bar/pango_markup.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/bar/position.c b/sway/commands/bar/position.c
index 4d0171ba..50de58e2 100644
--- a/sway/commands/bar/position.c
+++ b/sway/commands/bar/position.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/bar/separator_symbol.c b/sway/commands/bar/separator_symbol.c
index 2249da52..2766d8a2 100644
--- a/sway/commands/bar/separator_symbol.c
+++ b/sway/commands/bar/separator_symbol.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
diff --git a/sway/commands/bar/strip_workspace_numbers.c b/sway/commands/bar/strip_workspace_numbers.c
index 7cd19d60..9ac32482 100644
--- a/sway/commands/bar/strip_workspace_numbers.c
+++ b/sway/commands/bar/strip_workspace_numbers.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/bar/tray_padding.c b/sway/commands/bar/tray_padding.c
index 32f8eeba..8c559f65 100644
--- a/sway/commands/bar/tray_padding.c
+++ b/sway/commands/bar/tray_padding.c
@@ -1,5 +1,6 @@
1#include <stdlib.h> 1#include <stdlib.h>
2#include <string.h> 2#include <string.h>
3#include <strings.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "log.h" 5#include "log.h"
5 6
diff --git a/sway/commands/bar/workspace_buttons.c b/sway/commands/bar/workspace_buttons.c
index a0e0549d..67dd2d31 100644
--- a/sway/commands/bar/workspace_buttons.c
+++ b/sway/commands/bar/workspace_buttons.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/bar/wrap_scroll.c b/sway/commands/bar/wrap_scroll.c
index caa85660..4ed1f12a 100644
--- a/sway/commands/bar/wrap_scroll.c
+++ b/sway/commands/bar/wrap_scroll.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/border.c b/sway/commands/border.c
index 68ae58a6..0211e40c 100644
--- a/sway/commands/border.c
+++ b/sway/commands/border.c
@@ -1,6 +1,7 @@
1#include <errno.h> 1#include <errno.h>
2#include <stdlib.h> 2#include <stdlib.h>
3#include <string.h> 3#include <string.h>
4#include <strings.h>
4#include "sway/commands.h" 5#include "sway/commands.h"
5#include "sway/container.h" 6#include "sway/container.h"
6#include "sway/focus.h" 7#include "sway/focus.h"
diff --git a/sway/commands/debuglog.c b/sway/commands/debuglog.c
index 76192fb0..658d6165 100644
--- a/sway/commands/debuglog.c
+++ b/sway/commands/debuglog.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 1d7cd494..ab2d8622 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
2#include <sys/wait.h> 3#include <sys/wait.h>
3#include <unistd.h> 4#include <unistd.h>
diff --git a/sway/commands/floating.c b/sway/commands/floating.c
index 612b8641..113c8b71 100644
--- a/sway/commands/floating.c
+++ b/sway/commands/floating.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/container.h" 4#include "sway/container.h"
4#include "sway/ipc-server.h" 5#include "sway/ipc-server.h"
diff --git a/sway/commands/floating_mod.c b/sway/commands/floating_mod.c
index b6360d9a..b8e81ab9 100644
--- a/sway/commands/floating_mod.c
+++ b/sway/commands/floating_mod.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input_state.h" 4#include "sway/input_state.h"
4#include "list.h" 5#include "list.h"
diff --git a/sway/commands/floating_scroll.c b/sway/commands/floating_scroll.c
index 5705cfee..8c50c5bd 100644
--- a/sway/commands/floating_scroll.c
+++ b/sway/commands/floating_scroll.c
@@ -1,4 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
3#include <strings.h>
2#include "sway/commands.h" 4#include "sway/commands.h"
3#include "log.h" 5#include "log.h"
4#include "stringop.h" 6#include "stringop.h"
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index 0be442ca..12c5d02c 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include <wlc/wlc.h> 3#include <wlc/wlc.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/container.h" 5#include "sway/container.h"
diff --git a/sway/commands/focus_follows_mouse.c b/sway/commands/focus_follows_mouse.c
index 8ccefa59..7c9c2b13 100644
--- a/sway/commands/focus_follows_mouse.c
+++ b/sway/commands/focus_follows_mouse.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_focus_follows_mouse(int argc, char **argv) { 5struct cmd_results *cmd_focus_follows_mouse(int argc, char **argv) {
diff --git a/sway/commands/font.c b/sway/commands/font.c
index 1ee06396..32994f8a 100644
--- a/sway/commands/font.c
+++ b/sway/commands/font.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
2#include "sway/border.h" 3#include "sway/border.h"
3#include "sway/commands.h" 4#include "sway/commands.h"
diff --git a/sway/commands/for_window.c b/sway/commands/for_window.c
index 8c5722fd..d1fd1641 100644
--- a/sway/commands/for_window.c
+++ b/sway/commands/for_window.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/criteria.h" 4#include "sway/criteria.h"
diff --git a/sway/commands/force_focus_wrapping.c b/sway/commands/force_focus_wrapping.c
index 23019cd3..f19dd163 100644
--- a/sway/commands/force_focus_wrapping.c
+++ b/sway/commands/force_focus_wrapping.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) { 5struct cmd_results *cmd_force_focus_wrapping(int argc, char **argv) {
diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c
index fe06add4..0a48592d 100644
--- a/sway/commands/gaps.c
+++ b/sway/commands/gaps.c
@@ -2,6 +2,7 @@
2#include <errno.h> 2#include <errno.h>
3#include <stdlib.h> 3#include <stdlib.h>
4#include <string.h> 4#include <string.h>
5#include <strings.h>
5#include "sway/commands.h" 6#include "sway/commands.h"
6#include "sway/container.h" 7#include "sway/container.h"
7#include "sway/focus.h" 8#include "sway/focus.h"
diff --git a/sway/commands/hide_edge_borders.c b/sway/commands/hide_edge_borders.c
index cb4f052d..ee2a2644 100644
--- a/sway/commands/hide_edge_borders.c
+++ b/sway/commands/hide_edge_borders.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) { 5struct cmd_results *cmd_hide_edge_borders(int argc, char **argv) {
diff --git a/sway/commands/input.c b/sway/commands/input.c
index f584bb77..ad53d272 100644
--- a/sway/commands/input.c
+++ b/sway/commands/input.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4#include "log.h" 5#include "log.h"
diff --git a/sway/commands/input/accel_profile.c b/sway/commands/input/accel_profile.c
index 290129f5..8288c1ad 100644
--- a/sway/commands/input/accel_profile.c
+++ b/sway/commands/input/accel_profile.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/click_method.c b/sway/commands/input/click_method.c
index 0a7b7d23..5e9d3dcb 100644
--- a/sway/commands/input/click_method.c
+++ b/sway/commands/input/click_method.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4#include "log.h" 5#include "log.h"
diff --git a/sway/commands/input/drag_lock.c b/sway/commands/input/drag_lock.c
index 0d100dd0..f5a7beb4 100644
--- a/sway/commands/input/drag_lock.c
+++ b/sway/commands/input/drag_lock.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/dwt.c b/sway/commands/input/dwt.c
index 82013730..557b2207 100644
--- a/sway/commands/input/dwt.c
+++ b/sway/commands/input/dwt.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/events.c b/sway/commands/input/events.c
index 2f13e30a..9d54287a 100644
--- a/sway/commands/input/events.c
+++ b/sway/commands/input/events.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4#include "log.h" 5#include "log.h"
diff --git a/sway/commands/input/left_handed.c b/sway/commands/input/left_handed.c
index 3278bd33..6c913e70 100644
--- a/sway/commands/input/left_handed.c
+++ b/sway/commands/input/left_handed.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/middle_emulation.c b/sway/commands/input/middle_emulation.c
index b2e55468..33cdd7d6 100644
--- a/sway/commands/input/middle_emulation.c
+++ b/sway/commands/input/middle_emulation.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/natural_scroll.c b/sway/commands/input/natural_scroll.c
index ac8cec12..7bc8b8d0 100644
--- a/sway/commands/input/natural_scroll.c
+++ b/sway/commands/input/natural_scroll.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/scroll_method.c b/sway/commands/input/scroll_method.c
index de032b64..5c6c3d7a 100644
--- a/sway/commands/input/scroll_method.c
+++ b/sway/commands/input/scroll_method.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4 5
diff --git a/sway/commands/input/tap.c b/sway/commands/input/tap.c
index 9b559447..9e3ca2af 100644
--- a/sway/commands/input/tap.c
+++ b/sway/commands/input/tap.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/input.h" 4#include "sway/input.h"
4#include "log.h" 5#include "log.h"
diff --git a/sway/commands/layout.c b/sway/commands/layout.c
index d04bb4dc..570cd207 100644
--- a/sway/commands/layout.c
+++ b/sway/commands/layout.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "sway/container.h" 4#include "sway/container.h"
4#include "sway/layout.h" 5#include "sway/layout.h"
diff --git a/sway/commands/log_colors.c b/sway/commands/log_colors.c
index 6ef99da7..815d1942 100644
--- a/sway/commands/log_colors.c
+++ b/sway/commands/log_colors.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3#include "log.h" 4#include "log.h"
4 5
diff --git a/sway/commands/mode.c b/sway/commands/mode.c
index ed3f432f..d2985c54 100644
--- a/sway/commands/mode.c
+++ b/sway/commands/mode.c
@@ -1,5 +1,7 @@
1#define _XOPEN_SOURCE 500
1#include <stdbool.h> 2#include <stdbool.h>
2#include <string.h> 3#include <string.h>
4#include <strings.h>
3#include "sway/commands.h" 5#include "sway/commands.h"
4#include "sway/config.h" 6#include "sway/config.h"
5#include "sway/ipc-server.h" 7#include "sway/ipc-server.h"
diff --git a/sway/commands/mouse_warping.c b/sway/commands/mouse_warping.c
index ef71d595..5596d483 100644
--- a/sway/commands/mouse_warping.c
+++ b/sway/commands/mouse_warping.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_mouse_warping(int argc, char **argv) { 5struct cmd_results *cmd_mouse_warping(int argc, char **argv) {
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 1a8a321e..97e10f10 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include <wlc/wlc.h> 3#include <wlc/wlc.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/container.h" 5#include "sway/container.h"
diff --git a/sway/commands/new_float.c b/sway/commands/new_float.c
index 8e4e354f..432af436 100644
--- a/sway/commands/new_float.c
+++ b/sway/commands/new_float.c
@@ -1,5 +1,6 @@
1#include <errno.h> 1#include <errno.h>
2#include <string.h> 2#include <string.h>
3#include <strings.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/container.h" 5#include "sway/container.h"
5 6
diff --git a/sway/commands/new_window.c b/sway/commands/new_window.c
index 423b5af0..722d7d75 100644
--- a/sway/commands/new_window.c
+++ b/sway/commands/new_window.c
@@ -1,5 +1,6 @@
1#include <errno.h> 1#include <errno.h>
2#include <string.h> 2#include <string.h>
3#include <strings.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/container.h" 5#include "sway/container.h"
5 6
diff --git a/sway/commands/orientation.c b/sway/commands/orientation.c
index b6d7202e..e54b60ee 100644
--- a/sway/commands/orientation.c
+++ b/sway/commands/orientation.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_orientation(int argc, char **argv) { 5struct cmd_results *cmd_orientation(int argc, char **argv) {
diff --git a/sway/commands/output.c b/sway/commands/output.c
index 01ac9f4e..e5d4b317 100644
--- a/sway/commands/output.c
+++ b/sway/commands/output.c
@@ -1,7 +1,9 @@
1#define _XOPEN_SOURCE 500
1#include <ctype.h> 2#include <ctype.h>
2#include <libgen.h> 3#include <libgen.h>
3#include <stdlib.h> 4#include <stdlib.h>
4#include <string.h> 5#include <string.h>
6#include <strings.h>
5#include <unistd.h> 7#include <unistd.h>
6#include <wordexp.h> 8#include <wordexp.h>
7#include "sway/commands.h" 9#include "sway/commands.h"
diff --git a/sway/commands/resize.c b/sway/commands/resize.c
index 28b20dc4..61af080c 100644
--- a/sway/commands/resize.c
+++ b/sway/commands/resize.c
@@ -3,6 +3,7 @@
3#include <stdbool.h> 3#include <stdbool.h>
4#include <stdlib.h> 4#include <stdlib.h>
5#include <string.h> 5#include <string.h>
6#include <strings.h>
6#include <wlc/wlc.h> 7#include <wlc/wlc.h>
7#include "sway/commands.h" 8#include "sway/commands.h"
8#include "sway/layout.h" 9#include "sway/layout.h"
diff --git a/sway/commands/scratchpad.c b/sway/commands/scratchpad.c
index d43ef82d..d5e888b8 100644
--- a/sway/commands/scratchpad.c
+++ b/sway/commands/scratchpad.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include <wlc/wlc.h> 3#include <wlc/wlc.h>
3#include "sway/commands.h" 4#include "sway/commands.h"
4#include "sway/container.h" 5#include "sway/container.h"
diff --git a/sway/commands/seamless_mouse.c b/sway/commands/seamless_mouse.c
index 4d4bcc02..7760e88d 100644
--- a/sway/commands/seamless_mouse.c
+++ b/sway/commands/seamless_mouse.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_seamless_mouse(int argc, char **argv) { 5struct cmd_results *cmd_seamless_mouse(int argc, char **argv) {
diff --git a/sway/commands/set.c b/sway/commands/set.c
index 8b293825..1d6bce04 100644
--- a/sway/commands/set.c
+++ b/sway/commands/set.c
@@ -1,5 +1,7 @@
1#define _XOPEN_SOURCE 500
1#include <stdio.h> 2#include <stdio.h>
2#include <string.h> 3#include <string.h>
4#include <strings.h>
3#include "sway/commands.h" 5#include "sway/commands.h"
4#include "sway/config.h" 6#include "sway/config.h"
5#include "list.h" 7#include "list.h"
@@ -14,7 +16,6 @@ static int compare_set_qsort(const void *_l, const void *_r) {
14 16
15struct cmd_results *cmd_set(int argc, char **argv) { 17struct cmd_results *cmd_set(int argc, char **argv) {
16 char *tmp; 18 char *tmp;
17 int size;
18 struct cmd_results *error = NULL; 19 struct cmd_results *error = NULL;
19 if (!config->reading) return cmd_results_new(CMD_FAILURE, "set", "Can only be used in config file."); 20 if (!config->reading) return cmd_results_new(CMD_FAILURE, "set", "Can only be used in config file.");
20 if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) { 21 if ((error = checkarg(argc, "set", EXPECTED_AT_LEAST, 2))) {
@@ -24,13 +25,14 @@ struct cmd_results *cmd_set(int argc, char **argv) {
24 if (argv[0][0] != '$') { 25 if (argv[0][0] != '$') {
25 sway_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]); 26 sway_log(L_INFO, "Warning: variable '%s' doesn't start with $", argv[0]);
26 27
27 size = asprintf(&tmp, "%s%s", "$", argv[0]); 28 size_t size = snprintf(NULL, 0, "$%s", argv[0]);
28 if (size == -1) { 29 tmp = malloc(size + 1);
30 if (!tmp) {
29 return cmd_results_new(CMD_FAILURE, "set", "Not possible to create variable $'%s'", argv[0]); 31 return cmd_results_new(CMD_FAILURE, "set", "Not possible to create variable $'%s'", argv[0]);
30 } 32 }
33 snprintf(tmp, size, "$%s", argv[0]);
31 34
32 argv[0] = strdup(tmp); 35 argv[0] = tmp;
33 free(tmp);
34 } 36 }
35 37
36 struct sway_variable *var = NULL; 38 struct sway_variable *var = NULL;
diff --git a/sway/commands/smart_gaps.c b/sway/commands/smart_gaps.c
index bd50d6bc..815fc501 100644
--- a/sway/commands/smart_gaps.c
+++ b/sway/commands/smart_gaps.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_smart_gaps(int argc, char **argv) { 5struct cmd_results *cmd_smart_gaps(int argc, char **argv) {
diff --git a/sway/commands/split.c b/sway/commands/split.c
index f3e58fbf..e7da93d7 100644
--- a/sway/commands/split.c
+++ b/sway/commands/split.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include <wlc/wlc-render.h> 3#include <wlc/wlc-render.h>
3#include "sway/border.h" 4#include "sway/border.h"
4#include "sway/commands.h" 5#include "sway/commands.h"
diff --git a/sway/commands/workspace.c b/sway/commands/workspace.c
index b49a3a69..c831bdfd 100644
--- a/sway/commands/workspace.c
+++ b/sway/commands/workspace.c
@@ -1,4 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
3#include <strings.h>
2#include "sway/commands.h" 4#include "sway/commands.h"
3#include "sway/config.h" 5#include "sway/config.h"
4#include "sway/input_state.h" 6#include "sway/input_state.h"
diff --git a/sway/commands/workspace_auto_back_and_forth.c b/sway/commands/workspace_auto_back_and_forth.c
index 22a66678..d58ae5c8 100644
--- a/sway/commands/workspace_auto_back_and_forth.c
+++ b/sway/commands/workspace_auto_back_and_forth.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) { 5struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) {
diff --git a/sway/commands/workspace_layout.c b/sway/commands/workspace_layout.c
index c9305773..a2a1a5a2 100644
--- a/sway/commands/workspace_layout.c
+++ b/sway/commands/workspace_layout.c
@@ -1,4 +1,5 @@
1#include <string.h> 1#include <string.h>
2#include <strings.h>
2#include "sway/commands.h" 3#include "sway/commands.h"
3 4
4struct cmd_results *cmd_workspace_layout(int argc, char **argv) { 5struct cmd_results *cmd_workspace_layout(int argc, char **argv) {
diff --git a/sway/config.c b/sway/config.c
index 98351b1e..f46ce882 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -1,3 +1,5 @@
1#define _POSIX_C_SOURCE 200809L
2#define _XOPEN_SOURCE 500
1#include <stdio.h> 3#include <stdio.h>
2#include <stdbool.h> 4#include <stdbool.h>
3#include <stdlib.h> 5#include <stdlib.h>
@@ -12,6 +14,7 @@
12#include <limits.h> 14#include <limits.h>
13#include <float.h> 15#include <float.h>
14#include <dirent.h> 16#include <dirent.h>
17#include <strings.h>
15#include "wayland-desktop-shell-server-protocol.h" 18#include "wayland-desktop-shell-server-protocol.h"
16#include "sway/commands.h" 19#include "sway/commands.h"
17#include "sway/config.h" 20#include "sway/config.h"
@@ -528,11 +531,13 @@ bool load_main_config(const char *file, bool is_active) {
528 list_t *secconfigs = create_list(); 531 list_t *secconfigs = create_list();
529 char *base = SYSCONFDIR "/sway/security.d/"; 532 char *base = SYSCONFDIR "/sway/security.d/";
530 struct dirent *ent = readdir(dir); 533 struct dirent *ent = readdir(dir);
534 struct stat s;
531 while (ent != NULL) { 535 while (ent != NULL) {
532 if (ent->d_type == DT_REG) { 536 char *_path = malloc(strlen(ent->d_name) + strlen(base) + 1);
533 char *_path = malloc(strlen(ent->d_name) + strlen(base) + 1); 537 strcpy(_path, base);
534 strcpy(_path, base); 538 strcat(_path, ent->d_name);
535 strcat(_path, ent->d_name); 539 lstat(_path, &s);
540 if (S_ISREG(s.st_mode)) {
536 list_add(secconfigs, _path); 541 list_add(secconfigs, _path);
537 } 542 }
538 ent = readdir(dir); 543 ent = readdir(dir);
@@ -542,7 +547,6 @@ bool load_main_config(const char *file, bool is_active) {
542 list_qsort(secconfigs, qstrcmp); 547 list_qsort(secconfigs, qstrcmp);
543 for (int i = 0; i < secconfigs->length; ++i) { 548 for (int i = 0; i < secconfigs->length; ++i) {
544 char *_path = secconfigs->items[i]; 549 char *_path = secconfigs->items[i];
545 struct stat s;
546 if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || (s.st_mode & 0777) != 0644) { 550 if (stat(_path, &s) || s.st_uid != 0 || s.st_gid != 0 || (s.st_mode & 0777) != 0644) {
547 sway_log(L_ERROR, "Refusing to load %s - it must be owned by root and mode 644", _path); 551 sway_log(L_ERROR, "Refusing to load %s - it must be owned by root and mode 644", _path);
548 success = false; 552 success = false;
diff --git a/sway/container.c b/sway/container.c
index 9b1eac60..d43ee35e 100644
--- a/sway/container.c
+++ b/sway/container.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <ctype.h> 2#include <ctype.h>
2#include <stdlib.h> 3#include <stdlib.h>
3#include <stdbool.h> 4#include <stdbool.h>
@@ -18,7 +19,6 @@
18#define ASSERT_NONNULL(PTR) \ 19#define ASSERT_NONNULL(PTR) \
19 sway_assert (PTR, #PTR "must be non-null") 20 sway_assert (PTR, #PTR "must be non-null")
20 21
21
22static swayc_t *new_swayc(enum swayc_types type) { 22static swayc_t *new_swayc(enum swayc_types type) {
23 // next id starts at 1 because 0 is assigned to root_container in layout.c 23 // next id starts at 1 because 0 is assigned to root_container in layout.c
24 static size_t next_id = 1; 24 static size_t next_id = 1;
diff --git a/sway/criteria.c b/sway/criteria.c
index 5c305193..bc0523ce 100644
--- a/sway/criteria.c
+++ b/sway/criteria.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <stdio.h> 3#include <stdio.h>
3#include <stdbool.h> 4#include <stdbool.h>
diff --git a/sway/handlers.c b/sway/handlers.c
index d74d6252..5862c2b9 100644
--- a/sway/handlers.c
+++ b/sway/handlers.c
@@ -1,4 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <xkbcommon/xkbcommon.h> 2#include <xkbcommon/xkbcommon.h>
3#include <strings.h>
2#include <stdlib.h> 4#include <stdlib.h>
3#include <stdbool.h> 5#include <stdbool.h>
4#include <libinput.h> 6#include <libinput.h>
diff --git a/sway/input.c b/sway/input.c
index 249d95c6..4f1ef760 100644
--- a/sway/input.c
+++ b/sway/input.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <ctype.h> 2#include <ctype.h>
2#include <float.h> 3#include <float.h>
3#include <limits.h> 4#include <limits.h>
diff --git a/sway/ipc-server.c b/sway/ipc-server.c
index eddae461..0cacc515 100644
--- a/sway/ipc-server.c
+++ b/sway/ipc-server.c
@@ -13,6 +13,13 @@
13#include <json-c/json.h> 13#include <json-c/json.h>
14#include <list.h> 14#include <list.h>
15#include <libinput.h> 15#include <libinput.h>
16#ifdef __linux__
17struct ucred {
18 pid_t pid;
19 uid_t uid;
20 gid_t gid;
21};
22#endif
16#include "sway/ipc-json.h" 23#include "sway/ipc-json.h"
17#include "sway/ipc-server.h" 24#include "sway/ipc-server.h"
18#include "sway/security.h" 25#include "sway/security.h"
diff --git a/sway/layout.c b/sway/layout.c
index e196ebd3..473b74f7 100644
--- a/sway/layout.c
+++ b/sway/layout.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <stdbool.h> 3#include <stdbool.h>
3#include <math.h> 4#include <math.h>
diff --git a/sway/main.c b/sway/main.c
index 5e3b2415..55b71fa4 100644
--- a/sway/main.c
+++ b/sway/main.c
@@ -1,3 +1,5 @@
1#define _XOPEN_SOURCE 500
2#define _POSIX_C_SOURCE 200112L
1#include <stdio.h> 3#include <stdio.h>
2#include <stdlib.h> 4#include <stdlib.h>
3#include <stdbool.h> 5#include <stdbool.h>
diff --git a/sway/security.c b/sway/security.c
index 9dfc7d2d..f8a96ba7 100644
--- a/sway/security.c
+++ b/sway/security.c
@@ -1,3 +1,5 @@
1#define _XOPEN_SOURCE 500
2#include <string.h>
1#include <unistd.h> 3#include <unistd.h>
2#include <stdio.h> 4#include <stdio.h>
3#include "sway/config.h" 5#include "sway/config.h"
diff --git a/sway/workspace.c b/sway/workspace.c
index d804126b..29cacce9 100644
--- a/sway/workspace.c
+++ b/sway/workspace.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <stdbool.h> 3#include <stdbool.h>
3#include <limits.h> 4#include <limits.h>
diff --git a/swaybar/bar.c b/swaybar/bar.c
index 7ec3e0ea..abde1cc9 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -1,9 +1,11 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <unistd.h> 3#include <unistd.h>
3#include <string.h> 4#include <string.h>
4#include <fcntl.h> 5#include <fcntl.h>
5#include <errno.h> 6#include <errno.h>
6#include <sys/wait.h> 7#include <sys/wait.h>
8#include <signal.h>
7#include <poll.h> 9#include <poll.h>
8#include "swaybar/ipc.h" 10#include "swaybar/ipc.h"
9#include "swaybar/render.h" 11#include "swaybar/render.h"
diff --git a/swaybar/config.c b/swaybar/config.c
index 7959b1ca..1d802022 100644
--- a/swaybar/config.c
+++ b/swaybar/config.c
@@ -1,6 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <string.h> 3#include <string.h>
3
4#include "wayland-desktop-shell-client-protocol.h" 4#include "wayland-desktop-shell-client-protocol.h"
5#include "log.h" 5#include "log.h"
6#include "swaybar/config.h" 6#include "swaybar/config.h"
diff --git a/swaybar/ipc.c b/swaybar/ipc.c
index f2da7392..b08eeea8 100644
--- a/swaybar/ipc.c
+++ b/swaybar/ipc.c
@@ -1,4 +1,6 @@
1#define _XOPEN_SOURCE 500
1#include <string.h> 2#include <string.h>
3#include <strings.h>
2#include <json-c/json.h> 4#include <json-c/json.h>
3#include "swaybar/config.h" 5#include "swaybar/config.h"
4#include "swaybar/ipc.h" 6#include "swaybar/ipc.h"
diff --git a/swaybar/main.c b/swaybar/main.c
index c9a554a3..a2168743 100644
--- a/swaybar/main.c
+++ b/swaybar/main.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdio.h> 2#include <stdio.h>
2#include <stdlib.h> 3#include <stdlib.h>
3#include <string.h> 4#include <string.h>
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
index c7055d4c..83e8ce2c 100644
--- a/swaybar/status_line.c
+++ b/swaybar/status_line.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <stdlib.h> 2#include <stdlib.h>
2#include <string.h> 3#include <string.h>
3#include <unistd.h> 4#include <unistd.h>
diff --git a/swaygrab/json.c b/swaygrab/json.c
index 7cd73cbe..563b8ba3 100644
--- a/swaygrab/json.c
+++ b/swaygrab/json.c
@@ -1,3 +1,5 @@
1#define _XOPEN_SOURCE 500
2#include <string.h>
1#include <stdio.h> 3#include <stdio.h>
2#include <stdbool.h> 4#include <stdbool.h>
3#include <stdlib.h> 5#include <stdlib.h>
diff --git a/swaygrab/main.c b/swaygrab/main.c
index a88a6bcc..3b8c5651 100644
--- a/swaygrab/main.c
+++ b/swaygrab/main.c
@@ -1,3 +1,5 @@
1#define _XOPEN_SOURCE 500
2#define _POSIX_C_SOURCE 199309L
1#include <stdio.h> 3#include <stdio.h>
2#include <stdbool.h> 4#include <stdbool.h>
3#include <stdlib.h> 5#include <stdlib.h>
diff --git a/swaylock/main.c b/swaylock/main.c
index 49b24a3a..9b33aab9 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include "wayland-swaylock-client-protocol.h" 2#include "wayland-swaylock-client-protocol.h"
2#include <xkbcommon/xkbcommon.h> 3#include <xkbcommon/xkbcommon.h>
3#include <xkbcommon/xkbcommon-names.h> 4#include <xkbcommon/xkbcommon-names.h>
@@ -460,12 +461,16 @@ int main(int argc, char **argv) {
460 case 'u': 461 case 'u':
461 show_indicator = false; 462 show_indicator = false;
462 break; 463 break;
463 case 'f': 464 case 'f': {
464 if (daemon(0, 0) != 0) { 465 pid_t t = fork();
466 if (t == -1) {
465 sway_log(L_ERROR, "daemon call failed"); 467 sway_log(L_ERROR, "daemon call failed");
466 exit(EXIT_FAILURE); 468 exit(EXIT_FAILURE);
469 } else if (t > 0) {
470 exit(0);
467 } 471 }
468 break; 472 break;
473 }
469 case 'r': 474 case 'r':
470 if (line_source != LINE_SOURCE_DEFAULT) { 475 if (line_source != LINE_SOURCE_DEFAULT) {
471 sway_log(L_ERROR, "line source options conflict"); 476 sway_log(L_ERROR, "line source options conflict");
diff --git a/swaymsg/main.c b/swaymsg/main.c
index 29e80f02..2c418127 100644
--- a/swaymsg/main.c
+++ b/swaymsg/main.c
@@ -1,6 +1,8 @@
1#define _XOPEN_SOURCE 500
1#include <stdio.h> 2#include <stdio.h>
2#include <stdlib.h> 3#include <stdlib.h>
3#include <string.h> 4#include <string.h>
5#include <strings.h>
4#include <getopt.h> 6#include <getopt.h>
5#include <stdint.h> 7#include <stdint.h>
6#include <sys/un.h> 8#include <sys/un.h>
diff --git a/wayland/buffers.c b/wayland/buffers.c
index 23bed555..e9780997 100644
--- a/wayland/buffers.c
+++ b/wayland/buffers.c
@@ -1,3 +1,4 @@
1#define _XOPEN_SOURCE 500
1#include <wayland-client.h> 2#include <wayland-client.h>
2#include <cairo/cairo.h> 3#include <cairo/cairo.h>
3#include <pango/pangocairo.h> 4#include <pango/pangocairo.h>
diff --git a/wayland/registry.c b/wayland/registry.c
index 43e41f0c..1ebc46e7 100644
--- a/wayland/registry.c
+++ b/wayland/registry.c
@@ -4,6 +4,7 @@
4#include <string.h> 4#include <string.h>
5#include <unistd.h> 5#include <unistd.h>
6#include <sys/mman.h> 6#include <sys/mman.h>
7#include <sys/types.h>
7#include <sys/timerfd.h> 8#include <sys/timerfd.h>
8#include "wayland-desktop-shell-client-protocol.h" 9#include "wayland-desktop-shell-client-protocol.h"
9#include "wayland-swaylock-client-protocol.h" 10#include "wayland-swaylock-client-protocol.h"