Darwin: Adding "fake RandR" support from old X11.app
(cherry picked from commit 633490c4e8dab30af7ecbe1bef076c22ad5f5da9)
This commit is contained in:
parent
01b70afaac
commit
28e73e99a9
|
@ -54,6 +54,8 @@
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <IOKit/pwr_mgt/IOPMLib.h>
|
#include <IOKit/pwr_mgt/IOPMLib.h>
|
||||||
|
|
||||||
|
#define FAKE_RANDR 1
|
||||||
|
|
||||||
// Shared global variables for Quartz modes
|
// Shared global variables for Quartz modes
|
||||||
int quartzEventWriteFD = -1;
|
int quartzEventWriteFD = -1;
|
||||||
int quartzStartClients = 1;
|
int quartzStartClients = 1;
|
||||||
|
@ -69,6 +71,30 @@ int noPseudoramiXExtension = FALSE;
|
||||||
QuartzModeProcsPtr quartzProcs = NULL;
|
QuartzModeProcsPtr quartzProcs = NULL;
|
||||||
const char *quartzOpenGLBundle = NULL;
|
const char *quartzOpenGLBundle = NULL;
|
||||||
|
|
||||||
|
#if defined(RANDR) && !defined(FAKE_RANDR)
|
||||||
|
Bool DarwinModeRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool DarwinModeRandRSetConfig (ScreenPtr pScreen,
|
||||||
|
Rotation randr,
|
||||||
|
int rate,
|
||||||
|
RRScreenSizePtr pSize) {
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
Bool DarwinModeRandRInit (ScreenPtr pScreen) {
|
||||||
|
rrScrPrivPtr pScrPriv;
|
||||||
|
|
||||||
|
if (!RRScreenInit (pScreen)) return FALSE;
|
||||||
|
|
||||||
|
pScrPriv = rrGetScrPriv(pScreen);
|
||||||
|
pScrPriv->rrGetInfo = DarwinModeRandRGetInfo;
|
||||||
|
pScrPriv->rrSetConfig = DarwinModeRandRSetConfig;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
===========================================================================
|
===========================================================================
|
||||||
|
|
||||||
|
@ -170,6 +196,51 @@ void DarwinModeInitInput(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef FAKE_RANDR
|
||||||
|
extern char *ConnectionInfo;
|
||||||
|
|
||||||
|
static int padlength[4] = {0, 3, 2, 1};
|
||||||
|
|
||||||
|
static void
|
||||||
|
RREditConnectionInfo (ScreenPtr pScreen)
|
||||||
|
{
|
||||||
|
xConnSetup *connSetup;
|
||||||
|
char *vendor;
|
||||||
|
xPixmapFormat *formats;
|
||||||
|
xWindowRoot *root;
|
||||||
|
xDepth *depth;
|
||||||
|
xVisualType *visual;
|
||||||
|
int screen = 0;
|
||||||
|
int d;
|
||||||
|
|
||||||
|
connSetup = (xConnSetup *) ConnectionInfo;
|
||||||
|
vendor = (char *) connSetup + sizeof (xConnSetup);
|
||||||
|
formats = (xPixmapFormat *) ((char *) vendor +
|
||||||
|
connSetup->nbytesVendor +
|
||||||
|
padlength[connSetup->nbytesVendor & 3]);
|
||||||
|
root = (xWindowRoot *) ((char *) formats +
|
||||||
|
sizeof (xPixmapFormat) * screenInfo.numPixmapFormats);
|
||||||
|
while (screen != pScreen->myNum)
|
||||||
|
{
|
||||||
|
depth = (xDepth *) ((char *) root +
|
||||||
|
sizeof (xWindowRoot));
|
||||||
|
for (d = 0; d < root->nDepths; d++)
|
||||||
|
{
|
||||||
|
visual = (xVisualType *) ((char *) depth +
|
||||||
|
sizeof (xDepth));
|
||||||
|
depth = (xDepth *) ((char *) visual +
|
||||||
|
depth->nVisuals * sizeof (xVisualType));
|
||||||
|
}
|
||||||
|
root = (xWindowRoot *) ((char *) depth);
|
||||||
|
screen++;
|
||||||
|
}
|
||||||
|
root->pixWidth = pScreen->width;
|
||||||
|
root->pixHeight = pScreen->height;
|
||||||
|
root->mmWidth = pScreen->mmWidth;
|
||||||
|
root->mmHeight = pScreen->mmHeight;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* QuartzUpdateScreens
|
* QuartzUpdateScreens
|
||||||
* Adjust for screen arrangement changes.
|
* Adjust for screen arrangement changes.
|
||||||
|
@ -181,6 +252,7 @@ static void QuartzUpdateScreens(void)
|
||||||
int x, y, width, height, sx, sy;
|
int x, y, width, height, sx, sy;
|
||||||
xEvent e;
|
xEvent e;
|
||||||
|
|
||||||
|
ErrorF("QuartzUpdateScreens()\n");
|
||||||
if (noPseudoramiXExtension || screenInfo.numScreens != 1)
|
if (noPseudoramiXExtension || screenInfo.numScreens != 1)
|
||||||
{
|
{
|
||||||
/* FIXME: if not using Xinerama, we have multiple screens, and
|
/* FIXME: if not using Xinerama, we have multiple screens, and
|
||||||
|
@ -203,7 +275,10 @@ static void QuartzUpdateScreens(void)
|
||||||
pScreen->width = width;
|
pScreen->width = width;
|
||||||
pScreen->height = height;
|
pScreen->height = height;
|
||||||
|
|
||||||
/* FIXME: should probably do something with RandR here. */
|
#ifndef FAKE_RANDR
|
||||||
|
if(!DarwinModeRandRInit(pScreen))
|
||||||
|
FatalError("Failed to init RandR extension.\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
DarwinAdjustScreenOrigins(&screenInfo);
|
DarwinAdjustScreenOrigins(&screenInfo);
|
||||||
quartzProcs->UpdateScreen(pScreen);
|
quartzProcs->UpdateScreen(pScreen);
|
||||||
|
@ -231,7 +306,9 @@ static void QuartzUpdateScreens(void)
|
||||||
e.u.configureNotify.override = pRoot->overrideRedirect;
|
e.u.configureNotify.override = pRoot->overrideRedirect;
|
||||||
DeliverEvents(pRoot, &e, 1, NullWindow);
|
DeliverEvents(pRoot, &e, 1, NullWindow);
|
||||||
|
|
||||||
/* FIXME: Should we use RREditConnectionInfo(pScreen)? */
|
#ifdef FAKE_RANDR
|
||||||
|
RREditConnectionInfo(pScreen);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue