mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-14 05:33:59 -04:00
search: enable/disable weston sub-surface desync quirk when rendering search box
This commit is contained in:
parent
a29427a185
commit
b6f8a2e422
5 changed files with 26 additions and 6 deletions
|
|
@ -112,6 +112,7 @@ executable(
|
||||||
'main.c',
|
'main.c',
|
||||||
'misc.c', 'misc.h',
|
'misc.c', 'misc.h',
|
||||||
'osc.c', 'osc.h',
|
'osc.c', 'osc.h',
|
||||||
|
'quirks.c', 'quirks.h',
|
||||||
'render.c', 'render.h',
|
'render.c', 'render.h',
|
||||||
'search.c', 'search.h',
|
'search.c', 'search.h',
|
||||||
'selection.c', 'selection.h',
|
'selection.c', 'selection.h',
|
||||||
|
|
|
||||||
22
quirks.c
22
quirks.c
|
|
@ -3,8 +3,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
void
|
static bool
|
||||||
quirk_weston_subsurface_desync(struct wl_subsurface *sub)
|
is_weston(void)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* On weston (8.0), synchronized subsurfaces aren't updated
|
* On weston (8.0), synchronized subsurfaces aren't updated
|
||||||
|
|
@ -19,7 +19,6 @@ quirk_weston_subsurface_desync(struct wl_subsurface *sub)
|
||||||
* since it would defeat the purpose of having the subsurface
|
* since it would defeat the purpose of having the subsurface
|
||||||
* synchronized in the first place).
|
* synchronized in the first place).
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static bool is_weston = false;
|
static bool is_weston = false;
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
|
||||||
|
|
@ -28,8 +27,23 @@ quirk_weston_subsurface_desync(struct wl_subsurface *sub)
|
||||||
is_weston = getenv("WESTON_CONFIG_FILE") != NULL;
|
is_weston = getenv("WESTON_CONFIG_FILE") != NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_weston)
|
return is_weston;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
quirk_weston_subsurface_desync_on(struct wl_subsurface *sub)
|
||||||
|
{
|
||||||
|
if (!is_weston())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wl_subsurface_set_desync(sub);
|
wl_subsurface_set_desync(sub);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
quirk_weston_subsurface_desync_off(struct wl_subsurface *sub)
|
||||||
|
{
|
||||||
|
if (!is_weston())
|
||||||
|
return;
|
||||||
|
|
||||||
|
wl_subsurface_set_sync(sub);
|
||||||
|
}
|
||||||
|
|
|
||||||
3
quirks.h
3
quirks.h
|
|
@ -2,4 +2,5 @@
|
||||||
|
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
|
|
||||||
void quirk_weston_subsurface_desync(struct wl_subsurface *sub);
|
void quirk_weston_subsurface_desync_on(struct wl_subsurface *sub);
|
||||||
|
void quirk_weston_subsurface_desync_off(struct wl_subsurface *sub);
|
||||||
|
|
|
||||||
4
render.c
4
render.c
|
|
@ -18,6 +18,7 @@
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "grid.h"
|
#include "grid.h"
|
||||||
|
#include "quirks.h"
|
||||||
#include "selection.h"
|
#include "selection.h"
|
||||||
#include "shm.h"
|
#include "shm.h"
|
||||||
|
|
||||||
|
|
@ -1211,6 +1212,8 @@ render_search_box(struct terminal *term)
|
||||||
if (term->search.cursor >= term->search.len)
|
if (term->search.cursor >= term->search.len)
|
||||||
draw_bar(term, buf->pix, font, &fg, x, y);
|
draw_bar(term, buf->pix, font, &fg, x, y);
|
||||||
|
|
||||||
|
quirk_weston_subsurface_desync_on(term->window->search_sub_surface);
|
||||||
|
|
||||||
/* TODO: this is only necessary on a window resize */
|
/* TODO: this is only necessary on a window resize */
|
||||||
wl_subsurface_set_position(
|
wl_subsurface_set_position(
|
||||||
term->window->search_sub_surface,
|
term->window->search_sub_surface,
|
||||||
|
|
@ -1229,6 +1232,7 @@ render_search_box(struct terminal *term)
|
||||||
}
|
}
|
||||||
|
|
||||||
wl_surface_commit(term->window->search_surface);
|
wl_surface_commit(term->window->search_surface);
|
||||||
|
quirk_weston_subsurface_desync_off(term->window->search_sub_surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Move to terminal.c? */
|
/* Move to terminal.c? */
|
||||||
|
|
|
||||||
2
search.c
2
search.c
|
|
@ -79,12 +79,12 @@ search_begin(struct terminal *term)
|
||||||
|
|
||||||
win->search_sub_surface = wl_subcompositor_get_subsurface(
|
win->search_sub_surface = wl_subcompositor_get_subsurface(
|
||||||
wayl->sub_compositor, win->search_surface, win->surface);
|
wayl->sub_compositor, win->search_surface, win->surface);
|
||||||
wl_subsurface_set_desync(win->search_sub_surface);
|
|
||||||
|
|
||||||
struct wl_region *region = wl_compositor_create_region(term->wl->compositor);
|
struct wl_region *region = wl_compositor_create_region(term->wl->compositor);
|
||||||
wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX);
|
wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX);
|
||||||
wl_surface_set_opaque_region(win->search_surface, region);
|
wl_surface_set_opaque_region(win->search_surface, region);
|
||||||
wl_region_destroy(region);
|
wl_region_destroy(region);
|
||||||
|
wl_subsurface_set_sync(win->search_sub_surface);
|
||||||
|
|
||||||
term->search.original_view = term->grid->view;
|
term->search.original_view = term->grid->view;
|
||||||
term->search.view_followed_offset = term->grid->view == term->grid->offset;
|
term->search.view_followed_offset = term->grid->view == term->grid->offset;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue