diff options
121 files changed, 2233 insertions, 1734 deletions
diff --git a/Xext/sync.c b/Xext/sync.c index d495116dc..36dd27888 100644 --- a/Xext/sync.c +++ b/Xext/sync.c @@ -90,6 +90,16 @@ static RESTYPE RTAlarmClient; static RESTYPE RTFence; static int SyncNumSystemCounters = 0; static SyncCounter **SysCounterList = NULL; +static int SyncNumInvalidCounterWarnings = 0; +#define MAX_INVALID_COUNTER_WARNINGS 5 + +static const char *WARN_INVALID_COUNTER_COMPARE = +"Warning: Non-counter XSync object using Counter-only\n" +" comparison. Result will never be true.\n"; + +static const char *WARN_INVALID_COUNTER_ALARM = +"Warning: Non-counter XSync object used in alarm. This is\n" +" the result of a programming error in the X server.\n"; #define IsSystemCounter(pCounter) \ (pCounter && (pCounter->sync.client == NULL)) @@ -104,6 +114,22 @@ static void SyncInitServerTime(void); static void SyncInitIdleTime(void); +static Bool +SyncCheckWarnIsCounter(const SyncObject* pSync, const char *warning) +{ + if (pSync && (SYNC_COUNTER != pSync->type)) + { + if (SyncNumInvalidCounterWarnings++ < MAX_INVALID_COUNTER_WARNINGS) + { + ErrorF("%s", warning); + ErrorF(" Counter type: %d\n", pSync->type); + } + + return FALSE; + } + + return TRUE; +} /* Each counter maintains a simple linked list of triggers that are * interested in the counter. The two functions below are used to @@ -212,7 +238,11 @@ SyncCheckTriggerPositiveComparison(SyncTrigger *pTrigger, CARD64 oldval) { SyncCounter *pCounter; - assert(!pTrigger->pSync || (SYNC_COUNTER == pTrigger->pSync->type)); + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + pCounter = (SyncCounter *)pTrigger->pSync; return (pCounter == NULL || @@ -224,7 +254,11 @@ SyncCheckTriggerNegativeComparison(SyncTrigger *pTrigger, CARD64 oldval) { SyncCounter *pCounter; - assert(!pTrigger->pSync || (SYNC_COUNTER == pTrigger->pSync->type)); + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + pCounter = (SyncCounter *)pTrigger->pSync; return (pCounter == NULL || @@ -236,7 +270,11 @@ SyncCheckTriggerPositiveTransition(SyncTrigger *pTrigger, CARD64 oldval) { SyncCounter *pCounter; - assert(!pTrigger->pSync || (SYNC_COUNTER == pTrigger->pSync->type)); + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + pCounter = (SyncCounter *)pTrigger->pSync; return (pCounter == NULL || @@ -249,7 +287,11 @@ SyncCheckTriggerNegativeTransition(SyncTrigger *pTrigger, CARD64 oldval) { SyncCounter *pCounter; - assert(!pTrigger->pSync || (SYNC_COUNTER == pTrigger->pSync->type)); + /* Non-counter sync objects should never get here because they + * never trigger this comparison. */ + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_COMPARE)) + return FALSE; + pCounter = (SyncCounter *)pTrigger->pSync; return (pCounter == NULL || @@ -326,14 +368,6 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XID syncObject, } else { - if (pTrigger->test_type != XSyncPositiveTransition && - pTrigger->test_type != XSyncNegativeTransition && - pTrigger->test_type != XSyncPositiveComparison && - pTrigger->test_type != XSyncNegativeComparison) - { - client->errorValue = pTrigger->test_type; - return BadValue; - } /* select appropriate CheckTrigger function */ switch (pTrigger->test_type) @@ -350,6 +384,9 @@ SyncInitTrigger(ClientPtr client, SyncTrigger *pTrigger, XID syncObject, case XSyncNegativeComparison: pTrigger->CheckTrigger = SyncCheckTriggerNegativeComparison; break; + default: + client->errorValue = pTrigger->test_type; + return BadValue; } } } @@ -402,7 +439,8 @@ SyncSendAlarmNotifyEvents(SyncAlarm *pAlarm) SyncTrigger *pTrigger = &pAlarm->trigger; SyncCounter *pCounter; - assert(!pTrigger->pSync || (SYNC_COUNTER == pTrigger->pSync->type)); + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM)) + return; pCounter = (SyncCounter *)pTrigger->pSync; @@ -507,7 +545,9 @@ SyncAlarmTriggerFired(SyncTrigger *pTrigger) SyncCounter *pCounter; CARD64 new_test_value; - assert(!pTrigger->pSync || (SYNC_COUNTER == pTrigger->pSync->type)); + if (!SyncCheckWarnIsCounter(pTrigger->pSync, WARN_INVALID_COUNTER_ALARM)) + return; + pCounter = (SyncCounter *)pTrigger->pSync; /* no need to check alarm unless it's active */ @@ -534,7 +574,10 @@ SyncAlarmTriggerFired(SyncTrigger *pTrigger) SyncTrigger *paTrigger = &pAlarm->trigger; SyncCounter *paCounter; - assert(!paTrigger->pSync || (SYNC_COUNTER == paTrigger->pSync->type)); + if (!SyncCheckWarnIsCounter(paTrigger->pSync, + WARN_INVALID_COUNTER_ALARM)) + return; + paCounter = (SyncCounter *)pTrigger->pSync; /* "The alarm is updated by repeatedly adding delta to the @@ -758,17 +801,15 @@ SyncEventSelectForAlarm(SyncAlarm *pAlarm, ClientPtr client, Bool wantevents) */ pClients->delete_id = FakeClientID(client->index); - if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) - { - free(pClients); - return BadAlloc; - } /* link it into list after we know all the allocations succeed */ - pClients->next = pAlarm->pEventClients; pAlarm->pEventClients = pClients; pClients->client = client; + + if (!AddResource(pClients->delete_id, RTAlarmClient, pAlarm)) + return BadAlloc; + return Success; } @@ -877,17 +918,14 @@ static SyncObject * SyncCreate(ClientPtr client, XID id, unsigned char type) { SyncObject *pSync; - RESTYPE resType; switch (type) { case SYNC_COUNTER: - resType = RTCounter; pSync = malloc(sizeof(SyncCounter)); break; case SYNC_FENCE: - resType = RTFence; - pSync = dixAllocateObjectWithPrivates(SyncFence, - PRIVATE_SYNC_FENCE); + pSync = (SyncObject*)dixAllocateObjectWithPrivates(SyncFence, + PRIVATE_SYNC_FENCE); break; default: return NULL; @@ -896,19 +934,6 @@ SyncCreate(ClientPtr client, XID id, unsigned char type) if (!pSync) return NULL; - if (!AddResource(id, resType, (pointer) pSync)) - { - switch (type) { - case SYNC_FENCE: - dixFreeObjectWithPrivates((SyncFence *)pSync, PRIVATE_SYNC_FENCE); - break; - default: - free(pSync); - } - - return NULL; - } - pSync->client = client; pSync->id = id; pSync->pTriglist = NULL; @@ -931,6 +956,10 @@ SyncCreateCounter(ClientPtr client, XSyncCounter id, CARD64 initialvalue) pCounter->value = initialvalue; pCounter->pSysCounterInfo = NULL; + + if (!AddResource(id, RTCounter, (pointer) pCounter)) + return NULL; + return pCounter; } @@ -1541,15 +1570,12 @@ SyncAwaitPrologue(ClientPtr client, int items) /* first item is the header, remainder are real wait conditions */ pAwaitUnion->header.delete_id = FakeClientID(client->index); - if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) - { - free(pAwaitUnion); - return NULL; - } - pAwaitUnion->header.client = client; pAwaitUnion->header.num_waitconditions = 0; + if (!AddResource(pAwaitUnion->header.delete_id, RTAwait, pAwaitUnion)) + return NULL; + return pAwaitUnion; } @@ -1776,10 +1802,7 @@ ProcSyncCreateAlarm(ClientPtr client) } if (!AddResource(stuff->id, RTAlarm, pAlarm)) - { - free(pAlarm); return BadAlloc; - } /* see if alarm already triggered. NULL counter will not trigger * in CreateAlarm and sets alarm state to Inactive. @@ -1793,7 +1816,13 @@ ProcSyncCreateAlarm(ClientPtr client) { SyncCounter *pCounter; - assert(SYNC_COUNTER == pTrigger->pSync->type); + if (!SyncCheckWarnIsCounter(pTrigger->pSync, + WARN_INVALID_COUNTER_ALARM)) + { + FreeResource(stuff->id, RT_NONE); + return BadAlloc; + } + pCounter = (SyncCounter *)pTrigger->pSync; if ((*pTrigger->CheckTrigger)(pTrigger, pCounter->value)) @@ -1832,11 +1861,9 @@ ProcSyncChangeAlarm(ClientPtr client) (CARD32 *)&stuff[1])) != Success) return status; - if (pAlarm->trigger.pSync) - { - assert(SYNC_COUNTER == pAlarm->trigger.pSync->type); + if (SyncCheckWarnIsCounter(pAlarm->trigger.pSync, + WARN_INVALID_COUNTER_ALARM)) pCounter = (SyncCounter *)pAlarm->trigger.pSync; - } /* see if alarm already triggered. NULL counter WILL trigger * in ChangeAlarm. @@ -1950,6 +1977,9 @@ ProcSyncCreateFence(ClientPtr client) miSyncInitFence(pDraw->pScreen, pFence, stuff->initially_triggered); + if (!AddResource(stuff->fid, RTFence, (pointer) pFence)) + return BadAlloc; + return client->noClientException; } @@ -2092,7 +2122,7 @@ ProcSyncAwaitFence(ClientPtr client) } if (items == 0) { - client->errorValue = items; /* XXX protocol change */ + client->errorValue = items; return BadValue; } @@ -2106,14 +2136,14 @@ ProcSyncAwaitFence(ClientPtr client) pAwait = &(pAwaitUnion+1)->await; /* skip over header */ for (i = 0; i < items; i++, pProtocolFences++, pAwait++) { - if (*pProtocolFences == None) /* XXX protocol change */ + if (*pProtocolFences == None) { /* this should take care of removing any triggers created by * this request that have already been registered on sync objects */ FreeResource(pAwaitUnion->header.delete_id, RT_NONE); client->errorValue = *pProtocolFences; - return SyncErrorBase + XSyncBadCounter; + return SyncErrorBase + XSyncBadFence; } pAwait->trigger.pSync = NULL; diff --git a/Xext/xselinux_ext.c b/Xext/xselinux_ext.c index 93c1b595f..374571c4b 100644 --- a/Xext/xselinux_ext.c +++ b/Xext/xselinux_ext.c @@ -231,13 +231,11 @@ ProcSELinuxGetDrawableContext(ClientPtr client) REQUEST(SELinuxGetContextReq); REQUEST_SIZE_MATCH(SELinuxGetContextReq); - rc = dixLookupDrawable(&pDraw, stuff->id, client, - M_WINDOW | M_DRAWABLE_PIXMAP, - DixGetAttrAccess); + rc = dixLookupDrawable(&pDraw, stuff->id, client, 0, DixGetAttrAccess); if (rc != Success) return rc; - if (pDraw->type == M_DRAWABLE_PIXMAP) + if (pDraw->type == DRAWABLE_PIXMAP) privatePtr = &((PixmapPtr)pDraw)->devPrivates; else privatePtr = &((WindowPtr)pDraw)->devPrivates; diff --git a/Xi/exevents.c b/Xi/exevents.c index 8615fd456..327873e29 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1261,7 +1261,8 @@ DeviceFocusEvent(DeviceIntPtr dev, int type, int mode, int detail, xi2event->group.effective_group = dev->key->xkbInfo->state.group; } - FixUpEventFromWindow(dev, (xEvent*)xi2event, pWin, None, FALSE); + FixUpEventFromWindow(dev->spriteInfo->sprite, (xEvent*)xi2event, pWin, + None, FALSE); DeliverEventsToWindow(dev, pWin, (xEvent*)xi2event, 1, GetEventFilter(dev, (xEvent*)xi2event), NullGrab); diff --git a/Xi/extinit.c b/Xi/extinit.c index 546ccb42e..82df7eb02 100644 --- a/Xi/extinit.c +++ b/Xi/extinit.c @@ -757,6 +757,7 @@ static void SDeviceEvent(xXIDeviceEvent *from, xXIDeviceEvent *to) swapl(&to->mods.latched_mods, n); swapl(&to->mods.locked_mods, n); swapl(&to->mods.effective_mods, n); + swapl(&to->flags, n); ptr = (char*)(&to[1]); ptr += from->buttons_len * 4; diff --git a/Xi/xiwarppointer.c b/Xi/xiwarppointer.c index 7276e6faf..c01b115f3 100644 --- a/Xi/xiwarppointer.c +++ b/Xi/xiwarppointer.c @@ -192,6 +192,8 @@ ProcXIWarpPointer(ClientPtr client) /* if we don't update the device, we get a jump next time it moves */ pDev->last.valuators[0] = x; pDev->last.valuators[1] = y; + pDev->last.remainder[0] = 0; + pDev->last.remainder[1] = 0; miPointerUpdateSprite(pDev); /* FIXME: XWarpPointer is supposed to generate an event. It doesn't do it diff --git a/composite/compalloc.c b/composite/compalloc.c index 86a6f8ea9..e4064f6b1 100644 --- a/composite/compalloc.c +++ b/composite/compalloc.c @@ -51,7 +51,7 @@ static void compScreenUpdate (ScreenPtr pScreen) { compCheckTree (pScreen); - compWindowUpdate (pScreen->root); + compPaintChildrenToWindow (pScreen->root); } static void @@ -84,6 +84,15 @@ compReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure) pScreen->BlockHandler = compBlockHandler; } cw->damaged = TRUE; + + /* Mark the ancestors */ + pWin = pWin->parent; + while (pWin) { + if (pWin->damagedDescendants) + break; + pWin->damagedDescendants = TRUE; + pWin = pWin->parent; + } } static void diff --git a/composite/compinit.c b/composite/compinit.c index 276ed75f8..90ee66c88 100644 --- a/composite/compinit.c +++ b/composite/compinit.c @@ -77,6 +77,9 @@ compCloseScreen (int index, ScreenPtr pScreen) pScreen->CopyWindow = cs->CopyWindow; pScreen->PositionWindow = cs->PositionWindow; + pScreen->GetImage = cs->GetImage; + pScreen->SourceValidate = cs->SourceValidate; + free(cs); dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, NULL); ret = (*pScreen->CloseScreen) (index, pScreen); @@ -129,6 +132,43 @@ compChangeWindowAttributes(WindowPtr pWin, unsigned long mask) return ret; } +static void +compGetImage (DrawablePtr pDrawable, + int sx, int sy, + int w, int h, + unsigned int format, + unsigned long planemask, + char *pdstLine) +{ + ScreenPtr pScreen = pDrawable->pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + + pScreen->GetImage = cs->GetImage; + if (pDrawable->type == DRAWABLE_WINDOW) + compPaintChildrenToWindow ((WindowPtr) pDrawable); + (*pScreen->GetImage) (pDrawable, sx, sy, w, h, format, planemask, pdstLine); + cs->GetImage = pScreen->GetImage; + pScreen->GetImage = compGetImage; +} + +static void compSourceValidate(DrawablePtr pDrawable, + int x, int y, + int width, int height, + unsigned int subWindowMode) +{ + ScreenPtr pScreen = pDrawable->pScreen; + CompScreenPtr cs = GetCompScreen (pScreen); + + pScreen->SourceValidate = cs->SourceValidate; + if (pDrawable->type == DRAWABLE_WINDOW && subWindowMode == IncludeInferiors) + compPaintChildrenToWindow ((WindowPtr) pDrawable); + if (pScreen->SourceValidate) + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, + subWindowMode); + cs->SourceValidate = pScreen->SourceValidate; + pScreen->SourceValidate = compSourceValidate; +} + /* * Add alternate visuals -- always expose an ARGB32 and RGB24 visual */ @@ -361,6 +401,12 @@ compScreenInit (ScreenPtr pScreen) cs->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = compCloseScreen; + cs->GetImage = pScreen->GetImage; + pScreen->GetImage = compGetImage; + + cs->SourceValidate = pScreen->SourceValidate; + pScreen->SourceValidate = compSourceValidate; + dixSetPrivate(&pScreen->devPrivates, CompScreenPrivateKey, cs); RegisterRealChildHeadProc(CompositeRealChildHead); diff --git a/composite/compint.h b/composite/compint.h index 4b058e7c3..57e0b5dea 100644 --- a/composite/compint.h +++ b/composite/compint.h @@ -159,6 +159,8 @@ typedef struct _CompScreen { Window overlayWid; CompOverlayClientPtr pOverlayClients; + GetImageProcPtr GetImage; + SourceValidateProcPtr SourceValidate; } CompScreenRec, *CompScreenPtr; extern DevPrivateKeyRec CompScreenPrivateKeyRec; @@ -313,7 +315,7 @@ void compCopyWindow (WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); void -compWindowUpdate (WindowPtr pWin); +compPaintChildrenToWindow (WindowPtr pWin); WindowPtr CompositeRealChildHead (WindowPtr pWin); diff --git a/composite/compwindow.c b/composite/compwindow.c index bbd575651..2440f1897 100644 --- a/composite/compwindow.c +++ b/composite/compwindow.c @@ -653,9 +653,10 @@ compWindowFormat (WindowPtr pWin) } static void -compWindowUpdateAutomatic (WindowPtr pWin, ScreenPtr pScreen) +compWindowUpdateAutomatic (WindowPtr pWin) { CompWindowPtr cw = GetCompWindow (pWin); + ScreenPtr pScreen = pWin->drawable.pScreen; WindowPtr pParent = pWin->parent; PixmapPtr pSrcPixmap = (*pScreen->GetWindowPixmap) (pWin); PictFormatPtr pSrcFormat = compWindowFormat (pWin); @@ -678,7 +679,8 @@ compWindowUpdateAutomatic (WindowPtr pWin, ScreenPtr pScreen) /* * First move the region from window to screen coordinates */ - RegionTranslate(pRegion, pWin->drawable.x, pWin->drawable.y); + RegionTranslate(pRegion, + pWin->drawable.x, pWin->drawable.y); /* * Clip against the "real" border clip @@ -688,7 +690,8 @@ compWindowUpdateAutomatic (WindowPtr pWin, ScreenPtr pScreen) /* * Now translate from screen to dest coordinates */ - RegionTranslate(pRegion, -pParent->drawable.x, -pParent->drawable.y); + RegionTranslate(pRegion, + -pParent->drawable.x, -pParent->drawable.y); /* * Clip the picture @@ -717,26 +720,35 @@ compWindowUpdateAutomatic (WindowPtr pWin, ScreenPtr pScreen) DamageEmpty (cw->damage); } -static int -compWindowUpdateVisit(WindowPtr pWin, void *data) +static void +compPaintWindowToParent (WindowPtr pWin) { + compPaintChildrenToWindow (pWin); + if (pWin->redirectDraw != RedirectDrawNone) { - CompWindowPtr cw = GetCompWindow(pWin); + CompWindowPtr cw = GetCompWindow(pWin); + if (cw->damaged) { - compWindowUpdateAutomatic(pWin, data); + compWindowUpdateAutomatic (pWin); cw->damaged = FALSE; } } - - return WT_WALKCHILDREN; } void -compWindowUpdate (WindowPtr pWin) +compPaintChildrenToWindow (WindowPtr pWin) { - TraverseTree(pWin, compWindowUpdateVisit, pWin->drawable.pScreen); + WindowPtr pChild; + + if (!pWin->damagedDescendants) + return; + + for (pChild = pWin->lastChild; pChild; pChild = pChild->prevSib) + compPaintWindowToParent (pChild); + + pWin->damagedDescendants = FALSE; } WindowPtr diff --git a/configure.ac b/configure.ac index e6ada8d2b..628760e7e 100644 --- a/configure.ac +++ b/configure.ac @@ -1908,8 +1908,8 @@ AM_CONDITIONAL(XWIN_MULTIWINDOW, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_MULTIWINDOWEXTWM, [test "x$XWIN" = xyes && test "x$WINDOWSWM" = xyes]) AM_CONDITIONAL(XWIN_CLIPBOARD, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_GLX_WINDOWS, [test "x$XWIN" = xyes && false]) -AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes && false]) -AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes && false]) +AM_CONDITIONAL(XWIN_NATIVEGDI, [test "x$XWIN" = xyes]) +AM_CONDITIONAL(XWIN_PRIMARYFB, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_RANDR, [test "x$XWIN" = xyes]) AM_CONDITIONAL(XWIN_XV, [test "x$XWIN" = xyes && test "x$XV" = xyes]) @@ -2218,7 +2218,9 @@ hw/xfree86/doc/sgml/Makefile hw/xfree86/dri/Makefile hw/xfree86/dri2/Makefile hw/xfree86/exa/Makefile +hw/xfree86/exa/man/Makefile hw/xfree86/fbdevhw/Makefile +hw/xfree86/fbdevhw/man/Makefile hw/xfree86/i2c/Makefile hw/xfree86/int10/Makefile hw/xfree86/loader/Makefile @@ -2238,27 +2240,34 @@ hw/xfree86/vgahw/Makefile hw/xfree86/x86emu/Makefile hw/xfree86/xaa/Makefile hw/xfree86/utils/Makefile +hw/xfree86/utils/man/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile hw/dmx/config/Makefile +hw/dmx/config/man/Makefile hw/dmx/doc/Makefile hw/dmx/examples/Makefile hw/dmx/input/Makefile hw/dmx/glxProxy/Makefile hw/dmx/Makefile +hw/dmx/man/Makefile hw/vfb/Makefile +hw/vfb/man/Makefile hw/xnest/Makefile +hw/xnest/man/Makefile hw/xwin/Makefile hw/xwin/glx/Makefile +hw/xwin/man/Makefile hw/xquartz/Makefile hw/xquartz/GL/Makefile hw/xquartz/bundle/Makefile -hw/xquartz/doc/Makefile +hw/xquartz/man/Makefile hw/xquartz/mach-startup/Makefile hw/xquartz/pbproxy/Makefile hw/xquartz/xpr/Makefile hw/kdrive/Makefile hw/kdrive/ephyr/Makefile +hw/kdrive/ephyr/man/Makefile hw/kdrive/fake/Makefile hw/kdrive/fbdev/Makefile hw/kdrive/linux/Makefile diff --git a/cpprules.in b/cpprules.in deleted file mode 100644 index 6e435785a..000000000 --- a/cpprules.in +++ /dev/null @@ -1,49 +0,0 @@ -# -*- Makefile -*- -# Rules for generating files using the C pre-processor -# (Replaces CppFileTarget from Imake) - -SUFFIXES = .pre .man .man.pre - -# Translate XCOMM into pound sign with sed, rather than passing -DXCOMM=XCOMM -# to cpp, because that trick does not work on all ANSI C preprocessors. -# Delete line numbers from the cpp output (-P is not portable, I guess). -# Allow XCOMM to be preceded by whitespace and provide a means of generating -# output lines with trailing backslashes. -# Allow XHASH to always be substituted, even in cases where XCOMM isn't. - -CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ - -e '/^\#line *[0-9][0-9]* *.*$$/d' \ - -e '/^[ ]*XCOMM$$/s/XCOMM/\#/' \ - -e '/^[ ]*XCOMM[^a-zA-Z0-9_]/s/XCOMM/\#/' \ - -e '/^[ ]*XHASH/s/XHASH/\#/' \ - -e '/\@\@$$/s/\@\@$$/\\/' - -# Strings to replace in man pages -XORGRELSTRING = @PACKAGE_STRING@ - XORGMANNAME = X Version 11 - XSERVERNAME = Xorg - -MANDEFS = \ - -D__vendorversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ - -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ - -D__appmansuffix__=$(APP_MAN_SUFFIX) \ - -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ - -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ - -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ - -D__drivermansuffix__=$(DRIVER_MAN_SUFFIX) \ - -D__adminmansuffix__=$(ADMIN_MAN_SUFFIX) \ - -D__mandir__=$(mandir) \ - -D__projectroot__=$(prefix) \ - -D__sysconfdir__=$(sysconfdir) \ - -D__datadir__=$(datadir) \ - -D__xconfigfile__=$(__XCONFIGFILE__) \ - -D__xconfigdir__=$(__XCONFIGDIR__) \ - -D__xkbdir__=$(XKB_BASE_DIRECTORY) \ - -D__modulepath__="$(DEFAULT_MODULE_PATH)" \ - -D__xlogfile__=$(XLOGFILE) -D__xservername__=$(XSERVERNAME) - -.pre: - $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ - -.man.pre.man: - $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ diff --git a/dix/events.c b/dix/events.c index f280f9d7a..07f8b05ea 100644 --- a/dix/events.c +++ b/dix/events.c @@ -209,10 +209,6 @@ static void CheckPhysLimits(DeviceIntPtr pDev, Bool generateEvents, Bool confineToScreen, ScreenPtr pScreen); -static Bool CheckPassiveGrabsOnWindow(WindowPtr pWin, - DeviceIntPtr device, - DeviceEvent *event, - BOOL checkCore); /** Key repeat hack. Do not use but in TryClientEvents */ extern BOOL EventIsKeyRepeat(xEvent *event); @@ -256,7 +252,7 @@ EventSyncInfoRec syncEvents; /** * The root window the given device is currently on. */ -#define RootWindow(dev) dev->spriteInfo->sprite->spriteTrace[0] +#define RootWindow(sprite) sprite->spriteTrace[0] static xEvent* swapEvent = NULL; static int swapEventLen = 0; @@ -332,12 +328,6 @@ IsMaster(DeviceIntPtr dev) return dev->type == MASTER_POINTER || dev->type == MASTER_KEYBOARD; } -static WindowPtr XYToWindow( - DeviceIntPtr pDev, - int x, - int y -); - /** * Max event opcode. */ @@ -445,7 +435,7 @@ GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev) (inputMasks->xi2mask[XIAllMasterDevices][evtype/8] && IsMaster(dev))); } -static Mask +Mask GetEventMask(DeviceIntPtr dev, xEvent *event, InputClients* other) { /* XI2 filters are only ever 8 bit, so let's return a 8 bit mask */ @@ -879,7 +869,7 @@ CheckVirtualMotion( #ifdef PANORAMIX if (noPanoramiXExtension) /* No typo. Only set the root win if disabled */ #endif - RootWindow(pDev) = pSprite->hot.pScreen->root; + RootWindow(pDev->spriteInfo->sprite) = pSprite->hot.pScreen->root; } static void @@ -1012,7 +1002,7 @@ PostNewCursor(DeviceIntPtr pDev) WindowPtr GetCurrentRootWindow(DeviceIntPtr dev) { - return RootWindow(dev); + return RootWindow(dev->spriteInfo->sprite); } /** @@ -1290,7 +1280,8 @@ ComputeFreezes(void) syncEvents.replayDev = (DeviceIntPtr)NULL; - w = XYToWindow(replayDev, event->root_x, event->root_y); + w = XYToWindow(replayDev->spriteInfo->sprite, + event->root_x, event->root_y); if (!CheckDeviceGrabs(replayDev, event, syncEvents.replayWin)) { if (replayDev->focus && !IsPointerEvent((InternalEvent*)event)) @@ -1511,7 +1502,7 @@ DeactivatePointerGrab(DeviceIntPtr mouse) DoEnterLeaveEvents(mouse, mouse->id, grab->window, mouse->spriteInfo->sprite->win, NotifyUngrab); if (grab->confineTo) - ConfineCursorToWindow(mouse, RootWindow(mouse), FALSE, FALSE); + ConfineCursorToWindow(mouse, GetCurrentRootWindow(mouse), FALSE, FALSE); PostNewCursor(mouse); if (grab->cursor) FreeCursor(grab->cursor, (Cursor)0); @@ -2181,9 +2172,8 @@ MaybeDeliverEventsToClient(WindowPtr pWin, xEvent *pEvents, return 2; } -static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event) +static Window FindChildForEvent(SpritePtr pSprite, WindowPtr event) { - SpritePtr pSprite = dev->spriteInfo->sprite; WindowPtr w = pSprite->spriteTrace[pSprite->spriteTraceGood-1]; Window child = None; @@ -2222,16 +2212,14 @@ static Window FindChildForEvent(DeviceIntPtr dev, WindowPtr event) */ void FixUpEventFromWindow( - DeviceIntPtr pDev, + SpritePtr pSprite, xEvent *xE, WindowPtr pWin, Window child, Bool calcChild) { - SpritePtr pSprite = pDev->spriteInfo->sprite; - if (calcChild) - child = FindChildForEvent(pDev, pWin); + child = FindChildForEvent(pSprite, pWin); if (XI2_EVENT(xE)) { @@ -2247,7 +2235,7 @@ FixUpEventFromWindow( event->evtype == XI_PropertyEvent) return; - event->root = RootWindow(pDev)->drawable.id; + event->root = RootWindow(pSprite)->drawable.id; event->event = pWin->drawable.id; if (pSprite->hot.pScreen == pWin->drawable.pScreen) { @@ -2268,7 +2256,7 @@ FixUpEventFromWindow( } else { - XE_KBPTR.root = RootWindow(pDev)->drawable.id; + XE_KBPTR.root = RootWindow(pSprite)->drawable.id; XE_KBPTR.event = pWin->drawable.id; if (pSprite->hot.pScreen == pWin->drawable.pScreen) { @@ -2374,6 +2362,7 @@ int DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, WindowPtr stopAt, DeviceIntPtr dev) { + SpritePtr pSprite = dev->spriteInfo->sprite; Window child = None; Mask filter; int deliveries = 0; @@ -2396,7 +2385,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, { /* XXX: XACE */ filter = GetEventFilter(dev, xi2); - FixUpEventFromWindow(dev, xi2, pWin, child, FALSE); + FixUpEventFromWindow(pSprite, xi2, pWin, child, FALSE); deliveries = DeliverEventsToWindow(dev, pWin, xi2, 1, filter, grab); free(xi2); @@ -2414,7 +2403,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, if (rc == Success) { if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, xE, count) == Success) { filter = GetEventFilter(dev, xE); - FixUpEventFromWindow(dev, xE, pWin, child, FALSE); + FixUpEventFromWindow(pSprite, xE, pWin, child, FALSE); deliveries = DeliverEventsToWindow(dev, pWin, xE, count, filter, grab); if (deliveries > 0) @@ -2432,7 +2421,7 @@ DeliverDeviceEvents(WindowPtr pWin, InternalEvent *event, GrabPtr grab, if (rc == Success) { if (XaceHook(XACE_SEND_ACCESS, NULL, dev, pWin, &core, 1) == Success) { filter = GetEventFilter(dev, &core); - FixUpEventFromWindow(dev, &core, pWin, child, FALSE); + FixUpEventFromWindow(pSprite, &core, pWin, child, FALSE); deliveries = DeliverEventsToWindow(dev, pWin, &core, 1, filter, grab); if (deliveries > 0) @@ -2555,16 +2544,14 @@ PointInBorderSize(WindowPtr pWin, int x, int y) * * @returns the window at the given coordinates. */ -static WindowPtr -XYToWindow(DeviceIntPtr pDev, int x, int y) +WindowPtr +XYToWindow(SpritePtr pSprite, int x, int y) { WindowPtr pWin; BoxRec box; - SpritePtr pSprite; - pSprite = pDev->spriteInfo->sprite; pSprite->spriteTraceGood = 1; /* root window still there */ - pWin = RootWindow(pDev)->firstChild; + pWin = RootWindow(pSprite)->firstChild; while (pWin) { if ((pWin->mapped) && @@ -2642,7 +2629,7 @@ ActivateFocusInGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) event.deviceid = dev->id; event.sourceid = dev->id; event.detail.button = 0; - rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE); + rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE, TRUE) != NULL); if (rc) DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveUngrab); return rc; @@ -2679,10 +2666,9 @@ ActivateEnterGrab(DeviceIntPtr dev, WindowPtr old, WindowPtr win) event.deviceid = dev->id; event.sourceid = dev->id; event.detail.button = 0; - rc = CheckPassiveGrabsOnWindow(win, dev, &event, FALSE); + rc = (CheckPassiveGrabsOnWindow(win, dev, &event, FALSE, TRUE) != NULL); if (rc) DoEnterLeaveEvents(dev, dev->id, old, win, XINotifyPassiveGrab); - return rc; } @@ -2737,7 +2723,8 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) if (pSprite->hot.pScreen != pSprite->hotPhys.pScreen) { pSprite->hot.pScreen = pSprite->hotPhys.pScreen; - RootWindow(pDev) = pSprite->hot.pScreen->root; + RootWindow(pDev->spriteInfo->sprite) = + pSprite->hot.pScreen->root; } } @@ -2776,7 +2763,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) ev->root_y = pSprite->hot.y; } - newSpriteWin = XYToWindow(pDev, pSprite->hot.x, pSprite->hot.y); + newSpriteWin = XYToWindow(pSprite, pSprite->hot.x, pSprite->hot.y); if (newSpriteWin != prevSpriteWin) { @@ -2942,7 +2929,7 @@ InitializeSprite(DeviceIntPtr pDev, WindowPtr pWin) FatalError("Failed to allocate spriteTrace"); pSprite->spriteTraceSize = 32; - RootWindow(pDev) = pWin; + RootWindow(pDev->spriteInfo->sprite) = pWin; pSprite->spriteTraceGood = 1; pSprite->pEnqueueScreen = pScreen; @@ -3352,21 +3339,25 @@ BorderSizeNotEmpty(DeviceIntPtr pDev, WindowPtr pWin) /** * "CheckPassiveGrabsOnWindow" checks to see if the event passed in causes a * passive grab set on the window to be activated. - * If a passive grab is activated, the event will be delivered to the client. + * If activate is true and a passive grab is found, it will be activated, + * and the event will be delivered to the client. * * @param pWin The window that may be subject to a passive grab. * @param device Device that caused the event. * @param event The current device event. * @param checkCore Check for core grabs too. + * @param activate If a grab is found, activate it and deliver the event. */ -static Bool +GrabPtr CheckPassiveGrabsOnWindow( WindowPtr pWin, DeviceIntPtr device, DeviceEvent *event, - BOOL checkCore) + BOOL checkCore, + BOOL activate) { + SpritePtr pSprite = device->spriteInfo->sprite; GrabPtr grab = wPassiveGrabs(pWin); GrabRec tempGrab; GrabInfoPtr grabinfo; @@ -3376,7 +3367,7 @@ CheckPassiveGrabsOnWindow( int match = 0; if (!grab) - return FALSE; + return NULL; /* Fill out the grab details, but leave the type for later before * comparing */ tempGrab.window = pWin; @@ -3422,9 +3413,9 @@ CheckPassiveGrabsOnWindow( tempGrab.detail.exact = event->detail.key; if (!match) { - tempGrab.type = GetXIType((InternalEvent*)event); tempGrab.grabtype = GRABTYPE_XI; - if (GrabMatchesSecond(&tempGrab, grab, FALSE)) + if ((tempGrab.type = GetXIType((InternalEvent*)event)) && + (GrabMatchesSecond(&tempGrab, grab, FALSE))) match = XI_MATCH; } @@ -3490,6 +3481,8 @@ CheckPassiveGrabsOnWindow( continue; } + if (!activate) + return grab; if (match & CORE_MATCH) { @@ -3530,7 +3523,7 @@ CheckPassiveGrabsOnWindow( if (xE) { - FixUpEventFromWindow(device, xE, grab->window, None, TRUE); + FixUpEventFromWindow(pSprite, xE, grab->window, None, TRUE); TryClientEvents(rClient(grab), device, xE, count, GetEventFilter(device, xE), @@ -3547,10 +3540,10 @@ CheckPassiveGrabsOnWindow( if (match & (XI_MATCH | XI2_MATCH)) free(xE); /* on core match xE == &core */ - return TRUE; + return grab; } } - return FALSE; + return NULL; #undef CORE_MATCH #undef XI_MATCH #undef XI2_MATCH @@ -3616,7 +3609,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) for (; i < focus->traceGood; i++) { pWin = focus->trace[i]; - if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore)) + if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE)) return TRUE; } @@ -3629,7 +3622,7 @@ CheckDeviceGrabs(DeviceIntPtr device, DeviceEvent *event, WindowPtr ancestor) for (; i < device->spriteInfo->sprite->spriteTraceGood; i++) { pWin = device->spriteInfo->sprite->spriteTrace[i]; - if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore)) + if (CheckPassiveGrabsOnWindow(pWin, device, event, sendCore, TRUE)) return TRUE; } @@ -3682,7 +3675,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) { /* XXX: XACE */ int filter = GetEventFilter(keybd, xi2); - FixUpEventFromWindow(ptr, xi2, focus, None, FALSE); + FixUpEventFromWindow(ptr->spriteInfo->sprite, xi2, focus, None, FALSE); deliveries = DeliverEventsToWindow(keybd, focus, xi2, 1, filter, NullGrab); if (deliveries > 0) @@ -3695,7 +3688,7 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) if (rc == Success && XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, xE, count) == Success) { - FixUpEventFromWindow(ptr, xE, focus, None, FALSE); + FixUpEventFromWindow(ptr->spriteInfo->sprite, xE, focus, None, FALSE); deliveries = DeliverEventsToWindow(keybd, focus, xE, count, GetEventFilter(keybd, xE), NullGrab); @@ -3711,7 +3704,8 @@ DeliverFocusedEvent(DeviceIntPtr keybd, InternalEvent *event, WindowPtr window) rc = EventToCore(event, &core); if (rc == Success) { if (XaceHook(XACE_SEND_ACCESS, NULL, keybd, focus, &core, 1) == Success) { - FixUpEventFromWindow(keybd, &core, focus, None, FALSE); + FixUpEventFromWindow(keybd->spriteInfo->sprite, &core, focus, + None, FALSE); deliveries = DeliverEventsToWindow(keybd, focus, &core, 1, GetEventFilter(keybd, &core), NullGrab); @@ -3801,8 +3795,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, rc = EventToCore(event, &core); if (rc == Success) { - FixUpEventFromWindow(thisDev, &core, grab->window, - None, TRUE); + FixUpEventFromWindow(pSprite, &core, grab->window, None, TRUE); if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, grab->window, &core, 1) || XaceHook(XACE_RECEIVE_ACCESS, rClient(grab), @@ -3829,7 +3822,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, grab->xi2mask[XIAllMasterDevices][evtype/8] | grab->xi2mask[thisDev->id][evtype/8]; /* try XI2 event */ - FixUpEventFromWindow(thisDev, xi2, grab->window, None, TRUE); + FixUpEventFromWindow(pSprite, xi2, grab->window, None, TRUE); /* XXX: XACE */ deliveries = TryClientEvents(rClient(grab), thisDev, xi2, 1, mask, GetEventFilter(thisDev, xi2), grab); @@ -3850,8 +3843,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, else mask = grab->eventMask; - FixUpEventFromWindow(thisDev, xi, grab->window, - None, TRUE); + FixUpEventFromWindow(pSprite, xi, grab->window, None, TRUE); if (XaceHook(XACE_SEND_ACCESS, 0, thisDev, grab->window, xi, count) || @@ -3889,7 +3881,7 @@ DeliverGrabbedEvent(InternalEvent *event, DeviceIntPtr thisDev, (CLIENT_BITS(grab->resource) == CLIENT_BITS(dev->deviceGrab.grab->resource))) dev->deviceGrab.sync.state = FROZEN_NO_EVENT; - else + else if (GetPairedDevice(thisDev) == dev) dev->deviceGrab.sync.other = grab; } /* fall through */ @@ -4197,7 +4189,7 @@ CoreEnterLeaveEvent( event.u.enterLeave.rootX = mouse->spriteInfo->sprite->hot.x; event.u.enterLeave.rootY = mouse->spriteInfo->sprite->hot.y; /* Counts on the same initial structure of crossing & button events! */ - FixUpEventFromWindow(mouse, &event, pWin, None, FALSE); + FixUpEventFromWindow(mouse->spriteInfo->sprite, &event, pWin, None, FALSE); /* Enter/Leave events always set child */ event.u.enterLeave.child = child; event.u.enterLeave.flags = event.u.keyButtonPointer.sameScreen ? @@ -4297,7 +4289,8 @@ DeviceEnterLeaveEvent( event->group.locked_group = kbd->key->xkbInfo->state.locked_group; } - FixUpEventFromWindow(mouse, (xEvent*)event, pWin, None, FALSE); + FixUpEventFromWindow(mouse->spriteInfo->sprite, (xEvent*)event, pWin, + None, FALSE); filter = GetEventFilter(mouse, (xEvent*)event); @@ -4554,7 +4547,8 @@ ProcGrabPointer(ClientPtr client) if (grab) { if (grab->confineTo && !confineTo) - ConfineCursorToWindow(device, RootWindow(device), FALSE, FALSE); + ConfineCursorToWindow(device, GetCurrentRootWindow(device), FALSE, + FALSE); oldCursor = grab->cursor; } @@ -4883,7 +4877,7 @@ ProcQueryPointer(ClientPtr client) rep.mask = mouse->button ? (mouse->button->state) : 0; rep.mask |= XkbStateFieldFromRec(&keyboard->key->xkbInfo->state); rep.length = 0; - rep.root = (RootWindow(mouse))->drawable.id; + rep.root = (GetCurrentRootWindow(mouse))->drawable.id; rep.rootX = pSprite->hot.x; rep.rootY = pSprite->hot.y; rep.child = None; @@ -5042,7 +5036,7 @@ ProcSendEvent(ClientPtr client) /* If the input focus is PointerRootWin, send the event to where the pointer is if possible, then perhaps propogate up to root. */ if (inputFocus == PointerRootWin) - inputFocus = RootWindow(dev); + inputFocus = GetCurrentRootWindow(dev); if (IsParent(inputFocus, pSprite->win)) { diff --git a/dix/inpututils.c b/dix/inpututils.c index 2877804d6..ef3142c84 100644 --- a/dix/inpututils.c +++ b/dix/inpututils.c @@ -433,6 +433,14 @@ valuator_mask_new(int num_valuators) return mask; } +void +valuator_mask_free(ValuatorMask **mask) +{ + free(*mask); + *mask = NULL; +} + + /** * Sets a range of valuators between first_valuator and num_valuators with * the data in the valuators array. All other values are set to 0. diff --git a/dix/resource.c b/dix/resource.c index 6bd240368..26d2c72aa 100644 --- a/dix/resource.c +++ b/dix/resource.c @@ -167,7 +167,6 @@ typedef struct _Resource { RESTYPE type; pointer value; } ResourceRec, *ResourcePtr; -#define NullResource ((ResourcePtr)NULL) typedef struct _ClientResource { ResourcePtr *resources; @@ -176,7 +175,6 @@ typedef struct _ClientResource { int hashsize; /* log(2)(buckets) */ XID fakeID; XID endFakeID; - XID expectID; } ClientResourceRec; RESTYPE lastResourceType; @@ -323,10 +321,9 @@ InitClientResources(ClientPtr client) clientTable[i].fakeID = client->clientAsMask | (client->index ? SERVER_BIT : SERVER_MINID); clientTable[i].endFakeID = (clientTable[i].fakeID | RESOURCE_ID_MASK) + 1; - clientTable[i].expectID = client->clientAsMask; for (j=0; j<INITBUCKETS; j++) { - clientTable[i].resources[j] = NullResource; + clientTable[i].resources[j] = NULL; } return TRUE; } @@ -512,8 +509,6 @@ AddResource(XID id, RESTYPE type, pointer value) res->value = value; *head = res; rrec->elements++; - if (!(id & SERVER_BIT) && (id >= rrec->expectID)) - rrec->expectID = id + 1; CallResourceStateCallback(ResourceStateAdding, res); return TRUE; } @@ -543,7 +538,7 @@ RebuildTable(int client) } for (rptr = resources, tptr = tails; --j >= 0; rptr++, tptr++) { - *rptr = NullResource; + *rptr = NULL; *tptr = rptr; } clientTable[client].hashsize++; @@ -555,7 +550,7 @@ RebuildTable(int client) for (res = *rptr; res; res = next) { next = res->next; - res->next = NullResource; + res->next = NULL; tptr = &tails[Hash(client, res->id)]; **tptr = res; *tptr = &res->next; @@ -886,24 +881,21 @@ LegalNewID(XID id, ClientPtr client) #ifdef PANORAMIX XID minid, maxid; - if (!noPanoramiXExtension) { - minid = client->clientAsMask | (client->index ? - SERVER_BIT : SERVER_MINID); - maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1; - if ((id >= minid) && (id <= maxid)) - return TRUE; - } + if (!noPanoramiXExtension) { + minid = client->clientAsMask | (client->index ? + SERVER_BIT : SERVER_MINID); + maxid = (clientTable[client->index].fakeID | RESOURCE_ID_MASK) + 1; + if ((id >= minid) && (id <= maxid)) + return TRUE; + } #endif /* PANORAMIX */ - if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) - { - if (clientTable[client->index].expectID <= id) - return TRUE; - - rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, - DixGetAttrAccess); - return rc == BadValue; - } - return FALSE; + if (client->clientAsMask == (id & ~RESOURCE_ID_MASK)) + { + rc = dixLookupResourceByClass(&val, id, RC_ANY, serverClient, + DixGetAttrAccess); + return rc == BadValue; + } + return FALSE; } int diff --git a/dix/window.c b/dix/window.c index d140ddade..9be70649a 100644 --- a/dix/window.c +++ b/dix/window.c @@ -298,6 +298,10 @@ SetWindowToDefaults(WindowPtr pWin) #ifdef ROOTLESS pWin->rootlessUnhittable = FALSE; #endif + +#ifdef COMPOSITE + pWin->damagedDescendants = FALSE; +#endif } static void diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index dd0851270..71d704917 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -2,19 +2,5 @@ # (i.e. those handled in the os/utils.c options processing instead of in # the DDX-level options processing) -appmandir = $(APP_MAN_DIR) +include $(top_srcdir)/manpages.am appman_PRE = Xserver.man -appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) - -EXTRA_DIST = $(appman_PRE) -CLEANFILES = $(appman_DATA) -SUFFIXES = .$(APP_MAN_SUFFIX) .man - -# String replacements in MAN_SUBSTS now come from xorg-macros.m4 via configure -# 's|/,|/, |g' will add a space to help font path formatting -MAN_SUBSTS += -e 's|__datadir__|$(datadir)|g' \ - -e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \ - -e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' - -.man.$(APP_MAN_SUFFIX): - $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ diff --git a/doc/xml/Xserver-spec.xml b/doc/xml/Xserver-spec.xml index a2aec2f0f..7d7f9152c 100644 --- a/doc/xml/Xserver-spec.xml +++ b/doc/xml/Xserver-spec.xml @@ -2954,16 +2954,17 @@ The sample server implementation is in Xserver/fb/fbscreen.c.</para> pScreen->SourceValidate(pDrawable, x, y, width, height) DrawablePtr pDrawable; int x, y, width, height; + unsigned int subWindowMode; </programlisting></blockquote> SourceValidate should be called by CopyArea/CopyPlane primitives when -the source drawable is not the same as the destination, and the -SourceValidate function pointer in the screen is non-null. If you know that +the SourceValidate function pointer in the screen is non-null. If you know that you will never need SourceValidate, you can avoid this check. Currently, SourceValidate is used by the mi software cursor code to remove the cursor from the screen when the source rectangle overlaps the cursor position. x,y,width,height describe the source rectangle (source relative, that is) -for the copy operation.</para> +for the copy operation. subWindowMode comes from the GC or source Picture. +</para> <para> <blockquote><programlisting> diff --git a/exa/exa_mixed.c b/exa/exa_mixed.c index ef20eb502..606f1e1f9 100644 --- a/exa/exa_mixed.c +++ b/exa/exa_mixed.c @@ -98,7 +98,7 @@ exaCreatePixmap_mixed(ScreenPtr pScreen, int w, int h, int depth, pExaPixmap->use_gpu_copy = FALSE; if (w == 1 && h == 1) { - pExaPixmap->sys_ptr = malloc((pPixmap->drawable.bitsPerPixel + 7) / 8); + pExaPixmap->sys_ptr = malloc(paddedWidth); /* Set up damage tracking */ pExaPixmap->pDamage = DamageCreate(exaDamageReport_mixed, NULL, diff --git a/exa/exa_unaccel.c b/exa/exa_unaccel.c index d3c405fb1..bd533c402 100644 --- a/exa/exa_unaccel.c +++ b/exa/exa_unaccel.c @@ -438,7 +438,8 @@ ExaSrcValidate(DrawablePtr pDrawable, int x, int y, int width, - int height) + int height, + unsigned int subWindowMode) { ScreenPtr pScreen = pDrawable->pScreen; ExaScreenPriv(pScreen); @@ -464,7 +465,7 @@ ExaSrcValidate(DrawablePtr pDrawable, if (pExaScr->SavedSourceValidate) { swap(pExaScr, pScreen, SourceValidate); - pScreen->SourceValidate(pDrawable, x, y, width, height); + pScreen->SourceValidate(pDrawable, x, y, width, height, subWindowMode); swap(pExaScr, pScreen, SourceValidate); } } diff --git a/glx/glxcmds.c b/glx/glxcmds.c index de9c3f039..3ef567d10 100644 --- a/glx/glxcmds.c +++ b/glx/glxcmds.c @@ -56,7 +56,7 @@ validGlxScreen(ClientPtr client, int screen, __GLXscreen **pGlxScreen, int *err) /* ** Check if screen exists. */ - if (screen >= screenInfo.numScreens) { + if (screen < 0 || screen >= screenInfo.numScreens) { client->errorValue = screen; *err = BadValue; return FALSE; @@ -314,11 +314,14 @@ DoCreateContext(__GLXclientState *cl, GLXContextID gcId, int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; + REQUEST_SIZE_MATCH(xGLXCreateContextReq); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err)) @@ -330,11 +333,14 @@ int __glXDisp_CreateContext(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; + REQUEST_SIZE_MATCH(xGLXCreateNewContextReq); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) @@ -346,12 +352,15 @@ int __glXDisp_CreateNewContext(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; + REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) @@ -362,10 +371,13 @@ int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) } int __glXDisp_DestroyContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; __GLXcontext *glxc; int err; + REQUEST_SIZE_MATCH(xGLXDestroyContextReq); + if (!validGlxContext(cl->client, req->context, DixDestroyAccess, &glxc, &err)) return err; @@ -685,24 +697,33 @@ DoMakeCurrent(__GLXclientState *cl, int __glXDisp_MakeCurrent(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; + REQUEST_SIZE_MATCH(xGLXMakeCurrentReq); + return DoMakeCurrent( cl, req->drawable, req->drawable, req->context, req->oldContextTag ); } int __glXDisp_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; + REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq); + return DoMakeCurrent( cl, req->drawable, req->readdrawable, req->context, req->oldContextTag ); } int __glXDisp_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; + REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq); + return DoMakeCurrent( cl, req->drawable, req->readable, req->context, req->oldContextTag ); } @@ -715,6 +736,8 @@ int __glXDisp_IsDirect(__GLXclientState *cl, GLbyte *pc) __GLXcontext *glxc; int err; + REQUEST_SIZE_MATCH(xGLXIsDirectReq); + if (!validGlxContext(cl->client, req->context, DixReadAccess, &glxc, &err)) return err; @@ -739,6 +762,8 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc) xGLXQueryVersionReply reply; GLuint major, minor; + REQUEST_SIZE_MATCH(xGLXQueryVersionReq); + major = req->majorVersion; minor = req->minorVersion; (void)major; @@ -765,11 +790,15 @@ int __glXDisp_QueryVersion(__GLXclientState *cl, GLbyte *pc) int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXWaitGLReq *req = (xGLXWaitGLReq *)pc; - GLXContextTag tag = req->contextTag; + GLXContextTag tag; __GLXcontext *glxc = NULL; int error; + REQUEST_SIZE_MATCH(xGLXWaitGLReq); + + tag = req->contextTag; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) @@ -789,11 +818,15 @@ int __glXDisp_WaitGL(__GLXclientState *cl, GLbyte *pc) int __glXDisp_WaitX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXWaitXReq *req = (xGLXWaitXReq *)pc; - GLXContextTag tag = req->contextTag; + GLXContextTag tag; __GLXcontext *glxc = NULL; int error; + REQUEST_SIZE_MATCH(xGLXWaitXReq); + + tag = req->contextTag; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) @@ -813,13 +846,19 @@ int __glXDisp_CopyContext(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; - GLXContextID source = req->source; - GLXContextID dest = req->dest; - GLXContextTag tag = req->contextTag; - unsigned long mask = req->mask; + GLXContextID source; + GLXContextID dest; + GLXContextTag tag; + unsigned long mask; __GLXcontext *src, *dst; int error; + REQUEST_SIZE_MATCH(xGLXCopyContextReq); + + source = req->source; + dest = req->dest; + tag = req->contextTag; + mask = req->mask; if (!validGlxContext(cl->client, source, DixReadAccess, &src, &error)) return error; if (!validGlxContext(cl->client, dest, DixWriteAccess, &dst, &error)) @@ -902,6 +941,8 @@ int __glXDisp_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; @@ -1081,13 +1122,17 @@ DoGetFBConfigs(__GLXclientState *cl, unsigned screen) int __glXDisp_GetFBConfigs(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; + REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq); return DoGetFBConfigs(cl, req->screen); } int __glXDisp_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; + REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq); return DoGetFBConfigs(cl, req->screen); } @@ -1213,11 +1258,14 @@ determineTextureTarget(ClientPtr client, XID glxDrawableID, int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; + REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxVisual(cl->client, pGlxScreen, req->visual, &config, &err)) @@ -1229,11 +1277,19 @@ int __glXDisp_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; + REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) @@ -1252,12 +1308,15 @@ int __glXDisp_CreatePixmap(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; + REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); + if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) @@ -1284,15 +1343,21 @@ static int DoDestroyDrawable(__GLXclientState *cl, XID glxdrawable, int type) int __glXDisp_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; + REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq); + return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); } int __glXDisp_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyPixmapReq *req = (xGLXDestroyPixmapReq *) pc; + REQUEST_SIZE_MATCH(xGLXDestroyPixmapReq); + return DoDestroyDrawable(cl, req->glxpixmap, GLX_DRAWABLE_PIXMAP); } @@ -1331,10 +1396,18 @@ DoCreatePbuffer(ClientPtr client, int screenNum, XID fbconfigId, int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; CARD32 *attrs; int width, height, i; + REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); + attrs = (CARD32 *) (req + 1); width = 0; height = 0; @@ -1360,23 +1433,32 @@ int __glXDisp_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; + REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq); + return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, req->width, req->height, req->pbuffer); } int __glXDisp_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; + REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq); + return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER); } int __glXDisp_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; + REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); + return DoDestroyDrawable(cl, req->pbuffer, GLX_DRAWABLE_PBUFFER); } @@ -1407,18 +1489,34 @@ DoChangeDrawableAttributes(ClientPtr client, XID glxdrawable, int __glXDisp_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *) pc; + REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3); + return DoChangeDrawableAttributes(cl->client, req->drawable, req->numAttribs, (CARD32 *) (req + 1)); } int __glXDisp_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXChangeDrawableAttributesSGIXReq *req = (xGLXChangeDrawableAttributesSGIXReq *)pc; + REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3); + return DoChangeDrawableAttributes(cl->client, req->drawable, req->numAttribs, (CARD32 *) (req + 1)); } @@ -1432,6 +1530,13 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) DrawablePtr pDraw; int err; + REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); + LEGAL_NEW_RESOURCE(req->glxwindow, client); if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) @@ -1455,8 +1560,11 @@ int __glXDisp_CreateWindow(__GLXclientState *cl, GLbyte *pc) int __glXDisp_DestroyWindow(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; + REQUEST_SIZE_MATCH(xGLXDestroyWindowReq); + return DoDestroyDrawable(cl, req->glxwindow, GLX_DRAWABLE_WINDOW); } @@ -1472,12 +1580,16 @@ int __glXDisp_SwapBuffers(__GLXclientState *cl, GLbyte *pc) { ClientPtr client = cl->client; xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; - GLXContextTag tag = req->contextTag; - XID drawId = req->drawable; + GLXContextTag tag; + XID drawId; __GLXcontext *glxc = NULL; __GLXdrawable *pGlxDraw; int error; + REQUEST_SIZE_MATCH(xGLXSwapBuffersReq); + + tag = req->contextTag; + drawId = req->drawable; if (tag) { glxc = __glXLookupContextByTag(cl, tag); if (!glxc) { @@ -1558,15 +1670,21 @@ DoQueryContext(__GLXclientState *cl, GLXContextID gcId) int __glXDisp_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; + REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); + return DoQueryContext(cl, req->context); } int __glXDisp_QueryContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; + REQUEST_SIZE_MATCH(xGLXQueryContextReq); + return DoQueryContext(cl, req->context); } @@ -1580,6 +1698,8 @@ int __glXDisp_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) int buffer; int error; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); + pc += __GLX_VENDPRIV_HDR_SIZE; drawId = *((CARD32 *) (pc)); @@ -1614,6 +1734,8 @@ int __glXDisp_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) int buffer; int error; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); + pc += __GLX_VENDPRIV_HDR_SIZE; drawId = *((CARD32 *) (pc)); @@ -1649,6 +1771,8 @@ int __glXDisp_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) (void) client; (void) req; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); + pc += __GLX_VENDPRIV_HDR_SIZE; drawId = *((CARD32 *) (pc)); @@ -1737,16 +1861,22 @@ DoGetDrawableAttributes(__GLXclientState *cl, XID drawId) int __glXDisp_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; + REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq); + return DoGetDrawableAttributes(cl, req->drawable); } int __glXDisp_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetDrawableAttributesSGIXReq *req = (xGLXGetDrawableAttributesSGIXReq *)pc; + REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); + return DoGetDrawableAttributes(cl, req->drawable); } @@ -1771,6 +1901,8 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc) __GLXcontext *glxc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXRenderReq); + req = (xGLXRenderReq *) pc; if (client->swapped) { __GLX_SWAP_SHORT(&req->length); @@ -1791,6 +1923,9 @@ int __glXDisp_Render(__GLXclientState *cl, GLbyte *pc) __GLXdispatchRenderProcPtr proc; int err; + if (left < sizeof(__GLXrenderHeader)) + return BadLength; + /* ** Verify that the header length and the overall length agree. ** Also, each command must be word aligned. @@ -2069,10 +2204,12 @@ int __glXDisp_RenderLarge(__GLXclientState *cl, GLbyte *pc) int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLint vendorcode = req->vendorCode; __GLXdispatchVendorPrivProcPtr proc; + REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, @@ -2088,10 +2225,12 @@ int __glXDisp_VendorPrivate(__GLXclientState *cl, GLbyte *pc) int __glXDisp_VendorPrivateWithReply(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLint vendorcode = req->vendorCode; __GLXdispatchVendorPrivProcPtr proc; + REQUEST_AT_LEAST_SIZE(xGLXVendorPrivateReq); proc = (__GLXdispatchVendorPrivProcPtr) __glXGetProtocolDecodeFunction(& VendorPriv_dispatch_info, @@ -2114,6 +2253,8 @@ int __glXDisp_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) char *buf; int err; + REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq); + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; @@ -2153,6 +2294,8 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) int err; char ver_str[16]; + REQUEST_SIZE_MATCH(xGLXQueryServerStringReq); + if (!validGlxScreen(client, req->screen, &pGlxScreen, &err)) return err; @@ -2200,13 +2343,19 @@ int __glXDisp_QueryServerString(__GLXclientState *cl, GLbyte *pc) int __glXDisp_ClientInfo(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; const char *buf; + REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); + + buf = (const char *)(req+1); + if (!memchr(buf, 0, (client->req_len << 2) - sizeof(xGLXClientInfoReq))) + return BadLength; + cl->GLClientmajorVersion = req->major; cl->GLClientminorVersion = req->minor; free(cl->GLClientextensions); - buf = (const char *)(req+1); cl->GLClientextensions = strdup(buf); return Success; diff --git a/glx/glxcmdsswap.c b/glx/glxcmdsswap.c index ce4d69a0b..3bb4cade9 100644 --- a/glx/glxcmdsswap.c +++ b/glx/glxcmdsswap.c @@ -60,9 +60,12 @@ int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCreateContextReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->visual); @@ -74,9 +77,12 @@ int __glXDispSwap_CreateContext(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCreateNewContextReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->fbconfig); @@ -89,10 +95,13 @@ int __glXDispSwap_CreateNewContext(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCreateContextWithConfigSGIXReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); __GLX_SWAP_INT(&req->fbconfig); @@ -105,9 +114,12 @@ int __glXDispSwap_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXDestroyContextReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); @@ -116,9 +128,12 @@ int __glXDispSwap_DestroyContext(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXMakeCurrentReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->context); @@ -129,9 +144,12 @@ int __glXDispSwap_MakeCurrent(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXMakeContextCurrentReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->readdrawable); @@ -143,9 +161,12 @@ int __glXDispSwap_MakeContextCurrent(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXMakeCurrentReadSGIReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->readable); @@ -157,9 +178,12 @@ int __glXDispSwap_MakeCurrentReadSGI(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXIsDirectReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); @@ -168,9 +192,12 @@ int __glXDispSwap_IsDirect(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXQueryVersionReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->majorVersion); __GLX_SWAP_INT(&req->minorVersion); @@ -180,9 +207,12 @@ int __glXDispSwap_QueryVersion(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXWaitGLReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -191,9 +221,12 @@ int __glXDispSwap_WaitGL(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXWaitXReq *req = (xGLXWaitXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXWaitXReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -202,9 +235,12 @@ int __glXDispSwap_WaitX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCopyContextReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->source); __GLX_SWAP_INT(&req->dest); @@ -215,36 +251,48 @@ int __glXDispSwap_CopyContext(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetVisualConfigs(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXGetVisualConfigsReq); + __GLX_SWAP_INT(&req->screen); return __glXDisp_GetVisualConfigs(cl, pc); } int __glXDispSwap_GetFBConfigs(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXGetFBConfigsReq); + __GLX_SWAP_INT(&req->screen); return __glXDisp_GetFBConfigs(cl, pc); } int __glXDispSwap_GetFBConfigsSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXGetFBConfigsSGIXReq); + __GLX_SWAP_INT(&req->screen); return __glXDisp_GetFBConfigsSGIX(cl, pc); } int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->visual); @@ -256,29 +304,41 @@ int __glXDispSwap_CreateGLXPixmap(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_CreatePixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; CARD32 *attribs; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXCreatePixmapReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pixmap); __GLX_SWAP_INT(&req->glxpixmap); __GLX_SWAP_INT(&req->numAttribs); + + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXCreatePixmapReq, req->numAttribs << 3); attribs = (CARD32*)(req + 1); - __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); + __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_CreatePixmap(cl, pc); } int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateGLXPixmapWithConfigSGIXReq *req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCreateGLXPixmapWithConfigSGIXReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); @@ -290,9 +350,12 @@ int __glXDispSwap_CreateGLXPixmapWithConfigSGIX(__GLXclientState *cl, GLbyte *pc int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->glxpixmap); @@ -301,9 +364,12 @@ int __glXDispSwap_DestroyGLXPixmap(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXDestroyGLXPixmapReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->glxpixmap); @@ -312,9 +378,12 @@ int __glXDispSwap_DestroyPixmap(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXQueryContextReq); + __GLX_SWAP_INT(&req->context); return __glXDisp_QueryContext(cl, pc); @@ -322,26 +391,38 @@ int __glXDispSwap_QueryContext(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_CreatePbuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; + REQUEST_AT_LEAST_SIZE(xGLXCreatePbufferReq); + __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pbuffer); __GLX_SWAP_INT(&req->numAttribs); + + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXCreatePbufferReq, req->numAttribs << 3); attribs = (CARD32*)(req + 1); - __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); + __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_CreatePbuffer(cl, pc); } int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXCreateGLXPbufferSGIXReq); + __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->pbuffer); @@ -353,9 +434,12 @@ int __glXDispSwap_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXDestroyPbufferReq); + __GLX_SWAP_INT(&req->pbuffer); return __glXDisp_DestroyPbuffer(cl, pc); @@ -363,9 +447,12 @@ int __glXDispSwap_DestroyPbuffer(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyGLXPbufferSGIXReq *req = (xGLXDestroyGLXPbufferSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXDestroyGLXPbufferSGIXReq); + __GLX_SWAP_INT(&req->pbuffer); return __glXDisp_DestroyGLXPbufferSGIX(cl, pc); @@ -373,16 +460,25 @@ int __glXDispSwap_DestroyGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXChangeDrawableAttributesReq *req = (xGLXChangeDrawableAttributesReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; + REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesReq); + __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->numAttribs); + + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesReq, req->numAttribs << 3); attribs = (CARD32*)(req + 1); - __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); + __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_ChangeDrawableAttributes(cl, pc); } @@ -390,43 +486,64 @@ int __glXDispSwap_ChangeDrawableAttributes(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_ChangeDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXChangeDrawableAttributesSGIXReq *req = (xGLXChangeDrawableAttributesSGIXReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; + REQUEST_AT_LEAST_SIZE(xGLXChangeDrawableAttributesSGIXReq); + __GLX_SWAP_INT(&req->drawable); __GLX_SWAP_INT(&req->numAttribs); + + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXChangeDrawableAttributesSGIXReq, req->numAttribs << 3); attribs = (CARD32*)(req + 1); - __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); + __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_ChangeDrawableAttributesSGIX(cl, pc); } int __glXDispSwap_CreateWindow(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; __GLX_DECLARE_SWAP_ARRAY_VARIABLES; CARD32 *attribs; + REQUEST_AT_LEAST_SIZE(xGLXCreateWindowReq); + __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->fbconfig); __GLX_SWAP_INT(&req->window); __GLX_SWAP_INT(&req->glxwindow); __GLX_SWAP_INT(&req->numAttribs); + + if (req->numAttribs > (UINT32_MAX >> 3)) { + client->errorValue = req->numAttribs; + return BadValue; + } + REQUEST_FIXED_SIZE(xGLXCreateWindowReq, req->numAttribs << 3); attribs = (CARD32*)(req + 1); - __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs); + __GLX_SWAP_INT_ARRAY(attribs, req->numAttribs << 1); return __glXDisp_CreateWindow(cl, pc); } int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXDestroyWindowReq); + __GLX_SWAP_INT(&req->glxwindow); return __glXDisp_DestroyWindow(cl, pc); @@ -434,9 +551,12 @@ int __glXDispSwap_DestroyWindow(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXSwapBuffersReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->drawable); @@ -446,9 +566,12 @@ int __glXDispSwap_SwapBuffers(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXUseXFontReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); __GLX_SWAP_INT(&req->font); @@ -462,9 +585,12 @@ int __glXDispSwap_UseXFont(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXQueryExtensionsStringReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); @@ -473,9 +599,12 @@ int __glXDispSwap_QueryExtensionsString(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXQueryServerStringReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->screen); __GLX_SWAP_INT(&req->name); @@ -485,9 +614,12 @@ int __glXDispSwap_QueryServerString(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXClientInfoReq *req = (xGLXClientInfoReq *)pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_AT_LEAST_SIZE(xGLXClientInfoReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->major); __GLX_SWAP_INT(&req->minor); @@ -498,9 +630,12 @@ int __glXDispSwap_ClientInfo(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXQueryContextInfoEXTReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->context); @@ -509,12 +644,14 @@ int __glXDispSwap_QueryContextInfoEXT(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXDrawable *drawId; int *buffer; - __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); + pc += __GLX_VENDPRIV_HDR_SIZE; drawId = ((GLXDrawable *) (pc)); @@ -530,12 +667,14 @@ int __glXDispSwap_BindTexImageEXT(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXDrawable *drawId; int *buffer; - __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 8); + pc += __GLX_VENDPRIV_HDR_SIZE; drawId = ((GLXDrawable *) (pc)); @@ -551,12 +690,14 @@ int __glXDispSwap_ReleaseTexImageEXT(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; GLXDrawable *drawId; int *buffer; - __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_FIXED_SIZE(xGLXVendorPrivateReq, 20); + (void) drawId; (void) buffer; @@ -576,11 +717,13 @@ int __glXDispSwap_CopySubBufferMESA(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXVendorPrivateWithReplyReq *req = (xGLXVendorPrivateWithReplyReq *)pc; CARD32 *data; - __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesSGIXReq); + data = (CARD32 *) (req + 1); __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->contextTag); @@ -591,10 +734,12 @@ int __glXDispSwap_GetDrawableAttributesSGIX(__GLXclientState *cl, GLbyte *pc) int __glXDispSwap_GetDrawableAttributes(__GLXclientState *cl, GLbyte *pc) { + ClientPtr client = cl->client; xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *)pc; - __GLX_DECLARE_SWAP_VARIABLES; + REQUEST_SIZE_MATCH(xGLXGetDrawableAttributesReq); + __GLX_SWAP_SHORT(&req->length); __GLX_SWAP_INT(&req->drawable); diff --git a/glx/xfont.c b/glx/xfont.c index 99437842e..84a301f9b 100644 --- a/glx/xfont.c +++ b/glx/xfont.c @@ -154,6 +154,8 @@ int __glXDisp_UseXFont(__GLXclientState *cl, GLbyte *pc) __GLXcontext *cx; int error; + REQUEST_SIZE_MATCH(xGLXUseXFontReq); + req = (xGLXUseXFontReq *) pc; cx = __glXForceCurrent(cl, req->contextTag, &error); if (!cx) { diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am index 2a87c3966..e0b201b82 100644 --- a/hw/dmx/Makefile.am +++ b/hw/dmx/Makefile.am @@ -1,5 +1,5 @@ -SUBDIRS = input config examples doc +SUBDIRS = input config examples doc man bin_PROGRAMS = Xdmx if XINERAMA @@ -85,28 +85,5 @@ Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) Xdmx_DEPENDENCIES= $(XDMX_LIBS) Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) -# Man page -appmandir = $(APP_MAN_DIR) - -appman_PRE = Xdmx.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -CLEANFILES = $(appman_DATA) - -# Strings to replace in man pages -XORGRELSTRING = @PACKAGE_STRING@ - XORGMANNAME = X Version 11 - -MAN_SUBSTS = \ - -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' \ - -e 's|__miscmansuffix__|$(MISC_MAN_SUFFIX)|g' - -SUFFIXES = .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ - -EXTRA_DIST = $(appman_PRE) - relink: $(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT) diff --git a/hw/dmx/config/Makefile.am b/hw/dmx/config/Makefile.am index 25a814e79..de4ce315d 100644 --- a/hw/dmx/config/Makefile.am +++ b/hw/dmx/config/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = man + noinst_LIBRARIES = libdmxconfig.a LIBSRCS = parser.y \ @@ -53,26 +55,7 @@ dmxtodmx_DEPENDENCIES = libdmxconfig.a dmxtodmx_SOURCES = dmxtodmx.c dmxtodmx_LDADD = -L. -ldmxconfig -appmandir = $(APP_MAN_DIR) - -appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -CLEANFILES = $(appman_DATA) - -SUFFIXES = .$(APP_MAN_SUFFIX) .man - -# Strings to replace in man pages -XORGRELSTRING = @PACKAGE_STRING@ - XORGMANNAME = X Version 11 - -MAN_SUBSTS = -e 's|__vendorversion__|"$(XORGRELSTRING)" "$(XORGMANNAME)"|' - -.man.$(APP_MAN_SUFFIX): - $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ - EXTRA_DIST = \ - $(appman_PRE) \ test-a.in test-a.out \ test-b.in test-b.out \ test-c.in test-c.out \ diff --git a/hw/dmx/config/man/Makefile.am b/hw/dmx/config/man/Makefile.am new file mode 100644 index 000000000..9bb62a4c6 --- /dev/null +++ b/hw/dmx/config/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man diff --git a/hw/dmx/config/dmxtodmx.man b/hw/dmx/config/man/dmxtodmx.man index 68c7f5b40..68c7f5b40 100644 --- a/hw/dmx/config/dmxtodmx.man +++ b/hw/dmx/config/man/dmxtodmx.man diff --git a/hw/dmx/config/vdltodmx.man b/hw/dmx/config/man/vdltodmx.man index b733db7ab..b733db7ab 100644 --- a/hw/dmx/config/vdltodmx.man +++ b/hw/dmx/config/man/vdltodmx.man diff --git a/hw/dmx/config/xdmxconfig.man b/hw/dmx/config/man/xdmxconfig.man index dcceea0e3..dcceea0e3 100644 --- a/hw/dmx/config/xdmxconfig.man +++ b/hw/dmx/config/man/xdmxconfig.man diff --git a/hw/dmx/config/xdmxconfig.c b/hw/dmx/config/xdmxconfig.c index 033b52512..c67077aec 100644 --- a/hw/dmx/config/xdmxconfig.c +++ b/hw/dmx/config/xdmxconfig.c @@ -142,7 +142,7 @@ static void dmxConfigGetDims(int *maxWidth, int *maxHeight) DMXConfigEntryPtr e; *maxWidth = dmxConfigWallWidth = 0; - *maxWidth = dmxConfigWallHeight = 0; + *maxHeight = dmxConfigWallHeight = 0; if (!dmxConfigCurrent) return; dmxConfigWallWidth = dmxConfigCurrent->width; diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c index 45cb3db93..bd326ce2a 100644 --- a/hw/dmx/dmxextension.c +++ b/hw/dmx/dmxextension.c @@ -855,7 +855,7 @@ static void dmxBERestorePixmap(PixmapPtr pPixmap) static void dmxBECreateResources(pointer value, XID id, RESTYPE type, pointer n) { - int scrnNum = (int)n; + int scrnNum = (uintptr_t)n; ScreenPtr pScreen = screenInfo.screens[scrnNum]; if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { @@ -1059,7 +1059,7 @@ static void dmxBERestoreRenderPict(pointer value, XID id, pointer n) { PicturePtr pPicture = value; /* The picture */ DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ - int scrnNum = (int)n; + int scrnNum = (uintptr_t)n; if (pDraw->pScreen->myNum != scrnNum) { /* Picture not on the screen we are restoring*/ @@ -1081,7 +1081,7 @@ static void dmxBERestoreRenderPict(pointer value, XID id, pointer n) static void dmxBERestoreRenderGlyph(pointer value, XID id, pointer n) { GlyphSetPtr glyphSet = value; - int scrnNum = (int)n; + int scrnNum = (uintptr_t)n; dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum]; GlyphRefPtr table; @@ -1274,7 +1274,7 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) for (i = currentMaxClients; --i >= 0; ) if (clients[i]) FindAllClientResources(clients[i], dmxBECreateResources, - (pointer)idx); + (pointer)(uintptr_t)idx); /* Create window hierarchy (top down) */ dmxBECreateWindowTree(idx); @@ -1283,13 +1283,15 @@ int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) for (i = currentMaxClients; --i >= 0; ) if (clients[i]) FindClientResourcesByType(clients[i],PictureType, - dmxBERestoreRenderPict,(pointer)idx); + dmxBERestoreRenderPict, + (pointer)(uintptr_t)idx); /* Restore the glyph state for RENDER */ for (i = currentMaxClients; --i >= 0; ) if (clients[i]) FindClientResourcesByType(clients[i],GlyphSetType, - dmxBERestoreRenderGlyph,(pointer)idx); + dmxBERestoreRenderGlyph, + (pointer)(uintptr_t)idx); /* Refresh screen by generating exposure events for all windows */ dmxForceExposures(idx); @@ -1453,7 +1455,7 @@ static void dmxBESavePixmap(PixmapPtr pPixmap) static void dmxBEDestroyResources(pointer value, XID id, RESTYPE type, pointer n) { - int scrnNum = (int)n; + int scrnNum = (uintptr_t)n; ScreenPtr pScreen = screenInfo.screens[scrnNum]; if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { @@ -1596,7 +1598,7 @@ int dmxDetachScreen(int idx) for (i = currentMaxClients; --i >= 0; ) if (clients[i]) FindAllClientResources(clients[i], dmxBEDestroyResources, - (pointer)idx); + (pointer)(uintptr_t)idx); /* Free scratch GCs */ dmxBEDestroyScratchGCs(idx); diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c index 829200e6a..f10f9a074 100644 --- a/hw/dmx/dmxgc.c +++ b/hw/dmx/dmxgc.c @@ -383,12 +383,7 @@ void dmxChangeClip(GCPtr pGC, int type, pointer pvalue, int nrects) break; case CT_PIXMAP: - case CT_UNSORTED: - case CT_YSORTED: - case CT_YXSORTED: - case CT_YXBANDED: - /* These clip types are condensed down to either NONE or REGION - in the mi code */ + /* Condensed down to REGION in the mi code */ break; } diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c index 7cac86f79..5cbd620c9 100644 --- a/hw/dmx/input/dmxinputinit.c +++ b/hw/dmx/input/dmxinputinit.c @@ -132,14 +132,6 @@ static DMXLocalInputInfoRec DMXConsoleKbd = { NULL, dmxCommonKbdCtrl, dmxCommonKbdBell }; -static DMXLocalInputInfoRec DMXCommonOth = { - "common-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_COMMON, 1, - dmxCommonCopyPrivate, NULL, - NULL, NULL, NULL, dmxCommonOthGetInfo, - dmxCommonOthOn, dmxCommonOthOff -}; - - static DMXLocalInputInfoRec DMXLocalDevices[] = { /* Dummy drivers that can compile on any OS */ #ifdef __linux__ @@ -615,7 +607,7 @@ static void dmxCollectAll(DMXInputInfo *dmxInput) static void dmxBlockHandler(pointer blockData, OSTimePtr pTimeout, pointer pReadMask) { - DMXInputInfo *dmxInput = &dmxInputs[(int)blockData]; + DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData]; static unsigned long generation = 0; if (generation != serverGeneration) { @@ -642,7 +634,7 @@ static void dmxSwitchReturn(pointer p) static void dmxWakeupHandler(pointer blockData, int result, pointer pReadMask) { - DMXInputInfo *dmxInput = &dmxInputs[(int)blockData]; + DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t)blockData]; int i; if (dmxInput->vt_switch_pending) { @@ -897,29 +889,6 @@ static void dmxInputScanForExtensions(DMXInputInfo *dmxInput, int doXI) } } break; -#if 0 - case IsXExtensionDevice: - case IsXExtensionKeyboard: - case IsXExtensionPointer: - if (doXI) { - if (!dmxInput->numDevs) { - dmxLog(dmxWarning, - "Cannot use remote (%s) XInput devices if" - " not also using core devices\n", - dmxInput->name); - } else { - dmxLocal = dmxInputCopyLocal(dmxInput, - &DMXCommonOth); - dmxLocal->isCore = FALSE; - dmxLocal->sendsCore = FALSE; - dmxLocal->deviceId = devices[i].id; - dmxLocal->deviceName = (devices[i].name - ? strdup(devices[i].name) - : NULL); - } - } - break; -#endif } } XFreeDeviceList(devices); @@ -1067,9 +1036,8 @@ void dmxInputInit(DMXInputInfo *dmxInput) dmxInput->processInputEvents = dmxProcessInputEvents; dmxInput->detached = False; - RegisterBlockAndWakeupHandlers(dmxBlockHandler, - dmxWakeupHandler, - (void *)dmxInput->inputIdx); + RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler, + (void *)(uintptr_t)dmxInput->inputIdx); } static void dmxInputFreeLocal(DMXLocalInputInfoRec *local) diff --git a/hw/dmx/man/Makefile.am b/hw/dmx/man/Makefile.am new file mode 100644 index 000000000..e717aefe2 --- /dev/null +++ b/hw/dmx/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = Xdmx.man diff --git a/hw/dmx/Xdmx.man b/hw/dmx/man/Xdmx.man index 9c8bdea00..9c8bdea00 100644 --- a/hw/dmx/Xdmx.man +++ b/hw/dmx/man/Xdmx.man diff --git a/hw/kdrive/ephyr/.gitignore b/hw/kdrive/ephyr/.gitignore index bfe7e08c2..4962d1ef0 100644 --- a/hw/kdrive/ephyr/.gitignore +++ b/hw/kdrive/ephyr/.gitignore @@ -1,3 +1 @@ -# Add & Override for this directory and it's subdirectories Xephyr -Xephyr.man diff --git a/hw/kdrive/ephyr/Makefile.am b/hw/kdrive/ephyr/Makefile.am index 8646703ad..9d9b64ee5 100644 --- a/hw/kdrive/ephyr/Makefile.am +++ b/hw/kdrive/ephyr/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = man + INCLUDES = \ @KDRIVE_INCS@ \ @KDRIVE_CFLAGS@ \ @@ -83,20 +85,6 @@ Xephyr_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) relink: $(AM_V_at)rm -f $(bin_PROGRAMS) && $(MAKE) $(bin_PROGRAMS) -MAN_SRCS = Xephyr.man.pre - -appmandir = $(APP_MAN_DIR) -appman_DATA = Xephyr.$(APP_MAN_SUFFIX) - -Xephyr.$(APP_MAN_SUFFIX): Xephyr.man - -$(AM_V_at)rm -f Xephyr.$(APP_MAN_SUFFIX) - $(AM_V_at)$(LN_S) Xephyr.man Xephyr.$(APP_MAN_SUFFIX) - -include $(top_srcdir)/cpprules.in - -CLEANFILES = $(appman_DATA) Xephyr.man - EXTRA_DIST = \ $(HOSTVIDEO_SRCS) \ - $(HOSTDRI_SRCS) \ - $(MAN_SRCS) + $(HOSTDRI_SRCS) diff --git a/hw/kdrive/ephyr/man/Makefile.am b/hw/kdrive/ephyr/man/Makefile.am new file mode 100644 index 000000000..e8a372143 --- /dev/null +++ b/hw/kdrive/ephyr/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = Xephyr.man diff --git a/hw/kdrive/ephyr/Xephyr.man.pre b/hw/kdrive/ephyr/man/Xephyr.man index eb80b96b0..8e7bfd550 100644 --- a/hw/kdrive/ephyr/Xephyr.man.pre +++ b/hw/kdrive/ephyr/man/Xephyr.man @@ -46,9 +46,9 @@ sets the screen size. .BI -parent " id" uses exiting window .I id . -If a -.BI -screen -argument follows a +If a +.BI -screen +argument follows a .BI -parent argument, this screen is embedded into the given window. .TP 8 @@ -85,5 +85,3 @@ Mouse button 5 probably won't work. X(__miscmansuffix__), Xserver(__appmansuffix__) .SH AUTHOR Matthew Allum <mallum@o-hand.com> 2004 - - diff --git a/hw/vfb/.gitignore b/hw/vfb/.gitignore index 55076f01d..c04754124 100644 --- a/hw/vfb/.gitignore +++ b/hw/vfb/.gitignore @@ -1,3 +1 @@ -# Add & Override for this directory and it's subdirectories Xvfb -Xvfb.man diff --git a/hw/vfb/Makefile.am b/hw/vfb/Makefile.am index de5e1c5c9..ed46dbbc1 100644 --- a/hw/vfb/Makefile.am +++ b/hw/vfb/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = man + bin_PROGRAMS = Xvfb noinst_LIBRARIES = libfbcmap.a @@ -28,24 +30,5 @@ Xvfb_LDADD = $(XVFB_LIBS) $(XVFB_SYS_LIBS) $(XSERVER_SYS_LIBS) Xvfb_DEPENDENCIES = $(XVFB_LIBS) Xvfb_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -# Man page -include $(top_srcdir)/cpprules.in - -appmandir = $(APP_MAN_DIR) - -appman_PRE = Xvfb.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(appman_PRE) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -$(AM_V_at)rm -f $@ - $(AM_V_at)$(LN_S) $< $@ - -EXTRA_DIST = Xvfb.man.pre - relink: $(AM_V_at)rm -f Xvfb$(EXEEXT) && $(MAKE) Xvfb$(EXEEXT) diff --git a/hw/vfb/man/Makefile.am b/hw/vfb/man/Makefile.am new file mode 100644 index 000000000..93941882a --- /dev/null +++ b/hw/vfb/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = Xvfb.man diff --git a/hw/vfb/Xvfb.man.pre b/hw/vfb/man/Xvfb.man index 569afe175..95b4dd4c1 100644 --- a/hw/vfb/Xvfb.man.pre +++ b/hw/vfb/man/Xvfb.man @@ -1,16 +1,16 @@ .\" $XdotOrg: xc/programs/Xserver/hw/vfb/Xvfb.man,v 1.3 2005/03/23 20:49:52 gisburn Exp $ .\" $Xorg: Xvfb.man,v 1.4 2001/02/09 02:04:45 xorgcvs Exp $ .\" Copyright 1993, 1998 The Open Group -.\" +.\" .\" 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. @@ -18,7 +18,7 @@ .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. -.\" +.\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization @@ -66,7 +66,7 @@ have values from 1 to 32. .B "\-fbdir \fIframebuffer-directory\fP" This option specifies the directory in which the memory mapped files containing the framebuffer memory should be created. -See FILES. +See FILES. This option only exists on machines that have the mmap and msync system calls. .TP 4 @@ -113,7 +113,7 @@ Xvfb -pixdepths 3 27 -fbdir /var/tmp The server will listen for connections as server number 0, will have the default screen configuration (one screen, 1280x1024x8), will also support pixmap -depths of 3 and 27, +depths of 3 and 27, and will use memory mapped files in /var/tmp for the framebuffer. .TP 8 xwud -in /var/tmp/Xvfb_screen0 diff --git a/hw/xfree86/.gitignore b/hw/xfree86/.gitignore index 813af0b97..2ddca49e3 100644 --- a/hw/xfree86/.gitignore +++ b/hw/xfree86/.gitignore @@ -1,7 +1,4 @@ -# Add & Override for this directory and it's subdirectories libxorg.c Xorg xorg.c xorg.conf.example -xorg.conf.example.pre - diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am index 575481e70..c23b1fd6c 100644 --- a/hw/xfree86/Makefile.am +++ b/hw/xfree86/Makefile.am @@ -1,4 +1,3 @@ -include $(top_srcdir)/cpprules.in if DRI DRI_SUBDIR = dri @@ -77,7 +76,7 @@ Xorg_LDADD = $(MAIN_LIB) libxorg.la $(XORG_SYS_LIBS) $(XSERVER_SYS_LIBS) Xorg_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) BUILT_SOURCES = xorg.conf.example -DISTCLEANFILES += xorg.conf.example xorg.conf.example.pre +DISTCLEANFILES += xorg.conf.example EXTRA_DIST = xorgconf.cpp if SPECIAL_DTRACE_OBJECTS @@ -108,13 +107,14 @@ if INSTALL_SETUID chmod u+s $(DESTDIR)$(bindir)/Xorg endif -CPP_FILES_FLAGS = \ - $(MANDEFS) \ - -DDEFAULTFONTPATH="\"$(COMPILEDDEFAULTFONTPATH)\"" \ - -DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\" +# Use variables from XORG_MANPAGE_SECTIONS and X Server configuration +# Do not include manpages.am as values are not appropriate for rc files +CONF_SUBSTS = -e 's|__filemansuffix__|$(FILE_MAN_SUFFIX)|g' \ + -e 's|MODULEPATH|$(DEFAULT_MODULE_PATH)|g' \ + -e 's|DEFAULTFONTPATH|$(COMPILEDDEFAULTFONTPATH)|g' + +xorg.conf.example: xorgconf.cpp + $(AM_V_GEN)$(SED) $(CONF_SUBSTS) < $< > $@ relink: $(AM_V_at)rm -f Xorg && $(MAKE) Xorg - -xorg.conf.example.pre: xorgconf.cpp - cp $(srcdir)/xorgconf.cpp $@ diff --git a/hw/xfree86/common/xf86VGAarbiter.c b/hw/xfree86/common/xf86VGAarbiter.c index e518f455f..215e8454a 100644 --- a/hw/xfree86/common/xf86VGAarbiter.c +++ b/hw/xfree86/common/xf86VGAarbiter.c @@ -325,13 +325,14 @@ VGAarbiterGetSpans ( static void VGAarbiterSourceValidate ( DrawablePtr pDrawable, - int x, int y, int width, int height ) + int x, int y, int width, int height, + unsigned int subWindowMode ) { ScreenPtr pScreen = pDrawable->pScreen; SCREEN_PROLOG (SourceValidate); VGAGet(pScreen); if (pScreen->SourceValidate) - (*pScreen->SourceValidate) (pDrawable, x, y, width, height); + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode); VGAPut(); SCREEN_EPILOG (SourceValidate, VGAarbiterSourceValidate); } diff --git a/hw/xfree86/common/xf86VGAarbiterPriv.h b/hw/xfree86/common/xf86VGAarbiterPriv.h index 2920fb53a..848e45da7 100644 --- a/hw/xfree86/common/xf86VGAarbiterPriv.h +++ b/hw/xfree86/common/xf86VGAarbiterPriv.h @@ -149,7 +149,7 @@ static void VGAarbiterGetImage (DrawablePtr pDrawable, int sx, int sy, int w, static void VGAarbiterGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); static void VGAarbiterSourceValidate (DrawablePtr pDrawable, int x, int y, - int width, int height); + int width, int height, unsigned int subWindowMode); static void VGAarbiterCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc); static void VGAarbiterClearToBackground (WindowPtr pWin, int x, int y, int w, diff --git a/hw/xfree86/doc/man/.gitignore b/hw/xfree86/doc/man/.gitignore deleted file mode 100644 index 7a16e4a29..000000000 --- a/hw/xfree86/doc/man/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -# Add & Override for this directory and it's subdirectories -Xorg -Xorg.man -xorg.conf.man diff --git a/hw/xfree86/doc/man/Makefile.am b/hw/xfree86/doc/man/Makefile.am index 737166b51..80e22cbab 100644 --- a/hw/xfree86/doc/man/Makefile.am +++ b/hw/xfree86/doc/man/Makefile.am @@ -1,24 +1,3 @@ -# Xserver.man covers options generic to all X servers built in this tree -MAN_SRCS = Xorg.man.pre xorg.conf.man.pre - -appmandir = $(APP_MAN_DIR) -appman_DATA = Xorg.$(APP_MAN_SUFFIX) - -filemandir = $(FILE_MAN_DIR) -fileman_DATA = xorg.conf.$(FILE_MAN_SUFFIX) - -Xorg.$(APP_MAN_SUFFIX): Xorg.man - -$(AM_V_at)rm -f Xorg.$(APP_MAN_SUFFIX) - $(AM_V_at)$(LN_S) Xorg.man Xorg.$(APP_MAN_SUFFIX) - -xorg.conf.$(FILE_MAN_SUFFIX): xorg.conf.man - -$(AM_V_at)rm -f xorg.conf.$(FILE_MAN_SUFFIX) - $(AM_V_at)$(LN_S) xorg.conf.man xorg.conf.$(FILE_MAN_SUFFIX) - -include $(top_srcdir)/cpprules.in - -EXTRAMANDEFS = -D__logdir__=$(logdir) - -CLEANFILES = $(appman_DATA) $(fileman_DATA) xorg.conf.man Xorg.man - -EXTRA_DIST = $(MAN_SRCS) +include $(top_srcdir)/manpages.am +appman_PRE = Xorg.man +fileman_PRE = xorg.conf.man xorg.conf.d.man diff --git a/hw/xfree86/doc/man/Xorg.man.pre b/hw/xfree86/doc/man/Xorg.man index 86e89a93c..6fa334cc3 100644 --- a/hw/xfree86/doc/man/Xorg.man.pre +++ b/hw/xfree86/doc/man/Xorg.man @@ -15,7 +15,7 @@ is a full featured X server that was originally designed for UNIX and UNIX-like operating systems running on Intel x86 hardware. It now runs on a wider range of hardware and OS platforms. .PP -This work was derived by the X.Org Foundation from the XFree86 Project's +This work was derived by the X.Org Foundation from the XFree86 Project's .I "XFree86\ 4.4rc2" release. The XFree86 release was originally derived from @@ -117,13 +117,13 @@ one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters can be supplied via all methods. The available command line options and environment variables (and some defaults) are described here and in -the Xserver(__appmansuffix__) manual page. Most configuration file +the Xserver(__appmansuffix__) manual page. Most configuration file parameters, with their defaults, are described in the -__xconfigfile__(__filemansuffix__) manual page. Driver and module specific -configuration parameters are described in the relevant driver or module +__xconfigfile__(__filemansuffix__) manual page. Driver and module specific +configuration parameters are described in the relevant driver or module manual page. .PP -In addition to the normal server options described in the +In addition to the normal server options described in the Xserver(__appmansuffix__) manual page, .B __xservername__ accepts the following command line switches: @@ -673,7 +673,7 @@ information can be found from the X.Org web site .PP .B __xservername__ is copyright software, provided under licenses that permit modification -and redistribution in source and binary form without fee. +and redistribution in source and binary form without fee. .B __xservername__ is copyright by numerous authors and contributors from around the world. Licensing information can be found at @@ -684,6 +684,6 @@ Refer to the source code for specific copyright notices. is a trademark of The XFree86 Project, Inc. .PP .B X11(TM) -and +and .B X Window System(TM) are trademarks of The Open Group. diff --git a/hw/xfree86/doc/man/xorg.conf.d.man b/hw/xfree86/doc/man/xorg.conf.d.man new file mode 100644 index 000000000..6b3379ece --- /dev/null +++ b/hw/xfree86/doc/man/xorg.conf.d.man @@ -0,0 +1 @@ +.so man__filemansuffix__/xorg.conf.__filemansuffix__ diff --git a/hw/xfree86/doc/man/xorg.conf.man.pre b/hw/xfree86/doc/man/xorg.conf.man index e3fd0eadf..e3fd0eadf 100644 --- a/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/hw/xfree86/doc/man/xorg.conf.man diff --git a/hw/xfree86/dri2/dri2.c b/hw/xfree86/dri2/dri2.c index e4693d92e..39996f946 100644 --- a/hw/xfree86/dri2/dri2.c +++ b/hw/xfree86/dri2/dri2.c @@ -640,6 +640,17 @@ DRI2CanFlip(DrawablePtr pDraw) if (!RegionEqual(&pWin->clipList, &pRoot->winSize)) return FALSE; + /* Does the window match the pixmap exactly? */ + if (pDraw->x != 0 || + pDraw->y != 0 || +#ifdef COMPOSITE + pDraw->x != pWinPixmap->screen_x || + pDraw->y != pWinPixmap->screen_y || +#endif + pDraw->width != pWinPixmap->drawable.width || + pDraw->height != pWinPixmap->drawable.height) + return FALSE; + return TRUE; } diff --git a/hw/xfree86/exa/.gitignore b/hw/xfree86/exa/.gitignore deleted file mode 100644 index d20a82fb5..000000000 --- a/hw/xfree86/exa/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Add & Override for this directory and it's subdirectories -exa.man diff --git a/hw/xfree86/exa/Makefile.am b/hw/xfree86/exa/Makefile.am index da9b720d7..39f7a9057 100644 --- a/hw/xfree86/exa/Makefile.am +++ b/hw/xfree86/exa/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = man + module_LTLIBRARIES = libexa.la libexa_la_LDFLAGS = -avoid-version @@ -14,15 +16,3 @@ libexa_la_SOURCES = \ libexa_la_LIBADD = \ ../../../exa/libexa.la - -include $(top_srcdir)/cpprules.in - -drivermandir = $(DRIVER_MAN_DIR) -driverman_DATA = exa.$(DRIVER_MAN_SUFFIX) -CLEANFILES = $(driverman_DATA) exa.man - -exa.$(DRIVER_MAN_SUFFIX): exa.man - -$(AM_V_at)rm -f exa.$(DRIVER_MAN_SUFFIX) - $(AM_V_at)$(LN_S) exa.man exa.$(DRIVER_MAN_SUFFIX) - -EXTRA_DIST = exa.man.pre diff --git a/hw/xfree86/exa/man/Makefile.am b/hw/xfree86/exa/man/Makefile.am new file mode 100644 index 000000000..51da4fd50 --- /dev/null +++ b/hw/xfree86/exa/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +driverman_PRE = exa.man diff --git a/hw/xfree86/exa/exa.man.pre b/hw/xfree86/exa/man/exa.man index 5c953e256..30d01824d 100644 --- a/hw/xfree86/exa/exa.man.pre +++ b/hw/xfree86/exa/man/exa.man @@ -7,7 +7,7 @@ exa \- new 2D acceleration architecture for X.Org .B EXA provides a simple API for video drivers to implement for 2D acceleration. It is a module loaded by drivers, and is not intended to be loaded on its own. -See your driver's manual page for how to enable +See your driver's manual page for how to enable .BR EXA . .PP The @@ -25,7 +25,7 @@ the Render extension. Not related to the Composite extension. Default: No. Disables acceleration of uploading pixmap data to the framebuffer. Default: No. .TP .BI "Option \*qEXANoDownloadFromScreen\*q \*q" boolean \*q -Disables acceleration of downloading of pixmap data from the framebuffer. +Disables acceleration of downloading of pixmap data from the framebuffer. .B NOTE: Not usable with drivers which rely on DownloadFromScreen succeeding. Default: No. diff --git a/hw/xfree86/fbdevhw/.gitignore b/hw/xfree86/fbdevhw/.gitignore deleted file mode 100644 index 88d61c605..000000000 --- a/hw/xfree86/fbdevhw/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Add & Override for this directory and it's subdirectories -fbdevhw.man diff --git a/hw/xfree86/fbdevhw/Makefile.am b/hw/xfree86/fbdevhw/Makefile.am index 76a69c1fb..2a038905e 100644 --- a/hw/xfree86/fbdevhw/Makefile.am +++ b/hw/xfree86/fbdevhw/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = man + module_LTLIBRARIES = libfbdevhw.la libfbdevhw_la_LDFLAGS = -avoid-version @@ -14,14 +16,4 @@ AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) sdk_HEADERS = fbdevhw.h -include $(top_srcdir)/cpprules.in - -drivermandir = $(DRIVER_MAN_DIR) -driverman_DATA = fbdevhw.$(DRIVER_MAN_SUFFIX) -CLEANFILES = $(driverman_DATA) fbdevhw.man - -fbdevhw.$(DRIVER_MAN_SUFFIX): fbdevhw.man - -$(AM_V_at)rm -f fbdevhw.$(DRIVER_MAN_SUFFIX) - $(AM_V_at)$(LN_S) fbdevhw.man fbdevhw.$(DRIVER_MAN_SUFFIX) - -EXTRA_DIST = fbpriv.h fbdevhw.man.pre README +EXTRA_DIST = fbpriv.h README diff --git a/hw/xfree86/fbdevhw/man/Makefile.am b/hw/xfree86/fbdevhw/man/Makefile.am new file mode 100644 index 000000000..7f22a12b9 --- /dev/null +++ b/hw/xfree86/fbdevhw/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +driverman_PRE = fbdevhw.man diff --git a/hw/xfree86/fbdevhw/fbdevhw.man.pre b/hw/xfree86/fbdevhw/man/fbdevhw.man index deeced860..fe5d1e17b 100644 --- a/hw/xfree86/fbdevhw/fbdevhw.man.pre +++ b/hw/xfree86/fbdevhw/man/fbdevhw.man @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.1 2001/01/24 00:06:34 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.1 2001/01/24 00:06:34 dawes Exp $ .TH FBDEVHW __drivermansuffix__ __vendorversion__ .SH NAME fbdevhw \- os-specific submodule for framebuffer device access @@ -14,7 +14,7 @@ fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the fbdevhw module. fbdevhw can be used by other drivers too, this is usually activated with `Option "UseFBDev"' in the device section. .SH "SEE ALSO" -__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), +__xservername__(__appmansuffix__), __xconfigfile__(__filemansuffix__), xorgconfig(__appmansuffix__), Xserver(__appmansuffix__), X(__miscmansuffix__), fbdev(__drivermansuffix__) .SH AUTHORS diff --git a/hw/xfree86/modes/xf86Modes.c b/hw/xfree86/modes/xf86Modes.c index 75584cf87..c2dc3dc75 100644 --- a/hw/xfree86/modes/xf86Modes.c +++ b/hw/xfree86/modes/xf86Modes.c @@ -355,15 +355,32 @@ xf86ValidateModesSize(ScrnInfoPtr pScrn, DisplayModePtr modeList, { DisplayModePtr mode; - for (mode = modeList; mode != NULL; mode = mode->next) { - if (maxPitch > 0 && mode->HDisplay > maxPitch) - mode->status = MODE_BAD_WIDTH; - - if (maxX > 0 && mode->HDisplay > maxX) - mode->status = MODE_VIRTUAL_X; + if (maxPitch <= 0) + maxPitch = MAXINT; + if (maxX <= 0) + maxX = MAXINT; + if (maxY <= 0) + maxY = MAXINT; - if (maxY > 0 && mode->VDisplay > maxY) - mode->status = MODE_VIRTUAL_Y; + for (mode = modeList; mode != NULL; mode = mode->next) { + if ((xf86ModeWidth(mode, RR_Rotate_0) > maxPitch || + xf86ModeWidth(mode, RR_Rotate_0) > maxX || + xf86ModeHeight(mode, RR_Rotate_0) > maxY) && + (xf86ModeWidth(mode, RR_Rotate_90) > maxPitch || + xf86ModeWidth(mode, RR_Rotate_90) > maxX || + xf86ModeHeight(mode, RR_Rotate_90) > maxY)) { + if (xf86ModeWidth(mode, RR_Rotate_0) > maxPitch || + xf86ModeWidth(mode, RR_Rotate_90) > maxPitch) + mode->status = MODE_BAD_WIDTH; + + if (xf86ModeWidth(mode, RR_Rotate_0) > maxX || + xf86ModeWidth(mode, RR_Rotate_90) > maxX) + mode->status = MODE_VIRTUAL_X; + + if (xf86ModeHeight(mode, RR_Rotate_0) > maxY || + xf86ModeHeight(mode, RR_Rotate_90) > maxY) + mode->status = MODE_VIRTUAL_Y; + } if (mode->next == modeList) break; diff --git a/hw/xfree86/utils/Makefile.am b/hw/xfree86/utils/Makefile.am index d27861b03..71f979048 100644 --- a/hw/xfree86/utils/Makefile.am +++ b/hw/xfree86/utils/Makefile.am @@ -1,3 +1,4 @@ SUBDIRS = \ gtf \ - cvt + cvt \ + man diff --git a/hw/xfree86/utils/cvt/.gitignore b/hw/xfree86/utils/cvt/.gitignore index 7816fd7c6..a217c5563 100644 --- a/hw/xfree86/utils/cvt/.gitignore +++ b/hw/xfree86/utils/cvt/.gitignore @@ -1,3 +1 @@ -# Add & Override for this directory and it's subdirectories cvt -cvt.man diff --git a/hw/xfree86/utils/cvt/Makefile.am b/hw/xfree86/utils/cvt/Makefile.am index ba02145b7..4ebcedf39 100644 --- a/hw/xfree86/utils/cvt/Makefile.am +++ b/hw/xfree86/utils/cvt/Makefile.am @@ -32,11 +32,3 @@ cvt_SOURCES = cvt.c \ $(top_srcdir)/os/xprintf.c cvt_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) - -man1_MANS = cvt.man - -CLEANFILES = $(man1_MANS) - -include $(top_srcdir)/cpprules.in - -EXTRA_DIST = cvt.man.pre diff --git a/hw/xfree86/utils/gtf/.gitignore b/hw/xfree86/utils/gtf/.gitignore index 9aebbbb60..919c993fb 100644 --- a/hw/xfree86/utils/gtf/.gitignore +++ b/hw/xfree86/utils/gtf/.gitignore @@ -1,3 +1 @@ -# Add & Override for this directory and it's subdirectories gtf -gtf.man diff --git a/hw/xfree86/utils/gtf/Makefile.am b/hw/xfree86/utils/gtf/Makefile.am index ea1c5fb8c..f77bf608e 100644 --- a/hw/xfree86/utils/gtf/Makefile.am +++ b/hw/xfree86/utils/gtf/Makefile.am @@ -25,20 +25,3 @@ bin_PROGRAMS = gtf gtf_SOURCES = gtf.c gtf_CFLAGS = $(XORG_CFLAGS) gtf_LDADD = -lm - -appmandir = $(APP_MAN_DIR) - -appman_PRE = gtf.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -include $(top_srcdir)/cpprules.in - -EXTRA_DIST = gtf.man.pre -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(appman_PRE) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -$(AM_V_at)rm -f $@ - $(AM_V_at)$(LN_S) $< $@ diff --git a/hw/xfree86/utils/man/Makefile.am b/hw/xfree86/utils/man/Makefile.am new file mode 100644 index 000000000..7afc5bcca --- /dev/null +++ b/hw/xfree86/utils/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = cvt.man gtf.man diff --git a/hw/xfree86/utils/cvt/cvt.man.pre b/hw/xfree86/utils/man/cvt.man index 8a292eed8..b380171ee 100644 --- a/hw/xfree86/utils/cvt/cvt.man.pre +++ b/hw/xfree86/utils/man/cvt.man @@ -13,7 +13,7 @@ cvt - calculate VESA CVT mode lines .I Cvt is a utility for calculating VESA Coordinated Video Timing modes. Given the desired horizontal and vertical resolutions, a modeline adhering to the CVT -standard is printed. This modeline can be included in __xservername__ +standard is printed. This modeline can be included in __xservername__ .B __xconfigfile__(__filemansuffix__) . diff --git a/hw/xfree86/utils/gtf/gtf.man.pre b/hw/xfree86/utils/man/gtf.man index 74ade74cb..74ade74cb 100644 --- a/hw/xfree86/utils/gtf/gtf.man.pre +++ b/hw/xfree86/utils/man/gtf.man diff --git a/hw/xfree86/xaa/xaaBitBlt.c b/hw/xfree86/xaa/xaaBitBlt.c index 5148ed4a2..049dbfbe7 100644 --- a/hw/xfree86/xaa/xaaBitBlt.c +++ b/hw/xfree86/xaa/xaaBitBlt.c @@ -54,10 +54,10 @@ XAABitBlt( origDest.x = dstx; origDest.y = dsty; - if((pSrcDrawable != pDstDrawable) && - pSrcDrawable->pScreen->SourceValidate) { + if (pSrcDrawable->pScreen->SourceValidate) { (*pSrcDrawable->pScreen->SourceValidate) ( - pSrcDrawable, srcx, srcy, width, height); + pSrcDrawable, srcx, srcy, width, height, + pGC->subWindowMode); } srcx += pSrcDrawable->x; diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp index 8f0c83014..cd6d4a983 100644 --- a/hw/xfree86/xorgconf.cpp +++ b/hw/xfree86/xorgconf.cpp @@ -1,73 +1,73 @@ -XCOMM -XCOMM Copyright (c) 1994-1998 by The XFree86 Project, Inc. -XCOMM -XCOMM Permission is hereby granted, free of charge, to any person obtaining a -XCOMM copy of this software and associated documentation files (the "Software"), -XCOMM to deal in the Software without restriction, including without limitation -XCOMM the rights to use, copy, modify, merge, publish, distribute, sublicense, -XCOMM and/or sell copies of the Software, and to permit persons to whom the -XCOMM Software is furnished to do so, subject to the following conditions: -XCOMM -XCOMM The above copyright notice and this permission notice shall be included in -XCOMM all copies or substantial portions of the Software. -XCOMM -XCOMM THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -XCOMM IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -XCOMM FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -XCOMM THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -XCOMM WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF -XCOMM OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -XCOMM SOFTWARE. -XCOMM -XCOMM Except as contained in this notice, the name of the XFree86 Project shall -XCOMM not be used in advertising or otherwise to promote the sale, use or other -XCOMM dealings in this Software without prior written authorization from the -XCOMM XFree86 Project. -XCOMM -XCOMM $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $ - -XCOMM ********************************************************************** -XCOMM This is a sample configuration file only, intended to illustrate -XCOMM what a config file might look like. Refer to the __xconfigfile__(__filemansuffix__) -XCOMM man page for details about the format of this file. -XCOMM ********************************************************************** - -XCOMM The ordering of sections is not important in XFree86 4.0 and later, -XCOMM nor in any Xorg release. - -XCOMM ********************************************************************** -XCOMM Files section. This allows default font and module paths to be set -XCOMM ********************************************************************** +# +# Copyright (c) 1994-1998 by The XFree86 Project, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining a +# copy of this software and associated documentation files (the "Software"), +# to deal in the Software without restriction, including without limitation +# the rights to use, copy, modify, merge, publish, distribute, sublicense, +# and/or sell copies of the Software, and to permit persons to whom the +# Software is furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +# THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +# OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +# SOFTWARE. +# +# Except as contained in this notice, the name of the XFree86 Project shall +# not be used in advertising or otherwise to promote the sale, use or other +# dealings in this Software without prior written authorization from the +# XFree86 Project. +# +# $XConsortium: XF86Conf.cpp /main/22 1996/10/23 11:43:51 kaleb $ + +# ********************************************************************** +# This is a sample configuration file only, intended to illustrate +# what a config file might look like. Refer to the xorg.conf(__filemansuffix__) +# man page for details about the format of this file. +# ********************************************************************** + +# The ordering of sections is not important in XFree86 4.0 and later, +# nor in any Xorg release. + +# ********************************************************************** +# Files section. This allows default font and module paths to be set +# ********************************************************************** Section "Files" -XCOMM Multiple FontPath entries are allowed (which are concatenated together), -XCOMM as well as specifying multiple comma-separated entries in one FontPath -XCOMM command (or a combination of both methods). -XCOMM The default path is shown here. +# Multiple FontPath entries are allowed (which are concatenated together), +# as well as specifying multiple comma-separated entries in one FontPath +# command (or a combination of both methods). +# The default path is shown here. -XCOMM FontPath DEFAULTFONTPATH +# FontPath DEFAULTFONTPATH -XCOMM ModulePath can be used to set a search path for the X server modules. -XCOMM The default path is shown here. +# ModulePath can be used to set a search path for the X server modules. +# The default path is shown here. -XCOMM ModulePath MODULEPATH +# ModulePath MODULEPATH EndSection -XCOMM ********************************************************************** -XCOMM Module section -- this is an optional section which is used to specify -XCOMM which run-time loadable modules to load when the X server starts up. -XCOMM ********************************************************************** +# ********************************************************************** +# Module section -- this is an optional section which is used to specify +# which run-time loadable modules to load when the X server starts up. +# ********************************************************************** Section "Module" -XCOMM This loads the DBE extension module. +# This loads the DBE extension module. Load "dbe" -XCOMM This loads the miscellaneous extensions module, and disables -XCOMM initialisation of the XFree86-DGA extension within that module. +# This loads the miscellaneous extensions module, and disables +# initialisation of the XFree86-DGA extension within that module. SubSection "extmod" Option "omit xfree86-dga" @@ -76,53 +76,53 @@ XCOMM initialisation of the XFree86-DGA extension within that module. EndSection -XCOMM ********************************************************************** -XCOMM Server flags section. This contains various server-wide Options. -XCOMM ********************************************************************** +# ********************************************************************** +# Server flags section. This contains various server-wide Options. +# ********************************************************************** Section "ServerFlags" -XCOMM Uncomment this to cause a core dump at the spot where a signal is -XCOMM received. This may leave the console in an unusable state, but may -XCOMM provide a better stack trace in the core dump to aid in debugging +# Uncomment this to cause a core dump at the spot where a signal is +# received. This may leave the console in an unusable state, but may +# provide a better stack trace in the core dump to aid in debugging -XCOMM Option "NoTrapSignals" +# Option "NoTrapSignals" -XCOMM Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence -XCOMM (where n is 1 through 12). This allows clients to receive these key -XCOMM events. +# Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence +# (where n is 1 through 12). This allows clients to receive these key +# events. -XCOMM Option "DontVTSwitch" +# Option "DontVTSwitch" -XCOMM Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence -XCOMM This allows clients to receive this key event. +# Uncomment this to disable the <Ctrl><Alt><BS> server abort sequence +# This allows clients to receive this key event. -XCOMM Option "DontZap" "false" +# Option "DontZap" "false" -XCOMM Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching -XCOMM sequences. This allows clients to receive these key events. +# Uncomment this to disable the <Ctrl><Alt><KP_+>/<KP_-> mode switching +# sequences. This allows clients to receive these key events. -XCOMM Option "DontZoom" +# Option "DontZoom" -XCOMM Uncomment this to disable tuning with the xvidtune client. With -XCOMM it the client can still run and fetch card and monitor attributes, -XCOMM but it will not be allowed to change them. If it tries it will -XCOMM receive a protocol error. +# Uncomment this to disable tuning with the xvidtune client. With +# it the client can still run and fetch card and monitor attributes, +# but it will not be allowed to change them. If it tries it will +# receive a protocol error. -XCOMM Option "DisableVidModeExtension" +# Option "DisableVidModeExtension" -XCOMM Uncomment this to enable the use of a non-local xvidtune client. +# Uncomment this to enable the use of a non-local xvidtune client. -XCOMM Option "AllowNonLocalXvidtune" +# Option "AllowNonLocalXvidtune" -XCOMM Set the basic blanking screen saver timeout. +# Set the basic blanking screen saver timeout. Option "BlankTime" "10" # 10 minutes -XCOMM Set the DPMS timeouts. These are set here because they are global -XCOMM rather than screen-specific. These settings alone don't enable DPMS. -XCOMM It is enabled per-screen (or per-monitor), and even then only when -XCOMM the driver supports it. +# Set the DPMS timeouts. These are set here because they are global +# rather than screen-specific. These settings alone don't enable DPMS. +# It is enabled per-screen (or per-monitor), and even then only when +# the driver supports it. Option "StandbyTime" "10" # 10 minutes Option "SuspendTime" "10" # 10 minutes @@ -130,115 +130,115 @@ XCOMM the driver supports it. EndSection -XCOMM ********************************************************************** -XCOMM Input devices -XCOMM ********************************************************************** +# ********************************************************************** +# Input devices +# ********************************************************************** -XCOMM ********************************************************************** -XCOMM Core keyboard's InputDevice section -XCOMM ********************************************************************** +# ********************************************************************** +# Core keyboard's InputDevice section +# ********************************************************************** Section "InputDevice" Identifier "Keyboard1" Driver "kbd" -XCOMM Set the keyboard auto repeat parameters. Not all platforms implement -XCOMM this. +# Set the keyboard auto repeat parameters. Not all platforms implement +# this. Option "AutoRepeat" "500 5" -XCOMM Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)). - -XCOMM Option "Xleds" "1 2 3" - -XCOMM To customise the XKB settings to suit your keyboard, modify the -XCOMM lines below (which are the defaults). For example, for a European -XCOMM keyboard, you will probably want to use one of: -XCOMM -XCOMM Option "XkbModel" "pc102" -XCOMM Option "XkbModel" "pc105" -XCOMM -XCOMM If you have a Microsoft Natural keyboard, you can use: -XCOMM -XCOMM Option "XkbModel" "microsoft" -XCOMM -XCOMM If you have a US "windows" keyboard you will want: -XCOMM -XCOMM Option "XkbModel" "pc104" -XCOMM -XCOMM Then to change the language, change the Layout setting. -XCOMM For example, a german layout can be obtained with: -XCOMM -XCOMM Option "XkbLayout" "de" -XCOMM -XCOMM or: -XCOMM -XCOMM Option "XkbLayout" "de" -XCOMM Option "XkbVariant" "nodeadkeys" -XCOMM -XCOMM If you'd like to switch the positions of your capslock and -XCOMM control keys, use: -XCOMM -XCOMM Option "XkbOptions" "ctrl:swapcaps" - - -XCOMM These are the default XKB settings for xorg -XCOMM -XCOMM Option "XkbRules" "xorg" -XCOMM Option "XkbModel" "pc105" -XCOMM Option "XkbLayout" "us" -XCOMM Option "XkbVariant" "" -XCOMM Option "XkbOptions" "" +# Specifiy which keyboard LEDs can be user-controlled (eg, with xset(1)). + +# Option "Xleds" "1 2 3" + +# To customise the XKB settings to suit your keyboard, modify the +# lines below (which are the defaults). For example, for a European +# keyboard, you will probably want to use one of: +# +# Option "XkbModel" "pc102" +# Option "XkbModel" "pc105" +# +# If you have a Microsoft Natural keyboard, you can use: +# +# Option "XkbModel" "microsoft" +# +# If you have a US "windows" keyboard you will want: +# +# Option "XkbModel" "pc104" +# +# Then to change the language, change the Layout setting. +# For example, a german layout can be obtained with: +# +# Option "XkbLayout" "de" +# +# or: +# +# Option "XkbLayout" "de" +# Option "XkbVariant" "nodeadkeys" +# +# If you'd like to switch the positions of your capslock and +# control keys, use: +# +# Option "XkbOptions" "ctrl:swapcaps" + + +# These are the default XKB settings for xorg +# +# Option "XkbRules" "xorg" +# Option "XkbModel" "pc105" +# Option "XkbLayout" "us" +# Option "XkbVariant" "" +# Option "XkbOptions" "" EndSection -XCOMM ********************************************************************** -XCOMM Core Pointer's InputDevice section -XCOMM ********************************************************************** +# ********************************************************************** +# Core Pointer's InputDevice section +# ********************************************************************** Section "InputDevice" -XCOMM Identifier and driver +# Identifier and driver Identifier "Mouse1" Driver "mouse" -XCOMM The mouse protocol and device. The device is normally set to /dev/mouse, -XCOMM which is usually a symbolic link to the real device. +# The mouse protocol and device. The device is normally set to /dev/mouse, +# which is usually a symbolic link to the real device. Option "Protocol" "Microsoft" Option "Device" "/dev/mouse" -XCOMM On platforms where PnP mouse detection is supported the following -XCOMM protocol setting can be used when using a newer PnP mouse: +# On platforms where PnP mouse detection is supported the following +# protocol setting can be used when using a newer PnP mouse: -XCOMM Option "Protocol" "Auto" +# Option "Protocol" "Auto" -XCOMM When using mouse connected to a PS/2 port (aka "MousePort"), set the -XCOMM the protocol as follows. On some platforms some other settings may -XCOMM be available. +# When using mouse connected to a PS/2 port (aka "MousePort"), set the +# the protocol as follows. On some platforms some other settings may +# be available. -XCOMM Option "Protocol" "PS/2" +# Option "Protocol" "PS/2" -XCOMM Baudrate and SampleRate are only for some older Logitech mice. In -XCOMM almost every case these lines should be omitted. +# Baudrate and SampleRate are only for some older Logitech mice. In +# almost every case these lines should be omitted. -XCOMM Option "BaudRate" "9600" -XCOMM Option "SampleRate" "150" +# Option "BaudRate" "9600" +# Option "SampleRate" "150" -XCOMM Emulate3Buttons is an option for 2-button mice -XCOMM Emulate3Timeout is the timeout in milliseconds (default is 50ms) +# Emulate3Buttons is an option for 2-button mice +# Emulate3Timeout is the timeout in milliseconds (default is 50ms) -XCOMM Option "Emulate3Buttons" -XCOMM Option "Emulate3Timeout" "50" +# Option "Emulate3Buttons" +# Option "Emulate3Timeout" "50" -XCOMM ChordMiddle is an option for some 3-button Logitech mice, or any -XCOMM 3-button mouse where the middle button generates left+right button -XCOMM events. +# ChordMiddle is an option for some 3-button Logitech mice, or any +# 3-button mouse where the middle button generates left+right button +# events. -XCOMM Option "ChordMiddle" +# Option "ChordMiddle" EndSection @@ -249,91 +249,91 @@ Section "InputDevice" Option "Device" "/dev/mouse2" EndSection -XCOMM Some examples of extended input devices - -XCOMM Section "InputDevice" -XCOMM Identifier "spaceball" -XCOMM Driver "magellan" -XCOMM Option "Device" "/dev/cua0" -XCOMM EndSection -XCOMM -XCOMM Section "InputDevice" -XCOMM Identifier "spaceball2" -XCOMM Driver "spaceorb" -XCOMM Option "Device" "/dev/cua0" -XCOMM EndSection -XCOMM -XCOMM Section "InputDevice" -XCOMM Identifier "touchscreen0" -XCOMM Driver "microtouch" -XCOMM Option "Device" "/dev/ttyS0" -XCOMM Option "MinX" "1412" -XCOMM Option "MaxX" "15184" -XCOMM Option "MinY" "15372" -XCOMM Option "MaxY" "1230" -XCOMM Option "ScreenNumber" "0" -XCOMM Option "ReportingMode" "Scaled" -XCOMM Option "ButtonNumber" "1" -XCOMM Option "SendCoreEvents" -XCOMM EndSection -XCOMM -XCOMM Section "InputDevice" -XCOMM Identifier "touchscreen1" -XCOMM Driver "elo2300" -XCOMM Option "Device" "/dev/ttyS0" -XCOMM Option "MinX" "231" -XCOMM Option "MaxX" "3868" -XCOMM Option "MinY" "3858" -XCOMM Option "MaxY" "272" -XCOMM Option "ScreenNumber" "0" -XCOMM Option "ReportingMode" "Scaled" -XCOMM Option "ButtonThreshold" "17" -XCOMM Option "ButtonNumber" "1" -XCOMM Option "SendCoreEvents" -XCOMM EndSection - -XCOMM ********************************************************************** -XCOMM Monitor section -XCOMM ********************************************************************** - -XCOMM Any number of monitor sections may be present +# Some examples of extended input devices + +# Section "InputDevice" +# Identifier "spaceball" +# Driver "magellan" +# Option "Device" "/dev/cua0" +# EndSection +# +# Section "InputDevice" +# Identifier "spaceball2" +# Driver "spaceorb" +# Option "Device" "/dev/cua0" +# EndSection +# +# Section "InputDevice" +# Identifier "touchscreen0" +# Driver "microtouch" +# Option "Device" "/dev/ttyS0" +# Option "MinX" "1412" +# Option "MaxX" "15184" +# Option "MinY" "15372" +# Option "MaxY" "1230" +# Option "ScreenNumber" "0" +# Option "ReportingMode" "Scaled" +# Option "ButtonNumber" "1" +# Option "SendCoreEvents" +# EndSection +# +# Section "InputDevice" +# Identifier "touchscreen1" +# Driver "elo2300" +# Option "Device" "/dev/ttyS0" +# Option "MinX" "231" +# Option "MaxX" "3868" +# Option "MinY" "3858" +# Option "MaxY" "272" +# Option "ScreenNumber" "0" +# Option "ReportingMode" "Scaled" +# Option "ButtonThreshold" "17" +# Option "ButtonNumber" "1" +# Option "SendCoreEvents" +# EndSection + +# ********************************************************************** +# Monitor section +# ********************************************************************** + +# Any number of monitor sections may be present Section "Monitor" -XCOMM The identifier line must be present. +# The identifier line must be present. Identifier "Generic Monitor" -XCOMM HorizSync is in kHz unless units are specified. -XCOMM HorizSync may be a comma separated list of discrete values, or a -XCOMM comma separated list of ranges of values. -XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S -XCOMM USER MANUAL FOR THE CORRECT NUMBERS. +# HorizSync is in kHz unless units are specified. +# HorizSync may be a comma separated list of discrete values, or a +# comma separated list of ranges of values. +# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S +# USER MANUAL FOR THE CORRECT NUMBERS. -XCOMM HorizSync 31.5 # typical for a single frequency fixed-sync monitor -XCOMM HorizSync 30-64 # multisync -XCOMM HorizSync 31.5, 35.2 # multiple fixed sync frequencies -XCOMM HorizSync 15-25, 30-50 # multiple ranges of sync frequencies +# HorizSync 31.5 # typical for a single frequency fixed-sync monitor +# HorizSync 30-64 # multisync +# HorizSync 31.5, 35.2 # multiple fixed sync frequencies +# HorizSync 15-25, 30-50 # multiple ranges of sync frequencies -XCOMM VertRefresh is in Hz unless units are specified. -XCOMM VertRefresh may be a comma separated list of discrete values, or a -XCOMM comma separated list of ranges of values. -XCOMM NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S -XCOMM USER MANUAL FOR THE CORRECT NUMBERS. +# VertRefresh is in Hz unless units are specified. +# VertRefresh may be a comma separated list of discrete values, or a +# comma separated list of ranges of values. +# NOTE: THE VALUES HERE ARE EXAMPLES ONLY. REFER TO YOUR MONITOR'S +# USER MANUAL FOR THE CORRECT NUMBERS. -XCOMM VertRefresh 60 # typical for a single frequency fixed-sync monitor +# VertRefresh 60 # typical for a single frequency fixed-sync monitor -XCOMM VertRefresh 50-100 # multisync -XCOMM VertRefresh 60, 65 # multiple fixed sync frequencies -XCOMM VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies +# VertRefresh 50-100 # multisync +# VertRefresh 60, 65 # multiple fixed sync frequencies +# VertRefresh 40-50, 80-100 # multiple ranges of sync frequencies -XCOMM Modes can be specified in two formats. A compact one-line format, or -XCOMM a multi-line format. +# Modes can be specified in two formats. A compact one-line format, or +# a multi-line format. -XCOMM A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz) -XCOMM These two are equivalent +# A generic VGA 640x480 mode (hsync = 31.5kHz, refresh = 60Hz) +# These two are equivalent -XCOMM ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525 +# ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525 Mode "640x480" DotClock 25.175 @@ -341,75 +341,75 @@ XCOMM ModeLine "640x480" 25.175 640 664 760 800 480 491 493 525 VTimings 480 491 493 525 EndMode -XCOMM These two are equivalent +# These two are equivalent -XCOMM ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace +# ModeLine "1024x768i" 45 1024 1048 1208 1264 768 776 784 817 Interlace -XCOMM Mode "1024x768i" -XCOMM DotClock 45 -XCOMM HTimings 1024 1048 1208 1264 -XCOMM VTimings 768 776 784 817 -XCOMM Flags "Interlace" -XCOMM EndMode +# Mode "1024x768i" +# DotClock 45 +# HTimings 1024 1048 1208 1264 +# VTimings 768 776 784 817 +# Flags "Interlace" +# EndMode -XCOMM If a monitor has DPMS support, that can be indicated here. This will -XCOMM enable DPMS when the monitor is used with drivers that support it. +# If a monitor has DPMS support, that can be indicated here. This will +# enable DPMS when the monitor is used with drivers that support it. -XCOMM Option "dpms" +# Option "dpms" -XCOMM If a monitor requires that the sync signals be superimposed on the -XCOMM green signal, the following option will enable this when used with -XCOMM drivers that support it. Only a relatively small range of hardware -XCOMM (and drivers) actually support this. +# If a monitor requires that the sync signals be superimposed on the +# green signal, the following option will enable this when used with +# drivers that support it. Only a relatively small range of hardware +# (and drivers) actually support this. -XCOMM Option "sync on green" +# Option "sync on green" EndSection -XCOMM ********************************************************************** -XCOMM Graphics device section -XCOMM ********************************************************************** +# ********************************************************************** +# Graphics device section +# ********************************************************************** -XCOMM Any number of graphics device sections may be present +# Any number of graphics device sections may be present Section "Device" -XCOMM The Identifier must be present. +# The Identifier must be present. Identifier "Generic VESA" -XCOMM The Driver line must be present. When using run-time loadable driver -XCOMM modules, this line instructs the server to load the specified driver -XCOMM module. Even when not using loadable driver modules, this line -XCOMM indicates which driver should interpret the information in this section. +# The Driver line must be present. When using run-time loadable driver +# modules, this line instructs the server to load the specified driver +# module. Even when not using loadable driver modules, this line +# indicates which driver should interpret the information in this section. Driver "vesa" -XCOMM The chipset line is optional in most cases. It can be used to override -XCOMM the driver's chipset detection, and should not normally be specified. +# The chipset line is optional in most cases. It can be used to override +# the driver's chipset detection, and should not normally be specified. -XCOMM Chipset "generic" +# Chipset "generic" -XCOMM Various other lines can be specified to override the driver's automatic -XCOMM detection code. In most cases they are not needed. +# Various other lines can be specified to override the driver's automatic +# detection code. In most cases they are not needed. -XCOMM VideoRam 256 -XCOMM Clocks 25.2 28.3 +# VideoRam 256 +# Clocks 25.2 28.3 -XCOMM The BusID line is used to specify which of possibly multiple devices -XCOMM this section is intended for. When this line isn't present, a device -XCOMM section can only match up with the primary video device. For PCI -XCOMM devices a line like the following could be used. This line should not -XCOMM normally be included unless there is more than one video device -XCOMM intalled. +# The BusID line is used to specify which of possibly multiple devices +# this section is intended for. When this line isn't present, a device +# section can only match up with the primary video device. For PCI +# devices a line like the following could be used. This line should not +# normally be included unless there is more than one video device +# intalled. -XCOMM BusID "PCI:0:10:0" +# BusID "PCI:0:10:0" -XCOMM Various option lines can be added here as required. Some options -XCOMM are more appropriate in Screen sections, Display subsections or even -XCOMM Monitor sections. +# Various option lines can be added here as required. Some options +# are more appropriate in Screen sections, Display subsections or even +# Monitor sections. -XCOMM Option "hw cursor" "off" +# Option "hw cursor" "off" EndSection @@ -433,24 +433,24 @@ Section "Device" EndSection -XCOMM ********************************************************************** -XCOMM Screen sections. -XCOMM ********************************************************************** +# ********************************************************************** +# Screen sections. +# ********************************************************************** -XCOMM Any number of screen sections may be present. Each describes -XCOMM the configuration of a single screen. A single specific screen section -XCOMM may be specified from the X server command line with the "-screen" -XCOMM option. +# Any number of screen sections may be present. Each describes +# the configuration of a single screen. A single specific screen section +# may be specified from the X server command line with the "-screen" +# option. Section "Screen" -XCOMM The Identifier, Device and Monitor lines must be present +# The Identifier, Device and Monitor lines must be present Identifier "Screen 1" Device "Generic VESA" Monitor "Generic Monitor" -XCOMM The favoured Depth and/or Bpp may be specified here +# The favoured Depth and/or Bpp may be specified here DefaultDepth 8 @@ -480,7 +480,7 @@ Section "Screen" Monitor "Generic Monitor" Option "no accel" DefaultDepth 16 -XCOMM DefaultDepth 24 +# DefaultDepth 24 SubSection "Display" Depth 8 @@ -514,38 +514,38 @@ Section "Screen" EndSection -XCOMM ********************************************************************** -XCOMM ServerLayout sections. -XCOMM ********************************************************************** +# ********************************************************************** +# ServerLayout sections. +# ********************************************************************** -XCOMM Any number of ServerLayout sections may be present. Each describes -XCOMM the way multiple screens are organised. A specific ServerLayout -XCOMM section may be specified from the X server command line with the -XCOMM "-layout" option. In the absence of this, the first section is used. -XCOMM When now ServerLayout section is present, the first Screen section -XCOMM is used alone. +# Any number of ServerLayout sections may be present. Each describes +# the way multiple screens are organised. A specific ServerLayout +# section may be specified from the X server command line with the +# "-layout" option. In the absence of this, the first section is used. +# When now ServerLayout section is present, the first Screen section +# is used alone. Section "ServerLayout" -XCOMM The Identifier line must be present +# The Identifier line must be present Identifier "Main Layout" -XCOMM Each Screen line specifies a Screen section name, and optionally -XCOMM the relative position of other screens. The four names after -XCOMM primary screen name are the screens to the top, bottom, left and right -XCOMM of the primary screen. In this example, screen 2 is located to the -XCOMM right of screen 1. +# Each Screen line specifies a Screen section name, and optionally +# the relative position of other screens. The four names after +# primary screen name are the screens to the top, bottom, left and right +# of the primary screen. In this example, screen 2 is located to the +# right of screen 1. Screen "Screen MGA 1" "" "" "" "Screen MGA 2" Screen "Screen MGA 2" "" "" "Screen MGA 1" "" -XCOMM Each InputDevice line specifies an InputDevice section name and -XCOMM optionally some options to specify the way the device is to be -XCOMM used. Those options include "CorePointer", "CoreKeyboard" and -XCOMM "SendCoreEvents". In this example, "Mouse1" is the core pointer, -XCOMM and "Mouse2" is an extended input device that also generates core -XCOMM pointer events (i.e., both mice will move the standard pointer). +# Each InputDevice line specifies an InputDevice section name and +# optionally some options to specify the way the device is to be +# used. Those options include "CorePointer", "CoreKeyboard" and +# "SendCoreEvents". In this example, "Mouse1" is the core pointer, +# and "Mouse2" is an extended input device that also generates core +# pointer events (i.e., both mice will move the standard pointer). InputDevice "Mouse1" "CorePointer" InputDevice "Mouse2" "SendCoreEvents" diff --git a/hw/xnest/.gitignore b/hw/xnest/.gitignore index 16db15e20..b76c5a2d0 100644 --- a/hw/xnest/.gitignore +++ b/hw/xnest/.gitignore @@ -1,3 +1 @@ -# Add & Override for this directory and it's subdirectories Xnest -Xnest.man diff --git a/hw/xnest/Makefile.am b/hw/xnest/Makefile.am index 666a0f0e6..c395b4dae 100644 --- a/hw/xnest/Makefile.am +++ b/hw/xnest/Makefile.am @@ -1,3 +1,5 @@ +SUBDIRS = man + bin_PROGRAMS = Xnest noinst_LIBRARIES = libfbcmap.a @@ -59,34 +61,12 @@ Xnest_LDADD = $(XNEST_LIBS) $(XNEST_SYS_LIBS) $(XSERVER_SYS_LIBS) Xnest_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) EXTRA_DIST = icon \ - screensaver \ - Xnest.man.pre + screensaver # -UDPMSExtension for miinitext? can't put into # OS_DEFINES??? # EXT_DEFINES??? # ICONFIGFILES -- SpecialCObjectRule -# Man page -include $(top_srcdir)/cpprules.in - -appmandir = $(APP_MAN_DIR) - -appman_PRE = Xnest.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -EXTRAMANDEFS = \ - -D__XCONFIGFILE__=$(__XCONFIGFILE__) \ - -D__XSERVERNAME__=$(XSERVERNAME) - -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(appman_PRE) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -$(AM_V_at)rm -f $@ - $(AM_V_at)$(LN_S) $< $@ - relink: $(AM_V_at)rm -f Xnest$(EXEEXT) && $(MAKE) Xnest$(EXEEXT) diff --git a/hw/xnest/man/Makefile.am b/hw/xnest/man/Makefile.am new file mode 100644 index 000000000..30b6370bc --- /dev/null +++ b/hw/xnest/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = Xnest.man diff --git a/hw/xnest/Xnest.man.pre b/hw/xnest/man/Xnest.man index 024d88e82..024d88e82 100644 --- a/hw/xnest/Xnest.man.pre +++ b/hw/xnest/man/Xnest.man diff --git a/hw/xquartz/Makefile.am b/hw/xquartz/Makefile.am index 96b1fb0c5..61b04e0e1 100644 --- a/hw/xquartz/Makefile.am +++ b/hw/xquartz/Makefile.am @@ -14,9 +14,9 @@ if GLX GL_DIR = GL endif -SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup doc +SUBDIRS = bundle . $(GL_DIR) xpr pbproxy mach-startup man -DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup doc +DIST_SUBDIRS = bundle . GL xpr pbproxy mach-startup man libXquartz_la_SOURCES = \ $(top_srcdir)/fb/fbcmap_mi.c \ diff --git a/hw/xquartz/bundle/cpprules.in b/hw/xquartz/bundle/cpprules.in index f32eafc06..92a987d92 100644 --- a/hw/xquartz/bundle/cpprules.in +++ b/hw/xquartz/bundle/cpprules.in @@ -13,25 +13,7 @@ CPP_SED_MAGIC = $(SED) -e '/^\# *[0-9][0-9]* *.*$$/d' \ -e '/XSLASHGLOB/s/XSLASHGLOB/\/\*/' \ -e '/\@\@$$/s/\@\@$$/\\/' -# Strings to replace in man pages -XORGRELSTRING = @PACKAGE_STRING@ - XORGMANNAME = X Version 11 - -MANDEFS = \ - -D__xorgversion__="\"$(XORGRELSTRING)\" \"$(XORGMANNAME)\"" \ - -D__appmansuffix__=$(APP_MAN_SUFFIX) \ - -D__filemansuffix__=$(FILE_MAN_SUFFIX) \ - -D__libmansuffix__=$(LIB_MAN_SUFFIX) \ - -D__miscmansuffix__=$(MISC_MAN_SUFFIX) \ - -D__XSERVERNAME__=Xorg -D__XCONFIGFILE__=xorg.conf \ - -D__xinitdir__=$(XINITDIR) \ - -D__bindir__=$(bindir) \ - -DSHELL_CMD=$(SHELL_CMD) $(ARCHMANDEFS) - -SUFFIXES = .$(APP_MAN_SUFFIX) .man .cpp +SUFFIXES = .cpp .cpp: - $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ - -.man.$(APP_MAN_SUFFIX): - $(RAWCPP) $(RAWCPPFLAGS) $(MANDEFS) $(EXTRAMANDEFS) < $< | $(CPP_SED_MAGIC) > $@ + $(AM_V_GEN)$(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < $< | $(CPP_SED_MAGIC) > $@ diff --git a/hw/xquartz/doc/Makefile.am b/hw/xquartz/doc/Makefile.am deleted file mode 100644 index 6c68c845e..000000000 --- a/hw/xquartz/doc/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -appmandir = $(APP_MAN_DIR) -appman_PRE = Xquartz.man.pre -appman_PROCESSED = $(appman_PRE:man.pre=man) -appman_DATA = $(appman_PRE:man.pre=@APP_MAN_SUFFIX@) - -CLEANFILES = $(appman_PROCESSED) $(appman_DATA) - -include $(top_srcdir)/cpprules.in - -MANDEFS += -D__laucnd_id_prefix__=$(LAUNCHD_ID_PREFIX) - -.man.$(APP_MAN_SUFFIX): - $(AM_V_at)cp $< $@ - -EXTRA_DIST = \ - Xquartz.man.pre diff --git a/hw/xquartz/man/Makefile.am b/hw/xquartz/man/Makefile.am new file mode 100644 index 000000000..5a0cde7cc --- /dev/null +++ b/hw/xquartz/man/Makefile.am @@ -0,0 +1,2 @@ +include $(top_srcdir)/manpages.am +appman_PRE = Xquartz.man diff --git a/hw/xquartz/doc/Xquartz.man.pre b/hw/xquartz/man/Xquartz.man index 447194740..447194740 100644 --- a/hw/xquartz/doc/Xquartz.man.pre +++ b/hw/xquartz/man/Xquartz.man diff --git a/hw/xwin/.gitignore b/hw/xwin/.gitignore index a8c3a286b..bc4986cb4 100644 --- a/hw/xwin/.gitignore +++ b/hw/xwin/.gitignore @@ -1,6 +1,3 @@ -# Add & Override for this directory and it's subdirectories winprefslex.c winprefsyacc.c winprefsyacc.h -XWin.man -XWinrc.man diff --git a/hw/xwin/InitOutput.c b/hw/xwin/InitOutput.c index 38a658d77..7faed0170 100644 --- a/hw/xwin/InitOutput.c +++ b/hw/xwin/InitOutput.c @@ -755,6 +755,9 @@ winUseMsg (void) "\t\t1 - Shadow GDI\n" "\t\t2 - Shadow DirectDraw\n" "\t\t4 - Shadow DirectDraw4 Non-Locking\n" +#ifdef XWIN_PRIMARYFB + "\t\t8 - Primary DirectDraw - obsolete\n" +#endif #ifdef XWIN_NATIVEGDI "\t\t16 - Native GDI - experimental\n" #endif @@ -823,6 +826,11 @@ winUseMsg (void) "\tSpecify an optional refresh rate to use in fullscreen mode\n" "\twith a DirectDraw engine.\n"); + ErrorF ("-resize=none|scrollbars|randr" + "\tIn windowed mode, [don't] allow resizing of the window. 'scrollbars'\n" + "\tmode gives the window scrollbars as needed, 'randr' mode uses the RANR\n" + "\textension to resize the X screen.\n"); + ErrorF ("-rootless\n" "\tRun the server in rootless mode.\n"); @@ -836,11 +844,6 @@ winUseMsg (void) "\t -screen 0 1024x768@3 ; 3rd monitor size 1024x768\n" "\t -screen 0 @1 ; on 1st monitor using its full resolution (the default)\n"); - ErrorF ("-scrollbars\n" - "\tIn windowed mode, allow screens bigger than the Windows desktop.\n" - "\tMoreover, if the window has decorations, one can now resize\n" - "\tit.\n"); - ErrorF ("-silent-dup-error\n" "\tIf another instance of " EXECUTABLE_NAME " with the same display number is running\n" "\texit silently and don't display any error message.\n"); diff --git a/hw/xwin/Makefile.am b/hw/xwin/Makefile.am index 232d65e86..ce2edb2e6 100644 --- a/hw/xwin/Makefile.am +++ b/hw/xwin/Makefile.am @@ -87,6 +87,7 @@ SRCS = InitInput.c \ winkeybd.c \ winkeyhook.c \ winmisc.c \ + winmonitors.c \ winmouse.c \ winmsg.c \ winmultiwindowclass.c \ @@ -156,7 +157,7 @@ winprefsyacc.h: winprefsyacc.c winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h BUILT_SOURCES = winprefsyacc.h winprefsyacc.c winprefslex.c -CLEANFILES = $(BUILT_SOURCES) $(appman_DATA) $(fileman_DATA) XWin.man XWinrc.man +CLEANFILES = $(BUILT_SOURCES) AM_YFLAGS = -d AM_LFLAGS = -i @@ -165,34 +166,13 @@ AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \ -I$(top_srcdir) \ -Wno-bad-function-cast -MAN_SRCS = XWin.man.pre XWinrc.man.pre - -appmandir = $(APP_MAN_DIR) -appman_DATA = XWin.$(APP_MAN_SUFFIX) - -filemandir = $(FILE_MAN_DIR) -fileman_DATA = XWinrc.$(FILE_MAN_SUFFIX) - -XWin.$(APP_MAN_SUFFIX): XWin.man - -$(AM_V_at)rm -f XWin.$(APP_MAN_SUFFIX) - $(AM_V_at)$(LN_S) XWin.man XWin.$(APP_MAN_SUFFIX) - -XWinrc.$(FILE_MAN_SUFFIX): XWinrc.man - -$(AM_V_at)rm -f XWinrc.$(FILE_MAN_SUFFIX) - $(AM_V_at)$(LN_S) XWinrc.man XWinrc.$(FILE_MAN_SUFFIX) - -EXTRAMANDEFS = -D__logdir__=$(logdir) -D__sysconfdir__=$(sysconfdir) -D__datadir__=$(datadir) - xwinconfigdir = $(sysconfdir)/X11 xwinconfig_DATA = system.XWinrc -include $(top_srcdir)/cpprules.in - install-exec-hook: (cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) XWin$(EXEEXT) X) EXTRA_DIST = \ - $(MAN_SRCS) \ $(xwinconfig_DATA) \ X.ico \ XWin.rc \ @@ -220,5 +200,5 @@ EXTRA_DIST = \ relink: $(AM_V_at)rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT) -SUBDIRS = $(GLX_DIR) . -DIST_SUBDIRS = glx . +SUBDIRS = man $(GLX_DIR) . +DIST_SUBDIRS = man glx . diff --git a/hw/xwin/man/Makefile.am b/hw/xwin/man/Makefile.am new file mode 100644 index 000000000..d19c2729f --- /dev/null +++ b/hw/xwin/man/Makefile.am @@ -0,0 +1,3 @@ +include $(top_srcdir)/manpages.am +appman_PRE = XWin.man +fileman_PRE = XWinrc.man diff --git a/hw/xwin/XWin.man.pre b/hw/xwin/man/XWin.man index 51268f69a..e7933c9c8 100644 --- a/hw/xwin/XWin.man.pre +++ b/hw/xwin/man/XWin.man @@ -103,7 +103,7 @@ Examples: .SH OPTIONS CONTROLLING THE APPEARANCE OF THE X SCREEN WINDOWS These parameters only apply to windowed mode screens i.e. not -in \fB-multwindow\fP or \fB-rootless\fP mode +in \fB-multiwindow\fP or \fB-rootless\fP mode. .TP 8 .B "\-fullscreen" The X server window takes the full screen, covering completely the @@ -115,10 +115,52 @@ etc. This parameter is ignored when the \fB\-fullscreen\fP parameter is specified. .TP 8 .B \-scrollbars -In windowed mode, allow screens bigger than the \fIWindows\fP desktop. -Moreover, if the window has decorations, one can now resize it. -This parameter is ignored when the \fB\-fullscreen\fP parameter is specified. +Alternative name for \fB\-resize=scrollbars\fP. + +.SH OPTIONS CONTROLLING RESIZE BEHAVIOUR +.TP 8 +.B \-resize[=none|scrollbars|randr] +Select the resize mode of an X screen. + +.RS +.IP \fB\-resize=none\fP 8 +(default). The screen is not resizable. + +In windowed mode, if the window has decorations, a fixed frame is used. + +.IP \fB\-resize=scrollbars\fP 8 +The screen window is resizeable, but the screen is not resizable. + +In windowed mode, if the window has decorations, a resizing frame is used. +Scrollbars are drawn when needed to allow the entire X screen +to viewed by adjusting them. + +This also permits screens bigger than the \fIWindows\fP virtual desktop to be used. + +This parameter is ignored in \fB-multiwindow\fP or \fB-rootless\fP mode. +Alternative name is \fB\-scrollbars\fP. + +.IP \fB\-resize=randr\fP 8 +The screen is resizable and the screen window is resizeable. +In windowed mode, if the window has decorations, a resizing frame is used. + +Resizing the \fIWindows\fP window will use the RANDR extension to change +the size of the X screen. Likewise, changing the size of +the X screen using the RANDR extension will cause the size +of the \fIWindows\fP window containing the X screen to be changed. + +In \fB-multiwindow\fP or \fB-rootless\fP mode, if the X screen is +of the same dimensions as a Windows monitor or the virtual desktop, +the X server will respond to the WM_DISPLAYCHANGED sent when those +dimensions change by resizing the X screen. Changing the size +of the X screen using the RANDR extension is not permitted. + +The maximum dimensions of the screen are the dimensions of the \fIWindows\fP virtual desktop. + +.IP \fB\--resize\fP 8 +on its own is equivalent to \fB\--resize=randr\fP +.RE .SH OPTIONS CONTROLLING WINDOWS INTEGRATION .TP 8 @@ -190,15 +232,27 @@ respectively). .TP 8 .B "\-engine \fIengine_type_id\fP" This option, which is intended for Cygwin/X developers, -overrides the server's automatically selected engine type. This -parameter will be ignored if the specified engine type is not -supported on the current system. The supported engine type ids are 1 -- Shadow GDI, 2 - Shadow DirectDraw, and 4 - Shadow DirectDraw Non-Locking. -Additionally, there are engines with type ids -8 - Primary DirectDraw (obsolete) and 16 - Native GDI (experimental and barely functional). -Default behavior is to determine the engine with optimum performance that +overrides the server's automatically selected drawing engine type. This +parameter will be ignored if the specified drawing engine type is not +supported on the current system. + +Default behavior is to select the drawing engine with optimum performance that supports the specified depth and window configuration. +The engine type ids are: +.RS +.IP 1 4 +Shadow GDI +.IP 2 4 +Shadow DirectDraw +.IP 4 4 +Shadow DirectDraw Non-Locking +.IP 8 4 +Primary DirectDraw (unsupported, obsolete) +.IP 16 4 +Native GDI (unsupported, experimental and barely functional) +.RE + .SH FULLSCREEN OPTIONS .TP 8 .B "\-depth \fIdepth\fP" @@ -322,12 +376,9 @@ X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), XWinrc(__filemansuffix__), s .SH BUGS .I XWin -and this man page still have many limitations. Some of the more obvious -ones are: -.br -- The display mode can not be changed once the X server has started. -.br -- The \fIXWin\fP software is continuously developing; it is therefore possible that +and this man page still have many limitations. + +The \fIXWin\fP software is continuously developing; it is therefore possible that this man page is not up to date. It is always prudent to look also at the output of \fIXWin -help\fP in order to check the options that are operative. diff --git a/hw/xwin/XWinrc.man.pre b/hw/xwin/man/XWinrc.man index 5c1fb979b..5c1fb979b 100644 --- a/hw/xwin/XWinrc.man.pre +++ b/hw/xwin/man/XWinrc.man diff --git a/hw/xwin/win.h b/hw/xwin/win.h index 44307813c..3f40fdbe0 100644 --- a/hw/xwin/win.h +++ b/hw/xwin/win.h @@ -74,9 +74,6 @@ #endif #define WIN_DEFAULT_USER_GAVE_HEIGHT_AND_WIDTH FALSE -#define WIN_DIB_MAXIMUM_SIZE 0x08000000 /* 16 MB on Windows 95, 98, Me */ -#define WIN_DIB_MAXIMUM_SIZE_MB (WIN_DIB_MAXIMUM_SIZE / 8 / 1024 / 1024) - /* * Windows only supports 256 color palettes */ @@ -276,8 +273,12 @@ static Atom func (void) { \ typedef Bool (*winAllocateFBProcPtr)(ScreenPtr); +typedef void (*winFreeFBProcPtr)(ScreenPtr); + typedef void (*winShadowUpdateProcPtr)(ScreenPtr, shadowBufPtr); +typedef Bool (*winInitScreenProcPtr)(ScreenPtr); + typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr); typedef Bool (*winInitVisualsProcPtr)(ScreenPtr); @@ -315,6 +316,12 @@ typedef Bool (*winFinishCreateWindowsWindowProcPtr)(WindowPtr pWin); typedef Bool (*winCreateScreenResourcesProc)(ScreenPtr); +#ifdef XWIN_NATIVEGDI +/* Typedefs for native GDI wrappers */ +typedef Bool (*RealizeFontPtr) (ScreenPtr pScreen, FontPtr pFont); +typedef Bool (*UnrealizeFontPtr)(ScreenPtr pScreen, FontPtr pFont); +#endif + /* * GC (graphics context) privates @@ -369,6 +376,15 @@ typedef struct { } winCursorRec; /* + * Resize modes + */ +typedef enum { + notAllowed, + resizeWithScrollbars, + resizeWithRandr +} winResizeMode; + +/* * Screen information structure that we need before privates are available * in the server startup sequence. */ @@ -381,12 +397,12 @@ typedef struct Bool fUserGaveHeightAndWidth; DWORD dwScreen; + + int iMonitor; DWORD dwUserWidth; DWORD dwUserHeight; DWORD dwWidth; DWORD dwHeight; - DWORD dwWidth_mm; - DWORD dwHeight_mm; DWORD dwPaddedWidth; /* Did the user specify a screen position? */ @@ -431,7 +447,7 @@ typedef struct #endif Bool fMultipleMonitors; Bool fLessPointer; - Bool fScrollbars; + winResizeMode iResizeMode; Bool fNoTrayIcon; int iE3BTimeout; /* Windows (Alt+F4) and Unix (Ctrl+Alt+Backspace) Killkey */ @@ -473,11 +489,6 @@ typedef struct _winPrivScreenRec /* Handle to icons that must be freed */ HICON hiconNotifyIcon; - /* Last width, height, and depth of the Windows display */ - DWORD dwLastWindowsWidth; - DWORD dwLastWindowsHeight; - DWORD dwLastWindowsBitsPixel; - /* Palette management */ ColormapPtr pcmapInstalled; @@ -493,7 +504,8 @@ typedef struct _winPrivScreenRec HDC hdcScreen; HDC hdcShadow; HWND hwndScreen; - + BITMAPINFOHEADER *pbmih; + /* Privates used by shadow fb and primary fb DirectDraw servers */ LPDIRECTDRAW pdd; LPDIRECTDRAWSURFACE2 pddsPrimary; @@ -543,7 +555,9 @@ typedef struct _winPrivScreenRec /* Engine specific functions */ winAllocateFBProcPtr pwinAllocateFB; + winFreeFBProcPtr pwinFreeFB; winShadowUpdateProcPtr pwinShadowUpdate; + winInitScreenProcPtr pwinInitScreen; winCloseScreenProcPtr pwinCloseScreen; winInitVisualsProcPtr pwinInitVisuals; winAdjustVideoModeProcPtr pwinAdjustVideoMode; @@ -588,6 +602,12 @@ typedef struct _winPrivScreenRec SetShapeProcPtr SetShape; winCursorRec cursor; + +#ifdef XWIN_NATIVEGDI + RealizeFontPtr RealizeFont; + UnrealizeFontPtr UnrealizeFont; +#endif + } winPrivScreenRec; @@ -1452,6 +1472,18 @@ void winInitializeScreens(int maxscreens); /* + * winrandr.c + */ +Bool +winRandRInit (ScreenPtr pScreen); +void +winDoRandRScreenSetSize (ScreenPtr pScreen, + CARD16 width, + CARD16 height, + CARD32 mmWidth, + CARD32 mmHeight); + +/* * END DDX and DIX Function Prototypes */ diff --git a/hw/xwin/wincreatewnd.c b/hw/xwin/wincreatewnd.c index 0c342e1ae..755373965 100644 --- a/hw/xwin/wincreatewnd.c +++ b/hw/xwin/wincreatewnd.c @@ -192,7 +192,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) fForceShowWindow = TRUE; } dwWindowStyle |= WS_CAPTION; - if (pScreenInfo->fScrollbars) + if (pScreenInfo->iResizeMode != notAllowed) dwWindowStyle |= WS_THICKFRAME | WS_MAXIMIZEBOX; } else @@ -233,6 +233,22 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) iPosY = rcWorkArea.top; } + /* Clean up the scrollbars flag, if necessary */ + if ((!pScreenInfo->fDecoration +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fMWExtWM +#endif + || pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif + ) + && (pScreenInfo->iResizeMode == resizeWithScrollbars)) + { + /* We cannot have scrollbars if we do not have a window border */ + pScreenInfo->iResizeMode = notAllowed; + } + /* Did the user specify a height and width? */ if (pScreenInfo->fUserGaveHeightAndWidth) { @@ -256,12 +272,12 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) #if CYGDEBUG winDebug ("winCreateBoundingWindowWindowed - Window has decoration\n"); #endif - /* Are we using scrollbars? */ - if (pScreenInfo->fScrollbars) + + /* Are we resizable */ + if (pScreenInfo->iResizeMode != notAllowed) { #if CYGDEBUG - winDebug ("winCreateBoundingWindowWindowed - Window has " - "scrollbars\n"); + winDebug ("winCreateBoundingWindowWindowed - Window is resizable\n"); #endif iWidth += 2 * GetSystemMetrics (SM_CXSIZEFRAME); @@ -271,8 +287,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) else { #if CYGDEBUG - winDebug ("winCreateBoundingWindowWindowed - Window does not have " - "scrollbars\n"); + winDebug ("winCreateBoundingWindowWindowed - Window is not resizable\n"); #endif iWidth += 2 * GetSystemMetrics (SM_CXFIXEDFRAME); @@ -296,22 +311,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) } } - /* Clean up the scrollbars flag, if necessary */ - if ((!pScreenInfo->fDecoration -#ifdef XWIN_MULTIWINDOWEXTWM - || pScreenInfo->fMWExtWM -#endif - || pScreenInfo->fRootless -#ifdef XWIN_MULTIWINDOW - || pScreenInfo->fMultiWindow -#endif - ) - && pScreenInfo->fScrollbars) - { - /* We cannot have scrollbars if we do not have a window border */ - pScreenInfo->fScrollbars = FALSE; - } - + /* Make sure window is no bigger than work area */ if (TRUE #ifdef XWIN_MULTIWINDOWEXTWM && !pScreenInfo->fMWExtWM @@ -396,7 +396,7 @@ winCreateBoundingWindowWindowed (ScreenPtr pScreen) rcClient.bottom, rcClient.top); /* We adjust the visual size if the user did not specify it */ - if (!(pScreenInfo->fScrollbars && pScreenInfo->fUserGaveHeightAndWidth)) + if (!((pScreenInfo->iResizeMode == resizeWithScrollbars) && pScreenInfo->fUserGaveHeightAndWidth)) { /* * User did not give a height and width with scrollbars enabled, diff --git a/hw/xwin/windialogs.c b/hw/xwin/windialogs.c index 679b3fab5..c3a149762 100644 --- a/hw/xwin/windialogs.c +++ b/hw/xwin/windialogs.c @@ -482,11 +482,11 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message, #if CYGDEBUG winDebug ("winChangeDepthDlgProc - WM_INITDIALOG - orig bpp: %d, " - "last bpp: %d\n", + "current bpp: %d\n", s_pScreenInfo->dwBPP, - s_pScreenPriv->dwLastWindowsBitsPixel); + GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)); #endif - + winInitDialog( hwndDialog ); return TRUE; @@ -494,14 +494,13 @@ winChangeDepthDlgProc (HWND hwndDialog, UINT message, case WM_DISPLAYCHANGE: #if CYGDEBUG winDebug ("winChangeDepthDlgProc - WM_DISPLAYCHANGE - orig bpp: %d, " - "last bpp: %d, new bpp: %d\n", + "new bpp: %d\n", s_pScreenInfo->dwBPP, - s_pScreenPriv->dwLastWindowsBitsPixel, - wParam); + GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL)); #endif /* Dismiss the dialog if the display returns to the original depth */ - if (wParam == s_pScreenInfo->dwBPP) + if (GetDeviceCaps(s_pScreenPriv->hdcScreen, BITSPIXEL) == s_pScreenInfo->dwBPP) { ErrorF ("winChangeDelthDlgProc - wParam == s_pScreenInfo->dwBPP\n"); diff --git a/hw/xwin/winmonitors.c b/hw/xwin/winmonitors.c new file mode 100644 index 000000000..63af803d0 --- /dev/null +++ b/hw/xwin/winmonitors.c @@ -0,0 +1,92 @@ +/* + +Copyright 1993, 1998 The Open Group +Copyright (C) Colin Harrison 2005-2008 + +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. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + + +#include "win.h" +#include "winmonitors.h" + +/* + * getMonitorInfo - callback function used to return information from the enumeration of monitors attached + */ + +static +wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) +{ + struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data; + // only get data for monitor number specified in <data> + data->monitorNum++; + if (data->monitorNum == data->requestedMonitor) + { + data->bMonitorSpecifiedExists = TRUE; + data->monitorOffsetX = rect->left; + data->monitorOffsetY = rect->top; + data->monitorHeight = rect->bottom - rect->top; + data->monitorWidth = rect->right - rect->left; + return FALSE; + } + return TRUE; +} + +typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); +ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; + +wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); + +Bool QueryMonitor(int index, struct GetMonitorInfoData *data) +{ + /* Load EnumDisplayMonitors from DLL */ + HMODULE user32; + FARPROC func; + user32 = LoadLibrary("user32.dll"); + if (user32 == NULL) + { + winW32Error(2, "Could not open user32.dll"); + return FALSE; + } + func = GetProcAddress(user32, "EnumDisplayMonitors"); + if (func == NULL) + { + winW32Error(2, "Could not resolve EnumDisplayMonitors: "); + return FALSE; + } + _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; + + /* prepare data */ + if (data == NULL) + return FALSE; + memset(data, 0, sizeof(*data)); + data->requestedMonitor = index; + + /* query information */ + _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); + + /* cleanup */ + FreeLibrary(user32); + return TRUE; +} diff --git a/hw/xwin/winmonitors.h b/hw/xwin/winmonitors.h new file mode 100644 index 000000000..180566b00 --- /dev/null +++ b/hw/xwin/winmonitors.h @@ -0,0 +1,14 @@ + +/* data returned for monitor information */ +struct GetMonitorInfoData { + int requestedMonitor; + int monitorNum; + Bool bUserSpecifiedMonitor; + Bool bMonitorSpecifiedExists; + int monitorOffsetX; + int monitorOffsetY; + int monitorHeight; + int monitorWidth; +}; + +Bool QueryMonitor(int index, struct GetMonitorInfoData *data); diff --git a/hw/xwin/winnativegdi.c b/hw/xwin/winnativegdi.c index b8d2d351b..4d7afe898 100644 --- a/hw/xwin/winnativegdi.c +++ b/hw/xwin/winnativegdi.c @@ -92,6 +92,18 @@ winAllocateFBNativeGDI (ScreenPtr pScreen) return TRUE; } +static void +winFreeFBNativeGDI (ScreenPtr pScreen) +{ + FatalError ("winFreeFBNativeGDI\n"); +} + + +static Bool +winInitScreenNativeGDI(ScreenPtr pScreen) +{ + FatalError ("winInitScreenNativeGDI\n"); +} /* * We wrap whatever CloseScreen procedure was specified by fb; @@ -289,28 +301,9 @@ winAdjustVideoModeNativeGDI (ScreenPtr pScreen) break; } - /* GDI cannot change the screen depth */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeNativeGDI - Using Windows display " - "depth of %d bits per pixel, %d depth\n", - (int) dwBPP, (int) pScreenInfo->dwDepth); + /* GDI cannot change the screen depth, so we'll use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Warn user if GDI depth is different than -depth parameter */ - ErrorF ("winAdjustVideoModeNativeGDI - Command line bpp: %d, "\ - "using bpp: %d\n", - (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - /* Release our DC */ ReleaseDC (NULL, hdc); @@ -506,7 +499,9 @@ winSetEngineFunctionsNativeGDI (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBNativeGDI; + pScreenPriv->pwinFreeFB = winFreeFBNativeGDI; pScreenPriv->pwinShadowUpdate = winShadowUpdateNativeGDI; + pScreenPriv->pwinInitScreen = winInitScreenNativeGDI; pScreenPriv->pwinCloseScreen = winCloseScreenNativeGDI; pScreenPriv->pwinInitVisuals = winInitVisualsNativeGDI; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeNativeGDI; diff --git a/hw/xwin/winpfbdd.c b/hw/xwin/winpfbdd.c index 7859c6b19..c0bca71e3 100644 --- a/hw/xwin/winpfbdd.c +++ b/hw/xwin/winpfbdd.c @@ -233,6 +233,45 @@ winAllocateFBPrimaryDD (ScreenPtr pScreen) return TRUE; } +static void +winFreeFBPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the offscreen surface, if there is one */ + if (pScreenPriv->pddsOffscreen) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen); + pScreenPriv->pddsOffscreen = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw2_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} + +static Bool +winInitScreenPrimaryDD(ScreenPtr pScreen) +{ + return winAllocateFBPrimaryDD(pScreen); +} /* * Call the wrapped CloseScreen function. @@ -260,29 +299,7 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - /* Free the offscreen surface, if there is one */ - if (pScreenPriv->pddsOffscreen) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsOffscreen, NULL); - IDirectDrawSurface2_Release (pScreenPriv->pddsOffscreen); - pScreenPriv->pddsOffscreen = NULL; - } - - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsPrimary, NULL); - IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); - pScreenPriv->pddsPrimary = NULL; - } - - /* Free the DirectDraw object, if there is one */ - if (pScreenPriv->pdd) - { - IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd); - IDirectDraw2_Release (pScreenPriv->pdd); - pScreenPriv->pdd = NULL; - } + winFreeFBPrimaryDD(pScreen); /* Delete tray icon, if we have one */ if (!pScreenInfo->fNoTrayIcon) @@ -305,9 +322,6 @@ winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - /* Free the screen privates for this screen */ free ((pointer) pScreenPriv); @@ -422,33 +436,13 @@ winAdjustVideoModePrimaryDD (ScreenPtr pScreen) dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) + if (!(pScreenInfo->fFullScreen && + (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModePrimaryDD - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ + /* Otherwise, We'll use GDI's depth */ pScreenInfo->dwBPP = dwBPP; } - else if (pScreenInfo->fFullScreen - && pScreenInfo->dwBPP != dwBPP) - { - /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModePrimaryDD - FullScreen, using command " - "line depth: %d\n", (int) pScreenInfo->dwBPP); - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModePrimaryDD - Windowed, command line " - "depth: %d, using depth: %d\n", - (int) pScreenInfo->dwBPP, (int) dwBPP); - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - /* Release our DC */ ReleaseDC (NULL, hdc); @@ -653,8 +647,9 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; - pScreenPriv->pwinShadowUpdate - = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinFreeFB = winFreeFBPrimaryDD; + pScreenPriv->pwinShadowUpdate = (winShadowUpdateProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinInitScreen = winInitScreenPrimaryDD; pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; @@ -663,10 +658,17 @@ winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) else pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; - pScreenPriv->pwinBltExposedRegions - = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinBltExposedRegions = (winBltExposedRegionsProcPtr) (void (*)(void))NoopDDA; pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD; + pScreenPriv->pwinRedrawScreen = NULL; + pScreenPriv->pwinRealizeInstalledPalette = NULL; + pScreenPriv->pwinInstallColormap = NULL; + pScreenPriv->pwinStoreColors = NULL; + pScreenPriv->pwinCreateColormap = NULL; + pScreenPriv->pwinDestroyColormap = NULL; pScreenPriv->pwinHotKeyAltTab = winHotKeyAltTabPrimaryDD; + pScreenPriv->pwinCreatePrimarySurface = (winCreatePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; + pScreenPriv->pwinReleasePrimarySurface = (winReleasePrimarySurfaceProcPtr) (void (*)(void))NoopDDA; #ifdef XWIN_MULTIWINDOW pScreenPriv->pwinFinishCreateWindowsWindow = (winFinishCreateWindowsWindowProcPtr) (void (*)(void))NoopDDA; diff --git a/hw/xwin/winprocarg.c b/hw/xwin/winprocarg.c index 1ce5c2dca..ddfe1f5b7 100644 --- a/hw/xwin/winprocarg.c +++ b/hw/xwin/winprocarg.c @@ -35,6 +35,7 @@ from The Open Group. #include "win.h" #include "winconfig.h" #include "winmsg.h" +#include "winmonitors.h" /* * References to external symbols @@ -44,55 +45,6 @@ from The Open Group. extern Bool g_fUnicodeClipboard; extern Bool g_fClipboard; #endif -/* globals required by callback function for monitor information */ -struct GetMonitorInfoData { - int requestedMonitor; - int monitorNum; - Bool bUserSpecifiedMonitor; - Bool bMonitorSpecifiedExists; - int monitorOffsetX; - int monitorOffsetY; - int monitorHeight; - int monitorWidth; -}; - -typedef wBOOL (*ENUMDISPLAYMONITORSPROC)(HDC,LPCRECT,MONITORENUMPROC,LPARAM); -ENUMDISPLAYMONITORSPROC _EnumDisplayMonitors; - -wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data); - -static Bool QueryMonitor(int index, struct GetMonitorInfoData *data) -{ - /* Load EnumDisplayMonitors from DLL */ - HMODULE user32; - FARPROC func; - user32 = LoadLibrary("user32.dll"); - if (user32 == NULL) - { - winW32Error(2, "Could not open user32.dll"); - return FALSE; - } - func = GetProcAddress(user32, "EnumDisplayMonitors"); - if (func == NULL) - { - winW32Error(2, "Could not resolve EnumDisplayMonitors: "); - return FALSE; - } - _EnumDisplayMonitors = (ENUMDISPLAYMONITORSPROC)func; - - /* prepare data */ - if (data == NULL) - return FALSE; - memset(data, 0, sizeof(*data)); - data->requestedMonitor = index; - - /* query information */ - _EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); - - /* cleanup */ - FreeLibrary(user32); - return TRUE; -} /* * Function prototypes @@ -143,6 +95,7 @@ winInitializeScreenDefaults(void) if (monitorResolution == 0) monitorResolution = WIN_DEFAULT_DPI; + defaultScreenInfo.iMonitor = 1; defaultScreenInfo.dwWidth = dwWidth; defaultScreenInfo.dwHeight = dwHeight; defaultScreenInfo.dwUserWidth = dwWidth; @@ -171,11 +124,9 @@ winInitializeScreenDefaults(void) #endif defaultScreenInfo.fMultipleMonitors = FALSE; defaultScreenInfo.fLessPointer = FALSE; - defaultScreenInfo.fScrollbars = FALSE; + defaultScreenInfo.iResizeMode = notAllowed; defaultScreenInfo.fNoTrayIcon = FALSE; defaultScreenInfo.iE3BTimeout = WIN_E3B_OFF; - defaultScreenInfo.dwWidth_mm = (dwWidth / WIN_DEFAULT_DPI) * 25.4; - defaultScreenInfo.dwHeight_mm = (dwHeight / WIN_DEFAULT_DPI) * 25.4; defaultScreenInfo.fUseWinKillKey = WIN_DEFAULT_WIN_KILL; defaultScreenInfo.fUseUnixKillKey = WIN_DEFAULT_UNIX_KILL; defaultScreenInfo.fIgnoreInput = FALSE; @@ -368,6 +319,7 @@ ddxProcessArgument (int argc, char *argv[], int i) iArgsProcessed = 3; g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].iMonitor = iMonitor; g_ScreenInfo[nScreenNum].dwWidth = data.monitorWidth; g_ScreenInfo[nScreenNum].dwHeight = data.monitorHeight; g_ScreenInfo[nScreenNum].dwUserWidth = data.monitorWidth; @@ -420,6 +372,7 @@ ddxProcessArgument (int argc, char *argv[], int i) "Querying monitors is not supported on NT4 and Win95\n"); } else if (data.bMonitorSpecifiedExists == TRUE) { + g_ScreenInfo[nScreenNum].iMonitor = iMonitor; g_ScreenInfo[nScreenNum].dwInitialX += data.monitorOffsetX; g_ScreenInfo[nScreenNum].dwInitialY += data.monitorOffsetY; } @@ -449,6 +402,7 @@ ddxProcessArgument (int argc, char *argv[], int i) { winErrorFVerb (2, "ddxProcessArgument - screen - Found Valid ``@Monitor'' = %d arg\n", iMonitor); g_ScreenInfo[nScreenNum].fUserGavePosition = TRUE; + g_ScreenInfo[nScreenNum].iMonitor = iMonitor; g_ScreenInfo[nScreenNum].dwInitialX = data.monitorOffsetX; g_ScreenInfo[nScreenNum].dwInitialY = data.monitorOffsetY; } @@ -500,17 +454,6 @@ ddxProcessArgument (int argc, char *argv[], int i) g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth = FALSE; } - /* Calculate the screen width and height in millimeters */ - if (g_ScreenInfo[nScreenNum].fUserGaveHeightAndWidth) - { - g_ScreenInfo[nScreenNum].dwWidth_mm - = (g_ScreenInfo[nScreenNum].dwWidth - / monitorResolution) * 25.4; - g_ScreenInfo[nScreenNum].dwHeight_mm - = (g_ScreenInfo[nScreenNum].dwHeight - / monitorResolution) * 25.4; - } - /* Flag that this screen was explicity specified by the user */ g_ScreenInfo[nScreenNum].fExplicitScreen = TRUE; @@ -717,12 +660,51 @@ ddxProcessArgument (int argc, char *argv[], int i) */ if (IS_OPTION ("-scrollbars")) { - screenInfoPtr->fScrollbars = TRUE; + + screenInfoPtr->iResizeMode = resizeWithScrollbars; /* Indicate that we have processed this argument */ return 1; } + /* + * Look for the '-resize' argument + */ + if (IS_OPTION ("-resize") || IS_OPTION ("-noresize") || + (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0)) + { + winResizeMode mode; + + if (IS_OPTION ("-resize")) + mode = resizeWithRandr; + else if (IS_OPTION ("-noresize")) + mode = notAllowed; + else if (strncmp(argv[i], "-resize=",strlen("-resize=")) == 0) + { + char *option = argv[i] + strlen("-resize="); + if (strcmp(option, "randr") == 0) + mode = resizeWithRandr; + else if (strcmp(option, "scrollbars") == 0) + mode = resizeWithScrollbars; + else if (strcmp(option, "none") == 0) + mode = notAllowed; + else + { + ErrorF ("ddxProcessArgument - resize - Invalid resize mode %s\n", option); + return 0; + } + } + else + { + ErrorF ("ddxProcessArgument - resize - Invalid resize option %s\n", argv[i]); + return 0; + } + + screenInfoPtr->iResizeMode = mode; + + /* Indicate that we have processed this argument */ + return 1; + } #ifdef XWIN_CLIPBOARD /* @@ -1233,24 +1215,3 @@ winLogVersionInfo (void) ErrorF ("%s\n\n", BUILDERSTRING); ErrorF ("Contact: %s\n", BUILDERADDR); } - -/* - * getMonitorInfo - callback function used to return information from the enumeration of monitors attached - */ - -wBOOL CALLBACK getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) -{ - struct GetMonitorInfoData* data = (struct GetMonitorInfoData*)_data; - // only get data for monitor number specified in <data> - data->monitorNum++; - if (data->monitorNum == data->requestedMonitor) - { - data->bMonitorSpecifiedExists = TRUE; - data->monitorOffsetX = rect->left; - data->monitorOffsetY = rect->top; - data->monitorHeight = rect->bottom - rect->top; - data->monitorWidth = rect->right - rect->left; - return FALSE; - } - return TRUE; -} diff --git a/hw/xwin/winrandr.c b/hw/xwin/winrandr.c index 7b5b1359c..248404800 100644 --- a/hw/xwin/winrandr.c +++ b/hw/xwin/winrandr.c @@ -1,8 +1,9 @@ /* *Copyright (C) 2001-2004 Harold L Hunt II All Rights Reserved. + *Copyright (C) 2009-2010 Jon TURNEY * *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the + *a copy of this software and associated documentation files (the *"Software"), to deal in the Software without restriction, including *without limitation the rights to use, copy, modify, merge, publish, *distribute, sublicense, and/or sell copies of the Software, and to @@ -20,101 +21,280 @@ *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * - *Except as contained in this notice, the name of Harold L Hunt II + *Except as contained in this notice, the name of the author(s) *shall not be used in advertising or otherwise to promote the sale, use *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. + *from the author(s) * * Authors: Harold L Hunt II + * Jon TURNEY */ #ifdef HAVE_XWIN_CONFIG_H #include <xwin-config.h> #endif #include "win.h" +#include "mivalidate.h" // for union _Validate used by windowstr.h + +#ifndef RANDR_12_INTERFACE +#error X server must have RandR 1.2 interface +#endif /* - * Local prototypes + * Answer queries about the RandR features supported. */ static Bool -winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations); +winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations) +{ + winDebug ("winRandRGetInfo ()\n"); -static Bool -winRandRSetConfig (ScreenPtr pScreen, - Rotation rotateKind, - int rate, - RRScreenSizePtr pSize); + /* Don't support rotations */ + *pRotations = RR_Rotate_0; -Bool -winRandRInit (ScreenPtr pScreen); + /* + The screen doesn't have to be limited to the actual + monitor size (we can have scrollbars :-), so what is + the upper limit? + */ + RRScreenSetSizeRange(pScreen, 0, 0, 4096, 4096); + + return TRUE; +} /* - * Answer queries about the RandR features supported. + Copied from the xfree86 DDX + + Why can't this be in DIX? + Does union _Validate vary depending on DDX?? */ +static void +xf86SetRootClip (ScreenPtr pScreen, Bool enable) +{ + WindowPtr pWin = pScreen->root; + WindowPtr pChild; + Bool WasViewable = (Bool)(pWin->viewable); + Bool anyMarked = FALSE; + WindowPtr pLayerWin; + BoxRec box; -static Bool -winRandRGetInfo (ScreenPtr pScreen, Rotation *pRotations) + if (WasViewable) + { + for (pChild = pWin->firstChild; pChild; pChild = pChild->nextSib) + { + (void) (*pScreen->MarkOverlappedWindows)(pChild, + pChild, + &pLayerWin); + } + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + if (pWin->valdata) + { + if (HasBorder (pWin)) + { + RegionPtr borderVisible; + + borderVisible = REGION_CREATE(pScreen, NullBox, 1); + REGION_SUBTRACT(pScreen, borderVisible, + &pWin->borderClip, &pWin->winSize); + pWin->valdata->before.borderVisible = borderVisible; + } + pWin->valdata->before.resized = TRUE; + } + } + + /* + * Use REGION_BREAK to avoid optimizations in ValidateTree + * that assume the root borderClip can't change well, normally + * it doesn't...) + */ + if (enable) + { + box.x1 = 0; + box.y1 = 0; + box.x2 = pScreen->width; + box.y2 = pScreen->height; + REGION_INIT (pScreen, &pWin->winSize, &box, 1); + REGION_INIT (pScreen, &pWin->borderSize, &box, 1); + if (WasViewable) + REGION_RESET(pScreen, &pWin->borderClip, &box); + pWin->drawable.width = pScreen->width; + pWin->drawable.height = pScreen->height; + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + else + { + REGION_EMPTY(pScreen, &pWin->borderClip); + REGION_BREAK (pWin->drawable.pScreen, &pWin->clipList); + } + + ResizeChildrenWinSize (pWin, 0, 0, 0, 0); + + if (WasViewable) + { + if (pWin->firstChild) + { + anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin->firstChild, + pWin->firstChild, + (WindowPtr *)NULL); + } + else + { + (*pScreen->MarkWindow) (pWin); + anyMarked = TRUE; + } + + + if (anyMarked) + (*pScreen->ValidateTree)(pWin, NullWindow, VTOther); + } + + if (WasViewable) + { + if (anyMarked) + (*pScreen->HandleExposures)(pWin); + if (anyMarked && pScreen->PostValidateTree) + (*pScreen->PostValidateTree)(pWin, NullWindow, VTOther); + } + if (pWin->realized) + WindowsRestructured (); + FlushAllOutput (); +} + +/* + +*/ +void +winDoRandRScreenSetSize (ScreenPtr pScreen, + CARD16 width, + CARD16 height, + CARD32 mmWidth, + CARD32 mmHeight) { winScreenPriv(pScreen); - winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - int n; - Rotation rotateKind; - RRScreenSizePtr pSize; + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + WindowPtr pRoot = pScreen->root; - winDebug ("winRandRGetInfo ()\n"); + // Prevent screen updates while we change things around + xf86SetRootClip(pScreen, FALSE); - /* Don't support rotations, yet */ - *pRotations = RR_Rotate_0; + /* Update the screen size as requested */ + pScreenInfo->dwWidth = width; + pScreenInfo->dwHeight = height; - /* 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; + /* Reallocate the framebuffer used by the drawing engine */ + (*pScreenPriv->pwinFreeFB)(pScreen); + if (!(*pScreenPriv->pwinAllocateFB)(pScreen)) + { + ErrorF ("winDoRandRScreenSetSize - Could not reallocate framebuffer\n"); + } - /* Only one allowed rotation for now */ - rotateKind = RR_Rotate_0; + pScreen->width = width; + pScreen->height = height; + pScreen->mmWidth = mmWidth; + pScreen->mmHeight = mmHeight; - /* - * Register supported sizes. This can be called many times, but - * we only support one size for now. - */ - pSize = RRRegisterSize (pScreen, - pScreenInfo->dwWidth, - pScreenInfo->dwHeight, - pScreenInfo->dwWidth_mm, - pScreenInfo->dwHeight_mm); - - /* Tell RandR what the current config is */ - RRSetCurrentConfig (pScreen, - rotateKind, - 0, /* refresh rate, not needed */ - pSize); - - return TRUE; -} + /* Update the screen pixmap to point to the new framebuffer */ + winUpdateFBPointer(pScreen, pScreenInfo->pfb); + + // pScreen->devPrivate == pScreen->GetScreenPixmap(screen) ? + // resize the root window + //pScreen->ResizeWindow(pRoot, 0, 0, width, height, NULL); + // does this emit a ConfigureNotify?? + // Restore the ability to update screen, now with new dimensions + xf86SetRootClip(pScreen, TRUE); + + // and arrange for it to be repainted + miPaintWindow(pRoot, &pRoot->borderClip, PW_BACKGROUND); + + /* Indicate that a screen size change took place */ + RRScreenSizeNotify(pScreen); +} /* - * Respond to resize/rotate request from either X Server or X client app + * Respond to resize request */ - -static Bool -winRandRSetConfig (ScreenPtr pScreen, - Rotation rotateKind, - int rate, - RRScreenSizePtr pSize) +static +Bool +winRandRScreenSetSize (ScreenPtr pScreen, + CARD16 width, + CARD16 height, + CARD16 pixWidth, + CARD16 pixHeight, + CARD32 mmWidth, + CARD32 mmHeight) { - winDebug ("winRandRSetConfig ()\n"); + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + winDebug ("winRandRScreenSetSize ()\n"); + + /* + It doesn't currently make sense to allow resize in fullscreen mode + (we'd actually have to list the supported resolutions) + */ + if (pScreenInfo->fFullScreen) + { + ErrorF ("winRandRScreenSetSize - resize not supported in fullscreen mode\n"); + return FALSE; + } + + /* + Client resize requests aren't allowed in rootless modes, even if + the X screen is monitor or virtual desktop size, we'd need to + resize the native display size + */ + if (FALSE +#ifdef XWIN_MULTIWINDOWEXTWM + || pScreenInfo->fMWExtWM +#endif + || pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || pScreenInfo->fMultiWindow +#endif + ) + { + ErrorF ("winRandRScreenSetSize - resize not supported in rootless modes\n"); + return FALSE; + } + + winDoRandRScreenSetSize(pScreen, width, height, mmWidth, mmHeight); + + /* Cause the native window for the screen to resize itself */ + { + DWORD dwStyle, dwExStyle; + RECT rcClient; + + rcClient.left = 0; + rcClient.top = 0; + rcClient.right = width; + rcClient.bottom = height; + + ErrorF ("winRandRScreenSetSize new client area w: %d h: %d\n", width, height); + + /* Get the Windows window style and extended style */ + dwExStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_EXSTYLE); + dwStyle = GetWindowLongPtr(pScreenPriv->hwndScreen, GWL_STYLE); + + /* + * Calculate the window size needed for the given client area + * adjusting for any decorations it will have + */ + AdjustWindowRectEx(&rcClient, dwStyle, FALSE, dwExStyle); + + ErrorF ("winRandRScreenSetSize new window area w: %ld h: %ld\n", rcClient.right-rcClient.left, rcClient.bottom-rcClient.top); + + SetWindowPos(pScreenPriv->hwndScreen, NULL, + 0, 0, rcClient.right-rcClient.left, rcClient.bottom-rcClient.top, + SWP_NOZORDER | SWP_NOMOVE); + } return TRUE; } - /* * Initialize the RandR layer. */ @@ -122,8 +302,7 @@ winRandRSetConfig (ScreenPtr pScreen, Bool winRandRInit (ScreenPtr pScreen) { - rrScrPrivPtr pRRScrPriv; - + rrScrPrivPtr pRRScrPriv; winDebug ("winRandRInit ()\n"); if (!RRScreenInit (pScreen)) @@ -135,7 +314,10 @@ winRandRInit (ScreenPtr pScreen) /* Set some RandR function pointers */ pRRScrPriv = rrGetScrPriv (pScreen); pRRScrPriv->rrGetInfo = winRandRGetInfo; - pRRScrPriv->rrSetConfig = winRandRSetConfig; + pRRScrPriv->rrSetConfig = NULL; + pRRScrPriv->rrScreenSetSize = winRandRScreenSetSize; + pRRScrPriv->rrCrtcSet = NULL; + pRRScrPriv->rrCrtcSetGamma = NULL; return TRUE; } diff --git a/hw/xwin/winscrinit.c b/hw/xwin/winscrinit.c index 21036f46c..691237e6f 100644 --- a/hw/xwin/winscrinit.c +++ b/hw/xwin/winscrinit.c @@ -69,10 +69,6 @@ winMWExtWMProcs = { * Prototypes */ -Bool -winRandRInit (ScreenPtr pScreen); - - /* * Local functions */ @@ -95,6 +91,7 @@ winScreenInit (int index, winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; winPrivScreenPtr pScreenPriv; HDC hdc; + DWORD dwInitialBPP; #if CYGDEBUG || YES winDebug ("winScreenInit - dwWidth: %ld dwHeight: %ld\n", @@ -130,13 +127,30 @@ winScreenInit (int index, return FALSE; } - /* Adjust the video mode for our engine type */ + /* Horribly misnamed function: Allow engine to adjust BPP for screen */ + dwInitialBPP = pScreenInfo->dwBPP; + if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) { ErrorF ("winScreenInit - winAdjustVideoMode () failed\n"); return FALSE; } + if (dwInitialBPP == WIN_DEFAULT_BPP) + { + /* No -depth parameter was passed, let the user know the depth being used */ + ErrorF ("winScreenInit - Using Windows display depth of %d bits per pixel\n", (int) pScreenInfo->dwBPP); + } + else if (dwInitialBPP != pScreenInfo->dwBPP) + { + /* Warn user if engine forced a depth different to -depth parameter */ + ErrorF ("winScreenInit - Command line depth of %d bpp overidden by engine, using %d bpp\n", (int) dwInitialBPP, (int) pScreenInfo->dwBPP); + } + else + { + ErrorF ("winScreenInit - Using command line depth of %d bpp\n", (int) pScreenInfo->dwBPP); + } + /* Check for supported display depth */ if (!(WIN_SUPPORTED_BPPS & (1 << (pScreenInfo->dwBPP - 1)))) { @@ -155,13 +169,20 @@ winScreenInit (int index, * Check that all monitors have the same display depth if we are using * multiple monitors */ - if (pScreenInfo->fMultipleMonitors + if (pScreenInfo->fMultipleMonitors && !GetSystemMetrics (SM_SAMEDISPLAYFORMAT)) { ErrorF ("winScreenInit - Monitors do not all have same pixel format / " - "display depth.\n" - "Using primary display only.\n"); - pScreenInfo->fMultipleMonitors = FALSE; + "display depth.\n"); + if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI) + { + ErrorF ("winScreenInit - Performance may suffer off primary display.\n"); + } + else + { + ErrorF ("winScreenInit - Using primary display only.\n"); + pScreenInfo->fMultipleMonitors = FALSE; + } } /* Create display window */ @@ -175,13 +196,9 @@ winScreenInit (int index, /* Get a device context */ hdc = GetDC (pScreenPriv->hwndScreen); - /* Store the initial height, width, and depth of the display */ /* Are we using multiple monitors? */ if (pScreenInfo->fMultipleMonitors) { - pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); - pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); - /* * In this case, some of the defaults set in * winInitializeScreenDefaults() are not correct ... @@ -190,30 +207,14 @@ winScreenInit (int index, { pScreenInfo->dwWidth = GetSystemMetrics (SM_CXVIRTUALSCREEN); pScreenInfo->dwHeight = GetSystemMetrics (SM_CYVIRTUALSCREEN); - pScreenInfo->dwWidth_mm = (pScreenInfo->dwWidth / - WIN_DEFAULT_DPI) * 25.4; - pScreenInfo->dwHeight_mm = (pScreenInfo->dwHeight / - WIN_DEFAULT_DPI) * 25.4; } } - else - { - pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); - pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); - } - - /* Save the original bits per pixel */ - pScreenPriv->dwLastWindowsBitsPixel = GetDeviceCaps (hdc, BITSPIXEL); /* Release the device context */ ReleaseDC (pScreenPriv->hwndScreen, hdc); /* Clear the visuals list */ miClearVisualTypes (); - - /* Set the padded screen width */ - pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, - pScreenInfo->dwBPP); /* Call the engine dependent screen initialization procedure */ if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) @@ -279,14 +280,15 @@ winFinishScreenInitFB (int index, #endif /* Create framebuffer */ - if (!(*pScreenPriv->pwinAllocateFB) (pScreen)) + if (!(*pScreenPriv->pwinInitScreen) (pScreen)) { ErrorF ("winFinishScreenInitFB - Could not allocate framebuffer\n"); return FALSE; } /* - * Grab the number of bits that are used to represent color in each pixel. + * Calculate the number of bits that are used to represent color in each pixel, + * the color depth for the screen */ if (pScreenInfo->dwBPP == 8) pScreenInfo->dwDepth = 8; @@ -294,7 +296,7 @@ winFinishScreenInitFB (int index, pScreenInfo->dwDepth = winCountBits (pScreenPriv->dwRedMask) + winCountBits (pScreenPriv->dwGreenMask) + winCountBits (pScreenPriv->dwBlueMask); - + winErrorFVerb (2, "winFinishScreenInitFB - Masks: %08x %08x %08x\n", (unsigned int) pScreenPriv->dwRedMask, (unsigned int) pScreenPriv->dwGreenMask, diff --git a/hw/xwin/winshaddd.c b/hw/xwin/winshaddd.c index 4e284b9c1..00d7a379f 100644 --- a/hw/xwin/winshaddd.c +++ b/hw/xwin/winshaddd.c @@ -239,9 +239,6 @@ winAllocateFBShadowDD (ScreenPtr pScreen) winDebug ("winAllocateFBShadowDD - Created a clipper\n"); #endif - /* Get a device context for the screen */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, 0, @@ -503,6 +500,48 @@ winAllocateFBShadowDD (ScreenPtr pScreen) return TRUE; } +static void +winFreeFBShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow) + { + IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); + IDirectDrawSurface2_Release (pScreenPriv->pddsShadow); + pScreenPriv->pddsShadow = NULL; + } + + /* Detach the clipper from the primary surface and release the primary surface, if there is one */ + winReleasePrimarySurfaceShadowDD(pScreen); + + /* Release the clipper object */ + if (pScreenPriv->pddcPrimary) + { + IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); + pScreenPriv->pddcPrimary = NULL; + } + + /* Free the DirectDraw2 object, if there is one */ + if (pScreenPriv->pdd2) + { + IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2); + IDirectDraw2_Release (pScreenPriv->pdd2); + pScreenPriv->pdd2 = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} /* * Transfer the damaged regions of the shadow framebuffer to the display. @@ -529,6 +568,10 @@ winShadowUpdateDD (ScreenPtr pScreen, if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) || pScreenPriv->fBadDepth) return; + /* Return immediately if we didn't get needed surfaces */ + if (!pScreenPriv->pddsPrimary || !pScreenPriv->pddsShadow) + return; + /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; @@ -647,25 +690,20 @@ winShadowUpdateDD (ScreenPtr pScreen, "%s file to " BUILDERADDR "\n", g_pszLogFile); /* Location of shadow framebuffer has changed */ - pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; - - /* Update the screen pixmap */ - if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, - pScreen->width, - pScreen->height, - pScreen->rootDepth, - BitsPerPixel (pScreen->rootDepth), - PixmapBytePad (pScreenInfo->dwStride, - pScreenInfo->dwBPP), - pScreenInfo->pfb)) - { - ErrorF ("winShadowUpdateDD - Bits changed, could not " - "notify fb.\n"); - return; - } + winUpdateFBPointer(pScreen, pScreenPriv->pddsdShadow->lpSurface); } } +static Bool +winInitScreenShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Get a device context for the screen */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + + return winAllocateFBShadowDD(pScreen); +} /* * Call the wrapped CloseScreen function. @@ -692,58 +730,18 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) WIN_UNWRAP(CloseScreen); fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + winFreeFBShadowDD(pScreen); + /* Free the screen DC */ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - /* Free the shadow surface, if there is one */ - if (pScreenPriv->pddsShadow) - { - IDirectDrawSurface2_Unlock (pScreenPriv->pddsShadow, NULL); - IDirectDrawSurface2_Release (pScreenPriv->pddsShadow); - pScreenPriv->pddsShadow = NULL; - } - - /* Detach the clipper from the primary surface and release the clipper. */ - if (pScreenPriv->pddcPrimary) - { - /* Detach the clipper */ - IDirectDrawSurface2_SetClipper (pScreenPriv->pddsPrimary, - NULL); - - /* Release the clipper object */ - IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); - pScreenPriv->pddcPrimary = NULL; - } - - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary) - { - IDirectDrawSurface2_Release (pScreenPriv->pddsPrimary); - pScreenPriv->pddsPrimary = NULL; - } - - /* Free the DirectDraw2 object, if there is one */ - if (pScreenPriv->pdd2) - { - IDirectDraw2_RestoreDisplayMode (pScreenPriv->pdd2); - IDirectDraw2_Release (pScreenPriv->pdd2); - pScreenPriv->pdd2 = NULL; - } - - /* Free the DirectDraw object, if there is one */ - if (pScreenPriv->pdd) - { - IDirectDraw_Release (pScreenPriv->pdd); - pScreenPriv->pdd = NULL; - } - /* Delete tray icon, if we have one */ if (!pScreenInfo->fNoTrayIcon) winDeleteNotifyIcon (pScreenPriv); - + /* Free the exit confirmation dialog box, if it exists */ if (g_hDlgExit != NULL) { @@ -766,9 +764,6 @@ winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - /* Free the screen privates for this screen */ free ((pointer) pScreenPriv); @@ -909,43 +904,12 @@ winAdjustVideoModeShadowDD (ScreenPtr pScreen) dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) + if (!(pScreenInfo->fFullScreen && + (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowDD - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ + /* Otherwise, We'll use GDI's depth */ pScreenInfo->dwBPP = dwBPP; } - else if (pScreenInfo->fFullScreen - && pScreenInfo->dwBPP != dwBPP) - { - /* FullScreen, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDD - FullScreen, using command line " - "bpp: %d\n", (int) pScreenInfo->dwBPP); - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Windowed, and GDI depth differs from -depth parameter */ - ErrorF ("winAdjustVideoModeShadowDD - Windowed, command line bpp: " - "%d, using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP - >= WIN_DIB_MAXIMUM_SIZE) - { - ErrorF ("winAdjustVideoModeShadowDD - Requested DirectDraw surface " - "will be larger than %d MB. The surface may fail to be " - "allocated on Windows 95, 98, or Me, due to a %d MB limit in " - "DIB size. This limit does not apply to Windows NT/2000, and " - "this message may be ignored on those platforms.\n", - WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); - } /* Release our DC */ ReleaseDC (NULL, hdc); @@ -1370,7 +1334,9 @@ winSetEngineFunctionsShadowDD (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; + pScreenPriv->pwinFreeFB = winFreeFBShadowDD; pScreenPriv->pwinShadowUpdate = winShadowUpdateDD; + pScreenPriv->pwinInitScreen = winInitScreenShadowDD; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; diff --git a/hw/xwin/winshadddnl.c b/hw/xwin/winshadddnl.c index 82fe4be36..0a0b4ae13 100644 --- a/hw/xwin/winshadddnl.c +++ b/hw/xwin/winshadddnl.c @@ -237,6 +237,10 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); #endif + /* Set the padded screen width */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwBPP); + /* Allocate memory for our shadow surface */ lpSurface = malloc (pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); if (lpSurface == NULL) @@ -266,9 +270,6 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) winDebug ("winAllocateFBShadowDDNL - Created a clipper\n"); #endif - /* Get a device context for the screen */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - /* Attach the clipper to our display window */ ddrval = IDirectDrawClipper_SetHWnd (pScreenPriv->pddcPrimary, 0, @@ -530,6 +531,49 @@ winAllocateFBShadowDDNL (ScreenPtr pScreen) return TRUE; } +static void +winFreeFBShadowDDNL(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow4) + { + IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); + free (pScreenInfo->pfb); + pScreenInfo->pfb = NULL; + pScreenPriv->pddsShadow4 = NULL; + } + + /* Detach the clipper from the primary surface and release the primary surface, if there is one */ + winReleasePrimarySurfaceShadowDDNL(pScreen); + + /* Release the clipper object */ + if (pScreenPriv->pddcPrimary) + { + IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); + pScreenPriv->pddcPrimary = NULL; + } + + /* Free the DirectDraw4 object, if there is one */ + if (pScreenPriv->pdd4) + { + IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); + IDirectDraw4_Release (pScreenPriv->pdd4); + pScreenPriv->pdd4 = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} #if defined(XWIN_MULTIWINDOW) || defined(XWIN_MULTIWINDOWEXTWM) /* @@ -605,6 +649,10 @@ winShadowUpdateDDNL (ScreenPtr pScreen, if ((!pScreenPriv->fActive && pScreenInfo->fFullScreen) || pScreenPriv->fBadDepth) return; + /* Return immediately if we didn't get needed surfaces */ + if (!pScreenPriv->pddsPrimary4 || !pScreenPriv->pddsShadow4) + return; + /* Get the origin of the window in the screen coords */ ptOrigin.x = pScreenInfo->dwXOffset; ptOrigin.y = pScreenInfo->dwYOffset; @@ -720,6 +768,16 @@ winShadowUpdateDDNL (ScreenPtr pScreen, } } +static Bool +winInitScreenShadowDDNL(ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Get a device context for the screen */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + + return winAllocateFBShadowDDNL(pScreen); +} /* * Call the wrapped CloseScreen function. @@ -746,55 +804,14 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) WIN_UNWRAP(CloseScreen); fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + winFreeFBShadowDDNL(pScreen); + /* Free the screen DC */ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); /* Delete the window property */ RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); - /* Free the shadow surface, if there is one */ - if (pScreenPriv->pddsShadow4) - { - IDirectDrawSurface4_Release (pScreenPriv->pddsShadow4); - free (pScreenInfo->pfb); - pScreenInfo->pfb = NULL; - pScreenPriv->pddsShadow4 = NULL; - } - - /* Detach the clipper from the primary surface and release the clipper. */ - if (pScreenPriv->pddcPrimary) - { - /* Detach the clipper */ - IDirectDrawSurface4_SetClipper (pScreenPriv->pddsPrimary4, - NULL); - - /* Release the clipper object */ - IDirectDrawClipper_Release (pScreenPriv->pddcPrimary); - pScreenPriv->pddcPrimary = NULL; - } - - /* Release the primary surface, if there is one */ - if (pScreenPriv->pddsPrimary4) - { - IDirectDrawSurface4_Release (pScreenPriv->pddsPrimary4); - pScreenPriv->pddsPrimary4 = NULL; - } - - /* Free the DirectDraw4 object, if there is one */ - if (pScreenPriv->pdd4) - { - IDirectDraw4_RestoreDisplayMode (pScreenPriv->pdd4); - IDirectDraw4_Release (pScreenPriv->pdd4); - pScreenPriv->pdd4 = NULL; - } - - /* Free the DirectDraw object, if there is one */ - if (pScreenPriv->pdd) - { - IDirectDraw_Release (pScreenPriv->pdd); - pScreenPriv->pdd = NULL; - } - /* Delete tray icon, if we have one */ if (!pScreenInfo->fNoTrayIcon) winDeleteNotifyIcon (pScreenPriv); @@ -821,9 +838,6 @@ winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) /* Kill our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - /* Free the screen privates for this screen */ free ((pointer) pScreenPriv); @@ -964,45 +978,13 @@ winAdjustVideoModeShadowDDNL (ScreenPtr pScreen) dwBPP = GetDeviceCaps (hdc, BITSPIXEL); /* DirectDraw can only change the depth in fullscreen mode */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) + if (!(pScreenInfo->fFullScreen && + (pScreenInfo->dwBPP != WIN_DEFAULT_BPP))) { - /* No -depth parameter passed, let the user know the depth being used */ - winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); - - /* Use GDI's depth */ + /* Otherwise, We'll use GDI's depth */ pScreenInfo->dwBPP = dwBPP; } - else if (pScreenInfo->fFullScreen - && pScreenInfo->dwBPP != dwBPP) - { - /* FullScreen, and GDI depth differs from -depth parameter */ - winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - FullScreen, using command " - "line bpp: %d\n", (int) pScreenInfo->dwBPP); - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Windowed, and GDI depth differs from -depth parameter */ - winErrorFVerb (2, "winAdjustVideoModeShadowDDNL - Windowed, command line " - "bpp: %d, using bpp: %d\n", - (int) pScreenInfo->dwBPP, (int) dwBPP); - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - - /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP - >= WIN_DIB_MAXIMUM_SIZE) - { - winErrorFVerb (1, "winAdjustVideoModeShadowDDNL - Requested DirectDraw surface " - "will be larger than %d MB. The surface may fail to be " - "allocated on Windows 95, 98, or Me, due to a %d MB limit in " - "DIB size. This limit does not apply to Windows NT/2000, and " - "this message may be ignored on those platforms.\n", - WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); - } - /* Release our DC */ ReleaseDC (NULL, hdc); @@ -1382,7 +1364,9 @@ winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; + pScreenPriv->pwinFreeFB = winFreeFBShadowDDNL; pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; + pScreenPriv->pwinInitScreen = winInitScreenShadowDDNL; pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; diff --git a/hw/xwin/winshadgdi.c b/hw/xwin/winshadgdi.c index 4971851e5..499037656 100644 --- a/hw/xwin/winshadgdi.c +++ b/hw/xwin/winshadgdi.c @@ -338,37 +338,20 @@ winAllocateFBShadowGDI (ScreenPtr pScreen) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; - BITMAPINFOHEADER *pbmih = NULL; DIBSECTION dibsection; Bool fReturn = TRUE; - /* Get device contexts for the screen and shadow bitmap */ - pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); - pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); - - /* Allocate bitmap info header */ - pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) - + 256 * sizeof (RGBQUAD)); - if (pbmih == NULL) - { - ErrorF ("winAllocateFBShadowGDI - malloc () failed\n"); - return FALSE; - } - - /* Query the screen format */ - fReturn = winQueryScreenDIBFormat (pScreen, pbmih); - /* Describe shadow bitmap to be created */ - pbmih->biWidth = pScreenInfo->dwWidth; - pbmih->biHeight = -pScreenInfo->dwHeight; - + pScreenPriv->pbmih->biWidth = pScreenInfo->dwWidth; + pScreenPriv->pbmih->biHeight = -pScreenInfo->dwHeight; + ErrorF ("winAllocateFBShadowGDI - Creating DIB with width: %d height: %d " "depth: %d\n", - (int) pbmih->biWidth, (int) -pbmih->biHeight, pbmih->biBitCount); + (int) pScreenPriv->pbmih->biWidth, (int) -pScreenPriv->pbmih->biHeight, pScreenPriv->pbmih->biBitCount); /* Create a DI shadow bitmap with a bit pointer */ pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, - (BITMAPINFO *) pbmih, + (BITMAPINFO *) pScreenPriv->pbmih, DIB_RGB_COLORS, (VOID**) &pScreenInfo->pfb, NULL, @@ -449,25 +432,6 @@ winAllocateFBShadowGDI (ScreenPtr pScreen) (int) pScreenInfo->dwStride); #endif - /* See if the shadow bitmap will be larger than the DIB size limit */ - if (pScreenInfo->dwWidth * pScreenInfo->dwHeight * pScreenInfo->dwBPP - >= WIN_DIB_MAXIMUM_SIZE) - { - ErrorF ("winAllocateFBShadowGDI - Requested DIB (bitmap) " - "will be larger than %d MB. The surface may fail to be " - "allocated on Windows 95, 98, or Me, due to a %d MB limit in " - "DIB size. This limit does not apply to Windows NT/2000, and " - "this message may be ignored on those platforms.\n", - WIN_DIB_MAXIMUM_SIZE_MB, WIN_DIB_MAXIMUM_SIZE_MB); - } - - /* Determine our color masks */ - if (!winQueryRGBBitsAndMasks (pScreen)) - { - ErrorF ("winAllocateFBShadowGDI - winQueryRGBBitsAndMasks failed\n"); - return FALSE; - } - #ifdef XWIN_MULTIWINDOW /* Redraw all windows */ if (pScreenInfo->fMultiWindow) @@ -477,6 +441,18 @@ winAllocateFBShadowGDI (ScreenPtr pScreen) return fReturn; } +static void +winFreeFBShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Free the shadow bitmap */ + DeleteObject (pScreenPriv->hbmpShadow); + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; +} /* * Blit the damaged regions of the shadow fb to the screen @@ -602,6 +578,41 @@ winShadowUpdateGDI (ScreenPtr pScreen, } +static Bool +winInitScreenShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* Get device contexts for the screen and shadow bitmap */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); + + /* Allocate bitmap info header */ + pScreenPriv->pbmih = (BITMAPINFOHEADER*) malloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pScreenPriv->pbmih == NULL) + { + ErrorF ("winInitScreenShadowGDI - malloc () failed\n"); + return FALSE; + } + + /* Query the screen format */ + if (!winQueryScreenDIBFormat (pScreen, pScreenPriv->pbmih)) + { + ErrorF ("winInitScreenShadowGDI - winQueryScreenDIBFormat failed\n"); + return FALSE; + } + + /* Determine our color masks */ + if (!winQueryRGBBitsAndMasks (pScreen)) + { + ErrorF ("winInitScreenShadowGDI - winQueryRGBBitsAndMasks failed\n"); + return FALSE; + } + + return winAllocateFBShadowGDI(pScreen); +} + /* See Porting Layer Definition - p. 33 */ /* * We wrap whatever CloseScreen procedure was specified by fb; @@ -632,9 +643,8 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) /* Free the shadow DC; which allows the bitmap to be freed */ DeleteDC (pScreenPriv->hdcShadow); - - /* Free the shadow bitmap */ - DeleteObject (pScreenPriv->hbmpShadow); + + winFreeFBShadowGDI(pScreen); /* Free the screen DC */ ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); @@ -665,9 +675,6 @@ winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) /* Invalidate our screeninfo's pointer to the screen */ pScreenInfo->pScreen = NULL; - /* Invalidate the ScreenInfo's fb pointer */ - pScreenInfo->pfb = NULL; - /* Free the screen privates for this screen */ free ((pointer) pScreenPriv); @@ -791,26 +798,9 @@ winAdjustVideoModeShadowGDI (ScreenPtr pScreen) /* Query GDI for current display depth */ dwBPP = GetDeviceCaps (hdc, BITSPIXEL); - /* GDI cannot change the screen depth */ - if (pScreenInfo->dwBPP == WIN_DEFAULT_BPP) - { - /* No -depth parameter passed, let the user know the depth being used */ - ErrorF ("winAdjustVideoModeShadowGDI - Using Windows display " - "depth of %d bits per pixel\n", (int) dwBPP); + /* GDI cannot change the screen depth, so always use GDI's depth */ + pScreenInfo->dwBPP = dwBPP; - /* Use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - else if (dwBPP != pScreenInfo->dwBPP) - { - /* Warn user if GDI depth is different than -depth parameter */ - ErrorF ("winAdjustVideoModeShadowGDI - Command line bpp: %d, "\ - "using bpp: %d\n", (int) pScreenInfo->dwBPP, (int) dwBPP); - - /* We'll use GDI's depth */ - pScreenInfo->dwBPP = dwBPP; - } - /* Release our DC */ ReleaseDC (NULL, hdc); hdc = NULL; @@ -1235,7 +1225,9 @@ winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) /* Set our pointers */ pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; + pScreenPriv->pwinFreeFB = winFreeFBShadowGDI; pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; + pScreenPriv->pwinInitScreen = winInitScreenShadowGDI; pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; diff --git a/hw/xwin/winvalargs.c b/hw/xwin/winvalargs.c index 357d3d70a..04db777b0 100644 --- a/hw/xwin/winvalargs.c +++ b/hw/xwin/winvalargs.c @@ -154,8 +154,8 @@ winValidateArgs (void) /* Check for !fullscreen and any fullscreen-only parameters */ if (!g_ScreenInfo[i].fFullScreen - && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_BPP - || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_REFRESH)) + && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH + || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP)) { ErrorF ("winValidateArgs - -refresh and -depth are only valid " "with -fullscreen.\n"); @@ -164,12 +164,12 @@ winValidateArgs (void) /* Check for fullscreen and any non-fullscreen parameters */ if (g_ScreenInfo[i].fFullScreen - && (g_ScreenInfo[i].fScrollbars + && ((g_ScreenInfo[i].iResizeMode != notAllowed) || !g_ScreenInfo[i].fDecoration || g_ScreenInfo[i].fLessPointer)) { ErrorF ("winValidateArgs - -fullscreen is invalid with " - "-scrollbars, -nodecoration, or -lesspointer.\n"); + "-scrollbars, -resize, -nodecoration, or -lesspointer.\n"); return FALSE; } } diff --git a/hw/xwin/winwindow.c b/hw/xwin/winwindow.c index 783760f4b..7975d71a9 100644 --- a/hw/xwin/winwindow.c +++ b/hw/xwin/winwindow.c @@ -58,6 +58,7 @@ winReshapeRootless (WindowPtr pWin); Bool winCreateWindowNativeGDI (WindowPtr pWin) { + Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; winWindowPriv(pWin); winScreenPriv(pScreen); diff --git a/hw/xwin/winwndproc.c b/hw/xwin/winwndproc.c index 6d2270a20..bccd6f9f2 100644 --- a/hw/xwin/winwndproc.c +++ b/hw/xwin/winwndproc.c @@ -40,6 +40,7 @@ #include "winprefs.h" #include "winconfig.h" #include "winmsg.h" +#include "winmonitors.h" #include "inputstr.h" /* @@ -148,6 +149,13 @@ winWindowProc (HWND hwnd, UINT message, return 0; case WM_DISPLAYCHANGE: + /* + WM_DISPLAYCHANGE seems to be sent when the monitor layout or + any monitor's resolution or depth changes, but it's lParam and + wParam always indicate the resolution and bpp for the primary + monitor (so ignore that as we could be on any monitor...) + */ + /* We cannot handle a display mode change during initialization */ if (s_pScreenInfo == NULL) FatalError ("winWindowProc - WM_DISPLAYCHANGE - The display " @@ -167,150 +175,153 @@ winWindowProc (HWND hwnd, UINT message, #endif )) { - /* - * Store the new display dimensions and depth. - * We do this here for future compatibility in case we - * ever allow switching from fullscreen to windowed mode. - */ - s_pScreenPriv->dwLastWindowsWidth = GetSystemMetrics (SM_CXSCREEN); - s_pScreenPriv->dwLastWindowsHeight = GetSystemMetrics (SM_CYSCREEN); - s_pScreenPriv->dwLastWindowsBitsPixel - = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL); break; } - - ErrorF ("winWindowProc - WM_DISPLAYCHANGE - orig bpp: %d, last bpp: %d, " - "new bpp: %d\n", - (int) s_pScreenInfo->dwBPP, - (int) s_pScreenPriv->dwLastWindowsBitsPixel, - wParam); ErrorF ("winWindowProc - WM_DISPLAYCHANGE - new width: %d " - "new height: %d\n", - LOWORD (lParam), HIWORD (lParam)); - - /* - * TrueColor --> TrueColor depth changes are disruptive for: - * Windowed: - * Shadow DirectDraw - * Shadow DirectDraw Non-Locking - * Primary DirectDraw - * - * TrueColor --> TrueColor depth changes are non-optimal for: - * Windowed: - * Shadow GDI - * - * FullScreen: - * Shadow GDI - * - * TrueColor --> PseudoColor or vice versa are disruptive for: - * Windowed: - * Shadow DirectDraw - * Shadow DirectDraw Non-Locking - * Primary DirectDraw - * Shadow GDI - */ + "new height: %d new bpp: %d\n", + LOWORD (lParam), HIWORD (lParam), wParam); /* * Check for a disruptive change in depth. * We can only display a message for a disruptive depth change, * we cannot do anything to correct the situation. */ - if ((s_pScreenInfo->dwBPP != wParam) - && (s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD - || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL + /* + XXX: maybe we need to check if GetSystemMetrics(SM_SAMEDISPLAYFORMAT) + has changed as well... + */ + if (s_pScreenInfo->dwBPP != GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL)) + { + if ((s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || s_pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL #ifdef XWIN_PRIMARYFB - || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD + || s_pScreenInfo->dwEngine == WIN_SERVER_PRIMARY_DD #endif - )) - { - /* Cannot display the visual until the depth is restored */ - ErrorF ("winWindowProc - Disruptive change in depth\n"); - - /* Display Exit dialog */ - winDisplayDepthChangeDialog (s_pScreenPriv); - - /* Flag that we have an invalid screen depth */ - s_pScreenPriv->fBadDepth = TRUE; - - /* Minimize the display window */ - ShowWindow (hwnd, SW_MINIMIZE); - } + )) + { + /* Cannot display the visual until the depth is restored */ + ErrorF ("winWindowProc - Disruptive change in depth\n"); + + /* Display depth change dialog */ + winDisplayDepthChangeDialog (s_pScreenPriv); + + /* Flag that we have an invalid screen depth */ + s_pScreenPriv->fBadDepth = TRUE; + + /* Minimize the display window */ + ShowWindow (hwnd, SW_MINIMIZE); + } + else + { + /* For GDI, performance may suffer until original depth is restored */ + ErrorF ("winWindowProc - Performance may be non-optimal after change in depth\n"); + } + } else - { - /* Flag that we have a valid screen depth */ - s_pScreenPriv->fBadDepth = FALSE; - } - + { + /* Flag that we have a valid screen depth */ + s_pScreenPriv->fBadDepth = FALSE; + } + /* - * Check for a change in display dimensions. - * We can simply recreate the same-sized primary surface when - * the display dimensions change. - */ - if (s_pScreenPriv->dwLastWindowsWidth != LOWORD (lParam) - || s_pScreenPriv->dwLastWindowsHeight != HIWORD (lParam)) + If we could cheaply check if this WM_DISPLAYCHANGE change + affects the monitor(s) which this X screen is displayed on + then we should do so here. For the moment, assume it does. + (this is probably usually the case so that might be an + overoptimization) + */ { /* - * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface - * and CreatePrimarySurface function pointers to point - * to the no operation function, NoopDDA. This allows us - * to blindly call these functions, even if they are not - * relevant to the current engine (e.g., Shadow GDI). - */ - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions changed\n"); -#endif - - /* Release the old primary surface */ - (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Released " - "primary surface\n"); + In rootless modes which are monitor or virtual desktop size + use RandR to resize the X screen + */ + if ((!s_pScreenInfo->fUserGaveHeightAndWidth) && + (s_pScreenInfo->iResizeMode == resizeWithRandr) && + (FALSE +#ifdef XWIN_MULTIWINDOWEXTWM + || s_pScreenInfo->fMWExtWM #endif - - /* Create the new primary surface */ - (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); - -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Recreated " - "primary surface\n"); + || s_pScreenInfo->fRootless +#ifdef XWIN_MULTIWINDOW + || s_pScreenInfo->fMultiWindow #endif - -#if 0 - /* Multi-Window mode uses RandR for resizes */ - if (s_pScreenInfo->fMultiWindow) + )) { - RRSetScreenConfig (); + DWORD dwWidth, dwHeight; + + if (s_pScreenInfo->fMultipleMonitors) + { + /* resize to new virtual desktop size */ + dwWidth = GetSystemMetrics(SM_CXVIRTUALSCREEN); + dwHeight = GetSystemMetrics(SM_CYVIRTUALSCREEN); + } + else + { + /* resize to new size of specified monitor */ + struct GetMonitorInfoData data; + if (QueryMonitor(s_pScreenInfo->iMonitor, &data)) + { + if (data.bMonitorSpecifiedExists == TRUE) + { + dwWidth = data.monitorWidth; + dwHeight = data.monitorHeight; + /* + XXX: monitor may have changed position, + so we might need to update xinerama data + */ + } + else + { + ErrorF ("Monitor number %d no longer exists!\n", s_pScreenInfo->iMonitor); + } + } + } + + /* + XXX: probably a small bug here: we don't compute the work area + and allow for task bar + + XXX: generally, we don't allow for the task bar being moved after + the server is started + */ + + /* Set screen size to match new size, if it is different to current */ + if ((s_pScreenInfo->dwWidth != dwWidth) || + (s_pScreenInfo->dwHeight != dwHeight)) + { + winDoRandRScreenSetSize(s_pScreen, + dwWidth, + dwHeight, + (dwWidth * 25.4) / monitorResolution, + (dwHeight * 25.4) / monitorResolution); + } } -#endif - } - else - { -#if CYGDEBUG - winDebug ("winWindowProc - WM_DISPLAYCHANGE - Dimensions did not " - "change\n"); -#endif + else + { + /* + * We can simply recreate the same-sized primary surface when + * the display dimensions change. + */ + + /* + * NOTE: The non-DirectDraw engines set the ReleasePrimarySurface + * and CreatePrimarySurface function pointers to point + * to the no operation function, NoopDDA. This allows us + * to blindly call these functions, even if they are not + * relevant to the current engine (e.g., Shadow GDI). + */ + + winDebug ("winWindowProc - WM_DISPLAYCHANGE - Releasing and recreating primary surface\n"); + + /* Release the old primary surface */ + (*s_pScreenPriv->pwinReleasePrimarySurface) (s_pScreen); + + /* Create the new primary surface */ + (*s_pScreenPriv->pwinCreatePrimarySurface) (s_pScreen); + } } - /* Store the new display dimensions and depth */ - if (s_pScreenInfo->fMultipleMonitors) - { - s_pScreenPriv->dwLastWindowsWidth - = GetSystemMetrics (SM_CXVIRTUALSCREEN); - s_pScreenPriv->dwLastWindowsHeight - = GetSystemMetrics (SM_CYVIRTUALSCREEN); - } - else - { - s_pScreenPriv->dwLastWindowsWidth - = GetSystemMetrics (SM_CXSCREEN); - s_pScreenPriv->dwLastWindowsHeight - = GetSystemMetrics (SM_CYSCREEN); - } - s_pScreenPriv->dwLastWindowsBitsPixel - = GetDeviceCaps (s_pScreenPriv->hdcScreen, BITSPIXEL); break; case WM_SIZE: @@ -323,8 +334,8 @@ winWindowProc (HWND hwnd, UINT message, winDebug ("winWindowProc - WM_SIZE\n"); #endif - /* Break if we do not use scrollbars */ - if (!s_pScreenInfo->fScrollbars + /* Break if we do not allow resizing */ + if ((s_pScreenInfo->iResizeMode == notAllowed) || !s_pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM || s_pScreenInfo->fMWExtWM @@ -340,6 +351,17 @@ winWindowProc (HWND hwnd, UINT message, if (wParam == SIZE_MINIMIZED) return 0; + ErrorF ("winWindowProc - WM_SIZE - new client area w: %d h: %d\n", + LOWORD (lParam), HIWORD (lParam)); + + if (s_pScreenInfo->iResizeMode == resizeWithRandr) + { + /* Actual resizing is done on WM_EXITSIZEMOVE */ + return 0; + } + + /* Otherwise iResizeMode == resizeWithScrollbars */ + /* * Get the size of the whole window, including client area, * scrollbars, and non-client area decorations (caption, borders). @@ -357,10 +379,6 @@ winWindowProc (HWND hwnd, UINT message, iWidth = rcWindow.right - rcWindow.left; iHeight = rcWindow.bottom - rcWindow.top; - ErrorF ("winWindowProc - WM_SIZE - window w: %d h: %d, " - "new client area w: %d h: %d\n", - iWidth, iHeight, LOWORD (lParam), HIWORD (lParam)); - /* Subtract the frame size from the window size. */ iWidth -= 2 * GetSystemMetrics (SM_CXSIZEFRAME); iHeight -= (2 * GetSystemMetrics (SM_CYSIZEFRAME) @@ -416,6 +434,37 @@ winWindowProc (HWND hwnd, UINT message, } return 0; + case WM_ENTERSIZEMOVE: + ErrorF("winWindowProc - WM_ENTERSIZEMOVE\n"); + break; + + case WM_EXITSIZEMOVE: + ErrorF("winWindowProc - WM_EXITSIZEMOVE\n"); + + if (s_pScreenInfo->iResizeMode == resizeWithRandr) + { + /* Set screen size to match new client area, if it is different to current */ + RECT rcClient; + DWORD dwWidth, dwHeight; + + GetClientRect (hwnd, &rcClient); + dwWidth = rcClient.right - rcClient.left; + dwHeight = rcClient.bottom - rcClient.top; + + if ((s_pScreenInfo->dwWidth != dwWidth) || + (s_pScreenInfo->dwHeight != dwHeight)) + { + /* mm = dots * (25.4 mm / inch) / (dots / inch) */ + winDoRandRScreenSetSize(s_pScreen, + dwWidth, + dwHeight, + (dwWidth * 25.4) / monitorResolution, + (dwHeight * 25.4) / monitorResolution); + } + } + + break; + case WM_VSCROLL: { SCROLLINFO si; @@ -599,7 +648,7 @@ winWindowProc (HWND hwnd, UINT message, /* Can't do anything without screen info */ if (s_pScreenInfo == NULL - || !s_pScreenInfo->fScrollbars + || (s_pScreenInfo->iResizeMode != resizeWithScrollbars) || s_pScreenInfo->fFullScreen || !s_pScreenInfo->fDecoration #ifdef XWIN_MULTIWINDOWEXTWM diff --git a/include/dix.h b/include/dix.h index 7485e8ed4..12e4b5977 100644 --- a/include/dix.h +++ b/include/dix.h @@ -372,6 +372,13 @@ extern void AllowSome( extern void ReleaseActiveGrabs( ClientPtr client); +extern GrabPtr CheckPassiveGrabsOnWindow( + WindowPtr /* pWin */, + DeviceIntPtr /* device */, + DeviceEvent * /* event */, + BOOL /* checkCore */, + BOOL /* activate */); + extern _X_EXPORT int DeliverEventsToWindow( DeviceIntPtr /* pWin */, WindowPtr /* pWin */, diff --git a/include/input.h b/include/input.h index 9f3227fb0..f96a0a988 100644 --- a/include/input.h +++ b/include/input.h @@ -103,6 +103,7 @@ typedef struct _OtherClients *OtherClientsPtr; typedef struct _InputClients *InputClientsPtr; typedef struct _DeviceIntRec *DeviceIntPtr; typedef struct _ClassesRec *ClassesPtr; +typedef struct _SpriteRec *SpritePtr; typedef union _GrabMask GrabMask; typedef struct _EventList { @@ -525,13 +526,15 @@ extern _X_EXPORT InputAttributes *DuplicateInputAttributes(InputAttributes *attr extern _X_EXPORT void FreeInputAttributes(InputAttributes *attrs); /* misc event helpers */ +extern Mask GetEventMask(DeviceIntPtr dev, xEvent* ev, InputClientsPtr clients); extern Mask GetEventFilter(DeviceIntPtr dev, xEvent *event); extern Mask GetWindowXI2Mask(DeviceIntPtr dev, WindowPtr win, xEvent* ev); -void FixUpEventFromWindow(DeviceIntPtr pDev, +void FixUpEventFromWindow(SpritePtr pSprite, xEvent *xE, WindowPtr pWin, Window child, Bool calcChild); +extern WindowPtr XYToWindow(SpritePtr pSprite, int x, int y); extern int EventIsDeliverable(DeviceIntPtr dev, InternalEvent* event, WindowPtr win); /** @@ -567,6 +570,7 @@ extern _X_HIDDEN void valuator_set_mode(DeviceIntPtr dev, int axis, int mode); extern Bool EnableCursor; extern _X_EXPORT ValuatorMask *valuator_mask_new(int num_valuators); +extern _X_EXPORT void valuator_mask_free(ValuatorMask **mask); extern _X_EXPORT void valuator_mask_set_range(ValuatorMask *mask, int first_valuator, int num_valuators, const int* valuators); diff --git a/include/inputstr.h b/include/inputstr.h index 44de9c44a..b74ee0454 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -203,6 +203,47 @@ typedef struct _GrabRec { unsigned char xi2mask[EMASKSIZE][XI2MASKSIZE]; } GrabRec; +/** + * Sprite information for a device. + */ +typedef struct _SpriteRec { + CursorPtr current; + BoxRec hotLimits; /* logical constraints of hot spot */ + Bool confined; /* confined to screen */ + RegionPtr hotShape; /* additional logical shape constraint */ + BoxRec physLimits; /* physical constraints of hot spot */ + WindowPtr win; /* window of logical position */ + HotSpot hot; /* logical pointer position */ + HotSpot hotPhys; /* physical pointer position */ +#ifdef PANORAMIX + ScreenPtr screen; /* all others are in Screen 0 coordinates */ + RegionRec Reg1; /* Region 1 for confining motion */ + RegionRec Reg2; /* Region 2 for confining virtual motion */ + WindowPtr windows[MAXSCREENS]; + WindowPtr confineWin; /* confine window */ +#endif + /* The window trace information is used at dix/events.c to avoid having + * to compute all the windows between the root and the current pointer + * window each time a button or key goes down. The grabs on each of those + * windows must be checked. + * spriteTraces should only be used at dix/events.c! */ + WindowPtr *spriteTrace; + int spriteTraceSize; + int spriteTraceGood; + + /* Due to delays between event generation and event processing, it is + * possible that the pointer has crossed screen boundaries between the + * time in which it begins generating events and the time when + * those events are processed. + * + * pEnqueueScreen: screen the pointer was on when the event was generated + * pDequeueScreen: screen the pointer was on when the event is processed + */ + ScreenPtr pEnqueueScreen; + ScreenPtr pDequeueScreen; + +} SpriteRec; + typedef struct _KeyClassRec { int sourceid; CARD8 down[DOWN_LENGTH]; @@ -360,47 +401,6 @@ typedef struct _ClassesRec { } ClassesRec; -/** - * Sprite information for a device. - */ -typedef struct { - CursorPtr current; - BoxRec hotLimits; /* logical constraints of hot spot */ - Bool confined; /* confined to screen */ - RegionPtr hotShape; /* additional logical shape constraint */ - BoxRec physLimits; /* physical constraints of hot spot */ - WindowPtr win; /* window of logical position */ - HotSpot hot; /* logical pointer position */ - HotSpot hotPhys; /* physical pointer position */ -#ifdef PANORAMIX - ScreenPtr screen; /* all others are in Screen 0 coordinates */ - RegionRec Reg1; /* Region 1 for confining motion */ - RegionRec Reg2; /* Region 2 for confining virtual motion */ - WindowPtr windows[MAXSCREENS]; - WindowPtr confineWin; /* confine window */ -#endif - /* The window trace information is used at dix/events.c to avoid having - * to compute all the windows between the root and the current pointer - * window each time a button or key goes down. The grabs on each of those - * windows must be checked. - * spriteTraces should only be used at dix/events.c! */ - WindowPtr *spriteTrace; - int spriteTraceSize; - int spriteTraceGood; - - /* Due to delays between event generation and event processing, it is - * possible that the pointer has crossed screen boundaries between the - * time in which it begins generating events and the time when - * those events are processed. - * - * pEnqueueScreen: screen the pointer was on when the event was generated - * pDequeueScreen: screen the pointer was on when the event is processed - */ - ScreenPtr pEnqueueScreen; - ScreenPtr pDequeueScreen; - -} SpriteRec, *SpritePtr; - /* Device properties */ typedef struct _XIPropertyValue { diff --git a/include/scrnintstr.h b/include/scrnintstr.h index 00d014ca8..9f4fbf3df 100644 --- a/include/scrnintstr.h +++ b/include/scrnintstr.h @@ -135,7 +135,8 @@ typedef void (* SourceValidateProcPtr)( int /*x*/, int /*y*/, int /*width*/, - int /*height*/); + int /*height*/, + unsigned int /*subWindowMode*/); typedef Bool (* CreateWindowProcPtr)( WindowPtr /*pWindow*/); @@ -402,6 +403,9 @@ typedef void (* DeviceCursorCleanupProcPtr)( DeviceIntPtr /* pDev */, ScreenPtr /* pScreen */); +typedef void (*ConstrainCursorHarderProcPtr)( + DeviceIntPtr, ScreenPtr, int *, int *); + typedef struct _Screen { int myNum; /* index of this instance in Screens[] */ ATOM id; @@ -468,6 +472,7 @@ typedef struct _Screen { /* Cursor Procedures */ ConstrainCursorProcPtr ConstrainCursor; + ConstrainCursorHarderProcPtr ConstrainCursorHarder; CursorLimitsProcPtr CursorLimits; DisplayCursorProcPtr DisplayCursor; RealizeCursorProcPtr RealizeCursor; diff --git a/include/windowstr.h b/include/windowstr.h index 0b66ebbcc..4a7a0f488 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -167,6 +167,9 @@ typedef struct _Window { #ifdef ROOTLESS unsigned rootlessUnhittable:1; /* doesn't hit-test */ #endif +#ifdef COMPOSITE + unsigned damagedDescendants:1; /* some descendants are damaged */ +#endif } WindowRec; /* diff --git a/manpages.am b/manpages.am new file mode 100644 index 000000000..69ee0054d --- /dev/null +++ b/manpages.am @@ -0,0 +1,37 @@ +appmandir = $(APP_MAN_DIR) +#appman_PRE = list of application man page files set by calling Makefile.am +appman_DATA = $(appman_PRE:man=$(APP_MAN_SUFFIX)) + +drivermandir = $(DRIVER_MAN_DIR) +#driverman_PRE = list of driver man page files set by calling Makefile.am +driverman_DATA = $(driverman_PRE:man=$(DRIVER_MAN_SUFFIX)) + +filemandir = $(FILE_MAN_DIR) +#fileman_PRE = list of file man page files set by calling Makefile.am +fileman_DATA = $(fileman_PRE:man=$(FILE_MAN_SUFFIX)) + +# The calling Makefile should only contain man page targets +# Otherwise the following three global variables may conflict +EXTRA_DIST = $(appman_PRE) $(driverman_PRE) $(fileman_PRE) +CLEANFILES = $(appman_DATA) $(driverman_DATA) $(fileman_DATA) +SUFFIXES = .$(APP_MAN_SUFFIX) .$(DRIVER_MAN_SUFFIX) .$(FILE_MAN_SUFFIX) .man + +# Add server specific man pages string substitution from XORG_MANPAGE_SECTIONS +# 's|/,|/, |g' will add a space to help font path formatting +MAN_SUBSTS += -e 's|__logdir__|$(logdir)|g' \ + -e 's|__datadir__|$(datadir)|g' \ + -e 's|__mandir__|$(mandir)|g' \ + -e 's|__sysconfdir__|$(sysconfdir)|g' \ + -e 's|__xconfigdir__|$(__XCONFIGDIR__)|g' \ + -e 's|__xkbdir__|$(XKB_BASE_DIRECTORY)|g' \ + -e 's|__laucnd_id_prefix__|$(LAUNCHD_ID_PREFIX)|g' \ + -e 's|__modulepath__|$(DEFAULT_MODULE_PATH)|g' \ + -e 's|__default_font_path__|$(COMPILEDDEFAULTFONTPATH)|g' \ + -e '\|$(COMPILEDDEFAULTFONTPATH)| s|/,|/, |g' + +.man.$(APP_MAN_SUFFIX): + $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ +.man.$(DRIVER_MAN_SUFFIX): + $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ +.man.$(FILE_MAN_SUFFIX): + $(AM_V_GEN)$(SED) $(MAN_SUBSTS) < $< > $@ diff --git a/mi/micopy.c b/mi/micopy.c index 027c461fe..652c6207e 100644 --- a/mi/micopy.c +++ b/mi/micopy.c @@ -183,10 +183,10 @@ miDoCopy (DrawablePtr pSrcDrawable, return NULL; } - if ((pSrcDrawable != pDstDrawable) && - pSrcDrawable->pScreen->SourceValidate) + if (pSrcDrawable->pScreen->SourceValidate) { - (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, widthSrc, heightSrc); + (*pSrcDrawable->pScreen->SourceValidate) (pSrcDrawable, xIn, yIn, widthSrc, heightSrc, + pGC->subWindowMode); } /* Compute source clip region */ diff --git a/mi/miinitext.c b/mi/miinitext.c index a7441c9a8..4499f377c 100644 --- a/mi/miinitext.c +++ b/mi/miinitext.c @@ -389,9 +389,7 @@ InitExtensions(int argc, char *argv[]) if (!noGEExtension) GEExtensionInit(); #ifdef PANORAMIX -# if !defined(NO_PANORAMIX) if (!noPanoramiXExtension) PanoramiXExtensionInit(); -# endif #endif #ifdef INXQUARTZ if(!noPseudoramiXExtension) PseudoramiXExtensionInit(); diff --git a/mi/misprite.c b/mi/misprite.c index c25c093f2..770951e8f 100644 --- a/mi/misprite.c +++ b/mi/misprite.c @@ -198,7 +198,8 @@ static void miSpriteGetSpans(DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart); static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, - int width, int height); + int width, int height, + unsigned int subWindowMode); static void miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); @@ -489,7 +490,7 @@ miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt, static void miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, - int height) + int height, unsigned int subWindowMode) { ScreenPtr pScreen = pDrawable->pScreen; DeviceIntPtr pDev; @@ -517,7 +518,7 @@ miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width, } if (pScreen->SourceValidate) - (*pScreen->SourceValidate) (pDrawable, x, y, width, height); + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, subWindowMode); SCREEN_EPILOGUE (pPriv, pScreen, SourceValidate); } diff --git a/miext/damage/damage.c b/miext/damage/damage.c index 21cbb78c9..566995c41 100644 --- a/miext/damage/damage.c +++ b/miext/damage/damage.c @@ -891,16 +891,6 @@ damageCopyArea(DrawablePtr pSrc, RegionPtr ret; DAMAGE_GC_OP_PROLOGUE(pGC, pDst); - /* The driver will only call SourceValidate() when pSrc != pDst, - * but the software sprite (misprite.c) always need to know when a - * drawable is copied so it can remove the sprite. See #1030. */ - if ((pSrc == pDst) && pSrc->pScreen->SourceValidate && - pSrc->type == DRAWABLE_WINDOW && - ((WindowPtr)pSrc)->viewable) - { - (*pSrc->pScreen->SourceValidate) (pSrc, srcx, srcy, width, height); - } - if (checkGCDamage (pDst, pGC)) { BoxRec box; @@ -937,16 +927,6 @@ damageCopyPlane(DrawablePtr pSrc, RegionPtr ret; DAMAGE_GC_OP_PROLOGUE(pGC, pDst); - /* The driver will only call SourceValidate() when pSrc != pDst, - * but the software sprite (misprite.c) always need to know when a - * drawable is copied so it can remove the sprite. See #1030. */ - if ((pSrc == pDst) && pSrc->pScreen->SourceValidate && - pSrc->type == DRAWABLE_WINDOW && - ((WindowPtr)pSrc)->viewable) - { - (*pSrc->pScreen->SourceValidate) (pSrc, srcx, srcy, width, height); - } - if (checkGCDamage (pDst, pGC)) { BoxRec box; diff --git a/miext/rootless/rootlessScreen.c b/miext/rootless/rootlessScreen.c index 61d2f5dab..510d6fdb1 100644 --- a/miext/rootless/rootlessScreen.c +++ b/miext/rootless/rootlessScreen.c @@ -223,7 +223,8 @@ out: * here and leave StopDrawing for the block handler. */ static void -RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h) +RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h, + unsigned int subWindowMode) { SCREEN_UNWRAP(pDrawable->pScreen, SourceValidate); if (pDrawable->type == DRAWABLE_WINDOW) { @@ -231,7 +232,7 @@ RootlessSourceValidate(DrawablePtr pDrawable, int x, int y, int w, int h) RootlessStartDrawing(pWin); } if (pDrawable->pScreen->SourceValidate) { - pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h); + pDrawable->pScreen->SourceValidate(pDrawable, x, y, w, h, subWindowMode); } SCREEN_WRAP(pDrawable->pScreen, SourceValidate); } diff --git a/os/WaitFor.c b/os/WaitFor.c index e66300490..867cb04b8 100644 --- a/os/WaitFor.c +++ b/os/WaitFor.c @@ -153,13 +153,17 @@ WaitForSomething(int *pClientsReady) fd_set clientsWritable; int curclient; int selecterr; - int nready; + static int nready; fd_set devicesReadable; CARD32 now = 0; Bool someReady = FALSE; FD_ZERO(&clientsReadable); + if (nready) + SmartScheduleStopTimer(); + nready = 0; + /* We need a while loop here to handle crashed connections and the screen saver timeout */ while (1) @@ -211,7 +215,6 @@ WaitForSomething(int *pClientsReady) } XFD_COPYSET(&AllSockets, &LastSelectMask); } - SmartScheduleStopTimer (); BlockHandler((pointer)&wt, (pointer)&LastSelectMask); if (NewOutputPending) @@ -230,7 +233,6 @@ WaitForSomething(int *pClientsReady) } selecterr = GetErrno(); WakeupHandler(i, (pointer)&LastSelectMask); - SmartScheduleStartTimer (); if (i <= 0) /* An error or timeout occurred */ { if (dispatchException) @@ -388,6 +390,10 @@ WaitForSomething(int *pClientsReady) #endif } } + + if (nready) + SmartScheduleStartTimer(); + return nready; } diff --git a/render/mipict.c b/render/mipict.c index b5b897037..de5eea6be 100644 --- a/render/mipict.c +++ b/render/mipict.c @@ -386,7 +386,8 @@ miCompositeSourceValidate (PicturePtr pPicture, } x += pPicture->pDrawable->x; y += pPicture->pDrawable->y; - (*pScreen->SourceValidate) (pDrawable, x, y, width, height); + (*pScreen->SourceValidate) (pDrawable, x, y, width, height, + pPicture->subWindowMode); } } diff --git a/test/input.c b/test/input.c index 1fe228c32..879e14f2f 100644 --- a/test/input.c +++ b/test/input.c @@ -256,7 +256,7 @@ static void dix_event_to_core(int type) #undef test_event } -static void dix_event_to_core_conversion(void) +static void dix_event_to_core_fail(int evtype, int expected_rc) { DeviceEvent ev; xEvent core; @@ -265,25 +265,18 @@ static void dix_event_to_core_conversion(void) ev.header = 0xFF; ev.length = sizeof(DeviceEvent); - ev.type = 0; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadImplementation); - - ev.type = 1; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadImplementation); - - ev.type = ET_ProximityOut + 1; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadImplementation); - - ev.type = ET_ProximityIn; + ev.type = evtype; rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadMatch); + g_assert(rc == expected_rc); +} - ev.type = ET_ProximityOut; - rc = EventToCore((InternalEvent*)&ev, &core); - g_assert(rc == BadMatch); +static void dix_event_to_core_conversion(void) +{ + dix_event_to_core_fail(0, BadImplementation); + dix_event_to_core_fail(1, BadImplementation); + dix_event_to_core_fail(ET_ProximityOut + 1, BadImplementation); + dix_event_to_core_fail(ET_ProximityIn, BadMatch); + dix_event_to_core_fail(ET_ProximityOut, BadMatch); dix_event_to_core(ET_KeyPress); dix_event_to_core(ET_KeyRelease); @@ -1017,7 +1010,8 @@ static void dix_input_valuator_masks(void) g_assert(valuator_mask_get(mask, i) == valuator_mask_get(copy, i)); } - free(mask); + valuator_mask_free(&mask); + g_assert(mask == NULL); } static void dix_valuator_mode(void) diff --git a/test/xi2/protocol-eventconvert.c b/test/xi2/protocol-eventconvert.c index 211cce6ad..0478c33fe 100644 --- a/test/xi2/protocol-eventconvert.c +++ b/test/xi2/protocol-eventconvert.c @@ -272,6 +272,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out, int buttons, valuators; int i; unsigned char *ptr; + uint32_t flagmask = 0; FP3232 *values; if (swap) { @@ -297,6 +298,7 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out, swapl(&out->mods.latched_mods, n); swapl(&out->mods.locked_mods, n); swapl(&out->mods.effective_mods, n); + swapl(&out->flags, n); } g_assert(out->extension == 0); /* IReqCode defaults to 0 */ @@ -308,7 +310,15 @@ static void test_values_XIDeviceEvent(DeviceEvent *in, xXIDeviceEvent *out, g_assert(out->deviceid == in->deviceid); g_assert(out->sourceid == in->sourceid); - g_assert(out->flags == 0); /* FIXME: we don't set the flags yet */ + switch (in->type) { + case ET_KeyPress: + flagmask = XIKeyRepeat; + break; + default: + flagmask = 0; + break; + } + g_assert((out->flags & ~flagmask) == 0); g_assert(out->root == in->root); g_assert(out->event == None); /* set in FixUpEventFromWindow */ diff --git a/test/xi2/protocol-xiselectevents.c b/test/xi2/protocol-xiselectevents.c index fe1c26df8..f951a14fe 100644 --- a/test/xi2/protocol-xiselectevents.c +++ b/test/xi2/protocol-xiselectevents.c @@ -131,7 +131,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) { int i, j; xXIEventMask *mask; - int nmasks = (XI_LASTEVENT + 7)/8; + int nmasks = (XI2LASTEVENT + 7)/8; unsigned char *bits; mask = (xXIEventMask*)&req[1]; @@ -150,14 +150,14 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) request_XISelectEvent(req, Success); /* Test 1: - * mask may be larger than needed for XI_LASTEVENT. + * mask may be larger than needed for XI2LASTEVENT. * Test setting each valid mask bit, while leaving unneeded bits 0. * -> Success */ bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4 * 10; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) { SetBit(bits, j); request_XISelectEvent(req, Success); @@ -165,7 +165,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) } /* Test 2: - * mask may be larger than needed for XI_LASTEVENT. + * mask may be larger than needed for XI2LASTEVENT. * Test setting all valid mask bits, while leaving unneeded bits 0. * -> Success */ @@ -173,21 +173,21 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) mask->mask_len = (nmasks + 3)/4 * 10; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) { SetBit(bits, j); request_XISelectEvent(req, Success); } /* Test 3: - * mask is larger than needed for XI_LASTEVENT. If any unneeded bit + * mask is larger than needed for XI2LASTEVENT. If any unneeded bit * is set -> BadValue */ bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4 * 10; memset(bits, 0, mask->mask_len * 4); - for (j = XI_LASTEVENT + 1; j < mask->mask_len * 4; j++) + for (j = XI2LASTEVENT + 1; j < mask->mask_len * 4; j++) { SetBit(bits, j); request_XISelectEvent(req, BadValue); @@ -200,7 +200,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) { SetBit(bits, j); request_XISelectEvent(req, Success); @@ -228,7 +228,7 @@ static void request_XISelectEvents_masks(xXISelectEventsReq *req) bits = (unsigned char*)&mask[1]; mask->mask_len = (nmasks + 3)/4; memset(bits, 0, mask->mask_len * 4); - for (j = 0; j <= XI_LASTEVENT; j++) + for (j = 0; j <= XI2LASTEVENT; j++) SetBit(bits, j); ClearBit(bits, XI_HierarchyChanged); for (j = 1; j < 6; j++) diff --git a/xkb/XKBMisc.c b/xkb/XKBMisc.c index efe291103..96688be18 100644 --- a/xkb/XKBMisc.c +++ b/xkb/XKBMisc.c @@ -454,11 +454,12 @@ unsigned changed,tmp; } if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; - old= xkb->ctrls->per_key_repeat[key/8]; + old= BitIsOn(xkb->ctrls->per_key_repeat, key); if (interps[0]->flags&XkbSI_AutoRepeat) - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); - else xkb->ctrls->per_key_repeat[key/8]&= ~(1<<(key%8)); - if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) + SetBit(xkb->ctrls->per_key_repeat, key); + else + ClearBit(xkb->ctrls->per_key_repeat, key); + if (changes && old != BitIsOn(xkb->ctrls->per_key_repeat, key)) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } } @@ -466,9 +467,9 @@ unsigned changed,tmp; if ((!found)||(interps[0]==NULL)) { if (((explicit&XkbExplicitAutoRepeatMask)==0)&&(xkb->ctrls)) { CARD8 old; - old= xkb->ctrls->per_key_repeat[key/8]; - xkb->ctrls->per_key_repeat[key/8]|= (1<<(key%8)); - if (changes && (old!=xkb->ctrls->per_key_repeat[key/8])) + old = BitIsOn(xkb->ctrls->per_key_repeat, key); + SetBit(xkb->ctrls->per_key_repeat, key); + if (changes && (old != BitIsOn(xkb->ctrls->per_key_repeat, key))) changes->ctrls.changed_ctrls|= XkbPerKeyRepeatMask; } if (((explicit&XkbExplicitBehaviorMask)==0)&& diff --git a/xkb/ddxLoad.c b/xkb/ddxLoad.c index e6904a501..51b577725 100644 --- a/xkb/ddxLoad.c +++ b/xkb/ddxLoad.c @@ -45,10 +45,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include <X11/extensions/XI.h> #include "xkb.h" -#if defined(CSRG_BASED) || defined(linux) || defined(__GNU__) -#include <paths.h> -#endif - /* * If XKM_OUTPUT_DIR specifies a path without a leading slash, it is * relative to the top-level XKB configuration directory. diff --git a/xkb/xkbUtils.c b/xkb/xkbUtils.c index 14dc784b8..3a56bea4c 100644 --- a/xkb/xkbUtils.c +++ b/xkb/xkbUtils.c @@ -342,15 +342,18 @@ CARD8 * repeat; xkb= xkbi->desc; repeat= xkb->ctrls->per_key_repeat; + /* before letting XKB do any changes, copy the current core values */ if (pXDev->kbdfeed) memcpy(repeat,pXDev->kbdfeed->ctrl.autoRepeats,XkbPerKeyBitArraySize); XkbUpdateDescActions(xkb,first,num,changes); if ((pXDev->kbdfeed)&& - (changes->ctrls.enabled_ctrls_changes&XkbPerKeyRepeatMask)) { - memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize); - (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl); + (changes->ctrls.changed_ctrls&XkbPerKeyRepeatMask)) { + /* now copy the modified changes back to core */ + memcpy(pXDev->kbdfeed->ctrl.autoRepeats,repeat, XkbPerKeyBitArraySize); + if (pXDev->kbdfeed->CtrlProc) + (*pXDev->kbdfeed->CtrlProc)(pXDev, &pXDev->kbdfeed->ctrl); } return; } |