Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 16 additions & 28 deletions xfixes/cursor.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;

Expand Down Expand Up @@ -1017,9 +1006,8 @@ XFixesCursorInit(void)

if (pInvisibleCursor == NULL) {
pInvisibleCursor = createInvisibleCursor();
if (pInvisibleCursor == NULL) {
if (pInvisibleCursor == NULL)
return BadAlloc;
}
}

return CursorClientType && CursorWindowType;
Expand Down