Add extra wl_pointer callbacks for v8 and v9

This commit is contained in:
Phireh 2024-12-06 15:41:43 +01:00
commit c98b67fcd3

View file

@ -326,6 +326,16 @@ void pointer_axis_discrete_callback(void *data, struct wl_pointer *pointer, uint
//fprintf(stdout, "Pointer axis discrete step: %d\n", discrete); //fprintf(stdout, "Pointer axis discrete step: %d\n", discrete);
} }
void pointer_axis_value120_callback(void *data, struct wl_pointer *pointer, uint axis, int value120)
{
fprintf(stdout, "Pointer axis value120: %d\n", value120);
}
void pointer_axis_relative_direction_callback(void *data, struct wl_pointer *pointer, uint axis, uint direction)
{
fprintf(stdout, "Pointer axis direction: %d\n", direction);
}
int main() int main()
{ {
fprintf(stdout, "Starting platform layer...\n"); fprintf(stdout, "Starting platform layer...\n");
@ -419,7 +429,8 @@ int main()
if (wl_keyboard_add_listener(wl_keyboard, &wl_keyboard_listener, NULL)) if (wl_keyboard_add_listener(wl_keyboard, &wl_keyboard_listener, NULL))
fprintf(stderr, "Could not set XKB keyboard listener\n"); fprintf(stderr, "Could not set XKB keyboard listener\n");
// TODO: Apparently we are not setting opcode 10's callback? /* NOTE: Apparently wl_pointer added 'axis_value120' with v8 and 'axis_relative_direction' events with v9.
Failing to provide callbacks for them crashes the client in runtime */
const struct wl_pointer_listener wl_pointer_listener = { const struct wl_pointer_listener wl_pointer_listener = {
.enter = pointer_enter_callback, .enter = pointer_enter_callback,
.leave = pointer_leave_callback, .leave = pointer_leave_callback,
@ -429,7 +440,9 @@ int main()
.frame = pointer_frame_callback, .frame = pointer_frame_callback,
.axis_source = pointer_axis_source_callback, .axis_source = pointer_axis_source_callback,
.axis_stop = pointer_axis_stop_callback, .axis_stop = pointer_axis_stop_callback,
.axis_discrete = pointer_axis_discrete_callback .axis_discrete = pointer_axis_discrete_callback,
.axis_value120 = pointer_axis_value120_callback,
.axis_relative_direction = pointer_axis_relative_direction_callback,
}; };
if (wl_pointer_add_listener(wl_pointer, &wl_pointer_listener, NULL)) if (wl_pointer_add_listener(wl_pointer, &wl_pointer_listener, NULL))