@@ -283,6 +283,7 @@ static X11_PenHandle *X11_MaybeAddPen(SDL_VideoDevice *_this, const XIDeviceInfo
283
283
284
284
X11_PenHandle * X11_MaybeAddPenByDeviceID (SDL_VideoDevice * _this , int deviceid )
285
285
{
286
+ if (!X11_Xinput2IsInitialized ()) return NULL ;
286
287
SDL_VideoData * data = _this -> internal ;
287
288
int num_device_info = 0 ;
288
289
XIDeviceInfo * device_info = X11_XIQueryDevice (data -> display , deviceid , & num_device_info );
@@ -297,6 +298,7 @@ X11_PenHandle *X11_MaybeAddPenByDeviceID(SDL_VideoDevice *_this, int deviceid)
297
298
298
299
void X11_RemovePenByDeviceID (int deviceid )
299
300
{
301
+ if (!X11_Xinput2IsInitialized ()) return ;
300
302
X11_PenHandle * handle = X11_FindPenByDeviceID (deviceid );
301
303
if (handle ) {
302
304
SDL_RemovePenDevice (0 , handle -> pen );
@@ -306,6 +308,7 @@ void X11_RemovePenByDeviceID(int deviceid)
306
308
307
309
void X11_InitPen (SDL_VideoDevice * _this )
308
310
{
311
+ if (!X11_Xinput2IsInitialized ()) return ;
309
312
SDL_VideoData * data = _this -> internal ;
310
313
311
314
#define LOOKUP_PEN_ATOM (X ) X11_XInternAtom(data->display, X, False)
@@ -335,6 +338,7 @@ static void X11_FreePenHandle(SDL_PenID instance_id, void *handle, void *userdat
335
338
336
339
void X11_QuitPen (SDL_VideoDevice * _this )
337
340
{
341
+ if (!X11_Xinput2IsInitialized ()) return ;
338
342
SDL_RemoveAllPenDevices (X11_FreePenHandle , NULL );
339
343
}
340
344
0 commit comments