Merge branch 'master' into set-set-raw-focus

master
Ian Fan 6 years ago committed by GitHub
commit ac20690945
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1,3 +1,4 @@
#define _POSIX_C_SOURCE 199309L
#include <limits.h> #include <limits.h>
#include <string.h> #include <string.h>
#include <stdbool.h> #include <stdbool.h>

@ -22,6 +22,7 @@ static void swap_places(struct sway_container *con1,
temp->width = con1->width; temp->width = con1->width;
temp->height = con1->height; temp->height = con1->height;
temp->parent = con1->parent; temp->parent = con1->parent;
temp->workspace = con1->workspace;
con1->x = con2->x; con1->x = con2->x;
con1->y = con2->y; con1->y = con2->y;
@ -34,8 +35,18 @@ static void swap_places(struct sway_container *con1,
con2->height = temp->height; con2->height = temp->height;
int temp_index = container_sibling_index(con1); int temp_index = container_sibling_index(con1);
container_insert_child(con2->parent, con1, container_sibling_index(con2)); 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); container_insert_child(temp->parent, con2, temp_index);
} else {
workspace_insert_tiling(temp->workspace, con2, temp_index);
}
free(temp); free(temp);
} }

@ -586,7 +586,11 @@ bool bar_setup(struct swaybar *bar, const char *socket_path) {
} }
bar->display = wl_display_connect(NULL); 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); struct wl_registry *registry = wl_display_get_registry(bar->display);
wl_registry_add_listener(registry, &registry_listener, bar); wl_registry_add_listener(registry, &registry_listener, bar);

@ -222,7 +222,12 @@ int main(int argc, const char **argv) {
} }
state.display = wl_display_connect(NULL); 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); struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state); wl_registry_add_listener(registry, &registry_listener, &state);

@ -388,7 +388,9 @@ int main(int argc, char *argv[]) {
state.display = wl_display_connect(NULL); state.display = wl_display_connect(NULL);
if (state.display == 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; return -3;
} }

@ -634,13 +634,9 @@ static int parse_options(int argc, char **argv, struct swaylock_state *state,
} }
break; break;
case 'v': case 'v':
#if defined SWAY_GIT_VERSION && defined SWAY_GIT_BRANCH && defined SWAY_VERSION_DATE fprintf(stdout, "swaylock version " SWAY_VERSION "\n");
fprintf(stdout, "swaylock version %s (%s, branch \"%s\")\n", exit(EXIT_SUCCESS);
SWAY_GIT_VERSION, SWAY_VERSION_DATE, SWAY_GIT_BRANCH); break;
#else
fprintf(stdout, "version unknown\n");
#endif
return 1;
case LO_BS_HL_COLOR: case LO_BS_HL_COLOR:
if (state) { if (state) {
state->args.colors.bs_highlight = parse_color(optarg); state->args.colors.bs_highlight = parse_color(optarg);
@ -908,7 +904,11 @@ int main(int argc, char **argv) {
wl_list_init(&state.surfaces); wl_list_init(&state.surfaces);
state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS); state.xkb.context = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
state.display = wl_display_connect(NULL); 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); struct wl_registry *registry = wl_display_get_registry(state.display);
wl_registry_add_listener(registry, &registry_listener, &state); wl_registry_add_listener(registry, &registry_listener, &state);

@ -342,7 +342,11 @@ static const struct wl_registry_listener registry_listener = {
void swaynag_setup(struct swaynag *swaynag) { void swaynag_setup(struct swaynag *swaynag) {
swaynag->display = wl_display_connect(NULL); 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; swaynag->scale = 1;
wl_list_init(&swaynag->outputs); wl_list_init(&swaynag->outputs);

Loading…
Cancel
Save