aboutsummaryrefslogtreecommitdiffstats
path: root/sway/commands/swap.c
diff options
context:
space:
mode:
authorLibravatar emersion <contact@emersion.fr>2018-11-14 19:31:43 +0100
committerLibravatar emersion <contact@emersion.fr>2018-11-14 19:31:43 +0100
commit98a953a87218305e87cab530d5442bf283949d97 (patch)
tree325f13b11d914ace15347fa7f0f26a3fc9636983 /sway/commands/swap.c
parentMerge pull request #3102 from emersion/render-software-cursors (diff)
downloadsway-98a953a87218305e87cab530d5442bf283949d97.tar.gz
sway-98a953a87218305e87cab530d5442bf283949d97.tar.zst
sway-98a953a87218305e87cab530d5442bf283949d97.zip
Fix unused function in swap command
Also fixes a size_t cast to void *.
Diffstat (limited to 'sway/commands/swap.c')
-rw-r--r--sway/commands/swap.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/sway/commands/swap.c b/sway/commands/swap.c
index 99051395..de3f5c18 100644
--- a/sway/commands/swap.c
+++ b/sway/commands/swap.c
@@ -144,19 +144,18 @@ static void container_swap(struct sway_container *con1,
144 } 144 }
145} 145}
146 146
147static bool test_con_id(struct sway_container *container, void *con_id) { 147static bool test_con_id(struct sway_container *container, void *data) {
148 return container->node.id == (size_t)con_id; 148 size_t *con_id = data;
149 return container->node.id == *con_id;
149} 150}
150 151
151static bool test_id(struct sway_container *container, void *id) {
152#ifdef HAVE_XWAYLAND 152#ifdef HAVE_XWAYLAND
153 xcb_window_t *wid = id; 153static bool test_id(struct sway_container *container, void *data) {
154 xcb_window_t *wid = data;
154 return (container->view && container->view->type == SWAY_VIEW_XWAYLAND 155 return (container->view && container->view->type == SWAY_VIEW_XWAYLAND
155 && container->view->wlr_xwayland_surface->window_id == *wid); 156 && container->view->wlr_xwayland_surface->window_id == *wid);
156#else
157 return false;
158#endif
159} 157}
158#endif
160 159
161static bool test_mark(struct sway_container *container, void *mark) { 160static bool test_mark(struct sway_container *container, void *mark) {
162 if (container->marks->length) { 161 if (container->marks->length) {
@@ -187,13 +186,13 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
187 if (strcasecmp(argv[2], "id") == 0) { 186 if (strcasecmp(argv[2], "id") == 0) {
188#ifdef HAVE_XWAYLAND 187#ifdef HAVE_XWAYLAND
189 xcb_window_t id = strtol(value, NULL, 0); 188 xcb_window_t id = strtol(value, NULL, 0);
190 other = root_find_container(test_id, (void *)&id); 189 other = root_find_container(test_id, &id);
191#endif 190#endif
192 } else if (strcasecmp(argv[2], "con_id") == 0) { 191 } else if (strcasecmp(argv[2], "con_id") == 0) {
193 size_t con_id = atoi(value); 192 size_t con_id = atoi(value);
194 other = root_find_container(test_con_id, (void *)con_id); 193 other = root_find_container(test_con_id, &con_id);
195 } else if (strcasecmp(argv[2], "mark") == 0) { 194 } else if (strcasecmp(argv[2], "mark") == 0) {
196 other = root_find_container(test_mark, (void *)value); 195 other = root_find_container(test_mark, value);
197 } else { 196 } else {
198 free(value); 197 free(value);
199 return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX); 198 return cmd_results_new(CMD_INVALID, "swap", EXPECTED_SYNTAX);