diff options
Diffstat (limited to 'src/output.c')
-rw-r--r-- | src/output.c | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/src/output.c b/src/output.c index a6980ae..708c98f 100644 --- a/src/output.c +++ b/src/output.c @@ -25,7 +25,7 @@ static void output_handle_scale (void *data, struct wl_output *wl_output, { struct Wlclock_output *output = (struct Wlclock_output *)data; output->scale = (uint32_t)factor; - clocklog(output->clock, 1, "[output] Property update: global_name=%d scale=%d\n", + clocklog(1, "[output] Property update: global_name=%d scale=%d\n", output->global_name, output->scale); } @@ -36,8 +36,7 @@ static void output_update_surface (struct Wlclock_output *output) if ( output->surface == NULL ) { - struct Wlclock *clock = output->clock; - if ( clock->output == NULL || ! strcmp(clock->output, output->name) ) + if ( context.output == NULL || ! strcmp(context.output, output->name) ) create_surface(output); } else @@ -50,7 +49,7 @@ static void output_handle_done (void *data, struct wl_output *wl_output) * and by xdg_output) have been advertised by preceding events. */ struct Wlclock_output *output = (struct Wlclock_output *)data; - clocklog(output->clock, 1, "[output] Atomic update complete: global_name=%d\n", + clocklog(1, "[output] Atomic update complete: global_name=%d\n", output->global_name); output_update_surface(output); } @@ -67,7 +66,7 @@ static void xdg_output_handle_name (void *data, struct zxdg_output_v1 *xdg_outpu { struct Wlclock_output *output = (struct Wlclock_output *)data; set_string(&output->name, (char *)name); - clocklog(output->clock, 1, "[output] Property update: global_name=%d name=%s\n", + clocklog(1, "[output] Property update: global_name=%d name=%s\n", output->global_name, name); } @@ -83,14 +82,13 @@ static const struct zxdg_output_v1_listener xdg_output_listener = { bool configure_output (struct Wlclock_output *output) { - struct Wlclock *clock = output->clock; - clocklog(clock, 1, "[output] Configuring: global_name=%d\n", output->global_name); + 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( - clock->xdg_output_manager, output->wl_output)) ) + context.xdg_output_manager, output->wl_output)) ) { - clocklog(NULL, 0, "ERROR: Could not get XDG output.\n"); + clocklog(0, "ERROR: Could not get XDG output.\n"); return false; } @@ -99,10 +97,10 @@ bool configure_output (struct Wlclock_output *output) return true; } -bool create_output (struct Wlclock *clock, struct wl_registry *registry, - uint32_t name, const char *interface, uint32_t version) +bool create_output (struct wl_registry *registry, uint32_t name, + const char *interface, uint32_t version) { - clocklog(clock, 1, "[output] Creating: global_name=%d\n", name); + clocklog(1, "[output] Creating: global_name=%d\n", name); struct wl_output *wl_output = wl_registry_bind(registry, name, &wl_output_interface, 3); @@ -111,18 +109,17 @@ bool create_output (struct Wlclock *clock, struct wl_registry *registry, struct Wlclock_output *output = calloc(1, sizeof(struct Wlclock_output)); if ( output == NULL ) { - clocklog(NULL, 0, "ERROR: Could not allocate.\n"); + clocklog(0, "ERROR: Could not allocate.\n"); return false; } - output->clock = clock; output->global_name = name; output->scale = 1; output->wl_output = wl_output; output->configured = false; output->name = NULL; - wl_list_insert(&clock->outputs, &output->link); + wl_list_insert(&context.outputs, &output->link); wl_output_set_user_data(wl_output, output); wl_output_add_listener(wl_output, &output_listener, output); @@ -130,21 +127,21 @@ bool create_output (struct Wlclock *clock, struct wl_registry *registry, * the layer_shell. If either one is not available yet, we have to * configure the output later (see init_wayland()). */ - if ( clock->xdg_output_manager != NULL && clock->layer_shell != NULL ) + if ( context.xdg_output_manager != NULL && context.layer_shell != NULL ) { if (! configure_output(output)) return false; } else - clocklog(clock, 2, "[output] Not yet configureable.\n"); + clocklog(2, "[output] Not yet configureable.\n"); return true; } -struct Wlclock_output *get_output_from_global_name (struct Wlclock *clock, uint32_t name) +struct Wlclock_output *get_output_from_global_name (uint32_t name) { struct Wlclock_output *op; - wl_list_for_each(op, &clock->outputs, link) + wl_list_for_each(op, &context.outputs, link) if ( op->global_name == name ) return op; return NULL; @@ -161,11 +158,11 @@ void destroy_output (struct Wlclock_output *output) free(output); } -void destroy_all_outputs (struct Wlclock *clock) +void destroy_all_outputs (void) { - clocklog(clock, 1, "[output] Destroying all outputs.\n"); + clocklog(1, "[output] Destroying all outputs.\n"); struct Wlclock_output *op, *tmp; - wl_list_for_each_safe(op, tmp, &clock->outputs, link) + wl_list_for_each_safe(op, tmp, &context.outputs, link) destroy_output(op); } |