mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-29 07:58:01 -04:00
wayland: refactor: surface_scale(): pass wl_window pointer, instead of wayland global
This commit is contained in:
parent
c309c9f572
commit
d71e588800
3 changed files with 13 additions and 13 deletions
11
render.c
11
render.c
|
|
@ -1692,7 +1692,7 @@ render_overlay(struct terminal *term)
|
||||||
|
|
||||||
quirk_weston_subsurface_desync_on(overlay->sub);
|
quirk_weston_subsurface_desync_on(overlay->sub);
|
||||||
wayl_surface_scale(
|
wayl_surface_scale(
|
||||||
term->wl, &overlay->surface, buf, term->scale);
|
term->window, &overlay->surface, buf, term->scale);
|
||||||
wl_subsurface_set_position(overlay->sub, 0, 0);
|
wl_subsurface_set_position(overlay->sub, 0, 0);
|
||||||
wl_surface_attach(overlay->surface.surf, buf->wl_buf, 0, 0);
|
wl_surface_attach(overlay->surface.surf, buf->wl_buf, 0, 0);
|
||||||
|
|
||||||
|
|
@ -1831,7 +1831,7 @@ get_csd_data(const struct terminal *term, enum csd_surface surf_idx)
|
||||||
static void
|
static void
|
||||||
csd_commit(struct terminal *term, struct wayl_surface *surf, struct buffer *buf)
|
csd_commit(struct terminal *term, struct wayl_surface *surf, struct buffer *buf)
|
||||||
{
|
{
|
||||||
wayl_surface_scale(term->wl, surf, buf, term->scale);
|
wayl_surface_scale(term->window, surf, buf, term->scale);
|
||||||
wl_surface_attach(surf->surf, buf->wl_buf, 0, 0);
|
wl_surface_attach(surf->surf, buf->wl_buf, 0, 0);
|
||||||
wl_surface_damage_buffer(surf->surf, 0, 0, buf->width, buf->height);
|
wl_surface_damage_buffer(surf->surf, 0, 0, buf->width, buf->height);
|
||||||
wl_surface_commit(surf->surf);
|
wl_surface_commit(surf->surf);
|
||||||
|
|
@ -1924,7 +1924,7 @@ render_osd(struct terminal *term, const struct wayl_sub_surface *sub_surf,
|
||||||
pixman_image_set_clip_region32(buf->pix[0], NULL);
|
pixman_image_set_clip_region32(buf->pix[0], NULL);
|
||||||
|
|
||||||
quirk_weston_subsurface_desync_on(sub_surf->sub);
|
quirk_weston_subsurface_desync_on(sub_surf->sub);
|
||||||
wayl_surface_scale(term->wl, &sub_surf->surface, buf, term->scale);
|
wayl_surface_scale(term->window, &sub_surf->surface, buf, term->scale);
|
||||||
wl_surface_attach(sub_surf->surface.surf, buf->wl_buf, 0, 0);
|
wl_surface_attach(sub_surf->surface.surf, buf->wl_buf, 0, 0);
|
||||||
wl_surface_damage_buffer(sub_surf->surface.surf, 0, 0, buf->width, buf->height);
|
wl_surface_damage_buffer(sub_surf->surface.surf, 0, 0, buf->width, buf->height);
|
||||||
|
|
||||||
|
|
@ -3371,7 +3371,7 @@ render_search_box(struct terminal *term)
|
||||||
margin / term->scale,
|
margin / term->scale,
|
||||||
max(0, (int32_t)term->height - height - margin) / term->scale);
|
max(0, (int32_t)term->height - height - margin) / term->scale);
|
||||||
|
|
||||||
wayl_surface_scale(term->wl, &term->window->search.surface, buf, term->scale);
|
wayl_surface_scale(term->window, &term->window->search.surface, buf, term->scale);
|
||||||
wl_surface_attach(term->window->search.surface.surf, buf->wl_buf, 0, 0);
|
wl_surface_attach(term->window->search.surface.surf, buf->wl_buf, 0, 0);
|
||||||
wl_surface_damage_buffer(term->window->search.surface.surf, 0, 0, width, height);
|
wl_surface_damage_buffer(term->window->search.surface.surf, 0, 0, width, height);
|
||||||
|
|
||||||
|
|
@ -4265,7 +4265,8 @@ render_xcursor_update(struct seat *seat)
|
||||||
struct wl_buffer *buf = wl_cursor_image_get_buffer(image);
|
struct wl_buffer *buf = wl_cursor_image_get_buffer(image);
|
||||||
|
|
||||||
wayl_surface_scale_explicit_width_height(
|
wayl_surface_scale_explicit_width_height(
|
||||||
seat->wayl, &seat->pointer.surface, image->width, image->height, scale);
|
seat->mouse_focus->window,
|
||||||
|
&seat->pointer.surface, image->width, image->height, scale);
|
||||||
|
|
||||||
wl_surface_attach(seat->pointer.surface.surf, buf, 0, 0);
|
wl_surface_attach(seat->pointer.surface.surf, buf, 0, 0);
|
||||||
|
|
||||||
|
|
|
||||||
11
wayland.c
11
wayland.c
|
|
@ -1891,7 +1891,7 @@ wayl_fractional_scaling(const struct wayland *wayl)
|
||||||
|
|
||||||
void
|
void
|
||||||
wayl_surface_scale_explicit_width_height(
|
wayl_surface_scale_explicit_width_height(
|
||||||
const struct wayland *wayl, const struct wayl_surface *surf,
|
const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
int width, int height, float scale)
|
int width, int height, float scale)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
@ -1915,26 +1915,25 @@ wayl_surface_scale_explicit_width_height(
|
||||||
xassert(width % iscale == 0);
|
xassert(width % iscale == 0);
|
||||||
xassert(height % iscale == 0);
|
xassert(height % iscale == 0);
|
||||||
|
|
||||||
wl_surface_set_buffer_scale(surf->surf, (int)scale);
|
wl_surface_set_buffer_scale(surf->surf, iscale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wayl_surface_scale(const struct wayland *wayl, const struct wayl_surface *surf,
|
wayl_surface_scale(const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
const struct buffer *buf, float scale)
|
const struct buffer *buf, float scale)
|
||||||
{
|
{
|
||||||
wayl_surface_scale_explicit_width_height(
|
wayl_surface_scale_explicit_width_height(
|
||||||
wayl, surf, buf->width, buf->height, scale);
|
win, surf, buf->width, buf->height, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wayl_win_scale(struct wl_window *win, const struct buffer *buf)
|
wayl_win_scale(struct wl_window *win, const struct buffer *buf)
|
||||||
{
|
{
|
||||||
const struct terminal *term = win->term;
|
const struct terminal *term = win->term;
|
||||||
const struct wayland *wayl = term->wl;
|
|
||||||
const float scale = term->scale;
|
const float scale = term->scale;
|
||||||
|
|
||||||
wayl_surface_scale(wayl, &win->surface, buf, scale);
|
wayl_surface_scale(win, &win->surface, buf, scale);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
|
|
@ -456,10 +456,10 @@ void wayl_roundtrip(struct wayland *wayl);
|
||||||
|
|
||||||
bool wayl_fractional_scaling(const struct wayland *wayl);
|
bool wayl_fractional_scaling(const struct wayland *wayl);
|
||||||
void wayl_surface_scale(
|
void wayl_surface_scale(
|
||||||
const struct wayland *wayl, const struct wayl_surface *surf,
|
const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
const struct buffer *buf, float scale);
|
const struct buffer *buf, float scale);
|
||||||
void wayl_surface_scale_explicit_width_height(
|
void wayl_surface_scale_explicit_width_height(
|
||||||
const struct wayland *wayl, const struct wayl_surface *surf,
|
const struct wl_window *win, const struct wayl_surface *surf,
|
||||||
int width, int height, float scale);
|
int width, int height, float scale);
|
||||||
|
|
||||||
struct wl_window *wayl_win_init(struct terminal *term, const char *token);
|
struct wl_window *wayl_win_init(struct terminal *term, const char *token);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue