diff options
author | Tony Crisci <tony@dubstepdish.com> | 2018-02-14 15:08:10 -0500 |
---|---|---|
committer | Tony Crisci <tony@dubstepdish.com> | 2018-02-14 15:08:10 -0500 |
commit | 083e11ac7c03167d88b4f7532e5311d460e799e2 (patch) | |
tree | 3cc0b6a72f4fa4dfd5d6f58bcd23831b74f19bcf | |
parent | get swayc in direction (diff) | |
parent | output damage fix (diff) | |
download | sway-083e11ac7c03167d88b4f7532e5311d460e799e2.tar.gz sway-083e11ac7c03167d88b4f7532e5311d460e799e2.tar.zst sway-083e11ac7c03167d88b4f7532e5311d460e799e2.zip |
fix build for latest api
-rw-r--r-- | include/sway/input/input-manager.h | 1 | ||||
-rw-r--r-- | include/sway/output.h | 1 | ||||
-rw-r--r-- | include/sway/server.h | 7 | ||||
-rw-r--r-- | sway/desktop/output.c | 15 | ||||
-rw-r--r-- | sway/input/input-manager.c | 61 | ||||
-rw-r--r-- | sway/server.c | 8 | ||||
-rw-r--r-- | sway/tree/container.c | 2 | ||||
-rw-r--r-- | sway/tree/layout.c | 3 |
8 files changed, 51 insertions, 47 deletions
diff --git a/include/sway/input/input-manager.h b/include/sway/input/input-manager.h index 66ace262..a76c3880 100644 --- a/include/sway/input/input-manager.h +++ b/include/sway/input/input-manager.h | |||
@@ -16,6 +16,7 @@ struct sway_input_device { | |||
16 | struct wlr_input_device *wlr_device; | 16 | struct wlr_input_device *wlr_device; |
17 | struct input_config *config; | 17 | struct input_config *config; |
18 | struct wl_list link; | 18 | struct wl_list link; |
19 | struct wl_listener device_destroy; | ||
19 | }; | 20 | }; |
20 | 21 | ||
21 | struct sway_input_manager { | 22 | struct sway_input_manager { |
diff --git a/include/sway/output.h b/include/sway/output.h index 7ca02d7b..95d64705 100644 --- a/include/sway/output.h +++ b/include/sway/output.h | |||
@@ -14,6 +14,7 @@ struct sway_output { | |||
14 | struct timespec last_frame; | 14 | struct timespec last_frame; |
15 | 15 | ||
16 | struct wl_listener frame; | 16 | struct wl_listener frame; |
17 | struct wl_listener output_destroy; | ||
17 | }; | 18 | }; |
18 | 19 | ||
19 | #endif | 20 | #endif |
diff --git a/include/sway/server.h b/include/sway/server.h index d497e132..1600babe 100644 --- a/include/sway/server.h +++ b/include/sway/server.h | |||
@@ -24,8 +24,7 @@ struct sway_server { | |||
24 | 24 | ||
25 | struct sway_input_manager *input; | 25 | struct sway_input_manager *input; |
26 | 26 | ||
27 | struct wl_listener output_add; | 27 | struct wl_listener new_output; |
28 | struct wl_listener output_remove; | ||
29 | struct wl_listener output_frame; | 28 | struct wl_listener output_frame; |
30 | 29 | ||
31 | struct wlr_xdg_shell_v6 *xdg_shell_v6; | 30 | struct wlr_xdg_shell_v6 *xdg_shell_v6; |
@@ -45,8 +44,8 @@ bool server_init(struct sway_server *server); | |||
45 | void server_fini(struct sway_server *server); | 44 | void server_fini(struct sway_server *server); |
46 | void server_run(struct sway_server *server); | 45 | void server_run(struct sway_server *server); |
47 | 46 | ||
48 | void output_add_notify(struct wl_listener *listener, void *data); | 47 | void handle_new_output(struct wl_listener *listener, void *data); |
49 | void output_remove_notify(struct wl_listener *listener, void *data); | 48 | void handle_output_destroy(struct wl_listener *listener, void *data); |
50 | 49 | ||
51 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); | 50 | void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data); |
52 | void handle_xwayland_surface(struct wl_listener *listener, void *data); | 51 | void handle_xwayland_surface(struct wl_listener *listener, void *data); |
diff --git a/sway/desktop/output.c b/sway/desktop/output.c index 6bbaf938..e250d450 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c | |||
@@ -216,11 +216,12 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
216 | struct sway_output *soutput = wl_container_of(listener, soutput, frame); | 216 | struct sway_output *soutput = wl_container_of(listener, soutput, frame); |
217 | struct wlr_output *wlr_output = data; | 217 | struct wlr_output *wlr_output = data; |
218 | struct sway_server *server = soutput->server; | 218 | struct sway_server *server = soutput->server; |
219 | |||
220 | float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; | 219 | float clear_color[] = {0.25f, 0.25f, 0.25f, 1.0f}; |
221 | struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); | 220 | struct wlr_renderer *renderer = wlr_backend_get_renderer(wlr_output->backend); |
222 | wlr_renderer_clear(renderer, &clear_color); | 221 | wlr_renderer_clear(renderer, &clear_color); |
223 | 222 | ||
223 | wlr_renderer_clear(renderer, &clear_color); | ||
224 | |||
224 | int buffer_age = -1; | 225 | int buffer_age = -1; |
225 | wlr_output_make_current(wlr_output, &buffer_age); | 226 | wlr_output_make_current(wlr_output, &buffer_age); |
226 | wlr_renderer_begin(server->renderer, wlr_output); | 227 | wlr_renderer_begin(server->renderer, wlr_output); |
@@ -254,8 +255,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) { | |||
254 | soutput->last_frame = now; | 255 | soutput->last_frame = now; |
255 | } | 256 | } |
256 | 257 | ||
257 | void output_add_notify(struct wl_listener *listener, void *data) { | 258 | void handle_new_output(struct wl_listener *listener, void *data) { |
258 | struct sway_server *server = wl_container_of(listener, server, output_add); | 259 | struct sway_server *server = wl_container_of(listener, server, new_output); |
259 | struct wlr_output *wlr_output = data; | 260 | struct wlr_output *wlr_output = data; |
260 | wlr_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); | 261 | wlr_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name); |
261 | 262 | ||
@@ -280,12 +281,14 @@ void output_add_notify(struct wl_listener *listener, void *data) { | |||
280 | 281 | ||
281 | sway_input_manager_configure_xcursor(input_manager); | 282 | sway_input_manager_configure_xcursor(input_manager); |
282 | 283 | ||
283 | output->frame.notify = output_frame_notify; | ||
284 | wl_signal_add(&wlr_output->events.frame, &output->frame); | 284 | wl_signal_add(&wlr_output->events.frame, &output->frame); |
285 | output->frame.notify = output_frame_notify; | ||
286 | |||
287 | wl_signal_add(&wlr_output->events.destroy, &output->output_destroy); | ||
288 | output->output_destroy.notify = handle_output_destroy; | ||
285 | } | 289 | } |
286 | 290 | ||
287 | void output_remove_notify(struct wl_listener *listener, void *data) { | 291 | void handle_output_destroy(struct wl_listener *listener, void *data) { |
288 | struct sway_server *server = wl_container_of(listener, server, output_remove); | ||
289 | struct wlr_output *wlr_output = data; | 292 | struct wlr_output *wlr_output = data; |
290 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); | 293 | wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name); |
291 | 294 | ||
diff --git a/sway/input/input-manager.c b/sway/input/input-manager.c index 90eb8cf6..e6708bad 100644 --- a/sway/input/input-manager.c +++ b/sway/input/input-manager.c | |||
@@ -160,7 +160,32 @@ static void sway_input_manager_libinput_config_pointer(struct sway_input_device | |||
160 | } | 160 | } |
161 | } | 161 | } |
162 | 162 | ||
163 | static void input_add_notify(struct wl_listener *listener, void *data) { | 163 | static void handle_device_destroy(struct wl_listener *listener, void *data) { |
164 | struct wlr_input_device *device = data; | ||
165 | |||
166 | struct sway_input_device *input_device = | ||
167 | input_sway_device_from_wlr(input_manager, device); | ||
168 | |||
169 | if (!sway_assert(input_device, "could not find sway device")) { | ||
170 | return; | ||
171 | } | ||
172 | |||
173 | wlr_log(L_DEBUG, "removing device: '%s'", | ||
174 | input_device->identifier); | ||
175 | |||
176 | struct sway_seat *seat = NULL; | ||
177 | wl_list_for_each(seat, &input_manager->seats, link) { | ||
178 | sway_seat_remove_device(seat, input_device); | ||
179 | } | ||
180 | |||
181 | wl_list_remove(&input_device->link); | ||
182 | wl_list_remove(&input_device->device_destroy.link); | ||
183 | free_input_config(input_device->config); | ||
184 | free(input_device->identifier); | ||
185 | free(input_device); | ||
186 | } | ||
187 | |||
188 | static void handle_new_input(struct wl_listener *listener, void *data) { | ||
164 | struct sway_input_manager *input = | 189 | struct sway_input_manager *input = |
165 | wl_container_of(listener, input, input_add); | 190 | wl_container_of(listener, input, input_add); |
166 | struct wlr_input_device *device = data; | 191 | struct wlr_input_device *device = data; |
@@ -226,32 +251,9 @@ static void input_add_notify(struct wl_listener *listener, void *data) { | |||
226 | "device '%s' is not configured on any seats", | 251 | "device '%s' is not configured on any seats", |
227 | input_device->identifier); | 252 | input_device->identifier); |
228 | } | 253 | } |
229 | } | ||
230 | |||
231 | static void input_remove_notify(struct wl_listener *listener, void *data) { | ||
232 | struct sway_input_manager *input = | ||
233 | wl_container_of(listener, input, input_remove); | ||
234 | struct wlr_input_device *device = data; | ||
235 | |||
236 | struct sway_input_device *input_device = | ||
237 | input_sway_device_from_wlr(input, device); | ||
238 | |||
239 | if (!sway_assert(input_device, "could not find sway device")) { | ||
240 | return; | ||
241 | } | ||
242 | |||
243 | wlr_log(L_DEBUG, "removing device: '%s'", | ||
244 | input_device->identifier); | ||
245 | |||
246 | struct sway_seat *seat = NULL; | ||
247 | wl_list_for_each(seat, &input->seats, link) { | ||
248 | sway_seat_remove_device(seat, input_device); | ||
249 | } | ||
250 | 254 | ||
251 | wl_list_remove(&input_device->link); | 255 | wl_signal_add(&device->events.destroy, &input_device->device_destroy); |
252 | free_input_config(input_device->config); | 256 | input_device->device_destroy.notify = handle_device_destroy; |
253 | free(input_device->identifier); | ||
254 | free(input_device); | ||
255 | } | 257 | } |
256 | 258 | ||
257 | struct sway_input_manager *sway_input_manager_create( | 259 | struct sway_input_manager *sway_input_manager_create( |
@@ -269,11 +271,8 @@ struct sway_input_manager *sway_input_manager_create( | |||
269 | // create the default seat | 271 | // create the default seat |
270 | input_manager_get_seat(input, default_seat); | 272 | input_manager_get_seat(input, default_seat); |
271 | 273 | ||
272 | input->input_add.notify = input_add_notify; | 274 | input->input_add.notify = handle_new_input; |
273 | wl_signal_add(&server->backend->events.input_add, &input->input_add); | 275 | wl_signal_add(&server->backend->events.new_input, &input->input_add); |
274 | |||
275 | input->input_remove.notify = input_remove_notify; | ||
276 | wl_signal_add(&server->backend->events.input_remove, &input->input_remove); | ||
277 | 276 | ||
278 | return input; | 277 | return input; |
279 | } | 278 | } |
diff --git a/sway/server.c b/sway/server.c index b5eb510b..0753d37e 100644 --- a/sway/server.c +++ b/sway/server.c | |||
@@ -48,12 +48,8 @@ bool server_init(struct sway_server *server) { | |||
48 | server->data_device_manager = | 48 | server->data_device_manager = |
49 | wlr_data_device_manager_create(server->wl_display); | 49 | wlr_data_device_manager_create(server->wl_display); |
50 | 50 | ||
51 | server->output_add.notify = output_add_notify; | 51 | server->new_output.notify = handle_new_output; |
52 | wl_signal_add(&server->backend->events.output_add, &server->output_add); | 52 | wl_signal_add(&server->backend->events.new_output, &server->new_output); |
53 | |||
54 | server->output_remove.notify = output_remove_notify; | ||
55 | wl_signal_add(&server->backend->events.output_remove, | ||
56 | &server->output_remove); | ||
57 | 53 | ||
58 | server->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); | 54 | server->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display); |
59 | wl_signal_add(&server->xdg_shell_v6->events.new_surface, | 55 | wl_signal_add(&server->xdg_shell_v6->events.new_surface, |
diff --git a/sway/tree/container.c b/sway/tree/container.c index d1fb7a79..a6268133 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c | |||
@@ -236,6 +236,8 @@ swayc_t *destroy_output(swayc_t *output) { | |||
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | wl_list_remove(&output->sway_output->output_destroy.link); | ||
240 | |||
239 | wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); | 241 | wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); |
240 | free_swayc(output); | 242 | free_swayc(output); |
241 | 243 | ||
diff --git a/sway/tree/layout.c b/sway/tree/layout.c index 9768279a..205f42eb 100644 --- a/sway/tree/layout.c +++ b/sway/tree/layout.c | |||
@@ -461,6 +461,8 @@ static swayc_t *get_swayc_in_direction_under(swayc_t *container, | |||
461 | int desired; | 461 | int desired; |
462 | int idx = index_child(container); | 462 | int idx = index_child(container); |
463 | if (parent->type == C_ROOT) { | 463 | if (parent->type == C_ROOT) { |
464 | // TODO | ||
465 | /* | ||
464 | struct wlr_output_layout *layout = root_container.sway_root->output_layout; | 466 | struct wlr_output_layout *layout = root_container.sway_root->output_layout; |
465 | wlr_output_layout_adjacent_output(layout, container->sway_output->wlr_output); | 467 | wlr_output_layout_adjacent_output(layout, container->sway_output->wlr_output); |
466 | //swayc_t *output = swayc_adjacent_output(container, dir, &abs_pos, true); | 468 | //swayc_t *output = swayc_adjacent_output(container, dir, &abs_pos, true); |
@@ -469,6 +471,7 @@ static swayc_t *get_swayc_in_direction_under(swayc_t *container, | |||
469 | } | 471 | } |
470 | wlr_log(L_DEBUG, "Moving between outputs"); | 472 | wlr_log(L_DEBUG, "Moving between outputs"); |
471 | return get_swayc_in_output_direction(output, dir, seat); | 473 | return get_swayc_in_output_direction(output, dir, seat); |
474 | */ | ||
472 | } else { | 475 | } else { |
473 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { | 476 | if (dir == MOVE_LEFT || dir == MOVE_RIGHT) { |
474 | if (parent->layout == L_HORIZ || parent->layout == L_TABBED) { | 477 | if (parent->layout == L_HORIZ || parent->layout == L_TABBED) { |