xserver: Branch 'randr-1.2'
Keith Packard
keithp at kemper.freedesktop.org
Thu Nov 9 09:18:22 EET 2006
randr/randr.c | 27 +++++++++++++++++++++------
randr/randrstr.h | 2 ++
randr/rroutput.c | 30 ++++++++++++++++++------------
3 files changed, 41 insertions(+), 18 deletions(-)
New commits:
diff-tree 0dee48b8af3e054228aef0d15c1cb1c9e23790cc (from ec77a95a02329a2ee3a94d7de9d2a234aecb9ca0)
Author: Keith Packard <keithp at mandolin.keithp.com>
Date: Wed Nov 8 23:17:55 2006 -0800
Add RRInit function to create resource types for RR objects.
To allow RandR objects to be created before the screen object exists,
the resource types must be registered with the resource database.
A driver wishing to create RandR objects must call RRInit before doing so.
Also, fix a segfault when setting Output data before it is associated with a
screen.
diff --git a/randr/randr.c b/randr/randr.c
index 4426c47..147df8c 100644
--- a/randr/randr.c
+++ b/randr/randr.c
@@ -39,8 +39,7 @@
#endif
#define RR_VALIDATE
-int RRGeneration;
-int RRNScreens;
+static int RRNScreens;
#define wrap(priv,real,mem,func) {\
priv->mem = real->mem; \
@@ -198,10 +197,10 @@ SRRNotifyEvent (xEvent *from,
}
}
-Bool RRScreenInit(ScreenPtr pScreen)
-{
- rrScrPrivPtr pScrPriv;
+static int RRGeneration;
+Bool RRInit (void)
+{
if (RRGeneration != serverGeneration)
{
if (!RRModeInit ())
@@ -210,9 +209,25 @@ Bool RRScreenInit(ScreenPtr pScreen)
return FALSE;
if (!RROutputInit ())
return FALSE;
+ RRGeneration = serverGeneration;
+ }
+ return TRUE;
+}
+
+static int RRScreenGeneration;
+
+Bool RRScreenInit(ScreenPtr pScreen)
+{
+ rrScrPrivPtr pScrPriv;
+
+ if (!RRInit ())
+ return FALSE;
+
+ if (RRScreenGeneration != serverGeneration)
+ {
if ((rrPrivIndex = AllocateScreenPrivateIndex()) < 0)
return FALSE;
- RRGeneration = serverGeneration;
+ RRScreenGeneration = serverGeneration;
}
pScrPriv = (rrScrPrivPtr) xalloc (sizeof (rrScrPrivRec));
diff --git a/randr/randrstr.h b/randr/randrstr.h
index 345418b..2c3e0e7 100644
--- a/randr/randrstr.h
+++ b/randr/randrstr.h
@@ -384,6 +384,8 @@ RRTellChanged (ScreenPtr pScreen);
Bool
RRGetInfo (ScreenPtr pScreen);
+Bool RRInit (void);
+
Bool RRScreenInit(ScreenPtr pScreen);
RROutputPtr
diff --git a/randr/rroutput.c b/randr/rroutput.c
index 1b0ecab..102587b 100644
--- a/randr/rroutput.c
+++ b/randr/rroutput.c
@@ -31,10 +31,13 @@ void
RROutputChanged (RROutputPtr output)
{
ScreenPtr pScreen = output->pScreen;
- rrScrPriv (pScreen);
-
+
output->changed = TRUE;
- pScrPriv->changed = TRUE;
+ if (pScreen)
+ {
+ rrScrPriv (pScreen);
+ pScrPriv->changed = TRUE;
+ }
}
/*
@@ -335,17 +338,21 @@ RROutputDestroyResource (pointer value,
{
RROutputPtr output = (RROutputPtr) value;
ScreenPtr pScreen = output->pScreen;
- rrScrPriv(pScreen);
- int i;
- for (i = 0; i < pScrPriv->numOutputs; i++)
+ if (pScreen)
{
- if (pScrPriv->outputs[i] == output)
+ rrScrPriv(pScreen);
+ int i;
+
+ for (i = 0; i < pScrPriv->numOutputs; i++)
{
- memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
- (pScrPriv->numOutputs - (i - 1)) * sizeof (RROutputPtr));
- --pScrPriv->numOutputs;
- break;
+ if (pScrPriv->outputs[i] == output)
+ {
+ memmove (pScrPriv->outputs + i, pScrPriv->outputs + i + 1,
+ (pScrPriv->numOutputs - (i - 1)) * sizeof (RROutputPtr));
+ --pScrPriv->numOutputs;
+ break;
+ }
}
}
if (output->modes)
@@ -481,4 +488,3 @@ ProcRRGetOutputInfo (ClientPtr client)
return client->noClientException;
}
-
More information about the xorg-commit
mailing list