minor code style changes
This commit is contained in:
parent
0cacd97e00
commit
1416d6be6c
1 changed files with 4 additions and 21 deletions
25
dam.c
25
dam.c
|
@ -204,9 +204,9 @@ bar_load_fonts(Bar *bar)
|
||||||
snprintf(fontattrs, sizeof(fontattrs), "dpi=%d", 96 * bar->scale);
|
snprintf(fontattrs, sizeof(fontattrs), "dpi=%d", 96 * bar->scale);
|
||||||
if (!(drwl_font_create(bar->drw, LENGTH(fonts), fonts, fontattrs)))
|
if (!(drwl_font_create(bar->drw, LENGTH(fonts), fonts, fontattrs)))
|
||||||
die("failed to load fonts");
|
die("failed to load fonts");
|
||||||
|
|
||||||
bar->lrpad = bar->drw->font->height;
|
bar->lrpad = bar->drw->font->height;
|
||||||
bar->height = bar->drw->font->height + 2;
|
bar->height = bar->drw->font->height + 2;
|
||||||
|
|
||||||
if (bar->layer_surface) {
|
if (bar->layer_surface) {
|
||||||
zwlr_layer_surface_v1_set_size(bar->layer_surface, 0, bar->height / bar->scale);
|
zwlr_layer_surface_v1_set_size(bar->layer_surface, 0, bar->height / bar->scale);
|
||||||
zwlr_layer_surface_v1_set_exclusive_zone(bar->layer_surface, bar->height / bar->scale);
|
zwlr_layer_surface_v1_set_exclusive_zone(bar->layer_surface, bar->height / bar->scale);
|
||||||
|
@ -283,7 +283,6 @@ frame_callback_handle_done(void *data, struct wl_callback *callback,
|
||||||
uint32_t time)
|
uint32_t time)
|
||||||
{
|
{
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
wl_callback_destroy(bar->frame_callback);
|
wl_callback_destroy(bar->frame_callback);
|
||||||
bar->frame_callback = NULL;
|
bar->frame_callback = NULL;
|
||||||
bar_draw(bar);
|
bar_draw(bar);
|
||||||
|
@ -321,7 +320,6 @@ output_status_handle_focused_tags(void *data,
|
||||||
struct zriver_output_status_v1 *output_status, uint32_t tags)
|
struct zriver_output_status_v1 *output_status, uint32_t tags)
|
||||||
{
|
{
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
bar->mtags = tags;
|
bar->mtags = tags;
|
||||||
bar_frame(bar);
|
bar_frame(bar);
|
||||||
}
|
}
|
||||||
|
@ -331,7 +329,6 @@ output_status_handle_urgent_tags(void *data,
|
||||||
struct zriver_output_status_v1 *output_status, uint32_t tags)
|
struct zriver_output_status_v1 *output_status, uint32_t tags)
|
||||||
{
|
{
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
bar->urg = tags;
|
bar->urg = tags;
|
||||||
bar_frame(bar);
|
bar_frame(bar);
|
||||||
}
|
}
|
||||||
|
@ -342,7 +339,6 @@ output_status_handle_view_tags(void *data,
|
||||||
{
|
{
|
||||||
uint32_t *vt;
|
uint32_t *vt;
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
bar->ctags = 0;
|
bar->ctags = 0;
|
||||||
wl_array_for_each(vt, wl_array)
|
wl_array_for_each(vt, wl_array)
|
||||||
bar->ctags |= *vt;
|
bar->ctags |= *vt;
|
||||||
|
@ -355,7 +351,6 @@ output_status_handle_layout_name(void *data,
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
if (bar->layout)
|
if (bar->layout)
|
||||||
free(bar->layout);
|
free(bar->layout);
|
||||||
for (i = 0; i < LENGTH(layouts); i++)
|
for (i = 0; i < LENGTH(layouts); i++)
|
||||||
|
@ -370,7 +365,6 @@ output_status_handle_layout_name_clear(void *data,
|
||||||
struct zriver_output_status_v1 *output_status)
|
struct zriver_output_status_v1 *output_status)
|
||||||
{
|
{
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
if (bar->layout)
|
if (bar->layout)
|
||||||
free(bar->layout);
|
free(bar->layout);
|
||||||
bar->layout = NULL;
|
bar->layout = NULL;
|
||||||
|
@ -421,7 +415,6 @@ layer_surface_configure(void *data, struct zwlr_layer_surface_v1 *surface,
|
||||||
|
|
||||||
if (bar->width / bar->scale == width && bar->height / bar->scale == height)
|
if (bar->width / bar->scale == width && bar->height / bar->scale == height)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bar->width = width * bar->scale;
|
bar->width = width * bar->scale;
|
||||||
bar->height = height * bar->scale;
|
bar->height = height * bar->scale;
|
||||||
bar->configured = true;
|
bar->configured = true;
|
||||||
|
@ -462,14 +455,12 @@ static void
|
||||||
bars_toggle_selected(void)
|
bars_toggle_selected(void)
|
||||||
{
|
{
|
||||||
Bar *bar;
|
Bar *bar;
|
||||||
|
wl_list_for_each(bar, &bars, link)
|
||||||
wl_list_for_each(bar, &bars, link) {
|
|
||||||
if (bar == selbar && bar->configured)
|
if (bar == selbar && bar->configured)
|
||||||
bar_hide(bar);
|
bar_hide(bar);
|
||||||
else if (bar == selbar)
|
else if (bar == selbar)
|
||||||
bar_show(bar);
|
bar_show(bar);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_handle_done(void *data, struct wl_output *wl_output)
|
output_handle_done(void *data, struct wl_output *wl_output)
|
||||||
|
@ -478,11 +469,9 @@ output_handle_done(void *data, struct wl_output *wl_output)
|
||||||
|
|
||||||
if (bar->drw)
|
if (bar->drw)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(bar->drw = drwl_create()))
|
if (!(bar->drw = drwl_create()))
|
||||||
die("failed to create drwl context");
|
die("failed to create drwl context");
|
||||||
bar_load_fonts(bar);
|
bar_load_fonts(bar);
|
||||||
|
|
||||||
bar->output_status = zriver_status_manager_v1_get_river_output_status(
|
bar->output_status = zriver_status_manager_v1_get_river_output_status(
|
||||||
status_manager, bar->wl_output);
|
status_manager, bar->wl_output);
|
||||||
zriver_output_status_v1_add_listener(bar->output_status,
|
zriver_output_status_v1_add_listener(bar->output_status,
|
||||||
|
@ -496,7 +485,6 @@ static void
|
||||||
output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor)
|
output_handle_scale(void *data, struct wl_output *wl_output, int32_t factor)
|
||||||
{
|
{
|
||||||
Bar *bar = data;
|
Bar *bar = data;
|
||||||
|
|
||||||
bar->scale = factor;
|
bar->scale = factor;
|
||||||
if (bar->drw)
|
if (bar->drw)
|
||||||
bar_load_fonts(bar);
|
bar_load_fonts(bar);
|
||||||
|
@ -531,10 +519,8 @@ seat_status_handle_unfocused_output(void *data, struct zriver_seat_status_v1 *se
|
||||||
struct wl_output *wl_output)
|
struct wl_output *wl_output)
|
||||||
{
|
{
|
||||||
Bar *oldbar;
|
Bar *oldbar;
|
||||||
|
|
||||||
if (!selbar)
|
if (!selbar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
oldbar = selbar;
|
oldbar = selbar;
|
||||||
selbar = NULL;
|
selbar = NULL;
|
||||||
bar_frame(oldbar);
|
bar_frame(oldbar);
|
||||||
|
@ -546,7 +532,6 @@ seat_status_handle_focused_view(void *data,
|
||||||
{
|
{
|
||||||
if (!selbar)
|
if (!selbar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (selbar->title)
|
if (selbar->title)
|
||||||
free(selbar->title);
|
free(selbar->title);
|
||||||
selbar->title = NULL;
|
selbar->title = NULL;
|
||||||
|
@ -579,7 +564,6 @@ pointer_motion(void *data, struct wl_pointer *wl_pointer, uint32_t time,
|
||||||
pointer.button = 0;
|
pointer.button = 0;
|
||||||
if (!selbar)
|
if (!selbar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
pointer.x = wl_fixed_to_int(surface_x) * selbar->scale;
|
pointer.x = wl_fixed_to_int(surface_x) * selbar->scale;
|
||||||
pointer.y = wl_fixed_to_int(surface_y) * selbar->scale;
|
pointer.y = wl_fixed_to_int(surface_y) * selbar->scale;
|
||||||
}
|
}
|
||||||
|
@ -689,7 +673,6 @@ static void
|
||||||
registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
|
||||||
{
|
{
|
||||||
Bar *bar, *bar_tmp;
|
Bar *bar, *bar_tmp;
|
||||||
|
|
||||||
wl_list_for_each_safe(bar, bar_tmp, &bars, link)
|
wl_list_for_each_safe(bar, bar_tmp, &bars, link)
|
||||||
if (bar->wl_name == name) {
|
if (bar->wl_name == name) {
|
||||||
bar_destroy(bar);
|
bar_destroy(bar);
|
||||||
|
@ -710,9 +693,9 @@ readstdin(void)
|
||||||
n = read(STDIN_FILENO, stext, sizeof(stext) - 1);
|
n = read(STDIN_FILENO, stext, sizeof(stext) - 1);
|
||||||
if (n < 0)
|
if (n < 0)
|
||||||
die("read:");
|
die("read:");
|
||||||
|
|
||||||
stext[n] = '\0';
|
stext[n] = '\0';
|
||||||
stext[strcspn(stext, "\n")] = '\0';
|
stext[strcspn(stext, "\n")] = '\0';
|
||||||
|
|
||||||
bars_draw();
|
bars_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -816,7 +799,6 @@ cleanup(void)
|
||||||
wl_list_for_each_safe(bar, bar_tmp, &bars, link)
|
wl_list_for_each_safe(bar, bar_tmp, &bars, link)
|
||||||
bar_destroy(bar);
|
bar_destroy(bar);
|
||||||
zriver_seat_status_v1_destroy(seat_status);
|
zriver_seat_status_v1_destroy(seat_status);
|
||||||
|
|
||||||
drwl_fini();
|
drwl_fini();
|
||||||
zriver_status_manager_v1_destroy(status_manager);
|
zriver_status_manager_v1_destroy(status_manager);
|
||||||
zriver_control_v1_destroy(control);
|
zriver_control_v1_destroy(control);
|
||||||
|
@ -867,5 +849,6 @@ main(int argc, char *argv[])
|
||||||
setup();
|
setup();
|
||||||
run();
|
run();
|
||||||
cleanup();
|
cleanup();
|
||||||
|
|
||||||
return EXIT_SUCCESS;
|
return EXIT_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue