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

This commit is contained in:
Ian Fan 2018-10-16 10:50:56 +01:00 committed by GitHub
commit ac20690945
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 14 deletions

View file

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

View file

@ -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);
}

View file

@ -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);

View file

@ -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);

View file

@ -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;
}

View file

@ -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);

View file

@ -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);