diff options
Diffstat (limited to 'src/output.c')
-rw-r--r-- | src/output.c | 25 |
1 files changed, 13 insertions, 12 deletions
diff --git a/src/output.c b/src/output.c index b2b4d0e..74088a9 100644 --- a/src/output.c +++ b/src/output.c @@ -43,13 +43,19 @@ static void output_handle_done (void *data, struct wl_output *wl_output) return; if ( output->surface == NULL ) { + /* We create the surface here, because we (sometimes) need to + * know the output name to decide whether an output gets a clock + * or not. This works both for outputs advertised during the + * initial registry dump and outputs added later. + */ if ( context.output == NULL || ! strcmp(context.output, output->name) ) create_surface(output); } - else + else if (output->surface->configured) { - if (! output->surface->configured) - return; + /* If we already have a clock on an output, it might need a new + * frame, for example if the outputs scale changed. + */ render_background_frame(output->surface); render_hands_frame(output->surface); wl_surface_commit(output->surface->hands_surface); @@ -74,6 +80,8 @@ static void xdg_output_handle_name (void *data, struct zxdg_output_v1 *xdg_outpu } static const struct zxdg_output_v1_listener xdg_output_listener = { + // TODO Remove XDG-Output dependency. The next Wayland version includes + // the name event in regular wl_output. .name = xdg_output_handle_name, .logical_size = noop, .logical_position = noop, @@ -86,15 +94,8 @@ static const struct zxdg_output_v1_listener xdg_output_listener = { bool configure_output (struct Wlclock_output *output) { clocklog(1, "[output] Configuring: global_name=%d\n", output->global_name); - - /* Create xdg_output and attach listeners. */ - if ( NULL == (output->xdg_output = zxdg_output_manager_v1_get_xdg_output( - context.xdg_output_manager, output->wl_output)) ) - { - clocklog(0, "ERROR: Could not get XDG output.\n"); - return false; - } - + output->xdg_output = zxdg_output_manager_v1_get_xdg_output( + context.xdg_output_manager, output->wl_output); zxdg_output_v1_add_listener(output->xdg_output, &xdg_output_listener, output); output->configured = true; return true; |