mirror of
https://github.com/swaywm/sway.git
synced 2024-12-29 16:36:26 +01:00
make handle_output_destroy() static
This commit is contained in:
parent
4c4cc9c999
commit
316effd7b1
2 changed files with 20 additions and 21 deletions
|
@ -45,7 +45,6 @@ void server_fini(struct sway_server *server);
|
|||
void server_run(struct sway_server *server);
|
||||
|
||||
void handle_new_output(struct wl_listener *listener, void *data);
|
||||
void handle_output_destroy(struct wl_listener *listener, void *data);
|
||||
|
||||
void handle_xdg_shell_v6_surface(struct wl_listener *listener, void *data);
|
||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||
|
|
|
@ -218,6 +218,26 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
|||
soutput->last_frame = now;
|
||||
}
|
||||
|
||||
static void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||
struct wlr_output *wlr_output = data;
|
||||
wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name);
|
||||
|
||||
swayc_t *output_container = NULL;
|
||||
for (int i = 0 ; i < root_container.children->length; ++i) {
|
||||
swayc_t *child = root_container.children->items[i];
|
||||
if (child->type == C_OUTPUT &&
|
||||
child->sway_output->wlr_output == wlr_output) {
|
||||
output_container = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!output_container) {
|
||||
return;
|
||||
}
|
||||
|
||||
destroy_output(output_container);
|
||||
}
|
||||
|
||||
void handle_new_output(struct wl_listener *listener, void *data) {
|
||||
struct sway_server *server = wl_container_of(listener, server, new_output);
|
||||
struct wlr_output *wlr_output = data;
|
||||
|
@ -252,23 +272,3 @@ void handle_new_output(struct wl_listener *listener, void *data) {
|
|||
|
||||
arrange_windows(&root_container, -1, -1);
|
||||
}
|
||||
|
||||
void handle_output_destroy(struct wl_listener *listener, void *data) {
|
||||
struct wlr_output *wlr_output = data;
|
||||
wlr_log(L_DEBUG, "Output %p %s removed", wlr_output, wlr_output->name);
|
||||
|
||||
swayc_t *output_container = NULL;
|
||||
for (int i = 0 ; i < root_container.children->length; ++i) {
|
||||
swayc_t *child = root_container.children->items[i];
|
||||
if (child->type == C_OUTPUT &&
|
||||
child->sway_output->wlr_output == wlr_output) {
|
||||
output_container = child;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!output_container) {
|
||||
return;
|
||||
}
|
||||
|
||||
destroy_output(output_container);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue