aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sway/commands/exec_always.c4
-rw-r--r--sway/config/bar.c4
-rw-r--r--sway/desktop/transaction.c23
-rw-r--r--sway/input/seat.c8
-rw-r--r--sway/tree/view.c5
5 files changed, 32 insertions, 12 deletions
diff --git a/sway/commands/exec_always.c b/sway/commands/exec_always.c
index 9bf2b320..c730cb8b 100644
--- a/sway/commands/exec_always.c
+++ b/sway/commands/exec_always.c
@@ -4,6 +4,7 @@
4#include <string.h> 4#include <string.h>
5#include <sys/wait.h> 5#include <sys/wait.h>
6#include <unistd.h> 6#include <unistd.h>
7#include <signal.h>
7#include "sway/commands.h" 8#include "sway/commands.h"
8#include "sway/config.h" 9#include "sway/config.h"
9#include "sway/tree/container.h" 10#include "sway/tree/container.h"
@@ -47,6 +48,9 @@ struct cmd_results *cmd_exec_always(int argc, char **argv) {
47 if ((pid = fork()) == 0) { 48 if ((pid = fork()) == 0) {
48 // Fork child process again 49 // Fork child process again
49 setsid(); 50 setsid();
51 sigset_t set;
52 sigemptyset(&set);
53 sigprocmask(SIG_SETMASK, &set, NULL);
50 close(fd[0]); 54 close(fd[0]);
51 if ((child = fork()) == 0) { 55 if ((child = fork()) == 0) {
52 close(fd[1]); 56 close(fd[1]);
diff --git a/sway/config/bar.c b/sway/config/bar.c
index 3a74331e..ae9383d6 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -10,6 +10,7 @@
10#include <sys/stat.h> 10#include <sys/stat.h>
11#include <signal.h> 11#include <signal.h>
12#include <strings.h> 12#include <strings.h>
13#include <signal.h>
13#include "sway/config.h" 14#include "sway/config.h"
14#include "stringop.h" 15#include "stringop.h"
15#include "list.h" 16#include "list.h"
@@ -175,6 +176,9 @@ void invoke_swaybar(struct bar_config *bar) {
175 if (bar->pid == 0) { 176 if (bar->pid == 0) {
176 setpgid(0, 0); 177 setpgid(0, 0);
177 close(filedes[0]); 178 close(filedes[0]);
179 sigset_t set;
180 sigemptyset(&set);
181 sigprocmask(SIG_SETMASK, &set, NULL);
178 182
179 // run custom swaybar 183 // run custom swaybar
180 size_t len = snprintf(NULL, 0, "%s -b %s", 184 size_t len = snprintf(NULL, 0, "%s -b %s",
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 94070363..4e6af86a 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -195,11 +195,18 @@ static void transaction_apply(struct sway_transaction *transaction) {
195 sizeof(struct sway_container_state)); 195 sizeof(struct sway_container_state));
196 196
197 if (container->type == C_VIEW) { 197 if (container->type == C_VIEW) {
198 if (container->sway_view->saved_buffer) { 198 if (container->destroying) {
199 view_remove_saved_buffer(container->sway_view); 199 if (container->instructions->length == 1 &&
200 } 200 container->sway_view->saved_buffer) {
201 if (container->instructions->length > 1) { 201 view_remove_saved_buffer(container->sway_view);
202 view_save_buffer(container->sway_view); 202 }
203 } else {
204 if (container->sway_view->saved_buffer) {
205 view_remove_saved_buffer(container->sway_view);
206 }
207 if (container->instructions->length > 1) {
208 view_save_buffer(container->sway_view);
209 }
203 } 210 }
204 } 211 }
205 } 212 }
@@ -276,9 +283,9 @@ static void transaction_commit(struct sway_transaction *transaction) {
276 // mapping and its default geometry doesn't intersect an output. 283 // mapping and its default geometry doesn't intersect an output.
277 struct timespec when; 284 struct timespec when;
278 wlr_surface_send_frame_done(con->sway_view->surface, &when); 285 wlr_surface_send_frame_done(con->sway_view->surface, &when);
279 if (!con->sway_view->saved_buffer) { 286 }
280 view_save_buffer(con->sway_view); 287 if (con->type == C_VIEW && !con->sway_view->saved_buffer) {
281 } 288 view_save_buffer(con->sway_view);
282 } 289 }
283 list_add(con->instructions, instruction); 290 list_add(con->instructions, instruction);
284 } 291 }
diff --git a/sway/input/seat.c b/sway/input/seat.c
index 869560af..dd4d5c3b 100644
--- a/sway/input/seat.c
+++ b/sway/input/seat.c
@@ -775,8 +775,12 @@ void seat_set_focus_warp(struct sway_seat *seat,
775 } 775 }
776 } 776 }
777 777
778 if (container->type == C_VIEW) { 778 if (container) {
779 ipc_event_window(container, "focus"); 779 if (container->type == C_VIEW) {
780 ipc_event_window(container, "focus");
781 } else if (container->type == C_WORKSPACE) {
782 ipc_event_workspace(NULL, container, "focus");
783 }
780 } 784 }
781 785
782 seat->has_focus = (container != NULL); 786 seat->has_focus = (container != NULL);
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 051b93ce..97318daa 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -496,7 +496,7 @@ static struct sway_container *select_workspace(struct sway_view *view) {
496 } 496 }
497 497
498 // Use the focused workspace 498 // Use the focused workspace
499 ws = seat_get_focus(seat); 499 ws = seat_get_focus_inactive(seat, &root_container);
500 if (ws->type != C_WORKSPACE) { 500 if (ws->type != C_WORKSPACE) {
501 ws = container_parent(ws, C_WORKSPACE); 501 ws = container_parent(ws, C_WORKSPACE);
502 } 502 }
@@ -505,7 +505,8 @@ static struct sway_container *select_workspace(struct sway_view *view) {
505 505
506static bool should_focus(struct sway_view *view) { 506static bool should_focus(struct sway_view *view) {
507 struct sway_seat *seat = input_manager_current_seat(input_manager); 507 struct sway_seat *seat = input_manager_current_seat(input_manager);
508 struct sway_container *prev_focus = seat_get_focus(seat); 508 struct sway_container *prev_focus =
509 seat_get_focus_inactive(seat, &root_container);
509 struct sway_container *prev_ws = prev_focus->type == C_WORKSPACE ? 510 struct sway_container *prev_ws = prev_focus->type == C_WORKSPACE ?
510 prev_focus : container_parent(prev_focus, C_WORKSPACE); 511 prev_focus : container_parent(prev_focus, C_WORKSPACE);
511 struct sway_container *map_ws = container_parent(view->swayc, C_WORKSPACE); 512 struct sway_container *map_ws = container_parent(view->swayc, C_WORKSPACE);