From 2a31e38d82566c4f93773ecf9c79f2cc9abef169 Mon Sep 17 00:00:00 2001 From: marha Date: Wed, 16 Jun 2010 07:28:49 +0000 Subject: xserver and libxcb git update 11/6/2010 --- libxcb/src/xcb_util.c | 46 +++++++++---- xorg-server/configure.ac | 4 +- xorg-server/dix/devices.c | 2 +- xorg-server/glx/glxscreens.c | 6 +- xorg-server/hw/kdrive/ephyr/ephyr.c | 107 ++++++++++++----------------- xorg-server/hw/xfree86/dri2/dri2.c | 6 +- xorg-server/hw/xfree86/modes/xf86Crtc.c | 2 + xorg-server/hw/xfree86/modes/xf86RandR12.c | 26 ++++++- xorg-server/hw/xfree86/modes/xf86RandR12.h | 85 ++++++++++++----------- 9 files changed, 157 insertions(+), 127 deletions(-) diff --git a/libxcb/src/xcb_util.c b/libxcb/src/xcb_util.c index 53c05e0b8..9cdfbff3f 100644 --- a/libxcb/src/xcb_util.c +++ b/libxcb/src/xcb_util.c @@ -64,6 +64,7 @@ static int _xcb_parse_display(const char *name, char **host, char **protocol, { int len, display, screen; char *slash, *colon, *dot, *end; + if(!name || !*name) name = getenv("DISPLAY"); if(!name) @@ -92,35 +93,43 @@ static int _xcb_parse_display(const char *name, char **host, char **protocol, colon = strrchr(name, ':'); if(!colon) - return 0; + goto error_out; len = colon - name; ++colon; display = strtoul(colon, &dot, 10); if(dot == colon) - return 0; + goto error_out; if(*dot == '\0') screen = 0; else { if(*dot != '.') - return 0; + goto error_out; ++dot; screen = strtoul(dot, &end, 10); if(end == dot || *end != '\0') - return 0; + goto error_out; } /* At this point, the display string is fully parsed and valid, but * the caller's memory is untouched. */ *host = malloc(len + 1); if(!*host) - return 0; + goto error_out; memcpy(*host, name, len); (*host)[len] = '\0'; *displayp = display; if(screenp) *screenp = screen; return 1; + +error_out: + if (protocol) { + free(*protocol); + *protocol = NULL; + } + + return 0; } int xcb_parse_display(const char *name, char **host, int *displayp, @@ -389,24 +398,28 @@ xcb_connection_t *xcb_connect(const char *displayname, int *screenp) xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, xcb_auth_info_t *auth, int *screenp) { int fd, display = 0; - char *host; - char *protocol; + char *host = NULL; + char *protocol = NULL; xcb_auth_info_t ourauth; xcb_connection_t *c; int parsed = _xcb_parse_display(displayname, &host, &protocol, &display, screenp); - if(!parsed) - return (xcb_connection_t *) &error_connection; - else + if(!parsed) { + c = (xcb_connection_t *) &error_connection; + goto out; + } else fd = _xcb_open(host, protocol, display); - free(host); - if(fd == -1) - return (xcb_connection_t *) &error_connection; + if(fd == -1) { + c = (xcb_connection_t *) &error_connection; + goto out; + } - if(auth) - return xcb_connect_to_fd(fd, auth); + if(auth) { + c = xcb_connect_to_fd(fd, auth); + goto out; + } if(_xcb_get_auth_info(fd, &ourauth, display)) { @@ -417,5 +430,8 @@ xcb_connection_t *xcb_connect_to_display_with_auth_info(const char *displayname, else c = xcb_connect_to_fd(fd, 0); +out: + free(host); + free(protocol); return c; } diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index dec96468d..161f9cda0 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -26,8 +26,8 @@ dnl dnl Process this file with autoconf to create configure. AC_PREREQ(2.57) -AC_INIT([xorg-server], 1.8.99.0, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) -RELEASE_DATE="unreleased" +AC_INIT([xorg-server], 1.8.99.901, [https://bugs.freedesktop.org/enter_bug.cgi?product=xorg], xorg-server) +RELEASE_DATE="2010-06-15" AC_CONFIG_SRCDIR([Makefile.am]) AM_INIT_AUTOMAKE([foreign dist-bzip2]) AM_MAINTAINER_MODE diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 9c9ca5496..e6d25ea40 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -1546,7 +1546,7 @@ InitPointerDeviceStruct(DevicePtr device, CARD8 *map, int numButtons, Atom* btn_ return(InitButtonClassDeviceStruct(dev, numButtons, btn_labels, map) && InitValuatorClassDeviceStruct(dev, numAxes, axes_labels, - numMotionEvents, 0) && + numMotionEvents, Relative) && InitPtrFeedbackClassDeviceStruct(dev, controlProc)); } diff --git a/xorg-server/glx/glxscreens.c b/xorg-server/glx/glxscreens.c index d2f044627..11b86df3f 100644 --- a/xorg-server/glx/glxscreens.c +++ b/xorg-server/glx/glxscreens.c @@ -425,9 +425,9 @@ void __glXScreenInit(__GLXscreen *pGlxScreen, ScreenPtr pScreen) if (i == pScreen->numVisuals) continue; - /* Make sure the FBconfig supports window drawables */ - if (!(config->drawableType & GLX_WINDOW_BIT)) - continue; + /* Make sure the FBconfig supports window drawables */ + if (!(config->drawableType & GLX_WINDOW_BIT)) + continue; /* Create a new X visual for our FBconfig. */ visual = AddScreenVisuals(pScreen, 1, depth); diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 8ed97d614..315f68340 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -38,6 +38,8 @@ #include "ephyrglxext.h" #endif /* XF86DRI */ +#include "xkbsrv.h" + extern int KdTsPhyScreen; #ifdef GLXEXT extern Bool noGlxVisualInit; @@ -748,75 +750,55 @@ ephyrScreenFini (KdScreenInfo *screen) void ephyrUpdateModifierState(unsigned int state) { -#if 0 - DeviceIntPtr pkeydev; - KeyClassPtr keyc; - int i; - CARD8 mask; - - pkeydev = inputInfo.keyboard; - if (!pkeydev) - return; + DeviceIntPtr pDev = inputInfo.keyboard; + KeyClassPtr keyc = pDev->key; + int i; + CARD8 mask; + int xkb_state; -/* This is pretty broken. - * - * What should happen is that focus out should do as a VT switch does in - * traditional servers: fake releases for all keys (and buttons too, come - * to think of it) currently down. Then, on focus in, get the state from - * the host, and fake keypresses for everything currently down. - * - * So I'm leaving this broken for a little while. Sorry, folks. - * - * -daniels - */ + if (!pDev) + return; - keyc = pkeydev->key; - + xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state); state = state & 0xff; - - if (keyc->state == state) + + if (xkb_state == state) return; - - for (i = 0, mask = 1; i < 8; i++, mask <<= 1) - { - int key; - /* Modifier is down, but shouldn't be */ - if ((keyc->state & mask) && !(state & mask)) - { - int count = keyc->modifierKeyCount[i]; - - for (key = 0; key < MAP_LENGTH; key++) - if (keyc->xkbInfo->desc->map->modmap[key] & mask) - { - int bit; - BYTE *kptr; - - kptr = &keyc->down[key >> 3]; - bit = 1 << (key & 7); - - if (*kptr & bit && ephyrKbd && - ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - KdEnqueueKeyboardEvent(ephyrKbd, key, TRUE); /* release */ - - if (--count == 0) - break; - } - } - - /* Modifier shoud be down, but isn't */ - if (!(keyc->state & mask) && (state & mask)) - for (key = 0; key < MAP_LENGTH; key++) - if (keyc->xkbInfo->desc->map->modmap[key] & mask) - { - if (keyc->xkbInfo->desc->map->modmap[key] & mask && ephyrKbd && - ((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - KdEnqueueKeyboardEvent(ephyrKbd, key, FALSE); /* press */ - break; - } + for (i = 0, mask = 1; i < 8; i++, mask <<= 1) { + int key; + + /* Modifier is down, but shouldn't be + */ + if ((xkb_state & mask) && !(state & mask)) { + int count = keyc->modifierKeyCount[i]; + + for (key = 0; key < MAP_LENGTH; key++) + if (keyc->xkbInfo->desc->map->modmap[key] & mask) { + int bit; + BYTE *kptr; + + kptr = &keyc->down[key >> 3]; + bit = 1 << (key & 7); + + if (*kptr & bit) + KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE); + + if (--count == 0) + break; + } } -#endif + + /* Modifier shoud be down, but isn't + */ + if (!(xkb_state & mask) && (state & mask)) + for (key = 0; key < MAP_LENGTH; key++) + if (keyc->xkbInfo->desc->map->modmap[key] & mask) { + KdEnqueueKeyboardEvent (ephyrKbd, key, FALSE); + break; + } + } } static void @@ -998,6 +980,7 @@ ephyrPoll(void) if (!ephyrKbd || !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) continue; + ephyrUpdateModifierState(ev.key_state); KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE); break; diff --git a/xorg-server/hw/xfree86/dri2/dri2.c b/xorg-server/hw/xfree86/dri2/dri2.c index bb1be358b..123bc3225 100644 --- a/xorg-server/hw/xfree86/dri2/dri2.c +++ b/xorg-server/hw/xfree86/dri2/dri2.c @@ -957,8 +957,12 @@ Bool DRI2Connect(ScreenPtr pScreen, unsigned int driverType, int *fd, const char **driverName, const char **deviceName) { - DRI2ScreenPtr ds = DRI2GetScreen(pScreen); + DRI2ScreenPtr ds; + + if (!dixPrivateKeyRegistered(dri2ScreenPrivateKey)) + return FALSE; + ds = DRI2GetScreen(pScreen); if (ds == NULL || driverType >= ds->numDrivers || !ds->driverNames[driverType]) return FALSE; diff --git a/xorg-server/hw/xfree86/modes/xf86Crtc.c b/xorg-server/hw/xfree86/modes/xf86Crtc.c index 9c5b3c1ad..6a56e31cc 100644 --- a/xorg-server/hw/xfree86/modes/xf86Crtc.c +++ b/xorg-server/hw/xfree86/modes/xf86Crtc.c @@ -753,6 +753,8 @@ xf86CrtcCloseScreen (int index, ScreenPtr screen) crtc->randr_crtc = NULL; } + xf86RandR12CloseScreen (screen); + return screen->CloseScreen (index, screen); } diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.c b/xorg-server/hw/xfree86/modes/xf86RandR12.c index e49387317..90e267c1e 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.c +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.c @@ -927,6 +927,24 @@ xf86RandR12Init (ScreenPtr pScreen) return TRUE; } +void +xf86RandR12CloseScreen (ScreenPtr pScreen) +{ + XF86RandRInfoPtr randrp; + +#if XORG_VERSION_CURRENT < XORG_VERSION_NUMERIC(7,0,0,0,0) + if (xf86RandR12Key == NULL) + return; +#endif + + randrp = XF86RANDRINFO(pScreen); +#if RANDR_12_INTERFACE + xf86Screens[pScreen->myNum]->EnterVT = randrp->orig_EnterVT; +#endif + + free(randrp); +} + void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotations) { @@ -1755,10 +1773,16 @@ static Bool xf86RandR12EnterVT (int screen_index, int flags) { ScreenPtr pScreen = screenInfo.screens[screen_index]; + ScrnInfoPtr pScrn = xf86Screens[screen_index]; XF86RandRInfoPtr randrp = XF86RANDRINFO(pScreen); + Bool ret; if (randrp->orig_EnterVT) { - if (!randrp->orig_EnterVT (screen_index, flags)) + pScrn->EnterVT = randrp->orig_EnterVT; + ret = pScrn->EnterVT (screen_index, flags); + randrp->orig_EnterVT = pScrn->EnterVT; + pScrn->EnterVT = xf86RandR12EnterVT; + if (!ret) return FALSE; } diff --git a/xorg-server/hw/xfree86/modes/xf86RandR12.h b/xorg-server/hw/xfree86/modes/xf86RandR12.h index c8d9918cf..755a472d1 100644 --- a/xorg-server/hw/xfree86/modes/xf86RandR12.h +++ b/xorg-server/hw/xfree86/modes/xf86RandR12.h @@ -1,42 +1,43 @@ -/* - * Copyright © 2006 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE - * OF THIS SOFTWARE. - */ - -#ifndef _XF86_RANDR_H_ -#define _XF86_RANDR_H_ -#include -#include -#if XF86_MODES_RENAME -#include "xf86Rename.h" -#endif - -extern _X_EXPORT Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen); -extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen); -extern _X_EXPORT void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation); -extern _X_EXPORT void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms); -extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, - RRScreenSizePtr pSize); -extern _X_EXPORT Rotation xf86RandR12GetRotation(ScreenPtr pScreen); -extern _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); -extern _X_EXPORT Bool xf86RandR12PreInit (ScrnInfoPtr pScrn); -extern _X_EXPORT void xf86RandR12TellChanged (ScreenPtr pScreen); - -#endif /* _XF86_RANDR_H_ */ +/* + * Copyright © 2006 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + */ + +#ifndef _XF86_RANDR_H_ +#define _XF86_RANDR_H_ +#include +#include +#if XF86_MODES_RENAME +#include "xf86Rename.h" +#endif + +extern _X_EXPORT Bool xf86RandR12CreateScreenResources (ScreenPtr pScreen); +extern _X_EXPORT Bool xf86RandR12Init(ScreenPtr pScreen); +extern _X_EXPORT void xf86RandR12CloseScreen(ScreenPtr pScreen); +extern _X_EXPORT void xf86RandR12SetRotations (ScreenPtr pScreen, Rotation rotation); +extern _X_EXPORT void xf86RandR12SetTransformSupport (ScreenPtr pScreen, Bool transforms); +extern _X_EXPORT Bool xf86RandR12SetConfig(ScreenPtr pScreen, Rotation rotation, int rate, + RRScreenSizePtr pSize); +extern _X_EXPORT Rotation xf86RandR12GetRotation(ScreenPtr pScreen); +extern _X_EXPORT void xf86RandR12GetOriginalVirtualSize(ScrnInfoPtr pScrn, int *x, int *y); +extern _X_EXPORT Bool xf86RandR12PreInit (ScrnInfoPtr pScrn); +extern _X_EXPORT void xf86RandR12TellChanged (ScreenPtr pScreen); + +#endif /* _XF86_RANDR_H_ */ -- cgit v1.2.3