Merge branch 'master' into XACE-SELINUX
This commit is contained in:
commit
bb111291d8
|
@ -496,11 +496,11 @@ int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc)
|
||||||
GLXDrawable *drawId;
|
GLXDrawable *drawId;
|
||||||
int *buffer;
|
int *buffer;
|
||||||
|
|
||||||
|
__GLX_DECLARE_SWAP_VARIABLES;
|
||||||
|
|
||||||
(void) drawId;
|
(void) drawId;
|
||||||
(void) buffer;
|
(void) buffer;
|
||||||
|
|
||||||
__GLX_DECLARE_SWAP_VARIABLES;
|
|
||||||
|
|
||||||
pc += __GLX_VENDPRIV_HDR_SIZE;
|
pc += __GLX_VENDPRIV_HDR_SIZE;
|
||||||
|
|
||||||
__GLX_SWAP_SHORT(&req->length);
|
__GLX_SWAP_SHORT(&req->length);
|
||||||
|
|
23
Xext/shm.c
23
Xext/shm.c
|
@ -119,9 +119,7 @@ static int pixmapFormat;
|
||||||
static int shmPixFormat[MAXSCREENS];
|
static int shmPixFormat[MAXSCREENS];
|
||||||
static ShmFuncsPtr shmFuncs[MAXSCREENS];
|
static ShmFuncsPtr shmFuncs[MAXSCREENS];
|
||||||
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
|
static DestroyPixmapProcPtr destroyPixmap[MAXSCREENS];
|
||||||
#ifdef PIXPRIV
|
|
||||||
static int shmPixmapPrivate;
|
static int shmPixmapPrivate;
|
||||||
#endif
|
|
||||||
static ShmFuncs miFuncs = {NULL, miShmPutImage};
|
static ShmFuncs miFuncs = {NULL, miShmPutImage};
|
||||||
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
|
static ShmFuncs fbFuncs = {fbShmCreatePixmap, fbShmPutImage};
|
||||||
|
|
||||||
|
@ -237,7 +235,6 @@ ShmExtensionInit(INITARGS)
|
||||||
destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
|
destroyPixmap[i] = screenInfo.screens[i]->DestroyPixmap;
|
||||||
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
|
screenInfo.screens[i]->DestroyPixmap = ShmDestroyPixmap;
|
||||||
}
|
}
|
||||||
#ifdef PIXPRIV
|
|
||||||
shmPixmapPrivate = AllocatePixmapPrivateIndex();
|
shmPixmapPrivate = AllocatePixmapPrivateIndex();
|
||||||
for (i = 0; i < screenInfo.numScreens; i++)
|
for (i = 0; i < screenInfo.numScreens; i++)
|
||||||
{
|
{
|
||||||
|
@ -245,7 +242,6 @@ ShmExtensionInit(INITARGS)
|
||||||
shmPixmapPrivate, 0))
|
shmPixmapPrivate, 0))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ShmSegType = CreateNewResourceType(ShmDetachSegment);
|
ShmSegType = CreateNewResourceType(ShmDetachSegment);
|
||||||
|
@ -299,22 +295,7 @@ ShmDestroyPixmap (PixmapPtr pPixmap)
|
||||||
if (pPixmap->refcnt == 1)
|
if (pPixmap->refcnt == 1)
|
||||||
{
|
{
|
||||||
ShmDescPtr shmdesc;
|
ShmDescPtr shmdesc;
|
||||||
#ifdef PIXPRIV
|
|
||||||
shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
|
shmdesc = (ShmDescPtr) pPixmap->devPrivates[shmPixmapPrivate].ptr;
|
||||||
#else
|
|
||||||
char *base = (char *) pPixmap->devPrivate.ptr;
|
|
||||||
|
|
||||||
if (base != (pointer) (pPixmap + 1))
|
|
||||||
{
|
|
||||||
for (shmdesc = Shmsegs; shmdesc; shmdesc = shmdesc->next)
|
|
||||||
{
|
|
||||||
if (shmdesc->addr <= base && base <= shmdesc->addr + shmdesc->size)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
shmdesc = 0;
|
|
||||||
#endif
|
|
||||||
if (shmdesc)
|
if (shmdesc)
|
||||||
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
|
ShmDetachSegment ((pointer) shmdesc, pPixmap->drawable.id);
|
||||||
}
|
}
|
||||||
|
@ -781,9 +762,7 @@ CreatePmap:
|
||||||
shmdesc->addr + stuff->offset);
|
shmdesc->addr + stuff->offset);
|
||||||
|
|
||||||
if (pMap) {
|
if (pMap) {
|
||||||
#ifdef PIXPRIV
|
|
||||||
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
|
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
|
||||||
#endif
|
|
||||||
shmdesc->refcnt++;
|
shmdesc->refcnt++;
|
||||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||||
pMap->drawable.id = newPix->info[j].id;
|
pMap->drawable.id = newPix->info[j].id;
|
||||||
|
@ -1097,9 +1076,7 @@ CreatePmap:
|
||||||
shmdesc->addr + stuff->offset);
|
shmdesc->addr + stuff->offset);
|
||||||
if (pMap)
|
if (pMap)
|
||||||
{
|
{
|
||||||
#ifdef PIXPRIV
|
|
||||||
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
|
pMap->devPrivates[shmPixmapPrivate].ptr = (pointer) shmdesc;
|
||||||
#endif
|
|
||||||
shmdesc->refcnt++;
|
shmdesc->refcnt++;
|
||||||
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||||
pMap->drawable.id = stuff->pid;
|
pMap->drawable.id = stuff->pid;
|
||||||
|
|
|
@ -102,12 +102,8 @@ afbCreatePixmap(pScreen, width, height, depth)
|
||||||
pPixmap->drawable.height = height;
|
pPixmap->drawable.height = height;
|
||||||
pPixmap->devKind = paddedWidth;
|
pPixmap->devKind = paddedWidth;
|
||||||
pPixmap->refcnt = 1;
|
pPixmap->refcnt = 1;
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivate.ptr = datasize ?
|
pPixmap->devPrivate.ptr = datasize ?
|
||||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
|
|
||||||
#endif
|
|
||||||
return(pPixmap);
|
return(pPixmap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,12 +96,8 @@ cfbCreatePixmap (pScreen, width, height, depth)
|
||||||
pPixmap->drawable.height = height;
|
pPixmap->drawable.height = height;
|
||||||
pPixmap->devKind = paddedWidth;
|
pPixmap->devKind = paddedWidth;
|
||||||
pPixmap->refcnt = 1;
|
pPixmap->refcnt = 1;
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivate.ptr = datasize ?
|
pPixmap->devPrivate.ptr = datasize ?
|
||||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
|
|
||||||
#endif
|
|
||||||
return pPixmap;
|
return pPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -364,9 +364,7 @@ main(int argc, char *argv[], char *envp[])
|
||||||
ResetScreenPrivates();
|
ResetScreenPrivates();
|
||||||
ResetWindowPrivates();
|
ResetWindowPrivates();
|
||||||
ResetGCPrivates();
|
ResetGCPrivates();
|
||||||
#ifdef PIXPRIV
|
|
||||||
ResetPixmapPrivates();
|
ResetPixmapPrivates();
|
||||||
#endif
|
|
||||||
ResetColormapPrivates();
|
ResetColormapPrivates();
|
||||||
ResetFontPrivateIndex();
|
ResetFontPrivateIndex();
|
||||||
ResetDevicePrivateIndex();
|
ResetDevicePrivateIndex();
|
||||||
|
@ -734,11 +732,9 @@ AddScreen(
|
||||||
pScreen->GCPrivateSizes = (unsigned *)NULL;
|
pScreen->GCPrivateSizes = (unsigned *)NULL;
|
||||||
pScreen->totalGCSize =
|
pScreen->totalGCSize =
|
||||||
((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
|
((sizeof(GC) + sizeof(long) - 1) / sizeof(long)) * sizeof(long);
|
||||||
#ifdef PIXPRIV
|
|
||||||
pScreen->PixmapPrivateLen = 0;
|
pScreen->PixmapPrivateLen = 0;
|
||||||
pScreen->PixmapPrivateSizes = (unsigned *)NULL;
|
pScreen->PixmapPrivateSizes = (unsigned *)NULL;
|
||||||
pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
|
pScreen->totalPixmapSize = BitmapBytePad(sizeof(PixmapRec)*8);
|
||||||
#endif
|
|
||||||
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
|
pScreen->ClipNotify = 0; /* for R4 ddx compatibility */
|
||||||
pScreen->CreateScreenResources = 0;
|
pScreen->CreateScreenResources = 0;
|
||||||
|
|
||||||
|
@ -802,9 +798,7 @@ FreeScreen(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
xfree(pScreen->WindowPrivateSizes);
|
xfree(pScreen->WindowPrivateSizes);
|
||||||
xfree(pScreen->GCPrivateSizes);
|
xfree(pScreen->GCPrivateSizes);
|
||||||
#ifdef PIXPRIV
|
|
||||||
xfree(pScreen->PixmapPrivateSizes);
|
xfree(pScreen->PixmapPrivateSizes);
|
||||||
#endif
|
|
||||||
xfree(pScreen->devPrivates);
|
xfree(pScreen->devPrivates);
|
||||||
xfree(pScreen);
|
xfree(pScreen);
|
||||||
}
|
}
|
||||||
|
|
|
@ -109,7 +109,6 @@ _X_EXPORT PixmapPtr
|
||||||
AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
||||||
{
|
{
|
||||||
PixmapPtr pPixmap;
|
PixmapPtr pPixmap;
|
||||||
#ifdef PIXPRIV
|
|
||||||
char *ptr;
|
char *ptr;
|
||||||
DevUnion *ppriv;
|
DevUnion *ppriv;
|
||||||
unsigned *sizes;
|
unsigned *sizes;
|
||||||
|
@ -136,9 +135,6 @@ AllocatePixmap(ScreenPtr pScreen, int pixDataSize)
|
||||||
else
|
else
|
||||||
ppriv->ptr = (pointer)NULL;
|
ppriv->ptr = (pointer)NULL;
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
pPixmap = (PixmapPtr)xalloc(sizeof(PixmapRec) + pixDataSize);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef _XSERVER64
|
#ifdef _XSERVER64
|
||||||
if (pPixmap) {
|
if (pPixmap) {
|
||||||
|
|
|
@ -574,7 +574,6 @@ AllocateGCPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
|
||||||
/*
|
/*
|
||||||
* pixmap private machinery
|
* pixmap private machinery
|
||||||
*/
|
*/
|
||||||
#ifdef PIXPRIV
|
|
||||||
static int pixmapPrivateCount;
|
static int pixmapPrivateCount;
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -620,7 +619,6 @@ AllocatePixmapPrivate(register ScreenPtr pScreen, int index2, unsigned amount)
|
||||||
pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
|
pScreen->totalPixmapSize = BitmapBytePad(pScreen->totalPixmapSize * 8);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -43,11 +43,7 @@ fbCreatePixmapBpp (ScreenPtr pScreen, int width, int height, int depth, int bpp)
|
||||||
if (paddedWidth / 4 > 32767 || height > 32767)
|
if (paddedWidth / 4 > 32767 || height > 32767)
|
||||||
return NullPixmap;
|
return NullPixmap;
|
||||||
datasize = height * paddedWidth;
|
datasize = height * paddedWidth;
|
||||||
#ifdef PIXPRIV
|
|
||||||
base = pScreen->totalPixmapSize;
|
base = pScreen->totalPixmapSize;
|
||||||
#else
|
|
||||||
base = sizeof (PixmapRec);
|
|
||||||
#endif
|
|
||||||
adjust = 0;
|
adjust = 0;
|
||||||
if (base & 7)
|
if (base & 7)
|
||||||
adjust = 8 - (base & 7);
|
adjust = 8 - (base & 7);
|
||||||
|
|
|
@ -112,7 +112,7 @@ macos_PROGRAMS = XDarwinApp
|
||||||
macos_SCRIPTS = x11app
|
macos_SCRIPTS = x11app
|
||||||
|
|
||||||
x11app:
|
x11app:
|
||||||
cd apple && xcodebuild
|
cd apple && xcodebuild CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)"
|
||||||
|
|
||||||
XDarwinApp_SOURCES = \
|
XDarwinApp_SOURCES = \
|
||||||
$(top_srcdir)/fb/fbcmap.c \
|
$(top_srcdir)/fb/fbcmap.c \
|
||||||
|
@ -275,7 +275,7 @@ install-data-hook: $(HOOK_TARGETS)
|
||||||
|
|
||||||
xquartz-install-hook:
|
xquartz-install-hook:
|
||||||
mv $(DESTDIR)$(macosdir)/XDarwinApp $(DESTDIR)$(macosdir)/XDarwin
|
mv $(DESTDIR)$(macosdir)/XDarwinApp $(DESTDIR)$(macosdir)/XDarwin
|
||||||
cd apple && xcodebuild CFLAGS="$(XSERVERCFLAGS_CFLAGS)" LDFLAGS="$(XSERVERCFLAGS_LIBS)"
|
cd apple && xcodebuild install
|
||||||
|
|
||||||
EXTRA_DIST = \
|
EXTRA_DIST = \
|
||||||
darwin.c \
|
darwin.c \
|
||||||
|
|
|
@ -22,20 +22,14 @@ The server builds 4 targets:
|
||||||
Known issues:
|
Known issues:
|
||||||
|
|
||||||
* AGL and CGL support for 3D indirect acceleration does not work;
|
* AGL and CGL support for 3D indirect acceleration does not work;
|
||||||
indirect.c needs to be rewritten.
|
indirect.c has been rewritten, but not yet integrated into this source tree.
|
||||||
|
|
||||||
* Fullscreen mode does not work; I don't know why.
|
* Fullscreen mode does not work; I don't know why.
|
||||||
|
|
||||||
* The keyboard and mouse do not work at all; they worked in X11R7.1,
|
|
||||||
and I believe that they were broken by the events changes in dix/.
|
|
||||||
|
|
||||||
* Some features in X11.app are not yet implemented; these are marked
|
* Some features in X11.app are not yet implemented; these are marked
|
||||||
with #ifdef DARWIN_DDX_MISSING in the code.
|
with #ifdef DARWIN_DDX_MISSING in the code.
|
||||||
|
|
||||||
* The build system code could probably be cleaned up slightly.
|
* The build system code could probably be cleaned up slightly.
|
||||||
|
|
||||||
* Most testing of this code has occurred under 10.5, but it should
|
|
||||||
also work under 10.4.
|
|
||||||
|
|
||||||
Any patches or code contributions would be most welcome and may be
|
Any patches or code contributions would be most welcome and may be
|
||||||
sent to me at bbyer@apple.com.
|
sent to me at bbyer@apple.com.
|
||||||
|
|
|
@ -855,48 +855,6 @@ convert_flags (unsigned int nsflags) {
|
||||||
return xflags;
|
return xflags;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sends a null byte down darwinEventWriteFD, which will cause the
|
|
||||||
Dispatch() event loop to check out event queue */
|
|
||||||
void DarwinPokeEQ(void) {
|
|
||||||
char nullbyte=0;
|
|
||||||
input_check_flag++;
|
|
||||||
// <daniels> bushing: oh, i ... er ... christ.
|
|
||||||
write(darwinEventWriteFD, &nullbyte, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
|
|
||||||
int i;
|
|
||||||
int valuators[2] = {pointer_x, pointer_y};
|
|
||||||
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
|
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
|
||||||
|
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
|
||||||
DarwinPokeEQ();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
|
||||||
int i;
|
|
||||||
int num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
|
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
|
|
||||||
DarwinPokeEQ();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
|
|
||||||
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
|
|
||||||
int i;
|
|
||||||
int ev_button = count > 0.0f ? 4 : 5;
|
|
||||||
int valuators[2] = {pointer_x, pointer_y};
|
|
||||||
|
|
||||||
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
|
||||||
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
|
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
|
||||||
num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
|
|
||||||
POINTER_ABSOLUTE, 0, 2, valuators);
|
|
||||||
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
|
||||||
}
|
|
||||||
DarwinPokeEQ();
|
|
||||||
}
|
|
||||||
|
|
||||||
// This code should probably be merged with that in XDarwin's XServer.m - BB
|
// This code should probably be merged with that in XDarwin's XServer.m - BB
|
||||||
static void send_nsevent (NSEventType type, NSEvent *e) {
|
static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
|
@ -961,11 +919,7 @@ static void send_nsevent (NSEventType type, NSEvent *e) {
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSFlagsChanged:
|
case NSFlagsChanged:
|
||||||
bzero(&xe, sizeof(xe));
|
DarwinUpdateModKeys([e modifierFlags]);
|
||||||
xe.u.u.type = kXDarwinUpdateModifiers;
|
|
||||||
xe.u.clientMessage.u.l.longs0 = [e modifierFlags];
|
|
||||||
DarwinEQEnqueue (&xe);
|
|
||||||
DarwinPokeEQ();
|
|
||||||
break;
|
break;
|
||||||
default: break; /* for gcc */
|
default: break; /* for gcc */
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,6 +63,8 @@ typedef struct _Event {
|
||||||
|
|
||||||
int input_check_zero, input_check_flag;
|
int input_check_zero, input_check_flag;
|
||||||
|
|
||||||
|
static int old_flags = 0; // last known modifier state
|
||||||
|
|
||||||
typedef struct _EventQueue {
|
typedef struct _EventQueue {
|
||||||
HWEventQueueType head, tail; /* long for SetInputCheck */
|
HWEventQueueType head, tail; /* long for SetInputCheck */
|
||||||
CARD32 lastEventTime; /* to avoid time running backwards */
|
CARD32 lastEventTime; /* to avoid time running backwards */
|
||||||
|
@ -81,18 +83,15 @@ xEvent *darwinEvents;
|
||||||
* Press or release the given modifier key, specified by its mask.
|
* Press or release the given modifier key, specified by its mask.
|
||||||
*/
|
*/
|
||||||
static void DarwinPressModifierMask(
|
static void DarwinPressModifierMask(
|
||||||
xEvent *xe, // must already have type, time and mouse location
|
int pressed,
|
||||||
int mask) // one of NX_*MASK constants
|
int mask) // one of NX_*MASK constants
|
||||||
{
|
{
|
||||||
int key = DarwinModifierNXMaskToNXKey(mask);
|
int key = DarwinModifierNXMaskToNXKey(mask);
|
||||||
|
|
||||||
if (key != -1) {
|
if (key != -1) {
|
||||||
int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
|
int keycode = DarwinModifierNXKeyToNXKeycode(key, 0);
|
||||||
if (keycode != 0) {
|
if (keycode != 0)
|
||||||
xe->u.u.detail = keycode + MIN_KEYCODE;
|
DarwinSendKeyboardEvents(pressed, keycode);
|
||||||
(*darwinEventQueue.pKbd->processInputProc)(xe,
|
|
||||||
(DeviceIntPtr)darwinEventQueue.pKbd, 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,28 +124,26 @@ static void DarwinPressModifierMask(
|
||||||
* Send events to update the modifier state.
|
* Send events to update the modifier state.
|
||||||
*/
|
*/
|
||||||
static void DarwinUpdateModifiers(
|
static void DarwinUpdateModifiers(
|
||||||
xEvent *xe, // event template with time and mouse position set
|
|
||||||
int pressed, // KeyPress or KeyRelease
|
int pressed, // KeyPress or KeyRelease
|
||||||
int flags ) // modifier flags that have changed
|
int flags ) // modifier flags that have changed
|
||||||
{
|
{
|
||||||
xe->u.u.type = pressed;
|
|
||||||
if (flags & NX_ALPHASHIFTMASK) {
|
if (flags & NX_ALPHASHIFTMASK) {
|
||||||
DarwinPressModifierMask(xe, NX_ALPHASHIFTMASK);
|
DarwinPressModifierMask(pressed, NX_ALPHASHIFTMASK);
|
||||||
}
|
}
|
||||||
if (flags & NX_COMMANDMASK) {
|
if (flags & NX_COMMANDMASK) {
|
||||||
DarwinPressModifierMask(xe, COMMAND_MASK(flags));
|
DarwinPressModifierMask(pressed, COMMAND_MASK(flags));
|
||||||
}
|
}
|
||||||
if (flags & NX_CONTROLMASK) {
|
if (flags & NX_CONTROLMASK) {
|
||||||
DarwinPressModifierMask(xe, CONTROL_MASK(flags));
|
DarwinPressModifierMask(pressed, CONTROL_MASK(flags));
|
||||||
}
|
}
|
||||||
if (flags & NX_ALTERNATEMASK) {
|
if (flags & NX_ALTERNATEMASK) {
|
||||||
DarwinPressModifierMask(xe, ALTERNATE_MASK(flags));
|
DarwinPressModifierMask(pressed, ALTERNATE_MASK(flags));
|
||||||
}
|
}
|
||||||
if (flags & NX_SHIFTMASK) {
|
if (flags & NX_SHIFTMASK) {
|
||||||
DarwinPressModifierMask(xe, SHIFT_MASK(flags));
|
DarwinPressModifierMask(pressed, SHIFT_MASK(flags));
|
||||||
}
|
}
|
||||||
if (flags & NX_SECONDARYFNMASK) {
|
if (flags & NX_SECONDARYFNMASK) {
|
||||||
DarwinPressModifierMask(xe, NX_SECONDARYFNMASK);
|
DarwinPressModifierMask(pressed, NX_SECONDARYFNMASK);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,19 +160,20 @@ static void DarwinUpdateModifiers(
|
||||||
* simulate a button 2 press instead of Command-button 2.
|
* simulate a button 2 press instead of Command-button 2.
|
||||||
*/
|
*/
|
||||||
static void DarwinSimulateMouseClick(
|
static void DarwinSimulateMouseClick(
|
||||||
xEvent *xe, // event template with time and
|
int pointer_x,
|
||||||
// mouse position filled in
|
int pointer_y,
|
||||||
int whichButton, // mouse button to be pressed
|
int whichButton, // mouse button to be pressed
|
||||||
int modifierMask) // modifiers used for the fake click
|
int modifierMask) // modifiers used for the fake click
|
||||||
{
|
{
|
||||||
// first fool X into forgetting about the keys
|
// first fool X into forgetting about the keys
|
||||||
DarwinUpdateModifiers(xe, KeyRelease, modifierMask);
|
DarwinUpdateModifiers(KeyRelease, modifierMask);
|
||||||
|
|
||||||
// push the mouse button
|
// push the mouse button
|
||||||
xe->u.u.type = ButtonPress;
|
DarwinSendPointerEvents(ButtonPress, whichButton, pointer_x, pointer_y);
|
||||||
xe->u.u.detail = whichButton;
|
DarwinSendPointerEvents(ButtonRelease, whichButton, pointer_x, pointer_y);
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
// restore old modifiers
|
||||||
|
DarwinUpdateModifiers(KeyPress, modifierMask);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -234,7 +232,7 @@ void DarwinEQEnqueue(const xEvent *e) {
|
||||||
darwinEventQueue.tail = newtail;
|
darwinEventQueue.tail = newtail;
|
||||||
|
|
||||||
// Signal there is an event ready to handle
|
// Signal there is an event ready to handle
|
||||||
write(darwinEventWriteFD, &byte, 1);
|
DarwinPokeEQ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -265,8 +263,6 @@ void ProcessInputEvents(void) {
|
||||||
xEvent xe;
|
xEvent xe;
|
||||||
static int old_flags = 0; // last known modifier state
|
static int old_flags = 0; // last known modifier state
|
||||||
// button number and modifier mask of currently pressed fake button
|
// button number and modifier mask of currently pressed fake button
|
||||||
static int darwinFakeMouseButtonDown = 0;
|
|
||||||
static int darwinFakeMouseButtonMask = 0;
|
|
||||||
input_check_flag=0;
|
input_check_flag=0;
|
||||||
|
|
||||||
// ErrorF("calling mieqProcessInputEvents\n");
|
// ErrorF("calling mieqProcessInputEvents\n");
|
||||||
|
@ -318,155 +314,35 @@ void ProcessInputEvents(void) {
|
||||||
darwinEventQueue.head = 0;
|
darwinEventQueue.head = 0;
|
||||||
else
|
else
|
||||||
++darwinEventQueue.head;
|
++darwinEventQueue.head;
|
||||||
switch (xe.u.u.type)
|
switch (xe.u.u.type) {
|
||||||
{
|
|
||||||
case KeyPress:
|
case KeyPress:
|
||||||
if (old_flags == 0
|
|
||||||
&& darwinSyncKeymap && darwinKeymapFile == NULL)
|
|
||||||
{
|
|
||||||
/* See if keymap has changed. */
|
|
||||||
|
|
||||||
static unsigned int last_seed;
|
|
||||||
unsigned int this_seed;
|
|
||||||
|
|
||||||
this_seed = DarwinModeSystemKeymapSeed();
|
|
||||||
if (this_seed != last_seed)
|
|
||||||
{
|
|
||||||
last_seed = this_seed;
|
|
||||||
DarwinKeyboardReload(darwinKeyboard);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* fall through */
|
|
||||||
|
|
||||||
case KeyRelease:
|
case KeyRelease:
|
||||||
xe.u.u.detail += MIN_KEYCODE;
|
ErrorF("Unexpected Keyboard event in DarwinProcessInputEvents\n");
|
||||||
(*darwinEventQueue.pKbd->processInputProc)
|
break;
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pKbd, 1);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ButtonPress:
|
case ButtonPress:
|
||||||
miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
|
ErrorF("Unexpected ButtonPress event in DarwinProcessInputEvents\n");
|
||||||
xe.u.keyButtonPointer.rootY,
|
|
||||||
xe.u.keyButtonPointer.time);
|
|
||||||
if (darwinFakeButtons && xe.u.u.detail == 1) {
|
|
||||||
// Mimic multi-button mouse with modifier-clicks
|
|
||||||
// If both sets of modifiers are pressed,
|
|
||||||
// button 2 is clicked.
|
|
||||||
if ((old_flags & darwinFakeMouse2Mask) ==
|
|
||||||
darwinFakeMouse2Mask)
|
|
||||||
{
|
|
||||||
DarwinSimulateMouseClick(&xe, 2, darwinFakeMouse2Mask);
|
|
||||||
darwinFakeMouseButtonDown = 2;
|
|
||||||
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else if ((old_flags & darwinFakeMouse3Mask) ==
|
|
||||||
darwinFakeMouse3Mask)
|
|
||||||
{
|
|
||||||
DarwinSimulateMouseClick(&xe, 3, darwinFakeMouse3Mask);
|
|
||||||
darwinFakeMouseButtonDown = 3;
|
|
||||||
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ButtonRelease:
|
case ButtonRelease:
|
||||||
miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
|
ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
|
||||||
xe.u.keyButtonPointer.rootY,
|
|
||||||
xe.u.keyButtonPointer.time);
|
|
||||||
if (darwinFakeButtons && xe.u.u.detail == 1 &&
|
|
||||||
darwinFakeMouseButtonDown)
|
|
||||||
{
|
|
||||||
// If last mousedown was a fake click, don't check for
|
|
||||||
// mouse modifiers here. The user may have released the
|
|
||||||
// modifiers before the mouse button.
|
|
||||||
xe.u.u.detail = darwinFakeMouseButtonDown;
|
|
||||||
darwinFakeMouseButtonDown = 0;
|
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
|
||||||
|
|
||||||
// Bring modifiers back up to date
|
|
||||||
DarwinUpdateModifiers(&xe, KeyPress,
|
|
||||||
darwinFakeMouseButtonMask & old_flags);
|
|
||||||
darwinFakeMouseButtonMask = 0;
|
|
||||||
} else {
|
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MotionNotify:
|
case MotionNotify:
|
||||||
miPointerAbsoluteCursor(xe.u.keyButtonPointer.rootX,
|
ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
|
||||||
xe.u.keyButtonPointer.rootY,
|
|
||||||
xe.u.keyButtonPointer.time);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case kXDarwinUpdateModifiers:
|
case kXDarwinUpdateModifiers:
|
||||||
{
|
ErrorF("Unexpected ButtonRelease event in DarwinProcessInputEvents\n");
|
||||||
// Update modifier state.
|
break;
|
||||||
// Any amount of modifiers may have changed.
|
|
||||||
int flags = xe.u.clientMessage.u.l.longs0;
|
|
||||||
DarwinUpdateModifiers(&xe, KeyRelease,
|
|
||||||
old_flags & ~flags);
|
|
||||||
DarwinUpdateModifiers(&xe, KeyPress,
|
|
||||||
~old_flags & flags);
|
|
||||||
old_flags = flags;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case kXDarwinUpdateButtons:
|
case kXDarwinUpdateButtons:
|
||||||
{
|
ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
|
||||||
long hwDelta = xe.u.clientMessage.u.l.longs0;
|
break;
|
||||||
long hwButtons = xe.u.clientMessage.u.l.longs1;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 1; i < 5; i++) {
|
case kXDarwinScrollWheel:
|
||||||
if (hwDelta & (1 << i)) {
|
ErrorF("Unexpected XDarwinScrollWheel event in DarwinProcessInputEvents\n");
|
||||||
// IOKit and X have different numbering for the
|
break;
|
||||||
// middle and right mouse buttons.
|
|
||||||
if (i == 1) {
|
|
||||||
xe.u.u.detail = 3;
|
|
||||||
} else if (i == 2) {
|
|
||||||
xe.u.u.detail = 2;
|
|
||||||
} else {
|
|
||||||
xe.u.u.detail = i + 1;
|
|
||||||
}
|
|
||||||
if (hwButtons & (1 << i)) {
|
|
||||||
xe.u.u.type = ButtonPress;
|
|
||||||
} else {
|
|
||||||
xe.u.u.type = ButtonRelease;
|
|
||||||
}
|
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
case kXDarwinScrollWheel:
|
|
||||||
{
|
|
||||||
short count = xe.u.clientMessage.u.s.shorts0;
|
|
||||||
|
|
||||||
if (count > 0) {
|
|
||||||
xe.u.u.detail = SCROLLWHEELUPFAKE;
|
|
||||||
} else {
|
|
||||||
xe.u.u.detail = SCROLLWHEELDOWNFAKE;
|
|
||||||
count = -count;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (; count; --count) {
|
|
||||||
xe.u.u.type = ButtonPress;
|
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
|
||||||
xe.u.u.type = ButtonRelease;
|
|
||||||
(*darwinEventQueue.pPtr->processInputProc)
|
|
||||||
(&xe, (DeviceIntPtr)darwinEventQueue.pPtr, 1);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
// Check for mode specific event
|
// Check for mode specific event
|
||||||
|
@ -475,5 +351,96 @@ void ProcessInputEvents(void) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
miPointerUpdate();
|
// miPointerUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Sends a null byte down darwinEventWriteFD, which will cause the
|
||||||
|
Dispatch() event loop to check out event queue */
|
||||||
|
void DarwinPokeEQ(void) {
|
||||||
|
char nullbyte=0;
|
||||||
|
input_check_flag++;
|
||||||
|
// <daniels> bushing: oh, i ... er ... christ.
|
||||||
|
write(darwinEventWriteFD, &nullbyte, 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DarwinSendPointerEvents(int ev_type, int ev_button, int pointer_x, int pointer_y) {
|
||||||
|
static int darwinFakeMouseButtonDown = 0;
|
||||||
|
static int darwinFakeMouseButtonMask = 0;
|
||||||
|
int i, num_events;
|
||||||
|
int valuators[2] = {pointer_x, pointer_y};
|
||||||
|
if (ev_type == ButtonPress && darwinFakeButtons && ev_button == 1) {
|
||||||
|
// Mimic multi-button mouse with modifier-clicks
|
||||||
|
// If both sets of modifiers are pressed,
|
||||||
|
// button 2 is clicked.
|
||||||
|
if ((old_flags & darwinFakeMouse2Mask) == darwinFakeMouse2Mask) {
|
||||||
|
DarwinSimulateMouseClick(pointer_x, pointer_y, 2, darwinFakeMouse2Mask);
|
||||||
|
darwinFakeMouseButtonDown = 2;
|
||||||
|
darwinFakeMouseButtonMask = darwinFakeMouse2Mask;
|
||||||
|
} else if ((old_flags & darwinFakeMouse3Mask) == darwinFakeMouse3Mask) {
|
||||||
|
DarwinSimulateMouseClick(pointer_x, pointer_y, 3, darwinFakeMouse3Mask);
|
||||||
|
darwinFakeMouseButtonDown = 3;
|
||||||
|
darwinFakeMouseButtonMask = darwinFakeMouse3Mask;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (ev_type == ButtonRelease && darwinFakeButtons && darwinFakeMouseButtonDown) {
|
||||||
|
// If last mousedown was a fake click, don't check for
|
||||||
|
// mouse modifiers here. The user may have released the
|
||||||
|
// modifiers before the mouse button.
|
||||||
|
ev_button = darwinFakeMouseButtonDown;
|
||||||
|
darwinFakeMouseButtonDown = 0;
|
||||||
|
// Bring modifiers back up to date
|
||||||
|
DarwinUpdateModifiers(KeyPress, darwinFakeMouseButtonMask & old_flags);
|
||||||
|
darwinFakeMouseButtonMask = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
num_events = GetPointerEvents(darwinEvents, darwinPointer, ev_type, ev_button,
|
||||||
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
|
||||||
|
for(i=0; i<num_events; i++) mieqEnqueue (darwinPointer,&darwinEvents[i]);
|
||||||
|
DarwinPokeEQ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DarwinSendKeyboardEvents(int ev_type, int keycode) {
|
||||||
|
int i, num_events;
|
||||||
|
if (old_flags == 0 && darwinSyncKeymap && darwinKeymapFile == NULL) {
|
||||||
|
/* See if keymap has changed. */
|
||||||
|
|
||||||
|
static unsigned int last_seed;
|
||||||
|
unsigned int this_seed;
|
||||||
|
|
||||||
|
this_seed = DarwinModeSystemKeymapSeed();
|
||||||
|
if (this_seed != last_seed) {
|
||||||
|
last_seed = this_seed;
|
||||||
|
DarwinKeyboardReload(darwinKeyboard);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
num_events = GetKeyboardEvents(darwinEvents, darwinKeyboard, ev_type, keycode + MIN_KEYCODE);
|
||||||
|
for(i=0; i<num_events; i++) mieqEnqueue(darwinKeyboard,&darwinEvents[i]);
|
||||||
|
DarwinPokeEQ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Send the appropriate number of button 4 / 5 clicks to emulate scroll wheel */
|
||||||
|
void DarwinSendScrollEvents(float count, int pointer_x, int pointer_y) {
|
||||||
|
int i;
|
||||||
|
int ev_button = count > 0.0f ? 4 : 5;
|
||||||
|
int valuators[2] = {pointer_x, pointer_y};
|
||||||
|
|
||||||
|
for (count = fabs(count); count > 0.0; count = count - 1.0f) {
|
||||||
|
int num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonPress, ev_button,
|
||||||
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
||||||
|
num_events = GetPointerEvents(darwinEvents, darwinPointer, ButtonRelease, ev_button,
|
||||||
|
POINTER_ABSOLUTE, 0, 2, valuators);
|
||||||
|
for(i=0; i<num_events; i++) mieqEnqueue(darwinPointer,&darwinEvents[i]);
|
||||||
|
}
|
||||||
|
DarwinPokeEQ();
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Send the appropriate KeyPress/KeyRelease events to GetKeyboardEvents to
|
||||||
|
reflect changing modifier flags (alt, control, meta, etc) */
|
||||||
|
void DarwinUpdateModKeys(int flags) {
|
||||||
|
DarwinUpdateModifiers(KeyRelease, old_flags & ~flags);
|
||||||
|
DarwinUpdateModifiers(KeyPress, ~old_flags & flags);
|
||||||
|
old_flags = flags;
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,15 +49,11 @@
|
||||||
/** Initialize a private area in \a pScreen for pixmap information. */
|
/** Initialize a private area in \a pScreen for pixmap information. */
|
||||||
Bool dmxInitPixmap(ScreenPtr pScreen)
|
Bool dmxInitPixmap(ScreenPtr pScreen)
|
||||||
{
|
{
|
||||||
#ifdef PIXPRIV
|
|
||||||
if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex,
|
if (!AllocatePixmapPrivate(pScreen, dmxPixPrivateIndex,
|
||||||
sizeof(dmxPixPrivRec)))
|
sizeof(dmxPixPrivRec)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#else
|
|
||||||
#error Must define PIXPRIV to compile DMX X server
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Create a pixmap on the back-end server. */
|
/** Create a pixmap on the back-end server. */
|
||||||
|
|
|
@ -70,9 +70,7 @@ static unsigned long *dmxCursorGeneration;
|
||||||
|
|
||||||
int dmxGCPrivateIndex; /**< Private index for GCs */
|
int dmxGCPrivateIndex; /**< Private index for GCs */
|
||||||
int dmxWinPrivateIndex; /**< Private index for Windows */
|
int dmxWinPrivateIndex; /**< Private index for Windows */
|
||||||
#ifdef PIXPRIV
|
|
||||||
int dmxPixPrivateIndex; /**< Private index for Pixmaps */
|
int dmxPixPrivateIndex; /**< Private index for Pixmaps */
|
||||||
#endif
|
|
||||||
int dmxFontPrivateIndex; /**< Private index for Fonts */
|
int dmxFontPrivateIndex; /**< Private index for Fonts */
|
||||||
int dmxScreenPrivateIndex; /**< Private index for Screens */
|
int dmxScreenPrivateIndex; /**< Private index for Screens */
|
||||||
int dmxColormapPrivateIndex; /**< Private index for Colormaps */
|
int dmxColormapPrivateIndex; /**< Private index for Colormaps */
|
||||||
|
@ -233,14 +231,10 @@ Bool dmxScreenInit(int idx, ScreenPtr pScreen, int argc, char *argv[])
|
||||||
if (dmxWinPrivateIndex == -1)
|
if (dmxWinPrivateIndex == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
/* Allocate pixmap private index */
|
/* Allocate pixmap private index */
|
||||||
dmxPixPrivateIndex = AllocatePixmapPrivateIndex();
|
dmxPixPrivateIndex = AllocatePixmapPrivateIndex();
|
||||||
if (dmxPixPrivateIndex == -1)
|
if (dmxPixPrivateIndex == -1)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
#else
|
|
||||||
#error Must define PIXPRIV to compile DMX X server
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Allocate font private index */
|
/* Allocate font private index */
|
||||||
dmxFontPrivateIndex = AllocateFontPrivateIndex();
|
dmxFontPrivateIndex = AllocateFontPrivateIndex();
|
||||||
|
|
|
@ -968,7 +968,7 @@ localAllocateOffscreenLinear(
|
||||||
linear->size = h * w;
|
linear->size = h * w;
|
||||||
linear->offset = (pitch * area->box.y1) + area->box.x1;
|
linear->offset = (pitch * area->box.y1) + area->box.x1;
|
||||||
if (gran > 1)
|
if (gran > 1)
|
||||||
linear->offset += ((linear->offset + gran - 1) / gran) * gran;
|
linear->offset = ((linear->offset + gran - 1) / gran) * gran;
|
||||||
linear->granularity = gran;
|
linear->granularity = gran;
|
||||||
linear->MoveLinearCallback = moveCB;
|
linear->MoveLinearCallback = moveCB;
|
||||||
linear->RemoveLinearCallback = removeCB;
|
linear->RemoveLinearCallback = removeCB;
|
||||||
|
|
|
@ -0,0 +1,474 @@
|
||||||
|
Multi-monitor Mode Setting APIs
|
||||||
|
Keith Packard, <keithp@keithp.com
|
||||||
|
6 March 2007
|
||||||
|
|
||||||
|
1. Introduction
|
||||||
|
|
||||||
|
This document describes a set of mode setting APIs added in X server version
|
||||||
|
1.3 that support multiple monitors per card. These interfaces expose the
|
||||||
|
underlying hardware CRTC and output concepts to the xf86 DDX layer so that
|
||||||
|
the implementation of initial server setup and mode changes through
|
||||||
|
extensions can be shared across drivers. In addition, these new interfaces
|
||||||
|
support a new configuration mechanism as well which allows each monitor to
|
||||||
|
be customized separately providing a consistent cross-driver configuration
|
||||||
|
mechanism that supports the full range of output features.
|
||||||
|
|
||||||
|
All of the code implementing this interface can be found in hw/xfree86/modes
|
||||||
|
in the X server sources.
|
||||||
|
|
||||||
|
2. Overview
|
||||||
|
|
||||||
|
This document describes both the driver API and the configuration data
|
||||||
|
placed in xorg.conf; these are entirely separate as the driver has no
|
||||||
|
interaction with the configuration information at all. Much of the structure
|
||||||
|
here is cloned from the RandR extension version 1.2 additions which deal
|
||||||
|
with the same kinds of information.
|
||||||
|
|
||||||
|
2.1 API overview
|
||||||
|
|
||||||
|
The mode setting API is expressed through two new driver-visible objects,
|
||||||
|
the 'CRTC' (xf86CrtcRec) and the 'Output' (xf86OutputRec). A CRTC refers to
|
||||||
|
hardware within the video system that can scan a subset of the framebuffer
|
||||||
|
and generate a video signal. An Output receives that signal and transmits it
|
||||||
|
to a monitor, projector or other device.
|
||||||
|
|
||||||
|
The xf86CrtcRec and xf86OutputRec contain a small amount of state data
|
||||||
|
related to the object along with a pointer to a set of functions provided by
|
||||||
|
the driver that manipulate the object in fairly simple ways.
|
||||||
|
|
||||||
|
To emulate older behaviour, one of the outputs is picked as the 'compat'
|
||||||
|
output; this output changes over time as outputs are detected and used, the
|
||||||
|
goal is to always have one 'special' output which is used for operations
|
||||||
|
which need a single defined monitor (like XFree86-VidModeExtension mode
|
||||||
|
setting, RandR 1.1 mode setting, DDC property setting, etc.).
|
||||||
|
|
||||||
|
2.1.1 Output overview
|
||||||
|
|
||||||
|
As outputs are connected to monitors, they hold a list of modes supported by
|
||||||
|
the monitor. If the monitor and output support DDC, then the list of modes
|
||||||
|
generally comes from the EDID data in the monitor. Otherwise, the server
|
||||||
|
uses the standard VESA modes, pruned by monitor timing. If the configuration
|
||||||
|
file doesn't contain monitor timing data, the server uses default timing
|
||||||
|
information which supports 640x480, 800x600 and 1024x768 all with a 60Hz
|
||||||
|
refresh rate.
|
||||||
|
|
||||||
|
As hardware often limits possible configuration combinations, each output
|
||||||
|
knows the set of CRTCs that it can be connected to as well as the set of
|
||||||
|
other outputs which can be simutaneously connected to a CRTC.
|
||||||
|
|
||||||
|
2.1.2 CRTC overview
|
||||||
|
|
||||||
|
CRTCs serve only to stream frame buffer data to outputs using a mode line.
|
||||||
|
Ideally, they would not be presented to the user at all, and in fact the
|
||||||
|
configuration file doesn't expose them. The RandR 1.2 protocol does, but the
|
||||||
|
hope there is that client-side applications will hide them carefully away.
|
||||||
|
|
||||||
|
Each crtc has an associated cursor, along with the current configuration.
|
||||||
|
All of the data needed to determine valid configurations is contained within
|
||||||
|
the Outputs.
|
||||||
|
|
||||||
|
2.2 Configuration overview
|
||||||
|
|
||||||
|
As outputs drive monitors, the "Monitor" section has been repurposed to
|
||||||
|
define their configuration. This provides for a bit more syntax than
|
||||||
|
the large list of driver-specific options that were used in the past for
|
||||||
|
similar configuration.
|
||||||
|
|
||||||
|
However, the existing "Monitor" section referenced by the active "Screen"
|
||||||
|
section no longer has any use at all; some sensible meaning for this
|
||||||
|
parameter is needed now that a Screen can have multiple Monitors.
|
||||||
|
|
||||||
|
3. Public Functions
|
||||||
|
|
||||||
|
3.1 PreInit functions
|
||||||
|
|
||||||
|
These functions should be used during the driver PreInit phase, they are
|
||||||
|
arranged in the order they should be invoked.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86CrtcConfigInit (ScrnInfoPtr scrn
|
||||||
|
const xf86CrtcConfigFuncsRec *funcs)
|
||||||
|
|
||||||
|
This function allocates and initializes structures needed to track CRTC and
|
||||||
|
Output state.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86CrtcSetSizeRange (ScrnInfoPtr scrn,
|
||||||
|
int minWidth, int minHeight,
|
||||||
|
int maxWidth, int maxHeight)
|
||||||
|
|
||||||
|
This sets the range of screen sizes supported by the driver.
|
||||||
|
|
||||||
|
xf86CrtcPtr
|
||||||
|
xf86CrtcCreate (ScrnInfoPtr scrn,
|
||||||
|
const xf86CrtcFuncsRec *funcs)
|
||||||
|
|
||||||
|
Create one CRTC object. See the discussion below for a description of the
|
||||||
|
contents of the xf86CrtcFuncsRec. Note that this is done in PreInit, so it
|
||||||
|
should not be re-invoked at each server generation. Create one of these for
|
||||||
|
each CRTC present in the hardware.
|
||||||
|
|
||||||
|
xf86OutputPtr
|
||||||
|
xf86OutputCreate (ScrnInfoPtr scrn,
|
||||||
|
const xf86OutputFuncsRec *funcs,
|
||||||
|
const char *name)
|
||||||
|
|
||||||
|
Create one Output object. See the discussion below for a description of the
|
||||||
|
contents of the xf86OutputFuncsRec. This is also called from PreInit and
|
||||||
|
need not be re-invoked at each ScreenInit time. An Output should be created
|
||||||
|
for every Output present in the hardware, not just for outputs which have
|
||||||
|
detected monitors.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86OutputRename (xf86OutputPtr output, const char *name)
|
||||||
|
|
||||||
|
If necessary, the name of an output can be changed after it is created using
|
||||||
|
this function.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
||||||
|
|
||||||
|
Using the resources provided, and the configuration specified by the user,
|
||||||
|
this function computes an initial configuration for the server. It tries to
|
||||||
|
enable as much hardware as possible using some fairly simple heuristics.
|
||||||
|
|
||||||
|
The 'canGrow' parameter indicates that the frame buffer does not have a fixed
|
||||||
|
size (fixed size frame buffers are required by XAA). When the frame buffer
|
||||||
|
has a fixed size, the configuration selects a 'reasonablely large' frame
|
||||||
|
buffer so that common reconfiguration options are possible. For resizable
|
||||||
|
frame buffers, the frame buffer is set to the smallest size that encloses
|
||||||
|
the desired configuration.
|
||||||
|
|
||||||
|
3.2 ScreenInit functions
|
||||||
|
|
||||||
|
These functions should be used during the driver ScreenInit phase.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86DiDGAInit (ScreenPtr screen, unsigned long dga_address)
|
||||||
|
|
||||||
|
This function provides driver-independent accelerated DGA support for some
|
||||||
|
of the DGA operations; using this, the driver can avoid needing to implement
|
||||||
|
any of the rest of DGA.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SaveScreen(ScreenPtr pScreen, int mode)
|
||||||
|
|
||||||
|
Stick this in pScreen->SaveScreen and the core X screen saver will be
|
||||||
|
implemented by disabling outputs and crtcs using their dpms functions.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags)
|
||||||
|
|
||||||
|
Pass this function to xf86DPMSInit and all DPMS mode switching will be
|
||||||
|
managed by using the dpms functions provided by the Outputs and CRTCs.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86CrtcScreenInit (ScreenPtr screen)
|
||||||
|
|
||||||
|
This function completes the screen initialization process for the crtc and
|
||||||
|
output objects. Call it near the end of the ScreenInit function, after the
|
||||||
|
frame buffer and acceleration layers have been added.
|
||||||
|
|
||||||
|
3.3 EnterVT functions
|
||||||
|
|
||||||
|
Functions used during EnterVT, or whenever the current configuration needs
|
||||||
|
to be applied to the hardware.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SetDesiredModes (ScrnInfoPtr scrn)
|
||||||
|
|
||||||
|
xf86InitialConfiguration selects the desired configuration at PreInit time;
|
||||||
|
when the server finally hits ScreenInit, xf86SetDesiredModes is used by the
|
||||||
|
driver to take that configuration and apply it to the hardware. In addition,
|
||||||
|
successful mode selection at other times updates the configuration that will
|
||||||
|
be used by this function, so LeaveVT/EnterVT pairs can simply invoke this
|
||||||
|
and return to the previous configuration.
|
||||||
|
|
||||||
|
3.4 SwitchMode functions
|
||||||
|
|
||||||
|
Functions called from the pScrn->SwitchMode hook, which is used by the
|
||||||
|
XFree86-VidModeExtension and the keypad mode switch commands.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SetSingleMode (ScrnInfoPtr scrn,
|
||||||
|
DisplayModePtr desired,
|
||||||
|
Rotation rotation)
|
||||||
|
|
||||||
|
This function applies the specified mode to all active outputs. Which is to
|
||||||
|
say, it picks reasonable modes for all active outputs, attempting to get the
|
||||||
|
screen to the specified size while not breaking anything that is currently
|
||||||
|
working.
|
||||||
|
|
||||||
|
3.7 get_modes functions
|
||||||
|
|
||||||
|
Functions called during output->get_modes to help build lists of modes
|
||||||
|
|
||||||
|
xf86MonPtr
|
||||||
|
xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus)
|
||||||
|
|
||||||
|
This returns the EDID data structure for the 'output' using the I2C bus
|
||||||
|
'pDDCBus'. This has no effect on 'output' itself.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon)
|
||||||
|
|
||||||
|
Once the EDID data has been fetched, this call applies the EDID data to the
|
||||||
|
output object, setting the physical size and also various properties, like
|
||||||
|
the DDC root window property (when output is the 'compat' output), and the
|
||||||
|
RandR 1.2 EDID output properties.
|
||||||
|
|
||||||
|
DisplayModePtr
|
||||||
|
xf86OutputGetEDIDModes (xf86OutputPtr output)
|
||||||
|
|
||||||
|
Given an EDID data structure, this function computes a list of suitable
|
||||||
|
modes. This function also applies a sequence of 'quirks' during this process
|
||||||
|
so that the returned modes may not actually match the mode data present in
|
||||||
|
the EDID data.
|
||||||
|
|
||||||
|
3.6 Other functions
|
||||||
|
|
||||||
|
These remaining functions in the API can be used by the driver as needed.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation,
|
||||||
|
int x, int y)
|
||||||
|
|
||||||
|
Applies a mode to a CRTC. All of the outputs which are currently using the
|
||||||
|
specified CRTC are included in the mode setting process. 'x' and 'y' are the
|
||||||
|
offset within the frame buffer that the crtc is placed at. No checking is
|
||||||
|
done in this function to ensure that the mode is usable by the active
|
||||||
|
outputs.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY)
|
||||||
|
|
||||||
|
This discards the mode lists for all outputs, re-detects monitor presence
|
||||||
|
and then acquires new mode lists for all monitors which are not disconnected.
|
||||||
|
Monitor configuration data is used to modify the mode lists returned by the
|
||||||
|
outputs. 'maxX' and 'maxY' limit the maximum size modes that will be
|
||||||
|
returned.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86SetScrnInfoModes (ScrnInfoPtr pScrn)
|
||||||
|
|
||||||
|
This copies the 'compat' output mode list into the pScrn modes list which is
|
||||||
|
used by the XFree86-VidModeExtension and the keypad mode switching
|
||||||
|
operations. The current 'desired' mode for the CRTC associated with the
|
||||||
|
'compat' output is placed first in this list to indicate the current mode.
|
||||||
|
Usually, the driver won't need to call this function as
|
||||||
|
xf86InitialConfiguration will do so automatically, as well as any RandR
|
||||||
|
functions which reprobe for modes. However, if the driver reprobes for modes
|
||||||
|
at other times using xf86ProbeOutputModes, this function needs to be called.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86DiDGAReInit (ScreenPtr pScreen)
|
||||||
|
|
||||||
|
This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output
|
||||||
|
mode list to the set of modes advertised by the DGA extension; it needs to
|
||||||
|
be called whenever xf86ProbeOutputModes is invoked.
|
||||||
|
|
||||||
|
void
|
||||||
|
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn)
|
||||||
|
|
||||||
|
After any sequence of calls using xf86CrtcSetMode, this function cleans up
|
||||||
|
any leftover Output and CRTC objects by disabling them, saving power. It is
|
||||||
|
safe to call this whenever the server is running as it only disables objects
|
||||||
|
which are not currently in use.
|
||||||
|
|
||||||
|
4. CRTC operations
|
||||||
|
|
||||||
|
4.1 CRTC functions
|
||||||
|
|
||||||
|
These functions provide an abstract interface for the CRTC object; most
|
||||||
|
manipulation of the CRTC object is done through these functions.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->dpms (xf86CrtcPtr crtc, int mode)
|
||||||
|
|
||||||
|
Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or
|
||||||
|
DPMSModeOn. This requests that the crtc go to the specified power state.
|
||||||
|
When changing power states, the output dpms functions are invoked before the
|
||||||
|
crtc dpms functions.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->save (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->restore (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
Preserve/restore any register contents related to the CRTC. These are
|
||||||
|
strictly a convenience for the driver writer; if the existing driver has
|
||||||
|
fully operation save/restore functions, you need not place any additional
|
||||||
|
code here. In particular, the server itself never uses this function.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
crtc->funcs->lock (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->unlock (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
These functions are invoked around mode setting operations; the intent is
|
||||||
|
that DRI locking be done here to prevent DRI applications from manipulating
|
||||||
|
the hardware while the server is busy changing the output configuration. If
|
||||||
|
the lock function returns FALSE, the unlock function will not be invoked.
|
||||||
|
|
||||||
|
Bool
|
||||||
|
crtc->funcs->mode_fixup (xf86CrtcPtr crtc,
|
||||||
|
DisplayModePtr mode,
|
||||||
|
DisplayModePtr adjusted_mode)
|
||||||
|
|
||||||
|
This call gives the CRTC a chance to see what mode will be set and to
|
||||||
|
comment on the mode by changing 'adjusted_mode' as needed. This function
|
||||||
|
shall not modify the state of the crtc hardware at all. If the CRTC cannot
|
||||||
|
accept this mode, this function may return FALSE.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->prepare (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
This call is made just before the mode is set to make the hardware ready for
|
||||||
|
the operation. A usual function to perform here is to disable the crtc so
|
||||||
|
that mode setting can occur with clocks turned off and outputs deactivated.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->mode_set (xf86CrtcPtr crtc,
|
||||||
|
DisplayModePtr mode,
|
||||||
|
DisplayModePtr adjusted_mode)
|
||||||
|
|
||||||
|
This function applies the specified mode (possibly adjusted by the CRTC
|
||||||
|
and/or Outputs).
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->commit (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
Once the mode has been applied to the CRTC and Outputs, this function is
|
||||||
|
invoked to let the hardware turn things back on.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red,
|
||||||
|
CARD16 *green, CARD16 *blue, int size)
|
||||||
|
|
||||||
|
This function adjusts the gamma ramps for the specified crtc.
|
||||||
|
|
||||||
|
void *
|
||||||
|
crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height)
|
||||||
|
|
||||||
|
This function allocates frame buffer space for a shadow frame buffer. When
|
||||||
|
allocated, the crtc must scan from the shadow instead of the main frame
|
||||||
|
buffer. This is used for rotation. The address returned is passed to the
|
||||||
|
shadow_create function. This function should return NULL on failure.
|
||||||
|
|
||||||
|
PixmapPtr
|
||||||
|
crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data,
|
||||||
|
int width, int height)
|
||||||
|
|
||||||
|
This function creates a pixmap object that will be used as a shadow of the
|
||||||
|
main frame buffer for CRTCs which are rotated or reflected. 'data' is the
|
||||||
|
value returned by shadow_allocate.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap,
|
||||||
|
void *data)
|
||||||
|
|
||||||
|
Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap
|
||||||
|
was not created, but 'data' may still be non-NULL indicating that the shadow
|
||||||
|
had been allocated.
|
||||||
|
|
||||||
|
void
|
||||||
|
crtc->funcs->destroy (xf86CrtcPtr crtc)
|
||||||
|
|
||||||
|
When a CRTC is destroyed (which only happens in error cases), this function
|
||||||
|
can clean up any driver-specific data.
|
||||||
|
|
||||||
|
4.2 CRTC fields
|
||||||
|
|
||||||
|
The CRTC object is not opaque; there are several fields of interest to the
|
||||||
|
driver writer.
|
||||||
|
|
||||||
|
struct _xf86Crtc {
|
||||||
|
/**
|
||||||
|
* Associated ScrnInfo
|
||||||
|
*/
|
||||||
|
ScrnInfoPtr scrn;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active state of this CRTC
|
||||||
|
*
|
||||||
|
* Set when this CRTC is driving one or more outputs
|
||||||
|
*/
|
||||||
|
Bool enabled;
|
||||||
|
|
||||||
|
/** Track whether cursor is within CRTC range */
|
||||||
|
Bool cursorInRange;
|
||||||
|
|
||||||
|
/** Track state of cursor associated with this CRTC */
|
||||||
|
Bool cursorShown;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Active mode
|
||||||
|
*
|
||||||
|
* This reflects the mode as set in the CRTC currently
|
||||||
|
* It will be cleared when the VT is not active or
|
||||||
|
* during server startup
|
||||||
|
*/
|
||||||
|
DisplayModeRec mode;
|
||||||
|
Rotation rotation;
|
||||||
|
PixmapPtr rotatedPixmap;
|
||||||
|
void *rotatedData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Position on screen
|
||||||
|
*
|
||||||
|
* Locates this CRTC within the frame buffer
|
||||||
|
*/
|
||||||
|
int x, y;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Desired mode
|
||||||
|
*
|
||||||
|
* This is set to the requested mode, independent of
|
||||||
|
* whether the VT is active. In particular, it receives
|
||||||
|
* the startup configured mode and saves the active mode
|
||||||
|
* on VT switch.
|
||||||
|
*/
|
||||||
|
DisplayModeRec desiredMode;
|
||||||
|
Rotation desiredRotation;
|
||||||
|
int desiredX, desiredY;
|
||||||
|
|
||||||
|
/** crtc-specific functions */
|
||||||
|
const xf86CrtcFuncsRec *funcs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Driver private
|
||||||
|
*
|
||||||
|
* Holds driver-private information
|
||||||
|
*/
|
||||||
|
void *driver_private;
|
||||||
|
#ifdef RANDR_12_INTERFACE
|
||||||
|
/**
|
||||||
|
* RandR crtc
|
||||||
|
*
|
||||||
|
* When RandR 1.2 is available, this
|
||||||
|
* points at the associated crtc object
|
||||||
|
*/
|
||||||
|
RRCrtcPtr randr_crtc;
|
||||||
|
#else
|
||||||
|
void *randr_crtc;
|
||||||
|
#endif
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
5. Output functions.
|
||||||
|
|
||||||
|
6. Configuration
|
||||||
|
|
||||||
|
Because the configuration file syntax is fixed,
|
||||||
|
this was done by creating new "Driver" section options that hook specific
|
||||||
|
outputs to specific "Monitor" sections in the file. The option:
|
||||||
|
section of the form:
|
||||||
|
|
||||||
|
Option "monitor-VGA" "My VGA Monitor"
|
||||||
|
|
||||||
|
connects the VGA output of this driver to the "Monitor" section with
|
||||||
|
Identifier "My VGA Monitor". All of the usual monitor options can now be
|
||||||
|
placed in that "Monitor" section and will be applied to the VGA output
|
||||||
|
configuration.
|
|
@ -280,10 +280,8 @@ _X_HIDDEN void *dixLookupTab[] = {
|
||||||
SYMFUNC(AllocateColormapPrivateIndex)
|
SYMFUNC(AllocateColormapPrivateIndex)
|
||||||
SYMFUNC(AllocateDevicePrivateIndex)
|
SYMFUNC(AllocateDevicePrivateIndex)
|
||||||
SYMFUNC(AllocateDevicePrivate)
|
SYMFUNC(AllocateDevicePrivate)
|
||||||
#ifdef PIXPRIV
|
|
||||||
SYMFUNC(AllocatePixmapPrivateIndex)
|
SYMFUNC(AllocatePixmapPrivateIndex)
|
||||||
SYMFUNC(AllocatePixmapPrivate)
|
SYMFUNC(AllocatePixmapPrivate)
|
||||||
#endif
|
|
||||||
/* resource.c */
|
/* resource.c */
|
||||||
SYMFUNC(AddResource)
|
SYMFUNC(AddResource)
|
||||||
SYMFUNC(ChangeResourceValue)
|
SYMFUNC(ChangeResourceValue)
|
||||||
|
|
|
@ -545,6 +545,60 @@ xf86OutputDestroy (xf86OutputPtr output)
|
||||||
xfree (output);
|
xfree (output);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called during CreateScreenResources to hook up RandR
|
||||||
|
*/
|
||||||
|
static Bool
|
||||||
|
xf86CrtcCreateScreenResources (ScreenPtr screen)
|
||||||
|
{
|
||||||
|
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||||
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
|
|
||||||
|
screen->CreateScreenResources = config->CreateScreenResources;
|
||||||
|
|
||||||
|
if (!(*screen->CreateScreenResources)(screen))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!xf86RandR12CreateScreenResources (screen))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called at ScreenInit time to set up
|
||||||
|
*/
|
||||||
|
Bool
|
||||||
|
xf86CrtcScreenInit (ScreenPtr screen)
|
||||||
|
{
|
||||||
|
ScrnInfoPtr scrn = xf86Screens[screen->myNum];
|
||||||
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
|
int c;
|
||||||
|
|
||||||
|
/* Rotation */
|
||||||
|
xf86DrvMsg(scrn->scrnIndex, X_INFO, "RandR 1.2 enabled, ignore the following RandR disabled message.\n");
|
||||||
|
xf86DisableRandR(); /* Disable old RandR extension support */
|
||||||
|
xf86RandR12Init (screen);
|
||||||
|
|
||||||
|
/* support all rotations if every crtc has the shadow alloc funcs */
|
||||||
|
for (c = 0; c < config->num_crtc; c++)
|
||||||
|
{
|
||||||
|
xf86CrtcPtr crtc = config->crtc[c];
|
||||||
|
if (!crtc->funcs->shadow_allocate || !crtc->funcs->shadow_create)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (c == config->num_crtc)
|
||||||
|
xf86RandR12SetRotations (screen, RR_Rotate_0 | RR_Rotate_90 |
|
||||||
|
RR_Rotate_180 | RR_Rotate_270);
|
||||||
|
else
|
||||||
|
xf86RandR12SetRotations (screen, RR_Rotate_0);
|
||||||
|
|
||||||
|
/* Wrap CreateScreenResources so we can initialize the RandR code */
|
||||||
|
config->CreateScreenResources = screen->CreateScreenResources;
|
||||||
|
screen->CreateScreenResources = xf86CrtcCreateScreenResources;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
static DisplayModePtr
|
static DisplayModePtr
|
||||||
xf86DefaultMode (xf86OutputPtr output, int width, int height)
|
xf86DefaultMode (xf86OutputPtr output, int width, int height)
|
||||||
{
|
{
|
||||||
|
@ -879,13 +933,17 @@ xf86InitialOutputPositions (ScrnInfoPtr scrn, DisplayModePtr *modes)
|
||||||
{
|
{
|
||||||
xf86OutputPtr out_rel = config->output[or];
|
xf86OutputPtr out_rel = config->output[or];
|
||||||
XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
|
XF86ConfMonitorPtr rel_mon = out_rel->conf_monitor;
|
||||||
char *name;
|
|
||||||
|
|
||||||
if (rel_mon)
|
if (rel_mon)
|
||||||
name = rel_mon->mon_identifier;
|
{
|
||||||
else
|
if (xf86nameCompare (rel_mon->mon_identifier,
|
||||||
name = out_rel->name;
|
relative_name) == 0)
|
||||||
if (!strcmp (relative_name, name))
|
{
|
||||||
|
relative = config->output[or];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (strcmp (out_rel->name, relative_name) == 0)
|
||||||
{
|
{
|
||||||
relative = config->output[or];
|
relative = config->output[or];
|
||||||
break;
|
break;
|
||||||
|
@ -1542,6 +1600,189 @@ xf86InitialConfiguration (ScrnInfoPtr scrn, Bool canGrow)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using the desired mode information in each crtc, set
|
||||||
|
* modes (used in EnterVT functions, or at server startup)
|
||||||
|
*/
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SetDesiredModes (ScrnInfoPtr scrn)
|
||||||
|
{
|
||||||
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(scrn);
|
||||||
|
int c;
|
||||||
|
|
||||||
|
for (c = 0; c < config->num_crtc; c++)
|
||||||
|
{
|
||||||
|
xf86CrtcPtr crtc = config->crtc[c];
|
||||||
|
xf86OutputPtr output = NULL;
|
||||||
|
int o;
|
||||||
|
|
||||||
|
if (config->output[config->compat_output]->crtc == crtc)
|
||||||
|
output = config->output[config->compat_output];
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (o = 0; o < config->num_output; o++)
|
||||||
|
if (config->output[o]->crtc == crtc)
|
||||||
|
{
|
||||||
|
output = config->output[o];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
* Skip disabled crtcs
|
||||||
|
*/
|
||||||
|
if (!output)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
/* Mark that we'll need to re-set the mode for sure */
|
||||||
|
memset(&crtc->mode, 0, sizeof(crtc->mode));
|
||||||
|
if (!crtc->desiredMode.CrtcHDisplay)
|
||||||
|
{
|
||||||
|
DisplayModePtr mode = xf86OutputFindClosestMode (output, scrn->currentMode);
|
||||||
|
|
||||||
|
if (!mode)
|
||||||
|
return FALSE;
|
||||||
|
crtc->desiredMode = *mode;
|
||||||
|
crtc->desiredRotation = RR_Rotate_0;
|
||||||
|
crtc->desiredX = 0;
|
||||||
|
crtc->desiredY = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!xf86CrtcSetMode (crtc, &crtc->desiredMode, crtc->desiredRotation,
|
||||||
|
crtc->desiredX, crtc->desiredY))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xf86DisableUnusedFunctions(scrn);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* In the current world order, there are lists of modes per output, which may
|
||||||
|
* or may not include the mode that was asked to be set by XFree86's mode
|
||||||
|
* selection. Find the closest one, in the following preference order:
|
||||||
|
*
|
||||||
|
* - Equality
|
||||||
|
* - Closer in size to the requested mode, but no larger
|
||||||
|
* - Closer in refresh rate to the requested mode.
|
||||||
|
*/
|
||||||
|
|
||||||
|
DisplayModePtr
|
||||||
|
xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired)
|
||||||
|
{
|
||||||
|
DisplayModePtr best = NULL, scan = NULL;
|
||||||
|
|
||||||
|
for (scan = output->probed_modes; scan != NULL; scan = scan->next)
|
||||||
|
{
|
||||||
|
/* If there's an exact match, we're done. */
|
||||||
|
if (xf86ModesEqual(scan, desired)) {
|
||||||
|
best = desired;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Reject if it's larger than the desired mode. */
|
||||||
|
if (scan->HDisplay > desired->HDisplay ||
|
||||||
|
scan->VDisplay > desired->VDisplay)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* If we haven't picked a best mode yet, use the first
|
||||||
|
* one in the size range
|
||||||
|
*/
|
||||||
|
if (best == NULL)
|
||||||
|
{
|
||||||
|
best = scan;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find if it's closer to the right size than the current best
|
||||||
|
* option.
|
||||||
|
*/
|
||||||
|
if ((scan->HDisplay > best->HDisplay &&
|
||||||
|
scan->VDisplay >= best->VDisplay) ||
|
||||||
|
(scan->HDisplay >= best->HDisplay &&
|
||||||
|
scan->VDisplay > best->VDisplay))
|
||||||
|
{
|
||||||
|
best = scan;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Find if it's still closer to the right refresh than the current
|
||||||
|
* best resolution.
|
||||||
|
*/
|
||||||
|
if (scan->HDisplay == best->HDisplay &&
|
||||||
|
scan->VDisplay == best->VDisplay &&
|
||||||
|
(fabs(scan->VRefresh - desired->VRefresh) <
|
||||||
|
fabs(best->VRefresh - desired->VRefresh))) {
|
||||||
|
best = scan;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return best;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When setting a mode through XFree86-VidModeExtension or XFree86-DGA,
|
||||||
|
* take the specified mode and apply it to the crtc connected to the compat
|
||||||
|
* output. Then, find similar modes for the other outputs, as with the
|
||||||
|
* InitialConfiguration code above. The goal is to clone the desired
|
||||||
|
* mode across all outputs that are currently active.
|
||||||
|
*/
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation)
|
||||||
|
{
|
||||||
|
xf86CrtcConfigPtr config = XF86_CRTC_CONFIG_PTR(pScrn);
|
||||||
|
Bool ok = TRUE;
|
||||||
|
xf86OutputPtr compat_output = config->output[config->compat_output];
|
||||||
|
DisplayModePtr compat_mode;
|
||||||
|
int c;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Let the compat output drive the final mode selection
|
||||||
|
*/
|
||||||
|
compat_mode = xf86OutputFindClosestMode (compat_output, desired);
|
||||||
|
if (compat_mode)
|
||||||
|
desired = compat_mode;
|
||||||
|
|
||||||
|
for (c = 0; c < config->num_crtc; c++)
|
||||||
|
{
|
||||||
|
xf86CrtcPtr crtc = config->crtc[c];
|
||||||
|
DisplayModePtr crtc_mode = NULL;
|
||||||
|
int o;
|
||||||
|
|
||||||
|
if (!crtc->enabled)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for (o = 0; o < config->num_output; o++)
|
||||||
|
{
|
||||||
|
xf86OutputPtr output = config->output[o];
|
||||||
|
DisplayModePtr output_mode;
|
||||||
|
|
||||||
|
/* skip outputs not on this crtc */
|
||||||
|
if (output->crtc != crtc)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (crtc_mode)
|
||||||
|
{
|
||||||
|
output_mode = xf86OutputFindClosestMode (output, crtc_mode);
|
||||||
|
if (output_mode != crtc_mode)
|
||||||
|
output->crtc = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
crtc_mode = xf86OutputFindClosestMode (output, desired);
|
||||||
|
}
|
||||||
|
if (!xf86CrtcSetMode (crtc, crtc_mode, rotation, 0, 0))
|
||||||
|
ok = FALSE;
|
||||||
|
else
|
||||||
|
crtc->desiredMode = *crtc_mode;
|
||||||
|
}
|
||||||
|
xf86DisableUnusedFunctions(pScrn);
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the DPMS power mode of all outputs and CRTCs.
|
* Set the DPMS power mode of all outputs and CRTCs.
|
||||||
*
|
*
|
||||||
|
|
|
@ -494,6 +494,7 @@ typedef struct _xf86CrtcConfig {
|
||||||
|
|
||||||
const xf86CrtcConfigFuncsRec *funcs;
|
const xf86CrtcConfigFuncsRec *funcs;
|
||||||
|
|
||||||
|
CreateScreenResourcesProcPtr CreateScreenResources;
|
||||||
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
} xf86CrtcConfigRec, *xf86CrtcConfigPtr;
|
||||||
|
|
||||||
extern int xf86CrtcConfigPrivateIndex;
|
extern int xf86CrtcConfigPrivateIndex;
|
||||||
|
@ -524,25 +525,6 @@ void
|
||||||
xf86CrtcDestroy (xf86CrtcPtr crtc);
|
xf86CrtcDestroy (xf86CrtcPtr crtc);
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Allocate a crtc for the specified output
|
|
||||||
*
|
|
||||||
* Find a currently unused CRTC which is suitable for
|
|
||||||
* the specified output
|
|
||||||
*/
|
|
||||||
|
|
||||||
xf86CrtcPtr
|
|
||||||
xf86AllocCrtc (xf86OutputPtr output);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Free a crtc
|
|
||||||
*
|
|
||||||
* Mark the crtc as unused by any outputs
|
|
||||||
*/
|
|
||||||
|
|
||||||
void
|
|
||||||
xf86FreeCrtc (xf86CrtcPtr crtc);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the given video mode on the given crtc
|
* Sets the given video mode on the given crtc
|
||||||
*/
|
*/
|
||||||
|
@ -582,6 +564,9 @@ xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY);
|
||||||
void
|
void
|
||||||
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
xf86SetScrnInfoModes (ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86CrtcScreenInit (ScreenPtr pScreen);
|
||||||
|
|
||||||
Bool
|
Bool
|
||||||
xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
|
xf86InitialConfiguration (ScrnInfoPtr pScrn, Bool canGrow);
|
||||||
|
|
||||||
|
@ -594,6 +579,12 @@ xf86SaveScreen(ScreenPtr pScreen, int mode);
|
||||||
void
|
void
|
||||||
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
|
xf86DisableUnusedFunctions(ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
|
DisplayModePtr
|
||||||
|
xf86OutputFindClosestMode (xf86OutputPtr output, DisplayModePtr desired);
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SetSingleMode (ScrnInfoPtr pScrn, DisplayModePtr desired, Rotation rotation);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the EDID information for the specified output
|
* Set the EDID information for the specified output
|
||||||
*/
|
*/
|
||||||
|
@ -638,4 +629,12 @@ xf86CrtcSetScreenSubpixelOrder (ScreenPtr pScreen);
|
||||||
char *
|
char *
|
||||||
xf86ConnectorGetName(xf86ConnectorType connector);
|
xf86ConnectorGetName(xf86ConnectorType connector);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Using the desired mode information in each crtc, set
|
||||||
|
* modes (used in EnterVT functions, or at server startup)
|
||||||
|
*/
|
||||||
|
|
||||||
|
Bool
|
||||||
|
xf86SetDesiredModes (ScrnInfoPtr pScrn);
|
||||||
|
|
||||||
#endif /* _XF86CRTC_H_ */
|
#endif /* _XF86CRTC_H_ */
|
||||||
|
|
|
@ -422,8 +422,28 @@ xf86RandR12CreateScreenResources (ScreenPtr pScreen)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mmWidth = pScreen->mmWidth;
|
xf86OutputPtr output = config->output[config->compat_output];
|
||||||
mmHeight = pScreen->mmHeight;
|
xf86CrtcPtr crtc = output->crtc;
|
||||||
|
|
||||||
|
if (crtc && crtc->mode.HDisplay &&
|
||||||
|
output->mm_width && output->mm_height)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* If the output has a mode and a declared size, use that
|
||||||
|
* to scale the screen size
|
||||||
|
*/
|
||||||
|
DisplayModePtr mode = &crtc->mode;
|
||||||
|
mmWidth = output->mm_width * width / mode->HDisplay;
|
||||||
|
mmHeight = output->mm_height * height / mode->VDisplay;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Otherwise, just set the screen to 96dpi
|
||||||
|
*/
|
||||||
|
mmWidth = width * 25.4 / 96;
|
||||||
|
mmHeight = height * 25.4 / 96;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
xf86DrvMsg(pScrn->scrnIndex, X_INFO,
|
||||||
"Setting screen physical size to %d x %d\n",
|
"Setting screen physical size to %d x %d\n",
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
|
#define xf86CrtcDestroy XF86NAME(xf86CrtcDestroy)
|
||||||
#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
|
#define xf86CrtcInUse XF86NAME(xf86CrtcInUse)
|
||||||
#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
|
#define xf86CrtcRotate XF86NAME(xf86CrtcRotate)
|
||||||
|
#define xf86CrtcScreenInit XF86NAME(xf86CrtcScreenInit)
|
||||||
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
|
#define xf86CrtcSetMode XF86NAME(xf86CrtcSetMode)
|
||||||
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
|
#define xf86CrtcSetSizeRange XF86NAME(xf86CrtcSetSizeRange)
|
||||||
#define xf86CVTMode XF86NAME(xf86CVTMode)
|
#define xf86CVTMode XF86NAME(xf86CVTMode)
|
||||||
|
@ -76,5 +77,8 @@
|
||||||
#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder)
|
#define xf86CrtcSetScreenSubpixelOrder XF86NAME(xf86CrtcSetScreenSubpixelOrder)
|
||||||
#define xf86ModeWidth XF86NAME(xf86ModeWidth)
|
#define xf86ModeWidth XF86NAME(xf86ModeWidth)
|
||||||
#define xf86ModeHeight XF86NAME(xf86ModeHeight)
|
#define xf86ModeHeight XF86NAME(xf86ModeHeight)
|
||||||
|
#define xf86OutputFindClosestMode XF86NAME(xf86OutputFindClosestMode)
|
||||||
|
#define xf86SetSingleMode XF86NAME(xf86SetSingleMode)
|
||||||
|
#define xf86SetDesiredModes XF86NAME(xf86SetDesiredModes)
|
||||||
|
|
||||||
#endif /* _XF86RENAME_H_ */
|
#endif /* _XF86RENAME_H_ */
|
||||||
|
|
|
@ -120,12 +120,8 @@ xf4bppCreatePixmap( pScreen, width, height, depth )
|
||||||
pPixmap->devKind = size;
|
pPixmap->devKind = size;
|
||||||
pPixmap->refcnt = 1 ;
|
pPixmap->refcnt = 1 ;
|
||||||
size = height * pPixmap->devKind ;
|
size = height * pPixmap->devKind ;
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
|
pPixmap->devPrivate.ptr = (pointer) (((CARD8*)pPixmap)
|
||||||
+ pScreen->totalPixmapSize);
|
+ pScreen->totalPixmapSize);
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer) (pPixmap + 1);
|
|
||||||
#endif
|
|
||||||
bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
|
bzero( (char *) pPixmap->devPrivate.ptr, size ) ;
|
||||||
return pPixmap ;
|
return pPixmap ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,7 @@ is" without express or implied warranty.
|
||||||
#include "Screen.h"
|
#include "Screen.h"
|
||||||
#include "XNPixmap.h"
|
#include "XNPixmap.h"
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
int xnestPixmapPrivateIndex;
|
int xnestPixmapPrivateIndex;
|
||||||
#endif
|
|
||||||
|
|
||||||
PixmapPtr
|
PixmapPtr
|
||||||
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth)
|
xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth)
|
||||||
|
@ -57,12 +55,8 @@ xnestCreatePixmap(ScreenPtr pScreen, int width, int height, int depth)
|
||||||
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER;
|
||||||
pPixmap->refcnt = 1;
|
pPixmap->refcnt = 1;
|
||||||
pPixmap->devKind = PixmapBytePad(width, depth);
|
pPixmap->devKind = PixmapBytePad(width, depth);
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr =
|
pPixmap->devPrivates[xnestPixmapPrivateIndex].ptr =
|
||||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize);
|
(pointer)((char *)pPixmap + pScreen->totalPixmapSize);
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
|
|
||||||
#endif
|
|
||||||
if (width && height)
|
if (width && height)
|
||||||
xnestPixmapPriv(pPixmap)->pixmap =
|
xnestPixmapPriv(pPixmap)->pixmap =
|
||||||
XCreatePixmap(xnestDisplay,
|
XCreatePixmap(xnestDisplay,
|
||||||
|
|
|
@ -49,9 +49,7 @@ Window xnestScreenSaverWindows[MAXSCREENS];
|
||||||
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
extern void GlxWrapInitVisuals(miInitVisualsProcPtr *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
int xnestScreenGeneration = -1;
|
int xnestScreenGeneration = -1;
|
||||||
#endif
|
|
||||||
|
|
||||||
ScreenPtr
|
ScreenPtr
|
||||||
xnestScreen(Window window)
|
xnestScreen(Window window)
|
||||||
|
@ -154,7 +152,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
|
||||||
sizeof(xnestPrivGC))))
|
sizeof(xnestPrivGC))))
|
||||||
return False;
|
return False;
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
if (xnestScreenGeneration != serverGeneration) {
|
if (xnestScreenGeneration != serverGeneration) {
|
||||||
if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
|
if ((xnestPixmapPrivateIndex = AllocatePixmapPrivateIndex()) < 0)
|
||||||
return False;
|
return False;
|
||||||
|
@ -164,7 +161,6 @@ xnestOpenScreen(int index, ScreenPtr pScreen, int argc, char *argv[])
|
||||||
if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
|
if (!AllocatePixmapPrivate(pScreen,xnestPixmapPrivateIndex,
|
||||||
sizeof (xnestPrivPixmap)))
|
sizeof (xnestPrivPixmap)))
|
||||||
return False;
|
return False;
|
||||||
#endif
|
|
||||||
visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
|
visuals = (VisualPtr)xalloc(xnestNumVisuals * sizeof(VisualRec));
|
||||||
numVisuals = 0;
|
numVisuals = 0;
|
||||||
|
|
||||||
|
|
|
@ -15,21 +15,14 @@ is" without express or implied warranty.
|
||||||
#ifndef XNESTPIXMAP_H
|
#ifndef XNESTPIXMAP_H
|
||||||
#define XNESTPIXMAP_H
|
#define XNESTPIXMAP_H
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
extern int xnestPixmapPrivateIndex;
|
extern int xnestPixmapPrivateIndex;
|
||||||
#endif
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Pixmap pixmap;
|
Pixmap pixmap;
|
||||||
} xnestPrivPixmap;
|
} xnestPrivPixmap;
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
#define xnestPixmapPriv(pPixmap) \
|
#define xnestPixmapPriv(pPixmap) \
|
||||||
((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr))
|
((xnestPrivPixmap *)((pPixmap)->devPrivates[xnestPixmapPrivateIndex].ptr))
|
||||||
#else
|
|
||||||
#define xnestPixmapPriv(pPixmap) \
|
|
||||||
((xnestPrivPixmap *)((pPixmap)->devPrivate.ptr))
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
|
#define xnestPixmap(pPixmap) (xnestPixmapPriv(pPixmap)->pixmap)
|
||||||
|
|
||||||
|
|
|
@ -19,10 +19,10 @@ XPFONTS = \
|
||||||
LubalinGraph-BookOblique.pmf \
|
LubalinGraph-BookOblique.pmf \
|
||||||
LubalinGraph-Demi.pmf \
|
LubalinGraph-Demi.pmf \
|
||||||
LubalinGraph-DemiOblique.pmf \
|
LubalinGraph-DemiOblique.pmf \
|
||||||
NewCenturySchlbk-Bold.pmf \
|
NewCentSchlbk-Bold.pmf \
|
||||||
NewCenturySchlbk-BoldItalic.pmf \
|
NewCentSchlbk-BoldItal.pmf \
|
||||||
NewCenturySchlbk-Italic.pmf \
|
NewCentSchlbk-Ital.pmf \
|
||||||
NewCenturySchlbk-Roman.pmf \
|
NewCentSchlbk-Roman.pmf \
|
||||||
Souvenir-Demi.pmf \
|
Souvenir-Demi.pmf \
|
||||||
Souvenir-DemiItalic.pmf \
|
Souvenir-DemiItalic.pmf \
|
||||||
Souvenir-Light.pmf \
|
Souvenir-Light.pmf \
|
||||||
|
|
|
@ -19,10 +19,10 @@ XPFONTS = \
|
||||||
LubalinGraph-BookOblique.pmf \
|
LubalinGraph-BookOblique.pmf \
|
||||||
LubalinGraph-Demi.pmf \
|
LubalinGraph-Demi.pmf \
|
||||||
LubalinGraph-DemiOblique.pmf \
|
LubalinGraph-DemiOblique.pmf \
|
||||||
NewCenturySchlbk-Bold.pmf \
|
NewCentSchlbk-Bold.pmf \
|
||||||
NewCenturySchlbk-BoldItalic.pmf \
|
NewCentSchlbk-BoldItal.pmf \
|
||||||
NewCenturySchlbk-Italic.pmf \
|
NewCentSchlbk-Ital.pmf \
|
||||||
NewCenturySchlbk-Roman.pmf \
|
NewCentSchlbk-Roman.pmf \
|
||||||
Souvenir-Demi.pmf \
|
Souvenir-Demi.pmf \
|
||||||
Souvenir-DemiItalic.pmf \
|
Souvenir-DemiItalic.pmf \
|
||||||
Souvenir-Light.pmf \
|
Souvenir-Light.pmf \
|
||||||
|
|
|
@ -17,10 +17,10 @@ dist_xpc_DATA = \
|
||||||
LubalinGraph-Book.pmf \
|
LubalinGraph-Book.pmf \
|
||||||
LubalinGraph-DemiOblique.pmf \
|
LubalinGraph-DemiOblique.pmf \
|
||||||
LubalinGraph-Demi.pmf \
|
LubalinGraph-Demi.pmf \
|
||||||
NewCenturySchlbk-Bold.pmf \
|
NewCentSchlbk-Bold.pmf \
|
||||||
NewCenturySchlbk-BoldItalic.pmf \
|
NewCentSchlbk-BoldItal.pmf \
|
||||||
NewCenturySchlbk-Italic.pmf \
|
NewCentSchlbk-Ital.pmf \
|
||||||
NewCenturySchlbk-Roman.pmf \
|
NewCentSchlbk-Roman.pmf \
|
||||||
Souvenir-DemiItalic.pmf \
|
Souvenir-DemiItalic.pmf \
|
||||||
Souvenir-Demi.pmf \
|
Souvenir-Demi.pmf \
|
||||||
Souvenir-LightItalic.pmf \
|
Souvenir-LightItalic.pmf \
|
||||||
|
|
|
@ -86,9 +86,7 @@ typedef struct _Pixmap {
|
||||||
int refcnt;
|
int refcnt;
|
||||||
int devKind;
|
int devKind;
|
||||||
DevUnion devPrivate;
|
DevUnion devPrivate;
|
||||||
#ifdef PIXPRIV
|
|
||||||
DevUnion *devPrivates; /* real devPrivates like gcs & windows */
|
DevUnion *devPrivates; /* real devPrivates like gcs & windows */
|
||||||
#endif
|
|
||||||
#ifdef COMPOSITE
|
#ifdef COMPOSITE
|
||||||
short screen_x;
|
short screen_x;
|
||||||
short screen_y;
|
short screen_y;
|
||||||
|
|
|
@ -86,8 +86,6 @@ extern int AddScreen(
|
||||||
int /*argc*/,
|
int /*argc*/,
|
||||||
char** /*argv*/);
|
char** /*argv*/);
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
|
|
||||||
extern void ResetPixmapPrivates(void);
|
extern void ResetPixmapPrivates(void);
|
||||||
|
|
||||||
extern int AllocatePixmapPrivateIndex(void);
|
extern int AllocatePixmapPrivateIndex(void);
|
||||||
|
@ -97,8 +95,6 @@ extern Bool AllocatePixmapPrivate(
|
||||||
int /* index */,
|
int /* index */,
|
||||||
unsigned /* amount */);
|
unsigned /* amount */);
|
||||||
|
|
||||||
#endif /* PIXPRIV */
|
|
||||||
|
|
||||||
extern void ResetColormapPrivates(void);
|
extern void ResetColormapPrivates(void);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -558,11 +558,9 @@ typedef struct _Screen {
|
||||||
|
|
||||||
PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
|
PixmapPtr pScratchPixmap; /* scratch pixmap "pool" */
|
||||||
|
|
||||||
#ifdef PIXPRIV
|
|
||||||
int PixmapPrivateLen;
|
int PixmapPrivateLen;
|
||||||
unsigned int *PixmapPrivateSizes;
|
unsigned int *PixmapPrivateSizes;
|
||||||
unsigned int totalPixmapSize;
|
unsigned int totalPixmapSize;
|
||||||
#endif
|
|
||||||
|
|
||||||
MarkWindowProcPtr MarkWindow;
|
MarkWindowProcPtr MarkWindow;
|
||||||
MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
|
MarkOverlappedWindowsProcPtr MarkOverlappedWindows;
|
||||||
|
|
|
@ -101,12 +101,8 @@ mfbCreatePixmap (pScreen, width, height, depth)
|
||||||
pPixmap->drawable.height = height;
|
pPixmap->drawable.height = height;
|
||||||
pPixmap->devKind = paddedWidth;
|
pPixmap->devKind = paddedWidth;
|
||||||
pPixmap->refcnt = 1;
|
pPixmap->refcnt = 1;
|
||||||
#ifdef PIXPRIV
|
|
||||||
pPixmap->devPrivate.ptr = datasize ?
|
pPixmap->devPrivate.ptr = datasize ?
|
||||||
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
(pointer)((char *)pPixmap + pScreen->totalPixmapSize) : NULL;
|
||||||
#else
|
|
||||||
pPixmap->devPrivate.ptr = (pointer)(pPixmap + 1);
|
|
||||||
#endif
|
|
||||||
return pPixmap;
|
return pPixmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,7 @@ RRCrtcInit (void)
|
||||||
int
|
int
|
||||||
ProcRRGetCrtcInfo (ClientPtr client)
|
ProcRRGetCrtcInfo (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xRRGetCrtcInfoReq);;
|
REQUEST(xRRGetCrtcInfoReq);
|
||||||
xRRGetCrtcInfoReply rep;
|
xRRGetCrtcInfoReply rep;
|
||||||
RRCrtcPtr crtc;
|
RRCrtcPtr crtc;
|
||||||
CARD8 *extra;
|
CARD8 *extra;
|
||||||
|
|
|
@ -366,7 +366,7 @@ RROutputInit (void)
|
||||||
int
|
int
|
||||||
ProcRRGetOutputInfo (ClientPtr client)
|
ProcRRGetOutputInfo (ClientPtr client)
|
||||||
{
|
{
|
||||||
REQUEST(xRRGetOutputInfoReq);;
|
REQUEST(xRRGetOutputInfoReq);
|
||||||
xRRGetOutputInfoReply rep;
|
xRRGetOutputInfoReply rep;
|
||||||
RROutputPtr output;
|
RROutputPtr output;
|
||||||
CARD8 *extra;
|
CARD8 *extra;
|
||||||
|
|
|
@ -103,7 +103,7 @@ void
|
||||||
RRPointerMoved (ScreenPtr pScreen, int x, int y)
|
RRPointerMoved (ScreenPtr pScreen, int x, int y)
|
||||||
{
|
{
|
||||||
rrScrPriv (pScreen);
|
rrScrPriv (pScreen);
|
||||||
RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;;
|
RRCrtcPtr pointerCrtc = pScrPriv->pointerCrtc;
|
||||||
int c;
|
int c;
|
||||||
|
|
||||||
/* Check last known CRTC */
|
/* Check last known CRTC */
|
||||||
|
|
Loading…
Reference in New Issue