diff --git a/xfixes/cursor.c b/xfixes/cursor.c index 4dfd1e1..5148c96 100644 --- a/xfixes/cursor.c +++ b/xfixes/cursor.c @@ -136,12 +136,10 @@ CursorDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor) Unwrap(cs, pScreen, DisplayCursor); - if (cs->pCursorHideCounts != NULL) { + if (cs->pCursorHideCounts != NULL) ret = (*pScreen->DisplayCursor) (pScreen, pInvisibleCursor); - } - else { + else ret = (*pScreen->DisplayCursor) (pScreen, pCursor); - } if (pCursor != CursorCurrent) { CursorEventPtr e; @@ -190,14 +188,12 @@ XFixesSelectCursorInput(ClientPtr pClient, WindowPtr pWindow, CARD32 eventMask) CursorEventPtr *prev, e; for (prev = &cursorEvents; (e = *prev); prev = &e->next) { - if (e->pClient == pClient && e->pWindow == pWindow) { + if (e->pClient == pClient && e->pWindow == pWindow) break; - } } if (!eventMask) { - if (e) { + if (e) FreeResource(e->clientResource, 0); - } return Success; } if (!e) { @@ -735,9 +731,8 @@ findCursorHideCount(ClientPtr pClient, ScreenPtr pScreen) CursorHideCountPtr pChc; for (pChc = cs->pCursorHideCounts; pChc != NULL; pChc = pChc->pNext) { - if (pChc->pClient == pClient) { + if (pChc->pClient == pClient) return pChc; - } } return NULL; @@ -750,9 +745,9 @@ createCursorHideCount(ClientPtr pClient, ScreenPtr pScreen) CursorHideCountPtr pChc; pChc = malloc(sizeof(CursorHideCountRec)); - if (pChc == NULL) { + if (pChc == NULL) return BadAlloc; - } + pChc->pClient = pClient; pChc->pScreen = pScreen; pChc->hideCount = 1; @@ -787,12 +782,10 @@ deleteCursorHideCount(CursorHideCountPtr pChcToDel, ScreenPtr pScreen) pNext = pChc->pNext; if (pChc == pChcToDel) { free(pChc); - if (pChcLast == NULL) { + if (pChcLast == NULL) cs->pCursorHideCounts = pNext; - } - else { + else pChcLast->pNext = pNext; - } return; } pChcLast = pChc; @@ -852,9 +845,8 @@ ProcXFixesHideCursor(ClientPtr client) */ ret = createCursorHideCount(client, pWin->drawable.pScreen); - if (ret == Success) { + if (ret == Success) (void) CursorDisplayCursor(pWin->drawable.pScreen, CursorCurrent); - } return ret; } @@ -892,14 +884,12 @@ ProcXFixesShowCursor(ClientPtr client) * If not, generate an error. */ pChc = findCursorHideCount(client, pWin->drawable.pScreen); - if (pChc == NULL) { + if (pChc == NULL) return BadMatch; - } pChc->hideCount--; - if (pChc->hideCount <= 0) { + if (pChc->hideCount <= 0) FreeResource(pChc->resource, 0); - } return (client->noClientException); } @@ -952,9 +942,8 @@ CursorFreeWindow(pointer data, XID id) for (e = cursorEvents; e; e = next) { next = e->next; - if (e->pWindow == pWindow) { + if (e->pWindow == pWindow) FreeResource(e->clientResource, 0); - } } return 1; } @@ -970,9 +959,9 @@ createInvisibleCursor(void) psrcbits = malloc(4); pmaskbits = malloc(4); - if (psrcbits == NULL || pmaskbits == NULL) { + if (psrcbits == NULL || pmaskbits == NULL) return NULL; - } + *psrcbits = 0; *pmaskbits = 0; @@ -1017,9 +1006,8 @@ XFixesCursorInit(void) if (pInvisibleCursor == NULL) { pInvisibleCursor = createInvisibleCursor(); - if (pInvisibleCursor == NULL) { + if (pInvisibleCursor == NULL) return BadAlloc; - } } return CursorClientType && CursorWindowType;