re-adds wlr_output_update_enabled

Re-add the wlr_output_update_enabled to make sure
wlr_output::events.enable is called when the output enabled state
changes.
This commit is contained in:
Markus Ongyerth 2018-01-24 10:23:48 +01:00
parent 3cf7225cec
commit f946c10cb1
7 changed files with 18 additions and 9 deletions

View file

@ -267,7 +267,7 @@ static void wlr_drm_connector_enable(struct wlr_output *output, bool enable) {
wlr_drm_connector_start_renderer(conn); wlr_drm_connector_start_renderer(conn);
} }
conn->output.enabled = enable; wlr_output_update_enabled(&conn->output, enable);
} }
static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in, static void realloc_planes(struct wlr_drm_backend *drm, const uint32_t *crtc_in,
@ -813,7 +813,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link); wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link);
} }
wlr_conn->output.enabled = true; wlr_output_update_enabled(&wlr_conn->output, true);
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET; wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
wlr_log(L_INFO, "Sending modesetting signal for '%s'", wlr_log(L_INFO, "Sending modesetting signal for '%s'",
@ -823,7 +823,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
drm_conn->connection != DRM_MODE_CONNECTED) { drm_conn->connection != DRM_MODE_CONNECTED) {
wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name); wlr_log(L_INFO, "'%s' disconnected", wlr_conn->output.name);
wlr_conn->output.enabled = false; wlr_output_update_enabled(&wlr_conn->output, false);
wlr_drm_connector_cleanup(wlr_conn); wlr_drm_connector_cleanup(wlr_conn);
} }

View file

@ -15,7 +15,7 @@ static bool backend_start(struct wlr_backend *wlr_backend) {
struct wlr_headless_output *output; struct wlr_headless_output *output;
wl_list_for_each(output, &backend->outputs, link) { wl_list_for_each(output, &backend->outputs, link) {
wl_event_source_timer_update(output->frame_timer, output->frame_delay); wl_event_source_timer_update(output->frame_timer, output->frame_delay);
output->wlr_output.enabled = true; wlr_output_update_enabled(&output->wlr_output, true);
wl_signal_emit(&backend->backend.events.output_add, wl_signal_emit(&backend->backend.events.output_add,
&output->wlr_output); &output->wlr_output);
} }

View file

@ -139,7 +139,7 @@ struct wlr_output *wlr_headless_add_output(struct wlr_backend *wlr_backend,
if (backend->started) { if (backend->started) {
wl_event_source_timer_update(output->frame_timer, output->frame_delay); wl_event_source_timer_update(output->frame_timer, output->frame_delay);
wlr_output->enabled = true; wlr_output_update_enabled(wlr_output, true);
wl_signal_emit(&backend->backend.events.output_add, wlr_output); wl_signal_emit(&backend->backend.events.output_add, wlr_output);
} }

View file

@ -326,7 +326,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
} }
wl_list_insert(&backend->outputs, &output->link); wl_list_insert(&backend->outputs, &output->link);
wlr_output->enabled = true; wlr_output_update_enabled(wlr_output, true);
wl_signal_emit(&backend->backend.events.output_add, wlr_output); wl_signal_emit(&backend->backend.events.output_add, wlr_output);
return wlr_output; return wlr_output;

View file

@ -226,7 +226,7 @@ static bool wlr_x11_backend_start(struct wlr_backend *backend) {
xcb_map_window(x11->xcb_conn, output->win); xcb_map_window(x11->xcb_conn, output->win);
xcb_flush(x11->xcb_conn); xcb_flush(x11->xcb_conn);
output->wlr_output.enabled = true; wlr_output_update_enabled(&output->wlr_output, true);
wl_signal_emit(&x11->backend.events.output_add, output); wl_signal_emit(&x11->backend.events.output_add, output);
wl_signal_emit(&x11->backend.events.input_add, &x11->keyboard_dev); wl_signal_emit(&x11->backend.events.input_add, &x11->keyboard_dev);

View file

@ -89,8 +89,8 @@ struct wlr_output {
struct wlr_surface; struct wlr_surface;
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(); void wlr_output_create_global(struct wlr_output *output);
void wlr_output_destroy_global(); void wlr_output_destroy_global(struct wlr_output *output);
bool wlr_output_set_mode(struct wlr_output *output, bool wlr_output_set_mode(struct wlr_output *output,
struct wlr_output_mode *mode); struct wlr_output_mode *mode);
bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width, bool wlr_output_set_custom_mode(struct wlr_output *output, int32_t width,

View file

@ -134,6 +134,15 @@ void wlr_output_destroy_global(struct wlr_output *output) {
output->wl_global = NULL; output->wl_global = NULL;
} }
void wlr_output_update_enabled(struct wlr_output *output, bool enabled) {
if (output->enabled == enabled) {
return;
}
output->enabled = enabled;
wl_signal_emit(&output->events.enable, output);
}
static void wlr_output_update_matrix(struct wlr_output *output) { static void wlr_output_update_matrix(struct wlr_output *output) {
wlr_matrix_texture(output->transform_matrix, output->width, output->height, wlr_matrix_texture(output->transform_matrix, output->width, output->height,
output->transform); output->transform);