From 30ddfdcc0bcab2e5a6a1b0b56cab35459ce7e274 Mon Sep 17 00:00:00 2001 From: John Klehm Date: Sat, 31 May 2008 16:16:23 -0500 Subject: winex11.drv: Cursor iteration is now done by checking ACTIVE cursors. --- dlls/winex11.drv/wintab.c | 33 ++++++++++++++++++++++++--------- 1 files changed, 24 insertions(+), 9 deletions(-) diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index fd80cdb..a19d02f 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -307,7 +307,7 @@ static INT button_state[10]; static LOGCONTEXTW gSysContext; static WTI_DEVICES_INFO gSysDevice; static WTI_CURSORS_INFO gSysCursor[CURSORMAX]; -static INT gNumCursors; +static INT gNumCursors; /* do NOT use this to iterate through gSysCursor slots */ /* XInput stuff */ @@ -493,6 +493,18 @@ static BOOL is_eraser(const char *name, const char *type) return FALSE; } +static void disable_system_cursors(void) +{ + UINT i; + + for (i = 0; i < CURSORMAX; ++i) + { + gSysCursor[i].ACTIVE = 0; + } + + gNumCursors = 0; +} + /*********************************************************************** * X11DRV_LoadTabletInfo (X11DRV.@) @@ -552,6 +564,9 @@ void X11DRV_LoadTabletInfo(HWND hwnddefault) gSysContext.lcSysSensX= 65536; gSysContext.lcSysSensY= 65536; + /* initialize cursors */ + disable_system_cursors(); + /* Device Defaults */ gSysDevice.HARDWARE = HWC_HARDPROX|HWC_PHYSID_CURSORS; gSysDevice.FIRSTCSR= 0; @@ -856,8 +871,8 @@ static void set_button_state(int curnum, XID deviceid) static int cursor_from_device(DWORD deviceid, LPWTI_CURSORS_INFO *cursorp) { int i; - for (i = 0; i < gNumCursors; i++) - if (gSysCursor[i].PHYSID == deviceid) + for (i = 0; i < CURSORMAX; i++) + if (gSysCursor[i].ACTIVE && gSysCursor[i].PHYSID == deviceid) { *cursorp = &gSysCursor[i]; return i; @@ -997,11 +1012,13 @@ int X11DRV_AttachEventQueueToTablet(HWND hOwner) devices = pXListInputDevices(data->display, &num_devices); X11DRV_expect_error(data->display,Tablet_ErrorHandler,NULL); - for (cur_loop=0; cur_loop < gNumCursors; cur_loop++) + for (cur_loop=0; cur_loop < CURSORMAX; cur_loop++) { char cursorNameA[WT_MAX_NAME_LEN]; int event_number=0; + if (!gSysCursor[cur_loop].ACTIVE) continue; + /* the cursor name fits in the buffer because too long names are skipped */ WideCharToMultiByte(CP_UNIXCP, 0, gSysCursor[cur_loop].NAME, -1, cursorNameA, WT_MAX_NAME_LEN, NULL, NULL); for (loop=0; loop < num_devices; loop ++) @@ -1295,12 +1312,10 @@ UINT X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) case WTI_CURSORS+7: case WTI_CURSORS+8: case WTI_CURSORS+9: - if (wCategory - WTI_CURSORS >= gNumCursors) - { + /* Apps will poll different slots to detect what cursors are available + * if there isn't a cursor for this slot return 0 */ + if (!gSysCursor[wCategory - WTI_CURSORS].ACTIVE) rc = 0; - WARN("Requested cursor information for nonexistent cursor %d; only %d cursors\n", - wCategory - WTI_CURSORS, gNumCursors); - } else { tgtcursor = &gSysCursor[wCategory - WTI_CURSORS]; -- 1.5.4.3