2004-06-30 22:06:56 +02:00
|
|
|
/*
|
|
|
|
* Copyright 2001-2004 Red Hat Inc., Durham, North Carolina.
|
|
|
|
*
|
|
|
|
* 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, sublicense, and/or sell copies of the Software,
|
|
|
|
* and to permit persons to whom the Software is furnished to do so,
|
|
|
|
* subject to the following conditions:
|
|
|
|
*
|
|
|
|
* The above copyright notice and this permission notice (including the
|
|
|
|
* next paragraph) shall be included in all copies or substantial
|
|
|
|
* portions of the Software.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
* NON-INFRINGEMENT. IN NO EVENT SHALL RED HAT 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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Authors:
|
|
|
|
* Kevin E. Martin <kem@redhat.com>
|
|
|
|
* David H. Dawes <dawes@xfree86.org>
|
|
|
|
* Rickard E. (Rik) Faith <faith@redhat.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/** \file
|
|
|
|
* Provide expected functions for initialization from the ddx layer and
|
|
|
|
* global variables for the DMX server. */
|
|
|
|
|
2005-07-12 02:52:48 +02:00
|
|
|
#ifdef HAVE_DMX_CONFIG_H
|
|
|
|
#include <dmx-config.h>
|
|
|
|
#endif
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
#include "dmx.h"
|
|
|
|
#include "dmxinit.h"
|
|
|
|
#include "dmxsync.h"
|
|
|
|
#include "dmxlog.h"
|
|
|
|
#include "dmxinput.h"
|
|
|
|
#include "dmxscrinit.h"
|
|
|
|
#include "dmxcursor.h"
|
|
|
|
#include "dmxfont.h"
|
|
|
|
#include "config/dmxconfig.h"
|
|
|
|
#include "dmxcb.h"
|
|
|
|
#include "dmxprop.h"
|
|
|
|
#include "dmxstat.h"
|
|
|
|
#include "dmxpict.h"
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
#include <X11/Xos.h> /* For gettimeofday */
|
|
|
|
#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */
|
2004-06-30 22:06:56 +02:00
|
|
|
#include "dixstruct.h"
|
2009-09-15 03:39:09 +02:00
|
|
|
#ifdef PANORAMIX
|
2004-06-30 22:06:56 +02:00
|
|
|
#include "panoramiXsrv.h"
|
2009-09-15 03:39:09 +02:00
|
|
|
#endif
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
#include <signal.h> /* For SIGQUIT */
|
|
|
|
|
|
|
|
#ifdef GLXEXT
|
|
|
|
#include <GL/glx.h>
|
|
|
|
#include <GL/glxint.h>
|
|
|
|
#include "dmx_glxvisuals.h"
|
2012-11-19 05:00:22 +01:00
|
|
|
#include "glx_extinit.h"
|
2005-04-20 14:25:48 +02:00
|
|
|
#include <X11/extensions/Xext.h>
|
|
|
|
#include <X11/extensions/extutil.h>
|
2012-03-21 20:55:09 +01:00
|
|
|
#endif /* GLXEXT */
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-11-19 05:00:22 +01:00
|
|
|
#include <X11/extensions/dmxproto.h>
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
/* Global variables available to all Xserver/hw/dmx routines. */
|
2012-03-21 20:55:09 +01:00
|
|
|
int dmxNumScreens;
|
|
|
|
DMXScreenInfo *dmxScreens;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int dmxNumInputs;
|
|
|
|
DMXInputInfo *dmxInputs;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
XErrorEvent dmxLastErrorEvent;
|
|
|
|
Bool dmxErrorOccurred = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
char *dmxFontPath = NULL;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxOffScreenOpt = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxSubdividePrimitives = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxLazyWindowCreation = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxUseXKB = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
int dmxDepth = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
#ifndef GLXEXT
|
2012-03-21 20:55:09 +01:00
|
|
|
static Bool dmxGLXProxy = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
#else
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxGLXProxy = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxGLXSwapGroupSupport = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxGLXSyncSwap = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxGLXFinishSwap = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
#endif
|
|
|
|
|
2013-04-10 04:59:39 +02:00
|
|
|
RESTYPE RRProviderType = 0;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxIgnoreBadFontPaths = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool dmxAddRemoveScreens = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
/* dmxErrorHandler catches errors that occur when calling one of the
|
|
|
|
* back-end servers. Some of this code is based on _XPrintDefaultError
|
|
|
|
* in xc/lib/X11/XlibInt.c */
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
dmxErrorHandler(Display * dpy, XErrorEvent * ev)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
#define DMX_ERROR_BUF_SIZE 256
|
2012-03-21 20:55:09 +01:00
|
|
|
/* RATS: these buffers are only used in
|
|
|
|
* length-limited calls. */
|
|
|
|
char buf[DMX_ERROR_BUF_SIZE];
|
|
|
|
char request[DMX_ERROR_BUF_SIZE];
|
2004-06-30 22:06:56 +02:00
|
|
|
_XExtension *ext = NULL;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxErrorOccurred = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLastErrorEvent = *ev;
|
|
|
|
|
|
|
|
XGetErrorText(dpy, ev->error_code, buf, sizeof(buf));
|
|
|
|
dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Find major opcode name */
|
2004-06-30 22:06:56 +02:00
|
|
|
if (ev->request_code < 128) {
|
2011-09-19 03:47:04 +02:00
|
|
|
snprintf(request, sizeof(request), "%d", ev->request_code);
|
2004-06-30 22:06:56 +02:00
|
|
|
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else {
|
2004-06-30 22:06:56 +02:00
|
|
|
for (ext = dpy->ext_procs;
|
|
|
|
ext && ext->codes.major_opcode != ev->request_code;
|
|
|
|
ext = ext->next);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (ext)
|
|
|
|
strlcpy(buf, ext->name, sizeof(buf));
|
|
|
|
else
|
|
|
|
buf[0] = '\0';
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
dmxLog(dmxWarning, " Major opcode: %d (%s)\n",
|
|
|
|
ev->request_code, buf);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Find minor opcode name */
|
2004-06-30 22:06:56 +02:00
|
|
|
if (ev->request_code >= 128 && ext) {
|
2011-09-19 03:47:04 +02:00
|
|
|
snprintf(request, sizeof(request), "%d", ev->request_code);
|
2012-03-21 20:55:09 +01:00
|
|
|
snprintf(request, sizeof(request), "%s.%d", ext->name, ev->minor_code);
|
2004-06-30 22:06:56 +02:00
|
|
|
XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf));
|
|
|
|
dmxLog(dmxWarning, " Minor opcode: %d (%s)\n",
|
|
|
|
ev->minor_code, buf);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Provide value information */
|
2004-06-30 22:06:56 +02:00
|
|
|
switch (ev->error_code) {
|
|
|
|
case BadValue:
|
|
|
|
dmxLog(dmxWarning, " Value: 0x%x\n",
|
dmx: fix printf format argument warnings
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-13 04:09:36 +01:00
|
|
|
(unsigned int) ev->resourceid);
|
2004-06-30 22:06:56 +02:00
|
|
|
break;
|
|
|
|
case BadAtom:
|
|
|
|
dmxLog(dmxWarning, " AtomID: 0x%x\n",
|
dmx: fix printf format argument warnings
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-13 04:09:36 +01:00
|
|
|
(unsigned int) ev->resourceid);
|
2004-06-30 22:06:56 +02:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
dmxLog(dmxWarning, " ResourceID: 0x%x\n",
|
dmx: fix printf format argument warnings
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-13 04:09:36 +01:00
|
|
|
(unsigned int) ev->resourceid);
|
2004-06-30 22:06:56 +02:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Provide serial number information */
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning, " Failed serial number: %d\n",
|
dmx: fix printf format argument warnings
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-13 04:09:36 +01:00
|
|
|
(unsigned int) ev->serial);
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning, " Current serial number: %d\n",
|
dmx: fix printf format argument warnings
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-13 04:09:36 +01:00
|
|
|
(unsigned int) dpy->request);
|
2004-06-30 22:06:56 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
#ifdef GLXEXT
|
2012-03-21 20:55:09 +01:00
|
|
|
static int
|
|
|
|
dmxNOPErrorHandler(Display * dpy, XErrorEvent * ev)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool
|
|
|
|
dmxOpenDisplay(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name)))
|
2012-03-21 20:55:09 +01:00
|
|
|
return FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
dmxPropertyDisplay(dmxScreen);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
dmxSetErrorHandler(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
XSetErrorHandler(dmxErrorHandler);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static void
|
|
|
|
dmxPrintScreenInfo(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
XWindowAttributes attribs;
|
2012-03-21 20:55:09 +01:00
|
|
|
int ndepths = 0, *depths = NULL;
|
|
|
|
int i;
|
|
|
|
Display *dpy = dmxScreen->beDisplay;
|
|
|
|
Screen *s = DefaultScreenOfDisplay(dpy);
|
|
|
|
int scr = DefaultScreen(dpy);
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!(depths = XListDepths(dpy, scr, &ndepths)))
|
|
|
|
ndepths = 0;
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLogOutput(dmxScreen, "Name of display: %s\n", DisplayString(dpy));
|
|
|
|
dmxLogOutput(dmxScreen, "Version number: %d.%d\n",
|
|
|
|
ProtocolVersion(dpy), ProtocolRevision(dpy));
|
|
|
|
dmxLogOutput(dmxScreen, "Vendor string: %s\n", ServerVendor(dpy));
|
|
|
|
if (!strstr(ServerVendor(dpy), "XFree86")) {
|
|
|
|
dmxLogOutput(dmxScreen, "Vendor release: %d\n", VendorRelease(dpy));
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
/* This code based on xdpyinfo.c */
|
|
|
|
int v = VendorRelease(dpy);
|
2004-06-30 22:06:56 +02:00
|
|
|
int major = -1, minor = -1, patch = -1, subpatch = -1;
|
|
|
|
|
|
|
|
if (v < 336)
|
|
|
|
major = v / 100, minor = (v / 10) % 10, patch = v % 10;
|
|
|
|
else if (v < 3900) {
|
|
|
|
major = v / 1000;
|
|
|
|
minor = (v / 100) % 10;
|
|
|
|
if (((v / 10) % 10) || (v % 10)) {
|
|
|
|
patch = (v / 10) % 10;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (v % 10)
|
|
|
|
subpatch = v % 10;
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (v < 40000000) {
|
2004-06-30 22:06:56 +02:00
|
|
|
major = v / 1000;
|
|
|
|
minor = (v / 10) % 10;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (v % 10)
|
|
|
|
patch = v % 10;
|
|
|
|
}
|
|
|
|
else {
|
2004-06-30 22:06:56 +02:00
|
|
|
major = v / 10000000;
|
|
|
|
minor = (v / 100000) % 100;
|
|
|
|
patch = (v / 1000) % 100;
|
2012-03-21 20:55:09 +01:00
|
|
|
if (v % 1000)
|
|
|
|
subpatch = v % 1000;
|
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d",
|
|
|
|
v, major, minor);
|
2012-03-21 20:55:09 +01:00
|
|
|
if (patch > 0)
|
|
|
|
dmxLogOutputCont(dmxScreen, ".%d", patch);
|
|
|
|
if (subpatch > 0)
|
|
|
|
dmxLogOutputCont(dmxScreen, ".%d", subpatch);
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLogOutputCont(dmxScreen, ")\n");
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n",
|
2004-06-30 22:06:56 +02:00
|
|
|
attribs.width, attribs.height);
|
|
|
|
dmxLogOutput(dmxScreen, "%d depths on screen %d: ", ndepths, scr);
|
|
|
|
for (i = 0; i < ndepths; i++)
|
|
|
|
dmxLogOutputCont(dmxScreen, "%c%d", i ? ',' : ' ', depths[i]);
|
|
|
|
dmxLogOutputCont(dmxScreen, "\n");
|
|
|
|
dmxLogOutput(dmxScreen, "Depth of root window: %d plane%s (%d)\n",
|
|
|
|
attribs.depth, attribs.depth == 1 ? "" : "s",
|
|
|
|
DisplayPlanes(dpy, scr));
|
|
|
|
dmxLogOutput(dmxScreen, "Number of colormaps: %d min, %d max\n",
|
|
|
|
MinCmapsOfScreen(s), MaxCmapsOfScreen(s));
|
|
|
|
dmxLogOutput(dmxScreen, "Options: backing-store %s, save-unders %s\n",
|
2012-03-21 20:55:09 +01:00
|
|
|
(DoesBackingStore(s) == NotUseful) ? "no" :
|
|
|
|
((DoesBackingStore(s) == Always) ? "yes" : "when mapped"),
|
|
|
|
DoesSaveUnders(s) ? "yes" : "no");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLogOutput(dmxScreen, "Window Manager running: %s\n",
|
2012-03-21 20:55:09 +01:00
|
|
|
(dmxScreen->WMRunningOnBE) ? "yes" : "no");
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
if (dmxScreen->WMRunningOnBE) {
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxLogOutputWarning(dmxScreen,
|
|
|
|
"Window manager running "
|
|
|
|
"-- colormaps not supported\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
XFree(depths);
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
dmxGetScreenAttribs(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
XWindowAttributes attribs;
|
2012-03-21 20:55:09 +01:00
|
|
|
Display *dpy = dmxScreen->beDisplay;
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
#ifdef GLXEXT
|
2012-03-21 20:55:09 +01:00
|
|
|
int dummy;
|
2004-06-30 22:06:56 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs);
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->beWidth = attribs.width;
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxScreen->beHeight = attribs.height;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
/* Fill in missing geometry information */
|
2004-06-30 22:06:56 +02:00
|
|
|
if (dmxScreen->scrnXSign < 0) {
|
|
|
|
if (dmxScreen->scrnWidth) {
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth
|
|
|
|
- dmxScreen->scrnX);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
|
|
|
|
dmxScreen->scrnX = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (dmxScreen->scrnYSign < 0) {
|
|
|
|
if (dmxScreen->scrnHeight) {
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight
|
|
|
|
- dmxScreen->scrnY);
|
|
|
|
}
|
|
|
|
else {
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->scrnY = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!dmxScreen->scrnWidth)
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX;
|
2004-06-30 22:06:56 +02:00
|
|
|
if (!dmxScreen->scrnHeight)
|
|
|
|
dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!dmxScreen->rootWidth)
|
|
|
|
dmxScreen->rootWidth = dmxScreen->scrnWidth;
|
|
|
|
if (!dmxScreen->rootHeight)
|
|
|
|
dmxScreen->rootHeight = dmxScreen->scrnHeight;
|
2004-06-30 22:06:56 +02:00
|
|
|
if (dmxScreen->rootWidth + dmxScreen->rootX > dmxScreen->scrnWidth)
|
|
|
|
dmxScreen->rootWidth = dmxScreen->scrnWidth - dmxScreen->rootX;
|
|
|
|
if (dmxScreen->rootHeight + dmxScreen->rootY > dmxScreen->scrnHeight)
|
|
|
|
dmxScreen->rootHeight = dmxScreen->scrnHeight - dmxScreen->rootY;
|
|
|
|
|
|
|
|
/* FIXME: Get these from the back-end server */
|
|
|
|
dmxScreen->beXDPI = 75;
|
|
|
|
dmxScreen->beYDPI = 75;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->beDepth = attribs.depth; /* FIXME: verify that this
|
|
|
|
* works always. In
|
|
|
|
* particular, this will work
|
|
|
|
* well for depth=16, will fail
|
|
|
|
* because of colormap issues
|
|
|
|
* at depth 8. More work needs
|
|
|
|
* to be done here. */
|
|
|
|
|
|
|
|
if (dmxScreen->beDepth <= 8)
|
|
|
|
dmxScreen->beBPP = 8;
|
|
|
|
else if (dmxScreen->beDepth <= 16)
|
|
|
|
dmxScreen->beBPP = 16;
|
|
|
|
else
|
|
|
|
dmxScreen->beBPP = 32;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
#ifdef GLXEXT
|
|
|
|
/* get the majorOpcode for the back-end GLX extension */
|
|
|
|
XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode,
|
2012-03-21 20:55:09 +01:00
|
|
|
&dummy, &dmxScreen->glxErrorBase);
|
2004-06-30 22:06:56 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
dmxPrintScreenInfo(dmxScreen);
|
|
|
|
dmxLogOutput(dmxScreen, "%dx%d+%d+%d on %dx%d at depth=%d, bpp=%d\n",
|
|
|
|
dmxScreen->scrnWidth, dmxScreen->scrnHeight,
|
|
|
|
dmxScreen->scrnX, dmxScreen->scrnY,
|
|
|
|
dmxScreen->beWidth, dmxScreen->beHeight,
|
|
|
|
dmxScreen->beDepth, dmxScreen->beBPP);
|
|
|
|
if (dmxScreen->beDepth == 8)
|
|
|
|
dmxLogOutputWarning(dmxScreen,
|
|
|
|
"Support for depth == 8 is not complete\n");
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
Bool
|
|
|
|
dmxGetVisualInfo(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
XVisualInfo visinfo;
|
|
|
|
|
|
|
|
visinfo.screen = DefaultScreen(dmxScreen->beDisplay);
|
|
|
|
dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay,
|
2012-03-21 20:55:09 +01:00
|
|
|
VisualScreenMask,
|
|
|
|
&visinfo, &dmxScreen->beNumVisuals);
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
dmxScreen->beDefVisualIndex = -1;
|
|
|
|
|
|
|
|
if (defaultColorVisualClass >= 0 || dmxDepth > 0) {
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < dmxScreen->beNumVisuals; i++)
|
|
|
|
if (defaultColorVisualClass >= 0) {
|
|
|
|
if (dmxScreen->beVisuals[i].class == defaultColorVisualClass) {
|
|
|
|
if (dmxDepth > 0) {
|
|
|
|
if (dmxScreen->beVisuals[i].depth == dmxDepth) {
|
|
|
|
dmxScreen->beDefVisualIndex = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dmxScreen->beDefVisualIndex = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (dmxScreen->beVisuals[i].depth == dmxDepth) {
|
|
|
|
dmxScreen->beDefVisualIndex = i;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
visinfo.visualid =
|
|
|
|
XVisualIDFromVisual(DefaultVisual(dmxScreen->beDisplay,
|
|
|
|
visinfo.screen));
|
|
|
|
|
|
|
|
for (i = 0; i < dmxScreen->beNumVisuals; i++)
|
|
|
|
if (visinfo.visualid == dmxScreen->beVisuals[i].visualid) {
|
|
|
|
dmxScreen->beDefVisualIndex = i;
|
|
|
|
break;
|
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
for (i = 0; i < dmxScreen->beNumVisuals; i++)
|
|
|
|
dmxLogVisual(dmxScreen, &dmxScreen->beVisuals[i],
|
|
|
|
(i == dmxScreen->beDefVisualIndex));
|
|
|
|
|
2010-06-06 16:18:40 +02:00
|
|
|
return dmxScreen->beDefVisualIndex >= 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
dmxGetColormaps(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals;
|
2010-05-05 20:44:06 +02:00
|
|
|
dmxScreen->beDefColormaps = malloc(dmxScreen->beNumDefColormaps *
|
2012-03-21 20:55:09 +01:00
|
|
|
sizeof(*dmxScreen->beDefColormaps));
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
for (i = 0; i < dmxScreen->beNumDefColormaps; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreen->beDefColormaps[i] =
|
|
|
|
XCreateColormap(dmxScreen->beDisplay,
|
|
|
|
DefaultRootWindow(dmxScreen->beDisplay),
|
|
|
|
dmxScreen->beVisuals[i].visual, AllocNone);
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay,
|
2012-03-21 20:55:09 +01:00
|
|
|
DefaultScreen(dmxScreen->beDisplay));
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay,
|
2012-03-21 20:55:09 +01:00
|
|
|
DefaultScreen(dmxScreen->beDisplay));
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
dmxGetPixmapFormats(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
dmxScreen->beDepths =
|
2012-03-21 20:55:09 +01:00
|
|
|
XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay),
|
|
|
|
&dmxScreen->beNumDepths);
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
dmxScreen->bePixmapFormats =
|
2012-03-21 20:55:09 +01:00
|
|
|
XListPixmapFormats(dmxScreen->beDisplay,
|
|
|
|
&dmxScreen->beNumPixmapFormats);
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static Bool
|
|
|
|
dmxSetPixmapFormats(ScreenInfo * pScreenInfo, DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
XPixmapFormatValues *bePixmapFormat;
|
2012-03-21 20:55:09 +01:00
|
|
|
PixmapFormatRec *format;
|
|
|
|
int i, j;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
pScreenInfo->imageByteOrder = ImageByteOrder(dmxScreen->beDisplay);
|
|
|
|
pScreenInfo->bitmapScanlineUnit = BitmapUnit(dmxScreen->beDisplay);
|
|
|
|
pScreenInfo->bitmapScanlinePad = BitmapPad(dmxScreen->beDisplay);
|
|
|
|
pScreenInfo->bitmapBitOrder = BitmapBitOrder(dmxScreen->beDisplay);
|
|
|
|
|
|
|
|
pScreenInfo->numPixmapFormats = 0;
|
|
|
|
for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) {
|
2012-03-21 20:55:09 +01:00
|
|
|
bePixmapFormat = &dmxScreen->bePixmapFormats[i];
|
|
|
|
for (j = 0; j < dmxScreen->beNumDepths; j++)
|
|
|
|
if ((bePixmapFormat->depth == 1) ||
|
|
|
|
(bePixmapFormat->depth == dmxScreen->beDepths[j])) {
|
|
|
|
format = &pScreenInfo->formats[pScreenInfo->numPixmapFormats];
|
|
|
|
|
|
|
|
format->depth = bePixmapFormat->depth;
|
|
|
|
format->bitsPerPixel = bePixmapFormat->bits_per_pixel;
|
|
|
|
format->scanlinePad = bePixmapFormat->scanline_pad;
|
|
|
|
|
|
|
|
pScreenInfo->numPixmapFormats++;
|
|
|
|
break;
|
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
dmxCheckForWM(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
Status status;
|
|
|
|
XWindowAttributes xwa;
|
|
|
|
|
|
|
|
status = XGetWindowAttributes(dmxScreen->beDisplay,
|
2012-03-21 20:55:09 +01:00
|
|
|
DefaultRootWindow(dmxScreen->beDisplay),
|
|
|
|
&xwa);
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxScreen->WMRunningOnBE =
|
2012-03-21 20:55:09 +01:00
|
|
|
(status &&
|
|
|
|
((xwa.all_event_masks & SubstructureRedirectMask) ||
|
|
|
|
(xwa.all_event_masks & SubstructureNotifyMask)));
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** Initialize the display and collect relevant information about the
|
|
|
|
* display properties */
|
2012-03-21 20:55:09 +01:00
|
|
|
static void
|
|
|
|
dmxDisplayInit(DMXScreenInfo * dmxScreen)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
if (!dmxOpenDisplay(dmxScreen))
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxLog(dmxFatal,
|
|
|
|
"dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name);
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
dmxSetErrorHandler(dmxScreen);
|
|
|
|
dmxCheckForWM(dmxScreen);
|
|
|
|
dmxGetScreenAttribs(dmxScreen);
|
|
|
|
|
|
|
|
if (!dmxGetVisualInfo(dmxScreen))
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
dmxGetColormaps(dmxScreen);
|
|
|
|
dmxGetPixmapFormats(dmxScreen);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* If this doesn't compile, just add || defined(yoursystem) to the line
|
|
|
|
* below. This information is to help with bug reports and is not
|
|
|
|
* critical. */
|
2012-03-21 20:55:09 +01:00
|
|
|
#if !defined(_POSIX_SOURCE)
|
|
|
|
static const char *
|
|
|
|
dmxExecOS(void)
|
|
|
|
{
|
|
|
|
return "";
|
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
#else
|
|
|
|
#include <sys/utsname.h>
|
2012-03-21 20:55:09 +01:00
|
|
|
static const char *
|
|
|
|
dmxExecOS(void)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
static char buffer[128];
|
2012-03-21 20:55:09 +01:00
|
|
|
static int initialized = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
struct utsname u;
|
|
|
|
|
|
|
|
if (!initialized++) {
|
|
|
|
memset(buffer, 0, sizeof(buffer));
|
|
|
|
uname(&u);
|
2012-03-21 20:55:09 +01:00
|
|
|
snprintf(buffer, sizeof(buffer) - 1, "%s %s %s",
|
|
|
|
u.sysname, u.release, u.version);
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static const char *
|
|
|
|
dmxBuildCompiler(void)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
static char buffer[128];
|
2012-03-21 20:55:09 +01:00
|
|
|
static int initialized = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
if (!initialized++) {
|
|
|
|
memset(buffer, 0, sizeof(buffer));
|
|
|
|
#if defined(__GNUC__) && defined(__GNUC_MINOR__) &&defined(__GNUC_PATCHLEVEL__)
|
2012-03-21 20:55:09 +01:00
|
|
|
snprintf(buffer, sizeof(buffer) - 1, "gcc %d.%d.%d",
|
|
|
|
__GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
|
2004-06-30 22:06:56 +02:00
|
|
|
#endif
|
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
static const char *
|
|
|
|
dmxExecHost(void)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
static char buffer[128];
|
2012-03-21 20:55:09 +01:00
|
|
|
static int initialized = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
if (!initialized++) {
|
|
|
|
memset(buffer, 0, sizeof(buffer));
|
|
|
|
XmuGetHostname(buffer, sizeof(buffer) - 1);
|
|
|
|
}
|
|
|
|
return buffer;
|
|
|
|
}
|
|
|
|
|
2012-11-19 05:00:22 +01:00
|
|
|
static void dmxAddExtensions(Bool glxSupported)
|
|
|
|
{
|
|
|
|
const ExtensionModule dmxExtensions[] = {
|
|
|
|
{ DMXExtensionInit, DMX_EXTENSION_NAME, NULL },
|
|
|
|
#ifdef GLXEXT
|
|
|
|
{ GlxExtensionInit, "GLX", &glxSupported },
|
|
|
|
#endif
|
|
|
|
};
|
|
|
|
|
2013-09-26 21:28:37 +02:00
|
|
|
LoadExtensionList(dmxExtensions, ARRAY_SIZE(dmxExtensions), TRUE);
|
2012-11-19 05:00:22 +01:00
|
|
|
}
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
/** This routine is called in Xserver/dix/main.c from \a main(). */
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[])
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
2012-03-21 20:55:09 +01:00
|
|
|
int i;
|
2004-06-30 22:06:56 +02:00
|
|
|
static unsigned long dmxGeneration = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
#ifdef GLXEXT
|
2012-11-19 05:00:22 +01:00
|
|
|
static Bool glxSupported = TRUE;
|
2013-11-26 07:19:34 +01:00
|
|
|
#else
|
|
|
|
const Bool glxSupported = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
#endif
|
|
|
|
|
|
|
|
if (dmxGeneration != serverGeneration) {
|
2012-03-21 20:55:09 +01:00
|
|
|
int vendrel = VENDOR_RELEASE;
|
2004-06-30 22:06:56 +02:00
|
|
|
int major, minor, year, month, day;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxGeneration = serverGeneration;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
major = vendrel / 100000000;
|
|
|
|
vendrel -= major * 100000000;
|
|
|
|
minor = vendrel / 1000000;
|
|
|
|
vendrel -= minor * 1000000;
|
|
|
|
year = vendrel / 10000;
|
|
|
|
vendrel -= year * 10000;
|
|
|
|
month = vendrel / 100;
|
|
|
|
vendrel -= month * 100;
|
|
|
|
day = vendrel;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Add other epoch tests here */
|
|
|
|
if (major > 0 && minor > 0)
|
|
|
|
year += 2000;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
dmx: fix printf format argument warnings
Gets rid of these gcc 4.8 warnings:
dmxinit.c: In function ‘dmxErrorHandler’:
dmxinit.c:167:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:171:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:175:16: warning: format ‘%x’ expects argument of type ‘unsigned int’,
but argument 3 has type ‘XID64’ [-Wformat=]
ev->resourceid);
^
dmxinit.c:181:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
ev->serial);
^
dmxinit.c:183:12: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dpy->request);
^
dmxinit.c: In function ‘InitOutput’:
dmxinit.c:637:9: warning: format ‘%d’ expects argument of type ‘int’,
but argument 3 has type ‘long unsigned int’ [-Wformat=]
dmxLog(dmxInfo, "Generation: %d\n", dmxGeneration);
^
dmxprop.c: In function ‘dmxPropertyCheckOtherWindows’:
dmxprop.c:223:24: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 4 has type ‘Window’ [-Wformat=]
dmxScreen->name, win, tp.value);
^
dmxprop.c: In function ‘dmxPropertyWindow’:
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 5 has type ‘Window’ [-Wformat=]
other->index, other->name, other->scrnWin);
^
dmxprop.c:364:16: warning: format ‘%lu’ expects argument of type ‘long
unsigned int’, but argument 8 has type ‘Window’ [-Wformat=]
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Reviewed-by: Rémi Cardona <remi@gentoo.org>
Reviewed-by: Keith Packard <keithp@keithp.com>
2014-12-13 04:09:36 +01:00
|
|
|
dmxLog(dmxInfo, "Generation: %lu\n", dmxGeneration);
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d (%s)\n",
|
|
|
|
major, minor, year, month, day, VENDOR_STRING);
|
|
|
|
|
|
|
|
SetVendorRelease(VENDOR_RELEASE);
|
|
|
|
SetVendorString(VENDOR_STRING);
|
|
|
|
|
|
|
|
if (dmxGeneration == 1) {
|
|
|
|
dmxLog(dmxInfo, "DMX Build OS: %s (%s)\n", OSNAME, OSVENDOR);
|
|
|
|
dmxLog(dmxInfo, "DMX Build Compiler: %s\n", dmxBuildCompiler());
|
|
|
|
dmxLog(dmxInfo, "DMX Execution OS: %s\n", dmxExecOS());
|
|
|
|
dmxLog(dmxInfo, "DMX Execution Host: %s\n", dmxExecHost());
|
|
|
|
}
|
|
|
|
dmxLog(dmxInfo, "MAXSCREENS: %d\n", MAXSCREENS);
|
|
|
|
|
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
|
|
|
if (dmxScreens[i].beDisplay)
|
|
|
|
dmxLog(dmxWarning, "Display \"%s\" still open\n",
|
|
|
|
dmxScreens[i].name);
|
|
|
|
dmxStatFree(dmxScreens[i].stat);
|
|
|
|
dmxScreens[i].stat = NULL;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < dmxNumInputs; i++)
|
|
|
|
dmxInputFree(&dmxInputs[i]);
|
2010-06-06 10:28:30 +02:00
|
|
|
free(dmxScreens);
|
|
|
|
free(dmxInputs);
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxScreens = NULL;
|
|
|
|
dmxInputs = NULL;
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxNumScreens = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxNumInputs = 0;
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Make sure that the command-line arguments are sane. */
|
2006-12-16 18:02:38 +01:00
|
|
|
if (dmxAddRemoveScreens && dmxGLXProxy) {
|
2012-03-21 20:55:09 +01:00
|
|
|
/* Currently it is not possible to support GLX and Render
|
|
|
|
* extensions with dynamic screen addition/removal due to the
|
|
|
|
* state that each extension keeps, which cannot be restored. */
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning,
|
2012-03-21 20:55:09 +01:00
|
|
|
"GLX Proxy and Render extensions do not yet support dynamic\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning,
|
2012-03-21 20:55:09 +01:00
|
|
|
"screen addition and removal. Please specify -noglxproxy\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning,
|
2012-03-21 20:55:09 +01:00
|
|
|
"and -norender on the command line or in the configuration\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning,
|
2012-03-21 20:55:09 +01:00
|
|
|
"file to disable these two extensions if you wish to use\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxWarning,
|
2012-03-21 20:55:09 +01:00
|
|
|
"the dynamic addition and removal of screens support.\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxFatal,
|
2012-03-21 20:55:09 +01:00
|
|
|
"Dynamic screen addition/removal error (see above).\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* ddxProcessArgument has been called at this point, but any data
|
|
|
|
* from the configuration file has not been applied. Do so, and be
|
|
|
|
* sure we have at least one back-end display. */
|
|
|
|
dmxConfigConfigure();
|
|
|
|
if (!dmxNumScreens)
|
|
|
|
dmxLog(dmxFatal, "InitOutput: no back-end displays found\n");
|
|
|
|
if (!dmxNumInputs)
|
|
|
|
dmxLog(dmxInfo, "InitOutput: no inputs found\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
/* Disable lazy window creation optimization if offscreen
|
|
|
|
* optimization is disabled */
|
|
|
|
if (!dmxOffScreenOpt && dmxLazyWindowCreation) {
|
|
|
|
dmxLog(dmxInfo,
|
2012-03-21 20:55:09 +01:00
|
|
|
"InitOutput: Disabling lazy window creation optimization\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxLog(dmxInfo,
|
2012-03-21 20:55:09 +01:00
|
|
|
" since it requires the offscreen optimization\n");
|
|
|
|
dmxLog(dmxInfo, " to function properly.\n");
|
|
|
|
dmxLazyWindowCreation = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Open each display and gather information about it. */
|
|
|
|
for (i = 0; i < dmxNumScreens; i++)
|
|
|
|
dmxDisplayInit(&dmxScreens[i]);
|
|
|
|
|
2004-07-07 01:51:00 +02:00
|
|
|
#if PANORAMIX
|
2004-06-30 22:06:56 +02:00
|
|
|
/* Register a Xinerama callback which will run from within
|
|
|
|
* PanoramiXCreateConnectionBlock. We can use the callback to
|
|
|
|
* determine if Xinerama is loaded and to check the visuals
|
|
|
|
* determined by PanoramiXConsolidate. */
|
|
|
|
XineramaRegisterConnectionBlockCallback(dmxConnectionBlockCallback);
|
2004-07-07 01:51:00 +02:00
|
|
|
#endif
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
/* Since we only have a single screen thus far, we only need to set
|
2012-03-21 20:55:09 +01:00
|
|
|
the pixmap formats to match that screen. FIXME: this isn't true. */
|
|
|
|
if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0]))
|
|
|
|
return;
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
/* Might want to install a signal handler to allow cleaning up after
|
|
|
|
* unexpected signals. The DIX/OS layer already handles SIGINT and
|
|
|
|
* SIGTERM, so everything is OK for expected signals. --DD
|
|
|
|
*
|
|
|
|
* SIGHUP, SIGINT, and SIGTERM are trapped in os/connection.c
|
|
|
|
* SIGQUIT is another common signal that is sent from the keyboard.
|
|
|
|
* Trap it here, to ensure that the keyboard modifier map and other
|
|
|
|
* state for the input devices are restored. (This makes the
|
|
|
|
* behavior of SIGQUIT somewhat unexpected, since it will be the
|
|
|
|
* same as the behavior of SIGINT. However, leaving the modifier
|
|
|
|
* map of the input devices empty is even more unexpected.) --RF
|
|
|
|
*/
|
|
|
|
OsSignal(SIGQUIT, GiveUp);
|
|
|
|
|
|
|
|
#ifdef GLXEXT
|
|
|
|
/* Check if GLX extension exists on all back-end servers */
|
|
|
|
for (i = 0; i < dmxNumScreens; i++)
|
2012-03-21 20:55:09 +01:00
|
|
|
glxSupported &= (dmxScreens[i].glxMajorOpcode > 0);
|
2013-11-26 07:19:34 +01:00
|
|
|
#endif
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-11-19 05:00:22 +01:00
|
|
|
if (serverGeneration == 1)
|
|
|
|
dmxAddExtensions(glxSupported);
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
/* Tell dix layer about the backend displays */
|
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
|
|
|
|
|
|
|
#ifdef GLXEXT
|
2012-03-21 20:55:09 +01:00
|
|
|
if (glxSupported) {
|
|
|
|
/*
|
|
|
|
* Builds GLX configurations from the list of visuals
|
|
|
|
* supported by the back-end server, and give that
|
|
|
|
* configuration list to the glx layer - so that he will
|
|
|
|
* build the visuals accordingly.
|
|
|
|
*/
|
|
|
|
|
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
|
|
|
__GLXvisualConfig *configs = NULL;
|
|
|
|
dmxGlxVisualPrivate **configprivs = NULL;
|
|
|
|
int nconfigs = 0;
|
|
|
|
int (*oldErrorHandler) (Display *, XErrorEvent *);
|
|
|
|
int i;
|
|
|
|
|
|
|
|
/* Catch errors if when using an older GLX w/o FBconfigs */
|
|
|
|
oldErrorHandler = XSetErrorHandler(dmxNOPErrorHandler);
|
|
|
|
|
|
|
|
/* Get FBConfigs of the back-end server */
|
|
|
|
dmxScreen->fbconfigs = GetGLXFBConfigs(dmxScreen->beDisplay,
|
|
|
|
dmxScreen->glxMajorOpcode,
|
|
|
|
&dmxScreen->numFBConfigs);
|
|
|
|
|
|
|
|
XSetErrorHandler(oldErrorHandler);
|
|
|
|
|
|
|
|
dmxScreen->glxVisuals =
|
|
|
|
GetGLXVisualConfigs(dmxScreen->beDisplay,
|
|
|
|
DefaultScreen(dmxScreen->beDisplay),
|
|
|
|
&dmxScreen->numGlxVisuals);
|
|
|
|
|
|
|
|
if (dmxScreen->fbconfigs) {
|
|
|
|
configs =
|
|
|
|
GetGLXVisualConfigsFromFBConfigs(dmxScreen->fbconfigs,
|
|
|
|
dmxScreen->numFBConfigs,
|
|
|
|
dmxScreen->beVisuals,
|
|
|
|
dmxScreen->beNumVisuals,
|
|
|
|
dmxScreen->glxVisuals,
|
|
|
|
dmxScreen->numGlxVisuals,
|
|
|
|
&nconfigs);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
configs = dmxScreen->glxVisuals;
|
|
|
|
nconfigs = dmxScreen->numGlxVisuals;
|
|
|
|
}
|
|
|
|
|
|
|
|
configprivs = malloc(nconfigs * sizeof(dmxGlxVisualPrivate *));
|
|
|
|
|
|
|
|
if (configs != NULL && configprivs != NULL) {
|
|
|
|
|
|
|
|
/* Initialize our private info for each visual
|
|
|
|
* (currently only x_visual_depth and x_visual_class)
|
|
|
|
*/
|
|
|
|
for (i = 0; i < nconfigs; i++) {
|
|
|
|
|
|
|
|
configprivs[i] = (dmxGlxVisualPrivate *)
|
|
|
|
malloc(sizeof(dmxGlxVisualPrivate));
|
|
|
|
configprivs[i]->x_visual_depth = 0;
|
|
|
|
configprivs[i]->x_visual_class = 0;
|
|
|
|
|
|
|
|
/* Find the visual depth */
|
|
|
|
if (configs[i].vid > 0) {
|
|
|
|
int j;
|
|
|
|
|
|
|
|
for (j = 0; j < dmxScreen->beNumVisuals; j++) {
|
|
|
|
if (dmxScreen->beVisuals[j].visualid ==
|
|
|
|
configs[i].vid) {
|
|
|
|
configprivs[i]->x_visual_depth =
|
|
|
|
dmxScreen->beVisuals[j].depth;
|
|
|
|
configprivs[i]->x_visual_class =
|
|
|
|
dmxScreen->beVisuals[j].class;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2008-06-04 09:28:31 +02:00
|
|
|
XFlush(dmxScreen->beDisplay);
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
#endif /* GLXEXT */
|
2004-06-30 22:06:56 +02:00
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
AddScreen(dmxScreenInit, argc, argv);
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Compute origin information. */
|
|
|
|
dmxInitOrigins();
|
|
|
|
|
|
|
|
/* Compute overlap information. */
|
|
|
|
dmxInitOverlap();
|
|
|
|
|
|
|
|
/* Make sure there is a global width/height available */
|
|
|
|
dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX);
|
|
|
|
|
|
|
|
/* FIXME: The following is temporarily placed here. When the DMX
|
|
|
|
* extension is available, it will be move there.
|
|
|
|
*/
|
|
|
|
dmxInitFonts();
|
|
|
|
|
|
|
|
/* Initialize the render extension */
|
2004-07-31 06:23:21 +02:00
|
|
|
if (!noRenderExtension)
|
2012-03-21 20:55:09 +01:00
|
|
|
dmxInitRender();
|
2004-06-30 22:06:56 +02:00
|
|
|
|
|
|
|
/* Initialized things that need timer hooks */
|
|
|
|
dmxStatInit();
|
|
|
|
dmxSyncInit(); /* Calls RegisterBlockAndWakeupHandlers */
|
|
|
|
}
|
|
|
|
|
|
|
|
/* RATS: Assuming the fp string (which comes from the command-line argv
|
|
|
|
vector) is NULL-terminated, the buffer is large enough for the
|
2012-03-21 20:55:09 +01:00
|
|
|
strcpy. */
|
|
|
|
static void
|
|
|
|
dmxSetDefaultFontPath(const char *fp)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
if (dmxFontPath) {
|
2012-03-21 20:55:09 +01:00
|
|
|
int fplen = strlen(fp) + 1;
|
|
|
|
int len = strlen(dmxFontPath);
|
|
|
|
|
|
|
|
dmxFontPath = realloc(dmxFontPath, len + fplen + 1);
|
|
|
|
dmxFontPath[len] = ',';
|
|
|
|
strncpy(&dmxFontPath[len + 1], fp, fplen);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
dmxFontPath = strdup(fp);
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
defaultFontPath = dmxFontPath;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** This function is called in Xserver/os/utils.c from \a AbortServer().
|
|
|
|
* We must ensure that backend and console state is restored in the
|
|
|
|
* event the server shutdown wasn't clean. */
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
AbortDDX(enum ExitCode error)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
2012-03-21 20:55:09 +01:00
|
|
|
for (i = 0; i < dmxNumScreens; i++) {
|
2004-06-30 22:06:56 +02:00
|
|
|
DMXScreenInfo *dmxScreen = &dmxScreens[i];
|
2012-03-21 20:55:09 +01:00
|
|
|
|
|
|
|
if (dmxScreen->beDisplay)
|
|
|
|
XCloseDisplay(dmxScreen->beDisplay);
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxScreen->beDisplay = NULL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-10-15 08:53:43 +02:00
|
|
|
#ifdef DDXBEFORERESET
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
ddxBeforeReset(void)
|
2009-10-15 08:53:43 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
/** This function is called in Xserver/dix/main.c from \a main() when
|
|
|
|
* dispatchException & DE_TERMINATE (which is the only way to exit the
|
|
|
|
* main loop without an interruption. */
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
ddxGiveUp(enum ExitCode error)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
2011-07-20 05:09:05 +02:00
|
|
|
AbortDDX(error);
|
2004-06-30 22:06:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/** This function is called in Xserver/os/osinit.c from \a OsInit(). */
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
OsVendorInit(void)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/** This function is called in Xserver/os/utils.c from \a FatalError()
|
|
|
|
* and \a VFatalError(). (Note that setting the function pointer \a
|
|
|
|
* OsVendorVErrorFProc will cause \a VErrorF() (which is called by the
|
|
|
|
* two routines mentioned here, as well as by others) to use the
|
|
|
|
* referenced routine instead of \a vfprintf().) */
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
2012-02-17 21:35:02 +01:00
|
|
|
OsVendorFatalError(const char *f, va_list args)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Process our command line arguments. */
|
2012-03-21 20:55:09 +01:00
|
|
|
int
|
|
|
|
ddxProcessArgument(int argc, char *argv[], int i)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
int retval = 0;
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
if (!strcmp(argv[i], "-display")) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (++i < argc)
|
|
|
|
dmxConfigStoreDisplay(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxConfigStoreInput(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i], "-xinput")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxConfigStoreXInput(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-noshadowfb")) {
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-nomulticursor")) {
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxCursorNoMulti();
|
2012-03-21 20:55:09 +01:00
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-shadowfb")) {
|
|
|
|
retval = 1;
|
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-configfile")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxConfigStoreFile(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-config")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxConfigStoreConfig(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-fontpath")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxSetDefaultFontPath(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-stat")) {
|
|
|
|
if ((i += 2) < argc)
|
|
|
|
dmxStatActivate(argv[i - 1], argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 3;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-syncbatch")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxSyncActivate(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-nooffscreenopt")) {
|
|
|
|
dmxOffScreenOpt = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-nosubdivprims")) {
|
|
|
|
dmxSubdividePrimitives = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-nowindowopt")) {
|
|
|
|
dmxLazyWindowCreation = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-noxkb")) {
|
|
|
|
dmxUseXKB = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-depth")) {
|
|
|
|
if (++i < argc)
|
|
|
|
dmxDepth = atoi(argv[i]);
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 2;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-norender")) {
|
|
|
|
noRenderExtension = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
|
|
|
#ifdef GLXEXT
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-noglxproxy")) {
|
|
|
|
dmxGLXProxy = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-noglxswapgroup")) {
|
|
|
|
dmxGLXSwapGroupSupport = FALSE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-glxsyncswap")) {
|
|
|
|
dmxGLXSyncSwap = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-glxfinishswap")) {
|
|
|
|
dmxGLXFinishSwap = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-ignorebadfontpaths")) {
|
|
|
|
dmxIgnoreBadFontPaths = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-addremovescreens")) {
|
|
|
|
dmxAddRemoveScreens = TRUE;
|
2004-06-30 22:06:56 +02:00
|
|
|
retval = 1;
|
2012-03-21 20:55:09 +01:00
|
|
|
}
|
|
|
|
else if (!strcmp(argv[i], "-param")) {
|
2004-06-30 22:06:56 +02:00
|
|
|
if ((i += 2) < argc) {
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!strcasecmp(argv[i - 1], "xkbrules"))
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxConfigSetXkbRules(argv[i]);
|
2012-03-21 20:55:09 +01:00
|
|
|
else if (!strcasecmp(argv[i - 1], "xkbmodel"))
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxConfigSetXkbModel(argv[i]);
|
2012-03-21 20:55:09 +01:00
|
|
|
else if (!strcasecmp(argv[i - 1], "xkblayout"))
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxConfigSetXkbLayout(argv[i]);
|
2012-03-21 20:55:09 +01:00
|
|
|
else if (!strcasecmp(argv[i - 1], "xkbvariant"))
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxConfigSetXkbVariant(argv[i]);
|
2012-03-21 20:55:09 +01:00
|
|
|
else if (!strcasecmp(argv[i - 1], "xkboptions"))
|
2004-06-30 22:06:56 +02:00
|
|
|
dmxConfigSetXkbOptions(argv[i]);
|
|
|
|
else
|
|
|
|
dmxLog(dmxWarning,
|
|
|
|
"-param requires: XkbRules, XkbModel, XkbLayout,"
|
|
|
|
" XkbVariant, or XkbOptions\n");
|
|
|
|
}
|
|
|
|
retval = 3;
|
|
|
|
}
|
2012-03-21 20:55:09 +01:00
|
|
|
if (!serverGeneration)
|
|
|
|
dmxConfigSetMaxScreens();
|
2004-06-30 22:06:56 +02:00
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
/** Provide succinct usage information for the DMX server. */
|
2012-03-21 20:55:09 +01:00
|
|
|
void
|
|
|
|
ddxUseMsg(void)
|
2004-06-30 22:06:56 +02:00
|
|
|
{
|
|
|
|
ErrorF("\n\nDevice Dependent Usage:\n");
|
|
|
|
ErrorF("-display string Specify the back-end display(s)\n");
|
|
|
|
ErrorF("-input string Specify input source for core device\n");
|
|
|
|
ErrorF("-xinput string Specify input source for XInput device\n");
|
|
|
|
ErrorF("-shadowfb Enable shadow frame buffer\n");
|
|
|
|
ErrorF("-configfile file Read from a configuration file\n");
|
|
|
|
ErrorF("-config config Select a specific configuration\n");
|
|
|
|
ErrorF("-nomulticursor Turn of multiple cursor support\n");
|
|
|
|
ErrorF("-fontpath Sets the default font path\n");
|
|
|
|
ErrorF("-stat inter scrns Print out performance statistics\n");
|
|
|
|
ErrorF("-syncbatch inter Set interval for XSync batching\n");
|
|
|
|
ErrorF("-nooffscreenopt Disable offscreen optimization\n");
|
|
|
|
ErrorF("-nosubdivprims Disable primitive subdivision\n");
|
|
|
|
ErrorF(" optimization\n");
|
|
|
|
ErrorF("-nowindowopt Disable lazy window creation optimization\n");
|
|
|
|
ErrorF("-noxkb Disable use of the XKB extension with\n");
|
|
|
|
ErrorF(" backend displays (cf. -kb).\n");
|
|
|
|
ErrorF("-depth Specify the default root window depth\n");
|
|
|
|
ErrorF("-norender Disable RENDER extension support\n");
|
|
|
|
#ifdef GLXEXT
|
|
|
|
ErrorF("-noglxproxy Disable GLX Proxy\n");
|
|
|
|
ErrorF("-noglxswapgroup Disable swap group and swap barrier\n");
|
|
|
|
ErrorF(" extensions in GLX proxy\n");
|
|
|
|
ErrorF("-glxsyncswap Force XSync after swap buffers\n");
|
|
|
|
ErrorF("-glxfinishswap Force glFinish after swap buffers\n");
|
|
|
|
#endif
|
2012-03-21 20:55:09 +01:00
|
|
|
ErrorF
|
|
|
|
("-ignorebadfontpaths Ignore bad font paths during initialization\n");
|
2004-06-30 22:06:56 +02:00
|
|
|
ErrorF("-addremovescreens Enable dynamic screen addition/removal\n");
|
|
|
|
ErrorF("-param ... Specify configuration parameters (e.g.,\n");
|
|
|
|
ErrorF(" XkbRules, XkbModel, XkbLayout, etc.)\n");
|
|
|
|
ErrorF("\n");
|
|
|
|
ErrorF(" If the -input string matches a -display string, then input\n"
|
|
|
|
" is taken from that backend display. (XInput cannot be taken\n"
|
|
|
|
" from a backend display.) Placing \",console\" after the\n"
|
|
|
|
" display name will force a console window to be opened on\n"
|
|
|
|
" that display in addition to the backend input. This is\n"
|
|
|
|
" useful if the backend window does not cover the whole\n"
|
|
|
|
" physical display.\n\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
ErrorF(" Otherwise, if the -input or -xinput string specifies another\n"
|
|
|
|
" X display, then a console window will be created on that\n"
|
|
|
|
" display. Placing \",windows\" or \",nowindows\" after the\n"
|
|
|
|
" display name will control the display of window outlines in\n"
|
|
|
|
" the console.\n\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
ErrorF(" -input or -xinput dummy specifies no input.\n");
|
|
|
|
ErrorF(" -input or -xinput local specifies the use of a raw keyboard,\n"
|
|
|
|
" mouse, or other (extension) device:\n"
|
|
|
|
" -input local,kbd,ps2 will use a ps2 mouse\n"
|
|
|
|
" -input local,kbd,ms will use a serial mouse\n"
|
|
|
|
" -input local,usb-kbd,usb-mou will use USB devices \n"
|
|
|
|
" -xinput local,usb-oth will use a non-mouse and\n"
|
|
|
|
" non-keyboard USB device with XInput\n\n");
|
2012-03-21 20:55:09 +01:00
|
|
|
|
2004-06-30 22:06:56 +02:00
|
|
|
ErrorF(" Special Keys:\n");
|
|
|
|
ErrorF(" Ctrl-Alt-g Server grab/ungrab (console only)\n");
|
|
|
|
ErrorF(" Ctrl-Alt-f Fine (1-pixel) mouse mode (console only)\n");
|
|
|
|
ErrorF(" Ctrl-Alt-q Quit (core devices only)\n");
|
|
|
|
ErrorF(" Ctrl-Alt-F* Switch to VC (local only)\n");
|
|
|
|
}
|