diff options
Diffstat (limited to 'xorg-server')
41 files changed, 733 insertions, 658 deletions
diff --git a/xorg-server/autogen.sh b/xorg-server/autogen.sh index 8b6f58f69..dd0731ad9 100644 --- a/xorg-server/autogen.sh +++ b/xorg-server/autogen.sh @@ -9,4 +9,6 @@ cd $srcdir autoreconf --force -v --install || exit 1 cd $ORIGDIR || exit $? -$srcdir/configure "$@" +if test -z "$NOCONFIGURE"; then + exec $srcdir/configure "$@" +fi diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index e6866140e..b6ed92cb3 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -811,7 +811,7 @@ LIBPCIACCESS="pciaccess >= 0.12.901" LIBUDEV="libudev >= 143" LIBSELINUX="libselinux >= 2.0.86" LIBDBUS="dbus-1 >= 1.0" -LIBPIXMAN="pixman-1 >= 0.21.8" +LIBPIXMAN="pixman-1 >= 0.27.2" dnl Pixman is always required, but we separate it out so we can link dnl specific modules against it diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 8f208933b..f30407a4e 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -448,6 +448,7 @@ DisableDevice(DeviceIntPtr dev, BOOL sendevent) if (*prev != dev) return FALSE; + TouchEndPhysicallyActiveTouches(dev); ReleaseButtonsAndKeys(dev); SyncRemoveDeviceIdleTime(dev->idle_counter); dev->idle_counter = NULL; diff --git a/xorg-server/dix/grabs.c b/xorg-server/dix/grabs.c index 83e18e263..fe7967415 100644 --- a/xorg-server/dix/grabs.c +++ b/xorg-server/dix/grabs.c @@ -179,7 +179,8 @@ UngrabAllDevices(Bool kill_client) continue; PrintDeviceGrabInfo(dev); client = clients[CLIENT_ID(dev->deviceGrab.grab->resource)]; - dev->deviceGrab.DeactivateGrab(dev); + if (!kill_client || !client || client->clientGone) + dev->deviceGrab.DeactivateGrab(dev); if (kill_client) CloseDownClient(client); } diff --git a/xorg-server/dix/touch.c b/xorg-server/dix/touch.c index 497ad7dac..e64a6262c 100644 --- a/xorg-server/dix/touch.c +++ b/xorg-server/dix/touch.c @@ -1029,3 +1029,31 @@ TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode, return TouchListenerAcceptReject(dev, ti, i, mode); } + +/** + * End physically active touches for a device. + */ +void +TouchEndPhysicallyActiveTouches(DeviceIntPtr dev) +{ + InternalEvent *eventlist = InitEventList(GetMaximumEventsNum()); + int i; + + OsBlockSignals(); + mieqProcessInputEvents(); + for (i = 0; i < dev->last.num_touches; i++) { + DDXTouchPointInfoPtr ddxti = dev->last.touches + i; + + if (ddxti->active) { + int j; + int nevents = GetTouchEvents(eventlist, dev, ddxti->ddx_id, + XI_TouchEnd, 0, NULL); + + for (j = 0; j < nevents; j++) + mieqProcessDeviceEvent(dev, eventlist + j, NULL); + } + } + OsReleaseSignals(); + + FreeEventList(eventlist, GetMaximumEventsNum()); +} diff --git a/xorg-server/exa/exa_priv.h b/xorg-server/exa/exa_priv.h index 70075786a..1f5605687 100644 --- a/xorg-server/exa/exa_priv.h +++ b/xorg-server/exa/exa_priv.h @@ -208,6 +208,7 @@ typedef struct { RegionRec srcReg; RegionRec maskReg; PixmapPtr srcPix; + PixmapPtr maskPix; DevPrivateKeyRec pixmapPrivateKeyRec; DevPrivateKeyRec gcPrivateKeyRec; diff --git a/xorg-server/exa/exa_unaccel.c b/xorg-server/exa/exa_unaccel.c index fc0f6c42e..3bfbb4fe9 100644 --- a/xorg-server/exa/exa_unaccel.c +++ b/xorg-server/exa/exa_unaccel.c @@ -442,6 +442,13 @@ ExaSrcValidate(DrawablePtr pDrawable, RegionPtr dst; int xoff, yoff; + if (pExaScr->srcPix == pPix) + dst = &pExaScr->srcReg; + else if (pExaScr->maskPix == pPix) + dst = &pExaScr->maskReg; + else + return; + exaGetDrawableDeltas(pDrawable, pPix, &xoff, &yoff); box.x1 = x + xoff; @@ -449,8 +456,6 @@ ExaSrcValidate(DrawablePtr pDrawable, box.x2 = box.x1 + width; box.y2 = box.y1 + height; - dst = (pExaScr->srcPix == pPix) ? &pExaScr->srcReg : &pExaScr->maskReg; - RegionInit(®, &box, 1); RegionUnion(dst, dst, ®); RegionUninit(®); @@ -495,16 +500,19 @@ ExaPrepareCompositeReg(ScreenPtr pScreen, if (pSrc != pDst) RegionTranslate(pSrc->pCompositeClip, -pSrc->pDrawable->x, -pSrc->pDrawable->y); - } + } else + pExaScr->srcPix = NULL; if (pMask && pMask->pDrawable) { pMaskPix = exaGetDrawablePixmap(pMask->pDrawable); RegionNull(&pExaScr->maskReg); maskReg = &pExaScr->maskReg; + pExaScr->maskPix = pMaskPix; if (pMask != pDst && pMask != pSrc) RegionTranslate(pMask->pCompositeClip, -pMask->pDrawable->x, -pMask->pDrawable->y); - } + } else + pExaScr->maskPix = NULL; RegionTranslate(pDst->pCompositeClip, -pDst->pDrawable->x, -pDst->pDrawable->y); diff --git a/xorg-server/fb/fb.h b/xorg-server/fb/fb.h index 728b04444..248e9d86e 100644 --- a/xorg-server/fb/fb.h +++ b/xorg-server/fb/fb.h @@ -1321,6 +1321,9 @@ extern _X_EXPORT void extern _X_EXPORT Bool fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats); +extern _X_EXPORT void +fbDestroyGlyphCache(void); + /* * fbpixmap.c */ diff --git a/xorg-server/fb/fbpict.c b/xorg-server/fb/fbpict.c index 097a1a6bd..2804ff481 100644 --- a/xorg-server/fb/fbpict.c +++ b/xorg-server/fb/fbpict.c @@ -70,6 +70,156 @@ fbComposite(CARD8 op, free_pixman_pict(pDst, dest); } +static pixman_glyph_cache_t *glyphCache; + +void +fbDestroyGlyphCache(void) +{ + if (glyphCache) + { + pixman_glyph_cache_destroy (glyphCache); + glyphCache = NULL; + } +} + +static void +fbUnrealizeGlyph(ScreenPtr pScreen, + GlyphPtr pGlyph) +{ + if (glyphCache) + pixman_glyph_cache_remove (glyphCache, pGlyph, NULL); +} + +static void +fbGlyphs(CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, int nlist, + GlyphListPtr list, + GlyphPtr *glyphs) +{ +#define N_STACK_GLYPHS 512 + ScreenPtr pScreen = pDst->pDrawable->pScreen; + pixman_glyph_t stack_glyphs[N_STACK_GLYPHS]; + pixman_glyph_t *pglyphs = stack_glyphs; + pixman_image_t *srcImage, *dstImage; + int srcXoff, srcYoff, dstXoff, dstYoff; + GlyphPtr glyph; + int n_glyphs; + int x, y; + int i, n; + int xDst = list->xOff, yDst = list->yOff; + + miCompositeSourceValidate(pSrc); + + n_glyphs = 0; + for (i = 0; i < nlist; ++i) + n_glyphs += list[i].len; + + if (!glyphCache) + glyphCache = pixman_glyph_cache_create(); + + pixman_glyph_cache_freeze (glyphCache); + + if (n_glyphs > N_STACK_GLYPHS) { + if (!(pglyphs = malloc (n_glyphs * sizeof (pixman_glyph_t)))) + goto out; + } + + i = 0; + x = y = 0; + while (nlist--) { + x += list->xOff; + y += list->yOff; + n = list->len; + while (n--) { + const void *g; + + glyph = *glyphs++; + + if (!(g = pixman_glyph_cache_lookup (glyphCache, glyph, NULL))) { + pixman_image_t *glyphImage; + PicturePtr pPicture; + int xoff, yoff; + + pPicture = GetGlyphPicture(glyph, pScreen); + if (!pPicture) { + n_glyphs--; + goto next; + } + + if (!(glyphImage = image_from_pict(pPicture, FALSE, &xoff, &yoff))) + goto out; + + g = pixman_glyph_cache_insert(glyphCache, glyph, NULL, + glyph->info.x, + glyph->info.y, + glyphImage); + + free_pixman_pict(pPicture, glyphImage); + + if (!g) + goto out; + } + + pglyphs[i].x = x; + pglyphs[i].y = y; + pglyphs[i].glyph = g; + i++; + + next: + x += glyph->info.xOff; + y += glyph->info.yOff; + } + list++; + } + + if (!(srcImage = image_from_pict(pSrc, FALSE, &srcXoff, &srcYoff))) + goto out; + + if (!(dstImage = image_from_pict(pDst, TRUE, &dstXoff, &dstYoff))) + goto out_free_src; + + if (maskFormat) { + pixman_format_code_t format; + pixman_box32_t extents; + int x, y; + + format = maskFormat->format | (maskFormat->depth << 24); + + pixman_glyph_get_extents(glyphCache, n_glyphs, pglyphs, &extents); + + x = extents.x1; + y = extents.y1; + + pixman_composite_glyphs(op, srcImage, dstImage, format, + xSrc + srcXoff + xDst, ySrc + srcYoff + yDst, + x, y, + x + dstXoff, y + dstYoff, + extents.x2 - extents.x1, + extents.y2 - extents.y1, + glyphCache, n_glyphs, pglyphs); + } + else { + pixman_composite_glyphs_no_mask(op, srcImage, dstImage, + xSrc + srcXoff - xDst, ySrc + srcYoff - yDst, + dstXoff, dstYoff, + glyphCache, n_glyphs, pglyphs); + } + + free_pixman_pict(pDst, dstImage); + +out_free_src: + free_pixman_pict(pSrc, srcImage); + +out: + pixman_glyph_cache_thaw(glyphCache); + if (pglyphs != stack_glyphs) + free(pglyphs); +} + static pixman_image_t * create_solid_fill_image(PicturePtr pict) { @@ -357,7 +507,8 @@ fbPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) return FALSE; ps = GetPictureScreen(pScreen); ps->Composite = fbComposite; - ps->Glyphs = miGlyphs; + ps->Glyphs = fbGlyphs; + ps->UnrealizeGlyph = fbUnrealizeGlyph; ps->CompositeRects = miCompositeRects; ps->RasterizeTrapezoid = fbRasterizeTrapezoid; ps->Trapezoids = fbTrapezoids; diff --git a/xorg-server/fb/fbscreen.c b/xorg-server/fb/fbscreen.c index 7c7d6560e..f9080a445 100644 --- a/xorg-server/fb/fbscreen.c +++ b/xorg-server/fb/fbscreen.c @@ -32,6 +32,7 @@ fbCloseScreen(ScreenPtr pScreen) int d; DepthPtr depths = pScreen->allowedDepths; + fbDestroyGlyphCache(); for (d = 0; d < pScreen->numDepths; d++) free(depths[d].vids); free(depths); diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h index 059026243..4c2d147a2 100644 --- a/xorg-server/hw/xfree86/common/xf86str.h +++ b/xorg-server/hw/xfree86/common/xf86str.h @@ -347,7 +347,7 @@ typedef struct _DriverRec { */ /* Tolerate prior #include <linux/input.h> */ -#if defined(linux) && defined(_INPUT_H) +#if defined(linux) #undef BUS_NONE #undef BUS_PCI #undef BUS_SBUS diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 53388a093..eb6165e38 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -76,11 +76,6 @@ static void winClipboardShutdown(void); #endif -#if defined(DDXOSVERRORF) -void - OsVendorVErrorF(const char *pszFormat, va_list va_args); -#endif - static Bool winCheckDisplayNumber(void); @@ -295,11 +290,11 @@ winCheckMount(void) } while ((ent = getmntent(mnt)) != NULL) { - BOOL system = (winCheckMntOpt(ent, "user") != NULL); + BOOL sys = (winCheckMntOpt(ent, "user") != NULL); BOOL root = (strcmp(ent->mnt_dir, "/") == 0); BOOL tmp = (strcmp(ent->mnt_dir, "/tmp") == 0); - if (system) { + if (sys) { if (root) curlevel = sys_root; else if (tmp) @@ -924,7 +919,7 @@ ddxUseMsg(void) */ void -InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) +InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) { int i; @@ -959,15 +954,15 @@ InitOutput(ScreenInfo * screenInfo, int argc, char *argv[]) LoadPreferences(); /* Setup global screen info parameters */ - screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; - screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; - screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - screenInfo->numPixmapFormats = NUMFORMATS; + pScreenInfo->imageByteOrder = IMAGE_BYTE_ORDER; + pScreenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; + pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; + pScreenInfo->numPixmapFormats = NUMFORMATS; /* Describe how we want common pixmap formats padded */ for (i = 0; i < NUMFORMATS; i++) { - screenInfo->formats[i] = g_PixmapFormats[i]; + pScreenInfo->formats[i] = g_PixmapFormats[i]; } /* Load pointers to DirectDraw functions */ diff --git a/xorg-server/hw/xwin/Makefile.am b/xorg-server/hw/xwin/Makefile.am index 003a9a272..eaf475fff 100644 --- a/xorg-server/hw/xwin/Makefile.am +++ b/xorg-server/hw/xwin/Makefile.am @@ -95,7 +95,6 @@ SRCS = InitInput.c \ winprefsyacc.y \ winprefslex.l \ winprocarg.c \ - winregistry.c \ winscrinit.c \ winshaddd.c \ winshadddnl.c \ diff --git a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py index d45e7aea9..6e92e9edb 100644 --- a/xorg-server/hw/xwin/glx/gen_gl_wrappers.py +++ b/xorg-server/hw/xwin/glx/gen_gl_wrappers.py @@ -146,9 +146,8 @@ for line in glspec : arglist_use = m1.group(2) wrappers[function] = {} - # near and far might be reserved words or macros so can't be used as formal parameter names - arglist_use = arglist_use.replace('near','zNear') - arglist_use = arglist_use.replace('far','zFar') + # ensure formal parameter names don't collide with reserved names or shadow global declarations + arglist_use = ',' .join([i.rstrip() + '_' for i in arglist_use.split(",")]) wrappers[function]['arglist_use'] = arglist_use param_count = 0 @@ -217,9 +216,8 @@ for w in sorted(wrappers.keys()) : if k.startswith('param') : l = wrappers[w][k].split() - # near and far might be reserved words or macros so can't be used as formal parameter names - l[0] = l[0].replace('near','zNear') - l[0] = l[0].replace('far','zFar') + # ensure formal parameter names don't collide with reserved names or shadow global declarations + l[0] = l[0] + '_' if l[2] == 'in' : if l[3] == 'array' : diff --git a/xorg-server/hw/xwin/glx/glwrap.c b/xorg-server/hw/xwin/glx/glwrap.c index 21a42aa9c..18d3521e0 100644 --- a/xorg-server/hw/xwin/glx/glwrap.c +++ b/xorg-server/hw/xwin/glx/glwrap.c @@ -70,7 +70,7 @@ glWinCallDelta(void) #endif static PROC -glWinResolveHelper(PROC * cache, char *symbol) +glWinResolveHelper(PROC * cache, const char *symbol) { PROC proc = NULL; diff --git a/xorg-server/hw/xwin/glx/indirect.c b/xorg-server/hw/xwin/glx/indirect.c index 830d00e19..c1eb254f2 100644 --- a/xorg-server/hw/xwin/glx/indirect.c +++ b/xorg-server/hw/xwin/glx/indirect.c @@ -1809,15 +1809,15 @@ glxWinCreateContext(__GLXscreen * screen, */ static int -GetShift(int Mask) +GetShift(int mask) { - int Shift = 0; + int shift = 0; - while ((Mask &1) == 0) { - Shift++; - Mask >>=1; + while ((mask &1) == 0) { + shift++; + mask >>=1; } - return Shift; + return shift; } static int diff --git a/xorg-server/hw/xwin/makefile b/xorg-server/hw/xwin/makefile index 8523d0f26..82585a025 100644 --- a/xorg-server/hw/xwin/makefile +++ b/xorg-server/hw/xwin/makefile @@ -104,7 +104,6 @@ SRCS = InitInput.c \ winprefsyacc.y \ winprefslex.l \ winprocarg.c \ - winregistry.c \ winscrinit.c \ winshaddd.c \ winshadddnl.c \ diff --git a/xorg-server/hw/xwin/win.h b/xorg-server/hw/xwin/win.h index 37e8e3d43..9c474cba3 100644 --- a/xorg-server/hw/xwin/win.h +++ b/xorg-server/hw/xwin/win.h @@ -825,11 +825,13 @@ void #ifdef DDXOSVERRORF void - OSVenderVErrorF(const char *pszFormat, va_list va_args); +OsVendorVErrorF(const char *pszFormat, va_list va_args) +_X_ATTRIBUTE_PRINTF(1, 0); #endif void - winMessageBoxF(const char *pszError, UINT uType, ...); +winMessageBoxF(const char *pszError, UINT uType, ...) +_X_ATTRIBUTE_PRINTF(1, 3); #ifdef XWIN_NATIVEGDI /* @@ -1020,18 +1022,6 @@ void winPolyLineNativeGDI(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr ppt); #endif - -#ifdef XWIN_NATIVEGDI -/* - * winpushpxl.c - */ - -void - -winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, - int dx, int dy, int xOrg, int yOrg); -#endif - /* * winscrinit.c */ diff --git a/xorg-server/hw/xwin/winallpriv.c b/xorg-server/hw/xwin/winallpriv.c index a263d3a7f..248d03658 100644 --- a/xorg-server/hw/xwin/winallpriv.c +++ b/xorg-server/hw/xwin/winallpriv.c @@ -108,7 +108,7 @@ winAllocatePrivates(ScreenPtr pScreen) */ Bool -winInitCmapPrivates(ColormapPtr pcmap, int index) +winInitCmapPrivates(ColormapPtr pcmap, int i) { winDebug("winInitCmapPrivates\n"); diff --git a/xorg-server/hw/xwin/winclipboard.h b/xorg-server/hw/xwin/winclipboard.h index a267dec7c..7d5db98fe 100644 --- a/xorg-server/hw/xwin/winclipboard.h +++ b/xorg-server/hw/xwin/winclipboard.h @@ -98,7 +98,7 @@ void winClipboardDOStoUNIX(char *pszData, int iLength); void - winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength); + winClipboardUNIXtoDOS(char **ppszData, int iLength); /* * winclipboardthread.c diff --git a/xorg-server/hw/xwin/winclipboardtextconv.c b/xorg-server/hw/xwin/winclipboardtextconv.c index 74a351b17..fd405a02e 100644 --- a/xorg-server/hw/xwin/winclipboardtextconv.c +++ b/xorg-server/hw/xwin/winclipboardtextconv.c @@ -38,7 +38,7 @@ void winClipboardDOStoUNIX(char *pszSrc, int iLength); void - winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength); + winClipboardUNIXtoDOS(char **ppszData, int iLength); /* * Convert \r\n to \n @@ -75,12 +75,12 @@ winClipboardDOStoUNIX(char *pszSrc, int iLength) */ void -winClipboardUNIXtoDOS(unsigned char **ppszData, int iLength) +winClipboardUNIXtoDOS(char **ppszData, int iLength) { int iNewlineCount = 0; - unsigned char *pszSrc = *ppszData; - unsigned char *pszEnd = pszSrc + iLength; - unsigned char *pszDest = NULL, *pszDestBegin = NULL; + char *pszSrc = *ppszData; + char *pszEnd = pszSrc + iLength; + char *pszDest = NULL, *pszDestBegin = NULL; winDebug("UNIXtoDOS () - Original data:'%s'\n", *ppszData); diff --git a/xorg-server/hw/xwin/winclipboardthread.c b/xorg-server/hw/xwin/winclipboardthread.c index eb32db88c..c0069e329 100644 --- a/xorg-server/hw/xwin/winclipboardthread.c +++ b/xorg-server/hw/xwin/winclipboardthread.c @@ -51,7 +51,6 @@ */ extern Bool g_fUnicodeClipboard; -extern unsigned long serverGeneration; extern Bool g_fClipboardStarted; extern Bool g_fClipboardLaunched; extern HWND g_hwndClipboard; diff --git a/xorg-server/hw/xwin/winclipboardwrappers.c b/xorg-server/hw/xwin/winclipboardwrappers.c index 247c8ea43..09fbfd3aa 100644 --- a/xorg-server/hw/xwin/winclipboardwrappers.c +++ b/xorg-server/hw/xwin/winclipboardwrappers.c @@ -49,9 +49,6 @@ * Local function prototypes */ -int winProcEstablishConnection(ClientPtr /* client */ ); -int winProcSetSelectionOwner(ClientPtr /* client */ ); - DISPATCH_PROC(winProcEstablishConnection); DISPATCH_PROC(winProcSetSelectionOwner); @@ -59,10 +56,8 @@ DISPATCH_PROC(winProcSetSelectionOwner); * References to external symbols */ -extern int g_iNumScreens; extern unsigned int g_uiAuthDataLen; extern char *g_pAuthData; -extern Bool g_fXdmcpEnabled; extern Bool g_fClipboardLaunched; extern Bool g_fClipboardStarted; extern Bool g_fClipboard; @@ -71,8 +66,6 @@ extern Atom g_atomLastOwnedSelection; extern HWND g_hwndClipboard; extern Bool g_fClipboardPrimary; -extern winDispatchProcPtr winProcEstablishConnectionOrig; -extern winDispatchProcPtr winProcSetSelectionOwnerOrig; /* * Wrapper for internal EstablishConnection function. diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c index 57825af72..5d36aa89f 100644 --- a/xorg-server/hw/xwin/winconfig.c +++ b/xorg-server/hw/xwin/winconfig.c @@ -81,7 +81,8 @@ WinCmdlineRec g_cmdline = { 0 /* emulate3Timeout */ }; -winInfoRec g_winInfo = { +winInfoRec +g_winInfo = { { /* keyboard */ 0, /* leds */ 500, /* delay */ @@ -335,10 +336,10 @@ winConfigKeyboard(DeviceIntPtr pDevice) pLayout->xkbvariant ? pLayout->xkbvariant : "none", pLayout->xkboptions ? pLayout->xkboptions : "none"); - g_winInfo.xkb.model = pLayout->xkbmodel; - g_winInfo.xkb.layout = pLayout->xkblayout; - g_winInfo.xkb.variant = pLayout->xkbvariant; - g_winInfo.xkb.options = pLayout->xkboptions; + g_winInfo.xkb.model = (char *)pLayout->xkbmodel; + g_winInfo.xkb.layout = (char *)pLayout->xkblayout; + g_winInfo.xkb.variant = (char *)pLayout->xkbvariant; + g_winInfo.xkb.options = (char *)pLayout->xkboptions; break; } diff --git a/xorg-server/hw/xwin/wincursor.c b/xorg-server/hw/xwin/wincursor.c index 8f4130207..77cf1c13f 100644 --- a/xorg-server/hw/xwin/wincursor.c +++ b/xorg-server/hw/xwin/wincursor.c @@ -157,7 +157,6 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) HBITMAP hAnd, hXor; ICONINFO ii; unsigned char *pCur; - int x, y; unsigned char bit; HDC hDC; BITMAPV4HEADER bi; @@ -261,6 +260,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) sizeof(unsigned long)); if (lpBits) { + int y; for (y = 0; y < nCY; y++) { unsigned long *src, *dst; @@ -304,6 +304,7 @@ winLoadCursor(ScreenPtr pScreen, CursorPtr pCursor, int screen) pCur = (unsigned char *) lpBits; if (lpBits) { + int x, y; for (y = 0; y < pScreenPriv->cursor.sm_cy; y++) { for (x = 0; x < pScreenPriv->cursor.sm_cx; x++) { if (x >= nCX || y >= nCY) /* Outside of X11 icon bounds */ diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c index 9638bdcb1..ed9ee296e 100644 --- a/xorg-server/hw/xwin/winerror.c +++ b/xorg-server/hw/xwin/winerror.c @@ -37,10 +37,6 @@ extern Bool g_fSilentDupError; #ifdef DDXOSVERRORF -/* Prototype */ -void - OsVendorVErrorF(const char *pszFormat, va_list va_args); - void OsVendorVErrorF(const char *pszFormat, va_list va_args) { diff --git a/xorg-server/hw/xwin/wingc.c b/xorg-server/hw/xwin/wingc.c index 0ad64676d..259d2e29d 100644 --- a/xorg-server/hw/xwin/wingc.c +++ b/xorg-server/hw/xwin/wingc.c @@ -33,11 +33,6 @@ #endif #include "win.h" -void - -winPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable, int dx, - int dy, int xOrg, int yOrg); - /* * Local prototypes */ diff --git a/xorg-server/hw/xwin/winlayouts.h b/xorg-server/hw/xwin/winlayouts.h index 82da2da63..0aae18b00 100644 --- a/xorg-server/hw/xwin/winlayouts.h +++ b/xorg-server/hw/xwin/winlayouts.h @@ -30,11 +30,11 @@ typedef struct { unsigned int winlayout; int winkbtype; - char *xkbmodel; - char *xkblayout; - char *xkbvariant; - char *xkboptions; - char *layoutname; + const char *xkbmodel; + const char *xkblayout; + const char *xkbvariant; + const char *xkboptions; + const char *layoutname; } WinKBLayoutRec, *WinKBLayoutPtr; /* diff --git a/xorg-server/hw/xwin/winmonitors.c b/xorg-server/hw/xwin/winmonitors.c index ab8842a32..916b8b0bb 100644 --- a/xorg-server/hw/xwin/winmonitors.c +++ b/xorg-server/hw/xwin/winmonitors.c @@ -30,6 +30,7 @@ from The Open Group. #ifdef HAVE_XWIN_CONFIG_H #include <xwin-config.h> #endif + #include "win.h" #define COMPILE_MULTIMON_STUBS #include <multimon.h> @@ -60,13 +61,13 @@ getMonitorInfo(HMONITOR hMonitor, HDC hdc, LPRECT rect, LPARAM _data) } Bool -QueryMonitor(int index, struct GetMonitorInfoData *data) +QueryMonitor(int i, struct GetMonitorInfoData *data) { /* prepare data */ if (data == NULL) return FALSE; memset(data, 0, sizeof(*data)); - data->requestedMonitor = index; + data->requestedMonitor = i; /* query information */ return !EnumDisplayMonitors(NULL, NULL, getMonitorInfo, (LPARAM) data); diff --git a/xorg-server/hw/xwin/winmultiwindowwm.c b/xorg-server/hw/xwin/winmultiwindowwm.c index 662664b8a..5d547dbdd 100644 --- a/xorg-server/hw/xwin/winmultiwindowwm.c +++ b/xorg-server/hw/xwin/winmultiwindowwm.c @@ -140,13 +140,6 @@ typedef struct _XMsgProcArgRec { } XMsgProcArgRec, *XMsgProcArgPtr; /* - * References to external symbols - */ - -extern char *display; -extern void ErrorF(const char * /*f */ , ...); - -/* * Prototypes for local functions */ @@ -496,7 +489,6 @@ getHwnd(WMInfoPtr pWMInfo, Window iWindow) static void UpdateName(WMInfoPtr pWMInfo, Window iWindow) { - wchar_t *pszName; HWND hWnd; XWindowAttributes attr; diff --git a/xorg-server/hw/xwin/winprefs.c b/xorg-server/hw/xwin/winprefs.c index c66e11396..5becf23a0 100644 --- a/xorg-server/hw/xwin/winprefs.c +++ b/xorg-server/hw/xwin/winprefs.c @@ -59,9 +59,6 @@ extern int parse_file(FILE * fp); /* Currently in use command ID, incremented each new menu item created */ static int g_cmdid = STARTMENUID; -/* Defined in DIX */ -extern char *display; - /* Local function to handle comma-ified icon names */ static HICON LoadImageComma(char *fname, int sx, int sy, int flags); @@ -332,12 +329,12 @@ HandleCustomWM_COMMAND(unsigned long hwndIn, int command) case CMD_EXEC: if (fork() == 0) { struct rlimit rl; - unsigned long i; + int fd; /* Close any open descriptors except for STD* */ getrlimit(RLIMIT_NOFILE, &rl); - for (i = STDERR_FILENO + 1; i < rl.rlim_cur; i++) - close(i); + for (fd = STDERR_FILENO + 1; fd < rl.rlim_cur; fd++) + close(fd); /* Disassociate any TTYs */ setsid(); @@ -540,21 +537,21 @@ static HICON LoadImageComma(char *fname, int sx, int sy, int flags) { HICON hicon; - int index; + int i; char file[PATH_MAX + NAME_MAX + 2]; /* Some input error checking */ if (!fname || !fname[0]) return NULL; - index = 0; + i = 0; hicon = NULL; if (fname[0] == ',') { /* It's the XWIN.EXE resource they want */ - index = atoi(fname + 1); + i = atoi(fname + 1); hicon = LoadImage(g_hInstance, - MAKEINTRESOURCE(index), IMAGE_ICON, sx, sy, flags); + MAKEINTRESOURCE(i), IMAGE_ICON, sx, sy, flags); } else { file[0] = 0; @@ -571,8 +568,8 @@ LoadImageComma(char *fname, int sx, int sy, int flags) /* Specified as <fname>,<index> */ *(strrchr(file, ',')) = 0; /* End string at comma */ - index = atoi(strrchr(fname, ',') + 1); - hicon = ExtractIcon(g_hInstance, file, index); + i = atoi(strrchr(fname, ',') + 1); + hicon = ExtractIcon(g_hInstance, file, i); } else { /* Just an .ico file... */ diff --git a/xorg-server/hw/xwin/winprefslex.l b/xorg-server/hw/xwin/winprefslex.l index 83204b61c..66d12ede7 100644 --- a/xorg-server/hw/xwin/winprefslex.l +++ b/xorg-server/hw/xwin/winprefslex.l @@ -37,12 +37,8 @@ #include <string.h> #include "winprefsyacc.h" -extern YYSTYPE yylval; -extern char *yytext; extern int yyparse(void); -int yylineno; - /* Copy the parsed string, must be free()d in yacc parser */ static char *makestr(char *str) { @@ -60,6 +56,9 @@ static char *makestr(char *str) %} %option yylineno +%option nounput +%option noinput +%option never-interactive %% \#.*[\r\n] { /* comment */ return NEWLINE; } diff --git a/xorg-server/hw/xwin/winprefsyacc.y b/xorg-server/hw/xwin/winprefsyacc.y index b9e961622..ff051f233 100644 --- a/xorg-server/hw/xwin/winprefsyacc.y +++ b/xorg-server/hw/xwin/winprefsyacc.y @@ -1,460 +1,461 @@ -%{
-/*
- * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved.
- * Copyright (C) Colin Harrison 2005-2008
- *
- * 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.
- *
- * Authors: Earle F. Philhower, III
- * Colin Harrison
- */
-/* $XFree86: $ */
-
-#ifdef HAVE_XWIN_CONFIG_H
-#include <xwin-config.h>
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include "winprefs.h"
-#include "winmsg.h"
-
-/* The following give better error messages in bison at the cost of a few KB */
-#define YYERROR_VERBOSE 1
-
-/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */
-#define YYLTYPE_IS_TRIVIAL 1
-#define YYENABLE_NLS 0
-
-/* The global pref settings */
-WINPREFS pref;
-
-/* The working menu */
-static MENUPARSED menu;
-
-/* Functions for parsing the tokens into out structure */
-/* Defined at the end section of this file */
-
-static void SetIconDirectory (char *path);
-static void SetDefaultIcon (char *fname);
-static void SetRootMenu (char *menu);
-static void SetDefaultSysMenu (char *menu, int pos);
-static void SetTrayIcon (char *fname);
-
-static void OpenMenu(char *menuname);
-static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param);
-static void CloseMenu(void);
-
-static void OpenIcons(void);
-static void AddIconLine(char *matchstr, char *iconfile);
-static void CloseIcons(void);
-
-static void OpenStyles(void);
-static void AddStyleLine(char *matchstr, unsigned long style);
-static void CloseStyles(void);
-
-static void OpenSysMenu(void);
-static void AddSysMenuLine(char *matchstr, char *menuname, int pos);
-static void CloseSysMenu(void);
-
-static int yyerror (char *s);
-
-extern char *yytext;
-extern int yylex(void);
-
-#define YYMALLOC malloc
-#define YYFREE free
-
-%}
-
-%union {
- char *sVal;
- unsigned long uVal;
- int iVal;
-}
-
-%token NEWLINE
-%token MENU
-%token LB
-%token RB
-%token ICONDIRECTORY
-%token DEFAULTICON
-%token ICONS
-%token STYLES
-%token TOPMOST
-%token MAXIMIZE
-%token MINIMIZE
-%token BOTTOM
-%token NOTITLE
-%token OUTLINE
-%token NOFRAME
-%token DEFAULTSYSMENU
-%token SYSMENU
-%token ROOTMENU
-%token SEPARATOR
-%token ATSTART
-%token ATEND
-%token EXEC
-%token ALWAYSONTOP
-%token DEBUGOUTPUT "DEBUG"
-%token RELOAD
-%token TRAYICON
-%token FORCEEXIT
-%token SILENTEXIT
-
-%token <sVal> STRING
-%type <uVal> group1
-%type <uVal> group2
-%type <uVal> stylecombo
-%type <iVal> atspot
-
-%%
-
-input: /* empty */
- | input line
- ;
-
-line: NEWLINE
- | command
- ;
-
-
-newline_or_nada:
- | NEWLINE newline_or_nada
- ;
-
-command: defaulticon
- | icondirectory
- | menu
- | icons
- | styles
- | sysmenu
- | rootmenu
- | defaultsysmenu
- | debug
- | trayicon
- | forceexit
- | silentexit
- ;
-
-trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); }
- ;
-
-rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); }
- ;
-
-defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); }
- ;
-
-defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); }
- ;
-
-icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); }
- ;
-
-menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); }
- | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); }
- | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); }
- | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); }
- | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); }
- ;
-
-menulist: menuline
- | menuline menulist
- ;
-
-menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();}
- ;
-
-iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); }
- ;
-
-iconlist: iconline
- | iconline iconlist
- ;
-
-icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();}
- ;
-
-group1: TOPMOST { $$=STYLE_TOPMOST; }
- | MAXIMIZE { $$=STYLE_MAXIMIZE; }
- | MINIMIZE { $$=STYLE_MINIMIZE; }
- | BOTTOM { $$=STYLE_BOTTOM; }
- ;
-
-group2: NOTITLE { $$=STYLE_NOTITLE; }
- | OUTLINE { $$=STYLE_OUTLINE; }
- | NOFRAME { $$=STYLE_NOFRAME; }
- ;
-
-stylecombo: group1 { $$=$1; }
- | group2 { $$=$1; }
- | group1 group2 { $$=$1|$2; }
- | group2 group1 { $$=$1|$2; }
- ;
-
-styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); }
- ;
-
-stylelist: styleline
- | styleline stylelist
- ;
-
-styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();}
- ;
-
-atspot: { $$=AT_END; }
- | ATSTART { $$=AT_START; }
- | ATEND { $$=AT_END; }
- ;
-
-sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); }
- ;
-
-sysmenulist: sysmenuline
- | sysmenuline sysmenulist
- ;
-
-sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();}
- ;
-
-forceexit: FORCEEXIT NEWLINE { pref.fForceExit = TRUE; }
- ;
-
-silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; }
- ;
-
-debug: DEBUGOUTPUT STRING NEWLINE { winDebug("LoadPreferences: %s\n", $2); free($2); }
- ;
-
-
-%%
-/*
- * Errors in parsing abort and print log messages
- */
-static int
-yyerror (char *s)
-{
- extern int yylineno; /* Handled by flex internally */
-
- ErrorF("LoadPreferences: %s line %d\n", s, yylineno);
- return 1;
-}
-
-/* Miscellaneous functions to store TOKENs into the structure */
-static void
-SetIconDirectory (char *path)
-{
- strncpy (pref.iconDirectory, path, PATH_MAX);
- pref.iconDirectory[PATH_MAX] = 0;
-}
-
-static void
-SetDefaultIcon (char *fname)
-{
- strncpy (pref.defaultIconName, fname, NAME_MAX);
- pref.defaultIconName[NAME_MAX] = 0;
-}
-
-static void
-SetTrayIcon (char *fname)
-{
- strncpy (pref.trayIconName, fname, NAME_MAX);
- pref.trayIconName[NAME_MAX] = 0;
-}
-
-static void
-SetRootMenu (char *menu)
-{
- strncpy (pref.rootMenuName, menu, MENU_MAX);
- pref.rootMenuName[MENU_MAX] = 0;
-}
-
-static void
-SetDefaultSysMenu (char *menu, int pos)
-{
- strncpy (pref.defaultSysMenuName, menu, MENU_MAX);
- pref.defaultSysMenuName[MENU_MAX] = 0;
- pref.defaultSysMenuPos = pos;
-}
-
-static void
-OpenMenu (char *menuname)
-{
- if (menu.menuItem) free(menu.menuItem);
- menu.menuItem = NULL;
- strncpy(menu.menuName, menuname, MENU_MAX);
- menu.menuName[MENU_MAX] = 0;
- menu.menuItems = 0;
-}
-
-static void
-AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param)
-{
- if (menu.menuItem==NULL)
- menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM));
- else
- menu.menuItem = (MENUITEM*)
- realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1));
-
- strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX);
- menu.menuItem[menu.menuItems].text[MENU_MAX] = 0;
-
- menu.menuItem[menu.menuItems].cmd = cmd;
-
- strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX);
- menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0;
-
- menu.menuItem[menu.menuItems].commandID = 0;
-
- menu.menuItems++;
-}
-
-static void
-CloseMenu (void)
-{
- if (menu.menuItem==NULL || menu.menuItems==0)
- {
- ErrorF("LoadPreferences: Empty menu detected\n");
- return;
- }
-
- if (pref.menuItems)
- pref.menu = (MENUPARSED*)
- realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED));
- else
- pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED));
-
- memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED));
- pref.menuItems++;
-
- memset (&menu, 0, sizeof(MENUPARSED));
-}
-
-static void
-OpenIcons (void)
-{
- if (pref.icon != NULL) {
- winDebug("LoadPreferences: Redefining icon mappings\n");
- free(pref.icon);
- pref.icon = NULL;
- }
- pref.iconItems = 0;
-}
-
-static void
-AddIconLine (char *matchstr, char *iconfile)
-{
- if (pref.icon==NULL)
- pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM));
- else
- pref.icon = (ICONITEM*)
- realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1));
-
- strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX);
- pref.icon[pref.iconItems].match[MENU_MAX] = 0;
-
- strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1);
- pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0;
-
- pref.icon[pref.iconItems].hicon = 0;
-
- pref.iconItems++;
-}
-
-static void
-CloseIcons (void)
-{
-}
-
-static void
-OpenStyles (void)
-{
- if (pref.style != NULL) {
- winDebug("LoadPreferences: Redefining window style\n");
- free(pref.style);
- pref.style = NULL;
- }
- pref.styleItems = 0;
-}
-
-static void
-AddStyleLine (char *matchstr, unsigned long style)
-{
- if (pref.style==NULL)
- pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM));
- else
- pref.style = (STYLEITEM*)
- realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1));
-
- strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX);
- pref.style[pref.styleItems].match[MENU_MAX] = 0;
-
- pref.style[pref.styleItems].type = style;
-
- pref.styleItems++;
-}
-
-static void
-CloseStyles (void)
-{
-}
-
-static void
-OpenSysMenu (void)
-{
- if (pref.sysMenu != NULL) {
- winDebug("LoadPreferences: Redefining system menu\n");
- free(pref.sysMenu);
- pref.sysMenu = NULL;
- }
- pref.sysMenuItems = 0;
-}
-
-static void
-AddSysMenuLine (char *matchstr, char *menuname, int pos)
-{
- if (pref.sysMenu==NULL)
- pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM));
- else
- pref.sysMenu = (SYSMENUITEM*)
- realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1));
-
- strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX);
- pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0;
-
- strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX);
- pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0;
-
- pref.sysMenu[pref.sysMenuItems].menuPos = pos;
-
- pref.sysMenuItems++;
-}
-
-static void
-CloseSysMenu (void)
-{
-}
-
+%{ +/* + * Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * Copyright (C) Colin Harrison 2005-2008 + * + * 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. + * + * Authors: Earle F. Philhower, III + * Colin Harrison + */ +/* $XFree86: $ */ + +#ifdef HAVE_XWIN_CONFIG_H +#include <xwin-config.h> +#endif +#include <stdio.h> +#include <stdlib.h> +#define _STDLIB_H 1 /* bison checks this to know if stdlib has been included */ +#include <string.h> +#include "winprefs.h" +#include "winmsg.h" + +/* The following give better error messages in bison at the cost of a few KB */ +#define YYERROR_VERBOSE 1 + +/* YYLTYPE_IS_TRIVIAL and YYENABLE_NLS defined to suppress warnings */ +#define YYLTYPE_IS_TRIVIAL 1 +#define YYENABLE_NLS 0 + +/* The global pref settings */ +WINPREFS pref; + +/* The working menu */ +static MENUPARSED menu; + +/* Functions for parsing the tokens into out structure */ +/* Defined at the end section of this file */ + +static void SetIconDirectory (char *path); +static void SetDefaultIcon (char *fname); +static void SetRootMenu (char *menu); +static void SetDefaultSysMenu (char *menu, int pos); +static void SetTrayIcon (char *fname); + +static void OpenMenu(char *menuname); +static void AddMenuLine(char *name, MENUCOMMANDTYPE cmd, char *param); +static void CloseMenu(void); + +static void OpenIcons(void); +static void AddIconLine(char *matchstr, char *iconfile); +static void CloseIcons(void); + +static void OpenStyles(void); +static void AddStyleLine(char *matchstr, unsigned long style); +static void CloseStyles(void); + +static void OpenSysMenu(void); +static void AddSysMenuLine(char *matchstr, char *menuname, int pos); +static void CloseSysMenu(void); + +static int yyerror (char *s); + +extern char *yytext; +extern int yylex(void); + +#define YYMALLOC malloc +#define YYFREE free + +%} + +%union { + char *sVal; + unsigned long uVal; + int iVal; +} + +%token NEWLINE +%token MENU +%token LB +%token RB +%token ICONDIRECTORY +%token DEFAULTICON +%token ICONS +%token STYLES +%token TOPMOST +%token MAXIMIZE +%token MINIMIZE +%token BOTTOM +%token NOTITLE +%token OUTLINE +%token NOFRAME +%token DEFAULTSYSMENU +%token SYSMENU +%token ROOTMENU +%token SEPARATOR +%token ATSTART +%token ATEND +%token EXEC +%token ALWAYSONTOP +%token DEBUGOUTPUT "DEBUG" +%token RELOAD +%token TRAYICON +%token FORCEEXIT +%token SILENTEXIT + +%token <sVal> STRING +%type <uVal> group1 +%type <uVal> group2 +%type <uVal> stylecombo +%type <iVal> atspot + +%% + +input: /* empty */ + | input line + ; + +line: NEWLINE + | command + ; + + +newline_or_nada: + | NEWLINE newline_or_nada + ; + +command: defaulticon + | icondirectory + | menu + | icons + | styles + | sysmenu + | rootmenu + | defaultsysmenu + | debug + | trayicon + | forceexit + | silentexit + ; + +trayicon: TRAYICON STRING NEWLINE { SetTrayIcon($2); free($2); } + ; + +rootmenu: ROOTMENU STRING NEWLINE { SetRootMenu($2); free($2); } + ; + +defaultsysmenu: DEFAULTSYSMENU STRING atspot NEWLINE { SetDefaultSysMenu($2, $3); free($2); } + ; + +defaulticon: DEFAULTICON STRING NEWLINE { SetDefaultIcon($2); free($2); } + ; + +icondirectory: ICONDIRECTORY STRING NEWLINE { SetIconDirectory($2); free($2); } + ; + +menuline: SEPARATOR NEWLINE newline_or_nada { AddMenuLine("-", CMD_SEPARATOR, ""); } + | STRING ALWAYSONTOP NEWLINE newline_or_nada { AddMenuLine($1, CMD_ALWAYSONTOP, ""); free($1); } + | STRING EXEC STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_EXEC, $3); free($1); free($3); } + | STRING MENU STRING NEWLINE newline_or_nada { AddMenuLine($1, CMD_MENU, $3); free($1); free($3); } + | STRING RELOAD NEWLINE newline_or_nada { AddMenuLine($1, CMD_RELOAD, ""); free($1); } + ; + +menulist: menuline + | menuline menulist + ; + +menu: MENU STRING LB { OpenMenu($2); free($2); } newline_or_nada menulist RB {CloseMenu();} + ; + +iconline: STRING STRING NEWLINE newline_or_nada { AddIconLine($1, $2); free($1); free($2); } + ; + +iconlist: iconline + | iconline iconlist + ; + +icons: ICONS LB {OpenIcons();} newline_or_nada iconlist RB {CloseIcons();} + ; + +group1: TOPMOST { $$=STYLE_TOPMOST; } + | MAXIMIZE { $$=STYLE_MAXIMIZE; } + | MINIMIZE { $$=STYLE_MINIMIZE; } + | BOTTOM { $$=STYLE_BOTTOM; } + ; + +group2: NOTITLE { $$=STYLE_NOTITLE; } + | OUTLINE { $$=STYLE_OUTLINE; } + | NOFRAME { $$=STYLE_NOFRAME; } + ; + +stylecombo: group1 { $$=$1; } + | group2 { $$=$1; } + | group1 group2 { $$=$1|$2; } + | group2 group1 { $$=$1|$2; } + ; + +styleline: STRING stylecombo NEWLINE newline_or_nada { AddStyleLine($1, $2); free($1); } + ; + +stylelist: styleline + | styleline stylelist + ; + +styles: STYLES LB {OpenStyles();} newline_or_nada stylelist RB {CloseStyles();} + ; + +atspot: { $$=AT_END; } + | ATSTART { $$=AT_START; } + | ATEND { $$=AT_END; } + ; + +sysmenuline: STRING STRING atspot NEWLINE newline_or_nada { AddSysMenuLine($1, $2, $3); free($1); free($2); } + ; + +sysmenulist: sysmenuline + | sysmenuline sysmenulist + ; + +sysmenu: SYSMENU LB NEWLINE {OpenSysMenu();} newline_or_nada sysmenulist RB {CloseSysMenu();} + ; + +forceexit: FORCEEXIT NEWLINE { pref.fForceExit = TRUE; } + ; + +silentexit: SILENTEXIT NEWLINE { pref.fSilentExit = TRUE; } + ; + +debug: DEBUGOUTPUT STRING NEWLINE { winDebug("LoadPreferences: %s\n", $2); free($2); } + ; + + +%% +/* + * Errors in parsing abort and print log messages + */ +static int +yyerror (char *s) +{ + extern int yylineno; /* Handled by flex internally */ + + ErrorF("LoadPreferences: %s line %d\n", s, yylineno); + return 1; +} + +/* Miscellaneous functions to store TOKENs into the structure */ +static void +SetIconDirectory (char *path) +{ + strncpy (pref.iconDirectory, path, PATH_MAX); + pref.iconDirectory[PATH_MAX] = 0; +} + +static void +SetDefaultIcon (char *fname) +{ + strncpy (pref.defaultIconName, fname, NAME_MAX); + pref.defaultIconName[NAME_MAX] = 0; +} + +static void +SetTrayIcon (char *fname) +{ + strncpy (pref.trayIconName, fname, NAME_MAX); + pref.trayIconName[NAME_MAX] = 0; +} + +static void +SetRootMenu (char *menuname) +{ + strncpy (pref.rootMenuName, menuname, MENU_MAX); + pref.rootMenuName[MENU_MAX] = 0; +} + +static void +SetDefaultSysMenu (char *menuname, int pos) +{ + strncpy (pref.defaultSysMenuName, menuname, MENU_MAX); + pref.defaultSysMenuName[MENU_MAX] = 0; + pref.defaultSysMenuPos = pos; +} + +static void +OpenMenu (char *menuname) +{ + if (menu.menuItem) free(menu.menuItem); + menu.menuItem = NULL; + strncpy(menu.menuName, menuname, MENU_MAX); + menu.menuName[MENU_MAX] = 0; + menu.menuItems = 0; +} + +static void +AddMenuLine (char *text, MENUCOMMANDTYPE cmd, char *param) +{ + if (menu.menuItem==NULL) + menu.menuItem = (MENUITEM*)malloc(sizeof(MENUITEM)); + else + menu.menuItem = (MENUITEM*) + realloc(menu.menuItem, sizeof(MENUITEM)*(menu.menuItems+1)); + + strncpy (menu.menuItem[menu.menuItems].text, text, MENU_MAX); + menu.menuItem[menu.menuItems].text[MENU_MAX] = 0; + + menu.menuItem[menu.menuItems].cmd = cmd; + + strncpy(menu.menuItem[menu.menuItems].param, param, PARAM_MAX); + menu.menuItem[menu.menuItems].param[PARAM_MAX] = 0; + + menu.menuItem[menu.menuItems].commandID = 0; + + menu.menuItems++; +} + +static void +CloseMenu (void) +{ + if (menu.menuItem==NULL || menu.menuItems==0) + { + ErrorF("LoadPreferences: Empty menu detected\n"); + return; + } + + if (pref.menuItems) + pref.menu = (MENUPARSED*) + realloc (pref.menu, (pref.menuItems+1)*sizeof(MENUPARSED)); + else + pref.menu = (MENUPARSED*)malloc (sizeof(MENUPARSED)); + + memcpy (pref.menu+pref.menuItems, &menu, sizeof(MENUPARSED)); + pref.menuItems++; + + memset (&menu, 0, sizeof(MENUPARSED)); +} + +static void +OpenIcons (void) +{ + if (pref.icon != NULL) { + winDebug("LoadPreferences: Redefining icon mappings\n"); + free(pref.icon); + pref.icon = NULL; + } + pref.iconItems = 0; +} + +static void +AddIconLine (char *matchstr, char *iconfile) +{ + if (pref.icon==NULL) + pref.icon = (ICONITEM*)malloc(sizeof(ICONITEM)); + else + pref.icon = (ICONITEM*) + realloc(pref.icon, sizeof(ICONITEM)*(pref.iconItems+1)); + + strncpy(pref.icon[pref.iconItems].match, matchstr, MENU_MAX); + pref.icon[pref.iconItems].match[MENU_MAX] = 0; + + strncpy(pref.icon[pref.iconItems].iconFile, iconfile, PATH_MAX+NAME_MAX+1); + pref.icon[pref.iconItems].iconFile[PATH_MAX+NAME_MAX+1] = 0; + + pref.icon[pref.iconItems].hicon = 0; + + pref.iconItems++; +} + +static void +CloseIcons (void) +{ +} + +static void +OpenStyles (void) +{ + if (pref.style != NULL) { + winDebug("LoadPreferences: Redefining window style\n"); + free(pref.style); + pref.style = NULL; + } + pref.styleItems = 0; +} + +static void +AddStyleLine (char *matchstr, unsigned long style) +{ + if (pref.style==NULL) + pref.style = (STYLEITEM*)malloc(sizeof(STYLEITEM)); + else + pref.style = (STYLEITEM*) + realloc(pref.style, sizeof(STYLEITEM)*(pref.styleItems+1)); + + strncpy(pref.style[pref.styleItems].match, matchstr, MENU_MAX); + pref.style[pref.styleItems].match[MENU_MAX] = 0; + + pref.style[pref.styleItems].type = style; + + pref.styleItems++; +} + +static void +CloseStyles (void) +{ +} + +static void +OpenSysMenu (void) +{ + if (pref.sysMenu != NULL) { + winDebug("LoadPreferences: Redefining system menu\n"); + free(pref.sysMenu); + pref.sysMenu = NULL; + } + pref.sysMenuItems = 0; +} + +static void +AddSysMenuLine (char *matchstr, char *menuname, int pos) +{ + if (pref.sysMenu==NULL) + pref.sysMenu = (SYSMENUITEM*)malloc(sizeof(SYSMENUITEM)); + else + pref.sysMenu = (SYSMENUITEM*) + realloc(pref.sysMenu, sizeof(SYSMENUITEM)*(pref.sysMenuItems+1)); + + strncpy (pref.sysMenu[pref.sysMenuItems].match, matchstr, MENU_MAX); + pref.sysMenu[pref.sysMenuItems].match[MENU_MAX] = 0; + + strncpy (pref.sysMenu[pref.sysMenuItems].menuName, menuname, MENU_MAX); + pref.sysMenu[pref.sysMenuItems].menuName[MENU_MAX] = 0; + + pref.sysMenu[pref.sysMenuItems].menuPos = pos; + + pref.sysMenuItems++; +} + +static void +CloseSysMenu (void) +{ +} + diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index f8c981a97..7ada2de73 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -57,10 +57,6 @@ void void winLogVersionInfo(void); -#ifdef DDXOSVERRORF -void OsVendorVErrorF(const char *pszFormat, va_list va_args); -#endif - /* * Process arguments on the command line */ diff --git a/xorg-server/hw/xwin/winregistry.c b/xorg-server/hw/xwin/winregistry.c deleted file mode 100644 index 0535c879d..000000000 --- a/xorg-server/hw/xwin/winregistry.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - *Copyright (C) 2002-2004 Harold L Hunt II All Rights Reserved. - * - *Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - *"Software"), to deal in the Software without restriction, including - *without limitation the rights to use, copy, modify, merge, publish, - *distribute, sublicense, and/or sell copies of the Software, and to - *permit persons to whom the Software is furnished to do so, subject to - *the following conditions: - * - *The above copyright notice and this permission notice shall be - *included in all copies or substantial portions of the Software. - * - *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR - *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF - *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - *Except as contained in this notice, the name of Harold L Hunt II - *shall not be used in advertising or otherwise to promote the sale, use - *or other dealings in this Software without prior written authorization - *from Harold L Hunt II. - * - * Authors: Harold L Hunt II - */ - -#ifdef HAVE_XWIN_CONFIG_H -#include <xwin-config.h> -#endif -#include "win.h" - -/* Prototypes */ -DWORD winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey); - -DWORD -winGetRegistryDWORD(HKEY hkey, char *pszRegistryKey) -{ - HKEY hkResult; - DWORD dwDisposition; - - RegCreateKeyEx(hkey, - pszRegistryKey, - 0, - '\0', - REG_OPTION_NON_VOLATILE, - KEY_READ, NULL, &hkResult, &dwDisposition); - - if (dwDisposition == REG_CREATED_NEW_KEY) { - winDebug ("winGetRegistryDWORD - Created new key: %s\n", pszRegistryKey); - } - else if (dwDisposition == REG_OPENED_EXISTING_KEY) { - winDebug ("winGetRegistryDWORD - Opened existing key: %s\n", - pszRegistryKey); - } - - /* Free the registry key handle */ - RegCloseKey(hkResult); - hkResult = NULL; - - return 0; -} diff --git a/xorg-server/hw/xwin/winscrinit.c b/xorg-server/hw/xwin/winscrinit.c index bfc094fcf..c0426ac0b 100644 --- a/xorg-server/hw/xwin/winscrinit.c +++ b/xorg-server/hw/xwin/winscrinit.c @@ -251,7 +251,7 @@ winCreateScreenResources(ScreenPtr pScreen) /* See Porting Layer Definition - p. 20 */ Bool -winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv) +winFinishScreenInitFB(int i, ScreenPtr pScreen, int argc, char **argv) { winScreenPriv(pScreen); winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; @@ -565,11 +565,11 @@ winFinishScreenInitFB(int index, ScreenPtr pScreen, int argc, char **argv) /* See Porting Layer Definition - p. 20 */ Bool -winFinishScreenInitNativeGDI(int index, +winFinishScreenInitNativeGDI(int i, ScreenPtr pScreen, int argc, char **argv) { winScreenPriv(pScreen); - winScreenInfoPtr pScreenInfo = &g_ScreenInfo[index]; + winScreenInfoPtr pScreenInfo = &g_ScreenInfo[i]; VisualPtr pVisuals = NULL; DepthPtr pDepths = NULL; VisualID rootVisual = 0; diff --git a/xorg-server/hw/xwin/winvalargs.c b/xorg-server/hw/xwin/winvalargs.c index eb6e973b8..edfd71f72 100644 --- a/xorg-server/hw/xwin/winvalargs.c +++ b/xorg-server/hw/xwin/winvalargs.c @@ -57,9 +57,7 @@ Bool winValidateArgs(void) { int i; - int iMaxConsecutiveScreen = 0; BOOL fHasNormalScreen0 = FALSE; - BOOL fImplicitScreenFound = FALSE; /* * Check for a malformed set of -screen parameters. diff --git a/xorg-server/hw/xwin/winwindow.c b/xorg-server/hw/xwin/winwindow.c index a847561f8..1a5bbae4e 100644 --- a/xorg-server/hw/xwin/winwindow.c +++ b/xorg-server/hw/xwin/winwindow.c @@ -59,7 +59,6 @@ winCreateWindowNativeGDI(WindowPtr pWin) Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); winDebug ("winCreateWindowNativeGDI (%p)\n", pWin); @@ -80,7 +79,6 @@ winDestroyWindowNativeGDI(WindowPtr pWin) Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); winDebug ("winDestroyWindowNativeGDI (%p)\n", pWin); @@ -101,7 +99,6 @@ winPositionWindowNativeGDI(WindowPtr pWin, int x, int y) Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); winDebug ("winPositionWindowNativeGDI (%p)\n", pWin); @@ -190,7 +187,6 @@ winChangeWindowAttributesNativeGDI(WindowPtr pWin, unsigned long mask) Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); winDebug ("winChangeWindowAttributesNativeGDI (%p)\n", pWin); @@ -216,7 +212,6 @@ winUnmapWindowNativeGDI(WindowPtr pWin) Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); winDebug ("winUnmapWindowNativeGDI (%p)\n", pWin); @@ -238,7 +233,6 @@ winMapWindowNativeGDI(WindowPtr pWin) Bool fResult = TRUE; ScreenPtr pScreen = pWin->drawable.pScreen; - winWindowPriv(pWin); winScreenPriv(pScreen); winDebug ("winMapWindowNativeGDI (%p)\n", pWin); diff --git a/xorg-server/hw/xwin/winwindowswm.c b/xorg-server/hw/xwin/winwindowswm.c index 19d5e95a9..92fa5e3ff 100644 --- a/xorg-server/hw/xwin/winwindowswm.c +++ b/xorg-server/hw/xwin/winwindowswm.c @@ -82,7 +82,6 @@ static int ProcWindowsWMQueryVersion(ClientPtr client) { xWindowsWMQueryVersionReply rep; - int n; REQUEST_SIZE_MATCH(xWindowsWMQueryVersionReq); rep.type = X_Reply; @@ -467,7 +466,7 @@ ProcWindowsWMFrameSetTitle(ClientPtr client) winDebug ("ProcWindowsWMFrameSetTitle - length is valid\n"); title_bytes = malloc(title_length + 1); - strncpy(title_bytes, (unsigned char *) &stuff[1], title_length); + strncpy(title_bytes, (char *) &stuff[1], title_length); title_bytes[title_length] = '\0'; pRLWinPriv = (win32RootlessWindowPtr) RootlessFrameForWindow(pWin, FALSE); @@ -536,8 +535,6 @@ SNotifyEvent(xWindowsWMNotifyEvent * from, xWindowsWMNotifyEvent * to) static int SProcWindowsWMQueryVersion(ClientPtr client) { - int n; - REQUEST(xWindowsWMQueryVersionReq); swaps(&stuff->length); return ProcWindowsWMQueryVersion(client); diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h index 5747f3cd2..f8459b8c8 100644 --- a/xorg-server/include/input.h +++ b/xorg-server/include/input.h @@ -579,6 +579,7 @@ extern int TouchListenerAcceptReject(DeviceIntPtr dev, TouchPointInfoPtr ti, int listener, int mode); extern int TouchAcceptReject(ClientPtr client, DeviceIntPtr dev, int mode, uint32_t touchid, Window grab_window, XID *error); +extern void TouchEndPhysicallyActiveTouches(DeviceIntPtr dev); /* misc event helpers */ extern Mask GetEventMask(DeviceIntPtr dev, xEvent *ev, InputClientsPtr clients); diff --git a/xorg-server/include/os.h b/xorg-server/include/os.h index d906834f1..68f405714 100644 --- a/xorg-server/include/os.h +++ b/xorg-server/include/os.h @@ -88,7 +88,9 @@ extern void ddxBeforeReset(void); #endif #ifdef DDXOSVERRORF -extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, va_list args); +extern _X_EXPORT void (*OsVendorVErrorFProc) (const char *, + va_list args) +_X_ATTRIBUTE_PRINTF(1, 0); #endif extern _X_EXPORT int WaitForSomething(int * /*pClientsReady */ |