mirror of
https://git.sr.ht/~leon_plickat/wlopm
synced 2024-12-25 21:18:21 +01:00
Remove noop()
Sending a handler with incompatible pointer types is undefined behavior, so this removes noop() and implements empty handlers for all of its previous uses. This used to work until C23.
This commit is contained in:
parent
3ef08977b3
commit
84c3e0baf1
51
wlopm.c
51
wlopm.c
@ -92,8 +92,6 @@ struct zwlr_output_power_manager_v1 *wlr_output_power_manager = NULL;
|
||||
int ret = EXIT_SUCCESS;
|
||||
bool loop = true;
|
||||
|
||||
static void noop () {}
|
||||
|
||||
static void wlr_output_power_handle_mode (void *data, struct zwlr_output_power_v1 *wlr_output_power,
|
||||
enum zwlr_output_power_v1_mode mode)
|
||||
{
|
||||
@ -121,13 +119,43 @@ static void wl_output_handle_name (void *data, struct wl_output *wl_output,
|
||||
output->name = strdup(name);
|
||||
}
|
||||
|
||||
static void wl_output_handle_geometry (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)
|
||||
{
|
||||
/* This function is deliberately left empty. */
|
||||
}
|
||||
|
||||
static void wl_output_handle_mode (void *data, struct wl_output *wl_output,
|
||||
uint32_t flags, int32_t width, int32_t height, int32_t refresh)
|
||||
{
|
||||
/* This function is deliberately left empty. */
|
||||
}
|
||||
|
||||
static void wl_output_handle_scale (void *data, struct wl_output *wl_output,
|
||||
int32_t scale)
|
||||
{
|
||||
/* This function is deliberately left empty. */
|
||||
}
|
||||
|
||||
static void wl_output_handle_description (void *data, struct wl_output *wl_output,
|
||||
const char *description)
|
||||
{
|
||||
/* This function is deliberately left empty. */
|
||||
}
|
||||
|
||||
static void wl_output_handle_done (void *data, struct wl_output *wl_output)
|
||||
{
|
||||
/* This function is deliberately left empty. */
|
||||
}
|
||||
|
||||
static const struct wl_output_listener wl_output_listener = {
|
||||
.name = wl_output_handle_name,
|
||||
.geometry = noop,
|
||||
.mode = noop,
|
||||
.scale = noop,
|
||||
.description = noop,
|
||||
.done = noop,
|
||||
.geometry = wl_output_handle_geometry,
|
||||
.mode = wl_output_handle_mode,
|
||||
.scale = wl_output_handle_scale,
|
||||
.description = wl_output_handle_description,
|
||||
.done = wl_output_handle_done,
|
||||
};
|
||||
|
||||
static void registry_handle_global (void *data, struct wl_registry *registry,
|
||||
@ -164,9 +192,15 @@ static void registry_handle_global (void *data, struct wl_registry *registry,
|
||||
&zwlr_output_power_manager_v1_interface, version);
|
||||
}
|
||||
|
||||
static void registry_handle_global_remove (void *data, struct wl_registry *registry,
|
||||
uint32_t name)
|
||||
{
|
||||
/* We don't run long enough to care. */
|
||||
}
|
||||
|
||||
static const struct wl_registry_listener registry_listener = {
|
||||
.global = registry_handle_global,
|
||||
.global_remove = noop, /* We don't run long enough to care. */
|
||||
.global_remove = registry_handle_global_remove,
|
||||
};
|
||||
|
||||
static void sync_handle_done (void *data, struct wl_callback *wl_callback, uint32_t other_data);
|
||||
@ -569,4 +603,3 @@ int main(int argc, char *argv[])
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user