File 14833.diff of Package SDL3

diff --git a/src/video/android/SDL_androidpen.c b/src/video/android/SDL_androidpen.c
index 7ce2acbea4c90..f54bf7f3f2309 100644
--- a/src/video/android/SDL_androidpen.c
+++ b/src/video/android/SDL_androidpen.c
@@ -59,6 +59,9 @@ void Android_OnPen(SDL_Window *window, int pen_id_in, SDL_PenDeviceType device_t
         }
     }
 
+    if (action == ACTION_HOVER_ENTER)
+        SDL_SendPenProximity(0, pen, window, true);
+
     SDL_SendPenMotion(0, pen, window, x, y);
     SDL_SendPenAxis(0, pen, window, SDL_PEN_AXIS_PRESSURE, p);
     // TODO: add more axis
@@ -77,10 +80,6 @@ void Android_OnPen(SDL_Window *window, int pen_id_in, SDL_PenDeviceType device_t
     // button contains DOWN/ERASER_TIP on DOWN/UP regardless of pressed state, use action to distinguish
     // we don't compare tip flags above because MotionEvent.getButtonState doesn't return stylus tip/eraser state.
     switch (action) {
-    case ACTION_HOVER_ENTER:
-        SDL_SendPenProximity(0, pen, window, true);
-        break;
-
     case ACTION_CANCEL:
     case ACTION_HOVER_EXIT:  // strictly speaking, this can mean both "proximity out" and "left the View" but close enough.
         SDL_SendPenProximity(0, pen, window, false);
diff --git a/src/video/x11/SDL_x11xinput2.c b/src/video/x11/SDL_x11xinput2.c
index 30deb118a8bbf..a32a02f3e4ec2 100644
--- a/src/video/x11/SDL_x11xinput2.c
+++ b/src/video/x11/SDL_x11xinput2.c
@@ -658,6 +658,8 @@ void X11_HandleXinput2Event(SDL_VideoDevice *_this, XGenericEventCookie *cookie)
             }
 
             SDL_Window *window = xinput2_get_sdlwindow(videodata, xev->event);
+            // We may receive motion event before proximity event, so add this as a workaround to keep event order sane
+            SDL_SendPenProximity(0, pen->pen, window, true);
             SDL_SendPenMotion(0, pen->pen, window, (float) xev->event_x, (float) xev->event_y);
 
             float axes[SDL_PEN_AXIS_COUNT];
openSUSE Build Service is sponsored by