Added pointer source events

This commit is contained in:
akallabeth 2021-03-02 09:30:01 +01:00 committed by akallabeth
parent 9ea7f88753
commit b6b6a81187
2 changed files with 26 additions and 2 deletions

View File

@ -108,7 +108,8 @@ enum
UWAC_EVENT_CLIPBOARD_OFFER, UWAC_EVENT_CLIPBOARD_OFFER,
UWAC_EVENT_OUTPUT_GEOMETRY, UWAC_EVENT_OUTPUT_GEOMETRY,
UWAC_EVENT_POINTER_AXIS_DISCRETE, UWAC_EVENT_POINTER_AXIS_DISCRETE,
UWAC_EVENT_POINTER_FRAME UWAC_EVENT_POINTER_FRAME,
UWAC_EVENT_POINTER_SOURCE
}; };
/** @brief window states */ /** @brief window states */
@ -204,6 +205,15 @@ struct uwac_pointer_frame_event
}; };
typedef struct uwac_pointer_frame_event UwacPointerFrameEvent; typedef struct uwac_pointer_frame_event UwacPointerFrameEvent;
struct uwac_pointer_source_event
{
int type;
UwacWindow* window;
UwacSeat* seat;
enum wl_pointer_axis_source axis_source;
};
typedef struct uwac_pointer_source_event UwacPointerSourceEvent;
struct uwac_touch_frame_event struct uwac_touch_frame_event
{ {
int type; int type;
@ -296,6 +306,7 @@ union uwac_event {
UwacPointerButtonEvent mouse_button; UwacPointerButtonEvent mouse_button;
UwacPointerAxisEvent mouse_axis; UwacPointerAxisEvent mouse_axis;
UwacPointerFrameEvent mouse_frame; UwacPointerFrameEvent mouse_frame;
UwacPointerSourceEvent mouse_source;
UwacKeyboardEnterLeaveEvent keyboard_enter_leave; UwacKeyboardEnterLeaveEvent keyboard_enter_leave;
UwacKeyboardModifiersEvent keyboard_modifiers; UwacKeyboardModifiersEvent keyboard_modifiers;
UwacClipboardEvent clipboard; UwacClipboardEvent clipboard;

View File

@ -861,7 +861,20 @@ static void pointer_frame(void* data, struct wl_pointer* wl_pointer)
static void pointer_axis_source(void* data, struct wl_pointer* wl_pointer, uint32_t axis_source) static void pointer_axis_source(void* data, struct wl_pointer* wl_pointer, uint32_t axis_source)
{ {
/*UwacSeat *seat = data;*/ UwacPointerSourceEvent* event;
UwacSeat* seat = data;
UwacWindow* window = seat->pointer_focus;
if (!window)
return;
event = (UwacPointerSourceEvent*)UwacDisplayNewEvent(seat->display, UWAC_EVENT_POINTER_SOURCE);
if (!event)
return;
event->seat = seat;
event->window = window;
event->axis_source = axis_source;
} }
static void pointer_axis_stop(void* data, struct wl_pointer* wl_pointer, uint32_t time, static void pointer_axis_stop(void* data, struct wl_pointer* wl_pointer, uint32_t time,