aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-02-12 11:00:40 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-02-17 20:48:08 +0000
commit5c8579043dd22a08e872d90a20011f5d6d8d3dc1 (patch)
tree1f0a4b0ab0bdbd636e650ef672ec82bba2873141
parentrender-timer: use wayl_win_subsurface_new/destroy() (diff)
wayland: drop ‘_surface’ suffix from subsurface struct instances
-rw-r--r--render.c42
-rw-r--r--search.c5
-rw-r--r--terminal.c6
-rw-r--r--wayland.c26
-rw-r--r--wayland.h6
5 files changed, 42 insertions, 43 deletions
diff --git a/render.c b/render.c
index 09c1b87f..aaa106a3 100644
--- a/render.c
+++ b/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);
diff --git a/search.c b/search.c
index 75a083d5..5dfa7b58 100644
--- a/search.c
+++ b/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;
diff --git a/terminal.c b/terminal.c
index 2ff02783..0051ca6d 100644
--- a/terminal.c
+++ b/terminal.c
@@ -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;
diff --git a/wayland.c b/wayland.c
index d8968ab6..85dc08e6 100644
--- a/wayland.c
+++ b/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);
diff --git a/wayland.h b/wayland.h
index 4b146d57..b2d7c64f 100644
--- a/wayland.h
+++ b/wayland.h
@@ -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;