mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-21 05:33:45 -04:00
main: render_resize() scales the width and height
Thus, when we call render_resize() with *old* with/height values, we must scale them back to their original values. This fixes an issue where, for example, moving a window between outputs with different scales caused the window to keep growing.
This commit is contained in:
parent
47da5b4086
commit
fb018eb64e
1 changed files with 7 additions and 3 deletions
10
main.c
10
main.c
|
|
@ -130,8 +130,10 @@ output_scale(void *data, struct wl_output *wl_output, int32_t factor)
|
||||||
{
|
{
|
||||||
struct monitor *mon = data;
|
struct monitor *mon = data;
|
||||||
mon->scale = factor;
|
mon->scale = factor;
|
||||||
|
|
||||||
|
int old_scale = mon->term->scale >= 1 ? mon->term->scale : 1;
|
||||||
render_reload_cursor_theme(mon->term);
|
render_reload_cursor_theme(mon->term);
|
||||||
render_resize(mon->term, mon->term->width, mon->term->height);
|
render_resize(mon->term, mon->term->width / old_scale, mon->term->height / old_scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_output_listener output_listener = {
|
static const struct wl_output_listener output_listener = {
|
||||||
|
|
@ -271,8 +273,9 @@ surface_enter(void *data, struct wl_surface *wl_surface,
|
||||||
tll_push_back(term->wl.on_outputs, &it->item);
|
tll_push_back(term->wl.on_outputs, &it->item);
|
||||||
|
|
||||||
/* Resize, since scale-to-use may have changed */
|
/* Resize, since scale-to-use may have changed */
|
||||||
|
int scale = term->scale >= 1 ? term->scale : 1;
|
||||||
render_reload_cursor_theme(term);
|
render_reload_cursor_theme(term);
|
||||||
render_resize(term, term->width, term->height);
|
render_resize(term, term->width / scale, term->height / scale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -293,8 +296,9 @@ surface_leave(void *data, struct wl_surface *wl_surface,
|
||||||
tll_remove(term->wl.on_outputs, it);
|
tll_remove(term->wl.on_outputs, it);
|
||||||
|
|
||||||
/* Resize, since scale-to-use may have changed */
|
/* Resize, since scale-to-use may have changed */
|
||||||
|
int scale = term->scale >= 1 ? term->scale : 1;
|
||||||
render_reload_cursor_theme(term);
|
render_reload_cursor_theme(term);
|
||||||
render_resize(term, term->width, term->height);
|
render_resize(term, term->width / scale, term->height / scale);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue