This repository has been archived by the owner on Jul 5, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
quirks.c
68 lines (55 loc) · 1.39 KB
/
quirks.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#include "quirks.h"
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#define LOG_MODULE "quirks"
#define LOG_ENABLE_DBG 0
#include "log.h"
#include "util.h"
static bool
is_weston(void)
{
static bool is_weston = false;
static bool initialized = false;
if (!initialized) {
initialized = true;
is_weston = getenv("WESTON_CONFIG_FILE") != NULL;
if (is_weston)
LOG_WARN("applying wl_subsurface_set_desync() workaround for weston");
}
return is_weston;
}
void
quirk_weston_subsurface_desync_on(struct wl_subsurface *sub)
{
if (!is_weston())
return;
wl_subsurface_set_desync(sub);
}
void
quirk_weston_subsurface_desync_off(struct wl_subsurface *sub)
{
if (!is_weston())
return;
wl_subsurface_set_sync(sub);
}
void
quirk_weston_csd_on(struct terminal *term)
{
if (term->window->use_csd != CSD_YES)
return;
if (term->window->is_fullscreen)
return;
for (int i = 0; i < ALEN(term->window->csd.surface); i++)
quirk_weston_subsurface_desync_on(term->window->csd.surface[i].sub);
}
void
quirk_weston_csd_off(struct terminal *term)
{
if (term->window->use_csd != CSD_YES)
return;
if (term->window->is_fullscreen)
return;
for (int i = 0; i < ALEN(term->window->csd.surface); i++)
quirk_weston_subsurface_desync_off(term->window->csd.surface[i].sub);
}