Skip to content

Commit b6fff0c

Browse files
committed
Display (Wayland): code refactor
1 parent c16373a commit b6fff0c

File tree

2 files changed

+45
-45
lines changed

2 files changed

+45
-45
lines changed

src/detection/displayserver/linux/wayland/kde-output.c

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,34 @@ void waylandOutputNameListener(void* data, FF_MAYBE_UNUSED struct kde_output_dev
114114
ffStrbufAppendS(&display->name, name);
115115
}
116116

117+
static struct kde_output_device_v2_listener outputListener = {
118+
.geometry = waylandKdeGeometryListener,
119+
.current_mode = waylandKdeCurrentModeListener,
120+
.mode = waylandKdeModeListener,
121+
.done = (void*) stubListener,
122+
.scale = waylandKdeScaleListener,
123+
.edid = waylandKdeEdidListener,
124+
.enabled = waylandKdeEnabledListener,
125+
.uuid = (void*) stubListener,
126+
.serial_number = (void*) stubListener,
127+
.eisa_id = (void*) stubListener,
128+
.capabilities = (void*) stubListener,
129+
.overscan = (void*) stubListener,
130+
.vrr_policy = (void*) stubListener,
131+
.rgb_range = (void*) stubListener,
132+
.name = waylandOutputNameListener,
133+
.high_dynamic_range = (void*) stubListener,
134+
.sdr_brightness = (void*) stubListener,
135+
.wide_color_gamut = (void*) stubListener,
136+
.auto_rotate_policy = (void*) stubListener,
137+
.icc_profile_path = (void*) stubListener,
138+
.brightness_metadata = (void*) stubListener,
139+
.brightness_overrides = (void*) stubListener,
140+
.sdr_gamut_wideness = (void*) stubListener,
141+
.color_profile_source = (void*) stubListener,
142+
.brightness = (void*) stubListener,
143+
};
144+
117145
void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry, uint32_t name, uint32_t version)
118146
{
119147
struct wl_proxy* output = wldata->ffwl_proxy_marshal_constructor_versioned((struct wl_proxy*) registry, WL_REGISTRY_BIND, &kde_output_device_v2_interface, version, name, kde_output_device_v2_interface.name, version, NULL);
@@ -135,34 +163,6 @@ void ffWaylandHandleKdeOutput(WaylandData* wldata, struct wl_registry* registry,
135163
.internal = &modes,
136164
};
137165

138-
struct kde_output_device_v2_listener outputListener = {
139-
.geometry = waylandKdeGeometryListener,
140-
.current_mode = waylandKdeCurrentModeListener,
141-
.mode = waylandKdeModeListener,
142-
.done = (void*) stubListener,
143-
.scale = waylandKdeScaleListener,
144-
.edid = waylandKdeEdidListener,
145-
.enabled = waylandKdeEnabledListener,
146-
.uuid = (void*) stubListener,
147-
.serial_number = (void*) stubListener,
148-
.eisa_id = (void*) stubListener,
149-
.capabilities = (void*) stubListener,
150-
.overscan = (void*) stubListener,
151-
.vrr_policy = (void*) stubListener,
152-
.rgb_range = (void*) stubListener,
153-
.name = waylandOutputNameListener,
154-
.high_dynamic_range = (void*) stubListener,
155-
.sdr_brightness = (void*) stubListener,
156-
.wide_color_gamut = (void*) stubListener,
157-
.auto_rotate_policy = (void*) stubListener,
158-
.icc_profile_path = (void*) stubListener,
159-
.brightness_metadata = (void*) stubListener,
160-
.brightness_overrides = (void*) stubListener,
161-
.sdr_gamut_wideness = (void*) stubListener,
162-
.color_profile_source = (void*) stubListener,
163-
.brightness = (void*) stubListener,
164-
};
165-
166166
wldata->ffwl_proxy_add_listener(output, (void(**)(void)) &outputListener, &display);
167167
wldata->ffwl_display_roundtrip(wldata->display);
168168
wldata->ffwl_proxy_destroy(output);

src/detection/displayserver/linux/wayland/zwlr-output.c

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -71,27 +71,27 @@ static void waylandZwlrCurrentModeListener(void* data, FF_MAYBE_UNUSED struct zw
7171
wldata->refreshRate = current->refreshRate;
7272
}
7373

74+
static const struct zwlr_output_head_v1_listener headListener = {
75+
.name = (void*) ffWaylandOutputNameListener,
76+
.description = (void*) ffWaylandOutputDescriptionListener,
77+
.physical_size = (void*) stubListener,
78+
.mode = waylandZwlrModeListener,
79+
.enabled = (void*) stubListener,
80+
.current_mode = waylandZwlrCurrentModeListener,
81+
.position = (void*) stubListener,
82+
.transform = waylandZwlrTransformListener,
83+
.scale = waylandZwlrScaleListener,
84+
.finished = (void*) stubListener,
85+
.make = (void*) stubListener,
86+
.model = (void*) stubListener,
87+
.serial_number = (void*) stubListener,
88+
.adaptive_sync = (void*) stubListener,
89+
};
90+
7491
static void waylandHandleZwlrHead(void *data, FF_MAYBE_UNUSED struct zwlr_output_manager_v1 *zwlr_output_manager_v1, struct zwlr_output_head_v1 *head)
7592
{
7693
WaylandData* wldata = data;
7794

78-
const struct zwlr_output_head_v1_listener headListener = {
79-
.name = (void*) ffWaylandOutputNameListener,
80-
.description = (void*) ffWaylandOutputDescriptionListener,
81-
.physical_size = (void*) stubListener,
82-
.mode = waylandZwlrModeListener,
83-
.enabled = (void*) stubListener,
84-
.current_mode = waylandZwlrCurrentModeListener,
85-
.position = (void*) stubListener,
86-
.transform = waylandZwlrTransformListener,
87-
.scale = waylandZwlrScaleListener,
88-
.finished = (void*) stubListener,
89-
.make = (void*) stubListener,
90-
.model = (void*) stubListener,
91-
.serial_number = (void*) stubListener,
92-
.adaptive_sync = (void*) stubListener,
93-
};
94-
9595
FF_LIST_AUTO_DESTROY modes = ffListCreate(sizeof(WaylandZwlrMode));
9696
WaylandDisplay display = {
9797
.parent = wldata,

0 commit comments

Comments
 (0)