xorg: got RANDR working

ulab-original
Jay Sorg 13 years ago
parent e075b8cc5d
commit 90a359dadb

@ -6,7 +6,8 @@ LIBBASE = $(X11RDPBASE)/lib
XSRCBASE = ../build_dir/xorg-server-1.9.3
OBJS = rdpmain.o rdpdraw.o rdpinput.o rdpmisc.o rdpup.o miinitext.o \
OBJS = rdpmain.o rdpdraw.o rdpinput.o rdpmisc.o rdpup.o rdprandr.o \
miinitext.o \
fbcmap_mi.o
# in Xorg 7.1, fbcmap.c was used but now it looks like fbcmap_mi.c should

@ -113,10 +113,10 @@ struct _rdpScreenInfoRec
/* Pixmap procedures */
CreatePixmapProcPtr CreatePixmap;
DestroyPixmapProcPtr DestroyPixmap;
/* Window Procedures */
//PaintWindowBackgroundProcPtr PaintWindowBackground;
//PaintWindowBorderProcPtr PaintWindowBorder;
/* Window Procedures */
CreateWindowProcPtr CreateWindow;
DestroyWindowProcPtr DestroyWindow;
CreateColormapProcPtr CreateColormap;
DestroyColormapProcPtr DestroyColormap;
@ -144,6 +144,26 @@ struct _rdpGCRec
};
typedef struct _rdpGCRec rdpGCRec;
typedef rdpGCRec* rdpGCPtr;
#define GETGCPRIV(_pGC) \
(rdpGCPtr)dixGetPrivateAddr(&(_pGC->devPrivates), &g_rdpGCIndex)
struct _rdpWindowRec
{
int status;
};
typedef struct _rdpWindowRec rdpWindowRec;
typedef rdpWindowRec* rdpWindowPtr;
#define GETWINPRIV(_pWindow) \
(rdpWindowPtr)dixGetPrivateAddr(&(_pWindow->devPrivates), &g_rdpWindowIndex)
struct _rdpPixmapRec
{
int status;
};
typedef struct _rdpPixmapRec rdpPixmapRec;
typedef rdpPixmapRec* rdpPixmapPtr;
#define GETPIXPRIV(_pPixmap) \
(rdpPixmapPtr)dixGetPrivateAddr(&(_pPixmap->devPrivates), &g_rdpPixmapIndex)
/* rdpmisc.c */
void
@ -200,20 +220,21 @@ hexdump(unsigned char *p, unsigned int len);
/* rdpdraw.c */
Bool
rdpCloseScreen(int i, ScreenPtr pScreen);
PixmapPtr
rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint);
Bool
rdpDestroyPixmap(PixmapPtr pPixmap);
Bool
rdpDestroyPixmap(PixmapPtr pPixmap);
rdpCreateWindow(WindowPtr pWindow);
Bool
rdpDestroyWindow(WindowPtr pWindow);
Bool
rdpCreateGC(GCPtr pGC);
void
rdpPaintWindowBackground(WindowPtr pWin, RegionPtr pRegion, int what);
void
rdpPaintWindowBorder(WindowPtr pWin, RegionPtr pRegion, int what);
void
rdpCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr pOldRegion);
void
rdpClearToBackground(WindowPtr pWin, int x, int y, int w, int h,

@ -34,6 +34,8 @@ Xserver drawing ops and funcs
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpGCIndex; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpWindowIndex; /* from rdpmain.c */
extern DevPrivateKeyRec g_rdpPixmapIndex; /* from rdpmain.c */
extern int g_Bpp; /* from rdpmain.c */
extern ScreenPtr g_pScreen; /* from rdpmain.c */
@ -1766,14 +1768,16 @@ rdpCreatePixmap(ScreenPtr pScreen, int width, int height, int depth,
unsigned usage_hint)
{
PixmapPtr rv;
rdpPixmapRec* priv;
ErrorF("rdpCreatePixmap:\n");
ErrorF(" in width %d height %d depth %d\n", width, height, depth);
//ErrorF("rdpCreatePixmap:\n");
//ErrorF(" in width %d height %d depth %d\n", width, height, depth);
pScreen->CreatePixmap = g_rdpScreen.CreatePixmap;
rv = pScreen->CreatePixmap(pScreen, width, height, depth, usage_hint);
priv = GETPIXPRIV(rv);
pScreen->CreatePixmap = rdpCreatePixmap;
ErrorF(" out width %d height %d depth %d\n", rv->drawable.width,
rv->drawable.height, rv->drawable.depth);
//ErrorF(" out width %d height %d depth %d\n", rv->drawable.width,
// rv->drawable.height, rv->drawable.depth);
return rv;
}
@ -1783,9 +1787,11 @@ rdpDestroyPixmap(PixmapPtr pPixmap)
{
Bool rv;
ScreenPtr pScreen;
rdpPixmapRec* priv;
ErrorF("rdpDestroyPixmap:\n");
ErrorF(" refcnt %d\n", pPixmap->refcnt);
//ErrorF("rdpDestroyPixmap:\n");
priv = GETPIXPRIV(pPixmap);
//ErrorF(" refcnt %d\n", pPixmap->refcnt);
pScreen = pPixmap->drawable.pScreen;
pScreen->DestroyPixmap = g_rdpScreen.DestroyPixmap;
rv = pScreen->DestroyPixmap(pPixmap);
@ -1793,6 +1799,41 @@ rdpDestroyPixmap(PixmapPtr pPixmap)
return rv;
}
/******************************************************************************/
Bool
rdpCreateWindow(WindowPtr pWindow)
{
ScreenPtr pScreen;
rdpWindowRec* priv;
Bool rv;
//ErrorF("rdpCreateWindow:\n");
priv = GETWINPRIV(pWindow);
//ErrorF(" %p status %d\n", priv, priv->status);
pScreen = pWindow->drawable.pScreen;
pScreen->CreateWindow = g_rdpScreen.CreateWindow;
rv = pScreen->CreateWindow(pWindow);
pScreen->CreateWindow = rdpCreateWindow;
return rv;
}
/******************************************************************************/
Bool
rdpDestroyWindow(WindowPtr pWindow)
{
ScreenPtr pScreen;
rdpWindowRec* priv;
Bool rv;
//ErrorF("rdpDestroyWindow:\n");
priv = GETWINPRIV(pWindow);
pScreen = pWindow->drawable.pScreen;
pScreen->DestroyWindow = g_rdpScreen.DestroyWindow;
rv = pScreen->DestroyWindow(pWindow);
pScreen->DestroyWindow = rdpDestroyWindow;
return rv;
}
/******************************************************************************/
Bool
rdpCreateGC(GCPtr pGC)
@ -1801,28 +1842,20 @@ rdpCreateGC(GCPtr pGC)
Bool rv;
DEBUG_OUT_OPS(("in rdpCreateGC\n"));
rv = 0;
if (1) // g_rdpGCIndex != -1)
priv = GETGCPRIV(pGC);
g_pScreen->CreateGC = g_rdpScreen.CreateGC;
rv = g_pScreen->CreateGC(pGC);
if (rv)
{
priv = (rdpGCPtr)dixGetPrivateAddr(&(pGC->devPrivates), &g_rdpGCIndex);
g_pScreen->CreateGC = g_rdpScreen.CreateGC;
rv = g_pScreen->CreateGC(pGC);
if (rv)
{
priv->funcs = pGC->funcs;
priv->ops = 0;
pGC->funcs = &g_rdpGCFuncs;
}
else
{
rdpLog("error in rdpCreateGC, CreateGC failed\n");
}
g_pScreen->CreateGC = rdpCreateGC;
priv->funcs = pGC->funcs;
priv->ops = 0;
pGC->funcs = &g_rdpGCFuncs;
}
else
{
rdpLog("error in rdpCreateGC, g_rdpGCIndex is -1\n");
rdpLog("error in rdpCreateGC, CreateGC failed\n");
}
g_pScreen->CreateGC = rdpCreateGC;
return rv;
}

@ -920,8 +920,6 @@ KbdAddEvent(int down, int param1, int param2, int param3, int param4)
/******************************************************************************/
/* notes -
we should use defines or something for the
g_keyboard->key->xkbInfo->state below
scroll lock doesn't seem to be a modifier in X
*/
void

@ -23,6 +23,7 @@ Sets up the functions
*/
#include "rdp.h"
#include "rdprandr.h"
#if 1
#define DEBUG_OUT(arg)
@ -30,17 +31,20 @@ Sets up the functions
#define DEBUG_OUT(arg) ErrorF arg
#endif
Bool noSecurityExtension = FALSE;
Bool noXFree86BigfontExtension = FALSE;
rdpScreenInfoRec g_rdpScreen; /* the one screen */
ScreenPtr g_pScreen = 0;
DevPrivateKeyRec g_rdpGCIndex;
DevPrivateKeyRec g_rdpWindowIndex;
DevPrivateKeyRec g_rdpPixmapIndex;
/* main mouse and keyboard devices */
DeviceIntPtr g_pointer = 0;
DeviceIntPtr g_keyboard = 0;
Bool g_wrapWindow = 0;
Bool g_wrapPixmap = 0;
/* set all these at once, use function set_bpp */
int g_bpp = 16;
int g_Bpp = 2;
@ -82,19 +86,6 @@ static miPointerScreenFuncRec g_rdpPointerCursorFuncs =
rdpPointerNewEventScreen
};
#define FB_GET_SCREEN_PIXMAP(s) ((PixmapPtr) ((s)->devPrivate))
#if 0
static OsTimerPtr g_updateTimer = 0;
#endif
static XID g_wid = 0;
static Bool
rdpRandRGetInfo(ScreenPtr pScreen, Rotation* pRotations);
static Bool
rdpRandRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize);
/******************************************************************************/
/* returns error, zero is good */
static int
@ -327,7 +318,17 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
if (!dixRegisterPrivateKey(&g_rdpGCIndex, PRIVATE_GC, sizeof(rdpGCRec)))
{
FatalError("rdpScreenInit: miAllocateGCPrivate failed\n");
FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_GC failed\n");
}
if (!dixRegisterPrivateKey(&g_rdpWindowIndex, PRIVATE_WINDOW, sizeof(rdpWindowRec)))
{
FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_WINDOW failed\n");
}
if (!dixRegisterPrivateKey(&g_rdpPixmapIndex, PRIVATE_PIXMAP, sizeof(rdpPixmapRec)))
{
FatalError("rdpScreenInit: dixRegisterPrivateKey PRIVATE_PIXMAP failed\n");
}
/* Random screen procedures */
@ -337,9 +338,13 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
/* Pixmap procudures */
g_rdpScreen.CreatePixmap = pScreen->CreatePixmap;
g_rdpScreen.DestroyPixmap = pScreen->DestroyPixmap;
/* Window Procedures */
g_rdpScreen.CreateWindow = pScreen->CreateWindow;
g_rdpScreen.DestroyWindow = pScreen->DestroyWindow;
g_rdpScreen.CopyWindow = pScreen->CopyWindow;
g_rdpScreen.ClearToBackground = pScreen->ClearToBackground;
/* Backing store procedures */
g_rdpScreen.RestoreAreas = pScreen->RestoreAreas;
g_rdpScreen.WakeupHandler = pScreen->WakeupHandler;
@ -364,12 +369,24 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
pScreen->SaveScreen = rdpSaveScreen;
/* GC procedures */
pScreen->CreateGC = rdpCreateGC;
/* Pixmap procedures */
/* pScreen->CreatePixmap = rdpCreatePixmap; */
/* pScreen->DestroyPixmap = rdpDestroyPixmap; */
/* Window Procedures */
if (g_wrapPixmap)
{
/* Pixmap procedures */
pScreen->CreatePixmap = rdpCreatePixmap;
pScreen->DestroyPixmap = rdpDestroyPixmap;
}
if (g_wrapWindow)
{
/* Window Procedures */
pScreen->CreateWindow = rdpCreateWindow;
pScreen->DestroyWindow = rdpDestroyWindow;
}
pScreen->CopyWindow = rdpCopyWindow;
pScreen->ClearToBackground = rdpClearToBackground;
/* Backing store procedures */
pScreen->RestoreAreas = rdpRestoreAreas;
@ -430,8 +447,23 @@ rdpScreenInit(int index, ScreenPtr pScreen, int argc, char** argv)
{
pRRScrPriv = rrGetScrPriv(pScreen);
ErrorF("pRRScrPriv %p\n", pRRScrPriv);
pRRScrPriv->rrGetInfo = rdpRandRGetInfo;
pRRScrPriv->rrSetConfig = rdpRandRSetConfig;
pRRScrPriv->rrSetConfig = rdpRRSetConfig;
pRRScrPriv->rrGetInfo = rdpRRGetInfo;
pRRScrPriv->rrScreenSetSize = rdpRRScreenSetSize;
pRRScrPriv->rrCrtcSet = rdpRRCrtcSet;
pRRScrPriv->rrCrtcGetGamma = rdpRRCrtcGetGamma;
pRRScrPriv->rrCrtcSetGamma = rdpRRCrtcSetGamma;
pRRScrPriv->rrOutputSetProperty = rdpRROutputSetProperty;
pRRScrPriv->rrOutputValidateMode = rdpRROutputValidateMode;
pRRScrPriv->rrModeDestroy = rdpRRModeDestroy;
pRRScrPriv->rrOutputGetProperty = rdpRROutputGetProperty;
pRRScrPriv->rrGetPanning = rdpRRGetPanning;
pRRScrPriv->rrSetPanning = rdpRRSetPanning;
}
ErrorF("rdpScreenInit: ret %d\n", ret);
@ -668,231 +700,3 @@ DeleteInputDeviceRequest(DeviceIntPtr dev)
{
ErrorF("DeleteInputDeviceRequest\n");
}
/******************************************************************************/
/*
* Answer queries about the RandR features supported.
1280x1024+0+0 359mm x 287mm
*/
static Bool
rdpRandRGetInfo(ScreenPtr pScreen, Rotation* pRotations)
{
int n;
int width;
int height;
int mmwidth;
int mmheight;
Rotation rotateKind;
RRScreenSizePtr pSize;
rrScrPrivPtr pRRScrPriv;
ErrorF("rdpRandRGetInfo:\n");
pRRScrPriv = rrGetScrPriv(pScreen);
DEBUG_OUT(("rdpRandRGetInfo: nSizes %d\n", pRRScrPriv->nSizes));
for (n = 0; n < pRRScrPriv->nSizes; n++)
{
DEBUG_OUT(("rdpRandRGetInfo: width %d height %d\n",
pRRScrPriv->pSizes[n].width,
pRRScrPriv->pSizes[n].height));
}
/* 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;
for (n = 0; n < pRRScrPriv->nSizes; n++)
{
RRRegisterSize(pScreen, pRRScrPriv->pSizes[n].width,
pRRScrPriv->pSizes[n].height,
pRRScrPriv->pSizes[n].mmWidth,
pRRScrPriv->pSizes[n].mmHeight);
}
/*
* Register supported sizes. This can be called many times, but
* we only support one size for now.
*/
#if 0
width = 800;
height = 600;
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
width = 1024;
height = 768;
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
width = 1280;
height = 1024;
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
#endif
width = g_rdpScreen.rdp_width;
height = g_rdpScreen.rdp_height;
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
/* Tell RandR what the current config is */
RRSetCurrentConfig(pScreen, rotateKind, 0, pSize);
return TRUE;
}
#if 0
/******************************************************************************/
static CARD32
rdpDeferredDrawCallback(OsTimerPtr timer, CARD32 now, pointer arg)
{
WindowPtr pWin;
DEBUG_OUT(("rdpDeferredDrawCallback:\n"));
pWin = (WindowPtr)arg;
DeleteWindow(pWin, None);
/*
FreeResource(g_wid, RT_NONE);
g_wid = 0;
*/
return 0;
}
#endif
/******************************************************************************/
/* for lack of a better way, a window is created that covers a the area and
when its deleted, it's invalidated */
static int
rdpInvalidateArea(ScreenPtr pScreen, int x, int y, int cx, int cy)
{
WindowPtr rootWindow;
WindowPtr pWin;
int result;
int attri;
XID attributes[4];
Mask mask;
DEBUG_OUT(("rdpInvalidateArea:\n"));
rootWindow = GetCurrentRootWindow(g_keyboard);
if (rootWindow != 0)
{
mask = 0;
attri = 0;
attributes[attri++] = pScreen->blackPixel;
mask |= CWBackPixel;
attributes[attri++] = xTrue;
mask |= CWOverrideRedirect;
if (g_wid == 0)
{
g_wid = FakeClientID(0);
}
pWin = CreateWindow(g_wid, rootWindow,
x, y, cx, cy, 0, InputOutput, mask,
attributes, 0, serverClient,
wVisual(rootWindow), &result);
if (result == 0)
{
MapWindow(pWin, serverClient);
DeleteWindow(pWin, None);
#if 0
g_updateTimer = TimerSet(g_updateTimer, 0, 50,
rdpDeferredDrawCallback, pWin);
#endif
}
}
return 0;
}
/******************************************************************************/
/*
* Respond to resize/rotate request from either X Server or X client app
*/
static Bool
rdpRandRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize)
{
PixmapPtr screenPixmap;
WindowPtr rootWindow;
BoxRec box;
ErrorF("rdpRandRSetConfig:\n");
if ((pSize->width < 1) || (pSize->height < 1))
{
ErrorF("rdpRandRSetConfig: error width %d height %d\n",
pSize->width, pSize->height);
return FALSE;
}
ErrorF("rdpRandRSetConfig: width %d height %d\n",
pSize->width, pSize->height);
g_rdpScreen.width = pSize->width;
g_rdpScreen.height = pSize->height;
g_rdpScreen.paddedWidthInBytes =
PixmapBytePad(g_rdpScreen.width, g_rdpScreen.depth);
g_rdpScreen.sizeInBytes =
g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height;
pScreen->width = pSize->width;
pScreen->height = pSize->height;
DEBUG_OUT(("rdpRandRSetConfig: pScreen %dx%d pSize %dx%d\n",
pScreen->mmWidth, pScreen->mmHeight,
pSize->mmWidth, pSize->mmHeight));
pScreen->mmWidth = pSize->mmWidth;
pScreen->mmHeight = pSize->mmHeight;
#if 0
g_free(g_rdpScreen.pfbMemory);
g_rdpScreen.pfbMemory = (char*)g_malloc(g_rdpScreen.sizeInBytes, 1);
#endif
screenPixmap = FB_GET_SCREEN_PIXMAP(pScreen);
if (screenPixmap != 0)
{
DEBUG_OUT(("rdpRandRSetConfig: resizing screenPixmap [%p] to %dx%d, "
"currently at %dx%d\n",
(void*)screenPixmap, pSize->width, pSize->height,
screenPixmap->drawable.width, screenPixmap->drawable.height));
pScreen->ModifyPixmapHeader(screenPixmap,
pSize->width, pSize->height,
g_rdpScreen.depth, g_rdpScreen.bitsPerPixel,
g_rdpScreen.paddedWidthInBytes,
g_rdpScreen.pfbMemory);
DEBUG_OUT(("rdpRandRSetConfig: resized to %dx%d\n",
screenPixmap->drawable.width, screenPixmap->drawable.height));
/* memset(g_rdpScreen.pfbMemory, 0xff, 2048 * 2048 * 4); */
}
rootWindow = GetCurrentRootWindow(g_keyboard);
if (rootWindow != 0)
{
DEBUG_OUT(("rdpRandRSetConfig: rootWindow %p\n", (void*)rootWindow));
box.x1 = 0;
box.y1 = 0;
box.x2 = pSize->width;
box.y2 = pSize->height;
RegionInit(&rootWindow->winSize, &box, 1);
RegionInit(&rootWindow->borderSize, &box, 1);
RegionReset(&rootWindow->borderClip, &box);
RegionBreak(&rootWindow->clipList);
rootWindow->drawable.width = pSize->width;
rootWindow->drawable.height = pSize->height;
ResizeChildrenWinSize(rootWindow, 0, 0, 0, 0);
}
rdpInvalidateArea(g_pScreen, 0, 0, g_rdpScreen.width, g_rdpScreen.height);
return TRUE;
}

@ -0,0 +1,272 @@
/*
Copyright 2011-2012 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 THE
OPEN GROUP 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.
RandR extension implementation
*/
#include "rdp.h"
#include "rdprandr.h"
#if 1
#define DEBUG_OUT(arg)
#else
#define DEBUG_OUT(arg) ErrorF arg
#endif
extern rdpScreenInfoRec g_rdpScreen; /* from rdpmain.c */
extern DeviceIntPtr g_pointer; /* in rdpmain.c */
extern DeviceIntPtr g_keyboard; /* in rdpmain.c */
extern ScreenPtr g_pScreen; /* in rdpmain.c */
static XID g_wid = 0;
/******************************************************************************/
Bool
rdpRRRegisterSize(ScreenPtr pScreen, int width, int height)
{
int mmwidth;
int mmheight;
RRScreenSizePtr pSize;
ErrorF("rdpRRRegisterSize: width %d height %d\n", width, height);
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
pSize = RRRegisterSize(pScreen, width, height, mmwidth, mmheight);
/* Tell RandR what the current config is */
RRSetCurrentConfig(pScreen, RR_Rotate_0, 0, pSize);
return TRUE;
}
/******************************************************************************/
Bool
rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize)
{
ErrorF("rdpRRSetConfig:\n");
return TRUE;
}
/******************************************************************************/
Bool
rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations)
{
int width;
int height;
ErrorF("rdpRRGetInfo:\n");
*pRotations = RR_Rotate_0;
width = g_rdpScreen.width;
height = g_rdpScreen.height;
rdpRRRegisterSize(pScreen, width, height);
return TRUE;
}
/******************************************************************************/
/* for lack of a better way, a window is created that covers a the area and
when its deleted, it's invalidated */
static int
rdpInvalidateArea(ScreenPtr pScreen, int x, int y, int cx, int cy)
{
WindowPtr pWin;
int result;
int attri;
XID attributes[4];
Mask mask;
DEBUG_OUT(("rdpInvalidateArea:\n"));
mask = 0;
attri = 0;
attributes[attri++] = pScreen->blackPixel;
mask |= CWBackPixel;
attributes[attri++] = xTrue;
mask |= CWOverrideRedirect;
if (g_wid == 0)
{
g_wid = FakeClientID(0);
}
pWin = CreateWindow(g_wid, pScreen->root,
x, y, cx, cy, 0, InputOutput, mask,
attributes, 0, serverClient,
wVisual(pScreen->root), &result);
if (result == 0)
{
MapWindow(pWin, serverClient);
DeleteWindow(pWin, None);
}
return 0;
}
/******************************************************************************/
Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight)
{
PixmapPtr screenPixmap;
BoxRec box;
ErrorF("rdpRRScreenSetSize: width %d height %d mmWidth %d mmHeight %d\n",
width, height, mmWidth, mmHeight);
if ((width < 1) || (height < 1))
{
ErrorF(" error width %d height %d\n", width, height);
return FALSE;
}
g_rdpScreen.width = width;
g_rdpScreen.height = height;
g_rdpScreen.paddedWidthInBytes =
PixmapBytePad(g_rdpScreen.width, g_rdpScreen.depth);
g_rdpScreen.sizeInBytes =
g_rdpScreen.paddedWidthInBytes * g_rdpScreen.height;
pScreen->width = width;
pScreen->height = height;
pScreen->mmWidth = mmWidth;
pScreen->mmHeight = mmHeight;
screenPixmap = pScreen->GetScreenPixmap(pScreen);
if (screenPixmap != 0)
{
ErrorF(" resizing screenPixmap [%p] to %dx%d, currently at %dx%d\n",
(void*)screenPixmap, width, height,
screenPixmap->drawable.width, screenPixmap->drawable.height);
pScreen->ModifyPixmapHeader(screenPixmap, width, height,
g_rdpScreen.depth, g_rdpScreen.bitsPerPixel,
g_rdpScreen.paddedWidthInBytes,
g_rdpScreen.pfbMemory);
ErrorF(" pixmap resized to %dx%d\n",
screenPixmap->drawable.width, screenPixmap->drawable.height);
}
DEBUG_OUT((" root window %p\n", (void*)pScreen->root));
box.x1 = 0;
box.y1 = 0;
box.x2 = width;
box.y2 = height;
RegionInit(&pScreen->root->winSize, &box, 1);
RegionInit(&pScreen->root->borderSize, &box, 1);
RegionReset(&pScreen->root->borderClip, &box);
RegionBreak(&pScreen->root->clipList);
pScreen->root->drawable.width = width;
pScreen->root->drawable.height = height;
ResizeChildrenWinSize(pScreen->root, 0, 0, 0, 0);
RRScreenSizeNotify(pScreen);
rdpInvalidateArea(g_pScreen, 0, 0, g_rdpScreen.width, g_rdpScreen.height);
ErrorF(" screen resized to %dx%d\n",
pScreen->width, pScreen->height);
return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
int x, int y, Rotation rotation, int numOutputs,
RROutputPtr* outputs)
{
ErrorF("rdpRRCrtcSet:\n");
return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
ErrorF("rdpRRCrtcSetGamma:\n");
return TRUE;
}
/******************************************************************************/
Bool
rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc)
{
ErrorF("rdpRRCrtcGetGamma:\n");
return TRUE;
}
/******************************************************************************/
Bool
rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
RRPropertyValuePtr value)
{
ErrorF("rdpRROutputSetProperty:\n");
return TRUE;
}
/******************************************************************************/
Bool
rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
RRModePtr mode)
{
ErrorF("rdpRROutputValidateMode:\n");
return TRUE;
}
/******************************************************************************/
void
rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode)
{
ErrorF("rdpRRModeDestroy:\n");
}
/******************************************************************************/
Bool
rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property)
{
ErrorF("rdpRROutputGetProperty:\n");
return TRUE;
}
/******************************************************************************/
Bool
rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border)
{
ErrorF("rdpRRGetPanning:\n");
if (totalArea != 0)
{
totalArea->x1 = 0;
totalArea->y1 = 0;
totalArea->x2 = g_rdpScreen.width;
totalArea->y2 = g_rdpScreen.height;
}
if (trackingArea != 0)
{
trackingArea->x1 = 0;
trackingArea->y1 = 0;
trackingArea->x2 = g_rdpScreen.width;
trackingArea->y2 = g_rdpScreen.height;
}
if (border != 0)
{
border[0] = 0;
border[1] = 0;
border[2] = 0;
border[3] = 0;
}
return TRUE;
}
/******************************************************************************/
Bool
rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border)
{
ErrorF("rdpRRSetPanning:\n");
return TRUE;
}

@ -0,0 +1,60 @@
/*
Copyright 2011-2012 Jay Sorg
Permission to use, copy, modify, distribute, and sell this software and its
documentation for any purpose is hereby granted without fee, provided that
the above copyright notice appear in all copies and that both that
copyright notice and this permission notice appear in supporting
documentation.
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 THE
OPEN GROUP 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.
*/
#ifndef _RDPRANDR_H
#define _RDPRANDR_H
Bool
rdpRRRegisterSize(ScreenPtr pScreen, int width, int height);
Bool
rdpRRGetInfo(ScreenPtr pScreen, Rotation* pRotations);
Bool
rdpRRSetConfig(ScreenPtr pScreen, Rotation rotateKind, int rate,
RRScreenSizePtr pSize);
Bool
rdpRRScreenSetSize(ScreenPtr pScreen, CARD16 width, CARD16 height,
CARD32 mmWidth, CARD32 mmHeight);
Bool
rdpRRCrtcSet(ScreenPtr pScreen, RRCrtcPtr crtc, RRModePtr mode,
int x, int y, Rotation rotation, int numOutputs,
RROutputPtr* outputs);
Bool
rdpRRCrtcSetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
Bool
rdpRRCrtcGetGamma(ScreenPtr pScreen, RRCrtcPtr crtc);
Bool
rdpRROutputSetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property,
RRPropertyValuePtr value);
Bool
rdpRROutputValidateMode(ScreenPtr pScreen, RROutputPtr output,
RRModePtr mode);
void
rdpRRModeDestroy(ScreenPtr pScreen, RRModePtr mode);
Bool
rdpRROutputGetProperty(ScreenPtr pScreen, RROutputPtr output, Atom property);
Bool
rdpRRGetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border);
Bool
rdpRRSetPanning(ScreenPtr pScrn, RRCrtcPtr crtc, BoxPtr totalArea,
BoxPtr trackingArea, INT16* border);
#endif

@ -285,7 +285,7 @@ process_screen_size_msg(int width, int height, int bpp)
RRScreenSizePtr pSize;
int mmwidth;
int mmheight;
int error;
Bool ok;
ErrorF("process_screen_size_msg: set width %d height %d bpp %d\n",
width, height, bpp);
@ -315,21 +315,13 @@ process_screen_size_msg(int width, int height, int bpp)
mmwidth = PixelToMM(width);
mmheight = PixelToMM(height);
return 0;
pSize = RRRegisterSize(g_pScreen, width, height, mmwidth, mmheight);
RRSetCurrentConfig(g_pScreen, RR_Rotate_0, 0, pSize);
if ((g_rdpScreen.width != width) || (g_rdpScreen.height != height))
{
ErrorF(" calling ProcRRSetScreenConfig\n");
error = 0;
//error = ProcRRSetScreenConfig(serverClient);
//error = RRSetScreenConfig(g_pScreen, RR_Rotate_0, 0, pSize);
if (error == BadImplementation)
{
ErrorF("process_screen_size_msg: RRSetScreenConfig returned "
"BadImplementation\n");
}
ErrorF(" calling RRScreenSizeSet\n");
ok = RRScreenSizeSet(g_pScreen, width, height, mmwidth, mmheight);
ErrorF(" RRScreenSizeSet ok=[%d]\n", ok);
}
return 0;
}

Loading…
Cancel
Save