mirror of
https://github.com/NickHu/sway
synced 2024-12-26 21:58:30 +01:00
output destroy
This commit is contained in:
parent
06c71f115b
commit
7dfbf06de9
5 changed files with 15 additions and 15 deletions
|
@ -14,6 +14,7 @@ struct sway_output {
|
|||
struct timespec last_frame;
|
||||
|
||||
struct wl_listener frame;
|
||||
struct wl_listener output_destroy;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,8 +24,7 @@ struct sway_server {
|
|||
|
||||
struct sway_input_manager *input;
|
||||
|
||||
struct wl_listener output_add;
|
||||
struct wl_listener output_remove;
|
||||
struct wl_listener new_output;
|
||||
struct wl_listener output_frame;
|
||||
|
||||
struct wlr_xdg_shell_v6 *xdg_shell_v6;
|
||||
|
@ -45,8 +44,8 @@ bool server_init(struct sway_server *server);
|
|||
void server_fini(struct sway_server *server);
|
||||
void server_run(struct sway_server *server);
|
||||
|
||||
void output_add_notify(struct wl_listener *listener, void *data);
|
||||
void output_remove_notify(struct wl_listener *listener, void *data);
|
||||
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);
|
||||
|
|
|
@ -243,8 +243,8 @@ static void output_frame_notify(struct wl_listener *listener, void *data) {
|
|||
soutput->last_frame = now;
|
||||
}
|
||||
|
||||
void output_add_notify(struct wl_listener *listener, void *data) {
|
||||
struct sway_server *server = wl_container_of(listener, server, output_add);
|
||||
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;
|
||||
wlr_log(L_DEBUG, "New output %p: %s", wlr_output, wlr_output->name);
|
||||
|
||||
|
@ -269,12 +269,14 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
|||
|
||||
sway_input_manager_configure_xcursor(input_manager);
|
||||
|
||||
output->frame.notify = output_frame_notify;
|
||||
wl_signal_add(&wlr_output->events.frame, &output->frame);
|
||||
output->frame.notify = output_frame_notify;
|
||||
|
||||
wl_signal_add(&wlr_output->events.destroy, &output->output_destroy);
|
||||
output->output_destroy.notify = handle_output_destroy;
|
||||
}
|
||||
|
||||
void output_remove_notify(struct wl_listener *listener, void *data) {
|
||||
struct sway_server *server = wl_container_of(listener, server, output_remove);
|
||||
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);
|
||||
|
||||
|
|
|
@ -48,12 +48,8 @@ bool server_init(struct sway_server *server) {
|
|||
server->data_device_manager =
|
||||
wlr_data_device_manager_create(server->wl_display);
|
||||
|
||||
server->output_add.notify = output_add_notify;
|
||||
wl_signal_add(&server->backend->events.output_add, &server->output_add);
|
||||
|
||||
server->output_remove.notify = output_remove_notify;
|
||||
wl_signal_add(&server->backend->events.output_remove,
|
||||
&server->output_remove);
|
||||
server->new_output.notify = handle_new_output;
|
||||
wl_signal_add(&server->backend->events.new_output, &server->new_output);
|
||||
|
||||
server->xdg_shell_v6 = wlr_xdg_shell_v6_create(server->wl_display);
|
||||
wl_signal_add(&server->xdg_shell_v6->events.new_surface,
|
||||
|
|
|
@ -235,6 +235,8 @@ swayc_t *destroy_output(swayc_t *output) {
|
|||
}
|
||||
}
|
||||
|
||||
wl_list_remove(&output->sway_output->output_destroy.link);
|
||||
|
||||
wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
|
||||
free_swayc(output);
|
||||
|
||||
|
|
Loading…
Reference in a new issue