forked from external/yambar
bar: wayland: update bar size + refresh in output_done()
This ensures the bar's size (width) is updated when the screen resolution (and/or scale) is changed. Note that we already handled scale changes. This logic has been moved from output_scale() to output_done(). Closes #330
This commit is contained in:
parent
9365580539
commit
cdee55afed
2 changed files with 17 additions and 14 deletions
|
@ -31,9 +31,12 @@
|
||||||
* map: conditions failing to match when they contain multiple, quoted
|
* map: conditions failing to match when they contain multiple, quoted
|
||||||
tag values ([#302][302]).
|
tag values ([#302][302]).
|
||||||
* Crash when hidden by an opaque window.
|
* Crash when hidden by an opaque window.
|
||||||
|
* Bar not resizing itself when the screen resolution is changed
|
||||||
|
([#330][330]).
|
||||||
|
|
||||||
[311]: https://codeberg.org/dnkl/yambar/issues/311
|
[311]: https://codeberg.org/dnkl/yambar/issues/311
|
||||||
[302]: https://codeberg.org/dnkl/yambar/issues/302
|
[302]: https://codeberg.org/dnkl/yambar/issues/302
|
||||||
|
[330]: https://codeberg.org/dnkl/yambar/issues/330
|
||||||
|
|
||||||
|
|
||||||
### Security
|
### Security
|
||||||
|
|
|
@ -475,13 +475,24 @@ output_mode(void *data, struct wl_output *wl_output, uint32_t flags,
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool update_size(struct wayland_backend *backend);
|
||||||
|
static void refresh(const struct bar *_bar);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_done(void *data, struct wl_output *wl_output)
|
output_done(void *data, struct wl_output *wl_output)
|
||||||
{
|
{
|
||||||
}
|
struct monitor *mon = data;
|
||||||
|
|
||||||
static bool update_size(struct wayland_backend *backend);
|
if (mon->backend->monitor == mon) {
|
||||||
static void refresh(const struct bar *_bar);
|
int old_scale = mon->backend->scale;
|
||||||
|
int old_width = mon->backend->width;
|
||||||
|
|
||||||
|
update_size(mon->backend);
|
||||||
|
|
||||||
|
if (mon->backend->scale != old_scale || mon->backend->width != old_width)
|
||||||
|
refresh(mon->backend->bar);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
output_scale(void *data, struct wl_output *wl_output, int32_t factor)
|
output_scale(void *data, struct wl_output *wl_output, int32_t factor)
|
||||||
|
@ -491,14 +502,6 @@ output_scale(void *data, struct wl_output *wl_output, int32_t factor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
mon->scale = factor;
|
mon->scale = factor;
|
||||||
|
|
||||||
if (mon->backend->monitor == mon) {
|
|
||||||
int old_scale = mon->backend->scale;
|
|
||||||
update_size(mon->backend);
|
|
||||||
|
|
||||||
if (mon->backend->scale != old_scale)
|
|
||||||
refresh(mon->backend->bar);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(WL_OUTPUT_NAME_SINCE_VERSION)
|
#if defined(WL_OUTPUT_NAME_SINCE_VERSION)
|
||||||
|
@ -1058,9 +1061,6 @@ update_size(struct wayland_backend *backend)
|
||||||
|
|
||||||
assert(backend->surface != NULL);
|
assert(backend->surface != NULL);
|
||||||
|
|
||||||
if (backend->scale == scale)
|
|
||||||
return true;
|
|
||||||
|
|
||||||
backend->scale = scale;
|
backend->scale = scale;
|
||||||
|
|
||||||
int height = bar->height_with_border;
|
int height = bar->height_with_border;
|
||||||
|
|
Loading…
Add table
Reference in a new issue