wintab32: Better handling of XInput initialisation errors.
This commit is contained in:
parent
af0a4b6956
commit
0ea8bf17fa
|
@ -484,7 +484,7 @@ static void disable_system_cursors(void)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* X11DRV_LoadTabletInfo (X11DRV.@)
|
* X11DRV_LoadTabletInfo (X11DRV.@)
|
||||||
*/
|
*/
|
||||||
void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
||||||
{
|
{
|
||||||
const WCHAR SZ_CONTEXT_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','C','o','n','t','e','x','t',0};
|
const WCHAR SZ_CONTEXT_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','C','o','n','t','e','x','t',0};
|
||||||
const WCHAR SZ_DEVICE_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','D','e','v','i','c','e',0};
|
const WCHAR SZ_DEVICE_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','D','e','v','i','c','e',0};
|
||||||
|
@ -507,7 +507,7 @@ void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
||||||
if (!X11DRV_XInput_Init())
|
if (!X11DRV_XInput_Init())
|
||||||
{
|
{
|
||||||
ERR("Unable to initialize the XInput library.\n");
|
ERR("Unable to initialize the XInput library.\n");
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwndTabletDefault = hwnddefault;
|
hwndTabletDefault = hwnddefault;
|
||||||
|
@ -555,9 +555,9 @@ void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
||||||
devices = pXListInputDevices(data->display, &num_devices);
|
devices = pXListInputDevices(data->display, &num_devices);
|
||||||
if (!devices)
|
if (!devices)
|
||||||
{
|
{
|
||||||
WARN("XInput Extensions reported as not avalable\n");
|
WARN("XInput Extensions reported as not available\n");
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
return;
|
return FALSE;
|
||||||
}
|
}
|
||||||
TRACE("XListInputDevices reports %d devices\n", num_devices);
|
TRACE("XListInputDevices reports %d devices\n", num_devices);
|
||||||
for (loop=0; loop < num_devices; loop++)
|
for (loop=0; loop < num_devices; loop++)
|
||||||
|
@ -778,6 +778,7 @@ void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
||||||
}
|
}
|
||||||
|
|
||||||
wine_tsx11_unlock();
|
wine_tsx11_unlock();
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int figure_deg(int x, int y)
|
static int figure_deg(int x, int y)
|
||||||
|
@ -971,7 +972,7 @@ int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner)
|
||||||
XEventClass event_list[7];
|
XEventClass event_list[7];
|
||||||
Window win = X11DRV_get_whole_window( hOwner );
|
Window win = X11DRV_get_whole_window( hOwner );
|
||||||
|
|
||||||
if (!win) return 0;
|
if (!win || !xinput_handle) return 0;
|
||||||
|
|
||||||
TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors);
|
TRACE("Creating context for window %p (%lx) %i cursors\n", hOwner, win, gNumCursors);
|
||||||
|
|
||||||
|
@ -1080,6 +1081,8 @@ UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput)
|
||||||
LPWTI_CURSORS_INFO tgtcursor;
|
LPWTI_CURSORS_INFO tgtcursor;
|
||||||
TRACE("(%u, %u, %p)\n", wCategory, nIndex, lpOutput);
|
TRACE("(%u, %u, %p)\n", wCategory, nIndex, lpOutput);
|
||||||
|
|
||||||
|
if (!xinput_handle) return 0;
|
||||||
|
|
||||||
switch(wCategory)
|
switch(wCategory)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -1512,8 +1515,9 @@ int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet)
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* LoadTabletInfo (X11DRV.@)
|
* LoadTabletInfo (X11DRV.@)
|
||||||
*/
|
*/
|
||||||
void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
BOOL CDECL X11DRV_LoadTabletInfo(HWND hwnddefault)
|
||||||
{
|
{
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
|
|
@ -42,7 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintab32);
|
||||||
* http://www.csl.sony.co.jp/projects/ar/restricted/wintabl.html
|
* http://www.csl.sony.co.jp/projects/ar/restricted/wintabl.html
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static BOOL gLoaded;
|
|
||||||
static LPOPENCONTEXT gOpenContexts;
|
static LPOPENCONTEXT gOpenContexts;
|
||||||
static HCTX gTopContext = (HCTX)0xc00;
|
static HCTX gTopContext = (HCTX)0xc00;
|
||||||
|
|
||||||
|
@ -151,12 +150,26 @@ static LPOPENCONTEXT TABLET_FindOpenContext(HCTX hCtx)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void LoadTablet(void)
|
static inline BOOL LoadTablet(void)
|
||||||
{
|
{
|
||||||
|
static enum {TI_START = 0, TI_OK, TI_FAIL} loaded = TI_START;
|
||||||
|
|
||||||
|
if (loaded == TI_START)
|
||||||
|
{
|
||||||
TRACE("Initializing the tablet to hwnd %p\n",hwndDefault);
|
TRACE("Initializing the tablet to hwnd %p\n",hwndDefault);
|
||||||
gLoaded= TRUE;
|
|
||||||
if (pLoadTabletInfo)
|
if (pLoadTabletInfo && pLoadTabletInfo(hwndDefault))
|
||||||
pLoadTabletInfo(hwndDefault);
|
{
|
||||||
|
loaded = TI_OK;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
loaded = TI_FAIL;
|
||||||
|
ERR("LoadTabletInfo(%p) failed\n", hwndDefault);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return loaded == TI_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam,
|
int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam,
|
||||||
|
@ -366,9 +379,9 @@ static UINT WTInfoT(UINT wCategory, UINT nIndex, LPVOID lpOutput, BOOL bUnicode)
|
||||||
{
|
{
|
||||||
UINT result;
|
UINT result;
|
||||||
|
|
||||||
|
if (!LoadTablet()) return 0;
|
||||||
|
|
||||||
TRACE("(%d, %d, %p, %d)\n", wCategory, nIndex, lpOutput, bUnicode);
|
TRACE("(%d, %d, %p, %d)\n", wCategory, nIndex, lpOutput, bUnicode);
|
||||||
if (gLoaded == FALSE)
|
|
||||||
LoadTablet();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Handle system extents here, as we can use user32.dll code to set them.
|
* Handle system extents here, as we can use user32.dll code to set them.
|
||||||
|
@ -450,6 +463,8 @@ HCTX WINAPI WTOpenW(HWND hWnd, LPLOGCONTEXTW lpLogCtx, BOOL fEnable)
|
||||||
{
|
{
|
||||||
LPOPENCONTEXT newcontext;
|
LPOPENCONTEXT newcontext;
|
||||||
|
|
||||||
|
if (!LoadTablet()) return 0;
|
||||||
|
|
||||||
TRACE("hWnd=%p, lpLogCtx=%p, fEnable=%u\n", hWnd, lpLogCtx, fEnable);
|
TRACE("hWnd=%p, lpLogCtx=%p, fEnable=%u\n", hWnd, lpLogCtx, fEnable);
|
||||||
DUMPCONTEXT(*lpLogCtx);
|
DUMPCONTEXT(*lpLogCtx);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue