aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Fan <ianfan0@gmail.com>2018-10-16 10:50:56 +0100
committerGitHub <noreply@github.com>2018-10-16 10:50:56 +0100
commitac20690945f1cd44c4c22267c9e7a172ebcf5ba5 (patch)
tree994739d4ba8388d7a336ac825a618daf2274ec66
parent05284b65db5f3cdfa88d7e06055aadd0d5fa8e50 (diff)
parentcd02d60a992ee38689a0d17fc69c4e2b1956f266 (diff)
Merge branch 'master' into set-set-raw-focus
-rw-r--r--common/loop.c1
-rw-r--r--sway/commands/swap.c15
-rw-r--r--swaybar/bar.c6
-rw-r--r--swaybg/main.c7
-rw-r--r--swayidle/main.c4
-rw-r--r--swaylock/main.c16
-rw-r--r--swaynag/swaynag.c6
7 files changed, 41 insertions, 14 deletions
diff --git a/common/loop.c b/common/loop.c
index 1b174967..750bee75 100644
--- a/common/loop.c
+++ b/common/loop.c
@@ -1,3 +1,4 @@
+#define _POSIX_C_SOURCE 199309L
#include <limits.h>
#include <string.h>
#include <stdbool.h>
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index 22e3927d..9cc0d5c2 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -22,6 +22,7 @@ static void swap_places(struct sway_container *con1,
temp->width = con1->width;
temp->height = con1->height;
temp->parent = con1->parent;
+ temp->workspace = con1->workspace;
con1->x = con2->x;
con1->y = con2->y;
@@ -34,8 +35,18 @@ static void swap_places(struct sway_container *con1,
con2->height = temp->height;
int temp_index = container_sibling_index(con1);
- container_insert_child(con2->parent, con1, container_sibling_index(con2));
- container_insert_child(temp->parent, con2, temp_index);
+ if (con2->parent) {
+ container_insert_child(con2->parent, con1,
+ container_sibling_index(con2));
+ } else {
+ workspace_insert_tiling(con2->workspace, con1,
+ container_sibling_index(con2));
+ }
+ if (temp->parent) {
+ container_insert_child(temp->parent, con2, temp_index);
+ } else {
+ workspace_insert_tiling(temp->workspace, con2, temp_index);
+ }
free(temp);
}
diff --git a/swaybar/bar.c b/swaybar/bar.c
index be290c18..0deba72d 100644
--- a/swaybar/bar.c
+++ b/swaybar/bar.c
@@ -586,7 +586,11 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
}
bar->display = wl_display_connect(NULL);
- assert(bar->display);
+ if (!bar->display) {
+ sway_abort("Unable to connect to the compositor. "
+ "If your compositor is running, check or set the "
+ "WAYLAND_DISPLAY environment variable.");
+ }
struct wl_registry *registry = wl_display_get_registry(bar->display);
wl_registry_add_listener(registry, &registry_listener, bar);
diff --git a/swaybg/main.c b/swaybg/main.c
index 742669ef..45b7a913 100644
--- a/swaybg/main.c
+++ b/swaybg/main.c
@@ -222,7 +222,12 @@ int main(int argc, const char **argv) {
}
state.display = wl_display_connect(NULL);
- assert(state.display);
+ if (!state.display) {
+ wlr_log(WLR_ERROR, "Unable to connect to the compositor. "
+ "If your compositor is running, check or set the "
+ "WAYLAND_DISPLAY environment variable.");
+ return 1;
+ }
struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state);
diff --git a/swayidle/main.c b/swayidle/main.c
index 5b6c95a7..93f4c94b 100644
--- a/swayidle/main.c
+++ b/swayidle/main.c
@@ -388,7 +388,9 @@ int main(int argc, char *argv[]) {
state.display = wl_display_connect(NULL);
if (state.display == NULL) {
- wlr_log(WLR_ERROR, "Failed to create display");
+ wlr_log(WLR_ERROR, "Unable to connect to the compositor. "
+ "If your compositor is running, check or set the "
+ "WAYLAND_DISPLAY environment variable.");
return -3;
}
diff --git a/swaylock/main.c b/swaylock/main.c
index 27bcfe32..86dfd577 100644
--- a/swaylock/main.c
+++ b/swaylock/main.c
@@ -634,13 +634,9 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state,
}
break;
case 'v':
-#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE
- fprintf(stdout, "swaylock version %s (%s, branch \"%s\")\n",
- SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH);
-#else
- fprintf(stdout, "version unknown\n");
-#endif
- return 1;
+ fprintf(stdout, "swaylock version " SWAY_VERSION "\n");
+ exit(EXIT_SUCCESS);
+ break;
case LO_BS_HL_COLOR:
if (state) {
state->args.colors.bs_highlight = parse_color(optarg);
@@ -908,7 +904,11 @@ int main(int argc, char **argv) {
wl_list_init(&state.surfaces);
state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
state.display = wl_display_connect(NULL);
- assert(state.display);
+ if (!state.display) {
+ sway_abort("Unable to connect to the compositor. "
+ "If your compositor is running, check or set the "
+ "WAYLAND_DISPLAY environment variable.");
+ }
struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state);
diff --git a/swaynag/swaynag.c b/swaynag/swaynag.c
index 69da851e..fa6bbe05 100644
--- a/swaynag/swaynag.c
+++ b/swaynag/swaynag.c
@@ -342,7 +342,11 @@ static const struct wl_registry_listener registry_listener = {
void swaynag_setup(struct swaynag *swaynag) {
swaynag->display = wl_display_connect(NULL);
- assert(swaynag->display);
+ if (!swaynag->display) {
+ sway_abort("Unable to connect to the compositor. "
+ "If your compositor is running, check or set the "
+ "WAYLAND_DISPLAY environment variable.");
+ }
swaynag->scale = 1;
wl_list_init(&swaynag->outputs);