From 417a10f4772cb768d3a12fdd7b903a8d8ad9bcf9 Mon Sep 17 00:00:00 2001
From: madblobfish <madblobfish@users.noreply.github.com>
Date: Sun, 4 Nov 2018 17:38:13 +0100
Subject: [PATCH 01/10] removed unneeded code fragment

---
 sway/input/seat.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/sway/input/seat.c b/sway/input/seat.c
index 64419afa..54fdf40b 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -55,9 +55,6 @@ void seat_destroy(struct sway_seat *seat) {
 	free(seat);
 }
 
-static struct sway_seat_node *seat_node_from_node(
-		struct sway_seat *seat, struct sway_node *node);
-
 static void seat_node_destroy(struct sway_seat_node *seat_node) {
 	wl_list_remove(&seat_node->destroy.link);
 	wl_list_remove(&seat_node->link);

From 7d8ed7a3a70d44c9ebe68d19a1be2d8fb8183b49 Mon Sep 17 00:00:00 2001
From: madblobfish <madblobfish@users.noreply.github.com>
Date: Sun, 4 Nov 2018 17:38:35 +0100
Subject: [PATCH 02/10] added space after table in sway.5 manpage

---
 sway/sway.5.scd | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index b3d696f2..f7ca00d6 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -364,6 +364,7 @@ The default colors are:
 :  #000000
 :  #0c0c0c
 
+
 *debuglog* on|off|toggle
 	Enables, disables or toggles debug logging. _toggle_ cannot be used in the
 	configuration file.

From 60df5cc9f80a64a594c81d6ec438e86f6e73cd0c Mon Sep 17 00:00:00 2001
From: mwenzkowski <29407878+mwenzkowski@users.noreply.github.com>
Date: Sun, 4 Nov 2018 18:12:14 +0100
Subject: [PATCH 03/10] Correct manpage regarding gaps command

The command 'gaps inner|outer all|current set|plus|minus <amount>'
is not valid in the configuration file, hence list it accordingly.
---
 sway/sway.5.scd | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sway/sway.5.scd b/sway/sway.5.scd
index b3d696f2..b83cf8ac 100644
--- a/sway/sway.5.scd
+++ b/sway/sway.5.scd
@@ -133,6 +133,10 @@ They are expected to be used with *bindsym* or at runtime through *swaymsg*(1).
 *fullscreen*
 	Toggles fullscreen for the focused view.
 
+*gaps* inner|outer all|current set|plus|minus <amount>
+	Changes the _inner_ or _outer_ gaps for either _all_ workspaces or the
+	_current_ workspace.
+
 *layout* default|splith|splitv|stacking|tabbed
 	Sets the layout mode of the focused container.
 
@@ -433,10 +437,6 @@ The default colors are:
 	This affects new workspaces only, and is used when the workspace doesn't
 	have its own gaps settings (see: workspace <ws> gaps inner|outer <amount>).
 
-*gaps* inner|outer all|current set|plus|minus <amount>
-	Changes the _inner_ or _outer_ gaps for either _all_ workspaces or the
-	_current_ workspace.
-
 *hide\_edge\_borders* none|vertical|horizontal|both|smart|smart\_no\_gaps
 	Hides window borders adjacent to the screen edges. Default is _none_.
 

From 67866dc3785453ad0ac97d14858c9176cbcca966 Mon Sep 17 00:00:00 2001
From: mwenzkowski <29407878+mwenzkowski@users.noreply.github.com>
Date: Sun, 4 Nov 2018 20:40:14 +0100
Subject: [PATCH 04/10] gaps: Improve error reporting

Always raise an error if the runtime only gaps command is found in the
config file.
---
 sway/commands/gaps.c | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/sway/commands/gaps.c b/sway/commands/gaps.c
index ca8cb27a..3f0ef155 100644
--- a/sway/commands/gaps.c
+++ b/sway/commands/gaps.c
@@ -149,16 +149,17 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
 		return error;
 	}
 
+	bool config_loading = !config->active || config->reloading;
+
 	if (argc == 2) {
 		return gaps_set_defaults(argc, argv);
 	}
-	if (argc == 4) {
-		if (config->active) {
-			return gaps_set_runtime(argc, argv);
-		} else {
-			return cmd_results_new(CMD_INVALID, "gaps",
-					"This syntax can only be used when sway is running");
-		}
+	if (argc == 4 && !config_loading) {
+		return gaps_set_runtime(argc, argv);
+	}
+	if (config_loading) {
+		return cmd_results_new(CMD_INVALID, "gaps",
+				"Expected 'gaps inner|outer <px>'");
 	}
 	return cmd_results_new(CMD_INVALID, "gaps",
 			"Expected 'gaps inner|outer <px>' or "

From e47b31c55680daf40208eed3586a3bfe83764130 Mon Sep 17 00:00:00 2001
From: madblobfish <madblobfish@users.noreply.github.com>
Date: Sun, 4 Nov 2018 22:49:44 +0100
Subject: [PATCH 05/10] document swaymessage type for get_seats

---
 completions/fish/swaymsg.fish | 1 +
 swaymsg/swaymsg.1.scd         | 4 ++++
 2 files changed, 5 insertions(+)

diff --git a/completions/fish/swaymsg.fish b/completions/fish/swaymsg.fish
index 1e5bf3da..fd577413 100644
--- a/completions/fish/swaymsg.fish
+++ b/completions/fish/swaymsg.fish
@@ -16,4 +16,5 @@ complete -c swaymsg -s t -l type -fra 'get_bar_config' --description "Get a JSON
 complete -c swaymsg -s t -l type -fra 'get_version' --description "Get JSON-encoded version information for the running instance of sway."
 complete -c swaymsg -s t -l type -fra 'get_binding_modes' --description "Gets a JSON-encoded list of currently configured binding modes."
 complete -c swaymsg -s t -l type -fra 'get_config' --description "Gets a JSON-encoded copy of the current configuration."
+complete -c swaymsg -s t -l type -fra 'get_seats' --description "Gets a JSON-encoded list of all seats, its properties and all assigned devices."
 complete -c swaymsg -s t -l type -fra 'send_tick' --description "Sends a tick event to all subscribed clients."
diff --git a/swaymsg/swaymsg.1.scd b/swaymsg/swaymsg.1.scd
index 8cf1b222..eaac8105 100644
--- a/swaymsg/swaymsg.1.scd
+++ b/swaymsg/swaymsg.1.scd
@@ -50,6 +50,10 @@ _swaymsg_ [options...] [message]
 	Gets a JSON-encoded layout tree of all open windows, containers, outputs,
 	workspaces, and so on.
 
+*get\_seats*
+	Gets a JSON-encoded list of all seats,
+	its properties and all assigned devices.
+
 *get\_marks*
 	Get a JSON-encoded list of marks.
 

From 4f21b6f670f0cd10430845d7d3ea19732b79bf08 Mon Sep 17 00:00:00 2001
From: Jarkko Oranen <oranenj@iki.fi>
Date: Mon, 5 Nov 2018 18:11:55 +0200
Subject: [PATCH 06/10] Work around swayidle never triggering on SIGUSR1

---
 swayidle/main.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/swayidle/main.c b/swayidle/main.c
index 7d0f23f4..c7a17826 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -347,7 +347,9 @@ void sway_terminate(int exit_code) {
 
 static void register_zero_idle_timeout(void *item) {
 	struct swayidle_timeout_cmd *cmd = item;
-	register_timeout(cmd, 0);
+	// A zero timeout never actually triggers. Adding a 50ms timeout is most
+	// likely not the correct fix either, but will work
+	register_timeout(cmd, 50);
 }
 
 static int handle_signal(int sig, void *data) {

From 9a3cd000a39d9fdb515ab1c5c58b280491609f91 Mon Sep 17 00:00:00 2001
From: Drew DeVault <sir@cmpwn.com>
Date: Mon, 5 Nov 2018 12:12:44 -0500
Subject: [PATCH 07/10] Revert "Work around swayidle never triggering on
 SIGUSR1"

---
 swayidle/main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/swayidle/main.c b/swayidle/main.c
index c7a17826..7d0f23f4 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -347,9 +347,7 @@ void sway_terminate(int exit_code) {
 
 static void register_zero_idle_timeout(void *item) {
 	struct swayidle_timeout_cmd *cmd = item;
-	// A zero timeout never actually triggers. Adding a 50ms timeout is most
-	// likely not the correct fix either, but will work
-	register_timeout(cmd, 50);
+	register_timeout(cmd, 0);
 }
 
 static int handle_signal(int sig, void *data) {

From c8c1ecaf258188266161832991fc52999eddbfc7 Mon Sep 17 00:00:00 2001
From: Brian Ashworth <bosrsf04@gmail.com>
Date: Mon, 5 Nov 2018 12:39:44 -0500
Subject: [PATCH 08/10] Fix focus_wrapping yes

It appears that the focus code that handles `focus_wrapping yes` was
removed during the conversion to type safety. This re-implements the
focus code for when `focus_wrapping` is set to `yes` (default). Neither
the `no` or `force` options appear to be effected and should be working.
---
 sway/commands/focus.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index cef92144..f6338c55 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -156,6 +156,14 @@ static struct sway_node *node_get_in_direction(struct sway_container *container,
 	if (new_output) {
 		return get_node_in_output_direction(new_output, dir);
 	}
+
+	// If there is a wrap candidate, return its focus inactive view
+	if (wrap_candidate) {
+		struct sway_container *wrap_inactive = seat_get_focus_inactive_view(
+				seat, &wrap_candidate->node);
+		return &wrap_inactive->node;
+	}
+
 	return NULL;
 }
 

From 5fdffea99ac5fcfd3618256a0291c9ff71cb1480 Mon Sep 17 00:00:00 2001
From: Rouven Czerwinski <rouven@czerwinskis.de>
Date: Mon, 5 Nov 2018 20:28:59 +0100
Subject: [PATCH 09/10] commands/exec_always: defer command on config
 validation

The exec_always command was executed twice, since it was not checking for the
config->validating variable.
Fix this by defering the command if the configuration is validating.

Fixes #3072
---
 sway/commands/exec_always.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 8bdeceeb..7a15709b 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -15,7 +15,7 @@
 
 struct cmd_results *cmd_exec_always(int argc, char **argv) {
 	struct cmd_results *error = NULL;
-	if (!config->active) return cmd_results_new(CMD_DEFER, NULL, NULL);
+	if (!config->active || config->validating) return cmd_results_new(CMD_DEFER, NULL, NULL);
 	if ((error = checkarg(argc, argv[-1], EXPECTED_AT_LEAST, 1))) {
 		return error;
 	}

From f54287eaf3f96e9574ebd4828788fd20be4b35dd Mon Sep 17 00:00:00 2001
From: Rouven Czerwinski <rouven@czerwinskis.de>
Date: Mon, 5 Nov 2018 20:32:05 +0100
Subject: [PATCH 10/10] config: mention that reload message is also printed on
 validation

---
 sway/config.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sway/config.c b/sway/config.c
index 9ec40367..7ef3ef38 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -389,7 +389,8 @@ bool load_main_config(const char *file, bool is_active, bool validating) {
 	config_defaults(config);
 	config->validating = validating;
 	if (is_active) {
-		wlr_log(WLR_DEBUG, "Performing configuration file reload");
+		wlr_log(WLR_DEBUG, "Performing configuration file %s",
+			validating ? "validation" : "reload");
 		config->reloading = true;
 		config->active = true;