diff options
author | Keith Packard <keithp@mandolin.keithp.com> | 2006-11-08 23:17:55 -0800 |
---|---|---|
committer | Keith Packard <keithp@mandolin.keithp.com> | 2006-11-08 23:17:55 -0800 |
commit | 0dee48b8af3e054228aef0d15c1cb1c9e23790cc (patch) | |
tree | 6d250c50dccc36eee79427e663eaee829c323420 /randr/randr.c | |
parent | ec77a95a02329a2ee3a94d7de9d2a234aecb9ca0 (diff) |
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.
Diffstat (limited to 'randr/randr.c')
-rw-r--r-- | randr/randr.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/randr/randr.c b/randr/randr.c index 4426c4773..147df8c2c 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)); |