summaryrefslogtreecommitdiff
path: root/Xext/saver.c
diff options
context:
space:
mode:
Diffstat (limited to 'Xext/saver.c')
-rw-r--r--Xext/saver.c165
1 files changed, 124 insertions, 41 deletions
diff --git a/Xext/saver.c b/Xext/saver.c
index 463622391..944009773 100644
--- a/Xext/saver.c
+++ b/Xext/saver.c
@@ -1,6 +1,5 @@
/*
* $XConsortium: saver.c,v 1.12 94/04/17 20:59:36 dpw Exp $
- * $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.4 2001/08/23 13:01:36 alanh Exp $
*
Copyright (c) 1992 X Consortium
@@ -28,6 +27,8 @@ in this Software without prior written authorization from the X Consortium.
* Author: Keith Packard, MIT X Consortium
*/
+/* $XFree86: xc/programs/Xserver/Xext/saver.c,v 3.8 2003/11/17 22:20:26 dawes Exp $ */
+
#define NEED_REPLIES
#define NEED_EVENTS
#include "X.h"
@@ -45,6 +46,11 @@ in this Software without prior written authorization from the X Consortium.
#include "gcstruct.h"
#include "cursorstr.h"
#include "colormapst.h"
+#ifdef PANORAMIX
+#include "panoramiX.h"
+#include "panoramiXsrv.h"
+#endif
+
#ifdef IN_MODULE
#include <xf86_ansic.h>
@@ -52,7 +58,11 @@ in this Software without prior written authorization from the X Consortium.
#include <stdio.h>
#endif
+#include "modinit.h"
+
+#if 0
static unsigned char ScreenSaverReqCode = 0;
+#endif
static int ScreenSaverEventBase = 0;
extern DISPATCH_PROC(ProcScreenSaverQueryInfo);
@@ -69,52 +79,38 @@ static DISPATCH_PROC(SProcScreenSaverSetAttributes);
static DISPATCH_PROC(SProcScreenSaverUnsetAttributes);
static Bool ScreenSaverHandle (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */,
int /* xstate */,
Bool /* force */
-#endif
);
static Bool
CreateSaverWindow (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */
-#endif
);
static Bool
DestroySaverWindow (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */
-#endif
);
static void
UninstallSaverColormap (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */
-#endif
);
static void
CheckScreenPrivate (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */
-#endif
);
static void SScreenSaverNotifyEvent (
-#if NeedFunctionPrototypes
xScreenSaverNotifyEvent * /* from */,
xScreenSaverNotifyEvent * /* to */
-#endif
);
static void ScreenSaverResetProc (
-#if NeedFunctionPrototypes
ExtensionEntry * /* extEntry */
-#endif
);
/*
@@ -138,25 +134,19 @@ typedef struct _ScreenSaverEvent {
} ScreenSaverEventRec;
static int ScreenSaverFreeEvents(
-#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
-#endif
);
static Bool setEventMask (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */,
ClientPtr /* client */,
unsigned long /* mask */
-#endif
);
static unsigned long getEventMask (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */,
ClientPtr /* client */
-#endif
);
/*
@@ -184,31 +174,23 @@ typedef struct _ScreenSaverAttr {
} ScreenSaverAttrRec, *ScreenSaverAttrPtr;
static int ScreenSaverFreeAttr (
-#if NeedFunctionPrototypes
pointer /* value */,
XID /* id */
-#endif
);
static void FreeAttrs (
-#if NeedFunctionPrototypes
ScreenSaverAttrPtr /* pAttr */
-#endif
);
static void FreeScreenAttr (
-#if NeedFunctionPrototypes
ScreenSaverAttrPtr /* pAttr */
-#endif
);
static void
SendScreenSaverNotify (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */,
int /* state */,
Bool /* forced */
-#endif
);
typedef struct _ScreenSaverScreenPrivate {
@@ -220,9 +202,7 @@ typedef struct _ScreenSaverScreenPrivate {
static ScreenSaverScreenPrivatePtr
MakeScreenPrivate (
-#if NeedFunctionPrototypes
ScreenPtr /* pScreen */
-#endif
);
static int ScreenPrivateIndex;
@@ -242,7 +222,7 @@ static int ScreenPrivateIndex;
****************/
void
-ScreenSaverExtensionInit()
+ScreenSaverExtensionInit(INITARGS)
{
ExtensionEntry *extEntry;
int i;
@@ -261,7 +241,9 @@ ScreenSaverExtensionInit()
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
ScreenSaverResetProc, StandardMinorOpcode)))
{
+#if 0
ScreenSaverReqCode = (unsigned char)extEntry->base;
+#endif
ScreenSaverEventBase = extEntry->eventBase;
EventSwapVector[ScreenSaverEventBase] = (EventSwapPtr) SScreenSaverNotifyEvent;
}
@@ -460,7 +442,6 @@ SendScreenSaverNotify (pScreen, state, forced)
xScreenSaverNotifyEvent ev;
ClientPtr client;
int kind;
- ScreenSaverStuffPtr pSaver;
UpdateCurrentTimeIf ();
mask = ScreenSaverNotifyMask;
@@ -470,7 +451,6 @@ SendScreenSaverNotify (pScreen, state, forced)
pPriv = GetScreenPrivate(pScreen);
if (!pPriv)
return;
- pSaver = &savedScreenInfo[pScreen->myNum];
if (pPriv->attr)
kind = ScreenSaverExternal;
else if (ScreenSaverBlanking != DontPreferBlanking)
@@ -696,7 +676,10 @@ ScreenSaverHandle (pScreen, xstate, force)
ret = TRUE;
}
- SendScreenSaverNotify (pScreen, state, force);
+#ifdef PANORAMIX
+ if(noPanoramiXExtension || !pScreen->myNum)
+#endif
+ SendScreenSaverNotify (pScreen, state, force);
return ret;
}
@@ -810,8 +793,7 @@ ProcScreenSaverSelectInput (client)
}
static int
-ProcScreenSaverSetAttributes (client)
- register ClientPtr client;
+ScreenSaverSetAttributes (ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
@@ -829,7 +811,6 @@ ProcScreenSaverSetAttributes (client)
WindowOptPtr ancwopt;
unsigned long *pVlist;
unsigned long *values = 0;
- int valuei;
unsigned long tmask, imask;
unsigned long val;
Pixmap pixID;
@@ -957,7 +938,6 @@ ProcScreenSaverSetAttributes (client)
ret = BadAlloc;
goto bail;
}
- valuei = 0;
pAttr->screen = pScreen;
pAttr->client = client;
pAttr->x = stuff->x;
@@ -1191,8 +1171,7 @@ bail:
}
static int
-ProcScreenSaverUnsetAttributes (client)
- register ClientPtr client;
+ScreenSaverUnsetAttributes (ClientPtr client)
{
REQUEST(xScreenSaverSetAttributesReq);
DrawablePtr pDraw;
@@ -1212,6 +1191,110 @@ ProcScreenSaverUnsetAttributes (client)
return Success;
}
+static int
+ProcScreenSaverSetAttributes (ClientPtr client)
+{
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ REQUEST(xScreenSaverSetAttributesReq);
+ PanoramiXRes *draw;
+ PanoramiXRes *backPix = NULL;
+ PanoramiXRes *bordPix = NULL;
+ PanoramiXRes *cmap = NULL;
+ int i, status = 0, len;
+ int pback_offset = 0, pbord_offset = 0, cmap_offset = 0;
+ XID orig_visual, tmp;
+
+ REQUEST_AT_LEAST_SIZE (xScreenSaverSetAttributesReq);
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ len = stuff->length - (sizeof(xScreenSaverSetAttributesReq) >> 2);
+ if (Ones(stuff->mask) != len)
+ return BadLength;
+
+ if((Mask)stuff->mask & CWBackPixmap) {
+ pback_offset = Ones((Mask)stuff->mask & (CWBackPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pback_offset);
+ if ((tmp != None) && (tmp != ParentRelative)) {
+ if(!(backPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
+ }
+ }
+
+ if ((Mask)stuff->mask & CWBorderPixmap) {
+ pbord_offset = Ones((Mask)stuff->mask & (CWBorderPixmap - 1));
+ tmp = *((CARD32 *) &stuff[1] + pbord_offset);
+ if (tmp != CopyFromParent) {
+ if(!(bordPix = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_PIXMAP, SecurityReadAccess)))
+ return BadPixmap;
+ }
+ }
+
+ if ((Mask)stuff->mask & CWColormap) {
+ cmap_offset = Ones((Mask)stuff->mask & (CWColormap - 1));
+ tmp = *((CARD32 *) &stuff[1] + cmap_offset);
+ if ((tmp != CopyFromParent) && (tmp != None)) {
+ if(!(cmap = (PanoramiXRes*) SecurityLookupIDByType(
+ client, tmp, XRT_COLORMAP, SecurityReadAccess)))
+ return BadColor;
+ }
+ }
+
+ orig_visual = stuff->visualID;
+
+ FOR_NSCREENS_BACKWARD(i) {
+ stuff->drawable = draw->info[i].id;
+ if (backPix)
+ *((CARD32 *) &stuff[1] + pback_offset) = backPix->info[i].id;
+ if (bordPix)
+ *((CARD32 *) &stuff[1] + pbord_offset) = bordPix->info[i].id;
+ if (cmap)
+ *((CARD32 *) &stuff[1] + cmap_offset) = cmap->info[i].id;
+
+ if (orig_visual != CopyFromParent)
+ stuff->visualID =
+ PanoramiXVisualTable[(orig_visual*MAXSCREENS) + i];
+
+ status = ScreenSaverSetAttributes(client);
+ }
+
+ return status;
+ }
+#endif
+
+ return ScreenSaverSetAttributes(client);
+}
+
+static int
+ProcScreenSaverUnsetAttributes (ClientPtr client)
+{
+#ifdef PANORAMIX
+ if(!noPanoramiXExtension) {
+ REQUEST(xScreenSaverUnsetAttributesReq);
+ PanoramiXRes *draw;
+ int i;
+
+ if(!(draw = (PanoramiXRes *)SecurityLookupIDByClass(
+ client, stuff->drawable, XRC_DRAWABLE, SecurityWriteAccess)))
+ return BadDrawable;
+
+ for(i = PanoramiXNumScreens - 1; i > 0; i--) {
+ stuff->drawable = draw->info[i].id;
+ ScreenSaverUnsetAttributes(client);
+ }
+
+ stuff->drawable = draw->info[0].id;
+ }
+#endif
+
+ return ScreenSaverUnsetAttributes(client);
+}
+
static DISPATCH_PROC((*NormalVector[])) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,