[client] x11: don't care if SDL has XInput support anymore

As the X11 code is all self contained now and can be disabled at
configure time there is no longer any need to check if SDL has X11
XInput support.
This commit is contained in:
Geoffrey McRae 2021-01-19 05:29:25 +11:00
parent 85ee6737d5
commit 16f88a5285
2 changed files with 19 additions and 12 deletions

View File

@ -26,13 +26,9 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <string.h>
#include <unistd.h>
#if SDL_VIDEO_DRIVER_X11_XINPUT2
#include <X11/extensions/XInput2.h>
#endif
#include <X11/extensions/Xfixes.h>
#include "app.h"
#include "common/debug.h"
@ -89,10 +85,16 @@ static bool x11Init(SDL_SysWMinfo * info)
int event, error;
// enable X11 events to work around SDL2 bugs
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
int major = 2;
int minor = 3;
if (XIQueryVersion(x11.display, &major, &minor) != Success)
{
DEBUG_ERROR("Failed to query the XInput version");
return false;
}
DEBUG_INFO("X11 XInput %d.%d in use", major, minor);
#if SDL_VIDEO_DRIVER_X11_XINPUT2
XQueryExtension(x11.display, "XInputExtension", &x11.xinputOp, &event, &error);
int num_masks;
@ -112,9 +114,14 @@ static bool x11Init(SDL_SysWMinfo * info)
XISetMask(mask[i].mask, XI_KeyRelease );
}
XISelectEvents(x11.display, x11.window, mask, num_masks);
if (XISelectEvents(x11.display, x11.window, mask, num_masks) != Success)
{
XFree(mask);
DEBUG_ERROR("Failed to select the xinput events");
return false;
}
XFree(mask);
#endif
Atom NETWM_BYPASS_COMPOSITOR = XInternAtom(x11.display,
"NETWM_BYPASS_COMPOSITOR", False);
@ -283,8 +290,6 @@ static bool x11EventFilter(SDL_Event * event)
return true;
}
#if SDL_VIDEO_DRIVER_X11_XINPUT2
/* support movements via XInput2 */
case GenericEvent:
{
XGenericEventCookie *cookie = (XGenericEventCookie*)&xe.xcookie;
@ -402,7 +407,6 @@ static bool x11EventFilter(SDL_Event * event)
return false;
}
#endif
// clipboard events
case SelectionRequest:

View File

@ -1930,6 +1930,9 @@ static int lg_run(void)
return -1;
}
// enable WM events
SDL_EventState(SDL_SYSWMEVENT, SDL_ENABLE);
g_state.ds->init(&g_state.wminfo);
SDL_SetHint(SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS,