From 5563861ab7e56ec891cfce6b34af43fec53ccee3 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Fri, 13 Oct 2006 19:05:28 -0700 Subject: [PATCH 01/13] Make sure xorgcfg files are included even when dist made with --disable-xorgcfg --- hw/xfree86/utils/xorgcfg/Makefile.am | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am index 73e4042ae..309ed5c0a 100644 --- a/hw/xfree86/utils/xorgcfg/Makefile.am +++ b/hw/xfree86/utils/xorgcfg/Makefile.am @@ -56,6 +56,7 @@ endif if NEED_STRLCAT STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c endif +endif BUILD_XORGCFG xorgcfg_SOURCES = \ accessx.c \ @@ -95,10 +96,7 @@ xorgcfg_SOURCES = \ xf86config.h \ $(STRL_SRCS) -XBMdir = $(includedir)/X11/bitmaps -XPMdir = $(includedir)/X11/pixmaps - -XBM_DATA = \ +BITMAPS = \ card.xbm \ keyboard.xbm \ monitor.xbm \ @@ -112,7 +110,7 @@ XBM_DATA = \ shorter.xbm \ taller.xbm -XPM_DATA = \ +PIXMAPS = \ card.xpm \ computer.xpm \ keyboard.xpm \ @@ -122,6 +120,13 @@ XPM_DATA = \ # Rules needed to cpp man page & app-defaults include $(top_srcdir)/cpprules.in +if BUILD_XORGCFG +XBMdir = $(includedir)/X11/bitmaps +XPMdir = $(includedir)/X11/pixmaps + +XBM_DATA = $(BITMAPS) +XPM_DATA = $(PIXMAPS) + # App default files (*.ad) appdefaultdir = @APPDEFAULTDIR@ @@ -146,7 +151,6 @@ appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) all-local: $(appman_PRE) $(appman_DATA) -EXTRA_DIST = $(XBM_DATA) $(XPM_DATA) XOrgCfg.pre xorgcfg.man.pre BUILT_SOURCES = $(appman_PRE) CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA) @@ -156,4 +160,6 @@ SUFFIXES += .$(APP_MAN_SUFFIX) .man -rm -f $@ $(LN_S) $< $@ -endif +endif BUILD_XORGCFG + +EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre From a232693c8c2a206aac47c07b133c071938204e0b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sun, 15 Oct 2006 16:48:59 +0200 Subject: [PATCH 02/13] Add per-drawable Xv colour key helper function. This allows overlay Xv adaptors to work slightly better with compositing managers. Bump the video driver ABI minor so drivers only need to check for this at build time. --- hw/xfree86/common/xf86Module.h | 2 +- hw/xfree86/common/xf86xv.c | 66 ++++++++++++++++++++++++++++++++-- hw/xfree86/common/xf86xv.h | 3 ++ hw/xfree86/common/xf86xvpriv.h | 1 + hw/xfree86/loader/xf86sym.c | 1 + 5 files changed, 69 insertions(+), 4 deletions(-) diff --git a/hw/xfree86/common/xf86Module.h b/hw/xfree86/common/xf86Module.h index f0cf5eb93..3c3247e40 100644 --- a/hw/xfree86/common/xf86Module.h +++ b/hw/xfree86/common/xf86Module.h @@ -84,7 +84,7 @@ typedef enum { * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 3) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 0) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(1, 1) #define ABI_XINPUT_VERSION SET_ABI_VERSION(1, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 3) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 5) diff --git a/hw/xfree86/common/xf86xv.c b/hw/xfree86/common/xf86xv.c index 89cb6bac4..3e908b86a 100644 --- a/hw/xfree86/common/xf86xv.c +++ b/hw/xfree86/common/xf86xv.c @@ -974,6 +974,7 @@ xf86XVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) if(!winPriv) { winPriv = xalloc(sizeof(XF86XVWindowRec)); if(!winPriv) return BadAlloc; + memset(winPriv, 0, sizeof(XF86XVWindowRec)); winPriv->PortRec = portPriv; winPriv->next = PrivRoot; pWin->devPrivates[XF86XVWindowIndex].ptr = (pointer)winPriv; @@ -1026,6 +1027,9 @@ xf86XVDestroyWindow(WindowPtr pWin) pPriv->pDraw = NULL; tmp = WinPriv; + if(WinPriv->pGC) { + FreeGC(WinPriv->pGC, 0); + } WinPriv = WinPriv->next; xfree(tmp); } @@ -1118,6 +1122,8 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) while(WinPriv) { pPriv = WinPriv->PortRec; + if(!pPriv) goto next; + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pScreen, pPriv->pCompositeClip); @@ -1148,6 +1154,7 @@ xf86XVClipNotify(WindowPtr pWin, int dx, int dy) } } +next: pPrev = WinPriv; WinPriv = WinPriv->next; } @@ -1739,9 +1746,13 @@ xf86XVPutImage( REGION_UNINIT(pScreen, &VPReg); } - if(portPriv->pDraw) { + /* If we are changing windows, unregister our port in the old window */ + if(portPriv->pDraw && (portPriv->pDraw != pDraw)) xf86XVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); - } + + /* Register our port with the new window */ + ret = xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); + if(ret != Success) goto PUT_IMAGE_BAILOUT; if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -1772,7 +1783,6 @@ xf86XVPutImage( if((ret == Success) && (portPriv->AdaptorRec->flags & VIDEO_OVERLAID_IMAGES)) { - xf86XVEnlistPortInWindow((WindowPtr)pDraw, portPriv); portPriv->isOn = XV_ON; portPriv->pDraw = pDraw; portPriv->drw_x = drw_x; portPriv->drw_y = drw_y; @@ -1813,6 +1823,56 @@ xf86XVQueryImageAttributes( format->id, width, height, pitches, offsets); } + +_X_EXPORT void +xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes) +{ + ScreenPtr pScreen = pDraw->pScreen; + WindowPtr pWin = (WindowPtr)pDraw; + XF86XVWindowPtr pPriv = GET_XF86XV_WINDOW(pWin); + GCPtr pGC = NULL; + XID pval[2]; + BoxPtr pbox = REGION_RECTS(clipboxes); + int i, nbox = REGION_NUM_RECTS(clipboxes); + xRectangle *rects; + + if(!xf86Screens[pScreen->myNum]->vtSema) return; + + if(pPriv) + pGC = pPriv->pGC; + + if(!pGC) { + int status; + pval[0] = key; + pval[1] = IncludeInferiors; + pGC = CreateGC(pDraw, GCForeground | GCSubwindowMode, pval, &status); + if(!pGC) return; + ValidateGC(pDraw, pGC); + if (pPriv) pPriv->pGC = pGC; + } else if (key != pGC->fgPixel){ + pval[0] = key; + ChangeGC(pGC, GCForeground, pval); + ValidateGC(pDraw, pGC); + } + + REGION_TRANSLATE(pDraw->pScreen, clipboxes, -pDraw->x, -pDraw->y); + + rects = ALLOCATE_LOCAL(nbox * sizeof(xRectangle)); + + for(i = 0; i < nbox; i++, pbox++) { + rects[i].x = pbox->x1; + rects[i].y = pbox->y1; + rects[i].width = pbox->x2 - pbox->x1; + rects[i].height = pbox->y2 - pbox->y1; + } + + (*pGC->ops->PolyFillRect)(pDraw, pGC, nbox, rects); + + if (!pPriv) FreeGC(pGC, 0); + + DEALLOCATE_LOCAL(rects); +} + _X_EXPORT void xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes) { diff --git a/hw/xfree86/common/xf86xv.h b/hw/xfree86/common/xf86xv.h index e0feb57b8..817e2b994 100644 --- a/hw/xfree86/common/xf86xv.h +++ b/hw/xfree86/common/xf86xv.h @@ -232,6 +232,9 @@ void xf86XVFreeVideoAdaptorRec(XF86VideoAdaptorPtr ptr); void xf86XVFillKeyHelper (ScreenPtr pScreen, CARD32 key, RegionPtr clipboxes); +void +xf86XVFillKeyHelperDrawable (DrawablePtr pDraw, CARD32 key, RegionPtr clipboxes); + Bool xf86XVClipVideoHelper( BoxPtr dst, diff --git a/hw/xfree86/common/xf86xvpriv.h b/hw/xfree86/common/xf86xvpriv.h index ced053679..e716c9c6a 100644 --- a/hw/xfree86/common/xf86xvpriv.h +++ b/hw/xfree86/common/xf86xvpriv.h @@ -80,6 +80,7 @@ typedef struct { typedef struct _XF86XVWindowRec{ XvPortRecPrivatePtr PortRec; struct _XF86XVWindowRec *next; + GCPtr pGC; } XF86XVWindowRec, *XF86XVWindowPtr; #endif /* _XF86XVPRIV_H_ */ diff --git a/hw/xfree86/loader/xf86sym.c b/hw/xfree86/loader/xf86sym.c index 586d5dc81..8e39373b3 100644 --- a/hw/xfree86/loader/xf86sym.c +++ b/hw/xfree86/loader/xf86sym.c @@ -621,6 +621,7 @@ _X_HIDDEN void *xfree86LookupTab[] = { SYMFUNC(xf86XVAllocateVideoAdaptorRec) SYMFUNC(xf86XVFreeVideoAdaptorRec) SYMFUNC(xf86XVFillKeyHelper) + SYMFUNC(xf86XVFillKeyHelperDrawable) SYMFUNC(xf86XVClipVideoHelper) SYMFUNC(xf86XVCopyYUV12ToPacked) SYMFUNC(xf86XVCopyPacked) From 0901eec87ee9f3a2a067695bdbd569ff42149879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michel=20D=C3=A4nzer?= Date: Sun, 15 Oct 2006 16:57:09 +0200 Subject: [PATCH 03/13] Fix __glXDRIbindTexImage() for 32 bpp on big endian platforms. --- GL/glx/glxdri.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/GL/glx/glxdri.c b/GL/glx/glxdri.c index b5723049d..170662c7e 100644 --- a/GL/glx/glxdri.c +++ b/GL/glx/glxdri.c @@ -359,7 +359,12 @@ __glXDRIbindTexImage(__GLXcontext *baseContext, if (pixmap->drawable.depth >= 24) { bpp = 4; format = GL_BGRA; - type = GL_UNSIGNED_BYTE; + type = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + GL_UNSIGNED_BYTE; +#else + GL_UNSIGNED_INT_8_8_8_8_REV; +#endif } else { bpp = 2; format = GL_RGB; From 85ac2f16abe9f6e88b4e71609da334d336a9a600 Mon Sep 17 00:00:00 2001 From: Alan Hourihane Date: Mon, 16 Oct 2006 12:39:05 +0100 Subject: [PATCH 04/13] Small modification to blocking signals when switching modes. --- hw/xfree86/common/xf86Cursor.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/hw/xfree86/common/xf86Cursor.c b/hw/xfree86/common/xf86Cursor.c index 20905b030..46d812804 100644 --- a/hw/xfree86/common/xf86Cursor.c +++ b/hw/xfree86/common/xf86Cursor.c @@ -208,7 +208,6 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) ScreenPtr pCursorScreen; Bool Switched; int px, py; - int sigstate; if (!pScr->vtSema || !mode || !pScr->SwitchMode) return FALSE; @@ -228,10 +227,8 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) if (pScreen == pCursorScreen) miPointerGetPosition(inputInfo.pointer, &px, &py); - sigstate = xf86BlockSIGIO (); xf86EnterServerState(SETUP); Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0); - xf86EnterServerState(OPERATING); if (Switched) { pScr->currentMode = mode; @@ -266,7 +263,7 @@ xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) pScr->frameY1 = pScr->virtualY - 1; } } - xf86UnblockSIGIO (sigstate); + xf86EnterServerState(OPERATING); if (pScr->AdjustFrame) (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); From 205c6788d7a34704e36b23f1a93d89e9b986266a Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Mon, 16 Oct 2006 23:48:09 +0300 Subject: [PATCH 05/13] config/dbus: properly initialise vtable Properly initialise the vtable, so we don't end up with an unregister_function pointing to god knows where. --- config/config.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/config/config.c b/config/config.c index a50302f2f..4d12a0758 100644 --- a/config/config.c +++ b/config/config.c @@ -251,7 +251,7 @@ configInitialise() { DBusConnection *bus = NULL; DBusError error; - DBusObjectPathVTable vtable; + DBusObjectPathVTable vtable = { .message_function = configMessage }; configConnection = NULL; @@ -294,7 +294,6 @@ configInitialise() return; } - vtable.message_function = configMessage; snprintf(busobject, sizeof(busobject), "/org/x/config/%d", atoi(display)); if (!dbus_connection_register_object_path(bus, busobject, &vtable, bus)) { configfd = -1; @@ -319,10 +318,7 @@ configFini() if (configConnection) { dbus_error_init(&error); - /* This causes a segfault inside libdbus. Sigh. */ -#if 0 dbus_connection_unregister_object_path(configConnection, busobject); -#endif dbus_bus_remove_match(configConnection, MATCH_RULE, &error); dbus_bus_release_name(configConnection, busname, &error); dbus_connection_unref(configConnection); From 5e17cde27b064174584d478130b0f95dcef78deb Mon Sep 17 00:00:00 2001 From: Matthias Hopf Date: Tue, 17 Oct 2006 17:06:44 +0200 Subject: [PATCH 06/13] StorePixels() macro could create invalid *x++=*x... code - fixed. --- cfb/cfbteblt8.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cfb/cfbteblt8.c b/cfb/cfbteblt8.c index 1db299623..9d4ce5708 100644 --- a/cfb/cfbteblt8.c +++ b/cfb/cfbteblt8.c @@ -301,7 +301,7 @@ typedef unsigned int *glyphPointer; #define StorePixels(o,p) dst[o] = p #define Loop dst += widthDst; #else -#define StorePixels(o,p) *dst++ = (p) +#define StorePixels(o,p) do { *dst = (p); dst++; } while (0) #define Loop dst += widthLeft; #endif From 80642f37d40216035786eaf490952d16f6b5f597 Mon Sep 17 00:00:00 2001 From: Adam Jackson Date: Tue, 17 Oct 2006 14:53:28 -0400 Subject: [PATCH 07/13] Stop building xorgcfg by default. --- configure.ac | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/configure.ac b/configure.ac index 7992d77b0..0d7fb6ca8 100644 --- a/configure.ac +++ b/configure.ac @@ -1665,13 +1665,9 @@ fi dnl xorgcfg GUI configuration utility AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], - [Build xorgcfg GUI configuration utility (default: auto)]), - [XORGCFG=$enableval],[XORGCFG=auto]) -if test "x$XORGCFG" = xauto && test "x$XORG" = xyes; then - XORGCFG=yes -fi - -if test "x$XORGCFG" = xyes; then + [Build xorgcfg GUI configuration utility (default: no)]), + [XORGCFG=$enableval],[XORGCFG=no]) +if test x$XORGCFG = xyes ; then PKG_CHECK_MODULES([XORGCFG_DEP], [xkbui >= 1.0.2 xkbfile xxf86misc xxf86vm xaw7 xmu xt xpm xext x11]) AC_CHECK_LIB([curses],[waddstr], From a8a0abdbea0573c861a5af9d58f3ce66790455ca Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Wed, 18 Oct 2006 10:59:07 +0300 Subject: [PATCH 08/13] config/dbus: always unref the connection, not close --- config/config.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/config/config.c b/config/config.c index 4d12a0758..5b0d90d74 100644 --- a/config/config.c +++ b/config/config.c @@ -265,7 +265,7 @@ configInitialise() } if (!dbus_connection_get_unix_fd(bus, &configfd)) { - dbus_connection_close(bus); + dbus_connection_unref(bus); configfd = -1; FatalError("[dbus] couldn't get fd for bus\n"); return; @@ -275,7 +275,7 @@ configInitialise() if (!dbus_bus_request_name(bus, busname, 0, &error) || dbus_error_is_set(&error)) { dbus_error_free(&error); - dbus_connection_close(bus); + dbus_connection_unref(bus); configfd = -1; FatalError("[dbus] couldn't take over org.x.config: %s (%s)\n", error.name, error.message); @@ -287,7 +287,7 @@ configInitialise() if (dbus_error_is_set(&error)) { dbus_error_free(&error); dbus_bus_release_name(bus, busname, &error); - dbus_connection_close(bus); + dbus_connection_unref(bus); configfd = -1; FatalError("[dbus] couldn't match X.Org rule: %s (%s)\n", error.name, error.message); @@ -299,7 +299,7 @@ configInitialise() configfd = -1; dbus_bus_release_name(bus, busname, &error); dbus_bus_remove_match(bus, MATCH_RULE, &error); - dbus_connection_close(bus); + dbus_connection_unref(bus); FatalError("[dbus] couldn't register object path\n"); return; } From d029c8f1b72019446a5c873f55ffa43504b03dfb Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Wed, 18 Oct 2006 18:11:06 -0700 Subject: [PATCH 09/13] Use getisax() instead of asm code to determine available x86 ISA extensions on Solaris --- configure.ac | 3 ++- fb/fbpict.c | 25 +++++++++++++++++++++++-- include/dix-config.h.in | 3 +++ 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 0d7fb6ca8..2467e7973 100644 --- a/configure.ac +++ b/configure.ac @@ -82,7 +82,8 @@ AC_TYPE_PID_T dnl Checks for library functions. AC_FUNC_VPRINTF AC_CHECK_FUNCS([geteuid getuid link memmove memset mkstemp strchr strrchr \ - strtol getopt getopt_long vsnprintf walkcontext backtrace]) + strtol getopt getopt_long vsnprintf walkcontext backtrace \ + getisax]) AC_FUNC_ALLOCA dnl Old HAS_* names used in os/*.c. AC_CHECK_FUNC([getdtablesize], diff --git a/fb/fbpict.c b/fb/fbpict.c index eb305b906..d839994ae 100644 --- a/fb/fbpict.c +++ b/fb/fbpict.c @@ -1435,6 +1435,10 @@ fbPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats) */ #if !defined(__amd64__) && !defined(__x86_64__) +#ifdef HAVE_GETISAX +#include +#endif + enum CPUFeatures { NoFeatures = 0, MMX = 0x1, @@ -1445,7 +1449,23 @@ enum CPUFeatures { }; static unsigned int detectCPUFeatures(void) { + unsigned int features = 0; unsigned int result; + +#ifdef HAVE_GETISAX + if (getisax(&result, 1)) { + if (result & AV_386_CMOV) + features |= CMOV; + if (result & AV_386_MMX) + features |= MMX; + if (result & AV_386_AMD_MMX) + features |= MMX_Extensions; + if (result & AV_386_SSE) + features |= SSE; + if (result & AV_386_SSE2) + features |= SSE2; + } +#else char vendor[13]; vendor[0] = 0; vendor[12] = 0; @@ -1454,7 +1474,8 @@ static unsigned int detectCPUFeatures(void) { * %esp here. We can't declare either one as clobbered * since they are special registers (%ebx is the "PIC * register" holding an offset to global data, %esp the - * stack pointer), so we need to make sure they have their+ * original values when we access the output operands. + * stack pointer), so we need to make sure they have their + * original values when we access the output operands. */ __asm__ ("pushf\n" "pop %%eax\n" @@ -1490,7 +1511,6 @@ static unsigned int detectCPUFeatures(void) { : "%eax", "%ecx", "%edx" ); - unsigned int features = 0; if (result) { /* result now contains the standard feature bits */ if (result & (1 << 15)) @@ -1524,6 +1544,7 @@ static unsigned int detectCPUFeatures(void) { features |= MMX_Extensions; } } +#endif /* HAVE_GETISAX */ return features; } diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 53858e968..a92024217 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -112,6 +112,9 @@ /* Define to 1 if you have the `geteuid' function. */ #undef HAVE_GETEUID +/* Define to 1 if you have the `getisax' function. */ +#undef HAVE_GETISAX + /* Define to 1 if you have the `getopt' function. */ #undef HAVE_GETOPT From c5dc997baf57ffa08025efadbbaf761296ce4bc4 Mon Sep 17 00:00:00 2001 From: Joshua Baergen Date: Thu, 19 Oct 2006 11:14:26 -0700 Subject: [PATCH 10/13] Create xorg.conf.example (Gentoo bug #138623). --- configure.ac | 1 + hw/xfree86/Makefile.am | 18 ++++++++++++++++++ hw/xfree86/xorgconf.cpp | 5 +---- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/configure.ac b/configure.ac index 2467e7973..9700d61a5 100644 --- a/configure.ac +++ b/configure.ac @@ -836,6 +836,7 @@ VENDOR_MAN_VERSION="Version ${VENDOR_VERSION_STRING}" AC_DEFINE_DIR(COMPILEDDEFAULTFONTPATH, FONTPATH, [Default font path]) AC_DEFINE_DIR(RGB_DB, RGBPATH, [Default RGB path]) +AC_DEFINE_DIR(BASE_FONT_PATH, FONTDIR, [Default base font path]) AC_DEFINE_DIR(DRI_DRIVER_PATH, DRI_DRIVER_PATH, [Default DRI driver path]) AC_DEFINE_UNQUOTED(XVENDORNAME, ["$VENDOR_STRING"], [Vendor name]) AC_DEFINE_UNQUOTED(XVENDORNAMESHORT, ["$VENDOR_STRING_SHORT"], [Short vendor name]) diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am index 5cce11d27..79d2ec5c0 100644 --- a/hw/xfree86/Makefile.am +++ b/hw/xfree86/Makefile.am @@ -1,3 +1,5 @@ +include $(top_srcdir)/cpprules.in + if DRI DRI_SUBDIR = dri endif @@ -82,7 +84,23 @@ endif optionsdir = $(libdir)/X11 dist_options_DATA = Options +BUILT_SOURCES = xorg.conf.example +CLEAN = xorg.conf.example xorg.conf.example.pre EXTRA_DIST = xorgconf.cpp +CPP_FILES_FLAGS = \ + -DRGBPATH=\"$(RGB_DB)\" \ + -DLOCALFONTPATH="\"$(BASE_FONT_PATH)/local\"" \ + -DMISCFONTPATH="\"$(BASE_FONT_PATH)/misc\"" \ + -DT1FONTPATH="\"$(BASE_FONT_PATH)/Type1\"" \ + -DTRUETYPEFONTPATH="\"$(BASE_FONT_PATH)/TTF\"" \ + -DCIDFONTPATH="\"$(BASE_FONT_PATH)/CID\"" \ + -DDPI75FONTPATH="\"$(BASE_FONT_PATH)/75dpi\"" \ + -DDPI100FONTPATH="\"$(BASE_FONT_PATH)/100dpi\"" \ + -DMODULEPATH=\"$(DEFAULT_MODULE_PATH)\" + relink: rm -f Xorg && $(MAKE) Xorg + +xorg.conf.example.pre: xorgconf.cpp + cp $< $@ diff --git a/hw/xfree86/xorgconf.cpp b/hw/xfree86/xorgconf.cpp index df6704f5c..71abe130d 100644 --- a/hw/xfree86/xorgconf.cpp +++ b/hw/xfree86/xorgconf.cpp @@ -54,12 +54,9 @@ XCOMM command (or a combination of both methods) FontPath LOCALFONTPATH FontPath MISCFONTPATH - FontPath DPI75USFONTPATH - FontPath DPI100USFONTPATH FontPath T1FONTPATH - FontPath TRUETYPEFONTPATH + FontPath TRUETYPEFONTPATH FontPath CIDFONTPATH - FontPath SPFONTPATH FontPath DPI75FONTPATH FontPath DPI100FONTPATH From b0780312d80ea4af0136227f90fdd7ada3db71c5 Mon Sep 17 00:00:00 2001 From: Alan Coopersmith Date: Thu, 19 Oct 2006 13:51:53 -0700 Subject: [PATCH 11/13] Pre-release message should tell users to check git, not CVS, for updates --- hw/xfree86/common/xf86Init.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xfree86/common/xf86Init.c b/hw/xfree86/common/xf86Init.c index a49bd541b..33351f2c1 100644 --- a/hw/xfree86/common/xf86Init.c +++ b/hw/xfree86/common/xf86Init.c @@ -1651,8 +1651,8 @@ xf86PrintBanner() "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" "Select the \"xorg\" product for bugs you find in this release.\n" "Before reporting bugs in pre-release versions please check the\n" - "latest version in the X.Org Foundation CVS repository.\n" - "See http://wiki.x.org/wiki/CvsPage for CVS access instructions.\n"); + "latest version in the X.Org Foundation git repository.\n" + "See http://wiki.x.org/wiki/GitPage for git access instructions.\n"); #endif ErrorF("\nX Window System Version %d.%d.%d", XORG_VERSION_MAJOR, From a8d3dad9d9f2b9053843e655abe463a68ba8dcb7 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 20 Oct 2006 00:28:40 +0300 Subject: [PATCH 12/13] xi: add DEVICE_ENABLE control Add DEVICE_ENABLE control, which allows runtime enabling and disabling of specific devices. --- Xi/chgdctl.c | 23 +++++++++++++++++++++++ Xi/getdctl.c | 24 ++++++++++++++++++++++++ Xi/getdctl.h | 5 +++++ dix/devices.c | 4 ++++ include/inputstr.h | 1 + 5 files changed, 57 insertions(+) diff --git a/Xi/chgdctl.c b/Xi/chgdctl.c index ebe086548..4b9c2b6ed 100644 --- a/Xi/chgdctl.c +++ b/Xi/chgdctl.c @@ -106,6 +106,7 @@ ProcXChangeDeviceControl(ClientPtr client) CARD32 *resolution; xDeviceTSCtl *ts; xDeviceCoreCtl *c; + xDeviceEnableCtl *e; REQUEST(xChangeDeviceControlReq); REQUEST_AT_LEAST_SIZE(xChangeDeviceControlReq); @@ -217,6 +218,28 @@ ProcXChangeDeviceControl(ClientPtr client) return Success; } + break; + case DEVICE_ENABLE: + e = (xDeviceEnableCtl *)&stuff[1]; + + status = ChangeDeviceControl(client, dev, (xDeviceCtl *) e); + + if (status == Success) { + if (e->enable) + EnableDevice(dev); + else + DisableDevice(dev); + } else if (status == DeviceBusy) { + rep.status = DeviceBusy; + WriteReplyToClient(client, sizeof(xChangeDeviceControlReply), + &rep); + return Success; + } else { + SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, + BadMatch); + return Success; + } + break; default: SendErrorToClient(client, IReqCode, X_ChangeDeviceControl, 0, BadValue); diff --git a/Xi/getdctl.c b/Xi/getdctl.c index 66342b340..2ae6ef302 100644 --- a/Xi/getdctl.c +++ b/Xi/getdctl.c @@ -136,6 +136,9 @@ ProcXGetDeviceControl(ClientPtr client) case DEVICE_CORE: total_length = sizeof(xDeviceCoreCtl); break; + case DEVICE_ENABLE: + total_length = sizeof(xDeviceEnableCtl); + break; default: SendErrorToClient(client, IReqCode, X_GetDeviceControl, 0, BadValue); return Success; @@ -157,6 +160,10 @@ ProcXGetDeviceControl(ClientPtr client) break; case DEVICE_CORE: CopySwapDeviceCore(client, dev, buf); + break; + case DEVICE_ENABLE: + CopySwapDeviceEnable(client, dev, buf); + break; default: break; } @@ -239,6 +246,7 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) c->control = DEVICE_CORE; c->length = sizeof(c); c->status = dev->coreEvents; + c->iscore = (dev == inputInfo.keyboard || dev == inputInfo.pointer); if (client->swapped) { swaps(&c->control, n); @@ -247,6 +255,22 @@ void CopySwapDeviceCore (ClientPtr client, DeviceIntPtr dev, char *buf) } } +void CopySwapDeviceEnable (ClientPtr client, DeviceIntPtr dev, char *buf) +{ + register char n; + xDeviceEnableState *e = (xDeviceEnableState *) buf; + + e->control = DEVICE_ENABLE; + e->length = sizeof(e); + e->enable = dev->enabled; + + if (client->swapped) { + swaps(&e->control, n); + swaps(&e->length, n); + swaps(&e->enable, n); + } +} + /*********************************************************************** * diff --git a/Xi/getdctl.h b/Xi/getdctl.h index 1417d1b38..1331a327c 100644 --- a/Xi/getdctl.h +++ b/Xi/getdctl.h @@ -52,6 +52,11 @@ void CopySwapDeviceCore(ClientPtr /* client */ , char * /* buf */ ); +void CopySwapDeviceEnable(ClientPtr /* client */ , + DeviceIntPtr /* dev */ , + char * /* buf */ + ); + void SRepXGetDeviceControl(ClientPtr /* client */ , int /* size */ , xGetDeviceControlReply * /* rep */ diff --git a/dix/devices.c b/dix/devices.c index 0121eea97..7b4be0e36 100644 --- a/dix/devices.c +++ b/dix/devices.c @@ -130,6 +130,8 @@ AddInputDevice(DeviceProc deviceProc, Bool autoStart) dev->devPrivates = NULL; dev->unwrapProc = NULL; dev->coreEvents = TRUE; + dev->inited = FALSE; + dev->enabled = FALSE; for (prev = &inputInfo.off_devices; *prev; prev = &(*prev)->next) ; @@ -154,6 +156,7 @@ EnableDevice(register DeviceIntPtr dev) ErrorF("couldn't enable device %d\n", dev->id); return FALSE; } + dev->enabled = TRUE; *prev = dev->next; for (prev = &inputInfo.devices; *prev; prev = &(*prev)->next) @@ -176,6 +179,7 @@ DisableDevice(register DeviceIntPtr dev) if (*prev != dev) return FALSE; (void)(*dev->deviceProc)(dev, DEVICE_OFF); + dev->enabled = FALSE; *prev = dev->next; dev->next = inputInfo.off_devices; inputInfo.off_devices = dev; diff --git a/include/inputstr.h b/include/inputstr.h index e12b64195..64763213a 100644 --- a/include/inputstr.h +++ b/include/inputstr.h @@ -265,6 +265,7 @@ typedef struct _DeviceIntRec { used to initialize, turn on, or turn off the device */ Bool inited; /* TRUE if INIT returns Success */ + Bool enabled; /* TRUE if ON returns Success */ Bool coreEvents; /* TRUE if device also sends core */ GrabPtr grab; /* the grabber - used by DIX */ struct { From aeba855b07832354f59678e20cc29a085e42bd99 Mon Sep 17 00:00:00 2001 From: Daniel Stone Date: Fri, 20 Oct 2006 00:30:28 +0300 Subject: [PATCH 13/13] move keymap copy to event processing, from enqueuing Move the keymap copying to event processing time (in ProcessInputEvents), instead of being at event enqueuing time. Break SetCore{Pointer,Keyboard} out into separate functions. Change mieqEnqueue to take a device pointer, that asks for the _original_ device associated with this event. --- dix/getevents.c | 54 ++++++++++-- hw/kdrive/src/kinput.c | 10 +-- hw/xfree86/common/xf86DGA.c | 46 ----------- hw/xfree86/common/xf86Events.c | 13 +-- hw/xfree86/common/xf86Xinput.c | 21 +---- include/input.h | 3 + mi/mi.h | 1 + mi/mieq.c | 146 +++++++++++++++------------------ 8 files changed, 129 insertions(+), 165 deletions(-) diff --git a/dix/getevents.c b/dix/getevents.c index 4f9608053..42b9df9d2 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -481,19 +481,19 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, xv->deviceid = kbp->deviceid; switch (final_valuator - i) { case 6: - xv->valuator5 = valuators[i+5]; + xv->valuator5 = valuators[i + 5]; case 5: - xv->valuator4 = valuators[i+4]; + xv->valuator4 = valuators[i + 4]; case 4: - xv->valuator3 = valuators[i+3]; + xv->valuator3 = valuators[i + 3]; case 3: - xv->valuator2 = valuators[i+2]; + xv->valuator2 = valuators[i + 2]; case 2: /* x and y may have been accelerated. */ if (i == 0) xv->valuator1 = kbp->root_y; else - xv->valuator1 = valuators[i+1]; + xv->valuator1 = valuators[i + 1]; case 1: /* x and y may have been accelerated. */ if (i == 0) @@ -520,11 +520,47 @@ GetPointerEvents(xEvent *events, DeviceIntPtr pDev, int type, int buttons, else { events->u.u.detail = 0; } - - if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != - pDev) - inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; } return num_events; } + +void SwitchCoreKeyboard(DeviceIntPtr pDev) +{ + KeyClassPtr ckeyc = inputInfo.keyboard->key; + + if (inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) { + memcpy(ckeyc->modifierMap, pDev->key->modifierMap, MAP_LENGTH); + if (ckeyc->modifierKeyMap) + xfree(ckeyc->modifierKeyMap); + ckeyc->modifierKeyMap = xalloc(8 * pDev->key->maxKeysPerModifier); + memcpy(ckeyc->modifierKeyMap, pDev->key->modifierKeyMap, + (8 * pDev->key->maxKeysPerModifier)); + + ckeyc->maxKeysPerModifier = pDev->key->maxKeysPerModifier; + ckeyc->curKeySyms.minKeyCode = pDev->key->curKeySyms.minKeyCode; + ckeyc->curKeySyms.maxKeyCode = pDev->key->curKeySyms.maxKeyCode; + SetKeySymsMap(&ckeyc->curKeySyms, &pDev->key->curKeySyms); + +#ifdef XKB + if (!noXkbExtension && pDev->key->xkbInfo && pDev->key->xkbInfo->desc) { + if (!XkbCopyKeymap(pDev->key->xkbInfo->desc, ckeyc->xkbInfo->desc, + True)) + FatalError("Couldn't pivot keymap from device to core!\n"); + } +#endif + + SendMappingNotify(MappingKeyboard, ckeyc->curKeySyms.minKeyCode, + (ckeyc->curKeySyms.maxKeyCode - + ckeyc->curKeySyms.minKeyCode), + serverClient); + inputInfo.keyboard->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; + } +} + +/* Currently a no-op. */ +void SwitchCorePointer(DeviceIntPtr pDev) +{ + if (inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr != pDev) + inputInfo.pointer->devPrivates[CoreDevicePrivatesIndex].ptr = pDev; +} diff --git a/hw/kdrive/src/kinput.c b/hw/kdrive/src/kinput.c index 8dd372829..449be9e06 100644 --- a/hw/kdrive/src/kinput.c +++ b/hw/kdrive/src/kinput.c @@ -1656,10 +1656,10 @@ char *kdActionNames[] = { #endif static void -KdQueueEvent (xEvent *ev) +KdQueueEvent (DeviceIntPtr pDev, xEvent *ev) { KdAssertSigioBlocked ("KdQueueEvent"); - mieqEnqueue (ev); + mieqEnqueue (pDev, ev); } /* We return true if we're stealing the event. */ @@ -1862,7 +1862,7 @@ KdReleaseAllKeys (void) KdHandleKeyboardEvent(ki, KeyRelease, key); nEvents = GetKeyboardEvents(kdEvents, ki->dixdev, KeyRelease, key); for (i = 0; i < nEvents; i++) - KdQueueEvent (kdEvents + i); + KdQueueEvent (ki->dixdev, kdEvents + i); } } } @@ -1934,7 +1934,7 @@ KdEnqueueKeyboardEvent(KdKeyboardInfo *ki, ErrorF("KdEnqueueKeyboardEvent: got %d events from GKE\n", nEvents); #endif for (i = 0; i < nEvents; i++) - KdQueueEvent(kdEvents + i); + KdQueueEvent(ki->dixdev, kdEvents + i); } else { ErrorF("driver %s wanted to post scancode %d outside of [%d, %d]!\n", @@ -2052,7 +2052,7 @@ _KdEnqueuePointerEvent (KdPointerInfo *pi, int type, int x, int y, int z, nEvents = GetPointerEvents(kdEvents, pi->dixdev, type, b, absrel, 0, 3, valuators); for (i = 0; i < nEvents; i++) - KdQueueEvent(kdEvents + i); + KdQueueEvent(pi->dixdev, kdEvents + i); } void diff --git a/hw/xfree86/common/xf86DGA.c b/hw/xfree86/common/xf86DGA.c index cb7783994..204457fb1 100644 --- a/hw/xfree86/common/xf86DGA.c +++ b/hw/xfree86/common/xf86DGA.c @@ -909,22 +909,6 @@ DGAVTSwitch(void) Bool DGAStealKeyEvent(int index, xEvent *e) { - DGAScreenPtr pScreenPriv; - dgaEvent de; - - if(DGAScreenIndex < 0) /* no DGA */ - return FALSE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if(!pScreenPriv || !pScreenPriv->grabKeyboard) /* no direct mode */ - return FALSE; - - de.u.u.type = e->u.u.type + *XDGAEventBase; - de.u.u.detail = e->u.u.detail; - de.u.event.time = e->u.keyButtonPointer.time; - mieqEnqueue ((xEvent *) &de); - return TRUE; } static int DGAMouseX, DGAMouseY; @@ -932,36 +916,6 @@ static int DGAMouseX, DGAMouseY; Bool DGAStealMouseEvent(int index, xEvent *e, int dx, int dy) { - DGAScreenPtr pScreenPriv; - dgaEvent de; - - if(DGAScreenIndex < 0) /* no DGA */ - return FALSE; - - pScreenPriv = DGA_GET_SCREEN_PRIV(screenInfo.screens[index]); - - if(!pScreenPriv || !pScreenPriv->grabMouse) /* no direct mode */ - return FALSE; - - DGAMouseX += dx; - if (DGAMouseX < 0) - DGAMouseX = 0; - else if (DGAMouseX > screenInfo.screens[index]->width) - DGAMouseX = screenInfo.screens[index]->width; - DGAMouseY += dy; - if (DGAMouseY < 0) - DGAMouseY = 0; - else if (DGAMouseY > screenInfo.screens[index]->height) - DGAMouseY = screenInfo.screens[index]->height; - de.u.u.type = e->u.u.type + *XDGAEventBase; - de.u.u.detail = e->u.u.detail; - de.u.event.time = e->u.keyButtonPointer.time; - de.u.event.dx = dx; - de.u.event.dy = dy; - de.u.event.pad1 = DGAMouseX; - de.u.event.pad2 = DGAMouseY; - mieqEnqueue ((xEvent *) &de); - return TRUE; } Bool diff --git a/hw/xfree86/common/xf86Events.c b/hw/xfree86/common/xf86Events.c index db259b3b2..3df201aa7 100644 --- a/hw/xfree86/common/xf86Events.c +++ b/hw/xfree86/common/xf86Events.c @@ -104,19 +104,12 @@ extern Bool noXkbExtension; #define XE_POINTER 1 #define XE_KEYBOARD 2 -#define __EqEnqueue(ev) mieqEnqueue(ev) - -#define EqEnqueue(ev) { \ +#define EqEnqueue(pDev, ev) { \ int __sigstate = xf86BlockSIGIO (); \ - __EqEnqueue (ev); \ + mieqEnqueue (pDev, ev); \ xf86UnblockSIGIO(__sigstate); \ } -#define ENQUEUE(ev, code, direction, dev_type) \ - (ev)->u.u.detail = (code); \ - (ev)->u.u.type = (direction); \ - EqEnqueue((ev)) - /* * The first of many hacks to get VT switching to work under * Solaris 2.1 for x86. The basic problem is that Solaris is supposed @@ -839,7 +832,7 @@ xf86ReleaseKeys(DeviceIntPtr pDev) else { nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i); for (j = 0; j < nevents; j++) - mieqEnqueue(xf86Events + i); + EqEnqueue(pDev, xf86Events + i); } break; } diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 411deddab..97c038f7b 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -656,20 +656,7 @@ xf86PostMotionEvent(DeviceIntPtr device, valuators); for (i = 0; i < nevents; i++) - mieqEnqueue(xf86Events + i); - -#if 0 - if (HAS_MOTION_HISTORY(local)) { - buff = ((char *)local->motion_history + - (sizeof(INT32) * local->dev->valuator->numAxes + sizeof(Time)) * local->last); - } - - if (HAS_MOTION_HISTORY(local)) { - local->last = (local->last + 1) % device->valuator->numMotionEvents; - if (local->last == local->first) - local->first = (local->first + 1) % device->valuator->numMotionEvents; - } -#endif + mieqEnqueue(device, xf86Events + i); } _X_EXPORT void @@ -795,7 +782,7 @@ xf86PostButtonEvent(DeviceIntPtr device, first_valuator, num_valuators, valuators); for (i = 0; i < nevents; i++) - mieqEnqueue(xf86Events + i); + mieqEnqueue(device, xf86Events + i); } _X_EXPORT void @@ -839,7 +826,7 @@ xf86PostKeyEvent(DeviceIntPtr device, } for (i = 0; i < nevents; i++) - mieqEnqueue(xf86Events + i); + mieqEnqueue(device, xf86Events + i); } _X_EXPORT void @@ -858,7 +845,7 @@ xf86PostKeyboardEvent(DeviceIntPtr device, is_down ? KeyPress : KeyRelease, key_code); for (i = 0; i < nevents; i++) - mieqEnqueue(xf86Events + i); + mieqEnqueue(device, xf86Events + i); } /* diff --git a/include/input.h b/include/input.h index 3e3d16d2b..a9eeb3f62 100644 --- a/include/input.h +++ b/include/input.h @@ -406,6 +406,9 @@ extern int GetKeyboardValuatorEvents( int num_valuator, int *valuators); +extern void SwitchCoreKeyboard(DeviceIntPtr pDev); +extern void SwitchCorePointer(DeviceIntPtr pDev); + extern DeviceIntPtr LookupDeviceIntRec( CARD8 deviceid); diff --git a/mi/mi.h b/mi/mi.h index 89d460fb7..8d9d120bd 100644 --- a/mi/mi.h +++ b/mi/mi.h @@ -173,6 +173,7 @@ extern Bool mieqInit( ); extern void mieqEnqueue( + DeviceIntPtr /*pDev*/, xEventPtr /*e*/ ); diff --git a/mi/mieq.c b/mi/mieq.c index 16e638c64..0ac68d6e8 100644 --- a/mi/mieq.c +++ b/mi/mieq.c @@ -73,14 +73,14 @@ typedef struct _EventQueue { static EventQueueRec miEventQueue; Bool -mieqInit () +mieqInit() { miEventQueue.head = miEventQueue.tail = 0; miEventQueue.lastEventTime = GetTimeInMillis (); miEventQueue.lastMotion = FALSE; miEventQueue.pEnqueueScreen = screenInfo.screens[0]; miEventQueue.pDequeueScreen = miEventQueue.pEnqueueScreen; - SetInputCheck (&miEventQueue.head, &miEventQueue.tail); + SetInputCheck(&miEventQueue.head, &miEventQueue.tail); return TRUE; } @@ -92,57 +92,39 @@ mieqInit () */ void -mieqEnqueue (xEvent *e) +mieqEnqueue(DeviceIntPtr pDev, xEvent *e) { HWEventQueueType oldtail = miEventQueue.tail, newtail; int isMotion = 0; - DeviceIntPtr pDev = NULL; - deviceKeyButtonPointer *kbp = (deviceKeyButtonPointer *) e; deviceValuator *v = (deviceValuator *) e; EventPtr laste = &miEventQueue.events[oldtail - 1]; deviceKeyButtonPointer *lastkbp = (deviceKeyButtonPointer *) &laste->event[0]; - if (e->u.u.type == MotionNotify) { - pDev = inputInfo.pointer; - isMotion = inputInfo.pointer->id & DEVICE_BITS; - } - else if (e->u.u.type == KeyPress || e->u.u.type == KeyRelease) { - pDev = inputInfo.keyboard; - } - else if (e->u.u.type == ButtonPress || e->u.u.type == ButtonRelease) { - pDev = inputInfo.pointer; - } - else { - pDev = LookupDeviceIntRec(kbp->deviceid & DEVICE_BITS); + if (e->u.u.type == MotionNotify) + isMotion = inputInfo.pointer->id; + else if (e->u.u.type == DeviceMotionNotify) + isMotion = pDev->id; - /* 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) { - if (laste->nevents > 6) { - ErrorF("mieqEnqueue: more than six valuator events; dropping.\n"); - return; - } - if (oldtail == miEventQueue.head || - !(lastkbp->type == DeviceMotionNotify || - lastkbp->type == DeviceButtonPress || - lastkbp->type == DeviceButtonRelease) || - ((lastkbp->deviceid & DEVICE_BITS) != - (v->deviceid & DEVICE_BITS))) { - ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n"); - return; - } - memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent)); + /* 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) { + if (laste->nevents > 6) { + ErrorF("mieqEnqueue: more than six valuator events; dropping.\n"); return; } - else if (e->u.u.type == DeviceMotionNotify) { - isMotion = pDev->id & DEVICE_BITS; + if (oldtail == miEventQueue.head || + !(lastkbp->type == DeviceMotionNotify || + lastkbp->type == DeviceButtonPress || + lastkbp->type == DeviceButtonRelease) || + (lastkbp->deviceid != v->deviceid)) { + ErrorF("mieqEnequeue: out-of-order valuator event; dropping.\n"); + return; } + memcpy(&(laste->event[laste->nevents++]), e, sizeof(xEvent)); + return; } - if (!pDev) - FatalError("Couldn't find device for event!\n"); - if (isMotion && isMotion == miEventQueue.lastMotion && oldtail != miEventQueue.head) { if (oldtail == 0) @@ -164,10 +146,8 @@ mieqEnqueue (xEvent *e) memcpy(&(miEventQueue.events[oldtail].event[0]), e, sizeof(xEvent)); miEventQueue.events[oldtail].nevents = 1; - /* - * Make sure that event times don't go backwards - this - * is "unnecessary", but very useful - */ + /* 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 = @@ -182,49 +162,59 @@ mieqEnqueue (xEvent *e) } void -mieqSwitchScreen (ScreenPtr pScreen, Bool fromDIX) +mieqSwitchScreen(ScreenPtr pScreen, Bool fromDIX) { miEventQueue.pEnqueueScreen = pScreen; if (fromDIX) miEventQueue.pDequeueScreen = pScreen; } -/* - * Call this from ProcessInputEvents() - */ - -void mieqProcessInputEvents () +/* Call this from ProcessInputEvents(). */ +void +mieqProcessInputEvents() { - EventRec *e; - int x, y; + EventRec *e = NULL; + int x = 0, y = 0; + DeviceIntPtr dev = NULL; - while (miEventQueue.head != miEventQueue.tail) - { - if (screenIsSaved == SCREEN_SAVER_ON) - SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); + while (miEventQueue.head != miEventQueue.tail) { + if (screenIsSaved == SCREEN_SAVER_ON) + SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); - e = &miEventQueue.events[miEventQueue.head]; - /* - * Assumption - screen switching can only occur on motion events - */ - if (e->pScreen != miEventQueue.pDequeueScreen) - { - miEventQueue.pDequeueScreen = e->pScreen; - x = e->event[0].u.keyButtonPointer.rootX; - y = e->event[0].u.keyButtonPointer.rootY; - if (miEventQueue.head == QUEUE_SIZE - 1) - miEventQueue.head = 0; - else - ++miEventQueue.head; - NewCurrentScreen (miEventQueue.pDequeueScreen, x, y); - } - else - { - if (miEventQueue.head == QUEUE_SIZE - 1) - miEventQueue.head = 0; - else - ++miEventQueue.head; - (*e->pDev->public.processInputProc)(e->event, e->pDev, e->nevents); - } + e = &miEventQueue.events[miEventQueue.head]; + /* Assumption - screen switching can only occur on motion events. */ + if (e->pScreen != miEventQueue.pDequeueScreen) { + miEventQueue.pDequeueScreen = e->pScreen; + x = e->event[0].u.keyButtonPointer.rootX; + y = e->event[0].u.keyButtonPointer.rootY; + if (miEventQueue.head == QUEUE_SIZE - 1) + miEventQueue.head = 0; + else + ++miEventQueue.head; + NewCurrentScreen (miEventQueue.pDequeueScreen, x, y); + } + else { + if (miEventQueue.head == QUEUE_SIZE - 1) + miEventQueue.head = 0; + else + ++miEventQueue.head; + + 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; + } + + dev->public.processInputProc(e->event, dev, e->nevents); + } } }