diff options
40 files changed, 215 insertions, 190 deletions
diff --git a/Xext/xace.c b/Xext/xace.c index c757cad05..ef69fe363 100644 --- a/Xext/xace.c +++ b/Xext/xace.c @@ -101,6 +101,10 @@ int XaceHook(int hook, ...) } u; int *prv = NULL; /* points to return value from callback */ va_list ap; /* argument list */ + + if (!XaceHooks[hook]) + return Success; + va_start(ap, hook); /* Marshal arguments for passing to callback. diff --git a/Xext/xf86bigfont.c b/Xext/xf86bigfont.c index 4b63a13a1..5053852a4 100644 --- a/Xext/xf86bigfont.c +++ b/Xext/xf86bigfont.c @@ -300,7 +300,7 @@ ProcXF86BigfontQueryVersion( #endif reply.capabilities = #ifdef HAS_SHM - (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0) + (client->local && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0) #else 0 #endif @@ -367,7 +367,7 @@ ProcXF86BigfontQueryFont( #else switch (client->req_len) { case 2: /* client with version 1.0 libX11 */ - stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0); + stuff_flags = (client->local && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0); break; case 3: /* client with version 1.1 libX11 */ stuff_flags = stuff->flags; diff --git a/Xi/exevents.c b/Xi/exevents.c index db49e31b8..6b2db4b59 100644 --- a/Xi/exevents.c +++ b/Xi/exevents.c @@ -1159,13 +1159,11 @@ TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, DeliverTouchEvents(sourcedev, ti, tel + i, ev->resource); } - /* If there are no other listeners left, then don't bother sending an - * ownership change event to no-one; if the touchpoint is pending + /* If there are no other listeners left, and the touchpoint is pending * finish, then we can just kill it now. */ - if (ti->num_listeners == 1) + if (ti->num_listeners == 1 && ti->pending_finish) { - if (ti->pending_finish) - TouchEndTouch(sourcedev, ti); + TouchEndTouch(sourcedev, ti); goto out; } @@ -1178,9 +1176,9 @@ TouchEventRejected(DeviceIntPtr sourcedev, TouchPointInfoPtr ti, ti->num_grabs--; } - /* If the current owner was removed, deliver the TouchOwnership or TouchBegin - event to the new owner. */ - if (was_owner) + /* If the current owner was removed and there are further listeners, deliver + * the TouchOwnership or TouchBegin event to the new owner. */ + if (ti->num_listeners > 0 && was_owner) TouchPuntToNextOwner(sourcedev, ti, ev); out: @@ -1803,8 +1801,10 @@ DeliverTouchEndEvent(DeviceIntPtr dev, TouchPointInfoPtr ti, InternalEvent *ev, rc = DeliverOneTouchEvent(client, dev, ti, grab, win, ev); listener->state = LISTENER_HAS_END; } - if (ti->num_listeners > 1 && - (ev->device_event.flags & (TOUCH_ACCEPT|TOUCH_REJECT)) == 0) + if ((ti->num_listeners > 1 || + (listener->type == LISTENER_GRAB && + xi2mask_isset(xi2mask, dev, XI_TouchOwnership))) && + (ev->device_event.flags & (TOUCH_ACCEPT|TOUCH_REJECT)) == 0) { ev->any.type = ET_TouchUpdate; ev->device_event.flags |= TOUCH_PENDING_END; diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c index 88de11959..c612af22c 100644 --- a/Xi/xiproperty.c +++ b/Xi/xiproperty.c @@ -706,7 +706,7 @@ XIDeleteDeviceProperty (DeviceIntPtr device, Atom property, Bool fromClient) int XIChangeDeviceProperty (DeviceIntPtr dev, Atom property, Atom type, int format, int mode, unsigned long len, - const pointer value, Bool sendevent) + const void *value, Bool sendevent) { XIPropertyPtr prop; int size_in_bytes; diff --git a/configure.ac b/configure.ac index 6de92b435..a203ab285 100644 --- a/configure.ac +++ b/configure.ac @@ -776,7 +776,7 @@ XPROTO="xproto >= 7.0.22" RANDRPROTO="randrproto >= 1.2.99.3" RENDERPROTO="renderproto >= 0.11" XEXTPROTO="xextproto >= 7.1.99" -INPUTPROTO="inputproto >= 2.1.99.3" +INPUTPROTO="inputproto >= 2.1.99.5" KBPROTO="kbproto >= 1.0.3" FONTSPROTO="fontsproto" FIXESPROTO="fixesproto >= 5.0" @@ -1024,6 +1024,13 @@ if test "x$RES" = xyes && test "x$CLIENTIDS" = xyes; then else CLIENTIDS=no fi +if test "x$CLIENTIDS" = xyes; then + case $host_os in + openbsd*) + SYS_LIBS="$SYS_LIBS -lkvm" + ;; + esac +fi AC_MSG_RESULT([$CLIENTIDS]) AM_CONDITIONAL(CLIENTIDS, [test "x$CLIENTIDS" = xyes]) diff --git a/dix/dispatch.c b/dix/dispatch.c index 048dff652..b91b41f4a 100644 --- a/dix/dispatch.c +++ b/dix/dispatch.c @@ -425,9 +425,11 @@ Dispatch(void) client->minorOp = ext->MinorOpcode(client); } #ifdef XSERVER_DTRACE - XSERVER_REQUEST_START(LookupMajorName(client->majorOp), client->majorOp, - ((xReq *)client->requestBuffer)->length, - client->index, client->requestBuffer); + if (XSERVER_REQUEST_START_ENABLED()) + XSERVER_REQUEST_START(LookupMajorName(client->majorOp), + client->majorOp, + ((xReq *)client->requestBuffer)->length, + client->index, client->requestBuffer); #endif if (result > (maxBigRequestSize << 2)) result = BadLength; @@ -438,8 +440,10 @@ Dispatch(void) XaceHookAuditEnd(client, result); } #ifdef XSERVER_DTRACE - XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), client->majorOp, - client->sequence, client->index, result); + if (XSERVER_REQUEST_DONE_ENABLED()) + XSERVER_REQUEST_DONE(LookupMajorName(client->majorOp), + client->majorOp, client->sequence, + client->index, result); #endif if (client->noClientException != Success) @@ -3578,12 +3582,14 @@ ProcInitialConnection(ClientPtr client) REQUEST(xReq); xConnClientPrefix *prefix; int whichbyte = 1; + char order; prefix = (xConnClientPrefix *)((char *)stuff + sz_xReq); - if ((prefix->byteOrder != 'l') && (prefix->byteOrder != 'B')) + order = prefix->byteOrder; + if (order != 'l' && order != 'B' && order != 'r' && order != 'R') return client->noClientException = -1; - if (((*(char *) &whichbyte) && (prefix->byteOrder == 'B')) || - (!(*(char *) &whichbyte) && (prefix->byteOrder == 'l'))) + if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) || + (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) { client->swapped = TRUE; SwapConnClientPrefix(prefix); @@ -3595,6 +3601,10 @@ ProcInitialConnection(ClientPtr client) { swaps(&stuff->length); } + if (order == 'r' || order == 'R') + { + client->local = FALSE; + } ResetCurrentRequest(client); return Success; } diff --git a/dix/dixutils.c b/dix/dixutils.c index 00bbde67c..da26dc144 100644 --- a/dix/dixutils.c +++ b/dix/dixutils.c @@ -202,13 +202,12 @@ dixLookupDrawable(DrawablePtr *pDraw, XID id, ClientPtr client, int rc; *pDraw = NULL; - client->errorValue = id; - - if (id == INVALID) - return BadDrawable; rc = dixLookupResourceByClass((pointer *)&pTmp, id, RC_DRAWABLE, client, access); + if (rc != Success) + client->errorValue = id; + if (rc == BadValue) return BadDrawable; if (rc != Success) @@ -225,7 +224,15 @@ dixLookupWindow(WindowPtr *pWin, XID id, ClientPtr client, Mask access) { int rc; rc = dixLookupDrawable((DrawablePtr*)pWin, id, client, M_WINDOW, access); - return (rc == BadDrawable) ? BadWindow : rc; + /* dixLookupDrawable returns BadMatch iff id is a valid Drawable + but is not a Window. Users of dixLookupWindow expect a BadWindow + error in this case; they don't care that it's a valid non-Window XID */ + if (rc == BadMatch) + rc = BadWindow; + /* Similarly, users of dixLookupWindow don't want BadDrawable. */ + if (rc == BadDrawable) + rc = BadWindow; + return rc; } int diff --git a/dix/enterleave.c b/dix/enterleave.c index a39e64001..89a82ab99 100644 --- a/dix/enterleave.c +++ b/dix/enterleave.c @@ -1292,14 +1292,17 @@ DeviceFocusEvents(DeviceIntPtr dev, NotifyPointer); DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from); /* next call catches the root too, if the screen changed */ - DeviceFocusOutEvents(dev, from->parent, NullWindow, mode, + DeviceFocusOutEvents(dev, from, NullWindow, mode, NotifyNonlinearVirtual); } /* Notify all the roots */ for (i = 0; i < nscreens; i++) DeviceFocusEvent(dev, XI_FocusIn, mode, in, screenInfo.screens[i]->root); if (to == PointerRootWin) + { DeviceFocusInEvents(dev, GetCurrentRootWindow(dev), sprite->win, mode, NotifyPointer); + DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyPointer, sprite->win); + } } else { @@ -1321,7 +1324,7 @@ DeviceFocusEvents(DeviceIntPtr dev, if (IsParent(to, from)) { DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyAncestor, from); - DeviceFocusOutEvents(dev, from->parent, to, mode, + DeviceFocusOutEvents(dev, from, to, mode, NotifyVirtual); DeviceFocusEvent(dev, XI_FocusIn, mode, NotifyInferior, to); if ((IsParent(to, sprite->win)) && @@ -1353,7 +1356,7 @@ DeviceFocusEvents(DeviceIntPtr dev, NotifyPointer); DeviceFocusEvent(dev, XI_FocusOut, mode, NotifyNonlinear, from); if (from->parent != NullWindow) - DeviceFocusOutEvents(dev, from->parent, common, mode, + DeviceFocusOutEvents(dev, from, common, mode, NotifyNonlinearVirtual); if (to->parent != NullWindow) DeviceFocusInEvents(dev, common, to, mode, NotifyNonlinearVirtual); diff --git a/dix/eventconvert.c b/dix/eventconvert.c index 017c87190..60dc22fff 100644 --- a/dix/eventconvert.c +++ b/dix/eventconvert.c @@ -691,6 +691,10 @@ eventToDeviceEvent(DeviceEvent *ev, xEvent **xi) else xde->flags = ev->flags; + if (IsTouchEvent((InternalEvent*)ev) && + ev->flags & TOUCH_POINTER_EMULATED) + xde->flags |= XITouchEmulatingPointer; + if (ev->key_repeat) xde->flags |= XIKeyRepeat; diff --git a/dix/getevents.c b/dix/getevents.c index 3b40a5bb7..d0014e617 100644 --- a/dix/getevents.c +++ b/dix/getevents.c @@ -1328,7 +1328,7 @@ fill_pointer_events(InternalEvent *events, DeviceIntPtr pDev, int type, storeLastValuators(pDev, &mask, 0, 1, devx, devy); /* Update the MD's co-ordinates, which are always in desktop space. */ - if (!IsMaster(pDev) || !IsFloating(pDev)) { + if (!IsMaster(pDev) && !IsFloating(pDev)) { DeviceIntPtr master = GetMaster(pDev, MASTER_POINTER); master->last.valuators[0] = screenx; master->last.valuators[1] = screeny; diff --git a/dix/property.c b/dix/property.c index a1ae5305d..d933d5cec 100644 --- a/dix/property.c +++ b/dix/property.c @@ -474,7 +474,7 @@ ProcGetProperty(ClientPtr client) } rc = dixLookupWindow(&pWin, stuff->window, client, win_mode); if (rc != Success) - return (rc == BadMatch) ? BadWindow : rc; + return rc; if (!ValidAtom(stuff->property)) { diff --git a/hw/kdrive/ephyr/ephyrdriext.c b/hw/kdrive/ephyr/ephyrdriext.c index 0741a7294..85e38e058 100644 --- a/hw/kdrive/ephyr/ephyrdriext.c +++ b/hw/kdrive/ephyr/ephyrdriext.c @@ -586,7 +586,7 @@ ProcXF86DRIQueryDirectRenderingCapable (register ClientPtr client) } rep.isCapable = isCapable; - if (!LocalClient(client) || client->swapped) + if (!client->local || client->swapped) rep.isCapable = 0; if (client->swapped) { @@ -1253,7 +1253,7 @@ ProcXF86DRIDispatch (register ClientPtr client) } } - if (!LocalClient(client)) + if (!client->local) return DRIErrorBase + XF86DRIClientNotLocal; switch (stuff->data) diff --git a/hw/xfree86/Makefile.am b/hw/xfree86/Makefile.am index 4f0877290..72be8891c 100644 --- a/hw/xfree86/Makefile.am +++ b/hw/xfree86/Makefile.am @@ -11,9 +11,7 @@ if XF86UTILS XF86UTILS_SUBDIR = utils endif -if XAA XAA_SUBDIR = xaa -endif if VGAHW VGAHW_SUBDIR = vgahw diff --git a/hw/xfree86/common/compiler.h b/hw/xfree86/common/compiler.h index 9e00d7571..34e60c52a 100644 --- a/hw/xfree86/common/compiler.h +++ b/hw/xfree86/common/compiler.h @@ -397,25 +397,6 @@ extern _X_EXPORT unsigned int inl(unsigned int port); #include <machine/pio.h> #endif /* __NetBSD__ */ -# elif defined(linux) && defined(__ia64__) - -# include <inttypes.h> - -# include <sys/io.h> - -# undef outb -# undef outw -# undef outl -# undef inb -# undef inw -# undef inl -extern _X_EXPORT void outb(unsigned long port, unsigned char val); -extern _X_EXPORT void outw(unsigned long port, unsigned short val); -extern _X_EXPORT void outl(unsigned long port, unsigned int val); -extern _X_EXPORT unsigned int inb(unsigned long port); -extern _X_EXPORT unsigned int inw(unsigned long port); -extern _X_EXPORT unsigned int inl(unsigned long port); - # elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__) # include <inttypes.h> diff --git a/hw/xfree86/common/xf86Xinput.c b/hw/xfree86/common/xf86Xinput.c index 280a6ec93..fd40f28da 100644 --- a/hw/xfree86/common/xf86Xinput.c +++ b/hw/xfree86/common/xf86Xinput.c @@ -970,15 +970,16 @@ NewInputDeviceRequest (InputOption *options, InputAttributes *attrs, pInfo->attrs = DuplicateInputAttributes(attrs); } - if (!pInfo->driver || !pInfo->name) { - xf86Msg(X_INFO, "No input driver/identifier specified (ignoring)\n"); + if (!pInfo->name) { + xf86Msg(X_INFO, "No identifier specified, ignoring this device.\n"); rval = BadRequest; goto unwind; } - if (!pInfo->name) { - xf86Msg(X_ERROR, "No device identifier specified (ignoring)\n"); - rval = BadMatch; + if (!pInfo->driver) { + xf86Msg(X_INFO, "No input driver specified, ignoring this device.\n"); + xf86Msg(X_INFO, "This device may have been added with another device file.\n"); + rval = BadRequest; goto unwind; } diff --git a/hw/xfree86/ddc/ddcProperty.c b/hw/xfree86/ddc/ddcProperty.c index 5d6eec927..c3aced5c2 100644 --- a/hw/xfree86/ddc/ddcProperty.c +++ b/hw/xfree86/ddc/ddcProperty.c @@ -33,7 +33,6 @@ #include <string.h> #define EDID1_ATOM_NAME "XFree86_DDC_EDID1_RAWDATA" -#define EDID2_ATOM_NAME "XFree86_DDC_EDID2_RAWDATA" static void edidMakeAtom(int i, const char *name, CARD8 *data, int size) @@ -52,59 +51,21 @@ edidMakeAtom(int i, const char *name, CARD8 *data, int size) static void addRootWindowProperties(ScrnInfoPtr pScrn, xf86MonPtr DDC) { - int i, scrnIndex = pScrn->scrnIndex; - Bool makeEDID1prop = FALSE; - Bool makeEDID2prop = FALSE; + int scrnIndex = pScrn->scrnIndex; if (DDC->flags & MONITOR_DISPLAYID) { /* Don't bother, use RANDR already */ return; } else if (DDC->ver.version == 1) { - makeEDID1prop = TRUE; - } else if (DDC->ver.version == 2) { - int checksum1; - int checksum2; - makeEDID2prop = TRUE; + int size = 128 + + (DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0); - /* Some monitors (eg Panasonic PanaSync4) - * report version==2 because they used EDID v2 spec document, - * although they use EDID v1 data structure :-( - * - * Try using checksum to determine when we have such a monitor. - */ - checksum2 = 0; - for (i = 0; i < 256; i++) - checksum2 += DDC->rawData[i]; - if (checksum2 % 256) { - xf86DrvMsg(scrnIndex, X_INFO, "Monitor EDID v2 checksum failed\n"); - xf86DrvMsg(scrnIndex, X_INFO, - "XFree86_DDC_EDID2_RAWDATA property may be bad\n"); - checksum1 = 0; - for (i = 0; i < 128; i++) - checksum1 += DDC->rawData[i]; - if (!(checksum1 % 256)) { - xf86DrvMsg(scrnIndex, X_INFO, - "Monitor EDID v1 checksum passed,\n"); - xf86DrvMsg(scrnIndex, X_INFO, - "XFree86_DDC_EDID1_RAWDATA property created\n"); - makeEDID1prop = TRUE; - } - } + edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size); } else { xf86DrvMsg(scrnIndex, X_PROBED, "unexpected EDID version %d.%d\n", DDC->ver.version, DDC->ver.revision); return; } - - if (makeEDID1prop) { - int size = 128 + - (DDC->flags & EDID_COMPLETE_RAWDATA ? DDC->no_sections * 128 : 0); - - edidMakeAtom(scrnIndex, EDID1_ATOM_NAME, DDC->rawData, size); - } - - if (makeEDID2prop) - edidMakeAtom(scrnIndex, EDID2_ATOM_NAME, DDC->rawData, 256); } Bool diff --git a/hw/xfree86/dixmods/extmod/xf86dga2.c b/hw/xfree86/dixmods/extmod/xf86dga2.c index 4bcf77efd..4b17f152e 100644 --- a/hw/xfree86/dixmods/extmod/xf86dga2.c +++ b/hw/xfree86/dixmods/extmod/xf86dga2.c @@ -928,7 +928,7 @@ ProcXDGADispatch (ClientPtr client) { REQUEST(xReq); - if (!LocalClient(client)) + if (!client->local) return DGAErrorBase + XF86DGAClientNotLocal; #ifdef DGA_REQ_DEBUG diff --git a/hw/xfree86/dixmods/extmod/xf86vmode.c b/hw/xfree86/dixmods/extmod/xf86vmode.c index 6d3d5fcbc..6e5e3f94c 100644 --- a/hw/xfree86/dixmods/extmod/xf86vmode.c +++ b/hw/xfree86/dixmods/extmod/xf86vmode.c @@ -1527,7 +1527,7 @@ ProcXF86VidModeGetPermissions(ClientPtr client) rep.sequenceNumber = client->sequence; rep.permissions = XF86VM_READ_PERMISSION; if (xf86GetVidModeEnabled() && - (xf86GetVidModeAllowNonLocal() || LocalClient (client))) { + (xf86GetVidModeAllowNonLocal() || client->local)) { rep.permissions |= XF86VM_WRITE_PERMISSION; } if(client->swapped) { @@ -1597,7 +1597,7 @@ ProcXF86VidModeDispatch(ClientPtr client) default: if (!xf86GetVidModeEnabled()) return VidModeErrorBase + XF86VidModeExtensionDisabled; - if (xf86GetVidModeAllowNonLocal() || LocalClient (client)) { + if (xf86GetVidModeAllowNonLocal() || client->local) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return ProcXF86VidModeAddModeLine(client); @@ -2017,7 +2017,7 @@ SProcXF86VidModeDispatch(ClientPtr client) default: if (!xf86GetVidModeEnabled()) return VidModeErrorBase + XF86VidModeExtensionDisabled; - if (xf86GetVidModeAllowNonLocal() || LocalClient(client)) { + if (xf86GetVidModeAllowNonLocal() || client->local) { switch (stuff->data) { case X_XF86VidModeAddModeLine: return SProcXF86VidModeAddModeLine(client); diff --git a/hw/xfree86/dri/xf86dri.c b/hw/xfree86/dri/xf86dri.c index c35ba2f94..723e52622 100644 --- a/hw/xfree86/dri/xf86dri.c +++ b/hw/xfree86/dri/xf86dri.c @@ -130,7 +130,7 @@ ProcXF86DRIQueryDirectRenderingCapable( } rep.isCapable = isCapable; - if (!LocalClient(client) || client->swapped) + if (!client->local || client->swapped) rep.isCapable = 0; if (client->swapped) { @@ -557,7 +557,7 @@ ProcXF86DRIDispatch ( return ProcXF86DRIQueryDirectRenderingCapable(client); } - if (!LocalClient(client)) + if (!client->local) return DRIErrorBase + XF86DRIClientNotLocal; switch (stuff->data) diff --git a/hw/xfree86/dri2/dri2ext.c b/hw/xfree86/dri2/dri2ext.c index 73ef7f25e..21331559f 100644 --- a/hw/xfree86/dri2/dri2ext.c +++ b/hw/xfree86/dri2/dri2ext.c @@ -547,7 +547,7 @@ ProcDRI2Dispatch (ClientPtr client) return ProcDRI2QueryVersion(client); } - if (!LocalClient(client)) + if (!client->local) return BadRequest; switch (stuff->data) { diff --git a/hw/xfree86/loader/loadmod.c b/hw/xfree86/loader/loadmod.c index 5b9f8d1c3..5b9c11950 100644 --- a/hw/xfree86/loader/loadmod.c +++ b/hw/xfree86/loader/loadmod.c @@ -1090,6 +1090,9 @@ UnloadSubModule(pointer _mod) { ModuleDescPtr mod = (ModuleDescPtr)_mod; + /* Some drivers are calling us on built-in submodules, ignore them */ + if (mod == (ModuleDescPtr)1) + return; RemoveChild(mod); UnloadModuleOrDriver(mod); } diff --git a/hw/xfree86/os-support/linux/lnx_init.c b/hw/xfree86/os-support/linux/lnx_init.c index 5f3e3a9fb..2176985f9 100644 --- a/hw/xfree86/os-support/linux/lnx_init.c +++ b/hw/xfree86/os-support/linux/lnx_init.c @@ -212,10 +212,20 @@ xf86OpenConsole(void) tcgetattr(xf86Info.consoleFd, &tty_attr); SYSCALL(ioctl(xf86Info.consoleFd, KDGKBMODE, &tty_mode)); - SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW)); +#ifdef K_OFF + /* disable kernel special keys and buffering */ + SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_OFF)); if (ret < 0) - FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n", - strerror(errno)); +#endif + { + SYSCALL(ret = ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW)); + if (ret < 0) + FatalError("xf86OpenConsole: KDSKBMODE K_RAW failed %s\n", + strerror(errno)); + + /* need to keep the buffer clean, else the kernel gets angry */ + xf86SetConsoleHandler(drain_console, NULL); + } nTty = tty_attr; nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); @@ -228,9 +238,6 @@ xf86OpenConsole(void) cfsetospeed(&nTty, 9600); tcsetattr(xf86Info.consoleFd, TCSANOW, &nTty); - /* need to keep the buffer clean, else the kernel gets angry */ - xf86SetConsoleHandler(drain_console, NULL); - /* we really should have a InitOSInputDevices() function instead * of Init?$#*&Device(). So I just place it here */ } diff --git a/hw/xfree86/vgahw/vgaHW.h b/hw/xfree86/vgahw/vgaHW.h index e943aa391..d1ba9da89 100644 --- a/hw/xfree86/vgahw/vgaHW.h +++ b/hw/xfree86/vgahw/vgaHW.h @@ -170,10 +170,10 @@ typedef struct _vgaHWRec { #define BITS_PER_GUN 6 #define COLORMAP_SIZE 256 -#define DACDelay(hw) \ - do { \ - pci_io_read8((hw)->io, (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ - pci_io_read8((hw)->io, (hw)->IOBase + VGA_IN_STAT_1_OFFSET); \ +#define DACDelay(hw) \ + do { \ + (hw)->readST01((hw)); \ + (hw)->readST01((hw)); \ } while (0) /* Function Prototypes */ diff --git a/hw/xfree86/xaa/Makefile.am b/hw/xfree86/xaa/Makefile.am index 7ebe0b91e..78d934876 100644 --- a/hw/xfree86/xaa/Makefile.am +++ b/hw/xfree86/xaa/Makefile.am @@ -8,6 +8,8 @@ MSB_FIXED = mf-xaaBitmap.c mf-xaaStipple.c mf-xaaTEGlyph.c MSB_3_FIXED = mf3-xaaBitmap.c mf3-xaaStipple.c POLYSEG = s-xaaLine.c s-xaaDashLine.c +if XAA + libxaa_la_LDFLAGS = -module -avoid-version if COMPOSITE libxaa_la_LIBADD = $(top_builddir)/miext/cw/libcw.la @@ -60,6 +62,8 @@ ${MSB_3_FIXED}: $(AM_V_GEN)echo "#define FIXEDBASE" >> $@ $(AM_V_GEN)echo '#include "$(srcdir)/${@:mf3-%=%}"' >> $@ +endif # XAA + DISTCLEANFILES = $(POLYSEG) \ $(LSB_FIRST) $(LSB_FIXED) $(MSB_FIRST) $(MSB_FIXED) \ $(LSB_3_FIRST) $(LSB_3_FIXED) $(MSB_3_FIRST) $(MSB_3_FIXED) diff --git a/hw/xquartz/GL/indirect.c b/hw/xquartz/GL/indirect.c index 27d6daebd..e6ff37668 100644 --- a/hw/xquartz/GL/indirect.c +++ b/hw/xquartz/GL/indirect.c @@ -48,9 +48,6 @@ #include <glxserver.h> #include <glxutil.h> -typedef unsigned long long GLuint64EXT; -typedef long long GLint64EXT; -#include <dispatch.h> #include <glapi.h> #include "x-hash.h" diff --git a/hw/xquartz/applewm.c b/hw/xquartz/applewm.c index 55976c454..7077a6c6a 100644 --- a/hw/xquartz/applewm.c +++ b/hw/xquartz/applewm.c @@ -630,7 +630,7 @@ ProcAppleWMDispatch ( return ProcAppleWMQueryVersion(client); } - if (!LocalClient(client)) + if (!client->local) return WMErrorBase + AppleWMClientNotLocal; switch (stuff->data) @@ -693,7 +693,7 @@ SProcAppleWMDispatch ( REQUEST(xReq); /* It is bound to be non-local when there is byte swapping */ - if (!LocalClient(client)) + if (!client->local) return WMErrorBase + AppleWMClientNotLocal; /* only local clients are allowed WM access */ diff --git a/hw/xquartz/xpr/appledri.c b/hw/xquartz/xpr/appledri.c index 44c132abc..091145be3 100644 --- a/hw/xquartz/xpr/appledri.c +++ b/hw/xquartz/xpr/appledri.c @@ -133,7 +133,7 @@ ProcAppleDRIQueryDirectRenderingCapable( } rep.isCapable = isCapable; - if (!LocalClient(client)) + if (!client->local) rep.isCapable = 0; if (client->swapped) { @@ -365,7 +365,7 @@ ProcAppleDRIDispatch ( return ProcAppleDRIQueryDirectRenderingCapable(client); } - if (!LocalClient(client)) + if (!client->local) return DRIErrorBase + AppleDRIClientNotLocal; switch (stuff->data) diff --git a/hw/xwin/winwindowswm.c b/hw/xwin/winwindowswm.c index 577614db6..f43834d5e 100644 --- a/hw/xwin/winwindowswm.c +++ b/hw/xwin/winwindowswm.c @@ -548,7 +548,7 @@ ProcWindowsWMDispatch (ClientPtr client) return ProcWindowsWMQueryVersion(client); } - if (!LocalClient(client)) + if (!client->local) return WMErrorBase + WindowsWMClientNotLocal; switch (stuff->data) @@ -598,7 +598,7 @@ SProcWindowsWMDispatch (ClientPtr client) REQUEST(xReq); /* It is bound to be non-local when there is byte swapping */ - if (!LocalClient(client)) + if (!client->local) return WMErrorBase + WindowsWMClientNotLocal; /* only local clients are allowed WM access */ diff --git a/include/dixstruct.h b/include/dixstruct.h index 0a85f40b6..cb370519e 100644 --- a/include/dixstruct.h +++ b/include/dixstruct.h @@ -90,23 +90,23 @@ typedef struct _Client { Mask clientAsMask; pointer requestBuffer; pointer osPrivate; /* for OS layer, including scheduler */ - Bool swapped; + char swapped; + char local; + char big_requests; + char closeDownMode; + char clientGone; + char noClientException; /* this client died or needs to be + * killed */ + char clientState; ReplySwapPtr pSwapReplyFunc; XID errorValue; int sequence; - int closeDownMode; - int clientGone; - int noClientException; /* this client died or needs to be - * killed */ int ignoreCount; /* count for Attend/IgnoreClient */ - SaveSetElt *saveSet; int numSaved; - int (**requestVector) ( - ClientPtr /* pClient */); + SaveSetElt *saveSet; + int (**requestVector) (ClientPtr /* pClient */); CARD32 req_len; /* length of current request */ - Bool big_requests; /* supports large requests */ int priority; - ClientState clientState; PrivateRec *devPrivates; unsigned short xkbClientFlags; unsigned short mapNotifyMask; @@ -114,16 +114,16 @@ typedef struct _Client { unsigned short vMajor,vMinor; KeyCode minKC,maxKC; - unsigned long replyBytesRemaining; + unsigned int replyBytesRemaining; int smart_priority; - long smart_start_tick; - long smart_stop_tick; - long smart_check_tick; + int smart_start_tick; + int smart_stop_tick; + int smart_check_tick; DeviceIntPtr clientPtr; ClientIdPtr clientIds; unsigned short majorOp, minorOp; -} ClientRec; +} ClientRec; /* * Scheduling interface diff --git a/include/exevents.h b/include/exevents.h index bd1697066..31acb30ea 100644 --- a/include/exevents.h +++ b/include/exevents.h @@ -92,7 +92,7 @@ extern _X_EXPORT int XIChangeDeviceProperty( int /* format*/, int /* mode*/, unsigned long /* len*/, - const pointer /* value*/, + const void* /* value*/, Bool /* sendevent*/ ); diff --git a/include/os.h b/include/os.h index 48ce32962..84dedd5cb 100644 --- a/include/os.h +++ b/include/os.h @@ -353,8 +353,6 @@ typedef struct sockaddr * sockaddrPtr; extern _X_EXPORT int InvalidHost(sockaddrPtr /*saddr*/, int /*len*/, ClientPtr client); -extern _X_EXPORT int LocalClient(ClientPtr /* client */); - extern _X_EXPORT int LocalClientCred(ClientPtr, int *, int *); #define LCC_UID_SET (1 << 0) diff --git a/include/windowstr.h b/include/windowstr.h index 222de31dc..1124dfc4c 100644 --- a/include/windowstr.h +++ b/include/windowstr.h @@ -87,8 +87,8 @@ typedef struct _WindowOpt { struct _OtherClients *otherClients; /* default: NULL */ struct _GrabRec *passiveGrabs; /* default: NULL */ PropertyPtr userProps; /* default: NULL */ - unsigned long backingBitPlanes; /* default: ~0L */ - unsigned long backingPixel; /* default: 0 */ + CARD32 backingBitPlanes; /* default: ~0L */ + CARD32 backingPixel; /* default: 0 */ RegionPtr boundingShape; /* default: NULL */ RegionPtr clipShape; /* default: NULL */ RegionPtr inputShape; /* default: NULL */ diff --git a/mi/mibitblt.c b/mi/mibitblt.c index 2dfff1451..fc6eb8d6e 100644 --- a/mi/mibitblt.c +++ b/mi/mibitblt.c @@ -648,7 +648,7 @@ miGetImage( DrawablePtr pDraw, int sx, int sy, int w, int h, depth = pDraw->depth; if(format == ZPixmap) { - if ( (((1<<depth)-1)&planeMask) != (1<<depth)-1 ) + if ( (((1LL<<depth)-1)&planeMask) != (1LL<<depth)-1 ) { ChangeGCVal gcv; xPoint pt; diff --git a/os/access.c b/os/access.c index b609442de..ed13d0a0d 100644 --- a/os/access.c +++ b/os/access.c @@ -1045,13 +1045,6 @@ ComputeLocalClient(ClientPtr client) return FALSE; } -Bool LocalClient(ClientPtr client) -{ - if (!client->osPrivate) - return FALSE; - return ((OsCommPtr)client->osPrivate)->local_client; -} - /* * Return the uid and gid of a connected local client * @@ -1209,7 +1202,7 @@ AuthorizedClient(ClientPtr client) if (rc != Success) return rc; - return LocalClient(client) ? Success : BadAccess; + return client->local ? Success : BadAccess; } /* Add a host to the access control list. This is the external interface diff --git a/os/backtrace.c b/os/backtrace.c index 58b4b1f34..298bf1898 100644 --- a/os/backtrace.c +++ b/os/backtrace.c @@ -46,7 +46,11 @@ void xorg_backtrace(void) ErrorF("\nBacktrace:\n"); size = backtrace(array, 64); for (i = 0; i < size; i++) { - dladdr(array[i], &info); + int rc = dladdr(array[i], &info); + if (rc == 0) { + ErrorF("%d: ?? [%p]\n", i, array[i]); + continue; + } mod = (info.dli_fname && *info.dli_fname) ? info.dli_fname : "(vdso)"; if (info.dli_saddr) ErrorF("%d: %s (%s+0x%lx) [%p]\n", i, mod, diff --git a/os/client.c b/os/client.c index 8f4707b09..fbccf22ed 100644 --- a/os/client.c +++ b/os/client.c @@ -64,6 +64,15 @@ #include <procfs.h> #endif +#ifdef __OpenBSD__ +#include <sys/param.h> +#include <sys/sysctl.h> +#include <sys/types.h> + +#include <kvm.h> +#include <limits.h> +#endif + /** * Try to determine a PID for a client from its connection * information. This should be called only once when new client has @@ -172,7 +181,39 @@ void DetermineClientCmd(pid_t pid, const char **cmdname, const char **cmdargs) if (cmdargs && sp) *cmdargs = strdup(sp); } -#else /* not Solaris */ +#elif defined(__OpenBSD__) + /* on OpenBSD use kvm_getargv() */ + { + kvm_t *kd; + char errbuf[_POSIX2_LINE_MAX]; + char **argv; + struct kinfo_proc *kp; + size_t len = 0; + int i, n; + + kd = kvm_open(NULL, NULL, NULL, KVM_NO_FILES, errbuf); + if (kd == NULL) + return; + kp = kvm_getprocs(kd, KERN_PROC_PID, pid, sizeof(struct kinfo_proc), &n); + if (n != 1) + return; + argv = kvm_getargv(kd, kp, 0); + *cmdname = strdup(argv[0]); + i = 1; + while (argv[i] != NULL) { + len += strlen(argv[i]) + 1; + i++; + } + *cmdargs = calloc(1, len); + i = 1; + while (argv[i] != NULL) { + strlcat(*cmdargs, argv[i], len); + strlcat(*cmdargs, " ", len); + i++; + } + kvm_close(kd); + } +#else /* Linux using /proc/pid/cmdline */ /* Check if /proc/pid/cmdline exists. It's not supported on all * operating systems. */ diff --git a/os/connection.c b/os/connection.c index 8a677a7ef..2c90d72a9 100644 --- a/os/connection.c +++ b/os/connection.c @@ -745,7 +745,7 @@ AllocNewConnection (XtransConnInfo trans_conn, int fd, CARD32 conn_time) free(oc); return NullClient; } - oc->local_client = ComputeLocalClient(client); + client->local = ComputeLocalClient(client); #if !defined(WIN32) ConnectionTranslation[fd] = client->index; #else @@ -873,6 +873,8 @@ EstablishNewConnections(ClientPtr clientUnused, pointer closure) * Fail a connection due to lack of client or file descriptor space ************/ +#define BOTIMEOUT 200 /* in milliseconds */ + static void ErrorConnMax(XtransConnInfo trans_conn) { @@ -880,7 +882,7 @@ ErrorConnMax(XtransConnInfo trans_conn) xConnSetupPrefix csp; char pad[3]; struct iovec iov[3]; - char byteOrder = 0; + char order = 0; int whichbyte = 1; struct timeval waittime; fd_set mask; @@ -893,16 +895,16 @@ ErrorConnMax(XtransConnInfo trans_conn) FD_SET(fd, &mask); (void)Select(fd + 1, &mask, NULL, NULL, &waittime); /* try to read the byte-order of the connection */ - (void)_XSERVTransRead(trans_conn, &byteOrder, 1); - if ((byteOrder == 'l') || (byteOrder == 'B')) + (void)_XSERVTransRead(trans_conn, &order, 1); + if (order == 'l' || order == 'B' || order == 'r' || order == 'R') { csp.success = xFalse; csp.lengthReason = sizeof(NOROOM) - 1; csp.length = (sizeof(NOROOM) + 2) >> 2; csp.majorVersion = X_PROTOCOL; csp.minorVersion = X_PROTOCOL_REVISION; - if (((*(char *) &whichbyte) && (byteOrder == 'B')) || - (!(*(char *) &whichbyte) && (byteOrder == 'l'))) + if (((*(char *) &whichbyte) && (order == 'B' || order == 'R')) || + (!(*(char *) &whichbyte) && (order == 'l' || order == 'r'))) { swaps(&csp.majorVersion); swaps(&csp.minorVersion); @@ -1030,7 +1032,7 @@ CloseDownConnection(ClientPtr client) if (FlushCallback) CallCallbacks(&FlushCallback, NULL); - if (oc->output && oc->output->count) + if (oc->output) FlushClient(client, oc, (char *)NULL, 0); #ifdef XDMCP XdmcpCloseDisplay(oc->fd); @@ -84,6 +84,23 @@ SOFTWARE. CallbackListPtr ReplyCallback; CallbackListPtr FlushCallback; +typedef struct _connectionInput { + struct _connectionInput *next; + char *buffer; /* contains current client input */ + char *bufptr; /* pointer to current start of data */ + int bufcnt; /* count of bytes in buffer */ + int lenLastReq; + int size; + unsigned int ignoreBytes; /* bytes to ignore before the next request */ +} ConnectionInput, *ConnectionInputPtr; + +typedef struct _connectionOutput { + struct _connectionOutput *next; + unsigned char *buf; + int size; + int count; +} ConnectionOutput, *ConnectionOutputPtr; + static ConnectionInputPtr AllocateInputBuffer(void); static ConnectionOutputPtr AllocateOutputBuffer(void); @@ -112,6 +129,8 @@ static OsCommPtr AvailableInput = (OsCommPtr)NULL; ((xBigReq *)(req))->length) #define MAX_TIMES_PER 10 +#define BUFSIZE 4096 +#define BUFWATERMARK 8192 /* * A lot of the code in this file manipulates a ConnectionInputPtr: @@ -889,7 +908,7 @@ FlushClient(ClientPtr who, OsCommPtr oc, const void *__extraBuf, int extraCount) long notWritten; long todo; - if (!oco) + if (!oco || !oco->count) return 0; written = 0; padsize = padlength[extraCount & 3]; diff --git a/os/osdep.h b/os/osdep.h index 71a7e44e3..c9add48ee 100644 --- a/os/osdep.h +++ b/os/osdep.h @@ -52,10 +52,6 @@ SOFTWARE. #ifndef _OSDEP_H_ #define _OSDEP_H_ 1 -#define BOTIMEOUT 200 /* in milliseconds */ -#define BUFSIZE 4096 -#define BUFWATERMARK 8192 - #if defined(XDMCP) || defined(HASXDMAUTH) #include <X11/Xdmcp.h> #endif @@ -112,22 +108,8 @@ typedef Bool (*AddAuthorFunc)(unsigned name_length, const char *name, unsigned data_length, char *data); #endif -typedef struct _connectionInput { - struct _connectionInput *next; - char *buffer; /* contains current client input */ - char *bufptr; /* pointer to current start of data */ - int bufcnt; /* count of bytes in buffer */ - int lenLastReq; - int size; - unsigned int ignoreBytes; /* bytes to ignore before the next request */ -} ConnectionInput, *ConnectionInputPtr; - -typedef struct _connectionOutput { - struct _connectionOutput *next; - int size; - unsigned char *buf; - int count; -} ConnectionOutput, *ConnectionOutputPtr; +typedef struct _connectionInput *ConnectionInputPtr; +typedef struct _connectionOutput *ConnectionOutputPtr; struct _osComm; @@ -166,7 +148,6 @@ typedef struct _osComm { XID auth_id; /* authorization id */ CARD32 conn_time; /* timestamp if not established, else 0 */ struct _XtransConnInfo *trans_conn; /* transport connection object */ - Bool local_client; } OsCommRec, *OsCommPtr; extern int FlushClient( diff --git a/xkb/xkbActions.c b/xkb/xkbActions.c index 33864e16d..da0bdea69 100644 --- a/xkb/xkbActions.c +++ b/xkb/xkbActions.c @@ -784,7 +784,7 @@ DeviceIntPtr kbd; filter->active= 0; return ((pMsg->flags&XkbSA_MessageGenKeyEvent)!=0); } - return 0; + return 1; } static int |