From 33a317f48eb3fe888177235ee49b635fbb8cda2f Mon Sep 17 00:00:00 2001 From: marha Date: Mon, 4 Jan 2010 15:34:07 +0000 Subject: Git update 4/1/2010 --- xorg-server/hw/dmx/dmxinput.c | 3 +- xorg-server/hw/kdrive/Xkdrive.man | 57 +++ xorg-server/hw/kdrive/ephyr/ephyr.c | 6 +- xorg-server/hw/kdrive/ephyr/ephyr.h | 1 - xorg-server/hw/kdrive/ephyr/ephyrdriext.c | 21 +- xorg-server/hw/kdrive/ephyr/ephyrglxext.c | 28 +- xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c | 94 ++++ xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h | 51 +++ xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c | 6 +- xorg-server/hw/kdrive/ephyr/ephyrproxyext.c | 119 +++++ xorg-server/hw/kdrive/ephyr/ephyrproxyext.h | 34 ++ xorg-server/hw/kdrive/ephyr/ephyrvideo.c | 19 +- xorg-server/hw/kdrive/fake/fake.c | 5 +- xorg-server/hw/kdrive/fake/fake.h | 1 - xorg-server/hw/kdrive/fbdev/Xfbdev.man | 28 ++ xorg-server/hw/kdrive/fbdev/fbdev.h | 7 +- xorg-server/hw/kdrive/linux/bus.c | 3 +- xorg-server/hw/kdrive/linux/keyboard.c | 14 +- xorg-server/hw/kdrive/linux/tslib.c | 14 +- xorg-server/hw/kdrive/src/kinfo.c | 36 +- xorg-server/hw/kdrive/src/kinput.c | 85 ++-- xorg-server/hw/kdrive/src/kxv.c | 303 ++++++------- xorg-server/hw/xfree86/common/xf86AutoConfig.c | 3 +- xorg-server/hw/xfree86/common/xf86Config.c | 211 +++++---- xorg-server/hw/xfree86/common/xf86Globals.c | 3 +- xorg-server/hw/xfree86/common/xf86Init.c | 15 + xorg-server/hw/xfree86/common/xf86Module.h | 2 +- xorg-server/hw/xfree86/common/xf86Option.c | 25 +- xorg-server/hw/xfree86/common/xf86Priv.h | 1 + xorg-server/hw/xfree86/common/xf86Xinput.c | 119 ++++- xorg-server/hw/xfree86/doc/README.modes | 474 +++++++++++++++++++ xorg-server/hw/xfree86/doc/man/Xorg.man.pre | 57 ++- xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre | 239 +++++++--- xorg-server/hw/xfree86/exa/examodule.c | 37 +- xorg-server/hw/xfree86/parser/Configint.h | 2 + xorg-server/hw/xfree86/parser/Input.c | 7 - xorg-server/hw/xfree86/parser/InputClass.c | 232 ++++++++++ xorg-server/hw/xfree86/parser/Layout.c | 96 ++-- xorg-server/hw/xfree86/parser/Makefile.am | 1 + xorg-server/hw/xfree86/parser/configProcs.h | 4 + xorg-server/hw/xfree86/parser/read.c | 8 + xorg-server/hw/xfree86/parser/scan.c | 356 +++++++++++---- xorg-server/hw/xfree86/parser/write.c | 2 + xorg-server/hw/xfree86/parser/xf86Parser.h | 47 +- xorg-server/hw/xfree86/parser/xf86tokens.h | 13 +- xorg-server/hw/xquartz/GL/glcontextmodes.c | 550 +++++++++++++++++++++++ xorg-server/hw/xquartz/GL/glcontextmodes.h | 54 +++ xorg-server/hw/xquartz/darwinXinput.c | 3 +- xorg-server/hw/xwin/InitOutput.c | 3 + xorg-server/hw/xwin/winconfig.c | 40 +- xorg-server/hw/xwin/winconfig.h | 1 + xorg-server/hw/xwin/winprocarg.c | 18 + xorg-server/hw/xwin/xlaunch/Makefile | 79 ++++ xorg-server/hw/xwin/xlaunch/config.h | 60 +++ 54 files changed, 3039 insertions(+), 658 deletions(-) create mode 100644 xorg-server/hw/kdrive/Xkdrive.man create mode 100644 xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c create mode 100644 xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h create mode 100644 xorg-server/hw/kdrive/ephyr/ephyrproxyext.c create mode 100644 xorg-server/hw/kdrive/ephyr/ephyrproxyext.h create mode 100644 xorg-server/hw/kdrive/fbdev/Xfbdev.man create mode 100644 xorg-server/hw/xfree86/doc/README.modes create mode 100644 xorg-server/hw/xfree86/parser/InputClass.c create mode 100644 xorg-server/hw/xquartz/GL/glcontextmodes.c create mode 100644 xorg-server/hw/xquartz/GL/glcontextmodes.h create mode 100644 xorg-server/hw/xwin/xlaunch/Makefile create mode 100644 xorg-server/hw/xwin/xlaunch/config.h (limited to 'xorg-server/hw') diff --git a/xorg-server/hw/dmx/dmxinput.c b/xorg-server/hw/dmx/dmxinput.c index d9118b6a0..c099349d8 100644 --- a/xorg-server/hw/dmx/dmxinput.c +++ b/xorg-server/hw/dmx/dmxinput.c @@ -103,7 +103,8 @@ void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow) } int -NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) +NewInputDeviceRequest (InputOption *options, InputAttributes *attrs, + DeviceIntPtr *pdev) { return BadRequest; } diff --git a/xorg-server/hw/kdrive/Xkdrive.man b/xorg-server/hw/kdrive/Xkdrive.man new file mode 100644 index 000000000..b37f9f10a --- /dev/null +++ b/xorg-server/hw/kdrive/Xkdrive.man @@ -0,0 +1,57 @@ +.\" $RCSId: xc/programs/Xserver/hw/kdrive/Xkdrive.man,v 1.3 2001/01/24 00:06:10 dawes Exp $ +.\" +.TH Xkdrive 1 __vendorversion__ +.SH NAME +Xkdrive \- tiny X server +.SH SYNOPSIS +.B Xvesa +.RI [ :display ] +.RI [ option ...] + +.B Xfbdev +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xkdrive +is a family of X servers designed to be particularly small. This +manual page describes the common functionality of the +.B Xkdrive +servers; for information on a specific X server, please refer to the +relevant manual page. +.SH OPTIONS +In addition to the standard options accepted by all X servers (see +Xserver(1)), all the +.B Xkdrive +servers accept the following options: +.TP 8 +.B -card \fIpcmcia\fP +use pcmcia card as additional screen. +.TP 8 +.B -dumb +disable hardware acceleration. +.TP 8 +.B -origin \fIX\fP,\fIY\fP +Locates the next screen in the Xinerama virtual screen. +.TP 8 +.B -screen \fIwidth\fBx\fIheight\fR[\fBx\fIdepth\fR[\fBx\fIfreq\fR]]\fR[\fB@\fIrotation\fR]\fB +use a screen of the specified \fIwidth\fP, \fIheight\fP, screen \fIdepth\fP, \fIfrequency\fP, and \fIrotation\fP (0, 90, 180 and 270 are legal values). +.TP 8 +.B -softCursor +disable the hardware cursor. +.TP 8 +.B -videoTest +start the server, pause momentarily, and exit. +.TP 8 +.B -zaphod +disable switching screens by moving the pointer across a screen boundary. +.TP 8 +.B -2button +enable emulation of a middle mouse button by chording. +.TP 8 +.B -3button +disable emulation of a middle mouse button by chording. +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), Xvesa(1), Xfbdev(1). +.SH AUTHORS +The Xkdrive common core was written by Keith Packard, +and is based on the Sample Implementation of X. diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.c b/xorg-server/hw/kdrive/ephyr/ephyr.c index 254fcbc54..b6a2adaff 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.c +++ b/xorg-server/hw/kdrive/ephyr/ephyr.c @@ -1074,8 +1074,7 @@ MouseInit (KdPointerInfo *pi) ((EphyrPointerPrivate *)pi->driverPrivate)->enabled = FALSE; pi->nAxes = 3; pi->nButtons = 32; - if (pi->name) - xfree(pi->name); + xfree(pi->name); pi->name = strdup("Xephyr virtual mouse"); ephyrMouse = pi; return Success; @@ -1125,8 +1124,7 @@ EphyrKeyboardInit (KdKeyboardInfo *ki) } ki->minScanCode = ephyrKeySyms.minKeyCode; ki->maxScanCode = ephyrKeySyms.maxKeyCode; - if (ki->name) - xfree(ki->name); + xfree(ki->name); ki->name = strdup("Xephyr virtual keyboard"); ephyrKbd = ki; return Success; diff --git a/xorg-server/hw/kdrive/ephyr/ephyr.h b/xorg-server/hw/kdrive/ephyr/ephyr.h index 5d58a216c..f5ea144b3 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyr.h +++ b/xorg-server/hw/kdrive/ephyr/ephyr.h @@ -63,7 +63,6 @@ typedef struct _ephyrFakexaPriv { typedef struct _ephyrScrPriv { Rotation randr; Bool shadow; - PixmapPtr pShadow; DamagePtr pDamage; EphyrFakexaPriv *fakexa; } EphyrScrPriv; diff --git a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c index f741d7420..5f5fd3bff 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrdriext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrdriext.c @@ -440,10 +440,9 @@ ephyrDRIClipNotify (WindowPtr a_win, is_ok = TRUE ; out: - if (rects) { - xfree (rects) ; - rects = NULL ; - } + xfree (rects) ; + rects = NULL ; + EPHYR_LOG ("leave. is_ok:%d\n", is_ok) ; /*do cleanup here*/ } @@ -566,10 +565,9 @@ EphyrDuplicateVisual (unsigned int a_screen, is_ok = TRUE ; out: - if (new_visuals) { - xfree (new_visuals) ; - new_visuals = NULL ; - } + xfree (new_visuals) ; + new_visuals = NULL ; + EPHYR_LOG ("leave\n") ; return is_ok ; } @@ -1254,10 +1252,9 @@ ProcXF86DRIGetDrawableInfo (register ClientPtr client) sizeof(drm_clip_rect_t) * rep.numBackClipRects, (char *)backClipRects); } - if (clipRects) { - xfree(clipRects); - clipRects = NULL ; - } + xfree(clipRects); + clipRects = NULL ; + EPHYR_LOG ("leave\n") ; return (client->noClientException); diff --git a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c index 63c4ceda4..a0278cc2b 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrglxext.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrglxext.c @@ -243,10 +243,9 @@ ephyrGLXGetVisualConfigsReal (__GLXclientState *a_cl, out: EPHYR_LOG ("leave\n") ; - if (props_buf) { - xfree (props_buf) ; - props_buf = NULL ; - } + xfree (props_buf) ; + props_buf = NULL ; + return res ; } @@ -301,10 +300,9 @@ ephyrGLXGetFBConfigsSGIXReal (__GLXclientState *a_cl, out: EPHYR_LOG ("leave\n") ; - if (props_buf) { - xfree (props_buf) ; - props_buf = NULL ; - } + xfree (props_buf) ; + props_buf = NULL ; + return res ; } @@ -391,14 +389,12 @@ ephyrGLXQueryServerString(__GLXclientState *a_cl, GLbyte *a_pc) out: EPHYR_LOG ("leave\n") ; - if (server_string) { - xfree (server_string) ; - server_string = NULL; - } - if (buf) { - xfree (buf); - buf = NULL; - } + xfree (server_string) ; + server_string = NULL; + + xfree (buf); + buf = NULL; + return res ; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c new file mode 100644 index 000000000..ce3f01852 --- /dev/null +++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.c @@ -0,0 +1,94 @@ +/* + * Xephyr - A kdrive X server thats runs in a host X window. + * Authored by Matthew Allum + * + * Copyright © 2007 OpenedHand Ltd + * + * 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 OpenedHand Ltd not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OpenedHand Ltd makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OpenedHand Ltd 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. + * + * Authors: + * Dodji Seketeli + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#define _HAVE_XALLOC_DECLS +#include "ephyrlog.h" +#include "ephyrhostproxy.h" +#include "hostx.h" + +/* byte swap a short */ +#define swaps(x, n) { \ + n = ((char *) (x))[0];\ + ((char *) (x))[0] = ((char *) (x))[1];\ + ((char *) (x))[1] = n; } + +#define GetXReq(req) \ + WORD64ALIGN ;\ + if ((dpy->bufptr + SIZEOF(xReq)) > dpy->bufmax)\ + _XFlush(dpy);\ + req = (xReq *)(dpy->last_req = dpy->bufptr);\ + dpy->bufptr += SIZEOF(xReq);\ + dpy->request++ + + +Bool +ephyrHostProxyDoForward (pointer a_request_buffer, + struct XReply *a_reply, + Bool a_do_swap) +{ + Bool is_ok = FALSE ; + int n=0 ; + Display *dpy=hostx_get_display () ; + xReq *in_req = (xReq*) a_request_buffer ; + xReq *forward_req=NULL ; + struct XReply reply ; + + EPHYR_RETURN_VAL_IF_FAIL (in_req && dpy, FALSE) ; + + EPHYR_LOG ("enter\n") ; + + if (a_do_swap) { + swaps (&in_req->length, n) ; + } + EPHYR_LOG ("Req {type:%d, data:%d, length:%d}\n", + in_req->reqType, in_req->data, in_req->length) ; + GetXReq (forward_req) ; + memmove (forward_req, in_req, 4) ; + + if (!_XReply (dpy, (xReply*) &reply, 0, FALSE)) { + EPHYR_LOG_ERROR ("failed to get reply\n") ; + goto out; + } + EPHYR_LOG ("XReply{type:%d, foo:%d, seqnum:%d, length:%d}\n", + reply.type, reply.foo, reply.sequence_number, reply.length) ; + + if (a_reply) { + memmove (a_reply, &reply, sizeof (reply)) ; + } + is_ok = TRUE ; + +out: + EPHYR_LOG ("leave\n") ; + return is_ok ; +} + diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h new file mode 100644 index 000000000..720c986ff --- /dev/null +++ b/xorg-server/hw/kdrive/ephyr/ephyrhostproxy.h @@ -0,0 +1,51 @@ +/* + * Xephyr - A kdrive X server thats runs in a host X window. + * Authored by Matthew Allum + * + * Copyright © 2007 OpenedHand Ltd + * + * 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 OpenedHand Ltd not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OpenedHand Ltd makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OpenedHand Ltd 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. + * + * Authors: + * Dodji Seketeli + */ + +#ifndef __EPHYRHOSTPROXY_H__ +#define __EPHYRHOSTPROXY_H__ + +struct XReply { + int8_t type ;/*X_Reply*/ + int8_t foo; + int16_t sequence_number ; + int32_t length ; + /*following is some data up to 32 bytes lenght*/ + int32_t pad0 ; + int32_t pad1 ; + int32_t pad2 ; + int32_t pad3 ; + int32_t pad4 ; + int32_t pad5 ; +}; + +Bool +ephyrHostProxyDoForward (pointer a_request_buffer, + struct XReply *a_reply, + Bool a_do_swap) ; + +#endif /*__EPHYRHOSTPROXY_H__*/ diff --git a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c index 41c0b755b..f4a1b9d17 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrhostvideo.c @@ -485,10 +485,8 @@ ephyrHostEncodingsDelete (EphyrHostEncoding *a_encodings, if (!a_encodings) return ; for (i=0; i < a_num_encodings; i++) { - if (a_encodings[i].name) { - xfree (a_encodings[i].name) ; - a_encodings[i].name = NULL ; - } + xfree (a_encodings[i].name) ; + a_encodings[i].name = NULL ; } xfree (a_encodings) ; } diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c new file mode 100644 index 000000000..0c070f4c7 --- /dev/null +++ b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.c @@ -0,0 +1,119 @@ +/* + * Xephyr - A kdrive X server thats runs in a host X window. + * Authored by Matthew Allum + * + * Copyright © 2007 OpenedHand Ltd + * + * 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 OpenedHand Ltd not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OpenedHand Ltd makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OpenedHand Ltd 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. + * + * Authors: + * Dodji Seketeli + */ + +/* + * \file + * This file defines a proxy extension that forwards requests. + * When a request to extension FOO is sent to Xephyr, that request is forwared + * to the host X, without even trying to know what the request means. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include "misc.h" +#include "dixstruct.h" +#include "extnsionst.h" +#include "ephyrproxyext.h" +#define _HAVE_XALLOC_DECLS +#include "ephyrlog.h" +#include "ephyrhostproxy.h" +#include "hostx.h" + +static Bool ephyrProxyGetHostExtensionInfo (const char *a_ext_name, + int *a_major_opcode, + int *a_first_event, + int *a_first_error) ; + +static int ephyrProxyProcDispatch (ClientPtr client) ; + +static Bool +ephyrProxyGetHostExtensionInfo (const char *a_ext_name, + int *a_major_opcode, + int *a_first_event, + int *a_first_error) +{ + return hostx_get_extension_info (a_ext_name, a_major_opcode, + a_first_event, a_first_error) ; +} + +static int +ephyrProxyProcDispatch (ClientPtr a_client) +{ + int res=BadImplementation ; + struct XReply reply ; + + if (!ephyrHostProxyDoForward (a_client->requestBuffer, &reply, FALSE)) { + EPHYR_LOG_ERROR ("forwarding failed\n") ; + goto out ; + } + reply.sequence_number = a_client->sequence; + res = Success ; + + WriteToClient(a_client, 32, (char *)&reply); + +out: + return res ; +} + +static void +ephyrProxyProcReset (ExtensionEntry *a_entry) +{ +} + +Bool +ephyrProxyExtensionInit (const char *a_extension_name) +{ + Bool is_ok = FALSE ; + int major_opcode=0, first_event=0, first_error=0; + ExtensionEntry *ext=NULL ; + + if (!ephyrProxyGetHostExtensionInfo (a_extension_name, + &major_opcode, + &first_event, + &first_error)) { + EPHYR_LOG ("failed to query extension %s from host\n", a_extension_name) ; + goto out; + } + ext = AddExtension ((char*)a_extension_name, 0, 0, + ephyrProxyProcDispatch, + ephyrProxyProcDispatch, + ephyrProxyProcReset, + StandardMinorOpcode) ; + if (!ext) { + EPHYR_LOG_ERROR ("failed to add the extension\n") ; + goto out ; + } + is_ok = TRUE ; + +out: + EPHYR_LOG ("leave\n") ; + return is_ok ; +} + diff --git a/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h new file mode 100644 index 000000000..e52f8d887 --- /dev/null +++ b/xorg-server/hw/kdrive/ephyr/ephyrproxyext.h @@ -0,0 +1,34 @@ +/* + * Xephyr - A kdrive X server thats runs in a host X window. + * Authored by Matthew Allum + * + * Copyright © 2007 OpenedHand Ltd + * + * 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 OpenedHand Ltd not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OpenedHand Ltd makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * OpenedHand Ltd DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OpenedHand Ltd 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. + * + * Authors: + * Dodji Seketeli + */ +#ifndef __EPHYRPROXYEXT_H__ +#define __EPHYRPROXYEXT_H__ + +Bool ephyrProxyExtensionInit (const char *a_extension_name) ; + +#endif /*__EPHYRPROXYEXT_H__*/ + diff --git a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c index 5058ebe03..bb2ee1032 100644 --- a/xorg-server/hw/kdrive/ephyr/ephyrvideo.c +++ b/xorg-server/hw/kdrive/ephyr/ephyrvideo.c @@ -371,10 +371,8 @@ ephyrXVPrivDelete (EphyrXVPriv *a_this) ephyrHostXVAdaptorArrayDelete (a_this->host_adaptors) ; a_this->host_adaptors = NULL ; } - if (a_this->adaptors) { - xfree (a_this->adaptors) ; - a_this->adaptors = NULL ; - } + xfree (a_this->adaptors) ; + a_this->adaptors = NULL ; xfree (a_this) ; EPHYR_LOG ("leave\n") ; } @@ -675,14 +673,11 @@ ephyrXVPrivRegisterAdaptors (EphyrXVPriv *a_this, is_ok = TRUE ; out: - if (registered_adaptors) { - xfree (registered_adaptors) ; - registered_adaptors = NULL ; - } - if (adaptors) { - xfree (adaptors) ; - adaptors=NULL ; - } + xfree (registered_adaptors) ; + registered_adaptors = NULL ; + xfree (adaptors) ; + adaptors = NULL ; + EPHYR_LOG ("leave\n") ; return is_ok ; } diff --git a/xorg-server/hw/kdrive/fake/fake.c b/xorg-server/hw/kdrive/fake/fake.c index ff597981d..ea88f0edb 100644 --- a/xorg-server/hw/kdrive/fake/fake.c +++ b/xorg-server/hw/kdrive/fake/fake.c @@ -457,9 +457,8 @@ void fakeCardFini (KdCardInfo *card) { FakePriv *priv = card->driver; - - if (priv->base) - free (priv->base); + + free (priv->base); xfree (priv); } diff --git a/xorg-server/hw/kdrive/fake/fake.h b/xorg-server/hw/kdrive/fake/fake.h index 88d209674..3c4a51bbc 100644 --- a/xorg-server/hw/kdrive/fake/fake.h +++ b/xorg-server/hw/kdrive/fake/fake.h @@ -38,7 +38,6 @@ typedef struct _fakePriv { typedef struct _fakeScrPriv { Rotation randr; Bool shadow; - PixmapPtr pShadow; } FakeScrPriv; extern KdCardFuncs fakeFuncs; diff --git a/xorg-server/hw/kdrive/fbdev/Xfbdev.man b/xorg-server/hw/kdrive/fbdev/Xfbdev.man new file mode 100644 index 000000000..bfdae168f --- /dev/null +++ b/xorg-server/hw/kdrive/fbdev/Xfbdev.man @@ -0,0 +1,28 @@ +.\" $RCSId: xc/programs/Xserver/hw/kdrive/fbdev/Xfbdev.man,v 1.4 2001/01/27 18:20:40 dawes Exp $ +.\" +.TH Xfbdev 1 __vendorversion__ +.SH NAME +Xfbdev \- Linux framebuffer device tiny X server +.SH SYNOPSIS +.B Xfbdev +.RI [ :display ] +.RI [ option ...] +.SH DESCRIPTION +.B Xfbdev +is a generic X server for Linux. +.B Xfbdev +doesn't know about any particular hardware, and uses the framebuffer +provided by the Linux framebuffer device. +.SH OPTIONS +.B Xfbdev +accepts the common options of the Xkdrive family of servers. Please +see Xkdrive(1). +.SH KEYBOARD +To be written. +.SH SEE ALSO +X(__miscmansuffix__), Xserver(1), Xkdrive(1), xdm(1), xinit(1). +.SH AUTHORS +The +.B Xfbdev +server was written by Keith Packard. + diff --git a/xorg-server/hw/kdrive/fbdev/fbdev.h b/xorg-server/hw/kdrive/fbdev/fbdev.h index 9e322dacb..3da8e4753 100644 --- a/xorg-server/hw/kdrive/fbdev/fbdev.h +++ b/xorg-server/hw/kdrive/fbdev/fbdev.h @@ -42,11 +42,10 @@ typedef struct _fbdevPriv { char *fb; char *fb_base; } FbdevPriv; - + typedef struct _fbdevScrPriv { Rotation randr; Bool shadow; - PixmapPtr pShadow; } FbdevScrPriv; extern KdCardFuncs fbdevFuncs; @@ -63,7 +62,7 @@ fbdevScreenInit (KdScreenInfo *screen); Bool fbdevScreenInitialize (KdScreenInfo *screen, FbdevScrPriv *scrpriv); - + Bool fbdevInitScreen (ScreenPtr pScreen); @@ -122,7 +121,7 @@ fbdevSetShadow (ScreenPtr pScreen); Bool fbdevCreateColormap (ColormapPtr pmap); - + #ifdef RANDR Bool fbdevRandRGetInfo (ScreenPtr pScreen, Rotation *rotations); diff --git a/xorg-server/hw/kdrive/linux/bus.c b/xorg-server/hw/kdrive/linux/bus.c index 93c3ea5f3..de9b90f5a 100644 --- a/xorg-server/hw/kdrive/linux/bus.c +++ b/xorg-server/hw/kdrive/linux/bus.c @@ -75,8 +75,7 @@ BusInit (KdPointerInfo *pi) if ((fd = open (BusNames[i], 0)) >= 0) { close(fd); - if (pi->path) - xfree(pi->path); + xfree(pi->path); pi->path = strdup(BusNames[i]); return Success; } diff --git a/xorg-server/hw/kdrive/linux/keyboard.c b/xorg-server/hw/kdrive/linux/keyboard.c index 79cf59898..6eed7aed3 100644 --- a/xorg-server/hw/kdrive/linux/keyboard.c +++ b/xorg-server/hw/kdrive/linux/keyboard.c @@ -231,7 +231,7 @@ readKernelMapping(KdKeyboardInfo *ki) return; fd = LinuxConsoleFd; - + minKeyCode = NR_KEYS; maxKeyCode = 0; row = 0; @@ -241,7 +241,7 @@ readKernelMapping(KdKeyboardInfo *ki) kbe.kb_index = LNX_KEY_INDEX(i); k = ki->keySyms.map + row * ki->keySyms.mapWidth; - + for (j = 0; j < ki->keySyms.mapWidth; ++j) { unsigned short kval; @@ -463,7 +463,7 @@ readKernelMapping(KdKeyboardInfo *ki) k[j] = (kbe.kb_value & 0xFF) + 0x1008FF00; break; #endif - + default: break; } @@ -720,7 +720,7 @@ static void LinuxKeyboardDisable (KdKeyboardInfo *ki) { int fd; - + if (!ki) return; @@ -737,11 +737,9 @@ LinuxKeyboardInit (KdKeyboardInfo *ki) if (!ki) return !Success; - if (ki->path) - xfree(ki->path); + xfree(ki->path); ki->path = strdup("console"); - if (ki->name) - xfree(ki->name); + xfree(ki->name); ki->name = strdup("Linux console keyboard"); readKernelMapping (ki); diff --git a/xorg-server/hw/kdrive/linux/tslib.c b/xorg-server/hw/kdrive/linux/tslib.c index 7cc23e637..322ccc7d5 100644 --- a/xorg-server/hw/kdrive/linux/tslib.c +++ b/xorg-server/hw/kdrive/linux/tslib.c @@ -9,7 +9,7 @@ * Copyright © 2002 MontaVista Software Inc. * Copyright © 2005 OpenedHand Ltd. * Copyright © 2006 Nokia Corporation - * + * * 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 @@ -76,7 +76,7 @@ TsRead (int fd, void *closure) if (event.pressure) { flags = KD_BUTTON_1; - /* + /* * Here we test for the touch screen driver actually being on the * touch screen, if it is we send absolute coordinates. If not, * then we send delta's so that we can track the entire vga screen. @@ -127,7 +127,7 @@ TslibEnable (KdPointerInfo *pi) } KdRegisterFd(private->fd, TsRead, pi); - + return Success; } @@ -155,7 +155,7 @@ TslibInit (KdPointerInfo *pi) if (!pi || !pi->dixdev) return !Success; - + pi->driverPrivate = (struct TslibPrivate *) xcalloc(sizeof(struct TslibPrivate), 1); if (!pi->driverPrivate) @@ -175,10 +175,8 @@ TslibInit (KdPointerInfo *pi) static void TslibFini (KdPointerInfo *pi) { - if (pi->driverPrivate) { - xfree(pi->driverPrivate); - pi->driverPrivate = NULL; - } + xfree(pi->driverPrivate); + pi->driverPrivate = NULL; } diff --git a/xorg-server/hw/kdrive/src/kinfo.c b/xorg-server/hw/kdrive/src/kinfo.c index 4551fd76b..95afc7963 100644 --- a/xorg-server/hw/kdrive/src/kinfo.c +++ b/xorg-server/hw/kdrive/src/kinfo.c @@ -138,40 +138,28 @@ KdFreePointer(KdPointerInfo *pi) { InputOption *option, *prev = NULL; - if (pi->name) - xfree(pi->name); - if (pi->path) - xfree(pi->path); + xfree(pi->name); + xfree(pi->path); for (option = pi->options; option; option = option->next) { - if (prev) - xfree(prev); - if (option->key) - xfree(option->key); - if (option->value) - xfree(option->value); + xfree(prev); + xfree(option->key); + xfree(option->value); prev = option; } - if (prev) - xfree(prev); - + xfree(prev); xfree(pi); } - + void KdFreeKeyboard(KdKeyboardInfo *ki) { - if (ki->name) - xfree(ki->name); - if (ki->path) - xfree(ki->path); - if (ki->xkbRules) - xfree(ki->xkbRules); - if (ki->xkbModel) - xfree(ki->xkbModel); - if (ki->xkbLayout) - xfree(ki->xkbLayout); + xfree(ki->name); + xfree(ki->path); + xfree(ki->xkbRules); + xfree(ki->xkbModel); + xfree(ki->xkbLayout); ki->next = NULL; xfree(ki); } diff --git a/xorg-server/hw/kdrive/src/kinput.c b/xorg-server/hw/kdrive/src/kinput.c index 65fc75a54..a88f2dc61 100644 --- a/xorg-server/hw/kdrive/src/kinput.c +++ b/xorg-server/hw/kdrive/src/kinput.c @@ -76,7 +76,7 @@ static KdPointerMatrix kdPointerMatrix = { }; void KdResetInputMachine (void); - + #define KD_MAX_INPUT_FDS 8 typedef struct _kdInputFd { @@ -105,7 +105,7 @@ static void KdBlockSigio (void) { sigset_t set; - + sigemptyset (&set); sigaddset (&set, SIGIO); sigprocmask (SIG_BLOCK, &set, 0); @@ -115,7 +115,7 @@ static void KdUnblockSigio (void) { sigset_t set; - + sigemptyset (&set); sigaddset (&set, SIGIO); sigprocmask (SIG_UNBLOCK, &set, 0); @@ -175,7 +175,7 @@ KdAddFd (int fd) { struct sigaction act; sigset_t set; - + kdnFds++; fcntl (fd, F_SETOWN, getpid()); KdNonBlockFd (fd); @@ -196,7 +196,7 @@ KdRemoveFd (int fd) { struct sigaction act; int flags; - + kdnFds--; RemoveEnabledDevice (fd); flags = fcntl (fd, F_GETFL); @@ -324,7 +324,7 @@ KdEnableInput (void) InternalEvent ev; KdKeyboardInfo *ki; KdPointerInfo *pi; - + kdInputEnabled = TRUE; for (ki = kdKeyboards; ki; ki = ki->next) { @@ -352,7 +352,7 @@ KdFindKeyboardDriver (char *name) /* ask a stupid question ... */ if (!name) return NULL; - + for (ret = kdKeyboardDrivers; ret; ret = ret->next) { if (strcmp(ret->name, name) == 0) return ret; @@ -487,11 +487,11 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff) pi->name ? pi->name : "Generic KDrive Pointer"); return Success; - + case DEVICE_ON: if (pDev->on == TRUE) return Success; - + if (!pi->driver->Enable) { ErrorF("no enable function\n"); return BadImplementation; @@ -538,7 +538,7 @@ KdPointerProc(DeviceIntPtr pDevice, int onoff) (*pi->driver->Fini) (pi); KdRemovePointer(pi); - + return Success; } @@ -557,7 +557,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something) { KeybdCtrl *ctrl = arg; KdKeyboardInfo *ki = NULL; - + for (ki = kdKeyboards; ki; ki = ki->next) { if (ki->dixdev && ki->dixdev->id == pDev->id) break; @@ -565,7 +565,7 @@ KdBell (int volume, DeviceIntPtr pDev, pointer arg, int something) if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) return; - + KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); } @@ -590,7 +590,7 @@ KdRingBell(KdKeyboardInfo *ki, int volume, int pitch, int duration) { if (!ki || !ki->driver || !ki->driver->Bell) return; - + if (kdInputEnabled) (*ki->driver->Bell) (ki, volume, pitch, duration); } @@ -691,7 +691,7 @@ KdKbdCtrl (DeviceIntPtr pDevice, KeybdCtrl *ctrl) KdSetLeds(ki, ctrl->leds); ki->bellPitch = ctrl->bell_pitch; - ki->bellDuration = ctrl->bell_duration; + ki->bellDuration = ctrl->bell_duration; } extern KeybdCtrl defaultKeyboardControl; @@ -794,7 +794,7 @@ KdKeyboardProc(DeviceIntPtr pDevice, int onoff) pDev->on = FALSE; return Success; - + break; case DEVICE_CLOSE: @@ -935,7 +935,7 @@ KdAddKeyboard (KdKeyboardInfo *ki) if (!ki) return !Success; - + ki->dixdev = AddInputDevice(serverClient, KdKeyboardProc, TRUE); if (!ki->dixdev) { ErrorF("Couldn't register keyboard device %s\n", @@ -1042,12 +1042,12 @@ KdRemovePointer (KdPointerInfo *pi) KdFreePointer(pi); } -/* +/* * You can call your kdriver server with something like: * $ ./hw/kdrive/yourserver/X :1 -mouse evdev,,device=/dev/input/event4 -keybd - * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br + * evdev,,device=/dev/input/event1,xkbmodel=abnt2,xkblayout=br */ -static Bool +static Bool KdGetOptions (InputOption **options, char *string) { InputOption *newopt = NULL, **tmpo = NULL; @@ -1058,7 +1058,7 @@ KdGetOptions (InputOption **options, char *string) return FALSE; for (tmpo = options; *tmpo; tmpo = &(*tmpo)->next) - ; /* Hello, I'm here */ + ; /* Hello, I'm here */ *tmpo = newopt; if (strchr(string, '=')) @@ -1099,7 +1099,7 @@ KdParseKbdOptions (KdKeyboardInfo *ki) else if (!strcasecmp (option->key, "device")) ki->path = strdup(option->value); else - ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", + ErrorF("Kbd option key (%s) of value (%s) not assigned!\n", option->key, option->value); } } @@ -1160,11 +1160,11 @@ KdParseKeyboard (char *arg) { arg = KdParseFindNext (arg, ",", save, &delim); - if (!KdGetOptions(&options, save)) + if (!KdGetOptions(&options, save)) { KdFreeKeyboard(ki); return NULL; - } + } } if (options) @@ -1196,7 +1196,7 @@ KdParsePointerOptions (KdPointerInfo *pi) else if (!strcasecmp (option->key, "protocol")) pi->protocol = strdup(option->value); else - ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", + ErrorF("Pointer option key (%s) of value (%s) not assigned!\n", option->key, option->value); } } @@ -1448,7 +1448,7 @@ KdInitInput (void) * <> -> (deliver) synthetic_2_down_1 * k -> (deliver) synthetic_2_down_1 */ - + typedef enum _inputClass { down_1, up_1, down_2, up_2, @@ -1628,7 +1628,7 @@ KdInsideEmulationWindow (KdPointerInfo *pi, int x, int y, int z) return (abs (pi->emulationDx) < EMULATION_WINDOW && abs (pi->emulationDy) < EMULATION_WINDOW); } - + static KdInputClass KdClassifyInput (KdPointerInfo *pi, int type, int x, int y, int z, int b) { @@ -1906,7 +1906,7 @@ KdEnqueuePointerEvent(KdPointerInfo *pi, unsigned long flags, int rx, int ry, if (!pi) return; - + ms = GetTimeInMillis(); /* we don't need to transform z, so we don't. */ @@ -2001,7 +2001,7 @@ KdBlockHandler (int screen, if (pi->timeoutPending) { int ms; - + ms = pi->emulationTimeout - GetTimeInMillis (); if (ms < 1) ms = 1; @@ -2020,7 +2020,7 @@ KdBlockHandler (int screen, } void -KdWakeupHandler (int screen, +KdWakeupHandler (int screen, pointer data, unsigned long lresult, pointer readmask) @@ -2029,7 +2029,7 @@ KdWakeupHandler (int screen, fd_set *pReadmask = (fd_set *) readmask; int i; KdPointerInfo *pi; - + if (kdInputEnabled && result > 0) { for (i = 0; i < kdNumInputFds; i++) @@ -2069,13 +2069,13 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) int best_x, best_y; int n_best_x, n_best_y; CARD32 ms; - + if (kdDisableZaphod || screenInfo.numScreens <= 1) return FALSE; if (0 <= *x && *x < pScreen->width && 0 <= *y && *y < pScreen->height) return FALSE; - + ms = GetTimeInMillis (); if (kdOffScreen && (int) (ms - kdOffScreenTime) < 1000) return FALSE; @@ -2088,7 +2088,7 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) for (n = 0; n < screenInfo.numScreens; n++) { pNewScreen = screenInfo.screens[n]; - if (pNewScreen == pScreen) + if (pNewScreen == pScreen) continue; dx = KdScreenOrigin(pNewScreen)->x - KdScreenOrigin(pScreen)->x; dy = KdScreenOrigin(pNewScreen)->y - KdScreenOrigin(pScreen)->y; @@ -2130,17 +2130,17 @@ KdCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) if (n_best_x == -1) return FALSE; pNewScreen = screenInfo.screens[n_best_x]; - + if (*x < 0) *x += pNewScreen->width; if (*y < 0) *y += pNewScreen->height; - + if (*x >= pScreen->width) *x -= pScreen->width; if (*y >= pScreen->height) *y -= pScreen->height; - + *ppScreen = pNewScreen; return TRUE; } @@ -2167,7 +2167,7 @@ KdWarpCursor (DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) KdUnblockSigio (); } -miPointerScreenFuncRec kdPointerScreenFuncs = +miPointerScreenFuncRec kdPointerScreenFuncs = { KdCursorOffScreen, KdCrossScreen, @@ -2249,7 +2249,8 @@ ChangeDeviceControl(register ClientPtr client, DeviceIntPtr pDev, } int -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) +NewInputDeviceRequest(InputOption *options, InputAttributes *attrs, + DeviceIntPtr *pdev) { InputOption *option = NULL; KdPointerInfo *pi = NULL; @@ -2279,6 +2280,14 @@ NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) ErrorF("Ignoring device from HAL.\n"); return BadValue; } +#endif +#ifdef CONFIG_UDEV + else if (strcmp(option->key, "_source") == 0 && + strcmp(option->value, "server/udev") == 0) + { + ErrorF("Ignoring device from udev.\n"); + return BadValue; + } #endif } diff --git a/xorg-server/hw/kdrive/src/kxv.c b/xorg-server/hw/kdrive/src/kxv.c index 9a74654af..27ecc5d6c 100644 --- a/xorg-server/hw/kdrive/src/kxv.c +++ b/xorg-server/hw/kdrive/src/kxv.c @@ -1,6 +1,6 @@ -/* +/* - XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) + XFree86 Xv DDX written by Mark Vojkovich (markv@valinux.com) Adapted for KDrive by Pontus Lidman Copyright (C) 2000, 2001 - Nokia Home Communications @@ -67,29 +67,29 @@ static int KdXVQueryAdaptors(ScreenPtr, XvAdaptorPtr *, int *); static int KdXVAllocatePort(unsigned long, XvPortPtr, XvPortPtr*); static int KdXVFreePort(XvPortPtr); static int KdXVPutVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVPutStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVGetVideo(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVGetStill(ClientPtr, DrawablePtr,XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16); static int KdXVStopVideo(ClientPtr, XvPortPtr, DrawablePtr); static int KdXVSetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32); static int KdXVGetPortAttribute(ClientPtr, XvPortPtr, Atom, INT32 *); static int KdXVQueryBestSize(ClientPtr, XvPortPtr, CARD8, - CARD16, CARD16,CARD16, CARD16, + CARD16, CARD16,CARD16, CARD16, unsigned int*, unsigned int*); static int KdXVPutImage(ClientPtr, DrawablePtr, XvPortPtr, GCPtr, - INT16, INT16, CARD16, CARD16, + INT16, INT16, CARD16, CARD16, INT16, INT16, CARD16, CARD16, XvImagePtr, unsigned char*, Bool, CARD16, CARD16); -static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, +static int KdXVQueryImageAttributes(ClientPtr, XvPortPtr, XvImagePtr, CARD16*, CARD16*, int*, int*); @@ -134,12 +134,12 @@ KdXVRegisterGenericAdaptorDriver( /* fprintf(stderr,"KdXVRegisterGenericAdaptorDriver\n"); */ - newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * + newdrivers = xrealloc(GenDrivers, sizeof(KdXVInitGenericAdaptorPtr) * (1 + NumGenDrivers)); if (!newdrivers) return 0; GenDrivers = newdrivers; - + GenDrivers[NumGenDrivers++] = InitFunc; return 1; @@ -184,7 +184,7 @@ KdXVFreeVideoAdaptorRec(KdVideoAdaptorPtr ptr) Bool KdXVScreenInit( - ScreenPtr pScreen, + ScreenPtr pScreen, KdVideoAdaptorPtr *adaptors, int num ){ @@ -197,7 +197,7 @@ KdXVScreenInit( KdXVGeneration = serverGeneration; if(!XvGetScreenKeyProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; + return FALSE; if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; @@ -247,20 +247,18 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) { int i; - if(pAdaptor->name) - xfree(pAdaptor->name); + xfree(pAdaptor->name); if(pAdaptor->pEncodings) { XvEncodingPtr pEncode = pAdaptor->pEncodings; for(i = 0; i < pAdaptor->nEncodings; i++, pEncode++) { - if(pEncode->name) xfree(pEncode->name); + xfree(pEncode->name); } xfree(pAdaptor->pEncodings); } - if(pAdaptor->pFormats) - xfree(pAdaptor->pFormats); + xfree(pAdaptor->pFormats); if(pAdaptor->pPorts) { XvPortPtr pPort = pAdaptor->pPorts; @@ -269,9 +267,9 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) for(i = 0; i < pAdaptor->nPorts; i++, pPort++) { pPriv = (XvPortRecPrivatePtr)pPort->devPriv.ptr; if(pPriv) { - if(pPriv->clientClip) + if(pPriv->clientClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->clientClip); - if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) + if(pPriv->pCompositeClip && pPriv->FreeCompositeClip) REGION_DESTROY(pAdaptor->pScreen, pPriv->pCompositeClip); xfree(pPriv); } @@ -283,22 +281,20 @@ KdXVFreeAdaptor(XvAdaptorPtr pAdaptor) XvAttributePtr pAttribute = pAdaptor->pAttributes; for(i = 0; i < pAdaptor->nAttributes; i++, pAttribute++) { - if(pAttribute->name) xfree(pAttribute->name); + xfree(pAttribute->name); } xfree(pAdaptor->pAttributes); } - if(pAdaptor->nImages) - xfree(pAdaptor->pImages); - - if(pAdaptor->devPriv.ptr) - xfree(pAdaptor->devPriv.ptr); + xfree(pAdaptor->pImages); + + xfree(pAdaptor->devPriv.ptr); } static Bool KdXVInitAdaptors( - ScreenPtr pScreen, + ScreenPtr pScreen, KdVideoAdaptorPtr *infoPtr, int number ) { @@ -329,7 +325,7 @@ KdXVInitAdaptors( pxvs->nAdaptors = 0; pxvs->pAdaptors = NULL; - if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) + if(!(pAdaptor = xcalloc(number, sizeof(XvAdaptorRec)))) return FALSE; for(pa = pAdaptor, na = 0, numAdaptor = 0; na < number; na++, adaptorPtr++) { @@ -343,7 +339,7 @@ KdXVInitAdaptors( if(!adaptorPtr->nEncodings || !adaptorPtr->pEncodings) continue; - pa->type = adaptorPtr->type; + pa->type = adaptorPtr->type; if(!adaptorPtr->PutVideo && !adaptorPtr->GetVideo) pa->type &= ~XvVideoMask; @@ -354,19 +350,19 @@ KdXVInitAdaptors( if(!adaptorPtr->PutImage || !adaptorPtr->QueryImageAttributes) pa->type &= ~XvImageMask; - if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && + if(!adaptorPtr->PutVideo && !adaptorPtr->PutImage && !adaptorPtr->PutStill) pa->type &= ~XvInputMask; if(!adaptorPtr->GetVideo && !adaptorPtr->GetStill) pa->type &= ~XvOutputMask; - - if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) + + if(!(adaptorPtr->type & (XvPixmapMask | XvWindowMask))) continue; - if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) + if(!(adaptorPtr->type & (XvImageMask | XvVideoMask | XvStillMask))) continue; - pa->pScreen = pScreen; + pa->pScreen = pScreen; pa->ddAllocatePort = KdXVAllocatePort; pa->ddFreePort = KdXVFreePort; pa->ddPutVideo = KdXVPutVideo; @@ -385,8 +381,8 @@ KdXVInitAdaptors( if(adaptorPtr->nEncodings && (pEncode = xcalloc(adaptorPtr->nEncodings, sizeof(XvEncodingRec)))) { - for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; - i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) + for(pe = pEncode, encodingPtr = adaptorPtr->pEncodings, i = 0; + i < adaptorPtr->nEncodings; pe++, i++, encodingPtr++) { pe->id = encodingPtr->id; pe->pScreen = pScreen; @@ -398,14 +394,14 @@ KdXVInitAdaptors( pe->rate.denominator = encodingPtr->rate.denominator; } pa->nEncodings = adaptorPtr->nEncodings; - pa->pEncodings = pEncode; - } + pa->pEncodings = pEncode; + } if(adaptorPtr->nImages && (pImage = xcalloc(adaptorPtr->nImages, sizeof(XvImageRec)))) { for(i = 0, pi = pImage, imagePtr = adaptorPtr->pImages; - i < adaptorPtr->nImages; i++, pi++, imagePtr++) + i < adaptorPtr->nImages; i++, pi++, imagePtr++) { pi->id = imagePtr->id; pi->type = imagePtr->type; @@ -437,8 +433,8 @@ KdXVInitAdaptors( if(adaptorPtr->nAttributes && (pAttribute = xcalloc(adaptorPtr->nAttributes, sizeof(XvAttributeRec)))) { - for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; - i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) + for(pat = pAttribute, attributePtr = adaptorPtr->pAttributes, i = 0; + i < adaptorPtr->nAttributes; pat++, i++, attributePtr++) { pat->flags = attributePtr->flags; pat->min_value = attributePtr->min_value; @@ -447,8 +443,8 @@ KdXVInitAdaptors( strcpy(pat->name, attributePtr->name); } pa->nAttributes = adaptorPtr->nAttributes; - pa->pAttributes = pAttribute; - } + pa->pAttributes = pAttribute; + } totFormat = adaptorPtr->nFormats; @@ -457,8 +453,8 @@ KdXVInitAdaptors( KdXVFreeAdaptor(pa); continue; } - for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; - i < adaptorPtr->nFormats; i++, formatPtr++) + for(pf = pFormat, i = 0, numFormat = 0, formatPtr = adaptorPtr->pFormats; + i < adaptorPtr->nFormats; i++, formatPtr++) { numVisuals = pScreen->numVisuals; pVisual = pScreen->visuals; @@ -468,26 +464,26 @@ KdXVInitAdaptors( (pVisual->nplanes == formatPtr->depth)) { if(numFormat >= totFormat) { - void *moreSpace; + void *moreSpace; totFormat *= 2; - moreSpace = xrealloc(pFormat, + moreSpace = xrealloc(pFormat, totFormat * sizeof(XvFormatRec)); if(!moreSpace) break; pFormat = moreSpace; pf = pFormat + numFormat; } - pf->visual = pVisual->vid; + pf->visual = pVisual->vid; pf->depth = formatPtr->depth; pf++; numFormat++; } pVisual++; - } + } } pa->nFormats = numFormat; - pa->pFormats = pFormat; + pa->pFormats = pFormat; if(!numFormat) { KdXVFreeAdaptor(pa); continue; @@ -517,15 +513,15 @@ KdXVInitAdaptors( KdXVFreeAdaptor(pa); continue; } - for(pp = pPort, i = 0, numPort = 0; + for(pp = pPort, i = 0, numPort = 0; i < adaptorPtr->nPorts; i++) { - if(!(pp->id = FakeClientID(0))) + if(!(pp->id = FakeClientID(0))) continue; - if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) + if(!(portPriv = xcalloc(1, sizeof(XvPortRecPrivate)))) continue; - + if(!AddResource(pp->id, PortResource, pp)) { xfree(portPriv); continue; @@ -542,7 +538,7 @@ KdXVInitAdaptors( portPriv->screen = screen; portPriv->AdaptorRec = adaptorPriv; portPriv->DevPriv.ptr = adaptorPtr->pPortPrivates[i].ptr; - + pp++; numPort++; } @@ -554,7 +550,7 @@ KdXVInitAdaptors( } pa->base_id = pPort->id; - + pa++; numAdaptor++; } @@ -580,13 +576,13 @@ KdXVInitAdaptors( the GC and used it's clip list when they needed to reclip the window, even if the client clip was different from the one the video was initialized with. If the original GC was destroyed, they had to stop - the video. I like the new method better (MArk). + the video. I like the new method better (MArk). This function only works for windows. Will need to rewrite when (if) we support pixmap rendering. */ -static void +static void KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) { RegionPtr pregWin, pCompositeClip; @@ -623,7 +619,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) if(freeCompClip) { REGION_DESTROY(pWin->pScreen, pregWin); - } + } } /* Save the current clientClip and update the CompositeClip whenever @@ -631,7 +627,7 @@ KdXVUpdateCompositeClip(XvPortRecPrivatePtr portPriv) static void KdXVCopyClip( - XvPortRecPrivatePtr portPriv, + XvPortRecPrivatePtr portPriv, GCPtr pGC ){ /* copy the new clip if it exists */ @@ -672,12 +668,12 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(portPriv->pDraw->pScreen, &WinRegion, &WinBox, 1); REGION_INIT(portPriv->pDraw->pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); - + REGION_INTERSECT(portPriv->pDraw->pScreen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(portPriv->pDraw->pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -689,10 +685,10 @@ KdXVRegetVideo(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->GetVideo)(portPriv->screen, portPriv->pDraw, - portPriv->vid_x, portPriv->vid_y, - WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_x, portPriv->vid_y, + WinBox.x1, WinBox.y1, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) @@ -736,11 +732,11 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { @@ -753,10 +749,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -767,8 +763,8 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -780,10 +776,10 @@ KdXVReputVideo(XvPortRecPrivatePtr portPriv) } ret = (*portPriv->AdaptorRec->PutVideo)(portPriv->screen, portPriv->pDraw, - portPriv->vid_x, portPriv->vid_y, + portPriv->vid_x, portPriv->vid_y, WinBox.x1, WinBox.y1, - portPriv->vid_w, portPriv->vid_h, - portPriv->drw_w, portPriv->drw_h, + portPriv->vid_w, portPriv->vid_h, + portPriv->drw_w, portPriv->drw_h, &ClipRegion, portPriv->DevPriv.ptr); if(ret == Success) portPriv->isOn = XV_ON; @@ -825,11 +821,11 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) WinBox.y1 = portPriv->pDraw->y + portPriv->drw_y; WinBox.x2 = WinBox.x1 + portPriv->drw_w; WinBox.y2 = WinBox.y1 + portPriv->drw_h; - + /* clip to the window composite clip */ REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); + REGION_INTERSECT(Screen, &ClipRegion, &WinRegion, portPriv->pCompositeClip); /* clip and translate to the viewport */ if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { @@ -842,10 +838,10 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } - + /* that's all if it's totally obscured */ if(!REGION_NOTEMPTY(pScreen, &ClipRegion)) { clippedAway = TRUE; @@ -856,8 +852,8 @@ KdXVReputImage(XvPortRecPrivatePtr portPriv) if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || - (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; goto CLIP_VIDEO_BAILOUT; @@ -897,10 +893,10 @@ static int KdXVReputAllVideo(WindowPtr pWin, pointer data) { KdXVWindowPtr WinPriv; - + if (pWin->drawable.type != DRAWABLE_WINDOW) return WT_DONTWALKCHILDREN; - + WinPriv = GET_KDXV_WINDOW(pWin); while(WinPriv) { @@ -917,7 +913,7 @@ KdXVReputAllVideo(WindowPtr pWin, pointer data) static int KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) { - KdXVWindowPtr winPriv, PrivRoot; + KdXVWindowPtr winPriv, PrivRoot; winPriv = PrivRoot = GET_KDXV_WINDOW(pWin); @@ -934,7 +930,7 @@ KdXVEnlistPortInWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) winPriv->PortRec = portPriv; winPriv->next = PrivRoot; dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv); - } + } return Success; } @@ -948,14 +944,14 @@ KdXVRemovePortFromWindow(WindowPtr pWin, XvPortRecPrivatePtr portPriv) while(winPriv) { if(winPriv->PortRec == portPriv) { - if(prevPriv) + if(prevPriv) prevPriv->next = winPriv->next; - else + else dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, winPriv->next); xfree(winPriv); break; } - prevPriv = winPriv; + prevPriv = winPriv; winPriv = winPriv->next; } portPriv->pDraw = NULL; @@ -1033,7 +1029,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) /* filter out XClearWindow/Area */ if (!pWin->valdata) return; - + pPrev = NULL; while(WinPriv) { @@ -1044,10 +1040,10 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) switch(pPriv->type) { case XvInputMask: KdXVReputVideo(pPriv); - break; + break; case XvOutputMask: - KdXVRegetVideo(pPriv); - break; + KdXVRegetVideo(pPriv); + break; default: /* overlaid still/image*/ if (pPriv->AdaptorRec->ReputImage) KdXVReputImage(pPriv); @@ -1061,7 +1057,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } pPriv->pDraw = NULL; - if(!pPrev) + if(!pPrev) dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; @@ -1078,7 +1074,7 @@ KdXVWindowExposures(WindowPtr pWin, RegionPtr reg1, RegionPtr reg2) } -static void +static void KdXVClipNotify(WindowPtr pWin, int dx, int dy) { ScreenPtr pScreen = pWin->drawable.pScreen; @@ -1097,7 +1093,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) pPriv->pCompositeClip = NULL; - /* Stop everything except images, but stop them too if the + /* Stop everything except images, but stop them too if the window isn't visible. But we only remove the images. */ if(pPriv->type || !visible) { @@ -1110,7 +1106,7 @@ KdXVClipNotify(WindowPtr pWin, int dx, int dy) if(!pPriv->type) { /* overlaid still/image */ pPriv->pDraw = NULL; - if(!pPrev) + if(!pPrev) dixSetPrivate(&pWin->devPrivates, KdXVWindowKey, WinPriv->next); else pPrev->next = WinPriv->next; @@ -1153,16 +1149,13 @@ KdXVCloseScreen(int i, ScreenPtr pScreen) /* fprintf(stderr,"XV: Unwrapping screen funcs\n"); */ - for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { + for(c = 0, pa = pxvs->pAdaptors; c < pxvs->nAdaptors; c++, pa++) { KdXVFreeAdaptor(pa); } - if(pxvs->pAdaptors) - xfree(pxvs->pAdaptors); - + xfree(pxvs->pAdaptors); xfree(ScreenPriv); - return TRUE; } @@ -1193,9 +1186,9 @@ KdXVEnable(ScreenPtr pScreen) { if (!KdXVRunning (pScreen)) return TRUE; - - WalkTree(pScreen, KdXVReputAllVideo, 0); - + + WalkTree(pScreen, KdXVReputAllVideo, 0); + return TRUE; } @@ -1214,7 +1207,7 @@ KdXVDisable(ScreenPtr pScreen) pxvs = GET_XV_SCREEN(pScreen); ScreenPriv = GET_KDXV_SCREEN(pScreen); - + for(i = 0; i < pxvs->nAdaptors; i++) { pAdaptor = &pxvs->pAdaptors[i]; for(j = 0; j < pAdaptor->nPorts; j++) { @@ -1263,8 +1256,8 @@ KdXVPutVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1277,7 +1270,7 @@ KdXVPutVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1302,7 +1295,7 @@ KdXVPutVideo( pPort->pDraw = pDraw; if (!pScreenPriv->enabled) return Success; - + return(KdXVReputVideo(portPriv)); } @@ -1312,13 +1305,13 @@ KdXVPutStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - ScreenPtr pScreen = pDraw->pScreen; + ScreenPtr pScreen = pDraw->pScreen; KdScreenPriv(pScreen); KdScreenInfo *screen=pScreenPriv->screen; RegionRec WinRegion; @@ -1336,10 +1329,10 @@ KdXVPutStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; @@ -1351,7 +1344,7 @@ KdXVPutStill( VPBox.y2 = screen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1367,7 +1360,7 @@ KdXVPutStill( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; @@ -1417,8 +1410,8 @@ KdXVGetVideo( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1431,7 +1424,7 @@ KdXVGetVideo( pPort->pDraw = (DrawablePtr)NULL; return BadAlloc; } - + /* If we are changing windows, unregister our port in the old window */ if(portPriv->pDraw && (portPriv->pDraw != pDraw)) KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1454,7 +1447,7 @@ KdXVGetVideo( /* To indicate to the DI layer that we were successful */ pPort->pDraw = pDraw; - + if(!pScreenPriv->enabled) return Success; return(KdXVRegetVideo(portPriv)); @@ -1466,8 +1459,8 @@ KdXVGetStill( DrawablePtr pDraw, XvPortPtr pPort, GCPtr pGC, - INT16 vid_x, INT16 vid_y, - CARD16 vid_w, CARD16 vid_h, + INT16 vid_x, INT16 vid_y, + CARD16 vid_w, CARD16 vid_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h ){ @@ -1489,10 +1482,10 @@ KdXVGetStill( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->pDraw) { KdXVRemovePortFromWindow((WindowPtr)(portPriv->pDraw), portPriv); @@ -1526,7 +1519,7 @@ GET_STILL_BAILOUT: return ret; } - + static int KdXVStopVideo( @@ -1539,7 +1532,7 @@ KdXVStopVideo( if(pDraw->type != DRAWABLE_WINDOW) return BadAlloc; - + KdXVRemovePortFromWindow((WindowPtr)pDraw, portPriv); if(!pScreenPriv->enabled) return Success; @@ -1563,8 +1556,8 @@ KdXVSetPortAttribute( INT32 value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, + + return((*portPriv->AdaptorRec->SetPortAttribute)(portPriv->screen, attribute, value, portPriv->DevPriv.ptr)); } @@ -1577,8 +1570,8 @@ KdXVGetPortAttribute( INT32 *p_value ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, + + return((*portPriv->AdaptorRec->GetPortAttribute)(portPriv->screen, attribute, (int *) p_value, portPriv->DevPriv.ptr)); } @@ -1594,8 +1587,8 @@ KdXVQueryBestSize( unsigned int *p_w, unsigned int *p_h ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - - (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, + + (*portPriv->AdaptorRec->QueryBestSize)(portPriv->screen, (Bool)motion, vid_w, vid_h, drw_w, drw_h, p_w, p_h, portPriv->DevPriv.ptr); @@ -1603,14 +1596,14 @@ KdXVQueryBestSize( } -static int +static int KdXVPutImage( - ClientPtr client, - DrawablePtr pDraw, - XvPortPtr pPort, + ClientPtr client, + DrawablePtr pDraw, + XvPortPtr pPort, GCPtr pGC, - INT16 src_x, INT16 src_y, - CARD16 src_w, CARD16 src_h, + INT16 src_x, INT16 src_y, + CARD16 src_w, CARD16 src_h, INT16 drw_x, INT16 drw_y, CARD16 drw_w, CARD16 drw_h, XvImagePtr format, @@ -1636,10 +1629,10 @@ KdXVPutImage( WinBox.y1 = pDraw->y + drw_y; WinBox.x2 = WinBox.x1 + drw_w; WinBox.y2 = WinBox.y1 + drw_h; - + REGION_INIT(pScreen, &WinRegion, &WinBox, 1); REGION_INIT(pScreen, &ClipRegion, NullBox, 1); - REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); + REGION_INTERSECT(pScreen, &ClipRegion, &WinRegion, pGC->pCompositeClip); if(portPriv->AdaptorRec->flags & VIDEO_CLIP_TO_VIEWPORT) { RegionRec VPReg; @@ -1651,7 +1644,7 @@ KdXVPutImage( VPBox.y2 = pScreen->height; REGION_INIT(pScreen, &VPReg, &VPBox, 1); - REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); + REGION_INTERSECT(Screen, &ClipRegion, &ClipRegion, &VPReg); REGION_UNINIT(pScreen, &VPReg); } @@ -1667,7 +1660,7 @@ KdXVPutImage( if(portPriv->AdaptorRec->flags & VIDEO_NO_CLIPPING) { BoxPtr clipBox = REGION_RECTS(&ClipRegion); if( (REGION_NUM_RECTS(&ClipRegion) != 1) || - (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || + (clipBox->x1 != WinBox.x1) || (clipBox->x2 != WinBox.x2) || (clipBox->y1 != WinBox.y1) || (clipBox->y2 != WinBox.y2)) { clippedAway = TRUE; @@ -1712,19 +1705,19 @@ PUT_IMAGE_BAILOUT: } -static int +static int KdXVQueryImageAttributes( - ClientPtr client, + ClientPtr client, XvPortPtr pPort, - XvImagePtr format, - CARD16 *width, - CARD16 *height, + XvImagePtr format, + CARD16 *width, + CARD16 *height, int *pitches, int *offsets ){ XvPortRecPrivatePtr portPriv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); - return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, + return (*portPriv->AdaptorRec->QueryImageAttributes)(portPriv->screen, format->id, width, height, pitches, offsets); } @@ -1878,7 +1871,7 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) xRectangle *rects, *r; BoxPtr pBox = REGION_RECTS (pRgn); int nBox = REGION_NUM_RECTS (pRgn); - + rects = xalloc (nBox * sizeof (xRectangle)); if (!rects) goto bail0; @@ -1892,18 +1885,18 @@ KXVPaintRegion (DrawablePtr pDraw, RegionPtr pRgn, Pixel fg) r++; pBox++; } - + pGC = GetScratchGC (pDraw->depth, pDraw->pScreen); if (!pGC) goto bail1; - + val[0] = fg; val[1] = IncludeInferiors; ChangeGC (pGC, GCForeground|GCSubwindowMode, val); - + ValidateGC (pDraw, pGC); - - (*pGC->ops->PolyFillRect) (pDraw, pGC, + + (*pGC->ops->PolyFillRect) (pDraw, pGC, REGION_NUM_RECTS (pRgn), rects); FreeScratchGC (pGC); diff --git a/xorg-server/hw/xfree86/common/xf86AutoConfig.c b/xorg-server/hw/xfree86/common/xf86AutoConfig.c index a6199b0e8..1c4595e36 100644 --- a/xorg-server/hw/xfree86/common/xf86AutoConfig.c +++ b/xorg-server/hw/xfree86/common/xf86AutoConfig.c @@ -272,7 +272,8 @@ xf86AutoConfig(void) for (cp = builtinConfig; *cp; cp++) xf86ErrorFVerb(3, "\t%s", *cp); xf86MsgVerb(X_DEFAULT, 3, "--- End of built-in configuration ---\n"); - + + xf86initConfigFiles(); xf86setBuiltinConfig(builtinConfig); ret = xf86HandleConfigFile(TRUE); FreeConfig(); diff --git a/xorg-server/hw/xfree86/common/xf86Config.c b/xorg-server/hw/xfree86/common/xf86Config.c index 6fbf61346..1abc182da 100644 --- a/xorg-server/hw/xfree86/common/xf86Config.c +++ b/xorg-server/hw/xfree86/common/xf86Config.c @@ -95,6 +95,23 @@ extern DeviceAssocRec mouse_assoc; "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif +#ifndef ROOT_CONFIGDIRPATH +#define ROOT_CONFIGDIRPATH "%A," "%R," \ + "/etc/X11/%R," "%P/etc/X11/%R," \ + "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif +#ifndef USER_CONFIGDIRPATH +#define USER_CONFIGDIRPATH "/etc/X11/%S," "%P/etc/X11/%S," \ + "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif @@ -1444,12 +1461,19 @@ checkCoreInputDevices(serverLayoutPtr servlayoutp, Bool implicitLayout) } if (xf86Info.allowEmptyInput && !(foundPointer && foundKeyboard)) { -#ifdef CONFIG_HAL - xf86Msg(X_INFO, "The server relies on HAL to provide the list of " +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) + const char *config_backend; +#if defined(CONFIG_HAL) + config_backend = "HAL"; +#else + config_backend = "udev"; +#endif + xf86Msg(X_INFO, "The server relies on %s to provide the list of " "input devices.\n\tIf no devices become available, " - "reconfigure HAL or disable AutoAddDevices.\n"); + "reconfigure %s or disable AutoAddDevices.\n", + config_backend, config_backend); #else - xf86Msg(X_INFO, "HAL is disabled and no input devices were configured.\n" + xf86Msg(X_INFO, "Hotplugging is disabled and no input devices were configured.\n" "\tTry disabling AllowEmptyInput.\n"); #endif } @@ -1471,6 +1495,45 @@ static OptionInfoRec LayoutOptions[] = { {0}, FALSE }, }; +static Bool +configInputDevices(XF86ConfLayoutPtr layout, serverLayoutPtr servlayoutp) +{ + XF86ConfInputrefPtr irp; + IDevPtr *indp; + int count = 0; + + /* + * Count the number of input devices. + */ + irp = layout->lay_input_lst; + while (irp) { + count++; + irp = (XF86ConfInputrefPtr)irp->list.next; + } + DebugF("Found %d input devices in the layout section %s\n", + count, layout.lay_identifier); + indp = xnfcalloc((count + 1), sizeof(IDevPtr)); + indp[count] = NULL; + irp = layout->lay_input_lst; + count = 0; + while (irp) { + indp[count] = xnfalloc(sizeof(IDevRec)); + if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) { + while(count--) + xfree(indp[count]); + xfree(indp); + return FALSE; + } + indp[count]->extraOptions = irp->iref_option_lst; + count++; + irp = (XF86ConfInputrefPtr)irp->list.next; + } + servlayoutp->inputs = indp; + + return TRUE; +} + + /* * figure out which layout is active, which screens are used in that layout, * which drivers and monitors are used in these screens @@ -1481,14 +1544,12 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, { XF86ConfAdjacencyPtr adjp; XF86ConfInactivePtr idp; - XF86ConfInputrefPtr irp; int count = 0; int scrnum; XF86ConfLayoutPtr l; MessageType from; screenLayoutPtr slp; GDevPtr gdp; - IDevPtr* indp; int i = 0, j; if (!servlayoutp) @@ -1639,45 +1700,6 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, } } -#ifdef LAYOUT_DEBUG - ErrorF("Layout \"%s\"\n", conf_layout->lay_identifier); - for (i = 0; i < count; i++) { - ErrorF("Screen: \"%s\" (%d):\n", slp[i].screen->id, - slp[i].screen->screennum); - switch (slp[i].where) { - case PosObsolete: - ErrorF("\tObsolete format: \"%s\" \"%s\" \"%s\" \"%s\"\n", - slp[i].top, slp[i].bottom, slp[i].left, slp[i].right); - break; - case PosAbsolute: - if (slp[i].x == -1) - if (slp[i].screen->screennum == 0) - ErrorF("\tImplicitly left-most\n"); - else - ErrorF("\tImplicitly right of screen %d\n", - slp[i].screen->screennum - 1); - else - ErrorF("\t%d %d\n", slp[i].x, slp[i].y); - break; - case PosRightOf: - ErrorF("\tRight of \"%s\"\n", slp[i].refscreen->id); - break; - case PosLeftOf: - ErrorF("\tLeft of \"%s\"\n", slp[i].refscreen->id); - break; - case PosAbove: - ErrorF("\tAbove \"%s\"\n", slp[i].refscreen->id); - break; - case PosBelow: - ErrorF("\tBelow \"%s\"\n", slp[i].refscreen->id); - break; - case PosRelative: - ErrorF("\t%d %d relative to \"%s\"\n", slp[i].x, slp[i].y, - slp[i].refscreen->id); - break; - } - } -#endif /* * Count the number of inactive devices. */ @@ -1701,37 +1723,13 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, count++; idp = (XF86ConfInactivePtr)idp->list.next; } - /* - * Count the number of input devices. - */ - count = 0; - irp = conf_layout->lay_input_lst; - while (irp) { - count++; - irp = (XF86ConfInputrefPtr)irp->list.next; - } - DebugF("Found %d input devices in the layout section %s\n", - count, conf_layout->lay_identifier); - indp = xnfcalloc((count + 1), sizeof(IDevPtr)); - indp[count] = NULL; - irp = conf_layout->lay_input_lst; - count = 0; - while (irp) { - indp[count] = xnfalloc(sizeof(IDevRec)); - if (!configInput(indp[count], irp->iref_inputdev, X_CONFIG)) { - while(count--) - xfree(indp[count]); - xfree(indp); - return FALSE; - } - indp[count]->extraOptions = irp->iref_option_lst; - count++; - irp = (XF86ConfInputrefPtr)irp->list.next; - } + + if (!configInputDevices(conf_layout, servlayoutp)) + return FALSE; + servlayoutp->id = conf_layout->lay_identifier; servlayoutp->screens = slp; servlayoutp->inactives = gdp; - servlayoutp->inputs = indp; servlayoutp->options = conf_layout->lay_option_lst; from = X_DEFAULT; @@ -1743,12 +1741,14 @@ configLayout(serverLayoutPtr servlayoutp, XF86ConfLayoutPtr conf_layout, * the only active screen. */ static Bool -configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) +configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen, + XF86ConfigPtr xf86configptr) { MessageType from; XF86ConfScreenPtr s; screenLayoutPtr slp; IDevPtr *indp; + XF86ConfLayoutRec layout; if (!servlayoutp) return FALSE; @@ -1784,10 +1784,19 @@ configImpliedLayout(serverLayoutPtr servlayoutp, XF86ConfScreenPtr conf_screen) servlayoutp->screens = slp; servlayoutp->inactives = xnfcalloc(1, sizeof(GDevRec)); servlayoutp->options = NULL; - /* Set up an empty input device list, then look for some core devices. */ - indp = xnfalloc(sizeof(IDevPtr)); - *indp = NULL; - servlayoutp->inputs = indp; + + memset(&layout, 0, sizeof(layout)); + layout.lay_identifier = servlayoutp->id; + if (xf86layoutAddInputDevices(xf86configptr, &layout) > 0) { + if (!configInputDevices(&layout, servlayoutp)) + return FALSE; + from = X_DEFAULT; + } else { + /* Set up an empty input device list, then look for some core devices. */ + indp = xnfalloc(sizeof(IDevPtr)); + *indp = NULL; + servlayoutp->inputs = indp; + } return TRUE; } @@ -2428,34 +2437,53 @@ checkInput(serverLayoutPtr layout, Bool implicit_layout) { ConfigStatus xf86HandleConfigFile(Bool autoconfig) { - const char *filename; - char *searchpath; - MessageType from = X_DEFAULT; + const char *filename, *dirname; + char *filesearch, *dirsearch; + MessageType filefrom = X_DEFAULT; + MessageType dirfrom = X_DEFAULT; char *scanptr; Bool singlecard = 0; Bool implicit_layout = FALSE; if (!autoconfig) { - if (getuid() == 0) - searchpath = ROOT_CONFIGPATH; - else - searchpath = USER_CONFIGPATH; + if (getuid() == 0) { + filesearch = ROOT_CONFIGPATH; + dirsearch = ROOT_CONFIGDIRPATH; + } else { + filesearch = USER_CONFIGPATH; + dirsearch = USER_CONFIGDIRPATH; + } if (xf86ConfigFile) - from = X_CMDLINE; + filefrom = X_CMDLINE; + if (xf86ConfigDir) + dirfrom = X_CMDLINE; - filename = xf86openConfigFile(searchpath, xf86ConfigFile, PROJECTROOT); + xf86initConfigFiles(); + filename = xf86openConfigFile(filesearch, xf86ConfigFile, PROJECTROOT); + dirname = xf86openConfigDirFiles(dirsearch, xf86ConfigDir, PROJECTROOT); if (filename) { - xf86MsgVerb(from, 0, "Using config file: \"%s\"\n", filename); + xf86MsgVerb(filefrom, 0, "Using config file: \"%s\"\n", filename); xf86ConfigFile = xnfstrdup(filename); } else { if (xf86ConfigFile) xf86Msg(X_ERROR, "Unable to locate/open config file: \"%s\"\n", xf86ConfigFile); - return CONFIG_NOFILE; } + if (dirname) { + xf86MsgVerb(dirfrom, 0, "Using config directory: \"%s\"\n", + dirname); + xf86ConfigDir = xnfstrdup(dirname); + } else { + if (xf86ConfigDir) + xf86Msg(X_ERROR, + "Unable to locate/open config directory: \"%s\"\n", + xf86ConfigDir); + } + if (!filename && !dirname) + return CONFIG_NOFILE; } - + if ((xf86configptr = xf86readConfigFile ()) == NULL) { xf86Msg(X_ERROR, "Problem parsing the config file\n"); return CONFIG_PARSE_ERROR; @@ -2481,7 +2509,8 @@ xf86HandleConfigFile(Bool autoconfig) "No Layout section. Using the first Screen section.\n"); } if (!configImpliedLayout(&xf86ConfigLayout, - xf86configptr->conf_screen_lst)) { + xf86configptr->conf_screen_lst, + xf86configptr)) { xf86Msg(X_ERROR, "Unable to determine the screen layout\n"); return CONFIG_PARSE_ERROR; } diff --git a/xorg-server/hw/xfree86/common/xf86Globals.c b/xorg-server/hw/xfree86/common/xf86Globals.c index 98f828483..8b483f35c 100644 --- a/xorg-server/hw/xfree86/common/xf86Globals.c +++ b/xorg-server/hw/xfree86/common/xf86Globals.c @@ -132,7 +132,7 @@ xf86InfoRec xf86Info = { .kbdCustomKeycodes = FALSE, .disableRandR = FALSE, .randRFrom = X_DEFAULT, -#ifdef CONFIG_HAL +#if defined(CONFIG_HAL) || defined(CONFIG_UDEV) .allowEmptyInput = TRUE, .autoAddDevices = TRUE, .autoEnableDevices = TRUE @@ -143,6 +143,7 @@ xf86InfoRec xf86Info = { #endif }; const char *xf86ConfigFile = NULL; +const char *xf86ConfigDir = NULL; const char *xf86ModulePath = DEFAULT_MODULE_PATH; MessageType xf86ModPathFrom = X_DEFAULT; const char *xf86LogFile = DEFAULT_LOGPREFIX; diff --git a/xorg-server/hw/xfree86/common/xf86Init.c b/xorg-server/hw/xfree86/common/xf86Init.c index 3b25c89a6..670744802 100644 --- a/xorg-server/hw/xfree86/common/xf86Init.c +++ b/xorg-server/hw/xfree86/common/xf86Init.c @@ -1387,6 +1387,19 @@ ddxProcessArgument(int argc, char **argv, int 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; @@ -1670,6 +1683,8 @@ ddxUseMsg(void) } 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"); diff --git a/xorg-server/hw/xfree86/common/xf86Module.h b/xorg-server/hw/xfree86/common/xf86Module.h index 8e5d5cfb5..bbf5786c9 100644 --- a/xorg-server/hw/xfree86/common/xf86Module.h +++ b/xorg-server/hw/xfree86/common/xf86Module.h @@ -83,7 +83,7 @@ typedef enum { */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 4) #define ABI_VIDEODRV_VERSION SET_ABI_VERSION(7, 0) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(8, 0) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(9, 0) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(3, 0) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 6) diff --git a/xorg-server/hw/xfree86/common/xf86Option.c b/xorg-server/hw/xfree86/common/xf86Option.c index ad8d1c426..a2868bf21 100644 --- a/xorg-server/hw/xfree86/common/xf86Option.c +++ b/xorg-server/hw/xfree86/common/xf86Option.c @@ -42,6 +42,7 @@ #include "xf86.h" #include "xf86Xinput.h" #include "xf86Optrec.h" +#include "xf86Parser.h" static Bool ParseOptionValue(int scrnIndex, pointer options, OptionInfoPtr p, Bool markUsed); @@ -456,29 +457,7 @@ xf86ShowUnusedOptions(int scrnIndex, pointer options) static Bool GetBoolValue(OptionInfoPtr p, const char *s) { - if (*s == '\0') { - p->value.bool = TRUE; - } else { - if (xf86NameCmp(s, "1") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "on") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "true") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "yes") == 0) - p->value.bool = TRUE; - else if (xf86NameCmp(s, "0") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "off") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "false") == 0) - p->value.bool = FALSE; - else if (xf86NameCmp(s, "no") == 0) - p->value.bool = FALSE; - else - return FALSE; - } - return TRUE; + return xf86getBoolValue(&p->value.bool, s); } static Bool diff --git a/xorg-server/hw/xfree86/common/xf86Priv.h b/xorg-server/hw/xfree86/common/xf86Priv.h index 3bb15718c..0612c9c4e 100644 --- a/xorg-server/hw/xfree86/common/xf86Priv.h +++ b/xorg-server/hw/xfree86/common/xf86Priv.h @@ -46,6 +46,7 @@ * 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; diff --git a/xorg-server/hw/xfree86/common/xf86Xinput.c b/xorg-server/hw/xfree86/common/xf86Xinput.c index f637cfe19..57db056d8 100644 --- a/xorg-server/hw/xfree86/common/xf86Xinput.c +++ b/xorg-server/hw/xfree86/common/xf86Xinput.c @@ -57,9 +57,11 @@ #include #include "xf86.h" #include "xf86Priv.h" +#include "xf86Config.h" #include "xf86Xinput.h" #include "XIstubs.h" #include "xf86Optrec.h" +#include "xf86Parser.h" #include "mipointer.h" #include "xf86InPriv.h" #include "compiler.h" @@ -74,6 +76,11 @@ #include "exglobals.h" #include "eventstr.h" +#include /* InputClassMatches */ +#ifdef HAVE_FNMATCH_H +#include +#endif + #include "extnsionst.h" #include "windowstr.h" /* screenIsSaved */ @@ -466,6 +473,85 @@ AddOtherInputDevices(void) { } +/* + * Classes without any Match statements match all devices. Otherwise, all + * statements must match. + */ +static Bool +InputClassMatches(XF86ConfInputClassPtr iclass, InputAttributes *attrs) +{ + if (iclass->match_product && + (!attrs->product || !strstr(attrs->product, iclass->match_product))) + return False; + if (iclass->match_vendor && + (!attrs->vendor || !strstr(attrs->vendor, iclass->match_vendor))) + return False; + if (iclass->match_device && +#ifdef HAVE_FNMATCH_H + (!attrs->device || + fnmatch(iclass->match_device, attrs->device, 0) != 0)) +#else + (!attrs->device || !strstr(attrs->device, iclass->match_device))) +#endif + return False; + if (iclass->is_keyboard.set && + iclass->is_keyboard.val != !!(attrs->flags & ATTR_KEYBOARD)) + return False; + if (iclass->is_pointer.set && + iclass->is_pointer.val != !!(attrs->flags & ATTR_POINTER)) + return False; + if (iclass->is_joystick.set && + iclass->is_joystick.val != !!(attrs->flags & ATTR_JOYSTICK)) + return False; + if (iclass->is_tablet.set && + iclass->is_tablet.val != !!(attrs->flags & ATTR_TABLET)) + return False; + if (iclass->is_touchpad.set && + iclass->is_touchpad.val != !!(attrs->flags & ATTR_TOUCHPAD)) + return False; + if (iclass->is_touchscreen.set && + iclass->is_touchscreen.val != !!(attrs->flags & ATTR_TOUCHSCREEN)) + return False; + return True; +} + +/* + * Merge in any InputClass configurations. Each InputClass section can + * add to the original device configuration as well as any previous + * InputClass sections. + */ +static int +MergeInputClasses(IDevPtr idev, InputAttributes *attrs) +{ + XF86ConfInputClassPtr cl; + XF86OptionPtr classopts; + + for (cl = xf86configptr->conf_inputclass_lst; cl; cl = cl->list.next) { + if (!InputClassMatches(cl, attrs)) + continue; + + xf86Msg(X_CONFIG, "%s: Applying InputClass \"%s\"\n", + idev->identifier, cl->identifier); + if (cl->driver && !idev->driver) { + idev->driver = xstrdup(cl->driver); + if (!idev->driver) { + xf86Msg(X_ERROR, "Could not allocate memory while merging " + "InputClass configuration"); + return BadAlloc; + } + } + + classopts = xf86optionListDup(cl->option_lst); + if (idev->commonOptions) + idev->commonOptions = xf86optionListMerge(classopts, + idev->commonOptions); + else + idev->commonOptions = classopts; + } + + return Success; +} + /** * Create a new input device, activate and enable it. * @@ -568,7 +654,8 @@ unwind: } int -NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) +NewInputDeviceRequest (InputOption *options, InputAttributes *attrs, + DeviceIntPtr *pdev) { IDevRec *idev = NULL; InputOption *option = NULL; @@ -605,9 +692,9 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) } } - /* Right now, the only automatic config we know of is HAL. */ if (strcmp(option->key, "_source") == 0 && - strcmp(option->value, "server/hal") == 0) { + (strcmp(option->value, "server/hal") == 0 || + strcmp(option->value, "server/udev") == 0)) { is_auto = 1; if (!xf86Info.autoAddDevices) { rval = BadMatch; @@ -615,6 +702,23 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) } } } + + for (option = options; option; option = option->next) { + /* Steal option key/value strings from the provided list. + * We need those strings, the InputOption list doesn't. */ + idev->commonOptions = xf86addNewOption(idev->commonOptions, + option->key, option->value); + option->key = NULL; + option->value = NULL; + } + + /* Apply InputClass settings */ + if (attrs) { + rval = MergeInputClasses(idev, attrs); + if (rval != Success) + goto unwind; + } + if (!idev->driver || !idev->identifier) { xf86Msg(X_ERROR, "No input driver/identifier specified (ignoring)\n"); rval = BadRequest; @@ -626,15 +730,6 @@ NewInputDeviceRequest (InputOption *options, DeviceIntPtr *pdev) return BadMatch; } - for (option = options; option; option = option->next) { - /* Steal option key/value strings from the provided list. - * We need those strings, the InputOption list doesn't. */ - idev->commonOptions = xf86addNewOption(idev->commonOptions, - option->key, option->value); - option->key = NULL; - option->value = NULL; - } - rval = xf86NewInputDevice(idev, pdev, (!is_auto || (is_auto && xf86Info.autoEnableDevices))); if (rval == Success) diff --git a/xorg-server/hw/xfree86/doc/README.modes b/xorg-server/hw/xfree86/doc/README.modes new file mode 100644 index 000000000..894e21313 --- /dev/null +++ b/xorg-server/hw/xfree86/doc/README.modes @@ -0,0 +1,474 @@ + Multi-monitor Mode Setting APIs + Keith Packard, SaveScreen and the core X screen saver will be +implemented by disabling outputs and crtcs using their dpms functions. + + void + xf86DPMSSet(ScrnInfoPtr scrn, int mode, int flags) + +Pass this function to xf86DPMSInit and all DPMS mode switching will be +managed by using the dpms functions provided by the Outputs and CRTCs. + + Bool + xf86CrtcScreenInit (ScreenPtr screen) + +This function completes the screen initialization process for the crtc and +output objects. Call it near the end of the ScreenInit function, after the +frame buffer and acceleration layers have been added. + +3.3 EnterVT functions + +Functions used during EnterVT, or whenever the current configuration needs +to be applied to the hardware. + + Bool + xf86SetDesiredModes (ScrnInfoPtr scrn) + +xf86InitialConfiguration selects the desired configuration at PreInit time; +when the server finally hits ScreenInit, xf86SetDesiredModes is used by the +driver to take that configuration and apply it to the hardware. In addition, +successful mode selection at other times updates the configuration that will +be used by this function, so LeaveVT/EnterVT pairs can simply invoke this +and return to the previous configuration. + +3.4 SwitchMode functions + +Functions called from the pScrn->SwitchMode hook, which is used by the +XFree86-VidModeExtension and the keypad mode switch commands. + + Bool + xf86SetSingleMode (ScrnInfoPtr scrn, + DisplayModePtr desired, + Rotation rotation) + +This function applies the specified mode to all active outputs. Which is to +say, it picks reasonable modes for all active outputs, attempting to get the +screen to the specified size while not breaking anything that is currently +working. + +3.7 get_modes functions + +Functions called during output->get_modes to help build lists of modes + + xf86MonPtr + xf86OutputGetEDID (xf86OutputPtr output, I2CBusPtr pDDCBus) + +This returns the EDID data structure for the 'output' using the I2C bus +'pDDCBus'. This has no effect on 'output' itself. + + void + xf86OutputSetEDID (xf86OutputPtr output, xf86MonPtr edid_mon) + +Once the EDID data has been fetched, this call applies the EDID data to the +output object, setting the physical size and also various properties, like +the DDC root window property (when output is the 'compat' output), and the +RandR 1.2 EDID output properties. + + DisplayModePtr + xf86OutputGetEDIDModes (xf86OutputPtr output) + +Given an EDID data structure, this function computes a list of suitable +modes. This function also applies a sequence of 'quirks' during this process +so that the returned modes may not actually match the mode data present in +the EDID data. + +3.6 Other functions + +These remaining functions in the API can be used by the driver as needed. + + Bool + xf86CrtcSetMode (xf86CrtcPtr crtc, DisplayModePtr mode, Rotation rotation, + int x, int y) + +Applies a mode to a CRTC. All of the outputs which are currently using the +specified CRTC are included in the mode setting process. 'x' and 'y' are the +offset within the frame buffer that the crtc is placed at. No checking is +done in this function to ensure that the mode is usable by the active +outputs. + + void + xf86ProbeOutputModes (ScrnInfoPtr pScrn, int maxX, int maxY) + +This discards the mode lists for all outputs, re-detects monitor presence +and then acquires new mode lists for all monitors which are not disconnected. +Monitor configuration data is used to modify the mode lists returned by the +outputs. 'maxX' and 'maxY' limit the maximum size modes that will be +returned. + + void + xf86SetScrnInfoModes (ScrnInfoPtr pScrn) + +This copies the 'compat' output mode list into the pScrn modes list which is +used by the XFree86-VidModeExtension and the keypad mode switching +operations. The current 'desired' mode for the CRTC associated with the +'compat' output is placed first in this list to indicate the current mode. +Usually, the driver won't need to call this function as +xf86InitialConfiguration will do so automatically, as well as any RandR +functions which reprobe for modes. However, if the driver reprobes for modes +at other times using xf86ProbeOutputModes, this function needs to be called. + + Bool + xf86DiDGAReInit (ScreenPtr pScreen) + +This is similar to xf86SetScrnInfoModes, but it applies the 'compat' output +mode list to the set of modes advertised by the DGA extension; it needs to +be called whenever xf86ProbeOutputModes is invoked. + + void + xf86DisableUnusedFunctions(ScrnInfoPtr pScrn) + +After any sequence of calls using xf86CrtcSetMode, this function cleans up +any leftover Output and CRTC objects by disabling them, saving power. It is +safe to call this whenever the server is running as it only disables objects +which are not currently in use. + +4. CRTC operations + +4.1 CRTC functions + +These functions provide an abstract interface for the CRTC object; most +manipulation of the CRTC object is done through these functions. + + void + crtc->funcs->dpms (xf86CrtcPtr crtc, int mode) + +Where 'mode' is one of DPMSModeOff, DPMSModeSuspend, DPMSModeStandby or +DPMSModeOn. This requests that the crtc go to the specified power state. +When changing power states, the output dpms functions are invoked before the +crtc dpms functions. + + void + crtc->funcs->save (xf86CrtcPtr crtc) + + void + crtc->funcs->restore (xf86CrtcPtr crtc) + +Preserve/restore any register contents related to the CRTC. These are +strictly a convenience for the driver writer; if the existing driver has +fully operation save/restore functions, you need not place any additional +code here. In particular, the server itself never uses this function. + + Bool + crtc->funcs->lock (xf86CrtcPtr crtc) + + void + crtc->funcs->unlock (xf86CrtcPtr crtc) + +These functions are invoked around mode setting operations; the intent is +that DRI locking be done here to prevent DRI applications from manipulating +the hardware while the server is busy changing the output configuration. If +the lock function returns FALSE, the unlock function will not be invoked. + + Bool + crtc->funcs->mode_fixup (xf86CrtcPtr crtc, + DisplayModePtr mode, + DisplayModePtr adjusted_mode) + +This call gives the CRTC a chance to see what mode will be set and to +comment on the mode by changing 'adjusted_mode' as needed. This function +shall not modify the state of the crtc hardware at all. If the CRTC cannot +accept this mode, this function may return FALSE. + + void + crtc->funcs->prepare (xf86CrtcPtr crtc) + +This call is made just before the mode is set to make the hardware ready for +the operation. A usual function to perform here is to disable the crtc so +that mode setting can occur with clocks turned off and outputs deactivated. + + void + crtc->funcs->mode_set (xf86CrtcPtr crtc, + DisplayModePtr mode, + DisplayModePtr adjusted_mode) + +This function applies the specified mode (possibly adjusted by the CRTC +and/or Outputs). + + void + crtc->funcs->commit (xf86CrtcPtr crtc) + +Once the mode has been applied to the CRTC and Outputs, this function is +invoked to let the hardware turn things back on. + + void + crtc->funcs->gamma_set (xf86CrtcPtr crtc, CARD16 *red, + CARD16 *green, CARD16 *blue, int size) + +This function adjusts the gamma ramps for the specified crtc. + + void * + crtc->funcs->shadow_allocate (xf86CrtcPtr crtc, int width, int height) + +This function allocates frame buffer space for a shadow frame buffer. When +allocated, the crtc must scan from the shadow instead of the main frame +buffer. This is used for rotation. The address returned is passed to the +shadow_create function. This function should return NULL on failure. + + PixmapPtr + crtc->funcs->shadow_create (xf86CrtcPtr crtc, void *data, + int width, int height) + +This function creates a pixmap object that will be used as a shadow of the +main frame buffer for CRTCs which are rotated or reflected. 'data' is the +value returned by shadow_allocate. + + void + crtc->funcs->shadow_destroy (xf86CrtcPtr crtc, PixmapPtr pPixmap, + void *data) + +Destroys any associated shadow objects. If pPixmap is NULL, then a pixmap +was not created, but 'data' may still be non-NULL indicating that the shadow +had been allocated. + + void + crtc->funcs->destroy (xf86CrtcPtr crtc) + +When a CRTC is destroyed (which only happens in error cases), this function +can clean up any driver-specific data. + +4.2 CRTC fields + +The CRTC object is not opaque; there are several fields of interest to the +driver writer. + + struct _xf86Crtc { + /** + * Associated ScrnInfo + */ + ScrnInfoPtr scrn; + + /** + * Active state of this CRTC + * + * Set when this CRTC is driving one or more outputs + */ + Bool enabled; + + /** Track whether cursor is within CRTC range */ + Bool cursorInRange; + + /** Track state of cursor associated with this CRTC */ + Bool cursorShown; + + /** + * Active mode + * + * This reflects the mode as set in the CRTC currently + * It will be cleared when the VT is not active or + * during server startup + */ + DisplayModeRec mode; + Rotation rotation; + PixmapPtr rotatedPixmap; + void *rotatedData; + + /** + * Position on screen + * + * Locates this CRTC within the frame buffer + */ + int x, y; + + /** + * Desired mode + * + * This is set to the requested mode, independent of + * whether the VT is active. In particular, it receives + * the startup configured mode and saves the active mode + * on VT switch. + */ + DisplayModeRec desiredMode; + Rotation desiredRotation; + int desiredX, desiredY; + + /** crtc-specific functions */ + const xf86CrtcFuncsRec *funcs; + + /** + * Driver private + * + * Holds driver-private information + */ + void *driver_private; + #ifdef RANDR_12_INTERFACE + /** + * RandR crtc + * + * When RandR 1.2 is available, this + * points at the associated crtc object + */ + RRCrtcPtr randr_crtc; + #else + void *randr_crtc; + #endif + }; + + +5. Output functions. + +6. Configuration + +Because the configuration file syntax is fixed, +this was done by creating new "Driver" section options that hook specific +outputs to specific "Monitor" sections in the file. The option: +section of the form: + + Option "monitor-VGA" "My VGA Monitor" + +connects the VGA output of this driver to the "Monitor" section with +Identifier "My VGA Monitor". All of the usual monitor options can now be +placed in that "Monitor" section and will be applied to the VGA output +configuration. diff --git a/xorg-server/hw/xfree86/doc/man/Xorg.man.pre b/xorg-server/hw/xfree86/doc/man/Xorg.man.pre index fe3280038..46d0e4468 100644 --- a/xorg-server/hw/xfree86/doc/man/Xorg.man.pre +++ b/xorg-server/hw/xfree86/doc/man/Xorg.man.pre @@ -109,7 +109,7 @@ script. .B __xservername__ supports several mechanisms for supplying/obtaining configuration and run-time parameters: command line options, environment variables, the -__xconfigfile__(__filemansuffix__) configuration file, auto-detection, and +__xconfigfile__(__filemansuffix__) configuration files, auto-detection, and fallback defaults. When the same information is supplied in more than one way, the highest precedence mechanism is used. The list of mechanisms is ordered from highest precedence to lowest. Note that not all parameters @@ -176,6 +176,13 @@ This option will work for any file when the server is run as root (i.e, with real-uid 0), or for files relative to a directory in the config search path for all other users. .TP 8 +.BI \-configdir " directory" +Read the server configuration files from +.IR directory . +This option will work for any directory when the server is run as root +(i.e, with real-uid 0), or for directories relative to a directory in the +config directory search path for all other users. +.TP 8 .B \-configure When this option is specified, the .B __xservername__ @@ -421,25 +428,18 @@ The .B __xservername__ server is normally configured to recognize various special combinations of key presses that instruct the server to perform some action, rather -than just sending the key press event to a client application. The -default XKEYBOARD keymap defines the key combinations listed below. -The kbd (__drivermansuffix__) driver also has these key combinations -builtin to its event handler -for cases where the XKEYBOARD extension is not being used. When using -the XKEYBOARD extension, which key combinations perform which actions -is completely configurable. +than just sending the key press event to a client application. These actions +depend on the XKB keymap loaded by a particular keyboard device and may or +may not be available on a given configuration. .PP -The special combinations of key presses recognized directly -by -.B __xservername__ -are: +The following key combinations are commonly part of the default XKEYBOARD +keymap. .TP 8 .B Ctrl+Alt+Backspace -Immediately kills the server -- no questions asked. This is disabled by -default. It can be enabled with the -retro command line flag or by setting -the +Immediately kills the server -- no questions asked. It can be disabled by +setting the .B DontZap -__xconfigfile__(__filemansuffix__) file option to a FALSE value. +__xconfigfile__(__filemansuffix__) file option to a TRUE value. .TP 8 .B Ctrl+Alt+Keypad-Plus Change video mode to next one specified in the configuration file. @@ -463,6 +463,10 @@ __xconfigfile__(__filemansuffix__) file option. .B __xservername__ typically uses a configuration file called .B __xconfigfile__ +and configuration files with the suffix +.I .conf +in a directory called +.B __xconfigdir__ for its initial setup. Refer to the __xconfigfile__(__filemansuffix__) manual page for information about the format of this file. @@ -471,7 +475,9 @@ about the format of this file. has a mechanism for automatically generating a built-in configuration at run-time when no .B __xconfigfile__ -file is present. The current version of this automatic configuration +file or +.B __xconfigdir__ +files are present. The current version of this automatic configuration mechanism works in two ways. .PP The first is via enhancements that have made many components of the @@ -493,7 +499,7 @@ supported by __xservername__. Enhancements are planned for future releases. .SH FILES The .B __xservername__ -server config file can be found in a range of locations. These are +server config files can be found in a range of locations. These are documented fully in the __xconfigfile__(__filemansuffix__) manual page. The most commonly used locations are shown here. .TP 30 @@ -512,6 +518,21 @@ Server configuration file. .B __projectroot__/lib/X11/__xconfigfile__ Server configuration file. .TP 30 +.B /etc/X11/__xconfigdir__ +Server configuration directory. +.TP 30 +.B /etc/X11/__xconfigdir__-4 +Server configuration directory. +.TP 30 +.B /etc/__xconfigdir__ +Server configuration directory. +.TP 30 +.B __projectroot__/etc/__xconfigdir__ +Server configuration directory. +.TP 30 +.B __projectroot__/lib/X11/__xconfigdir__ +Server configuration directory. +.TP 30 .BI __logdir__/__xservername__. n .log Server log file for display .IR n . diff --git a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre index ace041c92..5b98bda63 100644 --- a/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre +++ b/xorg-server/hw/xfree86/doc/man/xorg.conf.man.pre @@ -2,27 +2,35 @@ .ds q \N'34' .TH __xconfigfile__ __filemansuffix__ __vendorversion__ .SH NAME -__xconfigfile__ \- configuration File for __xservername__ X server +__xconfigfile__ and __xconfigdir__ \- configuration files for +__xservername__ X server .SH INTRODUCTION .B __xservername__ supports several mechanisms for supplying/obtaining configuration and run-time parameters: command line options, environment variables, the -__xconfigfile__ configuration file, auto-detection, and fallback defaults. -When the same information is supplied in more than one way, the highest -precedence mechanism is used. The list of mechanisms is ordered from -highest precedence to lowest. Note that not all parameters can be -supplied via all methods. The available command line options and -environment variables (and some defaults) are described in the Xserver(__appmansuffix__) -and __xservername__(__appmansuffix__) manual pages. Most configuration file parameters, with -their defaults, are described below. Driver and module specific -configuration parameters are described in the relevant driver or module -manual page. +__xconfigfile__ and __xconfigdir__ configuration files, auto-detection, +and fallback defaults. When the same information is supplied in more +than one way, the highest precedence mechanism is used. The list of +mechanisms is ordered from highest precedence to lowest. Note that not +all parameters can be supplied via all methods. The available command +line options and environment variables (and some defaults) are +described in the Xserver(__appmansuffix__) and +__xservername__(__appmansuffix__) manual pages. Most configuration file +parameters, with their defaults, are described below. Driver and module +specific configuration parameters are described in the relevant driver +or module manual page. .SH DESCRIPTION .B __xservername__ uses a configuration file called .I __xconfigfile__ +and files ending in the suffix +.I .conf +from the directory +.I __xconfigdir__ for its initial setup. -This configuration file is searched for in the following places when the +The +.I __xconfigfile__ +configuration file is searched for in the following places when the server is started as a normal user: .PP .RS 4 @@ -93,9 +101,28 @@ directory), and is the machine's hostname as reported by .BR gethostname (__libmansuffix__). .PP +Additional configuration files are searched for in the following +directories: +.PP +.RS 4 +.nf +.I /etc/X11/__xconfigdir__\-4 +.I /etc/X11/__xconfigdir__ +.I /etc/__xconfigdir__ +.IR __projectroot__/etc/X11/__xconfigdir__. +.I __projectroot__/etc/X11/__xconfigdir__\-4 +.I __projectroot__/etc/X11/__xconfigdir__ +.IR __projectroot__/lib/X11/__xconfigdir__. +.I __projectroot__/lib/X11/__xconfigdir__\-4 +.I __projectroot__/lib/X11/__xconfigdir__ +.fi +.RE +.PP The .I __xconfigfile__ -file is composed of a number of sections which may be present in any order, +and +.I __xconfigdir__ +files are composed of a number of sections which may be present in any order, or omitted to use default configuration values. Each section has the form: .PP @@ -117,6 +144,7 @@ The section names are: .BR "Module " "Dynamic module loading" .BR "Extensions " "Extension enabling" .BR "InputDevice " "Input device description" +.BR "InputClass " "Input class description" .BR "Device " "Graphics device description" .BR "VideoAdaptor " "Xv video adaptor description" .BR "Monitor " "Monitor description" @@ -769,11 +797,28 @@ Example: the MIT-SHM extension can be disabled with the following entry: The config file may have multiple .B InputDevice sections. -If HAL is not being used for input device configuration, there will normally -be at least two: one for the core (primary) keyboard, -and one of the core pointer. +Recent X servers employ input hotplugging to add input devices, with the HAL +backend being the default backend for X servers since 1.4. It is usually not +necessary to provide +.B InputDevice +sections in the xorg.conf if hotplugging is enabled. +.PP +If hotplugging is disabled, there will normally +be at least two: one for the core (primary) keyboard +and one for the core pointer. If either of these two is missing, a default configuration for the missing -ones will be used. +ones will be used. In the absence of an explicitly specified core input +device, the first +.B InputDevice +marked as +.B CorePointer +(or +.BR CoreKeyboard ) +is used. +If there is no match there, the first +.B InputDevice +that uses the \(lqmouse\(rq (or \(lqkbd\(rq) driver is used. +The final fallback is to use built\-in default configurations. Currently the default configuration may not work as expected on all platforms. .PP .B InputDevice @@ -828,17 +873,6 @@ and .BR mousedrv (__drivermansuffix__) on other platforms. .PP -In the absence of an explicitly specified core input device, the first -.B InputDevice -marked as -.B CorePointer -(or -.BR CoreKeyboard ) -is used. -If there is no match there, the first -.B InputDevice -that uses the \(lqmouse\(rq (or \(lqkbd\(rq) driver is used. -The final fallback is to use built\-in default configurations. .PP .B InputDevice sections recognise some driver\-independent @@ -847,48 +881,135 @@ which are described here. See the individual input driver manual pages for a description of the device\-specific options. .TP 7 +.BI "Option \*qAutoServerLayout\*q \*q" boolean \*q +Always add the device to the ServerLayout section used by this instance of +the server. This affects implied layouts as well as explicit layouts +specified in the configuration and/or on the command line. +.TP 7 .BI "Option \*qCorePointer\*q" -When this is set, the input device is installed as the core (primary) -pointer device. -There must be exactly one core pointer. -If this option is not set here, or in the -.B ServerLayout -section, or from the -.B \-pointer -command line option, then the first input device that is capable of -being used as a core pointer will be selected as the core pointer. -This option is implicitly set when the obsolete -.B Pointer -section is used. +Deprecated, use +.B SendCoreEvents +instead. .TP 7 .BI "Option \*qCoreKeyboard\*q" -When this is set, the input device is to be installed as the core -(primary) keyboard device. -There must be exactly one core keyboard. -If this option is not set here, in the -.B ServerLayout -section, or from the -.B \-keyboard -command line option, then the first input device that is capable of -being used as a core keyboard will be selected as the core keyboard. -This option is implicitly set when the obsolete -.B Keyboard -section is used. +Deprecated, use +.B SendCoreEvents +instead. .TP 7 .BI "Option \*qAlwaysCore\*q \*q" boolean \*q +.B +Deprecated, use +.B SendCoreEvents +instead. .TP 7 .BI "Option \*qSendCoreEvents\*q \*q" boolean \*q Both of these options are equivalent, and when enabled cause the -input device to always report core events. -This can be used, for example, to allow an additional pointer device to -generate core pointer events (like moving the cursor, etc). -.TP 4 -.BI "Option \*qHistorySize\*q \*q" number \*q -Sets the motion history size. -Default: 0. +input device to report core events through the master device. They are +enabled by default. Any device configured to send core events will be +attached to the virtual core pointer or keyboard and control the cursor by +default. Devices with +.B SendCoreEvents +disabled will be \*qfloating\*q and only accessible by clients employing the +X Input extension. This option controls the startup behavior only, a device +may be reattached or set floating at runtime. .TP 7 .BI "Option \*qSendDragEvents\*q \*q" boolean \*q ??? +.SH "INPUTCLASS SECTION" +The config file may have multiple +.B InputClass +sections. +These sections are optional and are used to provide configuration for a +class of input devices as they are automatically added. An input device can +match more than one +.B InputClass +section. Each class can only supplement settings from a previous class, so +it is best to arrange the sections with the most generic matches last. +.PP +.B InputClass +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qInputClass\*q" +.BI " Identifier \*q" name \*q +.I " entries" +.I " ..." +.I " options" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry is required in all +.B InputClass +sections. +All other entries are optional. +.PP +The +.B Identifier +entry specifies the unique name for this input class. +The +.B Driver +entry specifies the name of the driver to use for this input device. +After all classes have been examined, the +.RI \*q inputdriver \*q +module from the final +.B Driver +entry will be enabled when using the loadable server. +.PP +When an input device is automatically added, its characteristics are +checked against all +.B InputClass +sections. Each section can contain optional entries to narrow the match +of the class. If none of the optional entries appear, the +.B InputClass +section is generic and will match any input device. If more than one of +these entries appear, they all must match for the configuration to apply. +The allowed matching entries are shown below. +.PP +.TP 7 +.BI "MatchProduct \*q" matchproduct \*q +This entry can be used to check if the substring +.RI \*q matchproduct \*q +occurs in the device's product name. +.TP 7 +.BI "MatchVendor \*q" matchvendor \*q +This entry can be used to check if the substring +.RI \*q matchvendor \*q +occurs in the device's vendor name. +.TP 7 +.BI "MatchDevicePath \*q" matchdevice \*q +This entry can be used to check if the device file matches the +.RI \*q matchdevice \*q +pathname pattern. +.TP 7 +.BI "MatchIsKeyboard \*q" bool \*q +.TP 7 +.BI "MatchIsPointer \*q" bool \*q +.TP 7 +.BI "MatchIsJoystick \*q" bool \*q +.TP 7 +.BI "MatchIsTablet \*q" bool \*q +.TP 7 +.BI "MatchIsTouchpad \*q" bool \*q +.TP 7 +.BI "MatchIsTouchscreen \*q" bool \*q +Match device types. These entries take a boolean argument similar to +.B Option +entries. +.PP +When an input device has been matched to the +.B InputClass +section, any +.B Option +entries are applied to the device. See the +.B InputDevice +section above for a description of the various +.B Option +entries. .SH "DEVICE SECTION" The config file may have multiple .B Device diff --git a/xorg-server/hw/xfree86/exa/examodule.c b/xorg-server/hw/xfree86/exa/examodule.c index 601288c73..bcb6a405c 100644 --- a/xorg-server/hw/xfree86/exa/examodule.c +++ b/xorg-server/hw/xfree86/exa/examodule.c @@ -122,24 +122,25 @@ exaDDXDriverInit(ScreenPtr pScreen) memcpy(pScreenPriv->options, EXAOptions, sizeof(EXAOptions)); xf86ProcessOptions (pScrn->scrnIndex, pScrn->options, pScreenPriv->options); - if ((pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) && - pExaScr->info->offScreenBase < pExaScr->info->memorySize) - { - char *heuristicName; - - heuristicName = xf86GetOptValString (pScreenPriv->options, - EXAOPT_MIGRATION_HEURISTIC); - if (heuristicName != NULL) { - if (strcmp(heuristicName, "greedy") == 0) - pExaScr->migration = ExaMigrationGreedy; - else if (strcmp(heuristicName, "always") == 0) - pExaScr->migration = ExaMigrationAlways; - else if (strcmp(heuristicName, "smart") == 0) - pExaScr->migration = ExaMigrationSmart; - else { - xf86DrvMsg (pScreen->myNum, X_WARNING, - "EXA: unknown migration heuristic %s\n", - heuristicName); + if (pExaScr->info->flags & EXA_OFFSCREEN_PIXMAPS) { + if (!(pExaScr->info->flags & EXA_HANDLES_PIXMAPS) && + pExaScr->info->offScreenBase < pExaScr->info->memorySize) { + char *heuristicName; + + heuristicName = xf86GetOptValString (pScreenPriv->options, + EXAOPT_MIGRATION_HEURISTIC); + if (heuristicName != NULL) { + if (strcmp(heuristicName, "greedy") == 0) + pExaScr->migration = ExaMigrationGreedy; + else if (strcmp(heuristicName, "always") == 0) + pExaScr->migration = ExaMigrationAlways; + else if (strcmp(heuristicName, "smart") == 0) + pExaScr->migration = ExaMigrationSmart; + else { + xf86DrvMsg (pScreen->myNum, X_WARNING, + "EXA: unknown migration heuristic %s\n", + heuristicName); + } } } diff --git a/xorg-server/hw/xfree86/parser/Configint.h b/xorg-server/hw/xfree86/parser/Configint.h index cdc7be806..03509b397 100644 --- a/xorg-server/hw/xfree86/parser/Configint.h +++ b/xorg-server/hw/xfree86/parser/Configint.h @@ -148,6 +148,8 @@ else\ "The %s keyword requires a number to follow it." #define POSITIVE_INT_MSG \ "The %s keyword requires a positive integer to follow it." +#define BOOL_MSG \ +"The %s keyword requires a boolean to follow it." #define ZAXISMAPPING_MSG \ "The ZAxisMapping keyword requires 2 positive numbers or X or Y to follow it." #define AUTOREPEAT_MSG \ diff --git a/xorg-server/hw/xfree86/parser/Input.c b/xorg-server/hw/xfree86/parser/Input.c index 4e3c04e53..8c8e46fb4 100644 --- a/xorg-server/hw/xfree86/parser/Input.c +++ b/xorg-server/hw/xfree86/parser/Input.c @@ -172,13 +172,6 @@ xf86validateInput (XF86ConfigPtr p) { XF86ConfInputPtr input = p->conf_input_lst; -#if 0 /* Enable this later */ - if (!input) { - xf86validationError ("At least one InputDevice section is required."); - return (FALSE); - } -#endif - while (input) { if (!input->inp_driver) { xf86validationError (UNDEFINED_INPUTDRIVER_MSG, input->inp_identifier); diff --git a/xorg-server/hw/xfree86/parser/InputClass.c b/xorg-server/hw/xfree86/parser/InputClass.c new file mode 100644 index 000000000..1c9816012 --- /dev/null +++ b/xorg-server/hw/xfree86/parser/InputClass.c @@ -0,0 +1,232 @@ +/* + * Copyright (c) 2009 Dan Nicholson + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ + +/* View/edit this file with tab stops set to 4 */ + +#ifdef HAVE_XORG_CONFIG_H +#include +#endif + +#include "xf86Parser.h" +#include "xf86tokens.h" +#include "Configint.h" + +extern LexRec val; + +static +xf86ConfigSymTabRec InputClassTab[] = +{ + {ENDSECTION, "endsection"}, + {IDENTIFIER, "identifier"}, + {OPTION, "option"}, + {DRIVER, "driver"}, + {MATCH_PRODUCT, "matchproduct"}, + {MATCH_VENDOR, "matchvendor"}, + {MATCH_DEVICE_PATH, "matchdevicepath"}, + {MATCH_IS_KEYBOARD, "matchiskeyboard"}, + {MATCH_IS_POINTER, "matchispointer"}, + {MATCH_IS_JOYSTICK, "matchisjoystick"}, + {MATCH_IS_TABLET, "matchistablet"}, + {MATCH_IS_TOUCHPAD, "matchistouchpad"}, + {MATCH_IS_TOUCHSCREEN, "matchistouchscreen"}, + {-1, ""}, +}; + +#define CLEANUP xf86freeInputClassList + +XF86ConfInputClassPtr +xf86parseInputClassSection(void) +{ + int has_ident = FALSE; + int token; + + parsePrologue(XF86ConfInputClassPtr, XF86ConfInputClassRec) + + while ((token = xf86getToken(InputClassTab)) != ENDSECTION) { + switch (token) { + case COMMENT: + ptr->comment = xf86addComment(ptr->comment, val.str); + break; + case IDENTIFIER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error(MULTIPLE_MSG, "Identifier"); + ptr->identifier = val.str; + has_ident = TRUE; + break; + case DRIVER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "Driver"); + if (strcmp(val.str, "keyboard") == 0) + ptr->driver = "kbd"; + else + ptr->driver = val.str; + break; + case OPTION: + ptr->option_lst = xf86parseOption(ptr->option_lst); + break; + case MATCH_PRODUCT: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchProduct"); + ptr->match_product = val.str; + break; + case MATCH_VENDOR: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchVendor"); + ptr->match_vendor = val.str; + break; + case MATCH_DEVICE_PATH: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchDevicePath"); + ptr->match_device = val.str; + break; + case MATCH_IS_KEYBOARD: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsKeyboard"); + ptr->is_keyboard.set = xf86getBoolValue(&ptr->is_keyboard.val, + val.str); + if (!ptr->is_keyboard.set) + Error(BOOL_MSG, "MatchIsKeyboard"); + break; + case MATCH_IS_POINTER: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsPointer"); + ptr->is_pointer.set = xf86getBoolValue(&ptr->is_pointer.val, + val.str); + if (!ptr->is_pointer.set) + Error(BOOL_MSG, "MatchIsPointer"); + break; + case MATCH_IS_JOYSTICK: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsJoystick"); + ptr->is_joystick.set = xf86getBoolValue(&ptr->is_joystick.val, + val.str); + if (!ptr->is_joystick.set) + Error(BOOL_MSG, "MatchIsJoystick"); + break; + case MATCH_IS_TABLET: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsTablet"); + ptr->is_tablet.set = xf86getBoolValue(&ptr->is_tablet.val, + val.str); + if (!ptr->is_tablet.set) + Error(BOOL_MSG, "MatchIsTablet"); + break; + case MATCH_IS_TOUCHPAD: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsTouchpad"); + ptr->is_touchpad.set = xf86getBoolValue(&ptr->is_touchpad.val, + val.str); + if (!ptr->is_touchpad.set) + Error(BOOL_MSG, "MatchIsTouchpad"); + break; + case MATCH_IS_TOUCHSCREEN: + if (xf86getSubToken(&(ptr->comment)) != STRING) + Error(QUOTE_MSG, "MatchIsTouchscreen"); + ptr->is_touchscreen.set = xf86getBoolValue(&ptr->is_touchscreen.val, + val.str); + if (!ptr->is_touchscreen.set) + Error(BOOL_MSG, "MatchIsTouchscreen"); + break; + case EOF_TOKEN: + Error(UNEXPECTED_EOF_MSG, NULL); + break; + default: + Error(INVALID_KEYWORD_MSG, xf86tokenString ()); + break; + } + } + + if (!has_ident) + Error(NO_IDENT_MSG, NULL); + +#ifdef DEBUG + printf("InputClass section parsed\n"); +#endif + + return ptr; +} + +void +xf86printInputClassSection (FILE * cf, XF86ConfInputClassPtr ptr) +{ + while (ptr) { + fprintf(cf, "Section \"InputClass\"\n"); + if (ptr->comment) + fprintf(cf, "%s", ptr->comment); + if (ptr->identifier) + fprintf(cf, "\tIdentifier \"%s\"\n", ptr->identifier); + if (ptr->driver) + fprintf(cf, "\tDriver \"%s\"\n", ptr->driver); + if (ptr->match_product) + fprintf(cf, "\tMatchProduct \"%s\"\n", ptr->match_product); + if (ptr->match_vendor) + fprintf(cf, "\tMatchVendor \"%s\"\n", ptr->match_vendor); + if (ptr->match_device) + fprintf(cf, "\tMatchDevicePath \"%s\"\n", ptr->match_device); + if (ptr->is_keyboard.set) + fprintf(cf, "\tIsKeyboard \"%s\"\n", + ptr->is_keyboard.val ? "yes" : "no"); + if (ptr->is_pointer.set) + fprintf(cf, "\tIsPointer \"%s\"\n", + ptr->is_pointer.val ? "yes" : "no"); + if (ptr->is_joystick.set) + fprintf(cf, "\tIsJoystick \"%s\"\n", + ptr->is_joystick.val ? "yes" : "no"); + if (ptr->is_tablet.set) + fprintf(cf, "\tIsTablet \"%s\"\n", + ptr->is_tablet.val ? "yes" : "no"); + if (ptr->is_touchpad.set) + fprintf(cf, "\tIsTouchpad \"%s\"\n", + ptr->is_touchpad.val ? "yes" : "no"); + if (ptr->is_touchscreen.set) + fprintf(cf, "\tIsTouchscreen \"%s\"\n", + ptr->is_touchscreen.val ? "yes" : "no"); + xf86printOptionList(cf, ptr->option_lst, 1); + fprintf(cf, "EndSection\n\n"); + ptr = ptr->list.next; + } +} + +void +xf86freeInputClassList (XF86ConfInputClassPtr ptr) +{ + XF86ConfInputClassPtr prev; + + while (ptr) { + TestFree(ptr->identifier); + TestFree(ptr->driver); + TestFree(ptr->match_product); + TestFree(ptr->match_vendor); + TestFree(ptr->match_device); + TestFree(ptr->comment); + xf86optionListFree(ptr->option_lst); + + prev = ptr; + ptr = ptr->list.next; + free(prev); + } +} diff --git a/xorg-server/hw/xfree86/parser/Layout.c b/xorg-server/hw/xfree86/parser/Layout.c index d548cd210..00c1e7d09 100644 --- a/xorg-server/hw/xfree86/parser/Layout.c +++ b/xorg-server/hw/xfree86/parser/Layout.c @@ -64,6 +64,10 @@ #include "Configint.h" #include + +/* Needed for auto server layout */ +extern int xf86CheckBoolOption(void* optlist, const char *name, int deflt); + extern LexRec val; static xf86ConfigSymTabRec LayoutTab[] = @@ -435,18 +439,58 @@ xf86freeLayoutList (XF86ConfLayoutPtr ptr) } } -#define CheckScreen(str, ptr)\ -if (str[0] != '\0') \ -{ \ -screen = xf86findScreen (str, p->conf_screen_lst); \ -if (!screen) \ -{ \ - xf86validationError (UNDEFINED_SCREEN_MSG, \ - str, layout->lay_identifier); \ - return (FALSE); \ -} \ -else \ - ptr = screen; \ +int +xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout) +{ + int count = 0; + XF86ConfInputPtr input = config->conf_input_lst; + XF86ConfInputrefPtr inptr; + + /* add all AutoServerLayout devices to the server layout */ + while (input) + { + if (xf86CheckBoolOption(input->inp_option_lst, "AutoServerLayout", FALSE)) + { + XF86ConfInputrefPtr iref = layout->lay_input_lst; + + /* avoid duplicates if referenced but lists AutoServerLayout too */ + while (iref) + { + if (strcmp(iref->iref_inputdev_str, input->inp_identifier) == 0) + break; + iref = iref->list.next; + } + + if (!iref) + { + XF86ConfInputrefPtr iptr; + iptr = calloc(1, sizeof(XF86ConfInputrefRec)); + iptr->iref_inputdev_str = input->inp_identifier; + layout->lay_input_lst = (XF86ConfInputrefPtr) + xf86addListItem((glp)layout->lay_input_lst, (glp)iptr); + count++; + } + } + input = input->list.next; + } + + inptr = layout->lay_input_lst; + while (inptr) + { + input = xf86findInput (inptr->iref_inputdev_str, + config->conf_input_lst); + if (!input) + { + xf86validationError (UNDEFINED_INPUT_MSG, + inptr->iref_inputdev_str, layout->lay_identifier); + return -1; + } + else + inptr->iref_inputdev = input; + inptr = inptr->list.next; + } + + return count; } int @@ -455,10 +499,8 @@ xf86validateLayout (XF86ConfigPtr p) XF86ConfLayoutPtr layout = p->conf_layout_lst; XF86ConfAdjacencyPtr adj; XF86ConfInactivePtr iptr; - XF86ConfInputrefPtr inptr; XF86ConfScreenPtr screen; XF86ConfDevicePtr device; - XF86ConfInputPtr input; while (layout) { @@ -476,13 +518,6 @@ xf86validateLayout (XF86ConfigPtr p) else adj->adj_screen = screen; -#if 0 - CheckScreen (adj->adj_top_str, adj->adj_top); - CheckScreen (adj->adj_bottom_str, adj->adj_bottom); - CheckScreen (adj->adj_left_str, adj->adj_left); - CheckScreen (adj->adj_right_str, adj->adj_right); -#endif - adj = adj->list.next; } iptr = layout->lay_inactive_lst; @@ -500,21 +535,10 @@ xf86validateLayout (XF86ConfigPtr p) iptr->inactive_device = device; iptr = iptr->list.next; } - inptr = layout->lay_input_lst; - while (inptr) - { - input = xf86findInput (inptr->iref_inputdev_str, - p->conf_input_lst); - if (!input) - { - xf86validationError (UNDEFINED_INPUT_MSG, - inptr->iref_inputdev_str, layout->lay_identifier); - return (FALSE); - } - else - inptr->iref_inputdev = input; - inptr = inptr->list.next; - } + + if (xf86layoutAddInputDevices(p, layout) == -1) + return FALSE; + layout = layout->list.next; } return (TRUE); diff --git a/xorg-server/hw/xfree86/parser/Makefile.am b/xorg-server/hw/xfree86/parser/Makefile.am index b8fab2835..49c191f2a 100644 --- a/xorg-server/hw/xfree86/parser/Makefile.am +++ b/xorg-server/hw/xfree86/parser/Makefile.am @@ -13,6 +13,7 @@ INTERNAL_SOURCES= \ Files.c \ Flags.c \ Input.c \ + InputClass.c \ Layout.c \ Module.c \ Video.c \ diff --git a/xorg-server/hw/xfree86/parser/configProcs.h b/xorg-server/hw/xfree86/parser/configProcs.h index 26ba40ebb..7d8a8e53a 100644 --- a/xorg-server/hw/xfree86/parser/configProcs.h +++ b/xorg-server/hw/xfree86/parser/configProcs.h @@ -48,6 +48,10 @@ XF86ConfInputPtr xf86parseInputSection(void); void xf86printInputSection(FILE *f, XF86ConfInputPtr ptr); void xf86freeInputList(XF86ConfInputPtr ptr); int xf86validateInput (XF86ConfigPtr p); +/* InputClass.c */ +XF86ConfInputClassPtr xf86parseInputClassSection(void); +void xf86printInputClassSection(FILE *f, XF86ConfInputClassPtr ptr); +void xf86freeInputClassList(XF86ConfInputClassPtr ptr); /* Layout.c */ XF86ConfLayoutPtr xf86parseLayoutSection(void); void xf86printLayoutSection(FILE *cf, XF86ConfLayoutPtr ptr); diff --git a/xorg-server/hw/xfree86/parser/read.c b/xorg-server/hw/xfree86/parser/read.c index e965d209e..1091be5e5 100644 --- a/xorg-server/hw/xfree86/parser/read.c +++ b/xorg-server/hw/xfree86/parser/read.c @@ -177,6 +177,14 @@ xf86readConfigFile (void) HANDLE_LIST (conf_input_lst, xf86parseInputSection, XF86ConfInputPtr); } + else if (xf86nameCompare(val.str, "inputclass") == 0) + { + free(val.str); + val.str = NULL; + HANDLE_LIST (conf_inputclass_lst, + xf86parseInputClassSection, + XF86ConfInputClassPtr); + } else if (xf86nameCompare (val.str, "module") == 0) { free(val.str); diff --git a/xorg-server/hw/xfree86/parser/scan.c b/xorg-server/hw/xfree86/parser/scan.c index d2e8b6d2b..b80fbfb8f 100644 --- a/xorg-server/hw/xfree86/parser/scan.c +++ b/xorg-server/hw/xfree86/parser/scan.c @@ -62,8 +62,11 @@ #include #include #include +#include +#include #include #include +#include #include #if defined(_POSIX_SOURCE) @@ -90,17 +93,24 @@ #include "xf86tokens.h" #define CONFIG_BUF_LEN 1024 +#define CONFIG_MAX_FILES 64 static int StringToToken (char *, xf86ConfigSymTabRec *); -static FILE *configFile = NULL; +static struct { + FILE *file; + char *path; +} configFiles[CONFIG_MAX_FILES]; static const char **builtinConfig = NULL; static int builtinIndex = 0; static int configPos = 0; /* current readers position */ static int configLineNo = 0; /* linenumber */ static char *configBuf, *configRBuf; /* buffer for lines */ static char *configPath; /* path to config file */ +static char *configDirPath; /* path to config dir */ static char *configSection = NULL; /* name of current section being parsed */ +static int numFiles = 0; /* number of config files */ +static int curFileIndex = 0; /* index of current config file */ static int pushToken = LOCK_TOKEN; static int eol_seen = 0; /* private state to handle comments */ LexRec val; @@ -155,7 +165,7 @@ xf86strToUL (char *str) /* * xf86getNextLine -- * - * read from the configFile FILE stream until we encounter a new + * read from the configFiles FILE stream until we encounter a new * line; this is effectively just a big wrapper for fgets(3). * * xf86getToken() assumes that we will read up to the next @@ -213,9 +223,18 @@ xf86getNextLine(void) /* read in another block of chars */ do { - ret = fgets(configBuf + pos, configBufLen - pos - 1, configFile); + ret = fgets(configBuf + pos, configBufLen - pos - 1, + configFiles[curFileIndex].file); - if (!ret) break; + if (!ret) { + /* stop if there are no more files */ + if (++curFileIndex >= numFiles) { + curFileIndex = 0; + break; + } + configLineNo = 0; + continue; + } /* search for EOL in the new block of chars */ @@ -306,7 +325,7 @@ again: if (!c) { char *ret; - if (configFile) + if (numFiles > 0) ret = xf86getNextLine(); else { if (builtinConfig[builtinIndex] == NULL) @@ -575,6 +594,12 @@ xf86pathIsSafe(const char *path) #ifndef XCONFIGFILE #define XCONFIGFILE "xorg.conf" #endif +#ifndef XCONFIGDIR +#define XCONFIGDIR "xorg.conf.d" +#endif +#ifndef XCONFIGSUFFIX +#define XCONFIGSUFFIX ".conf" +#endif #ifndef PROJECTROOT #define PROJECTROOT "/usr/X11R6" #endif @@ -616,7 +641,8 @@ xf86pathIsSafe(const char *path) static char * DoSubstitution(const char *template, const char *cmdline, const char *projroot, - int *cmdlineUsed, int *envUsed, char *XConfigFile) + int *cmdlineUsed, int *envUsed, + const char *XConfigFile) { char *result; int i, l; @@ -745,7 +771,164 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot, return result; } -/* +/* + * Given some searching parameters, locate and open the xorg config file. + */ +static char * +OpenConfigFile(const char *path, const char *cmdline, const char *projroot, + const char *confname) +{ + char *filepath = NULL; + char *pathcopy; + const char *template; + int cmdlineUsed = 0; + FILE *file = NULL; + + pathcopy = strdup(path); + for (template = strtok(pathcopy, ","); template && !file; + template = strtok(NULL, ",")) { + filepath = DoSubstitution(template, cmdline, projroot, + &cmdlineUsed, NULL, confname); + if (!filepath) + continue; + if (cmdline && !cmdlineUsed) { + free(filepath); + filepath = NULL; + continue; + } + file = fopen(filepath, "r"); + if (!file) { + free(filepath); + filepath = NULL; + } + } + + if (file) { + configFiles[numFiles].file = file; + configFiles[numFiles].path = strdup(filepath); + numFiles++; + } + return filepath; +} + +/* + * Match non-hidden files in the xorg config directory with a .conf + * suffix. This filter is passed to scandir(3). + */ +static int +ConfigFilter(const struct dirent *de) +{ + const char *name = de->d_name; + size_t len = strlen(name); + size_t suflen = strlen(XCONFIGSUFFIX); + + if (!name || name[0] == '.' || len <= suflen) + return 0; + if (strcmp(&name[len-suflen], XCONFIGSUFFIX) != 0) + return 0; + return 1; +} + +static Bool +AddConfigDirFiles(const char *dirpath, struct dirent **list, int num) +{ + int i; + Bool openedFile = FALSE; + Bool warnOnce = FALSE; + + for (i = 0; i < num; i++) { + char *path; + FILE *file; + + if (numFiles >= CONFIG_MAX_FILES) { + if (!warnOnce) { + ErrorF("Maximum number of configuration " + "files opened\n"); + warnOnce = TRUE; + } + free(list[i]); + continue; + } + + path = malloc(PATH_MAX + 1); + snprintf(path, PATH_MAX + 1, "%s/%s", dirpath, + list[i]->d_name); + free(list[i]); + file = fopen(path, "r"); + if (!file) { + free(path); + continue; + } + openedFile = TRUE; + + configFiles[numFiles].file = file; + configFiles[numFiles].path = path; + numFiles++; + } + + return openedFile; +} + +/* + * Given some searching parameters, locate and open the xorg config + * directory. The directory does not need to contain config files. + */ +static char * +OpenConfigDir(const char *path, const char *cmdline, const char *projroot, + const char *confname) +{ + char *dirpath, *pathcopy; + const char *template; + Bool found = FALSE; + int cmdlineUsed = 0; + + pathcopy = strdup(path); + for (template = strtok(pathcopy, ","); template && !found; + template = strtok(NULL, ",")) { + struct dirent **list = NULL; + int num; + + dirpath = DoSubstitution(template, cmdline, projroot, + &cmdlineUsed, NULL, confname); + if (!dirpath) + continue; + if (cmdline && !cmdlineUsed) { + free(dirpath); + dirpath = NULL; + continue; + } + + /* match files named *.conf */ + num = scandir(dirpath, &list, ConfigFilter, alphasort); + found = AddConfigDirFiles(dirpath, list, num); + if (!found) { + free(dirpath); + dirpath = NULL; + if (list) + free(list); + } + } + + return dirpath; +} + +/* + * xf86initConfigFiles -- Setup global variables and buffers. + */ +void +xf86initConfigFiles(void) +{ + curFileIndex = 0; + configPos = 0; + configLineNo = 0; + pushToken = LOCK_TOKEN; + + configBuf = malloc(CONFIG_BUF_LEN); + configRBuf = malloc(CONFIG_BUF_LEN); + configBuf[0] = '\0'; /* sanity ... */ +} + +/* * xf86openConfigFile -- * * This function take a config file search path (optional), a command-line @@ -758,7 +941,7 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot, * opened. When no file is found, the return value is NULL. * * The escape sequences allowed in the search path are defined above. - * + * */ #ifndef DEFAULT_CONF_PATH @@ -780,117 +963,90 @@ DoSubstitution(const char *template, const char *cmdline, const char *projroot, const char * xf86openConfigFile(const char *path, const char *cmdline, const char *projroot) { - char *pathcopy; - const char *template; - int cmdlineUsed = 0; - - configFile = NULL; - configPos = 0; /* current readers position */ - configLineNo = 0; /* linenumber */ - pushToken = LOCK_TOKEN; - if (!path || !path[0]) path = DEFAULT_CONF_PATH; - pathcopy = malloc(strlen(path) + 1); - strcpy(pathcopy, path); if (!projroot || !projroot[0]) projroot = PROJECTROOT; - template = strtok(pathcopy, ","); - - /* First, search for a config file. */ - while (template && !configFile) { - if ((configPath = DoSubstitution(template, cmdline, projroot, - &cmdlineUsed, NULL, - XCONFIGFILE))) { - if ((configFile = fopen(configPath, "r")) != 0) { - if (cmdline && !cmdlineUsed) { - fclose(configFile); - configFile = NULL; - } - } - } - if (configPath && !configFile) { - free(configPath); - configPath = NULL; - } - template = strtok(NULL, ","); - } - - /* Then search for fallback */ - if (!configFile) { - strcpy(pathcopy, path); - template = strtok(pathcopy, ","); - - while (template && !configFile) { - if ((configPath = DoSubstitution(template, cmdline, projroot, - &cmdlineUsed, NULL, - XFREE86CFGFILE))) { - if ((configFile = fopen(configPath, "r")) != 0) { - if (cmdline && !cmdlineUsed) { - fclose(configFile); - configFile = NULL; - } - } - } - if (configPath && !configFile) { - free(configPath); - configPath = NULL; - } - template = strtok(NULL, ","); - } - } - - free(pathcopy); - if (!configFile) { - - return NULL; - } + /* Search for a config file or a fallback */ + configPath = OpenConfigFile(path, cmdline, projroot, XCONFIGFILE); + if (!configPath) + configPath = OpenConfigFile(path, cmdline, projroot, + XFREE86CFGFILE); + return configPath; +} - configBuf = malloc (CONFIG_BUF_LEN); - configRBuf = malloc (CONFIG_BUF_LEN); - configBuf[0] = '\0'; /* sanity ... */ +/* + * xf86openConfigDirFiles -- + * + * This function take a config directory search path (optional), a + * command-line specified directory name (optional) and the ProjectRoot path + * (optional) and locates and opens a config directory based on that + * information. If a command-line name is specified, then this function + * fails if it is not found. + * + * The return value is a pointer to the actual name of the direcoty that was + * opened. When no directory is found, the return value is NULL. + * + * The escape sequences allowed in the search path are defined above. + * + */ +const char * +xf86openConfigDirFiles(const char *path, const char *cmdline, + const char *projroot) +{ + if (!path || !path[0]) + path = DEFAULT_CONF_PATH; + if (!projroot || !projroot[0]) + projroot = PROJECTROOT; - return configPath; + /* Search for the multiconf directory */ + configDirPath = OpenConfigDir(path, cmdline, projroot, XCONFIGDIR); + return configDirPath; } void xf86closeConfigFile (void) { + int i; + free (configPath); configPath = NULL; + free (configDirPath); + configDirPath = NULL; free (configRBuf); configRBuf = NULL; free (configBuf); configBuf = NULL; - if (configFile) { - fclose (configFile); - configFile = NULL; - } else { + if (numFiles == 0) { builtinConfig = NULL; builtinIndex = 0; } + for (i = 0; i < numFiles; i++) { + fclose(configFiles[i].file); + configFiles[i].file = NULL; + free(configFiles[i].path); + configFiles[i].path = NULL; + } + numFiles = 0; } void xf86setBuiltinConfig(const char *config[]) { builtinConfig = config; - configPath = strdup(""); - configBuf = malloc (CONFIG_BUF_LEN); - configRBuf = malloc (CONFIG_BUF_LEN); - configBuf[0] = '\0'; /* sanity ... */ - } void xf86parseError (char *format,...) { va_list ap; + char *filename = numFiles ? configFiles[curFileIndex].path : + ""; ErrorF ("Parse error on line %d of section %s in file %s\n\t", - configLineNo, configSection, configPath); + configLineNo, configSection, filename); va_start (ap, format); VErrorF (format, ap); va_end (ap); @@ -902,8 +1058,10 @@ void xf86validationError (char *format,...) { va_list ap; + char *filename = numFiles ? configFiles[curFileIndex].path : + ""; - ErrorF ("Data incomplete in file %s\n\t", configPath); + ErrorF ("Data incomplete in file %s\n\t", filename); va_start (ap, format); VErrorF (format, ap); va_end (ap); @@ -1028,3 +1186,33 @@ xf86addComment(char *cur, char *add) return (cur); } + +Bool +xf86getBoolValue(Bool *val, const char *str) +{ + if (!val || !str) + return FALSE; + if (*str == '\0') { + *val = TRUE; + } else { + if (strcmp(str, "1") == 0) + *val = TRUE; + else if (strcmp(str, "on") == 0) + *val = TRUE; + else if (strcmp(str, "true") == 0) + *val = TRUE; + else if (strcmp(str, "yes") == 0) + *val = TRUE; + else if (strcmp(str, "0") == 0) + *val = FALSE; + else if (strcmp(str, "off") == 0) + *val = FALSE; + else if (strcmp(str, "false") == 0) + *val = FALSE; + else if (strcmp(str, "no") == 0) + *val = FALSE; + else + return FALSE; + } + return TRUE; +} diff --git a/xorg-server/hw/xfree86/parser/write.c b/xorg-server/hw/xfree86/parser/write.c index 3b77b9314..083203c05 100644 --- a/xorg-server/hw/xfree86/parser/write.c +++ b/xorg-server/hw/xfree86/parser/write.c @@ -117,6 +117,8 @@ doWriteConfigFile (const char *filename, XF86ConfigPtr cptr) xf86printInputSection (cf, cptr->conf_input_lst); + xf86printInputClassSection (cf, cptr->conf_inputclass_lst); + xf86printVideoAdaptorSection (cf, cptr->conf_videoadaptor_lst); xf86printModesSection (cf, cptr->conf_modes_lst); diff --git a/xorg-server/hw/xfree86/parser/xf86Parser.h b/xorg-server/hw/xfree86/parser/xf86Parser.h index 603080066..5e8351fc4 100644 --- a/xorg-server/hw/xfree86/parser/xf86Parser.h +++ b/xorg-server/hw/xfree86/parser/xf86Parser.h @@ -64,6 +64,7 @@ #ifndef _xf86Parser_h_ #define _xf86Parser_h_ +#include #include "xf86Optrec.h" #define HAVE_PARSER_DECLS @@ -330,6 +331,32 @@ typedef struct } XF86ConfInputrefRec, *XF86ConfInputrefPtr; +typedef struct +{ + Bool set; + Bool val; +} +xf86TriState; + +typedef struct +{ + GenericListRec list; + char *identifier; + char *driver; + char *match_product; + char *match_vendor; + char *match_device; + xf86TriState is_keyboard; + xf86TriState is_pointer; + xf86TriState is_joystick; + xf86TriState is_tablet; + xf86TriState is_touchpad; + xf86TriState is_touchscreen; + XF86OptionPtr option_lst; + char *comment; +} +XF86ConfInputClassRec, *XF86ConfInputClassPtr; + /* Values for adj_where */ #define CONF_ADJ_OBSOLETE -1 #define CONF_ADJ_ABSOLUTE 0 @@ -438,6 +465,7 @@ typedef struct XF86ConfDevicePtr conf_device_lst; XF86ConfScreenPtr conf_screen_lst; XF86ConfInputPtr conf_input_lst; + XF86ConfInputClassPtr conf_inputclass_lst; XF86ConfLayoutPtr conf_layout_lst; XF86ConfVendorPtr conf_vendor_lst; XF86ConfDRIPtr conf_dri; @@ -456,13 +484,16 @@ xf86ConfigSymTabRec, *xf86ConfigSymTabPtr; /* * prototypes for public functions */ -extern _X_EXPORT const char *xf86openConfigFile (const char *, const char *, - const char *); -extern _X_EXPORT void xf86setBuiltinConfig(const char *config[]); -extern _X_EXPORT XF86ConfigPtr xf86readConfigFile (void); -extern _X_EXPORT void xf86closeConfigFile (void); -extern _X_EXPORT void xf86freeConfig (XF86ConfigPtr p); -extern _X_EXPORT int xf86writeConfigFile (const char *, XF86ConfigPtr); +extern void xf86initConfigFiles(void); +extern const char *xf86openConfigFile(const char *path, const char *cmdline, + const char *projroot); +extern const char *xf86openConfigDirFiles(const char *path, const char *cmdline, + const char *projroot); +extern void xf86setBuiltinConfig(const char *config[]); +extern XF86ConfigPtr xf86readConfigFile(void); +extern void xf86closeConfigFile(void); +extern void xf86freeConfig(XF86ConfigPtr p); +extern int xf86writeConfigFile(const char *, XF86ConfigPtr); extern _X_EXPORT XF86ConfDevicePtr xf86findDevice(const char *ident, XF86ConfDevicePtr p); extern _X_EXPORT XF86ConfLayoutPtr xf86findLayout(const char *name, XF86ConfLayoutPtr list); extern _X_EXPORT XF86ConfMonitorPtr xf86findMonitor(const char *ident, XF86ConfMonitorPtr p); @@ -473,6 +504,7 @@ extern _X_EXPORT XF86ConfInputPtr xf86findInput(const char *ident, XF86ConfInput extern _X_EXPORT XF86ConfInputPtr xf86findInputByDriver(const char *driver, XF86ConfInputPtr p); extern _X_EXPORT XF86ConfVideoAdaptorPtr xf86findVideoAdaptor(const char *ident, XF86ConfVideoAdaptorPtr p); +extern int xf86layoutAddInputDevices(XF86ConfigPtr config, XF86ConfLayoutPtr layout); extern _X_EXPORT GenericListPtr xf86addListItem(GenericListPtr head, GenericListPtr c_new); extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr list_2); @@ -480,5 +512,6 @@ extern _X_EXPORT int xf86itemNotSublist(GenericListPtr list_1, GenericListPtr li extern _X_EXPORT int xf86pathIsAbsolute(const char *path); extern _X_EXPORT int xf86pathIsSafe(const char *path); extern _X_EXPORT char *xf86addComment(char *cur, char *add); +extern _X_EXPORT Bool xf86getBoolValue(Bool *val, const char *str); #endif /* _xf86Parser_h_ */ diff --git a/xorg-server/hw/xfree86/parser/xf86tokens.h b/xorg-server/hw/xfree86/parser/xf86tokens.h index 4c1d38c03..e3a9d716b 100644 --- a/xorg-server/hw/xfree86/parser/xf86tokens.h +++ b/xorg-server/hw/xfree86/parser/xf86tokens.h @@ -273,7 +273,18 @@ typedef enum { /* DRI Tokens */ GROUP, - BUFFERS + BUFFERS, + + /* InputClass Tokens */ + MATCH_PRODUCT, + MATCH_VENDOR, + MATCH_DEVICE_PATH, + MATCH_IS_KEYBOARD, + MATCH_IS_POINTER, + MATCH_IS_JOYSTICK, + MATCH_IS_TABLET, + MATCH_IS_TOUCHPAD, + MATCH_IS_TOUCHSCREEN } ParserTokens; #endif /* _xf86_tokens_h */ diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.c b/xorg-server/hw/xquartz/GL/glcontextmodes.c new file mode 100644 index 000000000..326c8b235 --- /dev/null +++ b/xorg-server/hw/xquartz/GL/glcontextmodes.c @@ -0,0 +1,550 @@ +/* + * (C) Copyright IBM Corporation 2003 + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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. + */ + +/** + * \file glcontextmodes.c + * Utility routines for working with \c __GLcontextModes structures. At + * some point most or all of these functions will be moved to the Mesa + * code base. + * + * \author Ian Romanick + */ + +#if defined(IN_MINI_GLX) +#include +#else +#if defined(HAVE_DIX_CONFIG_H) +# include +#endif +#include +#include +#include "GL/glxint.h" +#endif + +/* Memory macros */ +#if defined(IN_MINI_GLX) +# include +# include +# define _mesa_malloc(b) malloc(b) +# define _mesa_free(m) free(m) +# define _mesa_memset memset +#else +# ifdef XFree86Server +# include +# include +# define _mesa_malloc(b) xalloc(b) +# define _mesa_free(m) xfree(m) +# define _mesa_memset memset +# else +# include +# define _mesa_memset memset +# define _mesa_malloc(b) Xmalloc(b) +# define _mesa_free(m) Xfree(m) +# endif /* XFree86Server */ +#endif /* !defined(IN_MINI_GLX) */ + +#include "glcontextmodes.h" + +#if !defined(IN_MINI_GLX) +#define NUM_VISUAL_TYPES 6 + +/** + * Convert an X visual type to a GLX visual type. + * + * \param visualType X visual type (i.e., \c TrueColor, \c StaticGray, etc.) + * to be converted. + * \return If \c visualType is a valid X visual type, a GLX visual type will + * be returned. Otherwise \c GLX_NONE will be returned. + */ +GLint +_gl_convert_from_x_visual_type( int visualType ) +{ + static const int glx_visual_types[ NUM_VISUAL_TYPES ] = { + GLX_STATIC_GRAY, GLX_GRAY_SCALE, + GLX_STATIC_COLOR, GLX_PSEUDO_COLOR, + GLX_TRUE_COLOR, GLX_DIRECT_COLOR + }; + + return ( (unsigned) visualType < NUM_VISUAL_TYPES ) + ? glx_visual_types[ visualType ] : GLX_NONE; +} + + +/** + * Convert a GLX visual type to an X visual type. + * + * \param visualType GLX visual type (i.e., \c GLX_TRUE_COLOR, + * \c GLX_STATIC_GRAY, etc.) to be converted. + * \return If \c visualType is a valid GLX visual type, an X visual type will + * be returned. Otherwise -1 will be returned. + */ +GLint +_gl_convert_to_x_visual_type( int visualType ) +{ + static const int x_visual_types[ NUM_VISUAL_TYPES ] = { + TrueColor, DirectColor, + PseudoColor, StaticColor, + GrayScale, StaticGray + }; + + return ( (unsigned) (visualType - GLX_TRUE_COLOR) < NUM_VISUAL_TYPES ) + ? x_visual_types[ visualType - GLX_TRUE_COLOR ] : -1; +} + + +/** + * Copy a GLX visual config structure to a GL context mode structure. All + * of the fields in \c config are copied to \c mode. Additional fields in + * \c mode that can be derrived from the fields of \c config (i.e., + * \c haveDepthBuffer) are also filled in. The remaining fields in \c mode + * that cannot be derived are set to default values. + * + * \param mode Destination GL context mode. + * \param config Source GLX visual config. + * + * \note + * The \c fbconfigID and \c visualID fields of the \c __GLcontextModes + * structure will be set to the \c vid of the \c __GLXvisualConfig structure. + */ +void +_gl_copy_visual_to_context_mode( __GLcontextModes * mode, + const __GLXvisualConfig * config ) +{ + __GLcontextModes * const next = mode->next; + + (void) _mesa_memset( mode, 0, sizeof( __GLcontextModes ) ); + mode->next = next; + + mode->visualID = config->vid; + mode->visualType = _gl_convert_from_x_visual_type( config->class ); + mode->xRenderable = GL_TRUE; + mode->fbconfigID = config->vid; + mode->drawableType = GLX_WINDOW_BIT | GLX_PIXMAP_BIT; + + mode->rgbMode = (config->rgba != 0); + mode->renderType = (mode->rgbMode) ? GLX_RGBA_BIT : GLX_COLOR_INDEX_BIT; + + mode->colorIndexMode = !(mode->rgbMode); + mode->doubleBufferMode = (config->doubleBuffer != 0); + mode->stereoMode = (config->stereo != 0); + + mode->haveAccumBuffer = ((config->accumRedSize + + config->accumGreenSize + + config->accumBlueSize + + config->accumAlphaSize) > 0); + mode->haveDepthBuffer = (config->depthSize > 0); + mode->haveStencilBuffer = (config->stencilSize > 0); + + mode->redBits = config->redSize; + mode->greenBits = config->greenSize; + mode->blueBits = config->blueSize; + mode->alphaBits = config->alphaSize; + mode->redMask = config->redMask; + mode->greenMask = config->greenMask; + mode->blueMask = config->blueMask; + mode->alphaMask = config->alphaMask; + mode->rgbBits = mode->rgbMode ? config->bufferSize : 0; + mode->indexBits = mode->colorIndexMode ? config->bufferSize : 0; + + mode->accumRedBits = config->accumRedSize; + mode->accumGreenBits = config->accumGreenSize; + mode->accumBlueBits = config->accumBlueSize; + mode->accumAlphaBits = config->accumAlphaSize; + mode->depthBits = config->depthSize; + mode->stencilBits = config->stencilSize; + + mode->numAuxBuffers = config->auxBuffers; + mode->level = config->level; + + mode->visualRating = config->visualRating; + mode->transparentPixel = config->transparentPixel; + mode->transparentRed = config->transparentRed; + mode->transparentGreen = config->transparentGreen; + mode->transparentBlue = config->transparentBlue; + mode->transparentAlpha = config->transparentAlpha; + mode->transparentIndex = config->transparentIndex; + mode->samples = config->multiSampleSize; + mode->sampleBuffers = config->nMultiSampleBuffers; + /* mode->visualSelectGroup = config->visualSelectGroup; ? */ + + mode->swapMethod = GLX_SWAP_UNDEFINED_OML; + + mode->bindToTextureRgb = (mode->rgbMode) ? GL_TRUE : GL_FALSE; + mode->bindToTextureRgba = (mode->rgbMode && mode->alphaBits) ? + GL_TRUE : GL_FALSE; + mode->bindToMipmapTexture = mode->rgbMode ? GL_TRUE : GL_FALSE; + mode->bindToTextureTargets = mode->rgbMode ? + GLX_TEXTURE_1D_BIT_EXT | GLX_TEXTURE_2D_BIT_EXT | + GLX_TEXTURE_RECTANGLE_BIT_EXT : 0; + mode->yInverted = GL_FALSE; +} + + +/** + * Get data from a GL context mode. + * + * \param mode GL context mode whose data is to be returned. + * \param attribute Attribute of \c mode that is to be returned. + * \param value_return Location to store the data member of \c mode. + * \return If \c attribute is a valid attribute of \c mode, zero is + * returned. Otherwise \c GLX_BAD_ATTRIBUTE is returned. + */ +int +_gl_get_context_mode_data(const __GLcontextModes *mode, int attribute, + int *value_return) +{ + switch (attribute) { + case GLX_USE_GL: + *value_return = GL_TRUE; + return 0; + case GLX_BUFFER_SIZE: + *value_return = mode->rgbBits; + return 0; + case GLX_RGBA: + *value_return = mode->rgbMode; + return 0; + case GLX_RED_SIZE: + *value_return = mode->redBits; + return 0; + case GLX_GREEN_SIZE: + *value_return = mode->greenBits; + return 0; + case GLX_BLUE_SIZE: + *value_return = mode->blueBits; + return 0; + case GLX_ALPHA_SIZE: + *value_return = mode->alphaBits; + return 0; + case GLX_DOUBLEBUFFER: + *value_return = mode->doubleBufferMode; + return 0; + case GLX_STEREO: + *value_return = mode->stereoMode; + return 0; + case GLX_AUX_BUFFERS: + *value_return = mode->numAuxBuffers; + return 0; + case GLX_DEPTH_SIZE: + *value_return = mode->depthBits; + return 0; + case GLX_STENCIL_SIZE: + *value_return = mode->stencilBits; + return 0; + case GLX_ACCUM_RED_SIZE: + *value_return = mode->accumRedBits; + return 0; + case GLX_ACCUM_GREEN_SIZE: + *value_return = mode->accumGreenBits; + return 0; + case GLX_ACCUM_BLUE_SIZE: + *value_return = mode->accumBlueBits; + return 0; + case GLX_ACCUM_ALPHA_SIZE: + *value_return = mode->accumAlphaBits; + return 0; + case GLX_LEVEL: + *value_return = mode->level; + return 0; + case GLX_TRANSPARENT_TYPE_EXT: + *value_return = mode->transparentPixel; + return 0; + case GLX_TRANSPARENT_RED_VALUE: + *value_return = mode->transparentRed; + return 0; + case GLX_TRANSPARENT_GREEN_VALUE: + *value_return = mode->transparentGreen; + return 0; + case GLX_TRANSPARENT_BLUE_VALUE: + *value_return = mode->transparentBlue; + return 0; + case GLX_TRANSPARENT_ALPHA_VALUE: + *value_return = mode->transparentAlpha; + return 0; + case GLX_TRANSPARENT_INDEX_VALUE: + *value_return = mode->transparentIndex; + return 0; + case GLX_X_VISUAL_TYPE: + *value_return = mode->visualType; + return 0; + case GLX_CONFIG_CAVEAT: + *value_return = mode->visualRating; + return 0; + case GLX_VISUAL_ID: + *value_return = mode->visualID; + return 0; + case GLX_DRAWABLE_TYPE: + *value_return = mode->drawableType; + return 0; + case GLX_RENDER_TYPE: + *value_return = mode->renderType; + return 0; + case GLX_X_RENDERABLE: + *value_return = mode->xRenderable; + return 0; + case GLX_FBCONFIG_ID: + *value_return = mode->fbconfigID; + return 0; + case GLX_MAX_PBUFFER_WIDTH: + *value_return = mode->maxPbufferWidth; + return 0; + case GLX_MAX_PBUFFER_HEIGHT: + *value_return = mode->maxPbufferHeight; + return 0; + case GLX_MAX_PBUFFER_PIXELS: + *value_return = mode->maxPbufferPixels; + return 0; + case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX: + *value_return = mode->optimalPbufferWidth; + return 0; + case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX: + *value_return = mode->optimalPbufferHeight; + return 0; + case GLX_SWAP_METHOD_OML: + *value_return = mode->swapMethod; + return 0; + case GLX_SAMPLE_BUFFERS_SGIS: + *value_return = mode->sampleBuffers; + return 0; + case GLX_SAMPLES_SGIS: + *value_return = mode->samples; + return 0; + case GLX_BIND_TO_TEXTURE_RGB_EXT: + *value_return = mode->bindToTextureRgb; + return 0; + case GLX_BIND_TO_TEXTURE_RGBA_EXT: + *value_return = mode->bindToTextureRgba; + return 0; + case GLX_BIND_TO_MIPMAP_TEXTURE_EXT: + *value_return = mode->bindToMipmapTexture == GL_TRUE ? GL_TRUE : + GL_FALSE; + return 0; + case GLX_BIND_TO_TEXTURE_TARGETS_EXT: + *value_return = mode->bindToTextureTargets; + return 0; + case GLX_Y_INVERTED_EXT: + *value_return = mode->yInverted; + return 0; + + /* Applications are NOT allowed to query GLX_VISUAL_SELECT_GROUP_SGIX. + * It is ONLY for communication between the GLX client and the GLX + * server. + */ + case GLX_VISUAL_SELECT_GROUP_SGIX: + default: + return GLX_BAD_ATTRIBUTE; + } +} +#endif /* !defined(IN_MINI_GLX) */ + + +/** + * Allocate a linked list of \c __GLcontextModes structures. The fields of + * each structure will be initialized to "reasonable" default values. In + * most cases this is the default value defined by table 3.4 of the GLX + * 1.3 specification. This means that most values are either initialized to + * zero or \c GLX_DONT_CARE (which is -1). As support for additional + * extensions is added, the new values will be initialized to appropriate + * values from the extension specification. + * + * \param count Number of structures to allocate. + * \param minimum_size Minimum size of a structure to allocate. This allows + * for differences in the version of the + * \c __GLcontextModes stucture used in libGL and in a + * DRI-based driver. + * \returns A pointer to the first element in a linked list of \c count + * stuctures on success, or \c NULL on failure. + * + * \warning Use of \c minimum_size does \b not guarantee binary compatibility. + * The fundamental assumption is that if the \c minimum_size + * specified by the driver and the size of the \c __GLcontextModes + * structure in libGL is the same, then the meaning of each byte in + * the structure is the same in both places. \b Be \b careful! + * Basically this means that fields have to be added in libGL and + * then propagated to drivers. Drivers should \b never arbitrarilly + * extend the \c __GLcontextModes data-structure. + */ +__GLcontextModes * +_gl_context_modes_create( unsigned count, size_t minimum_size ) +{ + const size_t size = (minimum_size > sizeof( __GLcontextModes )) + ? minimum_size : sizeof( __GLcontextModes ); + __GLcontextModes * base = NULL; + __GLcontextModes ** next; + unsigned i; + + next = & base; + for ( i = 0 ; i < count ; i++ ) { + *next = (__GLcontextModes *) _mesa_malloc( size ); + if ( *next == NULL ) { + _gl_context_modes_destroy( base ); + base = NULL; + break; + } + + (void) _mesa_memset( *next, 0, size ); + (*next)->visualID = GLX_DONT_CARE; + (*next)->visualType = GLX_DONT_CARE; + (*next)->visualRating = GLX_NONE; + (*next)->transparentPixel = GLX_NONE; + (*next)->transparentRed = GLX_DONT_CARE; + (*next)->transparentGreen = GLX_DONT_CARE; + (*next)->transparentBlue = GLX_DONT_CARE; + (*next)->transparentAlpha = GLX_DONT_CARE; + (*next)->transparentIndex = GLX_DONT_CARE; + (*next)->xRenderable = GLX_DONT_CARE; + (*next)->fbconfigID = GLX_DONT_CARE; + (*next)->swapMethod = GLX_SWAP_UNDEFINED_OML; + (*next)->bindToTextureRgb = GLX_DONT_CARE; + (*next)->bindToTextureRgba = GLX_DONT_CARE; + (*next)->bindToMipmapTexture = GLX_DONT_CARE; + (*next)->bindToTextureTargets = GLX_DONT_CARE; + (*next)->yInverted = GLX_DONT_CARE; + + next = & ((*next)->next); + } + + return base; +} + + +/** + * Destroy a linked list of \c __GLcontextModes structures created by + * \c _gl_context_modes_create. + * + * \param modes Linked list of structures to be destroyed. All structres + * in the list will be freed. + */ +void +_gl_context_modes_destroy( __GLcontextModes * modes ) +{ + while ( modes != NULL ) { + __GLcontextModes * const next = modes->next; + + _mesa_free( modes ); + modes = next; + } +} + + +/** + * Find a context mode matching a Visual ID. + * + * \param modes List list of context-mode structures to be searched. + * \param vid Visual ID to be found. + * \returns A pointer to a context-mode in \c modes if \c vid was found in + * the list, or \c NULL if it was not. + */ + +__GLcontextModes * +_gl_context_modes_find_visual(__GLcontextModes *modes, int vid) +{ + __GLcontextModes *m; + + for (m = modes; m != NULL; m = m->next) + if (m->visualID == vid) + return m; + + return NULL; +} + +__GLcontextModes * +_gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid) +{ + __GLcontextModes *m; + + for (m = modes; m != NULL; m = m->next) + if (m->fbconfigID == fbid) + return m; + + return NULL; +} + +/** + * Determine if two context-modes are the same. This is intended to be used + * by libGL implementations to compare to sets of driver generated FBconfigs. + * + * \param a Context-mode to be compared. + * \param b Context-mode to be compared. + * \returns \c GL_TRUE if the two context-modes are the same. \c GL_FALSE is + * returned otherwise. + */ +GLboolean +_gl_context_modes_are_same( const __GLcontextModes * a, + const __GLcontextModes * b ) +{ + return( (a->rgbMode == b->rgbMode) && + (a->floatMode == b->floatMode) && + (a->colorIndexMode == b->colorIndexMode) && + (a->doubleBufferMode == b->doubleBufferMode) && + (a->stereoMode == b->stereoMode) && + (a->redBits == b->redBits) && + (a->greenBits == b->greenBits) && + (a->blueBits == b->blueBits) && + (a->alphaBits == b->alphaBits) && +#if 0 /* For some reason these don't get set on the client-side in libGL. */ + (a->redMask == b->redMask) && + (a->greenMask == b->greenMask) && + (a->blueMask == b->blueMask) && + (a->alphaMask == b->alphaMask) && +#endif + (a->rgbBits == b->rgbBits) && + (a->indexBits == b->indexBits) && + (a->accumRedBits == b->accumRedBits) && + (a->accumGreenBits == b->accumGreenBits) && + (a->accumBlueBits == b->accumBlueBits) && + (a->accumAlphaBits == b->accumAlphaBits) && + (a->depthBits == b->depthBits) && + (a->stencilBits == b->stencilBits) && + (a->numAuxBuffers == b->numAuxBuffers) && + (a->level == b->level) && + (a->pixmapMode == b->pixmapMode) && + (a->visualRating == b->visualRating) && + + (a->transparentPixel == b->transparentPixel) && + + ((a->transparentPixel != GLX_TRANSPARENT_RGB) || + ((a->transparentRed == b->transparentRed) && + (a->transparentGreen == b->transparentGreen) && + (a->transparentBlue == b->transparentBlue) && + (a->transparentAlpha == b->transparentAlpha))) && + + ((a->transparentPixel != GLX_TRANSPARENT_INDEX) || + (a->transparentIndex == b->transparentIndex)) && + + (a->sampleBuffers == b->sampleBuffers) && + (a->samples == b->samples) && + ((a->drawableType & b->drawableType) != 0) && + (a->renderType == b->renderType) && + (a->maxPbufferWidth == b->maxPbufferWidth) && + (a->maxPbufferHeight == b->maxPbufferHeight) && + (a->maxPbufferPixels == b->maxPbufferPixels) && + (a->optimalPbufferWidth == b->optimalPbufferWidth) && + (a->optimalPbufferHeight == b->optimalPbufferHeight) && + (a->swapMethod == b->swapMethod) && + (a->bindToTextureRgb == b->bindToTextureRgb) && + (a->bindToTextureRgba == b->bindToTextureRgba) && + (a->bindToMipmapTexture == b->bindToMipmapTexture) && + (a->bindToTextureTargets == b->bindToTextureTargets) && + (a->yInverted == b->yInverted) ); +} diff --git a/xorg-server/hw/xquartz/GL/glcontextmodes.h b/xorg-server/hw/xquartz/GL/glcontextmodes.h new file mode 100644 index 000000000..afd09cd7f --- /dev/null +++ b/xorg-server/hw/xquartz/GL/glcontextmodes.h @@ -0,0 +1,54 @@ +/* + * (C) Copyright IBM Corporation 2003 + * 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 + * on the rights to use, copy, modify, merge, publish, distribute, sub + * license, and/or sell copies of the Software, and to permit persons to whom + * 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 NON-INFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEM, IBM AND/OR THEIR SUPPLIERS 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. + */ + +/** + * \file glcontextmodes.h + * \author Ian Romanick + */ + +#ifndef GLCONTEXTMODES_H +#define GLCONTEXTMODES_H + +#include "GL/internal/glcore.h" + +#if !defined(IN_MINI_GLX) +extern GLint _gl_convert_from_x_visual_type( int visualType ); +extern GLint _gl_convert_to_x_visual_type( int visualType ); +extern void _gl_copy_visual_to_context_mode( __GLcontextModes * mode, + const __GLXvisualConfig * config ); +extern int _gl_get_context_mode_data( const __GLcontextModes *mode, + int attribute, int *value_return ); +#endif /* !defined(IN_MINI_GLX) */ + +extern __GLcontextModes * _gl_context_modes_create( unsigned count, + size_t minimum_size ); +extern void _gl_context_modes_destroy( __GLcontextModes * modes ); +extern __GLcontextModes * + _gl_context_modes_find_visual(__GLcontextModes *modes, int vid); +extern __GLcontextModes * + _gl_context_modes_find_fbconfig(__GLcontextModes *modes, int fbid); +extern GLboolean _gl_context_modes_are_same( const __GLcontextModes * a, + const __GLcontextModes * b ); + +#endif /* GLCONTEXTMODES_H */ diff --git a/xorg-server/hw/xquartz/darwinXinput.c b/xorg-server/hw/xquartz/darwinXinput.c index 8af9fc740..43aea6140 100644 --- a/xorg-server/hw/xquartz/darwinXinput.c +++ b/xorg-server/hw/xquartz/darwinXinput.c @@ -230,7 +230,8 @@ ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, * */ int -NewInputDeviceRequest(InputOption *options, DeviceIntPtr *pdev) +NewInputDeviceRequest(InputOption *options, InputAttributes *attrs, + DeviceIntPtr *pdev) { DEBUG_LOG("NewInputDeviceRequest(%p, %p)\n", options, pdev); return BadValue; diff --git a/xorg-server/hw/xwin/InitOutput.c b/xorg-server/hw/xwin/InitOutput.c index 8fd82d087..91f5ec09b 100644 --- a/xorg-server/hw/xwin/InitOutput.c +++ b/xorg-server/hw/xwin/InitOutput.c @@ -853,6 +853,9 @@ winUseMsg (void) ErrorF ("-config\n" "\tSpecify a configuration file.\n"); + ErrorF ("-configdir\n" + "\tSpecify a configuration directory.\n"); + ErrorF ("-keyboard\n" "\tSpecify a keyboard device from the configuration file.\n"); #endif diff --git a/xorg-server/hw/xwin/winconfig.c b/xorg-server/hw/xwin/winconfig.c index 3e1908c90..f1e805c4c 100644 --- a/xorg-server/hw/xwin/winconfig.c +++ b/xorg-server/hw/xwin/winconfig.c @@ -50,6 +50,13 @@ "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ "%P/lib/X11/%X" #endif +#ifndef CONFIGDIRPATH +#define CONFIGDIRPATH "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ + "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ + "%P/etc/X11/%X," \ + "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ + "%P/lib/X11/%X" +#endif XF86ConfigPtr g_xf86configptr = NULL; #endif @@ -57,6 +64,7 @@ XF86ConfigPtr g_xf86configptr = NULL; WinCmdlineRec g_cmdline = { #ifdef XWIN_XF86CONFIG NULL, /* configFile */ + NULL, /* configDir */ #endif NULL, /* fontPath */ #ifdef XWIN_XF86CONFIG @@ -109,20 +117,28 @@ Bool winReadConfigfile () { Bool retval = TRUE; - const char *filename; - MessageType from = X_DEFAULT; + const char *filename, *dirname; + MessageType filefrom = X_DEFAULT; + MessageType dirfrom = X_DEFAULT; char *xf86ConfigFile = NULL; + char *xf86ConfigDir = NULL; if (g_cmdline.configFile) { - from = X_CMDLINE; + filefrom = X_CMDLINE; xf86ConfigFile = g_cmdline.configFile; } + if (g_cmdline.configDir) + { + dirfrom = X_CMDLINE; + xf86ConfigDir = g_cmdline.configDir; + } /* Parse config file into data structure */ - + xf86initConfigFiles(); filename = xf86openConfigFile (CONFIGPATH, xf86ConfigFile, PROJECTROOT); - + dirname = xf86openConfigDirFiles (CONFIGDIRPATH, xf86ConfigDir, PROJECTROOT); + /* Hack for backward compatibility */ if (!filename && from == X_DEFAULT) filename = xf86openConfigFile (CONFIGPATH, "XF86Config", PROJECTROOT); @@ -137,6 +153,20 @@ winReadConfigfile () if (xf86ConfigFile) ErrorF (": \"%s\"", xf86ConfigFile); ErrorF ("\n"); + } + if (dirname) + { + winMsg (from, "Using config directory: \"%s\"\n", dirname); + } + else + { + winMsg (X_ERROR, "Unable to locate/open config directory"); + if (xf86ConfigDir) + ErrorF (": \"%s\"", xf86ConfigDir); + ErrorF ("\n"); + } + if (!filename && !dirname) + { return FALSE; } if ((g_xf86configptr = xf86readConfigFile ()) == NULL) diff --git a/xorg-server/hw/xwin/winconfig.h b/xorg-server/hw/xwin/winconfig.h index 63d621112..058884abc 100644 --- a/xorg-server/hw/xwin/winconfig.h +++ b/xorg-server/hw/xwin/winconfig.h @@ -188,6 +188,7 @@ typedef struct /* Files */ #ifdef XWIN_XF86CONFIG char *configFile; + char *configDir; #endif char *fontPath; /* input devices - keyboard */ diff --git a/xorg-server/hw/xwin/winprocarg.c b/xorg-server/hw/xwin/winprocarg.c index 31e505e8d..fd7719c3a 100644 --- a/xorg-server/hw/xwin/winprocarg.c +++ b/xorg-server/hw/xwin/winprocarg.c @@ -1340,6 +1340,24 @@ ddxProcessArgument (int argc, char *argv[], int i) return 2; } + /* + * Look for the '-configdir' argument + */ + if (IS_OPTION ("-configdir")) + { + CHECK_ARGS (1); +#ifdef XWIN_XF86CONFIG + g_cmdline.configDir = argv[++i]; +#else + winMessageBoxF ("The %s option is not supported in this " + "release.\n" + "Ignoring this option and continuing.\n", + MB_ICONINFORMATION, + argv[i]); +#endif + return 2; + } + /* * Look for the '-keyboard' argument */ diff --git a/xorg-server/hw/xwin/xlaunch/Makefile b/xorg-server/hw/xwin/xlaunch/Makefile new file mode 100644 index 000000000..f7cf923df --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/Makefile @@ -0,0 +1,79 @@ +# +# Copyright (c) 2005 Alexander Gottwald +# +# 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 ABOVE LISTED COPYRIGHT HOLDER(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(s) of the above copyright +# holders shall not be used in advertising or otherwise to promote the sale, +# use or other dealings in this Software without prior written authorization. +# +WINDRES=windres + +TARGET=mingw +#DEBUG_FLAGS=-D_DEBUG + +OS_FLAGS_mingw=-mno-cygwin +OS_FLAGS=$(OS_FLAGS_$(TARGET)) $(DEBUG_FLAGS) + +X11_DIR_$(TARGET)=/usr/X11R6 +X11_DIR_mingw=../../../../../exports +X11_DIR=$(X11_DIR_$(TARGET)) +X11_INCLUDE=-I$(X11_DIR)/include +X11_LIBDIR=-L$(X11_DIR)/lib +X11_LIBS_$(TARGET)=-lX11 +X11_LIBS_mingw=-lX11 -lwsock32 +X11_LIBS=$(X11_LIBS_$(TARGET)) + +PROGRAMFILES:=$(shell cygpath -u $(PROGRAMFILES)) +#MSXML_DIR=$(PROGRAMFILES)/MSXML 4.0 +MSXML_DIR=$(PROGRAMFILES)/Microsoft XML Parser SDK +MSXML_INCLUDE="-I$(MSXML_DIR)/inc" +MSXML_LIBDIR="-L$(MSXML_DIR)/lib" +MSXML_LIBS= + + +CXXFLAGS=-g $(OS_FLAGS) $(X11_INCLUDE) $(MSXML_INCLUDE) +LDFLAGS=-mwindows $(X11_LIBDIR) $(MSXML_LIBDIR) +LIBS=-lcomctl32 -lole32 -loleaut32 $(X11_LIBS) $(MSXML_LIBS) +all:xlaunch.exe +%.res: %.rc + $(WINDRES) -O coff -o $@ $< + +WINDOW_PARTS=window util dialog wizard +WINDOW_OBJECTS=$(foreach file,$(WINDOW_PARTS),window/$(file).o) + +RESOURCES_IMAGES=resources/multiwindow.bmp resources/fullscreen.bmp \ + resources/windowed.bmp resources/nodecoration.bmp + +resources/resources.res: resources/resources.rc resources/resources.h \ + resources/images.rc resources/dialog.rc resources/strings.rc \ + $(RESOURCES_IMAGES) +xlaunch.exe: $(WINDOW_OBJECTS) main.o config.o resources/resources.res + $(CXX) $(CXXFLAGS) $(LDFLAGS) -o $@ $^ $(LIBS) + + +window/dialog.o: window/dialog.cc window/dialog.h window/window.h window/util.h +window/frame.o: window/frame.cc window/frame.h window/window.h +window/util.o: window/util.cc window/util.h +window/window.o: window/window.cc window/window.h window/util.h +window/wizard.o: window/wizard.cc window/wizard.h window/dialog.h \ + window/window.h window/util.h +main.o: main.cc window/util.h window/wizard.h window/dialog.h \ + window/window.h resources/resources.h config.h +config.o: config.cc config.h diff --git a/xorg-server/hw/xwin/xlaunch/config.h b/xorg-server/hw/xwin/xlaunch/config.h new file mode 100644 index 000000000..f0aed3cf1 --- /dev/null +++ b/xorg-server/hw/xwin/xlaunch/config.h @@ -0,0 +1,60 @@ +/* + * Copyright (c) 2005 Alexander Gottwald + * + * 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 ABOVE LISTED COPYRIGHT HOLDER(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(s) of the above copyright + * holders shall not be used in advertising or otherwise to promote the sale, + * use or other dealings in this Software without prior written authorization. + */ +#ifndef __CONFIG_H__ +#define __CONFIG_H__ + +#include +struct CConfig +{ + enum {MultiWindow, Fullscreen, Windowed, Nodecoration} window; + enum {NoClient, StartProgram, XDMCP} client; + bool local; + std::string display; + std::string protocol; + std::string program; + std::string host; + std::string user; + bool broadcast; + bool indirect; + std::string xdmcp_host; + bool clipboard; + std::string extra_params; +#ifdef _DEBUG + CConfig() : window(MultiWindow), client(StartProgram), local(false), display("1"), + protocol("Putty"), program("xterm"), host("lupus"), user("ago"), + broadcast(false), indirect(false), xdmcp_host("lupus"), + clipboard(true), extra_params() {}; +#else + CConfig() : window(MultiWindow), client(StartProgram), local(false), display("0"), + protocol("Putty"), program("xterm"), host(""), user(""), + broadcast(true), indirect(false), xdmcp_host(""), + clipboard(true), extra_params() {}; +#endif + void Load(const char* filename); + void Save(const char* filename); +}; + +#endif -- cgit v1.2.3