mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
output: take wl_display in wlr_output_create_global()
Currently wlr_output holds a wl_display, but it will go away soon. Instead of relying on that field in wlr_output_create_global(), make the dependency explicit by taking a wl_display as argument.
This commit is contained in:
parent
6a7463bb8e
commit
5717e27c06
6 changed files with 11 additions and 10 deletions
|
@ -163,7 +163,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
wl_list_insert(&server->outputs, &output->link);
|
wl_list_insert(&server->outputs, &output->link);
|
||||||
|
|
||||||
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
wlr_output_layout_add_auto(server->output_layout, wlr_output);
|
||||||
wlr_output_create_global(wlr_output);
|
wlr_output_create_global(wlr_output, server->wl_display);
|
||||||
|
|
||||||
struct wlr_output_state state;
|
struct wlr_output_state state;
|
||||||
wlr_output_state_init(&state);
|
wlr_output_state_init(&state);
|
||||||
|
|
|
@ -184,7 +184,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_commit_state(wlr_output, &state);
|
wlr_output_commit_state(wlr_output, &state);
|
||||||
wlr_output_state_finish(&state);
|
wlr_output_state_finish(&state);
|
||||||
|
|
||||||
wlr_output_create_global(wlr_output);
|
wlr_output_create_global(wlr_output, server->wl_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_surface_handle_destroy(struct wl_listener *listener,
|
static void output_surface_handle_destroy(struct wl_listener *listener,
|
||||||
|
|
|
@ -90,7 +90,7 @@ static void server_handle_new_output(struct wl_listener *listener, void *data) {
|
||||||
wlr_output_commit_state(wlr_output, &state);
|
wlr_output_commit_state(wlr_output, &state);
|
||||||
wlr_output_state_finish(&state);
|
wlr_output_state_finish(&state);
|
||||||
|
|
||||||
wlr_output_create_global(wlr_output);
|
wlr_output_create_global(wlr_output, server->display);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void surface_handle_commit(struct wl_listener *listener, void *data) {
|
static void surface_handle_commit(struct wl_listener *listener, void *data) {
|
||||||
|
|
|
@ -279,7 +279,7 @@ struct wlr_surface;
|
||||||
* wlr_output_commit().
|
* wlr_output_commit().
|
||||||
*/
|
*/
|
||||||
void wlr_output_enable(struct wlr_output *output, bool enable);
|
void wlr_output_enable(struct wlr_output *output, bool enable);
|
||||||
void wlr_output_create_global(struct wlr_output *output);
|
void wlr_output_create_global(struct wlr_output *output, struct wl_display *display);
|
||||||
void wlr_output_destroy_global(struct wlr_output *output);
|
void wlr_output_destroy_global(struct wlr_output *output);
|
||||||
/**
|
/**
|
||||||
* Initialize the output's rendering subsystem with the provided allocator and
|
* Initialize the output's rendering subsystem with the provided allocator and
|
||||||
|
|
|
@ -128,11 +128,11 @@ static void output_bind(struct wl_client *wl_client, void *data,
|
||||||
wl_signal_emit_mutable(&output->events.bind, &evt);
|
wl_signal_emit_mutable(&output->events.bind, &evt);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wlr_output_create_global(struct wlr_output *output) {
|
void wlr_output_create_global(struct wlr_output *output, struct wl_display *display) {
|
||||||
if (output->global != NULL) {
|
if (output->global != NULL) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
output->global = wl_global_create(output->display,
|
output->global = wl_global_create(display,
|
||||||
&wl_output_interface, OUTPUT_VERSION, output, output_bind);
|
&wl_output_interface, OUTPUT_VERSION, output, output_bind);
|
||||||
if (output->global == NULL) {
|
if (output->global == NULL) {
|
||||||
wlr_log(WLR_ERROR, "Failed to allocate wl_output global");
|
wlr_log(WLR_ERROR, "Failed to allocate wl_output global");
|
||||||
|
|
|
@ -115,10 +115,11 @@ static void output_layout_reconfigure(struct wlr_output_layout *layout) {
|
||||||
wl_signal_emit_mutable(&layout->events.change, layout);
|
wl_signal_emit_mutable(&layout->events.change, layout);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void output_update_global(struct wlr_output *output) {
|
static void output_update_global(struct wlr_output_layout *layout,
|
||||||
|
struct wlr_output *output) {
|
||||||
// Don't expose the output if it doesn't have a current mode
|
// Don't expose the output if it doesn't have a current mode
|
||||||
if (wl_list_empty(&output->modes) || output->current_mode != NULL) {
|
if (wl_list_empty(&output->modes) || output->current_mode != NULL) {
|
||||||
wlr_output_create_global(output);
|
wlr_output_create_global(output, layout->display);
|
||||||
} else {
|
} else {
|
||||||
wlr_output_destroy_global(output);
|
wlr_output_destroy_global(output);
|
||||||
}
|
}
|
||||||
|
@ -133,7 +134,7 @@ static void handle_output_commit(struct wl_listener *listener, void *data) {
|
||||||
WLR_OUTPUT_STATE_TRANSFORM |
|
WLR_OUTPUT_STATE_TRANSFORM |
|
||||||
WLR_OUTPUT_STATE_MODE)) {
|
WLR_OUTPUT_STATE_MODE)) {
|
||||||
output_layout_reconfigure(l_output->layout);
|
output_layout_reconfigure(l_output->layout);
|
||||||
output_update_global(l_output->output);
|
output_update_global(l_output->layout, l_output->output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -193,7 +194,7 @@ static struct wlr_output_layout_output *output_layout_add(struct wlr_output_layo
|
||||||
l_output->auto_configured = auto_configured;
|
l_output->auto_configured = auto_configured;
|
||||||
|
|
||||||
output_layout_reconfigure(layout);
|
output_layout_reconfigure(layout);
|
||||||
output_update_global(output);
|
output_update_global(layout, output);
|
||||||
|
|
||||||
if (is_new) {
|
if (is_new) {
|
||||||
wl_signal_emit_mutable(&layout->events.add, l_output);
|
wl_signal_emit_mutable(&layout->events.add, l_output);
|
||||||
|
|
Loading…
Reference in a new issue