2020-03-01 12:54:27 +01:00
|
|
|
#include "quirks.h"
|
|
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <stdbool.h>
|
2020-03-24 17:44:17 +01:00
|
|
|
#include <string.h>
|
2020-03-01 12:54:27 +01:00
|
|
|
|
2020-03-02 18:47:04 +01:00
|
|
|
#define LOG_MODULE "quirks"
|
|
|
|
|
#define LOG_ENABLE_DBG 0
|
|
|
|
|
#include "log.h"
|
2020-05-01 11:46:24 +02:00
|
|
|
#include "util.h"
|
2020-03-03 18:19:47 +01:00
|
|
|
|
2020-03-01 13:06:00 +01:00
|
|
|
static bool
|
|
|
|
|
is_weston(void)
|
2020-03-01 12:54:27 +01:00
|
|
|
{
|
|
|
|
|
static bool is_weston = false;
|
|
|
|
|
static bool initialized = false;
|
|
|
|
|
|
|
|
|
|
if (!initialized) {
|
|
|
|
|
initialized = true;
|
|
|
|
|
is_weston = getenv("WESTON_CONFIG_FILE") != NULL;
|
2020-03-02 18:47:04 +01:00
|
|
|
if (is_weston)
|
|
|
|
|
LOG_WARN("applying wl_subsurface_set_desync() workaround for weston");
|
2020-03-01 12:54:27 +01:00
|
|
|
}
|
|
|
|
|
|
2020-03-01 13:06:00 +01:00
|
|
|
return is_weston;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
quirk_weston_subsurface_desync_on(struct wl_subsurface *sub)
|
|
|
|
|
{
|
|
|
|
|
if (!is_weston())
|
2020-03-01 12:54:27 +01:00
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
wl_subsurface_set_desync(sub);
|
|
|
|
|
}
|
2020-03-01 13:06:00 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
quirk_weston_subsurface_desync_off(struct wl_subsurface *sub)
|
|
|
|
|
{
|
|
|
|
|
if (!is_weston())
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
wl_subsurface_set_sync(sub);
|
|
|
|
|
}
|
2020-03-03 18:19:47 +01:00
|
|
|
|
|
|
|
|
void
|
|
|
|
|
quirk_weston_csd_on(struct terminal *term)
|
|
|
|
|
{
|
2021-06-22 18:58:38 +02:00
|
|
|
if (term->window->csd_mode != CSD_YES)
|
2020-03-03 18:19:47 +01:00
|
|
|
return;
|
2020-03-12 09:31:25 +01:00
|
|
|
if (term->window->is_fullscreen)
|
|
|
|
|
return;
|
2020-03-03 18:19:47 +01:00
|
|
|
|
|
|
|
|
for (int i = 0; i < ALEN(term->window->csd.surface); i++)
|
2021-02-12 11:39:25 +01:00
|
|
|
quirk_weston_subsurface_desync_on(term->window->csd.surface[i].sub);
|
2020-03-03 18:19:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
|
quirk_weston_csd_off(struct terminal *term)
|
|
|
|
|
{
|
2021-06-22 18:58:38 +02:00
|
|
|
if (term->window->csd_mode != CSD_YES)
|
2020-03-03 18:19:47 +01:00
|
|
|
return;
|
2020-03-12 09:31:25 +01:00
|
|
|
if (term->window->is_fullscreen)
|
|
|
|
|
return;
|
2020-03-03 18:19:47 +01:00
|
|
|
|
|
|
|
|
for (int i = 0; i < ALEN(term->window->csd.surface); i++)
|
2021-02-12 11:39:25 +01:00
|
|
|
quirk_weston_subsurface_desync_off(term->window->csd.surface[i].sub);
|
2020-03-03 18:19:47 +01:00
|
|
|
}
|