diff options
Diffstat (limited to 'xserver/mi')
-rw-r--r-- | xserver/mi/Makefile.am | 3 | ||||
-rw-r--r-- | xserver/mi/Makefile.in | 23 | ||||
-rw-r--r-- | xserver/mi/mibitblt.c | 6 | ||||
-rw-r--r-- | xserver/mi/mibstore.c | 43 | ||||
-rw-r--r-- | xserver/mi/mibstore.h | 23 | ||||
-rw-r--r-- | xserver/mi/midispcur.c | 213 | ||||
-rw-r--r-- | xserver/mi/mieq.c | 29 | ||||
-rw-r--r-- | xserver/mi/miexpose.c | 13 | ||||
-rw-r--r-- | xserver/mi/miinitext.c | 485 | ||||
-rw-r--r-- | xserver/mi/mioverlay.c | 6 | ||||
-rw-r--r-- | xserver/mi/mipointer.c | 65 | ||||
-rw-r--r-- | xserver/mi/mipointer.h | 3 | ||||
-rw-r--r-- | xserver/mi/miscrinit.c | 4 | ||||
-rw-r--r-- | xserver/mi/mispans.c | 4 | ||||
-rw-r--r-- | xserver/mi/misprite.c | 13 |
15 files changed, 339 insertions, 594 deletions
diff --git a/xserver/mi/Makefile.am b/xserver/mi/Makefile.am index 96ceeaa8a..0cef7798f 100644 --- a/xserver/mi/Makefile.am +++ b/xserver/mi/Makefile.am @@ -1,7 +1,7 @@ noinst_LTLIBRARIES = libmi.la if XORG -sdk_HEADERS = micmap.h miline.h mipointer.h mi.h mibstore.h \ +sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \ migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \ mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h endif @@ -12,7 +12,6 @@ libmi_la_SOURCES = \ mi.h \ miarc.c \ mibitblt.c \ - mibstore.h \ micmap.c \ micmap.h \ micoord.h \ diff --git a/xserver/mi/Makefile.in b/xserver/mi/Makefile.in index 02e252bce..abd29f2f0 100644 --- a/xserver/mi/Makefile.in +++ b/xserver/mi/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.12.3 from Makefile.am. +# Makefile.in generated by automake 1.12.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2012 Free Software Foundation, Inc. @@ -129,8 +129,8 @@ am__can_run_installinfo = \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac -am__sdk_HEADERS_DIST = micmap.h miline.h mipointer.h mi.h mibstore.h \ - migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h mispans.h \ +am__sdk_HEADERS_DIST = micmap.h miline.h mipointer.h mi.h migc.h \ + mipointrst.h mizerarc.h micoord.h mifillarc.h mispans.h \ miwideline.h mistruct.h mifpoly.h mioverlay.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -221,13 +221,9 @@ DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@ DOXYGEN = @DOXYGEN@ DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@ DRI2PROTO_LIBS = @DRI2PROTO_LIBS@ -DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@ -DRIPROTO_LIBS = @DRIPROTO_LIBS@ DRIVER_MAN_DIR = @DRIVER_MAN_DIR@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@ -DRI_CFLAGS = @DRI_CFLAGS@ DRI_DRIVER_PATH = @DRI_DRIVER_PATH@ -DRI_LIBS = @DRI_LIBS@ DSYMUTIL = @DSYMUTIL@ DTRACE = @DTRACE@ DUMPBIN = @DUMPBIN@ @@ -249,6 +245,7 @@ FONTTYPE1DIR = @FONTTYPE1DIR@ FOP = @FOP@ GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@ GLX_DEFINES = @GLX_DEFINES@ +GLX_SYS_LIBS = @GLX_SYS_LIBS@ GLX_TLS = @GLX_TLS@ GL_CFLAGS = @GL_CFLAGS@ GL_LIBS = @GL_LIBS@ @@ -273,6 +270,7 @@ KHRONOS_SPEC_DIR = @KHRONOS_SPEC_DIR@ LD = @LD@ LDFLAGS = @LDFLAGS@ LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@ +LD_NO_UNDEFINED_FLAG = @LD_NO_UNDEFINED_FLAG@ LEX = @LEX@ LEXLIB = @LEXLIB@ LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@ @@ -288,7 +286,6 @@ LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ -MAINT = @MAINT@ MAIN_LIB = @MAIN_LIB@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ @@ -387,6 +384,7 @@ XNESTMODULES_LIBS = @XNESTMODULES_LIBS@ XNEST_LIBS = @XNEST_LIBS@ XNEST_SYS_LIBS = @XNEST_SYS_LIBS@ XORG_CFLAGS = @XORG_CFLAGS@ +XORG_DRIVER_LIBS = @XORG_DRIVER_LIBS@ XORG_INCS = @XORG_INCS@ XORG_LIBS = @XORG_LIBS@ XORG_MALLOC_DEBUG_ENV = @XORG_MALLOC_DEBUG_ENV@ @@ -487,7 +485,7 @@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ noinst_LTLIBRARIES = libmi.la -@XORG_TRUE@sdk_HEADERS = micmap.h miline.h mipointer.h mi.h mibstore.h \ +@XORG_TRUE@sdk_HEADERS = micmap.h miline.h mipointer.h mi.h \ @XORG_TRUE@ migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \ @XORG_TRUE@ mispans.h miwideline.h mistruct.h mifpoly.h mioverlay.h @@ -496,7 +494,6 @@ libmi_la_SOURCES = \ mi.h \ miarc.c \ mibitblt.c \ - mibstore.h \ micmap.c \ micmap.h \ micoord.h \ @@ -551,7 +548,7 @@ all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -576,9 +573,9 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) +$(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh -$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) +$(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): diff --git a/xserver/mi/mibitblt.c b/xserver/mi/mibitblt.c index b9873c16d..b0d14ae55 100644 --- a/xserver/mi/mibitblt.c +++ b/xserver/mi/mibitblt.c @@ -614,7 +614,7 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h, if (format == ZPixmap) { if ((((1LL << depth) - 1) & planeMask) != (1LL << depth) - 1) { ChangeGCVal gcv; - xPoint pt; + xPoint xpt; pGC = GetScratchGC(depth, pDraw->pScreen); if (!pGC) @@ -629,9 +629,9 @@ miGetImage(DrawablePtr pDraw, int sx, int sy, int w, int h, * Clear the pixmap before doing anything else */ ValidateGC((DrawablePtr) pPixmap, pGC); - pt.x = pt.y = 0; + xpt.x = xpt.y = 0; width = w; - (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &pt, &width, + (*pGC->ops->FillSpans) ((DrawablePtr) pPixmap, pGC, 1, &xpt, &width, TRUE); /* alu is already GXCopy */ diff --git a/xserver/mi/mibstore.c b/xserver/mi/mibstore.c deleted file mode 100644 index 6cadb2b8f..000000000 --- a/xserver/mi/mibstore.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2007 Red Hat, 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 (including the next - * paragraph) 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 AUTHORS OR COPYRIGHT HOLDERS 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. - */ - -#ifdef HAVE_DIX_CONFIG_H -#include <dix-config.h> -#endif -#include "scrnintstr.h" -#include "mibstore.h" - -/* - * There is no longer an mi implementation of backing store. This function - * is only for source compatibility with old drivers. - * - * Note though that you do get backing store for free if your server has - * Composite enabled, since the automatic redirection mechanism provides - * essentially the same functionality. See compChangeWindowAttributes() - * for the implementation. - */ - -void -miInitializeBackingStore(ScreenPtr pScreen) -{ -} diff --git a/xserver/mi/mibstore.h b/xserver/mi/mibstore.h deleted file mode 100644 index f8ed4446d..000000000 --- a/xserver/mi/mibstore.h +++ /dev/null @@ -1,23 +0,0 @@ -/*- - * mibstore.h -- - * Header file for users of the MI backing-store scheme. - * - * Copyright (c) 1987 by the Regents of the University of California - * - * Permission to use, copy, modify, and distribute this - * software and its documentation for any purpose and without - * fee is hereby granted, provided that the above copyright - * notice appear in all copies. The University of California - * makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without - * express or implied warranty. - */ - -#ifndef _MIBSTORE_H -#define _MIBSTORE_H - -#include "screenint.h" - -#define miInitializeBackingStore(x) do {} while (0) - -#endif /* _MIBSTORE_H */ diff --git a/xserver/mi/midispcur.c b/xserver/mi/midispcur.c index 24b9a700d..edca9696f 100644 --- a/xserver/mi/midispcur.c +++ b/xserver/mi/midispcur.c @@ -56,14 +56,12 @@ in this Software without prior written authorization from The Open Group. static DevPrivateKeyRec miDCScreenKeyRec; #define miDCScreenKey (&miDCScreenKeyRec) -static DevScreenPrivateKeyRec miDCCursorBitsKeyRec; -#define miDCCursorBitsKey (&miDCCursorBitsKeyRec) static DevScreenPrivateKeyRec miDCDeviceKeyRec; #define miDCDeviceKey (&miDCDeviceKeyRec) -static Bool miDCCloseScreen(int index, ScreenPtr pScreen); +static Bool miDCCloseScreen(ScreenPtr pScreen); /* per device private data */ typedef struct { @@ -86,18 +84,15 @@ typedef struct { */ typedef struct { CloseScreenProcPtr CloseScreen; -} miDCScreenRec, *miDCScreenPtr; - -#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey))) - -/* per-cursor per-screen private data */ -typedef struct { PixmapPtr sourceBits; /* source bits */ PixmapPtr maskBits; /* mask bits */ #ifdef ARGB_CURSOR PicturePtr pPicture; #endif -} miDCCursorRec, *miDCCursorPtr; + CursorPtr pCursor; +} miDCScreenRec, *miDCScreenPtr; + +#define miGetDCScreen(s) ((miDCScreenPtr)(dixLookupPrivate(&(s)->devPrivates, miDCScreenKey))) Bool miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) @@ -105,13 +100,11 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) miDCScreenPtr pScreenPriv; if (!dixRegisterPrivateKey(&miDCScreenKeyRec, PRIVATE_SCREEN, 0) || - !dixRegisterScreenPrivateKey(&miDCCursorBitsKeyRec, pScreen, - PRIVATE_CURSOR_BITS, 0) || !dixRegisterScreenPrivateKey(&miDCDeviceKeyRec, pScreen, PRIVATE_DEVICE, 0)) return FALSE; - pScreenPriv = malloc(sizeof(miDCScreenRec)); + pScreenPriv = calloc(1, sizeof(miDCScreenRec)); if (!pScreenPriv) return FALSE; @@ -127,57 +120,60 @@ miDCInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) return TRUE; } +static void +miDCSwitchScreenCursor(ScreenPtr pScreen, CursorPtr pCursor, PixmapPtr sourceBits, PixmapPtr maskBits, PicturePtr pPicture) +{ + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); + + if (pScreenPriv->sourceBits) + (*pScreen->DestroyPixmap)(pScreenPriv->sourceBits); + pScreenPriv->sourceBits = sourceBits; + + if (pScreenPriv->maskBits) + (*pScreen->DestroyPixmap)(pScreenPriv->maskBits); + pScreenPriv->maskBits = maskBits; + +#ifdef ARGB_CURSOR + if (pScreenPriv->pPicture) + FreePicture(pScreenPriv->pPicture, 0); + pScreenPriv->pPicture = pPicture; +#endif + + pScreenPriv->pCursor = pCursor; +} + static Bool -miDCCloseScreen(int index, ScreenPtr pScreen) +miDCCloseScreen(ScreenPtr pScreen) { miDCScreenPtr pScreenPriv; pScreenPriv = (miDCScreenPtr) dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); pScreen->CloseScreen = pScreenPriv->CloseScreen; + + miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); free((pointer) pScreenPriv); - return (*pScreen->CloseScreen) (index, pScreen); + return (*pScreen->CloseScreen) (pScreen); } Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { - if (pCursor->bits->refcnt <= 1) - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, - pScreen, NULL); return TRUE; } #ifdef ARGB_CURSOR #define EnsurePicture(picture,draw,win) (picture || miDCMakePicture(&picture,draw,win)) -static VisualPtr -miDCGetWindowVisual(WindowPtr pWin) -{ - ScreenPtr pScreen = pWin->drawable.pScreen; - VisualID vid = wVisual(pWin); - int i; - - for (i = 0; i < pScreen->numVisuals; i++) - if (pScreen->visuals[i].vid == vid) - return &pScreen->visuals[i]; - return 0; -} - static PicturePtr miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin) { - ScreenPtr pScreen = pDraw->pScreen; - VisualPtr pVisual; PictFormatPtr pFormat; XID subwindow_mode = IncludeInferiors; PicturePtr pPicture; int error; - pVisual = miDCGetWindowVisual(pWin); - if (!pVisual) - return 0; - pFormat = PictureMatchVisual(pScreen, pDraw->depth, pVisual); + pFormat = PictureWindowFormat(pWin); if (!pFormat) return 0; pPicture = CreatePicture(0, pDraw, pFormat, @@ -188,42 +184,39 @@ miDCMakePicture(PicturePtr * ppPicture, DrawablePtr pDraw, WindowPtr pWin) } #endif -static miDCCursorPtr +static Bool miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) { - miDCCursorPtr pPriv; + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); GCPtr pGC; ChangeGCVal gcvals; + PixmapPtr sourceBits, maskBits; + + if (pScreenPriv->pCursor == pCursor) + return TRUE; - pPriv = malloc(sizeof(miDCCursorRec)); - if (!pPriv) - return NULL; #ifdef ARGB_CURSOR + if (pCursor->bits->argb) { PixmapPtr pPixmap; PictFormatPtr pFormat; int error; + PicturePtr pPicture; pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); - if (!pFormat) { - free((pointer) pPriv); - return NULL; - } + if (!pFormat) + return FALSE; - pPriv->sourceBits = 0; - pPriv->maskBits = 0; pPixmap = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, pCursor->bits->height, 32, CREATE_PIXMAP_USAGE_SCRATCH); - if (!pPixmap) { - free((pointer) pPriv); - return NULL; - } + if (!pPixmap) + return FALSE; + pGC = GetScratchGC(32, pScreen); if (!pGC) { (*pScreen->DestroyPixmap) (pPixmap); - free((pointer) pPriv); - return NULL; + return FALSE; } ValidateGC(&pPixmap->drawable, pGC); (*pGC->ops->PutImage) (&pPixmap->drawable, pGC, 32, @@ -231,105 +224,86 @@ miDCRealize(ScreenPtr pScreen, CursorPtr pCursor) pCursor->bits->height, 0, ZPixmap, (char *) pCursor->bits->argb); FreeScratchGC(pGC); - pPriv->pPicture = CreatePicture(0, &pPixmap->drawable, - pFormat, 0, 0, serverClient, &error); + pPicture = CreatePicture(0, &pPixmap->drawable, + pFormat, 0, 0, serverClient, &error); (*pScreen->DestroyPixmap) (pPixmap); - if (!pPriv->pPicture) { - free((pointer) pPriv); - return NULL; - } - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, - pScreen, pPriv); - return pPriv; + if (!pPicture) + return FALSE; + + miDCSwitchScreenCursor(pScreen, pCursor, NULL, NULL, pPicture); + return TRUE; } - pPriv->pPicture = 0; #endif - pPriv->sourceBits = - (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 1, 0); - if (!pPriv->sourceBits) { - free((pointer) pPriv); - return NULL; - } - pPriv->maskBits = - (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, - pCursor->bits->height, 1, 0); - if (!pPriv->maskBits) { - (*pScreen->DestroyPixmap) (pPriv->sourceBits); - free((pointer) pPriv); - return NULL; + sourceBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, + pCursor->bits->height, 1, 0); + if (!sourceBits) + return FALSE; + + maskBits = (*pScreen->CreatePixmap) (pScreen, pCursor->bits->width, + pCursor->bits->height, 1, 0); + if (!maskBits) { + (*pScreen->DestroyPixmap) (sourceBits); + return FALSE; } - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, pScreen, - pPriv); /* create the two sets of bits, clipping as appropriate */ pGC = GetScratchGC(1, pScreen); if (!pGC) { - (void) miDCUnrealizeCursor(pScreen, pCursor); - return NULL; + (*pScreen->DestroyPixmap) (sourceBits); + (*pScreen->DestroyPixmap) (maskBits); + return FALSE; } - ValidateGC((DrawablePtr) pPriv->sourceBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->sourceBits, pGC, 1, + ValidateGC((DrawablePtr) sourceBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->source); gcvals.val = GXand; ChangeGC(NullClient, pGC, GCFunction, &gcvals); - ValidateGC((DrawablePtr) pPriv->sourceBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->sourceBits, pGC, 1, + ValidateGC((DrawablePtr) sourceBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) sourceBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->mask); /* mask bits -- pCursor->mask & ~pCursor->source */ gcvals.val = GXcopy; ChangeGC(NullClient, pGC, GCFunction, &gcvals); - ValidateGC((DrawablePtr) pPriv->maskBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->maskBits, pGC, 1, + ValidateGC((DrawablePtr) maskBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->mask); gcvals.val = GXandInverted; ChangeGC(NullClient, pGC, GCFunction, &gcvals); - ValidateGC((DrawablePtr) pPriv->maskBits, pGC); - (*pGC->ops->PutImage) ((DrawablePtr) pPriv->maskBits, pGC, 1, + ValidateGC((DrawablePtr) maskBits, pGC); + (*pGC->ops->PutImage) ((DrawablePtr) maskBits, pGC, 1, 0, 0, pCursor->bits->width, pCursor->bits->height, 0, XYPixmap, (char *) pCursor->bits->source); FreeScratchGC(pGC); - return pPriv; + + miDCSwitchScreenCursor(pScreen, pCursor, sourceBits, maskBits, NULL); + return TRUE; } Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) { - miDCCursorPtr pPriv; - - pPriv = (miDCCursorPtr) dixLookupScreenPrivate(&pCursor->bits->devPrivates, - miDCCursorBitsKey, pScreen); - if (pPriv && (pCursor->bits->refcnt <= 1)) { - if (pPriv->sourceBits) - (*pScreen->DestroyPixmap) (pPriv->sourceBits); - if (pPriv->maskBits) - (*pScreen->DestroyPixmap) (pPriv->maskBits); -#ifdef ARGB_CURSOR - if (pPriv->pPicture) - FreePicture(pPriv->pPicture, 0); -#endif - free((pointer) pPriv); - dixSetScreenPrivate(&pCursor->bits->devPrivates, miDCCursorBitsKey, - pScreen, NULL); - } + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); + + if (pCursor == pScreenPriv->pCursor) + miDCSwitchScreenCursor(pScreen, NULL, NULL, NULL, NULL); return TRUE; } static void miDCPutBits(DrawablePtr pDrawable, - miDCCursorPtr pPriv, GCPtr sourceGC, GCPtr maskGC, int x_org, int y_org, unsigned w, unsigned h, unsigned long source, unsigned long mask) { + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pDrawable->pScreen->devPrivates, miDCScreenKey); ChangeGCVal gcval; int x, y; @@ -349,7 +323,7 @@ miDCPutBits(DrawablePtr pDrawable, y = y_org; } - (*sourceGC->ops->PushPixels) (sourceGC, pPriv->sourceBits, pDrawable, w, h, + (*sourceGC->ops->PushPixels) (sourceGC, pScreenPriv->sourceBits, pDrawable, w, h, x, y); if (maskGC->fgPixel != mask) { gcval.val = mask; @@ -367,7 +341,7 @@ miDCPutBits(DrawablePtr pDrawable, y = y_org; } - (*maskGC->ops->PushPixels) (maskGC, pPriv->maskBits, pDrawable, w, h, x, y); + (*maskGC->ops->PushPixels) (maskGC, pScreenPriv->maskBits, pDrawable, w, h, x, y); } static GCPtr @@ -389,27 +363,22 @@ Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, int y, unsigned long source, unsigned long mask) { - miDCCursorPtr pPriv; + miDCScreenPtr pScreenPriv = dixLookupPrivate(&pScreen->devPrivates, miDCScreenKey); miDCBufferPtr pBuffer; WindowPtr pWin; - pPriv = (miDCCursorPtr) dixLookupScreenPrivate(&pCursor->bits->devPrivates, - miDCCursorBitsKey, pScreen); - if (!pPriv) { - pPriv = miDCRealize(pScreen, pCursor); - if (!pPriv) - return FALSE; - } + if (!miDCRealize(pScreen, pCursor)) + return FALSE; pWin = pScreen->root; pBuffer = miGetDCDevice(pDev, pScreen); #ifdef ARGB_CURSOR - if (pPriv->pPicture) { + if (pScreenPriv->pPicture) { if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin)) return FALSE; CompositePicture(PictOpOver, - pPriv->pPicture, + pScreenPriv->pPicture, NULL, pBuffer->pRootPicture, 0, 0, 0, 0, @@ -418,7 +387,7 @@ miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, else #endif { - miDCPutBits((DrawablePtr) pWin, pPriv, + miDCPutBits((DrawablePtr) pWin, pBuffer->pSourceGC, pBuffer->pMaskGC, x, y, pCursor->bits->width, pCursor->bits->height, source, mask); diff --git a/xserver/mi/mieq.c b/xserver/mi/mieq.c index e117a8db7..d7d73deb6 100644 --- a/xserver/mi/mieq.c +++ b/xserver/mi/mieq.c @@ -276,23 +276,22 @@ mieqEnqueue(DeviceIntPtr pDev, InternalEvent *e) */ miEventQueue.dropped++; if (miEventQueue.dropped == 1) { - ErrorF - ("[mi] EQ overflowing. Additional events will be discarded until existing events are processed.\n"); + ErrorFSigSafe("[mi] EQ overflowing. Additional events will be " + "discarded until existing events are processed.\n"); xorg_backtrace(); - ErrorF - ("[mi] These backtraces from mieqEnqueue may point to a culprit higher up the stack.\n"); - ErrorF("[mi] mieq is *NOT* the cause. It is a victim.\n"); + ErrorFSigSafe("[mi] These backtraces from mieqEnqueue may point to " + "a culprit higher up the stack.\n"); + ErrorFSigSafe("[mi] mieq is *NOT* the cause. It is a victim.\n"); } else if (miEventQueue.dropped % QUEUE_DROP_BACKTRACE_FREQUENCY == 0 && miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY <= QUEUE_DROP_BACKTRACE_MAX) { - ErrorF - ("[mi] EQ overflow continuing. %lu events have been dropped.\n", - miEventQueue.dropped); + ErrorFSigSafe("[mi] EQ overflow continuing. %u events have been " + "dropped.\n", miEventQueue.dropped); if (miEventQueue.dropped / QUEUE_DROP_BACKTRACE_FREQUENCY == QUEUE_DROP_BACKTRACE_MAX) { - ErrorF - ("[mi] No further overflow reports will be reported until the clog is cleared.\n"); + ErrorFSigSafe("[mi] No further overflow reports will be " + "reported until the clog is cleared.\n"); } xorg_backtrace(); } @@ -408,6 +407,10 @@ ChangeDeviceID(DeviceIntPtr dev, InternalEvent *event) case ET_RawTouchUpdate: event->raw_event.deviceid = dev->id; break; + case ET_BarrierHit: + case ET_BarrierLeave: + event->barrier_event.deviceid = dev->id; + break; default: ErrorF("[mi] Unknown event type (%d), cannot change id.\n", event->any.type); @@ -624,7 +627,11 @@ mieqProcessInputEvents(void) mieqProcessDeviceEvent(dev, &event, screen); /* Update the sprite now. Next event may be from different device. */ - if (event.any.type == ET_Motion && master) + if (master && + (event.any.type == ET_Motion || + ((event.any.type == ET_TouchBegin || + event.any.type == ET_TouchUpdate) && + event.device_event.flags & TOUCH_POINTER_EMULATED))) miPointerUpdateSprite(dev); #ifdef XQUARTZ diff --git a/xserver/mi/miexpose.c b/xserver/mi/miexpose.c index dbb29ca4a..8b7c93fb8 100644 --- a/xserver/mi/miexpose.c +++ b/xserver/mi/miexpose.c @@ -327,7 +327,7 @@ miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable, numRects = RegionNumRects(pRgn); pBox = RegionRects(pRgn); - if (!(pEvent = malloc(numRects * sizeof(xEvent)))) + if (!(pEvent = calloc(numRects, sizeof(xEvent)))) return; pe = pEvent; @@ -349,13 +349,12 @@ miSendGraphicsExpose(ClientPtr client, RegionPtr pRgn, XID drawable, free(pEvent); } else { - xEvent event; - - memset(&event, 0, sizeof(xEvent)); + xEvent event = { + .u.noExposure.drawable = drawable, + .u.noExposure.majorEvent = major, + .u.noExposure.minorEvent = minor + }; event.u.u.type = NoExpose; - event.u.noExposure.drawable = drawable; - event.u.noExposure.majorEvent = major; - event.u.noExposure.minorEvent = minor; WriteEventsToClient(client, 1, &event); } } diff --git a/xserver/mi/miinitext.c b/xserver/mi/miinitext.c index 6ceae0537..81c663abe 100644 --- a/xserver/mi/miinitext.c +++ b/xserver/mi/miinitext.c @@ -44,21 +44,46 @@ SOFTWARE. ******************************************************************/ +/* + * Copyright (c) 2000 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 COPYRIGHT HOLDER(S) OR AUTHOR(S) 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 copyright holder(s) + * and 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 the copyright holder(s) and author(s). + */ + #ifdef HAVE_DIX_CONFIG_H #include <dix-config.h> #endif #ifdef HAVE_XORG_CONFIG_H #include <xorg-config.h> +#include "xf86Extensions.h" #endif #ifdef HAVE_DMX_CONFIG_H #include <dmx-config.h> #undef XV #undef DBE -#undef XF86VIDMODE -#undef XFreeXDGA -#undef XF86DRI #undef SCREENSAVER #undef RANDR #undef XFIXES @@ -75,198 +100,18 @@ SOFTWARE. #ifdef HAVE_KDRIVE_CONFIG_H #include <kdrive-config.h> -/* there must be a better way... */ -#undef XFreeXDGA -#undef XF86DRI -#undef XF86VIDMODE #endif #ifdef HAVE_XGL_CONFIG_H #include <xgl-config.h> -#undef XFreeXDGA -#undef XF86DRI -#undef XF86VIDMODE #endif #include "misc.h" #include "extension.h" +#include "extinit.h" #include "micmap.h" #include "globals.h" -extern Bool noTestExtensions; - -#ifdef COMPOSITE -extern Bool noCompositeExtension; -#endif -#ifdef DBE -extern Bool noDbeExtension; -#endif -#ifdef DPMSExtension -extern Bool noDPMSExtension; -#endif -#ifdef GLXEXT -extern Bool noGlxExtension; -#endif -#ifdef SCREENSAVER -extern Bool noScreenSaverExtension; -#endif -#ifdef MITSHM -extern Bool noMITShmExtension; -#endif -#ifdef RANDR -extern Bool noRRExtension; -#endif -extern Bool noRenderExtension; - -#ifdef XCSECURITY -extern Bool noSecurityExtension; -#endif -#ifdef RES -extern Bool noResExtension; -#endif -#ifdef XF86BIGFONT -extern Bool noXFree86BigfontExtension; -#endif -#ifdef XFreeXDGA -extern Bool noXFree86DGAExtension; -#endif -#ifdef XF86DRI -extern Bool noXFree86DRIExtension; -#endif -#ifdef XF86VIDMODE -extern Bool noXFree86VidModeExtension; -#endif -#ifdef XFIXES -extern Bool noXFixesExtension; -#endif -#ifdef PANORAMIX -extern Bool noPanoramiXExtension; -#endif -#ifdef INXQUARTZ -extern Bool noPseudoramiXExtension; -#endif -#ifdef XSELINUX -extern Bool noSELinuxExtension; -#endif -#ifdef XV -extern Bool noXvExtension; -#endif -extern Bool noGEExtension; - -#ifndef XFree86LOADER -#define INITARGS void -typedef void (*InitExtension) (INITARGS); -#else /* XFree86Loader */ -#include "loaderProcs.h" -#endif - -#ifdef MITSHM -#include <X11/extensions/shm.h> -#endif -#ifdef XTEST -#include <X11/extensions/xtestconst.h> -#endif -#include <X11/extensions/XKB.h> -#ifdef XCSECURITY -#include "securitysrv.h" -#include <X11/extensions/secur.h> -#endif -#ifdef XSELINUX -#include "xselinux.h" -#endif -#ifdef PANORAMIX -#include <X11/extensions/panoramiXproto.h> -#endif -#ifdef XF86BIGFONT -#include <X11/extensions/xf86bigfproto.h> -#endif -#ifdef RES -#include <X11/extensions/XResproto.h> -#endif - -/* FIXME: this whole block of externs should be from the appropriate headers */ -#ifdef MITSHM -extern void ShmExtensionInit(INITARGS); -#endif -#ifdef PANORAMIX -extern void PanoramiXExtensionInit(INITARGS); -#endif -#ifdef INXQUARTZ -extern void PseudoramiXExtensionInit(INITARGS); -#endif -extern void XInputExtensionInit(INITARGS); - -#ifdef XTEST -extern void XTestExtensionInit(INITARGS); -#endif -extern void BigReqExtensionInit(INITARGS); - -#ifdef SCREENSAVER -extern void ScreenSaverExtensionInit(INITARGS); -#endif -#ifdef XV -extern void XvExtensionInit(INITARGS); -extern void XvMCExtensionInit(INITARGS); -#endif -extern void SyncExtensionInit(INITARGS); -extern void XkbExtensionInit(INITARGS); -extern void XCMiscExtensionInit(INITARGS); - -#ifdef XRECORD -extern void RecordExtensionInit(INITARGS); -#endif -#ifdef DBE -extern void DbeExtensionInit(INITARGS); -#endif -#ifdef XCSECURITY -extern void SecurityExtensionInit(INITARGS); -#endif -#ifdef XSELINUX -extern void SELinuxExtensionInit(INITARGS); -#endif -#ifdef XF86BIGFONT -extern void XFree86BigfontExtensionInit(INITARGS); -#endif -#ifdef XF86VIDMODE -extern void XFree86VidModeExtensionInit(INITARGS); -#endif -#ifdef XFreeXDGA -extern void XFree86DGAExtensionInit(INITARGS); -#endif -#ifdef GLXEXT -typedef struct __GLXprovider __GLXprovider; -extern __GLXprovider __glXDRISWRastProvider; -extern void GlxPushProvider(__GLXprovider * impl); -extern void GlxExtensionInit(INITARGS); -#endif -#ifdef XF86DRI -extern void XFree86DRIExtensionInit(INITARGS); -#endif -#ifdef DPMSExtension -extern void DPMSExtensionInit(INITARGS); -#endif -extern void RenderExtensionInit(INITARGS); - -#ifdef RANDR -extern void RRExtensionInit(INITARGS); -#endif -#ifdef RES -extern void ResExtensionInit(INITARGS); -#endif -#ifdef DMXEXT -extern void DMXExtensionInit(INITARGS); -#endif -#ifdef XFIXES -extern void XFixesExtensionInit(INITARGS); -#endif -#ifdef DAMAGE -extern void DamageExtensionInit(INITARGS); -#endif -#ifdef COMPOSITE -extern void CompositeExtensionInit(INITARGS); -#endif -extern void GEExtensionInit(INITARGS); - /* The following is only a small first step towards run-time * configurable extensions. */ @@ -312,6 +157,7 @@ static ExtensionToggle ExtensionToggleList[] = { #ifdef XF86BIGFONT {"XFree86-Bigfont", &noXFree86BigfontExtension}, #endif +#ifdef XorgLoader #ifdef XFreeXDGA {"XFree86-DGA", &noXFree86DGAExtension}, #endif @@ -321,6 +167,7 @@ static ExtensionToggle ExtensionToggleList[] = { #ifdef XF86VIDMODE {"XFree86-VidModeExtension", &noXFree86VidModeExtension}, #endif +#endif #ifdef XFIXES {"XFIXES", &noXFixesExtension}, #endif @@ -336,15 +183,16 @@ static ExtensionToggle ExtensionToggleList[] = { #ifdef XV {"XVideo", &noXvExtension}, #endif - {NULL, NULL} }; Bool EnableDisableExtension(const char *name, Bool enable) { - ExtensionToggle *ext = &ExtensionToggleList[0]; + ExtensionToggle *ext; + int i; - for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) { + for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) { + ext = &ExtensionToggleList[i]; if (strcmp(name, ext->name) == 0) { if (ext->disablePtr != NULL) { *ext->disablePtr = !enable; @@ -364,10 +212,12 @@ EnableDisableExtension(const char *name, Bool enable) void EnableDisableExtensionError(const char *name, Bool enable) { - ExtensionToggle *ext = &ExtensionToggleList[0]; + ExtensionToggle *ext; + int i; Bool found = FALSE; - for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) { + for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) { + ext = &ExtensionToggleList[i]; if ((strcmp(name, ext->name) == 0) && (ext->disablePtr == NULL)) { ErrorF("[mi] Extension \"%s\" can not be disabled\n", name); found = TRUE; @@ -378,187 +228,107 @@ EnableDisableExtensionError(const char *name, Bool enable) ErrorF("[mi] Extension \"%s\" is not recognized\n", name); ErrorF("[mi] Only the following extensions can be run-time %s:\n", enable ? "enabled" : "disabled"); - for (ext = &ExtensionToggleList[0]; ext->name != NULL; ext++) { + for (i = 0; i < ARRAY_SIZE(ExtensionToggleList); i++) { + ext = &ExtensionToggleList[i]; if (ext->disablePtr != NULL) { ErrorF("[mi] %s\n", ext->name); } } } -#ifndef XFree86LOADER - - /*ARGSUSED*/ void -InitExtensions(int argc, char *argv[]) -{ - if (!noGEExtension) - GEExtensionInit(); - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - PanoramiXExtensionInit(); -#endif -#ifdef INXQUARTZ - if (!noPseudoramiXExtension) - PseudoramiXExtensionInit(); -#endif - ShapeExtensionInit(); +/* List of built-in (statically linked) extensions */ +static ExtensionModule staticExtensions[] = { + {GEExtensionInit, "Generic Event Extension", &noGEExtension}, + {ShapeExtensionInit, "SHAPE", NULL}, #ifdef MITSHM - if (!noMITShmExtension) - ShmExtensionInit(); + {ShmExtensionInit, SHMNAME, &noMITShmExtension}, #endif - XInputExtensionInit(); + {XInputExtensionInit, "XInputExtension", NULL}, #ifdef XTEST - if (!noTestExtensions) - XTestExtensionInit(); -#endif - BigReqExtensionInit(); -#if defined(SCREENSAVER) - if (!noScreenSaverExtension) - ScreenSaverExtensionInit(); -#endif -#ifdef XV - if (!noXvExtension) { - XvExtensionInit(); - XvMCExtensionInit(); - } -#endif - SyncExtensionInit(); - XkbExtensionInit(); - XCMiscExtensionInit(); -#ifdef XRECORD - if (!noTestExtensions) - RecordExtensionInit(); -#endif -#ifdef DBE - if (!noDbeExtension) - DbeExtensionInit(); + {XTestExtensionInit, XTestExtensionName, &noTestExtensions}, #endif + {BigReqExtensionInit, "BIG-REQUESTS", NULL}, + {SyncExtensionInit, "SYNC", NULL}, + {XkbExtensionInit, XkbName, NULL}, + {XCMiscExtensionInit, "XC-MISC", NULL}, #ifdef XCSECURITY - if (!noSecurityExtension) - SecurityExtensionInit(); -#endif -#ifdef XSELINUX - if (!noSELinuxExtension) - SELinuxExtensionInit(); -#endif -#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS) - if (!noDPMSExtension) - DPMSExtensionInit(); -#endif -#ifdef XF86BIGFONT - if (!noXFree86BigfontExtension) - XFree86BigfontExtensionInit(); + {SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension}, #endif -#if !defined(NO_HW_ONLY_EXTS) -#if defined(XF86VIDMODE) - if (!noXFree86VidModeExtension) - XFree86VidModeExtensionInit(); -#endif -#if defined(XFreeXDGA) - if (!noXFree86DGAExtension) - XFree86DGAExtensionInit(); -#endif -#ifdef XF86DRI - if (!noXFree86DRIExtension) - XFree86DRIExtensionInit(); +#ifdef PANORAMIX + {PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension}, #endif +#ifdef INXQUARTZ + /* PseudoramiXExtensionInit must be done before RRExtensionInit, or + * XQuartz will render windows offscreen. + */ + {PseudoramiXExtensionInit, "PseudoramiX", &noPseudoramiXExtension}, #endif #ifdef XFIXES /* must be before Render to layer DisplayCursor correctly */ - if (!noXFixesExtension) - XFixesExtensionInit(); -#endif - if (!noRenderExtension) - RenderExtensionInit(); -#ifdef RANDR - if (!noRRExtension) - RRExtensionInit(); + {XFixesExtensionInit, "XFIXES", &noXFixesExtension}, #endif -#ifdef RES - if (!noResExtension) - ResExtensionInit(); +#ifdef XF86BIGFONT + {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension}, #endif -#ifdef DMXEXT - DMXExtensionInit(); /* server-specific extension, cannot be disabled */ + {RenderExtensionInit, "RENDER", &noRenderExtension}, +#ifdef RANDR + {RRExtensionInit, "RANDR", &noRRExtension}, #endif #ifdef COMPOSITE - if (!noCompositeExtension) - CompositeExtensionInit(); + {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension}, #endif #ifdef DAMAGE - if (!noDamageExtension) - DamageExtensionInit(); -#endif - -#ifdef GLXEXT - if (serverGeneration == 1) - GlxPushProvider(&__glXDRISWRastProvider); - if (!noGlxExtension) - GlxExtensionInit(); -#endif -} - -#else /* XFree86LOADER */ -/* List of built-in (statically linked) extensions */ -static ExtensionModule staticExtensions[] = { - {GEExtensionInit, "Generic Event Extension", &noGEExtension, NULL, NULL}, - {ShapeExtensionInit, "SHAPE", NULL, NULL, NULL}, -#ifdef MITSHM - {ShmExtensionInit, SHMNAME, &noMITShmExtension, NULL, NULL}, -#endif - {XInputExtensionInit, "XInputExtension", NULL, NULL, NULL}, -#ifdef XTEST - {XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL}, + {DamageExtensionInit, "DAMAGE", &noDamageExtension}, #endif - {BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL}, - {SyncExtensionInit, "SYNC", NULL, NULL, NULL}, - {XkbExtensionInit, XkbName, NULL, NULL, NULL}, - {XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL}, -#ifdef XCSECURITY - {SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, - NULL}, +#ifdef SCREENSAVER + {ScreenSaverExtensionInit, ScreenSaverName, &noScreenSaverExtension}, #endif -#ifdef PANORAMIX - {PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, - NULL, NULL}, +#ifdef DBE + {DbeExtensionInit, "DOUBLE-BUFFER", &noDbeExtension}, #endif -#ifdef XFIXES - /* must be before Render to layer DisplayCursor correctly */ - {XFixesExtensionInit, "XFIXES", &noXFixesExtension, NULL, NULL}, +#ifdef XRECORD + {RecordExtensionInit, "RECORD", &noTestExtensions}, #endif -#ifdef XF86BIGFONT - {XFree86BigfontExtensionInit, XF86BIGFONTNAME, &noXFree86BigfontExtension, - NULL, NULL}, +#ifdef DPMSExtension + {DPMSExtensionInit, DPMSExtensionName, &noDPMSExtension}, #endif - {RenderExtensionInit, "RENDER", &noRenderExtension, NULL, NULL}, -#ifdef RANDR - {RRExtensionInit, "RANDR", &noRRExtension, NULL, NULL}, +#ifdef RES + {ResExtensionInit, XRES_NAME, &noResExtension}, #endif -#ifdef COMPOSITE - {CompositeExtensionInit, "COMPOSITE", &noCompositeExtension, NULL}, +#ifdef XV + {XvExtensionInit, XvName, &noXvExtension}, + {XvMCExtensionInit, XvMCName, &noXvExtension}, #endif -#ifdef DAMAGE - {DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL}, +#ifdef XSELINUX + {SELinuxExtensionInit, SELINUX_EXTENSION_NAME, &noSELinuxExtension}, #endif - {NULL, NULL, NULL, NULL, NULL} }; - /*ARGSUSED*/ void +static ExtensionModule *ExtensionModuleList = NULL; +static int numExtensionModules = 0; + +static void +AddStaticExtensions(void) +{ + static Bool listInitialised = FALSE; + int i; + + if (listInitialised) + return; + listInitialised = TRUE; + + /* Add built-in extensions to the list. */ + for (i = 0; i < ARRAY_SIZE(staticExtensions); i++) + LoadExtension(&staticExtensions[i], TRUE); +} + +void InitExtensions(int argc, char *argv[]) { int i; ExtensionModule *ext; - static Bool listInitialised = FALSE; - - if (!listInitialised) { - /* Add built-in extensions to the list. */ - for (i = 0; staticExtensions[i].name; i++) - LoadExtension(&staticExtensions[i], TRUE); - /* Sort the extensions according the init dependencies. */ - LoaderSortExtensions(); - listInitialised = TRUE; - } + AddStaticExtensions(); for (i = 0; ExtensionModuleList[i].name != NULL; i++) { ext = &ExtensionModuleList[i]; @@ -569,4 +339,51 @@ InitExtensions(int argc, char *argv[]) } } -#endif /* XFree86LOADER */ +static ExtensionModule * +NewExtensionModule(void) +{ + ExtensionModule *save = ExtensionModuleList; + int n; + + /* Make sure built-in extensions get added to the list before those + * in modules. */ + AddStaticExtensions(); + + /* Sanity check */ + if (!ExtensionModuleList) + numExtensionModules = 0; + + n = numExtensionModules + 1; + ExtensionModuleList = realloc(ExtensionModuleList, + (n + 1) * sizeof(ExtensionModule)); + if (ExtensionModuleList == NULL) { + ExtensionModuleList = save; + return NULL; + } + else { + numExtensionModules++; + ExtensionModuleList[numExtensionModules].name = NULL; + return ExtensionModuleList + (numExtensionModules - 1); + } +} + +void +LoadExtension(const ExtensionModule * e, Bool builtin) +{ + ExtensionModule *newext; + + if (e == NULL || e->name == NULL) + return; + + if (!(newext = NewExtensionModule())) + return; + + if (builtin) + ErrorF("Initializing built-in extension %s\n", e->name); + else + ErrorF("Loading extension %s\n", e->name); + + newext->name = e->name; + newext->initFunc = e->initFunc; + newext->disablePtr = e->disablePtr; +} diff --git a/xserver/mi/mioverlay.c b/xserver/mi/mioverlay.c index f72159e73..2bfd5e401 100644 --- a/xserver/mi/mioverlay.c +++ b/xserver/mi/mioverlay.c @@ -66,7 +66,7 @@ static Bool HasUnderlayChildren(WindowPtr); static void MarkUnderlayWindow(WindowPtr); static Bool CollectUnderlayChildrenRegions(WindowPtr, RegionPtr); -static Bool miOverlayCloseScreen(int, ScreenPtr); +static Bool miOverlayCloseScreen(ScreenPtr); static Bool miOverlayCreateWindow(WindowPtr); static Bool miOverlayDestroyWindow(WindowPtr); static Bool miOverlayUnrealizeWindow(WindowPtr); @@ -160,7 +160,7 @@ miInitOverlay(ScreenPtr pScreen, } static Bool -miOverlayCloseScreen(int i, ScreenPtr pScreen) +miOverlayCloseScreen(ScreenPtr pScreen) { miOverlayScreenPtr pScreenPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen); @@ -172,7 +172,7 @@ miOverlayCloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static Bool diff --git a/xserver/mi/mipointer.c b/xserver/mi/mipointer.c index de6698a37..b8503f450 100644 --- a/xserver/mi/mipointer.c +++ b/xserver/mi/mipointer.c @@ -91,14 +91,14 @@ static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pTopLeftBox); static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y, Bool generateEvent); -static Bool miPointerCloseScreen(int index, ScreenPtr pScreen); +static Bool miPointerCloseScreen(ScreenPtr pScreen); static void miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); static Bool miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen); static void miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen); static void miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); -static InternalEvent *events; /* for WarpPointer MotionNotifies */ +static InternalEvent *mipointermove_events; /* for WarpPointer MotionNotifies */ Bool miPointerInitialize(ScreenPtr pScreen, @@ -143,7 +143,7 @@ miPointerInitialize(ScreenPtr pScreen, pScreen->DeviceCursorInitialize = miPointerDeviceInitialize; pScreen->DeviceCursorCleanup = miPointerDeviceCleanup; - events = NULL; + mipointermove_events = NULL; return TRUE; } @@ -154,15 +154,15 @@ miPointerInitialize(ScreenPtr pScreen, * @param pScreen The actual screen pointer */ static Bool -miPointerCloseScreen(int index, ScreenPtr pScreen) +miPointerCloseScreen(ScreenPtr pScreen) { SetupScreen(pScreen); pScreen->CloseScreen = pScreenPriv->CloseScreen; free((pointer) pScreenPriv); - FreeEventList(events, GetMaximumEventsNum()); - events = NULL; - return (*pScreen->CloseScreen) (index, pScreen); + FreeEventList(mipointermove_events, GetMaximumEventsNum()); + mipointermove_events = NULL; + return (*pScreen->CloseScreen) (pScreen); } /* @@ -565,23 +565,21 @@ miPointerMoveNoEvent(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) */ ScreenPtr miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, - double *screeny) + double *screeny, + int *nevents, InternalEvent* events) { miPointerScreenPtr pScreenPriv; ScreenPtr pScreen; ScreenPtr newScreen; int x, y; Bool switch_screen = FALSE; + Bool should_constrain_barriers = FALSE; + int i; miPointerPtr pPointer; - if (!pDev || !pDev->coreEvents) - return NULL; - pPointer = MIPOINTER(pDev); pScreen = pPointer->pScreen; - if (!pScreen) - return NULL; /* called before ready */ x = trunc(*screenx); y = trunc(*screeny); @@ -593,6 +591,25 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, x -= pScreen->x; y -= pScreen->y; + should_constrain_barriers = (mode == Relative); + + if (should_constrain_barriers) { + /* coordinates after clamped to a barrier */ + int constrained_x, constrained_y; + int current_x, current_y; /* current position in per-screen coord */ + + current_x = MIPOINTER(pDev)->x - pScreen->y; + current_y = MIPOINTER(pDev)->y - pScreen->x; + + input_constrain_cursor(pDev, pScreen, + current_x, current_y, x, y, + &constrained_x, &constrained_y, + nevents, events); + + x = constrained_x; + y = constrained_y; + } + if (switch_screen) { pScreenPriv = GetScreenPrivate(pScreen); if (!pPointer->confined) { @@ -624,6 +641,18 @@ miPointerSetPosition(DeviceIntPtr pDev, int mode, double *screenx, if (pPointer->x != x || pPointer->y != y || pPointer->pScreen != pScreen) miPointerMoveNoEvent(pDev, pScreen, x, y); + /* check if we generated any barrier events and if so, update root x/y + * to the fully constrained coords */ + if (should_constrain_barriers) { + for (i = 0; i < *nevents; i++) { + if (events[i].any.type == ET_BarrierHit || + events[i].any.type == ET_BarrierLeave) { + events[i].barrier_event.root_x = x; + events[i].barrier_event.root_y = y; + } + } + } + /* Convert to desktop coordinates again */ x += pScreen->x; y += pScreen->y; @@ -681,17 +710,17 @@ miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) valuators[0] = x; valuators[1] = y; - if (!events) { - events = InitEventList(GetMaximumEventsNum()); + if (!mipointermove_events) { + mipointermove_events = InitEventList(GetMaximumEventsNum()); - if (!events) { + if (!mipointermove_events) { FatalError("Could not allocate event store.\n"); return; } } valuator_mask_set_range(&mask, 0, 2, valuators); - nevents = GetPointerEvents(events, pDev, MotionNotify, 0, + nevents = GetPointerEvents(mipointermove_events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE | POINTER_NORAW, &mask); @@ -700,7 +729,7 @@ miPointerMove(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) darwinEvents_lock(); #endif for (i = 0; i < nevents; i++) - mieqEnqueue(pDev, &events[i]); + mieqEnqueue(pDev, &mipointermove_events[i]); #ifdef XQUARTZ darwinEvents_unlock(); #endif diff --git a/xserver/mi/mipointer.h b/xserver/mi/mipointer.h index 1500e216a..f89dff31e 100644 --- a/xserver/mi/mipointer.h +++ b/xserver/mi/mipointer.h @@ -115,7 +115,8 @@ miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y); /* Moves the cursor to the specified position. May clip the co-ordinates: * x and y are modified in-place. */ extern _X_EXPORT ScreenPtr -miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y); +miPointerSetPosition(DeviceIntPtr pDev, int mode, double *x, double *y, + int *nevents, InternalEvent *events); extern _X_EXPORT void miPointerUpdateSprite(DeviceIntPtr pDev); diff --git a/xserver/mi/miscrinit.c b/xserver/mi/miscrinit.c index 2850c8d79..4698b532f 100644 --- a/xserver/mi/miscrinit.c +++ b/xserver/mi/miscrinit.c @@ -119,7 +119,7 @@ miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth, } static Bool -miCloseScreen(int iScreen, ScreenPtr pScreen) +miCloseScreen(ScreenPtr pScreen) { return ((*pScreen->DestroyPixmap) ((PixmapPtr) pScreen->devPrivate)); } @@ -262,8 +262,6 @@ miScreenInit(ScreenPtr pScreen, pointer pbits, /* pointer to screen bits */ pScreen->SendGraphicsExpose = miSendGraphicsExpose; pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; - pScreen->blockData = (pointer) 0; - pScreen->wakeupData = (pointer) 0; pScreen->MarkWindow = miMarkWindow; pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; pScreen->MoveWindow = miMoveWindow; diff --git a/xserver/mi/mispans.c b/xserver/mi/mispans.c index 0f89880e2..11c8a43d0 100644 --- a/xserver/mi/mispans.c +++ b/xserver/mi/mispans.c @@ -453,8 +453,6 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup) (int *) realloc(newspans->widths, ysizes[index] * sizeof(int)); if (!newpoints || !newwidths) { - int i; - for (i = 0; i < ylength; i++) { free(yspans[i].points); free(yspans[i].widths); @@ -485,8 +483,6 @@ miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup * spanGroup) points = malloc(count * sizeof(DDXPointRec)); widths = malloc(count * sizeof(int)); if (!points || !widths) { - int i; - for (i = 0; i < ylength; i++) { free(yspans[i].points); free(yspans[i].widths); diff --git a/xserver/mi/misprite.c b/xserver/mi/misprite.c index c9fcabcab..97bbf8ef5 100644 --- a/xserver/mi/misprite.c +++ b/xserver/mi/misprite.c @@ -191,7 +191,7 @@ static DevPrivateKeyRec miSpriteDevPrivatesKeyRec; #define miSpriteDevPrivatesKey (&miSpriteDevPrivatesKeyRec) -static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen); +static Bool miSpriteCloseScreen(ScreenPtr pScreen); static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, unsigned int format, unsigned long planemask, char *pdstLine); @@ -203,7 +203,7 @@ static void miSpriteSourceValidate(DrawablePtr pDrawable, int x, int y, unsigned int subWindowMode); static void miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc); -static void miSpriteBlockHandler(int i, pointer blockData, +static void miSpriteBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadMask); static void miSpriteInstallColormap(ColormapPtr pMap); static void miSpriteStoreColors(ColormapPtr pMap, int ndef, xColorItem * pdef); @@ -367,7 +367,7 @@ miSpriteInitialize(ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs) */ static Bool -miSpriteCloseScreen(int i, ScreenPtr pScreen) +miSpriteCloseScreen(ScreenPtr pScreen) { miSpriteScreenPtr pScreenPriv = GetSpriteScreen(pScreen); @@ -382,7 +382,7 @@ miSpriteCloseScreen(int i, ScreenPtr pScreen) free(pScreenPriv); - return (*pScreen->CloseScreen) (i, pScreen); + return (*pScreen->CloseScreen) (pScreen); } static void @@ -520,10 +520,9 @@ miSpriteCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) } static void -miSpriteBlockHandler(int i, pointer blockData, pointer pTimeout, +miSpriteBlockHandler(ScreenPtr pScreen, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; miSpriteScreenPtr pPriv = GetSpriteScreen(pScreen); DeviceIntPtr pDev; miCursorInfoPtr pCursorInfo; @@ -554,7 +553,7 @@ miSpriteBlockHandler(int i, pointer blockData, pointer pTimeout, SCREEN_PROLOGUE(pPriv, pScreen, BlockHandler); - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + (*pScreen->BlockHandler) (pScreen, pTimeout, pReadmask); if (WorkToDo) SCREEN_EPILOGUE(pPriv, pScreen, BlockHandler); |