summaryrefslogtreecommitdiff
path: root/sway/commands
diff options
context:
space:
mode:
authorWill McKinnon <[email protected]>2022-08-15 00:54:07 -0400
committerWill McKinnon <[email protected]>2022-08-15 00:54:07 -0400
commit7b530bf4487f36273938ffd7236dad8a7629790a (patch)
tree0c5cdceb7fbda31530d2d32388db8e27f67748a0 /sway/commands
parentcf1ed777ae56f677bcc0f832c52c04dc65be18ce (diff)
Revert "merge sway master"
This reverts commit 7460d9f565092836f81b917a040caff57142d91a.
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, 27 insertions, 32 deletions
diff --git a/sway/commands/bind.c b/sway/commands/bind.c
index 26c99e63..25be415e 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->trigger != binding_b->trigger) {
+ if (binding_a->state != binding_b->state) {
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->trigger = SWAY_SWITCH_TRIGGER_ON;
+ binding->state = WLR_SWITCH_STATE_ON;
} else if (strcmp(split->items[1], "off") == 0) {
- binding->trigger = SWAY_SWITCH_TRIGGER_OFF;
+ binding->state = WLR_SWITCH_STATE_OFF;
} else if (strcmp(split->items[1], "toggle") == 0) {
- binding->trigger = SWAY_SWITCH_TRIGGER_TOGGLE;
+ binding->state = WLR_SWITCH_STATE_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 facd82de..b8d28480 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,14 +375,10 @@ 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) {
- if (!container) {
- return cmd_results_new(CMD_FAILURE, "No container to focus was specified.");
- }
-
+ if (argc == 0 && container) {
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 3be37daf..d6548a68 100644
--- a/sway/commands/input/xkb_switch_layout.c
+++ b/sway/commands/input/xkb_switch_layout.c
@@ -1,6 +1,5 @@
#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 0d0d9727..1a05a7a6 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, &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;
+ 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;
}
- 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 67f212ff..68ee9fe1 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 *real_src = malloc(strlen(conf_path) + strlen(src) + 2);
- if (!real_src) {
- free(src);
+ char *rel_path = src;
+ src = malloc(strlen(conf_path) + strlen(src) + 2);
+ if (!src) {
+ free(rel_path);
free(conf);
sway_log(SWAY_ERROR, "Unable to allocate memory");
return cmd_results_new(CMD_FAILURE,
"Unable to allocate resources");
}
- snprintf(real_src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, src);
- free(src);
+ sprintf(src, "%s/%s", conf_path, rel_path);
+ free(rel_path);
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 504a9f5e..749235eb 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_pointer_axis_event event = {
- .pointer = NULL,
+ struct wlr_event_pointer_axis event = {
+ .device = NULL,
.time_msec = 0,
.source = WLR_AXIS_SOURCE_WHEEL,
.orientation = orientation,