mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
wayland: drop ‘_surface’ suffix from subsurface struct instances
This commit is contained in:
parent
438853a2d8
commit
5c8579043d
5 changed files with 42 additions and 43 deletions
42
render.c
42
render.c
|
|
@ -1778,20 +1778,20 @@ render_scrollback_position(struct terminal *term)
|
|||
struct wl_window *win = term->window;
|
||||
|
||||
if (term->grid->view == term->grid->offset) {
|
||||
if (win->scrollback_indicator_surface.surf != NULL)
|
||||
wayl_win_subsurface_destroy(&win->scrollback_indicator_surface);
|
||||
if (win->scrollback_indicator.surf != NULL)
|
||||
wayl_win_subsurface_destroy(&win->scrollback_indicator);
|
||||
return;
|
||||
}
|
||||
|
||||
if (win->scrollback_indicator_surface.surf == NULL) {
|
||||
if (!wayl_win_subsurface_new(win, &win->scrollback_indicator_surface)) {
|
||||
if (win->scrollback_indicator.surf == NULL) {
|
||||
if (!wayl_win_subsurface_new(win, &win->scrollback_indicator)) {
|
||||
LOG_ERR("failed to create scrollback indicator surface");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
xassert(win->scrollback_indicator_surface.surf != NULL);
|
||||
xassert(win->scrollback_indicator_surface.sub != NULL);
|
||||
xassert(win->scrollback_indicator.surf != NULL);
|
||||
xassert(win->scrollback_indicator.sub != NULL);
|
||||
|
||||
/* Find absolute row number of the scrollback start */
|
||||
int scrollback_start = term->grid->offset + term->rows;
|
||||
|
|
@ -1879,14 +1879,14 @@ render_scrollback_position(struct terminal *term)
|
|||
}
|
||||
|
||||
wl_subsurface_set_position(
|
||||
win->scrollback_indicator_surface.sub,
|
||||
win->scrollback_indicator.sub,
|
||||
(term->width - margin - width) / scale,
|
||||
(term->margins.top + surf_top) / scale);
|
||||
|
||||
render_osd(
|
||||
term,
|
||||
win->scrollback_indicator_surface.surf,
|
||||
win->scrollback_indicator_surface.sub,
|
||||
win->scrollback_indicator.surf,
|
||||
win->scrollback_indicator.sub,
|
||||
buf, text,
|
||||
term->colors.table[0], term->colors.table[8 + 4],
|
||||
width, height, width - margin - wcslen(text) * term->cell_width, margin);
|
||||
|
|
@ -1912,14 +1912,14 @@ render_render_timer(struct terminal *term, struct timeval render_time)
|
|||
term->wl->shm, width, height, cookie, false, 1);
|
||||
|
||||
wl_subsurface_set_position(
|
||||
win->render_timer_surface.sub,
|
||||
win->render_timer.sub,
|
||||
margin / term->scale,
|
||||
(term->margins.top + term->cell_height - margin) / term->scale);
|
||||
|
||||
render_osd(
|
||||
term,
|
||||
win->render_timer_surface.surf,
|
||||
win->render_timer_surface.sub,
|
||||
win->render_timer.surf,
|
||||
win->render_timer.sub,
|
||||
buf, text,
|
||||
term->colors.table[0], term->colors.table[8 + 1],
|
||||
width, height, margin, margin);
|
||||
|
|
@ -2208,7 +2208,7 @@ grid_render(struct terminal *term)
|
|||
static void
|
||||
render_search_box(struct terminal *term)
|
||||
{
|
||||
xassert(term->window->search_surface.sub != NULL);
|
||||
xassert(term->window->search.sub != NULL);
|
||||
|
||||
/*
|
||||
* We treat the search box pretty much like a row of cells. That
|
||||
|
|
@ -2481,27 +2481,27 @@ render_search_box(struct terminal *term)
|
|||
term, WINDOW_X(x), WINDOW_Y(y), 1, term->cell_height);
|
||||
}
|
||||
|
||||
quirk_weston_subsurface_desync_on(term->window->search_surface.sub);
|
||||
quirk_weston_subsurface_desync_on(term->window->search.sub);
|
||||
|
||||
/* TODO: this is only necessary on a window resize */
|
||||
wl_subsurface_set_position(
|
||||
term->window->search_surface.sub,
|
||||
term->window->search.sub,
|
||||
margin / scale,
|
||||
max(0, (int32_t)term->height - height - margin) / scale);
|
||||
|
||||
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_set_buffer_scale(term->window->search_surface.surf, scale);
|
||||
wl_surface_attach(term->window->search.surf, buf->wl_buf, 0, 0);
|
||||
wl_surface_damage_buffer(term->window->search.surf, 0, 0, width, height);
|
||||
wl_surface_set_buffer_scale(term->window->search.surf, scale);
|
||||
|
||||
struct wl_region *region = wl_compositor_create_region(term->wl->compositor);
|
||||
if (region != NULL) {
|
||||
wl_region_add(region, width - visible_width, 0, visible_width, height);
|
||||
wl_surface_set_opaque_region(term->window->search_surface.surf, region);
|
||||
wl_surface_set_opaque_region(term->window->search.surf, region);
|
||||
wl_region_destroy(region);
|
||||
}
|
||||
|
||||
wl_surface_commit(term->window->search_surface.surf);
|
||||
quirk_weston_subsurface_desync_off(term->window->search_surface.sub);
|
||||
wl_surface_commit(term->window->search.surf);
|
||||
quirk_weston_subsurface_desync_off(term->window->search.sub);
|
||||
|
||||
#if defined(FOOT_IME_ENABLED) && FOOT_IME_ENABLED
|
||||
free(text);
|
||||
|
|
|
|||
5
search.c
5
search.c
|
|
@ -81,7 +81,7 @@ static void
|
|||
search_cancel_keep_selection(struct terminal *term)
|
||||
{
|
||||
struct wl_window *win = term->window;
|
||||
wayl_win_subsurface_destroy(&win->search_surface);
|
||||
wayl_win_subsurface_destroy(&win->search);
|
||||
|
||||
free(term->search.buf);
|
||||
term->search.buf = NULL;
|
||||
|
|
@ -118,8 +118,7 @@ search_begin(struct terminal *term)
|
|||
}
|
||||
|
||||
/* On-demand instantiate wayland surface */
|
||||
bool ret = wayl_win_subsurface_new(
|
||||
term->window, &term->window->search_surface);
|
||||
bool ret = wayl_win_subsurface_new(term->window, &term->window->search);
|
||||
xassert(ret);
|
||||
|
||||
term->search.original_view = term->grid->view;
|
||||
|
|
|
|||
|
|
@ -2821,11 +2821,11 @@ term_surface_kind(const struct terminal *term, const struct wl_surface *surface)
|
|||
{
|
||||
if (likely(surface == term->window->surface))
|
||||
return TERM_SURF_GRID;
|
||||
else if (surface == term->window->search_surface.surf)
|
||||
else if (surface == term->window->search.surf)
|
||||
return TERM_SURF_SEARCH;
|
||||
else if (surface == term->window->scrollback_indicator_surface.surf)
|
||||
else if (surface == term->window->scrollback_indicator.surf)
|
||||
return TERM_SURF_SCROLLBACK_INDICATOR;
|
||||
else if (surface == term->window->render_timer_surface.surf)
|
||||
else if (surface == term->window->render_timer.surf)
|
||||
return TERM_SURF_RENDER_TIMER;
|
||||
else if (surface == term->window->csd.surface[CSD_SURF_TITLE].surf)
|
||||
return TERM_SURF_TITLE;
|
||||
|
|
|
|||
26
wayland.c
26
wayland.c
|
|
@ -1367,7 +1367,7 @@ wayl_win_init(struct terminal *term)
|
|||
wl_surface_commit(win->surface);
|
||||
|
||||
if (conf->tweak.render_timer_osd) {
|
||||
if (!wayl_win_subsurface_new(win, &win->render_timer_surface)) {
|
||||
if (!wayl_win_subsurface_new(win, &win->render_timer)) {
|
||||
LOG_ERR("failed to create render timer surface");
|
||||
goto out;
|
||||
}
|
||||
|
|
@ -1398,20 +1398,20 @@ wayl_win_destroy(struct wl_window *win)
|
|||
* nor mouse focus).
|
||||
*/
|
||||
|
||||
if (win->render_timer_surface.surf != NULL) {
|
||||
wl_surface_attach(win->render_timer_surface.surf, NULL, 0, 0);
|
||||
wl_surface_commit(win->render_timer_surface.surf);
|
||||
if (win->render_timer.surf != NULL) {
|
||||
wl_surface_attach(win->render_timer.surf, NULL, 0, 0);
|
||||
wl_surface_commit(win->render_timer.surf);
|
||||
}
|
||||
|
||||
if (win->scrollback_indicator_surface.surf != NULL) {
|
||||
wl_surface_attach(win->scrollback_indicator_surface.surf, NULL, 0, 0);
|
||||
wl_surface_commit(win->scrollback_indicator_surface.surf);
|
||||
if (win->scrollback_indicator.surf != NULL) {
|
||||
wl_surface_attach(win->scrollback_indicator.surf, NULL, 0, 0);
|
||||
wl_surface_commit(win->scrollback_indicator.surf);
|
||||
}
|
||||
|
||||
/* Scrollback search */
|
||||
if (win->search_surface.surf != NULL) {
|
||||
wl_surface_attach(win->search_surface.surf, NULL, 0, 0);
|
||||
wl_surface_commit(win->search_surface.surf);
|
||||
if (win->search.surf != NULL) {
|
||||
wl_surface_attach(win->search.surf, NULL, 0, 0);
|
||||
wl_surface_commit(win->search.surf);
|
||||
}
|
||||
|
||||
/* CSD */
|
||||
|
|
@ -1437,9 +1437,9 @@ wayl_win_destroy(struct wl_window *win)
|
|||
}
|
||||
|
||||
csd_destroy(win);
|
||||
wayl_win_subsurface_destroy(&win->search_surface);
|
||||
wayl_win_subsurface_destroy(&win->scrollback_indicator_surface);
|
||||
wayl_win_subsurface_destroy(&win->render_timer_surface);
|
||||
wayl_win_subsurface_destroy(&win->search);
|
||||
wayl_win_subsurface_destroy(&win->scrollback_indicator);
|
||||
wayl_win_subsurface_destroy(&win->render_timer);
|
||||
|
||||
if (win->frame_callback != NULL)
|
||||
wl_callback_destroy(win->frame_callback);
|
||||
|
|
|
|||
|
|
@ -377,9 +377,9 @@ struct wl_window {
|
|||
uint32_t serial;
|
||||
} csd;
|
||||
|
||||
struct wl_surf_subsurf search_surface;
|
||||
struct wl_surf_subsurf scrollback_indicator_surface;
|
||||
struct wl_surf_subsurf render_timer_surface;
|
||||
struct wl_surf_subsurf search;
|
||||
struct wl_surf_subsurf scrollback_indicator;
|
||||
struct wl_surf_subsurf render_timer;
|
||||
|
||||
struct wl_callback *frame_callback;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue