Skip to content

Commit 609fa14

Browse files
Wayland: use a single, common stub listener
1 parent 7d6f92a commit 609fa14

File tree

1 file changed

+17
-9
lines changed

1 file changed

+17
-9
lines changed

src/detection/displayserver/wayland.c

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ static void waylandDetectWM(int fd, FFDisplayServerResult* result)
3636
ffStrbufDestroy(&procPath);
3737
}
3838

39-
static void waylandOutputGeometryListener(void* data, struct wl_output* wl_output, int32_t x, int32_t y, int32_t physical_width, int32_t physical_height, int32_t subpixel, const char* make, const char* model, int32_t transform)
39+
static void stubListener(void* data, ...)
4040
{
41-
FF_UNUSED(data, wl_output, x, y, physical_width, physical_height, subpixel, make, model, transform);
41+
(void) data;
4242
}
4343

4444
static void waylandOutputModeListener(void* data, struct wl_output* output, uint32_t flags, int32_t width, int32_t height, int32_t refreshRate)
@@ -62,10 +62,6 @@ static void waylandOutputModeListener(void* data, struct wl_output* output, uint
6262
result->refreshRate = ffdsParseRefreshRate(refreshRate / 1000);
6363
}
6464

65-
static void waylandGlobalRemoveListener(void* data, struct wl_registry* wl_registry, uint32_t name){
66-
FF_UNUSED(data, wl_registry, name);
67-
}
68-
6965
static void waylandGlobalAddListener(void* data, struct wl_registry* registry, uint32_t name, const char* interface, uint32_t version)
7066
{
7167
WaylandData* wldata = data;
@@ -78,8 +74,20 @@ static void waylandGlobalAddListener(void* data, struct wl_registry* registry, u
7874

7975
//Needs to be static, because the scope of the function will already be lost when calling the listener
8076
static struct wl_output_listener outputListener = {
81-
.mode = waylandOutputModeListener, //This is the only one we really need
82-
.geometry = waylandOutputGeometryListener,
77+
.mode = waylandOutputModeListener,
78+
.geometry = (void*) stubListener,
79+
80+
//https://lists.freedesktop.org/archives/wayland-devel/2013-July/010278.html
81+
#if WAYLAND_VERSION_MINOR >= 2
82+
.done = (void*) stubListener,
83+
.scale = (void*) stubListener,
84+
#endif
85+
86+
//https://lists.freedesktop.org/archives/wayland-devel/2021-December/042064.html
87+
#if WAYLAND_VERSION_MINOR >= 20
88+
.name = (void*) stubListener,
89+
.description = (void*) stubListener,
90+
#endif
8391
};
8492

8593
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, data);
@@ -126,7 +134,7 @@ bool detectWayland(const FFinstance* instance, FFDisplayServerResult* result)
126134

127135
struct wl_registry_listener registry_listener = {
128136
.global = waylandGlobalAddListener,
129-
.global_remove = waylandGlobalRemoveListener
137+
.global_remove = (void*) stubListener
130138
};
131139

132140
data.ffwl_proxy_add_listener(registry, (void(**)(void)) &registry_listener, &data);

0 commit comments

Comments
 (0)