Put in place a framework for RANDR support on Cygwin. Be sure to 'cd xc/lib

&& make Makefile && make Makefiles && cd Xrandr && make' then 'cd
    xc/programs/Xserver && make Makefile && make Makefiles && cd dix &&
    make clean && make && cd ../randr && make && cd ../hw/xwin && make
    clean && make'. We don't actually do resizes yet, but the function we
    need to do so (RRSetScreenConfig) exists now and we just have to do the
    Cygwin/X-specific part.
This commit is contained in:
Harold L Hunt II 2004-03-30 00:31:28 +00:00
parent 6760d33061
commit e64b14a48e
5 changed files with 253 additions and 79 deletions

View file

@ -165,9 +165,6 @@
#include "miline.h"
#include "shadow.h"
#include "fb.h"
#ifdef XWIN_LAYER
#include "layer.h"
#endif
#include "rootless.h"
#ifdef RENDER
@ -453,12 +450,6 @@ typedef struct _winPrivScreenRec
DWORD dwLastWindowsHeight;
DWORD dwLastWindowsBitsPixel;
/* Layer support */
#ifdef XWIN_LAYER
DWORD dwLayerKind;
LayerPtr pLayer;
#endif
/* Palette management */
ColormapPtr pcmapInstalled;
@ -976,35 +967,6 @@ void
winSendKeyEvent (DWORD dwKey, Bool fDown);
#ifdef XWIN_LAYER
/*
* winlayer.c
*/
LayerPtr
winLayerCreate (ScreenPtr pScreen);
int
winLayerAdd (WindowPtr pWindow, pointer value);
int
winLayerRemove (WindowPtr pWindow, pointer value);
# ifdef RANDR
Bool
winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations);
Bool
winRandRSetConfig (ScreenPtr pScreen,
Rotation rotateKind,
RRScreenSizePtr pSize);
Bool
winRandRInit (ScreenPtr pScreen);
# endif /* RANDR */
#endif /* XWIN_LAYER */
/*
* winmisc.c
*/
@ -1206,6 +1168,25 @@ winPushPixels (GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
#endif
#ifdef RANDR
/*
* winrandr.c
*/
Bool
winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations);
Bool
winRandRSetConfig (ScreenPtr pScreen,
Rotation rotateKind,
int rate,
RRScreenSizePtr pSize);
Bool
winRandRInit (ScreenPtr pScreen);
#endif /* RANDR */
/*
* winscrinit.c
*/

121
hw/xwin/winrandr.c Executable file
View file

@ -0,0 +1,121 @@
/*
*Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved.
*
*Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
*"Software"), to deal in the Software without restriction, including
*without limitation the rights to use, copy, modify, merge, publish,
*distribute, sublicense, and/or sell copies of the Software, and to
*permit persons to whom the Software is furnished to do so, subject to
*the following conditions:
*
*The above copyright notice and this permission notice shall be
*included in all copies or substantial portions of the Software.
*
*THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
*EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
*MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
*NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
*ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
*CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
*WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*
*Except as contained in this notice, the name of Harold L Hunt II
*shall not be used in advertising or otherwise to promote the sale, use
*or other dealings in this Software without prior written authorization
*from Harold L Hunt II.
*
* Authors: Harold L Hunt II
*/
#include "win.h"
/*
* Answer queries about the RandR features supported.
*/
Bool
winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations)
{
winScreenPriv(pScreen);
winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo;
int n;
Rotation rotateKind;
RRScreenSizePtr pSize;
ErrorF ("winRandRGetInfo ()\n");
/* Don't support rotations, yet */
*pRotations = RR_Rotate_0;
/* Bail if no depth has a visual associated with it */
for (n = 0; n < pScreen->numDepths; n++)
if (pScreen->allowedDepths[n].numVids)
break;
if (n == pScreen->numDepths)
return FALSE;
/* Only one allowed rotation for now */
rotateKind = RR_Rotate_0;
/*
* Register supported sizes. This can be called many times, but
* we only support one size for now.
*/
pSize = RRRegisterSize (pScreen,
pScreenInfo->dwWidth,
pScreenInfo->dwHeight,
pScreenInfo->dwWidth_mm,
pScreenInfo->dwHeight_mm);
/* Tell RandR what the current config is */
RRSetCurrentConfig (pScreen,
rotateKind,
0, /* refresh rate, not needed */
pSize);
return TRUE;
}
/*
* Respond to resize/rotate request from either X Server or X client app
*/
Bool
winRandRSetConfig (ScreenPtr pScreen,
Rotation rotateKind,
int rate,
RRScreenSizePtr pSize)
{
ErrorF ("winRandRSetConfig ()\n");
return TRUE;
}
/*
* Initialize the RandR layer.
*/
Bool
winRandRInit (ScreenPtr pScreen)
{
rrScrPrivPtr pRRScrPriv;
ErrorF ("winRandRInit ()\n");
if (!RRScreenInit (pScreen))
{
ErrorF ("winRandRInit () - RRScreenInit () failed\n");
return FALSE;
}
/* Set some RandR function pointers */
pRRScrPriv = rrGetScrPriv (pScreen);
pRRScrPriv->rrGetInfo = winRandRGetInfo;
pRRScrPriv->rrSetConfig = winRandRSetConfig;
return TRUE;
}

View file

@ -243,10 +243,6 @@ winFinishScreenInitFB (int index,
char *pbits = NULL;
int iReturn;
#ifdef XWIN_LAYER
pScreenPriv->dwLayerKind = LAYER_SHADOW;
#endif
/* Create framebuffer */
if (!(*pScreenPriv->pwinAllocateFB) (pScreen))
{
@ -369,44 +365,13 @@ winFinishScreenInitFB (int index,
}
#endif
#ifdef XWIN_LAYER
/* KDrive does LayerStartInit right after fbPictureInit */
if (!LayerStartInit (pScreen))
{
ErrorF ("winFinishScreenInitFB - LayerStartInit () failed\n");
return FALSE;
}
/* Not sure what we're adding to shadow, but add it anyway */
if (!shadowAdd (pScreen, 0, pScreenPriv->pwinShadowUpdate, NULL, 0, 0))
{
ErrorF ("winFinishScreenInitFB - shadowAdd () failed\n");
return FALSE;
}
/* KDrive does LayerFinishInit right after LayerStartInit */
if (!LayerFinishInit (pScreen))
{
ErrorF ("winFinishScreenInitFB - LayerFinishInit () failed\n");
return FALSE;
}
/* KDrive does LayerCreate right after LayerFinishInit */
pScreenPriv->pLayer = winLayerCreate (pScreen);
if (!pScreenPriv->pLayer)
{
ErrorF ("winFinishScreenInitFB - winLayerCreate () failed\n");
return FALSE;
}
/* KDrive does RandRInit right after LayerCreate */
#ifdef RANDR
if (pScreenInfo->dwDepth != 8 && !winRandRInit (pScreen))
/* Initialize resize and rotate support */
if (!winRandRInit (pScreen))
{
ErrorF ("winFinishScreenInitFB - winRandRInit () failed\n");
return FALSE;
}
#endif
#endif
/*
@ -433,7 +398,6 @@ winFinishScreenInitFB (int index,
return FALSE;
}
#ifndef XWIN_LAYER
/* Initialize the shadow framebuffer layer */
if ((pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI
|| pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD
@ -454,7 +418,6 @@ winFinishScreenInitFB (int index,
return FALSE;
}
}
#endif
#ifdef XWIN_MULTIWINDOWEXTWM
/* Handle multi-window external window manager mode */

View file

@ -719,7 +719,7 @@ ProcRRSetScreenConfig (ClientPtr client)
pScreen = pDraw->pScreen;
pScrPriv= rrGetScrPriv(pScreen);
pScrPriv = rrGetScrPriv(pScreen);
time = ClientTimeToServerTime(stuff->timestamp);
configTime = ClientTimeToServerTime(stuff->configTimestamp);
@ -900,6 +900,109 @@ sendReply:
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)
{

View file

@ -113,7 +113,13 @@ RRSetCurrentConfig (ScreenPtr pScreen,
RRScreenSizePtr pSize);
Bool RRScreenInit(ScreenPtr pScreen);
int
RRSetScreenConfig (ScreenPtr pScreen,
Rotation rotation,
int rate,
RRScreenSizePtr pSize);
Bool
miRandRInit (ScreenPtr pScreen);