mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-03-22 05:33:45 -04:00
quirks: add KDE quirk: surface must be damaged *after* being attached
KDE resets all surface damage when a buffer is attached. Add a quirk that adds a full-buffer damage to the surface. This quirk is intended to be called after attaching a buffer to a surface.
This commit is contained in:
parent
3a04061847
commit
b42709525c
2 changed files with 43 additions and 13 deletions
37
quirks.c
37
quirks.c
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
#define LOG_MODULE "quirks"
|
#define LOG_MODULE "quirks"
|
||||||
#define LOG_ENABLE_DBG 0
|
#define LOG_ENABLE_DBG 0
|
||||||
|
|
@ -12,19 +13,6 @@
|
||||||
static bool
|
static bool
|
||||||
is_weston(void)
|
is_weston(void)
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
* On weston (8.0), synchronized subsurfaces aren't updated
|
|
||||||
* correctly.
|
|
||||||
|
|
||||||
* They appear to render once, but after that, updates are
|
|
||||||
* sporadic. Sometimes they update, most of the time they
|
|
||||||
* don't.
|
|
||||||
*
|
|
||||||
* Adding explicit parent surface commits right after the
|
|
||||||
* subsurface commit doesn't help (and would be useless anyway,
|
|
||||||
* since it would defeat the purpose of having the subsurface
|
|
||||||
* synchronized in the first place).
|
|
||||||
*/
|
|
||||||
static bool is_weston = false;
|
static bool is_weston = false;
|
||||||
static bool initialized = false;
|
static bool initialized = false;
|
||||||
|
|
||||||
|
|
@ -79,3 +67,26 @@ quirk_weston_csd_off(struct terminal *term)
|
||||||
for (int i = 0; i < ALEN(term->window->csd.surface); i++)
|
for (int i = 0; i < ALEN(term->window->csd.surface); i++)
|
||||||
quirk_weston_subsurface_desync_off(term->window->csd.sub_surface[i]);
|
quirk_weston_subsurface_desync_off(term->window->csd.sub_surface[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
quirk_kde_damage_before_attach(struct wl_surface *surface)
|
||||||
|
{
|
||||||
|
static bool is_kde = false;
|
||||||
|
static bool initialized = false;
|
||||||
|
|
||||||
|
if (!initialized) {
|
||||||
|
initialized = true;
|
||||||
|
|
||||||
|
const char *cur_desktop = getenv("XDG_CURRENT_DESKTOP");
|
||||||
|
if (cur_desktop != NULL)
|
||||||
|
is_kde = strcasestr(cur_desktop, "kde") != NULL;
|
||||||
|
|
||||||
|
if (is_kde)
|
||||||
|
LOG_WARN("applying wl_surface_damage_buffer() workaround for KDE");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_kde)
|
||||||
|
return;
|
||||||
|
|
||||||
|
wl_surface_damage_buffer(surface, 0, 0, INT32_MAX, INT32_MAX);
|
||||||
|
}
|
||||||
|
|
|
||||||
19
quirks.h
19
quirks.h
|
|
@ -4,9 +4,28 @@
|
||||||
|
|
||||||
#include "terminal.h"
|
#include "terminal.h"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* On weston (8.0), synchronized subsurfaces aren't updated correctly.
|
||||||
|
|
||||||
|
* They appear to render once, but after that, updates are
|
||||||
|
* sporadic. Sometimes they update, most of the time they don't.
|
||||||
|
*
|
||||||
|
* Adding explicit parent surface commits right after the subsurface
|
||||||
|
* commit doesn't help (and would be useless anyway, since it would
|
||||||
|
* defeat the purpose of having the subsurface synchronized in the
|
||||||
|
* first place).
|
||||||
|
*/
|
||||||
void quirk_weston_subsurface_desync_on(struct wl_subsurface *sub);
|
void quirk_weston_subsurface_desync_on(struct wl_subsurface *sub);
|
||||||
void quirk_weston_subsurface_desync_off(struct wl_subsurface *sub);
|
void quirk_weston_subsurface_desync_off(struct wl_subsurface *sub);
|
||||||
|
|
||||||
/* Shortcuts to call desync_{on,off} on all CSD subsurfaces */
|
/* Shortcuts to call desync_{on,off} on all CSD subsurfaces */
|
||||||
void quirk_weston_csd_on(struct terminal *term);
|
void quirk_weston_csd_on(struct terminal *term);
|
||||||
void quirk_weston_csd_off(struct terminal *term);
|
void quirk_weston_csd_off(struct terminal *term);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* KDE discards all previous damage when a buffer is attached to a
|
||||||
|
* surface. Thus, if you have recorded damage before you call
|
||||||
|
* wl_surface_attach(), call this function to record a full buffer
|
||||||
|
* damage.
|
||||||
|
*/
|
||||||
|
void quirk_kde_damage_before_attach(struct wl_surface *surface);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue