summaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
Diffstat (limited to 'sway/commands')
-rw-r--r--sway/commands/bind.c8
-rw-r--r--sway/commands/focus.c18
-rw-r--r--sway/commands/input/xkb_switch_layout.c1
-rw-r--r--sway/commands/move.c16
-rw-r--r--sway/commands/output/background.c12
-rw-r--r--sway/commands/seat/cursor.c4
6 files changed, 32 insertions, 27 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 25be415e..26c99e63 100644
--- a/sway/commands/bind.c
+++ b/sway/commands/bind.c
@@ -47,7 +47,7 @@ static bool binding_switch_compare(struct sway_switch_binding *binding_a,
if (binding_a->type != binding_b->type) {
return false;
}
- if (binding_a->state != binding_b->state) {
+ if (binding_a->trigger != binding_b->trigger) {
return false;
}
if ((binding_a->flags & BINDING_LOCKED) !=
@@ -551,11 +551,11 @@ struct cmd_results *cmd_bind_or_unbind_switch(int argc, char **argv,
"unknown switch %s)", bindtype, split->items[0]);
}
if (strcmp(split->items[1], "on") == 0) {
- binding->state = WLR_SWITCH_STATE_ON;
+ binding->trigger = SWAY_SWITCH_TRIGGER_ON;
} else if (strcmp(split->items[1], "off") == 0) {
- binding->state = WLR_SWITCH_STATE_OFF;
+ binding->trigger = SWAY_SWITCH_TRIGGER_OFF;
} else if (strcmp(split->items[1], "toggle") == 0) {
- binding->state = WLR_SWITCH_STATE_TOGGLE;
+ binding->trigger = SWAY_SWITCH_TRIGGER_TOGGLE;
} else {
free_switch_binding(binding);
return cmd_results_new(CMD_FAILURE,
diff --git a/sway/commands/focus.c b/sway/commands/focus.c
index b8d28480..facd82de 100644
--- a/sway/commands/focus.c
+++ b/sway/commands/focus.c
@@ -54,7 +54,7 @@ static bool get_direction_from_next_prev(struct sway_container *container,
} else {
return false;
}
-
+
return true;
}
@@ -285,7 +285,7 @@ static struct cmd_results *focus_mode(struct sway_workspace *ws,
}
} else {
return cmd_results_new(CMD_FAILURE,
- "Failed to find a %s container in workspace",
+ "Failed to find a %s container in workspace.",
floating ? "floating" : "tiling");
}
return cmd_results_new(CMD_SUCCESS, NULL);
@@ -295,7 +295,7 @@ static struct cmd_results *focus_output(struct sway_seat *seat,
int argc, char **argv) {
if (!argc) {
return cmd_results_new(CMD_INVALID,
- "Expected 'focus output <direction|name>'");
+ "Expected 'focus output <direction|name>'.");
}
char *identifier = join_args(argv, argc);
struct sway_output *output = output_by_name_or_id(identifier);
@@ -305,13 +305,13 @@ static struct cmd_results *focus_output(struct sway_seat *seat,
if (!parse_direction(identifier, &direction)) {
free(identifier);
return cmd_results_new(CMD_INVALID,
- "There is no output with that name");
+ "There is no output with that name.");
}
struct sway_workspace *ws = seat_get_focused_workspace(seat);
if (!ws) {
free(identifier);
return cmd_results_new(CMD_FAILURE,
- "No focused workspace to base directions off of");
+ "No focused workspace to base directions off of.");
}
output = output_get_in_direction(ws->output, direction);
@@ -375,10 +375,14 @@ struct cmd_results *cmd_focus(int argc, char **argv) {
struct sway_seat *seat = config->handler_context.seat;
if (node->type < N_WORKSPACE) {
return cmd_results_new(CMD_FAILURE,
- "Command 'focus' cannot be used above the workspace level");
+ "Command 'focus' cannot be used above the workspace level.");
}
- if (argc == 0 && container) {
+ if (argc == 0) {
+ if (!container) {
+ return cmd_results_new(CMD_FAILURE, "No container to focus was specified.");
+ }
+
if (container_is_scratchpad_hidden_or_child(container)) {
root_scratchpad_show(container);
}
diff --git a/sway/commands/input/xkb_switch_layout.c b/sway/commands/input/xkb_switch_layout.c
index d6548a68..3be37daf 100644
--- a/sway/commands/input/xkb_switch_layout.c
+++ b/sway/commands/input/xkb_switch_layout.c
@@ -1,5 +1,6 @@
#define _POSIX_C_SOURCE 200809L
#include <assert.h>
+#include <wlr/interfaces/wlr_keyboard.h>
#include "sway/config.h"
#include "sway/commands.h"
#include "sway/input/input-manager.h"
diff --git a/sway/commands/move.c b/sway/commands/move.c
index 1a05a7a6..0d0d9727 100644
--- a/sway/commands/move.c
+++ b/sway/commands/move.c
@@ -788,15 +788,15 @@ static struct cmd_results *cmd_move_to_position_pointer(
struct wlr_output *output = wlr_output_layout_output_at(
root->output_layout, cursor->x, cursor->y);
if (output) {
- struct wlr_box *box =
- wlr_output_layout_get_box(root->output_layout, output);
- lx = fmax(lx, box->x);
- ly = fmax(ly, box->y);
- if (lx + container->pending.width > box->x + box->width) {
- lx = box->x + box->width - container->pending.width;
+ struct wlr_box box;
+ wlr_output_layout_get_box(root->output_layout, output, &box);
+ lx = fmax(lx, box.x);
+ ly = fmax(ly, box.y);
+ if (lx + container->pending.width > box.x + box.width) {
+ lx = box.x + box.width - container->pending.width;
}
- if (ly + container->pending.height > box->y + box->height) {
- ly = box->y + box->height - container->pending.height;
+ if (ly + container->pending.height > box.y + box.height) {
+ ly = box.y + box.height - container->pending.height;
}
}
diff --git a/sway/commands/output/background.c b/sway/commands/output/background.c
index 68ee9fe1..67f212ff 100644
--- a/sway/commands/output/background.c
+++ b/sway/commands/output/background.c
@@ -102,19 +102,19 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
}
char *conf_path = dirname(conf);
- char *rel_path = src;
- src = malloc(strlen(conf_path) + strlen(src) + 2);
- if (!src) {
- free(rel_path);
+ char *real_src = malloc(strlen(conf_path) + strlen(src) + 2);
+ if (!real_src) {
+ free(src);
free(conf);
sway_log(SWAY_ERROR, "Unable to allocate memory");
return cmd_results_new(CMD_FAILURE,
"Unable to allocate resources");
}
- sprintf(src, "%s/%s", conf_path, rel_path);
- free(rel_path);
+ snprintf(real_src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, src);
+ free(src);
free(conf);
+ src = real_src;
}
bool can_access = access(src, F_OK) != -1;
diff --git a/sway/commands/seat/cursor.c b/sway/commands/seat/cursor.c
index 749235eb..504a9f5e 100644
--- a/sway/commands/seat/cursor.c
+++ b/sway/commands/seat/cursor.c
@@ -111,8 +111,8 @@ static struct cmd_results *press_or_release(struct sway_cursor *cursor,
: WLR_AXIS_ORIENTATION_HORIZONTAL;
double delta = (button == SWAY_SCROLL_UP || button == SWAY_SCROLL_LEFT)
? -1 : 1;
- struct wlr_event_pointer_axis event = {
- .device = NULL,
+ struct wlr_pointer_axis_event event = {
+ .pointer = NULL,
.time_msec = 0,
.source = WLR_AXIS_SOURCE_WHEEL,
.orientation = orientation,