From 31f336a4c3ac31bd62e2bcc279386b44dae83de8 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Tue, 10 Mar 2020 10:36:17 -0400 Subject: [PATCH 01/12] Initial refactor for more sane pan events --- include/SDL_events.h | 18 ++++++----- include/SDL_mouse.h | 44 +++++++++++++++++++++++++++ src/events/SDL_mouse.c | 14 +++------ src/video/wayland/SDL_waylandevents.c | 18 ++++++++--- 4 files changed, 73 insertions(+), 21 deletions(-) diff --git a/include/SDL_events.h b/include/SDL_events.h index d35ec36c6..44f891af6 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -320,19 +320,23 @@ typedef struct SDL_MouseWheelEvent Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ } SDL_MouseWheelEvent; +typedef struct SDL_Pan +{ + Uint32 axis; /**< One of SDL_PAN_AXIS_[...], the axis this event contains a delta for */ + typedef struct SDL_PanEvent { Uint32 type; /**< ::SDL_PANEVENT */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ - Uint64 x; /**< Precise scrolling amount on x axis. */ - Uint64 y; /**< Precise scrolling amount on y axis. */ + //Uint64 delta; /**< Precise scrolling amount on given axis. */ + //Uint32 axis; /**< One of SDL_PAN_AXIS_[...], the axis this event contains a delta for */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ - Uint32 source_type; /**< One of SDL_MOUSEWHEEL_SOURCE_[...] */ - Uint8 contains_x; /**< Indicates event contains a useful value in scalar_x and a pan should be calculated */ - Uint8 contains_y; /**< Indicates event contains a useful value in scalar_y and a pan should be calculated */ - Uint8 interrupt; /**< If some fling event was dispatched, this is intended to terminate it */ - Uint8 fling; /**< Indicates the user has "flung" the wheel and kinetic scrolling (if enabled) should begin here */ + SDL_PanType pantype; + SDL_PanType_Contents contents; + //Uint32 source_type; /**< One of SDL_MOUSEWHEEL_SOURCE_[...] */ + //Uint8 interrupt; /**< If some fling event was dispatched, this is intended to terminate it. Indicates delta should be ignored */ + //Uint8 fling; /**< Indicates the user has "flung" the wheel and kinetic scrolling (if enabled) should begin here. Ingicates delta should be ignored */ } SDL_PanEvent; /** diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index 53bf92c65..03b627a45 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -92,6 +92,50 @@ typedef enum SDL_MOUSEWHEEL_SOURCE_OTHER_KINETIC, } SDL_MouseWheelSource; +typedef enum +{ + SDL_PAN_AXIS_VERTICAL, + SDL_PAN_AXIS_HORIZONTAL, + SDL_PAN_AXIS_NONE, /**< Indicates this delta describes no axis. Any event marked with this should not rely on delta being sane or meaningful */ +} SDL_PanAxis; + +typedef enum +{ + SDL_PANTYPE_PAN, + SDL_PANTYPE_FLING, + SDL_PANTYPE_INTERRUPT, + SDL_PANTYPE_SOURCE, +} SDL_PanType; + +typedef struct SDL_PanType_Pan +{ + SDL_PanAxis axis; + Uint64 delta; +} SDL_PanType_Pan; + +typedef struct SDL_PanType_Source +{ + SDL_MouseWheelSource source; +} SDL_PanType_Source; + +typedef struct SDL_PanType_Interrupt +{ + SDL_PanAxis axis; +} SDL_PanType_Interrupt; + +typedef struct SDL_PanType_Fling +{ + SDL_PanAxis axis; +} SDL_PanType_Fling; + +typedef union SDL_PanType_Contents +{ + SDL_PanType_Pan pan; + SDL_PanType_Source source; + SDL_PanType_Interrupt interrupt; + SDL_PanType_Fling fling; +} SDL_PanType_Contents; + /* Function prototypes */ /** diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index b341ab632..8af283749 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -665,13 +665,11 @@ int SDL_SendPanEvent( SDL_Window * window, SDL_MouseID mouseID, - Sint64 precise_x, - Sint64 precise_y, - Uint8 contains_x, - Uint8 contains_y, + Sint64 precise_delta, Uint8 is_fling, Uint8 is_interrupt, - SDL_MouseWheelSource source_type + SDL_MouseWheelSource source_type, + SDL_PanAxis axis ) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -680,13 +678,11 @@ SDL_SendPanEvent( event.type = SDL_PANEVENT; event.pan.windowID = mouse->focus ? mouse->focus->id : 0; event.pan.which = mouseID; - event.pan.contains_x = contains_x; - event.pan.contains_y = contains_y; - event.pan.x = precise_x; - event.pan.y = precise_y; + event.pan.delta = precise_delta; event.pan.fling = is_fling; event.pan.interrupt = is_interrupt; event.pan.source_type = source_type; + event.pan.axis = axis; return SDL_PushEvent(&event) > 0; } else { return 0; diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 073491980..6e8eb4e5b 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -419,7 +419,7 @@ pointer_handle_axis_source(void *data, struct wl_pointer *pointer, default: source = SDL_MOUSEWHEEL_SOURCE_UNDEFINED; break; } - SDL_SendPanEvent(window->sdlwindow, 0, 0, 0, 0, 0, 0, 0, source); + SDL_SendPanEvent(window->sdlwindow, 0, 0, false, false, source, SDL_PAN_AXIS_NONE); } static void @@ -429,7 +429,14 @@ pointer_handle_axis_stop(void *data, struct wl_pointer *pointer, struct SDL_WaylandInput *input = data; SDL_WindowData *window = input->pointer_focus; - SDL_SendPanEvent(window->sdlwindow, 0, 0, 0, 0, 0, 1, 0, SDL_MOUSEWHEEL_SOURCE_LAST); + uint32_t mapped_axis; + switch(axis) { + case 0: mapped_axis = SDL_PAN_AXIS_VERTICAL; + case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; + } + + // emits event with SDL_PAN_AXIS_NONE as this event + SDL_SendPanEvent(window->sdlwindow, 0, 0, true, false, SDL_MOUSEWHEEL_SOURCE_LAST, SDL_PAN_AXIS_NONE); } static void @@ -441,12 +448,13 @@ pointer_handle_axis_discrete(void *data, struct wl_pointer *pointer, Uint64 x = 0; Uint64 y = 0; + uint32_t mapped_axis; switch(axis) { - case 0: y = discrete; - case 1: x = discrete; + case 0: mapped_axis = SDL_PAN_AXIS_VERTICAL; + case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; } - SDL_SendPanEvent(window->sdlwindow, 0, x, y, axis, !axis, 0, 0, SDL_MOUSEWHEEL_SOURCE_WHEEL); + SDL_SendPanEvent(window->sdlwindow, 0, discrete, y, axis, !axis, 0, 0, SDL_MOUSEWHEEL_SOURCE_WHEEL); } static const struct wl_pointer_listener pointer_listener = { From a3cb9f67270fc454bcde2bd429866327a37b687b Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Tue, 10 Mar 2020 17:48:05 -0400 Subject: [PATCH 02/12] Fix syntax errors --- include/SDL_events.h | 4 ---- src/events/SDL_mouse.c | 30 ++++++++++++++++++++++++++---- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/include/SDL_events.h b/include/SDL_events.h index 44f891af6..ceb7a28bb 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -320,10 +320,6 @@ typedef struct SDL_MouseWheelEvent Uint32 direction; /**< Set to one of the SDL_MOUSEWHEEL_* defines. When FLIPPED the values in X and Y will be opposite. Multiply by -1 to change them back */ } SDL_MouseWheelEvent; -typedef struct SDL_Pan -{ - Uint32 axis; /**< One of SDL_PAN_AXIS_[...], the axis this event contains a delta for */ - typedef struct SDL_PanEvent { Uint32 type; /**< ::SDL_PANEVENT */ diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 8af283749..75c5cf42b 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -662,13 +662,35 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, S } int -SDL_SendPanEvent( +SDL_SendPanSource( + SDL_Window * window, + SDL_MouseID mouseID, + SDL_MouseWheelSource source +) { + SDL_Mouse *mouse = SDL_GetMouse(); + + if( SDL_GetEventState(SDL_PANEVENT) == SDL_ENABLE ) { + SDL_Event event; + event.type = SDL_PANEVENT; + event.pan.windowID = mouse->focus ? mouse->focus->id : 0; + event.pan.which = mouseID; + event.pan.pantype = SDL_PANTYPE_SOURCE; + + SDL_PanType_Source pan_source; + pan_source.source = source; + + event.pan.contents.source = pan_source; + return SDL_PushEvent(&event) > 0; + } else { + return 0; + } +} + +int +SDL_SendPanDelta( SDL_Window * window, SDL_MouseID mouseID, Sint64 precise_delta, - Uint8 is_fling, - Uint8 is_interrupt, - SDL_MouseWheelSource source_type, SDL_PanAxis axis ) { SDL_Mouse *mouse = SDL_GetMouse(); From 0b701386e5dc8216bfef27537e001dd20570fb5f Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Fri, 3 Apr 2020 16:16:08 -0400 Subject: [PATCH 03/12] Big refactor, slight breaking changes --- include/SDL_events.h | 5 +- include/SDL_mouse.h | 23 +++------ src/events/SDL_mouse.c | 70 +++++++++++++++++++++------ src/events/SDL_mouse_c.h | 5 +- src/video/wayland/SDL_waylandevents.c | 15 +++--- 5 files changed, 80 insertions(+), 38 deletions(-) diff --git a/include/SDL_events.h b/include/SDL_events.h index ceb7a28bb..d35483546 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -328,8 +328,11 @@ typedef struct SDL_PanEvent //Uint64 delta; /**< Precise scrolling amount on given axis. */ //Uint32 axis; /**< One of SDL_PAN_AXIS_[...], the axis this event contains a delta for */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ + SDL_PanAxis axis; SDL_PanType pantype; - SDL_PanType_Contents contents; + SDL_PanContents contents; + + SDL_MouseWheelSource source; //Uint32 source_type; /**< One of SDL_MOUSEWHEEL_SOURCE_[...] */ //Uint8 interrupt; /**< If some fling event was dispatched, this is intended to terminate it. Indicates delta should be ignored */ //Uint8 fling; /**< Indicates the user has "flung" the wheel and kinetic scrolling (if enabled) should begin here. Ingicates delta should be ignored */ diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index 03b627a45..4d3b88463 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -101,40 +101,31 @@ typedef enum typedef enum { - SDL_PANTYPE_PAN, - SDL_PANTYPE_FLING, - SDL_PANTYPE_INTERRUPT, - SDL_PANTYPE_SOURCE, + SDL_PANEVENTTYPE_PAN, + SDL_PANEVENTTYPE_FLING, + SDL_PANEVENTTYPE_INTERRUPT, + SDL_PANEVENTTYPE_SOURCE, } SDL_PanType; typedef struct SDL_PanType_Pan { - SDL_PanAxis axis; - Uint64 delta; + double delta; } SDL_PanType_Pan; -typedef struct SDL_PanType_Source -{ - SDL_MouseWheelSource source; -} SDL_PanType_Source; - typedef struct SDL_PanType_Interrupt { - SDL_PanAxis axis; } SDL_PanType_Interrupt; typedef struct SDL_PanType_Fling { - SDL_PanAxis axis; } SDL_PanType_Fling; -typedef union SDL_PanType_Contents +typedef union SDL_PanContents { SDL_PanType_Pan pan; - SDL_PanType_Source source; SDL_PanType_Interrupt interrupt; SDL_PanType_Fling fling; -} SDL_PanType_Contents; +} SDL_PanContents; /* Function prototypes */ diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 75c5cf42b..1a2cf601e 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -661,11 +661,24 @@ SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, S return posted; } +static SDL_MouseWheelSource latest_source = SDL_MOUSEWHEEL_SOURCE_LAST; + +static void +SDL_SetPanSource(SDL_MouseWheelSource source) { + latest_source = source; +} + +static SDL_MouseWheelSource +SDL_GetPanLastSource() { + return latest_source; +} + int -SDL_SendPanSource( +SDL_SendPanDelta( SDL_Window * window, SDL_MouseID mouseID, - SDL_MouseWheelSource source + double delta, + SDL_PanAxis axis ) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -674,12 +687,31 @@ SDL_SendPanSource( event.type = SDL_PANEVENT; event.pan.windowID = mouse->focus ? mouse->focus->id : 0; event.pan.which = mouseID; - event.pan.pantype = SDL_PANTYPE_SOURCE; - - SDL_PanType_Source pan_source; - pan_source.source = source; + event.pan.pantype = SDL_PANEVENTTYPE_PAN; + event.pan.contents.pan.delta = delta; + event.pan.source = SDL_GetPanLastSource(); + return SDL_PushEvent(&event) > 0; + } else { + return 0; + } +} - event.pan.contents.source = pan_source; +int +SDL_SendPanFling( + SDL_Window * window, + SDL_MouseID mouseID, + SDL_PanAxis axis +) { + SDL_Mouse *mouse = SDL_GetMouse(); + + if( SDL_GetEventState(SDL_PANEVENT) == SDL_ENABLE ) { + SDL_Event event; + event.type = SDL_PANEVENT; + event.pan.windowID = mouse->focus ? mouse->focus->id : 0; + event.pan.which = mouseID; + event.pan.pantype = SDL_PANEVENTTYPE_FLING; + // no union contents written for this event type + event.pan.source = SDL_GetPanLastSource(); return SDL_PushEvent(&event) > 0; } else { return 0; @@ -687,10 +719,9 @@ SDL_SendPanSource( } int -SDL_SendPanDelta( +SDL_SendPanInterrupt( SDL_Window * window, SDL_MouseID mouseID, - Sint64 precise_delta, SDL_PanAxis axis ) { SDL_Mouse *mouse = SDL_GetMouse(); @@ -700,17 +731,28 @@ SDL_SendPanDelta( event.type = SDL_PANEVENT; event.pan.windowID = mouse->focus ? mouse->focus->id : 0; event.pan.which = mouseID; - event.pan.delta = precise_delta; - event.pan.fling = is_fling; - event.pan.interrupt = is_interrupt; - event.pan.source_type = source_type; - event.pan.axis = axis; + event.pan.pantype = SDL_PANEVENTTYPE_INTERRUPT; + // no union contents written for this event type + event.pan.source = SDL_GetPanLastSource(); return SDL_PushEvent(&event) > 0; } else { return 0; } } +int +SDL_SendPanSource( + SDL_Window * window, + SDL_MouseID mouseID, + SDL_MouseWheelSource source +) { + // may become a full event at some point, + // implemented very basically here. Expect semantics + // to be the same as other event dispatch functions + SDL_SetPanSource(source); + return 1; +} + void SDL_MouseQuit(void) { diff --git a/src/events/SDL_mouse_c.h b/src/events/SDL_mouse_c.h index b73746c6c..e0182a226 100644 --- a/src/events/SDL_mouse_c.h +++ b/src/events/SDL_mouse_c.h @@ -135,7 +135,10 @@ extern int SDL_SendMouseButtonClicks(SDL_Window * window, SDL_MouseID mouseID, U extern int SDL_SendMouseWheel(SDL_Window * window, SDL_MouseID mouseID, float x, float y, SDL_MouseWheelDirection direction); /* Send a pan/scroll event */ -extern int SDL_SendPanEvent( SDL_Window * window, SDL_MouseID mouseID, Sint64 precise_x, Sint64 precise_y, Uint8 contains_x, Uint8 contains_y, Uint8 is_fling, Uint8 is_interrupt, SDL_MouseWheelSource source_type); +extern int SDL_SendPanSource( SDL_Window * window, SDL_MouseID mouseID, SDL_MouseWheelSource source); +extern int SDL_SendPanDelta( SDL_Window * window, SDL_MouseID mouseID, double precise_delta, SDL_PanAxis axis); +extern int SDL_SendPanFling( SDL_Window * window, SDL_MouseID mouseID, SDL_PanAxis axis); +extern int SDL_SendPanInterrupt( SDL_Window * window, SDL_MouseID mouseID, SDL_PanAxis axis); /* Shutdown the mouse subsystem */ extern void SDL_MouseQuit(void); diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 6e8eb4e5b..19c51a7ac 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -393,7 +393,7 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer, case 1: x = value; break; } - SDL_SendPanEvent(window->sdlwindow, 0, x, y, axis, !axis, 0, 0, SDL_MOUSEWHEEL_SOURCE_LAST); + SDL_SendPanDelta(window->sdlwindow, 0, value, wl_fixed_to_double(value)); } static void @@ -409,7 +409,7 @@ pointer_handle_axis_source(void *data, struct wl_pointer *pointer, struct SDL_WaylandInput *input = data; SDL_WindowData *window = input->pointer_focus; - int source; + SDL_MouseWheelSource source; switch(axis_source) { case 0: source = SDL_MOUSEWHEEL_SOURCE_WHEEL; break; @@ -419,7 +419,7 @@ pointer_handle_axis_source(void *data, struct wl_pointer *pointer, default: source = SDL_MOUSEWHEEL_SOURCE_UNDEFINED; break; } - SDL_SendPanEvent(window->sdlwindow, 0, 0, false, false, source, SDL_PAN_AXIS_NONE); + SDL_SendPanSource(window->sdlwindow, 0, source); } static void @@ -435,8 +435,7 @@ pointer_handle_axis_stop(void *data, struct wl_pointer *pointer, case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; } - // emits event with SDL_PAN_AXIS_NONE as this event - SDL_SendPanEvent(window->sdlwindow, 0, 0, true, false, SDL_MOUSEWHEEL_SOURCE_LAST, SDL_PAN_AXIS_NONE); + SDL_SendPanSource(window->sdlwindow, 0, mapped_axis); } static void @@ -454,7 +453,11 @@ pointer_handle_axis_discrete(void *data, struct wl_pointer *pointer, case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; } - SDL_SendPanEvent(window->sdlwindow, 0, discrete, y, axis, !axis, 0, 0, SDL_MOUSEWHEEL_SOURCE_WHEEL); + // TODO: figure out semantics, may make sense to dispatch as SDL_MOUSEWHEEL_SOURCE_WHEEL every time + //SDL_SendPanEvent(window->sdlwindow, 0, discrete, y, axis, !axis, 0, 0, wl_latest_source); + //SDL_SendPanDelta( + // Is this actually something that should be picked up for mousewheels or do they already go through + // the normal axis pan event? TODO: figure this out } static const struct wl_pointer_listener pointer_listener = { From 4e63d9a77b880edde74ebab6291e85400c448d14 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Fri, 3 Apr 2020 16:27:49 -0400 Subject: [PATCH 04/12] Remove comments --- include/SDL_events.h | 5 ----- 1 file changed, 5 deletions(-) diff --git a/include/SDL_events.h b/include/SDL_events.h index d35483546..5a16eb6cd 100644 --- a/include/SDL_events.h +++ b/include/SDL_events.h @@ -325,17 +325,12 @@ typedef struct SDL_PanEvent Uint32 type; /**< ::SDL_PANEVENT */ Uint32 timestamp; /**< In milliseconds, populated using SDL_GetTicks() */ Uint32 windowID; /**< The window with mouse focus, if any */ - //Uint64 delta; /**< Precise scrolling amount on given axis. */ - //Uint32 axis; /**< One of SDL_PAN_AXIS_[...], the axis this event contains a delta for */ Uint32 which; /**< The mouse instance id, or SDL_TOUCH_MOUSEID */ SDL_PanAxis axis; SDL_PanType pantype; SDL_PanContents contents; SDL_MouseWheelSource source; - //Uint32 source_type; /**< One of SDL_MOUSEWHEEL_SOURCE_[...] */ - //Uint8 interrupt; /**< If some fling event was dispatched, this is intended to terminate it. Indicates delta should be ignored */ - //Uint8 fling; /**< Indicates the user has "flung" the wheel and kinetic scrolling (if enabled) should begin here. Ingicates delta should be ignored */ } SDL_PanEvent; /** From 51a21803660da58082e68e9eb07f58d4da45761a Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Fri, 3 Apr 2020 17:43:06 -0400 Subject: [PATCH 05/12] add breaks --- src/video/wayland/SDL_waylandevents.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 19c51a7ac..6b3e1da76 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -431,8 +431,8 @@ pointer_handle_axis_stop(void *data, struct wl_pointer *pointer, uint32_t mapped_axis; switch(axis) { - case 0: mapped_axis = SDL_PAN_AXIS_VERTICAL; - case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; + case 0: mapped_axis = SDL_PAN_AXIS_VERTICAL; break; + case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; break; } SDL_SendPanSource(window->sdlwindow, 0, mapped_axis); @@ -449,8 +449,8 @@ pointer_handle_axis_discrete(void *data, struct wl_pointer *pointer, uint32_t mapped_axis; switch(axis) { - case 0: mapped_axis = SDL_PAN_AXIS_VERTICAL; - case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; + case 0: mapped_axis = SDL_PAN_AXIS_VERTICAL; break; + case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; break; } // TODO: figure out semantics, may make sense to dispatch as SDL_MOUSEWHEEL_SOURCE_WHEEL every time From a1cd4bb7e7118342d2137296fc2bdaae4b18ebdc Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Fri, 3 Apr 2020 21:50:40 -0400 Subject: [PATCH 06/12] set axis --- src/events/SDL_mouse.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 1a2cf601e..0f811a105 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -690,6 +690,7 @@ SDL_SendPanDelta( event.pan.pantype = SDL_PANEVENTTYPE_PAN; event.pan.contents.pan.delta = delta; event.pan.source = SDL_GetPanLastSource(); + event.pan.axis = axis; return SDL_PushEvent(&event) > 0; } else { return 0; @@ -712,6 +713,7 @@ SDL_SendPanFling( event.pan.pantype = SDL_PANEVENTTYPE_FLING; // no union contents written for this event type event.pan.source = SDL_GetPanLastSource(); + event.pan.axis = axis; return SDL_PushEvent(&event) > 0; } else { return 0; @@ -734,6 +736,7 @@ SDL_SendPanInterrupt( event.pan.pantype = SDL_PANEVENTTYPE_INTERRUPT; // no union contents written for this event type event.pan.source = SDL_GetPanLastSource(); + event.pan.axis = axis; return SDL_PushEvent(&event) > 0; } else { return 0; From 8589c57e1411b954cdb0ae4b92a8971fb7ebe2dc Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Sat, 4 Apr 2020 19:47:25 -0400 Subject: [PATCH 07/12] Fix dispatch on wayland for fling events --- src/video/wayland/SDL_waylandevents.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 6b3e1da76..6b5e59b21 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -435,7 +435,7 @@ pointer_handle_axis_stop(void *data, struct wl_pointer *pointer, case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; break; } - SDL_SendPanSource(window->sdlwindow, 0, mapped_axis); + SDL_SendPanFling(window->sdlwindow, 0, mapped_axis); } static void @@ -453,9 +453,6 @@ pointer_handle_axis_discrete(void *data, struct wl_pointer *pointer, case 1: mapped_axis = SDL_PAN_AXIS_HORIZONTAL; break; } - // TODO: figure out semantics, may make sense to dispatch as SDL_MOUSEWHEEL_SOURCE_WHEEL every time - //SDL_SendPanEvent(window->sdlwindow, 0, discrete, y, axis, !axis, 0, 0, wl_latest_source); - //SDL_SendPanDelta( // Is this actually something that should be picked up for mousewheels or do they already go through // the normal axis pan event? TODO: figure this out } From c7c09d3fd4d6d9bd55bdd3f783987dc925713a7a Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Tue, 7 Apr 2020 11:36:17 -0400 Subject: [PATCH 08/12] Update src/events/SDL_mouse.c in line with docs, negative error code allows more info Co-Authored-By: Et7f3 --- src/events/SDL_mouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 0f811a105..1fa85e21e 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -691,7 +691,7 @@ SDL_SendPanDelta( event.pan.contents.pan.delta = delta; event.pan.source = SDL_GetPanLastSource(); event.pan.axis = axis; - return SDL_PushEvent(&event) > 0; + return SDL_PushEvent(&event); } else { return 0; } From 835ad4037faae3535a85a33ff6b0f959b8bbe2be Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Tue, 7 Apr 2020 11:41:51 -0400 Subject: [PATCH 09/12] Update src/events/SDL_mouse.c Co-Authored-By: Et7f3 --- src/events/SDL_mouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index 1fa85e21e..d854903da 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -737,7 +737,7 @@ SDL_SendPanInterrupt( // no union contents written for this event type event.pan.source = SDL_GetPanLastSource(); event.pan.axis = axis; - return SDL_PushEvent(&event) > 0; + return SDL_PushEvent(&event); } else { return 0; } From 4b93ccb0fb83046fa3ebaf71747819ceded0cc76 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Tue, 7 Apr 2020 11:44:25 -0400 Subject: [PATCH 10/12] Add changes from review --- include/SDL_mouse.h | 1 - src/video/wayland/SDL_waylandevents.c | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/SDL_mouse.h b/include/SDL_mouse.h index 4d3b88463..044ddad9a 100644 --- a/include/SDL_mouse.h +++ b/include/SDL_mouse.h @@ -96,7 +96,6 @@ typedef enum { SDL_PAN_AXIS_VERTICAL, SDL_PAN_AXIS_HORIZONTAL, - SDL_PAN_AXIS_NONE, /**< Indicates this delta describes no axis. Any event marked with this should not rely on delta being sane or meaningful */ } SDL_PanAxis; typedef enum diff --git a/src/video/wayland/SDL_waylandevents.c b/src/video/wayland/SDL_waylandevents.c index 6b5e59b21..04aa0a344 100644 --- a/src/video/wayland/SDL_waylandevents.c +++ b/src/video/wayland/SDL_waylandevents.c @@ -389,11 +389,11 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer, // dispatch new pan event switch(axis) { - case 0: y = value; break; - case 1: x = value; break; + case 0: axis = SDL_PAN_AXIS_VERTICAL; break; + case 1: axis = SDL_PAN_AXIS_HORIZONTAL; break; } - SDL_SendPanDelta(window->sdlwindow, 0, value, wl_fixed_to_double(value)); + SDL_SendPanDelta(window->sdlwindow, 0, wl_fixed_to_double(value), axis); } static void From 2982c0231344cd471099fb3fc82687615e8bcc79 Mon Sep 17 00:00:00 2001 From: Sawyer Bergeron Date: Tue, 7 Apr 2020 17:19:19 -0400 Subject: [PATCH 11/12] Update src/events/SDL_mouse.c Co-Authored-By: Et7f3 --- src/events/SDL_mouse.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/events/SDL_mouse.c b/src/events/SDL_mouse.c index d854903da..05fb7d182 100644 --- a/src/events/SDL_mouse.c +++ b/src/events/SDL_mouse.c @@ -714,7 +714,7 @@ SDL_SendPanFling( // no union contents written for this event type event.pan.source = SDL_GetPanLastSource(); event.pan.axis = axis; - return SDL_PushEvent(&event) > 0; + return SDL_PushEvent(&event); } else { return 0; } From 82c2c5ae991d634ce4b5f593143a7e0ab1104052 Mon Sep 17 00:00:00 2001 From: Et7f3 Date: Fri, 14 Aug 2020 14:59:25 +0200 Subject: [PATCH 12/12] move 10.13/10.14 to 10.14/10.15 https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml ``` macOS X Mojave 10.14 macOS-10.14 macOS-10.14 Link macOS X Catalina 10.15 macOS-10.15 macOS-latest OR macOS-10.15 Link ``` --- azure-pipelines.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 272a43903..379c553ad 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -9,17 +9,17 @@ jobs: steps: - template: .ci/esy-build-steps.yml -- job: MacOS13 +- job: MacOS14 displayName: "MacOS Mojave" pool: - vmImage: 'macOS 10.13' + vmImage: 'macOS 10.14' steps: - template: .ci/esy-build-steps.yml -- job: MacOS14 - displayName: "MacOS High Sierra" +- job: MacOS15 + displayName: "MacOS Catalina" pool: - vmImage: 'macOS 10.14' + vmImage: 'macOS 10.15' steps: - template: .ci/esy-build-steps.yml