From 1ccf18dc09e288ddf937aa890b50c8d0a9df4319 Mon Sep 17 00:00:00 2001 From: marha Date: Sun, 29 May 2011 15:02:10 +0200 Subject: libX11 mesa mkfontscale pixman xserver git update 29 Mar 2011 --- xorg-server/dix/devices.c | 9 - xorg-server/dix/events.c | 7 +- xorg-server/dix/inpututils.c | 2 +- xorg-server/fb/fbbltone.c | 4 +- xorg-server/hw/kdrive/ephyr/ephyr.c | 2333 ++++++++++---------- xorg-server/hw/kdrive/ephyr/ephyrinit.c | 7 +- xorg-server/hw/xfree86/common/xf86Module.h | 2 +- xorg-server/hw/xfree86/common/xf86Xinput.c | 21 + xorg-server/hw/xfree86/man/xorg.conf.man | 10 + xorg-server/hw/xfree86/parser/InputClass.c | 827 +++---- xorg-server/hw/xfree86/parser/xf86Parser.h | 1037 ++++----- xorg-server/hw/xfree86/parser/xf86tokens.h | 587 ++--- xorg-server/hw/xwin/winkeybd.c | 6 +- xorg-server/hw/xwin/winmouse.c | 4 +- xorg-server/include/input.h | 6 - xorg-server/include/inputstr.h | 2 - xorg-server/include/xserver-properties.h | 390 ++-- xorg-server/mi/mieq.c | 1 + xorg-server/randr/rrscreen.c | 12 +- .../xkeyboard-config/rules/base.extras.xml.in | 12 +- xorg-server/xkeyboard-config/rules/base.xml.in | 10 - 21 files changed, 2680 insertions(+), 2609 deletions(-) (limited to 'xorg-server') diff --git a/xorg-server/dix/devices.c b/xorg-server/dix/devices.c index 9a4498b9f..0ccf25277 100644 --- a/xorg-server/dix/devices.c +++ b/xorg-server/dix/devices.c @@ -1360,15 +1360,6 @@ InitPointerAccelerationScheme(DeviceIntPtr dev, return TRUE; } -Bool -InitAbsoluteClassDeviceStruct(DeviceIntPtr dev) -{ - /* This is an API-preserving noop. Instructions: Kill when no more drivers - * call it. The infrastructure behind hasn't really been used, so any calls - * are likely just a declaration that the device is absolute. */ - return FALSE; -} - Bool InitFocusClassDeviceStruct(DeviceIntPtr dev) { diff --git a/xorg-server/dix/events.c b/xorg-server/dix/events.c index 14f6f909e..b60c29952 100644 --- a/xorg-server/dix/events.c +++ b/xorg-server/dix/events.c @@ -112,6 +112,7 @@ Equipment Corporation. #include #include "windowstr.h" #include "inputstr.h" +#include "inpututils.h" #include "scrnintstr.h" #include "cursorstr.h" @@ -2195,7 +2196,7 @@ DeliverEventsToWindow(DeviceIntPtr pDev, WindowPtr pWin, xEvent */ if (!grab && ActivateImplicitGrab(pDev, client, pWin, pEvents, deliveryMask)) /* grab activated */; - else if ((type == MotionNotify)) + else if (type == MotionNotify) pDev->valuator->motionHintWindow = pWin; else if (type == DeviceMotionNotify || type == DeviceButtonPress) CheckDeviceGrabAndHintWindow (pWin, type, @@ -2832,7 +2833,7 @@ CheckMotion(DeviceEvent *ev, DeviceIntPtr pDev) WindowPtr prevSpriteWin, newSpriteWin; SpritePtr pSprite = pDev->spriteInfo->sprite; - verify_internal_event(ev); + verify_internal_event((InternalEvent *)ev); prevSpriteWin = pSprite->win; @@ -5906,7 +5907,7 @@ PickPointer(ClientPtr client) if (!client->clientPtr) { - DeviceIntPtr it = inputInfo.devices; + it = inputInfo.devices; while (it) { if (IsMaster(it) && it->spriteInfo->spriteOwner) diff --git a/xorg-server/dix/inpututils.c b/xorg-server/dix/inpututils.c index aeace6ef8..49e175822 100644 --- a/xorg-server/dix/inpututils.c +++ b/xorg-server/dix/inpututils.c @@ -574,7 +574,7 @@ void verify_internal_event(const InternalEvent *ev) for (i = 0; i < sizeof(xEvent); i++, data++) { - ErrorF("%02hx ", *data); + ErrorF("%02hhx ", *data); if ((i % 8) == 7) ErrorF("\n"); diff --git a/xorg-server/fb/fbbltone.c b/xorg-server/fb/fbbltone.c index 0a91575a7..67e7853c6 100644 --- a/xorg-server/fb/fbbltone.c +++ b/xorg-server/fb/fbbltone.c @@ -428,8 +428,8 @@ fbBltOne (FbStip *src, #define Mask24(x,r) (Mask24Pos(x,r) < FB_UNIT ? \ (Mask24Pos(x,r) < 0 ? \ - 0xffffff >> Mask24Neg (x,r) : \ - 0xffffff << Mask24Check(x,r)) : 0) + 0xffffffU >> Mask24Neg (x,r) : \ + 0xffffffU << Mask24Check(x,r)) : 0) #define SelMask24(b,n,r) ((((b) >> n) & 1) * Mask24(n,r)) diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 5dfde07f6..ac8e5bef9 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -1,1156 +1,1177 @@ -/* - * Xephyr - A kdrive X server thats runs in a host X window. - * Authored by Matthew Allum - * - * Copyright © 2004 Nokia - * - * 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 Nokia not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Nokia makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL NOKIA 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "ephyr.h" - -#include "inputstr.h" -#include "scrnintstr.h" -#include "ephyrlog.h" - -#ifdef XF86DRI -#include "ephyrdri.h" -#include "ephyrdriext.h" -#include "ephyrglxext.h" -#endif /* XF86DRI */ - -#include "xkbsrv.h" - -extern int KdTsPhyScreen; -#ifdef GLXEXT -extern Bool noGlxVisualInit; -#endif - -KdKeyboardInfo *ephyrKbd; -KdPointerInfo *ephyrMouse; -EphyrKeySyms ephyrKeySyms; -Bool ephyrNoDRI=FALSE ; -Bool ephyrNoXV=FALSE ; - -static int mouseState = 0; - -typedef struct _EphyrInputPrivate { - Bool enabled; -} EphyrKbdPrivate, EphyrPointerPrivate; - -Bool EphyrWantGrayScale = 0; - - -Bool -ephyrInitialize (KdCardInfo *card, EphyrPriv *priv) -{ - OsSignal(SIGUSR1, hostx_handle_signal); - - priv->base = 0; - priv->bytes_per_line = 0; - return TRUE; -} - -Bool -ephyrCardInit (KdCardInfo *card) -{ - EphyrPriv *priv; - - priv = (EphyrPriv *) malloc(sizeof (EphyrPriv)); - if (!priv) - return FALSE; - - if (!ephyrInitialize (card, priv)) - { - free(priv); - return FALSE; - } - card->driver = priv; - - return TRUE; -} - -Bool -ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv) -{ - int width = 640, height = 480; - CARD32 redMask, greenMask, blueMask; - - if (hostx_want_screen_size(screen, &width, &height) - || !screen->width || !screen->height) - { - screen->width = width; - screen->height = height; - } - - if (EphyrWantGrayScale) - screen->fb.depth = 8; - - if (screen->fb.depth && screen->fb.depth != hostx_get_depth()) - { - if (screen->fb.depth < hostx_get_depth() - && (screen->fb.depth == 24 || screen->fb.depth == 16 - || screen->fb.depth == 8)) - { - hostx_set_server_depth(screen, screen->fb.depth); - } - else - ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n"); - } - - screen->fb.depth = hostx_get_server_depth(screen); - screen->rate = 72; - - if (screen->fb.depth <= 8) - { - if (EphyrWantGrayScale) - screen->fb.visuals = ((1 << StaticGray) | (1 << GrayScale)); - else - screen->fb.visuals = ((1 << StaticGray) | - (1 << GrayScale) | - (1 << StaticColor) | - (1 << PseudoColor) | - (1 << TrueColor) | - (1 << DirectColor)); - - screen->fb.redMask = 0x00; - screen->fb.greenMask = 0x00; - screen->fb.blueMask = 0x00; - screen->fb.depth = 8; - screen->fb.bitsPerPixel = 8; - } - else - { - screen->fb.visuals = (1 << TrueColor); - - if (screen->fb.depth <= 15) - { - screen->fb.depth = 15; - screen->fb.bitsPerPixel = 16; - } - else if (screen->fb.depth <= 16) - { - screen->fb.depth = 16; - screen->fb.bitsPerPixel = 16; - } - else if (screen->fb.depth <= 24) - { - screen->fb.depth = 24; - screen->fb.bitsPerPixel = 32; - } - else if (screen->fb.depth <= 30) - { - screen->fb.depth = 30; - screen->fb.bitsPerPixel = 32; - } - else - { - ErrorF("\nXephyr: Unsupported screen depth %d\n", - screen->fb.depth); - return FALSE; - } - - hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask); - - screen->fb.redMask = (Pixel) redMask; - screen->fb.greenMask = (Pixel) greenMask; - screen->fb.blueMask = (Pixel) blueMask; - - } - - scrpriv->randr = screen->randr; - - return ephyrMapFramebuffer (screen); -} - -Bool -ephyrScreenInit (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv; - - scrpriv = calloc(1, sizeof (EphyrScrPriv)); - - if (!scrpriv) - return FALSE; - - screen->driver = scrpriv; - - if (!ephyrScreenInitialize (screen, scrpriv)) - { - screen->driver = 0; - free(scrpriv); - return FALSE; - } - - return TRUE; -} - -void* -ephyrWindowLinear (ScreenPtr pScreen, - CARD32 row, - CARD32 offset, - int mode, - CARD32 *size, - void *closure) -{ - KdScreenPriv(pScreen); - EphyrPriv *priv = pScreenPriv->card->driver; - - if (!pScreenPriv->enabled) - return 0; - - *size = priv->bytes_per_line; - return priv->base + row * priv->bytes_per_line + offset; -} - -/** - * Figure out display buffer size. If fakexa is enabled, allocate a larger - * buffer so that fakexa has space to put offscreen pixmaps. - */ -int -ephyrBufferHeight(KdScreenInfo *screen) -{ - int buffer_height; - if (ephyrFuncs.initAccel == NULL) - buffer_height = screen->height; - else - buffer_height = 3 * screen->height; - return buffer_height; -} - - -Bool -ephyrMapFramebuffer (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv = screen->driver; - EphyrPriv *priv = screen->card->driver; - KdPointerMatrix m; - int buffer_height; - - EPHYR_LOG("screen->width: %d, screen->height: %d index=%d", - screen->width, screen->height, screen->mynum); - - KdComputePointerMatrix (&m, scrpriv->randr, screen->width, screen->height); - KdSetPointerMatrix (&m); - - priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2; - - buffer_height = ephyrBufferHeight(screen); - - priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height); - - if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) - { - scrpriv->shadow = FALSE; - - screen->fb.byteStride = priv->bytes_per_line; - screen->fb.pixelStride = screen->width; - screen->fb.frameBuffer = (CARD8 *) (priv->base); - } - else - { - /* Rotated/Reflected so we need to use shadow fb */ - scrpriv->shadow = TRUE; - - EPHYR_LOG("allocing shadow"); - - KdShadowFbAlloc (screen, - scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)); - } - - return TRUE; -} - -void -ephyrSetScreenSizes (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - - if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180)) - { - pScreen->width = screen->width; - pScreen->height = screen->height; - pScreen->mmWidth = screen->width_mm; - pScreen->mmHeight = screen->height_mm; - } - else - { - pScreen->width = screen->height; - pScreen->height = screen->width; - pScreen->mmWidth = screen->height_mm; - pScreen->mmHeight = screen->width_mm; - } -} - -Bool -ephyrUnmapFramebuffer (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv = screen->driver; - - if (scrpriv->shadow) - KdShadowFbFree (screen); - - /* Note, priv->base will get freed when XImage recreated */ - - return TRUE; -} - -void -ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - - EPHYR_LOG("slow paint"); - - /* FIXME: Slow Rotated/Reflected updates could be much - * much faster efficiently updating via tranforming - * pBuf->pDamage regions - */ - shadowUpdateRotatePacked(pScreen, pBuf); - hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height); -} - -static void -ephyrInternalDamageRedisplay (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - RegionPtr pRegion; - - if (!scrpriv || !scrpriv->pDamage) - return; - - pRegion = DamageRegion (scrpriv->pDamage); - - if (RegionNotEmpty(pRegion)) - { - int nbox; - BoxPtr pbox; - - nbox = RegionNumRects (pRegion); - pbox = RegionRects (pRegion); - - while (nbox--) - { - hostx_paint_rect(screen, - pbox->x1, pbox->y1, - pbox->x1, pbox->y1, - pbox->x2 - pbox->x1, - pbox->y2 - pbox->y1); - pbox++; - } - DamageEmpty (scrpriv->pDamage); - } -} - -static void -ephyrInternalDamageBlockHandler (pointer data, - OSTimePtr pTimeout, - pointer pRead) -{ - ScreenPtr pScreen = (ScreenPtr) data; - - ephyrInternalDamageRedisplay (pScreen); -} - -static void -ephyrInternalDamageWakeupHandler (pointer data, int i, pointer LastSelectMask) -{ - /* FIXME: Not needed ? */ -} - -Bool -ephyrSetInternalDamage (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - PixmapPtr pPixmap = NULL; - - scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0, - (DamageDestroyFunc) 0, - DamageReportNone, - TRUE, - pScreen, - pScreen); - - if (!RegisterBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, - ephyrInternalDamageWakeupHandler, - (pointer) pScreen)) - return FALSE; - - pPixmap = (*pScreen->GetScreenPixmap) (pScreen); - - DamageRegister (&pPixmap->drawable, scrpriv->pDamage); - - return TRUE; -} - -void -ephyrUnsetInternalDamage (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - PixmapPtr pPixmap = NULL; - - pPixmap = (*pScreen->GetScreenPixmap) (pScreen); - DamageUnregister (&pPixmap->drawable, scrpriv->pDamage); - DamageDestroy (scrpriv->pDamage); - - RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, - ephyrInternalDamageWakeupHandler, - (pointer) pScreen); -} - -#ifdef RANDR -Bool -ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - RRScreenSizePtr pSize; - Rotation randr; - int n = 0; - - struct { int width, height; } sizes[] = - { - { 1600, 1200 }, - { 1400, 1050 }, - { 1280, 960 }, - { 1280, 1024 }, - { 1152, 864 }, - { 1024, 768 }, - { 832, 624 }, - { 800, 600 }, - { 720, 400 }, - { 480, 640 }, - { 640, 480 }, - { 640, 400 }, - { 320, 240 }, - { 240, 320 }, - { 160, 160 }, - { 0, 0 } - }; - - EPHYR_LOG("mark"); - - *rotations = RR_Rotate_All|RR_Reflect_All; - - if (!hostx_want_preexisting_window (screen) - && !hostx_want_fullscreen ()) /* only if no -parent switch */ - { - while (sizes[n].width != 0 && sizes[n].height != 0) - { - RRRegisterSize (pScreen, - sizes[n].width, - sizes[n].height, - (sizes[n].width * screen->width_mm)/screen->width, - (sizes[n].height *screen->height_mm)/screen->height - ); - n++; - } - } - - pSize = RRRegisterSize (pScreen, - screen->width, - screen->height, - screen->width_mm, - screen->height_mm); - - randr = KdSubRotation (scrpriv->randr, screen->randr); - - RRSetCurrentConfig (pScreen, randr, 0, pSize); - - return TRUE; -} - -Bool -ephyrRandRSetConfig (ScreenPtr pScreen, - Rotation randr, - int rate, - RRScreenSizePtr pSize) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - Bool wasEnabled = pScreenPriv->enabled; - EphyrScrPriv oldscr; - int oldwidth, oldheight, oldmmwidth, oldmmheight; - Bool oldshadow; - int newwidth, newheight; - - if (screen->randr & (RR_Rotate_0|RR_Rotate_180)) - { - newwidth = pSize->width; - newheight = pSize->height; - } - else - { - newwidth = pSize->height; - newheight = pSize->width; - } - - if (wasEnabled) - KdDisableScreen (pScreen); - - oldscr = *scrpriv; - - oldwidth = screen->width; - oldheight = screen->height; - oldmmwidth = pScreen->mmWidth; - oldmmheight = pScreen->mmHeight; - oldshadow = scrpriv->shadow; - - /* - * Set new configuration - */ - - scrpriv->randr = KdAddRotation (screen->randr, randr); - - ephyrUnmapFramebuffer (screen); - - screen->width = newwidth; - screen->height = newheight; - - if (!ephyrMapFramebuffer (screen)) - goto bail4; - - /* FIXME below should go in own call */ - - if (oldshadow) - KdShadowUnset (screen->pScreen); - else - ephyrUnsetInternalDamage(screen->pScreen); - - if (scrpriv->shadow) - { - if (!KdShadowSet (screen->pScreen, - scrpriv->randr, - ephyrShadowUpdate, - ephyrWindowLinear)) - goto bail4; - } - else - { - /* Without shadow fb ( non rotated ) we need - * to use damage to efficiently update display - * via signal regions what to copy from 'fb'. - */ - if (!ephyrSetInternalDamage(screen->pScreen)) - goto bail4; - } - - ephyrSetScreenSizes (screen->pScreen); - - /* - * Set frame buffer mapping - */ - (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), - pScreen->width, - pScreen->height, - screen->fb.depth, - screen->fb.bitsPerPixel, - screen->fb.byteStride, - screen->fb.frameBuffer); - - /* set the subpixel order */ - - KdSetSubpixelOrder (pScreen, scrpriv->randr); - - if (wasEnabled) - KdEnableScreen (pScreen); - - return TRUE; - - bail4: - EPHYR_LOG("bailed"); - - ephyrUnmapFramebuffer (screen); - *scrpriv = oldscr; - (void) ephyrMapFramebuffer (screen); - - pScreen->width = oldwidth; - pScreen->height = oldheight; - pScreen->mmWidth = oldmmwidth; - pScreen->mmHeight = oldmmheight; - - if (wasEnabled) - KdEnableScreen (pScreen); - return FALSE; -} - -Bool -ephyrRandRInit (ScreenPtr pScreen) -{ - rrScrPrivPtr pScrPriv; - - if (!RRScreenInit (pScreen)) - return FALSE; - - pScrPriv = rrGetScrPriv(pScreen); - pScrPriv->rrGetInfo = ephyrRandRGetInfo; - pScrPriv->rrSetConfig = ephyrRandRSetConfig; - return TRUE; -} -#endif - -Bool -ephyrCreateColormap (ColormapPtr pmap) -{ - return fbInitializeColormap (pmap); -} - -Bool -ephyrInitScreen (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - - EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ; - hostx_set_screen_number (screen, pScreen->myNum); - hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ; - pScreen->CreateColormap = ephyrCreateColormap; - -#ifdef XV - if (!ephyrNoXV) { - if (!ephyrInitVideo (pScreen)) { - EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ; - } else { - EPHYR_LOG ("initialized xvideo okay\n") ; - } - } -#endif /*XV*/ - -#ifdef XF86DRI - if (!ephyrNoDRI && !hostx_has_dri ()) { - EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ; - ephyrNoDRI = TRUE ; -#ifdef GLXEXT - noGlxVisualInit = FALSE ; -#endif - } - if (!ephyrNoDRI) { - ephyrDRIExtensionInit (pScreen) ; - ephyrHijackGLXExtension () ; - } -#endif - -#ifdef GLXEXT - if (ephyrNoDRI) { - noGlxVisualInit = FALSE ; - } -#endif - - return TRUE; -} - -Bool -ephyrFinishInitScreen (ScreenPtr pScreen) -{ - /* FIXME: Calling this even if not using shadow. - * Seems harmless enough. But may be safer elsewhere. - */ - if (!shadowSetup (pScreen)) - return FALSE; - -#ifdef RANDR - if (!ephyrRandRInit (pScreen)) - return FALSE; -#endif - - return TRUE; -} - -Bool -ephyrCreateResources (ScreenPtr pScreen) -{ - KdScreenPriv(pScreen); - KdScreenInfo *screen = pScreenPriv->screen; - EphyrScrPriv *scrpriv = screen->driver; - - EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d", - pScreen, pScreen->myNum, scrpriv->shadow); - - if (scrpriv->shadow) - return KdShadowSet (pScreen, - scrpriv->randr, - ephyrShadowUpdate, - ephyrWindowLinear); - else - return ephyrSetInternalDamage(pScreen); -} - -void -ephyrPreserve (KdCardInfo *card) -{ -} - -Bool -ephyrEnable (ScreenPtr pScreen) -{ - return TRUE; -} - -Bool -ephyrDPMS (ScreenPtr pScreen, int mode) -{ - return TRUE; -} - -void -ephyrDisable (ScreenPtr pScreen) -{ -} - -void -ephyrRestore (KdCardInfo *card) -{ -} - -void -ephyrScreenFini (KdScreenInfo *screen) -{ - EphyrScrPriv *scrpriv = screen->driver; - if (scrpriv->shadow) { - KdShadowFbFree (screen); - } - free(screen->driver); - screen->driver = NULL; -} - -/* - * Port of Mark McLoughlin's Xnest fix for focus in + modifier bug. - * See https://bugs.freedesktop.org/show_bug.cgi?id=3030 - */ -void -ephyrUpdateModifierState(unsigned int state) -{ - - DeviceIntPtr pDev = inputInfo.keyboard; - KeyClassPtr keyc = pDev->key; - int i; - CARD8 mask; - int xkb_state; - - if (!pDev) - return; - - xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state); - state = state & 0xff; - - 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 ((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) { - if (key_is_down(pDev, key, KEY_PROCESSED)) - KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE); - - if (--count == 0) - break; - } - } - - /* 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 -ephyrBlockSigio (void) -{ - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_BLOCK, &set, 0); -} - -static void -ephyrUnblockSigio (void) -{ - sigset_t set; - - sigemptyset (&set); - sigaddset (&set, SIGIO); - sigprocmask (SIG_UNBLOCK, &set, 0); -} - -static Bool -ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) -{ - return FALSE; -} - -static void -ephyrCrossScreen (ScreenPtr pScreen, Bool entering) -{ -} - -int ephyrCurScreen; /*current event screen*/ - -static void -ephyrWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - ephyrBlockSigio (); - ephyrCurScreen = pScreen->myNum; - miPointerWarpCursor (inputInfo.pointer, pScreen, x, y); - ephyrUnblockSigio (); -} - -miPointerScreenFuncRec ephyrPointerScreenFuncs = -{ - ephyrCursorOffScreen, - ephyrCrossScreen, - ephyrWarpCursor, - NULL, - NULL -}; - -#ifdef XF86DRI -/** - * find if the remote window denoted by a_remote - * is paired with an internal Window within the Xephyr server. - * If the remove window is paired with an internal window, send an - * expose event to the client insterested in the internal window expose event. - * - * Pairing happens when a drawable inside Xephyr is associated with - * a GL surface in a DRI environment. - * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to - * know a paired window is created. - * - * This is useful to make GL drawables (only windows for now) handle - * expose events and send those events to clients. - */ -static void -ephyrExposePairedWindow (int a_remote) -{ - EphyrWindowPair *pair = NULL; - RegionRec reg; - ScreenPtr screen; - - if (!findWindowPairFromRemote (a_remote, &pair)) { - EPHYR_LOG ("did not find a pair for this window\n"); - return; - } - screen = pair->local->drawable.pScreen; - RegionNull(®); - RegionCopy(®, &pair->local->clipList); - screen->WindowExposures (pair->local, ®, NullRegion); - RegionUninit(®); -} -#endif /* XF86DRI */ - -void -ephyrPoll(void) -{ - EphyrHostXEvent ev; - - while (hostx_get_event(&ev)) - { - switch (ev.type) - { - case EPHYR_EV_MOUSE_MOTION: - if (!ephyrMouse || - !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ; - continue; - } - { - if (ev.data.mouse_motion.screen >=0 - && (ephyrCurScreen != ev.data.mouse_motion.screen)) - { - EPHYR_LOG ("warping mouse cursor. " - "cur_screen%d, motion_screen:%d\n", - ephyrCurScreen, ev.data.mouse_motion.screen) ; - if (ev.data.mouse_motion.screen >= 0) - { - ephyrWarpCursor - (inputInfo.pointer, screenInfo.screens[ev.data.mouse_motion.screen], - ev.data.mouse_motion.x, - ev.data.mouse_motion.y ); - } - } - else - { - int x=0, y=0; -#ifdef XF86DRI - EphyrWindowPair *pair = NULL; -#endif - EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ; - x = ev.data.mouse_motion.x; - y = ev.data.mouse_motion.y; - EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ; -#ifdef XF86DRI - EPHYR_LOG ("is this window peered by a gl drawable ?\n") ; - if (findWindowPairFromRemote (ev.data.mouse_motion.window, - &pair)) - { - EPHYR_LOG ("yes, it is peered\n") ; - x += pair->local->drawable.x; - y += pair->local->drawable.y; - } - else - { - EPHYR_LOG ("no, it is not peered\n") ; - } - EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ; -#endif - KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0); - } - } - break; - - case EPHYR_EV_MOUSE_PRESS: - if (!ephyrMouse || - !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) { - EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ; - continue; - } - EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ; - ephyrUpdateModifierState(ev.key_state); - mouseState |= ev.data.mouse_down.button_num; - KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0); - break; - - case EPHYR_EV_MOUSE_RELEASE: - if (!ephyrMouse || - !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - mouseState &= ~ev.data.mouse_up.button_num; - EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ; - KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0); - break; - - case EPHYR_EV_KEY_PRESS: - if (!ephyrKbd || - !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE); - break; - - case EPHYR_EV_KEY_RELEASE: - if (!ephyrKbd || - !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) - continue; - ephyrUpdateModifierState(ev.key_state); - KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE); - break; - -#ifdef XF86DRI - case EPHYR_EV_EXPOSE: - /* - * We only receive expose events when the expose event have - * be generated for a drawable that is a host X window managed - * by Xephyr. Host X windows managed by Xephyr exists for instance - * when Xephyr is asked to create a GL drawable in a DRI environment. - */ - ephyrExposePairedWindow (ev.data.expose.window); - break; -#endif /* XF86DRI */ - - default: - break; - } - } -} - -void -ephyrCardFini (KdCardInfo *card) -{ - EphyrPriv *priv = card->driver; - free(priv); -} - -void -ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs) -{ - /* XXX Not sure if this is right */ - - EPHYR_LOG("mark"); - - while (n--) - { - pdefs->red = 0; - pdefs->green = 0; - pdefs->blue = 0; - pdefs++; - } - -} - -void -ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs) -{ - int min, max, p; - - /* XXX Not sure if this is right */ - - min = 256; - max = 0; - - while (n--) - { - p = pdefs->pixel; - if (p < min) - min = p; - if (p > max) - max = p; - - hostx_set_cmap_entry(p, - pdefs->red >> 8, - pdefs->green >> 8, - pdefs->blue >> 8); - pdefs++; - } -} - -/* Mouse calls */ - -static Status -MouseInit (KdPointerInfo *pi) -{ - pi->driverPrivate = (EphyrPointerPrivate *) - calloc(sizeof(EphyrPointerPrivate), 1); - ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; - pi->nAxes = 3; - pi->nButtons = 32; - free(pi->name); - pi->name = strdup("Xephyr virtual mouse"); - ephyrMouse = pi; - return Success; -} - -static Status -MouseEnable (KdPointerInfo *pi) -{ - ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE; - return Success; -} - -static void -MouseDisable (KdPointerInfo *pi) -{ - ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; - return; -} - -static void -MouseFini (KdPointerInfo *pi) -{ - ephyrMouse = NULL; - return; -} - -KdPointerDriver EphyrMouseDriver = { - "ephyr", - MouseInit, - MouseEnable, - MouseDisable, - MouseFini, - NULL, -}; - -/* Keyboard */ - -static Status -EphyrKeyboardInit (KdKeyboardInfo *ki) -{ - ki->driverPrivate = (EphyrKbdPrivate *) - calloc(sizeof(EphyrKbdPrivate), 1); - hostx_load_keymap(); - if (!ephyrKeySyms.map) { - ErrorF("Couldn't load keymap from host\n"); - return BadAlloc; - } - ki->minScanCode = ephyrKeySyms.minKeyCode; - ki->maxScanCode = ephyrKeySyms.maxKeyCode; - free(ki->name); - ki->name = strdup("Xephyr virtual keyboard"); - ephyrKbd = ki; - return Success; -} - -static Status -EphyrKeyboardEnable (KdKeyboardInfo *ki) -{ - ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE; - - return Success; -} - -static void -EphyrKeyboardDisable (KdKeyboardInfo *ki) -{ - ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE; -} - -static void -EphyrKeyboardFini (KdKeyboardInfo *ki) -{ - ephyrKbd = NULL; - return; -} - -static void -EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds) -{ -} - -static void -EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration) -{ -} - - -KdKeyboardDriver EphyrKeyboardDriver = { - "ephyr", - EphyrKeyboardInit, - EphyrKeyboardEnable, - EphyrKeyboardLeds, - EphyrKeyboardBell, - EphyrKeyboardDisable, - EphyrKeyboardFini, - NULL, -}; +/* + * Xephyr - A kdrive X server thats runs in a host X window. + * Authored by Matthew Allum + * + * Copyright © 2004 Nokia + * + * 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 Nokia not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Nokia makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * NOKIA DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL NOKIA 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "ephyr.h" + +#include "inputstr.h" +#include "scrnintstr.h" +#include "ephyrlog.h" + +#ifdef XF86DRI +#include "ephyrdri.h" +#include "ephyrdriext.h" +#include "ephyrglxext.h" +#endif /* XF86DRI */ + +#include "xkbsrv.h" + +extern int KdTsPhyScreen; +#ifdef GLXEXT +extern Bool noGlxVisualInit; +#endif + +KdKeyboardInfo *ephyrKbd; +KdPointerInfo *ephyrMouse; +EphyrKeySyms ephyrKeySyms; +Bool ephyrNoDRI=FALSE ; +Bool ephyrNoXV=FALSE ; + +static int mouseState = 0; +static Rotation ephyrRandr = RR_Rotate_0; + +typedef struct _EphyrInputPrivate { + Bool enabled; +} EphyrKbdPrivate, EphyrPointerPrivate; + +Bool EphyrWantGrayScale = 0; + + +Bool +ephyrInitialize (KdCardInfo *card, EphyrPriv *priv) +{ + OsSignal(SIGUSR1, hostx_handle_signal); + + priv->base = 0; + priv->bytes_per_line = 0; + return TRUE; +} + +Bool +ephyrCardInit (KdCardInfo *card) +{ + EphyrPriv *priv; + + priv = (EphyrPriv *) malloc(sizeof (EphyrPriv)); + if (!priv) + return FALSE; + + if (!ephyrInitialize (card, priv)) + { + free(priv); + return FALSE; + } + card->driver = priv; + + return TRUE; +} + +Bool +ephyrScreenInitialize (KdScreenInfo *screen, EphyrScrPriv *scrpriv) +{ + int width = 640, height = 480; + CARD32 redMask, greenMask, blueMask; + + if (hostx_want_screen_size(screen, &width, &height) + || !screen->width || !screen->height) + { + screen->width = width; + screen->height = height; + } + + if (EphyrWantGrayScale) + screen->fb.depth = 8; + + if (screen->fb.depth && screen->fb.depth != hostx_get_depth()) + { + if (screen->fb.depth < hostx_get_depth() + && (screen->fb.depth == 24 || screen->fb.depth == 16 + || screen->fb.depth == 8)) + { + hostx_set_server_depth(screen, screen->fb.depth); + } + else + ErrorF("\nXephyr: requested screen depth not supported, setting to match hosts.\n"); + } + + screen->fb.depth = hostx_get_server_depth(screen); + screen->rate = 72; + + if (screen->fb.depth <= 8) + { + if (EphyrWantGrayScale) + screen->fb.visuals = ((1 << StaticGray) | (1 << GrayScale)); + else + screen->fb.visuals = ((1 << StaticGray) | + (1 << GrayScale) | + (1 << StaticColor) | + (1 << PseudoColor) | + (1 << TrueColor) | + (1 << DirectColor)); + + screen->fb.redMask = 0x00; + screen->fb.greenMask = 0x00; + screen->fb.blueMask = 0x00; + screen->fb.depth = 8; + screen->fb.bitsPerPixel = 8; + } + else + { + screen->fb.visuals = (1 << TrueColor); + + if (screen->fb.depth <= 15) + { + screen->fb.depth = 15; + screen->fb.bitsPerPixel = 16; + } + else if (screen->fb.depth <= 16) + { + screen->fb.depth = 16; + screen->fb.bitsPerPixel = 16; + } + else if (screen->fb.depth <= 24) + { + screen->fb.depth = 24; + screen->fb.bitsPerPixel = 32; + } + else if (screen->fb.depth <= 30) + { + screen->fb.depth = 30; + screen->fb.bitsPerPixel = 32; + } + else + { + ErrorF("\nXephyr: Unsupported screen depth %d\n", + screen->fb.depth); + return FALSE; + } + + hostx_get_visual_masks (screen, &redMask, &greenMask, &blueMask); + + screen->fb.redMask = (Pixel) redMask; + screen->fb.greenMask = (Pixel) greenMask; + screen->fb.blueMask = (Pixel) blueMask; + + } + + scrpriv->randr = screen->randr; + + return ephyrMapFramebuffer (screen); +} + +Bool +ephyrScreenInit (KdScreenInfo *screen) +{ + EphyrScrPriv *scrpriv; + + scrpriv = calloc(1, sizeof (EphyrScrPriv)); + + if (!scrpriv) + return FALSE; + + screen->driver = scrpriv; + + if (!ephyrScreenInitialize (screen, scrpriv)) + { + screen->driver = 0; + free(scrpriv); + return FALSE; + } + + return TRUE; +} + +void* +ephyrWindowLinear (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size, + void *closure) +{ + KdScreenPriv(pScreen); + EphyrPriv *priv = pScreenPriv->card->driver; + + if (!pScreenPriv->enabled) + return 0; + + *size = priv->bytes_per_line; + return priv->base + row * priv->bytes_per_line + offset; +} + +/** + * Figure out display buffer size. If fakexa is enabled, allocate a larger + * buffer so that fakexa has space to put offscreen pixmaps. + */ +int +ephyrBufferHeight(KdScreenInfo *screen) +{ + int buffer_height; + if (ephyrFuncs.initAccel == NULL) + buffer_height = screen->height; + else + buffer_height = 3 * screen->height; + return buffer_height; +} + + +Bool +ephyrMapFramebuffer (KdScreenInfo *screen) +{ + EphyrScrPriv *scrpriv = screen->driver; + EphyrPriv *priv = screen->card->driver; + KdPointerMatrix m; + int buffer_height; + + EPHYR_LOG("screen->width: %d, screen->height: %d index=%d", + screen->width, screen->height, screen->mynum); + + /* + * Use the rotation last applied to ourselves (in the Xephyr case the fb + * coordinate system moves independently of the pointer coordiante system). + */ + KdComputePointerMatrix (&m, ephyrRandr, screen->width, screen->height); + KdSetPointerMatrix (&m); + + priv->bytes_per_line = ((screen->width * screen->fb.bitsPerPixel + 31) >> 5) << 2; + + buffer_height = ephyrBufferHeight(screen); + + priv->base = hostx_screen_init (screen, screen->width, screen->height, buffer_height); + + if ((scrpriv->randr & RR_Rotate_0) && !(scrpriv->randr & RR_Reflect_All)) + { + scrpriv->shadow = FALSE; + + screen->fb.byteStride = priv->bytes_per_line; + screen->fb.pixelStride = screen->width; + screen->fb.frameBuffer = (CARD8 *) (priv->base); + } + else + { + /* Rotated/Reflected so we need to use shadow fb */ + scrpriv->shadow = TRUE; + + EPHYR_LOG("allocing shadow"); + + KdShadowFbAlloc (screen, + scrpriv->randr & (RR_Rotate_90|RR_Rotate_270)); + } + + return TRUE; +} + +void +ephyrSetScreenSizes (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + + if (scrpriv->randr & (RR_Rotate_0|RR_Rotate_180)) + { + pScreen->width = screen->width; + pScreen->height = screen->height; + pScreen->mmWidth = screen->width_mm; + pScreen->mmHeight = screen->height_mm; + } + else + { + pScreen->width = screen->height; + pScreen->height = screen->width; + pScreen->mmWidth = screen->height_mm; + pScreen->mmHeight = screen->width_mm; + } +} + +Bool +ephyrUnmapFramebuffer (KdScreenInfo *screen) +{ + EphyrScrPriv *scrpriv = screen->driver; + + if (scrpriv->shadow) + KdShadowFbFree (screen); + + /* Note, priv->base will get freed when XImage recreated */ + + return TRUE; +} + +void +ephyrShadowUpdate (ScreenPtr pScreen, shadowBufPtr pBuf) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + + EPHYR_LOG("slow paint"); + + /* FIXME: Slow Rotated/Reflected updates could be much + * much faster efficiently updating via tranforming + * pBuf->pDamage regions + */ + shadowUpdateRotatePacked(pScreen, pBuf); + hostx_paint_rect(screen, 0,0,0,0, screen->width, screen->height); +} + +static void +ephyrInternalDamageRedisplay (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + RegionPtr pRegion; + + if (!scrpriv || !scrpriv->pDamage) + return; + + pRegion = DamageRegion (scrpriv->pDamage); + + if (RegionNotEmpty(pRegion)) + { + int nbox; + BoxPtr pbox; + + nbox = RegionNumRects (pRegion); + pbox = RegionRects (pRegion); + + while (nbox--) + { + hostx_paint_rect(screen, + pbox->x1, pbox->y1, + pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, + pbox->y2 - pbox->y1); + pbox++; + } + DamageEmpty (scrpriv->pDamage); + } +} + +static void +ephyrInternalDamageBlockHandler (pointer data, + OSTimePtr pTimeout, + pointer pRead) +{ + ScreenPtr pScreen = (ScreenPtr) data; + + ephyrInternalDamageRedisplay (pScreen); +} + +static void +ephyrInternalDamageWakeupHandler (pointer data, int i, pointer LastSelectMask) +{ + /* FIXME: Not needed ? */ +} + +Bool +ephyrSetInternalDamage (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + PixmapPtr pPixmap = NULL; + + scrpriv->pDamage = DamageCreate ((DamageReportFunc) 0, + (DamageDestroyFunc) 0, + DamageReportNone, + TRUE, + pScreen, + pScreen); + + if (!RegisterBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, + ephyrInternalDamageWakeupHandler, + (pointer) pScreen)) + return FALSE; + + pPixmap = (*pScreen->GetScreenPixmap) (pScreen); + + DamageRegister (&pPixmap->drawable, scrpriv->pDamage); + + return TRUE; +} + +void +ephyrUnsetInternalDamage (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + PixmapPtr pPixmap = NULL; + + pPixmap = (*pScreen->GetScreenPixmap) (pScreen); + DamageUnregister (&pPixmap->drawable, scrpriv->pDamage); + DamageDestroy (scrpriv->pDamage); + + RemoveBlockAndWakeupHandlers (ephyrInternalDamageBlockHandler, + ephyrInternalDamageWakeupHandler, + (pointer) pScreen); +} + +#ifdef RANDR +Bool +ephyrRandRGetInfo (ScreenPtr pScreen, Rotation *rotations) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + RRScreenSizePtr pSize; + Rotation randr; + int n = 0; + + struct { int width, height; } sizes[] = + { + { 1600, 1200 }, + { 1400, 1050 }, + { 1280, 960 }, + { 1280, 1024 }, + { 1152, 864 }, + { 1024, 768 }, + { 832, 624 }, + { 800, 600 }, + { 720, 400 }, + { 480, 640 }, + { 640, 480 }, + { 640, 400 }, + { 320, 240 }, + { 240, 320 }, + { 160, 160 }, + { 0, 0 } + }; + + EPHYR_LOG("mark"); + + *rotations = RR_Rotate_All|RR_Reflect_All; + + if (!hostx_want_preexisting_window (screen) + && !hostx_want_fullscreen ()) /* only if no -parent switch */ + { + while (sizes[n].width != 0 && sizes[n].height != 0) + { + RRRegisterSize (pScreen, + sizes[n].width, + sizes[n].height, + (sizes[n].width * screen->width_mm)/screen->width, + (sizes[n].height *screen->height_mm)/screen->height + ); + n++; + } + } + + pSize = RRRegisterSize (pScreen, + screen->width, + screen->height, + screen->width_mm, + screen->height_mm); + + randr = KdSubRotation (scrpriv->randr, screen->randr); + + RRSetCurrentConfig (pScreen, randr, 0, pSize); + + return TRUE; +} + +Bool +ephyrRandRSetConfig (ScreenPtr pScreen, + Rotation randr, + int rate, + RRScreenSizePtr pSize) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + Bool wasEnabled = pScreenPriv->enabled; + EphyrScrPriv oldscr; + int oldwidth, oldheight, oldmmwidth, oldmmheight; + Bool oldshadow; + int newwidth, newheight; + + if (screen->randr & (RR_Rotate_0|RR_Rotate_180)) + { + newwidth = pSize->width; + newheight = pSize->height; + } + else + { + newwidth = pSize->height; + newheight = pSize->width; + } + + if (wasEnabled) + KdDisableScreen (pScreen); + + oldscr = *scrpriv; + + oldwidth = screen->width; + oldheight = screen->height; + oldmmwidth = pScreen->mmWidth; + oldmmheight = pScreen->mmHeight; + oldshadow = scrpriv->shadow; + + /* + * Set new configuration + */ + + /* + * We need to store the rotation value for pointer coords transformation; + * though initially the pointer and fb rotation are identical, when we map + * the fb, the screen will be reinitialized and return into an unrotated + * state (presumably the HW is taking care of the rotation of the fb), but the + * pointer still needs to be transformed. + */ + ephyrRandr = KdAddRotation (screen->randr, randr); + scrpriv->randr = ephyrRandr; + + ephyrUnmapFramebuffer (screen); + + screen->width = newwidth; + screen->height = newheight; + + if (!ephyrMapFramebuffer (screen)) + goto bail4; + + /* FIXME below should go in own call */ + + if (oldshadow) + KdShadowUnset (screen->pScreen); + else + ephyrUnsetInternalDamage(screen->pScreen); + + if (scrpriv->shadow) + { + if (!KdShadowSet (screen->pScreen, + scrpriv->randr, + ephyrShadowUpdate, + ephyrWindowLinear)) + goto bail4; + } + else + { + /* Without shadow fb ( non rotated ) we need + * to use damage to efficiently update display + * via signal regions what to copy from 'fb'. + */ + if (!ephyrSetInternalDamage(screen->pScreen)) + goto bail4; + } + + ephyrSetScreenSizes (screen->pScreen); + + /* + * Set frame buffer mapping + */ + (*pScreen->ModifyPixmapHeader) (fbGetScreenPixmap (pScreen), + pScreen->width, + pScreen->height, + screen->fb.depth, + screen->fb.bitsPerPixel, + screen->fb.byteStride, + screen->fb.frameBuffer); + + /* set the subpixel order */ + + KdSetSubpixelOrder (pScreen, scrpriv->randr); + + if (wasEnabled) + KdEnableScreen (pScreen); + + return TRUE; + + bail4: + EPHYR_LOG("bailed"); + + ephyrUnmapFramebuffer (screen); + *scrpriv = oldscr; + (void) ephyrMapFramebuffer (screen); + + pScreen->width = oldwidth; + pScreen->height = oldheight; + pScreen->mmWidth = oldmmwidth; + pScreen->mmHeight = oldmmheight; + + if (wasEnabled) + KdEnableScreen (pScreen); + return FALSE; +} + +Bool +ephyrRandRInit (ScreenPtr pScreen) +{ + rrScrPrivPtr pScrPriv; + + if (!RRScreenInit (pScreen)) + return FALSE; + + pScrPriv = rrGetScrPriv(pScreen); + pScrPriv->rrGetInfo = ephyrRandRGetInfo; + pScrPriv->rrSetConfig = ephyrRandRSetConfig; + return TRUE; +} +#endif + +Bool +ephyrCreateColormap (ColormapPtr pmap) +{ + return fbInitializeColormap (pmap); +} + +Bool +ephyrInitScreen (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + + EPHYR_LOG ("pScreen->myNum:%d\n", pScreen->myNum) ; + hostx_set_screen_number (screen, pScreen->myNum); + hostx_set_win_title (screen, "(ctrl+shift grabs mouse and keyboard)") ; + pScreen->CreateColormap = ephyrCreateColormap; + +#ifdef XV + if (!ephyrNoXV) { + if (!ephyrInitVideo (pScreen)) { + EPHYR_LOG_ERROR ("failed to initialize xvideo\n") ; + } else { + EPHYR_LOG ("initialized xvideo okay\n") ; + } + } +#endif /*XV*/ + +#ifdef XF86DRI + if (!ephyrNoDRI && !hostx_has_dri ()) { + EPHYR_LOG ("host x does not support DRI. Disabling DRI forwarding\n") ; + ephyrNoDRI = TRUE ; +#ifdef GLXEXT + noGlxVisualInit = FALSE ; +#endif + } + if (!ephyrNoDRI) { + ephyrDRIExtensionInit (pScreen) ; + ephyrHijackGLXExtension () ; + } +#endif + +#ifdef GLXEXT + if (ephyrNoDRI) { + noGlxVisualInit = FALSE ; + } +#endif + + return TRUE; +} + +Bool +ephyrFinishInitScreen (ScreenPtr pScreen) +{ + /* FIXME: Calling this even if not using shadow. + * Seems harmless enough. But may be safer elsewhere. + */ + if (!shadowSetup (pScreen)) + return FALSE; + +#ifdef RANDR + if (!ephyrRandRInit (pScreen)) + return FALSE; +#endif + + return TRUE; +} + +Bool +ephyrCreateResources (ScreenPtr pScreen) +{ + KdScreenPriv(pScreen); + KdScreenInfo *screen = pScreenPriv->screen; + EphyrScrPriv *scrpriv = screen->driver; + + EPHYR_LOG("mark pScreen=%p mynum=%d shadow=%d", + pScreen, pScreen->myNum, scrpriv->shadow); + + if (scrpriv->shadow) + return KdShadowSet (pScreen, + scrpriv->randr, + ephyrShadowUpdate, + ephyrWindowLinear); + else + return ephyrSetInternalDamage(pScreen); +} + +void +ephyrPreserve (KdCardInfo *card) +{ +} + +Bool +ephyrEnable (ScreenPtr pScreen) +{ + return TRUE; +} + +Bool +ephyrDPMS (ScreenPtr pScreen, int mode) +{ + return TRUE; +} + +void +ephyrDisable (ScreenPtr pScreen) +{ +} + +void +ephyrRestore (KdCardInfo *card) +{ +} + +void +ephyrScreenFini (KdScreenInfo *screen) +{ + EphyrScrPriv *scrpriv = screen->driver; + if (scrpriv->shadow) { + KdShadowFbFree (screen); + } + free(screen->driver); + screen->driver = NULL; +} + +/* + * Port of Mark McLoughlin's Xnest fix for focus in + modifier bug. + * See https://bugs.freedesktop.org/show_bug.cgi?id=3030 + */ +void +ephyrUpdateModifierState(unsigned int state) +{ + + DeviceIntPtr pDev = inputInfo.keyboard; + KeyClassPtr keyc = pDev->key; + int i; + CARD8 mask; + int xkb_state; + + if (!pDev) + return; + + xkb_state = XkbStateFieldFromRec(&pDev->key->xkbInfo->state); + state = state & 0xff; + + 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 ((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) { + if (key_is_down(pDev, key, KEY_PROCESSED)) + KdEnqueueKeyboardEvent (ephyrKbd, key, TRUE); + + if (--count == 0) + break; + } + } + + /* 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 +ephyrBlockSigio (void) +{ + sigset_t set; + + sigemptyset (&set); + sigaddset (&set, SIGIO); + sigprocmask (SIG_BLOCK, &set, 0); +} + +static void +ephyrUnblockSigio (void) +{ + sigset_t set; + + sigemptyset (&set); + sigaddset (&set, SIGIO); + sigprocmask (SIG_UNBLOCK, &set, 0); +} + +static Bool +ephyrCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) +{ + return FALSE; +} + +static void +ephyrCrossScreen (ScreenPtr pScreen, Bool entering) +{ +} + +int ephyrCurScreen; /*current event screen*/ + +static void +ephyrWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) +{ + ephyrBlockSigio (); + ephyrCurScreen = pScreen->myNum; + miPointerWarpCursor (inputInfo.pointer, pScreen, x, y); + ephyrUnblockSigio (); +} + +miPointerScreenFuncRec ephyrPointerScreenFuncs = +{ + ephyrCursorOffScreen, + ephyrCrossScreen, + ephyrWarpCursor, + NULL, + NULL +}; + +#ifdef XF86DRI +/** + * find if the remote window denoted by a_remote + * is paired with an internal Window within the Xephyr server. + * If the remove window is paired with an internal window, send an + * expose event to the client insterested in the internal window expose event. + * + * Pairing happens when a drawable inside Xephyr is associated with + * a GL surface in a DRI environment. + * Look at the function ProcXF86DRICreateDrawable in ephyrdriext.c to + * know a paired window is created. + * + * This is useful to make GL drawables (only windows for now) handle + * expose events and send those events to clients. + */ +static void +ephyrExposePairedWindow (int a_remote) +{ + EphyrWindowPair *pair = NULL; + RegionRec reg; + ScreenPtr screen; + + if (!findWindowPairFromRemote (a_remote, &pair)) { + EPHYR_LOG ("did not find a pair for this window\n"); + return; + } + screen = pair->local->drawable.pScreen; + RegionNull(®); + RegionCopy(®, &pair->local->clipList); + screen->WindowExposures (pair->local, ®, NullRegion); + RegionUninit(®); +} +#endif /* XF86DRI */ + +void +ephyrPoll(void) +{ + EphyrHostXEvent ev; + + while (hostx_get_event(&ev)) + { + switch (ev.type) + { + case EPHYR_EV_MOUSE_MOTION: + if (!ephyrMouse || + !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) { + EPHYR_LOG ("skipping mouse motion:%d\n", ephyrCurScreen) ; + continue; + } + { + if (ev.data.mouse_motion.screen >=0 + && (ephyrCurScreen != ev.data.mouse_motion.screen)) + { + EPHYR_LOG ("warping mouse cursor. " + "cur_screen%d, motion_screen:%d\n", + ephyrCurScreen, ev.data.mouse_motion.screen) ; + if (ev.data.mouse_motion.screen >= 0) + { + ephyrWarpCursor + (inputInfo.pointer, screenInfo.screens[ev.data.mouse_motion.screen], + ev.data.mouse_motion.x, + ev.data.mouse_motion.y ); + } + } + else + { + int x=0, y=0; +#ifdef XF86DRI + EphyrWindowPair *pair = NULL; +#endif + EPHYR_LOG ("enqueuing mouse motion:%d\n", ephyrCurScreen) ; + x = ev.data.mouse_motion.x; + y = ev.data.mouse_motion.y; + EPHYR_LOG ("initial (x,y):(%d,%d)\n", x, y) ; +#ifdef XF86DRI + EPHYR_LOG ("is this window peered by a gl drawable ?\n") ; + if (findWindowPairFromRemote (ev.data.mouse_motion.window, + &pair)) + { + EPHYR_LOG ("yes, it is peered\n") ; + x += pair->local->drawable.x; + y += pair->local->drawable.y; + } + else + { + EPHYR_LOG ("no, it is not peered\n") ; + } + EPHYR_LOG ("final (x,y):(%d,%d)\n", x, y) ; +#endif + KdEnqueuePointerEvent(ephyrMouse, mouseState, x, y, 0); + } + } + break; + + case EPHYR_EV_MOUSE_PRESS: + if (!ephyrMouse || + !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) { + EPHYR_LOG ("skipping mouse press:%d\n", ephyrCurScreen) ; + continue; + } + EPHYR_LOG ("enqueuing mouse press:%d\n", ephyrCurScreen) ; + ephyrUpdateModifierState(ev.key_state); + mouseState |= ev.data.mouse_down.button_num; + KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0); + break; + + case EPHYR_EV_MOUSE_RELEASE: + if (!ephyrMouse || + !((EphyrPointerPrivate *)ephyrMouse->driverPrivate)->enabled) + continue; + ephyrUpdateModifierState(ev.key_state); + mouseState &= ~ev.data.mouse_up.button_num; + EPHYR_LOG ("enqueuing mouse release:%d\n", ephyrCurScreen) ; + KdEnqueuePointerEvent(ephyrMouse, mouseState|KD_MOUSE_DELTA, 0, 0, 0); + break; + + case EPHYR_EV_KEY_PRESS: + if (!ephyrKbd || + !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) + continue; + ephyrUpdateModifierState(ev.key_state); + KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_down.scancode, FALSE); + break; + + case EPHYR_EV_KEY_RELEASE: + if (!ephyrKbd || + !((EphyrKbdPrivate *)ephyrKbd->driverPrivate)->enabled) + continue; + ephyrUpdateModifierState(ev.key_state); + KdEnqueueKeyboardEvent (ephyrKbd, ev.data.key_up.scancode, TRUE); + break; + +#ifdef XF86DRI + case EPHYR_EV_EXPOSE: + /* + * We only receive expose events when the expose event have + * be generated for a drawable that is a host X window managed + * by Xephyr. Host X windows managed by Xephyr exists for instance + * when Xephyr is asked to create a GL drawable in a DRI environment. + */ + ephyrExposePairedWindow (ev.data.expose.window); + break; +#endif /* XF86DRI */ + + default: + break; + } + } +} + +void +ephyrCardFini (KdCardInfo *card) +{ + EphyrPriv *priv = card->driver; + free(priv); +} + +void +ephyrGetColors (ScreenPtr pScreen, int n, xColorItem *pdefs) +{ + /* XXX Not sure if this is right */ + + EPHYR_LOG("mark"); + + while (n--) + { + pdefs->red = 0; + pdefs->green = 0; + pdefs->blue = 0; + pdefs++; + } + +} + +void +ephyrPutColors (ScreenPtr pScreen, int n, xColorItem *pdefs) +{ + int min, max, p; + + /* XXX Not sure if this is right */ + + min = 256; + max = 0; + + while (n--) + { + p = pdefs->pixel; + if (p < min) + min = p; + if (p > max) + max = p; + + hostx_set_cmap_entry(p, + pdefs->red >> 8, + pdefs->green >> 8, + pdefs->blue >> 8); + pdefs++; + } +} + +/* Mouse calls */ + +static Status +MouseInit (KdPointerInfo *pi) +{ + pi->driverPrivate = (EphyrPointerPrivate *) + calloc(sizeof(EphyrPointerPrivate), 1); + ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; + pi->nAxes = 3; + pi->nButtons = 32; + free(pi->name); + pi->name = strdup("Xephyr virtual mouse"); + + /* + * Must transform pointer coords since the pointer position + * relative to the Xephyr window is controlled by the host server and + * remains constant regardless of any rotation applied to the Xephyr screen. + */ + pi->transformCoordinates = TRUE; + + ephyrMouse = pi; + return Success; +} + +static Status +MouseEnable (KdPointerInfo *pi) +{ + ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = TRUE; + return Success; +} + +static void +MouseDisable (KdPointerInfo *pi) +{ + ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; + return; +} + +static void +MouseFini (KdPointerInfo *pi) +{ + ephyrMouse = NULL; + return; +} + +KdPointerDriver EphyrMouseDriver = { + "ephyr", + MouseInit, + MouseEnable, + MouseDisable, + MouseFini, + NULL, +}; + +/* Keyboard */ + +static Status +EphyrKeyboardInit (KdKeyboardInfo *ki) +{ + ki->driverPrivate = (EphyrKbdPrivate *) + calloc(sizeof(EphyrKbdPrivate), 1); + hostx_load_keymap(); + if (!ephyrKeySyms.map) { + ErrorF("Couldn't load keymap from host\n"); + return BadAlloc; + } + ki->minScanCode = ephyrKeySyms.minKeyCode; + ki->maxScanCode = ephyrKeySyms.maxKeyCode; + free(ki->name); + ki->name = strdup("Xephyr virtual keyboard"); + ephyrKbd = ki; + return Success; +} + +static Status +EphyrKeyboardEnable (KdKeyboardInfo *ki) +{ + ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = TRUE; + + return Success; +} + +static void +EphyrKeyboardDisable (KdKeyboardInfo *ki) +{ + ((EphyrKbdPrivate *)ki->driverPrivate)->enabled = FALSE; +} + +static void +EphyrKeyboardFini (KdKeyboardInfo *ki) +{ + ephyrKbd = NULL; + return; +} + +static void +EphyrKeyboardLeds (KdKeyboardInfo *ki, int leds) +{ +} + +static void +EphyrKeyboardBell (KdKeyboardInfo *ki, int volume, int frequency, int duration) +{ +} + + +KdKeyboardDriver EphyrKeyboardDriver = { + "ephyr", + EphyrKeyboardInit, + EphyrKeyboardEnable, + EphyrKeyboardLeds, + EphyrKeyboardBell, + EphyrKeyboardDisable, + EphyrKeyboardFini, + NULL, +}; diff --git a/xorg-server/hw/kdrive/ephyr/ephyrinit.c b/xorg-server/hw/kdrive/ephyr/ephyrinit.c index 27cab3b63..2deb7b81d 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrinit.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrinit.c @@ -358,13 +358,18 @@ ephyrDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen) return TRUE; } +static void +ephyrDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen) +{ +} + miPointerSpriteFuncRec EphyrPointerSpriteFuncs = { ephyrRealizeCursor, ephyrUnrealizeCursor, ephyrSetCursor, ephyrMoveCursor, ephyrDeviceCursorInitialize, - NULL + ephyrDeviceCursorCleanup }; diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h index 94f17e980..2a5c805c4 100644 --- a/xorg-server/hw/xfree86/common/xf86Module.h +++ b/xorg-server/hw/xfree86/common/xf86Module.h @@ -83,7 +83,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(11, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(12, 2) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(13, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(5, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index e7e1ce1f0..26051ad7f 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -469,6 +469,20 @@ match_path_pattern(const char *attr, const char *pattern) #define match_path_pattern match_substring #endif +/* + * If no Layout section is found, xf86ServerLayout.id becomes "(implicit)" + * It is convenient that "" in patterns means "no explicit layout" + */ +static int +match_string_implicit(const char *attr, const char *pattern) +{ + if (strlen(pattern)) { + return strcmp(attr, pattern); + } else { + return strcmp(attr,"(implicit)"); + } +} + /* * Match an attribute against a list of NULL terminated arrays of patterns. * If a pattern in each list entry is matched, return TRUE. @@ -564,6 +578,13 @@ InputClassMatches(const XF86ConfInputClassPtr iclass, const InputInfoPtr idev, return FALSE; } + /* MatchLayout string */ + if (!list_is_empty(&iclass->match_layout)) { + if (!MatchAttrToken(xf86ConfigLayout.id, + &iclass->match_layout, match_string_implicit)) + return FALSE; + } + /* MatchIs* booleans */ if (iclass->is_keyboard.set && iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD)) diff --git a/xorg-server/hw/xfree86/man/xorg.conf.man b/xorg-server/hw/xfree86/man/xorg.conf.man index 4bec31695..f406f82bb 100644 --- a/xorg-server/hw/xfree86/man/xorg.conf.man +++ b/xorg-server/hw/xfree86/man/xorg.conf.man @@ -1140,6 +1140,16 @@ matches the pattern. A match is found if at least one of the tags given in .RI \*q matchtag \*q matches at least one of the tags assigned by the backend. +.TP 7 +.BI "MatchLayout \*q" matchlayout \*q +Check the case-sensitive string +.RI \*q matchlayout \*q +against the currently active +.B ServerLayout +section. The empty string "" matches an implicit layout which appears +if no named +.B ServerLayout +sections have been found. .PP The second type of entry is used to match device types. These entries take a boolean argument similar to diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c index ddf344a0f..3f801700e 100644 --- a/xorg-server/hw/xfree86/parser/InputClass.c +++ b/xorg-server/hw/xfree86/parser/InputClass.c @@ -1,403 +1,424 @@ -/* - * Copyright (c) 2009 Dan Nicholson - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, - * copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following - * conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES - * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - */ - -/* View/edit this file with tab stops set to 4 */ - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#include -#include "os.h" -#include "xf86Parser.h" -#include "xf86tokens.h" -#include "Configint.h" - -extern LexRec val; - -static -xf86ConfigSymTabRec InputClassTab[] = -{ - {ENDSECTION, "endsection"}, - {IDENTIFIER, "identifier"}, - {OPTION, "option"}, - {DRIVER, "driver"}, - {MATCH_PRODUCT, "matchproduct"}, - {MATCH_VENDOR, "matchvendor"}, - {MATCH_DEVICE_PATH, "matchdevicepath"}, - {MATCH_OS, "matchos"}, - {MATCH_PNPID, "matchpnpid"}, - {MATCH_USBID, "matchusbid"}, - {MATCH_DRIVER, "matchdriver"}, - {MATCH_TAG, "matchtag"}, - {MATCH_IS_KEYBOARD, "matchiskeyboard"}, - {MATCH_IS_POINTER, "matchispointer"}, - {MATCH_IS_JOYSTICK, "matchisjoystick"}, - {MATCH_IS_TABLET, "matchistablet"}, - {MATCH_IS_TOUCHPAD, "matchistouchpad"}, - {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"}, - {-1, ""}, -}; - -#define CLEANUP xf86freeInputClassList - -#define TOKEN_SEP "|" - -static void -add_group_entry(struct list *head, char **values) -{ - xf86MatchGroup *group; - - group = malloc(sizeof(*group)); - if (group) { - group->values = values; - list_add(&group->entry, head); - } -} - -XF86ConfInputClassPtr -xf86parseInputClassSection(void) -{ - int has_ident = FALSE; - int token; - - parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec) - - /* Initialize MatchGroup lists */ - list_init(&ptr->match_product); - list_init(&ptr->match_vendor); - list_init(&ptr->match_device); - list_init(&ptr->match_os); - list_init(&ptr->match_pnpid); - list_init(&ptr->match_usbid); - list_init(&ptr->match_driver); - list_init(&ptr->match_tag); - - while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { - switch (token) { - case COMMENT: - ptr->comment = xf86addComment(ptr->comment, val.str); - break; - case IDENTIFIER: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "Identifier"); - if (has_ident == TRUE) - Error(MULTIPLE_MSG, "Identifier"); - ptr->identifier = val.str; - has_ident = TRUE; - break; - case DRIVER: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "Driver"); - if (strcmp(val.str, "keyboard") == 0) { - ptr->driver = strdup("kbd"); - free(val.str); - } - else - ptr->driver = val.str; - break; - case OPTION: - ptr->option_lst = xf86parseOption(ptr->option_lst); - break; - case MATCH_PRODUCT: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchProduct"); - add_group_entry(&ptr->match_product, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_VENDOR: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchVendor"); - add_group_entry(&ptr->match_vendor, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_DEVICE_PATH: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchDevicePath"); - add_group_entry(&ptr->match_device, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_OS: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchOS"); - add_group_entry(&ptr->match_os, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_PNPID: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchPnPID"); - add_group_entry(&ptr->match_pnpid, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_USBID: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchUSBID"); - add_group_entry(&ptr->match_usbid, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_DRIVER: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchDriver"); - add_group_entry(&ptr->match_driver, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_TAG: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchTag"); - add_group_entry(&ptr->match_tag, - xstrtokenize(val.str, TOKEN_SEP)); - break; - case MATCH_IS_KEYBOARD: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchIsKeyboard"); - ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, - val.str); - if (!ptr->is_keyboard.set) - Error(BOOL_MSG, "MatchIsKeyboard"); - break; - case MATCH_IS_POINTER: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchIsPointer"); - ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, - val.str); - if (!ptr->is_pointer.set) - Error(BOOL_MSG, "MatchIsPointer"); - break; - case MATCH_IS_JOYSTICK: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchIsJoystick"); - ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, - val.str); - if (!ptr->is_joystick.set) - Error(BOOL_MSG, "MatchIsJoystick"); - break; - case MATCH_IS_TABLET: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchIsTablet"); - ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, - val.str); - if (!ptr->is_tablet.set) - Error(BOOL_MSG, "MatchIsTablet"); - break; - case MATCH_IS_TOUCHPAD: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchIsTouchpad"); - ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, - val.str); - if (!ptr->is_touchpad.set) - Error(BOOL_MSG, "MatchIsTouchpad"); - break; - case MATCH_IS_TOUCHSCREEN: - if (xf86getSubToken(&(ptr->comment)) != STRING) - Error(QUOTE_MSG, "MatchIsTouchscreen"); - ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, - val.str); - if (!ptr->is_touchscreen.set) - Error(BOOL_MSG, "MatchIsTouchscreen"); - break; - case EOF_TOKEN: - Error(UNEXPECTED_EOF_MSG, NULL); - break; - default: - Error(INVALID_KEYWORD_MSG, xf86tokenString ()); - break; - } - } - - if (!has_ident) - Error(NO_IDENT_MSG, NULL); - -#ifdef DEBUG - printf("InputClass section parsed\n"); -#endif - - return ptr; -} - -void -xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr) -{ - const xf86MatchGroup *group; - char * const *cur; - - while (ptr) { - fprintf(cf, "Section \"InputClass\"\n"); - if (ptr->comment) - fprintf(cf, "%s", ptr->comment); - if (ptr->identifier) - fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); - if (ptr->driver) - fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); - - list_for_each_entry(group, &ptr->match_product, entry) { - fprintf(cf, "\tMatchProduct \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_vendor, entry) { - fprintf(cf, "\tMatchVendor \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_device, entry) { - fprintf(cf, "\tMatchDevicePath \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_os, entry) { - fprintf(cf, "\tMatchOS \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_pnpid, entry) { - fprintf(cf, "\tMatchPnPID \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_usbid, entry) { - fprintf(cf, "\tMatchUSBID \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_driver, entry) { - fprintf(cf, "\tMatchDriver \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - list_for_each_entry(group, &ptr->match_tag, entry) { - fprintf(cf, "\tMatchTag \""); - for (cur = group->values; *cur; cur++) - fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, - *cur); - fprintf(cf, "\"\n"); - } - - if (ptr->is_keyboard.set) - fprintf(cf, "\tIsKeyboard \"%s\"\n", - ptr->is_keyboard.val ? "yes" : "no"); - if (ptr->is_pointer.set) - fprintf(cf, "\tIsPointer \"%s\"\n", - ptr->is_pointer.val ? "yes" : "no"); - if (ptr->is_joystick.set) - fprintf(cf, "\tIsJoystick \"%s\"\n", - ptr->is_joystick.val ? "yes" : "no"); - if (ptr->is_tablet.set) - fprintf(cf, "\tIsTablet \"%s\"\n", - ptr->is_tablet.val ? "yes" : "no"); - if (ptr->is_touchpad.set) - fprintf(cf, "\tIsTouchpad \"%s\"\n", - ptr->is_touchpad.val ? "yes" : "no"); - if (ptr->is_touchscreen.set) - fprintf(cf, "\tIsTouchscreen \"%s\"\n", - ptr->is_touchscreen.val ? "yes" : "no"); - xf86printOptionList(cf, ptr->option_lst, 1); - fprintf(cf, "EndSection\n\n"); - ptr = ptr->list.next; - } -} - -void -xf86freeInputClassList (XF86ConfInputClassPtr ptr) -{ - XF86ConfInputClassPtr prev; - - while (ptr) { - xf86MatchGroup *group, *next; - char **list; - - TestFree(ptr->identifier); - TestFree(ptr->driver); - - list_for_each_entry_safe(group, next, &ptr->match_product, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_device, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_os, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_driver, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - list_for_each_entry_safe(group, next, &ptr->match_tag, entry) { - list_del(&group->entry); - for (list = group->values; *list; list++) - free(*list); - free(group); - } - - TestFree(ptr->comment); - xf86optionListFree(ptr->option_lst); - - prev = ptr; - ptr = ptr->list.next; - free(prev); - } -} +/* + * Copyright (c) 2009 Dan Nicholson + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* View/edit this file with tab stops set to 4 */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include +#include "os.h" +#include "xf86Parser.h" +#include "xf86tokens.h" +#include "Configint.h" + +extern LexRec val; + +static +xf86ConfigSymTabRec InputClassTab[] = +{ + {ENDSECTION, "endsection"}, + {IDENTIFIER, "identifier"}, + {OPTION, "option"}, + {DRIVER, "driver"}, + {MATCH_PRODUCT, "matchproduct"}, + {MATCH_VENDOR, "matchvendor"}, + {MATCH_DEVICE_PATH, "matchdevicepath"}, + {MATCH_OS, "matchos"}, + {MATCH_PNPID, "matchpnpid"}, + {MATCH_USBID, "matchusbid"}, + {MATCH_DRIVER, "matchdriver"}, + {MATCH_TAG, "matchtag"}, + {MATCH_LAYOUT, "matchlayout"}, + {MATCH_IS_KEYBOARD, "matchiskeyboard"}, + {MATCH_IS_POINTER, "matchispointer"}, + {MATCH_IS_JOYSTICK, "matchisjoystick"}, + {MATCH_IS_TABLET, "matchistablet"}, + {MATCH_IS_TOUCHPAD, "matchistouchpad"}, + {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"}, + {-1, ""}, +}; + +#define CLEANUP xf86freeInputClassList + +#define TOKEN_SEP "|" + +static void +add_group_entry(struct list *head, char **values) +{ + xf86MatchGroup *group; + + group = malloc(sizeof(*group)); + if (group) { + group->values = values; + list_add(&group->entry, head); + } +} + +XF86ConfInputClassPtr +xf86parseInputClassSection(void) +{ + int has_ident = FALSE; + int token; + + parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec) + + /* Initialize MatchGroup lists */ + list_init(&ptr->match_product); + list_init(&ptr->match_vendor); + list_init(&ptr->match_device); + list_init(&ptr->match_os); + list_init(&ptr->match_pnpid); + list_init(&ptr->match_usbid); + list_init(&ptr->match_driver); + list_init(&ptr->match_tag); + list_init(&ptr->match_layout); + + while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { + switch (token) { + case COMMENT: + ptr->comment = xf86addComment(ptr->comment, val.str); + break; + case IDENTIFIER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error(MULTIPLE_MSG, "Identifier"); + ptr->identifier = val.str; + has_ident = TRUE; + break; + case DRIVER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "Driver"); + if (strcmp(val.str, "keyboard") == 0) { + ptr->driver = strdup("kbd"); + free(val.str); + } + else + ptr->driver = val.str; + break; + case OPTION: + ptr->option_lst = xf86parseOption(ptr->option_lst); + break; + case MATCH_PRODUCT: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchProduct"); + add_group_entry(&ptr->match_product, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_VENDOR: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchVendor"); + add_group_entry(&ptr->match_vendor, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_DEVICE_PATH: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchDevicePath"); + add_group_entry(&ptr->match_device, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_OS: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchOS"); + add_group_entry(&ptr->match_os, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_PNPID: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchPnPID"); + add_group_entry(&ptr->match_pnpid, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_USBID: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchUSBID"); + add_group_entry(&ptr->match_usbid, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_DRIVER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchDriver"); + add_group_entry(&ptr->match_driver, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_TAG: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchTag"); + add_group_entry(&ptr->match_tag, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_LAYOUT: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchLayout"); + add_group_entry(&ptr->match_layout, + xstrtokenize(val.str, TOKEN_SEP)); + break; + case MATCH_IS_KEYBOARD: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsKeyboard"); + ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, + val.str); + if (!ptr->is_keyboard.set) + Error(BOOL_MSG, "MatchIsKeyboard"); + break; + case MATCH_IS_POINTER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsPointer"); + ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, + val.str); + if (!ptr->is_pointer.set) + Error(BOOL_MSG, "MatchIsPointer"); + break; + case MATCH_IS_JOYSTICK: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsJoystick"); + ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, + val.str); + if (!ptr->is_joystick.set) + Error(BOOL_MSG, "MatchIsJoystick"); + break; + case MATCH_IS_TABLET: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsTablet"); + ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, + val.str); + if (!ptr->is_tablet.set) + Error(BOOL_MSG, "MatchIsTablet"); + break; + case MATCH_IS_TOUCHPAD: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsTouchpad"); + ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, + val.str); + if (!ptr->is_touchpad.set) + Error(BOOL_MSG, "MatchIsTouchpad"); + break; + case MATCH_IS_TOUCHSCREEN: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsTouchscreen"); + ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, + val.str); + if (!ptr->is_touchscreen.set) + Error(BOOL_MSG, "MatchIsTouchscreen"); + break; + case EOF_TOKEN: + Error(UNEXPECTED_EOF_MSG, NULL); + break; + default: + Error(INVALID_KEYWORD_MSG, xf86tokenString ()); + break; + } + } + + if (!has_ident) + Error(NO_IDENT_MSG, NULL); + +#ifdef DEBUG + printf("InputClass section parsed\n"); +#endif + + return ptr; +} + +void +xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr) +{ + const xf86MatchGroup *group; + char * const *cur; + + while (ptr) { + fprintf(cf, "Section \"InputClass\"\n"); + if (ptr->comment) + fprintf(cf, "%s", ptr->comment); + if (ptr->identifier) + fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); + if (ptr->driver) + fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); + + list_for_each_entry(group, &ptr->match_product, entry) { + fprintf(cf, "\tMatchProduct \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_vendor, entry) { + fprintf(cf, "\tMatchVendor \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_device, entry) { + fprintf(cf, "\tMatchDevicePath \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_os, entry) { + fprintf(cf, "\tMatchOS \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_pnpid, entry) { + fprintf(cf, "\tMatchPnPID \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_usbid, entry) { + fprintf(cf, "\tMatchUSBID \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_driver, entry) { + fprintf(cf, "\tMatchDriver \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_tag, entry) { + fprintf(cf, "\tMatchTag \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + list_for_each_entry(group, &ptr->match_layout, entry) { + fprintf(cf, "\tMatchLayout \""); + for (cur = group->values; *cur; cur++) + fprintf(cf, "%s%s", cur == group->values ? "" : TOKEN_SEP, + *cur); + fprintf(cf, "\"\n"); + } + + if (ptr->is_keyboard.set) + fprintf(cf, "\tIsKeyboard \"%s\"\n", + ptr->is_keyboard.val ? "yes" : "no"); + if (ptr->is_pointer.set) + fprintf(cf, "\tIsPointer \"%s\"\n", + ptr->is_pointer.val ? "yes" : "no"); + if (ptr->is_joystick.set) + fprintf(cf, "\tIsJoystick \"%s\"\n", + ptr->is_joystick.val ? "yes" : "no"); + if (ptr->is_tablet.set) + fprintf(cf, "\tIsTablet \"%s\"\n", + ptr->is_tablet.val ? "yes" : "no"); + if (ptr->is_touchpad.set) + fprintf(cf, "\tIsTouchpad \"%s\"\n", + ptr->is_touchpad.val ? "yes" : "no"); + if (ptr->is_touchscreen.set) + fprintf(cf, "\tIsTouchscreen \"%s\"\n", + ptr->is_touchscreen.val ? "yes" : "no"); + xf86printOptionList(cf, ptr->option_lst, 1); + fprintf(cf, "EndSection\n\n"); + ptr = ptr->list.next; + } +} + +void +xf86freeInputClassList (XF86ConfInputClassPtr ptr) +{ + XF86ConfInputClassPtr prev; + + while (ptr) { + xf86MatchGroup *group, *next; + char **list; + + TestFree(ptr->identifier); + TestFree(ptr->driver); + + list_for_each_entry_safe(group, next, &ptr->match_product, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_vendor, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_device, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_os, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_pnpid, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_usbid, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_driver, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_tag, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + list_for_each_entry_safe(group, next, &ptr->match_layout, entry) { + list_del(&group->entry); + for (list = group->values; *list; list++) + free(*list); + free(group); + } + + TestFree(ptr->comment); + xf86optionListFree(ptr->option_lst); + + prev = ptr; + ptr = ptr->list.next; + free(prev); + } +} diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h index bb7025dc4..a8785c5fa 100644 --- a/xorg-server/hw/xfree86/parser/xf86Parser.h +++ b/xorg-server/hw/xfree86/parser/xf86Parser.h @@ -1,518 +1,519 @@ -/* - * - * Copyright (c) 1997 Metro Link Incorporated - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -/* - * This file contains the external interfaces for the XFree86 configuration - * file parser. - */ -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _xf86Parser_h_ -#define _xf86Parser_h_ - -#include -#include "xf86Optrec.h" -#include "list.h" - -#define HAVE_PARSER_DECLS - -typedef struct -{ - char *file_logfile; - char *file_modulepath; - char *file_fontpath; - char *file_comment; - char *file_xkbdir; -} -XF86ConfFilesRec, *XF86ConfFilesPtr; - -/* Values for load_type */ -#define XF86_LOAD_MODULE 0 -#define XF86_LOAD_DRIVER 1 -#define XF86_DISABLE_MODULE 2 - -typedef struct -{ - GenericListRec list; - int load_type; - char *load_name; - XF86OptionPtr load_opt; - char *load_comment; - int ignore; -} -XF86LoadRec, *XF86LoadPtr; - -typedef struct -{ - XF86LoadPtr mod_load_lst; - XF86LoadPtr mod_disable_lst; - char *mod_comment; -} -XF86ConfModuleRec, *XF86ConfModulePtr; - -#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard" - -#define CONF_IMPLICIT_POINTER "Implicit Core Pointer" - -#define XF86CONF_PHSYNC 0x0001 -#define XF86CONF_NHSYNC 0x0002 -#define XF86CONF_PVSYNC 0x0004 -#define XF86CONF_NVSYNC 0x0008 -#define XF86CONF_INTERLACE 0x0010 -#define XF86CONF_DBLSCAN 0x0020 -#define XF86CONF_CSYNC 0x0040 -#define XF86CONF_PCSYNC 0x0080 -#define XF86CONF_NCSYNC 0x0100 -#define XF86CONF_HSKEW 0x0200 /* hskew provided */ -#define XF86CONF_BCAST 0x0400 -#define XF86CONF_VSCAN 0x1000 - -typedef struct -{ - GenericListRec list; - char *ml_identifier; - int ml_clock; - int ml_hdisplay; - int ml_hsyncstart; - int ml_hsyncend; - int ml_htotal; - int ml_vdisplay; - int ml_vsyncstart; - int ml_vsyncend; - int ml_vtotal; - int ml_vscan; - int ml_flags; - int ml_hskew; - char *ml_comment; -} -XF86ConfModeLineRec, *XF86ConfModeLinePtr; - -typedef struct -{ - GenericListRec list; - char *vp_identifier; - XF86OptionPtr vp_option_lst; - char *vp_comment; -} -XF86ConfVideoPortRec, *XF86ConfVideoPortPtr; - -typedef struct -{ - GenericListRec list; - char *va_identifier; - char *va_vendor; - char *va_board; - char *va_busid; - char *va_driver; - XF86OptionPtr va_option_lst; - XF86ConfVideoPortPtr va_port_lst; - char *va_fwdref; - char *va_comment; -} -XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr; - -#define CONF_MAX_HSYNC 8 -#define CONF_MAX_VREFRESH 8 - -typedef struct -{ - float hi, lo; -} -parser_range; - -typedef struct -{ - int red, green, blue; -} -parser_rgb; - -typedef struct -{ - GenericListRec list; - char *modes_identifier; - XF86ConfModeLinePtr mon_modeline_lst; - char *modes_comment; -} -XF86ConfModesRec, *XF86ConfModesPtr; - -typedef struct -{ - GenericListRec list; - char *ml_modes_str; - XF86ConfModesPtr ml_modes; -} -XF86ConfModesLinkRec, *XF86ConfModesLinkPtr; - -typedef struct -{ - GenericListRec list; - char *mon_identifier; - char *mon_vendor; - char *mon_modelname; - int mon_width; /* in mm */ - int mon_height; /* in mm */ - XF86ConfModeLinePtr mon_modeline_lst; - int mon_n_hsync; - parser_range mon_hsync[CONF_MAX_HSYNC]; - int mon_n_vrefresh; - parser_range mon_vrefresh[CONF_MAX_VREFRESH]; - float mon_gamma_red; - float mon_gamma_green; - float mon_gamma_blue; - XF86OptionPtr mon_option_lst; - XF86ConfModesLinkPtr mon_modes_sect_lst; - char *mon_comment; -} -XF86ConfMonitorRec, *XF86ConfMonitorPtr; - -#define CONF_MAXDACSPEEDS 4 -#define CONF_MAXCLOCKS 128 - -typedef struct -{ - GenericListRec list; - char *dev_identifier; - char *dev_vendor; - char *dev_board; - char *dev_chipset; - char *dev_busid; - char *dev_card; - char *dev_driver; - char *dev_ramdac; - int dev_dacSpeeds[CONF_MAXDACSPEEDS]; - int dev_videoram; - int dev_textclockfreq; - unsigned long dev_bios_base; - unsigned long dev_mem_base; - unsigned long dev_io_base; - char *dev_clockchip; - int dev_clocks; - int dev_clock[CONF_MAXCLOCKS]; - int dev_chipid; - int dev_chiprev; - int dev_irq; - int dev_screen; - XF86OptionPtr dev_option_lst; - char *dev_comment; -} -XF86ConfDeviceRec, *XF86ConfDevicePtr; - -typedef struct -{ - GenericListRec list; - char *mode_name; -} -XF86ModeRec, *XF86ModePtr; - -typedef struct -{ - GenericListRec list; - int disp_frameX0; - int disp_frameY0; - int disp_virtualX; - int disp_virtualY; - int disp_depth; - int disp_bpp; - char *disp_visual; - parser_rgb disp_weight; - parser_rgb disp_black; - parser_rgb disp_white; - XF86ModePtr disp_mode_lst; - XF86OptionPtr disp_option_lst; - char *disp_comment; -} -XF86ConfDisplayRec, *XF86ConfDisplayPtr; - -typedef struct -{ - XF86OptionPtr flg_option_lst; - char *flg_comment; -} -XF86ConfFlagsRec, *XF86ConfFlagsPtr; - -typedef struct -{ - GenericListRec list; - char *al_adaptor_str; - XF86ConfVideoAdaptorPtr al_adaptor; -} -XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr; - -typedef struct -{ - GenericListRec list; - char *scrn_identifier; - char *scrn_obso_driver; - int scrn_defaultdepth; - int scrn_defaultbpp; - int scrn_defaultfbbpp; - char *scrn_monitor_str; - XF86ConfMonitorPtr scrn_monitor; - char *scrn_device_str; - XF86ConfDevicePtr scrn_device; - XF86ConfAdaptorLinkPtr scrn_adaptor_lst; - XF86ConfDisplayPtr scrn_display_lst; - XF86OptionPtr scrn_option_lst; - char *scrn_comment; - int scrn_virtualX, scrn_virtualY; -} -XF86ConfScreenRec, *XF86ConfScreenPtr; - -typedef struct -{ - GenericListRec list; - char *inp_identifier; - char *inp_driver; - XF86OptionPtr inp_option_lst; - char *inp_comment; -} -XF86ConfInputRec, *XF86ConfInputPtr; - -typedef struct -{ - GenericListRec list; - XF86ConfInputPtr iref_inputdev; - char *iref_inputdev_str; - XF86OptionPtr iref_option_lst; -} -XF86ConfInputrefRec, *XF86ConfInputrefPtr; - -typedef struct -{ - Bool set; - Bool val; -} -xf86TriState; - -typedef struct -{ - struct list entry; - char **values; -} -xf86MatchGroup; - -typedef struct -{ - GenericListRec list; - char *identifier; - char *driver; - struct list match_product; - struct list match_vendor; - struct list match_device; - struct list match_os; - struct list match_pnpid; - struct list match_usbid; - struct list match_driver; - struct list match_tag; - xf86TriState is_keyboard; - xf86TriState is_pointer; - xf86TriState is_joystick; - xf86TriState is_tablet; - xf86TriState is_touchpad; - xf86TriState is_touchscreen; - XF86OptionPtr option_lst; - char *comment; -} -XF86ConfInputClassRec, *XF86ConfInputClassPtr; - -/* Values for adj_where */ -#define CONF_ADJ_OBSOLETE -1 -#define CONF_ADJ_ABSOLUTE 0 -#define CONF_ADJ_RIGHTOF 1 -#define CONF_ADJ_LEFTOF 2 -#define CONF_ADJ_ABOVE 3 -#define CONF_ADJ_BELOW 4 -#define CONF_ADJ_RELATIVE 5 - -typedef struct -{ - GenericListRec list; - int adj_scrnum; - XF86ConfScreenPtr adj_screen; - char *adj_screen_str; - XF86ConfScreenPtr adj_top; - char *adj_top_str; - XF86ConfScreenPtr adj_bottom; - char *adj_bottom_str; - XF86ConfScreenPtr adj_left; - char *adj_left_str; - XF86ConfScreenPtr adj_right; - char *adj_right_str; - int adj_where; - int adj_x; - int adj_y; - char *adj_refscreen; -} -XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr; - -typedef struct -{ - GenericListRec list; - char *inactive_device_str; - XF86ConfDevicePtr inactive_device; -} -XF86ConfInactiveRec, *XF86ConfInactivePtr; - -typedef struct -{ - GenericListRec list; - char *lay_identifier; - XF86ConfAdjacencyPtr lay_adjacency_lst; - XF86ConfInactivePtr lay_inactive_lst; - XF86ConfInputrefPtr lay_input_lst; - XF86OptionPtr lay_option_lst; - char *lay_comment; -} -XF86ConfLayoutRec, *XF86ConfLayoutPtr; - -typedef struct -{ - GenericListRec list; - char *vs_name; - char *vs_identifier; - XF86OptionPtr vs_option_lst; - char *vs_comment; -} -XF86ConfVendSubRec, *XF86ConfVendSubPtr; - -typedef struct -{ - GenericListRec list; - char *vnd_identifier; - XF86OptionPtr vnd_option_lst; - XF86ConfVendSubPtr vnd_sub_lst; - char *vnd_comment; -} -XF86ConfVendorRec, *XF86ConfVendorPtr; - -typedef struct -{ - char *dri_group_name; - int dri_group; - int dri_mode; - char *dri_comment; -} -XF86ConfDRIRec, *XF86ConfDRIPtr; - -typedef struct -{ - XF86OptionPtr ext_option_lst; - char *extensions_comment; -} -XF86ConfExtensionsRec, *XF86ConfExtensionsPtr; - -typedef struct -{ - XF86ConfFilesPtr conf_files; - XF86ConfModulePtr conf_modules; - XF86ConfFlagsPtr conf_flags; - XF86ConfVideoAdaptorPtr conf_videoadaptor_lst; - XF86ConfModesPtr conf_modes_lst; - XF86ConfMonitorPtr conf_monitor_lst; - XF86ConfDevicePtr conf_device_lst; - XF86ConfScreenPtr conf_screen_lst; - XF86ConfInputPtr conf_input_lst; - XF86ConfInputClassPtr conf_inputclass_lst; - XF86ConfLayoutPtr conf_layout_lst; - XF86ConfVendorPtr conf_vendor_lst; - XF86ConfDRIPtr conf_dri; - XF86ConfExtensionsPtr conf_extensions; - char *conf_comment; -} -XF86ConfigRec, *XF86ConfigPtr; - -typedef struct -{ - int token; /* id of the token */ - char *name; /* pointer to the LOWERCASED name */ -} -xf86ConfigSymTabRec, *xf86ConfigSymTabPtr; - -/* - * prototypes for public functions - */ -extern void xf86initConfigFiles(void); -extern const char *xf86openConfigFile(const char *path, const char *cmdline, - const char *projroot); -extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline, - const char *projroot); -extern void xf86setBuiltinConfig(const char *config[]); -extern XF86ConfigPtr xf86readConfigFile(void); -extern void xf86closeConfigFile(void); -extern void xf86freeConfig(XF86ConfigPtr p); -extern int xf86writeConfigFile(const char *, XF86ConfigPtr); -extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); -extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); -extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); -extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p); -extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); -extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); -extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); -extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); -extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, - XF86ConfVideoAdaptorPtr p); -extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout); - -extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); -extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); - -extern _X_EXPORT int xf86pathIsAbsolute(const char *path); -extern _X_EXPORT int xf86pathIsSafe(const char *path); -extern _X_EXPORT char *xf86addComment(char *cur, char *add); -extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str); - -#endif /* _xf86Parser_h_ */ +/* + * + * Copyright (c) 1997 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* + * Copyright (c) 1997-2003 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + + +/* + * This file contains the external interfaces for the XFree86 configuration + * file parser. + */ +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#ifndef _xf86Parser_h_ +#define _xf86Parser_h_ + +#include +#include "xf86Optrec.h" +#include "list.h" + +#define HAVE_PARSER_DECLS + +typedef struct +{ + char *file_logfile; + char *file_modulepath; + char *file_fontpath; + char *file_comment; + char *file_xkbdir; +} +XF86ConfFilesRec, *XF86ConfFilesPtr; + +/* Values for load_type */ +#define XF86_LOAD_MODULE 0 +#define XF86_LOAD_DRIVER 1 +#define XF86_DISABLE_MODULE 2 + +typedef struct +{ + GenericListRec list; + int load_type; + char *load_name; + XF86OptionPtr load_opt; + char *load_comment; + int ignore; +} +XF86LoadRec, *XF86LoadPtr; + +typedef struct +{ + XF86LoadPtr mod_load_lst; + XF86LoadPtr mod_disable_lst; + char *mod_comment; +} +XF86ConfModuleRec, *XF86ConfModulePtr; + +#define CONF_IMPLICIT_KEYBOARD "Implicit Core Keyboard" + +#define CONF_IMPLICIT_POINTER "Implicit Core Pointer" + +#define XF86CONF_PHSYNC 0x0001 +#define XF86CONF_NHSYNC 0x0002 +#define XF86CONF_PVSYNC 0x0004 +#define XF86CONF_NVSYNC 0x0008 +#define XF86CONF_INTERLACE 0x0010 +#define XF86CONF_DBLSCAN 0x0020 +#define XF86CONF_CSYNC 0x0040 +#define XF86CONF_PCSYNC 0x0080 +#define XF86CONF_NCSYNC 0x0100 +#define XF86CONF_HSKEW 0x0200 /* hskew provided */ +#define XF86CONF_BCAST 0x0400 +#define XF86CONF_VSCAN 0x1000 + +typedef struct +{ + GenericListRec list; + char *ml_identifier; + int ml_clock; + int ml_hdisplay; + int ml_hsyncstart; + int ml_hsyncend; + int ml_htotal; + int ml_vdisplay; + int ml_vsyncstart; + int ml_vsyncend; + int ml_vtotal; + int ml_vscan; + int ml_flags; + int ml_hskew; + char *ml_comment; +} +XF86ConfModeLineRec, *XF86ConfModeLinePtr; + +typedef struct +{ + GenericListRec list; + char *vp_identifier; + XF86OptionPtr vp_option_lst; + char *vp_comment; +} +XF86ConfVideoPortRec, *XF86ConfVideoPortPtr; + +typedef struct +{ + GenericListRec list; + char *va_identifier; + char *va_vendor; + char *va_board; + char *va_busid; + char *va_driver; + XF86OptionPtr va_option_lst; + XF86ConfVideoPortPtr va_port_lst; + char *va_fwdref; + char *va_comment; +} +XF86ConfVideoAdaptorRec, *XF86ConfVideoAdaptorPtr; + +#define CONF_MAX_HSYNC 8 +#define CONF_MAX_VREFRESH 8 + +typedef struct +{ + float hi, lo; +} +parser_range; + +typedef struct +{ + int red, green, blue; +} +parser_rgb; + +typedef struct +{ + GenericListRec list; + char *modes_identifier; + XF86ConfModeLinePtr mon_modeline_lst; + char *modes_comment; +} +XF86ConfModesRec, *XF86ConfModesPtr; + +typedef struct +{ + GenericListRec list; + char *ml_modes_str; + XF86ConfModesPtr ml_modes; +} +XF86ConfModesLinkRec, *XF86ConfModesLinkPtr; + +typedef struct +{ + GenericListRec list; + char *mon_identifier; + char *mon_vendor; + char *mon_modelname; + int mon_width; /* in mm */ + int mon_height; /* in mm */ + XF86ConfModeLinePtr mon_modeline_lst; + int mon_n_hsync; + parser_range mon_hsync[CONF_MAX_HSYNC]; + int mon_n_vrefresh; + parser_range mon_vrefresh[CONF_MAX_VREFRESH]; + float mon_gamma_red; + float mon_gamma_green; + float mon_gamma_blue; + XF86OptionPtr mon_option_lst; + XF86ConfModesLinkPtr mon_modes_sect_lst; + char *mon_comment; +} +XF86ConfMonitorRec, *XF86ConfMonitorPtr; + +#define CONF_MAXDACSPEEDS 4 +#define CONF_MAXCLOCKS 128 + +typedef struct +{ + GenericListRec list; + char *dev_identifier; + char *dev_vendor; + char *dev_board; + char *dev_chipset; + char *dev_busid; + char *dev_card; + char *dev_driver; + char *dev_ramdac; + int dev_dacSpeeds[CONF_MAXDACSPEEDS]; + int dev_videoram; + int dev_textclockfreq; + unsigned long dev_bios_base; + unsigned long dev_mem_base; + unsigned long dev_io_base; + char *dev_clockchip; + int dev_clocks; + int dev_clock[CONF_MAXCLOCKS]; + int dev_chipid; + int dev_chiprev; + int dev_irq; + int dev_screen; + XF86OptionPtr dev_option_lst; + char *dev_comment; +} +XF86ConfDeviceRec, *XF86ConfDevicePtr; + +typedef struct +{ + GenericListRec list; + char *mode_name; +} +XF86ModeRec, *XF86ModePtr; + +typedef struct +{ + GenericListRec list; + int disp_frameX0; + int disp_frameY0; + int disp_virtualX; + int disp_virtualY; + int disp_depth; + int disp_bpp; + char *disp_visual; + parser_rgb disp_weight; + parser_rgb disp_black; + parser_rgb disp_white; + XF86ModePtr disp_mode_lst; + XF86OptionPtr disp_option_lst; + char *disp_comment; +} +XF86ConfDisplayRec, *XF86ConfDisplayPtr; + +typedef struct +{ + XF86OptionPtr flg_option_lst; + char *flg_comment; +} +XF86ConfFlagsRec, *XF86ConfFlagsPtr; + +typedef struct +{ + GenericListRec list; + char *al_adaptor_str; + XF86ConfVideoAdaptorPtr al_adaptor; +} +XF86ConfAdaptorLinkRec, *XF86ConfAdaptorLinkPtr; + +typedef struct +{ + GenericListRec list; + char *scrn_identifier; + char *scrn_obso_driver; + int scrn_defaultdepth; + int scrn_defaultbpp; + int scrn_defaultfbbpp; + char *scrn_monitor_str; + XF86ConfMonitorPtr scrn_monitor; + char *scrn_device_str; + XF86ConfDevicePtr scrn_device; + XF86ConfAdaptorLinkPtr scrn_adaptor_lst; + XF86ConfDisplayPtr scrn_display_lst; + XF86OptionPtr scrn_option_lst; + char *scrn_comment; + int scrn_virtualX, scrn_virtualY; +} +XF86ConfScreenRec, *XF86ConfScreenPtr; + +typedef struct +{ + GenericListRec list; + char *inp_identifier; + char *inp_driver; + XF86OptionPtr inp_option_lst; + char *inp_comment; +} +XF86ConfInputRec, *XF86ConfInputPtr; + +typedef struct +{ + GenericListRec list; + XF86ConfInputPtr iref_inputdev; + char *iref_inputdev_str; + XF86OptionPtr iref_option_lst; +} +XF86ConfInputrefRec, *XF86ConfInputrefPtr; + +typedef struct +{ + Bool set; + Bool val; +} +xf86TriState; + +typedef struct +{ + struct list entry; + char **values; +} +xf86MatchGroup; + +typedef struct +{ + GenericListRec list; + char *identifier; + char *driver; + struct list match_product; + struct list match_vendor; + struct list match_device; + struct list match_os; + struct list match_pnpid; + struct list match_usbid; + struct list match_driver; + struct list match_tag; + struct list match_layout; + xf86TriState is_keyboard; + xf86TriState is_pointer; + xf86TriState is_joystick; + xf86TriState is_tablet; + xf86TriState is_touchpad; + xf86TriState is_touchscreen; + XF86OptionPtr option_lst; + char *comment; +} +XF86ConfInputClassRec, *XF86ConfInputClassPtr; + +/* Values for adj_where */ +#define CONF_ADJ_OBSOLETE -1 +#define CONF_ADJ_ABSOLUTE 0 +#define CONF_ADJ_RIGHTOF 1 +#define CONF_ADJ_LEFTOF 2 +#define CONF_ADJ_ABOVE 3 +#define CONF_ADJ_BELOW 4 +#define CONF_ADJ_RELATIVE 5 + +typedef struct +{ + GenericListRec list; + int adj_scrnum; + XF86ConfScreenPtr adj_screen; + char *adj_screen_str; + XF86ConfScreenPtr adj_top; + char *adj_top_str; + XF86ConfScreenPtr adj_bottom; + char *adj_bottom_str; + XF86ConfScreenPtr adj_left; + char *adj_left_str; + XF86ConfScreenPtr adj_right; + char *adj_right_str; + int adj_where; + int adj_x; + int adj_y; + char *adj_refscreen; +} +XF86ConfAdjacencyRec, *XF86ConfAdjacencyPtr; + +typedef struct +{ + GenericListRec list; + char *inactive_device_str; + XF86ConfDevicePtr inactive_device; +} +XF86ConfInactiveRec, *XF86ConfInactivePtr; + +typedef struct +{ + GenericListRec list; + char *lay_identifier; + XF86ConfAdjacencyPtr lay_adjacency_lst; + XF86ConfInactivePtr lay_inactive_lst; + XF86ConfInputrefPtr lay_input_lst; + XF86OptionPtr lay_option_lst; + char *lay_comment; +} +XF86ConfLayoutRec, *XF86ConfLayoutPtr; + +typedef struct +{ + GenericListRec list; + char *vs_name; + char *vs_identifier; + XF86OptionPtr vs_option_lst; + char *vs_comment; +} +XF86ConfVendSubRec, *XF86ConfVendSubPtr; + +typedef struct +{ + GenericListRec list; + char *vnd_identifier; + XF86OptionPtr vnd_option_lst; + XF86ConfVendSubPtr vnd_sub_lst; + char *vnd_comment; +} +XF86ConfVendorRec, *XF86ConfVendorPtr; + +typedef struct +{ + char *dri_group_name; + int dri_group; + int dri_mode; + char *dri_comment; +} +XF86ConfDRIRec, *XF86ConfDRIPtr; + +typedef struct +{ + XF86OptionPtr ext_option_lst; + char *extensions_comment; +} +XF86ConfExtensionsRec, *XF86ConfExtensionsPtr; + +typedef struct +{ + XF86ConfFilesPtr conf_files; + XF86ConfModulePtr conf_modules; + XF86ConfFlagsPtr conf_flags; + XF86ConfVideoAdaptorPtr conf_videoadaptor_lst; + XF86ConfModesPtr conf_modes_lst; + XF86ConfMonitorPtr conf_monitor_lst; + XF86ConfDevicePtr conf_device_lst; + XF86ConfScreenPtr conf_screen_lst; + XF86ConfInputPtr conf_input_lst; + XF86ConfInputClassPtr conf_inputclass_lst; + XF86ConfLayoutPtr conf_layout_lst; + XF86ConfVendorPtr conf_vendor_lst; + XF86ConfDRIPtr conf_dri; + XF86ConfExtensionsPtr conf_extensions; + char *conf_comment; +} +XF86ConfigRec, *XF86ConfigPtr; + +typedef struct +{ + int token; /* id of the token */ + char *name; /* pointer to the LOWERCASED name */ +} +xf86ConfigSymTabRec, *xf86ConfigSymTabPtr; + +/* + * prototypes for public functions + */ +extern void xf86initConfigFiles(void); +extern const char *xf86openConfigFile(const char *path, const char *cmdline, + const char *projroot); +extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline, + const char *projroot); +extern void xf86setBuiltinConfig(const char *config[]); +extern XF86ConfigPtr xf86readConfigFile(void); +extern void xf86closeConfigFile(void); +extern void xf86freeConfig(XF86ConfigPtr p); +extern int xf86writeConfigFile(const char *, XF86ConfigPtr); +extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); +extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); +extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); +extern _X_EXPORT XF86ConfModesPtr xf86findModes(const char *ident, XF86ConfModesPtr p); +extern _X_EXPORT XF86ConfModeLinePtr xf86findModeLine(const char *ident, XF86ConfModeLinePtr p); +extern _X_EXPORT XF86ConfScreenPtr xf86findScreen(const char *ident, XF86ConfScreenPtr p); +extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInputPtr p); +extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); +extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, + XF86ConfVideoAdaptorPtr p); +extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout); + +extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); +extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); + +extern _X_EXPORT int xf86pathIsAbsolute(const char *path); +extern _X_EXPORT int xf86pathIsSafe(const char *path); +extern _X_EXPORT char *xf86addComment(char *cur, char *add); +extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str); + +#endif /* _xf86Parser_h_ */ diff --git a/xorg-server/hw/xfree86/parser/xf86tokens.h b/xorg-server/hw/xfree86/parser/xf86tokens.h index d91755d7e..abcafcf8e 100644 --- a/xorg-server/hw/xfree86/parser/xf86tokens.h +++ b/xorg-server/hw/xfree86/parser/xf86tokens.h @@ -1,293 +1,294 @@ -/* - * - * Copyright (c) 1997 Metro Link Incorporated - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of the Metro Link shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Metro Link. - * - */ -/* - * Copyright (c) 1997-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - - -#ifdef HAVE_XORG_CONFIG_H -#include -#endif - -#ifndef _xf86_tokens_h -#define _xf86_tokens_h - -/* Undefine symbols that some OSs might define */ -#undef IOBASE - -/* - * Each token should have a unique value regardless of the section - * it is used in. - */ - -typedef enum { - /* errno-style tokens */ - OBSOLETE_TOKEN = -5, - EOF_TOKEN = -4, - LOCK_TOKEN = -3, - ERROR_TOKEN = -2, - - /* value type tokens */ - NUMBER = 1, - STRING, - - /* Tokens that can appear in many sections */ - SECTION, - SUBSECTION, - ENDSECTION, - ENDSUBSECTION, - IDENTIFIER, - VENDOR, - DASH, - COMMA, - OPTION, - COMMENT, - - /* Frequency units */ - HRZ, - KHZ, - MHZ, - - /* File tokens */ - FONTPATH, - MODULEPATH, - LOGFILEPATH, - XKBDIR, - - /* Server Flag tokens. These are deprecated in favour of generic Options */ - NOTRAPSIGNALS, - DONTZAP, - DONTZOOM, - DISABLEVIDMODE, - ALLOWNONLOCAL, - DISABLEMODINDEV, - MODINDEVALLOWNONLOCAL, - ALLOWMOUSEOPENFAIL, - BLANKTIME, - STANDBYTIME, - SUSPENDTIME, - OFFTIME, - DEFAULTLAYOUT, - - /* Monitor tokens */ - MODEL, - MODELINE, - DISPLAYSIZE, - HORIZSYNC, - VERTREFRESH, - MODE, - GAMMA, - USEMODES, - - /* Modes tokens */ - /* no new ones */ - - /* Mode tokens */ - DOTCLOCK, - HTIMINGS, - VTIMINGS, - FLAGS, - HSKEW, - BCAST, - VSCAN, - ENDMODE, - - /* Screen tokens */ - OBSDRIVER, - MDEVICE, - MONITOR, - SCREENNO, - DEFAULTDEPTH, - DEFAULTBPP, - DEFAULTFBBPP, - - /* VideoAdaptor tokens */ - VIDEOADAPTOR, - - /* Mode timing tokens */ - TT_INTERLACE, - TT_PHSYNC, - TT_NHSYNC, - TT_PVSYNC, - TT_NVSYNC, - TT_CSYNC, - TT_PCSYNC, - TT_NCSYNC, - TT_DBLSCAN, - TT_HSKEW, - TT_BCAST, - TT_VSCAN, - - /* Module tokens */ - LOAD, - LOAD_DRIVER, - DISABLE, - - /* Device tokens */ - DRIVER, - CHIPSET, - CLOCKS, - VIDEORAM, - BOARD, - IOBASE, - RAMDAC, - DACSPEED, - BIOSBASE, - MEMBASE, - CLOCKCHIP, - CHIPID, - CHIPREV, - CARD, - BUSID, - TEXTCLOCKFRQ, - IRQ, - - /* Keyboard tokens */ - AUTOREPEAT, - XLEDS, - KPROTOCOL, - XKBKEYMAP, - XKBCOMPAT, - XKBTYPES, - XKBKEYCODES, - XKBGEOMETRY, - XKBSYMBOLS, - XKBDISABLE, - PANIX106, - XKBRULES, - XKBMODEL, - XKBLAYOUT, - XKBVARIANT, - XKBOPTIONS, - /* The next two have become ServerFlags options */ - VTSYSREQ, - /* Obsolete keyboard tokens */ - SERVERNUM, - LEFTALT, - RIGHTALT, - SCROLLLOCK_TOK, - RIGHTCTL, - /* arguments for the above obsolete tokens */ - CONF_KM_META, - CONF_KM_COMPOSE, - CONF_KM_MODESHIFT, - CONF_KM_MODELOCK, - CONF_KM_SCROLLLOCK, - CONF_KM_CONTROL, - - /* Pointer tokens */ - EMULATE3, - BAUDRATE, - SAMPLERATE, - PRESOLUTION, - CLEARDTR, - CLEARRTS, - CHORDMIDDLE, - PROTOCOL, - PDEVICE, - EM3TIMEOUT, - DEVICE_NAME, - ALWAYSCORE, - PBUTTONS, - ZAXISMAPPING, - - /* Pointer Z axis mapping tokens */ - XAXIS, - YAXIS, - - /* Display tokens */ - MODES, - VIEWPORT, - VIRTUAL, - VISUAL, - BLACK_TOK, - WHITE_TOK, - DEPTH, - BPP, - WEIGHT, - - /* Layout Tokens */ - SCREEN, - INACTIVE, - INPUTDEVICE, - - /* Adjaceny Tokens */ - RIGHTOF, - LEFTOF, - ABOVE, - BELOW, - RELATIVE, - ABSOLUTE, - - /* Vendor Tokens */ - VENDORNAME, - - /* DRI Tokens */ - GROUP, - - /* InputClass Tokens */ - MATCH_PRODUCT, - MATCH_VENDOR, - MATCH_DEVICE_PATH, - MATCH_OS, - MATCH_PNPID, - MATCH_USBID, - MATCH_DRIVER, - MATCH_TAG, - MATCH_IS_KEYBOARD, - MATCH_IS_POINTER, - MATCH_IS_JOYSTICK, - MATCH_IS_TABLET, - MATCH_IS_TOUCHPAD, - MATCH_IS_TOUCHSCREEN -} ParserTokens; - -#endif /* _xf86_tokens_h */ +/* + * + * Copyright (c) 1997 Metro Link Incorporated + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF + * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + * + * Except as contained in this notice, the name of the Metro Link shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from Metro Link. + * + */ +/* + * Copyright (c) 1997-2003 by The XFree86 Project, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of the copyright holder(s) + * and author(s) shall not be used in advertising or otherwise to promote + * the sale, use or other dealings in this Software without prior written + * authorization from the copyright holder(s) and author(s). + */ + + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#ifndef _xf86_tokens_h +#define _xf86_tokens_h + +/* Undefine symbols that some OSs might define */ +#undef IOBASE + +/* + * Each token should have a unique value regardless of the section + * it is used in. + */ + +typedef enum { + /* errno-style tokens */ + OBSOLETE_TOKEN = -5, + EOF_TOKEN = -4, + LOCK_TOKEN = -3, + ERROR_TOKEN = -2, + + /* value type tokens */ + NUMBER = 1, + STRING, + + /* Tokens that can appear in many sections */ + SECTION, + SUBSECTION, + ENDSECTION, + ENDSUBSECTION, + IDENTIFIER, + VENDOR, + DASH, + COMMA, + OPTION, + COMMENT, + + /* Frequency units */ + HRZ, + KHZ, + MHZ, + + /* File tokens */ + FONTPATH, + MODULEPATH, + LOGFILEPATH, + XKBDIR, + + /* Server Flag tokens. These are deprecated in favour of generic Options */ + NOTRAPSIGNALS, + DONTZAP, + DONTZOOM, + DISABLEVIDMODE, + ALLOWNONLOCAL, + DISABLEMODINDEV, + MODINDEVALLOWNONLOCAL, + ALLOWMOUSEOPENFAIL, + BLANKTIME, + STANDBYTIME, + SUSPENDTIME, + OFFTIME, + DEFAULTLAYOUT, + + /* Monitor tokens */ + MODEL, + MODELINE, + DISPLAYSIZE, + HORIZSYNC, + VERTREFRESH, + MODE, + GAMMA, + USEMODES, + + /* Modes tokens */ + /* no new ones */ + + /* Mode tokens */ + DOTCLOCK, + HTIMINGS, + VTIMINGS, + FLAGS, + HSKEW, + BCAST, + VSCAN, + ENDMODE, + + /* Screen tokens */ + OBSDRIVER, + MDEVICE, + MONITOR, + SCREENNO, + DEFAULTDEPTH, + DEFAULTBPP, + DEFAULTFBBPP, + + /* VideoAdaptor tokens */ + VIDEOADAPTOR, + + /* Mode timing tokens */ + TT_INTERLACE, + TT_PHSYNC, + TT_NHSYNC, + TT_PVSYNC, + TT_NVSYNC, + TT_CSYNC, + TT_PCSYNC, + TT_NCSYNC, + TT_DBLSCAN, + TT_HSKEW, + TT_BCAST, + TT_VSCAN, + + /* Module tokens */ + LOAD, + LOAD_DRIVER, + DISABLE, + + /* Device tokens */ + DRIVER, + CHIPSET, + CLOCKS, + VIDEORAM, + BOARD, + IOBASE, + RAMDAC, + DACSPEED, + BIOSBASE, + MEMBASE, + CLOCKCHIP, + CHIPID, + CHIPREV, + CARD, + BUSID, + TEXTCLOCKFRQ, + IRQ, + + /* Keyboard tokens */ + AUTOREPEAT, + XLEDS, + KPROTOCOL, + XKBKEYMAP, + XKBCOMPAT, + XKBTYPES, + XKBKEYCODES, + XKBGEOMETRY, + XKBSYMBOLS, + XKBDISABLE, + PANIX106, + XKBRULES, + XKBMODEL, + XKBLAYOUT, + XKBVARIANT, + XKBOPTIONS, + /* The next two have become ServerFlags options */ + VTSYSREQ, + /* Obsolete keyboard tokens */ + SERVERNUM, + LEFTALT, + RIGHTALT, + SCROLLLOCK_TOK, + RIGHTCTL, + /* arguments for the above obsolete tokens */ + CONF_KM_META, + CONF_KM_COMPOSE, + CONF_KM_MODESHIFT, + CONF_KM_MODELOCK, + CONF_KM_SCROLLLOCK, + CONF_KM_CONTROL, + + /* Pointer tokens */ + EMULATE3, + BAUDRATE, + SAMPLERATE, + PRESOLUTION, + CLEARDTR, + CLEARRTS, + CHORDMIDDLE, + PROTOCOL, + PDEVICE, + EM3TIMEOUT, + DEVICE_NAME, + ALWAYSCORE, + PBUTTONS, + ZAXISMAPPING, + + /* Pointer Z axis mapping tokens */ + XAXIS, + YAXIS, + + /* Display tokens */ + MODES, + VIEWPORT, + VIRTUAL, + VISUAL, + BLACK_TOK, + WHITE_TOK, + DEPTH, + BPP, + WEIGHT, + + /* Layout Tokens */ + SCREEN, + INACTIVE, + INPUTDEVICE, + + /* Adjaceny Tokens */ + RIGHTOF, + LEFTOF, + ABOVE, + BELOW, + RELATIVE, + ABSOLUTE, + + /* Vendor Tokens */ + VENDORNAME, + + /* DRI Tokens */ + GROUP, + + /* InputClass Tokens */ + MATCH_PRODUCT, + MATCH_VENDOR, + MATCH_DEVICE_PATH, + MATCH_OS, + MATCH_PNPID, + MATCH_USBID, + MATCH_DRIVER, + MATCH_TAG, + MATCH_LAYOUT, + MATCH_IS_KEYBOARD, + MATCH_IS_POINTER, + MATCH_IS_JOYSTICK, + MATCH_IS_TABLET, + MATCH_IS_TOUCHPAD, + MATCH_IS_TOUCHSCREEN +} ParserTokens; + +#endif /* _xf86_tokens_h */ diff --git a/xorg-server/hw/xwin/winkeybd.c b/xorg-server/hw/xwin/winkeybd.c index 2fa6b3f6e..a3112fffe 100644 --- a/xorg-server/hw/xwin/winkeybd.c +++ b/xorg-server/hw/xwin/winkeybd.c @@ -472,8 +472,6 @@ winKeybdReleaseKeys (void) void winSendKeyEvent (DWORD dwKey, Bool fDown) { - InternalEvent* events; - /* * When alt-tabing between screens we can get phantom key up messages * Here we only pass them through it we think we should! @@ -485,8 +483,8 @@ winSendKeyEvent (DWORD dwKey, Bool fDown) QueueKeyboardEvents(g_pwinKeyboard, fDown ? KeyPress : KeyRelease, dwKey + MIN_KEYCODE, NULL); - winDebug("winSendKeyEvent: dwKey: %d, fDown: %d, nEvents %d\n", - dwKey, fDown, nevents); + winDebug("winSendKeyEvent: dwKey: %d, fDown: %d\n", + dwKey, fDown); } BOOL winCheckKeyPressed(WPARAM wParam, LPARAM lParam) diff --git a/xorg-server/hw/xwin/winmouse.c b/xorg-server/hw/xwin/winmouse.c index b1b0657cf..752334a31 100644 --- a/xorg-server/hw/xwin/winmouse.c +++ b/xorg-server/hw/xwin/winmouse.c @@ -244,8 +244,8 @@ winMouseButtonsSendEvent (int iEventType, int iButton) POINTER_RELATIVE, &mask); #if CYGDEBUG - ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d, nEvents %d\n", - iEventType, iButton, nevents); + ErrorF("winMouseButtonsSendEvent: iEventType: %d, iButton: %d\n", + iEventType, iButton); #endif } diff --git a/xorg-server/include/input.h b/xorg-server/include/input.h index 4de4ff52c..56847ed8d 100644 --- a/xorg-server/include/input.h +++ b/xorg-server/include/input.h @@ -305,12 +305,6 @@ extern _X_EXPORT Bool InitPointerAccelerationScheme( DeviceIntPtr /*dev*/, int /*scheme*/); -/** - * This is not implemented and just returns FALSE. - */ -extern _X_EXPORT _X_DEPRECATED Bool InitAbsoluteClassDeviceStruct( - DeviceIntPtr /*device*/); - extern _X_EXPORT Bool InitFocusClassDeviceStruct( DeviceIntPtr /*device*/); diff --git a/xorg-server/include/inputstr.h b/xorg-server/include/inputstr.h index bc0accc87..00f72c260 100644 --- a/xorg-server/include/inputstr.h +++ b/xorg-server/include/inputstr.h @@ -371,7 +371,6 @@ typedef struct _ClassesRec { ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; - void* _pad0; /* keep ABI during AbsoluteClass removal */ KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; @@ -496,7 +495,6 @@ typedef struct _DeviceIntRec { ButtonClassPtr button; FocusClassPtr focus; ProximityClassPtr proximity; - void* _pad0; /* keep ABI, was pointer to abs class */ KbdFeedbackPtr kbdfeed; PtrFeedbackPtr ptrfeed; IntegerFeedbackPtr intfeed; diff --git a/xorg-server/include/xserver-properties.h b/xorg-server/include/xserver-properties.h index d3dc976fd..2b1feabb6 100644 --- a/xorg-server/include/xserver-properties.h +++ b/xorg-server/include/xserver-properties.h @@ -1,191 +1,199 @@ -/* - * Copyright 2008 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software") - * to deal in the software without restriction, including without limitation - * on the rights to use, copy, modify, merge, publish, distribute, sub - * license, and/or sell copies of the Software, and to permit persons to whom - * them Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER - * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - - -/* Properties managed by the server. */ - -#ifndef _XSERVER_PROPERTIES_H_ -#define _XSERVER_PROPERTIES_H_ - -/* Type for a 4 byte float. Storage format IEEE 754 in client's default - * byte-ordering. */ -#define XATOM_FLOAT "FLOAT" - -/* BOOL. 0 - device disabled, 1 - device enabled */ -#define XI_PROP_ENABLED "Device Enabled" -/* BOOL. If present, device is a virtual XTEST device */ -#define XI_PROP_XTEST_DEVICE "XTEST Device" - -/* Coordinate transformation matrix for absolute input devices - * FLOAT, 9 values in row-major order, coordinates in 0..1 range: - * [c0 c1 c2] [x] - * [c3 c4 c5] * [y] - * [c6 c7 c8] [1] */ -#define XI_PROP_TRANSFORM "Coordinate Transformation Matrix" - -/* Pointer acceleration properties */ -/* INTEGER of any format */ -#define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile" -/* FLOAT, format 32 */ -#define ACCEL_PROP_CONSTANT_DECELERATION "Device Accel Constant Deceleration" -/* FLOAT, format 32 */ -#define ACCEL_PROP_ADAPTIVE_DECELERATION "Device Accel Adaptive Deceleration" -/* FLOAT, format 32 */ -#define ACCEL_PROP_VELOCITY_SCALING "Device Accel Velocity Scaling" - - -/* Axis labels */ -#define AXIS_LABEL_PROP "Axis Labels" - -#define AXIS_LABEL_PROP_REL_X "Rel X" -#define AXIS_LABEL_PROP_REL_Y "Rel Y" -#define AXIS_LABEL_PROP_REL_Z "Rel Z" -#define AXIS_LABEL_PROP_REL_RX "Rel Rotary X" -#define AXIS_LABEL_PROP_REL_RY "Rel Rotary Y" -#define AXIS_LABEL_PROP_REL_RZ "Rel Rotary Z" -#define AXIS_LABEL_PROP_REL_HWHEEL "Rel Horiz Wheel" -#define AXIS_LABEL_PROP_REL_DIAL "Rel Dial" -#define AXIS_LABEL_PROP_REL_WHEEL "Rel Vert Wheel" -#define AXIS_LABEL_PROP_REL_MISC "Rel Misc" - -/* - * Absolute axes - */ - -#define AXIS_LABEL_PROP_ABS_X "Abs X" -#define AXIS_LABEL_PROP_ABS_Y "Abs Y" -#define AXIS_LABEL_PROP_ABS_Z "Abs Z" -#define AXIS_LABEL_PROP_ABS_RX "Abs Rotary X" -#define AXIS_LABEL_PROP_ABS_RY "Abs Rotary Y" -#define AXIS_LABEL_PROP_ABS_RZ "Abs Rotary Z" -#define AXIS_LABEL_PROP_ABS_THROTTLE "Abs Throttle" -#define AXIS_LABEL_PROP_ABS_RUDDER "Abs Rudder" -#define AXIS_LABEL_PROP_ABS_WHEEL "Abs Wheel" -#define AXIS_LABEL_PROP_ABS_GAS "Abs Gas" -#define AXIS_LABEL_PROP_ABS_BRAKE "Abs Brake" -#define AXIS_LABEL_PROP_ABS_HAT0X "Abs Hat 0 X" -#define AXIS_LABEL_PROP_ABS_HAT0Y "Abs Hat 0 Y" -#define AXIS_LABEL_PROP_ABS_HAT1X "Abs Hat 1 X" -#define AXIS_LABEL_PROP_ABS_HAT1Y "Abs Hat 1 Y" -#define AXIS_LABEL_PROP_ABS_HAT2X "Abs Hat 2 X" -#define AXIS_LABEL_PROP_ABS_HAT2Y "Abs Hat 2 Y" -#define AXIS_LABEL_PROP_ABS_HAT3X "Abs Hat 3 X" -#define AXIS_LABEL_PROP_ABS_HAT3Y "Abs Hat 3 Y" -#define AXIS_LABEL_PROP_ABS_PRESSURE "Abs Pressure" -#define AXIS_LABEL_PROP_ABS_DISTANCE "Abs Distance" -#define AXIS_LABEL_PROP_ABS_TILT_X "Abs Tilt X" -#define AXIS_LABEL_PROP_ABS_TILT_Y "Abs Tilt Y" -#define AXIS_LABEL_PROP_ABS_TOOL_WIDTH "Abs Tool Width" -#define AXIS_LABEL_PROP_ABS_VOLUME "Abs Volume" -#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major" -#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor" -#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR "Abs MT Width Major" -#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR "Abs MT Width Minor" -#define AXIS_LABEL_PROP_ABS_MT_ORIENTATION "Abs MT Orientation" -#define AXIS_LABEL_PROP_ABS_MT_POSITION_X "Abs MT Position X" -#define AXIS_LABEL_PROP_ABS_MT_POSITION_Y "Abs MT Position Y" -#define AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE "Abs MT Tool Type" -#define AXIS_LABEL_PROP_ABS_MT_BLOB_ID "Abs MT Blob ID" -#define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID" -#define AXIS_LABEL_PROP_ABS_MT_PRESSURE "Abs MT Pressure" -#define AXIS_LABEL_PROP_ABS_MISC "Abs Misc" - -/* Button names */ -#define BTN_LABEL_PROP "Button Labels" - -/* Default label */ -#define BTN_LABEL_PROP_BTN_UNKNOWN "Button Unknown" -/* Wheel buttons */ -#define BTN_LABEL_PROP_BTN_WHEEL_UP "Button Wheel Up" -#define BTN_LABEL_PROP_BTN_WHEEL_DOWN "Button Wheel Down" -#define BTN_LABEL_PROP_BTN_HWHEEL_LEFT "Button Horiz Wheel Left" -#define BTN_LABEL_PROP_BTN_HWHEEL_RIGHT "Button Horiz Wheel Right" - -/* The following are from linux/input.h */ -#define BTN_LABEL_PROP_BTN_0 "Button 0" -#define BTN_LABEL_PROP_BTN_1 "Button 1" -#define BTN_LABEL_PROP_BTN_2 "Button 2" -#define BTN_LABEL_PROP_BTN_3 "Button 3" -#define BTN_LABEL_PROP_BTN_4 "Button 4" -#define BTN_LABEL_PROP_BTN_5 "Button 5" -#define BTN_LABEL_PROP_BTN_6 "Button 6" -#define BTN_LABEL_PROP_BTN_7 "Button 7" -#define BTN_LABEL_PROP_BTN_8 "Button 8" -#define BTN_LABEL_PROP_BTN_9 "Button 9" - -#define BTN_LABEL_PROP_BTN_LEFT "Button Left" -#define BTN_LABEL_PROP_BTN_RIGHT "Button Right" -#define BTN_LABEL_PROP_BTN_MIDDLE "Button Middle" -#define BTN_LABEL_PROP_BTN_SIDE "Button Side" -#define BTN_LABEL_PROP_BTN_EXTRA "Button Extra" -#define BTN_LABEL_PROP_BTN_FORWARD "Button Forward" -#define BTN_LABEL_PROP_BTN_BACK "Button Back" -#define BTN_LABEL_PROP_BTN_TASK "Button Task" - -#define BTN_LABEL_PROP_BTN_TRIGGER "Button Trigger" -#define BTN_LABEL_PROP_BTN_THUMB "Button Thumb" -#define BTN_LABEL_PROP_BTN_THUMB2 "Button Thumb2" -#define BTN_LABEL_PROP_BTN_TOP "Button Top" -#define BTN_LABEL_PROP_BTN_TOP2 "Button Top2" -#define BTN_LABEL_PROP_BTN_PINKIE "Button Pinkie" -#define BTN_LABEL_PROP_BTN_BASE "Button Base" -#define BTN_LABEL_PROP_BTN_BASE2 "Button Base2" -#define BTN_LABEL_PROP_BTN_BASE3 "Button Base3" -#define BTN_LABEL_PROP_BTN_BASE4 "Button Base4" -#define BTN_LABEL_PROP_BTN_BASE5 "Button Base5" -#define BTN_LABEL_PROP_BTN_BASE6 "Button Base6" -#define BTN_LABEL_PROP_BTN_DEAD "Button Dead" - -#define BTN_LABEL_PROP_BTN_A "Button A" -#define BTN_LABEL_PROP_BTN_B "Button B" -#define BTN_LABEL_PROP_BTN_C "Button C" -#define BTN_LABEL_PROP_BTN_X "Button X" -#define BTN_LABEL_PROP_BTN_Y "Button Y" -#define BTN_LABEL_PROP_BTN_Z "Button Z" -#define BTN_LABEL_PROP_BTN_TL "Button T Left" -#define BTN_LABEL_PROP_BTN_TR "Button T Right" -#define BTN_LABEL_PROP_BTN_TL2 "Button T Left2" -#define BTN_LABEL_PROP_BTN_TR2 "Button T Right2" -#define BTN_LABEL_PROP_BTN_SELECT "Button Select" -#define BTN_LABEL_PROP_BTN_START "Button Start" -#define BTN_LABEL_PROP_BTN_MODE "Button Mode" -#define BTN_LABEL_PROP_BTN_THUMBL "Button Thumb Left" -#define BTN_LABEL_PROP_BTN_THUMBR "Button Thumb Right" - -#define BTN_LABEL_PROP_BTN_TOOL_PEN "Button Tool Pen" -#define BTN_LABEL_PROP_BTN_TOOL_RUBBER "Button Tool Rubber" -#define BTN_LABEL_PROP_BTN_TOOL_BRUSH "Button Tool Brush" -#define BTN_LABEL_PROP_BTN_TOOL_PENCIL "Button Tool Pencil" -#define BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH "Button Tool Airbrush" -#define BTN_LABEL_PROP_BTN_TOOL_FINGER "Button Tool Finger" -#define BTN_LABEL_PROP_BTN_TOOL_MOUSE "Button Tool Mouse" -#define BTN_LABEL_PROP_BTN_TOOL_LENS "Button Tool Lens" -#define BTN_LABEL_PROP_BTN_TOUCH "Button Touch" -#define BTN_LABEL_PROP_BTN_STYLUS "Button Stylus" -#define BTN_LABEL_PROP_BTN_STYLUS2 "Button Stylus2" -#define BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP "Button Tool Doubletap" -#define BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP "Button Tool Tripletap" - -#define BTN_LABEL_PROP_BTN_GEAR_DOWN "Button Gear down" -#define BTN_LABEL_PROP_BTN_GEAR_UP "Button Gear up" - -#endif +/* + * Copyright 2008 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software") + * to deal in the software without restriction, including without limitation + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * them Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTIBILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + + +/* Properties managed by the server. */ + +#ifndef _XSERVER_PROPERTIES_H_ +#define _XSERVER_PROPERTIES_H_ + +/* Type for a 4 byte float. Storage format IEEE 754 in client's default + * byte-ordering. */ +#define XATOM_FLOAT "FLOAT" + +/* BOOL. 0 - device disabled, 1 - device enabled */ +#define XI_PROP_ENABLED "Device Enabled" +/* BOOL. If present, device is a virtual XTEST device */ +#define XI_PROP_XTEST_DEVICE "XTEST Device" + +/* CARD32, 2 values, vendor, product. + * This property is set by the driver and may not be available for some + * drivers. Read-Only */ +#define XI_PROP_PRODUCT_ID "Device Product ID" + +/* Coordinate transformation matrix for absolute input devices + * FLOAT, 9 values in row-major order, coordinates in 0..1 range: + * [c0 c1 c2] [x] + * [c3 c4 c5] * [y] + * [c6 c7 c8] [1] */ +#define XI_PROP_TRANSFORM "Coordinate Transformation Matrix" + +/* STRING. Device node path of device */ +#define XI_PROP_DEVICE_NODE "Device Node" + +/* Pointer acceleration properties */ +/* INTEGER of any format */ +#define ACCEL_PROP_PROFILE_NUMBER "Device Accel Profile" +/* FLOAT, format 32 */ +#define ACCEL_PROP_CONSTANT_DECELERATION "Device Accel Constant Deceleration" +/* FLOAT, format 32 */ +#define ACCEL_PROP_ADAPTIVE_DECELERATION "Device Accel Adaptive Deceleration" +/* FLOAT, format 32 */ +#define ACCEL_PROP_VELOCITY_SCALING "Device Accel Velocity Scaling" + + +/* Axis labels */ +#define AXIS_LABEL_PROP "Axis Labels" + +#define AXIS_LABEL_PROP_REL_X "Rel X" +#define AXIS_LABEL_PROP_REL_Y "Rel Y" +#define AXIS_LABEL_PROP_REL_Z "Rel Z" +#define AXIS_LABEL_PROP_REL_RX "Rel Rotary X" +#define AXIS_LABEL_PROP_REL_RY "Rel Rotary Y" +#define AXIS_LABEL_PROP_REL_RZ "Rel Rotary Z" +#define AXIS_LABEL_PROP_REL_HWHEEL "Rel Horiz Wheel" +#define AXIS_LABEL_PROP_REL_DIAL "Rel Dial" +#define AXIS_LABEL_PROP_REL_WHEEL "Rel Vert Wheel" +#define AXIS_LABEL_PROP_REL_MISC "Rel Misc" + +/* + * Absolute axes + */ + +#define AXIS_LABEL_PROP_ABS_X "Abs X" +#define AXIS_LABEL_PROP_ABS_Y "Abs Y" +#define AXIS_LABEL_PROP_ABS_Z "Abs Z" +#define AXIS_LABEL_PROP_ABS_RX "Abs Rotary X" +#define AXIS_LABEL_PROP_ABS_RY "Abs Rotary Y" +#define AXIS_LABEL_PROP_ABS_RZ "Abs Rotary Z" +#define AXIS_LABEL_PROP_ABS_THROTTLE "Abs Throttle" +#define AXIS_LABEL_PROP_ABS_RUDDER "Abs Rudder" +#define AXIS_LABEL_PROP_ABS_WHEEL "Abs Wheel" +#define AXIS_LABEL_PROP_ABS_GAS "Abs Gas" +#define AXIS_LABEL_PROP_ABS_BRAKE "Abs Brake" +#define AXIS_LABEL_PROP_ABS_HAT0X "Abs Hat 0 X" +#define AXIS_LABEL_PROP_ABS_HAT0Y "Abs Hat 0 Y" +#define AXIS_LABEL_PROP_ABS_HAT1X "Abs Hat 1 X" +#define AXIS_LABEL_PROP_ABS_HAT1Y "Abs Hat 1 Y" +#define AXIS_LABEL_PROP_ABS_HAT2X "Abs Hat 2 X" +#define AXIS_LABEL_PROP_ABS_HAT2Y "Abs Hat 2 Y" +#define AXIS_LABEL_PROP_ABS_HAT3X "Abs Hat 3 X" +#define AXIS_LABEL_PROP_ABS_HAT3Y "Abs Hat 3 Y" +#define AXIS_LABEL_PROP_ABS_PRESSURE "Abs Pressure" +#define AXIS_LABEL_PROP_ABS_DISTANCE "Abs Distance" +#define AXIS_LABEL_PROP_ABS_TILT_X "Abs Tilt X" +#define AXIS_LABEL_PROP_ABS_TILT_Y "Abs Tilt Y" +#define AXIS_LABEL_PROP_ABS_TOOL_WIDTH "Abs Tool Width" +#define AXIS_LABEL_PROP_ABS_VOLUME "Abs Volume" +#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MAJOR "Abs MT Touch Major" +#define AXIS_LABEL_PROP_ABS_MT_TOUCH_MINOR "Abs MT Touch Minor" +#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MAJOR "Abs MT Width Major" +#define AXIS_LABEL_PROP_ABS_MT_WIDTH_MINOR "Abs MT Width Minor" +#define AXIS_LABEL_PROP_ABS_MT_ORIENTATION "Abs MT Orientation" +#define AXIS_LABEL_PROP_ABS_MT_POSITION_X "Abs MT Position X" +#define AXIS_LABEL_PROP_ABS_MT_POSITION_Y "Abs MT Position Y" +#define AXIS_LABEL_PROP_ABS_MT_TOOL_TYPE "Abs MT Tool Type" +#define AXIS_LABEL_PROP_ABS_MT_BLOB_ID "Abs MT Blob ID" +#define AXIS_LABEL_PROP_ABS_MT_TRACKING_ID "Abs MT Tracking ID" +#define AXIS_LABEL_PROP_ABS_MT_PRESSURE "Abs MT Pressure" +#define AXIS_LABEL_PROP_ABS_MISC "Abs Misc" + +/* Button names */ +#define BTN_LABEL_PROP "Button Labels" + +/* Default label */ +#define BTN_LABEL_PROP_BTN_UNKNOWN "Button Unknown" +/* Wheel buttons */ +#define BTN_LABEL_PROP_BTN_WHEEL_UP "Button Wheel Up" +#define BTN_LABEL_PROP_BTN_WHEEL_DOWN "Button Wheel Down" +#define BTN_LABEL_PROP_BTN_HWHEEL_LEFT "Button Horiz Wheel Left" +#define BTN_LABEL_PROP_BTN_HWHEEL_RIGHT "Button Horiz Wheel Right" + +/* The following are from linux/input.h */ +#define BTN_LABEL_PROP_BTN_0 "Button 0" +#define BTN_LABEL_PROP_BTN_1 "Button 1" +#define BTN_LABEL_PROP_BTN_2 "Button 2" +#define BTN_LABEL_PROP_BTN_3 "Button 3" +#define BTN_LABEL_PROP_BTN_4 "Button 4" +#define BTN_LABEL_PROP_BTN_5 "Button 5" +#define BTN_LABEL_PROP_BTN_6 "Button 6" +#define BTN_LABEL_PROP_BTN_7 "Button 7" +#define BTN_LABEL_PROP_BTN_8 "Button 8" +#define BTN_LABEL_PROP_BTN_9 "Button 9" + +#define BTN_LABEL_PROP_BTN_LEFT "Button Left" +#define BTN_LABEL_PROP_BTN_RIGHT "Button Right" +#define BTN_LABEL_PROP_BTN_MIDDLE "Button Middle" +#define BTN_LABEL_PROP_BTN_SIDE "Button Side" +#define BTN_LABEL_PROP_BTN_EXTRA "Button Extra" +#define BTN_LABEL_PROP_BTN_FORWARD "Button Forward" +#define BTN_LABEL_PROP_BTN_BACK "Button Back" +#define BTN_LABEL_PROP_BTN_TASK "Button Task" + +#define BTN_LABEL_PROP_BTN_TRIGGER "Button Trigger" +#define BTN_LABEL_PROP_BTN_THUMB "Button Thumb" +#define BTN_LABEL_PROP_BTN_THUMB2 "Button Thumb2" +#define BTN_LABEL_PROP_BTN_TOP "Button Top" +#define BTN_LABEL_PROP_BTN_TOP2 "Button Top2" +#define BTN_LABEL_PROP_BTN_PINKIE "Button Pinkie" +#define BTN_LABEL_PROP_BTN_BASE "Button Base" +#define BTN_LABEL_PROP_BTN_BASE2 "Button Base2" +#define BTN_LABEL_PROP_BTN_BASE3 "Button Base3" +#define BTN_LABEL_PROP_BTN_BASE4 "Button Base4" +#define BTN_LABEL_PROP_BTN_BASE5 "Button Base5" +#define BTN_LABEL_PROP_BTN_BASE6 "Button Base6" +#define BTN_LABEL_PROP_BTN_DEAD "Button Dead" + +#define BTN_LABEL_PROP_BTN_A "Button A" +#define BTN_LABEL_PROP_BTN_B "Button B" +#define BTN_LABEL_PROP_BTN_C "Button C" +#define BTN_LABEL_PROP_BTN_X "Button X" +#define BTN_LABEL_PROP_BTN_Y "Button Y" +#define BTN_LABEL_PROP_BTN_Z "Button Z" +#define BTN_LABEL_PROP_BTN_TL "Button T Left" +#define BTN_LABEL_PROP_BTN_TR "Button T Right" +#define BTN_LABEL_PROP_BTN_TL2 "Button T Left2" +#define BTN_LABEL_PROP_BTN_TR2 "Button T Right2" +#define BTN_LABEL_PROP_BTN_SELECT "Button Select" +#define BTN_LABEL_PROP_BTN_START "Button Start" +#define BTN_LABEL_PROP_BTN_MODE "Button Mode" +#define BTN_LABEL_PROP_BTN_THUMBL "Button Thumb Left" +#define BTN_LABEL_PROP_BTN_THUMBR "Button Thumb Right" + +#define BTN_LABEL_PROP_BTN_TOOL_PEN "Button Tool Pen" +#define BTN_LABEL_PROP_BTN_TOOL_RUBBER "Button Tool Rubber" +#define BTN_LABEL_PROP_BTN_TOOL_BRUSH "Button Tool Brush" +#define BTN_LABEL_PROP_BTN_TOOL_PENCIL "Button Tool Pencil" +#define BTN_LABEL_PROP_BTN_TOOL_AIRBRUSH "Button Tool Airbrush" +#define BTN_LABEL_PROP_BTN_TOOL_FINGER "Button Tool Finger" +#define BTN_LABEL_PROP_BTN_TOOL_MOUSE "Button Tool Mouse" +#define BTN_LABEL_PROP_BTN_TOOL_LENS "Button Tool Lens" +#define BTN_LABEL_PROP_BTN_TOUCH "Button Touch" +#define BTN_LABEL_PROP_BTN_STYLUS "Button Stylus" +#define BTN_LABEL_PROP_BTN_STYLUS2 "Button Stylus2" +#define BTN_LABEL_PROP_BTN_TOOL_DOUBLETAP "Button Tool Doubletap" +#define BTN_LABEL_PROP_BTN_TOOL_TRIPLETAP "Button Tool Tripletap" + +#define BTN_LABEL_PROP_BTN_GEAR_DOWN "Button Gear down" +#define BTN_LABEL_PROP_BTN_GEAR_UP "Button Gear up" + +#endif diff --git a/xorg-server/mi/mieq.c b/xorg-server/mi/mieq.c index 031b11ab2..fc3738a41 100644 --- a/xorg-server/mi/mieq.c +++ b/xorg-server/mi/mieq.c @@ -43,6 +43,7 @@ in this Software without prior written authorization from The Open Group. # include "windowstr.h" # include "pixmapstr.h" # include "inputstr.h" +# include "inpututils.h" # include "mi.h" # include "mipointer.h" # include "scrnintstr.h" diff --git a/xorg-server/randr/rrscreen.c b/xorg-server/randr/rrscreen.c index 1bc1a9ea1..da6d48d6e 100644 --- a/xorg-server/randr/rrscreen.c +++ b/xorg-server/randr/rrscreen.c @@ -910,12 +910,6 @@ ProcRRSetScreenConfig (ClientPtr client) */ width = mode->mode.width; height = mode->mode.height; - if (rotation & (RR_Rotate_90|RR_Rotate_270)) - { - width = mode->mode.height; - height = mode->mode.width; - } - if (width < pScrPriv->minWidth || pScrPriv->maxWidth < width) { client->errorValue = width; free(pData); @@ -927,6 +921,12 @@ ProcRRSetScreenConfig (ClientPtr client) return BadValue; } + if (rotation & (RR_Rotate_90|RR_Rotate_270)) + { + width = mode->mode.height; + height = mode->mode.width; + } + if (width != pScreen->width || height != pScreen->height) { int c; diff --git a/xorg-server/xkeyboard-config/rules/base.extras.xml.in b/xorg-server/xkeyboard-config/rules/base.extras.xml.in index bbdf8db19..a6b52f0ed 100644 --- a/xorg-server/xkeyboard-config/rules/base.extras.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.extras.xml.in @@ -189,6 +189,16 @@ rum + + + crh_dobruja + <_shortDescription>crh + <_description>Crimean Tatar (Dobruja Q) + + crh + + + ergonomic @@ -252,7 +262,7 @@ olpc-phonetic - <_description>Armenian (alternative phonetic for OLPC) + <_description>Armenian (OLPC phonetic) diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index 33307dd81..9f117cf34 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -3891,16 +3891,6 @@ <_description>Romanian (WinKeys) - - - crh_dobruja - <_shortDescription>crh - <_description>Crimean Tatar (Dobruja Q) - - crh - - - -- cgit v1.2.3