# SDL: Fix GetGlobalMouseState when xi2 is not available at runtime (7d55c)

**URL:** <https://discourse.libsdl.org/t/sdl-fix-getglobalmousestate-when-xi2-is-not-available-at-runtime-7d55c/42662>\
**Category:** SDL Commits\
**Created:** [February 19, 2023, 5:58pm UTC](https://discourse.libsdl.org/t/sdl-fix-getglobalmousestate-when-xi2-is-not-available-at-runtime-7d55c/42662 "2023-02-19T17:58:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![SDLPushPostBot](https://discourse.libsdl.org/user_avatar/discourse.libsdl.org/sdlpushpostbot/32/4370_2.png) [@SDLPushPostBot](https://discourse.libsdl.org/u/SDLPushPostBot)\
**Post date:** [February 19, 2023, 5:58pm UTC](https://discourse.libsdl.org/t/sdl-fix-getglobalmousestate-when-xi2-is-not-available-at-runtime-7d55c/42662/1 "2023-02-19T17:58:08Z")

</div>

> <https://github.com/libsdl-org/SDL/commit/7d55ccb8b04f2b1d88a959a55a51bb788fc531f4>
>
> (cherry picked from commit 0123d6311d5c0059d617324426ef7eef8d577d9b)

```diff
From 7d55ccb8b04f2b1d88a959a55a51bb788fc531f4 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[EMAIL REDACTED]>
Date: Sun, 19 Feb 2023 16:04:47 +0200
Subject: [PATCH] Fix GetGlobalMouseState when xi2 is not available at runtime

(cherry picked from commit 0123d6311d5c0059d617324426ef7eef8d577d9b)
---
 src/video/x11/SDL_x11mouse.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/video/x11/SDL_x11mouse.c b/src/video/x11/SDL_x11mouse.c
index 786e219ebedc..978a3058479d 100644
--- a/src/video/x11/SDL_x11mouse.c
+++ b/src/video/x11/SDL_x11mouse.c
@@ -416,6 +416,9 @@ static Uint32 X11_GetGlobalMouseState(int *x, int *y)
 
 #if !SDL_VIDEO_DRIVER_X11_XINPUT2
     videodata->global_mouse_changed = SDL_TRUE;
+#else
+ if (!SDL_X11_HAVE_XINPUT2)
+ videodata->global_mouse_changed = SDL_TRUE;
 #endif
 
     /* check if we have this cached since XInput last saw the mouse move. */

```
