tizen 2.4 release
[framework/uifw/xorg/server/xorg-server.git] / Xext / saver.c
index ac4a633..8e92fdf 100644 (file)
@@ -107,9 +107,7 @@ typedef struct _ScreenSaverSuspension {
     int count;
 } ScreenSaverSuspensionRec;
 
-static int ScreenSaverFreeSuspend(pointer /*value */ ,
-                                  XID   /* id */
-    );
+static int ScreenSaverFreeSuspend(void *value, XID id);
 
 /*
  * each screen has a list of clients requesting
@@ -131,18 +129,14 @@ typedef struct _ScreenSaverEvent {
     CARD32 mask;
 } ScreenSaverEventRec;
 
-static int ScreenSaverFreeEvents(pointer /* value */ ,
-                                 XID    /* id */
-    );
+static int ScreenSaverFreeEvents(void * value, XID id);
 
-static Bool setEventMask(ScreenPtr /* pScreen */ ,
-                         ClientPtr /* client */ ,
-                         unsigned long  /* mask */
-    );
+static Bool setEventMask(ScreenPtr      pScreen,
+                         ClientPtr      client,
+                         unsigned long  mask);
 
-static unsigned long getEventMask(ScreenPtr /* pScreen */ ,
-                                  ClientPtr     /* client */
-    );
+static unsigned long getEventMask(ScreenPtr     pScreen,
+                                  ClientPtr     client);
 
 /*
  * when a client sets the screen saver attributes, a resource is
@@ -168,21 +162,16 @@ typedef struct _ScreenSaverAttr {
     unsigned long *values;
 } ScreenSaverAttrRec, *ScreenSaverAttrPtr;
 
-static int ScreenSaverFreeAttr(pointer /* value */ ,
-                               XID      /* id */
-    );
+static int ScreenSaverFreeAttr(void *value, XID id);
 
-static void FreeAttrs(ScreenSaverAttrPtr        /* pAttr */
-    );
+static void FreeAttrs(ScreenSaverAttrPtr pAttr);
 
-static void FreeScreenAttr(ScreenSaverAttrPtr   /* pAttr */
-    );
+static void FreeScreenAttr(ScreenSaverAttrPtr pAttr);
 
 static void
- SendScreenSaverNotify(ScreenPtr /* pScreen */ ,
-                       int /* state */ ,
-                       Bool     /* forced */
-    );
+SendScreenSaverNotify(ScreenPtr pScreen,
+                      int       state,
+                      Bool      forced);
 
 typedef struct _ScreenSaverScreenPrivate {
     ScreenSaverEventPtr events;
@@ -191,8 +180,7 @@ typedef struct _ScreenSaverScreenPrivate {
     Colormap installedMap;
 } ScreenSaverScreenPrivateRec, *ScreenSaverScreenPrivatePtr;
 
-static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr  /* pScreen */
-    );
+static ScreenSaverScreenPrivatePtr MakeScreenPrivate(ScreenPtr pScreen);
 
 static DevPrivateKeyRec ScreenPrivateKeyRec;
 
@@ -288,7 +276,7 @@ setEventMask(ScreenPtr pScreen, ClientPtr client, unsigned long mask)
             pEv->client = client;
             pEv->screen = pScreen;
             pEv->resource = FakeClientID(client->index);
-            if (!AddResource(pEv->resource, SaverEventType, (pointer) pEv))
+            if (!AddResource(pEv->resource, SaverEventType, (void *) pEv))
                 return FALSE;
         }
         pEv->mask = mask;
@@ -319,7 +307,7 @@ FreeScreenAttr(ScreenSaverAttrPtr pAttr)
 }
 
 static int
-ScreenSaverFreeEvents(pointer value, XID id)
+ScreenSaverFreeEvents(void *value, XID id)
 {
     ScreenSaverEventPtr pOld = (ScreenSaverEventPtr) value;
     ScreenPtr pScreen = pOld->screen;
@@ -341,7 +329,7 @@ ScreenSaverFreeEvents(pointer value, XID id)
 }
 
 static int
-ScreenSaverFreeAttr(pointer value, XID id)
+ScreenSaverFreeAttr(void *value, XID id)
 {
     ScreenSaverAttrPtr pOldAttr = (ScreenSaverAttrPtr) value;
     ScreenPtr pScreen = pOldAttr->screen;
@@ -363,7 +351,7 @@ ScreenSaverFreeAttr(pointer value, XID id)
 }
 
 static int
-ScreenSaverFreeSuspend(pointer value, XID id)
+ScreenSaverFreeSuspend(void *value, XID id)
 {
     ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value;
     ScreenSaverSuspensionPtr *prev, this;
@@ -392,7 +380,7 @@ ScreenSaverFreeSuspend(pointer value, XID id)
             DeviceIntPtr dev;
             UpdateCurrentTimeIf();
             nt_list_for_each_entry(dev, inputInfo.devices, next)
-                lastDeviceEventTime[dev->id] = currentTime;
+                NoticeTime(dev, currentTime);
             SetScreenSaverTimer();
         }
     }
@@ -460,7 +448,7 @@ UninstallSaverColormap(ScreenPtr pScreen)
     int rc;
 
     if (pPriv && pPriv->installedMap != None) {
-        rc = dixLookupResourceByType((pointer *) &pCmap, pPriv->installedMap,
+        rc = dixLookupResourceByType((void **) &pCmap, pPriv->installedMap,
                                      RT_COLORMAP, serverClient,
                                      DixUninstallAccess);
         if (rc == Success)
@@ -529,15 +517,16 @@ CreateSaverWindow(ScreenPtr pScreen)
         mask |= CWBorderPixmap;
     }
     if (pAttr->pCursor) {
+        CursorPtr cursor;
         if (!pWin->optional)
             if (!MakeWindowOptional(pWin)) {
                 FreeResource(pWin->drawable.id, RT_NONE);
                 return FALSE;
             }
-        pAttr->pCursor->refcnt++;
+        cursor = RefCursor(pAttr->pCursor);
         if (pWin->optional->cursor)
             FreeCursor(pWin->optional->cursor, (Cursor) 0);
-        pWin->optional->cursor = pAttr->pCursor;
+        pWin->optional->cursor = cursor;
         pWin->cursorIsNone = FALSE;
         CheckWindowOptionalNeed(pWin);
         mask |= CWCursor;
@@ -570,7 +559,7 @@ CreateSaverWindow(ScreenPtr pScreen)
     if (i < numInstalled)
         return TRUE;
 
-    result = dixLookupResourceByType((pointer *) &pCmap, wantMap, RT_COLORMAP,
+    result = dixLookupResourceByType((void **) &pCmap, wantMap, RT_COLORMAP,
                                      serverClient, DixInstallAccess);
     if (result != Success)
         return TRUE;
@@ -678,7 +667,7 @@ ProcScreenSaverQueryInfo(ClientPtr client)
     pPriv = GetScreenPrivate(pDraw->pScreen);
 
     UpdateCurrentTime();
-    lastInput = GetTimeInMillis() - lastDeviceEventTime[XIAllDevices].milliseconds;
+    lastInput = GetTimeInMillis() - LastEventTime(XIAllDevices).milliseconds;
 
     rep = (xScreenSaverQueryInfoReply) {
         .type = X_Reply,
@@ -835,7 +824,7 @@ ScreenSaverSetAttributes(ClientPtr client)
     if ((visual != ancwopt->visual) || (depth != pParent->drawable.depth)) {
         fOK = FALSE;
         for (idepth = 0; idepth < pScreen->numDepths; idepth++) {
-            pDepth = (DepthPtr) & pScreen->allowedDepths[idepth];
+            pDepth = (DepthPtr) &pScreen->allowedDepths[idepth];
             if ((depth == pDepth->depth) || (depth == 0)) {
                 for (ivisual = 0; ivisual < pDepth->numVids; ivisual++) {
                     if (visual == pDepth->vids[ivisual]) {
@@ -922,7 +911,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             }
             else {
                 ret =
-                    dixLookupResourceByType((pointer *) &pPixmap, pixID,
+                    dixLookupResourceByType((void **) &pPixmap, pixID,
                                             RT_PIXMAP, client, DixReadAccess);
                 if (ret == Success) {
                     if ((pPixmap->drawable.depth != depth) ||
@@ -954,7 +943,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             }
             else {
                 ret =
-                    dixLookupResourceByType((pointer *) &pPixmap, pixID,
+                    dixLookupResourceByType((void **) &pPixmap, pixID,
                                             RT_PIXMAP, client, DixReadAccess);
                 if (ret == Success) {
                     if ((pPixmap->drawable.depth != depth) ||
@@ -1038,7 +1027,7 @@ ScreenSaverSetAttributes(ClientPtr client)
             break;
         case CWColormap:
             cmap = (Colormap) * pVlist;
-            ret = dixLookupResourceByType((pointer *) &pCmap, cmap, RT_COLORMAP,
+            ret = dixLookupResourceByType((void **) &pCmap, cmap, RT_COLORMAP,
                                           client, DixUseAccess);
             if (ret != Success) {
                 client->errorValue = cmap;
@@ -1057,14 +1046,13 @@ ScreenSaverSetAttributes(ClientPtr client)
                 *values++ = None;
             }
             else {
-                ret = dixLookupResourceByType((pointer *) &pCursor, cursorID,
+                ret = dixLookupResourceByType((void **) &pCursor, cursorID,
                                               RT_CURSOR, client, DixUseAccess);
                 if (ret != Success) {
                     client->errorValue = cursorID;
                     goto PatchUp;
                 }
-                pCursor->refcnt++;
-                pAttr->pCursor = pCursor;
+                pAttr->pCursor = RefCursor(pCursor);
                 pAttr->mask &= ~CWCursor;
             }
             break;
@@ -1079,7 +1067,7 @@ ScreenSaverSetAttributes(ClientPtr client)
         FreeScreenAttr(pPriv->attr);
     pPriv->attr = pAttr;
     pAttr->resource = FakeClientID(client->index);
-    if (!AddResource(pAttr->resource, AttrType, (pointer) pAttr))
+    if (!AddResource(pAttr->resource, AttrType, (void *) pAttr))
         return BadAlloc;
     return Success;
  PatchUp:
@@ -1131,7 +1119,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
 
         REQUEST_AT_LEAST_SIZE(xScreenSaverSetAttributesReq);
 
-        status = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+        status = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                           XRC_DRAWABLE, client, DixWriteAccess);
         if (status != Success)
             return (status == BadValue) ? BadDrawable : status;
@@ -1146,7 +1134,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
             pback_offset = Ones((Mask) stuff->mask & (CWBackPixmap - 1));
             tmp = *((CARD32 *) &stuff[1] + pback_offset);
             if ((tmp != None) && (tmp != ParentRelative)) {
-                status = dixLookupResourceByType((pointer *) &backPix, tmp,
+                status = dixLookupResourceByType((void **) &backPix, tmp,
                                                  XRT_PIXMAP, client,
                                                  DixReadAccess);
                 if (status != Success)
@@ -1158,7 +1146,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
             pbord_offset = Ones((Mask) stuff->mask & (CWBorderPixmap - 1));
             tmp = *((CARD32 *) &stuff[1] + pbord_offset);
             if (tmp != CopyFromParent) {
-                status = dixLookupResourceByType((pointer *) &bordPix, tmp,
+                status = dixLookupResourceByType((void **) &bordPix, tmp,
                                                  XRT_PIXMAP, client,
                                                  DixReadAccess);
                 if (status != Success)
@@ -1170,7 +1158,7 @@ ProcScreenSaverSetAttributes(ClientPtr client)
             cmap_offset = Ones((Mask) stuff->mask & (CWColormap - 1));
             tmp = *((CARD32 *) &stuff[1] + cmap_offset);
             if ((tmp != CopyFromParent) && (tmp != None)) {
-                status = dixLookupResourceByType((pointer *) &cmap, tmp,
+                status = dixLookupResourceByType((void **) &cmap, tmp,
                                                  XRT_COLORMAP, client,
                                                  DixReadAccess);
                 if (status != Success)
@@ -1211,7 +1199,7 @@ ProcScreenSaverUnsetAttributes(ClientPtr client)
         PanoramiXRes *draw;
         int rc, i;
 
-        rc = dixLookupResourceByClass((pointer *) &draw, stuff->drawable,
+        rc = dixLookupResourceByClass((void **) &draw, stuff->drawable,
                                       XRC_DRAWABLE, client, DixWriteAccess);
         if (rc != Success)
             return (rc == BadValue) ? BadDrawable : rc;
@@ -1270,7 +1258,7 @@ ProcScreenSaverSuspend(ClientPtr client)
     this->count = 1;
     this->clientResource = FakeClientID(client->index);
 
-    if (!AddResource(this->clientResource, SuspendType, (pointer) this)) {
+    if (!AddResource(this->clientResource, SuspendType, (void *) this)) {
         free(this);
         return BadAlloc;
     }