diff options
Diffstat (limited to 'xorg-server')
33 files changed, 22377 insertions, 23454 deletions
diff --git a/xorg-server/Xext/xf86bigfont.c b/xorg-server/Xext/xf86bigfont.c index 356a6152b..da3528783 100644 --- a/xorg-server/Xext/xf86bigfont.c +++ b/xorg-server/Xext/xf86bigfont.c @@ -1,751 +1,751 @@ -/*
- * BIGFONT extension for sharing font metrics between clients (if possible)
- * and for transmitting font metrics to clients in a compressed form.
- *
- * Copyright (c) 1999-2000 Bruno Haible
- * Copyright (c) 1999-2000 The XFree86 Project, Inc.
- */
-
-/* THIS IS NOT AN X CONSORTIUM STANDARD */
-
-/*
- * Big fonts suffer from the following: All clients that have opened a
- * font can access the complete glyph metrics array (the XFontStruct member
- * `per_char') directly, without going through a macro. Moreover these
- * glyph metrics are ink metrics, i.e. are not redundant even for a
- * fixed-width font. For a Unicode font, the size of this array is 768 KB.
- *
- * Problems: 1. It eats a lot of memory in each client. 2. All this glyph
- * metrics data is piped through the socket when the font is opened.
- *
- * This extension addresses these two problems for local clients, by using
- * shared memory. It also addresses the second problem for non-local clients,
- * by compressing the data before transmit by a factor of nearly 6.
- *
- * If you use this extension, your OS ought to nicely support shared memory.
- * This means: Shared memory should be swappable to the swap, and the limits
- * should be high enough (SHMMNI at least 64, SHMMAX at least 768 KB,
- * SHMALL at least 48 MB). It is a plus if your OS allows shmat() calls
- * on segments that have already been marked "removed", because it permits
- * these segments to be cleaned up by the OS if the X server is killed with
- * signal SIGKILL.
- *
- * This extension is transparently exploited by Xlib (functions XQueryFont,
- * XLoadQueryFont).
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <sys/types.h>
-#ifdef HAS_SHM
-#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2)
-/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */
-/* Linux libc4 and libc5 only (because glibc doesn't include kernel headers):
- Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define
- PAGE_SIZE. It is defined in <asm/page.h>. */
-#include <asm/page.h>
-#endif
-#ifdef SVR4
-#include <sys/sysmacros.h>
-#endif
-#if defined(__CYGWIN__) || defined(__SCO__)
-#include <sys/param.h>
-#include <sys/sysmacros.h>
-#endif
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <sys/stat.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <time.h>
-#include <errno.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "os.h"
-#include "dixstruct.h"
-#include "gcstruct.h"
-#include "dixfontstr.h"
-#include "extnsionst.h"
-#include "protocol-versions.h"
-
-#include <X11/extensions/xf86bigfproto.h>
-#include "xf86bigfontsrv.h"
-
-static void XF86BigfontResetProc(
- ExtensionEntry * /* extEntry */
- );
-
-
-#ifdef HAS_SHM
-
-/* A random signature, transmitted to the clients so they can verify that the
- shared memory segment they are attaching to was really established by the
- X server they are talking to. */
-static CARD32 signature;
-
-/* Index for additional information stored in a FontRec's devPrivates array. */
-static int FontShmdescIndex;
-
-static unsigned int pagesize;
-
-static Bool badSysCall = FALSE;
-
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__)
-
-#include <sys/signal.h>
-
-static void
-SigSysHandler(
- int signo)
-{
- badSysCall = TRUE;
-}
-
-static Bool
-CheckForShmSyscall(void)
-{
- void (*oldHandler)(int);
- int shmid = -1;
-
- /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */
- oldHandler = signal(SIGSYS, SigSysHandler);
-
- badSysCall = FALSE;
- shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT);
- if (shmid != -1)
- {
- /* Successful allocation - clean up */
- shmctl(shmid, IPC_RMID, NULL);
- }
- else
- {
- /* Allocation failed */
- badSysCall = TRUE;
- }
- signal(SIGSYS, oldHandler);
- return !badSysCall;
-}
-
-#define MUST_CHECK_FOR_SHM_SYSCALL
-
-#endif
-
-#endif
-
-void
-XFree86BigfontExtensionInit(void)
-{
- if (AddExtension(XF86BIGFONTNAME,
- XF86BigfontNumberEvents,
- XF86BigfontNumberErrors,
- ProcXF86BigfontDispatch,
- SProcXF86BigfontDispatch,
- XF86BigfontResetProc,
- StandardMinorOpcode)) {
-#ifdef HAS_SHM
-#ifdef MUST_CHECK_FOR_SHM_SYSCALL
- /*
- * Note: Local-clients will not be optimized without shared memory
- * support. Remote-client optimization does not depend on shared
- * memory support. Thus, the extension is still registered even
- * when shared memory support is not functional.
- */
- if (!CheckForShmSyscall()) {
- ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n");
- return;
- }
-#endif
-
- srand((unsigned int) time(NULL));
- signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16)
- + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand());
- /* fprintf(stderr, "signature = 0x%08X\n", signature); */
-
- FontShmdescIndex = AllocateFontPrivateIndex();
-
-#if !defined(CSRG_BASED) && !defined(__CYGWIN__)
- pagesize = SHMLBA;
-#else
-# ifdef _SC_PAGESIZE
- pagesize = sysconf(_SC_PAGESIZE);
-# else
- pagesize = getpagesize();
-# endif
-#endif
-#endif
- }
-}
-
-
-/* ========== Management of shared memory segments ========== */
-
-#ifdef HAS_SHM
-
-#ifdef __linux__
-/* On Linux, shared memory marked as "removed" can still be attached.
- Nice feature, because the kernel will automatically free the associated
- storage when the server and all clients are gone. */
-#define EARLY_REMOVE
-#endif
-
-typedef struct _ShmDesc {
- struct _ShmDesc *next;
- struct _ShmDesc **prev;
- int shmid;
- char *attach_addr;
-} ShmDescRec, *ShmDescPtr;
-
-static ShmDescPtr ShmList = (ShmDescPtr) NULL;
-
-static ShmDescPtr
-shmalloc(
- unsigned int size)
-{
- ShmDescPtr pDesc;
- int shmid;
- char *addr;
-
-#ifdef MUST_CHECK_FOR_SHM_SYSCALL
- if (pagesize == 0)
- return (ShmDescPtr) NULL;
-#endif
-
- /* On some older Linux systems, the number of shared memory segments
- system-wide is 127. In Linux 2.4, it is 4095.
- Therefore there is a tradeoff to be made between allocating a
- shared memory segment on one hand, and allocating memory and piping
- the glyph metrics on the other hand. If the glyph metrics size is
- small, we prefer the traditional way. */
- if (size < 3500)
- return (ShmDescPtr) NULL;
-
- pDesc = malloc(sizeof(ShmDescRec));
- if (!pDesc)
- return (ShmDescPtr) NULL;
-
- size = (size + pagesize-1) & -pagesize;
- shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH);
- if (shmid == -1) {
- ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n",
- size, strerror(errno));
- free(pDesc);
- return (ShmDescPtr) NULL;
- }
-
- if ((addr = shmat(shmid, 0, 0)) == (char *)-1) {
- ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n",
- size, strerror(errno));
- shmctl(shmid, IPC_RMID, (void *) 0);
- free(pDesc);
- return (ShmDescPtr) NULL;
- }
-
-#ifdef EARLY_REMOVE
- shmctl(shmid, IPC_RMID, (void *) 0);
-#endif
-
- pDesc->shmid = shmid;
- pDesc->attach_addr = addr;
- if (ShmList) ShmList->prev = &pDesc->next;
- pDesc->next = ShmList;
- pDesc->prev = &ShmList;
- ShmList = pDesc;
-
- return pDesc;
-}
-
-static void
-shmdealloc(
- ShmDescPtr pDesc)
-{
-#ifndef EARLY_REMOVE
- shmctl(pDesc->shmid, IPC_RMID, (void *) 0);
-#endif
- shmdt(pDesc->attach_addr);
-
- if (pDesc->next) pDesc->next->prev = pDesc->prev;
- *pDesc->prev = pDesc->next;
- free(pDesc);
-}
-
-#endif
-
-/* Called when a font is closed. */
-void
-XF86BigfontFreeFontShm(
- FontPtr pFont)
-{
-#ifdef HAS_SHM
- ShmDescPtr pDesc;
-
- /* If during shutdown of the server, XF86BigfontCleanup() has already
- * called shmdealloc() for all segments, we don't need to do it here.
- */
- if (!ShmList)
- return;
-
- pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
- if (pDesc)
- shmdealloc(pDesc);
-#endif
-}
-
-/* Called upon fatal signal. */
-void
-XF86BigfontCleanup(void)
-{
-#ifdef HAS_SHM
- while (ShmList)
- shmdealloc(ShmList);
-#endif
-}
-
-/* Called when a server generation dies. */
-static void
-XF86BigfontResetProc(
- ExtensionEntry* extEntry)
-{
- /* This function is normally called from CloseDownExtensions(), called
- * from main(). It will be followed by a call to FreeAllResources(),
- * which will call XF86BigfontFreeFontShm() for each font. Thus it
- * appears that we do not need to do anything in this function. --
- * But I prefer to write robust code, and not keep shared memory lying
- * around when it's not needed any more. (Someone might close down the
- * extension without calling FreeAllResources()...)
- */
- XF86BigfontCleanup();
-}
-
-
-/* ========== Handling of extension specific requests ========== */
-
-static int
-ProcXF86BigfontQueryVersion(
- ClientPtr client)
-{
- xXF86BigfontQueryVersionReply reply;
-
- REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq);
- reply.type = X_Reply;
- reply.length = 0;
- reply.sequenceNumber = client->sequence;
- reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION;
- reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION;
- reply.uid = geteuid();
- reply.gid = getegid();
-#ifdef HAS_SHM
- reply.signature = signature;
-#else
- reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */
-#endif
- reply.capabilities =
-#ifdef HAS_SHM
- (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0)
-#else
- 0
-#endif
- ; /* may add more bits here in future versions */
- if (client->swapped) {
- char tmp;
- swaps(&reply.sequenceNumber, tmp);
- swapl(&reply.length, tmp);
- swaps(&reply.majorVersion, tmp);
- swaps(&reply.minorVersion, tmp);
- swapl(&reply.uid, tmp);
- swapl(&reply.gid, tmp);
- swapl(&reply.signature, tmp);
- }
- WriteToClient(client,
- sizeof(xXF86BigfontQueryVersionReply), (char *)&reply);
- return Success;
-}
-
-static void
-swapCharInfo(
- xCharInfo *pCI)
-{
- char tmp;
-
- swaps(&pCI->leftSideBearing, tmp);
- swaps(&pCI->rightSideBearing, tmp);
- swaps(&pCI->characterWidth, tmp);
- swaps(&pCI->ascent, tmp);
- swaps(&pCI->descent, tmp);
- swaps(&pCI->attributes, tmp);
-}
-
-/* static CARD32 hashCI (xCharInfo *p); */
-#define hashCI(p) \
- (CARD32)(((p->leftSideBearing << 27) + (p->leftSideBearing >> 5) + \
- (p->rightSideBearing << 23) + (p->rightSideBearing >> 9) + \
- (p->characterWidth << 16) + \
- (p->ascent << 11) + (p->descent << 6)) ^ p->attributes)
-
-static int
-ProcXF86BigfontQueryFont(
- ClientPtr client)
-{
- FontPtr pFont;
- REQUEST(xXF86BigfontQueryFontReq);
- CARD32 stuff_flags;
- xCharInfo* pmax;
- xCharInfo* pmin;
- int nCharInfos;
- int shmid;
-#ifdef HAS_SHM
- ShmDescPtr pDesc = NULL;
-#else
-#define pDesc 0
-#endif
- xCharInfo* pCI;
- CARD16* pIndex2UniqIndex;
- CARD16* pUniqIndex2Index;
- CARD32 nUniqCharInfos;
-
-#if 0
- REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
-#else
- switch (client->req_len) {
- case 2: /* client with version 1.0 libX11 */
- stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0);
- break;
- case 3: /* client with version 1.1 libX11 */
- stuff_flags = stuff->flags;
- break;
- default:
- return BadLength;
- }
-#endif
- if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success)
- return BadFont; /* procotol spec says only error is BadFont */
-
- pmax = FONTINKMAX(pFont);
- pmin = FONTINKMIN(pFont);
- nCharInfos =
- (pmax->rightSideBearing == pmin->rightSideBearing
- && pmax->leftSideBearing == pmin->leftSideBearing
- && pmax->descent == pmin->descent
- && pmax->ascent == pmin->ascent
- && pmax->characterWidth == pmin->characterWidth)
- ? 0 : N2dChars(pFont);
- shmid = -1;
- pCI = NULL;
- pIndex2UniqIndex = NULL;
- pUniqIndex2Index = NULL;
- nUniqCharInfos = 0;
-
- if (nCharInfos > 0) {
-#ifdef HAS_SHM
- if (!badSysCall)
- pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex);
- if (pDesc) {
- pCI = (xCharInfo *) pDesc->attach_addr;
- if (stuff_flags & XF86Bigfont_FLAGS_Shm)
- shmid = pDesc->shmid;
- } else {
- if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall)
- pDesc = shmalloc(nCharInfos * sizeof(xCharInfo)
- + sizeof(CARD32));
- if (pDesc) {
- pCI = (xCharInfo *) pDesc->attach_addr;
- shmid = pDesc->shmid;
- } else {
-#endif
- pCI = malloc(nCharInfos * sizeof(xCharInfo));
- if (!pCI)
- return BadAlloc;
-#ifdef HAS_SHM
- }
-#endif
- /* Fill nCharInfos starting at pCI. */
- {
- xCharInfo* prCI = pCI;
- int ninfos = 0;
- int ncols = pFont->info.lastCol - pFont->info.firstCol + 1;
- int row;
- for (row = pFont->info.firstRow;
- row <= pFont->info.lastRow && ninfos < nCharInfos;
- row++) {
- unsigned char chars[512];
- xCharInfo* tmpCharInfos[256];
- unsigned long count;
- int col;
- unsigned long i;
- i = 0;
- for (col = pFont->info.firstCol;
- col <= pFont->info.lastCol;
- col++) {
- chars[i++] = row;
- chars[i++] = col;
- }
- (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit,
- &count, tmpCharInfos);
- for (i = 0; i < count && ninfos < nCharInfos; i++) {
- *prCI++ = *tmpCharInfos[i];
- ninfos++;
- }
- }
- }
-#ifdef HAS_SHM
- if (pDesc && !badSysCall) {
- *(CARD32 *)(pCI + nCharInfos) = signature;
- if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) {
- shmdealloc(pDesc);
- return BadAlloc;
- }
- }
- }
-#endif
- if (shmid == -1) {
- /* Cannot use shared memory, so remove-duplicates the xCharInfos
- using a temporary hash table. */
- /* Note that CARD16 is suitable as index type, because
- nCharInfos <= 0x10000. */
- CARD32 hashModulus;
- CARD16* pHash2UniqIndex;
- CARD16* pUniqIndex2NextUniqIndex;
- CARD32 NextIndex;
- CARD32 NextUniqIndex;
- CARD16* tmp;
- CARD32 i, j;
-
- hashModulus = 67;
- if (hashModulus > nCharInfos+1)
- hashModulus = nCharInfos+1;
-
- tmp = malloc((4*nCharInfos+1) * sizeof(CARD16));
- if (!tmp) {
- if (!pDesc) free(pCI);
- return BadAlloc;
- }
- pIndex2UniqIndex = tmp;
- /* nCharInfos elements */
- pUniqIndex2Index = tmp + nCharInfos;
- /* max. nCharInfos elements */
- pUniqIndex2NextUniqIndex = tmp + 2*nCharInfos;
- /* max. nCharInfos elements */
- pHash2UniqIndex = tmp + 3*nCharInfos;
- /* hashModulus (<= nCharInfos+1) elements */
-
- /* Note that we can use 0xffff as end-of-list indicator, because
- even if nCharInfos = 0x10000, 0xffff can not occur as valid
- entry before the last element has been inserted. And once the
- last element has been inserted, we don't need the hash table
- any more. */
- for (j = 0; j < hashModulus; j++)
- pHash2UniqIndex[j] = (CARD16)(-1);
-
- NextUniqIndex = 0;
- for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) {
- xCharInfo* p = &pCI[NextIndex];
- CARD32 hashCode = hashCI(p) % hashModulus;
- for (i = pHash2UniqIndex[hashCode];
- i != (CARD16)(-1);
- i = pUniqIndex2NextUniqIndex[i]) {
- j = pUniqIndex2Index[i];
- if (pCI[j].leftSideBearing == p->leftSideBearing
- && pCI[j].rightSideBearing == p->rightSideBearing
- && pCI[j].characterWidth == p->characterWidth
- && pCI[j].ascent == p->ascent
- && pCI[j].descent == p->descent
- && pCI[j].attributes == p->attributes)
- break;
- }
- if (i != (CARD16)(-1)) {
- /* Found *p at Index j, UniqIndex i */
- pIndex2UniqIndex[NextIndex] = i;
- } else {
- /* Allocate a new entry in the Uniq table */
- if (hashModulus <= 2*NextUniqIndex
- && hashModulus < nCharInfos+1) {
- /* Time to increate hash table size */
- hashModulus = 2*hashModulus+1;
- if (hashModulus > nCharInfos+1)
- hashModulus = nCharInfos+1;
- for (j = 0; j < hashModulus; j++)
- pHash2UniqIndex[j] = (CARD16)(-1);
- for (i = 0; i < NextUniqIndex; i++)
- pUniqIndex2NextUniqIndex[i] = (CARD16)(-1);
- for (i = 0; i < NextUniqIndex; i++) {
- j = pUniqIndex2Index[i];
- p = &pCI[j];
- hashCode = hashCI(p) % hashModulus;
- pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
- pHash2UniqIndex[hashCode] = i;
- }
- p = &pCI[NextIndex];
- hashCode = hashCI(p) % hashModulus;
- }
- i = NextUniqIndex++;
- pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode];
- pHash2UniqIndex[hashCode] = i;
- pUniqIndex2Index[i] = NextIndex;
- pIndex2UniqIndex[NextIndex] = i;
- }
- }
- nUniqCharInfos = NextUniqIndex;
- /* fprintf(stderr, "font metrics: nCharInfos = %d, nUniqCharInfos = %d, hashModulus = %d\n", nCharInfos, nUniqCharInfos, hashModulus); */
- }
- }
-
- {
- int nfontprops = pFont->info.nprops;
- int rlength =
- sizeof(xXF86BigfontQueryFontReply)
- + nfontprops * sizeof(xFontProp)
- + (nCharInfos > 0 && shmid == -1
- ? nUniqCharInfos * sizeof(xCharInfo)
- + (nCharInfos+1)/2 * 2 * sizeof(CARD16)
- : 0);
- xXF86BigfontQueryFontReply* reply = malloc(rlength);
- char* p;
- if (!reply) {
- if (nCharInfos > 0) {
- if (shmid == -1) free(pIndex2UniqIndex);
- if (!pDesc) free(pCI);
- }
- return BadAlloc;
- }
- reply->type = X_Reply;
- reply->length = bytes_to_int32(rlength - sizeof(xGenericReply));
- reply->sequenceNumber = client->sequence;
- reply->minBounds = pFont->info.ink_minbounds;
- reply->maxBounds = pFont->info.ink_maxbounds;
- reply->minCharOrByte2 = pFont->info.firstCol;
- reply->maxCharOrByte2 = pFont->info.lastCol;
- reply->defaultChar = pFont->info.defaultCh;
- reply->nFontProps = pFont->info.nprops;
- reply->drawDirection = pFont->info.drawDirection;
- reply->minByte1 = pFont->info.firstRow;
- reply->maxByte1 = pFont->info.lastRow;
- reply->allCharsExist = pFont->info.allExist;
- reply->fontAscent = pFont->info.fontAscent;
- reply->fontDescent = pFont->info.fontDescent;
- reply->nCharInfos = nCharInfos;
- reply->nUniqCharInfos = nUniqCharInfos;
- reply->shmid = shmid;
- reply->shmsegoffset = 0;
- if (client->swapped) {
- char tmp;
- swaps(&reply->sequenceNumber, tmp);
- swapl(&reply->length, tmp);
- swapCharInfo(&reply->minBounds);
- swapCharInfo(&reply->maxBounds);
- swaps(&reply->minCharOrByte2, tmp);
- swaps(&reply->maxCharOrByte2, tmp);
- swaps(&reply->defaultChar, tmp);
- swaps(&reply->nFontProps, tmp);
- swaps(&reply->fontAscent, tmp);
- swaps(&reply->fontDescent, tmp);
- swapl(&reply->nCharInfos, tmp);
- swapl(&reply->nUniqCharInfos, tmp);
- swapl(&reply->shmid, tmp);
- swapl(&reply->shmsegoffset, tmp);
- }
- p = (char*) &reply[1];
- {
- FontPropPtr pFP;
- xFontProp* prFP;
- int i;
- for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p;
- i < nfontprops;
- i++, pFP++, prFP++) {
- prFP->name = pFP->name;
- prFP->value = pFP->value;
- if (client->swapped) {
- char tmp;
- swapl(&prFP->name, tmp);
- swapl(&prFP->value, tmp);
- }
- }
- p = (char*) prFP;
- }
- if (nCharInfos > 0 && shmid == -1) {
- xCharInfo* pci;
- CARD16* ps;
- int i, j;
- pci = (xCharInfo*) p;
- for (i = 0; i < nUniqCharInfos; i++, pci++) {
- *pci = pCI[pUniqIndex2Index[i]];
- if (client->swapped)
- swapCharInfo(pci);
- }
- ps = (CARD16*) pci;
- for (j = 0; j < nCharInfos; j++, ps++) {
- *ps = pIndex2UniqIndex[j];
- if (client->swapped) {
- char tmp;
- swaps(ps, tmp);
- }
- }
- }
- WriteToClient(client, rlength, (char *)reply);
- free(reply);
- if (nCharInfos > 0) {
- if (shmid == -1) free(pIndex2UniqIndex);
- if (!pDesc) free(pCI);
- }
- return Success;
- }
-}
-
-static int
-ProcXF86BigfontDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data) {
- case X_XF86BigfontQueryVersion:
- return ProcXF86BigfontQueryVersion(client);
- case X_XF86BigfontQueryFont:
- return ProcXF86BigfontQueryFont(client);
- default:
- return BadRequest;
- }
-}
-
-static int
-SProcXF86BigfontQueryVersion(
- ClientPtr client)
-{
- REQUEST(xXF86BigfontQueryVersionReq);
- char tmp;
-
- swaps(&stuff->length, tmp);
- return ProcXF86BigfontQueryVersion(client);
-}
-
-static int
-SProcXF86BigfontQueryFont(
- ClientPtr client)
-{
- REQUEST(xXF86BigfontQueryFontReq);
- char tmp;
-
- swaps(&stuff->length, tmp);
- REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq);
- swapl(&stuff->id, tmp);
- return ProcXF86BigfontQueryFont(client);
-}
-
-static int
-SProcXF86BigfontDispatch(
- ClientPtr client)
-{
- REQUEST(xReq);
-
- switch (stuff->data) {
- case X_XF86BigfontQueryVersion:
- return SProcXF86BigfontQueryVersion(client);
- case X_XF86BigfontQueryFont:
- return SProcXF86BigfontQueryFont(client);
- default:
- return BadRequest;
- }
-}
+/* + * BIGFONT extension for sharing font metrics between clients (if possible) + * and for transmitting font metrics to clients in a compressed form. + * + * Copyright (c) 1999-2000 Bruno Haible + * Copyright (c) 1999-2000 The XFree86 Project, Inc. + */ + +/* THIS IS NOT AN X CONSORTIUM STANDARD */ + +/* + * Big fonts suffer from the following: All clients that have opened a + * font can access the complete glyph metrics array (the XFontStruct member + * `per_char') directly, without going through a macro. Moreover these + * glyph metrics are ink metrics, i.e. are not redundant even for a + * fixed-width font. For a Unicode font, the size of this array is 768 KB. + * + * Problems: 1. It eats a lot of memory in each client. 2. All this glyph + * metrics data is piped through the socket when the font is opened. + * + * This extension addresses these two problems for local clients, by using + * shared memory. It also addresses the second problem for non-local clients, + * by compressing the data before transmit by a factor of nearly 6. + * + * If you use this extension, your OS ought to nicely support shared memory. + * This means: Shared memory should be swappable to the swap, and the limits + * should be high enough (SHMMNI at least 64, SHMMAX at least 768 KB, + * SHMALL at least 48 MB). It is a plus if your OS allows shmat() calls + * on segments that have already been marked "removed", because it permits + * these segments to be cleaned up by the OS if the X server is killed with + * signal SIGKILL. + * + * This extension is transparently exploited by Xlib (functions XQueryFont, + * XLoadQueryFont). + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <sys/types.h> +#ifdef HAS_SHM +#if defined(linux) && (!defined(__GNU_LIBRARY__) || __GNU_LIBRARY__ < 2) +/* libc4 does not define __GNU_LIBRARY__, libc5 defines __GNU_LIBRARY__ as 1 */ +/* Linux libc4 and libc5 only (because glibc doesn't include kernel headers): + Linux 2.0.x and 2.2.x define SHMLBA as PAGE_SIZE, but forget to define + PAGE_SIZE. It is defined in <asm/page.h>. */ +#include <asm/page.h> +#endif +#ifdef SVR4 +#include <sys/sysmacros.h> +#endif +#if defined(__CYGWIN__) +#include <sys/param.h> +#include <sys/sysmacros.h> +#endif +#include <sys/ipc.h> +#include <sys/shm.h> +#include <sys/stat.h> +#include <stdlib.h> +#include <unistd.h> +#include <time.h> +#include <errno.h> +#endif + +#include <X11/X.h> +#include <X11/Xproto.h> +#include "misc.h" +#include "os.h" +#include "dixstruct.h" +#include "gcstruct.h" +#include "dixfontstr.h" +#include "extnsionst.h" +#include "protocol-versions.h" + +#include <X11/extensions/xf86bigfproto.h> +#include "xf86bigfontsrv.h" + +static void XF86BigfontResetProc( + ExtensionEntry * /* extEntry */ + ); + + +#ifdef HAS_SHM + +/* A random signature, transmitted to the clients so they can verify that the + shared memory segment they are attaching to was really established by the + X server they are talking to. */ +static CARD32 signature; + +/* Index for additional information stored in a FontRec's devPrivates array. */ +static int FontShmdescIndex; + +static unsigned int pagesize; + +static Bool badSysCall = FALSE; + +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__CYGWIN__) || defined(__DragonFly__) + +#include <sys/signal.h> + +static void +SigSysHandler( + int signo) +{ + badSysCall = TRUE; +} + +static Bool +CheckForShmSyscall(void) +{ + void (*oldHandler)(int); + int shmid = -1; + + /* If no SHM support in the kernel, the bad syscall will generate SIGSYS */ + oldHandler = signal(SIGSYS, SigSysHandler); + + badSysCall = FALSE; + shmid = shmget(IPC_PRIVATE, 4096, IPC_CREAT); + if (shmid != -1) + { + /* Successful allocation - clean up */ + shmctl(shmid, IPC_RMID, NULL); + } + else + { + /* Allocation failed */ + badSysCall = TRUE; + } + signal(SIGSYS, oldHandler); + return !badSysCall; +} + +#define MUST_CHECK_FOR_SHM_SYSCALL + +#endif + +#endif + +void +XFree86BigfontExtensionInit(void) +{ + if (AddExtension(XF86BIGFONTNAME, + XF86BigfontNumberEvents, + XF86BigfontNumberErrors, + ProcXF86BigfontDispatch, + SProcXF86BigfontDispatch, + XF86BigfontResetProc, + StandardMinorOpcode)) { +#ifdef HAS_SHM +#ifdef MUST_CHECK_FOR_SHM_SYSCALL + /* + * Note: Local-clients will not be optimized without shared memory + * support. Remote-client optimization does not depend on shared + * memory support. Thus, the extension is still registered even + * when shared memory support is not functional. + */ + if (!CheckForShmSyscall()) { + ErrorF(XF86BIGFONTNAME " extension local-client optimization disabled due to lack of shared memory support in the kernel\n"); + return; + } +#endif + + srand((unsigned int) time(NULL)); + signature = ((unsigned int) (65536.0/(RAND_MAX+1.0) * rand()) << 16) + + (unsigned int) (65536.0/(RAND_MAX+1.0) * rand()); + /* fprintf(stderr, "signature = 0x%08X\n", signature); */ + + FontShmdescIndex = AllocateFontPrivateIndex(); + +#if !defined(CSRG_BASED) && !defined(__CYGWIN__) + pagesize = SHMLBA; +#else +# ifdef _SC_PAGESIZE + pagesize = sysconf(_SC_PAGESIZE); +# else + pagesize = getpagesize(); +# endif +#endif +#endif + } +} + + +/* ========== Management of shared memory segments ========== */ + +#ifdef HAS_SHM + +#ifdef __linux__ +/* On Linux, shared memory marked as "removed" can still be attached. + Nice feature, because the kernel will automatically free the associated + storage when the server and all clients are gone. */ +#define EARLY_REMOVE +#endif + +typedef struct _ShmDesc { + struct _ShmDesc *next; + struct _ShmDesc **prev; + int shmid; + char *attach_addr; +} ShmDescRec, *ShmDescPtr; + +static ShmDescPtr ShmList = (ShmDescPtr) NULL; + +static ShmDescPtr +shmalloc( + unsigned int size) +{ + ShmDescPtr pDesc; + int shmid; + char *addr; + +#ifdef MUST_CHECK_FOR_SHM_SYSCALL + if (pagesize == 0) + return (ShmDescPtr) NULL; +#endif + + /* On some older Linux systems, the number of shared memory segments + system-wide is 127. In Linux 2.4, it is 4095. + Therefore there is a tradeoff to be made between allocating a + shared memory segment on one hand, and allocating memory and piping + the glyph metrics on the other hand. If the glyph metrics size is + small, we prefer the traditional way. */ + if (size < 3500) + return (ShmDescPtr) NULL; + + pDesc = malloc(sizeof(ShmDescRec)); + if (!pDesc) + return (ShmDescPtr) NULL; + + size = (size + pagesize-1) & -pagesize; + shmid = shmget(IPC_PRIVATE, size, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); + if (shmid == -1) { + ErrorF(XF86BIGFONTNAME " extension: shmget() failed, size = %u, %s\n", + size, strerror(errno)); + free(pDesc); + return (ShmDescPtr) NULL; + } + + if ((addr = shmat(shmid, 0, 0)) == (char *)-1) { + ErrorF(XF86BIGFONTNAME " extension: shmat() failed, size = %u, %s\n", + size, strerror(errno)); + shmctl(shmid, IPC_RMID, (void *) 0); + free(pDesc); + return (ShmDescPtr) NULL; + } + +#ifdef EARLY_REMOVE + shmctl(shmid, IPC_RMID, (void *) 0); +#endif + + pDesc->shmid = shmid; + pDesc->attach_addr = addr; + if (ShmList) ShmList->prev = &pDesc->next; + pDesc->next = ShmList; + pDesc->prev = &ShmList; + ShmList = pDesc; + + return pDesc; +} + +static void +shmdealloc( + ShmDescPtr pDesc) +{ +#ifndef EARLY_REMOVE + shmctl(pDesc->shmid, IPC_RMID, (void *) 0); +#endif + shmdt(pDesc->attach_addr); + + if (pDesc->next) pDesc->next->prev = pDesc->prev; + *pDesc->prev = pDesc->next; + free(pDesc); +} + +#endif + +/* Called when a font is closed. */ +void +XF86BigfontFreeFontShm( + FontPtr pFont) +{ +#ifdef HAS_SHM + ShmDescPtr pDesc; + + /* If during shutdown of the server, XF86BigfontCleanup() has already + * called shmdealloc() for all segments, we don't need to do it here. + */ + if (!ShmList) + return; + + pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex); + if (pDesc) + shmdealloc(pDesc); +#endif +} + +/* Called upon fatal signal. */ +void +XF86BigfontCleanup(void) +{ +#ifdef HAS_SHM + while (ShmList) + shmdealloc(ShmList); +#endif +} + +/* Called when a server generation dies. */ +static void +XF86BigfontResetProc( + ExtensionEntry* extEntry) +{ + /* This function is normally called from CloseDownExtensions(), called + * from main(). It will be followed by a call to FreeAllResources(), + * which will call XF86BigfontFreeFontShm() for each font. Thus it + * appears that we do not need to do anything in this function. -- + * But I prefer to write robust code, and not keep shared memory lying + * around when it's not needed any more. (Someone might close down the + * extension without calling FreeAllResources()...) + */ + XF86BigfontCleanup(); +} + + +/* ========== Handling of extension specific requests ========== */ + +static int +ProcXF86BigfontQueryVersion( + ClientPtr client) +{ + xXF86BigfontQueryVersionReply reply; + + REQUEST_SIZE_MATCH(xXF86BigfontQueryVersionReq); + reply.type = X_Reply; + reply.length = 0; + reply.sequenceNumber = client->sequence; + reply.majorVersion = SERVER_XF86BIGFONT_MAJOR_VERSION; + reply.minorVersion = SERVER_XF86BIGFONT_MINOR_VERSION; + reply.uid = geteuid(); + reply.gid = getegid(); +#ifdef HAS_SHM + reply.signature = signature; +#else + reply.signature = 0; /* This is redundant. Avoids uninitialized memory. */ +#endif + reply.capabilities = +#ifdef HAS_SHM + (LocalClient(client) && !client->swapped ? XF86Bigfont_CAP_LocalShm : 0) +#else + 0 +#endif + ; /* may add more bits here in future versions */ + if (client->swapped) { + char tmp; + swaps(&reply.sequenceNumber, tmp); + swapl(&reply.length, tmp); + swaps(&reply.majorVersion, tmp); + swaps(&reply.minorVersion, tmp); + swapl(&reply.uid, tmp); + swapl(&reply.gid, tmp); + swapl(&reply.signature, tmp); + } + WriteToClient(client, + sizeof(xXF86BigfontQueryVersionReply), (char *)&reply); + return Success; +} + +static void +swapCharInfo( + xCharInfo *pCI) +{ + char tmp; + + swaps(&pCI->leftSideBearing, tmp); + swaps(&pCI->rightSideBearing, tmp); + swaps(&pCI->characterWidth, tmp); + swaps(&pCI->ascent, tmp); + swaps(&pCI->descent, tmp); + swaps(&pCI->attributes, tmp); +} + +/* static CARD32 hashCI (xCharInfo *p); */ +#define hashCI(p) \ + (CARD32)(((p->leftSideBearing << 27) + (p->leftSideBearing >> 5) + \ + (p->rightSideBearing << 23) + (p->rightSideBearing >> 9) + \ + (p->characterWidth << 16) + \ + (p->ascent << 11) + (p->descent << 6)) ^ p->attributes) + +static int +ProcXF86BigfontQueryFont( + ClientPtr client) +{ + FontPtr pFont; + REQUEST(xXF86BigfontQueryFontReq); + CARD32 stuff_flags; + xCharInfo* pmax; + xCharInfo* pmin; + int nCharInfos; + int shmid; +#ifdef HAS_SHM + ShmDescPtr pDesc = NULL; +#else +#define pDesc 0 +#endif + xCharInfo* pCI; + CARD16* pIndex2UniqIndex; + CARD16* pUniqIndex2Index; + CARD32 nUniqCharInfos; + +#if 0 + REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq); +#else + switch (client->req_len) { + case 2: /* client with version 1.0 libX11 */ + stuff_flags = (LocalClient(client) && !client->swapped ? XF86Bigfont_FLAGS_Shm : 0); + break; + case 3: /* client with version 1.1 libX11 */ + stuff_flags = stuff->flags; + break; + default: + return BadLength; + } +#endif + if (dixLookupFontable(&pFont, stuff->id, client, DixGetAttrAccess) != Success) + return BadFont; /* procotol spec says only error is BadFont */ + + pmax = FONTINKMAX(pFont); + pmin = FONTINKMIN(pFont); + nCharInfos = + (pmax->rightSideBearing == pmin->rightSideBearing + && pmax->leftSideBearing == pmin->leftSideBearing + && pmax->descent == pmin->descent + && pmax->ascent == pmin->ascent + && pmax->characterWidth == pmin->characterWidth) + ? 0 : N2dChars(pFont); + shmid = -1; + pCI = NULL; + pIndex2UniqIndex = NULL; + pUniqIndex2Index = NULL; + nUniqCharInfos = 0; + + if (nCharInfos > 0) { +#ifdef HAS_SHM + if (!badSysCall) + pDesc = (ShmDescPtr) FontGetPrivate(pFont, FontShmdescIndex); + if (pDesc) { + pCI = (xCharInfo *) pDesc->attach_addr; + if (stuff_flags & XF86Bigfont_FLAGS_Shm) + shmid = pDesc->shmid; + } else { + if (stuff_flags & XF86Bigfont_FLAGS_Shm && !badSysCall) + pDesc = shmalloc(nCharInfos * sizeof(xCharInfo) + + sizeof(CARD32)); + if (pDesc) { + pCI = (xCharInfo *) pDesc->attach_addr; + shmid = pDesc->shmid; + } else { +#endif + pCI = malloc(nCharInfos * sizeof(xCharInfo)); + if (!pCI) + return BadAlloc; +#ifdef HAS_SHM + } +#endif + /* Fill nCharInfos starting at pCI. */ + { + xCharInfo* prCI = pCI; + int ninfos = 0; + int ncols = pFont->info.lastCol - pFont->info.firstCol + 1; + int row; + for (row = pFont->info.firstRow; + row <= pFont->info.lastRow && ninfos < nCharInfos; + row++) { + unsigned char chars[512]; + xCharInfo* tmpCharInfos[256]; + unsigned long count; + int col; + unsigned long i; + i = 0; + for (col = pFont->info.firstCol; + col <= pFont->info.lastCol; + col++) { + chars[i++] = row; + chars[i++] = col; + } + (*pFont->get_metrics) (pFont, ncols, chars, TwoD16Bit, + &count, tmpCharInfos); + for (i = 0; i < count && ninfos < nCharInfos; i++) { + *prCI++ = *tmpCharInfos[i]; + ninfos++; + } + } + } +#ifdef HAS_SHM + if (pDesc && !badSysCall) { + *(CARD32 *)(pCI + nCharInfos) = signature; + if (!FontSetPrivate(pFont, FontShmdescIndex, pDesc)) { + shmdealloc(pDesc); + return BadAlloc; + } + } + } +#endif + if (shmid == -1) { + /* Cannot use shared memory, so remove-duplicates the xCharInfos + using a temporary hash table. */ + /* Note that CARD16 is suitable as index type, because + nCharInfos <= 0x10000. */ + CARD32 hashModulus; + CARD16* pHash2UniqIndex; + CARD16* pUniqIndex2NextUniqIndex; + CARD32 NextIndex; + CARD32 NextUniqIndex; + CARD16* tmp; + CARD32 i, j; + + hashModulus = 67; + if (hashModulus > nCharInfos+1) + hashModulus = nCharInfos+1; + + tmp = malloc((4*nCharInfos+1) * sizeof(CARD16)); + if (!tmp) { + if (!pDesc) free(pCI); + return BadAlloc; + } + pIndex2UniqIndex = tmp; + /* nCharInfos elements */ + pUniqIndex2Index = tmp + nCharInfos; + /* max. nCharInfos elements */ + pUniqIndex2NextUniqIndex = tmp + 2*nCharInfos; + /* max. nCharInfos elements */ + pHash2UniqIndex = tmp + 3*nCharInfos; + /* hashModulus (<= nCharInfos+1) elements */ + + /* Note that we can use 0xffff as end-of-list indicator, because + even if nCharInfos = 0x10000, 0xffff can not occur as valid + entry before the last element has been inserted. And once the + last element has been inserted, we don't need the hash table + any more. */ + for (j = 0; j < hashModulus; j++) + pHash2UniqIndex[j] = (CARD16)(-1); + + NextUniqIndex = 0; + for (NextIndex = 0; NextIndex < nCharInfos; NextIndex++) { + xCharInfo* p = &pCI[NextIndex]; + CARD32 hashCode = hashCI(p) % hashModulus; + for (i = pHash2UniqIndex[hashCode]; + i != (CARD16)(-1); + i = pUniqIndex2NextUniqIndex[i]) { + j = pUniqIndex2Index[i]; + if (pCI[j].leftSideBearing == p->leftSideBearing + && pCI[j].rightSideBearing == p->rightSideBearing + && pCI[j].characterWidth == p->characterWidth + && pCI[j].ascent == p->ascent + && pCI[j].descent == p->descent + && pCI[j].attributes == p->attributes) + break; + } + if (i != (CARD16)(-1)) { + /* Found *p at Index j, UniqIndex i */ + pIndex2UniqIndex[NextIndex] = i; + } else { + /* Allocate a new entry in the Uniq table */ + if (hashModulus <= 2*NextUniqIndex + && hashModulus < nCharInfos+1) { + /* Time to increate hash table size */ + hashModulus = 2*hashModulus+1; + if (hashModulus > nCharInfos+1) + hashModulus = nCharInfos+1; + for (j = 0; j < hashModulus; j++) + pHash2UniqIndex[j] = (CARD16)(-1); + for (i = 0; i < NextUniqIndex; i++) + pUniqIndex2NextUniqIndex[i] = (CARD16)(-1); + for (i = 0; i < NextUniqIndex; i++) { + j = pUniqIndex2Index[i]; + p = &pCI[j]; + hashCode = hashCI(p) % hashModulus; + pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode]; + pHash2UniqIndex[hashCode] = i; + } + p = &pCI[NextIndex]; + hashCode = hashCI(p) % hashModulus; + } + i = NextUniqIndex++; + pUniqIndex2NextUniqIndex[i] = pHash2UniqIndex[hashCode]; + pHash2UniqIndex[hashCode] = i; + pUniqIndex2Index[i] = NextIndex; + pIndex2UniqIndex[NextIndex] = i; + } + } + nUniqCharInfos = NextUniqIndex; + /* fprintf(stderr, "font metrics: nCharInfos = %d, nUniqCharInfos = %d, hashModulus = %d\n", nCharInfos, nUniqCharInfos, hashModulus); */ + } + } + + { + int nfontprops = pFont->info.nprops; + int rlength = + sizeof(xXF86BigfontQueryFontReply) + + nfontprops * sizeof(xFontProp) + + (nCharInfos > 0 && shmid == -1 + ? nUniqCharInfos * sizeof(xCharInfo) + + (nCharInfos+1)/2 * 2 * sizeof(CARD16) + : 0); + xXF86BigfontQueryFontReply* reply = malloc(rlength); + char* p; + if (!reply) { + if (nCharInfos > 0) { + if (shmid == -1) free(pIndex2UniqIndex); + if (!pDesc) free(pCI); + } + return BadAlloc; + } + reply->type = X_Reply; + reply->length = bytes_to_int32(rlength - sizeof(xGenericReply)); + reply->sequenceNumber = client->sequence; + reply->minBounds = pFont->info.ink_minbounds; + reply->maxBounds = pFont->info.ink_maxbounds; + reply->minCharOrByte2 = pFont->info.firstCol; + reply->maxCharOrByte2 = pFont->info.lastCol; + reply->defaultChar = pFont->info.defaultCh; + reply->nFontProps = pFont->info.nprops; + reply->drawDirection = pFont->info.drawDirection; + reply->minByte1 = pFont->info.firstRow; + reply->maxByte1 = pFont->info.lastRow; + reply->allCharsExist = pFont->info.allExist; + reply->fontAscent = pFont->info.fontAscent; + reply->fontDescent = pFont->info.fontDescent; + reply->nCharInfos = nCharInfos; + reply->nUniqCharInfos = nUniqCharInfos; + reply->shmid = shmid; + reply->shmsegoffset = 0; + if (client->swapped) { + char tmp; + swaps(&reply->sequenceNumber, tmp); + swapl(&reply->length, tmp); + swapCharInfo(&reply->minBounds); + swapCharInfo(&reply->maxBounds); + swaps(&reply->minCharOrByte2, tmp); + swaps(&reply->maxCharOrByte2, tmp); + swaps(&reply->defaultChar, tmp); + swaps(&reply->nFontProps, tmp); + swaps(&reply->fontAscent, tmp); + swaps(&reply->fontDescent, tmp); + swapl(&reply->nCharInfos, tmp); + swapl(&reply->nUniqCharInfos, tmp); + swapl(&reply->shmid, tmp); + swapl(&reply->shmsegoffset, tmp); + } + p = (char*) &reply[1]; + { + FontPropPtr pFP; + xFontProp* prFP; + int i; + for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) p; + i < nfontprops; + i++, pFP++, prFP++) { + prFP->name = pFP->name; + prFP->value = pFP->value; + if (client->swapped) { + char tmp; + swapl(&prFP->name, tmp); + swapl(&prFP->value, tmp); + } + } + p = (char*) prFP; + } + if (nCharInfos > 0 && shmid == -1) { + xCharInfo* pci; + CARD16* ps; + int i, j; + pci = (xCharInfo*) p; + for (i = 0; i < nUniqCharInfos; i++, pci++) { + *pci = pCI[pUniqIndex2Index[i]]; + if (client->swapped) + swapCharInfo(pci); + } + ps = (CARD16*) pci; + for (j = 0; j < nCharInfos; j++, ps++) { + *ps = pIndex2UniqIndex[j]; + if (client->swapped) { + char tmp; + swaps(ps, tmp); + } + } + } + WriteToClient(client, rlength, (char *)reply); + free(reply); + if (nCharInfos > 0) { + if (shmid == -1) free(pIndex2UniqIndex); + if (!pDesc) free(pCI); + } + return Success; + } +} + +static int +ProcXF86BigfontDispatch( + ClientPtr client) +{ + REQUEST(xReq); + + switch (stuff->data) { + case X_XF86BigfontQueryVersion: + return ProcXF86BigfontQueryVersion(client); + case X_XF86BigfontQueryFont: + return ProcXF86BigfontQueryFont(client); + default: + return BadRequest; + } +} + +static int +SProcXF86BigfontQueryVersion( + ClientPtr client) +{ + REQUEST(xXF86BigfontQueryVersionReq); + char tmp; + + swaps(&stuff->length, tmp); + return ProcXF86BigfontQueryVersion(client); +} + +static int +SProcXF86BigfontQueryFont( + ClientPtr client) +{ + REQUEST(xXF86BigfontQueryFontReq); + char tmp; + + swaps(&stuff->length, tmp); + REQUEST_SIZE_MATCH(xXF86BigfontQueryFontReq); + swapl(&stuff->id, tmp); + return ProcXF86BigfontQueryFont(client); +} + +static int +SProcXF86BigfontDispatch( + ClientPtr client) +{ + REQUEST(xReq); + + switch (stuff->data) { + case X_XF86BigfontQueryVersion: + return SProcXF86BigfontQueryVersion(client); + case X_XF86BigfontQueryFont: + return SProcXF86BigfontQueryFont(client); + default: + return BadRequest; + } +} diff --git a/xorg-server/configure.ac b/xorg-server/configure.ac index a5967ad03..1ceffe7cb 100644 --- a/xorg-server/configure.ac +++ b/xorg-server/configure.ac @@ -2224,7 +2224,6 @@ hw/xfree86/os-support/bus/Makefile hw/xfree86/os-support/hurd/Makefile hw/xfree86/os-support/misc/Makefile hw/xfree86/os-support/linux/Makefile -hw/xfree86/os-support/sco/Makefile hw/xfree86/os-support/solaris/Makefile hw/xfree86/parser/Makefile hw/xfree86/ramdac/Makefile diff --git a/xorg-server/dix/dixfonts.c b/xorg-server/dix/dixfonts.c index e249e6f55..d8f15290b 100644 --- a/xorg-server/dix/dixfonts.c +++ b/xorg-server/dix/dixfonts.c @@ -1,2084 +1,2084 @@ -/************************************************************************
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-************************************************************************/
-/* The panoramix components contained the following notice */
-/*
-Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts.
-
-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.
-
-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
-DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING,
-BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation
-shall not be used in advertising or otherwise to promote the sale, use or other
-dealings in this Software without prior written authorization from Digital
-Equipment Corporation.
-
-******************************************************************/
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include "scrnintstr.h"
-#include "resource.h"
-#include "dixstruct.h"
-#include "cursorstr.h"
-#include "misc.h"
-#include "opaque.h"
-#include "dixfontstr.h"
-#include "closestr.h"
-#include "dixfont.h"
-#include "xace.h"
-
-#ifdef DEBUG
-#include <stdio.h>
-#endif
-
-#ifdef XF86BIGFONT
-#include "xf86bigfontsrv.h"
-#endif
-
-#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics
-
-extern pointer fosNaturalParams;
-extern FontPtr defaultFont;
-
-static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0;
-static int num_fpes = 0;
-static FPEFunctions *fpe_functions = (FPEFunctions *) 0;
-static int num_fpe_types = 0;
-
-static unsigned char *font_path_string;
-
-static int num_slept_fpes = 0;
-static int size_slept_fpes = 0;
-static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0;
-static FontPatternCachePtr patternCache;
-
-static int
-FontToXError(int err)
-{
- switch (err) {
- case Successful:
- return Success;
- case AllocError:
- return BadAlloc;
- case BadFontName:
- return BadName;
- case BadFontPath:
- case BadFontFormat: /* is there something better? */
- case BadCharRange:
- return BadValue;
- default:
- return err;
- }
-}
-
-static int
-LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size,
- unsigned char *data)
-{
- if (fpe_functions[pfont->fpe->type].load_glyphs)
- return (*fpe_functions[pfont->fpe->type].load_glyphs)
- (client, pfont, 0, nchars, item_size, data);
- else
- return Successful;
-}
-
-/*
- * adding RT_FONT prevents conflict with default cursor font
- */
-Bool
-SetDefaultFont(char *defaultfontname)
-{
- int err;
- FontPtr pf;
- XID fid;
-
- fid = FakeClientID(0);
- err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync,
- (unsigned) strlen(defaultfontname), defaultfontname);
- if (err != Success)
- return FALSE;
- err = dixLookupResourceByType((pointer *)&pf, fid, RT_FONT, serverClient,
- DixReadAccess);
- if (err != Success)
- return FALSE;
- defaultFont = pf;
- return TRUE;
-}
-
-/*
- * note that the font wakeup queue is not refcounted. this is because
- * an fpe needs to be added when it's inited, and removed when it's finally
- * freed, in order to handle any data that isn't requested, like FS events.
- *
- * since the only thing that should call these routines is the renderer's
- * init_fpe() and free_fpe(), there shouldn't be any problem in using
- * freed data.
- */
-void
-QueueFontWakeup(FontPathElementPtr fpe)
-{
- int i;
- FontPathElementPtr *new;
-
- for (i = 0; i < num_slept_fpes; i++) {
- if (slept_fpes[i] == fpe) {
- return;
- }
- }
- if (num_slept_fpes == size_slept_fpes) {
- new = (FontPathElementPtr *)
- realloc(slept_fpes,
- sizeof(FontPathElementPtr) * (size_slept_fpes + 4));
- if (!new)
- return;
- slept_fpes = new;
- size_slept_fpes += 4;
- }
- slept_fpes[num_slept_fpes] = fpe;
- num_slept_fpes++;
-}
-
-void
-RemoveFontWakeup(FontPathElementPtr fpe)
-{
- int i,
- j;
-
- for (i = 0; i < num_slept_fpes; i++) {
- if (slept_fpes[i] == fpe) {
- for (j = i; j < num_slept_fpes; j++) {
- slept_fpes[j] = slept_fpes[j + 1];
- }
- num_slept_fpes--;
- return;
- }
- }
-}
-
-void
-FontWakeup(pointer data, int count, pointer LastSelectMask)
-{
- int i;
- FontPathElementPtr fpe;
-
- if (count < 0)
- return;
- /* wake up any fpe's that may be waiting for information */
- for (i = 0; i < num_slept_fpes; i++) {
- fpe = slept_fpes[i];
- (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask);
- }
-}
-
-/* XXX -- these two funcs may want to be broken into macros */
-static void
-UseFPE(FontPathElementPtr fpe)
-{
- fpe->refcount++;
-}
-
-static void
-FreeFPE (FontPathElementPtr fpe)
-{
- fpe->refcount--;
- if (fpe->refcount == 0) {
- (*fpe_functions[fpe->type].free_fpe) (fpe);
- free(fpe->name);
- free(fpe);
- }
-}
-
-static Bool
-doOpenFont(ClientPtr client, OFclosurePtr c)
-{
- FontPtr pfont = NullFont;
- FontPathElementPtr fpe = NULL;
- ScreenPtr pScr;
- int err = Successful;
- int i;
- char *alias,
- *newname;
- int newlen;
- int aliascount = 20;
- /*
- * Decide at runtime what FontFormat to use.
- */
- Mask FontFormat =
-
- ((screenInfo.imageByteOrder == LSBFirst) ?
- BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) |
-
- ((screenInfo.bitmapBitOrder == LSBFirst) ?
- BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) |
-
- BitmapFormatImageRectMin |
-
-#if GLYPHPADBYTES == 1
- BitmapFormatScanlinePad8 |
-#endif
-
-#if GLYPHPADBYTES == 2
- BitmapFormatScanlinePad16 |
-#endif
-
-#if GLYPHPADBYTES == 4
- BitmapFormatScanlinePad32 |
-#endif
-
-#if GLYPHPADBYTES == 8
- BitmapFormatScanlinePad64 |
-#endif
-
- BitmapFormatScanlineUnit8;
-
- if (client->clientGone)
- {
- if (c->current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current_fpe];
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
- err = Successful;
- goto bail;
- }
- while (c->current_fpe < c->num_fpes) {
- fpe = c->fpe_list[c->current_fpe];
- err = (*fpe_functions[fpe->type].open_font)
- ((pointer) client, fpe, c->flags,
- c->fontname, c->fnamelen, FontFormat,
- BitmapFormatMaskByte |
- BitmapFormatMaskBit |
- BitmapFormatMaskImageRectangle |
- BitmapFormatMaskScanLinePad |
- BitmapFormatMaskScanLineUnit,
- c->fontid, &pfont, &alias,
- c->non_cachable_font && c->non_cachable_font->fpe == fpe ?
- c->non_cachable_font :
- (FontPtr)0);
-
- if (err == FontNameAlias && alias) {
- newlen = strlen(alias);
- newname = (char *) realloc(c->fontname, newlen);
- if (!newname) {
- err = AllocError;
- break;
- }
- memmove(newname, alias, newlen);
- c->fontname = newname;
- c->fnamelen = newlen;
- c->current_fpe = 0;
- if (--aliascount <= 0) {
- /* We've tried resolving this alias 20 times, we're
- * probably stuck in an infinite loop of aliases pointing
- * to each other - time to take emergency exit!
- */
- err = BadImplementation;
- break;
- }
- continue;
- }
- if (err == BadFontName) {
- c->current_fpe++;
- continue;
- }
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client, (ClientSleepProcPtr)doOpenFont, c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- break;
- }
-
- if (err != Successful)
- goto bail;
- if (!pfont) {
- err = BadFontName;
- goto bail;
- }
- /* check values for firstCol, lastCol, firstRow, and lastRow */
- if (pfont->info.firstCol > pfont->info.lastCol ||
- pfont->info.firstRow > pfont->info.lastRow ||
- pfont->info.lastCol - pfont->info.firstCol > 255) {
- err = AllocError;
- goto bail;
- }
- if (!pfont->fpe)
- pfont->fpe = fpe;
- pfont->refcnt++;
- if (pfont->refcnt == 1) {
- UseFPE(pfont->fpe);
- for (i = 0; i < screenInfo.numScreens; i++) {
- pScr = screenInfo.screens[i];
- if (pScr->RealizeFont)
- {
- if (!(*pScr->RealizeFont) (pScr, pfont))
- {
- CloseFont (pfont, (Font) 0);
- err = AllocError;
- goto bail;
- }
- }
- }
- }
- if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) {
- err = AllocError;
- goto bail;
- }
- if (patternCache && pfont != c->non_cachable_font)
- CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen,
- pfont);
-bail:
- if (err != Successful && c->client != serverClient) {
- SendErrorToClient(c->client, X_OpenFont, 0,
- c->fontid, FontToXError(err));
- }
- ClientWakeup(c->client);
-xinerama_sleep:
- for (i = 0; i < c->num_fpes; i++) {
- FreeFPE(c->fpe_list[i]);
- }
- free(c->fpe_list);
- free(c->fontname);
- free(c);
- return TRUE;
-}
-
-int
-OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname)
-{
- OFclosurePtr c;
- int i;
- FontPtr cached = (FontPtr)0;
-
-#ifdef FONTDEBUG
- char *f;
- f = malloc(lenfname + 1);
- memmove(f, pfontname, lenfname);
- f[lenfname] = '\0';
- ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f);
- free(f);
-#endif
- if (!lenfname || lenfname > XLFDMAXFONTNAMELEN)
- return BadName;
- if (patternCache)
- {
-
- /*
- ** Check name cache. If we find a cached version of this font that
- ** is cachable, immediately satisfy the request with it. If we find
- ** a cached version of this font that is non-cachable, we do not
- ** satisfy the request with it. Instead, we pass the FontPtr to the
- ** FPE's open_font code (the fontfile FPE in turn passes the
- ** information to the rasterizer; the fserve FPE ignores it).
- **
- ** Presumably, the font is marked non-cachable because the FPE has
- ** put some licensing restrictions on it. If the FPE, using
- ** whatever logic it relies on, determines that it is willing to
- ** share this existing font with the client, then it has the option
- ** to return the FontPtr we passed it as the newly-opened font.
- ** This allows the FPE to exercise its licensing logic without
- ** having to create another instance of a font that already exists.
- */
-
- cached = FindCachedFontPattern(patternCache, pfontname, lenfname);
- if (cached && cached->info.cachable)
- {
- if (!AddResource(fid, RT_FONT, (pointer) cached))
- return BadAlloc;
- cached->refcnt++;
- return Success;
- }
- }
- c = malloc(sizeof(OFclosureRec));
- if (!c)
- return BadAlloc;
- c->fontname = malloc(lenfname);
- c->origFontName = pfontname;
- c->origFontNameLen = lenfname;
- if (!c->fontname) {
- free(c);
- return BadAlloc;
- }
- /*
- * copy the current FPE list, so that if it gets changed by another client
- * while we're blocking, the request still appears atomic
- */
- c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
- if (!c->fpe_list) {
- free(c->fontname);
- free(c);
- return BadAlloc;
- }
- memmove(c->fontname, pfontname, lenfname);
- for (i = 0; i < num_fpes; i++) {
- c->fpe_list[i] = font_path_elements[i];
- UseFPE(c->fpe_list[i]);
- }
- c->client = client;
- c->fontid = fid;
- c->current_fpe = 0;
- c->num_fpes = num_fpes;
- c->fnamelen = lenfname;
- c->flags = flags;
- c->non_cachable_font = cached;
-
- (void) doOpenFont(client, c);
- return Success;
-}
-
-/**
- * Decrement font's ref count, and free storage if ref count equals zero
- *
- * \param value must conform to DeleteType
- */
-int
-CloseFont(pointer value, XID fid)
-{
- int nscr;
- ScreenPtr pscr;
- FontPathElementPtr fpe;
- FontPtr pfont = (FontPtr)value;
-
- if (pfont == NullFont)
- return Success;
- if (--pfont->refcnt == 0) {
- if (patternCache)
- RemoveCachedFontPattern (patternCache, pfont);
- /*
- * since the last reference is gone, ask each screen to free any
- * storage it may have allocated locally for it.
- */
- for (nscr = 0; nscr < screenInfo.numScreens; nscr++) {
- pscr = screenInfo.screens[nscr];
- if (pscr->UnrealizeFont)
- (*pscr->UnrealizeFont) (pscr, pfont);
- }
- if (pfont == defaultFont)
- defaultFont = NULL;
-#ifdef XF86BIGFONT
- XF86BigfontFreeFontShm(pfont);
-#endif
- fpe = pfont->fpe;
- (*fpe_functions[fpe->type].close_font) (fpe, pfont);
- FreeFPE(fpe);
- }
- return Success;
-}
-
-
-/***====================================================================***/
-
-/**
- * Sets up pReply as the correct QueryFontReply for pFont with the first
- * nProtoCCIStructs char infos.
- *
- * \param pReply caller must allocate this storage
- */
-void
-QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs)
-{
- FontPropPtr pFP;
- int r,
- c,
- i;
- xFontProp *prFP;
- xCharInfo *prCI;
- xCharInfo *charInfos[256];
- unsigned char chars[512];
- int ninfos;
- unsigned long ncols;
- unsigned long count;
-
- /* pr->length set in dispatch */
- pReply->minCharOrByte2 = pFont->info.firstCol;
- pReply->defaultChar = pFont->info.defaultCh;
- pReply->maxCharOrByte2 = pFont->info.lastCol;
- pReply->drawDirection = pFont->info.drawDirection;
- pReply->allCharsExist = pFont->info.allExist;
- pReply->minByte1 = pFont->info.firstRow;
- pReply->maxByte1 = pFont->info.lastRow;
- pReply->fontAscent = pFont->info.fontAscent;
- pReply->fontDescent = pFont->info.fontDescent;
-
- pReply->minBounds = pFont->info.ink_minbounds;
- pReply->maxBounds = pFont->info.ink_maxbounds;
-
- pReply->nFontProps = pFont->info.nprops;
- pReply->nCharInfos = nProtoCCIStructs;
-
- for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) (&pReply[1]);
- i < pFont->info.nprops;
- i++, pFP++, prFP++) {
- prFP->name = pFP->name;
- prFP->value = pFP->value;
- }
-
- ninfos = 0;
- ncols = (unsigned long) (pFont->info.lastCol - pFont->info.firstCol + 1);
- prCI = (xCharInfo *) (prFP);
- for (r = pFont->info.firstRow;
- ninfos < nProtoCCIStructs && r <= (int)pFont->info.lastRow;
- r++) {
- i = 0;
- for (c = pFont->info.firstCol; c <= (int)pFont->info.lastCol; c++) {
- chars[i++] = r;
- chars[i++] = c;
- }
- (*pFont->get_metrics) (pFont, ncols, chars,
- TwoD16Bit, &count, charInfos);
- i = 0;
- for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) {
- *prCI = *charInfos[i];
- prCI++;
- ninfos++;
- }
- }
- return;
-}
-
-static Bool
-doListFontsAndAliases(ClientPtr client, LFclosurePtr c)
-{
- FontPathElementPtr fpe;
- int err = Successful;
- FontNamesPtr names = NULL;
- char *name, *resolved=NULL;
- int namelen, resolvedlen;
- int nnames;
- int stringLens;
- int i;
- xListFontsReply reply;
- char *bufptr;
- char *bufferStart;
- int aliascount = 0;
-
- if (client->clientGone)
- {
- if (c->current.current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current.current_fpe];
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
- err = Successful;
- goto bail;
- }
-
- if (!c->current.patlen)
- goto finish;
-
- while (c->current.current_fpe < c->num_fpes) {
- fpe = c->fpe_list[c->current.current_fpe];
- err = Successful;
-
- if (!fpe_functions[fpe->type].start_list_fonts_and_aliases)
- {
- /* This FPE doesn't support/require list_fonts_and_aliases */
-
- err = (*fpe_functions[fpe->type].list_fonts)
- ((pointer) c->client, fpe, c->current.pattern,
- c->current.patlen, c->current.max_names - c->names->nnames,
- c->names);
-
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsAndAliases,
- c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
-
- err = BadFontName;
- }
- else
- {
- /* Start of list_fonts_and_aliases functionality. Modeled
- after list_fonts_with_info in that it resolves aliases,
- except that the information collected from FPEs is just
- names, not font info. Each list_next_font_or_alias()
- returns either a name into name/namelen or an alias into
- name/namelen and its target name into resolved/resolvedlen.
- The code at this level then resolves the alias by polling
- the FPEs. */
-
- if (!c->current.list_started) {
- err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases)
- ((pointer) c->client, fpe, c->current.pattern,
- c->current.patlen, c->current.max_names - c->names->nnames,
- &c->current.private);
- if (err == Suspended) {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsAndAliases,
- c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- if (err == Successful)
- c->current.list_started = TRUE;
- }
- if (err == Successful) {
- char *tmpname;
- name = 0;
- err = (*fpe_functions[fpe->type].list_next_font_or_alias)
- ((pointer) c->client, fpe, &name, &namelen, &tmpname,
- &resolvedlen, c->current.private);
- if (err == Suspended) {
- if (ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsAndAliases,
- c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- if (err == FontNameAlias) {
- free(resolved);
- resolved = malloc(resolvedlen + 1);
- if (resolved)
- memmove(resolved, tmpname, resolvedlen + 1);
- }
- }
-
- if (err == Successful)
- {
- if (c->haveSaved)
- {
- if (c->savedName)
- (void)AddFontNamesName(c->names, c->savedName,
- c->savedNameLen);
- }
- else
- (void)AddFontNamesName(c->names, name, namelen);
- }
-
- /*
- * When we get an alias back, save our state and reset back to
- * the start of the FPE looking for the specified name. As
- * soon as a real font is found for the alias, pop back to the
- * old state
- */
- else if (err == FontNameAlias) {
- char tmp_pattern[XLFDMAXFONTNAMELEN];
- /*
- * when an alias recurses, we need to give
- * the last FPE a chance to clean up; so we call
- * it again, and assume that the error returned
- * is BadFontName, indicating the alias resolution
- * is complete.
- */
- memmove(tmp_pattern, resolved, resolvedlen);
- if (c->haveSaved)
- {
- char *tmpname;
- int tmpnamelen;
-
- tmpname = 0;
- (void) (*fpe_functions[fpe->type].list_next_font_or_alias)
- ((pointer) c->client, fpe, &tmpname, &tmpnamelen,
- &tmpname, &tmpnamelen, c->current.private);
- if (--aliascount <= 0)
- {
- err = BadFontName;
- goto ContBadFontName;
- }
- }
- else
- {
- c->saved = c->current;
- c->haveSaved = TRUE;
- free(c->savedName);
- c->savedName = malloc(namelen + 1);
- if (c->savedName)
- memmove(c->savedName, name, namelen + 1);
- c->savedNameLen = namelen;
- aliascount = 20;
- }
- memmove(c->current.pattern, tmp_pattern, resolvedlen);
- c->current.patlen = resolvedlen;
- c->current.max_names = c->names->nnames + 1;
- c->current.current_fpe = -1;
- c->current.private = 0;
- err = BadFontName;
- }
- }
- /*
- * At the end of this FPE, step to the next. If we've finished
- * processing an alias, pop state back. If we've collected enough
- * font names, quit.
- */
- if (err == BadFontName) {
- ContBadFontName: ;
- c->current.list_started = FALSE;
- c->current.current_fpe++;
- err = Successful;
- if (c->haveSaved)
- {
- if (c->names->nnames == c->current.max_names ||
- c->current.current_fpe == c->num_fpes) {
- c->haveSaved = FALSE;
- c->current = c->saved;
- /* Give the saved namelist a chance to clean itself up */
- continue;
- }
- }
- if (c->names->nnames == c->current.max_names)
- break;
- }
- }
-
- /*
- * send the reply
- */
- if (err != Successful) {
- SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err));
- goto bail;
- }
-
-finish:
-
- names = c->names;
- nnames = names->nnames;
- client = c->client;
- stringLens = 0;
- for (i = 0; i < nnames; i++)
- stringLens += (names->length[i] <= 255) ? names->length[i] : 0;
-
- memset(&reply, 0, sizeof(xListFontsReply));
- reply.type = X_Reply;
- reply.length = bytes_to_int32(stringLens + nnames);
- reply.nFonts = nnames;
- reply.sequenceNumber = client->sequence;
-
- bufptr = bufferStart = malloc(reply.length << 2);
-
- if (!bufptr && reply.length) {
- SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc);
- goto bail;
- }
- /*
- * since WriteToClient long word aligns things, copy to temp buffer and
- * write all at once
- */
- for (i = 0; i < nnames; i++) {
- if (names->length[i] > 255)
- reply.nFonts--;
- else
- {
- *bufptr++ = names->length[i];
- memmove( bufptr, names->names[i], names->length[i]);
- bufptr += names->length[i];
- }
- }
- nnames = reply.nFonts;
- reply.length = bytes_to_int32(stringLens + nnames);
- client->pSwapReplyFunc = ReplySwapVector[X_ListFonts];
- WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply);
- (void) WriteToClient(client, stringLens + nnames, bufferStart);
- free(bufferStart);
-
-bail:
- ClientWakeup(client);
-xinerama_sleep:
- for (i = 0; i < c->num_fpes; i++)
- FreeFPE(c->fpe_list[i]);
- free(c->fpe_list);
- free(c->savedName);
- FreeFontNames(names);
- free(c);
- free(resolved);
- return TRUE;
-}
-
-int
-ListFonts(ClientPtr client, unsigned char *pattern, unsigned length,
- unsigned max_names)
-{
- int i;
- LFclosurePtr c;
-
- /*
- * The right error to return here would be BadName, however the
- * specification does not allow for a Name error on this request.
- * Perhaps a better solution would be to return a nil list, i.e.
- * a list containing zero fontnames.
- */
- if (length > XLFDMAXFONTNAMELEN)
- return BadAlloc;
-
- i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess);
- if (i != Success)
- return i;
-
- if (!(c = malloc(sizeof *c)))
- return BadAlloc;
- c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
- if (!c->fpe_list) {
- free(c);
- return BadAlloc;
- }
- c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100);
- if (!c->names)
- {
- free(c->fpe_list);
- free(c);
- return BadAlloc;
- }
- memmove( c->current.pattern, pattern, length);
- for (i = 0; i < num_fpes; i++) {
- c->fpe_list[i] = font_path_elements[i];
- UseFPE(c->fpe_list[i]);
- }
- c->client = client;
- c->num_fpes = num_fpes;
- c->current.patlen = length;
- c->current.current_fpe = 0;
- c->current.max_names = max_names;
- c->current.list_started = FALSE;
- c->current.private = 0;
- c->haveSaved = FALSE;
- c->savedName = 0;
- doListFontsAndAliases(client, c);
- return Success;
-}
-
-int
-doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c)
-{
- FontPathElementPtr fpe;
- int err = Successful;
- char *name;
- int namelen;
- int numFonts;
- FontInfoRec fontInfo,
- *pFontInfo;
- xListFontsWithInfoReply *reply;
- int length;
- xFontProp *pFP;
- int i;
- int aliascount = 0;
- xListFontsWithInfoReply finalReply;
-
- if (client->clientGone)
- {
- if (c->current.current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current.current_fpe];
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
- err = Successful;
- goto bail;
- }
- client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo];
- if (!c->current.patlen)
- goto finish;
- while (c->current.current_fpe < c->num_fpes)
- {
- fpe = c->fpe_list[c->current.current_fpe];
- err = Successful;
- if (!c->current.list_started)
- {
- err = (*fpe_functions[fpe->type].start_list_fonts_with_info)
- (client, fpe, c->current.pattern, c->current.patlen,
- c->current.max_names, &c->current.private);
- if (err == Suspended)
- {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsWithInfo, c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- if (err == Successful)
- c->current.list_started = TRUE;
- }
- if (err == Successful)
- {
- name = 0;
- pFontInfo = &fontInfo;
- err = (*fpe_functions[fpe->type].list_next_font_with_info)
- (client, fpe, &name, &namelen, &pFontInfo,
- &numFonts, c->current.private);
- if (err == Suspended)
- {
- if (!ClientIsAsleep(client))
- ClientSleep(client,
- (ClientSleepProcPtr)doListFontsWithInfo, c);
- else
- goto xinerama_sleep;
- return TRUE;
- }
- }
- /*
- * When we get an alias back, save our state and reset back to the
- * start of the FPE looking for the specified name. As soon as a real
- * font is found for the alias, pop back to the old state
- */
- if (err == FontNameAlias)
- {
- /*
- * when an alias recurses, we need to give
- * the last FPE a chance to clean up; so we call
- * it again, and assume that the error returned
- * is BadFontName, indicating the alias resolution
- * is complete.
- */
- if (c->haveSaved)
- {
- char *tmpname;
- int tmpnamelen;
- FontInfoPtr tmpFontInfo;
-
- tmpname = 0;
- tmpFontInfo = &fontInfo;
- (void) (*fpe_functions[fpe->type].list_next_font_with_info)
- (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo,
- &numFonts, c->current.private);
- if (--aliascount <= 0)
- {
- err = BadFontName;
- goto ContBadFontName;
- }
- }
- else
- {
- c->saved = c->current;
- c->haveSaved = TRUE;
- c->savedNumFonts = numFonts;
- free(c->savedName);
- c->savedName = malloc(namelen + 1);
- if (c->savedName)
- memmove(c->savedName, name, namelen + 1);
- aliascount = 20;
- }
- memmove(c->current.pattern, name, namelen);
- c->current.patlen = namelen;
- c->current.max_names = 1;
- c->current.current_fpe = 0;
- c->current.private = 0;
- c->current.list_started = FALSE;
- }
- /*
- * At the end of this FPE, step to the next. If we've finished
- * processing an alias, pop state back. If we've sent enough font
- * names, quit. Always wait for BadFontName to let the FPE
- * have a chance to clean up.
- */
- else if (err == BadFontName)
- {
- ContBadFontName: ;
- c->current.list_started = FALSE;
- c->current.current_fpe++;
- err = Successful;
- if (c->haveSaved)
- {
- if (c->current.max_names == 0 ||
- c->current.current_fpe == c->num_fpes)
- {
- c->haveSaved = FALSE;
- c->saved.max_names -= (1 - c->current.max_names);
- c->current = c->saved;
- }
- }
- else if (c->current.max_names == 0)
- break;
- }
- else if (err == Successful)
- {
- length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp);
- reply = c->reply;
- if (c->length < length)
- {
- reply = (xListFontsWithInfoReply *) realloc(c->reply, length);
- if (!reply)
- {
- err = AllocError;
- break;
- }
- memset((char*)reply + c->length, 0, length - c->length);
- c->reply = reply;
- c->length = length;
- }
- if (c->haveSaved)
- {
- numFonts = c->savedNumFonts;
- name = c->savedName;
- namelen = strlen(name);
- }
- reply->type = X_Reply;
- reply->length = bytes_to_int32(sizeof *reply - sizeof(xGenericReply) +
- pFontInfo->nprops * sizeof(xFontProp) +
- namelen);
- reply->sequenceNumber = client->sequence;
- reply->nameLength = namelen;
- reply->minBounds = pFontInfo->ink_minbounds;
- reply->maxBounds = pFontInfo->ink_maxbounds;
- reply->minCharOrByte2 = pFontInfo->firstCol;
- reply->maxCharOrByte2 = pFontInfo->lastCol;
- reply->defaultChar = pFontInfo->defaultCh;
- reply->nFontProps = pFontInfo->nprops;
- reply->drawDirection = pFontInfo->drawDirection;
- reply->minByte1 = pFontInfo->firstRow;
- reply->maxByte1 = pFontInfo->lastRow;
- reply->allCharsExist = pFontInfo->allExist;
- reply->fontAscent = pFontInfo->fontAscent;
- reply->fontDescent = pFontInfo->fontDescent;
- reply->nReplies = numFonts;
- pFP = (xFontProp *) (reply + 1);
- for (i = 0; i < pFontInfo->nprops; i++)
- {
- pFP->name = pFontInfo->props[i].name;
- pFP->value = pFontInfo->props[i].value;
- pFP++;
- }
- WriteSwappedDataToClient(client, length, reply);
- (void) WriteToClient(client, namelen, name);
- if (pFontInfo == &fontInfo)
- {
- free(fontInfo.props);
- free(fontInfo.isStringProp);
- }
- --c->current.max_names;
- }
- }
-finish:
- length = sizeof(xListFontsWithInfoReply);
- memset((char *) &finalReply, 0, sizeof(xListFontsWithInfoReply));
- finalReply.type = X_Reply;
- finalReply.sequenceNumber = client->sequence;
- finalReply.length = bytes_to_int32(sizeof(xListFontsWithInfoReply)
- - sizeof(xGenericReply));
- WriteSwappedDataToClient(client, length, &finalReply);
-bail:
- ClientWakeup(client);
-xinerama_sleep:
- for (i = 0; i < c->num_fpes; i++)
- FreeFPE(c->fpe_list[i]);
- free(c->reply);
- free(c->fpe_list);
- free(c->savedName);
- free(c);
- return TRUE;
-}
-
-int
-StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern,
- int max_names)
-{
- int i;
- LFWIclosurePtr c;
-
- /*
- * The right error to return here would be BadName, however the
- * specification does not allow for a Name error on this request.
- * Perhaps a better solution would be to return a nil list, i.e.
- * a list containing zero fontnames.
- */
- if (length > XLFDMAXFONTNAMELEN)
- return BadAlloc;
-
- i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess);
- if (i != Success)
- return i;
-
- if (!(c = malloc(sizeof *c)))
- goto badAlloc;
- c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes);
- if (!c->fpe_list)
- {
- free(c);
- goto badAlloc;
- }
- memmove(c->current.pattern, pattern, length);
- for (i = 0; i < num_fpes; i++)
- {
- c->fpe_list[i] = font_path_elements[i];
- UseFPE(c->fpe_list[i]);
- }
- c->client = client;
- c->num_fpes = num_fpes;
- c->reply = 0;
- c->length = 0;
- c->current.patlen = length;
- c->current.current_fpe = 0;
- c->current.max_names = max_names;
- c->current.list_started = FALSE;
- c->current.private = 0;
- c->savedNumFonts = 0;
- c->haveSaved = FALSE;
- c->savedName = 0;
- doListFontsWithInfo(client, c);
- return Success;
-badAlloc:
- return BadAlloc;
-}
-
-#define TextEltHeader 2
-#define FontShiftSize 5
-static ChangeGCVal clearGC[] = { { .ptr = NullPixmap } };
-#define clearGCmask (GCClipMask)
-
-int
-doPolyText(ClientPtr client, PTclosurePtr c)
-{
- FontPtr pFont = c->pGC->font, oldpFont;
- int err = Success, lgerr; /* err is in X error, not font error, space */
- enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT;
- FontPathElementPtr fpe;
- GC *origGC = NULL;
- int itemSize = c->reqType == X_PolyText8 ? 1 : 2;
-
- if (client->clientGone)
- {
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
-
- if (ClientIsAsleep(client))
- {
- /* Client has died, but we cannot bail out right now. We
- need to clean up after the work we did when going to
- sleep. Setting the drawable pointer to 0 makes this
- happen without any attempts to render or perform other
- unnecessary activities. */
- c->pDraw = (DrawablePtr)0;
- }
- else
- {
- err = Success;
- goto bail;
- }
- }
-
- /* Make sure our drawable hasn't disappeared while we slept. */
- if (ClientIsAsleep(client) && c->pDraw)
- {
- DrawablePtr pDraw;
- dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
- if (c->pDraw != pDraw) {
- /* Our drawable has disappeared. Treat like client died... ask
- the FPE code to clean up after client and avoid further
- rendering while we clean up after ourself. */
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- c->pDraw = (DrawablePtr)0;
- }
- }
-
- client_state = ClientIsAsleep(client) ? SLEEPING : NEVER_SLEPT;
-
- while (c->endReq - c->pElt > TextEltHeader)
- {
- if (*c->pElt == FontChange)
- {
- Font fid;
- if (c->endReq - c->pElt < FontShiftSize)
- {
- err = BadLength;
- goto bail;
- }
-
- oldpFont = pFont;
-
- fid = ((Font)*(c->pElt+4)) /* big-endian */
- | ((Font)*(c->pElt+3)) << 8
- | ((Font)*(c->pElt+2)) << 16
- | ((Font)*(c->pElt+1)) << 24;
- err = dixLookupResourceByType((pointer *)&pFont, fid, RT_FONT,
- client, DixUseAccess);
- if (err != Success)
- {
- /* restore pFont for step 4 (described below) */
- pFont = oldpFont;
-
- /* If we're in START_SLEEP mode, the following step
- shortens the request... in the unlikely event that
- the fid somehow becomes valid before we come through
- again to actually execute the polytext, which would
- then mess up our refcounting scheme badly. */
- c->err = err;
- c->endReq = c->pElt;
-
- goto bail;
- }
-
- /* Step 3 (described below) on our new font */
- if (client_state == START_SLEEP)
- pFont->refcnt++;
- else
- {
- if (pFont != c->pGC->font && c->pDraw)
- {
- ChangeGCVal val;
- val.ptr = pFont;
- ChangeGC(NullClient, c->pGC, GCFont, &val);
- ValidateGC(c->pDraw, c->pGC);
- }
-
- /* Undo the refcnt++ we performed when going to sleep */
- if (client_state == SLEEPING)
- (void)CloseFont(c->pGC->font, (Font)0);
- }
- c->pElt += FontShiftSize;
- }
- else /* print a string */
- {
- unsigned char *pNextElt;
- pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize;
- if ( pNextElt > c->endReq)
- {
- err = BadLength;
- goto bail;
- }
- if (client_state == START_SLEEP)
- {
- c->pElt = pNextElt;
- continue;
- }
- if (c->pDraw)
- {
- lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, itemSize,
- c->pElt + TextEltHeader);
- }
- else lgerr = Successful;
-
- if (lgerr == Suspended)
- {
- if (!ClientIsAsleep(client)) {
- int len;
- GC *pGC;
- PTclosurePtr new_closure;
-
- /* We're putting the client to sleep. We need to do a few things
- to ensure successful and atomic-appearing execution of the
- remainder of the request. First, copy the remainder of the
- request into a safe malloc'd area. Second, create a scratch GC
- to use for the remainder of the request. Third, mark all fonts
- referenced in the remainder of the request to prevent their
- deallocation. Fourth, make the original GC look like the
- request has completed... set its font to the final font value
- from this request. These GC manipulations are for the unlikely
- (but possible) event that some other client is using the GC.
- Steps 3 and 4 are performed by running this procedure through
- the remainder of the request in a special no-render mode
- indicated by client_state = START_SLEEP. */
-
- /* Step 1 */
- /* Allocate a malloc'd closure structure to replace
- the local one we were passed */
- new_closure = malloc(sizeof(PTclosureRec));
- if (!new_closure)
- {
- err = BadAlloc;
- goto bail;
- }
- *new_closure = *c;
- c = new_closure;
-
- len = c->endReq - c->pElt;
- c->data = malloc(len);
- if (!c->data)
- {
- free(c);
- err = BadAlloc;
- goto bail;
- }
- memmove(c->data, c->pElt, len);
- c->pElt = c->data;
- c->endReq = c->pElt + len;
-
- /* Step 2 */
-
- pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
- if (!pGC)
- {
- free(c->data);
- free(c);
- err = BadAlloc;
- goto bail;
- }
- if ((err = CopyGC(c->pGC, pGC, GCFunction |
- GCPlaneMask | GCForeground |
- GCBackground | GCFillStyle |
- GCTile | GCStipple |
- GCTileStipXOrigin |
- GCTileStipYOrigin | GCFont |
- GCSubwindowMode | GCClipXOrigin |
- GCClipYOrigin | GCClipMask)) !=
- Success)
- {
- FreeScratchGC(pGC);
- free(c->data);
- free(c);
- err = BadAlloc;
- goto bail;
- }
- origGC = c->pGC;
- c->pGC = pGC;
- ValidateGC(c->pDraw, c->pGC);
-
- ClientSleep(client, (ClientSleepProcPtr)doPolyText, c);
-
- /* Set up to perform steps 3 and 4 */
- client_state = START_SLEEP;
- continue; /* on to steps 3 and 4 */
- }
- else
- goto xinerama_sleep;
- return TRUE;
- }
- else if (lgerr != Successful)
- {
- err = FontToXError(lgerr);
- goto bail;
- }
- if (c->pDraw)
- {
- c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */
- if (c->reqType == X_PolyText8)
- c->xorg = (* c->pGC->ops->PolyText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
- *c->pElt, (char *) (c->pElt + TextEltHeader));
- else
- c->xorg = (* c->pGC->ops->PolyText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
- *c->pElt, (unsigned short *) (c->pElt + TextEltHeader));
- }
- c->pElt = pNextElt;
- }
- }
-
-bail:
-
- if (client_state == START_SLEEP)
- {
- /* Step 4 */
- if (pFont != origGC->font)
- {
- ChangeGCVal val;
- val.ptr = pFont;
- ChangeGC(NullClient, origGC, GCFont, &val);
- ValidateGC(c->pDraw, origGC);
- }
-
- /* restore pElt pointer for execution of remainder of the request */
- c->pElt = c->data;
- return TRUE;
- }
-
- if (c->err != Success) err = c->err;
- if (err != Success && c->client != serverClient) {
-#ifdef PANORAMIX
- if (noPanoramiXExtension || !c->pGC->pScreen->myNum)
-#endif
- SendErrorToClient(c->client, c->reqType, 0, 0, err);
- }
- if (ClientIsAsleep(client))
- {
- ClientWakeup(c->client);
-xinerama_sleep:
- ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
-
- /* Unreference the font from the scratch GC */
- CloseFont(c->pGC->font, (Font)0);
- c->pGC->font = NullFont;
-
- FreeScratchGC(c->pGC);
- free(c->data);
- free(c);
- }
- return TRUE;
-}
-
-int
-PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt,
- unsigned char *endReq, int xorg, int yorg, int reqType, XID did)
-{
- PTclosureRec local_closure;
-
- local_closure.pElt = pElt;
- local_closure.endReq = endReq;
- local_closure.client = client;
- local_closure.pDraw = pDraw;
- local_closure.xorg = xorg;
- local_closure.yorg = yorg;
- local_closure.reqType = reqType;
- local_closure.pGC = pGC;
- local_closure.did = did;
- local_closure.err = Success;
-
- (void) doPolyText(client, &local_closure);
- return Success;
-}
-
-
-#undef TextEltHeader
-#undef FontShiftSize
-
-int
-doImageText(ClientPtr client, ITclosurePtr c)
-{
- int err = Success, lgerr; /* err is in X error, not font error, space */
- FontPathElementPtr fpe;
- int itemSize = c->reqType == X_ImageText8 ? 1 : 2;
-
- if (client->clientGone)
- {
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- err = Success;
- goto bail;
- }
-
- /* Make sure our drawable hasn't disappeared while we slept. */
- if (ClientIsAsleep(client) && c->pDraw)
- {
- DrawablePtr pDraw;
- dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess);
- if (c->pDraw != pDraw) {
- /* Our drawable has disappeared. Treat like client died... ask
- the FPE code to clean up after client. */
- fpe = c->pGC->font->fpe;
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- err = Success;
- goto bail;
- }
- }
-
- lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data);
- if (lgerr == Suspended)
- {
- if (!ClientIsAsleep(client)) {
- GC *pGC;
- unsigned char *data;
- ITclosurePtr new_closure;
-
- /* We're putting the client to sleep. We need to
- save some state. Similar problem to that handled
- in doPolyText, but much simpler because the
- request structure is much simpler. */
-
- new_closure = malloc(sizeof(ITclosureRec));
- if (!new_closure)
- {
- err = BadAlloc;
- goto bail;
- }
- *new_closure = *c;
- c = new_closure;
-
- data = malloc(c->nChars * itemSize);
- if (!data)
- {
- free(c);
- err = BadAlloc;
- goto bail;
- }
- memmove(data, c->data, c->nChars * itemSize);
- c->data = data;
-
- pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen);
- if (!pGC)
- {
- free(c->data);
- free(c);
- err = BadAlloc;
- goto bail;
- }
- if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask |
- GCForeground | GCBackground | GCFillStyle |
- GCTile | GCStipple | GCTileStipXOrigin |
- GCTileStipYOrigin | GCFont |
- GCSubwindowMode | GCClipXOrigin |
- GCClipYOrigin | GCClipMask)) != Success)
- {
- FreeScratchGC(pGC);
- free(c->data);
- free(c);
- err = BadAlloc;
- goto bail;
- }
- c->pGC = pGC;
- ValidateGC(c->pDraw, c->pGC);
-
- ClientSleep(client, (ClientSleepProcPtr)doImageText, c);
- }
- else
- goto xinerama_sleep;
- return TRUE;
- }
- else if (lgerr != Successful)
- {
- err = FontToXError(lgerr);
- goto bail;
- }
- if (c->pDraw)
- {
- if (c->reqType == X_ImageText8)
- (* c->pGC->ops->ImageText8)(c->pDraw, c->pGC, c->xorg, c->yorg,
- c->nChars, (char *) c->data);
- else
- (* c->pGC->ops->ImageText16)(c->pDraw, c->pGC, c->xorg, c->yorg,
- c->nChars, (unsigned short *) c->data);
- }
-
-bail:
-
- if (err != Success && c->client != serverClient) {
- SendErrorToClient(c->client, c->reqType, 0, 0, err);
- }
- if (ClientIsAsleep(client))
- {
- ClientWakeup(c->client);
-xinerama_sleep:
- ChangeGC(NullClient, c->pGC, clearGCmask, clearGC);
-
- /* Unreference the font from the scratch GC */
- CloseFont(c->pGC->font, (Font)0);
- c->pGC->font = NullFont;
-
- FreeScratchGC(c->pGC);
- free(c->data);
- free(c);
- }
- return TRUE;
-}
-
-int
-ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars,
- unsigned char *data, int xorg, int yorg, int reqType, XID did)
-{
- ITclosureRec local_closure;
-
- local_closure.client = client;
- local_closure.pDraw = pDraw;
- local_closure.pGC = pGC;
- local_closure.nChars = nChars;
- local_closure.data = data;
- local_closure.xorg = xorg;
- local_closure.yorg = yorg;
- local_closure.reqType = reqType;
- local_closure.did = did;
-
- (void) doImageText(client, &local_closure);
- return Success;
-}
-
-
-/* does the necessary magic to figure out the fpe type */
-static int
-DetermineFPEType(char *pathname)
-{
- int i;
-
- for (i = 0; i < num_fpe_types; i++) {
- if ((*fpe_functions[i].name_check) (pathname))
- return i;
- }
- return -1;
-}
-
-
-static void
-FreeFontPath(FontPathElementPtr *list, int n, Bool force)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- if (force) {
- /* Sanity check that all refcounts will be 0 by the time
- we get to the end of the list. */
- int found = 1; /* the first reference is us */
- int j;
- for (j = i+1; j < n; j++) {
- if (list[j] == list[i])
- found++;
- }
- if (list[i]->refcount != found) {
- list[i]->refcount = found; /* ensure it will get freed */
- }
- }
- FreeFPE(list[i]);
- }
- free(list);
-}
-
-static FontPathElementPtr
-find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len)
-{
- FontPathElementPtr fpe;
- int i;
-
- for (i = 0; i < num; i++) {
- fpe = list[i];
- if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0)
- return fpe;
- }
- return (FontPathElementPtr) 0;
-}
-
-
-static int
-SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist)
-{
- int i, err = 0;
- int valid_paths = 0;
- unsigned int len;
- unsigned char *cp = paths;
- FontPathElementPtr fpe = NULL, *fplist;
-
- fplist = malloc(sizeof(FontPathElementPtr) * npaths);
- if (!fplist) {
- *bad = 0;
- return BadAlloc;
- }
- for (i = 0; i < num_fpe_types; i++) {
- if (fpe_functions[i].set_path_hook)
- (*fpe_functions[i].set_path_hook) ();
- }
- for (i = 0; i < npaths; i++)
- {
- len = (unsigned int) (*cp++);
-
- if (len == 0)
- {
- if (persist)
- ErrorF("[dix] Removing empty element from the valid list of fontpaths\n");
- err = BadValue;
- }
- else
- {
- /* if it's already in our active list, just reset it */
- /*
- * note that this can miss FPE's in limbo -- may be worth catching
- * them, though it'd muck up refcounting
- */
- fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len);
- if (fpe)
- {
- err = (*fpe_functions[fpe->type].reset_fpe) (fpe);
- if (err == Successful)
- {
- UseFPE(fpe);/* since it'll be decref'd later when freed
- * from the old list */
- }
- else
- fpe = 0;
- }
- /* if error or can't do it, act like it's a new one */
- if (!fpe)
- {
- fpe = malloc(sizeof(FontPathElementRec));
- if (!fpe)
- {
- err = BadAlloc;
- goto bail;
- }
- fpe->name = malloc(len + 1);
- if (!fpe->name)
- {
- free(fpe);
- err = BadAlloc;
- goto bail;
- }
- fpe->refcount = 1;
-
- strncpy(fpe->name, (char *) cp, (int) len);
- fpe->name[len] = '\0';
- fpe->name_length = len;
- fpe->type = DetermineFPEType(fpe->name);
- if (fpe->type == -1)
- err = BadValue;
- else
- err = (*fpe_functions[fpe->type].init_fpe) (fpe);
- if (err != Successful)
- {
- if (persist)
- {
- ErrorF("[dix] Could not init font path element %s, removing from list!\n",
- fpe->name);
- }
- free(fpe->name);
- free(fpe);
- }
- }
- }
- if (err != Successful)
- {
- if (!persist)
- goto bail;
- }
- else
- {
- fplist[valid_paths++] = fpe;
- }
- cp += len;
- }
-
- FreeFontPath(font_path_elements, num_fpes, FALSE);
- font_path_elements = fplist;
- if (patternCache)
- EmptyFontPatternCache(patternCache);
- num_fpes = valid_paths;
-
- return Success;
-bail:
- *bad = i;
- while (--valid_paths >= 0)
- FreeFPE(fplist[valid_paths]);
- free(fplist);
- return FontToXError(err);
-}
-
-int
-SetFontPath(ClientPtr client, int npaths, unsigned char *paths)
-{
- int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
- if (err != Success)
- return err;
-
- if (npaths == 0) {
- if (SetDefaultFontPath(defaultFontPath) != Success)
- return BadValue;
- } else {
- int bad;
- err = SetFontPathElements(npaths, paths, &bad, FALSE);
- client->errorValue = bad;
- }
- return err;
-}
-
-int
-SetDefaultFontPath(char *path)
-{
- char *temp_path,
- *start,
- *end;
- unsigned char *cp,
- *pp,
- *nump,
- *newpath;
- int num = 1,
- len,
- err,
- size = 0,
- bad;
-
- /* ensure temp_path contains "built-ins" */
- start = path;
- while (1) {
- start = strstr(start, "built-ins");
- if (start == NULL)
- break;
- end = start + strlen("built-ins");
- if ((start == path || start[-1] == ',') && (!*end || *end == ','))
- break;
- start = end;
- }
- if (!start) {
- if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "")
- == -1)
- temp_path = NULL;
- } else {
- temp_path = strdup(path);
- }
- if (!temp_path)
- return BadAlloc;
-
- /* get enough for string, plus values -- use up commas */
- len = strlen(temp_path) + 1;
- nump = cp = newpath = malloc(len);
- if (!newpath)
- return BadAlloc;
- pp = (unsigned char *) temp_path;
- cp++;
- while (*pp) {
- if (*pp == ',') {
- *nump = (unsigned char) size;
- nump = cp++;
- pp++;
- num++;
- size = 0;
- } else {
- *cp++ = *pp++;
- size++;
- }
- }
- *nump = (unsigned char) size;
-
- err = SetFontPathElements(num, newpath, &bad, TRUE);
-
- free(newpath);
- free(temp_path);
-
- return err;
-}
-
-int
-GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result)
-{
- int i;
- unsigned char *c;
- int len;
- FontPathElementPtr fpe;
-
- i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess);
- if (i != Success)
- return i;
-
- len = 0;
- for (i = 0; i < num_fpes; i++) {
- fpe = font_path_elements[i];
- len += fpe->name_length + 1;
- }
- font_path_string = (unsigned char *) realloc(font_path_string, len);
- if (!font_path_string)
- return BadAlloc;
-
- c = font_path_string;
- *length = 0;
- for (i = 0; i < num_fpes; i++) {
- fpe = font_path_elements[i];
- *c = fpe->name_length;
- *length += *c++;
- memmove(c, fpe->name, fpe->name_length);
- c += fpe->name_length;
- }
- *count = num_fpes;
- *result = font_path_string;
- return Success;
-}
-
-void
-DeleteClientFontStuff(ClientPtr client)
-{
- int i;
- FontPathElementPtr fpe;
-
- for (i = 0; i < num_fpes; i++)
- {
- fpe = font_path_elements[i];
- if (fpe_functions[fpe->type].client_died)
- (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe);
- }
-}
-
-void
-InitFonts (void)
-{
- patternCache = MakeFontPatternCache();
-
- register_fpe_functions();
-}
-
-int
-GetDefaultPointSize (void)
-{
- return 120;
-}
-
-
-FontResolutionPtr
-GetClientResolutions (int *num)
-{
- static struct _FontResolution res;
- ScreenPtr pScreen;
-
- pScreen = screenInfo.screens[0];
- res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth;
- /*
- * XXX - we'll want this as long as bitmap instances are prevalent
- so that we can match them from scalable fonts
- */
- if (res.x_resolution < 88)
- res.x_resolution = 75;
- else
- res.x_resolution = 100;
- res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight;
- if (res.y_resolution < 88)
- res.y_resolution = 75;
- else
- res.y_resolution = 100;
- res.point_size = 120;
- *num = 1;
- return &res;
-}
-
-/*
- * returns the type index of the new fpe
- *
- * should be called (only once!) by each type of fpe when initialized
- */
-
-int
-RegisterFPEFunctions(NameCheckFunc name_func,
- InitFpeFunc init_func,
- FreeFpeFunc free_func,
- ResetFpeFunc reset_func,
- OpenFontFunc open_func,
- CloseFontFunc close_func,
- ListFontsFunc list_func,
- StartLfwiFunc start_lfwi_func,
- NextLfwiFunc next_lfwi_func,
- WakeupFpeFunc wakeup_func,
- ClientDiedFunc client_died,
- LoadGlyphsFunc load_glyphs,
- StartLaFunc start_list_alias_func,
- NextLaFunc next_list_alias_func,
- SetPathFunc set_path_func)
-{
- FPEFunctions *new;
-
- /* grow the list */
- new = (FPEFunctions *) realloc(fpe_functions,
- (num_fpe_types + 1) * sizeof(FPEFunctions));
- if (!new)
- return -1;
- fpe_functions = new;
-
- fpe_functions[num_fpe_types].name_check = name_func;
- fpe_functions[num_fpe_types].open_font = open_func;
- fpe_functions[num_fpe_types].close_font = close_func;
- fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func;
- fpe_functions[num_fpe_types].list_fonts = list_func;
- fpe_functions[num_fpe_types].start_list_fonts_with_info =
- start_lfwi_func;
- fpe_functions[num_fpe_types].list_next_font_with_info =
- next_lfwi_func;
- fpe_functions[num_fpe_types].init_fpe = init_func;
- fpe_functions[num_fpe_types].free_fpe = free_func;
- fpe_functions[num_fpe_types].reset_fpe = reset_func;
- fpe_functions[num_fpe_types].client_died = client_died;
- fpe_functions[num_fpe_types].load_glyphs = load_glyphs;
- fpe_functions[num_fpe_types].start_list_fonts_and_aliases =
- start_list_alias_func;
- fpe_functions[num_fpe_types].list_next_font_or_alias =
- next_list_alias_func;
- fpe_functions[num_fpe_types].set_path_hook = set_path_func;
-
- return num_fpe_types++;
-}
-
-void
-FreeFonts(void)
-{
- if (patternCache) {
- FreeFontPatternCache(patternCache);
- patternCache = 0;
- }
- FreeFontPath(font_path_elements, num_fpes, TRUE);
- font_path_elements = 0;
- num_fpes = 0;
- free(fpe_functions);
- num_fpe_types = 0;
- fpe_functions = (FPEFunctions *) 0;
-}
-
-/* convenience functions for FS interface */
-
-FontPtr
-find_old_font(XID id)
-{
- pointer pFont;
- dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess);
- return (FontPtr)pFont;
-}
-
-Font
-GetNewFontClientID(void)
-{
- return FakeClientID(0);
-}
-
-int
-StoreFontClientFont(FontPtr pfont, Font id)
-{
- return AddResource(id, RT_NONE, (pointer) pfont);
-}
-
-void
-DeleteFontClientID(Font id)
-{
- FreeResource(id, RT_NONE);
-}
-
-int
-client_auth_generation(ClientPtr client)
-{
- return 0;
-}
-
-static int fs_handlers_installed = 0;
-static unsigned int last_server_gen;
-
-int
-init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler)
-{
- /* if server has reset, make sure the b&w handlers are reinstalled */
- if (last_server_gen < serverGeneration) {
- last_server_gen = serverGeneration;
- fs_handlers_installed = 0;
- }
- if (fs_handlers_installed == 0) {
- if (!RegisterBlockAndWakeupHandlers(block_handler,
- FontWakeup, (pointer) 0))
- return AllocError;
- fs_handlers_installed++;
- }
- QueueFontWakeup(fpe);
- return Successful;
-}
-
-void
-remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bool all)
-{
- if (all) {
- /* remove the handlers if no one else is using them */
- if (--fs_handlers_installed == 0) {
- RemoveBlockAndWakeupHandlers(block_handler, FontWakeup,
- (pointer) 0);
- }
- }
- RemoveFontWakeup(fpe);
-}
+/************************************************************************ +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +************************************************************************/ +/* The panoramix components contained the following notice */ +/* +Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. + +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. + +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 +DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, +BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL 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 Digital Equipment Corporation +shall not be used in advertising or otherwise to promote the sale, use or other +dealings in this Software without prior written authorization from Digital +Equipment Corporation. + +******************************************************************/ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xproto.h> +#include "scrnintstr.h" +#include "resource.h" +#include "dixstruct.h" +#include "cursorstr.h" +#include "misc.h" +#include "opaque.h" +#include "dixfontstr.h" +#include "closestr.h" +#include "dixfont.h" +#include "xace.h" + +#ifdef DEBUG +#include <stdio.h> +#endif + +#ifdef XF86BIGFONT +#include "xf86bigfontsrv.h" +#endif + +#define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics + +extern pointer fosNaturalParams; +extern FontPtr defaultFont; + +static FontPathElementPtr *font_path_elements = (FontPathElementPtr *) 0; +static int num_fpes = 0; +static FPEFunctions *fpe_functions = (FPEFunctions *) 0; +static int num_fpe_types = 0; + +static unsigned char *font_path_string; + +static int num_slept_fpes = 0; +static int size_slept_fpes = 0; +static FontPathElementPtr *slept_fpes = (FontPathElementPtr *) 0; +static FontPatternCachePtr patternCache; + +static int +FontToXError(int err) +{ + switch (err) { + case Successful: + return Success; + case AllocError: + return BadAlloc; + case BadFontName: + return BadName; + case BadFontPath: + case BadFontFormat: /* is there something better? */ + case BadCharRange: + return BadValue; + default: + return err; + } +} + +static int +LoadGlyphs(ClientPtr client, FontPtr pfont, unsigned nchars, int item_size, + unsigned char *data) +{ + if (fpe_functions[pfont->fpe->type].load_glyphs) + return (*fpe_functions[pfont->fpe->type].load_glyphs) + (client, pfont, 0, nchars, item_size, data); + else + return Successful; +} + +/* + * adding RT_FONT prevents conflict with default cursor font + */ +Bool +SetDefaultFont(char *defaultfontname) +{ + int err; + FontPtr pf; + XID fid; + + fid = FakeClientID(0); + err = OpenFont(serverClient, fid, FontLoadAll | FontOpenSync, + (unsigned) strlen(defaultfontname), defaultfontname); + if (err != Success) + return FALSE; + err = dixLookupResourceByType((pointer *)&pf, fid, RT_FONT, serverClient, + DixReadAccess); + if (err != Success) + return FALSE; + defaultFont = pf; + return TRUE; +} + +/* + * note that the font wakeup queue is not refcounted. this is because + * an fpe needs to be added when it's inited, and removed when it's finally + * freed, in order to handle any data that isn't requested, like FS events. + * + * since the only thing that should call these routines is the renderer's + * init_fpe() and free_fpe(), there shouldn't be any problem in using + * freed data. + */ +void +QueueFontWakeup(FontPathElementPtr fpe) +{ + int i; + FontPathElementPtr *new; + + for (i = 0; i < num_slept_fpes; i++) { + if (slept_fpes[i] == fpe) { + return; + } + } + if (num_slept_fpes == size_slept_fpes) { + new = (FontPathElementPtr *) + realloc(slept_fpes, + sizeof(FontPathElementPtr) * (size_slept_fpes + 4)); + if (!new) + return; + slept_fpes = new; + size_slept_fpes += 4; + } + slept_fpes[num_slept_fpes] = fpe; + num_slept_fpes++; +} + +void +RemoveFontWakeup(FontPathElementPtr fpe) +{ + int i, + j; + + for (i = 0; i < num_slept_fpes; i++) { + if (slept_fpes[i] == fpe) { + for (j = i; j < num_slept_fpes; j++) { + slept_fpes[j] = slept_fpes[j + 1]; + } + num_slept_fpes--; + return; + } + } +} + +void +FontWakeup(pointer data, int count, pointer LastSelectMask) +{ + int i; + FontPathElementPtr fpe; + + if (count < 0) + return; + /* wake up any fpe's that may be waiting for information */ + for (i = 0; i < num_slept_fpes; i++) { + fpe = slept_fpes[i]; + (void) (*fpe_functions[fpe->type].wakeup_fpe) (fpe, LastSelectMask); + } +} + +/* XXX -- these two funcs may want to be broken into macros */ +static void +UseFPE(FontPathElementPtr fpe) +{ + fpe->refcount++; +} + +static void +FreeFPE (FontPathElementPtr fpe) +{ + fpe->refcount--; + if (fpe->refcount == 0) { + (*fpe_functions[fpe->type].free_fpe) (fpe); + free(fpe->name); + free(fpe); + } +} + +static Bool +doOpenFont(ClientPtr client, OFclosurePtr c) +{ + FontPtr pfont = NullFont; + FontPathElementPtr fpe = NULL; + ScreenPtr pScr; + int err = Successful; + int i; + char *alias, + *newname; + int newlen; + int aliascount = 20; + /* + * Decide at runtime what FontFormat to use. + */ + Mask FontFormat = + + ((screenInfo.imageByteOrder == LSBFirst) ? + BitmapFormatByteOrderLSB : BitmapFormatByteOrderMSB) | + + ((screenInfo.bitmapBitOrder == LSBFirst) ? + BitmapFormatBitOrderLSB : BitmapFormatBitOrderMSB) | + + BitmapFormatImageRectMin | + +#if GLYPHPADBYTES == 1 + BitmapFormatScanlinePad8 | +#endif + +#if GLYPHPADBYTES == 2 + BitmapFormatScanlinePad16 | +#endif + +#if GLYPHPADBYTES == 4 + BitmapFormatScanlinePad32 | +#endif + +#if GLYPHPADBYTES == 8 + BitmapFormatScanlinePad64 | +#endif + + BitmapFormatScanlineUnit8; + + if (client->clientGone) + { + if (c->current_fpe < c->num_fpes) + { + fpe = c->fpe_list[c->current_fpe]; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + } + err = Successful; + goto bail; + } + while (c->current_fpe < c->num_fpes) { + fpe = c->fpe_list[c->current_fpe]; + err = (*fpe_functions[fpe->type].open_font) + ((pointer) client, fpe, c->flags, + c->fontname, c->fnamelen, FontFormat, + BitmapFormatMaskByte | + BitmapFormatMaskBit | + BitmapFormatMaskImageRectangle | + BitmapFormatMaskScanLinePad | + BitmapFormatMaskScanLineUnit, + c->fontid, &pfont, &alias, + c->non_cachable_font && c->non_cachable_font->fpe == fpe ? + c->non_cachable_font : + (FontPtr)0); + + if (err == FontNameAlias && alias) { + newlen = strlen(alias); + newname = (char *) realloc(c->fontname, newlen); + if (!newname) { + err = AllocError; + break; + } + memmove(newname, alias, newlen); + c->fontname = newname; + c->fnamelen = newlen; + c->current_fpe = 0; + if (--aliascount <= 0) { + /* We've tried resolving this alias 20 times, we're + * probably stuck in an infinite loop of aliases pointing + * to each other - time to take emergency exit! + */ + err = BadImplementation; + break; + } + continue; + } + if (err == BadFontName) { + c->current_fpe++; + continue; + } + if (err == Suspended) { + if (!ClientIsAsleep(client)) + ClientSleep(client, (ClientSleepProcPtr)doOpenFont, c); + else + goto xinerama_sleep; + return TRUE; + } + break; + } + + if (err != Successful) + goto bail; + if (!pfont) { + err = BadFontName; + goto bail; + } + /* check values for firstCol, lastCol, firstRow, and lastRow */ + if (pfont->info.firstCol > pfont->info.lastCol || + pfont->info.firstRow > pfont->info.lastRow || + pfont->info.lastCol - pfont->info.firstCol > 255) { + err = AllocError; + goto bail; + } + if (!pfont->fpe) + pfont->fpe = fpe; + pfont->refcnt++; + if (pfont->refcnt == 1) { + UseFPE(pfont->fpe); + for (i = 0; i < screenInfo.numScreens; i++) { + pScr = screenInfo.screens[i]; + if (pScr->RealizeFont) + { + if (!(*pScr->RealizeFont) (pScr, pfont)) + { + CloseFont (pfont, (Font) 0); + err = AllocError; + goto bail; + } + } + } + } + if (!AddResource(c->fontid, RT_FONT, (pointer) pfont)) { + err = AllocError; + goto bail; + } + if (patternCache && pfont != c->non_cachable_font) + CacheFontPattern(patternCache, c->origFontName, c->origFontNameLen, + pfont); +bail: + if (err != Successful && c->client != serverClient) { + SendErrorToClient(c->client, X_OpenFont, 0, + c->fontid, FontToXError(err)); + } + ClientWakeup(c->client); +xinerama_sleep: + for (i = 0; i < c->num_fpes; i++) { + FreeFPE(c->fpe_list[i]); + } + free(c->fpe_list); + free(c->fontname); + free(c); + return TRUE; +} + +int +OpenFont(ClientPtr client, XID fid, Mask flags, unsigned lenfname, char *pfontname) +{ + OFclosurePtr c; + int i; + FontPtr cached = (FontPtr)0; + +#ifdef FONTDEBUG + char *f; + f = malloc(lenfname + 1); + memmove(f, pfontname, lenfname); + f[lenfname] = '\0'; + ErrorF("[dix] OpenFont: fontname is \"%s\"\n", f); + free(f); +#endif + if (!lenfname || lenfname > XLFDMAXFONTNAMELEN) + return BadName; + if (patternCache) + { + + /* + ** Check name cache. If we find a cached version of this font that + ** is cachable, immediately satisfy the request with it. If we find + ** a cached version of this font that is non-cachable, we do not + ** satisfy the request with it. Instead, we pass the FontPtr to the + ** FPE's open_font code (the fontfile FPE in turn passes the + ** information to the rasterizer; the fserve FPE ignores it). + ** + ** Presumably, the font is marked non-cachable because the FPE has + ** put some licensing restrictions on it. If the FPE, using + ** whatever logic it relies on, determines that it is willing to + ** share this existing font with the client, then it has the option + ** to return the FontPtr we passed it as the newly-opened font. + ** This allows the FPE to exercise its licensing logic without + ** having to create another instance of a font that already exists. + */ + + cached = FindCachedFontPattern(patternCache, pfontname, lenfname); + if (cached && cached->info.cachable) + { + if (!AddResource(fid, RT_FONT, (pointer) cached)) + return BadAlloc; + cached->refcnt++; + return Success; + } + } + c = malloc(sizeof(OFclosureRec)); + if (!c) + return BadAlloc; + c->fontname = malloc(lenfname); + c->origFontName = pfontname; + c->origFontNameLen = lenfname; + if (!c->fontname) { + free(c); + return BadAlloc; + } + /* + * copy the current FPE list, so that if it gets changed by another client + * while we're blocking, the request still appears atomic + */ + c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); + if (!c->fpe_list) { + free(c->fontname); + free(c); + return BadAlloc; + } + memmove(c->fontname, pfontname, lenfname); + for (i = 0; i < num_fpes; i++) { + c->fpe_list[i] = font_path_elements[i]; + UseFPE(c->fpe_list[i]); + } + c->client = client; + c->fontid = fid; + c->current_fpe = 0; + c->num_fpes = num_fpes; + c->fnamelen = lenfname; + c->flags = flags; + c->non_cachable_font = cached; + + (void) doOpenFont(client, c); + return Success; +} + +/** + * Decrement font's ref count, and free storage if ref count equals zero + * + * \param value must conform to DeleteType + */ +int +CloseFont(pointer value, XID fid) +{ + int nscr; + ScreenPtr pscr; + FontPathElementPtr fpe; + FontPtr pfont = (FontPtr)value; + + if (pfont == NullFont) + return Success; + if (--pfont->refcnt == 0) { + if (patternCache) + RemoveCachedFontPattern (patternCache, pfont); + /* + * since the last reference is gone, ask each screen to free any + * storage it may have allocated locally for it. + */ + for (nscr = 0; nscr < screenInfo.numScreens; nscr++) { + pscr = screenInfo.screens[nscr]; + if (pscr->UnrealizeFont) + (*pscr->UnrealizeFont) (pscr, pfont); + } + if (pfont == defaultFont) + defaultFont = NULL; +#ifdef XF86BIGFONT + XF86BigfontFreeFontShm(pfont); +#endif + fpe = pfont->fpe; + (*fpe_functions[fpe->type].close_font) (fpe, pfont); + FreeFPE(fpe); + } + return Success; +} + + +/***====================================================================***/ + +/** + * Sets up pReply as the correct QueryFontReply for pFont with the first + * nProtoCCIStructs char infos. + * + * \param pReply caller must allocate this storage + */ +void +QueryFont(FontPtr pFont, xQueryFontReply *pReply, int nProtoCCIStructs) +{ + FontPropPtr pFP; + int r, + c, + i; + xFontProp *prFP; + xCharInfo *prCI; + xCharInfo *charInfos[256]; + unsigned char chars[512]; + int ninfos; + unsigned long ncols; + unsigned long count; + + /* pr->length set in dispatch */ + pReply->minCharOrByte2 = pFont->info.firstCol; + pReply->defaultChar = pFont->info.defaultCh; + pReply->maxCharOrByte2 = pFont->info.lastCol; + pReply->drawDirection = pFont->info.drawDirection; + pReply->allCharsExist = pFont->info.allExist; + pReply->minByte1 = pFont->info.firstRow; + pReply->maxByte1 = pFont->info.lastRow; + pReply->fontAscent = pFont->info.fontAscent; + pReply->fontDescent = pFont->info.fontDescent; + + pReply->minBounds = pFont->info.ink_minbounds; + pReply->maxBounds = pFont->info.ink_maxbounds; + + pReply->nFontProps = pFont->info.nprops; + pReply->nCharInfos = nProtoCCIStructs; + + for (i = 0, pFP = pFont->info.props, prFP = (xFontProp *) (&pReply[1]); + i < pFont->info.nprops; + i++, pFP++, prFP++) { + prFP->name = pFP->name; + prFP->value = pFP->value; + } + + ninfos = 0; + ncols = (unsigned long) (pFont->info.lastCol - pFont->info.firstCol + 1); + prCI = (xCharInfo *) (prFP); + for (r = pFont->info.firstRow; + ninfos < nProtoCCIStructs && r <= (int)pFont->info.lastRow; + r++) { + i = 0; + for (c = pFont->info.firstCol; c <= (int)pFont->info.lastCol; c++) { + chars[i++] = r; + chars[i++] = c; + } + (*pFont->get_metrics) (pFont, ncols, chars, + TwoD16Bit, &count, charInfos); + i = 0; + for (i = 0; i < (int) count && ninfos < nProtoCCIStructs; i++) { + *prCI = *charInfos[i]; + prCI++; + ninfos++; + } + } + return; +} + +static Bool +doListFontsAndAliases(ClientPtr client, LFclosurePtr c) +{ + FontPathElementPtr fpe; + int err = Successful; + FontNamesPtr names = NULL; + char *name, *resolved=NULL; + int namelen, resolvedlen; + int nnames; + int stringLens; + int i; + xListFontsReply reply; + char *bufptr; + char *bufferStart; + int aliascount = 0; + + if (client->clientGone) + { + if (c->current.current_fpe < c->num_fpes) + { + fpe = c->fpe_list[c->current.current_fpe]; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + } + err = Successful; + goto bail; + } + + if (!c->current.patlen) + goto finish; + + while (c->current.current_fpe < c->num_fpes) { + fpe = c->fpe_list[c->current.current_fpe]; + err = Successful; + + if (!fpe_functions[fpe->type].start_list_fonts_and_aliases) + { + /* This FPE doesn't support/require list_fonts_and_aliases */ + + err = (*fpe_functions[fpe->type].list_fonts) + ((pointer) c->client, fpe, c->current.pattern, + c->current.patlen, c->current.max_names - c->names->nnames, + c->names); + + if (err == Suspended) { + if (!ClientIsAsleep(client)) + ClientSleep(client, + (ClientSleepProcPtr)doListFontsAndAliases, + c); + else + goto xinerama_sleep; + return TRUE; + } + + err = BadFontName; + } + else + { + /* Start of list_fonts_and_aliases functionality. Modeled + after list_fonts_with_info in that it resolves aliases, + except that the information collected from FPEs is just + names, not font info. Each list_next_font_or_alias() + returns either a name into name/namelen or an alias into + name/namelen and its target name into resolved/resolvedlen. + The code at this level then resolves the alias by polling + the FPEs. */ + + if (!c->current.list_started) { + err = (*fpe_functions[fpe->type].start_list_fonts_and_aliases) + ((pointer) c->client, fpe, c->current.pattern, + c->current.patlen, c->current.max_names - c->names->nnames, + &c->current.private); + if (err == Suspended) { + if (!ClientIsAsleep(client)) + ClientSleep(client, + (ClientSleepProcPtr)doListFontsAndAliases, + c); + else + goto xinerama_sleep; + return TRUE; + } + if (err == Successful) + c->current.list_started = TRUE; + } + if (err == Successful) { + char *tmpname; + name = 0; + err = (*fpe_functions[fpe->type].list_next_font_or_alias) + ((pointer) c->client, fpe, &name, &namelen, &tmpname, + &resolvedlen, c->current.private); + if (err == Suspended) { + if (!ClientIsAsleep(client)) + ClientSleep(client, + (ClientSleepProcPtr)doListFontsAndAliases, + c); + else + goto xinerama_sleep; + return TRUE; + } + if (err == FontNameAlias) { + free(resolved); + resolved = malloc(resolvedlen + 1); + if (resolved) + memmove(resolved, tmpname, resolvedlen + 1); + } + } + + if (err == Successful) + { + if (c->haveSaved) + { + if (c->savedName) + (void)AddFontNamesName(c->names, c->savedName, + c->savedNameLen); + } + else + (void)AddFontNamesName(c->names, name, namelen); + } + + /* + * When we get an alias back, save our state and reset back to + * the start of the FPE looking for the specified name. As + * soon as a real font is found for the alias, pop back to the + * old state + */ + else if (err == FontNameAlias) { + char tmp_pattern[XLFDMAXFONTNAMELEN]; + /* + * when an alias recurses, we need to give + * the last FPE a chance to clean up; so we call + * it again, and assume that the error returned + * is BadFontName, indicating the alias resolution + * is complete. + */ + memmove(tmp_pattern, resolved, resolvedlen); + if (c->haveSaved) + { + char *tmpname; + int tmpnamelen; + + tmpname = 0; + (void) (*fpe_functions[fpe->type].list_next_font_or_alias) + ((pointer) c->client, fpe, &tmpname, &tmpnamelen, + &tmpname, &tmpnamelen, c->current.private); + if (--aliascount <= 0) + { + err = BadFontName; + goto ContBadFontName; + } + } + else + { + c->saved = c->current; + c->haveSaved = TRUE; + free(c->savedName); + c->savedName = malloc(namelen + 1); + if (c->savedName) + memmove(c->savedName, name, namelen + 1); + c->savedNameLen = namelen; + aliascount = 20; + } + memmove(c->current.pattern, tmp_pattern, resolvedlen); + c->current.patlen = resolvedlen; + c->current.max_names = c->names->nnames + 1; + c->current.current_fpe = -1; + c->current.private = 0; + err = BadFontName; + } + } + /* + * At the end of this FPE, step to the next. If we've finished + * processing an alias, pop state back. If we've collected enough + * font names, quit. + */ + if (err == BadFontName) { + ContBadFontName: ; + c->current.list_started = FALSE; + c->current.current_fpe++; + err = Successful; + if (c->haveSaved) + { + if (c->names->nnames == c->current.max_names || + c->current.current_fpe == c->num_fpes) { + c->haveSaved = FALSE; + c->current = c->saved; + /* Give the saved namelist a chance to clean itself up */ + continue; + } + } + if (c->names->nnames == c->current.max_names) + break; + } + } + + /* + * send the reply + */ + if (err != Successful) { + SendErrorToClient(client, X_ListFonts, 0, 0, FontToXError(err)); + goto bail; + } + +finish: + + names = c->names; + nnames = names->nnames; + client = c->client; + stringLens = 0; + for (i = 0; i < nnames; i++) + stringLens += (names->length[i] <= 255) ? names->length[i] : 0; + + memset(&reply, 0, sizeof(xListFontsReply)); + reply.type = X_Reply; + reply.length = bytes_to_int32(stringLens + nnames); + reply.nFonts = nnames; + reply.sequenceNumber = client->sequence; + + bufptr = bufferStart = malloc(reply.length << 2); + + if (!bufptr && reply.length) { + SendErrorToClient(client, X_ListFonts, 0, 0, BadAlloc); + goto bail; + } + /* + * since WriteToClient long word aligns things, copy to temp buffer and + * write all at once + */ + for (i = 0; i < nnames; i++) { + if (names->length[i] > 255) + reply.nFonts--; + else + { + *bufptr++ = names->length[i]; + memmove( bufptr, names->names[i], names->length[i]); + bufptr += names->length[i]; + } + } + nnames = reply.nFonts; + reply.length = bytes_to_int32(stringLens + nnames); + client->pSwapReplyFunc = ReplySwapVector[X_ListFonts]; + WriteSwappedDataToClient(client, sizeof(xListFontsReply), &reply); + (void) WriteToClient(client, stringLens + nnames, bufferStart); + free(bufferStart); + +bail: + ClientWakeup(client); +xinerama_sleep: + for (i = 0; i < c->num_fpes; i++) + FreeFPE(c->fpe_list[i]); + free(c->fpe_list); + free(c->savedName); + FreeFontNames(names); + free(c); + free(resolved); + return TRUE; +} + +int +ListFonts(ClientPtr client, unsigned char *pattern, unsigned length, + unsigned max_names) +{ + int i; + LFclosurePtr c; + + /* + * The right error to return here would be BadName, however the + * specification does not allow for a Name error on this request. + * Perhaps a better solution would be to return a nil list, i.e. + * a list containing zero fontnames. + */ + if (length > XLFDMAXFONTNAMELEN) + return BadAlloc; + + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + + if (!(c = malloc(sizeof *c))) + return BadAlloc; + c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); + if (!c->fpe_list) { + free(c); + return BadAlloc; + } + c->names = MakeFontNamesRecord(max_names < 100 ? max_names : 100); + if (!c->names) + { + free(c->fpe_list); + free(c); + return BadAlloc; + } + memmove( c->current.pattern, pattern, length); + for (i = 0; i < num_fpes; i++) { + c->fpe_list[i] = font_path_elements[i]; + UseFPE(c->fpe_list[i]); + } + c->client = client; + c->num_fpes = num_fpes; + c->current.patlen = length; + c->current.current_fpe = 0; + c->current.max_names = max_names; + c->current.list_started = FALSE; + c->current.private = 0; + c->haveSaved = FALSE; + c->savedName = 0; + doListFontsAndAliases(client, c); + return Success; +} + +int +doListFontsWithInfo(ClientPtr client, LFWIclosurePtr c) +{ + FontPathElementPtr fpe; + int err = Successful; + char *name; + int namelen; + int numFonts; + FontInfoRec fontInfo, + *pFontInfo; + xListFontsWithInfoReply *reply; + int length; + xFontProp *pFP; + int i; + int aliascount = 0; + xListFontsWithInfoReply finalReply; + + if (client->clientGone) + { + if (c->current.current_fpe < c->num_fpes) + { + fpe = c->fpe_list[c->current.current_fpe]; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + } + err = Successful; + goto bail; + } + client->pSwapReplyFunc = ReplySwapVector[X_ListFontsWithInfo]; + if (!c->current.patlen) + goto finish; + while (c->current.current_fpe < c->num_fpes) + { + fpe = c->fpe_list[c->current.current_fpe]; + err = Successful; + if (!c->current.list_started) + { + err = (*fpe_functions[fpe->type].start_list_fonts_with_info) + (client, fpe, c->current.pattern, c->current.patlen, + c->current.max_names, &c->current.private); + if (err == Suspended) + { + if (!ClientIsAsleep(client)) + ClientSleep(client, + (ClientSleepProcPtr)doListFontsWithInfo, c); + else + goto xinerama_sleep; + return TRUE; + } + if (err == Successful) + c->current.list_started = TRUE; + } + if (err == Successful) + { + name = 0; + pFontInfo = &fontInfo; + err = (*fpe_functions[fpe->type].list_next_font_with_info) + (client, fpe, &name, &namelen, &pFontInfo, + &numFonts, c->current.private); + if (err == Suspended) + { + if (!ClientIsAsleep(client)) + ClientSleep(client, + (ClientSleepProcPtr)doListFontsWithInfo, c); + else + goto xinerama_sleep; + return TRUE; + } + } + /* + * When we get an alias back, save our state and reset back to the + * start of the FPE looking for the specified name. As soon as a real + * font is found for the alias, pop back to the old state + */ + if (err == FontNameAlias) + { + /* + * when an alias recurses, we need to give + * the last FPE a chance to clean up; so we call + * it again, and assume that the error returned + * is BadFontName, indicating the alias resolution + * is complete. + */ + if (c->haveSaved) + { + char *tmpname; + int tmpnamelen; + FontInfoPtr tmpFontInfo; + + tmpname = 0; + tmpFontInfo = &fontInfo; + (void) (*fpe_functions[fpe->type].list_next_font_with_info) + (client, fpe, &tmpname, &tmpnamelen, &tmpFontInfo, + &numFonts, c->current.private); + if (--aliascount <= 0) + { + err = BadFontName; + goto ContBadFontName; + } + } + else + { + c->saved = c->current; + c->haveSaved = TRUE; + c->savedNumFonts = numFonts; + free(c->savedName); + c->savedName = malloc(namelen + 1); + if (c->savedName) + memmove(c->savedName, name, namelen + 1); + aliascount = 20; + } + memmove(c->current.pattern, name, namelen); + c->current.patlen = namelen; + c->current.max_names = 1; + c->current.current_fpe = 0; + c->current.private = 0; + c->current.list_started = FALSE; + } + /* + * At the end of this FPE, step to the next. If we've finished + * processing an alias, pop state back. If we've sent enough font + * names, quit. Always wait for BadFontName to let the FPE + * have a chance to clean up. + */ + else if (err == BadFontName) + { + ContBadFontName: ; + c->current.list_started = FALSE; + c->current.current_fpe++; + err = Successful; + if (c->haveSaved) + { + if (c->current.max_names == 0 || + c->current.current_fpe == c->num_fpes) + { + c->haveSaved = FALSE; + c->saved.max_names -= (1 - c->current.max_names); + c->current = c->saved; + } + } + else if (c->current.max_names == 0) + break; + } + else if (err == Successful) + { + length = sizeof(*reply) + pFontInfo->nprops * sizeof(xFontProp); + reply = c->reply; + if (c->length < length) + { + reply = (xListFontsWithInfoReply *) realloc(c->reply, length); + if (!reply) + { + err = AllocError; + break; + } + memset((char*)reply + c->length, 0, length - c->length); + c->reply = reply; + c->length = length; + } + if (c->haveSaved) + { + numFonts = c->savedNumFonts; + name = c->savedName; + namelen = strlen(name); + } + reply->type = X_Reply; + reply->length = bytes_to_int32(sizeof *reply - sizeof(xGenericReply) + + pFontInfo->nprops * sizeof(xFontProp) + + namelen); + reply->sequenceNumber = client->sequence; + reply->nameLength = namelen; + reply->minBounds = pFontInfo->ink_minbounds; + reply->maxBounds = pFontInfo->ink_maxbounds; + reply->minCharOrByte2 = pFontInfo->firstCol; + reply->maxCharOrByte2 = pFontInfo->lastCol; + reply->defaultChar = pFontInfo->defaultCh; + reply->nFontProps = pFontInfo->nprops; + reply->drawDirection = pFontInfo->drawDirection; + reply->minByte1 = pFontInfo->firstRow; + reply->maxByte1 = pFontInfo->lastRow; + reply->allCharsExist = pFontInfo->allExist; + reply->fontAscent = pFontInfo->fontAscent; + reply->fontDescent = pFontInfo->fontDescent; + reply->nReplies = numFonts; + pFP = (xFontProp *) (reply + 1); + for (i = 0; i < pFontInfo->nprops; i++) + { + pFP->name = pFontInfo->props[i].name; + pFP->value = pFontInfo->props[i].value; + pFP++; + } + WriteSwappedDataToClient(client, length, reply); + (void) WriteToClient(client, namelen, name); + if (pFontInfo == &fontInfo) + { + free(fontInfo.props); + free(fontInfo.isStringProp); + } + --c->current.max_names; + } + } +finish: + length = sizeof(xListFontsWithInfoReply); + memset((char *) &finalReply, 0, sizeof(xListFontsWithInfoReply)); + finalReply.type = X_Reply; + finalReply.sequenceNumber = client->sequence; + finalReply.length = bytes_to_int32(sizeof(xListFontsWithInfoReply) + - sizeof(xGenericReply)); + WriteSwappedDataToClient(client, length, &finalReply); +bail: + ClientWakeup(client); +xinerama_sleep: + for (i = 0; i < c->num_fpes; i++) + FreeFPE(c->fpe_list[i]); + free(c->reply); + free(c->fpe_list); + free(c->savedName); + free(c); + return TRUE; +} + +int +StartListFontsWithInfo(ClientPtr client, int length, unsigned char *pattern, + int max_names) +{ + int i; + LFWIclosurePtr c; + + /* + * The right error to return here would be BadName, however the + * specification does not allow for a Name error on this request. + * Perhaps a better solution would be to return a nil list, i.e. + * a list containing zero fontnames. + */ + if (length > XLFDMAXFONTNAMELEN) + return BadAlloc; + + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + + if (!(c = malloc(sizeof *c))) + goto badAlloc; + c->fpe_list = malloc(sizeof(FontPathElementPtr) * num_fpes); + if (!c->fpe_list) + { + free(c); + goto badAlloc; + } + memmove(c->current.pattern, pattern, length); + for (i = 0; i < num_fpes; i++) + { + c->fpe_list[i] = font_path_elements[i]; + UseFPE(c->fpe_list[i]); + } + c->client = client; + c->num_fpes = num_fpes; + c->reply = 0; + c->length = 0; + c->current.patlen = length; + c->current.current_fpe = 0; + c->current.max_names = max_names; + c->current.list_started = FALSE; + c->current.private = 0; + c->savedNumFonts = 0; + c->haveSaved = FALSE; + c->savedName = 0; + doListFontsWithInfo(client, c); + return Success; +badAlloc: + return BadAlloc; +} + +#define TextEltHeader 2 +#define FontShiftSize 5 +static ChangeGCVal clearGC[] = { { .ptr = NullPixmap } }; +#define clearGCmask (GCClipMask) + +int +doPolyText(ClientPtr client, PTclosurePtr c) +{ + FontPtr pFont = c->pGC->font, oldpFont; + int err = Success, lgerr; /* err is in X error, not font error, space */ + enum { NEVER_SLEPT, START_SLEEP, SLEEPING } client_state = NEVER_SLEPT; + FontPathElementPtr fpe; + GC *origGC = NULL; + int itemSize = c->reqType == X_PolyText8 ? 1 : 2; + + if (client->clientGone) + { + fpe = c->pGC->font->fpe; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + + if (ClientIsAsleep(client)) + { + /* Client has died, but we cannot bail out right now. We + need to clean up after the work we did when going to + sleep. Setting the drawable pointer to 0 makes this + happen without any attempts to render or perform other + unnecessary activities. */ + c->pDraw = (DrawablePtr)0; + } + else + { + err = Success; + goto bail; + } + } + + /* Make sure our drawable hasn't disappeared while we slept. */ + if (ClientIsAsleep(client) && c->pDraw) + { + DrawablePtr pDraw; + dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess); + if (c->pDraw != pDraw) { + /* Our drawable has disappeared. Treat like client died... ask + the FPE code to clean up after client and avoid further + rendering while we clean up after ourself. */ + fpe = c->pGC->font->fpe; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + c->pDraw = (DrawablePtr)0; + } + } + + client_state = ClientIsAsleep(client) ? SLEEPING : NEVER_SLEPT; + + while (c->endReq - c->pElt > TextEltHeader) + { + if (*c->pElt == FontChange) + { + Font fid; + if (c->endReq - c->pElt < FontShiftSize) + { + err = BadLength; + goto bail; + } + + oldpFont = pFont; + + fid = ((Font)*(c->pElt+4)) /* big-endian */ + | ((Font)*(c->pElt+3)) << 8 + | ((Font)*(c->pElt+2)) << 16 + | ((Font)*(c->pElt+1)) << 24; + err = dixLookupResourceByType((pointer *)&pFont, fid, RT_FONT, + client, DixUseAccess); + if (err != Success) + { + /* restore pFont for step 4 (described below) */ + pFont = oldpFont; + + /* If we're in START_SLEEP mode, the following step + shortens the request... in the unlikely event that + the fid somehow becomes valid before we come through + again to actually execute the polytext, which would + then mess up our refcounting scheme badly. */ + c->err = err; + c->endReq = c->pElt; + + goto bail; + } + + /* Step 3 (described below) on our new font */ + if (client_state == START_SLEEP) + pFont->refcnt++; + else + { + if (pFont != c->pGC->font && c->pDraw) + { + ChangeGCVal val; + val.ptr = pFont; + ChangeGC(NullClient, c->pGC, GCFont, &val); + ValidateGC(c->pDraw, c->pGC); + } + + /* Undo the refcnt++ we performed when going to sleep */ + if (client_state == SLEEPING) + (void)CloseFont(c->pGC->font, (Font)0); + } + c->pElt += FontShiftSize; + } + else /* print a string */ + { + unsigned char *pNextElt; + pNextElt = c->pElt + TextEltHeader + (*c->pElt) * itemSize; + if ( pNextElt > c->endReq) + { + err = BadLength; + goto bail; + } + if (client_state == START_SLEEP) + { + c->pElt = pNextElt; + continue; + } + if (c->pDraw) + { + lgerr = LoadGlyphs(client, c->pGC->font, *c->pElt, itemSize, + c->pElt + TextEltHeader); + } + else lgerr = Successful; + + if (lgerr == Suspended) + { + if (!ClientIsAsleep(client)) { + int len; + GC *pGC; + PTclosurePtr new_closure; + + /* We're putting the client to sleep. We need to do a few things + to ensure successful and atomic-appearing execution of the + remainder of the request. First, copy the remainder of the + request into a safe malloc'd area. Second, create a scratch GC + to use for the remainder of the request. Third, mark all fonts + referenced in the remainder of the request to prevent their + deallocation. Fourth, make the original GC look like the + request has completed... set its font to the final font value + from this request. These GC manipulations are for the unlikely + (but possible) event that some other client is using the GC. + Steps 3 and 4 are performed by running this procedure through + the remainder of the request in a special no-render mode + indicated by client_state = START_SLEEP. */ + + /* Step 1 */ + /* Allocate a malloc'd closure structure to replace + the local one we were passed */ + new_closure = malloc(sizeof(PTclosureRec)); + if (!new_closure) + { + err = BadAlloc; + goto bail; + } + *new_closure = *c; + c = new_closure; + + len = c->endReq - c->pElt; + c->data = malloc(len); + if (!c->data) + { + free(c); + err = BadAlloc; + goto bail; + } + memmove(c->data, c->pElt, len); + c->pElt = c->data; + c->endReq = c->pElt + len; + + /* Step 2 */ + + pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); + if (!pGC) + { + free(c->data); + free(c); + err = BadAlloc; + goto bail; + } + if ((err = CopyGC(c->pGC, pGC, GCFunction | + GCPlaneMask | GCForeground | + GCBackground | GCFillStyle | + GCTile | GCStipple | + GCTileStipXOrigin | + GCTileStipYOrigin | GCFont | + GCSubwindowMode | GCClipXOrigin | + GCClipYOrigin | GCClipMask)) != + Success) + { + FreeScratchGC(pGC); + free(c->data); + free(c); + err = BadAlloc; + goto bail; + } + origGC = c->pGC; + c->pGC = pGC; + ValidateGC(c->pDraw, c->pGC); + + ClientSleep(client, (ClientSleepProcPtr)doPolyText, c); + + /* Set up to perform steps 3 and 4 */ + client_state = START_SLEEP; + continue; /* on to steps 3 and 4 */ + } + else + goto xinerama_sleep; + return TRUE; + } + else if (lgerr != Successful) + { + err = FontToXError(lgerr); + goto bail; + } + if (c->pDraw) + { + c->xorg += *((INT8 *)(c->pElt + 1)); /* must be signed */ + if (c->reqType == X_PolyText8) + c->xorg = (* c->pGC->ops->PolyText8)(c->pDraw, c->pGC, c->xorg, c->yorg, + *c->pElt, (char *) (c->pElt + TextEltHeader)); + else + c->xorg = (* c->pGC->ops->PolyText16)(c->pDraw, c->pGC, c->xorg, c->yorg, + *c->pElt, (unsigned short *) (c->pElt + TextEltHeader)); + } + c->pElt = pNextElt; + } + } + +bail: + + if (client_state == START_SLEEP) + { + /* Step 4 */ + if (pFont != origGC->font) + { + ChangeGCVal val; + val.ptr = pFont; + ChangeGC(NullClient, origGC, GCFont, &val); + ValidateGC(c->pDraw, origGC); + } + + /* restore pElt pointer for execution of remainder of the request */ + c->pElt = c->data; + return TRUE; + } + + if (c->err != Success) err = c->err; + if (err != Success && c->client != serverClient) { +#ifdef PANORAMIX + if (noPanoramiXExtension || !c->pGC->pScreen->myNum) +#endif + SendErrorToClient(c->client, c->reqType, 0, 0, err); + } + if (ClientIsAsleep(client)) + { + ClientWakeup(c->client); +xinerama_sleep: + ChangeGC(NullClient, c->pGC, clearGCmask, clearGC); + + /* Unreference the font from the scratch GC */ + CloseFont(c->pGC->font, (Font)0); + c->pGC->font = NullFont; + + FreeScratchGC(c->pGC); + free(c->data); + free(c); + } + return TRUE; +} + +int +PolyText(ClientPtr client, DrawablePtr pDraw, GC *pGC, unsigned char *pElt, + unsigned char *endReq, int xorg, int yorg, int reqType, XID did) +{ + PTclosureRec local_closure; + + local_closure.pElt = pElt; + local_closure.endReq = endReq; + local_closure.client = client; + local_closure.pDraw = pDraw; + local_closure.xorg = xorg; + local_closure.yorg = yorg; + local_closure.reqType = reqType; + local_closure.pGC = pGC; + local_closure.did = did; + local_closure.err = Success; + + (void) doPolyText(client, &local_closure); + return Success; +} + + +#undef TextEltHeader +#undef FontShiftSize + +int +doImageText(ClientPtr client, ITclosurePtr c) +{ + int err = Success, lgerr; /* err is in X error, not font error, space */ + FontPathElementPtr fpe; + int itemSize = c->reqType == X_ImageText8 ? 1 : 2; + + if (client->clientGone) + { + fpe = c->pGC->font->fpe; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + err = Success; + goto bail; + } + + /* Make sure our drawable hasn't disappeared while we slept. */ + if (ClientIsAsleep(client) && c->pDraw) + { + DrawablePtr pDraw; + dixLookupDrawable(&pDraw, c->did, client, 0, DixWriteAccess); + if (c->pDraw != pDraw) { + /* Our drawable has disappeared. Treat like client died... ask + the FPE code to clean up after client. */ + fpe = c->pGC->font->fpe; + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + err = Success; + goto bail; + } + } + + lgerr = LoadGlyphs(client, c->pGC->font, c->nChars, itemSize, c->data); + if (lgerr == Suspended) + { + if (!ClientIsAsleep(client)) { + GC *pGC; + unsigned char *data; + ITclosurePtr new_closure; + + /* We're putting the client to sleep. We need to + save some state. Similar problem to that handled + in doPolyText, but much simpler because the + request structure is much simpler. */ + + new_closure = malloc(sizeof(ITclosureRec)); + if (!new_closure) + { + err = BadAlloc; + goto bail; + } + *new_closure = *c; + c = new_closure; + + data = malloc(c->nChars * itemSize); + if (!data) + { + free(c); + err = BadAlloc; + goto bail; + } + memmove(data, c->data, c->nChars * itemSize); + c->data = data; + + pGC = GetScratchGC(c->pGC->depth, c->pGC->pScreen); + if (!pGC) + { + free(c->data); + free(c); + err = BadAlloc; + goto bail; + } + if ((err = CopyGC(c->pGC, pGC, GCFunction | GCPlaneMask | + GCForeground | GCBackground | GCFillStyle | + GCTile | GCStipple | GCTileStipXOrigin | + GCTileStipYOrigin | GCFont | + GCSubwindowMode | GCClipXOrigin | + GCClipYOrigin | GCClipMask)) != Success) + { + FreeScratchGC(pGC); + free(c->data); + free(c); + err = BadAlloc; + goto bail; + } + c->pGC = pGC; + ValidateGC(c->pDraw, c->pGC); + + ClientSleep(client, (ClientSleepProcPtr)doImageText, c); + } + else + goto xinerama_sleep; + return TRUE; + } + else if (lgerr != Successful) + { + err = FontToXError(lgerr); + goto bail; + } + if (c->pDraw) + { + if (c->reqType == X_ImageText8) + (* c->pGC->ops->ImageText8)(c->pDraw, c->pGC, c->xorg, c->yorg, + c->nChars, (char *) c->data); + else + (* c->pGC->ops->ImageText16)(c->pDraw, c->pGC, c->xorg, c->yorg, + c->nChars, (unsigned short *) c->data); + } + +bail: + + if (err != Success && c->client != serverClient) { + SendErrorToClient(c->client, c->reqType, 0, 0, err); + } + if (ClientIsAsleep(client)) + { + ClientWakeup(c->client); +xinerama_sleep: + ChangeGC(NullClient, c->pGC, clearGCmask, clearGC); + + /* Unreference the font from the scratch GC */ + CloseFont(c->pGC->font, (Font)0); + c->pGC->font = NullFont; + + FreeScratchGC(c->pGC); + free(c->data); + free(c); + } + return TRUE; +} + +int +ImageText(ClientPtr client, DrawablePtr pDraw, GC *pGC, int nChars, + unsigned char *data, int xorg, int yorg, int reqType, XID did) +{ + ITclosureRec local_closure; + + local_closure.client = client; + local_closure.pDraw = pDraw; + local_closure.pGC = pGC; + local_closure.nChars = nChars; + local_closure.data = data; + local_closure.xorg = xorg; + local_closure.yorg = yorg; + local_closure.reqType = reqType; + local_closure.did = did; + + (void) doImageText(client, &local_closure); + return Success; +} + + +/* does the necessary magic to figure out the fpe type */ +static int +DetermineFPEType(char *pathname) +{ + int i; + + for (i = 0; i < num_fpe_types; i++) { + if ((*fpe_functions[i].name_check) (pathname)) + return i; + } + return -1; +} + + +static void +FreeFontPath(FontPathElementPtr *list, int n, Bool force) +{ + int i; + + for (i = 0; i < n; i++) { + if (force) { + /* Sanity check that all refcounts will be 0 by the time + we get to the end of the list. */ + int found = 1; /* the first reference is us */ + int j; + for (j = i+1; j < n; j++) { + if (list[j] == list[i]) + found++; + } + if (list[i]->refcount != found) { + list[i]->refcount = found; /* ensure it will get freed */ + } + } + FreeFPE(list[i]); + } + free(list); +} + +static FontPathElementPtr +find_existing_fpe(FontPathElementPtr *list, int num, unsigned char *name, int len) +{ + FontPathElementPtr fpe; + int i; + + for (i = 0; i < num; i++) { + fpe = list[i]; + if (fpe->name_length == len && memcmp(name, fpe->name, len) == 0) + return fpe; + } + return (FontPathElementPtr) 0; +} + + +static int +SetFontPathElements(int npaths, unsigned char *paths, int *bad, Bool persist) +{ + int i, err = 0; + int valid_paths = 0; + unsigned int len; + unsigned char *cp = paths; + FontPathElementPtr fpe = NULL, *fplist; + + fplist = malloc(sizeof(FontPathElementPtr) * npaths); + if (!fplist) { + *bad = 0; + return BadAlloc; + } + for (i = 0; i < num_fpe_types; i++) { + if (fpe_functions[i].set_path_hook) + (*fpe_functions[i].set_path_hook) (); + } + for (i = 0; i < npaths; i++) + { + len = (unsigned int) (*cp++); + + if (len == 0) + { + if (persist) + ErrorF("[dix] Removing empty element from the valid list of fontpaths\n"); + err = BadValue; + } + else + { + /* if it's already in our active list, just reset it */ + /* + * note that this can miss FPE's in limbo -- may be worth catching + * them, though it'd muck up refcounting + */ + fpe = find_existing_fpe(font_path_elements, num_fpes, cp, len); + if (fpe) + { + err = (*fpe_functions[fpe->type].reset_fpe) (fpe); + if (err == Successful) + { + UseFPE(fpe);/* since it'll be decref'd later when freed + * from the old list */ + } + else + fpe = 0; + } + /* if error or can't do it, act like it's a new one */ + if (!fpe) + { + fpe = malloc(sizeof(FontPathElementRec)); + if (!fpe) + { + err = BadAlloc; + goto bail; + } + fpe->name = malloc(len + 1); + if (!fpe->name) + { + free(fpe); + err = BadAlloc; + goto bail; + } + fpe->refcount = 1; + + strncpy(fpe->name, (char *) cp, (int) len); + fpe->name[len] = '\0'; + fpe->name_length = len; + fpe->type = DetermineFPEType(fpe->name); + if (fpe->type == -1) + err = BadValue; + else + err = (*fpe_functions[fpe->type].init_fpe) (fpe); + if (err != Successful) + { + if (persist) + { + ErrorF("[dix] Could not init font path element %s, removing from list!\n", + fpe->name); + } + free(fpe->name); + free(fpe); + } + } + } + if (err != Successful) + { + if (!persist) + goto bail; + } + else + { + fplist[valid_paths++] = fpe; + } + cp += len; + } + + FreeFontPath(font_path_elements, num_fpes, FALSE); + font_path_elements = fplist; + if (patternCache) + EmptyFontPatternCache(patternCache); + num_fpes = valid_paths; + + return Success; +bail: + *bad = i; + while (--valid_paths >= 0) + FreeFPE(fplist[valid_paths]); + free(fplist); + return FontToXError(err); +} + +int +SetFontPath(ClientPtr client, int npaths, unsigned char *paths) +{ + int err = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess); + if (err != Success) + return err; + + if (npaths == 0) { + if (SetDefaultFontPath(defaultFontPath) != Success) + return BadValue; + } else { + int bad; + err = SetFontPathElements(npaths, paths, &bad, FALSE); + client->errorValue = bad; + } + return err; +} + +int +SetDefaultFontPath(char *path) +{ + char *temp_path, + *start, + *end; + unsigned char *cp, + *pp, + *nump, + *newpath; + int num = 1, + len, + err, + size = 0, + bad; + + /* ensure temp_path contains "built-ins" */ + start = path; + while (1) { + start = strstr(start, "built-ins"); + if (start == NULL) + break; + end = start + strlen("built-ins"); + if ((start == path || start[-1] == ',') && (!*end || *end == ',')) + break; + start = end; + } + if (!start) { + if (asprintf(&temp_path, "%s%sbuilt-ins", path, *path ? "," : "") + == -1) + temp_path = NULL; + } else { + temp_path = strdup(path); + } + if (!temp_path) + return BadAlloc; + + /* get enough for string, plus values -- use up commas */ + len = strlen(temp_path) + 1; + nump = cp = newpath = malloc(len); + if (!newpath) + return BadAlloc; + pp = (unsigned char *) temp_path; + cp++; + while (*pp) { + if (*pp == ',') { + *nump = (unsigned char) size; + nump = cp++; + pp++; + num++; + size = 0; + } else { + *cp++ = *pp++; + size++; + } + } + *nump = (unsigned char) size; + + err = SetFontPathElements(num, newpath, &bad, TRUE); + + free(newpath); + free(temp_path); + + return err; +} + +int +GetFontPath(ClientPtr client, int *count, int *length, unsigned char **result) +{ + int i; + unsigned char *c; + int len; + FontPathElementPtr fpe; + + i = XaceHook(XACE_SERVER_ACCESS, client, DixGetAttrAccess); + if (i != Success) + return i; + + len = 0; + for (i = 0; i < num_fpes; i++) { + fpe = font_path_elements[i]; + len += fpe->name_length + 1; + } + font_path_string = (unsigned char *) realloc(font_path_string, len); + if (!font_path_string) + return BadAlloc; + + c = font_path_string; + *length = 0; + for (i = 0; i < num_fpes; i++) { + fpe = font_path_elements[i]; + *c = fpe->name_length; + *length += *c++; + memmove(c, fpe->name, fpe->name_length); + c += fpe->name_length; + } + *count = num_fpes; + *result = font_path_string; + return Success; +} + +void +DeleteClientFontStuff(ClientPtr client) +{ + int i; + FontPathElementPtr fpe; + + for (i = 0; i < num_fpes; i++) + { + fpe = font_path_elements[i]; + if (fpe_functions[fpe->type].client_died) + (*fpe_functions[fpe->type].client_died) ((pointer) client, fpe); + } +} + +void +InitFonts (void) +{ + patternCache = MakeFontPatternCache(); + + register_fpe_functions(); +} + +int +GetDefaultPointSize (void) +{ + return 120; +} + + +FontResolutionPtr +GetClientResolutions (int *num) +{ + static struct _FontResolution res; + ScreenPtr pScreen; + + pScreen = screenInfo.screens[0]; + res.x_resolution = (pScreen->width * 25.4) / pScreen->mmWidth; + /* + * XXX - we'll want this as long as bitmap instances are prevalent + so that we can match them from scalable fonts + */ + if (res.x_resolution < 88) + res.x_resolution = 75; + else + res.x_resolution = 100; + res.y_resolution = (pScreen->height * 25.4) / pScreen->mmHeight; + if (res.y_resolution < 88) + res.y_resolution = 75; + else + res.y_resolution = 100; + res.point_size = 120; + *num = 1; + return &res; +} + +/* + * returns the type index of the new fpe + * + * should be called (only once!) by each type of fpe when initialized + */ + +int +RegisterFPEFunctions(NameCheckFunc name_func, + InitFpeFunc init_func, + FreeFpeFunc free_func, + ResetFpeFunc reset_func, + OpenFontFunc open_func, + CloseFontFunc close_func, + ListFontsFunc list_func, + StartLfwiFunc start_lfwi_func, + NextLfwiFunc next_lfwi_func, + WakeupFpeFunc wakeup_func, + ClientDiedFunc client_died, + LoadGlyphsFunc load_glyphs, + StartLaFunc start_list_alias_func, + NextLaFunc next_list_alias_func, + SetPathFunc set_path_func) +{ + FPEFunctions *new; + + /* grow the list */ + new = (FPEFunctions *) realloc(fpe_functions, + (num_fpe_types + 1) * sizeof(FPEFunctions)); + if (!new) + return -1; + fpe_functions = new; + + fpe_functions[num_fpe_types].name_check = name_func; + fpe_functions[num_fpe_types].open_font = open_func; + fpe_functions[num_fpe_types].close_font = close_func; + fpe_functions[num_fpe_types].wakeup_fpe = wakeup_func; + fpe_functions[num_fpe_types].list_fonts = list_func; + fpe_functions[num_fpe_types].start_list_fonts_with_info = + start_lfwi_func; + fpe_functions[num_fpe_types].list_next_font_with_info = + next_lfwi_func; + fpe_functions[num_fpe_types].init_fpe = init_func; + fpe_functions[num_fpe_types].free_fpe = free_func; + fpe_functions[num_fpe_types].reset_fpe = reset_func; + fpe_functions[num_fpe_types].client_died = client_died; + fpe_functions[num_fpe_types].load_glyphs = load_glyphs; + fpe_functions[num_fpe_types].start_list_fonts_and_aliases = + start_list_alias_func; + fpe_functions[num_fpe_types].list_next_font_or_alias = + next_list_alias_func; + fpe_functions[num_fpe_types].set_path_hook = set_path_func; + + return num_fpe_types++; +} + +void +FreeFonts(void) +{ + if (patternCache) { + FreeFontPatternCache(patternCache); + patternCache = 0; + } + FreeFontPath(font_path_elements, num_fpes, TRUE); + font_path_elements = 0; + num_fpes = 0; + free(fpe_functions); + num_fpe_types = 0; + fpe_functions = (FPEFunctions *) 0; +} + +/* convenience functions for FS interface */ + +FontPtr +find_old_font(XID id) +{ + pointer pFont; + dixLookupResourceByType(&pFont, id, RT_NONE, serverClient, DixReadAccess); + return (FontPtr)pFont; +} + +Font +GetNewFontClientID(void) +{ + return FakeClientID(0); +} + +int +StoreFontClientFont(FontPtr pfont, Font id) +{ + return AddResource(id, RT_NONE, (pointer) pfont); +} + +void +DeleteFontClientID(Font id) +{ + FreeResource(id, RT_NONE); +} + +int +client_auth_generation(ClientPtr client) +{ + return 0; +} + +static int fs_handlers_installed = 0; +static unsigned int last_server_gen; + +int +init_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler) +{ + /* if server has reset, make sure the b&w handlers are reinstalled */ + if (last_server_gen < serverGeneration) { + last_server_gen = serverGeneration; + fs_handlers_installed = 0; + } + if (fs_handlers_installed == 0) { + if (!RegisterBlockAndWakeupHandlers(block_handler, + FontWakeup, (pointer) 0)) + return AllocError; + fs_handlers_installed++; + } + QueueFontWakeup(fpe); + return Successful; +} + +void +remove_fs_handlers(FontPathElementPtr fpe, BlockHandlerProcPtr block_handler, Bool all) +{ + if (all) { + /* remove the handlers if no one else is using them */ + if (--fs_handlers_installed == 0) { + RemoveBlockAndWakeupHandlers(block_handler, FontWakeup, + (pointer) 0); + } + } + RemoveFontWakeup(fpe); +} diff --git a/xorg-server/hw/xfree86/common/Makefile.am b/xorg-server/hw/xfree86/common/Makefile.am index 56caaa5ab..c031d4be3 100644 --- a/xorg-server/hw/xfree86/common/Makefile.am +++ b/xorg-server/hw/xfree86/common/Makefile.am @@ -1,93 +1,92 @@ -noinst_LTLIBRARIES = libcommon.la
-
-if XORG_BUS_SPARC
-SBUS_SOURCES = xf86sbusBus.c
-endif
-
-if XV
-XVSOURCES = xf86xv.c xf86xvmc.c
-XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h
-endif
-
-if XF86VIDMODE
-XF86VMODE_SDK = vidmodeproc.h
-endif
-
-if DGA
-DGASOURCES = xf86DGA.c
-endif
-
-RANDRSOURCES = xf86RandR.c
-
-BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES)
-
-MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes
-
-xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES)
- $(AM_V_GEN)cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@
- $(AM_V_GEN)echo >> $@
-
-BUILT_SOURCES = xf86DefModeSet.c
-
-AM_LDFLAGS = -r
-libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \
- xf86Cursor.c $(DGASOURCES) xf86DPMS.c \
- xf86Events.c xf86Globals.c xf86AutoConfig.c \
- xf86Option.c xf86Init.c xf86VGAarbiter.c \
- xf86VidMode.c xf86fbman.c xf86cmap.c \
- xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \
- xf86Mode.c xorgHelper.c \
- $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES)
-nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h
-libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la
-
-INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \
- -I$(srcdir)/../loader -I$(srcdir)/../parser \
- -I$(srcdir)/../vbe -I$(srcdir)/../int10 \
- -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \
- -I$(srcdir)/../modes -I$(srcdir)/../ramdac
-
-sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \
- xf86PciInfo.h xf86Priv.h xf86Privstr.h \
- xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \
- $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \
- xf86sbusBus.h xf86VGAarbiter.h
-
-DISTCLEANFILES = xf86Build.h
-CLEANFILES = $(BUILT_SOURCES)
-
-EXTRA_DIST = \
- compiler.h \
- fourcc.h \
- scoasm.h \
- vidmodeproc.h \
- xf86.h \
- xf86Bus.h \
- xf86Config.h \
- xf86InPriv.h \
- xf86Module.h \
- xf86Opt.h \
- xf86PciInfo.h \
- xf86Priv.h \
- xf86Privstr.h \
- xf86Xinput.h \
- xf86cmap.h \
- xf86fbman.h \
- xf86pciBus.h \
- xf86str.h \
- xf86xv.h \
- xf86xvmc.h \
- xf86xvpriv.h \
- xisb.h \
- xorgVersion.h \
- $(MODEDEFSOURCES) \
- modeline2c.awk \
- xf86VGAarbiter.h \
- xf86VGAarbiterPriv.h \
- $(DISTKBDSOURCES)
-
-if LNXACPI
-XORG_CFLAGS += -DHAVE_ACPI
-endif
-
-AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS)
+noinst_LTLIBRARIES = libcommon.la + +if XORG_BUS_SPARC +SBUS_SOURCES = xf86sbusBus.c +endif + +if XV +XVSOURCES = xf86xv.c xf86xvmc.c +XVSDKINCS = xf86xv.h xf86xvmc.h xf86xvpriv.h +endif + +if XF86VIDMODE +XF86VMODE_SDK = vidmodeproc.h +endif + +if DGA +DGASOURCES = xf86DGA.c +endif + +RANDRSOURCES = xf86RandR.c + +BUSSOURCES = xf86pciBus.c xf86fbBus.c xf86noBus.c $(SBUS_SOURCES) + +MODEDEFSOURCES = $(srcdir)/vesamodes $(srcdir)/extramodes + +xf86DefModeSet.c: $(srcdir)/modeline2c.awk $(MODEDEFSOURCES) + $(AM_V_GEN)cat $(MODEDEFSOURCES) | LC_ALL=C $(AWK) -f $(srcdir)/modeline2c.awk > $@ + $(AM_V_GEN)echo >> $@ + +BUILT_SOURCES = xf86DefModeSet.c + +AM_LDFLAGS = -r +libcommon_la_SOURCES = xf86Configure.c xf86ShowOpts.c xf86Bus.c xf86Config.c \ + xf86Cursor.c $(DGASOURCES) xf86DPMS.c \ + xf86Events.c xf86Globals.c xf86AutoConfig.c \ + xf86Option.c xf86Init.c xf86VGAarbiter.c \ + xf86VidMode.c xf86fbman.c xf86cmap.c \ + xf86Helper.c xf86PM.c xf86Xinput.c xisb.c \ + xf86Mode.c xorgHelper.c \ + $(XVSOURCES) $(BUSSOURCES) $(RANDRSOURCES) +nodist_libcommon_la_SOURCES = xf86DefModeSet.c xf86Build.h +libcommon_la_LIBADD = $(top_builddir)/config/libconfig.la + +INCLUDES = $(XORG_INCS) -I$(srcdir)/../ddc -I$(srcdir)/../i2c \ + -I$(srcdir)/../loader -I$(srcdir)/../parser \ + -I$(srcdir)/../vbe -I$(srcdir)/../int10 \ + -I$(srcdir)/../vgahw -I$(srcdir)/../dixmods/extmod \ + -I$(srcdir)/../modes -I$(srcdir)/../ramdac + +sdk_HEADERS = compiler.h fourcc.h xf86.h xf86Module.h xf86Opt.h \ + xf86PciInfo.h xf86Priv.h xf86Privstr.h \ + xf86cmap.h xf86fbman.h xf86str.h xf86Xinput.h xisb.h \ + $(XVSDKINCS) $(XF86VMODE_SDK) xorgVersion.h \ + xf86sbusBus.h xf86VGAarbiter.h + +DISTCLEANFILES = xf86Build.h +CLEANFILES = $(BUILT_SOURCES) + +EXTRA_DIST = \ + compiler.h \ + fourcc.h \ + vidmodeproc.h \ + xf86.h \ + xf86Bus.h \ + xf86Config.h \ + xf86InPriv.h \ + xf86Module.h \ + xf86Opt.h \ + xf86PciInfo.h \ + xf86Priv.h \ + xf86Privstr.h \ + xf86Xinput.h \ + xf86cmap.h \ + xf86fbman.h \ + xf86pciBus.h \ + xf86str.h \ + xf86xv.h \ + xf86xvmc.h \ + xf86xvpriv.h \ + xisb.h \ + xorgVersion.h \ + $(MODEDEFSOURCES) \ + modeline2c.awk \ + xf86VGAarbiter.h \ + xf86VGAarbiterPriv.h \ + $(DISTKBDSOURCES) + +if LNXACPI +XORG_CFLAGS += -DHAVE_ACPI +endif + +AM_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) diff --git a/xorg-server/hw/xfree86/common/compiler.h b/xorg-server/hw/xfree86/common/compiler.h index 4cbe47c98..9e00d7571 100644 --- a/xorg-server/hw/xfree86/common/compiler.h +++ b/xorg-server/hw/xfree86/common/compiler.h @@ -1,1786 +1,1773 @@ -/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
- *
- */
-/*
- * Copyright (c) 1994-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).
- */
-
-#ifndef _COMPILER_H
-
-# define _COMPILER_H
-
-#if defined(__SUNPRO_C)
-# define DO_PROTOTYPES
-#endif
-
-/* Map Sun compiler platform defines to gcc-style used in the code */
-#if defined(__amd64) && !defined(__amd64__)
-# define __amd64__
-#endif
-#if defined(__i386) && !defined(__i386__)
-# define __i386__
-#endif
-#if defined(__sparc) && !defined(__sparc__)
-# define __sparc__
-#endif
-#if defined(__sparcv9) && !defined(__sparc64__)
-# define __sparc64__
-#endif
-
-#ifndef _X_EXPORT
-# include <X11/Xfuncproto.h>
-#endif
-
-# include <pixman.h> /* for uint*_t types */
-
-/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */
-# ifndef __inline__
-# if defined(__GNUC__)
- /* gcc has __inline__ */
-# elif defined(__HIGHC__)
-# define __inline__ _Inline
-# else
-# define __inline__ /**/
-# endif
-# endif /* __inline__ */
-# ifndef __inline
-# if defined(__GNUC__)
- /* gcc has __inline */
-# elif defined(__HIGHC__)
-# define __inline _Inline
-# else
-# define __inline /**/
-# endif
-# endif /* __inline */
-
-/* Support gcc's __FUNCTION__ for people using other compilers */
-#if !defined(__GNUC__) && !defined(__FUNCTION__)
-# define __FUNCTION__ __func__ /* C99 */
-#endif
-
-# if defined(NO_INLINE) || defined(DO_PROTOTYPES)
-
-# if !defined(__arm__)
-# if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \
- && !(defined(__alpha__) && defined(linux)) \
- && !(defined(__ia64__) && defined(linux)) \
-
-extern _X_EXPORT void outb(unsigned short, unsigned char);
-extern _X_EXPORT void outw(unsigned short, unsigned short);
-extern _X_EXPORT void outl(unsigned short, unsigned int);
-extern _X_EXPORT unsigned int inb(unsigned short);
-extern _X_EXPORT unsigned int inw(unsigned short);
-extern _X_EXPORT unsigned int inl(unsigned short);
-
-# else /* __sparc__, __arm32__, __alpha__, __nds32__ */
-
-extern _X_EXPORT void outb(unsigned long, unsigned char);
-extern _X_EXPORT void outw(unsigned long, unsigned short);
-extern _X_EXPORT void outl(unsigned long, unsigned int);
-extern _X_EXPORT unsigned int inb(unsigned long);
-extern _X_EXPORT unsigned int inw(unsigned long);
-extern _X_EXPORT unsigned int inl(unsigned long);
-
-# endif /* __sparc__, __arm32__, __alpha__, __nds32__ */
-# endif /* __arm__ */
-
-# if defined(__powerpc__) && !defined(__OpenBSD__)
-extern unsigned long ldq_u(unsigned long *);
-extern unsigned long ldl_u(unsigned int *);
-extern unsigned long ldw_u(unsigned short *);
-extern void stq_u(unsigned long, unsigned long *);
-extern void stl_u(unsigned long, unsigned int *);
-extern void stw_u(unsigned long, unsigned short *);
-extern void mem_barrier(void);
-extern void write_mem_barrier(void);
-extern void stl_brx(unsigned long, volatile unsigned char *, int);
-extern void stw_brx(unsigned short, volatile unsigned char *, int);
-extern unsigned long ldl_brx(volatile unsigned char *, int);
-extern unsigned short ldw_brx(volatile unsigned char *, int);
-# endif /* __powerpc__ && !__OpenBSD */
-
-# endif /* NO_INLINE || DO_PROTOTYPES */
-
-# ifndef NO_INLINE
-# ifdef __GNUC__
-# ifdef __i386__
-
-# ifdef __SSE__
-# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
-# else
-# define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
-# endif
-
-# ifdef __SSE2__
-# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
-# else
-# define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory")
-# endif
-
-# elif defined __alpha__
-
-# define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
-
-# elif defined __amd64__
-
-# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory")
-
-# elif defined __ia64__
-
-# ifndef __INTEL_COMPILER
-# define mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
-# define write_mem_barrier() __asm__ __volatile__ ("mf" : : : "memory")
-# else
-# include "ia64intrin.h"
-# define mem_barrier() __mf()
-# define write_mem_barrier() __mf()
-# endif
-
-# elif defined __mips__
- /* Note: sync instruction requires MIPS II instruction set */
-# define mem_barrier() \
- __asm__ __volatile__( \
- ".set push\n\t" \
- ".set noreorder\n\t" \
- ".set mips2\n\t" \
- "sync\n\t" \
- ".set pop" \
- : /* no output */ \
- : /* no input */ \
- : "memory")
-# define write_mem_barrier() mem_barrier()
-
-# elif defined __powerpc__
-
-# if defined(linux) && defined(__powerpc64__)
-# include <linux/version.h>
-# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0)
-# include <asm/memory.h>
-# endif
-# endif /* defined(linux) && defined(__powerpc64__) */
-
-# ifndef eieio /* We deal with arch-specific eieio() routines above... */
-# define eieio() __asm__ __volatile__ ("eieio" ::: "memory")
-# endif /* eieio */
-# define mem_barrier() eieio()
-# define write_mem_barrier() eieio()
-
-# elif defined __sparc__
-
-# define barrier() __asm__ __volatile__ (".word 0x8143e00a" : : : "memory")
-# define mem_barrier() /* XXX: nop for now */
-# define write_mem_barrier() /* XXX: nop for now */
-# endif
-# endif /* __GNUC__ */
-# endif /* NO_INLINE */
-
-# ifndef mem_barrier
-# define mem_barrier() /* NOP */
-# endif
-
-# ifndef write_mem_barrier
-# define write_mem_barrier() /* NOP */
-# endif
-
-
-# ifndef NO_INLINE
-# ifdef __GNUC__
-
-/* Define some packed structures to use with unaligned accesses */
-
-struct __una_u64 { uint64_t x __attribute__((packed)); };
-struct __una_u32 { uint32_t x __attribute__((packed)); };
-struct __una_u16 { uint16_t x __attribute__((packed)); };
-
-/* Elemental unaligned loads */
-
-static __inline__ uint64_t ldq_u(uint64_t *p)
-{
- const struct __una_u64 *ptr = (const struct __una_u64 *) p;
- return ptr->x;
-}
-
-static __inline__ uint32_t ldl_u(uint32_t *p)
-{
- const struct __una_u32 *ptr = (const struct __una_u32 *) p;
- return ptr->x;
-}
-
-static __inline__ uint16_t ldw_u(uint16_t *p)
-{
- const struct __una_u16 *ptr = (const struct __una_u16 *) p;
- return ptr->x;
-}
-
-/* Elemental unaligned stores */
-
-static __inline__ void stq_u(uint64_t val, uint64_t *p)
-{
- struct __una_u64 *ptr = (struct __una_u64 *) p;
- ptr->x = val;
-}
-
-static __inline__ void stl_u(uint32_t val, uint32_t *p)
-{
- struct __una_u32 *ptr = (struct __una_u32 *) p;
- ptr->x = val;
-}
-
-static __inline__ void stw_u(uint16_t val, uint16_t *p)
-{
- struct __una_u16 *ptr = (struct __una_u16 *) p;
- ptr->x = val;
-}
-# else /* !__GNUC__ */
-
-#include <string.h> /* needed for memmove */
-
-static __inline__ uint64_t ldq_u(uint64_t *p)
-{
- uint64_t ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
-}
-
-static __inline__ uint32_t ldl_u(uint32_t *p)
-{
- uint32_t ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
-}
-
-static __inline__ uint16_t ldw_u(uint16_t *p)
-{
- uint16_t ret;
- memmove(&ret, p, sizeof(*p));
- return ret;
-}
-
-static __inline__ void stq_u(uint64_t val, uint64_t *p)
-{
- uint64_t tmp = val;
- memmove(p, &tmp, sizeof(*p));
-}
-
-static __inline__ void stl_u(uint32_t val, uint32_t *p)
-{
- uint32_t tmp = val;
- memmove(p, &tmp, sizeof(*p));
-}
-
-static __inline__ void stw_u(uint16_t val, uint16_t *p)
-{
- uint16_t tmp = val;
- memmove(p, &tmp, sizeof(*p));
-}
-
-# endif /* __GNUC__ */
-# endif /* NO_INLINE */
-
-# ifndef NO_INLINE
-# ifdef __GNUC__
-# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__))
-
-# ifdef linux
-/* for Linux on Alpha, we use the LIBC _inx/_outx routines */
-/* note that the appropriate setup via "ioperm" needs to be done */
-/* *before* any inx/outx is done. */
-
-extern _X_EXPORT void _outb(unsigned char val, unsigned long port);
-extern _X_EXPORT void _outw(unsigned short val, unsigned long port);
-extern _X_EXPORT void _outl(unsigned int val, unsigned long port);
-extern _X_EXPORT unsigned int _inb(unsigned long port);
-extern _X_EXPORT unsigned int _inw(unsigned long port);
-extern _X_EXPORT unsigned int _inl(unsigned long port);
-
-static __inline__ void
-outb(unsigned long port, unsigned char val)
-{
- _outb(val, port);
-}
-
-static __inline__ void
-outw(unsigned long port, unsigned short val)
-{
- _outw(val, port);
-}
-
-static __inline__ void
-outl(unsigned long port, unsigned int val)
-{
- _outl(val, port);
-}
-
-static __inline__ unsigned int
-inb(unsigned long port)
-{
- return _inb(port);
-}
-
-static __inline__ unsigned int
-inw(unsigned long port)
-{
- return _inw(port);
-}
-
-static __inline__ unsigned int
-inl(unsigned long port)
-{
- return _inl(port);
-}
-
-# endif /* linux */
-
-# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \
- && !defined(DO_PROTOTYPES)
-
-/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */
-/* inx/outx routines */
-/* note that the appropriate setup via "ioperm" needs to be done */
-/* *before* any inx/outx is done. */
-
-extern _X_EXPORT void outb(unsigned int port, unsigned char val);
-extern _X_EXPORT void outw(unsigned int port, unsigned short val);
-extern _X_EXPORT void outl(unsigned int port, unsigned int val);
-extern _X_EXPORT unsigned char inb(unsigned int port);
-extern _X_EXPORT unsigned short inw(unsigned int port);
-extern _X_EXPORT unsigned int inl(unsigned int port);
-
-# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */
-
-
-#if defined(__NetBSD__)
-#include <machine/pio.h>
-#endif /* __NetBSD__ */
-
-# elif defined(linux) && defined(__ia64__)
-
-# include <inttypes.h>
-
-# include <sys/io.h>
-
-# undef outb
-# undef outw
-# undef outl
-# undef inb
-# undef inw
-# undef inl
-extern _X_EXPORT void outb(unsigned long port, unsigned char val);
-extern _X_EXPORT void outw(unsigned long port, unsigned short val);
-extern _X_EXPORT void outl(unsigned long port, unsigned int val);
-extern _X_EXPORT unsigned int inb(unsigned long port);
-extern _X_EXPORT unsigned int inw(unsigned long port);
-extern _X_EXPORT unsigned int inl(unsigned long port);
-
-# elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__)
-
-# include <inttypes.h>
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
- __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
-}
-
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
- __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
- unsigned short ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-# elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__)
-
-# ifndef ASI_PL
-# define ASI_PL 0x88
-# endif
-
-static __inline__ void
-outb(unsigned long port, unsigned char val)
-{
- __asm__ __volatile__("stba %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (port), "i" (ASI_PL));
- barrier();
-}
-
-static __inline__ void
-outw(unsigned long port, unsigned short val)
-{
- __asm__ __volatile__("stha %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (port), "i" (ASI_PL));
- barrier();
-}
-
-static __inline__ void
-outl(unsigned long port, unsigned int val)
-{
- __asm__ __volatile__("sta %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (port), "i" (ASI_PL));
- barrier();
-}
-
-static __inline__ unsigned int
-inb(unsigned long port)
-{
- unsigned int ret;
- __asm__ __volatile__("lduba [%1] %2, %0"
- : "=r" (ret)
- : "r" (port), "i" (ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned int
-inw(unsigned long port)
-{
- unsigned int ret;
- __asm__ __volatile__("lduha [%1] %2, %0"
- : "=r" (ret)
- : "r" (port), "i" (ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned int
-inl(unsigned long port)
-{
- unsigned int ret;
- __asm__ __volatile__("lda [%1] %2, %0"
- : "=r" (ret)
- : "r" (port), "i" (ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned char
-xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned char ret;
-
- __asm__ __volatile__("lduba [%1] %2, %0"
- : "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned short
-xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned short ret;
-
- __asm__ __volatile__("lduh [%1], %0"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ unsigned short
-xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned short ret;
-
- __asm__ __volatile__("lduha [%1] %2, %0"
- : "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
- return ret;
-}
-
-static __inline__ unsigned int
-xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
-
- __asm__ __volatile__("ld [%1], %0"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ unsigned int
-xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
-
- __asm__ __volatile__("lda [%1] %2, %0"
- : "=r" (ret)
- : "r" (addr), "i" (ASI_PL));
- return ret;
-}
-
-static __inline__ void
-xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("stba %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("sth %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("stha %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("st %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("sta %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("stba %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
-}
-
-static __inline__ void
-xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("sth %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-static __inline__ void
-xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("stha %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
-}
-
-static __inline__ void
-xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("st %0, [%1]"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-static __inline__ void
-xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("sta %0, [%1] %2"
- : /* No outputs */
- : "r" (val), "r" (addr), "i" (ASI_PL));
-}
-
-# elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__))
-# ifdef __arm32__
-# define PORT_SIZE long
-# else
-# define PORT_SIZE short
-# endif
-
-_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */
-
-static __inline__ void
-outb(unsigned PORT_SIZE port, unsigned char val)
-{
- *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
-}
-
-static __inline__ void
-outw(unsigned PORT_SIZE port, unsigned short val)
-{
- *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
-}
-
-static __inline__ void
-outl(unsigned PORT_SIZE port, unsigned int val)
-{
- *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val;
-}
-
-static __inline__ unsigned int
-inb(unsigned PORT_SIZE port)
-{
- return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase);
-}
-
-static __inline__ unsigned int
-inw(unsigned PORT_SIZE port)
-{
- return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase);
-}
-
-static __inline__ unsigned int
-inl(unsigned PORT_SIZE port)
-{
- return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase);
-}
-
-
-# if defined(__mips__)
-# ifdef linux /* don't mess with other OSs */
-# if X_BYTE_ORDER == X_BIG_ENDIAN
-static __inline__ unsigned int
-xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
-
- __asm__ __volatile__("lw %0, 0(%1)"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ void
-xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__("sw %0, 0(%1)"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-# endif
-# endif /* !linux */
-# endif /* __mips__ */
-
-# elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__)
-
-# ifndef MAP_FAILED
-# define MAP_FAILED ((void *)-1)
-# endif
-
-extern _X_EXPORT volatile unsigned char *ioBase;
-
-static __inline__ unsigned char
-xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
-{
- register unsigned char val;
- __asm__ __volatile__(
- "lbzx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
-}
-
-static __inline__ unsigned short
-xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset)
-{
- register unsigned short val;
- __asm__ __volatile__(
- "lhzx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
-}
-
-static __inline__ unsigned short
-xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset)
-{
- register unsigned short val;
- __asm__ __volatile__(
- "lhbrx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
-}
-
-static __inline__ unsigned int
-xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset)
-{
- register unsigned int val;
- __asm__ __volatile__(
- "lwzx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
-}
-
-static __inline__ unsigned int
-xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset)
-{
- register unsigned int val;
- __asm__ __volatile__(
- "lwbrx %0,%1,%2\n\t"
- "eieio"
- : "=r" (val)
- : "b" (base), "r" (offset),
- "m" (*((volatile unsigned char *)base+offset)));
- return val;
-}
-
-static __inline__ void
-xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset,
- const unsigned char val)
-{
- __asm__ __volatile__(
- "stbx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
-}
-
-static __inline__ void
-xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset,
- const unsigned short val)
-{
- __asm__ __volatile__(
- "sthbrx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
-}
-
-static __inline__ void
-xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset,
- const unsigned short val)
-{
- __asm__ __volatile__(
- "sthx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
-}
-
-static __inline__ void
-xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- __asm__ __volatile__(
- "stwbrx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
-}
-
-static __inline__ void
-xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- __asm__ __volatile__(
- "stwx %1,%2,%3\n\t"
- : "=m" (*((volatile unsigned char *)base+offset))
- : "r" (val), "b" (base), "r" (offset));
-}
-
-static __inline__ void
-xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
- const unsigned char val)
-{
- xf86WriteMmioNB8(base, offset, val);
- eieio();
-}
-
-static __inline__ void
-xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset,
- const unsigned short val)
-{
- xf86WriteMmioNB16Le(base, offset, val);
- eieio();
-}
-
-static __inline__ void
-xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset,
- const unsigned short val)
-{
- xf86WriteMmioNB16Be(base, offset, val);
- eieio();
-}
-
-static __inline__ void
-xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- xf86WriteMmioNB32Le(base, offset, val);
- eieio();
-}
-
-static __inline__ void
-xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- xf86WriteMmioNB32Be(base, offset, val);
- eieio();
-}
-
-
-static __inline__ void
-outb(unsigned short port, unsigned char value)
-{
- if(ioBase == MAP_FAILED) return;
- xf86WriteMmio8((void *)ioBase, port, value);
-}
-
-static __inline__ void
-outw(unsigned short port, unsigned short value)
-{
- if(ioBase == MAP_FAILED) return;
- xf86WriteMmio16Le((void *)ioBase, port, value);
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int value)
-{
- if(ioBase == MAP_FAILED) return;
- xf86WriteMmio32Le((void *)ioBase, port, value);
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
- if(ioBase == MAP_FAILED) return 0;
- return xf86ReadMmio8((void *)ioBase, port);
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
- if(ioBase == MAP_FAILED) return 0;
- return xf86ReadMmio16Le((void *)ioBase, port);
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
- if(ioBase == MAP_FAILED) return 0;
- return xf86ReadMmio32Le((void *)ioBase, port);
-}
-
-#elif defined(__arm__) && defined(__linux__)
-
-/* for Linux on ARM, we use the LIBC inx/outx routines */
-/* note that the appropriate setup via "ioperm" needs to be done */
-/* *before* any inx/outx is done. */
-
-#include <sys/io.h>
-
-static __inline__ void
-xf_outb(unsigned short port, unsigned char val)
-{
- outb(val, port);
-}
-
-static __inline__ void
-xf_outw(unsigned short port, unsigned short val)
-{
- outw(val, port);
-}
-
-static __inline__ void
-xf_outl(unsigned short port, unsigned int val)
-{
- outl(val, port);
-}
-
-#define outb xf_outb
-#define outw xf_outw
-#define outl xf_outl
-
-# elif defined(__nds32__)
-
-/*
- * Assume all port access are aligned. We need to revise this implementation
- * if there is unaligned port access. For ldq_u, ldl_u, ldw_u, stq_u, stl_u and
- * stw_u, they are assumed unaligned.
- */
-
-#define barrier() /* no barrier */
-
-#define PORT_SIZE long
-
-static __inline__ unsigned char
-xf86ReadMmio8(__volatile__ void *base, const unsigned long offset)
-{
- return *(volatile unsigned char *)((unsigned char *)base + offset) ;
-}
-
-static __inline__ void
-xf86WriteMmio8(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- *(volatile unsigned char *)((unsigned char *)base + offset) = val ;
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- *(volatile unsigned char *)((unsigned char *)base + offset) = val ;
-}
-
-static __inline__ unsigned short
-xf86ReadMmio16Swap(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned short ret;
-
- __asm__ __volatile__(
- "lhi %0, [%1];\n\t"
- "wsbh %0, %0;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ unsigned short
-xf86ReadMmio16(__volatile__ void *base, const unsigned long offset)
-{
- return *(volatile unsigned short *)((char *)base + offset) ;
-}
-
-static __inline__ void
-xf86WriteMmio16Swap(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "shi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio16(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- *(volatile unsigned short *)((unsigned char *)base + offset) = val ;
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio16SwapNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "shi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-static __inline__ void
-xf86WriteMmio16NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- *(volatile unsigned short *)((unsigned char *)base + offset) = val ;
-}
-
-static __inline__ unsigned int
-xf86ReadMmio32Swap(__volatile__ void *base, const unsigned long offset)
-{
- unsigned long addr = ((unsigned long)base) + offset;
- unsigned int ret;
-
- __asm__ __volatile__(
- "lwi %0, [%1];\n\t"
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ unsigned int
-xf86ReadMmio32(__volatile__ void *base, const unsigned long offset)
-{
- return *(volatile unsigned int *)((unsigned char *)base + offset) ;
-}
-
-static __inline__ void
-xf86WriteMmio32Swap(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "swi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio32(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- *(volatile unsigned int *)((unsigned char *)base + offset) = val ;
- barrier();
-}
-
-static __inline__ void
-xf86WriteMmio32SwapNB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- unsigned long addr = ((unsigned long)base) + offset;
-
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "swi %0, [%1];\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-static __inline__ void
-xf86WriteMmio32NB(__volatile__ void *base, const unsigned long offset,
- const unsigned int val)
-{
- *(volatile unsigned int *)((unsigned char *)base + offset) = val ;
-}
-
-# if defined(NDS32_MMIO_SWAP)
-static __inline__ void
-outb(unsigned PORT_SIZE port, unsigned char val)
-{
- xf86WriteMmio8(IOPortBase, port, val);
-}
-
-static __inline__ void
-outw(unsigned PORT_SIZE port, unsigned short val)
-{
- xf86WriteMmio16Swap(IOPortBase, port, val);
-}
-
-static __inline__ void
-outl(unsigned PORT_SIZE port, unsigned int val)
-{
- xf86WriteMmio32Swap(IOPortBase, port, val);
-}
-
-static __inline__ unsigned int
-inb(unsigned PORT_SIZE port)
-{
- return xf86ReadMmio8(IOPortBase, port);
-}
-
-static __inline__ unsigned int
-inw(unsigned PORT_SIZE port)
-{
- return xf86ReadMmio16Swap(IOPortBase, port);
-}
-
-static __inline__ unsigned int
-inl(unsigned PORT_SIZE port)
-{
- return xf86ReadMmio32Swap(IOPortBase, port);
-}
-
-static __inline__ unsigned long ldq_u(unsigned long *p)
-{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
-
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ unsigned long ldl_u(unsigned int *p)
-{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
-
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ void stq_u(unsigned long val, unsigned long *p)
-{
- unsigned long addr = (unsigned long)p;
-
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-static __inline__ void stl_u(unsigned long val, unsigned int *p)
-{
- unsigned long addr = (unsigned long)p;
-
- __asm__ __volatile__(
- "wsbh %0, %0;\n\t"
- "rotri %0, %0, 16;\n\t"
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-# else /* !NDS32_MMIO_SWAP */
-static __inline__ void
-outb(unsigned PORT_SIZE port, unsigned char val)
-{
- *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))) = val;
- barrier();
-}
-
-static __inline__ void
-outw(unsigned PORT_SIZE port, unsigned short val)
-{
- *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))) = val;
- barrier();
-}
-
-static __inline__ void
-outl(unsigned PORT_SIZE port, unsigned int val)
-{
- *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))) = val;
- barrier();
-}
-static __inline__ unsigned int
-inb(unsigned PORT_SIZE port)
-{
- return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port)));
-}
-
-static __inline__ unsigned int
-inw(unsigned PORT_SIZE port)
-{
- return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port)));
-}
-
-static __inline__ unsigned int
-inl(unsigned PORT_SIZE port)
-{
- return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port)));
-}
-
-static __inline__ unsigned long ldq_u(unsigned long *p)
-{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
-
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-static __inline__ unsigned long ldl_u(unsigned int *p)
-{
- unsigned long addr = (unsigned long)p;
- unsigned int ret;
-
- __asm__ __volatile__(
- "lmw.bi %0, [%1], %0, 0;\n\t"
- : "=r" (ret)
- : "r" (addr));
- return ret;
-}
-
-
-static __inline__ void stq_u(unsigned long val, unsigned long *p)
-{
- unsigned long addr = (unsigned long)p;
-
- __asm__ __volatile__(
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-
-static __inline__ void stl_u(unsigned long val, unsigned int *p)
-{
- unsigned long addr = (unsigned long)p;
-
- __asm__ __volatile__(
- "smw.bi %0, [%1], %0, 0;\n\t"
- : /* No outputs */
- : "r" (val), "r" (addr));
-}
-# endif /* NDS32_MMIO_SWAP */
-
-# if (((X_BYTE_ORDER == X_BIG_ENDIAN) && !defined(NDS32_MMIO_SWAP)) || ((X_BYTE_ORDER != X_BIG_ENDIAN) && defined(NDS32_MMIO_SWAP)))
-# define ldw_u(p) ((*(unsigned char *)(p)) << 8 | \
- (*((unsigned char *)(p)+1)))
-# define stw_u(v,p) (*(unsigned char *)(p)) = ((v) >> 8); \
- (*((unsigned char *)(p)+1)) = (v)
-# else
-# define ldw_u(p) ((*(unsigned char *)(p)) | \
- (*((unsigned char *)(p)+1)<<8))
-# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \
- (*((unsigned char *)(p)+1)) = ((v) >> 8)
-# endif
-
-# define mem_barrier() /* XXX: nop for now */
-# define write_mem_barrier() /* XXX: nop for now */
-
-# else /* ix86 */
-
-# if !defined(__SUNPRO_C)
-# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__)
-# ifdef GCCUSESGAS
-
-/*
- * If gcc uses gas rather than the native assembler, the syntax of these
- * inlines has to be different. DHD
- */
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
- __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port));
-}
-
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
- __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port));
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
- __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port));
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
- unsigned char ret;
- __asm__ __volatile__("inb %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
- unsigned short ret;
- __asm__ __volatile__("inw %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
- unsigned int ret;
- __asm__ __volatile__("inl %1,%0" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-# else /* GCCUSESGAS */
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
- __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port));
-}
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
- __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port));
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
- __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port));
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
- unsigned char ret;
- __asm__ __volatile__("in%B0 (%1)" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
- unsigned short ret;
- __asm__ __volatile__("in%W0 (%1)" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
- unsigned int ret;
- __asm__ __volatile__("in%L0 (%1)" :
- "=a" (ret) :
- "d" (port));
- return ret;
-}
-
-# endif /* GCCUSESGAS */
-
-# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */
-
-static __inline__ void
-outb(unsigned short port, unsigned char val)
-{
-}
-
-static __inline__ void
-outw(unsigned short port, unsigned short val)
-{
-}
-
-static __inline__ void
-outl(unsigned short port, unsigned int val)
-{
-}
-
-static __inline__ unsigned int
-inb(unsigned short port)
-{
- return 0;
-}
-
-static __inline__ unsigned int
-inw(unsigned short port)
-{
- return 0;
-}
-
-static __inline__ unsigned int
-inl(unsigned short port)
-{
- return 0;
-}
-
-# endif /* FAKEIT */
-# endif /* __SUNPRO_C */
-
-# endif /* ix86 */
-
-# else /* !GNUC */
-# if defined(__STDC__) && (__STDC__ == 1)
-# ifndef asm
-# define asm __asm
-# endif
-# endif
-# ifndef SCO325
-# if defined(__UNIXWARE__)
-# /* avoid including <sys/types.h> for <sys/inline.h> on UnixWare */
-# define ushort unsigned short
-# define ushort_t unsigned short
-# define ulong unsigned long
-# define ulong_t unsigned long
-# define uint_t unsigned int
-# define uchar_t unsigned char
-# endif /* __UNIXWARE__ */
-# if !defined(__SUNPRO_C)
-# include <sys/inline.h>
-# endif
-# else
-# include "scoasm.h"
-# endif
-# if !defined(__HIGHC__) && !defined(__SUNPRO_C) || \
- defined(__USLC__)
-# pragma asm partial_optimization outl
-# pragma asm partial_optimization outw
-# pragma asm partial_optimization outb
-# pragma asm partial_optimization inl
-# pragma asm partial_optimization inw
-# pragma asm partial_optimization inb
-# endif
-# endif /* __GNUC__ */
-
-# endif /* NO_INLINE */
-
-# ifdef __alpha__
-/* entry points for Mmio memory access routines */
-extern _X_EXPORT int (*xf86ReadMmio8)(void *, unsigned long);
-extern _X_EXPORT int (*xf86ReadMmio16)(void *, unsigned long);
-# ifndef STANDALONE_MMIO
-extern _X_EXPORT int (*xf86ReadMmio32)(void *, unsigned long);
-# else
-/* Some DRI 3D drivers need MMIO_IN32. */
-static __inline__ int
-xf86ReadMmio32(void *Base, unsigned long Offset)
-{
- mem_barrier();
- return *(volatile unsigned int*)((unsigned long)Base+(Offset));
-}
-# endif
-extern _X_EXPORT void (*xf86WriteMmio8)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio16)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmio32)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB8)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB16)(int, void *, unsigned long);
-extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long);
-extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int);
-extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int);
-
-/* Some macros to hide the system dependencies for MMIO accesses */
-/* Changed to kill noise generated by gcc's -Wcast-align */
-# define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset)
-# define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset)
-# ifndef STANDALONE_MMIO
-# define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset)
-# else
-# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
-# endif
-
-# define MMIO_OUT32(base, offset, val) \
- do { \
- write_mem_barrier(); \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \
- } while (0)
-# define MMIO_ONB32(base, offset, val) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-
-# define MMIO_OUT8(base, offset, val) \
- (*xf86WriteMmio8)((CARD8)(val), base, offset)
-# define MMIO_OUT16(base, offset, val) \
- (*xf86WriteMmio16)((CARD16)(val), base, offset)
-# define MMIO_ONB8(base, offset, val) \
- (*xf86WriteMmioNB8)((CARD8)(val), base, offset)
-# define MMIO_ONB16(base, offset, val) \
- (*xf86WriteMmioNB16)((CARD16)(val), base, offset)
-# define MMIO_MOVE32(base, offset, val) \
- MMIO_OUT32(base, offset, val)
-
-# elif defined(__powerpc__)
- /*
- * we provide byteswapping and no byteswapping functions here
- * with byteswapping as default,
- * drivers that don't need byteswapping should define PPC_MMIO_IS_BE
- */
-# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) \
- xf86WriteMmio8(base, offset, (CARD8)(val))
-# define MMIO_ONB8(base, offset, val) \
- xf86WriteMmioNB8(base, offset, (CARD8)(val))
-
-# if defined(PPC_MMIO_IS_BE) /* No byteswapping */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
-# define MMIO_OUT16(base, offset, val) \
- xf86WriteMmio16Be(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
- xf86WriteMmio32Be(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
- xf86WriteMmioNB16Be(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
- xf86WriteMmioNB32Be(base, offset, (CARD32)(val))
-# else /* byteswapping is the default */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
-# define MMIO_OUT16(base, offset, val) \
- xf86WriteMmio16Le(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
- xf86WriteMmio32Le(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
- xf86WriteMmioNB16Le(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
- xf86WriteMmioNB32Le(base, offset, (CARD32)(val))
-# endif
-
-# define MMIO_MOVE32(base, offset, val) \
- xf86WriteMmio32Be(base, offset, (CARD32)(val))
-
-# elif defined(__sparc__) || defined(sparc) || defined(__sparc)
- /*
- * Like powerpc, we provide byteswapping and no byteswapping functions
- * here with byteswapping as default, drivers that don't need byteswapping
- * should define SPARC_MMIO_IS_BE (perhaps create a generic macro so that we
- * do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places
- * of drivers?).
- */
-# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) \
- xf86WriteMmio8(base, offset, (CARD8)(val))
-# define MMIO_ONB8(base, offset, val) \
- xf86WriteMmio8NB(base, offset, (CARD8)(val))
-
-# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset)
-# define MMIO_OUT16(base, offset, val) \
- xf86WriteMmio16Be(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
- xf86WriteMmio32Be(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
- xf86WriteMmio16BeNB(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
- xf86WriteMmio32BeNB(base, offset, (CARD32)(val))
-# else /* byteswapping is the default */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset)
-# define MMIO_OUT16(base, offset, val) \
- xf86WriteMmio16Le(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
- xf86WriteMmio32Le(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
- xf86WriteMmio16LeNB(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
- xf86WriteMmio32LeNB(base, offset, (CARD32)(val))
-# endif
-
-# define MMIO_MOVE32(base, offset, val) \
- xf86WriteMmio32Be(base, offset, (CARD32)(val))
-
-# elif defined(__nds32__)
- /*
- * we provide byteswapping and no byteswapping functions here
- * with no byteswapping as default; when endianness of CPU core
- * and I/O devices don't match, byte swapping is necessary
- * drivers that need byteswapping should define NDS32_MMIO_SWAP
- */
-# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset)
-# define MMIO_OUT8(base, offset, val) \
- xf86WriteMmio8(base, offset, (CARD8)(val))
-# define MMIO_ONB8(base, offset, val) \
- xf86WriteMmioNB8(base, offset, (CARD8)(val))
-
-# if defined(NDS32_MMIO_SWAP) /* byteswapping */
-# define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32Swap(base, offset)
-# define MMIO_OUT16(base, offset, val) \
- xf86WriteMmio16Swap(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
- xf86WriteMmio32Swap(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
- xf86WriteMmioNB16Swap(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
- xf86WriteMmioNB32Swap(base, offset, (CARD32)(val))
-# else /* no byteswapping is the default */
-# define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset)
-# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset)
-# define MMIO_OUT16(base, offset, val) \
- xf86WriteMmio16(base, offset, (CARD16)(val))
-# define MMIO_OUT32(base, offset, val) \
- xf86WriteMmio32(base, offset, (CARD32)(val))
-# define MMIO_ONB16(base, offset, val) \
- xf86WriteMmioNB16(base, offset, (CARD16)(val))
-# define MMIO_ONB32(base, offset, val) \
- xf86WriteMmioNB32(base, offset, (CARD32)(val))
-# endif
-
-# define MMIO_MOVE32(base, offset, val) \
- xf86WriteMmio32(base, offset, (CARD32)(val))
-
-#ifdef N1213_HC /* for NDS32 N1213 hardcore */
-static __inline__ void nds32_flush_icache(char *addr)
-{
- __asm__ volatile (
- "isync %0;"
- "msync;"
- "isb;"
- "cctl %0,L1I_VA_INVAL;"
- "isb;"
- : : "r"(addr) : "memory");
-}
-#else
-static __inline__ void nds32_flush_icache(char *addr)
-{
- __asm__ volatile (
- "isync %0;"
- "isb;"
- : : "r"(addr) : "memory");
-}
-#endif
-
-# else /* !__alpha__ && !__powerpc__ && !__sparc__ */
-
-# define MMIO_IN8(base, offset) \
- *(volatile CARD8 *)(((CARD8*)(base)) + (offset))
-# define MMIO_IN16(base, offset) \
- *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset))
-# define MMIO_IN32(base, offset) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset))
-# define MMIO_OUT8(base, offset, val) \
- *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_OUT16(base, offset, val) \
- *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_OUT32(base, offset, val) \
- *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val)
-# define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val)
-# define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val)
-# define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val)
-
-# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val)
-
-# endif /* __alpha__ */
-
-/*
- * With Intel, the version in os-support/misc/SlowBcopy.s is used.
- * This avoids port I/O during the copy (which causes problems with
- * some hardware).
- */
-# ifdef __alpha__
-# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count)
-# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count)
-# else /* __alpha__ */
-# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count)
-# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count)
-# endif /* __alpha__ */
-
-#endif /* _COMPILER_H */
+/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * + * 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 Thomas Roell not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Roell makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS ROELL 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. + * + */ +/* + * Copyright (c) 1994-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). + */ + +#ifndef _COMPILER_H + +# define _COMPILER_H + +#if defined(__SUNPRO_C) +# define DO_PROTOTYPES +#endif + +/* Map Sun compiler platform defines to gcc-style used in the code */ +#if defined(__amd64) && !defined(__amd64__) +# define __amd64__ +#endif +#if defined(__i386) && !defined(__i386__) +# define __i386__ +#endif +#if defined(__sparc) && !defined(__sparc__) +# define __sparc__ +#endif +#if defined(__sparcv9) && !defined(__sparc64__) +# define __sparc64__ +#endif + +#ifndef _X_EXPORT +# include <X11/Xfuncproto.h> +#endif + +# include <pixman.h> /* for uint*_t types */ + +/* Allow drivers to use the GCC-supported __inline__ and/or __inline. */ +# ifndef __inline__ +# if defined(__GNUC__) + /* gcc has __inline__ */ +# elif defined(__HIGHC__) +# define __inline__ _Inline +# else +# define __inline__ /**/ +# endif +# endif /* __inline__ */ +# ifndef __inline +# if defined(__GNUC__) + /* gcc has __inline */ +# elif defined(__HIGHC__) +# define __inline _Inline +# else +# define __inline /**/ +# endif +# endif /* __inline */ + +/* Support gcc's __FUNCTION__ for people using other compilers */ +#if !defined(__GNUC__) && !defined(__FUNCTION__) +# define __FUNCTION__ __func__ /* C99 */ +#endif + +# if defined(NO_INLINE) || defined(DO_PROTOTYPES) + +# if !defined(__arm__) +# if !defined(__sparc__) && !defined(__sparc) && !defined(__arm32__) && !defined(__nds32__) \ + && !(defined(__alpha__) && defined(linux)) \ + && !(defined(__ia64__) && defined(linux)) \ + +extern _X_EXPORT void outb(unsigned short, unsigned char); +extern _X_EXPORT void outw(unsigned short, unsigned short); +extern _X_EXPORT void outl(unsigned short, unsigned int); +extern _X_EXPORT unsigned int inb(unsigned short); +extern _X_EXPORT unsigned int inw(unsigned short); +extern _X_EXPORT unsigned int inl(unsigned short); + +# else /* __sparc__, __arm32__, __alpha__, __nds32__ */ + +extern _X_EXPORT void outb(unsigned long, unsigned char); +extern _X_EXPORT void outw(unsigned long, unsigned short); +extern _X_EXPORT void outl(unsigned long, unsigned int); +extern _X_EXPORT unsigned int inb(unsigned long); +extern _X_EXPORT unsigned int inw(unsigned long); +extern _X_EXPORT unsigned int inl(unsigned long); + +# endif /* __sparc__, __arm32__, __alpha__, __nds32__ */ +# endif /* __arm__ */ + +# if defined(__powerpc__) && !defined(__OpenBSD__) +extern unsigned long ldq_u(unsigned long *); +extern unsigned long ldl_u(unsigned int *); +extern unsigned long ldw_u(unsigned short *); +extern void stq_u(unsigned long, unsigned long *); +extern void stl_u(unsigned long, unsigned int *); +extern void stw_u(unsigned long, unsigned short *); +extern void mem_barrier(void); +extern void write_mem_barrier(void); +extern void stl_brx(unsigned long, volatile unsigned char *, int); +extern void stw_brx(unsigned short, volatile unsigned char *, int); +extern unsigned long ldl_brx(volatile unsigned char *, int); +extern unsigned short ldw_brx(volatile unsigned char *, int); +# endif /* __powerpc__ && !__OpenBSD */ + +# endif /* NO_INLINE || DO_PROTOTYPES */ + +# ifndef NO_INLINE +# ifdef __GNUC__ +# ifdef __i386__ + +# ifdef __SSE__ +# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory") +# else +# define write_mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory") +# endif + +# ifdef __SSE2__ +# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory") +# else +# define mem_barrier() __asm__ __volatile__ ("lock; addl $0,0(%%esp)" : : : "memory") +# endif + +# elif defined __alpha__ + +# define mem_barrier() __asm__ __volatile__ ("mb" : : : "memory") +# define write_mem_barrier() __asm__ __volatile__ ("wmb" : : : "memory") + +# elif defined __amd64__ + +# define mem_barrier() __asm__ __volatile__ ("mfence" : : : "memory") +# define write_mem_barrier() __asm__ __volatile__ ("sfence" : : : "memory") + +# elif defined __ia64__ + +# ifndef __INTEL_COMPILER +# define mem_barrier() __asm__ __volatile__ ("mf" : : : "memory") +# define write_mem_barrier() __asm__ __volatile__ ("mf" : : : "memory") +# else +# include "ia64intrin.h" +# define mem_barrier() __mf() +# define write_mem_barrier() __mf() +# endif + +# elif defined __mips__ + /* Note: sync instruction requires MIPS II instruction set */ +# define mem_barrier() \ + __asm__ __volatile__( \ + ".set push\n\t" \ + ".set noreorder\n\t" \ + ".set mips2\n\t" \ + "sync\n\t" \ + ".set pop" \ + : /* no output */ \ + : /* no input */ \ + : "memory") +# define write_mem_barrier() mem_barrier() + +# elif defined __powerpc__ + +# if defined(linux) && defined(__powerpc64__) +# include <linux/version.h> +# if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 0) +# include <asm/memory.h> +# endif +# endif /* defined(linux) && defined(__powerpc64__) */ + +# ifndef eieio /* We deal with arch-specific eieio() routines above... */ +# define eieio() __asm__ __volatile__ ("eieio" ::: "memory") +# endif /* eieio */ +# define mem_barrier() eieio() +# define write_mem_barrier() eieio() + +# elif defined __sparc__ + +# define barrier() __asm__ __volatile__ (".word 0x8143e00a" : : : "memory") +# define mem_barrier() /* XXX: nop for now */ +# define write_mem_barrier() /* XXX: nop for now */ +# endif +# endif /* __GNUC__ */ +# endif /* NO_INLINE */ + +# ifndef mem_barrier +# define mem_barrier() /* NOP */ +# endif + +# ifndef write_mem_barrier +# define write_mem_barrier() /* NOP */ +# endif + + +# ifndef NO_INLINE +# ifdef __GNUC__ + +/* Define some packed structures to use with unaligned accesses */ + +struct __una_u64 { uint64_t x __attribute__((packed)); }; +struct __una_u32 { uint32_t x __attribute__((packed)); }; +struct __una_u16 { uint16_t x __attribute__((packed)); }; + +/* Elemental unaligned loads */ + +static __inline__ uint64_t ldq_u(uint64_t *p) +{ + const struct __una_u64 *ptr = (const struct __una_u64 *) p; + return ptr->x; +} + +static __inline__ uint32_t ldl_u(uint32_t *p) +{ + const struct __una_u32 *ptr = (const struct __una_u32 *) p; + return ptr->x; +} + +static __inline__ uint16_t ldw_u(uint16_t *p) +{ + const struct __una_u16 *ptr = (const struct __una_u16 *) p; + return ptr->x; +} + +/* Elemental unaligned stores */ + +static __inline__ void stq_u(uint64_t val, uint64_t *p) +{ + struct __una_u64 *ptr = (struct __una_u64 *) p; + ptr->x = val; +} + +static __inline__ void stl_u(uint32_t val, uint32_t *p) +{ + struct __una_u32 *ptr = (struct __una_u32 *) p; + ptr->x = val; +} + +static __inline__ void stw_u(uint16_t val, uint16_t *p) +{ + struct __una_u16 *ptr = (struct __una_u16 *) p; + ptr->x = val; +} +# else /* !__GNUC__ */ + +#include <string.h> /* needed for memmove */ + +static __inline__ uint64_t ldq_u(uint64_t *p) +{ + uint64_t ret; + memmove(&ret, p, sizeof(*p)); + return ret; +} + +static __inline__ uint32_t ldl_u(uint32_t *p) +{ + uint32_t ret; + memmove(&ret, p, sizeof(*p)); + return ret; +} + +static __inline__ uint16_t ldw_u(uint16_t *p) +{ + uint16_t ret; + memmove(&ret, p, sizeof(*p)); + return ret; +} + +static __inline__ void stq_u(uint64_t val, uint64_t *p) +{ + uint64_t tmp = val; + memmove(p, &tmp, sizeof(*p)); +} + +static __inline__ void stl_u(uint32_t val, uint32_t *p) +{ + uint32_t tmp = val; + memmove(p, &tmp, sizeof(*p)); +} + +static __inline__ void stw_u(uint16_t val, uint16_t *p) +{ + uint16_t tmp = val; + memmove(p, &tmp, sizeof(*p)); +} + +# endif /* __GNUC__ */ +# endif /* NO_INLINE */ + +# ifndef NO_INLINE +# ifdef __GNUC__ +# if (defined(linux) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)) && (defined(__alpha__)) + +# ifdef linux +/* for Linux on Alpha, we use the LIBC _inx/_outx routines */ +/* note that the appropriate setup via "ioperm" needs to be done */ +/* *before* any inx/outx is done. */ + +extern _X_EXPORT void _outb(unsigned char val, unsigned long port); +extern _X_EXPORT void _outw(unsigned short val, unsigned long port); +extern _X_EXPORT void _outl(unsigned int val, unsigned long port); +extern _X_EXPORT unsigned int _inb(unsigned long port); +extern _X_EXPORT unsigned int _inw(unsigned long port); +extern _X_EXPORT unsigned int _inl(unsigned long port); + +static __inline__ void +outb(unsigned long port, unsigned char val) +{ + _outb(val, port); +} + +static __inline__ void +outw(unsigned long port, unsigned short val) +{ + _outw(val, port); +} + +static __inline__ void +outl(unsigned long port, unsigned int val) +{ + _outl(val, port); +} + +static __inline__ unsigned int +inb(unsigned long port) +{ + return _inb(port); +} + +static __inline__ unsigned int +inw(unsigned long port) +{ + return _inw(port); +} + +static __inline__ unsigned int +inl(unsigned long port) +{ + return _inl(port); +} + +# endif /* linux */ + +# if (defined(__FreeBSD__) || defined(__OpenBSD__)) \ + && !defined(DO_PROTOTYPES) + +/* for FreeBSD and OpenBSD on Alpha, we use the libio (resp. libalpha) */ +/* inx/outx routines */ +/* note that the appropriate setup via "ioperm" needs to be done */ +/* *before* any inx/outx is done. */ + +extern _X_EXPORT void outb(unsigned int port, unsigned char val); +extern _X_EXPORT void outw(unsigned int port, unsigned short val); +extern _X_EXPORT void outl(unsigned int port, unsigned int val); +extern _X_EXPORT unsigned char inb(unsigned int port); +extern _X_EXPORT unsigned short inw(unsigned int port); +extern _X_EXPORT unsigned int inl(unsigned int port); + +# endif /* (__FreeBSD__ || __OpenBSD__ ) && !DO_PROTOTYPES */ + + +#if defined(__NetBSD__) +#include <machine/pio.h> +#endif /* __NetBSD__ */ + +# elif defined(linux) && defined(__ia64__) + +# include <inttypes.h> + +# include <sys/io.h> + +# undef outb +# undef outw +# undef outl +# undef inb +# undef inw +# undef inl +extern _X_EXPORT void outb(unsigned long port, unsigned char val); +extern _X_EXPORT void outw(unsigned long port, unsigned short val); +extern _X_EXPORT void outl(unsigned long port, unsigned int val); +extern _X_EXPORT unsigned int inb(unsigned long port); +extern _X_EXPORT unsigned int inw(unsigned long port); +extern _X_EXPORT unsigned int inl(unsigned long port); + +# elif (defined(linux) || defined(__FreeBSD__)) && defined(__amd64__) + +# include <inttypes.h> + +static __inline__ void +outb(unsigned short port, unsigned char val) +{ + __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); +} + + +static __inline__ void +outw(unsigned short port, unsigned short val) +{ + __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ void +outl(unsigned short port, unsigned int val) +{ + __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(unsigned short port) +{ + unsigned char ret; + __asm__ __volatile__("inb %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(unsigned short port) +{ + unsigned short ret; + __asm__ __volatile__("inw %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inl(unsigned short port) +{ + unsigned int ret; + __asm__ __volatile__("inl %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +# elif (defined(linux) || defined(sun) || defined(__OpenBSD__) || defined(__FreeBSD__)) && defined(__sparc__) + +# ifndef ASI_PL +# define ASI_PL 0x88 +# endif + +static __inline__ void +outb(unsigned long port, unsigned char val) +{ + __asm__ __volatile__("stba %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (port), "i" (ASI_PL)); + barrier(); +} + +static __inline__ void +outw(unsigned long port, unsigned short val) +{ + __asm__ __volatile__("stha %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (port), "i" (ASI_PL)); + barrier(); +} + +static __inline__ void +outl(unsigned long port, unsigned int val) +{ + __asm__ __volatile__("sta %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (port), "i" (ASI_PL)); + barrier(); +} + +static __inline__ unsigned int +inb(unsigned long port) +{ + unsigned int ret; + __asm__ __volatile__("lduba [%1] %2, %0" + : "=r" (ret) + : "r" (port), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned int +inw(unsigned long port) +{ + unsigned int ret; + __asm__ __volatile__("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (port), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned int +inl(unsigned long port) +{ + unsigned int ret; + __asm__ __volatile__("lda [%1] %2, %0" + : "=r" (ret) + : "r" (port), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned char +xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned char ret; + + __asm__ __volatile__("lduba [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned short +xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned short ret; + + __asm__ __volatile__("lduh [%1], %0" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ unsigned short +xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned short ret; + + __asm__ __volatile__("lduha [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + return ret; +} + +static __inline__ unsigned int +xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned int ret; + + __asm__ __volatile__("ld [%1], %0" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ unsigned int +xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned int ret; + + __asm__ __volatile__("lda [%1] %2, %0" + : "=r" (ret) + : "r" (addr), "i" (ASI_PL)); + return ret; +} + +static __inline__ void +xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("stba %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (addr), "i" (ASI_PL)); + barrier(); +} + +static __inline__ void +xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("sth %0, [%1]" + : /* No outputs */ + : "r" (val), "r" (addr)); + barrier(); +} + +static __inline__ void +xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("stha %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (addr), "i" (ASI_PL)); + barrier(); +} + +static __inline__ void +xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("st %0, [%1]" + : /* No outputs */ + : "r" (val), "r" (addr)); + barrier(); +} + +static __inline__ void +xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("sta %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (addr), "i" (ASI_PL)); + barrier(); +} + +static __inline__ void +xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("stba %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (addr), "i" (ASI_PL)); +} + +static __inline__ void +xf86WriteMmio16BeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("sth %0, [%1]" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +static __inline__ void +xf86WriteMmio16LeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("stha %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (addr), "i" (ASI_PL)); +} + +static __inline__ void +xf86WriteMmio32BeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("st %0, [%1]" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +static __inline__ void +xf86WriteMmio32LeNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("sta %0, [%1] %2" + : /* No outputs */ + : "r" (val), "r" (addr), "i" (ASI_PL)); +} + +# elif defined(__mips__) || (defined(__arm32__) && !defined(__linux__)) +# ifdef __arm32__ +# define PORT_SIZE long +# else +# define PORT_SIZE short +# endif + +_X_EXPORT unsigned int IOPortBase; /* Memory mapped I/O port area */ + +static __inline__ void +outb(unsigned PORT_SIZE port, unsigned char val) +{ + *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val; +} + +static __inline__ void +outw(unsigned PORT_SIZE port, unsigned short val) +{ + *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val; +} + +static __inline__ void +outl(unsigned PORT_SIZE port, unsigned int val) +{ + *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase) = val; +} + +static __inline__ unsigned int +inb(unsigned PORT_SIZE port) +{ + return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))+IOPortBase); +} + +static __inline__ unsigned int +inw(unsigned PORT_SIZE port) +{ + return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))+IOPortBase); +} + +static __inline__ unsigned int +inl(unsigned PORT_SIZE port) +{ + return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))+IOPortBase); +} + + +# if defined(__mips__) +# ifdef linux /* don't mess with other OSs */ +# if X_BYTE_ORDER == X_BIG_ENDIAN +static __inline__ unsigned int +xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned int ret; + + __asm__ __volatile__("lw %0, 0(%1)" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ void +xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__("sw %0, 0(%1)" + : /* No outputs */ + : "r" (val), "r" (addr)); +} +# endif +# endif /* !linux */ +# endif /* __mips__ */ + +# elif (defined(linux) || defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)) && defined(__powerpc__) + +# ifndef MAP_FAILED +# define MAP_FAILED ((void *)-1) +# endif + +extern _X_EXPORT volatile unsigned char *ioBase; + +static __inline__ unsigned char +xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) +{ + register unsigned char val; + __asm__ __volatile__( + "lbzx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +static __inline__ unsigned short +xf86ReadMmio16Be(__volatile__ void *base, const unsigned long offset) +{ + register unsigned short val; + __asm__ __volatile__( + "lhzx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +static __inline__ unsigned short +xf86ReadMmio16Le(__volatile__ void *base, const unsigned long offset) +{ + register unsigned short val; + __asm__ __volatile__( + "lhbrx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +static __inline__ unsigned int +xf86ReadMmio32Be(__volatile__ void *base, const unsigned long offset) +{ + register unsigned int val; + __asm__ __volatile__( + "lwzx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +static __inline__ unsigned int +xf86ReadMmio32Le(__volatile__ void *base, const unsigned long offset) +{ + register unsigned int val; + __asm__ __volatile__( + "lwbrx %0,%1,%2\n\t" + "eieio" + : "=r" (val) + : "b" (base), "r" (offset), + "m" (*((volatile unsigned char *)base+offset))); + return val; +} + +static __inline__ void +xf86WriteMmioNB8(__volatile__ void *base, const unsigned long offset, + const unsigned char val) +{ + __asm__ __volatile__( + "stbx %1,%2,%3\n\t" + : "=m" (*((volatile unsigned char *)base+offset)) + : "r" (val), "b" (base), "r" (offset)); +} + +static __inline__ void +xf86WriteMmioNB16Le(__volatile__ void *base, const unsigned long offset, + const unsigned short val) +{ + __asm__ __volatile__( + "sthbrx %1,%2,%3\n\t" + : "=m" (*((volatile unsigned char *)base+offset)) + : "r" (val), "b" (base), "r" (offset)); +} + +static __inline__ void +xf86WriteMmioNB16Be(__volatile__ void *base, const unsigned long offset, + const unsigned short val) +{ + __asm__ __volatile__( + "sthx %1,%2,%3\n\t" + : "=m" (*((volatile unsigned char *)base+offset)) + : "r" (val), "b" (base), "r" (offset)); +} + +static __inline__ void +xf86WriteMmioNB32Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + __asm__ __volatile__( + "stwbrx %1,%2,%3\n\t" + : "=m" (*((volatile unsigned char *)base+offset)) + : "r" (val), "b" (base), "r" (offset)); +} + +static __inline__ void +xf86WriteMmioNB32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + __asm__ __volatile__( + "stwx %1,%2,%3\n\t" + : "=m" (*((volatile unsigned char *)base+offset)) + : "r" (val), "b" (base), "r" (offset)); +} + +static __inline__ void +xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, + const unsigned char val) +{ + xf86WriteMmioNB8(base, offset, val); + eieio(); +} + +static __inline__ void +xf86WriteMmio16Le(__volatile__ void *base, const unsigned long offset, + const unsigned short val) +{ + xf86WriteMmioNB16Le(base, offset, val); + eieio(); +} + +static __inline__ void +xf86WriteMmio16Be(__volatile__ void *base, const unsigned long offset, + const unsigned short val) +{ + xf86WriteMmioNB16Be(base, offset, val); + eieio(); +} + +static __inline__ void +xf86WriteMmio32Le(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + xf86WriteMmioNB32Le(base, offset, val); + eieio(); +} + +static __inline__ void +xf86WriteMmio32Be(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + xf86WriteMmioNB32Be(base, offset, val); + eieio(); +} + + +static __inline__ void +outb(unsigned short port, unsigned char value) +{ + if(ioBase == MAP_FAILED) return; + xf86WriteMmio8((void *)ioBase, port, value); +} + +static __inline__ void +outw(unsigned short port, unsigned short value) +{ + if(ioBase == MAP_FAILED) return; + xf86WriteMmio16Le((void *)ioBase, port, value); +} + +static __inline__ void +outl(unsigned short port, unsigned int value) +{ + if(ioBase == MAP_FAILED) return; + xf86WriteMmio32Le((void *)ioBase, port, value); +} + +static __inline__ unsigned int +inb(unsigned short port) +{ + if(ioBase == MAP_FAILED) return 0; + return xf86ReadMmio8((void *)ioBase, port); +} + +static __inline__ unsigned int +inw(unsigned short port) +{ + if(ioBase == MAP_FAILED) return 0; + return xf86ReadMmio16Le((void *)ioBase, port); +} + +static __inline__ unsigned int +inl(unsigned short port) +{ + if(ioBase == MAP_FAILED) return 0; + return xf86ReadMmio32Le((void *)ioBase, port); +} + +#elif defined(__arm__) && defined(__linux__) + +/* for Linux on ARM, we use the LIBC inx/outx routines */ +/* note that the appropriate setup via "ioperm" needs to be done */ +/* *before* any inx/outx is done. */ + +#include <sys/io.h> + +static __inline__ void +xf_outb(unsigned short port, unsigned char val) +{ + outb(val, port); +} + +static __inline__ void +xf_outw(unsigned short port, unsigned short val) +{ + outw(val, port); +} + +static __inline__ void +xf_outl(unsigned short port, unsigned int val) +{ + outl(val, port); +} + +#define outb xf_outb +#define outw xf_outw +#define outl xf_outl + +# elif defined(__nds32__) + +/* + * Assume all port access are aligned. We need to revise this implementation + * if there is unaligned port access. For ldq_u, ldl_u, ldw_u, stq_u, stl_u and + * stw_u, they are assumed unaligned. + */ + +#define barrier() /* no barrier */ + +#define PORT_SIZE long + +static __inline__ unsigned char +xf86ReadMmio8(__volatile__ void *base, const unsigned long offset) +{ + return *(volatile unsigned char *)((unsigned char *)base + offset) ; +} + +static __inline__ void +xf86WriteMmio8(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + *(volatile unsigned char *)((unsigned char *)base + offset) = val ; + barrier(); +} + +static __inline__ void +xf86WriteMmio8NB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + *(volatile unsigned char *)((unsigned char *)base + offset) = val ; +} + +static __inline__ unsigned short +xf86ReadMmio16Swap(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned short ret; + + __asm__ __volatile__( + "lhi %0, [%1];\n\t" + "wsbh %0, %0;\n\t" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ unsigned short +xf86ReadMmio16(__volatile__ void *base, const unsigned long offset) +{ + return *(volatile unsigned short *)((char *)base + offset) ; +} + +static __inline__ void +xf86WriteMmio16Swap(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__( + "wsbh %0, %0;\n\t" + "shi %0, [%1];\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); + barrier(); +} + +static __inline__ void +xf86WriteMmio16(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + *(volatile unsigned short *)((unsigned char *)base + offset) = val ; + barrier(); +} + +static __inline__ void +xf86WriteMmio16SwapNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__( + "wsbh %0, %0;\n\t" + "shi %0, [%1];\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +static __inline__ void +xf86WriteMmio16NB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + *(volatile unsigned short *)((unsigned char *)base + offset) = val ; +} + +static __inline__ unsigned int +xf86ReadMmio32Swap(__volatile__ void *base, const unsigned long offset) +{ + unsigned long addr = ((unsigned long)base) + offset; + unsigned int ret; + + __asm__ __volatile__( + "lwi %0, [%1];\n\t" + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ unsigned int +xf86ReadMmio32(__volatile__ void *base, const unsigned long offset) +{ + return *(volatile unsigned int *)((unsigned char *)base + offset) ; +} + +static __inline__ void +xf86WriteMmio32Swap(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__( + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + "swi %0, [%1];\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); + barrier(); +} + +static __inline__ void +xf86WriteMmio32(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + *(volatile unsigned int *)((unsigned char *)base + offset) = val ; + barrier(); +} + +static __inline__ void +xf86WriteMmio32SwapNB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + unsigned long addr = ((unsigned long)base) + offset; + + __asm__ __volatile__( + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + "swi %0, [%1];\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +static __inline__ void +xf86WriteMmio32NB(__volatile__ void *base, const unsigned long offset, + const unsigned int val) +{ + *(volatile unsigned int *)((unsigned char *)base + offset) = val ; +} + +# if defined(NDS32_MMIO_SWAP) +static __inline__ void +outb(unsigned PORT_SIZE port, unsigned char val) +{ + xf86WriteMmio8(IOPortBase, port, val); +} + +static __inline__ void +outw(unsigned PORT_SIZE port, unsigned short val) +{ + xf86WriteMmio16Swap(IOPortBase, port, val); +} + +static __inline__ void +outl(unsigned PORT_SIZE port, unsigned int val) +{ + xf86WriteMmio32Swap(IOPortBase, port, val); +} + +static __inline__ unsigned int +inb(unsigned PORT_SIZE port) +{ + return xf86ReadMmio8(IOPortBase, port); +} + +static __inline__ unsigned int +inw(unsigned PORT_SIZE port) +{ + return xf86ReadMmio16Swap(IOPortBase, port); +} + +static __inline__ unsigned int +inl(unsigned PORT_SIZE port) +{ + return xf86ReadMmio32Swap(IOPortBase, port); +} + +static __inline__ unsigned long ldq_u(unsigned long *p) +{ + unsigned long addr = (unsigned long)p; + unsigned int ret; + + __asm__ __volatile__( + "lmw.bi %0, [%1], %0, 0;\n\t" + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ unsigned long ldl_u(unsigned int *p) +{ + unsigned long addr = (unsigned long)p; + unsigned int ret; + + __asm__ __volatile__( + "lmw.bi %0, [%1], %0, 0;\n\t" + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ void stq_u(unsigned long val, unsigned long *p) +{ + unsigned long addr = (unsigned long)p; + + __asm__ __volatile__( + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + "smw.bi %0, [%1], %0, 0;\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +static __inline__ void stl_u(unsigned long val, unsigned int *p) +{ + unsigned long addr = (unsigned long)p; + + __asm__ __volatile__( + "wsbh %0, %0;\n\t" + "rotri %0, %0, 16;\n\t" + "smw.bi %0, [%1], %0, 0;\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +# else /* !NDS32_MMIO_SWAP */ +static __inline__ void +outb(unsigned PORT_SIZE port, unsigned char val) +{ + *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))) = val; + barrier(); +} + +static __inline__ void +outw(unsigned PORT_SIZE port, unsigned short val) +{ + *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))) = val; + barrier(); +} + +static __inline__ void +outl(unsigned PORT_SIZE port, unsigned int val) +{ + *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))) = val; + barrier(); +} +static __inline__ unsigned int +inb(unsigned PORT_SIZE port) +{ + return *(volatile unsigned char*)(((unsigned PORT_SIZE)(port))); +} + +static __inline__ unsigned int +inw(unsigned PORT_SIZE port) +{ + return *(volatile unsigned short*)(((unsigned PORT_SIZE)(port))); +} + +static __inline__ unsigned int +inl(unsigned PORT_SIZE port) +{ + return *(volatile unsigned int*)(((unsigned PORT_SIZE)(port))); +} + +static __inline__ unsigned long ldq_u(unsigned long *p) +{ + unsigned long addr = (unsigned long)p; + unsigned int ret; + + __asm__ __volatile__( + "lmw.bi %0, [%1], %0, 0;\n\t" + : "=r" (ret) + : "r" (addr)); + return ret; +} + +static __inline__ unsigned long ldl_u(unsigned int *p) +{ + unsigned long addr = (unsigned long)p; + unsigned int ret; + + __asm__ __volatile__( + "lmw.bi %0, [%1], %0, 0;\n\t" + : "=r" (ret) + : "r" (addr)); + return ret; +} + + +static __inline__ void stq_u(unsigned long val, unsigned long *p) +{ + unsigned long addr = (unsigned long)p; + + __asm__ __volatile__( + "smw.bi %0, [%1], %0, 0;\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); +} + +static __inline__ void stl_u(unsigned long val, unsigned int *p) +{ + unsigned long addr = (unsigned long)p; + + __asm__ __volatile__( + "smw.bi %0, [%1], %0, 0;\n\t" + : /* No outputs */ + : "r" (val), "r" (addr)); +} +# endif /* NDS32_MMIO_SWAP */ + +# if (((X_BYTE_ORDER == X_BIG_ENDIAN) && !defined(NDS32_MMIO_SWAP)) || ((X_BYTE_ORDER != X_BIG_ENDIAN) && defined(NDS32_MMIO_SWAP))) +# define ldw_u(p) ((*(unsigned char *)(p)) << 8 | \ + (*((unsigned char *)(p)+1))) +# define stw_u(v,p) (*(unsigned char *)(p)) = ((v) >> 8); \ + (*((unsigned char *)(p)+1)) = (v) +# else +# define ldw_u(p) ((*(unsigned char *)(p)) | \ + (*((unsigned char *)(p)+1)<<8)) +# define stw_u(v,p) (*(unsigned char *)(p)) = (v); \ + (*((unsigned char *)(p)+1)) = ((v) >> 8) +# endif + +# define mem_barrier() /* XXX: nop for now */ +# define write_mem_barrier() /* XXX: nop for now */ + +# else /* ix86 */ + +# if !defined(__SUNPRO_C) +# if !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__s390__) && !defined(__m32r__) +# ifdef GCCUSESGAS + +/* + * If gcc uses gas rather than the native assembler, the syntax of these + * inlines has to be different. DHD + */ + +static __inline__ void +outb(unsigned short port, unsigned char val) +{ + __asm__ __volatile__("outb %0,%1" : :"a" (val), "d" (port)); +} + + +static __inline__ void +outw(unsigned short port, unsigned short val) +{ + __asm__ __volatile__("outw %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ void +outl(unsigned short port, unsigned int val) +{ + __asm__ __volatile__("outl %0,%1" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(unsigned short port) +{ + unsigned char ret; + __asm__ __volatile__("inb %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(unsigned short port) +{ + unsigned short ret; + __asm__ __volatile__("inw %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inl(unsigned short port) +{ + unsigned int ret; + __asm__ __volatile__("inl %1,%0" : + "=a" (ret) : + "d" (port)); + return ret; +} + +# else /* GCCUSESGAS */ + +static __inline__ void +outb(unsigned short port, unsigned char val) +{ + __asm__ __volatile__("out%B0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ void +outw(unsigned short port, unsigned short val) +{ + __asm__ __volatile__("out%W0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ void +outl(unsigned short port, unsigned int val) +{ + __asm__ __volatile__("out%L0 (%1)" : :"a" (val), "d" (port)); +} + +static __inline__ unsigned int +inb(unsigned short port) +{ + unsigned char ret; + __asm__ __volatile__("in%B0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inw(unsigned short port) +{ + unsigned short ret; + __asm__ __volatile__("in%W0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +static __inline__ unsigned int +inl(unsigned short port) +{ + unsigned int ret; + __asm__ __volatile__("in%L0 (%1)" : + "=a" (ret) : + "d" (port)); + return ret; +} + +# endif /* GCCUSESGAS */ + +# else /* !defined(FAKEIT) && !defined(__mc68000__) && !defined(__arm__) && !defined(__sh__) && !defined(__hppa__) && !defined(__m32r__) */ + +static __inline__ void +outb(unsigned short port, unsigned char val) +{ +} + +static __inline__ void +outw(unsigned short port, unsigned short val) +{ +} + +static __inline__ void +outl(unsigned short port, unsigned int val) +{ +} + +static __inline__ unsigned int +inb(unsigned short port) +{ + return 0; +} + +static __inline__ unsigned int +inw(unsigned short port) +{ + return 0; +} + +static __inline__ unsigned int +inl(unsigned short port) +{ + return 0; +} + +# endif /* FAKEIT */ +# endif /* __SUNPRO_C */ + +# endif /* ix86 */ + +# else /* !GNUC */ +# if defined(__STDC__) && (__STDC__ == 1) +# ifndef asm +# define asm __asm +# endif +# endif +# if !defined(__SUNPRO_C) +# include <sys/inline.h> +# endif +# if !defined(__HIGHC__) && !defined(__SUNPRO_C) || \ + defined(__USLC__) +# pragma asm partial_optimization outl +# pragma asm partial_optimization outw +# pragma asm partial_optimization outb +# pragma asm partial_optimization inl +# pragma asm partial_optimization inw +# pragma asm partial_optimization inb +# endif +# endif /* __GNUC__ */ + +# endif /* NO_INLINE */ + +# ifdef __alpha__ +/* entry points for Mmio memory access routines */ +extern _X_EXPORT int (*xf86ReadMmio8)(void *, unsigned long); +extern _X_EXPORT int (*xf86ReadMmio16)(void *, unsigned long); +# ifndef STANDALONE_MMIO +extern _X_EXPORT int (*xf86ReadMmio32)(void *, unsigned long); +# else +/* Some DRI 3D drivers need MMIO_IN32. */ +static __inline__ int +xf86ReadMmio32(void *Base, unsigned long Offset) +{ + mem_barrier(); + return *(volatile unsigned int*)((unsigned long)Base+(Offset)); +} +# endif +extern _X_EXPORT void (*xf86WriteMmio8)(int, void *, unsigned long); +extern _X_EXPORT void (*xf86WriteMmio16)(int, void *, unsigned long); +extern _X_EXPORT void (*xf86WriteMmio32)(int, void *, unsigned long); +extern _X_EXPORT void (*xf86WriteMmioNB8)(int, void *, unsigned long); +extern _X_EXPORT void (*xf86WriteMmioNB16)(int, void *, unsigned long); +extern _X_EXPORT void (*xf86WriteMmioNB32)(int, void *, unsigned long); +extern _X_EXPORT void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); +extern _X_EXPORT void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); + +/* Some macros to hide the system dependencies for MMIO accesses */ +/* Changed to kill noise generated by gcc's -Wcast-align */ +# define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset) +# define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset) +# ifndef STANDALONE_MMIO +# define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset) +# else +# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset) +# endif + +# define MMIO_OUT32(base, offset, val) \ + do { \ + write_mem_barrier(); \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ + } while (0) +# define MMIO_ONB32(base, offset, val) \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) + +# define MMIO_OUT8(base, offset, val) \ + (*xf86WriteMmio8)((CARD8)(val), base, offset) +# define MMIO_OUT16(base, offset, val) \ + (*xf86WriteMmio16)((CARD16)(val), base, offset) +# define MMIO_ONB8(base, offset, val) \ + (*xf86WriteMmioNB8)((CARD8)(val), base, offset) +# define MMIO_ONB16(base, offset, val) \ + (*xf86WriteMmioNB16)((CARD16)(val), base, offset) +# define MMIO_MOVE32(base, offset, val) \ + MMIO_OUT32(base, offset, val) + +# elif defined(__powerpc__) + /* + * we provide byteswapping and no byteswapping functions here + * with byteswapping as default, + * drivers that don't need byteswapping should define PPC_MMIO_IS_BE + */ +# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) +# define MMIO_OUT8(base, offset, val) \ + xf86WriteMmio8(base, offset, (CARD8)(val)) +# define MMIO_ONB8(base, offset, val) \ + xf86WriteMmioNB8(base, offset, (CARD8)(val)) + +# if defined(PPC_MMIO_IS_BE) /* No byteswapping */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Be(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmioNB16Be(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmioNB32Be(base, offset, (CARD32)(val)) +# else /* byteswapping is the default */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Le(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Le(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmioNB16Le(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) +# endif + +# define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) + +# elif defined(__sparc__) || defined(sparc) || defined(__sparc) + /* + * Like powerpc, we provide byteswapping and no byteswapping functions + * here with byteswapping as default, drivers that don't need byteswapping + * should define SPARC_MMIO_IS_BE (perhaps create a generic macro so that we + * do not need to use PPC_MMIO_IS_BE and the sparc one in all the same places + * of drivers?). + */ +# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) +# define MMIO_OUT8(base, offset, val) \ + xf86WriteMmio8(base, offset, (CARD8)(val)) +# define MMIO_ONB8(base, offset, val) \ + xf86WriteMmio8NB(base, offset, (CARD8)(val)) + +# if defined(SPARC_MMIO_IS_BE) /* No byteswapping */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Be(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmio16BeNB(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmio32BeNB(base, offset, (CARD32)(val)) +# else /* byteswapping is the default */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Le(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Le(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Le(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Le(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmio16LeNB(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) +# endif + +# define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32Be(base, offset, (CARD32)(val)) + +# elif defined(__nds32__) + /* + * we provide byteswapping and no byteswapping functions here + * with no byteswapping as default; when endianness of CPU core + * and I/O devices don't match, byte swapping is necessary + * drivers that need byteswapping should define NDS32_MMIO_SWAP + */ +# define MMIO_IN8(base, offset) xf86ReadMmio8(base, offset) +# define MMIO_OUT8(base, offset, val) \ + xf86WriteMmio8(base, offset, (CARD8)(val)) +# define MMIO_ONB8(base, offset, val) \ + xf86WriteMmioNB8(base, offset, (CARD8)(val)) + +# if defined(NDS32_MMIO_SWAP) /* byteswapping */ +# define MMIO_IN16(base, offset) xf86ReadMmio16Swap(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32Swap(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16Swap(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32Swap(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmioNB16Swap(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmioNB32Swap(base, offset, (CARD32)(val)) +# else /* no byteswapping is the default */ +# define MMIO_IN16(base, offset) xf86ReadMmio16(base, offset) +# define MMIO_IN32(base, offset) xf86ReadMmio32(base, offset) +# define MMIO_OUT16(base, offset, val) \ + xf86WriteMmio16(base, offset, (CARD16)(val)) +# define MMIO_OUT32(base, offset, val) \ + xf86WriteMmio32(base, offset, (CARD32)(val)) +# define MMIO_ONB16(base, offset, val) \ + xf86WriteMmioNB16(base, offset, (CARD16)(val)) +# define MMIO_ONB32(base, offset, val) \ + xf86WriteMmioNB32(base, offset, (CARD32)(val)) +# endif + +# define MMIO_MOVE32(base, offset, val) \ + xf86WriteMmio32(base, offset, (CARD32)(val)) + +#ifdef N1213_HC /* for NDS32 N1213 hardcore */ +static __inline__ void nds32_flush_icache(char *addr) +{ + __asm__ volatile ( + "isync %0;" + "msync;" + "isb;" + "cctl %0,L1I_VA_INVAL;" + "isb;" + : : "r"(addr) : "memory"); +} +#else +static __inline__ void nds32_flush_icache(char *addr) +{ + __asm__ volatile ( + "isync %0;" + "isb;" + : : "r"(addr) : "memory"); +} +#endif + +# else /* !__alpha__ && !__powerpc__ && !__sparc__ */ + +# define MMIO_IN8(base, offset) \ + *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) +# define MMIO_IN16(base, offset) \ + *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) +# define MMIO_IN32(base, offset) \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) +# define MMIO_OUT8(base, offset, val) \ + *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) = (val) +# define MMIO_OUT16(base, offset, val) \ + *(volatile CARD16 *)(void *)(((CARD8*)(base)) + (offset)) = (val) +# define MMIO_OUT32(base, offset, val) \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) +# define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val) +# define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) +# define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) + +# define MMIO_MOVE32(base, offset, val) MMIO_OUT32(base, offset, val) + +# endif /* __alpha__ */ + +/* + * With Intel, the version in os-support/misc/SlowBcopy.s is used. + * This avoids port I/O during the copy (which causes problems with + * some hardware). + */ +# ifdef __alpha__ +# define slowbcopy_tobus(src,dst,count) xf86SlowBCopyToBus(src,dst,count) +# define slowbcopy_frombus(src,dst,count) xf86SlowBCopyFromBus(src,dst,count) +# else /* __alpha__ */ +# define slowbcopy_tobus(src,dst,count) xf86SlowBcopy(src,dst,count) +# define slowbcopy_frombus(src,dst,count) xf86SlowBcopy(src,dst,count) +# endif /* __alpha__ */ + +#endif /* _COMPILER_H */ diff --git a/xorg-server/hw/xfree86/common/scoasm.h b/xorg-server/hw/xfree86/common/scoasm.h deleted file mode 100644 index 8f80e7b1e..000000000 --- a/xorg-server/hw/xfree86/common/scoasm.h +++ /dev/null @@ -1,142 +0,0 @@ - -/* - * Copyright (c) 1996 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). - */ - -/* - * scoasm.h - used to define inline versions of certain functions which - * do NOT appear in sys/inline.h. - */ -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#if defined(__SCO__) && defined(__USLC__) -#ifndef _SCOASM_HDR_INC -#define _SCOASM_HDR_INC - -asm void outl(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - outl (%dx) -%reg port; mem val; - movl port, %edx - movl val, %eax - outl (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - outl (%dx) -%mem port,val; - movw port, %dx - movl val, %eax - outl (%dx) -} - -asm void outw(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - data16 - outl (%dx) -%reg port; mem val; - movl port, %edx - movw val, %ax - data16 - outl (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - data16 - outl (%dx) -%mem port,val; - movw port, %dx - movw val, %ax - data16 - outl (%dx) -} - -asm void outb(port,val) -{ -%reg port,val; - movl port, %edx - movl val, %eax - outb (%dx) -%reg port; mem val; - movl port, %edx - movb val, %al - outb (%dx) -%mem port; reg val; - movw port, %dx - movl val, %eax - outb (%dx) -%mem port,val; - movw port, %dx - movb val, %al - outb (%dx) -} - -asm int inl(port) -{ -%reg port; - movl port, %edx - inl (%dx) -%mem port; - movw port, %dx - inl (%dx) -} - -asm int inw(port) -{ -%reg port; - subl %eax, %eax - movl port, %edx - data16 - inl (%dx) -%mem port; - subl %eax, %eax - movw port, %dx - data16 - inl (%dx) -} - -asm int inb(port) -{ -%reg port; - subl %eax, %eax - movl port, %edx - inb (%dx) -%mem port; - subl %eax, %eax - movw port, %dx - inb (%dx) -} - -#endif /* _SCOASM_HDR_INC */ -#endif /* __SCO__ && __USLC__ */ diff --git a/xorg-server/hw/xfree86/common/xf86.h b/xorg-server/hw/xfree86/common/xf86.h index c91020132..54332e381 100644 --- a/xorg-server/hw/xfree86/common/xf86.h +++ b/xorg-server/hw/xfree86/common/xf86.h @@ -1,355 +1,353 @@ -/*
- * 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 declarations for public XFree86 functions and variables,
- * and definitions of public macros.
- *
- * "public" means available to video drivers.
- */
-
-#ifndef _XF86_H
-#define _XF86_H
-
-#if HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#elif HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "xf86str.h"
-#include "xf86Opt.h"
-#include <X11/Xfuncproto.h>
-#include <stdarg.h>
-#ifdef RANDR
-#include <X11/extensions/randr.h>
-#endif
-
-#include "propertyst.h"
-
-/* General parameters */
-extern _X_EXPORT int xf86DoConfigure;
-extern _X_EXPORT int xf86DoShowOptions;
-extern _X_EXPORT Bool xf86DoConfigurePass1;
-
-extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec;
-#define xf86ScreenKey (&xf86ScreenKeyRec)
-
-extern _X_EXPORT DevPrivateKeyRec xf86CreateRootWindowKeyRec;
-#define xf86CreateRootWindowKey (&xf86CreateRootWindowKeyRec)
-
-extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */
-extern _X_EXPORT const unsigned char byte_reversed[256];
-extern _X_EXPORT Bool fbSlotClaimed;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-extern _X_EXPORT Bool sbusSlotClaimed;
-#endif
-extern _X_EXPORT confDRIRec xf86ConfigDRI;
-extern _X_EXPORT Bool xf86inSuspend;
-extern _X_EXPORT Bool xf86DRI2Enabled(void);
-
-extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */
-
-#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \
- xf86ScreenKey))
-#define XF86FLIP_PIXELS() \
- do { \
- if (xf86GetFlipPixels()) { \
- pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \
- pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \
- } \
- while (0)
-
-#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE")
-
-#define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \
- (((p) == Pix24Use32) ? 32 : 0))
-
-/* Function Prototypes */
-#ifndef _NO_XF86_PROTOTYPES
-
-/* PCI related */
-#include <pciaccess.h>
-extern _X_EXPORT Bool pciSlotClaimed;
-
-extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *);
-extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp,
- int chipset, GDevPtr dev, Bool active);
-extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *);
-extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus,
- int *device, int *func);
-extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus,
- int device, int func);
-extern _X_EXPORT void xf86FormatPciBusNumber(int busnum, char *buffer);
-extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci);
-extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device * pPci,
- memType base);
-extern _X_EXPORT struct pci_device * xf86GetPciInfoForEntity(int entityIndex);
-extern _X_EXPORT int xf86MatchPciInstances(const char *driverName,
- int vendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets,
- GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities);
-extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn,
- int scrnFlag, int entityIndex,PciChipsets *p_chip, void *dummy,
- EntityProc init, EntityProc enter, EntityProc leave, pointer private);
-/* Obsolete! don't use */
-extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn,
- int entityIndex,PciChipsets *p_chip, void *dummy, EntityProc init,
- EntityProc enter, EntityProc leave, pointer private);
-
-/* xf86Bus.c */
-
-extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex);
-extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
-extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active);
-extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp);
-extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex);
-extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex,
- int instance);
-extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex);
-extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance);
-extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex);
-extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex);
-extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init,
- EntityProc enter, EntityProc leave, pointer);
-extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex);
-extern _X_EXPORT void xf86EnterServerState(xf86State state);
-extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex);
-
-extern _X_EXPORT int xf86GetLastScrnFlag(int entityIndex);
-extern _X_EXPORT void xf86SetLastScrnFlag(int entityIndex, int scrnIndex);
-extern _X_EXPORT Bool xf86IsEntityShared(int entityIndex);
-extern _X_EXPORT void xf86SetEntityShared(int entityIndex);
-extern _X_EXPORT Bool xf86IsEntitySharable(int entityIndex);
-extern _X_EXPORT void xf86SetEntitySharable(int entityIndex);
-extern _X_EXPORT Bool xf86IsPrimInitDone(int entityIndex);
-extern _X_EXPORT void xf86SetPrimInitDone(int entityIndex);
-extern _X_EXPORT void xf86ClearPrimInitDone(int entityIndex);
-extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void);
-extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex);
-
-/* xf86Configure.c */
-extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus,
- void *busData, int chipset);
-
-/* xf86Cursor.c */
-
-extern _X_EXPORT void xf86LockZoom(ScreenPtr pScreen, int lock);
-extern _X_EXPORT void xf86InitViewport(ScrnInfoPtr pScr);
-extern _X_EXPORT void xf86SetViewport(ScreenPtr pScreen, int x, int y);
-extern _X_EXPORT void xf86ZoomViewport(ScreenPtr pScreen, int zoom);
-extern _X_EXPORT Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode);
-extern _X_EXPORT void *xf86GetPointerScreenFuncs(void);
-extern _X_EXPORT void xf86InitOrigins(void);
-extern _X_EXPORT void xf86ReconfigureLayout(void);
-
-/* xf86cvt.c */
-extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh,
- Bool Reduced, Bool Interlaced);
-
-/* xf86DPMS.c */
-
-extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags);
-
-#ifdef DPMSExtension
-extern _X_EXPORT int DPMSSet(ClientPtr client, int level);
-extern _X_EXPORT Bool DPMSSupported(void);
-#endif
-
-
-/* xf86DGA.c */
-
-#ifdef XFreeXDGA
-extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes,
- int num);
-extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num);
-extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode;
-#endif
-
-/* xf86Events.c */
-
-extern _X_EXPORT void SetTimeSinceLastInputEvent(void);
-extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data);
-extern _X_EXPORT int xf86RemoveInputHandler(pointer handler);
-extern _X_EXPORT void xf86DisableInputHandler(pointer handler);
-extern _X_EXPORT void xf86EnableInputHandler(pointer handler);
-extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data);
-extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler);
-extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler);
-extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler);
-extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc handler, pointer data);
-extern _X_EXPORT void xf86InterceptSignals(int *signo);
-extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler)(void));
-extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new);
-extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg);
-extern _X_EXPORT void xf86PrintBacktrace(void);
-
-/* xf86Helper.c */
-
-extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, int flags);
-extern _X_EXPORT void xf86DeleteDriver(int drvIndex);
-extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags);
-extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags);
-extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void);
-extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad);
-extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp,
- int depth24flags);
-extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp);
-extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask);
-extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual);
-extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma);
-extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y);
-extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen);
-extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable);
-extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb,
- const char *format, va_list args);
-extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb,
- const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5);
-extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...)
- _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...)
- _X_ATTRIBUTE_PRINTF(3,4);
-extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3);
-extern _X_EXPORT void xf86ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2);
-extern _X_EXPORT const char *xf86TokenToString(SymTabPtr table, int token);
-extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string);
-extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from);
-extern _X_EXPORT void xf86PrintChipsets(const char *drvname, const char *drvmsg,
- SymTabPtr chips);
-extern _X_EXPORT int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist);
-extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num,
- Bool (*ClockFunc)(ScrnInfoPtr, int),
- void (*ProtectRegs)(ScrnInfoPtr, Bool),
- void (*BlankScreen)(ScrnInfoPtr, Bool),
- IOADDRESS vertsyncreg, int maskval,
- int knownclkindex, int knownclkvalue);
-extern _X_EXPORT const char *xf86GetVisualName(int visual);
-extern _X_EXPORT int xf86GetVerbosity(void);
-extern _X_EXPORT Pix24Flags xf86GetPix24(void);
-extern _X_EXPORT int xf86GetDepth(void);
-extern _X_EXPORT rgb xf86GetWeight(void);
-extern _X_EXPORT Gamma xf86GetGamma(void);
-extern _X_EXPORT Bool xf86GetFlipPixels(void);
-extern _X_EXPORT const char *xf86GetServerName(void);
-extern _X_EXPORT Bool xf86ServerIsExiting(void);
-extern _X_EXPORT Bool xf86ServerIsResetting(void);
-extern _X_EXPORT Bool xf86ServerIsInitialising(void);
-extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void);
-extern _X_EXPORT Bool xf86CaughtSignal(void);
-extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void);
-extern _X_EXPORT Bool xf86GetVidModeEnabled(void);
-extern _X_EXPORT Bool xf86GetModInDevAllowNonLocal(void);
-extern _X_EXPORT Bool xf86GetModInDevEnabled(void);
-extern _X_EXPORT Bool xf86GetAllowMouseOpenFail(void);
-extern _X_EXPORT Bool xf86IsPc98(void);
-extern _X_EXPORT void xf86DisableRandR(void);
-extern _X_EXPORT CARD32 xorgGetVersion(void);
-extern _X_EXPORT CARD32 xf86GetModuleVersion(pointer module);
-extern _X_EXPORT pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name);
-extern _X_EXPORT pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name);
-extern _X_EXPORT pointer xf86LoadOneModule(char *name, pointer optlist);
-extern _X_EXPORT void xf86UnloadSubModule(pointer mod);
-extern _X_EXPORT Bool xf86LoaderCheckSymbol(const char *name);
-extern _X_EXPORT void xf86SetBackingStore(ScreenPtr pScreen);
-extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen);
-extern _X_EXPORT pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name,
- char **adaptor_name, pointer *adaptor_options);
-extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny);
-extern _X_EXPORT ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag,
- int entityIndex, EntityProc init,
- EntityProc enter, EntityProc leave,
- pointer private);
-
-extern _X_EXPORT Bool xf86IsScreenPrimary(int scrnIndex);
-extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
- int format, unsigned long len,
- pointer value);
-extern _X_EXPORT Bool xf86IsUnblank(int mode);
-
-/* xf86Init.c */
-
-extern _X_EXPORT PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth);
-extern _X_EXPORT int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth);
-
-/* xf86Mode.c */
-
-extern _X_EXPORT int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2,
- int DivFactor, int MulFactor, int *divider);
-extern _X_EXPORT const char *xf86ModeStatusToString(ModeStatus status);
-extern _X_EXPORT ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep,
- ClockRangePtr clockRanges, LookupModeFlags strategy);
-extern _X_EXPORT ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor);
-extern _X_EXPORT ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
- ClockRangePtr clockRanges,
- LookupModeFlags strategy,
- int maxPitch, int virtualX,
- int virtualY);
-extern _X_EXPORT ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode,
- int flags);
-extern _X_EXPORT int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes,
- char **modeNames, ClockRangePtr clockRanges,
- int *linePitches, int minPitch, int maxPitch,
- int minHeight, int maxHeight, int pitchInc,
- int virtualX, int virtualY, int apertureSize,
- LookupModeFlags strategy);
-extern _X_EXPORT void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode);
-extern _X_EXPORT void xf86PruneDriverModes(ScrnInfoPtr scrp);
-extern _X_EXPORT void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags);
-extern _X_EXPORT void xf86PrintModes(ScrnInfoPtr scrp);
-extern _X_EXPORT void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges);
-extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec *mode);
-extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec *mode);
-extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode);
-extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags);
-extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode);
-extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList);
-extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec *pMode1,
- const DisplayModeRec *pMode2);
-extern _X_EXPORT void xf86PrintModeline(int scrnIndex,DisplayModePtr mode);
-extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new);
-
-/* xf86Option.c */
-
-extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts);
-
-
-/* xf86RandR.c */
-#ifdef RANDR
-extern _X_EXPORT Bool xf86RandRInit (ScreenPtr pScreen);
-extern _X_EXPORT Rotation xf86GetRotation(ScreenPtr pScreen);
-extern _X_EXPORT Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen,
- int newvirtX, int newvirtY,
- int newmmWidth, int newmmHeight, Bool resetMode);
-#endif
-
-/* xf86VidModeExtentionInit.c */
-
-extern _X_EXPORT Bool VidModeExtensionInit(ScreenPtr pScreen);
-
-#endif /* _NO_XF86_PROTOTYPES */
-
-#endif /* _XF86_H */
+/* + * 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 declarations for public XFree86 functions and variables, + * and definitions of public macros. + * + * "public" means available to video drivers. + */ + +#ifndef _XF86_H +#define _XF86_H + +#if HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#elif HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include "xf86str.h" +#include "xf86Opt.h" +#include <X11/Xfuncproto.h> +#include <stdarg.h> +#ifdef RANDR +#include <X11/extensions/randr.h> +#endif + +#include "propertyst.h" + +/* General parameters */ +extern _X_EXPORT int xf86DoConfigure; +extern _X_EXPORT int xf86DoShowOptions; +extern _X_EXPORT Bool xf86DoConfigurePass1; + +extern _X_EXPORT DevPrivateKeyRec xf86ScreenKeyRec; +#define xf86ScreenKey (&xf86ScreenKeyRec) + +extern _X_EXPORT DevPrivateKeyRec xf86CreateRootWindowKeyRec; +#define xf86CreateRootWindowKey (&xf86CreateRootWindowKeyRec) + +extern _X_EXPORT ScrnInfoPtr *xf86Screens; /* List of pointers to ScrnInfoRecs */ +extern _X_EXPORT const unsigned char byte_reversed[256]; +extern _X_EXPORT Bool fbSlotClaimed; +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) +extern _X_EXPORT Bool sbusSlotClaimed; +#endif +extern _X_EXPORT confDRIRec xf86ConfigDRI; +extern _X_EXPORT Bool xf86DRI2Enabled(void); + +extern _X_EXPORT Bool VTSwitchEnabled; /* kbd driver */ + +#define XF86SCRNINFO(p) ((ScrnInfoPtr)dixLookupPrivate(&(p)->devPrivates, \ + xf86ScreenKey)) +#define XF86FLIP_PIXELS() \ + do { \ + if (xf86GetFlipPixels()) { \ + pScreen->whitePixel = (pScreen->whitePixel) ? 0 : 1; \ + pScreen->blackPixel = (pScreen->blackPixel) ? 0 : 1; \ + } \ + while (0) + +#define BOOLTOSTRING(b) ((b) ? "TRUE" : "FALSE") + +#define PIX24TOBPP(p) (((p) == Pix24Use24) ? 24 : \ + (((p) == Pix24Use32) ? 32 : 0)) + +/* Function Prototypes */ +#ifndef _NO_XF86_PROTOTYPES + +/* PCI related */ +#include <pciaccess.h> +extern _X_EXPORT Bool pciSlotClaimed; + +extern _X_EXPORT Bool xf86CheckPciSlot(const struct pci_device *); +extern _X_EXPORT int xf86ClaimPciSlot(struct pci_device *, DriverPtr drvp, + int chipset, GDevPtr dev, Bool active); +extern _X_EXPORT void xf86UnclaimPciSlot(struct pci_device *); +extern _X_EXPORT Bool xf86ParsePciBusString(const char *busID, int *bus, + int *device, int *func); +extern _X_EXPORT Bool xf86ComparePciBusString(const char *busID, int bus, + int device, int func); +extern _X_EXPORT void xf86FormatPciBusNumber(int busnum, char *buffer); +extern _X_EXPORT Bool xf86IsPrimaryPci(struct pci_device * pPci); +extern _X_EXPORT Bool xf86CheckPciMemBase(struct pci_device * pPci, + memType base); +extern _X_EXPORT struct pci_device * xf86GetPciInfoForEntity(int entityIndex); +extern _X_EXPORT int xf86MatchPciInstances(const char *driverName, + int vendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets, + GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities); +extern _X_EXPORT ScrnInfoPtr xf86ConfigPciEntity(ScrnInfoPtr pScrn, + int scrnFlag, int entityIndex,PciChipsets *p_chip, void *dummy, + EntityProc init, EntityProc enter, EntityProc leave, pointer private); +/* Obsolete! don't use */ +extern _X_EXPORT Bool xf86ConfigActivePciEntity(ScrnInfoPtr pScrn, + int entityIndex,PciChipsets *p_chip, void *dummy, EntityProc init, + EntityProc enter, EntityProc leave, pointer private); + +/* xf86Bus.c */ + +extern _X_EXPORT int xf86GetFbInfoForScreen(int scrnIndex); +extern _X_EXPORT int xf86ClaimFbSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); +extern _X_EXPORT int xf86ClaimNoSlot(DriverPtr drvp, int chipset, GDevPtr dev, Bool active); +extern _X_EXPORT Bool xf86DriverHasEntities(DriverPtr drvp); +extern _X_EXPORT void xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex); +extern _X_EXPORT void xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, + int instance); +extern _X_EXPORT int xf86GetNumEntityInstances(int entityIndex); +extern _X_EXPORT GDevPtr xf86GetDevFromEntity(int entityIndex, int instance); +extern _X_EXPORT void xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex); +extern _X_EXPORT EntityInfoPtr xf86GetEntityInfo(int entityIndex); +extern _X_EXPORT Bool xf86SetEntityFuncs(int entityIndex, EntityProc init, + EntityProc enter, EntityProc leave, pointer); +extern _X_EXPORT Bool xf86IsEntityPrimary(int entityIndex); +extern _X_EXPORT ScrnInfoPtr xf86FindScreenForEntity(int entityIndex); + +extern _X_EXPORT int xf86GetLastScrnFlag(int entityIndex); +extern _X_EXPORT void xf86SetLastScrnFlag(int entityIndex, int scrnIndex); +extern _X_EXPORT Bool xf86IsEntityShared(int entityIndex); +extern _X_EXPORT void xf86SetEntityShared(int entityIndex); +extern _X_EXPORT Bool xf86IsEntitySharable(int entityIndex); +extern _X_EXPORT void xf86SetEntitySharable(int entityIndex); +extern _X_EXPORT Bool xf86IsPrimInitDone(int entityIndex); +extern _X_EXPORT void xf86SetPrimInitDone(int entityIndex); +extern _X_EXPORT void xf86ClearPrimInitDone(int entityIndex); +extern _X_EXPORT int xf86AllocateEntityPrivateIndex(void); +extern _X_EXPORT DevUnion *xf86GetEntityPrivate(int entityIndex, int privIndex); + +/* xf86Configure.c */ +extern _X_EXPORT GDevPtr xf86AddBusDeviceToConfigure(const char *driver, BusType bus, + void *busData, int chipset); + +/* xf86Cursor.c */ + +extern _X_EXPORT void xf86LockZoom(ScreenPtr pScreen, int lock); +extern _X_EXPORT void xf86InitViewport(ScrnInfoPtr pScr); +extern _X_EXPORT void xf86SetViewport(ScreenPtr pScreen, int x, int y); +extern _X_EXPORT void xf86ZoomViewport(ScreenPtr pScreen, int zoom); +extern _X_EXPORT Bool xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode); +extern _X_EXPORT void *xf86GetPointerScreenFuncs(void); +extern _X_EXPORT void xf86InitOrigins(void); +extern _X_EXPORT void xf86ReconfigureLayout(void); + +/* xf86cvt.c */ +extern _X_EXPORT DisplayModePtr xf86CVTMode(int HDisplay, int VDisplay, float VRefresh, + Bool Reduced, Bool Interlaced); + +/* xf86DPMS.c */ + +extern _X_EXPORT Bool xf86DPMSInit(ScreenPtr pScreen, DPMSSetProcPtr set, int flags); + +#ifdef DPMSExtension +extern _X_EXPORT int DPMSSet(ClientPtr client, int level); +extern _X_EXPORT Bool DPMSSupported(void); +#endif + + +/* xf86DGA.c */ + +#ifdef XFreeXDGA +extern _X_EXPORT Bool DGAInit(ScreenPtr pScreen, DGAFunctionPtr funcs, DGAModePtr modes, + int num); +extern _X_EXPORT Bool DGAReInitModes(ScreenPtr pScreen, DGAModePtr modes, int num); +extern _X_EXPORT xf86SetDGAModeProc xf86SetDGAMode; +#endif + +/* xf86Events.c */ + +extern _X_EXPORT void SetTimeSinceLastInputEvent(void); +extern _X_EXPORT pointer xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data); +extern _X_EXPORT int xf86RemoveInputHandler(pointer handler); +extern _X_EXPORT void xf86DisableInputHandler(pointer handler); +extern _X_EXPORT void xf86EnableInputHandler(pointer handler); +extern _X_EXPORT pointer xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data); +extern _X_EXPORT int xf86RemoveGeneralHandler(pointer handler); +extern _X_EXPORT void xf86DisableGeneralHandler(pointer handler); +extern _X_EXPORT void xf86EnableGeneralHandler(pointer handler); +extern _X_EXPORT InputHandlerProc xf86SetConsoleHandler(InputHandlerProc handler, pointer data); +extern _X_EXPORT void xf86InterceptSignals(int *signo); +extern _X_EXPORT void xf86InterceptSigIll(void (*sigillhandler)(void)); +extern _X_EXPORT Bool xf86EnableVTSwitch(Bool new); +extern _X_EXPORT void xf86ProcessActionEvent(ActionEvent action, void *arg); +extern _X_EXPORT void xf86PrintBacktrace(void); + +/* xf86Helper.c */ + +extern _X_EXPORT void xf86AddDriver(DriverPtr driver, pointer module, int flags); +extern _X_EXPORT void xf86DeleteDriver(int drvIndex); +extern _X_EXPORT ScrnInfoPtr xf86AllocateScreen(DriverPtr drv, int flags); +extern _X_EXPORT void xf86DeleteScreen(int scrnIndex, int flags); +extern _X_EXPORT int xf86AllocateScrnInfoPrivateIndex(void); +extern _X_EXPORT Bool xf86AddPixFormat(ScrnInfoPtr pScrn, int depth, int bpp, int pad); +extern _X_EXPORT Bool xf86SetDepthBpp(ScrnInfoPtr scrp, int depth, int bpp, int fbbpp, + int depth24flags); +extern _X_EXPORT void xf86PrintDepthBpp(ScrnInfoPtr scrp); +extern _X_EXPORT Bool xf86SetWeight(ScrnInfoPtr scrp, rgb weight, rgb mask); +extern _X_EXPORT Bool xf86SetDefaultVisual(ScrnInfoPtr scrp, int visual); +extern _X_EXPORT Bool xf86SetGamma(ScrnInfoPtr scrp, Gamma newGamma); +extern _X_EXPORT void xf86SetDpi(ScrnInfoPtr pScrn, int x, int y); +extern _X_EXPORT void xf86SetBlackWhitePixels(ScreenPtr pScreen); +extern _X_EXPORT void xf86EnableDisableFBAccess(int scrnIndex, Bool enable); +extern _X_EXPORT void xf86VDrvMsgVerb(int scrnIndex, MessageType type, int verb, + const char *format, va_list args); +extern _X_EXPORT void xf86DrvMsgVerb(int scrnIndex, MessageType type, int verb, + const char *format, ...) _X_ATTRIBUTE_PRINTF(4,5); +extern _X_EXPORT void xf86DrvMsg(int scrnIndex, MessageType type, const char *format, ...) + _X_ATTRIBUTE_PRINTF(3,4); +extern _X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...) + _X_ATTRIBUTE_PRINTF(3,4); +extern _X_EXPORT void xf86Msg(MessageType type, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3); +extern _X_EXPORT void xf86ErrorFVerb(int verb, const char *format, ...) _X_ATTRIBUTE_PRINTF(2,3); +extern _X_EXPORT void xf86ErrorF(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,2); +extern _X_EXPORT const char *xf86TokenToString(SymTabPtr table, int token); +extern _X_EXPORT int xf86StringToToken(SymTabPtr table, const char *string); +extern _X_EXPORT void xf86ShowClocks(ScrnInfoPtr scrp, MessageType from); +extern _X_EXPORT void xf86PrintChipsets(const char *drvname, const char *drvmsg, + SymTabPtr chips); +extern _X_EXPORT int xf86MatchDevice(const char *drivername, GDevPtr **driversectlist); +extern _X_EXPORT void xf86GetClocks(ScrnInfoPtr pScrn, int num, + Bool (*ClockFunc)(ScrnInfoPtr, int), + void (*ProtectRegs)(ScrnInfoPtr, Bool), + void (*BlankScreen)(ScrnInfoPtr, Bool), + IOADDRESS vertsyncreg, int maskval, + int knownclkindex, int knownclkvalue); +extern _X_EXPORT const char *xf86GetVisualName(int visual); +extern _X_EXPORT int xf86GetVerbosity(void); +extern _X_EXPORT Pix24Flags xf86GetPix24(void); +extern _X_EXPORT int xf86GetDepth(void); +extern _X_EXPORT rgb xf86GetWeight(void); +extern _X_EXPORT Gamma xf86GetGamma(void); +extern _X_EXPORT Bool xf86GetFlipPixels(void); +extern _X_EXPORT const char *xf86GetServerName(void); +extern _X_EXPORT Bool xf86ServerIsExiting(void); +extern _X_EXPORT Bool xf86ServerIsResetting(void); +extern _X_EXPORT Bool xf86ServerIsInitialising(void); +extern _X_EXPORT Bool xf86ServerIsOnlyDetecting(void); +extern _X_EXPORT Bool xf86CaughtSignal(void); +extern _X_EXPORT Bool xf86GetVidModeAllowNonLocal(void); +extern _X_EXPORT Bool xf86GetVidModeEnabled(void); +extern _X_EXPORT Bool xf86GetModInDevAllowNonLocal(void); +extern _X_EXPORT Bool xf86GetModInDevEnabled(void); +extern _X_EXPORT Bool xf86GetAllowMouseOpenFail(void); +extern _X_EXPORT Bool xf86IsPc98(void); +extern _X_EXPORT void xf86DisableRandR(void); +extern _X_EXPORT CARD32 xorgGetVersion(void); +extern _X_EXPORT CARD32 xf86GetModuleVersion(pointer module); +extern _X_EXPORT pointer xf86LoadDrvSubModule(DriverPtr drv, const char *name); +extern _X_EXPORT pointer xf86LoadSubModule(ScrnInfoPtr pScrn, const char *name); +extern _X_EXPORT pointer xf86LoadOneModule(char *name, pointer optlist); +extern _X_EXPORT void xf86UnloadSubModule(pointer mod); +extern _X_EXPORT Bool xf86LoaderCheckSymbol(const char *name); +extern _X_EXPORT void xf86SetBackingStore(ScreenPtr pScreen); +extern _X_EXPORT void xf86SetSilkenMouse(ScreenPtr pScreen); +extern _X_EXPORT pointer xf86FindXvOptions(int scrnIndex, int adapt_index, char *port_name, + char **adaptor_name, pointer *adaptor_options); +extern _X_EXPORT void xf86GetOS(const char **name, int *major, int *minor, int *teeny); +extern _X_EXPORT ScrnInfoPtr xf86ConfigFbEntity(ScrnInfoPtr pScrn, int scrnFlag, + int entityIndex, EntityProc init, + EntityProc enter, EntityProc leave, + pointer private); + +extern _X_EXPORT Bool xf86IsScreenPrimary(int scrnIndex); +extern _X_EXPORT int xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type, + int format, unsigned long len, + pointer value); +extern _X_EXPORT Bool xf86IsUnblank(int mode); + +/* xf86Init.c */ + +extern _X_EXPORT PixmapFormatPtr xf86GetPixFormat(ScrnInfoPtr pScrn, int depth); +extern _X_EXPORT int xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth); + +/* xf86Mode.c */ + +extern _X_EXPORT int xf86GetNearestClock(ScrnInfoPtr scrp, int freq, Bool allowDiv2, + int DivFactor, int MulFactor, int *divider); +extern _X_EXPORT const char *xf86ModeStatusToString(ModeStatus status); +extern _X_EXPORT ModeStatus xf86LookupMode(ScrnInfoPtr scrp, DisplayModePtr modep, + ClockRangePtr clockRanges, LookupModeFlags strategy); +extern _X_EXPORT ModeStatus xf86CheckModeForMonitor(DisplayModePtr mode, MonPtr monitor); +extern _X_EXPORT ModeStatus xf86InitialCheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, + ClockRangePtr clockRanges, + LookupModeFlags strategy, + int maxPitch, int virtualX, + int virtualY); +extern _X_EXPORT ModeStatus xf86CheckModeForDriver(ScrnInfoPtr scrp, DisplayModePtr mode, + int flags); +extern _X_EXPORT int xf86ValidateModes(ScrnInfoPtr scrp, DisplayModePtr availModes, + char **modeNames, ClockRangePtr clockRanges, + int *linePitches, int minPitch, int maxPitch, + int minHeight, int maxHeight, int pitchInc, + int virtualX, int virtualY, int apertureSize, + LookupModeFlags strategy); +extern _X_EXPORT void xf86DeleteMode(DisplayModePtr *modeList, DisplayModePtr mode); +extern _X_EXPORT void xf86PruneDriverModes(ScrnInfoPtr scrp); +extern _X_EXPORT void xf86SetCrtcForModes(ScrnInfoPtr scrp, int adjustFlags); +extern _X_EXPORT void xf86PrintModes(ScrnInfoPtr scrp); +extern _X_EXPORT void xf86ShowClockRanges(ScrnInfoPtr scrp, ClockRangePtr clockRanges); +extern _X_EXPORT double xf86ModeHSync(const DisplayModeRec *mode); +extern _X_EXPORT double xf86ModeVRefresh(const DisplayModeRec *mode); +extern _X_EXPORT void xf86SetModeDefaultName(DisplayModePtr mode); +extern _X_EXPORT void xf86SetModeCrtc(DisplayModePtr p, int adjustFlags); +extern _X_EXPORT DisplayModePtr xf86DuplicateMode(const DisplayModeRec *pMode); +extern _X_EXPORT DisplayModePtr xf86DuplicateModes(ScrnInfoPtr pScrn, DisplayModePtr modeList); +extern _X_EXPORT Bool xf86ModesEqual(const DisplayModeRec *pMode1, + const DisplayModeRec *pMode2); +extern _X_EXPORT void xf86PrintModeline(int scrnIndex,DisplayModePtr mode); +extern _X_EXPORT DisplayModePtr xf86ModesAdd(DisplayModePtr modes, DisplayModePtr new); + +/* xf86Option.c */ + +extern _X_EXPORT void xf86CollectOptions(ScrnInfoPtr pScrn, pointer extraOpts); + + +/* xf86RandR.c */ +#ifdef RANDR +extern _X_EXPORT Bool xf86RandRInit (ScreenPtr pScreen); +extern _X_EXPORT Rotation xf86GetRotation(ScreenPtr pScreen); +extern _X_EXPORT Bool xf86RandRSetNewVirtualAndDimensions(ScreenPtr pScreen, + int newvirtX, int newvirtY, + int newmmWidth, int newmmHeight, Bool resetMode); +#endif + +/* xf86VidModeExtentionInit.c */ + +extern _X_EXPORT Bool VidModeExtensionInit(ScreenPtr pScreen); + +#endif /* _NO_XF86_PROTOTYPES */ + +#endif /* _XF86_H */ diff --git a/xorg-server/hw/xfree86/common/xf86Bus.c b/xorg-server/hw/xfree86/common/xf86Bus.c index bec2343b2..3b0896863 100644 --- a/xorg-server/hw/xfree86/common/xf86Bus.c +++ b/xorg-server/hw/xfree86/common/xf86Bus.c @@ -1,671 +1,636 @@ -/*
- * 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 interfaces to the bus-specific code
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <X11/X.h>
-#include "os.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-
-/* Bus-specific headers */
-
-#include "xf86Bus.h"
-
-#define XF86_OS_PRIVS
-#include "xf86_OSproc.h"
-#include "xf86VGAarbiter.h"
-
-/* Entity data */
-EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */
-int xf86NumEntities = 0;
-static int xf86EntityPrivateCount = 0;
-
-BusRec primaryBus = { BUS_NONE, { 0 } };
-
-/**
- * Call the driver's correct probe function.
- *
- * If the driver implements the \c DriverRec::PciProbe entry-point and an
- * appropriate PCI device (with matching Device section in the xorg.conf file)
- * is found, it is called. If \c DriverRec::PciProbe or no devices can be
- * successfully probed with it (e.g., only non-PCI devices are available),
- * the driver's \c DriverRec::Probe function is called.
- *
- * \param drv Driver to probe
- *
- * \return
- * If a device can be successfully probed by the driver, \c TRUE is
- * returned. Otherwise, \c FALSE is returned.
- */
-Bool
-xf86CallDriverProbe( DriverPtr drv, Bool detect_only )
-{
- Bool foundScreen = FALSE;
-
- if (drv->PciProbe != NULL) {
- if (xf86DoConfigure && xf86DoConfigurePass1) {
- assert(detect_only);
- foundScreen = xf86PciAddMatchingDev(drv);
- }
- else {
- assert(! detect_only);
- foundScreen = xf86PciProbeDev(drv);
- }
- }
-
- if (!foundScreen && (drv->Probe != NULL)) {
- xf86Msg( X_WARNING, "Falling back to old probe method for %s\n",
- drv->driverName);
- foundScreen = (*drv->Probe)(drv, (detect_only) ? PROBE_DETECT
- : PROBE_DEFAULT);
- }
-
- return foundScreen;
-}
-
-/**
- * @return TRUE if all buses are configured and set up correctly and FALSE
- * otherwise.
- */
-Bool
-xf86BusConfig(void)
-{
- screenLayoutPtr layout;
- int i, j;
-
- /* Enable full I/O access */
- if (xorgHWAccess)
- xorgHWAccess = xf86EnableIO();
-
- /*
- * Now call each of the Probe functions. Each successful probe will
- * result in an extra entry added to the xf86Screens[] list for each
- * instance of the hardware found.
- */
- for (i = 0; i < xf86NumDrivers; i++) {
- xorgHWFlags flags;
- if (!xorgHWAccess) {
- if (!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags)
- || NEED_IO_ENABLED(flags))
- continue;
- }
-
- xf86CallDriverProbe(xf86DriverList[i], FALSE);
- }
-
- /* If nothing was detected, return now */
- if (xf86NumScreens == 0) {
- xf86Msg(X_ERROR, "No devices detected.\n");
- return FALSE;
- }
-
- xf86VGAarbiterInit();
-
- /*
- * Match up the screens found by the probes against those specified
- * in the config file. Remove the ones that won't be used. Sort
- * them in the order specified.
- *
- * What is the best way to do this?
- *
- * For now, go through the screens allocated by the probes, and
- * look for screen config entry which refers to the same device
- * section as picked out by the probe.
- *
- */
- for (i = 0; i < xf86NumScreens; i++) {
- for (layout = xf86ConfigLayout.screens; layout->screen != NULL;
- layout++) {
- Bool found = FALSE;
- for (j = 0; j < xf86Screens[i]->numEntities; j++) {
-
- GDevPtr dev = xf86GetDevFromEntity(
- xf86Screens[i]->entityList[j],
- xf86Screens[i]->entityInstanceList[j]);
- if (dev == layout->screen->device) {
- /* A match has been found */
- xf86Screens[i]->confScreen = layout->screen;
- found = TRUE;
- break;
- }
- }
- if (found) break;
- }
- if (layout->screen == NULL) {
- /* No match found */
- xf86Msg(X_ERROR,
- "Screen %d deleted because of no matching config section.\n", i);
- xf86DeleteScreen(i--, 0);
- }
- }
-
- /* If no screens left, return now. */
- if (xf86NumScreens == 0) {
- xf86Msg(X_ERROR,
- "Device(s) detected, but none match those in the config file.\n");
- return FALSE;
- }
-
- return TRUE;
-}
-
-/*
- * Call the bus probes relevant to the architecture.
- *
- * The only one available so far is for PCI and SBUS.
- */
-
-void
-xf86BusProbe(void)
-{
- xf86PciProbe();
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- xf86SbusProbe();
-#endif
-}
-
-/*
- * Determine what bus type the busID string represents. The start of the
- * bus-dependent part of the string is returned as retID.
- */
-
-BusType
-StringToBusType(const char* busID, const char **retID)
-{
- char *p, *s;
- BusType ret = BUS_NONE;
-
- /* If no type field, Default to PCI */
- if (isdigit(busID[0])) {
- if (retID)
- *retID = busID;
- return BUS_PCI;
- }
-
- s = xstrdup(busID);
- p = strtok(s, ":");
- if (p == NULL || *p == 0) {
- free(s);
- return BUS_NONE;
- }
- if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp"))
- ret = BUS_PCI;
- if (!xf86NameCmp(p, "sbus"))
- ret = BUS_SBUS;
- if (ret != BUS_NONE)
- if (retID)
- *retID = busID + strlen(p) + 1;
- free(s);
- return ret;
-}
-
-int
-xf86AllocateEntity(void)
-{
- xf86NumEntities++;
- xf86Entities = xnfrealloc(xf86Entities,
- sizeof(EntityPtr) * xf86NumEntities);
- xf86Entities[xf86NumEntities - 1] = xnfcalloc(1,sizeof(EntityRec));
- xf86Entities[xf86NumEntities - 1]->entityPrivates =
- xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1);
- return xf86NumEntities - 1;
-}
-
-Bool
-xf86IsEntityPrimary(int entityIndex)
-{
- EntityPtr pEnt = xf86Entities[entityIndex];
-
- if (primaryBus.type != pEnt->bus.type) return FALSE;
-
- switch (pEnt->bus.type) {
- case BUS_PCI:
- return pEnt->bus.id.pci == primaryBus.id.pci;
- case BUS_SBUS:
- return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum;
- default:
- return FALSE;
- }
-}
-
-Bool
-xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter,
- EntityProc leave, pointer private)
-{
- if (entityIndex >= xf86NumEntities)
- return FALSE;
- xf86Entities[entityIndex]->entityInit = init;
- xf86Entities[entityIndex]->entityEnter = enter;
- xf86Entities[entityIndex]->entityLeave = leave;
- xf86Entities[entityIndex]->private = private;
- return TRUE;
-}
-
-Bool
-xf86DriverHasEntities(DriverPtr drvp)
-{
- int i;
- for (i = 0; i < xf86NumEntities; i++) {
- if (xf86Entities[i]->driver == drvp)
- return TRUE;
- }
- return FALSE;
-}
-
-void
-xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex)
-{
- if (entityIndex == -1)
- return;
- if (xf86Entities[entityIndex]->inUse &&
- !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) {
- ErrorF("Requested Entity already in use!\n");
- return;
- }
-
- pScrn->numEntities++;
- pScrn->entityList = xnfrealloc(pScrn->entityList,
- pScrn->numEntities * sizeof(int));
- pScrn->entityList[pScrn->numEntities - 1] = entityIndex;
- xf86Entities[entityIndex]->inUse = TRUE;
- pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList,
- pScrn->numEntities * sizeof(int));
- pScrn->entityInstanceList[pScrn->numEntities - 1] = 0;
- pScrn->domainIOBase = xf86Entities[entityIndex]->domainIO;
-}
-
-void
-xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance)
-{
- int i;
-
- if (entityIndex == -1 || entityIndex >= xf86NumEntities)
- return;
-
- for (i = 0; i < pScrn->numEntities; i++) {
- if (pScrn->entityList[i] == entityIndex) {
- pScrn->entityInstanceList[i] = instance;
- break;
- }
- }
-}
-
-/*
- * XXX This needs to be updated for the case where a single entity may have
- * instances associated with more than one screen.
- */
-ScrnInfoPtr
-xf86FindScreenForEntity(int entityIndex)
-{
- int i,j;
-
- if (entityIndex == -1) return NULL;
-
- if (xf86Screens) {
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numEntities; j++) {
- if ( xf86Screens[i]->entityList[j] == entityIndex )
- return xf86Screens[i];
- }
- }
- }
- return NULL;
-}
-
-void
-xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex)
-{
- int i;
-
- for (i = 0; i < pScrn->numEntities; i++) {
- if (pScrn->entityList[i] == entityIndex) {
- for (i++; i < pScrn->numEntities; i++)
- pScrn->entityList[i-1] = pScrn->entityList[i];
- pScrn->numEntities--;
- xf86Entities[entityIndex]->inUse = FALSE;
- break;
- }
- }
-}
-
-/*
- * xf86ClearEntitiesForScreen() - called when a screen is deleted
- * to mark it's entities unused. Called by xf86DeleteScreen().
- */
-void
-xf86ClearEntityListForScreen(int scrnIndex)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- int i, entityIndex;
-
- if (pScrn->entityList == NULL || pScrn->numEntities == 0) return;
-
- for (i = 0; i < pScrn->numEntities; i++) {
- entityIndex = pScrn->entityList[i];
- xf86Entities[entityIndex]->inUse = FALSE;
- /* disable resource: call the disable function */
- }
- free(pScrn->entityList);
- free(pScrn->entityInstanceList);
- pScrn->entityList = NULL;
- pScrn->entityInstanceList = NULL;
-}
-
-/*
- * Add an extra device section (GDevPtr) to an entity.
- */
-
-void
-xf86AddDevToEntity(int entityIndex, GDevPtr dev)
-{
- EntityPtr pEnt;
-
- if (entityIndex >= xf86NumEntities)
- return;
-
- pEnt = xf86Entities[entityIndex];
- pEnt->numInstances++;
- pEnt->devices = xnfrealloc(pEnt->devices,
- pEnt->numInstances * sizeof(GDevPtr));
- pEnt->devices[pEnt->numInstances - 1] = dev;
- dev->claimed = TRUE;
-}
-
-/*
- * xf86GetEntityInfo() -- This function hands information from the
- * EntityRec struct to the drivers. The EntityRec structure itself
- * remains invisible to the driver.
- */
-EntityInfoPtr
-xf86GetEntityInfo(int entityIndex)
-{
- EntityInfoPtr pEnt;
- int i;
-
- if (entityIndex == -1)
- return NULL;
-
- if (entityIndex >= xf86NumEntities)
- return NULL;
-
- pEnt = xnfcalloc(1,sizeof(EntityInfoRec));
- pEnt->index = entityIndex;
- pEnt->location = xf86Entities[entityIndex]->bus;
- pEnt->active = xf86Entities[entityIndex]->active;
- pEnt->chipset = xf86Entities[entityIndex]->chipset;
- pEnt->driver = xf86Entities[entityIndex]->driver;
- if ( (xf86Entities[entityIndex]->devices) &&
- (xf86Entities[entityIndex]->devices[0]) ) {
- for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
- if (xf86Entities[entityIndex]->devices[i]->screen == 0)
- break;
- pEnt->device = xf86Entities[entityIndex]->devices[i];
- } else
- pEnt->device = NULL;
-
- return pEnt;
-}
-
-int
-xf86GetNumEntityInstances(int entityIndex)
-{
- if (entityIndex >= xf86NumEntities)
- return -1;
-
- return xf86Entities[entityIndex]->numInstances;
-}
-
-GDevPtr
-xf86GetDevFromEntity(int entityIndex, int instance)
-{
- int i;
-
- /* We might not use AddDevtoEntity */
- if ( (!xf86Entities[entityIndex]->devices) ||
- (!xf86Entities[entityIndex]->devices[0]) )
- return NULL;
-
- if (entityIndex >= xf86NumEntities ||
- instance >= xf86Entities[entityIndex]->numInstances)
- return NULL;
-
- for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++)
- if (xf86Entities[entityIndex]->devices[i]->screen == instance)
- break;
- return xf86Entities[entityIndex]->devices[i];
-}
-
-/*
- * xf86AccessEnter() -- gets called to save the text mode VGA IO
- * resources when reentering the server after a VT switch.
- */
-void
-xf86AccessEnter(void)
-{
- int i;
-
- for (i = 0; i < xf86NumEntities; i++)
- if (xf86Entities[i]->entityEnter)
- xf86Entities[i]->entityEnter(i,xf86Entities[i]->private);
-
- xf86EnterServerState(SETUP);
-}
-
-void
-xf86AccessLeave(void)
-{
- int i;
-
- for (i = 0; i < xf86NumEntities; i++)
- if (xf86Entities[i]->entityLeave)
- xf86Entities[i]->entityLeave(i,xf86Entities[i]->private);
-}
-
-/*
- * xf86EnterServerState() -- set state the server is in.
- */
-
-typedef enum { TRI_UNSET, TRI_TRUE, TRI_FALSE } TriState;
-
-void
-xf86EnterServerState(xf86State state)
-{
- static int sigio_state;
- static TriState sigio_blocked = TRI_UNSET;
-
- /*
- * This is a good place to block SIGIO during SETUP state. SIGIO should be
- * blocked in SETUP state otherwise (u)sleep() might get interrupted
- * early. We take care not to call xf86BlockSIGIO() twice.
- */
- if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) {
- sigio_state = xf86BlockSIGIO();
- sigio_blocked = TRI_TRUE;
- } else if ((state == OPERATING) && (sigio_blocked != TRI_UNSET)) {
- xf86UnblockSIGIO(sigio_state);
- sigio_blocked = TRI_FALSE;
- }
-}
-
-/*
- * xf86PostProbe() -- Allocate all non conflicting resources
- * This function gets called by xf86Init().
- */
-void
-xf86PostProbe(void)
-{
- int i;
-
- if (fbSlotClaimed && (pciSlotClaimed
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- || sbusSlotClaimed
-#endif
- ))
- FatalError("Cannot run in framebuffer mode. Please specify busIDs "
- " for all framebuffer devices\n");
-
- for (i = 0; i < xf86NumEntities; i++)
- if (xf86Entities[i]->entityInit)
- xf86Entities[i]->entityInit(i,xf86Entities[i]->private);
-}
-
-void
-xf86PostScreenInit(void)
-{
- xf86VGAarbiterWrapFunctions();
- xf86EnterServerState(OPERATING);
-}
-
-int
-xf86GetLastScrnFlag(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- return xf86Entities[entityIndex]->lastScrnFlag;
- } else {
- return -1;
- }
-}
-
-void
-xf86SetLastScrnFlag(int entityIndex, int scrnIndex)
-{
- if(entityIndex < xf86NumEntities) {
- xf86Entities[entityIndex]->lastScrnFlag = scrnIndex;
- }
-}
-
-Bool
-xf86IsEntityShared(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- if(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void
-xf86SetEntityShared(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL;
- }
-}
-
-Bool
-xf86IsEntitySharable(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- if(xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void
-xf86SetEntitySharable(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE;
- }
-}
-
-Bool
-xf86IsPrimInitDone(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- if(xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) {
- return TRUE;
- }
- }
- return FALSE;
-}
-
-void
-xf86SetPrimInitDone(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE;
- }
-}
-
-void
-xf86ClearPrimInitDone(int entityIndex)
-{
- if(entityIndex < xf86NumEntities) {
- xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE;
- }
-}
-
-
-/*
- * Allocate a private in the entities.
- */
-
-int
-xf86AllocateEntityPrivateIndex(void)
-{
- int idx, i;
- EntityPtr pEnt;
- DevUnion *nprivs;
-
- idx = xf86EntityPrivateCount++;
- for (i = 0; i < xf86NumEntities; i++) {
- pEnt = xf86Entities[i];
- nprivs = xnfrealloc(pEnt->entityPrivates,
- xf86EntityPrivateCount * sizeof(DevUnion));
- /* Zero the new private */
- memset(&nprivs[idx], 0, sizeof(DevUnion));
- pEnt->entityPrivates = nprivs;
- }
- return idx;
-}
-
-DevUnion *
-xf86GetEntityPrivate(int entityIndex, int privIndex)
-{
- if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount)
- return NULL;
-
- return &(xf86Entities[entityIndex]->entityPrivates[privIndex]);
-}
-
+/* + * 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 interfaces to the bus-specific code + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <ctype.h> +#include <stdlib.h> +#include <unistd.h> +#include <X11/X.h> +#include "os.h" +#include "xf86.h" +#include "xf86Priv.h" + +/* Bus-specific headers */ + +#include "xf86Bus.h" + +#define XF86_OS_PRIVS +#include "xf86_OSproc.h" +#include "xf86VGAarbiter.h" + +/* Entity data */ +EntityPtr *xf86Entities = NULL; /* Bus slots claimed by drivers */ +int xf86NumEntities = 0; +static int xf86EntityPrivateCount = 0; + +BusRec primaryBus = { BUS_NONE, { 0 } }; + +/** + * Call the driver's correct probe function. + * + * If the driver implements the \c DriverRec::PciProbe entry-point and an + * appropriate PCI device (with matching Device section in the xorg.conf file) + * is found, it is called. If \c DriverRec::PciProbe or no devices can be + * successfully probed with it (e.g., only non-PCI devices are available), + * the driver's \c DriverRec::Probe function is called. + * + * \param drv Driver to probe + * + * \return + * If a device can be successfully probed by the driver, \c TRUE is + * returned. Otherwise, \c FALSE is returned. + */ +Bool +xf86CallDriverProbe( DriverPtr drv, Bool detect_only ) +{ + Bool foundScreen = FALSE; + + if (drv->PciProbe != NULL) { + if (xf86DoConfigure && xf86DoConfigurePass1) { + assert(detect_only); + foundScreen = xf86PciAddMatchingDev(drv); + } + else { + assert(! detect_only); + foundScreen = xf86PciProbeDev(drv); + } + } + + if (!foundScreen && (drv->Probe != NULL)) { + xf86Msg( X_WARNING, "Falling back to old probe method for %s\n", + drv->driverName); + foundScreen = (*drv->Probe)(drv, (detect_only) ? PROBE_DETECT + : PROBE_DEFAULT); + } + + return foundScreen; +} + +/** + * @return TRUE if all buses are configured and set up correctly and FALSE + * otherwise. + */ +Bool +xf86BusConfig(void) +{ + screenLayoutPtr layout; + int i, j; + + /* Enable full I/O access */ + if (xorgHWAccess) + xorgHWAccess = xf86EnableIO(); + + /* + * Now call each of the Probe functions. Each successful probe will + * result in an extra entry added to the xf86Screens[] list for each + * instance of the hardware found. + */ + for (i = 0; i < xf86NumDrivers; i++) { + xorgHWFlags flags; + if (!xorgHWAccess) { + if (!xf86DriverList[i]->driverFunc + || !xf86DriverList[i]->driverFunc(NULL, + GET_REQUIRED_HW_INTERFACES, + &flags) + || NEED_IO_ENABLED(flags)) + continue; + } + + xf86CallDriverProbe(xf86DriverList[i], FALSE); + } + + /* If nothing was detected, return now */ + if (xf86NumScreens == 0) { + xf86Msg(X_ERROR, "No devices detected.\n"); + return FALSE; + } + + xf86VGAarbiterInit(); + + /* + * Match up the screens found by the probes against those specified + * in the config file. Remove the ones that won't be used. Sort + * them in the order specified. + * + * What is the best way to do this? + * + * For now, go through the screens allocated by the probes, and + * look for screen config entry which refers to the same device + * section as picked out by the probe. + * + */ + for (i = 0; i < xf86NumScreens; i++) { + for (layout = xf86ConfigLayout.screens; layout->screen != NULL; + layout++) { + Bool found = FALSE; + for (j = 0; j < xf86Screens[i]->numEntities; j++) { + + GDevPtr dev = xf86GetDevFromEntity( + xf86Screens[i]->entityList[j], + xf86Screens[i]->entityInstanceList[j]); + if (dev == layout->screen->device) { + /* A match has been found */ + xf86Screens[i]->confScreen = layout->screen; + found = TRUE; + break; + } + } + if (found) break; + } + if (layout->screen == NULL) { + /* No match found */ + xf86Msg(X_ERROR, + "Screen %d deleted because of no matching config section.\n", i); + xf86DeleteScreen(i--, 0); + } + } + + /* If no screens left, return now. */ + if (xf86NumScreens == 0) { + xf86Msg(X_ERROR, + "Device(s) detected, but none match those in the config file.\n"); + return FALSE; + } + + return TRUE; +} + +/* + * Call the bus probes relevant to the architecture. + * + * The only one available so far is for PCI and SBUS. + */ + +void +xf86BusProbe(void) +{ + xf86PciProbe(); +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) + xf86SbusProbe(); +#endif +} + +/* + * Determine what bus type the busID string represents. The start of the + * bus-dependent part of the string is returned as retID. + */ + +BusType +StringToBusType(const char* busID, const char **retID) +{ + char *p, *s; + BusType ret = BUS_NONE; + + /* If no type field, Default to PCI */ + if (isdigit(busID[0])) { + if (retID) + *retID = busID; + return BUS_PCI; + } + + s = xstrdup(busID); + p = strtok(s, ":"); + if (p == NULL || *p == 0) { + free(s); + return BUS_NONE; + } + if (!xf86NameCmp(p, "pci") || !xf86NameCmp(p, "agp")) + ret = BUS_PCI; + if (!xf86NameCmp(p, "sbus")) + ret = BUS_SBUS; + if (ret != BUS_NONE) + if (retID) + *retID = busID + strlen(p) + 1; + free(s); + return ret; +} + +int +xf86AllocateEntity(void) +{ + xf86NumEntities++; + xf86Entities = xnfrealloc(xf86Entities, + sizeof(EntityPtr) * xf86NumEntities); + xf86Entities[xf86NumEntities - 1] = xnfcalloc(1,sizeof(EntityRec)); + xf86Entities[xf86NumEntities - 1]->entityPrivates = + xnfcalloc(sizeof(DevUnion) * xf86EntityPrivateCount, 1); + return xf86NumEntities - 1; +} + +Bool +xf86IsEntityPrimary(int entityIndex) +{ + EntityPtr pEnt = xf86Entities[entityIndex]; + + if (primaryBus.type != pEnt->bus.type) return FALSE; + + switch (pEnt->bus.type) { + case BUS_PCI: + return pEnt->bus.id.pci == primaryBus.id.pci; + case BUS_SBUS: + return pEnt->bus.id.sbus.fbNum == primaryBus.id.sbus.fbNum; + default: + return FALSE; + } +} + +Bool +xf86SetEntityFuncs(int entityIndex, EntityProc init, EntityProc enter, + EntityProc leave, pointer private) +{ + if (entityIndex >= xf86NumEntities) + return FALSE; + xf86Entities[entityIndex]->entityInit = init; + xf86Entities[entityIndex]->entityEnter = enter; + xf86Entities[entityIndex]->entityLeave = leave; + xf86Entities[entityIndex]->private = private; + return TRUE; +} + +Bool +xf86DriverHasEntities(DriverPtr drvp) +{ + int i; + for (i = 0; i < xf86NumEntities; i++) { + if (xf86Entities[i]->driver == drvp) + return TRUE; + } + return FALSE; +} + +void +xf86AddEntityToScreen(ScrnInfoPtr pScrn, int entityIndex) +{ + if (entityIndex == -1) + return; + if (xf86Entities[entityIndex]->inUse && + !(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL)) { + ErrorF("Requested Entity already in use!\n"); + return; + } + + pScrn->numEntities++; + pScrn->entityList = xnfrealloc(pScrn->entityList, + pScrn->numEntities * sizeof(int)); + pScrn->entityList[pScrn->numEntities - 1] = entityIndex; + xf86Entities[entityIndex]->inUse = TRUE; + pScrn->entityInstanceList = xnfrealloc(pScrn->entityInstanceList, + pScrn->numEntities * sizeof(int)); + pScrn->entityInstanceList[pScrn->numEntities - 1] = 0; + pScrn->domainIOBase = xf86Entities[entityIndex]->domainIO; +} + +void +xf86SetEntityInstanceForScreen(ScrnInfoPtr pScrn, int entityIndex, int instance) +{ + int i; + + if (entityIndex == -1 || entityIndex >= xf86NumEntities) + return; + + for (i = 0; i < pScrn->numEntities; i++) { + if (pScrn->entityList[i] == entityIndex) { + pScrn->entityInstanceList[i] = instance; + break; + } + } +} + +/* + * XXX This needs to be updated for the case where a single entity may have + * instances associated with more than one screen. + */ +ScrnInfoPtr +xf86FindScreenForEntity(int entityIndex) +{ + int i,j; + + if (entityIndex == -1) return NULL; + + if (xf86Screens) { + for (i = 0; i < xf86NumScreens; i++) { + for (j = 0; j < xf86Screens[i]->numEntities; j++) { + if ( xf86Screens[i]->entityList[j] == entityIndex ) + return xf86Screens[i]; + } + } + } + return NULL; +} + +void +xf86RemoveEntityFromScreen(ScrnInfoPtr pScrn, int entityIndex) +{ + int i; + + for (i = 0; i < pScrn->numEntities; i++) { + if (pScrn->entityList[i] == entityIndex) { + for (i++; i < pScrn->numEntities; i++) + pScrn->entityList[i-1] = pScrn->entityList[i]; + pScrn->numEntities--; + xf86Entities[entityIndex]->inUse = FALSE; + break; + } + } +} + +/* + * xf86ClearEntitiesForScreen() - called when a screen is deleted + * to mark it's entities unused. Called by xf86DeleteScreen(). + */ +void +xf86ClearEntityListForScreen(int scrnIndex) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + int i, entityIndex; + + if (pScrn->entityList == NULL || pScrn->numEntities == 0) return; + + for (i = 0; i < pScrn->numEntities; i++) { + entityIndex = pScrn->entityList[i]; + xf86Entities[entityIndex]->inUse = FALSE; + /* disable resource: call the disable function */ + } + free(pScrn->entityList); + free(pScrn->entityInstanceList); + pScrn->entityList = NULL; + pScrn->entityInstanceList = NULL; +} + +/* + * Add an extra device section (GDevPtr) to an entity. + */ + +void +xf86AddDevToEntity(int entityIndex, GDevPtr dev) +{ + EntityPtr pEnt; + + if (entityIndex >= xf86NumEntities) + return; + + pEnt = xf86Entities[entityIndex]; + pEnt->numInstances++; + pEnt->devices = xnfrealloc(pEnt->devices, + pEnt->numInstances * sizeof(GDevPtr)); + pEnt->devices[pEnt->numInstances - 1] = dev; + dev->claimed = TRUE; +} + +/* + * xf86GetEntityInfo() -- This function hands information from the + * EntityRec struct to the drivers. The EntityRec structure itself + * remains invisible to the driver. + */ +EntityInfoPtr +xf86GetEntityInfo(int entityIndex) +{ + EntityInfoPtr pEnt; + int i; + + if (entityIndex == -1) + return NULL; + + if (entityIndex >= xf86NumEntities) + return NULL; + + pEnt = xnfcalloc(1,sizeof(EntityInfoRec)); + pEnt->index = entityIndex; + pEnt->location = xf86Entities[entityIndex]->bus; + pEnt->active = xf86Entities[entityIndex]->active; + pEnt->chipset = xf86Entities[entityIndex]->chipset; + pEnt->driver = xf86Entities[entityIndex]->driver; + if ( (xf86Entities[entityIndex]->devices) && + (xf86Entities[entityIndex]->devices[0]) ) { + for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++) + if (xf86Entities[entityIndex]->devices[i]->screen == 0) + break; + pEnt->device = xf86Entities[entityIndex]->devices[i]; + } else + pEnt->device = NULL; + + return pEnt; +} + +int +xf86GetNumEntityInstances(int entityIndex) +{ + if (entityIndex >= xf86NumEntities) + return -1; + + return xf86Entities[entityIndex]->numInstances; +} + +GDevPtr +xf86GetDevFromEntity(int entityIndex, int instance) +{ + int i; + + /* We might not use AddDevtoEntity */ + if ( (!xf86Entities[entityIndex]->devices) || + (!xf86Entities[entityIndex]->devices[0]) ) + return NULL; + + if (entityIndex >= xf86NumEntities || + instance >= xf86Entities[entityIndex]->numInstances) + return NULL; + + for (i = 0; i < xf86Entities[entityIndex]->numInstances; i++) + if (xf86Entities[entityIndex]->devices[i]->screen == instance) + break; + return xf86Entities[entityIndex]->devices[i]; +} + +/* + * xf86AccessEnter() -- gets called to save the text mode VGA IO + * resources when reentering the server after a VT switch. + */ +void +xf86AccessEnter(void) +{ + int i; + + for (i = 0; i < xf86NumEntities; i++) + if (xf86Entities[i]->entityEnter) + xf86Entities[i]->entityEnter(i,xf86Entities[i]->private); +} + +void +xf86AccessLeave(void) +{ + int i; + + for (i = 0; i < xf86NumEntities; i++) + if (xf86Entities[i]->entityLeave) + xf86Entities[i]->entityLeave(i,xf86Entities[i]->private); +} + +/* + * xf86PostProbe() -- Allocate all non conflicting resources + * This function gets called by xf86Init(). + */ +void +xf86PostProbe(void) +{ + int i; + + if (fbSlotClaimed && (pciSlotClaimed +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) + || sbusSlotClaimed +#endif + )) + FatalError("Cannot run in framebuffer mode. Please specify busIDs " + " for all framebuffer devices\n"); + + for (i = 0; i < xf86NumEntities; i++) + if (xf86Entities[i]->entityInit) + xf86Entities[i]->entityInit(i,xf86Entities[i]->private); +} + +int +xf86GetLastScrnFlag(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + return xf86Entities[entityIndex]->lastScrnFlag; + } else { + return -1; + } +} + +void +xf86SetLastScrnFlag(int entityIndex, int scrnIndex) +{ + if(entityIndex < xf86NumEntities) { + xf86Entities[entityIndex]->lastScrnFlag = scrnIndex; + } +} + +Bool +xf86IsEntityShared(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + if(xf86Entities[entityIndex]->entityProp & IS_SHARED_ACCEL) { + return TRUE; + } + } + return FALSE; +} + +void +xf86SetEntityShared(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + xf86Entities[entityIndex]->entityProp |= IS_SHARED_ACCEL; + } +} + +Bool +xf86IsEntitySharable(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + if(xf86Entities[entityIndex]->entityProp & ACCEL_IS_SHARABLE) { + return TRUE; + } + } + return FALSE; +} + +void +xf86SetEntitySharable(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + xf86Entities[entityIndex]->entityProp |= ACCEL_IS_SHARABLE; + } +} + +Bool +xf86IsPrimInitDone(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + if(xf86Entities[entityIndex]->entityProp & SA_PRIM_INIT_DONE) { + return TRUE; + } + } + return FALSE; +} + +void +xf86SetPrimInitDone(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + xf86Entities[entityIndex]->entityProp |= SA_PRIM_INIT_DONE; + } +} + +void +xf86ClearPrimInitDone(int entityIndex) +{ + if(entityIndex < xf86NumEntities) { + xf86Entities[entityIndex]->entityProp &= ~SA_PRIM_INIT_DONE; + } +} + + +/* + * Allocate a private in the entities. + */ + +int +xf86AllocateEntityPrivateIndex(void) +{ + int idx, i; + EntityPtr pEnt; + DevUnion *nprivs; + + idx = xf86EntityPrivateCount++; + for (i = 0; i < xf86NumEntities; i++) { + pEnt = xf86Entities[i]; + nprivs = xnfrealloc(pEnt->entityPrivates, + xf86EntityPrivateCount * sizeof(DevUnion)); + /* Zero the new private */ + memset(&nprivs[idx], 0, sizeof(DevUnion)); + pEnt->entityPrivates = nprivs; + } + return idx; +} + +DevUnion * +xf86GetEntityPrivate(int entityIndex, int privIndex) +{ + if (entityIndex >= xf86NumEntities || privIndex >= xf86EntityPrivateCount) + return NULL; + + return &(xf86Entities[entityIndex]->entityPrivates[privIndex]); +} + diff --git a/xorg-server/hw/xfree86/common/xf86Configure.c b/xorg-server/hw/xfree86/common/xf86Configure.c index c106f3754..883c48cc0 100644 --- a/xorg-server/hw/xfree86/common/xf86Configure.c +++ b/xorg-server/hw/xfree86/common/xf86Configure.c @@ -1,784 +1,765 @@ -/*
- * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales.
- *
- * 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 Alan Hourihane not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Alan Hourihane makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL ALAN HOURIHANE 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.
- *
- * Author: Alan Hourihane, alanh@fairlite.demon.co.uk
- *
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "xf86.h"
-#include "xf86Config.h"
-#include "xf86_OSlib.h"
-#include "xf86Priv.h"
-#define IN_XSERVER
-#include "Configint.h"
-#include "xf86DDC.h"
-#include "xf86pciBus.h"
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
-#include "xf86Bus.h"
-#include "xf86Sbus.h"
-#endif
-
-typedef struct _DevToConfig {
- GDevRec GDev;
- struct pci_device * pVideo;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- sbusDevicePtr sVideo;
-#endif
- int iDriver;
-} DevToConfigRec, *DevToConfigPtr;
-
-static DevToConfigPtr DevToConfig = NULL;
-static int nDevToConfig = 0, CurrentDriver;
-
-xf86MonPtr ConfiguredMonitor;
-Bool xf86DoConfigurePass1 = TRUE;
-static Bool foundMouse = FALSE;
-
-#if defined(__SCO__)
-static char *DFLT_MOUSE_PROTO = "OSMouse";
-#elif defined(__UNIXWARE__)
-static char *DFLT_MOUSE_PROTO = "OSMouse";
-static char *DFLT_MOUSE_DEV = "/dev/mouse";
-#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__)
-static char *DFLT_MOUSE_DEV = "/dev/sysmouse";
-static char *DFLT_MOUSE_PROTO = "auto";
-#elif defined(linux)
-static char DFLT_MOUSE_DEV[] = "/dev/input/mice";
-static char DFLT_MOUSE_PROTO[] = "auto";
-#else
-static char *DFLT_MOUSE_DEV = "/dev/mouse";
-static char *DFLT_MOUSE_PROTO = "auto";
-#endif
-
-/*
- * This is called by the driver, either through xf86Match???Instances() or
- * directly. We allocate a GDevRec and fill it in as much as we can, letting
- * the caller fill in the rest and/or change it as it sees fit.
- */
-GDevPtr
-xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset)
-{
- int ret, i, j;
-
- if (!xf86DoConfigure || !xf86DoConfigurePass1)
- return NULL;
-
- /* Check for duplicates */
- for (i = 0; i < nDevToConfig; i++) {
- switch (bus) {
- case BUS_PCI:
- ret = xf86PciConfigure(busData, DevToConfig[i].pVideo);
- break;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- case BUS_SBUS:
- ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo);
- break;
-#endif
- default:
- return NULL;
- }
- if (ret == 0)
- goto out;
- }
-
- /* Allocate new structure occurrence */
- i = nDevToConfig++;
- DevToConfig =
- xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec));
- memset(DevToConfig + i, 0, sizeof(DevToConfigRec));
-
- DevToConfig[i].GDev.chipID =
- DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1;
-
- DevToConfig[i].iDriver = CurrentDriver;
-
- /* Fill in what we know, converting the driver name to lower case */
- DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1);
- for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++);
-
- switch (bus) {
- case BUS_PCI:
- xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo,
- &DevToConfig[i].GDev, &chipset);
- break;
-#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__)
- case BUS_SBUS:
- xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo,
- &DevToConfig[i].GDev);
- break;
-#endif
- default:
- break;
- }
-
- /* Get driver's available options */
- if (xf86DriverList[CurrentDriver]->AvailableOptions)
- DevToConfig[i].GDev.options = (OptionInfoPtr)
- (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset,
- bus);
-
- return &DevToConfig[i].GDev;
-
-out:
- return NULL;
-}
-
-static XF86ConfInputPtr
-configureInputSection (void)
-{
- XF86ConfInputPtr mouse = NULL;
- parsePrologue (XF86ConfInputPtr, XF86ConfInputRec)
-
- ptr->inp_identifier = "Keyboard0";
- ptr->inp_driver = "kbd";
- ptr->list.next = NULL;
-
- /* Crude mechanism to auto-detect mouse (os dependent) */
- {
- int fd;
-#ifdef WSCONS_SUPPORT
- fd = open("/dev/wsmouse", 0);
- if (fd >= 0) {
- DFLT_MOUSE_DEV = "/dev/wsmouse";
- DFLT_MOUSE_PROTO = "wsmouse";
- close(fd);
- } else {
- ErrorF("cannot open /dev/wsmouse\n");
- }
-#endif
-
-#ifndef __SCO__
- fd = open(DFLT_MOUSE_DEV, 0);
- if (fd != -1) {
- foundMouse = TRUE;
- close(fd);
- }
-#else
- foundMouse = TRUE;
-#endif
- }
-
- mouse = calloc(1, sizeof(XF86ConfInputRec));
- mouse->inp_identifier = "Mouse0";
- mouse->inp_driver = "mouse";
- mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"),
- strdup(DFLT_MOUSE_PROTO));
-#ifndef __SCO__
- mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, strdup("Device"),
- strdup(DFLT_MOUSE_DEV));
-#endif
- mouse->inp_option_lst =
- xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"),
- strdup("4 5 6 7"));
- ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse);
- return ptr;
-}
-
-static XF86ConfScreenPtr
-configureScreenSection (int screennum)
-{
- int i;
- int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ };
- parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec)
-
- XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum);
- XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum);
- XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum);
-
- for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++)
- {
- XF86ConfDisplayPtr display;
-
- display = calloc(1, sizeof(XF86ConfDisplayRec));
- display->disp_depth = depths[i];
- display->disp_black.red = display->disp_white.red = -1;
- display->disp_black.green = display->disp_white.green = -1;
- display->disp_black.blue = display->disp_white.blue = -1;
- ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem(
- (glp)ptr->scrn_display_lst, (glp)display);
- }
-
- return ptr;
-}
-
-static const char*
-optionTypeToString(OptionValueType type)
-{
- switch (type) {
- case OPTV_NONE:
- return "";
- case OPTV_INTEGER:
- return "<i>";
- case OPTV_STRING:
- return "<str>";
- case OPTV_ANYSTR:
- return "[<str>]";
- case OPTV_REAL:
- return "<f>";
- case OPTV_BOOLEAN:
- return "[<bool>]";
- case OPTV_FREQ:
- return "<freq>";
- case OPTV_PERCENT:
- return "<percent>";
- default:
- return "";
- }
-}
-
-static XF86ConfDevicePtr
-configureDeviceSection (int screennum)
-{
- OptionInfoPtr p;
- int i = 0;
- parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec)
-
- /* Move device info to parser structure */
- if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1)
- ptr->dev_identifier = NULL;
- ptr->dev_chipset = DevToConfig[screennum].GDev.chipset;
- ptr->dev_busid = DevToConfig[screennum].GDev.busID;
- ptr->dev_driver = DevToConfig[screennum].GDev.driver;
- ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac;
- for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++)
- ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i];
- ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam;
- ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq;
- ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase;
- ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase;
- ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase;
- ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip;
- for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++)
- ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i];
- ptr->dev_clocks = i;
- ptr->dev_chipid = DevToConfig[screennum].GDev.chipID;
- ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev;
- ptr->dev_irq = DevToConfig[screennum].GDev.irq;
-
- /* Make sure older drivers don't segv */
- if (DevToConfig[screennum].GDev.options) {
- /* Fill in the available driver options for people to use */
- const char *descrip =
- " ### Available Driver options are:-\n"
- " ### Values: <i>: integer, <f>: float, "
- "<bool>: \"True\"/\"False\",\n"
- " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n"
- " ### <percent>: \"<f>%\"\n"
- " ### [arg]: arg optional\n";
- ptr->dev_comment = strdup(descrip);
- if (ptr->dev_comment) {
- for (p = DevToConfig[screennum].GDev.options;
- p->name != NULL; p++) {
- char *p_e;
- const char *prefix = " #Option ";
- const char *middle = " \t# ";
- const char *suffix = "\n";
- const char *opttype = optionTypeToString(p->type);
- char *optname;
- int len = strlen(ptr->dev_comment) + strlen(prefix) +
- strlen(middle) + strlen(suffix) + 1;
-
- if (asprintf(&optname, "\"%s\"", p->name) == -1)
- break;
-
- len += max(20, strlen(optname));
- len += strlen(opttype);
-
- ptr->dev_comment = realloc(ptr->dev_comment, len);
- if (!ptr->dev_comment)
- break;
- p_e = ptr->dev_comment + strlen(ptr->dev_comment);
- sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle,
- opttype, suffix);
- free(optname);
- }
- }
- }
-
- return ptr;
-}
-
-static XF86ConfLayoutPtr
-configureLayoutSection (void)
-{
- int scrnum = 0;
- parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec)
-
- ptr->lay_identifier = "X.org Configured";
-
- {
- XF86ConfInputrefPtr iptr;
-
- iptr = malloc (sizeof (XF86ConfInputrefRec));
- iptr->list.next = NULL;
- iptr->iref_option_lst = NULL;
- iptr->iref_inputdev_str = "Mouse0";
- iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL);
- ptr->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
- }
-
- {
- XF86ConfInputrefPtr iptr;
-
- iptr = malloc (sizeof (XF86ConfInputrefRec));
- iptr->list.next = NULL;
- iptr->iref_option_lst = NULL;
- iptr->iref_inputdev_str = "Keyboard0";
- iptr->iref_option_lst =
- xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL);
- ptr->lay_input_lst = (XF86ConfInputrefPtr)
- xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr);
- }
-
- for (scrnum = 0; scrnum < nDevToConfig; scrnum++) {
- XF86ConfAdjacencyPtr aptr;
-
- aptr = malloc (sizeof (XF86ConfAdjacencyRec));
- aptr->list.next = NULL;
- aptr->adj_x = 0;
- aptr->adj_y = 0;
- aptr->adj_scrnum = scrnum;
- XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum);
- if (scrnum == 0) {
- aptr->adj_where = CONF_ADJ_ABSOLUTE;
- aptr->adj_refscreen = NULL;
- }
- else {
- aptr->adj_where = CONF_ADJ_RIGHTOF;
- XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1);
- }
- ptr->lay_adjacency_lst =
- (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst,
- (glp)aptr);
- }
-
- return ptr;
-}
-
-static XF86ConfFlagsPtr
-configureFlagsSection (void)
-{
- parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec)
-
- return ptr;
-}
-
-static XF86ConfModulePtr
-configureModuleSection (void)
-{
- char **elist, **el;
- /* Find the list of extension & font modules. */
- const char *esubdirs[] = {
- "extensions",
- "fonts",
- NULL
- };
- parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec)
-
- elist = LoaderListDirs(esubdirs, NULL);
- if (elist) {
- for (el = elist; *el; el++) {
- XF86LoadPtr module;
-
- module = calloc(1, sizeof(XF86LoadRec));
- module->load_name = *el;
- ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem(
- (glp)ptr->mod_load_lst, (glp)module);
- }
- free(elist);
- }
-
- return ptr;
-}
-
-static XF86ConfFilesPtr
-configureFilesSection (void)
-{
- parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec)
-
- if (xf86ModulePath)
- ptr->file_modulepath = strdup(xf86ModulePath);
- if (defaultFontPath)
- ptr->file_fontpath = strdup(defaultFontPath);
-
- return ptr;
-}
-
-static XF86ConfMonitorPtr
-configureMonitorSection (int screennum)
-{
- parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
-
- XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
- ptr->mon_vendor = strdup("Monitor Vendor");
- ptr->mon_modelname = strdup("Monitor Model");
-
- return ptr;
-}
-
-/* Initialize Configure Monitor from Detailed Timing Block */
-static void handle_detailed_input(struct detailed_monitor_section *det_mon,
- void *data)
-{
- XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data;
-
- switch (det_mon->type) {
- case DS_NAME:
- ptr->mon_modelname = realloc(ptr->mon_modelname,
- strlen((char*)(det_mon->section.name)) +
- 1);
- strcpy(ptr->mon_modelname,
- (char*)(det_mon->section.name));
- break;
- case DS_RANGES:
- ptr->mon_hsync[ptr->mon_n_hsync].lo =
- det_mon->section.ranges.min_h;
- ptr->mon_hsync[ptr->mon_n_hsync].hi =
- det_mon->section.ranges.max_h;
- ptr->mon_n_vrefresh = 1;
- ptr->mon_vrefresh[ptr->mon_n_hsync].lo =
- det_mon->section.ranges.min_v;
- ptr->mon_vrefresh[ptr->mon_n_hsync].hi =
- det_mon->section.ranges.max_v;
- ptr->mon_n_hsync++;
- default:
- break;
- }
-}
-
-static XF86ConfMonitorPtr
-configureDDCMonitorSection (int screennum)
-{
- int len, mon_width, mon_height;
-#define displaySizeMaxLen 80
- char displaySize_string[displaySizeMaxLen];
- int displaySizeLen;
-
- parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec)
-
- XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum);
- ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name);
- XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id);
-
- /* features in centimetres, we want millimetres */
- mon_width = 10 * ConfiguredMonitor->features.hsize ;
- mon_height = 10 * ConfiguredMonitor->features.vsize ;
-
-#ifdef CONFIGURE_DISPLAYSIZE
- ptr->mon_width = mon_width;
- ptr->mon_height = mon_height;
-#else
- if (mon_width && mon_height) {
- /* when values available add DisplaySize option AS A COMMENT */
-
- displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen,
- "\t#DisplaySize\t%5d %5d\t# mm\n",
- mon_width, mon_height);
-
- if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) {
- if (ptr->mon_comment) {
- len = strlen(ptr->mon_comment);
- } else {
- len = 0;
- }
- if ((ptr->mon_comment =
- realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) {
- strcpy(ptr->mon_comment + len, displaySize_string);
- }
- }
- }
-#endif /* def CONFIGURE_DISPLAYSIZE */
-
- xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input,
- ptr);
-
- if (ConfiguredMonitor->features.dpms) {
- ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL);
- }
-
- return ptr;
-}
-
-#if !defined(PATH_MAX)
-# define PATH_MAX 1024
-#endif
-
-void
-DoConfigure(void)
-{
- int i,j, screennum = -1;
- char *home = NULL;
- char filename[PATH_MAX];
- char *addslash = "";
- XF86ConfigPtr xf86config = NULL;
- char **vlist, **vl;
- int *dev2screen;
-
- vlist = xf86DriverlistFromCompile();
-
- if (!vlist) {
- ErrorF("Missing output drivers. Configuration failed.\n");
- goto bail;
- }
-
- ErrorF("List of video drivers:\n");
- for (vl = vlist; *vl; vl++)
- ErrorF("\t%s\n", *vl);
-
- /* Load all the drivers that were found. */
- xf86LoadModules(vlist, NULL);
-
- free(vlist);
-
- for (i = 0; i < xf86NumDrivers; i++) {
- xorgHWFlags flags;
- if (!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags)
- || NEED_IO_ENABLED(flags)) {
- xorgHWAccess = TRUE;
- break;
- }
- }
- /* Enable full I/O access */
- if (xorgHWAccess) {
- if(!xf86EnableIO())
- /* oops, we have failed */
- xorgHWAccess = FALSE;
- }
-
- /* Create XF86Config file structure */
- xf86config = calloc(1, sizeof(XF86ConfigRec));
-
- /* Call all of the probe functions, reporting the results. */
- for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) {
- xorgHWFlags flags;
- Bool found_screen;
- DriverRec * const drv = xf86DriverList[CurrentDriver];
-
- if (!xorgHWAccess) {
- if (!drv->driverFunc
- || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags )
- || NEED_IO_ENABLED(flags))
- continue;
- }
-
- found_screen = xf86CallDriverProbe( drv, TRUE );
- if ( found_screen && drv->Identify ) {
- (*drv->Identify)(0);
- }
- }
-
- if (nDevToConfig <= 0) {
- ErrorF("No devices to configure. Configuration failed.\n");
- goto bail;
- }
-
- /* Add device, monitor and screen sections for detected devices */
- for (screennum = 0; screennum < nDevToConfig; screennum++) {
- XF86ConfDevicePtr DevicePtr;
- XF86ConfMonitorPtr MonitorPtr;
- XF86ConfScreenPtr ScreenPtr;
-
- DevicePtr = configureDeviceSection(screennum);
- xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem(
- (glp)xf86config->conf_device_lst, (glp)DevicePtr);
- MonitorPtr = configureMonitorSection(screennum);
- xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
- (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
- ScreenPtr = configureScreenSection(screennum);
- xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
- (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
- }
-
- xf86config->conf_files = configureFilesSection();
- xf86config->conf_modules = configureModuleSection();
- xf86config->conf_flags = configureFlagsSection();
- xf86config->conf_videoadaptor_lst = NULL;
- xf86config->conf_modes_lst = NULL;
- xf86config->conf_vendor_lst = NULL;
- xf86config->conf_dri = NULL;
- xf86config->conf_input_lst = configureInputSection();
- xf86config->conf_layout_lst = configureLayoutSection();
-
- home = getenv("HOME");
- if ((home == NULL) || (home[0] == '\0')) {
- home = "/";
- } else {
- /* Determine if trailing slash is present or needed */
- int l = strlen(home);
-
- if (home[l-1] != '/') {
- addslash = "/";
- }
- }
-
- snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new",
- home, addslash);
-
- if (xf86writeConfigFile(filename, xf86config) == 0) {
- xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
- filename, strerror(errno));
- goto bail;
- }
-
- xf86DoConfigurePass1 = FALSE;
- /* Try to get DDC information filled in */
- xf86ConfigFile = filename;
- if (xf86HandleConfigFile(FALSE) != CONFIG_OK) {
- goto bail;
- }
-
- xf86DoConfigurePass1 = FALSE;
-
- dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int));
-
- {
- Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool));
- for (screennum = 0; screennum < nDevToConfig; screennum++) {
- int k,l,n,oldNumScreens;
-
- i = DevToConfig[screennum].iDriver;
-
- if (driverProbed[i]) continue;
- driverProbed[i] = TRUE;
-
- oldNumScreens = xf86NumScreens;
-
- xf86CallDriverProbe( xf86DriverList[i], FALSE );
-
- /* reorder */
- k = screennum > 0 ? screennum : 1;
- for (l = oldNumScreens; l < xf86NumScreens; l++) {
- /* is screen primary? */
- Bool primary = FALSE;
- for (n = 0; n<xf86Screens[l]->numEntities; n++) {
- if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) {
- dev2screen[0] = l;
- primary = TRUE;
- break;
- }
- }
- if (primary) continue;
- /* not primary: assign it to next device of same driver */
- /*
- * NOTE: we assume that devices in DevToConfig
- * and xf86Screens[] have the same order except
- * for the primary device which always comes first.
- */
- for (; k < nDevToConfig; k++) {
- if (DevToConfig[k].iDriver == i) {
- dev2screen[k++] = l;
- break;
- }
- }
- }
- }
- free(driverProbed);
- }
-
-
- if (nDevToConfig != xf86NumScreens) {
- ErrorF("Number of created screens does not match number of detected"
- " devices.\n Configuration failed.\n");
- goto bail;
- }
-
- xf86PostProbe();
-
- for (j = 0; j < xf86NumScreens; j++) {
- xf86Screens[j]->scrnIndex = j;
- }
-
- xf86freeMonitorList(xf86config->conf_monitor_lst);
- xf86config->conf_monitor_lst = NULL;
- xf86freeScreenList(xf86config->conf_screen_lst);
- xf86config->conf_screen_lst = NULL;
- for (j = 0; j < xf86NumScreens; j++) {
- XF86ConfMonitorPtr MonitorPtr;
- XF86ConfScreenPtr ScreenPtr;
-
- ConfiguredMonitor = NULL;
-
- if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]],
- PROBE_DETECT) &&
- ConfiguredMonitor) {
- MonitorPtr = configureDDCMonitorSection(j);
- } else {
- MonitorPtr = configureMonitorSection(j);
- }
- ScreenPtr = configureScreenSection(j);
- xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem(
- (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr);
- xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem(
- (glp)xf86config->conf_screen_lst, (glp)ScreenPtr);
- }
-
- if (xf86writeConfigFile(filename, xf86config) == 0) {
- xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n",
- filename, strerror(errno));
- goto bail;
- }
-
- ErrorF("\n");
-
-#ifdef __SCO__
- ErrorF("\n"__XSERVERNAME__
- " is using the kernel event driver to access the mouse.\n"
- "If you wish to use the internal "__XSERVERNAME__
- " mouse drivers, please\n"
- "edit the file and correct the Device.\n");
-#else /* !__SCO__ */
- if (!foundMouse) {
- ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n"
- "Edit the file and correct the Device.\n");
- } else {
- ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n"
- "Please check your config if the mouse is still not\n"
- "operational, as by default "__XSERVERNAME__
- " tries to autodetect\n"
- "the protocol.\n",DFLT_MOUSE_DEV);
- }
-#endif /* !__SCO__ */
-
- if (xf86NumScreens > 1) {
- ErrorF("\n"__XSERVERNAME__
- " has configured a multihead system, please check your config.\n");
- }
-
- ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename);
- ErrorF("To test the server, run 'X -config %s'\n\n", filename);
-
-bail:
- OsCleanup(TRUE);
- AbortDDX();
- fflush(stderr);
- exit(0);
-}
+/* + * Copyright 2000-2002 by Alan Hourihane, Flint Mountain, North Wales. + * + * 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 Alan Hourihane not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Alan Hourihane makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL ALAN HOURIHANE 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. + * + * Author: Alan Hourihane, alanh@fairlite.demon.co.uk + * + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "xf86.h" +#include "xf86Config.h" +#include "xf86_OSlib.h" +#include "xf86Priv.h" +#define IN_XSERVER +#include "Configint.h" +#include "xf86DDC.h" +#include "xf86pciBus.h" +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) +#include "xf86Bus.h" +#include "xf86Sbus.h" +#endif + +typedef struct _DevToConfig { + GDevRec GDev; + struct pci_device * pVideo; +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) + sbusDevicePtr sVideo; +#endif + int iDriver; +} DevToConfigRec, *DevToConfigPtr; + +static DevToConfigPtr DevToConfig = NULL; +static int nDevToConfig = 0, CurrentDriver; + +xf86MonPtr ConfiguredMonitor; +Bool xf86DoConfigurePass1 = TRUE; +static Bool foundMouse = FALSE; + +#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__DragonFly__) +static char *DFLT_MOUSE_DEV = "/dev/sysmouse"; +static char *DFLT_MOUSE_PROTO = "auto"; +#elif defined(linux) +static char DFLT_MOUSE_DEV[] = "/dev/input/mice"; +static char DFLT_MOUSE_PROTO[] = "auto"; +#else +static char *DFLT_MOUSE_DEV = "/dev/mouse"; +static char *DFLT_MOUSE_PROTO = "auto"; +#endif + +/* + * This is called by the driver, either through xf86Match???Instances() or + * directly. We allocate a GDevRec and fill it in as much as we can, letting + * the caller fill in the rest and/or change it as it sees fit. + */ +GDevPtr +xf86AddBusDeviceToConfigure(const char *driver, BusType bus, void *busData, int chipset) +{ + int ret, i, j; + + if (!xf86DoConfigure || !xf86DoConfigurePass1) + return NULL; + + /* Check for duplicates */ + for (i = 0; i < nDevToConfig; i++) { + switch (bus) { + case BUS_PCI: + ret = xf86PciConfigure(busData, DevToConfig[i].pVideo); + break; +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) + case BUS_SBUS: + ret = xf86SbusConfigure(busData, DevToConfig[i].sVideo); + break; +#endif + default: + return NULL; + } + if (ret == 0) + goto out; + } + + /* Allocate new structure occurrence */ + i = nDevToConfig++; + DevToConfig = + xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec)); + memset(DevToConfig + i, 0, sizeof(DevToConfigRec)); + + DevToConfig[i].GDev.chipID = + DevToConfig[i].GDev.chipRev = DevToConfig[i].GDev.irq = -1; + + DevToConfig[i].iDriver = CurrentDriver; + + /* Fill in what we know, converting the driver name to lower case */ + DevToConfig[i].GDev.driver = xnfalloc(strlen(driver) + 1); + for (j = 0; (DevToConfig[i].GDev.driver[j] = tolower(driver[j])); j++); + + switch (bus) { + case BUS_PCI: + xf86PciConfigureNewDev(busData, DevToConfig[i].pVideo, + &DevToConfig[i].GDev, &chipset); + break; +#if (defined(__sparc__) || defined(__sparc)) && !defined(__OpenBSD__) + case BUS_SBUS: + xf86SbusConfigureNewDev(busData, DevToConfig[i].sVideo, + &DevToConfig[i].GDev); + break; +#endif + default: + break; + } + + /* Get driver's available options */ + if (xf86DriverList[CurrentDriver]->AvailableOptions) + DevToConfig[i].GDev.options = (OptionInfoPtr) + (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset, + bus); + + return &DevToConfig[i].GDev; + +out: + return NULL; +} + +static XF86ConfInputPtr +configureInputSection (void) +{ + XF86ConfInputPtr mouse = NULL; + parsePrologue (XF86ConfInputPtr, XF86ConfInputRec) + + ptr->inp_identifier = "Keyboard0"; + ptr->inp_driver = "kbd"; + ptr->list.next = NULL; + + /* Crude mechanism to auto-detect mouse (os dependent) */ + { + int fd; +#ifdef WSCONS_SUPPORT + fd = open("/dev/wsmouse", 0); + if (fd >= 0) { + DFLT_MOUSE_DEV = "/dev/wsmouse"; + DFLT_MOUSE_PROTO = "wsmouse"; + close(fd); + } else { + ErrorF("cannot open /dev/wsmouse\n"); + } +#endif + + fd = open(DFLT_MOUSE_DEV, 0); + if (fd != -1) { + foundMouse = TRUE; + close(fd); + } + } + + mouse = calloc(1, sizeof(XF86ConfInputRec)); + mouse->inp_identifier = "Mouse0"; + mouse->inp_driver = "mouse"; + mouse->inp_option_lst = + xf86addNewOption(mouse->inp_option_lst, strdup("Protocol"), + strdup(DFLT_MOUSE_PROTO)); + mouse->inp_option_lst = + xf86addNewOption(mouse->inp_option_lst, strdup("Device"), + strdup(DFLT_MOUSE_DEV)); + mouse->inp_option_lst = + xf86addNewOption(mouse->inp_option_lst, strdup("ZAxisMapping"), + strdup("4 5 6 7")); + ptr = (XF86ConfInputPtr)xf86addListItem((glp)ptr, (glp)mouse); + return ptr; +} + +static XF86ConfScreenPtr +configureScreenSection (int screennum) +{ + int i; + int depths[] = { 1, 4, 8, 15, 16, 24/*, 32*/ }; + parsePrologue (XF86ConfScreenPtr, XF86ConfScreenRec) + + XNFasprintf(&ptr->scrn_identifier, "Screen%d", screennum); + XNFasprintf(&ptr->scrn_monitor_str, "Monitor%d", screennum); + XNFasprintf(&ptr->scrn_device_str, "Card%d", screennum); + + for (i=0; i<sizeof(depths)/sizeof(depths[0]); i++) + { + XF86ConfDisplayPtr display; + + display = calloc(1, sizeof(XF86ConfDisplayRec)); + display->disp_depth = depths[i]; + display->disp_black.red = display->disp_white.red = -1; + display->disp_black.green = display->disp_white.green = -1; + display->disp_black.blue = display->disp_white.blue = -1; + ptr->scrn_display_lst = (XF86ConfDisplayPtr)xf86addListItem( + (glp)ptr->scrn_display_lst, (glp)display); + } + + return ptr; +} + +static const char* +optionTypeToString(OptionValueType type) +{ + switch (type) { + case OPTV_NONE: + return ""; + case OPTV_INTEGER: + return "<i>"; + case OPTV_STRING: + return "<str>"; + case OPTV_ANYSTR: + return "[<str>]"; + case OPTV_REAL: + return "<f>"; + case OPTV_BOOLEAN: + return "[<bool>]"; + case OPTV_FREQ: + return "<freq>"; + case OPTV_PERCENT: + return "<percent>"; + default: + return ""; + } +} + +static XF86ConfDevicePtr +configureDeviceSection (int screennum) +{ + OptionInfoPtr p; + int i = 0; + parsePrologue (XF86ConfDevicePtr, XF86ConfDeviceRec) + + /* Move device info to parser structure */ + if (asprintf(&ptr->dev_identifier, "Card%d", screennum) == -1) + ptr->dev_identifier = NULL; + ptr->dev_chipset = DevToConfig[screennum].GDev.chipset; + ptr->dev_busid = DevToConfig[screennum].GDev.busID; + ptr->dev_driver = DevToConfig[screennum].GDev.driver; + ptr->dev_ramdac = DevToConfig[screennum].GDev.ramdac; + for (i = 0; (i < MAXDACSPEEDS) && (i < CONF_MAXDACSPEEDS); i++) + ptr->dev_dacSpeeds[i] = DevToConfig[screennum].GDev.dacSpeeds[i]; + ptr->dev_videoram = DevToConfig[screennum].GDev.videoRam; + ptr->dev_textclockfreq = DevToConfig[screennum].GDev.textClockFreq; + ptr->dev_bios_base = DevToConfig[screennum].GDev.BiosBase; + ptr->dev_mem_base = DevToConfig[screennum].GDev.MemBase; + ptr->dev_io_base = DevToConfig[screennum].GDev.IOBase; + ptr->dev_clockchip = DevToConfig[screennum].GDev.clockchip; + for (i = 0; (i < MAXCLOCKS) && (i < DevToConfig[screennum].GDev.numclocks); i++) + ptr->dev_clock[i] = DevToConfig[screennum].GDev.clock[i]; + ptr->dev_clocks = i; + ptr->dev_chipid = DevToConfig[screennum].GDev.chipID; + ptr->dev_chiprev = DevToConfig[screennum].GDev.chipRev; + ptr->dev_irq = DevToConfig[screennum].GDev.irq; + + /* Make sure older drivers don't segv */ + if (DevToConfig[screennum].GDev.options) { + /* Fill in the available driver options for people to use */ + const char *descrip = + " ### Available Driver options are:-\n" + " ### Values: <i>: integer, <f>: float, " + "<bool>: \"True\"/\"False\",\n" + " ### <string>: \"String\", <freq>: \"<f> Hz/kHz/MHz\",\n" + " ### <percent>: \"<f>%\"\n" + " ### [arg]: arg optional\n"; + ptr->dev_comment = strdup(descrip); + if (ptr->dev_comment) { + for (p = DevToConfig[screennum].GDev.options; + p->name != NULL; p++) { + char *p_e; + const char *prefix = " #Option "; + const char *middle = " \t# "; + const char *suffix = "\n"; + const char *opttype = optionTypeToString(p->type); + char *optname; + int len = strlen(ptr->dev_comment) + strlen(prefix) + + strlen(middle) + strlen(suffix) + 1; + + if (asprintf(&optname, "\"%s\"", p->name) == -1) + break; + + len += max(20, strlen(optname)); + len += strlen(opttype); + + ptr->dev_comment = realloc(ptr->dev_comment, len); + if (!ptr->dev_comment) + break; + p_e = ptr->dev_comment + strlen(ptr->dev_comment); + sprintf(p_e, "%s%-20s%s%s%s", prefix, optname, middle, + opttype, suffix); + free(optname); + } + } + } + + return ptr; +} + +static XF86ConfLayoutPtr +configureLayoutSection (void) +{ + int scrnum = 0; + parsePrologue (XF86ConfLayoutPtr, XF86ConfLayoutRec) + + ptr->lay_identifier = "X.org Configured"; + + { + XF86ConfInputrefPtr iptr; + + iptr = malloc (sizeof (XF86ConfInputrefRec)); + iptr->list.next = NULL; + iptr->iref_option_lst = NULL; + iptr->iref_inputdev_str = "Mouse0"; + iptr->iref_option_lst = + xf86addNewOption (iptr->iref_option_lst, strdup("CorePointer"), NULL); + ptr->lay_input_lst = (XF86ConfInputrefPtr) + xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); + } + + { + XF86ConfInputrefPtr iptr; + + iptr = malloc (sizeof (XF86ConfInputrefRec)); + iptr->list.next = NULL; + iptr->iref_option_lst = NULL; + iptr->iref_inputdev_str = "Keyboard0"; + iptr->iref_option_lst = + xf86addNewOption (iptr->iref_option_lst, strdup("CoreKeyboard"), NULL); + ptr->lay_input_lst = (XF86ConfInputrefPtr) + xf86addListItem ((glp) ptr->lay_input_lst, (glp) iptr); + } + + for (scrnum = 0; scrnum < nDevToConfig; scrnum++) { + XF86ConfAdjacencyPtr aptr; + + aptr = malloc (sizeof (XF86ConfAdjacencyRec)); + aptr->list.next = NULL; + aptr->adj_x = 0; + aptr->adj_y = 0; + aptr->adj_scrnum = scrnum; + XNFasprintf(&aptr->adj_screen_str, "Screen%d", scrnum); + if (scrnum == 0) { + aptr->adj_where = CONF_ADJ_ABSOLUTE; + aptr->adj_refscreen = NULL; + } + else { + aptr->adj_where = CONF_ADJ_RIGHTOF; + XNFasprintf(&aptr->adj_refscreen, "Screen%d", scrnum - 1); + } + ptr->lay_adjacency_lst = + (XF86ConfAdjacencyPtr)xf86addListItem((glp)ptr->lay_adjacency_lst, + (glp)aptr); + } + + return ptr; +} + +static XF86ConfFlagsPtr +configureFlagsSection (void) +{ + parsePrologue (XF86ConfFlagsPtr, XF86ConfFlagsRec) + + return ptr; +} + +static XF86ConfModulePtr +configureModuleSection (void) +{ + char **elist, **el; + /* Find the list of extension & font modules. */ + const char *esubdirs[] = { + "extensions", + "fonts", + NULL + }; + parsePrologue (XF86ConfModulePtr, XF86ConfModuleRec) + + elist = LoaderListDirs(esubdirs, NULL); + if (elist) { + for (el = elist; *el; el++) { + XF86LoadPtr module; + + module = calloc(1, sizeof(XF86LoadRec)); + module->load_name = *el; + ptr->mod_load_lst = (XF86LoadPtr)xf86addListItem( + (glp)ptr->mod_load_lst, (glp)module); + } + free(elist); + } + + return ptr; +} + +static XF86ConfFilesPtr +configureFilesSection (void) +{ + parsePrologue (XF86ConfFilesPtr, XF86ConfFilesRec) + + if (xf86ModulePath) + ptr->file_modulepath = strdup(xf86ModulePath); + if (defaultFontPath) + ptr->file_fontpath = strdup(defaultFontPath); + + return ptr; +} + +static XF86ConfMonitorPtr +configureMonitorSection (int screennum) +{ + parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) + + XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); + ptr->mon_vendor = strdup("Monitor Vendor"); + ptr->mon_modelname = strdup("Monitor Model"); + + return ptr; +} + +/* Initialize Configure Monitor from Detailed Timing Block */ +static void handle_detailed_input(struct detailed_monitor_section *det_mon, + void *data) +{ + XF86ConfMonitorPtr ptr = (XF86ConfMonitorPtr) data; + + switch (det_mon->type) { + case DS_NAME: + ptr->mon_modelname = realloc(ptr->mon_modelname, + strlen((char*)(det_mon->section.name)) + + 1); + strcpy(ptr->mon_modelname, + (char*)(det_mon->section.name)); + break; + case DS_RANGES: + ptr->mon_hsync[ptr->mon_n_hsync].lo = + det_mon->section.ranges.min_h; + ptr->mon_hsync[ptr->mon_n_hsync].hi = + det_mon->section.ranges.max_h; + ptr->mon_n_vrefresh = 1; + ptr->mon_vrefresh[ptr->mon_n_hsync].lo = + det_mon->section.ranges.min_v; + ptr->mon_vrefresh[ptr->mon_n_hsync].hi = + det_mon->section.ranges.max_v; + ptr->mon_n_hsync++; + default: + break; + } +} + +static XF86ConfMonitorPtr +configureDDCMonitorSection (int screennum) +{ + int len, mon_width, mon_height; +#define displaySizeMaxLen 80 + char displaySize_string[displaySizeMaxLen]; + int displaySizeLen; + + parsePrologue (XF86ConfMonitorPtr, XF86ConfMonitorRec) + + XNFasprintf(&ptr->mon_identifier, "Monitor%d", screennum); + ptr->mon_vendor = strdup(ConfiguredMonitor->vendor.name); + XNFasprintf(&ptr->mon_modelname, "%x", ConfiguredMonitor->vendor.prod_id); + + /* features in centimetres, we want millimetres */ + mon_width = 10 * ConfiguredMonitor->features.hsize ; + mon_height = 10 * ConfiguredMonitor->features.vsize ; + +#ifdef CONFIGURE_DISPLAYSIZE + ptr->mon_width = mon_width; + ptr->mon_height = mon_height; +#else + if (mon_width && mon_height) { + /* when values available add DisplaySize option AS A COMMENT */ + + displaySizeLen = snprintf(displaySize_string, displaySizeMaxLen, + "\t#DisplaySize\t%5d %5d\t# mm\n", + mon_width, mon_height); + + if (displaySizeLen>0 && displaySizeLen<displaySizeMaxLen) { + if (ptr->mon_comment) { + len = strlen(ptr->mon_comment); + } else { + len = 0; + } + if ((ptr->mon_comment = + realloc(ptr->mon_comment, len + strlen(displaySize_string) + 1))) { + strcpy(ptr->mon_comment + len, displaySize_string); + } + } + } +#endif /* def CONFIGURE_DISPLAYSIZE */ + + xf86ForEachDetailedBlock(ConfiguredMonitor, handle_detailed_input, + ptr); + + if (ConfiguredMonitor->features.dpms) { + ptr->mon_option_lst = xf86addNewOption(ptr->mon_option_lst, strdup("DPMS"), NULL); + } + + return ptr; +} + +#if !defined(PATH_MAX) +# define PATH_MAX 1024 +#endif + +void +DoConfigure(void) +{ + int i,j, screennum = -1; + char *home = NULL; + char filename[PATH_MAX]; + char *addslash = ""; + XF86ConfigPtr xf86config = NULL; + char **vlist, **vl; + int *dev2screen; + + vlist = xf86DriverlistFromCompile(); + + if (!vlist) { + ErrorF("Missing output drivers. Configuration failed.\n"); + goto bail; + } + + ErrorF("List of video drivers:\n"); + for (vl = vlist; *vl; vl++) + ErrorF("\t%s\n", *vl); + + /* Load all the drivers that were found. */ + xf86LoadModules(vlist, NULL); + + free(vlist); + + for (i = 0; i < xf86NumDrivers; i++) { + xorgHWFlags flags; + if (!xf86DriverList[i]->driverFunc + || !xf86DriverList[i]->driverFunc(NULL, + GET_REQUIRED_HW_INTERFACES, + &flags) + || NEED_IO_ENABLED(flags)) { + xorgHWAccess = TRUE; + break; + } + } + /* Enable full I/O access */ + if (xorgHWAccess) { + if(!xf86EnableIO()) + /* oops, we have failed */ + xorgHWAccess = FALSE; + } + + /* Create XF86Config file structure */ + xf86config = calloc(1, sizeof(XF86ConfigRec)); + + /* Call all of the probe functions, reporting the results. */ + for (CurrentDriver = 0; CurrentDriver < xf86NumDrivers; CurrentDriver++) { + xorgHWFlags flags; + Bool found_screen; + DriverRec * const drv = xf86DriverList[CurrentDriver]; + + if (!xorgHWAccess) { + if (!drv->driverFunc + || !drv->driverFunc( NULL, GET_REQUIRED_HW_INTERFACES, &flags ) + || NEED_IO_ENABLED(flags)) + continue; + } + + found_screen = xf86CallDriverProbe( drv, TRUE ); + if ( found_screen && drv->Identify ) { + (*drv->Identify)(0); + } + } + + if (nDevToConfig <= 0) { + ErrorF("No devices to configure. Configuration failed.\n"); + goto bail; + } + + /* Add device, monitor and screen sections for detected devices */ + for (screennum = 0; screennum < nDevToConfig; screennum++) { + XF86ConfDevicePtr DevicePtr; + XF86ConfMonitorPtr MonitorPtr; + XF86ConfScreenPtr ScreenPtr; + + DevicePtr = configureDeviceSection(screennum); + xf86config->conf_device_lst = (XF86ConfDevicePtr)xf86addListItem( + (glp)xf86config->conf_device_lst, (glp)DevicePtr); + MonitorPtr = configureMonitorSection(screennum); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem( + (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr); + ScreenPtr = configureScreenSection(screennum); + xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem( + (glp)xf86config->conf_screen_lst, (glp)ScreenPtr); + } + + xf86config->conf_files = configureFilesSection(); + xf86config->conf_modules = configureModuleSection(); + xf86config->conf_flags = configureFlagsSection(); + xf86config->conf_videoadaptor_lst = NULL; + xf86config->conf_modes_lst = NULL; + xf86config->conf_vendor_lst = NULL; + xf86config->conf_dri = NULL; + xf86config->conf_input_lst = configureInputSection(); + xf86config->conf_layout_lst = configureLayoutSection(); + + home = getenv("HOME"); + if ((home == NULL) || (home[0] == '\0')) { + home = "/"; + } else { + /* Determine if trailing slash is present or needed */ + int l = strlen(home); + + if (home[l-1] != '/') { + addslash = "/"; + } + } + + snprintf(filename, sizeof(filename), "%s%s" XF86CONFIGFILE ".new", + home, addslash); + + if (xf86writeConfigFile(filename, xf86config) == 0) { + xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", + filename, strerror(errno)); + goto bail; + } + + xf86DoConfigurePass1 = FALSE; + /* Try to get DDC information filled in */ + xf86ConfigFile = filename; + if (xf86HandleConfigFile(FALSE) != CONFIG_OK) { + goto bail; + } + + xf86DoConfigurePass1 = FALSE; + + dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int)); + + { + Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool)); + for (screennum = 0; screennum < nDevToConfig; screennum++) { + int k,l,n,oldNumScreens; + + i = DevToConfig[screennum].iDriver; + + if (driverProbed[i]) continue; + driverProbed[i] = TRUE; + + oldNumScreens = xf86NumScreens; + + xf86CallDriverProbe( xf86DriverList[i], FALSE ); + + /* reorder */ + k = screennum > 0 ? screennum : 1; + for (l = oldNumScreens; l < xf86NumScreens; l++) { + /* is screen primary? */ + Bool primary = FALSE; + for (n = 0; n<xf86Screens[l]->numEntities; n++) { + if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) { + dev2screen[0] = l; + primary = TRUE; + break; + } + } + if (primary) continue; + /* not primary: assign it to next device of same driver */ + /* + * NOTE: we assume that devices in DevToConfig + * and xf86Screens[] have the same order except + * for the primary device which always comes first. + */ + for (; k < nDevToConfig; k++) { + if (DevToConfig[k].iDriver == i) { + dev2screen[k++] = l; + break; + } + } + } + } + free(driverProbed); + } + + + if (nDevToConfig != xf86NumScreens) { + ErrorF("Number of created screens does not match number of detected" + " devices.\n Configuration failed.\n"); + goto bail; + } + + xf86PostProbe(); + + for (j = 0; j < xf86NumScreens; j++) { + xf86Screens[j]->scrnIndex = j; + } + + xf86freeMonitorList(xf86config->conf_monitor_lst); + xf86config->conf_monitor_lst = NULL; + xf86freeScreenList(xf86config->conf_screen_lst); + xf86config->conf_screen_lst = NULL; + for (j = 0; j < xf86NumScreens; j++) { + XF86ConfMonitorPtr MonitorPtr; + XF86ConfScreenPtr ScreenPtr; + + ConfiguredMonitor = NULL; + + if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], + PROBE_DETECT) && + ConfiguredMonitor) { + MonitorPtr = configureDDCMonitorSection(j); + } else { + MonitorPtr = configureMonitorSection(j); + } + ScreenPtr = configureScreenSection(j); + xf86config->conf_monitor_lst = (XF86ConfMonitorPtr)xf86addListItem( + (glp)xf86config->conf_monitor_lst, (glp)MonitorPtr); + xf86config->conf_screen_lst = (XF86ConfScreenPtr)xf86addListItem( + (glp)xf86config->conf_screen_lst, (glp)ScreenPtr); + } + + if (xf86writeConfigFile(filename, xf86config) == 0) { + xf86Msg(X_ERROR, "Unable to write config file: \"%s\": %s\n", + filename, strerror(errno)); + goto bail; + } + + ErrorF("\n"); + + if (!foundMouse) { + ErrorF("\n"__XSERVERNAME__" is not able to detect your mouse.\n" + "Edit the file and correct the Device.\n"); + } else { + ErrorF("\n"__XSERVERNAME__" detected your mouse at device %s.\n" + "Please check your config if the mouse is still not\n" + "operational, as by default "__XSERVERNAME__ + " tries to autodetect\n" + "the protocol.\n",DFLT_MOUSE_DEV); + } + + if (xf86NumScreens > 1) { + ErrorF("\n"__XSERVERNAME__ + " has configured a multihead system, please check your config.\n"); + } + + ErrorF("\nYour %s file is %s\n\n", XF86CONFIGFILE ,filename); + ErrorF("To test the server, run 'X -config %s'\n\n", filename); + +bail: + OsCleanup(TRUE); + AbortDDX(); + fflush(stderr); + exit(0); +} diff --git a/xorg-server/hw/xfree86/common/xf86Cursor.c b/xorg-server/hw/xfree86/common/xf86Cursor.c index acfa79f10..929f047cc 100644 --- a/xorg-server/hw/xfree86/common/xf86Cursor.c +++ b/xorg-server/hw/xfree86/common/xf86Cursor.c @@ -1,860 +1,860 @@ -/*
- * Copyright (c) 1994-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 <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include "input.h"
-#include "cursor.h"
-#include "mipointer.h"
-#include "scrnintstr.h"
-#include "globals.h"
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSproc.h"
-
-#include <X11/extensions/XIproto.h>
-#include "xf86Xinput.h"
-
-#ifdef XFreeXDGA
-#include "dgaproc.h"
-#endif
-
-typedef struct _xf86EdgeRec {
- short screen;
- short start;
- short end;
- DDXPointRec offset;
- struct _xf86EdgeRec *next;
-} xf86EdgeRec, *xf86EdgePtr;
-
-typedef struct {
- xf86EdgePtr left, right, up, down;
-} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr;
-
-static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y);
-static void xf86CrossScreen(ScreenPtr pScreen, Bool entering);
-static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y);
-
-static void xf86PointerMoved(int scrnIndex, int x, int y);
-
-static miPointerScreenFuncRec xf86PointerScreenFuncs = {
- xf86CursorOffScreen,
- xf86CrossScreen,
- xf86WarpCursor,
- /* let miPointerInitialize take care of these */
- NULL,
- NULL
-};
-
-static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS];
-
-static Bool HardEdges;
-
-/*
- * xf86InitViewport --
- * Initialize paning & zooming parameters, so that a driver must only
- * check what resolutions are possible and whether the virtual area
- * is valid if specified.
- */
-
-void
-xf86InitViewport(ScrnInfoPtr pScr)
-{
-
- pScr->PointerMoved = xf86PointerMoved;
-
- /*
- * Compute the initial Viewport if necessary
- */
- if (pScr->display) {
- if (pScr->display->frameX0 < 0) {
- pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2;
- pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2;
- } else {
- pScr->frameX0 = pScr->display->frameX0;
- pScr->frameY0 = pScr->display->frameY0;
- }
- }
-
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
-
- /*
- * Now adjust the initial Viewport, so it lies within the virtual area
- */
- if (pScr->frameX1 >= pScr->virtualX)
- {
- pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay;
- pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1;
- }
-
- if (pScr->frameY1 >= pScr->virtualY)
- {
- pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay;
- pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1;
- }
-}
-
-
-/*
- * xf86SetViewport --
- * Scroll the visual part of the screen so the pointer is visible.
- */
-
-void
-xf86SetViewport(ScreenPtr pScreen, int x, int y)
-{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
-
- (*pScr->PointerMoved)(pScreen->myNum, x, y);
-}
-
-
-static void
-xf86PointerMoved(int scrnIndex, int x, int y)
-{
- Bool frameChanged = FALSE;
- ScrnInfoPtr pScr = xf86Screens[scrnIndex];
-
- /*
- * check wether (x,y) belongs to the visual part of the screen
- * if not, change the base of the displayed frame accoring
- */
- if ( pScr->frameX0 > x) {
- pScr->frameX0 = x;
- pScr->frameX1 = x + pScr->currentMode->HDisplay - 1;
- frameChanged = TRUE ;
- }
-
- if ( pScr->frameX1 < x) {
- pScr->frameX1 = x + 1;
- pScr->frameX0 = x - pScr->currentMode->HDisplay + 1;
- frameChanged = TRUE ;
- }
-
- if ( pScr->frameY0 > y) {
- pScr->frameY0 = y;
- pScr->frameY1 = y + pScr->currentMode->VDisplay - 1;
- frameChanged = TRUE;
- }
-
- if ( pScr->frameY1 < y) {
- pScr->frameY1 = y;
- pScr->frameY0 = y - pScr->currentMode->VDisplay + 1;
- frameChanged = TRUE;
- }
-
- if (frameChanged && pScr->AdjustFrame != NULL)
- pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
-}
-
-/*
- * xf86LockZoom --
- * Enable/disable ZoomViewport
- */
-
-void
-xf86LockZoom(ScreenPtr pScreen, Bool lock)
-{
- XF86SCRNINFO(pScreen)->zoomLocked = lock;
-}
-
-/*
- * xf86SwitchMode --
- * This is called by both keyboard processing and the VidMode extension to
- * set a new mode.
- */
-
-Bool
-xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode)
-{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
- ScreenPtr pCursorScreen;
- Bool Switched;
- int px, py;
- DeviceIntPtr dev, it;
-
- if (!pScr->vtSema || !mode || !pScr->SwitchMode)
- return FALSE;
-
-#ifdef XFreeXDGA
- if (DGAActive(pScr->scrnIndex))
- return FALSE;
-#endif
-
- if (mode == pScr->currentMode)
- return TRUE;
-
- if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY)
- return FALSE;
-
- /* Let's take an educated guess for which pointer to take here. And about as
- educated as it gets is to take the first pointer we find.
- */
- for (dev = inputInfo.devices; dev; dev = dev->next)
- {
- if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner)
- break;
- }
-
- pCursorScreen = miPointerGetScreen(dev);
- if (pScreen == pCursorScreen)
- miPointerGetPosition(dev, &px, &py);
-
- xf86EnterServerState(SETUP);
- Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0);
- if (Switched) {
- pScr->currentMode = mode;
-
- /*
- * Adjust frame for new display size.
- * Frame is centered around cursor position if cursor is on same screen.
- */
- if (pScreen == pCursorScreen)
- pScr->frameX0 = px - (mode->HDisplay / 2) + 1;
- else
- pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2;
-
- if (pScr->frameX0 < 0)
- pScr->frameX0 = 0;
-
- pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1;
- if (pScr->frameX1 >= pScr->virtualX) {
- pScr->frameX0 = pScr->virtualX - mode->HDisplay;
- pScr->frameX1 = pScr->virtualX - 1;
- }
-
- if (pScreen == pCursorScreen)
- pScr->frameY0 = py - (mode->VDisplay / 2) + 1;
- else
- pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2;
-
- if (pScr->frameY0 < 0)
- pScr->frameY0 = 0;
-
- pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1;
- if (pScr->frameY1 >= pScr->virtualY) {
- pScr->frameY0 = pScr->virtualY - mode->VDisplay;
- pScr->frameY1 = pScr->virtualY - 1;
- }
- }
- xf86EnterServerState(OPERATING);
-
- if (pScr->AdjustFrame)
- (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0);
-
- /* The original code centered the frame around the cursor if possible.
- * Since this is hard to achieve with multiple cursors, we do the following:
- * - center around the first pointer
- * - move all other pointers to the nearest edge on the screen (or leave
- * them unmodified if they are within the boundaries).
- */
- if (pScreen == pCursorScreen)
- {
- xf86WarpCursor(dev, pScreen, px, py);
- }
-
- for (it = inputInfo.devices; it; it = it->next)
- {
- if (it == dev)
- continue;
-
- if (IsPointerDevice(it) && it->spriteInfo->spriteOwner)
- {
- pCursorScreen = miPointerGetScreen(it);
- if (pScreen == pCursorScreen)
- {
- miPointerGetPosition(it, &px, &py);
- if (px < pScr->frameX0)
- px = pScr->frameX0;
- else if (px > pScr->frameX1)
- px = pScr->frameX1;
-
- if(py < pScr->frameY0)
- py = pScr->frameY0;
- else if(py > pScr->frameY1)
- py = pScr->frameY1;
-
- xf86WarpCursor(it, pScreen, px, py);
- }
- }
- }
-
- return Switched;
-}
-
-/*
- * xf86ZoomViewport --
- * Reinitialize the visual part of the screen for another mode.
- */
-
-void
-xf86ZoomViewport(ScreenPtr pScreen, int zoom)
-{
- ScrnInfoPtr pScr = XF86SCRNINFO(pScreen);
- DisplayModePtr mode;
-
- if (pScr->zoomLocked || !(mode = pScr->currentMode))
- return;
-
- do {
- if (zoom > 0)
- mode = mode->next;
- else
- mode = mode->prev;
- } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF));
-
- (void)xf86SwitchMode(pScreen, mode);
-}
-
-
-static xf86EdgePtr
-FindEdge(xf86EdgePtr edge, int val)
-{
- while(edge && (edge->end <= val))
- edge = edge->next;
-
- if(edge && (edge->start <= val))
- return edge;
-
- return NULL;
-}
-
-/*
- * xf86CursorOffScreen --
- * Check whether it is necessary to switch to another screen
- */
-
-static Bool
-xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y)
-{
- xf86EdgePtr edge;
- int tmp;
-
- if(screenInfo.numScreens == 1)
- return FALSE;
-
- if(*x < 0) {
- tmp = *y;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].left))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *x = 0;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- *pScreen = xf86Screens[edge->screen]->pScreen;
- }
- }
-
- if(*x >= (*pScreen)->width) {
- tmp = *y;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].right))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *x = (*pScreen)->width - 1;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- *pScreen = xf86Screens[edge->screen]->pScreen;
- }
- }
-
- if(*y < 0) {
- tmp = *x;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].up))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *y = 0;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- *pScreen = xf86Screens[edge->screen]->pScreen;
- }
- }
-
- if(*y >= (*pScreen)->height) {
- tmp = *x;
- if(tmp < 0) tmp = 0;
- if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1;
-
- if((edge = xf86ScreenLayout[(*pScreen)->myNum].down))
- edge = FindEdge(edge, tmp);
-
- if(!edge) *y = (*pScreen)->height - 1;
- else {
- *x += edge->offset.x;
- *y += edge->offset.y;
- (*pScreen) = xf86Screens[edge->screen]->pScreen;
- }
- }
-
-
-#if 0
- /* This presents problems for overlapping screens when
- HardEdges is used. Have to think about the logic more */
- if((*x < 0) || (*x >= (*pScreen)->width) ||
- (*y < 0) || (*y >= (*pScreen)->height)) {
- /* We may have crossed more than one screen */
- xf86CursorOffScreen(pScreen, x, y);
- }
-#endif
-
- return TRUE;
-}
-
-
-
-/*
- * xf86CrossScreen --
- * Switch to another screen
- *
- * Currently nothing special happens, but mi assumes the CrossScreen
- * method exists.
- */
-
-static void
-xf86CrossScreen (ScreenPtr pScreen, Bool entering)
-{
-}
-
-
-/*
- * xf86WarpCursor --
- * Warp possible to another screen
- */
-
-/* ARGSUSED */
-static void
-xf86WarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y)
-{
- int sigstate;
- sigstate = xf86BlockSIGIO ();
- miPointerWarpCursor(pDev, pScreen, x, y);
-
- xf86Info.currentScreen = pScreen;
- xf86UnblockSIGIO (sigstate);
-}
-
-
-void *
-xf86GetPointerScreenFuncs(void)
-{
- return (void *)&xf86PointerScreenFuncs;
-}
-
-
-static xf86EdgePtr
-AddEdge(
- xf86EdgePtr edge,
- short min,
- short max,
- short dx,
- short dy,
- short screen
-){
- xf86EdgePtr pEdge = edge, pPrev = NULL, pNew;
-
- while(1) {
- while(pEdge && (min >= pEdge->end)) {
- pPrev = pEdge;
- pEdge = pEdge->next;
- }
-
- if(!pEdge) {
- if(!(pNew = malloc(sizeof(xf86EdgeRec))))
- break;
-
- pNew->screen = screen;
- pNew->start = min;
- pNew->end = max;
- pNew->offset.x = dx;
- pNew->offset.y = dy;
- pNew->next = NULL;
-
- if(pPrev)
- pPrev->next = pNew;
- else
- edge = pNew;
-
- break;
- } else if (min < pEdge->start) {
- if(!(pNew = malloc(sizeof(xf86EdgeRec))))
- break;
-
- pNew->screen = screen;
- pNew->start = min;
- pNew->offset.x = dx;
- pNew->offset.y = dy;
- pNew->next = pEdge;
-
- if(pPrev) pPrev->next = pNew;
- else edge = pNew;
-
- if(max <= pEdge->start) {
- pNew->end = max;
- break;
- } else {
- pNew->end = pEdge->start;
- min = pEdge->end;
- }
- } else
- min = pEdge->end;
-
- pPrev = pEdge;
- pEdge = pEdge->next;
-
- if(max <= min) break;
- }
-
- return edge;
-}
-
-static void
-FillOutEdge(xf86EdgePtr pEdge, int limit)
-{
- xf86EdgePtr pNext;
- int diff;
-
- if(pEdge->start > 0) pEdge->start = 0;
-
- while((pNext = pEdge->next)) {
- diff = pNext->start - pEdge->end;
- if(diff > 0) {
- pEdge->end += diff >> 1;
- pNext->start -= diff - (diff >> 1);
- }
- pEdge = pNext;
- }
-
- if(pEdge->end < limit)
- pEdge->end = limit;
-}
-
-/*
- * xf86InitOrigins() can deal with a maximum of 32 screens
- * on 32 bit architectures, 64 on 64 bit architectures.
- */
-
-void
-xf86InitOrigins(void)
-{
- unsigned long screensLeft, prevScreensLeft, mask;
- screenLayoutPtr screen;
- ScreenPtr pScreen, refScreen;
- int x1, x2, y1, y2, left, right, top, bottom;
- int i, j, ref, minX, minY, min, max;
- xf86ScreenLayoutPtr pLayout;
- Bool OldStyleConfig = FALSE;
-
- /* need to have this set up with a config file option */
- HardEdges = FALSE;
-
- memset(xf86ScreenLayout, 0, MAXSCREENS * sizeof(xf86ScreenLayoutRec));
-
- screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1;
-
- while(1) {
- for(mask = screensLeft, i = 0; mask; mask >>= 1, i++) {
- if(!(mask & 1L)) continue;
-
- screen = &xf86ConfigLayout.screens[i];
-
- if (screen->refscreen != NULL &&
- screen->refscreen->screennum >= xf86NumScreens) {
- screensLeft &= ~(1 << i);
- xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n",
- screen->screen->id);
- continue;
- }
-
- pScreen = xf86Screens[i]->pScreen;
- switch(screen->where) {
- case PosObsolete:
- OldStyleConfig = TRUE;
- pLayout = &xf86ScreenLayout[i];
- /* force edge lists */
- if(screen->left) {
- ref = screen->left->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->left = AddEdge(pLayout->left,
- 0, pScreen->height,
- xf86Screens[ref]->pScreen->width, 0, ref);
- }
- if(screen->right) {
- ref = screen->right->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->right = AddEdge(pLayout->right,
- 0, pScreen->height, -pScreen->width, 0, ref);
- }
- if(screen->top) {
- ref = screen->top->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->up = AddEdge(pLayout->up,
- 0, pScreen->width,
- 0, xf86Screens[ref]->pScreen->height, ref);
- }
- if(screen->bottom) {
- ref = screen->bottom->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- pLayout->down = AddEdge(pLayout->down,
- 0, pScreen->width, 0, -pScreen->height, ref);
- }
- /* we could also try to place it based on those
- relative locations if we wanted to */
- screen->x = screen->y = 0;
- /* FALLTHROUGH */
- case PosAbsolute:
- pScreen->x = screen->x;
- pScreen->y = screen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosRelative:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x + screen->x;
- pScreen->y = refScreen->y + screen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosRightOf:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x + refScreen->width;
- pScreen->y = refScreen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosLeftOf:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x - pScreen->width;
- pScreen->y = refScreen->y;
- screensLeft &= ~(1 << i);
- break;
- case PosBelow:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y + refScreen->height;
- screensLeft &= ~(1 << i);
- break;
- case PosAbove:
- ref = screen->refscreen->screennum;
- if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) {
- ErrorF("Referenced uninitialized screen in Layout!\n");
- break;
- }
- if(screensLeft & (1 << ref)) break;
- refScreen = xf86Screens[ref]->pScreen;
- pScreen->x = refScreen->x;
- pScreen->y = refScreen->y - pScreen->height;
- screensLeft &= ~(1 << i);
- break;
- default:
- ErrorF("Illegal placement keyword in Layout!\n");
- break;
- }
-
- }
-
- if(!screensLeft) break;
-
- if(screensLeft == prevScreensLeft) {
- /* All the remaining screens are referencing each other.
- Assign a value to one of them and go through again */
- i = 0;
- while(!((1 << i) & screensLeft)){ i++; }
-
- ref = xf86ConfigLayout.screens[i].refscreen->screennum;
- xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0;
- screensLeft &= ~(1 << ref);
- }
-
- prevScreensLeft = screensLeft;
- }
-
- /* justify the topmost and leftmost to (0,0) */
- minX = xf86Screens[0]->pScreen->x;
- minY = xf86Screens[0]->pScreen->y;
-
- for(i = 1; i < xf86NumScreens; i++) {
- if(xf86Screens[i]->pScreen->x < minX)
- minX = xf86Screens[i]->pScreen->x;
- if(xf86Screens[i]->pScreen->y < minY)
- minY = xf86Screens[i]->pScreen->y;
- }
-
- if (minX || minY) {
- for(i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->pScreen->x -= minX;
- xf86Screens[i]->pScreen->y -= minY;
- }
- }
-
-
- /* Create the edge lists */
-
- if(!OldStyleConfig) {
- for(i = 0; i < xf86NumScreens; i++) {
- pLayout = &xf86ScreenLayout[i];
-
- pScreen = xf86Screens[i]->pScreen;
-
- left = pScreen->x;
- right = left + pScreen->width;
- top = pScreen->y;
- bottom = top + pScreen->height;
-
- for(j = 0; j < xf86NumScreens; j++) {
- if(i == j) continue;
-
- refScreen = xf86Screens[j]->pScreen;
-
- x1 = refScreen->x;
- x2 = x1 + refScreen->width;
- y1 = refScreen->y;
- y2 = y1 + refScreen->height;
-
- if((bottom > y1) && (top < y2)) {
- min = y1 - top;
- if(min < 0) min = 0;
- max = pScreen->height - (bottom - y2);
- if(max > pScreen->height) max = pScreen->height;
-
- if(((left - 1) >= x1) && ((left - 1) < x2))
- pLayout->left = AddEdge(pLayout->left, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
-
- if((right >= x1) && (right < x2))
- pLayout->right = AddEdge(pLayout->right, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
- }
-
-
- if((left < x2) && (right > x1)) {
- min = x1 - left;
- if(min < 0) min = 0;
- max = pScreen->width - (right - x2);
- if(max > pScreen->width) max = pScreen->width;
-
- if(((top - 1) >= y1) && ((top - 1) < y2))
- pLayout->up = AddEdge(pLayout->up, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
-
- if((bottom >= y1) && (bottom < y2))
- pLayout->down = AddEdge(pLayout->down, min, max,
- pScreen->x - refScreen->x,
- pScreen->y - refScreen->y, j);
- }
- }
- }
- }
-
- if(!HardEdges && !OldStyleConfig) {
- for(i = 0; i < xf86NumScreens; i++) {
- pLayout = &xf86ScreenLayout[i];
- pScreen = xf86Screens[i]->pScreen;
- if(pLayout->left)
- FillOutEdge(pLayout->left, pScreen->height);
- if(pLayout->right)
- FillOutEdge(pLayout->right, pScreen->height);
- if(pLayout->up)
- FillOutEdge(pLayout->up, pScreen->width);
- if(pLayout->down)
- FillOutEdge(pLayout->down, pScreen->width);
- }
- }
-}
-
-void
-xf86ReconfigureLayout(void)
-{
- int i;
-
- for (i = 0; i < MAXSCREENS; i++) {
- xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i];
- /* we don't have to zero these, xf86InitOrigins() takes care of that */
- free(sl->left);
- free(sl->right);
- free(sl->up);
- free(sl->down);
- }
-
- xf86InitOrigins();
-}
-
-
+/* + * Copyright (c) 1994-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 <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xmd.h> +#include "input.h" +#include "cursor.h" +#include "mipointer.h" +#include "scrnintstr.h" +#include "globals.h" + +#include "compiler.h" + +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSproc.h" + +#include <X11/extensions/XIproto.h> +#include "xf86Xinput.h" + +#ifdef XFreeXDGA +#include "dgaproc.h" +#endif + +typedef struct _xf86EdgeRec { + short screen; + short start; + short end; + DDXPointRec offset; + struct _xf86EdgeRec *next; +} xf86EdgeRec, *xf86EdgePtr; + +typedef struct { + xf86EdgePtr left, right, up, down; +} xf86ScreenLayoutRec, *xf86ScreenLayoutPtr; + +static Bool xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y); +static void xf86CrossScreen(ScreenPtr pScreen, Bool entering); +static void xf86WarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); + +static void xf86PointerMoved(int scrnIndex, int x, int y); + +static miPointerScreenFuncRec xf86PointerScreenFuncs = { + xf86CursorOffScreen, + xf86CrossScreen, + xf86WarpCursor, + /* let miPointerInitialize take care of these */ + NULL, + NULL +}; + +static xf86ScreenLayoutRec xf86ScreenLayout[MAXSCREENS]; + +static Bool HardEdges; + +/* + * xf86InitViewport -- + * Initialize paning & zooming parameters, so that a driver must only + * check what resolutions are possible and whether the virtual area + * is valid if specified. + */ + +void +xf86InitViewport(ScrnInfoPtr pScr) +{ + + pScr->PointerMoved = xf86PointerMoved; + + /* + * Compute the initial Viewport if necessary + */ + if (pScr->display) { + if (pScr->display->frameX0 < 0) { + pScr->frameX0 = (pScr->virtualX - pScr->modes->HDisplay) / 2; + pScr->frameY0 = (pScr->virtualY - pScr->modes->VDisplay) / 2; + } else { + pScr->frameX0 = pScr->display->frameX0; + pScr->frameY0 = pScr->display->frameY0; + } + } + + pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; + + /* + * Now adjust the initial Viewport, so it lies within the virtual area + */ + if (pScr->frameX1 >= pScr->virtualX) + { + pScr->frameX0 = pScr->virtualX - pScr->modes->HDisplay; + pScr->frameX1 = pScr->frameX0 + pScr->modes->HDisplay - 1; + } + + if (pScr->frameY1 >= pScr->virtualY) + { + pScr->frameY0 = pScr->virtualY - pScr->modes->VDisplay; + pScr->frameY1 = pScr->frameY0 + pScr->modes->VDisplay - 1; + } +} + + +/* + * xf86SetViewport -- + * Scroll the visual part of the screen so the pointer is visible. + */ + +void +xf86SetViewport(ScreenPtr pScreen, int x, int y) +{ + ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + + (*pScr->PointerMoved)(pScreen->myNum, x, y); +} + + +static void +xf86PointerMoved(int scrnIndex, int x, int y) +{ + Bool frameChanged = FALSE; + ScrnInfoPtr pScr = xf86Screens[scrnIndex]; + + /* + * check wether (x,y) belongs to the visual part of the screen + * if not, change the base of the displayed frame accoring + */ + if ( pScr->frameX0 > x) { + pScr->frameX0 = x; + pScr->frameX1 = x + pScr->currentMode->HDisplay - 1; + frameChanged = TRUE ; + } + + if ( pScr->frameX1 < x) { + pScr->frameX1 = x + 1; + pScr->frameX0 = x - pScr->currentMode->HDisplay + 1; + frameChanged = TRUE ; + } + + if ( pScr->frameY0 > y) { + pScr->frameY0 = y; + pScr->frameY1 = y + pScr->currentMode->VDisplay - 1; + frameChanged = TRUE; + } + + if ( pScr->frameY1 < y) { + pScr->frameY1 = y; + pScr->frameY0 = y - pScr->currentMode->VDisplay + 1; + frameChanged = TRUE; + } + + if (frameChanged && pScr->AdjustFrame != NULL) + pScr->AdjustFrame(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); +} + +/* + * xf86LockZoom -- + * Enable/disable ZoomViewport + */ + +void +xf86LockZoom(ScreenPtr pScreen, Bool lock) +{ + XF86SCRNINFO(pScreen)->zoomLocked = lock; +} + +/* + * xf86SwitchMode -- + * This is called by both keyboard processing and the VidMode extension to + * set a new mode. + */ + +Bool +xf86SwitchMode(ScreenPtr pScreen, DisplayModePtr mode) +{ + ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + ScreenPtr pCursorScreen; + Bool Switched; + int px, py, was_blocked; + DeviceIntPtr dev, it; + + if (!pScr->vtSema || !mode || !pScr->SwitchMode) + return FALSE; + +#ifdef XFreeXDGA + if (DGAActive(pScr->scrnIndex)) + return FALSE; +#endif + + if (mode == pScr->currentMode) + return TRUE; + + if (mode->HDisplay > pScr->virtualX || mode->VDisplay > pScr->virtualY) + return FALSE; + + /* Let's take an educated guess for which pointer to take here. And about as + educated as it gets is to take the first pointer we find. + */ + for (dev = inputInfo.devices; dev; dev = dev->next) + { + if (IsPointerDevice(dev) && dev->spriteInfo->spriteOwner) + break; + } + + pCursorScreen = miPointerGetScreen(dev); + if (pScreen == pCursorScreen) + miPointerGetPosition(dev, &px, &py); + + was_blocked = xf86BlockSIGIO(); + Switched = (*pScr->SwitchMode)(pScr->scrnIndex, mode, 0); + if (Switched) { + pScr->currentMode = mode; + + /* + * Adjust frame for new display size. + * Frame is centered around cursor position if cursor is on same screen. + */ + if (pScreen == pCursorScreen) + pScr->frameX0 = px - (mode->HDisplay / 2) + 1; + else + pScr->frameX0 = (pScr->frameX0 + pScr->frameX1 + 1 - mode->HDisplay) / 2; + + if (pScr->frameX0 < 0) + pScr->frameX0 = 0; + + pScr->frameX1 = pScr->frameX0 + mode->HDisplay - 1; + if (pScr->frameX1 >= pScr->virtualX) { + pScr->frameX0 = pScr->virtualX - mode->HDisplay; + pScr->frameX1 = pScr->virtualX - 1; + } + + if (pScreen == pCursorScreen) + pScr->frameY0 = py - (mode->VDisplay / 2) + 1; + else + pScr->frameY0 = (pScr->frameY0 + pScr->frameY1 + 1 - mode->VDisplay) / 2; + + if (pScr->frameY0 < 0) + pScr->frameY0 = 0; + + pScr->frameY1 = pScr->frameY0 + mode->VDisplay - 1; + if (pScr->frameY1 >= pScr->virtualY) { + pScr->frameY0 = pScr->virtualY - mode->VDisplay; + pScr->frameY1 = pScr->virtualY - 1; + } + } + xf86UnblockSIGIO(was_blocked); + + if (pScr->AdjustFrame) + (*pScr->AdjustFrame)(pScr->scrnIndex, pScr->frameX0, pScr->frameY0, 0); + + /* The original code centered the frame around the cursor if possible. + * Since this is hard to achieve with multiple cursors, we do the following: + * - center around the first pointer + * - move all other pointers to the nearest edge on the screen (or leave + * them unmodified if they are within the boundaries). + */ + if (pScreen == pCursorScreen) + { + xf86WarpCursor(dev, pScreen, px, py); + } + + for (it = inputInfo.devices; it; it = it->next) + { + if (it == dev) + continue; + + if (IsPointerDevice(it) && it->spriteInfo->spriteOwner) + { + pCursorScreen = miPointerGetScreen(it); + if (pScreen == pCursorScreen) + { + miPointerGetPosition(it, &px, &py); + if (px < pScr->frameX0) + px = pScr->frameX0; + else if (px > pScr->frameX1) + px = pScr->frameX1; + + if(py < pScr->frameY0) + py = pScr->frameY0; + else if(py > pScr->frameY1) + py = pScr->frameY1; + + xf86WarpCursor(it, pScreen, px, py); + } + } + } + + return Switched; +} + +/* + * xf86ZoomViewport -- + * Reinitialize the visual part of the screen for another mode. + */ + +void +xf86ZoomViewport(ScreenPtr pScreen, int zoom) +{ + ScrnInfoPtr pScr = XF86SCRNINFO(pScreen); + DisplayModePtr mode; + + if (pScr->zoomLocked || !(mode = pScr->currentMode)) + return; + + do { + if (zoom > 0) + mode = mode->next; + else + mode = mode->prev; + } while (mode != pScr->currentMode && !(mode->type & M_T_USERDEF)); + + (void)xf86SwitchMode(pScreen, mode); +} + + +static xf86EdgePtr +FindEdge(xf86EdgePtr edge, int val) +{ + while(edge && (edge->end <= val)) + edge = edge->next; + + if(edge && (edge->start <= val)) + return edge; + + return NULL; +} + +/* + * xf86CursorOffScreen -- + * Check whether it is necessary to switch to another screen + */ + +static Bool +xf86CursorOffScreen(ScreenPtr *pScreen, int *x, int *y) +{ + xf86EdgePtr edge; + int tmp; + + if(screenInfo.numScreens == 1) + return FALSE; + + if(*x < 0) { + tmp = *y; + if(tmp < 0) tmp = 0; + if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1; + + if((edge = xf86ScreenLayout[(*pScreen)->myNum].left)) + edge = FindEdge(edge, tmp); + + if(!edge) *x = 0; + else { + *x += edge->offset.x; + *y += edge->offset.y; + *pScreen = xf86Screens[edge->screen]->pScreen; + } + } + + if(*x >= (*pScreen)->width) { + tmp = *y; + if(tmp < 0) tmp = 0; + if(tmp >= (*pScreen)->height) tmp = (*pScreen)->height - 1; + + if((edge = xf86ScreenLayout[(*pScreen)->myNum].right)) + edge = FindEdge(edge, tmp); + + if(!edge) *x = (*pScreen)->width - 1; + else { + *x += edge->offset.x; + *y += edge->offset.y; + *pScreen = xf86Screens[edge->screen]->pScreen; + } + } + + if(*y < 0) { + tmp = *x; + if(tmp < 0) tmp = 0; + if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1; + + if((edge = xf86ScreenLayout[(*pScreen)->myNum].up)) + edge = FindEdge(edge, tmp); + + if(!edge) *y = 0; + else { + *x += edge->offset.x; + *y += edge->offset.y; + *pScreen = xf86Screens[edge->screen]->pScreen; + } + } + + if(*y >= (*pScreen)->height) { + tmp = *x; + if(tmp < 0) tmp = 0; + if(tmp >= (*pScreen)->width) tmp = (*pScreen)->width - 1; + + if((edge = xf86ScreenLayout[(*pScreen)->myNum].down)) + edge = FindEdge(edge, tmp); + + if(!edge) *y = (*pScreen)->height - 1; + else { + *x += edge->offset.x; + *y += edge->offset.y; + (*pScreen) = xf86Screens[edge->screen]->pScreen; + } + } + + +#if 0 + /* This presents problems for overlapping screens when + HardEdges is used. Have to think about the logic more */ + if((*x < 0) || (*x >= (*pScreen)->width) || + (*y < 0) || (*y >= (*pScreen)->height)) { + /* We may have crossed more than one screen */ + xf86CursorOffScreen(pScreen, x, y); + } +#endif + + return TRUE; +} + + + +/* + * xf86CrossScreen -- + * Switch to another screen + * + * Currently nothing special happens, but mi assumes the CrossScreen + * method exists. + */ + +static void +xf86CrossScreen (ScreenPtr pScreen, Bool entering) +{ +} + + +/* + * xf86WarpCursor -- + * Warp possible to another screen + */ + +/* ARGSUSED */ +static void +xf86WarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) +{ + int sigstate; + sigstate = xf86BlockSIGIO (); + miPointerWarpCursor(pDev, pScreen, x, y); + + xf86Info.currentScreen = pScreen; + xf86UnblockSIGIO (sigstate); +} + + +void * +xf86GetPointerScreenFuncs(void) +{ + return (void *)&xf86PointerScreenFuncs; +} + + +static xf86EdgePtr +AddEdge( + xf86EdgePtr edge, + short min, + short max, + short dx, + short dy, + short screen +){ + xf86EdgePtr pEdge = edge, pPrev = NULL, pNew; + + while(1) { + while(pEdge && (min >= pEdge->end)) { + pPrev = pEdge; + pEdge = pEdge->next; + } + + if(!pEdge) { + if(!(pNew = malloc(sizeof(xf86EdgeRec)))) + break; + + pNew->screen = screen; + pNew->start = min; + pNew->end = max; + pNew->offset.x = dx; + pNew->offset.y = dy; + pNew->next = NULL; + + if(pPrev) + pPrev->next = pNew; + else + edge = pNew; + + break; + } else if (min < pEdge->start) { + if(!(pNew = malloc(sizeof(xf86EdgeRec)))) + break; + + pNew->screen = screen; + pNew->start = min; + pNew->offset.x = dx; + pNew->offset.y = dy; + pNew->next = pEdge; + + if(pPrev) pPrev->next = pNew; + else edge = pNew; + + if(max <= pEdge->start) { + pNew->end = max; + break; + } else { + pNew->end = pEdge->start; + min = pEdge->end; + } + } else + min = pEdge->end; + + pPrev = pEdge; + pEdge = pEdge->next; + + if(max <= min) break; + } + + return edge; +} + +static void +FillOutEdge(xf86EdgePtr pEdge, int limit) +{ + xf86EdgePtr pNext; + int diff; + + if(pEdge->start > 0) pEdge->start = 0; + + while((pNext = pEdge->next)) { + diff = pNext->start - pEdge->end; + if(diff > 0) { + pEdge->end += diff >> 1; + pNext->start -= diff - (diff >> 1); + } + pEdge = pNext; + } + + if(pEdge->end < limit) + pEdge->end = limit; +} + +/* + * xf86InitOrigins() can deal with a maximum of 32 screens + * on 32 bit architectures, 64 on 64 bit architectures. + */ + +void +xf86InitOrigins(void) +{ + unsigned long screensLeft, prevScreensLeft, mask; + screenLayoutPtr screen; + ScreenPtr pScreen, refScreen; + int x1, x2, y1, y2, left, right, top, bottom; + int i, j, ref, minX, minY, min, max; + xf86ScreenLayoutPtr pLayout; + Bool OldStyleConfig = FALSE; + + /* need to have this set up with a config file option */ + HardEdges = FALSE; + + memset(xf86ScreenLayout, 0, MAXSCREENS * sizeof(xf86ScreenLayoutRec)); + + screensLeft = prevScreensLeft = (1 << xf86NumScreens) - 1; + + while(1) { + for(mask = screensLeft, i = 0; mask; mask >>= 1, i++) { + if(!(mask & 1L)) continue; + + screen = &xf86ConfigLayout.screens[i]; + + if (screen->refscreen != NULL && + screen->refscreen->screennum >= xf86NumScreens) { + screensLeft &= ~(1 << i); + xf86Msg(X_WARNING, "Not including screen \"%s\" in origins calculation.\n", + screen->screen->id); + continue; + } + + pScreen = xf86Screens[i]->pScreen; + switch(screen->where) { + case PosObsolete: + OldStyleConfig = TRUE; + pLayout = &xf86ScreenLayout[i]; + /* force edge lists */ + if(screen->left) { + ref = screen->left->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + pLayout->left = AddEdge(pLayout->left, + 0, pScreen->height, + xf86Screens[ref]->pScreen->width, 0, ref); + } + if(screen->right) { + ref = screen->right->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + pLayout->right = AddEdge(pLayout->right, + 0, pScreen->height, -pScreen->width, 0, ref); + } + if(screen->top) { + ref = screen->top->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + pLayout->up = AddEdge(pLayout->up, + 0, pScreen->width, + 0, xf86Screens[ref]->pScreen->height, ref); + } + if(screen->bottom) { + ref = screen->bottom->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + pLayout->down = AddEdge(pLayout->down, + 0, pScreen->width, 0, -pScreen->height, ref); + } + /* we could also try to place it based on those + relative locations if we wanted to */ + screen->x = screen->y = 0; + /* FALLTHROUGH */ + case PosAbsolute: + pScreen->x = screen->x; + pScreen->y = screen->y; + screensLeft &= ~(1 << i); + break; + case PosRelative: + ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + if(screensLeft & (1 << ref)) break; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x + screen->x; + pScreen->y = refScreen->y + screen->y; + screensLeft &= ~(1 << i); + break; + case PosRightOf: + ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + if(screensLeft & (1 << ref)) break; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x + refScreen->width; + pScreen->y = refScreen->y; + screensLeft &= ~(1 << i); + break; + case PosLeftOf: + ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + if(screensLeft & (1 << ref)) break; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x - pScreen->width; + pScreen->y = refScreen->y; + screensLeft &= ~(1 << i); + break; + case PosBelow: + ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + if(screensLeft & (1 << ref)) break; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x; + pScreen->y = refScreen->y + refScreen->height; + screensLeft &= ~(1 << i); + break; + case PosAbove: + ref = screen->refscreen->screennum; + if (! xf86Screens[ref] || ! xf86Screens[ref]->pScreen) { + ErrorF("Referenced uninitialized screen in Layout!\n"); + break; + } + if(screensLeft & (1 << ref)) break; + refScreen = xf86Screens[ref]->pScreen; + pScreen->x = refScreen->x; + pScreen->y = refScreen->y - pScreen->height; + screensLeft &= ~(1 << i); + break; + default: + ErrorF("Illegal placement keyword in Layout!\n"); + break; + } + + } + + if(!screensLeft) break; + + if(screensLeft == prevScreensLeft) { + /* All the remaining screens are referencing each other. + Assign a value to one of them and go through again */ + i = 0; + while(!((1 << i) & screensLeft)){ i++; } + + ref = xf86ConfigLayout.screens[i].refscreen->screennum; + xf86Screens[ref]->pScreen->x = xf86Screens[ref]->pScreen->y = 0; + screensLeft &= ~(1 << ref); + } + + prevScreensLeft = screensLeft; + } + + /* justify the topmost and leftmost to (0,0) */ + minX = xf86Screens[0]->pScreen->x; + minY = xf86Screens[0]->pScreen->y; + + for(i = 1; i < xf86NumScreens; i++) { + if(xf86Screens[i]->pScreen->x < minX) + minX = xf86Screens[i]->pScreen->x; + if(xf86Screens[i]->pScreen->y < minY) + minY = xf86Screens[i]->pScreen->y; + } + + if (minX || minY) { + for(i = 0; i < xf86NumScreens; i++) { + xf86Screens[i]->pScreen->x -= minX; + xf86Screens[i]->pScreen->y -= minY; + } + } + + + /* Create the edge lists */ + + if(!OldStyleConfig) { + for(i = 0; i < xf86NumScreens; i++) { + pLayout = &xf86ScreenLayout[i]; + + pScreen = xf86Screens[i]->pScreen; + + left = pScreen->x; + right = left + pScreen->width; + top = pScreen->y; + bottom = top + pScreen->height; + + for(j = 0; j < xf86NumScreens; j++) { + if(i == j) continue; + + refScreen = xf86Screens[j]->pScreen; + + x1 = refScreen->x; + x2 = x1 + refScreen->width; + y1 = refScreen->y; + y2 = y1 + refScreen->height; + + if((bottom > y1) && (top < y2)) { + min = y1 - top; + if(min < 0) min = 0; + max = pScreen->height - (bottom - y2); + if(max > pScreen->height) max = pScreen->height; + + if(((left - 1) >= x1) && ((left - 1) < x2)) + pLayout->left = AddEdge(pLayout->left, min, max, + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); + + if((right >= x1) && (right < x2)) + pLayout->right = AddEdge(pLayout->right, min, max, + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); + } + + + if((left < x2) && (right > x1)) { + min = x1 - left; + if(min < 0) min = 0; + max = pScreen->width - (right - x2); + if(max > pScreen->width) max = pScreen->width; + + if(((top - 1) >= y1) && ((top - 1) < y2)) + pLayout->up = AddEdge(pLayout->up, min, max, + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); + + if((bottom >= y1) && (bottom < y2)) + pLayout->down = AddEdge(pLayout->down, min, max, + pScreen->x - refScreen->x, + pScreen->y - refScreen->y, j); + } + } + } + } + + if(!HardEdges && !OldStyleConfig) { + for(i = 0; i < xf86NumScreens; i++) { + pLayout = &xf86ScreenLayout[i]; + pScreen = xf86Screens[i]->pScreen; + if(pLayout->left) + FillOutEdge(pLayout->left, pScreen->height); + if(pLayout->right) + FillOutEdge(pLayout->right, pScreen->height); + if(pLayout->up) + FillOutEdge(pLayout->up, pScreen->width); + if(pLayout->down) + FillOutEdge(pLayout->down, pScreen->width); + } + } +} + +void +xf86ReconfigureLayout(void) +{ + int i; + + for (i = 0; i < MAXSCREENS; i++) { + xf86ScreenLayoutPtr sl = &xf86ScreenLayout[i]; + /* we don't have to zero these, xf86InitOrigins() takes care of that */ + free(sl->left); + free(sl->right); + free(sl->up); + free(sl->down); + } + + xf86InitOrigins(); +} + + diff --git a/xorg-server/hw/xfree86/common/xf86Events.c b/xorg-server/hw/xfree86/common/xf86Events.c index 004807483..84c0d182a 100644 --- a/xorg-server/hw/xfree86/common/xf86Events.c +++ b/xorg-server/hw/xfree86/common/xf86Events.c @@ -1,758 +1,753 @@ -/*
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- *
- * 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 Thomas Roell not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Thomas Roell makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL THOMAS ROELL 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.
- *
- */
-/*
- * Copyright (c) 1994-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).
- */
-
-/* [JCH-96/01/21] Extended std reverse map to four buttons. */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xpoll.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "compiler.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#define XF86_OS_PRIVS
-#include "xf86_OSlib.h"
-#include <X11/keysym.h>
-
-#ifdef XFreeXDGA
-#include "dgaproc.h"
-#endif
-
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "inputstr.h"
-#include "xf86Xinput.h"
-
-#include "mi.h"
-#include "mipointer.h"
-
-#include "xkbsrv.h"
-#include "xkbstr.h"
-
-#ifdef DPMSExtension
-#include <X11/extensions/dpmsconst.h>
-#include "dpmsproc.h"
-#endif
-
-/*
- * This is a toggling variable:
- * FALSE = No VT switching keys have been pressed last time around
- * TRUE = Possible VT switch Pending
- * (DWH - 12/2/93)
- *
- * This has been generalised to work with Linux and *BSD+syscons (DHD)
- */
-
-Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for
- *BSD and for avoiding VT
- switches when using the DRI
- automatic full screen mode.*/
-
-extern fd_set EnabledDevices;
-
-#ifdef XF86PM
-extern void (*xf86OSPMClose)(void);
-#endif
-
-static void xf86VTSwitch(void);
-
-/*
- * Allow arbitrary drivers or other XFree86 code to register with our main
- * Wakeup handler.
- */
-typedef struct x_IHRec {
- int fd;
- InputHandlerProc ihproc;
- pointer data;
- Bool enabled;
- struct x_IHRec * next;
-} IHRec, *IHPtr;
-
-static IHPtr InputHandlers = NULL;
-
-
-Bool
-LegalModifier(unsigned int key, DeviceIntPtr pDev)
-{
- return TRUE;
-}
-
-/*
- * TimeSinceLastInputEvent --
- * Function used for screensaver purposes by the os module. Returns the
- * time in milliseconds since there last was any input.
- */
-int
-TimeSinceLastInputEvent(void)
-{
- if (xf86Info.lastEventTime == 0) {
- xf86Info.lastEventTime = GetTimeInMillis();
- }
- return GetTimeInMillis() - xf86Info.lastEventTime;
-}
-
-/*
- * SetTimeSinceLastInputEvent --
- * Set the lastEventTime to now.
- */
-void
-SetTimeSinceLastInputEvent(void)
-{
- xf86Info.lastEventTime = GetTimeInMillis();
-}
-
-/*
- * ProcessInputEvents --
- * Retrieve all waiting input events and pass them to DIX in their
- * correct chronological order. Only reads from the system pointer
- * and keyboard.
- */
-void
-ProcessInputEvents (void)
-{
- int x, y;
-
- mieqProcessInputEvents();
-
- /* FIXME: This is a problem if we have multiple pointers */
- miPointerGetPosition(inputInfo.pointer, &x, &y);
- xf86SetViewport(xf86Info.currentScreen, x, y);
-}
-
-/*
- * Handle keyboard events that cause some kind of "action"
- * (i.e., server termination, video mode changes, VT switches, etc.)
- */
-void
-xf86ProcessActionEvent(ActionEvent action, void *arg)
-{
- DebugF("ProcessActionEvent(%d,%x)\n", (int) action, arg);
- switch (action) {
- case ACTION_TERMINATE:
- if (!xf86Info.dontZap) {
-#ifdef XFreeXDGA
- DGAShutdown();
-#endif
- GiveUp(0);
- }
- break;
- case ACTION_NEXT_MODE:
- if (!xf86Info.dontZoom)
- xf86ZoomViewport(xf86Info.currentScreen, 1);
- break;
- case ACTION_PREV_MODE:
- if (!xf86Info.dontZoom)
- xf86ZoomViewport(xf86Info.currentScreen, -1);
- break;
- case ACTION_SWITCHSCREEN:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) {
- int vtno = *((int *) arg);
-
- if (vtno != xf86Info.vtno) {
- if (!xf86VTActivate(vtno)) {
- ErrorF("Failed to switch from vt%02d to vt%02d: %s\n",
- xf86Info.vtno, vtno, strerror(errno));
- }
- }
- }
- break;
- case ACTION_SWITCHSCREEN_NEXT:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch) {
- if (!xf86VTActivate(xf86Info.vtno + 1)) {
- /* If first try failed, assume this is the last VT and
- * try wrapping around to the first vt.
- */
- if (!xf86VTActivate(1)) {
- ErrorF("Failed to switch from vt%02d to next vt: %s\n",
- xf86Info.vtno, strerror(errno));
- }
- }
- }
- break;
- case ACTION_SWITCHSCREEN_PREV:
- if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) {
- if (!xf86VTActivate(xf86Info.vtno - 1)) {
- /* Don't know what the maximum VT is, so can't wrap around */
- ErrorF("Failed to switch from vt%02d to previous vt: %s\n",
- xf86Info.vtno, strerror(errno));
- }
- }
- break;
- default:
- break;
- }
-}
-
-/*
- * xf86Wakeup --
- * Os wakeup handler.
- */
-
-/* ARGSUSED */
-void
-xf86Wakeup(pointer blockData, int err, pointer pReadmask)
-{
- fd_set* LastSelectMask = (fd_set*)pReadmask;
- fd_set devicesWithInput;
- InputInfoPtr pInfo;
-
- if (err >= 0) {
-
- XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices);
- if (XFD_ANYSET(&devicesWithInput)) {
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->read_input && pInfo->fd >= 0 &&
- (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) {
- int sigstate = xf86BlockSIGIO();
-
- /*
- * Remove the descriptior from the set because more than one
- * device may share the same file descriptor.
- */
- FD_CLR(pInfo->fd, &devicesWithInput);
-
- pInfo->read_input(pInfo);
- xf86UnblockSIGIO(sigstate);
- }
- pInfo = pInfo->next;
- }
- }
- }
-
- if (err >= 0) { /* we don't want the handlers called if select() */
- IHPtr ih; /* returned with an error condition, do we? */
-
- for (ih = InputHandlers; ih; ih = ih->next) {
- if (ih->enabled && ih->fd >= 0 && ih->ihproc &&
- (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) {
- ih->ihproc(ih->fd, ih->data);
- }
- }
- }
-
- if (xf86VTSwitchPending()) xf86VTSwitch();
-}
-
-
-/*
- * xf86SigioReadInput --
- * signal handler for the SIGIO signal.
- */
-static void
-xf86SigioReadInput(int fd, void *closure)
-{
- int errno_save = errno;
- InputInfoPtr pInfo = closure;
-
- pInfo->read_input(pInfo);
-
- errno = errno_save;
-}
-
-/*
- * xf86AddEnabledDevice --
- *
- */
-void
-xf86AddEnabledDevice(InputInfoPtr pInfo)
-{
- if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) {
- AddEnabledDevice(pInfo->fd);
- }
-}
-
-/*
- * xf86RemoveEnabledDevice --
- *
- */
-void
-xf86RemoveEnabledDevice(InputInfoPtr pInfo)
-{
- if (!xf86RemoveSIGIOHandler (pInfo->fd)) {
- RemoveEnabledDevice(pInfo->fd);
- }
-}
-
-static int *xf86SignalIntercept = NULL;
-
-void
-xf86InterceptSignals(int *signo)
-{
- if ((xf86SignalIntercept = signo))
- *signo = -1;
-}
-
-static void (*xf86SigIllHandler)(void) = NULL;
-
-void
-xf86InterceptSigIll(void (*sigillhandler)(void))
-{
- xf86SigIllHandler = sigillhandler;
-}
-
-/*
- * xf86SigWrapper --
- * Catch unexpected signals and exit or continue cleanly.
- */
-int
-xf86SigWrapper(int signo)
-{
- if ((signo == SIGILL) && xf86SigIllHandler) {
- (*xf86SigIllHandler)();
- return 0; /* continue */
- }
-
- if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) {
- *xf86SignalIntercept = signo;
- return 0; /* continue */
- }
-
- xf86Info.caughtSignal = TRUE;
- return 1; /* abort */
-}
-
-/*
- * xf86PrintBacktrace --
- * Print a stack backtrace for debugging purposes.
- */
-void
-xf86PrintBacktrace(void)
-{
- xorg_backtrace();
-}
-
-static void
-xf86ReleaseKeys(DeviceIntPtr pDev)
-{
- KeyClassPtr keyc;
- int i, j, nevents, sigstate;
-
- if (!pDev || !pDev->key)
- return;
-
- keyc = pDev->key;
-
- /*
- * Hmm... here is the biggest hack of every time !
- * It may be possible that a switch-vt procedure has finished BEFORE
- * you released all keys neccessary to do this. That peculiar behavior
- * can fool the X-server pretty much, cause it assumes that some keys
- * were not released. TWM may stuck alsmost completly....
- * OK, what we are doing here is after returning from the vt-switch
- * exeplicitely unrelease all keyboard keys before the input-devices
- * are reenabled.
- */
-
- for (i = keyc->xkbInfo->desc->min_key_code;
- i < keyc->xkbInfo->desc->max_key_code;
- i++) {
- if (key_is_down(pDev, i, KEY_POSTED)) {
- sigstate = xf86BlockSIGIO ();
- nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i);
- for (j = 0; j < nevents; j++)
- mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event);
- xf86UnblockSIGIO(sigstate);
- }
- }
-}
-
-/*
- * xf86VTSwitch --
- * Handle requests for switching the vt.
- */
-static void
-xf86VTSwitch(void)
-{
- int i, prevSIGIO;
- InputInfoPtr pInfo;
- IHPtr ih;
-
- DebugF("xf86VTSwitch()\n");
-
-#ifdef XFreeXDGA
- if(!DGAVTSwitch())
- return;
-#endif
-
- /*
- * Since all screens are currently all in the same state it is sufficient
- * check the first. This might change in future.
- */
- if (xf86Screens[0]->vtSema) {
-
- DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n",
- BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE));
-#ifdef DPMSExtension
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(serverClient, DPMSModeOn);
-#endif
- for (i = 0; i < xf86NumScreens; i++) {
- if (!(dispatchException & DE_TERMINATE))
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE);
- }
-
- /*
- * Keep the order: Disable Device > LeaveVT
- * EnterVT > EnableDevice
- */
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86DisableInputHandler(ih);
- for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) {
- if (pInfo->dev) {
- xf86ReleaseKeys(pInfo->dev);
- ProcessInputEvents();
- DisableDevice(pInfo->dev, TRUE);
- }
- }
- xf86EnterServerState(SETUP);
- for (i = 0; i < xf86NumScreens; i++)
- xf86Screens[i]->LeaveVT(i, 0);
-
- xf86AccessLeave(); /* We need this here, otherwise */
-
- if (!xf86VTSwitchAway()) {
- /*
- * switch failed
- */
-
- DebugF("xf86VTSwitch: Leave failed\n");
- prevSIGIO = xf86BlockSIGIO();
- xf86AccessEnter();
- xf86EnterServerState(SETUP);
- for (i = 0; i < xf86NumScreens; i++) {
- if (!xf86Screens[i]->EnterVT(i, 0))
- FatalError("EnterVT failed for screen %d\n", i);
- }
- xf86EnterServerState(OPERATING);
- if (!(dispatchException & DE_TERMINATE)) {
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE);
- }
- }
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
-
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev)
- EnableDevice(pInfo->dev, TRUE);
- pInfo = pInfo->next;
- }
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86EnableInputHandler(ih);
-
- xf86UnblockSIGIO(prevSIGIO);
-
- } else {
-#ifdef XF86PM
- if (xf86OSPMClose)
- xf86OSPMClose();
- xf86OSPMClose = NULL;
-#endif
-
- for (i = 0; i < xf86NumScreens; i++) {
- /*
- * zero all access functions to
- * trap calls when switched away.
- */
- xf86Screens[i]->vtSema = FALSE;
- }
- if (xorgHWAccess)
- xf86DisableIO();
- }
- } else {
-
- DebugF("xf86VTSwitch: Entering\n");
- if (!xf86VTSwitchTo()) return;
-
- prevSIGIO = xf86BlockSIGIO();
-#ifdef XF86PM
- xf86OSPMClose = xf86OSPMOpen();
-#endif
-
- if (xorgHWAccess)
- xf86EnableIO();
- xf86AccessEnter();
- xf86EnterServerState(SETUP);
- for (i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->vtSema = TRUE;
- if (!xf86Screens[i]->EnterVT(i, 0))
- FatalError("EnterVT failed for screen %d\n", i);
- }
- xf86EnterServerState(OPERATING);
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->EnableDisableFBAccess)
- (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE);
- }
-
- /* Turn screen saver off when switching back */
- dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset);
-
- pInfo = xf86InputDevs;
- while (pInfo) {
- if (pInfo->dev)
- EnableDevice(pInfo->dev, TRUE);
- pInfo = pInfo->next;
- }
-
- for (ih = InputHandlers; ih; ih = ih->next)
- xf86EnableInputHandler(ih);
-
- xf86UnblockSIGIO(prevSIGIO);
- }
-}
-
-
-/* Input handler registration */
-
-static pointer
-addInputHandler(int fd, InputHandlerProc proc, pointer data)
-{
- IHPtr ih;
-
- if (fd < 0 || !proc)
- return NULL;
-
- ih = calloc(sizeof(*ih), 1);
- if (!ih)
- return NULL;
-
- ih->fd = fd;
- ih->ihproc = proc;
- ih->data = data;
- ih->enabled = TRUE;
-
- ih->next = InputHandlers;
- InputHandlers = ih;
-
- return ih;
-}
-
-pointer
-xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data)
-{
- IHPtr ih = addInputHandler(fd, proc, data);
-
- if (ih)
- AddEnabledDevice(fd);
- return ih;
-}
-
-pointer
-xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data)
-{
- IHPtr ih = addInputHandler(fd, proc, data);
-
- if (ih)
- AddGeneralSocket(fd);
- return ih;
-}
-
-/**
- * Set the handler for the console's fd. Replaces (and returns) the previous
- * handler or NULL, whichever appropriate.
- * proc may be NULL if the server should not handle events on the console.
- */
-InputHandlerProc
-xf86SetConsoleHandler(InputHandlerProc proc, pointer data)
-{
- static InputHandlerProc handler = NULL;
- InputHandlerProc old_handler = handler;
-
- if (old_handler)
- xf86RemoveGeneralHandler(old_handler);
-
- xf86AddGeneralHandler(xf86Info.consoleFd, proc, data);
- handler = proc;
-
- return old_handler;
-}
-
-static void
-removeInputHandler(IHPtr ih)
-{
- IHPtr p;
-
- if (ih == InputHandlers)
- InputHandlers = ih->next;
- else {
- p = InputHandlers;
- while (p && p->next != ih)
- p = p->next;
- if (ih)
- p->next = ih->next;
- }
- free(ih);
-}
-
-int
-xf86RemoveInputHandler(pointer handler)
-{
- IHPtr ih;
- int fd;
-
- if (!handler)
- return -1;
-
- ih = handler;
- fd = ih->fd;
-
- if (ih->fd >= 0)
- RemoveEnabledDevice(ih->fd);
- removeInputHandler(ih);
-
- return fd;
-}
-
-int
-xf86RemoveGeneralHandler(pointer handler)
-{
- IHPtr ih;
- int fd;
-
- if (!handler)
- return -1;
-
- ih = handler;
- fd = ih->fd;
-
- if (ih->fd >= 0)
- RemoveGeneralSocket(ih->fd);
- removeInputHandler(ih);
-
- return fd;
-}
-
-void
-xf86DisableInputHandler(pointer handler)
-{
- IHPtr ih;
-
- if (!handler)
- return;
-
- ih = handler;
- ih->enabled = FALSE;
- if (ih->fd >= 0)
- RemoveEnabledDevice(ih->fd);
-}
-
-void
-xf86DisableGeneralHandler(pointer handler)
-{
- IHPtr ih;
-
- if (!handler)
- return;
-
- ih = handler;
- ih->enabled = FALSE;
- if (ih->fd >= 0)
- RemoveGeneralSocket(ih->fd);
-}
-
-void
-xf86EnableInputHandler(pointer handler)
-{
- IHPtr ih;
-
- if (!handler)
- return;
-
- ih = handler;
- ih->enabled = TRUE;
- if (ih->fd >= 0)
- AddEnabledDevice(ih->fd);
-}
-
-void
-xf86EnableGeneralHandler(pointer handler)
-{
- IHPtr ih;
-
- if (!handler)
- return;
-
- ih = handler;
- ih->enabled = TRUE;
- if (ih->fd >= 0)
- AddGeneralSocket(ih->fd);
-}
-
-/*
- * As used currently by the DRI, the return value is ignored.
- */
-Bool
-xf86EnableVTSwitch(Bool new)
-{
- static Bool def = TRUE;
- Bool old;
-
- old = VTSwitchEnabled;
- if (!new) {
- /* Disable VT switching */
- def = VTSwitchEnabled;
- VTSwitchEnabled = FALSE;
- } else {
- /* Restore VT switching to default */
- VTSwitchEnabled = def;
- }
- return old;
-}
-
-void
-DDXRingBell(int volume, int pitch, int duration) {
- xf86OSRingBell(volume, pitch, duration);
-}
+/* + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + * + * 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 Thomas Roell not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Thomas Roell makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THOMAS ROELL 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. + * + */ +/* + * Copyright (c) 1994-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). + */ + +/* [JCH-96/01/21] Extended std reverse map to four buttons. */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include <X11/Xpoll.h> +#include <X11/Xproto.h> +#include "misc.h" +#include "compiler.h" +#include "xf86.h" +#include "xf86Priv.h" +#define XF86_OS_PRIVS +#include "xf86_OSlib.h" +#include <X11/keysym.h> + +#ifdef XFreeXDGA +#include "dgaproc.h" +#endif + +#include <X11/extensions/XI.h> +#include <X11/extensions/XIproto.h> +#include "inputstr.h" +#include "xf86Xinput.h" + +#include "mi.h" +#include "mipointer.h" + +#include "xkbsrv.h" +#include "xkbstr.h" + +#ifdef DPMSExtension +#include <X11/extensions/dpmsconst.h> +#include "dpmsproc.h" +#endif + +/* + * This is a toggling variable: + * FALSE = No VT switching keys have been pressed last time around + * TRUE = Possible VT switch Pending + * (DWH - 12/2/93) + * + * This has been generalised to work with Linux and *BSD+syscons (DHD) + */ + +Bool VTSwitchEnabled = TRUE; /* Allows run-time disabling for + *BSD and for avoiding VT + switches when using the DRI + automatic full screen mode.*/ + +extern fd_set EnabledDevices; + +#ifdef XF86PM +extern void (*xf86OSPMClose)(void); +#endif + +static void xf86VTSwitch(void); + +/* + * Allow arbitrary drivers or other XFree86 code to register with our main + * Wakeup handler. + */ +typedef struct x_IHRec { + int fd; + InputHandlerProc ihproc; + pointer data; + Bool enabled; + struct x_IHRec * next; +} IHRec, *IHPtr; + +static IHPtr InputHandlers = NULL; + + +Bool +LegalModifier(unsigned int key, DeviceIntPtr pDev) +{ + return TRUE; +} + +/* + * TimeSinceLastInputEvent -- + * Function used for screensaver purposes by the os module. Returns the + * time in milliseconds since there last was any input. + */ +int +TimeSinceLastInputEvent(void) +{ + if (xf86Info.lastEventTime == 0) { + xf86Info.lastEventTime = GetTimeInMillis(); + } + return GetTimeInMillis() - xf86Info.lastEventTime; +} + +/* + * SetTimeSinceLastInputEvent -- + * Set the lastEventTime to now. + */ +void +SetTimeSinceLastInputEvent(void) +{ + xf86Info.lastEventTime = GetTimeInMillis(); +} + +/* + * ProcessInputEvents -- + * Retrieve all waiting input events and pass them to DIX in their + * correct chronological order. Only reads from the system pointer + * and keyboard. + */ +void +ProcessInputEvents (void) +{ + int x, y; + + mieqProcessInputEvents(); + + /* FIXME: This is a problem if we have multiple pointers */ + miPointerGetPosition(inputInfo.pointer, &x, &y); + xf86SetViewport(xf86Info.currentScreen, x, y); +} + +/* + * Handle keyboard events that cause some kind of "action" + * (i.e., server termination, video mode changes, VT switches, etc.) + */ +void +xf86ProcessActionEvent(ActionEvent action, void *arg) +{ + DebugF("ProcessActionEvent(%d,%x)\n", (int) action, arg); + switch (action) { + case ACTION_TERMINATE: + if (!xf86Info.dontZap) { +#ifdef XFreeXDGA + DGAShutdown(); +#endif + GiveUp(0); + } + break; + case ACTION_NEXT_MODE: + if (!xf86Info.dontZoom) + xf86ZoomViewport(xf86Info.currentScreen, 1); + break; + case ACTION_PREV_MODE: + if (!xf86Info.dontZoom) + xf86ZoomViewport(xf86Info.currentScreen, -1); + break; + case ACTION_SWITCHSCREEN: + if (VTSwitchEnabled && !xf86Info.dontVTSwitch && arg) { + int vtno = *((int *) arg); + + if (vtno != xf86Info.vtno) { + if (!xf86VTActivate(vtno)) { + ErrorF("Failed to switch from vt%02d to vt%02d: %s\n", + xf86Info.vtno, vtno, strerror(errno)); + } + } + } + break; + case ACTION_SWITCHSCREEN_NEXT: + if (VTSwitchEnabled && !xf86Info.dontVTSwitch) { + if (!xf86VTActivate(xf86Info.vtno + 1)) { + /* If first try failed, assume this is the last VT and + * try wrapping around to the first vt. + */ + if (!xf86VTActivate(1)) { + ErrorF("Failed to switch from vt%02d to next vt: %s\n", + xf86Info.vtno, strerror(errno)); + } + } + } + break; + case ACTION_SWITCHSCREEN_PREV: + if (VTSwitchEnabled && !xf86Info.dontVTSwitch && xf86Info.vtno > 0) { + if (!xf86VTActivate(xf86Info.vtno - 1)) { + /* Don't know what the maximum VT is, so can't wrap around */ + ErrorF("Failed to switch from vt%02d to previous vt: %s\n", + xf86Info.vtno, strerror(errno)); + } + } + break; + default: + break; + } +} + +/* + * xf86Wakeup -- + * Os wakeup handler. + */ + +/* ARGSUSED */ +void +xf86Wakeup(pointer blockData, int err, pointer pReadmask) +{ + fd_set* LastSelectMask = (fd_set*)pReadmask; + fd_set devicesWithInput; + InputInfoPtr pInfo; + + if (err >= 0) { + + XFD_ANDSET(&devicesWithInput, LastSelectMask, &EnabledDevices); + if (XFD_ANYSET(&devicesWithInput)) { + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->read_input && pInfo->fd >= 0 && + (FD_ISSET(pInfo->fd, &devicesWithInput) != 0)) { + int sigstate = xf86BlockSIGIO(); + + /* + * Remove the descriptior from the set because more than one + * device may share the same file descriptor. + */ + FD_CLR(pInfo->fd, &devicesWithInput); + + pInfo->read_input(pInfo); + xf86UnblockSIGIO(sigstate); + } + pInfo = pInfo->next; + } + } + } + + if (err >= 0) { /* we don't want the handlers called if select() */ + IHPtr ih; /* returned with an error condition, do we? */ + + for (ih = InputHandlers; ih; ih = ih->next) { + if (ih->enabled && ih->fd >= 0 && ih->ihproc && + (FD_ISSET(ih->fd, ((fd_set *)pReadmask)) != 0)) { + ih->ihproc(ih->fd, ih->data); + } + } + } + + if (xf86VTSwitchPending()) xf86VTSwitch(); +} + + +/* + * xf86SigioReadInput -- + * signal handler for the SIGIO signal. + */ +static void +xf86SigioReadInput(int fd, void *closure) +{ + int errno_save = errno; + InputInfoPtr pInfo = closure; + + pInfo->read_input(pInfo); + + errno = errno_save; +} + +/* + * xf86AddEnabledDevice -- + * + */ +void +xf86AddEnabledDevice(InputInfoPtr pInfo) +{ + if (!xf86InstallSIGIOHandler (pInfo->fd, xf86SigioReadInput, pInfo)) { + AddEnabledDevice(pInfo->fd); + } +} + +/* + * xf86RemoveEnabledDevice -- + * + */ +void +xf86RemoveEnabledDevice(InputInfoPtr pInfo) +{ + if (!xf86RemoveSIGIOHandler (pInfo->fd)) { + RemoveEnabledDevice(pInfo->fd); + } +} + +static int *xf86SignalIntercept = NULL; + +void +xf86InterceptSignals(int *signo) +{ + if ((xf86SignalIntercept = signo)) + *signo = -1; +} + +static void (*xf86SigIllHandler)(void) = NULL; + +void +xf86InterceptSigIll(void (*sigillhandler)(void)) +{ + xf86SigIllHandler = sigillhandler; +} + +/* + * xf86SigWrapper -- + * Catch unexpected signals and exit or continue cleanly. + */ +int +xf86SigWrapper(int signo) +{ + if ((signo == SIGILL) && xf86SigIllHandler) { + (*xf86SigIllHandler)(); + return 0; /* continue */ + } + + if (xf86SignalIntercept && (*xf86SignalIntercept < 0)) { + *xf86SignalIntercept = signo; + return 0; /* continue */ + } + + xf86Info.caughtSignal = TRUE; + return 1; /* abort */ +} + +/* + * xf86PrintBacktrace -- + * Print a stack backtrace for debugging purposes. + */ +void +xf86PrintBacktrace(void) +{ + xorg_backtrace(); +} + +static void +xf86ReleaseKeys(DeviceIntPtr pDev) +{ + KeyClassPtr keyc; + int i, j, nevents, sigstate; + + if (!pDev || !pDev->key) + return; + + keyc = pDev->key; + + /* + * Hmm... here is the biggest hack of every time ! + * It may be possible that a switch-vt procedure has finished BEFORE + * you released all keys neccessary to do this. That peculiar behavior + * can fool the X-server pretty much, cause it assumes that some keys + * were not released. TWM may stuck alsmost completly.... + * OK, what we are doing here is after returning from the vt-switch + * exeplicitely unrelease all keyboard keys before the input-devices + * are reenabled. + */ + + for (i = keyc->xkbInfo->desc->min_key_code; + i < keyc->xkbInfo->desc->max_key_code; + i++) { + if (key_is_down(pDev, i, KEY_POSTED)) { + sigstate = xf86BlockSIGIO (); + nevents = GetKeyboardEvents(xf86Events, pDev, KeyRelease, i); + for (j = 0; j < nevents; j++) + mieqEnqueue(pDev, (InternalEvent*)(xf86Events + j)->event); + xf86UnblockSIGIO(sigstate); + } + } +} + +/* + * xf86VTSwitch -- + * Handle requests for switching the vt. + */ +static void +xf86VTSwitch(void) +{ + int i; + static int prevSIGIO; + InputInfoPtr pInfo; + IHPtr ih; + + DebugF("xf86VTSwitch()\n"); + +#ifdef XFreeXDGA + if(!DGAVTSwitch()) + return; +#endif + + /* + * Since all screens are currently all in the same state it is sufficient + * check the first. This might change in future. + */ + if (xf86Screens[0]->vtSema) { + + DebugF("xf86VTSwitch: Leaving, xf86Exiting is %s\n", + BOOLTOSTRING((dispatchException & DE_TERMINATE) ? TRUE : FALSE)); +#ifdef DPMSExtension + if (DPMSPowerLevel != DPMSModeOn) + DPMSSet(serverClient, DPMSModeOn); +#endif + for (i = 0; i < xf86NumScreens; i++) { + if (!(dispatchException & DE_TERMINATE)) + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); + } + + /* + * Keep the order: Disable Device > LeaveVT + * EnterVT > EnableDevice + */ + for (ih = InputHandlers; ih; ih = ih->next) + xf86DisableInputHandler(ih); + for (pInfo = xf86InputDevs; pInfo; pInfo = pInfo->next) { + if (pInfo->dev) { + xf86ReleaseKeys(pInfo->dev); + ProcessInputEvents(); + DisableDevice(pInfo->dev, TRUE); + } + } + + prevSIGIO = xf86BlockSIGIO(); + for (i = 0; i < xf86NumScreens; i++) + xf86Screens[i]->LeaveVT(i, 0); + + xf86AccessLeave(); /* We need this here, otherwise */ + + if (!xf86VTSwitchAway()) { + /* + * switch failed + */ + + DebugF("xf86VTSwitch: Leave failed\n"); + xf86AccessEnter(); + for (i = 0; i < xf86NumScreens; i++) { + if (!xf86Screens[i]->EnterVT(i, 0)) + FatalError("EnterVT failed for screen %d\n", i); + } + if (!(dispatchException & DE_TERMINATE)) { + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); + } + } + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->dev) + EnableDevice(pInfo->dev, TRUE); + pInfo = pInfo->next; + } + for (ih = InputHandlers; ih; ih = ih->next) + xf86EnableInputHandler(ih); + + xf86UnblockSIGIO(prevSIGIO); + + } else { +#ifdef XF86PM + if (xf86OSPMClose) + xf86OSPMClose(); + xf86OSPMClose = NULL; +#endif + + for (i = 0; i < xf86NumScreens; i++) { + /* + * zero all access functions to + * trap calls when switched away. + */ + xf86Screens[i]->vtSema = FALSE; + } + if (xorgHWAccess) + xf86DisableIO(); + } + } else { + DebugF("xf86VTSwitch: Entering\n"); + if (!xf86VTSwitchTo()) return; + +#ifdef XF86PM + xf86OSPMClose = xf86OSPMOpen(); +#endif + + if (xorgHWAccess) + xf86EnableIO(); + xf86AccessEnter(); + for (i = 0; i < xf86NumScreens; i++) { + xf86Screens[i]->vtSema = TRUE; + if (!xf86Screens[i]->EnterVT(i, 0)) + FatalError("EnterVT failed for screen %d\n", i); + } + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->EnableDisableFBAccess) + (*xf86Screens[i]->EnableDisableFBAccess)(i, TRUE); + } + + /* Turn screen saver off when switching back */ + dixSaveScreens(serverClient, SCREEN_SAVER_FORCER, ScreenSaverReset); + + pInfo = xf86InputDevs; + while (pInfo) { + if (pInfo->dev) + EnableDevice(pInfo->dev, TRUE); + pInfo = pInfo->next; + } + + for (ih = InputHandlers; ih; ih = ih->next) + xf86EnableInputHandler(ih); + + xf86UnblockSIGIO(prevSIGIO); + } +} + + +/* Input handler registration */ + +static pointer +addInputHandler(int fd, InputHandlerProc proc, pointer data) +{ + IHPtr ih; + + if (fd < 0 || !proc) + return NULL; + + ih = calloc(sizeof(*ih), 1); + if (!ih) + return NULL; + + ih->fd = fd; + ih->ihproc = proc; + ih->data = data; + ih->enabled = TRUE; + + ih->next = InputHandlers; + InputHandlers = ih; + + return ih; +} + +pointer +xf86AddInputHandler(int fd, InputHandlerProc proc, pointer data) +{ + IHPtr ih = addInputHandler(fd, proc, data); + + if (ih) + AddEnabledDevice(fd); + return ih; +} + +pointer +xf86AddGeneralHandler(int fd, InputHandlerProc proc, pointer data) +{ + IHPtr ih = addInputHandler(fd, proc, data); + + if (ih) + AddGeneralSocket(fd); + return ih; +} + +/** + * Set the handler for the console's fd. Replaces (and returns) the previous + * handler or NULL, whichever appropriate. + * proc may be NULL if the server should not handle events on the console. + */ +InputHandlerProc +xf86SetConsoleHandler(InputHandlerProc proc, pointer data) +{ + static InputHandlerProc handler = NULL; + InputHandlerProc old_handler = handler; + + if (old_handler) + xf86RemoveGeneralHandler(old_handler); + + xf86AddGeneralHandler(xf86Info.consoleFd, proc, data); + handler = proc; + + return old_handler; +} + +static void +removeInputHandler(IHPtr ih) +{ + IHPtr p; + + if (ih == InputHandlers) + InputHandlers = ih->next; + else { + p = InputHandlers; + while (p && p->next != ih) + p = p->next; + if (ih) + p->next = ih->next; + } + free(ih); +} + +int +xf86RemoveInputHandler(pointer handler) +{ + IHPtr ih; + int fd; + + if (!handler) + return -1; + + ih = handler; + fd = ih->fd; + + if (ih->fd >= 0) + RemoveEnabledDevice(ih->fd); + removeInputHandler(ih); + + return fd; +} + +int +xf86RemoveGeneralHandler(pointer handler) +{ + IHPtr ih; + int fd; + + if (!handler) + return -1; + + ih = handler; + fd = ih->fd; + + if (ih->fd >= 0) + RemoveGeneralSocket(ih->fd); + removeInputHandler(ih); + + return fd; +} + +void +xf86DisableInputHandler(pointer handler) +{ + IHPtr ih; + + if (!handler) + return; + + ih = handler; + ih->enabled = FALSE; + if (ih->fd >= 0) + RemoveEnabledDevice(ih->fd); +} + +void +xf86DisableGeneralHandler(pointer handler) +{ + IHPtr ih; + + if (!handler) + return; + + ih = handler; + ih->enabled = FALSE; + if (ih->fd >= 0) + RemoveGeneralSocket(ih->fd); +} + +void +xf86EnableInputHandler(pointer handler) +{ + IHPtr ih; + + if (!handler) + return; + + ih = handler; + ih->enabled = TRUE; + if (ih->fd >= 0) + AddEnabledDevice(ih->fd); +} + +void +xf86EnableGeneralHandler(pointer handler) +{ + IHPtr ih; + + if (!handler) + return; + + ih = handler; + ih->enabled = TRUE; + if (ih->fd >= 0) + AddGeneralSocket(ih->fd); +} + +/* + * As used currently by the DRI, the return value is ignored. + */ +Bool +xf86EnableVTSwitch(Bool new) +{ + static Bool def = TRUE; + Bool old; + + old = VTSwitchEnabled; + if (!new) { + /* Disable VT switching */ + def = VTSwitchEnabled; + VTSwitchEnabled = FALSE; + } else { + /* Restore VT switching to default */ + VTSwitchEnabled = def; + } + return old; +} + +void +DDXRingBell(int volume, int pitch, int duration) { + xf86OSRingBell(volume, pitch, duration); +} diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c index 02f20f690..16d55577e 100644 --- a/xorg-server/hw/xfree86/common/xf86Globals.c +++ b/xorg-server/hw/xfree86/common/xf86Globals.c @@ -1,198 +1,197 @@ -
-/*
- * 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 all the XFree86 global variables.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include "os.h"
-#include "windowstr.h"
-#include "propertyst.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86Parser.h"
-#include "xf86Xinput.h"
-#include "xf86InPriv.h"
-#include "xf86Config.h"
-
-/* Globals that video drivers may access */
-
-DevPrivateKeyRec xf86CreateRootWindowKeyRec;
-DevPrivateKeyRec xf86ScreenKeyRec;
-
-ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */
-const unsigned char byte_reversed[256] =
-{
- 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0,
- 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0,
- 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8,
- 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8,
- 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4,
- 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4,
- 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec,
- 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc,
- 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2,
- 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2,
- 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea,
- 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa,
- 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6,
- 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6,
- 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee,
- 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe,
- 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1,
- 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1,
- 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9,
- 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9,
- 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5,
- 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5,
- 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed,
- 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd,
- 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3,
- 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3,
- 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb,
- 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb,
- 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7,
- 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7,
- 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef,
- 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff,
-};
-
-/* Globals that input drivers may access */
-InputInfoPtr xf86InputDevs = NULL;
-
-
-/* Globals that video drivers may not access */
-
-xf86InfoRec xf86Info = {
- .consoleFd = -1,
- .vtno = -1,
- .vtSysreq = FALSE,
- .lastEventTime = -1,
- .vtRequestsPending = FALSE,
-#ifdef sun
- .vtPendingNum = -1,
-#endif
- .dontVTSwitch = FALSE,
- .dontZap = FALSE,
- .dontZoom = FALSE,
- .notrapSignals = FALSE,
- .caughtSignal = FALSE,
- .currentScreen = NULL,
-#ifdef CSRG_BASED
- .screenFd = -1,
- .consType = -1,
-#endif
- .allowMouseOpenFail = FALSE,
- .vidModeEnabled = TRUE,
- .vidModeAllowNonLocal = FALSE,
- .miscModInDevEnabled = TRUE,
- .miscModInDevAllowNonLocal = FALSE,
- .pixmap24 = Pix24DontCare,
- .pix24From = X_DEFAULT,
-#ifdef SUPPORT_PC98
- .pc98 = FALSE,
-#endif
- .pmFlag = TRUE,
- .log = LogNone,
- .disableRandR = FALSE,
- .randRFrom = X_DEFAULT,
-#if defined(CONFIG_HAL) || defined(CONFIG_UDEV)
- .forceInputDevices = FALSE,
- .autoAddDevices = TRUE,
- .autoEnableDevices = TRUE
-#else
- .forceInputDevices = TRUE,
- .autoAddDevices = FALSE,
- .autoEnableDevices = FALSE
-#endif
-};
-const char *xf86ConfigFile = NULL;
-const char *xf86ConfigDir = NULL;
-const char *xf86ModulePath = DEFAULT_MODULE_PATH;
-MessageType xf86ModPathFrom = X_DEFAULT;
-const char *xf86LogFile = DEFAULT_LOGPREFIX;
-MessageType xf86LogFileFrom = X_DEFAULT;
-Bool xf86LogFileWasOpened = FALSE;
-serverLayoutRec xf86ConfigLayout = {NULL, };
-confDRIRec xf86ConfigDRI = {0, };
-XF86ConfigPtr xf86configptr = NULL;
-Bool xf86Resetting = FALSE;
-Bool xf86Initialising = FALSE;
-Bool xf86DoConfigure = FALSE;
-Bool xf86DoShowOptions = FALSE;
-DriverPtr *xf86DriverList = NULL;
-int xf86NumDrivers = 0;
-InputDriverPtr *xf86InputDriverList = NULL;
-int xf86NumInputDrivers = 0;
-int xf86NumScreens = 0;
-
-const char *xf86VisualNames[] = {
- "StaticGray",
- "GrayScale",
- "StaticColor",
- "PseudoColor",
- "TrueColor",
- "DirectColor"
-};
-
-/* Parameters set only from the command line */
-char *xf86ServerName = "no-name";
-Bool xf86fpFlag = FALSE;
-Bool xf86sFlag = FALSE;
-Bool xf86bsEnableFlag = FALSE;
-Bool xf86bsDisableFlag = FALSE;
-Bool xf86silkenMouseDisableFlag = FALSE;
-Bool xf86xkbdirFlag = FALSE;
-#ifdef HAVE_ACPI
-Bool xf86acpiDisableFlag = FALSE;
-#endif
-char *xf86LayoutName = NULL;
-char *xf86ScreenName = NULL;
-char *xf86PointerName = NULL;
-char *xf86KeyboardName = NULL;
-int xf86Verbose = DEFAULT_VERBOSE;
-int xf86LogVerbose = DEFAULT_LOG_VERBOSE;
-int xf86FbBpp = -1;
-Pix24Flags xf86Pix24 = Pix24DontCare;
-int xf86Depth = -1;
-rgb xf86Weight = {0, 0, 0};
-Bool xf86FlipPixels = FALSE;
-Gamma xf86Gamma = {0.0, 0.0, 0.0};
-Bool xf86AllowMouseOpenFail = FALSE;
-#ifdef XF86VIDMODE
-Bool xf86VidModeDisabled = FALSE;
-Bool xf86VidModeAllowNonLocal = FALSE;
-#endif
-RootWinPropPtr *xf86RegisteredPropertiesTable = NULL;
-Bool xf86inSuspend = FALSE;
-Bool xorgHWAccess = FALSE;
+ +/* + * 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 all the XFree86 global variables. + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include <X11/X.h> +#include "os.h" +#include "windowstr.h" +#include "propertyst.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86Parser.h" +#include "xf86Xinput.h" +#include "xf86InPriv.h" +#include "xf86Config.h" + +/* Globals that video drivers may access */ + +DevPrivateKeyRec xf86CreateRootWindowKeyRec; +DevPrivateKeyRec xf86ScreenKeyRec; + +ScrnInfoPtr *xf86Screens = NULL; /* List of ScrnInfos */ +const unsigned char byte_reversed[256] = +{ + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff, +}; + +/* Globals that input drivers may access */ +InputInfoPtr xf86InputDevs = NULL; + + +/* Globals that video drivers may not access */ + +xf86InfoRec xf86Info = { + .consoleFd = -1, + .vtno = -1, + .vtSysreq = FALSE, + .lastEventTime = -1, + .vtRequestsPending = FALSE, +#ifdef sun + .vtPendingNum = -1, +#endif + .dontVTSwitch = FALSE, + .dontZap = FALSE, + .dontZoom = FALSE, + .notrapSignals = FALSE, + .caughtSignal = FALSE, + .currentScreen = NULL, +#ifdef CSRG_BASED + .screenFd = -1, + .consType = -1, +#endif + .allowMouseOpenFail = FALSE, + .vidModeEnabled = TRUE, + .vidModeAllowNonLocal = FALSE, + .miscModInDevEnabled = TRUE, + .miscModInDevAllowNonLocal = FALSE, + .pixmap24 = Pix24DontCare, + .pix24From = X_DEFAULT, +#ifdef SUPPORT_PC98 + .pc98 = FALSE, +#endif + .pmFlag = TRUE, + .log = LogNone, + .disableRandR = FALSE, + .randRFrom = X_DEFAULT, +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) + .forceInputDevices = FALSE, + .autoAddDevices = TRUE, + .autoEnableDevices = TRUE +#else + .forceInputDevices = TRUE, + .autoAddDevices = FALSE, + .autoEnableDevices = FALSE +#endif +}; +const char *xf86ConfigFile = NULL; +const char *xf86ConfigDir = NULL; +const char *xf86ModulePath = DEFAULT_MODULE_PATH; +MessageType xf86ModPathFrom = X_DEFAULT; +const char *xf86LogFile = DEFAULT_LOGPREFIX; +MessageType xf86LogFileFrom = X_DEFAULT; +Bool xf86LogFileWasOpened = FALSE; +serverLayoutRec xf86ConfigLayout = {NULL, }; +confDRIRec xf86ConfigDRI = {0, }; +XF86ConfigPtr xf86configptr = NULL; +Bool xf86Resetting = FALSE; +Bool xf86Initialising = FALSE; +Bool xf86DoConfigure = FALSE; +Bool xf86DoShowOptions = FALSE; +DriverPtr *xf86DriverList = NULL; +int xf86NumDrivers = 0; +InputDriverPtr *xf86InputDriverList = NULL; +int xf86NumInputDrivers = 0; +int xf86NumScreens = 0; + +const char *xf86VisualNames[] = { + "StaticGray", + "GrayScale", + "StaticColor", + "PseudoColor", + "TrueColor", + "DirectColor" +}; + +/* Parameters set only from the command line */ +char *xf86ServerName = "no-name"; +Bool xf86fpFlag = FALSE; +Bool xf86sFlag = FALSE; +Bool xf86bsEnableFlag = FALSE; +Bool xf86bsDisableFlag = FALSE; +Bool xf86silkenMouseDisableFlag = FALSE; +Bool xf86xkbdirFlag = FALSE; +#ifdef HAVE_ACPI +Bool xf86acpiDisableFlag = FALSE; +#endif +char *xf86LayoutName = NULL; +char *xf86ScreenName = NULL; +char *xf86PointerName = NULL; +char *xf86KeyboardName = NULL; +int xf86Verbose = DEFAULT_VERBOSE; +int xf86LogVerbose = DEFAULT_LOG_VERBOSE; +int xf86FbBpp = -1; +Pix24Flags xf86Pix24 = Pix24DontCare; +int xf86Depth = -1; +rgb xf86Weight = {0, 0, 0}; +Bool xf86FlipPixels = FALSE; +Gamma xf86Gamma = {0.0, 0.0, 0.0}; +Bool xf86AllowMouseOpenFail = FALSE; +#ifdef XF86VIDMODE +Bool xf86VidModeDisabled = FALSE; +Bool xf86VidModeAllowNonLocal = FALSE; +#endif +RootWinPropPtr *xf86RegisteredPropertiesTable = NULL; +Bool xorgHWAccess = FALSE; diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index f3ce3f696..a1fda54cd 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -1,1510 +1,1497 @@ -/*
- * Loosely based on code bearing the following copyright:
- *
- * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany.
- */
-/*
- * Copyright (c) 1992-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 <xorg-config.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-
-#undef HAS_UTSNAME
-#if !defined(WIN32)
-#define HAS_UTSNAME 1
-#include <sys/utsname.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-#include <X11/Xproto.h>
-#include <X11/Xatom.h>
-#include "input.h"
-#include "servermd.h"
-#include "windowstr.h"
-#include "scrnintstr.h"
-#include "site.h"
-#include "mi.h"
-
-#include "compiler.h"
-
-#include "loaderProcs.h"
-#ifdef XFreeXDGA
-#include "dgaproc.h"
-#endif
-
-#define XF86_OS_PRIVS
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86Config.h"
-#include "xf86_OSlib.h"
-#include "xf86cmap.h"
-#include "xorgVersion.h"
-#include "xf86Build.h"
-#include "mipointer.h"
-#include <X11/extensions/XI.h>
-#include <X11/extensions/XIproto.h>
-#include "xf86DDC.h"
-#include "xf86Xinput.h"
-#include "xf86InPriv.h"
-#include "picturestr.h"
-
-#include "xf86Bus.h"
-#include "xf86VGAarbiter.h"
-#include "globals.h"
-
-#ifdef DPMSExtension
-#include <X11/extensions/dpmsconst.h>
-#include "dpmsproc.h"
-#endif
-#include <hotplug.h>
-
-
-#ifdef XF86PM
-void (*xf86OSPMClose)(void) = NULL;
-#endif
-static Bool xorgHWOpenConsole = FALSE;
-
-/* Common pixmap formats */
-
-static PixmapFormatRec formats[MAXFORMATS] = {
- { 1, 1, BITMAP_SCANLINE_PAD },
- { 4, 8, BITMAP_SCANLINE_PAD },
- { 8, 8, BITMAP_SCANLINE_PAD },
- { 15, 16, BITMAP_SCANLINE_PAD },
- { 16, 16, BITMAP_SCANLINE_PAD },
- { 24, 32, BITMAP_SCANLINE_PAD },
- { 32, 32, BITMAP_SCANLINE_PAD },
-};
-static int numFormats = 7;
-static Bool formatsDone = FALSE;
-
-#ifndef OSNAME
-#define OSNAME " unknown"
-#endif
-#ifndef OSVENDOR
-#define OSVENDOR ""
-#endif
-#ifndef PRE_RELEASE
-#define PRE_RELEASE XORG_VERSION_SNAP
-#endif
-
-static void
-xf86PrintBanner(void)
-{
-#if PRE_RELEASE
- xf86ErrorFVerb(0, "\n"
- "This is a pre-release version of the X server from " XVENDORNAME ".\n"
- "It is not supported in any way.\n"
- "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n"
- "Select the \"xorg\" product for bugs you find in this release.\n"
- "Before reporting bugs in pre-release versions please check the\n"
- "latest version in the X.Org Foundation git repository.\n"
- "See http://wiki.x.org/wiki/GitPage for git access instructions.\n");
-#endif
- xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d",
- XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR,
- XORG_VERSION_PATCH);
-#if XORG_VERSION_SNAP > 0
- xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP);
-#endif
-
-#if XORG_VERSION_SNAP >= 900
- /* When the minor number is 99, that signifies that the we are making
- * a release candidate for a major version. (X.0.0)
- * When the patch number is 99, that signifies that the we are making
- * a release candidate for a minor version. (X.Y.0)
- * When the patch number is < 99, then we are making a release
- * candidate for the next point release. (X.Y.Z)
- */
-#if XORG_VERSION_MINOR >= 99
- xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1,
- XORG_VERSION_SNAP - 900);
-#elif XORG_VERSION_PATCH == 99
- xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900);
-#else
- xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR,
- XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1,
- XORG_VERSION_SNAP - 900);
-#endif
-#endif
-
-#ifdef XORG_CUSTOM_VERSION
- xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION);
-#endif
-#ifndef XORG_DATE
-# define XORG_DATE "Unknown"
-#endif
- xf86ErrorFVerb(0, "\nRelease Date: %s\n", XORG_DATE);
- xf86ErrorFVerb(0, "X Protocol Version %d, Revision %d\n",
- X_PROTOCOL, X_PROTOCOL_REVISION);
- xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR);
-#ifdef HAS_UTSNAME
- {
- struct utsname name;
-
- /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX,
- and Irix) and Single Unix Spec 3 just say that non-negative is success.
- All agree that failure is represented by a negative number.
- */
- if (uname(&name) >= 0) {
- xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n",
- name.sysname, name.nodename, name.release, name.version, name.machine);
-#ifdef linux
- do {
- char buf[80];
- int fd = open("/proc/cmdline", O_RDONLY);
- if (fd != -1) {
- xf86ErrorFVerb(0, "Kernel command line: ");
- memset(buf, 0, 80);
- while (read(fd, buf, 80) > 0) {
- xf86ErrorFVerb(0, "%.80s", buf);
- memset(buf, 0, 80);
- }
- close(fd);
- }
- } while (0);
-#endif
- }
- }
-#endif
-#if defined(BUILD_DATE) && (BUILD_DATE > 19000000)
- {
- struct tm t;
- char buf[100];
-
- memset(&t, 0, sizeof(t));
- memset(buf, 0, sizeof(buf));
- t.tm_mday = BUILD_DATE % 100;
- t.tm_mon = (BUILD_DATE / 100) % 100 - 1;
- t.tm_year = BUILD_DATE / 10000 - 1900;
-#if defined(BUILD_TIME)
- t.tm_sec = BUILD_TIME % 100;
- t.tm_min = (BUILD_TIME / 100) % 100;
- t.tm_hour = (BUILD_TIME / 10000) % 100;
- if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t))
- xf86ErrorFVerb(0, "Build Date: %s\n", buf);
-#else
- if (strftime(buf, sizeof(buf), "%d %B %Y", &t))
- xf86ErrorFVerb(0, "Build Date: %s\n", buf);
-#endif
- }
-#endif
-#if defined(BUILDERSTRING)
- xf86ErrorFVerb(0, "%s \n", BUILDERSTRING);
-#endif
- xf86ErrorFVerb(0, "Current version of pixman: %s\n",
- pixman_version_string());
- xf86ErrorFVerb(0, "\tBefore reporting problems, check "
- ""__VENDORDWEBSUPPORT__"\n"
- "\tto make sure that you have the latest version.\n");
-}
-
-static void
-xf86PrintMarkers(void)
-{
- LogPrintMarkers();
-}
-
-static Bool
-xf86CreateRootWindow(WindowPtr pWin)
-{
- int ret = TRUE;
- int err = Success;
- ScreenPtr pScreen = pWin->drawable.pScreen;
- RootWinPropPtr pProp;
- CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr)
- dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey);
-
- DebugF("xf86CreateRootWindow(%p)\n", pWin);
-
- if ( pScreen->CreateWindow != xf86CreateRootWindow ) {
- /* Can't find hook we are hung on */
- xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */,
- "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n",
- (void *)xf86CreateRootWindow,
- (void *)pScreen->CreateWindow );
- }
-
- /* Unhook this function ... */
- pScreen->CreateWindow = CreateWindow;
- dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL);
-
- /* ... and call the previous CreateWindow fuction, if any */
- if (NULL!=pScreen->CreateWindow) {
- ret = (*pScreen->CreateWindow)(pWin);
- }
-
- /* Now do our stuff */
- if (xf86RegisteredPropertiesTable != NULL) {
- if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) {
- for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum];
- pProp != NULL && err==Success;
- pProp = pProp->next )
- {
- Atom prop;
-
- prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE);
- err = dixChangeWindowProperty(serverClient, pWin,
- prop, pProp->type,
- pProp->format, PropModeReplace,
- pProp->size, pProp->data,
- FALSE);
- }
-
- /* Look at err */
- ret &= (err==Success);
-
- } else {
- xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with "
- "non-root window %p (parent %p)\n",
- (void *)pWin, (void *)pWin->parent);
- ret = FALSE;
- }
- }
-
- DebugF("xf86CreateRootWindow() returns %d\n", ret);
- return ret;
-}
-
-
-static void
-InstallSignalHandlers(void)
-{
- /*
- * Install signal handler for unexpected signals
- */
- xf86Info.caughtSignal=FALSE;
- if (!xf86Info.notrapSignals) {
- OsRegisterSigWrapper(xf86SigWrapper);
- } else {
- signal(SIGSEGV, SIG_DFL);
- signal(SIGILL, SIG_DFL);
-#ifdef SIGEMT
- signal(SIGEMT, SIG_DFL);
-#endif
- signal(SIGFPE, SIG_DFL);
- signal(SIGBUS, SIG_DFL);
- signal(SIGSYS, SIG_DFL);
- signal(SIGXCPU, SIG_DFL);
- signal(SIGXFSZ, SIG_DFL);
- }
-}
-
-/*
- * InitOutput --
- * Initialize screenInfo for all actually accessible framebuffers.
- * That includes vt-manager setup, querying all possible devices and
- * collecting the pixmap formats.
- */
-void
-InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv)
-{
- int i, j, k, scr_index;
- char **modulelist;
- pointer *optionlist;
- Pix24Flags screenpix24, pix24;
- MessageType pix24From = X_DEFAULT;
- Bool pix24Fail = FALSE;
- Bool autoconfig = FALSE;
- GDevPtr configured_device;
-
- xf86Initialising = TRUE;
-
- if (serverGeneration == 1) {
- if ((xf86ServerName = strrchr(argv[0], '/')) != 0)
- xf86ServerName++;
- else
- xf86ServerName = argv[0];
-
- xf86PrintBanner();
- xf86PrintMarkers();
- if (xf86LogFile) {
- time_t t;
- const char *ct;
- t = time(NULL);
- ct = ctime(&t);
- xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s",
- xf86LogFile, ct);
- }
-
- /* Read and parse the config file */
- if (!xf86DoConfigure && !xf86DoShowOptions) {
- switch (xf86HandleConfigFile(FALSE)) {
- case CONFIG_OK:
- break;
- case CONFIG_PARSE_ERROR:
- xf86Msg(X_ERROR, "Error parsing the config file\n");
- return;
- case CONFIG_NOFILE:
- autoconfig = TRUE;
- break;
- }
- }
-
- InstallSignalHandlers();
-
- /* Initialise the loader */
- LoaderInit();
-
- /* Tell the loader the default module search path */
- LoaderSetPath(xf86ModulePath);
-
- if (xf86Info.ignoreABI) {
- LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
- }
-
- if (xf86DoShowOptions)
- DoShowOptions();
-
- /* Do a general bus probe. This will be a PCI probe for x86 platforms */
- xf86BusProbe();
-
- if (xf86DoConfigure)
- DoConfigure();
-
- if (autoconfig) {
- if (!xf86AutoConfig()) {
- xf86Msg(X_ERROR, "Auto configuration failed\n");
- return;
- }
- }
-
-#ifdef XF86PM
- xf86OSPMClose = xf86OSPMOpen();
-#endif
-
- /* Load all modules specified explicitly in the config file */
- if ((modulelist = xf86ModulelistFromConfig(&optionlist))) {
- xf86LoadModules(modulelist, optionlist);
- free(modulelist);
- free(optionlist);
- }
-
- /* Load all driver modules specified in the config file */
- /* If there aren't any specified in the config file, autoconfig them */
- /* FIXME: Does not handle multiple active screen sections, but I'm not
- * sure if we really want to handle that case*/
- configured_device = xf86ConfigLayout.screens->screen->device;
- if ((!configured_device) || (!configured_device->driver)) {
- if (!autoConfigDevice(configured_device)) {
- xf86Msg(X_ERROR, "Automatic driver configuration failed\n");
- return ;
- }
- }
- if ((modulelist = xf86DriverlistFromConfig())) {
- xf86LoadModules(modulelist, NULL);
- free(modulelist);
- }
-
- /* Load all input driver modules specified in the config file. */
- if ((modulelist = xf86InputDriverlistFromConfig())) {
- xf86LoadModules(modulelist, NULL);
- free(modulelist);
- }
-
- /*
- * It is expected that xf86AddDriver()/xf86AddInputDriver will be
- * called for each driver as it is loaded. Those functions save the
- * module pointers for drivers.
- * XXX Nothing keeps track of them for other modules.
- */
- /* XXX What do we do if not all of these could be loaded? */
-
- /*
- * At this point, xf86DriverList[] is all filled in with entries for
- * each of the drivers to try and xf86NumDrivers has the number of
- * drivers. If there are none, return now.
- */
-
- if (xf86NumDrivers == 0) {
- xf86Msg(X_ERROR, "No drivers available.\n");
- return;
- }
-
- /*
- * Call each of the Identify functions and call the driverFunc to check
- * if HW access is required. The Identify functions print out some
- * identifying information, and anything else that might be
- * needed at this early stage.
- */
-
- for (i = 0; i < xf86NumDrivers; i++) {
- if (xf86DriverList[i]->Identify != NULL)
- xf86DriverList[i]->Identify(0);
-
- if (!xorgHWAccess || !xorgHWOpenConsole) {
- xorgHWFlags flags;
- if(!xf86DriverList[i]->driverFunc
- || !xf86DriverList[i]->driverFunc(NULL,
- GET_REQUIRED_HW_INTERFACES,
- &flags))
- flags = HW_IO;
-
- if(NEED_IO_ENABLED(flags))
- xorgHWAccess = TRUE;
- if(!(flags & HW_SKIP_CONSOLE))
- xorgHWOpenConsole = TRUE;
- }
- }
-
- if (xorgHWOpenConsole)
- xf86OpenConsole();
- else
- xf86Info.dontVTSwitch = TRUE;
-
- if (xf86BusConfig() == FALSE)
- return;
-
- xf86PostProbe();
-
- /*
- * Sort the drivers to match the requested ording. Using a slow
- * bubble sort.
- */
- for (j = 0; j < xf86NumScreens - 1; j++) {
- for (i = 0; i < xf86NumScreens - j - 1; i++) {
- if (xf86Screens[i + 1]->confScreen->screennum <
- xf86Screens[i]->confScreen->screennum) {
- ScrnInfoPtr tmpScrn = xf86Screens[i + 1];
- xf86Screens[i + 1] = xf86Screens[i];
- xf86Screens[i] = tmpScrn;
- }
- }
- }
- /* Fix up the indexes */
- for (i = 0; i < xf86NumScreens; i++) {
- xf86Screens[i]->scrnIndex = i;
- }
-
- /*
- * Call the driver's PreInit()'s to complete initialisation for the first
- * generation.
- */
-
- for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterScrnInit(xf86Screens[i]);
- xf86VGAarbiterLock(xf86Screens[i]);
- if (xf86Screens[i]->PreInit &&
- xf86Screens[i]->PreInit(xf86Screens[i], 0))
- xf86Screens[i]->configured = TRUE;
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- for (i = 0; i < xf86NumScreens; i++)
- if (!xf86Screens[i]->configured)
- xf86DeleteScreen(i--, 0);
-
- /*
- * If no screens left, return now.
- */
-
- if (xf86NumScreens == 0) {
- xf86Msg(X_ERROR,
- "Screen(s) found, but none have a usable configuration.\n");
- return;
- }
-
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->name == NULL) {
- XNFasprintf(&xf86Screens[i]->name, "screen%d", i);
- xf86MsgVerb(X_WARNING, 0,
- "Screen driver %d has no name set, using `%s'.\n",
- i, xf86Screens[i]->name);
- }
- }
-
- /* Remove (unload) drivers that are not required */
- for (i = 0; i < xf86NumDrivers; i++)
- if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0)
- xf86DeleteDriver(i);
-
- /*
- * At this stage we know how many screens there are.
- */
-
- for (i = 0; i < xf86NumScreens; i++)
- xf86InitViewport(xf86Screens[i]);
-
- /*
- * Collect all pixmap formats and check for conflicts at the display
- * level. Should we die here? Or just delete the offending screens?
- */
- screenpix24 = Pix24DontCare;
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->imageByteOrder !=
- xf86Screens[0]->imageByteOrder)
- FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
- if (xf86Screens[i]->bitmapScanlinePad !=
- xf86Screens[0]->bitmapScanlinePad)
- FatalError("Inconsistent display bitmapScanlinePad. Exiting\n");
- if (xf86Screens[i]->bitmapScanlineUnit !=
- xf86Screens[0]->bitmapScanlineUnit)
- FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n");
- if (xf86Screens[i]->bitmapBitOrder !=
- xf86Screens[0]->bitmapBitOrder)
- FatalError("Inconsistent display bitmapBitOrder. Exiting\n");
-
- /* Determine the depth 24 pixmap format the screens would like */
- if (xf86Screens[i]->pixmap24 != Pix24DontCare) {
- if (screenpix24 == Pix24DontCare)
- screenpix24 = xf86Screens[i]->pixmap24;
- else if (screenpix24 != xf86Screens[i]->pixmap24)
- FatalError("Inconsistent depth 24 pixmap format. Exiting\n");
- }
- }
- /* check if screenpix24 is consistent with the config/cmdline */
- if (xf86Info.pixmap24 != Pix24DontCare) {
- pix24 = xf86Info.pixmap24;
- pix24From = xf86Info.pix24From;
- if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24)
- pix24Fail = TRUE;
- } else if (screenpix24 != Pix24DontCare) {
- pix24 = screenpix24;
- pix24From = X_PROBED;
- } else
- pix24 = Pix24Use32;
-
- if (pix24Fail)
- FatalError("Screen(s) can't use the required depth 24 pixmap format"
- " (%d). Exiting\n", PIX24TOBPP(pix24));
-
- /* Initialise the depth 24 format */
- for (j = 0; j < numFormats && formats[j].depth != 24; j++)
- ;
- formats[j].bitsPerPixel = PIX24TOBPP(pix24);
-
- /* Collect additional formats */
- for (i = 0; i < xf86NumScreens; i++) {
- for (j = 0; j < xf86Screens[i]->numFormats; j++) {
- for (k = 0; ; k++) {
- if (k >= numFormats) {
- if (k >= MAXFORMATS)
- FatalError("Too many pixmap formats! Exiting\n");
- formats[k] = xf86Screens[i]->formats[j];
- numFormats++;
- break;
- }
- if (formats[k].depth == xf86Screens[i]->formats[j].depth) {
- if ((formats[k].bitsPerPixel ==
- xf86Screens[i]->formats[j].bitsPerPixel) &&
- (formats[k].scanlinePad ==
- xf86Screens[i]->formats[j].scanlinePad))
- break;
- FatalError("Inconsistent pixmap format for depth %d."
- " Exiting\n", formats[k].depth);
- }
- }
- }
- }
- formatsDone = TRUE;
-
- if (xf86Info.vtno >= 0 ) {
-#define VT_ATOM_NAME "XFree86_VT"
- Atom VTAtom=-1;
- CARD32 *VT = NULL;
- int ret;
-
- /* This memory needs to stay available until the screen has been
- initialized, and we can create the property for real.
- */
- if ( (VT = malloc(sizeof(CARD32)))==NULL ) {
- FatalError("Unable to make VT property - out of memory. Exiting...\n");
- }
- *VT = xf86Info.vtno;
-
- VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE);
-
- for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) {
- ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex,
- VTAtom, XA_INTEGER, 32,
- 1, VT );
- if (ret != Success)
- xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING,
- "Failed to register VT property\n");
- }
- }
-
- /* If a screen uses depth 24, show what the pixmap format is */
- for (i = 0; i < xf86NumScreens; i++) {
- if (xf86Screens[i]->depth == 24) {
- xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n",
- PIX24TOBPP(pix24));
- break;
- }
- }
- } else {
- /*
- * serverGeneration != 1; some OSs have to do things here, too.
- */
- if (xorgHWOpenConsole)
- xf86OpenConsole();
-
-#ifdef XF86PM
- /*
- should we reopen it here? We need to deal with an already opened
- device. We could leave this to the OS layer. For now we simply
- close it here
- */
- if (xf86OSPMClose)
- xf86OSPMClose();
- if ((xf86OSPMClose = xf86OSPMOpen()) != NULL)
- xf86MsgVerb(X_INFO, 3, "APM registered successfully\n");
-#endif
-
- /* Make sure full I/O access is enabled */
- if (xorgHWAccess)
- xf86EnableIO();
- }
-
- /*
- * Use the previously collected parts to setup pScreenInfo
- */
-
- pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder;
- pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad;
- pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit;
- pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder;
- pScreenInfo->numPixmapFormats = numFormats;
- for (i = 0; i < numFormats; i++)
- pScreenInfo->formats[i] = formats[i];
-
- /* Make sure the server's VT is active */
-
- if (serverGeneration != 1) {
- xf86Resetting = TRUE;
- /* All screens are in the same state, so just check the first */
- if (!xf86Screens[0]->vtSema) {
-#ifdef HAS_USL_VTS
- ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ);
-#endif
- xf86AccessEnter();
- xf86EnterServerState(SETUP);
- }
- }
-#ifdef SCO325
- else {
- /*
- * Under SCO we must ack that we got the console at startup,
- * I think this is the safest way to assure it.
- */
- static int once = 1;
- if (once) {
- once = 0;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0)
- xf86Msg(X_WARNING, "VT_ACKACQ failed");
- }
- }
-#endif /* SCO325 */
-
- for (i = 0; i < xf86NumScreens; i++)
- if (!xf86ColormapAllocatePrivates(xf86Screens[i]))
- FatalError("Cannot register DDX private keys");
-
- if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) ||
- !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0))
- FatalError("Cannot register DDX private keys");
-
- for (i = 0; i < xf86NumScreens; i++) {
- xf86VGAarbiterLock(xf86Screens[i]);
- /*
- * Almost everything uses these defaults, and many of those that
- * don't, will wrap them.
- */
- xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess;
-#ifdef XFreeXDGA
- xf86Screens[i]->SetDGAMode = xf86SetDGAMode;
-#endif
- xf86Screens[i]->DPMSSet = NULL;
- xf86Screens[i]->LoadPalette = NULL;
- xf86Screens[i]->SetOverscan = NULL;
- xf86Screens[i]->DriverFunc = NULL;
- xf86Screens[i]->pScreen = NULL;
- scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- if (scr_index == i) {
- /*
- * Hook in our ScrnInfoRec, and initialise some other pScreen
- * fields.
- */
- dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
- xf86ScreenKey, xf86Screens[i]);
- xf86Screens[i]->pScreen = screenInfo.screens[scr_index];
- /* The driver should set this, but make sure it is set anyway */
- xf86Screens[i]->vtSema = TRUE;
- } else {
- /* This shouldn't normally happen */
- FatalError("AddScreen/ScreenInit failed for driver %d\n", i);
- }
-
- DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n",
- i, xf86Screens[i]->pScreen );
- DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n",
- i, xf86Screens[i]->pScreen->CreateWindow );
-
- dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates,
- xf86CreateRootWindowKey,
- xf86Screens[i]->pScreen->CreateWindow);
- xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow;
-
- if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown)
- {
- xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC);
- PictureSetSubpixelOrder (xf86Screens[i]->pScreen,
- DDC ?
- (DDC->features.input_type ?
- SubPixelHorizontalRGB : SubPixelNone) :
- SubPixelUnknown);
- }
-#ifdef RANDR
- if (!xf86Info.disableRandR)
- xf86RandRInit (screenInfo.screens[scr_index]);
- xf86Msg(xf86Info.randRFrom, "RandR %s\n",
- xf86Info.disableRandR ? "disabled" : "enabled");
-#endif
- }
-
- xf86PostScreenInit();
-
- xf86InitOrigins();
-
- xf86Resetting = FALSE;
- xf86Initialising = FALSE;
-
- RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup,
- NULL);
-}
-
-/*
- * InitInput --
- * Initialize all supported input devices.
- */
-
-void
-InitInput(int argc, char **argv)
-{
- InputInfoPtr* pDev;
- DeviceIntPtr dev;
-
- xf86Info.vtRequestsPending = FALSE;
-
- mieqInit();
-
- GetEventList(&xf86Events);
-
- /* Call the PreInit function for each input device instance. */
- for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) {
- /* Replace obsolete keyboard driver with kbd */
- if (!xf86NameCmp((*pDev)->driver, "keyboard")) {
- strcpy((*pDev)->driver, "kbd");
- }
-
- /* If one fails, the others will too */
- if (xf86NewInputDevice(*pDev, &dev, TRUE) == BadAlloc)
- break;
- }
-
- config_init();
-}
-
-void
-CloseInput (void)
-{
- config_fini();
-}
-
-/*
- * OsVendorInit --
- * OS/Vendor-specific initialisations. Called from OsInit(), which
- * is called by dix before establishing the well known sockets.
- */
-
-void
-OsVendorInit(void)
-{
- static Bool beenHere = FALSE;
-
- signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */
-
- if (!beenHere) {
- umask(022);
- xf86LogInit();
- }
-
- /* Set stderr to non-blocking. */
-#ifndef O_NONBLOCK
-#if defined(FNDELAY)
-#define O_NONBLOCK FNDELAY
-#elif defined(O_NDELAY)
-#define O_NONBLOCK O_NDELAY
-#endif
-
-#ifdef O_NONBLOCK
- if (!beenHere) {
- if (geteuid() == 0 && getuid() != geteuid())
- {
- int status;
-
- status = fcntl(fileno(stderr), F_GETFL, 0);
- if (status != -1) {
- fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK);
- }
- }
- }
-#endif
-#endif
-
- beenHere = TRUE;
-}
-
-/*
- * ddxGiveUp --
- * Device dependent cleanup. Called by by dix before normal server death.
- * For SYSV386 we must switch the terminal back to normal mode. No error-
- * checking here, since there should be restored as much as possible.
- */
-
-void
-ddxGiveUp(void)
-{
- int i;
-
- xf86VGAarbiterFini();
-
-#ifdef XF86PM
- if (xf86OSPMClose)
- xf86OSPMClose();
- xf86OSPMClose = NULL;
-#endif
-
- for (i = 0; i < xf86NumScreens; i++) {
- /*
- * zero all access functions to
- * trap calls when switched away.
- */
- xf86Screens[i]->vtSema = FALSE;
- }
-
-#ifdef XFreeXDGA
- DGAShutdown();
-#endif
-
- if (xorgHWOpenConsole)
- xf86CloseConsole();
-
- xf86CloseLog();
-
- /* If an unexpected signal was caught, dump a core for debugging */
- if (xf86Info.caughtSignal)
- OsAbort();
-}
-
-
-
-/*
- * AbortDDX --
- * DDX - specific abort routine. Called by AbortServer(). The attempt is
- * made to restore all original setting of the displays. Also all devices
- * are closed.
- */
-
-void
-AbortDDX(void)
-{
- int i;
-
- /*
- * try to restore the original video state
- */
-#ifdef DPMSExtension /* Turn screens back on */
- if (DPMSPowerLevel != DPMSModeOn)
- DPMSSet(serverClient, DPMSModeOn);
-#endif
- if (xf86Screens) {
- if (xf86Screens[0]->vtSema)
- xf86EnterServerState(SETUP);
- for (i = 0; i < xf86NumScreens; i++)
- if (xf86Screens[i]->vtSema) {
- /*
- * if we are aborting before ScreenInit() has finished
- * we might not have been wrapped yet. Therefore enable
- * screen explicitely.
- */
- xf86VGAarbiterLock(xf86Screens[i]);
- (xf86Screens[i]->LeaveVT)(i, 0);
- xf86VGAarbiterUnlock(xf86Screens[i]);
- }
- }
-
- xf86AccessLeave();
-
- /*
- * This is needed for an abnormal server exit, since the normal exit stuff
- * MUST also be performed (i.e. the vt must be left in a defined state)
- */
- ddxGiveUp();
-}
-
-void
-OsVendorFatalError(void)
-{
-#ifdef VENDORSUPPORT
- ErrorF("\nPlease refer to your Operating System Vendor support pages\n"
- "at %s for support on this crash.\n",VENDORSUPPORT);
-#else
- ErrorF("\nPlease consult the "XVENDORNAME" support \n"
- "\t at "__VENDORDWEBSUPPORT__"\n for help. \n");
-#endif
- if (xf86LogFile && xf86LogFileWasOpened)
- ErrorF("Please also check the log file at \"%s\" for additional "
- "information.\n", xf86LogFile);
- ErrorF("\n");
-}
-
-int
-xf86SetVerbosity(int verb)
-{
- int save = xf86Verbose;
-
- xf86Verbose = verb;
- LogSetParameter(XLOG_VERBOSITY, verb);
- return save;
-}
-
-int
-xf86SetLogVerbosity(int verb)
-{
- int save = xf86LogVerbose;
-
- xf86LogVerbose = verb;
- LogSetParameter(XLOG_FILE_VERBOSITY, verb);
- return save;
-}
-
-static void
-xf86PrintDefaultModulePath(void)
-{
- ErrorF("%s\n", DEFAULT_MODULE_PATH);
-}
-
-static void
-xf86PrintDefaultLibraryPath(void)
-{
- ErrorF("%s\n", DEFAULT_LIBRARY_PATH);
-}
-
-/*
- * ddxProcessArgument --
- * Process device-dependent command line args. Returns 0 if argument is
- * not device dependent, otherwise Count of number of elements of argv
- * that are part of a device dependent commandline option.
- *
- */
-
-/* ARGSUSED */
-int
-ddxProcessArgument(int argc, char **argv, int i)
-{
-#define CHECK_FOR_REQUIRED_ARGUMENT() \
- if (((i + 1) >= argc) || (!argv[i + 1])) { \
- ErrorF("Required argument to %s not specified\n", argv[i]); \
- UseMsg(); \
- FatalError("Required argument to %s not specified\n", argv[i]); \
- }
-
- /* First the options that are only allowed for root */
- if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) {
- if ( (geteuid() == 0) && (getuid() != 0) ) {
- FatalError("The '%s' option can only be used by root.\n", argv[i]);
- }
- else if (!strcmp(argv[i], "-modulepath"))
- {
- char *mp;
- CHECK_FOR_REQUIRED_ARGUMENT();
- mp = strdup(argv[i + 1]);
- if (!mp)
- FatalError("Can't allocate memory for ModulePath\n");
- xf86ModulePath = mp;
- xf86ModPathFrom = X_CMDLINE;
- return 2;
- }
- else if (!strcmp(argv[i], "-logfile"))
- {
- char *lf;
- CHECK_FOR_REQUIRED_ARGUMENT();
- lf = strdup(argv[i + 1]);
- if (!lf)
- FatalError("Can't allocate memory for LogFile\n");
- xf86LogFile = lf;
- xf86LogFileFrom = X_CMDLINE;
- return 2;
- }
- }
- if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
- FatalError("\nInvalid argument for %s\n"
- "\tFor non-root users, the file specified with %s must be\n"
- "\ta relative path and must not contain any \"..\" elements.\n"
- "\tUsing default "__XCONFIGFILE__" search path.\n\n",
- argv[i], argv[i]);
- }
- xf86ConfigFile = argv[i + 1];
- return 2;
- }
- if (!strcmp(argv[i], "-configdir"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) {
- FatalError("\nInvalid argument for %s\n"
- "\tFor non-root users, the file specified with %s must be\n"
- "\ta relative path and must not contain any \"..\" elements.\n"
- "\tUsing default "__XCONFIGDIR__" search path.\n\n",
- argv[i], argv[i]);
- }
- xf86ConfigDir = argv[i + 1];
- return 2;
- }
- if (!strcmp(argv[i],"-flipPixels"))
- {
- xf86FlipPixels = TRUE;
- return 1;
- }
-#ifdef XF86VIDMODE
- if (!strcmp(argv[i],"-disableVidMode"))
- {
- xf86VidModeDisabled = TRUE;
- return 1;
- }
- if (!strcmp(argv[i],"-allowNonLocalXvidtune"))
- {
- xf86VidModeAllowNonLocal = TRUE;
- return 1;
- }
-#endif
- if (!strcmp(argv[i],"-allowMouseOpenFail"))
- {
- xf86AllowMouseOpenFail = TRUE;
- return 1;
- }
- if (!strcmp(argv[i],"-ignoreABI"))
- {
- LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL);
- return 1;
- }
- if (!strcmp(argv[i],"-verbose"))
- {
- if (++i < argc && argv[i])
- {
- char *end;
- long val;
- val = strtol(argv[i], &end, 0);
- if (*end == '\0')
- {
- xf86SetVerbosity(val);
- return 2;
- }
- }
- xf86SetVerbosity(++xf86Verbose);
- return 1;
- }
- if (!strcmp(argv[i],"-logverbose"))
- {
- if (++i < argc && argv[i])
- {
- char *end;
- long val;
- val = strtol(argv[i], &end, 0);
- if (*end == '\0')
- {
- xf86SetLogVerbosity(val);
- return 2;
- }
- }
- xf86SetLogVerbosity(++xf86LogVerbose);
- return 1;
- }
- if (!strcmp(argv[i],"-quiet"))
- {
- xf86SetVerbosity(-1);
- return 1;
- }
- if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version"))
- {
- xf86PrintBanner();
- exit(0);
- }
- if (!strcmp(argv[i],"-showDefaultModulePath"))
- {
- xf86PrintDefaultModulePath();
- exit(0);
- }
- if (!strcmp(argv[i],"-showDefaultLibPath"))
- {
- xf86PrintDefaultLibraryPath();
- exit(0);
- }
- /* Notice the -fp flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "-fp"))
- {
- xf86fpFlag = TRUE;
- return 0;
- }
- /* Notice the -bs flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "-bs"))
- {
- xf86bsDisableFlag = TRUE;
- return 0;
- }
- /* Notice the +bs flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "+bs"))
- {
- xf86bsEnableFlag = TRUE;
- return 0;
- }
- /* Notice the -s flag, but allow it to pass to the dix layer */
- if (!strcmp(argv[i], "-s"))
- {
- xf86sFlag = TRUE;
- return 0;
- }
- if (!strcmp(argv[i], "-pixmap24"))
- {
- xf86Pix24 = Pix24Use24;
- return 1;
- }
- if (!strcmp(argv[i], "-pixmap32"))
- {
- xf86Pix24 = Pix24Use32;
- return 1;
- }
- if (!strcmp(argv[i], "-fbbpp"))
- {
- int bpp;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%d", &bpp) == 1)
- {
- xf86FbBpp = bpp;
- return 2;
- }
- else
- {
- ErrorF("Invalid fbbpp\n");
- return 0;
- }
- }
- if (!strcmp(argv[i], "-depth"))
- {
- int depth;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%d", &depth) == 1)
- {
- xf86Depth = depth;
- return 2;
- }
- else
- {
- ErrorF("Invalid depth\n");
- return 0;
- }
- }
- if (!strcmp(argv[i], "-weight"))
- {
- int red, green, blue;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3)
- {
- xf86Weight.red = red;
- xf86Weight.green = green;
- xf86Weight.blue = blue;
- return 2;
- }
- else
- {
- ErrorF("Invalid weighting\n");
- return 0;
- }
- }
- if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") ||
- !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma"))
- {
- double gamma;
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (sscanf(argv[++i], "%lf", &gamma) == 1) {
- if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) {
- ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f"
- " is valid\n", GAMMA_MIN, GAMMA_MAX);
- return 0;
- }
- if (!strcmp(argv[i-1], "-gamma"))
- xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma;
- else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma;
- else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma;
- else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma;
- return 2;
- }
- }
- if (!strcmp(argv[i], "-layout"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86LayoutName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-screen"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86ScreenName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-pointer"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86PointerName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-keyboard"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- xf86KeyboardName = argv[++i];
- return 2;
- }
- if (!strcmp(argv[i], "-nosilk"))
- {
- xf86silkenMouseDisableFlag = TRUE;
- return 1;
- }
-#ifdef HAVE_ACPI
- if (!strcmp(argv[i], "-noacpi"))
- {
- xf86acpiDisableFlag = TRUE;
- return 1;
- }
-#endif
- if (!strcmp(argv[i], "-configure"))
- {
- if (getuid() != 0 && geteuid() == 0) {
- ErrorF("The '-configure' option can only be used by root.\n");
- exit(1);
- }
- xf86DoConfigure = TRUE;
- xf86AllowMouseOpenFail = TRUE;
- return 1;
- }
- if (!strcmp(argv[i], "-showopts"))
- {
- if (getuid() != 0 && geteuid() == 0) {
- ErrorF("The '-showopts' option can only be used by root.\n");
- exit(1);
- }
- xf86DoShowOptions = TRUE;
- return 1;
- }
- if (!strcmp(argv[i], "-isolateDevice"))
- {
- CHECK_FOR_REQUIRED_ARGUMENT();
- if (strncmp(argv[++i], "PCI:", 4)) {
- FatalError("Bus types other than PCI not yet isolable\n");
- }
- xf86PciIsolateDevice(argv[i]);
- return 2;
- }
- /* Notice cmdline xkbdir, but pass to dix as well */
- if (!strcmp(argv[i], "-xkbdir"))
- {
- xf86xkbdirFlag = TRUE;
- return 0;
- }
-
- /* OS-specific processing */
- return xf86ProcessArgument(argc, argv, i);
-}
-
-/*
- * ddxUseMsg --
- * Print out correct use of device dependent commandline options.
- * Maybe the user now knows what really to do ...
- */
-
-void
-ddxUseMsg(void)
-{
- ErrorF("\n");
- ErrorF("\n");
- ErrorF("Device Dependent Usage\n");
- if (getuid() == 0 || geteuid() != 0)
- {
- ErrorF("-modulepath paths specify the module search path\n");
- ErrorF("-logfile file specify a log file name\n");
- ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n");
- ErrorF("-showopts print available options for all installed drivers\n");
- }
- ErrorF("-config file specify a configuration file, relative to the\n");
- ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n");
- ErrorF("-configdir dir specify a configuration directory, relative to the\n");
- ErrorF(" "__XCONFIGDIR__" search path, only root can use absolute\n");
- ErrorF("-verbose [n] verbose startup messages\n");
- ErrorF("-logverbose [n] verbose log messages\n");
- ErrorF("-quiet minimal startup messages\n");
- ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n");
- ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n");
- ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n");
- ErrorF("-depth n set colour depth. Default: 8\n");
- ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n");
- ErrorF("-rgamma f set gamma value for red phase\n");
- ErrorF("-ggamma f set gamma value for green phase\n");
- ErrorF("-bgamma f set gamma value for blue phase\n");
- ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n");
- ErrorF("-layout name specify the ServerLayout section name\n");
- ErrorF("-screen name specify the Screen section name\n");
- ErrorF("-keyboard name specify the core keyboard InputDevice name\n");
- ErrorF("-pointer name specify the core pointer InputDevice name\n");
- ErrorF("-nosilk disable Silken Mouse\n");
- ErrorF("-flipPixels swap default black/white Pixel values\n");
-#ifdef XF86VIDMODE
- ErrorF("-disableVidMode disable mode adjustments with xvidtune\n");
- ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n");
-#endif
- ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n");
- ErrorF("-ignoreABI make module ABI mismatches non-fatal\n");
- ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n");
- ErrorF("-version show the server version\n");
- ErrorF("-showDefaultModulePath show the server default module path\n");
- ErrorF("-showDefaultLibPath show the server default library path\n");
- /* OS-specific usage */
- xf86UseMsg();
- ErrorF("\n");
-}
-
-
-/*
- * xf86LoadModules iterates over a list that is being passed in.
- */
-Bool
-xf86LoadModules(char **list, pointer *optlist)
-{
- int errmaj, errmin;
- pointer opt;
- int i;
- char *name;
- Bool failed = FALSE;
-
- if (!list)
- return TRUE;
-
- for (i = 0; list[i] != NULL; i++) {
-
- /* Normalise the module name */
- name = xf86NormalizeName(list[i]);
-
- /* Skip empty names */
- if (name == NULL || *name == '\0')
- continue;
-
- /* Replace obsolete keyboard driver with kbd */
- if (!xf86NameCmp(name, "keyboard")) {
- strcpy(name, "kbd");
- }
-
- if (optlist)
- opt = optlist[i];
- else
- opt = NULL;
-
- if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) {
- LoaderErrorMsg(NULL, name, errmaj, errmin);
- failed = TRUE;
- }
- free(name);
- }
- return !failed;
-}
-
-/* Pixmap format stuff */
-
-PixmapFormatPtr
-xf86GetPixFormat(ScrnInfoPtr pScrn, int depth)
-{
- int i;
- static PixmapFormatRec format; /* XXX not reentrant */
-
- /*
- * When the formats[] list initialisation isn't complete, check the
- * depth 24 pixmap config/cmdline options and screen-specified formats.
- */
-
- if (!formatsDone) {
- if (depth == 24) {
- Pix24Flags pix24 = Pix24DontCare;
-
- format.depth = 24;
- format.scanlinePad = BITMAP_SCANLINE_PAD;
- if (xf86Info.pixmap24 != Pix24DontCare)
- pix24 = xf86Info.pixmap24;
- else if (pScrn->pixmap24 != Pix24DontCare)
- pix24 = pScrn->pixmap24;
- if (pix24 == Pix24Use24)
- format.bitsPerPixel = 24;
- else
- format.bitsPerPixel = 32;
- return &format;
- }
- }
-
- for (i = 0; i < numFormats; i++)
- if (formats[i].depth == depth)
- break;
- if (i != numFormats)
- return &formats[i];
- else if (!formatsDone) {
- /* Check for screen-specified formats */
- for (i = 0; i < pScrn->numFormats; i++)
- if (pScrn->formats[i].depth == depth)
- break;
- if (i != pScrn->numFormats)
- return &pScrn->formats[i];
- }
- return NULL;
-}
-
-int
-xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth)
-{
- PixmapFormatPtr format;
-
-
- format = xf86GetPixFormat(pScrn, depth);
- if (format)
- return format->bitsPerPixel;
- else
- return 0;
-}
+/* + * Loosely based on code bearing the following copyright: + * + * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. + */ +/* + * Copyright (c) 1992-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 <xorg-config.h> +#endif + +#include <stdlib.h> +#include <errno.h> + +#undef HAS_UTSNAME +#if !defined(WIN32) +#define HAS_UTSNAME 1 +#include <sys/utsname.h> +#endif + +#include <X11/X.h> +#include <X11/Xmd.h> +#include <X11/Xproto.h> +#include <X11/Xatom.h> +#include "input.h" +#include "servermd.h" +#include "windowstr.h" +#include "scrnintstr.h" +#include "site.h" +#include "mi.h" + +#include "compiler.h" + +#include "loaderProcs.h" +#ifdef XFreeXDGA +#include "dgaproc.h" +#endif + +#define XF86_OS_PRIVS +#include "xf86.h" +#include "xf86Priv.h" +#include "xf86Config.h" +#include "xf86_OSlib.h" +#include "xf86cmap.h" +#include "xorgVersion.h" +#include "xf86Build.h" +#include "mipointer.h" +#include <X11/extensions/XI.h> +#include <X11/extensions/XIproto.h> +#include "xf86DDC.h" +#include "xf86Xinput.h" +#include "xf86InPriv.h" +#include "picturestr.h" + +#include "xf86Bus.h" +#include "xf86VGAarbiter.h" +#include "globals.h" + +#ifdef DPMSExtension +#include <X11/extensions/dpmsconst.h> +#include "dpmsproc.h" +#endif +#include <hotplug.h> + + +#ifdef XF86PM +void (*xf86OSPMClose)(void) = NULL; +#endif +static Bool xorgHWOpenConsole = FALSE; + +/* Common pixmap formats */ + +static PixmapFormatRec formats[MAXFORMATS] = { + { 1, 1, BITMAP_SCANLINE_PAD }, + { 4, 8, BITMAP_SCANLINE_PAD }, + { 8, 8, BITMAP_SCANLINE_PAD }, + { 15, 16, BITMAP_SCANLINE_PAD }, + { 16, 16, BITMAP_SCANLINE_PAD }, + { 24, 32, BITMAP_SCANLINE_PAD }, + { 32, 32, BITMAP_SCANLINE_PAD }, +}; +static int numFormats = 7; +static Bool formatsDone = FALSE; + +#ifndef OSNAME +#define OSNAME " unknown" +#endif +#ifndef OSVENDOR +#define OSVENDOR "" +#endif +#ifndef PRE_RELEASE +#define PRE_RELEASE XORG_VERSION_SNAP +#endif + +static void +xf86PrintBanner(void) +{ +#if PRE_RELEASE + xf86ErrorFVerb(0, "\n" + "This is a pre-release version of the X server from " XVENDORNAME ".\n" + "It is not supported in any way.\n" + "Bugs may be filed in the bugzilla at http://bugs.freedesktop.org/.\n" + "Select the \"xorg\" product for bugs you find in this release.\n" + "Before reporting bugs in pre-release versions please check the\n" + "latest version in the X.Org Foundation git repository.\n" + "See http://wiki.x.org/wiki/GitPage for git access instructions.\n"); +#endif + xf86ErrorFVerb(0, "\nX.Org X Server %d.%d.%d", + XORG_VERSION_MAJOR, + XORG_VERSION_MINOR, + XORG_VERSION_PATCH); +#if XORG_VERSION_SNAP > 0 + xf86ErrorFVerb(0, ".%d", XORG_VERSION_SNAP); +#endif + +#if XORG_VERSION_SNAP >= 900 + /* When the minor number is 99, that signifies that the we are making + * a release candidate for a major version. (X.0.0) + * When the patch number is 99, that signifies that the we are making + * a release candidate for a minor version. (X.Y.0) + * When the patch number is < 99, then we are making a release + * candidate for the next point release. (X.Y.Z) + */ +#if XORG_VERSION_MINOR >= 99 + xf86ErrorFVerb(0, " (%d.0.0 RC %d)", XORG_VERSION_MAJOR+1, + XORG_VERSION_SNAP - 900); +#elif XORG_VERSION_PATCH == 99 + xf86ErrorFVerb(0, " (%d.%d.0 RC %d)", XORG_VERSION_MAJOR, + XORG_VERSION_MINOR + 1, XORG_VERSION_SNAP - 900); +#else + xf86ErrorFVerb(0, " (%d.%d.%d RC %d)", XORG_VERSION_MAJOR, + XORG_VERSION_MINOR, XORG_VERSION_PATCH + 1, + XORG_VERSION_SNAP - 900); +#endif +#endif + +#ifdef XORG_CUSTOM_VERSION + xf86ErrorFVerb(0, " (%s)", XORG_CUSTOM_VERSION); +#endif +#ifndef XORG_DATE +# define XORG_DATE "Unknown" +#endif + xf86ErrorFVerb(0, "\nRelease Date: %s\n", XORG_DATE); + xf86ErrorFVerb(0, "X Protocol Version %d, Revision %d\n", + X_PROTOCOL, X_PROTOCOL_REVISION); + xf86ErrorFVerb(0, "Build Operating System: %s %s\n", OSNAME, OSVENDOR); +#ifdef HAS_UTSNAME + { + struct utsname name; + + /* Linux & BSD state that 0 is success, SysV (including Solaris, HP-UX, + and Irix) and Single Unix Spec 3 just say that non-negative is success. + All agree that failure is represented by a negative number. + */ + if (uname(&name) >= 0) { + xf86ErrorFVerb(0, "Current Operating System: %s %s %s %s %s\n", + name.sysname, name.nodename, name.release, name.version, name.machine); +#ifdef linux + do { + char buf[80]; + int fd = open("/proc/cmdline", O_RDONLY); + if (fd != -1) { + xf86ErrorFVerb(0, "Kernel command line: "); + memset(buf, 0, 80); + while (read(fd, buf, 80) > 0) { + xf86ErrorFVerb(0, "%.80s", buf); + memset(buf, 0, 80); + } + close(fd); + } + } while (0); +#endif + } + } +#endif +#if defined(BUILD_DATE) && (BUILD_DATE > 19000000) + { + struct tm t; + char buf[100]; + + memset(&t, 0, sizeof(t)); + memset(buf, 0, sizeof(buf)); + t.tm_mday = BUILD_DATE % 100; + t.tm_mon = (BUILD_DATE / 100) % 100 - 1; + t.tm_year = BUILD_DATE / 10000 - 1900; +#if defined(BUILD_TIME) + t.tm_sec = BUILD_TIME % 100; + t.tm_min = (BUILD_TIME / 100) % 100; + t.tm_hour = (BUILD_TIME / 10000) % 100; + if (strftime(buf, sizeof(buf), "%d %B %Y %I:%M:%S%p", &t)) + xf86ErrorFVerb(0, "Build Date: %s\n", buf); +#else + if (strftime(buf, sizeof(buf), "%d %B %Y", &t)) + xf86ErrorFVerb(0, "Build Date: %s\n", buf); +#endif + } +#endif +#if defined(BUILDERSTRING) + xf86ErrorFVerb(0, "%s \n", BUILDERSTRING); +#endif + xf86ErrorFVerb(0, "Current version of pixman: %s\n", + pixman_version_string()); + xf86ErrorFVerb(0, "\tBefore reporting problems, check " + ""__VENDORDWEBSUPPORT__"\n" + "\tto make sure that you have the latest version.\n"); +} + +static void +xf86PrintMarkers(void) +{ + LogPrintMarkers(); +} + +static Bool +xf86CreateRootWindow(WindowPtr pWin) +{ + int ret = TRUE; + int err = Success; + ScreenPtr pScreen = pWin->drawable.pScreen; + RootWinPropPtr pProp; + CreateWindowProcPtr CreateWindow = (CreateWindowProcPtr) + dixLookupPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey); + + DebugF("xf86CreateRootWindow(%p)\n", pWin); + + if ( pScreen->CreateWindow != xf86CreateRootWindow ) { + /* Can't find hook we are hung on */ + xf86DrvMsg(pScreen->myNum, X_WARNING /* X_ERROR */, + "xf86CreateRootWindow %p called when not in pScreen->CreateWindow %p n", + (void *)xf86CreateRootWindow, + (void *)pScreen->CreateWindow ); + } + + /* Unhook this function ... */ + pScreen->CreateWindow = CreateWindow; + dixSetPrivate(&pScreen->devPrivates, xf86CreateRootWindowKey, NULL); + + /* ... and call the previous CreateWindow fuction, if any */ + if (NULL!=pScreen->CreateWindow) { + ret = (*pScreen->CreateWindow)(pWin); + } + + /* Now do our stuff */ + if (xf86RegisteredPropertiesTable != NULL) { + if (pWin->parent == NULL && xf86RegisteredPropertiesTable != NULL) { + for (pProp = xf86RegisteredPropertiesTable[pScreen->myNum]; + pProp != NULL && err==Success; + pProp = pProp->next ) + { + Atom prop; + + prop = MakeAtom(pProp->name, strlen(pProp->name), TRUE); + err = dixChangeWindowProperty(serverClient, pWin, + prop, pProp->type, + pProp->format, PropModeReplace, + pProp->size, pProp->data, + FALSE); + } + + /* Look at err */ + ret &= (err==Success); + + } else { + xf86Msg(X_ERROR, "xf86CreateRootWindow unexpectedly called with " + "non-root window %p (parent %p)\n", + (void *)pWin, (void *)pWin->parent); + ret = FALSE; + } + } + + DebugF("xf86CreateRootWindow() returns %d\n", ret); + return ret; +} + + +static void +InstallSignalHandlers(void) +{ + /* + * Install signal handler for unexpected signals + */ + xf86Info.caughtSignal=FALSE; + if (!xf86Info.notrapSignals) { + OsRegisterSigWrapper(xf86SigWrapper); + } else { + signal(SIGSEGV, SIG_DFL); + signal(SIGILL, SIG_DFL); +#ifdef SIGEMT + signal(SIGEMT, SIG_DFL); +#endif + signal(SIGFPE, SIG_DFL); + signal(SIGBUS, SIG_DFL); + signal(SIGSYS, SIG_DFL); + signal(SIGXCPU, SIG_DFL); + signal(SIGXFSZ, SIG_DFL); + } +} + +/* + * InitOutput -- + * Initialize screenInfo for all actually accessible framebuffers. + * That includes vt-manager setup, querying all possible devices and + * collecting the pixmap formats. + */ +void +InitOutput(ScreenInfo *pScreenInfo, int argc, char **argv) +{ + int i, j, k, scr_index, was_blocked = 0; + char **modulelist; + pointer *optionlist; + Pix24Flags screenpix24, pix24; + MessageType pix24From = X_DEFAULT; + Bool pix24Fail = FALSE; + Bool autoconfig = FALSE; + GDevPtr configured_device; + + xf86Initialising = TRUE; + + if (serverGeneration == 1) { + if ((xf86ServerName = strrchr(argv[0], '/')) != 0) + xf86ServerName++; + else + xf86ServerName = argv[0]; + + xf86PrintBanner(); + xf86PrintMarkers(); + if (xf86LogFile) { + time_t t; + const char *ct; + t = time(NULL); + ct = ctime(&t); + xf86MsgVerb(xf86LogFileFrom, 0, "Log file: \"%s\", Time: %s", + xf86LogFile, ct); + } + + /* Read and parse the config file */ + if (!xf86DoConfigure && !xf86DoShowOptions) { + switch (xf86HandleConfigFile(FALSE)) { + case CONFIG_OK: + break; + case CONFIG_PARSE_ERROR: + xf86Msg(X_ERROR, "Error parsing the config file\n"); + return; + case CONFIG_NOFILE: + autoconfig = TRUE; + break; + } + } + + InstallSignalHandlers(); + + /* Initialise the loader */ + LoaderInit(); + + /* Tell the loader the default module search path */ + LoaderSetPath(xf86ModulePath); + + if (xf86Info.ignoreABI) { + LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); + } + + if (xf86DoShowOptions) + DoShowOptions(); + + /* Do a general bus probe. This will be a PCI probe for x86 platforms */ + xf86BusProbe(); + + if (xf86DoConfigure) + DoConfigure(); + + if (autoconfig) { + if (!xf86AutoConfig()) { + xf86Msg(X_ERROR, "Auto configuration failed\n"); + return; + } + } + +#ifdef XF86PM + xf86OSPMClose = xf86OSPMOpen(); +#endif + + /* Load all modules specified explicitly in the config file */ + if ((modulelist = xf86ModulelistFromConfig(&optionlist))) { + xf86LoadModules(modulelist, optionlist); + free(modulelist); + free(optionlist); + } + + /* Load all driver modules specified in the config file */ + /* If there aren't any specified in the config file, autoconfig them */ + /* FIXME: Does not handle multiple active screen sections, but I'm not + * sure if we really want to handle that case*/ + configured_device = xf86ConfigLayout.screens->screen->device; + if ((!configured_device) || (!configured_device->driver)) { + if (!autoConfigDevice(configured_device)) { + xf86Msg(X_ERROR, "Automatic driver configuration failed\n"); + return ; + } + } + if ((modulelist = xf86DriverlistFromConfig())) { + xf86LoadModules(modulelist, NULL); + free(modulelist); + } + + /* Load all input driver modules specified in the config file. */ + if ((modulelist = xf86InputDriverlistFromConfig())) { + xf86LoadModules(modulelist, NULL); + free(modulelist); + } + + /* + * It is expected that xf86AddDriver()/xf86AddInputDriver will be + * called for each driver as it is loaded. Those functions save the + * module pointers for drivers. + * XXX Nothing keeps track of them for other modules. + */ + /* XXX What do we do if not all of these could be loaded? */ + + /* + * At this point, xf86DriverList[] is all filled in with entries for + * each of the drivers to try and xf86NumDrivers has the number of + * drivers. If there are none, return now. + */ + + if (xf86NumDrivers == 0) { + xf86Msg(X_ERROR, "No drivers available.\n"); + return; + } + + /* + * Call each of the Identify functions and call the driverFunc to check + * if HW access is required. The Identify functions print out some + * identifying information, and anything else that might be + * needed at this early stage. + */ + + for (i = 0; i < xf86NumDrivers; i++) { + if (xf86DriverList[i]->Identify != NULL) + xf86DriverList[i]->Identify(0); + + if (!xorgHWAccess || !xorgHWOpenConsole) { + xorgHWFlags flags; + if(!xf86DriverList[i]->driverFunc + || !xf86DriverList[i]->driverFunc(NULL, + GET_REQUIRED_HW_INTERFACES, + &flags)) + flags = HW_IO; + + if(NEED_IO_ENABLED(flags)) + xorgHWAccess = TRUE; + if(!(flags & HW_SKIP_CONSOLE)) + xorgHWOpenConsole = TRUE; + } + } + + if (xorgHWOpenConsole) + xf86OpenConsole(); + else + xf86Info.dontVTSwitch = TRUE; + + if (xf86BusConfig() == FALSE) + return; + + xf86PostProbe(); + + /* + * Sort the drivers to match the requested ording. Using a slow + * bubble sort. + */ + for (j = 0; j < xf86NumScreens - 1; j++) { + for (i = 0; i < xf86NumScreens - j - 1; i++) { + if (xf86Screens[i + 1]->confScreen->screennum < + xf86Screens[i]->confScreen->screennum) { + ScrnInfoPtr tmpScrn = xf86Screens[i + 1]; + xf86Screens[i + 1] = xf86Screens[i]; + xf86Screens[i] = tmpScrn; + } + } + } + /* Fix up the indexes */ + for (i = 0; i < xf86NumScreens; i++) { + xf86Screens[i]->scrnIndex = i; + } + + /* + * Call the driver's PreInit()'s to complete initialisation for the first + * generation. + */ + + for (i = 0; i < xf86NumScreens; i++) { + xf86VGAarbiterScrnInit(xf86Screens[i]); + xf86VGAarbiterLock(xf86Screens[i]); + if (xf86Screens[i]->PreInit && + xf86Screens[i]->PreInit(xf86Screens[i], 0)) + xf86Screens[i]->configured = TRUE; + xf86VGAarbiterUnlock(xf86Screens[i]); + } + for (i = 0; i < xf86NumScreens; i++) + if (!xf86Screens[i]->configured) + xf86DeleteScreen(i--, 0); + + /* + * If no screens left, return now. + */ + + if (xf86NumScreens == 0) { + xf86Msg(X_ERROR, + "Screen(s) found, but none have a usable configuration.\n"); + return; + } + + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->name == NULL) { + XNFasprintf(&xf86Screens[i]->name, "screen%d", i); + xf86MsgVerb(X_WARNING, 0, + "Screen driver %d has no name set, using `%s'.\n", + i, xf86Screens[i]->name); + } + } + + /* Remove (unload) drivers that are not required */ + for (i = 0; i < xf86NumDrivers; i++) + if (xf86DriverList[i] && xf86DriverList[i]->refCount <= 0) + xf86DeleteDriver(i); + + /* + * At this stage we know how many screens there are. + */ + + for (i = 0; i < xf86NumScreens; i++) + xf86InitViewport(xf86Screens[i]); + + /* + * Collect all pixmap formats and check for conflicts at the display + * level. Should we die here? Or just delete the offending screens? + */ + screenpix24 = Pix24DontCare; + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->imageByteOrder != + xf86Screens[0]->imageByteOrder) + FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); + if (xf86Screens[i]->bitmapScanlinePad != + xf86Screens[0]->bitmapScanlinePad) + FatalError("Inconsistent display bitmapScanlinePad. Exiting\n"); + if (xf86Screens[i]->bitmapScanlineUnit != + xf86Screens[0]->bitmapScanlineUnit) + FatalError("Inconsistent display bitmapScanlineUnit. Exiting\n"); + if (xf86Screens[i]->bitmapBitOrder != + xf86Screens[0]->bitmapBitOrder) + FatalError("Inconsistent display bitmapBitOrder. Exiting\n"); + + /* Determine the depth 24 pixmap format the screens would like */ + if (xf86Screens[i]->pixmap24 != Pix24DontCare) { + if (screenpix24 == Pix24DontCare) + screenpix24 = xf86Screens[i]->pixmap24; + else if (screenpix24 != xf86Screens[i]->pixmap24) + FatalError("Inconsistent depth 24 pixmap format. Exiting\n"); + } + } + /* check if screenpix24 is consistent with the config/cmdline */ + if (xf86Info.pixmap24 != Pix24DontCare) { + pix24 = xf86Info.pixmap24; + pix24From = xf86Info.pix24From; + if (screenpix24 != Pix24DontCare && screenpix24 != xf86Info.pixmap24) + pix24Fail = TRUE; + } else if (screenpix24 != Pix24DontCare) { + pix24 = screenpix24; + pix24From = X_PROBED; + } else + pix24 = Pix24Use32; + + if (pix24Fail) + FatalError("Screen(s) can't use the required depth 24 pixmap format" + " (%d). Exiting\n", PIX24TOBPP(pix24)); + + /* Initialise the depth 24 format */ + for (j = 0; j < numFormats && formats[j].depth != 24; j++) + ; + formats[j].bitsPerPixel = PIX24TOBPP(pix24); + + /* Collect additional formats */ + for (i = 0; i < xf86NumScreens; i++) { + for (j = 0; j < xf86Screens[i]->numFormats; j++) { + for (k = 0; ; k++) { + if (k >= numFormats) { + if (k >= MAXFORMATS) + FatalError("Too many pixmap formats! Exiting\n"); + formats[k] = xf86Screens[i]->formats[j]; + numFormats++; + break; + } + if (formats[k].depth == xf86Screens[i]->formats[j].depth) { + if ((formats[k].bitsPerPixel == + xf86Screens[i]->formats[j].bitsPerPixel) && + (formats[k].scanlinePad == + xf86Screens[i]->formats[j].scanlinePad)) + break; + FatalError("Inconsistent pixmap format for depth %d." + " Exiting\n", formats[k].depth); + } + } + } + } + formatsDone = TRUE; + + if (xf86Info.vtno >= 0 ) { +#define VT_ATOM_NAME "XFree86_VT" + Atom VTAtom=-1; + CARD32 *VT = NULL; + int ret; + + /* This memory needs to stay available until the screen has been + initialized, and we can create the property for real. + */ + if ( (VT = malloc(sizeof(CARD32)))==NULL ) { + FatalError("Unable to make VT property - out of memory. Exiting...\n"); + } + *VT = xf86Info.vtno; + + VTAtom = MakeAtom(VT_ATOM_NAME, sizeof(VT_ATOM_NAME) - 1, TRUE); + + for (i = 0, ret = Success; i < xf86NumScreens && ret == Success; i++) { + ret = xf86RegisterRootWindowProperty(xf86Screens[i]->scrnIndex, + VTAtom, XA_INTEGER, 32, + 1, VT ); + if (ret != Success) + xf86DrvMsg(xf86Screens[i]->scrnIndex, X_WARNING, + "Failed to register VT property\n"); + } + } + + /* If a screen uses depth 24, show what the pixmap format is */ + for (i = 0; i < xf86NumScreens; i++) { + if (xf86Screens[i]->depth == 24) { + xf86Msg(pix24From, "Depth 24 pixmap format is %d bpp\n", + PIX24TOBPP(pix24)); + break; + } + } + } else { + /* + * serverGeneration != 1; some OSs have to do things here, too. + */ + if (xorgHWOpenConsole) + xf86OpenConsole(); + +#ifdef XF86PM + /* + should we reopen it here? We need to deal with an already opened + device. We could leave this to the OS layer. For now we simply + close it here + */ + if (xf86OSPMClose) + xf86OSPMClose(); + if ((xf86OSPMClose = xf86OSPMOpen()) != NULL) + xf86MsgVerb(X_INFO, 3, "APM registered successfully\n"); +#endif + + /* Make sure full I/O access is enabled */ + if (xorgHWAccess) + xf86EnableIO(); + } + + /* + * Use the previously collected parts to setup pScreenInfo + */ + + pScreenInfo->imageByteOrder = xf86Screens[0]->imageByteOrder; + pScreenInfo->bitmapScanlinePad = xf86Screens[0]->bitmapScanlinePad; + pScreenInfo->bitmapScanlineUnit = xf86Screens[0]->bitmapScanlineUnit; + pScreenInfo->bitmapBitOrder = xf86Screens[0]->bitmapBitOrder; + pScreenInfo->numPixmapFormats = numFormats; + for (i = 0; i < numFormats; i++) + pScreenInfo->formats[i] = formats[i]; + + /* Make sure the server's VT is active */ + + if (serverGeneration != 1) { + xf86Resetting = TRUE; + /* All screens are in the same state, so just check the first */ + if (!xf86Screens[0]->vtSema) { +#ifdef HAS_USL_VTS + ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ); +#endif + xf86AccessEnter(); + was_blocked = xf86BlockSIGIO(); + } + } + + for (i = 0; i < xf86NumScreens; i++) + if (!xf86ColormapAllocatePrivates(xf86Screens[i])) + FatalError("Cannot register DDX private keys"); + + if (!dixRegisterPrivateKey(&xf86ScreenKeyRec, PRIVATE_SCREEN, 0) || + !dixRegisterPrivateKey(&xf86CreateRootWindowKeyRec, PRIVATE_SCREEN, 0)) + FatalError("Cannot register DDX private keys"); + + for (i = 0; i < xf86NumScreens; i++) { + xf86VGAarbiterLock(xf86Screens[i]); + /* + * Almost everything uses these defaults, and many of those that + * don't, will wrap them. + */ + xf86Screens[i]->EnableDisableFBAccess = xf86EnableDisableFBAccess; +#ifdef XFreeXDGA + xf86Screens[i]->SetDGAMode = xf86SetDGAMode; +#endif + xf86Screens[i]->DPMSSet = NULL; + xf86Screens[i]->LoadPalette = NULL; + xf86Screens[i]->SetOverscan = NULL; + xf86Screens[i]->DriverFunc = NULL; + xf86Screens[i]->pScreen = NULL; + scr_index = AddScreen(xf86Screens[i]->ScreenInit, argc, argv); + xf86VGAarbiterUnlock(xf86Screens[i]); + if (scr_index == i) { + /* + * Hook in our ScrnInfoRec, and initialise some other pScreen + * fields. + */ + dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, + xf86ScreenKey, xf86Screens[i]); + xf86Screens[i]->pScreen = screenInfo.screens[scr_index]; + /* The driver should set this, but make sure it is set anyway */ + xf86Screens[i]->vtSema = TRUE; + } else { + /* This shouldn't normally happen */ + FatalError("AddScreen/ScreenInit failed for driver %d\n", i); + } + + DebugF("InitOutput - xf86Screens[%d]->pScreen = %p\n", + i, xf86Screens[i]->pScreen ); + DebugF("xf86Screens[%d]->pScreen->CreateWindow = %p\n", + i, xf86Screens[i]->pScreen->CreateWindow ); + + dixSetPrivate(&screenInfo.screens[scr_index]->devPrivates, + xf86CreateRootWindowKey, + xf86Screens[i]->pScreen->CreateWindow); + xf86Screens[i]->pScreen->CreateWindow = xf86CreateRootWindow; + + if (PictureGetSubpixelOrder (xf86Screens[i]->pScreen) == SubPixelUnknown) + { + xf86MonPtr DDC = (xf86MonPtr)(xf86Screens[i]->monitor->DDC); + PictureSetSubpixelOrder (xf86Screens[i]->pScreen, + DDC ? + (DDC->features.input_type ? + SubPixelHorizontalRGB : SubPixelNone) : + SubPixelUnknown); + } +#ifdef RANDR + if (!xf86Info.disableRandR) + xf86RandRInit (screenInfo.screens[scr_index]); + xf86Msg(xf86Info.randRFrom, "RandR %s\n", + xf86Info.disableRandR ? "disabled" : "enabled"); +#endif + } + + xf86VGAarbiterWrapFunctions(); + xf86UnblockSIGIO(was_blocked); + + xf86InitOrigins(); + + xf86Resetting = FALSE; + xf86Initialising = FALSE; + + RegisterBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA, xf86Wakeup, + NULL); +} + +/* + * InitInput -- + * Initialize all supported input devices. + */ + +void +InitInput(int argc, char **argv) +{ + InputInfoPtr* pDev; + DeviceIntPtr dev; + + xf86Info.vtRequestsPending = FALSE; + + mieqInit(); + + GetEventList(&xf86Events); + + /* Call the PreInit function for each input device instance. */ + for (pDev = xf86ConfigLayout.inputs; pDev && *pDev; pDev++) { + /* Replace obsolete keyboard driver with kbd */ + if (!xf86NameCmp((*pDev)->driver, "keyboard")) { + strcpy((*pDev)->driver, "kbd"); + } + + /* If one fails, the others will too */ + if (xf86NewInputDevice(*pDev, &dev, TRUE) == BadAlloc) + break; + } + + config_init(); +} + +void +CloseInput (void) +{ + config_fini(); +} + +/* + * OsVendorInit -- + * OS/Vendor-specific initialisations. Called from OsInit(), which + * is called by dix before establishing the well known sockets. + */ + +void +OsVendorInit(void) +{ + static Bool beenHere = FALSE; + + signal(SIGCHLD, SIG_DFL); /* Need to wait for child processes */ + + if (!beenHere) { + umask(022); + xf86LogInit(); + } + + /* Set stderr to non-blocking. */ +#ifndef O_NONBLOCK +#if defined(FNDELAY) +#define O_NONBLOCK FNDELAY +#elif defined(O_NDELAY) +#define O_NONBLOCK O_NDELAY +#endif + +#ifdef O_NONBLOCK + if (!beenHere) { + if (geteuid() == 0 && getuid() != geteuid()) + { + int status; + + status = fcntl(fileno(stderr), F_GETFL, 0); + if (status != -1) { + fcntl(fileno(stderr), F_SETFL, status | O_NONBLOCK); + } + } + } +#endif +#endif + + beenHere = TRUE; +} + +/* + * ddxGiveUp -- + * Device dependent cleanup. Called by by dix before normal server death. + * For SYSV386 we must switch the terminal back to normal mode. No error- + * checking here, since there should be restored as much as possible. + */ + +void +ddxGiveUp(void) +{ + int i; + + xf86VGAarbiterFini(); + +#ifdef XF86PM + if (xf86OSPMClose) + xf86OSPMClose(); + xf86OSPMClose = NULL; +#endif + + for (i = 0; i < xf86NumScreens; i++) { + /* + * zero all access functions to + * trap calls when switched away. + */ + xf86Screens[i]->vtSema = FALSE; + } + +#ifdef XFreeXDGA + DGAShutdown(); +#endif + + if (xorgHWOpenConsole) + xf86CloseConsole(); + + xf86CloseLog(); + + /* If an unexpected signal was caught, dump a core for debugging */ + if (xf86Info.caughtSignal) + OsAbort(); +} + + + +/* + * AbortDDX -- + * DDX - specific abort routine. Called by AbortServer(). The attempt is + * made to restore all original setting of the displays. Also all devices + * are closed. + */ + +void +AbortDDX(void) +{ + int i; + + xf86BlockSIGIO(); + + /* + * try to restore the original video state + */ +#ifdef DPMSExtension /* Turn screens back on */ + if (DPMSPowerLevel != DPMSModeOn) + DPMSSet(serverClient, DPMSModeOn); +#endif + if (xf86Screens) { + for (i = 0; i < xf86NumScreens; i++) + if (xf86Screens[i]->vtSema) { + /* + * if we are aborting before ScreenInit() has finished + * we might not have been wrapped yet. Therefore enable + * screen explicitely. + */ + xf86VGAarbiterLock(xf86Screens[i]); + (xf86Screens[i]->LeaveVT)(i, 0); + xf86VGAarbiterUnlock(xf86Screens[i]); + } + } + + xf86AccessLeave(); + + /* + * This is needed for an abnormal server exit, since the normal exit stuff + * MUST also be performed (i.e. the vt must be left in a defined state) + */ + ddxGiveUp(); +} + +void +OsVendorFatalError(void) +{ +#ifdef VENDORSUPPORT + ErrorF("\nPlease refer to your Operating System Vendor support pages\n" + "at %s for support on this crash.\n",VENDORSUPPORT); +#else + ErrorF("\nPlease consult the "XVENDORNAME" support \n" + "\t at "__VENDORDWEBSUPPORT__"\n for help. \n"); +#endif + if (xf86LogFile && xf86LogFileWasOpened) + ErrorF("Please also check the log file at \"%s\" for additional " + "information.\n", xf86LogFile); + ErrorF("\n"); +} + +int +xf86SetVerbosity(int verb) +{ + int save = xf86Verbose; + + xf86Verbose = verb; + LogSetParameter(XLOG_VERBOSITY, verb); + return save; +} + +int +xf86SetLogVerbosity(int verb) +{ + int save = xf86LogVerbose; + + xf86LogVerbose = verb; + LogSetParameter(XLOG_FILE_VERBOSITY, verb); + return save; +} + +static void +xf86PrintDefaultModulePath(void) +{ + ErrorF("%s\n", DEFAULT_MODULE_PATH); +} + +static void +xf86PrintDefaultLibraryPath(void) +{ + ErrorF("%s\n", DEFAULT_LIBRARY_PATH); +} + +/* + * ddxProcessArgument -- + * Process device-dependent command line args. Returns 0 if argument is + * not device dependent, otherwise Count of number of elements of argv + * that are part of a device dependent commandline option. + * + */ + +/* ARGSUSED */ +int +ddxProcessArgument(int argc, char **argv, int i) +{ +#define CHECK_FOR_REQUIRED_ARGUMENT() \ + if (((i + 1) >= argc) || (!argv[i + 1])) { \ + ErrorF("Required argument to %s not specified\n", argv[i]); \ + UseMsg(); \ + FatalError("Required argument to %s not specified\n", argv[i]); \ + } + + /* First the options that are only allowed for root */ + if (!strcmp(argv[i], "-modulepath") || !strcmp(argv[i], "-logfile")) { + if ( (geteuid() == 0) && (getuid() != 0) ) { + FatalError("The '%s' option can only be used by root.\n", argv[i]); + } + else if (!strcmp(argv[i], "-modulepath")) + { + char *mp; + CHECK_FOR_REQUIRED_ARGUMENT(); + mp = strdup(argv[i + 1]); + if (!mp) + FatalError("Can't allocate memory for ModulePath\n"); + xf86ModulePath = mp; + xf86ModPathFrom = X_CMDLINE; + return 2; + } + else if (!strcmp(argv[i], "-logfile")) + { + char *lf; + CHECK_FOR_REQUIRED_ARGUMENT(); + lf = strdup(argv[i + 1]); + if (!lf) + FatalError("Can't allocate memory for LogFile\n"); + xf86LogFile = lf; + xf86LogFileFrom = X_CMDLINE; + return 2; + } + } + if (!strcmp(argv[i], "-config") || !strcmp(argv[i], "-xf86config")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { + FatalError("\nInvalid argument for %s\n" + "\tFor non-root users, the file specified with %s must be\n" + "\ta relative path and must not contain any \"..\" elements.\n" + "\tUsing default "__XCONFIGFILE__" search path.\n\n", + argv[i], argv[i]); + } + xf86ConfigFile = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i], "-configdir")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + if (getuid() != 0 && !xf86PathIsSafe(argv[i + 1])) { + FatalError("\nInvalid argument for %s\n" + "\tFor non-root users, the file specified with %s must be\n" + "\ta relative path and must not contain any \"..\" elements.\n" + "\tUsing default "__XCONFIGDIR__" search path.\n\n", + argv[i], argv[i]); + } + xf86ConfigDir = argv[i + 1]; + return 2; + } + if (!strcmp(argv[i],"-flipPixels")) + { + xf86FlipPixels = TRUE; + return 1; + } +#ifdef XF86VIDMODE + if (!strcmp(argv[i],"-disableVidMode")) + { + xf86VidModeDisabled = TRUE; + return 1; + } + if (!strcmp(argv[i],"-allowNonLocalXvidtune")) + { + xf86VidModeAllowNonLocal = TRUE; + return 1; + } +#endif + if (!strcmp(argv[i],"-allowMouseOpenFail")) + { + xf86AllowMouseOpenFail = TRUE; + return 1; + } + if (!strcmp(argv[i],"-ignoreABI")) + { + LoaderSetOptions(LDR_OPT_ABI_MISMATCH_NONFATAL); + return 1; + } + if (!strcmp(argv[i],"-verbose")) + { + if (++i < argc && argv[i]) + { + char *end; + long val; + val = strtol(argv[i], &end, 0); + if (*end == '\0') + { + xf86SetVerbosity(val); + return 2; + } + } + xf86SetVerbosity(++xf86Verbose); + return 1; + } + if (!strcmp(argv[i],"-logverbose")) + { + if (++i < argc && argv[i]) + { + char *end; + long val; + val = strtol(argv[i], &end, 0); + if (*end == '\0') + { + xf86SetLogVerbosity(val); + return 2; + } + } + xf86SetLogVerbosity(++xf86LogVerbose); + return 1; + } + if (!strcmp(argv[i],"-quiet")) + { + xf86SetVerbosity(-1); + return 1; + } + if (!strcmp(argv[i],"-showconfig") || !strcmp(argv[i],"-version")) + { + xf86PrintBanner(); + exit(0); + } + if (!strcmp(argv[i],"-showDefaultModulePath")) + { + xf86PrintDefaultModulePath(); + exit(0); + } + if (!strcmp(argv[i],"-showDefaultLibPath")) + { + xf86PrintDefaultLibraryPath(); + exit(0); + } + /* Notice the -fp flag, but allow it to pass to the dix layer */ + if (!strcmp(argv[i], "-fp")) + { + xf86fpFlag = TRUE; + return 0; + } + /* Notice the -bs flag, but allow it to pass to the dix layer */ + if (!strcmp(argv[i], "-bs")) + { + xf86bsDisableFlag = TRUE; + return 0; + } + /* Notice the +bs flag, but allow it to pass to the dix layer */ + if (!strcmp(argv[i], "+bs")) + { + xf86bsEnableFlag = TRUE; + return 0; + } + /* Notice the -s flag, but allow it to pass to the dix layer */ + if (!strcmp(argv[i], "-s")) + { + xf86sFlag = TRUE; + return 0; + } + if (!strcmp(argv[i], "-pixmap24")) + { + xf86Pix24 = Pix24Use24; + return 1; + } + if (!strcmp(argv[i], "-pixmap32")) + { + xf86Pix24 = Pix24Use32; + return 1; + } + if (!strcmp(argv[i], "-fbbpp")) + { + int bpp; + CHECK_FOR_REQUIRED_ARGUMENT(); + if (sscanf(argv[++i], "%d", &bpp) == 1) + { + xf86FbBpp = bpp; + return 2; + } + else + { + ErrorF("Invalid fbbpp\n"); + return 0; + } + } + if (!strcmp(argv[i], "-depth")) + { + int depth; + CHECK_FOR_REQUIRED_ARGUMENT(); + if (sscanf(argv[++i], "%d", &depth) == 1) + { + xf86Depth = depth; + return 2; + } + else + { + ErrorF("Invalid depth\n"); + return 0; + } + } + if (!strcmp(argv[i], "-weight")) + { + int red, green, blue; + CHECK_FOR_REQUIRED_ARGUMENT(); + if (sscanf(argv[++i], "%1d%1d%1d", &red, &green, &blue) == 3) + { + xf86Weight.red = red; + xf86Weight.green = green; + xf86Weight.blue = blue; + return 2; + } + else + { + ErrorF("Invalid weighting\n"); + return 0; + } + } + if (!strcmp(argv[i], "-gamma") || !strcmp(argv[i], "-rgamma") || + !strcmp(argv[i], "-ggamma") || !strcmp(argv[i], "-bgamma")) + { + double gamma; + CHECK_FOR_REQUIRED_ARGUMENT(); + if (sscanf(argv[++i], "%lf", &gamma) == 1) { + if (gamma < GAMMA_MIN || gamma > GAMMA_MAX) { + ErrorF("gamma out of range, only %.2f <= gamma_value <= %.1f" + " is valid\n", GAMMA_MIN, GAMMA_MAX); + return 0; + } + if (!strcmp(argv[i-1], "-gamma")) + xf86Gamma.red = xf86Gamma.green = xf86Gamma.blue = gamma; + else if (!strcmp(argv[i-1], "-rgamma")) xf86Gamma.red = gamma; + else if (!strcmp(argv[i-1], "-ggamma")) xf86Gamma.green = gamma; + else if (!strcmp(argv[i-1], "-bgamma")) xf86Gamma.blue = gamma; + return 2; + } + } + if (!strcmp(argv[i], "-layout")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + xf86LayoutName = argv[++i]; + return 2; + } + if (!strcmp(argv[i], "-screen")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + xf86ScreenName = argv[++i]; + return 2; + } + if (!strcmp(argv[i], "-pointer")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + xf86PointerName = argv[++i]; + return 2; + } + if (!strcmp(argv[i], "-keyboard")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + xf86KeyboardName = argv[++i]; + return 2; + } + if (!strcmp(argv[i], "-nosilk")) + { + xf86silkenMouseDisableFlag = TRUE; + return 1; + } +#ifdef HAVE_ACPI + if (!strcmp(argv[i], "-noacpi")) + { + xf86acpiDisableFlag = TRUE; + return 1; + } +#endif + if (!strcmp(argv[i], "-configure")) + { + if (getuid() != 0 && geteuid() == 0) { + ErrorF("The '-configure' option can only be used by root.\n"); + exit(1); + } + xf86DoConfigure = TRUE; + xf86AllowMouseOpenFail = TRUE; + return 1; + } + if (!strcmp(argv[i], "-showopts")) + { + if (getuid() != 0 && geteuid() == 0) { + ErrorF("The '-showopts' option can only be used by root.\n"); + exit(1); + } + xf86DoShowOptions = TRUE; + return 1; + } + if (!strcmp(argv[i], "-isolateDevice")) + { + CHECK_FOR_REQUIRED_ARGUMENT(); + if (strncmp(argv[++i], "PCI:", 4)) { + FatalError("Bus types other than PCI not yet isolable\n"); + } + xf86PciIsolateDevice(argv[i]); + return 2; + } + /* Notice cmdline xkbdir, but pass to dix as well */ + if (!strcmp(argv[i], "-xkbdir")) + { + xf86xkbdirFlag = TRUE; + return 0; + } + + /* OS-specific processing */ + return xf86ProcessArgument(argc, argv, i); +} + +/* + * ddxUseMsg -- + * Print out correct use of device dependent commandline options. + * Maybe the user now knows what really to do ... + */ + +void +ddxUseMsg(void) +{ + ErrorF("\n"); + ErrorF("\n"); + ErrorF("Device Dependent Usage\n"); + if (getuid() == 0 || geteuid() != 0) + { + ErrorF("-modulepath paths specify the module search path\n"); + ErrorF("-logfile file specify a log file name\n"); + ErrorF("-configure probe for devices and write an "__XCONFIGFILE__"\n"); + ErrorF("-showopts print available options for all installed drivers\n"); + } + ErrorF("-config file specify a configuration file, relative to the\n"); + ErrorF(" "__XCONFIGFILE__" search path, only root can use absolute\n"); + ErrorF("-configdir dir specify a configuration directory, relative to the\n"); + ErrorF(" "__XCONFIGDIR__" search path, only root can use absolute\n"); + ErrorF("-verbose [n] verbose startup messages\n"); + ErrorF("-logverbose [n] verbose log messages\n"); + ErrorF("-quiet minimal startup messages\n"); + ErrorF("-pixmap24 use 24bpp pixmaps for depth 24\n"); + ErrorF("-pixmap32 use 32bpp pixmaps for depth 24\n"); + ErrorF("-fbbpp n set bpp for the framebuffer. Default: 8\n"); + ErrorF("-depth n set colour depth. Default: 8\n"); + ErrorF("-gamma f set gamma value (0.1 < f < 10.0) Default: 1.0\n"); + ErrorF("-rgamma f set gamma value for red phase\n"); + ErrorF("-ggamma f set gamma value for green phase\n"); + ErrorF("-bgamma f set gamma value for blue phase\n"); + ErrorF("-weight nnn set RGB weighting at 16 bpp. Default: 565\n"); + ErrorF("-layout name specify the ServerLayout section name\n"); + ErrorF("-screen name specify the Screen section name\n"); + ErrorF("-keyboard name specify the core keyboard InputDevice name\n"); + ErrorF("-pointer name specify the core pointer InputDevice name\n"); + ErrorF("-nosilk disable Silken Mouse\n"); + ErrorF("-flipPixels swap default black/white Pixel values\n"); +#ifdef XF86VIDMODE + ErrorF("-disableVidMode disable mode adjustments with xvidtune\n"); + ErrorF("-allowNonLocalXvidtune allow xvidtune to be run as a non-local client\n"); +#endif + ErrorF("-allowMouseOpenFail start server even if the mouse can't be initialized\n"); + ErrorF("-ignoreABI make module ABI mismatches non-fatal\n"); + ErrorF("-isolateDevice bus_id restrict device resets to bus_id (PCI only)\n"); + ErrorF("-version show the server version\n"); + ErrorF("-showDefaultModulePath show the server default module path\n"); + ErrorF("-showDefaultLibPath show the server default library path\n"); + /* OS-specific usage */ + xf86UseMsg(); + ErrorF("\n"); +} + + +/* + * xf86LoadModules iterates over a list that is being passed in. + */ +Bool +xf86LoadModules(char **list, pointer *optlist) +{ + int errmaj, errmin; + pointer opt; + int i; + char *name; + Bool failed = FALSE; + + if (!list) + return TRUE; + + for (i = 0; list[i] != NULL; i++) { + + /* Normalise the module name */ + name = xf86NormalizeName(list[i]); + + /* Skip empty names */ + if (name == NULL || *name == '\0') + continue; + + /* Replace obsolete keyboard driver with kbd */ + if (!xf86NameCmp(name, "keyboard")) { + strcpy(name, "kbd"); + } + + if (optlist) + opt = optlist[i]; + else + opt = NULL; + + if (!LoadModule(name, NULL, NULL, NULL, opt, NULL, &errmaj, &errmin)) { + LoaderErrorMsg(NULL, name, errmaj, errmin); + failed = TRUE; + } + free(name); + } + return !failed; +} + +/* Pixmap format stuff */ + +PixmapFormatPtr +xf86GetPixFormat(ScrnInfoPtr pScrn, int depth) +{ + int i; + static PixmapFormatRec format; /* XXX not reentrant */ + + /* + * When the formats[] list initialisation isn't complete, check the + * depth 24 pixmap config/cmdline options and screen-specified formats. + */ + + if (!formatsDone) { + if (depth == 24) { + Pix24Flags pix24 = Pix24DontCare; + + format.depth = 24; + format.scanlinePad = BITMAP_SCANLINE_PAD; + if (xf86Info.pixmap24 != Pix24DontCare) + pix24 = xf86Info.pixmap24; + else if (pScrn->pixmap24 != Pix24DontCare) + pix24 = pScrn->pixmap24; + if (pix24 == Pix24Use24) + format.bitsPerPixel = 24; + else + format.bitsPerPixel = 32; + return &format; + } + } + + for (i = 0; i < numFormats; i++) + if (formats[i].depth == depth) + break; + if (i != numFormats) + return &formats[i]; + else if (!formatsDone) { + /* Check for screen-specified formats */ + for (i = 0; i < pScrn->numFormats; i++) + if (pScrn->formats[i].depth == depth) + break; + if (i != pScrn->numFormats) + return &pScrn->formats[i]; + } + return NULL; +} + +int +xf86GetBppFromDepth(ScrnInfoPtr pScrn, int depth) +{ + PixmapFormatPtr format; + + + format = xf86GetPixFormat(pScrn, depth); + if (format) + return format->bitsPerPixel; + else + return 0; +} diff --git a/xorg-server/hw/xfree86/common/xf86PM.c b/xorg-server/hw/xfree86/common/xf86PM.c index 7af89b5b4..16b6bdc4a 100644 --- a/xorg-server/hw/xfree86/common/xf86PM.c +++ b/xorg-server/hw/xfree86/common/xf86PM.c @@ -33,6 +33,7 @@ #include "xf86.h" #include "xf86Priv.h" #include "xf86Xinput.h" +#include "xf86_OSproc.h" int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num) = NULL; pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event) = NULL; @@ -61,14 +62,14 @@ eventName(pmEvent event, char **str) } } +static int sigio_blocked_for_suspend; + static void suspend (pmEvent event, Bool undo) { int i; InputInfoPtr pInfo; - xf86inSuspend = TRUE; - for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (i, FALSE); @@ -78,7 +79,7 @@ suspend (pmEvent event, Bool undo) DisableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } - xf86EnterServerState(SETUP); + sigio_blocked_for_suspend = xf86BlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) xf86Screens[i]->PMEvent(i,event,undo); @@ -98,7 +99,6 @@ resume(pmEvent event, Bool undo) InputInfoPtr pInfo; xf86AccessEnter(); - xf86EnterServerState(SETUP); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) xf86Screens[i]->PMEvent(i,event,undo); @@ -107,7 +107,7 @@ resume(pmEvent event, Bool undo) xf86Screens[i]->EnterVT(i, 0); } } - xf86EnterServerState(OPERATING); + xf86UnblockSIGIO(sigio_blocked_for_suspend); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->EnableDisableFBAccess) (*xf86Screens[i]->EnableDisableFBAccess) (i, TRUE); @@ -118,18 +118,12 @@ resume(pmEvent event, Bool undo) EnableDevice(pInfo->dev, TRUE); pInfo = pInfo->next; } - xf86inSuspend = FALSE; } static void DoApmEvent(pmEvent event, Bool undo) { - /* - * we leave that as a global function for now. I don't know if - * this might cause problems in the future. It is a global server - * variable therefore it needs to be in a server info structure - */ - int i, setup = 0; + int i, was_blocked; switch(event) { #if 0 @@ -159,14 +153,13 @@ DoApmEvent(pmEvent event, Bool undo) } break; default: + was_blocked = xf86BlockSIGIO(); for (i = 0; i < xf86NumScreens; i++) { if (xf86Screens[i]->PMEvent) { - if (!setup) xf86EnterServerState(SETUP); - setup = 1; xf86Screens[i]->PMEvent(i,event,undo); } } - if (setup) xf86EnterServerState(OPERATING); + xf86UnblockSIGIO(was_blocked); break; } } diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h index 01e178372..7137a5363 100644 --- a/xorg-server/hw/xfree86/common/xf86Priv.h +++ b/xorg-server/hw/xfree86/common/xf86Priv.h @@ -1,158 +1,157 @@ -/*
- * Copyright (c) 1997-2002 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 declarations for private XFree86 functions and variables,
- * and definitions of private macros.
- *
- * "private" means not available to video drivers.
- */
-
-#ifndef _XF86PRIV_H
-#define _XF86PRIV_H
-
-#include "xf86Privstr.h"
-#include "propertyst.h"
-#include "input.h"
-
-/*
- * Parameters set ONLY from the command line options
- * The global state of these things is held in xf86InfoRec (when appropriate).
- */
-extern _X_EXPORT const char *xf86ConfigFile;
-extern _X_EXPORT const char *xf86ConfigDir;
-extern _X_EXPORT Bool xf86AllowMouseOpenFail;
-#ifdef XF86VIDMODE
-extern _X_EXPORT Bool xf86VidModeDisabled;
-extern _X_EXPORT Bool xf86VidModeAllowNonLocal;
-#endif
-extern _X_EXPORT Bool xf86fpFlag;
-extern _X_EXPORT Bool xf86sFlag;
-extern _X_EXPORT Bool xf86bsEnableFlag;
-extern _X_EXPORT Bool xf86bsDisableFlag;
-extern _X_EXPORT Bool xf86silkenMouseDisableFlag;
-extern _X_EXPORT Bool xf86xkbdirFlag;
-#ifdef HAVE_ACPI
-extern _X_EXPORT Bool xf86acpiDisableFlag;
-#endif
-extern _X_EXPORT char *xf86LayoutName;
-extern _X_EXPORT char *xf86ScreenName;
-extern _X_EXPORT char *xf86PointerName;
-extern _X_EXPORT char *xf86KeyboardName;
-extern _X_EXPORT int xf86FbBpp;
-extern _X_EXPORT int xf86Depth;
-extern _X_EXPORT Pix24Flags xf86Pix24;
-extern _X_EXPORT rgb xf86Weight;
-extern _X_EXPORT Bool xf86FlipPixels;
-extern _X_EXPORT Gamma xf86Gamma;
-extern _X_EXPORT char *xf86ServerName;
-
-/* Other parameters */
-
-extern _X_EXPORT xf86InfoRec xf86Info;
-extern _X_EXPORT const char *xf86ModulePath;
-extern _X_EXPORT MessageType xf86ModPathFrom;
-extern _X_EXPORT const char *xf86LogFile;
-extern _X_EXPORT MessageType xf86LogFileFrom;
-extern _X_EXPORT Bool xf86LogFileWasOpened;
-extern _X_EXPORT serverLayoutRec xf86ConfigLayout;
-
-extern _X_EXPORT DriverPtr *xf86DriverList;
-extern _X_EXPORT int xf86NumDrivers;
-extern _X_EXPORT Bool xf86Resetting;
-extern _X_EXPORT Bool xf86Initialising;
-extern _X_EXPORT int xf86NumScreens;
-extern _X_EXPORT const char *xf86VisualNames[];
-extern _X_EXPORT int xf86Verbose; /* verbosity level */
-extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */
-extern _X_EXPORT Bool xorgHWAccess;
-
-extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable;
-
-#ifndef DEFAULT_VERBOSE
-#define DEFAULT_VERBOSE 0
-#endif
-#ifndef DEFAULT_LOG_VERBOSE
-#define DEFAULT_LOG_VERBOSE 3
-#endif
-#ifndef DEFAULT_DPI
-#define DEFAULT_DPI 96
-#endif
-
-/* Function Prototypes */
-#ifndef _NO_XF86_PROTOTYPES
-
-/* xf86Bus.c */
-extern _X_EXPORT Bool xf86BusConfig(void);
-extern _X_EXPORT void xf86BusProbe(void);
-extern _X_EXPORT void xf86AccessEnter(void);
-extern _X_EXPORT void xf86AccessLeave(void);
-extern _X_EXPORT void xf86PostProbe(void);
-extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex);
-extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev);
-extern _X_EXPORT void xf86PostScreenInit(void);
-
-/* xf86Config.c */
-
-extern _X_EXPORT Bool xf86PathIsSafe(const char *path);
-
-/* xf86DefaultModes */
-
-extern _X_EXPORT const DisplayModeRec xf86DefaultModes[];
-extern _X_EXPORT const int xf86NumDefaultModes;
-
-/* xf86Configure.c */
-extern _X_EXPORT void DoConfigure(void);
-
-/* xf86ShowOpts.c */
-extern _X_EXPORT void DoShowOptions(void);
-
-/* xf86Events.c */
-
-extern _X_EXPORT void xf86Wakeup(pointer blockData, int err, pointer pReadmask);
-extern _X_HIDDEN int xf86SigWrapper(int signo);
-extern _X_EXPORT void xf86HandlePMEvents(int fd, pointer data);
-extern _X_EXPORT int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num);
-extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event);
-
-/* xf86Helper.c */
-extern _X_EXPORT void xf86LogInit(void);
-extern _X_EXPORT void xf86CloseLog(void);
-
-/* xf86Init.c */
-extern _X_EXPORT Bool xf86LoadModules(char **list, pointer *optlist);
-extern _X_EXPORT int xf86SetVerbosity(int verb);
-extern _X_EXPORT int xf86SetLogVerbosity(int verb);
-extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only );
-
-/* xf86Xinput.c */
-extern _X_EXPORT EventList *xf86Events;
-
-#endif /* _NO_XF86_PROTOTYPES */
-
-
-#endif /* _XF86PRIV_H */
+/* + * Copyright (c) 1997-2002 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 declarations for private XFree86 functions and variables, + * and definitions of private macros. + * + * "private" means not available to video drivers. + */ + +#ifndef _XF86PRIV_H +#define _XF86PRIV_H + +#include "xf86Privstr.h" +#include "propertyst.h" +#include "input.h" + +/* + * Parameters set ONLY from the command line options + * The global state of these things is held in xf86InfoRec (when appropriate). + */ +extern _X_EXPORT const char *xf86ConfigFile; +extern _X_EXPORT const char *xf86ConfigDir; +extern _X_EXPORT Bool xf86AllowMouseOpenFail; +#ifdef XF86VIDMODE +extern _X_EXPORT Bool xf86VidModeDisabled; +extern _X_EXPORT Bool xf86VidModeAllowNonLocal; +#endif +extern _X_EXPORT Bool xf86fpFlag; +extern _X_EXPORT Bool xf86sFlag; +extern _X_EXPORT Bool xf86bsEnableFlag; +extern _X_EXPORT Bool xf86bsDisableFlag; +extern _X_EXPORT Bool xf86silkenMouseDisableFlag; +extern _X_EXPORT Bool xf86xkbdirFlag; +#ifdef HAVE_ACPI +extern _X_EXPORT Bool xf86acpiDisableFlag; +#endif +extern _X_EXPORT char *xf86LayoutName; +extern _X_EXPORT char *xf86ScreenName; +extern _X_EXPORT char *xf86PointerName; +extern _X_EXPORT char *xf86KeyboardName; +extern _X_EXPORT int xf86FbBpp; +extern _X_EXPORT int xf86Depth; +extern _X_EXPORT Pix24Flags xf86Pix24; +extern _X_EXPORT rgb xf86Weight; +extern _X_EXPORT Bool xf86FlipPixels; +extern _X_EXPORT Gamma xf86Gamma; +extern _X_EXPORT char *xf86ServerName; + +/* Other parameters */ + +extern _X_EXPORT xf86InfoRec xf86Info; +extern _X_EXPORT const char *xf86ModulePath; +extern _X_EXPORT MessageType xf86ModPathFrom; +extern _X_EXPORT const char *xf86LogFile; +extern _X_EXPORT MessageType xf86LogFileFrom; +extern _X_EXPORT Bool xf86LogFileWasOpened; +extern _X_EXPORT serverLayoutRec xf86ConfigLayout; + +extern _X_EXPORT DriverPtr *xf86DriverList; +extern _X_EXPORT int xf86NumDrivers; +extern _X_EXPORT Bool xf86Resetting; +extern _X_EXPORT Bool xf86Initialising; +extern _X_EXPORT int xf86NumScreens; +extern _X_EXPORT const char *xf86VisualNames[]; +extern _X_EXPORT int xf86Verbose; /* verbosity level */ +extern _X_EXPORT int xf86LogVerbose; /* log file verbosity level */ +extern _X_EXPORT Bool xorgHWAccess; + +extern _X_EXPORT RootWinPropPtr *xf86RegisteredPropertiesTable; + +#ifndef DEFAULT_VERBOSE +#define DEFAULT_VERBOSE 0 +#endif +#ifndef DEFAULT_LOG_VERBOSE +#define DEFAULT_LOG_VERBOSE 3 +#endif +#ifndef DEFAULT_DPI +#define DEFAULT_DPI 96 +#endif + +/* Function Prototypes */ +#ifndef _NO_XF86_PROTOTYPES + +/* xf86Bus.c */ +extern _X_EXPORT Bool xf86BusConfig(void); +extern _X_EXPORT void xf86BusProbe(void); +extern _X_EXPORT void xf86AccessEnter(void); +extern _X_EXPORT void xf86AccessLeave(void); +extern _X_EXPORT void xf86PostProbe(void); +extern _X_EXPORT void xf86ClearEntityListForScreen(int scrnIndex); +extern _X_EXPORT void xf86AddDevToEntity(int entityIndex, GDevPtr dev); + +/* xf86Config.c */ + +extern _X_EXPORT Bool xf86PathIsSafe(const char *path); + +/* xf86DefaultModes */ + +extern _X_EXPORT const DisplayModeRec xf86DefaultModes[]; +extern _X_EXPORT const int xf86NumDefaultModes; + +/* xf86Configure.c */ +extern _X_EXPORT void DoConfigure(void); + +/* xf86ShowOpts.c */ +extern _X_EXPORT void DoShowOptions(void); + +/* xf86Events.c */ + +extern _X_EXPORT void xf86Wakeup(pointer blockData, int err, pointer pReadmask); +extern _X_HIDDEN int xf86SigWrapper(int signo); +extern _X_EXPORT void xf86HandlePMEvents(int fd, pointer data); +extern _X_EXPORT int (*xf86PMGetEventFromOs)(int fd,pmEvent *events,int num); +extern _X_EXPORT pmWait (*xf86PMConfirmEventToOs)(int fd,pmEvent event); + +/* xf86Helper.c */ +extern _X_EXPORT void xf86LogInit(void); +extern _X_EXPORT void xf86CloseLog(void); + +/* xf86Init.c */ +extern _X_EXPORT Bool xf86LoadModules(char **list, pointer *optlist); +extern _X_EXPORT int xf86SetVerbosity(int verb); +extern _X_EXPORT int xf86SetLogVerbosity(int verb); +extern _X_EXPORT Bool xf86CallDriverProbe( struct _DriverRec * drv, Bool detect_only ); + +/* xf86Xinput.c */ +extern _X_EXPORT EventList *xf86Events; + +#endif /* _NO_XF86_PROTOTYPES */ + + +#endif /* _XF86PRIV_H */ diff --git a/xorg-server/hw/xfree86/common/xf86str.h b/xorg-server/hw/xfree86/common/xf86str.h index 74ad759c5..0493dc53c 100644 --- a/xorg-server/hw/xfree86/common/xf86str.h +++ b/xorg-server/hw/xfree86/common/xf86str.h @@ -1,913 +1,906 @@ -
-/*
- * 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 definitions of the public XFree86 data structures/types.
- * Any data structures that video drivers need to access should go here.
- */
-
-#ifndef _XF86STR_H
-#define _XF86STR_H
-
-#include "misc.h"
-#include "input.h"
-#include "scrnintstr.h"
-#include "pixmapstr.h"
-#include "colormapst.h"
-#include "xf86Module.h"
-#include "xf86Opt.h"
-#include "xf86Pci.h"
-
-#include <pciaccess.h>
-
-/**
- * Integer type that is of the size of the addressable memory (machine size).
- * On most platforms \c uintptr_t will suffice. However, on some mixed
- * 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this
- * must be 64-bits.
- */
-#include <inttypes.h>
-#if defined(__powerpc__)
-typedef uint64_t memType;
-#else
-typedef uintptr_t memType;
-#endif
-
-
-/* Video mode flags */
-
-typedef enum {
- V_PHSYNC = 0x0001,
- V_NHSYNC = 0x0002,
- V_PVSYNC = 0x0004,
- V_NVSYNC = 0x0008,
- V_INTERLACE = 0x0010,
- V_DBLSCAN = 0x0020,
- V_CSYNC = 0x0040,
- V_PCSYNC = 0x0080,
- V_NCSYNC = 0x0100,
- V_HSKEW = 0x0200, /* hskew provided */
- V_BCAST = 0x0400,
- V_PIXMUX = 0x1000,
- V_DBLCLK = 0x2000,
- V_CLKDIV2 = 0x4000
-} ModeFlags;
-
-typedef enum {
- INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */
-} CrtcAdjustFlags;
-
-/* Flags passed to ChipValidMode() */
-typedef enum {
- MODECHECK_INITIAL = 0,
- MODECHECK_FINAL = 1
-} ModeCheckFlags;
-
-/* These are possible return values for xf86CheckMode() and ValidMode() */
-typedef enum {
- MODE_OK = 0, /* Mode OK */
- MODE_HSYNC, /* hsync out of range */
- MODE_VSYNC, /* vsync out of range */
- MODE_H_ILLEGAL, /* mode has illegal horizontal timings */
- MODE_V_ILLEGAL, /* mode has illegal horizontal timings */
- MODE_BAD_WIDTH, /* requires an unsupported linepitch */
- MODE_NOMODE, /* no mode with a maching name */
- MODE_NO_INTERLACE, /* interlaced mode not supported */
- MODE_NO_DBLESCAN, /* doublescan mode not supported */
- MODE_NO_VSCAN, /* multiscan mode not supported */
- MODE_MEM, /* insufficient video memory */
- MODE_VIRTUAL_X, /* mode width too large for specified virtual size */
- MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */
- MODE_MEM_VIRT, /* insufficient video memory given virtual size */
- MODE_NOCLOCK, /* no fixed clock available */
- MODE_CLOCK_HIGH, /* clock required is too high */
- MODE_CLOCK_LOW, /* clock required is too low */
- MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */
- MODE_BAD_HVALUE, /* horizontal timing was out of range */
- MODE_BAD_VVALUE, /* vertical timing was out of range */
- MODE_BAD_VSCAN, /* VScan value out of range */
- MODE_HSYNC_NARROW, /* horizontal sync too narrow */
- MODE_HSYNC_WIDE, /* horizontal sync too wide */
- MODE_HBLANK_NARROW, /* horizontal blanking too narrow */
- MODE_HBLANK_WIDE, /* horizontal blanking too wide */
- MODE_VSYNC_NARROW, /* vertical sync too narrow */
- MODE_VSYNC_WIDE, /* vertical sync too wide */
- MODE_VBLANK_NARROW, /* vertical blanking too narrow */
- MODE_VBLANK_WIDE, /* vertical blanking too wide */
- MODE_PANEL, /* exceeds panel dimensions */
- MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */
- MODE_ONE_WIDTH, /* only one width is supported */
- MODE_ONE_HEIGHT, /* only one height is supported */
- MODE_ONE_SIZE, /* only one resolution is supported */
- MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */
- MODE_BANDWIDTH, /* mode requires too much memory bandwidth */
- MODE_BAD = -2, /* unspecified reason */
- MODE_ERROR = -1 /* error condition */
-} ModeStatus;
-
-/*
- * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN.
- * Preferred will bubble a mode to the top within a set.
- */
-# define M_T_BUILTIN 0x01 /* built-in mode */
-# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */
-# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */
-# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C)
- /* built-in mode - configure CRTC and clock */
-# define M_T_PREFERRED 0x08 /* preferred mode within a set */
-# define M_T_DEFAULT 0x10 /* (VESA) default modes */
-# define M_T_USERDEF 0x20 /* One of the modes from the config file */
-# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */
-# define M_T_USERPREF 0x80 /* mode preferred by the user config */
-
-/* Video mode */
-typedef struct _DisplayModeRec {
- struct _DisplayModeRec * prev;
- struct _DisplayModeRec * next;
- char * name; /* identifier for the mode */
- ModeStatus status;
- int type;
-
- /* These are the values that the user sees/provides */
- int Clock; /* pixel clock freq (kHz) */
- int HDisplay; /* horizontal timing */
- int HSyncStart;
- int HSyncEnd;
- int HTotal;
- int HSkew;
- int VDisplay; /* vertical timing */
- int VSyncStart;
- int VSyncEnd;
- int VTotal;
- int VScan;
- int Flags;
-
- /* These are the values the hardware uses */
- int ClockIndex;
- int SynthClock; /* Actual clock freq to
- * be programmed (kHz) */
- int CrtcHDisplay;
- int CrtcHBlankStart;
- int CrtcHSyncStart;
- int CrtcHSyncEnd;
- int CrtcHBlankEnd;
- int CrtcHTotal;
- int CrtcHSkew;
- int CrtcVDisplay;
- int CrtcVBlankStart;
- int CrtcVSyncStart;
- int CrtcVSyncEnd;
- int CrtcVBlankEnd;
- int CrtcVTotal;
- Bool CrtcHAdjusted;
- Bool CrtcVAdjusted;
- int PrivSize;
- INT32 * Private;
- int PrivFlags;
-
- float HSync, VRefresh;
-} DisplayModeRec, *DisplayModePtr;
-
-/* The monitor description */
-
-#define MAX_HSYNC 8
-#define MAX_VREFRESH 8
-
-typedef struct { float hi, lo; } range;
-
-typedef struct { CARD32 red, green, blue; } rgb;
-
-typedef struct { float red, green, blue; } Gamma;
-
-/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */
-#define GAMMA_MAX 10.0
-#define GAMMA_MIN (1.0 / GAMMA_MAX)
-#define GAMMA_ZERO (GAMMA_MIN / 100.0)
-
-typedef struct {
- char * id;
- char * vendor;
- char * model;
- int nHsync;
- range hsync[MAX_HSYNC];
- int nVrefresh;
- range vrefresh[MAX_VREFRESH];
- DisplayModePtr Modes; /* Start of the monitor's mode list */
- DisplayModePtr Last; /* End of the monitor's mode list */
- Gamma gamma; /* Gamma of the monitor */
- int widthmm;
- int heightmm;
- pointer options;
- pointer DDC;
- Bool reducedblanking; /* Allow CVT reduced blanking modes? */
- int maxPixClock; /* in kHz, like mode->Clock */
-} MonRec, *MonPtr;
-
-/* the list of clock ranges */
-typedef struct x_ClockRange {
- struct x_ClockRange *next;
- int minClock; /* (kHz) */
- int maxClock; /* (kHz) */
- int clockIndex; /* -1 for programmable clocks */
- Bool interlaceAllowed;
- Bool doubleScanAllowed;
- int ClockMulFactor;
- int ClockDivFactor;
- int PrivFlags;
-} ClockRange, *ClockRangePtr;
-
-/*
- * The driverFunc. xorgDriverFuncOp specifies the action driver should
- * perform. If requested option is not supported function should return
- * FALSE. pointer can be used to pass arguments to the function or
- * to return data to the caller.
- */
-typedef struct _ScrnInfoRec *ScrnInfoPtr;
-
-/* do not change order */
-typedef enum {
- RR_GET_INFO,
- RR_SET_CONFIG,
- RR_GET_MODE_MM,
- GET_REQUIRED_HW_INTERFACES = 10
-} xorgDriverFuncOp;
-
-typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp,
- pointer);
-
-/* RR_GET_INFO, RR_SET_CONFIG */
-typedef struct {
- int rotation;
- int rate;
- int width;
- int height;
-} xorgRRConfig;
-
-typedef union {
- short RRRotations;
- xorgRRConfig RRConfig;
-} xorgRRRotation, *xorgRRRotationPtr;
-
-/* RR_GET_MODE_MM */
-typedef struct {
- DisplayModePtr mode;
- int virtX;
- int virtY;
- int mmWidth;
- int mmHeight;
-} xorgRRModeMM, *xorgRRModeMMPtr;
-
-/* GET_REQUIRED_HW_INTERFACES */
-#define HW_IO 1
-#define HW_MMIO 2
-#define HW_SKIP_CONSOLE 4
-#define NEED_IO_ENABLED(x) (x & HW_IO)
-
-typedef CARD32 xorgHWFlags;
-
-/*
- * The driver list struct. This contains the information required for each
- * driver before a ScrnInfoRec has been allocated.
- */
-struct _DriverRec;
-
-typedef struct {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- Bool (*Probe)(struct _DriverRec *drv, int flags);
- const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
- pointer module;
- int refCount;
-} DriverRec1;
-
-struct _SymTabRec;
-struct _PciChipsets;
-
-typedef struct _DriverRec {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- Bool (*Probe)(struct _DriverRec *drv, int flags);
- const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype);
- pointer module;
- int refCount;
- xorgDriverFuncProc *driverFunc;
-
- const struct pci_id_match * supported_devices;
- Bool (*PciProbe)( struct _DriverRec * drv, int entity_num,
- struct pci_device * dev, intptr_t match_data );
-} DriverRec, *DriverPtr;
-
-/*
- * AddDriver flags
- */
-#define HaveDriverFuncs 1
-
-/*
- * These are the private bus types. New types can be added here. Types
- * required for the public interface should be added to xf86str.h, with
- * function prototypes added to xf86.h.
- */
-
-/* Tolerate prior #include <linux/input.h> */
-#if defined(linux) && defined(_INPUT_H)
-#undef BUS_NONE
-#undef BUS_PCI
-#undef BUS_SBUS
-#undef BUS_last
-#endif
-
-typedef enum {
- BUS_NONE,
- BUS_PCI,
- BUS_SBUS,
- BUS_last /* Keep last */
-} BusType;
-
-struct pci_device;
-
-typedef struct {
- int fbNum;
-} SbusBusId;
-
-typedef struct _bus {
- BusType type;
- union {
- struct pci_device *pci;
- SbusBusId sbus;
- } id;
-} BusRec, *BusPtr;
-
-#define MAXCLOCKS 128
-typedef enum {
- DAC_BPP8 = 0,
- DAC_BPP16,
- DAC_BPP24,
- DAC_BPP32,
- MAXDACSPEEDS
-} DacSpeedIndex;
-
-typedef struct {
- char * identifier;
- char * vendor;
- char * board;
- char * chipset;
- char * ramdac;
- char * driver;
- struct _confscreenrec * myScreenSection;
- Bool claimed;
- int dacSpeeds[MAXDACSPEEDS];
- int numclocks;
- int clock[MAXCLOCKS];
- char * clockchip;
- char * busID;
- Bool active;
- Bool inUse;
- int videoRam;
- int textClockFreq;
- unsigned long BiosBase; /* Base address of video BIOS */
- unsigned long MemBase; /* Frame buffer base address */
- unsigned long IOBase;
- int chipID;
- int chipRev;
- pointer options;
- int irq;
- int screen; /* For multi-CRTC cards */
-} GDevRec, *GDevPtr;
-
-typedef struct {
- int frameX0;
- int frameY0;
- int virtualX;
- int virtualY;
- int depth;
- int fbbpp;
- rgb weight;
- rgb blackColour;
- rgb whiteColour;
- int defaultVisual;
- char ** modes;
- pointer options;
-} DispRec, *DispPtr;
-
-typedef struct _confxvportrec {
- char * identifier;
- pointer options;
-} confXvPortRec, *confXvPortPtr;
-
-typedef struct _confxvadaptrec {
- char * identifier;
- int numports;
- confXvPortPtr ports;
- pointer options;
-} confXvAdaptorRec, *confXvAdaptorPtr;
-
-typedef struct _confscreenrec {
- char * id;
- int screennum;
- int defaultdepth;
- int defaultbpp;
- int defaultfbbpp;
- MonPtr monitor;
- GDevPtr device;
- int numdisplays;
- DispPtr displays;
- int numxvadaptors;
- confXvAdaptorPtr xvadaptors;
- pointer options;
-} confScreenRec, *confScreenPtr;
-
-typedef enum {
- PosObsolete = -1,
- PosAbsolute = 0,
- PosRightOf,
- PosLeftOf,
- PosAbove,
- PosBelow,
- PosRelative
-} PositionType;
-
-typedef struct _screenlayoutrec {
- confScreenPtr screen;
- char * topname;
- confScreenPtr top;
- char * bottomname;
- confScreenPtr bottom;
- char * leftname;
- confScreenPtr left;
- char * rightname;
- confScreenPtr right;
- PositionType where;
- int x;
- int y;
- char * refname;
- confScreenPtr refscreen;
-} screenLayoutRec, *screenLayoutPtr;
-
-typedef struct _InputInfoRec InputInfoRec;
-
-typedef struct _serverlayoutrec {
- char * id;
- screenLayoutPtr screens;
- GDevPtr inactives;
- InputInfoRec** inputs; /* NULL terminated */
- pointer options;
-} serverLayoutRec, *serverLayoutPtr;
-
-typedef struct _confdribufferrec {
- int count;
- int size;
- enum {
- XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */
- } flags;
-} confDRIBufferRec, *confDRIBufferPtr;
-
-typedef struct _confdrirec {
- int group;
- int mode;
- int bufs_count;
- confDRIBufferRec *bufs;
-} confDRIRec, *confDRIPtr;
-
-/* These values should be adjusted when new fields are added to ScrnInfoRec */
-#define NUM_RESERVED_INTS 16
-#define NUM_RESERVED_POINTERS 14
-#define NUM_RESERVED_FUNCS 10
-
-typedef pointer (*funcPointer)(void);
-
-/* flags for depth 24 pixmap options */
-typedef enum {
- Pix24DontCare = 0,
- Pix24Use24,
- Pix24Use32
-} Pix24Flags;
-
-/* Power management events: so far we only support APM */
-
-typedef enum {
- XF86_APM_UNKNOWN = -1,
- XF86_APM_SYS_STANDBY,
- XF86_APM_SYS_SUSPEND,
- XF86_APM_CRITICAL_SUSPEND,
- XF86_APM_USER_STANDBY,
- XF86_APM_USER_SUSPEND,
- XF86_APM_STANDBY_RESUME,
- XF86_APM_NORMAL_RESUME,
- XF86_APM_CRITICAL_RESUME,
- XF86_APM_LOW_BATTERY,
- XF86_APM_POWER_STATUS_CHANGE,
- XF86_APM_UPDATE_TIME,
- XF86_APM_CAPABILITY_CHANGED,
- XF86_APM_STANDBY_FAILED,
- XF86_APM_SUSPEND_FAILED
-} pmEvent;
-
-typedef enum {
- PM_WAIT,
- PM_CONTINUE,
- PM_FAILED,
- PM_NONE
-} pmWait;
-
-typedef struct _PciChipsets {
- /**
- * Key used to match this device with its name in an array of
- * \c SymTabRec.
- */
- int numChipset;
-
- /**
- * This value is quirky. Depending on the driver, it can take on one of
- * three meanings. In drivers that have exactly one vendor ID (e.g.,
- * radeon, mga, i810) the low 16-bits are the device ID.
- *
- * In drivers that can have multiple vendor IDs (e.g., the glint driver
- * can have either 3dlabs' ID or TI's ID, the i740 driver can have either
- * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and
- * the high 16-bits are the vendor ID.
- *
- * In drivers that don't have a specific vendor (e.g., vga) contains the
- * device ID for either the generic VGA or generic 8514 devices. This
- * turns out to be the same as the subclass and programming interface
- * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or
- * 0x000101) and for 8514 is 0x030001).
- */
- int PCIid;
-
-/* dummy place holders for drivers to build against old/new servers */
-#define RES_UNDEFINED NULL
-#define RES_EXCLUSIVE_VGA NULL
-#define RES_SHARED_VGA NULL
- void *dummy;
-} PciChipsets;
-
-
-/* Entity properties */
-typedef void (*EntityProc)(int entityIndex,pointer private);
-
-typedef struct _entityInfo {
- int index;
- BusRec location;
- int chipset;
- Bool active;
- GDevPtr device;
- DriverPtr driver;
-} EntityInfoRec, *EntityInfoPtr;
-
-/* server states */
-
-typedef enum {
- SETUP,
- OPERATING
-} xf86State;
-
-/* DGA */
-
-typedef struct {
- int num; /* A unique identifier for the mode (num > 0) */
- DisplayModePtr mode;
- int flags; /* DGA_CONCURRENT_ACCESS, etc... */
- int imageWidth; /* linear accessible portion (pixels) */
- int imageHeight;
- int pixmapWidth; /* Xlib accessible portion (pixels) */
- int pixmapHeight; /* both fields ignored if no concurrent access */
- int bytesPerScanline;
- int byteOrder; /* MSBFirst, LSBFirst */
- int depth;
- int bitsPerPixel;
- unsigned long red_mask;
- unsigned long green_mask;
- unsigned long blue_mask;
- short visualClass;
- int viewportWidth;
- int viewportHeight;
- int xViewportStep; /* viewport position granularity */
- int yViewportStep;
- int maxViewportX; /* max viewport origin */
- int maxViewportY;
- int viewportFlags; /* types of page flipping possible */
- int offset; /* offset into physical memory */
- unsigned char *address; /* server's mapped framebuffer */
- int reserved1;
- int reserved2;
-} DGAModeRec, *DGAModePtr;
-
-typedef struct {
- DGAModePtr mode;
- PixmapPtr pPix;
-} DGADeviceRec, *DGADevicePtr;
-
-/*
- * Flags for driver Probe() functions.
- */
-#define PROBE_DEFAULT 0x00
-#define PROBE_DETECT 0x01
-#define PROBE_TRYHARD 0x02
-
-/*
- * Driver entry point types
- */
-
-typedef Bool xf86ProbeProc (DriverPtr, int);
-typedef Bool xf86PreInitProc (ScrnInfoPtr, int);
-typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**);
-typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int);
-typedef void xf86AdjustFrameProc (int, int, int, int);
-typedef Bool xf86EnterVTProc (int, int);
-typedef void xf86LeaveVTProc (int, int);
-typedef void xf86FreeScreenProc (int, int);
-typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int);
-typedef void xf86EnableDisableFBAccessProc(int, Bool);
-typedef int xf86SetDGAModeProc (int, int, DGADevicePtr);
-typedef int xf86ChangeGammaProc (int, Gamma);
-typedef void xf86PointerMovedProc (int, int, int);
-typedef Bool xf86PMEventProc (int, pmEvent, Bool);
-typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int);
-typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr);
-typedef void xf86SetOverscanProc (ScrnInfoPtr, int);
-typedef void xf86ModeSetProc (ScrnInfoPtr);
-
-
-/*
- * ScrnInfoRec
- *
- * There is one of these for each screen, and it holds all the screen-specific
- * information.
- *
- * Note: the size and layout must be kept the same across versions. New
- * fields are to be added in place of the "reserved*" fields. No fields
- * are to be dependent on compile-time defines.
- */
-
-
-typedef struct _ScrnInfoRec {
- int driverVersion;
- char * driverName; /* canonical name used in */
- /* the config file */
- ScreenPtr pScreen; /* Pointer to the ScreenRec */
- int scrnIndex; /* Number of this screen */
- Bool configured; /* Is this screen valid */
- int origIndex; /* initial number assigned to
- * this screen before
- * finalising the number of
- * available screens */
-
- /* Display-wide screenInfo values needed by this screen */
- int imageByteOrder;
- int bitmapScanlineUnit;
- int bitmapScanlinePad;
- int bitmapBitOrder;
- int numFormats;
- PixmapFormatRec formats[MAXFORMATS];
- PixmapFormatRec fbFormat;
-
- int bitsPerPixel; /* fb bpp */
- Pix24Flags pixmap24; /* pixmap pref for depth 24 */
- int depth; /* depth of default visual */
- MessageType depthFrom; /* set from config? */
- MessageType bitsPerPixelFrom; /* set from config? */
- rgb weight; /* r/g/b weights */
- rgb mask; /* rgb masks */
- rgb offset; /* rgb offsets */
- int rgbBits; /* Number of bits in r/g/b */
- Gamma gamma; /* Gamma of the monitor */
- int defaultVisual; /* default visual class */
- int maxHValue; /* max horizontal timing */
- int maxVValue; /* max vertical timing value */
- int virtualX; /* Virtual width */
- int virtualY; /* Virtual height */
- int xInc; /* Horizontal timing increment */
- MessageType virtualFrom; /* set from config? */
- int displayWidth; /* memory pitch */
- int frameX0; /* viewport position */
- int frameY0;
- int frameX1;
- int frameY1;
- int zoomLocked; /* Disallow mode changes */
- DisplayModePtr modePool; /* list of compatible modes */
- DisplayModePtr modes; /* list of actual modes */
- DisplayModePtr currentMode; /* current mode
- * This was previously
- * overloaded with the modes
- * field, which is a pointer
- * into a circular list */
- confScreenPtr confScreen; /* Screen config info */
- MonPtr monitor; /* Monitor information */
- DispPtr display; /* Display information */
- int * entityList; /* List of device entities */
- int numEntities;
- int widthmm; /* physical display dimensions
- * in mm */
- int heightmm;
- int xDpi; /* width DPI */
- int yDpi; /* height DPI */
- char * name; /* Name to prefix messages */
- pointer driverPrivate; /* Driver private area */
- DevUnion * privates; /* Other privates can hook in
- * here */
- DriverPtr drv; /* xf86DriverList[] entry */
- pointer module; /* Pointer to module head */
- int colorKey;
- int overlayFlags;
-
- /* Some of these may be moved out of here into the driver private area */
-
- char * chipset; /* chipset name */
- char * ramdac; /* ramdac name */
- char * clockchip; /* clock name */
- Bool progClock; /* clock is programmable */
- int numClocks; /* number of clocks */
- int clock[MAXCLOCKS]; /* list of clock frequencies */
- int videoRam; /* amount of video ram (kb) */
- unsigned long biosBase; /* Base address of video BIOS */
- unsigned long memPhysBase; /* Physical address of FB */
- unsigned long fbOffset; /* Offset of FB in the above */
- IOADDRESS domainIOBase; /* Domain I/O base address */
- int memClk; /* memory clock */
- int textClockFreq; /* clock of text mode */
- Bool flipPixels; /* swap default black/white */
- pointer options;
-
- int chipID;
- int chipRev;
-
- /* Allow screens to be enabled/disabled individually */
- Bool vtSema;
-
- /* hw cursor moves at SIGIO time */
- Bool silkenMouse;
-
- /* Storage for clockRanges and adjustFlags for use with the VidMode ext */
- ClockRangePtr clockRanges;
- int adjustFlags;
-
- /*
- * These can be used when the minor ABI version is incremented.
- * The NUM_* parameters must be reduced appropriately to keep the
- * structure size and alignment unchanged.
- */
- int reservedInt[NUM_RESERVED_INTS];
-
- int * entityInstanceList;
- struct pci_device *vgaDev;
-
- pointer reservedPtr[NUM_RESERVED_POINTERS];
-
- /*
- * Driver entry points.
- *
- */
-
- xf86ProbeProc *Probe;
- xf86PreInitProc *PreInit;
- xf86ScreenInitProc *ScreenInit;
- xf86SwitchModeProc *SwitchMode;
- xf86AdjustFrameProc *AdjustFrame;
- xf86EnterVTProc *EnterVT;
- xf86LeaveVTProc *LeaveVT;
- xf86FreeScreenProc *FreeScreen;
- xf86ValidModeProc *ValidMode;
- xf86EnableDisableFBAccessProc *EnableDisableFBAccess;
- xf86SetDGAModeProc *SetDGAMode;
- xf86ChangeGammaProc *ChangeGamma;
- xf86PointerMovedProc *PointerMoved;
- xf86PMEventProc *PMEvent;
- xf86DPMSSetProc *DPMSSet;
- xf86LoadPaletteProc *LoadPalette;
- xf86SetOverscanProc *SetOverscan;
- xorgDriverFuncProc *DriverFunc;
- xf86ModeSetProc *ModeSet;
-
- /*
- * This can be used when the minor ABI version is incremented.
- * The NUM_* parameter must be reduced appropriately to keep the
- * structure size and alignment unchanged.
- */
- funcPointer reservedFuncs[NUM_RESERVED_FUNCS];
-
-} ScrnInfoRec;
-
-
-typedef struct {
- Bool (*OpenFramebuffer)(
- ScrnInfoPtr pScrn,
- char **name,
- unsigned char **mem,
- int *size,
- int *offset,
- int *extra
- );
- void (*CloseFramebuffer)(ScrnInfoPtr pScrn);
- Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode);
- void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags);
- int (*GetViewport)(ScrnInfoPtr pScrn);
- void (*Sync)(ScrnInfoPtr);
- void (*FillRect)(
- ScrnInfoPtr pScrn,
- int x, int y, int w, int h,
- unsigned long color
- );
- void (*BlitRect)(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty
- );
- void (*BlitTransRect)(
- ScrnInfoPtr pScrn,
- int srcx, int srcy,
- int w, int h,
- int dstx, int dsty,
- unsigned long color
- );
-} DGAFunctionRec, *DGAFunctionPtr;
-
-typedef struct _SymTabRec {
- int token; /* id of the token */
- const char * name; /* token name */
-} SymTabRec, *SymTabPtr;
-
-/* flags for xf86LookupMode */
-typedef enum {
- LOOKUP_DEFAULT = 0, /* Use default mode lookup method */
- LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */
- LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */
- LOOKUP_LIST_ORDER, /* Pick first useful mode in list */
- LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */
- LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */
-} LookupModeFlags;
-
-#define NoDepth24Support 0x00
-#define Support24bppFb 0x01 /* 24bpp framebuffer supported */
-#define Support32bppFb 0x02 /* 32bpp framebuffer supported */
-#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */
-#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */
-#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */
-#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */
-
-
-/* For DPMS */
-typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int);
-
-/* Input handler proc */
-typedef void (*InputHandlerProc)(int fd, pointer data);
-
-/* These are used by xf86GetClocks */
-#define CLK_REG_SAVE -1
-#define CLK_REG_RESTORE -2
-
-/*
- * misc constants
- */
-#define INTERLACE_REFRESH_WEIGHT 1.5
-#define SYNC_TOLERANCE 0.01 /* 1 percent */
-#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */
-
-
-#define OVERLAY_8_32_DUALFB 0x00000001
-#define OVERLAY_8_24_DUALFB 0x00000002
-#define OVERLAY_8_16_DUALFB 0x00000004
-#define OVERLAY_8_32_PLANAR 0x00000008
-
-/* Values of xf86Info.mouseFlags */
-#define MF_CLEAR_DTR 1
-#define MF_CLEAR_RTS 2
-
-/* Action Events */
-typedef enum {
- ACTION_TERMINATE = 0, /* Terminate Server */
- ACTION_NEXT_MODE = 10, /* Switch to next video mode */
- ACTION_PREV_MODE,
- ACTION_SWITCHSCREEN = 100, /* VT switch */
- ACTION_SWITCHSCREEN_NEXT,
- ACTION_SWITCHSCREEN_PREV,
-} ActionEvent;
-
-#endif /* _XF86STR_H */
+ +/* + * 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 definitions of the public XFree86 data structures/types. + * Any data structures that video drivers need to access should go here. + */ + +#ifndef _XF86STR_H +#define _XF86STR_H + +#include "misc.h" +#include "input.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "colormapst.h" +#include "xf86Module.h" +#include "xf86Opt.h" +#include "xf86Pci.h" + +#include <pciaccess.h> + +/** + * Integer type that is of the size of the addressable memory (machine size). + * On most platforms \c uintptr_t will suffice. However, on some mixed + * 32-bit / 64-bit platforms, such as 32-bit binaries on 64-bit PowerPC, this + * must be 64-bits. + */ +#include <inttypes.h> +#if defined(__powerpc__) +typedef uint64_t memType; +#else +typedef uintptr_t memType; +#endif + + +/* Video mode flags */ + +typedef enum { + V_PHSYNC = 0x0001, + V_NHSYNC = 0x0002, + V_PVSYNC = 0x0004, + V_NVSYNC = 0x0008, + V_INTERLACE = 0x0010, + V_DBLSCAN = 0x0020, + V_CSYNC = 0x0040, + V_PCSYNC = 0x0080, + V_NCSYNC = 0x0100, + V_HSKEW = 0x0200, /* hskew provided */ + V_BCAST = 0x0400, + V_PIXMUX = 0x1000, + V_DBLCLK = 0x2000, + V_CLKDIV2 = 0x4000 +} ModeFlags; + +typedef enum { + INTERLACE_HALVE_V = 0x0001 /* Halve V values for interlacing */ +} CrtcAdjustFlags; + +/* Flags passed to ChipValidMode() */ +typedef enum { + MODECHECK_INITIAL = 0, + MODECHECK_FINAL = 1 +} ModeCheckFlags; + +/* These are possible return values for xf86CheckMode() and ValidMode() */ +typedef enum { + MODE_OK = 0, /* Mode OK */ + MODE_HSYNC, /* hsync out of range */ + MODE_VSYNC, /* vsync out of range */ + MODE_H_ILLEGAL, /* mode has illegal horizontal timings */ + MODE_V_ILLEGAL, /* mode has illegal horizontal timings */ + MODE_BAD_WIDTH, /* requires an unsupported linepitch */ + MODE_NOMODE, /* no mode with a maching name */ + MODE_NO_INTERLACE, /* interlaced mode not supported */ + MODE_NO_DBLESCAN, /* doublescan mode not supported */ + MODE_NO_VSCAN, /* multiscan mode not supported */ + MODE_MEM, /* insufficient video memory */ + MODE_VIRTUAL_X, /* mode width too large for specified virtual size */ + MODE_VIRTUAL_Y, /* mode height too large for specified virtual size */ + MODE_MEM_VIRT, /* insufficient video memory given virtual size */ + MODE_NOCLOCK, /* no fixed clock available */ + MODE_CLOCK_HIGH, /* clock required is too high */ + MODE_CLOCK_LOW, /* clock required is too low */ + MODE_CLOCK_RANGE, /* clock/mode isn't in a ClockRange */ + MODE_BAD_HVALUE, /* horizontal timing was out of range */ + MODE_BAD_VVALUE, /* vertical timing was out of range */ + MODE_BAD_VSCAN, /* VScan value out of range */ + MODE_HSYNC_NARROW, /* horizontal sync too narrow */ + MODE_HSYNC_WIDE, /* horizontal sync too wide */ + MODE_HBLANK_NARROW, /* horizontal blanking too narrow */ + MODE_HBLANK_WIDE, /* horizontal blanking too wide */ + MODE_VSYNC_NARROW, /* vertical sync too narrow */ + MODE_VSYNC_WIDE, /* vertical sync too wide */ + MODE_VBLANK_NARROW, /* vertical blanking too narrow */ + MODE_VBLANK_WIDE, /* vertical blanking too wide */ + MODE_PANEL, /* exceeds panel dimensions */ + MODE_INTERLACE_WIDTH, /* width too large for interlaced mode */ + MODE_ONE_WIDTH, /* only one width is supported */ + MODE_ONE_HEIGHT, /* only one height is supported */ + MODE_ONE_SIZE, /* only one resolution is supported */ + MODE_NO_REDUCED, /* monitor doesn't accept reduced blanking */ + MODE_BANDWIDTH, /* mode requires too much memory bandwidth */ + MODE_BAD = -2, /* unspecified reason */ + MODE_ERROR = -1 /* error condition */ +} ModeStatus; + +/* + * The mode sets are, from best to worst: USERDEF, DRIVER, and DEFAULT/BUILTIN. + * Preferred will bubble a mode to the top within a set. + */ +# define M_T_BUILTIN 0x01 /* built-in mode */ +# define M_T_CLOCK_C (0x02 | M_T_BUILTIN) /* built-in mode - configure clock */ +# define M_T_CRTC_C (0x04 | M_T_BUILTIN) /* built-in mode - configure CRTC */ +# define M_T_CLOCK_CRTC_C (M_T_CLOCK_C | M_T_CRTC_C) + /* built-in mode - configure CRTC and clock */ +# define M_T_PREFERRED 0x08 /* preferred mode within a set */ +# define M_T_DEFAULT 0x10 /* (VESA) default modes */ +# define M_T_USERDEF 0x20 /* One of the modes from the config file */ +# define M_T_DRIVER 0x40 /* Supplied by the driver (EDID, etc) */ +# define M_T_USERPREF 0x80 /* mode preferred by the user config */ + +/* Video mode */ +typedef struct _DisplayModeRec { + struct _DisplayModeRec * prev; + struct _DisplayModeRec * next; + char * name; /* identifier for the mode */ + ModeStatus status; + int type; + + /* These are the values that the user sees/provides */ + int Clock; /* pixel clock freq (kHz) */ + int HDisplay; /* horizontal timing */ + int HSyncStart; + int HSyncEnd; + int HTotal; + int HSkew; + int VDisplay; /* vertical timing */ + int VSyncStart; + int VSyncEnd; + int VTotal; + int VScan; + int Flags; + + /* These are the values the hardware uses */ + int ClockIndex; + int SynthClock; /* Actual clock freq to + * be programmed (kHz) */ + int CrtcHDisplay; + int CrtcHBlankStart; + int CrtcHSyncStart; + int CrtcHSyncEnd; + int CrtcHBlankEnd; + int CrtcHTotal; + int CrtcHSkew; + int CrtcVDisplay; + int CrtcVBlankStart; + int CrtcVSyncStart; + int CrtcVSyncEnd; + int CrtcVBlankEnd; + int CrtcVTotal; + Bool CrtcHAdjusted; + Bool CrtcVAdjusted; + int PrivSize; + INT32 * Private; + int PrivFlags; + + float HSync, VRefresh; +} DisplayModeRec, *DisplayModePtr; + +/* The monitor description */ + +#define MAX_HSYNC 8 +#define MAX_VREFRESH 8 + +typedef struct { float hi, lo; } range; + +typedef struct { CARD32 red, green, blue; } rgb; + +typedef struct { float red, green, blue; } Gamma; + +/* The permitted gamma range is 1 / GAMMA_MAX <= g <= GAMMA_MAX */ +#define GAMMA_MAX 10.0 +#define GAMMA_MIN (1.0 / GAMMA_MAX) +#define GAMMA_ZERO (GAMMA_MIN / 100.0) + +typedef struct { + char * id; + char * vendor; + char * model; + int nHsync; + range hsync[MAX_HSYNC]; + int nVrefresh; + range vrefresh[MAX_VREFRESH]; + DisplayModePtr Modes; /* Start of the monitor's mode list */ + DisplayModePtr Last; /* End of the monitor's mode list */ + Gamma gamma; /* Gamma of the monitor */ + int widthmm; + int heightmm; + pointer options; + pointer DDC; + Bool reducedblanking; /* Allow CVT reduced blanking modes? */ + int maxPixClock; /* in kHz, like mode->Clock */ +} MonRec, *MonPtr; + +/* the list of clock ranges */ +typedef struct x_ClockRange { + struct x_ClockRange *next; + int minClock; /* (kHz) */ + int maxClock; /* (kHz) */ + int clockIndex; /* -1 for programmable clocks */ + Bool interlaceAllowed; + Bool doubleScanAllowed; + int ClockMulFactor; + int ClockDivFactor; + int PrivFlags; +} ClockRange, *ClockRangePtr; + +/* + * The driverFunc. xorgDriverFuncOp specifies the action driver should + * perform. If requested option is not supported function should return + * FALSE. pointer can be used to pass arguments to the function or + * to return data to the caller. + */ +typedef struct _ScrnInfoRec *ScrnInfoPtr; + +/* do not change order */ +typedef enum { + RR_GET_INFO, + RR_SET_CONFIG, + RR_GET_MODE_MM, + GET_REQUIRED_HW_INTERFACES = 10 +} xorgDriverFuncOp; + +typedef Bool xorgDriverFuncProc (ScrnInfoPtr, xorgDriverFuncOp, + pointer); + +/* RR_GET_INFO, RR_SET_CONFIG */ +typedef struct { + int rotation; + int rate; + int width; + int height; +} xorgRRConfig; + +typedef union { + short RRRotations; + xorgRRConfig RRConfig; +} xorgRRRotation, *xorgRRRotationPtr; + +/* RR_GET_MODE_MM */ +typedef struct { + DisplayModePtr mode; + int virtX; + int virtY; + int mmWidth; + int mmHeight; +} xorgRRModeMM, *xorgRRModeMMPtr; + +/* GET_REQUIRED_HW_INTERFACES */ +#define HW_IO 1 +#define HW_MMIO 2 +#define HW_SKIP_CONSOLE 4 +#define NEED_IO_ENABLED(x) (x & HW_IO) + +typedef CARD32 xorgHWFlags; + +/* + * The driver list struct. This contains the information required for each + * driver before a ScrnInfoRec has been allocated. + */ +struct _DriverRec; + +typedef struct { + int driverVersion; + char * driverName; + void (*Identify)(int flags); + Bool (*Probe)(struct _DriverRec *drv, int flags); + const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype); + pointer module; + int refCount; +} DriverRec1; + +struct _SymTabRec; +struct _PciChipsets; + +typedef struct _DriverRec { + int driverVersion; + char * driverName; + void (*Identify)(int flags); + Bool (*Probe)(struct _DriverRec *drv, int flags); + const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype); + pointer module; + int refCount; + xorgDriverFuncProc *driverFunc; + + const struct pci_id_match * supported_devices; + Bool (*PciProbe)( struct _DriverRec * drv, int entity_num, + struct pci_device * dev, intptr_t match_data ); +} DriverRec, *DriverPtr; + +/* + * AddDriver flags + */ +#define HaveDriverFuncs 1 + +/* + * These are the private bus types. New types can be added here. Types + * required for the public interface should be added to xf86str.h, with + * function prototypes added to xf86.h. + */ + +/* Tolerate prior #include <linux/input.h> */ +#if defined(linux) && defined(_INPUT_H) +#undef BUS_NONE +#undef BUS_PCI +#undef BUS_SBUS +#undef BUS_last +#endif + +typedef enum { + BUS_NONE, + BUS_PCI, + BUS_SBUS, + BUS_last /* Keep last */ +} BusType; + +struct pci_device; + +typedef struct { + int fbNum; +} SbusBusId; + +typedef struct _bus { + BusType type; + union { + struct pci_device *pci; + SbusBusId sbus; + } id; +} BusRec, *BusPtr; + +#define MAXCLOCKS 128 +typedef enum { + DAC_BPP8 = 0, + DAC_BPP16, + DAC_BPP24, + DAC_BPP32, + MAXDACSPEEDS +} DacSpeedIndex; + +typedef struct { + char * identifier; + char * vendor; + char * board; + char * chipset; + char * ramdac; + char * driver; + struct _confscreenrec * myScreenSection; + Bool claimed; + int dacSpeeds[MAXDACSPEEDS]; + int numclocks; + int clock[MAXCLOCKS]; + char * clockchip; + char * busID; + Bool active; + Bool inUse; + int videoRam; + int textClockFreq; + unsigned long BiosBase; /* Base address of video BIOS */ + unsigned long MemBase; /* Frame buffer base address */ + unsigned long IOBase; + int chipID; + int chipRev; + pointer options; + int irq; + int screen; /* For multi-CRTC cards */ +} GDevRec, *GDevPtr; + +typedef struct { + int frameX0; + int frameY0; + int virtualX; + int virtualY; + int depth; + int fbbpp; + rgb weight; + rgb blackColour; + rgb whiteColour; + int defaultVisual; + char ** modes; + pointer options; +} DispRec, *DispPtr; + +typedef struct _confxvportrec { + char * identifier; + pointer options; +} confXvPortRec, *confXvPortPtr; + +typedef struct _confxvadaptrec { + char * identifier; + int numports; + confXvPortPtr ports; + pointer options; +} confXvAdaptorRec, *confXvAdaptorPtr; + +typedef struct _confscreenrec { + char * id; + int screennum; + int defaultdepth; + int defaultbpp; + int defaultfbbpp; + MonPtr monitor; + GDevPtr device; + int numdisplays; + DispPtr displays; + int numxvadaptors; + confXvAdaptorPtr xvadaptors; + pointer options; +} confScreenRec, *confScreenPtr; + +typedef enum { + PosObsolete = -1, + PosAbsolute = 0, + PosRightOf, + PosLeftOf, + PosAbove, + PosBelow, + PosRelative +} PositionType; + +typedef struct _screenlayoutrec { + confScreenPtr screen; + char * topname; + confScreenPtr top; + char * bottomname; + confScreenPtr bottom; + char * leftname; + confScreenPtr left; + char * rightname; + confScreenPtr right; + PositionType where; + int x; + int y; + char * refname; + confScreenPtr refscreen; +} screenLayoutRec, *screenLayoutPtr; + +typedef struct _InputInfoRec InputInfoRec; + +typedef struct _serverlayoutrec { + char * id; + screenLayoutPtr screens; + GDevPtr inactives; + InputInfoRec** inputs; /* NULL terminated */ + pointer options; +} serverLayoutRec, *serverLayoutPtr; + +typedef struct _confdribufferrec { + int count; + int size; + enum { + XF86DRI_WC_HINT = 0x0001 /* Placeholder: not implemented */ + } flags; +} confDRIBufferRec, *confDRIBufferPtr; + +typedef struct _confdrirec { + int group; + int mode; + int bufs_count; + confDRIBufferRec *bufs; +} confDRIRec, *confDRIPtr; + +/* These values should be adjusted when new fields are added to ScrnInfoRec */ +#define NUM_RESERVED_INTS 16 +#define NUM_RESERVED_POINTERS 14 +#define NUM_RESERVED_FUNCS 10 + +typedef pointer (*funcPointer)(void); + +/* flags for depth 24 pixmap options */ +typedef enum { + Pix24DontCare = 0, + Pix24Use24, + Pix24Use32 +} Pix24Flags; + +/* Power management events: so far we only support APM */ + +typedef enum { + XF86_APM_UNKNOWN = -1, + XF86_APM_SYS_STANDBY, + XF86_APM_SYS_SUSPEND, + XF86_APM_CRITICAL_SUSPEND, + XF86_APM_USER_STANDBY, + XF86_APM_USER_SUSPEND, + XF86_APM_STANDBY_RESUME, + XF86_APM_NORMAL_RESUME, + XF86_APM_CRITICAL_RESUME, + XF86_APM_LOW_BATTERY, + XF86_APM_POWER_STATUS_CHANGE, + XF86_APM_UPDATE_TIME, + XF86_APM_CAPABILITY_CHANGED, + XF86_APM_STANDBY_FAILED, + XF86_APM_SUSPEND_FAILED +} pmEvent; + +typedef enum { + PM_WAIT, + PM_CONTINUE, + PM_FAILED, + PM_NONE +} pmWait; + +typedef struct _PciChipsets { + /** + * Key used to match this device with its name in an array of + * \c SymTabRec. + */ + int numChipset; + + /** + * This value is quirky. Depending on the driver, it can take on one of + * three meanings. In drivers that have exactly one vendor ID (e.g., + * radeon, mga, i810) the low 16-bits are the device ID. + * + * In drivers that can have multiple vendor IDs (e.g., the glint driver + * can have either 3dlabs' ID or TI's ID, the i740 driver can have either + * Intel's ID or Real3D's ID, etc.) the low 16-bits are the device ID and + * the high 16-bits are the vendor ID. + * + * In drivers that don't have a specific vendor (e.g., vga) contains the + * device ID for either the generic VGA or generic 8514 devices. This + * turns out to be the same as the subclass and programming interface + * value (e.g., the full 24-bit class for the VGA device is 0x030000 (or + * 0x000101) and for 8514 is 0x030001). + */ + int PCIid; + +/* dummy place holders for drivers to build against old/new servers */ +#define RES_UNDEFINED NULL +#define RES_EXCLUSIVE_VGA NULL +#define RES_SHARED_VGA NULL + void *dummy; +} PciChipsets; + + +/* Entity properties */ +typedef void (*EntityProc)(int entityIndex,pointer private); + +typedef struct _entityInfo { + int index; + BusRec location; + int chipset; + Bool active; + GDevPtr device; + DriverPtr driver; +} EntityInfoRec, *EntityInfoPtr; + +/* DGA */ + +typedef struct { + int num; /* A unique identifier for the mode (num > 0) */ + DisplayModePtr mode; + int flags; /* DGA_CONCURRENT_ACCESS, etc... */ + int imageWidth; /* linear accessible portion (pixels) */ + int imageHeight; + int pixmapWidth; /* Xlib accessible portion (pixels) */ + int pixmapHeight; /* both fields ignored if no concurrent access */ + int bytesPerScanline; + int byteOrder; /* MSBFirst, LSBFirst */ + int depth; + int bitsPerPixel; + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + short visualClass; + int viewportWidth; + int viewportHeight; + int xViewportStep; /* viewport position granularity */ + int yViewportStep; + int maxViewportX; /* max viewport origin */ + int maxViewportY; + int viewportFlags; /* types of page flipping possible */ + int offset; /* offset into physical memory */ + unsigned char *address; /* server's mapped framebuffer */ + int reserved1; + int reserved2; +} DGAModeRec, *DGAModePtr; + +typedef struct { + DGAModePtr mode; + PixmapPtr pPix; +} DGADeviceRec, *DGADevicePtr; + +/* + * Flags for driver Probe() functions. + */ +#define PROBE_DEFAULT 0x00 +#define PROBE_DETECT 0x01 +#define PROBE_TRYHARD 0x02 + +/* + * Driver entry point types + */ + +typedef Bool xf86ProbeProc (DriverPtr, int); +typedef Bool xf86PreInitProc (ScrnInfoPtr, int); +typedef Bool xf86ScreenInitProc (int, ScreenPtr, int, char**); +typedef Bool xf86SwitchModeProc (int, DisplayModePtr, int); +typedef void xf86AdjustFrameProc (int, int, int, int); +typedef Bool xf86EnterVTProc (int, int); +typedef void xf86LeaveVTProc (int, int); +typedef void xf86FreeScreenProc (int, int); +typedef ModeStatus xf86ValidModeProc (int, DisplayModePtr, Bool, int); +typedef void xf86EnableDisableFBAccessProc(int, Bool); +typedef int xf86SetDGAModeProc (int, int, DGADevicePtr); +typedef int xf86ChangeGammaProc (int, Gamma); +typedef void xf86PointerMovedProc (int, int, int); +typedef Bool xf86PMEventProc (int, pmEvent, Bool); +typedef void xf86DPMSSetProc (ScrnInfoPtr, int, int); +typedef void xf86LoadPaletteProc (ScrnInfoPtr, int, int *, LOCO *, VisualPtr); +typedef void xf86SetOverscanProc (ScrnInfoPtr, int); +typedef void xf86ModeSetProc (ScrnInfoPtr); + + +/* + * ScrnInfoRec + * + * There is one of these for each screen, and it holds all the screen-specific + * information. + * + * Note: the size and layout must be kept the same across versions. New + * fields are to be added in place of the "reserved*" fields. No fields + * are to be dependent on compile-time defines. + */ + + +typedef struct _ScrnInfoRec { + int driverVersion; + char * driverName; /* canonical name used in */ + /* the config file */ + ScreenPtr pScreen; /* Pointer to the ScreenRec */ + int scrnIndex; /* Number of this screen */ + Bool configured; /* Is this screen valid */ + int origIndex; /* initial number assigned to + * this screen before + * finalising the number of + * available screens */ + + /* Display-wide screenInfo values needed by this screen */ + int imageByteOrder; + int bitmapScanlineUnit; + int bitmapScanlinePad; + int bitmapBitOrder; + int numFormats; + PixmapFormatRec formats[MAXFORMATS]; + PixmapFormatRec fbFormat; + + int bitsPerPixel; /* fb bpp */ + Pix24Flags pixmap24; /* pixmap pref for depth 24 */ + int depth; /* depth of default visual */ + MessageType depthFrom; /* set from config? */ + MessageType bitsPerPixelFrom; /* set from config? */ + rgb weight; /* r/g/b weights */ + rgb mask; /* rgb masks */ + rgb offset; /* rgb offsets */ + int rgbBits; /* Number of bits in r/g/b */ + Gamma gamma; /* Gamma of the monitor */ + int defaultVisual; /* default visual class */ + int maxHValue; /* max horizontal timing */ + int maxVValue; /* max vertical timing value */ + int virtualX; /* Virtual width */ + int virtualY; /* Virtual height */ + int xInc; /* Horizontal timing increment */ + MessageType virtualFrom; /* set from config? */ + int displayWidth; /* memory pitch */ + int frameX0; /* viewport position */ + int frameY0; + int frameX1; + int frameY1; + int zoomLocked; /* Disallow mode changes */ + DisplayModePtr modePool; /* list of compatible modes */ + DisplayModePtr modes; /* list of actual modes */ + DisplayModePtr currentMode; /* current mode + * This was previously + * overloaded with the modes + * field, which is a pointer + * into a circular list */ + confScreenPtr confScreen; /* Screen config info */ + MonPtr monitor; /* Monitor information */ + DispPtr display; /* Display information */ + int * entityList; /* List of device entities */ + int numEntities; + int widthmm; /* physical display dimensions + * in mm */ + int heightmm; + int xDpi; /* width DPI */ + int yDpi; /* height DPI */ + char * name; /* Name to prefix messages */ + pointer driverPrivate; /* Driver private area */ + DevUnion * privates; /* Other privates can hook in + * here */ + DriverPtr drv; /* xf86DriverList[] entry */ + pointer module; /* Pointer to module head */ + int colorKey; + int overlayFlags; + + /* Some of these may be moved out of here into the driver private area */ + + char * chipset; /* chipset name */ + char * ramdac; /* ramdac name */ + char * clockchip; /* clock name */ + Bool progClock; /* clock is programmable */ + int numClocks; /* number of clocks */ + int clock[MAXCLOCKS]; /* list of clock frequencies */ + int videoRam; /* amount of video ram (kb) */ + unsigned long biosBase; /* Base address of video BIOS */ + unsigned long memPhysBase; /* Physical address of FB */ + unsigned long fbOffset; /* Offset of FB in the above */ + IOADDRESS domainIOBase; /* Domain I/O base address */ + int memClk; /* memory clock */ + int textClockFreq; /* clock of text mode */ + Bool flipPixels; /* swap default black/white */ + pointer options; + + int chipID; + int chipRev; + + /* Allow screens to be enabled/disabled individually */ + Bool vtSema; + + /* hw cursor moves at SIGIO time */ + Bool silkenMouse; + + /* Storage for clockRanges and adjustFlags for use with the VidMode ext */ + ClockRangePtr clockRanges; + int adjustFlags; + + /* + * These can be used when the minor ABI version is incremented. + * The NUM_* parameters must be reduced appropriately to keep the + * structure size and alignment unchanged. + */ + int reservedInt[NUM_RESERVED_INTS]; + + int * entityInstanceList; + struct pci_device *vgaDev; + + pointer reservedPtr[NUM_RESERVED_POINTERS]; + + /* + * Driver entry points. + * + */ + + xf86ProbeProc *Probe; + xf86PreInitProc *PreInit; + xf86ScreenInitProc *ScreenInit; + xf86SwitchModeProc *SwitchMode; + xf86AdjustFrameProc *AdjustFrame; + xf86EnterVTProc *EnterVT; + xf86LeaveVTProc *LeaveVT; + xf86FreeScreenProc *FreeScreen; + xf86ValidModeProc *ValidMode; + xf86EnableDisableFBAccessProc *EnableDisableFBAccess; + xf86SetDGAModeProc *SetDGAMode; + xf86ChangeGammaProc *ChangeGamma; + xf86PointerMovedProc *PointerMoved; + xf86PMEventProc *PMEvent; + xf86DPMSSetProc *DPMSSet; + xf86LoadPaletteProc *LoadPalette; + xf86SetOverscanProc *SetOverscan; + xorgDriverFuncProc *DriverFunc; + xf86ModeSetProc *ModeSet; + + /* + * This can be used when the minor ABI version is incremented. + * The NUM_* parameter must be reduced appropriately to keep the + * structure size and alignment unchanged. + */ + funcPointer reservedFuncs[NUM_RESERVED_FUNCS]; + +} ScrnInfoRec; + + +typedef struct { + Bool (*OpenFramebuffer)( + ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, + int *size, + int *offset, + int *extra + ); + void (*CloseFramebuffer)(ScrnInfoPtr pScrn); + Bool (*SetMode)(ScrnInfoPtr pScrn, DGAModePtr pMode); + void (*SetViewport)(ScrnInfoPtr pScrn, int x, int y, int flags); + int (*GetViewport)(ScrnInfoPtr pScrn); + void (*Sync)(ScrnInfoPtr); + void (*FillRect)( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned long color + ); + void (*BlitRect)( + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, + int dstx, int dsty + ); + void (*BlitTransRect)( + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, + int dstx, int dsty, + unsigned long color + ); +} DGAFunctionRec, *DGAFunctionPtr; + +typedef struct _SymTabRec { + int token; /* id of the token */ + const char * name; /* token name */ +} SymTabRec, *SymTabPtr; + +/* flags for xf86LookupMode */ +typedef enum { + LOOKUP_DEFAULT = 0, /* Use default mode lookup method */ + LOOKUP_BEST_REFRESH, /* Pick modes with best refresh */ + LOOKUP_CLOSEST_CLOCK, /* Pick modes with the closest clock */ + LOOKUP_LIST_ORDER, /* Pick first useful mode in list */ + LOOKUP_CLKDIV2 = 0x0100, /* Allow half clocks */ + LOOKUP_OPTIONAL_TOLERANCES = 0x0200 /* Allow missing hsync/vrefresh */ +} LookupModeFlags; + +#define NoDepth24Support 0x00 +#define Support24bppFb 0x01 /* 24bpp framebuffer supported */ +#define Support32bppFb 0x02 /* 32bpp framebuffer supported */ +#define SupportConvert24to32 0x04 /* Can convert 24bpp pixmap to 32bpp */ +#define SupportConvert32to24 0x08 /* Can convert 32bpp pixmap to 24bpp */ +#define PreferConvert24to32 0x10 /* prefer 24bpp pixmap to 32bpp conv */ +#define PreferConvert32to24 0x20 /* prefer 32bpp pixmap to 24bpp conv */ + + +/* For DPMS */ +typedef void (*DPMSSetProcPtr)(ScrnInfoPtr, int, int); + +/* Input handler proc */ +typedef void (*InputHandlerProc)(int fd, pointer data); + +/* These are used by xf86GetClocks */ +#define CLK_REG_SAVE -1 +#define CLK_REG_RESTORE -2 + +/* + * misc constants + */ +#define INTERLACE_REFRESH_WEIGHT 1.5 +#define SYNC_TOLERANCE 0.01 /* 1 percent */ +#define CLOCK_TOLERANCE 2000 /* Clock matching tolerance (2MHz) */ + + +#define OVERLAY_8_32_DUALFB 0x00000001 +#define OVERLAY_8_24_DUALFB 0x00000002 +#define OVERLAY_8_16_DUALFB 0x00000004 +#define OVERLAY_8_32_PLANAR 0x00000008 + +/* Values of xf86Info.mouseFlags */ +#define MF_CLEAR_DTR 1 +#define MF_CLEAR_RTS 2 + +/* Action Events */ +typedef enum { + ACTION_TERMINATE = 0, /* Terminate Server */ + ACTION_NEXT_MODE = 10, /* Switch to next video mode */ + ACTION_PREV_MODE, + ACTION_SWITCHSCREEN = 100, /* VT switch */ + ACTION_SWITCHSCREEN_NEXT, + ACTION_SWITCHSCREEN_PREV, +} ActionEvent; + +#endif /* _XF86STR_H */ diff --git a/xorg-server/hw/xfree86/ddc/ddc.c b/xorg-server/hw/xfree86/ddc/ddc.c index e9b8a52eb..179f42ccd 100644 --- a/xorg-server/hw/xfree86/ddc/ddc.c +++ b/xorg-server/hw/xfree86/ddc/ddc.c @@ -1,506 +1,503 @@ -/* xf86DDC.c
- *
- * Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE>
- */
-
-/*
- * A note on terminology. DDC1 is the original dumb serial protocol, and
- * can only do up to 128 bytes of EDID. DDC2 is I2C-encapsulated and
- * introduces extension blocks. EDID is the old display identification
- * block, DisplayID is the new one.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include "misc.h"
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "xf86DDC.h"
-#include <string.h>
-
-#define RETRIES 4
-
-typedef enum {
- DDCOPT_NODDC1,
- DDCOPT_NODDC2,
- DDCOPT_NODDC
-} DDCOpts;
-
-static const OptionInfoRec DDCOptions[] = {
- { DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE },
- { DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE },
- { DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE },
- { -1, NULL, OPTV_NONE, {0}, FALSE },
-};
-
-/* DDC1 */
-
-static int
-find_start(unsigned int *ptr)
-{
- unsigned int comp[9], test[9];
- int i,j;
-
- for (i=0;i<9;i++){
- comp[i] = *(ptr++);
- test[i] = 1;
- }
- for (i=0;i<127;i++){
- for (j=0;j<9;j++){
- test[j] = test[j] & !(comp[j] ^ *(ptr++));
- }
- }
- for (i=0;i<9;i++)
- if (test[i]) return i+1;
- return -1;
-}
-
-static unsigned char *
-find_header(unsigned char *block)
-{
- unsigned char *ptr, *head_ptr, *end;
- unsigned char header[]={0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00};
-
- ptr = block;
- end = block + EDID1_LEN;
- while (ptr<end) {
- int i;
- head_ptr = ptr;
- for (i=0;i<8;i++){
- if (header[i] != *(head_ptr++)) break;
- if (head_ptr == end) head_ptr = block;
- }
- if (i==8) break;
- ptr++;
- }
- if (ptr == end) return NULL;
- return ptr;
-}
-
-static unsigned char *
-resort(unsigned char *s_block)
-{
- unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end;
- unsigned char tmp;
-
- s_end = s_block + EDID1_LEN;
- d_new = malloc(EDID1_LEN);
- if (!d_new) return NULL;
- d_end = d_new + EDID1_LEN;
-
- s_ptr = find_header(s_block);
- if (!s_ptr) return NULL;
- for (d_ptr=d_new;d_ptr<d_end;d_ptr++){
- tmp = *(s_ptr++);
- *d_ptr = tmp;
- if (s_ptr == s_end) s_ptr = s_block;
- }
- free(s_block);
- return d_new;
-}
-
-static int
-DDC_checksum(const unsigned char *block, int len)
-{
- int i, result = 0;
- int not_null = 0;
-
- for (i=0;i<len;i++) {
- not_null |= block[i];
- result += block[i];
- }
-
-#ifdef DEBUG
- if (result & 0xFF) ErrorF("DDC checksum not correct\n");
- if (!not_null) ErrorF("DDC read all Null\n");
-#endif
-
- /* catch the trivial case where all bytes are 0 */
- if (!not_null) return 1;
-
- return result&0xFF;
-}
-
-static unsigned char *
-GetEDID_DDC1(unsigned int *s_ptr)
-{
- unsigned char *d_block, *d_pos;
- unsigned int *s_pos, *s_end;
- int s_start;
- int i,j;
- s_start = find_start(s_ptr);
- if (s_start==-1) return NULL;
- s_end = s_ptr + NUM;
- s_pos = s_ptr + s_start;
- d_block=malloc(EDID1_LEN);
- if (!d_block) return NULL;
- d_pos = d_block;
- for (i=0;i<EDID1_LEN;i++) {
- for (j=0;j<8;j++) {
- *d_pos <<= 1;
- if (*s_pos) {
- *d_pos |= 0x01;
- }
- s_pos++; if (s_pos == s_end) s_pos=s_ptr;
- };
- s_pos++; if (s_pos == s_end) s_pos=s_ptr;
- d_pos++;
- }
- free(s_ptr);
- if (d_block && DDC_checksum(d_block,EDID1_LEN)) {
- free(d_block);
- return NULL;
- }
- return (resort(d_block));
-}
-
-/* fetch entire EDID record; DDC bit needs to be masked */
-static unsigned int *
-FetchEDID_DDC1(register ScrnInfoPtr pScrn,
- register unsigned int (*read_DDC)(ScrnInfoPtr))
-{
- int count = NUM;
- unsigned int *ptr, *xp;
-
- ptr=xp=malloc(sizeof(int)*NUM);
-
- if (!ptr) return NULL;
- do {
- /* wait for next retrace */
- *xp = read_DDC(pScrn);
- xp++;
- } while(--count);
- return ptr;
-}
-
-/* test if DDC1 return 0 if not */
-static Bool
-TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC)(ScrnInfoPtr))
-{
- int old, count;
-
- old = read_DDC(pScrn);
- count = HEADER * BITS_PER_BYTE;
- do {
- /* wait for next retrace */
- if (old != read_DDC(pScrn)) break;
- } while(count--);
- return count;
-}
-
-/*
- * read EDID record , pass it to callback function to interpret.
- * callback function will store it for further use by calling
- * function; it will also decide if we need to reread it
- */
-static unsigned char *
-EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed,
- unsigned int (*read_DDC)(ScrnInfoPtr))
-{
- unsigned char *EDID_block = NULL;
- int count = RETRIES;
-
- if (!read_DDC) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED,
- "chipset doesn't support DDC1\n");
- return NULL;
- };
-
- if (TestDDC1(pScrn,read_DDC)==-1) {
- xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n");
- return NULL;
- };
-
- if (DDCSpeed) DDCSpeed(pScrn,DDC_FAST);
- do {
- EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn,read_DDC));
- count --;
- } while (!EDID_block && count);
- if (DDCSpeed) DDCSpeed(pScrn,DDC_SLOW);
-
- return EDID_block;
-}
-
-/**
- * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are
- * unset. EDID information blocks are interpreted and the results returned in
- * an xf86MonPtr.
- *
- * This function does not affect the list of modes used by drivers -- it is up
- * to the driver to decide policy on what to do with EDID information.
- *
- * @return pointer to a new xf86MonPtr containing the EDID information.
- * @return NULL if no monitor attached or failure to interpret the EDID.
- */
-xf86MonPtr
-xf86DoEDID_DDC1(
- int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed,
- unsigned int (*DDC1Read)(ScrnInfoPtr)
-)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- unsigned char *EDID_block = NULL;
- xf86MonPtr tmp = NULL;
- int sigio;
- /* Default DDC and DDC1 to enabled. */
- Bool noddc = FALSE, noddc1 = FALSE;
- OptionInfoPtr options;
-
- options = xnfalloc(sizeof(DDCOptions));
- (void)memcpy(options, DDCOptions, sizeof(DDCOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
- xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1);
- free(options);
-
- if (noddc || noddc1)
- return NULL;
-
- sigio = xf86BlockSIGIO();
- EDID_block = EDIDRead_DDC1(pScrn,DDC1SetSpeed,DDC1Read);
- xf86UnblockSIGIO(sigio);
-
- if (EDID_block){
- tmp = xf86InterpretEDID(scrnIndex,EDID_block);
- }
-#ifdef DEBUG
- else ErrorF("No EDID block returned\n");
- if (!tmp)
- ErrorF("Cannot interpret EDID block\n");
-#endif
- return tmp;
-}
-
-/* DDC2 */
-
-static I2CDevPtr
-DDC2MakeDevice(I2CBusPtr pBus, int address, char *name)
-{
- I2CDevPtr dev = NULL;
-
- if (!(dev = xf86I2CFindDev(pBus, address))) {
- dev = xf86CreateI2CDevRec();
- dev->DevName = name;
- dev->SlaveAddr = address;
- dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */
- dev->StartTimeout = 550;
- dev->BitTimeout = 40;
- dev->AcknTimeout = 40;
-
- dev->pI2CBus = pBus;
- if (!xf86I2CDevInit(dev)) {
- xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n");
- return NULL;
- }
- }
-
- return dev;
-}
-
-static I2CDevPtr
-DDC2Init(int scrnIndex, I2CBusPtr pBus)
-{
- I2CDevPtr dev = NULL;
-
- /*
- * Slow down the bus so that older monitors don't
- * miss things.
- */
- pBus->RiseFallTime = 20;
-
- dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2");
- if (xf86I2CProbeAddress(pBus, 0x0060))
- DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register");
-
- return dev;
-}
-
-/* Mmmm, smell the hacks */
-static void
-EEDIDStop(I2CDevPtr d)
-{
-}
-
-/* block is the EDID block number. a segment is two blocks. */
-static Bool
-DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer)
-{
- unsigned char W_Buffer[1];
- int i, segment;
- I2CDevPtr seg;
- void (*stop)(I2CDevPtr);
-
- for (i = 0; i < RETRIES; i++) {
- /* Stop bits reset the segment pointer to 0, so be careful here. */
- segment = block >> 1;
- if (segment) {
- Bool b;
-
- if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060)))
- return FALSE;
-
- W_Buffer[0] = segment;
-
- stop = dev->pI2CBus->I2CStop;
- dev->pI2CBus->I2CStop = EEDIDStop;
-
- b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0);
-
- dev->pI2CBus->I2CStop = stop;
- if (!b) {
- dev->pI2CBus->I2CStop(dev);
- continue;
- }
- }
-
- W_Buffer[0] = (block & 0x01) * EDID1_LEN;
-
- if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) {
- if (!DDC_checksum(R_Buffer, EDID1_LEN))
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-/**
- * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
- * unset. EDID information blocks are interpreted and the results returned in
- * an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return
- * the complete EDID data, including all extension blocks, if the 'complete'
- * parameter is TRUE;
- *
- * This function does not affect the list of modes used by drivers -- it is up
- * to the driver to decide policy on what to do with EDID information.
- *
- * @return pointer to a new xf86MonPtr containing the EDID information.
- * @return NULL if no monitor attached or failure to interpret the EDID.
- */
-xf86MonPtr
-xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- unsigned char *EDID_block = NULL;
- xf86MonPtr tmp = NULL;
- I2CDevPtr dev = NULL;
- /* Default DDC and DDC2 to enabled. */
- Bool noddc = FALSE, noddc2 = FALSE;
- OptionInfoPtr options;
-
- options = malloc(sizeof(DDCOptions));
- if (!options)
- return NULL;
- memcpy(options, DDCOptions, sizeof(DDCOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
- xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
- free(options);
-
- if (noddc || noddc2)
- return NULL;
-
- if (!(dev = DDC2Init(scrnIndex, pBus)))
- return NULL;
-
- EDID_block = calloc(1, EDID1_LEN);
- if (!EDID_block)
- return NULL;
-
- if (DDC2Read(dev, 0, EDID_block)) {
- int i, n = EDID_block[0x7e];
-
- if (complete && n) {
- EDID_block = realloc(EDID_block, EDID1_LEN * (1+n));
-
- for (i = 0; i < n; i++)
- DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i)));
- }
-
- tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
- }
-
- if (tmp && complete)
- tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA;
-
- return tmp;
-}
-
-/**
- * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are
- * unset. EDID information blocks are interpreted and the results returned in
- * an xf86MonPtr.
- *
- * This function does not affect the list of modes used by drivers -- it is up
- * to the driver to decide policy on what to do with EDID information.
- *
- * @return pointer to a new xf86MonPtr containing the EDID information.
- * @return NULL if no monitor attached or failure to interpret the EDID.
- */
-xf86MonPtr
-xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus)
-{
- return xf86DoEEDID(scrnIndex, pBus, FALSE);
-}
-
-/* XXX write me */
-static void *
-DDC2ReadDisplayID(void)
-{
- return FALSE;
-}
-
-/**
- * Attempts to probe the monitor for DisplayID information, if NoDDC and
- * NoDDC2 are unset. DisplayID blocks are interpreted and the results
- * returned in an xf86MonPtr.
- *
- * This function does not affect the list of modes used by drivers -- it is up
- * to the driver to decide policy on what to do with DisplayID information.
- *
- * @return pointer to a new xf86MonPtr containing the DisplayID information.
- * @return NULL if no monitor attached or failure to interpret the DisplayID.
- */
-xf86MonPtr
-xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus)
-{
- ScrnInfoPtr pScrn = xf86Screens[scrnIndex];
- unsigned char *did = NULL;
- xf86MonPtr tmp = NULL;
- I2CDevPtr dev = NULL;
- /* Default DDC and DDC2 to enabled. */
- Bool noddc = FALSE, noddc2 = FALSE;
- OptionInfoPtr options;
-
- options = malloc(sizeof(DDCOptions));
- if (!options)
- return NULL;
- memcpy(options, DDCOptions, sizeof(DDCOptions));
- xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options);
-
- xf86GetOptValBool(options, DDCOPT_NODDC, &noddc);
- xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2);
- free(options);
-
- if (noddc || noddc2)
- return NULL;
-
- if (!(dev = DDC2Init(scrnIndex, pBus)))
- return NULL;
-
- if ((did = DDC2ReadDisplayID())) {
- tmp = calloc(1, sizeof(*tmp));
- if (!tmp)
- return NULL;
-
- tmp->scrnIndex = scrnIndex;
- tmp->flags |= MONITOR_DISPLAYID;
- tmp->rawData = did;
- }
-
- return tmp;
-}
+/* xf86DDC.c + * + * Copyright 1998,1999 by Egbert Eich <Egbert.Eich@Physik.TU-Darmstadt.DE> + */ + +/* + * A note on terminology. DDC1 is the original dumb serial protocol, and + * can only do up to 128 bytes of EDID. DDC2 is I2C-encapsulated and + * introduces extension blocks. EDID is the old display identification + * block, DisplayID is the new one. + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86DDC.h" +#include <string.h> + +#define RETRIES 4 + +typedef enum { + DDCOPT_NODDC1, + DDCOPT_NODDC2, + DDCOPT_NODDC +} DDCOpts; + +static const OptionInfoRec DDCOptions[] = { + { DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE }, + { DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE }, + { DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE }, +}; + +/* DDC1 */ + +static int +find_start(unsigned int *ptr) +{ + unsigned int comp[9], test[9]; + int i,j; + + for (i=0;i<9;i++){ + comp[i] = *(ptr++); + test[i] = 1; + } + for (i=0;i<127;i++){ + for (j=0;j<9;j++){ + test[j] = test[j] & !(comp[j] ^ *(ptr++)); + } + } + for (i=0;i<9;i++) + if (test[i]) return i+1; + return -1; +} + +static unsigned char * +find_header(unsigned char *block) +{ + unsigned char *ptr, *head_ptr, *end; + unsigned char header[]={0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00}; + + ptr = block; + end = block + EDID1_LEN; + while (ptr<end) { + int i; + head_ptr = ptr; + for (i=0;i<8;i++){ + if (header[i] != *(head_ptr++)) break; + if (head_ptr == end) head_ptr = block; + } + if (i==8) break; + ptr++; + } + if (ptr == end) return NULL; + return ptr; +} + +static unsigned char * +resort(unsigned char *s_block) +{ + unsigned char *d_new, *d_ptr, *d_end, *s_ptr, *s_end; + unsigned char tmp; + + s_end = s_block + EDID1_LEN; + d_new = malloc(EDID1_LEN); + if (!d_new) return NULL; + d_end = d_new + EDID1_LEN; + + s_ptr = find_header(s_block); + if (!s_ptr) return NULL; + for (d_ptr=d_new;d_ptr<d_end;d_ptr++){ + tmp = *(s_ptr++); + *d_ptr = tmp; + if (s_ptr == s_end) s_ptr = s_block; + } + free(s_block); + return d_new; +} + +static int +DDC_checksum(const unsigned char *block, int len) +{ + int i, result = 0; + int not_null = 0; + + for (i=0;i<len;i++) { + not_null |= block[i]; + result += block[i]; + } + +#ifdef DEBUG + if (result & 0xFF) ErrorF("DDC checksum not correct\n"); + if (!not_null) ErrorF("DDC read all Null\n"); +#endif + + /* catch the trivial case where all bytes are 0 */ + if (!not_null) return 1; + + return result&0xFF; +} + +static unsigned char * +GetEDID_DDC1(unsigned int *s_ptr) +{ + unsigned char *d_block, *d_pos; + unsigned int *s_pos, *s_end; + int s_start; + int i,j; + s_start = find_start(s_ptr); + if (s_start==-1) return NULL; + s_end = s_ptr + NUM; + s_pos = s_ptr + s_start; + d_block=malloc(EDID1_LEN); + if (!d_block) return NULL; + d_pos = d_block; + for (i=0;i<EDID1_LEN;i++) { + for (j=0;j<8;j++) { + *d_pos <<= 1; + if (*s_pos) { + *d_pos |= 0x01; + } + s_pos++; if (s_pos == s_end) s_pos=s_ptr; + }; + s_pos++; if (s_pos == s_end) s_pos=s_ptr; + d_pos++; + } + free(s_ptr); + if (d_block && DDC_checksum(d_block,EDID1_LEN)) { + free(d_block); + return NULL; + } + return (resort(d_block)); +} + +/* fetch entire EDID record; DDC bit needs to be masked */ +static unsigned int * +FetchEDID_DDC1(register ScrnInfoPtr pScrn, + register unsigned int (*read_DDC)(ScrnInfoPtr)) +{ + int count = NUM; + unsigned int *ptr, *xp; + + ptr=xp=malloc(sizeof(int)*NUM); + + if (!ptr) return NULL; + do { + /* wait for next retrace */ + *xp = read_DDC(pScrn); + xp++; + } while(--count); + return ptr; +} + +/* test if DDC1 return 0 if not */ +static Bool +TestDDC1(ScrnInfoPtr pScrn, unsigned int (*read_DDC)(ScrnInfoPtr)) +{ + int old, count; + + old = read_DDC(pScrn); + count = HEADER * BITS_PER_BYTE; + do { + /* wait for next retrace */ + if (old != read_DDC(pScrn)) break; + } while(count--); + return count; +} + +/* + * read EDID record , pass it to callback function to interpret. + * callback function will store it for further use by calling + * function; it will also decide if we need to reread it + */ +static unsigned char * +EDIDRead_DDC1(ScrnInfoPtr pScrn, DDC1SetSpeedProc DDCSpeed, + unsigned int (*read_DDC)(ScrnInfoPtr)) +{ + unsigned char *EDID_block = NULL; + int count = RETRIES; + + if (!read_DDC) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "chipset doesn't support DDC1\n"); + return NULL; + }; + + if (TestDDC1(pScrn,read_DDC)==-1) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No DDC signal\n"); + return NULL; + }; + + if (DDCSpeed) DDCSpeed(pScrn,DDC_FAST); + do { + EDID_block = GetEDID_DDC1(FetchEDID_DDC1(pScrn,read_DDC)); + count --; + } while (!EDID_block && count); + if (DDCSpeed) DDCSpeed(pScrn,DDC_SLOW); + + return EDID_block; +} + +/** + * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC1 are + * unset. EDID information blocks are interpreted and the results returned in + * an xf86MonPtr. + * + * This function does not affect the list of modes used by drivers -- it is up + * to the driver to decide policy on what to do with EDID information. + * + * @return pointer to a new xf86MonPtr containing the EDID information. + * @return NULL if no monitor attached or failure to interpret the EDID. + */ +xf86MonPtr +xf86DoEDID_DDC1(int scrnIndex, DDC1SetSpeedProc DDC1SetSpeed, + unsigned int (*DDC1Read)(ScrnInfoPtr)) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + unsigned char *EDID_block = NULL; + xf86MonPtr tmp = NULL; + /* Default DDC and DDC1 to enabled. */ + Bool noddc = FALSE, noddc1 = FALSE; + OptionInfoPtr options; + + options = xnfalloc(sizeof(DDCOptions)); + (void)memcpy(options, DDCOptions, sizeof(DDCOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); + xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1); + free(options); + + if (noddc || noddc1) + return NULL; + + OsBlockSignals(); + EDID_block = EDIDRead_DDC1(pScrn,DDC1SetSpeed,DDC1Read); + OsReleaseSignals(); + + if (EDID_block){ + tmp = xf86InterpretEDID(scrnIndex,EDID_block); + } +#ifdef DEBUG + else ErrorF("No EDID block returned\n"); + if (!tmp) + ErrorF("Cannot interpret EDID block\n"); +#endif + return tmp; +} + +/* DDC2 */ + +static I2CDevPtr +DDC2MakeDevice(I2CBusPtr pBus, int address, char *name) +{ + I2CDevPtr dev = NULL; + + if (!(dev = xf86I2CFindDev(pBus, address))) { + dev = xf86CreateI2CDevRec(); + dev->DevName = name; + dev->SlaveAddr = address; + dev->ByteTimeout = 2200; /* VESA DDC spec 3 p. 43 (+10 %) */ + dev->StartTimeout = 550; + dev->BitTimeout = 40; + dev->AcknTimeout = 40; + + dev->pI2CBus = pBus; + if (!xf86I2CDevInit(dev)) { + xf86DrvMsg(pBus->scrnIndex, X_PROBED, "No DDC2 device\n"); + return NULL; + } + } + + return dev; +} + +static I2CDevPtr +DDC2Init(int scrnIndex, I2CBusPtr pBus) +{ + I2CDevPtr dev = NULL; + + /* + * Slow down the bus so that older monitors don't + * miss things. + */ + pBus->RiseFallTime = 20; + + dev = DDC2MakeDevice(pBus, 0x00A0, "ddc2"); + if (xf86I2CProbeAddress(pBus, 0x0060)) + DDC2MakeDevice(pBus, 0x0060, "E-EDID segment register"); + + return dev; +} + +/* Mmmm, smell the hacks */ +static void +EEDIDStop(I2CDevPtr d) +{ +} + +/* block is the EDID block number. a segment is two blocks. */ +static Bool +DDC2Read(I2CDevPtr dev, int block, unsigned char *R_Buffer) +{ + unsigned char W_Buffer[1]; + int i, segment; + I2CDevPtr seg; + void (*stop)(I2CDevPtr); + + for (i = 0; i < RETRIES; i++) { + /* Stop bits reset the segment pointer to 0, so be careful here. */ + segment = block >> 1; + if (segment) { + Bool b; + + if (!(seg = xf86I2CFindDev(dev->pI2CBus, 0x0060))) + return FALSE; + + W_Buffer[0] = segment; + + stop = dev->pI2CBus->I2CStop; + dev->pI2CBus->I2CStop = EEDIDStop; + + b = xf86I2CWriteRead(seg, W_Buffer, 1, NULL, 0); + + dev->pI2CBus->I2CStop = stop; + if (!b) { + dev->pI2CBus->I2CStop(dev); + continue; + } + } + + W_Buffer[0] = (block & 0x01) * EDID1_LEN; + + if (xf86I2CWriteRead(dev, W_Buffer, 1, R_Buffer, EDID1_LEN)) { + if (!DDC_checksum(R_Buffer, EDID1_LEN)) + return TRUE; + } + } + + return FALSE; +} + +/** + * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are + * unset. EDID information blocks are interpreted and the results returned in + * an xf86MonPtr. Unlike xf86DoEDID_DDC[12](), this function will return + * the complete EDID data, including all extension blocks, if the 'complete' + * parameter is TRUE; + * + * This function does not affect the list of modes used by drivers -- it is up + * to the driver to decide policy on what to do with EDID information. + * + * @return pointer to a new xf86MonPtr containing the EDID information. + * @return NULL if no monitor attached or failure to interpret the EDID. + */ +xf86MonPtr +xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + unsigned char *EDID_block = NULL; + xf86MonPtr tmp = NULL; + I2CDevPtr dev = NULL; + /* Default DDC and DDC2 to enabled. */ + Bool noddc = FALSE, noddc2 = FALSE; + OptionInfoPtr options; + + options = malloc(sizeof(DDCOptions)); + if (!options) + return NULL; + memcpy(options, DDCOptions, sizeof(DDCOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); + xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); + free(options); + + if (noddc || noddc2) + return NULL; + + if (!(dev = DDC2Init(scrnIndex, pBus))) + return NULL; + + EDID_block = calloc(1, EDID1_LEN); + if (!EDID_block) + return NULL; + + if (DDC2Read(dev, 0, EDID_block)) { + int i, n = EDID_block[0x7e]; + + if (complete && n) { + EDID_block = realloc(EDID_block, EDID1_LEN * (1+n)); + + for (i = 0; i < n; i++) + DDC2Read(dev, i+1, EDID_block + (EDID1_LEN * (1+i))); + } + + tmp = xf86InterpretEEDID(scrnIndex, EDID_block); + } + + if (tmp && complete) + tmp->flags |= MONITOR_EDID_COMPLETE_RAWDATA; + + return tmp; +} + +/** + * Attempts to probe the monitor for EDID information, if NoDDC and NoDDC2 are + * unset. EDID information blocks are interpreted and the results returned in + * an xf86MonPtr. + * + * This function does not affect the list of modes used by drivers -- it is up + * to the driver to decide policy on what to do with EDID information. + * + * @return pointer to a new xf86MonPtr containing the EDID information. + * @return NULL if no monitor attached or failure to interpret the EDID. + */ +xf86MonPtr +xf86DoEDID_DDC2(int scrnIndex, I2CBusPtr pBus) +{ + return xf86DoEEDID(scrnIndex, pBus, FALSE); +} + +/* XXX write me */ +static void * +DDC2ReadDisplayID(void) +{ + return FALSE; +} + +/** + * Attempts to probe the monitor for DisplayID information, if NoDDC and + * NoDDC2 are unset. DisplayID blocks are interpreted and the results + * returned in an xf86MonPtr. + * + * This function does not affect the list of modes used by drivers -- it is up + * to the driver to decide policy on what to do with DisplayID information. + * + * @return pointer to a new xf86MonPtr containing the DisplayID information. + * @return NULL if no monitor attached or failure to interpret the DisplayID. + */ +xf86MonPtr +xf86DoDisplayID(int scrnIndex, I2CBusPtr pBus) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + unsigned char *did = NULL; + xf86MonPtr tmp = NULL; + I2CDevPtr dev = NULL; + /* Default DDC and DDC2 to enabled. */ + Bool noddc = FALSE, noddc2 = FALSE; + OptionInfoPtr options; + + options = malloc(sizeof(DDCOptions)); + if (!options) + return NULL; + memcpy(options, DDCOptions, sizeof(DDCOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); + xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); + free(options); + + if (noddc || noddc2) + return NULL; + + if (!(dev = DDC2Init(scrnIndex, pBus))) + return NULL; + + if ((did = DDC2ReadDisplayID())) { + tmp = calloc(1, sizeof(*tmp)); + if (!tmp) + return NULL; + + tmp->scrnIndex = scrnIndex; + tmp->flags |= MONITOR_DISPLAYID; + tmp->rawData = did; + } + + return tmp; +} diff --git a/xorg-server/hw/xfree86/int10/helper_exec.c b/xorg-server/hw/xfree86/int10/helper_exec.c index a55390194..b9af473b1 100644 --- a/xorg-server/hw/xfree86/int10/helper_exec.c +++ b/xorg-server/hw/xfree86/int10/helper_exec.c @@ -1,732 +1,733 @@ -/*
- * XFree86 int10 module
- * execute BIOS int 10h calls in x86 real mode environment
- * Copyright 1999 Egbert Eich
- *
- * Part of this code was inspired by the VBIOS POSTing code in DOSEMU
- * developed by the "DOSEMU-Development-Team"
- */
-
-/*
- * To debug port accesses define PRINT_PORT to 1.
- * Note! You also have to comment out ioperm()
- * in xf86EnableIO(). Otherwise we won't trap
- * on PIO.
- */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#define PRINT_PORT 0
-
-#include <unistd.h>
-
-#include <X11/Xos.h>
-#include "xf86.h"
-#include "xf86_OSproc.h"
-#include "compiler.h"
-#define _INT10_PRIVATE
-#include "int10Defines.h"
-#include "xf86int10.h"
-#include "Pci.h"
-#ifdef _X86EMU
-#include "x86emu/x86emui.h"
-#else
-#define DEBUG_IO_TRACE() 0
-#endif
-#include <pciaccess.h>
-
-static int pciCfg1in(CARD16 addr, CARD32 *val);
-static int pciCfg1out(CARD16 addr, CARD32 val);
-static int pciCfg1inw(CARD16 addr, CARD16 *val);
-static int pciCfg1outw(CARD16 addr, CARD16 val);
-static int pciCfg1inb(CARD16 addr, CARD8 *val);
-static int pciCfg1outb(CARD16 addr, CARD8 val);
-#if defined (_PC)
-static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set);
-#endif
-
-#define REG pInt
-
-int
-setup_int(xf86Int10InfoPtr pInt)
-{
- if (pInt != Int10Current) {
- if (!MapCurrentInt10(pInt))
- return -1;
- Int10Current = pInt;
- }
- X86_EAX = (CARD32) pInt->ax;
- X86_EBX = (CARD32) pInt->bx;
- X86_ECX = (CARD32) pInt->cx;
- X86_EDX = (CARD32) pInt->dx;
- X86_ESI = (CARD32) pInt->si;
- X86_EDI = (CARD32) pInt->di;
- X86_EBP = (CARD32) pInt->bp;
- X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4;
- X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */
- X86_DS = 0x40; /* standard pc ds */
- X86_ES = pInt->es;
- X86_FS = 0;
- X86_GS = 0;
- X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK;
-#if defined (_PC)
- if (pInt->Flags & SET_BIOS_SCRATCH)
- SetResetBIOSVars(pInt, TRUE);
-#endif
- return xf86BlockSIGIO();
-}
-
-void
-finish_int(xf86Int10InfoPtr pInt, int sig)
-{
- xf86UnblockSIGIO(sig);
- pInt->ax = (CARD32) X86_EAX;
- pInt->bx = (CARD32) X86_EBX;
- pInt->cx = (CARD32) X86_ECX;
- pInt->dx = (CARD32) X86_EDX;
- pInt->si = (CARD32) X86_ESI;
- pInt->di = (CARD32) X86_EDI;
- pInt->es = (CARD16) X86_ES;
- pInt->bp = (CARD32) X86_EBP;
- pInt->flags = (CARD32) X86_FLAGS;
-#if defined (_PC)
- if (pInt->Flags & RESTORE_BIOS_SCRATCH)
- SetResetBIOSVars(pInt, FALSE);
-#endif
-}
-
-/* general software interrupt handler */
-CARD32
-getIntVect(xf86Int10InfoPtr pInt,int num)
-{
- return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4);
-}
-
-void
-pushw(xf86Int10InfoPtr pInt, CARD16 val)
-{
- X86_ESP -= 2;
- MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val);
-}
-
-int
-run_bios_int(int num, xf86Int10InfoPtr pInt)
-{
- CARD32 eflags;
-#ifndef _PC
- /* check if bios vector is initialized */
- if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/
-
- if (num == 21 && X86_AH == 0x4e) {
- xf86DrvMsg(pInt->scrnIndex, X_NOTICE,
- "Failing Find-Matching-File on non-PC"
- " (int 21, func 4e)\n");
- X86_AX = 2;
- SET_FLAG(F_CF);
- return 1;
- } else {
- xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "Ignoring int 0x%02x call\n", num);
- if (xf86GetVerbosity() > 3) {
- dump_registers(pInt);
- stack_trace(pInt);
- }
- return 1;
- }
- }
-#endif
-#ifdef PRINT_INT
- ErrorF("calling card BIOS at: ");
-#endif
- eflags = X86_EFLAGS;
-#if 0
- eflags = eflags | IF_MASK;
- X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK);
-#endif
- pushw(pInt, eflags);
- pushw(pInt, X86_CS);
- pushw(pInt, X86_IP);
- X86_CS = MEM_RW(pInt, (num << 2) + 2);
- X86_IP = MEM_RW(pInt, num << 2);
-#ifdef PRINT_INT
- ErrorF("0x%x:%lx\n", X86_CS, X86_EIP);
-#endif
- return 1;
-}
-
-/* Debugging stuff */
-void
-dump_code(xf86Int10InfoPtr pInt)
-{
- int i;
- unsigned long lina = SEG_ADR((CARD32), X86_CS, IP);
-
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8lx:\n", lina);
- for (i=0; i<0x10; i++)
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
- xf86ErrorFVerb(3, "\n");
- for (; i<0x20; i++)
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i));
- xf86ErrorFVerb(3, "\n");
-}
-
-void
-dump_registers(xf86Int10InfoPtr pInt)
-{
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n",
- (unsigned long)X86_EAX, (unsigned long)X86_EBX,
- (unsigned long)X86_ECX, (unsigned long)X86_EDX);
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n",
- (unsigned long)X86_ESP, (unsigned long)X86_EBP,
- (unsigned long)X86_ESI, (unsigned long)X86_EDI);
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "CS=0x%4.4x, SS=0x%4.4x,"
- " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n",
- X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS);
- xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3,
- "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n",
- (unsigned long)X86_EIP, (unsigned long)X86_EFLAGS);
-}
-
-void
-stack_trace(xf86Int10InfoPtr pInt)
-{
- int i = 0;
- unsigned long stack = SEG_ADR((CARD32), X86_SS, SP);
- unsigned long tail = (CARD32)((X86_SS << 4) + 0x1000);
-
- if (stack >= tail) return;
-
- xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack);
- for (; stack < tail; stack++) {
- xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack));
- i = (i + 1) % 0x10;
- if (!i)
- xf86ErrorFVerb(3, "\n");
- }
- if (i)
- xf86ErrorFVerb(3, "\n");
-}
-
-int
-port_rep_inb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -1 : 1;
- CARD32 dst = base;
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insb(%#x) %ld bytes at %8.8lx %s\n",
- port, count, base, d_f ? "up" : "down");
- while (count--) {
- MEM_WB(pInt, dst, x_inb(port));
- dst += inc;
- }
- return dst - base;
-}
-
-int
-port_rep_inw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -2 : 2;
- CARD32 dst = base;
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insw(%#x) %ld bytes at %8.8lx %s\n",
- port, count, base, d_f ? "up" : "down");
- while (count--) {
- MEM_WW(pInt, dst, x_inw(port));
- dst += inc;
- }
- return dst - base;
-}
-
-int
-port_rep_inl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -4 : 4;
- CARD32 dst = base;
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_insl(%#x) %ld bytes at %8.8lx %s\n",
- port, count, base, d_f ? "up" : "down");
- while (count--) {
- MEM_WL(pInt, dst, x_inl(port));
- dst += inc;
- }
- return dst - base;
-}
-
-int
-port_rep_outb(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -1 : 1;
- CARD32 dst = base;
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outb(%#x) %ld bytes at %8.8lx %s\n",
- port, count, base, d_f ? "up" : "down");
- while (count--) {
- x_outb(port, MEM_RB(pInt, dst));
- dst += inc;
- }
- return dst - base;
-}
-
-int
-port_rep_outw(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -2 : 2;
- CARD32 dst = base;
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outw(%#x) %ld bytes at %8.8lx %s\n",
- port, count, base, d_f ? "up" : "down");
- while (count--) {
- x_outw(port, MEM_RW(pInt, dst));
- dst += inc;
- }
- return dst - base;
-}
-
-int
-port_rep_outl(xf86Int10InfoPtr pInt,
- CARD16 port, CARD32 base, int d_f, CARD32 count)
-{
- register int inc = d_f ? -4 : 4;
- CARD32 dst = base;
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" rep_outl(%#x) %ld bytes at %8.8lx %s\n",
- port, count, base, d_f ? "up" : "down");
- while (count--) {
- x_outl(port, MEM_RL(pInt, dst));
- dst += inc;
- }
- return dst - base;
-}
-
-CARD8
-x_inb(CARD16 port)
-{
- CARD8 val;
-
- if (port == 0x40) {
- Int10Current->inb40time++;
- val = (CARD8)(Int10Current->inb40time >>
- ((Int10Current->inb40time & 1) << 3));
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
-#ifdef __NOT_YET__
- } else if (port < 0x0100) { /* Don't interfere with mainboard */
- val = 0;
- xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "inb 0x%4.4x\n", port);
- if (xf86GetVerbosity() > 3) {
- dump_registers(Int10Current);
- stack_trace(Int10Current);
- }
-#endif /* __NOT_YET__ */
- } else if (!pciCfg1inb(port, &val)) {
- val = inb(Int10Current->ioBase + port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inb(%#x) = %2.2x\n", port, val);
- }
- return val;
-}
-
-CARD16
-x_inw(CARD16 port)
-{
- CARD16 val;
-
- if (port == 0x5c) {
- struct timeval tv;
-
- /*
- * Emulate a PC98's timer. Typical resolution is 3.26 usec.
- * Approximate this by dividing by 3.
- */
- X_GETTIMEOFDAY(&tv);
- val = (CARD16)(tv.tv_usec / 3);
- } else if (!pciCfg1inw(port, &val)) {
- val = inw(Int10Current->ioBase + port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inw(%#x) = %4.4x\n", port, val);
- }
- return val;
-}
-
-void
-x_outb(CARD16 port, CARD8 val)
-{
- if ((port == 0x43) && (val == 0)) {
- struct timeval tv;
- /*
- * Emulate a PC's timer 0. Such timers typically have a resolution of
- * some .838 usec per tick, but this can only provide 1 usec per tick.
- * (Not that this matters much, given inherent emulation delays.) Use
- * the bottom bit as a byte select. See inb(0x40) above.
- */
- X_GETTIMEOFDAY(&tv);
- Int10Current->inb40time = (CARD16)(tv.tv_usec | 1);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
-#ifdef __NOT_YET__
- } else if (port < 0x0100) { /* Don't interfere with mainboard */
- xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2,
- "outb 0x%4.4x,0x%2.2x\n", port, val);
- if (xf86GetVerbosity() > 3) {
- dump_registers(Int10Current);
- stack_trace(Int10Current);
- }
-#endif /* __NOT_YET__ */
- } else if (!pciCfg1outb(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outb(%#x, %2.2x)\n", port, val);
- outb(Int10Current->ioBase + port, val);
- }
-}
-
-void
-x_outw(CARD16 port, CARD16 val)
-{
-
- if (!pciCfg1outw(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outw(%#x, %4.4x)\n", port, val);
- outw(Int10Current->ioBase + port, val);
- }
-}
-
-CARD32
-x_inl(CARD16 port)
-{
- CARD32 val;
-
- if (!pciCfg1in(port, &val)) {
- val = inl(Int10Current->ioBase + port);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" inl(%#x) = %8.8lx\n", port, val);
- }
- return val;
-}
-
-void
-x_outl(CARD16 port, CARD32 val)
-{
- if (!pciCfg1out(port, val)) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" outl(%#x, %8.8lx)\n", port, val);
- outl(Int10Current->ioBase + port, val);
- }
-}
-
-CARD8
-Mem_rb(CARD32 addr)
-{
- return (*Int10Current->mem->rb)(Int10Current, addr);
-}
-
-CARD16
-Mem_rw(CARD32 addr)
-{
- return (*Int10Current->mem->rw)(Int10Current, addr);
-}
-
-CARD32
-Mem_rl(CARD32 addr)
-{
- return (*Int10Current->mem->rl)(Int10Current, addr);
-}
-
-void
-Mem_wb(CARD32 addr, CARD8 val)
-{
- (*Int10Current->mem->wb)(Int10Current, addr, val);
-}
-
-void
-Mem_ww(CARD32 addr, CARD16 val)
-{
- (*Int10Current->mem->ww)(Int10Current, addr, val);
-}
-
-void
-Mem_wl(CARD32 addr, CARD32 val)
-{
- (*Int10Current->mem->wl)(Int10Current, addr, val);
-}
-
-static CARD32 PciCfg1Addr = 0;
-
-#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK))
-#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK))
-#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11)
-#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8)
-
-#define PCI_OFFSET(x) ((x) & 0x000000ff)
-#define PCI_TAG(x) ((x) & 0x7fffff00)
-
-static struct pci_device*
-pci_device_for_cfg_address (CARD32 addr)
-{
- struct pci_device *dev = NULL;
- PCITAG tag = PCI_TAG(addr);
- struct pci_slot_match slot_match = {
- .domain = PCI_DOM_FROM_TAG(tag),
- .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)),
- .dev = PCI_DEV_FROM_TAG(tag),
- .func = PCI_FUNC_FROM_TAG(tag),
- .match_data = 0
- };
-
- struct pci_device_iterator *iter =
- pci_slot_match_iterator_create (&slot_match);
-
- if (iter)
- dev = pci_device_next(iter);
-
- pci_iterator_destroy(iter);
-
- return dev;
-}
-
-static int
-pciCfg1in(CARD16 addr, CARD32 *val)
-{
- if (addr == 0xCF8) {
- *val = PciCfg1Addr;
- return 1;
- }
- if (addr == 0xCFC) {
- pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr));
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inl(%#lx) = %8.8lx\n", PciCfg1Addr, *val);
- return 1;
- }
- return 0;
-}
-
-static int
-pciCfg1out(CARD16 addr, CARD32 val)
-{
- if (addr == 0xCF8) {
- PciCfg1Addr = val;
- return 1;
- }
- if (addr == 0xCFC) {
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outl(%#lx, %8.8lx)\n", PciCfg1Addr, val);
- pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr));
- return 1;
- }
- return 0;
-}
-
-static int
-pciCfg1inw(CARD16 addr, CARD16 *val)
-{
- int shift;
-
- if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- *val = (PciCfg1Addr >> shift) & 0xffff;
- return 1;
- }
- if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inw(%#lx) = %4.4x\n", PciCfg1Addr + offset, *val);
- return 1;
- }
- return 0;
-}
-
-static int
-pciCfg1outw(CARD16 addr, CARD16 val)
-{
- int shift;
-
- if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- PciCfg1Addr &= ~(0xffff << shift);
- PciCfg1Addr |= ((CARD32) val) << shift;
- return 1;
- }
- if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outw(%#lx, %4.4x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- return 1;
- }
- return 0;
-}
-
-static int
-pciCfg1inb(CARD16 addr, CARD8 *val)
-{
- int shift;
-
- if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- *val = (PciCfg1Addr >> shift) & 0xff;
- return 1;
- }
- if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_inb(%#lx) = %2.2x\n", PciCfg1Addr + offset, *val);
- return 1;
- }
- return 0;
-}
-
-static int
-pciCfg1outb(CARD16 addr, CARD8 val)
-{
- int shift;
-
- if ((addr >= 0xCF8) && (addr <= 0xCFB)) {
- shift = (addr - 0xCF8) * 8;
- PciCfg1Addr &= ~(0xff << shift);
- PciCfg1Addr |= ((CARD32) val) << shift;
- return 1;
- }
- if ((addr >= 0xCFC) && (addr <= 0xCFF)) {
- const unsigned offset = addr - 0xCFC;
-
- if (PRINT_PORT && DEBUG_IO_TRACE())
- ErrorF(" cfg_outb(%#lx, %2.2x)\n", PciCfg1Addr + offset, val);
- pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr),
- val, PCI_OFFSET(PciCfg1Addr) + offset);
- return 1;
- }
- return 0;
-}
-
-CARD8
-bios_checksum(const CARD8 *start, int size)
-{
- CARD8 sum = 0;
-
- while (size-- > 0)
- sum += *start++;
- return sum;
-}
-
-/*
- * Lock/Unlock legacy VGA. Some Bioses try to be very clever and make
- * an attempt to detect a legacy ISA card. If they find one they might
- * act very strange: for example they might configure the card as a
- * monochrome card. This might cause some drivers to choke.
- * To avoid this we attempt legacy VGA by writing to all know VGA
- * disable registers before we call the BIOS initialization and
- * restore the original values afterwards. In beween we hold our
- * breath. To get to a (possibly exising) ISA card need to disable
- * our current PCI card.
- */
-/*
- * This is just for booting: we just want to catch pure
- * legacy vga therefore we don't worry about mmio etc.
- * This stuff should really go into vgaHW.c. However then
- * the driver would have to load the vga-module prior to
- * doing int10.
- */
-void
-LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
-{
- vga->save_msr = inb(pInt->ioBase + 0x03CC);
- vga->save_vse = inb(pInt->ioBase + 0x03C3);
-#ifndef __ia64__
- vga->save_46e8 = inb(pInt->ioBase + 0x46E8);
-#endif
- vga->save_pos102 = inb(pInt->ioBase + 0x0102);
- outb(pInt->ioBase + 0x03C2, ~(CARD8)0x03 & vga->save_msr);
- outb(pInt->ioBase + 0x03C3, ~(CARD8)0x01 & vga->save_vse);
-#ifndef __ia64__
- outb(pInt->ioBase + 0x46E8, ~(CARD8)0x08 & vga->save_46e8);
-#endif
- outb(pInt->ioBase + 0x0102, ~(CARD8)0x01 & vga->save_pos102);
-}
-
-void
-UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga)
-{
- outb(pInt->ioBase + 0x0102, vga->save_pos102);
-#ifndef __ia64__
- outb(pInt->ioBase + 0x46E8, vga->save_46e8);
-#endif
- outb(pInt->ioBase + 0x03C3, vga->save_vse);
- outb(pInt->ioBase + 0x03C2, vga->save_msr);
-}
-
-#if defined (_PC)
-static void
-SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set)
-{
- int pagesize = getpagesize();
- unsigned char* base = xf86MapVidMem(pInt->scrnIndex,
- VIDMEM_MMIO, 0, pagesize);
- int i;
-
- if (set) {
- for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
- MEM_WW(pInt, i, *(base + i));
- } else {
- for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++)
- *(base + i) = MEM_RW(pInt, i);
- }
-
- xf86UnMapVidMem(pInt->scrnIndex,base,pagesize);
-}
-
-void
-xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save)
-{
- int pagesize = getpagesize();
- unsigned char* base;
- int i;
-
- if (!xf86IsEntityPrimary(pInt->entityIndex)
- || (!save && !pInt->BIOSScratch))
- return;
-
- base = xf86MapVidMem(pInt->scrnIndex, VIDMEM_MMIO, 0, pagesize);
- base += BIOS_SCRATCH_OFF;
- if (save) {
- if ((pInt->BIOSScratch
- = xnfalloc(BIOS_SCRATCH_LEN)))
- for (i = 0; i < BIOS_SCRATCH_LEN; i++)
- *(((char*)pInt->BIOSScratch + i)) = *(base + i);
- } else {
- if (pInt->BIOSScratch) {
- for (i = 0; i < BIOS_SCRATCH_LEN; i++)
- *(base + i) = *(pInt->BIOSScratch + i);
- free(pInt->BIOSScratch);
- pInt->BIOSScratch = NULL;
- }
- }
-
- xf86UnMapVidMem(pInt->scrnIndex,base - BIOS_SCRATCH_OFF ,pagesize);
-}
-#endif
-
-xf86Int10InfoPtr
-xf86InitInt10(int entityIndex)
-{
- return xf86ExtendedInitInt10(entityIndex, 0);
-}
+/* + * XFree86 int10 module + * execute BIOS int 10h calls in x86 real mode environment + * Copyright 1999 Egbert Eich + * + * Part of this code was inspired by the VBIOS POSTing code in DOSEMU + * developed by the "DOSEMU-Development-Team" + */ + +/* + * To debug port accesses define PRINT_PORT to 1. + * Note! You also have to comment out ioperm() + * in xf86EnableIO(). Otherwise we won't trap + * on PIO. + */ + +#ifdef HAVE_XORG_CONFIG_H +#include <xorg-config.h> +#endif + +#define PRINT_PORT 0 + +#include <unistd.h> + +#include <X11/Xos.h> +#include "xf86.h" +#include "xf86_OSproc.h" +#include "compiler.h" +#define _INT10_PRIVATE +#include "int10Defines.h" +#include "xf86int10.h" +#include "Pci.h" +#ifdef _X86EMU +#include "x86emu/x86emui.h" +#else +#define DEBUG_IO_TRACE() 0 +#endif +#include <pciaccess.h> + +static int pciCfg1in(CARD16 addr, CARD32 *val); +static int pciCfg1out(CARD16 addr, CARD32 val); +static int pciCfg1inw(CARD16 addr, CARD16 *val); +static int pciCfg1outw(CARD16 addr, CARD16 val); +static int pciCfg1inb(CARD16 addr, CARD8 *val); +static int pciCfg1outb(CARD16 addr, CARD8 val); +#if defined (_PC) +static void SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set); +#endif + +#define REG pInt + +int +setup_int(xf86Int10InfoPtr pInt) +{ + if (pInt != Int10Current) { + if (!MapCurrentInt10(pInt)) + return -1; + Int10Current = pInt; + } + X86_EAX = (CARD32) pInt->ax; + X86_EBX = (CARD32) pInt->bx; + X86_ECX = (CARD32) pInt->cx; + X86_EDX = (CARD32) pInt->dx; + X86_ESI = (CARD32) pInt->si; + X86_EDI = (CARD32) pInt->di; + X86_EBP = (CARD32) pInt->bp; + X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4; + X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */ + X86_DS = 0x40; /* standard pc ds */ + X86_ES = pInt->es; + X86_FS = 0; + X86_GS = 0; + X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK; +#if defined (_PC) + if (pInt->Flags & SET_BIOS_SCRATCH) + SetResetBIOSVars(pInt, TRUE); +#endif + OsBlockSignals(); + return 0; +} + +void +finish_int(xf86Int10InfoPtr pInt, int sig) +{ + OsReleaseSignals(); + pInt->ax = (CARD32) X86_EAX; + pInt->bx = (CARD32) X86_EBX; + pInt->cx = (CARD32) X86_ECX; + pInt->dx = (CARD32) X86_EDX; + pInt->si = (CARD32) X86_ESI; + pInt->di = (CARD32) X86_EDI; + pInt->es = (CARD16) X86_ES; + pInt->bp = (CARD32) X86_EBP; + pInt->flags = (CARD32) X86_FLAGS; +#if defined (_PC) + if (pInt->Flags & RESTORE_BIOS_SCRATCH) + SetResetBIOSVars(pInt, FALSE); +#endif +} + +/* general software interrupt handler */ +CARD32 +getIntVect(xf86Int10InfoPtr pInt,int num) +{ + return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4); +} + +void +pushw(xf86Int10InfoPtr pInt, CARD16 val) +{ + X86_ESP -= 2; + MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val); +} + +int +run_bios_int(int num, xf86Int10InfoPtr pInt) +{ + CARD32 eflags; +#ifndef _PC + /* check if bios vector is initialized */ + if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/ + + if (num == 21 && X86_AH == 0x4e) { + xf86DrvMsg(pInt->scrnIndex, X_NOTICE, + "Failing Find-Matching-File on non-PC" + " (int 21, func 4e)\n"); + X86_AX = 2; + SET_FLAG(F_CF); + return 1; + } else { + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "Ignoring int 0x%02x call\n", num); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + return 1; + } + } +#endif +#ifdef PRINT_INT + ErrorF("calling card BIOS at: "); +#endif + eflags = X86_EFLAGS; +#if 0 + eflags = eflags | IF_MASK; + X86_EFLAGS = X86_EFLAGS & ~(VIF_MASK | TF_MASK | IF_MASK | NT_MASK); +#endif + pushw(pInt, eflags); + pushw(pInt, X86_CS); + pushw(pInt, X86_IP); + X86_CS = MEM_RW(pInt, (num << 2) + 2); + X86_IP = MEM_RW(pInt, num << 2); +#ifdef PRINT_INT + ErrorF("0x%x:%lx\n", X86_CS, X86_EIP); +#endif + return 1; +} + +/* Debugging stuff */ +void +dump_code(xf86Int10InfoPtr pInt) +{ + int i; + unsigned long lina = SEG_ADR((CARD32), X86_CS, IP); + + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8lx:\n", lina); + for (i=0; i<0x10; i++) + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); + xf86ErrorFVerb(3, "\n"); + for (; i<0x20; i++) + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); + xf86ErrorFVerb(3, "\n"); +} + +void +dump_registers(xf86Int10InfoPtr pInt) +{ + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "EAX=0x%8.8lx, EBX=0x%8.8lx, ECX=0x%8.8lx, EDX=0x%8.8lx\n", + (unsigned long)X86_EAX, (unsigned long)X86_EBX, + (unsigned long)X86_ECX, (unsigned long)X86_EDX); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "ESP=0x%8.8lx, EBP=0x%8.8lx, ESI=0x%8.8lx, EDI=0x%8.8lx\n", + (unsigned long)X86_ESP, (unsigned long)X86_EBP, + (unsigned long)X86_ESI, (unsigned long)X86_EDI); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "CS=0x%4.4x, SS=0x%4.4x," + " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n", + X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "EIP=0x%8.8lx, EFLAGS=0x%8.8lx\n", + (unsigned long)X86_EIP, (unsigned long)X86_EFLAGS); +} + +void +stack_trace(xf86Int10InfoPtr pInt) +{ + int i = 0; + unsigned long stack = SEG_ADR((CARD32), X86_SS, SP); + unsigned long tail = (CARD32)((X86_SS << 4) + 0x1000); + + if (stack >= tail) return; + + xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack); + for (; stack < tail; stack++) { + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack)); + i = (i + 1) % 0x10; + if (!i) + xf86ErrorFVerb(3, "\n"); + } + if (i) + xf86ErrorFVerb(3, "\n"); +} + +int +port_rep_inb(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +{ + register int inc = d_f ? -1 : 1; + CARD32 dst = base; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" rep_insb(%#x) %ld bytes at %8.8lx %s\n", + port, count, base, d_f ? "up" : "down"); + while (count--) { + MEM_WB(pInt, dst, x_inb(port)); + dst += inc; + } + return dst - base; +} + +int +port_rep_inw(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +{ + register int inc = d_f ? -2 : 2; + CARD32 dst = base; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" rep_insw(%#x) %ld bytes at %8.8lx %s\n", + port, count, base, d_f ? "up" : "down"); + while (count--) { + MEM_WW(pInt, dst, x_inw(port)); + dst += inc; + } + return dst - base; +} + +int +port_rep_inl(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +{ + register int inc = d_f ? -4 : 4; + CARD32 dst = base; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" rep_insl(%#x) %ld bytes at %8.8lx %s\n", + port, count, base, d_f ? "up" : "down"); + while (count--) { + MEM_WL(pInt, dst, x_inl(port)); + dst += inc; + } + return dst - base; +} + +int +port_rep_outb(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +{ + register int inc = d_f ? -1 : 1; + CARD32 dst = base; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" rep_outb(%#x) %ld bytes at %8.8lx %s\n", + port, count, base, d_f ? "up" : "down"); + while (count--) { + x_outb(port, MEM_RB(pInt, dst)); + dst += inc; + } + return dst - base; +} + +int +port_rep_outw(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +{ + register int inc = d_f ? -2 : 2; + CARD32 dst = base; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" rep_outw(%#x) %ld bytes at %8.8lx %s\n", + port, count, base, d_f ? "up" : "down"); + while (count--) { + x_outw(port, MEM_RW(pInt, dst)); + dst += inc; + } + return dst - base; +} + +int +port_rep_outl(xf86Int10InfoPtr pInt, + CARD16 port, CARD32 base, int d_f, CARD32 count) +{ + register int inc = d_f ? -4 : 4; + CARD32 dst = base; + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" rep_outl(%#x) %ld bytes at %8.8lx %s\n", + port, count, base, d_f ? "up" : "down"); + while (count--) { + x_outl(port, MEM_RL(pInt, dst)); + dst += inc; + } + return dst - base; +} + +CARD8 +x_inb(CARD16 port) +{ + CARD8 val; + + if (port == 0x40) { + Int10Current->inb40time++; + val = (CARD8)(Int10Current->inb40time >> + ((Int10Current->inb40time & 1) << 3)); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" inb(%#x) = %2.2x\n", port, val); +#ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ + val = 0; + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + "inb 0x%4.4x\n", port); + if (xf86GetVerbosity() > 3) { + dump_registers(Int10Current); + stack_trace(Int10Current); + } +#endif /* __NOT_YET__ */ + } else if (!pciCfg1inb(port, &val)) { + val = inb(Int10Current->ioBase + port); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" inb(%#x) = %2.2x\n", port, val); + } + return val; +} + +CARD16 +x_inw(CARD16 port) +{ + CARD16 val; + + if (port == 0x5c) { + struct timeval tv; + + /* + * Emulate a PC98's timer. Typical resolution is 3.26 usec. + * Approximate this by dividing by 3. + */ + X_GETTIMEOFDAY(&tv); + val = (CARD16)(tv.tv_usec / 3); + } else if (!pciCfg1inw(port, &val)) { + val = inw(Int10Current->ioBase + port); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" inw(%#x) = %4.4x\n", port, val); + } + return val; +} + +void +x_outb(CARD16 port, CARD8 val) +{ + if ((port == 0x43) && (val == 0)) { + struct timeval tv; + /* + * Emulate a PC's timer 0. Such timers typically have a resolution of + * some .838 usec per tick, but this can only provide 1 usec per tick. + * (Not that this matters much, given inherent emulation delays.) Use + * the bottom bit as a byte select. See inb(0x40) above. + */ + X_GETTIMEOFDAY(&tv); + Int10Current->inb40time = (CARD16)(tv.tv_usec | 1); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" outb(%#x, %2.2x)\n", port, val); +#ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + "outb 0x%4.4x,0x%2.2x\n", port, val); + if (xf86GetVerbosity() > 3) { + dump_registers(Int10Current); + stack_trace(Int10Current); + } +#endif /* __NOT_YET__ */ + } else if (!pciCfg1outb(port, val)) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" outb(%#x, %2.2x)\n", port, val); + outb(Int10Current->ioBase + port, val); + } +} + +void +x_outw(CARD16 port, CARD16 val) +{ + + if (!pciCfg1outw(port, val)) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" outw(%#x, %4.4x)\n", port, val); + outw(Int10Current->ioBase + port, val); + } +} + +CARD32 +x_inl(CARD16 port) +{ + CARD32 val; + + if (!pciCfg1in(port, &val)) { + val = inl(Int10Current->ioBase + port); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" inl(%#x) = %8.8lx\n", port, val); + } + return val; +} + +void +x_outl(CARD16 port, CARD32 val) +{ + if (!pciCfg1out(port, val)) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" outl(%#x, %8.8lx)\n", port, val); + outl(Int10Current->ioBase + port, val); + } +} + +CARD8 +Mem_rb(CARD32 addr) +{ + return (*Int10Current->mem->rb)(Int10Current, addr); +} + +CARD16 +Mem_rw(CARD32 addr) +{ + return (*Int10Current->mem->rw)(Int10Current, addr); +} + +CARD32 +Mem_rl(CARD32 addr) +{ + return (*Int10Current->mem->rl)(Int10Current, addr); +} + +void +Mem_wb(CARD32 addr, CARD8 val) +{ + (*Int10Current->mem->wb)(Int10Current, addr, val); +} + +void +Mem_ww(CARD32 addr, CARD16 val) +{ + (*Int10Current->mem->ww)(Int10Current, addr, val); +} + +void +Mem_wl(CARD32 addr, CARD32 val) +{ + (*Int10Current->mem->wl)(Int10Current, addr, val); +} + +static CARD32 PciCfg1Addr = 0; + +#define PCI_DOM_FROM_TAG(tag) (((tag) >> 24) & (PCI_DOM_MASK)) +#define PCI_BUS_FROM_TAG(tag) (((tag) >> 16) & (PCI_DOMBUS_MASK)) +#define PCI_DEV_FROM_TAG(tag) (((tag) & 0x0000f800u) >> 11) +#define PCI_FUNC_FROM_TAG(tag) (((tag) & 0x00000700u) >> 8) + +#define PCI_OFFSET(x) ((x) & 0x000000ff) +#define PCI_TAG(x) ((x) & 0x7fffff00) + +static struct pci_device* +pci_device_for_cfg_address (CARD32 addr) +{ + struct pci_device *dev = NULL; + PCITAG tag = PCI_TAG(addr); + struct pci_slot_match slot_match = { + .domain = PCI_DOM_FROM_TAG(tag), + .bus = PCI_BUS_NO_DOMAIN(PCI_BUS_FROM_TAG(tag)), + .dev = PCI_DEV_FROM_TAG(tag), + .func = PCI_FUNC_FROM_TAG(tag), + .match_data = 0 + }; + + struct pci_device_iterator *iter = + pci_slot_match_iterator_create (&slot_match); + + if (iter) + dev = pci_device_next(iter); + + pci_iterator_destroy(iter); + + return dev; +} + +static int +pciCfg1in(CARD16 addr, CARD32 *val) +{ + if (addr == 0xCF8) { + *val = PciCfg1Addr; + return 1; + } + if (addr == 0xCFC) { + pci_device_cfg_read_u32(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr)); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_inl(%#lx) = %8.8lx\n", PciCfg1Addr, *val); + return 1; + } + return 0; +} + +static int +pciCfg1out(CARD16 addr, CARD32 val) +{ + if (addr == 0xCF8) { + PciCfg1Addr = val; + return 1; + } + if (addr == 0xCFC) { + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_outl(%#lx, %8.8lx)\n", PciCfg1Addr, val); + pci_device_cfg_write_u32(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr)); + return 1; + } + return 0; +} + +static int +pciCfg1inw(CARD16 addr, CARD16 *val) +{ + int shift; + + if ((addr >= 0xCF8) && (addr <= 0xCFB)) { + shift = (addr - 0xCF8) * 8; + *val = (PciCfg1Addr >> shift) & 0xffff; + return 1; + } + if ((addr >= 0xCFC) && (addr <= 0xCFF)) { + const unsigned offset = addr - 0xCFC; + + pci_device_cfg_read_u16(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_inw(%#lx) = %4.4x\n", PciCfg1Addr + offset, *val); + return 1; + } + return 0; +} + +static int +pciCfg1outw(CARD16 addr, CARD16 val) +{ + int shift; + + if ((addr >= 0xCF8) && (addr <= 0xCFB)) { + shift = (addr - 0xCF8) * 8; + PciCfg1Addr &= ~(0xffff << shift); + PciCfg1Addr |= ((CARD32) val) << shift; + return 1; + } + if ((addr >= 0xCFC) && (addr <= 0xCFF)) { + const unsigned offset = addr - 0xCFC; + + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_outw(%#lx, %4.4x)\n", PciCfg1Addr + offset, val); + pci_device_cfg_write_u16(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); + return 1; + } + return 0; +} + +static int +pciCfg1inb(CARD16 addr, CARD8 *val) +{ + int shift; + + if ((addr >= 0xCF8) && (addr <= 0xCFB)) { + shift = (addr - 0xCF8) * 8; + *val = (PciCfg1Addr >> shift) & 0xff; + return 1; + } + if ((addr >= 0xCFC) && (addr <= 0xCFF)) { + const unsigned offset = addr - 0xCFC; + + pci_device_cfg_read_u8(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_inb(%#lx) = %2.2x\n", PciCfg1Addr + offset, *val); + return 1; + } + return 0; +} + +static int +pciCfg1outb(CARD16 addr, CARD8 val) +{ + int shift; + + if ((addr >= 0xCF8) && (addr <= 0xCFB)) { + shift = (addr - 0xCF8) * 8; + PciCfg1Addr &= ~(0xff << shift); + PciCfg1Addr |= ((CARD32) val) << shift; + return 1; + } + if ((addr >= 0xCFC) && (addr <= 0xCFF)) { + const unsigned offset = addr - 0xCFC; + + if (PRINT_PORT && DEBUG_IO_TRACE()) + ErrorF(" cfg_outb(%#lx, %2.2x)\n", PciCfg1Addr + offset, val); + pci_device_cfg_write_u8(pci_device_for_cfg_address(PciCfg1Addr), + val, PCI_OFFSET(PciCfg1Addr) + offset); + return 1; + } + return 0; +} + +CARD8 +bios_checksum(const CARD8 *start, int size) +{ + CARD8 sum = 0; + + while (size-- > 0) + sum += *start++; + return sum; +} + +/* + * Lock/Unlock legacy VGA. Some Bioses try to be very clever and make + * an attempt to detect a legacy ISA card. If they find one they might + * act very strange: for example they might configure the card as a + * monochrome card. This might cause some drivers to choke. + * To avoid this we attempt legacy VGA by writing to all know VGA + * disable registers before we call the BIOS initialization and + * restore the original values afterwards. In beween we hold our + * breath. To get to a (possibly exising) ISA card need to disable + * our current PCI card. + */ +/* + * This is just for booting: we just want to catch pure + * legacy vga therefore we don't worry about mmio etc. + * This stuff should really go into vgaHW.c. However then + * the driver would have to load the vga-module prior to + * doing int10. + */ +void +LockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) +{ + vga->save_msr = inb(pInt->ioBase + 0x03CC); + vga->save_vse = inb(pInt->ioBase + 0x03C3); +#ifndef __ia64__ + vga->save_46e8 = inb(pInt->ioBase + 0x46E8); +#endif + vga->save_pos102 = inb(pInt->ioBase + 0x0102); + outb(pInt->ioBase + 0x03C2, ~(CARD8)0x03 & vga->save_msr); + outb(pInt->ioBase + 0x03C3, ~(CARD8)0x01 & vga->save_vse); +#ifndef __ia64__ + outb(pInt->ioBase + 0x46E8, ~(CARD8)0x08 & vga->save_46e8); +#endif + outb(pInt->ioBase + 0x0102, ~(CARD8)0x01 & vga->save_pos102); +} + +void +UnlockLegacyVGA(xf86Int10InfoPtr pInt, legacyVGAPtr vga) +{ + outb(pInt->ioBase + 0x0102, vga->save_pos102); +#ifndef __ia64__ + outb(pInt->ioBase + 0x46E8, vga->save_46e8); +#endif + outb(pInt->ioBase + 0x03C3, vga->save_vse); + outb(pInt->ioBase + 0x03C2, vga->save_msr); +} + +#if defined (_PC) +static void +SetResetBIOSVars(xf86Int10InfoPtr pInt, Bool set) +{ + int pagesize = getpagesize(); + unsigned char* base = xf86MapVidMem(pInt->scrnIndex, + VIDMEM_MMIO, 0, pagesize); + int i; + + if (set) { + for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++) + MEM_WW(pInt, i, *(base + i)); + } else { + for (i = BIOS_SCRATCH_OFF; i < BIOS_SCRATCH_END; i++) + *(base + i) = MEM_RW(pInt, i); + } + + xf86UnMapVidMem(pInt->scrnIndex,base,pagesize); +} + +void +xf86Int10SaveRestoreBIOSVars(xf86Int10InfoPtr pInt, Bool save) +{ + int pagesize = getpagesize(); + unsigned char* base; + int i; + + if (!xf86IsEntityPrimary(pInt->entityIndex) + || (!save && !pInt->BIOSScratch)) + return; + + base = xf86MapVidMem(pInt->scrnIndex, VIDMEM_MMIO, 0, pagesize); + base += BIOS_SCRATCH_OFF; + if (save) { + if ((pInt->BIOSScratch + = xnfalloc(BIOS_SCRATCH_LEN))) + for (i = 0; i < BIOS_SCRATCH_LEN; i++) + *(((char*)pInt->BIOSScratch + i)) = *(base + i); + } else { + if (pInt->BIOSScratch) { + for (i = 0; i < BIOS_SCRATCH_LEN; i++) + *(base + i) = *(pInt->BIOSScratch + i); + free(pInt->BIOSScratch); + pInt->BIOSScratch = NULL; + } + } + + xf86UnMapVidMem(pInt->scrnIndex,base - BIOS_SCRATCH_OFF ,pagesize); +} +#endif + +xf86Int10InfoPtr +xf86InitInt10(int entityIndex) +{ + return xf86ExtendedInitInt10(entityIndex, 0); +} diff --git a/xorg-server/hw/xfree86/loader/loader.c b/xorg-server/hw/xfree86/loader/loader.c index dce3b22f6..159b61198 100644 --- a/xorg-server/hw/xfree86/loader/loader.c +++ b/xorg-server/hw/xfree86/loader/loader.c @@ -1,228 +1,208 @@ -/*
- * Copyright 1995-1998 by Metro Link, Inc.
- *
- * 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 Metro Link, Inc. not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. Metro Link, Inc. makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL METRO LINK, INC. 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.
- */
-/*
- * 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 <xorg-config.h>
-#endif
-
-#include <errno.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <sys/types.h>
-#include <unistd.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <string.h>
-#include <stdarg.h>
-
-#include "os.h"
-#include "loader.h"
-#include "loaderProcs.h"
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "compiler.h"
-
-#ifdef HAVE_DLFCN_H
-
-#include <dlfcn.h>
-#include <X11/Xos.h>
-
-#if defined(DL_LAZY)
-#define DLOPEN_LAZY DL_LAZY
-#elif defined(RTLD_LAZY)
-#define DLOPEN_LAZY RTLD_LAZY
-#elif defined(__FreeBSD__)
-#define DLOPEN_LAZY 1
-#else
-#define DLOPEN_LAZY 0
-#endif
-
-#if defined(LD_GLOBAL)
-#define DLOPEN_GLOBAL LD_GLOBAL
-#elif defined(RTLD_GLOBAL)
-#define DLOPEN_GLOBAL RTLD_GLOBAL
-#else
-#define DLOPEN_GLOBAL 0
-#endif
-
-#else
-#error i have no dynamic linker and i must scream
-#endif
-
-extern void *xorg_symbols[];
-
-void
-LoaderInit(void)
-{
- xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *)xorg_symbols);
- xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n");
- xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC,
- GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion),
- GET_ABI_MINOR(LoaderVersionInfo.ansicVersion));
- xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV,
- GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion),
- GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion));
- xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT,
- GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion),
- GET_ABI_MINOR(LoaderVersionInfo.xinputVersion));
- xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION,
- GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion),
- GET_ABI_MINOR(LoaderVersionInfo.extensionVersion));
-
-#if defined(__UNIXWARE__) && !defined(__GNUC__)
- /* For UnixWare we need to load the C Runtime libraries which are
- * normally auto-linked by the compiler. Otherwise we are bound to
- * see unresolved symbols when trying to use the type "long long".
- * Obviously, this does not apply if the GNU C compiler is used.
- */
- {
- int errmaj, errmin, wasLoaded; /* place holders */
- char *xcrtpath = DEFAULT_MODULE_PATH "/libcrt.a";
- char *uwcrtpath = "/usr/ccs/lib/libcrt.a";
- char *path;
- struct stat st;
-
- if(stat(xcrtpath, &st) < 0)
- path = uwcrtpath; /* fallback: try to get libcrt.a from the uccs */
- else
- path = xcrtpath; /* get the libcrt.a we compiled with */
- LoaderOpen (path, &errmaj, &errmin, &wasLoaded, 0);
- }
-#endif
-}
-
-/* Public Interface to the loader. */
-
-void *
-LoaderOpen(const char *module, int *errmaj, int *errmin)
-{
- void *ret;
-
-#if defined(DEBUG)
- ErrorF("LoaderOpen(%s)\n", module);
-#endif
-
- xf86Msg(X_INFO, "Loading %s\n", module);
-
- if (!(ret = dlopen(module, DLOPEN_LAZY | DLOPEN_GLOBAL))) {
- xf86Msg(X_ERROR, "Failed to load %s: %s\n", module, dlerror());
- if (errmaj)
- *errmaj = LDR_NOLOAD;
- if (errmin)
- *errmin = LDR_NOLOAD;
- return NULL;
- }
-
- return ret;
-}
-
-void *
-LoaderSymbol(const char *name)
-{
- static void *global_scope = NULL;
- void *p;
-
- p = dlsym(RTLD_DEFAULT, name);
- if (p != NULL)
- return p;
-
- if (!global_scope)
- global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL);
-
- if (global_scope)
- return dlsym(global_scope, name);
-
- return NULL;
-}
-
-void
-LoaderUnload(const char *name, void *handle)
-{
- xf86Msg(X_INFO, "Unloading %s\n", name);
- if (handle)
- dlclose(handle);
-}
-
-unsigned long LoaderOptions = 0;
-
-void
-LoaderSetOptions(unsigned long opts)
-{
- LoaderOptions |= opts;
-}
-
-Bool
-LoaderShouldIgnoreABI(void)
-{
- return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0;
-}
-
-int
-LoaderGetABIVersion(const char *abiclass)
-{
- struct {
- const char *name;
- int version;
- } classes[] = {
- { ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion },
- { ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion },
- { ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion },
- { ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion },
- { ABI_CLASS_FONT, LoaderVersionInfo.fontVersion },
- { NULL, 0 }
- };
- int i;
-
- for(i = 0; classes[i].name; i++) {
- if(!strcmp(classes[i].name, abiclass)) {
- return classes[i].version;
- }
- }
-
- return 0;
-}
+/* + * Copyright 1995-1998 by Metro Link, Inc. + * + * 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 Metro Link, Inc. not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Metro Link, Inc. makes no + * representations about the suitability of this software for any purpose. + * It is provided "as is" without express or implied warranty. + * + * METRO LINK, INC. DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL METRO LINK, INC. 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. + */ +/* + * 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 <xorg-config.h> +#endif + +#include <errno.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/types.h> +#include <unistd.h> +#include <sys/stat.h> +#include <fcntl.h> +#include <string.h> +#include <stdarg.h> + +#include "os.h" +#include "loader.h" +#include "loaderProcs.h" +#include "xf86.h" +#include "xf86Priv.h" +#include "compiler.h" + +#ifdef HAVE_DLFCN_H + +#include <dlfcn.h> +#include <X11/Xos.h> + +#if defined(DL_LAZY) +#define DLOPEN_LAZY DL_LAZY +#elif defined(RTLD_LAZY) +#define DLOPEN_LAZY RTLD_LAZY +#elif defined(__FreeBSD__) +#define DLOPEN_LAZY 1 +#else +#define DLOPEN_LAZY 0 +#endif + +#if defined(LD_GLOBAL) +#define DLOPEN_GLOBAL LD_GLOBAL +#elif defined(RTLD_GLOBAL) +#define DLOPEN_GLOBAL RTLD_GLOBAL +#else +#define DLOPEN_GLOBAL 0 +#endif + +#else +#error i have no dynamic linker and i must scream +#endif + +extern void *xorg_symbols[]; + +void +LoaderInit(void) +{ + xf86MsgVerb(X_INFO, 2, "Loader magic: %p\n", (void *)xorg_symbols); + xf86MsgVerb(X_INFO, 2, "Module ABI versions:\n"); + xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_ANSIC, + GET_ABI_MAJOR(LoaderVersionInfo.ansicVersion), + GET_ABI_MINOR(LoaderVersionInfo.ansicVersion)); + xf86ErrorFVerb(2, "\t%s: %d.%d\n", ABI_CLASS_VIDEODRV, + GET_ABI_MAJOR(LoaderVersionInfo.videodrvVersion), + GET_ABI_MINOR(LoaderVersionInfo.videodrvVersion)); + xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_XINPUT, + GET_ABI_MAJOR(LoaderVersionInfo.xinputVersion), + GET_ABI_MINOR(LoaderVersionInfo.xinputVersion)); + xf86ErrorFVerb(2, "\t%s : %d.%d\n", ABI_CLASS_EXTENSION, + GET_ABI_MAJOR(LoaderVersionInfo.extensionVersion), + GET_ABI_MINOR(LoaderVersionInfo.extensionVersion)); + +} + +/* Public Interface to the loader. */ + +void * +LoaderOpen(const char *module, int *errmaj, int *errmin) +{ + void *ret; + +#if defined(DEBUG) + ErrorF("LoaderOpen(%s)\n", module); +#endif + + xf86Msg(X_INFO, "Loading %s\n", module); + + if (!(ret = dlopen(module, DLOPEN_LAZY | DLOPEN_GLOBAL))) { + xf86Msg(X_ERROR, "Failed to load %s: %s\n", module, dlerror()); + if (errmaj) + *errmaj = LDR_NOLOAD; + if (errmin) + *errmin = LDR_NOLOAD; + return NULL; + } + + return ret; +} + +void * +LoaderSymbol(const char *name) +{ + static void *global_scope = NULL; + void *p; + + p = dlsym(RTLD_DEFAULT, name); + if (p != NULL) + return p; + + if (!global_scope) + global_scope = dlopen(NULL, DLOPEN_LAZY | DLOPEN_GLOBAL); + + if (global_scope) + return dlsym(global_scope, name); + + return NULL; +} + +void +LoaderUnload(const char *name, void *handle) +{ + xf86Msg(X_INFO, "Unloading %s\n", name); + if (handle) + dlclose(handle); +} + +unsigned long LoaderOptions = 0; + +void +LoaderSetOptions(unsigned long opts) +{ + LoaderOptions |= opts; +} + +Bool +LoaderShouldIgnoreABI(void) +{ + return (LoaderOptions & LDR_OPT_ABI_MISMATCH_NONFATAL) != 0; +} + +int +LoaderGetABIVersion(const char *abiclass) +{ + struct { + const char *name; + int version; + } classes[] = { + { ABI_CLASS_ANSIC, LoaderVersionInfo.ansicVersion }, + { ABI_CLASS_VIDEODRV, LoaderVersionInfo.videodrvVersion }, + { ABI_CLASS_XINPUT, LoaderVersionInfo.xinputVersion }, + { ABI_CLASS_EXTENSION, LoaderVersionInfo.extensionVersion }, + { ABI_CLASS_FONT, LoaderVersionInfo.fontVersion }, + { NULL, 0 } + }; + int i; + + for(i = 0; classes[i].name; i++) { + if(!strcmp(classes[i].name, abiclass)) { + return classes[i].version; + } + } + + return 0; +} diff --git a/xorg-server/hw/xfree86/loader/os.c b/xorg-server/hw/xfree86/loader/os.c index 5acce0024..6b5ac7e86 100644 --- a/xorg-server/hw/xfree86/loader/os.c +++ b/xorg-server/hw/xfree86/loader/os.c @@ -50,8 +50,6 @@ #define OSNAME "openbsd" #elif defined(__GNU__) #define OSNAME "hurd" -#elif defined(__SCO__) -#define OSNAME "sco" #elif defined(SVR4) && defined(sun) #define OSNAME "solaris" #elif defined(SVR5) diff --git a/xorg-server/hw/xfree86/os-support/Makefile.am b/xorg-server/hw/xfree86/os-support/Makefile.am index c0504d5eb..3af4328ff 100644 --- a/xorg-server/hw/xfree86/os-support/Makefile.am +++ b/xorg-server/hw/xfree86/os-support/Makefile.am @@ -1,26 +1,26 @@ -SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS)
-DIST_SUBDIRS = bsd bus misc linux solaris sco hurd
-
-sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h
-
-EXTRA_DIST = int10Defines.h xf86OSpriv.h
-
-# to get the grouping semantics right, you have to glom these three together
-# as one library, otherwise libtool will actively defeat your attempts to
-# list them multiple times on the link line.
-noinst_LTLIBRARIES = libxorgos.la
-libxorgos_la_SOURCES = xorgos.c
-libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \
- bus/libbus.la \
- misc/libmisc.la
-
-AM_CFLAGS = $(DIX_CFLAGS)
-
-xorgos.c:
- touch $@
-
-DISTCLEANFILES = xorgos.c
-
-# FIXME: These don't seem to be used anywhere
-EXTRA_DIST += \
- shared/bios_devmem.c
+SUBDIRS = bus @XORG_OS_SUBDIR@ misc $(DRI_SUBDIRS) +DIST_SUBDIRS = bsd bus misc linux solaris hurd + +sdk_HEADERS = xf86_OSproc.h xf86_OSlib.h + +EXTRA_DIST = int10Defines.h xf86OSpriv.h + +# to get the grouping semantics right, you have to glom these three together +# as one library, otherwise libtool will actively defeat your attempts to +# list them multiple times on the link line. +noinst_LTLIBRARIES = libxorgos.la +libxorgos_la_SOURCES = xorgos.c +libxorgos_la_LIBADD = @XORG_OS_SUBDIR@/lib@XORG_OS_SUBDIR@.la \ + bus/libbus.la \ + misc/libmisc.la + +AM_CFLAGS = $(DIX_CFLAGS) + +xorgos.c: + touch $@ + +DISTCLEANFILES = xorgos.c + +# FIXME: These don't seem to be used anywhere +EXTRA_DIST += \ + shared/bios_devmem.c diff --git a/xorg-server/hw/xfree86/os-support/sco/Makefile.am b/xorg-server/hw/xfree86/os-support/sco/Makefile.am deleted file mode 100644 index b5d40f7a5..000000000 --- a/xorg-server/hw/xfree86/os-support/sco/Makefile.am +++ /dev/null @@ -1,5 +0,0 @@ -EXTRA_DIST = \ - VTsw_sco.c \ - sco_init.c \ - sco_iop.c \ - sco_video.c diff --git a/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c b/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c deleted file mode 100644 index c9ef7d5cd..000000000 --- a/xorg-server/hw/xfree86/os-support/sco/VTsw_sco.c +++ /dev/null @@ -1,127 +0,0 @@ -/*
- * Copyright 1993 by David Wexelblat <dwex@goblin.org>
- * Copyright 1993 by David McCullough <davidm@stallion.oz.au>
- *
- * 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 David Wexelblat not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. David Wexelblat makes no representations
- * about the suitability of this software for any purpose. It is provided
- * "as is" without express or implied warranty.
- *
- * DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL DAVID WEXELBLAT 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_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-/* For the event driver prototypes */
-#include <sys/event.h>
-#include <mouse.h>
-
-/*
- * Handle the VT-switching interface for SCO
- */
-
-/*
- * This function is the signal handler for the VT-switching signal. It
- * is only referenced inside the OS-support layer. NOTE: we do NOT need
- * to re-arm the signal here, since we used sigaction() to set the signal
- * disposition in sco_init.c. If we had used signal(), we would need to
- * re-arm the signal here. All we need to do now is record the fact that
- * we got the signal. XFree86 handles the rest.
- */
-void
-xf86VTRequest(int sig)
-{
- xf86Info.vtRequestsPending = TRUE;
- return;
-}
-
-Bool
-xf86VTSwitchPending(void)
-{
- return xf86Info.vtRequestsPending ? TRUE : FALSE;
-}
-
-/*
- * When we switch away, we need to flush and suspend the event driver
- * before the VT_RELDISP. We also need to get the current LED status
- * and preserve it, so that we can restore it when we come back.
- */
-static int sco_ledstatus = -1;
-static unsigned int sco_ledstate = 0;
-
-Bool
-xf86VTSwitchAway(void)
-{
- ev_flush();
- ev_suspend();
-
- sco_ledstatus = ioctl(xf86Info.consoleFd, KDGETLED, &sco_ledstate);
-
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_TRUE) < 0) {
- return FALSE;
- } else {
- return TRUE;
- }
-}
-
-/*
- * When we come back to the X server, we need to resume the event driver,
- * and we need to restore the LED settings to what they were when we
- * switched away.
- */
-Bool
-xf86VTSwitchTo(void)
-{
- ev_resume();
-
- xf86Info.vtRequestsPending = FALSE;
- if (ioctl(xf86Info.consoleFd, VT_RELDISP, VT_ACKACQ) < 0) {
- return FALSE;
- } else {
- if (sco_ledstatus >= 0) {
- ioctl (xf86Info.consoleFd, KDSETLED, sco_ledstate);
- }
- sco_ledstatus = -1;
-
- /*
- * Convince the console driver this screen is in graphics mode,
- * otherwise it assumes it can do more to the screen than it should.
- */
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
- ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
- }
-
- return TRUE;
- }
-}
-
-Bool
-xf86VTActivate(int vtno)
-{
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, vtno - 1) < 0) {
- return FALSE;
- }
-
- return TRUE;
-}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_init.c b/xorg-server/hw/xfree86/os-support/sco/sco_init.c deleted file mode 100644 index fd4c898dd..000000000 --- a/xorg-server/hw/xfree86/os-support/sco/sco_init.c +++ /dev/null @@ -1,294 +0,0 @@ -/*
- * Copyright 2001-2005 by J. Kean Johnston <jkj@sco.com>
- *
- * 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 J. Kean Johnston not be used in
- * advertising or publicity pertaining to distribution of the software without
- * specific, written prior permission. J. Kean Johnston makes no
- * representations about the suitability of this software for any purpose.
- * It is provided "as is" without express or implied warranty.
- *
- * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- * EVENT SHALL J. KEAN JOHNSTON 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.
- */
-
-/* Re-written May 2001 to represent the current state of reality */
-
-#ifdef HAVE_XORG_CONFIG_H
-#include <xorg-config.h>
-#endif
-
-#include <X11/X.h>
-#include <X11/Xmd.h>
-
-#include "compiler.h"
-
-#include "xf86.h"
-#include "xf86Priv.h"
-#include "xf86_OSlib.h"
-
-static Bool KeepTty = FALSE;
-static int VTnum = -1;
-static char vtdevice[48];
-static int sco_console_mode = -1;
-
-extern Bool mpxLock;
-
-void
-xf86OpenConsole(void)
-{
- int i, ioctl_ret;
- struct vt_mode VT;
- struct vid_info vidinf;
- struct sigaction sigvtsw;
- char *ttn;
-
- if (serverGeneration == 1) {
- /* check if we're run with euid==0 */
- if (geteuid() != 0) {
- FatalError("xf86OpenConsole: Server must be setuid root\n");
- }
-
- /* If we are run in the background we will get SIGTTOU. Ignore it. */
- OsSignal (SIGTTOU, SIG_IGN);
-
- /*
- * Set up the virtual terminal (multiscreen in SCO parlance).
- * For the actual console itself, screens are numbered from
- * 1 to (usually) 16. However, it is possible to have a nested
- * server, and it is also possible to be on a multi-console
- * system such as MaxSpeed or SunRiver. Therefore, we should
- * not make any assumptions about the TTY name we are on, and
- * instead we rely on ttyname() to give us the real TTY name.
- * Previously, we tried to determine the TTY name manually.
- * This is wrong. The only time we need to futz with the TTY name
- * is if we were given the name of a TTY to run on explicity on
- * the command line.
- */
-
- if (VTnum == -1) {
- /*
- * No device was specified. We need to query the kernel to see which
- * console device we are on (and in fact if we are on a console at all).
- */
- ttn = ttyname (1);
-
- if (ttn == (char *)0) {
- FatalError ("xf86OpenConsole: Could not determine TTY name: %s\n",
- strerror(errno));
- }
- strlcpy (vtdevice, ttn, sizeof(vtdevice));
- } else if (VTnum >= 0) {
- snprintf (vtdevice, sizeof(vtdevice), "/dev/tty%02d", VTnum);
- }
-
- /*
- * Now we can dispose of stdin/stdout
- */
- fclose (stdin);
- fclose (stdout);
-
- if ((xf86Info.consoleFd = open(vtdevice, O_RDWR | O_NDELAY, 0)) < 0) {
- FatalError("xf86OpenConsole: Cannot open %s: %s\n", vtdevice,
- strerror(errno));
- }
-
- /*
- * We make 100% sure we use the correct VT number. This can get ugly
- * where there are multi-consoles in use, so we make sure we query
- * the kernel for the correct VT number. It knows best, we don't.
- */
- vidinf.size = sizeof(vidinf);
- if (ioctl (xf86Info.consoleFd, CONS_GETINFO, &vidinf) < 0) {
- FatalError ("xf86OpenConsole: %s not a console device "
- "or error querying device: %s\n", vtdevice, strerror (errno));
- }
- xf86Info.vtno = vidinf.m_num;
- VTnum = vidinf.m_num + 1; /* 0-based */
-
- ErrorF("(using VT%02d device %s)\n\n", VTnum, vtdevice);
-
- /* We activate the console just in case its not the one we are on */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
- }
-
- /* Disassociate from controling TTY */
- if (!KeepTty) {
- setpgrp();
- }
-
- /*
- * Now we get the current mode that the console device is in. We will
- * use this later when we close the console device to restore it to
- * that same mode.
- */
- if ((sco_console_mode = ioctl(xf86Info.consoleFd, CONS_GET, 0L)) < 0) {
- FatalError("xf86OpenConsole: CONS_GET failed on console (%s)\n",
- strerror(errno));
- }
-
- if (ioctl(xf86Info.consoleFd, VT_GETMODE, &VT) < 0) {
- FatalError("xf86OpenConsole: VT_GETMODE failed (%s)\n", strerror(errno));
- }
-
- sigvtsw.sa_handler = xf86VTRequest;
- sigfillset(&sigvtsw.sa_mask);
- sigvtsw.sa_flags = 0;
-
- /* NOTE: Using sigaction means we dont have to re-arm the signal */
- sigaction(SIGUSR1, &sigvtsw, NULL);
-
- VT.mode = VT_PROCESS;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- VT.frsig = SIGINT; /* Not implemented */
- VT.waitv = 0;
-
- /*
- * The SCO X server tries the following call 5 times. Lets do the same
- * thing. It shouldn't really be required but sometimes things take a
- * while to settle down when switching screens. *helpless shrug* I know
- * its sucks but ...
- */
-
- ioctl_ret = 0;
- for (i = 0; i < 5; i++) {
- ioctl_ret = ioctl(xf86Info.consoleFd, VT_SETMODE, &VT);
- if (ioctl_ret >= 0)
- break;
- usleep(999999); /* Dont use nap() - it forces linking with -lx */
- }
-
- if (ioctl_ret < 0) {
- FatalError("xf86OpenConsole: VT_SETMODE failed (%s)\n", strerror(errno));
- }
-
- /*
- * Convince the console driver we are in graphics mode.
- */
- if (ioctl(xf86Info.consoleFd, KDSETMODE, KD_GRAPHICS) < 0) {
- ErrorF("Failed to set graphics mode (%s)\n", strerror(errno));
- }
- } else { /* serverGeneration != 1 */
- if (ioctl(xf86Info.consoleFd, VT_ACTIVATE, xf86Info.vtno) != 0) {
- ErrorF("xf86OpenConsole: VT_ACTIVATE failed (%s)\n", strerror(errno));
- }
- }
-}
-
-/*
- * Restore the console to its previous state. This may cause flicker if
- * the screen was previous in a graphics mode, because we first set it
- * to text mode. This has the advantage of getting the console driver
- * to do a soft reset on the card, which really does help settle the
- * video card down again after coming out of Xfree86.
- */
-void
-xf86CloseConsole(void)
-{
- struct vt_mode VT;
- struct sigaction sigvtsw;
-
- /* Set text mode (possibly briefly) */
- ioctl(xf86Info.consoleFd, KDSETMODE, KD_TEXT0);
-
- /* Restore the original mode */
- if (sco_console_mode != -1) {
- ioctl(xf86Info.consoleFd, MODESWITCH | sco_console_mode, 0L);
- }
-
- ioctl(xf86Info.consoleFd, VT_RELDISP, 1); /* Release the display */
-
- sigvtsw.sa_handler = SIG_DFL;
- sigfillset(&sigvtsw.sa_mask);
- sigvtsw.sa_flags = 0;
-
- sigaction(SIGUSR1, &sigvtsw, NULL);
-
- VT.mode = VT_AUTO;
- VT.waitv = 0;
- VT.relsig = SIGUSR1;
- VT.acqsig = SIGUSR1;
- VT.frsig = SIGINT;
- ioctl(xf86Info.consoleFd, VT_SETMODE, &VT); /* Revert to auto handling */
-
- close(xf86Info.consoleFd); /* We're done with the device */
-}
-
-int
-xf86ProcessArgument(int argc, char *argv[], int i)
-{
- /*
- * Keep server from detaching from controlling tty. This is useful
- * when debugging (so the server can receive keyboard signals).
- */
- if (!strcmp(argv[i], "-keeptty")) {
- KeepTty = TRUE;
- return 1;
- }
-
- /*
- * By default, the X server wants to bind itself to CPU 0. This makes
- * sure that the server has full access to the I/O ports at IOPL 3.
- * Some SMP systems have trouble with I/O on CPU's other than 0. If,
- * however, you have a system that is well behaved, you can specify
- * this argument and let the scheduler decide which CPU the server
- * should run on.
- */
- if (!strcmp(argv[i], "-nompxlock")) {
- mpxLock = FALSE;
- return 1;
- }
-
- /*
- * Specify the VT number to run on (NOT the device).
- */
- if ((argv[i][0] == 'v') && (argv[i][1] == 't')) {
- if (sscanf(argv[i], "vt%2d", &VTnum) == 0) {
- UseMsg();
- VTnum = -1;
- return 0;
- }
- if (VTnum <= 0) {
- UseMsg();
- VTnum = -1;
- return 0;
- }
- return 1;
- }
-
- /*
- * Use a device the user specifies.
- */
- if (!strcmp(argv[i], "-crt")) {
- if (++i > argc) {
- UseMsg();
- VTnum = -1;
- return 0;
- } else {
- VTnum = -2;
- strlcpy (vtdevice, argv[i], sizeof(vtdevice));
- return 2;
- }
- }
- return 0;
-}
-
-void
-xf86UseMsg(void)
-{
- ErrorF("vtXX use the specified VT number\n");
- ErrorF("-crt DEVICE use the specified VT device\n");
- ErrorF("-nompxlock dont bind X server to CPU 0\n");
- ErrorF("-keeptty ");
- ErrorF("don't detach controlling tty (for debugging only)\n");
-}
diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_iop.c b/xorg-server/hw/xfree86/os-support/sco/sco_iop.c deleted file mode 100644 index 3da4fcf3a..000000000 --- a/xorg-server/hw/xfree86/os-support/sco/sco_iop.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2001 by J. Kean Johnston <jkj@caldera.com> - * - * 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 J. Kean Johnston not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. J. Kean Johnston makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL J. KEAN JOHNSTON 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_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> - -#include "compiler.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86OSpriv.h" -#include "xf86_OSlib.h" - - -/***************************************************************************/ -/* I/O Permissions section */ -/***************************************************************************/ - -/* - * There is a right way and a wrong way of doing this. Unfortunately, we - * are forced to do it the wrong way. The right way is to be told the range - * or ranges of I/O ports the driver(s) need access to, in order to use the - * CONS_IOPERM ioctl() to grant access only to those ports we care about. - * This way we can guarantee some small level of stability because a driver - * does not have access to all ports (which would mean it could play with - * the PIT and thus affect scheduling times, or a whole slew of other - * nasty things). However, because XFree86 currently only enables or disables - * ALL port access, we need to run at IOPL 3, which basically means the - * X Server runs at the same level as the kernel. You can image why this is - * unsafe. Oh, and this is not a problem unique to OSR5, other OSes are - * affected by this as well. - * - * So, for the time being, we change our IOPL until such time as the XFree86 - * architecture is changed to allow for tighter control of I/O ports. If and - * when it is, then the CONS_ADDIOP/DELIOP ioctl() should be used to enable - * or disable access to the desired ports. - */ - -extern long sysi86 (int cmd, ...); - -static Bool IOEnabled = FALSE; - -Bool -xf86EnableIO(void) -{ - if (IOEnabled) - return TRUE; - - if (sysi86(SI86V86, V86SC_IOPL, PS_IOPL) < 0) { - xf86Msg(X_WARNING,"Failed to set IOPL for extended I/O\n"); - return FALSE; - } - - IOEnabled = TRUE; - return TRUE; -} - -void -xf86DisableIO(void) -{ - if (!IOEnabled) - return; - - sysi86(SI86V86, V86SC_IOPL, 0); - IOEnabled = FALSE; -} diff --git a/xorg-server/hw/xfree86/os-support/sco/sco_video.c b/xorg-server/hw/xfree86/os-support/sco/sco_video.c deleted file mode 100644 index f63b71df8..000000000 --- a/xorg-server/hw/xfree86/os-support/sco/sco_video.c +++ /dev/null @@ -1,290 +0,0 @@ -/* - * Copyright 2001 by J. Kean Johnston <jkj@sco.com> - * - * 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 J. Kean Johnston not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. J. Kean Johnston makes no - * representations about the suitability of this software for any purpose. - * It is provided "as is" without express or implied warranty. - * - * J. KEAN JOHNSTON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL J. KEAN JOHNSTON 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. - */ - -/* Re-written May 2001 to represent the current state of reality */ - -/* - * This file contains the completely re-written SCO OpenServer video - * routines for XFree86 4.x. Much of this is based on the SCO X server - * code (which is an X11R5 server) and will probably only work on - * OpenServer versions 5.0.5, 5.0.6 and later. Please send me (jkj@sco.com) - * email if you have any questions. - * - * Ideally, you should use OSR5.0.6A or later, with the updated console - * driver for 5.0.6A (its the default driver in 5.0.7 and later). - * However, if you are running on an older system, this code will detect - * that and adjust accordingly. - */ - -#ifdef HAVE_XORG_CONFIG_H -#include <xorg-config.h> -#endif - -#include <X11/X.h> -#include "input.h" -#include "scrnintstr.h" - -#define _NEED_SYSI86 -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86OSpriv.h" -#include "xf86_OSlib.h" - -#include <sys/ci/ciioctl.h> -#define MPXNAME "/dev/atp1" -#define BASECPU 1 - -Bool mpxLock = TRUE; - -#define USE_VASMETHOD 1 - -/***************************************************************************/ -/* Video Memory Mapping section */ -/***************************************************************************/ - -static int sco_mcdone = 0, sco_ismc = 0; - -/***************************************************************************/ -/* - * To map the video memory, we first need to see if we are on a multi-console - * system. If we are, we need to try to use an existing video class in the - * kernel. We do this by retrieving the list of currently defined classes - * (via the new CONS_GETCLASS ioctl()) to see if we have a class that will - * match the range of memory we desire. If we can't find one, we have an - * error and we abort. - * - * If we are not using a multi-console, we can simply use mmap() to map in - * the frame buffer, using the classs-access method as a fall-back only if - * the mmap() fails (it shouldn't). We always set the appropriate pointers - * in the config structure to point ot the right function to map and unmap - * the video memory. An alternative to using mmap() is to use the new - * CONS_ADDVAS call, which will use vasmalloc() and vasbind() in the kernel - * to map the physical address to a virtual one, which it then returns. - * I am not 100% sure if this is faster or not, but it may prove easier to - * debug things. Just to be on the safe side, I have included both methods - * here, and the mmap() method can be used by setting USE_VASMETHOD to 0 - * above. - */ - -#if !defined(CONS_ADDVAS) -# undef USE_VASMETHOD -# define USE_VASMETHOD 0 -#endif - -static int -scoIsMultiConsole (void) -{ - int x; - - if (sco_mcdone) - return sco_ismc; - x = access ("/usr/lib/vidconf/.multiconsole", F_OK); - if (x == 0) - sco_ismc = 1; - sco_mcdone = 1; - return sco_ismc; -} - -/* - * This maps memory using mmap() - */ -static pointer -mapVidMemMMAP(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - int fd; - unsigned long realBase, alignOff; - pointer base; - - fd = open (DEV_MEM, (flags & VIDMEM_READONLY) ? O_RDONLY : O_RDWR); - if (fd < 0) { - FatalError("xf86MapVidMem: failed to open %s (%s)\n", DEV_MEM, - strerror(errno)); - return 0; /* NOTREACHED */ - } - - realBase = Base & ~(getpagesize() - 1); - alignOff = Base - realBase; - - DebugF("base: %lx, realBase: %lx, alignOff: %lx\n", Base,realBase,alignOff); - - base = mmap((caddr_t)0, Size + alignOff, - (flags & VIDMEM_READONLY) ? PROT_READ : (PROT_READ | PROT_WRITE), - MAP_SHARED, fd, (off_t)realBase); - close(fd); - if (base == MAP_FAILED) { - FatalError("xf86MapVidMem: Could not mmap framebuffer (0x%08x,0x%x) (%s)\n", - Base, Size, strerror(errno)); - return 0; /* NOTREACHED */ - } - - DebugF("base: %lx aligned base: %lx\n",base, base + alignOff); - return (pointer)((char *)base + alignOff); -} - -#if (USE_VASMETHOD) -/* - * This maps memory using the virtual address space (VAS) console calls. - */ -static pointer -mapVidMemVAS(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - struct vidvasmem vas; - pointer base; - - vas.base = (long)Base; - vas.size = (long)Size; - - base = (pointer)ioctl (xf86Info.consoleFd, CONS_ADDVAS, &vas); - if (base == (pointer)-1) { - return mapVidMemMMAP(ScreenNum, Base, Size, flags); - } - return base; -} -#endif /* USE_VASMETHOD */ - -struct vidclass vidclasslist[] = { - { "VBE", "", 0xf0000000, 0x2000000, 0 }, - { "P9000", "", 0xc0000000, 0x400000, 0 }, - { "TULIP", "", 0x80000000, 0x400000, 0 }, - { "VIPER", "", 0xa0000000, 0x400000, 0 }, - { "S3T", "", 0xa0000000, 0x200000, 0 }, - { "S3DT", "", 0x4000000, 0x400000, 0 }, - { "MGA", "", 0x2200000, 0x4000, 0 }, - { "CLVGA", "", 0xa0000, 0x20000, 0 }, - { "OLIVE", "", 0xd8000000, 0x400000, 0 }, - { "S3C", "", 0xa0000, 0x10000, 0 }, - { "MGAVLB", "", 0xac000, 0x34000, 0 }, - { "ATI8514", "", 0xFF000, 0x1000, 0 }, - { "GXREGS", "", 0xb0000, 0x10000, 0 }, - { "GX", "", 0xa0000, 0x10000, 0 }, - { "CT64300", "", 0xa0000000, 0x400000, 0 }, - { "SVGA", "", 0xa0000, 0x20000, 0 }, - { "S3V", "", 0xa0000000, 0x400000, 0 }, - { "8514A", "", 0xFF000, 0x1000, 0 }, - { "VGA", "", 0xa0000, 0x10000, 0 }, - { 0 } -}; - -static pointer -mapVidMemVC(int ScreenNum, unsigned long Base, unsigned long Size, int flags) -{ - struct vidclass *vcp; - char *class = NULL; - pointer base; - - for (vcp = vidclasslist; vcp->name; vcp++) { - if ((vcp->base == Base) && (vcp->size == Size)) { - class = vcp->name; - break; - } - } - - if (class == NULL) { - /* - * As a fall-back, we will try and use the mmap() approach. This may - * prove to be the wrong thing to do, but time and testing will tell. - */ - ErrorF("xf86MapVidMem: No class map defined for (0x%08x,0x%08x)\n", Base, Size); -#if USE_VASMETHOD - return mapVidMemVAS(ScreenNum, Base, Size, flags); -#else /* !USE_VASMETHOD */ - return mapVidMemMMAP(ScreenNum, Base, Size, flags); -#endif - } - - /* - * We found a suitable class. Try and use it. - */ - base = (pointer)ioctl(xf86Info.consoleFd, MAP_CLASS, class); - if ((int)base == -1) { - FatalError("xf86MapVidMem: Failed to map video memory class `%s'\n", class); - return 0; /* NOTREACHED */ - } - - return base; -} - -/* - * Unmapping the video memory is easy. We always call munmap(), as it is - * safe to do so even if we haven't actually mapped in any pages via mmap(). - * In the case where we used the video class, we don't need to do anything - * as the kernel will clean up the TSS when we exit, and will undo the - * vasbind() that was done when the class was originally mapped. If we used - * vasmap, we simply undo the map. Again, it is benign to call vasunmap - * even if we got the frame buffer via some other mechanism (like mmap). - */ - -static void -unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) -{ -#if USE_VASMETHOD - struct vidvasmem vas; - int x; - - vas.base = (long)Base; - vas.size = (long)Size; - - x = ioctl (xf86Info.consoleFd, CONS_DELVAS, &vas); - if (x == 0) - return; -#endif /* USE_VASMETHOD */ - - munmap(Base, Size); -} - -/* - * Set things up to point to our local functions. When the kernel gets - * MTRR support, we will need to add the required functions for that - * here too. MTRR support will most likely appear in 5.0.8 or 5.1.0. - * - * We also want to lock the X server process to the base CPU in an MPX - * system, since we will be going to IOPL 3. Most engine drivers can cope - * with I/O access on any CPU but there are a few (AST Manhattan I believe) - * that can't, so the server needs to be locked to CPU0. - */ -void -xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - int mpx_fd; - - if (scoIsMultiConsole ()) { - pVidMem->mapMem = mapVidMemVC; - } else { -#if USE_VASMETHOD - pVidMem->mapMem = mapVidMemVAS; -#else - pVidMem->mapMem = mapVidMemMMAP; -#endif - } - - pVidMem->unmapMem = unmapVidMem; - pVidMem->linearSupported = TRUE; - pVidMem->initialised = TRUE; - - if (mpxLock && (mpx_fd = open (MPXNAME, O_RDONLY)) > 0) { - if (ioctl (mpx_fd, ACPU_XLOCK, BASECPU) < 0) - ErrorF ("xf86OSInitVidMem: Can not bind to CPU 0 (%s)\n", - strerror(errno)); - close (mpx_fd); - } -} - diff --git a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h index c53fc0dac..3b646da70 100644 --- a/xorg-server/hw/xfree86/os-support/xf86_OSlib.h +++ b/xorg-server/hw/xfree86/os-support/xf86_OSlib.h @@ -85,22 +85,11 @@ /**************************************************************************/ #if (defined(SYSV) || defined(SVR4)) && \ (defined(sun) || defined(__i386__)) -# ifdef SCO325 -# ifndef _SVID3 -# define _SVID3 -# endif -# ifndef _NO_STATIC -# define _NO_STATIC -# endif -# endif # include <sys/ioctl.h> # include <signal.h> # include <termio.h> # include <sys/stat.h> # include <sys/types.h> -# if defined(__SCO__) -# include <sys/param.h> -# endif # include <errno.h> @@ -140,15 +129,7 @@ # if !defined(sun) # include <sys/emap.h> # endif -# if defined(SCO325) -# include <sys/vtkd.h> -# include <sys/console.h> -# include <sys/scankbd.h> -# include <sys/vid.h> -# define LED_CAP CLKED -# define LED_NUM NLKED -# define LED_SCR SLKED -# elif defined(HAS_USL_VTS) +# if defined(HAS_USL_VTS) # if !defined(sun) # include <sys/at_ansi.h> # endif @@ -177,20 +158,12 @@ # define VT_ACKACQ 2 # endif /* !VT_ACKACQ */ -# if defined(__SCO__) -# include <sys/sysmacros.h> -# define POSIX_TTY -# endif /* __SCO__ */ -# if defined(SVR4) || defined(SCO325) +# if defined(SVR4) # include <sys/mman.h> # if !(defined(sun) && defined (SVR4)) # define DEV_MEM "/dev/pmem" # endif -# ifdef SCO325 -# undef DEV_MEM -# define DEV_MEM "/dev/mem" -# endif # define CLEARDTR_SUPPORT # define POSIX_TTY # endif /* SVR4 */ diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c index 0266cc44a..d43fdf8e4 100644 --- a/xorg-server/os/access.c +++ b/xorg-server/os/access.c @@ -1,2091 +1,2087 @@ -/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-All rights reserved.
-
-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, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-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
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-X Window System is a trademark of The Open Group.
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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.
-
-******************************************************************/
-
-/*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
- *
- * 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 (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 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.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#ifdef WIN32
-#include <X11/Xwinsock.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#define XSERV_t
-#define TRANS_SERVER
-#define TRANS_REOPEN
-#include <X11/Xtrans/Xtrans.h>
-#include <X11/Xauth.h>
-#include <X11/X.h>
-#include <X11/Xproto.h>
-#include "misc.h"
-#include "site.h"
-#include <errno.h>
-#include <sys/types.h>
-#ifndef WIN32
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <ctype.h>
-
-#if defined(TCPCONN) || defined(STREAMSCONN) || defined(__SCO__)
-#include <netinet/in.h>
-#endif /* TCPCONN || STREAMSCONN || __SCO__ */
-
-#ifdef HAS_GETPEERUCRED
-# include <ucred.h>
-# ifdef sun
-# include <zone.h>
-# endif
-#endif
-
-#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__)
-# include <sys/utsname.h>
-#endif
-#if defined(SYSV) && defined(__i386__)
-# include <sys/stream.h>
-#endif
-#ifdef __GNU__
-#undef SIOCGIFCONF
-#include <netdb.h>
-#else /*!__GNU__*/
-# include <net/if.h>
-#endif /*__GNU__ */
-
-#ifdef SVR4
-#include <sys/sockio.h>
-#include <sys/stropts.h>
-#endif
-
-#include <netdb.h>
-
-#ifdef CSRG_BASED
-#include <sys/param.h>
-#if (BSD >= 199103)
-#define VARIABLE_IFREQ
-#endif
-#endif
-
-#ifdef BSD44SOCKETS
-#ifndef VARIABLE_IFREQ
-#define VARIABLE_IFREQ
-#endif
-#endif
-
-#ifdef HAS_GETIFADDRS
-#include <ifaddrs.h>
-#endif
-
-/* Solaris provides an extended interface SIOCGLIFCONF. Other systems
- * may have this as well, but the code has only been tested on Solaris
- * so far, so we only enable it there. Other platforms may be added as
- * needed.
- *
- * Test for Solaris commented out -- TSI @ UQV 2003.06.13
- */
-#ifdef SIOCGLIFCONF
-/* #if defined(sun) */
-#define USE_SIOCGLIFCONF
-/* #endif */
-#endif
-
-#endif /* WIN32 */
-
-#ifndef PATH_MAX
-#include <sys/param.h>
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-#endif
-
-#ifdef __SCO__
-/* The system defined value is wrong. MAXPATHLEN is set in sco5.cf. */
-#undef PATH_MAX
-#endif
-
-#define X_INCLUDE_NETDB_H
-#include <X11/Xos_r.h>
-
-#include "dixstruct.h"
-#include "osdep.h"
-
-#include "xace.h"
-
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
-Bool defeatAccessControl = FALSE;
-
-#define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len)
-#define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len)
-#define addrEqual(fam, address, length, host) \
- ((fam) == (host)->family &&\
- (length) == (host)->len &&\
- !acmp (address, (host)->addr, length))
-
-static int ConvertAddr(struct sockaddr * /*saddr*/,
- int * /*len*/,
- pointer * /*addr*/);
-
-static int CheckAddr(int /*family*/,
- const void * /*pAddr*/,
- unsigned /*length*/);
-
-static Bool NewHost(int /*family*/,
- const void * /*addr*/,
- int /*len*/,
- int /* addingLocalHosts */);
-
-/* XFree86 bug #156: To keep track of which hosts were explicitly requested in
- /etc/X<display>.hosts, we've added a requested field to the HOST struct,
- and a LocalHostRequested variable. These default to FALSE, but are set
- to TRUE in ResetHosts when reading in /etc/X<display>.hosts. They are
- checked in DisableLocalHost(), which is called to disable the default
- local host entries when stronger authentication is turned on. */
-
-typedef struct _host {
- short family;
- short len;
- unsigned char *addr;
- struct _host *next;
- int requested;
-} HOST;
-
-#define MakeHost(h,l) (h)=malloc(sizeof *(h)+(l));\
- if (h) { \
- (h)->addr=(unsigned char *) ((h) + 1);\
- (h)->requested = FALSE; \
- }
-#define FreeHost(h) free(h)
-static HOST *selfhosts = NULL;
-static HOST *validhosts = NULL;
-static int AccessEnabled = DEFAULT_ACCESS_CONTROL;
-static int LocalHostEnabled = FALSE;
-static int LocalHostRequested = FALSE;
-static int UsingXdmcp = FALSE;
-
-/* FamilyServerInterpreted implementation */
-static Bool siAddrMatch(int family, pointer addr, int len, HOST *host,
- ClientPtr client);
-static int siCheckAddr(const char *addrString, int length);
-static void siTypesInitialize(void);
-
-/*
- * called when authorization is not enabled to add the
- * local host to the access list
- */
-
-void
-EnableLocalHost (void)
-{
- if (!UsingXdmcp)
- {
- LocalHostEnabled = TRUE;
- AddLocalHosts ();
- }
-}
-
-/*
- * called when authorization is enabled to keep us secure
- */
-void
-DisableLocalHost (void)
-{
- HOST *self;
-
- if (!LocalHostRequested) /* Fix for XFree86 bug #156 */
- LocalHostEnabled = FALSE;
- for (self = selfhosts; self; self = self->next) {
- if (!self->requested) /* Fix for XFree86 bug #156 */
- (void) RemoveHost ((ClientPtr)NULL, self->family, self->len, (pointer)self->addr);
- }
-}
-
-/*
- * called at init time when XDMCP will be used; xdmcp always
- * adds local hosts manually when needed
- */
-
-void
-AccessUsingXdmcp (void)
-{
- UsingXdmcp = TRUE;
- LocalHostEnabled = FALSE;
-}
-
-
-#if defined(SVR4) && !defined(SCO325) && !defined(sun) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF)
-
-/* Deal with different SIOCGIFCONF ioctl semantics on these OSs */
-
-static int
-ifioctl (int fd, int cmd, char *arg)
-{
- struct strioctl ioc;
- int ret;
-
- memset((char *) &ioc, 0, sizeof(ioc));
- ioc.ic_cmd = cmd;
- ioc.ic_timout = 0;
- if (cmd == SIOCGIFCONF)
- {
- ioc.ic_len = ((struct ifconf *) arg)->ifc_len;
- ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf;
- }
- else
- {
- ioc.ic_len = sizeof(struct ifreq);
- ioc.ic_dp = arg;
- }
- ret = ioctl(fd, I_STR, (char *) &ioc);
- if (ret >= 0 && cmd == SIOCGIFCONF)
-#ifdef SVR4
- ((struct ifconf *) arg)->ifc_len = ioc.ic_len;
-#endif
- return ret;
-}
-#else /* Case sun, SCO325 and others */
-#define ifioctl ioctl
-#endif
-
-/*
- * DefineSelf (fd):
- *
- * Define this host for access control. Find all the hosts the OS knows about
- * for this fd and add them to the selfhosts list.
- */
-
-#if !defined(SIOCGIFCONF)
-void
-DefineSelf (int fd)
-{
-#if !defined(TCPCONN) && !defined(STREAMSCONN) && !defined(UNIXCONN)
- return;
-#else
- register int n;
- int len;
- caddr_t addr;
- int family;
- register HOST *host;
-
-#ifndef WIN32
- struct utsname name;
-#else
- struct {
- char nodename[512];
- } name;
-#endif
-
- register struct hostent *hp;
-
- union {
- struct sockaddr sa;
- struct sockaddr_in in;
-#if defined(IPv6) && defined(AF_INET6)
- struct sockaddr_in6 in6;
-#endif
- } saddr;
-
- struct sockaddr_in *inetaddr;
- struct sockaddr_in6 *inet6addr;
- struct sockaddr_in broad_addr;
-#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
-#endif
-
- /* Why not use gethostname()? Well, at least on my system, I've had to
- * make an ugly kernel patch to get a name longer than 8 characters, and
- * uname() lets me access to the whole string (it smashes release, you
- * see), whereas gethostname() kindly truncates it for me.
- */
-#ifndef WIN32
- uname(&name);
-#else
- gethostname(name.nodename, sizeof(name.nodename));
-#endif
-
- hp = _XGethostbyname(name.nodename, hparams);
- if (hp != NULL)
- {
- saddr.sa.sa_family = hp->h_addrtype;
- switch (hp->h_addrtype) {
- case AF_INET:
- inetaddr = (struct sockaddr_in *) (&(saddr.sa));
- acopy ( hp->h_addr, &(inetaddr->sin_addr), hp->h_length);
- len = sizeof(saddr.sa);
- break;
-#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6:
- inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
- acopy ( hp->h_addr, &(inet6addr->sin6_addr), hp->h_length);
- len = sizeof(saddr.in6);
- break;
-#endif
- default:
- goto DefineLocalHost;
- }
- family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr);
- if ( family != -1 && family != FamilyLocal )
- {
- for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next) ;
- if (!host)
- {
- /* add this host to the host list. */
- MakeHost(host,len)
- if (host)
- {
- host->family = family;
- host->len = len;
- acopy ( addr, host->addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
-#ifdef XDMCP
- /*
- * If this is an Internet Address, but not the localhost
- * address (127.0.0.1), nor the bogus address (0.0.0.0),
- * register it.
- */
- if (family == FamilyInternet &&
- !(len == 4 &&
- ((addr[0] == 127) ||
- (addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)))
- )
- {
- XdmcpRegisterConnection (family, (char *)addr, len);
- broad_addr = *inetaddr;
- ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
- htonl (INADDR_BROADCAST);
- XdmcpRegisterBroadcastAddress ((struct sockaddr_in *)
- &broad_addr);
- }
-#if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)))
- {
- XdmcpRegisterConnection (family, (char *)addr, len);
- }
-#endif
-
-#endif /* XDMCP */
- }
- }
- }
- /*
- * now add a host of family FamilyLocalHost...
- */
-DefineLocalHost:
- for (host = selfhosts;
- host && !addrEqual(FamilyLocalHost, "", 0, host);
- host = host->next);
- if (!host)
- {
- MakeHost(host, 0);
- if (host)
- {
- host->family = FamilyLocalHost;
- host->len = 0;
- acopy("", host->addr, 0);
- host->next = selfhosts;
- selfhosts = host;
- }
- }
-#endif /* !TCPCONN && !STREAMSCONN && !UNIXCONN */
-}
-
-#else
-
-#ifdef USE_SIOCGLIFCONF
-#define ifr_type struct lifreq
-#else
-#define ifr_type struct ifreq
-#endif
-
-#ifdef VARIABLE_IFREQ
-#define ifr_size(p) (sizeof (struct ifreq) + \
- (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \
- p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0))
-#define ifraddr_size(a) (a.sa_len)
-#else
-#define ifr_size(p) (sizeof (ifr_type))
-#define ifraddr_size(a) (sizeof (a))
-#endif
-
-#if defined(IPv6) && defined(AF_INET6)
-#include <arpa/inet.h>
-#endif
-
-#if defined(IPv6) && defined(AF_INET6)
-static void
-in6_fillscopeid(struct sockaddr_in6 *sin6)
-{
-#if defined(__KAME__)
- if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
- sin6->sin6_scope_id =
- ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]);
- sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0;
- }
-#endif
-}
-#endif
-
-void
-DefineSelf (int fd)
-{
-#ifndef HAS_GETIFADDRS
- char *cp, *cplim;
-# ifdef USE_SIOCGLIFCONF
- struct sockaddr_storage buf[16];
- struct lifconf ifc;
- register struct lifreq *ifr;
-# ifdef SIOCGLIFNUM
- struct lifnum ifn;
-# endif
-# else /* !USE_SIOCGLIFCONF */
- char buf[2048];
- struct ifconf ifc;
- register struct ifreq *ifr;
-# endif
- void * bufptr = buf;
-#else /* HAS_GETIFADDRS */
- struct ifaddrs * ifap, *ifr;
-#endif
- int len;
- unsigned char * addr;
- int family;
- register HOST *host;
-
-#ifndef HAS_GETIFADDRS
-
- len = sizeof(buf);
-
-#ifdef USE_SIOCGLIFCONF
-
-#ifdef SIOCGLIFNUM
- ifn.lifn_family = AF_UNSPEC;
- ifn.lifn_flags = 0;
- if (ioctl (fd, SIOCGLIFNUM, (char *) &ifn) < 0)
- Error ("Getting interface count");
- if (len < (ifn.lifn_count * sizeof(struct lifreq))) {
- len = ifn.lifn_count * sizeof(struct lifreq);
- bufptr = malloc(len);
- }
-#endif
-
- ifc.lifc_family = AF_UNSPEC;
- ifc.lifc_flags = 0;
- ifc.lifc_len = len;
- ifc.lifc_buf = bufptr;
-
-#define IFC_IOCTL_REQ SIOCGLIFCONF
-#define IFC_IFC_REQ ifc.lifc_req
-#define IFC_IFC_LEN ifc.lifc_len
-#define IFR_IFR_ADDR ifr->lifr_addr
-#define IFR_IFR_NAME ifr->lifr_name
-
-#else /* Use SIOCGIFCONF */
- ifc.ifc_len = len;
- ifc.ifc_buf = bufptr;
-
-#define IFC_IOCTL_REQ SIOCGIFCONF
-#define IFC_IFC_REQ ifc.ifc_req
-#define IFC_IFC_LEN ifc.ifc_len
-#define IFR_IFR_ADDR ifr->ifr_addr
-#define IFR_IFR_NAME ifr->ifr_name
-#endif
-
- if (ifioctl (fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0)
- Error ("Getting interface configuration (4)");
-
- cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN;
-
- for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr))
- {
- ifr = (ifr_type *) cp;
- len = ifraddr_size (IFR_IFR_ADDR);
- family = ConvertAddr ((struct sockaddr *) &IFR_IFR_ADDR,
- &len, (pointer *)&addr);
- if (family == -1 || family == FamilyLocal)
- continue;
-#if defined(IPv6) && defined(AF_INET6)
- if (family == FamilyInternet6)
- in6_fillscopeid((struct sockaddr_in6 *)&IFR_IFR_ADDR);
-#endif
- for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next)
- ;
- if (host)
- continue;
- MakeHost(host,len)
- if (host)
- {
- host->family = family;
- host->len = len;
- acopy(addr, host->addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
-#ifdef XDMCP
- {
-#ifdef USE_SIOCGLIFCONF
- struct sockaddr_storage broad_addr;
-#else
- struct sockaddr broad_addr;
-#endif
-
- /*
- * If this isn't an Internet Address, don't register it.
- */
- if (family != FamilyInternet
-#if defined(IPv6) && defined(AF_INET6)
- && family != FamilyInternet6
-#endif
- )
- continue;
-
- /*
- * ignore 'localhost' entries as they're not useful
- * on the other end of the wire
- */
- if (family == FamilyInternet &&
- addr[0] == 127 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 1)
- continue;
-#if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))
- continue;
-#endif
-
- /*
- * Ignore '0.0.0.0' entries as they are
- * returned by some OSes for unconfigured NICs but they are
- * not useful on the other end of the wire.
- */
- if (len == 4 &&
- addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)
- continue;
-
- XdmcpRegisterConnection (family, (char *)addr, len);
-
-#if defined(IPv6) && defined(AF_INET6)
- /* IPv6 doesn't support broadcasting, so we drop out here */
- if (family == FamilyInternet6)
- continue;
-#endif
-
- broad_addr = IFR_IFR_ADDR;
-
- ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
- htonl (INADDR_BROADCAST);
-#if defined(USE_SIOCGLIFCONF) && defined(SIOCGLIFBRDADDR)
- {
- struct lifreq broad_req;
-
- broad_req = *ifr;
- if (ioctl (fd, SIOCGLIFFLAGS, (char *) &broad_req) != -1 &&
- (broad_req.lifr_flags & IFF_BROADCAST) &&
- (broad_req.lifr_flags & IFF_UP)
- )
- {
- broad_req = *ifr;
- if (ioctl (fd, SIOCGLIFBRDADDR, &broad_req) != -1)
- broad_addr = broad_req.lifr_broadaddr;
- else
- continue;
- }
- else
- continue;
- }
-
-#elif defined(SIOCGIFBRDADDR)
- {
- struct ifreq broad_req;
-
- broad_req = *ifr;
- if (ifioctl (fd, SIOCGIFFLAGS, (pointer) &broad_req) != -1 &&
- (broad_req.ifr_flags & IFF_BROADCAST) &&
- (broad_req.ifr_flags & IFF_UP)
- )
- {
- broad_req = *ifr;
- if (ifioctl (fd, SIOCGIFBRDADDR, (pointer) &broad_req) != -1)
- broad_addr = broad_req.ifr_addr;
- else
- continue;
- }
- else
- continue;
- }
-#endif /* SIOCGIFBRDADDR */
- XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr);
- }
-#endif /* XDMCP */
- }
- if (bufptr != buf)
- free(bufptr);
-#else /* HAS_GETIFADDRS */
- if (getifaddrs(&ifap) < 0) {
- ErrorF("Warning: getifaddrs returns %s\n", strerror(errno));
- return;
- }
- for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) {
- if (!ifr->ifa_addr)
- continue;
- len = sizeof(*(ifr->ifa_addr));
- family = ConvertAddr((struct sockaddr *) ifr->ifa_addr, &len,
- (pointer *)&addr);
- if (family == -1 || family == FamilyLocal)
- continue;
-#if defined(IPv6) && defined(AF_INET6)
- if (family == FamilyInternet6)
- in6_fillscopeid((struct sockaddr_in6 *)ifr->ifa_addr);
-#endif
-
- for (host = selfhosts;
- host != NULL && !addrEqual(family, addr, len, host);
- host = host->next)
- ;
- if (host != NULL)
- continue;
- MakeHost(host, len);
- if (host != NULL) {
- host->family = family;
- host->len = len;
- acopy(addr, host->addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
-#ifdef XDMCP
- {
- /*
- * If this isn't an Internet Address, don't register it.
- */
- if (family != FamilyInternet
-#if defined(IPv6) && defined(AF_INET6)
- && family != FamilyInternet6
-#endif
- )
- continue;
-
- /*
- * ignore 'localhost' entries as they're not useful
- * on the other end of the wire
- */
- if (ifr->ifa_flags & IFF_LOOPBACK)
- continue;
-
- if (family == FamilyInternet &&
- addr[0] == 127 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 1)
- continue;
-
- /*
- * Ignore '0.0.0.0' entries as they are
- * returned by some OSes for unconfigured NICs but they are
- * not useful on the other end of the wire.
- */
- if (len == 4 &&
- addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)
- continue;
-#if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))
- continue;
-#endif
- XdmcpRegisterConnection(family, (char *)addr, len);
-#if defined(IPv6) && defined(AF_INET6)
- if (family == FamilyInternet6)
- /* IPv6 doesn't support broadcasting, so we drop out here */
- continue;
-#endif
- if ((ifr->ifa_flags & IFF_BROADCAST) &&
- (ifr->ifa_flags & IFF_UP) &&
- ifr->ifa_broadaddr)
- XdmcpRegisterBroadcastAddress(
- (struct sockaddr_in *) ifr->ifa_broadaddr);
- else
- continue;
- }
-#endif /* XDMCP */
-
- } /* for */
- freeifaddrs(ifap);
-#endif /* HAS_GETIFADDRS */
-
- /*
- * add something of FamilyLocalHost
- */
- for (host = selfhosts;
- host && !addrEqual(FamilyLocalHost, "", 0, host);
- host = host->next);
- if (!host)
- {
- MakeHost(host, 0);
- if (host)
- {
- host->family = FamilyLocalHost;
- host->len = 0;
- acopy("", host->addr, 0);
- host->next = selfhosts;
- selfhosts = host;
- }
- }
-}
-#endif /* hpux && !HAS_IFREQ */
-
-#ifdef XDMCP
-void
-AugmentSelf(pointer from, int len)
-{
- int family;
- pointer addr;
- register HOST *host;
-
- family = ConvertAddr(from, &len, (pointer *)&addr);
- if (family == -1 || family == FamilyLocal)
- return;
- for (host = selfhosts; host; host = host->next)
- {
- if (addrEqual(family, addr, len, host))
- return;
- }
- MakeHost(host,len)
- if (!host)
- return;
- host->family = family;
- host->len = len;
- acopy(addr, host->addr, len);
- host->next = selfhosts;
- selfhosts = host;
-}
-#endif
-
-void
-AddLocalHosts (void)
-{
- HOST *self;
-
- for (self = selfhosts; self; self = self->next)
- /* Fix for XFree86 bug #156: pass addingLocal = TRUE to
- * NewHost to tell that we are adding the default local
- * host entries and not to flag the entries as being
- * explicitely requested */
- (void) NewHost (self->family, self->addr, self->len, TRUE);
-}
-
-/* Reset access control list to initial hosts */
-void
-ResetHosts (char *display)
-{
- register HOST *host;
- char lhostname[120], ohostname[120];
- char *hostname = ohostname;
- char fname[PATH_MAX + 1];
- int fnamelen;
- FILE *fd;
- char *ptr;
- int i, hostlen;
-#if (defined(TCPCONN) || defined(STREAMSCONN) ) && \
- (!defined(IPv6) || !defined(AF_INET6))
- union {
- struct sockaddr sa;
-#if defined(TCPCONN) || defined(STREAMSCONN)
- struct sockaddr_in in;
-#endif /* TCPCONN || STREAMSCONN */
- } saddr;
-#endif
- int family = 0;
- pointer addr;
- int len;
-
- siTypesInitialize();
- AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL;
- LocalHostEnabled = FALSE;
- while ((host = validhosts) != 0)
- {
- validhosts = host->next;
- FreeHost (host);
- }
-
-#if defined WIN32 && defined __MINGW32__
-#define ETC_HOST_PREFIX "X"
-#else
-#define ETC_HOST_PREFIX "/etc/X"
-#endif
-#define ETC_HOST_SUFFIX ".hosts"
- fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) +
- strlen(display) + 1;
- if (fnamelen > sizeof(fname))
- FatalError("Display name `%s' is too long\n", display);
- snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX,
- display);
-
- if ((fd = fopen (fname, "r")) != 0)
- {
- while (fgets (ohostname, sizeof (ohostname), fd))
- {
- family = FamilyWild;
- if (*ohostname == '#')
- continue;
- if ((ptr = strchr(ohostname, '\n')) != 0)
- *ptr = 0;
- hostlen = strlen(ohostname) + 1;
- for (i = 0; i < hostlen; i++)
- lhostname[i] = tolower(ohostname[i]);
- hostname = ohostname;
- if (!strncmp("local:", lhostname, 6))
- {
- family = FamilyLocalHost;
- NewHost(family, "", 0, FALSE);
- LocalHostRequested = TRUE; /* Fix for XFree86 bug #156 */
- }
-#if defined(TCPCONN) || defined(STREAMSCONN)
- else if (!strncmp("inet:", lhostname, 5))
- {
- family = FamilyInternet;
- hostname = ohostname + 5;
- }
-#if defined(IPv6) && defined(AF_INET6)
- else if (!strncmp("inet6:", lhostname, 6))
- {
- family = FamilyInternet6;
- hostname = ohostname + 6;
- }
-#endif
-#endif
-#ifdef SECURE_RPC
- else if (!strncmp("nis:", lhostname, 4))
- {
- family = FamilyNetname;
- hostname = ohostname + 4;
- }
-#endif
- else if (!strncmp("si:", lhostname, 3))
- {
- family = FamilyServerInterpreted;
- hostname = ohostname + 3;
- hostlen -= 3;
- }
-
-
- if (family == FamilyServerInterpreted)
- {
- len = siCheckAddr(hostname, hostlen);
- if (len >= 0) {
- NewHost(family, hostname, len, FALSE);
- }
- }
- else
-#ifdef SECURE_RPC
- if ((family == FamilyNetname) || (strchr(hostname, '@')))
- {
- SecureRPCInit ();
- (void) NewHost (FamilyNetname, hostname, strlen (hostname), FALSE);
- }
- else
-#endif /* SECURE_RPC */
-#if defined(TCPCONN) || defined(STREAMSCONN)
- {
-#if defined(IPv6) && defined(AF_INET6)
- if ( (family == FamilyInternet) || (family == FamilyInternet6) ||
- (family == FamilyWild) )
- {
- struct addrinfo *addresses;
- struct addrinfo *a;
- int f;
-
- if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) {
- for (a = addresses ; a != NULL ; a = a->ai_next) {
- len = a->ai_addrlen;
- f = ConvertAddr(a->ai_addr,&len,(pointer *)&addr);
- if ( (family == f) ||
- ((family == FamilyWild) && (f != -1)) ) {
- NewHost(f, addr, len, FALSE);
- }
- }
- freeaddrinfo(addresses);
- }
- }
-#else
-#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
-#endif
- register struct hostent *hp;
-
- /* host name */
- if ((family == FamilyInternet &&
- ((hp = _XGethostbyname(hostname, hparams)) != 0)) ||
- ((hp = _XGethostbyname(hostname, hparams)) != 0))
- {
- saddr.sa.sa_family = hp->h_addrtype;
- len = sizeof(saddr.sa);
- if ((family = ConvertAddr (&saddr.sa, &len, (pointer *)&addr)) != -1)
- {
-#ifdef h_addr /* new 4.3bsd version of gethostent */
- char **list;
-
- /* iterate over the addresses */
- for (list = hp->h_addr_list; *list; list++)
- (void) NewHost (family, (pointer)*list, len, FALSE);
-#else
- (void) NewHost (family, (pointer)hp->h_addr, len, FALSE);
-#endif
- }
- }
-#endif /* IPv6 */
- }
-#endif /* TCPCONN || STREAMSCONN */
- family = FamilyWild;
- }
- fclose (fd);
- }
-}
-
-/* Is client on the local host */
-Bool LocalClient(ClientPtr client)
-{
- int alen, family, notused;
- Xtransaddr *from = NULL;
- pointer addr;
- register HOST *host;
-
- if (!client->osPrivate)
- return FALSE;
- if (!((OsCommPtr)client->osPrivate)->trans_conn)
- return FALSE;
-
- if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn,
- ¬used, &alen, &from))
- {
- family = ConvertAddr ((struct sockaddr *) from,
- &alen, (pointer *)&addr);
- if (family == -1)
- {
- free(from);
- return FALSE;
- }
- if (family == FamilyLocal)
- {
- free(from);
- return TRUE;
- }
- for (host = selfhosts; host; host = host->next)
- {
- if (addrEqual (family, addr, alen, host))
- return TRUE;
- }
- free(from);
- }
- return FALSE;
-}
-
-/*
- * Return the uid and gid of a connected local client
- *
- * Used by XShm to test access rights to shared memory segments
- */
-int
-LocalClientCred(ClientPtr client, int *pUid, int *pGid)
-{
- LocalClientCredRec *lcc;
- int ret = GetLocalClientCreds(client, &lcc);
-
- if (ret == 0) {
-#ifdef HAVE_GETZONEID /* only local if in the same zone */
- if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) {
- FreeLocalClientCreds(lcc);
- return -1;
- }
-#endif
- if ((lcc->fieldsSet & LCC_UID_SET) && (pUid != NULL))
- *pUid = lcc->euid;
- if ((lcc->fieldsSet & LCC_GID_SET) && (pGid != NULL))
- *pGid = lcc->egid;
- FreeLocalClientCreds(lcc);
- }
- return ret;
-}
-
-/*
- * Return the uid and all gids of a connected local client
- * Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds
- *
- * Used by localuser & localgroup ServerInterpreted access control forms below
- * Used by AuthAudit to log who local connections came from
- */
-int
-GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp)
-{
-#if defined(HAS_GETPEEREID) || defined(HAS_GETPEERUCRED) || defined(SO_PEERCRED)
- int fd;
- XtransConnInfo ci;
- LocalClientCredRec *lcc;
-#ifdef HAS_GETPEEREID
- uid_t uid;
- gid_t gid;
-#elif defined(HAS_GETPEERUCRED)
- ucred_t *peercred = NULL;
- const gid_t *gids;
-#elif defined(SO_PEERCRED)
- struct ucred peercred;
- socklen_t so_len = sizeof(peercred);
-#endif
-
- if (client == NULL)
- return -1;
- ci = ((OsCommPtr)client->osPrivate)->trans_conn;
-#if !(defined(sun) && defined(HAS_GETPEERUCRED))
- /* Most implementations can only determine peer credentials for Unix
- * domain sockets - Solaris getpeerucred can work with a bit more, so
- * we just let it tell us if the connection type is supported or not
- */
- if (!_XSERVTransIsLocal(ci)) {
- return -1;
- }
-#endif
-
- *lccp = calloc(1, sizeof(LocalClientCredRec));
- if (*lccp == NULL)
- return -1;
- lcc = *lccp;
-
- fd = _XSERVTransGetConnectionNumber(ci);
-#ifdef HAS_GETPEEREID
- if (getpeereid(fd, &uid, &gid) == -1) {
- FreeLocalClientCreds(lcc);
- return -1;
- }
- lcc->euid = uid;
- lcc->egid = gid;
- lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET;
- return 0;
-#elif defined(HAS_GETPEERUCRED)
- if (getpeerucred(fd, &peercred) < 0) {
- FreeLocalClientCreds(lcc);
- return -1;
- }
- lcc->euid = ucred_geteuid(peercred);
- if (lcc->euid != -1)
- lcc->fieldsSet |= LCC_UID_SET;
- lcc->egid = ucred_getegid(peercred);
- if (lcc->egid != -1)
- lcc->fieldsSet |= LCC_GID_SET;
- lcc->pid = ucred_getpid(peercred);
- if (lcc->pid != -1)
- lcc->fieldsSet |= LCC_PID_SET;
-#ifdef HAVE_GETZONEID
- lcc->zoneid = ucred_getzoneid(peercred);
- if (lcc->zoneid != -1)
- lcc->fieldsSet |= LCC_ZID_SET;
-#endif
- lcc->nSuppGids = ucred_getgroups(peercred, &gids);
- if (lcc->nSuppGids > 0) {
- lcc->pSuppGids = calloc(lcc->nSuppGids, sizeof(int));
- if (lcc->pSuppGids == NULL) {
- lcc->nSuppGids = 0;
- } else {
- int i;
- for (i = 0 ; i < lcc->nSuppGids; i++) {
- (lcc->pSuppGids)[i] = (int) gids[i];
- }
- }
- } else {
- lcc->nSuppGids = 0;
- }
- ucred_free(peercred);
- return 0;
-#elif defined(SO_PEERCRED)
- if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1) {
- FreeLocalClientCreds(lcc);
- return -1;
- }
- lcc->euid = peercred.uid;
- lcc->egid = peercred.gid;
- lcc->pid = peercred.pid;
- lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET | LCC_PID_SET;
- return 0;
-#endif
-#else
- /* No system call available to get the credentials of the peer */
-#define NO_LOCAL_CLIENT_CRED
- return -1;
-#endif
-}
-
-void
-FreeLocalClientCreds(LocalClientCredRec *lcc)
-{
- if (lcc != NULL) {
- if (lcc->nSuppGids > 0) {
- free(lcc->pSuppGids);
- }
- free(lcc);
- }
-}
-
-static int
-AuthorizedClient(ClientPtr client)
-{
- int rc;
-
- if (!client || defeatAccessControl)
- return Success;
-
- /* untrusted clients can't change host access */
- rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess);
- if (rc != Success)
- return rc;
-
- return LocalClient(client) ? Success : BadAccess;
-}
-
-/* Add a host to the access control list. This is the external interface
- * called from the dispatcher */
-
-int
-AddHost (ClientPtr client,
- int family,
- unsigned length, /* of bytes in pAddr */
- const void * pAddr)
-{
- int rc, len;
-
- rc = AuthorizedClient(client);
- if (rc != Success)
- return rc;
- switch (family) {
- case FamilyLocalHost:
- len = length;
- LocalHostEnabled = TRUE;
- break;
-#ifdef SECURE_RPC
- case FamilyNetname:
- len = length;
- SecureRPCInit ();
- break;
-#endif
- case FamilyInternet:
-#if defined(IPv6) && defined(AF_INET6)
- case FamilyInternet6:
-#endif
- case FamilyDECnet:
- case FamilyChaos:
- case FamilyServerInterpreted:
- if ((len = CheckAddr (family, pAddr, length)) < 0)
- {
- client->errorValue = length;
- return BadValue;
- }
- break;
- case FamilyLocal:
- default:
- client->errorValue = family;
- return BadValue;
- }
- if (NewHost (family, pAddr, len, FALSE))
- return Success;
- return BadAlloc;
-}
-
-Bool
-ForEachHostInFamily (int family,
- Bool (*func)(
- unsigned char * /* addr */,
- short /* len */,
- pointer /* closure */),
- pointer closure)
-{
- HOST *host;
-
- for (host = validhosts; host; host = host->next)
- if (family == host->family && func (host->addr, host->len, closure))
- return TRUE;
- return FALSE;
-}
-
-/* Add a host to the access control list. This is the internal interface
- * called when starting or resetting the server */
-static Bool
-NewHost (int family,
- const void * addr,
- int len,
- int addingLocalHosts)
-{
- register HOST *host;
-
- for (host = validhosts; host; host = host->next)
- {
- if (addrEqual (family, addr, len, host))
- return TRUE;
- }
- if (!addingLocalHosts) { /* Fix for XFree86 bug #156 */
- for (host = selfhosts; host; host = host->next) {
- if (addrEqual (family, addr, len, host)) {
- host->requested = TRUE;
- break;
- }
- }
- }
- MakeHost(host,len)
- if (!host)
- return FALSE;
- host->family = family;
- host->len = len;
- acopy(addr, host->addr, len);
- host->next = validhosts;
- validhosts = host;
- return TRUE;
-}
-
-/* Remove a host from the access control list */
-
-int
-RemoveHost (
- ClientPtr client,
- int family,
- unsigned length, /* of bytes in pAddr */
- pointer pAddr)
-{
- int rc, len;
- register HOST *host, **prev;
-
- rc = AuthorizedClient(client);
- if (rc != Success)
- return rc;
- switch (family) {
- case FamilyLocalHost:
- len = length;
- LocalHostEnabled = FALSE;
- break;
-#ifdef SECURE_RPC
- case FamilyNetname:
- len = length;
- break;
-#endif
- case FamilyInternet:
-#if defined(IPv6) && defined(AF_INET6)
- case FamilyInternet6:
-#endif
- case FamilyDECnet:
- case FamilyChaos:
- case FamilyServerInterpreted:
- if ((len = CheckAddr (family, pAddr, length)) < 0)
- {
- client->errorValue = length;
- return BadValue;
- }
- break;
- case FamilyLocal:
- default:
- client->errorValue = family;
- return BadValue;
- }
- for (prev = &validhosts;
- (host = *prev) && (!addrEqual (family, pAddr, len, host));
- prev = &host->next)
- ;
- if (host)
- {
- *prev = host->next;
- FreeHost (host);
- }
- return Success;
-}
-
-/* Get all hosts in the access control list */
-int
-GetHosts (
- pointer *data,
- int *pnHosts,
- int *pLen,
- BOOL *pEnabled)
-{
- int len;
- register int n = 0;
- register unsigned char *ptr;
- register HOST *host;
- int nHosts = 0;
-
- *pEnabled = AccessEnabled ? EnableAccess : DisableAccess;
- for (host = validhosts; host; host = host->next)
- {
- nHosts++;
- n += pad_to_int32(host->len) + sizeof(xHostEntry);
- }
- if (n)
- {
- *data = ptr = malloc(n);
- if (!ptr)
- {
- return BadAlloc;
- }
- for (host = validhosts; host; host = host->next)
- {
- len = host->len;
- ((xHostEntry *)ptr)->family = host->family;
- ((xHostEntry *)ptr)->length = len;
- ptr += sizeof(xHostEntry);
- acopy (host->addr, ptr, len);
- ptr += pad_to_int32(len);
- }
- } else {
- *data = NULL;
- }
- *pnHosts = nHosts;
- *pLen = n;
- return Success;
-}
-
-/* Check for valid address family and length, and return address length. */
-
-/*ARGSUSED*/
-static int
-CheckAddr (
- int family,
- const void * pAddr,
- unsigned length)
-{
- int len;
-
- switch (family)
- {
-#if defined(TCPCONN) || defined(STREAMSCONN)
- case FamilyInternet:
- if (length == sizeof (struct in_addr))
- len = length;
- else
- len = -1;
- break;
-#if defined(IPv6) && defined(AF_INET6)
- case FamilyInternet6:
- if (length == sizeof (struct in6_addr))
- len = length;
- else
- len = -1;
- break;
-#endif
-#endif
- case FamilyServerInterpreted:
- len = siCheckAddr(pAddr, length);
- break;
- default:
- len = -1;
- }
- return len;
-}
-
-/* Check if a host is not in the access control list.
- * Returns 1 if host is invalid, 0 if we've found it. */
-
-int
-InvalidHost (
- register struct sockaddr *saddr,
- int len,
- ClientPtr client)
-{
- int family;
- pointer addr;
- register HOST *selfhost, *host;
-
- if (!AccessEnabled) /* just let them in */
- return 0;
- family = ConvertAddr (saddr, &len, (pointer *)&addr);
- if (family == -1)
- return 1;
- if (family == FamilyLocal)
- {
- if (!LocalHostEnabled)
- {
- /*
- * check to see if any local address is enabled. This
- * implicitly enables local connections.
- */
- for (selfhost = selfhosts; selfhost; selfhost=selfhost->next)
- {
- for (host = validhosts; host; host=host->next)
- {
- if (addrEqual (selfhost->family, selfhost->addr,
- selfhost->len, host))
- return 0;
- }
- }
- } else
- return 0;
- }
- for (host = validhosts; host; host = host->next)
- {
- if ((host->family == FamilyServerInterpreted)) {
- if (siAddrMatch (family, addr, len, host, client)) {
- return 0;
- }
- } else {
- if (addrEqual (family, addr, len, host))
- return 0;
- }
-
- }
- return 1;
-}
-
-static int
-ConvertAddr (
- register struct sockaddr *saddr,
- int *len,
- pointer *addr)
-{
- if (*len == 0)
- return FamilyLocal;
- switch (saddr->sa_family)
- {
- case AF_UNSPEC:
-#if defined(UNIXCONN) || defined(LOCALCONN)
- case AF_UNIX:
-#endif
- return FamilyLocal;
-#if defined(TCPCONN) || defined(STREAMSCONN)
- case AF_INET:
-#ifdef WIN32
- if (16777343 == *(long*)&((struct sockaddr_in *) saddr)->sin_addr)
- return FamilyLocal;
-#endif
- *len = sizeof (struct in_addr);
- *addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr);
- return FamilyInternet;
-#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6:
- {
- struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) saddr;
- if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) {
- *len = sizeof (struct in_addr);
- *addr = (pointer) &(saddr6->sin6_addr.s6_addr[12]);
- return FamilyInternet;
- } else {
- *len = sizeof (struct in6_addr);
- *addr = (pointer) &(saddr6->sin6_addr);
- return FamilyInternet6;
- }
- }
-#endif
-#endif
- default:
- return -1;
- }
-}
-
-int
-ChangeAccessControl(
- ClientPtr client,
- int fEnabled)
-{
- int rc = AuthorizedClient(client);
- if (rc != Success)
- return rc;
- AccessEnabled = fEnabled;
- return Success;
-}
-
-/* returns FALSE if xhost + in effect, else TRUE */
-int
-GetAccessControl(void)
-{
- return AccessEnabled;
-}
-
-/*****************************************************************************
- * FamilyServerInterpreted host entry implementation
- *
- * Supports an extensible system of host types which the server can interpret
- * See the IPv6 extensions to the X11 protocol spec for the definition.
- *
- * Currently supported schemes:
- *
- * hostname - hostname as defined in IETF RFC 2396
- * ipv6 - IPv6 literal address as defined in IETF RFC's 3513 and <TBD>
- *
- * See xc/doc/specs/SIAddresses for formal definitions of each type.
- */
-
-/* These definitions and the siTypeAdd function could be exported in the
- * future to enable loading additional host types, but that was not done for
- * the initial implementation.
- */
-typedef Bool (*siAddrMatchFunc)(int family, pointer addr, int len,
- const char *siAddr, int siAddrlen, ClientPtr client, void *siTypePriv);
-typedef int (*siCheckAddrFunc)(const char *addrString, int length,
- void *siTypePriv);
-
-struct siType {
- struct siType * next;
- const char * typeName;
- siAddrMatchFunc addrMatch;
- siCheckAddrFunc checkAddr;
- void * typePriv; /* Private data for type routines */
-};
-
-static struct siType *siTypeList;
-
-static int
-siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch,
- siCheckAddrFunc checkAddr, void *typePriv)
-{
- struct siType *s, *p;
-
- if ((typeName == NULL) || (addrMatch == NULL) || (checkAddr == NULL))
- return BadValue;
-
- for (s = siTypeList, p = NULL; s != NULL ; p = s, s = s->next) {
- if (strcmp(typeName, s->typeName) == 0) {
- s->addrMatch = addrMatch;
- s->checkAddr = checkAddr;
- s->typePriv = typePriv;
- return Success;
- }
- }
-
- s = malloc(sizeof(struct siType));
- if (s == NULL)
- return BadAlloc;
-
- if (p == NULL)
- siTypeList = s;
- else
- p->next = s;
-
- s->next = NULL;
- s->typeName = typeName;
- s->addrMatch = addrMatch;
- s->checkAddr = checkAddr;
- s->typePriv = typePriv;
- return Success;
-}
-
-/* Checks to see if a host matches a server-interpreted host entry */
-static Bool
-siAddrMatch(int family, pointer addr, int len, HOST *host, ClientPtr client)
-{
- Bool matches = FALSE;
- struct siType *s;
- const char *valueString;
- int addrlen;
-
- valueString = (const char *) memchr(host->addr, '\0', host->len);
- if (valueString != NULL) {
- for (s = siTypeList; s != NULL ; s = s->next) {
- if (strcmp((char *) host->addr, s->typeName) == 0) {
- addrlen = host->len - (strlen((char *)host->addr) + 1);
- matches = s->addrMatch(family, addr, len,
- valueString + 1, addrlen, client, s->typePriv);
- break;
- }
- }
-#ifdef FAMILY_SI_DEBUG
- ErrorF(
- "Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n",
- host->addr, addrlen, addrlen, valueString + 1,
- (matches) ? "accepted" : "rejected");
-#endif
- }
- return matches;
-}
-
-static int
-siCheckAddr(const char *addrString, int length)
-{
- const char *valueString;
- int addrlen, typelen;
- int len = -1;
- struct siType *s;
-
- /* Make sure there is a \0 byte inside the specified length
- to separate the address type from the address value. */
- valueString = (const char *) memchr(addrString, '\0', length);
- if (valueString != NULL) {
- /* Make sure the first string is a recognized address type,
- * and the second string is a valid address of that type.
- */
- typelen = strlen(addrString) + 1;
- addrlen = length - typelen;
-
- for (s = siTypeList; s != NULL ; s = s->next) {
- if (strcmp(addrString, s->typeName) == 0) {
- len = s->checkAddr(valueString + 1, addrlen, s->typePriv);
- if (len >= 0) {
- len += typelen;
- }
- break;
- }
- }
-#ifdef FAMILY_SI_DEBUG
- {
- const char *resultMsg;
-
- if (s == NULL) {
- resultMsg = "type not registered";
- } else {
- if (len == -1)
- resultMsg = "rejected";
- else
- resultMsg = "accepted";
- }
-
- ErrorF("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n",
- addrString, addrlen, addrlen, valueString + 1, len, resultMsg);
- }
-#endif
- }
- return len;
-}
-
-
-/***
- * Hostname server-interpreted host type
- *
- * Stored as hostname string, explicitly defined to be resolved ONLY
- * at access check time, to allow for hosts with dynamic addresses
- * but static hostnames, such as found in some DHCP & mobile setups.
- *
- * Hostname must conform to IETF RFC 2396 sec. 3.2.2, which defines it as:
- * hostname = *( domainlabel "." ) toplabel [ "." ]
- * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum
- * toplabel = alpha | alpha *( alphanum | "-" ) alphanum
- */
-
-#ifdef NI_MAXHOST
-# define SI_HOSTNAME_MAXLEN NI_MAXHOST
-#else
-# ifdef MAXHOSTNAMELEN
-# define SI_HOSTNAME_MAXLEN MAXHOSTNAMELEN
-# else
-# define SI_HOSTNAME_MAXLEN 256
-# endif
-#endif
-
-static Bool
-siHostnameAddrMatch(int family, pointer addr, int len,
- const char *siAddr, int siAddrLen, ClientPtr client, void *typePriv)
-{
- Bool res = FALSE;
-
-/* Currently only supports checking against IPv4 & IPv6 connections, but
- * support for other address families, such as DECnet, could be added if
- * desired.
- */
-#if defined(IPv6) && defined(AF_INET6)
- if ((family == FamilyInternet) || (family == FamilyInternet6)) {
- char hostname[SI_HOSTNAME_MAXLEN];
- struct addrinfo *addresses;
- struct addrinfo *a;
- int f, hostaddrlen;
- pointer hostaddr;
-
- if (siAddrLen >= sizeof(hostname))
- return FALSE;
-
- strncpy(hostname, siAddr, siAddrLen);
- hostname[siAddrLen] = '\0';
-
- if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) {
- for (a = addresses ; a != NULL ; a = a->ai_next) {
- hostaddrlen = a->ai_addrlen;
- f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr);
- if ((f == family) && (len == hostaddrlen) &&
- (acmp (addr, hostaddr, len) == 0) ) {
- res = TRUE;
- break;
- }
- }
- freeaddrinfo(addresses);
- }
- }
-#else /* IPv6 not supported, use gethostbyname instead for IPv4 */
- if (family == FamilyInternet) {
- register struct hostent *hp;
-#ifdef XTHREADS_NEEDS_BYNAMEPARAMS
- _Xgethostbynameparams hparams;
-#endif
- char hostname[SI_HOSTNAME_MAXLEN];
- int f, hostaddrlen;
- pointer hostaddr;
- const char **addrlist;
-
- if (siAddrLen >= sizeof(hostname))
- return FALSE;
-
- strncpy(hostname, siAddr, siAddrLen);
- hostname[siAddrLen] = '\0';
-
- if ((hp = _XGethostbyname(hostname, hparams)) != NULL) {
-#ifdef h_addr /* new 4.3bsd version of gethostent */
- /* iterate over the addresses */
- for (addrlist = hp->h_addr_list; *addrlist; addrlist++)
-#else
- addrlist = &hp->h_addr;
-#endif
- {
- struct sockaddr_in sin;
-
- sin.sin_family = hp->h_addrtype;
- acopy ( *addrlist, &(sin.sin_addr), hp->h_length);
- hostaddrlen = sizeof(sin);
- f = ConvertAddr ((struct sockaddr *)&sin,
- &hostaddrlen, &hostaddr);
- if ((f == family) && (len == hostaddrlen) &&
- (acmp (addr, hostaddr, len) == 0) ) {
- res = TRUE;
- break;
- }
- }
- }
- }
-#endif
- return res;
-}
-
-
-static int
-siHostnameCheckAddr(const char *valueString, int length, void *typePriv)
-{
- /* Check conformance of hostname to RFC 2396 sec. 3.2.2 definition.
- * We do not use ctype functions here to avoid locale-specific
- * character sets. Hostnames must be pure ASCII.
- */
- int len = length;
- int i;
- Bool dotAllowed = FALSE;
- Bool dashAllowed = FALSE;
-
- if ((length <= 0) || (length >= SI_HOSTNAME_MAXLEN)) {
- len = -1;
- } else {
- for (i = 0; i < length; i++) {
- char c = valueString[i];
-
- if (c == 0x2E) { /* '.' */
- if (dotAllowed == FALSE) {
- len = -1;
- break;
- } else {
- dotAllowed = FALSE;
- dashAllowed = FALSE;
- }
- } else if (c == 0x2D) { /* '-' */
- if (dashAllowed == FALSE) {
- len = -1;
- break;
- } else {
- dotAllowed = FALSE;
- }
- } else if (((c >= 0x30) && (c <= 0x3A)) /* 0-9 */ ||
- ((c >= 0x61) && (c <= 0x7A)) /* a-z */ ||
- ((c >= 0x41) && (c <= 0x5A)) /* A-Z */) {
- dotAllowed = TRUE;
- dashAllowed = TRUE;
- } else { /* Invalid character */
- len = -1;
- break;
- }
- }
- }
- return len;
-}
-
-#if defined(IPv6) && defined(AF_INET6)
-/***
- * "ipv6" server interpreted type
- *
- * Currently supports only IPv6 literal address as specified in IETF RFC 3513
- *
- * Once draft-ietf-ipv6-scoping-arch-00.txt becomes an RFC, support will be
- * added for the scoped address format it specifies.
- */
-
-/* Maximum length of an IPv6 address string - increase when adding support
- * for scoped address qualifiers. Includes room for trailing NUL byte.
- */
-#define SI_IPv6_MAXLEN INET6_ADDRSTRLEN
-
-static Bool
-siIPv6AddrMatch(int family, pointer addr, int len,
- const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv)
-{
- struct in6_addr addr6;
- char addrbuf[SI_IPv6_MAXLEN];
-
- if ((family != FamilyInternet6) || (len != sizeof(addr6)))
- return FALSE;
-
- memcpy(addrbuf, siAddr, siAddrlen);
- addrbuf[siAddrlen] = '\0';
-
- if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) {
- perror("inet_pton");
- return FALSE;
- }
-
- if (memcmp(addr, &addr6, len) == 0) {
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static int
-siIPv6CheckAddr(const char *addrString, int length, void *typePriv)
-{
- int len;
-
- /* Minimum length is 3 (smallest legal address is "::1") */
- if (length < 3) {
- /* Address is too short! */
- len = -1;
- } else if (length >= SI_IPv6_MAXLEN) {
- /* Address is too long! */
- len = -1;
- } else {
- /* Assume inet_pton is sufficient validation */
- struct in6_addr addr6;
- char addrbuf[SI_IPv6_MAXLEN];
-
- memcpy(addrbuf, addrString, length);
- addrbuf[length] = '\0';
-
- if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) {
- perror("inet_pton");
- len = -1;
- } else {
- len = length;
- }
- }
- return len;
-}
-#endif /* IPv6 */
-
-#if !defined(NO_LOCAL_CLIENT_CRED)
-/***
- * "localuser" & "localgroup" server interpreted types
- *
- * Allows local connections from a given local user or group
- */
-
-#include <pwd.h>
-#include <grp.h>
-
-#define LOCAL_USER 1
-#define LOCAL_GROUP 2
-
-typedef struct {
- int credType;
-} siLocalCredPrivRec, *siLocalCredPrivPtr;
-
-static siLocalCredPrivRec siLocalUserPriv = { LOCAL_USER };
-static siLocalCredPrivRec siLocalGroupPriv = { LOCAL_GROUP };
-
-static Bool
-siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id)
-{
- Bool parsedOK = FALSE;
- char *addrbuf = malloc(len + 1);
-
- if (addrbuf == NULL) {
- return FALSE;
- }
-
- memcpy(addrbuf, addr, len);
- addrbuf[len] = '\0';
-
- if (addr[0] == '#') { /* numeric id */
- char *cp;
- errno = 0;
- *id = strtol(addrbuf + 1, &cp, 0);
- if ((errno == 0) && (cp != (addrbuf+1))) {
- parsedOK = TRUE;
- }
- } else { /* non-numeric name */
- if (lcPriv->credType == LOCAL_USER) {
- struct passwd *pw = getpwnam(addrbuf);
-
- if (pw != NULL) {
- *id = (int) pw->pw_uid;
- parsedOK = TRUE;
- }
- } else { /* group */
- struct group *gr = getgrnam(addrbuf);
-
- if (gr != NULL) {
- *id = (int) gr->gr_gid;
- parsedOK = TRUE;
- }
- }
- }
-
- free(addrbuf);
- return parsedOK;
-}
-
-static Bool
-siLocalCredAddrMatch(int family, pointer addr, int len,
- const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv)
-{
- int siAddrId;
- LocalClientCredRec *lcc;
- siLocalCredPrivPtr lcPriv = (siLocalCredPrivPtr) typePriv;
-
- if (GetLocalClientCreds(client, &lcc) == -1) {
- return FALSE;
- }
-
-#ifdef HAVE_GETZONEID /* Ensure process is in the same zone */
- if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) {
- FreeLocalClientCreds(lcc);
- return FALSE;
- }
-#endif
-
- if (siLocalCredGetId(siAddr, siAddrlen, lcPriv, &siAddrId) == FALSE) {
- FreeLocalClientCreds(lcc);
- return FALSE;
- }
-
- if (lcPriv->credType == LOCAL_USER) {
- if ((lcc->fieldsSet & LCC_UID_SET) && (lcc->euid == siAddrId)) {
- FreeLocalClientCreds(lcc);
- return TRUE;
- }
- } else {
- if ((lcc->fieldsSet & LCC_GID_SET) && (lcc->egid == siAddrId)) {
- FreeLocalClientCreds(lcc);
- return TRUE;
- }
- if (lcc->pSuppGids != NULL) {
- int i;
-
- for (i = 0 ; i < lcc->nSuppGids; i++) {
- if (lcc->pSuppGids[i] == siAddrId) {
- FreeLocalClientCreds(lcc);
- return TRUE;
- }
- }
- }
- }
- FreeLocalClientCreds(lcc);
- return FALSE;
-}
-
-static int
-siLocalCredCheckAddr(const char *addrString, int length, void *typePriv)
-{
- int len = length;
- int id;
-
- if (siLocalCredGetId(addrString, length,
- (siLocalCredPrivPtr)typePriv, &id) == FALSE) {
- len = -1;
- }
- return len;
-}
-#endif /* localuser */
-
-static void
-siTypesInitialize(void)
-{
- siTypeAdd("hostname", siHostnameAddrMatch, siHostnameCheckAddr, NULL);
-#if defined(IPv6) && defined(AF_INET6)
- siTypeAdd("ipv6", siIPv6AddrMatch, siIPv6CheckAddr, NULL);
-#endif
-#if !defined(NO_LOCAL_CLIENT_CRED)
- siTypeAdd("localuser", siLocalCredAddrMatch, siLocalCredCheckAddr,
- &siLocalUserPriv);
- siTypeAdd("localgroup", siLocalCredAddrMatch, siLocalCredCheckAddr,
- &siLocalGroupPriv);
-#endif
-}
+/*********************************************************** + +Copyright 1987, 1998 The Open Group + +All rights reserved. + +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, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +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 +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group. + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +******************************************************************/ + +/* + * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * + * 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 (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 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. + */ + +#ifdef HAVE_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#ifdef WIN32 +#include <X11/Xwinsock.h> +#endif + +#include <stdio.h> +#include <stdlib.h> +#define XSERV_t +#define TRANS_SERVER +#define TRANS_REOPEN +#include <X11/Xtrans/Xtrans.h> +#include <X11/Xauth.h> +#include <X11/X.h> +#include <X11/Xproto.h> +#include "misc.h" +#include "site.h" +#include <errno.h> +#include <sys/types.h> +#ifndef WIN32 +#include <sys/socket.h> +#include <sys/ioctl.h> +#include <ctype.h> + +#if defined(TCPCONN) || defined(STREAMSCONN) +#include <netinet/in.h> +#endif /* TCPCONN || STREAMSCONN */ + +#ifdef HAS_GETPEERUCRED +# include <ucred.h> +# ifdef sun +# include <zone.h> +# endif +#endif + +#if defined(SVR4) || (defined(SYSV) && defined(__i386__)) || defined(__GNU__) +# include <sys/utsname.h> +#endif +#if defined(SYSV) && defined(__i386__) +# include <sys/stream.h> +#endif +#ifdef __GNU__ +#undef SIOCGIFCONF +#include <netdb.h> +#else /*!__GNU__*/ +# include <net/if.h> +#endif /*__GNU__ */ + +#ifdef SVR4 +#include <sys/sockio.h> +#include <sys/stropts.h> +#endif + +#include <netdb.h> + +#ifdef CSRG_BASED +#include <sys/param.h> +#if (BSD >= 199103) +#define VARIABLE_IFREQ +#endif +#endif + +#ifdef BSD44SOCKETS +#ifndef VARIABLE_IFREQ +#define VARIABLE_IFREQ +#endif +#endif + +#ifdef HAS_GETIFADDRS +#include <ifaddrs.h> +#endif + +/* Solaris provides an extended interface SIOCGLIFCONF. Other systems + * may have this as well, but the code has only been tested on Solaris + * so far, so we only enable it there. Other platforms may be added as + * needed. + * + * Test for Solaris commented out -- TSI @ UQV 2003.06.13 + */ +#ifdef SIOCGLIFCONF +/* #if defined(sun) */ +#define USE_SIOCGLIFCONF +/* #endif */ +#endif + +#endif /* WIN32 */ + +#ifndef PATH_MAX +#include <sys/param.h> +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif +#endif + + +#define X_INCLUDE_NETDB_H +#include <X11/Xos_r.h> + +#include "dixstruct.h" +#include "osdep.h" + +#include "xace.h" + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + +Bool defeatAccessControl = FALSE; + +#define acmp(a1, a2, len) memcmp((char *)(a1), (char *)(a2), len) +#define acopy(a1, a2, len) memmove((char *)(a2), (char *)(a1), len) +#define addrEqual(fam, address, length, host) \ + ((fam) == (host)->family &&\ + (length) == (host)->len &&\ + !acmp (address, (host)->addr, length)) + +static int ConvertAddr(struct sockaddr * /*saddr*/, + int * /*len*/, + pointer * /*addr*/); + +static int CheckAddr(int /*family*/, + const void * /*pAddr*/, + unsigned /*length*/); + +static Bool NewHost(int /*family*/, + const void * /*addr*/, + int /*len*/, + int /* addingLocalHosts */); + +/* XFree86 bug #156: To keep track of which hosts were explicitly requested in + /etc/X<display>.hosts, we've added a requested field to the HOST struct, + and a LocalHostRequested variable. These default to FALSE, but are set + to TRUE in ResetHosts when reading in /etc/X<display>.hosts. They are + checked in DisableLocalHost(), which is called to disable the default + local host entries when stronger authentication is turned on. */ + +typedef struct _host { + short family; + short len; + unsigned char *addr; + struct _host *next; + int requested; +} HOST; + +#define MakeHost(h,l) (h)=malloc(sizeof *(h)+(l));\ + if (h) { \ + (h)->addr=(unsigned char *) ((h) + 1);\ + (h)->requested = FALSE; \ + } +#define FreeHost(h) free(h) +static HOST *selfhosts = NULL; +static HOST *validhosts = NULL; +static int AccessEnabled = DEFAULT_ACCESS_CONTROL; +static int LocalHostEnabled = FALSE; +static int LocalHostRequested = FALSE; +static int UsingXdmcp = FALSE; + +/* FamilyServerInterpreted implementation */ +static Bool siAddrMatch(int family, pointer addr, int len, HOST *host, + ClientPtr client); +static int siCheckAddr(const char *addrString, int length); +static void siTypesInitialize(void); + +/* + * called when authorization is not enabled to add the + * local host to the access list + */ + +void +EnableLocalHost (void) +{ + if (!UsingXdmcp) + { + LocalHostEnabled = TRUE; + AddLocalHosts (); + } +} + +/* + * called when authorization is enabled to keep us secure + */ +void +DisableLocalHost (void) +{ + HOST *self; + + if (!LocalHostRequested) /* Fix for XFree86 bug #156 */ + LocalHostEnabled = FALSE; + for (self = selfhosts; self; self = self->next) { + if (!self->requested) /* Fix for XFree86 bug #156 */ + (void) RemoveHost ((ClientPtr)NULL, self->family, self->len, (pointer)self->addr); + } +} + +/* + * called at init time when XDMCP will be used; xdmcp always + * adds local hosts manually when needed + */ + +void +AccessUsingXdmcp (void) +{ + UsingXdmcp = TRUE; + LocalHostEnabled = FALSE; +} + + +#if defined(SVR4) && !defined(sun) && defined(SIOCGIFCONF) && !defined(USE_SIOCGLIFCONF) + +/* Deal with different SIOCGIFCONF ioctl semantics on these OSs */ + +static int +ifioctl (int fd, int cmd, char *arg) +{ + struct strioctl ioc; + int ret; + + memset((char *) &ioc, 0, sizeof(ioc)); + ioc.ic_cmd = cmd; + ioc.ic_timout = 0; + if (cmd == SIOCGIFCONF) + { + ioc.ic_len = ((struct ifconf *) arg)->ifc_len; + ioc.ic_dp = ((struct ifconf *) arg)->ifc_buf; + } + else + { + ioc.ic_len = sizeof(struct ifreq); + ioc.ic_dp = arg; + } + ret = ioctl(fd, I_STR, (char *) &ioc); + if (ret >= 0 && cmd == SIOCGIFCONF) +#ifdef SVR4 + ((struct ifconf *) arg)->ifc_len = ioc.ic_len; +#endif + return ret; +} +#else +#define ifioctl ioctl +#endif + +/* + * DefineSelf (fd): + * + * Define this host for access control. Find all the hosts the OS knows about + * for this fd and add them to the selfhosts list. + */ + +#if !defined(SIOCGIFCONF) +void +DefineSelf (int fd) +{ +#if !defined(TCPCONN) && !defined(STREAMSCONN) && !defined(UNIXCONN) + return; +#else + register int n; + int len; + caddr_t addr; + int family; + register HOST *host; + +#ifndef WIN32 + struct utsname name; +#else + struct { + char nodename[512]; + } name; +#endif + + register struct hostent *hp; + + union { + struct sockaddr sa; + struct sockaddr_in in; +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_in6 in6; +#endif + } saddr; + + struct sockaddr_in *inetaddr; + struct sockaddr_in6 *inet6addr; + struct sockaddr_in broad_addr; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + + /* Why not use gethostname()? Well, at least on my system, I've had to + * make an ugly kernel patch to get a name longer than 8 characters, and + * uname() lets me access to the whole string (it smashes release, you + * see), whereas gethostname() kindly truncates it for me. + */ +#ifndef WIN32 + uname(&name); +#else + gethostname(name.nodename, sizeof(name.nodename)); +#endif + + hp = _XGethostbyname(name.nodename, hparams); + if (hp != NULL) + { + saddr.sa.sa_family = hp->h_addrtype; + switch (hp->h_addrtype) { + case AF_INET: + inetaddr = (struct sockaddr_in *) (&(saddr.sa)); + acopy ( hp->h_addr, &(inetaddr->sin_addr), hp->h_length); + len = sizeof(saddr.sa); + break; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + inet6addr = (struct sockaddr_in6 *) (&(saddr.sa)); + acopy ( hp->h_addr, &(inet6addr->sin6_addr), hp->h_length); + len = sizeof(saddr.in6); + break; +#endif + default: + goto DefineLocalHost; + } + family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr); + if ( family != -1 && family != FamilyLocal ) + { + for (host = selfhosts; + host && !addrEqual (family, addr, len, host); + host = host->next) ; + if (!host) + { + /* add this host to the host list. */ + MakeHost(host,len) + if (host) + { + host->family = family; + host->len = len; + acopy ( addr, host->addr, len); + host->next = selfhosts; + selfhosts = host; + } +#ifdef XDMCP + /* + * If this is an Internet Address, but not the localhost + * address (127.0.0.1), nor the bogus address (0.0.0.0), + * register it. + */ + if (family == FamilyInternet && + !(len == 4 && + ((addr[0] == 127) || + (addr[0] == 0 && addr[1] == 0 && + addr[2] == 0 && addr[3] == 0))) + ) + { + XdmcpRegisterConnection (family, (char *)addr, len); + broad_addr = *inetaddr; + ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr = + htonl (INADDR_BROADCAST); + XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) + &broad_addr); + } +#if defined(IPv6) && defined(AF_INET6) + else if (family == FamilyInternet6 && + !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr))) + { + XdmcpRegisterConnection (family, (char *)addr, len); + } +#endif + +#endif /* XDMCP */ + } + } + } + /* + * now add a host of family FamilyLocalHost... + */ +DefineLocalHost: + for (host = selfhosts; + host && !addrEqual(FamilyLocalHost, "", 0, host); + host = host->next); + if (!host) + { + MakeHost(host, 0); + if (host) + { + host->family = FamilyLocalHost; + host->len = 0; + acopy("", host->addr, 0); + host->next = selfhosts; + selfhosts = host; + } + } +#endif /* !TCPCONN && !STREAMSCONN && !UNIXCONN */ +} + +#else + +#ifdef USE_SIOCGLIFCONF +#define ifr_type struct lifreq +#else +#define ifr_type struct ifreq +#endif + +#ifdef VARIABLE_IFREQ +#define ifr_size(p) (sizeof (struct ifreq) + \ + (p->ifr_addr.sa_len > sizeof (p->ifr_addr) ? \ + p->ifr_addr.sa_len - sizeof (p->ifr_addr) : 0)) +#define ifraddr_size(a) (a.sa_len) +#else +#define ifr_size(p) (sizeof (ifr_type)) +#define ifraddr_size(a) (sizeof (a)) +#endif + +#if defined(IPv6) && defined(AF_INET6) +#include <arpa/inet.h> +#endif + +#if defined(IPv6) && defined(AF_INET6) +static void +in6_fillscopeid(struct sockaddr_in6 *sin6) +{ +#if defined(__KAME__) + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + sin6->sin6_scope_id = + ntohs(*(u_int16_t *)&sin6->sin6_addr.s6_addr[2]); + sin6->sin6_addr.s6_addr[2] = sin6->sin6_addr.s6_addr[3] = 0; + } +#endif +} +#endif + +void +DefineSelf (int fd) +{ +#ifndef HAS_GETIFADDRS + char *cp, *cplim; +# ifdef USE_SIOCGLIFCONF + struct sockaddr_storage buf[16]; + struct lifconf ifc; + register struct lifreq *ifr; +# ifdef SIOCGLIFNUM + struct lifnum ifn; +# endif +# else /* !USE_SIOCGLIFCONF */ + char buf[2048]; + struct ifconf ifc; + register struct ifreq *ifr; +# endif + void * bufptr = buf; +#else /* HAS_GETIFADDRS */ + struct ifaddrs * ifap, *ifr; +#endif + int len; + unsigned char * addr; + int family; + register HOST *host; + +#ifndef HAS_GETIFADDRS + + len = sizeof(buf); + +#ifdef USE_SIOCGLIFCONF + +#ifdef SIOCGLIFNUM + ifn.lifn_family = AF_UNSPEC; + ifn.lifn_flags = 0; + if (ioctl (fd, SIOCGLIFNUM, (char *) &ifn) < 0) + Error ("Getting interface count"); + if (len < (ifn.lifn_count * sizeof(struct lifreq))) { + len = ifn.lifn_count * sizeof(struct lifreq); + bufptr = malloc(len); + } +#endif + + ifc.lifc_family = AF_UNSPEC; + ifc.lifc_flags = 0; + ifc.lifc_len = len; + ifc.lifc_buf = bufptr; + +#define IFC_IOCTL_REQ SIOCGLIFCONF +#define IFC_IFC_REQ ifc.lifc_req +#define IFC_IFC_LEN ifc.lifc_len +#define IFR_IFR_ADDR ifr->lifr_addr +#define IFR_IFR_NAME ifr->lifr_name + +#else /* Use SIOCGIFCONF */ + ifc.ifc_len = len; + ifc.ifc_buf = bufptr; + +#define IFC_IOCTL_REQ SIOCGIFCONF +#define IFC_IFC_REQ ifc.ifc_req +#define IFC_IFC_LEN ifc.ifc_len +#define IFR_IFR_ADDR ifr->ifr_addr +#define IFR_IFR_NAME ifr->ifr_name +#endif + + if (ifioctl (fd, IFC_IOCTL_REQ, (pointer) &ifc) < 0) + Error ("Getting interface configuration (4)"); + + cplim = (char *) IFC_IFC_REQ + IFC_IFC_LEN; + + for (cp = (char *) IFC_IFC_REQ; cp < cplim; cp += ifr_size (ifr)) + { + ifr = (ifr_type *) cp; + len = ifraddr_size (IFR_IFR_ADDR); + family = ConvertAddr ((struct sockaddr *) &IFR_IFR_ADDR, + &len, (pointer *)&addr); + if (family == -1 || family == FamilyLocal) + continue; +#if defined(IPv6) && defined(AF_INET6) + if (family == FamilyInternet6) + in6_fillscopeid((struct sockaddr_in6 *)&IFR_IFR_ADDR); +#endif + for (host = selfhosts; + host && !addrEqual (family, addr, len, host); + host = host->next) + ; + if (host) + continue; + MakeHost(host,len) + if (host) + { + host->family = family; + host->len = len; + acopy(addr, host->addr, len); + host->next = selfhosts; + selfhosts = host; + } +#ifdef XDMCP + { +#ifdef USE_SIOCGLIFCONF + struct sockaddr_storage broad_addr; +#else + struct sockaddr broad_addr; +#endif + + /* + * If this isn't an Internet Address, don't register it. + */ + if (family != FamilyInternet +#if defined(IPv6) && defined(AF_INET6) + && family != FamilyInternet6 +#endif + ) + continue; + + /* + * ignore 'localhost' entries as they're not useful + * on the other end of the wire + */ + if (family == FamilyInternet && + addr[0] == 127 && addr[1] == 0 && + addr[2] == 0 && addr[3] == 1) + continue; +#if defined(IPv6) && defined(AF_INET6) + else if (family == FamilyInternet6 && + IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)) + continue; +#endif + + /* + * Ignore '0.0.0.0' entries as they are + * returned by some OSes for unconfigured NICs but they are + * not useful on the other end of the wire. + */ + if (len == 4 && + addr[0] == 0 && addr[1] == 0 && + addr[2] == 0 && addr[3] == 0) + continue; + + XdmcpRegisterConnection (family, (char *)addr, len); + +#if defined(IPv6) && defined(AF_INET6) + /* IPv6 doesn't support broadcasting, so we drop out here */ + if (family == FamilyInternet6) + continue; +#endif + + broad_addr = IFR_IFR_ADDR; + + ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr = + htonl (INADDR_BROADCAST); +#if defined(USE_SIOCGLIFCONF) && defined(SIOCGLIFBRDADDR) + { + struct lifreq broad_req; + + broad_req = *ifr; + if (ioctl (fd, SIOCGLIFFLAGS, (char *) &broad_req) != -1 && + (broad_req.lifr_flags & IFF_BROADCAST) && + (broad_req.lifr_flags & IFF_UP) + ) + { + broad_req = *ifr; + if (ioctl (fd, SIOCGLIFBRDADDR, &broad_req) != -1) + broad_addr = broad_req.lifr_broadaddr; + else + continue; + } + else + continue; + } + +#elif defined(SIOCGIFBRDADDR) + { + struct ifreq broad_req; + + broad_req = *ifr; + if (ifioctl (fd, SIOCGIFFLAGS, (pointer) &broad_req) != -1 && + (broad_req.ifr_flags & IFF_BROADCAST) && + (broad_req.ifr_flags & IFF_UP) + ) + { + broad_req = *ifr; + if (ifioctl (fd, SIOCGIFBRDADDR, (pointer) &broad_req) != -1) + broad_addr = broad_req.ifr_addr; + else + continue; + } + else + continue; + } +#endif /* SIOCGIFBRDADDR */ + XdmcpRegisterBroadcastAddress ((struct sockaddr_in *) &broad_addr); + } +#endif /* XDMCP */ + } + if (bufptr != buf) + free(bufptr); +#else /* HAS_GETIFADDRS */ + if (getifaddrs(&ifap) < 0) { + ErrorF("Warning: getifaddrs returns %s\n", strerror(errno)); + return; + } + for (ifr = ifap; ifr != NULL; ifr = ifr->ifa_next) { + if (!ifr->ifa_addr) + continue; + len = sizeof(*(ifr->ifa_addr)); + family = ConvertAddr((struct sockaddr *) ifr->ifa_addr, &len, + (pointer *)&addr); + if (family == -1 || family == FamilyLocal) + continue; +#if defined(IPv6) && defined(AF_INET6) + if (family == FamilyInternet6) + in6_fillscopeid((struct sockaddr_in6 *)ifr->ifa_addr); +#endif + + for (host = selfhosts; + host != NULL && !addrEqual(family, addr, len, host); + host = host->next) + ; + if (host != NULL) + continue; + MakeHost(host, len); + if (host != NULL) { + host->family = family; + host->len = len; + acopy(addr, host->addr, len); + host->next = selfhosts; + selfhosts = host; + } +#ifdef XDMCP + { + /* + * If this isn't an Internet Address, don't register it. + */ + if (family != FamilyInternet +#if defined(IPv6) && defined(AF_INET6) + && family != FamilyInternet6 +#endif + ) + continue; + + /* + * ignore 'localhost' entries as they're not useful + * on the other end of the wire + */ + if (ifr->ifa_flags & IFF_LOOPBACK) + continue; + + if (family == FamilyInternet && + addr[0] == 127 && addr[1] == 0 && + addr[2] == 0 && addr[3] == 1) + continue; + + /* + * Ignore '0.0.0.0' entries as they are + * returned by some OSes for unconfigured NICs but they are + * not useful on the other end of the wire. + */ + if (len == 4 && + addr[0] == 0 && addr[1] == 0 && + addr[2] == 0 && addr[3] == 0) + continue; +#if defined(IPv6) && defined(AF_INET6) + else if (family == FamilyInternet6 && + IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)) + continue; +#endif + XdmcpRegisterConnection(family, (char *)addr, len); +#if defined(IPv6) && defined(AF_INET6) + if (family == FamilyInternet6) + /* IPv6 doesn't support broadcasting, so we drop out here */ + continue; +#endif + if ((ifr->ifa_flags & IFF_BROADCAST) && + (ifr->ifa_flags & IFF_UP) && + ifr->ifa_broadaddr) + XdmcpRegisterBroadcastAddress( + (struct sockaddr_in *) ifr->ifa_broadaddr); + else + continue; + } +#endif /* XDMCP */ + + } /* for */ + freeifaddrs(ifap); +#endif /* HAS_GETIFADDRS */ + + /* + * add something of FamilyLocalHost + */ + for (host = selfhosts; + host && !addrEqual(FamilyLocalHost, "", 0, host); + host = host->next); + if (!host) + { + MakeHost(host, 0); + if (host) + { + host->family = FamilyLocalHost; + host->len = 0; + acopy("", host->addr, 0); + host->next = selfhosts; + selfhosts = host; + } + } +} +#endif /* hpux && !HAS_IFREQ */ + +#ifdef XDMCP +void +AugmentSelf(pointer from, int len) +{ + int family; + pointer addr; + register HOST *host; + + family = ConvertAddr(from, &len, (pointer *)&addr); + if (family == -1 || family == FamilyLocal) + return; + for (host = selfhosts; host; host = host->next) + { + if (addrEqual(family, addr, len, host)) + return; + } + MakeHost(host,len) + if (!host) + return; + host->family = family; + host->len = len; + acopy(addr, host->addr, len); + host->next = selfhosts; + selfhosts = host; +} +#endif + +void +AddLocalHosts (void) +{ + HOST *self; + + for (self = selfhosts; self; self = self->next) + /* Fix for XFree86 bug #156: pass addingLocal = TRUE to + * NewHost to tell that we are adding the default local + * host entries and not to flag the entries as being + * explicitely requested */ + (void) NewHost (self->family, self->addr, self->len, TRUE); +} + +/* Reset access control list to initial hosts */ +void +ResetHosts (char *display) +{ + register HOST *host; + char lhostname[120], ohostname[120]; + char *hostname = ohostname; + char fname[PATH_MAX + 1]; + int fnamelen; + FILE *fd; + char *ptr; + int i, hostlen; +#if (defined(TCPCONN) || defined(STREAMSCONN) ) && \ + (!defined(IPv6) || !defined(AF_INET6)) + union { + struct sockaddr sa; +#if defined(TCPCONN) || defined(STREAMSCONN) + struct sockaddr_in in; +#endif /* TCPCONN || STREAMSCONN */ + } saddr; +#endif + int family = 0; + pointer addr; + int len; + + siTypesInitialize(); + AccessEnabled = defeatAccessControl ? FALSE : DEFAULT_ACCESS_CONTROL; + LocalHostEnabled = FALSE; + while ((host = validhosts) != 0) + { + validhosts = host->next; + FreeHost (host); + } + +#if defined WIN32 && defined __MINGW32__ +#define ETC_HOST_PREFIX "X" +#else +#define ETC_HOST_PREFIX "/etc/X" +#endif +#define ETC_HOST_SUFFIX ".hosts" + fnamelen = strlen(ETC_HOST_PREFIX) + strlen(ETC_HOST_SUFFIX) + + strlen(display) + 1; + if (fnamelen > sizeof(fname)) + FatalError("Display name `%s' is too long\n", display); + snprintf(fname, sizeof(fname), ETC_HOST_PREFIX "%s" ETC_HOST_SUFFIX, + display); + + if ((fd = fopen (fname, "r")) != 0) + { + while (fgets (ohostname, sizeof (ohostname), fd)) + { + family = FamilyWild; + if (*ohostname == '#') + continue; + if ((ptr = strchr(ohostname, '\n')) != 0) + *ptr = 0; + hostlen = strlen(ohostname) + 1; + for (i = 0; i < hostlen; i++) + lhostname[i] = tolower(ohostname[i]); + hostname = ohostname; + if (!strncmp("local:", lhostname, 6)) + { + family = FamilyLocalHost; + NewHost(family, "", 0, FALSE); + LocalHostRequested = TRUE; /* Fix for XFree86 bug #156 */ + } +#if defined(TCPCONN) || defined(STREAMSCONN) + else if (!strncmp("inet:", lhostname, 5)) + { + family = FamilyInternet; + hostname = ohostname + 5; + } +#if defined(IPv6) && defined(AF_INET6) + else if (!strncmp("inet6:", lhostname, 6)) + { + family = FamilyInternet6; + hostname = ohostname + 6; + } +#endif +#endif +#ifdef SECURE_RPC + else if (!strncmp("nis:", lhostname, 4)) + { + family = FamilyNetname; + hostname = ohostname + 4; + } +#endif + else if (!strncmp("si:", lhostname, 3)) + { + family = FamilyServerInterpreted; + hostname = ohostname + 3; + hostlen -= 3; + } + + + if (family == FamilyServerInterpreted) + { + len = siCheckAddr(hostname, hostlen); + if (len >= 0) { + NewHost(family, hostname, len, FALSE); + } + } + else +#ifdef SECURE_RPC + if ((family == FamilyNetname) || (strchr(hostname, '@'))) + { + SecureRPCInit (); + (void) NewHost (FamilyNetname, hostname, strlen (hostname), FALSE); + } + else +#endif /* SECURE_RPC */ +#if defined(TCPCONN) || defined(STREAMSCONN) + { +#if defined(IPv6) && defined(AF_INET6) + if ( (family == FamilyInternet) || (family == FamilyInternet6) || + (family == FamilyWild) ) + { + struct addrinfo *addresses; + struct addrinfo *a; + int f; + + if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { + for (a = addresses ; a != NULL ; a = a->ai_next) { + len = a->ai_addrlen; + f = ConvertAddr(a->ai_addr,&len,(pointer *)&addr); + if ( (family == f) || + ((family == FamilyWild) && (f != -1)) ) { + NewHost(f, addr, len, FALSE); + } + } + freeaddrinfo(addresses); + } + } +#else +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + register struct hostent *hp; + + /* host name */ + if ((family == FamilyInternet && + ((hp = _XGethostbyname(hostname, hparams)) != 0)) || + ((hp = _XGethostbyname(hostname, hparams)) != 0)) + { + saddr.sa.sa_family = hp->h_addrtype; + len = sizeof(saddr.sa); + if ((family = ConvertAddr (&saddr.sa, &len, (pointer *)&addr)) != -1) + { +#ifdef h_addr /* new 4.3bsd version of gethostent */ + char **list; + + /* iterate over the addresses */ + for (list = hp->h_addr_list; *list; list++) + (void) NewHost (family, (pointer)*list, len, FALSE); +#else + (void) NewHost (family, (pointer)hp->h_addr, len, FALSE); +#endif + } + } +#endif /* IPv6 */ + } +#endif /* TCPCONN || STREAMSCONN */ + family = FamilyWild; + } + fclose (fd); + } +} + +/* Is client on the local host */ +Bool LocalClient(ClientPtr client) +{ + int alen, family, notused; + Xtransaddr *from = NULL; + pointer addr; + register HOST *host; + + if (!client->osPrivate) + return FALSE; + if (!((OsCommPtr)client->osPrivate)->trans_conn) + return FALSE; + + if (!_XSERVTransGetPeerAddr (((OsCommPtr)client->osPrivate)->trans_conn, + ¬used, &alen, &from)) + { + family = ConvertAddr ((struct sockaddr *) from, + &alen, (pointer *)&addr); + if (family == -1) + { + free(from); + return FALSE; + } + if (family == FamilyLocal) + { + free(from); + return TRUE; + } + for (host = selfhosts; host; host = host->next) + { + if (addrEqual (family, addr, alen, host)) + return TRUE; + } + free(from); + } + return FALSE; +} + +/* + * Return the uid and gid of a connected local client + * + * Used by XShm to test access rights to shared memory segments + */ +int +LocalClientCred(ClientPtr client, int *pUid, int *pGid) +{ + LocalClientCredRec *lcc; + int ret = GetLocalClientCreds(client, &lcc); + + if (ret == 0) { +#ifdef HAVE_GETZONEID /* only local if in the same zone */ + if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) { + FreeLocalClientCreds(lcc); + return -1; + } +#endif + if ((lcc->fieldsSet & LCC_UID_SET) && (pUid != NULL)) + *pUid = lcc->euid; + if ((lcc->fieldsSet & LCC_GID_SET) && (pGid != NULL)) + *pGid = lcc->egid; + FreeLocalClientCreds(lcc); + } + return ret; +} + +/* + * Return the uid and all gids of a connected local client + * Allocates a LocalClientCredRec - caller must call FreeLocalClientCreds + * + * Used by localuser & localgroup ServerInterpreted access control forms below + * Used by AuthAudit to log who local connections came from + */ +int +GetLocalClientCreds(ClientPtr client, LocalClientCredRec **lccp) +{ +#if defined(HAS_GETPEEREID) || defined(HAS_GETPEERUCRED) || defined(SO_PEERCRED) + int fd; + XtransConnInfo ci; + LocalClientCredRec *lcc; +#ifdef HAS_GETPEEREID + uid_t uid; + gid_t gid; +#elif defined(HAS_GETPEERUCRED) + ucred_t *peercred = NULL; + const gid_t *gids; +#elif defined(SO_PEERCRED) + struct ucred peercred; + socklen_t so_len = sizeof(peercred); +#endif + + if (client == NULL) + return -1; + ci = ((OsCommPtr)client->osPrivate)->trans_conn; +#if !(defined(sun) && defined(HAS_GETPEERUCRED)) + /* Most implementations can only determine peer credentials for Unix + * domain sockets - Solaris getpeerucred can work with a bit more, so + * we just let it tell us if the connection type is supported or not + */ + if (!_XSERVTransIsLocal(ci)) { + return -1; + } +#endif + + *lccp = calloc(1, sizeof(LocalClientCredRec)); + if (*lccp == NULL) + return -1; + lcc = *lccp; + + fd = _XSERVTransGetConnectionNumber(ci); +#ifdef HAS_GETPEEREID + if (getpeereid(fd, &uid, &gid) == -1) { + FreeLocalClientCreds(lcc); + return -1; + } + lcc->euid = uid; + lcc->egid = gid; + lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET; + return 0; +#elif defined(HAS_GETPEERUCRED) + if (getpeerucred(fd, &peercred) < 0) { + FreeLocalClientCreds(lcc); + return -1; + } + lcc->euid = ucred_geteuid(peercred); + if (lcc->euid != -1) + lcc->fieldsSet |= LCC_UID_SET; + lcc->egid = ucred_getegid(peercred); + if (lcc->egid != -1) + lcc->fieldsSet |= LCC_GID_SET; + lcc->pid = ucred_getpid(peercred); + if (lcc->pid != -1) + lcc->fieldsSet |= LCC_PID_SET; +#ifdef HAVE_GETZONEID + lcc->zoneid = ucred_getzoneid(peercred); + if (lcc->zoneid != -1) + lcc->fieldsSet |= LCC_ZID_SET; +#endif + lcc->nSuppGids = ucred_getgroups(peercred, &gids); + if (lcc->nSuppGids > 0) { + lcc->pSuppGids = calloc(lcc->nSuppGids, sizeof(int)); + if (lcc->pSuppGids == NULL) { + lcc->nSuppGids = 0; + } else { + int i; + for (i = 0 ; i < lcc->nSuppGids; i++) { + (lcc->pSuppGids)[i] = (int) gids[i]; + } + } + } else { + lcc->nSuppGids = 0; + } + ucred_free(peercred); + return 0; +#elif defined(SO_PEERCRED) + if (getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &peercred, &so_len) == -1) { + FreeLocalClientCreds(lcc); + return -1; + } + lcc->euid = peercred.uid; + lcc->egid = peercred.gid; + lcc->pid = peercred.pid; + lcc->fieldsSet = LCC_UID_SET | LCC_GID_SET | LCC_PID_SET; + return 0; +#endif +#else + /* No system call available to get the credentials of the peer */ +#define NO_LOCAL_CLIENT_CRED + return -1; +#endif +} + +void +FreeLocalClientCreds(LocalClientCredRec *lcc) +{ + if (lcc != NULL) { + if (lcc->nSuppGids > 0) { + free(lcc->pSuppGids); + } + free(lcc); + } +} + +static int +AuthorizedClient(ClientPtr client) +{ + int rc; + + if (!client || defeatAccessControl) + return Success; + + /* untrusted clients can't change host access */ + rc = XaceHook(XACE_SERVER_ACCESS, client, DixManageAccess); + if (rc != Success) + return rc; + + return LocalClient(client) ? Success : BadAccess; +} + +/* Add a host to the access control list. This is the external interface + * called from the dispatcher */ + +int +AddHost (ClientPtr client, + int family, + unsigned length, /* of bytes in pAddr */ + const void * pAddr) +{ + int rc, len; + + rc = AuthorizedClient(client); + if (rc != Success) + return rc; + switch (family) { + case FamilyLocalHost: + len = length; + LocalHostEnabled = TRUE; + break; +#ifdef SECURE_RPC + case FamilyNetname: + len = length; + SecureRPCInit (); + break; +#endif + case FamilyInternet: +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: +#endif + case FamilyDECnet: + case FamilyChaos: + case FamilyServerInterpreted: + if ((len = CheckAddr (family, pAddr, length)) < 0) + { + client->errorValue = length; + return BadValue; + } + break; + case FamilyLocal: + default: + client->errorValue = family; + return BadValue; + } + if (NewHost (family, pAddr, len, FALSE)) + return Success; + return BadAlloc; +} + +Bool +ForEachHostInFamily (int family, + Bool (*func)( + unsigned char * /* addr */, + short /* len */, + pointer /* closure */), + pointer closure) +{ + HOST *host; + + for (host = validhosts; host; host = host->next) + if (family == host->family && func (host->addr, host->len, closure)) + return TRUE; + return FALSE; +} + +/* Add a host to the access control list. This is the internal interface + * called when starting or resetting the server */ +static Bool +NewHost (int family, + const void * addr, + int len, + int addingLocalHosts) +{ + register HOST *host; + + for (host = validhosts; host; host = host->next) + { + if (addrEqual (family, addr, len, host)) + return TRUE; + } + if (!addingLocalHosts) { /* Fix for XFree86 bug #156 */ + for (host = selfhosts; host; host = host->next) { + if (addrEqual (family, addr, len, host)) { + host->requested = TRUE; + break; + } + } + } + MakeHost(host,len) + if (!host) + return FALSE; + host->family = family; + host->len = len; + acopy(addr, host->addr, len); + host->next = validhosts; + validhosts = host; + return TRUE; +} + +/* Remove a host from the access control list */ + +int +RemoveHost ( + ClientPtr client, + int family, + unsigned length, /* of bytes in pAddr */ + pointer pAddr) +{ + int rc, len; + register HOST *host, **prev; + + rc = AuthorizedClient(client); + if (rc != Success) + return rc; + switch (family) { + case FamilyLocalHost: + len = length; + LocalHostEnabled = FALSE; + break; +#ifdef SECURE_RPC + case FamilyNetname: + len = length; + break; +#endif + case FamilyInternet: +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: +#endif + case FamilyDECnet: + case FamilyChaos: + case FamilyServerInterpreted: + if ((len = CheckAddr (family, pAddr, length)) < 0) + { + client->errorValue = length; + return BadValue; + } + break; + case FamilyLocal: + default: + client->errorValue = family; + return BadValue; + } + for (prev = &validhosts; + (host = *prev) && (!addrEqual (family, pAddr, len, host)); + prev = &host->next) + ; + if (host) + { + *prev = host->next; + FreeHost (host); + } + return Success; +} + +/* Get all hosts in the access control list */ +int +GetHosts ( + pointer *data, + int *pnHosts, + int *pLen, + BOOL *pEnabled) +{ + int len; + register int n = 0; + register unsigned char *ptr; + register HOST *host; + int nHosts = 0; + + *pEnabled = AccessEnabled ? EnableAccess : DisableAccess; + for (host = validhosts; host; host = host->next) + { + nHosts++; + n += pad_to_int32(host->len) + sizeof(xHostEntry); + } + if (n) + { + *data = ptr = malloc(n); + if (!ptr) + { + return BadAlloc; + } + for (host = validhosts; host; host = host->next) + { + len = host->len; + ((xHostEntry *)ptr)->family = host->family; + ((xHostEntry *)ptr)->length = len; + ptr += sizeof(xHostEntry); + acopy (host->addr, ptr, len); + ptr += pad_to_int32(len); + } + } else { + *data = NULL; + } + *pnHosts = nHosts; + *pLen = n; + return Success; +} + +/* Check for valid address family and length, and return address length. */ + +/*ARGSUSED*/ +static int +CheckAddr ( + int family, + const void * pAddr, + unsigned length) +{ + int len; + + switch (family) + { +#if defined(TCPCONN) || defined(STREAMSCONN) + case FamilyInternet: + if (length == sizeof (struct in_addr)) + len = length; + else + len = -1; + break; +#if defined(IPv6) && defined(AF_INET6) + case FamilyInternet6: + if (length == sizeof (struct in6_addr)) + len = length; + else + len = -1; + break; +#endif +#endif + case FamilyServerInterpreted: + len = siCheckAddr(pAddr, length); + break; + default: + len = -1; + } + return len; +} + +/* Check if a host is not in the access control list. + * Returns 1 if host is invalid, 0 if we've found it. */ + +int +InvalidHost ( + register struct sockaddr *saddr, + int len, + ClientPtr client) +{ + int family; + pointer addr; + register HOST *selfhost, *host; + + if (!AccessEnabled) /* just let them in */ + return 0; + family = ConvertAddr (saddr, &len, (pointer *)&addr); + if (family == -1) + return 1; + if (family == FamilyLocal) + { + if (!LocalHostEnabled) + { + /* + * check to see if any local address is enabled. This + * implicitly enables local connections. + */ + for (selfhost = selfhosts; selfhost; selfhost=selfhost->next) + { + for (host = validhosts; host; host=host->next) + { + if (addrEqual (selfhost->family, selfhost->addr, + selfhost->len, host)) + return 0; + } + } + } else + return 0; + } + for (host = validhosts; host; host = host->next) + { + if ((host->family == FamilyServerInterpreted)) { + if (siAddrMatch (family, addr, len, host, client)) { + return 0; + } + } else { + if (addrEqual (family, addr, len, host)) + return 0; + } + + } + return 1; +} + +static int +ConvertAddr ( + register struct sockaddr *saddr, + int *len, + pointer *addr) +{ + if (*len == 0) + return FamilyLocal; + switch (saddr->sa_family) + { + case AF_UNSPEC: +#if defined(UNIXCONN) || defined(LOCALCONN) + case AF_UNIX: +#endif + return FamilyLocal; +#if defined(TCPCONN) || defined(STREAMSCONN) + case AF_INET: +#ifdef WIN32 + if (16777343 == *(long*)&((struct sockaddr_in *) saddr)->sin_addr) + return FamilyLocal; +#endif + *len = sizeof (struct in_addr); + *addr = (pointer) &(((struct sockaddr_in *) saddr)->sin_addr); + return FamilyInternet; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + { + struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) saddr; + if (IN6_IS_ADDR_V4MAPPED(&(saddr6->sin6_addr))) { + *len = sizeof (struct in_addr); + *addr = (pointer) &(saddr6->sin6_addr.s6_addr[12]); + return FamilyInternet; + } else { + *len = sizeof (struct in6_addr); + *addr = (pointer) &(saddr6->sin6_addr); + return FamilyInternet6; + } + } +#endif +#endif + default: + return -1; + } +} + +int +ChangeAccessControl( + ClientPtr client, + int fEnabled) +{ + int rc = AuthorizedClient(client); + if (rc != Success) + return rc; + AccessEnabled = fEnabled; + return Success; +} + +/* returns FALSE if xhost + in effect, else TRUE */ +int +GetAccessControl(void) +{ + return AccessEnabled; +} + +/***************************************************************************** + * FamilyServerInterpreted host entry implementation + * + * Supports an extensible system of host types which the server can interpret + * See the IPv6 extensions to the X11 protocol spec for the definition. + * + * Currently supported schemes: + * + * hostname - hostname as defined in IETF RFC 2396 + * ipv6 - IPv6 literal address as defined in IETF RFC's 3513 and <TBD> + * + * See xc/doc/specs/SIAddresses for formal definitions of each type. + */ + +/* These definitions and the siTypeAdd function could be exported in the + * future to enable loading additional host types, but that was not done for + * the initial implementation. + */ +typedef Bool (*siAddrMatchFunc)(int family, pointer addr, int len, + const char *siAddr, int siAddrlen, ClientPtr client, void *siTypePriv); +typedef int (*siCheckAddrFunc)(const char *addrString, int length, + void *siTypePriv); + +struct siType { + struct siType * next; + const char * typeName; + siAddrMatchFunc addrMatch; + siCheckAddrFunc checkAddr; + void * typePriv; /* Private data for type routines */ +}; + +static struct siType *siTypeList; + +static int +siTypeAdd(const char *typeName, siAddrMatchFunc addrMatch, + siCheckAddrFunc checkAddr, void *typePriv) +{ + struct siType *s, *p; + + if ((typeName == NULL) || (addrMatch == NULL) || (checkAddr == NULL)) + return BadValue; + + for (s = siTypeList, p = NULL; s != NULL ; p = s, s = s->next) { + if (strcmp(typeName, s->typeName) == 0) { + s->addrMatch = addrMatch; + s->checkAddr = checkAddr; + s->typePriv = typePriv; + return Success; + } + } + + s = malloc(sizeof(struct siType)); + if (s == NULL) + return BadAlloc; + + if (p == NULL) + siTypeList = s; + else + p->next = s; + + s->next = NULL; + s->typeName = typeName; + s->addrMatch = addrMatch; + s->checkAddr = checkAddr; + s->typePriv = typePriv; + return Success; +} + +/* Checks to see if a host matches a server-interpreted host entry */ +static Bool +siAddrMatch(int family, pointer addr, int len, HOST *host, ClientPtr client) +{ + Bool matches = FALSE; + struct siType *s; + const char *valueString; + int addrlen; + + valueString = (const char *) memchr(host->addr, '\0', host->len); + if (valueString != NULL) { + for (s = siTypeList; s != NULL ; s = s->next) { + if (strcmp((char *) host->addr, s->typeName) == 0) { + addrlen = host->len - (strlen((char *)host->addr) + 1); + matches = s->addrMatch(family, addr, len, + valueString + 1, addrlen, client, s->typePriv); + break; + } + } +#ifdef FAMILY_SI_DEBUG + ErrorF( + "Xserver: siAddrMatch(): type = %s, value = %*.*s -- %s\n", + host->addr, addrlen, addrlen, valueString + 1, + (matches) ? "accepted" : "rejected"); +#endif + } + return matches; +} + +static int +siCheckAddr(const char *addrString, int length) +{ + const char *valueString; + int addrlen, typelen; + int len = -1; + struct siType *s; + + /* Make sure there is a \0 byte inside the specified length + to separate the address type from the address value. */ + valueString = (const char *) memchr(addrString, '\0', length); + if (valueString != NULL) { + /* Make sure the first string is a recognized address type, + * and the second string is a valid address of that type. + */ + typelen = strlen(addrString) + 1; + addrlen = length - typelen; + + for (s = siTypeList; s != NULL ; s = s->next) { + if (strcmp(addrString, s->typeName) == 0) { + len = s->checkAddr(valueString + 1, addrlen, s->typePriv); + if (len >= 0) { + len += typelen; + } + break; + } + } +#ifdef FAMILY_SI_DEBUG + { + const char *resultMsg; + + if (s == NULL) { + resultMsg = "type not registered"; + } else { + if (len == -1) + resultMsg = "rejected"; + else + resultMsg = "accepted"; + } + + ErrorF("Xserver: siCheckAddr(): type = %s, value = %*.*s, len = %d -- %s\n", + addrString, addrlen, addrlen, valueString + 1, len, resultMsg); + } +#endif + } + return len; +} + + +/*** + * Hostname server-interpreted host type + * + * Stored as hostname string, explicitly defined to be resolved ONLY + * at access check time, to allow for hosts with dynamic addresses + * but static hostnames, such as found in some DHCP & mobile setups. + * + * Hostname must conform to IETF RFC 2396 sec. 3.2.2, which defines it as: + * hostname = *( domainlabel "." ) toplabel [ "." ] + * domainlabel = alphanum | alphanum *( alphanum | "-" ) alphanum + * toplabel = alpha | alpha *( alphanum | "-" ) alphanum + */ + +#ifdef NI_MAXHOST +# define SI_HOSTNAME_MAXLEN NI_MAXHOST +#else +# ifdef MAXHOSTNAMELEN +# define SI_HOSTNAME_MAXLEN MAXHOSTNAMELEN +# else +# define SI_HOSTNAME_MAXLEN 256 +# endif +#endif + +static Bool +siHostnameAddrMatch(int family, pointer addr, int len, + const char *siAddr, int siAddrLen, ClientPtr client, void *typePriv) +{ + Bool res = FALSE; + +/* Currently only supports checking against IPv4 & IPv6 connections, but + * support for other address families, such as DECnet, could be added if + * desired. + */ +#if defined(IPv6) && defined(AF_INET6) + if ((family == FamilyInternet) || (family == FamilyInternet6)) { + char hostname[SI_HOSTNAME_MAXLEN]; + struct addrinfo *addresses; + struct addrinfo *a; + int f, hostaddrlen; + pointer hostaddr; + + if (siAddrLen >= sizeof(hostname)) + return FALSE; + + strncpy(hostname, siAddr, siAddrLen); + hostname[siAddrLen] = '\0'; + + if (getaddrinfo(hostname, NULL, NULL, &addresses) == 0) { + for (a = addresses ; a != NULL ; a = a->ai_next) { + hostaddrlen = a->ai_addrlen; + f = ConvertAddr(a->ai_addr,&hostaddrlen,&hostaddr); + if ((f == family) && (len == hostaddrlen) && + (acmp (addr, hostaddr, len) == 0) ) { + res = TRUE; + break; + } + } + freeaddrinfo(addresses); + } + } +#else /* IPv6 not supported, use gethostbyname instead for IPv4 */ + if (family == FamilyInternet) { + register struct hostent *hp; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + char hostname[SI_HOSTNAME_MAXLEN]; + int f, hostaddrlen; + pointer hostaddr; + const char **addrlist; + + if (siAddrLen >= sizeof(hostname)) + return FALSE; + + strncpy(hostname, siAddr, siAddrLen); + hostname[siAddrLen] = '\0'; + + if ((hp = _XGethostbyname(hostname, hparams)) != NULL) { +#ifdef h_addr /* new 4.3bsd version of gethostent */ + /* iterate over the addresses */ + for (addrlist = hp->h_addr_list; *addrlist; addrlist++) +#else + addrlist = &hp->h_addr; +#endif + { + struct sockaddr_in sin; + + sin.sin_family = hp->h_addrtype; + acopy ( *addrlist, &(sin.sin_addr), hp->h_length); + hostaddrlen = sizeof(sin); + f = ConvertAddr ((struct sockaddr *)&sin, + &hostaddrlen, &hostaddr); + if ((f == family) && (len == hostaddrlen) && + (acmp (addr, hostaddr, len) == 0) ) { + res = TRUE; + break; + } + } + } + } +#endif + return res; +} + + +static int +siHostnameCheckAddr(const char *valueString, int length, void *typePriv) +{ + /* Check conformance of hostname to RFC 2396 sec. 3.2.2 definition. + * We do not use ctype functions here to avoid locale-specific + * character sets. Hostnames must be pure ASCII. + */ + int len = length; + int i; + Bool dotAllowed = FALSE; + Bool dashAllowed = FALSE; + + if ((length <= 0) || (length >= SI_HOSTNAME_MAXLEN)) { + len = -1; + } else { + for (i = 0; i < length; i++) { + char c = valueString[i]; + + if (c == 0x2E) { /* '.' */ + if (dotAllowed == FALSE) { + len = -1; + break; + } else { + dotAllowed = FALSE; + dashAllowed = FALSE; + } + } else if (c == 0x2D) { /* '-' */ + if (dashAllowed == FALSE) { + len = -1; + break; + } else { + dotAllowed = FALSE; + } + } else if (((c >= 0x30) && (c <= 0x3A)) /* 0-9 */ || + ((c >= 0x61) && (c <= 0x7A)) /* a-z */ || + ((c >= 0x41) && (c <= 0x5A)) /* A-Z */) { + dotAllowed = TRUE; + dashAllowed = TRUE; + } else { /* Invalid character */ + len = -1; + break; + } + } + } + return len; +} + +#if defined(IPv6) && defined(AF_INET6) +/*** + * "ipv6" server interpreted type + * + * Currently supports only IPv6 literal address as specified in IETF RFC 3513 + * + * Once draft-ietf-ipv6-scoping-arch-00.txt becomes an RFC, support will be + * added for the scoped address format it specifies. + */ + +/* Maximum length of an IPv6 address string - increase when adding support + * for scoped address qualifiers. Includes room for trailing NUL byte. + */ +#define SI_IPv6_MAXLEN INET6_ADDRSTRLEN + +static Bool +siIPv6AddrMatch(int family, pointer addr, int len, + const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) +{ + struct in6_addr addr6; + char addrbuf[SI_IPv6_MAXLEN]; + + if ((family != FamilyInternet6) || (len != sizeof(addr6))) + return FALSE; + + memcpy(addrbuf, siAddr, siAddrlen); + addrbuf[siAddrlen] = '\0'; + + if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) { + perror("inet_pton"); + return FALSE; + } + + if (memcmp(addr, &addr6, len) == 0) { + return TRUE; + } else { + return FALSE; + } +} + +static int +siIPv6CheckAddr(const char *addrString, int length, void *typePriv) +{ + int len; + + /* Minimum length is 3 (smallest legal address is "::1") */ + if (length < 3) { + /* Address is too short! */ + len = -1; + } else if (length >= SI_IPv6_MAXLEN) { + /* Address is too long! */ + len = -1; + } else { + /* Assume inet_pton is sufficient validation */ + struct in6_addr addr6; + char addrbuf[SI_IPv6_MAXLEN]; + + memcpy(addrbuf, addrString, length); + addrbuf[length] = '\0'; + + if (inet_pton(AF_INET6, addrbuf, &addr6) != 1) { + perror("inet_pton"); + len = -1; + } else { + len = length; + } + } + return len; +} +#endif /* IPv6 */ + +#if !defined(NO_LOCAL_CLIENT_CRED) +/*** + * "localuser" & "localgroup" server interpreted types + * + * Allows local connections from a given local user or group + */ + +#include <pwd.h> +#include <grp.h> + +#define LOCAL_USER 1 +#define LOCAL_GROUP 2 + +typedef struct { + int credType; +} siLocalCredPrivRec, *siLocalCredPrivPtr; + +static siLocalCredPrivRec siLocalUserPriv = { LOCAL_USER }; +static siLocalCredPrivRec siLocalGroupPriv = { LOCAL_GROUP }; + +static Bool +siLocalCredGetId(const char *addr, int len, siLocalCredPrivPtr lcPriv, int *id) +{ + Bool parsedOK = FALSE; + char *addrbuf = malloc(len + 1); + + if (addrbuf == NULL) { + return FALSE; + } + + memcpy(addrbuf, addr, len); + addrbuf[len] = '\0'; + + if (addr[0] == '#') { /* numeric id */ + char *cp; + errno = 0; + *id = strtol(addrbuf + 1, &cp, 0); + if ((errno == 0) && (cp != (addrbuf+1))) { + parsedOK = TRUE; + } + } else { /* non-numeric name */ + if (lcPriv->credType == LOCAL_USER) { + struct passwd *pw = getpwnam(addrbuf); + + if (pw != NULL) { + *id = (int) pw->pw_uid; + parsedOK = TRUE; + } + } else { /* group */ + struct group *gr = getgrnam(addrbuf); + + if (gr != NULL) { + *id = (int) gr->gr_gid; + parsedOK = TRUE; + } + } + } + + free(addrbuf); + return parsedOK; +} + +static Bool +siLocalCredAddrMatch(int family, pointer addr, int len, + const char *siAddr, int siAddrlen, ClientPtr client, void *typePriv) +{ + int siAddrId; + LocalClientCredRec *lcc; + siLocalCredPrivPtr lcPriv = (siLocalCredPrivPtr) typePriv; + + if (GetLocalClientCreds(client, &lcc) == -1) { + return FALSE; + } + +#ifdef HAVE_GETZONEID /* Ensure process is in the same zone */ + if ((lcc->fieldsSet & LCC_ZID_SET) && (lcc->zoneid != getzoneid())) { + FreeLocalClientCreds(lcc); + return FALSE; + } +#endif + + if (siLocalCredGetId(siAddr, siAddrlen, lcPriv, &siAddrId) == FALSE) { + FreeLocalClientCreds(lcc); + return FALSE; + } + + if (lcPriv->credType == LOCAL_USER) { + if ((lcc->fieldsSet & LCC_UID_SET) && (lcc->euid == siAddrId)) { + FreeLocalClientCreds(lcc); + return TRUE; + } + } else { + if ((lcc->fieldsSet & LCC_GID_SET) && (lcc->egid == siAddrId)) { + FreeLocalClientCreds(lcc); + return TRUE; + } + if (lcc->pSuppGids != NULL) { + int i; + + for (i = 0 ; i < lcc->nSuppGids; i++) { + if (lcc->pSuppGids[i] == siAddrId) { + FreeLocalClientCreds(lcc); + return TRUE; + } + } + } + } + FreeLocalClientCreds(lcc); + return FALSE; +} + +static int +siLocalCredCheckAddr(const char *addrString, int length, void *typePriv) +{ + int len = length; + int id; + + if (siLocalCredGetId(addrString, length, + (siLocalCredPrivPtr)typePriv, &id) == FALSE) { + len = -1; + } + return len; +} +#endif /* localuser */ + +static void +siTypesInitialize(void) +{ + siTypeAdd("hostname", siHostnameAddrMatch, siHostnameCheckAddr, NULL); +#if defined(IPv6) && defined(AF_INET6) + siTypeAdd("ipv6", siIPv6AddrMatch, siIPv6CheckAddr, NULL); +#endif +#if !defined(NO_LOCAL_CLIENT_CRED) + siTypeAdd("localuser", siLocalCredAddrMatch, siLocalCredCheckAddr, + &siLocalUserPriv); + siTypeAdd("localgroup", siLocalCredAddrMatch, siLocalCredCheckAddr, + &siLocalGroupPriv); +#endif +} diff --git a/xorg-server/os/osinit.c b/xorg-server/os/osinit.c index 57cd2c511..018e4047d 100644 --- a/xorg-server/os/osinit.c +++ b/xorg-server/os/osinit.c @@ -1,318 +1,315 @@ -/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-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.
-
-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
-OPEN GROUP 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 Open Group 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 Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-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 Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL 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_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include <stdio.h>
-#include <X11/X.h>
-#include "os.h"
-#include "osdep.h"
-#include <X11/Xos.h>
-#include <signal.h>
-#include <errno.h>
-#ifdef HAVE_DLFCN_H
-# include <dlfcn.h>
-#endif
-#ifdef HAVE_BACKTRACE
-#include <execinfo.h>
-#endif
-
-
-#include "dixstruct.h"
-
-#ifndef PATH_MAX
-#ifdef MAXPATHLEN
-#define PATH_MAX MAXPATHLEN
-#else
-#define PATH_MAX 1024
-#endif
-#endif
-
-#if defined(__SCO__)
-#include <sys/wait.h>
-#endif
-
-#if !defined(SYSV) && !defined(WIN32)
-#include <sys/resource.h>
-#endif
-
-#ifndef ADMPATH
-#define ADMPATH "/usr/adm/X%smsgs"
-#endif
-
-extern char *display;
-#ifdef RLIMIT_DATA
-int limitDataSpace = -1;
-#endif
-#ifdef RLIMIT_STACK
-int limitStackSpace = -1;
-#endif
-#ifdef RLIMIT_NOFILE
-int limitNoFile = -1;
-#endif
-
-static OsSigWrapperPtr OsSigWrapper = NULL;
-
-OsSigWrapperPtr
-OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper)
-{
- OsSigWrapperPtr oldSigWrapper = OsSigWrapper;
-
- OsSigWrapper = newSigWrapper;
-
- return oldSigWrapper;
-}
-
-/*
- * OsSigHandler --
- * Catch unexpected signals and exit or continue cleanly.
- */
-static void
-#ifdef SA_SIGINFO
-OsSigHandler(int signo, siginfo_t *sip, void *unused)
-#else
-OsSigHandler(int signo)
-#endif
-{
-#ifdef RTLD_DI_SETSIGNAL
- const char *dlerr = dlerror();
-
- if (dlerr) {
- LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr);
- }
-#endif /* RTLD_DI_SETSIGNAL */
-
- if (OsSigWrapper != NULL) {
- if (OsSigWrapper(signo) == 0) {
- /* ddx handled signal and wants us to continue */
- return;
- }
- }
-
- /* log, cleanup, and abort */
- xorg_backtrace();
-
-#ifdef SA_SIGINFO
- if (sip->si_code == SI_USER) {
- ErrorF("Recieved signal %d sent by process %ld, uid %ld\n",
- signo, (long) sip->si_pid, (long) sip->si_uid);
- } else {
- switch (signo) {
- case SIGSEGV:
- case SIGBUS:
- case SIGILL:
- case SIGFPE:
- ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr);
- }
- }
-#endif
-
- FatalError("Caught signal %d (%s). Server aborting\n",
- signo, strsignal(signo));
-}
-
-void
-OsInit(void)
-{
- static Bool been_here = FALSE;
- static char* devnull = "/dev/null";
- char fname[PATH_MAX];
-
- if (!been_here) {
- struct sigaction act, oact;
- int i;
- int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS,
- SIGSYS,
- SIGXCPU,
- SIGXFSZ,
-#ifdef SIGEMT
- SIGEMT,
-#endif
- 0 /* must be last */ };
- sigemptyset(&act.sa_mask);
-#ifdef SA_SIGINFO
- act.sa_sigaction = OsSigHandler;
- act.sa_flags = SA_SIGINFO;
-#else
- act.sa_handler = OsSigHandler;
- act.sa_flags = 0;
-#endif
- for (i = 0; siglist[i] != 0; i++) {
- if (sigaction(siglist[i], &act, &oact)) {
- ErrorF("failed to install signal handler for signal %d: %s\n",
- siglist[i], strerror(errno));
- }
- }
-#ifdef HAVE_BACKTRACE
- /*
- * initialize the backtracer, since the ctor calls dlopen(), which
- * calls malloc(), which isn't signal-safe.
- */
- do {
- void *array;
- backtrace(&array, 1);
- } while (0);
-#endif
-
-#ifdef RTLD_DI_SETSIGNAL
- /* Tell runtime linker to send a signal we can catch instead of SIGKILL
- * for failures to load libraries/modules at runtime so we can clean up
- * after ourselves.
- */
- int failure_signal = SIGQUIT;
- dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal);
-#endif
-
-#if !defined(__SCO__) && !defined(__CYGWIN__) && !defined(__UNIXWARE__)
- fclose(stdin);
- fclose(stdout);
-#endif
- /*
- * If a write of zero bytes to stderr returns non-zero, i.e. -1,
- * then writing to stderr failed, and we'll write somewhere else
- * instead. (Apparently this never happens in the Real World.)
- */
- if (write (2, fname, 0) == -1)
- {
- FILE *err;
-
- if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname)
- sprintf (fname, ADMPATH, display);
- else
- strcpy (fname, devnull);
- /*
- * uses stdio to avoid os dependencies here,
- * a real os would use
- * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666)
- */
- if (!(err = fopen (fname, "a+")))
- err = fopen (devnull, "w");
- if (err && (fileno(err) != 2)) {
- dup2 (fileno (err), 2);
- fclose (err);
- }
-#if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN__)
- {
- static char buf[BUFSIZ];
- setvbuf (stderr, buf, _IOLBF, BUFSIZ);
- }
-#else
- setlinebuf(stderr);
-#endif
- }
-
- if (getpgrp () == 0)
- setpgid (0, 0);
-
-#ifdef RLIMIT_DATA
- if (limitDataSpace >= 0)
- {
- struct rlimit rlim;
-
- if (!getrlimit(RLIMIT_DATA, &rlim))
- {
- if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max))
- rlim.rlim_cur = limitDataSpace;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void)setrlimit(RLIMIT_DATA, &rlim);
- }
- }
-#endif
-#ifdef RLIMIT_STACK
- if (limitStackSpace >= 0)
- {
- struct rlimit rlim;
-
- if (!getrlimit(RLIMIT_STACK, &rlim))
- {
- if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max))
- rlim.rlim_cur = limitStackSpace;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void)setrlimit(RLIMIT_STACK, &rlim);
- }
- }
-#endif
-#ifdef RLIMIT_NOFILE
- if (limitNoFile >= 0)
- {
- struct rlimit rlim;
-
- if (!getrlimit(RLIMIT_NOFILE, &rlim))
- {
- if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max))
- rlim.rlim_cur = limitNoFile;
- else
- rlim.rlim_cur = rlim.rlim_max;
- (void)setrlimit(RLIMIT_NOFILE, &rlim);
- }
- }
-#endif
- LockServer();
- been_here = TRUE;
- }
- TimerInit();
- OsVendorInit();
- /*
- * No log file by default. OsVendorInit() should call LogInit() with the
- * log file name if logging to a file is desired.
- */
- LogInit(NULL, NULL);
- SmartScheduleInit ();
-}
-
-void
-OsCleanup(Bool terminating)
-{
- if (terminating)
- {
- UnlockServer();
- }
-}
+/*********************************************************** + +Copyright 1987, 1998 The Open Group + +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. + +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 +OPEN GROUP 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 Open Group 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 Open Group. + + +Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. + + All Rights Reserved + +Permission to use, copy, modify, and distribute this software and its +documentation for any purpose and without fee is hereby granted, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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_DIX_CONFIG_H +#include <dix-config.h> +#endif + +#include <stdio.h> +#include <X11/X.h> +#include "os.h" +#include "osdep.h" +#include <X11/Xos.h> +#include <signal.h> +#include <errno.h> +#ifdef HAVE_DLFCN_H +# include <dlfcn.h> +#endif +#ifdef HAVE_BACKTRACE +#include <execinfo.h> +#endif + + +#include "dixstruct.h" + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif + + +#if !defined(SYSV) && !defined(WIN32) +#include <sys/resource.h> +#endif + +#ifndef ADMPATH +#define ADMPATH "/usr/adm/X%smsgs" +#endif + +extern char *display; +#ifdef RLIMIT_DATA +int limitDataSpace = -1; +#endif +#ifdef RLIMIT_STACK +int limitStackSpace = -1; +#endif +#ifdef RLIMIT_NOFILE +int limitNoFile = -1; +#endif + +static OsSigWrapperPtr OsSigWrapper = NULL; + +OsSigWrapperPtr +OsRegisterSigWrapper(OsSigWrapperPtr newSigWrapper) +{ + OsSigWrapperPtr oldSigWrapper = OsSigWrapper; + + OsSigWrapper = newSigWrapper; + + return oldSigWrapper; +} + +/* + * OsSigHandler -- + * Catch unexpected signals and exit or continue cleanly. + */ +static void +#ifdef SA_SIGINFO +OsSigHandler(int signo, siginfo_t *sip, void *unused) +#else +OsSigHandler(int signo) +#endif +{ +#ifdef RTLD_DI_SETSIGNAL + const char *dlerr = dlerror(); + + if (dlerr) { + LogMessage(X_ERROR, "Dynamic loader error: %s\n", dlerr); + } +#endif /* RTLD_DI_SETSIGNAL */ + + if (OsSigWrapper != NULL) { + if (OsSigWrapper(signo) == 0) { + /* ddx handled signal and wants us to continue */ + return; + } + } + + /* log, cleanup, and abort */ + xorg_backtrace(); + +#ifdef SA_SIGINFO + if (sip->si_code == SI_USER) { + ErrorF("Recieved signal %d sent by process %ld, uid %ld\n", + signo, (long) sip->si_pid, (long) sip->si_uid); + } else { + switch (signo) { + case SIGSEGV: + case SIGBUS: + case SIGILL: + case SIGFPE: + ErrorF("%s at address %p\n", strsignal(signo), sip->si_addr); + } + } +#endif + + FatalError("Caught signal %d (%s). Server aborting\n", + signo, strsignal(signo)); +} + +void +OsInit(void) +{ + static Bool been_here = FALSE; + static char* devnull = "/dev/null"; + char fname[PATH_MAX]; + + if (!been_here) { + struct sigaction act, oact; + int i; + int siglist[] = { SIGSEGV, SIGQUIT, SIGILL, SIGFPE, SIGBUS, + SIGSYS, + SIGXCPU, + SIGXFSZ, +#ifdef SIGEMT + SIGEMT, +#endif + 0 /* must be last */ }; + sigemptyset(&act.sa_mask); +#ifdef SA_SIGINFO + act.sa_sigaction = OsSigHandler; + act.sa_flags = SA_SIGINFO; +#else + act.sa_handler = OsSigHandler; + act.sa_flags = 0; +#endif + for (i = 0; siglist[i] != 0; i++) { + if (sigaction(siglist[i], &act, &oact)) { + ErrorF("failed to install signal handler for signal %d: %s\n", + siglist[i], strerror(errno)); + } + } +#ifdef HAVE_BACKTRACE + /* + * initialize the backtracer, since the ctor calls dlopen(), which + * calls malloc(), which isn't signal-safe. + */ + do { + void *array; + backtrace(&array, 1); + } while (0); +#endif + +#ifdef RTLD_DI_SETSIGNAL + /* Tell runtime linker to send a signal we can catch instead of SIGKILL + * for failures to load libraries/modules at runtime so we can clean up + * after ourselves. + */ + int failure_signal = SIGQUIT; + dlinfo(RTLD_SELF, RTLD_DI_SETSIGNAL, &failure_signal); +#endif + +#if !defined(__CYGWIN__) + fclose(stdin); + fclose(stdout); +#endif + /* + * If a write of zero bytes to stderr returns non-zero, i.e. -1, + * then writing to stderr failed, and we'll write somewhere else + * instead. (Apparently this never happens in the Real World.) + */ + if (write (2, fname, 0) == -1) + { + FILE *err; + + if (strlen (display) + strlen (ADMPATH) + 1 < sizeof fname) + sprintf (fname, ADMPATH, display); + else + strcpy (fname, devnull); + /* + * uses stdio to avoid os dependencies here, + * a real os would use + * open (fname, O_WRONLY|O_APPEND|O_CREAT, 0666) + */ + if (!(err = fopen (fname, "a+"))) + err = fopen (devnull, "w"); + if (err && (fileno(err) != 2)) { + dup2 (fileno (err), 2); + fclose (err); + } +#if defined(SYSV) || defined(SVR4) || defined(WIN32) || defined(__CYGWIN__) + { + static char buf[BUFSIZ]; + setvbuf (stderr, buf, _IOLBF, BUFSIZ); + } +#else + setlinebuf(stderr); +#endif + } + + if (getpgrp () == 0) + setpgid (0, 0); + +#ifdef RLIMIT_DATA + if (limitDataSpace >= 0) + { + struct rlimit rlim; + + if (!getrlimit(RLIMIT_DATA, &rlim)) + { + if ((limitDataSpace > 0) && (limitDataSpace < rlim.rlim_max)) + rlim.rlim_cur = limitDataSpace; + else + rlim.rlim_cur = rlim.rlim_max; + (void)setrlimit(RLIMIT_DATA, &rlim); + } + } +#endif +#ifdef RLIMIT_STACK + if (limitStackSpace >= 0) + { + struct rlimit rlim; + + if (!getrlimit(RLIMIT_STACK, &rlim)) + { + if ((limitStackSpace > 0) && (limitStackSpace < rlim.rlim_max)) + rlim.rlim_cur = limitStackSpace; + else + rlim.rlim_cur = rlim.rlim_max; + (void)setrlimit(RLIMIT_STACK, &rlim); + } + } +#endif +#ifdef RLIMIT_NOFILE + if (limitNoFile >= 0) + { + struct rlimit rlim; + + if (!getrlimit(RLIMIT_NOFILE, &rlim)) + { + if ((limitNoFile > 0) && (limitNoFile < rlim.rlim_max)) + rlim.rlim_cur = limitNoFile; + else + rlim.rlim_cur = rlim.rlim_max; + (void)setrlimit(RLIMIT_NOFILE, &rlim); + } + } +#endif + LockServer(); + been_here = TRUE; + } + TimerInit(); + OsVendorInit(); + /* + * No log file by default. OsVendorInit() should call LogInit() with the + * log file name if logging to a file is desired. + */ + LogInit(NULL, NULL); + SmartScheduleInit (); +} + +void +OsCleanup(Bool terminating) +{ + if (terminating) + { + UnlockServer(); + } +} diff --git a/xorg-server/xkeyboard-config/rules/base.xml.in b/xorg-server/xkeyboard-config/rules/base.xml.in index d9faa2d87..8d472719b 100644 --- a/xorg-server/xkeyboard-config/rules/base.xml.in +++ b/xorg-server/xkeyboard-config/rules/base.xml.in @@ -1,5726 +1,5736 @@ -<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd">
-<xkbConfigRegistry>
- <modelList>
- <model>
- <configItem>
- <name>pc101</name>
- <_description>Generic 101-key PC</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>pc102</name>
- <_description>Generic 102-key (Intl) PC</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>pc104</name>
- <_description>Generic 104-key PC</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>pc105</name>
- <_description>Generic 105-key (Intl) PC</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dell101</name>
- <_description>Dell 101-key PC</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>latitude</name>
- <_description>Dell Latitude series laptop</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dellm65</name>
- <_description>Dell Precision M65</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>everex</name>
- <_description>Everex STEPnote</_description>
- <vendor>Everex</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>flexpro</name>
- <_description>Keytronic FlexPro</_description>
- <vendor>Keytronic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoft</name>
- <_description>Microsoft Natural</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>omnikey101</name>
- <_description>Northgate OmniKey 101</_description>
- <vendor>Northgate</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>winbook</name>
- <_description>Winbook Model XP5</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>pc98</name>
- <_description>PC-98xx Series</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>a4techKB21</name>
- <_description>A4Tech KB-21</_description>
- <vendor>A4Tech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>a4techKBS8</name>
- <_description>A4Tech KBS-8</_description>
- <vendor>A4Tech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>a4_rfkb23</name>
- <_description>A4Tech Wireless Desktop RFKB-23</_description>
- <vendor>A4Tech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>airkey</name>
- <_description>Acer AirKey V</_description>
- <vendor>Acer</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>azonaRF2300</name>
- <_description>Azona RF2300 wireless Internet Keyboard</_description>
- <vendor>Azona</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>scorpius</name>
- <_description>Advance Scorpius KI</_description>
- <vendor>Scorpius</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>brother</name>
- <_description>Brother Internet Keyboard</_description>
- <vendor>Brother</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc5113rf</name>
- <_description>BTC 5113RF Multimedia</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc5126t</name>
- <_description>BTC 5126T</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc6301urf</name>
- <_description>BTC 6301URF</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc9000</name>
- <_description>BTC 9000</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc9000a</name>
- <_description>BTC 9000A</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc9001ah</name>
- <_description>BTC 9001AH</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc5090</name>
- <_description>BTC 5090</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc9019u</name>
- <_description>BTC 9019U</_description>
- <vendor>BTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>btc9116u</name>
- <_description>BTC 9116U Mini Wireless Internet and Gaming</_description>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cherryblue</name>
- <_description>Cherry Blue Line CyBo@rd</_description>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cherryblueb</name>
- <_description>Cherry CyMotion Master XPress</_description>
- <vendor>Cherry</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cherrybluea</name>
- <_description>Cherry Blue Line CyBo@rd (alternate option)</_description>
- <vendor>Cherry</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cherrycyboard</name>
- <_description>Cherry CyBo@rd USB-Hub</_description>
- <vendor>Cherry</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cherrycmexpert</name>
- <_description>Cherry CyMotion Expert</_description>
- <vendor>Cherry</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cherrybunlim</name>
- <_description>Cherry B.UNLIMITED</_description>
- <vendor>Cherry</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>chicony</name>
- <_description>Chicony Internet Keyboard</_description>
- <vendor>Chicony</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>chicony0108</name>
- <_description>Chicony KU-0108</_description>
- <vendor>Chicony</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>chicony0420</name>
- <_description>Chicony KU-0420</_description>
- <vendor>Chicony</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>chicony9885</name>
- <_description>Chicony KB-9885</_description>
- <vendor>Chicony</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>compaqeak8</name>
- <_description>Compaq Easy Access Keyboard</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>compaqik7</name>
- <_description>Compaq Internet Keyboard (7 keys)</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>compaqik13</name>
- <_description>Compaq Internet Keyboard (13 keys)</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>compaqik18</name>
- <_description>Compaq Internet Keyboard (18 keys)</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>cymotionlinux</name>
- <_description>Cherry CyMotion Master Linux</_description>
- <vendor>Cherry</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>armada</name>
- <_description>Laptop/notebook Compaq (eg. Armada) Laptop Keyboard</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>presario</name>
- <_description>Laptop/notebook Compaq (eg. Presario) Internet Keyboard</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>ipaq</name>
- <_description>Compaq iPaq Keyboard</_description>
- <vendor>Compaq</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dell</name>
- <_description>Dell</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dellsk8125</name>
- <_description>Dell SK-8125</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dellsk8135</name>
- <_description>Dell SK-8135</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dellusbmm</name>
- <_description>Dell USB Multimedia Keyboard</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>inspiron</name>
- <_description>Dell Laptop/notebook Inspiron 6xxx/8xxx</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>precision_m</name>
- <_description>Dell Laptop/notebook Precision M series</_description>
- <vendor>Dell</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dexxa</name>
- <_description>Dexxa Wireless Desktop Keyboard</_description>
- <vendor>Dexxa</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>diamond</name>
- <_description>Diamond 9801 / 9802 series</_description>
- <vendor>Diamond</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>dtk2000</name>
- <_description>DTK2000</_description>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>ennyah_dkb1008</name>
- <_description>Ennyah DKB-1008</_description>
- <vendor>Ennyah</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>fscaa1667g</name>
- <_description>Fujitsu-Siemens Computers AMILO laptop</_description>
- <vendor>Fujitsu-Siemens</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>genius</name>
- <_description>Genius Comfy KB-16M / Genius MM Keyboard KWD-910</_description>
- <vendor>Genius</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>geniuscomfy</name>
- <_description>Genius Comfy KB-12e</_description>
- <vendor>Genius</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>geniuscomfy2</name>
- <_description>Genius Comfy KB-21e-Scroll</_description>
- <vendor>Genius</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>geniuskb19e</name>
- <_description>Genius KB-19e NB</_description>
- <vendor>Genius</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>geniuskkb2050hs</name>
- <_description>Genius KKB-2050HS</_description>
- <vendor>Genius</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>gyration</name>
- <_description>Gyration</_description>
- <vendor>Gyration</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>htcdream</name>
- <_description>HTC Dream</_description>
- <vendor>HTC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>kinesis</name>
- <_description>Kinesis</_description>
- <vendor>Kinesis</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logitech_base</name>
- <_description>Logitech Generic Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logitech_g15</name>
- <_description>Logitech G15 extra keys via G15daemon</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpi6</name>
- <_description>Hewlett-Packard Internet Keyboard</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hp250x</name>
- <_description>Hewlett-Packard SK-250x Multimedia Keyboard</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpxe3gc</name>
- <_description>Hewlett-Packard Omnibook XE3 GC</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpxe3gf</name>
- <_description>Hewlett-Packard Omnibook XE3 GF</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpxt1000</name>
- <_description>Hewlett-Packard Omnibook XT1000</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpdv5</name>
- <_description>Hewlett-Packard Pavilion dv5</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpzt11xx</name>
- <_description>Hewlett-Packard Pavilion ZT11xx</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hp500fa</name>
- <_description>Hewlett-Packard Omnibook 500 FA</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hp5xx</name>
- <_description>Hewlett-Packard Omnibook 5xx</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpnx9020</name>
- <_description>Hewlett-Packard nx9020</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hp6000</name>
- <_description>Hewlett-Packard Omnibook 6000/6100</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>honeywell_euroboard</name>
- <_description>Honeywell Euroboard</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hpmini110</name>
- <_description>Hewlett-Packard Mini 110 Notebook</_description>
- <vendor>Hewlett-Packard</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>rapidaccess</name>
- <_description>IBM Rapid Access</_description>
- <vendor>Lenovo (previously IBM)</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>rapidaccess2</name>
- <_description>IBM Rapid Access II</_description>
- <vendor>Lenovo (previously IBM)</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>thinkpad</name>
- <_description>IBM ThinkPad 560Z/600/600E/A22E</_description>
- <vendor>Lenovo (previously IBM)</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>thinkpad60</name>
- <_description>IBM ThinkPad R60/T60/R61/T61</_description>
- <vendor>Lenovo (previously IBM)</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>thinkpadz60</name>
- <_description>IBM ThinkPad Z60m/Z60t/Z61m/Z61t</_description>
- <vendor>Lenovo (previously IBM)</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>ibm_spacesaver</name>
- <_description>IBM Space Saver</_description>
- <vendor>Lenovo (previously IBM)</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiaccess</name>
- <_description>Logitech Access Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiclx300</name>
- <_description>Logitech Cordless Desktop LX-300</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logii350</name>
- <_description>Logitech Internet 350 Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logimel</name>
- <_description>Logitech Media Elite Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicd</name>
- <_description>Logitech Cordless Desktop</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicd_it</name>
- <_description>Logitech Cordless Desktop iTouch</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicd_nav</name>
- <_description>Logitech Cordless Desktop Navigator</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicd_opt</name>
- <_description>Logitech Cordless Desktop Optical</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicda</name>
- <_description>Logitech Cordless Desktop (alternate option)</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicdpa2</name>
- <_description>Logitech Cordless Desktop Pro (alternate option 2)</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicfn</name>
- <_description>Logitech Cordless Freedom/Desktop Navigator</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicdn</name>
- <_description>Logitech Cordless Desktop Navigator</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiitc</name>
- <_description>Logitech iTouch Cordless Keyboard (model Y-RB6)</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiik</name>
- <_description>Logitech Internet Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>itouch</name>
- <_description>Logitech iTouch</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logicink</name>
- <_description>Logitech Internet Navigator Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiex110</name>
- <_description>Logitech Cordless Desktop EX110</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiinkse</name>
- <_description>Logitech iTouch Internet Navigator Keyboard SE</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiinkseusb</name>
- <_description>Logitech iTouch Internet Navigator Keyboard SE (USB)</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiultrax</name>
- <_description>Logitech Ultra-X Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logiultraxc</name>
- <_description>Logitech Ultra-X Cordless Media Desktop Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logidinovo</name>
- <_description>Logitech diNovo Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>logidinovoedge</name>
- <_description>Logitech diNovo Edge Keyboard</_description>
- <vendor>Logitech</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>mx1998</name>
- <_description>Memorex MX1998</_description>
- <vendor>Memorex</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>mx2500</name>
- <_description>Memorex MX2500 EZ-Access Keyboard</_description>
- <vendor>Memorex</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>mx2750</name>
- <_description>Memorex MX2750</_description>
- <vendor>Memorex</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoft7000</name>
- <_description>Microsoft Natural Wireless Ergonomic Keyboard 7000</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftinet</name>
- <_description>Microsoft Internet Keyboard</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftpro</name>
- <_description>Microsoft Natural Keyboard Pro / Microsoft Internet Keyboard Pro</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftprousb</name>
- <_description>Microsoft Natural Keyboard Pro USB / Microsoft Internet Keyboard Pro</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftprooem</name>
- <_description>Microsoft Natural Keyboard Pro OEM</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>vsonku306</name>
- <_description>ViewSonic KU-306 Internet Keyboard</_description>
- <vendor>ViewSonic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftprose</name>
- <_description>Microsoft Internet Keyboard Pro, Swedish</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftoffice</name>
- <_description>Microsoft Office Keyboard</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftmult</name>
- <_description>Microsoft Wireless Multimedia Keyboard 1.0A</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftelite</name>
- <_description>Microsoft Natural Keyboard Elite</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>microsoftccurve2k</name>
- <_description>Microsoft Comfort Curve Keyboard 2000</_description>
- <vendor>Microsoft Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>oretec</name>
- <_description>Ortek MCK-800 MM/Internet keyboard</_description>
- <vendor>Ortek</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>propeller</name>
- <_description>Propeller Voyager (KTEZ-1000)</_description>
- <vendor>KeyTronic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>qtronix</name>
- <_description>QTronix Scorpius 98N+</_description>
- <vendor>QTronix</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>samsung4500</name>
- <_description>Samsung SDM 4500P</_description>
- <vendor>Samsung</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>samsung4510</name>
- <_description>Samsung SDM 4510P</_description>
- <vendor>Samsung</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sanwaskbkg3</name>
- <description>Sanwa Supply SKB-KG3</description>
- <vendor>Sanwa Supply Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sk1300</name>
- <_description>SK-1300</_description>
- <vendor>NEC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sk2500</name>
- <_description>SK-2500</_description>
- <vendor>NEC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sk6200</name>
- <_description>SK-6200</_description>
- <vendor>NEC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sk7100</name>
- <_description>SK-7100</_description>
- <vendor>NEC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sp_inet</name>
- <_description>Super Power Multimedia Keyboard</_description>
- <vendor>Generic</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sven</name>
- <_description>SVEN Ergonomic 2500</_description>
- <vendor>SVEN</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sven303</name>
- <_description>SVEN Slim 303</_description>
- <vendor>SVEN</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>symplon</name>
- <_description>Symplon PaceBook (tablet PC)</_description>
- <vendor>Symplon</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>toshiba_s3000</name>
- <_description>Toshiba Satellite S3000</_description>
- <vendor>Toshiba</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>trust</name>
- <_description>Trust Wireless Keyboard Classic</_description>
- <vendor>Trust</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>trustda</name>
- <_description>Trust Direct Access Keyboard</_description>
- <vendor>Trust</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>trust_slimline</name>
- <_description>Trust Slimline</_description>
- <vendor>Trust</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>tm2020</name>
- <_description>TypeMatrix EZ-Reach 2020</_description>
- <vendor>TypeMatrix</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>tm2030PS2</name>
- <_description>TypeMatrix EZ-Reach 2030 PS2</_description>
- <vendor>TypeMatrix</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>tm2030USB</name>
- <_description>TypeMatrix EZ-Reach 2030 USB</_description>
- <vendor>TypeMatrix</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>tm2030USB-102</name>
- <_description>TypeMatrix EZ-Reach 2030 USB (102/105:EU mode)</_description>
- <vendor>TypeMatrix</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>tm2030USB-106</name>
- <_description>TypeMatrix EZ-Reach 2030 USB (106:JP mode)</_description>
- <vendor>TypeMatrix</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>yahoo</name>
- <_description>Yahoo! Internet Keyboard</_description>
- <vendor>Yahoo!</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>macbook78</name>
- <_description>MacBook/MacBook Pro</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>macbook79</name>
- <_description>MacBook/MacBook Pro (Intl)</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>macintosh</name>
- <_description>Macintosh</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>macintosh_old</name>
- <_description>Macintosh Old</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>macintosh_hhk</name>
- <_description>Happy Hacking Keyboard for Mac</_description>
- <vendor>Fujitsu</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>acer_c300</name>
- <_description>Acer C300</_description>
- <vendor>Acer</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>acer_ferrari4k</name>
- <_description>Acer Ferrari 4000</_description>
- <vendor>Acer</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>acer_laptop</name>
- <_description>Acer Laptop</_description>
- <vendor>Acer</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>asus_laptop</name>
- <_description>Asus Laptop</_description>
- <vendor>Asus</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>apple</name>
- <_description>Apple</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>apple_laptop</name>
- <_description>Apple Laptop</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>applealu_ansi</name>
- <_description>Apple Aluminium Keyboard (ANSI)</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>applealu_iso</name>
- <_description>Apple Aluminium Keyboard (ISO)</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>applealu_jis</name>
- <_description>Apple Aluminium Keyboard (JIS)</_description>
- <vendor>Apple</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>silvercrest</name>
- <_description>SILVERCREST Multimedia Wireless Keyboard</_description>
- <vendor>Silvercrest</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>emachines</name>
- <_description>Laptop/notebook eMachines m68xx</_description>
- <vendor>eMachines</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>benqx</name>
- <_description>BenQ X-Touch</_description>
- <vendor>BenQ</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>benqx730</name>
- <_description>BenQ X-Touch 730</_description>
- <vendor>BenQ</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>benqx800</name>
- <_description>BenQ X-Touch 800</_description>
- <vendor>BenQ</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>hhk</name>
- <_description>Happy Hacking Keyboard</_description>
- <vendor>Fujitsu</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>classmate</name>
- <_description>Classmate PC</_description>
- <vendor>Intel</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>olpc</name>
- <_description>OLPC</_description>
- <vendor>OLPC</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>sun6</name>
- <_description>Sun Type 5/6</_description>
- <vendor>Sun Microsystems</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>targa_v811</name>
- <_description>Targa Visionary 811</_description>
- <vendor>Targa</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>unitekkb1925</name>
- <_description>Unitek KB-1925</_description>
- <vendor>Unitek Group</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>compalfl90</name>
- <_description>FL90</_description>
- <vendor>Compal Electronics Inc.</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>creativedw7000</name>
- <_description>Creative Desktop Wireless 7000</_description>
- <vendor>Creative</vendor>
- </configItem>
- </model>
- <model>
- <configItem>
- <name>htcdream</name>
- <_description>Htc Dream phone</_description>
- <vendor>htc</vendor>
- </configItem>
- </model>
- </modelList>
- <layoutList>
- <layout>
- <configItem>
- <name>us</name>
- <_shortDescription>USA</_shortDescription>
- <_description>USA</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>chr</name>
- <_description>Cherokee</_description>
- <languageList><iso639Id>chr</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>euro</name>
- <_description>With EuroSign on 5</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>intl</name>
- <_description>International (with dead keys)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>alt-intl</name>
- <_description>Alternative international</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>colemak</name>
- <_description>Colemak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-intl</name>
- <_description>Dvorak international (with dead keys)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-alt-intl</name>
- <_description>Dvorak alternative international (no dead keys)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-l</name>
- <_description>Left handed Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-r</name>
- <_description>Right handed Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-classic</name>
- <_description>Classic Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvp</name>
- <_description>Programmer Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>rus</name>
- <_description>Russian phonetic</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>altgr-intl</name>
- <_description>International (AltGr dead keys)</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>fra</iso639Id>
- <iso639Id>ger</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>olpc2</name>
- <_description>Layout toggle on multiply/divide key</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>srp</name>
- <_description>Serbian</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>srp</iso639Id> </languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ad</name>
- <_shortDescription>And</_shortDescription>
- <_description>Andorra</_description>
- <languageList><iso639Id>cat</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>af</name>
- <_shortDescription>Afg</_shortDescription>
- <_description>Afghanistan</_description>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>ps</name>
- <_description>Pashto</_description>
- <languageList><iso639Id>pus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>uz</name>
- <_description>Southern Uzbek</_description>
- <languageList><iso639Id>uzb</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>olpc-ps</name>
- <_description>OLPC Pashto</_description>
- <languageList><iso639Id>pus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>olpc-fa</name>
- <_description>OLPC Dari</_description>
- <!-- No ISO code in ISO639-2, only draft ISO693-3 -->
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>olpc-uz</name>
- <_description>OLPC Southern Uzbek</_description>
- <languageList><iso639Id>uzb</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ara</name>
- <_shortDescription>Ara</_shortDescription>
- <_description>Arabic</_description>
- <countryList>
- <iso3166Id>AE</iso3166Id>
- <iso3166Id>BH</iso3166Id>
- <iso3166Id>DZ</iso3166Id>
- <iso3166Id>EG</iso3166Id>
- <iso3166Id>EH</iso3166Id>
- <iso3166Id>JO</iso3166Id>
- <iso3166Id>KW</iso3166Id>
- <iso3166Id>LB</iso3166Id>
- <iso3166Id>LY</iso3166Id>
- <iso3166Id>MA</iso3166Id>
- <iso3166Id>MR</iso3166Id>
- <iso3166Id>OM</iso3166Id>
- <iso3166Id>PS</iso3166Id>
- <iso3166Id>QA</iso3166Id>
- <iso3166Id>SA</iso3166Id>
- <iso3166Id>SD</iso3166Id>
- <iso3166Id>SY</iso3166Id>
- <iso3166Id>TN</iso3166Id>
- <iso3166Id>YE</iso3166Id>
- </countryList>
- <languageList><iso639Id>ara</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>azerty</name>
- <_description>azerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>azerty_digits</name>
- <_description>azerty/digits</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>digits</name>
- <_description>digits</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty</name>
- <_description>qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty_digits</name>
- <_description>qwerty/digits</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>buckwalter</name>
- <_description>Buckwalter</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>al</name>
- <_shortDescription>Alb</_shortDescription>
- <_description>Albania</_description>
- <languageList><iso639Id>alb</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>am</name>
- <_shortDescription>Arm</_shortDescription>
- <_description>Armenia</_description>
- <languageList><iso639Id>hye</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>phonetic</name>
- <_description>Phonetic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>phonetic-alt</name>
- <_description>Alternative Phonetic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>eastern</name>
- <_description>Eastern</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>western</name>
- <_description>Western</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>eastern-alt</name>
- <_description>Alternative Eastern</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>at</name>
- <_shortDescription>Aut</_shortDescription>
- <_description>Austria</_description>
- <languageList><iso639Id>ger</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>az</name>
- <_shortDescription>Aze</_shortDescription>
- <_description>Azerbaijan</_description>
- <languageList><iso639Id>aze</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>cyrillic</name>
- <_description>Cyrillic</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>by</name>
- <_shortDescription>Blr</_shortDescription>
- <_description>Belarus</_description>
- <languageList><iso639Id>bel</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>legacy</name>
- <_description>Legacy</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latin</name>
- <_description>Latin</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>be</name>
- <_shortDescription>Bel</_shortDescription>
- <_description>Belgium</_description>
- <languageList><iso639Id>ger</iso639Id>
- <iso639Id>nld</iso639Id>
- <iso639Id>fra</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>oss</name>
- <_description>Alternative</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oss_latin9</name>
- <_description>Alternative, latin-9 only</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oss_sundeadkeys</name>
- <_description>Alternative, Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>iso-alternate</name>
- <_description>ISO Alternate</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>wang</name>
- <_description>Wang model 724 azerty</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>bd</name>
- <_shortDescription>Bgd</_shortDescription>
- <_description>Bangladesh</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>probhat</name>
- <_description>Probhat</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>in</name>
- <_shortDescription>Ind</_shortDescription>
- <_description>India</_description>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>ben</name>
- <_description>Bengali</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ben_probhat</name>
- <_description>Bengali Probhat</_description>
- <languageList><iso639Id>ben</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>guj</name>
- <_description>Gujarati</_description>
- <languageList><iso639Id>guj</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>guru</name>
- <_description>Gurmukhi</_description>
- <languageList><iso639Id>pan</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>jhelum</name>
- <_description>Gurmukhi Jhelum</_description>
- <languageList><iso639Id>pan</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>kan</name>
- <_description>Kannada</_description>
- <languageList><iso639Id>kan</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mal</name>
- <_description>Malayalam</_description>
- <languageList><iso639Id>mal</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mal_lalitha</name>
- <_description>Malayalam Lalitha</_description>
- <languageList><iso639Id>mal</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ori</name>
- <_description>Oriya</_description>
- <languageList><iso639Id>ori</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tam_unicode</name>
- <_description>Tamil Unicode</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tam_keyboard_with_numerals</name>
- <_description>Tamil Keyboard with Numerals</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tam_TAB</name>
- <_description>Tamil TAB Typewriter</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tam_TSCII</name>
- <_description>Tamil TSCII Typewriter</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tam</name>
- <_description>Tamil</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tel</name>
- <_description>Telugu</_description>
- <languageList><iso639Id>tel</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>urd-phonetic</name>
- <_description>Urdu, Phonetic</_description>
- <languageList><iso639Id>urd</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>urd-phonetic3</name>
- <_description>Urdu, Alternative phonetic</_description>
- <languageList><iso639Id>urd</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>urd-winkeys</name>
- <_description>Urdu, Winkeys</_description>
- <languageList><iso639Id>urd</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>bolnagri</name>
- <_description>Hindi Bolnagri</_description>
- <languageList><iso639Id>hin</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>hin-wx</name>
- <_description>Hindi Wx</_description>
- <languageList><iso639Id>hin</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>eng</name>
- <_description>English with RupeeSign</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ba</name>
- <_shortDescription>Bih</_shortDescription>
- <_description>Bosnia and Herzegovina</_description>
- <languageList><iso639Id>bos</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>alternatequotes</name>
- <_description> Use guillemets for quotes</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>unicode</name>
- <_description>Use Bosnian digraphs</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>unicodeus</name>
- <_description>US keyboard with Bosnian digraphs</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us</name>
- <_description>US keyboard with Bosnian letters</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>br</name>
- <_shortDescription>Bra</_shortDescription>
- <_description>Brazil</_description>
- <languageList><iso639Id>por</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nativo</name>
- <_description>Nativo</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nativo-us</name>
- <_description>Nativo for USA keyboards</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nativo-epo</name>
- <_description>Nativo for Esperanto</_description>
- <languageList><iso639Id>epo</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>bg</name>
- <_shortDescription>Bgr</_shortDescription>
- <_description>Bulgaria</_description>
- <languageList><iso639Id>bul</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>phonetic</name>
- <_description>Traditional phonetic</_description>
- </configItem>
- </variant>
- </variantList>
- <variantList>
- <variant>
- <configItem>
- <name>bas_phonetic</name>
- <_description>New phonetic</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ma</name>
- <_description>Morocco</_description>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>french</name>
- <_description>French</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tifinagh</name>
- <_description>Tifinagh</_description>
- <languageList><iso639Id>ber</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tifinagh-alt</name>
- <_description>Tifinagh alternative</_description>
- <languageList><iso639Id>ber</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tifinagh-alt-phonetic</name>
- <_description>Tifinagh alternative phonetic</_description>
- <languageList><iso639Id>ber</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tifinagh-extended</name>
- <_description>Tifinagh extended</_description>
- <languageList><iso639Id>ber</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tifinagh-phonetic</name>
- <_description>Tifinagh phonetic</_description>
- <languageList><iso639Id>ber</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tifinagh-extended-phonetic</name>
- <_description>Tifinagh extended phonetic</_description>
- <languageList><iso639Id>ber</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>mm</name>
- <_shortDescription>Mmr</_shortDescription>
- <_description>Myanmar</_description>
- <languageList><iso639Id>mya</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>ca</name>
- <_shortDescription>Can</_shortDescription>
- <_description>Canada</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>fr-dvorak</name>
- <_description>French Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fr-legacy</name>
- <_description>French (legacy)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>multix</name>
- <_description>Multilingual</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>multi</name>
- <_description>Multilingual, first part</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>multi-2gr</name>
- <_description>Multilingual, second part</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ike</name>
- <_description>Inuktitut</_description>
- <languageList><iso639Id>iku</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>shs</name>
- <_description>Secwepemctsin</_description>
- <!-- No ISO code in ISO639-2, only draft ISO693-3 -->
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>kut</name>
- <_description>Ktunaxa</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>eng</name>
- <_description>English</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>cd</name>
- <_shortDescription>COD</_shortDescription>
- <_description>Congo, Democratic Republic of the</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>cn</name>
- <_shortDescription>Chn</_shortDescription>
- <_description>China</_description>
- <languageList><iso639Id>chi</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>tib</name>
- <_description>Tibetan</_description>
- <languageList><iso639Id>tib</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tib_asciinum</name>
- <_description>Tibetan (with ASCII numerals)</_description>
- <languageList><iso639Id>tib</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>hr</name>
- <_shortDescription>Hrv</_shortDescription>
- <_description>Croatia</_description>
- <languageList><iso639Id>scr</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>alternatequotes</name>
- <_description>Use guillemets for quotes</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>unicode</name>
- <_description>Use Croatian digraphs</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>unicodeus</name>
- <_description>US keyboard with Croatian digraphs</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us</name>
- <_description>US keyboard with Croatian letters</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>cz</name>
- <_shortDescription>Cze</_shortDescription>
- <_description>Czechia</_description>
- <languageList><iso639Id>cze</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>bksl</name>
- <_description>With <\|> key</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty</name>
- <_description>qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty_bksl</name>
- <_description>qwerty, extended Backslash</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ucw</name>
- <_description>UCW layout (accented letters only)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-ucw</name>
- <_description>US Dvorak with CZ UCW support</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>dk</name>
- <_shortDescription>Dnk</_shortDescription>
- <_description>Denmark</_description>
- <languageList><iso639Id>dan</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac_nodeadkeys</name>
- <_description>Macintosh, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>nl</name>
- <_shortDescription>Nld</_shortDescription>
- <_description>Netherlands</_description>
- <languageList><iso639Id>nld</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>std</name>
- <_description>Standard</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>bt</name>
- <_shortDescription>Btn</_shortDescription>
- <_description>Bhutan</_description>
- <languageList><iso639Id>dzo</iso639Id></languageList>
- </configItem>
- </layout>
- <layout>
- <configItem>
- <name>ee</name>
- <_shortDescription>Est</_shortDescription>
- <_description>Estonia</_description>
- <languageList><iso639Id>est</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us</name>
- <_description>US keyboard with Estonian letters</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ir</name>
- <_shortDescription>Irn</_shortDescription>
- <_description>Iran</_description>
- <languageList><iso639Id>per</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>pes_keypad</name>
- <_description>Persian, with Persian Keypad</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku</name>
- <_description>Kurdish, Latin Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_f</name>
- <_description>Kurdish, (F)</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_alt</name>
- <_description>Kurdish, Latin Alt-Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_ara</name>
- <_description>Kurdish, Arabic-Latin</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>iq</name>
- <_shortDescription>Irq</_shortDescription>
- <_description>Iraq</_description>
- <languageList><iso639Id>ara</iso639Id>
- <iso639Id>kur</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>ku</name>
- <_description>Kurdish, Latin Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_f</name>
- <_description>Kurdish, (F)</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_alt</name>
- <_description>Kurdish, Latin Alt-Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_ara</name>
- <_description>Kurdish, Arabic-Latin</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>fo</name>
- <_shortDescription>Fro</_shortDescription>
- <_description>Faroe Islands</_description>
- <languageList><iso639Id>fao</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>fi</name>
- <_shortDescription>Fin</_shortDescription>
- <_description>Finland</_description>
- <languageList><iso639Id>fin</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>classic</name>
- <_description>Classic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Classic, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>smi</name>
- <_description>Northern Saami</_description>
- <languageList><iso639Id>smi</iso639Id>
- <iso639Id>sme</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>fr</name>
- <_shortDescription>Fra</_shortDescription>
- <_description>France</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oss</name>
- <_description>Alternative</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oss_latin9</name>
- <_description>Alternative, latin-9 only</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oss_nodeadkeys</name>
- <_description>Alternative, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oss_sundeadkeys</name>
- <_description>Alternative, Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latin9</name>
- <_description>(Legacy) Alternative</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latin9_nodeadkeys</name>
- <_description>(Legacy) Alternative, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latin9_sundeadkeys</name>
- <_description>(Legacy) Alternative, Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>bepo</name>
- <_description>Bepo, ergonomic, Dvorak way</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>bepo_latin9</name>
- <_description>Bepo, ergonomic, Dvorak way, latin-9 only</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>bre</name>
- <_description>Breton</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>oci</name>
- <_description>Occitan</_description>
- <languageList><iso639Id>oci</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>geo</name>
- <_description>Georgian AZERTY Tskapo</_description>
- <languageList><iso639Id>geo</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>gh</name>
- <_shortDescription>Gha</_shortDescription>
- <_description>Ghana</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>generic</name>
- <_description>Multilingual</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>akan</name>
- <_description>Akan</_description>
- <languageList><iso639Id>aka</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ewe</name>
- <_description>Ewe</_description>
- <languageList><iso639Id>ewe</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fula</name>
- <_description>Fula</_description>
- <languageList><iso639Id>ful</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ga</name>
- <_description>Ga</_description>
- <languageList><iso639Id>gaa</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>hausa</name>
- <_description>Hausa</_description>
- <languageList><iso639Id>hau</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>avn</name>
- <_description>Avatime</_description>
- <languageList><iso639Id>avn</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>gillbt</name>
- <_description>GILLBT</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>gn</name>
- <_shortDescription>Gin</_shortDescription>
- <_description>Guinea</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>ge</name>
- <_shortDescription>Geo</_shortDescription>
- <_description>Georgia</_description>
- <languageList><iso639Id>geo</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>ergonomic</name>
- <_description>Ergonomic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mess</name>
- <_description>MESS</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ru</name>
- <_description>Russian</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>os</name>
- <_description>Ossetian</_description>
- <languageList><iso639Id>oss</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>de</name>
- <_shortDescription>Deu</_shortDescription>
- <_description>Germany</_description>
- <languageList><iso639Id>ger</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>deadacute</name>
- <_description>Dead acute</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>deadgraveacute</name>
- <_description>Dead grave acute</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ro</name>
- <_description>Romanian keyboard with German letters</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ro_nodeadkeys</name>
- <_description>Romanian keyboard with German letters, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>neo</name>
- <_description>Neo 2</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac_nodeadkeys</name>
- <_description>Macintosh, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dsb</name>
- <_description>Lower Sorbian</_description>
- <languageList><iso639Id>dsb</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dsb_qwertz</name>
- <_description>Lower Sorbian (qwertz)</_description>
- <languageList><iso639Id>dsb</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty</name>
- <_description>qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ru</name>
- <_description>Russian phonetic</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>gr</name>
- <_shortDescription>Grc</_shortDescription>
- <_description>Greece</_description>
- <languageList><iso639Id>gre</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>simple</name>
- <_description>Simple</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>extended</name>
- <_description>Extended</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>polytonic</name>
- <_description>Polytonic</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>hu</name>
- <_shortDescription>Hun</_shortDescription>
- <_description>Hungary</_description>
- <languageList><iso639Id>hun</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>standard</name>
- <_description>Standard</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty</name>
- <_description>qwerty</_description>
- </configItem>
- </variant>
-
- <!-- 101 keys -->
- <variant>
- <configItem>
- <name>101_qwertz_comma_dead</name>
- <_description>101/qwertz/comma/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwertz_comma_nodead</name>
- <_description>101/qwertz/comma/Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwertz_dot_dead</name>
- <_description>101/qwertz/dot/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwertz_dot_nodead</name>
- <_description>101/qwertz/dot/Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwerty_comma_dead</name>
- <_description>101/qwerty/comma/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwerty_comma_nodead</name>
- <_description>101/qwerty/comma/Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwerty_dot_dead</name>
- <_description>101/qwerty/dot/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>101_qwerty_dot_nodead</name>
- <_description>101/qwerty/dot/Eliminate dead keys</_description>
- </configItem>
- </variant>
-
-
- <!-- 102 keys -->
- <variant>
- <configItem>
- <name>102_qwertz_comma_dead</name>
- <_description>102/qwertz/comma/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwertz_comma_nodead</name>
- <_description>102/qwertz/comma/Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwertz_dot_dead</name>
- <_description>102/qwertz/dot/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwertz_dot_nodead</name>
- <_description>102/qwertz/dot/Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwerty_comma_dead</name>
- <_description>102/qwerty/comma/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwerty_comma_nodead</name>
- <_description>102/qwerty/comma/Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwerty_dot_dead</name>
- <_description>102/qwerty/dot/Dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>102_qwerty_dot_nodead</name>
- <_description>102/qwerty/dot/Eliminate dead keys</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>is</name>
- <_shortDescription>Isl</_shortDescription>
- <_description>Iceland</_description>
- <languageList><iso639Id>ice</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>Sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>il</name>
- <_shortDescription>Isr</_shortDescription>
- <_description>Israel</_description>
- <languageList><iso639Id>heb</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>lyx</name>
- <_description>lyx</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>phonetic</name>
- <_description>Phonetic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>biblical</name>
- <_description>Biblical Hebrew (Tiro)</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>it</name>
- <_shortDescription>Ita</_shortDescription>
- <_description>Italy</_description>
- <languageList><iso639Id>ita</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us</name>
- <_description>US keyboard with Italian letters</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>geo</name>
- <_description>Georgian</_description>
- <languageList><iso639Id>geo</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>jp</name>
- <_shortDescription>Jpn</_shortDescription>
- <_description>Japan</_description>
- <languageList><iso639Id>jpn</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>kana</name>
- <_description>Kana</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>kana86</name>
- <_description>Kana 86</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>OADG109A</name>
- <_description>OADG 109A</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>kg</name>
- <_shortDescription>Kgz</_shortDescription>
- <_description>Kyrgyzstan</_description>
- <languageList><iso639Id>kir</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>phonetic</name>
- <_description>Phonetic</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>kh</name>
- <_shortDescription>Khm</_shortDescription>
- <_description>Cambodia</_description>
- <languageList><iso639Id>khm</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>kz</name>
- <_shortDescription>Kaz</_shortDescription>
- <_description>Kazakhstan</_description>
- <languageList><iso639Id>kaz</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>ruskaz</name>
- <_description>Russian with Kazakh</_description>
- <languageList><iso639Id>kaz</iso639Id>
- <iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>kazrus</name>
- <_description>Kazakh with Russian</_description>
- <languageList><iso639Id>kaz</iso639Id>
- <iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>la</name>
- <_shortDescription>Lao</_shortDescription>
- <_description>Laos</_description>
- <languageList><iso639Id>lao</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>latam</name>
- <_shortDescription>LAm</_shortDescription>
- <_description>Latin American</_description>
- <countryList>
- <iso3166Id>AR</iso3166Id>
- <iso3166Id>BO</iso3166Id>
- <iso3166Id>CL</iso3166Id>
- <iso3166Id>CO</iso3166Id>
- <iso3166Id>CR</iso3166Id>
- <iso3166Id>CU</iso3166Id>
- <iso3166Id>DO</iso3166Id>
- <iso3166Id>EC</iso3166Id>
- <iso3166Id>GT</iso3166Id>
- <iso3166Id>HN</iso3166Id>
- <iso3166Id>HT</iso3166Id>
- <iso3166Id>MX</iso3166Id>
- <iso3166Id>NI</iso3166Id>
- <iso3166Id>PA</iso3166Id>
- <iso3166Id>PE</iso3166Id>
- <iso3166Id>PR</iso3166Id>
- <iso3166Id>PY</iso3166Id>
- <iso3166Id>SV</iso3166Id>
- <iso3166Id>US</iso3166Id>
- <iso3166Id>UY</iso3166Id>
- <iso3166Id>VE</iso3166Id>
- </countryList>
- <languageList><iso639Id>spa</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>deadtilde</name>
- <_description>Include dead tilde</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>lt</name>
- <_shortDescription>Ltu</_shortDescription>
- <_description>Lithuania</_description>
- <languageList><iso639Id>lit</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>std</name>
- <_description>Standard</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us</name>
- <_description>US keyboard with Lithuanian letters</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ibm</name>
- <_description>IBM (LST 1205-92)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>lekp</name>
- <_description>LEKP</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>lekpa</name>
- <_description>LEKPa</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>lv</name>
- <_shortDescription>Lva</_shortDescription>
- <_description>Latvia</_description>
- <languageList><iso639Id>lav</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>apostrophe</name>
- <_description>Apostrophe (') variant</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tilde</name>
- <_description>Tilde (~) variant</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fkey</name>
- <_description>F-letter (F) variant</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>mao</name>
- <_shortDescription>Mao</_shortDescription>
- <_description>Maori</_description>
- <languageList><iso639Id>mao</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>me</name>
- <_shortDescription>MNE</_shortDescription>
- <_description>Montenegro</_description>
- <languageList><iso639Id>srp</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>cyrillic</name>
- <_description>Cyrillic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>cyrillicyz</name>
- <_description>Cyrillic, Z and ZHE swapped</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinunicode</name>
- <_description>Latin unicode</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinyz</name>
- <_description>Latin qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinunicodeyz</name>
- <_description>Latin unicode qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>cyrillicalternatequotes</name>
- <_description>Cyrillic with guillemets</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinalternatequotes</name>
- <_description>Latin with guillemets</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>mk</name>
- <_shortDescription>Mkd</_shortDescription>
- <_description>Macedonia</_description>
- <languageList><iso639Id>mkd</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>mt</name>
- <_shortDescription>Mlt</_shortDescription>
- <_description>Malta</_description>
- <languageList><iso639Id>mlt</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>us</name>
- <_description>Maltese keyboard with US layout</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>mn</name>
- <_shortDescription>Mng</_shortDescription>
- <_description>Mongolia</_description>
- <languageList><iso639Id>mng</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>no</name>
- <_shortDescription>Nor</_shortDescription>
- <_description>Norway</_description>
- <languageList><iso639Id>nor</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>smi</name>
- <_description>Northern Saami</_description>
- <languageList><iso639Id>sme</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>smi_nodeadkeys</name>
- <_description>Northern Saami, eliminate dead keys</_description>
- <languageList><iso639Id>sme</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac_nodeadkeys</name>
- <_description>Macintosh, eliminate dead keys</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>pl</name>
- <_shortDescription>Pol</_shortDescription>
- <_description>Poland</_description>
- <languageList><iso639Id>pol</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>qwertz</name>
- <_description>qwertz</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak_quotes</name>
- <_description>Dvorak, Polish quotes on quotemark key</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak_altquotes</name>
- <_description>Dvorak, Polish quotes on key 1</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>csb</name>
- <_description>Kashubian</_description>
- <languageList><iso639Id>csb</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ru_phonetic_dvorak</name>
- <_description>Russian phonetic Dvorak</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvp</name>
- <_description>Programmer Dvorak</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>pt</name>
- <_shortDescription>Prt</_shortDescription>
- <_description>Portugal</_description>
- <languageList><iso639Id>por</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac_nodeadkeys</name>
- <_description>Macintosh, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac_sundeadkeys</name>
- <_description>Macintosh, Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nativo</name>
- <_description>Nativo</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nativo-us</name>
- <_description>Nativo for USA keyboards</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>nativo-epo</name>
- <_description>Nativo for Esperanto</_description>
- <languageList><iso639Id>epo</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ro</name>
- <_shortDescription>Rou</_shortDescription>
- <_description>Romania</_description>
- <languageList><iso639Id>rum</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>cedilla</name>
- <_description>Cedilla</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>std</name>
- <_description>Standard</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>std_cedilla</name>
- <_description>Standard (Cedilla)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>winkeys</name>
- <_description>Winkeys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_f</name>
- <_description>Crimean Tatar (Turkish F)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_alt</name>
- <_description>Crimean Tatar (Turkish Alt-Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_dobruca1</name>
- <_description>Crimean Tatar (Dobruca-1 Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_dobruca2</name>
- <_description>Crimean Tatar (Dobruca-2 Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ru</name>
- <_shortDescription>Rus</_shortDescription>
- <_description>Russia</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>phonetic</name>
- <_description>Phonetic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>phonetic_winkeys</name>
- <_description>Phonetic Winkeys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>typewriter</name>
- <_description>Typewriter</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>legacy</name>
- <_description>Legacy</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>typewriter-legacy</name>
- <_description>Typewriter, legacy</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tt</name>
- <_description>Tatar</_description>
- <languageList><iso639Id>tat</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>os_legacy</name>
- <_description>Ossetian, legacy</_description>
- <languageList><iso639Id>oss</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>os_winkeys</name>
- <_description>Ossetian, Winkeys</_description>
- <languageList><iso639Id>oss</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>cv</name>
- <_description>Chuvash</_description>
- <languageList><iso639Id>chv</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>cv_latin</name>
- <_description>Chuvash Latin</_description>
- <languageList><iso639Id>chv</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>udm</name>
- <_description>Udmurt</_description>
- <languageList><iso639Id>udm</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>kom</name>
- <_description>Komi</_description>
- <languageList><iso639Id>kom</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sah</name>
- <_description>Yakut</_description>
- <languageList><iso639Id>sah</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>xal</name>
- <_description>Kalmyk</_description>
- <languageList><iso639Id>xal</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dos</name>
- <_description>DOS</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>srp</name>
- <_description>Serbian</_description>
- <languageList><iso639Id>rus</iso639Id>
- <iso639Id>srp</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>bak</name>
- <_description>Bashkirian</_description>
- <languageList><iso639Id>bak</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>rs</name>
- <_shortDescription>SRB</_shortDescription>
- <_description>Serbia</_description>
- <languageList><iso639Id>srp</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>yz</name>
- <_description>Z and ZHE swapped</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latin</name>
- <_description>Latin</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinunicode</name>
- <_description>Latin Unicode</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinyz</name>
- <_description>Latin qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinunicodeyz</name>
- <_description>Latin Unicode qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>alternatequotes</name>
- <_description>With guillemets</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>latinalternatequotes</name>
- <_description>Latin with guillemets</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>rue</name>
- <_description>Pannonian Rusyn Homophonic</_description>
- <languageList><iso639Id>rue</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>si</name>
- <_shortDescription>Svn</_shortDescription>
- <_description>Slovenia</_description>
- <languageList><iso639Id>slv</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>alternatequotes</name>
- <_description>Use guillemets for quotes</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us</name>
- <_description>US keyboard with Slovenian letters</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>sk</name>
- <_shortDescription>Svk</_shortDescription>
- <_description>Slovakia</_description>
- <languageList><iso639Id>slo</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>bksl</name>
- <_description>Extended Backslash</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty</name>
- <_description>qwerty</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>qwerty_bksl</name>
- <_description>qwerty, extended Backslash</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>es</name>
- <_shortDescription>Esp</_shortDescription>
- <_description>Spain</_description>
- <languageList><iso639Id>spa</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>deadtilde</name>
- <_description>Include dead tilde</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ast</name>
- <_description>Asturian variant with bottom-dot H and bottom-dot L</_description>
- <languageList><iso639Id>ast</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>cat</name>
- <_description>Catalan variant with middle-dot L</_description>
- <languageList><iso639Id>cat</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>se</name>
- <_shortDescription>Swe</_shortDescription>
- <_description>Sweden</_description>
- <languageList><iso639Id>swe</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>nodeadkeys</name>
- <_description>Eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>rus</name>
- <_description>Russian phonetic</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>rus_nodeadkeys</name>
- <_description>Russian phonetic, eliminate dead keys</_description>
- <languageList><iso639Id>rus</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>smi</name>
- <_description>Northern Saami</_description>
- <languageList><iso639Id>sme</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>svdvorak</name>
- <_description>Svdvorak</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ch</name>
- <_shortDescription>Che</_shortDescription>
- <_description>Switzerland</_description>
- <languageList><iso639Id>ger</iso639Id>
- <iso639Id>gsw</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>legacy</name>
- <_description>Legacy</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>de_nodeadkeys</name>
- <_description>German, eliminate dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>de_sundeadkeys</name>
- <_description>German, Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fr</name>
- <_description>French</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fr_nodeadkeys</name>
- <_description>French, eliminate dead keys</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fr_sundeadkeys</name>
- <_description>French, Sun dead keys</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>fr_mac</name>
- <_description>French (Macintosh)</_description>
- <languageList><iso639Id>fra</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>de_mac</name>
- <_description>German (Macintosh)</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>sy</name>
- <_shortDescription>Syr</_shortDescription>
- <_description>Syria</_description>
- <languageList><iso639Id>syr</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>syc</name>
- <_description>Syriac</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>syc_phonetic</name>
- <_description>Syriac phonetic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku</name>
- <_description>Kurdish, Latin Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_f</name>
- <_description>Kurdish, (F)</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_alt</name>
- <_description>Kurdish, Latin Alt-Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>tj</name>
- <_shortDescription>Tjk</_shortDescription>
- <_description>Tajikistan</_description>
- <languageList><iso639Id>tgk</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>legacy</name>
- <_description>Legacy</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>lk</name>
- <_shortDescription>Lka</_shortDescription>
- <_description>Sri Lanka</_description>
- <languageList><iso639Id>sin</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>tam_unicode</name>
- <_description>Tamil Unicode</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>tam_TAB</name>
- <_description>Tamil TAB Typewriter</_description>
- <languageList><iso639Id>tam</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>th</name>
- <_shortDescription>Tha</_shortDescription>
- <_description>Thailand</_description>
- <languageList><iso639Id>tha</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>tis</name>
- <_description>TIS-820.2538</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>pat</name>
- <_description>Pattachote</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>tr</name>
- <_shortDescription>Tur</_shortDescription>
- <_description>Turkey</_description>
- <languageList><iso639Id>tur</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>f</name>
- <_description>(F)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>alt</name>
- <_description>Alt-Q</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>sundeadkeys</name>
- <_description>Sun dead keys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku</name>
- <_description>Kurdish, Latin Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_f</name>
- <_description>Kurdish, (F)</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ku_alt</name>
- <_description>Kurdish, Latin Alt-Q</_description>
- <languageList><iso639Id>kur</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>intl</name>
- <_description>International (with dead keys)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh</name>
- <_description>Crimean Tatar (Turkish Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_f</name>
- <_description>Crimean Tatar (Turkish F)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_alt</name>
- <_description>Crimean Tatar (Turkish Alt-Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ua</name>
- <_shortDescription>Ukr</_shortDescription>
- <_description>Ukraine</_description>
- <languageList><iso639Id>ukr</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>phonetic</name>
- <_description>Phonetic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>typewriter</name>
- <_description>Typewriter</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>winkeys</name>
- <_description>Winkeys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>legacy</name>
- <_description>Legacy</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>rstu</name>
-<!-- RSTU 2019-91 -->
- <_description>Standard RSTU</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>rstu_ru</name>
-<!-- RSTU 2019-91 -->
- <_description>Standard RSTU on Russian layout</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>homophonic</name>
- <_description>Homophonic</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh</name>
- <_description>Crimean Tatar (Turkish Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_f</name>
- <_description>Crimean Tatar (Turkish F)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_alt</name>
- <_description>Crimean Tatar (Turkish Alt-Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>gb</name>
- <_shortDescription>GBr</_shortDescription>
- <_description>United Kingdom</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>extd</name>
- <_description>Extended - Winkeys</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>intl</name>
- <_description>International (with dead keys)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorakukp</name>
- <_description>Dvorak (UK Punctuation)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac</name>
- <_description>Macintosh</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>mac_intl</name>
- <_description>Macintosh (International)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>colemak</name>
- <_description>Colemak</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>uz</name>
- <_shortDescription>Uzb</_shortDescription>
- <_description>Uzbekistan</_description>
- <languageList><iso639Id>uzb</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>latin</name>
- <_description>Latin</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh</name>
- <_description>Crimean Tatar (Turkish Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_f</name>
- <_description>Crimean Tatar (Turkish F)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>crh_alt</name>
- <_description>Crimean Tatar (Turkish Alt-Q)</_description>
- <languageList><iso639Id>crh</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>vn</name>
- <_shortDescription>Vnm</_shortDescription>
- <_description>Vietnam</_description>
- <languageList><iso639Id>vie</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>kr</name>
- <_shortDescription>Kor</_shortDescription>
- <_description>Korea, Republic of</_description>
- <languageList><iso639Id>kor</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>kr104</name>
- <_description>101/104 key Compatible</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>nec_vndr/jp</name>
- <_shortDescription>Jpn</_shortDescription>
- <_description>Japan (PC-98xx Series)</_description>
- <countryList><iso3166Id>JP</iso3166Id></countryList>
- <languageList><iso639Id>jpn</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>ie</name>
- <_shortDescription>Irl</_shortDescription>
- <_description>Ireland</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>CloGaelach</name>
- <_description>CloGaelach</_description>
- <languageList><iso639Id>gla</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>UnicodeExpert</name>
- <_description>UnicodeExpert</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ogam</name>
- <_description>Ogham</_description>
- <!-- No ISO code in ISO639 -->
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ogam_is434</name>
- <_description>Ogham IS434</_description>
- <!-- No ISO code in ISO639 -->
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>pk</name>
- <_shortDescription>Pak</_shortDescription>
- <_description>Pakistan</_description>
- <languageList><iso639Id>urd</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>urd-crulp</name>
- <_description>CRULP</_description>
- <languageList><iso639Id>urd</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>urd-nla</name>
- <_description>NLA</_description>
- <languageList><iso639Id>urd</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>ara</name>
- <_description>Arabic</_description>
- <languageList><iso639Id>ara</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>snd</name>
- <_description>Sindhi</_description>
- <languageList><iso639Id>sd</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>mv</name>
- <_shortDescription>Mdv</_shortDescription>
- <_description>Maldives</_description>
- <languageList><iso639Id>div</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>za</name>
- <_shortDescription>Zaf</_shortDescription>
- <_description>South Africa</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- </layout>
- <layout>
- <configItem>
- <name>epo</name>
- <_shortDescription>Epo</_shortDescription>
- <_description>Esperanto</_description>
- <languageList><iso639Id>epo</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>legacy</name>
- <_description>displaced semicolon and quote (obsolete)</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>np</name>
- <_shortDescription>Npl</_shortDescription>
- <_description>Nepal</_description>
- <languageList><iso639Id>nep</iso639Id></languageList>
- </configItem>
- </layout>
- <layout>
- <configItem>
- <name>ng</name>
- <_shortDescription>Nga</_shortDescription>
- <_description>Nigeria</_description>
- <languageList><iso639Id>eng</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>igbo</name>
- <_description>Igbo</_description>
- <languageList><iso639Id>ibo</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>yoruba</name>
- <_description>Yoruba</_description>
- <languageList><iso639Id>yor</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>hausa</name>
- <_description>Hausa</_description>
- <languageList><iso639Id>hau</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>et</name>
- <_shortDescription>Eth</_shortDescription>
- <_description>Ethiopia</_description>
- <languageList><iso639Id>amh</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>sn</name>
- <_shortDescription>Sen</_shortDescription>
- <_description>Senegal</_description>
- <languageList><iso639Id>wol</iso639Id></languageList>
- </configItem>
- <variantList/>
- </layout>
- <layout>
- <configItem>
- <name>brai</name>
- <_shortDescription>Brl</_shortDescription>
- <_description>Braille</_description>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>left_hand</name>
- <_description>Left hand</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>right_hand</name>
- <_description>Right hand</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>tm</name>
- <_shortDescription>Tkm</_shortDescription>
- <_description>Turkmenistan</_description>
- <languageList><iso639Id>tuk</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>alt</name>
- <_description>Alt-Q</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>ml</name>
- <_shortDescription>Mli</_shortDescription>
- <_description>Mali</_description>
- <languageList><iso639Id>bam</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>fr-oss</name>
- <_description>Français (France Alternative)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us-mac</name>
- <_description>English (USA Macintosh)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>us-intl</name>
- <_description>English (USA International)</_description>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>tz</name>
- <_shortDescription>Tza</_shortDescription>
- <_description>Tanzania</_description>
- <languageList><iso639Id>swa</iso639Id></languageList>
- </configItem>
- </layout>
- <layout>
- <configItem>
- <name>ke</name>
- <_shortDescription>Ken</_shortDescription>
- <_description>Kenya</_description>
- <languageList><iso639Id>swa</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>kik</name>
- <_description>Kikuyu</_description>
- <languageList><iso639Id>kik</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- <layout>
- <configItem>
- <name>bw</name>
- <_shortDescription>Bwa</_shortDescription>
- <_description>Botswana</_description>
- <languageList><iso639Id>tsn</iso639Id></languageList>
- </configItem>
- </layout>
- <layout>
- <configItem>
- <name>ph</name>
- <_shortDescription>Phi</_shortDescription>
- <_description>Philippines</_description>
- <languageList><iso639Id>eng</iso639Id>
- <iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
- </configItem>
- <variantList>
- <variant>
- <configItem>
- <name>qwerty-bay</name>
- <_description>QWERTY (Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>capewell-dvorak</name>
- <_description>Capewell-Dvorak (Latin)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>capewell-dvorak-bay</name>
- <_description>Capewell-Dvorak (Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>capewell-qwerf2k6</name>
- <_description>Capewell-QWERF 2006 (Latin)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>capewell-qwerf2k6-bay</name>
- <_description>Capewell-QWERF 2006 (Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>colemak</name>
- <_description>Colemak (Latin)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>colemak-bay</name>
- <_description>Colemak (Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak</name>
- <_description>Dvorak (Latin)</_description>
- </configItem>
- </variant>
- <variant>
- <configItem>
- <name>dvorak-bay</name>
- <_description>Dvorak (Baybayin)</_description>
- <languageList><iso639Id>bik</iso639Id>
- <iso639Id>ceb</iso639Id>
- <iso639Id>fil</iso639Id>
- <iso639Id>hil</iso639Id>
- <iso639Id>ilo</iso639Id>
- <iso639Id>pam</iso639Id>
- <iso639Id>pag</iso639Id>
- <iso639Id>phi</iso639Id>
- <iso639Id>tgl</iso639Id>
- <iso639Id>war</iso639Id></languageList>
- </configItem>
- </variant>
- </variantList>
- </layout>
- </layoutList>
- <optionList>
- <group allowMultipleSelection="true">
- <!-- The key combination used to switch between groups -->
- <configItem>
- <name>grp</name>
- <_description>Key(s) to change layout</_description>
- </configItem>
- <option>
- <configItem>
- <name>grp:switch</name>
- <_description>Right Alt (while pressed)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lswitch</name>
- <_description>Left Alt (while pressed)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lwin_switch</name>
- <_description>Left Win (while pressed)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:rwin_switch</name>
- <_description>Right Win (while pressed)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:win_switch</name>
- <_description>Any Win key (while pressed)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:caps_switch</name>
- <_description>Caps Lock (while pressed), Alt+Caps Lock does the original capslock action</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:rctrl_switch</name>
- <_description>Right Ctrl (while pressed)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:toggle</name>
- <_description>Right Alt</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lalt_toggle</name>
- <_description>Left Alt</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:caps_toggle</name>
- <_description>Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:shift_caps_toggle</name>
- <_description>Shift+Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:shift_caps_switch</name>
- <_description>Caps Lock (to first layout), Shift+Caps Lock (to last layout)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:win_menu_switch</name>
- <_description>Left Win (to first layout), Right Win/Menu (to last layout)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lctrl_rctrl_switch</name>
- <_description>Left Ctrl (to first layout), Right Ctrl (to last layout)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:alt_caps_toggle</name>
- <_description>Alt+Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:shifts_toggle</name>
- <_description>Both Shift keys together</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:alts_toggle</name>
- <_description>Both Alt keys together</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:ctrls_toggle</name>
- <_description>Both Ctrl keys together</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:ctrl_shift_toggle</name>
- <_description>Ctrl+Shift</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lctrl_lshift_toggle</name>
- <_description>Left Ctrl+Left Shift</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:rctrl_rshift_toggle</name>
- <_description>Right Ctrl+Right Shift</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:ctrl_alt_toggle</name>
- <_description>Alt+Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:alt_shift_toggle</name>
- <_description>Alt+Shift</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:alt_space_toggle</name>
- <_description>Alt+Space</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:menu_toggle</name>
- <_description>Menu</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lwin_toggle</name>
- <_description>Left Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:rwin_toggle</name>
- <_description>Right Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lshift_toggle</name>
- <_description>Left Shift</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:rshift_toggle</name>
- <_description>Right Shift</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:lctrl_toggle</name>
- <_description>Left Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:rctrl_toggle</name>
- <_description>Right Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp:sclk_toggle</name>
- <_description>Scroll Lock</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <!-- The key combination used to choose the 3rd (and 4th, together with Shift)
- level of symbols -->
- <configItem>
- <name>lv3</name>
- <_description>Key to choose 3rd level</_description>
- </configItem>
- <option>
- <configItem>
- <name>lv3:switch</name>
- <_description>Right Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:menu_switch</name>
- <_description>Menu</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:win_switch</name>
- <_description>Any Win key</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:lwin_switch</name>
- <_description>Left Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:rwin_switch</name>
- <_description>Right Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:alt_switch</name>
- <_description>Any Alt key</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:lalt_switch</name>
- <_description>Left Alt</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:ralt_switch</name>
- <_description>Right Alt</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:ralt_switch_multikey</name>
- <_description>Right Alt, Shift+Right Alt key is Multi_Key</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:ralt_alt</name>
- <_description>Right Alt key never chooses 3rd level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:enter_switch</name>
- <_description>Enter on keypad</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:caps_switch</name>
- <_description>Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:bksl_switch</name>
- <_description>Backslash</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:lsgt_switch</name>
- <description><Less/Greater></description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:caps_switch_latch</name>
- <description>Caps Lock (chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:bksl_switch_latch</name>
- <description>Backslash chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv3:lsgt_switch_latch</name>
- <description><Less/Greater> (chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <!-- Tweaking the position of the "Ctrl" key -->
- <configItem>
- <name>ctrl</name>
- <_description>Ctrl key position</_description>
- </configItem>
- <option>
- <configItem>
- <name>ctrl:nocaps</name>
- <_description>Make Caps Lock an additional Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>ctrl:lctrl_meta</name>
- <_description>Meta on Left Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>ctrl:swapcaps</name>
- <_description>Swap Ctrl and Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>ctrl:ctrl_ac</name>
- <_description>At left of 'A'</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>ctrl:ctrl_aa</name>
- <_description>At bottom left</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>ctrl:ctrl_ra</name>
- <_description>Right Ctrl as Right Alt</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>ctrl:ctrl_menu</name>
- <description>Right Ctrl is mapped to Menu</description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <!-- Using startard LEDs to indicate the alternative (not first) group(s) -->
- <configItem>
- <name>grp_led</name>
- <_description>Use keyboard LED to show alternative layout</_description>
- </configItem>
- <option>
- <configItem>
- <name>grp_led:num</name>
- <_description>Num Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp_led:caps</name>
- <_description>Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>grp_led:scroll</name>
- <_description>Scroll Lock</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="false">
- <!-- Select a keypad type -->
- <configItem>
- <name>keypad</name>
- <_description>Numeric keypad layout selection</_description>
- </configItem>
- <option>
- <configItem>
- <name>keypad:legacy</name>
- <_description>Legacy</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:oss</name>
- <_description>Unicode additions (arrows and math operators)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:future</name>
- <_description>Unicode additions (arrows and math operators). Math operators on default level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:legacy_wang</name>
- <_description>Legacy Wang 724</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:oss_wang</name>
- <_description>Wang 724 keypad with unicode additions (arrows and math operators)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:future_wang</name>
- <_description>Wang 724 keypad with unicode additions (arrows and math operators). Math operators on default level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:hex</name>
- <_description>Hexadecimal</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:atm</name>
- <_description>ATM/phone-style</_description>
- </configItem>
- </option>
- </group>
- <!-- This option should override the KPDL key defined in keypad; I hope it's declared in the right place -->
- <group allowMultipleSelection="false">
- <!-- Select a keypad KPDL variant -->
- <configItem>
- <name>kpdl</name>
- <_description>Numeric keypad delete key behaviour</_description>
- </configItem>
- <option>
- <configItem>
- <!-- Actually, with KP_DECIMAL, as the old keypad(dot) -->
- <name>kpdl:dot</name>
- <_description>Legacy key with dot</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:comma</name>
- <!-- Actually, with KP_SEPARATOR, as the old keypad(comma) -->
- <_description>Legacy key with comma</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:dotoss</name>
- <_description>Four-level key with dot</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:dotoss_latin9</name>
- <_description>Four-level key with dot, latin-9 restriction</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:commaoss</name>
- <_description>Four-level key with comma</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:momayyezoss</name>
- <_description>Four-level key with momayyez</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:kposs</name>
- <!-- This assumes the KP_ abstract symbols are actually useful for some apps
- The description needs to be rewritten -->
- <_description>Four-level key with abstract separators</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>kpdl:semi</name>
- <_description>Semi-colon on third level</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="false">
- <!-- Caps Lock tweaks.
- "Internal" capitalization means capitalization using some internal tables.
- Otherwise "as Shift" - means using next group. -->
- <configItem>
- <name>caps</name>
- <_description>Caps Lock key behavior</_description>
- </configItem>
- <option>
- <configItem>
- <name>caps:internal</name>
- <_description>Caps Lock uses internal capitalization. Shift "pauses" Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:internal_nocancel</name>
- <_description>Caps Lock uses internal capitalization. Shift doesn't affect Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:shift</name>
- <_description>Caps Lock acts as Shift with locking. Shift "pauses" Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:shift_nocancel</name>
- <_description>Caps Lock acts as Shift with locking. Shift doesn't affect Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:capslock</name>
- <_description>Caps Lock toggles normal capitalization of alphabetic characters</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:numlock</name>
- <_description>Make Caps Lock an additional Num Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:swapescape</name>
- <_description>Swap ESC and Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:escape</name>
- <_description>Make Caps Lock an additional ESC</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:backspace</name>
- <_description>Make Caps Lock an additional Backspace</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:super</name>
- <_description>Make Caps Lock an additional Super</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:hyper</name>
- <_description>Make Caps Lock an additional Hyper</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:shiftlock</name>
- <_description>Caps Lock toggles Shift so all keys are affected</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>caps:none</name>
- <_description>Caps Lock is disabled</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="false">
- <!-- Using special PC keys (Win, Menu) to work as standard X keys (Super, Hyper, etc.) -->
- <configItem>
- <name>altwin</name>
- <_description>Alt/Win key behavior</_description>
- </configItem>
- <option>
- <configItem>
- <name>altwin:menu</name>
- <_description>Add the standard behavior to Menu key</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:meta_alt</name>
- <_description>Alt and Meta are on Alt keys</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:ctrl_win</name>
- <_description>Control is mapped to Win keys (and the usual Ctrl keys)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:ctrl_alt_win</name>
- <_description>Control is mapped to Alt keys, Alt is mapped to Win keys</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:meta_win</name>
- <_description>Meta is mapped to Win keys</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:left_meta_win</name>
- <_description>Meta is mapped to Left Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:hyper_win</name>
- <_description>Hyper is mapped to Win-keys</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:alt_super_win</name>
- <_description>Alt is mapped to Right Win, Super to Menu</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>altwin:swap_lalt_lwin</name>
- <_description>Left Alt is swapped with Left Win</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <!-- Tweaking the position of the "Compose" key: mapping to existing PC keys -->
- <configItem>
- <name>Compose key</name>
- <_description>Compose key position</_description>
- </configItem>
- <option>
- <configItem>
- <name>compose:ralt</name>
- <_description>Right Alt</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:lwin</name>
- <_description>Left Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:rwin</name>
- <_description>Right Win</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:menu</name>
- <_description>Menu</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:lctrl</name>
- <_description>Left Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:rctrl</name>
- <_description>Right Ctrl</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:caps</name>
- <_description>Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:102</name>
- <_description><Less/Greater></_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:paus</name>
- <_description>Pause</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:prsc</name>
- <_description>PrtSc</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>compose:sclk</name>
- <_description>Scroll Lock</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <configItem>
- <name>compat</name>
- <_description>Miscellaneous compatibility options</_description>
- </configItem>
- <option>
- <configItem>
- <name>numpad:pc</name>
- <_description>Default numeric keypad keys</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>numpad:mac</name>
- <_description>Numeric keypad keys work as with Mac</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>numpad:microsoft</name>
- <_description>Shift with numeric keypad keys works as in MS Windows</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>numpad:shift3</name>
- <_description>Shift does not cancel Num Lock, chooses 3rd level instead</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>srvrkeys:none</name>
- <_description>Special keys (Ctrl+Alt+<key>) handled in a server</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>apple:alupckeys</name>
- <_description>Apple Aluminium Keyboard: emulate PC keys (Print, Scroll Lock, Pause, Num Lock)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>shift:breaks_caps</name>
- <_description>Shift cancels Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>misc:typo</name>
- <_description>Enable extra typographic characters</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>shift:both_capslock</name>
- <_description>Both Shift-Keys together toggle Caps Lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>shift:both_capslock_cancel</name>
- <description>Both Shift-Keys together activate Caps Lock, one Shift-Key deactivates</description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>shift:both_shiftlock</name>
- <description>Both Shift-Keys together toggle ShiftLock</description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>keypad:pointerkeys</name>
- <_description>Toggle PointerKeys with Shift + NumLock.</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <!-- Special shortcuts for the Euro character -->
- <configItem>
- <name>eurosign</name>
- <_description>Adding currency signs to certain keys</_description>
- </configItem>
- <option>
- <configItem>
- <name>eurosign:e</name>
- <_description>Euro on E</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>eurosign:2</name>
- <_description>Euro on 2</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>eurosign:4</name>
- <_description>Euro on 4</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>eurosign:5</name>
- <_description>Euro on 5</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>rupeesign:4</name>
- <_description>Rupee on 4</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <configItem>
- <name>lv5</name>
- <_description>Key to choose 5th level</_description>
- </configItem>
- <option>
- <configItem>
- <name>lv5:lsgt_switch_lock</name>
- <_description><Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:ralt_switch_lock</name>
- <_description>Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:lwin_switch_lock</name>
- <_description>Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:rwin_switch_lock</name>
- <_description>Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:lsgt_switch_lock_cancel</name>
- <_description><Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:ralt_switch_lock_cancel</name>
- <_description>Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:lwin_switch_lock_cancel</name>
- <_description>Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:rwin_switch_lock_cancel</name>
- <_description>Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:lsgt_switch_lock_cancel</name>
- <description><Less/Greater> chooses 5th level and activates level5-Lock when pressed together with another 5th-level-chooser, one press releases the lock</description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>lv5:ralt_switch_lock_cancel</name>
- <description>Right Alt chooses 5th level and activates level5-Lock when pressed together with another 5th-level-chooser, one press releases the lock</description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="false">
- <!-- Let space output NBSP, NNBSP, ZWNJ, and ZWJ for the desired level -->
- <configItem>
- <name>nbsp</name>
- <_description>Using space key to input non-breakable space character</_description>
- </configItem>
- <option>
- <configItem>
- <name>nbsp:none</name>
- <_description>Usual space at any level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level2</name>
- <_description>Non-breakable space character at second level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level3</name>
- <_description>Non-breakable space character at third level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level3s</name>
- <_description>Non-breakable space character at third level, nothing at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level3n</name>
- <_description>Non-breakable space character at third level, thin non-breakable space character at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level4</name>
- <_description>Non-breakable space character at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level4n</name>
- <_description>Non-breakable space character at fourth level, thin non-breakable space character at sixth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:level4nl</name>
- <_description>Non-breakable space character at fourth level, thin non-breakable space character at sixth level (via Ctrl+Shift)</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2</name>
- <_description>Zero-width non-joiner character at second level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2zwj3</name>
- <_description>Zero-width non-joiner character at second level, zero-width joiner character at third level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2zwj3nb4</name>
- <_description>Zero-width non-joiner character at second level, zero-width joiner character at third level, non-breakable space character at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2nb3</name>
- <_description>Zero-width non-joiner character at second level, non-breakable space character at third level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2nb3s</name>
- <_description>Zero-width non-joiner character at second level, non-breakable space character at third level, nothing at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2nb3zwj4</name>
- <_description>Zero-width non-joiner character at second level, non-breakable space character at third level, zero-width joiner at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj2nb3nnb4</name>
- <_description>Zero-width non-joiner character at second level, non-breakable space character at third level, thin non-breakable space at fourth level</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>nbsp:zwnj3zwj4</name>
- <_description>Zero-width non-joiner character at third level, zero-width joiner at fourth level</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <configItem>
- <name>japan</name>
- <_description>Japanese keyboard options</_description>
- </configItem>
- <option>
- <configItem>
- <name>japan:kana_lock</name>
- <_description>Kana Lock key is locking</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>japan:nicola_f_bs</name>
- <_description>NICOLA-F style Backspace</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="false">
- <configItem>
- <name>esperanto</name>
- <_description>Adding Esperanto circumflexes (supersigno)</_description>
- </configItem>
- <option>
- <configItem>
- <name>esperanto:qwerty</name>
- <_description>To the corresponding key in a Qwerty keyboard.</_description>
- </configItem>
- </option>
- <option>
- <configItem>
- <name>esperanto:dvorak</name>
- <_description>To the corresponding key in a Dvorak keyboard.</_description>
- </configItem>
- </option>
- </group>
- <group allowMultipleSelection="true">
- <configItem>
- <name>terminate</name>
- <_description>Key sequence to kill the X server</_description>
- </configItem>
- <option>
- <configItem>
- <name>terminate:ctrl_alt_bksp</name>
- <_description>Control + Alt + Backspace</_description>
- </configItem>
- </option>
- </group>
- </optionList>
-</xkbConfigRegistry>
+<?xml version="1.0" encoding="utf-8"?> +<!DOCTYPE xkbConfigRegistry SYSTEM "xkb.dtd"> +<xkbConfigRegistry> + <modelList> + <model> + <configItem> + <name>pc101</name> + <_description>Generic 101-key PC</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>pc102</name> + <_description>Generic 102-key (Intl) PC</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>pc104</name> + <_description>Generic 104-key PC</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>pc105</name> + <_description>Generic 105-key (Intl) PC</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dell101</name> + <_description>Dell 101-key PC</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>latitude</name> + <_description>Dell Latitude series laptop</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dellm65</name> + <_description>Dell Precision M65</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>everex</name> + <_description>Everex STEPnote</_description> + <vendor>Everex</vendor> + </configItem> + </model> + <model> + <configItem> + <name>flexpro</name> + <_description>Keytronic FlexPro</_description> + <vendor>Keytronic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoft</name> + <_description>Microsoft Natural</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>omnikey101</name> + <_description>Northgate OmniKey 101</_description> + <vendor>Northgate</vendor> + </configItem> + </model> + <model> + <configItem> + <name>winbook</name> + <_description>Winbook Model XP5</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>pc98</name> + <_description>PC-98xx Series</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>a4techKB21</name> + <_description>A4Tech KB-21</_description> + <vendor>A4Tech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>a4techKBS8</name> + <_description>A4Tech KBS-8</_description> + <vendor>A4Tech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>a4_rfkb23</name> + <_description>A4Tech Wireless Desktop RFKB-23</_description> + <vendor>A4Tech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>airkey</name> + <_description>Acer AirKey V</_description> + <vendor>Acer</vendor> + </configItem> + </model> + <model> + <configItem> + <name>azonaRF2300</name> + <_description>Azona RF2300 wireless Internet Keyboard</_description> + <vendor>Azona</vendor> + </configItem> + </model> + <model> + <configItem> + <name>scorpius</name> + <_description>Advance Scorpius KI</_description> + <vendor>Scorpius</vendor> + </configItem> + </model> + <model> + <configItem> + <name>brother</name> + <_description>Brother Internet Keyboard</_description> + <vendor>Brother</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc5113rf</name> + <_description>BTC 5113RF Multimedia</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc5126t</name> + <_description>BTC 5126T</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc6301urf</name> + <_description>BTC 6301URF</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc9000</name> + <_description>BTC 9000</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc9000a</name> + <_description>BTC 9000A</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc9001ah</name> + <_description>BTC 9001AH</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc5090</name> + <_description>BTC 5090</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc9019u</name> + <_description>BTC 9019U</_description> + <vendor>BTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>btc9116u</name> + <_description>BTC 9116U Mini Wireless Internet and Gaming</_description> + </configItem> + </model> + <model> + <configItem> + <name>cherryblue</name> + <_description>Cherry Blue Line CyBo@rd</_description> + </configItem> + </model> + <model> + <configItem> + <name>cherryblueb</name> + <_description>Cherry CyMotion Master XPress</_description> + <vendor>Cherry</vendor> + </configItem> + </model> + <model> + <configItem> + <name>cherrybluea</name> + <_description>Cherry Blue Line CyBo@rd (alternate option)</_description> + <vendor>Cherry</vendor> + </configItem> + </model> + <model> + <configItem> + <name>cherrycyboard</name> + <_description>Cherry CyBo@rd USB-Hub</_description> + <vendor>Cherry</vendor> + </configItem> + </model> + <model> + <configItem> + <name>cherrycmexpert</name> + <_description>Cherry CyMotion Expert</_description> + <vendor>Cherry</vendor> + </configItem> + </model> + <model> + <configItem> + <name>cherrybunlim</name> + <_description>Cherry B.UNLIMITED</_description> + <vendor>Cherry</vendor> + </configItem> + </model> + <model> + <configItem> + <name>chicony</name> + <_description>Chicony Internet Keyboard</_description> + <vendor>Chicony</vendor> + </configItem> + </model> + <model> + <configItem> + <name>chicony0108</name> + <_description>Chicony KU-0108</_description> + <vendor>Chicony</vendor> + </configItem> + </model> + <model> + <configItem> + <name>chicony0420</name> + <_description>Chicony KU-0420</_description> + <vendor>Chicony</vendor> + </configItem> + </model> + <model> + <configItem> + <name>chicony9885</name> + <_description>Chicony KB-9885</_description> + <vendor>Chicony</vendor> + </configItem> + </model> + <model> + <configItem> + <name>compaqeak8</name> + <_description>Compaq Easy Access Keyboard</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>compaqik7</name> + <_description>Compaq Internet Keyboard (7 keys)</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>compaqik13</name> + <_description>Compaq Internet Keyboard (13 keys)</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>compaqik18</name> + <_description>Compaq Internet Keyboard (18 keys)</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>cymotionlinux</name> + <_description>Cherry CyMotion Master Linux</_description> + <vendor>Cherry</vendor> + </configItem> + </model> + <model> + <configItem> + <name>armada</name> + <_description>Laptop/notebook Compaq (eg. Armada) Laptop Keyboard</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>presario</name> + <_description>Laptop/notebook Compaq (eg. Presario) Internet Keyboard</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>ipaq</name> + <_description>Compaq iPaq Keyboard</_description> + <vendor>Compaq</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dell</name> + <_description>Dell</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dellsk8125</name> + <_description>Dell SK-8125</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dellsk8135</name> + <_description>Dell SK-8135</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dellusbmm</name> + <_description>Dell USB Multimedia Keyboard</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>inspiron</name> + <_description>Dell Laptop/notebook Inspiron 6xxx/8xxx</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>precision_m</name> + <_description>Dell Laptop/notebook Precision M series</_description> + <vendor>Dell</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dexxa</name> + <_description>Dexxa Wireless Desktop Keyboard</_description> + <vendor>Dexxa</vendor> + </configItem> + </model> + <model> + <configItem> + <name>diamond</name> + <_description>Diamond 9801 / 9802 series</_description> + <vendor>Diamond</vendor> + </configItem> + </model> + <model> + <configItem> + <name>dtk2000</name> + <_description>DTK2000</_description> + </configItem> + </model> + <model> + <configItem> + <name>ennyah_dkb1008</name> + <_description>Ennyah DKB-1008</_description> + <vendor>Ennyah</vendor> + </configItem> + </model> + <model> + <configItem> + <name>fscaa1667g</name> + <_description>Fujitsu-Siemens Computers AMILO laptop</_description> + <vendor>Fujitsu-Siemens</vendor> + </configItem> + </model> + <model> + <configItem> + <name>genius</name> + <_description>Genius Comfy KB-16M / Genius MM Keyboard KWD-910</_description> + <vendor>Genius</vendor> + </configItem> + </model> + <model> + <configItem> + <name>geniuscomfy</name> + <_description>Genius Comfy KB-12e</_description> + <vendor>Genius</vendor> + </configItem> + </model> + <model> + <configItem> + <name>geniuscomfy2</name> + <_description>Genius Comfy KB-21e-Scroll</_description> + <vendor>Genius</vendor> + </configItem> + </model> + <model> + <configItem> + <name>geniuskb19e</name> + <_description>Genius KB-19e NB</_description> + <vendor>Genius</vendor> + </configItem> + </model> + <model> + <configItem> + <name>geniuskkb2050hs</name> + <_description>Genius KKB-2050HS</_description> + <vendor>Genius</vendor> + </configItem> + </model> + <model> + <configItem> + <name>gyration</name> + <_description>Gyration</_description> + <vendor>Gyration</vendor> + </configItem> + </model> + <model> + <configItem> + <name>htcdream</name> + <_description>HTC Dream</_description> + <vendor>HTC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>kinesis</name> + <_description>Kinesis</_description> + <vendor>Kinesis</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logitech_base</name> + <_description>Logitech Generic Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logitech_g15</name> + <_description>Logitech G15 extra keys via G15daemon</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpi6</name> + <_description>Hewlett-Packard Internet Keyboard</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hp250x</name> + <_description>Hewlett-Packard SK-250x Multimedia Keyboard</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpxe3gc</name> + <_description>Hewlett-Packard Omnibook XE3 GC</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpxe3gf</name> + <_description>Hewlett-Packard Omnibook XE3 GF</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpxt1000</name> + <_description>Hewlett-Packard Omnibook XT1000</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpdv5</name> + <_description>Hewlett-Packard Pavilion dv5</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpzt11xx</name> + <_description>Hewlett-Packard Pavilion ZT11xx</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hp500fa</name> + <_description>Hewlett-Packard Omnibook 500 FA</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hp5xx</name> + <_description>Hewlett-Packard Omnibook 5xx</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpnx9020</name> + <_description>Hewlett-Packard nx9020</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hp6000</name> + <_description>Hewlett-Packard Omnibook 6000/6100</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>honeywell_euroboard</name> + <_description>Honeywell Euroboard</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hpmini110</name> + <_description>Hewlett-Packard Mini 110 Notebook</_description> + <vendor>Hewlett-Packard</vendor> + </configItem> + </model> + <model> + <configItem> + <name>rapidaccess</name> + <_description>IBM Rapid Access</_description> + <vendor>Lenovo (previously IBM)</vendor> + </configItem> + </model> + <model> + <configItem> + <name>rapidaccess2</name> + <_description>IBM Rapid Access II</_description> + <vendor>Lenovo (previously IBM)</vendor> + </configItem> + </model> + <model> + <configItem> + <name>thinkpad</name> + <_description>IBM ThinkPad 560Z/600/600E/A22E</_description> + <vendor>Lenovo (previously IBM)</vendor> + </configItem> + </model> + <model> + <configItem> + <name>thinkpad60</name> + <_description>IBM ThinkPad R60/T60/R61/T61</_description> + <vendor>Lenovo (previously IBM)</vendor> + </configItem> + </model> + <model> + <configItem> + <name>thinkpadz60</name> + <_description>IBM ThinkPad Z60m/Z60t/Z61m/Z61t</_description> + <vendor>Lenovo (previously IBM)</vendor> + </configItem> + </model> + <model> + <configItem> + <name>ibm_spacesaver</name> + <_description>IBM Space Saver</_description> + <vendor>Lenovo (previously IBM)</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiaccess</name> + <_description>Logitech Access Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiclx300</name> + <_description>Logitech Cordless Desktop LX-300</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logii350</name> + <_description>Logitech Internet 350 Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logimel</name> + <_description>Logitech Media Elite Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicd</name> + <_description>Logitech Cordless Desktop</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicd_it</name> + <_description>Logitech Cordless Desktop iTouch</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicd_nav</name> + <_description>Logitech Cordless Desktop Navigator</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicd_opt</name> + <_description>Logitech Cordless Desktop Optical</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicda</name> + <_description>Logitech Cordless Desktop (alternate option)</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicdpa2</name> + <_description>Logitech Cordless Desktop Pro (alternate option 2)</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicfn</name> + <_description>Logitech Cordless Freedom/Desktop Navigator</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicdn</name> + <_description>Logitech Cordless Desktop Navigator</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiitc</name> + <_description>Logitech iTouch Cordless Keyboard (model Y-RB6)</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiik</name> + <_description>Logitech Internet Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>itouch</name> + <_description>Logitech iTouch</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logicink</name> + <_description>Logitech Internet Navigator Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiex110</name> + <_description>Logitech Cordless Desktop EX110</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiinkse</name> + <_description>Logitech iTouch Internet Navigator Keyboard SE</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiinkseusb</name> + <_description>Logitech iTouch Internet Navigator Keyboard SE (USB)</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiultrax</name> + <_description>Logitech Ultra-X Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logiultraxc</name> + <_description>Logitech Ultra-X Cordless Media Desktop Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logidinovo</name> + <_description>Logitech diNovo Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>logidinovoedge</name> + <_description>Logitech diNovo Edge Keyboard</_description> + <vendor>Logitech</vendor> + </configItem> + </model> + <model> + <configItem> + <name>mx1998</name> + <_description>Memorex MX1998</_description> + <vendor>Memorex</vendor> + </configItem> + </model> + <model> + <configItem> + <name>mx2500</name> + <_description>Memorex MX2500 EZ-Access Keyboard</_description> + <vendor>Memorex</vendor> + </configItem> + </model> + <model> + <configItem> + <name>mx2750</name> + <_description>Memorex MX2750</_description> + <vendor>Memorex</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoft7000</name> + <_description>Microsoft Natural Wireless Ergonomic Keyboard 7000</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftinet</name> + <_description>Microsoft Internet Keyboard</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftpro</name> + <_description>Microsoft Natural Keyboard Pro / Microsoft Internet Keyboard Pro</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftprousb</name> + <_description>Microsoft Natural Keyboard Pro USB / Microsoft Internet Keyboard Pro</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftprooem</name> + <_description>Microsoft Natural Keyboard Pro OEM</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>vsonku306</name> + <_description>ViewSonic KU-306 Internet Keyboard</_description> + <vendor>ViewSonic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftprose</name> + <_description>Microsoft Internet Keyboard Pro, Swedish</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftoffice</name> + <_description>Microsoft Office Keyboard</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftmult</name> + <_description>Microsoft Wireless Multimedia Keyboard 1.0A</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftelite</name> + <_description>Microsoft Natural Keyboard Elite</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>microsoftccurve2k</name> + <_description>Microsoft Comfort Curve Keyboard 2000</_description> + <vendor>Microsoft Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>oretec</name> + <_description>Ortek MCK-800 MM/Internet keyboard</_description> + <vendor>Ortek</vendor> + </configItem> + </model> + <model> + <configItem> + <name>propeller</name> + <_description>Propeller Voyager (KTEZ-1000)</_description> + <vendor>KeyTronic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>qtronix</name> + <_description>QTronix Scorpius 98N+</_description> + <vendor>QTronix</vendor> + </configItem> + </model> + <model> + <configItem> + <name>samsung4500</name> + <_description>Samsung SDM 4500P</_description> + <vendor>Samsung</vendor> + </configItem> + </model> + <model> + <configItem> + <name>samsung4510</name> + <_description>Samsung SDM 4510P</_description> + <vendor>Samsung</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sanwaskbkg3</name> + <description>Sanwa Supply SKB-KG3</description> + <vendor>Sanwa Supply Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sk1300</name> + <_description>SK-1300</_description> + <vendor>NEC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sk2500</name> + <_description>SK-2500</_description> + <vendor>NEC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sk6200</name> + <_description>SK-6200</_description> + <vendor>NEC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sk7100</name> + <_description>SK-7100</_description> + <vendor>NEC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sp_inet</name> + <_description>Super Power Multimedia Keyboard</_description> + <vendor>Generic</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sven</name> + <_description>SVEN Ergonomic 2500</_description> + <vendor>SVEN</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sven303</name> + <_description>SVEN Slim 303</_description> + <vendor>SVEN</vendor> + </configItem> + </model> + <model> + <configItem> + <name>symplon</name> + <_description>Symplon PaceBook (tablet PC)</_description> + <vendor>Symplon</vendor> + </configItem> + </model> + <model> + <configItem> + <name>toshiba_s3000</name> + <_description>Toshiba Satellite S3000</_description> + <vendor>Toshiba</vendor> + </configItem> + </model> + <model> + <configItem> + <name>trust</name> + <_description>Trust Wireless Keyboard Classic</_description> + <vendor>Trust</vendor> + </configItem> + </model> + <model> + <configItem> + <name>trustda</name> + <_description>Trust Direct Access Keyboard</_description> + <vendor>Trust</vendor> + </configItem> + </model> + <model> + <configItem> + <name>trust_slimline</name> + <_description>Trust Slimline</_description> + <vendor>Trust</vendor> + </configItem> + </model> + <model> + <configItem> + <name>tm2020</name> + <_description>TypeMatrix EZ-Reach 2020</_description> + <vendor>TypeMatrix</vendor> + </configItem> + </model> + <model> + <configItem> + <name>tm2030PS2</name> + <_description>TypeMatrix EZ-Reach 2030 PS2</_description> + <vendor>TypeMatrix</vendor> + </configItem> + </model> + <model> + <configItem> + <name>tm2030USB</name> + <_description>TypeMatrix EZ-Reach 2030 USB</_description> + <vendor>TypeMatrix</vendor> + </configItem> + </model> + <model> + <configItem> + <name>tm2030USB-102</name> + <_description>TypeMatrix EZ-Reach 2030 USB (102/105:EU mode)</_description> + <vendor>TypeMatrix</vendor> + </configItem> + </model> + <model> + <configItem> + <name>tm2030USB-106</name> + <_description>TypeMatrix EZ-Reach 2030 USB (106:JP mode)</_description> + <vendor>TypeMatrix</vendor> + </configItem> + </model> + <model> + <configItem> + <name>yahoo</name> + <_description>Yahoo! Internet Keyboard</_description> + <vendor>Yahoo!</vendor> + </configItem> + </model> + <model> + <configItem> + <name>macbook78</name> + <_description>MacBook/MacBook Pro</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>macbook79</name> + <_description>MacBook/MacBook Pro (Intl)</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>macintosh</name> + <_description>Macintosh</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>macintosh_old</name> + <_description>Macintosh Old</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>macintosh_hhk</name> + <_description>Happy Hacking Keyboard for Mac</_description> + <vendor>Fujitsu</vendor> + </configItem> + </model> + <model> + <configItem> + <name>acer_c300</name> + <_description>Acer C300</_description> + <vendor>Acer</vendor> + </configItem> + </model> + <model> + <configItem> + <name>acer_ferrari4k</name> + <_description>Acer Ferrari 4000</_description> + <vendor>Acer</vendor> + </configItem> + </model> + <model> + <configItem> + <name>acer_laptop</name> + <_description>Acer Laptop</_description> + <vendor>Acer</vendor> + </configItem> + </model> + <model> + <configItem> + <name>asus_laptop</name> + <_description>Asus Laptop</_description> + <vendor>Asus</vendor> + </configItem> + </model> + <model> + <configItem> + <name>apple</name> + <_description>Apple</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>apple_laptop</name> + <_description>Apple Laptop</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>applealu_ansi</name> + <_description>Apple Aluminium Keyboard (ANSI)</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>applealu_iso</name> + <_description>Apple Aluminium Keyboard (ISO)</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>applealu_jis</name> + <_description>Apple Aluminium Keyboard (JIS)</_description> + <vendor>Apple</vendor> + </configItem> + </model> + <model> + <configItem> + <name>silvercrest</name> + <_description>SILVERCREST Multimedia Wireless Keyboard</_description> + <vendor>Silvercrest</vendor> + </configItem> + </model> + <model> + <configItem> + <name>emachines</name> + <_description>Laptop/notebook eMachines m68xx</_description> + <vendor>eMachines</vendor> + </configItem> + </model> + <model> + <configItem> + <name>benqx</name> + <_description>BenQ X-Touch</_description> + <vendor>BenQ</vendor> + </configItem> + </model> + <model> + <configItem> + <name>benqx730</name> + <_description>BenQ X-Touch 730</_description> + <vendor>BenQ</vendor> + </configItem> + </model> + <model> + <configItem> + <name>benqx800</name> + <_description>BenQ X-Touch 800</_description> + <vendor>BenQ</vendor> + </configItem> + </model> + <model> + <configItem> + <name>hhk</name> + <_description>Happy Hacking Keyboard</_description> + <vendor>Fujitsu</vendor> + </configItem> + </model> + <model> + <configItem> + <name>classmate</name> + <_description>Classmate PC</_description> + <vendor>Intel</vendor> + </configItem> + </model> + <model> + <configItem> + <name>olpc</name> + <_description>OLPC</_description> + <vendor>OLPC</vendor> + </configItem> + </model> + <model> + <configItem> + <name>sun6</name> + <_description>Sun Type 5/6</_description> + <vendor>Sun Microsystems</vendor> + </configItem> + </model> + <model> + <configItem> + <name>targa_v811</name> + <_description>Targa Visionary 811</_description> + <vendor>Targa</vendor> + </configItem> + </model> + <model> + <configItem> + <name>unitekkb1925</name> + <_description>Unitek KB-1925</_description> + <vendor>Unitek Group</vendor> + </configItem> + </model> + <model> + <configItem> + <name>compalfl90</name> + <_description>FL90</_description> + <vendor>Compal Electronics Inc.</vendor> + </configItem> + </model> + <model> + <configItem> + <name>creativedw7000</name> + <_description>Creative Desktop Wireless 7000</_description> + <vendor>Creative</vendor> + </configItem> + </model> + <model> + <configItem> + <name>htcdream</name> + <_description>Htc Dream phone</_description> + <vendor>htc</vendor> + </configItem> + </model> + </modelList> + <layoutList> + <layout> + <configItem> + <name>us</name> + <_shortDescription>USA</_shortDescription> + <_description>USA</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>chr</name> + <_description>Cherokee</_description> + <languageList><iso639Id>chr</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>euro</name> + <_description>With EuroSign on 5</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>intl</name> + <_description>International (with dead keys)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>alt-intl</name> + <_description>Alternative international</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>colemak</name> + <_description>Colemak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-intl</name> + <_description>Dvorak international (with dead keys)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-alt-intl</name> + <_description>Dvorak alternative international (no dead keys)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-l</name> + <_description>Left handed Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-r</name> + <_description>Right handed Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-classic</name> + <_description>Classic Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvp</name> + <_description>Programmer Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>rus</name> + <_description>Russian phonetic</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>altgr-intl</name> + <_description>International (AltGr dead keys)</_description> + <languageList><iso639Id>eng</iso639Id> + <iso639Id>fra</iso639Id> + <iso639Id>ger</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>olpc2</name> + <_description>Layout toggle on multiply/divide key</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>hbs</name> + <_description>Serbo-Croatian</_description> + <languageList><iso639Id>eng</iso639Id> + <iso639Id>bos</iso639Id> + <iso639Id>hbs</iso639Id> + <iso639Id>hrv</iso639Id> + <iso639Id>srp</iso639Id> </languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ad</name> + <_shortDescription>And</_shortDescription> + <_description>Andorra</_description> + <languageList><iso639Id>cat</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>af</name> + <_shortDescription>Afg</_shortDescription> + <_description>Afghanistan</_description> + </configItem> + <variantList> + <variant> + <configItem> + <name>ps</name> + <_description>Pashto</_description> + <languageList><iso639Id>pus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>uz</name> + <_description>Southern Uzbek</_description> + <languageList><iso639Id>uzb</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>olpc-ps</name> + <_description>OLPC Pashto</_description> + <languageList><iso639Id>pus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>olpc-fa</name> + <_description>OLPC Dari</_description> + <!-- No ISO code in ISO639-2, only draft ISO693-3 --> + </configItem> + </variant> + <variant> + <configItem> + <name>olpc-uz</name> + <_description>OLPC Southern Uzbek</_description> + <languageList><iso639Id>uzb</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ara</name> + <_shortDescription>Ara</_shortDescription> + <_description>Arabic</_description> + <countryList> + <iso3166Id>AE</iso3166Id> + <iso3166Id>BH</iso3166Id> + <iso3166Id>DZ</iso3166Id> + <iso3166Id>EG</iso3166Id> + <iso3166Id>EH</iso3166Id> + <iso3166Id>JO</iso3166Id> + <iso3166Id>KW</iso3166Id> + <iso3166Id>LB</iso3166Id> + <iso3166Id>LY</iso3166Id> + <iso3166Id>MA</iso3166Id> + <iso3166Id>MR</iso3166Id> + <iso3166Id>OM</iso3166Id> + <iso3166Id>PS</iso3166Id> + <iso3166Id>QA</iso3166Id> + <iso3166Id>SA</iso3166Id> + <iso3166Id>SD</iso3166Id> + <iso3166Id>SY</iso3166Id> + <iso3166Id>TN</iso3166Id> + <iso3166Id>YE</iso3166Id> + </countryList> + <languageList><iso639Id>ara</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>azerty</name> + <_description>azerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>azerty_digits</name> + <_description>azerty/digits</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>digits</name> + <_description>digits</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty</name> + <_description>qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty_digits</name> + <_description>qwerty/digits</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>buckwalter</name> + <_description>Buckwalter</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>al</name> + <_shortDescription>Alb</_shortDescription> + <_description>Albania</_description> + <languageList><iso639Id>alb</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>am</name> + <_shortDescription>Arm</_shortDescription> + <_description>Armenia</_description> + <languageList><iso639Id>hye</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <_description>Phonetic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>phonetic-alt</name> + <_description>Alternative Phonetic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>eastern</name> + <_description>Eastern</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>western</name> + <_description>Western</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>eastern-alt</name> + <_description>Alternative Eastern</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>at</name> + <_shortDescription>Aut</_shortDescription> + <_description>Austria</_description> + <languageList><iso639Id>ger</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>az</name> + <_shortDescription>Aze</_shortDescription> + <_description>Azerbaijan</_description> + <languageList><iso639Id>aze</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>cyrillic</name> + <_description>Cyrillic</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>by</name> + <_shortDescription>Blr</_shortDescription> + <_description>Belarus</_description> + <languageList><iso639Id>bel</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>legacy</name> + <_description>Legacy</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latin</name> + <_description>Latin</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>be</name> + <_shortDescription>Bel</_shortDescription> + <_description>Belgium</_description> + <languageList><iso639Id>ger</iso639Id> + <iso639Id>nld</iso639Id> + <iso639Id>fra</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>oss</name> + <_description>Alternative</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oss_latin9</name> + <_description>Alternative, latin-9 only</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oss_sundeadkeys</name> + <_description>Alternative, Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>iso-alternate</name> + <_description>ISO Alternate</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>wang</name> + <_description>Wang model 724 azerty</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>bd</name> + <_shortDescription>Bgd</_shortDescription> + <_description>Bangladesh</_description> + <languageList><iso639Id>ben</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>probhat</name> + <_description>Probhat</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>in</name> + <_shortDescription>Ind</_shortDescription> + <_description>India</_description> + </configItem> + <variantList> + <variant> + <configItem> + <name>ben</name> + <_description>Bengali</_description> + <languageList><iso639Id>ben</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ben_probhat</name> + <_description>Bengali Probhat</_description> + <languageList><iso639Id>ben</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>guj</name> + <_description>Gujarati</_description> + <languageList><iso639Id>guj</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>guru</name> + <_description>Gurmukhi</_description> + <languageList><iso639Id>pan</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>jhelum</name> + <_description>Gurmukhi Jhelum</_description> + <languageList><iso639Id>pan</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>kan</name> + <_description>Kannada</_description> + <languageList><iso639Id>kan</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mal</name> + <_description>Malayalam</_description> + <languageList><iso639Id>mal</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mal_lalitha</name> + <_description>Malayalam Lalitha</_description> + <languageList><iso639Id>mal</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ori</name> + <_description>Oriya</_description> + <languageList><iso639Id>ori</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tam_unicode</name> + <_description>Tamil Unicode</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tam_keyboard_with_numerals</name> + <_description>Tamil Keyboard with Numerals</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tam_TAB</name> + <_description>Tamil TAB Typewriter</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tam_TSCII</name> + <_description>Tamil TSCII Typewriter</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tam</name> + <_description>Tamil</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tel</name> + <_description>Telugu</_description> + <languageList><iso639Id>tel</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>urd-phonetic</name> + <_description>Urdu, Phonetic</_description> + <languageList><iso639Id>urd</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>urd-phonetic3</name> + <_description>Urdu, Alternative phonetic</_description> + <languageList><iso639Id>urd</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>urd-winkeys</name> + <_description>Urdu, Winkeys</_description> + <languageList><iso639Id>urd</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>bolnagri</name> + <_description>Hindi Bolnagri</_description> + <languageList><iso639Id>hin</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>hin-wx</name> + <_description>Hindi Wx</_description> + <languageList><iso639Id>hin</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>eng</name> + <_description>English with RupeeSign</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ba</name> + <_shortDescription>Bih</_shortDescription> + <_description>Bosnia and Herzegovina</_description> + <languageList><iso639Id>bos</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>alternatequotes</name> + <_description> Use guillemets for quotes</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>unicode</name> + <_description>Use Bosnian digraphs</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>unicodeus</name> + <_description>US keyboard with Bosnian digraphs</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us</name> + <_description>US keyboard with Bosnian letters</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>br</name> + <_shortDescription>Bra</_shortDescription> + <_description>Brazil</_description> + <languageList><iso639Id>por</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nativo</name> + <_description>Nativo</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nativo-us</name> + <_description>Nativo for USA keyboards</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nativo-epo</name> + <_description>Nativo for Esperanto</_description> + <languageList><iso639Id>epo</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>bg</name> + <_shortDescription>Bgr</_shortDescription> + <_description>Bulgaria</_description> + <languageList><iso639Id>bul</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <_description>Traditional phonetic</_description> + </configItem> + </variant> + </variantList> + <variantList> + <variant> + <configItem> + <name>bas_phonetic</name> + <_description>New phonetic</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ma</name> + <_description>Morocco</_description> + </configItem> + <variantList> + <variant> + <configItem> + <name>french</name> + <_description>French</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tifinagh</name> + <_description>Tifinagh</_description> + <languageList><iso639Id>ber</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tifinagh-alt</name> + <_description>Tifinagh alternative</_description> + <languageList><iso639Id>ber</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tifinagh-alt-phonetic</name> + <_description>Tifinagh alternative phonetic</_description> + <languageList><iso639Id>ber</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tifinagh-extended</name> + <_description>Tifinagh extended</_description> + <languageList><iso639Id>ber</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tifinagh-phonetic</name> + <_description>Tifinagh phonetic</_description> + <languageList><iso639Id>ber</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tifinagh-extended-phonetic</name> + <_description>Tifinagh extended phonetic</_description> + <languageList><iso639Id>ber</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mm</name> + <_shortDescription>Mmr</_shortDescription> + <_description>Myanmar</_description> + <languageList><iso639Id>mya</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ca</name> + <_shortDescription>Can</_shortDescription> + <_description>Canada</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>fr-dvorak</name> + <_description>French Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>fr-legacy</name> + <_description>French (legacy)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>multix</name> + <_description>Multilingual</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>multi</name> + <_description>Multilingual, first part</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>multi-2gr</name> + <_description>Multilingual, second part</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ike</name> + <_description>Inuktitut</_description> + <languageList><iso639Id>iku</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>shs</name> + <_description>Secwepemctsin</_description> + <!-- No ISO code in ISO639-2, only draft ISO693-3 --> + </configItem> + </variant> + <variant> + <configItem> + <name>kut</name> + <_description>Ktunaxa</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>eng</name> + <_description>English</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>cd</name> + <_shortDescription>COD</_shortDescription> + <_description>Congo, Democratic Republic of the</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>cn</name> + <_shortDescription>Chn</_shortDescription> + <_description>China</_description> + <languageList><iso639Id>chi</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>tib</name> + <_description>Tibetan</_description> + <languageList><iso639Id>tib</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tib_asciinum</name> + <_description>Tibetan (with ASCII numerals)</_description> + <languageList><iso639Id>tib</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>hr</name> + <_shortDescription>Hrv</_shortDescription> + <_description>Croatia</_description> + <languageList><iso639Id>scr</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>alternatequotes</name> + <_description>Use guillemets for quotes</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>unicode</name> + <_description>Use Croatian digraphs</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>unicodeus</name> + <_description>US keyboard with Croatian digraphs</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us</name> + <_description>US keyboard with Croatian letters</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>cz</name> + <_shortDescription>Cze</_shortDescription> + <_description>Czechia</_description> + <languageList><iso639Id>cze</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>bksl</name> + <_description>With <\|> key</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty</name> + <_description>qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty_bksl</name> + <_description>qwerty, extended Backslash</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ucw</name> + <_description>UCW layout (accented letters only)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-ucw</name> + <_description>US Dvorak with CZ UCW support</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>dk</name> + <_shortDescription>Dnk</_shortDescription> + <_description>Denmark</_description> + <languageList><iso639Id>dan</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac_nodeadkeys</name> + <_description>Macintosh, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>nl</name> + <_shortDescription>Nld</_shortDescription> + <_description>Netherlands</_description> + <languageList><iso639Id>nld</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>std</name> + <_description>Standard</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>bt</name> + <_shortDescription>Btn</_shortDescription> + <_description>Bhutan</_description> + <languageList><iso639Id>dzo</iso639Id></languageList> + </configItem> + </layout> + <layout> + <configItem> + <name>ee</name> + <_shortDescription>Est</_shortDescription> + <_description>Estonia</_description> + <languageList><iso639Id>est</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us</name> + <_description>US keyboard with Estonian letters</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ir</name> + <_shortDescription>Irn</_shortDescription> + <_description>Iran</_description> + <languageList><iso639Id>per</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>pes_keypad</name> + <_description>Persian, with Persian Keypad</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ku</name> + <_description>Kurdish, Latin Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_f</name> + <_description>Kurdish, (F)</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_alt</name> + <_description>Kurdish, Latin Alt-Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_ara</name> + <_description>Kurdish, Arabic-Latin</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>iq</name> + <_shortDescription>Irq</_shortDescription> + <_description>Iraq</_description> + <languageList><iso639Id>ara</iso639Id> + <iso639Id>kur</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>ku</name> + <_description>Kurdish, Latin Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_f</name> + <_description>Kurdish, (F)</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_alt</name> + <_description>Kurdish, Latin Alt-Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_ara</name> + <_description>Kurdish, Arabic-Latin</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>fo</name> + <_shortDescription>Fro</_shortDescription> + <_description>Faroe Islands</_description> + <languageList><iso639Id>fao</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>fi</name> + <_shortDescription>Fin</_shortDescription> + <_description>Finland</_description> + <languageList><iso639Id>fin</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>classic</name> + <_description>Classic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Classic, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>smi</name> + <_description>Northern Saami</_description> + <languageList><iso639Id>smi</iso639Id> + <iso639Id>sme</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>fr</name> + <_shortDescription>Fra</_shortDescription> + <_description>France</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oss</name> + <_description>Alternative</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oss_latin9</name> + <_description>Alternative, latin-9 only</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oss_nodeadkeys</name> + <_description>Alternative, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oss_sundeadkeys</name> + <_description>Alternative, Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latin9</name> + <_description>(Legacy) Alternative</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latin9_nodeadkeys</name> + <_description>(Legacy) Alternative, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latin9_sundeadkeys</name> + <_description>(Legacy) Alternative, Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>bepo</name> + <_description>Bepo, ergonomic, Dvorak way</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>bepo_latin9</name> + <_description>Bepo, ergonomic, Dvorak way, latin-9 only</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>bre</name> + <_description>Breton</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>oci</name> + <_description>Occitan</_description> + <languageList><iso639Id>oci</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>geo</name> + <_description>Georgian AZERTY Tskapo</_description> + <languageList><iso639Id>geo</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>gh</name> + <_shortDescription>Gha</_shortDescription> + <_description>Ghana</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>generic</name> + <_description>Multilingual</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>akan</name> + <_description>Akan</_description> + <languageList><iso639Id>aka</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ewe</name> + <_description>Ewe</_description> + <languageList><iso639Id>ewe</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>fula</name> + <_description>Fula</_description> + <languageList><iso639Id>ful</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ga</name> + <_description>Ga</_description> + <languageList><iso639Id>gaa</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>hausa</name> + <_description>Hausa</_description> + <languageList><iso639Id>hau</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>avn</name> + <_description>Avatime</_description> + <languageList><iso639Id>avn</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>gillbt</name> + <_description>GILLBT</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>gn</name> + <_shortDescription>Gin</_shortDescription> + <_description>Guinea</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ge</name> + <_shortDescription>Geo</_shortDescription> + <_description>Georgia</_description> + <languageList><iso639Id>geo</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>ergonomic</name> + <_description>Ergonomic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mess</name> + <_description>MESS</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ru</name> + <_description>Russian</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>os</name> + <_description>Ossetian</_description> + <languageList><iso639Id>oss</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>de</name> + <_shortDescription>Deu</_shortDescription> + <_description>Germany</_description> + <languageList><iso639Id>ger</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>deadacute</name> + <_description>Dead acute</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>deadgraveacute</name> + <_description>Dead grave acute</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ro</name> + <_description>Romanian keyboard with German letters</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ro_nodeadkeys</name> + <_description>Romanian keyboard with German letters, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>neo</name> + <_description>Neo 2</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac_nodeadkeys</name> + <_description>Macintosh, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dsb</name> + <_description>Lower Sorbian</_description> + <languageList><iso639Id>dsb</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>dsb_qwertz</name> + <_description>Lower Sorbian (qwertz)</_description> + <languageList><iso639Id>dsb</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty</name> + <_description>qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ru</name> + <_description>Russian phonetic</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>gr</name> + <_shortDescription>Grc</_shortDescription> + <_description>Greece</_description> + <languageList><iso639Id>gre</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>simple</name> + <_description>Simple</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>extended</name> + <_description>Extended</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>polytonic</name> + <_description>Polytonic</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>hu</name> + <_shortDescription>Hun</_shortDescription> + <_description>Hungary</_description> + <languageList><iso639Id>hun</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>standard</name> + <_description>Standard</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty</name> + <_description>qwerty</_description> + </configItem> + </variant> + + <!-- 101 keys --> + <variant> + <configItem> + <name>101_qwertz_comma_dead</name> + <_description>101/qwertz/comma/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwertz_comma_nodead</name> + <_description>101/qwertz/comma/Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwertz_dot_dead</name> + <_description>101/qwertz/dot/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwertz_dot_nodead</name> + <_description>101/qwertz/dot/Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwerty_comma_dead</name> + <_description>101/qwerty/comma/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwerty_comma_nodead</name> + <_description>101/qwerty/comma/Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwerty_dot_dead</name> + <_description>101/qwerty/dot/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>101_qwerty_dot_nodead</name> + <_description>101/qwerty/dot/Eliminate dead keys</_description> + </configItem> + </variant> + + + <!-- 102 keys --> + <variant> + <configItem> + <name>102_qwertz_comma_dead</name> + <_description>102/qwertz/comma/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwertz_comma_nodead</name> + <_description>102/qwertz/comma/Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwertz_dot_dead</name> + <_description>102/qwertz/dot/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwertz_dot_nodead</name> + <_description>102/qwertz/dot/Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwerty_comma_dead</name> + <_description>102/qwerty/comma/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwerty_comma_nodead</name> + <_description>102/qwerty/comma/Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwerty_dot_dead</name> + <_description>102/qwerty/dot/Dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>102_qwerty_dot_nodead</name> + <_description>102/qwerty/dot/Eliminate dead keys</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>is</name> + <_shortDescription>Isl</_shortDescription> + <_description>Iceland</_description> + <languageList><iso639Id>ice</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>Sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>il</name> + <_shortDescription>Isr</_shortDescription> + <_description>Israel</_description> + <languageList><iso639Id>heb</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>lyx</name> + <_description>lyx</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>phonetic</name> + <_description>Phonetic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>biblical</name> + <_description>Biblical Hebrew (Tiro)</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>it</name> + <_shortDescription>Ita</_shortDescription> + <_description>Italy</_description> + <languageList><iso639Id>ita</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us</name> + <_description>US keyboard with Italian letters</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>geo</name> + <_description>Georgian</_description> + <languageList><iso639Id>geo</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>jp</name> + <_shortDescription>Jpn</_shortDescription> + <_description>Japan</_description> + <languageList><iso639Id>jpn</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>kana</name> + <_description>Kana</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>kana86</name> + <_description>Kana 86</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>OADG109A</name> + <_description>OADG 109A</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>kg</name> + <_shortDescription>Kgz</_shortDescription> + <_description>Kyrgyzstan</_description> + <languageList><iso639Id>kir</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <_description>Phonetic</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>kh</name> + <_shortDescription>Khm</_shortDescription> + <_description>Cambodia</_description> + <languageList><iso639Id>khm</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>kz</name> + <_shortDescription>Kaz</_shortDescription> + <_description>Kazakhstan</_description> + <languageList><iso639Id>kaz</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>ruskaz</name> + <_description>Russian with Kazakh</_description> + <languageList><iso639Id>kaz</iso639Id> + <iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>kazrus</name> + <_description>Kazakh with Russian</_description> + <languageList><iso639Id>kaz</iso639Id> + <iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>la</name> + <_shortDescription>Lao</_shortDescription> + <_description>Laos</_description> + <languageList><iso639Id>lao</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>latam</name> + <_shortDescription>LAm</_shortDescription> + <_description>Latin American</_description> + <countryList> + <iso3166Id>AR</iso3166Id> + <iso3166Id>BO</iso3166Id> + <iso3166Id>CL</iso3166Id> + <iso3166Id>CO</iso3166Id> + <iso3166Id>CR</iso3166Id> + <iso3166Id>CU</iso3166Id> + <iso3166Id>DO</iso3166Id> + <iso3166Id>EC</iso3166Id> + <iso3166Id>GT</iso3166Id> + <iso3166Id>HN</iso3166Id> + <iso3166Id>HT</iso3166Id> + <iso3166Id>MX</iso3166Id> + <iso3166Id>NI</iso3166Id> + <iso3166Id>PA</iso3166Id> + <iso3166Id>PE</iso3166Id> + <iso3166Id>PR</iso3166Id> + <iso3166Id>PY</iso3166Id> + <iso3166Id>SV</iso3166Id> + <iso3166Id>US</iso3166Id> + <iso3166Id>UY</iso3166Id> + <iso3166Id>VE</iso3166Id> + </countryList> + <languageList><iso639Id>spa</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>deadtilde</name> + <_description>Include dead tilde</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>lt</name> + <_shortDescription>Ltu</_shortDescription> + <_description>Lithuania</_description> + <languageList><iso639Id>lit</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>std</name> + <_description>Standard</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us</name> + <_description>US keyboard with Lithuanian letters</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ibm</name> + <_description>IBM (LST 1205-92)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>lekp</name> + <_description>LEKP</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>lekpa</name> + <_description>LEKPa</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>lv</name> + <_shortDescription>Lva</_shortDescription> + <_description>Latvia</_description> + <languageList><iso639Id>lav</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>apostrophe</name> + <_description>Apostrophe (') variant</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>tilde</name> + <_description>Tilde (~) variant</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>fkey</name> + <_description>F-letter (F) variant</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mao</name> + <_shortDescription>Mao</_shortDescription> + <_description>Maori</_description> + <languageList><iso639Id>mao</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>me</name> + <_shortDescription>MNE</_shortDescription> + <_description>Montenegro</_description> + <languageList><iso639Id>srp</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>cyrillic</name> + <_description>Cyrillic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>cyrillicyz</name> + <_description>Cyrillic, Z and ZHE swapped</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinunicode</name> + <_description>Latin unicode</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinyz</name> + <_description>Latin qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinunicodeyz</name> + <_description>Latin unicode qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>cyrillicalternatequotes</name> + <_description>Cyrillic with guillemets</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinalternatequotes</name> + <_description>Latin with guillemets</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mk</name> + <_shortDescription>Mkd</_shortDescription> + <_description>Macedonia</_description> + <languageList><iso639Id>mkd</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mt</name> + <_shortDescription>Mlt</_shortDescription> + <_description>Malta</_description> + <languageList><iso639Id>mlt</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>us</name> + <_description>Maltese keyboard with US layout</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mn</name> + <_shortDescription>Mng</_shortDescription> + <_description>Mongolia</_description> + <languageList><iso639Id>mng</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>no</name> + <_shortDescription>Nor</_shortDescription> + <_description>Norway</_description> + <languageList><iso639Id>nor</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>smi</name> + <_description>Northern Saami</_description> + <languageList><iso639Id>sme</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>smi_nodeadkeys</name> + <_description>Northern Saami, eliminate dead keys</_description> + <languageList><iso639Id>sme</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac_nodeadkeys</name> + <_description>Macintosh, eliminate dead keys</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>pl</name> + <_shortDescription>Pol</_shortDescription> + <_description>Poland</_description> + <languageList><iso639Id>pol</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>qwertz</name> + <_description>qwertz</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak_quotes</name> + <_description>Dvorak, Polish quotes on quotemark key</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak_altquotes</name> + <_description>Dvorak, Polish quotes on key 1</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>csb</name> + <_description>Kashubian</_description> + <languageList><iso639Id>csb</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ru_phonetic_dvorak</name> + <_description>Russian phonetic Dvorak</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>dvp</name> + <_description>Programmer Dvorak</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>pt</name> + <_shortDescription>Prt</_shortDescription> + <_description>Portugal</_description> + <languageList><iso639Id>por</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac_nodeadkeys</name> + <_description>Macintosh, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac_sundeadkeys</name> + <_description>Macintosh, Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nativo</name> + <_description>Nativo</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nativo-us</name> + <_description>Nativo for USA keyboards</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>nativo-epo</name> + <_description>Nativo for Esperanto</_description> + <languageList><iso639Id>epo</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ro</name> + <_shortDescription>Rou</_shortDescription> + <_description>Romania</_description> + <languageList><iso639Id>rum</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>cedilla</name> + <_description>Cedilla</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>std</name> + <_description>Standard</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>std_cedilla</name> + <_description>Standard (Cedilla)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>winkeys</name> + <_description>Winkeys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_f</name> + <_description>Crimean Tatar (Turkish F)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_alt</name> + <_description>Crimean Tatar (Turkish Alt-Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_dobruca1</name> + <_description>Crimean Tatar (Dobruca-1 Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_dobruca2</name> + <_description>Crimean Tatar (Dobruca-2 Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ru</name> + <_shortDescription>Rus</_shortDescription> + <_description>Russia</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <_description>Phonetic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>phonetic_winkeys</name> + <_description>Phonetic Winkeys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>typewriter</name> + <_description>Typewriter</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>legacy</name> + <_description>Legacy</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>typewriter-legacy</name> + <_description>Typewriter, legacy</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>tt</name> + <_description>Tatar</_description> + <languageList><iso639Id>tat</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>os_legacy</name> + <_description>Ossetian, legacy</_description> + <languageList><iso639Id>oss</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>os_winkeys</name> + <_description>Ossetian, Winkeys</_description> + <languageList><iso639Id>oss</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>cv</name> + <_description>Chuvash</_description> + <languageList><iso639Id>chv</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>cv_latin</name> + <_description>Chuvash Latin</_description> + <languageList><iso639Id>chv</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>udm</name> + <_description>Udmurt</_description> + <languageList><iso639Id>udm</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>kom</name> + <_description>Komi</_description> + <languageList><iso639Id>kom</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>sah</name> + <_description>Yakut</_description> + <languageList><iso639Id>sah</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>xal</name> + <_description>Kalmyk</_description> + <languageList><iso639Id>xal</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>dos</name> + <_description>DOS</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>srp</name> + <_description>Serbian</_description> + <languageList><iso639Id>rus</iso639Id> + <iso639Id>srp</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>bak</name> + <_description>Bashkirian</_description> + <languageList><iso639Id>bak</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>chm</name> + <_description>Mari</_description> + <languageList><iso639Id>chm</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>rs</name> + <_shortDescription>SRB</_shortDescription> + <_description>Serbia</_description> + <languageList><iso639Id>srp</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>yz</name> + <_description>Z and ZHE swapped</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latin</name> + <_description>Latin</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinunicode</name> + <_description>Latin Unicode</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinyz</name> + <_description>Latin qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinunicodeyz</name> + <_description>Latin Unicode qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>alternatequotes</name> + <_description>With guillemets</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>latinalternatequotes</name> + <_description>Latin with guillemets</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>rue</name> + <_description>Pannonian Rusyn Homophonic</_description> + <languageList><iso639Id>rue</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>si</name> + <_shortDescription>Svn</_shortDescription> + <_description>Slovenia</_description> + <languageList><iso639Id>slv</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>alternatequotes</name> + <_description>Use guillemets for quotes</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us</name> + <_description>US keyboard with Slovenian letters</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>sk</name> + <_shortDescription>Svk</_shortDescription> + <_description>Slovakia</_description> + <languageList><iso639Id>slo</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>bksl</name> + <_description>Extended Backslash</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty</name> + <_description>qwerty</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>qwerty_bksl</name> + <_description>qwerty, extended Backslash</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>es</name> + <_shortDescription>Esp</_shortDescription> + <_description>Spain</_description> + <languageList><iso639Id>spa</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>deadtilde</name> + <_description>Include dead tilde</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ast</name> + <_description>Asturian variant with bottom-dot H and bottom-dot L</_description> + <languageList><iso639Id>ast</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>cat</name> + <_description>Catalan variant with middle-dot L</_description> + <languageList><iso639Id>cat</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>se</name> + <_shortDescription>Swe</_shortDescription> + <_description>Sweden</_description> + <languageList><iso639Id>swe</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>nodeadkeys</name> + <_description>Eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>rus</name> + <_description>Russian phonetic</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>rus_nodeadkeys</name> + <_description>Russian phonetic, eliminate dead keys</_description> + <languageList><iso639Id>rus</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>smi</name> + <_description>Northern Saami</_description> + <languageList><iso639Id>sme</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>svdvorak</name> + <_description>Svdvorak</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ch</name> + <_shortDescription>Che</_shortDescription> + <_description>Switzerland</_description> + <languageList><iso639Id>ger</iso639Id> + <iso639Id>gsw</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>legacy</name> + <_description>Legacy</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>de_nodeadkeys</name> + <_description>German, eliminate dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>de_sundeadkeys</name> + <_description>German, Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>fr</name> + <_description>French</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>fr_nodeadkeys</name> + <_description>French, eliminate dead keys</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>fr_sundeadkeys</name> + <_description>French, Sun dead keys</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>fr_mac</name> + <_description>French (Macintosh)</_description> + <languageList><iso639Id>fra</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>de_mac</name> + <_description>German (Macintosh)</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>sy</name> + <_shortDescription>Syr</_shortDescription> + <_description>Syria</_description> + <languageList><iso639Id>syr</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>syc</name> + <_description>Syriac</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>syc_phonetic</name> + <_description>Syriac phonetic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ku</name> + <_description>Kurdish, Latin Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_f</name> + <_description>Kurdish, (F)</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_alt</name> + <_description>Kurdish, Latin Alt-Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>tj</name> + <_shortDescription>Tjk</_shortDescription> + <_description>Tajikistan</_description> + <languageList><iso639Id>tgk</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>legacy</name> + <_description>Legacy</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>lk</name> + <_shortDescription>Lka</_shortDescription> + <_description>Sri Lanka</_description> + <languageList><iso639Id>sin</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>tam_unicode</name> + <_description>Tamil Unicode</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>tam_TAB</name> + <_description>Tamil TAB Typewriter</_description> + <languageList><iso639Id>tam</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>th</name> + <_shortDescription>Tha</_shortDescription> + <_description>Thailand</_description> + <languageList><iso639Id>tha</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>tis</name> + <_description>TIS-820.2538</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>pat</name> + <_description>Pattachote</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>tr</name> + <_shortDescription>Tur</_shortDescription> + <_description>Turkey</_description> + <languageList><iso639Id>tur</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>f</name> + <_description>(F)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>alt</name> + <_description>Alt-Q</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>sundeadkeys</name> + <_description>Sun dead keys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ku</name> + <_description>Kurdish, Latin Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_f</name> + <_description>Kurdish, (F)</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ku_alt</name> + <_description>Kurdish, Latin Alt-Q</_description> + <languageList><iso639Id>kur</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>intl</name> + <_description>International (with dead keys)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>crh</name> + <_description>Crimean Tatar (Turkish Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_f</name> + <_description>Crimean Tatar (Turkish F)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_alt</name> + <_description>Crimean Tatar (Turkish Alt-Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ua</name> + <_shortDescription>Ukr</_shortDescription> + <_description>Ukraine</_description> + <languageList><iso639Id>ukr</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>phonetic</name> + <_description>Phonetic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>typewriter</name> + <_description>Typewriter</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>winkeys</name> + <_description>Winkeys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>legacy</name> + <_description>Legacy</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>rstu</name> +<!-- RSTU 2019-91 --> + <_description>Standard RSTU</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>rstu_ru</name> +<!-- RSTU 2019-91 --> + <_description>Standard RSTU on Russian layout</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>homophonic</name> + <_description>Homophonic</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>crh</name> + <_description>Crimean Tatar (Turkish Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_f</name> + <_description>Crimean Tatar (Turkish F)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_alt</name> + <_description>Crimean Tatar (Turkish Alt-Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>gb</name> + <_shortDescription>GBr</_shortDescription> + <_description>United Kingdom</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>extd</name> + <_description>Extended - Winkeys</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>intl</name> + <_description>International (with dead keys)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorakukp</name> + <_description>Dvorak (UK Punctuation)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac</name> + <_description>Macintosh</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>mac_intl</name> + <_description>Macintosh (International)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>colemak</name> + <_description>Colemak</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>uz</name> + <_shortDescription>Uzb</_shortDescription> + <_description>Uzbekistan</_description> + <languageList><iso639Id>uzb</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>latin</name> + <_description>Latin</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>crh</name> + <_description>Crimean Tatar (Turkish Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_f</name> + <_description>Crimean Tatar (Turkish F)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>crh_alt</name> + <_description>Crimean Tatar (Turkish Alt-Q)</_description> + <languageList><iso639Id>crh</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>vn</name> + <_shortDescription>Vnm</_shortDescription> + <_description>Vietnam</_description> + <languageList><iso639Id>vie</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>kr</name> + <_shortDescription>Kor</_shortDescription> + <_description>Korea, Republic of</_description> + <languageList><iso639Id>kor</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>kr104</name> + <_description>101/104 key Compatible</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>nec_vndr/jp</name> + <_shortDescription>Jpn</_shortDescription> + <_description>Japan (PC-98xx Series)</_description> + <countryList><iso3166Id>JP</iso3166Id></countryList> + <languageList><iso639Id>jpn</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>ie</name> + <_shortDescription>Irl</_shortDescription> + <_description>Ireland</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>CloGaelach</name> + <_description>CloGaelach</_description> + <languageList><iso639Id>gla</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>UnicodeExpert</name> + <_description>UnicodeExpert</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>ogam</name> + <_description>Ogham</_description> + <!-- No ISO code in ISO639 --> + </configItem> + </variant> + <variant> + <configItem> + <name>ogam_is434</name> + <_description>Ogham IS434</_description> + <!-- No ISO code in ISO639 --> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>pk</name> + <_shortDescription>Pak</_shortDescription> + <_description>Pakistan</_description> + <languageList><iso639Id>urd</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>urd-crulp</name> + <_description>CRULP</_description> + <languageList><iso639Id>urd</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>urd-nla</name> + <_description>NLA</_description> + <languageList><iso639Id>urd</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>ara</name> + <_description>Arabic</_description> + <languageList><iso639Id>ara</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>snd</name> + <_description>Sindhi</_description> + <languageList><iso639Id>sd</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>mv</name> + <_shortDescription>Mdv</_shortDescription> + <_description>Maldives</_description> + <languageList><iso639Id>div</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>za</name> + <_shortDescription>Zaf</_shortDescription> + <_description>South Africa</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + </layout> + <layout> + <configItem> + <name>epo</name> + <_shortDescription>Epo</_shortDescription> + <_description>Esperanto</_description> + <languageList><iso639Id>epo</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>legacy</name> + <_description>displaced semicolon and quote (obsolete)</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>np</name> + <_shortDescription>Npl</_shortDescription> + <_description>Nepal</_description> + <languageList><iso639Id>nep</iso639Id></languageList> + </configItem> + </layout> + <layout> + <configItem> + <name>ng</name> + <_shortDescription>Nga</_shortDescription> + <_description>Nigeria</_description> + <languageList><iso639Id>eng</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>igbo</name> + <_description>Igbo</_description> + <languageList><iso639Id>ibo</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>yoruba</name> + <_description>Yoruba</_description> + <languageList><iso639Id>yor</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>hausa</name> + <_description>Hausa</_description> + <languageList><iso639Id>hau</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>et</name> + <_shortDescription>Eth</_shortDescription> + <_description>Ethiopia</_description> + <languageList><iso639Id>amh</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>sn</name> + <_shortDescription>Sen</_shortDescription> + <_description>Senegal</_description> + <languageList><iso639Id>wol</iso639Id></languageList> + </configItem> + <variantList/> + </layout> + <layout> + <configItem> + <name>brai</name> + <_shortDescription>Brl</_shortDescription> + <_description>Braille</_description> + </configItem> + <variantList> + <variant> + <configItem> + <name>left_hand</name> + <_description>Left hand</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>right_hand</name> + <_description>Right hand</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>tm</name> + <_shortDescription>Tkm</_shortDescription> + <_description>Turkmenistan</_description> + <languageList><iso639Id>tuk</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>alt</name> + <_description>Alt-Q</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>ml</name> + <_shortDescription>Mli</_shortDescription> + <_description>Mali</_description> + <languageList><iso639Id>bam</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>fr-oss</name> + <_description>Français (France Alternative)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us-mac</name> + <_description>English (USA Macintosh)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>us-intl</name> + <_description>English (USA International)</_description> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>tz</name> + <_shortDescription>Tza</_shortDescription> + <_description>Tanzania</_description> + <languageList><iso639Id>swa</iso639Id></languageList> + </configItem> + </layout> + <layout> + <configItem> + <name>ke</name> + <_shortDescription>Ken</_shortDescription> + <_description>Kenya</_description> + <languageList><iso639Id>swa</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>kik</name> + <_description>Kikuyu</_description> + <languageList><iso639Id>kik</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + <layout> + <configItem> + <name>bw</name> + <_shortDescription>Bwa</_shortDescription> + <_description>Botswana</_description> + <languageList><iso639Id>tsn</iso639Id></languageList> + </configItem> + </layout> + <layout> + <configItem> + <name>ph</name> + <_shortDescription>Phi</_shortDescription> + <_description>Philippines</_description> + <languageList><iso639Id>eng</iso639Id> + <iso639Id>bik</iso639Id> + <iso639Id>ceb</iso639Id> + <iso639Id>fil</iso639Id> + <iso639Id>hil</iso639Id> + <iso639Id>ilo</iso639Id> + <iso639Id>pam</iso639Id> + <iso639Id>pag</iso639Id> + <iso639Id>phi</iso639Id> + <iso639Id>tgl</iso639Id> + <iso639Id>war</iso639Id></languageList> + </configItem> + <variantList> + <variant> + <configItem> + <name>qwerty-bay</name> + <_description>QWERTY (Baybayin)</_description> + <languageList><iso639Id>bik</iso639Id> + <iso639Id>ceb</iso639Id> + <iso639Id>fil</iso639Id> + <iso639Id>hil</iso639Id> + <iso639Id>ilo</iso639Id> + <iso639Id>pam</iso639Id> + <iso639Id>pag</iso639Id> + <iso639Id>phi</iso639Id> + <iso639Id>tgl</iso639Id> + <iso639Id>war</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>capewell-dvorak</name> + <_description>Capewell-Dvorak (Latin)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>capewell-dvorak-bay</name> + <_description>Capewell-Dvorak (Baybayin)</_description> + <languageList><iso639Id>bik</iso639Id> + <iso639Id>ceb</iso639Id> + <iso639Id>fil</iso639Id> + <iso639Id>hil</iso639Id> + <iso639Id>ilo</iso639Id> + <iso639Id>pam</iso639Id> + <iso639Id>pag</iso639Id> + <iso639Id>phi</iso639Id> + <iso639Id>tgl</iso639Id> + <iso639Id>war</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>capewell-qwerf2k6</name> + <_description>Capewell-QWERF 2006 (Latin)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>capewell-qwerf2k6-bay</name> + <_description>Capewell-QWERF 2006 (Baybayin)</_description> + <languageList><iso639Id>bik</iso639Id> + <iso639Id>ceb</iso639Id> + <iso639Id>fil</iso639Id> + <iso639Id>hil</iso639Id> + <iso639Id>ilo</iso639Id> + <iso639Id>pam</iso639Id> + <iso639Id>pag</iso639Id> + <iso639Id>phi</iso639Id> + <iso639Id>tgl</iso639Id> + <iso639Id>war</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>colemak</name> + <_description>Colemak (Latin)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>colemak-bay</name> + <_description>Colemak (Baybayin)</_description> + <languageList><iso639Id>bik</iso639Id> + <iso639Id>ceb</iso639Id> + <iso639Id>fil</iso639Id> + <iso639Id>hil</iso639Id> + <iso639Id>ilo</iso639Id> + <iso639Id>pam</iso639Id> + <iso639Id>pag</iso639Id> + <iso639Id>phi</iso639Id> + <iso639Id>tgl</iso639Id> + <iso639Id>war</iso639Id></languageList> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak</name> + <_description>Dvorak (Latin)</_description> + </configItem> + </variant> + <variant> + <configItem> + <name>dvorak-bay</name> + <_description>Dvorak (Baybayin)</_description> + <languageList><iso639Id>bik</iso639Id> + <iso639Id>ceb</iso639Id> + <iso639Id>fil</iso639Id> + <iso639Id>hil</iso639Id> + <iso639Id>ilo</iso639Id> + <iso639Id>pam</iso639Id> + <iso639Id>pag</iso639Id> + <iso639Id>phi</iso639Id> + <iso639Id>tgl</iso639Id> + <iso639Id>war</iso639Id></languageList> + </configItem> + </variant> + </variantList> + </layout> + </layoutList> + <optionList> + <group allowMultipleSelection="true"> + <!-- The key combination used to switch between groups --> + <configItem> + <name>grp</name> + <_description>Key(s) to change layout</_description> + </configItem> + <option> + <configItem> + <name>grp:switch</name> + <_description>Right Alt (while pressed)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lswitch</name> + <_description>Left Alt (while pressed)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lwin_switch</name> + <_description>Left Win (while pressed)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rwin_switch</name> + <_description>Right Win (while pressed)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:win_switch</name> + <_description>Any Win key (while pressed)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:caps_switch</name> + <_description>Caps Lock (while pressed), Alt+Caps Lock does the original capslock action</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rctrl_switch</name> + <_description>Right Ctrl (while pressed)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:toggle</name> + <_description>Right Alt</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lalt_toggle</name> + <_description>Left Alt</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:caps_toggle</name> + <_description>Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:shift_caps_toggle</name> + <_description>Shift+Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:shift_caps_switch</name> + <_description>Caps Lock (to first layout), Shift+Caps Lock (to last layout)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:win_menu_switch</name> + <_description>Left Win (to first layout), Right Win/Menu (to last layout)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lctrl_rctrl_switch</name> + <_description>Left Ctrl (to first layout), Right Ctrl (to last layout)</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:alt_caps_toggle</name> + <_description>Alt+Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:shifts_toggle</name> + <_description>Both Shift keys together</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:alts_toggle</name> + <_description>Both Alt keys together</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:ctrls_toggle</name> + <_description>Both Ctrl keys together</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:ctrl_shift_toggle</name> + <_description>Ctrl+Shift</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lctrl_lshift_toggle</name> + <_description>Left Ctrl+Left Shift</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rctrl_rshift_toggle</name> + <_description>Right Ctrl+Right Shift</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:ctrl_alt_toggle</name> + <_description>Alt+Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:alt_shift_toggle</name> + <_description>Alt+Shift</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:alt_space_toggle</name> + <_description>Alt+Space</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:menu_toggle</name> + <_description>Menu</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lwin_toggle</name> + <_description>Left Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rwin_toggle</name> + <_description>Right Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lshift_toggle</name> + <_description>Left Shift</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rshift_toggle</name> + <_description>Right Shift</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:lctrl_toggle</name> + <_description>Left Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:rctrl_toggle</name> + <_description>Right Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp:sclk_toggle</name> + <_description>Scroll Lock</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <!-- The key combination used to choose the 3rd (and 4th, together with Shift) + level of symbols --> + <configItem> + <name>lv3</name> + <_description>Key to choose 3rd level</_description> + </configItem> + <option> + <configItem> + <name>lv3:switch</name> + <_description>Right Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:menu_switch</name> + <_description>Menu</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:win_switch</name> + <_description>Any Win key</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:lwin_switch</name> + <_description>Left Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:rwin_switch</name> + <_description>Right Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:alt_switch</name> + <_description>Any Alt key</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:lalt_switch</name> + <_description>Left Alt</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:ralt_switch</name> + <_description>Right Alt</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:ralt_switch_multikey</name> + <_description>Right Alt, Shift+Right Alt key is Multi_Key</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:ralt_alt</name> + <_description>Right Alt key never chooses 3rd level</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:enter_switch</name> + <_description>Enter on keypad</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:caps_switch</name> + <_description>Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:bksl_switch</name> + <_description>Backslash</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:lsgt_switch</name> + <description><Less/Greater></description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:caps_switch_latch</name> + <description>Caps Lock (chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:bksl_switch_latch</name> + <description>Backslash chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</description> + </configItem> + </option> + <option> + <configItem> + <name>lv3:lsgt_switch_latch</name> + <description><Less/Greater> (chooses 3rd level, latches when pressed together with another 3rd-level-chooser)</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <!-- Tweaking the position of the "Ctrl" key --> + <configItem> + <name>ctrl</name> + <_description>Ctrl key position</_description> + </configItem> + <option> + <configItem> + <name>ctrl:nocaps</name> + <_description>Make Caps Lock an additional Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:lctrl_meta</name> + <_description>Meta on Left Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:swapcaps</name> + <_description>Swap Ctrl and Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:ctrl_ac</name> + <_description>At left of 'A'</_description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:ctrl_aa</name> + <_description>At bottom left</_description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:ctrl_ra</name> + <_description>Right Ctrl as Right Alt</_description> + </configItem> + </option> + <option> + <configItem> + <name>ctrl:ctrl_menu</name> + <description>Right Ctrl is mapped to Menu</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <!-- Using startard LEDs to indicate the alternative (not first) group(s) --> + <configItem> + <name>grp_led</name> + <_description>Use keyboard LED to show alternative layout</_description> + </configItem> + <option> + <configItem> + <name>grp_led:num</name> + <_description>Num Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp_led:caps</name> + <_description>Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>grp_led:scroll</name> + <_description>Scroll Lock</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <!-- Select a keypad type --> + <configItem> + <name>keypad</name> + <_description>Numeric keypad layout selection</_description> + </configItem> + <option> + <configItem> + <name>keypad:legacy</name> + <_description>Legacy</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:oss</name> + <_description>Unicode additions (arrows and math operators)</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:future</name> + <_description>Unicode additions (arrows and math operators). Math operators on default level</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:legacy_wang</name> + <_description>Legacy Wang 724</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:oss_wang</name> + <_description>Wang 724 keypad with unicode additions (arrows and math operators)</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:future_wang</name> + <_description>Wang 724 keypad with unicode additions (arrows and math operators). Math operators on default level</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:hex</name> + <_description>Hexadecimal</_description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:atm</name> + <_description>ATM/phone-style</_description> + </configItem> + </option> + </group> + <!-- This option should override the KPDL key defined in keypad; I hope it's declared in the right place --> + <group allowMultipleSelection="false"> + <!-- Select a keypad KPDL variant --> + <configItem> + <name>kpdl</name> + <_description>Numeric keypad delete key behaviour</_description> + </configItem> + <option> + <configItem> + <!-- Actually, with KP_DECIMAL, as the old keypad(dot) --> + <name>kpdl:dot</name> + <_description>Legacy key with dot</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:comma</name> + <!-- Actually, with KP_SEPARATOR, as the old keypad(comma) --> + <_description>Legacy key with comma</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:dotoss</name> + <_description>Four-level key with dot</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:dotoss_latin9</name> + <_description>Four-level key with dot, latin-9 restriction</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:commaoss</name> + <_description>Four-level key with comma</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:momayyezoss</name> + <_description>Four-level key with momayyez</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:kposs</name> + <!-- This assumes the KP_ abstract symbols are actually useful for some apps + The description needs to be rewritten --> + <_description>Four-level key with abstract separators</_description> + </configItem> + </option> + <option> + <configItem> + <name>kpdl:semi</name> + <_description>Semi-colon on third level</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <!-- Caps Lock tweaks. + "Internal" capitalization means capitalization using some internal tables. + Otherwise "as Shift" - means using next group. --> + <configItem> + <name>caps</name> + <_description>Caps Lock key behavior</_description> + </configItem> + <option> + <configItem> + <name>caps:internal</name> + <_description>Caps Lock uses internal capitalization. Shift "pauses" Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:internal_nocancel</name> + <_description>Caps Lock uses internal capitalization. Shift doesn't affect Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:shift</name> + <_description>Caps Lock acts as Shift with locking. Shift "pauses" Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:shift_nocancel</name> + <_description>Caps Lock acts as Shift with locking. Shift doesn't affect Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:capslock</name> + <_description>Caps Lock toggles normal capitalization of alphabetic characters</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:numlock</name> + <_description>Make Caps Lock an additional Num Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:swapescape</name> + <_description>Swap ESC and Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:escape</name> + <_description>Make Caps Lock an additional ESC</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:backspace</name> + <_description>Make Caps Lock an additional Backspace</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:super</name> + <_description>Make Caps Lock an additional Super</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:hyper</name> + <_description>Make Caps Lock an additional Hyper</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:shiftlock</name> + <_description>Caps Lock toggles Shift so all keys are affected</_description> + </configItem> + </option> + <option> + <configItem> + <name>caps:none</name> + <_description>Caps Lock is disabled</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <!-- Using special PC keys (Win, Menu) to work as standard X keys (Super, Hyper, etc.) --> + <configItem> + <name>altwin</name> + <_description>Alt/Win key behavior</_description> + </configItem> + <option> + <configItem> + <name>altwin:menu</name> + <_description>Add the standard behavior to Menu key</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:meta_alt</name> + <_description>Alt and Meta are on Alt keys</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:ctrl_win</name> + <_description>Control is mapped to Win keys (and the usual Ctrl keys)</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:ctrl_alt_win</name> + <_description>Control is mapped to Alt keys, Alt is mapped to Win keys</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:meta_win</name> + <_description>Meta is mapped to Win keys</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:left_meta_win</name> + <_description>Meta is mapped to Left Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:hyper_win</name> + <_description>Hyper is mapped to Win-keys</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:alt_super_win</name> + <_description>Alt is mapped to Right Win, Super to Menu</_description> + </configItem> + </option> + <option> + <configItem> + <name>altwin:swap_lalt_lwin</name> + <_description>Left Alt is swapped with Left Win</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <!-- Tweaking the position of the "Compose" key: mapping to existing PC keys --> + <configItem> + <name>Compose key</name> + <_description>Compose key position</_description> + </configItem> + <option> + <configItem> + <name>compose:ralt</name> + <_description>Right Alt</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:lwin</name> + <_description>Left Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:rwin</name> + <_description>Right Win</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:menu</name> + <_description>Menu</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:lctrl</name> + <_description>Left Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:rctrl</name> + <_description>Right Ctrl</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:caps</name> + <_description>Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:102</name> + <_description><Less/Greater></_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:paus</name> + <_description>Pause</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:prsc</name> + <_description>PrtSc</_description> + </configItem> + </option> + <option> + <configItem> + <name>compose:sclk</name> + <_description>Scroll Lock</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>compat</name> + <_description>Miscellaneous compatibility options</_description> + </configItem> + <option> + <configItem> + <name>numpad:pc</name> + <_description>Default numeric keypad keys</_description> + </configItem> + </option> + <option> + <configItem> + <name>numpad:mac</name> + <_description>Numeric keypad keys work as with Mac</_description> + </configItem> + </option> + <option> + <configItem> + <name>numpad:microsoft</name> + <_description>Shift with numeric keypad keys works as in MS Windows</_description> + </configItem> + </option> + <option> + <configItem> + <name>numpad:shift3</name> + <_description>Shift does not cancel Num Lock, chooses 3rd level instead</_description> + </configItem> + </option> + <option> + <configItem> + <name>srvrkeys:none</name> + <_description>Special keys (Ctrl+Alt+<key>) handled in a server</_description> + </configItem> + </option> + <option> + <configItem> + <name>apple:alupckeys</name> + <_description>Apple Aluminium Keyboard: emulate PC keys (Print, Scroll Lock, Pause, Num Lock)</_description> + </configItem> + </option> + <option> + <configItem> + <name>shift:breaks_caps</name> + <_description>Shift cancels Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>misc:typo</name> + <_description>Enable extra typographic characters</_description> + </configItem> + </option> + <option> + <configItem> + <name>shift:both_capslock</name> + <_description>Both Shift-Keys together toggle Caps Lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>shift:both_capslock_cancel</name> + <description>Both Shift-Keys together activate Caps Lock, one Shift-Key deactivates</description> + </configItem> + </option> + <option> + <configItem> + <name>shift:both_shiftlock</name> + <description>Both Shift-Keys together toggle ShiftLock</description> + </configItem> + </option> + <option> + <configItem> + <name>keypad:pointerkeys</name> + <_description>Toggle PointerKeys with Shift + NumLock.</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <!-- Special shortcuts for the Euro character --> + <configItem> + <name>eurosign</name> + <_description>Adding currency signs to certain keys</_description> + </configItem> + <option> + <configItem> + <name>eurosign:e</name> + <_description>Euro on E</_description> + </configItem> + </option> + <option> + <configItem> + <name>eurosign:2</name> + <_description>Euro on 2</_description> + </configItem> + </option> + <option> + <configItem> + <name>eurosign:4</name> + <_description>Euro on 4</_description> + </configItem> + </option> + <option> + <configItem> + <name>eurosign:5</name> + <_description>Euro on 5</_description> + </configItem> + </option> + <option> + <configItem> + <name>rupeesign:4</name> + <_description>Rupee on 4</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>lv5</name> + <_description>Key to choose 5th level</_description> + </configItem> + <option> + <configItem> + <name>lv5:lsgt_switch_lock</name> + <_description><Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:ralt_switch_lock</name> + <_description>Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:lwin_switch_lock</name> + <_description>Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:rwin_switch_lock</name> + <_description>Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:lsgt_switch_lock_cancel</name> + <_description><Less/Greater> chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:ralt_switch_lock_cancel</name> + <_description>Right Alt chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:lwin_switch_lock_cancel</name> + <_description>Left Win chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:rwin_switch_lock_cancel</name> + <_description>Right Win chooses 5th level, locks when pressed together with another 5th-level-chooser, one press releases the lock</_description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:lsgt_switch_lock_cancel</name> + <description><Less/Greater> chooses 5th level and activates level5-Lock when pressed together with another 5th-level-chooser, one press releases the lock</description> + </configItem> + </option> + <option> + <configItem> + <name>lv5:ralt_switch_lock_cancel</name> + <description>Right Alt chooses 5th level and activates level5-Lock when pressed together with another 5th-level-chooser, one press releases the lock</description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <!-- Let space output NBSP, NNBSP, ZWNJ, and ZWJ for the desired level --> + <configItem> + <name>nbsp</name> + <_description>Using space key to input non-breakable space character</_description> + </configItem> + <option> + <configItem> + <name>nbsp:none</name> + <_description>Usual space at any level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level2</name> + <_description>Non-breakable space character at second level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level3</name> + <_description>Non-breakable space character at third level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level3s</name> + <_description>Non-breakable space character at third level, nothing at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level3n</name> + <_description>Non-breakable space character at third level, thin non-breakable space character at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level4</name> + <_description>Non-breakable space character at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level4n</name> + <_description>Non-breakable space character at fourth level, thin non-breakable space character at sixth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:level4nl</name> + <_description>Non-breakable space character at fourth level, thin non-breakable space character at sixth level (via Ctrl+Shift)</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2</name> + <_description>Zero-width non-joiner character at second level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2zwj3</name> + <_description>Zero-width non-joiner character at second level, zero-width joiner character at third level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2zwj3nb4</name> + <_description>Zero-width non-joiner character at second level, zero-width joiner character at third level, non-breakable space character at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2nb3</name> + <_description>Zero-width non-joiner character at second level, non-breakable space character at third level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2nb3s</name> + <_description>Zero-width non-joiner character at second level, non-breakable space character at third level, nothing at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2nb3zwj4</name> + <_description>Zero-width non-joiner character at second level, non-breakable space character at third level, zero-width joiner at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj2nb3nnb4</name> + <_description>Zero-width non-joiner character at second level, non-breakable space character at third level, thin non-breakable space at fourth level</_description> + </configItem> + </option> + <option> + <configItem> + <name>nbsp:zwnj3zwj4</name> + <_description>Zero-width non-joiner character at third level, zero-width joiner at fourth level</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>japan</name> + <_description>Japanese keyboard options</_description> + </configItem> + <option> + <configItem> + <name>japan:kana_lock</name> + <_description>Kana Lock key is locking</_description> + </configItem> + </option> + <option> + <configItem> + <name>japan:nicola_f_bs</name> + <_description>NICOLA-F style Backspace</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="false"> + <configItem> + <name>esperanto</name> + <_description>Adding Esperanto circumflexes (supersigno)</_description> + </configItem> + <option> + <configItem> + <name>esperanto:qwerty</name> + <_description>To the corresponding key in a Qwerty keyboard.</_description> + </configItem> + </option> + <option> + <configItem> + <name>esperanto:dvorak</name> + <_description>To the corresponding key in a Dvorak keyboard.</_description> + </configItem> + </option> + </group> + <group allowMultipleSelection="true"> + <configItem> + <name>terminate</name> + <_description>Key sequence to kill the X server</_description> + </configItem> + <option> + <configItem> + <name>terminate:ctrl_alt_bksp</name> + <_description>Control + Alt + Backspace</_description> + </configItem> + </option> + </group> + </optionList> +</xkbConfigRegistry> diff --git a/xorg-server/xkeyboard-config/symbols/fi b/xorg-server/xkeyboard-config/symbols/fi index 78dd91934..9d0f6247e 100644 --- a/xorg-server/xkeyboard-config/symbols/fi +++ b/xorg-server/xkeyboard-config/symbols/fi @@ -1,207 +1,208 @@ -//
-// $XKeyboardConfig$
-//
-// X keyboard maps for Finland
-//
-// SFS 5966 / Kotoistus keymap created by Troy Korjuslommi
-// Classic keymap based on traditional by Marko Myllynen
-// Eliminate deadkeys alternative sent by Linus Torvalds
-//
-
-//
-// Missing from X11/keysymdef.h as of 2010-05-13
-//
-// U2030 # PER MILLE SIGN
-// U0292 # LATIN SMALL LETTER EZH
-// U01B7 # LATIN CAPITAL LETTER EZH
-//
-
-partial alphanumeric_keys default
-xkb_symbols "kotoistus" {
-
- // Official keymap for Finland based on SFS 5966 standard
- //
- // This keymap implements all the functionality of Annex 1
- // of the standard and additionally defines the following to
- // allow entering these characters with keyboars without LSGT.
- //
- // AE08+4, U+003C : LESS-THAN SIGN (less)
- // AE09+4, U+003E : GREATER-THAN SIGN (greater)
- // AD08+4, U+007C : VERTICAL LINE (bar)
- //
- // Annex 3 of the standard is implemented in fi_FI.UTF-8/Compose
-
- name[Group1]="Finland";
-
- key <TLDE> { [ section, onehalf, dead_stroke, NoSymbol ] };
- key <AE01> { [ 1, exclam, NoSymbol, exclamdown ] };
- key <AE02> { [ 2, quotedbl, at, rightdoublequotemark ] };
- key <AE03> { [ 3, numbersign, sterling, guillemotright ] };
- key <AE04> { [ 4, currency, dollar, guillemotleft ] };
- key <AE05> { [ 5, percent, U2030, leftdoublequotemark ] };
- key <AE06> { [ 6, ampersand, singlelowquotemark, doublelowquotemark ] };
- key <AE07> { [ 7, slash, braceleft, NoSymbol ] };
- key <AE08> { [ 8, parenleft, bracketleft, less ] };
- key <AE09> { [ 9, parenright, bracketright, greater ] };
- key <AE10> { [ 0, equal, braceright, degree ] };
- key <AE11> { [ plus, question, backslash, questiondown ] };
- key <AE12> { [ dead_acute, dead_grave, dead_cedilla, dead_ogonek ] };
-
- key <AD01> { [ q, Q, q, Q ] };
- key <AD02> { [ w, W, w, W ] };
- key <AD03> { [ e, E, EuroSign, NoSymbol ] };
- key <AD04> { [ r, R, r, R ] };
- key <AD05> { [ t, T, thorn, THORN ] };
- key <AD06> { [ y, Y, y, Y ] };
- key <AD07> { [ u, U, u, U ] };
- key <AD08> { [ i, I, idotless, bar ] };
- key <AD09> { [ o, O, oe, OE ] };
- key <AD10> { [ p, P, dead_horn, dead_hook ] };
- key <AD11> { [ aring, Aring, dead_doubleacute, dead_abovering ] };
- key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, dead_macron ] };
-
- key <AC01> { [ a, A, schwa, SCHWA ] };
- key <AC02> { [ s, S, ssharp, NoSymbol ] };
- key <AC03> { [ d, D, eth, ETH ] };
- key <AC04> { [ f, F, f, F ] };
- key <AC05> { [ g, G, g, G ] };
- key <AC06> { [ h, H, h, H ] };
- key <AC07> { [ j, J, j, J ] };
- key <AC08> { [ k, K, kra, NoSymbol ] };
- key <AC09> { [ l, L, dead_stroke, NoSymbol ] };
- key <AC10> { [ odiaeresis, Odiaeresis, oslash, Oslash ] };
- key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] };
- key <BKSL> { [ apostrophe, asterisk, dead_caron, dead_breve ] };
-
- key <LSGT> { [ less, greater, bar, NoSymbol ] };
- key <AB01> { [ z, Z, U0292, U01B7 ] };
- key <AB02> { [ x, X, multiply, periodcentered ] };
- key <AB03> { [ c, C, c, C ] };
- key <AB04> { [ v, V, v, V ] };
- key <AB05> { [ b, B, b, B ] };
- key <AB06> { [ n, N, eng, ENG ] };
- key <AB07> { [ m, M, mu, emdash ] };
- key <AB08> { [ comma, semicolon, rightsinglequotemark, leftsinglequotemark ] };
- key <AB09> { [ period, colon, dead_belowdot, dead_abovedot ] };
- key <AB10> { [ minus, underscore, endash, dead_belowcomma ] };
-
- include "nbsp(level3)"
- include "kpdl(comma)"
- include "level3(ralt_switch)"
- include "compose(rwin)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "classic" {
-
- include "fi(fi)"
-
- name[Group1]="Finland - Classic";
-};
-
-partial alphanumeric_keys hidden
-xkb_symbols "fi" {
-
- // Classic Finnish keyboard layout with dead keys support
- // and all ISO-8859-1 and ISO-8859-15 characters available
-
- key <TLDE> { [ section, onehalf, onequarter, threequarters ] };
- key <AE01> { [ 1, exclam, exclamdown, onesuperior ] };
- key <AE02> { [ 2, quotedbl, at, twosuperior ] };
- key <AE03> { [ 3, numbersign, sterling, threesuperior ] };
- key <AE04> { [ 4, currency, dollar, cent ] };
- key <AE05> { [ 5, percent, EuroSign, masculine ] };
- key <AE06> { [ 6, ampersand, yen, ordfeminine ] };
- key <AE07> { [ 7, slash, braceleft, plusminus ] };
- key <AE08> { [ 8, parenleft, bracketleft, guillemotleft ] };
- key <AE09> { [ 9, parenright, bracketright, guillemotright ] };
- key <AE10> { [ 0, equal, braceright, degree ] };
- key <AE11> { [ plus, question, backslash, questiondown ] };
- key <AE12> { [ dead_acute, dead_grave, dead_cedilla, dead_ogonek ] };
-
- key <AD01> { [ q, Q, q, Q ] };
- key <AD02> { [ w, W, w, W ] };
- key <AD03> { [ e, E, EuroSign, cent ] };
- key <AD04> { [ r, R, registered, NoSymbol ] };
- key <AD05> { [ t, T, thorn, THORN ] };
- key <AD06> { [ y, Y, y, Y ] };
- key <AD07> { [ u, U, u, U ] };
- key <AD08> { [ i, I, idotless, bar ] };
- key <AD09> { [ o, O, o, O ] };
- key <AD10> { [ p, P, paragraph, NoSymbol ] };
- key <AD11> { [ aring, Aring, oe, OE ] };
- key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, dead_caron ] };
-
- key <AC01> { [ a, A, schwa, SCHWA ] };
- key <AC02> { [ s, S, scaron, Scaron ] };
- key <AC03> { [ d, D, eth, ETH ] };
- key <AC04> { [ f, F, f, F ] };
- key <AC05> { [ g, G, eng, ENG ] };
- key <AC06> { [ h, H, h, H ] };
- key <AC07> { [ j, J, j, J ] };
- key <AC08> { [ k, K, kra, NoSymbol ] };
- key <AC09> { [ l, L, dead_stroke, NoSymbol ] };
- key <AC10> { [ odiaeresis, Odiaeresis, oslash, Oslash ] };
- key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] };
- key <BKSL> { [ apostrophe, asterisk, dead_caron, dead_breve ] };
-
- key <LSGT> { [ less, greater, bar, brokenbar ] };
- key <AB01> { [ z, Z, zcaron, Zcaron ] };
- key <AB02> { [ x, X, multiply, division ] };
- key <AB03> { [ c, C, copyright, cent ] };
- key <AB04> { [ v, V, v, V ] };
- key <AB05> { [ b, B, ssharp, NoSymbol ] };
- key <AB06> { [ n, N, ntilde, Ntilde ] };
- key <AB07> { [ m, M, mu, NoSymbol ] };
- key <AB08> { [ comma, semicolon, dead_cedilla, dead_ogonek ] };
- key <AB09> { [ period, colon, periodcentered, notsign ] };
- key <AB10> { [ minus, underscore, hyphen, dead_macron ] };
-
- include "nbsp(level4)"
- include "kpdl(comma)"
- include "level3(ralt_switch)"
- include "compose(rwin)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "nodeadkeys" {
-
- // Classic Finnish keyboard layout without dead keys
-
- include "fi(fi)"
-
- name[Group1]="Finland - Classic, eliminate dead keys";
-
- key <AE12> { [ acute, grave, cedilla, ogonek ] };
- key <AD12> { [ diaeresis, asciicircum, asciitilde, caron ] };
- key <AC09> { [ l, L, l, L ] };
- key <BKSL> { [ apostrophe, asterisk, caron, breve ] };
- key <AB08> { [ comma, semicolon, cedilla, ogonek ] };
- key <AB10> { [ minus, underscore, hyphen, macron ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "smi" {
-
- // Describes the differences between a Norwegian Northern Sami
- // (keyboard with dead key support) and a Swedish/Finnish Sami
- // keyboard according to the specs at:
- // http://www.hum.uit.no/a/trond/se-lat9-sefi-keys.html
-
- include "no(smi)"
-
- name[Group1]="Finland - Northern Saami";
-
- key <AC10> { [ odiaeresis, Odiaeresis, oslash, Oslash ] };
- key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "mac" {
-
- // Macintosh keyboard for Finland based on Swedish(Macintosh) keyboard
-
- include "se(mac)"
-
- name[Group1]="Finland - Macintosh";
-};
+// +// $XKeyboardConfig$ +// +// X keyboard maps for Finland +// +// SFS 5966 / Kotoistus keymap created by Troy Korjuslommi +// Classic keymap based on traditional by Marko Myllynen +// Eliminate deadkeys alternative sent by Linus Torvalds +// + +// +// Missing from X11/keysymdef.h as of 2010-05-13 +// +// U2030 # PER MILLE SIGN +// U0292 # LATIN SMALL LETTER EZH +// U01B7 # LATIN CAPITAL LETTER EZH +// + +partial alphanumeric_keys default +xkb_symbols "kotoistus" { + + // Official keymap for Finland based on SFS 5966 standard + // + // This keymap implements all the functionality of Annex 1 + // of the standard and additionally defines the following to + // allow entering these characters with keyboars without LSGT. + // + // AE08+4, U+003C : LESS-THAN SIGN (less) + // AE09+4, U+003E : GREATER-THAN SIGN (greater) + // AD08+4, U+007C : VERTICAL LINE (bar) + // + // Annex 3 of the standard is implemented in fi_FI.UTF-8/Compose + + name[Group1]="Finland"; + + key <TLDE> { [ section, onehalf, dead_stroke, NoSymbol ] }; + key <AE01> { [ 1, exclam, NoSymbol, exclamdown ] }; + key <AE02> { [ 2, quotedbl, at, rightdoublequotemark ] }; + key <AE03> { [ 3, numbersign, sterling, guillemotright ] }; + key <AE04> { [ 4, currency, dollar, guillemotleft ] }; + key <AE05> { [ 5, percent, U2030, leftdoublequotemark ] }; + key <AE06> { [ 6, ampersand, singlelowquotemark, doublelowquotemark ] }; + key <AE07> { [ 7, slash, braceleft, NoSymbol ] }; + key <AE08> { [ 8, parenleft, bracketleft, less ] }; + key <AE09> { [ 9, parenright, bracketright, greater ] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + key <AE11> { [ plus, question, backslash, questiondown ] }; + key <AE12> { [ dead_acute, dead_grave, dead_cedilla, dead_ogonek ] }; + + key <AD01> { [ q, Q, q, Q ] }; + key <AD02> { [ w, W, w, W ] }; + key <AD03> { [ e, E, EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, r, R ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, y, Y ] }; + key <AD07> { [ u, U, u, U ] }; + key <AD08> { [ i, I, idotless, bar ] }; + key <AD09> { [ o, O, oe, OE ] }; + key <AD10> { [ p, P, dead_horn, dead_hook ] }; + key <AD11> { [ aring, Aring, dead_doubleacute, dead_abovering ] }; + key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, dead_macron ] }; + + key <AC01> { [ a, A, schwa, SCHWA ] }; + key <AC02> { [ s, S, ssharp, NoSymbol ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, f, F ] }; + key <AC05> { [ g, G, g, G ] }; + key <AC06> { [ h, H, h, H ] }; + key <AC07> { [ j, J, j, J ] }; + key <AC08> { [ k, K, kra, NoSymbol ] }; + key <AC09> { [ l, L, dead_stroke, NoSymbol ] }; + key <AC10> { [ odiaeresis, Odiaeresis, oslash, Oslash ] }; + key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] }; + key <BKSL> { [ apostrophe, asterisk, dead_caron, dead_breve ] }; + + key <LSGT> { [ less, greater, bar, NoSymbol ] }; + key <AB01> { [ z, Z, U0292, U01B7 ] }; + key <AB02> { [ x, X, multiply, periodcentered ] }; + key <AB03> { [ c, C, c, C ] }; + key <AB04> { [ v, V, v, V ] }; + key <AB05> { [ b, B, b, B ] }; + key <AB06> { [ n, N, eng, ENG ] }; + key <AB07> { [ m, M, mu, emdash ] }; + key <AB08> { [ comma, semicolon, rightsinglequotemark, leftsinglequotemark ] }; + key <AB09> { [ period, colon, dead_belowdot, dead_abovedot ] }; + key <AB10> { [ minus, underscore, endash, dead_belowcomma ] }; + + include "nbsp(level4)" + include "nbsp(level3)" + include "kpdl(comma)" + include "level3(ralt_switch)" + include "compose(rwin)" +}; + +partial alphanumeric_keys +xkb_symbols "classic" { + + include "fi(fi)" + + name[Group1]="Finland - Classic"; +}; + +partial alphanumeric_keys hidden +xkb_symbols "fi" { + + // Classic Finnish keyboard layout with dead keys support + // and all ISO-8859-1 and ISO-8859-15 characters available + + key <TLDE> { [ section, onehalf, onequarter, threequarters ] }; + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, quotedbl, at, twosuperior ] }; + key <AE03> { [ 3, numbersign, sterling, threesuperior ] }; + key <AE04> { [ 4, currency, dollar, cent ] }; + key <AE05> { [ 5, percent, EuroSign, masculine ] }; + key <AE06> { [ 6, ampersand, yen, ordfeminine ] }; + key <AE07> { [ 7, slash, braceleft, plusminus ] }; + key <AE08> { [ 8, parenleft, bracketleft, guillemotleft ] }; + key <AE09> { [ 9, parenright, bracketright, guillemotright ] }; + key <AE10> { [ 0, equal, braceright, degree ] }; + key <AE11> { [ plus, question, backslash, questiondown ] }; + key <AE12> { [ dead_acute, dead_grave, dead_cedilla, dead_ogonek ] }; + + key <AD01> { [ q, Q, q, Q ] }; + key <AD02> { [ w, W, w, W ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AD04> { [ r, R, registered, NoSymbol ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, y, Y ] }; + key <AD07> { [ u, U, u, U ] }; + key <AD08> { [ i, I, idotless, bar ] }; + key <AD09> { [ o, O, o, O ] }; + key <AD10> { [ p, P, paragraph, NoSymbol ] }; + key <AD11> { [ aring, Aring, oe, OE ] }; + key <AD12> { [ dead_diaeresis, dead_circumflex, dead_tilde, dead_caron ] }; + + key <AC01> { [ a, A, schwa, SCHWA ] }; + key <AC02> { [ s, S, scaron, Scaron ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, f, F ] }; + key <AC05> { [ g, G, eng, ENG ] }; + key <AC06> { [ h, H, h, H ] }; + key <AC07> { [ j, J, j, J ] }; + key <AC08> { [ k, K, kra, NoSymbol ] }; + key <AC09> { [ l, L, dead_stroke, NoSymbol ] }; + key <AC10> { [ odiaeresis, Odiaeresis, oslash, Oslash ] }; + key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] }; + key <BKSL> { [ apostrophe, asterisk, dead_caron, dead_breve ] }; + + key <LSGT> { [ less, greater, bar, brokenbar ] }; + key <AB01> { [ z, Z, zcaron, Zcaron ] }; + key <AB02> { [ x, X, multiply, division ] }; + key <AB03> { [ c, C, copyright, cent ] }; + key <AB04> { [ v, V, v, V ] }; + key <AB05> { [ b, B, ssharp, NoSymbol ] }; + key <AB06> { [ n, N, ntilde, Ntilde ] }; + key <AB07> { [ m, M, mu, NoSymbol ] }; + key <AB08> { [ comma, semicolon, dead_cedilla, dead_ogonek ] }; + key <AB09> { [ period, colon, periodcentered, notsign ] }; + key <AB10> { [ minus, underscore, hyphen, dead_macron ] }; + + include "nbsp(level4)" + include "kpdl(comma)" + include "level3(ralt_switch)" + include "compose(rwin)" +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + + // Classic Finnish keyboard layout without dead keys + + include "fi(fi)" + + name[Group1]="Finland - Classic, eliminate dead keys"; + + key <AE12> { [ acute, grave, cedilla, ogonek ] }; + key <AD12> { [ diaeresis, asciicircum, asciitilde, caron ] }; + key <AC09> { [ l, L, l, L ] }; + key <BKSL> { [ apostrophe, asterisk, caron, breve ] }; + key <AB08> { [ comma, semicolon, cedilla, ogonek ] }; + key <AB10> { [ minus, underscore, hyphen, macron ] }; +}; + +partial alphanumeric_keys +xkb_symbols "smi" { + + // Describes the differences between a Norwegian Northern Sami + // (keyboard with dead key support) and a Swedish/Finnish Sami + // keyboard according to the specs at: + // http://www.hum.uit.no/a/trond/se-lat9-sefi-keys.html + + include "no(smi)" + + name[Group1]="Finland - Northern Saami"; + + key <AC10> { [ odiaeresis, Odiaeresis, oslash, Oslash ] }; + key <AC11> { [ adiaeresis, Adiaeresis, ae, AE ] }; +}; + +partial alphanumeric_keys +xkb_symbols "mac" { + + // Macintosh keyboard for Finland based on Swedish(Macintosh) keyboard + + include "se(mac)" + + name[Group1]="Finland - Macintosh"; +}; diff --git a/xorg-server/xkeyboard-config/symbols/ru b/xorg-server/xkeyboard-config/symbols/ru index 0e059afad..b95d6d57e 100644 --- a/xorg-server/xkeyboard-config/symbols/ru +++ b/xorg-server/xkeyboard-config/symbols/ru @@ -1,510 +1,531 @@ -// $XKeyboardConfig$
-
-// based on
-// russian standard keyboard
-// AEN <aen@logic.ru>
-// 2001/12/23 by Leon Kanter <leon@blackcatlinux.com>
-// 2005/12/09 Valery Inozemtsev <shrek@altlinux.ru>
-//
-// $XFree86: xc/programs/xkbcomp/symbols/ru,v 1.3 2003/02/15 22:27:05 dawes Exp $
-
-// Windows layout
-partial default alphanumeric_keys
-xkb_symbols "winkeys" {
- include "ru(common)"
-
- name[Group1]= "Russia";
-
- key <AE03> { [ 3, numerosign ] };
- key <AE04> { [ 4, semicolon ] };
- key <AE05> { [ 5, percent ] };
- key <AE06> { [ 6, colon ] };
- key <AE07> { [ 7, question ] };
- key <AE08> { [ 8, asterisk ] };
-
- key <AB10> { [ period, comma ] };
- key <BKSL> { [ backslash, slash ] };
-};
-
-partial hidden alphanumeric_keys
-xkb_symbols "common" {
-
- key <AE01> { [ 1, exclam ] };
- key <AE02> { [ 2, quotedbl ] };
- key <AE03> { [ 3, numbersign ] };
- key <AE04> { [ 4, asterisk ] };
- key <AE05> { [ 5, colon ] };
- key <AE06> { [ 6, comma ] };
- key <AE07> { [ 7, period ] };
- key <AE08> { [ 8, semicolon ] };
- key <AE09> { [ 9, parenleft ] };
- key <AE10> { [ 0, parenright ] };
- key <AE11> { [ minus, underscore ] };
- key <AE12> { [ equal, plus ] };
- key <BKSL> { [ backslash, bar ] };
- key <AB10> { [ slash, question ] };
- key <LSGT> { [ slash, bar ] };
-
- key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] };
- key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] };
- key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] };
- key <AD03> { [ Cyrillic_u, Cyrillic_U ] };
- key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] };
- key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] };
- key <AD06> { [ Cyrillic_en, Cyrillic_EN ] };
- key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] };
- key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] };
- key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] };
- key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] };
- key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] };
- key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] };
- key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] };
- key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] };
- key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] };
- key <AC04> { [ Cyrillic_a, Cyrillic_A ] };
- key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] };
- key <AC06> { [ Cyrillic_er, Cyrillic_ER ] };
- key <AC07> { [ Cyrillic_o, Cyrillic_O ] };
- key <AC08> { [ Cyrillic_el, Cyrillic_EL ] };
- key <AC09> { [ Cyrillic_de, Cyrillic_DE ] };
- key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] };
- key <AC11> { [ Cyrillic_e, Cyrillic_E ] };
- key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] };
- key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] };
- key <AB03> { [ Cyrillic_es, Cyrillic_ES ] };
- key <AB04> { [ Cyrillic_em, Cyrillic_EM ] };
- key <AB05> { [ Cyrillic_i, Cyrillic_I ] };
- key <AB06> { [ Cyrillic_te, Cyrillic_TE ] };
- key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] };
- key <AB08> { [ Cyrillic_be, Cyrillic_BE ] };
- key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] };
-
- key.type[group1]="TWO_LEVEL";
-
- include "kpdl(comma)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "legacy" {
- include "ru(common)"
-
- name[Group1]= "Russia - Legacy";
-};
-
-partial alphanumeric_keys
-xkb_symbols "olpc" {
-
- include "ru(common)"
-
- key <TLDE> { [ 0x01000451, 0x01000401, grave ] }; // Ñ‘, Ð
- key <AE03> { [ 3, numbersign, 0x01002116 ] }; // â„–
- key <AE04> { [ 4, dollar, semicolon ] };
- key <AE06> { [ 6, asciicircum, colon ] };
- key <AE07> { [ 7, ampersand ] };
- key <AE09> { [ 9, parenleft, acute ] };
- key <AC12> { [ backslash, bar, slash ] };
-
- include "group(olpc)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "typewriter" {
- include "ru(common)"
- name[Group1]= "Russia - Typewriter";
- key <TLDE> { [ bar, plus ] };
- key <AE01> { [ numerosign, 1 ] };
- key <AE02> { [ minus, 2 ] };
- key <AE03> { [ slash, 3 ] };
- key <AE04> { [ quotedbl, 4 ] };
- key <AE05> { [ colon, 5 ] };
- key <AE06> { [ comma, 6 ] };
- key <AE07> { [ period, 7 ] };
- key <AE08> { [ underscore, 8 ] };
- key <AE09> { [ question, 9 ] };
- key <AE10> { [ percent, 0 ] };
- key <AE11> { [ exclam, equal ] };
- key <AE12> { [ semicolon, backslash ] };
-
- key <BKSL> { [ parenright, parenleft ] };
-
- key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] };
- key <AB10> { [ Cyrillic_io, Cyrillic_IO ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "typewriter-legacy" {
- include "ru(common)"
- name[Group1]= "Russia - Typewriter, legacy";
- key <TLDE> { [ apostrophe, quotedbl ] };
- key <AE01> { [ exclam, 1 ] };
- key <AE02> { [ numerosign, 2 ] };
- key <AE03> { [ slash, 3 ] };
- key <AE04> { [ semicolon, 4 ] };
- key <AE05> { [ colon, 5 ] };
- key <AE06> { [ comma, 6 ] };
- key <AE07> { [ period, 7 ] };
- key <AE08> { [ underscore, 8 ] };
- key <AE09> { [ question, 9 ] };
- key <AE10> { [ percent, 0 ] };
- key <BKSL> { [ parenleft, parenright ] };
-
- key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] };
- key <AB10> { [ Cyrillic_io, Cyrillic_IO ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "phonetic" {
-
- name[Group1]= "Russia - Phonetic";
-
- key <AE01> { [ 1, exclam ] };
- key <AE02> { [ 2, at ] };
- key <AE03> { [ 3, Cyrillic_io ] };
- key <AE04> { [ 4, Cyrillic_IO ] };
- key <AE05> { [ 5, Cyrillic_hardsign ] };
- key <AE06> { [ 6, Cyrillic_HARDSIGN ] };
- key <AE07> { [ 7, ampersand ] };
- key <AE08> { [ 8, asterisk ] };
- key <AE09> { [ 9, parenleft ] };
- key <AE10> { [ 0, parenright ] };
- key <AE11> { [ minus, underscore ] };
-
- key <AB09> { [ period, greater ] };
- key <AB10> { [ slash, question ] };
- key <AB08> { [ comma, less ] };
- key <AC10> { [ semicolon, colon ] };
- key <AC11> { [ apostrophe, quotedbl ] };
- key <LSGT> { [ bar, brokenbar ] };
-
- key <TLDE> { [ Cyrillic_yu, Cyrillic_YU ] };
- key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] };
- key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] };
- key <LatS> { [ Cyrillic_es, Cyrillic_ES ] };
- key <LatA> { [ Cyrillic_a, Cyrillic_A ] };
- key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] };
- key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] };
- key <LatX> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] };
- key <LatD> { [ Cyrillic_de, Cyrillic_DE ] };
- key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] };
- key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] };
- key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] };
- key <LatT> { [ Cyrillic_te, Cyrillic_TE ] };
- key <LatR> { [ Cyrillic_er, Cyrillic_ER ] };
- key <LatN> { [ Cyrillic_en, Cyrillic_EN ] };
- key <LatB> { [ Cyrillic_be, Cyrillic_BE ] };
- key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] };
- key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] };
- key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] };
- key <LatM> { [ Cyrillic_em, Cyrillic_EM ] };
- key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] };
- key <LatU> { [ Cyrillic_u, Cyrillic_U ] };
- key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] };
- key <LatI> { [ Cyrillic_i, Cyrillic_I ] };
- key <LatO> { [ Cyrillic_o, Cyrillic_O ] };
- key <LatL> { [ Cyrillic_el, Cyrillic_EL ] };
- key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] };
-
- key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] };
- key <AE12> { [ Cyrillic_che, Cyrillic_CHE ] };
- key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] };
- key <BKSL> { [ Cyrillic_e, Cyrillic_E ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "phonetic_winkeys" {
-
- include "ru(phonetic)"
- name[Group1]= "Russia - Phonetic Winkeys";
-
- key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] };
- key <LatH> { [ Cyrillic_che, Cyrillic_CHE ] };
- key <AE12> { [ Cyrillic_softsign, Cyrillic_softsign ] };
-
-};
-
-partial alphanumeric_keys
-xkb_symbols "tt" {
- include "ru(winkeys)"
- name[Group1]= "Russia - Tatar";
-
- key.type[group1]="FOUR_LEVEL";
-
- key <TLDE> { [ 0x010004bb, 0x010004ba,
- Cyrillic_io, Cyrillic_IO ] };
- key <AD02> { [ 0x010004e9, 0x010004e8,
- Cyrillic_tse, Cyrillic_TSE ] };
- key <AD09> { [ 0x010004d9, 0x010004d8,
- Cyrillic_shcha, Cyrillic_SHCHA ] };
- key <AD12> { [ 0x010004af, 0x010004ae,
- Cyrillic_hardsign,Cyrillic_HARDSIGN ] };
- key <AC10> { [ 0x010004a3, 0x010004a2,
- Cyrillic_zhe, Cyrillic_ZHE ] };
- key <AB07> { [ 0x01000497, 0x01000496,
- Cyrillic_softsign,Cyrillic_SOFTSIGN ] };
-
- include "level3(ralt_switch)"
-
-};
-
-partial alphanumeric_keys
-xkb_symbols "os_legacy" {
- include "ru(common)"
-
- name[Group1]= "Russia - Ossetian, legacy";
-
- key <TLDE> { [ Cyrillic_e, Cyrillic_E ] };
- key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] };
- key <AC11> { [ 0x010004D5, 0x010004D4 ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "os_winkeys" {
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Ossetian, Winkeys";
-
- key <TLDE> { [ Cyrillic_e, Cyrillic_E ] };
- key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] };
- key <AC11> { [ 0x010004D5, 0x010004D4 ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "cv" {
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Chuvash";
-
- key.type[group1]="FOUR_LEVEL";
-
- key <AD03> { [ Cyrillic_u, Cyrillic_U,
- 0x010004f3, 0x010004f2 ] };
- key <AD05> { [ Cyrillic_ie, Cyrillic_IE,
- 0x01000115, 0x01000114 ] };
- key <AC04> { [ Cyrillic_a, Cyrillic_A,
- abreve, Abreve ] };
- key <AB03> { [ Cyrillic_es, Cyrillic_ES,
- ccedilla, Ccedilla ] };
-
- include "level3(ralt_switch)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "udm" {
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Udmurt";
-
- key.type[group1]="FOUR_LEVEL";
-
- key <AE01> { [ question, exclam, 1, 1 ] };
- key <AE02> { [ parenleft, quotedbl, 2, 2 ] };
- key <AE03> { [ parenright, numerosign, 3, 3 ] };
- key <AE04> { [ colon, semicolon, 4, 4 ] };
- key <AE05> { [ asterisk, percent, 5, 5 ] };
- key <AE06> { [ 0x010004dd, 0x010004dc, 6, 6 ] };
- key <AE07> { [ 0x010004e7, 0x010004e6, 7, 7 ] };
- key <AE08> { [ 0x010004f5, 0x010004f4, 8, 8 ] };
- key <AE09> { [ 0x010004e5, 0x010004e4, 9, 9 ] };
- key <AE10> { [ 0x010004df, 0x010004de, 0, 0 ] };
-
- include "level3(ralt_switch)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "cv_latin" {
- include "us(alt-intl)"
-
- name[Group1]= "Russia - Chuvash Latin";
-
- key.type[group1]="FOUR_LEVEL";
-
- key <AD01> { [ q, Q, 0x01000161, 0x01000160 ] };
- key <AD02> { [ w, W, udiaeresis, Udiaeresis ] };
- key <AD03> { [ e, E, 0x01000115, 0x01000114 ] };
- key <AD07> { [ u, U, udiaeresis, Udiaeresis ] };
- key <AD08> { [ i, I, 0x0100012d, 0x0100012c ] };
- key <AD09> { [ o, O, odiaeresis, Odiaeresis ] };
- key <AC01> { [ a, A, abreve, Abreve ] };
- key <AC02> { [ s, S, scedilla, Scedilla ] };
- key <AC05> { [ g, G, gbreve, Gbreve ] };
- key <AC07> { [ j, J, 0x01000131, 0x01000130 ] };
- key <AB03> { [ c, C, ccedilla, Ccedilla ] };
-
- include "level3(ralt_switch)"
-
-};
-
-// Komi language layout
-// based on
-// russian standard keyboard
-// Vlad Shakhov <lumpen.intellectual@gmail.com>
-// Last Changes 2007/10/23 by Vlad Shakhov <lumpen.intellectual@gmail.com>
-
-partial alphanumeric_keys
-xkb_symbols "kom" {
-
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Komi";
-
- key.type[group1]="FOUR_LEVEL_ALPHABETIC";
-
-// cyrilllic o with diaeresis
- key <AC07> { [ Cyrillic_o, Cyrillic_O,
- U04E7, U04E6 ] };
-
-// hard I as additional key for soft Cyrillic_I
- key <AB05> { [ Cyrillic_i, Cyrillic_I,
- Ukrainian_i, Ukrainian_I ] };
-
- include "level3(ralt_switch)"
-};
-
-// Yakut language layout
-// 2008/04/23 Yakov Aleksandrov <bertjickty@yandex.ru>
-// 2008/04/23 Anatoliy Zhozhikov <jav@sitc.ru>
-// 2008/04/23 Aleksandr Varlamov
-partial alphanumeric_keys
-xkb_symbols "sah" {
-
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Yakut";
-
- key.type[group1]="FOUR_LEVEL_ALPHABETIC";
-
- key <TLDE> { [ Cyrillic_io, Cyrillic_IO,
- U04EB, U04EA ] };
- key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI,
- U048B, U048A ] };
- key <AD03> { [ Cyrillic_u, Cyrillic_U,
- Cyrillic_u_straight, Cyrillic_U_straight ] };
- key <AD04> { [ Cyrillic_ka, Cyrillic_KA,
- U04C4, U04C3 ] };
- key <AD06> { [ Cyrillic_en, Cyrillic_EN,
- U04A5, U04A4 ] };
- key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE,
- U0495, U0494 ] };
- key <AD10> { [ Cyrillic_ze, Cyrillic_ZE,
- U04E1, U04E0 ] };
- key <AD11> { [ Cyrillic_ha, Cyrillic_HA,
- Cyrillic_shha, Cyrillic_SHHA ] };
- key <AC07> { [ Cyrillic_o, Cyrillic_O,
- Cyrillic_o_bar, Cyrillic_O_bar ] };
- key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE,
- U0461, U0460 ] };
- key <AB02> { [ Cyrillic_che, Cyrillic_CHE,
- Cyrillic_u_macron, Cyrillic_U_macron ] };
- key <AB04> { [ Cyrillic_em, Cyrillic_EM,
- U04C8, U04C7 ] };
- key <AB05> { [ Cyrillic_i, Cyrillic_I,
- Cyrillic_i_macron, Cyrillic_I_macron ] };
-
- include "level3(ralt_switch)"
-};
-
-
-//Kalmyk language layout
-//based on the Kalmyk language layout: http://soft.oyrat.org/
-//Nikolay Korneev <halmg@oyrat.org>
-//Toli Miron <mirontoli@gmail.com>
-
-partial alphanumeric_keys
-xkb_symbols "xal" {
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Kalmyk";
-
- key.type[group1]="FOUR_LEVEL";
-
- key <AE01> { [ question, exclam, 1 ] };
- key <AE02> { [ numerosign, quotedbl, 2 ] };
- key <AE03> { [ Cyrillic_u_straight, Cyrillic_U_straight, 3 ] };
- key <AE04> { [ Cyrillic_schwa, Cyrillic_SCHWA, 4 ] };
- key <AE05> { [ asterisk, percent, 5 ] };
- key <AE06> { [ Cyrillic_en_descender, Cyrillic_EN_descender, 6 ] };
- key <AE07> { [ Cyrillic_o_bar, Cyrillic_O_bar, 7 ] };
- key <AE08> { [ Cyrillic_shha, Cyrillic_SHHA, 8 ] };
- key <AE09> { [ Cyrillic_zhe_descender, Cyrillic_ZHE_descender, 9 ] };
- key <AE10> { [ semicolon, colon, 0 ] };
-
- key <TLDE> { [ parenleft, parenright, Cyrillic_io, Cyrillic_IO ] };
-
- key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, dollar ] };
- key <AD03> { [ Cyrillic_u, Cyrillic_U, EuroSign ] };
- key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] };
- key <AD05> { [ Cyrillic_ie, Cyrillic_IE, trademark ] };
- key <AD11> { [ Cyrillic_ha, Cyrillic_HA, bracketleft ] };
- key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, bracketright ] };
- key <AC11> { [ Cyrillic_e, Cyrillic_E, apostrophe ] };
- key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] };
- key <AB08> { [ Cyrillic_be, Cyrillic_BE, less ] };
- key <AB09> { [ Cyrillic_yu, Cyrillic_YU, greater ] };
-
- include "level3(ralt_switch)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "dos" {
-
- include "ru(common)"
-
- name[Group1]= "Russia - DOS";
-
- key <TLDE> { [ parenright, parenleft ] };
- key <AE04> { [ 4, currency ] };
- key <AE09> { [ 9, question ] };
- key <AE10> { [ 0, percent ] };
-
- key <AB10> { [ Cyrillic_io, Cyrillic_IO ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "bak" {
- include "ru(winkeys)"
-
- name[Group1]= "Russia - Bashkirian";
- key.type[group1]="FOUR_LEVEL";
-
- key <TLDE> { [ 0x010004d9, 0x010004d8, Cyrillic_io, Cyrillic_IO ] };
- key <AE01> { [ exclam, quotedbl, 1, 1 ] };
- key <AE02> { [ 0x010004e9, 0x010004e8, 2, 2 ] };
- key <AE03> { [ 0x010004a1, 0x010004a0, 3, 3 ] };
- key <AE04> { [ 0x01000493, 0x01000492, 4, 4 ] };
- key <AE05> { [ 0x010004ab, 0x010004aa, 5, 5 ] };
- key <AE06> { [ colon, semicolon, 6, 6 ] };
- key <AE07> { [ 0x01000499, 0x01000498, 7, 7 ] };
- key <AE08> { [ 0x010004bb, 0x010004ba, 8, 8 ] };
- key <AE09> { [ question, parenleft, 9, 9 ] };
- key <AE10> { [ numerosign, parenright, 0, 0 ] };
- key <AE11> { [ minus, percent, minus, underscore ]};
- key <AE12> { [ 0x010004af, 0x010004ae, equal, plus ]};
- key <BKSL> { [ 0x010004a3, 0x010004a2, backslash, slash ]};
-
- include "level3(ralt_switch)"
-};
-
-// Serbian charecters added as third level symbols to Russian keyboard layout.
-
-partial alphanumeric_keys
-xkb_symbols "srp" {
- include "ru(common)"
- include "level3(ralt_switch)"
-
- name[Group1]= "Russia - Serbian";
-
- key <AE03> { [ 3, numerosign ] };
- key <AE04> { [ 4, semicolon ] };
- key <AE05> { [ 5, percent ] };
- key <AE06> { [ 6, colon ] };
- key <AE07> { [ 7, question ] };
- key <AE08> { [ 8, asterisk ] };
- key <AB10> { [ period, comma ] };
- key <BKSL> { [ backslash, slash ] };
- key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U458, U408 ] };
- key <AD06> { [ Cyrillic_en, Cyrillic_EN, U45A, U40A ] };
- key <AC08> { [ Cyrillic_el, Cyrillic_EL, U459, U409 ] };
- key <AC09> { [ Cyrillic_de, Cyrillic_DE, U45F, U40F ] };
- key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U452, U402 ] };
- key <AB02> { [ Cyrillic_che, Cyrillic_CHE, U45B, U40B ] };
-};
+// $XKeyboardConfig$ + +// based on +// russian standard keyboard +// AEN <aen@logic.ru> +// 2001/12/23 by Leon Kanter <leon@blackcatlinux.com> +// 2005/12/09 Valery Inozemtsev <shrek@altlinux.ru> +// +// $XFree86: xc/programs/xkbcomp/symbols/ru,v 1.3 2003/02/15 22:27:05 dawes Exp $ + +// Windows layout +partial default alphanumeric_keys +xkb_symbols "winkeys" { + include "ru(common)" + + name[Group1]= "Russia"; + + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + + key <AB10> { [ period, comma ] }; + key <BKSL> { [ backslash, slash ] }; +}; + +partial hidden alphanumeric_keys +xkb_symbols "common" { + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, quotedbl ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, asterisk ] }; + key <AE05> { [ 5, colon ] }; + key <AE06> { [ 6, comma ] }; + key <AE07> { [ 7, period ] }; + key <AE08> { [ 8, semicolon ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + key <BKSL> { [ backslash, bar ] }; + key <AB10> { [ slash, question ] }; + key <LSGT> { [ slash, bar ] }; + + key <TLDE> { [ Cyrillic_io, Cyrillic_IO ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AD08> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AC01> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <AC02> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC03> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A ] }; + key <AC05> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <AC06> { [ Cyrillic_er, Cyrillic_ER ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E ] }; + key <AB01> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I ] }; + key <AB06> { [ Cyrillic_te, Cyrillic_TE ] }; + key <AB07> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU ] }; + + key.type[group1]="TWO_LEVEL"; + + include "kpdl(comma)" +}; + +partial alphanumeric_keys +xkb_symbols "legacy" { + include "ru(common)" + + name[Group1]= "Russia - Legacy"; +}; + +partial alphanumeric_keys +xkb_symbols "olpc" { + + include "ru(common)" + + key <TLDE> { [ 0x01000451, 0x01000401, grave ] }; // Ñ‘, Ð + key <AE03> { [ 3, numbersign, 0x01002116 ] }; // â„– + key <AE04> { [ 4, dollar, semicolon ] }; + key <AE06> { [ 6, asciicircum, colon ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE09> { [ 9, parenleft, acute ] }; + key <AC12> { [ backslash, bar, slash ] }; + + include "group(olpc)" +}; + +partial alphanumeric_keys +xkb_symbols "typewriter" { + include "ru(common)" + name[Group1]= "Russia - Typewriter"; + key <TLDE> { [ bar, plus ] }; + key <AE01> { [ numerosign, 1 ] }; + key <AE02> { [ minus, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ quotedbl, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; + key <AE11> { [ exclam, equal ] }; + key <AE12> { [ semicolon, backslash ] }; + + key <BKSL> { [ parenright, parenleft ] }; + + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; +}; + +partial alphanumeric_keys +xkb_symbols "typewriter-legacy" { + include "ru(common)" + name[Group1]= "Russia - Typewriter, legacy"; + key <TLDE> { [ apostrophe, quotedbl ] }; + key <AE01> { [ exclam, 1 ] }; + key <AE02> { [ numerosign, 2 ] }; + key <AE03> { [ slash, 3 ] }; + key <AE04> { [ semicolon, 4 ] }; + key <AE05> { [ colon, 5 ] }; + key <AE06> { [ comma, 6 ] }; + key <AE07> { [ period, 7 ] }; + key <AE08> { [ underscore, 8 ] }; + key <AE09> { [ question, 9 ] }; + key <AE10> { [ percent, 0 ] }; + key <BKSL> { [ parenleft, parenright ] }; + + key <AD12> { [Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic" { + + name[Group1]= "Russia - Phonetic"; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, Cyrillic_io ] }; + key <AE04> { [ 4, Cyrillic_IO ] }; + key <AE05> { [ 5, Cyrillic_hardsign ] }; + key <AE06> { [ 6, Cyrillic_HARDSIGN ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + key <AB08> { [ comma, less ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + key <LSGT> { [ bar, brokenbar ] }; + + key <TLDE> { [ Cyrillic_yu, Cyrillic_YU ] }; + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <LatX> { [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AE12> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <BKSL> { [ Cyrillic_e, Cyrillic_E ] }; +}; + +partial alphanumeric_keys +xkb_symbols "phonetic_winkeys" { + + include "ru(phonetic)" + name[Group1]= "Russia - Phonetic Winkeys"; + + key <LatX> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatH> { [ Cyrillic_che, Cyrillic_CHE ] }; + key <AE12> { [ Cyrillic_softsign, Cyrillic_softsign ] }; + +}; + +partial alphanumeric_keys +xkb_symbols "tt" { + include "ru(winkeys)" + name[Group1]= "Russia - Tatar"; + + key.type[group1]="FOUR_LEVEL"; + + key <TLDE> { [ 0x010004bb, 0x010004ba, + Cyrillic_io, Cyrillic_IO ] }; + key <AD02> { [ 0x010004e9, 0x010004e8, + Cyrillic_tse, Cyrillic_TSE ] }; + key <AD09> { [ 0x010004d9, 0x010004d8, + Cyrillic_shcha, Cyrillic_SHCHA ] }; + key <AD12> { [ 0x010004af, 0x010004ae, + Cyrillic_hardsign,Cyrillic_HARDSIGN ] }; + key <AC10> { [ 0x010004a3, 0x010004a2, + Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AB07> { [ 0x01000497, 0x01000496, + Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + + include "level3(ralt_switch)" + +}; + +partial alphanumeric_keys +xkb_symbols "os_legacy" { + include "ru(common)" + + name[Group1]= "Russia - Ossetian, legacy"; + + key <TLDE> { [ Cyrillic_e, Cyrillic_E ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] }; + key <AC11> { [ 0x010004D5, 0x010004D4 ] }; +}; + +partial alphanumeric_keys +xkb_symbols "os_winkeys" { + include "ru(winkeys)" + + name[Group1]= "Russia - Ossetian, Winkeys"; + + key <TLDE> { [ Cyrillic_e, Cyrillic_E ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, Cyrillic_io, Cyrillic_IO ] }; + key <AC11> { [ 0x010004D5, 0x010004D4 ] }; +}; + +partial alphanumeric_keys +xkb_symbols "cv" { + include "ru(winkeys)" + + name[Group1]= "Russia - Chuvash"; + + key.type[group1]="FOUR_LEVEL"; + + key <AD03> { [ Cyrillic_u, Cyrillic_U, + 0x010004f3, 0x010004f2 ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, + 0x01000115, 0x01000114 ] }; + key <AC04> { [ Cyrillic_a, Cyrillic_A, + abreve, Abreve ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES, + ccedilla, Ccedilla ] }; + + include "level3(ralt_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "udm" { + include "ru(winkeys)" + + name[Group1]= "Russia - Udmurt"; + + key.type[group1]="FOUR_LEVEL"; + + key <AE01> { [ question, exclam, 1, 1 ] }; + key <AE02> { [ parenleft, quotedbl, 2, 2 ] }; + key <AE03> { [ parenright, numerosign, 3, 3 ] }; + key <AE04> { [ colon, semicolon, 4, 4 ] }; + key <AE05> { [ asterisk, percent, 5, 5 ] }; + key <AE06> { [ 0x010004dd, 0x010004dc, 6, 6 ] }; + key <AE07> { [ 0x010004e7, 0x010004e6, 7, 7 ] }; + key <AE08> { [ 0x010004f5, 0x010004f4, 8, 8 ] }; + key <AE09> { [ 0x010004e5, 0x010004e4, 9, 9 ] }; + key <AE10> { [ 0x010004df, 0x010004de, 0, 0 ] }; + + include "level3(ralt_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "cv_latin" { + include "us(alt-intl)" + + name[Group1]= "Russia - Chuvash Latin"; + + key.type[group1]="FOUR_LEVEL"; + + key <AD01> { [ q, Q, 0x01000161, 0x01000160 ] }; + key <AD02> { [ w, W, udiaeresis, Udiaeresis ] }; + key <AD03> { [ e, E, 0x01000115, 0x01000114 ] }; + key <AD07> { [ u, U, udiaeresis, Udiaeresis ] }; + key <AD08> { [ i, I, 0x0100012d, 0x0100012c ] }; + key <AD09> { [ o, O, odiaeresis, Odiaeresis ] }; + key <AC01> { [ a, A, abreve, Abreve ] }; + key <AC02> { [ s, S, scedilla, Scedilla ] }; + key <AC05> { [ g, G, gbreve, Gbreve ] }; + key <AC07> { [ j, J, 0x01000131, 0x01000130 ] }; + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + + include "level3(ralt_switch)" + +}; + +// Komi language layout +// based on +// russian standard keyboard +// Vlad Shakhov <lumpen.intellectual@gmail.com> +// Last Changes 2007/10/23 by Vlad Shakhov <lumpen.intellectual@gmail.com> + +partial alphanumeric_keys +xkb_symbols "kom" { + + include "ru(winkeys)" + + name[Group1]= "Russia - Komi"; + + key.type[group1]="FOUR_LEVEL_ALPHABETIC"; + +// cyrilllic o with diaeresis + key <AC07> { [ Cyrillic_o, Cyrillic_O, + U04E7, U04E6 ] }; + +// hard I as additional key for soft Cyrillic_I + key <AB05> { [ Cyrillic_i, Cyrillic_I, + Ukrainian_i, Ukrainian_I ] }; + + include "level3(ralt_switch)" +}; + +// Yakut language layout +// 2008/04/23 Yakov Aleksandrov <bertjickty@yandex.ru> +// 2008/04/23 Anatoliy Zhozhikov <jav@sitc.ru> +// 2008/04/23 Aleksandr Varlamov +partial alphanumeric_keys +xkb_symbols "sah" { + + include "ru(winkeys)" + + name[Group1]= "Russia - Yakut"; + + key.type[group1]="FOUR_LEVEL_ALPHABETIC"; + + key <TLDE> { [ Cyrillic_io, Cyrillic_IO, + U04EB, U04EA ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, + U048B, U048A ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, + Cyrillic_u_straight, Cyrillic_U_straight ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, + U04C4, U04C3 ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN, + U04A5, U04A4 ] }; + key <AD07> { [ Cyrillic_ghe, Cyrillic_GHE, + U0495, U0494 ] }; + key <AD10> { [ Cyrillic_ze, Cyrillic_ZE, + U04E1, U04E0 ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA, + Cyrillic_shha, Cyrillic_SHHA ] }; + key <AC07> { [ Cyrillic_o, Cyrillic_O, + Cyrillic_o_bar, Cyrillic_O_bar ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, + U0461, U0460 ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE, + Cyrillic_u_macron, Cyrillic_U_macron ] }; + key <AB04> { [ Cyrillic_em, Cyrillic_EM, + U04C8, U04C7 ] }; + key <AB05> { [ Cyrillic_i, Cyrillic_I, + Cyrillic_i_macron, Cyrillic_I_macron ] }; + + include "level3(ralt_switch)" +}; + + +//Kalmyk language layout +//based on the Kalmyk language layout: http://soft.oyrat.org/ +//Nikolay Korneev <halmg@oyrat.org> +//Toli Miron <mirontoli@gmail.com> + +partial alphanumeric_keys +xkb_symbols "xal" { + include "ru(winkeys)" + + name[Group1]= "Russia - Kalmyk"; + + key.type[group1]="FOUR_LEVEL"; + + key <AE01> { [ question, exclam, 1 ] }; + key <AE02> { [ numerosign, quotedbl, 2 ] }; + key <AE03> { [ Cyrillic_u_straight, Cyrillic_U_straight, 3 ] }; + key <AE04> { [ Cyrillic_schwa, Cyrillic_SCHWA, 4 ] }; + key <AE05> { [ asterisk, percent, 5 ] }; + key <AE06> { [ Cyrillic_en_descender, Cyrillic_EN_descender, 6 ] }; + key <AE07> { [ Cyrillic_o_bar, Cyrillic_O_bar, 7 ] }; + key <AE08> { [ Cyrillic_shha, Cyrillic_SHHA, 8 ] }; + key <AE09> { [ Cyrillic_zhe_descender, Cyrillic_ZHE_descender, 9 ] }; + key <AE10> { [ semicolon, colon, 0 ] }; + + key <TLDE> { [ parenleft, parenright, Cyrillic_io, Cyrillic_IO ] }; + + key <AD02> { [ Cyrillic_tse, Cyrillic_TSE, dollar ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, EuroSign ] }; + key <AD04> { [ Cyrillic_ka, Cyrillic_KA, registered ] }; + key <AD05> { [ Cyrillic_ie, Cyrillic_IE, trademark ] }; + key <AD11> { [ Cyrillic_ha, Cyrillic_HA, bracketleft ] }; + key <AD12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, bracketright ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E, apostrophe ] }; + key <AB03> { [ Cyrillic_es, Cyrillic_ES, copyright ] }; + key <AB08> { [ Cyrillic_be, Cyrillic_BE, less ] }; + key <AB09> { [ Cyrillic_yu, Cyrillic_YU, greater ] }; + + include "level3(ralt_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "dos" { + + include "ru(common)" + + name[Group1]= "Russia - DOS"; + + key <TLDE> { [ parenright, parenleft ] }; + key <AE04> { [ 4, currency ] }; + key <AE09> { [ 9, question ] }; + key <AE10> { [ 0, percent ] }; + + key <AB10> { [ Cyrillic_io, Cyrillic_IO ] }; +}; + +partial alphanumeric_keys +xkb_symbols "bak" { + include "ru(winkeys)" + + name[Group1]= "Russia - Bashkirian"; + key.type[group1]="FOUR_LEVEL"; + + key <TLDE> { [ 0x010004d9, 0x010004d8, Cyrillic_io, Cyrillic_IO ] }; + key <AE01> { [ exclam, quotedbl, 1, 1 ] }; + key <AE02> { [ 0x010004e9, 0x010004e8, 2, 2 ] }; + key <AE03> { [ 0x010004a1, 0x010004a0, 3, 3 ] }; + key <AE04> { [ 0x01000493, 0x01000492, 4, 4 ] }; + key <AE05> { [ 0x010004ab, 0x010004aa, 5, 5 ] }; + key <AE06> { [ colon, semicolon, 6, 6 ] }; + key <AE07> { [ 0x01000499, 0x01000498, 7, 7 ] }; + key <AE08> { [ 0x010004bb, 0x010004ba, 8, 8 ] }; + key <AE09> { [ question, parenleft, 9, 9 ] }; + key <AE10> { [ numerosign, parenright, 0, 0 ] }; + key <AE11> { [ minus, percent, minus, underscore ]}; + key <AE12> { [ 0x010004af, 0x010004ae, equal, plus ]}; + key <BKSL> { [ 0x010004a3, 0x010004a2, backslash, slash ]}; + + include "level3(ralt_switch)" +}; + +// Serbian charecters added as third level symbols to Russian keyboard layout. + +partial alphanumeric_keys +xkb_symbols "srp" { + include "ru(common)" + include "level3(ralt_switch)" + + name[Group1]= "Russia - Serbian"; + + key <AE03> { [ 3, numerosign ] }; + key <AE04> { [ 4, semicolon ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, colon ] }; + key <AE07> { [ 7, question ] }; + key <AE08> { [ 8, asterisk ] }; + key <AB10> { [ period, comma ] }; + key <BKSL> { [ backslash, slash ] }; + key <AD01> { [ Cyrillic_shorti, Cyrillic_SHORTI, U458, U408 ] }; + key <AD06> { [ Cyrillic_en, Cyrillic_EN, U45A, U40A ] }; + key <AC08> { [ Cyrillic_el, Cyrillic_EL, U459, U409 ] }; + key <AC09> { [ Cyrillic_de, Cyrillic_DE, U45F, U40F ] }; + key <AC10> { [ Cyrillic_zhe, Cyrillic_ZHE, U452, U402 ] }; + key <AB02> { [ Cyrillic_che, Cyrillic_CHE, U45B, U40B ] }; +}; + +// Mari language layout +// based on Russian standard keyboard +// http://www.marlamuter.ru/ +partial alphanumeric_keys +xkb_symbols "chm" { + include "ru(common)" + + name[Group1]= "Russia - Mari"; + + key.type[group1]="FOUR_LEVEL_ALPHABETIC"; + key <AC04> { [ Cyrillic_a, Cyrillic_A, U04D3, U04D2 ] }; + key <AD03> { [ Cyrillic_u, Cyrillic_U, U04F1, U04F0 ] }; + key <AC02> { [ Cyrillic_ui, Cyrillic_UI, U04F9, U04F8 ] }; + key <AD06> { [ Cyrillic_n, Cyrillic_N, U04A5, U04A4 ] }; + key <AC11> { [ Cyrillic_e, Cyrillic_E, U04E9, U04E8 ] }; + key <AC10> { [ Cyrillic_zh, Cyrillic_ZH, U04EB, U04EA ] }; + key <AC01> { [ Cyrillic_f, Cyrillic_F, UF537, UF536 ] }; + + include "level3(ralt_switch)" +}; diff --git a/xorg-server/xkeyboard-config/symbols/us b/xorg-server/xkeyboard-config/symbols/us index 2d9523922..092fb747d 100644 --- a/xorg-server/xkeyboard-config/symbols/us +++ b/xorg-server/xkeyboard-config/symbols/us @@ -1,1194 +1,1196 @@ -// $XKeyboardConfig$
-
-//
-// $XdotOrg: xc/programs/xkbcomp/symbols/us,v 1.1.4.3 2004/03/05 13:41:33 eich Exp $
-// $XFree86: xc/programs/xkbcomp/symbols/us,v 1.6 2003/10/31 14:32:05 pascal Exp $
-
-default
-partial alphanumeric_keys modifier_keys
-xkb_symbols "basic" {
-
- name[Group1]= "USA";
-
- // Alphanumeric section
- key <TLDE> { [ grave, asciitilde ] };
- key <AE01> { [ 1, exclam ] };
- key <AE02> { [ 2, at ] };
- key <AE03> { [ 3, numbersign ] };
- key <AE04> { [ 4, dollar ] };
- key <AE05> { [ 5, percent ] };
- key <AE06> { [ 6, asciicircum ] };
- key <AE07> { [ 7, ampersand ] };
- key <AE08> { [ 8, asterisk ] };
- key <AE09> { [ 9, parenleft ] };
- key <AE10> { [ 0, parenright ] };
- key <AE11> { [ minus, underscore ] };
- key <AE12> { [ equal, plus ] };
-
- key <AD01> { [ q, Q ] };
- key <AD02> { [ w, W ] };
- key <AD03> { [ e, E ] };
- key <AD04> { [ r, R ] };
- key <AD05> { [ t, T ] };
- key <AD06> { [ y, Y ] };
- key <AD07> { [ u, U ] };
- key <AD08> { [ i, I ] };
- key <AD09> { [ o, O ] };
- key <AD10> { [ p, P ] };
- key <AD11> { [ bracketleft, braceleft ] };
- key <AD12> { [ bracketright, braceright ] };
-
- key <AC01> { [ a, A ] };
- key <AC02> { [ s, S ] };
- key <AC03> { [ d, D ] };
- key <AC04> { [ f, F ] };
- key <AC05> { [ g, G ] };
- key <AC06> { [ h, H ] };
- key <AC07> { [ j, J ] };
- key <AC08> { [ k, K ] };
- key <AC09> { [ l, L ] };
- key <AC10> { [ semicolon, colon ] };
- key <AC11> { [ apostrophe, quotedbl ] };
-
- key <AB01> { [ z, Z ] };
- key <AB02> { [ x, X ] };
- key <AB03> { [ c, C ] };
- key <AB04> { [ v, V ] };
- key <AB05> { [ b, B ] };
- key <AB06> { [ n, N ] };
- key <AB07> { [ m, M ] };
- key <AB08> { [ comma, less ] };
- key <AB09> { [ period, greater ] };
- key <AB10> { [ slash, question ] };
-
- key <BKSL> { [ backslash, bar ] };
- // End alphanumeric section
-};
-
-partial alphanumeric_keys
-xkb_symbols "euro" {
-
- name[Group1]= "USA - With EuroSign on 5";
-
- include "us(basic)"
-
- include "eurosign(5)"
-
- include "level3(ralt_switch)"
-};
-
-
-partial alphanumeric_keys
-xkb_symbols "intl" {
-
- name[Group1]= "USA - International (with dead keys)";
-
- include "us(basic)"
-
- // Alphanumeric section
- key <TLDE> { [dead_grave, dead_tilde, grave, asciitilde ] };
- key <AE01> { [ 1, exclam, exclamdown, onesuperior ] };
- key <AE02> { [ 2, at, twosuperior, dead_doubleacute ] };
- key <AE03> { [ 3, numbersign, threesuperior, dead_macron ] };
- key <AE04> { [ 4, dollar, currency, sterling ] };
- key <AE05> { [ 5, percent, EuroSign, dead_cedilla ] };
- key <AE06> { [ 6, dead_circumflex, onequarter, asciicircum ] };
- key <AE07> { [ 7, ampersand, onehalf, dead_horn ] };
- key <AE08> { [ 8, asterisk, threequarters, dead_ogonek ] };
- key <AE09> { [ 9, parenleft, leftsinglequotemark, dead_breve ] };
- key <AE10> { [ 0, parenright, rightsinglequotemark, dead_abovering ] };
- key <AE11> { [ minus, underscore, yen, dead_belowdot ] };
- key <AE12> { [ equal, plus, multiply, division ] };
-
- key <AD01> { [ q, Q, adiaeresis, Adiaeresis ] };
- key <AD02> { [ w, W, aring, Aring ] };
- key <AD03> { [ e, E, eacute, Eacute ] };
- key <AD04> { [ r, R, registered, registered ] };
- key <AD05> { [ t, T, thorn, THORN ] };
- key <AD06> { [ y, Y, udiaeresis, Udiaeresis ] };
- key <AD07> { [ u, U, uacute, Uacute ] };
- key <AD08> { [ i, I, iacute, Iacute ] };
- key <AD09> { [ o, O, oacute, Oacute ] };
- key <AD10> { [ p, P, odiaeresis, Odiaeresis ] };
- key <AD11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] };
- key <AD12> { [bracketright, braceright, guillemotright, rightdoublequotemark ] };
-
- key <AC01> { [ a, A, aacute, Aacute ] };
- key <AC02> { [ s, S, ssharp, section ] };
- key <AC03> { [ d, D, eth, ETH ] };
- key <AC04> { [ f, F, f, F ] };
- key <AC05> { [ g, G, g, G ] };
- key <AC06> { [ h, H, h, H ] };
- key <AC07> { [ j, J, j, J ] };
- key <AC08> { [ k, K, oe, OE ] };
-
- key <AC09> { [ l, L, oslash, Ooblique ] };
- key <AC10> { [ semicolon, colon, paragraph, degree ] };
- key <AC11> { [dead_acute, dead_diaeresis, apostrophe, quotedbl ] };
-
- key <AB01> { [ z, Z, ae, AE ] };
- key <AB02> { [ x, X, x, X ] };
- key <AB03> { [ c, C, copyright, cent ] };
- key <AB04> { [ v, V, v, V ] };
- key <AB05> { [ b, B, b, B ] };
- key <AB06> { [ n, N, ntilde, Ntilde ] };
- key <AB07> { [ m, M, mu, mu ] };
- key <AB08> { [ comma, less, ccedilla, Ccedilla ] };
- key <AB09> { [ period, greater, dead_abovedot, dead_caron ] };
- key <AB10> { [ slash, question, questiondown, dead_hook ] };
- key <BKSL> { [ backslash, bar, notsign, brokenbar ] };
-
- include "level3(ralt_switch)"
-};
-
-// Based on symbols/us_intl keyboard map:
-// Dead-keys definition for a very simple US/ASCII layout.
-// by Conectiva (http://www.conectiva.com.br)
-// modified by Ricardo Y. Igarashi (iga@that.com.br)
-
-// Added the following deadkeys, to make it truly international:
-//
-// dead_macron: on AltGr-minus
-// dead_breve: on AltGr-parenleft
-// dead_abovedot: on AltGr-period
-// dead_abovering: on AltGr-0
-// dead_doubleacute: on AltGr-equal (as quotedbl is already used)
-// dead_caron: on AltGr-less (AltGr-shift-comma)
-// dead_cedilla: on AltGr-comma
-// dead_ogonek: on AltGr-semicolon
-// dead_belowdot: on AltGr-underscore (AltGr-shift-minus)
-// dead_hook: on AltGr-question
-// dead_horn: on AltGr-plus (AltGr-shift-equal)
-// dead_diaeresis: on AltGr-colon (Alt-shift-semicolon)
-//
-// those were already there:
-// dead_grave
-// dead_acute
-// dead_circumflex
-// dead_tilde
-// dead_diaeresis
-
-partial alphanumeric_keys
-xkb_symbols "alt-intl" {
-
- name[Group1]= "USA - Alternative international";
-
- include "us"
-
- key <TLDE> { [ dead_grave, dead_tilde, grave, asciitilde ] };
- key <AE05> { [ 5, percent, EuroSign ] };
- key <AE06> { [ 6, dead_circumflex, asciicircum, asciicircum ] };
- key <AE09> { [ 9, parenleft, leftsinglequotemark, dead_breve ] };
- key <AE10> { [ 0, parenright, rightsinglequotemark, dead_abovering ] };
- key <AE11> { [ minus, underscore, dead_macron, dead_belowdot ] };
- key <AE12> { [ equal, plus, dead_doubleacute, dead_horn ] };
-
- key <AD03> { [ e, E, EuroSign, cent ] };
-
- key <AC10> { [ semicolon, colon, dead_ogonek, dead_diaeresis ] };
- key <AC11> { [ dead_acute, dead_diaeresis, apostrophe, quotedbl ] };
-
- key <AB08> { [ comma, less, dead_cedilla, dead_caron ] };
- key <AB09> { [ period, greater, dead_abovedot, dead_circumflex ] };
- key <AB10> { [ slash, question, dead_hook, dead_hook ] };
-
- include "level3(ralt_switch)"
-};
-
-// based on a keyboard map from an 'xkb/symbols/dk' file
-//
-// $XFree86: xc/programs/xkbcomp/symbols/dvorak,v 1.5 2004/01/03 16:35:07 herrb Exp $
-
-partial alphanumeric_keys
-xkb_symbols "dvorak" {
-
- name[Group1]= "USA - Dvorak";
-
- // Alphanumeric section
-
- key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
-
- key <AE01> { [ 1, exclam ] };
- key <AE02> { [ 2, at ] };
- key <AE03> { [ 3, numbersign ] };
- key <AE04> { [ 4, dollar ] };
- key <AE05> { [ 5, percent ] };
- key <AE06> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] };
- key <AE07> { [ 7, ampersand ] };
- key <AE08> { [ 8, asterisk ] };
- key <AE09> { [ 9, parenleft, dead_grave] };
- key <AE10> { [ 0, parenright ] };
- key <AE11> { [ bracketleft, braceleft ] };
- key <AE12> { [ bracketright, braceright, dead_tilde] };
-
- key <AD01> { [ apostrophe, quotedbl, dead_acute, dead_diaeresis ] };
- key <AD02> { [ comma, less, dead_cedilla, dead_caron ] };
- key <AD03> { [ period, greater, dead_abovedot, periodcentered ] };
- key <AD04> { [ p, P ] };
- key <AD05> { [ y, Y ] };
- key <AD06> { [ f, F ] };
- key <AD07> { [ g, G ] };
- key <AD08> { [ c, C ] };
- key <AD09> { [ r, R ] };
- key <AD10> { [ l, L ] };
- key <AD11> { [ slash, question ] };
- key <AD12> { [ equal, plus ] };
-
- key <AC01> { [ a, A ] };
- key <AC02> { [ o, O ] };
- key <AC03> { [ e, E ] };
- key <AC04> { [ u, U ] };
- key <AC05> { [ i, I ] };
- key <AC06> { [ d, D ] };
- key <AC07> { [ h, H ] };
- key <AC08> { [ t, T ] };
- key <AC09> { [ n, N ] };
- key <AC10> { [ s, S ] };
- key <AC11> { [ minus, underscore ] };
-
- key <AB01> { [ semicolon, colon, dead_ogonek, dead_doubleacute ] };
- key <AB02> { [ q, Q ] };
- key <AB03> { [ j, J ] };
- key <AB04> { [ k, K ] };
- key <AB05> { [ x, X ] };
- key <AB06> { [ b, B ] };
- key <AB07> { [ m, M ] };
- key <AB08> { [ w, W ] };
- key <AB09> { [ v, V ] };
- key <AB10> { [ z, Z ] };
-
- key <BKSL> { [ backslash, bar ] };
-};
-
-// Dvorak international with dead keys
-// Olivier Mehani (shtrom-xorg@ssji.net)
-// Reproduce the per-key mapping of us(intl) for the dvorak layout
-// aka "I just swapped my keys over"
-partial alphanumeric_keys
-xkb_symbols "dvorak-intl" {
-
- name[Group1]= "USA - Dvorak international (with dead keys)";
-
- include "us(dvorak)"
-
- key <TLDE> { [dead_grave, dead_tilde, grave, asciitilde ] };
-
- key <AE01> { [ 1, exclam, exclamdown, onesuperior ] };
- key <AE02> { [ 2, at, twosuperior, dead_doubleacute ] };
- key <AE03> { [ 3, numbersign, threesuperior, dead_macron ] };
- key <AE04> { [ 4, dollar, currency, sterling ] };
- key <AE05> { [ 5, percent, EuroSign, dead_cedilla ] };
- key <AE06> { [ 6, dead_circumflex, onequarter, asciicircum ] };
- key <AE07> { [ 7, ampersand, onehalf, dead_horn ] };
- key <AE08> { [ 8, asterisk, threequarters, dead_ogonek ] };
- key <AE09> { [ 9, parenleft, leftsinglequotemark, dead_breve ] };
- key <AE10> { [ 0, parenright, rightsinglequotemark, dead_abovering ] };
- key <AE11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] };
- key <AE12> { [bracketright, braceright, guillemotright, rightdoublequotemark ] };
-
- key <AD01> { [dead_acute, dead_diaeresis, apostrophe, quotedbl ] };
- key <AD02> { [ comma, less, ccedilla, Ccedilla ] };
- key <AD03> { [ period, greater, dead_abovedot, dead_caron ] };
- key <AD04> { [ p, P, odiaeresis, Odiaeresis ] };
- key <AD05> { [ y, Y, udiaeresis, Udiaeresis ] };
- // key <AD06> { [ f, F ] };
- // key <AD07> { [ g, G ] };
- key <AD08> { [ c, C, copyright, cent ] };
- key <AD09> { [ r, R, registered, registered ] };
- key <AD10> { [ l, L, oslash, Ooblique ] };
- key <AD11> { [ slash, question, questiondown, dead_hook ] };
- // key <AD12> { [ equal, plus, multiply, division ] };
-
- key <AC01> { [ a, A, aacute, Aacute ] };
- key <AC02> { [ o, O, oacute, Oacute ] };
- key <AC03> { [ e, E, eacute, Eacute ] };
- key <AC04> { [ u, U, uacute, Uacute ] };
- key <AC05> { [ i, I, iacute, Iacute ] };
- key <AC06> { [ d, D, eth, ETH ] };
- // key <AC07> { [ h, H ] };
- key <AC08> { [ t, T, thorn, THORN ] };
- key <AC09> { [ n, N, ntilde, Ntilde ] };
- key <AC10> { [ s, S, ssharp, section ] };
- // key <AC11> { [ minus, underscore, yen, dead_belowdot ] };
-
- key <AB01> { [ semicolon, colon, paragraph, degree ] };
- key <AB02> { [ q, Q, adiaeresis, Adiaeresis ] };
- // key <AB03> { [ j, J ] };
- key <AB04> { [ k, K, oe, OE ] };
- // key <AB05> { [ x, X ] };
- // key <AB06> { [ b, B ] };
- key <AB07> { [ m, M, mu, mu ] };
- key <AB08> { [ w, W, aring, Aring ] };
- // key <AB09> { [ v, V ] };
- key <AB10> { [ z, Z, ae, AE ] };
-
- key <BKSL> { [ backslash, bar, notsign, brokenbar ] };
-
- include "level3(ralt_switch)"
-};
-
-// Dvorak international without dead keys
-// Stephane Magnenat (stephane at magnenat dot net, http://stephane.magnenat.net)
-// Based on information from http://www.poupinou.org/dvorak/index.html
-//
-// ` 1 2 3 4 5 6 7 8 9 0 [ ] \
-// €
-//
-// ' , . p y f g c r l / =
-// ä ê ë ü ç
-//
-// a o e u i d h t n s -
-// à ô é û î ß
-//
-// ; q j k x b m w v z
-// â ö è ù ï
-
-partial alphanumeric_keys
-xkb_symbols "dvorak-alt-intl" {
-
- name[Group1]= "USA - Dvorak alternative international (no dead keys)";
-
- include "us(dvorak)"
-
- key <AE04> { [ 4, dollar, EuroSign ] };
-
- key <AD02> { [ comma, less, adiaeresis, dead_caron ] };
- key <AD03> { [ period, greater, ecircumflex, periodcentered ] };
- key <AD04> { [ p, P, ediaeresis, dead_cedilla ] };
- key <AD05> { [ y, Y, udiaeresis ] };
- key <AD08> { [ c, C, ccedilla, dead_abovedot ] };
-
- key <AC01> { [ a, A, agrave ] };
- key <AC02> { [ o, O, ocircumflex ] };
- key <AC03> { [ e, E, eacute ] };
- key <AC04> { [ u, U, ucircumflex ] };
- key <AC05> { [ i, I, icircumflex ] };
- key <AC10> { [ s, S, ssharp ] };
-
- key <AB01> { [ semicolon, colon, acircumflex ] };
- key <AB02> { [ q, Q, odiaeresis, dead_ogonek ] };
- key <AB03> { [ j, J, egrave, dead_doubleacute ] };
- key <AB04> { [ k, K, ugrave ] };
- key <AB05> { [ x, X, idiaeresis ] };
-
- include "level3(ralt_switch)"
-};
-
-// Left and right handed dvorak layouts
-// by sqweek <sqweek@gmail.com> 2006-01-30
-// Based on the corresponding layouts in the console-tools package.
-partial alphanumeric_keys
-xkb_symbols "dvorak-l" {
-
- include "us(dvorak)"
- name[Group1]= "USA - Left handed Dvorak";
-
- key <AE01> { [ bracketleft, braceleft ] };
- key <AE02> { [ bracketright, braceright ] };
- key <AE03> { [ slash, question ] };
- key <AE04> { [ p, P ] };
- key <AE05> { [ f, F ] };
- key <AE06> { [ m, M ] };
- key <AE07> { [ l, L ] };
- key <AE08> { [ j, J ] };
- key <AE09> { [ 4, dollar ] };
- key <AE10> { [ 3, numbersign ] };
- key <AE11> { [ 2, at ] };
- key <AE12> { [ 1, exclam ] };
-
- key <AD01> { [ semicolon, colon ] };
- key <AD02> { [ q, Q ] };
- key <AD03> { [ b, B ] };
- key <AD04> { [ y, Y ] };
- key <AD05> { [ u, U ] };
- key <AD06> { [ r, R ] };
- key <AD07> { [ s, S ] };
- key <AD08> { [ o, O ] };
- key <AD09> { [ period, greater ] };
- key <AD10> { [ 6, asciicircum ] };
- key <AD11> { [ 5, percent ] };
- key <AD12> { [ equal, plus ] };
-
- key <AC01> { [ minus, underscore ] };
- key <AC02> { [ k, K ] };
- key <AC03> { [ c, C ] };
- key <AC04> { [ d, D ] };
- key <AC05> { [ t, T ] };
- key <AC06> { [ h, H ] };
- key <AC07> { [ e, E ] };
- key <AC08> { [ a, A ] };
- key <AC09> { [ z, Z ] };
- key <AC10> { [ 8, asterisk ] };
- key <AC11> { [ 7, ampersand ] };
-
- key <AB01> { [ apostrophe, quotedbl ] };
- key <AB02> { [ x, X ] };
- key <AB03> { [ g, G ] };
- key <AB04> { [ v, V ] };
- key <AB05> { [ w, W ] };
- key <AB06> { [ n, N ] };
- key <AB07> { [ i, I ] };
- key <AB08> { [ comma, less ] };
- key <AB09> { [ 0, parenright ] };
- key <AB10> { [ 9, parenleft ] };
-};
-
-partial alphanumeric_keys
-xkb_symbols "dvorak-r" {
-
- include "us(dvorak)"
- name[Group1]= "USA - Right handed Dvorak";
-
- key <AE01> { [ 1, exclam ] };
- key <AE02> { [ 2, at ] };
- key <AE03> { [ 3, numbersign ] };
- key <AE04> { [ 4, dollar ] };
- key <AE05> { [ j, J ] };
- key <AE06> { [ l, L ] };
- key <AE07> { [ m, M ] };
- key <AE08> { [ f, F ] };
- key <AE09> { [ p, P ] };
- key <AE10> { [ slash, question ] };
- key <AE11> { [ bracketleft, braceleft ] };
- key <AE12> { [ bracketright, braceright ] };
-
- key <AD01> { [ 5, percent ] };
- key <AD02> { [ 6, asciicircum ] };
- key <AD03> { [ q, Q ] };
- key <AD04> { [ period, greater ] };
- key <AD05> { [ o, O ] };
- key <AD06> { [ r, R ] };
- key <AD07> { [ s, S ] };
- key <AD08> { [ u, U ] };
- key <AD09> { [ y, Y ] };
- key <AD10> { [ b, B ] };
- key <AD11> { [ semicolon, colon ] };
- key <AD12> { [ equal, plus ] };
-
- key <AC01> { [ 7, ampersand ] };
- key <AC02> { [ 8, asterisk ] };
- key <AC03> { [ z, Z ] };
- key <AC04> { [ a, A ] };
- key <AC05> { [ e, E ] };
- key <AC06> { [ h, H ] };
- key <AC07> { [ t, T ] };
- key <AC08> { [ d, D ] };
- key <AC09> { [ c, C ] };
- key <AC10> { [ k, K ] };
- key <AC11> { [ minus, underscore ] };
-
- key <AB01> { [ 9, parenleft ] };
- key <AB02> { [ 0, parenright ] };
- key <AB03> { [ x, X ] };
- key <AB04> { [ comma, less ] };
- key <AB05> { [ i, I ] };
- key <AB06> { [ n, N ] };
- key <AB07> { [ w, W ] };
- key <AB08> { [ v, V ] };
- key <AB09> { [ g, G ] };
- key <AB10> { [ apostrophe, quotedbl ] };
-};
-
-// Classic dvorak layout
-// by Piter Punk <piterpk@terra.com.br> - 2006-07-06
-// Based on dvorak layout and e-mail from Russel L. Harris rlharris@oplink.net
-// on xorg list.
-partial alphanumeric_keys
-xkb_symbols "dvorak-classic" {
-
- name[Group1]= "USA - Classic Dvorak";
-
- // Alphanumeric section
-
- key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
-
- key <AE01> { [ bracketleft, braceleft ] };
- key <AE02> { [ 7, ampersand ] };
- key <AE03> { [ 5, percent ] };
- key <AE04> { [ 3, numbersign ] };
- key <AE05> { [ 1, exclam ] };
- key <AE06> { [ 9, parenleft, dead_grave] };
- key <AE07> { [ 0, parenright ] };
- key <AE08> { [ 2, at ] };
- key <AE09> { [ 4, dollar ] };
- key <AE10> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] };
- key <AE11> { [ 8, asterisk ] };
- key <AE12> { [ bracketright, braceright, dead_tilde] };
-
- key <AD01> { [ slash, question ] };
- key <AD02> { [ comma, less, dead_cedilla, dead_caron ] };
- key <AD03> { [ period, greater, dead_abovedot, periodcentered ] };
- key <AD04> { [ p, P ] };
- key <AD05> { [ y, Y ] };
- key <AD06> { [ f, F ] };
- key <AD07> { [ g, G ] };
- key <AD08> { [ c, C ] };
- key <AD09> { [ r, R ] };
- key <AD10> { [ l, L ] };
- key <AD11> { [ apostrophe, quotedbl, dead_acute, dead_diaeresis ] };
- key <AD12> { [ equal, plus ] };
-
- key <AC01> { [ a, A ] };
- key <AC02> { [ o, O ] };
- key <AC03> { [ e, E ] };
- key <AC04> { [ u, U ] };
- key <AC05> { [ i, I ] };
- key <AC06> { [ d, D ] };
- key <AC07> { [ h, H ] };
- key <AC08> { [ t, T ] };
- key <AC09> { [ n, N ] };
- key <AC10> { [ s, S ] };
- key <AC11> { [ minus, underscore ] };
-
- key <AB01> { [ semicolon, colon, dead_ogonek, dead_doubleacute ] };
- key <AB02> { [ q, Q ] };
- key <AB03> { [ j, J ] };
- key <AB04> { [ k, K ] };
- key <AB05> { [ x, X ] };
- key <AB06> { [ b, B ] };
- key <AB07> { [ m, M ] };
- key <AB08> { [ w, W ] };
- key <AB09> { [ v, V ] };
- key <AB10> { [ z, Z ] };
- key <BKSL> { [ backslash, bar ] };
-};
-
-// Programmer Dvorak, by Roland Kaufmann <rlndkfmn at gmail dot com>
-// License: BSD, available at <http://www.kaufmann.no/roland/dvorak/license.html>
-// Main features: Numbers are in shift position (like French), symbols have been
-// placed in locations that give good hand-alternation and finger rolling with
-// symbols that usually follows, accented characters are possible for I18N.
-partial alphanumeric_keys
-xkb_symbols "dvp" {
- include "us(dvorak)"
-
- name[Group1] = "USA - Programmer Dvorak";
-
- // Unmodified Shift AltGr Shift+AltGr
- // symbols row, left side
- key <TLDE> { [ dollar, asciitilde, dead_tilde ] };
- key <AE01> { [ ampersand, percent ] };
- key <AE02> { [ bracketleft, 7, currency ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE03> { [ braceleft, 5, cent ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE04> { [ braceright, 3, yen ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE05> { [ parenleft, 1, EuroSign ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE06> { [ equal, 9, sterling ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
-
- // symbols row, right side
- key <AE07> { [ asterisk, 0 ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE08> { [ parenright, 2, onehalf ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE09> { [ plus, 4 ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE10> { [ bracketright, 6 ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE11> { [ exclam, 8, exclamdown ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <AE12> { [ numbersign, grave, dead_grave ] };
- key <BKSP> { [ BackSpace ] };
-
- // upper row, left side
- key <AD01> { [ semicolon, colon, dead_diaeresis ] };
- key <AD02> { [ comma, less, guillemotleft ] };
- key <AD03> { [ period, greater, guillemotright ] };
- key <AD04> { [ p, P, paragraph, section ] };
- key <AD05> { [ y, Y, udiaeresis, Udiaeresis ] };
-
- // upper row, right side
- key <AD08> { [ c, C, ccedilla, Ccedilla ] };
- key <AD09> { [ r, R, registered, trademark ] };
- key <AD11> { [ slash, question, questiondown ] };
- key <AD12> { [ at, asciicircum, dead_circumflex, dead_caron ] };
-
- // home row, left side
- key <AC01> { [ a, A, aring, Aring ] };
- key <AC02> { [ o, O, oslash, Ooblique ] };
- key <AC03> { [ e, E, ae, AE ] };
- key <AC04> { [ u, U, eacute, Eacute ] };
-
- // home row, right side
- key <AC06> { [ d, D, eth, ETH ] };
- key <AC07> { [ h, H, dead_acute ] };
- key <AC08> { [ t, T, thorn, THORN ] };
- key <AC09> { [ n, N, ntilde, Ntilde ] };
- key <AC10> { [ s, S, ssharp ] };
- key <AC11> { [ minus, underscore, hyphen ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" };
- key <BKSL> { [ backslash, bar ] };
-
- // lower row, left side
- key <AB01> { [ apostrophe, quotedbl, dead_acute ] };
-};
-
-// phonetic layout for Russian letters on an US keyboard
-// by Ivan Popov <pin@konvalo.org> 2005-07-17
-
-// level3 modifier is a shortcut to the "us" meaning of the keys where
-// we place cyrillic letters, handy for accessing the corresponding
-// punctuation marks.
-// It is important to have access to punctuation marks, and the rest of
-// alphabetical keys are added for being consequent so that the users
-// can expect the level3 modifier to give what the key label shows.
-
-partial alphanumeric_keys
-xkb_symbols "rus" {
-
- name[Group1]= "USA - Russian phonetic";
-
- include "us(basic)"
-
-key.type[group1]="FOUR_LEVEL_ALPHABETIC";
-
- key <LatA> { [ Cyrillic_a, Cyrillic_A ] };
- key <LatB> { [ Cyrillic_be, Cyrillic_BE ] };
- key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] };
- key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] };
- key <LatD> { [ Cyrillic_de, Cyrillic_DE ] };
- key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] };
- key <TLDE> { [ Cyrillic_io, Cyrillic_IO, grave, asciitilde ] };
- key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] };
- key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] };
- key <LatI> { [ Cyrillic_i, Cyrillic_I ] };
- key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] };
- key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] };
- key <LatL> { [ Cyrillic_el, Cyrillic_EL ] };
- key <LatM> { [ Cyrillic_em, Cyrillic_EM ] };
- key <LatN> { [ Cyrillic_en, Cyrillic_EN ] };
- key <LatO> { [ Cyrillic_o, Cyrillic_O ] };
- key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] };
- key <LatR> { [ Cyrillic_er, Cyrillic_ER ] };
- key <LatS> { [ Cyrillic_es, Cyrillic_ES ] };
- key <LatT> { [ Cyrillic_te, Cyrillic_TE ] };
- key <LatU> { [ Cyrillic_u, Cyrillic_U ] };
- key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] };
- key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] };
- key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] };
- key <AC10> { [ Cyrillic_che, Cyrillic_CHE, semicolon, colon ] };
- key <AD11> { [ Cyrillic_sha, Cyrillic_SHA, bracketleft, braceleft] };
- key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA, bracketright, braceright ] };
- key <AE12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, equal, plus ] };
- key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] };
- key <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] };
- key <BKSL> { [ Cyrillic_e, Cyrillic_E, backslash, bar ] };
- key <AC11> { [ Cyrillic_yu, Cyrillic_YU, apostrophe, quotedbl ] };
- key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] };
-
- include "level3(ralt_switch)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "mac" {
-
- include "us(basic)"
- name[Group1]= "USA - Macintosh";
- key.type[group1]="FOUR_LEVEL";
-
- // Slightly improvised from http://homepage.mac.com/thgewecke/kblayout.jpg
- key <LSGT> { [ section, plusminus, section, plusminus ] };
- key <TLDE> { [ grave, asciitilde, dead_grave, dead_horn ] };
- key <AE01> { [ 1, exclam, exclamdown, U2044 ] };
- key <AE02> { [ 2, at, trademark, EuroSign ] };
- key <AE03> { [ 3, numbersign, sterling, U2039 ] };
- key <AE04> { [ 4, dollar, cent, U203A ] };
- key <AE05> { [ 5, percent, infinity, UFB01 ] };
- key <AE06> { [ 6,asciicircum, section, UFB02 ] };
- key <AE07> { [ 7, ampersand, paragraph, doubledagger ] };
- key <AE08> { [ 8, asterisk, enfilledcircbullet, degree ] };
- key <AE09> { [ 9, parenleft, ordfeminine, periodcentered ] };
- key <AE10> { [ 0, parenright, masculine,singlelowquotemark] };
- key <AE11> { [ minus, underscore, endash, emdash ] };
- key <AE12> { [ equal, plus, notequal, plusminus ] };
-
- key <AD01> { [ q, Q, oe, OE ] };
- key <AD02> { [ w, W, U2211,doublelowquotemark] };
- key <AD03> { [ e, E, dead_acute, acute ] };
- key <AD04> { [ r, R, registered, U2030 ] };
- key <AD05> { [ t, T, dagger, dead_caron ] };
- key <AD06> { [ y, Y, yen, onequarter ] };
- key <AD07> { [ u, U, dead_diaeresis, diaeresis ] };
- key <AD08> { [ i, I, dead_circumflex, U02C6 ] };
- key <AD09> { [ o, O, oslash, Ooblique ] };
- key <AD10> { [ p, P, Greek_pi, U220F ] };
- key <AD11> { [ bracketleft, braceleft, leftdoublequotemark, rightdoublequotemark ] };
- key <AD12> { [bracketright, braceright, leftsinglequotemark, rightsinglequotemark ] };
- key <BKSL> { [ backslash, bar, guillemotleft, guillemotright ] };
-
- key <AC01> { [ a, A, aring, Aring ] };
- key <AC02> { [ s, S, ssharp, dead_stroke ] };
- key <AC03> { [ d, D, partialderivative, eth ] };
- key <AC04> { [ f, F, function, dead_hook ] };
- key <AC05> { [ g, G, copyright, dead_doubleacute ] };
- key <AC06> { [ h, H, dead_abovedot, dead_belowdot ] };
- key <AC07> { [ j, J, U2206, onehalf ] };
- key <AC08> { [ k, K,dead_abovering, UF8FF ] };
-
- key <AC09> { [ l, L, notsign, THORN ] };
- key <AC10> { [ semicolon, colon, U2026, thorn ] };
- key <AC11> { [apostrophe, quotedbl, ae, AE ] };
-
- key <AB01> { [ z, Z, Greek_OMEGA, dead_cedilla ] };
- key <AB02> { [ x, X, U2248, dead_ogonek ] };
- // unclear whether "approxeq" is 2248 or 2245
- key <AB03> { [ c, C, ccedilla, Ccedilla ] };
- key <AB04> { [ v, V, squareroot, U25CA ] };
- key <AB05> { [ b, B, integral, idotless ] };
- key <AB06> { [ n, N, dead_tilde, U02DC ] };
- key <AB07> { [ m, M, mu, threequarters ] };
- key <AB08> { [ comma, less, lessthanequal, dead_macron ] };
- key <AB09> { [ period, greater, greaterthanequal, dead_breve ] };
- key <AB10> { [ slash, question, division, questiondown ] };
-
- include "level3(ralt_switch)"
-};
-
-// Colemak symbols for xkb on X.Org Server 7.x
-// 2006-01-01 Shai Coleman, http://colemak.com/ . Public domain.
-
-partial alphanumeric_keys
-xkb_symbols "colemak" {
- include "us"
- name[Group1]= "USA - Colemak";
-
- // Alphanumeric section
- key <TLDE> { [ grave, asciitilde, dead_tilde, asciitilde ] };
- key <AE01> { [ 1, exclam, exclamdown, onesuperior ] };
- key <AE02> { [ 2, at, masculine, twosuperior ] };
- key <AE03> { [ 3, numbersign, ordfeminine, threesuperior ] };
- key <AE04> { [ 4, dollar, cent, sterling ] };
- key <AE05> { [ 5, percent, EuroSign, yen ] };
- key <AE06> { [ 6, asciicircum, hstroke, Hstroke ] };
- key <AE07> { [ 7, ampersand, eth, ETH ] };
- key <AE08> { [ 8, asterisk, thorn, THORN ] };
- key <AE09> { [ 9, parenleft, leftsinglequotemark, leftdoublequotemark ] };
- key <AE10> { [ 0, parenright, rightsinglequotemark, rightdoublequotemark ] };
- key <AE11> { [ minus, underscore, endash, emdash ] };
- key <AE12> { [ equal, plus, multiply, division ] };
-
- key <AD01> { [ q, Q, adiaeresis, Adiaeresis ] };
- key <AD02> { [ w, W, aring, Aring ] };
- key <AD03> { [ f, F, atilde, Atilde ] };
- key <AD04> { [ p, P, oslash, Ooblique ] };
- key <AD05> { [ g, G, dead_ogonek, asciitilde ] };
- key <AD06> { [ j, J, dstroke, Dstroke ] };
- key <AD07> { [ l, L, lstroke, Lstroke ] };
- key <AD08> { [ u, U, uacute, Uacute ] };
- key <AD09> { [ y, Y, udiaeresis, Udiaeresis ] };
- key <AD10> { [ semicolon, colon, odiaeresis, Odiaeresis ] };
- key <AD11> { [ bracketleft, braceleft, guillemotleft, 0x1002039 ] };
- key <AD12> { [ bracketright, braceright, guillemotright, 0x100203a ] };
- key <BKSL> { [ backslash, bar, asciitilde, asciitilde ] };
-
- key <AC01> { [ a, A, aacute, Aacute ] };
- key <AC02> { [ r, R, dead_grave, asciitilde ] };
- key <AC03> { [ s, S, ssharp, asciitilde ] };
- key <AC04> { [ t, T, dead_acute, dead_doubleacute ] };
- key <AC05> { [ d, D, dead_diaeresis, asciitilde ] };
- key <AC06> { [ h, H, dead_caron, asciitilde ] };
- key <AC07> { [ n, N, ntilde, Ntilde ] };
- key <AC08> { [ e, E, eacute, Eacute ] };
- key <AC09> { [ i, I, iacute, Iacute ] };
- key <AC10> { [ o, O, oacute, Oacute ] };
- key <AC11> { [ apostrophe, quotedbl, otilde, Otilde ] };
-
- key <AB01> { [ z, Z, ae, AE ] };
- key <AB02> { [ x, X, dead_circumflex, asciitilde ] };
- key <AB03> { [ c, C, ccedilla, Ccedilla ] };
- key <AB04> { [ v, V, oe, OE ] };
- key <AB05> { [ b, B, dead_breve, asciitilde ] };
- key <AB06> { [ k, K, dead_abovering, asciitilde ] };
- key <AB07> { [ m, M, dead_macron, asciitilde ] };
- key <AB08> { [ comma, less, dead_cedilla, asciitilde ] };
- key <AB09> { [ period, greater, dead_abovedot, asciitilde ] };
- key <AB10> { [ slash, question, questiondown, asciitilde ] };
-
- key <CAPS> { [ BackSpace, BackSpace, BackSpace, BackSpace ] };
- key <LSGT> { [ minus, underscore, endash, emdash ] };
- key <SPCE> { [ space, space, space, nobreakspace ] };
-
- include "level3(ralt_switch)"
-};
-
-// I do NOT like dead-keys - the International keyboard as defined by Microsoft
-// doesn't fit my needs. Why use two keystrokes for all simple characters (eg '
-// and <space> generates a single ') just to have an é (eacute) in two strokes
-// as well? I type ' more often than é (eacute).
-//
-// This file works just like a regular keyboard, BUT has all dead-keys
-// accessible at level3 (through AltGr). An ë (ediaeresis) is now: AltGr+"
-// followed by an e. In other words, this keyboard is not international as long
-// as you leave the right Alt key alone.
-//
-// The original MS International keyboard was intended for Latin1 (iso8859-1).
-// With the introduction of iso8859-15, the (important) ligature oe (and OE)
-// became available. I added them next to ae. Because I write ediaeresis more
-// often than registered, I moved registered to be next to copyright and added
-// ediaeresis and idiaeresis. - Adriaan
-
-partial alphanumeric_keys
-xkb_symbols "altgr-intl" {
-
- name[Group1]= "USA - International (AltGr dead keys)";
-
- include "us(intl)"
-
-// five dead keys moved into level3:
-
- key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
- key <AC11> { [apostrophe,quotedbl, dead_acute, dead_diaeresis ] };
-
-// diversions from the MS Intl keyboard:
-
- key <AE01> { [ 1, exclam, onesuperior, exclamdown ] };
- key <AD04> { [ r, R, ediaeresis, Ediaeresis ] };
- key <AC07> { [ j, J, idiaeresis, Idiaeresis ] };
- key <AB02> { [ x, X, oe, OE ] };
- key <AB04> { [ v, V, registered, registered ] };
-
-// onequarter etc (not in iso8859-15) moved to get three unshifted deadkeys:
-
- key <AE06> { [ 6, asciicircum, dead_circumflex, onequarter ] };
- key <AE07> { [ 7, ampersand, dead_horn, onehalf ] };
- key <AE08> { [ 8, asterisk, dead_ogonek, threequarters ] };
-
- include "level3(ralt_switch)"
-};
-
-// Intel ClassmatePC Keyboard Layout
-// by Piter PUNK <piterpk@terra.com.br>
-//
-// The keyboard layouts below maps the us(basic), us(intl) and us(alt-intl)
-// to ClassmatePC keyboard. All layouts uses RCTL as level3(switch) since
-// the keyboard doesn't have AltGr key. The EuroSign is engraved at 5 key.
-
-// classmate - us(basic)
-partial alphanumeric_keys
-xkb_symbols "classmate" {
- include "us(basic)"
- name[Group1]= "USA - ClassmatePC";
-
- key <LSGT> { [ backslash, bar, backslash, bar ] };
-
- include "eurosign(5)"
- include "level3(switch)"
-};
-
-// classmate-intl - us(intl)
-// RCTL is generated by Fn+Alt, because that, when trying to access
-// the level3 symbols at 7,8,9,0,u,i,o,p,j,k,l,;,m,. and / we got
-// the keypad keycodes. The keypad is changed to make Fn+Alt+<KP_key>
-// generate the same symbol as the original key.
-partial alphanumeric_keys
-xkb_symbols "classmate-intl" {
- include "us(intl)"
- name[Group1]= "USA - ClassmatePC (International)";
- key.type[Group1]="FOUR_LEVEL";
-
- key <LSGT> { [ backslash, bar, backslash, bar ] };
-
- key <KP7> { [ KP_Home, KP_7,
- onehalf, dead_horn ] };
- key <KP8> { [ KP_Up, KP_8,
- threequarters, dead_ogonek ] };
- key <KP9> { [ KP_Prior, KP_9,
- leftsinglequotemark, dead_breve ] };
- key <KPMU> { [ KP_Multiply, KP_Multiply,
- rightsinglequotemark, dead_abovering ] };
-
- key <KP4> { [ KP_Left, KP_4,
- uacute, Uacute ] };
- key <KP5> { [ KP_Begin, KP_5,
- iacute, Iacute ] };
- key <KP6> { [ KP_Right, KP_6,
- oacute, Oacute ] };
- key <KPSU> { [ KP_Subtract, KP_Subtract,
- odiaeresis, Odiaeresis ] };
-
- key <KP2> { [ KP_Down, KP_2,
- oe, OE ] };
- key <KP3> { [ KP_Next, KP_3,
- oslash, Ooblique ] };
- key <KPAD> { [ KP_Add, KP_Add,
- paragraph, degree ] };
-
- key <KP0> { [ KP_Insert, KP_0,
- mu, mu ] };
- key <KPDL> { [ KP_Delete, KP_Decimal,
- dead_abovedot, dead_caron ] };
- key <KPDV> { [ KP_Divide, KP_Divide,
- questiondown, dead_hook ] };
-
- include "level3(switch)"
-};
-
-// classmate-alt-intl - us(alt-intl)
-// RCTL is generated by Fn+Alt, because that, when trying to access
-// the level3 symbols at 7,8,9,0,u,i,o,p,j,k,l,;,m,. and / we got
-// the keypad keycodes. The keypad is changed to make Fn+Alt+<KP_key>
-// generate the same symbol as the original key.
-partial alphanumeric_keys
-xkb_symbols "classmate-alt-intl" {
- include "us(alt-intl)"
- name[Group1]= "USA - ClassmatePC (Alternative international)";
- key.type[Group1]="FOUR_LEVEL";
-
- key <LSGT> { [ backslash, bar, backslash, bar ] };
-
- key <KPSU> { [ KP_Subtract, KP_Subtract ] };
-
- key <KP9> { [ KP_Prior, KP_9,
- leftsinglequotemark, dead_breve ] };
- key <KPMU> { [ KP_Multiply, KP_Multiply,
- rightsinglequotemark, dead_abovering ] };
-
- key <KPAD> { [ KP_Add, KP_Add,
- dead_ogonek, dead_diaeresis ] };
-
- key <KPDL> { [ KP_Delete, KP_Decimal,
- dead_abovedot, dead_circumflex ] };
- key <KPDV> { [ KP_Divide, KP_Divide,
- dead_hook, dead_hook ] };
-
- include "level3(switch)"
-};
-
-// classmate-altgr-intl - us(altgr-intl)
-// RCTL is generated by Fn+Alt, because that, when trying to access
-// the level3 symbols at 7,8,9,0,u,i,o,p,j,k,l,;,m,. and / we got
-// the keypad keycodes. The keypad is changed to make Fn+Alt+<KP_key>
-// generate the same symbol as the original key.
-partial alphanumeric_keys
-xkb_symbols "classmate-altgr-intl" {
- include "us(altgr-intl)"
- name[Group1]= "USA - ClassmatePC (International Fn+Alt dead-keys)";
- key.type[Group1]="FOUR_LEVEL";
-
- key <LSGT> { [ backslash, bar, backslash, bar ] };
-
- key <KP7> { [ KP_Home, KP_7,
- dead_horn, dead_horn ] };
- key <KP8> { [ KP_Up, KP_8,
- dead_ogonek, dead_ogonek ] };
- key <KP9> { [ KP_Prior, KP_9,
- leftsinglequotemark, dead_breve ] };
- key <KPMU> { [ KP_Multiply, KP_Multiply,
- rightsinglequotemark, dead_abovering ] };
-
- key <KP4> { [ KP_Left, KP_4,
- uacute, Uacute ] };
- key <KP5> { [ KP_Begin, KP_5,
- iacute, Iacute ] };
- key <KP6> { [ KP_Right, KP_6,
- oacute, Oacute ] };
- key <KPSU> { [ KP_Subtract, KP_Subtract,
- odiaeresis, Odiaeresis ] };
-
- key <KP1> { [ KP_End, KP_1,
- idiaeresis, Idiaeresis ] };
- key <KP2> { [ KP_Down, KP_2,
- oe, OE ] };
- key <KP3> { [ KP_Next, KP_3,
- oslash, Ooblique ] };
- key <KPAD> { [ KP_Add, KP_Add,
- paragraph, degree ] };
-
- key <KP0> { [ KP_Insert, KP_0,
- mu, mu ] };
- key <KPDL> { [ KP_Delete, KP_Decimal,
- dead_abovedot, dead_caron ] };
- key <KPDV> { [ KP_Divide, KP_Divide,
- questiondown, dead_hook ] };
-
- include "level3(switch)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "olpc" {
-
- include "us(basic)"
- name[Group1]= "USA";
-
- // OLPC international US English keyboard layout.
- // It's a little different from the usual international layout.
- // See: http://wiki.laptop.org/go/Image:Keyboard_english.png
-
- key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] };
- key <AE01> { [ 1, exclam, exclamdown, exclamdown ] };
- key <AE02> { [ 2, at, notsign, notsign ] };
- key <AE03> { [ 3, numbersign, 0x1000300, 0x1000300 ] }; // combining grave
- key <AE04> { [ 4, dollar, 0x1000301, 0x1000301 ] }; // combining acute
- key <AE05> { [ 5, percent, 0x1000306, 0x1000306 ] }; // combining breve above
- key <AE06> { [ 6,asciicircum, 0x100030A, 0x100030A ] }; // combining ring above
- key <AE07> { [ 7, ampersand, 0x1000302, 0x1000302 ] }; // combining circumflex above
- key <AE08> { [ 8, asterisk, 0x100030C, 0x100030C ] }; // combining caron above
- key <AE09> { [ 9, parenleft, 0x1000307, 0x1000307 ] }; // combining dot above
- key <AE10> { [ 0, parenright, 0x1000308, 0x1000308 ] }; // combining diaeresis above
- key <AE11> { [ minus, underscore, 0x1000304, 0x1000304 ] }; // combining macron above
- key <AE12> { [ equal, plus, 0x1000303, 0x1000303 ] }; // combining tilde above
-
- key <AD01> { [ q, Q, Greek_omega, Greek_OMEGA ] };
- key <AD02> { [ w, W, oslash, Oslash ] };
- key <AD03> { [ e, E, oe, OE ] };
- key <AD04> { [ r, R, 0x1000327, 0x1000327 ] }; // combining cedilla
- key <AD05> { [ t, T, 0x100032E, 0x100032E ] }; // combining breve below
- key <AD06> { [ y, Y, 0x1000325, 0x1000325 ] }; // combining ring below
- key <AD07> { [ u, U, 0x100032D, 0x100032D ] }; // combining circumflex below
- key <AD08> { [ i, I, 0x100032C, 0x100032C ] }; // combining caron below
- key <AD09> { [ o, O, 0x1000323, 0x1000323 ] }; // combining dot below
- key <AD10> { [ p, P, 0x1000324, 0x1000324 ] }; // combining diaeresis below
- key <AD11> { [ bracketleft, braceleft, 0x1000331, 0x1000331 ] }; // combining macron below
- key <AD12> { [bracketright, braceright, 0x1000330, 0x1000330 ] }; // combining tilde below
-
- key <AC01> { [ a, A, ae, AE ] };
- key <AC02> { [ s, S, ssharp, 0x1001E9C ] }; // uppercase S sharp
- key <AC03> { [ d, D, eth, ETH ] };
- key <AC04> { [ f, F, thorn, THORN ] };
- key <AC06> { [ h, H, sterling, sterling ] };
- key <AC07> { [ j, J, EuroSign, EuroSign ] };
- key <AC10> { [ semicolon, colon, masculine, ordfeminine ] };
- key <AC11> { [ apostrophe, quotedbl, currency, currency ] };
- key <BKSL> { [ backslash, bar, section, section ] };
-
- key <AB03> { [ c, C, ccedilla, Ccedilla ] };
- key <AB06> { [ n, N, ntilde, Ntilde ] };
- key <AB07> { [ m, M, mu, mu ] };
- key <AB08> { [ comma, less, guillemotleft, guillemotleft ] };
- key <AB09> { [ period, greater, guillemotright, guillemotright ] };
- key <AB10> { [ slash, question, questiondown, questiondown ] };
-
- key <I219> { [ multiply, division, ISO_Next_Group, ISO_Prev_Group ] };
-
- include "level3(ralt_switch)"
-};
-
-partial alphanumeric_keys
-xkb_symbols "olpc2" {
- include "us(olpc)"
- name[Group1]= "USA - Layout toggle on multiply/divide key";
- include "group(olpc)"
-};
-
-// Based on Cherokee Nation Official Layout
-// http://www.cherokee.org/extras/downloads/font/Keyboard.htm
-
-partial alphanumeric_keys modifier_keys
-xkb_symbols "chr" {
-
- name[Group1]= "USA - Cherokee";
- key.type[group1]="ALPHABETIC";
-
- // Alphanumeric section
- key <TLDE> { [ grave, U13CA ] };
- key <AE01> { [ 1, U13B1 ] };
- key <AE02> { [ 2, U13C7 ] };
- key <AE03> { [ 3, U13E7 ] };
- key <AE04> { [ U13D9, U13B0 ] };
- key <AE05> { [ U13E6, U13B9 ] };
- key <AE06> { [ U13DC, U13DD ] };
- key <AE07> { [ U13CB, U13E1 ] };
- key <AE08> { [ U13D6, U13BA ] };
- key <AE09> { [ U13D2, parenleft ] };
- key <AE10> { [ U13C4, parenright ] };
- key <AE11> { [ U13BF, U13BC ] };
- key <AE12> { [ U13F3, U13BD ] };
-
- key <AD01> { [ U13AA, U13C6 ] };
- key <AD02> { [ U13B3, U13EB ] };
- key <AD03> { [ U13A1, U13E3 ] };
- key <AD04> { [ U13DB, U13CF ] };
- key <AD05> { [ U13D4, U13D8 ] };
- key <AD06> { [ U13EF, U13F2 ] };
- key <AD07> { [ U13A4, U13AD ] };
- key <AD08> { [ U13A2, U13F1 ] };
- key <AD09> { [ U13A3, U13EC ] };
- key <AD10> { [ U13C1, U13EA ] };
- key <AD11> { [ U13D5, U13D1 ] };
- key <AD12> { [ U13B6, U13E4 ] };
- key <BKSL> { [ U13E9, U13EE ] };
-
- key <AC01> { [ U13A0, U13CC ] };
- key <AC02> { [ U13CD, U13CE ] };
- key <AC03> { [ U13D7, U13D0 ] };
- key <AC04> { [ U13A9, U13C8 ] };
- key <AC05> { [ U13A6, U13E5 ] };
- key <AC06> { [ U13AF, U13B2 ] };
- key <AC07> { [ U13DA, U13AB ] };
- key <AC08> { [ U13B8, U13A7 ] };
- key <AC09> { [ U13B5, U13AE ] };
- key <AC10> { [ U13E8, U13E0 ] };
- key <AC11> { [ apostrophe, quotedbl ] };
-
- key <AB01> { [ U13AC, U13C3 ] };
- key <AB02> { [ U13F4, U13ED ] };
- key <AB03> { [ U13D3, U13DF ] };
- key <AB04> { [ U13A5, U13DE ] };
- key <AB05> { [ U13A8, U13F0 ] };
- key <AB06> { [ U13BE, U13BB ] };
- key <AB07> { [ U13C5, U13B7 ] };
- key <AB08> { [ comma, U13E2 ] };
- key <AB09> { [ period, U13B4 ] };
- key <AB10> { [ U13C2, U13C9 ] };
-
- // End alphanumeric section
-};
-
-// Serbian charecters added as third level symbols to US keyboard layout.
-
-partial alphanumeric_keys
-xkb_symbols "srp" {
-
- name[Group1]= "USA - Serbian";
-
- include "us"
-
- key <TLDE> { [ grave, asciitilde ] };
- key <AE06> { [ 6, dead_caron, asciicircum, asciicircum ] };
- key <AC09> { [ l, L, U1C9, U1C8 ] };
- key <AB06> { [ n, N, U1CC, U1CB ] };
- key <AB01> { [ z, Z, U1C6, U1C5 ] };
- key <AD03> { [ e, E, EuroSign, cent ] };
- key <AC03> { [ d, D, dstroke, Dstroke ] };
- key <AC11> { [ dead_acute, quotedbl, apostrophe, U315 ] };
- key <SPCE> { [ space, space, nobreakspace, nobreakspace ] };
-
- include "level3(ralt_switch)"
-};
-
-//based on http://upload.wikimedia.org/wikipedia/commons/1/18/T-Mobile_G1_launch_event_2.jpg
-partial alphanumeric_keys
-xkb_symbols "htcdream" {
- include "inet(htcdream)"
- name[Group1]= "USA - htcdream";
-
- //second row
- key <AD01> { [ q, Q, Tab, Tab ] };
- key <AD02> { [ w, W, grave, grave ] };
- key <AD03> { [ e, E, underscore, underscore ] };
- key <AD04> { [ r, R, sterling, sterling ] };
- key <AD05> { [ t, T, EuroSign, EuroSign ] };
- key <AD06> { [ y, Y, division, division ] };
- key <AD07> { [ u, U, multiply, multiply ] };
- key <AD08> { [ i, I, minus, minus ] };
- key <AD09> { [ o, O, plus, plus ] };
- key <AD10> { [ p, P, equal, equal ] };
-
- //third row
- key <AC01> { [ a, A, NoSymbol, NoSymbol ] };
- key <AC02> { [ s, S, bar, bar ] };
- key <AC03> { [ d ,D, backslash, backslash ] };
- key <AC04> { [ f, F, braceleft, braceleft ] };
- key <AC05> { [ g, G, braceright, braceright ] };
- key <AC06> { [ h, H, colon, colon ] };
- key <AC07> { [ j, J, semicolon, semicolon ] };
- key <AC08> { [ k, K, quotedbl, quotedbl ] };
- key <AC09> { [ l, L, apostrophe, apostrophe ] };
-
- //forth row
- key <AB01> { [ z, Z, NoSymbol, NoSymbol ] };
- key <AB02> { [ x, X, NoSymbol, NoSymbol ] };
- key <AB03> { [ c, C, NoSymbol, NoSymbol ] };
- key <AB04> { [ v, V, bracketleft, bracketleft ] };
- key <AB05> { [ b, B, bracketright, bracketright ] };
- key <AB06> { [ n, N, less, less ] };
- key <AB07> { [ m, M, greater, greater ] };
- key <AB08> { [ comma, comma, question, question ] };
-
- //fifth row
- key <FK15> { [ at, at, asciitilde, asciitilde ] };
-
- include "level3(alt_switch)"
-};
\ No newline at end of file +// $XKeyboardConfig$ + +// +// $XdotOrg: xc/programs/xkbcomp/symbols/us,v 1.1.4.3 2004/03/05 13:41:33 eich Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us,v 1.6 2003/10/31 14:32:05 pascal Exp $ + +default +partial alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + name[Group1]= "USA"; + + // Alphanumeric section + key <TLDE> { [ grave, asciitilde ] }; + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft ] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ minus, underscore ] }; + key <AE12> { [ equal, plus ] }; + + key <AD01> { [ q, Q ] }; + key <AD02> { [ w, W ] }; + key <AD03> { [ e, E ] }; + key <AD04> { [ r, R ] }; + key <AD05> { [ t, T ] }; + key <AD06> { [ y, Y ] }; + key <AD07> { [ u, U ] }; + key <AD08> { [ i, I ] }; + key <AD09> { [ o, O ] }; + key <AD10> { [ p, P ] }; + key <AD11> { [ bracketleft, braceleft ] }; + key <AD12> { [ bracketright, braceright ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ s, S ] }; + key <AC03> { [ d, D ] }; + key <AC04> { [ f, F ] }; + key <AC05> { [ g, G ] }; + key <AC06> { [ h, H ] }; + key <AC07> { [ j, J ] }; + key <AC08> { [ k, K ] }; + key <AC09> { [ l, L ] }; + key <AC10> { [ semicolon, colon ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + + key <AB01> { [ z, Z ] }; + key <AB02> { [ x, X ] }; + key <AB03> { [ c, C ] }; + key <AB04> { [ v, V ] }; + key <AB05> { [ b, B ] }; + key <AB06> { [ n, N ] }; + key <AB07> { [ m, M ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ period, greater ] }; + key <AB10> { [ slash, question ] }; + + key <BKSL> { [ backslash, bar ] }; + // End alphanumeric section +}; + +partial alphanumeric_keys +xkb_symbols "euro" { + + name[Group1]= "USA - With EuroSign on 5"; + + include "us(basic)" + + include "eurosign(5)" + + include "level3(ralt_switch)" +}; + + +partial alphanumeric_keys +xkb_symbols "intl" { + + name[Group1]= "USA - International (with dead keys)"; + + include "us(basic)" + + // Alphanumeric section + key <TLDE> { [dead_grave, dead_tilde, grave, asciitilde ] }; + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, at, twosuperior, dead_doubleacute ] }; + key <AE03> { [ 3, numbersign, threesuperior, dead_macron ] }; + key <AE04> { [ 4, dollar, currency, sterling ] }; + key <AE05> { [ 5, percent, EuroSign, dead_cedilla ] }; + key <AE06> { [ 6, dead_circumflex, onequarter, asciicircum ] }; + key <AE07> { [ 7, ampersand, onehalf, dead_horn ] }; + key <AE08> { [ 8, asterisk, threequarters, dead_ogonek ] }; + key <AE09> { [ 9, parenleft, leftsinglequotemark, dead_breve ] }; + key <AE10> { [ 0, parenright, rightsinglequotemark, dead_abovering ] }; + key <AE11> { [ minus, underscore, yen, dead_belowdot ] }; + key <AE12> { [ equal, plus, multiply, division ] }; + + key <AD01> { [ q, Q, adiaeresis, Adiaeresis ] }; + key <AD02> { [ w, W, aring, Aring ] }; + key <AD03> { [ e, E, eacute, Eacute ] }; + key <AD04> { [ r, R, registered, registered ] }; + key <AD05> { [ t, T, thorn, THORN ] }; + key <AD06> { [ y, Y, udiaeresis, Udiaeresis ] }; + key <AD07> { [ u, U, uacute, Uacute ] }; + key <AD08> { [ i, I, iacute, Iacute ] }; + key <AD09> { [ o, O, oacute, Oacute ] }; + key <AD10> { [ p, P, odiaeresis, Odiaeresis ] }; + key <AD11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] }; + key <AD12> { [bracketright, braceright, guillemotright, rightdoublequotemark ] }; + + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ s, S, ssharp, section ] }; + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, f, F ] }; + key <AC05> { [ g, G, g, G ] }; + key <AC06> { [ h, H, h, H ] }; + key <AC07> { [ j, J, j, J ] }; + key <AC08> { [ k, K, oe, OE ] }; + + key <AC09> { [ l, L, oslash, Ooblique ] }; + key <AC10> { [ semicolon, colon, paragraph, degree ] }; + key <AC11> { [dead_acute, dead_diaeresis, apostrophe, quotedbl ] }; + + key <AB01> { [ z, Z, ae, AE ] }; + key <AB02> { [ x, X, x, X ] }; + key <AB03> { [ c, C, copyright, cent ] }; + key <AB04> { [ v, V, v, V ] }; + key <AB05> { [ b, B, b, B ] }; + key <AB06> { [ n, N, ntilde, Ntilde ] }; + key <AB07> { [ m, M, mu, mu ] }; + key <AB08> { [ comma, less, ccedilla, Ccedilla ] }; + key <AB09> { [ period, greater, dead_abovedot, dead_caron ] }; + key <AB10> { [ slash, question, questiondown, dead_hook ] }; + key <BKSL> { [ backslash, bar, notsign, brokenbar ] }; + + include "level3(ralt_switch)" +}; + +// Based on symbols/us_intl keyboard map: +// Dead-keys definition for a very simple US/ASCII layout. +// by Conectiva (http://www.conectiva.com.br) +// modified by Ricardo Y. Igarashi (iga@that.com.br) + +// Added the following deadkeys, to make it truly international: +// +// dead_macron: on AltGr-minus +// dead_breve: on AltGr-parenleft +// dead_abovedot: on AltGr-period +// dead_abovering: on AltGr-0 +// dead_doubleacute: on AltGr-equal (as quotedbl is already used) +// dead_caron: on AltGr-less (AltGr-shift-comma) +// dead_cedilla: on AltGr-comma +// dead_ogonek: on AltGr-semicolon +// dead_belowdot: on AltGr-underscore (AltGr-shift-minus) +// dead_hook: on AltGr-question +// dead_horn: on AltGr-plus (AltGr-shift-equal) +// dead_diaeresis: on AltGr-colon (Alt-shift-semicolon) +// +// those were already there: +// dead_grave +// dead_acute +// dead_circumflex +// dead_tilde +// dead_diaeresis + +partial alphanumeric_keys +xkb_symbols "alt-intl" { + + name[Group1]= "USA - Alternative international"; + + include "us" + + key <TLDE> { [ dead_grave, dead_tilde, grave, asciitilde ] }; + key <AE05> { [ 5, percent, EuroSign ] }; + key <AE06> { [ 6, dead_circumflex, asciicircum, asciicircum ] }; + key <AE09> { [ 9, parenleft, leftsinglequotemark, dead_breve ] }; + key <AE10> { [ 0, parenright, rightsinglequotemark, dead_abovering ] }; + key <AE11> { [ minus, underscore, dead_macron, dead_belowdot ] }; + key <AE12> { [ equal, plus, dead_doubleacute, dead_horn ] }; + + key <AD03> { [ e, E, EuroSign, cent ] }; + + key <AC10> { [ semicolon, colon, dead_ogonek, dead_diaeresis ] }; + key <AC11> { [ dead_acute, dead_diaeresis, apostrophe, quotedbl ] }; + + key <AB08> { [ comma, less, dead_cedilla, dead_caron ] }; + key <AB09> { [ period, greater, dead_abovedot, dead_circumflex ] }; + key <AB10> { [ slash, question, dead_hook, dead_hook ] }; + + include "level3(ralt_switch)" +}; + +// based on a keyboard map from an 'xkb/symbols/dk' file +// +// $XFree86: xc/programs/xkbcomp/symbols/dvorak,v 1.5 2004/01/03 16:35:07 herrb Exp $ + +partial alphanumeric_keys +xkb_symbols "dvorak" { + + name[Group1]= "USA - Dvorak"; + + // Alphanumeric section + + key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] }; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ 5, percent ] }; + key <AE06> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] }; + key <AE07> { [ 7, ampersand ] }; + key <AE08> { [ 8, asterisk ] }; + key <AE09> { [ 9, parenleft, dead_grave] }; + key <AE10> { [ 0, parenright ] }; + key <AE11> { [ bracketleft, braceleft ] }; + key <AE12> { [ bracketright, braceright, dead_tilde] }; + + key <AD01> { [ apostrophe, quotedbl, dead_acute, dead_diaeresis ] }; + key <AD02> { [ comma, less, dead_cedilla, dead_caron ] }; + key <AD03> { [ period, greater, dead_abovedot, periodcentered ] }; + key <AD04> { [ p, P ] }; + key <AD05> { [ y, Y ] }; + key <AD06> { [ f, F ] }; + key <AD07> { [ g, G ] }; + key <AD08> { [ c, C ] }; + key <AD09> { [ r, R ] }; + key <AD10> { [ l, L ] }; + key <AD11> { [ slash, question ] }; + key <AD12> { [ equal, plus ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ o, O ] }; + key <AC03> { [ e, E ] }; + key <AC04> { [ u, U ] }; + key <AC05> { [ i, I ] }; + key <AC06> { [ d, D ] }; + key <AC07> { [ h, H ] }; + key <AC08> { [ t, T ] }; + key <AC09> { [ n, N ] }; + key <AC10> { [ s, S ] }; + key <AC11> { [ minus, underscore ] }; + + key <AB01> { [ semicolon, colon, dead_ogonek, dead_doubleacute ] }; + key <AB02> { [ q, Q ] }; + key <AB03> { [ j, J ] }; + key <AB04> { [ k, K ] }; + key <AB05> { [ x, X ] }; + key <AB06> { [ b, B ] }; + key <AB07> { [ m, M ] }; + key <AB08> { [ w, W ] }; + key <AB09> { [ v, V ] }; + key <AB10> { [ z, Z ] }; + + key <BKSL> { [ backslash, bar ] }; +}; + +// Dvorak international with dead keys +// Olivier Mehani (shtrom-xorg@ssji.net) +// Reproduce the per-key mapping of us(intl) for the dvorak layout +// aka "I just swapped my keys over" +partial alphanumeric_keys +xkb_symbols "dvorak-intl" { + + name[Group1]= "USA - Dvorak international (with dead keys)"; + + include "us(dvorak)" + + key <TLDE> { [dead_grave, dead_tilde, grave, asciitilde ] }; + + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, at, twosuperior, dead_doubleacute ] }; + key <AE03> { [ 3, numbersign, threesuperior, dead_macron ] }; + key <AE04> { [ 4, dollar, currency, sterling ] }; + key <AE05> { [ 5, percent, EuroSign, dead_cedilla ] }; + key <AE06> { [ 6, dead_circumflex, onequarter, asciicircum ] }; + key <AE07> { [ 7, ampersand, onehalf, dead_horn ] }; + key <AE08> { [ 8, asterisk, threequarters, dead_ogonek ] }; + key <AE09> { [ 9, parenleft, leftsinglequotemark, dead_breve ] }; + key <AE10> { [ 0, parenright, rightsinglequotemark, dead_abovering ] }; + key <AE11> { [ bracketleft, braceleft, guillemotleft, leftdoublequotemark ] }; + key <AE12> { [bracketright, braceright, guillemotright, rightdoublequotemark ] }; + + key <AD01> { [dead_acute, dead_diaeresis, apostrophe, quotedbl ] }; + key <AD02> { [ comma, less, ccedilla, Ccedilla ] }; + key <AD03> { [ period, greater, dead_abovedot, dead_caron ] }; + key <AD04> { [ p, P, odiaeresis, Odiaeresis ] }; + key <AD05> { [ y, Y, udiaeresis, Udiaeresis ] }; + // key <AD06> { [ f, F ] }; + // key <AD07> { [ g, G ] }; + key <AD08> { [ c, C, copyright, cent ] }; + key <AD09> { [ r, R, registered, registered ] }; + key <AD10> { [ l, L, oslash, Ooblique ] }; + key <AD11> { [ slash, question, questiondown, dead_hook ] }; + // key <AD12> { [ equal, plus, multiply, division ] }; + + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ o, O, oacute, Oacute ] }; + key <AC03> { [ e, E, eacute, Eacute ] }; + key <AC04> { [ u, U, uacute, Uacute ] }; + key <AC05> { [ i, I, iacute, Iacute ] }; + key <AC06> { [ d, D, eth, ETH ] }; + // key <AC07> { [ h, H ] }; + key <AC08> { [ t, T, thorn, THORN ] }; + key <AC09> { [ n, N, ntilde, Ntilde ] }; + key <AC10> { [ s, S, ssharp, section ] }; + // key <AC11> { [ minus, underscore, yen, dead_belowdot ] }; + + key <AB01> { [ semicolon, colon, paragraph, degree ] }; + key <AB02> { [ q, Q, adiaeresis, Adiaeresis ] }; + // key <AB03> { [ j, J ] }; + key <AB04> { [ k, K, oe, OE ] }; + // key <AB05> { [ x, X ] }; + // key <AB06> { [ b, B ] }; + key <AB07> { [ m, M, mu, mu ] }; + key <AB08> { [ w, W, aring, Aring ] }; + // key <AB09> { [ v, V ] }; + key <AB10> { [ z, Z, ae, AE ] }; + + key <BKSL> { [ backslash, bar, notsign, brokenbar ] }; + + include "level3(ralt_switch)" +}; + +// Dvorak international without dead keys +// Stephane Magnenat (stephane at magnenat dot net, http://stephane.magnenat.net) +// Based on information from http://www.poupinou.org/dvorak/index.html +// +// ` 1 2 3 4 5 6 7 8 9 0 [ ] \ +// € +// +// ' , . p y f g c r l / = +// ä ê ë ü ç +// +// a o e u i d h t n s - +// à ô é û î ß +// +// ; q j k x b m w v z +// â ö è ù ï + +partial alphanumeric_keys +xkb_symbols "dvorak-alt-intl" { + + name[Group1]= "USA - Dvorak alternative international (no dead keys)"; + + include "us(dvorak)" + + key <AE04> { [ 4, dollar, EuroSign ] }; + + key <AD02> { [ comma, less, adiaeresis, dead_caron ] }; + key <AD03> { [ period, greater, ecircumflex, periodcentered ] }; + key <AD04> { [ p, P, ediaeresis, dead_cedilla ] }; + key <AD05> { [ y, Y, udiaeresis ] }; + key <AD08> { [ c, C, ccedilla, dead_abovedot ] }; + + key <AC01> { [ a, A, agrave ] }; + key <AC02> { [ o, O, ocircumflex ] }; + key <AC03> { [ e, E, eacute ] }; + key <AC04> { [ u, U, ucircumflex ] }; + key <AC05> { [ i, I, icircumflex ] }; + key <AC10> { [ s, S, ssharp ] }; + + key <AB01> { [ semicolon, colon, acircumflex ] }; + key <AB02> { [ q, Q, odiaeresis, dead_ogonek ] }; + key <AB03> { [ j, J, egrave, dead_doubleacute ] }; + key <AB04> { [ k, K, ugrave ] }; + key <AB05> { [ x, X, idiaeresis ] }; + + include "level3(ralt_switch)" +}; + +// Left and right handed dvorak layouts +// by sqweek <sqweek@gmail.com> 2006-01-30 +// Based on the corresponding layouts in the console-tools package. +partial alphanumeric_keys +xkb_symbols "dvorak-l" { + + include "us(dvorak)" + name[Group1]= "USA - Left handed Dvorak"; + + key <AE01> { [ bracketleft, braceleft ] }; + key <AE02> { [ bracketright, braceright ] }; + key <AE03> { [ slash, question ] }; + key <AE04> { [ p, P ] }; + key <AE05> { [ f, F ] }; + key <AE06> { [ m, M ] }; + key <AE07> { [ l, L ] }; + key <AE08> { [ j, J ] }; + key <AE09> { [ 4, dollar ] }; + key <AE10> { [ 3, numbersign ] }; + key <AE11> { [ 2, at ] }; + key <AE12> { [ 1, exclam ] }; + + key <AD01> { [ semicolon, colon ] }; + key <AD02> { [ q, Q ] }; + key <AD03> { [ b, B ] }; + key <AD04> { [ y, Y ] }; + key <AD05> { [ u, U ] }; + key <AD06> { [ r, R ] }; + key <AD07> { [ s, S ] }; + key <AD08> { [ o, O ] }; + key <AD09> { [ period, greater ] }; + key <AD10> { [ 6, asciicircum ] }; + key <AD11> { [ 5, percent ] }; + key <AD12> { [ equal, plus ] }; + + key <AC01> { [ minus, underscore ] }; + key <AC02> { [ k, K ] }; + key <AC03> { [ c, C ] }; + key <AC04> { [ d, D ] }; + key <AC05> { [ t, T ] }; + key <AC06> { [ h, H ] }; + key <AC07> { [ e, E ] }; + key <AC08> { [ a, A ] }; + key <AC09> { [ z, Z ] }; + key <AC10> { [ 8, asterisk ] }; + key <AC11> { [ 7, ampersand ] }; + + key <AB01> { [ apostrophe, quotedbl ] }; + key <AB02> { [ x, X ] }; + key <AB03> { [ g, G ] }; + key <AB04> { [ v, V ] }; + key <AB05> { [ w, W ] }; + key <AB06> { [ n, N ] }; + key <AB07> { [ i, I ] }; + key <AB08> { [ comma, less ] }; + key <AB09> { [ 0, parenright ] }; + key <AB10> { [ 9, parenleft ] }; +}; + +partial alphanumeric_keys +xkb_symbols "dvorak-r" { + + include "us(dvorak)" + name[Group1]= "USA - Right handed Dvorak"; + + key <AE01> { [ 1, exclam ] }; + key <AE02> { [ 2, at ] }; + key <AE03> { [ 3, numbersign ] }; + key <AE04> { [ 4, dollar ] }; + key <AE05> { [ j, J ] }; + key <AE06> { [ l, L ] }; + key <AE07> { [ m, M ] }; + key <AE08> { [ f, F ] }; + key <AE09> { [ p, P ] }; + key <AE10> { [ slash, question ] }; + key <AE11> { [ bracketleft, braceleft ] }; + key <AE12> { [ bracketright, braceright ] }; + + key <AD01> { [ 5, percent ] }; + key <AD02> { [ 6, asciicircum ] }; + key <AD03> { [ q, Q ] }; + key <AD04> { [ period, greater ] }; + key <AD05> { [ o, O ] }; + key <AD06> { [ r, R ] }; + key <AD07> { [ s, S ] }; + key <AD08> { [ u, U ] }; + key <AD09> { [ y, Y ] }; + key <AD10> { [ b, B ] }; + key <AD11> { [ semicolon, colon ] }; + key <AD12> { [ equal, plus ] }; + + key <AC01> { [ 7, ampersand ] }; + key <AC02> { [ 8, asterisk ] }; + key <AC03> { [ z, Z ] }; + key <AC04> { [ a, A ] }; + key <AC05> { [ e, E ] }; + key <AC06> { [ h, H ] }; + key <AC07> { [ t, T ] }; + key <AC08> { [ d, D ] }; + key <AC09> { [ c, C ] }; + key <AC10> { [ k, K ] }; + key <AC11> { [ minus, underscore ] }; + + key <AB01> { [ 9, parenleft ] }; + key <AB02> { [ 0, parenright ] }; + key <AB03> { [ x, X ] }; + key <AB04> { [ comma, less ] }; + key <AB05> { [ i, I ] }; + key <AB06> { [ n, N ] }; + key <AB07> { [ w, W ] }; + key <AB08> { [ v, V ] }; + key <AB09> { [ g, G ] }; + key <AB10> { [ apostrophe, quotedbl ] }; +}; + +// Classic dvorak layout +// by Piter Punk <piterpk@terra.com.br> - 2006-07-06 +// Based on dvorak layout and e-mail from Russel L. Harris rlharris@oplink.net +// on xorg list. +partial alphanumeric_keys +xkb_symbols "dvorak-classic" { + + name[Group1]= "USA - Classic Dvorak"; + + // Alphanumeric section + + key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] }; + + key <AE01> { [ bracketleft, braceleft ] }; + key <AE02> { [ 7, ampersand ] }; + key <AE03> { [ 5, percent ] }; + key <AE04> { [ 3, numbersign ] }; + key <AE05> { [ 1, exclam ] }; + key <AE06> { [ 9, parenleft, dead_grave] }; + key <AE07> { [ 0, parenright ] }; + key <AE08> { [ 2, at ] }; + key <AE09> { [ 4, dollar ] }; + key <AE10> { [ 6, asciicircum, dead_circumflex, dead_circumflex ] }; + key <AE11> { [ 8, asterisk ] }; + key <AE12> { [ bracketright, braceright, dead_tilde] }; + + key <AD01> { [ slash, question ] }; + key <AD02> { [ comma, less, dead_cedilla, dead_caron ] }; + key <AD03> { [ period, greater, dead_abovedot, periodcentered ] }; + key <AD04> { [ p, P ] }; + key <AD05> { [ y, Y ] }; + key <AD06> { [ f, F ] }; + key <AD07> { [ g, G ] }; + key <AD08> { [ c, C ] }; + key <AD09> { [ r, R ] }; + key <AD10> { [ l, L ] }; + key <AD11> { [ apostrophe, quotedbl, dead_acute, dead_diaeresis ] }; + key <AD12> { [ equal, plus ] }; + + key <AC01> { [ a, A ] }; + key <AC02> { [ o, O ] }; + key <AC03> { [ e, E ] }; + key <AC04> { [ u, U ] }; + key <AC05> { [ i, I ] }; + key <AC06> { [ d, D ] }; + key <AC07> { [ h, H ] }; + key <AC08> { [ t, T ] }; + key <AC09> { [ n, N ] }; + key <AC10> { [ s, S ] }; + key <AC11> { [ minus, underscore ] }; + + key <AB01> { [ semicolon, colon, dead_ogonek, dead_doubleacute ] }; + key <AB02> { [ q, Q ] }; + key <AB03> { [ j, J ] }; + key <AB04> { [ k, K ] }; + key <AB05> { [ x, X ] }; + key <AB06> { [ b, B ] }; + key <AB07> { [ m, M ] }; + key <AB08> { [ w, W ] }; + key <AB09> { [ v, V ] }; + key <AB10> { [ z, Z ] }; + key <BKSL> { [ backslash, bar ] }; +}; + +// Programmer Dvorak, by Roland Kaufmann <rlndkfmn at gmail dot com> +// License: BSD, available at <http://www.kaufmann.no/roland/dvorak/license.html> +// Main features: Numbers are in shift position (like French), symbols have been +// placed in locations that give good hand-alternation and finger rolling with +// symbols that usually follows, accented characters are possible for I18N. +partial alphanumeric_keys +xkb_symbols "dvp" { + include "us(dvorak)" + + name[Group1] = "USA - Programmer Dvorak"; + + // Unmodified Shift AltGr Shift+AltGr + // symbols row, left side + key <TLDE> { [ dollar, asciitilde, dead_tilde ] }; + key <AE01> { [ ampersand, percent ] }; + key <AE02> { [ bracketleft, 7, currency ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE03> { [ braceleft, 5, cent ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE04> { [ braceright, 3, yen ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE05> { [ parenleft, 1, EuroSign ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE06> { [ equal, 9, sterling ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + + // symbols row, right side + key <AE07> { [ asterisk, 0 ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE08> { [ parenright, 2, onehalf ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE09> { [ plus, 4 ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE10> { [ bracketright, 6 ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE11> { [ exclam, 8, exclamdown ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <AE12> { [ numbersign, grave, dead_grave ] }; + key <BKSP> { [ BackSpace ] }; + + // upper row, left side + key <AD01> { [ semicolon, colon, dead_diaeresis ] }; + key <AD02> { [ comma, less, guillemotleft ] }; + key <AD03> { [ period, greater, guillemotright ] }; + key <AD04> { [ p, P, paragraph, section ] }; + key <AD05> { [ y, Y, udiaeresis, Udiaeresis ] }; + + // upper row, right side + key <AD08> { [ c, C, ccedilla, Ccedilla ] }; + key <AD09> { [ r, R, registered, trademark ] }; + key <AD11> { [ slash, question, questiondown ] }; + key <AD12> { [ at, asciicircum, dead_circumflex, dead_caron ] }; + + // home row, left side + key <AC01> { [ a, A, aring, Aring ] }; + key <AC02> { [ o, O, oslash, Ooblique ] }; + key <AC03> { [ e, E, ae, AE ] }; + key <AC04> { [ u, U, eacute, Eacute ] }; + + // home row, right side + key <AC06> { [ d, D, eth, ETH ] }; + key <AC07> { [ h, H, dead_acute ] }; + key <AC08> { [ t, T, thorn, THORN ] }; + key <AC09> { [ n, N, ntilde, Ntilde ] }; + key <AC10> { [ s, S, ssharp ] }; + key <AC11> { [ minus, underscore, hyphen ], type[Group1] = "FOUR_LEVEL_ALPHABETIC" }; + key <BKSL> { [ backslash, bar ] }; + + // lower row, left side + key <AB01> { [ apostrophe, quotedbl, dead_acute ] }; +}; + +// phonetic layout for Russian letters on an US keyboard +// by Ivan Popov <pin@konvalo.org> 2005-07-17 + +// level3 modifier is a shortcut to the "us" meaning of the keys where +// we place cyrillic letters, handy for accessing the corresponding +// punctuation marks. +// It is important to have access to punctuation marks, and the rest of +// alphabetical keys are added for being consequent so that the users +// can expect the level3 modifier to give what the key label shows. + +partial alphanumeric_keys +xkb_symbols "rus" { + + name[Group1]= "USA - Russian phonetic"; + + include "us(basic)" + +key.type[group1]="FOUR_LEVEL_ALPHABETIC"; + + key <LatA> { [ Cyrillic_a, Cyrillic_A ] }; + key <LatB> { [ Cyrillic_be, Cyrillic_BE ] }; + key <LatW> { [ Cyrillic_ve, Cyrillic_VE ] }; + key <LatG> { [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <LatD> { [ Cyrillic_de, Cyrillic_DE ] }; + key <LatE> { [ Cyrillic_ie, Cyrillic_IE ] }; + key <TLDE> { [ Cyrillic_io, Cyrillic_IO, grave, asciitilde ] }; + key <LatV> { [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <LatZ> { [ Cyrillic_ze, Cyrillic_ZE ] }; + key <LatI> { [ Cyrillic_i, Cyrillic_I ] }; + key <LatJ> { [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <LatK> { [ Cyrillic_ka, Cyrillic_KA ] }; + key <LatL> { [ Cyrillic_el, Cyrillic_EL ] }; + key <LatM> { [ Cyrillic_em, Cyrillic_EM ] }; + key <LatN> { [ Cyrillic_en, Cyrillic_EN ] }; + key <LatO> { [ Cyrillic_o, Cyrillic_O ] }; + key <LatP> { [ Cyrillic_pe, Cyrillic_PE ] }; + key <LatR> { [ Cyrillic_er, Cyrillic_ER ] }; + key <LatS> { [ Cyrillic_es, Cyrillic_ES ] }; + key <LatT> { [ Cyrillic_te, Cyrillic_TE ] }; + key <LatU> { [ Cyrillic_u, Cyrillic_U ] }; + key <LatF> { [ Cyrillic_ef, Cyrillic_EF ] }; + key <LatH> { [ Cyrillic_ha, Cyrillic_HA ] }; + key <LatC> { [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AC10> { [ Cyrillic_che, Cyrillic_CHE, semicolon, colon ] }; + key <AD11> { [ Cyrillic_sha, Cyrillic_SHA, bracketleft, braceleft] }; + key <AD12> { [ Cyrillic_shcha, Cyrillic_SHCHA, bracketright, braceright ] }; + key <AE12> { [ Cyrillic_hardsign, Cyrillic_HARDSIGN, equal, plus ] }; + key <LatY> { [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <LatX> { [ Cyrillic_softsign, Cyrillic_SOFTSIGN ] }; + key <BKSL> { [ Cyrillic_e, Cyrillic_E, backslash, bar ] }; + key <AC11> { [ Cyrillic_yu, Cyrillic_YU, apostrophe, quotedbl ] }; + key <LatQ> { [ Cyrillic_ya, Cyrillic_YA ] }; + + include "level3(ralt_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "mac" { + + include "us(basic)" + name[Group1]= "USA - Macintosh"; + key.type[group1]="FOUR_LEVEL"; + + // Slightly improvised from http://homepage.mac.com/thgewecke/kblayout.jpg + key <LSGT> { [ section, plusminus, section, plusminus ] }; + key <TLDE> { [ grave, asciitilde, dead_grave, dead_horn ] }; + key <AE01> { [ 1, exclam, exclamdown, U2044 ] }; + key <AE02> { [ 2, at, trademark, EuroSign ] }; + key <AE03> { [ 3, numbersign, sterling, U2039 ] }; + key <AE04> { [ 4, dollar, cent, U203A ] }; + key <AE05> { [ 5, percent, infinity, UFB01 ] }; + key <AE06> { [ 6,asciicircum, section, UFB02 ] }; + key <AE07> { [ 7, ampersand, paragraph, doubledagger ] }; + key <AE08> { [ 8, asterisk, enfilledcircbullet, degree ] }; + key <AE09> { [ 9, parenleft, ordfeminine, periodcentered ] }; + key <AE10> { [ 0, parenright, masculine,singlelowquotemark] }; + key <AE11> { [ minus, underscore, endash, emdash ] }; + key <AE12> { [ equal, plus, notequal, plusminus ] }; + + key <AD01> { [ q, Q, oe, OE ] }; + key <AD02> { [ w, W, U2211,doublelowquotemark] }; + key <AD03> { [ e, E, dead_acute, acute ] }; + key <AD04> { [ r, R, registered, U2030 ] }; + key <AD05> { [ t, T, dagger, dead_caron ] }; + key <AD06> { [ y, Y, yen, onequarter ] }; + key <AD07> { [ u, U, dead_diaeresis, diaeresis ] }; + key <AD08> { [ i, I, dead_circumflex, U02C6 ] }; + key <AD09> { [ o, O, oslash, Ooblique ] }; + key <AD10> { [ p, P, Greek_pi, U220F ] }; + key <AD11> { [ bracketleft, braceleft, leftdoublequotemark, rightdoublequotemark ] }; + key <AD12> { [bracketright, braceright, leftsinglequotemark, rightsinglequotemark ] }; + key <BKSL> { [ backslash, bar, guillemotleft, guillemotright ] }; + + key <AC01> { [ a, A, aring, Aring ] }; + key <AC02> { [ s, S, ssharp, dead_stroke ] }; + key <AC03> { [ d, D, partialderivative, eth ] }; + key <AC04> { [ f, F, function, dead_hook ] }; + key <AC05> { [ g, G, copyright, dead_doubleacute ] }; + key <AC06> { [ h, H, dead_abovedot, dead_belowdot ] }; + key <AC07> { [ j, J, U2206, onehalf ] }; + key <AC08> { [ k, K,dead_abovering, UF8FF ] }; + + key <AC09> { [ l, L, notsign, THORN ] }; + key <AC10> { [ semicolon, colon, U2026, thorn ] }; + key <AC11> { [apostrophe, quotedbl, ae, AE ] }; + + key <AB01> { [ z, Z, Greek_OMEGA, dead_cedilla ] }; + key <AB02> { [ x, X, U2248, dead_ogonek ] }; + // unclear whether "approxeq" is 2248 or 2245 + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + key <AB04> { [ v, V, squareroot, U25CA ] }; + key <AB05> { [ b, B, integral, idotless ] }; + key <AB06> { [ n, N, dead_tilde, U02DC ] }; + key <AB07> { [ m, M, mu, threequarters ] }; + key <AB08> { [ comma, less, lessthanequal, dead_macron ] }; + key <AB09> { [ period, greater, greaterthanequal, dead_breve ] }; + key <AB10> { [ slash, question, division, questiondown ] }; + + include "level3(ralt_switch)" +}; + +// Colemak symbols for xkb on X.Org Server 7.x +// 2006-01-01 Shai Coleman, http://colemak.com/ . Public domain. + +partial alphanumeric_keys +xkb_symbols "colemak" { + include "us" + name[Group1]= "USA - Colemak"; + + // Alphanumeric section + key <TLDE> { [ grave, asciitilde, dead_tilde, asciitilde ] }; + key <AE01> { [ 1, exclam, exclamdown, onesuperior ] }; + key <AE02> { [ 2, at, masculine, twosuperior ] }; + key <AE03> { [ 3, numbersign, ordfeminine, threesuperior ] }; + key <AE04> { [ 4, dollar, cent, sterling ] }; + key <AE05> { [ 5, percent, EuroSign, yen ] }; + key <AE06> { [ 6, asciicircum, hstroke, Hstroke ] }; + key <AE07> { [ 7, ampersand, eth, ETH ] }; + key <AE08> { [ 8, asterisk, thorn, THORN ] }; + key <AE09> { [ 9, parenleft, leftsinglequotemark, leftdoublequotemark ] }; + key <AE10> { [ 0, parenright, rightsinglequotemark, rightdoublequotemark ] }; + key <AE11> { [ minus, underscore, endash, emdash ] }; + key <AE12> { [ equal, plus, multiply, division ] }; + + key <AD01> { [ q, Q, adiaeresis, Adiaeresis ] }; + key <AD02> { [ w, W, aring, Aring ] }; + key <AD03> { [ f, F, atilde, Atilde ] }; + key <AD04> { [ p, P, oslash, Ooblique ] }; + key <AD05> { [ g, G, dead_ogonek, asciitilde ] }; + key <AD06> { [ j, J, dstroke, Dstroke ] }; + key <AD07> { [ l, L, lstroke, Lstroke ] }; + key <AD08> { [ u, U, uacute, Uacute ] }; + key <AD09> { [ y, Y, udiaeresis, Udiaeresis ] }; + key <AD10> { [ semicolon, colon, odiaeresis, Odiaeresis ] }; + key <AD11> { [ bracketleft, braceleft, guillemotleft, 0x1002039 ] }; + key <AD12> { [ bracketright, braceright, guillemotright, 0x100203a ] }; + key <BKSL> { [ backslash, bar, asciitilde, asciitilde ] }; + + key <AC01> { [ a, A, aacute, Aacute ] }; + key <AC02> { [ r, R, dead_grave, asciitilde ] }; + key <AC03> { [ s, S, ssharp, asciitilde ] }; + key <AC04> { [ t, T, dead_acute, dead_doubleacute ] }; + key <AC05> { [ d, D, dead_diaeresis, asciitilde ] }; + key <AC06> { [ h, H, dead_caron, asciitilde ] }; + key <AC07> { [ n, N, ntilde, Ntilde ] }; + key <AC08> { [ e, E, eacute, Eacute ] }; + key <AC09> { [ i, I, iacute, Iacute ] }; + key <AC10> { [ o, O, oacute, Oacute ] }; + key <AC11> { [ apostrophe, quotedbl, otilde, Otilde ] }; + + key <AB01> { [ z, Z, ae, AE ] }; + key <AB02> { [ x, X, dead_circumflex, asciitilde ] }; + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + key <AB04> { [ v, V, oe, OE ] }; + key <AB05> { [ b, B, dead_breve, asciitilde ] }; + key <AB06> { [ k, K, dead_abovering, asciitilde ] }; + key <AB07> { [ m, M, dead_macron, asciitilde ] }; + key <AB08> { [ comma, less, dead_cedilla, asciitilde ] }; + key <AB09> { [ period, greater, dead_abovedot, asciitilde ] }; + key <AB10> { [ slash, question, questiondown, asciitilde ] }; + + key <CAPS> { [ BackSpace, BackSpace, BackSpace, BackSpace ] }; + key <LSGT> { [ minus, underscore, endash, emdash ] }; + key <SPCE> { [ space, space, space, nobreakspace ] }; + + include "level3(ralt_switch)" +}; + +// I do NOT like dead-keys - the International keyboard as defined by Microsoft +// doesn't fit my needs. Why use two keystrokes for all simple characters (eg ' +// and <space> generates a single ') just to have an é (eacute) in two strokes +// as well? I type ' more often than é (eacute). +// +// This file works just like a regular keyboard, BUT has all dead-keys +// accessible at level3 (through AltGr). An ë (ediaeresis) is now: AltGr+" +// followed by an e. In other words, this keyboard is not international as long +// as you leave the right Alt key alone. +// +// The original MS International keyboard was intended for Latin1 (iso8859-1). +// With the introduction of iso8859-15, the (important) ligature oe (and OE) +// became available. I added them next to ae. Because I write ediaeresis more +// often than registered, I moved registered to be next to copyright and added +// ediaeresis and idiaeresis. - Adriaan + +partial alphanumeric_keys +xkb_symbols "altgr-intl" { + + name[Group1]= "USA - International (AltGr dead keys)"; + + include "us(intl)" + +// five dead keys moved into level3: + + key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] }; + key <AC11> { [apostrophe,quotedbl, dead_acute, dead_diaeresis ] }; + +// diversions from the MS Intl keyboard: + + key <AE01> { [ 1, exclam, onesuperior, exclamdown ] }; + key <AD04> { [ r, R, ediaeresis, Ediaeresis ] }; + key <AC07> { [ j, J, idiaeresis, Idiaeresis ] }; + key <AB02> { [ x, X, oe, OE ] }; + key <AB04> { [ v, V, registered, registered ] }; + +// onequarter etc (not in iso8859-15) moved to get three unshifted deadkeys: + + key <AE06> { [ 6, asciicircum, dead_circumflex, onequarter ] }; + key <AE07> { [ 7, ampersand, dead_horn, onehalf ] }; + key <AE08> { [ 8, asterisk, dead_ogonek, threequarters ] }; + + include "level3(ralt_switch)" +}; + +// Intel ClassmatePC Keyboard Layout +// by Piter PUNK <piterpk@terra.com.br> +// +// The keyboard layouts below maps the us(basic), us(intl) and us(alt-intl) +// to ClassmatePC keyboard. All layouts uses RCTL as level3(switch) since +// the keyboard doesn't have AltGr key. The EuroSign is engraved at 5 key. + +// classmate - us(basic) +partial alphanumeric_keys +xkb_symbols "classmate" { + include "us(basic)" + name[Group1]= "USA - ClassmatePC"; + + key <LSGT> { [ backslash, bar, backslash, bar ] }; + + include "eurosign(5)" + include "level3(switch)" +}; + +// classmate-intl - us(intl) +// RCTL is generated by Fn+Alt, because that, when trying to access +// the level3 symbols at 7,8,9,0,u,i,o,p,j,k,l,;,m,. and / we got +// the keypad keycodes. The keypad is changed to make Fn+Alt+<KP_key> +// generate the same symbol as the original key. +partial alphanumeric_keys +xkb_symbols "classmate-intl" { + include "us(intl)" + name[Group1]= "USA - ClassmatePC (International)"; + key.type[Group1]="FOUR_LEVEL"; + + key <LSGT> { [ backslash, bar, backslash, bar ] }; + + key <KP7> { [ KP_Home, KP_7, + onehalf, dead_horn ] }; + key <KP8> { [ KP_Up, KP_8, + threequarters, dead_ogonek ] }; + key <KP9> { [ KP_Prior, KP_9, + leftsinglequotemark, dead_breve ] }; + key <KPMU> { [ KP_Multiply, KP_Multiply, + rightsinglequotemark, dead_abovering ] }; + + key <KP4> { [ KP_Left, KP_4, + uacute, Uacute ] }; + key <KP5> { [ KP_Begin, KP_5, + iacute, Iacute ] }; + key <KP6> { [ KP_Right, KP_6, + oacute, Oacute ] }; + key <KPSU> { [ KP_Subtract, KP_Subtract, + odiaeresis, Odiaeresis ] }; + + key <KP2> { [ KP_Down, KP_2, + oe, OE ] }; + key <KP3> { [ KP_Next, KP_3, + oslash, Ooblique ] }; + key <KPAD> { [ KP_Add, KP_Add, + paragraph, degree ] }; + + key <KP0> { [ KP_Insert, KP_0, + mu, mu ] }; + key <KPDL> { [ KP_Delete, KP_Decimal, + dead_abovedot, dead_caron ] }; + key <KPDV> { [ KP_Divide, KP_Divide, + questiondown, dead_hook ] }; + + include "level3(switch)" +}; + +// classmate-alt-intl - us(alt-intl) +// RCTL is generated by Fn+Alt, because that, when trying to access +// the level3 symbols at 7,8,9,0,u,i,o,p,j,k,l,;,m,. and / we got +// the keypad keycodes. The keypad is changed to make Fn+Alt+<KP_key> +// generate the same symbol as the original key. +partial alphanumeric_keys +xkb_symbols "classmate-alt-intl" { + include "us(alt-intl)" + name[Group1]= "USA - ClassmatePC (Alternative international)"; + key.type[Group1]="FOUR_LEVEL"; + + key <LSGT> { [ backslash, bar, backslash, bar ] }; + + key <KPSU> { [ KP_Subtract, KP_Subtract ] }; + + key <KP9> { [ KP_Prior, KP_9, + leftsinglequotemark, dead_breve ] }; + key <KPMU> { [ KP_Multiply, KP_Multiply, + rightsinglequotemark, dead_abovering ] }; + + key <KPAD> { [ KP_Add, KP_Add, + dead_ogonek, dead_diaeresis ] }; + + key <KPDL> { [ KP_Delete, KP_Decimal, + dead_abovedot, dead_circumflex ] }; + key <KPDV> { [ KP_Divide, KP_Divide, + dead_hook, dead_hook ] }; + + include "level3(switch)" +}; + +// classmate-altgr-intl - us(altgr-intl) +// RCTL is generated by Fn+Alt, because that, when trying to access +// the level3 symbols at 7,8,9,0,u,i,o,p,j,k,l,;,m,. and / we got +// the keypad keycodes. The keypad is changed to make Fn+Alt+<KP_key> +// generate the same symbol as the original key. +partial alphanumeric_keys +xkb_symbols "classmate-altgr-intl" { + include "us(altgr-intl)" + name[Group1]= "USA - ClassmatePC (International Fn+Alt dead-keys)"; + key.type[Group1]="FOUR_LEVEL"; + + key <LSGT> { [ backslash, bar, backslash, bar ] }; + + key <KP7> { [ KP_Home, KP_7, + dead_horn, dead_horn ] }; + key <KP8> { [ KP_Up, KP_8, + dead_ogonek, dead_ogonek ] }; + key <KP9> { [ KP_Prior, KP_9, + leftsinglequotemark, dead_breve ] }; + key <KPMU> { [ KP_Multiply, KP_Multiply, + rightsinglequotemark, dead_abovering ] }; + + key <KP4> { [ KP_Left, KP_4, + uacute, Uacute ] }; + key <KP5> { [ KP_Begin, KP_5, + iacute, Iacute ] }; + key <KP6> { [ KP_Right, KP_6, + oacute, Oacute ] }; + key <KPSU> { [ KP_Subtract, KP_Subtract, + odiaeresis, Odiaeresis ] }; + + key <KP1> { [ KP_End, KP_1, + idiaeresis, Idiaeresis ] }; + key <KP2> { [ KP_Down, KP_2, + oe, OE ] }; + key <KP3> { [ KP_Next, KP_3, + oslash, Ooblique ] }; + key <KPAD> { [ KP_Add, KP_Add, + paragraph, degree ] }; + + key <KP0> { [ KP_Insert, KP_0, + mu, mu ] }; + key <KPDL> { [ KP_Delete, KP_Decimal, + dead_abovedot, dead_caron ] }; + key <KPDV> { [ KP_Divide, KP_Divide, + questiondown, dead_hook ] }; + + include "level3(switch)" +}; + +partial alphanumeric_keys +xkb_symbols "olpc" { + + include "us(basic)" + name[Group1]= "USA"; + + // OLPC international US English keyboard layout. + // It's a little different from the usual international layout. + // See: http://wiki.laptop.org/go/Image:Keyboard_english.png + + key <TLDE> { [ grave, asciitilde, dead_grave, dead_tilde ] }; + key <AE01> { [ 1, exclam, exclamdown, exclamdown ] }; + key <AE02> { [ 2, at, notsign, notsign ] }; + key <AE03> { [ 3, numbersign, 0x1000300, 0x1000300 ] }; // combining grave + key <AE04> { [ 4, dollar, 0x1000301, 0x1000301 ] }; // combining acute + key <AE05> { [ 5, percent, 0x1000306, 0x1000306 ] }; // combining breve above + key <AE06> { [ 6,asciicircum, 0x100030A, 0x100030A ] }; // combining ring above + key <AE07> { [ 7, ampersand, 0x1000302, 0x1000302 ] }; // combining circumflex above + key <AE08> { [ 8, asterisk, 0x100030C, 0x100030C ] }; // combining caron above + key <AE09> { [ 9, parenleft, 0x1000307, 0x1000307 ] }; // combining dot above + key <AE10> { [ 0, parenright, 0x1000308, 0x1000308 ] }; // combining diaeresis above + key <AE11> { [ minus, underscore, 0x1000304, 0x1000304 ] }; // combining macron above + key <AE12> { [ equal, plus, 0x1000303, 0x1000303 ] }; // combining tilde above + + key <AD01> { [ q, Q, Greek_omega, Greek_OMEGA ] }; + key <AD02> { [ w, W, oslash, Oslash ] }; + key <AD03> { [ e, E, oe, OE ] }; + key <AD04> { [ r, R, 0x1000327, 0x1000327 ] }; // combining cedilla + key <AD05> { [ t, T, 0x100032E, 0x100032E ] }; // combining breve below + key <AD06> { [ y, Y, 0x1000325, 0x1000325 ] }; // combining ring below + key <AD07> { [ u, U, 0x100032D, 0x100032D ] }; // combining circumflex below + key <AD08> { [ i, I, 0x100032C, 0x100032C ] }; // combining caron below + key <AD09> { [ o, O, 0x1000323, 0x1000323 ] }; // combining dot below + key <AD10> { [ p, P, 0x1000324, 0x1000324 ] }; // combining diaeresis below + key <AD11> { [ bracketleft, braceleft, 0x1000331, 0x1000331 ] }; // combining macron below + key <AD12> { [bracketright, braceright, 0x1000330, 0x1000330 ] }; // combining tilde below + + key <AC01> { [ a, A, ae, AE ] }; + key <AC02> { [ s, S, ssharp, 0x1001E9C ] }; // uppercase S sharp + key <AC03> { [ d, D, eth, ETH ] }; + key <AC04> { [ f, F, thorn, THORN ] }; + key <AC06> { [ h, H, sterling, sterling ] }; + key <AC07> { [ j, J, EuroSign, EuroSign ] }; + key <AC10> { [ semicolon, colon, masculine, ordfeminine ] }; + key <AC11> { [ apostrophe, quotedbl, currency, currency ] }; + key <BKSL> { [ backslash, bar, section, section ] }; + + key <AB03> { [ c, C, ccedilla, Ccedilla ] }; + key <AB06> { [ n, N, ntilde, Ntilde ] }; + key <AB07> { [ m, M, mu, mu ] }; + key <AB08> { [ comma, less, guillemotleft, guillemotleft ] }; + key <AB09> { [ period, greater, guillemotright, guillemotright ] }; + key <AB10> { [ slash, question, questiondown, questiondown ] }; + + key <I219> { [ multiply, division, ISO_Next_Group, ISO_Prev_Group ] }; + + include "level3(ralt_switch)" +}; + +partial alphanumeric_keys +xkb_symbols "olpc2" { + include "us(olpc)" + name[Group1]= "USA - Layout toggle on multiply/divide key"; + include "group(olpc)" +}; + +// Based on Cherokee Nation Official Layout +// http://www.cherokee.org/extras/downloads/font/Keyboard.htm + +partial alphanumeric_keys modifier_keys +xkb_symbols "chr" { + + name[Group1]= "USA - Cherokee"; + key.type[group1]="ALPHABETIC"; + + // Alphanumeric section + key <TLDE> { [ grave, U13CA ] }; + key <AE01> { [ 1, U13B1 ] }; + key <AE02> { [ 2, U13C7 ] }; + key <AE03> { [ 3, U13E7 ] }; + key <AE04> { [ U13D9, U13B0 ] }; + key <AE05> { [ U13E6, U13B9 ] }; + key <AE06> { [ U13DC, U13DD ] }; + key <AE07> { [ U13CB, U13E1 ] }; + key <AE08> { [ U13D6, U13BA ] }; + key <AE09> { [ U13D2, parenleft ] }; + key <AE10> { [ U13C4, parenright ] }; + key <AE11> { [ U13BF, U13BC ] }; + key <AE12> { [ U13F3, U13BD ] }; + + key <AD01> { [ U13AA, U13C6 ] }; + key <AD02> { [ U13B3, U13EB ] }; + key <AD03> { [ U13A1, U13E3 ] }; + key <AD04> { [ U13DB, U13CF ] }; + key <AD05> { [ U13D4, U13D8 ] }; + key <AD06> { [ U13EF, U13F2 ] }; + key <AD07> { [ U13A4, U13AD ] }; + key <AD08> { [ U13A2, U13F1 ] }; + key <AD09> { [ U13A3, U13EC ] }; + key <AD10> { [ U13C1, U13EA ] }; + key <AD11> { [ U13D5, U13D1 ] }; + key <AD12> { [ U13B6, U13E4 ] }; + key <BKSL> { [ U13E9, U13EE ] }; + + key <AC01> { [ U13A0, U13CC ] }; + key <AC02> { [ U13CD, U13CE ] }; + key <AC03> { [ U13D7, U13D0 ] }; + key <AC04> { [ U13A9, U13C8 ] }; + key <AC05> { [ U13A6, U13E5 ] }; + key <AC06> { [ U13AF, U13B2 ] }; + key <AC07> { [ U13DA, U13AB ] }; + key <AC08> { [ U13B8, U13A7 ] }; + key <AC09> { [ U13B5, U13AE ] }; + key <AC10> { [ U13E8, U13E0 ] }; + key <AC11> { [ apostrophe, quotedbl ] }; + + key <AB01> { [ U13AC, U13C3 ] }; + key <AB02> { [ U13F4, U13ED ] }; + key <AB03> { [ U13D3, U13DF ] }; + key <AB04> { [ U13A5, U13DE ] }; + key <AB05> { [ U13A8, U13F0 ] }; + key <AB06> { [ U13BE, U13BB ] }; + key <AB07> { [ U13C5, U13B7 ] }; + key <AB08> { [ comma, U13E2 ] }; + key <AB09> { [ period, U13B4 ] }; + key <AB10> { [ U13C2, U13C9 ] }; + + // End alphanumeric section +}; + +// Serbian charecters added as third level symbols to US keyboard layout. + +partial alphanumeric_keys +xkb_symbols "hbs" { + + name[Group1]= "USA - Serbo-Croatian"; + + include "us" + + key <TLDE> { [ grave, asciitilde ] }; + key <AE06> { [ 6, dead_caron, asciicircum, asciicircum ] }; + key <AC09> { [ l, L, U1C9, U1C8 ] }; + key <AB06> { [ n, N, U1CC, U1CB ] }; + key <AB01> { [ z, Z, U1C6, U1C5 ] }; + key <AD03> { [ e, E, EuroSign, cent ] }; + key <AC03> { [ d, D, dstroke, Dstroke ] }; + key <AC11> { [ dead_acute, quotedbl, apostrophe, apostrophe ] }; + key <SPCE> { [ space, space, nobreakspace, nobreakspace ] }; + key <AB08> { [ comma, less, NoSymbol, guillemotright ] }; + key <AB09> { [ period, greater, NoSymbol, guillemotleft ] }; + + include "level3(ralt_switch)" +}; + +//based on http://upload.wikimedia.org/wikipedia/commons/1/18/T-Mobile_G1_launch_event_2.jpg +partial alphanumeric_keys +xkb_symbols "htcdream" { + include "inet(htcdream)" + name[Group1]= "USA - htcdream"; + + //second row + key <AD01> { [ q, Q, Tab, Tab ] }; + key <AD02> { [ w, W, grave, grave ] }; + key <AD03> { [ e, E, underscore, underscore ] }; + key <AD04> { [ r, R, sterling, sterling ] }; + key <AD05> { [ t, T, EuroSign, EuroSign ] }; + key <AD06> { [ y, Y, division, division ] }; + key <AD07> { [ u, U, multiply, multiply ] }; + key <AD08> { [ i, I, minus, minus ] }; + key <AD09> { [ o, O, plus, plus ] }; + key <AD10> { [ p, P, equal, equal ] }; + + //third row + key <AC01> { [ a, A, NoSymbol, NoSymbol ] }; + key <AC02> { [ s, S, bar, bar ] }; + key <AC03> { [ d ,D, backslash, backslash ] }; + key <AC04> { [ f, F, braceleft, braceleft ] }; + key <AC05> { [ g, G, braceright, braceright ] }; + key <AC06> { [ h, H, colon, colon ] }; + key <AC07> { [ j, J, semicolon, semicolon ] }; + key <AC08> { [ k, K, quotedbl, quotedbl ] }; + key <AC09> { [ l, L, apostrophe, apostrophe ] }; + + //forth row + key <AB01> { [ z, Z, NoSymbol, NoSymbol ] }; + key <AB02> { [ x, X, NoSymbol, NoSymbol ] }; + key <AB03> { [ c, C, NoSymbol, NoSymbol ] }; + key <AB04> { [ v, V, bracketleft, bracketleft ] }; + key <AB05> { [ b, B, bracketright, bracketright ] }; + key <AB06> { [ n, N, less, less ] }; + key <AB07> { [ m, M, greater, greater ] }; + key <AB08> { [ comma, comma, question, question ] }; + + //fifth row + key <FK15> { [ at, at, asciitilde, asciitilde ] }; + + include "level3(alt_switch)" +}; |