aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/programs/Xserver/Xext
diff options
context:
space:
mode:
Diffstat (limited to 'nx-X11/programs/Xserver/Xext')
-rw-r--r--nx-X11/programs/Xserver/Xext/dpms.c6
-rw-r--r--nx-X11/programs/Xserver/Xext/panoramiX.c31
-rw-r--r--nx-X11/programs/Xserver/Xext/saver.c149
-rw-r--r--nx-X11/programs/Xserver/Xext/sleepuntil.c2
-rw-r--r--nx-X11/programs/Xserver/Xext/sync.c12
-rw-r--r--nx-X11/programs/Xserver/Xext/xres.c4
-rw-r--r--nx-X11/programs/Xserver/Xext/xvmain.c6
7 files changed, 187 insertions, 23 deletions
diff --git a/nx-X11/programs/Xserver/Xext/dpms.c b/nx-X11/programs/Xserver/Xext/dpms.c
index e05a70621..74969bb52 100644
--- a/nx-X11/programs/Xserver/Xext/dpms.c
+++ b/nx-X11/programs/Xserver/Xext/dpms.c
@@ -183,12 +183,12 @@ ProcDPMSSetTimeouts(client)
client->errorValue = stuff->suspend;
return BadValue;
}
-
+
DPMSStandbyTime = stuff->standby * MILLI_PER_SECOND;
DPMSSuspendTime = stuff->suspend * MILLI_PER_SECOND;
DPMSOffTime = stuff->off * MILLI_PER_SECOND;
- SetDPMSTimers();
-
+ SetScreenSaverTimer();
+
return(client->noClientException);
}
diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.c b/nx-X11/programs/Xserver/Xext/panoramiX.c
index e720965d4..e36d04d9e 100644
--- a/nx-X11/programs/Xserver/Xext/panoramiX.c
+++ b/nx-X11/programs/Xserver/Xext/panoramiX.c
@@ -72,10 +72,10 @@ static unsigned char PanoramiXReqCode = 0;
int PanoramiXPixWidth = 0;
int PanoramiXPixHeight = 0;
-int PanoramiXNumScreens = 0;
+_X_EXPORT int PanoramiXNumScreens = 0;
-PanoramiXData *panoramiXdataPtr = NULL;
-RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL};
+_X_EXPORT PanoramiXData *panoramiXdataPtr = NULL;
+RegionRec PanoramiXScreenRegion = {{0, 0, 0, 0}, NULL};
static int PanoramiXNumDepths;
static DepthPtr PanoramiXDepths;
@@ -83,13 +83,13 @@ static int PanoramiXNumVisuals;
static VisualPtr PanoramiXVisuals;
/* We support at most 256 visuals */
-XID *PanoramiXVisualTable = NULL;
+_X_EXPORT XID *PanoramiXVisualTable = NULL;
-unsigned long XRC_DRAWABLE;
-unsigned long XRT_WINDOW;
-unsigned long XRT_PIXMAP;
-unsigned long XRT_GC;
-unsigned long XRT_COLORMAP;
+_X_EXPORT unsigned long XRC_DRAWABLE;
+_X_EXPORT unsigned long XRT_WINDOW;
+_X_EXPORT unsigned long XRT_PIXMAP;
+_X_EXPORT unsigned long XRT_GC;
+_X_EXPORT unsigned long XRT_COLORMAP;
/*
* Function prototypes
@@ -330,7 +330,7 @@ XineramaDestroyClip(GCPtr pGC)
-int
+_X_EXPORT int
XineramaDeleteResource(void * data, XID id)
{
free(data);
@@ -411,7 +411,7 @@ typedef struct _connect_callback_list {
static XineramaConnectionCallbackList *ConnectionCallbackList = NULL;
-Bool
+_X_EXPORT Bool
XineramaRegisterConnectionBlockCallback(void (*func)(void))
{
XineramaConnectionCallbackList *newlist;
@@ -1037,7 +1037,16 @@ ProcXineramaIsActive(ClientPtr client)
rep.type = X_Reply;
rep.length = 0;
rep.sequenceNumber = client->sequence;
+#if 1
+ {
+ /* The following hack fools clients into thinking that Xinerama
+ * is disabled even though it is not. */
+ extern Bool PanoramiXExtensionDisabledHack;
+ rep.state = !noPanoramiXExtension && !PanoramiXExtensionDisabledHack;
+ }
+#else
rep.state = !noPanoramiXExtension;
+#endif
if (client->swapped) {
swaps (&rep.sequenceNumber);
swapl (&rep.length);
diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c
index 066dffed0..0b79a002b 100644
--- a/nx-X11/programs/Xserver/Xext/saver.c
+++ b/nx-X11/programs/Xserver/Xext/saver.c
@@ -51,7 +51,10 @@ in this Software without prior written authorization from the X Consortium.
#include "panoramiX.h"
#include "panoramiXsrv.h"
#endif
-
+#ifdef DPMSExtension
+#define DPMS_SERVER
+#include <nx-X11/extensions/dpms.h>
+#endif
#include <stdio.h>
@@ -68,12 +71,14 @@ static DISPATCH_PROC(ProcScreenSaverQueryVersion);
static DISPATCH_PROC(ProcScreenSaverSelectInput);
static DISPATCH_PROC(ProcScreenSaverSetAttributes);
static DISPATCH_PROC(ProcScreenSaverUnsetAttributes);
+static DISPATCH_PROC(ProcScreenSaverSuspend);
static DISPATCH_PROC(SProcScreenSaverDispatch);
static DISPATCH_PROC(SProcScreenSaverQueryInfo);
static DISPATCH_PROC(SProcScreenSaverQueryVersion);
static DISPATCH_PROC(SProcScreenSaverSelectInput);
static DISPATCH_PROC(SProcScreenSaverSetAttributes);
static DISPATCH_PROC(SProcScreenSaverUnsetAttributes);
+static DISPATCH_PROC(SProcScreenSaverSuspend);
static Bool ScreenSaverHandle (
ScreenPtr /* pScreen */,
@@ -110,6 +115,32 @@ static void ScreenSaverResetProc (
ExtensionEntry * /* extEntry */
);
+static RESTYPE SuspendType; /* resource type for suspension records */
+
+typedef struct _ScreenSaverSuspension *ScreenSaverSuspensionPtr;
+
+/* List of clients that are suspending the screensaver. */
+static ScreenSaverSuspensionPtr suspendingClients = NULL;
+
+/*
+ * clientResource is a resource ID that's added when the record is
+ * allocated, so the record is freed and the screensaver resumed when
+ * the client disconnects. count is the number of times the client has
+ * requested the screensaver be suspended.
+ */
+typedef struct _ScreenSaverSuspension
+{
+ ScreenSaverSuspensionPtr next;
+ ClientPtr pClient;
+ XID clientResource;
+ int count;
+} ScreenSaverSuspensionRec;
+
+static int ScreenSaverFreeSuspend(
+ pointer /*value */,
+ XID /* id */
+);
+
/*
* each screen has a list of clients requesting
* ScreenSaverNotify events. Each client has a resource
@@ -227,13 +258,15 @@ ScreenSaverExtensionInit(void)
AttrType = CreateNewResourceType(ScreenSaverFreeAttr);
EventType = CreateNewResourceType(ScreenSaverFreeEvents);
+ SuspendType = CreateNewResourceType(ScreenSaverFreeSuspend);
ScreenPrivateIndex = AllocateScreenPrivateIndex ();
+
for (i = 0; i < screenInfo.numScreens; i++)
{
pScreen = screenInfo.screens[i];
SetScreenPrivate (pScreen, NULL);
}
- if (AttrType && EventType && ScreenPrivateIndex != -1 &&
+ if (AttrType && EventType && SuspendType && ScreenPrivateIndex != -1 &&
(extEntry = AddExtension(ScreenSaverName, ScreenSaverNumberEvents, 0,
ProcScreenSaverDispatch, SProcScreenSaverDispatch,
ScreenSaverResetProc, StandardMinorOpcode)))
@@ -427,6 +460,45 @@ ScreenSaverFreeAttr (value, id)
return TRUE;
}
+static int
+ScreenSaverFreeSuspend (pointer value, XID id)
+{
+ ScreenSaverSuspensionPtr data = (ScreenSaverSuspensionPtr) value;
+ ScreenSaverSuspensionPtr *prev, this;
+
+ /* Unlink and free the suspension record for the client */
+ for (prev = &suspendingClients; (this = *prev); prev = &this->next)
+ {
+ if (this == data)
+ {
+ *prev = this->next;
+ free (this);
+ break;
+ }
+ }
+
+ /* Reenable the screensaver if this was the last client suspending it. */
+ if (screenSaverSuspended && suspendingClients == NULL)
+ {
+ screenSaverSuspended = FALSE;
+
+ /* The screensaver could be active, since suspending it (by design)
+ doesn't prevent it from being forceably activated */
+#ifdef DPMSExtension
+ if (screenIsSaved != SCREEN_SAVER_ON && DPMSPowerLevel == DPMSModeOn)
+#else
+ if (screenIsSaved != SCREEN_SAVER_ON)
+#endif
+ {
+ UpdateCurrentTimeIf();
+ lastDeviceEventTime = currentTime;
+ SetScreenSaverTimer();
+ }
+ }
+
+ return Success;
+}
+
static void
SendScreenSaverNotify (pScreen, state, forced)
ScreenPtr pScreen;
@@ -1286,12 +1358,73 @@ ProcScreenSaverUnsetAttributes (ClientPtr client)
return ScreenSaverUnsetAttributes(client);
}
+static int
+ProcScreenSaverSuspend (ClientPtr client)
+{
+ ScreenSaverSuspensionPtr *prev, this;
+
+ REQUEST(xScreenSaverSuspendReq);
+ REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
+
+ /* Check if this client is suspending the screensaver */
+ for (prev = &suspendingClients; (this = *prev); prev = &this->next)
+ if (this->pClient == client)
+ break;
+
+ if (this)
+ {
+ if (stuff->suspend == TRUE)
+ this->count++;
+ else if (--this->count == 0)
+ FreeResource (this->clientResource, RT_NONE);
+
+ return Success;
+ }
+
+ /* If we get to this point, this client isn't suspending the screensaver */
+ if (stuff->suspend == FALSE)
+ return Success;
+
+ /*
+ * Allocate a suspension record for the client, and stop the screensaver
+ * if it isn't already suspended by another client. We attach a resource ID
+ * to the record, so the screensaver will be reenabled and the record freed
+ * if the client disconnects without reenabling it first.
+ */
+ this = (ScreenSaverSuspensionPtr) malloc (sizeof (ScreenSaverSuspensionRec));
+
+ if (!this)
+ return BadAlloc;
+
+ memset(this, 0, sizeof (ScreenSaverSuspensionRec));
+ this->next = NULL;
+ this->pClient = client;
+ this->count = 1;
+ this->clientResource = FakeClientID (client->index);
+
+ if (!AddResource (this->clientResource, SuspendType, (pointer) this))
+ {
+ free (this);
+ return BadAlloc;
+ }
+
+ *prev = this;
+ if (!screenSaverSuspended)
+ {
+ screenSaverSuspended = TRUE;
+ FreeScreenSaverTimer();
+ }
+
+ return (client->noClientException);
+}
+
static DISPATCH_PROC((*NormalVector[])) = {
ProcScreenSaverQueryVersion,
ProcScreenSaverQueryInfo,
ProcScreenSaverSelectInput,
ProcScreenSaverSetAttributes,
ProcScreenSaverUnsetAttributes,
+ ProcScreenSaverSuspend,
};
#define NUM_REQUESTS ((sizeof NormalVector) / (sizeof NormalVector[0]))
@@ -1375,12 +1508,24 @@ SProcScreenSaverUnsetAttributes (client)
return ProcScreenSaverUnsetAttributes (client);
}
+static int
+SProcScreenSaverSuspend (ClientPtr client)
+{
+ REQUEST(xScreenSaverSuspendReq);
+
+ swaps(&stuff->length);
+ REQUEST_SIZE_MATCH(xScreenSaverSuspendReq);
+ swapl(&stuff->suspend);
+ return ProcScreenSaverSuspend (client);
+}
+
static DISPATCH_PROC((*SwappedVector[])) = {
SProcScreenSaverQueryVersion,
SProcScreenSaverQueryInfo,
SProcScreenSaverSelectInput,
SProcScreenSaverSetAttributes,
SProcScreenSaverUnsetAttributes,
+ SProcScreenSaverSuspend,
};
static int
diff --git a/nx-X11/programs/Xserver/Xext/sleepuntil.c b/nx-X11/programs/Xserver/Xext/sleepuntil.c
index 1934828d4..cc43815a7 100644
--- a/nx-X11/programs/Xserver/Xext/sleepuntil.c
+++ b/nx-X11/programs/Xserver/Xext/sleepuntil.c
@@ -78,7 +78,7 @@ static void SertafiedWakeupHandler(
void * /* LastSelectMask */
);
-int
+_X_EXPORT int
ClientSleepUntil (client, revive, notifyFunc, closure)
ClientPtr client;
TimeStamp *revive;
diff --git a/nx-X11/programs/Xserver/Xext/sync.c b/nx-X11/programs/Xserver/Xext/sync.c
index 7fa6145a6..e90e35db9 100644
--- a/nx-X11/programs/Xserver/Xext/sync.c
+++ b/nx-X11/programs/Xserver/Xext/sync.c
@@ -296,14 +296,18 @@ static void
SyncDeleteTriggerFromCounter(pTrigger)
SyncTrigger *pTrigger;
{
- SyncTriggerList *pCur, *pPrev = NULL;
+ SyncTriggerList *pCur;
+ SyncTriggerList *pPrev;
/* pCounter needs to be stored in pTrigger before calling here. */
if (!pTrigger->pCounter)
return;
- for (pCur = pTrigger->pCounter->pTriglist; pCur; pCur = pCur->next)
+ pPrev = NULL;
+ pCur = pTrigger->pCounter->pTriglist;
+
+ while (pCur)
{
if (pCur->pTrigger == pTrigger)
{
@@ -311,9 +315,13 @@ SyncDeleteTriggerFromCounter(pTrigger)
pPrev->next = pCur->next;
else
pTrigger->pCounter->pTriglist = pCur->next;
+
free(pCur);
break;
}
+
+ pPrev = pCur;
+ pCur = pCur->next;
}
if (IsSystemCounter(pTrigger->pCounter))
diff --git a/nx-X11/programs/Xserver/Xext/xres.c b/nx-X11/programs/Xserver/Xext/xres.c
index ceb9c65d4..03597ad95 100644
--- a/nx-X11/programs/Xserver/Xext/xres.c
+++ b/nx-X11/programs/Xserver/Xext/xres.c
@@ -6,6 +6,8 @@
#include <dix-config.h>
#endif
+#include <stdio.h>
+#include <string.h>
#include <nx-X11/X.h>
#include <nx-X11/Xproto.h>
#include "misc.h"
@@ -206,7 +208,7 @@ ProcXResQueryClientPixmapBytes (ClientPtr client)
rep.sequenceNumber = client->sequence;
rep.length = 0;
rep.bytes = bytes;
-#ifdef XSERVER64
+#ifdef _XSERVER64
rep.bytes_overflow = bytes >> 32;
#else
rep.bytes_overflow = 0;
diff --git a/nx-X11/programs/Xserver/Xext/xvmain.c b/nx-X11/programs/Xserver/Xext/xvmain.c
index 397f8dc81..c1492fdc6 100644
--- a/nx-X11/programs/Xserver/Xext/xvmain.c
+++ b/nx-X11/programs/Xserver/Xext/xvmain.c
@@ -253,7 +253,7 @@ CreateResourceTypes()
}
-int
+_X_EXPORT int
XvScreenInit(ScreenPtr pScreen)
{
XvScreenPtr pxvs;
@@ -333,13 +333,13 @@ XvResetProc(ExtensionEntry* extEntry)
{
}
-int
+_X_EXPORT int
XvGetScreenIndex()
{
return XvScreenIndex;
}
-unsigned long
+_X_EXPORT unsigned long
XvGetRTPort()
{
return XvRTPort;