mirror of
https://codeberg.org/dnkl/yambar.git
synced 2025-06-21 09:55:39 +02:00
Pre-expose modules
~ Attempt to pre expose modules to calculate proper width/height ~ Doesn't really work, but also doesn't segfault, so a win in my book
This commit is contained in:
parent
0b6a38fa8f
commit
033f21a1f2
3 changed files with 114 additions and 54 deletions
|
@ -1044,13 +1044,16 @@ update_size(struct wayland_backend *backend)
|
|||
|
||||
backend->scale = scale;
|
||||
|
||||
int height = bar->height;
|
||||
bar->height = height - bar->border.top_width - bar->border.bottom_width;
|
||||
bar->height_with_border = height;
|
||||
int height = bar->height < 0 ? 0 : bar->height_with_border;
|
||||
int width = bar->width < 0 ? 0 : bar->width_with_border;
|
||||
|
||||
LOG_INFO("Attempting to set %dx%d", width, height);
|
||||
|
||||
// TODO: Somehow set up width and height properly
|
||||
// I need to read more to understand how bar->width and bar->height are used
|
||||
zwlr_layer_surface_v1_set_size(backend->layer_surface, width / scale, height / scale);
|
||||
|
||||
if (bar->location == BAR_TOP || bar->location == BAR_BOTTOM) {
|
||||
zwlr_layer_surface_v1_set_size(
|
||||
backend->layer_surface, 0, bar->height_with_border / scale);
|
||||
zwlr_layer_surface_v1_set_exclusive_zone(
|
||||
backend->layer_surface,
|
||||
(bar->height_with_border + (bar->location == BAR_TOP
|
||||
|
@ -1058,8 +1061,6 @@ update_size(struct wayland_backend *backend)
|
|||
: bar->border.top_margin))
|
||||
/ scale);
|
||||
} else {
|
||||
zwlr_layer_surface_v1_set_size(
|
||||
backend->layer_surface, bar->width_with_border / scale, 0);
|
||||
zwlr_layer_surface_v1_set_exclusive_zone(
|
||||
backend->layer_surface,
|
||||
(bar->width_with_border + (bar->location == BAR_LEFT
|
||||
|
@ -1085,9 +1086,6 @@ update_size(struct wayland_backend *backend)
|
|||
return false;
|
||||
}
|
||||
|
||||
bar->width = backend->width;
|
||||
bar->height = backend->height;
|
||||
|
||||
/* Reload buffers */
|
||||
if (backend->next_buffer != NULL)
|
||||
backend->next_buffer->busy = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue