summaryrefslogtreecommitdiff
path: root/dix
diff options
context:
space:
mode:
authorJamey Sharp <jamey@minilop.net>2010-05-21 23:13:51 -0700
committerJamey Sharp <jamey@minilop.net>2010-06-03 14:03:22 -0700
commit80b5d3a3264d2c5167e5ac85a3b04af0f89cece1 (patch)
tree678ee80f7856b7c8d93ca702ce733fe87ddc9ac8 /dix
parent5030540d6cd2aa9bbd4ecb7f4487616f9ef0140a (diff)
Move each screen's screensaver data into ScreenRec.
Most references to the savedScreenInfo array already had the corresponding screen pointer handy, which meant they usually looked like "savedScreenInfo[pScreen->myNum]". Adding a field to ScreenRec instead of keeping this information in a parallel array simplifies those expressions, and eliminates a MAXSCREENS-sized array. Since dix uses this data, a screen private entry isn't appropriate. Signed-off-by: Jamey Sharp <jamey@minilop.net> Reviewed-by: Tiago Vignatti <tiago.vignatti@nokia.com> Tested-by: Tiago Vignatti <tiago.vignatti@nokia.com> (i686 GNU/Linux)
Diffstat (limited to 'dix')
-rw-r--r--dix/window.c71
1 files changed, 34 insertions, 37 deletions
diff --git a/dix/window.c b/dix/window.c
index 00854c6d5..bdad749e8 100644
--- a/dix/window.c
+++ b/dix/window.c
@@ -151,12 +151,10 @@ WindowSeekDeviceCursor(WindowPtr pWin,
int screenIsSaved = SCREEN_SAVER_OFF;
-ScreenSaverStuffRec savedScreenInfo[MAXSCREENS];
-
static int FocusPrivatesKeyIndex;
DevPrivateKey FocusPrivatesKey = &FocusPrivatesKeyIndex;
-static Bool TileScreenSaver(int i, int kind);
+static Bool TileScreenSaver(ScreenPtr pScreen, int kind);
#define INPUTONLY_LEGAL_MASK (CWWinGravity | CWEventMask | \
@@ -363,9 +361,9 @@ CreateRootWindow(ScreenPtr pScreen)
if (!pWin)
return FALSE;
- savedScreenInfo[pScreen->myNum].pWindow = NULL;
- savedScreenInfo[pScreen->myNum].wid = FakeClientID(0);
- savedScreenInfo[pScreen->myNum].ExternalScreenSaver = NULL;
+ pScreen->screensaver.pWindow = NULL;
+ pScreen->screensaver.wid = FakeClientID(0);
+ pScreen->screensaver.ExternalScreenSaver = NULL;
screenIsSaved = SCREEN_SAVER_OFF;
WindowTable[pScreen->myNum] = pWin;
@@ -539,7 +537,7 @@ RealChildHead(WindowPtr pWin)
if (!pWin->parent &&
(screenIsSaved == SCREEN_SAVER_ON) &&
- (HasSaverWindow (pWin->drawable.pScreen->myNum)))
+ (HasSaverWindow (pWin->drawable.pScreen)))
return (pWin->firstChild);
else
return (NullWindow);
@@ -3034,7 +3032,7 @@ NotClippedByChildren(WindowPtr pWin)
pReg = REGION_CREATE(pScreen, NullBox, 1);
if (pWin->parent ||
screenIsSaved != SCREEN_SAVER_ON ||
- !HasSaverWindow (pWin->drawable.pScreen->myNum))
+ !HasSaverWindow (pWin->drawable.pScreen))
{
REGION_INTERSECT(pScreen, pReg, &pWin->borderClip, &pWin->winSize);
}
@@ -3152,33 +3150,33 @@ dixSaveScreens(ClientPtr client, int on, int mode)
}
for (i = 0; i < screenInfo.numScreens; i++)
{
+ ScreenPtr pScreen = screenInfo.screens[i];
if (on == SCREEN_SAVER_FORCER)
- (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i], on);
- if (savedScreenInfo[i].ExternalScreenSaver)
+ (* pScreen->SaveScreen) (pScreen, on);
+ if (pScreen->screensaver.ExternalScreenSaver)
{
- if ((*savedScreenInfo[i].ExternalScreenSaver)
- (screenInfo.screens[i], type, on == SCREEN_SAVER_FORCER))
+ if ((*pScreen->screensaver.ExternalScreenSaver)
+ (pScreen, type, on == SCREEN_SAVER_FORCER))
continue;
}
if (type == screenIsSaved)
continue;
switch (type) {
case SCREEN_SAVER_OFF:
- if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED)
{
- (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
- what);
+ (* pScreen->SaveScreen) (pScreen, what);
}
- else if (HasSaverWindow (i))
+ else if (HasSaverWindow (pScreen))
{
- savedScreenInfo[i].pWindow = NullWindow;
- FreeResource(savedScreenInfo[i].wid, RT_NONE);
+ pScreen->screensaver.pWindow = NullWindow;
+ FreeResource(pScreen->screensaver.wid, RT_NONE);
}
break;
case SCREEN_SAVER_CYCLE:
- if (savedScreenInfo[i].blanked == SCREEN_IS_TILED)
+ if (pScreen->screensaver.blanked == SCREEN_IS_TILED)
{
- WindowPtr pWin = savedScreenInfo[i].pWindow;
+ WindowPtr pWin = pScreen->screensaver.pWindow;
/* make it look like screen saver is off, so that
* NotClippedByChildren will compute a clip list
* for the root window, so miPaintWindow works
@@ -3202,35 +3200,33 @@ dixSaveScreens(ClientPtr client, int on, int mode)
* Call the DDX saver in case it wants to do something
* at cycle time
*/
- else if (savedScreenInfo[i].blanked == SCREEN_IS_BLANKED)
+ else if (pScreen->screensaver.blanked == SCREEN_IS_BLANKED)
{
- (* screenInfo.screens[i]->SaveScreen) (screenInfo.screens[i],
- type);
+ (* pScreen->SaveScreen) (pScreen, type);
}
break;
case SCREEN_SAVER_ON:
if (ScreenSaverBlanking != DontPreferBlanking)
{
- if ((* screenInfo.screens[i]->SaveScreen)
- (screenInfo.screens[i], what))
+ if ((* pScreen->SaveScreen) (pScreen, what))
{
- savedScreenInfo[i].blanked = SCREEN_IS_BLANKED;
+ pScreen->screensaver.blanked = SCREEN_IS_BLANKED;
continue;
}
if ((ScreenSaverAllowExposures != DontAllowExposures) &&
- TileScreenSaver(i, SCREEN_IS_BLACK))
+ TileScreenSaver(pScreen, SCREEN_IS_BLACK))
{
- savedScreenInfo[i].blanked = SCREEN_IS_BLACK;
+ pScreen->screensaver.blanked = SCREEN_IS_BLACK;
continue;
}
}
if ((ScreenSaverAllowExposures != DontAllowExposures) &&
- TileScreenSaver(i, SCREEN_IS_TILED))
+ TileScreenSaver(pScreen, SCREEN_IS_TILED))
{
- savedScreenInfo[i].blanked = SCREEN_IS_TILED;
+ pScreen->screensaver.blanked = SCREEN_IS_TILED;
}
else
- savedScreenInfo[i].blanked = SCREEN_ISNT_SAVED;
+ pScreen->screensaver.blanked = SCREEN_ISNT_SAVED;
break;
}
}
@@ -3252,8 +3248,9 @@ SaveScreens(int on, int mode)
}
static Bool
-TileScreenSaver(int i, int kind)
+TileScreenSaver(ScreenPtr pScreen, int kind)
{
+ int i = pScreen->myNum;
int j;
int result;
XID attributes[3];
@@ -3330,12 +3327,12 @@ TileScreenSaver(int i, int kind)
}
}
- pWin = savedScreenInfo[i].pWindow =
- CreateWindow(savedScreenInfo[i].wid,
+ pWin = pScreen->screensaver.pWindow =
+ CreateWindow(pScreen->screensaver.wid,
WindowTable[i],
-RANDOM_WIDTH, -RANDOM_WIDTH,
- (unsigned short)screenInfo.screens[i]->width + RANDOM_WIDTH,
- (unsigned short)screenInfo.screens[i]->height + RANDOM_WIDTH,
+ (unsigned short)pScreen->width + RANDOM_WIDTH,
+ (unsigned short)pScreen->height + RANDOM_WIDTH,
0, InputOutput, mask, attributes, 0, serverClient,
wVisual (WindowTable[i]), &result);
@@ -3346,7 +3343,7 @@ TileScreenSaver(int i, int kind)
return FALSE;
if (!AddResource(pWin->drawable.id, RT_WINDOW,
- (pointer)savedScreenInfo[i].pWindow))
+ (pointer)pScreen->screensaver.pWindow))
return FALSE;
if (mask & CWBackPixmap)