aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/mi
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
committermarha <marha@users.sourceforge.net>2009-07-25 19:39:46 +0000
commit4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch)
treec1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/mi
parentdc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff)
downloadvcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2
vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/mi')
-rw-r--r--xorg-server/mi/Makefile.in76
-rw-r--r--xorg-server/mi/mi.h32
-rw-r--r--xorg-server/mi/miarc.c6
-rw-r--r--xorg-server/mi/mibank.c73
-rw-r--r--xorg-server/mi/mibank.h6
-rw-r--r--xorg-server/mi/mibitblt.c60
-rw-r--r--xorg-server/mi/micmap.c32
-rw-r--r--xorg-server/mi/micmap.h7
-rw-r--r--xorg-server/mi/micoord.h4
-rw-r--r--xorg-server/mi/micursor.c22
-rw-r--r--xorg-server/mi/midash.c15
-rw-r--r--xorg-server/mi/midispcur.c366
-rw-r--r--xorg-server/mi/mieq.c359
-rw-r--r--xorg-server/mi/miexpose.c43
-rw-r--r--xorg-server/mi/mifillarc.c17
-rw-r--r--xorg-server/mi/mifillrct.c11
-rw-r--r--xorg-server/mi/mifpolycon.c18
-rw-r--r--xorg-server/mi/migc.c58
-rw-r--r--xorg-server/mi/migc.h8
-rw-r--r--xorg-server/mi/miglblt.c32
-rw-r--r--xorg-server/mi/miinitext.c281
-rw-r--r--xorg-server/mi/mioverlay.c58
-rw-r--r--xorg-server/mi/mipointer.c481
-rw-r--r--xorg-server/mi/mipointer.h47
-rw-r--r--xorg-server/mi/mipointrst.h4
-rw-r--r--xorg-server/mi/mipoly.c9
-rw-r--r--xorg-server/mi/mipolycon.c13
-rw-r--r--xorg-server/mi/mipolygen.c11
-rw-r--r--xorg-server/mi/mipolypnt.c13
-rw-r--r--xorg-server/mi/mipolyrect.c6
-rw-r--r--xorg-server/mi/mipolyseg.c6
-rw-r--r--xorg-server/mi/mipolytext.c29
-rw-r--r--xorg-server/mi/mipolyutil.c21
-rw-r--r--xorg-server/mi/mipushpxl.c9
-rw-r--r--xorg-server/mi/miregion.c167
-rw-r--r--xorg-server/mi/miscrinit.c91
-rw-r--r--xorg-server/mi/mispans.c15
-rw-r--r--xorg-server/mi/misprite.c845
-rw-r--r--xorg-server/mi/misprite.h13
-rw-r--r--xorg-server/mi/mispritest.h40
-rw-r--r--xorg-server/mi/mivaltree.c22
-rw-r--r--xorg-server/mi/miwideline.c68
-rw-r--r--xorg-server/mi/miwindow.c326
-rw-r--r--xorg-server/mi/mizerarc.c11
-rw-r--r--xorg-server/mi/mizerclip.c17
-rw-r--r--xorg-server/mi/mizerline.c27
46 files changed, 1836 insertions, 2039 deletions
diff --git a/xorg-server/mi/Makefile.in b/xorg-server/mi/Makefile.in
index 451dcd889..0c24c1695 100644
--- a/xorg-server/mi/Makefile.in
+++ b/xorg-server/mi/Makefile.in
@@ -1,4 +1,4 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.10.2 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
@@ -45,7 +45,6 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/do-not-use-config.h \
$(top_builddir)/include/xorg-server.h \
$(top_builddir)/include/dix-config.h \
- $(top_builddir)/include/xgl-config.h \
$(top_builddir)/include/xorg-config.h \
$(top_builddir)/include/xkb-config.h \
$(top_builddir)/include/xwin-config.h \
@@ -67,9 +66,6 @@ depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
@@ -96,8 +92,9 @@ ADMIN_MAN_DIR = @ADMIN_MAN_DIR@
ADMIN_MAN_SUFFIX = @ADMIN_MAN_SUFFIX@
ALLOCA = @ALLOCA@
AMTAR = @AMTAR@
-APPDEFAULTDIR = @APPDEFAULTDIR@
APPLE_APPLICATIONS_DIR = @APPLE_APPLICATIONS_DIR@
+APPLE_APPLICATION_ID = @APPLE_APPLICATION_ID@
+APPLE_APPLICATION_NAME = @APPLE_APPLICATION_NAME@
APP_MAN_DIR = @APP_MAN_DIR@
APP_MAN_SUFFIX = @APP_MAN_SUFFIX@
AR = @AR@
@@ -118,10 +115,6 @@ CFLAGS = @CFLAGS@
COMPILEDDEFAULTFONTPATH = @COMPILEDDEFAULTFONTPATH@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DARWIN_LIBS = @DARWIN_LIBS@
DBUS_CFLAGS = @DBUS_CFLAGS@
@@ -143,6 +136,7 @@ DMXXIEXAMPLES_DEP_CFLAGS = @DMXXIEXAMPLES_DEP_CFLAGS@
DMXXIEXAMPLES_DEP_LIBS = @DMXXIEXAMPLES_DEP_LIBS@
DMXXMUEXAMPLES_DEP_CFLAGS = @DMXXMUEXAMPLES_DEP_CFLAGS@
DMXXMUEXAMPLES_DEP_LIBS = @DMXXMUEXAMPLES_DEP_LIBS@
+DOLT_BASH = @DOLT_BASH@
DRI2PROTO_CFLAGS = @DRI2PROTO_CFLAGS@
DRI2PROTO_LIBS = @DRI2PROTO_LIBS@
DRIPROTO_CFLAGS = @DRIPROTO_CFLAGS@
@@ -152,18 +146,15 @@ DRIVER_MAN_SUFFIX = @DRIVER_MAN_SUFFIX@
DRI_DRIVER_PATH = @DRI_DRIVER_PATH@
DSYMUTIL = @DSYMUTIL@
DTRACE = @DTRACE@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FILE_MAN_DIR = @FILE_MAN_DIR@
FILE_MAN_SUFFIX = @FILE_MAN_SUFFIX@
-FREETYPE_CFLAGS = @FREETYPE_CFLAGS@
-FREETYPE_LIBS = @FREETYPE_LIBS@
GLX_ARCH_DEFINES = @GLX_ARCH_DEFINES@
GLX_DEFINES = @GLX_DEFINES@
GL_CFLAGS = @GL_CFLAGS@
@@ -182,7 +173,7 @@ KDRIVE_LIBS = @KDRIVE_LIBS@
KDRIVE_LOCAL_LIBS = @KDRIVE_LOCAL_LIBS@
KDRIVE_PURE_INCS = @KDRIVE_PURE_INCS@
KDRIVE_PURE_LIBS = @KDRIVE_PURE_LIBS@
-LAUNCHD = @LAUNCHD@
+LD = @LD@
LDFLAGS = @LDFLAGS@
LD_EXPORT_SYMBOLS_FLAG = @LD_EXPORT_SYMBOLS_FLAG@
LEX = @LEX@
@@ -196,7 +187,10 @@ LIBTOOL = @LIBTOOL@
LIB_MAN_DIR = @LIB_MAN_DIR@
LIB_MAN_SUFFIX = @LIB_MAN_SUFFIX@
LINUXDOC = @LINUXDOC@
+LIPO = @LIPO@
LN_S = @LN_S@
+LTCOMPILE = @LTCOMPILE@
+LTCXXCOMPILE = @LTCXXCOMPILE@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
@@ -208,8 +202,7 @@ MESA_SOURCE = @MESA_SOURCE@
MISC_MAN_DIR = @MISC_MAN_DIR@
MISC_MAN_SUFFIX = @MISC_MAN_SUFFIX@
MKDIR_P = @MKDIR_P@
-MKFONTDIR = @MKFONTDIR@
-MKFONTSCALE = @MKFONTSCALE@
+NM = @NM@
NMEDIT = @NMEDIT@
OBJC = @OBJC@
OBJCCLD = @OBJCCLD@
@@ -218,8 +211,8 @@ OBJCFLAGS = @OBJCFLAGS@
OBJCLINK = @OBJCLINK@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OPENSSL_CFLAGS = @OPENSSL_CFLAGS@
-OPENSSL_LIBS = @OPENSSL_LIBS@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
@@ -252,7 +245,6 @@ VENDOR_NAME = @VENDOR_NAME@
VENDOR_NAME_SHORT = @VENDOR_NAME_SHORT@
VENDOR_RELEASE = @VENDOR_RELEASE@
VERSION = @VERSION@
-X11APP_ARCHS = @X11APP_ARCHS@
X11EXAMPLES_DEP_CFLAGS = @X11EXAMPLES_DEP_CFLAGS@
X11EXAMPLES_DEP_LIBS = @X11EXAMPLES_DEP_LIBS@
XDMCP_CFLAGS = @XDMCP_CFLAGS@
@@ -262,27 +254,12 @@ XDMXCONFIG_DEP_LIBS = @XDMXCONFIG_DEP_LIBS@
XDMX_CFLAGS = @XDMX_CFLAGS@
XDMX_LIBS = @XDMX_LIBS@
XDMX_SYS_LIBS = @XDMX_SYS_LIBS@
-XEGLMODULES_CFLAGS = @XEGLMODULES_CFLAGS@
-XEGL_LIBS = @XEGL_LIBS@
-XEGL_SYS_LIBS = @XEGL_SYS_LIBS@
XEPHYR_CFLAGS = @XEPHYR_CFLAGS@
-XEPHYR_DRI_LIBS = @XEPHYR_DRI_LIBS@
XEPHYR_INCS = @XEPHYR_INCS@
XEPHYR_LIBS = @XEPHYR_LIBS@
XF86CONFIGFILE = @XF86CONFIGFILE@
-XF86MISC_CFLAGS = @XF86MISC_CFLAGS@
-XF86MISC_LIBS = @XF86MISC_LIBS@
XF86VIDMODE_CFLAGS = @XF86VIDMODE_CFLAGS@
XF86VIDMODE_LIBS = @XF86VIDMODE_LIBS@
-XGLMODULES_CFLAGS = @XGLMODULES_CFLAGS@
-XGLMODULES_LIBS = @XGLMODULES_LIBS@
-XGLXMODULES_CFLAGS = @XGLXMODULES_CFLAGS@
-XGLXMODULES_LIBS = @XGLXMODULES_LIBS@
-XGLX_LIBS = @XGLX_LIBS@
-XGLX_SYS_LIBS = @XGLX_SYS_LIBS@
-XGL_LIBS = @XGL_LIBS@
-XGL_MODULE_PATH = @XGL_MODULE_PATH@
-XGL_SYS_LIBS = @XGL_SYS_LIBS@
XKB_BASE_DIRECTORY = @XKB_BASE_DIRECTORY@
XKB_BIN_DIRECTORY = @XKB_BIN_DIRECTORY@
XKB_COMPILED_DIR = @XKB_COMPILED_DIR@
@@ -293,10 +270,6 @@ XNESTMODULES_CFLAGS = @XNESTMODULES_CFLAGS@
XNESTMODULES_LIBS = @XNESTMODULES_LIBS@
XNEST_LIBS = @XNEST_LIBS@
XNEST_SYS_LIBS = @XNEST_SYS_LIBS@
-XORGCFG_DEP_CFLAGS = @XORGCFG_DEP_CFLAGS@
-XORGCFG_DEP_LIBS = @XORGCFG_DEP_LIBS@
-XORGCONFIG_DEP_CFLAGS = @XORGCONFIG_DEP_CFLAGS@
-XORGCONFIG_DEP_LIBS = @XORGCONFIG_DEP_LIBS@
XORG_CFLAGS = @XORG_CFLAGS@
XORG_INCS = @XORG_INCS@
XORG_LIBS = @XORG_LIBS@
@@ -305,13 +278,8 @@ XORG_MODULES_LIBS = @XORG_MODULES_LIBS@
XORG_OS = @XORG_OS@
XORG_OS_SUBDIR = @XORG_OS_SUBDIR@
XORG_SYS_LIBS = @XORG_SYS_LIBS@
-XPRINTMODULES_CFLAGS = @XPRINTMODULES_CFLAGS@
-XPRINTMODULES_LIBS = @XPRINTMODULES_LIBS@
-XPRINTPROTO_CFLAGS = @XPRINTPROTO_CFLAGS@
-XPRINTPROTO_LIBS = @XPRINTPROTO_LIBS@
-XPRINT_CFLAGS = @XPRINT_CFLAGS@
-XPRINT_LIBS = @XPRINT_LIBS@
-XPRINT_SYS_LIBS = @XPRINT_SYS_LIBS@
+XPBPROXY_CFLAGS = @XPBPROXY_CFLAGS@
+XPBPROXY_LIBS = @XPBPROXY_LIBS@
XRESEXAMPLES_DEP_CFLAGS = @XRESEXAMPLES_DEP_CFLAGS@
XRESEXAMPLES_DEP_LIBS = @XRESEXAMPLES_DEP_LIBS@
XSDL_INCS = @XSDL_INCS@
@@ -344,8 +312,7 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -365,7 +332,6 @@ driverdir = @driverdir@
dvidir = @dvidir@
exec_prefix = @exec_prefix@
extdir = @extdir@
-ft_config = @ft_config@
host = @host@
host_alias = @host_alias@
host_cpu = @host_cpu@
@@ -375,12 +341,12 @@ htmldir = @htmldir@
includedir = @includedir@
infodir = @infodir@
install_sh = @install_sh@
-launchagentsdir = @launchagentsdir@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
logdir = @logdir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
moduledir = @moduledir@
@@ -398,8 +364,6 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-xglmoduledir = @xglmoduledir@
-xpconfigdir = @xpconfigdir@
noinst_LTLIBRARIES = libmi.la
@XORG_TRUE@sdk_HEADERS = mibank.h micmap.h miline.h mipointer.h mi.h mibstore.h \
@XORG_TRUE@ migc.h mipointrst.h mizerarc.h micoord.h mifillarc.h \
@@ -474,8 +438,8 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
@@ -603,7 +567,7 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
diff --git a/xorg-server/mi/mi.h b/xorg-server/mi/mi.h
index 8d8f488a0..6e8b89e19 100644
--- a/xorg-server/mi/mi.h
+++ b/xorg-server/mi/mi.h
@@ -126,6 +126,7 @@ extern void miPutImage(
/* micursor.c */
extern void miRecolorCursor(
+ DeviceIntPtr /* pDev */,
ScreenPtr /*pScr*/,
CursorPtr /*pCurs*/,
Bool /*displayed*/
@@ -152,12 +153,17 @@ extern Bool mieqInit(
void
);
+extern void mieqResizeEvents(
+ int /* min_size */
+);
+
extern void mieqEnqueue(
DeviceIntPtr /*pDev*/,
xEventPtr /*e*/
);
extern void mieqSwitchScreen(
+ DeviceIntPtr /* pDev */,
ScreenPtr /*pScreen*/,
Bool /*fromDIX*/
);
@@ -169,6 +175,10 @@ extern void mieqProcessInputEvents(
typedef void (*mieqHandler)(int, xEventPtr, DeviceIntPtr, int);
void mieqSetHandler(int event, mieqHandler handler);
+void
+CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+ EventListPtr master, int count);
+
/* miexpose.c */
extern RegionPtr miHandleExposures(
@@ -363,10 +373,6 @@ extern Bool miRectAlloc(
int /*n*/
);
-extern int miFindMaxBand(
- RegionPtr /*prgn*/
-);
-
#ifdef DEBUG
extern Bool miValidRegion(
RegionPtr /*prgn*/
@@ -417,14 +423,6 @@ extern DevPrivateKey miAllocateGCPrivateIndex(
void
);
-extern PixmapPtr miGetScreenPixmap(
- ScreenPtr pScreen
-);
-
-extern void miSetScreenPixmap(
- PixmapPtr pPix
-);
-
/* mivaltree.c */
extern int miShapedWindowIn(
@@ -479,16 +477,6 @@ extern void miClearToBackground(
Bool /*generateExposures*/
);
-extern Bool miChangeSaveUnder(
- WindowPtr /*pWin*/,
- WindowPtr /*first*/
-);
-
-extern void miPostChangeSaveUnder(
- WindowPtr /*pWin*/,
- WindowPtr /*pFirst*/
-);
-
extern void miMarkWindow(
WindowPtr /*pWin*/
);
diff --git a/xorg-server/mi/miarc.c b/xorg-server/mi/miarc.c
index 5ccd11127..f0c863fd9 100644
--- a/xorg-server/mi/miarc.c
+++ b/xorg-server/mi/miarc.c
@@ -1042,11 +1042,7 @@ miFillWideEllipse(
*/
_X_EXPORT void
-miPolyArc(pDraw, pGC, narcs, parcs)
- DrawablePtr pDraw;
- GCPtr pGC;
- int narcs;
- xArc *parcs;
+miPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
{
int i;
xArc *parc;
diff --git a/xorg-server/mi/mibank.c b/xorg-server/mi/mibank.c
index ea79e9d36..dcaf4a14f 100644
--- a/xorg-server/mi/mibank.c
+++ b/xorg-server/mi/mibank.c
@@ -67,7 +67,6 @@
* dropped due to colour flashing concerns.
*
* TODO:
- * - Allow miModifyBanking() to change BankSize and nBankDepth.
* - Re-instate shared and double banking for framebuffers whose pixmap formats
* don't describe how the server "sees" the screen.
* - Remove remaining assumptions that a pixmap's devPrivate field points
@@ -175,8 +174,11 @@ typedef struct _miBankQueue
#define xalloc_ARRAY(atype, ntype) \
(atype *)xalloc((ntype) * sizeof(atype))
-static DevPrivateKey miBankScreenKey = &miBankScreenKey;
-static DevPrivateKey miBankGCKey = &miBankGCKey;
+static int miBankScreenKeyIndex;
+static DevPrivateKey miBankScreenKey = &miBankScreenKeyIndex;
+static int miBankGCKeyIndex;
+static DevPrivateKey miBankGCKey = &miBankGCKeyIndex;
+
static unsigned long miBankGeneration = 0;
#define BANK_SCRPRIVLVAL dixLookupPrivate(&pScreen->devPrivates, miBankScreenKey)
@@ -2201,71 +2203,6 @@ miInitializeBanking(
return TRUE;
}
-/* This is used to force GC revalidation when the banking type is changed */
-/*ARGSUSED*/
-static int
-miBankNewSerialNumber(
- WindowPtr pWin,
- pointer unused
-)
-{
- pWin->drawable.serialNumber = NEXT_SERIAL_NUMBER;
- return WT_WALKCHILDREN;
-}
-
-/* This entry modifies the banking interface */
-_X_EXPORT Bool
-miModifyBanking(
- ScreenPtr pScreen,
- miBankInfoPtr pBankInfo
-)
-{
- unsigned int type;
-
- if (!pScreen)
- return FALSE;
-
- if (miBankGeneration == serverGeneration)
- {
- SCREEN_INIT;
-
- if (pScreenPriv)
- {
- if (!pBankInfo || !pBankInfo->BankSize ||
- !pBankInfo->pBankA || !pBankInfo->pBankB ||
- !pBankInfo->SetSourceBank || !pBankInfo->SetDestinationBank ||
- !pBankInfo->SetSourceAndDestinationBanks)
- return FALSE;
-
- /* BankSize and nBankDepth cannot, as yet, be changed */
- if ((pScreenPriv->BankInfo.BankSize != pBankInfo->BankSize) ||
- (pScreenPriv->BankInfo.nBankDepth != pBankInfo->nBankDepth))
- return FALSE;
-
- if ((type = miBankDeriveType(pScreen, pBankInfo)) == BANK_NOBANK)
- return FALSE;
-
- /* Reset banking info */
- pScreenPriv->BankInfo = *pBankInfo;
- if (type != pScreenPriv->type)
- {
- /*
- * Banking type is changing. Revalidate all window GC's.
- */
- pScreenPriv->type = type;
- WalkTree(pScreen, miBankNewSerialNumber, 0);
- }
-
- return TRUE;
- }
- }
-
- if (!pBankInfo || !pBankInfo->BankSize)
- return TRUE; /* No change requested */
-
- return FALSE;
-}
-
/*
* Given various screen attributes, determine the minimum scanline width such
* that each scanline is server and DDX padded and any pixels with imbedded
diff --git a/xorg-server/mi/mibank.h b/xorg-server/mi/mibank.h
index fe93ab41b..327507db9 100644
--- a/xorg-server/mi/mibank.h
+++ b/xorg-server/mi/mibank.h
@@ -94,12 +94,6 @@ miInitializeBanking(
miBankInfoPtr /*pBankInfo*/
);
-Bool
-miModifyBanking(
- ScreenPtr /*pScreen*/,
- miBankInfoPtr /*pBankInfo*/
-);
-
/*
* This function determines the minimum screen width, given a initial estimate
* and various screen attributes. DDX needs to determine this width before
diff --git a/xorg-server/mi/mibitblt.c b/xorg-server/mi/mibitblt.c
index 14d68e2e1..3e82a5592 100644
--- a/xorg-server/mi/mibitblt.c
+++ b/xorg-server/mi/mibitblt.c
@@ -73,15 +73,16 @@ extern int ffs(int);
* set them in the destination with SetSpans
* We let SetSpans worry about clipping to the destination.
*/
-_X_EXPORT RegionPtr
-miCopyArea(pSrcDrawable, pDstDrawable,
- pGC, xIn, yIn, widthSrc, heightSrc, xOut, yOut)
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- GCPtr pGC;
- int xIn, yIn;
- int widthSrc, heightSrc;
- int xOut, yOut;
+RegionPtr
+miCopyArea(DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int xIn,
+ int yIn,
+ int widthSrc,
+ int heightSrc,
+ int xOut,
+ int yOut)
{
DDXPointPtr ppt, pptFirst;
unsigned int *pwidthFirst, *pwidth, *pbits;
@@ -316,11 +317,10 @@ miGetPlane(
sy += pDraw->y;
widthInBytes = BitmapBytePad(w);
if(!result)
- result = (MiBits *)xalloc(h * widthInBytes);
+ result = xcalloc(h, widthInBytes);
if (!result)
return (MiBits *)NULL;
bitsPerPixel = pDraw->bitsPerPixel;
- bzero((char *)result, h * widthInBytes);
pOut = (OUT_TYPE *) result;
if(bitsPerPixel == 1)
{
@@ -548,16 +548,17 @@ miOpqStipDrawable(DrawablePtr pDraw, GCPtr pGC, RegionPtr prgnSrc,
* build a source clip
* Use the bitmap we've built up as a Stipple for the destination
*/
-_X_EXPORT RegionPtr
-miCopyPlane(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, bitPlane)
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- GCPtr pGC;
- int srcx, srcy;
- int width, height;
- int dstx, dsty;
- unsigned long bitPlane;
+RegionPtr
+miCopyPlane( DrawablePtr pSrcDrawable,
+ DrawablePtr pDstDrawable,
+ GCPtr pGC,
+ int srcx,
+ int srcy,
+ int width,
+ int height,
+ int dstx,
+ int dsty,
+ unsigned long bitPlane)
{
MiBits *ptile;
BoxRec box;
@@ -643,12 +644,8 @@ miCopyPlane(pSrcDrawable, pDstDrawable,
* get the single plane specified in planemask
*/
_X_EXPORT void
-miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
- DrawablePtr pDraw;
- int sx, sy, w, h;
- unsigned int format;
- unsigned long planeMask;
- char * pDst;
+miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planeMask, char *pDst)
{
unsigned char depth;
int i, linelength, width, srcx, srcy;
@@ -745,12 +742,9 @@ miGetImage(pDraw, sx, sy, w, h, format, planeMask, pDst)
* This part is simple, just call SetSpans
*/
_X_EXPORT void
-miPutImage(pDraw, pGC, depth, x, y, w, h, leftPad, format, pImage)
- DrawablePtr pDraw;
- GCPtr pGC;
- int depth, x, y, w, h, leftPad;
- int format;
- char *pImage;
+miPutImage( DrawablePtr pDraw, GCPtr pGC, int depth,
+ int x, int y, int w, int h,
+ int leftPad, int format, char *pImage)
{
DDXPointPtr pptFirst, ppt;
int *pwidthFirst, *pwidth;
diff --git a/xorg-server/mi/micmap.c b/xorg-server/mi/micmap.c
index 33d948179..b92ddece5 100644
--- a/xorg-server/mi/micmap.c
+++ b/xorg-server/mi/micmap.c
@@ -48,12 +48,6 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE.
_X_EXPORT ColormapPtr miInstalledMaps[MAXSCREENS];
-static Bool miDoInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
- int *ndepthp, int *rootDepthp, VisualID *defaultVisp,
- unsigned long sizes, int bitsPerRGB, int preferredVis);
-
-_X_EXPORT miInitVisualsProcPtr miInitVisualsProc = miDoInitVisuals;
-
_X_EXPORT int
miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps)
{
@@ -479,20 +473,6 @@ miSetPixmapDepths (void)
return TRUE;
}
-_X_EXPORT Bool
-miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
- int *ndepthp, int *rootDepthp, VisualID *defaultVisp,
- unsigned long sizes, int bitsPerRGB, int preferredVis)
-
-{
- if (miInitVisualsProc)
- return miInitVisualsProc(visualp, depthp, nvisualp, ndepthp,
- rootDepthp, defaultVisp, sizes, bitsPerRGB,
- preferredVis);
- else
- return FALSE;
-}
-
/*
* Distance to least significant one bit
*/
@@ -517,10 +497,11 @@ maskShift (Pixel p)
* the set which can be used with this version of cfb.
*/
-static Bool
-miDoInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
+_X_EXPORT Bool
+miInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
int *ndepthp, int *rootDepthp, VisualID *defaultVisp,
unsigned long sizes, int bitsPerRGB, int preferredVis)
+
{
int i, j = 0, k;
VisualPtr visual;
@@ -688,10 +669,3 @@ miDoInitVisuals(VisualPtr *visualp, DepthPtr *depthp, int *nvisualp,
return TRUE;
}
-
-void
-miResetInitVisuals(void)
-{
- miInitVisualsProc = miDoInitVisuals;
-}
-
diff --git a/xorg-server/mi/micmap.h b/xorg-server/mi/micmap.h
index 9ee9f4ae4..667004b49 100644
--- a/xorg-server/mi/micmap.h
+++ b/xorg-server/mi/micmap.h
@@ -10,8 +10,6 @@ typedef Bool (* miInitVisualsProcPtr)(VisualPtr *, DepthPtr *, int *, int *,
int *, VisualID *, unsigned long, int,
int);
-extern miInitVisualsProcPtr miInitVisualsProc;
-
int miListInstalledColormaps(ScreenPtr pScreen, Colormap *pmaps);
void miInstallColormap(ColormapPtr pmap);
void miUninstallColormap(ColormapPtr pmap);
@@ -30,11 +28,6 @@ Bool miSetVisualTypesAndMasks(int depth, int visuals, int bitsPerRGB,
int miGetDefaultVisualMask(int);
Bool miInitVisuals(VisualPtr *, DepthPtr *, int *, int *, int *, VisualID *,
unsigned long, int, int);
-void miResetInitVisuals(void);
-
-void miHookInitVisuals(void (**old)(miInitVisualsProcPtr *),
- void (*new)(miInitVisualsProcPtr *));
-
#define MAX_PSEUDO_DEPTH 10
#define MIN_TRUE_DEPTH 6
diff --git a/xorg-server/mi/micoord.h b/xorg-server/mi/micoord.h
index 876e88c95..e6d814fc8 100644
--- a/xorg-server/mi/micoord.h
+++ b/xorg-server/mi/micoord.h
@@ -43,12 +43,12 @@
* forcing as to use div instead of shift. Let's be explicit.
*/
-#if defined(mips) || defined(sgi) || \
+#if defined(mips) || \
defined(sparc) || defined(__sparc64__) || \
defined(__alpha) || defined(__alpha__) || \
defined(__i386__) || defined(__i386) || defined(__ia64__) || \
defined(__s390x__) || defined(__s390__) || \
- defined(__amd64__) || defined(amd64) || defined(__amd64) || defined(__x86_64__)
+ defined(__amd64__) || defined(amd64) || defined(__amd64)
#define GetHighWord(x) (((int) (x)) >> 16)
#else
#define GetHighWord(x) (((int) (x)) / 65536)
diff --git a/xorg-server/mi/micursor.c b/xorg-server/mi/micursor.c
index 6e06fbc07..f6ae8f488 100644
--- a/xorg-server/mi/micursor.c
+++ b/xorg-server/mi/micursor.c
@@ -52,24 +52,18 @@ SOFTWARE.
#include "cursor.h"
#include "misc.h"
#include "mi.h"
+#include "inputstr.h"
-extern Bool Must_have_memory;
-
-_X_EXPORT void
-miRecolorCursor( pScr, pCurs, displayed)
- ScreenPtr pScr;
- CursorPtr pCurs;
- Bool displayed;
+void
+miRecolorCursor(DeviceIntPtr pDev, ScreenPtr pScr,
+ CursorPtr pCurs, Bool displayed)
{
/*
* This is guaranteed to correct any color-dependent state which may have
* been bound up in private state created by RealizeCursor
*/
- (* pScr->UnrealizeCursor)( pScr, pCurs);
- Must_have_memory = TRUE; /* XXX */
- (* pScr->RealizeCursor)( pScr, pCurs);
- Must_have_memory = FALSE; /* XXX */
- if ( displayed)
- (* pScr->DisplayCursor)( pScr, pCurs);
-
+ pScr->UnrealizeCursor(pDev, pScr, pCurs);
+ pScr->RealizeCursor(pDev, pScr, pCurs);
+ if (displayed)
+ pScr->DisplayCursor(pDev, pScr, pCurs);
}
diff --git a/xorg-server/mi/midash.c b/xorg-server/mi/midash.c
index 95a19c295..ba64d354f 100644
--- a/xorg-server/mi/midash.c
+++ b/xorg-server/mi/midash.c
@@ -52,13 +52,14 @@ SOFTWARE.
#include "mistruct.h"
#include "mifpoly.h"
-_X_EXPORT void
-miStepDash (dist, pDashIndex, pDash, numInDashList, pDashOffset)
- int dist; /* distance to step */
- int *pDashIndex; /* current dash */
- unsigned char *pDash; /* dash list */
- int numInDashList; /* total length of dash list */
- int *pDashOffset; /* offset into current dash */
+void
+miStepDash (
+ int dist, /* distance to step */
+ int *pDashIndex, /* current dash */
+ unsigned char *pDash, /* dash list */
+ int numInDashList, /* total length of dash list */
+ int *pDashOffset /* offset into current dash */
+ )
{
int dashIndex, dashOffset;
int totallen;
diff --git a/xorg-server/mi/midispcur.c b/xorg-server/mi/midispcur.c
index 45e0e9abe..05352fc89 100644
--- a/xorg-server/mi/midispcur.c
+++ b/xorg-server/mi/midispcur.c
@@ -52,23 +52,41 @@ in this Software without prior written authorization from The Open Group.
# include "picturestr.h"
#endif
-/* per-screen private data */
+# include "inputstr.h" /* for MAX_DEVICES */
-static DevPrivateKey miDCScreenKey = &miDCScreenKey;
+/* per-screen private data */
+static int miDCScreenKeyIndex;
+static DevPrivateKey miDCScreenKey = &miDCScreenKeyIndex;
static Bool miDCCloseScreen(int index, ScreenPtr pScreen);
+/* per device private data */
+static int miDCSpriteKeyIndex;
+static DevPrivateKey miDCSpriteKey = &miDCSpriteKeyIndex;
+
typedef struct {
GCPtr pSourceGC, pMaskGC;
GCPtr pSaveGC, pRestoreGC;
GCPtr pMoveGC;
GCPtr pPixSourceGC, pPixMaskGC;
- CloseScreenProcPtr CloseScreen;
PixmapPtr pSave, pTemp;
#ifdef ARGB_CURSOR
PicturePtr pRootPicture;
PicturePtr pTempPicture;
#endif
+} miDCBufferRec, *miDCBufferPtr;
+
+#define MIDCBUFFER(dev) \
+ ((DevHasCursor(dev)) ? \
+ (miDCBufferPtr)dixLookupPrivate(&dev->devPrivates, miDCSpriteKey) : \
+ (miDCBufferPtr)dixLookupPrivate(&dev->u.master->devPrivates, miDCSpriteKey))
+
+/*
+ * The core pointer buffer will point to the index of the virtual core pointer
+ * in the pCursorBuffers array.
+ */
+typedef struct {
+ CloseScreenProcPtr CloseScreen;
} miDCScreenRec, *miDCScreenPtr;
/* per-cursor per-screen private data */
@@ -86,18 +104,25 @@ typedef struct {
static Bool miDCRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
static Bool miDCUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-static Bool miDCPutUpCursor(ScreenPtr pScreen, CursorPtr pCursor,
- int x, int y, unsigned long source,
- unsigned long mask);
-static Bool miDCSaveUnderCursor(ScreenPtr pScreen, int x, int y,
+static Bool miDCPutUpCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, int x, int y,
+ unsigned long source, unsigned long mask);
+static Bool miDCSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y,
int w, int h);
-static Bool miDCRestoreUnderCursor(ScreenPtr pScreen, int x, int y,
+static Bool miDCRestoreUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y,
int w, int h);
-static Bool miDCMoveCursor(ScreenPtr pScreen, CursorPtr pCursor,
- int x, int y, int w, int h, int dx, int dy,
+static Bool miDCMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, int x, int y,
+ int w, int h, int dx, int dy,
unsigned long source, unsigned long mask);
-static Bool miDCChangeSave(ScreenPtr pScreen, int x, int y, int w, int h,
- int dx, int dy);
+static Bool miDCChangeSave(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h,
+ int dx, int dy);
+
+static Bool miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen);
+static void miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen);
static miSpriteCursorFuncRec miDCFuncs = {
miDCRealizeCursor,
@@ -107,12 +132,12 @@ static miSpriteCursorFuncRec miDCFuncs = {
miDCRestoreUnderCursor,
miDCMoveCursor,
miDCChangeSave,
+ miDCDeviceInitialize,
+ miDCDeviceCleanup
};
_X_EXPORT Bool
-miDCInitialize (pScreen, screenFuncs)
- ScreenPtr pScreen;
- miPointerScreenFuncPtr screenFuncs;
+miDCInitialize (ScreenPtr pScreen, miPointerScreenFuncPtr screenFuncs)
{
miDCScreenPtr pScreenPriv;
@@ -120,27 +145,10 @@ miDCInitialize (pScreen, screenFuncs)
if (!pScreenPriv)
return FALSE;
- /*
- * initialize the entire private structure to zeros
- */
-
- pScreenPriv->pSourceGC =
- pScreenPriv->pMaskGC =
- pScreenPriv->pSaveGC =
- pScreenPriv->pRestoreGC =
- pScreenPriv->pMoveGC =
- pScreenPriv->pPixSourceGC =
- pScreenPriv->pPixMaskGC = NULL;
-#ifdef ARGB_CURSOR
- pScreenPriv->pRootPicture = NULL;
- pScreenPriv->pTempPicture = NULL;
-#endif
-
- pScreenPriv->pSave = pScreenPriv->pTemp = NULL;
pScreenPriv->CloseScreen = pScreen->CloseScreen;
pScreen->CloseScreen = miDCCloseScreen;
-
+
dixSetPrivate(&pScreen->devPrivates, miDCScreenKey, pScreenPriv);
if (!miSpriteInitialize (pScreen, &miDCFuncs, screenFuncs))
@@ -156,38 +164,22 @@ miDCInitialize (pScreen, screenFuncs)
#define tossPict(pict) (pict ? FreePicture (pict, 0) : 0)
static Bool
-miDCCloseScreen (index, pScreen)
- int index;
- ScreenPtr pScreen;
+miDCCloseScreen (int index, ScreenPtr pScreen)
{
miDCScreenPtr pScreenPriv;
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pScreen->CloseScreen = pScreenPriv->CloseScreen;
- tossGC (pScreenPriv->pSourceGC);
- tossGC (pScreenPriv->pMaskGC);
- tossGC (pScreenPriv->pSaveGC);
- tossGC (pScreenPriv->pRestoreGC);
- tossGC (pScreenPriv->pMoveGC);
- tossGC (pScreenPriv->pPixSourceGC);
- tossGC (pScreenPriv->pPixMaskGC);
- tossPix (pScreenPriv->pSave);
- tossPix (pScreenPriv->pTemp);
-#ifdef ARGB_CURSOR
- tossPict (pScreenPriv->pTempPicture);
-#endif
xfree ((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (index, pScreen);
}
static Bool
-miDCRealizeCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miDCRealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
{
if (pCursor->bits->refcnt <= 1)
- dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL);
+ dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
return TRUE;
}
@@ -232,9 +224,7 @@ miDCMakePicture (PicturePtr *ppPicture, DrawablePtr pDraw, WindowPtr pWin)
#endif
static miDCCursorPtr
-miDCRealize (
- ScreenPtr pScreen,
- CursorPtr pCursor)
+miDCRealize (ScreenPtr pScreen, CursorPtr pCursor)
{
miDCCursorPtr pPriv;
GCPtr pGC;
@@ -288,7 +278,7 @@ miDCRealize (
xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL;
}
- dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv);
+ dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
return pPriv;
}
pPriv->pPicture = 0;
@@ -306,7 +296,7 @@ miDCRealize (
xfree ((pointer) pPriv);
return (miDCCursorPtr)NULL;
}
- dixSetPrivate(&pCursor->bits->devPrivates, pScreen, pPriv);
+ dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), pPriv);
/* create the two sets of bits, clipping as appropriate */
@@ -346,14 +336,12 @@ miDCRealize (
}
static Bool
-miDCUnrealizeCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miDCUnrealizeCursor (ScreenPtr pScreen, CursorPtr pCursor)
{
miDCCursorPtr pPriv;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
- pScreen);
+ CursorScreenKey(pScreen));
if (pPriv && (pCursor->bits->refcnt <= 1))
{
if (pPriv->sourceBits)
@@ -365,7 +353,7 @@ miDCUnrealizeCursor (pScreen, pCursor)
FreePicture (pPriv->pPicture, 0);
#endif
xfree ((pointer) pPriv);
- dixSetPrivate(&pCursor->bits->devPrivates, pScreen, NULL);
+ dixSetPrivate(&pCursor->bits->devPrivates, CursorScreenKey(pScreen), NULL);
}
return TRUE;
}
@@ -450,18 +438,16 @@ miDCMakeGC(
static Bool
-miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
- ScreenPtr pScreen;
- CursorPtr pCursor;
- int x, y;
- unsigned long source, mask;
+miDCPutUpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, unsigned long source, unsigned long mask)
{
miDCScreenPtr pScreenPriv;
miDCCursorPtr pPriv;
+ miDCBufferPtr pBuffer;
WindowPtr pWin;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
- pScreen);
+ CursorScreenKey(pScreen));
if (!pPriv)
{
pPriv = miDCRealize(pScreen, pCursor);
@@ -471,15 +457,26 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
+ pBuffer = MIDCBUFFER(pDev);
+
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- if (!EnsurePicture(pScreenPriv->pRootPicture, &pWin->drawable, pWin))
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRootPicture &&
+ pBuffer->pRootPicture->pDrawable &&
+ pBuffer->pRootPicture->pDrawable->pScreen != pScreen)
+ {
+ tossPict(pBuffer->pRootPicture);
+ pBuffer->pRootPicture = NULL;
+ }
+
+ if (!EnsurePicture(pBuffer->pRootPicture, &pWin->drawable, pWin))
return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
- pScreenPriv->pRootPicture,
+ pBuffer->pRootPicture,
0, 0, 0, 0,
x, y,
pCursor->bits->width,
@@ -488,16 +485,35 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
else
#endif
{
- if (!EnsureGC(pScreenPriv->pSourceGC, pWin))
+ /**
+ * XXX: Before MPX, the sourceGC and maskGC were attached to the
+ * screen, and would switch as the screen switches. With mpx we have
+ * the GC's attached to the device now, so each time we switch screen
+ * we need to make sure the GC's are allocated on the new screen.
+ * This is ... not optimal. (whot)
+ */
+ if (pBuffer->pSourceGC && pScreen != pBuffer->pSourceGC->pScreen)
+ {
+ tossGC(pBuffer->pSourceGC);
+ pBuffer->pSourceGC = NULL;
+ }
+
+ if (pBuffer->pMaskGC && pScreen != pBuffer->pMaskGC->pScreen)
+ {
+ tossGC(pBuffer->pMaskGC);
+ pBuffer->pMaskGC = NULL;
+ }
+
+ if (!EnsureGC(pBuffer->pSourceGC, pWin))
return FALSE;
- if (!EnsureGC(pScreenPriv->pMaskGC, pWin))
+ if (!EnsureGC(pBuffer->pMaskGC, pWin))
{
- FreeGC (pScreenPriv->pSourceGC, (GContext) 0);
- pScreenPriv->pSourceGC = 0;
+ FreeGC (pBuffer->pSourceGC, (GContext) 0);
+ pBuffer->pSourceGC = 0;
return FALSE;
}
miDCPutBits ((DrawablePtr)pWin, pPriv,
- pScreenPriv->pSourceGC, pScreenPriv->pMaskGC,
+ pBuffer->pSourceGC, pBuffer->pMaskGC,
x, y, pCursor->bits->width, pCursor->bits->height,
source, mask);
}
@@ -505,31 +521,39 @@ miDCPutUpCursor (pScreen, pCursor, x, y, source, mask)
}
static Bool
-miDCSaveUnderCursor (pScreen, x, y, w, h)
- ScreenPtr pScreen;
- int x, y, w, h;
+miDCSaveUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h)
{
miDCScreenPtr pScreenPriv;
+ miDCBufferPtr pBuffer;
PixmapPtr pSave;
WindowPtr pWin;
GCPtr pGC;
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pSave = pScreenPriv->pSave;
+ pBuffer = MIDCBUFFER(pDev);
+
+ pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
if (!pSave || pSave->drawable.width < w || pSave->drawable.height < h)
{
if (pSave)
(*pScreen->DestroyPixmap) (pSave);
- pScreenPriv->pSave = pSave =
+ pBuffer->pSave = pSave =
(*pScreen->CreatePixmap) (pScreen, w, h, pScreen->rootDepth, 0);
if (!pSave)
return FALSE;
}
- if (!EnsureGC(pScreenPriv->pSaveGC, pWin))
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pSaveGC && pBuffer->pSaveGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pSaveGC);
+ pBuffer->pSaveGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pSaveGC, pWin))
return FALSE;
- pGC = pScreenPriv->pSaveGC;
+ pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pSave, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr) pWin, (DrawablePtr) pSave, pGC,
@@ -538,24 +562,32 @@ miDCSaveUnderCursor (pScreen, x, y, w, h)
}
static Bool
-miDCRestoreUnderCursor (pScreen, x, y, w, h)
- ScreenPtr pScreen;
- int x, y, w, h;
+miDCRestoreUnderCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h)
{
miDCScreenPtr pScreenPriv;
+ miDCBufferPtr pBuffer;
PixmapPtr pSave;
WindowPtr pWin;
GCPtr pGC;
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pSave = pScreenPriv->pSave;
+ pBuffer = MIDCBUFFER(pDev);
+ pSave = pBuffer->pSave;
+
pWin = WindowTable[pScreen->myNum];
if (!pSave)
return FALSE;
- if (!EnsureGC(pScreenPriv->pRestoreGC, pWin))
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pRestoreGC);
+ pBuffer->pRestoreGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pRestoreGC, pWin))
return FALSE;
- pGC = pScreenPriv->pRestoreGC;
+ pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
(*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
@@ -564,11 +596,11 @@ miDCRestoreUnderCursor (pScreen, x, y, w, h)
}
static Bool
-miDCChangeSave (pScreen, x, y, w, h, dx, dy)
- ScreenPtr pScreen;
- int x, y, w, h, dx, dy;
+miDCChangeSave (DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, int w, int h, int dx, int dy)
{
miDCScreenPtr pScreenPriv;
+ miDCBufferPtr pBuffer;
PixmapPtr pSave;
WindowPtr pWin;
GCPtr pGC;
@@ -576,16 +608,24 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy)
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
- pSave = pScreenPriv->pSave;
+ pBuffer = MIDCBUFFER(pDev);
+
+ pSave = pBuffer->pSave;
pWin = WindowTable[pScreen->myNum];
/*
* restore the bits which are about to get trashed
*/
if (!pSave)
return FALSE;
- if (!EnsureGC(pScreenPriv->pRestoreGC, pWin))
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pRestoreGC);
+ pBuffer->pRestoreGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pRestoreGC, pWin))
return FALSE;
- pGC = pScreenPriv->pRestoreGC;
+ pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
/*
@@ -623,9 +663,15 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy)
(*pGC->ops->CopyArea) ((DrawablePtr) pSave, (DrawablePtr) pWin, pGC,
0, sourcey, -dx, copyh, x + dx, desty);
}
- if (!EnsureGC(pScreenPriv->pSaveGC, pWin))
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pSaveGC && pBuffer->pSaveGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pSaveGC);
+ pBuffer->pSaveGC = NULL;
+ }
+ if (!EnsureGC(pBuffer->pSaveGC, pWin))
return FALSE;
- pGC = pScreenPriv->pSaveGC;
+ pGC = pBuffer->pSaveGC;
if (pSave->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pSave, pGC);
/*
@@ -697,14 +743,13 @@ miDCChangeSave (pScreen, x, y, w, h, dx, dy)
}
static Bool
-miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
- ScreenPtr pScreen;
- CursorPtr pCursor;
- int x, y, w, h, dx, dy;
- unsigned long source, mask;
+miDCMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
+ int x, int y, int w, int h, int dx, int dy,
+ unsigned long source, unsigned long mask)
{
miDCCursorPtr pPriv;
miDCScreenPtr pScreenPriv;
+ miDCBufferPtr pBuffer;
int status;
WindowPtr pWin;
GCPtr pGC;
@@ -712,7 +757,7 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
PixmapPtr pTemp;
pPriv = (miDCCursorPtr)dixLookupPrivate(&pCursor->bits->devPrivates,
- pScreen);
+ CursorScreenKey(pScreen));
if (!pPriv)
{
pPriv = miDCRealize(pScreen, pCursor);
@@ -722,39 +767,41 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
pScreenPriv = (miDCScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miDCScreenKey);
pWin = WindowTable[pScreen->myNum];
- pTemp = pScreenPriv->pTemp;
+ pBuffer = MIDCBUFFER(pDev);
+
+ pTemp = pBuffer->pTemp;
if (!pTemp ||
- pTemp->drawable.width != pScreenPriv->pSave->drawable.width ||
- pTemp->drawable.height != pScreenPriv->pSave->drawable.height)
+ pTemp->drawable.width != pBuffer->pSave->drawable.width ||
+ pTemp->drawable.height != pBuffer->pSave->drawable.height)
{
if (pTemp)
(*pScreen->DestroyPixmap) (pTemp);
#ifdef ARGB_CURSOR
- if (pScreenPriv->pTempPicture)
+ if (pBuffer->pTempPicture)
{
- FreePicture (pScreenPriv->pTempPicture, 0);
- pScreenPriv->pTempPicture = 0;
+ FreePicture (pBuffer->pTempPicture, 0);
+ pBuffer->pTempPicture = 0;
}
#endif
- pScreenPriv->pTemp = pTemp = (*pScreen->CreatePixmap)
- (pScreen, w, h, pScreenPriv->pSave->drawable.depth, 0);
+ pBuffer->pTemp = pTemp = (*pScreen->CreatePixmap)
+ (pScreen, w, h, pBuffer->pSave->drawable.depth, 0);
if (!pTemp)
return FALSE;
}
- if (!pScreenPriv->pMoveGC)
+ if (!pBuffer->pMoveGC)
{
- pScreenPriv->pMoveGC = CreateGC ((DrawablePtr)pTemp,
+ pBuffer->pMoveGC = CreateGC ((DrawablePtr)pTemp,
GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pScreenPriv->pMoveGC)
+ if (!pBuffer->pMoveGC)
return FALSE;
}
/*
* copy the saved area to a temporary pixmap
*/
- pGC = pScreenPriv->pMoveGC;
+ pGC = pBuffer->pMoveGC;
if (pGC->serialNumber != pTemp->drawable.serialNumber)
ValidateGC ((DrawablePtr) pTemp, pGC);
- (*pGC->ops->CopyArea)((DrawablePtr)pScreenPriv->pSave,
+ (*pGC->ops->CopyArea)((DrawablePtr)pBuffer->pSave,
(DrawablePtr)pTemp, pGC, 0, 0, w, h, 0, 0);
/*
@@ -763,12 +810,21 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
#ifdef ARGB_CURSOR
if (pPriv->pPicture)
{
- if (!EnsurePicture(pScreenPriv->pTempPicture, &pTemp->drawable, pWin))
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pTempPicture &&
+ pBuffer->pTempPicture->pDrawable &&
+ pBuffer->pTempPicture->pDrawable->pScreen != pScreen)
+ {
+ tossPict(pBuffer->pTempPicture);
+ pBuffer->pTempPicture = NULL;
+ }
+
+ if (!EnsurePicture(pBuffer->pTempPicture, &pTemp->drawable, pWin))
return FALSE;
CompositePicture (PictOpOver,
pPriv->pPicture,
NULL,
- pScreenPriv->pTempPicture,
+ pBuffer->pTempPicture,
0, 0, 0, 0,
dx, dy,
pCursor->bits->width,
@@ -777,33 +833,39 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
else
#endif
{
- if (!pScreenPriv->pPixSourceGC)
+ if (!pBuffer->pPixSourceGC)
{
- pScreenPriv->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
+ pBuffer->pPixSourceGC = CreateGC ((DrawablePtr)pTemp,
GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pScreenPriv->pPixSourceGC)
+ if (!pBuffer->pPixSourceGC)
return FALSE;
}
- if (!pScreenPriv->pPixMaskGC)
+ if (!pBuffer->pPixMaskGC)
{
- pScreenPriv->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
+ pBuffer->pPixMaskGC = CreateGC ((DrawablePtr)pTemp,
GCGraphicsExposures, &gcval, &status, (XID)0, serverClient);
- if (!pScreenPriv->pPixMaskGC)
+ if (!pBuffer->pPixMaskGC)
return FALSE;
}
miDCPutBits ((DrawablePtr)pTemp, pPriv,
- pScreenPriv->pPixSourceGC, pScreenPriv->pPixMaskGC,
+ pBuffer->pPixSourceGC, pBuffer->pPixMaskGC,
dx, dy, pCursor->bits->width, pCursor->bits->height,
source, mask);
}
+ /* see comment in miDCPutUpCursor */
+ if (pBuffer->pRestoreGC && pBuffer->pRestoreGC->pScreen != pScreen)
+ {
+ tossGC(pBuffer->pRestoreGC);
+ pBuffer->pRestoreGC = NULL;
+ }
/*
* copy the temporary pixmap onto the screen
*/
- if (!EnsureGC(pScreenPriv->pRestoreGC, pWin))
+ if (!EnsureGC(pBuffer->pRestoreGC, pWin))
return FALSE;
- pGC = pScreenPriv->pRestoreGC;
+ pGC = pBuffer->pRestoreGC;
if (pWin->drawable.serialNumber != pGC->serialNumber)
ValidateGC ((DrawablePtr) pWin, pGC);
@@ -812,3 +874,55 @@ miDCMoveCursor (pScreen, pCursor, x, y, w, h, dx, dy, source, mask)
0, 0, w, h, x, y);
return TRUE;
}
+
+static Bool
+miDCDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ miDCBufferPtr pBuffer;
+
+ pBuffer = xalloc(sizeof(miDCBufferRec));
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, pBuffer);
+
+ pBuffer->pSourceGC =
+ pBuffer->pMaskGC =
+ pBuffer->pSaveGC =
+ pBuffer->pRestoreGC =
+ pBuffer->pMoveGC =
+ pBuffer->pPixSourceGC =
+ pBuffer->pPixMaskGC = NULL;
+#ifdef ARGB_CURSOR
+ pBuffer->pRootPicture = NULL;
+ pBuffer->pTempPicture = NULL;
+#endif
+ pBuffer->pSave = pBuffer->pTemp = NULL;
+
+ return TRUE;
+}
+
+static void
+miDCDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ miDCBufferPtr pBuffer;
+
+ if (DevHasCursor(pDev))
+ {
+ pBuffer = MIDCBUFFER(pDev);
+ tossGC (pBuffer->pSourceGC);
+ tossGC (pBuffer->pMaskGC);
+ tossGC (pBuffer->pSaveGC);
+ tossGC (pBuffer->pRestoreGC);
+ tossGC (pBuffer->pMoveGC);
+ tossGC (pBuffer->pPixSourceGC);
+ tossGC (pBuffer->pPixMaskGC);
+ tossPix (pBuffer->pSave);
+ tossPix (pBuffer->pTemp);
+#ifdef ARGB_CURSOR
+#if 0 /* This has been free()d before */
+ tossPict (pScreenPriv->pRootPicture);
+#endif
+ tossPict (pBuffer->pTempPicture);
+#endif
+ xfree(pBuffer);
+ dixSetPrivate(&pDev->devPrivates, miDCSpriteKey, NULL);
+ }
+}
diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c
index 803724708..213ad5b40 100644
--- a/xorg-server/mi/mieq.c
+++ b/xorg-server/mi/mieq.c
@@ -49,6 +49,7 @@ in this Software without prior written authorization from The Open Group.
# include "scrnintstr.h"
# include <X11/extensions/XI.h>
# include <X11/extensions/XIproto.h>
+# include <X11/extensions/geproto.h>
# include "extinit.h"
# include "exglobals.h"
@@ -60,8 +61,11 @@ in this Software without prior written authorization from The Open Group.
#define QUEUE_SIZE 512
+#define EnqueueScreen(dev) dev->spriteInfo->sprite->pEnqueueScreen
+#define DequeueScreen(dev) dev->spriteInfo->sprite->pDequeueScreen
+
typedef struct _Event {
- xEvent event[7];
+ EventListPtr events;
int nevents;
ScreenPtr pScreen;
DeviceIntPtr pDev; /* device this event _originated_ from */
@@ -72,12 +76,30 @@ typedef struct _EventQueue {
CARD32 lastEventTime; /* to avoid time running backwards */
int lastMotion; /* device ID if last event motion? */
EventRec events[QUEUE_SIZE]; /* static allocation for signals */
- ScreenPtr pEnqueueScreen; /* screen events are being delivered to */
- ScreenPtr pDequeueScreen; /* screen events are being dispatched to */
mieqHandler handlers[128]; /* custom event handler */
} EventQueueRec, *EventQueuePtr;
static EventQueueRec miEventQueue;
+static EventListPtr masterEvents; /* for use in mieqProcessInputEvents */
+
+#ifdef XQUARTZ
+#include <pthread.h>
+static pthread_mutex_t miEventQueueMutex = PTHREAD_MUTEX_INITIALIZER;
+
+extern BOOL serverInitComplete;
+extern pthread_mutex_t serverInitCompleteMutex;
+extern pthread_cond_t serverInitCompleteCond;
+
+static inline void wait_for_server_init(void) {
+ /* If the server hasn't finished initializing, wait for it... */
+ if(!serverInitComplete) {
+ pthread_mutex_lock(&serverInitCompleteMutex);
+ while(!serverInitComplete)
+ pthread_cond_wait(&serverInitCompleteCond, &serverInitCompleteMutex);
+ pthread_mutex_unlock(&serverInitCompleteMutex);
+ }
+}
+#endif
Bool
mieqInit(void)
@@ -87,14 +109,40 @@ mieqInit(void)
miEventQueue.head = miEventQueue.tail = 0;
miEventQueue.lastEventTime = GetTimeInMillis ();
miEventQueue.lastMotion = FALSE;
- miEventQueue.pEnqueueScreen = screenInfo.screens[0];
- miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen;
for (i = 0; i < 128; i++)
miEventQueue.handlers[i] = NULL;
+ for (i = 0; i < QUEUE_SIZE; i++)
+ {
+ EventListPtr evlist = InitEventList(1 + MAX_VALUATOR_EVENTS);
+ if (!evlist)
+ FatalError("Could not allocate event queue.\n");
+ miEventQueue.events[i].events = evlist;
+ }
+
+ /* XXX: mE is just 1 event long, if we have Motion + Valuator they are
+ * squashed into the first event to make passing it into the event
+ * processing handlers easier. This should be fixed when the processing
+ * handlers switch to EventListPtr instead of xEvent */
+ masterEvents = InitEventList(1);
+ if (!masterEvents)
+ FatalError("Could not allocated MD event queue.\n");
+ SetMinimumEventSize(masterEvents, 1,
+ (1 + MAX_VALUATOR_EVENTS) * sizeof(xEvent));
+
SetInputCheck(&miEventQueue.head, &miEventQueue.tail);
return TRUE;
}
+/* Ensure all events in the EQ are at least size bytes. */
+void
+mieqResizeEvents(int min_size)
+{
+ int i;
+
+ for (i = 0; i < QUEUE_SIZE; i++)
+ SetMinimumEventSize(miEventQueue.events[i].events, 7, min_size);
+}
+
/*
* Must be reentrant with ProcessInputEvents. Assumption: mieqEnqueue
* will never be interrupted. If this is called from both signal
@@ -105,23 +153,37 @@ mieqInit(void)
void
mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
{
- unsigned int oldtail = miEventQueue.tail, newtail;
+ unsigned int oldtail = miEventQueue.tail;
+ EventListPtr evt;
int isMotion = 0;
- deviceValuator *v = (deviceValuator *) e;
- EventPtr laste = &miEventQueue.events[(oldtail - 1) %
- QUEUE_SIZE];
- deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *)
- &laste->event[0];
+ int evlen;
+#ifdef XQUARTZ
+ wait_for_server_init();
+ pthread_mutex_lock(&miEventQueueMutex);
+#endif
+
+ /* avoid merging events from different devices */
if (e->u.u.type == MotionNotify)
- isMotion = inputInfo.pointer->id;
- else if (e->u.u.type == DeviceMotionNotify)
isMotion = pDev->id;
+ else if (e->u.u.type == DeviceMotionNotify)
+ isMotion = pDev->id | (1 << 8); /* flag to indicate DeviceMotion */
/* We silently steal valuator events: just tack them on to the last
* motion event they need to be attached to. Sigh. */
if (e->u.u.type == DeviceValuator) {
+ deviceValuator *v = (deviceValuator *) e;
+ EventPtr laste;
+ deviceKeyButtonPointer *lastkbp;
+
+ laste = &miEventQueue.events[(oldtail - 1) % QUEUE_SIZE];
+ lastkbp = (deviceKeyButtonPointer *) laste->events->event;
+
if (laste->nevents > 6) {
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+
ErrorF("[mi] mieqEnqueue: more than six valuator events; dropping.\n");
return;
}
@@ -133,10 +195,17 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
lastkbp->type == ProximityOut) ||
((lastkbp->deviceid & DEVICE_BITS) !=
(v->deviceid & DEVICE_BITS))) {
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
ErrorF("[mi] mieqEnequeue: out-of-order valuator event; dropping.\n");
return;
}
- memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent));
+
+ memcpy((laste->events[laste->nevents++].event), e, sizeof(xEvent));
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
return;
}
@@ -146,68 +215,216 @@ mieqEnqueue(DeviceIntPtr pDev, xEvent *e)
}
else {
static int stuck = 0;
- newtail = (oldtail + 1) % QUEUE_SIZE;
/* Toss events which come in late. Usually this means your server's
* stuck in an infinite loop somewhere, but SIGIO is still getting
* handled. */
- if (newtail == miEventQueue.head) {
+ if (((oldtail + 1) % QUEUE_SIZE) == miEventQueue.head) {
ErrorF("[mi] EQ overflowing. The server is probably stuck "
"in an infinite loop.\n");
if (!stuck) {
xorg_backtrace();
stuck = 1;
}
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
return;
}
stuck = 0;
- miEventQueue.tail = newtail;
}
- memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent));
+ evlen = sizeof(xEvent);
+ if (e->u.u.type == GenericEvent)
+ evlen += ((xGenericEvent*)e)->length * 4;
+
+ evt = miEventQueue.events[oldtail].events;
+ if (evt->evlen < evlen)
+ {
+ evt->evlen = evlen;
+ evt->event = xrealloc(evt->event, evt->evlen);
+ if (!evt->event)
+ {
+ ErrorF("[mi] Running out of memory. Tossing event.\n");
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+ return;
+ }
+ }
+
+ memcpy(evt->event, e, evlen);
miEventQueue.events[oldtail].nevents = 1;
/* Make sure that event times don't go backwards - this
* is "unnecessary", but very useful. */
- if (e->u.keyButtonPointer.time < miEventQueue.lastEventTime &&
- miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
- miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time =
- miEventQueue.lastEventTime;
-
- miEventQueue.lastEventTime =
- miEventQueue.events[oldtail].event[0].u.keyButtonPointer.time;
- miEventQueue.events[oldtail].pScreen = miEventQueue.pEnqueueScreen;
+ if (e->u.u.type != GenericEvent &&
+ e->u.keyButtonPointer.time < miEventQueue.lastEventTime &&
+ miEventQueue.lastEventTime - e->u.keyButtonPointer.time < 10000)
+ evt->event->u.keyButtonPointer.time = miEventQueue.lastEventTime;
+
+ miEventQueue.lastEventTime = evt->event->u.keyButtonPointer.time;
+ miEventQueue.events[oldtail].pScreen = EnqueueScreen(pDev);
miEventQueue.events[oldtail].pDev = pDev;
miEventQueue.lastMotion = isMotion;
+ miEventQueue.tail = (oldtail + 1) % QUEUE_SIZE;
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
}
void
-mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX)
+mieqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, Bool fromDIX)
{
- miEventQueue.pEnqueueScreen = pScreen;
+#ifdef XQUARTZ
+ pthread_mutex_lock(&miEventQueueMutex);
+#endif
+ EnqueueScreen(pDev) = pScreen;
if (fromDIX)
- miEventQueue.pDequeueScreen = pScreen;
+ DequeueScreen(pDev) = pScreen;
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
}
void
mieqSetHandler(int event, mieqHandler handler)
{
+#ifdef XQUARTZ
+ pthread_mutex_lock(&miEventQueueMutex);
+#endif
if (handler && miEventQueue.handlers[event])
- ErrorF("mieq: warning: overriding existing handler %p with %p for "
+ ErrorF("[mi] mieq: warning: overriding existing handler %p with %p for "
"event %d\n", miEventQueue.handlers[event], handler, event);
miEventQueue.handlers[event] = handler;
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+}
+
+/**
+ * Change the device id of the given event to the given device's id.
+ */
+static void
+ChangeDeviceID(DeviceIntPtr dev, xEvent* event)
+{
+ int type = event->u.u.type;
+
+ if (type == DeviceKeyPress || type == DeviceKeyRelease ||
+ type == DeviceButtonPress || type == DeviceButtonRelease ||
+ type == DeviceMotionNotify || type == ProximityIn ||
+ type == ProximityOut)
+ ((deviceKeyButtonPointer*)event)->deviceid = dev->id;
+ else if (type == DeviceValuator)
+ ((deviceValuator*)event)->deviceid = dev->id;
+ else if (type == GenericEvent)
+ {
+ DebugF("[mi] Unknown generic event (%d/%d), cannot change id.\n",
+ ((xGenericEvent*)event)->extension,
+ ((xGenericEvent*)event)->evtype);
+ } else
+ DebugF("[mi] Unknown event type (%d), cannot change id.\n", type);
}
+static void
+FixUpEventForMaster(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+ EventListPtr master, int count)
+{
+ /* Ensure chained button mappings, i.e. that the detail field is the
+ * value of the mapped button on the SD, not the physical button */
+ if (original->u.u.type == DeviceButtonPress || original->u.u.type == DeviceButtonRelease)
+ {
+ int btn = original->u.u.detail;
+ if (!sdev->button)
+ return; /* Should never happen */
+
+ master->event->u.u.detail = sdev->button->map[btn];
+ }
+}
+
+/**
+ * Copy the given event into master.
+ * @param mdev The master device
+ * @param sdev The slave device the original event comes from
+ * @param original The event as it came from the EQ
+ * @param master The event after being copied
+ * @param count Number of events in original.
+ */
+void
+CopyGetMasterEvent(DeviceIntPtr mdev, DeviceIntPtr sdev, xEvent* original,
+ EventListPtr master, int count)
+{
+ int len = count * sizeof(xEvent);
+
+ /* Assumption: GenericEvents always have count 1 */
+
+ if (GEV(original)->type == GenericEvent)
+ len += GEV(original)->length * 4;
+
+ if (master->evlen < len)
+ SetMinimumEventSize(master, 1, len);
+
+ memcpy(master->event, original, len);
+ while (count--)
+ {
+ ChangeDeviceID(mdev, &master->event[count]);
+ FixUpEventForMaster(mdev, sdev, original, master, count);
+ }
+}
+extern void
+CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
+
+
+
/* Call this from ProcessInputEvents(). */
void
mieqProcessInputEvents(void)
{
+ mieqHandler handler;
EventRec *e = NULL;
int x = 0, y = 0;
- DeviceIntPtr dev = NULL;
-
+ int type, nevents, evlen, i;
+ ScreenPtr screen;
+ static xEvent *event = NULL;
+ static size_t event_size = 0;
+ DeviceIntPtr dev = NULL,
+ master = NULL;
+
+#ifdef XQUARTZ
+ pthread_mutex_lock(&miEventQueueMutex);
+#endif
+
while (miEventQueue.head != miEventQueue.tail) {
+ e = &miEventQueue.events[miEventQueue.head];
+
+ /* GenericEvents always have nevents == 1 */
+ nevents = e->nevents;
+ evlen = (nevents > 1) ? sizeof(xEvent) : e->events->evlen;
+ if((nevents * evlen) > event_size) {
+ event_size = nevents * evlen;
+ event = (xEvent *)xrealloc(event, event_size);
+ }
+
+ if (!event)
+ FatalError("[mi] No memory left for event processing.\n");
+
+ for (i = 0; i < nevents; i++)
+ memcpy(&event[i], e->events[i].event, evlen);
+
+
+ dev = e->pDev;
+ screen = e->pScreen;
+
+ miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
+
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
+
+ type = event->u.u.type;
+ master = (!dev->isMaster && dev->u.master) ? dev->u.master : NULL;
+
if (screenIsSaved == SCREEN_SAVER_ON)
dixSaveScreens (serverClient, SCREEN_SAVER_OFF, ScreenSaverReset);
#ifdef DPMSExtension
@@ -218,44 +435,60 @@ mieqProcessInputEvents(void)
DPMSSet(serverClient, DPMSModeOn);
#endif
- e = &miEventQueue.events[miEventQueue.head];
- /* Assumption - screen switching can only occur on motion events. */
- miEventQueue.head = (miEventQueue.head + 1) % QUEUE_SIZE;
+ /* Custom event handler */
+ handler = miEventQueue.handlers[type];
- if (e->pScreen != miEventQueue.pDequeueScreen) {
- miEventQueue.pDequeueScreen = e->pScreen;
- x = e->event[0].u.keyButtonPointer.rootX;
- y = e->event[0].u.keyButtonPointer.rootY;
- NewCurrentScreen (miEventQueue.pDequeueScreen, x, y);
+ if (screen != DequeueScreen(dev) && !handler) {
+ /* Assumption - screen switching can only occur on motion events. */
+ DequeueScreen(dev) = screen;
+ x = event->u.keyButtonPointer.rootX;
+ y = event->u.keyButtonPointer.rootY;
+ NewCurrentScreen (dev, DequeueScreen(dev), x, y);
}
else {
+ if (master) {
+ /* Force a copy of the key class into the VCK so that the layout
+ is transferred. */
+ if (event->u.u.type == DeviceKeyPress ||
+ event->u.u.type == DeviceKeyRelease)
+ {
+ if (!master->key)
+ master = GetPairedDevice(master);
+ CopyKeyClass(dev, master);
+ }
+
+ CopyGetMasterEvent(master, dev, event, masterEvents, nevents);
+ }
+
/* If someone's registered a custom event handler, let them
* steal it. */
- if (miEventQueue.handlers[e->event->u.u.type]) {
- miEventQueue.handlers[e->event->u.u.type](miEventQueue.pDequeueScreen->myNum,
- e->event, dev,
- e->nevents);
- return;
+ if (handler)
+ {
+ handler(DequeueScreen(dev)->myNum, event, dev, nevents);
+ if (master)
+ handler(DequeueScreen(master)->myNum,
+ masterEvents->event, master, nevents);
+ } else
+ {
+ /* process slave first, then master */
+ dev->public.processInputProc(event, dev, nevents);
+
+ if (master)
+ master->public.processInputProc(masterEvents->event, master,
+ nevents);
}
+ }
- /* If this is a core event, make sure our keymap, et al, is
- * changed to suit. */
- if (e->event[0].u.u.type == KeyPress ||
- e->event[0].u.u.type == KeyRelease) {
- SwitchCoreKeyboard(e->pDev);
- dev = inputInfo.keyboard;
- }
- else if (e->event[0].u.u.type == MotionNotify ||
- e->event[0].u.u.type == ButtonPress ||
- e->event[0].u.u.type == ButtonRelease) {
- SwitchCorePointer(e->pDev);
- dev = inputInfo.pointer;
- }
- else {
- dev = e->pDev;
- }
+ /* Update the sprite now. Next event may be from different device. */
+ if (type == DeviceMotionNotify && dev->coreEvents)
+ miPointerUpdateSprite(dev);
- dev->public.processInputProc(e->event, dev, e->nevents);
- }
+#ifdef XQUARTZ
+ pthread_mutex_lock(&miEventQueueMutex);
+#endif
}
+#ifdef XQUARTZ
+ pthread_mutex_unlock(&miEventQueueMutex);
+#endif
}
+
diff --git a/xorg-server/mi/miexpose.c b/xorg-server/mi/miexpose.c
index 2fba6a28c..f8a9e2fe4 100644
--- a/xorg-server/mi/miexpose.c
+++ b/xorg-server/mi/miexpose.c
@@ -128,15 +128,9 @@ exposing is done by the backing store's GraphicsExpose function, of course.
*/
_X_EXPORT RegionPtr
-miHandleExposures(pSrcDrawable, pDstDrawable,
- pGC, srcx, srcy, width, height, dstx, dsty, plane)
- DrawablePtr pSrcDrawable;
- DrawablePtr pDstDrawable;
- GCPtr pGC;
- int srcx, srcy;
- int width, height;
- int dstx, dsty;
- unsigned long plane;
+miHandleExposures(DrawablePtr pSrcDrawable, DrawablePtr pDstDrawable,
+ GCPtr pGC, int srcx, int srcy, int width, int height,
+ int dstx, int dsty, unsigned long plane)
{
ScreenPtr pscr;
RegionPtr prgnSrcClip; /* drawable-relative source clip */
@@ -271,7 +265,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
extents = pGC->graphicsExposures &&
(REGION_NUM_RECTS(&rgnExposed) > RECTLIMIT) &&
(pDstDrawable->type != DRAWABLE_PIXMAP);
-#ifdef SHAPE
if (pSrcWin)
{
RegionPtr region;
@@ -285,7 +278,6 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
(RECT_IN_REGION(pscr, region, &srcBox) != rgnIN))
extents = FALSE;
}
-#endif
if (extents)
{
expBox = *REGION_EXTENTS(pscr, &rgnExposed);
@@ -349,13 +341,9 @@ miHandleExposures(pSrcDrawable, pDstDrawable,
/* send GraphicsExpose events, or a NoExpose event, based on the region */
-_X_EXPORT void
-miSendGraphicsExpose (client, pRgn, drawable, major, minor)
- ClientPtr client;
- RegionPtr pRgn;
- XID drawable;
- int major;
- int minor;
+void
+miSendGraphicsExpose (ClientPtr client, RegionPtr pRgn, XID drawable,
+ int major, int minor)
{
if (pRgn && !REGION_NIL(pRgn))
{
@@ -383,7 +371,7 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
pe->u.graphicsExposure.majorEvent = major;
pe->u.graphicsExposure.minorEvent = minor;
}
- TryClientEvents(client, pEvent, numRects,
+ TryClientEvents(client, NULL, pEvent, numRects,
(Mask)0, NoEventMask, NullGrab);
xfree(pEvent);
}
@@ -394,17 +382,14 @@ miSendGraphicsExpose (client, pRgn, drawable, major, minor)
event.u.noExposure.drawable = drawable;
event.u.noExposure.majorEvent = major;
event.u.noExposure.minorEvent = minor;
- TryClientEvents(client, &event, 1,
+ TryClientEvents(client, NULL, &event, 1,
(Mask)0, NoEventMask, NullGrab);
}
}
void
-miSendExposures(pWin, pRgn, dx, dy)
- WindowPtr pWin;
- RegionPtr pRgn;
- int dx, dy;
+miSendExposures( WindowPtr pWin, RegionPtr pRgn, int dx, int dy)
{
BoxPtr pBox;
int numRects;
@@ -464,9 +449,7 @@ miSendExposures(pWin, pRgn, dx, dy)
}
_X_EXPORT void
-miWindowExposures(pWin, prgn, other_exposed)
- WindowPtr pWin;
- RegionPtr prgn, other_exposed;
+miWindowExposures( WindowPtr pWin, RegionPtr prgn, RegionPtr other_exposed)
{
RegionPtr exposures = prgn;
if ((prgn && !REGION_NIL(prgn)) ||
@@ -531,7 +514,7 @@ miWindowExposures(pWin, prgn, other_exposed)
REGION_DESTROY( pWin->drawable.pScreen, exposures);
}
-_X_EXPORT void
+void
miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
{
ScreenPtr pScreen = pWin->drawable.pScreen;
@@ -654,9 +637,7 @@ miPaintWindow(WindowPtr pWin, RegionPtr prgn, int what)
* the GC. Useful when we have a scratch drawable and need to initialize
* it. */
_X_EXPORT void
-miClearDrawable(pDraw, pGC)
- DrawablePtr pDraw;
- GCPtr pGC;
+miClearDrawable(DrawablePtr pDraw, GCPtr pGC)
{
XID fg = pGC->fgPixel;
XID bg = pGC->bgPixel;
diff --git a/xorg-server/mi/mifillarc.c b/xorg-server/mi/mifillarc.c
index f68ddf468..f2ab5ceb1 100644
--- a/xorg-server/mi/mifillarc.c
+++ b/xorg-server/mi/mifillarc.c
@@ -53,9 +53,7 @@ Author: Bob Scheifler, MIT X Consortium
#define Dcos(d) cos((double)d*(M_PI/11520.0))
_X_EXPORT void
-miFillArcSetup(arc, info)
- xArc *arc;
- miFillArcRec *info;
+miFillArcSetup(xArc *arc, miFillArcRec *info)
{
info->y = arc->height >> 1;
info->dy = arc->height & 1;
@@ -307,10 +305,7 @@ miGetPieEdge(
}
_X_EXPORT void
-miFillArcSliceSetup(arc, slice, pGC)
- xArc *arc;
- miArcSliceRec *slice;
- GCPtr pGC;
+miFillArcSliceSetup(xArc *arc, miArcSliceRec *slice, GCPtr pGC)
{
int angle1, angle2;
@@ -776,11 +771,7 @@ miFillArcSliceD(
* fill each arc as it comes.
*/
_X_EXPORT void
-miPolyFillArc(pDraw, pGC, narcs, parcs)
- DrawablePtr pDraw;
- GCPtr pGC;
- int narcs;
- xArc *parcs;
+miPolyFillArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
{
int i;
xArc *arc;
@@ -788,7 +779,7 @@ miPolyFillArc(pDraw, pGC, narcs, parcs)
for(i = narcs, arc = parcs; --i >= 0; arc++)
{
if (miFillArcEmpty(arc))
- continue;;
+ continue;
if ((arc->angle2 >= FULLCIRCLE) || (arc->angle2 <= -FULLCIRCLE))
{
if (miCanFillArc(arc))
diff --git a/xorg-server/mi/mifillrct.c b/xorg-server/mi/mifillrct.c
index e7646cf38..06f018e27 100644
--- a/xorg-server/mi/mifillrct.c
+++ b/xorg-server/mi/mifillrct.c
@@ -67,11 +67,12 @@ SOFTWARE.
* clipping to the destination
*/
_X_EXPORT void
-miPolyFillRect(pDrawable, pGC, nrectFill, prectInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int nrectFill; /* number of rectangles to fill */
- xRectangle *prectInit; /* Pointer to first rectangle to fill */
+miPolyFillRect(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int nrectFill, /* number of rectangles to fill */
+ xRectangle *prectInit /* Pointer to first rectangle to fill */
+ )
{
int i;
int height;
diff --git a/xorg-server/mi/mifpolycon.c b/xorg-server/mi/mifpolycon.c
index d19f031d7..4a3acfd2b 100644
--- a/xorg-server/mi/mifpolycon.c
+++ b/xorg-server/mi/mifpolycon.c
@@ -71,18 +71,20 @@ static int GetFPolyYBounds(SppPointPtr pts, int n, double yFtrans,
* interpolation involved because of the subpixel postioning.
*/
void
-miFillSppPoly(dst, pgc, count, ptsIn, xTrans, yTrans, xFtrans, yFtrans)
- DrawablePtr dst;
- GCPtr pgc;
- int count; /* number of points */
- SppPointPtr ptsIn; /* the points */
- int xTrans, yTrans; /* Translate each point by this */
- double xFtrans, yFtrans; /* translate before conversion
- by this amount. This provides
+miFillSppPoly(
+ DrawablePtr dst,
+ GCPtr pgc,
+ int count, /* number of points */
+ SppPointPtr ptsIn, /* the points */
+ int xTrans, int yTrans, /* Translate each point by this */
+ double xFtrans,
+ double yFtrans /* translate before conversion
+ by this amount. This provides
a mechanism to match rounding
errors with any shape that must
meet the polygon exactly.
*/
+ )
{
double xl = 0.0, xr = 0.0, /* x vals of left and right edges */
ml = 0.0, /* left edge slope */
diff --git a/xorg-server/mi/migc.c b/xorg-server/mi/migc.c
index 46643ab26..e6bec31c4 100644
--- a/xorg-server/mi/migc.c
+++ b/xorg-server/mi/migc.c
@@ -39,56 +39,22 @@ from The Open Group.
/* ARGSUSED */
_X_EXPORT void
-miChangeGC(pGC, mask)
- GCPtr pGC;
- unsigned long mask;
+miChangeGC(GCPtr pGC, unsigned long mask)
{
return;
}
_X_EXPORT void
-miDestroyGC(pGC)
- GCPtr pGC;
+miDestroyGC(GCPtr pGC)
{
if (pGC->pRotatedPixmap)
(*pGC->pScreen->DestroyPixmap) (pGC->pRotatedPixmap);
if (pGC->freeCompClip)
REGION_DESTROY(pGC->pScreen, pGC->pCompositeClip);
- miDestroyGCOps(pGC->ops);
}
-/*
- * create a private op array for a gc
- */
-
-_X_EXPORT GCOpsPtr
-miCreateGCOps(prototype)
- GCOpsPtr prototype;
-{
- GCOpsPtr ret;
-
- /* XXX */ Must_have_memory = TRUE;
- ret = (GCOpsPtr) xalloc(sizeof(GCOps));
- /* XXX */ Must_have_memory = FALSE;
- if (!ret)
- return 0;
- *ret = *prototype;
- ret->devPrivate.val = 1;
- return ret;
-}
-
-_X_EXPORT void
-miDestroyGCOps(ops)
- GCOpsPtr ops;
-{
- if (ops->devPrivate.val)
- xfree(ops);
-}
-
-
_X_EXPORT void
-miDestroyClip(pGC)
- GCPtr pGC;
+miDestroyClip(GCPtr pGC)
{
if (pGC->clientClipType == CT_NONE)
return;
@@ -109,11 +75,7 @@ miDestroyClip(pGC)
}
_X_EXPORT void
-miChangeClip(pGC, type, pvalue, nrects)
- GCPtr pGC;
- int type;
- pointer pvalue;
- int nrects;
+miChangeClip( GCPtr pGC, int type, pointer pvalue, int nrects)
{
(*pGC->funcs->DestroyClip) (pGC);
if (type == CT_PIXMAP)
@@ -140,8 +102,7 @@ miChangeClip(pGC, type, pvalue, nrects)
}
_X_EXPORT void
-miCopyClip(pgcDst, pgcSrc)
- GCPtr pgcDst, pgcSrc;
+miCopyClip(GCPtr pgcDst, GCPtr pgcSrc)
{
RegionPtr prgnNew;
@@ -165,18 +126,13 @@ miCopyClip(pgcDst, pgcSrc)
/* ARGSUSED */
_X_EXPORT void
-miCopyGC(pGCSrc, changes, pGCDst)
- GCPtr pGCSrc;
- unsigned long changes;
- GCPtr pGCDst;
+miCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst)
{
return;
}
_X_EXPORT void
-miComputeCompositeClip(pGC, pDrawable)
- GCPtr pGC;
- DrawablePtr pDrawable;
+miComputeCompositeClip( GCPtr pGC, DrawablePtr pDrawable)
{
ScreenPtr pScreen;
diff --git a/xorg-server/mi/migc.h b/xorg-server/mi/migc.h
index 84dc75c6c..51ed7b671 100644
--- a/xorg-server/mi/migc.h
+++ b/xorg-server/mi/migc.h
@@ -36,14 +36,6 @@ extern void miDestroyGC(
GCPtr /*pGC*/
);
-extern GCOpsPtr miCreateGCOps(
- GCOpsPtr /*prototype*/
-);
-
-extern void miDestroyGCOps(
- GCOpsPtr /*ops*/
-);
-
extern void miDestroyClip(
GCPtr /*pGC*/
);
diff --git a/xorg-server/mi/miglblt.c b/xorg-server/mi/miglblt.c
index 0155b5618..414773608 100644
--- a/xorg-server/mi/miglblt.c
+++ b/xorg-server/mi/miglblt.c
@@ -82,13 +82,15 @@ with the sample server.
*/
_X_EXPORT void
-miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GC *pGC;
- int x, y;
- unsigned int nglyph;
- CharInfoPtr *ppci; /* array of character info */
- pointer pglyphBase; /* start of array of glyphs */
+miPolyGlyphBlt(
+ DrawablePtr pDrawable,
+ GC *pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+ )
{
int width, height;
PixmapPtr pPixmap;
@@ -196,13 +198,15 @@ miPolyGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
_X_EXPORT void
-miImageGlyphBlt(pDrawable, pGC, x, y, nglyph, ppci, pglyphBase)
- DrawablePtr pDrawable;
- GC *pGC;
- int x, y;
- unsigned int nglyph;
- CharInfoPtr *ppci; /* array of character info */
- pointer pglyphBase; /* start of array of glyphs */
+miImageGlyphBlt(
+ DrawablePtr pDrawable,
+ GC *pGC,
+ int x,
+ int y,
+ unsigned int nglyph,
+ CharInfoPtr *ppci, /* array of character info */
+ pointer pglyphBase /* start of array of glyphs */
+ )
{
ExtentInfoRec info; /* used by QueryGlyphExtents() */
XID gcvals[3];
diff --git a/xorg-server/mi/miinitext.c b/xorg-server/mi/miinitext.c
index 55faec333..92d6cd2f0 100644
--- a/xorg-server/mi/miinitext.c
+++ b/xorg-server/mi/miinitext.c
@@ -59,13 +59,13 @@ SOFTWARE.
#ifdef HAVE_XNEST_CONFIG_H
#include <xnest-config.h>
+#undef COMPOSITE
#undef DPMSExtension
#endif
#ifdef HAVE_KDRIVE_CONFIG_H
#include <kdrive-config.h>
/* there must be a better way... */
-#undef XF86MISC
#undef XFreeXDGA
#undef XF86DRI
#undef XF86VIDMODE
@@ -73,7 +73,6 @@ SOFTWARE.
#ifdef HAVE_XGL_CONFIG_H
#include <xgl-config.h>
-#undef XF86MISC
#undef XFreeXDGA
#undef XF86DRI
#undef XF86VIDMODE
@@ -84,43 +83,9 @@ SOFTWARE.
#include "micmap.h"
#include "globals.h"
-#if defined(QNX4) /* sleaze for Watcom on QNX4 ... */
-#undef GLXEXT
-#endif
-
-/* Make sure Xprt only announces extensions it supports */
-#ifdef PRINT_ONLY_SERVER
-#undef MITSHM /* this is incompatible to the vector-based Xprint DDX */
-#undef XKB
-#undef PANORAMIX
-#undef RES
-#undef XINPUT
-#undef XV
-#undef SCREENSAVER
-#undef XIDLE
-#undef XRECORD
-#undef XF86VIDMODE
-#undef XF86MISC
-#undef XFreeXDGA
-#undef XF86DRI
-#undef DPMSExtension
-#undef FONTCACHE
-#undef COMPOSITE
-#undef DAMAGE
-#undef XFIXES
-#undef XEVIE
-#else
-#ifndef LOADABLEPRINTDDX
-#undef XPRINT
-#endif /* LOADABLEPRINTDDX */
-#endif /* PRINT_ONLY_SERVER */
-
extern Bool noTestExtensions;
-#ifdef BIGREQS
-extern Bool noBigReqExtension;
-#endif
#ifdef COMPOSITE
extern Bool noCompositeExtension;
#endif
@@ -130,12 +95,6 @@ extern Bool noDbeExtension;
#ifdef DPMSExtension
extern Bool noDPMSExtension;
#endif
-#ifdef EVI
-extern Bool noEVIExtension;
-#endif
-#ifdef FONTCACHE
-extern Bool noFontCacheExtension;
-#endif
#ifdef GLXEXT
extern Bool noGlxExtension;
#endif
@@ -145,9 +104,6 @@ extern Bool noScreenSaverExtension;
#ifdef MITSHM
extern Bool noMITShmExtension;
#endif
-#ifdef MITMISC
-extern Bool noMITMiscExtension;
-#endif
#ifdef MULTIBUFFER
extern Bool noMultibufferExtension;
#endif
@@ -157,30 +113,12 @@ extern Bool noRRExtension;
#ifdef RENDER
extern Bool noRenderExtension;
#endif
-#ifdef SHAPE
-extern Bool noShapeExtension;
-#endif
#ifdef XCSECURITY
extern Bool noSecurityExtension;
#endif
-#ifdef XSYNC
-extern Bool noSyncExtension;
-#endif
-#ifdef TOGCUP
-extern Bool noXcupExtension;
-#endif
#ifdef RES
extern Bool noResExtension;
#endif
-#ifdef XAPPGROUP
-extern Bool noXagExtension;
-#endif
-#ifdef XCMISC
-extern Bool noXCMiscExtension;
-#endif
-#ifdef XEVIE
-extern Bool noXevieExtension;
-#endif
#ifdef XF86BIGFONT
extern Bool noXFree86BigfontExtension;
#endif
@@ -190,9 +128,6 @@ extern Bool noXFree86DGAExtension;
#ifdef XF86DRI
extern Bool noXFree86DRIExtension;
#endif
-#ifdef XF86MISC
-extern Bool noXFree86MiscExtension;
-#endif
#ifdef XF86VIDMODE
extern Bool noXFree86VidModeExtension;
#endif
@@ -209,18 +144,13 @@ extern Bool noPanoramiXExtension;
#ifdef INXQUARTZ
extern Bool noPseudoramiXExtension;
#endif
-#ifdef XINPUT
-extern Bool noXInputExtension;
-#endif
-#ifdef XIDLE
-extern Bool noXIdleExtension;
-#endif
#ifdef XSELINUX
extern Bool noSELinuxExtension;
#endif
#ifdef XV
extern Bool noXvExtension;
#endif
+extern Bool noGEExtension;
#ifndef XFree86LOADER
#define INITARGS void
@@ -240,13 +170,6 @@ typedef void (*InitExtension)(INITARGS);
#ifdef XKB
#include <X11/extensions/XKB.h>
#endif
-#ifdef XPRINT
-#include <X11/extensions/Print.h>
-#endif
-#ifdef XAPPGROUP
-#define _XAG_SERVER_
-#include <X11/extensions/Xagstr.h>
-#endif
#ifdef XCSECURITY
#include "securitysrv.h"
#include <X11/extensions/securstr.h>
@@ -265,9 +188,6 @@ typedef void (*InitExtension)(INITARGS);
#endif
/* FIXME: this whole block of externs should be from the appropriate headers */
-#ifdef EVI
-extern void EVIExtensionInit(INITARGS);
-#endif
#ifdef MITSHM
extern void ShmExtensionInit(INITARGS);
#endif
@@ -280,24 +200,11 @@ extern void PanoramiXExtensionInit(INITARGS);
#ifdef INXQUARTZ
extern void PseudoramiXExtensionInit(INITARGS);
#endif
-#ifdef XINPUT
extern void XInputExtensionInit(INITARGS);
-#endif
#ifdef XTEST
extern void XTestExtensionInit(INITARGS);
#endif
-#ifdef BIGREQS
extern void BigReqExtensionInit(INITARGS);
-#endif
-#ifdef MITMISC
-extern void MITMiscExtensionInit(INITARGS);
-#endif
-#ifdef XIDLE
-extern void XIdleExtensionInit(INITARGS);
-#endif
-#ifdef XTRAP
-extern void DEC_XTRAPInit(INITARGS);
-#endif
#ifdef SCREENSAVER
extern void ScreenSaverExtensionInit (INITARGS);
#endif
@@ -305,42 +212,29 @@ extern void ScreenSaverExtensionInit (INITARGS);
extern void XvExtensionInit(INITARGS);
extern void XvMCExtensionInit(INITARGS);
#endif
-#ifdef XSYNC
extern void SyncExtensionInit(INITARGS);
-#endif
#ifdef XKB
extern void XkbExtensionInit(INITARGS);
#endif
-#ifdef XCMISC
extern void XCMiscExtensionInit(INITARGS);
-#endif
#ifdef XRECORD
extern void RecordExtensionInit(INITARGS);
#endif
#ifdef DBE
extern void DbeExtensionInit(INITARGS);
#endif
-#ifdef XAPPGROUP
-extern void XagExtensionInit(INITARGS);
-#endif
#ifdef XCSECURITY
extern void SecurityExtensionInit(INITARGS);
#endif
#ifdef XSELINUX
extern void SELinuxExtensionInit(INITARGS);
#endif
-#ifdef XPRINT
-extern void XpExtensionInit(INITARGS);
-#endif
#ifdef XF86BIGFONT
extern void XFree86BigfontExtensionInit(INITARGS);
#endif
#ifdef XF86VIDMODE
extern void XFree86VidModeExtensionInit(INITARGS);
#endif
-#ifdef XF86MISC
-extern void XFree86MiscExtensionInit(INITARGS);
-#endif
#ifdef XFreeXDGA
extern void XFree86DGAExtensionInit(INITARGS);
#endif
@@ -353,15 +247,9 @@ extern void GlxExtensionInit(INITARGS);
#ifdef XF86DRI
extern void XFree86DRIExtensionInit(INITARGS);
#endif
-#ifdef TOGCUP
-extern void XcupExtensionInit(INITARGS);
-#endif
#ifdef DPMSExtension
extern void DPMSExtensionInit(INITARGS);
#endif
-#ifdef FONTCACHE
-extern void FontCacheExtensionInit(INITARGS);
-#endif
#ifdef RENDER
extern void RenderExtensionInit(INITARGS);
#endif
@@ -374,9 +262,6 @@ extern void ResExtensionInit(INITARGS);
#ifdef DMXEXT
extern void DMXExtensionInit(INITARGS);
#endif
-#ifdef XEVIE
-extern void XevieExtensionInit(INITARGS);
-#endif
#ifdef XFIXES
extern void XFixesExtensionInit(INITARGS);
#endif
@@ -386,6 +271,7 @@ extern void DamageExtensionInit(INITARGS);
#ifdef COMPOSITE
extern void CompositeExtensionInit(INITARGS);
#endif
+extern void GEExtensionInit(INITARGS);
/* The following is only a small first step towards run-time
* configurable extensions.
@@ -398,9 +284,7 @@ typedef struct {
static ExtensionToggle ExtensionToggleList[] =
{
/* sort order is extension name string as shown in xdpyinfo */
-#ifdef BIGREQS
- { "BIG-REQUESTS", &noBigReqExtension },
-#endif
+ { "Generic Events", &noGEExtension },
#ifdef COMPOSITE
{ "Composite", &noCompositeExtension },
#endif
@@ -413,12 +297,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef DPMSExtension
{ "DPMS", &noDPMSExtension },
#endif
-#ifdef EVI
- { "Extended-Visual-Information", &noEVIExtension },
-#endif
-#ifdef FONTCACHE
- { "FontCache", &noFontCacheExtension },
-#endif
#ifdef GLXEXT
{ "GLX", &noGlxExtension },
#endif
@@ -428,9 +306,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef MITSHM
{ SHMNAME, &noMITShmExtension },
#endif
-#ifdef MITMISC
- { "MIT-SUNDRY-NONSTANDARD", &noMITMiscExtension },
-#endif
#ifdef MULTIBUFFER
{ "Multi-Buffering", &noMultibufferExtension },
#endif
@@ -440,30 +315,12 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef RENDER
{ "RENDER", &noRenderExtension },
#endif
-#ifdef SHAPE
- { "SHAPE", &noShapeExtension },
-#endif
#ifdef XCSECURITY
{ "SECURITY", &noSecurityExtension },
#endif
-#ifdef XSYNC
- { "SYNC", &noSyncExtension },
-#endif
-#ifdef TOGCUP
- { "TOG-CUP", &noXcupExtension },
-#endif
#ifdef RES
{ "X-Resource", &noResExtension },
#endif
-#ifdef XAPPGROUP
- { "XC-APPGROUP", &noXagExtension },
-#endif
-#ifdef XCMISC
- { "XC-MISC", &noXCMiscExtension },
-#endif
-#ifdef XEVIE
- { "XEVIE", &noXevieExtension },
-#endif
#ifdef XF86BIGFONT
{ "XFree86-Bigfont", &noXFree86BigfontExtension },
#endif
@@ -473,9 +330,6 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef XF86DRI
{ "XFree86-DRI", &noXFree86DRIExtension },
#endif
-#ifdef XF86MISC
- { "XFree86-Misc", &noXFree86MiscExtension },
-#endif
#ifdef XF86VIDMODE
{ "XFree86-VidModeExtension", &noXFree86VidModeExtension },
#endif
@@ -485,9 +339,7 @@ static ExtensionToggle ExtensionToggleList[] =
#ifdef PANORAMIX
{ "XINERAMA", &noPanoramiXExtension },
#endif
-#ifdef XINPUT
- { "XInputExtension", &noXInputExtension },
-#endif
+ { "XInputExtension", NULL },
#ifdef XKB
{ "XKEYBOARD", &noXkbExtension },
#endif
@@ -519,60 +371,42 @@ void EnableDisableExtensionError(char *name, Bool enable)
{
ExtensionToggle *ext = &ExtensionToggleList[0];
- ErrorF("Extension \"%s\" is not recognized\n", name);
- ErrorF("Only the following extensions can be run-time %s:\n",
+ 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++)
- ErrorF(" %s\n", ext->name);
+ ErrorF("[mi] %s\n", ext->name);
}
#ifndef XFree86LOADER
/*ARGSUSED*/
void
-InitExtensions(argc, argv)
- int argc;
- char *argv[];
+InitExtensions(int argc, char *argv[])
{
+ if (!noGEExtension) GEExtensionInit();
+
#ifdef PANORAMIX
-# if !defined(PRINT_ONLY_SERVER) && !defined(NO_PANORAMIX)
+# if !defined(NO_PANORAMIX)
if (!noPanoramiXExtension) PanoramiXExtensionInit();
# endif
#endif
#ifdef INXQUARTZ
if(!noPseudoramiXExtension) PseudoramiXExtensionInit();
#endif
-#ifdef SHAPE
- if (!noShapeExtension) ShapeExtensionInit();
-#endif
+ ShapeExtensionInit();
#ifdef MITSHM
if (!noMITShmExtension) ShmExtensionInit();
#endif
-#ifdef EVI
- if (!noEVIExtension) EVIExtensionInit();
-#endif
#ifdef MULTIBUFFER
if (!noMultibufferExtension) MultibufferExtensionInit();
#endif
-#if defined(XINPUT)
- if (!noXInputExtension) XInputExtensionInit();
-#endif
+ XInputExtensionInit();
#ifdef XTEST
if (!noTestExtensions) XTestExtensionInit();
#endif
-#ifdef BIGREQS
- if (!noBigReqExtension) BigReqExtensionInit();
-#endif
-#ifdef MITMISC
- if (!noMITMiscExtension) MITMiscExtensionInit();
-#endif
-#ifdef XIDLE
- if (!noXIdleExtension) XIdleExtensionInit();
-#endif
-#ifdef XTRAP
- if (!noTestExtensions) DEC_XTRAPInit();
-#endif
-#if defined(SCREENSAVER) && !defined(PRINT_ONLY_SERVER)
+ BigReqExtensionInit();
+#if defined(SCREENSAVER)
if (!noScreenSaverExtension) ScreenSaverExtensionInit ();
#endif
#ifdef XV
@@ -581,52 +415,33 @@ InitExtensions(argc, argv)
XvMCExtensionInit();
}
#endif
-#ifdef XSYNC
- if (!noSyncExtension) SyncExtensionInit();
-#endif
-#if defined(XKB) && !defined(PRINT_ONLY_SERVER)
+ SyncExtensionInit();
+#if defined(XKB)
if (!noXkbExtension) XkbExtensionInit();
#endif
-#ifdef XCMISC
- if (!noXCMiscExtension) XCMiscExtensionInit();
-#endif
+ XCMiscExtensionInit();
#ifdef XRECORD
if (!noTestExtensions) RecordExtensionInit();
#endif
#ifdef DBE
if (!noDbeExtension) DbeExtensionInit();
#endif
-#ifdef XAPPGROUP
- if (!noXagExtension) XagExtensionInit();
-#endif
#ifdef XCSECURITY
if (!noSecurityExtension) SecurityExtensionInit();
#endif
#ifdef XSELINUX
if (!noSELinuxExtension) SELinuxExtensionInit();
#endif
-#ifdef XPRINT
- XpExtensionInit(); /* server-specific extension, cannot be disabled */
-#endif
-#ifdef TOGCUP
- if (!noXcupExtension) XcupExtensionInit();
-#endif
#if defined(DPMSExtension) && !defined(NO_HW_ONLY_EXTS)
if (!noDPMSExtension) DPMSExtensionInit();
#endif
-#ifdef FONTCACHE
- if (!noFontCacheExtension) FontCacheExtensionInit();
-#endif
#ifdef XF86BIGFONT
if (!noXFree86BigfontExtension) XFree86BigfontExtensionInit();
#endif
-#if !defined(PRINT_ONLY_SERVER) && !defined(NO_HW_ONLY_EXTS)
+#if !defined(NO_HW_ONLY_EXTS)
#if defined(XF86VIDMODE)
if (!noXFree86VidModeExtension) XFree86VidModeExtensionInit();
#endif
-#if defined(XF86MISC)
- if (!noXFree86MiscExtension) XFree86MiscExtensionInit();
-#endif
#if defined(XFreeXDGA)
if (!noXFree86DGAExtension) XFree86DGAExtensionInit();
#endif
@@ -650,9 +465,6 @@ InitExtensions(argc, argv)
#ifdef DMXEXT
DMXExtensionInit(); /* server-specific extension, cannot be disabled */
#endif
-#ifdef XEVIE
- if (!noXevieExtension) XevieExtensionInit();
-#endif
#ifdef COMPOSITE
if (!noCompositeExtension) CompositeExtensionInit();
#endif
@@ -661,44 +473,33 @@ InitExtensions(argc, argv)
#endif
#ifdef GLXEXT
- GlxPushProvider(&__glXDRISWRastProvider);
+ if (serverGeneration == 1)
+ GlxPushProvider(&__glXDRISWRastProvider);
if (!noGlxExtension) GlxExtensionInit();
#endif
}
-void
-InitVisualWrap()
-{
- miResetInitVisuals();
-}
-
#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
-#ifdef XINPUT
- { XInputExtensionInit, "XInputExtension", &noXInputExtension, NULL, NULL },
-#endif
+ { XInputExtensionInit, "XInputExtension", NULL, NULL, NULL },
#ifdef XTEST
{ XTestExtensionInit, XTestExtensionName, &noTestExtensions, NULL, NULL },
#endif
-#ifdef XIDLE
- { XIdleExtensionInit, "XIDLE", &noXIdleExtension, NULL, NULL },
-#endif
+ { BigReqExtensionInit, "BIG-REQUESTS", NULL, NULL, NULL },
+ { SyncExtensionInit, "SYNC", NULL, NULL, NULL },
#ifdef XKB
{ XkbExtensionInit, XkbName, &noXkbExtension, NULL, NULL },
#endif
-#ifdef XAPPGROUP
- { XagExtensionInit, XAGNAME, &noXagExtension, NULL, NULL },
-#endif
+ { XCMiscExtensionInit, "XC-MISC", NULL, NULL, NULL },
#ifdef XCSECURITY
{ SecurityExtensionInit, SECURITY_EXTENSION_NAME, &noSecurityExtension, NULL, NULL },
#endif
-#ifdef XPRINT
- { XpExtensionInit, XP_PRINTNAME, NULL, NULL, NULL },
-#endif
#ifdef PANORAMIX
{ PanoramiXExtensionInit, PANORAMIX_PROTOCOL_NAME, &noPanoramiXExtension, NULL, NULL },
#endif
@@ -721,17 +522,12 @@ static ExtensionModule staticExtensions[] = {
#ifdef DAMAGE
{ DamageExtensionInit, "DAMAGE", &noDamageExtension, NULL },
#endif
-#ifdef XEVIE
- { XevieExtensionInit, "XEVIE", &noXevieExtension, NULL },
-#endif
{ NULL, NULL, NULL, NULL, NULL }
};
/*ARGSUSED*/
void
-InitExtensions(argc, argv)
- int argc;
- char *argv[];
+InitExtensions(int argc, char *argv[])
{
int i;
ExtensionModule *ext;
@@ -757,23 +553,4 @@ InitExtensions(argc, argv)
}
}
-static void (*__miHookInitVisualsFunction)(miInitVisualsProcPtr *);
-
-void
-InitVisualWrap()
-{
- miResetInitVisuals();
- if (__miHookInitVisualsFunction)
- (*__miHookInitVisualsFunction)(&miInitVisualsProc);
-}
-
-_X_EXPORT void
-miHookInitVisuals(void (**old)(miInitVisualsProcPtr *),
- void (*new)(miInitVisualsProcPtr *))
-{
- if (old)
- *old = __miHookInitVisualsFunction;
- __miHookInitVisualsFunction = new;
-}
-
#endif /* XFree86LOADER */
diff --git a/xorg-server/mi/mioverlay.c b/xorg-server/mi/mioverlay.c
index 6ddcc052d..395b1aab2 100644
--- a/xorg-server/mi/mioverlay.c
+++ b/xorg-server/mi/mioverlay.c
@@ -54,8 +54,10 @@ typedef struct {
Bool copyUnderlay;
} miOverlayScreenRec, *miOverlayScreenPtr;
-static DevPrivateKey miOverlayWindowKey = &miOverlayWindowKey;
-static DevPrivateKey miOverlayScreenKey = &miOverlayScreenKey;
+static int miOverlayWindowKeyKeyIndex;
+static DevPrivateKey miOverlayWindowKey = &miOverlayWindowKeyKeyIndex;
+static int miOverlayScreenKeyIndex;
+static DevPrivateKey miOverlayScreenKey = &miOverlayScreenKeyIndex;
static void RebuildTree(WindowPtr);
static Bool HasUnderlayChildren(WindowPtr);
@@ -80,9 +82,7 @@ static void miOverlayResizeWindow(WindowPtr, int, int, unsigned int,
unsigned int, WindowPtr);
static void miOverlayClearToBackground(WindowPtr, int, int, int, int, Bool);
-#ifdef SHAPE
static void miOverlaySetShape(WindowPtr);
-#endif
static void miOverlayChangeBorderWidth(WindowPtr, unsigned int);
#define MIOVERLAY_GET_SCREEN_PRIVATE(pScreen) ((miOverlayScreenPtr) \
@@ -148,9 +148,7 @@ miInitOverlay(
pScreen->ResizeWindow = miOverlayResizeWindow;
pScreen->MarkWindow = miOverlayMarkWindow;
pScreen->ClearToBackground = miOverlayClearToBackground;
-#ifdef SHAPE
pScreen->SetShape = miOverlaySetShape;
-#endif
pScreen->ChangeBorderWidth = miOverlayChangeBorderWidth;
return TRUE;
@@ -480,7 +478,6 @@ miOverlayComputeClips(
break;
case rgnPART:
newVis = VisibilityPartiallyObscured;
-#ifdef SHAPE
{
RegionPtr pBounding;
@@ -499,7 +496,6 @@ miOverlayComputeClips(
}
}
}
-#endif
break;
default:
newVis = VisibilityFullyObscured;
@@ -935,9 +931,6 @@ miOverlayMoveWindow(
short bw;
RegionRec overReg, underReg;
DDXPointRec oldpt;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
if (!(pParent = pWin->parent))
return ;
@@ -975,10 +968,6 @@ miOverlayMoveWindow(
miOverlayScreenPtr pPriv = MIOVERLAY_GET_SCREEN_PRIVATE(pScreen);
(*pScreen->MarkOverlappedWindows) (pWin, windowToValidate, NULL);
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- dosave = (*pScreen->ChangeSaveUnder)(pWin, windowToValidate);
-#endif /* DO_SAVE_UNDERS */
(*pScreen->ValidateTree)(pWin->parent, NullWindow, kind);
if(REGION_NOTEMPTY(pScreen, &underReg)) {
@@ -993,10 +982,6 @@ miOverlayMoveWindow(
REGION_UNINIT(pScreen, &overReg);
(*pScreen->HandleExposures)(pWin->parent);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pWin, windowToValidate);
-#endif /* DO_SAVE_UNDERS */
if (pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin->parent, NullWindow, kind);
}
@@ -1153,9 +1138,6 @@ miOverlayResizeWindow(
RegionPtr borderVisible2 = NullRegion;
Bool shrunk = FALSE; /* shrunk in an inner dimension */
Bool moved = FALSE; /* window position changed */
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
Bool doUnderlay;
/* if this is a root window, can't be resized */
@@ -1285,10 +1267,6 @@ miOverlayResizeWindow(
if(pTree)
pTree->valdata->borderVisible = borderVisible2;
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- dosave = (*pScreen->ChangeSaveUnder)(pWin, pFirstChange);
-#endif /* DO_SAVE_UNDERS */
(*pScreen->ValidateTree)(pWin->parent, pFirstChange, VTOther);
/*
@@ -1510,10 +1488,6 @@ miOverlayResizeWindow(
if (destClip2)
REGION_DESTROY(pScreen, destClip2);
(*pScreen->HandleExposures)(pWin->parent);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pWin, pFirstChange);
-#endif /* DO_SAVE_UNDERS */
if (pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin->parent, pFirstChange, VTOther);
}
@@ -1522,15 +1496,11 @@ miOverlayResizeWindow(
}
-#ifdef SHAPE
static void
miOverlaySetShape(WindowPtr pWin)
{
Bool WasViewable = (Bool)(pWin->viewable);
ScreenPtr pScreen = pWin->drawable.pScreen;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
if (WasViewable) {
(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
@@ -1563,20 +1533,12 @@ miOverlaySetShape(WindowPtr pWin)
if (WasViewable) {
(*pScreen->MarkOverlappedWindows)(pWin, pWin, NULL);
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- dosave = (*pScreen->ChangeSaveUnder)(pWin, pWin);
-#endif /* DO_SAVE_UNDERS */
(*pScreen->ValidateTree)(pWin->parent, NullWindow, VTOther);
}
if (WasViewable) {
(*pScreen->HandleExposures)(pWin->parent);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pWin, pWin);
-#endif /* DO_SAVE_UNDERS */
if (pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin->parent, NullWindow, VTOther);
}
@@ -1584,7 +1546,6 @@ miOverlaySetShape(WindowPtr pWin)
WindowsRestructured ();
CheckCursorConfinement(pWin);
}
-#endif
@@ -1597,9 +1558,6 @@ miOverlayChangeBorderWidth(
ScreenPtr pScreen;
Bool WasViewable = (Bool)(pWin->viewable);
Bool HadBorder;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
oldwidth = wBorderWidth (pWin);
if (oldwidth == width)
@@ -1633,17 +1591,9 @@ miOverlayChangeBorderWidth(
}
}
}
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- dosave = (*pScreen->ChangeSaveUnder)(pWin, pWin->nextSib);
-#endif /* DO_SAVE_UNDERS */
(*pScreen->ValidateTree)(pWin->parent, pWin, VTOther);
(*pScreen->HandleExposures)(pWin->parent);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pWin, pWin->nextSib);
-#endif /* DO_SAVE_UNDERS */
if (pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pWin->parent, pWin, VTOther);
}
diff --git a/xorg-server/mi/mipointer.c b/xorg-server/mi/mipointer.c
index b55e68bf0..e37316e71 100644
--- a/xorg-server/mi/mipointer.c
+++ b/xorg-server/mi/mipointer.c
@@ -41,38 +41,51 @@ in this Software without prior written authorization from The Open Group.
# include "dixstruct.h"
# include "inputstr.h"
-_X_EXPORT DevPrivateKey miPointerScreenKey = &miPointerScreenKey;
+static int miPointerScreenKeyIndex;
+_X_EXPORT DevPrivateKey miPointerScreenKey = &miPointerScreenKeyIndex;
#define GetScreenPrivate(s) ((miPointerScreenPtr) \
dixLookupPrivate(&(s)->devPrivates, miPointerScreenKey))
#define SetupScreen(s) miPointerScreenPtr pScreenPriv = GetScreenPrivate(s)
-/*
- * until more than one pointer device exists.
- */
-
-static miPointerRec miPointer;
-
-static Bool miPointerRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-static Bool miPointerUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-static Bool miPointerDisplayCursor(ScreenPtr pScreen, CursorPtr pCursor);
-static void miPointerConstrainCursor(ScreenPtr pScreen, BoxPtr pBox);
-static void miPointerPointerNonInterestBox(ScreenPtr pScreen, BoxPtr pBox);
-static void miPointerCursorLimits(ScreenPtr pScreen, CursorPtr pCursor,
- BoxPtr pHotBox, BoxPtr pTopLeftBox);
-static Bool miPointerSetCursorPosition(ScreenPtr pScreen, int x, int y,
+static int miPointerPrivKeyIndex;
+static DevPrivateKey miPointerPrivKey = &miPointerPrivKeyIndex;
+
+#define MIPOINTER(dev) \
+ ((DevHasCursor((dev)) || (!dev->isMaster && !dev->u.master)) ? \
+ (miPointerPtr)dixLookupPrivate(&(dev)->devPrivates, miPointerPrivKey): \
+ (miPointerPtr)dixLookupPrivate(&(dev)->u.master->devPrivates, miPointerPrivKey))
+
+static Bool miPointerRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool miPointerUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool miPointerDisplayCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static void miPointerConstrainCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ BoxPtr pBox);
+static void miPointerPointerNonInterestBox(DeviceIntPtr pDev,
+ ScreenPtr pScreen, BoxPtr pBox);
+static void miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, BoxPtr pHotBox,
+ BoxPtr pTopLeftBox);
+static Bool miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y,
Bool generateEvent);
static Bool miPointerCloseScreen(int index, ScreenPtr pScreen);
-static void miPointerMove(ScreenPtr pScreen, int x, int y, unsigned long time);
+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 xEvent* events; /* for WarpPointer MotionNotifies */
+static EventList* events; /* for WarpPointer MotionNotifies */
_X_EXPORT Bool
-miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
- ScreenPtr pScreen;
- miPointerSpriteFuncPtr spriteFuncs;
- miPointerScreenFuncPtr screenFuncs;
- Bool waitForUpdate;
+miPointerInitialize (ScreenPtr pScreen,
+ miPointerSpriteFuncPtr spriteFuncs,
+ miPointerScreenFuncPtr screenFuncs,
+ Bool waitForUpdate)
{
miPointerScreenPtr pScreenPriv;
@@ -104,40 +117,46 @@ miPointerInitialize (pScreen, spriteFuncs, screenFuncs, waitForUpdate)
pScreen->SetCursorPosition = miPointerSetCursorPosition;
pScreen->RecolorCursor = miRecolorCursor;
pScreen->PointerNonInterestBox = miPointerPointerNonInterestBox;
- /*
- * set up the pointer object
- */
- miPointer.pScreen = NULL;
- miPointer.pSpriteScreen = NULL;
- miPointer.pCursor = NULL;
- miPointer.pSpriteCursor = NULL;
- miPointer.limits.x1 = 0;
- miPointer.limits.x2 = 32767;
- miPointer.limits.y1 = 0;
- miPointer.limits.y2 = 32767;
- miPointer.confined = FALSE;
- miPointer.x = 0;
- miPointer.y = 0;
+ pScreen->DeviceCursorInitialize = miPointerDeviceInitialize;
+ pScreen->DeviceCursorCleanup = miPointerDeviceCleanup;
events = NULL;
-
return TRUE;
}
static Bool
-miPointerCloseScreen (index, pScreen)
- int index;
- ScreenPtr pScreen;
+miPointerCloseScreen (int index, ScreenPtr pScreen)
{
+#if 0
+ miPointerPtr pPointer;
+ DeviceIntPtr pDev;
+#endif
+
SetupScreen(pScreen);
- if (pScreen == miPointer.pScreen)
- miPointer.pScreen = 0;
- if (pScreen == miPointer.pSpriteScreen)
- miPointer.pSpriteScreen = 0;
+#if 0
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ {
+ if (DevHasCursor(pDev))
+ {
+ pPointer = MIPOINTER(pDev);
+
+ if (pScreen == pPointer->pScreen)
+ pPointer->pScreen = 0;
+ if (pScreen == pPointer->pSpriteScreen)
+ pPointer->pSpriteScreen = 0;
+ }
+ }
+
+ if (MIPOINTER(inputInfo.pointer)->pScreen == pScreen)
+ MIPOINTER(inputInfo.pointer)->pScreen = 0;
+ if (MIPOINTER(inputInfo.pointer)->pSpriteScreen == pScreen)
+ MIPOINTER(inputInfo.pointer)->pSpriteScreen = 0;
+#endif
+
pScreen->CloseScreen = pScreenPriv->CloseScreen;
xfree ((pointer) pScreenPriv);
- xfree ((pointer) events);
+ FreeEventList(events, GetMaximumEventsNum());
events = NULL;
return (*pScreen->CloseScreen) (index, pScreen);
}
@@ -147,61 +166,63 @@ miPointerCloseScreen (index, pScreen)
*/
static Bool
-miPointerRealizeCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miPointerRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
SetupScreen(pScreen);
-
- return (*pScreenPriv->spriteFuncs->RealizeCursor) (pScreen, pCursor);
+ return (*pScreenPriv->spriteFuncs->RealizeCursor) (pDev, pScreen, pCursor);
}
static Bool
-miPointerUnrealizeCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miPointerUnrealizeCursor (DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ CursorPtr pCursor)
{
SetupScreen(pScreen);
-
- return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pScreen, pCursor);
+ return (*pScreenPriv->spriteFuncs->UnrealizeCursor) (pDev, pScreen, pCursor);
}
static Bool
-miPointerDisplayCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miPointerDisplayCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
- miPointer.pCursor = pCursor;
- miPointer.pScreen = pScreen;
- miPointerUpdateSprite(inputInfo.pointer);
+ miPointerPtr pPointer;
+
+ /* return for keyboards */
+ if ((pDev->isMaster && !DevHasCursor(pDev)) ||
+ (!pDev->isMaster && pDev->u.master && !DevHasCursor(pDev->u.master)))
+ return FALSE;
+
+ pPointer = MIPOINTER(pDev);
+
+ pPointer->pCursor = pCursor;
+ pPointer->pScreen = pScreen;
+ miPointerUpdateSprite(pDev);
return TRUE;
}
static void
-miPointerConstrainCursor (pScreen, pBox)
- ScreenPtr pScreen;
- BoxPtr pBox;
+miPointerConstrainCursor (DeviceIntPtr pDev, ScreenPtr pScreen, BoxPtr pBox)
{
- miPointer.limits = *pBox;
- miPointer.confined = PointerConfinedToScreen();
+ miPointerPtr pPointer;
+
+ pPointer = MIPOINTER(pDev);
+
+ pPointer->limits = *pBox;
+ pPointer->confined = PointerConfinedToScreen(pDev);
}
/*ARGSUSED*/
static void
-miPointerPointerNonInterestBox (pScreen, pBox)
- ScreenPtr pScreen;
- BoxPtr pBox;
+miPointerPointerNonInterestBox (DeviceIntPtr pDev,
+ ScreenPtr pScreen,
+ BoxPtr pBox)
{
/* until DIX uses this, this will remain a stub */
}
/*ARGSUSED*/
static void
-miPointerCursorLimits(pScreen, pCursor, pHotBox, pTopLeftBox)
- ScreenPtr pScreen;
- CursorPtr pCursor;
- BoxPtr pHotBox;
- BoxPtr pTopLeftBox;
+miPointerCursorLimits(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor,
+ BoxPtr pHotBox, BoxPtr pTopLeftBox)
{
*pTopLeftBox = *pHotBox;
}
@@ -209,59 +230,117 @@ miPointerCursorLimits(pScreen, pCursor, pHotBox, pTopLeftBox)
static Bool GenerateEvent;
static Bool
-miPointerSetCursorPosition(pScreen, x, y, generateEvent)
- ScreenPtr pScreen;
- int x, y;
- Bool generateEvent;
+miPointerSetCursorPosition(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y, Bool generateEvent)
{
SetupScreen (pScreen);
GenerateEvent = generateEvent;
/* device dependent - must pend signal and call miPointerWarpCursor */
- (*pScreenPriv->screenFuncs->WarpCursor) (pScreen, x, y);
+ (*pScreenPriv->screenFuncs->WarpCursor) (pDev, pScreen, x, y);
if (!generateEvent)
- miPointerUpdateSprite(inputInfo.pointer);
+ miPointerUpdateSprite(pDev);
return TRUE;
}
+/* Set up sprite information for the device.
+ This function will be called once for each device after it is initialized
+ in the DIX.
+ */
+static Bool
+miPointerDeviceInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ miPointerPtr pPointer;
+ SetupScreen (pScreen);
+
+ pPointer = xalloc(sizeof(miPointerRec));
+ if (!pPointer)
+ return FALSE;
+
+ pPointer->pScreen = NULL;
+ pPointer->pSpriteScreen = NULL;
+ pPointer->pCursor = NULL;
+ pPointer->pSpriteCursor = NULL;
+ pPointer->limits.x1 = 0;
+ pPointer->limits.x2 = 32767;
+ pPointer->limits.y1 = 0;
+ pPointer->limits.y2 = 32767;
+ pPointer->confined = FALSE;
+ pPointer->x = 0;
+ pPointer->y = 0;
+
+ if (!((*pScreenPriv->spriteFuncs->DeviceCursorInitialize)(pDev, pScreen)))
+ {
+ xfree(pPointer);
+ return FALSE;
+ }
+
+ dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, pPointer);
+ return TRUE;
+}
+
+/* Clean up after device.
+ This function will be called once before the device is freed in the DIX
+ */
+static void
+miPointerDeviceCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ if (!pDev->isMaster && pDev->u.master)
+ return;
+
+ SetupScreen(pScreen);
+ (*pScreenPriv->spriteFuncs->DeviceCursorCleanup)(pDev, pScreen);
+ xfree(dixLookupPrivate(&pDev->devPrivates, miPointerPrivKey));
+ dixSetPrivate(&pDev->devPrivates, miPointerPrivKey, NULL);
+}
+
+
/* Once signals are ignored, the WarpCursor function can call this */
_X_EXPORT void
-miPointerWarpCursor (pScreen, x, y)
- ScreenPtr pScreen;
- int x, y;
+miPointerWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
+ miPointerPtr pPointer;
BOOL changedScreen = FALSE;
+
+ pPointer = MIPOINTER(pDev);
SetupScreen (pScreen);
- if (miPointer.pScreen != pScreen)
+ if (pPointer->pScreen != pScreen)
{
- (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, TRUE);
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, TRUE);
changedScreen = TRUE;
}
if (GenerateEvent)
{
- miPointerMove (pScreen, x, y, GetTimeInMillis());
+ miPointerMove (pDev, pScreen, x, y);
}
else
{
/* everything from miPointerMove except the event and history */
- if (!pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
+ if (!pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
{
- miPointer.devx = x;
- miPointer.devy = y;
- if(!miPointer.pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ pPointer->devx = x;
+ pPointer->devy = y;
+ if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
}
- miPointer.x = x;
- miPointer.y = y;
- miPointer.pScreen = pScreen;
+ pPointer->x = x;
+ pPointer->y = y;
+ pPointer->pScreen = pScreen;
}
- if (changedScreen)
- UpdateSpriteForScreen (pScreen) ;
+ /* Don't call USFS if we use Xinerama, otherwise the root window is
+ * updated to the second screen, and we never receive any events.
+ * (FDO bug #18668) */
+ if (changedScreen
+#ifdef PANORAMIX
+ && noPanoramiXExtension
+#endif
+ )
+ UpdateSpriteForScreen (pDev, pScreen) ;
}
/*
@@ -269,118 +348,100 @@ miPointerWarpCursor (pScreen, x, y)
*/
/*
- * miPointerUpdate
+ * miPointerUpdateSprite
*
* Syncronize the sprite with the cursor - called from ProcessInputEvents
*/
void
-miPointerUpdate ()
-{
- miPointerUpdateSprite(inputInfo.pointer);
-}
-
-void
miPointerUpdateSprite (DeviceIntPtr pDev)
{
ScreenPtr pScreen;
miPointerScreenPtr pScreenPriv;
CursorPtr pCursor;
int x, y, devx, devy;
+ miPointerPtr pPointer;
- if (!pDev || !(pDev->coreEvents || pDev == inputInfo.pointer))
+ if (!pDev || !pDev->coreEvents)
return;
- pScreen = miPointer.pScreen;
+ pPointer = MIPOINTER(pDev);
+
+ pScreen = pPointer->pScreen;
if (!pScreen)
return;
- x = miPointer.x;
- y = miPointer.y;
- devx = miPointer.devx;
- devy = miPointer.devy;
+ x = pPointer->x;
+ y = pPointer->y;
+ devx = pPointer->devx;
+ devy = pPointer->devy;
pScreenPriv = GetScreenPrivate (pScreen);
/*
* if the cursor has switched screens, disable the sprite
* on the old screen
*/
- if (pScreen != miPointer.pSpriteScreen)
+ if (pScreen != pPointer->pSpriteScreen)
{
- if (miPointer.pSpriteScreen)
+ if (pPointer->pSpriteScreen)
{
miPointerScreenPtr pOldPriv;
- pOldPriv = GetScreenPrivate (miPointer.pSpriteScreen);
- if (miPointer.pCursor)
+ pOldPriv = GetScreenPrivate (pPointer->pSpriteScreen);
+ if (pPointer->pCursor)
{
(*pOldPriv->spriteFuncs->SetCursor)
- (miPointer.pSpriteScreen, NullCursor, 0, 0);
+ (pDev, pPointer->pSpriteScreen, NullCursor, 0, 0);
}
- (*pOldPriv->screenFuncs->CrossScreen) (miPointer.pSpriteScreen, FALSE);
+ (*pOldPriv->screenFuncs->CrossScreen) (pPointer->pSpriteScreen, FALSE);
}
(*pScreenPriv->screenFuncs->CrossScreen) (pScreen, TRUE);
(*pScreenPriv->spriteFuncs->SetCursor)
- (pScreen, miPointer.pCursor, x, y);
- miPointer.devx = x;
- miPointer.devy = y;
- miPointer.pSpriteCursor = miPointer.pCursor;
- miPointer.pSpriteScreen = pScreen;
+ (pDev, pScreen, pPointer->pCursor, x, y);
+ pPointer->devx = x;
+ pPointer->devy = y;
+ pPointer->pSpriteCursor = pPointer->pCursor;
+ pPointer->pSpriteScreen = pScreen;
}
/*
* if the cursor has changed, display the new one
*/
- else if (miPointer.pCursor != miPointer.pSpriteCursor)
+ else if (pPointer->pCursor != pPointer->pSpriteCursor)
{
- pCursor = miPointer.pCursor;
- if (pCursor->bits->emptyMask && !pScreenPriv->showTransparent)
+ pCursor = pPointer->pCursor;
+ if (!pCursor || (pCursor->bits->emptyMask && !pScreenPriv->showTransparent))
pCursor = NullCursor;
- (*pScreenPriv->spriteFuncs->SetCursor) (pScreen, pCursor, x, y);
+ (*pScreenPriv->spriteFuncs->SetCursor) (pDev, pScreen, pCursor, x, y);
- miPointer.devx = x;
- miPointer.devy = y;
- miPointer.pSpriteCursor = miPointer.pCursor;
+ pPointer->devx = x;
+ pPointer->devy = y;
+ pPointer->pSpriteCursor = pPointer->pCursor;
}
else if (x != devx || y != devy)
{
- miPointer.devx = x;
- miPointer.devy = y;
- if(!miPointer.pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ pPointer->devx = x;
+ pPointer->devy = y;
+ if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
}
}
-/*
- * miPointerDeltaCursor. The pointer has moved dx,dy from it's previous
- * position.
- */
-
-void
-miPointerDeltaCursor (int dx, int dy, unsigned long time)
-{
- int x = miPointer.x + dx, y = miPointer.y + dy;
-
- miPointerSetPosition(inputInfo.pointer, &x, &y, time);
-}
-
-void
-miPointerSetNewScreen(int screen_no, int x, int y)
-{
- miPointerSetScreen(inputInfo.pointer, screen_no, x, y);
-}
-
void
miPointerSetScreen(DeviceIntPtr pDev, int screen_no, int x, int y)
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
+ miPointerPtr pPointer;
+
+ pPointer = MIPOINTER(pDev);
pScreen = screenInfo.screens[screen_no];
pScreenPriv = GetScreenPrivate (pScreen);
- (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE);
- NewCurrentScreen (pScreen, x, y);
- miPointer.limits.x2 = pScreen->width;
- miPointer.limits.y2 = pScreen->height;
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen, FALSE);
+ NewCurrentScreen (pDev, pScreen, x, y);
+
+ pPointer->limits.x2 = pScreen->width;
+ pPointer->limits.y2 = pScreen->height;
}
_X_EXPORT ScreenPtr
@@ -392,7 +453,8 @@ miPointerCurrentScreen ()
_X_EXPORT ScreenPtr
miPointerGetScreen(DeviceIntPtr pDev)
{
- return miPointer.pScreen;
+ miPointerPtr pPointer = MIPOINTER(pDev);
+ return (pPointer) ? pPointer->pScreen : NULL;
}
/* Move the pointer to x, y on the current screen, update the sprite, and
@@ -401,98 +463,110 @@ miPointerGetScreen(DeviceIntPtr pDev)
_X_EXPORT void
miPointerAbsoluteCursor (int x, int y, unsigned long time)
{
- miPointerSetPosition(inputInfo.pointer, &x, &y, time);
+ miPointerSetPosition(inputInfo.pointer, &x, &y);
}
/* Move the pointer on the current screen, and update the sprite. */
static void
-miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y,
- unsigned long time)
+miPointerMoved (DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y)
{
+ miPointerPtr pPointer;
SetupScreen(pScreen);
- if (pDev && (pDev->coreEvents || pDev == inputInfo.pointer) &&
- !pScreenPriv->waitForUpdate && pScreen == miPointer.pSpriteScreen)
+ pPointer = MIPOINTER(pDev);
+
+ /* Hack: We mustn't call into ->MoveCursor for anything but the
+ * VCP, as this may cause a non-HW rendered cursor to be rendered during
+ * SIGIO. This again leads to allocs during SIGIO which leads to SIGABRT.
+ */
+ if ((pDev == inputInfo.pointer || (!pDev->isMaster && pDev->u.master == inputInfo.pointer))
+ && !pScreenPriv->waitForUpdate && pScreen == pPointer->pSpriteScreen)
{
- miPointer.devx = x;
- miPointer.devy = y;
- if(!miPointer.pCursor->bits->emptyMask)
- (*pScreenPriv->spriteFuncs->MoveCursor) (pScreen, x, y);
+ pPointer->devx = x;
+ pPointer->devy = y;
+ if(pPointer->pCursor && !pPointer->pCursor->bits->emptyMask)
+ (*pScreenPriv->spriteFuncs->MoveCursor) (pDev, pScreen, x, y);
}
- miPointer.x = x;
- miPointer.y = y;
- miPointer.pScreen = pScreen;
+ pPointer->x = x;
+ pPointer->y = y;
+ pPointer->pScreen = pScreen;
}
_X_EXPORT void
-miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y, unsigned long time)
+miPointerSetPosition(DeviceIntPtr pDev, int *x, int *y)
{
miPointerScreenPtr pScreenPriv;
ScreenPtr pScreen;
ScreenPtr newScreen;
- pScreen = miPointer.pScreen;
+ miPointerPtr pPointer;
+
+ pPointer = MIPOINTER(pDev);
+ pScreen = pPointer->pScreen;
if (!pScreen)
return; /* called before ready */
- if (!pDev || !(pDev->coreEvents || pDev == inputInfo.pointer))
+ if (!pDev || !pDev->coreEvents)
return;
if (*x < 0 || *x >= pScreen->width || *y < 0 || *y >= pScreen->height)
{
pScreenPriv = GetScreenPrivate (pScreen);
- if (!miPointer.confined)
+ if (!pPointer->confined)
{
newScreen = pScreen;
(*pScreenPriv->screenFuncs->CursorOffScreen) (&newScreen, x, y);
if (newScreen != pScreen)
{
pScreen = newScreen;
- (*pScreenPriv->screenFuncs->NewEventScreen) (pScreen, FALSE);
+ (*pScreenPriv->screenFuncs->NewEventScreen) (pDev, pScreen,
+ FALSE);
pScreenPriv = GetScreenPrivate (pScreen);
/* Smash the confine to the new screen */
- miPointer.limits.x2 = pScreen->width;
- miPointer.limits.y2 = pScreen->height;
+ pPointer->limits.x2 = pScreen->width;
+ pPointer->limits.y2 = pScreen->height;
}
}
}
/* Constrain the sprite to the current limits. */
- if (*x < miPointer.limits.x1)
- *x = miPointer.limits.x1;
- if (*x >= miPointer.limits.x2)
- *x = miPointer.limits.x2 - 1;
- if (*y < miPointer.limits.y1)
- *y = miPointer.limits.y1;
- if (*y >= miPointer.limits.y2)
- *y = miPointer.limits.y2 - 1;
-
- if (miPointer.x == *x && miPointer.y == *y && miPointer.pScreen == pScreen)
- return;
-
- miPointerMoved(pDev, pScreen, *x, *y, time);
-}
+ if (*x < pPointer->limits.x1)
+ *x = pPointer->limits.x1;
+ if (*x >= pPointer->limits.x2)
+ *x = pPointer->limits.x2 - 1;
+ if (*y < pPointer->limits.y1)
+ *y = pPointer->limits.y1;
+ if (*y >= pPointer->limits.y2)
+ *y = pPointer->limits.y2 - 1;
+
+ if (pPointer->x == *x && pPointer->y == *y &&
+ pPointer->pScreen == pScreen)
+ return;
-_X_EXPORT void
-miPointerPosition (int *x, int *y)
-{
- miPointerGetPosition(inputInfo.pointer, x, y);
+ miPointerMoved(pDev, pScreen, *x, *y);
}
_X_EXPORT void
miPointerGetPosition(DeviceIntPtr pDev, int *x, int *y)
{
- *x = miPointer.x;
- *y = miPointer.y;
+ *x = MIPOINTER(pDev)->x;
+ *y = MIPOINTER(pDev)->y;
}
+#ifdef XQUARTZ
+#include <pthread.h>
+void darwinEvents_lock(void);
+void darwinEvents_unlock(void);
+#endif
+
void
-miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
+miPointerMove (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
int i, nevents;
int valuators[2];
- miPointerMoved(inputInfo.pointer, pScreen, x, y, time);
+ miPointerMoved(pDev, pScreen, x, y);
/* generate motion notify */
valuators[0] = x;
@@ -500,7 +574,7 @@ miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
if (!events)
{
- events = (xEvent*)xcalloc(sizeof(xEvent), GetMaximumEventsNum());
+ events = InitEventList(GetMaximumEventsNum());
if (!events)
{
@@ -509,9 +583,16 @@ miPointerMove (ScreenPtr pScreen, int x, int y, unsigned long time)
}
}
- nevents = GetPointerEvents(events, inputInfo.pointer, MotionNotify, 0,
- POINTER_ABSOLUTE, 0, 2, valuators);
+ nevents = GetPointerEvents(events, pDev, MotionNotify, 0, POINTER_SCREEN | POINTER_ABSOLUTE, 0, 2, valuators);
+ OsBlockSignals();
+#ifdef XQUARTZ
+ darwinEvents_lock();
+#endif
for (i = 0; i < nevents; i++)
- mieqEnqueue(inputInfo.pointer, &events[i]);
+ mieqEnqueue(pDev, events[i].event);
+#ifdef XQUARTZ
+ darwinEvents_unlock();
+#endif
+ OsReleaseSignals();
}
diff --git a/xorg-server/mi/mipointer.h b/xorg-server/mi/mipointer.h
index e864fddf4..d1eac987f 100644
--- a/xorg-server/mi/mipointer.h
+++ b/xorg-server/mi/mipointer.h
@@ -32,24 +32,36 @@ in this Software without prior written authorization from The Open Group.
typedef struct _miPointerSpriteFuncRec {
Bool (*RealizeCursor)(
+ DeviceIntPtr /* pDev */,
ScreenPtr /* pScr */,
CursorPtr /* pCurs */
);
Bool (*UnrealizeCursor)(
+ DeviceIntPtr /* pDev */,
ScreenPtr /* pScr */,
CursorPtr /* pCurs */
);
void (*SetCursor)(
+ DeviceIntPtr /* pDev */,
ScreenPtr /* pScr */,
CursorPtr /* pCurs */,
int /* x */,
int /* y */
);
void (*MoveCursor)(
+ DeviceIntPtr /* pDev */,
ScreenPtr /* pScr */,
int /* x */,
int /* y */
);
+ Bool (*DeviceCursorInitialize)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */
+ );
+ void (*DeviceCursorCleanup)(
+ DeviceIntPtr /* pDev */,
+ ScreenPtr /* pScr */
+ );
} miPointerSpriteFuncRec, *miPointerSpriteFuncPtr;
typedef struct _miPointerScreenFuncRec {
@@ -63,6 +75,7 @@ typedef struct _miPointerScreenFuncRec {
int /* entering */
);
void (*WarpCursor)(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /* pScr */,
int /* x */,
int /* y */
@@ -72,6 +85,7 @@ typedef struct _miPointerScreenFuncRec {
xEventPtr /* event */
);
void (*NewEventScreen)(
+ DeviceIntPtr /* pDev */,
ScreenPtr /* pScr */,
Bool /* fromDIX */
);
@@ -90,15 +104,12 @@ extern Bool miPointerInitialize(
);
extern void miPointerWarpCursor(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/
) _X_DEPRECATED;
-extern int miPointerGetMotionBufferSize(
- void
-) _X_DEPRECATED;
-
extern int miPointerGetMotionEvents(
DeviceIntPtr /*pPtr*/,
xTimecoord * /*coords*/,
@@ -107,36 +118,13 @@ extern int miPointerGetMotionEvents(
ScreenPtr /*pScreen*/
);
-/* Deprecated in favour of miPointerUpdateSprite. */
-extern void miPointerUpdate(
- void
-) _X_DEPRECATED;
-
-/* Deprecated in favour of miSetPointerPosition. */
-extern void miPointerDeltaCursor(
- int /*dx*/,
- int /*dy*/,
- unsigned long /*time*/
-) _X_DEPRECATED;
+/* Deprecated in favour of miPointerSetPosition. */
extern void miPointerAbsoluteCursor(
int /*x*/,
int /*y*/,
unsigned long /*time*/
) _X_DEPRECATED;
-/* Deprecated in favour of miGetPointerPosition. */
-extern void miPointerPosition(
- int * /*x*/,
- int * /*y*/
-) _X_DEPRECATED;
-
-/* Deprecated in favour of miPointerSetScreen. */
-extern void miPointerSetNewScreen(
- int, /*screen_no*/
- int, /*x*/
- int /*y*/
-) _X_DEPRECATED;
-
/* Deprecated in favour of miPointerGetScreen. */
extern ScreenPtr miPointerCurrentScreen(
void
@@ -161,8 +149,7 @@ extern void miPointerGetPosition(
extern void miPointerSetPosition(
DeviceIntPtr pDev,
int *x,
- int *y,
- unsigned long time);
+ int *y);
extern void miPointerUpdateSprite(
DeviceIntPtr pDev);
diff --git a/xorg-server/mi/mipointrst.h b/xorg-server/mi/mipointrst.h
index a80c52e7a..bd9c24a00 100644
--- a/xorg-server/mi/mipointrst.h
+++ b/xorg-server/mi/mipointrst.h
@@ -29,6 +29,9 @@ used in advertising or otherwise to promote the sale, use or other dealings
in this Software without prior written authorization from The Open Group.
*/
+#ifndef MIPOINTRST_H
+#define MIPOINTRST_H
+
#include "mipointer.h"
#include "scrnintstr.h"
@@ -50,3 +53,4 @@ typedef struct {
Bool waitForUpdate; /* don't move cursor in SIGIO */
Bool showTransparent; /* show empty cursors */
} miPointerScreenRec, *miPointerScreenPtr;
+#endif /* MIPOINTRST_H */
diff --git a/xorg-server/mi/mipoly.c b/xorg-server/mi/mipoly.c
index 4c77fc268..5ec4bfd6a 100644
--- a/xorg-server/mi/mipoly.c
+++ b/xorg-server/mi/mipoly.c
@@ -67,12 +67,9 @@ SOFTWARE.
_X_EXPORT void
-miFillPolygon(dst, pgc, shape, mode, count, pPts)
- DrawablePtr dst;
- GCPtr pgc;
- int shape, mode;
- int count;
- DDXPointPtr pPts;
+miFillPolygon( DrawablePtr dst, GCPtr pgc,
+ int shape, int mode,
+ int count, DDXPointPtr pPts)
{
int i;
int xorg, yorg;
diff --git a/xorg-server/mi/mipolycon.c b/xorg-server/mi/mipolycon.c
index 6aabad675..6e3889621 100644
--- a/xorg-server/mi/mipolycon.c
+++ b/xorg-server/mi/mipolycon.c
@@ -71,12 +71,13 @@ static int getPolyYBounds(DDXPointPtr pts, int n, int *by, int *ty);
* For a derivation of the algorithm, see the author of
* this code.
*/
-_X_EXPORT Bool
-miFillConvexPoly(dst, pgc, count, ptsIn)
- DrawablePtr dst;
- GCPtr pgc;
- int count; /* number of points */
- DDXPointPtr ptsIn; /* the points */
+Bool
+miFillConvexPoly(
+ DrawablePtr dst,
+ GCPtr pgc,
+ int count, /* number of points */
+ DDXPointPtr ptsIn /* the points */
+ )
{
int xl = 0, xr = 0; /* x vals of left and right edges */
int dl = 0, dr = 0; /* decision variables */
diff --git a/xorg-server/mi/mipolygen.c b/xorg-server/mi/mipolygen.c
index 7623fc40a..04bc2c67f 100644
--- a/xorg-server/mi/mipolygen.c
+++ b/xorg-server/mi/mipolygen.c
@@ -66,11 +66,12 @@ SOFTWARE.
*/
Bool
-miFillGeneralPoly(dst, pgc, count, ptsIn)
- DrawablePtr dst;
- GCPtr pgc;
- int count; /* number of points */
- DDXPointPtr ptsIn; /* the points */
+miFillGeneralPoly(
+ DrawablePtr dst,
+ GCPtr pgc,
+ int count, /* number of points */
+ DDXPointPtr ptsIn /* the points */
+ )
{
EdgeTableEntry *pAET; /* the Active Edge Table */
int y; /* the current scanline */
diff --git a/xorg-server/mi/mipolypnt.c b/xorg-server/mi/mipolypnt.c
index 56026bdbd..d16a95158 100644
--- a/xorg-server/mi/mipolypnt.c
+++ b/xorg-server/mi/mipolypnt.c
@@ -56,12 +56,13 @@ SOFTWARE.
#include "mi.h"
_X_EXPORT void
-miPolyPoint(pDrawable, pGC, mode, npt, pptInit)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode; /* Origin or Previous */
- int npt;
- xPoint *pptInit;
+miPolyPoint(
+ DrawablePtr pDrawable,
+ GCPtr pGC,
+ int mode, /* Origin or Previous */
+ int npt,
+ xPoint *pptInit
+ )
{
int xorg;
diff --git a/xorg-server/mi/mipolyrect.c b/xorg-server/mi/mipolyrect.c
index 788624872..e7504ef16 100644
--- a/xorg-server/mi/mipolyrect.c
+++ b/xorg-server/mi/mipolyrect.c
@@ -56,11 +56,7 @@ SOFTWARE.
#include "mi.h"
_X_EXPORT void
-miPolyRectangle(pDraw, pGC, nrects, pRects)
- DrawablePtr pDraw;
- GCPtr pGC;
- int nrects;
- xRectangle *pRects;
+miPolyRectangle(DrawablePtr pDraw, GCPtr pGC, int nrects, xRectangle *pRects)
{
int i;
xRectangle *pR = pRects;
diff --git a/xorg-server/mi/mipolyseg.c b/xorg-server/mi/mipolyseg.c
index 0cd9d416e..0832a601b 100644
--- a/xorg-server/mi/mipolyseg.c
+++ b/xorg-server/mi/mipolyseg.c
@@ -67,11 +67,7 @@ SOFTWARE.
_X_EXPORT void
-miPolySegment(pDraw, pGC, nseg, pSegs)
- DrawablePtr pDraw;
- GCPtr pGC;
- int nseg;
- xSegment *pSegs;
+miPolySegment(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment *pSegs)
{
int i;
diff --git a/xorg-server/mi/mipolytext.c b/xorg-server/mi/mipolytext.c
index 82b16f7d2..7be40aef1 100644
--- a/xorg-server/mi/mipolytext.c
+++ b/xorg-server/mi/mipolytext.c
@@ -67,12 +67,7 @@ SOFTWARE.
#include "mi.h"
_X_EXPORT int
-miPolyText8(pDraw, pGC, x, y, count, chars)
- DrawablePtr pDraw;
- GCPtr pGC;
- int x, y;
- int count;
- char *chars;
+miPolyText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars)
{
unsigned long n, i;
int w;
@@ -89,12 +84,7 @@ miPolyText8(pDraw, pGC, x, y, count, chars)
}
_X_EXPORT int
-miPolyText16(pDraw, pGC, x, y, count, chars)
- DrawablePtr pDraw;
- GCPtr pGC;
- int x, y;
- int count;
- unsigned short *chars;
+miPolyText16(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, unsigned short *chars)
{
unsigned long n, i;
int w;
@@ -112,12 +102,7 @@ miPolyText16(pDraw, pGC, x, y, count, chars)
}
_X_EXPORT void
-miImageText8(pDraw, pGC, x, y, count, chars)
- DrawablePtr pDraw;
- GCPtr pGC;
- int x, y;
- int count;
- char *chars;
+miImageText8(DrawablePtr pDraw, GCPtr pGC, int x, int y, int count, char *chars)
{
unsigned long n;
FontPtr font = pGC->font;
@@ -130,12 +115,8 @@ miImageText8(pDraw, pGC, x, y, count, chars)
}
_X_EXPORT void
-miImageText16(pDraw, pGC, x, y, count, chars)
- DrawablePtr pDraw;
- GCPtr pGC;
- int x, y;
- int count;
- unsigned short *chars;
+miImageText16(DrawablePtr pDraw, GCPtr pGC, int x, int y,
+ int count, unsigned short *chars)
{
unsigned long n;
FontPtr font = pGC->font;
diff --git a/xorg-server/mi/mipolyutil.c b/xorg-server/mi/mipolyutil.c
index 6ec860a25..ed41a7d1a 100644
--- a/xorg-server/mi/mipolyutil.c
+++ b/xorg-server/mi/mipolyutil.c
@@ -161,13 +161,8 @@ miInsertEdgeInET(EdgeTable *ET, EdgeTableEntry *ETE, int scanline,
*/
Bool
-miCreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock)
- int count;
- DDXPointPtr pts;
- EdgeTable *ET;
- EdgeTableEntry *AET;
- EdgeTableEntry *pETEs;
- ScanLineListBlock *pSLLBlock;
+miCreateETandAET(int count, DDXPointPtr pts, EdgeTable *ET, EdgeTableEntry *AET,
+ EdgeTableEntry *pETEs, ScanLineListBlock *pSLLBlock)
{
DDXPointPtr top, bottom;
DDXPointPtr PrevPt, CurrPt;
@@ -257,8 +252,7 @@ miCreateETandAET(count, pts, ET, AET, pETEs, pSLLBlock)
*/
void
-miloadAET(AET, ETEs)
- EdgeTableEntry *AET, *ETEs;
+miloadAET(EdgeTableEntry *AET, EdgeTableEntry *ETEs)
{
EdgeTableEntry *pPrevAET;
EdgeTableEntry *tmp;
@@ -305,8 +299,7 @@ miloadAET(AET, ETEs)
*
*/
void
-micomputeWAET(AET)
- EdgeTableEntry *AET;
+micomputeWAET(EdgeTableEntry *AET)
{
EdgeTableEntry *pWETE;
int inside = 1;
@@ -344,8 +337,7 @@ micomputeWAET(AET)
*/
int
-miInsertionSort(AET)
- EdgeTableEntry *AET;
+miInsertionSort(EdgeTableEntry *AET)
{
EdgeTableEntry *pETEchase;
EdgeTableEntry *pETEinsert;
@@ -381,8 +373,7 @@ miInsertionSort(AET)
* Clean up our act.
*/
void
-miFreeStorage(pSLLBlock)
- ScanLineListBlock *pSLLBlock;
+miFreeStorage(ScanLineListBlock *pSLLBlock)
{
ScanLineListBlock *tmpSLLBlock;
diff --git a/xorg-server/mi/mipushpxl.c b/xorg-server/mi/mipushpxl.c
index 6fc57db11..4b9789047 100644
--- a/xorg-server/mi/mipushpxl.c
+++ b/xorg-server/mi/mipushpxl.c
@@ -92,12 +92,9 @@ bitsizeof(int) padding and sacnline unit == bitsizeof(int).)
* in order to have both (MSB_FIRST and LSB_FIRST) versions of this
* in the server, we need to rename one of them
*/
-_X_EXPORT void
-miPushPixels(pGC, pBitMap, pDrawable, dx, dy, xOrg, yOrg)
- GCPtr pGC;
- PixmapPtr pBitMap;
- DrawablePtr pDrawable;
- int dx, dy, xOrg, yOrg;
+void
+miPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDrawable,
+ int dx, int dy, int xOrg, int yOrg)
{
int h, dxDivPPW, ibEnd;
MiBits *pwLineStart;
diff --git a/xorg-server/mi/miregion.c b/xorg-server/mi/miregion.c
index 45768a34f..bbeac877b 100644
--- a/xorg-server/mi/miregion.c
+++ b/xorg-server/mi/miregion.c
@@ -88,10 +88,15 @@ Equipment Corporation.
#include <pixman.h>
#undef assert
-#ifdef DEBUG
-#define assert(expr) {if (!(expr)) \
- FatalError("Assertion failed file %s, line %d: expr\n", \
- __FILE__, __LINE__); }
+#ifdef REGION_DEBUG
+#define assert(expr) { \
+ CARD32 *foo = NULL; \
+ if (!(expr)) { \
+ ErrorF("Assertion failed file %s, line %d: %s\n", \
+ __FILE__, __LINE__, #expr); \
+ *foo = 0xdeadbeef; /* to get a backtrace */ \
+ } \
+ }
#else
#define assert(expr)
#endif
@@ -232,9 +237,7 @@ InitRegions (void)
*****************************************************************/
_X_EXPORT RegionPtr
-miRegionCreate(rect, size)
- BoxPtr rect;
- int size;
+miRegionCreate(BoxPtr rect, int size)
{
RegionPtr pReg;
@@ -248,8 +251,7 @@ miRegionCreate(rect, size)
}
_X_EXPORT void
-miRegionDestroy(pReg)
- RegionPtr pReg;
+miRegionDestroy(RegionPtr pReg)
{
pixman_region_fini (pReg);
if (pReg != &miBrokenRegion)
@@ -257,8 +259,7 @@ miRegionDestroy(pReg)
}
_X_EXPORT void
-miPrintRegion(rgn)
- RegionPtr rgn;
+miPrintRegion(RegionPtr rgn)
{
int num, size;
int i;
@@ -267,27 +268,24 @@ miPrintRegion(rgn)
num = REGION_NUM_RECTS(rgn);
size = REGION_SIZE(rgn);
rects = REGION_RECTS(rgn);
- ErrorF("num: %d size: %d\n", num, size);
- ErrorF("extents: %d %d %d %d\n",
+ ErrorF("[mi] num: %d size: %d\n", num, size);
+ ErrorF("[mi] extents: %d %d %d %d\n",
rgn->extents.x1, rgn->extents.y1, rgn->extents.x2, rgn->extents.y2);
for (i = 0; i < num; i++)
- ErrorF("%d %d %d %d \n",
+ ErrorF("[mi] %d %d %d %d \n",
rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
- ErrorF("\n");
+ ErrorF("[mi] \n");
}
_X_EXPORT Bool
-miRegionEqual(reg1, reg2)
- RegionPtr reg1;
- RegionPtr reg2;
+miRegionEqual(RegionPtr reg1, RegionPtr reg2)
{
return pixman_region_equal (reg1, reg2);
}
#ifdef DEBUG
Bool
-miValidRegion(reg)
- RegionPtr reg;
+miValidRegion(RegionPtr reg)
{
int i, numRects;
@@ -338,10 +336,7 @@ miValidRegion(reg)
*****************************************************************/
_X_EXPORT void
-miRegionInit(pReg, rect, size)
- RegionPtr pReg;
- BoxPtr rect;
- int size;
+miRegionInit(RegionPtr pReg, BoxPtr rect, int size)
{
if (rect)
pixman_region_init_with_extents (pReg, rect);
@@ -350,15 +345,13 @@ miRegionInit(pReg, rect, size)
}
_X_EXPORT void
-miRegionUninit(pReg)
- RegionPtr pReg;
+miRegionUninit(RegionPtr pReg)
{
pixman_region_fini (pReg);
}
Bool
-miRegionBreak (pReg)
- RegionPtr pReg;
+miRegionBreak (RegionPtr pReg)
{
xfreeData (pReg);
pReg->extents = miEmptyBox;
@@ -367,9 +360,7 @@ miRegionBreak (pReg)
}
_X_EXPORT Bool
-miRectAlloc(
- RegionPtr pRgn,
- int n)
+miRectAlloc(RegionPtr pRgn, int n)
{
RegDataPtr data;
@@ -408,9 +399,7 @@ miRectAlloc(
}
_X_EXPORT Bool
-miRegionCopy(dst, src)
- RegionPtr dst;
- RegionPtr src;
+miRegionCopy(RegionPtr dst, RegionPtr src)
{
return pixman_region_copy (dst, src);
}
@@ -903,10 +892,11 @@ miSetExtents (RegionPtr pReg)
*/
/*ARGSUSED*/
_X_EXPORT Bool
-miIntersect(newReg, reg1, reg2)
- RegionPtr newReg; /* destination Region */
- RegionPtr reg1;
- RegionPtr reg2; /* source regions */
+miIntersect(
+ RegionPtr newReg, /* destination Region */
+ RegionPtr reg1,
+ RegionPtr reg2 /* source regions */
+ )
{
return pixman_region_intersect (newReg, reg1, reg2);
}
@@ -1005,11 +995,12 @@ miUnionO (
return TRUE;
}
-_X_EXPORT Bool
-miUnion(newReg, reg1, reg2)
- RegionPtr newReg; /* destination Region */
- RegionPtr reg1;
- RegionPtr reg2; /* source regions */
+_X_EXPORT Bool
+miUnion(
+ RegionPtr newReg, /* destination Region */
+ RegionPtr reg1,
+ RegionPtr reg2 /* source regions */
+ )
{
return pixman_region_union (newReg, reg1, reg2);
}
@@ -1036,9 +1027,7 @@ miUnion(newReg, reg1, reg2)
*
*/
_X_EXPORT Bool
-miRegionAppend(dstrgn, rgn)
- RegionPtr dstrgn;
- RegionPtr rgn;
+miRegionAppend(RegionPtr dstrgn, RegionPtr rgn)
{
int numRects, dnumRects, size;
BoxPtr new, old;
@@ -1222,9 +1211,7 @@ QuickSortRects(
*/
_X_EXPORT Bool
-miRegionValidate(badreg, pOverlap)
- RegionPtr badreg;
- Bool *pOverlap;
+miRegionValidate(RegionPtr badreg, Bool *pOverlap)
{
/* Descriptor for regions under construction in Step 2. */
typedef struct {
@@ -1413,10 +1400,7 @@ bail:
}
_X_EXPORT RegionPtr
-miRectsToRegion(nrects, prect, ctype)
- int nrects;
- xRectangle *prect;
- int ctype;
+miRectsToRegion(int nrects, xRectangle *prect, int ctype)
{
RegionPtr pRgn;
@@ -1530,10 +1514,7 @@ miRectsToRegion(nrects, prect, ctype)
*-----------------------------------------------------------------------
*/
_X_EXPORT Bool
-miSubtract(regD, regM, regS)
- RegionPtr regD;
- RegionPtr regM;
- RegionPtr regS;
+miSubtract(RegionPtr regD, RegionPtr regM, RegionPtr regS)
{
return pixman_region_subtract (regD, regM, regS);
}
@@ -1558,17 +1539,16 @@ miSubtract(regD, regM, regS)
*-----------------------------------------------------------------------
*/
_X_EXPORT Bool
-miInverse(newReg, reg1, invRect)
- RegionPtr newReg; /* Destination region */
- RegionPtr reg1; /* Region to invert */
- BoxPtr invRect; /* Bounding box for inversion */
+miInverse(
+ RegionPtr newReg, /* Destination region */
+ RegionPtr reg1, /* Region to invert */
+ BoxPtr invRect /* Bounding box for inversion */
+ )
{
return pixman_region_inverse (newReg, reg1, invRect);
}
_X_EXPORT int
-miRectIn(region, prect)
- RegionPtr region;
- BoxPtr prect;
+miRectIn(RegionPtr region, BoxPtr prect)
{
return pixman_region_contains_rectangle (region, prect);
}
@@ -1578,34 +1558,30 @@ miRectIn(region, prect)
*/
_X_EXPORT void
-miTranslateRegion(pReg, x, y)
- RegionPtr pReg;
- int x;
- int y;
+miTranslateRegion(RegionPtr pReg, int x, int y)
{
pixman_region_translate (pReg, x, y);
}
_X_EXPORT void
-miRegionReset(pReg, pBox)
- RegionPtr pReg;
- BoxPtr pBox;
+miRegionReset(RegionPtr pReg, BoxPtr pBox)
{
pixman_region_reset (pReg, pBox);
}
_X_EXPORT Bool
-miPointInRegion(pReg, x, y, box)
- RegionPtr pReg;
- int x, y;
- BoxPtr box; /* "return" value */
+miPointInRegion(
+ RegionPtr pReg,
+ int x,
+ int y,
+ BoxPtr box /* "return" value */
+ )
{
return pixman_region_contains_point (pReg, x, y, box);
}
_X_EXPORT Bool
-miRegionNotEmpty(pReg)
- RegionPtr pReg;
+miRegionNotEmpty(RegionPtr pReg)
{
return pixman_region_not_empty (pReg);
}
@@ -1618,8 +1594,7 @@ miRegionBroken(RegionPtr pReg)
}
_X_EXPORT void
-miRegionEmpty(pReg)
- RegionPtr pReg;
+miRegionEmpty(RegionPtr pReg)
{
good(pReg);
xfreeData(pReg);
@@ -1629,8 +1604,7 @@ miRegionEmpty(pReg)
}
_X_EXPORT BoxPtr
-miRegionExtents(pReg)
- RegionPtr pReg;
+miRegionExtents(RegionPtr pReg)
{
good(pReg);
return(&pReg->extents);
@@ -1869,34 +1843,3 @@ miClipSpans(
}
return (pwidthNew - pwidthNewStart);
}
-
-/* find the band in a region with the most rectangles */
-_X_EXPORT int
-miFindMaxBand(prgn)
- RegionPtr prgn;
-{
- int nbox;
- BoxPtr pbox;
- int nThisBand;
- int nMaxBand = 0;
- short yThisBand;
-
- good(prgn);
- nbox = REGION_NUM_RECTS(prgn);
- pbox = REGION_RECTS(prgn);
-
- while(nbox > 0)
- {
- yThisBand = pbox->y1;
- nThisBand = 0;
- while((nbox > 0) && (pbox->y1 == yThisBand))
- {
- nbox--;
- pbox++;
- nThisBand++;
- }
- if (nThisBand > nMaxBand)
- nMaxBand = nThisBand;
- }
- return (nMaxBand);
-}
diff --git a/xorg-server/mi/miscrinit.c b/xorg-server/mi/miscrinit.c
index 7ca5f5df1..28d331653 100644
--- a/xorg-server/mi/miscrinit.c
+++ b/xorg-server/mi/miscrinit.c
@@ -61,15 +61,8 @@ typedef struct
/* this plugs into pScreen->ModifyPixmapHeader */
_X_EXPORT Bool
-miModifyPixmapHeader(pPixmap, width, height, depth, bitsPerPixel, devKind,
- pPixData)
- PixmapPtr pPixmap;
- int width;
- int height;
- int depth;
- int bitsPerPixel;
- int devKind;
- pointer pPixData;
+miModifyPixmapHeader(PixmapPtr pPixmap, int width, int height, int depth,
+ int bitsPerPixel, int devKind, pointer pPixData)
{
if (!pPixmap)
return FALSE;
@@ -140,8 +133,7 @@ miCloseScreen (int iScreen, ScreenPtr pScreen)
* screen pixmap here.
*/
_X_EXPORT Bool
-miCreateScreenResources(pScreen)
- ScreenPtr pScreen;
+miCreateScreenResources(ScreenPtr pScreen)
{
miScreenInitParmsPtr pScrInitParms;
pointer value;
@@ -180,10 +172,7 @@ miCreateScreenResources(pScreen)
}
Bool
-miScreenDevPrivateInit(pScreen, width, pbits)
- ScreenPtr pScreen;
- int width;
- pointer pbits;
+miScreenDevPrivateInit(ScreenPtr pScreen, int width, pointer pbits)
{
miScreenInitParmsPtr pScrInitParms;
@@ -200,20 +189,33 @@ miScreenDevPrivateInit(pScreen, width, pbits)
return TRUE;
}
+static PixmapPtr
+miGetScreenPixmap(ScreenPtr pScreen)
+{
+ return (PixmapPtr)(pScreen->devPrivate);
+}
+
+static void
+miSetScreenPixmap(PixmapPtr pPix)
+{
+ if (pPix)
+ pPix->drawable.pScreen->devPrivate = (pointer)pPix;
+}
+
_X_EXPORT Bool
-miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
- rootDepth, numDepths, depths, rootVisual, numVisuals, visuals)
- ScreenPtr pScreen;
- pointer pbits; /* pointer to screen bits */
- int xsize, ysize; /* in pixels */
- int dpix, dpiy; /* dots per inch */
- int width; /* pixel width of frame buffer */
- int rootDepth; /* depth of root window */
- int numDepths; /* number of depths supported */
- DepthRec *depths; /* supported depths */
- VisualID rootVisual; /* root visual */
- int numVisuals; /* number of visuals supported */
- VisualRec *visuals; /* supported visuals */
+miScreenInit(
+ ScreenPtr pScreen,
+ pointer pbits, /* pointer to screen bits */
+ int xsize, int ysize, /* in pixels */
+ int dpix, int dpiy, /* dots per inch */
+ int width, /* pixel width of frame buffer */
+ int rootDepth, /* depth of root window */
+ int numDepths, /* number of depths supported */
+ DepthRec *depths, /* supported depths */
+ VisualID rootVisual, /* root visual */
+ int numVisuals, /* number of visuals supported */
+ VisualRec *visuals /* supported visuals */
+ )
{
pScreen->width = xsize;
pScreen->height = ysize;
@@ -268,17 +270,15 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
pScreen->wakeupData = (pointer)0;
pScreen->MarkWindow = miMarkWindow;
pScreen->MarkOverlappedWindows = miMarkOverlappedWindows;
- pScreen->ChangeSaveUnder = miChangeSaveUnder;
- pScreen->PostChangeSaveUnder = miPostChangeSaveUnder;
+ pScreen->ChangeSaveUnder = NULL;
+ pScreen->PostChangeSaveUnder = NULL;
pScreen->MoveWindow = miMoveWindow;
pScreen->ResizeWindow = miSlideAndSizeWindow;
pScreen->GetLayerWindow = miGetLayerWindow;
pScreen->HandleExposures = miHandleValidateExposures;
pScreen->ReparentWindow = (ReparentWindowProcPtr) 0;
pScreen->ChangeBorderWidth = miChangeBorderWidth;
-#ifdef SHAPE
pScreen->SetShape = miSetShape;
-#endif
pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow;
pScreen->SaveDoomedAreas = 0;
@@ -293,35 +293,20 @@ miScreenInit(pScreen, pbits, xsize, ysize, dpix, dpiy, width,
return miScreenDevPrivateInit(pScreen, width, pbits);
}
-static DevPrivateKey privateKey = &privateKey;
+static int privateKeyIndex;
+static DevPrivateKey privateKey = &privateKeyIndex;
-_X_EXPORT DevPrivateKey
+DevPrivateKey
miAllocateGCPrivateIndex()
{
return privateKey;
}
-_X_EXPORT DevPrivateKey miZeroLineScreenKey = &miZeroLineScreenKey;
+static int miZeroLineScreenKeyIndex;
+_X_EXPORT DevPrivateKey miZeroLineScreenKey = &miZeroLineScreenKeyIndex;
_X_EXPORT void
-miSetZeroLineBias(pScreen, bias)
- ScreenPtr pScreen;
- unsigned int bias;
+miSetZeroLineBias(ScreenPtr pScreen, unsigned int bias)
{
dixSetPrivate(&pScreen->devPrivates, miZeroLineScreenKey, (pointer)bias);
}
-
-_X_EXPORT PixmapPtr
-miGetScreenPixmap(pScreen)
- ScreenPtr pScreen;
-{
- return (PixmapPtr)(pScreen->devPrivate);
-}
-
-_X_EXPORT void
-miSetScreenPixmap(pPix)
- PixmapPtr pPix;
-{
- if (pPix)
- pPix->drawable.pScreen->devPrivate = (pointer)pPix;
-}
diff --git a/xorg-server/mi/mispans.c b/xorg-server/mi/mispans.c
index 6f30155f5..e59d711ae 100644
--- a/xorg-server/mi/mispans.c
+++ b/xorg-server/mi/mispans.c
@@ -180,11 +180,8 @@ static void miSubtractSpans (SpanGroup *spanGroup, Spans *sub)
}
}
}
-
-void miAppendSpans(spanGroup, otherGroup, spans)
- SpanGroup *spanGroup;
- SpanGroup *otherGroup;
- Spans *spans;
+
+void miAppendSpans(SpanGroup *spanGroup, SpanGroup *otherGroup, Spans *spans)
{
int ymin, ymax;
int spansCount;
@@ -217,8 +214,7 @@ void miAppendSpans(spanGroup, otherGroup, spans)
}
} /* AppendSpans */
-void miFreeSpanGroup(spanGroup)
- SpanGroup *spanGroup;
+void miFreeSpanGroup(SpanGroup *spanGroup)
{
if (spanGroup->group != NULL) xfree(spanGroup->group);
}
@@ -376,10 +372,7 @@ miDisposeSpanGroup (SpanGroup *spanGroup)
}
}
-void miFillUniqueSpanGroup(pDraw, pGC, spanGroup)
- DrawablePtr pDraw;
- GCPtr pGC;
- SpanGroup *spanGroup;
+void miFillUniqueSpanGroup(DrawablePtr pDraw, GCPtr pGC, SpanGroup *spanGroup)
{
int i;
Spans *spans;
diff --git a/xorg-server/mi/misprite.c b/xorg-server/mi/misprite.c
index 0af3368b6..692e6c97a 100644
--- a/xorg-server/mi/misprite.c
+++ b/xorg-server/mi/misprite.c
@@ -4,7 +4,6 @@
* machine independent software sprite routines
*/
-
/*
Copyright 1989, 1998 The Open Group
@@ -50,12 +49,15 @@ in this Software without prior written authorization from The Open Group.
# include "mispritest.h"
# include "dixfontstr.h"
# include <X11/fonts/fontstruct.h>
+# include "inputstr.h"
#ifdef RENDER
# include "mipict.h"
#endif
# include "damage.h"
+
+
#define SPRITE_DEBUG_ENABLE 0
#if SPRITE_DEBUG_ENABLE
#define SPRITE_DEBUG(x) ErrorF x
@@ -63,11 +65,54 @@ in this Software without prior written authorization from The Open Group.
#define SPRITE_DEBUG(x)
#endif
+
+#define MISPRITE(dev) \
+ ((DevHasCursor(dev)) ? \
+ (miCursorInfoPtr)dixLookupPrivate(&dev->devPrivates, miSpriteDevPrivatesKey) : \
+ (miCursorInfoPtr)dixLookupPrivate(&dev->u.master->devPrivates, miSpriteDevPrivatesKey))
+
+static int damageRegister = 0;
+
+static void
+miSpriteDisableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
+{
+ if (damageRegister) {
+ DamageUnregister (&(pScreen->GetScreenPixmap(pScreen)->drawable),
+ pScreenPriv->pDamage);
+ damageRegister = 0;
+ }
+}
+
+static void
+miSpriteEnableDamage(ScreenPtr pScreen, miSpriteScreenPtr pScreenPriv)
+{
+ if (!damageRegister) {
+ damageRegister = 1;
+ DamageRegister (&(pScreen->GetScreenPixmap(pScreen)->drawable),
+ pScreenPriv->pDamage);
+ }
+}
+
+static void
+miSpriteIsUp(miCursorInfoPtr pDevCursor)
+{
+ pDevCursor->isUp = TRUE;
+}
+
+static void
+miSpriteIsDown(miCursorInfoPtr pDevCursor)
+{
+ pDevCursor->isUp = FALSE;
+}
+
/*
* screen wrappers
*/
-static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKey;
+static int miSpriteScreenKeyIndex;
+static DevPrivateKey miSpriteScreenKey = &miSpriteScreenKeyIndex;
+static int mmiSpriteDevPrivatesKeyIndex;
+static DevPrivateKey miSpriteDevPrivatesKey = &mmiSpriteDevPrivatesKeyIndex;
static Bool miSpriteCloseScreen(int i, ScreenPtr pScreen);
static void miSpriteGetImage(DrawablePtr pDrawable, int sx, int sy,
@@ -88,7 +133,13 @@ static void miSpriteInstallColormap(ColormapPtr pMap);
static void miSpriteStoreColors(ColormapPtr pMap, int ndef,
xColorItem *pdef);
-static void miSpriteComputeSaved(ScreenPtr pScreen);
+static void miSpriteComputeSaved(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
+
+static Bool miSpriteDeviceCursorInitialize(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
+static void miSpriteDeviceCursorCleanup(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
#define SCREEN_PROLOGUE(pScreen, field) ((pScreen)->field = \
((miSpriteScreenPtr)dixLookupPrivate(&(pScreen)->devPrivates, \
@@ -100,39 +151,61 @@ static void miSpriteComputeSaved(ScreenPtr pScreen);
* pointer-sprite method table
*/
-static Bool miSpriteRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-static Bool miSpriteUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor);
-static void miSpriteSetCursor(ScreenPtr pScreen, CursorPtr pCursor,
- int x, int y);
-static void miSpriteMoveCursor(ScreenPtr pScreen, int x, int y);
+static Bool miSpriteRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static Bool miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor);
+static void miSpriteSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, int x, int y);
+static void miSpriteMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen,
+ int x, int y);
_X_EXPORT miPointerSpriteFuncRec miSpritePointerFuncs = {
miSpriteRealizeCursor,
miSpriteUnrealizeCursor,
miSpriteSetCursor,
miSpriteMoveCursor,
+ miSpriteDeviceCursorInitialize,
+ miSpriteDeviceCursorCleanup,
};
/*
* other misc functions
*/
-static void miSpriteRemoveCursor(ScreenPtr pScreen);
-static void miSpriteRestoreCursor(ScreenPtr pScreen);
+static void miSpriteRemoveCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
+static void miSpriteSaveUnderCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
+static void miSpriteRestoreCursor(DeviceIntPtr pDev,
+ ScreenPtr pScreen);
static void
miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
{
ScreenPtr pScreen = closure;
miSpriteScreenPtr pScreenPriv;
-
+ miCursorInfoPtr pCursorInfo;
+ DeviceIntPtr pDev;
+
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- if (pScreenPriv->isUp &&
- RECT_IN_REGION (pScreen, pRegion, &pScreenPriv->saved) != rgnOUT)
+
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- SPRITE_DEBUG(("Damage remove\n"));
- miSpriteRemoveCursor (pScreen);
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+
+ if (pCursorInfo->isUp &&
+ pCursorInfo->pScreen == pScreen &&
+ RECT_IN_REGION (pScreen, pRegion, &pCursorInfo->saved)
+ != rgnOUT)
+ {
+ SPRITE_DEBUG(("Damage remove\n"));
+ miSpriteRemoveCursor (pDev, pScreen);
+ }
+ }
}
}
@@ -143,21 +216,20 @@ miSpriteReportDamage (DamagePtr pDamage, RegionPtr pRegion, void *closure)
*/
Bool
-miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
- ScreenPtr pScreen;
- miSpriteCursorFuncPtr cursorFuncs;
- miPointerScreenFuncPtr screenFuncs;
+miSpriteInitialize (ScreenPtr pScreen,
+ miSpriteCursorFuncPtr cursorFuncs,
+ miPointerScreenFuncPtr screenFuncs)
{
miSpriteScreenPtr pScreenPriv;
VisualPtr pVisual;
-
+
if (!DamageSetup (pScreen))
return FALSE;
pScreenPriv = (miSpriteScreenPtr) xalloc (sizeof (miSpriteScreenRec));
if (!pScreenPriv)
return FALSE;
-
+
pScreenPriv->pDamage = DamageCreate (miSpriteReportDamage,
(DamageDestroyFunc) 0,
DamageReportRawRegion,
@@ -181,20 +253,15 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pScreenPriv->SourceValidate = pScreen->SourceValidate;
pScreenPriv->CopyWindow = pScreen->CopyWindow;
-
+
pScreenPriv->InstallColormap = pScreen->InstallColormap;
pScreenPriv->StoreColors = pScreen->StoreColors;
-
+
pScreenPriv->BlockHandler = pScreen->BlockHandler;
-
- pScreenPriv->pCursor = NULL;
- pScreenPriv->x = 0;
- pScreenPriv->y = 0;
- pScreenPriv->isUp = FALSE;
- pScreenPriv->shouldBeUp = FALSE;
- pScreenPriv->pCacheWin = NullWindow;
- pScreenPriv->isInCacheWin = FALSE;
- pScreenPriv->checkPixels = TRUE;
+
+ pScreenPriv->DeviceCursorInitialize = pScreen->DeviceCursorInitialize;
+ pScreenPriv->DeviceCursorCleanup = pScreen->DeviceCursorCleanup;
+
pScreenPriv->pInstalledMap = NULL;
pScreenPriv->pColormap = NULL;
pScreenPriv->funcs = cursorFuncs;
@@ -205,19 +272,20 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
pScreenPriv->colors[MASK_COLOR].green = 0;
pScreenPriv->colors[MASK_COLOR].blue = 0;
dixSetPrivate(&pScreen->devPrivates, miSpriteScreenKey, pScreenPriv);
-
+
pScreen->CloseScreen = miSpriteCloseScreen;
pScreen->GetImage = miSpriteGetImage;
pScreen->GetSpans = miSpriteGetSpans;
pScreen->SourceValidate = miSpriteSourceValidate;
-
+
pScreen->CopyWindow = miSpriteCopyWindow;
-
pScreen->InstallColormap = miSpriteInstallColormap;
pScreen->StoreColors = miSpriteStoreColors;
pScreen->BlockHandler = miSpriteBlockHandler;
-
+
+ damageRegister = 0;
+
return TRUE;
}
@@ -231,9 +299,7 @@ miSpriteInitialize (pScreen, cursorFuncs, screenFuncs)
*/
static Bool
-miSpriteCloseScreen (i, pScreen)
- int i;
- ScreenPtr pScreen;
+miSpriteCloseScreen (int i, ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv;
@@ -247,35 +313,42 @@ miSpriteCloseScreen (i, pScreen)
pScreen->InstallColormap = pScreenPriv->InstallColormap;
pScreen->StoreColors = pScreenPriv->StoreColors;
- miSpriteIsUpFALSE (pScreen, pScreenPriv);
DamageDestroy (pScreenPriv->pDamage);
-
+
xfree ((pointer) pScreenPriv);
return (*pScreen->CloseScreen) (i, pScreen);
}
static void
-miSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
- DrawablePtr pDrawable;
- int sx, sy, w, h;
- unsigned int format;
- unsigned long planemask;
- char *pdstLine;
+miSpriteGetImage (DrawablePtr pDrawable, int sx, int sy, int w, int h,
+ unsigned int format, unsigned long planemask,
+ char *pdstLine)
{
ScreenPtr pScreen = pDrawable->pScreen;
miSpriteScreenPtr pScreenPriv;
-
+ DeviceIntPtr pDev = inputInfo.pointer;
+ miCursorInfoPtr pCursorInfo;
+
SCREEN_PROLOGUE (pScreen, GetImage);
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- if (pDrawable->type == DRAWABLE_WINDOW &&
- pScreenPriv->isUp &&
- ORG_OVERLAP(&pScreenPriv->saved,pDrawable->x,pDrawable->y, sx, sy, w, h))
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- SPRITE_DEBUG (("GetImage remove\n"));
- miSpriteRemoveCursor (pScreen);
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ if (pDrawable->type == DRAWABLE_WINDOW &&
+ pCursorInfo->isUp &&
+ pCursorInfo->pScreen == pScreen &&
+ ORG_OVERLAP(&pCursorInfo->saved,pDrawable->x,pDrawable->y,
+ sx, sy, w, h))
+ {
+ SPRITE_DEBUG (("GetImage remove\n"));
+ miSpriteRemoveCursor (pDev, pScreen);
+ }
+ }
}
(*pScreen->GetImage) (pDrawable, sx, sy, w, h,
@@ -285,44 +358,52 @@ miSpriteGetImage (pDrawable, sx, sy, w, h, format, planemask, pdstLine)
}
static void
-miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
- DrawablePtr pDrawable;
- int wMax;
- DDXPointPtr ppt;
- int *pwidth;
- int nspans;
- char *pdstStart;
+miSpriteGetSpans (DrawablePtr pDrawable, int wMax, DDXPointPtr ppt,
+ int *pwidth, int nspans, char *pdstStart)
{
ScreenPtr pScreen = pDrawable->pScreen;
miSpriteScreenPtr pScreenPriv;
-
+ DeviceIntPtr pDev = inputInfo.pointer;
+ miCursorInfoPtr pCursorInfo;
+
SCREEN_PROLOGUE (pScreen, GetSpans);
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp)
+
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- DDXPointPtr pts;
- int *widths;
- int nPts;
- int xorg,
- yorg;
-
- xorg = pDrawable->x;
- yorg = pDrawable->y;
-
- for (pts = ppt, widths = pwidth, nPts = nspans;
- nPts--;
- pts++, widths++)
- {
- if (SPN_OVERLAP(&pScreenPriv->saved,pts->y+yorg,
- pts->x+xorg,*widths))
- {
- SPRITE_DEBUG (("GetSpans remove\n"));
- miSpriteRemoveCursor (pScreen);
- break;
- }
- }
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+
+ if (pDrawable->type == DRAWABLE_WINDOW &&
+ pCursorInfo->isUp &&
+ pCursorInfo->pScreen == pScreen)
+ {
+ DDXPointPtr pts;
+ int *widths;
+ int nPts;
+ int xorg,
+ yorg;
+
+ xorg = pDrawable->x;
+ yorg = pDrawable->y;
+
+ for (pts = ppt, widths = pwidth, nPts = nspans;
+ nPts--;
+ pts++, widths++)
+ {
+ if (SPN_OVERLAP(&pCursorInfo->saved,pts->y+yorg,
+ pts->x+xorg,*widths))
+ {
+ SPRITE_DEBUG (("GetSpans remove\n"));
+ miSpriteRemoveCursor (pDev, pScreen);
+ break;
+ }
+ }
+ }
+ }
}
(*pScreen->GetSpans) (pDrawable, wMax, ppt, pwidth, nspans, pdstStart);
@@ -331,23 +412,33 @@ miSpriteGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart)
}
static void
-miSpriteSourceValidate (pDrawable, x, y, width, height)
- DrawablePtr pDrawable;
- int x, y, width, height;
+miSpriteSourceValidate (DrawablePtr pDrawable, int x, int y, int width,
+ int height)
{
ScreenPtr pScreen = pDrawable->pScreen;
miSpriteScreenPtr pScreenPriv;
-
+ DeviceIntPtr pDev = inputInfo.pointer;
+ miCursorInfoPtr pCursorInfo;
+
SCREEN_PROLOGUE (pScreen, SourceValidate);
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- if (pDrawable->type == DRAWABLE_WINDOW && pScreenPriv->isUp &&
- ORG_OVERLAP(&pScreenPriv->saved, pDrawable->x, pDrawable->y,
- x, y, width, height))
+
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- SPRITE_DEBUG (("SourceValidate remove\n"));
- miSpriteRemoveCursor (pScreen);
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ if (pDrawable->type == DRAWABLE_WINDOW && pCursorInfo->isUp &&
+ pCursorInfo->pScreen == pScreen &&
+ ORG_OVERLAP(&pCursorInfo->saved, pDrawable->x, pDrawable->y,
+ x, y, width, height))
+ {
+ SPRITE_DEBUG (("SourceValidate remove\n"));
+ miSpriteRemoveCursor (pDev, pScreen);
+ }
+ }
}
if (pScreen->SourceValidate)
@@ -361,19 +452,29 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
{
ScreenPtr pScreen = pWindow->drawable.pScreen;
miSpriteScreenPtr pScreenPriv;
-
+ DeviceIntPtr pDev = inputInfo.pointer;
+ miCursorInfoPtr pCursorInfo;
+
SCREEN_PROLOGUE (pScreen, CopyWindow);
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- /*
- * Damage will take care of destination check
- */
- if (pScreenPriv->isUp &&
- RECT_IN_REGION (pScreen, prgnSrc, &pScreenPriv->saved) != rgnOUT)
+
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- SPRITE_DEBUG (("CopyWindow remove\n"));
- miSpriteRemoveCursor (pScreen);
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ /*
+ * Damage will take care of destination check
+ */
+ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen &&
+ RECT_IN_REGION (pScreen, prgnSrc, &pCursorInfo->saved) != rgnOUT)
+ {
+ SPRITE_DEBUG (("CopyWindow remove\n"));
+ miSpriteRemoveCursor (pDev, pScreen);
+ }
+ }
}
(*pScreen->CopyWindow) (pWindow, ptOldOrg, prgnSrc);
@@ -381,33 +482,54 @@ miSpriteCopyWindow (WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
}
static void
-miSpriteBlockHandler (i, blockData, pTimeout, pReadmask)
- int i;
- pointer blockData;
- pointer pTimeout;
- pointer pReadmask;
+miSpriteBlockHandler (int i, pointer blockData, pointer pTimeout,
+ pointer pReadmask)
{
ScreenPtr pScreen = screenInfo.screens[i];
miSpriteScreenPtr pPriv;
+ DeviceIntPtr pDev = inputInfo.pointer;
+ miCursorInfoPtr pCursorInfo;
pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
SCREEN_PROLOGUE(pScreen, BlockHandler);
-
+
(*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask);
SCREEN_EPILOGUE(pScreen, BlockHandler);
- if (!pPriv->isUp && pPriv->shouldBeUp)
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
{
- SPRITE_DEBUG (("BlockHandler restore\n"));
- miSpriteRestoreCursor (pScreen);
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ if (pCursorInfo && !pCursorInfo->isUp
+ && pCursorInfo->pScreen == pScreen
+ && pCursorInfo->shouldBeUp)
+ {
+ SPRITE_DEBUG (("BlockHandler restore\n"));
+ miSpriteSaveUnderCursor (pDev, pScreen);
+ }
+ }
+ }
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ {
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ if (pCursorInfo && !pCursorInfo->isUp &&
+ pCursorInfo->pScreen == pScreen &&
+ pCursorInfo->shouldBeUp)
+ {
+ SPRITE_DEBUG (("BlockHandler restore\n"));
+ miSpriteRestoreCursor (pDev, pScreen);
+ }
+ }
}
}
static void
-miSpriteInstallColormap (pMap)
- ColormapPtr pMap;
+miSpriteInstallColormap (ColormapPtr pMap)
{
ScreenPtr pScreen = pMap->pScreen;
miSpriteScreenPtr pPriv;
@@ -415,105 +537,124 @@ miSpriteInstallColormap (pMap)
pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
SCREEN_PROLOGUE(pScreen, InstallColormap);
-
+
(*pScreen->InstallColormap) (pMap);
SCREEN_EPILOGUE(pScreen, InstallColormap);
+ /* InstallColormap can be called before devices are initialized. */
pPriv->pInstalledMap = pMap;
if (pPriv->pColormap != pMap)
{
- pPriv->checkPixels = TRUE;
- if (pPriv->isUp)
- miSpriteRemoveCursor (pScreen);
+ DeviceIntPtr pDev;
+ miCursorInfoPtr pCursorInfo;
+ for (pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ {
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ pCursorInfo->checkPixels = TRUE;
+ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
+ miSpriteRemoveCursor(pDev, pScreen);
+ }
+ }
+
}
}
static void
-miSpriteStoreColors (pMap, ndef, pdef)
- ColormapPtr pMap;
- int ndef;
- xColorItem *pdef;
+miSpriteStoreColors (ColormapPtr pMap, int ndef, xColorItem *pdef)
{
ScreenPtr pScreen = pMap->pScreen;
miSpriteScreenPtr pPriv;
int i;
int updated;
VisualPtr pVisual;
+ DeviceIntPtr pDev = inputInfo.pointer;
+ miCursorInfoPtr pCursorInfo;
pPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
SCREEN_PROLOGUE(pScreen, StoreColors);
-
+
(*pScreen->StoreColors) (pMap, ndef, pdef);
SCREEN_EPILOGUE(pScreen, StoreColors);
if (pPriv->pColormap == pMap)
{
- updated = 0;
- pVisual = pMap->pVisual;
- if (pVisual->class == DirectColor)
- {
- /* Direct color - match on any of the subfields */
+ updated = 0;
+ pVisual = pMap->pVisual;
+ if (pVisual->class == DirectColor)
+ {
+ /* Direct color - match on any of the subfields */
#define MaskMatch(a,b,mask) (((a) & (pVisual->mask)) == ((b) & (pVisual->mask)))
-#define UpdateDAC(plane,dac,mask) {\
- if (MaskMatch (pPriv->colors[plane].pixel,pdef[i].pixel,mask)) {\
- pPriv->colors[plane].dac = pdef[i].dac; \
+#define UpdateDAC(dev, plane,dac,mask) {\
+ if (MaskMatch (dev->colors[plane].pixel,pdef[i].pixel,mask)) {\
+ dev->colors[plane].dac = pdef[i].dac; \
updated = 1; \
} \
}
-#define CheckDirect(plane) \
- UpdateDAC(plane,red,redMask) \
- UpdateDAC(plane,green,greenMask) \
- UpdateDAC(plane,blue,blueMask)
-
- for (i = 0; i < ndef; i++)
- {
- CheckDirect (SOURCE_COLOR)
- CheckDirect (MASK_COLOR)
- }
- }
- else
- {
- /* PseudoColor/GrayScale - match on exact pixel */
- for (i = 0; i < ndef; i++)
- {
- if (pdef[i].pixel == pPriv->colors[SOURCE_COLOR].pixel)
- {
- pPriv->colors[SOURCE_COLOR] = pdef[i];
- if (++updated == 2)
- break;
- }
- if (pdef[i].pixel == pPriv->colors[MASK_COLOR].pixel)
- {
- pPriv->colors[MASK_COLOR] = pdef[i];
- if (++updated == 2)
- break;
- }
- }
- }
- if (updated)
- {
- pPriv->checkPixels = TRUE;
- if (pPriv->isUp)
- miSpriteRemoveCursor (pScreen);
- }
+#define CheckDirect(dev, plane) \
+ UpdateDAC(dev, plane,red,redMask) \
+ UpdateDAC(dev, plane,green,greenMask) \
+ UpdateDAC(dev, plane,blue,blueMask)
+
+ for (i = 0; i < ndef; i++)
+ {
+ CheckDirect (pPriv, SOURCE_COLOR)
+ CheckDirect (pPriv, MASK_COLOR)
+ }
+ }
+ else
+ {
+ /* PseudoColor/GrayScale - match on exact pixel */
+ for (i = 0; i < ndef; i++)
+ {
+ if (pdef[i].pixel ==
+ pPriv->colors[SOURCE_COLOR].pixel)
+ {
+ pPriv->colors[SOURCE_COLOR] = pdef[i];
+ if (++updated == 2)
+ break;
+ }
+ if (pdef[i].pixel ==
+ pPriv->colors[MASK_COLOR].pixel)
+ {
+ pPriv->colors[MASK_COLOR] = pdef[i];
+ if (++updated == 2)
+ break;
+ }
+ }
+ }
+ if (updated)
+ {
+ for(pDev = inputInfo.devices; pDev; pDev = pDev->next)
+ {
+ if (DevHasCursor(pDev))
+ {
+ pCursorInfo = MISPRITE(pDev);
+ pCursorInfo->checkPixels = TRUE;
+ if (pCursorInfo->isUp && pCursorInfo->pScreen == pScreen)
+ miSpriteRemoveCursor (pDev, pScreen);
+ }
+ }
+ }
}
}
static void
-miSpriteFindColors (ScreenPtr pScreen)
+miSpriteFindColors (miCursorInfoPtr pDevCursor, ScreenPtr pScreen)
{
- miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
+ miSpriteScreenPtr pScreenPriv = (miSpriteScreenPtr)
dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
CursorPtr pCursor;
xColorItem *sourceColor, *maskColor;
- pCursor = pScreenPriv->pCursor;
+ pCursor = pDevCursor->pCursor;
sourceColor = &pScreenPriv->colors[SOURCE_COLOR];
maskColor = &pScreenPriv->colors[MASK_COLOR];
if (pScreenPriv->pColormap != pScreenPriv->pInstalledMap ||
@@ -537,7 +678,9 @@ miSpriteFindColors (ScreenPtr pScreen)
FakeFreeColor(pScreenPriv->pColormap, sourceColor->pixel);
FakeFreeColor(pScreenPriv->pColormap, maskColor->pixel);
}
- pScreenPriv->checkPixels = FALSE;
+
+ pDevCursor->checkPixels = FALSE;
+
}
/*
@@ -547,23 +690,28 @@ miSpriteFindColors (ScreenPtr pScreen)
#define SPRITE_PAD 8
static Bool
-miSpriteRealizeCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miSpriteRealizeCursor (DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
miSpriteScreenPtr pScreenPriv;
+ miCursorInfoPtr pCursorInfo;
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- if (pCursor == pScreenPriv->pCursor)
- pScreenPriv->checkPixels = TRUE;
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteRealizeCursor called for floating device.\n");
+ return FALSE;
+ }
+ pCursorInfo = MISPRITE(pDev);
+
+ if (pCursor == pCursorInfo->pCursor)
+ pCursorInfo->checkPixels = TRUE;
+
return (*pScreenPriv->funcs->RealizeCursor) (pScreen, pCursor);
}
static Bool
-miSpriteUnrealizeCursor (pScreen, pCursor)
- ScreenPtr pScreen;
- CursorPtr pCursor;
+miSpriteUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor)
{
miSpriteScreenPtr pScreenPriv;
@@ -573,118 +721,189 @@ miSpriteUnrealizeCursor (pScreen, pCursor)
}
static void
-miSpriteSetCursor (pScreen, pCursor, x, y)
- ScreenPtr pScreen;
- CursorPtr pCursor;
- int x;
- int y;
+miSpriteSetCursor (DeviceIntPtr pDev, ScreenPtr pScreen,
+ CursorPtr pCursor, int x, int y)
{
miSpriteScreenPtr pScreenPriv;
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
+ miCursorInfoPtr pPointer;
+
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteSetCursor called for floating device.\n");
+ return;
+ }
+ pPointer = MISPRITE(pDev);
+
if (!pCursor)
{
- pScreenPriv->shouldBeUp = FALSE;
- if (pScreenPriv->isUp)
- miSpriteRemoveCursor (pScreen);
- pScreenPriv->pCursor = 0;
+ pPointer->shouldBeUp = FALSE;
+ if (pPointer->isUp)
+ miSpriteRemoveCursor (pDev, pScreen);
+ pPointer->pCursor = 0;
return;
}
- pScreenPriv->shouldBeUp = TRUE;
- if (pScreenPriv->x == x &&
- pScreenPriv->y == y &&
- pScreenPriv->pCursor == pCursor &&
- !pScreenPriv->checkPixels)
+ pPointer->shouldBeUp = TRUE;
+ if (pPointer->x == x &&
+ pPointer->y == y &&
+ pPointer->pCursor == pCursor &&
+ !pPointer->checkPixels)
{
return;
}
- pScreenPriv->x = x;
- pScreenPriv->y = y;
- pScreenPriv->pCacheWin = NullWindow;
- if (pScreenPriv->checkPixels || pScreenPriv->pCursor != pCursor)
+ pPointer->x = x;
+ pPointer->y = y;
+ pPointer->pCacheWin = NullWindow;
+ if (pPointer->checkPixels || pPointer->pCursor != pCursor)
{
- pScreenPriv->pCursor = pCursor;
- miSpriteFindColors (pScreen);
+ pPointer->pCursor = pCursor;
+ miSpriteFindColors (pPointer, pScreen);
}
- if (pScreenPriv->isUp) {
+ if (pPointer->isUp) {
+#if 0
+ /* FIXME: Disabled for MPX, should be rewritten */
int sx, sy;
/*
* check to see if the old saved region
* encloses the new sprite, in which case we use
* the flicker-free MoveCursor primitive.
*/
- sx = pScreenPriv->x - (int)pCursor->bits->xhot;
- sy = pScreenPriv->y - (int)pCursor->bits->yhot;
- if (sx + (int) pCursor->bits->width >= pScreenPriv->saved.x1 &&
- sx < pScreenPriv->saved.x2 &&
- sy + (int) pCursor->bits->height >= pScreenPriv->saved.y1 &&
- sy < pScreenPriv->saved.y2 &&
+ sx = pointer->x - (int)pCursor->bits->xhot;
+ sy = pointer->y - (int)pCursor->bits->yhot;
+ if (sx + (int) pCursor->bits->width >= pointer->saved.x1 &&
+ sx < pointer->saved.x2 &&
+ sy + (int) pCursor->bits->height >= pointer->saved.y1 &&
+ sy < pointer->saved.y2 &&
(int) pCursor->bits->width + (2 * SPRITE_PAD) ==
- pScreenPriv->saved.x2 - pScreenPriv->saved.x1 &&
+ pointer->saved.x2 - pointer->saved.x1 &&
(int) pCursor->bits->height + (2 * SPRITE_PAD) ==
- pScreenPriv->saved.y2 - pScreenPriv->saved.y1
+ pointer->saved.y2 - pointer->saved.y1
)
{
DamageDrawInternal (pScreen, TRUE);
- miSpriteIsUpFALSE (pScreen, pScreenPriv);
- if (!(sx >= pScreenPriv->saved.x1 &&
- sx + (int)pCursor->bits->width < pScreenPriv->saved.x2 &&
- sy >= pScreenPriv->saved.y1 &&
- sy + (int)pCursor->bits->height < pScreenPriv->saved.y2))
- {
+ miSpriteIsDown(pCursorInfo);
+ if (!(sx >= pointer->saved.x1 &&
+ sx + (int)pCursor->bits->width < pointer->saved.x2
+ && sy >= pointer->saved.y1 &&
+ sy + (int)pCursor->bits->height <
+ pointer->saved.y2))
+ {
int oldx1, oldy1, dx, dy;
- oldx1 = pScreenPriv->saved.x1;
- oldy1 = pScreenPriv->saved.y1;
+ oldx1 = pointer->saved.x1;
+ oldy1 = pointer->saved.y1;
dx = oldx1 - (sx - SPRITE_PAD);
dy = oldy1 - (sy - SPRITE_PAD);
- pScreenPriv->saved.x1 -= dx;
- pScreenPriv->saved.y1 -= dy;
- pScreenPriv->saved.x2 -= dx;
- pScreenPriv->saved.y2 -= dy;
+ pointer->saved.x1 -= dx;
+ pointer->saved.y1 -= dy;
+ pointer->saved.x2 -= dx;
+ pointer->saved.y2 -= dy;
(void) (*pScreenPriv->funcs->ChangeSave) (pScreen,
- pScreenPriv->saved.x1,
- pScreenPriv->saved.y1,
- pScreenPriv->saved.x2 - pScreenPriv->saved.x1,
- pScreenPriv->saved.y2 - pScreenPriv->saved.y1,
+ pointer->saved.x1,
+ pointer->saved.y1,
+ pointer->saved.x2 -
+ pointer->saved.x1,
+ pointer->saved.y2 -
+ pointer->saved.y1,
dx, dy);
}
(void) (*pScreenPriv->funcs->MoveCursor) (pScreen, pCursor,
- pScreenPriv->saved.x1,
- pScreenPriv->saved.y1,
- pScreenPriv->saved.x2 - pScreenPriv->saved.x1,
- pScreenPriv->saved.y2 - pScreenPriv->saved.y1,
- sx - pScreenPriv->saved.x1,
- sy - pScreenPriv->saved.y1,
- pScreenPriv->colors[SOURCE_COLOR].pixel,
- pScreenPriv->colors[MASK_COLOR].pixel);
- miSpriteIsUpTRUE (pScreen, pScreenPriv);
+ pointer->saved.x1,
+ pointer->saved.y1,
+ pointer->saved.x2 -
+ pointer->saved.x1,
+ pointer->saved.y2 -
+ pointer->saved.y1,
+ sx - pointer->saved.x1,
+ sy - pointer->saved.y1,
+ pointer->colors[SOURCE_COLOR].pixel,
+ pointer->colors[MASK_COLOR].pixel);
+ miSpriteIsUp(pCursorInfo);
DamageDrawInternal (pScreen, FALSE);
}
else
+#endif
{
- SPRITE_DEBUG (("SetCursor remove\n"));
- miSpriteRemoveCursor (pScreen);
+ SPRITE_DEBUG (("SetCursor remove %d\n", pDev->id));
+ miSpriteRemoveCursor (pDev, pScreen);
}
}
- if (!pScreenPriv->isUp && pScreenPriv->pCursor)
+
+ if (!pPointer->isUp && pPointer->pCursor)
{
- SPRITE_DEBUG (("SetCursor restore\n"));
- miSpriteRestoreCursor (pScreen);
+ SPRITE_DEBUG (("SetCursor restore %d\n", pDev->id));
+ miSpriteSaveUnderCursor(pDev, pScreen);
+ miSpriteRestoreCursor (pDev, pScreen);
}
+
}
static void
-miSpriteMoveCursor (pScreen, x, y)
- ScreenPtr pScreen;
- int x, y;
+miSpriteMoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
{
miSpriteScreenPtr pScreenPriv;
+ CursorPtr pCursor;
+
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteMoveCursor called for floating device.\n");
+ return;
+ }
+ pCursor = MISPRITE(pDev)->pCursor;
+
+ miSpriteSetCursor (pDev, pScreen, pCursor, x, y);
+}
+
+
+static Bool
+miSpriteDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ miSpriteScreenPtr pScreenPriv;
+ miCursorInfoPtr pCursorInfo;
+ int ret = FALSE;
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- miSpriteSetCursor (pScreen, pScreenPriv->pCursor, x, y);
+
+ pCursorInfo = xalloc(sizeof(miCursorInfoRec));
+ if (!pCursorInfo)
+ return FALSE;
+
+ pCursorInfo->pCursor = NULL;
+ pCursorInfo->x = 0;
+ pCursorInfo->y = 0;
+ pCursorInfo->isUp = FALSE;
+ pCursorInfo->shouldBeUp = FALSE;
+ pCursorInfo->pCacheWin = NullWindow;
+ pCursorInfo->isInCacheWin = FALSE;
+ pCursorInfo->checkPixels = TRUE;
+ pCursorInfo->pScreen = FALSE;
+
+ ret = (*pScreenPriv->funcs->DeviceCursorInitialize)(pDev, pScreen);
+ if (!ret)
+ {
+ xfree(pCursorInfo);
+ pCursorInfo = NULL;
+ }
+ dixSetPrivate(&pDev->devPrivates, miSpriteDevPrivatesKey, pCursorInfo);
+ return ret;
+}
+
+static void
+miSpriteDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ if (DevHasCursor(pDev))
+ {
+ miSpriteScreenPtr pScreenPriv;
+ pScreenPriv = (miSpriteScreenPtr)
+ dixLookupPrivate(&pScreen->devPrivates, miSpriteScreenKey);
+
+ (*pScreenPriv->funcs->DeviceCursorCleanup)(pDev, pScreen);
+ }
}
/*
@@ -692,62 +911,126 @@ miSpriteMoveCursor (pScreen, x, y)
*/
static void
-miSpriteRemoveCursor (pScreen)
- ScreenPtr pScreen;
+miSpriteRemoveCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv;
+ miCursorInfoPtr pCursorInfo;
+
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteRemoveCursor called for floating device.\n");
+ return;
+ }
DamageDrawInternal (pScreen, TRUE);
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- miSpriteIsUpFALSE (pScreen, pScreenPriv);
- pScreenPriv->pCacheWin = NullWindow;
- if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pScreen,
- pScreenPriv->saved.x1,
- pScreenPriv->saved.y1,
- pScreenPriv->saved.x2 - pScreenPriv->saved.x1,
- pScreenPriv->saved.y2 - pScreenPriv->saved.y1))
+ pCursorInfo = MISPRITE(pDev);
+
+ miSpriteIsDown(pCursorInfo);
+ pCursorInfo->pCacheWin = NullWindow;
+ miSpriteDisableDamage(pScreen, pScreenPriv);
+ if (!(*pScreenPriv->funcs->RestoreUnderCursor) (pDev,
+ pScreen,
+ pCursorInfo->saved.x1,
+ pCursorInfo->saved.y1,
+ pCursorInfo->saved.x2 -
+ pCursorInfo->saved.x1,
+ pCursorInfo->saved.y2 -
+ pCursorInfo->saved.y1))
{
- miSpriteIsUpTRUE (pScreen, pScreenPriv);
+ miSpriteIsUp(pCursorInfo);
}
+ miSpriteEnableDamage(pScreen, pScreenPriv);
DamageDrawInternal (pScreen, FALSE);
}
/*
+ * Called from the block handler, saves area under cursor
+ * before waiting for something to do.
+ */
+
+static void
+miSpriteSaveUnderCursor(DeviceIntPtr pDev, ScreenPtr pScreen)
+{
+ miSpriteScreenPtr pScreenPriv;
+ int x, y;
+ CursorPtr pCursor;
+ miCursorInfoPtr pCursorInfo;
+
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteSaveUnderCursor called for floating device.\n");
+ return;
+ }
+ DamageDrawInternal (pScreen, TRUE);
+ pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
+ miSpriteScreenKey);
+ pCursorInfo = MISPRITE(pDev);
+
+ miSpriteComputeSaved (pDev, pScreen);
+ pCursor = pCursorInfo->pCursor;
+
+ x = pCursorInfo->x - (int)pCursor->bits->xhot;
+ y = pCursorInfo->y - (int)pCursor->bits->yhot;
+ miSpriteDisableDamage(pScreen, pScreenPriv);
+
+ (*pScreenPriv->funcs->SaveUnderCursor) (pDev,
+ pScreen,
+ pCursorInfo->saved.x1,
+ pCursorInfo->saved.y1,
+ pCursorInfo->saved.x2 -
+ pCursorInfo->saved.x1,
+ pCursorInfo->saved.y2 -
+ pCursorInfo->saved.y1);
+ SPRITE_DEBUG(("SaveUnderCursor %d\n", pDev->id));
+ miSpriteEnableDamage(pScreen, pScreenPriv);
+ DamageDrawInternal (pScreen, FALSE);
+}
+
+
+/*
* Called from the block handler, restores the cursor
* before waiting for something to do.
*/
static void
-miSpriteRestoreCursor (pScreen)
- ScreenPtr pScreen;
+miSpriteRestoreCursor (DeviceIntPtr pDev, ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv;
int x, y;
CursorPtr pCursor;
+ miCursorInfoPtr pCursorInfo;
+
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteRestoreCursor called for floating device.\n");
+ return;
+ }
DamageDrawInternal (pScreen, TRUE);
- miSpriteComputeSaved (pScreen);
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- pCursor = pScreenPriv->pCursor;
- x = pScreenPriv->x - (int)pCursor->bits->xhot;
- y = pScreenPriv->y - (int)pCursor->bits->yhot;
- if ((*pScreenPriv->funcs->SaveUnderCursor) (pScreen,
- pScreenPriv->saved.x1,
- pScreenPriv->saved.y1,
- pScreenPriv->saved.x2 - pScreenPriv->saved.x1,
- pScreenPriv->saved.y2 - pScreenPriv->saved.y1))
+ pCursorInfo = MISPRITE(pDev);
+
+ miSpriteComputeSaved (pDev, pScreen);
+ pCursor = pCursorInfo->pCursor;
+
+ x = pCursorInfo->x - (int)pCursor->bits->xhot;
+ y = pCursorInfo->y - (int)pCursor->bits->yhot;
+ miSpriteDisableDamage(pScreen, pScreenPriv);
+ SPRITE_DEBUG(("RestoreCursor %d\n", pDev->id));
+ if (pCursorInfo->checkPixels)
+ miSpriteFindColors (pCursorInfo, pScreen);
+ if ((*pScreenPriv->funcs->PutUpCursor) (pDev, pScreen,
+ pCursor, x, y,
+ pScreenPriv->colors[SOURCE_COLOR].pixel,
+ pScreenPriv->colors[MASK_COLOR].pixel))
{
- if (pScreenPriv->checkPixels)
- miSpriteFindColors (pScreen);
- if ((*pScreenPriv->funcs->PutUpCursor) (pScreen, pCursor, x, y,
- pScreenPriv->colors[SOURCE_COLOR].pixel,
- pScreenPriv->colors[MASK_COLOR].pixel))
- {
- miSpriteIsUpTRUE (pScreen, pScreenPriv);
- }
+ miSpriteIsUp(pCursorInfo);
+ pCursorInfo->pScreen = pScreen;
}
+ miSpriteEnableDamage(pScreen, pScreenPriv);
DamageDrawInternal (pScreen, FALSE);
}
@@ -756,25 +1039,33 @@ miSpriteRestoreCursor (pScreen)
*/
static void
-miSpriteComputeSaved (pScreen)
- ScreenPtr pScreen;
+miSpriteComputeSaved (DeviceIntPtr pDev, ScreenPtr pScreen)
{
miSpriteScreenPtr pScreenPriv;
int x, y, w, h;
int wpad, hpad;
CursorPtr pCursor;
+ miCursorInfoPtr pCursorInfo;
+ if (!pDev->isMaster && !pDev->u.master)
+ {
+ ErrorF("[mi] miSpriteComputeSaved called for floating device.\n");
+ return;
+ }
pScreenPriv = (miSpriteScreenPtr)dixLookupPrivate(&pScreen->devPrivates,
miSpriteScreenKey);
- pCursor = pScreenPriv->pCursor;
- x = pScreenPriv->x - (int)pCursor->bits->xhot;
- y = pScreenPriv->y - (int)pCursor->bits->yhot;
+ pCursorInfo = MISPRITE(pDev);
+
+ pCursor = pCursorInfo->pCursor;
+ x = pCursorInfo->x - (int)pCursor->bits->xhot;
+ y = pCursorInfo->y - (int)pCursor->bits->yhot;
w = pCursor->bits->width;
h = pCursor->bits->height;
wpad = SPRITE_PAD;
hpad = SPRITE_PAD;
- pScreenPriv->saved.x1 = x - wpad;
- pScreenPriv->saved.y1 = y - hpad;
- pScreenPriv->saved.x2 = pScreenPriv->saved.x1 + w + wpad * 2;
- pScreenPriv->saved.y2 = pScreenPriv->saved.y1 + h + hpad * 2;
+ pCursorInfo->saved.x1 = x - wpad;
+ pCursorInfo->saved.y1 = y - hpad;
+ pCursorInfo->saved.x2 = pCursorInfo->saved.x1 + w + wpad * 2;
+ pCursorInfo->saved.y2 = pCursorInfo->saved.y1 + h + hpad * 2;
}
+
diff --git a/xorg-server/mi/misprite.h b/xorg-server/mi/misprite.h
index 5173b7736..72dc06fc7 100644
--- a/xorg-server/mi/misprite.h
+++ b/xorg-server/mi/misprite.h
@@ -42,6 +42,7 @@ typedef struct {
CursorPtr /*pCursor*/
);
Bool (*PutUpCursor)(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/,
int /*x*/,
@@ -50,6 +51,7 @@ typedef struct {
unsigned long /*mask*/
);
Bool (*SaveUnderCursor)(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
@@ -57,6 +59,7 @@ typedef struct {
int /*h*/
);
Bool (*RestoreUnderCursor)(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
@@ -64,6 +67,7 @@ typedef struct {
int /*h*/
);
Bool (*MoveCursor)(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /*pScreen*/,
CursorPtr /*pCursor*/,
int /*x*/,
@@ -76,6 +80,7 @@ typedef struct {
unsigned long /*mask*/
);
Bool (*ChangeSave)(
+ DeviceIntPtr /*pDev*/,
ScreenPtr /*pScreen*/,
int /*x*/,
int /*y*/,
@@ -84,6 +89,14 @@ typedef struct {
int /*dx*/,
int /*dy*/
);
+ Bool (*DeviceCursorInitialize)(
+ DeviceIntPtr /*pDev*/,
+ ScreenPtr /*pScreen*/
+);
+ void (*DeviceCursorCleanup)(
+ DeviceIntPtr /*pDev*/,
+ ScreenPtr /*pScreen*/
+);
} miSpriteCursorFuncRec, *miSpriteCursorFuncPtr;
diff --git a/xorg-server/mi/mispritest.h b/xorg-server/mi/mispritest.h
index e8251ead2..232cdaffe 100644
--- a/xorg-server/mi/mispritest.h
+++ b/xorg-server/mi/mispritest.h
@@ -43,6 +43,19 @@ in this Software without prior written authorization from The Open Group.
#endif
# include "damage.h"
+typedef struct {
+ CursorPtr pCursor;
+ int x; /* cursor hotspot */
+ int y;
+ BoxRec saved; /* saved area from the screen */
+ Bool isUp; /* cursor in frame buffer */
+ Bool shouldBeUp; /* cursor should be displayed */
+ WindowPtr pCacheWin; /* window the cursor last seen in */
+ Bool isInCacheWin;
+ Bool checkPixels; /* check colormap collision */
+ ScreenPtr pScreen;
+} miCursorInfoRec, *miCursorInfoPtr;
+
/*
* per screen information
*/
@@ -63,19 +76,14 @@ typedef struct {
/* os layer procedures */
ScreenBlockHandlerProcPtr BlockHandler;
+
+ /* device cursor procedures */
+ DeviceCursorInitializeProcPtr DeviceCursorInitialize;
+ DeviceCursorCleanupProcPtr DeviceCursorCleanup;
- CursorPtr pCursor;
- int x; /* cursor hotspot */
- int y;
- BoxRec saved; /* saved area from the screen */
- Bool isUp; /* cursor in frame buffer */
- Bool shouldBeUp; /* cursor should be displayed */
- WindowPtr pCacheWin; /* window the cursor last seen in */
- Bool isInCacheWin;
- Bool checkPixels; /* check colormap collision */
xColorItem colors[2];
- ColormapPtr pInstalledMap;
- ColormapPtr pColormap;
+ ColormapPtr pInstalledMap;
+ ColormapPtr pColormap;
VisualPtr pVisual;
miSpriteCursorFuncPtr funcs;
DamagePtr pDamage; /* damage tracking structure */
@@ -84,16 +92,6 @@ typedef struct {
#define SOURCE_COLOR 0
#define MASK_COLOR 1
-#define miSpriteIsUpTRUE(pScreen, pScreenPriv) if (!pScreenPriv->isUp) { \
- pScreenPriv->isUp = TRUE; \
- DamageRegister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
-}
-
-#define miSpriteIsUpFALSE(pScreen, pScreenPriv) if (pScreenPriv->isUp) { \
- DamageUnregister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
- pScreenPriv->isUp = FALSE; \
-}
-
/*
* Overlap BoxPtr and Box elements
*/
diff --git a/xorg-server/mi/mivaltree.c b/xorg-server/mi/mivaltree.c
index d9d07caad..2585422bc 100644
--- a/xorg-server/mi/mivaltree.c
+++ b/xorg-server/mi/mivaltree.c
@@ -103,16 +103,12 @@ Equipment Corporation.
#include "globals.h"
-#ifdef SHAPE
/*
* Compute the visibility of a shaped window
*/
-_X_EXPORT int
-miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
- ScreenPtr pScreen;
- RegionPtr universe, bounding;
- BoxPtr rect;
- int x, y;
+int
+miShapedWindowIn (ScreenPtr pScreen, RegionPtr universe, RegionPtr bounding,
+ BoxPtr rect, int x, int y)
{
BoxRec box;
BoxPtr boundBox;
@@ -166,7 +162,6 @@ miShapedWindowIn (pScreen, universe, bounding, rect, x, y)
return rgnIN;
return rgnOUT;
}
-#endif
static GetRedirectBorderClipProcPtr miGetRedirectBorderClipProc;
static SetRedirectBorderClipProcPtr miSetRedirectBorderClipProc;
@@ -272,7 +267,6 @@ miComputeClips (
break;
case rgnPART:
newVis = VisibilityPartiallyObscured;
-#ifdef SHAPE
{
RegionPtr pBounding;
@@ -292,7 +286,6 @@ miComputeClips (
}
}
}
-#endif
break;
default:
newVis = VisibilityFullyObscured;
@@ -597,11 +590,12 @@ miTreeObscured(
*/
/*ARGSUSED*/
int
-miValidateTree (pParent, pChild, kind)
- WindowPtr pParent; /* Parent to validate */
- WindowPtr pChild; /* First child of pParent that was
+miValidateTree (
+ WindowPtr pParent, /* Parent to validate */
+ WindowPtr pChild, /* First child of pParent that was
* affected */
- VTKind kind; /* What kind of configuration caused call */
+ VTKind kind /* What kind of configuration caused call */
+ )
{
RegionRec totalClip; /* Total clipping region available to
* the marked children. pParent's clipList
diff --git a/xorg-server/mi/miwideline.c b/xorg-server/mi/miwideline.c
index f080ca11d..40f0d3e49 100644
--- a/xorg-server/mi/miwideline.c
+++ b/xorg-server/mi/miwideline.c
@@ -252,13 +252,16 @@ miFillRectPolyHelper (
}
_X_EXPORT /* static */ int
-miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
- double x0, y0;
- double k; /* x0 * dy - y0 * dx */
- int dx, dy;
- int xi, yi;
- int left;
- PolyEdgePtr edge;
+miPolyBuildEdge (
+ double x0,
+ double y0,
+ double k, /* x0 * dy - y0 * dx */
+ int dx,
+ int dy,
+ int xi,
+ int yi,
+ int left,
+ PolyEdgePtr edge)
{
int x, y, e;
int xady;
@@ -311,14 +314,17 @@ miPolyBuildEdge (x0, y0, k, dx, dy, xi, yi, left, edge)
#define StepAround(v, incr, max) (((v) + (incr) < 0) ? (max - 1) : ((v) + (incr) == max) ? 0 : ((v) + (incr)))
_X_EXPORT /* static */ int
-miPolyBuildPoly (vertices, slopes, count, xi, yi, left, right, pnleft, pnright, h)
- PolyVertexPtr vertices;
- PolySlopePtr slopes;
- int count;
- int xi, yi;
- PolyEdgePtr left, right;
- int *pnleft, *pnright;
- int *h;
+miPolyBuildPoly (
+ PolyVertexPtr vertices,
+ PolySlopePtr slopes,
+ int count,
+ int xi,
+ int yi,
+ PolyEdgePtr left,
+ PolyEdgePtr right,
+ int *pnleft,
+ int *pnright,
+ int *h)
{
int top, bottom;
double miny, maxy;
@@ -910,11 +916,9 @@ miRoundJoinFace (LineFacePtr face, PolyEdgePtr edge, Bool *leftEdge)
}
_X_EXPORT void
-miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
- LineFacePtr pLeft, pRight;
- PolyEdgePtr edge1, edge2;
- int *y1, *y2;
- Bool *left1, *left2;
+miRoundJoinClip (LineFacePtr pLeft, LineFacePtr pRight,
+ PolyEdgePtr edge1, PolyEdgePtr edge2,
+ int *y1, int *y2, Bool *left1, Bool *left2)
{
double denom;
@@ -935,11 +939,7 @@ miRoundJoinClip (pLeft, pRight, edge1, edge2, y1, y2, left1, left2)
}
_X_EXPORT int
-miRoundCapClip (face, isInt, edge, leftEdge)
- LineFacePtr face;
- Bool isInt;
- PolyEdgePtr edge;
- Bool *leftEdge;
+miRoundCapClip (LineFacePtr face, Bool isInt, PolyEdgePtr edge, Bool *leftEdge)
{
int y;
int dx, dy;
@@ -1525,14 +1525,10 @@ miCleanupSpanData (DrawablePtr pDrawable, GCPtr pGC, SpanDataPtr spanData)
}
_X_EXPORT void
-miWideLine (pDrawable, pGC, mode, npt, pPts)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode;
- int npt;
- DDXPointPtr pPts;
+miWideLine (DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pPts)
{
- int x1, y1, x2, y2;
+ int x1, y1, x2, y2;
SpanDataRec spanDataRec;
SpanDataPtr spanData;
long pixel;
@@ -2023,12 +2019,8 @@ miWideDashSegment (
}
_X_EXPORT void
-miWideDash (pDrawable, pGC, mode, npt, pPts)
- DrawablePtr pDrawable;
- GCPtr pGC;
- int mode;
- int npt;
- DDXPointPtr pPts;
+miWideDash (DrawablePtr pDrawable, GCPtr pGC,
+ int mode, int npt, DDXPointPtr pPts)
{
int x1, y1, x2, y2;
unsigned long pixel;
diff --git a/xorg-server/mi/miwindow.c b/xorg-server/mi/miwindow.c
index cb8400c0c..498c8a656 100644
--- a/xorg-server/mi/miwindow.c
+++ b/xorg-server/mi/miwindow.c
@@ -57,12 +57,10 @@ SOFTWARE.
#include "pixmapstr.h"
#include "mivalidate.h"
-_X_EXPORT void
-miClearToBackground(pWin, x, y, w, h, generateExposures)
- WindowPtr pWin;
- int x,y;
- int w,h;
- Bool generateExposures;
+_X_EXPORT void
+miClearToBackground(WindowPtr pWin,
+ int x, int y, int w, int h,
+ Bool generateExposures)
{
BoxRec box;
RegionRec reg;
@@ -124,213 +122,8 @@ miClearToBackground(pWin, x, y, w, h, generateExposures)
REGION_DESTROY(pScreen, pBSReg);
}
-/*
- * For SaveUnders using backing-store. The idea is that when a window is mapped
- * with saveUnder set TRUE, any windows it obscures will have its backing
- * store turned on setting the DIXsaveUnder bit,
- * The backing-store code must be written to allow for this
- */
-
-/*-
- *-----------------------------------------------------------------------
- * miCheckSubSaveUnder --
- * Check all the inferiors of a window for coverage by saveUnder
- * windows. Called from ChangeSaveUnder and CheckSaveUnder.
- * This code is very inefficient.
- *
- * Results:
- * TRUE if any windows need to have backing-store removed.
- *
- * Side Effects:
- * Windows may have backing-store turned on or off.
- *
- *-----------------------------------------------------------------------
- */
-static Bool
-miCheckSubSaveUnder(
- WindowPtr pParent, /* Parent to check */
- WindowPtr pFirst, /* first reconfigured window */
- RegionPtr pRegion) /* Initial area obscured by saveUnder */
-{
- WindowPtr pChild; /* Current child */
- ScreenPtr pScreen; /* Screen to use */
- RegionRec SubRegion; /* Area of children obscured */
- Bool res = FALSE; /* result */
- Bool subInited=FALSE;/* SubRegion initialized */
-
- pScreen = pParent->drawable.pScreen;
- if ( (pChild = pParent->firstChild) )
- {
- /*
- * build region above first changed window
- */
-
- for (; pChild != pFirst; pChild = pChild->nextSib)
- if (pChild->viewable && pChild->saveUnder)
- REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize);
-
- /*
- * check region below and including first changed window
- */
-
- for (; pChild; pChild = pChild->nextSib)
- {
- if (pChild->viewable)
- {
- /*
- * don't save under nephew/niece windows;
- * use a separate region
- */
-
- if (pChild->firstChild)
- {
- if (!subInited)
- {
- REGION_NULL(pScreen, &SubRegion);
- subInited = TRUE;
- }
- REGION_COPY(pScreen, &SubRegion, pRegion);
- res |= miCheckSubSaveUnder(pChild, pChild->firstChild,
- &SubRegion);
- }
- else
- {
- res |= miCheckSubSaveUnder(pChild, pChild->firstChild,
- pRegion);
- }
-
- if (pChild->saveUnder)
- REGION_UNION(pScreen, pRegion, pRegion, &pChild->borderSize);
- }
- }
-
- if (subInited)
- REGION_UNINIT(pScreen, &SubRegion);
- }
-
- /*
- * Check the state of this window. DIX save unders are
- * enabled for viewable windows with some client expressing
- * exposure interest and which intersect the save under region
- */
-
- if (pParent->viewable &&
- ((pParent->eventMask | wOtherEventMasks(pParent)) & ExposureMask) &&
- REGION_NOTEMPTY(pScreen, &pParent->borderSize) &&
- RECT_IN_REGION(pScreen, pRegion, REGION_EXTENTS(pScreen,
- &pParent->borderSize)) != rgnOUT)
- {
- if (!pParent->DIXsaveUnder)
- {
- pParent->DIXsaveUnder = TRUE;
- (*pScreen->ChangeWindowAttributes) (pParent, CWBackingStore);
- }
- }
- else
- {
- if (pParent->DIXsaveUnder)
- {
- res = TRUE;
- pParent->DIXsaveUnder = FALSE;
- }
- }
- return res;
-}
-
-
-/*-
- *-----------------------------------------------------------------------
- * miChangeSaveUnder --
- * Change the save-under state of a tree of windows. Called when
- * a window with saveUnder TRUE is mapped/unmapped/reconfigured.
- *
- * Results:
- * TRUE if any windows need to have backing-store removed (which
- * means that PostChangeSaveUnder needs to be called later to
- * finish the job).
- *
- * Side Effects:
- * Windows may have backing-store turned on or off.
- *
- *-----------------------------------------------------------------------
- */
-Bool
-miChangeSaveUnder(pWin, first)
- WindowPtr pWin;
- WindowPtr first; /* First window to check.
- * Used when pWin was restacked */
-{
- RegionRec rgn; /* Area obscured by saveUnder windows */
- ScreenPtr pScreen;
- Bool res;
-
- if (!deltaSaveUndersViewable && !numSaveUndersViewable)
- return FALSE;
- numSaveUndersViewable += deltaSaveUndersViewable;
- deltaSaveUndersViewable = 0;
- pScreen = pWin->drawable.pScreen;
- REGION_NULL(pScreen, &rgn);
- res = miCheckSubSaveUnder (pWin->parent,
- pWin->saveUnder ? first : pWin->nextSib,
- &rgn);
- REGION_UNINIT(pScreen, &rgn);
- return res;
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miPostChangeSaveUnder --
- * Actually turn backing-store off for those windows that no longer
- * need to have it on.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Backing-store and SAVE_UNDER_CHANGE_BIT are turned off for those
- * windows affected.
- *
- *-----------------------------------------------------------------------
- */
-void
-miPostChangeSaveUnder(pWin, pFirst)
- WindowPtr pWin;
- WindowPtr pFirst;
-{
- WindowPtr pParent, pChild;
- ChangeWindowAttributesProcPtr ChangeWindowAttributes;
-
- if (!(pParent = pWin->parent))
- return;
- ChangeWindowAttributes = pParent->drawable.pScreen->ChangeWindowAttributes;
- if (!pParent->DIXsaveUnder &&
- (pParent->backingStore == NotUseful) && pParent->backStorage)
- (*ChangeWindowAttributes)(pParent, CWBackingStore);
- if (!(pChild = pFirst))
- return;
- while (1)
- {
- if (!pChild->DIXsaveUnder &&
- (pChild->backingStore == NotUseful) && pChild->backStorage)
- (*ChangeWindowAttributes)(pChild, CWBackingStore);
- if (pChild->firstChild)
- {
- pChild = pChild->firstChild;
- continue;
- }
- while (!pChild->nextSib)
- {
- pChild = pChild->parent;
- if (pChild == pParent)
- return;
- }
- pChild = pChild->nextSib;
- }
-}
-
void
-miMarkWindow(pWin)
- WindowPtr pWin;
+miMarkWindow(WindowPtr pWin)
{
ValidatePtr val;
@@ -345,10 +138,7 @@ miMarkWindow(pWin)
}
Bool
-miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
- WindowPtr pWin;
- WindowPtr pFirst;
- WindowPtr *ppLayerWin;
+miMarkOverlappedWindows(WindowPtr pWin, WindowPtr pFirst, WindowPtr *ppLayerWin)
{
BoxPtr box;
WindowPtr pChild, pLast;
@@ -433,9 +223,8 @@ miMarkOverlappedWindows(pWin, pFirst, ppLayerWin)
* regions, translate the regions, restore any backing store,
* and then send any regions still exposed to the client
*****/
-_X_EXPORT void
-miHandleValidateExposures(pWin)
- WindowPtr pWin;
+void
+miHandleValidateExposures(WindowPtr pWin)
{
WindowPtr pChild;
ValidatePtr val;
@@ -472,11 +261,7 @@ miHandleValidateExposures(pWin)
}
void
-miMoveWindow(pWin, x, y, pNextSib, kind)
- WindowPtr pWin;
- int x,y;
- WindowPtr pNextSib;
- VTKind kind;
+miMoveWindow(WindowPtr pWin, int x, int y, WindowPtr pNextSib, VTKind kind)
{
WindowPtr pParent;
Bool WasViewable = (Bool)(pWin->viewable);
@@ -486,9 +271,6 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
Bool anyMarked = FALSE;
ScreenPtr pScreen;
WindowPtr windowToValidate;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
WindowPtr pLayerWin;
/* if this is a root window, can't be moved */
@@ -528,12 +310,6 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
anyMarked |= (*pScreen->MarkOverlappedWindows)
(pWin, pLayerWin, (WindowPtr *)NULL);
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, windowToValidate);
- }
-#endif /* DO_SAVE_UNDERS */
if (anyMarked)
{
@@ -543,10 +319,6 @@ miMoveWindow(pWin, x, y, pNextSib, kind)
/* XXX need to retile border if ParentRelative origin */
(*pScreen->HandleExposures)(pLayerWin->parent);
}
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, windowToValidate);
-#endif /* DO_SAVE_UNDERS */
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, kind);
}
@@ -570,6 +342,15 @@ miRecomputeExposures (
if (pWin->valdata)
{
+#ifdef COMPOSITE
+ /*
+ * Redirected windows are not affected by parent window
+ * gravity manipulations, so don't recompute their
+ * exposed areas here.
+ */
+ if (pWin->redirectDraw != RedirectDrawNone)
+ return WT_DONTWALKCHILDREN;
+#endif
pScreen = pWin->drawable.pScreen;
/*
* compute exposed regions of this window
@@ -589,11 +370,10 @@ miRecomputeExposures (
}
void
-miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
- WindowPtr pWin;
- int x,y;
- unsigned int w, h;
- WindowPtr pSib;
+miSlideAndSizeWindow(WindowPtr pWin,
+ int x, int y,
+ unsigned int w, unsigned int h,
+ WindowPtr pSib)
{
WindowPtr pParent;
Bool WasViewable = (Bool)(pWin->viewable);
@@ -619,9 +399,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
RegionPtr borderVisible = NullRegion; /* visible area of the border */
Bool shrunk = FALSE; /* shrunk in an inner dimension */
Bool moved = FALSE; /* window position changed */
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
WindowPtr pLayerWin;
/* if this is a root window, can't be resized */
@@ -734,12 +511,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
pWin->valdata->before.borderVisible = borderVisible;
}
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pFirstChange);
- }
-#endif /* DO_SAVE_UNDERS */
if (anyMarked)
(*pScreen->ValidateTree)(pLayerWin->parent, pFirstChange, VTOther);
@@ -902,12 +673,6 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
REGION_DESTROY(pScreen, destClip);
if (anyMarked)
(*pScreen->HandleExposures)(pLayerWin->parent);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- {
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pFirstChange);
- }
-#endif /* DO_SAVE_UNDERS */
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pLayerWin->parent, pFirstChange,
VTOther);
@@ -917,13 +682,11 @@ miSlideAndSizeWindow(pWin, x, y, w, h, pSib)
}
WindowPtr
-miGetLayerWindow(pWin)
- WindowPtr pWin;
+miGetLayerWindow(WindowPtr pWin)
{
return pWin->firstChild;
}
-#ifdef SHAPE
/******
*
* miSetShape
@@ -931,16 +694,12 @@ miGetLayerWindow(pWin)
* and send appropriate exposure events
*/
-_X_EXPORT void
-miSetShape(pWin)
- WindowPtr pWin;
+void
+miSetShape(WindowPtr pWin)
{
Bool WasViewable = (Bool)(pWin->viewable);
ScreenPtr pScreen = pWin->drawable.pScreen;
Bool anyMarked = FALSE;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
WindowPtr pLayerWin;
if (WasViewable)
@@ -972,12 +731,6 @@ miSetShape(pWin)
anyMarked |= (*pScreen->MarkOverlappedWindows)(pWin, pWin,
(WindowPtr *)NULL);
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pLayerWin);
- }
-#endif /* DO_SAVE_UNDERS */
if (anyMarked)
(*pScreen->ValidateTree)(pLayerWin->parent, NullWindow, VTOther);
@@ -987,10 +740,6 @@ miSetShape(pWin)
{
if (anyMarked)
(*pScreen->HandleExposures)(pLayerWin->parent);
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pLayerWin);
-#endif /* DO_SAVE_UNDERS */
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pLayerWin->parent, NullWindow, VTOther);
}
@@ -998,23 +747,17 @@ miSetShape(pWin)
WindowsRestructured ();
CheckCursorConfinement(pWin);
}
-#endif
/* Keeps the same inside(!) origin */
-_X_EXPORT void
-miChangeBorderWidth(pWin, width)
- WindowPtr pWin;
- unsigned int width;
+void
+miChangeBorderWidth(WindowPtr pWin, unsigned int width)
{
int oldwidth;
Bool anyMarked = FALSE;
ScreenPtr pScreen;
Bool WasViewable = (Bool)(pWin->viewable);
Bool HadBorder;
-#ifdef DO_SAVE_UNDERS
- Bool dosave = FALSE;
-#endif
WindowPtr pLayerWin;
oldwidth = wBorderWidth (pWin);
@@ -1047,22 +790,12 @@ miChangeBorderWidth(pWin, width)
pWin->valdata->before.borderVisible = borderVisible;
}
}
-#ifdef DO_SAVE_UNDERS
- if (DO_SAVE_UNDERS(pWin))
- {
- dosave = (*pScreen->ChangeSaveUnder)(pLayerWin, pWin->nextSib);
- }
-#endif /* DO_SAVE_UNDERS */
if (anyMarked)
{
(*pScreen->ValidateTree)(pLayerWin->parent, pLayerWin, VTOther);
(*pScreen->HandleExposures)(pLayerWin->parent);
}
-#ifdef DO_SAVE_UNDERS
- if (dosave)
- (*pScreen->PostChangeSaveUnder)(pLayerWin, pWin->nextSib);
-#endif /* DO_SAVE_UNDERS */
if (anyMarked && pScreen->PostValidateTree)
(*pScreen->PostValidateTree)(pLayerWin->parent, pLayerWin,
VTOther);
@@ -1072,10 +805,7 @@ miChangeBorderWidth(pWin, width)
}
void
-miMarkUnrealizedWindow(pChild, pWin, fromConfigure)
- WindowPtr pChild;
- WindowPtr pWin;
- Bool fromConfigure;
+miMarkUnrealizedWindow(WindowPtr pChild, WindowPtr pWin, Bool fromConfigure)
{
if ((pChild != pWin) || fromConfigure)
{
diff --git a/xorg-server/mi/mizerarc.c b/xorg-server/mi/mizerarc.c
index 947b85aac..d3cc1958c 100644
--- a/xorg-server/mi/mizerarc.c
+++ b/xorg-server/mi/mizerarc.c
@@ -96,10 +96,7 @@ static miZeroArcPtRec oob = {65536, 65536, 0};
*/
_X_EXPORT Bool
-miZeroArcSetup(arc, info, ok360)
- xArc *arc;
- miZeroArcRec *info;
- Bool ok360;
+miZeroArcSetup(xArc *arc, miZeroArcRec *info, Bool ok360)
{
int l;
int angle1, angle2;
@@ -706,11 +703,7 @@ miZeroArcDashPts(
}
_X_EXPORT void
-miZeroPolyArc(pDraw, pGC, narcs, parcs)
- DrawablePtr pDraw;
- GCPtr pGC;
- int narcs;
- xArc *parcs;
+miZeroPolyArc(DrawablePtr pDraw, GCPtr pGC, int narcs, xArc *parcs)
{
int maxPts = 0;
int n, maxw = 0;
diff --git a/xorg-server/mi/mizerclip.c b/xorg-server/mi/mizerclip.c
index b167c5475..dd05040bc 100644
--- a/xorg-server/mi/mizerclip.c
+++ b/xorg-server/mi/mizerclip.c
@@ -405,17 +405,12 @@ the numerator is therefore (2^32 - 1), which does not overflow an unsigned
*
*/
_X_EXPORT int
-miZeroClipLine(xmin, ymin, xmax, ymax,
- new_x1, new_y1, new_x2, new_y2,
- adx, ady,
- pt1_clipped, pt2_clipped, octant, bias, oc1, oc2)
- int xmin, ymin, xmax, ymax;
- int *new_x1, *new_y1, *new_x2, *new_y2;
- int *pt1_clipped, *pt2_clipped;
- unsigned int adx, ady;
- int octant;
- unsigned int bias;
- int oc1, oc2;
+miZeroClipLine(int xmin, int ymin, int xmax, int ymax,
+ int *new_x1, int *new_y1, int *new_x2, int *new_y2,
+ unsigned int adx, unsigned int ady,
+ int *pt1_clipped, int *pt2_clipped,
+ int octant, unsigned int bias,
+ int oc1, int oc2)
{
int swapped = 0;
int clipDone = 0;
diff --git a/xorg-server/mi/mizerline.c b/xorg-server/mi/mizerline.c
index 6604a0923..a415d73da 100644
--- a/xorg-server/mi/mizerline.c
+++ b/xorg-server/mi/mizerline.c
@@ -98,12 +98,12 @@ SOFTWARE.
}
_X_EXPORT void
-miZeroLine(pDraw, pGC, mode, npt, pptInit)
- DrawablePtr pDraw;
- GCPtr pGC;
- int mode; /* Origin or Previous */
- int npt; /* number of points */
- DDXPointPtr pptInit;
+miZeroLine(
+ DrawablePtr pDraw,
+ GCPtr pGC,
+ int mode, /* Origin or Previous */
+ int npt, /* number of points */
+ DDXPointPtr pptInit)
{
int Nspans, current_y = 0;
DDXPointPtr ppt;
@@ -363,13 +363,14 @@ miZeroLine(pDraw, pGC, mode, npt, pptInit)
xfree(pspanInit);
}
-_X_EXPORT void
-miZeroDashLine(dst, pgc, mode, nptInit, pptInit)
-DrawablePtr dst;
-GCPtr pgc;
-int mode;
-int nptInit; /* number of points in polyline */
-DDXPointRec *pptInit; /* points in the polyline */
+void
+miZeroDashLine(
+ DrawablePtr dst,
+ GCPtr pgc,
+ int mode,
+ int nptInit, /* number of points in polyline */
+ DDXPointRec *pptInit /* points in the polyline */
+ )
{
/* XXX kludge until real zero-width dash code is written */
pgc->lineWidth = 1;