[xorg-commit-diffs] xc/programs/Xserver/randr randr.c, 1.1.4.1.2.1, 1.1.4.1.2.2 randrstr.h, 1.1.6.1, 1.1.6.2

Harold L Hunt II xorg-commit at pdx.freedesktop.org
Mon Mar 29 16:31:31 PST 2004


Committed by: harold


Index: randr.c
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/randr/randr.c,v
retrieving revision 1.1.4.1.2.1
retrieving revision 1.1.4.1.2.2
diff -u -d -r1.1.4.1.2.1 -r1.1.4.1.2.2
--- a/randr.c	17 Mar 2004 20:32:06 -0000	1.1.4.1.2.1
+++ b/randr.c	30 Mar 2004 00:31:28 -0000	1.1.4.1.2.2
@@ -719,7 +719,7 @@
 
     pScreen = pDraw->pScreen;
 
-    pScrPriv= rrGetScrPriv(pScreen);
+    pScrPriv = rrGetScrPriv(pScreen);
     
     time = ClientTimeToServerTime(stuff->timestamp);
     configTime = ClientTimeToServerTime(stuff->configTimestamp);
@@ -900,6 +900,109 @@
     return (client->noClientException);
 }
 
+int
+RRSetScreenConfig (ScreenPtr		pScreen,
+		   Rotation		rotation,
+		   int			rate,
+		   RRScreenSizePtr	pSize)
+{
+    rrScrPrivPtr	    pScrPriv;
+    int			    i;
+    short		    oldWidth, oldHeight;
+
+    pScrPriv = rrGetScrPriv(pScreen);
+    
+    oldWidth = pScreen->width;
+    oldHeight = pScreen->height;
+    
+    if (!RRGetInfo (pScreen))
+	return BadAlloc;
+    
+    /*
+     * Validate requested rotation
+     */
+
+    /* test the rotation bits only! */
+    switch (rotation & 0xf) {
+    case RR_Rotate_0:
+    case RR_Rotate_90:
+    case RR_Rotate_180:
+    case RR_Rotate_270:
+	break;
+    default:
+	/*
+	 * Invalid rotation
+	 */
+	return BadValue;
+    }
+
+    if ((~pScrPriv->rotations) & rotation)
+    {
+	/*
+	 * requested rotation or reflection not supported by screen
+	 */
+	return BadMatch;
+    }
+
+    /*
+     * Validate requested refresh
+     */
+    if (rate)
+    {
+	for (i = 0; i < pSize->nRates; i++)
+	{
+	    RRScreenRatePtr pRate = &pSize->pRates[i];
+	    if (pRate->referenced && pRate->rate == rate)
+		break;
+	}
+	if (i == pSize->nRates)
+	{
+	    /*
+	     * Invalid rate
+	     */
+	    return BadValue;
+	}
+    }
+
+    /*
+     * call out to ddx routine to effect the change
+     */
+    if (!(*pScrPriv->rrSetConfig) (pScreen, rotation, rate,
+				   pSize))
+    {
+	/*
+	 * unknown DDX failure, report to client
+	 */
+        return BadImplementation;
+    }
+    
+    /*
+     * set current extension configuration pointers
+     */
+    RRSetCurrentConfig (pScreen, rotation, rate, pSize);
+    
+    /*
+     * Deliver ScreenChangeNotify events whenever
+     * the configuration is updated
+     */
+    WalkTree (pScreen, TellChanged, (pointer) pScreen);
+    
+    /*
+     * Deliver ConfigureNotify events when root changes
+     * pixel size
+     */
+    if (oldWidth != pScreen->width || oldHeight != pScreen->height)
+	RRSendConfigNotify (pScreen);
+    RREditConnectionInfo (pScreen);
+    
+    /*
+     * Fix pointer bounds and location
+     */
+    ScreenRestructured (pScreen);
+    
+    return Success;
+}
+
 static int
 ProcRRSelectInput (ClientPtr client)
 {

Index: randrstr.h
===================================================================
RCS file: /cvs/xorg/xc/programs/Xserver/randr/randrstr.h,v
retrieving revision 1.1.6.1
retrieving revision 1.1.6.2
diff -u -d -r1.1.6.1 -r1.1.6.2
--- a/randrstr.h	17 Mar 2004 20:32:06 -0000	1.1.6.1
+++ b/randrstr.h	30 Mar 2004 00:31:28 -0000	1.1.6.2
@@ -113,7 +113,13 @@
 		    RRScreenSizePtr	pSize);
 
 Bool RRScreenInit(ScreenPtr pScreen);
-    
+
+int
+RRSetScreenConfig (ScreenPtr		pScreen,
+		   Rotation		rotation,
+		   int			rate,
+		   RRScreenSizePtr	pSize);
+
 Bool
 miRandRInit (ScreenPtr pScreen);
 




More information about the xorg-commit-diffs mailing list