diff options
author | Povilas Kanapickas <povilas@radix.lt> | 2021-09-03 14:33:15 +0300 |
---|---|---|
committer | Povilas Kanapickas <povilas@radix.lt> | 2021-09-07 09:34:31 +0000 |
commit | b3b81c8c2090cd49410960a021baf0d27fdd2ab3 (patch) | |
tree | 3131dd016db3fe640e5591e6eb044bbfe141f6b7 | |
parent | 8f8ebf870b55c9875b7cfd8ef69c1df02d589b4a (diff) |
Drop DMX DDX
It turns out xdmx currently crashes when any client attempts to use GL
and it has been in such state for about 14 years. There was a patch to
fix the problem [1] 4 years ago, but it never got merged. The last
activity on any bugs referring to xdmx has been more than 4 years ago.
Given such situation, I find it unlikely that anyone is still using xdmx
and just having the code is a drain of resources.
[1]: https://lists.x.org/archives/xorg-devel/2017-June/053919.html
Signed-off-by: Povilas Kanapickas <povilas@radix.lt>
200 files changed, 3 insertions, 54316 deletions
diff --git a/.appveyor.yml b/.appveyor.yml index b243ff43b..80032b867 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,7 +29,6 @@ pkg-config,\ python3,\ windowsdriproto,\ xorgproto,\ -libdmx-devel,\ libepoxy-devel,\ libfontenc-devel,\ libfreetype-devel,\ @@ -73,7 +72,7 @@ cache: - '%CYGWIN_ROOT%\home\%USERNAME%\.ccache' build_script: - SET PATH=%CYGWIN_ROOT%/bin -- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Ddmx=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dhal=false -Dudev=false -Dpciaccess=false -Dint10=false build"' +- '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson setup --prefix=/usr -Dxv=false -Dxf86bigfont=true -Dxephyr=true -Dxnest=true -Dxvfb=true -Dxwin=true -Dxorg=true -Dhal=false -Dudev=false -Dpciaccess=false -Dint10=false build"' - '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; meson configure build"' - '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ninja -C build"' - '%CYGWIN_ROOT%/bin/bash -lc "cd $APPVEYOR_BUILD_FOLDER; ccache -s"' diff --git a/Makefile.am b/Makefile.am index 575296509..abbea2856 100644 --- a/Makefile.am +++ b/Makefile.am @@ -152,11 +152,6 @@ EXTRA_DIST += \ fb/meson.build \ glamor/meson.build \ glx/meson.build \ - hw/dmx/config/meson.build \ - hw/dmx/examples/meson.build \ - hw/dmx/glxProxy/meson.build \ - hw/dmx/input/meson.build \ - hw/dmx/meson.build \ hw/kdrive/ephyr/meson.build \ hw/kdrive/meson.build \ hw/kdrive/src/meson.build \ diff --git a/configure.ac b/configure.ac index 264bbb9d6..09e7a06ef 100644 --- a/configure.ac +++ b/configure.ac @@ -572,7 +572,6 @@ AC_ARG_ENABLE(suid-wrapper, AS_HELP_STRING([--enable-suid-wrapper], [Build suid- dnl DDXes. AC_ARG_ENABLE(xorg, AS_HELP_STRING([--enable-xorg], [Build Xorg server (default: auto)]), [XORG=$enableval], [XORG=auto]) -AC_ARG_ENABLE(dmx, AS_HELP_STRING([--enable-dmx], [Build DMX server (default: no)]), [DMX=$enableval], [DMX=no]) AC_ARG_ENABLE(xvfb, AS_HELP_STRING([--enable-xvfb], [Build Xvfb server (default: yes)]), [XVFB=$enableval], [XVFB=yes]) AC_ARG_ENABLE(xnest, AS_HELP_STRING([--enable-xnest], [Build Xnest server (default: auto)]), [XNEST=$enableval], [XNEST=auto]) AC_ARG_ENABLE(xquartz, AS_HELP_STRING([--enable-xquartz], [Build Xquartz server for OS-X (default: auto)]), [XQUARTZ=$enableval], [XQUARTZ=auto]) @@ -721,7 +720,6 @@ XINERAMAPROTO="xineramaproto" BIGFONTPROTO="xf86bigfontproto >= 1.2.0" DGAPROTO="xf86dgaproto >= 2.0.99.1" GLPROTO="glproto >= 1.4.17" -DMXPROTO="dmxproto >= 2.2.99.1" VIDMODEPROTO="xf86vidmodeproto >= 2.2.99.1" APPLEWMPROTO="applewmproto >= 1.4" LIBXSHMFENCE="xshmfence >= 1.1" @@ -743,7 +741,6 @@ PRESENTPROTO="presentproto >= 1.2" dnl List of libraries that require a specific version LIBAPPLEWM="applewm >= 1.4" -LIBDMX="dmx >= 1.0.99.1" LIBDRI="dri >= 7.8.0" LIBDRM="libdrm >= 2.4.89" LIBEGL="egl" @@ -2180,62 +2177,6 @@ AM_CONDITIONAL(XQUARTZ, [test "x$XQUARTZ" = xyes]) AM_CONDITIONAL(XQUARTZ_SPARKLE, [test "x$XQUARTZ_SPARKLE" != "xno"]) AM_CONDITIONAL(STANDALONE_XPBPROXY, [test "x$STANDALONE_XPBPROXY" = xyes]) -dnl DMX DDX -PKG_CHECK_MODULES( - [DMXMODULES], - [xmuu $LIBXEXT x11 >= 1.6 xrender xfixes $LIBXI $DMXPROTO xau $XDMCP_MODULES], - [PKG_CHECK_MODULES( - [XDMXCONFIG_DEP], - [xaw7 xmu xt xpm x11], - [have_dmx=yes], - [have_dmx=no])], - [have_dmx=no]) -AC_MSG_CHECKING([whether to build Xdmx DDX]) -if test "x$DMX" = xauto; then - DMX="$have_dmx" - case $host_os in - cygwin*) DMX="no" ;; - mingw*) DMX="no" ;; - darwin*) DMX="no" ;; - esac -fi -AC_MSG_RESULT([$DMX]) -AM_CONDITIONAL(DMX, [test "x$DMX" = xyes]) - -if test "x$DMX" = xyes; then - if test "x$have_dmx" = xno; then - AC_MSG_ERROR([Xdmx build explicitly requested, but required - modules not found.]) - fi - DMX_INCLUDES="$XEXT_INC $RENDER_INC $RECORD_INC" - XDMX_CFLAGS="$DMXMODULES_CFLAGS" - XDMX_LIBS="$FB_LIB $MI_LIB $XEXT_LIB $RENDER_LIB $RECORD_LIB $XI_LIB $XKB_LIB $XKB_STUB_LIB $DRI3_LIB $PRESENT_LIB $MIEXT_SYNC_LIB $MIEXT_SHADOW_LIB $MIEXT_DAMAGE_LIB $COMPOSITE_LIB $DAMAGE_LIB $MAIN_LIB $DIX_LIB $RANDR_LIB $RENDER_LIB $CONFIG_LIB $OS_LIB $FIXES_LIB" - XDMX_SYS_LIBS="$DMXMODULES_LIBS" - AC_SUBST([XDMX_CFLAGS]) - AC_SUBST([XDMX_LIBS]) - AC_SUBST([XDMX_SYS_LIBS]) - -dnl USB sources in DMX require <linux/input.h> - AC_CHECK_HEADER([linux/input.h], DMX_BUILD_USB="yes", - DMX_BUILD_USB="no") - AC_SUBST(XDMXCONFIG_DEP_CFLAGS) - AC_SUBST(XDMXCONFIG_DEP_LIBS) - PKG_CHECK_MODULES([DMXEXAMPLES_DEP], [$LIBDMX $LIBXEXT x11]) - AC_SUBST(DMXEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([DMXXMUEXAMPLES_DEP], [$LIBDMX xmu $LIBXEXT x11]) - AC_SUBST(DMXXMUEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([DMXXIEXAMPLES_DEP], [$LIBDMX $LIBXI $LIBXEXT x11]) - AC_SUBST(DMXXIEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([XTSTEXAMPLES_DEP], [$LIBXTST $LIBXEXT x11]) - AC_SUBST(XTSTEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([XRESEXAMPLES_DEP], [xres $LIBXEXT x11]) - AC_SUBST(XRESEXAMPLES_DEP_LIBS) - PKG_CHECK_MODULES([X11EXAMPLES_DEP], [$LIBXEXT x11]) - AC_SUBST(X11EXAMPLES_DEP_LIBS) - -fi -AM_CONDITIONAL([DMX_BUILD_USB], [test "x$DMX_BUILD_USB" = xyes]) - dnl kdrive DDX XEPHYR_LIBS= @@ -2489,16 +2430,6 @@ hw/xfree86/xkb/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/man/Makefile hw/xfree86/utils/gtf/Makefile -hw/dmx/config/Makefile -hw/dmx/config/man/Makefile -hw/dmx/doc/Makefile -hw/dmx/doxygen/doxygen.conf -hw/dmx/doxygen/Makefile -hw/dmx/examples/Makefile -hw/dmx/input/Makefile -hw/dmx/glxProxy/Makefile -hw/dmx/Makefile -hw/dmx/man/Makefile hw/vfb/Makefile hw/vfb/man/Makefile hw/xnest/Makefile diff --git a/hw/Makefile.am b/hw/Makefile.am index 19895dc77..006898bfb 100644 --- a/hw/Makefile.am +++ b/hw/Makefile.am @@ -1,7 +1,3 @@ -if DMX -DMX_SUBDIRS = dmx -endif - if XORG XORG_SUBDIRS = xfree86 endif @@ -35,12 +31,11 @@ SUBDIRS = \ $(XWIN_SUBDIRS) \ $(XVFB_SUBDIRS) \ $(XNEST_SUBDIRS) \ - $(DMX_SUBDIRS) \ $(KDRIVE_SUBDIRS) \ $(XQUARTZ_SUBDIRS) \ $(XWAYLAND_SUBDIRS) -DIST_SUBDIRS = dmx xfree86 vfb xnest xwin xquartz kdrive xwayland +DIST_SUBDIRS = xfree86 vfb xnest xwin xquartz kdrive xwayland relink: $(AM_V_at)for i in $(SUBDIRS) ; do $(MAKE) -C $$i relink || exit 1 ; done diff --git a/hw/dmx/.gitignore b/hw/dmx/.gitignore deleted file mode 100644 index 513ee3770..000000000 --- a/hw/dmx/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Add & Override for this directory and its subdirectories -Xdmx diff --git a/hw/dmx/Makefile.am b/hw/dmx/Makefile.am deleted file mode 100644 index fac1f1060..000000000 --- a/hw/dmx/Makefile.am +++ /dev/null @@ -1,87 +0,0 @@ - -SUBDIRS = input config examples doc doxygen man -bin_PROGRAMS = Xdmx - -if XINERAMA -PANORAMIX_SRCS = $(top_srcdir)/Xext/panoramiX.c -endif - -if GLX -SUBDIRS += glxProxy -GLX_LIBS = glxProxy/libglxproxy.a -GLX_SRCS = $(PANORAMIX_SRCS) dmx_glxvisuals.c dmx_glxvisuals.h -GLX_INCS = -I$(top_srcdir)/hw/xfree86/dixmods/extmod -GLX_DEFS = @GL_CFLAGS@ -endif - -AM_CFLAGS = \ - -DHAVE_DMX_CONFIG_H \ - $(DIX_CFLAGS) \ - $(GLX_INCS) \ - $(GLX_DEFS) \ - $(DMX_CFLAGS) \ - @DMXMODULES_CFLAGS@ - -Xdmx_SOURCES = dmx.c \ - dmxcb.c \ - dmxcb.h \ - dmxclient.h \ - dmxcmap.c \ - dmxcmap.h \ - dmx-config.h \ - dmxcursor.c \ - dmxcursor.h \ - dmxdpms.c \ - dmxdpms.h \ - dmxextension.c \ - dmxextension.h \ - dmxfont.c \ - dmxfont.h \ - dmxgc.c \ - dmxgc.h \ - dmxgcops.c \ - dmxgcops.h \ - dmx.h \ - dmxinit.c \ - dmxinit.h \ - dmxinput.c \ - dmxinput.h \ - dmxlog.c \ - dmxlog.h \ - dmxpict.c \ - dmxpict.h \ - dmxpixmap.c \ - dmxpixmap.h \ - dmxprop.c \ - dmxprop.h \ - dmxscrinit.c \ - dmxscrinit.h \ - dmxstat.c \ - dmxstat.h \ - dmxsync.c \ - dmxsync.h \ - dmxvisual.c \ - dmxvisual.h \ - dmxwindow.c \ - dmxwindow.h \ - $(top_srcdir)/mi/miinitext.c \ - $(top_srcdir)/mi/miinitext.h \ - $(GLX_SRCS) - - -#if COMPOSITE -#Xdmx_SOURCES += fakecw.c -#endif - -XDMX_LIBS = \ - $(GLX_LIBS) \ - @XDMX_LIBS@ \ - input/libdmxinput.a \ - config/libdmxconfig.a - -Xdmx_LDFLAGS = $(LD_EXPORT_SYMBOLS_FLAG) -Xdmx_DEPENDENCIES= $(XDMX_LIBS) -Xdmx_LDADD = $(XDMX_LIBS) $(XDMX_SYS_LIBS) $(XSERVER_SYS_LIBS) - -relink: - $(AM_V_at)rm -f Xdmx$(EXEEXT) && $(MAKE) Xdmx$(EXEEXT) diff --git a/hw/dmx/config/.gitignore b/hw/dmx/config/.gitignore deleted file mode 100644 index b74975302..000000000 --- a/hw/dmx/config/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -# Add & Override for this directory and its subdirectories -dmxtodmx -parser.c -parser.h -scanner.c -vdltodmx -xdmxconfig diff --git a/hw/dmx/config/Canvas.c b/hw/dmx/config/Canvas.c deleted file mode 100644 index 3662fe857..000000000 --- a/hw/dmx/config/Canvas.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright 1987, 1998 The Open Group - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of The Open Group shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from The Open Group. - */ - -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - * This file was originally taken from xc/lib/Xaw/Template.c - */ - -#include <X11/IntrinsicP.h> -#include <X11/StringDefs.h> -#include "CanvasP.h" - -static void -CanvasInitialize(Widget request, Widget w, ArgList args, Cardinal * num_args) -{ -} - -static void -CanvasExpose(Widget w, XEvent * event, Region region) -{ - CanvasExposeDataRec data; - - data.w = w; - data.event = event; - data.region = region; - - if (!XtIsRealized(w)) - return; - XtCallCallbacks(w, XtNcanvasExposeCallback, (XtPointer) &data); -} - -static void -CanvasResize(Widget w) -{ - if (!XtIsRealized(w)) - return; - XtCallCallbacks(w, XtNcanvasResizeCallback, (XtPointer) w); -} - -static void -CanvasAction(Widget w, XEvent * event, String * params, Cardinal * num_params) -{ - XtCallCallbacks(w, XtNcallback, (XtPointer) event); -} - -#define offset(field) XtOffsetOf(CanvasRec, canvas.field) -static XtResource resources[] = { - {XtNcallback, XtCCallback, XtRCallback, - sizeof(XtCallbackList), offset(input_callback), XtRCallback, NULL} - , - {(char *) XtNcanvasExposeCallback, (char *) XtCcanvasExposeCallback, XtRCallback, - sizeof(XtCallbackList), offset(expose_callback), XtRCallback, NULL} - , - {(char *) XtNcanvasResizeCallback, (char *) XtCcanvasResizeCallback, XtRCallback, - sizeof(XtCallbackList), offset(resize_callback), XtRCallback, NULL} - , -}; - -#undef offset - -static XtActionsRec actions[] = { - {(char *) "canvas", CanvasAction}, -}; - -static char translations[] = "<Key>: canvas()\n\ -<Motion>: canvas()\n\ -<BtnDown>: canvas()\n\ -<BtnUp>: canvas()\n\ -"; - -#define Superclass (&widgetClassRec) -CanvasClassRec canvasClassRec = { - /* core */ - { - (WidgetClass) Superclass, /* superclass */ - (char *) "Canvas", /* class_name */ - sizeof(CanvasRec), /* widget_size */ - NULL, /* class_initialize */ - NULL, /* class_part_initialize */ - False, /* class_inited */ - CanvasInitialize, /* initialize */ - NULL, /* initialize_hook */ - XtInheritRealize, /* realize */ - actions, /* actions */ - XtNumber(actions), /* num_actions */ - resources, /* resources */ - XtNumber(resources), /* num_resources */ - NULLQUARK, /* xrm_class */ - True, /* compress_motion */ - True, /* compress_exposure */ - True, /* compress_enterleave */ - False, /* visible_interest */ - NULL, /* destroy */ - CanvasResize, /* resize */ - CanvasExpose, /* expose */ - NULL, /* set_values */ - NULL, /* set_values_hook */ - XtInheritSetValuesAlmost, /* set_values_almost */ - NULL, /* get_values_hook */ - NULL, /* accept_focus */ - XtVersion, /* version */ - NULL, /* callback_private */ - translations, /* tm_table */ - XtInheritQueryGeometry, /* query_geometry */ - XtInheritDisplayAccelerator, /* display_accelerator */ - NULL, /* extension */ - } - , - /* canvas */ - { - NULL, /* extension */ - } -}; - -WidgetClass canvasWidgetClass = (WidgetClass) &canvasClassRec; diff --git a/hw/dmx/config/Canvas.h b/hw/dmx/config/Canvas.h deleted file mode 100644 index d516faf93..000000000 --- a/hw/dmx/config/Canvas.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group -Copyright 2002 Red Hat Inc., Durham, North Carolina. - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - * This file was originally taken from xc/lib/Xaw/Template.h - */ - -#ifndef _Canvas_h -#define _Canvas_h - -#include <X11/Intrinsic.h> - -#define XtNcanvasExposeCallback "canvasExposeCallback" -#define XtCcanvasExposeCallback "CanvasExposeCallback" -#define XtNcanvasResizeCallback "canvasResizeCallback" -#define XtCcanvasResizeCallback "CanvasResizeCallback" - -typedef struct _CanvasClassRec *CanvasWidgetClass; -typedef struct _CanvasRec *CanvasWidget; -extern WidgetClass canvasWidgetClass; - -typedef struct _CanvasExposeDataRec { - Widget w; - XEvent *event; - Region region; -} CanvasExposeDataRec, *CanvasExposeDataPtr; - -#endif /* _Canvas_h */ diff --git a/hw/dmx/config/CanvasP.h b/hw/dmx/config/CanvasP.h deleted file mode 100644 index b1ccf2497..000000000 --- a/hw/dmx/config/CanvasP.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group -Copyright 2002 Red Hat Inc., Durham, North Carolina. - -Permission to use, copy, modify, distribute, and sell this software and its -documentation for any purpose is hereby granted without fee, provided that -the above copyright notice appear in all copies and that both that -copyright notice and this permission notice appear in supporting -documentation. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - * This file was originally taken from xc/lib/Xaw/TemplateP.h - */ - -#ifndef _CanvasP_h -#define _CanvasP_h - -#include "Canvas.h" - -/* include superclass private header file */ -#include <X11/CoreP.h> - -typedef struct { - XtPointer extension; -} CanvasClassPart; - -typedef struct _CanvasClassRec { - CoreClassPart core_class; - CanvasClassPart canvas_class; -} CanvasClassRec; - -extern CanvasClassRec canvasClassRec; - -typedef struct { - XtCallbackList input_callback; - XtCallbackList expose_callback; - XtCallbackList resize_callback; -} CanvasPart; - -typedef struct _CanvasRec { - CorePart core; - CanvasPart canvas; -} CanvasRec; - -#endif /* _CanvasP_h */ diff --git a/hw/dmx/config/Makefile.am b/hw/dmx/config/Makefile.am deleted file mode 100644 index 97c309d3b..000000000 --- a/hw/dmx/config/Makefile.am +++ /dev/null @@ -1,68 +0,0 @@ -SUBDIRS = man - -noinst_LIBRARIES = libdmxconfig.a - -LIBSRCS = parser.y \ - scanner.l \ - dmxparse.c \ - dmxparse.h \ - dmxprint.c \ - dmxprint.h \ - dmxcompat.c \ - dmxcompat.h \ - dmxconfig.c \ - dmxconfig.h - -parser.h: parser.c -scanner.c: scanner.l parser.h - -BUILT_SOURCES = parser.c parser.h scanner.c - -MAINTAINERCLEANFILES = $(BUILT_SOURCES) - -libdmxconfig_a_SOURCES = $(LIBSRCS) -libdmxconfig_a_SOURCES += $(top_srcdir)/os/strlcpy.c - -if GLX -GLX_DEFS = @GL_CFLAGS@ -endif - -AM_YFLAGS = -d -AM_CFLAGS = \ - $(DIX_CFLAGS) \ - -I$(top_srcdir)/hw/dmx \ - -DHAVE_DMX_CONFIG_H \ - -DDMX_LOG_STANDALONE \ - $(GLX_DEFS) \ - @DMXMODULES_CFLAGS@ - -bin_PROGRAMS = xdmxconfig vdltodmx dmxtodmx - -xdmxconfig_SOURCES = \ - xdmxconfig.c \ - $(top_srcdir)/hw/dmx/dmxlog.c \ - Canvas.c \ - Canvas.h \ - CanvasP.h -xdmxconfig_LDADD = libdmxconfig.a @XDMXCONFIG_DEP_LIBS@ -xdmxconfig_CFLAGS = $(AM_CFLAGS) @XDMXCONFIG_DEP_CFLAGS@ - -vdltodmx_SOURCES = vdltodmx.c -vdltodmx_LDADD = libdmxconfig.a - -dmxtodmx_SOURCES = dmxtodmx.c -dmxtodmx_LDADD = libdmxconfig.a - -EXTRA_DIST = \ - test-a.in test-a.out \ - test-b.in test-b.out \ - test-c.in test-c.out \ - test-d.in test-d.out \ - test-e.in test-e.out \ - test-f.in test-f.out \ - test-g.in test-g.out \ - test-h.in test-h.out \ - test-i.in test-i.out \ - test-j.in test-j.out \ - test-k.in test-k.out \ - test-l.in test-l.out diff --git a/hw/dmx/config/TODO b/hw/dmx/config/TODO deleted file mode 100644 index 2998ff4a0..000000000 --- a/hw/dmx/config/TODO +++ /dev/null @@ -1,7 +0,0 @@ -Fri May 31 13:20:17 2002 - -1) Sanitize values from input boxes. - -2) Add canvas colors to cavas widget resources or to command-line options. - -3) Add ability to edit option line(s) and wall. diff --git a/hw/dmx/config/dmxcompat.c b/hw/dmx/config/dmxcompat.c deleted file mode 100644 index 6d31b5300..000000000 --- a/hw/dmx/config/dmxcompat.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * This file provides some compatibility support for reading VDL files - * that are used by xmovie - * (http://www.llnl.gov/icc/sdd/img/xmovie/xmovie.shtml). - * - * This file is not used by the DMX server. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "os.h" -#include "dmxconfig.h" -#include "dmxparse.h" -#include "dmxcompat.h" -#include "parser.h" -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> - -static int -dmxVDLReadLine(FILE * str, char *buf, int len) -{ - if (fgets(buf, len, str)) - return strlen(buf); - return 0; -} - -static int -dmxVDLCount(const char *buf) -{ - return strtol(buf, NULL, 10); -} - -static void -dmxVDLVirtualEntry(const char *buf, char *name, int *len, int *x, int *y) -{ - char *end; - const char *s; - char *d; - int start; - - *x = strtol(buf, &end, 10); - *y = strtol(end, &end, 10); - - for (s = end, d = name, start = 1; *s && *s != '['; ++s) { - if (start && isspace(*s)) - continue; - *d++ = *s; - start = 0; - } - *d = '\0'; - while (d > name && isspace(d[-1])) - *--d = '\0'; /* remove trailing space */ - *len = strlen(name); -} - -static void -dmxVDLDisplayEntry(const char *buf, - char *name, int *len, - int *x, int *y, int *xoff, int *yoff, int *xorig, int *yorig) -{ - const char *pt; - char *end; - - pt = strchr(buf, ' '); - strlcpy(name, buf, 1 + pt - buf); - *len = strlen(name); - - *x = strtol(pt, &end, 10); - *y = strtol(end, &end, 10); - *xorig = strtol(end, &end, 10); - *yorig = strtol(end, &end, 10); - *xoff = strtol(end, &end, 10); - *yoff = strtol(end, NULL, 10); -} - -/** Read from the VDL format \a filename and return a newly allocated \a - * DMXConfigEntryPtr */ -DMXConfigEntryPtr -dmxVDLRead(const char *filename) -{ - FILE *str; - char buf[2048]; /* RATS: Use ok */ - char *pt; - int lineno = 0; - DMXConfigEntryPtr entry = NULL; - DMXConfigVirtualPtr virtual = NULL; - DMXConfigSubPtr sub = NULL; - DMXConfigDisplayPtr display = NULL; - DMXConfigFullDimPtr fdim = NULL; - int dcount = 0; - int icount = 0; - int x, y, xoff, yoff, xorig, yorig; - char name[2048]; /* RATS: Use ok */ - const char *tmp; - int len; - enum { - simulateFlag, - virtualCount, - virtualEntry, - displayCount, - displayEntry, - ignoreCount, - ignoreEntry - } state = simulateFlag; - - if (!filename) - str = stdin; - else - str = fopen(filename, "r"); - if (!str) - return NULL; - - while (dmxVDLReadLine(str, buf, sizeof(buf))) { - DMXConfigCommentPtr comment = NULL; - - ++lineno; - for (pt = buf; *pt; pt++) - if (*pt == '\r' || *pt == '\n') { - *pt = '\0'; - break; - } - if (buf[0] == '#') { - tmp = dmxConfigCopyString(buf + 1, strlen(buf + 1)); - comment = dmxConfigCreateComment(T_COMMENT, lineno, tmp); - entry = dmxConfigAddEntry(entry, dmxConfigComment, comment, NULL); - continue; - } - switch (state) { - case simulateFlag: - state = virtualCount; - break; - case virtualCount: - state = virtualEntry; - break; - case virtualEntry: - len = sizeof(name); - dmxVDLVirtualEntry(buf, name, &len, &x, &y); - tmp = dmxConfigCopyString(name, len); - virtual = dmxConfigCreateVirtual(NULL, - dmxConfigCreateString(T_STRING, - lineno, - NULL, - tmp), - dmxConfigCreatePair(T_DIMENSION, - lineno, - NULL, - x, y, 0, 0), - NULL, NULL, NULL); - state = displayCount; - break; - case displayCount: - dcount = dmxVDLCount(buf); - state = displayEntry; - break; - case displayEntry: - dmxVDLDisplayEntry(buf, name, &len, &x, &y, &xoff, &yoff, - &xorig, &yorig); - tmp = dmxConfigCopyString(name, len); - fdim = - dmxConfigCreateFullDim(dmxConfigCreatePartDim - (dmxConfigCreatePair - (T_DIMENSION, lineno, NULL, x, y, 0, 0), - dmxConfigCreatePair(T_OFFSET, lineno, - NULL, xoff, yoff, - xoff, yoff)), NULL); - display = - dmxConfigCreateDisplay(NULL, - dmxConfigCreateString(T_STRING, lineno, - NULL, tmp), fdim, - dmxConfigCreatePair(T_ORIGIN, lineno, - NULL, xorig, yorig, - 0, 0), NULL); - sub = dmxConfigAddSub(sub, dmxConfigSubDisplay(display)); - if (!--dcount) { - state = ignoreCount; - virtual->subentry = sub; - entry = dmxConfigAddEntry(entry, - dmxConfigVirtual, NULL, virtual); - virtual = NULL; - sub = NULL; - } - break; - case ignoreCount: - icount = dmxVDLCount(buf); - state = ignoreEntry; - break; - case ignoreEntry: - if (!--icount) - state = virtualEntry; - break; - } - } - - if (str != stdin) - fclose(str); - - return entry; -} diff --git a/hw/dmx/config/dmxcompat.h b/hw/dmx/config/dmxcompat.h deleted file mode 100644 index 718892040..000000000 --- a/hw/dmx/config/dmxcompat.h +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to VDL compatibility support. \see dmxcompat.c - * - * This file is not used by the DMX server. - */ - -#ifndef _DMXCOMPAT_H_ -#define _DMXCOMPAT_H_ - -extern DMXConfigEntryPtr dmxVDLRead(const char *filename); -#endif diff --git a/hw/dmx/config/dmxconfig.c b/hw/dmx/config/dmxconfig.c deleted file mode 100644 index 3b9475046..000000000 --- a/hw/dmx/config/dmxconfig.c +++ /dev/null @@ -1,560 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provides interface for reading DMX configuration files and for - * combining that information with command-line configuration parameters. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxinput.h" -#include "dmxconfig.h" -#include "dmxparse.h" -#include "dmxlog.h" -#include "dmxcb.h" -#include "dmxstat.h" -#include "parser.h" - -extern int yydebug; -extern FILE *yyin; - -static char *dmxXkbRules; -static char *dmxXkbModel; -static char *dmxXkbLayout; -static char *dmxXkbVariant; -static char *dmxXkbOptions; - -/** Stores lists of configuration information. */ -typedef struct DMXConfigListStruct { - const char *name; - struct DMXConfigListStruct *next; -} DMXConfigList, *DMXConfigListPtr; - -/** This structure stores the parsed configuration information. */ -typedef struct DMXConfigCmdStruct { - const char *filename; - const char *config; - DMXConfigList *displays; - DMXConfigList *inputs; - DMXConfigList *xinputs; -} DMXConfigCmd, *DMXConfigCmdPtr; - -static DMXConfigCmd dmxConfigCmd; - -static int dmxDisplaysFromCommandLine; - -/** Make a note that \a display is the name of an X11 display that - * should be initialized as a backend (output) display. Called from - * #ddxProcessArgument. */ -void -dmxConfigStoreDisplay(const char *display) -{ - DMXConfigListPtr entry = malloc(sizeof(*entry)); - - entry->name = strdup(display); - entry->next = NULL; - if (!dmxConfigCmd.displays) - dmxConfigCmd.displays = entry; - else { - DMXConfigList *pt; - - for (pt = dmxConfigCmd.displays; pt->next; pt = pt->next); - if (!pt) - dmxLog(dmxFatal, "dmxConfigStoreDisplay: end of list non-NULL\n"); - pt->next = entry; - } - ++dmxDisplaysFromCommandLine; -} - -/** Make a note that \a input is the name of an X11 display that should - * be used for input (either a backend or a console input device). */ -void -dmxConfigStoreInput(const char *input) -{ - DMXConfigListPtr entry = malloc(sizeof(*entry)); - - entry->name = strdup(input); - entry->next = NULL; - if (!dmxConfigCmd.inputs) - dmxConfigCmd.inputs = entry; - else { - DMXConfigList *pt; - - for (pt = dmxConfigCmd.inputs; pt->next; pt = pt->next); - if (!pt) - dmxLog(dmxFatal, "dmxConfigStoreInput: end of list non-NULL\n"); - pt->next = entry; - } -} - -/** Make a note that \a input is the name of an X11 display that should - * be used for input from XInput extension devices. */ -void -dmxConfigStoreXInput(const char *input) -{ - DMXConfigListPtr entry = malloc(sizeof(*entry)); - - entry->name = strdup(input); - entry->next = NULL; - if (!dmxConfigCmd.xinputs) - dmxConfigCmd.xinputs = entry; - else { - DMXConfigList *pt; - - for (pt = dmxConfigCmd.xinputs; pt->next; pt = pt->next); - if (!pt) - dmxLog(dmxFatal, "dmxConfigStoreXInput: end of list non-NULL\n"); - pt->next = entry; - } -} - -/** Make a note that \a file is the configuration file. */ -void -dmxConfigStoreFile(const char *file) -{ - if (dmxConfigCmd.filename) - dmxLog(dmxFatal, "Only one -configfile allowed\n"); - dmxConfigCmd.filename = strdup(file); -} - -/** Make a note that \a config should be used as the configuration for - * current instantiation of the DMX server. */ -void -dmxConfigStoreConfig(const char *config) -{ - if (dmxConfigCmd.config) - dmxLog(dmxFatal, "Only one -config allowed\n"); - dmxConfigCmd.config = strdup(config); -} - -static int -dmxConfigReadFile(const char *filename, int debug) -{ - FILE *str; - - if (!(str = fopen(filename, "r"))) - return -1; - dmxLog(dmxInfo, "Reading configuration file \"%s\"\n", filename); - yyin = str; - yydebug = debug; - yyparse(); - fclose(str); - return 0; -} - -static const char * -dmxConfigMatch(const char *target, DMXConfigEntryPtr entry) -{ - DMXConfigVirtualPtr v = entry->virtual; - const char *name = NULL; - - if (v && v->name) - name = v->name; - - if (v && !dmxConfigCmd.config) - return v->name ? v->name : "<noname>"; - if (!name) - return NULL; - if (!strcmp(name, target)) - return name; - return NULL; -} - -static DMXScreenInfo * -dmxConfigAddDisplay(const char *name, - int scrnWidth, int scrnHeight, - int scrnX, int scrnY, - int scrnXSign, int scrnYSign, - int rootWidth, int rootHeight, - int rootX, int rootY, int rootXSign, int rootYSign) -{ - DMXScreenInfo *dmxScreen; - - if (!(dmxScreens = reallocarray(dmxScreens, dmxNumScreens + 1, - sizeof(*dmxScreens)))) - dmxLog(dmxFatal, - "dmxConfigAddDisplay: realloc failed for screen %d (%s)\n", - dmxNumScreens, name); - - dmxScreen = &dmxScreens[dmxNumScreens]; - memset(dmxScreen, 0, sizeof(*dmxScreen)); - dmxScreen->name = name; - dmxScreen->index = dmxNumScreens; - dmxScreen->scrnWidth = scrnWidth; - dmxScreen->scrnHeight = scrnHeight; - dmxScreen->scrnX = scrnX; - dmxScreen->scrnY = scrnY; - dmxScreen->scrnXSign = scrnXSign; - dmxScreen->scrnYSign = scrnYSign; - dmxScreen->rootWidth = rootWidth; - dmxScreen->rootHeight = rootHeight; - dmxScreen->rootX = rootX; - dmxScreen->rootY = rootY; - dmxScreen->stat = dmxStatAlloc(); - ++dmxNumScreens; - return dmxScreen; -} - -DMXInputInfo * -dmxConfigAddInput(const char *name, int core) -{ - DMXInputInfo *dmxInput; - - if (!(dmxInputs = reallocarray(dmxInputs, dmxNumInputs + 1, - sizeof(*dmxInputs)))) - dmxLog(dmxFatal, - "dmxConfigAddInput: realloc failed for input %d (%s)\n", - dmxNumInputs, name); - - dmxInput = &dmxInputs[dmxNumInputs]; - - memset(dmxInput, 0, sizeof(*dmxInput)); - dmxInput->name = name; - dmxInput->inputIdx = dmxNumInputs; - dmxInput->scrnIdx = -1; - dmxInput->core = core; - ++dmxNumInputs; - return dmxInput; -} - -static void -dmxConfigCopyFromDisplay(DMXConfigDisplayPtr d) -{ - DMXScreenInfo *dmxScreen; - - dmxScreen = dmxConfigAddDisplay(d->name, - d->scrnWidth, d->scrnHeight, - d->scrnX, d->scrnY, - d->scrnXSign, d->scrnYSign, - d->rootWidth, d->rootHeight, - d->rootX, d->rootY, - d->rootXSign, d->rootXSign); - dmxScreen->where = PosAbsolute; - dmxScreen->whereX = d->rootXOrigin; - dmxScreen->whereY = d->rootYOrigin; -} - -static void -dmxConfigCopyFromWall(DMXConfigWallPtr w) -{ - DMXConfigStringPtr pt; - DMXScreenInfo *dmxScreen; - int edge = dmxNumScreens; - int last = dmxNumScreens; - - if (!w->xwall && !w->ywall) { /* Try to make it square */ - int count; - - for (pt = w->nameList, count = 0; pt; pt = pt->next) - ++count; - w->xwall = sqrt(count) + .5; - } - - for (pt = w->nameList; pt; pt = pt->next) { - dmxScreen = dmxConfigAddDisplay(pt->string, w->width, w->height, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - if (pt == w->nameList) { /* Upper left */ - dmxScreen->where = PosAbsolute; - dmxScreen->whereX = 0; - dmxScreen->whereY = 0; - } - else if (w->xwall) { /* Tile left to right, then top to bottom */ - if (!((dmxNumScreens - 1) % w->xwall)) { - dmxScreen->where = PosBelow; - dmxScreen->whereRefScreen = edge; - edge = dmxNumScreens - 1; - } - else { - dmxScreen->where = PosRightOf; - dmxScreen->whereRefScreen = last; - } - } - else { /* Tile top to bottom, then left to right */ - if (!((dmxNumScreens - 1) % w->ywall)) { - dmxScreen->where = PosRightOf; - dmxScreen->whereRefScreen = edge; - edge = dmxNumScreens - 1; - } - else { - dmxScreen->where = PosBelow; - dmxScreen->whereRefScreen = last; - } - - } - last = dmxNumScreens - 1; - if (dmxScreen->where == PosAbsolute) - dmxLog(dmxInfo, "Added %s at %d %d\n", - pt->string, dmxScreen->whereX, dmxScreen->whereY); - else - dmxLog(dmxInfo, "Added %s %s %s\n", - pt->string, - dmxScreen->where == PosBelow ? "below" : "right of", - dmxScreens[dmxScreen->whereRefScreen].name); - } -} - -static void -dmxConfigCopyFromOption(DMXConfigOptionPtr o) -{ - DMXConfigStringPtr pt; - int argc = 0; - char **argv = NULL; - - if (serverGeneration != 1) - return; /* FIXME: only do once, for now */ - if (!o || !o->string) - return; - for (pt = o->option; pt; pt = pt->next) { - if (pt->string) { - ++argc; - argv = reallocarray(argv, argc + 1, sizeof(*argv)); - argv[argc] = (char *) pt->string; - } - } - argv[0] = NULL; - ProcessCommandLine(argc + 1, argv); - free(argv); -} - -static void -dmxConfigCopyFromParam(DMXConfigParamPtr p) -{ - const char **argv; - int argc; - - if ((argv = dmxConfigLookupParam(p, "xkbrules", &argc)) && argc == 2) { - dmxConfigSetXkbRules(argv[1]); - } - else if ((argv = dmxConfigLookupParam(p, "xkbmodel", &argc)) - && argc == 2) { - dmxConfigSetXkbModel(argv[1]); - } - else if ((argv = dmxConfigLookupParam(p, "xkblayout", &argc)) - && argc == 2) { - dmxConfigSetXkbLayout(argv[1]); - } - else if ((argv = dmxConfigLookupParam(p, "xkbvariant", &argc)) - && argc == 2) { - dmxConfigSetXkbVariant(argv[1]); - } - else if ((argv = dmxConfigLookupParam(p, "xkboptions", &argc)) - && argc == 2) { - dmxConfigSetXkbOptions(argv[1]); - } -} - -static void -dmxConfigCopyData(DMXConfigVirtualPtr v) -{ - DMXConfigSubPtr sub; - - if (v->dim) - dmxSetWidthHeight(v->dim->x, v->dim->y); - else - dmxSetWidthHeight(0, 0); - for (sub = v->subentry; sub; sub = sub->next) { - switch (sub->type) { - case dmxConfigDisplay: - dmxConfigCopyFromDisplay(sub->display); - break; - case dmxConfigWall: - dmxConfigCopyFromWall(sub->wall); - break; - case dmxConfigOption: - dmxConfigCopyFromOption(sub->option); - break; - case dmxConfigParam: - dmxConfigCopyFromParam(sub->param); - break; - default: - dmxLog(dmxFatal, - "dmxConfigCopyData: not a display, wall, or value\n"); - } - } -} - -static void -dmxConfigFromCommandLine(void) -{ - DMXConfigListPtr pt; - - dmxLog(dmxInfo, "Using configuration from command line\n"); - for (pt = dmxConfigCmd.displays; pt; pt = pt->next) { - DMXScreenInfo *dmxScreen = dmxConfigAddDisplay(pt->name, - 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0); - - if (dmxNumScreens == 1) { - dmxScreen->where = PosAbsolute; - dmxScreen->whereX = 0; - dmxScreen->whereY = 0; - dmxLog(dmxInfo, "Added %s at %d %d\n", - dmxScreen->name, dmxScreen->whereX, dmxScreen->whereY); - } - else { - dmxScreen->where = PosRightOf; - dmxScreen->whereRefScreen = dmxNumScreens - 2; - if (dmxScreen->whereRefScreen < 0) - dmxScreen->whereRefScreen = 0; - dmxLog(dmxInfo, "Added %s %s %s\n", - dmxScreen->name, - dmxScreen->where == PosBelow ? "below" : "right of", - dmxScreens[dmxScreen->whereRefScreen].name); - } - } -} - -static void -dmxConfigFromConfigFile(void) -{ - DMXConfigEntryPtr pt; - const char *name; - - for (pt = dmxConfigEntry; pt; pt = pt->next) { - /* FIXME -- if an input is specified, use it */ - if (pt->type != dmxConfigVirtual) - continue; - if ((name = dmxConfigMatch(dmxConfigCmd.config, pt))) { - dmxLog(dmxInfo, "Using configuration \"%s\"\n", name); - dmxConfigCopyData(pt->virtual); - return; - } - } - dmxLog(dmxFatal, "Could not find configuration \"%s\" in \"%s\"\n", - dmxConfigCmd.config, dmxConfigCmd.filename); -} - -static void -dmxConfigConfigInputs(void) -{ - DMXConfigListPtr pt; - - if (dmxNumInputs) - return; - - if (dmxConfigCmd.inputs) { /* Use command line */ - for (pt = dmxConfigCmd.inputs; pt; pt = pt->next) - dmxConfigAddInput(pt->name, TRUE); - } - else if (dmxNumScreens) { /* Use first display */ - dmxConfigAddInput(dmxScreens[0].name, TRUE); - } - else { /* Use dummy */ - dmxConfigAddInput("dummy", TRUE); - } - - if (dmxConfigCmd.xinputs) { /* Non-core devices from command line */ - for (pt = dmxConfigCmd.xinputs; pt; pt = pt->next) - dmxConfigAddInput(pt->name, FALSE); - } -} - -/** Set up the appropriate global variables so that the DMX server will - * be initialized using the configuration specified in the config file - * and on the command line. */ -void -dmxConfigConfigure(void) -{ - if (dmxConfigEntry) { - dmxConfigFreeEntry(dmxConfigEntry); - dmxConfigEntry = NULL; - } - if (dmxConfigCmd.filename) { - if (dmxConfigCmd.displays) - dmxLog(dmxWarning, - "Using configuration file \"%s\" instead of command line\n", - dmxConfigCmd.filename); - dmxConfigReadFile(dmxConfigCmd.filename, 0); - dmxConfigFromConfigFile(); - } - else { - if (dmxConfigCmd.config) - dmxLog(dmxWarning, - "Configuration name (%s) without configuration file\n", - dmxConfigCmd.config); - dmxConfigFromCommandLine(); - } - dmxConfigConfigInputs(); -} - -/** This function determines the number of displays we WILL have and - * sets MAXSCREENS to that value. This is difficult since the number - * depends on the command line (which is easy to count) or on the config - * file, which has to be parsed. */ -void -dmxConfigSetMaxScreens(void) -{ - static int processing = 0; - - if (processing) - return; /* Prevent reentry via ProcessCommandLine */ - processing = 1; - if (dmxConfigCmd.filename) { - if (!dmxNumScreens) - dmxConfigConfigure(); -#ifndef MAXSCREENS - SetMaxScreens(dmxNumScreens); -#endif - } - else -#ifndef MAXSCREENS - SetMaxScreens(dmxDisplaysFromCommandLine); -#endif - processing = 0; -} - -/** This macro is used to generate the following access methods: - * - dmxConfig{Set,Get}rules - * - dmxConfig{Set,Get}model - * - dmxConfig{Set,Get}layout - * - dmxConfig{Set,Get}variant - * - dmxConfig{Set,Get}options - * These methods are used to read and write information about the keyboard. */ - -#define GEN(param,glob,def) \ - void dmxConfigSet##glob(const char *param) { \ - if (dmx##glob) free((void *)dmx##glob); \ - dmx##glob = strdup(param); \ - } \ - char *dmxConfigGet##glob(void) { \ - return (char *)(dmx##glob ? dmx##glob : def); \ - } - -GEN(rules, XkbRules, XKB_DFLT_RULES) - GEN(model, XkbModel, XKB_DFLT_MODEL) - GEN(layout, XkbLayout, XKB_DFLT_LAYOUT) - GEN(variant, XkbVariant, XKB_DFLT_VARIANT) - GEN(options, XkbOptions, XKB_DFLT_OPTIONS) diff --git a/hw/dmx/config/dmxconfig.h b/hw/dmx/config/dmxconfig.h deleted file mode 100644 index deb293cc0..000000000 --- a/hw/dmx/config/dmxconfig.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for DMX configuration file support. \see dmxconfig.c */ - -#ifndef _DMXCONFIG_H_ -#define _DMXCONFIG_H_ - -#include <xkb-config.h> - -extern void dmxConfigStoreDisplay(const char *display); -extern void dmxConfigStoreInput(const char *input); /* Core devices */ -extern void dmxConfigStoreXInput(const char *input); /* Non-core devices */ -extern void dmxConfigStoreFile(const char *file); -extern void dmxConfigStoreConfig(const char *config); -extern void dmxConfigConfigure(void); -extern void dmxConfigSetMaxScreens(void); - -extern void dmxConfigSetXkbRules(const char *rules); -extern void dmxConfigSetXkbModel(const char *model); -extern void dmxConfigSetXkbLayout(const char *layout); -extern void dmxConfigSetXkbVariant(const char *variant); -extern void dmxConfigSetXkbOptions(const char *options); - -extern char *dmxConfigGetXkbRules(void); -extern char *dmxConfigGetXkbModel(void); -extern char *dmxConfigGetXkbLayout(void); -extern char *dmxConfigGetXkbVariant(void); -extern char *dmxConfigGetXkbOptions(void); -#endif diff --git a/hw/dmx/config/dmxparse.c b/hw/dmx/config/dmxparse.c deleted file mode 100644 index f66143a6a..000000000 --- a/hw/dmx/config/dmxparse.c +++ /dev/null @@ -1,688 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This file provides support routines and helper functions to be used - * by the DMX configuration file parser. - * - * Because the DMX configuration file parsing should be capable of being - * used in a stand-alone fashion (i.e., independent from the DMX server - * source tree), no dependencies on other DMX routines are made. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <stdarg.h> -#include "dmxparse.h" - -/** A general error logging routine that does not depend on the dmxLog - * functions. */ -void -dmxConfigLog(const char *format, ...) -{ - va_list args; - - va_start(args, format); - vprintf(format, args); /* RATS: All calls to dmxConfigLog from - * dmxparse.c and dmxprint.c use a - * trusted format. */ - va_end(args); -} - -void * -dmxConfigAlloc(unsigned long bytes) -{ - void *area = calloc(1, bytes); - - if (!area) { - dmxConfigLog("dmxConfigAlloc: out of memory\n"); - return NULL; - } - return area; -} - -void * -dmxConfigRealloc(void *orig, unsigned long orig_bytes, unsigned long bytes) -{ - unsigned char *area = realloc(orig, bytes); - - if (!area) { - dmxConfigLog("dmxConfigRealloc: out of memory\n"); - return NULL; - } - memset(area + orig_bytes, 0, bytes - orig_bytes); - return area; -} - -const char * -dmxConfigCopyString(const char *string, int length) -{ - char *copy; - - if (!length) - length = strlen(string); - copy = dmxConfigAlloc(length + 1); - if (length) - strncpy(copy, string, length); - copy[length] = '\0'; - return copy; -} - -void -dmxConfigFree(void *area) -{ - free(area); -} - -DMXConfigTokenPtr -dmxConfigCreateToken(int token, int line, const char *comment) -{ - DMXConfigTokenPtr pToken = dmxConfigAlloc(sizeof(*pToken)); - - pToken->token = token; - pToken->line = line; - pToken->comment = comment; - return pToken; -} - -void -dmxConfigFreeToken(DMXConfigTokenPtr p) -{ - if (!p) - return; - dmxConfigFree((void *) p->comment); - dmxConfigFree(p); -} - -DMXConfigStringPtr -dmxConfigCreateString(int token, int line, - const char *comment, const char *string) -{ - DMXConfigStringPtr pString = dmxConfigAlloc(sizeof(*pString)); - - pString->token = token; - pString->line = line; - pString->comment = comment; - pString->string = string; - return pString; -} - -void -dmxConfigFreeString(DMXConfigStringPtr p) -{ - DMXConfigStringPtr next; - - if (!p) - return; - do { - next = p->next; - dmxConfigFree((void *) p->comment); - dmxConfigFree((void *) p->string); - dmxConfigFree(p); - } while ((p = next)); -} - -DMXConfigNumberPtr -dmxConfigCreateNumber(int token, int line, const char *comment, int number) -{ - DMXConfigNumberPtr pNumber = dmxConfigAlloc(sizeof(*pNumber)); - - pNumber->token = token; - pNumber->line = line; - pNumber->comment = comment; - pNumber->number = number; - return pNumber; -} - -void -dmxConfigFreeNumber(DMXConfigNumberPtr p) -{ - if (!p) - return; - dmxConfigFree((void *) p->comment); - dmxConfigFree(p); -} - -DMXConfigPairPtr -dmxConfigCreatePair(int token, int line, - const char *comment, int x, int y, int xsign, int ysign) -{ - DMXConfigPairPtr pPair = dmxConfigAlloc(sizeof(*pPair)); - - pPair->token = token; - pPair->line = line; - pPair->comment = comment; - pPair->x = x; - pPair->y = y; - pPair->xsign = (xsign < 0) ? -1 : 1; - pPair->ysign = (ysign < 0) ? -1 : 1; - return pPair; -} - -void -dmxConfigFreePair(DMXConfigPairPtr p) -{ - if (!p) - return; - dmxConfigFree((void *) p->comment); - dmxConfigFree(p); -} - -DMXConfigCommentPtr -dmxConfigCreateComment(int token, int line, const char *comment) -{ - DMXConfigCommentPtr pComment = dmxConfigAlloc(sizeof(*pComment)); - - pComment->token = token; - pComment->line = line; - pComment->comment = comment; - return pComment; -} - -void -dmxConfigFreeComment(DMXConfigCommentPtr p) -{ - if (!p) - return; - dmxConfigFree((void *) p->comment); - dmxConfigFree(p); -} - -DMXConfigPartDimPtr -dmxConfigCreatePartDim(DMXConfigPairPtr pDim, DMXConfigPairPtr pOffset) -{ - DMXConfigPartDimPtr pPart = dmxConfigAlloc(sizeof(*pPart)); - - pPart->dim = pDim; - pPart->offset = pOffset; - return pPart; -} - -void -dmxConfigFreePartDim(DMXConfigPartDimPtr p) -{ - if (!p) - return; - dmxConfigFreePair(p->dim); - dmxConfigFreePair(p->offset); - dmxConfigFree(p); -} - -DMXConfigFullDimPtr -dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, DMXConfigPartDimPtr pRoot) -{ - DMXConfigFullDimPtr pFull = dmxConfigAlloc(sizeof(*pFull)); - - pFull->scrn = pScrn; - pFull->root = pRoot; - return pFull; -} - -void -dmxConfigFreeFullDim(DMXConfigFullDimPtr p) -{ - if (!p) - return; - dmxConfigFreePartDim(p->scrn); - dmxConfigFreePartDim(p->root); - dmxConfigFree(p); -} - -DMXConfigDisplayPtr -dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, - DMXConfigStringPtr pName, - DMXConfigFullDimPtr pDim, - DMXConfigPairPtr pOrigin, DMXConfigTokenPtr pEnd) -{ - DMXConfigDisplayPtr pDisplay = dmxConfigAlloc(sizeof(*pDisplay)); - - pDisplay->start = pStart; - pDisplay->dname = pName; - pDisplay->dim = pDim; - pDisplay->origin = pOrigin; - pDisplay->end = pEnd; - - pDisplay->name = pName ? pName->string : NULL; - pDisplay->rootXOrigin = pOrigin ? pOrigin->x : 0; - pDisplay->rootYOrigin = pOrigin ? pOrigin->y : 0; - - if (pDim && pDim->scrn && pDim->scrn->dim) { - pDisplay->scrnWidth = pDim->scrn->dim->x; - pDisplay->scrnHeight = pDim->scrn->dim->y; - } - if (pDim && pDim->scrn && pDim->scrn->offset) { - pDisplay->scrnX = pDim->scrn->offset->x; - pDisplay->scrnY = pDim->scrn->offset->y; - pDisplay->scrnXSign = pDim->scrn->offset->xsign; - pDisplay->scrnYSign = pDim->scrn->offset->ysign; - } - - if (pDim && pDim->root) { - if (pDim->root->dim) { - pDisplay->rootWidth = pDim->root->dim->x; - pDisplay->rootHeight = pDim->root->dim->y; - } - if (pDim->root->offset) { - pDisplay->rootX = pDim->root->offset->x; - pDisplay->rootY = pDim->root->offset->y; - pDisplay->rootXSign = pDim->root->offset->xsign; - pDisplay->rootYSign = pDim->root->offset->ysign; - } - } - else { /* If no root specification, copy width - * and height from scrn -- leave offset - * as zero, since it is relative to - * scrn. */ - pDisplay->rootWidth = pDisplay->scrnWidth; - pDisplay->rootHeight = pDisplay->scrnHeight; - } - - return pDisplay; -} - -void -dmxConfigFreeDisplay(DMXConfigDisplayPtr p) -{ - if (!p) - return; - dmxConfigFreeToken(p->start); - dmxConfigFreeString(p->dname); - dmxConfigFreeFullDim(p->dim); - dmxConfigFreeToken(p->end); - dmxConfigFree(p); -} - -DMXConfigWallPtr -dmxConfigCreateWall(DMXConfigTokenPtr pStart, - DMXConfigPairPtr pWallDim, - DMXConfigPairPtr pDisplayDim, - DMXConfigStringPtr pNameList, DMXConfigTokenPtr pEnd) -{ - DMXConfigWallPtr pWall = dmxConfigAlloc(sizeof(*pWall)); - - pWall->start = pStart; - pWall->wallDim = pWallDim; - pWall->displayDim = pDisplayDim; - pWall->nameList = pNameList; - pWall->end = pEnd; - - pWall->width = pDisplayDim ? pDisplayDim->x : 0; - pWall->height = pDisplayDim ? pDisplayDim->y : 0; - pWall->xwall = pWallDim ? pWallDim->x : 0; - pWall->ywall = pWallDim ? pWallDim->y : 0; - - return pWall; -} - -void -dmxConfigFreeWall(DMXConfigWallPtr p) -{ - if (!p) - return; - dmxConfigFreeToken(p->start); - dmxConfigFreePair(p->wallDim); - dmxConfigFreePair(p->displayDim); - dmxConfigFreeString(p->nameList); - dmxConfigFreeToken(p->end); - dmxConfigFree(p); -} - -DMXConfigOptionPtr -dmxConfigCreateOption(DMXConfigTokenPtr pStart, - DMXConfigStringPtr pOption, DMXConfigTokenPtr pEnd) -{ - int length = 0; - int offset = 0; - DMXConfigStringPtr p; - DMXConfigOptionPtr option = dmxConfigAlloc(sizeof(*option)); - - for (p = pOption; p; p = p->next) { - if (p->string) - length += strlen(p->string) + 1; - } - - option->string = dmxConfigAlloc(length + 1); - - for (p = pOption; p; p = p->next) { - if (p->string) { - int len = strlen(p->string); - - memcpy(option->string + offset, p->string, len); - offset += len; - if (p->next) - option->string[offset++] = ' '; - } - } - option->string[offset] = '\0'; - - option->start = pStart; - option->option = pOption; - option->end = pEnd; - - return option; -} - -void -dmxConfigFreeOption(DMXConfigOptionPtr p) -{ - if (!p) - return; - free(p->string); - dmxConfigFreeToken(p->start); - dmxConfigFreeString(p->option); - dmxConfigFreeToken(p->end); - dmxConfigFree(p); -} - -const char ** -dmxConfigLookupParam(DMXConfigParamPtr p, const char *key, int *argc) -{ - DMXConfigParamPtr pt; - - for (pt = p; pt; pt = pt->next) { - if (pt->argv && !strcasecmp(pt->argv[0], key)) { - *argc = pt->argc; - return pt->argv; - } - } - *argc = 0; - return NULL; -} - -DMXConfigParamPtr -dmxConfigCreateParam(DMXConfigTokenPtr pStart, - DMXConfigTokenPtr pOpen, - DMXConfigStringPtr pParam, - DMXConfigTokenPtr pClose, DMXConfigTokenPtr pEnd) -{ - DMXConfigParamPtr param = dmxConfigAlloc(sizeof(*param)); - DMXConfigStringPtr pt; - - param->argc = 0; - param->argv = NULL; - for (pt = pParam; pt; pt = pt->next) { - if (pt->string) { - param->argv = realloc(param->argv, - (param->argc + 2) * sizeof(*param->argv)); - param->argv[param->argc] = pt->string; - ++param->argc; - } - } - if (param->argv) - param->argv[param->argc] = NULL; - - param->start = pStart; - param->open = pOpen; - param->param = pParam; - param->close = pClose; - param->end = pEnd; - - return param; -} - -void -dmxConfigFreeParam(DMXConfigParamPtr p) -{ - DMXConfigParamPtr next; - - if (!p) - return; - do { - next = p->next; - dmxConfigFreeToken(p->start); - dmxConfigFreeToken(p->open); - dmxConfigFreeString(p->param); - dmxConfigFreeToken(p->close); - dmxConfigFreeToken(p->end); - dmxConfigFree(p->argv); - dmxConfigFree(p); - } while ((p = next)); -} - -DMXConfigSubPtr -dmxConfigCreateSub(DMXConfigType type, - DMXConfigCommentPtr comment, - DMXConfigDisplayPtr display, - DMXConfigWallPtr wall, - DMXConfigOptionPtr option, DMXConfigParamPtr param) -{ - DMXConfigSubPtr pSub = dmxConfigAlloc(sizeof(*pSub)); - - pSub->type = type; - switch (type) { - case dmxConfigComment: - pSub->comment = comment; - break; - case dmxConfigDisplay: - pSub->display = display; - break; - case dmxConfigWall: - pSub->wall = wall; - break; - case dmxConfigOption: - pSub->option = option; - break; - case dmxConfigParam: - pSub->param = param; - break; - default: - dmxConfigLog("Type %d not supported in subentry\n", type); - break; - } - return pSub; -} - -void -dmxConfigFreeSub(DMXConfigSubPtr sub) -{ - DMXConfigSubPtr pt; - - for (pt = sub; pt; pt = pt->next) { - switch (pt->type) { - case dmxConfigComment: - dmxConfigFreeComment(pt->comment); - break; - case dmxConfigDisplay: - dmxConfigFreeDisplay(pt->display); - break; - case dmxConfigWall: - dmxConfigFreeWall(pt->wall); - break; - case dmxConfigOption: - dmxConfigFreeOption(pt->option); - break; - case dmxConfigParam: - dmxConfigFreeParam(pt->param); - break; - default: - dmxConfigLog("Type %d not supported in subentry\n", pt->type); - break; - } - } - dmxConfigFree(sub); -} - -DMXConfigSubPtr -dmxConfigSubComment(DMXConfigCommentPtr comment) -{ - return dmxConfigCreateSub(dmxConfigComment, comment, NULL, NULL, NULL, - NULL); -} - -DMXConfigSubPtr -dmxConfigSubDisplay(DMXConfigDisplayPtr display) -{ - return dmxConfigCreateSub(dmxConfigDisplay, NULL, display, NULL, NULL, - NULL); -} - -DMXConfigSubPtr -dmxConfigSubWall(DMXConfigWallPtr wall) -{ - return dmxConfigCreateSub(dmxConfigWall, NULL, NULL, wall, NULL, NULL); -} - -DMXConfigSubPtr -dmxConfigSubOption(DMXConfigOptionPtr option) -{ - return dmxConfigCreateSub(dmxConfigOption, NULL, NULL, NULL, option, NULL); -} - -DMXConfigSubPtr -dmxConfigSubParam(DMXConfigParamPtr param) -{ - return dmxConfigCreateSub(dmxConfigParam, NULL, NULL, NULL, NULL, param); -} - -extern DMXConfigSubPtr -dmxConfigAddSub(DMXConfigSubPtr head, DMXConfigSubPtr sub) -{ - DMXConfigSubPtr pt; - - if (!head) - return sub; - for (pt = head; pt->next; pt = pt->next); - pt->next = sub; - return head; -} - -DMXConfigVirtualPtr -dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, - DMXConfigStringPtr pName, - DMXConfigPairPtr pDim, - DMXConfigTokenPtr pOpen, - DMXConfigSubPtr pSubentry, DMXConfigTokenPtr pClose) -{ - DMXConfigVirtualPtr pVirtual = dmxConfigAlloc(sizeof(*pVirtual)); - - pVirtual->start = pStart; - pVirtual->vname = pName; - pVirtual->dim = pDim; - pVirtual->open = pOpen; - pVirtual->subentry = pSubentry; - pVirtual->close = pClose; - - pVirtual->name = pName ? pName->string : NULL; - pVirtual->width = pDim ? pDim->x : 0; - pVirtual->height = pDim ? pDim->y : 0; - - return pVirtual; -} - -void -dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual) -{ - dmxConfigFreeToken(virtual->start); - dmxConfigFreeString(virtual->vname); - dmxConfigFreePair(virtual->dim); - dmxConfigFreeToken(virtual->open); - dmxConfigFreeSub(virtual->subentry); - dmxConfigFreeToken(virtual->close); - dmxConfigFree(virtual); -} - -DMXConfigEntryPtr -dmxConfigCreateEntry(DMXConfigType type, - DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual) -{ - DMXConfigEntryPtr pEntry = dmxConfigAlloc(sizeof(*pEntry)); - - pEntry->type = type; - switch (type) { - case dmxConfigComment: - pEntry->comment = comment; - break; - case dmxConfigVirtual: - pEntry->virtual = virtual; - break; - default: - dmxConfigLog("Type %d not supported in entry\n", type); - break; - } - return pEntry; -} - -void -dmxConfigFreeEntry(DMXConfigEntryPtr entry) -{ - DMXConfigEntryPtr pt; - - for (pt = entry; pt; pt = pt->next) { - switch (pt->type) { - case dmxConfigComment: - dmxConfigFreeComment(pt->comment); - break; - case dmxConfigVirtual: - dmxConfigFreeVirtual(pt->virtual); - break; - default: - dmxConfigLog("Type %d not supported in entry\n", pt->type); - break; - } - } - dmxConfigFree(entry); -} - -DMXConfigEntryPtr -dmxConfigAddEntry(DMXConfigEntryPtr head, - DMXConfigType type, - DMXConfigCommentPtr comment, DMXConfigVirtualPtr virtual) -{ - DMXConfigEntryPtr child = dmxConfigCreateEntry(type, comment, virtual); - DMXConfigEntryPtr pt; - - if (!head) - return child; - - for (pt = head; pt->next; pt = pt->next); - pt->next = child; - - return head; -} - -DMXConfigEntryPtr -dmxConfigEntryComment(DMXConfigCommentPtr comment) -{ - return dmxConfigCreateEntry(dmxConfigComment, comment, NULL); -} - -DMXConfigEntryPtr -dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual) -{ - return dmxConfigCreateEntry(dmxConfigVirtual, NULL, virtual); -} diff --git a/hw/dmx/config/dmxparse.h b/hw/dmx/config/dmxparse.h deleted file mode 100644 index 0a82e4ef0..000000000 --- a/hw/dmx/config/dmxparse.h +++ /dev/null @@ -1,291 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to DMX configuration file parser. \see dmxparse.c */ - -#ifndef _DMXPARSE_H_ -#define _DMXPARSE_H_ - -#include <stdio.h> /* For FILE */ -#include <X11/Xfuncproto.h> /* For _X_ATTRIBUTE_PRINTF */ - -/** Stores tokens not stored in other structures (e.g., keywords and ;) */ -typedef struct _DMXConfigToken { - int token; - int line; - const char *comment; -} DMXConfigToken, *DMXConfigTokenPtr; - -/** Stores parsed strings. */ -typedef struct _DMXConfigString { - int token; - int line; - const char *comment; - const char *string; - struct _DMXConfigString *next; -} DMXConfigString, *DMXConfigStringPtr; - -/** Stores parsed numbers. */ -typedef struct _DMXConfigNumber { - int token; - int line; - const char *comment; - int number; -} DMXConfigNumber, *DMXConfigNumberPtr; - -/** Stores parsed pairs (e.g., x y) */ -typedef struct _DMXConfigPair { - int token; - int line; - const char *comment; - int x; - int y; - int xsign; - int ysign; -} DMXConfigPair, *DMXConfigPairPtr; - -/** Stores parsed comments not stored with a token. */ -typedef struct _DMXConfigComment { - int token; - int line; - const char *comment; -} DMXConfigComment, *DMXConfigCommentPtr; - -typedef enum { - dmxConfigComment, - dmxConfigVirtual, - dmxConfigDisplay, - dmxConfigWall, - dmxConfigOption, - dmxConfigParam -} DMXConfigType; - -/** Stores a geometry specification. */ -typedef struct _DMXConfigPartDim { - DMXConfigPairPtr dim; - DMXConfigPairPtr offset; -} DMXConfigPartDim, *DMXConfigPartDimPtr; - -/** Stores a pair of geometry specifications. */ -typedef struct _DMXConfigFullDim { - DMXConfigPartDimPtr scrn; - DMXConfigPartDimPtr root; -} DMXConfigFullDim, *DMXConfigFullDimPtr; - -/** Stores parsed display information. */ -typedef struct _DMXConfigDisplay { - /* Summary information */ - const char *name; - /* Screen Window Geometry */ - int scrnWidth, scrnHeight; - int scrnX, scrnY; - int scrnXSign, scrnYSign; - /* Root Window Geometry */ - int rootWidth, rootHeight; - int rootX, rootY; - int rootXSign, rootYSign; - /* Origin in global space */ - int rootXOrigin, rootYOrigin; - - /* Raw configuration information */ - DMXConfigTokenPtr start; - DMXConfigStringPtr dname; - DMXConfigFullDimPtr dim; - DMXConfigPairPtr origin; - DMXConfigTokenPtr end; -} DMXConfigDisplay, *DMXConfigDisplayPtr; - -/** Stores parsed wall information. */ -typedef struct _DMXConfigWall { - /* Summary information */ - int width, height; /* dimensions of displays */ - int xwall, ywall; /* dimensions of wall, in tiles */ - - /* Raw configuration information */ - DMXConfigTokenPtr start; - DMXConfigPairPtr wallDim; - DMXConfigPairPtr displayDim; - DMXConfigStringPtr nameList; - DMXConfigTokenPtr end; -} DMXConfigWall, *DMXConfigWallPtr; - -/** Stores parsed option information. */ -typedef struct _DMXConfigOption { - /* Summary information */ - char *string; - - /* Raw configuration information */ - DMXConfigTokenPtr start; - DMXConfigStringPtr option; - DMXConfigTokenPtr end; -} DMXConfigOption, *DMXConfigOptionPtr; - -/** Stores parsed param information. */ -typedef struct _DMXConfigParam { - int argc; - const char **argv; - - DMXConfigTokenPtr start; - DMXConfigTokenPtr open; - DMXConfigStringPtr param; - DMXConfigTokenPtr close; - DMXConfigTokenPtr end; /* Either open/close OR end */ - struct _DMXConfigParam *next; -} DMXConfigParam, *DMXConfigParamPtr; - -/** Stores options under an entry (subentry). */ -typedef struct _DMXConfigSub { - DMXConfigType type; - DMXConfigCommentPtr comment; - DMXConfigDisplayPtr display; - DMXConfigWallPtr wall; - DMXConfigOptionPtr option; - DMXConfigParamPtr param; - struct _DMXConfigSub *next; -} DMXConfigSub, *DMXConfigSubPtr; - -/** Stores parsed virtual information. */ -typedef struct _DMXConfigVirtual { - /* Summary information */ - const char *name; - int width, height; - - /* Raw configuration information */ - DMXConfigTokenPtr start; - DMXConfigStringPtr vname; - DMXConfigPairPtr dim; - DMXConfigTokenPtr open; - DMXConfigSubPtr subentry; - DMXConfigTokenPtr close; -} DMXConfigVirtual, *DMXConfigVirtualPtr; - -/** Heads entry storage. */ -typedef struct _DMXConfigEntry { - DMXConfigType type; - DMXConfigCommentPtr comment; - DMXConfigVirtualPtr virtual; - struct _DMXConfigEntry *next; -} DMXConfigEntry, *DMXConfigEntryPtr; - -extern DMXConfigEntryPtr dmxConfigEntry; - -extern void yyerror(const char *message); - -extern void dmxConfigLog(const char *format, ...) _X_ATTRIBUTE_PRINTF(1,0); -extern void *dmxConfigAlloc(unsigned long bytes); -extern void *dmxConfigRealloc(void *orig, - unsigned long orig_bytes, unsigned long bytes); -extern const char *dmxConfigCopyString(const char *string, int length); -extern void dmxConfigFree(void *area); -extern DMXConfigTokenPtr dmxConfigCreateToken(int token, int line, - const char *comment); -extern void dmxConfigFreeToken(DMXConfigTokenPtr p); -extern DMXConfigStringPtr dmxConfigCreateString(int token, int line, - const char *comment, - const char *string); -extern void dmxConfigFreeString(DMXConfigStringPtr p); -extern DMXConfigNumberPtr dmxConfigCreateNumber(int token, int line, - const char *comment, - int number); -extern void dmxConfigFreeNumber(DMXConfigNumberPtr p); -extern DMXConfigPairPtr dmxConfigCreatePair(int token, int line, - const char *comment, - int x, int y, int xsign, int ysign); -extern void dmxConfigFreePair(DMXConfigPairPtr p); -extern DMXConfigCommentPtr dmxConfigCreateComment(int token, int line, - const char *comment); -extern void dmxConfigFreeComment(DMXConfigCommentPtr p); -extern DMXConfigPartDimPtr dmxConfigCreatePartDim(DMXConfigPairPtr pDim, - DMXConfigPairPtr pOffset); -extern void dmxConfigFreePartDim(DMXConfigPartDimPtr p); -extern DMXConfigFullDimPtr dmxConfigCreateFullDim(DMXConfigPartDimPtr pScrn, - DMXConfigPartDimPtr pRoot); -extern void dmxConfigFreeFullDim(DMXConfigFullDimPtr p); -extern DMXConfigDisplayPtr dmxConfigCreateDisplay(DMXConfigTokenPtr pStart, - DMXConfigStringPtr pName, - DMXConfigFullDimPtr pDim, - DMXConfigPairPtr pOrigin, - DMXConfigTokenPtr pEnd); -extern void dmxConfigFreeDisplay(DMXConfigDisplayPtr p); -extern DMXConfigWallPtr dmxConfigCreateWall(DMXConfigTokenPtr pStart, - DMXConfigPairPtr pWallDim, - DMXConfigPairPtr pDisplayDim, - DMXConfigStringPtr pNameList, - DMXConfigTokenPtr pEnd); -extern void dmxConfigFreeWall(DMXConfigWallPtr p); -extern DMXConfigOptionPtr dmxConfigCreateOption(DMXConfigTokenPtr pStart, - DMXConfigStringPtr pOption, - DMXConfigTokenPtr pEnd); -extern void dmxConfigFreeOption(DMXConfigOptionPtr p); -extern DMXConfigParamPtr dmxConfigCreateParam(DMXConfigTokenPtr pStart, - DMXConfigTokenPtr pOpen, - DMXConfigStringPtr pParam, - DMXConfigTokenPtr pClose, - DMXConfigTokenPtr pEnd); -extern void dmxConfigFreeParam(DMXConfigParamPtr p); -extern const char **dmxConfigLookupParam(DMXConfigParamPtr p, - const char *key, int *argc); -extern DMXConfigSubPtr dmxConfigCreateSub(DMXConfigType type, - DMXConfigCommentPtr comment, - DMXConfigDisplayPtr display, - DMXConfigWallPtr wall, - DMXConfigOptionPtr option, - DMXConfigParamPtr param); -extern void dmxConfigFreeSub(DMXConfigSubPtr sub); -extern DMXConfigSubPtr dmxConfigSubComment(DMXConfigCommentPtr comment); -extern DMXConfigSubPtr dmxConfigSubDisplay(DMXConfigDisplayPtr display); -extern DMXConfigSubPtr dmxConfigSubWall(DMXConfigWallPtr wall); -extern DMXConfigSubPtr dmxConfigSubOption(DMXConfigOptionPtr option); -extern DMXConfigSubPtr dmxConfigSubParam(DMXConfigParamPtr param); -extern DMXConfigSubPtr dmxConfigAddSub(DMXConfigSubPtr head, - DMXConfigSubPtr sub); -extern DMXConfigVirtualPtr dmxConfigCreateVirtual(DMXConfigTokenPtr pStart, - DMXConfigStringPtr pName, - DMXConfigPairPtr pDim, - DMXConfigTokenPtr pOpen, - DMXConfigSubPtr pSubentry, - DMXConfigTokenPtr pClose); -extern void dmxConfigFreeVirtual(DMXConfigVirtualPtr virtual); -extern DMXConfigEntryPtr dmxConfigCreateEntry(DMXConfigType type, - DMXConfigCommentPtr comment, - DMXConfigVirtualPtr virtual); -extern void dmxConfigFreeEntry(DMXConfigEntryPtr entry); -extern DMXConfigEntryPtr dmxConfigAddEntry(DMXConfigEntryPtr head, - DMXConfigType type, - DMXConfigCommentPtr comment, - DMXConfigVirtualPtr virtual); -extern DMXConfigEntryPtr dmxConfigEntryComment(DMXConfigCommentPtr comment); -extern DMXConfigEntryPtr dmxConfigEntryVirtual(DMXConfigVirtualPtr virtual); - -#endif diff --git a/hw/dmx/config/dmxprint.c b/hw/dmx/config/dmxprint.c deleted file mode 100644 index c80e830e4..000000000 --- a/hw/dmx/config/dmxprint.c +++ /dev/null @@ -1,532 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This file provides support routines and helper functions to be used - * to pretty-print DMX configurations. - * - * Because the DMX configuration file parsing should be capable of being - * used in a stand-alone fashion (i.e., independent from the DMX server - * source tree), no dependencies on other DMX routines are made. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxconfig.h" -#include "dmxparse.h" -#include "dmxprint.h" -#include "parser.h" -#include <stdio.h> -#include <stdarg.h> -#include <ctype.h> - -static FILE *str = NULL; -static int indent = 0; -static int pos = 0; - -/** Stack of indentation information used for pretty-printing - * configuration information. */ -static struct stack { - int base; - int comment; - int step; - struct stack *next; -} *stack, initialStack = { -0, 0, 4, NULL}; - -static void -dmxConfigIndent(void) -{ - int i; - - if (indent < 0) - indent = 0; - if (indent > 40) - indent = 40; - for (i = 0; i < indent; i++) - fprintf(str, " "); -} - -static void -dmxConfigNewline(void) -{ - if (pos) - fprintf(str, "\n"); - pos = 0; -} - -static void -dmxConfigPushState(int base, int comment, int step) -{ - struct stack *new = dmxConfigAlloc(sizeof(*new)); - - new->base = base; - new->comment = comment; - new->step = step; - new->next = stack; - stack = new; - indent = base; - dmxConfigNewline(); -} - -static void -dmxConfigPushComment(void) -{ - if (stack) - indent = stack->comment; -} - -static void -dmxConfigPushStep(void) -{ - if (stack) - indent = stack->step; -} - -static void -dmxConfigPopState(void) -{ - struct stack *old = stack; - - if (!stack) - return; - indent = old->base; - stack = old->next; - if (!stack) - dmxConfigLog("Stack underflow\n"); - dmxConfigFree(old); - dmxConfigNewline(); -} - -static void _X_ATTRIBUTE_PRINTF(4, 5) -dmxConfigOutput(int addSpace, int doNewline, const char *comment, - const char *format, ...) -{ - va_list args; - - if (!pos) - dmxConfigIndent(); - else if (addSpace) - fprintf(str, " "); - - if (format) { - va_start(args, format); - /* RATS: This hasn't been audited -- it - * could probably result in a buffer - * overflow. */ - pos += vfprintf(str, format, args); /* assumes no newlines! */ - va_end(args); - } - - if (comment) { - if (pos) - fprintf(str, " "); - pos += fprintf(str, "#%s", comment); - dmxConfigNewline(); - dmxConfigPushComment(); - } - else if (doNewline) - dmxConfigNewline(); -} - -static void -dmxConfigPrintComment(DMXConfigCommentPtr p) -{ - dmxConfigOutput(1, 1, p->comment, NULL); -} - -static void -dmxConfigPrintTokenFlag(DMXConfigTokenPtr p, int flag) -{ - if (!p) - return; - switch (p->token) { - case T_VIRTUAL: - dmxConfigPushState(0, 4, 4); - dmxConfigOutput(0, 0, p->comment, "virtual"); - break; - case T_DISPLAY: - dmxConfigPushState(4, 12, 16); - dmxConfigOutput(0, 0, p->comment, "display"); - break; - case T_WALL: - dmxConfigPushState(4, 12, 16); - dmxConfigOutput(0, 0, p->comment, "wall"); - break; - case T_OPTION: - dmxConfigPushState(4, 12, 16); - dmxConfigOutput(0, 0, p->comment, "option"); - break; - case T_PARAM: - dmxConfigPushState(4, 8, 12); - dmxConfigOutput(0, 0, p->comment, "param"); - break; - case ';': - dmxConfigOutput(0, 1, p->comment, ";"); - if (flag) - dmxConfigPopState(); - break; - case '{': - dmxConfigOutput(1, 1, p->comment, "{"); - dmxConfigPushStep(); - break; - case '}': - if (flag) - dmxConfigPopState(); - dmxConfigOutput(0, 1, p->comment, "}"); - break; - case '/': - dmxConfigOutput(1, 0, NULL, "/"); - break; - default: - dmxConfigLog("unknown token %d on line %d\n", p->token, p->line); - } -} - -static void -dmxConfigPrintToken(DMXConfigTokenPtr p) -{ - dmxConfigPrintTokenFlag(p, 1); -} - -static void -dmxConfigPrintTokenNopop(DMXConfigTokenPtr p) -{ - dmxConfigPrintTokenFlag(p, 0); -} - -static int -dmxConfigPrintQuotedString(const char *s) -{ - const char *pt; - - if (!s || !s[0]) - return 1; /* Quote empty string */ - for (pt = s; *pt; ++pt) - if (isspace(*pt)) - return 1; - return 0; -} - -static void -dmxConfigPrintString(DMXConfigStringPtr p, int quote) -{ - DMXConfigStringPtr pt; - - if (!p) - return; - for (pt = p; pt; pt = pt->next) { - if (quote && dmxConfigPrintQuotedString(pt->string)) { - dmxConfigOutput(1, 0, pt->comment, "\"%s\"", - pt->string ? pt->string : ""); - } - else - dmxConfigOutput(1, 0, pt->comment, "%s", - pt->string ? pt->string : ""); - } -} - -static int -dmxConfigPrintPair(DMXConfigPairPtr p, int addSpace) -{ - if (!p) - return 0; - if (p->token == T_OFFSET) { - if (!p->comment && !p->x && !p->y && p->xsign >= 0 && p->ysign >= 0) - return 0; - dmxConfigOutput(addSpace, 0, p->comment, "%c%d%c%d", - p->xsign < 0 ? '-' : '+', p->x, - p->ysign < 0 ? '-' : '+', p->y); - } - else { - if (!p->comment && !p->x && !p->y) - return 0; - dmxConfigOutput(addSpace, 0, p->comment, "%s%dx%d", - (p->token == T_ORIGIN) ? "@" : "", p->x, p->y); - } - return 1; -} - -static void -dmxConfigPrintDisplay(DMXConfigDisplayPtr p) -{ - DMXConfigToken dummyStart = { T_DISPLAY, 0, NULL }; - DMXConfigToken dummyEnd = { ';', 0, NULL }; - DMXConfigToken dummySep = { '/', 0, NULL }; - DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL }; - DMXConfigPair dummySDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 }; - DMXConfigPair dummySOffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 }; - DMXConfigPair dummyRDim = { T_DIMENSION, 0, NULL, 0, 0, 0, 0 }; - DMXConfigPair dummyROffset = { T_OFFSET, 0, NULL, 0, 0, 0, 0 }; - DMXConfigPair dummyOrigin = { T_ORIGIN, 0, NULL, 0, 0, 0, 0 }; - int output; - - if (p->dname) - p->dname->string = p->name; - else - dummyName.string = p->name; - - if (p->dim && p->dim->scrn && p->dim->scrn->dim) { - p->dim->scrn->dim->x = p->scrnWidth; - p->dim->scrn->dim->y = p->scrnHeight; - } - else { - dummySDim.x = p->scrnWidth; - dummySDim.y = p->scrnHeight; - } - - if (p->dim && p->dim->scrn && p->dim->scrn->offset) { - p->dim->scrn->offset->x = p->scrnX; - p->dim->scrn->offset->y = p->scrnY; - } - else { - dummySOffset.x = p->scrnX; - dummySOffset.y = p->scrnY; - } - - if (p->dim && p->dim->root && p->dim->root->dim) { - p->dim->root->dim->x = p->rootWidth; - p->dim->root->dim->y = p->rootHeight; - } - else { - dummyRDim.x = p->rootWidth; - dummyRDim.y = p->rootHeight; - } - - if (p->dim && p->dim->root && p->dim->root->offset) { - p->dim->root->offset->x = p->rootX; - p->dim->root->offset->y = p->rootY; - } - else { - dummyROffset.x = p->rootX; - dummyROffset.y = p->rootY; - } - - if (p->origin) { - p->origin->x = p->rootXOrigin, p->origin->y = p->rootYOrigin; - p->origin->xsign = p->rootXSign, p->origin->ysign = p->rootYSign; - } - else { - dummyOrigin.x = p->rootXOrigin, dummyOrigin.y = p->rootYOrigin; - dummyOrigin.xsign = p->rootXSign, dummyOrigin.ysign = p->rootYSign; - } - - dmxConfigPrintToken(p->start ? p->start : &dummyStart); - dmxConfigPrintString(p->dname ? p->dname : &dummyName, 1); - - if (p->dim && p->dim->scrn && p->dim->scrn->dim) - output = dmxConfigPrintPair(p->dim->scrn->dim, 1); - else - output = dmxConfigPrintPair(&dummySDim, 1); - if (p->dim && p->dim->scrn && p->dim->scrn->offset) - dmxConfigPrintPair(p->dim->scrn->offset, !output); - else - dmxConfigPrintPair(&dummySOffset, !output); - - if (p->scrnWidth != p->rootWidth - || p->scrnHeight != p->rootHeight || p->rootX || p->rootY) { - dmxConfigPrintToken(&dummySep); - if (p->dim && p->dim->root && p->dim->root->dim) - output = dmxConfigPrintPair(p->dim->root->dim, 1); - else - output = dmxConfigPrintPair(&dummyRDim, 1); - if (p->dim && p->dim->root && p->dim->root->offset) - dmxConfigPrintPair(p->dim->root->offset, !output); - else - dmxConfigPrintPair(&dummyROffset, !output); - } - - dmxConfigPrintPair(p->origin ? p->origin : &dummyOrigin, 1); - dmxConfigPrintToken(p->end ? p->end : &dummyEnd); -} - -static void -dmxConfigPrintWall(DMXConfigWallPtr p) -{ - dmxConfigPrintToken(p->start); - dmxConfigPrintPair(p->wallDim, 1); - dmxConfigPrintPair(p->displayDim, 1); - dmxConfigPrintString(p->nameList, 1); - dmxConfigPrintToken(p->end); -} - -static void -dmxConfigPrintOption(DMXConfigOptionPtr p) -{ - DMXConfigToken dummyStart = { T_OPTION, 0, NULL }; - DMXConfigString dummyOption = { T_STRING, 0, NULL, NULL, NULL }; - DMXConfigToken dummyEnd = { ';', 0, NULL }; - - dummyOption.string = p->string; - - dmxConfigPrintToken(p->start ? p->start : &dummyStart); - dmxConfigPrintString(&dummyOption, 0); - dmxConfigPrintToken(p->end ? p->end : &dummyEnd); -} - -static void -dmxConfigPrintParam(DMXConfigParamPtr p) -{ - if (!p) - return; - if (p->start) { - if (p->open && p->close) { - dmxConfigPrintToken(p->start); - dmxConfigPrintToken(p->open); - dmxConfigPrintParam(p->next); - dmxConfigPrintToken(p->close); - } - else if (p->end && p->param) { - dmxConfigPrintToken(p->start); - dmxConfigPrintString(p->param, 1); - dmxConfigPrintToken(p->end); - } - else - dmxConfigLog("dmxConfigPrintParam: cannot handle format (a)\n"); - } - else if (p->end && p->param) { - dmxConfigPrintString(p->param, 1); - dmxConfigPrintTokenNopop(p->end); - dmxConfigPrintParam(p->next); - } - else - dmxConfigLog("dmxConfigPrintParam: cannot handle format (b)\n"); -} - -static void -dmxConfigPrintSub(DMXConfigSubPtr p) -{ - DMXConfigSubPtr pt; - - if (!p) - return; - for (pt = p; pt; pt = pt->next) { - switch (pt->type) { - case dmxConfigComment: - dmxConfigPrintComment(pt->comment); - break; - case dmxConfigDisplay: - dmxConfigPrintDisplay(pt->display); - break; - case dmxConfigWall: - dmxConfigPrintWall(pt->wall); - break; - case dmxConfigOption: - dmxConfigPrintOption(pt->option); - break; - case dmxConfigParam: - dmxConfigPrintParam(pt->param); - break; - default: - dmxConfigLog("dmxConfigPrintSub:" - " cannot handle type %d in subentry\n", pt->type); - } - } -} - -static void -dmxConfigPrintVirtual(DMXConfigVirtualPtr p) -{ - DMXConfigToken dummyStart = { T_VIRTUAL, 0, NULL }; - DMXConfigToken dummyOpen = { '{', 0, NULL }; - DMXConfigToken dummyClose = { '}', 0, NULL }; - DMXConfigString dummyName = { T_STRING, 0, NULL, NULL, NULL }; - DMXConfigPair dummyDim = { T_DIMENSION, 0, NULL, 0, 0 }; - - if (p->vname) - p->vname->string = p->name; - else - dummyName.string = p->name; - - if (p->dim) - p->dim->x = p->width, p->dim->y = p->height; - else - dummyDim.x = p->width, dummyDim.y = p->height; - - dmxConfigPrintToken(p->start ? p->start : &dummyStart); - dmxConfigPrintString(p->vname ? p->vname : &dummyName, 1); - dmxConfigPrintPair(p->dim ? p->dim : &dummyDim, 1); - dmxConfigPrintToken(p->open ? p->open : &dummyOpen); - dmxConfigPrintSub(p->subentry); - dmxConfigPrintToken(p->close ? p->close : &dummyClose); -} - -/** The configuration information in \a entry will be pretty-printed to - * the \a stream. If \a stream is NULL, then stdout will be used. */ -void -dmxConfigPrint(FILE * stream, DMXConfigEntryPtr entry) -{ - DMXConfigEntryPtr pt; - - if (!stream) - str = stdout; - else - str = stream; - - stack = &initialStack; - - for (pt = entry; pt; pt = pt->next) { - switch (pt->type) { - case dmxConfigComment: - dmxConfigPrintComment(pt->comment); - break; - case dmxConfigVirtual: - dmxConfigPrintVirtual(pt->virtual); - break; - default: - dmxConfigLog("dmxConfigPrint: cannot handle type %d in entry\n", - pt->type); - } - } - if (pos) - dmxConfigNewline(); -} - -/** The configuration information in \a p will be pretty-printed to the - * \a stream. If \a stream is NULL, then stdout will be used. */ -void -dmxConfigVirtualPrint(FILE * stream, DMXConfigVirtualPtr p) -{ - if (!stream) - str = stdout; - else - str = stream; - - stack = &initialStack; - - dmxConfigPrintVirtual(p); - if (pos) - dmxConfigNewline(); -} diff --git a/hw/dmx/config/dmxprint.h b/hw/dmx/config/dmxprint.h deleted file mode 100644 index d77bafce2..000000000 --- a/hw/dmx/config/dmxprint.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to DMX configuration file pretty-printer. \see dmxprint.c */ - -#ifndef _DMXPRINT_H_ -#define _DMXPRINT_H_ - -void dmxConfigPrint(FILE * str, DMXConfigEntryPtr entry); -void dmxConfigVirtualPrint(FILE * str, DMXConfigVirtualPtr p); - -#endif diff --git a/hw/dmx/config/dmxtodmx.c b/hw/dmx/config/dmxtodmx.c deleted file mode 100644 index 5a1a0b4b1..000000000 --- a/hw/dmx/config/dmxtodmx.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - * This is a simple filter for testing. - */ - -#include "dmxconfig.h" -#include "dmxparse.h" -#include "dmxprint.h" -#include "dmxcompat.h" - -extern int yyparse(void); -extern int yydebug; -extern FILE *yyin; - -int -main(int argc, char **argv) -{ - yydebug = 0; - yyparse(); - dmxConfigPrint(stdout, dmxConfigEntry); - return 0; -} diff --git a/hw/dmx/config/man/Makefile.am b/hw/dmx/config/man/Makefile.am deleted file mode 100644 index 9bb62a4c6..000000000 --- a/hw/dmx/config/man/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -include $(top_srcdir)/manpages.am -appman_PRE = xdmxconfig.man vdltodmx.man dmxtodmx.man diff --git a/hw/dmx/config/man/dmxtodmx.man b/hw/dmx/config/man/dmxtodmx.man deleted file mode 100644 index e93948755..000000000 --- a/hw/dmx/config/man/dmxtodmx.man +++ /dev/null @@ -1,41 +0,0 @@ -.\" $XFree86$ -.\" Copyright 2002 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: -.\" Rickard E. (Rik) Faith <faith@redhat.com> -.\" -.TH dmxtodmx 1 @vendorversion@ -.SH NAME -dmxtodmx - dmx configuration file parser and printer -.SH SYNOPSIS -.B dmxtodmx -.SH DESCRIPTION -.I dmxtodmx -reads the standard input, parsing a configuration file for the -.I Xdmx -distributed multi-head X server. After a successful parse, the file is -pretty-printed to standard output. -.SH "SEE ALSO" -Xdmx(1), vdltodmx(1), xdmxconfig(1) diff --git a/hw/dmx/config/man/vdltodmx.man b/hw/dmx/config/man/vdltodmx.man deleted file mode 100644 index aa5b4244f..000000000 --- a/hw/dmx/config/man/vdltodmx.man +++ /dev/null @@ -1,95 +0,0 @@ -.\" $XFree86$ -.\" Copyright 2002 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: -.\" Rickard E. (Rik) Faith <faith@redhat.com> -.\" -.TH vdltodmx 1 @vendorversion@ -.SH NAME -vdltodmx - dmx configuration file parser and printer -.SH SYNOPSIS -.B vdltodmx -.I infile -.I outfile -.SH DESCRIPTION -.I vdltodmx -reads the input file, which should be in VDL configuration file format. -After a successful parse, a file in Xdmx configuration file format is -written to the output file. -.P -The VDL file format is used with -.IR xmovie , -which is available from -http://www.llnl.gov/icc/lc/img/xmovie/xmovie.html -.SH EXAMPLE -Given the following VDL-format file: -.RS -.nf -0 -2 -# -# -2560 2048 Left two-thirds [restrict=*:2] -2 -:2.1 1280 2048 0 0 0 0 -:2.2 1280 2048 1280 0 0 0 -4 -1280 1024 0 0 -1280 1024 0 1024 -1280 1024 1280 0 -1280 1024 1280 1024 -# -2560 2048 Right two-thirds [restrict=*:2] -2 -:2.2 1280 2048 0 0 0 0 -:2.3 1280 2048 1280 0 0 0 -4 -1280 1024 1280 0 -1280 1024 1280 1024 -1280 1024 2560 0 -1280 1024 2560 1024 -.fi -.RE -the following DMX-format file will be produced: -.RS -.nf -# -# -virtual "Left two-thirds" 2560x2048 { - display :2.1 1280x2048; - display :2.2 1280x2048 @1280x0; -} -# -virtual "Right two-thirds" 2560x2048 { - display :2.2 1280x2048; - display :2.3 1280x2048 @1280x0; -} -.fi -.RE -.SH BUGS -If the VDL file is not in the expected format, the program will probably -dump core. -.SH "SEE ALSO" -Xdmx(1), xdmxconfig(1), vdl(3), xmovie(1) diff --git a/hw/dmx/config/man/xdmxconfig.man b/hw/dmx/config/man/xdmxconfig.man deleted file mode 100644 index 32731d1db..000000000 --- a/hw/dmx/config/man/xdmxconfig.man +++ /dev/null @@ -1,63 +0,0 @@ -.\" $XFree86$ -.\" Copyright 2002 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: -.\" Rickard E. (Rik) Faith <faith@redhat.com> -.\" -.TH xdmxconfig 1 @vendorversion@ -.SH NAME -xdmxconfig - a graphical configuration tool for Xdmx configuration files -.SH SYNOPSIS -.B xdmxconfig -[filename] -.SH DESCRIPTION -.I xdmxconfig -reads, edits, and writes configuration files for the Xdmx server. The -grammar for the configuration file is specified in the Xdmx(1) manual -page. -.PP -To start from scratch, create a "New Global" and specify the name and -overall dimensions for the configuration. Then use "New Display" to -enter more displays. -.PP -If there is more than one configuration, the configuration name button -will bring up a selection menu. -.PP -In the right-hand panel, the left mouse button will move the -highlighted display at "tool resolution"; the middle mouse button will -move the highlighted display by a single pixel (at "wall resolution"); -and the right mouse button will bring up a menu allowing the highlighted -display to be edited or deleted. The arrow keys will also move the -highlighted display by a single pixel. -.SH BUGS -Currently, entries with the -.B wall -keyword are not editable, but will be preserved in the new output file. -The tool will quit when requested by the user, even if a configuration -file has not been written out (i.e., without warning). The menu -interaction should be improved (menu entries that don't currently work -should be greyed-out, for example). The Help button does not work. -.SH "SEE ALSO" -Xdmx(1), vdltodmx(1) diff --git a/hw/dmx/config/meson.build b/hw/dmx/config/meson.build deleted file mode 100644 index 39b41c2cb..000000000 --- a/hw/dmx/config/meson.build +++ /dev/null @@ -1,82 +0,0 @@ -flex = find_program('flex') -bison = find_program('bison') - -lgen = generator( - flex, - output : '@PLAINNAME@.yy.c', - arguments : ['-o', '@OUTPUT@', '@INPUT@'] -) -lfiles = lgen.process('scanner.l') - -pgen = generator( - bison, - output : ['@BASENAME@.c', '@BASENAME@.h'], - arguments : ['@INPUT@', '--defines=@OUTPUT1@', '--output=@OUTPUT0@'] -) -pfiles = pgen.process('parser.y') - -srcs_dmx_config = [ - 'dmxparse.c', - 'dmxprint.c', - 'dmxcompat.c', - 'dmxconfig.c', - pfiles, - lfiles, -] - -dmx_inc = [ - inc, - include_directories('../') -] - -dmx_c_args = [ - '-DHAVE_DMX_CONFIG_H', - '-DDMX_LOG_STANDALONE', -] - -dmx_config = static_library('dmx_config', - srcs_dmx_config, - include_directories: dmx_inc, - dependencies: common_dep, - link_with: libxlibc, - c_args: dmx_c_args, -) - -executable('xdmxconfig', - [ - 'xdmxconfig.c', - '../dmxlog.c', - 'Canvas.c', - ], - include_directories: [ - inc, - include_directories('../') - ], - dependencies: [ - common_dep, - dependency('xaw7'), - dependency('xmu'), - dependency('xt'), - dependency('xpm'), - dependency('x11'), - ], - link_with: dmx_config, - c_args: dmx_c_args, - install: true, -) - -executable('vdltodmx', - 'vdltodmx.c', - include_directories: dmx_inc, - link_with: dmx_config, - c_args: dmx_c_args, - install: true, -) - -executable('dmxtodmx', - 'dmxtodmx.c', - include_directories: dmx_inc, - link_with: dmx_config, - c_args: dmx_c_args, - install: true, -) diff --git a/hw/dmx/config/parser.y b/hw/dmx/config/parser.y deleted file mode 100644 index fa041a1c9..000000000 --- a/hw/dmx/config/parser.y +++ /dev/null @@ -1,227 +0,0 @@ -/* $XFree86$ */ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -%{ -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxparse.h" -#include <string.h> -#include <stdlib.h> -#define YYDEBUG 1 -#define YYERROR_VERBOSE -#define YY_USE_PROTOS - -extern int yylex(void); -DMXConfigEntryPtr dmxConfigEntry = NULL; -#define APPEND(type, h, t) \ -{ \ - type pt; \ - for (pt = h; pt->next; pt = pt->next); \ - pt->next = t; \ -} -%} - -%union { - DMXConfigTokenPtr token; - DMXConfigStringPtr string; - DMXConfigNumberPtr number; - DMXConfigPairPtr pair; - DMXConfigFullDimPtr fdim; - DMXConfigPartDimPtr pdim; - DMXConfigDisplayPtr display; - DMXConfigWallPtr wall; - DMXConfigOptionPtr option; - DMXConfigParamPtr param; - DMXConfigCommentPtr comment; - DMXConfigSubPtr subentry; - DMXConfigVirtualPtr virtual; - DMXConfigEntryPtr entry; -} - - /* Terminals */ -%token <token> '{' '}' ';' '/' T_VIRTUAL T_DISPLAY T_WALL T_OPTION T_PARAM -%token <string> T_STRING -%token <pair> T_DIMENSION T_OFFSET T_ORIGIN -%token <comment> T_COMMENT T_LINE_COMMENT - - /* Non-termials */ -%type <token> Display Wall Terminal Open Close -%type <string> NameList Name -%type <pair> Dimension Offset Origin -%type <pdim> PartialDim -%type <fdim> FullDim -%type <display> DisplayEntry -%type <option> OptionEntry -%type <param> ParamEntry ParamList Param -%type <subentry> SubList Sub -%type <wall> WallEntry -%type <virtual> Virtual -%type <entry> Program EntryList Entry - -%% - -Program : EntryList { dmxConfigEntry = $1; } - ; - -EntryList : Entry - | EntryList Entry { APPEND(DMXConfigEntryPtr,$1,$2); $$ = $1; } - ; - -Entry : Virtual { $$ = dmxConfigEntryVirtual($1); } - | T_LINE_COMMENT { $$ = dmxConfigEntryComment($1); } - ; - -Virtual : T_VIRTUAL Open SubList Close - { $$ = dmxConfigCreateVirtual($1, NULL, NULL, $2, $3, $4); } - | T_VIRTUAL Dimension Open SubList Close - { $$ = dmxConfigCreateVirtual($1, NULL, $2, $3, $4, $5); } - | T_VIRTUAL Name Open SubList Close - { $$ = dmxConfigCreateVirtual($1, $2, NULL, $3, $4, $5); } - | T_VIRTUAL Name Dimension Open SubList Close - { $$ = dmxConfigCreateVirtual($1, $2, $3, $4, $5, $6 ); } - ; - -SubList : Sub - | SubList Sub { APPEND(DMXConfigSubPtr,$1,$2); $$ = $1; } - ; - -Sub : T_LINE_COMMENT { $$ = dmxConfigSubComment($1); } - | DisplayEntry { $$ = dmxConfigSubDisplay($1); } - | WallEntry { $$ = dmxConfigSubWall($1); } - | OptionEntry { $$ = dmxConfigSubOption($1); } - | ParamEntry { $$ = dmxConfigSubParam($1); } - ; - -OptionEntry : T_OPTION NameList Terminal - { $$ = dmxConfigCreateOption($1, $2, $3); } - ; - -ParamEntry : T_PARAM NameList Terminal - { $$ = dmxConfigCreateParam($1, NULL, $2, NULL, $3); } - | T_PARAM Open ParamList Close - { $$ = dmxConfigCreateParam($1, $2, NULL, $4, NULL); - $$->next = $3; - } - ; - -ParamList : Param - | ParamList Param { APPEND(DMXConfigParamPtr,$1,$2); $$ = $1; } - ; - -Param : NameList Terminal - { $$ = dmxConfigCreateParam(NULL, NULL, $1, NULL, $2); } - ; - -PartialDim : Dimension Offset - { $$ = dmxConfigCreatePartDim($1, $2); } - | Dimension - { $$ = dmxConfigCreatePartDim($1, NULL); } - | Offset - { $$ = dmxConfigCreatePartDim(NULL, $1); } - ; - -FullDim : PartialDim '/' PartialDim - { $$ = dmxConfigCreateFullDim($1, $3); } - | '/' PartialDim - { $$ = dmxConfigCreateFullDim(NULL, $2); } - | PartialDim - { $$ = dmxConfigCreateFullDim($1, NULL); } - ; - -DisplayEntry : Display Name FullDim Origin Terminal - { $$ = dmxConfigCreateDisplay($1, $2, $3, $4, $5); } - | Display FullDim Origin Terminal - { $$ = dmxConfigCreateDisplay($1, NULL, $2, $3, $4); } - | Display Name Origin Terminal - { $$ = dmxConfigCreateDisplay($1, $2, NULL, $3, $4); } - - | Display Name FullDim Terminal - { $$ = dmxConfigCreateDisplay($1, $2, $3, NULL, $4); } - | Display FullDim Terminal - { $$ = dmxConfigCreateDisplay($1, NULL, $2, NULL, $3); } - | Display Name Terminal - { $$ = dmxConfigCreateDisplay($1, $2, NULL, NULL, $3); } - | Display Terminal - { $$ = dmxConfigCreateDisplay($1, NULL, NULL, NULL, $2); } - ; - -WallEntry : Wall Dimension Dimension NameList Terminal - { $$ = dmxConfigCreateWall($1, $2, $3, $4, $5); } - | Wall Dimension NameList Terminal - { $$ = dmxConfigCreateWall($1, $2, NULL, $3, $4); } - | Wall NameList Terminal - { $$ = dmxConfigCreateWall($1, NULL, NULL, $2, $3); } - ; - -Display : T_DISPLAY - | T_DISPLAY T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Name : T_STRING - | T_STRING T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Dimension : T_DIMENSION - | T_DIMENSION T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Offset : T_OFFSET - | T_OFFSET T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Origin : T_ORIGIN - | T_ORIGIN T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Terminal : ';' - | ';' T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Open : '{' - | '{' T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Close : '}' - | '}' T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -Wall : T_WALL - | T_WALL T_COMMENT { $$ = $1; $$->comment = $2->comment; } - ; - -NameList : Name - | NameList Name { APPEND(DMXConfigStringPtr, $1, $2); $$ = $1; } - ; diff --git a/hw/dmx/config/scanner.l b/hw/dmx/config/scanner.l deleted file mode 100644 index 3688fd71d..000000000 --- a/hw/dmx/config/scanner.l +++ /dev/null @@ -1,187 +0,0 @@ -/* $XFree86$ */ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -%{ -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxparse.h" -#include "parser.h" -#include "os.h" -#include <string.h> -#include <stdlib.h> -#include <ctype.h> -static int getdimension(int token, const char *text, int leng); -static int getstring(int token, const char *text, int leng); -static int gettoken(int token, const char *text, int leng); -static int getcomment(int token, const char *text, int leng); -static int lineno = 1; -%} -%s OTHER -comment #.* -word ([[:alpha:]_/:\-\+\.\*][[:alnum:]_/:\-\+\.\*]+) -string \"(([^\"\n])|\"\")*\" -badstring \"(([^\"\n])|\"\")* -number [[:digit:]x]+ -dimension [[:digit:]]+[[:blank:]]*x[[:blank:]]*[[:digit:]]+ -offset [+-][[:digit:]]+[[:blank:]]*[+-][[:blank:]]*[[:digit:]]+ -origin @[[:blank:]]*[[:digit:]]+[[:blank:]]*[[:blank:]]*x[[:digit:]]+ -NL \n -WS [[:blank:]]+ -%% -virtual return gettoken(T_VIRTUAL, yytext, yyleng); -display return gettoken(T_DISPLAY, yytext, yyleng); -wall return gettoken(T_WALL, yytext, yyleng); -option return gettoken(T_OPTION, yytext, yyleng); -param return gettoken(T_PARAM, yytext, yyleng); -{dimension} return getdimension(T_DIMENSION, yytext, yyleng); -{offset} return getdimension(T_OFFSET, yytext+1, yyleng-1); -{origin} return getdimension(T_ORIGIN, yytext+1, yyleng-1); -{word} return getstring(T_STRING, yytext, yyleng); -{string} return getstring(T_STRING, yytext+1, yyleng-2); -{NL} ++lineno; -{WS} -\{ return gettoken(yytext[0], yytext, yyleng); -\} return gettoken(yytext[0], yytext, yyleng); -\; return gettoken(yytext[0], yytext, yyleng); -\/ return gettoken(yytext[0], yytext, yyleng); -^{comment} return getcomment(T_LINE_COMMENT, yytext, yyleng); -{comment} return getcomment(T_COMMENT, yytext, yyleng); -. return getstring(T_STRING, yytext, yyleng); -<<EOF>> return 0; -%% -int yywrap(void) -{ - (void) &yyunput; - (void) &input; - return 1; -} - -_X_NORETURN void yyerror(const char *message) -{ - const char *pt, *end; - struct _entry { - const char *from; - const char *to; - } *entry, list[] = { - { "T_VIRTUAL", "\"virtual\"" }, - { "T_DISPLAY", "\"display\"" }, - { "T_WALL", "\"wall\"" }, - { "T_OPTION", "\"option\"" }, - { "T_PARAM", "\"param\"" }, - { "T_DIMENSION", "dimension (e.g., 2x2 or 1024x768)" }, - { "T_OFFSET", "display offset (e.g., +10-10)" }, - { "T_ORIGIN", "tile origin (e.g., @1280x1024)" }, - { "T_STRING", "string" }, - { "T_COMMENT", "comment (e.g., #...)" }, - { "T_LINE_COMMENT", "comment (e.g., #...)" }, - { NULL, NULL } - }; - - fprintf(stderr, "parse error on line %d at token \"%*.*s\"\n", - lineno, (int)yyleng, (int)yyleng, yytext); - end = message + strlen(message); - for (pt = message; *pt; pt++) { - if (pt[0] == 'T' && pt[1] == '_') { - const char *next = strchr(pt, ' '); - if (!next || !*next) next = strchr(pt, '\0'); - if (!next) goto bail; - --next; - if (next-pt == 1 && next[1] - && next[2] == '\'' && next[3] == '\'') { - fprintf(stderr, "\"%c\"", next[1]); - pt += 4; - goto cnt; - } - for (entry = list; entry->from; ++entry) { - if (!strncmp(entry->from, pt, strlen(entry->from))) { - fprintf(stderr, "%s", entry->to); - pt = next; - goto cnt; - } - } - } else if (end-pt >= 5 && pt[0] == '\'' && pt[1] == '\'' && pt[3] - && pt[4] == '\'' && pt[5] == '\'') { - fprintf(stderr, "\"%c\"", pt[3]); - pt += 5; - } else if (end-pt >= 3 && pt[0] == '\'' && pt[1] && pt[2] == '\'') { - fprintf(stderr, "\"%c\"", pt[1]); - pt += 3; - } - bail: - putc(*pt, stderr); - cnt: - ; - } - fprintf(stderr, "\n"); - exit( 1 ); -} - -static int getdimension(int token, const char *text, int leng) -{ - char *endptr; - char *tmp = dmxConfigAlloc(leng+1); - int x, y; - - strlcpy(tmp, text, leng+1); - x = strtol(tmp, &endptr, 10); - while (*endptr && !isdigit(*endptr)) ++endptr; - y = strtol(endptr, NULL, 10); - dmxConfigFree(tmp); - yylval.pair = dmxConfigCreatePair(token, lineno, NULL, x, y, 1, 1); - return token; -} - -static int getstring(int token, const char *text, int leng) -{ - yylval.string = dmxConfigCreateString(token, lineno, NULL, - dmxConfigCopyString(leng ? text : "", - leng)); - return token; -} - -static int gettoken(int token, const char *text, int leng) -{ - yylval.token = dmxConfigCreateToken(token, lineno, NULL); - return token; -} - -static int getcomment(int token, const char *text, int leng) -{ - yylval.comment = dmxConfigCreateComment(token, lineno, - dmxConfigCopyString(text + 1, - leng - 1)); - return token; -} diff --git a/hw/dmx/config/test-a.in b/hw/dmx/config/test-a.in deleted file mode 100644 index 827675374..000000000 --- a/hw/dmx/config/test-a.in +++ /dev/null @@ -1 +0,0 @@ -error diff --git a/hw/dmx/config/test-a.out b/hw/dmx/config/test-a.out deleted file mode 100644 index d35b29fc0..000000000 --- a/hw/dmx/config/test-a.out +++ /dev/null @@ -1,2 +0,0 @@ -parse error on line 1 at token "error" -syntax error, unexpected string expecting "virtual" or comment (e.g., #...) diff --git a/hw/dmx/config/test-b.in b/hw/dmx/config/test-b.in deleted file mode 100644 index 308ec1db4..000000000 --- a/hw/dmx/config/test-b.in +++ /dev/null @@ -1 +0,0 @@ -# comment diff --git a/hw/dmx/config/test-b.out b/hw/dmx/config/test-b.out deleted file mode 100644 index 308ec1db4..000000000 --- a/hw/dmx/config/test-b.out +++ /dev/null @@ -1 +0,0 @@ -# comment diff --git a/hw/dmx/config/test-c.in b/hw/dmx/config/test-c.in deleted file mode 100644 index e07ae5ba6..000000000 --- a/hw/dmx/config/test-c.in +++ /dev/null @@ -1 +0,0 @@ -virtual diff --git a/hw/dmx/config/test-c.out b/hw/dmx/config/test-c.out deleted file mode 100644 index 7390397a4..000000000 --- a/hw/dmx/config/test-c.out +++ /dev/null @@ -1,2 +0,0 @@ -parse error on line 2 at token " " -syntax error, unexpected $end, expecting "{" or string or dimension (e.g., 2x2 or 1024x768) diff --git a/hw/dmx/config/test-d.in b/hw/dmx/config/test-d.in deleted file mode 100644 index 6827503b1..000000000 --- a/hw/dmx/config/test-d.in +++ /dev/null @@ -1 +0,0 @@ -display diff --git a/hw/dmx/config/test-d.out b/hw/dmx/config/test-d.out deleted file mode 100644 index f3219b301..000000000 --- a/hw/dmx/config/test-d.out +++ /dev/null @@ -1,2 +0,0 @@ -parse error on line 1 at token "display" -syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...) diff --git a/hw/dmx/config/test-e.in b/hw/dmx/config/test-e.in deleted file mode 100644 index 21dbde95c..000000000 --- a/hw/dmx/config/test-e.in +++ /dev/null @@ -1 +0,0 @@ -display; diff --git a/hw/dmx/config/test-e.out b/hw/dmx/config/test-e.out deleted file mode 100644 index f3219b301..000000000 --- a/hw/dmx/config/test-e.out +++ /dev/null @@ -1,2 +0,0 @@ -parse error on line 1 at token "display" -syntax error, unexpected "display" expecting "virtual" or comment (e.g., #...) diff --git a/hw/dmx/config/test-f.in b/hw/dmx/config/test-f.in deleted file mode 100644 index 17f6c6327..000000000 --- a/hw/dmx/config/test-f.in +++ /dev/null @@ -1,2 +0,0 @@ -virtual { -} diff --git a/hw/dmx/config/test-f.out b/hw/dmx/config/test-f.out Binary files differdeleted file mode 100644 index ba3f441d7..000000000 --- a/hw/dmx/config/test-f.out +++ /dev/null diff --git a/hw/dmx/config/test-g.in b/hw/dmx/config/test-g.in deleted file mode 100644 index 453d8121c..000000000 --- a/hw/dmx/config/test-g.in +++ /dev/null @@ -1,4 +0,0 @@ -virtual a { - display d0:0 1280x1024; - display d1:0 1280x1024; -} diff --git a/hw/dmx/config/test-g.out b/hw/dmx/config/test-g.out deleted file mode 100644 index 453d8121c..000000000 --- a/hw/dmx/config/test-g.out +++ /dev/null @@ -1,4 +0,0 @@ -virtual a { - display d0:0 1280x1024; - display d1:0 1280x1024; -} diff --git a/hw/dmx/config/test-h.in b/hw/dmx/config/test-h.in deleted file mode 100644 index 1193d309e..000000000 --- a/hw/dmx/config/test-h.in +++ /dev/null @@ -1,7 +0,0 @@ -# comment a -# comment b -## comment c -# <-- tab -# Next comment is empty -# -# Non empty diff --git a/hw/dmx/config/test-h.out b/hw/dmx/config/test-h.out deleted file mode 100644 index 1193d309e..000000000 --- a/hw/dmx/config/test-h.out +++ /dev/null @@ -1,7 +0,0 @@ -# comment a -# comment b -## comment c -# <-- tab -# Next comment is empty -# -# Non empty diff --git a/hw/dmx/config/test-i.in b/hw/dmx/config/test-i.in deleted file mode 100644 index b65967e62..000000000 --- a/hw/dmx/config/test-i.in +++ /dev/null @@ -1,3 +0,0 @@ -virtual a { - param a b; # comment -} diff --git a/hw/dmx/config/test-i.out b/hw/dmx/config/test-i.out deleted file mode 100644 index b65967e62..000000000 --- a/hw/dmx/config/test-i.out +++ /dev/null @@ -1,3 +0,0 @@ -virtual a { - param a b; # comment -} diff --git a/hw/dmx/config/test-j.in b/hw/dmx/config/test-j.in deleted file mode 100644 index cc1cdd0ea..000000000 --- a/hw/dmx/config/test-j.in +++ /dev/null @@ -1,13 +0,0 @@ -virtual a { - option aaa # bbb - aa cc; - param { # comment 1 - a b; - c d; - x y z; # comment 2 - } - param e f g h; # comment 3 - param e f g hlskdjflskdfjsd #comment 4 - flksdjf sldkfjsldkfjsdlf - "lsdkfjsldkfjlsdkjflskdjflsdkjfl" "lkjsdlfjsdlfkjsdlfj"; -} diff --git a/hw/dmx/config/test-j.out b/hw/dmx/config/test-j.out deleted file mode 100644 index 9acaa009b..000000000 --- a/hw/dmx/config/test-j.out +++ /dev/null @@ -1,11 +0,0 @@ -virtual a { - option "aaa aa cc"; - param { # comment 1 - a b; - c d; - x y z; # comment 2 - } - param e f g h; # comment 3 - param e f g hlskdjflskdfjsd #comment 4 - flksdjf sldkfjsldkfjsdlf lsdkfjsldkfjlsdkjflskdjflsdkjfl lkjsdlfjsdlfkjsdlfj; -} diff --git a/hw/dmx/config/test-k.in b/hw/dmx/config/test-k.in deleted file mode 100644 index 2218d26d9..000000000 --- a/hw/dmx/config/test-k.in +++ /dev/null @@ -1,3 +0,0 @@ -virtual a { - option +xinerama -syncbatch 0; -} diff --git a/hw/dmx/config/test-k.out b/hw/dmx/config/test-k.out deleted file mode 100644 index ebd743923..000000000 --- a/hw/dmx/config/test-k.out +++ /dev/null @@ -1,3 +0,0 @@ -virtual a { - option "+xinerama -syncbatch 0"; -} diff --git a/hw/dmx/config/test-l.in b/hw/dmx/config/test-l.in deleted file mode 100644 index 7bf05139b..000000000 --- a/hw/dmx/config/test-l.in +++ /dev/null @@ -1,12 +0,0 @@ -virtual a { - display d0:0 1x2; - display d1:0 +3+4; - display d2:0 100x200 @1x1; - display d3:0 +3+4 @2x2; - display d4:0 100x200+3+4 @3x3; - display d5:0 / 1x2+3+4; - display d6:0 / 1x2; - display d7:0 / +3+4; - display d8:0 / 1x2+3+4 @4x4; - display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100; -} diff --git a/hw/dmx/config/test-l.out b/hw/dmx/config/test-l.out deleted file mode 100644 index 7bf05139b..000000000 --- a/hw/dmx/config/test-l.out +++ /dev/null @@ -1,12 +0,0 @@ -virtual a { - display d0:0 1x2; - display d1:0 +3+4; - display d2:0 100x200 @1x1; - display d3:0 +3+4 @2x2; - display d4:0 100x200+3+4 @3x3; - display d5:0 / 1x2+3+4; - display d6:0 / 1x2; - display d7:0 / +3+4; - display d8:0 / 1x2+3+4 @4x4; - display d9:0 11x22+33+44 / 111x222+333+444 @1000x1100; -} diff --git a/hw/dmx/config/vdltodmx.c b/hw/dmx/config/vdltodmx.c deleted file mode 100644 index 007416b33..000000000 --- a/hw/dmx/config/vdltodmx.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include "dmxconfig.h" -#include "dmxparse.h" -#include "dmxprint.h" -#include "dmxcompat.h" - -int -main(int argc, char **argv) -{ - DMXConfigEntryPtr entry; - FILE *str; - - if (argc != 2 && argc != 3) { - fprintf(stderr, "Usage: vdltodmx inFile [outFile]\n"); - return 1; - } - if (argc == 2) { - str = stdout; - } - else if (!(str = fopen(argv[2], "w"))) { - fprintf(stderr, "Cannot open %s for write\n", argv[2]); - return 2; - } - entry = dmxVDLRead(argv[1]); - dmxConfigPrint(str, entry); - return 0; -} diff --git a/hw/dmx/config/xdmxconfig.c b/hw/dmx/config/xdmxconfig.c deleted file mode 100644 index 8cb861c74..000000000 --- a/hw/dmx/config/xdmxconfig.c +++ /dev/null @@ -1,1231 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Intrinsic.h> -#include <X11/StringDefs.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Box.h> -/* #include <X11/Xaw/Paned.h> */ -#include <X11/Xaw/Command.h> -#include <X11/Xaw/SimpleMenu.h> -#include <X11/Xaw/SmeBSB.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/Viewport.h> -#include <X11/Xaw/Dialog.h> -#include <X11/keysym.h> -#include "Canvas.h" - -#include "dmxparse.h" -#include "dmxprint.h" -#include "dmxlog.h" - -extern int yyparse(void); -extern int yydebug; -extern FILE *yyin; - -#define DMX_INFO "xdmxconfig v0.9\nCopyright 2002 Red Hat Inc.\n" - -#define DMX_MAIN_WIDTH 800 -#define DMX_MAIN_HEIGHT 600 -#define DMX_DATA_WIDTH 200 -#define DMX_DATA_HEIGHT 200 -#define DMX_CANVAS_WIDTH 400 -#define DMX_CANVAS_HEIGHT 500 - -static DMXConfigVirtualPtr dmxConfigCurrent, dmxConfigNewVirtual; -static DMXConfigDisplayPtr dmxConfigCurrentDisplay, dmxConfigNewDisplay; -static int dmxConfigGrabbed, dmxConfigGrabbedFine; -static int dmxConfigGrabbedX, dmxConfigGrabbedY; -static char *dmxConfigFilename; -static GC dmxConfigGC, dmxConfigGCRev, dmxConfigGCHL; -static int dmxConfigGCInit = 0; -static Dimension dmxConfigWidgetWidth, dmxConfigWidgetHeight; -static Dimension dmxConfigWallWidth, dmxConfigWallHeight; -static double dmxConfigScaleX, dmxConfigScaleY; -static int dmxConfigNotSaved; -static enum { - dmxConfigStateOpen, - dmxConfigStateSave -} dmxConfigState; - -/* Global widgets */ -static Widget canvas; -static Widget cnamebox, cdimbox; -static Widget openpopup, opendialog; -static Widget namebox, dimbox, rtbox, origbox; -static Widget okbutton, buttonpopup; -static Widget ecbutton, dcbutton; -static Widget ndbutton0, ndbutton1, edbutton, ddbutton; -static Widget ecpopup, ecdialog0, ecdialog1; -static Widget edpopup, eddialog0, eddialog1, eddialog2; -static Widget aboutpopup, quitpopup; - -static void -dmxConfigCanvasGCs(void) -{ - Display *dpy = XtDisplay(canvas); - Window win = XtWindow(canvas); - XGCValues gcvals; - unsigned long mask; - Colormap colormap; - XColor fg, bg, hl, tmp; - - if (dmxConfigGCInit++) - return; - - XtVaGetValues(canvas, XtNcolormap, &colormap, NULL); - XAllocNamedColor(XtDisplay(canvas), colormap, "black", &bg, &tmp); - XAllocNamedColor(XtDisplay(canvas), colormap, "white", &fg, &tmp); - XAllocNamedColor(XtDisplay(canvas), colormap, "red", &hl, &tmp); - - mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground | - GCBackground | GCLineWidth | GCLineStyle | GCCapStyle | - GCFillStyle); - - /* FIXME: copy this from widget */ - gcvals.function = GXcopy; - gcvals.plane_mask = AllPlanes; - gcvals.clip_mask = None; - gcvals.foreground = fg.pixel; - gcvals.background = bg.pixel; - gcvals.line_width = 0; - gcvals.line_style = LineSolid; - gcvals.cap_style = CapNotLast; - gcvals.fill_style = FillSolid; - - dmxConfigGC = XCreateGC(dpy, win, mask, &gcvals); - gcvals.foreground = hl.pixel; - dmxConfigGCHL = XCreateGC(dpy, win, mask, &gcvals); - gcvals.foreground = bg.pixel; - gcvals.background = fg.pixel; - dmxConfigGCRev = XCreateGC(dpy, win, mask, &gcvals); -} - -static void -dmxConfigGetDims(int *maxWidth, int *maxHeight) -{ - DMXConfigSubPtr pt; - DMXConfigEntryPtr e; - - *maxWidth = dmxConfigWallWidth = 0; - *maxHeight = dmxConfigWallHeight = 0; - if (!dmxConfigCurrent) - return; - - dmxConfigWallWidth = dmxConfigCurrent->width; - dmxConfigWallHeight = dmxConfigCurrent->height; - if (!dmxConfigWallWidth || !dmxConfigWallHeight) { - for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { - if (pt->type == dmxConfigDisplay) { - int x = pt->display->scrnWidth + pt->display->rootXOrigin; - int y = pt->display->scrnHeight + pt->display->rootYOrigin; - - if (x > dmxConfigWallWidth) - dmxConfigWallWidth = x; - if (y > dmxConfigWallHeight) - dmxConfigWallHeight = y; - } - } - } - /* Compute maximums */ - *maxWidth = *maxHeight = 0; - for (e = dmxConfigEntry; e; e = e->next) { - if (e->type != dmxConfigVirtual) - continue; - for (pt = e->virtual->subentry; pt; pt = pt->next) { - if (pt->type == dmxConfigDisplay) { - int x = pt->display->scrnWidth + pt->display->rootXOrigin; - int y = pt->display->scrnHeight + pt->display->rootYOrigin; - - if (x > *maxWidth) - *maxWidth = x; - if (y > *maxHeight) - *maxHeight = y; - } - } - } - if (dmxConfigWallWidth > *maxWidth) - *maxWidth = dmxConfigWallWidth; - if (dmxConfigWallHeight > *maxHeight) - *maxHeight = dmxConfigWallHeight; -} - -static int -scalex(int x) -{ - return (int) ((x * dmxConfigScaleX) + .5); -} - -static int -scaley(int y) -{ - return (int) ((y * dmxConfigScaleY) + .5); -} - -static int -unscalex(int x) -{ - return (int) ((x / dmxConfigScaleX) + .5); -} - -static int -unscaley(int y) -{ - return (int) ((y / dmxConfigScaleY) + .5); -} - -static void -dmxConfigDataUpdate(void) -{ - /* FIXME: could result in buffer overflows */ - char cnambuf[512]; - char cdimbuf[128]; - char nambuf[512]; - char dimbuf[128]; - char rtbuf[128]; - char offbuf[128]; - const char *name; - - if (!dmxConfigCurrent) { - XtVaSetValues(cnamebox, XtNlabel, "", XtNsensitive, False, NULL); - XtVaSetValues(cdimbox, XtNlabel, "", XtNsensitive, False, NULL); - XtVaSetValues(ecbutton, XtNsensitive, False, NULL); - XtVaSetValues(dcbutton, XtNsensitive, False, NULL); - XtVaSetValues(ndbutton0, XtNsensitive, False, NULL); - XtVaSetValues(ndbutton1, XtNsensitive, False, NULL); - } - else { - name = dmxConfigCurrent->name; - snprintf(cnambuf, sizeof(cnambuf), "%s", name ? name : ""); - snprintf(cdimbuf, sizeof(cdimbuf), "%dx%d", - dmxConfigWallWidth, dmxConfigWallHeight); - XtVaSetValues(cnamebox, XtNlabel, cnambuf, XtNsensitive, True, NULL); - XtVaSetValues(cdimbox, XtNlabel, cdimbuf, XtNsensitive, True, NULL); - XtVaSetValues(ecbutton, XtNsensitive, True, NULL); - XtVaSetValues(dcbutton, XtNsensitive, True, NULL); - XtVaSetValues(ndbutton0, XtNsensitive, True, NULL); - XtVaSetValues(ndbutton1, XtNsensitive, True, NULL); - } - - if (!dmxConfigCurrentDisplay) { - XtVaSetValues(namebox, XtNlabel, "", XtNsensitive, False, NULL); - XtVaSetValues(dimbox, XtNlabel, "", XtNsensitive, False, NULL); - XtVaSetValues(rtbox, XtNlabel, "", XtNsensitive, False, NULL); - XtVaSetValues(origbox, XtNlabel, "", XtNsensitive, False, NULL); - XtVaSetValues(edbutton, XtNsensitive, False, NULL); - XtVaSetValues(ddbutton, XtNsensitive, False, NULL); - } - else { - name = dmxConfigCurrentDisplay->name; - snprintf(nambuf, sizeof(nambuf), "%s", name ? name : ""); - snprintf(dimbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", - dmxConfigCurrentDisplay->scrnWidth, - dmxConfigCurrentDisplay->scrnHeight, - dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+', - dmxConfigCurrentDisplay->scrnX, - dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+', - dmxConfigCurrentDisplay->scrnY); - snprintf(rtbuf, sizeof(dimbuf), "%dx%d%c%d%c%d", - dmxConfigCurrentDisplay->rootWidth, - dmxConfigCurrentDisplay->rootHeight, - dmxConfigCurrentDisplay->rootXSign < 0 ? '-' : '+', - dmxConfigCurrentDisplay->rootX, - dmxConfigCurrentDisplay->rootYSign < 0 ? '-' : '+', - dmxConfigCurrentDisplay->rootY); - snprintf(offbuf, sizeof(offbuf), "@%dx%d", - dmxConfigCurrentDisplay->rootXOrigin, - dmxConfigCurrentDisplay->rootYOrigin); - XtVaSetValues(namebox, XtNlabel, nambuf, XtNsensitive, True, NULL); - XtVaSetValues(dimbox, XtNlabel, dimbuf, XtNsensitive, True, NULL); - XtVaSetValues(rtbox, XtNlabel, rtbuf, XtNsensitive, True, NULL); - XtVaSetValues(origbox, XtNlabel, offbuf, XtNsensitive, True, NULL); - XtVaSetValues(edbutton, XtNsensitive, True, NULL); - XtVaSetValues(ddbutton, XtNsensitive, True, NULL); - } -} - -static void -dmxConfigCanvasUpdate(void) -{ - DMXConfigSubPtr pt; - Display *dpy = XtDisplay(canvas); - Window win = XtWindow(canvas); - GContext gcontext = XGContextFromGC(dmxConfigGC); - XFontStruct *fs; - int w, h; - - XFillRectangle(dpy, win, dmxConfigGCRev, - 0, 0, dmxConfigWidgetWidth, dmxConfigWidgetHeight); - dmxConfigDataUpdate(); - if (!dmxConfigCurrent) - return; - - w = scalex(dmxConfigWallWidth); - h = scaley(dmxConfigWallHeight); - if (w > dmxConfigWidgetWidth - 1) - w = dmxConfigWidgetWidth - 1; - if (h > dmxConfigWidgetHeight - 1) - h = dmxConfigWidgetHeight - 1; - XDrawRectangle(dpy, win, dmxConfigGC, 0, 0, w, h); - fs = XQueryFont(dpy, gcontext); - for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { - int x, y, len; - GC gc; - - if (pt->type != dmxConfigDisplay) - continue; - gc = (pt->display == dmxConfigCurrentDisplay - ? dmxConfigGCHL : dmxConfigGC); - x = scalex(pt->display->rootXOrigin); - y = scaley(pt->display->rootYOrigin); - w = scalex(pt->display->scrnWidth); - h = scaley(pt->display->scrnHeight); - len = pt->display->name ? strlen(pt->display->name) : 0; - if (x > dmxConfigWidgetWidth - 1) - x = dmxConfigWidgetWidth - 1; - if (y > dmxConfigWidgetHeight - 1) - y = dmxConfigWidgetHeight - 1; - XDrawRectangle(dpy, win, gc, x, y, w, h); - if (fs && len) { - int xo = 3, yo = fs->ascent + fs->descent + 2; - - while (len && XTextWidth(fs, pt->display->name, len) >= w - 2 * xo) - --len; - if (len) - XDrawString(dpy, win, gc, x + xo, y + yo, pt->display->name, - len); - } - } - if (fs) - XFreeFontInfo(NULL, fs, 0); -} - -static void -dmxConfigCanvasDraw(Region region) -{ - Display *dpy = XtDisplay(canvas); - int maxWidth, maxHeight; - - dmxConfigCanvasGCs(); - if (region) { - XSetRegion(dpy, dmxConfigGC, region); - XSetRegion(dpy, dmxConfigGCRev, region); - XSetRegion(dpy, dmxConfigGCHL, region); - } - XtVaGetValues(canvas, - XtNwidth, &dmxConfigWidgetWidth, - XtNheight, &dmxConfigWidgetHeight, NULL); - dmxConfigGetDims(&maxWidth, &maxHeight); - dmxConfigScaleX = (double) dmxConfigWidgetWidth / maxWidth; - dmxConfigScaleY = (double) dmxConfigWidgetHeight / maxHeight; - if (dmxConfigScaleX > dmxConfigScaleY) - dmxConfigScaleX = dmxConfigScaleY; - if (dmxConfigScaleY > dmxConfigScaleX) - dmxConfigScaleY = dmxConfigScaleX; - dmxConfigCanvasUpdate(); - if (region) { - XSetClipMask(dpy, dmxConfigGC, None); - XSetClipMask(dpy, dmxConfigGCRev, None); - XSetClipMask(dpy, dmxConfigGCHL, None); - } -} - -static void -dmxConfigSelectCallback(Widget w, XtPointer closure, XtPointer callData) -{ - dmxConfigCurrent = closure; - dmxConfigVirtualPrint(stdout, dmxConfigCurrent); - dmxConfigCanvasDraw(NULL); -} - -static void -dmxConfigCopystrings(void) -{ - DMXConfigEntryPtr pt; - DMXConfigSubPtr sub; - - if (!dmxConfigCurrent) - return; - - /* FIXME: this is all a per-config file - * memory leak */ - for (pt = dmxConfigEntry; pt; pt = pt->next) { - if (pt->type == dmxConfigVirtual) { - pt->virtual->name = XtNewString(pt->virtual->name - ? pt->virtual->name : ""); - - for (sub = pt->virtual->subentry; sub; sub = sub->next) { - if (sub->type != dmxConfigDisplay) - continue; - sub->display->name = XtNewString(sub->display->name - ? sub->display->name : ""); - } - } - } -} - -static void -dmxConfigGetValueString(char **d, Widget w) -{ - const char *tmp = XawDialogGetValueString(w); - - if (*d) - XtFree(*d); - *d = XtNewString(tmp); -} - -static void -dmxConfigSetupCnamemenu(void) -{ - static Widget cnamemenu = NULL; - Widget w; - DMXConfigEntryPtr pt; - - if (cnamemenu) - XtDestroyWidget(cnamemenu); - cnamemenu = NULL; - - if (!dmxConfigCurrent) - return; - cnamemenu = XtVaCreatePopupShell("cnamemenu", simpleMenuWidgetClass, - cnamebox, NULL); - - for (pt = dmxConfigEntry; pt; pt = pt->next) { - if (pt->type == dmxConfigVirtual) { - w = XtVaCreateManagedWidget(pt->virtual->name - ? pt->virtual->name - : "", - smeBSBObjectClass, cnamemenu, NULL); - XtAddCallback(w, XtNcallback, dmxConfigSelectCallback, pt->virtual); - } - } -} - -static void -dmxConfigReadFile(void) -{ - FILE *str; - DMXConfigEntryPtr pt; - - if (!(str = fopen(dmxConfigFilename, "r"))) { - dmxLog(dmxWarning, "Unable to read configuration file %s\n", - dmxConfigFilename); - return; - } - yyin = str; - yydebug = 0; - yyparse(); - fclose(str); - dmxLog(dmxInfo, "Read configuration file %s\n", dmxConfigFilename); - - for (pt = dmxConfigEntry; pt; pt = pt->next) { - if (pt->type == dmxConfigVirtual) { - dmxConfigCurrent = pt->virtual; - break; - } - } - - if (XtIsRealized(canvas)) { - dmxConfigCopystrings(); - dmxConfigSetupCnamemenu(); - dmxConfigCanvasDraw(NULL); - } - dmxConfigVirtualPrint(stdout, dmxConfigCurrent); -} - -static void -dmxConfigWriteFile(void) -{ - FILE *str; - - if (!(str = fopen(dmxConfigFilename, "w"))) { - dmxLog(dmxWarning, "Unable to write configuration file %s\n", - dmxConfigFilename); - return; - } - dmxConfigPrint(str, dmxConfigEntry); - fclose(str); -} - -static DMXConfigDisplayPtr -dmxConfigFindDisplay(int x, int y) -{ - DMXConfigSubPtr pt; - - if (!dmxConfigCurrent) - return NULL; - for (pt = dmxConfigCurrent->subentry; pt; pt = pt->next) { - DMXConfigDisplayPtr d = pt->display; - - if (pt->type != dmxConfigDisplay) - continue; - if (x >= scalex(d->rootXOrigin) - && x <= scalex(d->rootXOrigin + d->scrnWidth) - && y >= scaley(d->rootYOrigin) - && y <= scaley(d->rootYOrigin + d->scrnHeight)) - return d; - } - return NULL; -} - -static void -dmxConfigSetPopupPosition(Widget popup) -{ - Position x, y; - Window t1, t2; - int root_x, root_y; - int temp_x, temp_y; - unsigned int temp; - - XtRealizeWidget(popup); - if (!XQueryPointer(XtDisplay(popup), XtWindow(popup), &t1, &t2, - &root_x, &root_y, &temp_x, &temp_y, &temp)) - root_x = root_y = 0; - - x = root_x - 5; - y = root_y - 5; - XtVaSetValues(popup, XtNx, x, XtNy, y, NULL); -} - -static void -dmxConfigPlaceMenu(Widget w, XEvent * event, - String * params, Cardinal * num_params) -{ - dmxConfigSetPopupPosition(buttonpopup); -} - -static void -dmxConfigMove(int deltaX, int deltaY) -{ - dmxConfigCurrentDisplay->rootXOrigin += deltaX; - dmxConfigCurrentDisplay->rootYOrigin += deltaY; - if (dmxConfigCurrentDisplay->rootXOrigin < 0) - dmxConfigCurrentDisplay->rootXOrigin = 0; - if (dmxConfigCurrentDisplay->rootYOrigin < 0) - dmxConfigCurrentDisplay->rootYOrigin = 0; - if (dmxConfigWallWidth && dmxConfigWallHeight) { - if (dmxConfigCurrentDisplay->rootXOrigin >= dmxConfigWallWidth) - dmxConfigCurrentDisplay->rootXOrigin = dmxConfigWallWidth - 1; - if (dmxConfigCurrentDisplay->rootYOrigin >= dmxConfigWallHeight) - dmxConfigCurrentDisplay->rootYOrigin = dmxConfigWallHeight - 1; - } - dmxConfigCanvasUpdate(); - dmxConfigNotSaved = 1; -} - -static void -dmxConfigCanvasInput(Widget w, XtPointer closure, XtPointer callData) -{ - XEvent *e = (XEvent *) callData; - DMXConfigDisplayPtr display = NULL; - - switch (e->type) { - case ButtonPress: - if (e->xbutton.button == Button1) { - dmxConfigGrabbed = 1; - dmxConfigGrabbedFine = 0; - dmxConfigGrabbedX = e->xbutton.x; - dmxConfigGrabbedY = e->xbutton.y; - } - if (e->xbutton.button == Button2) { - dmxConfigGrabbed = 1; - dmxConfigGrabbedFine = 1; - dmxConfigGrabbedX = e->xbutton.x; - dmxConfigGrabbedY = e->xbutton.y; - } - break; - case ButtonRelease: - if (e->xbutton.button == Button1) - dmxConfigGrabbed = 0; - if (e->xbutton.button == Button2) - dmxConfigGrabbed = 0; - break; - case MotionNotify: - if (dmxConfigGrabbed && dmxConfigCurrentDisplay) { - int deltaX = e->xmotion.x - dmxConfigGrabbedX; - int deltaY = e->xmotion.y - dmxConfigGrabbedY; - - dmxConfigMove(dmxConfigGrabbedFine ? deltaX : unscalex(deltaX), - dmxConfigGrabbedFine ? deltaY : unscaley(deltaY)); - dmxConfigGrabbedX = e->xmotion.x; - dmxConfigGrabbedY = e->xmotion.y; - } - else { - display = dmxConfigFindDisplay(e->xmotion.x, e->xmotion.y); - if (display != dmxConfigCurrentDisplay) { - dmxConfigCurrentDisplay = display; - dmxConfigCanvasUpdate(); - } - } - break; - case KeyPress: - switch (XLookupKeysym(&e->xkey, 0)) { - case XK_Right: - dmxConfigMove(1, 0); - break; - case XK_Left: - dmxConfigMove(-1, 0); - break; - case XK_Down: - dmxConfigMove(0, 1); - break; - case XK_Up: - dmxConfigMove(0, -1); - break; - } - break; - } -} - -static void -dmxConfigCanvasResize(Widget w, XtPointer closure, XtPointer callData) -{ - dmxConfigCanvasDraw(NULL); -} - -static void -dmxConfigCanvasExpose(Widget w, XtPointer closure, XtPointer callData) -{ - CanvasExposeDataPtr data = (CanvasExposeDataPtr) callData; - - dmxConfigCanvasDraw(data->region); -} - -static void -dmxConfigOpenCallback(Widget w, XtPointer closure, XtPointer callData) -{ - dmxConfigState = dmxConfigStateOpen; - XtVaSetValues(okbutton, XtNlabel, "Open", NULL); - dmxConfigSetPopupPosition(openpopup); - XtPopup(openpopup, XtGrabExclusive); -} - -static void -dmxConfigSaveCallback(Widget w, XtPointer closure, XtPointer callData) -{ - dmxConfigState = dmxConfigStateSave; - XtVaSetValues(okbutton, XtNlabel, "Save", NULL); - dmxConfigSetPopupPosition(openpopup); - XtPopup(openpopup, XtGrabExclusive); -} - -static void -dmxConfigOkCallback(Widget w, XtPointer closure, XtPointer callData) -{ - dmxConfigGetValueString(&dmxConfigFilename, opendialog); - XtPopdown(openpopup); - if (dmxConfigState == dmxConfigStateOpen) - dmxConfigReadFile(); - else - dmxConfigWriteFile(); - dmxConfigNotSaved = 0; -} - -static void -dmxConfigCanCallback(Widget w, XtPointer closure, XtPointer callData) -{ - XtPopdown(openpopup); -} - -static void -dmxConfigECCallback(Widget w, XtPointer closure, XtPointer callData) -{ - char buf[256]; /* RATS: Only used in snprintf */ - - if (!dmxConfigCurrent) - return; - dmxConfigSetPopupPosition(ecpopup); - XtVaSetValues(ecdialog0, XtNvalue, - dmxConfigCurrent->name ? dmxConfigCurrent->name : "", NULL); - snprintf(buf, sizeof(buf), "%dx%d", - dmxConfigCurrent->width, dmxConfigCurrent->height); - XtVaSetValues(ecdialog1, XtNvalue, buf, NULL); - XtPopup(ecpopup, XtGrabExclusive); -} - -static void -dmxConfigNCCallback(Widget w, XtPointer closure, XtPointer callData) -{ - int width = 1280 * 2, height = 1024 * 2; - - if (dmxConfigCurrent) { - width = dmxConfigCurrent->width; - height = dmxConfigCurrent->height; - } - - dmxConfigCurrent = dmxConfigCreateVirtual(NULL, NULL, NULL, - NULL, NULL, NULL); - dmxConfigNewVirtual = dmxConfigCurrent; - dmxConfigCurrent->width = width; - dmxConfigCurrent->height = height; - dmxConfigEntry = dmxConfigAddEntry(dmxConfigEntry, dmxConfigVirtual, NULL, - dmxConfigCurrent); - dmxConfigECCallback(w, closure, callData); -} - -static void -dmxConfigDCCallback(Widget w, XtPointer closure, XtPointer callData) -{ - DMXConfigEntryPtr pt; - - if (!dmxConfigEntry) - return; - if (dmxConfigEntry - && dmxConfigEntry->type == dmxConfigVirtual - && dmxConfigEntry->virtual == dmxConfigCurrent) { - dmxConfigEntry = dmxConfigEntry->next; - } - else { - for (pt = dmxConfigEntry; pt && pt->next; pt = pt->next) - if (pt->next->type == dmxConfigVirtual - && pt->next->virtual == dmxConfigCurrent) { - pt->next = pt->next->next; - break; - } - } - dmxConfigFreeVirtual(dmxConfigCurrent); - dmxConfigCurrent = NULL; - dmxConfigCurrentDisplay = NULL; - - /* Make the first entry current */ - for (pt = dmxConfigEntry; pt; pt = pt->next) { - if (pt->type == dmxConfigVirtual) { - dmxConfigCurrent = pt->virtual; - break; - } - } - - dmxConfigSetupCnamemenu(); - dmxConfigCanvasDraw(NULL); -} - -static void -dmxConfigECOkCallback(Widget w, XtPointer closure, XtPointer callData) -{ - const char *value; - char *endpt; - - dmxConfigGetValueString((char **) &dmxConfigCurrent->name, ecdialog0); - value = XawDialogGetValueString(ecdialog1); - dmxConfigCurrent->width = strtol(value, &endpt, 10); - dmxConfigCurrent->height = strtol(endpt + 1, NULL, 10); - XtPopdown(ecpopup); - dmxConfigCurrentDisplay = NULL; - dmxConfigNewVirtual = NULL; - dmxConfigSetupCnamemenu(); - dmxConfigCanvasDraw(NULL); - dmxConfigNotSaved = 1; -} - -static void -dmxConfigECCanCallback(Widget w, XtPointer closure, XtPointer callData) -{ - if (dmxConfigNewVirtual) - dmxConfigDCCallback(w, closure, callData); - dmxConfigNewVirtual = NULL; - XtPopdown(ecpopup); -} - -static void -dmxConfigEDCallback(Widget w, XtPointer closure, XtPointer callData) -{ - char buf[256]; /* RATS: Only used in snprintf */ - - if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) - return; - dmxConfigSetPopupPosition(edpopup); - XtVaSetValues(eddialog0, XtNvalue, - dmxConfigCurrentDisplay->name - ? dmxConfigCurrentDisplay->name : "", NULL); - snprintf(buf, sizeof(buf), "%dx%d%c%d%c%d", - dmxConfigCurrentDisplay->scrnWidth, - dmxConfigCurrentDisplay->scrnHeight, - dmxConfigCurrentDisplay->scrnXSign < 0 ? '-' : '+', - dmxConfigCurrentDisplay->scrnY, - dmxConfigCurrentDisplay->scrnYSign < 0 ? '-' : '+', - dmxConfigCurrentDisplay->scrnY); - XtVaSetValues(eddialog1, XtNvalue, buf, NULL); - snprintf(buf, sizeof(buf), "@%dx%d", - dmxConfigCurrentDisplay->rootXOrigin, - dmxConfigCurrentDisplay->rootYOrigin); - XtVaSetValues(eddialog2, XtNvalue, buf, NULL); - XtPopup(edpopup, XtGrabExclusive); -} - -static void -dmxConfigNDCallback(Widget w, XtPointer closure, XtPointer callData) -{ - int width = 1280, height = 1024; - - if (!dmxConfigCurrent) - return; - if (dmxConfigCurrentDisplay) { - width = dmxConfigCurrentDisplay->scrnWidth; - height = dmxConfigCurrentDisplay->scrnHeight; - } - dmxConfigCurrentDisplay = dmxConfigCreateDisplay(NULL, NULL, NULL, - NULL, NULL); - dmxConfigNewDisplay = dmxConfigCurrentDisplay; - dmxConfigCurrentDisplay->scrnWidth = width; - dmxConfigCurrentDisplay->scrnHeight = height; - - dmxConfigCurrent->subentry - = dmxConfigAddSub(dmxConfigCurrent->subentry, - dmxConfigSubDisplay(dmxConfigCurrentDisplay)); - dmxConfigEDCallback(w, closure, callData); -} - -static void -dmxConfigDDCallback(Widget w, XtPointer closure, XtPointer callData) -{ - DMXConfigSubPtr pt; - - if (!dmxConfigCurrent || !dmxConfigCurrentDisplay) - return; - /* First */ - if (dmxConfigCurrent->subentry - && dmxConfigCurrent->subentry->type == dmxConfigDisplay - && dmxConfigCurrent->subentry->display == dmxConfigCurrentDisplay) { - dmxConfigCurrent->subentry = dmxConfigCurrent->subentry->next; - } - else { - for (pt = dmxConfigCurrent->subentry; pt && pt->next; pt = pt->next) - if (pt->next->type == dmxConfigDisplay - && pt->next->display == dmxConfigCurrentDisplay) { - pt->next = pt->next->next; - break; - } - } - dmxConfigFreeDisplay(dmxConfigCurrentDisplay); - dmxConfigCurrentDisplay = NULL; - dmxConfigSetupCnamemenu(); - dmxConfigCanvasDraw(NULL); -} - -static void -dmxConfigAboutCallback(Widget w, XtPointer closure, XtPointer callData) -{ - dmxConfigSetPopupPosition(aboutpopup); - XtPopup(aboutpopup, XtGrabExclusive); -} - -static void -dmxConfigAboutOkCallback(Widget w, XtPointer closure, XtPointer CallData) -{ - XtPopdown(aboutpopup); -} - -static void -dmxConfigQuitCallback(Widget w, XtPointer closure, XtPointer callData) -{ - if (dmxConfigNotSaved) { - dmxConfigSetPopupPosition(quitpopup); - XtPopup(quitpopup, XtGrabExclusive); - return; - } - exit(0); -} - -static void -dmxConfigQuitOkCallback(Widget w, XtPointer closure, XtPointer callData) -{ - XtPopdown(quitpopup); - exit(0); -} - -static void -dmxConfigQuitCanCallback(Widget w, XtPointer closure, XtPointer callData) -{ - XtPopdown(quitpopup); -} - -static void -dmxConfigEDOkCallback(Widget w, XtPointer closure, XtPointer callData) -{ - char *value; - char *endpt; - - dmxConfigNewDisplay = NULL; - dmxConfigGetValueString((char **) &dmxConfigCurrentDisplay->name, - eddialog0); - value = XawDialogGetValueString(eddialog1); - if (*value == '-' || *value == '+') { - dmxConfigCurrentDisplay->scrnWidth = 0; - dmxConfigCurrentDisplay->scrnHeight = 0; - endpt = value; - } - else { - dmxConfigCurrentDisplay->scrnWidth = strtol(value, &endpt, 10); - dmxConfigCurrentDisplay->scrnHeight = strtol(endpt + 1, &endpt, 10); - } - if (*endpt) { - dmxConfigCurrentDisplay->scrnXSign = (*endpt == '-') ? -1 : 1; - dmxConfigCurrentDisplay->scrnX = strtol(endpt + 1, &endpt, 10); - dmxConfigCurrentDisplay->scrnYSign = (*endpt == '-') ? -1 : 1; - dmxConfigCurrentDisplay->scrnY = strtol(endpt + 1, NULL, 10); - } - if (dmxConfigCurrentDisplay->scrnX < 0) - dmxConfigCurrentDisplay->scrnX = -dmxConfigCurrentDisplay->scrnX; - if (dmxConfigCurrentDisplay->scrnY < 0) - dmxConfigCurrentDisplay->scrnY = -dmxConfigCurrentDisplay->scrnY; - value = XawDialogGetValueString(eddialog2); - dmxConfigCurrentDisplay->rootXOrigin = strtol(value + 1, &endpt, 10); - dmxConfigCurrentDisplay->rootYOrigin = strtol(endpt + 1, NULL, 10); - XtPopdown(edpopup); - dmxConfigSetupCnamemenu(); - dmxConfigCanvasDraw(NULL); - dmxConfigNotSaved = 1; -} - -static void -dmxConfigEDCanCallback(Widget w, XtPointer closure, XtPointer callData) -{ - if (dmxConfigNewDisplay) - dmxConfigDDCallback(w, closure, callData); - dmxConfigNewDisplay = NULL; - XtPopdown(edpopup); -} - -static void -dmxConfigOkAction(Widget w, XEvent * event, - String * params, Cardinal * num_params) -{ - Widget p = XtParent(w); - Widget t; - - if (p == opendialog) - dmxConfigOkCallback(w, NULL, NULL); - - if (p == ecdialog0) { - t = XtNameToWidget(ecdialog1, "value"); - XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10); - } - if (p == ecdialog1) - dmxConfigECOkCallback(w, NULL, NULL); - - if (p == eddialog0) { - t = XtNameToWidget(eddialog1, "value"); - XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10); - } - if (p == eddialog1) { - t = XtNameToWidget(eddialog2, "value"); - XWarpPointer(XtDisplay(t), None, XtWindow(t), 0, 0, 0, 0, 0, 10); - } - if (p == eddialog2) - dmxConfigEDOkCallback(w, NULL, NULL); -} - -int -main(int argc, char **argv) -{ - XtAppContext appContext; - Widget toplevel; - Widget parent, menubox, bottombox, databox, canvasbox; - Widget filebutton, helpbutton; - Widget filemenu, openbutton, savebutton, quitbutton; - Widget helpmenu, aboutbutton, aboutbox, aboutok; - Widget quitbox, quitok, quitcan; - Widget ncbutton; - Widget canbutton; - Widget ecbox, ecokbutton, eccanbutton; - Widget edbox, edokbutton; - Widget edcanbutton; - - /* FIXME: add meta-i, ctrl,meta-z,v? */ - const char *opentrans = "<Key>Return: openOk()\n\ - <Key>Linefeed: openOk()\n\ - Ctrl<Key>M: openOk()\n\ - Ctrl<Key>J: openOk()\n\ - Ctrl<Key>O: noop()\n\ - Ctrl<Key>N: noop()\n\ - Ctrl<Key>P: noop()"; - const char *canvastrans = - "<Btn3Down>: placeMenu() XtMenuPopup(buttonpopup)"; - XtActionsRec actiontable[] = { - {(char *) "openOk", dmxConfigOkAction}, - {(char *) "placeMenu", dmxConfigPlaceMenu}, - {(char *) "noop", NULL} - }; - - dmxConfigFilename = XtNewString((argc >= 2) ? argv[1] : ""); - - toplevel = XtVaAppInitialize(&appContext, "XDmxconfig", - NULL, 0, &argc, argv, NULL, NULL); - - /* Main boxes */ - parent = XtVaCreateManagedWidget("parent", formWidgetClass, toplevel, - XtNorientation, XtorientVertical, - XtNwidth, DMX_MAIN_WIDTH, - XtNheight, DMX_MAIN_HEIGHT, NULL); - menubox = XtVaCreateManagedWidget("menubox", boxWidgetClass, parent, - XtNborderWidth, 0, - XtNorientation, XtorientHorizontal, - XtNtop, XtChainTop, NULL); - bottombox = XtVaCreateManagedWidget("bottombox", formWidgetClass, parent, - XtNborderWidth, 0, - XtNfromVert, menubox, - XtNorientation, XtorientHorizontal, - NULL); - databox = XtVaCreateManagedWidget("databox", formWidgetClass, - bottombox, - XtNborderWidth, 0, - XtNhorizDistance, 0, - XtNwidth, DMX_DATA_WIDTH, - XtNheight, DMX_DATA_HEIGHT, - XtNleft, XtChainLeft, - XtNorientation, XtorientVertical, NULL); - - /* Data */ - cnamebox = XtVaCreateManagedWidget("cnamebox", menuButtonWidgetClass, - databox, - XtNtop, XtChainTop, - XtNjustify, XtJustifyLeft, - XtNwidth, DMX_DATA_WIDTH, - XtNlabel, "", - XtNmenuName, "cnamemenu", NULL); - cdimbox = XtVaCreateManagedWidget("cdimbox", labelWidgetClass, - databox, - XtNfromVert, cnamebox, - XtNjustify, XtJustifyLeft, - XtNwidth, DMX_DATA_WIDTH, - XtNlabel, "", NULL); - namebox = XtVaCreateManagedWidget("namebox", labelWidgetClass, databox, - XtNfromVert, cdimbox, - XtNjustify, XtJustifyLeft, - XtNwidth, DMX_DATA_WIDTH, - XtNlabel, "", NULL); - dimbox = XtVaCreateManagedWidget("dimbox", labelWidgetClass, - databox, - XtNfromVert, namebox, - XtNjustify, XtJustifyLeft, - XtNwidth, DMX_DATA_WIDTH, - XtNlabel, "", NULL); - rtbox = XtVaCreateManagedWidget("rtbox", labelWidgetClass, - databox, - XtNfromVert, dimbox, - XtNjustify, XtJustifyLeft, - XtNwidth, DMX_DATA_WIDTH, - XtNlabel, "", NULL); - origbox = XtVaCreateManagedWidget("origbox", labelWidgetClass, - databox, - XtNfromVert, rtbox, - XtNjustify, XtJustifyLeft, - XtNwidth, DMX_DATA_WIDTH, - XtNlabel, "", NULL); - - /* Canvas */ - canvasbox = XtVaCreateManagedWidget("canvasbox", boxWidgetClass, - bottombox, - XtNborderWidth, 0, - XtNwidth, DMX_CANVAS_WIDTH, - XtNheight, DMX_CANVAS_HEIGHT, - XtNfromHoriz, databox, NULL); - - canvas = XtVaCreateManagedWidget("canvas", canvasWidgetClass, - canvasbox, - XtNwidth, DMX_CANVAS_WIDTH, - XtNheight, DMX_CANVAS_HEIGHT, NULL); - - /* Main menu buttons */ - filebutton = XtVaCreateManagedWidget("File", menuButtonWidgetClass, - menubox, - XtNmenuName, "filemenu", NULL); - helpbutton = XtVaCreateManagedWidget("Help", menuButtonWidgetClass, - menubox, - XtNmenuName, "helpmenu", NULL); - - /* File submenu buttons */ - filemenu = XtVaCreatePopupShell("filemenu", simpleMenuWidgetClass, - filebutton, NULL); - openbutton = XtVaCreateManagedWidget("Open File", smeBSBObjectClass, - filemenu, NULL); - savebutton = XtVaCreateManagedWidget("Save File", smeBSBObjectClass, - filemenu, NULL); - ncbutton = XtVaCreateManagedWidget("New Global", smeBSBObjectClass, - filemenu, NULL); - ecbutton = XtVaCreateManagedWidget("Edit Global", smeBSBObjectClass, - filemenu, NULL); - dcbutton = XtVaCreateManagedWidget("Delete Global", smeBSBObjectClass, - filemenu, NULL); - ndbutton0 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass, - filemenu, NULL); - quitbutton = XtVaCreateManagedWidget("Quit", smeBSBObjectClass, - filemenu, NULL); - - /* Help submenu button */ - helpmenu = XtVaCreatePopupShell("helpmenu", simpleMenuWidgetClass, - helpbutton, NULL); - aboutbutton = XtVaCreateManagedWidget("About", smeBSBObjectClass, - helpmenu, NULL); - - /* Open popup */ - openpopup = XtVaCreatePopupShell("openpopup", transientShellWidgetClass, - toplevel, NULL); - opendialog = XtVaCreateManagedWidget("opendialog", dialogWidgetClass, - openpopup, - XtNlabel, "Filename: ", - XtNvalue, dmxConfigFilename, NULL); - okbutton = XtVaCreateManagedWidget("Open", commandWidgetClass, - opendialog, NULL); - canbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass, - opendialog, NULL); - - /* EC popup */ - ecpopup = XtVaCreatePopupShell("ecpopup", transientShellWidgetClass, - toplevel, NULL); - ecbox = XtVaCreateManagedWidget("ecbox", boxWidgetClass, ecpopup, NULL); - ecdialog0 = XtVaCreateManagedWidget("ecdialog0", dialogWidgetClass, - ecbox, - XtNlabel, "Name: ", - XtNvalue, "", NULL); - ecdialog1 = XtVaCreateManagedWidget("ecdialog1", dialogWidgetClass, - ecbox, - XtNlabel, "Dimension: ", - XtNvalue, "", NULL); - ecokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, ecbox, NULL); - eccanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass, - ecbox, NULL); - - /* ED popup */ - edpopup = XtVaCreatePopupShell("edpopup", transientShellWidgetClass, - toplevel, NULL); - edbox = XtVaCreateManagedWidget("edbox", boxWidgetClass, edpopup, NULL); - eddialog0 = XtVaCreateManagedWidget("eddialog0", dialogWidgetClass, - edbox, - XtNlabel, "Display Name: ", - XtNvalue, "", NULL); - eddialog1 = XtVaCreateManagedWidget("eddialog1", dialogWidgetClass, - edbox, - XtNlabel, "Geometry: ", - XtNvalue, "", NULL); - eddialog2 = XtVaCreateManagedWidget("eddialog2", dialogWidgetClass, - edbox, - XtNlabel, "Offset: ", - XtNvalue, "", NULL); - edokbutton = XtVaCreateManagedWidget("OK", commandWidgetClass, edbox, NULL); - edcanbutton = XtVaCreateManagedWidget("Cancel", commandWidgetClass, - edbox, NULL); - - /* About popup */ - aboutpopup = XtVaCreatePopupShell("aboutpopup", transientShellWidgetClass, - toplevel, NULL); - aboutbox = XtVaCreateManagedWidget("aboutbox", boxWidgetClass, - aboutpopup, NULL); - XtVaCreateManagedWidget("abouttext", labelWidgetClass, - aboutbox, XtNlabel, DMX_INFO, NULL); - aboutok = XtVaCreateManagedWidget("OK", commandWidgetClass, aboutbox, NULL); - - /* Quit popup */ - quitpopup = XtVaCreatePopupShell("quitpopup", transientShellWidgetClass, - toplevel, NULL); - quitbox = XtVaCreateManagedWidget("quitbox", boxWidgetClass, - quitpopup, NULL); - XtVaCreateManagedWidget("quittext", labelWidgetClass, - quitbox, - XtNlabel, - "Changes to the configuration\n" - "been made that have not yet\n" - "been saved. Do you want to\n" - "quit without saving?", NULL); - quitok = XtVaCreateManagedWidget("Quit WITHOUT Saving", - commandWidgetClass, quitbox, NULL); - quitcan = XtVaCreateManagedWidget("Continue Editing", - commandWidgetClass, quitbox, NULL); - - /* Button popup */ - buttonpopup = XtVaCreatePopupShell("buttonpopup", simpleMenuWidgetClass, - toplevel, NULL); - ndbutton1 = XtVaCreateManagedWidget("New Display", smeBSBObjectClass, - buttonpopup, NULL); - edbutton = XtVaCreateManagedWidget("Edit Display", smeBSBObjectClass, - buttonpopup, NULL); - ddbutton = XtVaCreateManagedWidget("Delete Display", smeBSBObjectClass, - buttonpopup, NULL); - - /* Callbacks */ - XtAddCallback(openbutton, XtNcallback, dmxConfigOpenCallback, NULL); - XtAddCallback(savebutton, XtNcallback, dmxConfigSaveCallback, NULL); - XtAddCallback(okbutton, XtNcallback, dmxConfigOkCallback, NULL); - XtAddCallback(canbutton, XtNcallback, dmxConfigCanCallback, NULL); - - XtAppAddActions(appContext, actiontable, XtNumber(actiontable)); - XtOverrideTranslations(canvas, XtParseTranslationTable(canvastrans)); - XtOverrideTranslations(XtNameToWidget(opendialog, "value"), - XtParseTranslationTable(opentrans)); - XtOverrideTranslations(XtNameToWidget(ecdialog0, "value"), - XtParseTranslationTable(opentrans)); - XtOverrideTranslations(XtNameToWidget(ecdialog1, "value"), - XtParseTranslationTable(opentrans)); - XtOverrideTranslations(XtNameToWidget(eddialog0, "value"), - XtParseTranslationTable(opentrans)); - XtOverrideTranslations(XtNameToWidget(eddialog1, "value"), - XtParseTranslationTable(opentrans)); - XtOverrideTranslations(XtNameToWidget(eddialog2, "value"), - XtParseTranslationTable(opentrans)); - - XtAddCallback(ncbutton, XtNcallback, dmxConfigNCCallback, NULL); - XtAddCallback(ecbutton, XtNcallback, dmxConfigECCallback, NULL); - XtAddCallback(ecokbutton, XtNcallback, dmxConfigECOkCallback, NULL); - XtAddCallback(eccanbutton, XtNcallback, dmxConfigECCanCallback, NULL); - XtAddCallback(dcbutton, XtNcallback, dmxConfigDCCallback, NULL); - - XtAddCallback(ndbutton0, XtNcallback, dmxConfigNDCallback, NULL); - XtAddCallback(ndbutton1, XtNcallback, dmxConfigNDCallback, NULL); - XtAddCallback(edbutton, XtNcallback, dmxConfigEDCallback, NULL); - XtAddCallback(ddbutton, XtNcallback, dmxConfigDDCallback, NULL); - XtAddCallback(edokbutton, XtNcallback, dmxConfigEDOkCallback, NULL); - XtAddCallback(edcanbutton, XtNcallback, dmxConfigEDCanCallback, NULL); - - XtAddCallback(aboutbutton, XtNcallback, dmxConfigAboutCallback, NULL); - XtAddCallback(aboutok, XtNcallback, dmxConfigAboutOkCallback, NULL); - XtAddCallback(quitok, XtNcallback, dmxConfigQuitOkCallback, NULL); - XtAddCallback(quitcan, XtNcallback, dmxConfigQuitCanCallback, NULL); - - XtAddCallback(quitbutton, XtNcallback, dmxConfigQuitCallback, NULL); - - XtAddCallback(canvas, XtNcallback, dmxConfigCanvasInput, NULL); - XtAddCallback(canvas, XtNcanvasExposeCallback, dmxConfigCanvasExpose, NULL); - XtAddCallback(canvas, XtNcanvasResizeCallback, dmxConfigCanvasResize, NULL); - - if (dmxConfigFilename) - dmxConfigReadFile(); - - XtRealizeWidget(toplevel); - dmxConfigCopystrings(); - dmxConfigSetupCnamemenu(); - XtAppMainLoop(appContext); - return 0; -} diff --git a/hw/dmx/dmx-config.h b/hw/dmx/dmx-config.h deleted file mode 100644 index 76a37566b..000000000 --- a/hw/dmx/dmx-config.h +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright 2005 Red Hat Inc., Raleigh, 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> - * - */ - -/** \file - * Provide configuration define's and undef's to build Xdmx in X.Org's - * modular source tree. - */ - -#ifndef DMX_CONFIG_H -#define DMX_CONFIG_H - -#include <dix-config.h> - -/* - * Note 1: This is a signed int that is printed as a decimal number. - * Since we want to make it human-interpretable, the fields are - * defined as: - * 2147483648 - * AAbbyymmdd - * AA: major version 01-20 - * bb: minor version 00-99 - * yy: year 00-99 [See Note 2] - * mm: month 01-12 - * dd: day 01-31 - * - * Note 2: The default epoch for the year is 2000. - * To change the default epoch, change the DMX_VENDOR_RELEASE - * macro below, bump the minor version number, and change - * xdpyinfo to key off the major/minor version to determine the - * new epoch. Remember to do this on January 1, 2100 and every - * 100 years thereafter. - */ -#define DMX_VENDOR_RELEASE(major,minor,year,month,day) \ - ((major) * 100000000) + \ - ((minor) * 1000000) + \ - ((year-2000) * 10000) + \ - ((month) * 100) + \ - ((day) * 1) -#define VENDOR_RELEASE DMX_VENDOR_RELEASE(1,2,2007,4,24) - -/* Enable the DMX extension */ -#define DMXEXT - -#endif /* DMX_CONFIG_H */ diff --git a/hw/dmx/dmx.c b/hw/dmx/dmx.c deleted file mode 100644 index 9020f9e91..000000000 --- a/hw/dmx/dmx.c +++ /dev/null @@ -1,1200 +0,0 @@ -/* - * Copyright 2002-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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file implements the server-side part of the DMX protocol. A - * vector of functions is provided at extension initialization time, so - * most all of the useful functions in this file are declared static and - * do not appear in the doxygen documentation. - * - * Much of the low-level work is done by functions in \a dmxextension.c - * - * Please see the Client-to-Server DMX Extension to the X Protocol - * document for details about the protocol. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "misc.h" -#include "os.h" -#include "dixstruct.h" -#include "extnsionst.h" -#include "extinit.h" -#include "opaque.h" - -#include "dmx.h" -#include "dmxextension.h" -#include <X11/extensions/dmxproto.h> -#include <X11/extensions/dmx.h> -#include "protocol-versions.h" - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -static unsigned char DMXCode; - -static int -_DMXXineramaActive(void) -{ -#ifdef PANORAMIX - return !noPanoramiXExtension; -#else - return 0; -#endif -} - -static void -dmxSetScreenAttribute(int bit, DMXScreenAttributesPtr attr, CARD32 value) -{ - switch (1 << bit) { - case DMXScreenWindowWidth: - attr->screenWindowWidth = value; - break; - case DMXScreenWindowHeight: - attr->screenWindowHeight = value; - break; - case DMXScreenWindowXoffset: - attr->screenWindowXoffset = value; - break; - case DMXScreenWindowYoffset: - attr->screenWindowYoffset = value; - break; - case DMXRootWindowWidth: - attr->rootWindowWidth = value; - break; - case DMXRootWindowHeight: - attr->rootWindowHeight = value; - break; - case DMXRootWindowXoffset: - attr->rootWindowXoffset = value; - break; - case DMXRootWindowYoffset: - attr->rootWindowYoffset = value; - break; - case DMXRootWindowXorigin: - attr->rootWindowXorigin = value; - break; - case DMXRootWindowYorigin: - attr->rootWindowYorigin = value; - break; - } -} - -static int -dmxFetchScreenAttributes(unsigned int mask, - DMXScreenAttributesPtr attr, CARD32 *value_list) -{ - int i; - CARD32 *value = value_list; - int count = 0; - - for (i = 0; i < 32; i++) { - if (mask & (1 << i)) { - dmxSetScreenAttribute(i, attr, *value); - ++value; - ++count; - } - } - return count; -} - -static void -dmxSetDesktopAttribute(int bit, DMXDesktopAttributesPtr attr, CARD32 value) -{ - switch (1 << bit) { - case DMXDesktopWidth: - attr->width = value; - break; - case DMXDesktopHeight: - attr->height = value; - break; - case DMXDesktopShiftX: - attr->shiftX = value; - break; - case DMXDesktopShiftY: - attr->shiftY = value; - break; - } -} - -static int -dmxFetchDesktopAttributes(unsigned int mask, - DMXDesktopAttributesPtr attr, CARD32 *value_list) -{ - int i; - CARD32 *value = value_list; - int count = 0; - - for (i = 0; i < 32; i++) { - if (mask & (1 << i)) { - dmxSetDesktopAttribute(i, attr, *value); - ++value; - ++count; - } - } - return count; -} - -static void -dmxSetInputAttribute(int bit, DMXInputAttributesPtr attr, CARD32 value) -{ - switch (1 << bit) { - case DMXInputType: - attr->inputType = value; - break; - case DMXInputPhysicalScreen: - attr->physicalScreen = value; - break; - case DMXInputSendsCore: - attr->sendsCore = ! !value; - break; - } -} - -static int -dmxFetchInputAttributes(unsigned int mask, - DMXInputAttributesPtr attr, CARD32 *value_list) -{ - int i; - CARD32 *value = value_list; - int count = 0; - - for (i = 0; i < 32; i++) { - if (mask & (1 << i)) { - dmxSetInputAttribute(i, attr, *value); - ++value; - ++count; - } - } - return count; -} - -static int -ProcDMXQueryVersion(ClientPtr client) -{ - xDMXQueryVersionReply rep = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .majorVersion = SERVER_DMX_MAJOR_VERSION, - .minorVersion = SERVER_DMX_MINOR_VERSION, - .patchVersion = SERVER_DMX_PATCH_VERSION - }; - - REQUEST_SIZE_MATCH(xDMXQueryVersionReq); - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.majorVersion); - swapl(&rep.minorVersion); - swapl(&rep.patchVersion); - } - WriteToClient(client, sizeof(xDMXQueryVersionReply), &rep); - return Success; -} - -static int -ProcDMXSync(ClientPtr client) -{ - xDMXSyncReply rep; - - REQUEST_SIZE_MATCH(xDMXSyncReq); - - dmxFlushPendingSyncs(); - - rep = (xDMXSyncReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = 0 - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - } - WriteToClient(client, sizeof(xDMXSyncReply), &rep); - return Success; -} - -static int -ProcDMXForceWindowCreation(ClientPtr client) -{ - xDMXForceWindowCreationReply rep; - - REQUEST(xDMXForceWindowCreationReq); - WindowPtr pWin; - - REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq); - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - PanoramiXRes *win; - int i; - - if (Success != dixLookupResourceByType((void **) &win, - stuff->window, XRT_WINDOW, - client, DixReadAccess)) - return -1; /* BadWindow */ - - FOR_NSCREENS(i) { - if (Success != dixLookupWindow(&pWin, win->info[i].id, client, - DixReadAccess)) - return -1; /* BadWindow */ - - dmxForceWindowCreation(pWin); - } - goto doreply; - } -#endif - - if (Success != dixLookupWindow(&pWin, stuff->window, client, DixReadAccess)) - return -1; /* BadWindow */ - - dmxForceWindowCreation(pWin); - doreply: - dmxFlushPendingSyncs(); - rep = (xDMXForceWindowCreationReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = 0 - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - } - WriteToClient(client, sizeof(xDMXForceWindowCreationReply), &rep); - return Success; -} - -static int -ProcDMXGetScreenCount(ClientPtr client) -{ - xDMXGetScreenCountReply rep; - - REQUEST_SIZE_MATCH(xDMXGetScreenCountReq); - - rep = (xDMXGetScreenCountReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .screenCount = dmxGetNumScreens() - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.screenCount); - } - WriteToClient(client, sizeof(xDMXGetScreenCountReply), &rep); - return Success; -} - -static int -ProcDMXGetScreenAttributes(ClientPtr client) -{ - REQUEST(xDMXGetScreenAttributesReq); - xDMXGetScreenAttributesReply rep; - int length; - int paddedLength; - DMXScreenAttributesRec attr; - - REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq); - - if (stuff->physicalScreen < 0 - || stuff->physicalScreen >= dmxGetNumScreens()) - return BadValue; - - if (!dmxGetScreenAttributes(stuff->physicalScreen, &attr)) - return BadValue; - - length = attr.displayName ? strlen(attr.displayName) : 0; - paddedLength = pad_to_int32(length); - - rep = (xDMXGetScreenAttributesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = - bytes_to_int32((sizeof(xDMXGetScreenAttributesReply) - - sizeof(xGenericReply)) - + paddedLength), - .displayNameLength = length, - .logicalScreen = attr.logicalScreen, - .screenWindowWidth = attr.screenWindowWidth, - .screenWindowHeight = attr.screenWindowHeight, - .screenWindowXoffset = attr.screenWindowXoffset, - .screenWindowYoffset = attr.screenWindowYoffset, - .rootWindowWidth = attr.rootWindowWidth, - .rootWindowHeight = attr.rootWindowHeight, - .rootWindowXoffset = attr.rootWindowXoffset, - .rootWindowYoffset = attr.rootWindowYoffset, - .rootWindowXorigin = attr.rootWindowXorigin, - .rootWindowYorigin = attr.rootWindowYorigin - }; - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.displayNameLength); - swapl(&rep.logicalScreen); - swaps(&rep.screenWindowWidth); - swaps(&rep.screenWindowHeight); - swaps(&rep.screenWindowXoffset); - swaps(&rep.screenWindowYoffset); - swaps(&rep.rootWindowWidth); - swaps(&rep.rootWindowHeight); - swaps(&rep.rootWindowXoffset); - swaps(&rep.rootWindowYoffset); - swaps(&rep.rootWindowXorigin); - swaps(&rep.rootWindowYorigin); - } - WriteToClient(client, sizeof(xDMXGetScreenAttributesReply), &rep); - if (length) - WriteToClient(client, length, attr.displayName); - return Success; -} - -static int -ProcDMXChangeScreensAttributes(ClientPtr client) -{ - REQUEST(xDMXChangeScreensAttributesReq); - xDMXChangeScreensAttributesReply rep; - int status = DMX_BAD_XINERAMA; - unsigned int mask = 0; - unsigned int i; - CARD32 *screen_list; - CARD32 *mask_list; - CARD32 *value_list; - DMXScreenAttributesPtr attribs; - int errorScreen = 0; - unsigned int len; - int ones = 0; - - REQUEST_AT_LEAST_SIZE(xDMXChangeScreensAttributesReq); - len = - client->req_len - - bytes_to_int32(sizeof(xDMXChangeScreensAttributesReq)); - if (len < stuff->screenCount + stuff->maskCount) - return BadLength; - - screen_list = (CARD32 *) (stuff + 1); - mask_list = &screen_list[stuff->screenCount]; - value_list = &mask_list[stuff->maskCount]; - - for (i = 0; i < stuff->maskCount; i++) - ones += Ones(mask_list[i]); - if (len != stuff->screenCount + stuff->maskCount + ones) - return BadLength; - - if (!_DMXXineramaActive()) - goto noxinerama; - - if (!(attribs = xallocarray(stuff->screenCount, sizeof(*attribs)))) - return BadAlloc; - - for (i = 0; i < stuff->screenCount; i++) { - int count; - - if (i < stuff->maskCount) - mask = mask_list[i]; - dmxGetScreenAttributes(screen_list[i], &attribs[i]); - count = dmxFetchScreenAttributes(mask, &attribs[i], value_list); - value_list += count; - } - -#ifdef PANORAMIX - status = dmxConfigureScreenWindows(stuff->screenCount, - screen_list, attribs, &errorScreen); -#endif - - free(attribs); - - if (status == BadValue) - return status; - - noxinerama: - rep = (xDMXChangeScreensAttributesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = status, - .errorScreen = errorScreen - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - swapl(&rep.errorScreen); - } - WriteToClient(client, sizeof(xDMXChangeScreensAttributesReply), &rep); - return Success; -} - -static int -ProcDMXAddScreen(ClientPtr client) -{ - REQUEST(xDMXAddScreenReq); - xDMXAddScreenReply rep; - int status = 0; - CARD32 *value_list; - DMXScreenAttributesRec attr; - int count; - char *name; - int len; - int paddedLength; - - REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq); - paddedLength = pad_to_int32(stuff->displayNameLength); - len = client->req_len - bytes_to_int32(sizeof(xDMXAddScreenReq)); - if (len != Ones(stuff->valueMask) + paddedLength / 4) - return BadLength; - - memset(&attr, 0, sizeof(attr)); - dmxGetScreenAttributes(stuff->physicalScreen, &attr); - value_list = (CARD32 *) (stuff + 1); - count = dmxFetchScreenAttributes(stuff->valueMask, &attr, value_list); - - if (!(name = malloc(stuff->displayNameLength + 1 + 4))) - return BadAlloc; - memcpy(name, &value_list[count], stuff->displayNameLength); - name[stuff->displayNameLength] = '\0'; - attr.displayName = name; - - status = dmxAttachScreen(stuff->physicalScreen, &attr); - - free(name); - - rep = (xDMXAddScreenReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = status, - .physicalScreen = stuff->physicalScreen - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - swapl(&rep.physicalScreen); - } - WriteToClient(client, sizeof(xDMXAddScreenReply), &rep); - return Success; -} - -static int -ProcDMXRemoveScreen(ClientPtr client) -{ - REQUEST(xDMXRemoveScreenReq); - xDMXRemoveScreenReply rep; - int status = 0; - - REQUEST_SIZE_MATCH(xDMXRemoveScreenReq); - - status = dmxDetachScreen(stuff->physicalScreen); - - rep = (xDMXRemoveScreenReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = status - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - } - WriteToClient(client, sizeof(xDMXRemoveScreenReply), &rep); - return Success; -} - -#ifdef PANORAMIX -static int -dmxPopulatePanoramiX(ClientPtr client, Window window, - CARD32 *screens, CARD32 *windows, - xRectangle *pos, xRectangle *vis) -{ - WindowPtr pWin; - PanoramiXRes *win; - int i; - int count = 0; - DMXWindowAttributesRec attr; - - if (Success != dixLookupResourceByType((void **) &win, - window, XRT_WINDOW, - client, DixReadAccess)) - return -1; /* BadWindow */ - - FOR_NSCREENS(i) { - if (Success != dixLookupWindow(&pWin, win->info[i].id, client, - DixReadAccess)) - return -1; /* BadWindow */ - if (dmxGetWindowAttributes(pWin, &attr)) { - screens[count] = attr.screen; - windows[count] = attr.window; - pos[count] = attr.pos; - vis[count] = attr.vis; - ++count; /* Only count existing windows */ - } - } - return count; -} -#endif - -static int -dmxPopulate(ClientPtr client, Window window, CARD32 *screens, - CARD32 *windows, xRectangle *pos, xRectangle *vis) -{ - WindowPtr pWin; - DMXWindowAttributesRec attr; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - return dmxPopulatePanoramiX(client, window, screens, windows, pos, vis); -#endif - - if (Success != dixLookupWindow(&pWin, window, client, DixReadAccess)) - return -1; /* BadWindow */ - - dmxGetWindowAttributes(pWin, &attr); - *screens = attr.screen; - *windows = attr.window; - *pos = attr.pos; - *vis = attr.vis; - return 1; -} - -static int -dmxMaxNumScreens(void) -{ -#ifdef PANORAMIX - if (!noPanoramiXExtension) - return PanoramiXNumScreens; -#endif - return 1; -} - -static int -ProcDMXGetWindowAttributes(ClientPtr client) -{ - REQUEST(xDMXGetWindowAttributesReq); - xDMXGetWindowAttributesReply rep; - int i; - CARD32 *screens; - CARD32 *windows; - xRectangle *pos, *vis; - int count = dmxMaxNumScreens(); - - REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq); - - if (!(screens = xallocarray(count, sizeof(*screens)))) - return BadAlloc; - if (!(windows = xallocarray(count, sizeof(*windows)))) { - free(screens); - return BadAlloc; - } - if (!(pos = xallocarray(count, sizeof(*pos)))) { - free(windows); - free(screens); - return BadAlloc; - } - if (!(vis = xallocarray(count, sizeof(*vis)))) { - free(pos); - free(windows); - free(screens); - return BadAlloc; - } - - if ((count = dmxPopulate(client, stuff->window, screens, windows, - pos, vis)) < 0) { - free(vis); - free(pos); - free(windows); - free(screens); - return BadWindow; - } - - rep = (xDMXGetWindowAttributesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = count * 6, - .screenCount = count - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.screenCount); - for (i = 0; i < count; i++) { - swapl(&screens[i]); - swapl(&windows[i]); - - swaps(&pos[i].x); - swaps(&pos[i].y); - swaps(&pos[i].width); - swaps(&pos[i].height); - - swaps(&vis[i].x); - swaps(&vis[i].y); - swaps(&vis[i].width); - swaps(&vis[i].height); - } - } - - dmxFlushPendingSyncs(); - - WriteToClient(client, sizeof(xDMXGetWindowAttributesReply), &rep); - if (count) { - WriteToClient(client, count * sizeof(*screens), screens); - WriteToClient(client, count * sizeof(*windows), windows); - WriteToClient(client, count * sizeof(*pos), pos); - WriteToClient(client, count * sizeof(*vis), vis); - } - - free(vis); - free(pos); - free(windows); - free(screens); - - return Success; -} - -static int -ProcDMXGetDesktopAttributes(ClientPtr client) -{ - xDMXGetDesktopAttributesReply rep; - DMXDesktopAttributesRec attr; - - REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq); - - dmxGetDesktopAttributes(&attr); - - rep = (xDMXGetDesktopAttributesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .width = attr.width, - .height = attr.height, - .shiftX = attr.shiftX, - .shiftY = attr.shiftY - }; - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swaps(&rep.width); - swaps(&rep.height); - swaps(&rep.shiftX); - swaps(&rep.shiftY); - } - WriteToClient(client, sizeof(xDMXGetDesktopAttributesReply), &rep); - return Success; -} - -static int -ProcDMXChangeDesktopAttributes(ClientPtr client) -{ - REQUEST(xDMXChangeDesktopAttributesReq); - xDMXChangeDesktopAttributesReply rep; - int status = DMX_BAD_XINERAMA; - CARD32 *value_list; - DMXDesktopAttributesRec attr; - int len; - - REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq); - len = client->req_len - (sizeof(xDMXChangeDesktopAttributesReq) >> 2); - if (len != Ones(stuff->valueMask)) - return BadLength; - - if (!_DMXXineramaActive()) - goto noxinerama; - - value_list = (CARD32 *) (stuff + 1); - - dmxGetDesktopAttributes(&attr); - dmxFetchDesktopAttributes(stuff->valueMask, &attr, value_list); - -#ifdef PANORAMIX - status = dmxConfigureDesktop(&attr); -#endif - if (status == BadValue) - return status; - - noxinerama: - rep = (xDMXChangeDesktopAttributesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = status - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - } - WriteToClient(client, sizeof(xDMXChangeDesktopAttributesReply), &rep); - return Success; -} - -static int -ProcDMXGetInputCount(ClientPtr client) -{ - xDMXGetInputCountReply rep; - - REQUEST_SIZE_MATCH(xDMXGetInputCountReq); - - rep = (xDMXGetInputCountReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .inputCount = dmxGetInputCount() - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.inputCount); - } - WriteToClient(client, sizeof(xDMXGetInputCountReply), &rep); - return Success; -} - -static int -ProcDMXGetInputAttributes(ClientPtr client) -{ - REQUEST(xDMXGetInputAttributesReq); - xDMXGetInputAttributesReply rep; - int length; - int paddedLength; - DMXInputAttributesRec attr; - - REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq); - - if (dmxGetInputAttributes(stuff->deviceId, &attr)) - return BadValue; - - length = attr.name ? strlen(attr.name) : 0; - paddedLength = pad_to_int32(length); - - rep = (xDMXGetInputAttributesReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = bytes_to_int32(paddedLength), - - .inputType = attr.inputType, - .physicalScreen = attr.physicalScreen, - .physicalId = attr.physicalId, - .nameLength = length, - .isCore = attr.isCore, - .sendsCore = attr.sendsCore, - .detached = attr.detached - }; - - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.inputType); - swapl(&rep.physicalScreen); - swapl(&rep.physicalId); - swapl(&rep.nameLength); - } - WriteToClient(client, sizeof(xDMXGetInputAttributesReply), &rep); - if (length) - WriteToClient(client, length, attr.name); - return Success; -} - -static int -ProcDMXAddInput(ClientPtr client) -{ - REQUEST(xDMXAddInputReq); - xDMXAddInputReply rep; - int status = 0; - CARD32 *value_list; - DMXInputAttributesRec attr; - int count; - char *name; - int len; - int paddedLength; - int id = -1; - - REQUEST_AT_LEAST_SIZE(xDMXAddInputReq); - paddedLength = pad_to_int32(stuff->displayNameLength); - len = client->req_len - (sizeof(xDMXAddInputReq) >> 2); - if (len != Ones(stuff->valueMask) + paddedLength / 4) - return BadLength; - - memset(&attr, 0, sizeof(attr)); - value_list = (CARD32 *) (stuff + 1); - count = dmxFetchInputAttributes(stuff->valueMask, &attr, value_list); - - if (!(name = malloc(stuff->displayNameLength + 1 + 4))) - return BadAlloc; - memcpy(name, &value_list[count], stuff->displayNameLength); - name[stuff->displayNameLength] = '\0'; - attr.name = name; - - status = dmxAddInput(&attr, &id); - - free(name); - - if (status) - return status; - - rep = (xDMXAddInputReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = status, - .physicalId = id - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - swapl(&rep.physicalId); - } - WriteToClient(client, sizeof(xDMXAddInputReply), &rep); - return Success; -} - -static int -ProcDMXRemoveInput(ClientPtr client) -{ - REQUEST(xDMXRemoveInputReq); - xDMXRemoveInputReply rep; - int status = 0; - - REQUEST_SIZE_MATCH(xDMXRemoveInputReq); - - status = dmxRemoveInput(stuff->physicalId); - - if (status) - return status; - - rep = (xDMXRemoveInputReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .status = status - }; - if (client->swapped) { - swaps(&rep.sequenceNumber); - swapl(&rep.length); - swapl(&rep.status); - } - WriteToClient(client, sizeof(xDMXRemoveInputReply), &rep); - return Success; -} - -static int -ProcDMXDispatch(ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) { - case X_DMXQueryVersion: - return ProcDMXQueryVersion(client); - case X_DMXSync: - return ProcDMXSync(client); - case X_DMXForceWindowCreation: - return ProcDMXForceWindowCreation(client); - case X_DMXGetScreenCount: - return ProcDMXGetScreenCount(client); - case X_DMXGetScreenAttributes: - return ProcDMXGetScreenAttributes(client); - case X_DMXChangeScreensAttributes: - return ProcDMXChangeScreensAttributes(client); - case X_DMXAddScreen: - return ProcDMXAddScreen(client); - case X_DMXRemoveScreen: - return ProcDMXRemoveScreen(client); - case X_DMXGetWindowAttributes: - return ProcDMXGetWindowAttributes(client); - case X_DMXGetDesktopAttributes: - return ProcDMXGetDesktopAttributes(client); - case X_DMXChangeDesktopAttributes: - return ProcDMXChangeDesktopAttributes(client); - case X_DMXGetInputCount: - return ProcDMXGetInputCount(client); - case X_DMXGetInputAttributes: - return ProcDMXGetInputAttributes(client); - case X_DMXAddInput: - return ProcDMXAddInput(client); - case X_DMXRemoveInput: - return ProcDMXRemoveInput(client); - - case X_DMXGetScreenInformationDEPRECATED: - case X_DMXForceWindowCreationDEPRECATED: - case X_DMXReconfigureScreenDEPRECATED: - return BadImplementation; - - default: - return BadRequest; - } -} - -static int _X_COLD -SProcDMXQueryVersion(ClientPtr client) -{ - REQUEST(xDMXQueryVersionReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXQueryVersionReq); - return ProcDMXQueryVersion(client); -} - -static int _X_COLD -SProcDMXSync(ClientPtr client) -{ - REQUEST(xDMXSyncReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXSyncReq); - return ProcDMXSync(client); -} - -static int _X_COLD -SProcDMXForceWindowCreation(ClientPtr client) -{ - REQUEST(xDMXForceWindowCreationReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXForceWindowCreationReq); - swapl(&stuff->window); - return ProcDMXForceWindowCreation(client); -} - -static int _X_COLD -SProcDMXGetScreenCount(ClientPtr client) -{ - REQUEST(xDMXGetScreenCountReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXGetScreenCountReq); - return ProcDMXGetScreenCount(client); -} - -static int _X_COLD -SProcDMXGetScreenAttributes(ClientPtr client) -{ - REQUEST(xDMXGetScreenAttributesReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXGetScreenAttributesReq); - swapl(&stuff->physicalScreen); - return ProcDMXGetScreenAttributes(client); -} - -static int _X_COLD -SProcDMXChangeScreensAttributes(ClientPtr client) -{ - REQUEST(xDMXChangeScreensAttributesReq); - - swaps(&stuff->length); - REQUEST_AT_LEAST_SIZE(xDMXGetScreenAttributesReq); - swapl(&stuff->screenCount); - swapl(&stuff->maskCount); - SwapRestL(stuff); - return ProcDMXGetScreenAttributes(client); -} - -static int _X_COLD -SProcDMXAddScreen(ClientPtr client) -{ - int paddedLength; - - REQUEST(xDMXAddScreenReq); - - swaps(&stuff->length); - REQUEST_AT_LEAST_SIZE(xDMXAddScreenReq); - swapl(&stuff->displayNameLength); - swapl(&stuff->valueMask); - paddedLength = pad_to_int32(stuff->displayNameLength); - SwapLongs((CARD32 *) (stuff + 1), LengthRestL(stuff) - paddedLength / 4); - return ProcDMXAddScreen(client); -} - -static int _X_COLD -SProcDMXRemoveScreen(ClientPtr client) -{ - REQUEST(xDMXRemoveScreenReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXRemoveScreenReq); - swapl(&stuff->physicalScreen); - return ProcDMXRemoveScreen(client); -} - -static int _X_COLD -SProcDMXGetWindowAttributes(ClientPtr client) -{ - REQUEST(xDMXGetWindowAttributesReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXGetWindowAttributesReq); - swapl(&stuff->window); - return ProcDMXGetWindowAttributes(client); -} - -static int _X_COLD -SProcDMXGetDesktopAttributes(ClientPtr client) -{ - REQUEST(xDMXGetDesktopAttributesReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXGetDesktopAttributesReq); - return ProcDMXGetDesktopAttributes(client); -} - -static int _X_COLD -SProcDMXChangeDesktopAttributes(ClientPtr client) -{ - REQUEST(xDMXChangeDesktopAttributesReq); - - swaps(&stuff->length); - REQUEST_AT_LEAST_SIZE(xDMXChangeDesktopAttributesReq); - swapl(&stuff->valueMask); - SwapRestL(stuff); - return ProcDMXChangeDesktopAttributes(client); -} - -static int _X_COLD -SProcDMXGetInputCount(ClientPtr client) -{ - REQUEST(xDMXGetInputCountReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXGetInputCountReq); - return ProcDMXGetInputCount(client); -} - -static int _X_COLD -SProcDMXGetInputAttributes(ClientPtr client) -{ - REQUEST(xDMXGetInputAttributesReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXGetInputAttributesReq); - swapl(&stuff->deviceId); - return ProcDMXGetInputAttributes(client); -} - -static int _X_COLD -SProcDMXAddInput(ClientPtr client) -{ - int paddedLength; - - REQUEST(xDMXAddInputReq); - - swaps(&stuff->length); - REQUEST_AT_LEAST_SIZE(xDMXAddInputReq); - swapl(&stuff->displayNameLength); - swapl(&stuff->valueMask); - paddedLength = pad_to_int32(stuff->displayNameLength); - SwapLongs((CARD32 *) (stuff + 1), LengthRestL(stuff) - paddedLength / 4); - return ProcDMXAddInput(client); -} - -static int _X_COLD -SProcDMXRemoveInput(ClientPtr client) -{ - REQUEST(xDMXRemoveInputReq); - - swaps(&stuff->length); - REQUEST_SIZE_MATCH(xDMXRemoveInputReq); - swapl(&stuff->physicalId); - return ProcDMXRemoveInput(client); -} - -static int _X_COLD -SProcDMXDispatch(ClientPtr client) -{ - REQUEST(xReq); - - switch (stuff->data) { - case X_DMXQueryVersion: - return SProcDMXQueryVersion(client); - case X_DMXSync: - return SProcDMXSync(client); - case X_DMXForceWindowCreation: - return SProcDMXForceWindowCreation(client); - case X_DMXGetScreenCount: - return SProcDMXGetScreenCount(client); - case X_DMXGetScreenAttributes: - return SProcDMXGetScreenAttributes(client); - case X_DMXChangeScreensAttributes: - return SProcDMXChangeScreensAttributes(client); - case X_DMXAddScreen: - return SProcDMXAddScreen(client); - case X_DMXRemoveScreen: - return SProcDMXRemoveScreen(client); - case X_DMXGetWindowAttributes: - return SProcDMXGetWindowAttributes(client); - case X_DMXGetDesktopAttributes: - return SProcDMXGetDesktopAttributes(client); - case X_DMXChangeDesktopAttributes: - return SProcDMXChangeDesktopAttributes(client); - case X_DMXGetInputCount: - return SProcDMXGetInputCount(client); - case X_DMXGetInputAttributes: - return SProcDMXGetInputAttributes(client); - case X_DMXAddInput: - return SProcDMXAddInput(client); - case X_DMXRemoveInput: - return SProcDMXRemoveInput(client); - - case X_DMXGetScreenInformationDEPRECATED: - case X_DMXForceWindowCreationDEPRECATED: - case X_DMXReconfigureScreenDEPRECATED: - return BadImplementation; - - default: - return BadRequest; - } -} - -/** Initialize the extension. */ -void -DMXExtensionInit(void) -{ - ExtensionEntry *extEntry; - - if ((extEntry = AddExtension(DMX_EXTENSION_NAME, 0, 0, - ProcDMXDispatch, SProcDMXDispatch, - NULL, StandardMinorOpcode))) - DMXCode = extEntry->base; -} diff --git a/hw/dmx/dmx.h b/hw/dmx/dmx.h deleted file mode 100644 index 7242e4380..000000000 --- a/hw/dmx/dmx.h +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright 2001-2003 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 - * Main header file included by all other DMX-related files. - */ - -/** \mainpage - * - <a href="http://dmx.sourceforge.net">DMX Home Page</a> - * - <a href="http://sourceforge.net/projects/dmx">DMX Project Page (on - * Source Forge)</a> - * - <a href="http://dmx.sourceforge.net/dmx.html">Distributed Multihead - * X design</a>, the design document for DMX - * - <a href="http://dmx.sourceforge.net/DMXSpec.txt">Client-to-Server - * DMX Extension to the X Protocol</a> - */ - -#ifndef DMX_H -#define DMX_H - -#if HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "gcstruct.h" - -/* Handle client-side include files in one place. */ -#include "dmxclient.h" - -#include "globals.h" -#include "scrnintstr.h" - -#include "picturestr.h" - -#ifdef GLXEXT -#include <GL/glx.h> -#include <GL/glxint.h> -#endif - -typedef enum { - PosNone = -1, - PosAbsolute = 0, - PosRightOf, - PosLeftOf, - PosAbove, - PosBelow, - PosRelative -} PositionType; - -/** Provide the typedef globally, but keep the contents opaque outside - * of the input routines. \see dmxinput.h */ -typedef struct _DMXInputInfo DMXInputInfo; - -/** Provide the typedef globally, but keep the contents opaque outside - * of the XSync statistic routines. \see dmxstat.c */ -typedef struct _DMXStatInfo DMXStatInfo; - -/** Global structure containing information about each backend screen. */ -typedef struct _DMXScreenInfo { - const char *name; /**< Name from command line or config file */ - int index; /**< Index into dmxScreens global */ - - /*---------- Back-end X server information ----------*/ - - Display *beDisplay; /**< Back-end X server's display */ - int beWidth; /**< Width of BE display */ - int beHeight; /**< Height of BE display */ - int beDepth; /**< Depth of BE display */ - int beBPP; /**< Bits per pixel of BE display */ - int beXDPI; /**< Horizontal dots per inch of BE */ - int beYDPI; /**< Vertical dots per inch of BE */ - - int beNumDepths; /**< Number of depths on BE server */ - int *beDepths; /**< Depths from BE server */ - - int beNumPixmapFormats; /**< Number of pixmap formats on BE */ - XPixmapFormatValues *bePixmapFormats; /**< Pixmap formats on BE */ - - int beNumVisuals; /**< Number of visuals on BE */ - XVisualInfo *beVisuals; /**< Visuals from BE server */ - int beDefVisualIndex; /**< Default visual index of BE */ - - int beNumDefColormaps; /**< Number of default colormaps */ - Colormap *beDefColormaps; /**< Default colormaps for DMX server */ - - Pixel beBlackPixel; /**< Default black pixel for BE */ - Pixel beWhitePixel; /**< Default white pixel for BE */ - - /*---------- Screen window information ----------*/ - - Window scrnWin; /**< "Screen" window on backend display */ - int scrnX; /**< X offset of "screen" WRT BE display */ - int scrnY; /**< Y offset of "screen" WRT BE display */ - int scrnWidth; /**< Width of "screen" */ - int scrnHeight; /**< Height of "screen" */ - int scrnXSign; /**< X offset sign of "screen" */ - int scrnYSign; /**< Y offset sign of "screen" */ - - /** Default drawables for "screen" */ - Drawable scrnDefDrawables[MAXFORMATS]; - - struct _DMXScreenInfo *next; /**< List of "screens" on same display */ - struct _DMXScreenInfo *over; /**< List of "screens" that overlap */ - - /*---------- Root window information ----------*/ - - Window rootWin; /**< "Root" window on backend display */ - int rootX; /**< X offset of "root" window WRT "screen"*/ - int rootY; /**< Y offset of "root" window WRT "screen"*/ - int rootWidth; /**< Width of "root" window */ - int rootHeight; /**< Height of "root" window */ - - int rootXOrigin; /**< Global X origin of "root" window */ - int rootYOrigin; /**< Global Y origin of "root" window */ - - /*---------- Shadow framebuffer information ----------*/ - - void *shadow; /**< Shadow framebuffer data (if enabled) */ - XlibGC shadowGC; /**< Default GC used by shadow FB code */ - XImage *shadowFBImage; /**< Screen image used by shadow FB code */ - - /*---------- Other related information ----------*/ - - int shared; /**< Non-zero if another Xdmx is running */ - - Bool WMRunningOnBE; - - Cursor noCursor; - Cursor curCursor; - /* Support for cursors on overlapped - * backend displays. */ - CursorPtr cursor; - int cursorVisible; - int cursorNotShared; /* for overlapping screens on a backend */ - - PositionType where; /**< Relative layout information */ - int whereX; /**< Relative layout information */ - int whereY; /**< Relative layout information */ - int whereRefScreen; /**< Relative layout information */ - - int savedTimeout; /**< Original screen saver timeout */ - int dpmsCapable; /**< Non-zero if backend is DPMS capable */ - int dpmsEnabled; /**< Non-zero if DPMS enabled */ - int dpmsStandby; /**< Original DPMS standby value */ - int dpmsSuspend; /**< Original DPMS suspend value */ - int dpmsOff; /**< Original DPMS off value */ - - DMXStatInfo *stat; /**< Statistics about XSync */ - Bool needsSync; /**< True if an XSync is pending */ - -#ifdef GLXEXT - /** Visual information for glxProxy */ - int numGlxVisuals; - __GLXvisualConfig *glxVisuals; - int glxMajorOpcode; - int glxErrorBase; - - /** FB config information for glxProxy */ - __GLXFBConfig *fbconfigs; - int numFBConfigs; -#endif - - /** Function pointers to wrapped screen - * functions */ - CloseScreenProcPtr CloseScreen; - SaveScreenProcPtr SaveScreen; - - CreateGCProcPtr CreateGC; - - CreateWindowProcPtr CreateWindow; - DestroyWindowProcPtr DestroyWindow; - PositionWindowProcPtr PositionWindow; - ChangeWindowAttributesProcPtr ChangeWindowAttributes; - RealizeWindowProcPtr RealizeWindow; - UnrealizeWindowProcPtr UnrealizeWindow; - RestackWindowProcPtr RestackWindow; - WindowExposuresProcPtr WindowExposures; - CopyWindowProcPtr CopyWindow; - - ResizeWindowProcPtr ResizeWindow; - ReparentWindowProcPtr ReparentWindow; - - ChangeBorderWidthProcPtr ChangeBorderWidth; - - GetImageProcPtr GetImage; - GetSpansProcPtr GetSpans; - - CreatePixmapProcPtr CreatePixmap; - DestroyPixmapProcPtr DestroyPixmap; - BitmapToRegionProcPtr BitmapToRegion; - - RealizeFontProcPtr RealizeFont; - UnrealizeFontProcPtr UnrealizeFont; - - CreateColormapProcPtr CreateColormap; - DestroyColormapProcPtr DestroyColormap; - InstallColormapProcPtr InstallColormap; - StoreColorsProcPtr StoreColors; - - SetShapeProcPtr SetShape; - - CreatePictureProcPtr CreatePicture; - DestroyPictureProcPtr DestroyPicture; - ChangePictureClipProcPtr ChangePictureClip; - DestroyPictureClipProcPtr DestroyPictureClip; - - ChangePictureProcPtr ChangePicture; - ValidatePictureProcPtr ValidatePicture; - - CompositeProcPtr Composite; - GlyphsProcPtr Glyphs; - CompositeRectsProcPtr CompositeRects; - - InitIndexedProcPtr InitIndexed; - CloseIndexedProcPtr CloseIndexed; - UpdateIndexedProcPtr UpdateIndexed; - - TrapezoidsProcPtr Trapezoids; - TrianglesProcPtr Triangles; -} DMXScreenInfo; - -/* Global variables available to all Xserver/hw/dmx routines. */ -extern int dmxNumScreens; /**< Number of dmxScreens */ -extern DMXScreenInfo *dmxScreens; /**< List of outputs */ -extern XErrorEvent dmxLastErrorEvent; /**< Last error that - - * occurred */ -extern Bool dmxErrorOccurred; /**< True if an error - - * occurred */ -extern Bool dmxOffScreenOpt; /**< True if using off - - * screen - * optimizations */ -extern Bool dmxSubdividePrimitives; /**< True if using the - - * primitive subdivision - * optimization */ -extern Bool dmxLazyWindowCreation; /**< True if using the - - * lazy window creation - * optimization */ -extern Bool dmxUseXKB; /**< True if the XKB - - * extension should be - * used with the backend - * servers */ -extern int dmxDepth; /**< Requested depth if - - * non-zero */ -#ifdef GLXEXT -extern Bool dmxGLXProxy; /**< True if glxProxy - - * support is enabled */ -extern Bool dmxGLXSwapGroupSupport; /**< True if glxProxy - - * support for swap - * groups and barriers - * is enabled */ -extern Bool dmxGLXSyncSwap; /**< True if glxProxy - - * should force an XSync - * request after each - * swap buffers call */ -extern Bool dmxGLXFinishSwap; /**< True if glxProxy - - * should force a - * glFinish request - * after each swap - * buffers call */ -#endif -extern char *dmxFontPath; /**< NULL if no font - - * path is set on the - * command line; - * otherwise, a string - * of comma separated - * paths built from the - * command line - * specified font - * paths */ -extern Bool dmxIgnoreBadFontPaths; /**< True if bad font - - * paths should be - * ignored during server - * init */ -extern Bool dmxAddRemoveScreens; /**< True if add and - - * remove screens support - * is enabled */ - -/** Wrap screen or GC function pointer */ -#define DMX_WRAP(_entry, _newfunc, _saved, _actual) \ -do { \ - (_saved)->_entry = (_actual)->_entry; \ - (_actual)->_entry = (_newfunc); \ -} while (0) - -/** Unwrap screen or GC function pointer */ -#define DMX_UNWRAP(_entry, _saved, _actual) \ -do { \ - (_actual)->_entry = (_saved)->_entry; \ -} while (0) - -/* Define the MAXSCREENSALLOC/FREE macros, when MAXSCREENS patch has not - * been applied to sources. */ -#ifdef MAXSCREENS -#define MAXSCREEN_MAKECONSTSTR1(x) #x -#define MAXSCREEN_MAKECONSTSTR2(x) MAXSCREEN_MAKECONSTSTR1(x) - -#define MAXSCREEN_FAILED_TXT "Failed at [" \ - MAXSCREEN_MAKECONSTSTR2(__LINE__) ":" __FILE__ "] to allocate object: " - -#define _MAXSCREENSALLOCF(o,size,fatal) \ - do { \ - if (!o) { \ - o = calloc((size), sizeof(*(o))); \ - if (!o && fatal) FatalError(MAXSCREEN_FAILED_TXT #o); \ - } \ - } while (0) -#define _MAXSCREENSALLOCR(o,size,retval) \ - do { \ - if (!o) { \ - o = calloc((size), sizeof(*(o))); \ - if (!o) return retval; \ - } \ - } while (0) - -#define MAXSCREENSFREE(o) \ - do { \ - free(o); \ - o = NULL; \ - } while (0) - -#define MAXSCREENSALLOC(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 0) -#define MAXSCREENSALLOC_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS, 1) -#define MAXSCREENSALLOC_RETURN(o,r) _MAXSCREENSALLOCR(o,MAXSCREENS, (r)) -#define MAXSCREENSALLOCPLUSONE(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,0) -#define MAXSCREENSALLOCPLUSONE_FATAL(o) _MAXSCREENSALLOCF(o,MAXSCREENS+1,1) -#define MAXSCREENSCALLOC(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),0) -#define MAXSCREENSCALLOC_FATAL(o,m) _MAXSCREENSALLOCF(o,MAXSCREENS*(m),1) -#endif - -extern DevPrivateKeyRec dmxGCPrivateKeyRec; - -#define dmxGCPrivateKey (&dmxGCPrivateKeyRec) /**< Private index for GCs */ - -extern DevPrivateKeyRec dmxWinPrivateKeyRec; - -#define dmxWinPrivateKey (&dmxWinPrivateKeyRec) /**< Private index for Windows */ - -extern DevPrivateKeyRec dmxPixPrivateKeyRec; - -#define dmxPixPrivateKey (&dmxPixPrivateKeyRec) /**< Private index for Pixmaps */ - -extern int dmxFontPrivateIndex; /**< Private index for Fonts */ - -extern DevPrivateKeyRec dmxScreenPrivateKeyRec; - -#define dmxScreenPrivateKey (&dmxScreenPrivateKeyRec) /**< Private index for Screens */ - -extern DevPrivateKeyRec dmxColormapPrivateKeyRec; - -#define dmxColormapPrivateKey (&dmxColormapPrivateKeyRec) /**< Private index for Colormaps */ - -extern DevPrivateKeyRec dmxPictPrivateKeyRec; - -#define dmxPictPrivateKey (&dmxPictPrivateKeyRec) /**< Private index for Picts */ - -extern DevPrivateKeyRec dmxGlyphSetPrivateKeyRec; - -#define dmxGlyphSetPrivateKey (&dmxGlyphSetPrivateKeyRec) /**< Private index for GlyphSets */ - -void DMXExtensionInit(void); - -#endif /* DMX_H */ diff --git a/hw/dmx/dmx_glxvisuals.c b/hw/dmx/dmx_glxvisuals.c deleted file mode 100644 index b3bd3b79f..000000000 --- a/hw/dmx/dmx_glxvisuals.c +++ /dev/null @@ -1,615 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include <GL/glx.h> -#include <GL/glxproto.h> -#include <X11/extensions/Xext.h> -#include <X11/extensions/extutil.h> -#include <limits.h> - -#include "dmx_glxvisuals.h" - -__GLXvisualConfig * -GetGLXVisualConfigs(Display * dpy, int screen, int *nconfigs) -{ - xGLXGetVisualConfigsReq *req; - xGLXGetVisualConfigsReply reply; - __GLXvisualConfig *config, *configs; - GLint i, j, nvisuals, nprops; - INT32 *props, *p; - int majorOpcode, dummy; - int num_good_visuals; - - if (!XQueryExtension(dpy, "GLX", &majorOpcode, &dummy, &dummy)) { - return NULL; - } - - /* Send the glXGetVisualConfigs request */ - LockDisplay(dpy); - GetReq(GLXGetVisualConfigs, req); - req->reqType = majorOpcode; - req->glxCode = X_GLXGetVisualConfigs; - req->screen = screen; - if (!_XReply(dpy, (xReply *) &reply, 0, False)) { - /* Something is busted. Punt. */ - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - nvisuals = (int) reply.numVisuals; - if (!nvisuals) { - /* This screen does not support GL rendering */ - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - /* Check number of properties per visual */ - nprops = (int) reply.numProps; - if (nprops < __GLX_MIN_CONFIG_PROPS) { - /* Huh? Not in protocol defined limits. Punt */ - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - if (nprops < (INT_MAX / __GLX_SIZE_CARD32)) - props = Xmalloc(nprops * __GLX_SIZE_CARD32); - else - props = NULL; - if (!props) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - /* Allocate memory for our config structure */ - if (nvisuals < (INT_MAX / sizeof(__GLXvisualConfig))) - config = Xcalloc(nvisuals, sizeof(__GLXvisualConfig)); - else - config = NULL; - if (!config) { - free(props); - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - configs = config; - num_good_visuals = 0; - - /* Convert config structure into our format */ - for (i = 0; i < nvisuals; i++) { - - /* Read config structure */ - _XRead(dpy, (char *) props, (nprops * __GLX_SIZE_CARD32)); - - /* fill in default values */ - config->visualRating = GLX_NONE_EXT; - config->transparentPixel = GLX_NONE_EXT; - - /* Copy in the first set of properties */ - config->vid = props[0]; - config->class = props[1]; - - config->rgba = (Bool) props[2]; - - config->redSize = props[3]; - config->greenSize = props[4]; - config->blueSize = props[5]; - config->alphaSize = props[6]; - - config->accumRedSize = props[7]; - config->accumGreenSize = props[8]; - config->accumBlueSize = props[9]; - config->accumAlphaSize = props[10]; - - config->doubleBuffer = (Bool) props[11]; - config->stereo = (Bool) props[12]; - - config->bufferSize = props[13]; - config->depthSize = props[14]; - config->stencilSize = props[15]; - - config->auxBuffers = props[16]; - config->level = props[17]; - - /* Process remaining properties */ - p = &props[18]; - for (j = __GLX_MIN_CONFIG_PROPS; j < nprops; j += 2) { - int property = *p++; - int value = *p++; - - switch (property) { - case GLX_SAMPLES_SGIS: - config->multiSampleSize = value; - break; - case GLX_SAMPLE_BUFFERS_SGIS: - config->nMultiSampleBuffers = value; - break; - - case GLX_TRANSPARENT_TYPE_EXT: - config->transparentPixel = value; - break; - case GLX_TRANSPARENT_INDEX_VALUE_EXT: - config->transparentIndex = value; - break; - case GLX_TRANSPARENT_RED_VALUE_EXT: - config->transparentRed = value; - break; - case GLX_TRANSPARENT_GREEN_VALUE_EXT: - config->transparentGreen = value; - break; - case GLX_TRANSPARENT_BLUE_VALUE_EXT: - config->transparentBlue = value; - break; - case GLX_TRANSPARENT_ALPHA_VALUE_EXT: - config->transparentAlpha = value; - break; - - case GLX_VISUAL_CAVEAT_EXT: - config->visualRating = value; - break; - - /* visualSelectGroup is an internal used property */ - case GLX_VISUAL_SELECT_GROUP_SGIX: - config->visualSelectGroup = value; - break; - - default: - /* Ignore properties we don't recognize */ - break; - } - } /* for j */ - - /* - // filter out overlay visuals (dmx does not support overlays) - */ - if (config->level == 0) { - config++; - num_good_visuals++; - } - - } /* for i */ - - UnlockDisplay(dpy); - - nvisuals = num_good_visuals; - - config = configs; - for (i = 0; i < nvisuals; i++) { - /* XXX hack to fill-in mask info (need a better way to do this) */ - { - XVisualInfo *vis, template; - int n; - - template.screen = screen; - template.visualid = config->vid; - vis = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask, - &template, &n); - - if (vis != NULL) { - config->redMask = vis->red_mask; - config->greenMask = vis->green_mask; - config->blueMask = vis->blue_mask; - config->alphaMask = 0; /* XXX */ - free(vis); - } - } - config++; - } /* for i */ - - XFree(props); - SyncHandle(); - - *nconfigs = nvisuals; - return configs; -} - -__GLXFBConfig * -GetGLXFBConfigs(Display * dpy, int glxMajorOpcode, int *nconfigs) -{ - xGLXGetFBConfigsReq *req; - xGLXGetFBConfigsReply reply; - __GLXFBConfig *config, *fbconfigs; - GLint i, j, numFBConfigs, numAttribs; - INT32 *attrs, *p; - int screen = DefaultScreen(dpy); - int numValidConfigs = 0; - - /* Send the glXGetFBConfigs request */ - LockDisplay(dpy); - GetReq(GLXGetFBConfigs, req); - req->reqType = glxMajorOpcode; - req->glxCode = X_GLXGetFBConfigs; - req->screen = screen; - - *nconfigs = 0; - - if (!_XReply(dpy, (xReply *) &reply, 0, False)) { - /* Something is busted. Punt. */ - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - numFBConfigs = (int) reply.numFBConfigs; - if (!numFBConfigs) { - /* This screen does not support GL rendering */ - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - numAttribs = (int) reply.numAttribs; - if (!numAttribs) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - if (numAttribs < (INT_MAX / (2 * __GLX_SIZE_CARD32))) - attrs = Xmalloc(2 * numAttribs * __GLX_SIZE_CARD32); - else - attrs = NULL; - if (!attrs) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - - /* Allocate memory for our config structure */ - if (numFBConfigs < (INT_MAX / sizeof(__GLXFBConfig))) - config = Xcalloc(numFBConfigs, sizeof(__GLXFBConfig)); - else - config = NULL; - if (!config) { - free(attrs); - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - fbconfigs = config; - - /* Convert attribute list into our format */ - for (i = 0; i < numFBConfigs; i++) { - - /* Fill in default properties */ - config->transparentType = GLX_NONE_EXT; - config->visualCaveat = GLX_NONE_EXT; - config->minRed = 0.; - config->maxRed = 1.; - config->minGreen = 0.; - config->maxGreen = 1.; - config->minBlue = 0.; - config->maxBlue = 1.; - config->minAlpha = 0.; - config->maxAlpha = 1.; - - /* Read attribute list */ - _XRead(dpy, (char *) attrs, (2 * numAttribs * __GLX_SIZE_CARD32)); - - p = attrs; - for (j = 0; j < numAttribs; j++) { - int attribute = *p++; - int value = *p++; - - switch (attribute) { - /* core attributes */ - case GLX_FBCONFIG_ID: - config->id = value; - break; - case GLX_BUFFER_SIZE: - config->indexBits = value; - break; - case GLX_LEVEL: - config->level = value; - break; - case GLX_DOUBLEBUFFER: - config->doubleBufferMode = value; - break; - case GLX_STEREO: - config->stereoMode = value; - break; - case GLX_AUX_BUFFERS: - config->maxAuxBuffers = value; - break; - case GLX_RED_SIZE: - config->redBits = value; - break; - case GLX_GREEN_SIZE: - config->greenBits = value; - break; - case GLX_BLUE_SIZE: - config->blueBits = value; - break; - case GLX_ALPHA_SIZE: - config->alphaBits = value; - break; - case GLX_DEPTH_SIZE: - config->depthBits = value; - break; - case GLX_STENCIL_SIZE: - config->stencilBits = value; - break; - case GLX_ACCUM_RED_SIZE: - config->accumRedBits = value; - break; - case GLX_ACCUM_GREEN_SIZE: - config->accumGreenBits = value; - break; - case GLX_ACCUM_BLUE_SIZE: - config->accumBlueBits = value; - break; - case GLX_ACCUM_ALPHA_SIZE: - config->accumAlphaBits = value; - break; - case GLX_RENDER_TYPE: - config->renderType = value; - break; - case GLX_DRAWABLE_TYPE: - config->drawableType = value; - break; - case GLX_X_VISUAL_TYPE: - config->visualType = value; - break; - case GLX_CONFIG_CAVEAT: - config->visualCaveat = value; - break; - case GLX_TRANSPARENT_TYPE: - config->transparentType = value; - break; - case GLX_TRANSPARENT_INDEX_VALUE: - config->transparentIndex = value; - break; - case GLX_TRANSPARENT_RED_VALUE: - config->transparentRed = value; - break; - case GLX_TRANSPARENT_GREEN_VALUE: - config->transparentGreen = value; - break; - case GLX_TRANSPARENT_BLUE_VALUE: - config->transparentBlue = value; - break; - case GLX_TRANSPARENT_ALPHA_VALUE: - config->transparentAlpha = value; - break; - case GLX_MAX_PBUFFER_WIDTH: - config->maxPbufferWidth = value; - break; - case GLX_MAX_PBUFFER_HEIGHT: - config->maxPbufferHeight = value; - break; - case GLX_MAX_PBUFFER_PIXELS: - config->maxPbufferPixels = value; - break; - case GLX_VISUAL_ID: - config->associatedVisualId = value; - break; - - /* visualSelectGroup is an internal used property */ - case GLX_VISUAL_SELECT_GROUP_SGIX: - config->visualSelectGroup = value; - break; - - /* SGIS_multisample attributes */ - case GLX_SAMPLES_SGIS: - config->multiSampleSize = value; - break; - case GLX_SAMPLE_BUFFERS_SGIS: - config->nMultiSampleBuffers = value; - break; - - /* SGIX_pbuffer specific attributes */ - case GLX_OPTIMAL_PBUFFER_WIDTH_SGIX: - config->optimalPbufferWidth = value; - break; - case GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX: - config->optimalPbufferHeight = value; - break; - - default: - /* Ignore attributes we don't recognize */ - break; - } - } /* for j */ - - /* Fill in derived values */ - config->screen = screen; - - /* The rgbMode should be true for any mode which has distinguishible - * R, G and B components - */ - config->rgbMode = (config->renderType - & (GLX_RGBA_BIT | GLX_RGBA_FLOAT_BIT_ARB - | GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT)) != 0; - config->colorIndexMode = !config->rgbMode; - - config->haveAccumBuffer = - config->accumRedBits > 0 || - config->accumGreenBits > 0 || config->accumBlueBits > 0; - /* Can't have alpha without color */ - - config->haveDepthBuffer = config->depthBits > 0; - config->haveStencilBuffer = config->stencilBits > 0; - - /* overlay visuals are not valid for now */ - if (!config->level) { - config++; - numValidConfigs++; - } - - } /* for i */ - UnlockDisplay(dpy); - - config = fbconfigs; - for (i = 0; i < numValidConfigs; i++) { - - /* XXX hack to fill-in mask info (need a better way to do this) */ - if (config->associatedVisualId != 0) { - XVisualInfo *vis, template; - int n; - - template.screen = screen; - template.visualid = config->associatedVisualId; - vis = XGetVisualInfo(dpy, VisualScreenMask | VisualIDMask, - &template, &n); - - if (vis != NULL) { - config->redMask = (GLuint) vis->red_mask; - config->greenMask = (GLuint) vis->green_mask; - config->blueMask = (GLuint) vis->blue_mask; - config->alphaMask = 0; /* XXX */ - free(vis); - } - } - - config++; - } /* for i */ - - XFree(attrs); - SyncHandle(); - - *nconfigs = numValidConfigs; - return fbconfigs; -} - -__GLXvisualConfig * -GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig * fbconfigs, int nfbconfigs, - XVisualInfo * visuals, int nvisuals, - __GLXvisualConfig * glxConfigs, - int nGlxConfigs, int *nconfigs) -{ - __GLXvisualConfig *configs = NULL; - int i; - - if (!fbconfigs || !nfbconfigs || !nconfigs) - return NULL; - *nconfigs = 0; - - /* Allocate memory for our config structure */ - configs = (__GLXvisualConfig *) - Xmalloc(nfbconfigs * sizeof(__GLXvisualConfig)); - if (!configs) { - return NULL; - } - memset(configs, 0, nfbconfigs * sizeof(__GLXvisualConfig)); - - for (i = 0; i < nfbconfigs; i++) { - __GLXFBConfig *fbcfg = &fbconfigs[i]; - - if (fbcfg->associatedVisualId > 0) { - __GLXvisualConfig *cfg = configs + (*nconfigs); - int j; - XVisualInfo *vinfo = NULL; - - for (j = 0; j < nvisuals; j++) { - if (visuals[j].visualid == fbcfg->associatedVisualId) { - vinfo = &visuals[j]; - break; - } - } - if (!vinfo) - continue; - - /* skip 16 bit colormap visuals */ - if (vinfo->depth == 16 && - vinfo->class != TrueColor && vinfo->class != DirectColor) { - continue; - } - - (*nconfigs)++; - - /* - * if the same visualid exists in the glx configs, - * copy the glx attributes from the glx config - */ - for (j = 0; j < nGlxConfigs; j++) { - if (glxConfigs[j].vid == vinfo->visualid) - break; - } - if (j < nGlxConfigs) { - memcpy(cfg, &glxConfigs[j], sizeof(__GLXvisualConfig)); - continue; - } - - /* - * make glx attributes from the FB config attributes - */ - cfg->vid = fbcfg->associatedVisualId; - cfg->class = vinfo->class; - cfg->rgba = !(fbcfg->renderType & GLX_COLOR_INDEX_BIT_SGIX); - cfg->redSize = fbcfg->redBits; - cfg->greenSize = fbcfg->greenBits; - cfg->blueSize = fbcfg->blueBits; - cfg->alphaSize = fbcfg->alphaBits; - cfg->redMask = fbcfg->redMask; - cfg->greenMask = fbcfg->greenMask; - cfg->blueMask = fbcfg->blueMask; - cfg->alphaMask = fbcfg->alphaMask; - cfg->accumRedSize = fbcfg->accumRedBits; - cfg->accumGreenSize = fbcfg->accumGreenBits; - cfg->accumBlueSize = fbcfg->accumBlueBits; - cfg->accumAlphaSize = fbcfg->accumAlphaBits; - cfg->doubleBuffer = fbcfg->doubleBufferMode; - cfg->stereo = fbcfg->stereoMode; - if (vinfo->class == TrueColor || vinfo->class == DirectColor) { - cfg->bufferSize = (fbcfg->rgbMode ? (fbcfg->redBits + - fbcfg->greenBits + - fbcfg->blueBits + - fbcfg->alphaBits) - : fbcfg->indexBits); - } - else { - cfg->bufferSize = vinfo->depth; - } - cfg->depthSize = fbcfg->depthBits; - cfg->stencilSize = fbcfg->stencilBits; - cfg->auxBuffers = fbcfg->maxAuxBuffers; - cfg->level = fbcfg->level; - cfg->visualRating = fbcfg->visualCaveat; - cfg->transparentPixel = fbcfg->transparentType; - cfg->transparentRed = fbcfg->transparentRed; - cfg->transparentGreen = fbcfg->transparentGreen; - cfg->transparentBlue = fbcfg->transparentBlue; - cfg->transparentAlpha = fbcfg->transparentAlpha; - cfg->transparentIndex = fbcfg->transparentIndex; - cfg->multiSampleSize = fbcfg->multiSampleSize; - cfg->nMultiSampleBuffers = fbcfg->nMultiSampleBuffers; - cfg->visualSelectGroup = fbcfg->visualSelectGroup; - } - } - - return configs; -} diff --git a/hw/dmx/dmx_glxvisuals.h b/hw/dmx/dmx_glxvisuals.h deleted file mode 100644 index 54c3b44ca..000000000 --- a/hw/dmx/dmx_glxvisuals.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifndef _GLXVISUALS_H -#define _GLXVISUALS_H - -#include <GL/glxint.h> - -/** GLX Visual private area. */ -typedef struct { - int x_visual_depth; - int x_visual_class; -} dmxGlxVisualPrivate; - -__GLXvisualConfig *GetGLXVisualConfigs(Display * dpy, - int screen, int *nconfigs); - -__GLXFBConfig *GetGLXFBConfigs(Display * dpy, - int glxMajorOpcode, int *nconfigs); - -__GLXvisualConfig *GetGLXVisualConfigsFromFBConfigs(__GLXFBConfig * fbconfigs, - int nfbconfigs, - XVisualInfo * visuals, - int nvisuals, - __GLXvisualConfig - * glxConfigs, - int nGlxConfigs, - int *nconfigs); - -#endif diff --git a/hw/dmx/dmxcb.c b/hw/dmx/dmxcb.c deleted file mode 100644 index 6d652c32b..000000000 --- a/hw/dmx/dmxcb.c +++ /dev/null @@ -1,229 +0,0 @@ -/* - * 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This code queries and modifies the connection block. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxcb.h" -#include "dmxinput.h" -#include "dmxlog.h" - -extern int connBlockScreenStart; - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -int dmxGlobalWidth, dmxGlobalHeight; - -/** We may want the wall dimensions to be different from the bounding - * box dimensions that Xinerama computes, so save those and update them - * here. - */ -void -dmxSetWidthHeight(int width, int height) -{ - dmxGlobalWidth = width; - dmxGlobalHeight = height; -} - -/** Computes the global bounding box for DMX. This may be larger than - * the one computed by Xinerama because of the DMX configuration - * file. */ -void -dmxComputeWidthHeight(DMXRecomputeFlag flag) -{ - int i; - DMXScreenInfo *dmxScreen; - int w = 0; - int h = 0; - - for (i = 0; i < dmxNumScreens; i++) { - /* Don't use root* here because this is - * the global bounding box. */ - dmxScreen = &dmxScreens[i]; - if (w < dmxScreen->scrnWidth + dmxScreen->rootXOrigin) - w = dmxScreen->scrnWidth + dmxScreen->rootXOrigin; - if (h < dmxScreen->scrnHeight + dmxScreen->rootYOrigin) - h = dmxScreen->scrnHeight + dmxScreen->rootYOrigin; - } - if (!dmxGlobalWidth && !dmxGlobalHeight) { - dmxLog(dmxInfo, "Using %dx%d as global bounding box\n", w, h); - } - else { - switch (flag) { - case DMX_NO_RECOMPUTE_BOUNDING_BOX: - dmxLog(dmxInfo, - "Using old bounding box (%dx%d) instead of new (%dx%d)\n", - dmxGlobalWidth, dmxGlobalHeight, w, h); - w = dmxGlobalWidth; - h = dmxGlobalHeight; - break; - case DMX_RECOMPUTE_BOUNDING_BOX: - dmxLog(dmxInfo, - "Using %dx%d as global bounding box, instead of %dx%d\n", - w, h, dmxGlobalWidth, dmxGlobalHeight); - break; - } - } - - dmxGlobalWidth = w; - dmxGlobalHeight = h; -} - -/** A callback routine that hooks into Xinerama and provides a - * convenient place to print summary log information during server - * startup. This routine does not modify any values. */ -void -dmxConnectionBlockCallback(void) -{ - xWindowRoot *root = (xWindowRoot *) (ConnectionInfo + connBlockScreenStart); - int offset = connBlockScreenStart + sizeof(xWindowRoot); - int i; - Bool *found = NULL; - - MAXSCREENSALLOC(found); - if (!found) - dmxLog(dmxFatal, "dmxConnectionBlockCallback: out of memory\n"); - - dmxLog(dmxInfo, "===== Start of Summary =====\n"); -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - if (dmxGlobalWidth && dmxGlobalHeight - && (dmxGlobalWidth != PanoramiXPixWidth - || dmxGlobalHeight != PanoramiXPixHeight)) { - dmxLog(dmxInfo, - "Changing Xinerama dimensions from %d %d to %d %d\n", - PanoramiXPixWidth, PanoramiXPixHeight, - dmxGlobalWidth, dmxGlobalHeight); - PanoramiXPixWidth = root->pixWidth = dmxGlobalWidth; - PanoramiXPixHeight = root->pixHeight = dmxGlobalHeight; - } - else { - dmxGlobalWidth = PanoramiXPixWidth; - dmxGlobalHeight = PanoramiXPixHeight; - } - dmxLog(dmxInfo, "%d screens configured with Xinerama (%d %d)\n", - PanoramiXNumScreens, PanoramiXPixWidth, PanoramiXPixHeight); - FOR_NSCREENS(i) found[i] = FALSE; - } - else { -#endif - /* This never happens because we're - * either called from a Xinerama - * callback or during reconfiguration - * (which only works with Xinerama on). - * In any case, be reasonable. */ - dmxLog(dmxInfo, "%d screens configured (%d %d)\n", - screenInfo.numScreens, root->pixWidth, root->pixHeight); -#ifdef PANORAMIX - } -#endif - - for (i = 0; i < root->nDepths; i++) { - xDepth *depth = (xDepth *) (ConnectionInfo + offset); - int voffset = offset + sizeof(xDepth); - xVisualType *visual = (xVisualType *) (ConnectionInfo + voffset); - int j; - - dmxLog(dmxInfo, "%d visuals at depth %d:\n", - depth->nVisuals, depth->depth); - for (j = 0; j < depth->nVisuals; j++, visual++) { - XVisualInfo vi; - - vi.visual = NULL; - vi.visualid = visual->visualID; - vi.screen = 0; - vi.depth = depth->depth; - vi.class = visual->class; - vi.red_mask = visual->redMask; - vi.green_mask = visual->greenMask; - vi.blue_mask = visual->blueMask; - vi.colormap_size = visual->colormapEntries; - vi.bits_per_rgb = visual->bitsPerRGB; - dmxLogVisual(NULL, &vi, 0); - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - int k; - - FOR_NSCREENS(k) { - DMXScreenInfo *dmxScreen = &dmxScreens[k]; - - if (dmxScreen->beDisplay) { - XVisualInfo *pvi = - &dmxScreen->beVisuals[dmxScreen->beDefVisualIndex]; - if (pvi->depth == depth->depth && - pvi->class == visual->class) - found[k] = TRUE; - } - else { - /* Screen #k is detached, so it always succeeds */ - found[k] = TRUE; - } - } - } -#endif - } - offset = voffset + depth->nVisuals * sizeof(xVisualType); - } - - dmxInputLogDevices(); - dmxLog(dmxInfo, "===== End of Summary =====\n"); - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - Bool fatal = FALSE; - - FOR_NSCREENS(i) { - fatal |= !found[i]; - if (!found[i]) { - dmxLog(dmxError, - "The default visual for screen #%d does not match " - "any of the\n", i); - dmxLog(dmxError, - "consolidated visuals from Xinerama (listed above)\n"); - } - } - if (fatal) - dmxLog(dmxFatal, - "dmxConnectionBlockCallback: invalid screen(s) found"); - } -#endif - MAXSCREENSFREE(found); -} diff --git a/hw/dmx/dmxcb.h b/hw/dmx/dmxcb.h deleted file mode 100644 index ca8a2566d..000000000 --- a/hw/dmx/dmxcb.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2001,2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Header file for connection block functions. \see dmxcb.c. - */ - -#ifndef _DMXCB_H_ -#define _DMXCB_H_ -/** The cursor position, in global coordinates. */ -extern int dmxGlobalWidth, dmxGlobalHeight; - -/** #dmxComputeWidthHeight can either recompute the global bounding box - * or not. */ -typedef enum { - DMX_RECOMPUTE_BOUNDING_BOX, - DMX_NO_RECOMPUTE_BOUNDING_BOX -} DMXRecomputeFlag; - -extern void dmxSetWidthHeight(int width, int height); -extern void dmxComputeWidthHeight(DMXRecomputeFlag flag); -extern void dmxConnectionBlockCallback(void); -#endif diff --git a/hw/dmx/dmxclient.h b/hw/dmx/dmxclient.h deleted file mode 100644 index be8116f14..000000000 --- a/hw/dmx/dmxclient.h +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (c) 1995 X Consortium - * Copyright 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 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, THE X CONSORTIUM, - * 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. - * - * Except as contained in this notice, the name of the X Consortium - * shall not be used in advertising or otherwise to promote the sale, - * use or other dealings in this Software without prior written - * authorization from the X Consortium. - */ - -/* - * Derived from hw/xnest/Xnest.h by Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * This file includes all client-side include files with proper wrapping. - */ - -#ifndef _DMXCLIENT_H_ -#define _DMXCLIENT_H_ - -#define GC XlibGC - -#ifdef _XSERVER64 -#define DMX64 -#undef _XSERVER64 -typedef unsigned long XID64; -typedef unsigned long Mask64; -typedef unsigned long Atom64; -typedef unsigned long VisualID64; -typedef unsigned long Time64; - -#define XID XID64 -#define Mask Mask64 -#define Atom Atom64 -#define VisualID VisualID64 -#define Time Time64 -typedef XID Window64; -typedef XID Drawable64; -typedef XID Font64; -typedef XID Pixmap64; -typedef XID Cursor64; -typedef XID Colormap64; -typedef XID GContext64; -typedef XID KeySym64; - -#define Window Window64 -#define Drawable Drawable64 -#define Font Font64 -#define Pixmap Pixmap64 -#define Cursor Cursor64 -#define Colormap Colormap64 -#define GContext GContext64 -#define KeySym KeySym64 -#endif - -#include <X11/Xlib.h> -#include <X11/Xlibint.h> /* For _XExtension */ -#include <X11/X.h> /* from glxserver.h */ -#include <X11/Xmd.h> /* from glxserver.h */ -#include <X11/Xproto.h> -#include <X11/Xutil.h> -#include <X11/Xatom.h> -#include <X11/cursorfont.h> - -#include <X11/extensions/shape.h> - -#include <X11/extensions/Xrender.h> -#undef PictFormatType - -#include <X11/extensions/XKB.h> -#include "xkbstr.h" - -#include <X11/extensions/XI.h> - -/* Always include these, since we query them even if we don't export XINPUT. */ -#include <X11/extensions/XInput.h> /* For XDevice */ -#include <X11/extensions/Xext.h> - -#undef GC - -#ifdef DMX64 -#define _XSERVER64 -#undef XID -#undef Mask -#undef Atom -#undef VisualID -#undef Time -#undef Window -#undef Drawable -#undef Font -#undef Pixmap -#undef Cursor -#undef Colormap -#undef GContext -#undef KeySym -#endif - -/* Some protocol gets included last, after undefines. */ -#include <X11/XKBlib.h> -#include <X11/extensions/XKBproto.h> -#include "xkbstr.h" -#undef XPointer -#include <X11/extensions/XIproto.h> - -#endif diff --git a/hw/dmx/dmxcmap.c b/hw/dmx/dmxcmap.c deleted file mode 100644 index 7a87a9864..000000000 --- a/hw/dmx/dmxcmap.c +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Colormap support. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxlog.h" -#include "dmxsync.h" -#include "dmxcmap.h" -#include "dmxvisual.h" - -#include "micmap.h" - -static Bool -dmxAllocateColormapPrivates(ColormapPtr pColormap) -{ - dmxColormapPrivPtr pCmapPriv; - - pCmapPriv = (dmxColormapPrivPtr) malloc(sizeof(*pCmapPriv)); - if (!pCmapPriv) - return FALSE; - pCmapPriv->cmap = (Colormap) 0; - - DMX_SET_COLORMAP_PRIV(pColormap, pCmapPriv); - - return TRUE; -} - -/** Create \a pColormap on the back-end server. */ -Bool -dmxBECreateColormap(ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); - VisualPtr pVisual = pColormap->pVisual; - Visual *visual = dmxLookupVisual(pScreen, pVisual); - - if (visual) { - pCmapPriv->cmap = XCreateColormap(dmxScreen->beDisplay, - dmxScreen->scrnWin, - visual, - (pVisual->class & DynamicClass ? - AllocAll : AllocNone)); - return pCmapPriv->cmap != 0; - } - else { - dmxLog(dmxWarning, "dmxBECreateColormap: No visual found\n"); - return 0; - } -} - -/** Create colormap on back-end server associated with \a pColormap's - * screen. */ -Bool -dmxCreateColormap(ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - - if (!dmxAllocateColormapPrivates(pColormap)) - return FALSE; - - if (dmxScreen->beDisplay) { - if (!dmxBECreateColormap(pColormap)) - return FALSE; - } - - DMX_UNWRAP(CreateColormap, dmxScreen, pScreen); - if (pScreen->CreateColormap) - ret = pScreen->CreateColormap(pColormap); - DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen); - - return ret; -} - -/** Destroy \a pColormap on the back-end server. */ -Bool -dmxBEFreeColormap(ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); - - if (pCmapPriv->cmap) { - XFreeColormap(dmxScreen->beDisplay, pCmapPriv->cmap); - pCmapPriv->cmap = (Colormap) 0; - return TRUE; - } - - return FALSE; -} - -/** Destroy colormap on back-end server associated with \a pColormap's - * screen. */ -void -dmxDestroyColormap(ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); - - if (dmxScreen->beDisplay) - dmxBEFreeColormap(pColormap); - free(pCmapPriv); - DMX_SET_COLORMAP_PRIV(pColormap, NULL); - - DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen); - if (pScreen->DestroyColormap) - pScreen->DestroyColormap(pColormap); - DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen); -} - -/** Install colormap on back-end server associated with \a pColormap's - * screen. */ -void -dmxInstallColormap(ColormapPtr pColormap) -{ - ScreenPtr pScreen = pColormap->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); - - DMX_UNWRAP(InstallColormap, dmxScreen, pScreen); - if (pScreen->InstallColormap) - pScreen->InstallColormap(pColormap); - DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen); - - if (dmxScreen->beDisplay) { - XInstallColormap(dmxScreen->beDisplay, pCmapPriv->cmap); - dmxSync(dmxScreen, FALSE); - } -} - -/** Store colors in \a pColormap on back-end server associated with \a - * pColormap's screen. */ -void -dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef) -{ - ScreenPtr pScreen = pColormap->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxColormapPrivPtr pCmapPriv = DMX_GET_COLORMAP_PRIV(pColormap); - - if (dmxScreen->beDisplay && (pColormap->pVisual->class & DynamicClass)) { - XColor *color = xallocarray(ndef, sizeof(*color)); - int i; - - if (color) { - for (i = 0; i < ndef; i++) { - color[i].pixel = pdef[i].pixel; - color[i].red = pdef[i].red; - color[i].blue = pdef[i].blue; - color[i].green = pdef[i].green; - color[i].flags = pdef[i].flags; - color[i].pad = pdef[i].pad; - } - XStoreColors(dmxScreen->beDisplay, pCmapPriv->cmap, color, ndef); - free(color); - } - else { /* xalloc failed, so fallback */ - XColor c; - - for (i = 0; i < ndef; i++) { - c.pixel = pdef[i].pixel; - c.red = pdef[i].red; - c.blue = pdef[i].blue; - c.green = pdef[i].green; - c.flags = pdef[i].flags; - c.pad = pdef[i].pad; - XStoreColor(dmxScreen->beDisplay, pCmapPriv->cmap, &c); - } - } - dmxSync(dmxScreen, FALSE); - } - - DMX_UNWRAP(StoreColors, dmxScreen, pScreen); - if (pScreen->StoreColors) - pScreen->StoreColors(pColormap, ndef, pdef); - DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen); -} - -/** Create the DMX server's default colormap. */ -Bool -dmxCreateDefColormap(ScreenPtr pScreen) -{ - return miCreateDefColormap(pScreen); -} diff --git a/hw/dmx/dmxcmap.h b/hw/dmx/dmxcmap.h deleted file mode 100644 index 29318b586..000000000 --- a/hw/dmx/dmxcmap.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright 2002-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> - * - */ - -/** \file - * Header file for colormap support. \see dmxcmap.c. */ - -#ifndef DMXCMAP_H -#define DMXCMAP_H - -#include "colormapst.h" - -/** Colormap private area. */ -typedef struct _dmxColormapPriv { - Colormap cmap; -} dmxColormapPrivRec, *dmxColormapPrivPtr; - -extern Bool dmxCreateColormap(ColormapPtr pColormap); -extern void dmxDestroyColormap(ColormapPtr pColormap); -extern void dmxInstallColormap(ColormapPtr pColormap); -extern void dmxStoreColors(ColormapPtr pColormap, int ndef, xColorItem * pdef); - -extern Bool dmxCreateDefColormap(ScreenPtr pScreen); - -extern Bool dmxBECreateColormap(ColormapPtr pColormap); -extern Bool dmxBEFreeColormap(ColormapPtr pColormap); - -/** Set colormap private structure. */ -#define DMX_SET_COLORMAP_PRIV(_pCMap, _pCMapPriv) \ - dixSetPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey, _pCMapPriv) - -/** Get colormap private structure. */ -#define DMX_GET_COLORMAP_PRIV(_pCMap) (dmxColormapPrivPtr) \ - dixLookupPrivate(&(_pCMap)->devPrivates, dmxColormapPrivateKey) - -#endif /* DMXCMAP_H */ diff --git a/hw/dmx/dmxcursor.c b/hw/dmx/dmxcursor.c deleted file mode 100644 index c5ae2a620..000000000 --- a/hw/dmx/dmxcursor.c +++ /dev/null @@ -1,1023 +0,0 @@ -/* - * 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file contains code than supports cursor movement, including the - * code that initializes and reinitializes the screen positions and - * computes screen overlap. - * - * "This code is based very closely on the XFree86 equivalent - * (xfree86/common/xf86Cursor.c)." --David Dawes. - * - * "This code was then extensively re-written, as explained here." - * --Rik Faith - * - * The code in xf86Cursor.c used edge lists to implement the - * CursorOffScreen function. The edge list computation was complex - * (especially in the face of arbitrarily overlapping screens) compared - * with the speed savings in the CursorOffScreen function. The new - * implementation has erred on the side of correctness, readability, and - * maintainability over efficiency. For the common (non-edge) case, the - * dmxCursorOffScreen function does avoid a loop over all the screens. - * When the cursor has left the screen, all the screens are searched, - * and the first screen (in dmxScreens order) containing the cursor will - * be returned. If run-time profiling shows that this routing is a - * performance bottle-neck, then an edge list may have to be - * reimplemented. An edge list algorithm is O(edges) whereas the new - * algorithm is O(dmxNumScreens). Since edges is usually 1-3 and - * dmxNumScreens may be 30-60 for large backend walls, this trade off - * may be compelling. - * - * The xf86InitOrigins routine uses bit masks during the computation and - * is therefore limited to the length of a word (e.g., 32 or 64 bits) - * screens. Because Xdmx is expected to be used with a large number of - * backend displays, this limitation was removed. The new - * implementation has erred on the side of readability over efficiency, - * using the dmxSL* routines to manage a screen list instead of a - * bitmap, and a function call to decrease the length of the main - * routine. Both algorithms are of the same order, and both are called - * only at server generation time, so trading clarity and long-term - * maintainability for efficiency does not seem justified in this case. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_CURSOR_DEBUG 0 - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxcursor.h" -#include "dmxlog.h" -#include "dmxprop.h" -#include "dmxinput.h" - -#include "mipointer.h" -#include "windowstr.h" -#include "globals.h" -#include "cursorstr.h" -#include "dixevents.h" /* For GetSpriteCursor() */ -#include "inputstr.h" /* for inputInfo.pointer */ - -#if DMX_CURSOR_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#endif - -static int dmxCursorDoMultiCursors = 1; - -/** Turn off support for displaying multiple cursors on overlapped - back-end displays. See #dmxCursorDoMultiCursors. */ -void -dmxCursorNoMulti(void) -{ - dmxCursorDoMultiCursors = 0; -} - -static Bool -dmxCursorOffScreen(ScreenPtr *ppScreen, int *x, int *y) -{ - DMXScreenInfo *dmxScreen; - int i; - int localX = *x; - int localY = *y; - int globalX; - int globalY; - - if (screenInfo.numScreens == 1) - return FALSE; - - /* On current screen? */ - dmxScreen = &dmxScreens[(*ppScreen)->myNum]; - if (localX >= 0 - && localX < dmxScreen->rootWidth - && localY >= 0 && localY < dmxScreen->rootHeight) - return FALSE; - - /* Convert to global coordinate space */ - globalX = dmxScreen->rootXOrigin + localX; - globalY = dmxScreen->rootYOrigin + localY; - - /* Is cursor on the current screen? - * This efficiently exits this routine - * for the most common case. */ - if (ppScreen && *ppScreen) { - dmxScreen = &dmxScreens[(*ppScreen)->myNum]; - if (globalX >= dmxScreen->rootXOrigin - && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth - && globalY >= dmxScreen->rootYOrigin - && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) - return FALSE; - } - - /* Find first screen cursor is on */ - for (i = 0; i < dmxNumScreens; i++) { - dmxScreen = &dmxScreens[i]; - if (globalX >= dmxScreen->rootXOrigin - && globalX < dmxScreen->rootXOrigin + dmxScreen->rootWidth - && globalY >= dmxScreen->rootYOrigin - && globalY < dmxScreen->rootYOrigin + dmxScreen->rootHeight) { - if (dmxScreen->index == (*ppScreen)->myNum) - return FALSE; - *ppScreen = screenInfo.screens[dmxScreen->index]; - *x = globalX - dmxScreen->rootXOrigin; - *y = globalY - dmxScreen->rootYOrigin; - return TRUE; - } - } - return FALSE; -} - -static void -dmxCrossScreen(ScreenPtr pScreen, Bool entering) -{ -} - -static void -dmxWarpCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - DMXDBG3("dmxWarpCursor(%d,%d,%d)\n", pScreen->myNum, x, y); -#if 11 /*BP*/ - /* This call is deprecated. Replace with???? */ - miPointerWarpCursor(pDev, pScreen, x, y); -#else - pScreen->SetCursorPosition(pDev, pScreen, x, y, FALSE); -#endif -} - -miPointerScreenFuncRec dmxPointerCursorFuncs = { - dmxCursorOffScreen, - dmxCrossScreen, - dmxWarpCursor, -}; - -/** Create a list of screens that we'll manipulate. */ -static int * -dmxSLCreate(void) -{ - int *list = xallocarray(dmxNumScreens, sizeof(*list)); - int i; - - for (i = 0; i < dmxNumScreens; i++) - list[i] = 1; - return list; -} - -/** Free list. */ -static void -dmxSLFree(int *list) -{ - free(list); -} - -/** Find next uninitialized entry in list. */ -static int -dmxSLFindNext(int *list) -{ - int i; - - for (i = 0; i < dmxNumScreens; i++) - if (list[i]) - return i; - return -1; -} - -/** Make one pass over all the screens and return the number updated. */ -static int -dmxTryComputeScreenOrigins(int *screensLeft) -{ - ScreenPtr pScreen, refScreen; - DMXScreenInfo *screen; - int i, ref; - int changed = 0; - - for (i = 0; i < dmxNumScreens; i++) { - if (!screensLeft[i]) - continue; - screen = &dmxScreens[i]; - pScreen = screenInfo.screens[i]; - switch (screen->where) { - case PosAbsolute: - pScreen->x = screen->whereX; - pScreen->y = screen->whereY; - ++changed, screensLeft[i] = 0; - break; - case PosRelative: - ref = screen->whereRefScreen; - if (screensLeft[ref]) - break; - refScreen = screenInfo.screens[ref]; - pScreen->x = refScreen->x + screen->whereX; - pScreen->y = refScreen->y + screen->whereY; - ++changed, screensLeft[i] = 0; - break; - case PosRightOf: - ref = screen->whereRefScreen; - if (screensLeft[ref]) - break; - refScreen = screenInfo.screens[ref]; - pScreen->x = refScreen->x + refScreen->width; - pScreen->y = refScreen->y; - ++changed, screensLeft[i] = 0; - break; - case PosLeftOf: - ref = screen->whereRefScreen; - if (screensLeft[ref]) - break; - refScreen = screenInfo.screens[ref]; - pScreen->x = refScreen->x - pScreen->width; - pScreen->y = refScreen->y; - ++changed, screensLeft[i] = 0; - break; - case PosBelow: - ref = screen->whereRefScreen; - if (screensLeft[ref]) - break; - refScreen = screenInfo.screens[ref]; - pScreen->x = refScreen->x; - pScreen->y = refScreen->y + refScreen->height; - ++changed, screensLeft[i] = 0; - break; - case PosAbove: - ref = screen->whereRefScreen; - if (screensLeft[ref]) - break; - refScreen = screenInfo.screens[ref]; - pScreen->x = refScreen->x; - pScreen->y = refScreen->y - pScreen->height; - ++changed, screensLeft[i] = 0; - break; - case PosNone: - dmxLog(dmxFatal, "No position information for screen %d\n", i); - } - } - return changed; -} - -static void -dmxComputeScreenOrigins(void) -{ - ScreenPtr pScreen; - int *screensLeft; - int i, ref; - int minX, minY; - - /* Compute origins based on - * configuration information. */ - screensLeft = dmxSLCreate(); - while ((i = dmxSLFindNext(screensLeft)) >= 0) { - while (dmxTryComputeScreenOrigins(screensLeft)); - if ((i = dmxSLFindNext(screensLeft)) >= 0) { - /* All of the remaining screens are referencing each other. - * Assign a value to one of them and go through again. This - * guarantees that we will eventually terminate. - */ - ref = dmxScreens[i].whereRefScreen; - pScreen = screenInfo.screens[ref]; - pScreen->x = pScreen->y = 0; - screensLeft[ref] = 0; - } - } - dmxSLFree(screensLeft); - - /* Justify the topmost and leftmost to - * (0,0). */ - minX = screenInfo.screens[0]->x; - minY = screenInfo.screens[0]->y; - for (i = 1; i < dmxNumScreens; i++) { /* Compute minX, minY */ - if (screenInfo.screens[i]->x < minX) - minX = screenInfo.screens[i]->x; - if (screenInfo.screens[i]->y < minY) - minY = screenInfo.screens[i]->y; - } - if (minX || minY) { - for (i = 0; i < dmxNumScreens; i++) { - screenInfo.screens[i]->x -= minX; - screenInfo.screens[i]->y -= minY; - } - } - - update_desktop_dimensions(); -} - -/** Recompute origin information in the #dmxScreens list. This is - * called from #dmxInitOrigins. */ -void -dmxReInitOrigins(void) -{ - int i; - - if (dmxNumScreens > MAXSCREENS) - dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n", - dmxNumScreens, MAXSCREENS); - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - dmxLogOutput(dmxScreen, - "s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d" - " (be=%dx%d depth=%d bpp=%d)\n", - dmxScreen->scrnWidth, dmxScreen->scrnHeight, - dmxScreen->scrnX, dmxScreen->scrnY, - dmxScreen->rootWidth, dmxScreen->rootHeight, - dmxScreen->rootX, dmxScreen->rootY, - dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, - dmxScreen->beWidth, dmxScreen->beHeight, - dmxScreen->beDepth, dmxScreen->beBPP); - } -} - -/** Initialize screen origins (and relative position). This is called - * for each server generation. For dynamic reconfiguration, use - * #dmxReInitOrigins() instead. */ -void -dmxInitOrigins(void) -{ - int i; - - if (dmxNumScreens > MAXSCREENS) - dmxLog(dmxFatal, "dmxNumScreens = %d > MAXSCREENS = %d\n", - dmxNumScreens, MAXSCREENS); - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - dmxLogOutput(dmxScreen, - "(request) s=%dx%d%+d%+d r=%dx%d%+d%+d @%d,%d (%d)" - " (be=%dx%d depth=%d bpp=%d)\n", - dmxScreen->scrnWidth, dmxScreen->scrnHeight, - dmxScreen->scrnX, dmxScreen->scrnY, - dmxScreen->rootWidth, dmxScreen->rootHeight, - dmxScreen->rootX, dmxScreen->rootY, - dmxScreen->whereX, dmxScreen->whereY, - dmxScreen->where, - dmxScreen->beWidth, dmxScreen->beHeight, - dmxScreen->beDepth, dmxScreen->beBPP); - } - - dmxComputeScreenOrigins(); - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - dmxScreen->rootXOrigin = screenInfo.screens[i]->x; - dmxScreen->rootYOrigin = screenInfo.screens[i]->y; - } - - dmxReInitOrigins(); -} - -/** Returns non-zero if the global \a x, \a y coordinate is on the - * screen window of the \a dmxScreen. */ -int -dmxOnScreen(int x, int y, DMXScreenInfo * dmxScreen) -{ -#if DMX_CURSOR_DEBUG > 1 - dmxLog(dmxDebug, - "dmxOnScreen %d %d,%d (r=%dx%d%+d%+d@%d,%d s=%dx%d%+d%+d)\n", - dmxScreen->index, x, y, - dmxScreen->rootWidth, dmxScreen->rootHeight, - dmxScreen->rootX, dmxScreen->rootY, - dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, - dmxScreen->scrnWidth, dmxScreen->scrnHeight, - dmxScreen->scrnX, dmxScreen->scrnY); -#endif - if (x >= dmxScreen->rootXOrigin - && x < dmxScreen->rootXOrigin + dmxScreen->rootWidth - && y >= dmxScreen->rootYOrigin - && y < dmxScreen->rootYOrigin + dmxScreen->rootHeight) - return 1; - return 0; -} - -/** Returns non-zero if \a a overlaps \a b. */ -static int -dmxDoesOverlap(DMXScreenInfo * a, DMXScreenInfo * b) -{ - if (dmxOnScreen(a->rootXOrigin, a->rootYOrigin, b)) - return 1; - - if (dmxOnScreen(a->rootXOrigin, a->rootYOrigin + a->scrnWidth, b)) - return 1; - - if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, a->rootYOrigin, b)) - return 1; - - if (dmxOnScreen(a->rootXOrigin + a->scrnHeight, - a->rootYOrigin + a->scrnWidth, b)) - return 1; - - if (dmxOnScreen(b->rootXOrigin, b->rootYOrigin, a)) - return 1; - - if (dmxOnScreen(b->rootXOrigin, b->rootYOrigin + b->scrnWidth, a)) - return 1; - - if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, b->rootYOrigin, a)) - return 1; - - if (dmxOnScreen(b->rootXOrigin + b->scrnHeight, - b->rootYOrigin + b->scrnWidth, a)) - return 1; - - return 0; -} - -/** Used with \a dmxInterateOverlap to print out a list of screens which - * overlap each other. */ -static void * -dmxPrintOverlap(DMXScreenInfo * dmxScreen, void *closure) -{ - DMXScreenInfo *a = closure; - - if (dmxScreen != a) { - if (dmxScreen->cursorNotShared) - dmxLogOutputCont(a, " [%d/%s]", dmxScreen->index, dmxScreen->name); - else - dmxLogOutputCont(a, " %d/%s", dmxScreen->index, dmxScreen->name); - } - return NULL; -} - -/** Iterate over the screens which overlap with the \a start screen, - * calling \a f with the \a closure for each argument. Often used with - * #dmxPrintOverlap. */ -static void * -dmxIterateOverlap(DMXScreenInfo * start, - void *(*f) (DMXScreenInfo * dmxScreen, void *), void *closure) -{ - DMXScreenInfo *pt; - - if (!start->over) - return f(start, closure); - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - void *retval; - - if ((retval = f(pt, closure))) - return retval; - if (pt == start) - break; - } - return NULL; -} - -/** Used with #dmxPropertyIterate to determine if screen \a a is the - * same as the screen \a closure. */ -static void * -dmxTestSameDisplay(DMXScreenInfo * a, void *closure) -{ - DMXScreenInfo *b = closure; - - if (a == b) - return a; - return NULL; -} - -/** Detects overlapping dmxScreens and creates circular lists. This - * uses an O(dmxNumScreens^2) algorithm, but dmxNumScreens is < 100 and - * the computation only needs to be performed for every server - * generation or dynamic reconfiguration . */ -void -dmxInitOverlap(void) -{ - int i, j; - DMXScreenInfo *a, *b, *pt; - - for (i = 0; i < dmxNumScreens; i++) - dmxScreens[i].over = NULL; - - for (i = 0; i < dmxNumScreens; i++) { - a = &dmxScreens[i]; - - for (j = i + 1; j < dmxNumScreens; j++) { - b = &dmxScreens[j]; - if (b->over) - continue; - - if (dmxDoesOverlap(a, b)) { - DMXDBG6("%d overlaps %d: a=%p %p b=%p %p\n", - a->index, b->index, a, a->over, b, b->over); - b->over = (a->over ? a->over : a); - a->over = b; - } - } - } - - for (i = 0; i < dmxNumScreens; i++) { - a = &dmxScreens[i]; - - if (!a->over) - continue; - - /* Flag all pairs that are on same display */ - for (pt = a->over; pt != a; pt = pt->over) { - if (dmxPropertyIterate(a, dmxTestSameDisplay, pt)) { - /* The ->over sets contain the transitive set of screens - * that overlap. For screens that are on the same - * backend display, we only want to exclude pairs of - * screens that mutually overlap on the backend display, - * so we call dmxDoesOverlap, which is stricter than the - * ->over set. */ - if (!dmxDoesOverlap(a, pt)) - continue; - a->cursorNotShared = 1; - pt->cursorNotShared = 1; - dmxLog(dmxInfo, - "Screen %d and %d overlap on %s\n", - a->index, pt->index, a->name); - } - } - } - - for (i = 0; i < dmxNumScreens; i++) { - a = &dmxScreens[i]; - - if (a->over) { - dmxLogOutput(a, "Overlaps"); - dmxIterateOverlap(a, dmxPrintOverlap, a); - dmxLogOutputCont(a, "\n"); - } - } -} - -/** Create \a pCursor on the back-end associated with \a pScreen. */ -void -dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); - CursorBitsPtr pBits = pCursor->bits; - Pixmap src, msk; - XColor fg, bg; - XImage *img; - XlibGC gc = NULL; - XGCValues v; - unsigned long m; - int i; - - if (!pCursorPriv) - return; - - m = GCFunction | GCPlaneMask | GCForeground | GCBackground | GCClipMask; - v.function = GXcopy; - v.plane_mask = AllPlanes; - v.foreground = 1L; - v.background = 0L; - v.clip_mask = None; - - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (dmxScreen->bePixmapFormats[i].depth == 1) { - /* Create GC in the back-end servers */ - gc = XCreateGC(dmxScreen->beDisplay, dmxScreen->scrnDefDrawables[i], - m, &v); - break; - } - } - if (!gc) - dmxLog(dmxFatal, "dmxRealizeCursor: gc not initialized\n"); - - src = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, - pBits->width, pBits->height, 1); - msk = XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, - pBits->width, pBits->height, 1); - - img = XCreateImage(dmxScreen->beDisplay, - dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, - 1, XYBitmap, 0, (char *) pBits->source, - pBits->width, pBits->height, - BitmapPad(dmxScreen->beDisplay), 0); - - XPutImage(dmxScreen->beDisplay, src, gc, img, 0, 0, 0, 0, - pBits->width, pBits->height); - - XFree(img); - - img = XCreateImage(dmxScreen->beDisplay, - dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, - 1, XYBitmap, 0, (char *) pBits->mask, - pBits->width, pBits->height, - BitmapPad(dmxScreen->beDisplay), 0); - - XPutImage(dmxScreen->beDisplay, msk, gc, img, 0, 0, 0, 0, - pBits->width, pBits->height); - - XFree(img); - - fg.red = pCursor->foreRed; - fg.green = pCursor->foreGreen; - fg.blue = pCursor->foreBlue; - - bg.red = pCursor->backRed; - bg.green = pCursor->backGreen; - bg.blue = pCursor->backBlue; - - pCursorPriv->cursor = XCreatePixmapCursor(dmxScreen->beDisplay, - src, msk, - &fg, &bg, - pBits->xhot, pBits->yhot); - - XFreePixmap(dmxScreen->beDisplay, src); - XFreePixmap(dmxScreen->beDisplay, msk); - XFreeGC(dmxScreen->beDisplay, gc); - - dmxSync(dmxScreen, FALSE); -} - -static Bool -_dmxRealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxCursorPrivPtr pCursorPriv; - - DMXDBG2("_dmxRealizeCursor(%d,%p)\n", pScreen->myNum, pCursor); - - DMX_SET_CURSOR_PRIV(pCursor, pScreen, malloc(sizeof(*pCursorPriv))); - if (!DMX_GET_CURSOR_PRIV(pCursor, pScreen)) - return FALSE; - - pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); - pCursorPriv->cursor = (Cursor) 0; - - if (!dmxScreen->beDisplay) - return TRUE; - - dmxBECreateCursor(pScreen, pCursor); - return TRUE; -} - -/** Free \a pCursor on the back-end associated with \a pScreen. */ -Bool -dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); - - if (pCursorPriv) { - XFreeCursor(dmxScreen->beDisplay, pCursorPriv->cursor); - pCursorPriv->cursor = (Cursor) 0; - return TRUE; - } - - return FALSE; -} - -static Bool -_dmxUnrealizeCursor(ScreenPtr pScreen, CursorPtr pCursor) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - DMXDBG2("_dmxUnrealizeCursor(%d,%p)\n", pScreen->myNum, pCursor); - - if (dmxScreen->beDisplay) { - if (dmxBEFreeCursor(pScreen, pCursor)) - free(DMX_GET_CURSOR_PRIV(pCursor, pScreen)); - } - DMX_SET_CURSOR_PRIV(pCursor, pScreen, NULL); - - return TRUE; -} - -static void -_dmxMoveCursor(ScreenPtr pScreen, int x, int y) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - int newX = x + dmxScreen->rootX; - int newY = y + dmxScreen->rootY; - - if (newX < 0) - newX = 0; - if (newY < 0) - newY = 0; - - DMXDBG5("_dmxMoveCursor(%d,%d,%d) -> %d,%d\n", - pScreen->myNum, x, y, newX, newY); - if (dmxScreen->beDisplay) { - XWarpPointer(dmxScreen->beDisplay, None, dmxScreen->scrnWin, - 0, 0, 0, 0, newX, newY); - dmxSync(dmxScreen, TRUE); - } -} - -static void -_dmxSetCursor(ScreenPtr pScreen, CursorPtr pCursor, int x, int y) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - DMXDBG4("_dmxSetCursor(%d,%p,%d,%d)\n", pScreen->myNum, pCursor, x, y); - - if (pCursor) { - dmxCursorPrivPtr pCursorPriv = DMX_GET_CURSOR_PRIV(pCursor, pScreen); - - if (pCursorPriv && dmxScreen->curCursor != pCursorPriv->cursor) { - if (dmxScreen->beDisplay) - XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin, - pCursorPriv->cursor); - dmxScreen->cursor = pCursor; - dmxScreen->curCursor = pCursorPriv->cursor; - dmxScreen->cursorVisible = 1; - } - _dmxMoveCursor(pScreen, x, y); - } - else { - if (dmxScreen->beDisplay) - XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin, - dmxScreen->noCursor); - dmxScreen->cursor = NULL; - dmxScreen->curCursor = (Cursor) 0; - dmxScreen->cursorVisible = 0; - } - if (dmxScreen->beDisplay) - dmxSync(dmxScreen, TRUE); -} - -static Bool -dmxRealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; - DMXScreenInfo *pt; - - if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) - return _dmxRealizeCursor(pScreen, pCursor); - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->cursorNotShared) - continue; - _dmxRealizeCursor(screenInfo.screens[pt->index], pCursor); - if (pt == start) - break; - } - return TRUE; -} - -static Bool -dmxUnrealizeCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor) -{ - DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; - DMXScreenInfo *pt; - - if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) - return _dmxUnrealizeCursor(pScreen, pCursor); - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->cursorNotShared) - continue; - _dmxUnrealizeCursor(screenInfo.screens[pt->index], pCursor); - if (pt == start) - break; - } - return TRUE; -} - -static CursorPtr -dmxFindCursor(DMXScreenInfo * start) -{ - DMXScreenInfo *pt; - - if (!start || !start->over) - return GetSpriteCursor(inputInfo.pointer); - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->cursor) - return pt->cursor; - if (pt == start) - break; - } - return GetSpriteCursor(inputInfo.pointer); -} - -/** Move the cursor to coordinates (\a x, \a y)on \a pScreen. This - * function is usually called via #dmxPointerSpriteFuncs, except during - * reconfiguration when the cursor is repositioned to force an update on - * newley overlapping screens and on screens that no longer overlap. - * - * The coords (x,y) are in global coord space. We'll loop over the - * back-end screens and see if they contain the global coord. If so, call - * _dmxMoveCursor() (XWarpPointer) to position the pointer on that screen. - */ -void -dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y) -{ - DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; - DMXScreenInfo *pt; - - DMXDBG3("dmxMoveCursor(%d,%d,%d)\n", pScreen->myNum, x, y); - - if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { - _dmxMoveCursor(pScreen, x, y); - return; - } - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->cursorNotShared) - continue; - if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { - if ( /* pt != start && */ !pt->cursorVisible) { - if (!pt->cursor) { - /* This only happens during - * reconfiguration when a new overlap - * occurs. */ - CursorPtr pCursor; - - if ((pCursor = dmxFindCursor(start))) - _dmxRealizeCursor(screenInfo.screens[pt->index], - pt->cursor = pCursor); - - } - _dmxSetCursor(screenInfo.screens[pt->index], - pt->cursor, - x + start->rootXOrigin - pt->rootXOrigin, - y + start->rootYOrigin - pt->rootYOrigin); - } - _dmxMoveCursor(screenInfo.screens[pt->index], - x + start->rootXOrigin - pt->rootXOrigin, - y + start->rootYOrigin - pt->rootYOrigin); - } - else if ( /* pt != start && */ pt->cursorVisible) { - _dmxSetCursor(screenInfo.screens[pt->index], - NULL, - x + start->rootXOrigin - pt->rootXOrigin, - y + start->rootYOrigin - pt->rootYOrigin); - } - if (pt == start) - break; - } -} - -static void -dmxSetCursor(DeviceIntPtr pDev, ScreenPtr pScreen, CursorPtr pCursor, int x, - int y) -{ - DMXScreenInfo *start = &dmxScreens[pScreen->myNum]; - DMXScreenInfo *pt; - int GX, GY, gx, gy; - - DMXDBG5("dmxSetCursor(%d %p, %p,%d,%d)\n", - pScreen->myNum, start, pCursor, x, y); - - /* We do this check here because of two cases: - * - * 1) if a client calls XWarpPointer() - * and Xinerama is not running, we can - * have mi's notion of the pointer - * position out of phase with DMX's - * notion. - * - * 2) if a down button is held while the - * cursor moves outside the root window, - * mi's notion of the pointer position - * is out of phase with DMX's notion and - * the cursor can remain visible when it - * shouldn't be. */ - - dmxGetGlobalPosition(&GX, &GY); - gx = start->rootXOrigin + x; - gy = start->rootYOrigin + y; - if (x && y && (GX != gx || GY != gy)) - dmxCoreMotion(NULL, gx, gy, 0, DMX_NO_BLOCK); - - if (!start->over || !dmxCursorDoMultiCursors || start->cursorNotShared) { - _dmxSetCursor(pScreen, pCursor, x, y); - return; - } - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->cursorNotShared) - continue; - if (dmxOnScreen(x + start->rootXOrigin, y + start->rootYOrigin, pt)) { - _dmxSetCursor(screenInfo.screens[pt->index], pCursor, - x + start->rootXOrigin - pt->rootXOrigin, - y + start->rootYOrigin - pt->rootYOrigin); - } - else { - _dmxSetCursor(screenInfo.screens[pt->index], NULL, - x + start->rootXOrigin - pt->rootXOrigin, - y + start->rootYOrigin - pt->rootYOrigin); - } - if (pt == start) - break; - } -} - -/** This routine is used by the backend input routines to hide the - * cursor on a screen that is being used for relative input. \see - * dmxbackend.c */ -void -dmxHideCursor(DMXScreenInfo * dmxScreen) -{ - int x, y; - ScreenPtr pScreen = screenInfo.screens[dmxScreen->index]; - - dmxGetGlobalPosition(&x, &y); - _dmxSetCursor(pScreen, NULL, x, y); -} - -/** This routine is called during reconfiguration to make sure the - * cursor is visible. */ -void -dmxCheckCursor(void) -{ - int i; - int x, y; - ScreenPtr pScreen; - DMXScreenInfo *firstScreen; - - dmxGetGlobalPosition(&x, &y); - firstScreen = dmxFindFirstScreen(x, y); - - DMXDBG2("dmxCheckCursor %d %d\n", x, y); - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - pScreen = screenInfo.screens[dmxScreen->index]; - - if (!dmxOnScreen(x, y, dmxScreen)) { - if (firstScreen && - i == miPointerGetScreen(inputInfo.pointer)->myNum) - miPointerSetScreen(inputInfo.pointer, firstScreen->index, x, - y); - _dmxSetCursor(pScreen, NULL, x - dmxScreen->rootXOrigin, - y - dmxScreen->rootYOrigin); - } - else { - if (!dmxScreen->cursor) { - CursorPtr pCursor; - - if ((pCursor = dmxFindCursor(dmxScreen))) { - _dmxRealizeCursor(pScreen, dmxScreen->cursor = pCursor); - } - } - _dmxSetCursor(pScreen, dmxScreen->cursor, - x - dmxScreen->rootXOrigin, - y - dmxScreen->rootYOrigin); - } - } - DMXDBG2(" leave dmxCheckCursor %d %d\n", x, y); -} - -static Bool -dmxDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScr) -{ - return TRUE; -} - -static void -dmxDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScr) -{ -} - -miPointerSpriteFuncRec dmxPointerSpriteFuncs = { - dmxRealizeCursor, - dmxUnrealizeCursor, - dmxSetCursor, - dmxMoveCursor, - dmxDeviceCursorInitialize, - dmxDeviceCursorCleanup -}; diff --git a/hw/dmx/dmxcursor.h b/hw/dmx/dmxcursor.h deleted file mode 100644 index 2b55b4e86..000000000 --- a/hw/dmx/dmxcursor.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for cursor support. \see dmxcursor.c. */ - -#ifndef DMXCURSOR_H -#define DMXCURSOR_H - -#include "mipointer.h" - -/** Cursor private area. */ -typedef struct _dmxCursorPriv { - Cursor cursor; -} dmxCursorPrivRec, *dmxCursorPrivPtr; - -/** Cursor functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */ -extern miPointerScreenFuncRec dmxPointerCursorFuncs; - -/** Sprite functions for mi layer. \see dmxcursor.c \see dmxscrinit.c */ -extern miPointerSpriteFuncRec dmxPointerSpriteFuncs; - -extern void dmxReInitOrigins(void); -extern void dmxInitOrigins(void); -extern void dmxInitOverlap(void); -extern void dmxCursorNoMulti(void); -extern void dmxMoveCursor(DeviceIntPtr pDev, ScreenPtr pScreen, int x, int y); -extern void dmxCheckCursor(void); -extern int dmxOnScreen(int x, int y, DMXScreenInfo * dmxScreen); -extern void dmxHideCursor(DMXScreenInfo * dmxScreen); - -extern void dmxBECreateCursor(ScreenPtr pScreen, CursorPtr pCursor); -extern Bool dmxBEFreeCursor(ScreenPtr pScreen, CursorPtr pCursor); - -#define DMX_GET_CURSOR_PRIV(_pCursor, _pScreen) ((dmxCursorPrivPtr) \ - dixLookupScreenPrivate(&(_pCursor)->devPrivates, CursorScreenKey, _pScreen)) - -#define DMX_SET_CURSOR_PRIV(_pCursor, _pScreen, v) \ - dixSetScreenPrivate(&(_pCursor)->devPrivates, CursorScreenKey, _pScreen, v) - -#endif /* DMXCURSOR_H */ diff --git a/hw/dmx/dmxdpms.c b/hw/dmx/dmxdpms.c deleted file mode 100644 index 15a2cbd8d..000000000 --- a/hw/dmx/dmxdpms.c +++ /dev/null @@ -1,201 +0,0 @@ -/* - * Copyright 2003-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. - */ - -/* - * Author: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provides DPMS support and unifies all DPMS and other screen-saver - * support in one file. If -dpms is given on the command line, or the - * Xdmx server is not compiled with DPMS support, then the DPMS extension - * does not work for clients, but DPMS on the backends is still disables - * (and restored at Xdmx server shutdown time). - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxdpms.h" -#include "dmxlog.h" -#include "dmxsync.h" -#ifdef DPMSExtension -#include "dpmsproc.h" -#endif -#include "windowstr.h" /* For screenIsSaved */ -#include <X11/extensions/dpms.h> - -static int -_dmxDPMSInit(DMXScreenInfo * dmxScreen) -{ - int event_base, error_base; - int major, minor; - CARD16 level, standby, suspend, off; - BOOL state; - const char *monitor; - -#ifdef DPMSExtension - if (DPMSDisabledSwitch) - return FALSE; -#endif - - dmxScreen->dpmsCapable = 0; - - if (!dmxScreen->beDisplay) { - dmxLogOutput(dmxScreen, - "Cannot determine if DPMS supported (detached screen)\n"); - return FALSE; - } - - if (!DPMSQueryExtension(dmxScreen->beDisplay, &event_base, &error_base)) { - dmxLogOutput(dmxScreen, "DPMS not supported\n"); - return FALSE; - } - if (!DPMSGetVersion(dmxScreen->beDisplay, &major, &minor)) { - dmxLogOutput(dmxScreen, "DPMS not supported\n"); - return FALSE; - } - if (!DPMSCapable(dmxScreen->beDisplay)) { - dmxLogOutput(dmxScreen, "DPMS %d.%d (not DPMS capable)\n", - major, minor); - return FALSE; - } - - DPMSInfo(dmxScreen->beDisplay, &level, &state); - DPMSGetTimeouts(dmxScreen->beDisplay, &standby, &suspend, &off); - DPMSSetTimeouts(dmxScreen->beDisplay, 0, 0, 0); - DPMSEnable(dmxScreen->beDisplay); - DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn); - dmxScreen->dpmsCapable = 1; - dmxScreen->dpmsEnabled = ! !state; - dmxScreen->dpmsStandby = standby; - dmxScreen->dpmsSuspend = suspend; - dmxScreen->dpmsOff = off; - - switch (level) { - case DPMSModeOn: - monitor = "on"; - break; - case DPMSModeStandby: - monitor = "standby"; - break; - case DPMSModeSuspend: - monitor = "suspend"; - break; - case DPMSModeOff: - monitor = "off"; - break; - default: - monitor = "unknown"; - break; - } - - dmxLogOutput(dmxScreen, - "DPMS %d.%d (%s, %s, %d %d %d)\n", - major, minor, monitor, state ? "enabled" : "disabled", - standby, suspend, off); - return TRUE; -} - -/** Initialize DPMS support. We save the current settings and turn off - * DPMS. The settings are restored in #dmxDPMSTerm. */ -int -dmxDPMSInit(DMXScreenInfo * dmxScreen) -{ - int interval, preferBlanking, allowExposures; - - /* Turn off DPMS */ - if (!_dmxDPMSInit(dmxScreen)) - return FALSE; - - if (!dmxScreen->beDisplay) - return FALSE; - - /* Turn off screen saver */ - XGetScreenSaver(dmxScreen->beDisplay, &dmxScreen->savedTimeout, &interval, - &preferBlanking, &allowExposures); - XSetScreenSaver(dmxScreen->beDisplay, 0, interval, - preferBlanking, allowExposures); - XResetScreenSaver(dmxScreen->beDisplay); - dmxSync(dmxScreen, FALSE); - return TRUE; -} - -/** Terminate DPMS support on \a dmxScreen. We restore the settings - * saved in #dmxDPMSInit. */ -void -dmxDPMSTerm(DMXScreenInfo * dmxScreen) -{ - int timeout, interval, preferBlanking, allowExposures; - - if (!dmxScreen->beDisplay) - return; - - XGetScreenSaver(dmxScreen->beDisplay, &timeout, &interval, - &preferBlanking, &allowExposures); - XSetScreenSaver(dmxScreen->beDisplay, dmxScreen->savedTimeout, interval, - preferBlanking, allowExposures); - if (dmxScreen->dpmsCapable) { - /* Restore saved state */ - DPMSForceLevel(dmxScreen->beDisplay, DPMSModeOn); - DPMSSetTimeouts(dmxScreen->beDisplay, dmxScreen->dpmsStandby, - dmxScreen->dpmsSuspend, dmxScreen->dpmsOff); - if (dmxScreen->dpmsEnabled) - DPMSEnable(dmxScreen->beDisplay); - else - DPMSDisable(dmxScreen->beDisplay); - } - dmxSync(dmxScreen, FALSE); -} - -/** Called when activity is detected so that DPMS power-saving mode can - * be deactivated. */ -void -dmxDPMSWakeup(void) -{ - if (screenIsSaved == SCREEN_SAVER_ON) - dixSaveScreens(serverClient, SCREEN_SAVER_OFF, ScreenSaverReset); -#ifdef DPMSExtension - if (DPMSPowerLevel) - DPMSSet(serverClient, 0); -#endif -} - -#ifdef DPMSExtension -void -dmxDPMSBackend(DMXScreenInfo *dmxScreen, int level) -{ - if (dmxScreen->beDisplay) { - DPMSForceLevel(dmxScreen->beDisplay, level); - dmxSync(dmxScreen, FALSE); - } -} -#endif diff --git a/hw/dmx/dmxdpms.h b/hw/dmx/dmxdpms.h deleted file mode 100644 index 8c4fe9d4f..000000000 --- a/hw/dmx/dmxdpms.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2003 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. - */ - -/* - * Author: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for DPMS extension support. \see dmxdpms.c */ - -#ifndef _DMXDPMS_H_ -#define _DMXDPMS_H_ -extern int dmxDPMSInit(DMXScreenInfo * dmxScreen); -extern void dmxDPMSTerm(DMXScreenInfo * dmxScreen); -extern void dmxDPMSWakeup(void); /* Call when input is processed */ -extern void dmxDPMSBackend(DMXScreenInfo *dmxScreen, int level); -#endif diff --git a/hw/dmx/dmxextension.c b/hw/dmx/dmxextension.c deleted file mode 100644 index 5b860481c..000000000 --- a/hw/dmx/dmxextension.c +++ /dev/null @@ -1,1702 +0,0 @@ -/* - * Copyright 2003-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. - */ - -/* - * Author: - * Rickard E. (Rik) Faith <faith@redhat.com> - * Kevin E. Martin <kem@redhat.com> - * - */ - -/** \file - * This file provides the only interface to the X server extension support - * in programs/Xserver/Xext. Those programs should only include dmxext.h - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include <stdlib.h> - -#include "dmx.h" -#include "dmxinit.h" -#include "dmxextension.h" -#include "dmxwindow.h" -#include "dmxcb.h" -#include "dmxcursor.h" -#include "dmxpixmap.h" -#include "dmxgc.h" -#include "dmxfont.h" -#include "dmxcmap.h" -#include "dmxpict.h" -#include "dmxinput.h" -#include "dmxsync.h" -#include "dmxscrinit.h" -#include "input/dmxinputinit.h" - -#include "windowstr.h" -#include "inputstr.h" /* For DeviceIntRec */ -#include <X11/extensions/dmxproto.h> /* For DMX_BAD_* */ -#include "cursorstr.h" - -/* The default font is declared in dix/globals.c, but is not included in - * _any_ header files. */ -extern FontPtr defaultFont; - -/** This routine provides information to the DMX protocol extension - * about a particular screen. */ -Bool -dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr) -{ - DMXScreenInfo *dmxScreen; - - if (physical < 0 || physical >= dmxNumScreens) - return FALSE; - - dmxScreen = &dmxScreens[physical]; - attr->displayName = dmxScreen->name; -#ifdef PANORAMIX - attr->logicalScreen = noPanoramiXExtension ? dmxScreen->index : 0; -#else - attr->logicalScreen = dmxScreen->index; -#endif - - attr->screenWindowWidth = dmxScreen->scrnWidth; - attr->screenWindowHeight = dmxScreen->scrnHeight; - attr->screenWindowXoffset = dmxScreen->scrnX; - attr->screenWindowYoffset = dmxScreen->scrnY; - - attr->rootWindowWidth = dmxScreen->rootWidth; - attr->rootWindowHeight = dmxScreen->rootHeight; - attr->rootWindowXoffset = dmxScreen->rootX; - attr->rootWindowYoffset = dmxScreen->rootY; - - attr->rootWindowXorigin = dmxScreen->rootXOrigin; - attr->rootWindowYorigin = dmxScreen->rootYOrigin; - - return TRUE; -} - -/** This routine provides information to the DMX protocol extension - * about a particular window. */ -Bool -dmxGetWindowAttributes(WindowPtr pWindow, DMXWindowAttributesPtr attr) -{ - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - attr->screen = pWindow->drawable.pScreen->myNum; - attr->window = pWinPriv->window; - - attr->pos.x = pWindow->drawable.x; - attr->pos.y = pWindow->drawable.y; - attr->pos.width = pWindow->drawable.width; - attr->pos.height = pWindow->drawable.height; - - if (!pWinPriv->window || pWinPriv->offscreen) { - attr->vis.x = 0; - attr->vis.y = 0; - attr->vis.height = 0; - attr->vis.width = 0; - return pWinPriv->window ? TRUE : FALSE; - } - - /* Compute display-relative coordinates */ - attr->vis.x = pWindow->drawable.x; - attr->vis.y = pWindow->drawable.y; - attr->vis.width = pWindow->drawable.width; - attr->vis.height = pWindow->drawable.height; - - if (attr->pos.x < 0) { - attr->vis.x -= attr->pos.x; - attr->vis.width = attr->pos.x + attr->pos.width - attr->vis.x; - } - if (attr->pos.x + attr->pos.width > pWindow->drawable.pScreen->width) { - if (attr->pos.x < 0) - attr->vis.width = pWindow->drawable.pScreen->width; - else - attr->vis.width = pWindow->drawable.pScreen->width - attr->pos.x; - } - if (attr->pos.y < 0) { - attr->vis.y -= attr->pos.y; - attr->vis.height = attr->pos.y + attr->pos.height - attr->vis.y; - } - if (attr->pos.y + attr->pos.height > pWindow->drawable.pScreen->height) { - if (attr->pos.y < 0) - attr->vis.height = pWindow->drawable.pScreen->height; - else - attr->vis.height = pWindow->drawable.pScreen->height - attr->pos.y; - } - - /* Convert to window-relative coordinates */ - attr->vis.x -= attr->pos.x; - attr->vis.y -= attr->pos.y; - - return TRUE; -} - -void -dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr) -{ - attr->width = dmxGlobalWidth; - attr->height = dmxGlobalHeight; - attr->shiftX = 0; /* NOTE: The upper left hand corner of */ - attr->shiftY = 0; /* the desktop is always <0,0>. */ -} - -/** Return the total number of devices, not just #dmxNumInputs. The - * number returned should be the same as that returned by - * XListInputDevices. */ -int -dmxGetInputCount(void) -{ - int i, total; - - for (total = i = 0; i < dmxNumInputs; i++) - total += dmxInputs[i].numDevs; - return total; -} - -/** Return information about the device with id = \a deviceId. This - * information is primarily for the #ProcDMXGetInputAttributes() - * function, which does not have access to the appropriate data - * structure. */ -int -dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr) -{ - int i, j; - DMXInputInfo *dmxInput; - - if (deviceId < 0) - return -1; - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - - if (deviceId != dmxLocal->pDevice->id) - continue; - attr->isCore = ! !dmxLocal->isCore; - attr->sendsCore = ! !dmxLocal->sendsCore; - attr->detached = ! !dmxInput->detached; - attr->physicalScreen = -1; - attr->physicalId = -1; - attr->name = NULL; - switch (dmxLocal->extType) { - case DMX_LOCAL_TYPE_LOCAL: - attr->inputType = 0; - break; - case DMX_LOCAL_TYPE_CONSOLE: - attr->inputType = 1; - attr->name = dmxInput->name; - attr->physicalId = dmxLocal->deviceId; - break; - case DMX_LOCAL_TYPE_BACKEND: - case DMX_LOCAL_TYPE_COMMON: - attr->inputType = 2; - attr->physicalScreen = dmxInput->scrnIdx; - attr->name = dmxInput->name; - attr->physicalId = dmxLocal->deviceId; - break; - } - return 0; /* Success */ - } - } - return -1; /* Failure */ -} - -/** Reinitialized the cursor boundaries. */ -static void -dmxAdjustCursorBoundaries(void) -{ - int i; - - dmxReInitOrigins(); - dmxInitOverlap(); - dmxComputeWidthHeight(DMX_NO_RECOMPUTE_BOUNDING_BOX); - dmxConnectionBlockCallback(); - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (!dmxInput->detached) - dmxInputReInit(dmxInput); - } - - dmxCheckCursor(); - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (!dmxInput->detached) - dmxInputLateReInit(dmxInput); - } -} - -/** Add an input with the specified attributes. If the input is added, - * the physical id is returned in \a deviceId. */ -int -dmxAddInput(DMXInputAttributesPtr attr, int *id) -{ - int retcode = BadValue; - - if (attr->inputType == 1) /* console */ - retcode = dmxInputAttachConsole(attr->name, attr->sendsCore, id); - else if (attr->inputType == 2) /* backend */ - retcode = dmxInputAttachBackend(attr->physicalScreen, - attr->sendsCore, id); - - if (retcode == Success) { - /* Adjust the cursor boundaries */ - dmxAdjustCursorBoundaries(); - - /* Force completion of the changes */ - dmxSync(NULL, TRUE); - } - - return retcode; -} - -/** Remove the input with physical id \a id. */ -int -dmxRemoveInput(int id) -{ - return dmxInputDetachId(id); -} - -/** Return the value of #dmxNumScreens -- the total number of backend - * screens in use (these are logical screens and may be larger than the - * number of backend displays). */ -unsigned long -dmxGetNumScreens(void) -{ - return dmxNumScreens; -} - -/** Make sure that #dmxCreateAndRealizeWindow has been called for \a - * pWindow. */ -void -dmxForceWindowCreation(WindowPtr pWindow) -{ - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - if (!pWinPriv->window) - dmxCreateAndRealizeWindow(pWindow, TRUE); -} - -/** Flush pending syncs for all screens. */ -void -dmxFlushPendingSyncs(void) -{ - dmxSync(NULL, TRUE); -} - -/** Update DMX's screen resources to match those of the newly moved - * and/or resized "root" window. */ -void -dmxUpdateScreenResources(ScreenPtr pScreen, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - WindowPtr pRoot = pScreen->root; - WindowPtr pChild; - Bool anyMarked = FALSE; - - /* Handle special case where width and/or height are zero */ - if (w == 0 || h == 0) { - w = 1; - h = 1; - } - - /* Change screen size */ - pScreen->width = w; - pScreen->height = h; - - /* Reset the root window's drawable's size */ - pRoot->drawable.width = w; - pRoot->drawable.height = h; - - /* Set the root window's new winSize and borderSize */ - pRoot->winSize.extents.x1 = 0; - pRoot->winSize.extents.y1 = 0; - pRoot->winSize.extents.x2 = w; - pRoot->winSize.extents.y2 = h; - - pRoot->borderSize.extents.x1 = 0; - pRoot->borderSize.extents.y1 = 0; - pRoot->borderSize.extents.x2 = w; - pRoot->borderSize.extents.y2 = h; - - /* Recompute this screen's mmWidth & mmHeight */ - pScreen->mmWidth = - (w * 254 + dmxScreen->beXDPI * 5) / (dmxScreen->beXDPI * 10); - pScreen->mmHeight = - (h * 254 + dmxScreen->beYDPI * 5) / (dmxScreen->beYDPI * 10); - - /* Recompute this screen's window's clip rects as follows: */ - /* 1. Mark all of root's children's windows */ - for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) - anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, - (WindowPtr *) NULL); - - /* 2. Set the root window's borderClip */ - pRoot->borderClip.extents.x1 = 0; - pRoot->borderClip.extents.y1 = 0; - pRoot->borderClip.extents.x2 = w; - pRoot->borderClip.extents.y2 = h; - - /* 3. Set the root window's clipList */ - if (anyMarked) { - /* If any windows have been marked, set the root window's - * clipList to be broken since it will be recalculated in - * ValidateTree() - */ - RegionBreak(&pRoot->clipList); - } - else { - /* Otherwise, we just set it directly since there are no - * windows visible on this screen - */ - pRoot->clipList.extents.x1 = 0; - pRoot->clipList.extents.y1 = 0; - pRoot->clipList.extents.x2 = w; - pRoot->clipList.extents.y2 = h; - } - - /* 4. Revalidate all clip rects and generate expose events */ - if (anyMarked) { - pScreen->ValidateTree(pRoot, NULL, VTBroken); - pScreen->HandleExposures(pRoot); - if (pScreen->PostValidateTree) - pScreen->PostValidateTree(pRoot, NULL, VTBroken); - } -} - -#ifdef PANORAMIX -#include "panoramiXsrv.h" - -/** Change the "screen" window attributes by resizing the actual window - * on the back-end display (if necessary). */ -static void -dmxConfigureScreenWindow(int idx, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - ScreenPtr pScreen = screenInfo.screens[idx]; - - /* Resize "screen" window */ - if (dmxScreen->scrnX != x || - dmxScreen->scrnY != y || - dmxScreen->scrnWidth != w || dmxScreen->scrnHeight != h) { - dmxResizeScreenWindow(pScreen, x, y, w, h); - } - - /* Change "screen" window values */ - dmxScreen->scrnX = x; - dmxScreen->scrnY = y; - dmxScreen->scrnWidth = w; - dmxScreen->scrnHeight = h; -} - -/** Change the "root" window position and size by resizing the actual - * window on the back-end display (if necessary) and updating all of - * DMX's resources by calling #dmxUpdateScreenResources. */ -static void -dmxConfigureRootWindow(int idx, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - WindowPtr pRoot = screenInfo.screens[idx]->root; - - /* NOTE: Either this function or the ones that it calls must handle - * the case where w == 0 || h == 0. Currently, the functions that - * this one calls handle that case. */ - - /* 1. Resize "root" window */ - if (dmxScreen->rootX != x || - dmxScreen->rootY != y || - dmxScreen->rootWidth != w || dmxScreen->rootHeight != h) { - dmxResizeRootWindow(pRoot, x, y, w, h); - } - - /* 2. Update all of the screen's resources associated with this root - * window */ - if (dmxScreen->rootWidth != w || dmxScreen->rootHeight != h) { - dmxUpdateScreenResources(screenInfo.screens[idx], x, y, w, h); - } - - /* Change "root" window values */ - dmxScreen->rootX = x; - dmxScreen->rootY = y; - dmxScreen->rootWidth = w; - dmxScreen->rootHeight = h; -} - -/** Change the "root" window's origin by updating DMX's internal data - * structures (dix and Xinerama) to use the new origin and adjust the - * positions of windows that overlap this "root" window. */ -static void -dmxSetRootWindowOrigin(int idx, int x, int y) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - ScreenPtr pScreen = screenInfo.screens[idx]; - WindowPtr pRoot = pScreen->root; - WindowPtr pChild; - int xoff; - int yoff; - - /* Change "root" window's origin */ - dmxScreen->rootXOrigin = x; - dmxScreen->rootYOrigin = y; - - /* Compute offsets here in case <x,y> has been changed above */ - xoff = x - pScreen->x; - yoff = y - pScreen->y; - - /* Adjust the root window's position */ - pScreen->x = dmxScreen->rootXOrigin; - pScreen->y = dmxScreen->rootYOrigin; - - /* Recalculate the Xinerama regions and data structs */ - XineramaReinitData(); - - /* Adjust each of the root window's children */ - if (!idx) - ReinitializeRootWindow(screenInfo.screens[0]->root, xoff, yoff); - pChild = pRoot->firstChild; - while (pChild) { - /* Adjust child window's position */ - pScreen->MoveWindow(pChild, - pChild->origin.x - wBorderWidth(pChild) - xoff, - pChild->origin.y - wBorderWidth(pChild) - yoff, - pChild->nextSib, VTMove); - - /* Note that the call to MoveWindow will eventually call - * dmxPositionWindow which will automatically create a - * window if it is now exposed on screen (for lazy window - * creation optimization) and it will properly set the - * offscreen flag. - */ - - pChild = pChild->nextSib; - } -} - -/** Configure the attributes of each "screen" and "root" window. */ -int -dmxConfigureScreenWindows(int nscreens, - CARD32 *screens, - DMXScreenAttributesPtr attribs, int *errorScreen) -{ - int i; - - for (i = 0; i < nscreens; i++) { - DMXScreenAttributesPtr attr = &attribs[i]; - int idx = screens[i]; - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - - if (errorScreen) - *errorScreen = i; - - if (!dmxScreen->beDisplay) - return DMX_BAD_VALUE; - - /* Check for illegal values */ - if (idx < 0 || idx >= dmxNumScreens) - return BadValue; - - /* The "screen" and "root" windows must have valid sizes */ - if (attr->screenWindowWidth <= 0 || attr->screenWindowHeight <= 0 || - attr->rootWindowWidth < 0 || attr->rootWindowHeight < 0) - return DMX_BAD_VALUE; - - /* The "screen" window must fit entirely within the BE display */ - if (attr->screenWindowXoffset < 0 || - attr->screenWindowYoffset < 0 || - attr->screenWindowXoffset - + attr->screenWindowWidth > (unsigned) dmxScreen->beWidth || - attr->screenWindowYoffset - + attr->screenWindowHeight > (unsigned) dmxScreen->beHeight) - return DMX_BAD_VALUE; - - /* The "root" window must fit entirely within the "screen" window */ - if (attr->rootWindowXoffset < 0 || - attr->rootWindowYoffset < 0 || - attr->rootWindowXoffset - + attr->rootWindowWidth > attr->screenWindowWidth || - attr->rootWindowYoffset - + attr->rootWindowHeight > attr->screenWindowHeight) - return DMX_BAD_VALUE; - - /* The "root" window must not expose unaddressable coordinates */ - if (attr->rootWindowXorigin < 0 || - attr->rootWindowYorigin < 0 || - attr->rootWindowXorigin + attr->rootWindowWidth > 32767 || - attr->rootWindowYorigin + attr->rootWindowHeight > 32767) - return DMX_BAD_VALUE; - - /* The "root" window must fit within the global bounding box */ - if (attr->rootWindowXorigin - + attr->rootWindowWidth > (unsigned) dmxGlobalWidth || - attr->rootWindowYorigin - + attr->rootWindowHeight > (unsigned) dmxGlobalHeight) - return DMX_BAD_VALUE; - - /* FIXME: Handle the rest of the illegal value checking */ - } - - /* No illegal values found */ - if (errorScreen) - *errorScreen = 0; - - for (i = 0; i < nscreens; i++) { - DMXScreenAttributesPtr attr = &attribs[i]; - int idx = screens[i]; - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - - dmxLog(dmxInfo, "Changing screen #%d attributes " - "from %dx%d+%d+%d %dx%d+%d+%d +%d+%d " - "to %dx%d+%d+%d %dx%d+%d+%d +%d+%d\n", - idx, - dmxScreen->scrnWidth, dmxScreen->scrnHeight, - dmxScreen->scrnX, dmxScreen->scrnY, - dmxScreen->rootWidth, dmxScreen->rootHeight, - dmxScreen->rootX, dmxScreen->rootY, - dmxScreen->rootXOrigin, dmxScreen->rootYOrigin, - attr->screenWindowWidth, attr->screenWindowHeight, - attr->screenWindowXoffset, attr->screenWindowYoffset, - attr->rootWindowWidth, attr->rootWindowHeight, - attr->rootWindowXoffset, attr->rootWindowYoffset, - attr->rootWindowXorigin, attr->rootWindowYorigin); - - /* Configure "screen" window */ - dmxConfigureScreenWindow(idx, - attr->screenWindowXoffset, - attr->screenWindowYoffset, - attr->screenWindowWidth, - attr->screenWindowHeight); - - /* Configure "root" window */ - dmxConfigureRootWindow(idx, - attr->rootWindowXoffset, - attr->rootWindowYoffset, - attr->rootWindowWidth, attr->rootWindowHeight); - - /* Set "root" window's origin */ - dmxSetRootWindowOrigin(idx, - attr->rootWindowXorigin, - attr->rootWindowYorigin); - } - - /* Adjust the cursor boundaries */ - dmxAdjustCursorBoundaries(); - - /* Force completion of the changes */ - dmxSync(NULL, TRUE); - - return Success; -} - -/** Configure the attributes of the global desktop. */ -int -dmxConfigureDesktop(DMXDesktopAttributesPtr attribs) -{ - if (attribs->width <= 0 || attribs->width >= 32767 || - attribs->height <= 0 || attribs->height >= 32767) - return DMX_BAD_VALUE; - - /* If the desktop is shrinking, adjust the "root" windows on each - * "screen" window to only show the visible desktop. Also, handle - * the special case where the desktop shrinks such that the it no - * longer overlaps an portion of a "screen" window. */ - if (attribs->width < dmxGlobalWidth || attribs->height < dmxGlobalHeight) { - int i; - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->rootXOrigin - + dmxScreen->rootWidth > attribs->width || - dmxScreen->rootYOrigin - + dmxScreen->rootHeight > attribs->height) { - int w, h; - - if ((w = attribs->width - dmxScreen->rootXOrigin) < 0) - w = 0; - if ((h = attribs->height - dmxScreen->rootYOrigin) < 0) - h = 0; - if (w > dmxScreen->scrnWidth) - w = dmxScreen->scrnWidth; - if (h > dmxScreen->scrnHeight) - h = dmxScreen->scrnHeight; - if (w > dmxScreen->rootWidth) - w = dmxScreen->rootWidth; - if (h > dmxScreen->rootHeight) - h = dmxScreen->rootHeight; - dmxConfigureRootWindow(i, - dmxScreen->rootX, - dmxScreen->rootY, w, h); - } - } - } - - /* Set the global width/height */ - dmxSetWidthHeight(attribs->width, attribs->height); - - /* Handle shift[XY] changes */ - if (attribs->shiftX || attribs->shiftY) { - int i; - - for (i = 0; i < dmxNumScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - WindowPtr pChild = pScreen->root->firstChild; - - while (pChild) { - /* Adjust child window's position */ - pScreen->MoveWindow(pChild, - pChild->origin.x - wBorderWidth(pChild) - - attribs->shiftX, - pChild->origin.y - wBorderWidth(pChild) - - attribs->shiftY, pChild->nextSib, VTMove); - - /* Note that the call to MoveWindow will eventually call - * dmxPositionWindow which will automatically create a - * window if it is now exposed on screen (for lazy - * window creation optimization) and it will properly - * set the offscreen flag. - */ - - pChild = pChild->nextSib; - } - } - } - - /* Update connection block, Xinerama, etc. -- these appears to - * already be handled in dmxConnectionBlockCallback(), which is - * called from dmxAdjustCursorBoundaries() [below]. */ - - /* Adjust the cursor boundaries */ - dmxAdjustCursorBoundaries(); - - /* Force completion of the changes */ - dmxSync(NULL, TRUE); - - return Success; -} -#endif - -/** Create the scratch GCs per depth. */ -static void -dmxBECreateScratchGCs(int scrnNum) -{ - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - GCPtr *ppGC = pScreen->GCperDepth; - int i; - - for (i = 0; i <= pScreen->numDepths; i++) - dmxBECreateGC(pScreen, ppGC[i]); -} - -#ifdef PANORAMIX -static Bool FoundPixImage; - -/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs - * to have its image restored. When it is found, see if there is - * another screen with the same image. If so, copy the pixmap image - * from the existing screen to the newly created pixmap. */ -static void -dmxBERestorePixmapImage(void *value, XID id, RESTYPE type, void *p) -{ - if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { - PixmapPtr pDst = (PixmapPtr) p; - int idx = pDst->drawable.pScreen->myNum; - PanoramiXRes *pXinPix = (PanoramiXRes *) value; - PixmapPtr pPix; - int i; - - dixLookupResourceByType((void **) &pPix, pXinPix->info[idx].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - if (pPix != pDst) - return; /* Not a match.... Next! */ - - FOR_NSCREENS(i) { - PixmapPtr pSrc; - dmxPixPrivPtr pSrcPriv = NULL; - - if (i == idx) - continue; /* Self replication is bad */ - - dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); - if (pSrcPriv->pixmap) { - DMXScreenInfo *dmxSrcScreen = &dmxScreens[i]; - DMXScreenInfo *dmxDstScreen = &dmxScreens[idx]; - dmxPixPrivPtr pDstPriv = DMX_GET_PIXMAP_PRIV(pDst); - XImage *img; - int j; - XlibGC gc = NULL; - - /* This should never happen, but just in case.... */ - if (pSrc->drawable.width != pDst->drawable.width || - pSrc->drawable.height != pDst->drawable.height) - return; - - /* Copy from src pixmap to dst pixmap */ - img = XGetImage(dmxSrcScreen->beDisplay, - pSrcPriv->pixmap, - 0, 0, - pSrc->drawable.width, pSrc->drawable.height, - -1, ZPixmap); - - for (j = 0; j < dmxDstScreen->beNumPixmapFormats; j++) { - if (dmxDstScreen->bePixmapFormats[j].depth == img->depth) { - unsigned long m; - XGCValues v; - - m = GCFunction | GCPlaneMask | GCClipMask; - v.function = GXcopy; - v.plane_mask = AllPlanes; - v.clip_mask = None; - - gc = XCreateGC(dmxDstScreen->beDisplay, - dmxDstScreen->scrnDefDrawables[j], - m, &v); - break; - } - } - - if (gc) { - XPutImage(dmxDstScreen->beDisplay, - pDstPriv->pixmap, - gc, img, 0, 0, 0, 0, - pDst->drawable.width, pDst->drawable.height); - XFreeGC(dmxDstScreen->beDisplay, gc); - FoundPixImage = True; - } - else { - dmxLog(dmxWarning, "Could not create GC\n"); - } - - XDestroyImage(img); - return; - } - } - } -} -#endif - -/** Restore the pixmap image either from another screen or from an image - * that was saved when the screen was previously detached. */ -static void -dmxBERestorePixmap(PixmapPtr pPixmap) -{ -#ifdef PANORAMIX - int i; - - /* If Xinerama is not active, there's nothing we can do (see comment - * in #else below for more info). */ - if (noPanoramiXExtension) { - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - return; - } - - FoundPixImage = False; - for (i = currentMaxClients; --i >= 0;) - if (clients[i]) - FindAllClientResources(clients[i], dmxBERestorePixmapImage, - (void *) pPixmap); - - /* No corresponding pixmap image was found on other screens, so we - * need to copy it from the saved image when the screen was detached - * (if available). */ - if (!FoundPixImage) { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - if (pPixPriv->detachedImage) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - XlibGC gc = NULL; - - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (dmxScreen->bePixmapFormats[i].depth == - pPixPriv->detachedImage->depth) { - unsigned long m; - XGCValues v; - - m = GCFunction | GCPlaneMask | GCClipMask; - v.function = GXcopy; - v.plane_mask = AllPlanes; - v.clip_mask = None; - - gc = XCreateGC(dmxScreen->beDisplay, - dmxScreen->scrnDefDrawables[i], m, &v); - break; - } - } - - if (gc) { - XPutImage(dmxScreen->beDisplay, - pPixPriv->pixmap, - gc, - pPixPriv->detachedImage, - 0, 0, 0, 0, - pPixmap->drawable.width, pPixmap->drawable.height); - XFreeGC(dmxScreen->beDisplay, gc); - } - else { - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - } - - XDestroyImage(pPixPriv->detachedImage); - pPixPriv->detachedImage = NULL; - } - else { - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - } - } -#else - /* If Xinerama is not enabled, then there is no other copy of the - * pixmap image that we can restore. Saving all pixmap data is not - * a feasible option since there is no mechanism for updating pixmap - * data when a screen is detached, which means that the data that - * was previously saved would most likely be out of date. */ - dmxLog(dmxWarning, "Cannot restore pixmap image\n"); - return; -#endif -} - -/** Create resources on the back-end server. This function is called - * from #dmxAttachScreen() via the dix layer's FindAllResources - * function. It walks all resources, compares them to the screen - * number passed in as \a n and calls the appropriate DMX function to - * create the associated resource on the back-end server. */ -static void -dmxBECreateResources(void *value, XID id, RESTYPE type, void *n) -{ - int scrnNum = (uintptr_t) n; - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - - if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { - /* Window resources are created below in dmxBECreateWindowTree */ - } - else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { - PixmapPtr pPix = value; - - if (pPix->drawable.pScreen->myNum == scrnNum) { - dmxBECreatePixmap(pPix); - dmxBERestorePixmap(pPix); - } - } - else if ((type & TypeMask) == (RT_GC & TypeMask)) { - GCPtr pGC = value; - - if (pGC->pScreen->myNum == scrnNum) { - /* Create the GC on the back-end server */ - dmxBECreateGC(pScreen, pGC); - /* Create any pixmaps associated with this GC */ - if (!pGC->tileIsPixel) { - dmxBECreatePixmap(pGC->tile.pixmap); - dmxBERestorePixmap(pGC->tile.pixmap); - } - if (pGC->stipple != pScreen->defaultStipple) { - dmxBECreatePixmap(pGC->stipple); - dmxBERestorePixmap(pGC->stipple); - } - if (pGC->font != defaultFont) { - (void) dmxBELoadFont(pScreen, pGC->font); - } - /* Update the GC on the back-end server */ - dmxChangeGC(pGC, -1L); - } - } - else if ((type & TypeMask) == (RT_FONT & TypeMask)) { - (void) dmxBELoadFont(pScreen, (FontPtr) value); - } - else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { - dmxBECreateCursor(pScreen, (CursorPtr) value); - } - else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { - ColormapPtr pCmap = value; - - if (pCmap->pScreen->myNum == scrnNum) - (void) dmxBECreateColormap((ColormapPtr) value); -#if 0 - /* TODO: Recreate Picture and GlyphSet resources */ - } - else if ((type & TypeMask) == (PictureType & TypeMask)) { - /* Picture resources are created when windows are created */ - } - else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { - dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr) value); -#endif - } - else { - /* Other resource types??? */ - } -} - -/** Create window hierarchy on back-end server. The window tree is - * created in a special order (bottom most subwindow first) so that the - * #dmxCreateNonRootWindow() function does not need to recursively call - * itself to create each window's parents. This is required so that we - * have the opportunity to create each window's border and background - * pixmaps (where appropriate) before the window is created. */ -static void -dmxBECreateWindowTree(int idx) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - WindowPtr pRoot = screenInfo.screens[idx]->root; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); - WindowPtr pWin; - - /* Create the pixmaps associated with the root window */ - if (!pRoot->borderIsPixel) { - dmxBECreatePixmap(pRoot->border.pixmap); - dmxBERestorePixmap(pRoot->border.pixmap); - } - if (pRoot->backgroundState == BackgroundPixmap) { - dmxBECreatePixmap(pRoot->background.pixmap); - dmxBERestorePixmap(pRoot->background.pixmap); - } - - /* Create root window first */ - dmxScreen->rootWin = pWinPriv->window = dmxCreateRootWindow(pRoot); - XMapWindow(dmxScreen->beDisplay, dmxScreen->rootWin); - - pWin = pRoot->lastChild; - while (pWin) { - pWinPriv = DMX_GET_WINDOW_PRIV(pWin); - - /* Create the pixmaps regardless of whether or not the - * window is created or not due to lazy window creation. - */ - if (!pWin->borderIsPixel) { - dmxBECreatePixmap(pWin->border.pixmap); - dmxBERestorePixmap(pWin->border.pixmap); - } - if (pWin->backgroundState == BackgroundPixmap) { - dmxBECreatePixmap(pWin->background.pixmap); - dmxBERestorePixmap(pWin->background.pixmap); - } - - /* Reset the window attributes */ - dmxGetDefaultWindowAttributes(pWin, &pWinPriv->cmap, &pWinPriv->visual); - - /* Create the window */ - if (pWinPriv->mapped && !pWinPriv->offscreen) - dmxCreateAndRealizeWindow(pWin, TRUE); - - /* Next, create the bottom-most child */ - if (pWin->lastChild) { - pWin = pWin->lastChild; - continue; - } - - /* If the window has no children, move on to the next higher window */ - while (!pWin->prevSib && (pWin != pRoot)) - pWin = pWin->parent; - - if (pWin->prevSib) { - pWin = pWin->prevSib; - continue; - } - - /* When we reach the root window, we are finished */ - if (pWin == pRoot) - break; - } -} - -/* Refresh screen by generating exposure events for all windows */ -static void -dmxForceExposures(int idx) -{ - ScreenPtr pScreen = screenInfo.screens[idx]; - WindowPtr pRoot = pScreen->root; - Bool anyMarked = FALSE; - WindowPtr pChild; - - for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) - anyMarked |= pScreen->MarkOverlappedWindows(pChild, pChild, - (WindowPtr *) NULL); - if (anyMarked) { - /* If any windows have been marked, set the root window's - * clipList to be broken since it will be recalculated in - * ValidateTree() - */ - RegionBreak(&pRoot->clipList); - pScreen->ValidateTree(pRoot, NULL, VTBroken); - pScreen->HandleExposures(pRoot); - if (pScreen->PostValidateTree) - pScreen->PostValidateTree(pRoot, NULL, VTBroken); - } -} - -/** Compare the new and old screens to see if they are compatible. */ -static Bool -dmxCompareScreens(DMXScreenInfo * new, DMXScreenInfo * old) -{ - int i; - - if (new->beWidth != old->beWidth) - return FALSE; - if (new->beHeight != old->beHeight) - return FALSE; - if (new->beDepth != old->beDepth) - return FALSE; - if (new->beBPP != old->beBPP) - return FALSE; - - if (new->beNumDepths != old->beNumDepths) - return FALSE; - for (i = 0; i < old->beNumDepths; i++) - if (new->beDepths[i] != old->beDepths[i]) - return FALSE; - - if (new->beNumPixmapFormats != old->beNumPixmapFormats) - return FALSE; - for (i = 0; i < old->beNumPixmapFormats; i++) { - if (new->bePixmapFormats[i].depth != old->bePixmapFormats[i].depth) - return FALSE; - if (new->bePixmapFormats[i].bits_per_pixel != - old->bePixmapFormats[i].bits_per_pixel) - return FALSE; - if (new->bePixmapFormats[i].scanline_pad != - old->bePixmapFormats[i].scanline_pad) - return FALSE; - } - - if (new->beNumVisuals != old->beNumVisuals) - return FALSE; - for (i = 0; i < old->beNumVisuals; i++) { - if (new->beVisuals[i].visualid != old->beVisuals[i].visualid) - return FALSE; - if (new->beVisuals[i].screen != old->beVisuals[i].screen) - return FALSE; - if (new->beVisuals[i].depth != old->beVisuals[i].depth) - return FALSE; - if (new->beVisuals[i].class != old->beVisuals[i].class) - return FALSE; - if (new->beVisuals[i].red_mask != old->beVisuals[i].red_mask) - return FALSE; - if (new->beVisuals[i].green_mask != old->beVisuals[i].green_mask) - return FALSE; - if (new->beVisuals[i].blue_mask != old->beVisuals[i].blue_mask) - return FALSE; - if (new->beVisuals[i].colormap_size != old->beVisuals[i].colormap_size) - return FALSE; - if (new->beVisuals[i].bits_per_rgb != old->beVisuals[i].bits_per_rgb) - return FALSE; - } - - if (new->beDefVisualIndex != old->beDefVisualIndex) - return FALSE; - - return TRUE; -} - -/** Restore Render's picture */ -static void -dmxBERestoreRenderPict(void *value, XID id, void *n) -{ - PicturePtr pPicture = value; /* The picture */ - DrawablePtr pDraw = pPicture->pDrawable; /* The picture's drawable */ - int scrnNum = (uintptr_t) n; - - if (pDraw->pScreen->myNum != scrnNum) { - /* Picture not on the screen we are restoring */ - return; - } - - if (pDraw->type == DRAWABLE_PIXMAP) { - PixmapPtr pPixmap = (PixmapPtr) pDraw; - - /* Create and restore the pixmap drawable */ - dmxBECreatePixmap(pPixmap); - dmxBERestorePixmap(pPixmap); - } - - dmxBECreatePicture(pPicture); -} - -/** Restore Render's glyphs */ -static void -dmxBERestoreRenderGlyph(void *value, XID id, void *n) -{ - GlyphSetPtr glyphSet = value; - int scrnNum = (uintptr_t) n; - dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - DMXScreenInfo *dmxScreen = &dmxScreens[scrnNum]; - GlyphRefPtr table; - char *images; - Glyph *gids; - XGlyphInfo *glyphs; - char *pos; - int beret; - int len_images = 0; - int i; - int ctr; - - if (glyphPriv->glyphSets[scrnNum]) { - /* Only restore glyphs on the screen we are attaching */ - return; - } - - /* First we must create the glyph set on the backend. */ - if ((beret = dmxBECreateGlyphSet(scrnNum, glyphSet)) != Success) { - dmxLog(dmxWarning, - "\tdmxBERestoreRenderGlyph failed to create glyphset!\n"); - return; - } - - /* Now for the complex part, restore the glyph data */ - table = glyphSet->hash.table; - - /* We need to know how much memory to allocate for this part */ - for (i = 0; i < glyphSet->hash.hashSet->size; i++) { - GlyphRefPtr gr = &table[i]; - GlyphPtr gl = gr->glyph; - - if (!gl || gl == DeletedGlyph) - continue; - len_images += gl->size - sizeof(gl->info); - } - - /* Now allocate the memory we need */ - images = calloc(len_images, sizeof(char)); - gids = xallocarray(glyphSet->hash.tableEntries, sizeof(Glyph)); - glyphs = xallocarray(glyphSet->hash.tableEntries, sizeof(XGlyphInfo)); - - pos = images; - ctr = 0; - - /* Fill the allocated memory with the proper data */ - for (i = 0; i < glyphSet->hash.hashSet->size; i++) { - GlyphRefPtr gr = &table[i]; - GlyphPtr gl = gr->glyph; - - if (!gl || gl == DeletedGlyph) - continue; - - /* First lets put the data into gids */ - gids[ctr] = gr->signature; - - /* Next do the glyphs data structures */ - glyphs[ctr].width = gl->info.width; - glyphs[ctr].height = gl->info.height; - glyphs[ctr].x = gl->info.x; - glyphs[ctr].y = gl->info.y; - glyphs[ctr].xOff = gl->info.xOff; - glyphs[ctr].yOff = gl->info.yOff; - - /* Copy the images from the DIX's data into the buffer */ - memcpy(pos, gl + 1, gl->size - sizeof(gl->info)); - pos += gl->size - sizeof(gl->info); - ctr++; - } - - /* Now restore the glyph data */ - XRenderAddGlyphs(dmxScreen->beDisplay, glyphPriv->glyphSets[scrnNum], - gids, glyphs, glyphSet->hash.tableEntries, images, - len_images); - - /* Clean up */ - free(images); - free(gids); - free(glyphs); -} - -/** Reattach previously detached back-end screen. */ -int -dmxAttachScreen(int idx, DMXScreenAttributesPtr attr) -{ - ScreenPtr pScreen; - DMXScreenInfo *dmxScreen; - CARD32 scrnNum = idx; - DMXScreenInfo oldDMXScreen; - int i; - - /* Return failure if dynamic addition/removal of screens is disabled */ - if (!dmxAddRemoveScreens) { - dmxLog(dmxWarning, - "Attempting to add a screen, but the AddRemoveScreen\n"); - dmxLog(dmxWarning, - "extension has not been enabled. To enable this extension\n"); - dmxLog(dmxWarning, - "add the \"-addremovescreens\" option either to the command\n"); - dmxLog(dmxWarning, "line or in the configuration file.\n"); - return 1; - } - - /* Cannot add a screen that does not exist */ - if (idx < 0 || idx >= dmxNumScreens) - return 1; - pScreen = screenInfo.screens[idx]; - dmxScreen = &dmxScreens[idx]; - - /* Cannot attach to a screen that is already opened */ - if (dmxScreen->beDisplay) { - dmxLog(dmxWarning, - "Attempting to add screen #%d but a screen already exists\n", - idx); - return 1; - } - - dmxLogOutput(dmxScreen, "Attaching screen #%d\n", idx); - - /* Save old info */ - oldDMXScreen = *dmxScreen; - - /* Copy the name to the new screen */ - dmxScreen->name = strdup(attr->displayName); - - /* Open display and get all of the screen info */ - if (!dmxOpenDisplay(dmxScreen)) { - dmxLog(dmxWarning, - "dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name); - - /* Restore the old screen */ - *dmxScreen = oldDMXScreen; - return 1; - } - - dmxSetErrorHandler(dmxScreen); - dmxCheckForWM(dmxScreen); - dmxGetScreenAttribs(dmxScreen); - - if (!dmxGetVisualInfo(dmxScreen)) { - dmxLog(dmxWarning, "dmxGetVisualInfo: No matching visuals found\n"); - XFree(dmxScreen->beVisuals); - XCloseDisplay(dmxScreen->beDisplay); - - /* Restore the old screen */ - *dmxScreen = oldDMXScreen; - return 1; - } - - dmxGetColormaps(dmxScreen); - dmxGetPixmapFormats(dmxScreen); - - /* Verify that the screen to be added has the same info as the - * previously added screen. */ - if (!dmxCompareScreens(dmxScreen, &oldDMXScreen)) { - dmxLog(dmxWarning, - "New screen data (%s) does not match previously\n", - dmxScreen->name); - dmxLog(dmxWarning, "attached screen data (%s)\n", oldDMXScreen.name); - dmxLog(dmxWarning, - "All data must match in order to attach to screen #%d\n", idx); - XFree(dmxScreen->beVisuals); - XFree(dmxScreen->beDepths); - XFree(dmxScreen->bePixmapFormats); - XCloseDisplay(dmxScreen->beDisplay); - - /* Restore the old screen */ - *dmxScreen = oldDMXScreen; - return 1; - } - - /* Initialize the BE screen resources */ - dmxBEScreenInit(screenInfo.screens[idx]); - - /* TODO: Handle GLX visual initialization. GLXProxy needs to be - * updated to handle dynamic addition/removal of screens. */ - - /* Create default stipple */ - dmxBECreatePixmap(pScreen->defaultStipple); - dmxBERestorePixmap(pScreen->defaultStipple); - - /* Create the scratch GCs */ - dmxBECreateScratchGCs(idx); - - /* Create the default font */ - (void) dmxBELoadFont(pScreen, defaultFont); - - /* Create all resources that don't depend on windows */ - for (i = currentMaxClients; --i >= 0;) - if (clients[i]) - FindAllClientResources(clients[i], dmxBECreateResources, - (void *) (uintptr_t) idx); - - /* Create window hierarchy (top down) */ - dmxBECreateWindowTree(idx); - - /* Restore the picture state for RENDER */ - for (i = currentMaxClients; --i >= 0;) - if (clients[i]) - FindClientResourcesByType(clients[i], PictureType, - dmxBERestoreRenderPict, - (void *) (uintptr_t) idx); - - /* Restore the glyph state for RENDER */ - for (i = currentMaxClients; --i >= 0;) - if (clients[i]) - FindClientResourcesByType(clients[i], GlyphSetType, - dmxBERestoreRenderGlyph, - (void *) (uintptr_t) idx); - - /* Refresh screen by generating exposure events for all windows */ - dmxForceExposures(idx); - - dmxSync(&dmxScreens[idx], TRUE); - - /* We used these to compare the old and new screens. They are no - * longer needed since we have a newly attached screen, so we can - * now free the old screen's resources. */ - XFree(oldDMXScreen.beVisuals); - XFree(oldDMXScreen.beDepths); - XFree(oldDMXScreen.bePixmapFormats); - /* TODO: should oldDMXScreen.name be freed?? */ - -#ifdef PANORAMIX - if (!noPanoramiXExtension) - return dmxConfigureScreenWindows(1, &scrnNum, attr, NULL); - else -#endif - return 0; /* Success */ -} - -/* - * Resources that may have state on the BE server and need to be freed: - * - * RT_NONE - * RT_WINDOW - * RT_PIXMAP - * RT_GC - * RT_FONT - * RT_CURSOR - * RT_COLORMAP - * RT_CMAPENTRY - * RT_OTHERCLIENT - * RT_PASSIVEGRAB - * XRT_WINDOW - * XRT_PIXMAP - * XRT_GC - * XRT_COLORMAP - * XRT_PICTURE - * PictureType - * PictFormatType - * GlyphSetType - * ClientType - * EventType - * RT_INPUTCLIENT - * XETrapType - * RTCounter - * RTAwait - * RTAlarmClient - * RT_XKBCLIENT - * RTContext - * TagResType - * StalledResType - * SecurityAuthorizationResType - * RTEventClient - * __glXContextRes - * __glXClientRes - * __glXPixmapRes - * __glXWindowRes - * __glXPbufferRes - */ - -#ifdef PANORAMIX -/** Search the Xinerama XRT_PIXMAP resources for the pixmap that needs - * to have its image saved. */ -static void -dmxBEFindPixmapImage(void *value, XID id, RESTYPE type, void *p) -{ - if ((type & TypeMask) == (XRT_PIXMAP & TypeMask)) { - PixmapPtr pDst = (PixmapPtr) p; - int idx = pDst->drawable.pScreen->myNum; - PanoramiXRes *pXinPix = (PanoramiXRes *) value; - PixmapPtr pPix; - int i; - - dixLookupResourceByType((void **) &pPix, pXinPix->info[idx].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - if (pPix != pDst) - return; /* Not a match.... Next! */ - - FOR_NSCREENS(i) { - PixmapPtr pSrc; - dmxPixPrivPtr pSrcPriv = NULL; - - if (i == idx) - continue; /* Self replication is bad */ - - dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); - if (pSrcPriv->pixmap) { - FoundPixImage = True; - return; - } - } - } -} -#endif - -/** Save the pixmap image only when there is not another screen with - * that pixmap from which the image can be read when the screen is - * reattached. To do this, we first try to find a pixmap on another - * screen corresponding to the one we are trying to save. If we find - * one, then we do not need to save the image data since during - * reattachment, the image data can be read from that other pixmap. - * However, if we do not find one, then we need to save the image data. - * The common case for these are for the default stipple and root - * tile. */ -static void -dmxBESavePixmap(PixmapPtr pPixmap) -{ -#ifdef PANORAMIX - int i; - - /* If Xinerama is not active, there's nothing we can do (see comment - * in #else below for more info). */ - if (noPanoramiXExtension) - return; - - FoundPixImage = False; - for (i = currentMaxClients; --i >= 0;) - if (clients[i]) - FindAllClientResources(clients[i], dmxBEFindPixmapImage, - (void *) pPixmap); - - /* Save the image only if there is no other screens that have a - * pixmap that corresponds to the one we are trying to save. */ - if (!FoundPixImage) { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - if (!pPixPriv->detachedImage) { - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - pPixPriv->detachedImage = XGetImage(dmxScreen->beDisplay, - pPixPriv->pixmap, - 0, 0, - pPixmap->drawable.width, - pPixmap->drawable.height, - -1, ZPixmap); - if (!pPixPriv->detachedImage) - dmxLog(dmxWarning, "Cannot save pixmap image\n"); - } - } -#else - /* NOTE: The only time there is a pixmap on another screen that - * corresponds to the one we are trying to save is when Xinerama is - * active. Otherwise, the pixmap image data is only stored on a - * single screen, which means that once it is detached, that data is - * lost. We could save the data here, but then that would require - * us to implement the ability for Xdmx to keep the pixmap up to - * date while the screen is detached, which is beyond the scope of - * the current project. */ - return; -#endif -} - -/** Destroy resources on the back-end server. This function is called - * from #dmxDetachScreen() via the dix layer's FindAllResources - * function. It walks all resources, compares them to the screen - * number passed in as \a n and calls the appropriate DMX function to - * free the associated resource on the back-end server. */ -static void -dmxBEDestroyResources(void *value, XID id, RESTYPE type, void *n) -{ - int scrnNum = (uintptr_t) n; - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - - if ((type & TypeMask) == (RT_WINDOW & TypeMask)) { - /* Window resources are destroyed below in dmxBEDestroyWindowTree */ - } - else if ((type & TypeMask) == (RT_PIXMAP & TypeMask)) { - PixmapPtr pPix = value; - - if (pPix->drawable.pScreen->myNum == scrnNum) { - dmxBESavePixmap(pPix); - dmxBEFreePixmap(pPix); - } - } - else if ((type & TypeMask) == (RT_GC & TypeMask)) { - GCPtr pGC = value; - - if (pGC->pScreen->myNum == scrnNum) - dmxBEFreeGC(pGC); - } - else if ((type & TypeMask) == (RT_FONT & TypeMask)) { - dmxBEFreeFont(pScreen, (FontPtr) value); - } - else if ((type & TypeMask) == (RT_CURSOR & TypeMask)) { - dmxBEFreeCursor(pScreen, (CursorPtr) value); - } - else if ((type & TypeMask) == (RT_COLORMAP & TypeMask)) { - ColormapPtr pCmap = value; - - if (pCmap->pScreen->myNum == scrnNum) - dmxBEFreeColormap((ColormapPtr) value); - } - else if ((type & TypeMask) == (PictureType & TypeMask)) { - PicturePtr pPict = value; - - if (pPict->pDrawable->pScreen->myNum == scrnNum) { - /* Free the pixmaps on the backend if needed */ - if (pPict->pDrawable->type == DRAWABLE_PIXMAP) { - PixmapPtr pPixmap = (PixmapPtr) (pPict->pDrawable); - - dmxBESavePixmap(pPixmap); - dmxBEFreePixmap(pPixmap); - } - dmxBEFreePicture((PicturePtr) value); - } - } - else if ((type & TypeMask) == (GlyphSetType & TypeMask)) { - dmxBEFreeGlyphSet(pScreen, (GlyphSetPtr) value); - } - else { - /* Other resource types??? */ - } -} - -/** Destroy the scratch GCs that are created per depth. */ -static void -dmxBEDestroyScratchGCs(int scrnNum) -{ - ScreenPtr pScreen = screenInfo.screens[scrnNum]; - GCPtr *ppGC = pScreen->GCperDepth; - int i; - - for (i = 0; i <= pScreen->numDepths; i++) - dmxBEFreeGC(ppGC[i]); -} - -/** Destroy window hierarchy on back-end server. To ensure that all - * XDestroyWindow() calls succeed, they must be performed in a bottom - * up order so that windows are not destroyed before their children. - * XDestroyWindow(), which is called from #dmxBEDestroyWindow(), will - * destroy a window as well as all of its children. */ -static void -dmxBEDestroyWindowTree(int idx) -{ - WindowPtr pWin = screenInfo.screens[idx]->root; - WindowPtr pChild = pWin; - - while (1) { - if (pChild->firstChild) { - pChild = pChild->firstChild; - continue; - } - - /* Destroy the window */ - dmxBEDestroyWindow(pChild); - - /* Make sure we destroy the window's border and background - * pixmaps if they exist */ - if (!pChild->borderIsPixel) { - dmxBESavePixmap(pChild->border.pixmap); - dmxBEFreePixmap(pChild->border.pixmap); - } - if (pChild->backgroundState == BackgroundPixmap) { - dmxBESavePixmap(pChild->background.pixmap); - dmxBEFreePixmap(pChild->background.pixmap); - } - - while (!pChild->nextSib && (pChild != pWin)) { - pChild = pChild->parent; - dmxBEDestroyWindow(pChild); - if (!pChild->borderIsPixel) { - dmxBESavePixmap(pChild->border.pixmap); - dmxBEFreePixmap(pChild->border.pixmap); - } - if (pChild->backgroundState == BackgroundPixmap) { - dmxBESavePixmap(pChild->background.pixmap); - dmxBEFreePixmap(pChild->background.pixmap); - } - } - - if (pChild == pWin) - break; - - pChild = pChild->nextSib; - } -} - -/** Detach back-end screen. */ -int -dmxDetachScreen(int idx) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - int i; - - /* Return failure if dynamic addition/removal of screens is disabled */ - if (!dmxAddRemoveScreens) { - dmxLog(dmxWarning, - "Attempting to remove a screen, but the AddRemoveScreen\n"); - dmxLog(dmxWarning, - "extension has not been enabled. To enable this extension\n"); - dmxLog(dmxWarning, - "add the \"-addremovescreens\" option either to the command\n"); - dmxLog(dmxWarning, "line or in the configuration file.\n"); - return 1; - } - - /* Cannot remove a screen that does not exist */ - if (idx < 0 || idx >= dmxNumScreens) - return 1; - - /* Cannot detach from a screen that is not opened */ - if (!dmxScreen->beDisplay) { - dmxLog(dmxWarning, - "Attempting to remove screen #%d but it has not been opened\n", - idx); - return 1; - } - - dmxLogOutput(dmxScreen, "Detaching screen #%d\n", idx); - - /* Detach input */ - dmxInputDetachAll(dmxScreen); - - /* Save all relevant state (TODO) */ - - /* Free all non-window resources related to this screen */ - for (i = currentMaxClients; --i >= 0;) - if (clients[i]) - FindAllClientResources(clients[i], dmxBEDestroyResources, - (void *) (uintptr_t) idx); - - /* Free scratch GCs */ - dmxBEDestroyScratchGCs(idx); - - /* Free window resources related to this screen */ - dmxBEDestroyWindowTree(idx); - - /* Free default stipple */ - dmxBESavePixmap(screenInfo.screens[idx]->defaultStipple); - dmxBEFreePixmap(screenInfo.screens[idx]->defaultStipple); - - /* Free the remaining screen resources and close the screen */ - dmxBECloseScreen(screenInfo.screens[idx]); - - /* Adjust the cursor boundaries (paints detached console window) */ - dmxAdjustCursorBoundaries(); - - return 0; /* Success */ -} diff --git a/hw/dmx/dmxextension.h b/hw/dmx/dmxextension.h deleted file mode 100644 index 036417b8d..000000000 --- a/hw/dmx/dmxextension.h +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright 2003-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. - */ - -/* - * Author: - * Rickard E. (Rik) Faith <faith@redhat.com> - * Kevin E. Martin <kem@redhat.com> - * - */ - -/** \file - * Interface for DMX extension support. These routines are called by - * function in Xserver/Xext/dmx.c. \see dmxextension.c */ - -#ifndef _DMXEXTENSION_H_ -#define _DMXEXTENSION_H_ - -/** Screen attributes. Used by #ProcDMXGetScreenAttributes and - * \a ProcDMXChangeScreensAttributes. */ -typedef struct { - const char *displayName; - int logicalScreen; - - unsigned int screenWindowWidth; /* displayName's coordinate system */ - unsigned int screenWindowHeight; /* displayName's coordinate system */ - int screenWindowXoffset; /* displayName's coordinate system */ - int screenWindowYoffset; /* displayName's coordinate system */ - - unsigned int rootWindowWidth; /* screenWindow's coordinate system */ - unsigned int rootWindowHeight; /* screenWindow's coordinate system */ - int rootWindowXoffset; /* screenWindow's coordinate system */ - int rootWindowYoffset; /* screenWindow's coordinate system */ - - int rootWindowXorigin; /* global coordinate system */ - int rootWindowYorigin; /* global coordinate system */ -} DMXScreenAttributesRec, *DMXScreenAttributesPtr; - -/** Window attributes. Used by #ProcDMXGetWindowAttributes. */ -typedef struct { - int screen; - Window window; - xRectangle pos; - xRectangle vis; -} DMXWindowAttributesRec, *DMXWindowAttributesPtr; - -/** Desktop attributes. Used by #ProcDMXGetDesktopAttributes and - * #ProcDMXChangeDesktopAttributes. */ -typedef struct { - int width; - int height; - int shiftX; - int shiftY; -} DMXDesktopAttributesRec, *DMXDesktopAttributesPtr; - -/** Input attributes. Used by #ProcDMXGetInputAttributes. */ -typedef struct { - const char *name; - int inputType; - int physicalScreen; - int physicalId; - int isCore; - int sendsCore; - int detached; -} DMXInputAttributesRec, *DMXInputAttributesPtr; - -extern unsigned long dmxGetNumScreens(void); -extern void dmxForceWindowCreation(WindowPtr pWindow); -extern void dmxFlushPendingSyncs(void); -extern Bool dmxGetScreenAttributes(int physical, DMXScreenAttributesPtr attr); -extern Bool dmxGetWindowAttributes(WindowPtr pWindow, - DMXWindowAttributesPtr attr); -extern void dmxGetDesktopAttributes(DMXDesktopAttributesPtr attr); -extern int dmxGetInputCount(void); -extern int dmxGetInputAttributes(int deviceId, DMXInputAttributesPtr attr); -extern int dmxAddInput(DMXInputAttributesPtr attr, int *deviceId); -extern int dmxRemoveInput(int deviceId); - -extern int dmxConfigureScreenWindows(int nscreens, - CARD32 *screens, - DMXScreenAttributesPtr attribs, - int *errorScreen); - -extern int dmxConfigureDesktop(DMXDesktopAttributesPtr attribs); - -/* dmxUpdateScreenResources exposed for dmxCreateWindow in dmxwindow.c */ -extern void dmxUpdateScreenResources(ScreenPtr pScreen, - int x, int y, int w, int h); - -extern int dmxAttachScreen(int idx, DMXScreenAttributesPtr attr); -extern int dmxDetachScreen(int idx); -#endif diff --git a/hw/dmx/dmxfont.c b/hw/dmx/dmxfont.c deleted file mode 100644 index addfa6abf..000000000 --- a/hw/dmx/dmxfont.c +++ /dev/null @@ -1,573 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * This file provides support for fonts. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_FONTPATH_DEBUG 0 - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxfont.h" -#include "dmxlog.h" - -#include <X11/fonts/fontstruct.h> -#include <X11/fonts/libxfont2.h> -#include "dixfont.h" -#include "dixstruct.h" - -static int (*dmxSaveProcVector[256]) (ClientPtr); -static int dmxFontLastError; - -static int -dmxFontErrorHandler(Display * dpy, XErrorEvent * ev) -{ - dmxFontLastError = ev->error_code; - - return 0; -} - -static char ** -dmxGetFontPath(int *npaths) -{ - char **fp; - unsigned char *c, *paths; - char *newfp; - int len, l, i; - - GetFontPath(serverClient, npaths, &len, &paths); - - newfp = malloc(*npaths + len); - c = (unsigned char *) newfp; - fp = xallocarray(*npaths, sizeof(*fp)); - - memmove(newfp, paths + 1, *npaths + len - 1); - l = *paths; - for (i = 0; i < *npaths; i++) { - fp[i] = (char *) c; - c += l; - l = *c; - *c++ = '\0'; - } - -#if DMX_FONTPATH_DEBUG - for (i = 0; i < *npaths; i++) - dmxLog(dmxDebug, "FontPath[%d] = %s\n", i, fp[i]); -#endif - - return fp; -} - -static void -dmxFreeFontPath(char **fp) -{ - free(fp[0]); - free(fp); -} - -static Bool -dmxCheckFontPathElement(DMXScreenInfo * dmxScreen, char *fp) -{ - int (*oldErrorHandler) (Display *, XErrorEvent *); - - if (!dmxScreen->beDisplay) - return TRUE; - - dmxFontLastError = 0; - oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler); - XSetFontPath(dmxScreen->beDisplay, &fp, 1); - dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */ - XSetErrorHandler(oldErrorHandler); - - return dmxFontLastError == 0; -} - -static int -dmxSetFontPath(DMXScreenInfo * dmxScreen) -{ - int (*oldErrorHandler) (Display *, XErrorEvent *); - char **fp; - int result = Success; - int npaths; - - if (!dmxScreen->beDisplay) - return result; - - fp = dmxGetFontPath(&npaths); - if (!fp) - return BadAlloc; - - dmxFontLastError = 0; - oldErrorHandler = XSetErrorHandler(dmxFontErrorHandler); - XSetFontPath(dmxScreen->beDisplay, fp, npaths); - dmxSync(dmxScreen, TRUE); /* Must complete before removing handler */ - XSetErrorHandler(oldErrorHandler); - - if (dmxFontLastError) { - result = dmxFontLastError; - /* We could set *error here to the offending path, but it is - * ignored, so we don't bother figuring out which path is bad. - * If we do add this support in the future, we'll need to add - * error to the function's argument list. - */ - } - - dmxFreeFontPath(fp); - - return result; -} - -static int -dmxCheckFontPath(DMXScreenInfo * dmxScreen, int *error) -{ - char **oldFontPath; - int nOldPaths; - int result = Success; - - if (!dmxScreen->beDisplay) - return result; - - /* Save old font path */ - oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths); - - result = dmxSetFontPath(dmxScreen); - - /* Restore old font path */ - XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths); - XFreeFontPath(oldFontPath); - dmxSync(dmxScreen, FALSE); - - return result; -} - -static int -dmxProcSetFontPath(ClientPtr client) -{ - unsigned char *ptr; - unsigned long nbytes, total, n; - long nfonts; - int i, result; - unsigned char *oldFontPath, *tmpFontPath; - int nOldPaths; - int lenOldPaths; - - REQUEST(xSetFontPathReq); - - REQUEST_AT_LEAST_SIZE(xSetFontPathReq); - - nbytes = (client->req_len << 2) - sizeof(xSetFontPathReq); - total = nbytes; - ptr = (unsigned char *) &stuff[1]; - nfonts = stuff->nFonts; - - while (--nfonts >= 0) { - if ((total == 0) || (total < (n = (*ptr + 1)))) - return BadLength; - total -= n; - ptr += n; - } - if (total >= 4) - return BadLength; - - GetFontPath(serverClient, &nOldPaths, &lenOldPaths, &tmpFontPath); - oldFontPath = malloc(nOldPaths + lenOldPaths); - memmove(oldFontPath, tmpFontPath, nOldPaths + lenOldPaths); - - result = SetFontPath(client, stuff->nFonts, (unsigned char *) &stuff[1]); - if (!result) { - int error = 0; - - for (i = 0; i < dmxNumScreens; i++) - if ((result = dmxCheckFontPath(&dmxScreens[i], &error))) - break; - - if (result) { - /* Restore old fontpath in the DMX server */ - SetFontPath(client, nOldPaths, oldFontPath); - client->errorValue = error; - } - } - - free(oldFontPath); - return result; -} - -/** Initialize font support. In addition to the screen function call - * pointers, DMX also hooks in at the ProcVector[] level. Here the old - * ProcVector function pointers are saved and the new ProcVector - * function pointers are initialized. */ -void -dmxInitFonts(void) -{ - int i; - - for (i = 0; i < 256; i++) - dmxSaveProcVector[i] = ProcVector[i]; - - ProcVector[X_SetFontPath] = dmxProcSetFontPath; -} - -/** Reset font support by restoring the original ProcVector function - * pointers. */ -void -dmxResetFonts(void) -{ - int i; - - for (i = 0; i < 256; i++) - ProcVector[i] = dmxSaveProcVector[i]; -} - -/** Load the font, \a pFont, on the back-end server associated with \a - * pScreen. When a font is loaded, the font path on back-end server is - * first initialized to that specified on the command line with the - * -fontpath options, and then the font is loaded. */ -Bool -dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); - const char *name; - char **oldFontPath = NULL; - int nOldPaths; - Atom name_atom, value_atom; - int i; - - /* Make sure we have a font private struct to work with */ - if (!pFontPriv) - return FALSE; - - /* Don't load a font over top of itself */ - if (pFontPriv->font[pScreen->myNum]) { - return TRUE; /* Already loaded font */ - } - - /* Save old font path */ - oldFontPath = XGetFontPath(dmxScreen->beDisplay, &nOldPaths); - - /* Set the font path for the font about to be loaded on the back-end */ - if (dmxSetFontPath(dmxScreen)) { - char **fp; - int npaths; - Bool *goodfps; - - /* This could fail only when first starting the X server and - * loading the default font. If it fails here, then the default - * font path is invalid, no default font path will be set, the - * DMX server will fail to load the default font, and it will - * exit with an error unless we remove the offending font paths - * with the -ignorebadfontpaths command line option. - */ - - fp = dmxGetFontPath(&npaths); - if (!fp) { - dmxLog(dmxError, "No default font path set.\n"); - dmxLog(dmxError, - "Please see the Xdmx man page for information on how to\n"); - dmxLog(dmxError, - "initialize the DMX server's default font path.\n"); - XFreeFontPath(oldFontPath); - return FALSE; - } - - if (!dmxFontPath) - dmxLog(dmxWarning, "No default font path is set.\n"); - - goodfps = xallocarray(npaths, sizeof(*goodfps)); - - dmxLog(dmxError, - "The DMX server failed to set the following font paths on " - "screen #%d:\n", pScreen->myNum); - - for (i = 0; i < npaths; i++) - if (!(goodfps[i] = dmxCheckFontPathElement(dmxScreen, fp[i]))) - dmxLog(dmxError, " %s\n", fp[i]); - - if (dmxIgnoreBadFontPaths) { - char *newfp; - int newnpaths = 0; - int len = 0; - int j = 0; - - dmxLog(dmxError, - "These font paths will not be used because the " - "\"-ignorebadfontpaths\"\n"); - dmxLog(dmxError, "option is set.\n"); - - for (i = 0; i < npaths; i++) - if (goodfps[i]) { - len += strlen(fp[i]) + 1; - newnpaths++; - } - - if (!newnpaths) { - /* No valid font paths were found */ - dmxLog(dmxError, - "After removing the font paths above, no valid font " - "paths were\n"); - dmxLog(dmxError, - "available. Please check that the font paths set on " - "the command\n"); - dmxLog(dmxError, - "line or in the configuration file via the " - "\"-fontpath\" option\n"); - dmxLog(dmxError, - "are valid on all back-end servers. See the Xdmx man " - "page for\n"); - dmxLog(dmxError, "more information on font paths.\n"); - dmxFreeFontPath(fp); - XFreeFontPath(oldFontPath); - free(goodfps); - return FALSE; - } - - newfp = xallocarray(len, sizeof(*newfp)); - for (i = 0; i < npaths; i++) { - if (goodfps[i]) { - int n = strlen(fp[i]); - - newfp[j++] = n; - strncpy(&newfp[j], fp[i], n); - j += n; - } - } - - if (SetFontPath(serverClient, newnpaths, (unsigned char *) newfp)) { - /* Note that this should never happen since all of the - * FPEs were previously valid. */ - dmxLog(dmxError, "Cannot reset the default font path.\n"); - } - } - else if (dmxFontPath) { - dmxLog(dmxError, - "Please remove these font paths from the command line " - "or\n"); - dmxLog(dmxError, - "configuration file, or set the \"-ignorebadfontpaths\" " - "option to\n"); - dmxLog(dmxError, - "ignore them. For more information on these options, see " - "the\n"); - dmxLog(dmxError, "Xdmx man page.\n"); - } - else { - dmxLog(dmxError, - "Please specify the font paths that are available on all " - "back-end\n"); - dmxLog(dmxError, - "servers with the \"-fontpath\" option, or use the " - "\"-ignorebadfontpaths\"\n"); - dmxLog(dmxError, - "to ignore bad defaults. For more information on " - "these and other\n"); - dmxLog(dmxError, - "font-path-related options, see the Xdmx man page.\n"); - } - - free(goodfps); - if (!dmxIgnoreBadFontPaths || - (dmxIgnoreBadFontPaths && dmxSetFontPath(dmxScreen))) { - /* We still have errors so return with error */ - dmxFreeFontPath(fp); - XFreeFontPath(oldFontPath); - return FALSE; - } - } - - /* Find requested font on back-end server */ - name_atom = MakeAtom("FONT", 4, TRUE); - value_atom = 0L; - - for (i = 0; i < pFont->info.nprops; i++) { - if ((Atom) pFont->info.props[i].name == name_atom) { - value_atom = pFont->info.props[i].value; - break; - } - } - if (!value_atom) - return FALSE; - - name = NameForAtom(value_atom); - if (!name) - return FALSE; - - pFontPriv->font[pScreen->myNum] = - XLoadQueryFont(dmxScreen->beDisplay, name); - - /* Restore old font path */ - XSetFontPath(dmxScreen->beDisplay, oldFontPath, nOldPaths); - XFreeFontPath(oldFontPath); - dmxSync(dmxScreen, FALSE); - - if (!pFontPriv->font[pScreen->myNum]) - return FALSE; - - return TRUE; -} - -/** Realize the font, \a pFont, on the back-end server associated with - * \a pScreen. */ -Bool -dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxFontPrivPtr pFontPriv; - - if (!(pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) { - xfont2_font_set_private(pFont, dmxFontPrivateIndex, NULL); - pFontPriv = malloc(sizeof(dmxFontPrivRec)); - if (!pFontPriv) - return FALSE; - pFontPriv->font = NULL; - MAXSCREENSALLOC(pFontPriv->font); - if (!pFontPriv->font) { - free(pFontPriv); - return FALSE; - } - pFontPriv->refcnt = 0; - } - - xfont2_font_set_private(pFont, dmxFontPrivateIndex, (void *) pFontPriv); - - if (dmxScreen->beDisplay) { - if (!dmxBELoadFont(pScreen, pFont)) - return FALSE; - - pFontPriv->refcnt++; - } - else { - pFontPriv->font[pScreen->myNum] = NULL; - } - - return TRUE; -} - -/** Free \a pFont on the back-end associated with \a pScreen. */ -Bool -dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxFontPrivPtr pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); - - if (pFontPriv && pFontPriv->font[pScreen->myNum]) { - XFreeFont(dmxScreen->beDisplay, pFontPriv->font[pScreen->myNum]); - pFontPriv->font[pScreen->myNum] = NULL; - return TRUE; - } - - return FALSE; -} - -/** Unrealize the font, \a pFont, on the back-end server associated with - * \a pScreen. */ -Bool -dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxFontPrivPtr pFontPriv; - - if ((pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex))) { - /* In case the font failed to load properly */ - if (!pFontPriv->refcnt) { - MAXSCREENSFREE(pFontPriv->font); - free(pFontPriv); - xfont2_font_set_private(pFont, dmxFontPrivateIndex, NULL); - } - else if (pFontPriv->font[pScreen->myNum]) { - if (dmxScreen->beDisplay) - dmxBEFreeFont(pScreen, pFont); - - /* The code below is non-obvious, so here's an explanation... - * - * When creating the default GC, the server opens up the - * default font once for each screen, which in turn calls - * the RealizeFont function pointer once for each screen. - * During this process both dix's font refcnt and DMX's font - * refcnt are incremented once for each screen. - * - * Later, when shutting down the X server, dix shuts down - * each screen in reverse order. During this shutdown - * procedure, each screen's default GC is freed and then - * that screen is closed by calling the CloseScreen function - * pointer. screenInfo.numScreens is then decremented after - * closing each screen. This procedure means that the dix's - * font refcnt for the font used by the default GC's is - * decremented once for each screen # greater than 0. - * However, since dix's refcnt for the default font is not - * yet 0 for each screen greater than 0, no call to the - * UnrealizeFont function pointer is made for those screens. - * Then, when screen 0 is being closed, dix's font refcnt - * for the default GC's font is finally 0 and the font is - * unrealized. However, since screenInfo.numScreens has - * been decremented already down to 1, only one call to - * UnrealizeFont is made (for screen 0). Thus, even though - * RealizeFont was called once for each screen, - * UnrealizeFont is only called for screen 0. - * - * This is a bug in dix. - * - * To avoid the memory leak of pFontPriv for each server - * generation, we can also free pFontPriv if the refcnt is - * not yet 0 but the # of screens is 1 -- i.e., the case - * described in the dix bug above. This is only a temporary - * workaround until the bug in dix is solved. - * - * The other problem is that the font structure allocated by - * XLoadQueryFont() above is not freed for screens > 0. - * This problem cannot be worked around here since the back- - * end displays for screens > 0 have already been closed by - * the time this code is called from dix. - * - * When the bug in dix described above is fixed, then we can - * remove the "|| screenInfo.numScreens == 1" code below and - * the memory leaks will be eliminated. - */ - if (--pFontPriv->refcnt == 0 -#if 1 - /* Remove this code when the dix bug is fixed */ - || screenInfo.numScreens == 1 -#endif - ) { - MAXSCREENSFREE(pFontPriv->font); - free(pFontPriv); - xfont2_font_set_private(pFont, dmxFontPrivateIndex, NULL); - } - } - } - - return TRUE; -} diff --git a/hw/dmx/dmxfont.h b/hw/dmx/dmxfont.h deleted file mode 100644 index 66c663377..000000000 --- a/hw/dmx/dmxfont.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Interface for font-related functions. \see dmxfont.c */ - -#ifndef DMXFONT_H -#define DMXFONT_H - -#include <X11/fonts/fontstruct.h> - -/** Font private area. */ -typedef struct _dmxFontPriv { - int refcnt; - XFontStruct **font; -} dmxFontPrivRec, *dmxFontPrivPtr; - -extern void dmxInitFonts(void); -extern void dmxResetFonts(void); - -extern Bool dmxRealizeFont(ScreenPtr pScreen, FontPtr pFont); -extern Bool dmxUnrealizeFont(ScreenPtr pScreen, FontPtr pFont); - -extern Bool dmxBELoadFont(ScreenPtr pScreen, FontPtr pFont); -extern Bool dmxBEFreeFont(ScreenPtr pScreen, FontPtr pFont); - -#endif /* DMXFONT_H */ diff --git a/hw/dmx/dmxgc.c b/hw/dmx/dmxgc.c deleted file mode 100644 index c4789a607..000000000 --- a/hw/dmx/dmxgc.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * This file provides support for GCs. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxgc.h" -#include "dmxgcops.h" -#include "dmxpixmap.h" -#include "dmxfont.h" - -#include "gcstruct.h" -#include "pixmapstr.h" -#include "migc.h" - -static const GCFuncs dmxGCFuncs = { - dmxValidateGC, - dmxChangeGC, - dmxCopyGC, - dmxDestroyGC, - dmxChangeClip, - dmxDestroyClip, - dmxCopyClip, -}; - -static const GCOps dmxGCOps = { - dmxFillSpans, - dmxSetSpans, - dmxPutImage, - dmxCopyArea, - dmxCopyPlane, - dmxPolyPoint, - dmxPolylines, - dmxPolySegment, - dmxPolyRectangle, - dmxPolyArc, - dmxFillPolygon, - dmxPolyFillRect, - dmxPolyFillArc, - dmxPolyText8, - dmxPolyText16, - dmxImageText8, - dmxImageText16, - dmxImageGlyphBlt, - dmxPolyGlyphBlt, - dmxPushPixels -}; - -/** Initialize the GC on \a pScreen */ -Bool -dmxInitGC(ScreenPtr pScreen) -{ - if (!dixRegisterPrivateKey - (&dmxGCPrivateKeyRec, PRIVATE_GC, sizeof(dmxGCPrivRec))) - return FALSE; - return TRUE; -} - -/** Create the GC on the back-end server. */ -void -dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - int i; - - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (pGC->depth == dmxScreen->bePixmapFormats[i].depth) { - unsigned long mask; - XGCValues gcvals; - - mask = GCGraphicsExposures; - gcvals.graphics_exposures = FALSE; - - /* Create GC in the back-end servers */ - pGCPriv->gc = XCreateGC(dmxScreen->beDisplay, - dmxScreen->scrnDefDrawables[i], - mask, &gcvals); - break; - } - } -} - -/** Create a graphics context on the back-end server associated /a pGC's - * screen. */ -Bool -dmxCreateGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Bool ret; - - DMX_UNWRAP(CreateGC, dmxScreen, pScreen); - if ((ret = pScreen->CreateGC(pGC))) { - /* Save the old funcs */ - pGCPriv->funcs = pGC->funcs; - pGCPriv->ops = NULL; - - pGC->funcs = &dmxGCFuncs; - - if (dmxScreen->beDisplay) { - dmxBECreateGC(pScreen, pGC); - } - else { - pGCPriv->gc = NULL; - } - - /* Check for "magic special case" - * 1. see CreateGC in dix/gc.c for more info - * 2. see dmxChangeGC for more info - */ - pGCPriv->msc = (!pGC->tileIsPixel && !pGC->tile.pixmap); - } - DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); - - return ret; -} - -/** Validate a graphics context, \a pGC, locally in the DMX server and - * recompute the composite clip, if necessary. */ -void -dmxValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) -{ - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - - DMX_GC_FUNC_PROLOGUE(pGC); -#if 0 - pGC->funcs->ValidateGC(pGC, changes, pDrawable); -#endif - - if (pDrawable->type == DRAWABLE_WINDOW || - pDrawable->type == DRAWABLE_PIXMAP) { - /* Save the old ops, since we're about to change the ops in the - * epilogue. - */ - pGCPriv->ops = pGC->ops; - } - else { - pGCPriv->ops = NULL; - } - - /* If the client clip is different or moved OR the subwindowMode has - * changed OR the window's clip has changed since the last - * validation, then we need to recompute the composite clip. - */ - if ((changes & (GCClipXOrigin | - GCClipYOrigin | - GCClipMask | - GCSubwindowMode)) || - (pDrawable->serialNumber != - (pGC->serialNumber & DRAWABLE_SERIAL_BITS))) { - miComputeCompositeClip(pGC, pDrawable); - } - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Set the values in the graphics context on the back-end server - * associated with \a pGC's screen. */ -void -dmxChangeGC(GCPtr pGC, unsigned long mask) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - XGCValues v; - - DMX_GC_FUNC_PROLOGUE(pGC); -#if 0 - pGC->funcs->ChangeGC(pGC, mask); -#endif - - /* Handle "magic special case" from CreateGC */ - if (pGCPriv->msc) { - /* The "magic special case" is used to handle the case where a - * foreground pixel is set when the GC is created so that a - * "pseudo default-tile" can be created and used in case the - * fillstyle was set to FillTiled. This specific case is tested - * in xtest (XCreateGC test #3). What has happened in dix by - * the time it reaches here is (1) the pGC->tile.pixel has been - * set to pGC->fgPixel and pGC->tileIsPixel is set, (2) if a - * tile has also been set, then pGC->tileIsPixel is unset and - * pGC->tile.pixmap is initialized; else, the default tile is - * created and pGC->tileIsPixel is unset and pGC->tile.pixmap is - * initialized to the "pseudo default-tile". In either case, - * pGC->tile.pixmap is set; however, in the "magic special case" - * the mask is not updated to allow us to detect that we should - * initialize the GCTile in the back-end server. Thus, we catch - * this case in dmxCreateGC and add GCTile to the mask here. - * Are there any cases that I've missed? - */ - - /* Make sure that the tile.pixmap is set, just in case the user - * set GCTile in the mask but forgot to set vals.pixmap - */ - if (pGC->tile.pixmap) - mask |= GCTile; - - /* This only happens once when the GC is created */ - pGCPriv->msc = FALSE; - } - - /* Update back-end server's gc */ - if (mask & GCFunction) - v.function = pGC->alu; - if (mask & GCPlaneMask) - v.plane_mask = pGC->planemask; - if (mask & GCForeground) - v.foreground = pGC->fgPixel; - if (mask & GCBackground) - v.background = pGC->bgPixel; - if (mask & GCLineWidth) - v.line_width = pGC->lineWidth; - if (mask & GCLineStyle) - v.line_style = pGC->lineStyle; - if (mask & GCCapStyle) - v.cap_style = pGC->capStyle; - if (mask & GCJoinStyle) - v.join_style = pGC->joinStyle; - if (mask & GCFillStyle) - v.fill_style = pGC->fillStyle; - if (mask & GCFillRule) - v.fill_rule = pGC->fillRule; - if (mask & GCTile) { - if (pGC->tileIsPixel) { - mask &= ~GCTile; - } - else { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->tile.pixmap); - - v.tile = (Drawable) pPixPriv->pixmap; - } - } - if (mask & GCStipple) { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pGC->stipple); - - v.stipple = (Drawable) pPixPriv->pixmap; - } - if (mask & GCTileStipXOrigin) - v.ts_x_origin = pGC->patOrg.x; - if (mask & GCTileStipYOrigin) - v.ts_y_origin = pGC->patOrg.y; - if (mask & GCFont) { - if (dmxScreen->beDisplay) { - dmxFontPrivPtr pFontPriv; - - pFontPriv = FontGetPrivate(pGC->font, dmxFontPrivateIndex); - v.font = pFontPriv->font[pScreen->myNum]->fid; - } - else { - mask &= ~GCFont; - } - } - if (mask & GCSubwindowMode) - v.subwindow_mode = pGC->subWindowMode; - - /* Graphics exposures are not needed on the back-ends since they can - be generated on the front-end thereby saving bandwidth. */ - if (mask & GCGraphicsExposures) - mask &= ~GCGraphicsExposures; - - if (mask & GCClipXOrigin) - v.clip_x_origin = pGC->clipOrg.x; - if (mask & GCClipYOrigin) - v.clip_y_origin = pGC->clipOrg.y; - if (mask & GCClipMask) - mask &= ~GCClipMask; /* See ChangeClip */ - if (mask & GCDashOffset) - v.dash_offset = pGC->dashOffset; - if (mask & GCDashList) { - mask &= ~GCDashList; - if (dmxScreen->beDisplay) - XSetDashes(dmxScreen->beDisplay, pGCPriv->gc, - pGC->dashOffset, (char *) pGC->dash, pGC->numInDashList); - } - if (mask & GCArcMode) - v.arc_mode = pGC->arcMode; - - if (mask && dmxScreen->beDisplay) { - XChangeGC(dmxScreen->beDisplay, pGCPriv->gc, mask, &v); - dmxSync(dmxScreen, FALSE); - } - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Copy \a pGCSrc to \a pGCDst on the back-end server associated with - * \a pGCSrc's screen. */ -void -dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst) -{ - ScreenPtr pScreen = pGCSrc->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCSrcPriv = DMX_GET_GC_PRIV(pGCSrc); - dmxGCPrivPtr pGCDstPriv = DMX_GET_GC_PRIV(pGCDst); - - DMX_GC_FUNC_PROLOGUE(pGCDst); - pGCDst->funcs->CopyGC(pGCSrc, changes, pGCDst); - - /* Copy the GC on the back-end server */ - if (dmxScreen->beDisplay) - XCopyGC(dmxScreen->beDisplay, pGCSrcPriv->gc, changes, pGCDstPriv->gc); - - DMX_GC_FUNC_EPILOGUE(pGCDst); -} - -/** Free the \a pGC on the back-end server. */ -Bool -dmxBEFreeGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - - if (pGCPriv->gc) { - XFreeGC(dmxScreen->beDisplay, pGCPriv->gc); - pGCPriv->gc = NULL; - return TRUE; - } - - return FALSE; -} - -/** Destroy the graphics context, \a pGC and free the corresponding GC - * on the back-end server. */ -void -dmxDestroyGC(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - DMX_GC_FUNC_PROLOGUE(pGC); - - /* Free the GC on the back-end server */ - if (dmxScreen->beDisplay) - dmxBEFreeGC(pGC); - - pGC->funcs->DestroyGC(pGC); - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Change the clip rects for a GC. */ -void -dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - XRectangle *pRects; - BoxPtr pBox; - int i, nRects; - - DMX_GC_FUNC_PROLOGUE(pGC); - pGC->funcs->ChangeClip(pGC, type, pvalue, nrects); - - /* Set the client clip on the back-end server */ - if (!pGC->clientClip) { - if (dmxScreen->beDisplay) - XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); - } else { - if (dmxScreen->beDisplay) { - nRects = RegionNumRects((RegionPtr) pGC->clientClip); - pRects = xallocarray(nRects, sizeof(*pRects)); - pBox = RegionRects((RegionPtr) pGC->clientClip); - - for (i = 0; i < nRects; i++) { - pRects[i].x = pBox[i].x1; - pRects[i].y = pBox[i].y1; - pRects[i].width = pBox[i].x2 - pBox[i].x1; - pRects[i].height = pBox[i].y2 - pBox[i].y1; - } - - XSetClipRectangles(dmxScreen->beDisplay, pGCPriv->gc, - pGC->clipOrg.x, pGC->clipOrg.y, - pRects, nRects, Unsorted); - - free(pRects); - } - } - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Destroy a GC's clip rects. */ -void -dmxDestroyClip(GCPtr pGC) -{ - ScreenPtr pScreen = pGC->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - - DMX_GC_FUNC_PROLOGUE(pGC); - pGC->funcs->DestroyClip(pGC); - - /* Set the client clip on the back-end server to None */ - if (dmxScreen->beDisplay) - XSetClipMask(dmxScreen->beDisplay, pGCPriv->gc, None); - - DMX_GC_FUNC_EPILOGUE(pGC); -} - -/** Copy a GC's clip rects. */ -void -dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc) -{ - DMX_GC_FUNC_PROLOGUE(pGCDst); - pGCDst->funcs->CopyClip(pGCDst, pGCSrc); - DMX_GC_FUNC_EPILOGUE(pGCDst); -} diff --git a/hw/dmx/dmxgc.h b/hw/dmx/dmxgc.h deleted file mode 100644 index c5c6b7732..000000000 --- a/hw/dmx/dmxgc.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Interface for GC support. \see dmxgc.c */ - -#ifndef DMXGC_H -#define DMXGC_H - -#include "gcstruct.h" - -/** GC private area. */ -typedef struct _dmxGCPriv { - const GCOps *ops; - const GCFuncs *funcs; - XlibGC gc; - Bool msc; -} dmxGCPrivRec, *dmxGCPrivPtr; - -extern Bool dmxInitGC(ScreenPtr pScreen); - -extern Bool dmxCreateGC(GCPtr pGC); -extern void dmxValidateGC(GCPtr pGC, unsigned long changes, - DrawablePtr pDrawable); -extern void dmxChangeGC(GCPtr pGC, unsigned long mask); -extern void dmxCopyGC(GCPtr pGCSrc, unsigned long changes, GCPtr pGCDst); -extern void dmxDestroyGC(GCPtr pGC); -extern void dmxChangeClip(GCPtr pGC, int type, void *pvalue, int nrects); -extern void dmxDestroyClip(GCPtr pGC); -extern void dmxCopyClip(GCPtr pGCDst, GCPtr pGCSrc); - -extern void dmxBECreateGC(ScreenPtr pScreen, GCPtr pGC); -extern Bool dmxBEFreeGC(GCPtr pGC); - -/** Get private. */ -#define DMX_GET_GC_PRIV(_pGC) \ - (dmxGCPrivPtr)dixLookupPrivate(&(_pGC)->devPrivates, dmxGCPrivateKey) - -#define DMX_GC_FUNC_PROLOGUE(_pGC) \ -do { \ - dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \ - DMX_UNWRAP(funcs, _pGCPriv, (_pGC)); \ - if (_pGCPriv->ops) \ - DMX_UNWRAP(ops, _pGCPriv, (_pGC)); \ -} while (0) - -#define DMX_GC_FUNC_EPILOGUE(_pGC) \ -do { \ - dmxGCPrivPtr _pGCPriv = DMX_GET_GC_PRIV(_pGC); \ - DMX_WRAP(funcs, &dmxGCFuncs, _pGCPriv, (_pGC)); \ - if (_pGCPriv->ops) \ - DMX_WRAP(ops, &dmxGCOps, _pGCPriv, (_pGC)); \ -} while (0) - -#endif /* DMXGC_H */ diff --git a/hw/dmx/dmxgcops.c b/hw/dmx/dmxgcops.c deleted file mode 100644 index 0ebd69a0e..000000000 --- a/hw/dmx/dmxgcops.c +++ /dev/null @@ -1,637 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * This file provides support for GC operations. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxgc.h" -#include "dmxgcops.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" - -#include "mi.h" -#include "gcstruct.h" -#include "pixmapstr.h" -#include "dixfontstr.h" - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -#define DMX_GCOPS_SET_DRAWABLE(_pDraw, _draw) \ -do { \ - if ((_pDraw)->type == DRAWABLE_WINDOW) { \ - dmxWinPrivPtr pWinPriv = \ - DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw)); \ - (_draw) = (Drawable)pWinPriv->window; \ - } else { \ - dmxPixPrivPtr pPixPriv = \ - DMX_GET_PIXMAP_PRIV((PixmapPtr)(_pDraw)); \ - (_draw) = (Drawable)pPixPriv->pixmap; \ - } \ -} while (0) - -#define DMX_GCOPS_OFFSCREEN(_pDraw) \ - (!dmxScreens[(_pDraw)->pScreen->myNum].beDisplay || \ - (dmxOffScreenOpt && \ - (_pDraw)->type == DRAWABLE_WINDOW && \ - (DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->offscreen || \ - !DMX_GET_WINDOW_PRIV((WindowPtr)(_pDraw))->window))) - -/** Fill spans -- this function should never be called. */ -void -dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) -{ - /* Error -- this should never happen! */ -} - -/** Set spans -- this function should never be called. */ -void -dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC, - char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) -{ - /* Error -- this should never happen! */ -} - -/** Transfer \a pBits image to back-end server associated with \a - * pDrawable's screen. If primitive subdivision optimization is - * enabled, then only transfer the sections of \a pBits that are - * visible (i.e., not-clipped) to the back-end server. */ -void -dmxPutImage(DrawablePtr pDrawable, GCPtr pGC, - int depth, int x, int y, int w, int h, - int leftPad, int format, char *pBits) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - XImage *img; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - img = XCreateImage(dmxScreen->beDisplay, - dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, - depth, format, leftPad, pBits, w, h, - BitmapPad(dmxScreen->beDisplay), - (format == ZPixmap) ? - PixmapBytePad(w, depth) : BitmapBytePad(w + leftPad)); - - if (img) { - Drawable draw; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - if (dmxSubdividePrimitives && pGC->pCompositeClip) { - RegionPtr pSubImages; - RegionPtr pClip; - BoxRec box; - BoxPtr pBox; - int nBox; - - box.x1 = x; - box.y1 = y; - box.x2 = x + w; - box.y2 = y + h; - pSubImages = RegionCreate(&box, 1); - - pClip = RegionCreate(NullBox, 1); - RegionCopy(pClip, pGC->pCompositeClip); - RegionTranslate(pClip, -pDrawable->x, -pDrawable->y); - RegionIntersect(pSubImages, pSubImages, pClip); - - nBox = RegionNumRects(pSubImages); - pBox = RegionRects(pSubImages); - - while (nBox--) { - XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, img, - pBox->x1 - box.x1, - pBox->y1 - box.y1, - pBox->x1, - pBox->y1, pBox->x2 - pBox->x1, pBox->y2 - pBox->y1); - pBox++; - } - RegionDestroy(pClip); - RegionDestroy(pSubImages); - } - else { - XPutImage(dmxScreen->beDisplay, draw, pGCPriv->gc, - img, 0, 0, x, y, w, h); - } - XFree(img); /* Use XFree instead of XDestroyImage - * because pBits is passed in from the - * caller. */ - - dmxSync(dmxScreen, FALSE); - } - else { - /* Error -- this should not happen! */ - } -} - -/** Copy area from \a pSrc drawable to \a pDst drawable on the back-end - * server associated with \a pSrc drawable's screen. If the offscreen - * optimization is enabled, only copy when both \a pSrc and \a pDst are - * at least partially visible. */ -RegionPtr -dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int w, int h, int dstx, int dsty) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable srcDraw, dstDraw; - - if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst)) - return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, - dstx, dsty); - - DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw); - DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw); - - XCopyArea(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc, - srcx, srcy, w, h, dstx, dsty); - dmxSync(dmxScreen, FALSE); - - return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, w, h, dstx, dsty); -} - -/** Copy plane number \a bitPlane from \a pSrc drawable to \a pDst - * drawable on the back-end server associated with \a pSrc drawable's - * screen. If the offscreen optimization is enabled, only copy when - * both \a pSrc and \a pDst are at least partially visible. */ -RegionPtr -dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pSrc->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable srcDraw, dstDraw; - - if (DMX_GCOPS_OFFSCREEN(pSrc) || DMX_GCOPS_OFFSCREEN(pDst)) - return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height, - dstx, dsty); - - DMX_GCOPS_SET_DRAWABLE(pSrc, srcDraw); - DMX_GCOPS_SET_DRAWABLE(pDst, dstDraw); - - XCopyPlane(dmxScreen->beDisplay, srcDraw, dstDraw, pGCPriv->gc, - srcx, srcy, width, height, dstx, dsty, bitPlane); - dmxSync(dmxScreen, FALSE); - - return miHandleExposures(pSrc, pDst, pGC, srcx, srcy, width, height, - dstx, dsty); -} - -/** Render list of points, \a pptInit in \a pDrawable on the back-end - * server associated with \a pDrawable's screen. If the offscreen - * optimization is enabled, only draw when \a pDrawable is at least - * partially visible. */ -void -dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawPoints(dmxScreen->beDisplay, draw, pGCPriv->gc, - (XPoint *) pptInit, npt, mode); - dmxSync(dmxScreen, FALSE); -} - -/** Render list of connected lines, \a pptInit in \a pDrawable on the - * back-end server associated with \a pDrawable's screen. If the - * offscreen optimization is enabled, only draw when \a pDrawable is at - * least partially visible. */ -void -dmxPolylines(DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawLines(dmxScreen->beDisplay, draw, pGCPriv->gc, - (XPoint *) pptInit, npt, mode); - dmxSync(dmxScreen, FALSE); -} - -/** Render list of disjoint segments, \a pSegs in \a pDrawable on the - * back-end server associated with \a pDrawable's screen. If the - * offscreen optimization is enabled, only draw when \a pDrawable is at - * least partially visible. */ -void -dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawSegments(dmxScreen->beDisplay, draw, pGCPriv->gc, - (XSegment *) pSegs, nseg); - dmxSync(dmxScreen, FALSE); -} - -/** Render list of rectangle outlines, \a pRects in \a pDrawable on the - * back-end server associated with \a pDrawable's screen. If the - * offscreen optimization is enabled, only draw when \a pDrawable is at - * least partially visible. */ -void -dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, - int nrects, xRectangle *pRects) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc, - (XRectangle *) pRects, nrects); - - dmxSync(dmxScreen, FALSE); -} - -/** Render list of arc outlines, \a parcs in \a pDrawable on the - * back-end server associated with \a pDrawable's screen. If the - * offscreen optimization is enabled, only draw when \a pDrawable is at - * least partially visible. */ -void -dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs); - dmxSync(dmxScreen, FALSE); -} - -/** Render a filled polygons in \a pDrawable on the back-end server - * associated with \a pDrawable's screen. If the offscreen - * optimization is enabled, only draw when \a pDrawable is at least - * partially visible. */ -void -dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, DDXPointPtr pPts) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XFillPolygon(dmxScreen->beDisplay, draw, pGCPriv->gc, - (XPoint *) pPts, count, shape, mode); - dmxSync(dmxScreen, FALSE); -} - -/** Render list of filled rectangles, \a prectInit in \a pDrawable on - * the back-end server associated with \a pDrawable's screen. If the - * offscreen optimization is enabled, only draw when \a pDrawable is at - * least partially visible. */ -void -dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XFillRectangles(dmxScreen->beDisplay, draw, pGCPriv->gc, - (XRectangle *) prectInit, nrectFill); - dmxSync(dmxScreen, FALSE); -} - -/** Render list of filled arcs, \a parcs in \a pDrawable on the back-end - * server associated with \a pDrawable's screen. If the offscreen - * optimization is enabled, only draw when \a pDrawable is at least - * partially visible. */ -void -dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XFillArcs(dmxScreen->beDisplay, draw, pGCPriv->gc, (XArc *) parcs, narcs); - dmxSync(dmxScreen, FALSE); -} - -/** Render string of 8-bit \a chars (foreground only) in \a pDrawable on - * the back-end server associated with \a pDrawable's screen. If the - * offscreen optimization is enabled, only draw when \a pDrawable is at - * least partially visible. */ -int -dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, char *chars) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; - Drawable draw; - - GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars, - Linear8Bit, &n, charinfo); - - /* Calculate text width */ - w = 0; - for (i = 0; i < n; i++) - w += charinfo[i]->metrics.characterWidth; - - if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) { - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawString(dmxScreen->beDisplay, draw, pGCPriv->gc, - x, y, chars, count); - dmxSync(dmxScreen, FALSE); - } - - return x + w; -} - -/** Render string of 16-bit \a chars (foreground only) in \a pDrawable - * on the back-end server associated with \a pDrawable's screen. If - * the offscreen optimization is enabled, only draw when \a pDrawable - * is at least partially visible. */ -int -dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - unsigned long n, i; - int w; - CharInfoPtr charinfo[255]; - Drawable draw; - - GetGlyphs(pGC->font, (unsigned long) count, (unsigned char *) chars, - (FONTLASTROW(pGC->font) == 0) ? Linear16Bit : TwoD16Bit, - &n, charinfo); - - /* Calculate text width */ - w = 0; - for (i = 0; i < n; i++) - w += charinfo[i]->metrics.characterWidth; - - if (n != 0 && !DMX_GCOPS_OFFSCREEN(pDrawable)) { - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawString16(dmxScreen->beDisplay, draw, pGCPriv->gc, - x, y, (XChar2b *) chars, count); - dmxSync(dmxScreen, FALSE); - } - - return x + w; -} - -/** Render string of 8-bit \a chars (both foreground and background) in - * \a pDrawable on the back-end server associated with \a pDrawable's - * screen. If the offscreen optimization is enabled, only draw when \a - * pDrawable is at least partially visible. */ -void -dmxImageText8(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, char *chars) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawImageString(dmxScreen->beDisplay, draw, pGCPriv->gc, - x, y, chars, count); - dmxSync(dmxScreen, FALSE); -} - -/** Render string of 16-bit \a chars (both foreground and background) in - * \a pDrawable on the back-end server associated with \a pDrawable's - * screen. If the offscreen optimization is enabled, only draw when \a - * pDrawable is at least partially visible. */ -void -dmxImageText16(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, unsigned short *chars) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(pGC); - Drawable draw; - - if (DMX_GCOPS_OFFSCREEN(pDrawable)) - return; - - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - - XDrawImageString16(dmxScreen->beDisplay, draw, pGCPriv->gc, - x, y, (XChar2b *) chars, count); - dmxSync(dmxScreen, FALSE); -} - -/** Image Glyph Blt -- this function should never be called. */ -void -dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, void *pglyphBase) -{ - /* Error -- this should never happen! */ -} - -/** Poly Glyph Blt -- this function should never be called. */ -void -dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, void *pglyphBase) -{ - /* Error -- this should never happen! */ -} - -/** Push Pixels -- this function should never be called. */ -void -dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, - int w, int h, int x, int y) -{ - /* Error -- this should never happen! */ -} - -/********************************************************************** - * Miscellaneous drawing commands - */ - -/** When Xinerama is active, the client pixmaps are always obtained from - * screen 0. When screen 0 is detached, the pixmaps must be obtained - * from any other screen that is not detached. Usually, this is screen - * 1. */ -static DMXScreenInfo * -dmxFindAlternatePixmap(DrawablePtr pDrawable, XID *draw) -{ -#ifdef PANORAMIX - PanoramiXRes *pXinPix; - int i; - DMXScreenInfo *dmxScreen; - - if (noPanoramiXExtension) - return NULL; - if (pDrawable->type != DRAWABLE_PIXMAP) - return NULL; - - if (Success != dixLookupResourceByType((void **) &pXinPix, - pDrawable->id, XRT_PIXMAP, - NullClient, DixUnknownAccess)) - return NULL; - - FOR_NSCREENS_FORWARD_SKIP(i) { - dmxScreen = &dmxScreens[i]; - if (dmxScreen->beDisplay) { - PixmapPtr pSrc; - dmxPixPrivPtr pSrcPriv; - - dixLookupResourceByType((void **) &pSrc, pXinPix->info[i].id, - RT_PIXMAP, NullClient, DixUnknownAccess); - pSrcPriv = DMX_GET_PIXMAP_PRIV(pSrc); - if (pSrcPriv->pixmap) { - *draw = pSrcPriv->pixmap; - return dmxScreen; - } - } - } -#endif - return NULL; -} - -/** Get an image from the back-end server associated with \a pDrawable's - * screen. If \a pDrawable is a window, it must be viewable to get an - * image from it. If it is not viewable, then get the image from the - * first ancestor of \a pDrawable that is viewable. If no viewable - * ancestor is found, then simply return without getting an image. */ -void -dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planeMask, char *pdstLine) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pDrawable->pScreen->myNum]; - XImage *img; - Drawable draw; - - /* Cannot get image from unviewable window */ - if (pDrawable->type == DRAWABLE_WINDOW) { - WindowPtr pWindow = (WindowPtr) pDrawable; - - if (!pWindow->viewable) { - while (!pWindow->viewable && pWindow->parent) { - sx += pWindow->origin.x - wBorderWidth(pWindow); - sx += pWindow->origin.y - wBorderWidth(pWindow); - pWindow = pWindow->parent; - } - if (!pWindow->viewable) { - return; - } - } - DMX_GCOPS_SET_DRAWABLE(&pWindow->drawable, draw); - if (DMX_GCOPS_OFFSCREEN(&pWindow->drawable)) - return; - } - else { - DMX_GCOPS_SET_DRAWABLE(pDrawable, draw); - if (DMX_GCOPS_OFFSCREEN(pDrawable)) { - /* Try to find the pixmap on a non-detached Xinerama screen */ - dmxScreen = dmxFindAlternatePixmap(pDrawable, &draw); - if (!dmxScreen) - return; - } - } - - img = XGetImage(dmxScreen->beDisplay, draw, - sx, sy, w, h, planeMask, format); - if (img) { - int len = img->bytes_per_line * img->height; - - memmove(pdstLine, img->data, len); - XDestroyImage(img); - } - - dmxSync(dmxScreen, FALSE); -} - -/** Get Spans -- this function should never be called. */ -void -dmxGetSpans(DrawablePtr pDrawable, int wMax, - DDXPointPtr ppt, int *pwidth, int nspans, char *pdstStart) -{ - /* Error -- this should never happen! */ -} diff --git a/hw/dmx/dmxgcops.h b/hw/dmx/dmxgcops.h deleted file mode 100644 index 529b6ffc6..000000000 --- a/hw/dmx/dmxgcops.h +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright 2001,2002 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> - * - */ - -/** \file - * Interface for gcops support. \see dmxgcops.c */ - -#ifndef DMXGCOPS_H -#define DMXGCOPS_H - -extern void dmxFillSpans(DrawablePtr pDrawable, GCPtr pGC, - int nInit, DDXPointPtr pptInit, int *pwidthInit, - int fSorted); -extern void dmxSetSpans(DrawablePtr pDrawable, GCPtr pGC, - char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, - int fSorted); -extern void dmxPutImage(DrawablePtr pDrawable, GCPtr pGC, - int depth, int x, int y, int w, int h, - int leftPad, int format, char *pBits); -extern RegionPtr dmxCopyArea(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int w, int h, - int dstx, int dsty); -extern RegionPtr dmxCopyPlane(DrawablePtr pSrc, DrawablePtr pDst, GCPtr pGC, - int srcx, int srcy, int width, int height, - int dstx, int dsty, unsigned long bitPlane); -extern void dmxPolyPoint(DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit); -extern void dmxPolylines(DrawablePtr pDrawable, GCPtr pGC, - int mode, int npt, DDXPointPtr pptInit); -extern void dmxPolySegment(DrawablePtr pDrawable, GCPtr pGC, - int nseg, xSegment * pSegs); -extern void dmxPolyRectangle(DrawablePtr pDrawable, GCPtr pGC, - int nrects, xRectangle *pRects); -extern void dmxPolyArc(DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc * parcs); -extern void dmxFillPolygon(DrawablePtr pDrawable, GCPtr pGC, - int shape, int mode, int count, DDXPointPtr pPts); -extern void dmxPolyFillRect(DrawablePtr pDrawable, GCPtr pGC, - int nrectFill, xRectangle *prectInit); -extern void dmxPolyFillArc(DrawablePtr pDrawable, GCPtr pGC, - int narcs, xArc * parcs); -extern int dmxPolyText8(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, char *chars); -extern int dmxPolyText16(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, unsigned short *chars); -extern void dmxImageText8(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, char *chars); -extern void dmxImageText16(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, int count, unsigned short *chars); -extern void dmxImageGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, void *pglyphBase); -extern void dmxPolyGlyphBlt(DrawablePtr pDrawable, GCPtr pGC, - int x, int y, unsigned int nglyph, - CharInfoPtr * ppci, void *pglyphBase); -extern void dmxPushPixels(GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, - int w, int h, int x, int y); - -extern void dmxGetImage(DrawablePtr pDrawable, int sx, int sy, int w, int h, - unsigned int format, unsigned long planeMask, - char *pdstLine); -extern void dmxGetSpans(DrawablePtr pDrawable, int wMax, - DDXPointPtr ppt, int *pwidth, int nspans, - char *pdstStart); - -#endif /* DMXGCOPS_H */ diff --git a/hw/dmx/dmxinit.c b/hw/dmx/dmxinit.c deleted file mode 100644 index e0bb3b704..000000000 --- a/hw/dmx/dmxinit.c +++ /dev/null @@ -1,1050 +0,0 @@ -/* - * 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. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#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" - -#include <X11/Xos.h> /* For gettimeofday */ -#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */ -#include "dixstruct.h" -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -#include <signal.h> /* For SIGQUIT */ - -#ifdef GLXEXT -#include <GL/glx.h> -#include <GL/glxint.h> -#include "dmx_glxvisuals.h" -#include "glx_extinit.h" -#include <X11/extensions/Xext.h> -#include <X11/extensions/extutil.h> -#endif /* GLXEXT */ - -#include <X11/extensions/dmxproto.h> - -/* Global variables available to all Xserver/hw/dmx routines. */ -int dmxNumScreens; -DMXScreenInfo *dmxScreens; - -int dmxNumInputs; -DMXInputInfo *dmxInputs; - -XErrorEvent dmxLastErrorEvent; -Bool dmxErrorOccurred = FALSE; - -char *dmxFontPath = NULL; - -Bool dmxOffScreenOpt = TRUE; - -Bool dmxSubdividePrimitives = TRUE; - -Bool dmxLazyWindowCreation = TRUE; - -Bool dmxUseXKB = TRUE; - -int dmxDepth = 0; - -#ifndef GLXEXT -static Bool dmxGLXProxy = FALSE; -#else -Bool dmxGLXProxy = TRUE; - -Bool dmxGLXSwapGroupSupport = TRUE; - -Bool dmxGLXSyncSwap = FALSE; - -Bool dmxGLXFinishSwap = FALSE; -#endif - -Bool dmxIgnoreBadFontPaths = FALSE; - -Bool dmxAddRemoveScreens = FALSE; - -/* 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 */ -static int -dmxErrorHandler(Display * dpy, XErrorEvent * ev) -{ -#define DMX_ERROR_BUF_SIZE 256 - /* RATS: these buffers are only used in - * length-limited calls. */ - char buf[DMX_ERROR_BUF_SIZE]; - char request[DMX_ERROR_BUF_SIZE]; - _XExtension *ext = NULL; - - dmxErrorOccurred = TRUE; - dmxLastErrorEvent = *ev; - - XGetErrorText(dpy, ev->error_code, buf, sizeof(buf)); - dmxLog(dmxWarning, "dmxErrorHandler: %s\n", buf); - - /* Find major opcode name */ - if (ev->request_code < 128) { - snprintf(request, sizeof(request), "%d", ev->request_code); - XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); - } - else { - for (ext = dpy->ext_procs; - ext && ext->codes.major_opcode != ev->request_code; - ext = ext->next); - if (ext) - strlcpy(buf, ext->name, sizeof(buf)); - else - buf[0] = '\0'; - } - dmxLog(dmxWarning, " Major opcode: %d (%s)\n", - ev->request_code, buf); - - /* Find minor opcode name */ - if (ev->request_code >= 128 && ext) { - snprintf(request, sizeof(request), "%d", ev->request_code); - snprintf(request, sizeof(request), "%s.%d", ext->name, ev->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", request, "", buf, sizeof(buf)); - dmxLog(dmxWarning, " Minor opcode: %d (%s)\n", - ev->minor_code, buf); - } - - /* Provide value information */ - switch (ev->error_code) { - case BadValue: - dmxLog(dmxWarning, " Value: 0x%x\n", - (unsigned int) ev->resourceid); - break; - case BadAtom: - dmxLog(dmxWarning, " AtomID: 0x%x\n", - (unsigned int) ev->resourceid); - break; - default: - dmxLog(dmxWarning, " ResourceID: 0x%x\n", - (unsigned int) ev->resourceid); - break; - } - - /* Provide serial number information */ - dmxLog(dmxWarning, " Failed serial number: %d\n", - (unsigned int) ev->serial); - dmxLog(dmxWarning, " Current serial number: %d\n", - (unsigned int) dpy->request); - return 0; -} - -#ifdef GLXEXT -static int -dmxNOPErrorHandler(Display * dpy, XErrorEvent * ev) -{ - return 0; -} -#endif - -Bool -dmxOpenDisplay(DMXScreenInfo * dmxScreen) -{ - if (!(dmxScreen->beDisplay = XOpenDisplay(dmxScreen->name))) - return FALSE; - - dmxPropertyDisplay(dmxScreen); - return TRUE; -} - -void -dmxSetErrorHandler(DMXScreenInfo * dmxScreen) -{ - XSetErrorHandler(dmxErrorHandler); -} - -static void -dmxPrintScreenInfo(DMXScreenInfo * dmxScreen) -{ - XWindowAttributes attribs; - int ndepths = 0, *depths = NULL; - int i; - Display *dpy = dmxScreen->beDisplay; - Screen *s = DefaultScreenOfDisplay(dpy); - int scr = DefaultScreen(dpy); - - XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); - if (!(depths = XListDepths(dpy, scr, &ndepths))) - ndepths = 0; - - 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)); - } - else { - /* This code based on xdpyinfo.c */ - int v = VendorRelease(dpy); - 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; - if (v % 10) - subpatch = v % 10; - } - } - else if (v < 40000000) { - major = v / 1000; - minor = (v / 10) % 10; - if (v % 10) - patch = v % 10; - } - else { - major = v / 10000000; - minor = (v / 100000) % 100; - patch = (v / 1000) % 100; - if (v % 1000) - subpatch = v % 1000; - } - dmxLogOutput(dmxScreen, "Vendor release: %d (XFree86 version: %d.%d", - v, major, minor); - if (patch > 0) - dmxLogOutputCont(dmxScreen, ".%d", patch); - if (subpatch > 0) - dmxLogOutputCont(dmxScreen, ".%d", subpatch); - dmxLogOutputCont(dmxScreen, ")\n"); - } - - dmxLogOutput(dmxScreen, "Dimensions: %dx%d pixels\n", - 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", - (DoesBackingStore(s) == NotUseful) ? "no" : - ((DoesBackingStore(s) == Always) ? "yes" : "when mapped"), - DoesSaveUnders(s) ? "yes" : "no"); - dmxLogOutput(dmxScreen, "Window Manager running: %s\n", - (dmxScreen->WMRunningOnBE) ? "yes" : "no"); - - if (dmxScreen->WMRunningOnBE) { - dmxLogOutputWarning(dmxScreen, - "Window manager running " - "-- colormaps not supported\n"); - } - XFree(depths); -} - -void -dmxGetScreenAttribs(DMXScreenInfo * dmxScreen) -{ - XWindowAttributes attribs; - Display *dpy = dmxScreen->beDisplay; - -#ifdef GLXEXT - int dummy; -#endif - - XGetWindowAttributes(dpy, DefaultRootWindow(dpy), &attribs); - - dmxScreen->beWidth = attribs.width; - dmxScreen->beHeight = attribs.height; - - /* Fill in missing geometry information */ - if (dmxScreen->scrnXSign < 0) { - if (dmxScreen->scrnWidth) { - dmxScreen->scrnX = (attribs.width - dmxScreen->scrnWidth - - dmxScreen->scrnX); - } - else { - dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX; - dmxScreen->scrnX = 0; - } - } - if (dmxScreen->scrnYSign < 0) { - if (dmxScreen->scrnHeight) { - dmxScreen->scrnY = (attribs.height - dmxScreen->scrnHeight - - dmxScreen->scrnY); - } - else { - dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY; - dmxScreen->scrnY = 0; - } - } - if (!dmxScreen->scrnWidth) - dmxScreen->scrnWidth = attribs.width - dmxScreen->scrnX; - if (!dmxScreen->scrnHeight) - dmxScreen->scrnHeight = attribs.height - dmxScreen->scrnY; - - if (!dmxScreen->rootWidth) - dmxScreen->rootWidth = dmxScreen->scrnWidth; - if (!dmxScreen->rootHeight) - dmxScreen->rootHeight = dmxScreen->scrnHeight; - 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; - - 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; - -#ifdef GLXEXT - /* get the majorOpcode for the back-end GLX extension */ - XQueryExtension(dpy, "GLX", &dmxScreen->glxMajorOpcode, - &dummy, &dmxScreen->glxErrorBase); -#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"); -} - -Bool -dmxGetVisualInfo(DMXScreenInfo * dmxScreen) -{ - int i; - XVisualInfo visinfo; - - visinfo.screen = DefaultScreen(dmxScreen->beDisplay); - dmxScreen->beVisuals = XGetVisualInfo(dmxScreen->beDisplay, - VisualScreenMask, - &visinfo, &dmxScreen->beNumVisuals); - - dmxScreen->beDefVisualIndex = -1; - - if (defaultColorVisualClass >= 0 || dmxDepth > 0) { - 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; - } - } - - for (i = 0; i < dmxScreen->beNumVisuals; i++) - dmxLogVisual(dmxScreen, &dmxScreen->beVisuals[i], - (i == dmxScreen->beDefVisualIndex)); - - return dmxScreen->beDefVisualIndex >= 0; -} - -void -dmxGetColormaps(DMXScreenInfo * dmxScreen) -{ - int i; - - dmxScreen->beNumDefColormaps = dmxScreen->beNumVisuals; - dmxScreen->beDefColormaps = xallocarray(dmxScreen->beNumDefColormaps, - sizeof(*dmxScreen->beDefColormaps)); - - for (i = 0; i < dmxScreen->beNumDefColormaps; i++) - dmxScreen->beDefColormaps[i] = - XCreateColormap(dmxScreen->beDisplay, - DefaultRootWindow(dmxScreen->beDisplay), - dmxScreen->beVisuals[i].visual, AllocNone); - - dmxScreen->beBlackPixel = BlackPixel(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay)); - dmxScreen->beWhitePixel = WhitePixel(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay)); -} - -void -dmxGetPixmapFormats(DMXScreenInfo * dmxScreen) -{ - dmxScreen->beDepths = - XListDepths(dmxScreen->beDisplay, DefaultScreen(dmxScreen->beDisplay), - &dmxScreen->beNumDepths); - - dmxScreen->bePixmapFormats = - XListPixmapFormats(dmxScreen->beDisplay, - &dmxScreen->beNumPixmapFormats); -} - -static Bool -dmxSetPixmapFormats(ScreenInfo * pScreenInfo, DMXScreenInfo * dmxScreen) -{ - XPixmapFormatValues *bePixmapFormat; - PixmapFormatRec *format; - int i, j; - - 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++) { - 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; - } - } - - return TRUE; -} - -void -dmxCheckForWM(DMXScreenInfo * dmxScreen) -{ - Status status; - XWindowAttributes xwa; - - status = XGetWindowAttributes(dmxScreen->beDisplay, - DefaultRootWindow(dmxScreen->beDisplay), - &xwa); - dmxScreen->WMRunningOnBE = - (status && - ((xwa.all_event_masks & SubstructureRedirectMask) || - (xwa.all_event_masks & SubstructureNotifyMask))); -} - -/** Initialize the display and collect relevant information about the - * display properties */ -static void -dmxDisplayInit(DMXScreenInfo * dmxScreen) -{ - if (!dmxOpenDisplay(dmxScreen)) - dmxLog(dmxFatal, - "dmxOpenDisplay: Unable to open display %s\n", dmxScreen->name); - - dmxSetErrorHandler(dmxScreen); - dmxCheckForWM(dmxScreen); - dmxGetScreenAttribs(dmxScreen); - - if (!dmxGetVisualInfo(dmxScreen)) - dmxLog(dmxFatal, "dmxGetVisualInfo: No matching visuals found\n"); - - dmxGetColormaps(dmxScreen); - dmxGetPixmapFormats(dmxScreen); -} - -static void dmxAddExtensions(void) -{ - const ExtensionModule dmxExtensions[] = { - { DMXExtensionInit, DMX_EXTENSION_NAME, NULL }, - }; - - LoadExtensionList(dmxExtensions, ARRAY_SIZE(dmxExtensions), TRUE); -} - -/** This routine is called in Xserver/dix/main.c from \a main(). */ -void -InitOutput(ScreenInfo * pScreenInfo, int argc, char *argv[]) -{ - int i; - static unsigned long dmxGeneration = 0; - - if (dmxGeneration != serverGeneration) { - int vendrel = VENDOR_RELEASE; - int major, minor, year, month, day; - - dmxGeneration = serverGeneration; - - 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; - - /* Add other epoch tests here */ - if (major > 0 && minor > 0) - year += 2000; - - dmxLog(dmxInfo, "Generation: %lu\n", dmxGeneration); - dmxLog(dmxInfo, "DMX version: %d.%d.%02d%02d%02d\n", - major, minor, year, month, day); - - SetVendorRelease(VENDOR_RELEASE); - - 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; - } - for (i = 0; i < dmxNumInputs; i++) - dmxInputFree(&dmxInputs[i]); - free(dmxScreens); - free(dmxInputs); - dmxScreens = NULL; - dmxInputs = NULL; - dmxNumScreens = 0; - dmxNumInputs = 0; - } - - /* Make sure that the command-line arguments are sane. */ - if (dmxAddRemoveScreens && dmxGLXProxy) { - /* 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. */ - dmxLog(dmxWarning, - "GLX Proxy and Render extensions do not yet support dynamic\n"); - dmxLog(dmxWarning, - "screen addition and removal. Please specify -noglxproxy\n"); - dmxLog(dmxWarning, - "and -norender on the command line or in the configuration\n"); - dmxLog(dmxWarning, - "file to disable these two extensions if you wish to use\n"); - dmxLog(dmxWarning, - "the dynamic addition and removal of screens support.\n"); - dmxLog(dmxFatal, - "Dynamic screen addition/removal error (see above).\n"); - } - - /* 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"); - - /* Disable lazy window creation optimization if offscreen - * optimization is disabled */ - if (!dmxOffScreenOpt && dmxLazyWindowCreation) { - dmxLog(dmxInfo, - "InitOutput: Disabling lazy window creation optimization\n"); - dmxLog(dmxInfo, - " since it requires the offscreen optimization\n"); - dmxLog(dmxInfo, " to function properly.\n"); - dmxLazyWindowCreation = FALSE; - } - - /* Open each display and gather information about it. */ - for (i = 0; i < dmxNumScreens; i++) - dmxDisplayInit(&dmxScreens[i]); - -#ifdef PANORAMIX - /* 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); -#endif - - /* Since we only have a single screen thus far, we only need to set - the pixmap formats to match that screen. FIXME: this isn't true. */ - if (!dmxSetPixmapFormats(pScreenInfo, &dmxScreens[0])) - return; - - /* 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++) - noGlxExtension |= (dmxScreens[i].glxMajorOpcode == 0); -#endif - - if (serverGeneration == 1) - dmxAddExtensions(); - - /* Tell dix layer about the backend displays */ - for (i = 0; i < dmxNumScreens; i++) { - -#ifdef GLXEXT - if (!noGlxExtension) { - /* - * 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 *); - - /* 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 = xallocarray(nconfigs, sizeof(dmxGlxVisualPrivate *)); - - if (configs != NULL && configprivs != NULL) { - int j; - - /* Initialize our private info for each visual - * (currently only x_visual_depth and x_visual_class) - */ - for (j = 0; j < nconfigs; j++) { - - configprivs[j] = (dmxGlxVisualPrivate *) - malloc(sizeof(dmxGlxVisualPrivate)); - configprivs[j]->x_visual_depth = 0; - configprivs[j]->x_visual_class = 0; - - /* Find the visual depth */ - if (configs[j].vid > 0) { - int k; - - for (k = 0; k < dmxScreen->beNumVisuals; k++) { - if (dmxScreen->beVisuals[k].visualid == - configs[j].vid) { - configprivs[j]->x_visual_depth = - dmxScreen->beVisuals[k].depth; - configprivs[j]->x_visual_class = - dmxScreen->beVisuals[k].class; - break; - } - } - } - } - - XFlush(dmxScreen->beDisplay); - } - } -#endif /* GLXEXT */ - - AddScreen(dmxScreenInit, argc, argv); - } - - /* 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 */ - if (!noRenderExtension) - dmxInitRender(); - - /* 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 - strcpy. */ -static void -dmxSetDefaultFontPath(const char *fp) -{ - if (dmxFontPath) { - 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); - } - - defaultFontPath = dmxFontPath; -} - -/** 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), and from AbortServer on - * abnormal exit. */ -void -ddxGiveUp(enum ExitCode error) -{ - int i; - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->beDisplay) - XCloseDisplay(dmxScreen->beDisplay); - dmxScreen->beDisplay = NULL; - } -} - -#ifdef DDXBEFORERESET -void -ddxBeforeReset(void) -{ -} -#endif - -#if INPUTTHREAD -/** This function is called in Xserver/os/inputthread.c when starting - the input thread. */ -void -ddxInputThreadInit(void) -{ -} -#endif - -/** This function is called in Xserver/os/osinit.c from \a OsInit(). */ -void -OsVendorInit(void) -{ -} - -/** 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().) */ -void -OsVendorFatalError(const char *f, va_list args) -{ -} - -/** Process our command line arguments. */ -int -ddxProcessArgument(int argc, char *argv[], int i) -{ - int retval = 0; - - if (!strcmp(argv[i], "-display")) { - if (++i < argc) - dmxConfigStoreDisplay(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-inputfrom") || !strcmp(argv[i], "-input")) { - if (++i < argc) - dmxConfigStoreInput(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-xinputfrom") || !strcmp(argv[i], "-xinput")) { - if (++i < argc) - dmxConfigStoreXInput(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-noshadowfb")) { - retval = 1; - } - else if (!strcmp(argv[i], "-nomulticursor")) { - dmxCursorNoMulti(); - retval = 1; - } - else if (!strcmp(argv[i], "-shadowfb")) { - retval = 1; - } - else if (!strcmp(argv[i], "-configfile")) { - if (++i < argc) - dmxConfigStoreFile(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-config")) { - if (++i < argc) - dmxConfigStoreConfig(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-fontpath")) { - if (++i < argc) - dmxSetDefaultFontPath(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-stat")) { - if ((i += 2) < argc) - dmxStatActivate(argv[i - 1], argv[i]); - retval = 3; - } - else if (!strcmp(argv[i], "-syncbatch")) { - if (++i < argc) - dmxSyncActivate(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-nooffscreenopt")) { - dmxOffScreenOpt = FALSE; - retval = 1; - } - else if (!strcmp(argv[i], "-nosubdivprims")) { - dmxSubdividePrimitives = FALSE; - retval = 1; - } - else if (!strcmp(argv[i], "-nowindowopt")) { - dmxLazyWindowCreation = FALSE; - retval = 1; - } - else if (!strcmp(argv[i], "-noxkb")) { - dmxUseXKB = FALSE; - retval = 1; - } - else if (!strcmp(argv[i], "-depth")) { - if (++i < argc) - dmxDepth = atoi(argv[i]); - retval = 2; - } - else if (!strcmp(argv[i], "-norender")) { - noRenderExtension = TRUE; - retval = 1; -#ifdef GLXEXT - } - else if (!strcmp(argv[i], "-noglxproxy")) { - dmxGLXProxy = FALSE; - retval = 1; - } - else if (!strcmp(argv[i], "-noglxswapgroup")) { - dmxGLXSwapGroupSupport = FALSE; - retval = 1; - } - else if (!strcmp(argv[i], "-glxsyncswap")) { - dmxGLXSyncSwap = TRUE; - retval = 1; - } - else if (!strcmp(argv[i], "-glxfinishswap")) { - dmxGLXFinishSwap = TRUE; - retval = 1; -#endif - } - else if (!strcmp(argv[i], "-ignorebadfontpaths")) { - dmxIgnoreBadFontPaths = TRUE; - retval = 1; - } - else if (!strcmp(argv[i], "-addremovescreens")) { - dmxAddRemoveScreens = TRUE; - retval = 1; - } - else if (!strcmp(argv[i], "-param")) { - if ((i += 2) < argc) { - if (!strcasecmp(argv[i - 1], "xkbrules")) - dmxConfigSetXkbRules(argv[i]); - else if (!strcasecmp(argv[i - 1], "xkbmodel")) - dmxConfigSetXkbModel(argv[i]); - else if (!strcasecmp(argv[i - 1], "xkblayout")) - dmxConfigSetXkbLayout(argv[i]); - else if (!strcasecmp(argv[i - 1], "xkbvariant")) - dmxConfigSetXkbVariant(argv[i]); - else if (!strcasecmp(argv[i - 1], "xkboptions")) - dmxConfigSetXkbOptions(argv[i]); - else - dmxLog(dmxWarning, - "-param requires: XkbRules, XkbModel, XkbLayout," - " XkbVariant, or XkbOptions\n"); - } - retval = 3; - } - if (!serverGeneration) - dmxConfigSetMaxScreens(); - return retval; -} - -/** Provide succinct usage information for the DMX server. */ -void -ddxUseMsg(void) -{ - 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 - ErrorF - ("-ignorebadfontpaths Ignore bad font paths during initialization\n"); - 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"); - - 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"); - - 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"); - - 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"); -} diff --git a/hw/dmx/dmxinit.h b/hw/dmx/dmxinit.h deleted file mode 100644 index ce4e2ff4b..000000000 --- a/hw/dmx/dmxinit.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright 2004 Red Hat Inc., Raleigh, 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> - * - */ - -/** \file - * Interface for initialization. \see dmxinit.c */ - -#ifndef DMXINIT_H -#define DMXINIT_H - -#include "scrnintstr.h" - -extern Bool dmxOpenDisplay(DMXScreenInfo * dmxScreen); -extern void dmxSetErrorHandler(DMXScreenInfo * dmxScreen); -extern void dmxCheckForWM(DMXScreenInfo * dmxScreen); -extern void dmxGetScreenAttribs(DMXScreenInfo * dmxScreen); -extern Bool dmxGetVisualInfo(DMXScreenInfo * dmxScreen); -extern void dmxGetColormaps(DMXScreenInfo * dmxScreen); -extern void dmxGetPixmapFormats(DMXScreenInfo * dmxScreen); - -#endif /* DMXINIT_H */ diff --git a/hw/dmx/dmxinput.c b/hw/dmx/dmxinput.c deleted file mode 100644 index c099cf18d..000000000 --- a/hw/dmx/dmxinput.c +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2001,2002 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide the main entry points for input initialization and processing - * that arequired by the dix layer. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxlog.h" -#include "dmxinput.h" - -#include "inputstr.h" -#include "input.h" -#include "mi.h" - -/** Called from dix/main.c on each server generation to initialize - * inputs. All the work is done in dmxInputInit. \see - * dmxInputInit() */ -void -InitInput(int argc, char **argv) -{ - int i; - DMXInputInfo *dmxInput; - - if (!dmxNumInputs) - dmxLog(dmxFatal, "InitInput: no inputs specified\n"); - - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) - dmxInputInit(dmxInput); - - mieqInit(); -} - -void -CloseInput(void) -{ - mieqFini(); -} - -/** Called from dix/dispatch.c in Dispatch() whenever input events - * require processing. All the work is done in the lower level - * routines. */ -void -ProcessInputEvents(void) -{ - int i; - DMXInputInfo *dmxInput; - - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) - if (!dmxInput->detached && dmxInput->processInputEvents) - dmxInput->processInputEvents(dmxInput); -} - -/** This routine is called from \a dmxwindow.c whenever the layout of - * windows on the display might have changed. This information is used - * by input drivers (currently only the console driver) that provide - * information about window layout to the user. */ -void -dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow) -{ - int i; - DMXInputInfo *dmxInput; - - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) - if (!dmxInput->detached && dmxInput->updateWindowInfo) - dmxInput->updateWindowInfo(dmxInput, type, pWindow); -} - -int -NewInputDeviceRequest(InputOption *options, InputAttributes * attrs, - DeviceIntPtr *pdev) -{ - return BadRequest; -} - -void -DeleteInputDeviceRequest(DeviceIntPtr pDev) -{ -} - -void -RemoveInputDeviceTraces(const char *config_info) -{ -} diff --git a/hw/dmx/dmxinput.h b/hw/dmx/dmxinput.h deleted file mode 100644 index 210fd7ad0..000000000 --- a/hw/dmx/dmxinput.h +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright 2001,2002 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file provides access to: - * - global variables available to all hw/dmx routines, and - * - enumerations and typedefs needed by input routines in hw/dmx (and - * hw/dmx/input). - * - * The goal is that no files in hw/dmx should include header files from - * hw/dmx/input -- the interface defined here should be the only - * interface exported to the hw/dmx layer. \see input/dmxinputinit.c. - */ - -#ifndef DMXINPUT_H -#define DMXINPUT_H - -struct _DMXInputInfo; - -/** Reason why window layout was updated. */ -typedef enum { - DMX_UPDATE_REALIZE, /**< Window realized */ - DMX_UPDATE_UNREALIZE, /**< Window unrealized */ - DMX_UPDATE_RESTACK, /**< Stacking order changed */ - DMX_UPDATE_COPY, /**< Window copied */ - DMX_UPDATE_RESIZE, /**< Window resized */ - DMX_UPDATE_REPARENT /**< Window reparented */ -} DMXUpdateType; - -typedef void (*ProcessInputEventsProc) (struct _DMXInputInfo *); -typedef void (*UpdateWindowInfoProc) (struct _DMXInputInfo *, - DMXUpdateType, WindowPtr); - -/** An opaque structure that is only exposed in the dmx/input layer. */ -typedef struct _DMXLocalInputInfo *DMXLocalInputInfoPtr; - -/** DMXInputInfo is typedef'd in \a dmx.h so that all routines can have - * access to the global pointers. However, the elements are only - * available to input-related routines. */ -struct _DMXInputInfo { - const char *name; /**< Name of input display or device - * (from command line or config - * file) */ - Bool freename; /**< If true, free name on destroy */ - Bool detached; /**< If true, input screen is detached */ - int inputIdx; /**< Index into #dmxInputs global */ - int scrnIdx; /**< Index into #dmxScreens global */ - Bool core; /**< If True, initialize these - * devices as devices that send core - * events */ - Bool console; /**< True if console and backend - * input share the same backend - * display */ - - Bool windows; /**< True if window outlines are - * draw in console */ - - ProcessInputEventsProc processInputEvents; - UpdateWindowInfoProc updateWindowInfo; - - /** True if a VT switch is pending, but has not yet happened. */ - int vt_switch_pending; - - /** True if a VT switch has happened. */ - int vt_switched; - - /** Number of devices handled in this _DMXInputInfo structure. */ - int numDevs; - - /** List of actual input devices. Each _DMXInputInfo structure can - * refer to more than one device. For example, the keyboard and the - * pointer of a backend display; or all of the XInput extension - * devices on a backend display. */ - DMXLocalInputInfoPtr *devs; - - char *keycodes; /**< XKB keycodes from command line */ - char *symbols; /**< XKB symbols from command line */ - char *geometry; /**< XKB geometry from command line */ -}; - -extern int dmxNumInputs; /**< Number of #dmxInputs */ -extern DMXInputInfo *dmxInputs; /**< List of inputs */ - -extern void dmxInputInit(DMXInputInfo * dmxInput); -extern void dmxInputReInit(DMXInputInfo * dmxInput); -extern void dmxInputLateReInit(DMXInputInfo * dmxInput); -extern void dmxInputFree(DMXInputInfo * dmxInput); -extern void dmxInputLogDevices(void); -extern void dmxUpdateWindowInfo(DMXUpdateType type, WindowPtr pWindow); - -/* These functions are defined in input/dmxeq.c */ -extern void dmxeqSwitchScreen(DeviceIntPtr pDev, ScreenPtr pScreen, - Bool fromDIX); - -/* This type is used in input/dmxevents.c. Also, these functions are - * defined in input/dmxevents.c */ -typedef enum { - DMX_NO_BLOCK = 0, - DMX_BLOCK = 1 -} DMXBlockType; - -extern void dmxGetGlobalPosition(int *x, int *y); -extern DMXScreenInfo *dmxFindFirstScreen(int x, int y); -extern void dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, - DMXBlockType block); - -/* Support for dynamic addition of inputs. This functions is defined in - * config/dmxconfig.c */ -extern DMXInputInfo *dmxConfigAddInput(const char *name, int core); -#endif /* DMXINPUT_H */ diff --git a/hw/dmx/dmxlog.c b/hw/dmx/dmxlog.c deleted file mode 100644 index a1915a189..000000000 --- a/hw/dmx/dmxlog.c +++ /dev/null @@ -1,446 +0,0 @@ -/* - * Copyright 2001 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file encapsulated all of the logging functions that are used by - * DMX for informational, warning, and error messages. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxlog.h" -#include "dmxinput.h" -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> - -static dmxLogLevel dmxCurrentLogLevel = dmxDebug; - -/** Set the default level for logging to #dmxLogLevel. Returns the - * previous log level. */ -dmxLogLevel -dmxSetLogLevel(dmxLogLevel newLevel) -{ - dmxLogLevel oldLevel = dmxCurrentLogLevel; - - if (newLevel > dmxFatal) - newLevel = dmxFatal; - dmxCurrentLogLevel = newLevel; - return oldLevel; -} - -/** Returns the log level set by #dmxLogLevel. */ -dmxLogLevel -dmxGetLogLevel(void) -{ - return dmxCurrentLogLevel; -} - -#ifdef DMX_LOG_STANDALONE -/* When using this file as part of a stand-alone (i.e., non-X-Server - * program, then the ultimate output routines have to be defined. */ - -/** Provide an ErrorF function when used stand-alone. */ -void -ErrorF(const char *format, ...) -{ - va_list args; - - va_start(args, format); - vfprintf(stderr, format, args); /* RATS: We assume the format string - * is trusted, since it is always - * from a log message in our code. */ - va_end(args); -} - -/** Provide an VFatalError function when used stand-alone. */ -static void -VFatalError(const char *format, va_list args) _X_ATTRIBUTE_PRINTF(1, 0) _X_NORETURN; -static void -VFatalError(const char *format, va_list args) -{ - vfprintf(stderr, format, args); /* RATS: We assume the format string - * is trusted, since it is always - * from a log message in our code. */ - exit(1); -} - -/** Provide an VErrorF function when used stand-alone. */ -void -VErrorF(const char *format, va_list args) -{ - vfprintf(stderr, format, args); /* RATS: We assume the format string - * is trusted, since it is always - * from a log message in our code. */ -} -#else -/** This function was removed between XFree86 4.3.0 and XFree86 4.4.0. */ -extern void AbortServer(void) _X_NORETURN; -static void -VFatalError(const char *format, va_list args) _X_ATTRIBUTE_PRINTF(1, 0) _X_NORETURN; -static void -VFatalError(const char *format, va_list args) -{ - VErrorF(format, args); - ErrorF("\n"); - AbortServer(); - /*NOTREACHED*/} -#endif - -/* Prints a consistent header for each line. */ -static void -dmxHeader(dmxLogLevel logLevel, DMXInputInfo * dmxInput, - DMXScreenInfo * dmxScreen) -{ - const char *type = "??"; - - switch (logLevel) { - case dmxDebug: - type = ".."; - break; - case dmxInfo: - type = "II"; - break; - case dmxWarning: - type = "**"; - break; - case dmxError: - type = "!!"; - break; - case dmxFatal: - type = "Fatal Error"; - break; - } - - if (dmxInput && dmxScreen) { - ErrorF("(%s) dmx[i%d/%s;o%d/%s]: ", type, - dmxInput->inputIdx, dmxInput->name, - dmxScreen->index, dmxScreen->name); - } - else if (dmxScreen) { - ErrorF("(%s) dmx[o%d/%s]: ", type, dmxScreen->index, dmxScreen->name); - } - else if (dmxInput) { - const char *pt = strchr(dmxInput->name, ','); - int len = (pt ? (size_t) (pt - dmxInput->name) - : strlen(dmxInput->name)); - - ErrorF("(%s) dmx[i%d/%*.*s]: ", type, - dmxInput->inputIdx, len, len, dmxInput->name); - } - else { - ErrorF("(%s) dmx: ", type); - } -} - -/* Prints the error message with the appropriate low-level X output - * routine. */ -static void -dmxMessage(dmxLogLevel logLevel, const char *format, va_list args) _X_ATTRIBUTE_PRINTF(2, 0); -static void -dmxMessage(dmxLogLevel logLevel, const char *format, va_list args) -{ - if (logLevel == dmxFatal || logLevel >= dmxCurrentLogLevel) { - if (logLevel == dmxFatal) - VFatalError(format, args); - else - VErrorF(format, args); - } -} - -/** Log the specified message at the specified \a logLevel. \a format - * can be a printf-like format expression. */ -void -dmxLog(dmxLogLevel logLevel, const char *format, ...) -{ - va_list args; - - dmxHeader(logLevel, NULL, NULL); - va_start(args, format); - dmxMessage(logLevel, format, args); - va_end(args); -} - -/** Continue a log message without printing the message prefix. */ -void -dmxLogCont(dmxLogLevel logLevel, const char *format, ...) -{ - va_list args; - - va_start(args, format); - dmxMessage(logLevel, format, args); - va_end(args); -} - -#ifndef DMX_LOG_STANDALONE -/** Log an informational message (at level #dmxInfo) related to output. - * The message prefix will contain backend information from \a - * dmxScreen. */ -void -dmxLogOutput(DMXScreenInfo * dmxScreen, const char *format, ...) -{ - va_list args; - - dmxHeader(dmxInfo, NULL, dmxScreen); - va_start(args, format); - dmxMessage(dmxInfo, format, args); - va_end(args); -} - -/** Continue a message related to output without printing the message - * prefix. */ -void -dmxLogOutputCont(DMXScreenInfo * dmxScreen, const char *format, ...) -{ - va_list args; - - va_start(args, format); - dmxMessage(dmxInfo, format, args); - va_end(args); -} - -/** Log a warning message (at level #dmxWarning) related to output. - * The message prefix will contain backend information from \a - * dmxScreen. */ -void -dmxLogOutputWarning(DMXScreenInfo * dmxScreen, const char *format, ...) -{ - va_list args; - - dmxHeader(dmxWarning, NULL, dmxScreen); - va_start(args, format); - dmxMessage(dmxWarning, format, args); - va_end(args); -} - -/** Log an informational message (at level #dmxInfo) related to input. - * The message prefix will contain information from \a dmxInput. */ -void -dmxLogInput(DMXInputInfo * dmxInput, const char *format, ...) -{ - va_list args; - - dmxHeader(dmxInfo, dmxInput, NULL); - va_start(args, format); - dmxMessage(dmxInfo, format, args); - va_end(args); -} - -/** Continue a message related to input without printing the message - * prefix. */ -void -dmxLogInputCont(DMXInputInfo * dmxInput, const char *format, ...) -{ - va_list args; - - va_start(args, format); - dmxMessage(dmxInfo, format, args); - va_end(args); -} - -/** Print \a argc messages, each describing an element in \a argv. This - * is maingly for debugging purposes. */ -void -dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv) -{ - int i; - - for (i = 0; i < argc; i++) - dmxLog(logLevel, " Arg[%d] = \"%s\"\n", i, argv[i]); -} - -/** Print messages at level #dmxInfo describing the visuals in \a vi. */ -void -dmxLogVisual(DMXScreenInfo * dmxScreen, XVisualInfo * vi, int defaultVisual) -{ - const char *class = "Unknown"; - - switch (vi->class) { - case StaticGray: - class = "StaticGray "; - break; - case GrayScale: - class = "GrayScale "; - break; - case StaticColor: - class = "StaticColor"; - break; - case PseudoColor: - class = "PseudoColor"; - break; - case TrueColor: - class = "TrueColor "; - break; - case DirectColor: - class = "DirectColor"; - break; - } -#define VisualLogFormat "0x%02lx %s %2db %db/rgb %3d 0x%04lx 0x%04lx 0x%04lx%s\n" - - if (dmxScreen) { - dmxLogOutput(dmxScreen, - VisualLogFormat, - vi->visualid, class, vi->depth, vi->bits_per_rgb, - vi->colormap_size, - vi->red_mask, vi->green_mask, vi->blue_mask, - defaultVisual ? " *" : ""); - } - else { - dmxLog(dmxInfo, - " " VisualLogFormat, - vi->visualid, class, vi->depth, vi->bits_per_rgb, - vi->colormap_size, - vi->red_mask, vi->green_mask, vi->blue_mask, - defaultVisual ? " *" : ""); - } -} - -/** Translate a (normalized) XInput event \a type into a human-readable - * string. */ -const char * -dmxXInputEventName(int type) -{ - switch (type) { - case XI_DeviceValuator: - return "XI_DeviceValuator"; - case XI_DeviceKeyPress: - return "XI_DeviceKeyPress"; - case XI_DeviceKeyRelease: - return "XI_DeviceKeyRelease"; - case XI_DeviceButtonPress: - return "XI_DeviceButtonPress"; - case XI_DeviceButtonRelease: - return "XI_DeviceButtonRelease"; - case XI_DeviceMotionNotify: - return "XI_DeviceMotionNotify"; - case XI_DeviceFocusIn: - return "XI_DeviceFocusIn"; - case XI_DeviceFocusOut: - return "XI_DeviceFocusOut"; - case XI_ProximityIn: - return "XI_ProximityIn"; - case XI_ProximityOut: - return "XI_ProximityOut"; - case XI_DeviceStateNotify: - return "XI_DeviceStateNotify"; - case XI_DeviceMappingNotify: - return "XI_DeviceMappingNotify"; - case XI_ChangeDeviceNotify: - return "XI_ChangeDeviceNotify"; - case XI_DeviceKeystateNotify: - return "XI_DeviceKeystateNotify"; - case XI_DeviceButtonstateNotify: - return "XI_DeviceButtonstateNotify"; - default: - return "unknown"; - } -} - -#endif - -/** Translate an event \a type into a human-readable string. */ -const char * -dmxEventName(int type) -{ - switch (type) { - case KeyPress: - return "KeyPress"; - case KeyRelease: - return "KeyRelease"; - case ButtonPress: - return "ButtonPress"; - case ButtonRelease: - return "ButtonRelease"; - case MotionNotify: - return "MotionNotify"; - case EnterNotify: - return "EnterNotify"; - case LeaveNotify: - return "LeaveNotify"; - case FocusIn: - return "FocusIn"; - case FocusOut: - return "FocusOut"; - case KeymapNotify: - return "KeymapNotify"; - case Expose: - return "Expose"; - case GraphicsExpose: - return "GraphicsExpose"; - case NoExpose: - return "NoExpose"; - case VisibilityNotify: - return "VisibilityNotify"; - case CreateNotify: - return "CreateNotify"; - case DestroyNotify: - return "DestroyNotify"; - case UnmapNotify: - return "UnmapNotify"; - case MapNotify: - return "MapNotify"; - case MapRequest: - return "MapRequest"; - case ReparentNotify: - return "ReparentNotify"; - case ConfigureNotify: - return "ConfigureNotify"; - case ConfigureRequest: - return "ConfigureRequest"; - case GravityNotify: - return "GravityNotify"; - case ResizeRequest: - return "ResizeRequest"; - case CirculateNotify: - return "CirculateNotify"; - case CirculateRequest: - return "CirculateRequest"; - case PropertyNotify: - return "PropertyNotify"; - case SelectionClear: - return "SelectionClear"; - case SelectionRequest: - return "SelectionRequest"; - case SelectionNotify: - return "SelectionNotify"; - case ColormapNotify: - return "ColormapNotify"; - case ClientMessage: - return "ClientMessage"; - case MappingNotify: - return "MappingNotify"; - default: - return "<unknown>"; - } -} diff --git a/hw/dmx/dmxlog.h b/hw/dmx/dmxlog.h deleted file mode 100644 index 162484b34..000000000 --- a/hw/dmx/dmxlog.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2001 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This header is included by all files that need to use the DMX logging - * facilities. */ - -#ifndef _DMXLOG_H_ -#define _DMXLOG_H_ - -/** Logging levels -- output is tunable with #dmxSetLogLevel. */ -typedef enum { - dmxDebug, /**< Usually verbose debugging info */ - dmxInfo, /**< Non-warning information */ - dmxWarning, /**< A warning that may indicate DMX - * will not function as the user - * intends. */ - dmxError, /**< A non-fatal error that probably - * indicates DMX will not function as - * desired.*/ - dmxFatal /**< A fatal error that will cause DMX - * to shut down. */ -} dmxLogLevel; - -/* Logging functions used by Xserver/hw/dmx routines. */ -extern dmxLogLevel dmxSetLogLevel(dmxLogLevel newLevel); -extern dmxLogLevel dmxGetLogLevel(void); -extern void dmxLog(dmxLogLevel logLevel, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern void dmxLogCont(dmxLogLevel logLevel, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern const char *dmxEventName(int type); - -#ifndef DMX_LOG_STANDALONE -extern void dmxLogOutput(DMXScreenInfo * dmxScreen, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern void dmxLogOutputCont(DMXScreenInfo * dmxScreen, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern void dmxLogOutputWarning(DMXScreenInfo * dmxScreen, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern void dmxLogInput(DMXInputInfo * dmxInput, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern void dmxLogInputCont(DMXInputInfo * dmxInput, const char *format, - ...) _X_ATTRIBUTE_PRINTF(2, 3); -extern void dmxLogArgs(dmxLogLevel logLevel, int argc, char **argv); -extern void dmxLogVisual(DMXScreenInfo * dmxScreen, XVisualInfo * vi, - int defaultVisual); -extern const char *dmxXInputEventName(int type); -#endif - -#endif diff --git a/hw/dmx/dmxpict.c b/hw/dmx/dmxpict.c deleted file mode 100644 index 63caec94e..000000000 --- a/hw/dmx/dmxpict.c +++ /dev/null @@ -1,1277 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Provide support for the RENDER extension (version 0.8). - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxpict.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" - -#include "fb.h" -#include "pixmapstr.h" -#include "dixstruct.h" - -#include <X11/extensions/render.h> -#include <X11/extensions/renderproto.h> -#include <X11/extensions/Xfixes.h> -#include "picture.h" -#include "picturestr.h" -#include "mipict.h" -#include "fbpict.h" - -extern int (*ProcRenderVector[RenderNumberRequests]) (ClientPtr); - -static int (*dmxSaveRenderVector[RenderNumberRequests]) (ClientPtr); - -static int dmxProcRenderCreateGlyphSet(ClientPtr client); -static int dmxProcRenderFreeGlyphSet(ClientPtr client); -static int dmxProcRenderAddGlyphs(ClientPtr client); -static int dmxProcRenderFreeGlyphs(ClientPtr client); -static int dmxProcRenderCompositeGlyphs(ClientPtr client); -static int dmxProcRenderSetPictureTransform(ClientPtr client); -static int dmxProcRenderSetPictureFilter(ClientPtr client); - -#if 0 -/* FIXME: Not (yet) supported */ -static int dmxProcRenderCreateCursor(ClientPtr client); -static int dmxProcRenderCreateAnimCursor(ClientPtr client); -#endif - -/** Catch errors that might occur when allocating Glyph Sets. Errors - * are saved in dmxGlyphLastError for later handling. */ -static int dmxGlyphLastError; -static int -dmxGlyphErrorHandler(Display * dpy, XErrorEvent * ev) -{ - dmxGlyphLastError = ev->error_code; - return 0; -} - -/** Initialize the Proc Vector for the RENDER extension. The functions - * here cannot be handled by the mi layer RENDER hooks either because - * the required information is no longer available when it reaches the - * mi layer or no mi layer hooks exist. This function is called from - * InitOutput() since it should be initialized only once per server - * generation. */ -void -dmxInitRender(void) -{ - int i; - - for (i = 0; i < RenderNumberRequests; i++) - dmxSaveRenderVector[i] = ProcRenderVector[i]; - - ProcRenderVector[X_RenderCreateGlyphSet] - = dmxProcRenderCreateGlyphSet; - ProcRenderVector[X_RenderFreeGlyphSet] - = dmxProcRenderFreeGlyphSet; - ProcRenderVector[X_RenderAddGlyphs] - = dmxProcRenderAddGlyphs; - ProcRenderVector[X_RenderFreeGlyphs] - = dmxProcRenderFreeGlyphs; - ProcRenderVector[X_RenderCompositeGlyphs8] - = dmxProcRenderCompositeGlyphs; - ProcRenderVector[X_RenderCompositeGlyphs16] - = dmxProcRenderCompositeGlyphs; - ProcRenderVector[X_RenderCompositeGlyphs32] - = dmxProcRenderCompositeGlyphs; - ProcRenderVector[X_RenderSetPictureTransform] - = dmxProcRenderSetPictureTransform; - ProcRenderVector[X_RenderSetPictureFilter] - = dmxProcRenderSetPictureFilter; -} - -/** Reset the Proc Vector for the RENDER extension back to the original - * functions. This function is called from dmxCloseScreen() during the - * server reset (only for screen #0). */ -void -dmxResetRender(void) -{ - int i; - - for (i = 0; i < RenderNumberRequests; i++) - ProcRenderVector[i] = dmxSaveRenderVector[i]; -} - -/** Initialize the RENDER extension, allocate the picture privates and - * wrap mi function hooks. If the shadow frame buffer is used, then - * call the appropriate fb initialization function. */ -Bool -dmxPictureInit(ScreenPtr pScreen, PictFormatPtr formats, int nformats) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps; - - if (!miPictureInit(pScreen, formats, nformats)) - return FALSE; - - if (!dixRegisterPrivateKey - (&dmxPictPrivateKeyRec, PRIVATE_PICTURE, sizeof(dmxPictPrivRec))) - return FALSE; - - ps = GetPictureScreen(pScreen); - - DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps); - DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps); - - DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps); - DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps); - - DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps); - DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps); - - DMX_WRAP(Composite, dmxComposite, dmxScreen, ps); - DMX_WRAP(Glyphs, dmxGlyphs, dmxScreen, ps); - DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps); - - DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps); - DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps); - - return TRUE; -} - -/** Find the appropriate format on the requested screen given the - * internal format requested. The list of formats is searched - * sequentially as the XRenderFindFormat() function does not always - * find the appropriate format when a specific format is requested. */ -static XRenderPictFormat * -dmxFindFormat(DMXScreenInfo * dmxScreen, PictFormatPtr pFmt) -{ - XRenderPictFormat *pFormat = NULL; - int i = 0; - - if (!pFmt || !dmxScreen->beDisplay) - return pFormat; - - while (1) { - pFormat = XRenderFindFormat(dmxScreen->beDisplay, 0, 0, i++); - if (!pFormat) - break; - - if (pFormat->type != pFmt->type) - continue; - if (pFormat->depth != pFmt->depth) - continue; - if (pFormat->direct.red != pFmt->direct.red) - continue; - if (pFormat->direct.redMask != pFmt->direct.redMask) - continue; - if (pFormat->direct.green != pFmt->direct.green) - continue; - if (pFormat->direct.greenMask != pFmt->direct.greenMask) - continue; - if (pFormat->direct.blue != pFmt->direct.blue) - continue; - if (pFormat->direct.blueMask != pFmt->direct.blueMask) - continue; - if (pFormat->direct.alpha != pFmt->direct.alpha) - continue; - if (pFormat->direct.alphaMask != pFmt->direct.alphaMask) - continue; - - /* We have a match! */ - break; - } - - return pFormat; -} - -/** Free \a glyphSet on back-end screen number \a idx. */ -Bool -dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet) -{ - dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - int idx = pScreen->myNum; - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - - if (glyphPriv->glyphSets[idx]) { - XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]); - glyphPriv->glyphSets[idx] = (GlyphSet) 0; - return TRUE; - } - - return FALSE; -} - -/** Create \a glyphSet on the backend screen number \a idx. */ -int -dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet) -{ - XRenderPictFormat *pFormat; - DMXScreenInfo *dmxScreen = &dmxScreens[idx]; - dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - PictFormatPtr pFmt = glyphSet->format; - int (*oldErrorHandler) (Display *, XErrorEvent *); - - pFormat = dmxFindFormat(dmxScreen, pFmt); - if (!pFormat) { - return BadMatch; - } - - dmxGlyphLastError = 0; - oldErrorHandler = XSetErrorHandler(dmxGlyphErrorHandler); - - /* Catch when this fails */ - glyphPriv->glyphSets[idx] - = XRenderCreateGlyphSet(dmxScreen->beDisplay, pFormat); - - XSetErrorHandler(oldErrorHandler); - - if (dmxGlyphLastError) { - return dmxGlyphLastError; - } - - return Success; -} - -/** Create a Glyph Set on each screen. Save the glyphset ID from each - * screen in the Glyph Set's private structure. Fail if the format - * requested is not available or if the Glyph Set cannot be created on - * the screen. */ -static int -dmxProcRenderCreateGlyphSet(ClientPtr client) -{ - int ret; - - REQUEST(xRenderCreateGlyphSetReq); - - ret = dmxSaveRenderVector[stuff->renderReqType] (client); - - if (ret == Success) { - GlyphSetPtr glyphSet; - dmxGlyphPrivPtr glyphPriv; - int i; - - /* Look up glyphSet that was just created ???? */ - /* Store glyphsets from backends in glyphSet->devPrivate ????? */ - /* Make sure we handle all errors here!! */ - - dixLookupResourceByType((void **) &glyphSet, - stuff->gsid, GlyphSetType, - client, DixDestroyAccess); - - glyphPriv = malloc(sizeof(dmxGlyphPrivRec)); - if (!glyphPriv) - return BadAlloc; - glyphPriv->glyphSets = NULL; - MAXSCREENSALLOC_RETURN(glyphPriv->glyphSets, BadAlloc); - DMX_SET_GLYPH_PRIV(glyphSet, glyphPriv); - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - int beret; - - if (!dmxScreen->beDisplay) { - glyphPriv->glyphSets[i] = 0; - continue; - } - - if ((beret = dmxBECreateGlyphSet(i, glyphSet)) != Success) { - int j; - - /* Free the glyph sets we've allocated thus far */ - for (j = 0; j < i; j++) - dmxBEFreeGlyphSet(screenInfo.screens[j], glyphSet); - - /* Free the resource created by render */ - FreeResource(stuff->gsid, RT_NONE); - - return beret; - } - } - } - - return ret; -} - -/** Free the previously allocated Glyph Sets for each screen. */ -static int -dmxProcRenderFreeGlyphSet(ClientPtr client) -{ - GlyphSetPtr glyphSet; - - REQUEST(xRenderFreeGlyphSetReq); - - REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); - dixLookupResourceByType((void **) &glyphSet, - stuff->glyphset, GlyphSetType, - client, DixDestroyAccess); - - if (glyphSet && glyphSet->refcnt == 1) { - dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - int i; - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->beDisplay) { - if (dmxBEFreeGlyphSet(screenInfo.screens[i], glyphSet)) - dmxSync(dmxScreen, FALSE); - } - } - - MAXSCREENSFREE(glyphPriv->glyphSets); - free(glyphPriv); - DMX_SET_GLYPH_PRIV(glyphSet, NULL); - } - - return dmxSaveRenderVector[stuff->renderReqType] (client); -} - -/** Add glyphs to the Glyph Set on each screen. */ -static int -dmxProcRenderAddGlyphs(ClientPtr client) -{ - int ret; - - REQUEST(xRenderAddGlyphsReq); - - ret = dmxSaveRenderVector[stuff->renderReqType] (client); - - if (ret == Success) { - GlyphSetPtr glyphSet; - dmxGlyphPrivPtr glyphPriv; - int i; - int nglyphs; - CARD32 *gids; - Glyph *gidsCopy; - xGlyphInfo *gi; - CARD8 *bits; - int nbytes; - - dixLookupResourceByType((void **) &glyphSet, - stuff->glyphset, GlyphSetType, - client, DixReadAccess); - glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - - nglyphs = stuff->nglyphs; - gids = (CARD32 *) (stuff + 1); - gi = (xGlyphInfo *) (gids + nglyphs); - bits = (CARD8 *) (gi + nglyphs); - nbytes = ((stuff->length << 2) - - sizeof(xRenderAddGlyphsReq) - - (sizeof(CARD32) + sizeof(xGlyphInfo)) * nglyphs); - - gidsCopy = xallocarray(nglyphs, sizeof(*gidsCopy)); - for (i = 0; i < nglyphs; i++) - gidsCopy[i] = gids[i]; - - /* FIXME: Will this ever fail? */ - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->beDisplay) { - XRenderAddGlyphs(dmxScreen->beDisplay, - glyphPriv->glyphSets[i], - gidsCopy, - (XGlyphInfo *) gi, - nglyphs, (char *) bits, nbytes); - dmxSync(dmxScreen, FALSE); - } - } - free(gidsCopy); - } - - return ret; -} - -/** Free glyphs from the Glyph Set for each screen. */ -static int -dmxProcRenderFreeGlyphs(ClientPtr client) -{ - GlyphSetPtr glyphSet; - - REQUEST(xRenderFreeGlyphsReq); - - REQUEST_AT_LEAST_SIZE(xRenderFreeGlyphsReq); - dixLookupResourceByType((void **) &glyphSet, - stuff->glyphset, GlyphSetType, - client, DixWriteAccess); - - if (glyphSet) { - dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - int i; - int nglyphs; - Glyph *gids; - - nglyphs = ((client->req_len << 2) - sizeof(xRenderFreeGlyphsReq)) >> 2; - if (nglyphs) { - gids = xallocarray(nglyphs, sizeof(*gids)); - for (i = 0; i < nglyphs; i++) - gids[i] = ((CARD32 *) (stuff + 1))[i]; - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->beDisplay) { - XRenderFreeGlyphs(dmxScreen->beDisplay, - glyphPriv->glyphSets[i], gids, nglyphs); - dmxSync(dmxScreen, FALSE); - } - } - free(gids); - } - } - - return dmxSaveRenderVector[stuff->renderReqType] (client); -} - -/** Composite glyphs on each screen into the requested picture. If - * either the src or dest picture has not been allocated due to lazy - * window creation, this request will gracefully return. */ -static int -dmxProcRenderCompositeGlyphs(ClientPtr client) -{ - int ret; - - REQUEST(xRenderCompositeGlyphsReq); - - ret = dmxSaveRenderVector[stuff->renderReqType] (client); - - /* For the following to work with PanoramiX, it assumes that Render - * wraps the ProcRenderVector after dmxRenderInit has been called. - */ - if (ret == Success) { - PicturePtr pSrc; - dmxPictPrivPtr pSrcPriv; - PicturePtr pDst; - dmxPictPrivPtr pDstPriv; - PictFormatPtr pFmt; - XRenderPictFormat *pFormat; - int size; - - int scrnNum; - DMXScreenInfo *dmxScreen; - - CARD8 *buffer; - CARD8 *end; - int space; - - int nglyph; - char *glyphs; - char *curGlyph; - - xGlyphElt *elt; - int nelt; - XGlyphElt8 *elts; - XGlyphElt8 *curElt; - - GlyphSetPtr glyphSet; - dmxGlyphPrivPtr glyphPriv; - - dixLookupResourceByType((void **) &pSrc, - stuff->src, PictureType, client, DixReadAccess); - - pSrcPriv = DMX_GET_PICT_PRIV(pSrc); - if (!pSrcPriv->pict) - return ret; - - dixLookupResourceByType((void **) &pDst, - stuff->dst, PictureType, - client, DixWriteAccess); - - pDstPriv = DMX_GET_PICT_PRIV(pDst); - if (!pDstPriv->pict) - return ret; - - scrnNum = pDst->pDrawable->pScreen->myNum; - dmxScreen = &dmxScreens[scrnNum]; - - /* Note: If the back-end display has been detached, then it - * should not be possible to reach here since the pSrcPriv->pict - * and pDstPriv->pict will have already been set to 0. - */ - if (!dmxScreen->beDisplay) - return ret; - - if (stuff->maskFormat) - dixLookupResourceByType((void **) &pFmt, - stuff->maskFormat, PictFormatType, - client, DixReadAccess); - else - pFmt = NULL; - - pFormat = dmxFindFormat(dmxScreen, pFmt); - - switch (stuff->renderReqType) { - case X_RenderCompositeGlyphs8: - size = sizeof(CARD8); - break; - case X_RenderCompositeGlyphs16: - size = sizeof(CARD16); - break; - case X_RenderCompositeGlyphs32: - size = sizeof(CARD32); - break; - default: - return BadPictOp; /* Can't happen */ - } - - buffer = (CARD8 *) (stuff + 1); - end = (CARD8 *) stuff + (stuff->length << 2); - nelt = 0; - nglyph = 0; - while (buffer + sizeof(xGlyphElt) < end) { - elt = (xGlyphElt *) buffer; - buffer += sizeof(xGlyphElt); - - if (elt->len == 0xff) { - buffer += 4; - } - else { - nelt++; - nglyph += elt->len; - space = size * elt->len; - if (space & 3) - space += 4 - (space & 3); - buffer += space; - } - } - - /* The following only works for Render version > 0.2 */ - - /* All of the XGlyphElt* structure sizes are identical */ - elts = xallocarray(nelt, sizeof(XGlyphElt8)); - if (!elts) - return BadAlloc; - - glyphs = xallocarray(nglyph, size); - if (!glyphs) { - free(elts); - return BadAlloc; - } - - buffer = (CARD8 *) (stuff + 1); - end = (CARD8 *) stuff + (stuff->length << 2); - curGlyph = glyphs; - curElt = elts; - - dixLookupResourceByType((void **) &glyphSet, - stuff->glyphset, GlyphSetType, - client, DixReadAccess); - glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - - while (buffer + sizeof(xGlyphElt) < end) { - elt = (xGlyphElt *) buffer; - buffer += sizeof(xGlyphElt); - - if (elt->len == 0xff) { - dixLookupResourceByType((void **) &glyphSet, - *((CARD32 *) buffer), - GlyphSetType, client, DixReadAccess); - glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); - buffer += 4; - } - else { - curElt->glyphset = glyphPriv->glyphSets[scrnNum]; - curElt->xOff = elt->deltax; - curElt->yOff = elt->deltay; - curElt->nchars = elt->len; - curElt->chars = curGlyph; - - memcpy(curGlyph, buffer, size * elt->len); - curGlyph += size * elt->len; - - curElt++; - - space = size * elt->len; - if (space & 3) - space += 4 - (space & 3); - buffer += space; - } - } - - switch (stuff->renderReqType) { - case X_RenderCompositeGlyphs8: - XRenderCompositeText8(dmxScreen->beDisplay, stuff->op, - pSrcPriv->pict, pDstPriv->pict, - pFormat, - stuff->xSrc, stuff->ySrc, 0, 0, elts, nelt); - break; - case X_RenderCompositeGlyphs16: - XRenderCompositeText16(dmxScreen->beDisplay, stuff->op, - pSrcPriv->pict, pDstPriv->pict, - pFormat, - stuff->xSrc, stuff->ySrc, - 0, 0, (XGlyphElt16 *) elts, nelt); - break; - case X_RenderCompositeGlyphs32: - XRenderCompositeText32(dmxScreen->beDisplay, stuff->op, - pSrcPriv->pict, pDstPriv->pict, - pFormat, - stuff->xSrc, stuff->ySrc, - 0, 0, (XGlyphElt32 *) elts, nelt); - break; - } - - dmxSync(dmxScreen, FALSE); - - free(elts); - free(glyphs); - } - - return ret; -} - -/** Set the picture transform on each screen. */ -static int -dmxProcRenderSetPictureTransform(ClientPtr client) -{ - DMXScreenInfo *dmxScreen; - PicturePtr pPicture; - dmxPictPrivPtr pPictPriv; - XTransform xform; - - REQUEST(xRenderSetPictureTransformReq); - - REQUEST_SIZE_MATCH(xRenderSetPictureTransformReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess); - - /* For the following to work with PanoramiX, it assumes that Render - * wraps the ProcRenderVector after dmxRenderInit has been called. - */ - dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum]; - pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - if (pPictPriv->pict) { - xform.matrix[0][0] = stuff->transform.matrix11; - xform.matrix[0][1] = stuff->transform.matrix12; - xform.matrix[0][2] = stuff->transform.matrix13; - xform.matrix[1][0] = stuff->transform.matrix21; - xform.matrix[1][1] = stuff->transform.matrix22; - xform.matrix[1][2] = stuff->transform.matrix23; - xform.matrix[2][0] = stuff->transform.matrix31; - xform.matrix[2][1] = stuff->transform.matrix32; - xform.matrix[2][2] = stuff->transform.matrix33; - - XRenderSetPictureTransform(dmxScreen->beDisplay, - pPictPriv->pict, &xform); - dmxSync(dmxScreen, FALSE); - } - - return dmxSaveRenderVector[stuff->renderReqType] (client); -} - -/** Set the picture filter on each screen. */ -static int -dmxProcRenderSetPictureFilter(ClientPtr client) -{ - DMXScreenInfo *dmxScreen; - PicturePtr pPicture; - dmxPictPrivPtr pPictPriv; - char *filter; - XFixed *params; - int nparams; - - REQUEST(xRenderSetPictureFilterReq); - - REQUEST_AT_LEAST_SIZE(xRenderSetPictureFilterReq); - VERIFY_PICTURE(pPicture, stuff->picture, client, DixWriteAccess); - - /* For the following to work with PanoramiX, it assumes that Render - * wraps the ProcRenderVector after dmxRenderInit has been called. - */ - dmxScreen = &dmxScreens[pPicture->pDrawable->pScreen->myNum]; - pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - if (pPictPriv->pict) { - filter = (char *) (stuff + 1); - params = (XFixed *) (filter + ((stuff->nbytes + 3) & ~3)); - nparams = ((XFixed *) stuff + client->req_len) - params; - if (nparams < 0) - return BadLength; - - XRenderSetPictureFilter(dmxScreen->beDisplay, - pPictPriv->pict, filter, params, nparams); - dmxSync(dmxScreen, FALSE); - } - - return dmxSaveRenderVector[stuff->renderReqType] (client); -} - -/** Create a picture on the appropriate screen. This is the actual - * function that creates the picture. However, if the associated - * window has not yet been created due to lazy window creation, then - * delay the picture creation until the window is mapped. */ -static Picture -dmxDoCreatePicture(PicturePtr pPicture) -{ - DrawablePtr pDraw = pPicture->pDrawable; - ScreenPtr pScreen = pDraw->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - XRenderPictFormat *pFormat; - Drawable draw; - - if (pPicture->pDrawable->type == DRAWABLE_WINDOW) { - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV((WindowPtr) (pDraw)); - - if (!(draw = pWinPriv->window)) { - /* Window has not been created yet due to the window - * optimization. Delay picture creation until window is - * mapped. - */ - pWinPriv->hasPict = TRUE; - return 0; - } - } - else { - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV((PixmapPtr) (pDraw)); - - if (!(draw = pPixPriv->pixmap)) { - /* FIXME: Zero width/height pixmap?? */ - return 0; - } - } - - /* This should not be reached if the back-end display has been - * detached because the pWinPriv->window or the pPixPriv->pixmap - * will be NULL; however, we add it here for completeness - */ - if (!dmxScreen->beDisplay) - return 0; - - pFormat = dmxFindFormat(dmxScreen, pPicture->pFormat); - - return XRenderCreatePicture(dmxScreen->beDisplay, draw, pFormat, 0, 0); -} - -/** Create a list of pictures. This function is called by - * dmxCreateAndRealizeWindow() during the lazy window creation - * realization process. It creates the entire list of pictures that - * are associated with the given window. */ -void -dmxCreatePictureList(WindowPtr pWindow) -{ - PicturePtr pPicture = GetPictureWindow(pWindow); - - while (pPicture) { - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - /* Create the picture for this window */ - pPictPriv->pict = dmxDoCreatePicture(pPicture); - - /* ValidatePicture takes care of the state changes */ - - pPicture = pPicture->pNext; - } -} - -/** Create \a pPicture on the backend. */ -int -dmxBECreatePicture(PicturePtr pPicture) -{ - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - /* Create picutre on BE */ - pPictPriv->pict = dmxDoCreatePicture(pPicture); - - /* Flush changes to the backend server */ - dmxValidatePicture(pPicture, (1 << (CPLastBit + 1)) - 1); - - return Success; -} - -/** Create a picture. This function handles the CreatePicture - * unwrapping/wrapping and calls dmxDoCreatePicture to actually create - * the picture on the appropriate screen. */ -int -dmxCreatePicture(PicturePtr pPicture) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - int ret = Success; - - DMX_UNWRAP(CreatePicture, dmxScreen, ps); -#if 1 - if (ps->CreatePicture) - ret = ps->CreatePicture(pPicture); -#endif - - /* Create picture on back-end server */ - pPictPriv->pict = dmxDoCreatePicture(pPicture); - pPictPriv->savedMask = 0; - - DMX_WRAP(CreatePicture, dmxCreatePicture, dmxScreen, ps); - - return ret; -} - -/** Destroy \a pPicture on the back-end server. */ -Bool -dmxBEFreePicture(PicturePtr pPicture) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - if (pPictPriv->pict) { - XRenderFreePicture(dmxScreen->beDisplay, pPictPriv->pict); - pPictPriv->pict = (Picture) 0; - return TRUE; - } - - return FALSE; -} - -/** Destroy a list of pictures that are associated with the window that - * is being destroyed. This function is called by #dmxDestroyWindow(). - * */ -Bool -dmxDestroyPictureList(WindowPtr pWindow) -{ - PicturePtr pPicture = GetPictureWindow(pWindow); - Bool ret = FALSE; - - while (pPicture) { - ret |= dmxBEFreePicture(pPicture); - pPicture = pPicture->pNext; - } - - return ret; -} - -/** Destroy a picture. This function calls the wrapped function that - * frees the resources in the DMX server associated with this - * picture. */ -void -dmxDestroyPicture(PicturePtr pPicture) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - - DMX_UNWRAP(DestroyPicture, dmxScreen, ps); - - /* Destroy picture on back-end server */ - if (dmxBEFreePicture(pPicture)) - dmxSync(dmxScreen, FALSE); - -#if 1 - if (ps->DestroyPicture) - ps->DestroyPicture(pPicture); -#endif - DMX_WRAP(DestroyPicture, dmxDestroyPicture, dmxScreen, ps); -} - -/** Change the picture's list of clip rectangles. */ -int -dmxChangePictureClip(PicturePtr pPicture, int clipType, void *value, int n) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - DMX_UNWRAP(ChangePictureClip, dmxScreen, ps); -#if 1 - if (ps->ChangePictureClip) - ps->ChangePictureClip(pPicture, clipType, value, n); -#endif - - /* Change picture clip rects on back-end server */ - if (pPictPriv->pict) { - /* The clip has already been changed into a region by the mi - * routine called above. - */ - if (clipType == CT_NONE) { - /* Disable clipping, show all */ - XFixesSetPictureClipRegion(dmxScreen->beDisplay, - pPictPriv->pict, 0, 0, None); - } - else if (pPicture->clientClip) { - RegionPtr pClip = pPicture->clientClip; - BoxPtr pBox = RegionRects(pClip); - int nBox = RegionNumRects(pClip); - XRectangle *pRects; - XRectangle *pRect; - int nRects; - - nRects = nBox; - pRects = pRect = xallocarray(nRects, sizeof(*pRect)); - - while (nBox--) { - pRect->x = pBox->x1; - pRect->y = pBox->y1; - pRect->width = pBox->x2 - pBox->x1; - pRect->height = pBox->y2 - pBox->y1; - pBox++; - pRect++; - } - - XRenderSetPictureClipRectangles(dmxScreen->beDisplay, - pPictPriv->pict, - 0, 0, pRects, nRects); - free(pRects); - } - else { - XRenderSetPictureClipRectangles(dmxScreen->beDisplay, - pPictPriv->pict, 0, 0, NULL, 0); - } - dmxSync(dmxScreen, FALSE); - } - else { - /* FIXME: Handle saving clip region when offscreen */ - } - - DMX_WRAP(ChangePictureClip, dmxChangePictureClip, dmxScreen, ps); - - return Success; -} - -/** Destroy the picture's list of clip rectangles. */ -void -dmxDestroyPictureClip(PicturePtr pPicture) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - DMX_UNWRAP(DestroyPictureClip, dmxScreen, ps); -#if 1 - if (ps->DestroyPictureClip) - ps->DestroyPictureClip(pPicture); -#endif - - /* Destroy picture clip rects on back-end server */ - if (pPictPriv->pict) { - XRenderSetPictureClipRectangles(dmxScreen->beDisplay, - pPictPriv->pict, 0, 0, NULL, 0); - dmxSync(dmxScreen, FALSE); - } - else { - /* FIXME: Handle destroying clip region when offscreen */ - } - - DMX_WRAP(DestroyPictureClip, dmxDestroyPictureClip, dmxScreen, ps); -} - -/** Change the attributes of the pictures. If the picture has not yet - * been created due to lazy window creation, save the mask so that it - * can be used to appropriately initialize the picture's attributes - * when it is created later. */ -void -dmxChangePicture(PicturePtr pPicture, Mask mask) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - DMX_UNWRAP(ChangePicture, dmxScreen, ps); -#if 1 - if (ps->ChangePicture) - ps->ChangePicture(pPicture, mask); -#endif - - /* Picture attribute changes are handled in ValidatePicture */ - pPictPriv->savedMask |= mask; - - DMX_WRAP(ChangePicture, dmxChangePicture, dmxScreen, ps); -} - -/** Validate the picture's attributes before rendering to it. Update - * any picture attributes that have been changed by one of the higher - * layers. */ -void -dmxValidatePicture(PicturePtr pPicture, Mask mask) -{ - ScreenPtr pScreen = pPicture->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pPicture); - - DMX_UNWRAP(ValidatePicture, dmxScreen, ps); - - /* Change picture attributes on back-end server */ - if (pPictPriv->pict) { - XRenderPictureAttributes attribs; - - if (mask & CPRepeat) { - attribs.repeat = pPicture->repeatType; - } - if (mask & CPAlphaMap) { - if (pPicture->alphaMap) { - dmxPictPrivPtr pAlphaPriv; - - pAlphaPriv = DMX_GET_PICT_PRIV(pPicture->alphaMap); - if (pAlphaPriv->pict) { - attribs.alpha_map = pAlphaPriv->pict; - } - else { - /* FIXME: alpha picture drawable has not been created?? */ - return; /* or should this be: attribs.alpha_map = None; */ - } - } - else { - attribs.alpha_map = None; - } - } - if (mask & CPAlphaXOrigin) - attribs.alpha_x_origin = pPicture->alphaOrigin.x; - if (mask & CPAlphaYOrigin) - attribs.alpha_y_origin = pPicture->alphaOrigin.y; - if (mask & CPClipXOrigin) - attribs.clip_x_origin = pPicture->clipOrigin.x; - if (mask & CPClipYOrigin) - attribs.clip_y_origin = pPicture->clipOrigin.y; - if (mask & CPClipMask) - mask &= ~CPClipMask; /* Handled in ChangePictureClip */ - if (mask & CPGraphicsExposure) - attribs.graphics_exposures = pPicture->graphicsExposures; - if (mask & CPSubwindowMode) - attribs.subwindow_mode = pPicture->subWindowMode; - if (mask & CPPolyEdge) - attribs.poly_edge = pPicture->polyEdge; - if (mask & CPPolyMode) - attribs.poly_mode = pPicture->polyMode; - if (mask & CPComponentAlpha) - attribs.component_alpha = pPicture->componentAlpha; - - XRenderChangePicture(dmxScreen->beDisplay, pPictPriv->pict, - mask, &attribs); - dmxSync(dmxScreen, FALSE); - } - else { - pPictPriv->savedMask |= mask; - } - -#if 1 - if (ps->ValidatePicture) - ps->ValidatePicture(pPicture, mask); -#endif - - DMX_WRAP(ValidatePicture, dmxValidatePicture, dmxScreen, ps); -} - -/** Composite a picture on the appropriate screen by combining the - * specified rectangle of the transformed src and mask operands with - * the specified rectangle of the dst using op as the compositing - * operator. For a complete description see the protocol document of - * the RENDER library. */ -void -dmxComposite(CARD8 op, - PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, - INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); - dmxPictPrivPtr pMaskPriv = NULL; - dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); - - if (pMask) - pMaskPriv = DMX_GET_PICT_PRIV(pMask); - - DMX_UNWRAP(Composite, dmxScreen, ps); -#if 0 - if (ps->Composite) - ps->Composite(op, pSrc, pMask, pDst, - xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); -#endif - - /* Composite on back-end server */ - if (pSrcPriv->pict && pDstPriv->pict && - ((pMaskPriv && pMaskPriv->pict) || !pMaskPriv)) { - XRenderComposite(dmxScreen->beDisplay, - op, - pSrcPriv->pict, - pMaskPriv ? pMaskPriv->pict : None, - pDstPriv->pict, - xSrc, ySrc, xMask, yMask, xDst, yDst, width, height); - dmxSync(dmxScreen, FALSE); - } - - DMX_WRAP(Composite, dmxComposite, dmxScreen, ps); -} - -/** Null function to catch when/if RENDER calls lower level mi hooks. - * Compositing glyphs is handled by dmxProcRenderCompositeGlyphs(). - * This function should never be called. */ -void -dmxGlyphs(CARD8 op, - PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, - int nlists, GlyphListPtr lists, GlyphPtr * glyphs) -{ - /* This won't work, so we need to wrap ProcRenderCompositeGlyphs */ -} - -/** Fill a rectangle on the appropriate screen by combining the color - * with the dest picture in the area specified by the list of - * rectangles. For a complete description see the protocol document of - * the RENDER library. */ -void -dmxCompositeRects(CARD8 op, - PicturePtr pDst, - xRenderColor * color, int nRect, xRectangle *rects) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pPictPriv = DMX_GET_PICT_PRIV(pDst); - - DMX_UNWRAP(CompositeRects, dmxScreen, ps); -#if 0 - if (ps->CompositeRects) - ps->CompositeRects(op, pDst, color, nRect, rects); -#endif - - /* CompositeRects on back-end server */ - if (pPictPriv->pict) { - XRenderFillRectangles(dmxScreen->beDisplay, - op, - pPictPriv->pict, - (XRenderColor *) color, - (XRectangle *) rects, nRect); - dmxSync(dmxScreen, FALSE); - } - - DMX_WRAP(CompositeRects, dmxCompositeRects, dmxScreen, ps); -} - -/** Indexed color visuals are not yet supported. */ -Bool -dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat) -{ - return TRUE; -} - -/** Indexed color visuals are not yet supported. */ -void -dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat) -{ -} - -/** Indexed color visuals are not yet supported. */ -void -dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat, - int ndef, xColorItem * pdef) -{ -} - -/** Composite a list of trapezoids on the appropriate screen. For a - * complete description see the protocol document of the RENDER - * library. */ -void -dmxTrapezoids(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, int ntrap, xTrapezoid * traps) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); - dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); - - DMX_UNWRAP(Trapezoids, dmxScreen, ps); -#if 0 - if (ps->Trapezoids) - ps->Trapezoids(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntrap, *traps); -#endif - - /* Draw trapezoids on back-end server */ - if (pDstPriv->pict) { - XRenderPictFormat *pFormat; - - pFormat = dmxFindFormat(dmxScreen, maskFormat); - if (!pFormat) { - /* FIXME: Error! */ - } - - XRenderCompositeTrapezoids(dmxScreen->beDisplay, - op, - pSrcPriv->pict, - pDstPriv->pict, - pFormat, - xSrc, ySrc, (XTrapezoid *) traps, ntrap); - dmxSync(dmxScreen, FALSE); - } - - DMX_WRAP(Trapezoids, dmxTrapezoids, dmxScreen, ps); -} - -/** Composite a list of triangles on the appropriate screen. For a - * complete description see the protocol document of the RENDER - * library. */ -void -dmxTriangles(CARD8 op, PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris) -{ - ScreenPtr pScreen = pDst->pDrawable->pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PictureScreenPtr ps = GetPictureScreen(pScreen); - dmxPictPrivPtr pSrcPriv = DMX_GET_PICT_PRIV(pSrc); - dmxPictPrivPtr pDstPriv = DMX_GET_PICT_PRIV(pDst); - - DMX_UNWRAP(Triangles, dmxScreen, ps); -#if 0 - if (ps->Triangles) - ps->Triangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntri, *tris); -#endif - - /* Draw trapezoids on back-end server */ - if (pDstPriv->pict) { - XRenderPictFormat *pFormat; - - pFormat = dmxFindFormat(dmxScreen, maskFormat); - if (!pFormat) { - /* FIXME: Error! */ - } - - XRenderCompositeTriangles(dmxScreen->beDisplay, - op, - pSrcPriv->pict, - pDstPriv->pict, - pFormat, - xSrc, ySrc, (XTriangle *) tris, ntri); - dmxSync(dmxScreen, FALSE); - } - - DMX_WRAP(Triangles, dmxTriangles, dmxScreen, ps); -} diff --git a/hw/dmx/dmxpict.h b/hw/dmx/dmxpict.h deleted file mode 100644 index f36eca373..000000000 --- a/hw/dmx/dmxpict.h +++ /dev/null @@ -1,116 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * This file provides access to the externally visible RENDER support - * functions, global variables and macros for DMX. - * - * FIXME: Move function definitions for non-externally visible function - * to .c file. */ - -#ifndef DMXPICT_H -#define DMXPICT_H - -/** Picture private structure */ -typedef struct _dmxPictPriv { - Picture pict; /**< Picture ID from back-end server */ - Mask savedMask; /**< Mask of picture attributes saved for - * lazy window creation. */ -} dmxPictPrivRec, *dmxPictPrivPtr; - -/** Glyph Set private structure */ -typedef struct _dmxGlyphPriv { - GlyphSet *glyphSets; /**< Glyph Set IDs from back-end server */ -} dmxGlyphPrivRec, *dmxGlyphPrivPtr; - -extern void dmxInitRender(void); -extern void dmxResetRender(void); - -extern Bool dmxPictureInit(ScreenPtr pScreen, - PictFormatPtr formats, int nformats); - -extern void dmxCreatePictureList(WindowPtr pWindow); -extern Bool dmxDestroyPictureList(WindowPtr pWindow); - -extern int dmxCreatePicture(PicturePtr pPicture); -extern void dmxDestroyPicture(PicturePtr pPicture); -extern int dmxChangePictureClip(PicturePtr pPicture, int clipType, - void *value, int n); -extern void dmxDestroyPictureClip(PicturePtr pPicture); -extern void dmxChangePicture(PicturePtr pPicture, Mask mask); -extern void dmxValidatePicture(PicturePtr pPicture, Mask mask); -extern void dmxComposite(CARD8 op, - PicturePtr pSrc, PicturePtr pMask, PicturePtr pDst, - INT16 xSrc, INT16 ySrc, - INT16 xMask, INT16 yMask, - INT16 xDst, INT16 yDst, CARD16 width, CARD16 height); -extern void dmxGlyphs(CARD8 op, - PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, - int nlists, GlyphListPtr lists, GlyphPtr * glyphs); -extern void dmxCompositeRects(CARD8 op, - PicturePtr pDst, - xRenderColor * color, - int nRect, xRectangle *rects); -extern Bool dmxInitIndexed(ScreenPtr pScreen, PictFormatPtr pFormat); -extern void dmxCloseIndexed(ScreenPtr pScreen, PictFormatPtr pFormat); -extern void dmxUpdateIndexed(ScreenPtr pScreen, PictFormatPtr pFormat, - int ndef, xColorItem * pdef); -extern void dmxTrapezoids(CARD8 op, - PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, - int ntrap, xTrapezoid * traps); -extern void dmxTriangles(CARD8 op, - PicturePtr pSrc, PicturePtr pDst, - PictFormatPtr maskFormat, - INT16 xSrc, INT16 ySrc, int ntri, xTriangle * tris); - -extern int dmxBECreateGlyphSet(int idx, GlyphSetPtr glyphSet); -extern Bool dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet); -extern int dmxBECreatePicture(PicturePtr pPicture); -extern Bool dmxBEFreePicture(PicturePtr pPicture); - -/** Get the picture private data given a picture pointer */ -#define DMX_GET_PICT_PRIV(_pPict) \ - (dmxPictPrivPtr)dixLookupPrivate(&(_pPict)->devPrivates, dmxPictPrivateKey) - -/** Set the glyphset private data given a glyphset pointer */ -#define DMX_SET_GLYPH_PRIV(_pGlyph, _pPriv) \ - GlyphSetSetPrivate((_pGlyph), dmxGlyphSetPrivateKey, (_pPriv)) -/** Get the glyphset private data given a glyphset pointer */ -#define DMX_GET_GLYPH_PRIV(_pGlyph) \ - (dmxGlyphPrivPtr)GlyphSetGetPrivate((_pGlyph), dmxGlyphSetPrivateKey) - -#endif /* DMXPICT_H */ diff --git a/hw/dmx/dmxpixmap.c b/hw/dmx/dmxpixmap.c deleted file mode 100644 index 7b317eaef..000000000 --- a/hw/dmx/dmxpixmap.c +++ /dev/null @@ -1,262 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Provides pixmap support. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxpixmap.h" - -#include "pixmapstr.h" -#include "servermd.h" -#include "privates.h" - -/** Initialize a private area in \a pScreen for pixmap information. */ -Bool -dmxInitPixmap(ScreenPtr pScreen) -{ - if (!dixRegisterPrivateKey - (&dmxPixPrivateKeyRec, PRIVATE_PIXMAP, sizeof(dmxPixPrivRec))) - return FALSE; - - return TRUE; -} - -/** Create a pixmap on the back-end server. */ -void -dmxBECreatePixmap(PixmapPtr pPixmap) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - /* Make sure we haven't already created this pixmap. This can - * happen when the pixmap is used elsewhere (e.g., as a background - * or border for a window) and the refcnt > 1. - */ - if (pPixPriv->pixmap) - return; - - if (pPixmap->drawable.width && pPixmap->drawable.height) { - pPixPriv->pixmap = XCreatePixmap(dmxScreen->beDisplay, - dmxScreen->scrnWin, - pPixmap->drawable.width, - pPixmap->drawable.height, - pPixmap->drawable.depth); - dmxSync(dmxScreen, FALSE); - } -} - -/** Create a pixmap for \a pScreen with the specified \a width, \a - * height, and \a depth. */ -PixmapPtr -dmxCreatePixmap(ScreenPtr pScreen, int width, int height, int depth, - unsigned usage_hint) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - PixmapPtr pPixmap; - int bpp; - dmxPixPrivPtr pPixPriv; - -#if 0 - DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen); - if (pScreen->CreatePixmap) - ret = pScreen->CreatePixmap(pPixmap); -#endif - - /* Create pixmap on back-end server */ - if (depth == 24) - bpp = 32; - else - bpp = depth; - - pPixmap = AllocatePixmap(pScreen, 0); - if (!pPixmap) - return NullPixmap; - - pPixmap->drawable.type = DRAWABLE_PIXMAP; - pPixmap->drawable.class = 0; - pPixmap->drawable.pScreen = pScreen; - pPixmap->drawable.depth = depth; - pPixmap->drawable.bitsPerPixel = bpp; - pPixmap->drawable.id = 0; - pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; - pPixmap->drawable.x = 0; - pPixmap->drawable.y = 0; - pPixmap->drawable.width = width; - pPixmap->drawable.height = height; - pPixmap->devKind = PixmapBytePad(width, bpp); - pPixmap->refcnt = 1; - pPixmap->usage_hint = usage_hint; - - pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - pPixPriv->pixmap = (Pixmap) 0; - pPixPriv->detachedImage = NULL; - - /* Create the pixmap on the back-end server */ - if (dmxScreen->beDisplay) { - dmxBECreatePixmap(pPixmap); - } - -#if 0 - DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen); -#endif - - return pPixmap; -} - -/** Destroy the pixmap on the back-end server. */ -Bool -dmxBEFreePixmap(PixmapPtr pPixmap) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - if (pPixPriv->pixmap) { - XFreePixmap(dmxScreen->beDisplay, pPixPriv->pixmap); - pPixPriv->pixmap = (Pixmap) 0; - return TRUE; - } - - return FALSE; -} - -/** Destroy the pixmap pointed to by \a pPixmap. */ -Bool -dmxDestroyPixmap(PixmapPtr pPixmap) -{ - ScreenPtr pScreen = pPixmap->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - -#if 0 - DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen); -#endif - - if (--pPixmap->refcnt) - return TRUE; - - /* Destroy pixmap on back-end server */ - if (dmxScreen->beDisplay) { - if (dmxBEFreePixmap(pPixmap)) { - /* Also make sure that we destroy any detached image */ - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - - if (pPixPriv->detachedImage) - XDestroyImage(pPixPriv->detachedImage); - dmxSync(dmxScreen, FALSE); - } - } - FreePixmap(pPixmap); - -#if 0 - if (pScreen->DestroyPixmap) - ret = pScreen->DestroyPixmap(pPixmap); - DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen); -#endif - - return ret; -} - -/** Create and return a region based on the pixmap pointed to by \a - * pPixmap. */ -RegionPtr -dmxBitmapToRegion(PixmapPtr pPixmap) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pPixmap->drawable.pScreen->myNum]; - dmxPixPrivPtr pPixPriv = DMX_GET_PIXMAP_PRIV(pPixmap); - XImage *ximage; - RegionPtr pReg, pTmpReg; - int x, y; - unsigned long previousPixel, currentPixel; - BoxRec Box = { 0, }; - Bool overlap; - - if (!dmxScreen->beDisplay) { - pReg = RegionCreate(NullBox, 1); - return pReg; - } - - ximage = XGetImage(dmxScreen->beDisplay, pPixPriv->pixmap, 0, 0, - pPixmap->drawable.width, pPixmap->drawable.height, - 1, XYPixmap); - - pReg = RegionCreate(NullBox, 1); - pTmpReg = RegionCreate(NullBox, 1); - if (!pReg || !pTmpReg) { - XDestroyImage(ximage); - return NullRegion; - } - - for (y = 0; y < pPixmap->drawable.height; y++) { - Box.y1 = y; - Box.y2 = y + 1; - previousPixel = 0L; - for (x = 0; x < pPixmap->drawable.width; x++) { - currentPixel = XGetPixel(ximage, x, y); - if (previousPixel != currentPixel) { - if (previousPixel == 0L) { - /* left edge */ - Box.x1 = x; - } - else if (currentPixel == 0L) { - /* right edge */ - Box.x2 = x; - RegionReset(pTmpReg, &Box); - RegionAppend(pReg, pTmpReg); - } - previousPixel = currentPixel; - } - } - if (previousPixel != 0L) { - /* right edge because of the end of pixmap */ - Box.x2 = pPixmap->drawable.width; - RegionReset(pTmpReg, &Box); - RegionAppend(pReg, pTmpReg); - } - } - - RegionDestroy(pTmpReg); - XDestroyImage(ximage); - - RegionValidate(pReg, &overlap); - - dmxSync(dmxScreen, FALSE); - return pReg; -} diff --git a/hw/dmx/dmxpixmap.h b/hw/dmx/dmxpixmap.h deleted file mode 100644 index 30bb666d5..000000000 --- a/hw/dmx/dmxpixmap.h +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Interface for pixmap support. \see dmxpixmap.c */ - -#ifndef DMXPIXMAP_H -#define DMXPIXMAP_H - -#include "pixmapstr.h" - -/** Pixmap private area. */ -typedef struct _dmxPixPriv { - Pixmap pixmap; - XImage *detachedImage; -} dmxPixPrivRec, *dmxPixPrivPtr; - -extern Bool dmxInitPixmap(ScreenPtr pScreen); - -extern PixmapPtr dmxCreatePixmap(ScreenPtr pScreen, - int width, int height, int depth, - unsigned usage_hint); -extern Bool dmxDestroyPixmap(PixmapPtr pPixmap); -extern RegionPtr dmxBitmapToRegion(PixmapPtr pPixmap); - -extern void dmxBECreatePixmap(PixmapPtr pPixmap); -extern Bool dmxBEFreePixmap(PixmapPtr pPixmap); - -/** Get pixmap private pointer. */ -#define DMX_GET_PIXMAP_PRIV(_pPix) \ - (dmxPixPrivPtr)dixLookupPrivate(&(_pPix)->devPrivates, dmxPixPrivateKey) - -#endif /* DMXPIXMAP_H */ diff --git a/hw/dmx/dmxprop.c b/hw/dmx/dmxprop.c deleted file mode 100644 index 7dfa04af5..000000000 --- a/hw/dmx/dmxprop.c +++ /dev/null @@ -1,375 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * It is possible for one of the DMX "backend displays" to actually be - * smaller than the dimensions of the backend X server. Therefore, it - * is possible for more than one of the DMX "backend displays" to be - * physically located on the same backend X server. This situation must - * be detected so that cursor motion can be handled in an expected - * fashion. - * - * We could analyze the names used for the DMX "backend displays" (e.g., - * the names passed to the -display command-line parameter), but there - * are many possible names for a single X display, and failing to detect - * sameness leads to very unexpected results. Therefore, whenever the - * DMX server opens a window on a backend X server, a property value is - * queried and set on that backend to detect when another window is - * already open on that server. - * - * Further, it is possible that two different DMX server instantiations - * both have windows on the same physical backend X server. This case - * is also detected so that pointer input is not taken from that - * particular backend X server. - * - * The routines in this file handle the property management. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxprop.h" -#include "dmxlog.h" -#include <X11/Xmu/SysUtil.h> /* For XmuGetHostname */ - -/** Holds the window id of all DMX windows on the backend X server. */ -#define DMX_ATOMNAME "DMX_NAME" - -/** The identification string of this DMX server */ -#define DMX_IDENT "Xdmx" - -extern char *display; - -static int -dmxPropertyErrorHandler(Display * dpy, XErrorEvent * ev) -{ - return 0; -} - -static const unsigned char * -dmxPropertyIdentifier(void) -{ - /* RATS: These buffers are only used in - * length-limited calls. */ - char hostname[256]; - static char buf[512]; - static int initialized = 0; - - if (initialized++) - return (unsigned char *) buf; - - XmuGetHostname(hostname, sizeof(hostname)); - snprintf(buf, sizeof(buf), "%s:%s:%s", DMX_IDENT, hostname, display); - return (unsigned char *) buf; -} - -/** Starting with the \a start screen, iterate over all of the screens - * on the same physical X server as \a start, calling \a f with the - * screen and the \a closure. (The common case is that \a start is the - * only DMX window on the backend X server.) */ -void * -dmxPropertyIterate(DMXScreenInfo * start, - void *(*f) (DMXScreenInfo * dmxScreen, void *), - void *closure) -{ - DMXScreenInfo *pt; - - if (!start->next) { - if (!start->beDisplay) - return NULL; - return f(start, closure); - } - - for (pt = start->next; /* condition at end of loop */ ; pt = pt->next) { - void *retval; - - /* beDisplay ban be NULL if a screen was detached */ - dmxLog(dmxDebug, "pt = %p\n", pt); - dmxLog(dmxDebug, "pt->beDisplay = %p\n", pt->beDisplay); - if (pt->beDisplay && (retval = f(pt, closure))) - return retval; - if (pt == start) - break; - } - return NULL; -} - -/** Returns 0 if this is the only Xdmx session on the display; 1 - * otherwise. */ -static int -dmxPropertyCheckOtherServers(DMXScreenInfo * dmxScreen, Atom atom) -{ - Display *dpy = dmxScreen->beDisplay; - XTextProperty tp; - XTextProperty tproot; - const char *pt; - int retcode = 0; - char **list = NULL; - int count = 0; - int i; - int (*dmxOldHandler) (Display *, XErrorEvent *); - - if (!dpy) - return 0; - - if (!XGetTextProperty(dpy, RootWindow(dpy, 0), &tproot, atom) - || !tproot.nitems) - return 0; - - /* Ignore BadWindow errors for this - * routine because the window id stored - * in the property might be old */ - dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler); - for (pt = (const char *) tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) { - if ((pt = strchr(pt, ','))) { - Window win = strtol(pt + 1, NULL, 10); - - if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) { - if (!strncmp((char *) tp.value, DMX_IDENT, strlen(DMX_IDENT))) { - int flag = 0; - - for (i = 0; i < count; i++) - if (!strcmp(list[i], (char *) tp.value)) { - ++flag; - break; - } - if (flag) - continue; - ++retcode; - dmxLogOutputWarning(dmxScreen, - "%s also running on %s\n", - tp.value, dmxScreen->name); - list = reallocarray(list, ++count, sizeof(*list)); - list[count - 1] = malloc(tp.nitems + 2); - strncpy(list[count - 1], (char *) tp.value, tp.nitems + 1); - } - XFree(tp.value); - } - } - } - XSetErrorHandler(dmxOldHandler); - - for (i = 0; i < count; i++) - free(list[i]); - free(list); - XFree(tproot.value); - if (!retcode) - dmxLogOutput(dmxScreen, "No Xdmx server running on backend\n"); - return retcode; -} - -/** Returns NULL if this is the only Xdmx window on the display. - * Otherwise, returns a pointer to the dmxScreen of the other windows on - * the display. */ -static DMXScreenInfo * -dmxPropertyCheckOtherWindows(DMXScreenInfo * dmxScreen, Atom atom) -{ - Display *dpy = dmxScreen->beDisplay; - const unsigned char *id = dmxPropertyIdentifier(); - XTextProperty tproot; - XTextProperty tp; - const char *pt; - int (*dmxOldHandler) (Display *, XErrorEvent *); - - if (!dpy) - return NULL; - - if (!XGetTextProperty(dpy, RootWindow(dpy, 0), &tproot, atom) - || !tproot.nitems) - return 0; - - /* Ignore BadWindow errors for this - * routine because the window id stored - * in the property might be old */ - dmxOldHandler = XSetErrorHandler(dmxPropertyErrorHandler); - for (pt = (const char *) tproot.value; pt && *pt; pt = pt ? pt + 1 : NULL) { - if ((pt = strchr(pt, ','))) { - Window win = strtol(pt + 1, NULL, 10); - - if (XGetTextProperty(dpy, win, &tp, atom) && tp.nitems) { - dmxLog(dmxDebug, "On %s/%lu: %s\n", - dmxScreen->name, (unsigned long) win, tp.value); - if (!strncmp((char *) tp.value, (char *) id, - strlen((char *) id))) { - int idx; - - if (!(pt = strchr((char *) tp.value, ','))) - continue; - idx = strtol(pt + 1, NULL, 10); - if (idx < 0 || idx >= dmxNumScreens) - continue; - if (dmxScreens[idx].scrnWin != win) - continue; - XSetErrorHandler(dmxOldHandler); - return &dmxScreens[idx]; - } - XFree(tp.value); - } - } - } - XSetErrorHandler(dmxOldHandler); - XFree(tproot.value); - return 0; -} - -/** Returns 0 if this is the only Xdmx session on the display; 1 - * otherwise. */ -int -dmxPropertyDisplay(DMXScreenInfo * dmxScreen) -{ - Atom atom; - const unsigned char *id = dmxPropertyIdentifier(); - Display *dpy = dmxScreen->beDisplay; - - if (!dpy) - return 0; - - atom = XInternAtom(dpy, DMX_ATOMNAME, False); - if (dmxPropertyCheckOtherServers(dmxScreen, atom)) { - dmxScreen->shared = 1; - return 1; - } - XChangeProperty(dpy, RootWindow(dpy, 0), atom, XA_STRING, 8, - PropModeReplace, id, strlen((char *) id)); - return 0; -} - -/** Returns 1 if the dmxScreen and the display in \a name are on the - * same display, or 0 otherwise. We can't just compare the display - * names because there can be multiple synonyms for the same display, - * some of which cannot be determined without accessing the display - * itself (e.g., domain aliases or machines with multiple NICs). */ -int -dmxPropertySameDisplay(DMXScreenInfo * dmxScreen, const char *name) -{ - Display *dpy0 = dmxScreen->beDisplay; - Atom atom0; - XTextProperty tp0; - Display *dpy1 = NULL; - Atom atom1; - XTextProperty tp1; - int retval = 0; - - if (!dpy0) - return 0; - - tp0.nitems = 0; - tp1.nitems = 0; - - if ((atom0 = XInternAtom(dpy0, DMX_ATOMNAME, True)) == None) { - dmxLog(dmxWarning, "No atom on %s\n", dmxScreen->name); - return 0; - } - if (!XGetTextProperty(dpy0, RootWindow(dpy0, 0), &tp0, atom0) - || !tp0.nitems) { - dmxLog(dmxWarning, "No text property on %s\n", dmxScreen->name); - return 0; - } - - if (!(dpy1 = XOpenDisplay(name))) { - dmxLog(dmxWarning, "Cannot open %s\n", name); - goto cleanup; - } - atom1 = XInternAtom(dpy1, DMX_ATOMNAME, True); - if (atom1 == None) { - dmxLog(dmxDebug, "No atom on %s\n", name); - goto cleanup; - } - if (!XGetTextProperty(dpy1, RootWindow(dpy1, 0), &tp1, atom1) - || !tp1.nitems) { - dmxLog(dmxDebug, "No text property on %s\n", name); - goto cleanup; - } - if (!strcmp((char *) tp0.value, (char *) tp1.value)) - retval = 1; - - cleanup: - if (tp0.nitems) - XFree(tp0.value); - if (tp1.nitems) - XFree(tp1.value); - if (dpy1) - XCloseDisplay(dpy1); - return retval; -} - -/** Prints a log message if \a dmxScreen is on the same backend X server - * as some other DMX backend (output) screen. Modifies the property - * (#DMX_ATOMNAME) on the backend X server to reflect the creation of \a - * dmxScreen. - * - * The root window of the backend X server holds a list of window ids - * for all DMX windows (on this DMX server or some other DMX server). - * - * This list can then be iterated, and the property for each window can - * be examined. This property contains the following tuple (no quotes): - * - * "#DMX_IDENT:<hostname running DMX>:<display name of DMX>,<screen number>" - */ -void -dmxPropertyWindow(DMXScreenInfo * dmxScreen) -{ - Atom atom; - const unsigned char *id = dmxPropertyIdentifier(); - Display *dpy = dmxScreen->beDisplay; - Window win = dmxScreen->scrnWin; - DMXScreenInfo *other; - char buf[1024]; /* RATS: only used with snprintf */ - - if (!dpy) - return; /* FIXME: What should be done here if Xdmx is started - * with this screen initially detached? - */ - - atom = XInternAtom(dpy, DMX_ATOMNAME, False); - if ((other = dmxPropertyCheckOtherWindows(dmxScreen, atom))) { - DMXScreenInfo *tmp = dmxScreen->next; - - dmxScreen->next = (other->next ? other->next : other); - other->next = (tmp ? tmp : dmxScreen); - dmxLog(dmxDebug, "%d/%s/%lu and %d/%s/%lu are on the same backend\n", - dmxScreen->index, dmxScreen->name, (unsigned long) dmxScreen->scrnWin, - other->index, other->name, (unsigned long) other->scrnWin); - } - - snprintf(buf, sizeof(buf), ".%d,%lu", dmxScreen->index, - (long unsigned) win); - XChangeProperty(dpy, RootWindow(dpy, 0), atom, XA_STRING, 8, - PropModeAppend, (unsigned char *) buf, strlen(buf)); - - snprintf(buf, sizeof(buf), "%s,%d", id, dmxScreen->index); - XChangeProperty(dpy, win, atom, XA_STRING, 8, - PropModeAppend, (unsigned char *) buf, strlen(buf)); -} diff --git a/hw/dmx/dmxprop.h b/hw/dmx/dmxprop.h deleted file mode 100644 index a1170520f..000000000 --- a/hw/dmx/dmxprop.h +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2002,2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for property support. \see dmxprop.c */ - -#ifndef _DMXPROP_H_ -#define _DMXPROP_H_ -extern int dmxPropertyDisplay(DMXScreenInfo * dmxScreen); -extern void dmxPropertyWindow(DMXScreenInfo * dmxScreen); -extern void *dmxPropertyIterate(DMXScreenInfo * start, - void *(*f) (DMXScreenInfo * dmxScreen, - void *closure), void *closure); -extern int dmxPropertySameDisplay(DMXScreenInfo * dmxScreen, const char *name); -#endif diff --git a/hw/dmx/dmxscrinit.c b/hw/dmx/dmxscrinit.c deleted file mode 100644 index 433e31863..000000000 --- a/hw/dmx/dmxscrinit.c +++ /dev/null @@ -1,485 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * This file provides support for screen initialization. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxscrinit.h" -#include "dmxcursor.h" -#include "dmxgc.h" -#include "dmxgcops.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" -#include "dmxfont.h" -#include "dmxcmap.h" -#include "dmxprop.h" -#include "dmxdpms.h" - -#include "dmxpict.h" - -#include "fb.h" -#include "mipointer.h" -#include "micmap.h" - -#include <X11/fonts/libxfont2.h> - -extern Bool dmxCloseScreen(ScreenPtr pScreen); -static Bool dmxSaveScreen(ScreenPtr pScreen, int what); - -static unsigned long dmxGeneration; -static unsigned long *dmxCursorGeneration; - -DevPrivateKeyRec dmxGCPrivateKeyRec; -DevPrivateKeyRec dmxWinPrivateKeyRec; -DevPrivateKeyRec dmxPixPrivateKeyRec; -int dmxFontPrivateIndex; /**< Private index for Fonts */ -DevPrivateKeyRec dmxScreenPrivateKeyRec; -DevPrivateKeyRec dmxColormapPrivateKeyRec; -DevPrivateKeyRec dmxPictPrivateKeyRec; -DevPrivateKeyRec dmxGlyphSetPrivateKeyRec; - -#ifdef DPMSExtension -static void -dmxDPMS(ScreenPtr pScreen, int level) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxDPMSBackend(dmxScreen, level); -} -#else -#define dmxDPMS NULL -#endif - -/** Initialize the parts of screen \a idx that require access to the - * back-end server. */ -void -dmxBEScreenInit(ScreenPtr pScreen) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - XSetWindowAttributes attribs; - unsigned long mask; - int i, j; - - /* FIXME: The dmxScreenInit() code currently assumes that it will - * not be called if the Xdmx server is started with this screen - * detached -- i.e., it assumes that dmxScreen->beDisplay is always - * valid. This is not necessarily a valid assumption when full - * addition/removal of screens is implemented, but when this code is - * broken out for screen reattachment, then we will reevaluate this - * assumption. - */ - - pScreen->mmWidth = DisplayWidthMM(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay)); - pScreen->mmHeight = DisplayHeightMM(dmxScreen->beDisplay, - DefaultScreen(dmxScreen->beDisplay)); - - pScreen->whitePixel = dmxScreen->beWhitePixel; - pScreen->blackPixel = dmxScreen->beBlackPixel; - - /* Handle screen savers and DPMS on the backend */ - if (dmxDPMSInit(dmxScreen)) - pScreen->DPMS = dmxDPMS; - - /* Create root window for screen */ - mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect; - attribs.background_pixel = dmxScreen->beBlackPixel; - attribs.event_mask = (KeyPressMask - | KeyReleaseMask - | ButtonPressMask - | ButtonReleaseMask - | EnterWindowMask - | LeaveWindowMask - | PointerMotionMask - | KeymapStateMask | FocusChangeMask); - attribs.colormap = dmxScreen->beDefColormaps[dmxScreen->beDefVisualIndex]; - attribs.override_redirect = True; - - dmxScreen->scrnWin = - XCreateWindow(dmxScreen->beDisplay, - DefaultRootWindow(dmxScreen->beDisplay), - dmxScreen->scrnX, - dmxScreen->scrnY, - dmxScreen->scrnWidth, - dmxScreen->scrnHeight, - 0, - pScreen->rootDepth, - InputOutput, - dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual, - mask, &attribs); - dmxPropertyWindow(dmxScreen); - - /* - * This turns off the cursor by defining a cursor with no visible - * components. - */ - { - char noCursorData[] = { 0, 0, 0, 0, - 0, 0, 0, 0 - }; - Pixmap pixmap; - XColor color, tmp; - - pixmap = XCreateBitmapFromData(dmxScreen->beDisplay, dmxScreen->scrnWin, - noCursorData, 8, 8); - XAllocNamedColor(dmxScreen->beDisplay, dmxScreen->beDefColormaps[0], - "black", &color, &tmp); - dmxScreen->noCursor = XCreatePixmapCursor(dmxScreen->beDisplay, - pixmap, pixmap, - &color, &color, 0, 0); - XDefineCursor(dmxScreen->beDisplay, dmxScreen->scrnWin, - dmxScreen->noCursor); - - XFreePixmap(dmxScreen->beDisplay, pixmap); - } - - XMapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); - - /* Create default drawables (used during GC creation) */ - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) - for (j = 0; j < dmxScreen->beNumDepths; j++) - if ((dmxScreen->bePixmapFormats[i].depth == 1) || - (dmxScreen->bePixmapFormats[i].depth == - dmxScreen->beDepths[j])) { - dmxScreen->scrnDefDrawables[i] = (Drawable) - XCreatePixmap(dmxScreen->beDisplay, dmxScreen->scrnWin, - 1, 1, - dmxScreen->bePixmapFormats[i].depth); - break; - } -} - -/** Initialize screen number \a pScreen->myNum. */ -Bool -dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - int i, j; - - if (!dixRegisterPrivateKey(&dmxScreenPrivateKeyRec, PRIVATE_SCREEN, 0)) - return FALSE; - if (!dixRegisterPrivateKey(&dmxColormapPrivateKeyRec, PRIVATE_COLORMAP, 0)) - return FALSE; - if (!dixRegisterPrivateKey(&dmxGlyphSetPrivateKeyRec, PRIVATE_GLYPHSET, 0)) - return FALSE; - - if (dmxGeneration != serverGeneration) { - /* Allocate font private index */ - dmxFontPrivateIndex = xfont2_allocate_font_private_index(); - if (dmxFontPrivateIndex == -1) - return FALSE; - - dmxGeneration = serverGeneration; - } - - if (!dmxInitGC(pScreen)) - return FALSE; - if (!dmxInitWindow(pScreen)) - return FALSE; - if (!dmxInitPixmap(pScreen)) - return FALSE; - - /* - * Initialise the visual types. miSetVisualTypesAndMasks() requires - * that all of the types for each depth be collected together. It's - * intended for slightly different usage to what we would like here. - * Maybe a miAddVisualTypeAndMask() function will be added to make - * things easier here. - */ - for (i = 0; i < dmxScreen->beNumDepths; i++) { - int depth; - int visuals = 0; - int bitsPerRgb = 0; - int preferredClass = -1; - Pixel redMask = 0; - Pixel greenMask = 0; - Pixel blueMask = 0; - - depth = dmxScreen->beDepths[i]; - for (j = 0; j < dmxScreen->beNumVisuals; j++) { - XVisualInfo *vi; - - vi = &dmxScreen->beVisuals[j]; - if (vi->depth == depth) { - /* Assume the masks are all the same. */ - visuals |= (1 << vi->class); - bitsPerRgb = vi->bits_per_rgb; - redMask = vi->red_mask; - greenMask = vi->green_mask; - blueMask = vi->blue_mask; - if (j == dmxScreen->beDefVisualIndex) { - preferredClass = vi->class; - } - } - } - miSetVisualTypesAndMasks(depth, visuals, bitsPerRgb, preferredClass, - redMask, greenMask, blueMask); - } - - fbScreenInit(pScreen, - NULL, - dmxScreen->scrnWidth, - dmxScreen->scrnHeight, - dmxScreen->beXDPI, - dmxScreen->beXDPI, dmxScreen->scrnWidth, dmxScreen->beBPP); - (void) dmxPictureInit(pScreen, 0, 0); - - /* Not yet... */ - pScreen->GetWindowPixmap = NULL; - pScreen->SetWindowPixmap = NULL; - - MAXSCREENSALLOC(dmxCursorGeneration); - if (dmxCursorGeneration[pScreen->myNum] != serverGeneration) { - if (!(miPointerInitialize(pScreen, - &dmxPointerSpriteFuncs, - &dmxPointerCursorFuncs, FALSE))) - return FALSE; - - dmxCursorGeneration[pScreen->myNum] = serverGeneration; - } - - DMX_WRAP(CloseScreen, dmxCloseScreen, dmxScreen, pScreen); - DMX_WRAP(SaveScreen, dmxSaveScreen, dmxScreen, pScreen); - - dmxBEScreenInit(pScreen); - - /* Wrap GC functions */ - DMX_WRAP(CreateGC, dmxCreateGC, dmxScreen, pScreen); - - /* Wrap Window functions */ - DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); - DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); - DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); - DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, - pScreen); - DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); - DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); - DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); - DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); - DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); - - DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); - DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); - - DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); - - /* Wrap Image functions */ - DMX_WRAP(GetImage, dmxGetImage, dmxScreen, pScreen); - DMX_WRAP(GetSpans, dmxGetSpans, dmxScreen, pScreen); - - /* Wrap Pixmap functions */ - DMX_WRAP(CreatePixmap, dmxCreatePixmap, dmxScreen, pScreen); - DMX_WRAP(DestroyPixmap, dmxDestroyPixmap, dmxScreen, pScreen); - DMX_WRAP(BitmapToRegion, dmxBitmapToRegion, dmxScreen, pScreen); - - /* Wrap Font functions */ - DMX_WRAP(RealizeFont, dmxRealizeFont, dmxScreen, pScreen); - DMX_WRAP(UnrealizeFont, dmxUnrealizeFont, dmxScreen, pScreen); - - /* Wrap Colormap functions */ - DMX_WRAP(CreateColormap, dmxCreateColormap, dmxScreen, pScreen); - DMX_WRAP(DestroyColormap, dmxDestroyColormap, dmxScreen, pScreen); - DMX_WRAP(InstallColormap, dmxInstallColormap, dmxScreen, pScreen); - DMX_WRAP(StoreColors, dmxStoreColors, dmxScreen, pScreen); - - /* Wrap Shape functions */ - DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); - - if (!dmxCreateDefColormap(pScreen)) - return FALSE; - - return TRUE; -} - -/** Close the \a pScreen resources on the back-end server. */ -void -dmxBECloseScreen(ScreenPtr pScreen) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - int i; - - /* Restore the back-end screen-saver and DPMS state. */ - dmxDPMSTerm(dmxScreen); - - /* Free the screen resources */ - - XFreeCursor(dmxScreen->beDisplay, dmxScreen->noCursor); - dmxScreen->noCursor = (Cursor) 0; - - XUnmapWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); - XDestroyWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); - dmxScreen->scrnWin = (Window) 0; - - /* Free the default drawables */ - for (i = 0; i < dmxScreen->beNumPixmapFormats; i++) { - if (dmxScreen->scrnDefDrawables[i]) { - XFreePixmap(dmxScreen->beDisplay, - dmxScreen->scrnDefDrawables[i]); - dmxScreen->scrnDefDrawables[i] = (Drawable) 0; - } - } - - /* Free resources allocated during initialization (in dmxinit.c) */ - for (i = 0; i < dmxScreen->beNumDefColormaps; i++) - XFreeColormap(dmxScreen->beDisplay, dmxScreen->beDefColormaps[i]); - free(dmxScreen->beDefColormaps); - dmxScreen->beDefColormaps = NULL; - -#if 0 - /* Do not free visuals, depths and pixmap formats here. Free them - * in dmxCloseScreen() instead -- see comment below. */ - XFree(dmxScreen->beVisuals); - dmxScreen->beVisuals = NULL; - - XFree(dmxScreen->beDepths); - dmxScreen->beDepths = NULL; - - XFree(dmxScreen->bePixmapFormats); - dmxScreen->bePixmapFormats = NULL; -#endif - -#ifdef GLXEXT - if (dmxScreen->glxVisuals) { - XFree(dmxScreen->glxVisuals); - dmxScreen->glxVisuals = NULL; - dmxScreen->numGlxVisuals = 0; - } -#endif - - /* Close display */ - XCloseDisplay(dmxScreen->beDisplay); - dmxScreen->beDisplay = NULL; -} - -/** Close screen number \a idx. */ -Bool -dmxCloseScreen(ScreenPtr pScreen) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - /* Reset the proc vectors */ - if (pScreen->myNum == 0) { - dmxResetRender(); - dmxResetFonts(); - } - - /* Unwrap Shape functions */ - DMX_UNWRAP(SetShape, dmxScreen, pScreen); - - /* Unwrap the pScreen functions */ - DMX_UNWRAP(CreateGC, dmxScreen, pScreen); - - DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); - DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); - DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); - DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); - DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); - DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); - DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); - DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); - DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); - - DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); - DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); - - DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); - - DMX_UNWRAP(GetImage, dmxScreen, pScreen); - DMX_UNWRAP(GetSpans, dmxScreen, pScreen); - - DMX_UNWRAP(CreatePixmap, dmxScreen, pScreen); - DMX_UNWRAP(DestroyPixmap, dmxScreen, pScreen); - DMX_UNWRAP(BitmapToRegion, dmxScreen, pScreen); - - DMX_UNWRAP(RealizeFont, dmxScreen, pScreen); - DMX_UNWRAP(UnrealizeFont, dmxScreen, pScreen); - - DMX_UNWRAP(CreateColormap, dmxScreen, pScreen); - DMX_UNWRAP(DestroyColormap, dmxScreen, pScreen); - DMX_UNWRAP(InstallColormap, dmxScreen, pScreen); - DMX_UNWRAP(StoreColors, dmxScreen, pScreen); - - DMX_UNWRAP(SaveScreen, dmxScreen, pScreen); - - if (dmxScreen->beDisplay) { - dmxBECloseScreen(pScreen); - -#if 1 - /* Free visuals, depths and pixmap formats here so that they - * won't be freed when a screen is detached, thereby allowing - * the screen to be reattached to be compared to the one - * previously removed. - */ - XFree(dmxScreen->beVisuals); - dmxScreen->beVisuals = NULL; - - XFree(dmxScreen->beDepths); - dmxScreen->beDepths = NULL; - - XFree(dmxScreen->bePixmapFormats); - dmxScreen->bePixmapFormats = NULL; -#endif - } - - DMX_UNWRAP(CloseScreen, dmxScreen, pScreen); - return pScreen->CloseScreen(pScreen); -} - -static Bool -dmxSaveScreen(ScreenPtr pScreen, int what) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - - if (dmxScreen->beDisplay) { - switch (what) { - case SCREEN_SAVER_OFF: - case SCREEN_SAVER_FORCER: - XResetScreenSaver(dmxScreen->beDisplay); - dmxSync(dmxScreen, FALSE); - break; - case SCREEN_SAVER_ON: - case SCREEN_SAVER_CYCLE: - XActivateScreenSaver(dmxScreen->beDisplay); - dmxSync(dmxScreen, FALSE); - break; - } - } - - return TRUE; -} diff --git a/hw/dmx/dmxscrinit.h b/hw/dmx/dmxscrinit.h deleted file mode 100644 index 9fe9c9844..000000000 --- a/hw/dmx/dmxscrinit.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Interface for screen initialization. \see dmxscrinit.c */ - -#ifndef DMXSCRINIT_H -#define DMXSCRINIT_H - -#include "scrnintstr.h" - -extern Bool dmxScreenInit(ScreenPtr pScreen, int argc, char *argv[]); - -extern void dmxBEScreenInit(ScreenPtr pScreen); -extern void dmxBECloseScreen(ScreenPtr pScreen); - -#endif /* DMXSCRINIT_H */ diff --git a/hw/dmx/dmxstat.c b/hw/dmx/dmxstat.c deleted file mode 100644 index 0ae5107a4..000000000 --- a/hw/dmx/dmxstat.c +++ /dev/null @@ -1,238 +0,0 @@ -/* - * Copyright 2002, 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * The DMX server code is written to call #dmxSync() whenever an XSync() - * might be necessary. However, since XSync() requires a two way - * communication with the other X server, eliminating unnecessary - * XSync() calls is a key performance optimization. Support for this - * optimization is provided in \a dmxsync.c. This file provides routines - * that evaluate this optimization by counting the number of XSync() - * calls and monitoring their latency. This functionality can be turned - * on using the -stat command-line parameter. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxstat.h" -#include "dmxlog.h" -#include <X11/Xos.h> /* For sys/time.h */ - -/** Used to compute a running average of value. */ -typedef struct _DMXStatAvg { - int pos; - int count; - unsigned long value[DMX_STAT_LENGTH]; -} DMXStatAvg; - -/** Statistical information about XSync calls. */ -struct _DMXStatInfo { - unsigned long syncCount; - unsigned long oldSyncCount; - - DMXStatAvg usec; - DMXStatAvg pending; - - unsigned long bins[DMX_STAT_BINS]; -}; - -/* Interval in mS between statistic message log entries. */ -int dmxStatInterval; -static int dmxStatDisplays; -static OsTimerPtr dmxStatTimer; - -/** Return the number of microseconds as an unsigned long. - * Unfortunately, this is only useful for intervals < about 4 sec. */ -static unsigned long -usec(struct timeval *stop, struct timeval *start) -{ - return (stop->tv_sec - start->tv_sec) * 1000000 - + stop->tv_usec - start->tv_usec; -} - -static unsigned long -avg(DMXStatAvg * data, unsigned long *max) -{ - unsigned long sum; - int i; - - *max = 0; - if (!data->count) - return 0; - - for (i = 0, sum = 0; i < data->count; i++) { - if (data->value[i] > *max) - *max = data->value[i]; - sum += data->value[i]; - } - return sum / data->count; -} - -/** Turn on XSync statistic gathering and printing. Print every \a - * interval seconds, with lines for the first \a displays. If \a - * interval is NULL, 1 will be used. If \a displays is NULL, 0 will be - * used (meaning a line for every display will be printed). Note that - * this function takes string arguments because it will usually be - * called from #ddxProcessArgument in \a dmxinit.c. */ -void -dmxStatActivate(const char *interval, const char *displays) -{ - dmxStatInterval = (interval ? atoi(interval) : 1) * 1000; - dmxStatDisplays = (displays ? atoi(displays) : 0); - - if (dmxStatInterval < 1000) - dmxStatInterval = 1000; - if (dmxStatDisplays < 0) - dmxStatDisplays = 0; -} - -/** Allocate a \a DMXStatInfo structure. */ -DMXStatInfo * -dmxStatAlloc(void) -{ - DMXStatInfo *pt = calloc(1, sizeof(*pt)); - - return pt; -} - -/** Free the memory used by a \a DMXStatInfo structure. */ -void -dmxStatFree(DMXStatInfo * pt) -{ - free(pt); -} - -static void -dmxStatValue(DMXStatAvg * data, unsigned long value) -{ - if (data->count != DMX_STAT_LENGTH) - ++data->count; - if (data->pos >= DMX_STAT_LENGTH - 1) - data->pos = 0; - data->value[data->pos++] = value; -} - -/** Note that a XSync() was just done on \a dmxScreen with the \a start - * and \a stop times (from gettimeofday()) and the number of - * pending-but-not-yet-processed XSync requests. This routine is called - * from #dmxDoSync in \a dmxsync.c */ -void -dmxStatSync(DMXScreenInfo * dmxScreen, - struct timeval *stop, struct timeval *start, unsigned long pending) -{ - DMXStatInfo *s = dmxScreen->stat; - unsigned long elapsed = usec(stop, start); - unsigned long thresh; - int i; - - ++s->syncCount; - dmxStatValue(&s->usec, elapsed); - dmxStatValue(&s->pending, pending); - - for (i = 0, thresh = DMX_STAT_BIN0; i < DMX_STAT_BINS - 1; i++) { - if (elapsed < thresh) { - ++s->bins[i]; - break; - } - thresh *= DMX_STAT_BINMULT; - } - if (i == DMX_STAT_BINS - 1) - ++s->bins[i]; -} - -/* Actually do the work of printing out the human-readable message. */ -static CARD32 -dmxStatCallback(OsTimerPtr timer, CARD32 t, void *arg) -{ - int i, j; - static int header = 0; - int limit = dmxNumScreens; - - if (!dmxNumScreens) { - header = 0; - return DMX_STAT_INTERVAL; - } - - if (!header++ || !(header % 10)) { - dmxLog(dmxDebug, - " S SyncCount Sync/s avSync mxSync avPend mxPend | " - "<10ms <1s >1s\n"); - } - - if (dmxStatDisplays && dmxStatDisplays < limit) - limit = dmxStatDisplays; - for (i = 0; i < limit; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - DMXStatInfo *s = dmxScreen->stat; - unsigned long aSync, mSync; - unsigned long aPend, mPend; - - if (!s) - continue; - - aSync = avg(&s->usec, &mSync); - aPend = avg(&s->pending, &mPend); - dmxLog(dmxDebug, "%2d %9lu %7lu %6lu %6lu %6lu %6lu |", i, /* S */ - s->syncCount, /* SyncCount */ - (s->syncCount - s->oldSyncCount) * 1000 / dmxStatInterval, /* Sync/s */ - aSync, /* us/Sync */ - mSync, /* max/Sync */ - aPend, /* avgPend */ - mPend); /* maxPend */ - for (j = 0; j < DMX_STAT_BINS; j++) - dmxLogCont(dmxDebug, " %5lu", s->bins[j]); - dmxLogCont(dmxDebug, "\n"); - - /* Reset/clear */ - s->oldSyncCount = s->syncCount; - for (j = 0; j < DMX_STAT_BINS; j++) - s->bins[j] = 0; - } - return DMX_STAT_INTERVAL; /* Place on queue again */ -} - -/** Try to initialize the statistic gathering and printing routines. - * Initialization only takes place if #dmxStatActivate has already been - * called. We don't need the same generation protection that we used in - * dmxSyncInit because our timer is always on a queue -- hence, server - * generation will always free it. */ -void -dmxStatInit(void) -{ - if (dmxStatInterval) - dmxStatTimer = TimerSet(NULL, 0, - dmxStatInterval, dmxStatCallback, NULL); -} diff --git a/hw/dmx/dmxstat.h b/hw/dmx/dmxstat.h deleted file mode 100644 index 8c8d7bae5..000000000 --- a/hw/dmx/dmxstat.h +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for statistic gathering interface. \see dmxstat.c */ - -#ifndef _DMXSTAT_H_ -#define _DMXSTAT_H_ - -#define DMX_STAT_LENGTH 10 /**< number of events for moving average */ -#define DMX_STAT_INTERVAL 1000 /**< msec between printouts */ -#define DMX_STAT_BINS 3 /**< number of bins */ -#define DMX_STAT_BIN0 10000 /**< us for bin[0] */ -#define DMX_STAT_BINMULT 100 /**< multiplier for next bin[] */ - -extern int dmxStatInterval; /**< Only for dmxstat.c and dmxsync.c */ -extern void dmxStatActivate(const char *interval, const char *displays); -extern DMXStatInfo *dmxStatAlloc(void); -extern void dmxStatFree(DMXStatInfo *); -extern void dmxStatInit(void); -extern void dmxStatSync(DMXScreenInfo * dmxScreen, - struct timeval *stop, struct timeval *start, - unsigned long pending); - -#endif diff --git a/hw/dmx/dmxsync.c b/hw/dmx/dmxsync.c deleted file mode 100644 index ce20c84a5..000000000 --- a/hw/dmx/dmxsync.c +++ /dev/null @@ -1,207 +0,0 @@ -/* - * Copyright 2002-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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * The DMX server code is written to call #dmxSync() whenever an XSync() - * might be necessary. However, since XSync() requires a two way - * communication with the other X server, eliminating unnecessary - * XSync() calls is a key performance optimization. Support for this - * optimization is provided here. Statistics about XSync() calls and - * latency are gathered in \a dmxstat.c. - * - * During the initial conversion from calling XSync() immediately to the - * XSync() batching method implemented in this file, it was noted that, - * out of more than 300 \a x11perf tests, 8 tests became more than 100 - * times faster, with 68 more than 50X faster, 114 more than 10X faster, - * and 181 more than 2X faster. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxstat.h" -#include "dmxlog.h" -#include <sys/time.h> - -static int dmxSyncInterval = 100; /* Default interval in milliseconds */ -static OsTimerPtr dmxSyncTimer; -static int dmxSyncPending; - -static void -dmxDoSync(DMXScreenInfo * dmxScreen) -{ - dmxScreen->needsSync = FALSE; - - if (!dmxScreen->beDisplay) - return; /* FIXME: Is this correct behavior for sync stats? */ - - if (!dmxStatInterval) { - XSync(dmxScreen->beDisplay, False); - } - else { - struct timeval start, stop; - - gettimeofday(&start, 0); - XSync(dmxScreen->beDisplay, False); - gettimeofday(&stop, 0); - dmxStatSync(dmxScreen, &stop, &start, dmxSyncPending); - } -} - -static CARD32 -dmxSyncCallback(OsTimerPtr timer, CARD32 time, void *arg) -{ - int i; - - if (dmxSyncPending) { - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxScreen->needsSync) - dmxDoSync(dmxScreen); - } - } - dmxSyncPending = 0; - return 0; /* Do not place on queue again */ -} - -static void -dmxSyncBlockHandler(void *blockData, void *timeout) -{ - TimerForce(dmxSyncTimer); -} - -static void -dmxSyncWakeupHandler(void *blockData, int result) -{ -} - -/** Request the XSync() batching optimization with the specified \a - * interval (in mS). If the \a interval is 0, 100mS is used. If the \a - * interval is less than 0, then the XSync() batching optimization is - * not requested (e.g., so the -syncbatch -1 command line option can - * turn off the default 100mS XSync() batching). - * - * Note that the parameter to this routine is a string, since it will - * usually be called from #ddxProcessArgument in \a dmxinit.c */ -void -dmxSyncActivate(const char *interval) -{ - dmxSyncInterval = (interval ? atoi(interval) : 100); - - if (dmxSyncInterval < 0) - dmxSyncInterval = 0; -} - -/** Initialize the XSync() batching optimization, but only if - * #dmxSyncActivate was last called with a non-negative value. */ -void -dmxSyncInit(void) -{ - if (dmxSyncInterval) { - RegisterBlockAndWakeupHandlers(dmxSyncBlockHandler, - dmxSyncWakeupHandler, NULL); - dmxLog(dmxInfo, "XSync batching with %d ms interval\n", - dmxSyncInterval); - } - else { - dmxLog(dmxInfo, "XSync batching disabled\n"); - } -} - -/** Request an XSync() to the display used by \a dmxScreen. If \a now - * is TRUE, call XSync() immediately instead of waiting for the next - * XSync() batching point. Note that if XSync() batching was deselected - * with #dmxSyncActivate() before #dmxSyncInit() was called, then no - * XSync() batching is performed and this function always calls XSync() - * immediately. - * - * (Note that this function uses TimerSet but works correctly in the - * face of a server generation. See the source for details.) - * - * If \a dmxScreen is \a NULL, then all pending syncs will be flushed - * immediately. - */ -void -dmxSync(DMXScreenInfo * dmxScreen, Bool now) -{ - static unsigned long dmxGeneration = 0; - - if (dmxSyncInterval) { - if (dmxGeneration != serverGeneration) { - /* Server generation does a TimerInit, which frees all - * timers. So, at this point dmxSyncTimer is either: - * 1) NULL, iff dmxGeneration == 0, - * 2) freed, if it was on a queue (dmxSyncPending != 0), or - * 3) allocated, if it wasn't on a queue (dmxSyncPending == 0) - */ - if (dmxSyncTimer && !dmxSyncPending) - free(dmxSyncTimer); - dmxSyncTimer = NULL; - now = TRUE; - dmxGeneration = serverGeneration; - } - /* Queue sync */ - if (dmxScreen) { - dmxScreen->needsSync = TRUE; - ++dmxSyncPending; - } - - /* Do sync or set time for later */ - if (now || !dmxScreen) { - if (dmxSyncTimer == NULL || !TimerForce(dmxSyncTimer)) - dmxSyncCallback(NULL, 0, NULL); - /* At this point, dmxSyncPending == 0 because - * dmxSyncCallback must have been called. */ - if (dmxSyncPending) - dmxLog(dmxFatal, "dmxSync(%s,%d): dmxSyncPending = %d\n", - dmxScreen ? dmxScreen->name : "", now, dmxSyncPending); - } - else { - dmxScreen->needsSync = TRUE; - if (dmxSyncPending == 1) - dmxSyncTimer = TimerSet(dmxSyncTimer, 0, dmxSyncInterval, - dmxSyncCallback, NULL); - } - } - else { - /* If dmxSyncInterval is not being used, - * then all the backends are already - * up-to-date. */ - if (dmxScreen) - dmxDoSync(dmxScreen); - } -} diff --git a/hw/dmx/dmxsync.h b/hw/dmx/dmxsync.h deleted file mode 100644 index d67ae09c6..000000000 --- a/hw/dmx/dmxsync.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for sync support. \see dmxsync.c */ - -#ifndef _DMXSYNC_H_ -#define _DMXSYNC_H_ - -extern void dmxSyncActivate(const char *interval); -extern void dmxSyncInit(void); -extern void dmxSync(DMXScreenInfo * dmxScreen, Bool now); -#endif diff --git a/hw/dmx/dmxvisual.c b/hw/dmx/dmxvisual.c deleted file mode 100644 index 23b9bddea..000000000 --- a/hw/dmx/dmxvisual.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - * Copyright 2002-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> - * - */ - -/** \file - * This file provides support for visuals. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxvisual.h" - -#include "scrnintstr.h" - -#ifdef GLXEXT - -#include <GL/glxint.h> - -extern VisualID glxMatchVisualInConfigList(ScreenPtr pScreen, - VisualPtr pVisual, - __GLXvisualConfig * configs, - int nconfigs); - -static Visual * -dmxLookupGLXVisual(ScreenPtr pScreen, VisualPtr pVisual) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - int j; - VisualID vid; - - vid = glxMatchVisualInConfigList(pScreen, pVisual, - dmxScreen->glxVisuals, - dmxScreen->numGlxVisuals); - if (vid) { - /* Find the X visual of the matching GLX visual */ - for (j = 0; j < dmxScreen->beNumVisuals; j++) - if (vid == dmxScreen->beVisuals[j].visualid) - return dmxScreen->beVisuals[j].visual; - } - - /* No matching visual found */ - return NULL; -} -#endif - -/** Return the visual that matched \a pVisual. */ -Visual * -dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - int i; - -#ifdef GLXEXT - Visual *retval; -#endif - - if (!dmxScreen->beDisplay) - return NULL; - -#ifdef GLXEXT - if ((retval = dmxLookupGLXVisual(pScreen, pVisual))) - return retval; -#endif - - for (i = 0; i < dmxScreen->beNumVisuals; i++) { - if (pVisual->class == dmxScreen->beVisuals[i].class && - pVisual->bitsPerRGBValue == dmxScreen->beVisuals[i].bits_per_rgb && - pVisual->ColormapEntries == dmxScreen->beVisuals[i].colormap_size && - pVisual->nplanes == dmxScreen->beVisuals[i].depth && - pVisual->redMask == dmxScreen->beVisuals[i].red_mask && - pVisual->greenMask == dmxScreen->beVisuals[i].green_mask && - pVisual->blueMask == dmxScreen->beVisuals[i].blue_mask) { - return dmxScreen->beVisuals[i].visual; - } - } - - return NULL; -} - -/** Return the visual that matched the \a vid. */ -Visual * -dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid) -{ - Visual *visual; - int i; - - if (!dmxScreens[pScreen->myNum].beDisplay) - return NULL; - - for (i = 0; i < pScreen->numVisuals; i++) { - if (pScreen->visuals[i].vid == vid) { - visual = dmxLookupVisual(pScreen, &pScreen->visuals[i]); - if (visual) - return visual; - } - } - - return NULL; -} - -/** Return the colormap for the \a visual. */ -Colormap -dmxColormapFromDefaultVisual(ScreenPtr pScreen, Visual * visual) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - int i; - - if (dmxScreen->beDisplay) { - for (i = 0; i < dmxScreen->beNumDefColormaps; i++) - if (visual == dmxScreen->beVisuals[i].visual) - return dmxScreen->beDefColormaps[i]; - } - - return None; -} diff --git a/hw/dmx/dmxvisual.h b/hw/dmx/dmxvisual.h deleted file mode 100644 index 4d97df927..000000000 --- a/hw/dmx/dmxvisual.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 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> - * - */ - -/** \file - * Interface for visual support. \see dmxvisual.c */ - -#ifndef DMXVISUAL_H -#define DMXVISUAL_H - -#include "scrnintstr.h" - -extern Visual *dmxLookupVisual(ScreenPtr pScreen, VisualPtr pVisual); -extern Visual *dmxLookupVisualFromID(ScreenPtr pScreen, VisualID vid); -extern Colormap dmxColormapFromDefaultVisual(ScreenPtr pScreen, - Visual * visual); - -#endif /* DMXVISUAL_H */ diff --git a/hw/dmx/dmxwindow.c b/hw/dmx/dmxwindow.c deleted file mode 100644 index 56c6c9825..000000000 --- a/hw/dmx/dmxwindow.c +++ /dev/null @@ -1,1044 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * This file provides support for window-related functions. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxsync.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" -#include "dmxcmap.h" -#include "dmxvisual.h" -#include "dmxinput.h" -#include "dmxextension.h" -#include "dmxpict.h" - -#include "windowstr.h" - -static void dmxDoRestackWindow(WindowPtr pWindow); -static void dmxDoChangeWindowAttributes(WindowPtr pWindow, - unsigned long *mask, - XSetWindowAttributes * attribs); - -static void dmxDoSetShape(WindowPtr pWindow); - -/** Initialize the private area for the window functions. */ -Bool -dmxInitWindow(ScreenPtr pScreen) -{ - if (!dixRegisterPrivateKey - (&dmxWinPrivateKeyRec, PRIVATE_WINDOW, sizeof(dmxWinPrivRec))) - return FALSE; - - return TRUE; -} - -Window -dmxCreateRootWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - Window parent; - Visual *visual; - unsigned long mask; - XSetWindowAttributes attribs; - ColormapPtr pCmap; - dmxColormapPrivPtr pCmapPriv; - - /* Create root window */ - - parent = dmxScreen->scrnWin; /* This is our "Screen" window */ - visual = dmxScreen->beVisuals[dmxScreen->beDefVisualIndex].visual; - - dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), - RT_COLORMAP, NullClient, DixUnknownAccess); - pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); - - mask = CWEventMask | CWBackingStore | CWColormap | CWBorderPixel; - attribs.event_mask = ExposureMask; - attribs.backing_store = NotUseful; - attribs.colormap = pCmapPriv->cmap; - attribs.border_pixel = 0; - - /* Incorporate new attributes, if needed */ - if (pWinPriv->attribMask) { - dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs); - mask |= pWinPriv->attribMask; - } - - return XCreateWindow(dmxScreen->beDisplay, - parent, - pWindow->origin.x - wBorderWidth(pWindow), - pWindow->origin.y - wBorderWidth(pWindow), - pWindow->drawable.width, - pWindow->drawable.height, - pWindow->borderWidth, - pWindow->drawable.depth, - pWindow->drawable.class, visual, mask, &attribs); -} - -/** Change the location and size of the "screen" window. Called from - * dmxextension.c dmxConfigureScreenWindow(). */ -void -dmxResizeScreenWindow(ScreenPtr pScreen, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - unsigned int m; - XWindowChanges c; - - if (!dmxScreen->beDisplay) - return; - - /* Handle resizing on back-end server */ - m = CWX | CWY | CWWidth | CWHeight; - c.x = x; - c.y = y; - c.width = w; - c.height = h; - - XConfigureWindow(dmxScreen->beDisplay, dmxScreen->scrnWin, m, &c); - dmxSync(dmxScreen, False); -} - -/** Change the location and size of the "root" window. Called from - * #dmxCreateWindow. */ -void -dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[pRoot->drawable.pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pRoot); - unsigned int m; - XWindowChanges c; - - /* Handle resizing on back-end server */ - if (dmxScreen->beDisplay) { - m = CWX | CWY | CWWidth | CWHeight; - c.x = x; - c.y = y; - c.width = (w > 0) ? w : 1; - c.height = (h > 0) ? h : 1; - - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - } - - if (w == 0 || h == 0) { - if (pWinPriv->mapped) { - if (dmxScreen->beDisplay) - XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window); - pWinPriv->mapped = FALSE; - } - } - else if (!pWinPriv->mapped) { - if (dmxScreen->beDisplay) - XMapWindow(dmxScreen->beDisplay, pWinPriv->window); - pWinPriv->mapped = TRUE; - } - - if (dmxScreen->beDisplay) - dmxSync(dmxScreen, False); -} - -void -dmxGetDefaultWindowAttributes(WindowPtr pWindow, - Colormap * cmap, Visual ** visual) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - - if (pWindow->drawable.class != InputOnly && - pWindow->optional && - pWindow->optional->visual != wVisual(pWindow->parent)) { - - /* Find the matching visual */ - *visual = dmxLookupVisualFromID(pScreen, wVisual(pWindow)); - - /* Handle optional colormaps */ - if (pWindow->optional->colormap) { - ColormapPtr pCmap; - dmxColormapPrivPtr pCmapPriv; - - dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), - RT_COLORMAP, NullClient, DixUnknownAccess); - pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); - *cmap = pCmapPriv->cmap; - } - else { - *cmap = dmxColormapFromDefaultVisual(pScreen, *visual); - } - } - else { - *visual = CopyFromParent; - *cmap = (Colormap) 0; - } -} - -static Window -dmxCreateNonRootWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - Window parent; - unsigned long mask = 0L; - XSetWindowAttributes attribs; - dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent); - - /* Create window on back-end server */ - - parent = pParentPriv->window; - - /* The parent won't exist if this call to CreateNonRootWindow came - from ReparentWindow and the grandparent window has not yet been - created */ - if (!parent) { - dmxCreateAndRealizeWindow(pWindow->parent, FALSE); - parent = pParentPriv->window; - } - - /* Incorporate new attributes, if needed */ - if (pWinPriv->attribMask) { - dmxDoChangeWindowAttributes(pWindow, &pWinPriv->attribMask, &attribs); - mask |= pWinPriv->attribMask; - } - - /* Add in default attributes */ - if (pWindow->drawable.class != InputOnly) { - mask |= CWBackingStore; - attribs.backing_store = NotUseful; - - if (!(mask & CWColormap) && pWinPriv->cmap) { - mask |= CWColormap; - attribs.colormap = pWinPriv->cmap; - if (!(mask & CWBorderPixel)) { - mask |= CWBorderPixel; - attribs.border_pixel = 0; - } - } - } - - /* Handle case where subwindows are being mapped, but created out of - order -- if current window has a previous sibling, then it cannot - be created on top of the stack, so we must restack the windows */ - pWinPriv->restacked = (pWindow->prevSib != NullWindow); - - return XCreateWindow(dmxScreen->beDisplay, - parent, - pWindow->origin.x - wBorderWidth(pWindow), - pWindow->origin.y - wBorderWidth(pWindow), - pWindow->drawable.width, - pWindow->drawable.height, - pWindow->borderWidth, - pWindow->drawable.depth, - pWindow->drawable.class, - pWinPriv->visual, mask, &attribs); -} - -/** This function handles lazy window creation and realization. Window - * creation is handled by #dmxCreateNonRootWindow(). It also handles - * any stacking changes that have occurred since the window was - * originally created by calling #dmxDoRestackWindow(). If the window - * is shaped, the shape is set on the back-end server by calling - * #dmxDoSetShape(), and if the window has pictures (from RENDER) - * associated with it, those pictures are created on the back-end - * server by calling #dmxCreatePictureList(). If \a doSync is TRUE, - * then #dmxSync() is called. */ -void -dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - if (!dmxScreen->beDisplay) - return; - - pWinPriv->window = dmxCreateNonRootWindow(pWindow); - if (pWinPriv->restacked) - dmxDoRestackWindow(pWindow); - if (pWinPriv->isShaped) - dmxDoSetShape(pWindow); - if (pWinPriv->hasPict) - dmxCreatePictureList(pWindow); - if (pWinPriv->mapped) - XMapWindow(dmxScreen->beDisplay, pWinPriv->window); - if (doSync) - dmxSync(dmxScreen, False); -} - -/** Create \a pWindow on the back-end server. If the lazy window - * creation optimization is enabled, then the actual creation and - * realization of the window is handled by - * #dmxCreateAndRealizeWindow(). */ -Bool -dmxCreateWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - Bool ret = TRUE; - - DMX_UNWRAP(CreateWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->CreateWindow) - ret = pScreen->CreateWindow(pWindow); -#endif - - /* Set up the defaults */ - pWinPriv->window = (Window) 0; - pWinPriv->offscreen = TRUE; - pWinPriv->mapped = FALSE; - pWinPriv->restacked = FALSE; - pWinPriv->attribMask = 0; - pWinPriv->isShaped = FALSE; - pWinPriv->hasPict = FALSE; -#ifdef GLXEXT - pWinPriv->swapGroup = NULL; - pWinPriv->barrier = 0; -#endif - - if (dmxScreen->beDisplay) { - /* Only create the root window at this stage -- non-root windows are - created when they are mapped and are on-screen */ - if (!pWindow->parent) { - dmxScreen->rootWin = pWinPriv->window - = dmxCreateRootWindow(pWindow); - if (dmxScreen->scrnX != dmxScreen->rootX - || dmxScreen->scrnY != dmxScreen->rootY - || dmxScreen->scrnWidth != dmxScreen->rootWidth - || dmxScreen->scrnHeight != dmxScreen->rootHeight) { - dmxResizeRootWindow(pWindow, - dmxScreen->rootX, - dmxScreen->rootY, - dmxScreen->rootWidth, - dmxScreen->rootHeight); - dmxUpdateScreenResources(screenInfo.screens[dmxScreen->index], - dmxScreen->rootX, - dmxScreen->rootY, - dmxScreen->rootWidth, - dmxScreen->rootHeight); - pWindow->origin.x = dmxScreen->rootX; - pWindow->origin.y = dmxScreen->rootY; - } - } - else { - dmxGetDefaultWindowAttributes(pWindow, - &pWinPriv->cmap, &pWinPriv->visual); - - if (dmxLazyWindowCreation) { - /* Save parent's visual for use later */ - if (pWinPriv->visual == CopyFromParent) - pWinPriv->visual = - dmxLookupVisualFromID(pScreen, - wVisual(pWindow->parent)); - } - else { - pWinPriv->window = dmxCreateNonRootWindow(pWindow); - } - } - - dmxSync(dmxScreen, False); - } - - DMX_WRAP(CreateWindow, dmxCreateWindow, dmxScreen, pScreen); - - return ret; -} - -/** Destroy \a pWindow on the back-end server. */ -Bool -dmxBEDestroyWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - if (pWinPriv->window) { - XDestroyWindow(dmxScreen->beDisplay, pWinPriv->window); - pWinPriv->window = (Window) 0; - return TRUE; - } - - return FALSE; -} - -/** Destroy \a pWindow on the back-end server. If any RENDER pictures - were created, destroy them as well. */ -Bool -dmxDestroyWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - Bool needSync = FALSE; - -#ifdef GLXEXT - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); -#endif - - DMX_UNWRAP(DestroyWindow, dmxScreen, pScreen); - - /* Destroy any picture list associated with this window */ - needSync |= dmxDestroyPictureList(pWindow); - - /* Destroy window on back-end server */ - needSync |= dmxBEDestroyWindow(pWindow); - if (needSync) - dmxSync(dmxScreen, FALSE); - -#ifdef GLXEXT - if (pWinPriv->swapGroup && pWinPriv->windowDestroyed) - pWinPriv->windowDestroyed(pWindow); -#endif - - if (pScreen->DestroyWindow) - ret = pScreen->DestroyWindow(pWindow); - - DMX_WRAP(DestroyWindow, dmxDestroyWindow, dmxScreen, pScreen); - - return ret; -} - -/** Change the position of \a pWindow to be \a x, \a y. */ -Bool -dmxPositionWindow(WindowPtr pWindow, int x, int y) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - unsigned int m; - XWindowChanges c; - - DMX_UNWRAP(PositionWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->PositionWindow) - ret = pScreen->PositionWindow(pWindow, x, y); -#endif - - /* Determine if the window is completely off the visible portion of - the screen */ - pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); - - /* If the window is now on-screen and it is mapped and it has not - been created yet, create it and map it */ - if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { - dmxCreateAndRealizeWindow(pWindow, TRUE); - } - else if (pWinPriv->window) { - /* Position window on back-end server */ - m = CWX | CWY | CWWidth | CWHeight; - c.x = pWindow->origin.x - wBorderWidth(pWindow); - c.y = pWindow->origin.y - wBorderWidth(pWindow); - c.width = pWindow->drawable.width; - c.height = pWindow->drawable.height; - if (pWindow->drawable.class != InputOnly) { - m |= CWBorderWidth; - c.border_width = pWindow->borderWidth; - } - - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - dmxSync(dmxScreen, False); - } - - DMX_WRAP(PositionWindow, dmxPositionWindow, dmxScreen, pScreen); - - return ret; -} - -static void -dmxDoChangeWindowAttributes(WindowPtr pWindow, - unsigned long *mask, XSetWindowAttributes * attribs) -{ - dmxPixPrivPtr pPixPriv; - - if (*mask & CWBackPixmap) { - switch (pWindow->backgroundState) { - case None: - attribs->background_pixmap = None; - break; - - case ParentRelative: - attribs->background_pixmap = ParentRelative; - break; - - case BackgroundPixmap: - pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->background.pixmap); - attribs->background_pixmap = pPixPriv->pixmap; - break; - - case BackgroundPixel: - *mask &= ~CWBackPixmap; - break; - } - } - - if (*mask & CWBackPixel) { - if (pWindow->backgroundState == BackgroundPixel) - attribs->background_pixel = pWindow->background.pixel; - else - *mask &= ~CWBackPixel; - } - - if (*mask & CWBorderPixmap) { - if (pWindow->borderIsPixel) - *mask &= ~CWBorderPixmap; - else { - pPixPriv = DMX_GET_PIXMAP_PRIV(pWindow->border.pixmap); - attribs->border_pixmap = pPixPriv->pixmap; - } - } - - if (*mask & CWBorderPixel) { - if (pWindow->borderIsPixel) - attribs->border_pixel = pWindow->border.pixel; - else - *mask &= ~CWBorderPixel; - } - - if (*mask & CWBitGravity) - attribs->bit_gravity = pWindow->bitGravity; - - if (*mask & CWWinGravity) - *mask &= ~CWWinGravity; /* Handled by dix */ - - if (*mask & CWBackingStore) - *mask &= ~CWBackingStore; /* Backing store not supported */ - - if (*mask & CWBackingPlanes) - *mask &= ~CWBackingPlanes; /* Backing store not supported */ - - if (*mask & CWBackingPixel) - *mask &= ~CWBackingPixel; /* Backing store not supported */ - - if (*mask & CWOverrideRedirect) - attribs->override_redirect = pWindow->overrideRedirect; - - if (*mask & CWSaveUnder) - *mask &= ~CWSaveUnder; /* Save unders not supported */ - - if (*mask & CWEventMask) - *mask &= ~CWEventMask; /* Events are handled by dix */ - - if (*mask & CWDontPropagate) - *mask &= ~CWDontPropagate; /* Events are handled by dix */ - - if (*mask & CWColormap) { - ColormapPtr pCmap; - dmxColormapPrivPtr pCmapPriv; - - dixLookupResourceByType((void **) &pCmap, wColormap(pWindow), - RT_COLORMAP, NullClient, DixUnknownAccess); - pCmapPriv = DMX_GET_COLORMAP_PRIV(pCmap); - attribs->colormap = pCmapPriv->cmap; - } - - if (*mask & CWCursor) - *mask &= ~CWCursor; /* Handled by the cursor code */ -} - -/** Change the window attributes of \a pWindow. */ -Bool -dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - XSetWindowAttributes attribs; - - DMX_UNWRAP(ChangeWindowAttributes, dmxScreen, pScreen); -#if 0 - if (pScreen->ChangeWindowAttributes) - ret = pScreen->ChangeWindowAttributes(pWindow, mask); -#endif - - /* Change window attribs on back-end server */ - dmxDoChangeWindowAttributes(pWindow, &mask, &attribs); - - /* Save mask for lazy window creation optimization */ - pWinPriv->attribMask |= mask; - - if (mask && pWinPriv->window) { - XChangeWindowAttributes(dmxScreen->beDisplay, pWinPriv->window, - mask, &attribs); - dmxSync(dmxScreen, False); - } - - DMX_WRAP(ChangeWindowAttributes, dmxChangeWindowAttributes, dmxScreen, - pScreen); - - return ret; -} - -/** Realize \a pWindow on the back-end server. If the lazy window - * creation optimization is enabled, the window is only realized when - * it at least partially overlaps the screen. */ -Bool -dmxRealizeWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - DMX_UNWRAP(RealizeWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->RealizeWindow) - ret = pScreen->RealizeWindow(pWindow); -#endif - - /* Determine if the window is completely off the visible portion of - the screen */ - pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); - - /* If the window hasn't been created and it's not offscreen, then - create it */ - if (!pWinPriv->window && !pWinPriv->offscreen) { - dmxCreateAndRealizeWindow(pWindow, FALSE); - } - - if (pWinPriv->window) { - /* Realize window on back-end server */ - XMapWindow(dmxScreen->beDisplay, pWinPriv->window); - dmxSync(dmxScreen, False); - } - - /* Let the other functions know that the window is now mapped */ - pWinPriv->mapped = TRUE; - - DMX_WRAP(RealizeWindow, dmxRealizeWindow, dmxScreen, pScreen); - - dmxUpdateWindowInfo(DMX_UPDATE_REALIZE, pWindow); - return ret; -} - -/** Unrealize \a pWindow on the back-end server. */ -Bool -dmxUnrealizeWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - Bool ret = TRUE; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - DMX_UNWRAP(UnrealizeWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->UnrealizeWindow) - ret = pScreen->UnrealizeWindow(pWindow); -#endif - - if (pWinPriv->window) { - /* Unrealize window on back-end server */ - XUnmapWindow(dmxScreen->beDisplay, pWinPriv->window); - dmxSync(dmxScreen, False); - } - - /* When unrealized (i.e., unmapped), the window is always considered - off of the visible portion of the screen */ - pWinPriv->offscreen = TRUE; - pWinPriv->mapped = FALSE; - -#ifdef GLXEXT - if (pWinPriv->swapGroup && pWinPriv->windowUnmapped) - pWinPriv->windowUnmapped(pWindow); -#endif - - DMX_WRAP(UnrealizeWindow, dmxUnrealizeWindow, dmxScreen, pScreen); - - dmxUpdateWindowInfo(DMX_UPDATE_UNREALIZE, pWindow); - return ret; -} - -static void -dmxDoRestackWindow(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - WindowPtr pNextSib = pWindow->nextSib; - unsigned int m; - XWindowChanges c; - - if (pNextSib == NullWindow) { - /* Window is at the bottom of the stack */ - m = CWStackMode; - c.sibling = (Window) 0; - c.stack_mode = Below; - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - } - else { - /* Window is not at the bottom of the stack */ - dmxWinPrivPtr pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib); - - /* Handle case where siblings have not yet been created due to - lazy window creation optimization by first finding the next - sibling in the sibling list that has been created (if any) - and then putting the current window just above that sibling, - and if no next siblings have been created yet, then put it at - the bottom of the stack (since it might have a previous - sibling that should be above it). */ - while (!pNextSibPriv->window) { - pNextSib = pNextSib->nextSib; - if (pNextSib == NullWindow) { - /* Window is at the bottom of the stack */ - m = CWStackMode; - c.sibling = (Window) 0; - c.stack_mode = Below; - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - return; - } - pNextSibPriv = DMX_GET_WINDOW_PRIV(pNextSib); - } - - m = CWStackMode | CWSibling; - c.sibling = pNextSibPriv->window; - c.stack_mode = Above; - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - } -} - -/** Handle window restacking. The actual restacking occurs in - * #dmxDoRestackWindow(). */ -void -dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - DMX_UNWRAP(RestackWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->RestackWindow) - pScreen->RestackWindow(pWindow, pOldNextSib); -#endif - - if (pOldNextSib != pWindow->nextSib) { - /* Track restacking for lazy window creation optimization */ - pWinPriv->restacked = TRUE; - - /* Restack window on back-end server */ - if (pWinPriv->window) { - dmxDoRestackWindow(pWindow); - dmxSync(dmxScreen, False); - } - } - - DMX_WRAP(RestackWindow, dmxRestackWindow, dmxScreen, pScreen); - dmxUpdateWindowInfo(DMX_UPDATE_RESTACK, pWindow); -} - -static Bool -dmxWindowExposurePredicate(Display * dpy, XEvent * ev, XPointer ptr) -{ - return (ev->type == Expose && ev->xexpose.window == *(Window *) ptr); -} - -/** Handle exposures on \a pWindow. Since window exposures are handled - * in DMX, the events that are generated by the back-end server are - * redundant, so we eat them here. */ -void -dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - XEvent ev; - - DMX_UNWRAP(WindowExposures, dmxScreen, pScreen); - - dmxSync(dmxScreen, False); - - if (pWinPriv->window) { - while (XCheckIfEvent(dmxScreen->beDisplay, &ev, - dmxWindowExposurePredicate, - (XPointer) &pWinPriv->window)) { - /* Handle expose events -- this should not be necessary - since the base window in which the root window was - created is guaranteed to be on top (override_redirect), - so we should just swallow these events. If for some - reason the window is not on top, then we'd need to - collect these events and send them to the client later - (e.g., during the block handler as Xnest does). */ - } - } - -#if 1 - if (pScreen->WindowExposures) - pScreen->WindowExposures(pWindow, prgn); -#endif - DMX_WRAP(WindowExposures, dmxWindowExposures, dmxScreen, pScreen); -} - -/** Move \a pWindow on the back-end server. Determine whether or not it - * is on or offscreen, and realize it if it is newly on screen and the - * lazy window creation optimization is enabled. */ -void -dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - unsigned int m; - XWindowChanges c; - - DMX_UNWRAP(CopyWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->CopyWindow) - pScreen->CopyWindow(pWindow, ptOldOrg, prgnSrc); -#endif - - /* Determine if the window is completely off the visible portion of - the screen */ - pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); - - /* If the window is now on-screen and it is mapped and it has not - been created yet, create it and map it */ - if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { - dmxCreateAndRealizeWindow(pWindow, TRUE); - } - else if (pWinPriv->window) { - /* Move window on back-end server */ - m = CWX | CWY | CWWidth | CWHeight; - c.x = pWindow->origin.x - wBorderWidth(pWindow); - c.y = pWindow->origin.y - wBorderWidth(pWindow); - c.width = pWindow->drawable.width; - c.height = pWindow->drawable.height; - - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - dmxSync(dmxScreen, False); - } - - DMX_WRAP(CopyWindow, dmxCopyWindow, dmxScreen, pScreen); - dmxUpdateWindowInfo(DMX_UPDATE_COPY, pWindow); -} - -/** Resize \a pWindow on the back-end server. Determine whether or not - * it is on or offscreen, and realize it if it is newly on screen and - * the lazy window creation optimization is enabled. */ -void -dmxResizeWindow(WindowPtr pWindow, int x, int y, - unsigned int w, unsigned int h, WindowPtr pSib) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - unsigned int m; - XWindowChanges c; - - DMX_UNWRAP(ResizeWindow, dmxScreen, pScreen); -#if 1 - if (pScreen->ResizeWindow) - pScreen->ResizeWindow(pWindow, x, y, w, h, pSib); -#endif - - /* Determine if the window is completely off the visible portion of - the screen */ - pWinPriv->offscreen = DMX_WINDOW_OFFSCREEN(pWindow); - - /* If the window is now on-screen and it is mapped and it has not - been created yet, create it and map it */ - if (!pWinPriv->window && pWinPriv->mapped && !pWinPriv->offscreen) { - dmxCreateAndRealizeWindow(pWindow, TRUE); - } - else if (pWinPriv->window) { - /* Handle resizing on back-end server */ - m = CWX | CWY | CWWidth | CWHeight; - c.x = pWindow->origin.x - wBorderWidth(pWindow); - c.y = pWindow->origin.y - wBorderWidth(pWindow); - c.width = pWindow->drawable.width; - c.height = pWindow->drawable.height; - - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - dmxSync(dmxScreen, False); - } - - DMX_WRAP(ResizeWindow, dmxResizeWindow, dmxScreen, pScreen); - dmxUpdateWindowInfo(DMX_UPDATE_RESIZE, pWindow); -} - -/** Reparent \a pWindow on the back-end server. */ -void -dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - dmxWinPrivPtr pParentPriv = DMX_GET_WINDOW_PRIV(pWindow->parent); - - DMX_UNWRAP(ReparentWindow, dmxScreen, pScreen); -#if 0 - if (pScreen->ReparentWindow) - pScreen->ReparentWindow(pWindow, pPriorParent); -#endif - - if (pWinPriv->window) { - if (!pParentPriv->window) { - dmxCreateAndRealizeWindow(pWindow->parent, FALSE); - } - - /* Handle reparenting on back-end server */ - XReparentWindow(dmxScreen->beDisplay, pWinPriv->window, - pParentPriv->window, - pWindow->origin.x - wBorderWidth(pWindow), - pWindow->origin.x - wBorderWidth(pWindow)); - dmxSync(dmxScreen, False); - } - - DMX_WRAP(ReparentWindow, dmxReparentWindow, dmxScreen, pScreen); - dmxUpdateWindowInfo(DMX_UPDATE_REPARENT, pWindow); -} - -/** Change border width for \a pWindow to \a width pixels. */ -void -dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - unsigned int m; - XWindowChanges c; - - DMX_UNWRAP(ChangeBorderWidth, dmxScreen, pScreen); -#if 1 - if (pScreen->ChangeBorderWidth) - pScreen->ChangeBorderWidth(pWindow, width); -#endif - - /* NOTE: Do we need to check for on/off screen here? */ - - if (pWinPriv->window) { - /* Handle border width change on back-end server */ - m = CWBorderWidth; - c.border_width = width; - - XConfigureWindow(dmxScreen->beDisplay, pWinPriv->window, m, &c); - dmxSync(dmxScreen, False); - } - - DMX_WRAP(ChangeBorderWidth, dmxChangeBorderWidth, dmxScreen, pScreen); -} - -static void -dmxDoSetShape(WindowPtr pWindow) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - int nBox; - BoxPtr pBox; - int nRect; - XRectangle *pRect; - XRectangle *pRectFirst; - - /* First, set the bounding shape */ - if (wBoundingShape(pWindow)) { - pBox = RegionRects(wBoundingShape(pWindow)); - nRect = nBox = RegionNumRects(wBoundingShape(pWindow)); - pRectFirst = pRect = xallocarray(nRect, sizeof(*pRect)); - while (nBox--) { - pRect->x = pBox->x1; - pRect->y = pBox->y1; - pRect->width = pBox->x2 - pBox->x1; - pRect->height = pBox->y2 - pBox->y1; - pBox++; - pRect++; - } - XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window, - ShapeBounding, 0, 0, - pRectFirst, nRect, ShapeSet, YXBanded); - free(pRectFirst); - } - else { - XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window, - ShapeBounding, 0, 0, None, ShapeSet); - } - - /* Next, set the clip shape */ - if (wClipShape(pWindow)) { - pBox = RegionRects(wClipShape(pWindow)); - nRect = nBox = RegionNumRects(wClipShape(pWindow)); - pRectFirst = pRect = xallocarray(nRect, sizeof(*pRect)); - while (nBox--) { - pRect->x = pBox->x1; - pRect->y = pBox->y1; - pRect->width = pBox->x2 - pBox->x1; - pRect->height = pBox->y2 - pBox->y1; - pBox++; - pRect++; - } - XShapeCombineRectangles(dmxScreen->beDisplay, pWinPriv->window, - ShapeClip, 0, 0, - pRectFirst, nRect, ShapeSet, YXBanded); - free(pRectFirst); - } - else { - XShapeCombineMask(dmxScreen->beDisplay, pWinPriv->window, - ShapeClip, 0, 0, None, ShapeSet); - } - - if (XShapeInputSelected(dmxScreen->beDisplay, pWinPriv->window)) { - ErrorF("Input selected for window %x on Screen %d\n", - (unsigned int) pWinPriv->window, pScreen->myNum); - } -} - -/** Set shape of \a pWindow on the back-end server. */ -void -dmxSetShape(WindowPtr pWindow, int kind) -{ - ScreenPtr pScreen = pWindow->drawable.pScreen; - DMXScreenInfo *dmxScreen = &dmxScreens[pScreen->myNum]; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWindow); - - DMX_UNWRAP(SetShape, dmxScreen, pScreen); -#if 1 - if (pScreen->SetShape) - pScreen->SetShape(pWindow, kind); -#endif - - if (pWinPriv->window) { - /* Handle setting the current shape on the back-end server */ - dmxDoSetShape(pWindow); - dmxSync(dmxScreen, False); - } - else { - pWinPriv->isShaped = TRUE; - } - - DMX_WRAP(SetShape, dmxSetShape, dmxScreen, pScreen); -} diff --git a/hw/dmx/dmxwindow.h b/hw/dmx/dmxwindow.h deleted file mode 100644 index dda6538d1..000000000 --- a/hw/dmx/dmxwindow.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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> - * - */ - -/** \file - * Interface for window support. \see dmxwindow.c */ - -#ifndef DMXWINDOW_H -#define DMXWINDOW_H - -#include "windowstr.h" - -/** Window private area. */ -typedef struct _dmxWinPriv { - Window window; - Bool offscreen; - Bool mapped; - Bool restacked; - unsigned long attribMask; - Colormap cmap; - Visual *visual; - Bool isShaped; - Bool hasPict; -#ifdef GLXEXT - void *swapGroup; - int barrier; - void (*windowDestroyed) (WindowPtr); - void (*windowUnmapped) (WindowPtr); -#endif -} dmxWinPrivRec, *dmxWinPrivPtr; - -extern Bool dmxInitWindow(ScreenPtr pScreen); - -extern Window dmxCreateRootWindow(WindowPtr pWindow); - -extern void dmxGetDefaultWindowAttributes(WindowPtr pWindow, - Colormap * cmap, Visual ** visual); -extern void dmxCreateAndRealizeWindow(WindowPtr pWindow, Bool doSync); - -extern Bool dmxCreateWindow(WindowPtr pWindow); -extern Bool dmxDestroyWindow(WindowPtr pWindow); -extern Bool dmxPositionWindow(WindowPtr pWindow, int x, int y); -extern Bool dmxChangeWindowAttributes(WindowPtr pWindow, unsigned long mask); -extern Bool dmxRealizeWindow(WindowPtr pWindow); -extern Bool dmxUnrealizeWindow(WindowPtr pWindow); -extern void dmxRestackWindow(WindowPtr pWindow, WindowPtr pOldNextSib); -extern void dmxWindowExposures(WindowPtr pWindow, RegionPtr prgn); -extern void dmxCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, - RegionPtr prgnSrc); - -extern void dmxResizeWindow(WindowPtr pWindow, int x, int y, - unsigned int w, unsigned int h, WindowPtr pSib); -extern void dmxReparentWindow(WindowPtr pWindow, WindowPtr pPriorParent); - -extern void dmxChangeBorderWidth(WindowPtr pWindow, unsigned int width); - -extern void dmxResizeScreenWindow(ScreenPtr pScreen, - int x, int y, int w, int h); -extern void dmxResizeRootWindow(WindowPtr pRoot, int x, int y, int w, int h); - -extern Bool dmxBEDestroyWindow(WindowPtr pWindow); - -/* Support for shape extension */ -extern void dmxSetShape(WindowPtr pWindow, int kind); - -/** Get window private pointer. */ -#define DMX_GET_WINDOW_PRIV(_pWin) ((dmxWinPrivPtr) \ - dixLookupPrivate(&(_pWin)->devPrivates, dmxWinPrivateKey)) - -/* All of these macros are only used in dmxwindow.c */ -#define DMX_WINDOW_FUNC_PROLOGUE(_pGC) \ -do { \ - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \ - DMX_UNWRAP(funcs, pGCPriv, (_pGC)); \ - if (pGCPriv->ops) \ - DMX_UNWRAP(ops, pGCPriv, (_pGC)); \ -} while (0) - -#define DMX_WINDOW_FUNC_EPILOGUE(_pGC) \ -do { \ - dmxGCPrivPtr pGCPriv = DMX_GET_GC_PRIV(_pGC); \ - DMX_WRAP(funcs, &dmxGCFuncs, pGCPriv, (_pGC)); \ - if (pGCPriv->ops) \ - DMX_WRAP(ops, &dmxGCOps, pGCPriv, (_pGC)); \ -} while (0) - -#define DMX_WINDOW_X1(_pWin) \ - ((_pWin)->drawable.x - wBorderWidth(_pWin)) -#define DMX_WINDOW_Y1(_pWin) \ - ((_pWin)->drawable.y - wBorderWidth(_pWin)) -#define DMX_WINDOW_X2(_pWin) \ - ((_pWin)->drawable.x + wBorderWidth(_pWin) + (_pWin)->drawable.width) -#define DMX_WINDOW_Y2(_pWin) \ - ((_pWin)->drawable.y + wBorderWidth(_pWin) + (_pWin)->drawable.height) - -#define DMX_WINDOW_OFFSCREEN(_pWin) \ - (DMX_WINDOW_X1(_pWin) >= (_pWin)->drawable.pScreen->width || \ - DMX_WINDOW_Y1(_pWin) >= (_pWin)->drawable.pScreen->height || \ - DMX_WINDOW_X2(_pWin) <= 0 || \ - DMX_WINDOW_Y2(_pWin) <= 0) - -#endif /* DMXWINDOW_H */ diff --git a/hw/dmx/doc/.gitignore b/hw/dmx/doc/.gitignore deleted file mode 100644 index 9629c1538..000000000 --- a/hw/dmx/doc/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -*.html -*.pdf -*.ps -*.txt -!DMXSpec.txt -!DMXSpec-v1.txt diff --git a/hw/dmx/doc/DMXSpec-v1.txt b/hw/dmx/doc/DMXSpec-v1.txt deleted file mode 100644 index cea97b9fe..000000000 --- a/hw/dmx/doc/DMXSpec-v1.txt +++ /dev/null @@ -1,458 +0,0 @@ - - - Client-to-Server DMX Extension to the X Protocol - - $Date$, $Revision$ - - Rickard E. (Rik) Faith (faith@redhat.com) - Kevin E. Martin (kem@redhat.com) - - Copyright 2002,2003 Red Hat Inc., Raleigh, North Carolina. - - 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. - - - -1. Overview - - The client-to-server DMX extension to the X protocol (DMX) provides - normal client applications with the ability to determine information - about the characteristics of the Xdmx server and the back-end X - servers that DMX is using. - - The name for this extension is "DMX". - - - -2. Syntactic conventions - - This document uses the same syntactic conventions requests and data - types as [X11R6.4]. - - - -3. Data types - - No new data types are defined by this extension. All data types - referenced in this document are defined in [X11R6.4]. - - - -4. Requests - - DMXQueryVersion - ==> - majorVersion: CARD32 - minorVersion: CARD32 - patchVersion: CARD32 - - The protocol this extension actually supports is indicated by - majorVersion and minorVersion (patchVersion indicates the - patchlevel and is for informational purposes only). - - Any incompatible changes to the protocol should be indicated by - incrementing majorVersion. - - Small, upward-compatible changes should be indicated by incrementing - minorVersion. - - Servers that support the protocol defined in this document will - return a majorVersion of 1 and a minorVersion of 1. - - - - DMXGetScreenCount - ==> - screenCount: CARD32 - - This request returns the number of back-end screens that the Xdmx - server controls. A back-end screen may be managed as a regular X - screen in the Xdmx server or may be joined with other back-end - screens using Xinerama. (The information returned by this request - does not change while Xdmx is running and may be cached on the - client side.) - - - - DMXGetScreenInformation - physicalScreen: CARD32 - ==> - displayName: STRING8 - width: CARD16 - height: CARD16 - xoffset: INT16 - yoffset: INT16 - logicalScreen: CARD32 - xorigin: INT16 - yorigin: INT16 - - Errors: Value - - This request returns information about individual back-end screens. - The physicalScreen value is between 0 and screenCount-1, inclusive - (values outside this range will result in a Value error). The - displayname is the name used to open the display, either from the - Xdmx command-line or from the configuration file. The width, - height, xoffset, and yoffset values comprise a geometry - specification (see X(7x)) for the location of the DMX window on the - back-end screen. This request will always return non-negative - (i.e., normalized) values for xoffset and yoffset. The - logicalScreen value is the value of the screen that that Xdmx server - exports to clients. When Xinerama is in use, this value is - typically 0 for all values of physicalScreen. If Xinerama is in - use, the xorigin and yorigin values specify where the physical - screen is positioned in the global Xinerama coordinate system. - Otherwise, these values are set to 0. (The information returned by - this request does not change while Xdmx is running and may be cached - on the client side.) - - - - DMXGetWindowInformation - window: CARD32 - ==> - screenCount: CARD32 - screens: LISTofCARD32 - windows: LISTofCARD32 - pos: LISTofRECTANGLE - vis: LISTofRECTANGLE - - Errors: Window, Alloc - - This request computed the return values incorrectly for version 1.0 - of this protocol. Version 1.1 of this protocol conforms to this - description. - - Given a window ID on the Xdmx server, this request returns data - about how the window is represented on the back-end X servers. For - each back-end X server that displays a portion of the window, the - following information is returned: - 1) the number of the physical screen containing that portion - (which can be used with the DMXGetScreenInformation request - to obtain more information about the screen), - 2) the window ID on the back-end X server of the window - containing that portion, - 3) the position and dimensions of the window on the back-end, in - screen coordinates, and - 4) the visible area of the window on the back-end, in - window-relative coordinates (all zeros for windows that are - not visible) - Note that DMX allows multiple back-end windows to overlap in their - view of the DMX logical window. Further, a logical window does not - have to be completely covered by back-end windows -- there may be - gaps. - - As an example, consider a 500x500 window that spans the top two - 1024x768 back-end displays (A and B) of a 2048x1536 DMX display - composed of 4 1024x768 back-end displays arranged in a cube: - A B - C D - - In this case, the DMXGetWindowInformation call would return the - following information for the 500x500 window: - - display A: 500x500 window at 1024-250,0 (relative to back end) - with 250x500 visible at 0,0 (relative to window origin) - - display B: 500x500 window at -250,0 (relative to back end) - with 250x500 visible at 250,0 (relative to window origin) - - display C: 500x500 window at 1024-250,-768 with 0x0 visible at 0,0 - - display D: 500x500 window at -250,-768 with 0x0 visible at 0,0 - - Note that if the specified window has not yet been mapped when - DMXGetWindowInformation is called, then a subsequent XMapWindow call - might be buffered in xlib while requests directly to the back-end X - servers are processed. This race condition can be solved by calling - DMXSync before talking directly to the back-end X servers. - - - DMXGetInputCount - ==> - inputCount: CARD32 - - This request was first supported in version 1.1 of this protocol. - - This request returns the number of input devices connected to the - Xdmx server. This number is the same as that returned by - XListInputDevices, but is available even when the XInput extension - is not supported. - - - - DMXGetInputInformation - deviceId: CARD32 - ==> - inputType: CARD32 - physicalScreen: CARD32 - physicalId: CARD32 - isCore: BOOL - sendsCore: BOOL - name: STRING8 - - Errors: Value - - This request was first supported in version 1.1 of this protocol. - - This request returns information about the specified input device - that cannot be obtained from the XListInputDeivices call. The - deviceId is the same as that used by the XListInputDevices call, and - must be in the range 0 to inputCount-1, inclusive (values outside - this range will result in a Value error). - - The value of inputType will always be value, and will be one of the - following values: - 0 for local (and dummy) devices, - 1 for console devices, and - 2 for back-end devices. - - For local devices, all other fields returned, except isCore and - sendsCore, are invalid. - - For console devices, the physicalScreen and physicalID will be - invalid, and the name will return the name of the X server on which - the console window is displayed. - - For back-end devices, the physicalScreen will identify the back-end - display and can be used as an argument to DMXGetScreenInformation to - obtain more information; the physicalId will be the XInput device id - on the back-end X server; and the name will be invalid (since it - does not provide any additional information that cannot be obtained - with DMXGetScreenInformation). - - If isCore is True, then this device is active as a true core input - device and will send core events. If sendsCore is True, then this - device queried an XInput extension device, but sends core events - instead of extension events. Note that this behavior is different - from that of XFree86, where XInput extension devices may send both - extension events and core events. - - - - DMXForceWindowCreation - window: CARD32 - ==> - - Errors: Window - - This request was first supported in version 1.2 of this protocol. - - When using the lazy window creation optimization, windows are not - created on the back-end X servers until they are required. This - request forces the immediate creation of the window requested. - - - - DMXReconfigureScreen - screen: CARD32 - x: INT16 - y: INT16 - ==> - status: CARD32 - - Errors: Value - - This request was first supported in version 1.3 of this protocol. - - This request reconfigures the screen position to coordinates (x,y) - when using the Xinerama extension. Otherwise, it is a NOP. Illegal - values for screen will result in a BadValue error. Other non-fatal - errors will be returned in status. - - - - DMXSync - ==> - - This request was first supported in version 1.5 of this protocol. - - This request flushes all pending protocol requests between the Xdmx - server and each back-end X server. It is used by a client that - talks directly to back-end X servers - - To ensure proper synchronization semantics, this request has a - reply, but the reply does not carry any information. - - - -5. Events - - No new events are defined by this extension. - - - -6. Errors - - No new events are defined by this extension. - - - -7. Encoding - - DMXQueryVersion - 1 CARD8 opcode (X assigned) - 1 0 DMX opcode (X_DMXQueryVersion) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 majorVersion - 4 CARD32 minorVersion - 4 CARD32 patchVersion - 12 unused - - DMXGetScreenCount - 1 CARD8 opcode (X assigned) - 1 1 DMX opcode (X_DMXGetScreenCount) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 screenCount - 20 unused - - DMXGetScreenInformation - 1 CARD8 opcode (X assigned) - 1 2 DMX opcode (X_DMXGetScreenInformation) - 2 2 request length - 4 CARD32 physicalScreen - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 n/4+p reply length - 4 n displayNameLength - 2 CARD16 width - 2 CARD16 height - 2 INT16 xoffset - 2 INT16 yoffset - 4 CARD32 logicalScreen - 2 INT16 xorigin - 2 INT16 yorigin - 4 unused - n displayName - p pad(n) - - DMXGetWindowInformation - 1 CARD8 opcode (X assigned) - 1 3 DMX opcode (X_DMXGetWindowInformation) - 2 2 request length - 4 CARD32 window - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 n*6 reply length - 4 n screenCount - 20 unused - n*4 LISTofCARD32 screens - n*4 LISTofCARD32 windows - n*8 LISTofRECTANGLE pos - n*8 LISTofRECTANGLE vis - - DMXGetInputCount - 1 CARD8 opcode (X assigned) - 1 DMX opcode (X_DMXGetInputCount) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 inputCount - 20 unused - - DMXGetInputInformation - 1 CARD8 opcode (X assigned) - 1 4 DMX opcode (X_DMXGetInputInformation) - 2 2 request length - 4 CARD32 deviceId - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 n/4+p reply length - 4 CARD32 inputType - 4 CARD32 physicalScreen - 4 CARD32 physicalId - 4 n nameLength - 1 BOOL isCore - 1 BOOL sendsCore - 6 unused - n name - p pad(n) - - DMXForceWindowCreation - 1 CARD8 opcode (X assigned) - 1 2 DMX opcode (X_DMXForceWindowCreation) - 2 2 request length - 4 CARD32 window - ==> - - DMXReconfigureScreen - 1 CARD8 opcode (X assigned) - 1 2 DMX opcode (X_DMXReconfigureScreen) - 2 2 request length - 4 CARD32 screen - 2 INT16 x - 2 INT16 y - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 20 unused - - DMXSync - 1 CARD8 opcode (X assigned) - 1 0 DMX opcode (X_DMXSync) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 24 unused - - -8. Changes to existing requests/replies/events - - No changes to existing requests, replies, or events are necessitated - by this extension. - - - -9. Acknowledgments - - - -10. References - - [X11R6.4] Robert W. Sheifler. X Window System Protocol, X Consortium - Standard, X Version 11, Release 6.4. Available from - xc/doc/specs/XProtocol and xc/doc/hardcopy/XProtocol. diff --git a/hw/dmx/doc/DMXSpec.txt b/hw/dmx/doc/DMXSpec.txt deleted file mode 100644 index 4053dcc8f..000000000 --- a/hw/dmx/doc/DMXSpec.txt +++ /dev/null @@ -1,875 +0,0 @@ - - - Client-to-Server DMX Extension to the X Protocol - - $Date$, $Revision$ - - Rickard E. (Rik) Faith (faith@redhat.com) - Kevin E. Martin (kem@redhat.com) - - Copyright 2002-2004 Red Hat Inc., Raleigh, North Carolina. - - 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. - - - -1. Overview - - The client-to-server DMX extension to the X protocol (DMX) provides - normal client applications with the ability to determine information - about the characteristics of the Xdmx server and the back-end X - servers that DMX is using. - - The name for this extension is "DMX". - - - -2. Syntactic conventions - - This document uses the same syntactic conventions requests and data - types as [X11R6.4]. - - - -3. Data types - - No new data types are defined by this extension. All data types - referenced in this document are defined in [X11R6.4]. - - - -4. Requests - - DMXQueryVersion - ==> - majorVersion: CARD32 - minorVersion: CARD32 - patchVersion: CARD32 - - Errors: None - - The protocol this extension actually supports is indicated by - majorVersion and minorVersion (patchVersion indicates the - patchlevel and is for informational purposes only). - - Any incompatible changes to the protocol should be indicated by - incrementing majorVersion. - - Small, upward-compatible changes should be indicated by incrementing - minorVersion. - - Servers that support the protocol defined in this document will - return a majorVersion of 2 and a minorVersion of 2. - - (Version 1.5 was the last version in the 1.x series; version 2.0 was - a testing version that was poorly defined.) - - - - DMXSync - ==> - status: CARD32 - - Errors: None - - This request was first supported in version 1.5 of this protocol. - The status field in the reply was introduced in version 2.0 of this - protocol. Since the status field is ignored, no changes to the - underlying protocol were required. - - This request flushes all pending protocol requests between the Xdmx - server and each back-end X server. It is used by clients that - talk directly to back-end X servers to ensure that all pending Xdmx - requests have reached all back-end servers and have been processed - by those servers. - - The value of status is always 0. - - - - DMXForceWindowCreation - window: CARD32 - ==> - status: CARD32 - - Errors: Window - - This request was first supported in version 1.2 of this protocol. - This request was changed to have a reply in version 2.0 of this - protocol. The old version of this request was deprecated and will - return BadImplementation. - - When using the lazy window creation optimization, windows are not - created on the back-end X servers until they are required. This - request forces the immediate creation of the window requested. - - The value of status is always 0. - - - - - DMXGetScreenCount - ==> - screenCount: CARD32 - - Errors: None - - This request returns the number of screens that the Xdmx server - controls. Since a DMX screen usually fills all of the available - area on a back-end server, there is usually a one-to-one - correspondence between DMX screens and backend servers. However, it - is also possible for a DMX screen to cover only part of the - available area on a back-end server, and for more than one DMX - screen to occupy different parts of the visible area on the same - back-end server. - - A DMX screen may be managed as a regular X screen in the Xdmx server - or may be joined with other DMX screens using Xinerama. - - - - DMXGetScreenAttributes - physicalScreen: CARD32 - ==> - displayName: STRING8 - logicalScreen: CARD32 - screenWindowWidth: CARD16 - screenWindowHeight: CARD16 - screenWindowXoffset: INT16 - screenWindowYoffset: INT16 - rootWindowWidth: CARD16 - rootWindowHeight: CARD16 - rootWindowXoffset: INT16 - rootWindowYoffset: INT16 - rootWindowXorigin: INT16 - rootWindowYorigin: INT16 - - Errors: Value - - This request is new in version 2.0 of this protocol. The old - DMXGetScreenInformation request is deprecated and will now return - BadImplementation. - - This request returns attributes about a single DMX screen. - - The physicalScreen value is between 0 and screenCount-1, inclusive - (values outside this range will result in a Value error). - - The displayname is the name used to open the display, either from - the Xdmx command-line or from the configuration file. - - The logicalScreen value is the value of the screen that that Xdmx - server exports to clients. When Xinerama is in use, this value is - typically 0 for all values of physicalScreen. If Xinerama is in - use, the rootWindowXOrigin and rootWindowYOrigin values specify - where the physical screen is positioned in the global Xinerama - coordinate system. Otherwise, these values are set to 0. - - The screenWindow values comprise a geometry specification (see - X(7x)) for the location of the DMX screen on the back-end screen. - The coordinant system of the back-end display is used. - - The first four rootWindow values comprise a geometry specification - (see X(7x)) for the location of the root window on the screen - window. The coordinant system of the screen window is used. In - most cases, the root window will have the same geometry as the DMX - screen window, and will occupy the same area of the back-end - display. (This would not be the case, for example, if automatic - projector alignment is used.) - - - - DMXChangeScreensAttributes - screenCount: CARD32 - maskCount: CARD32 - screens: LISTofCARD32 - valueMasks: LISTofCARD32 - valueList: LISTofVALUES - ==> - status: CARD32 - errorScreen: CARD32 - - Errors: Length, Alloc - - This request was first supported in version 2.0 of this protocol. - (A singular version of this request with the ability to change some - RootWindow attributes was supported in version 1.3 of this protocol, - has been deprecated, and will return BadImplementation.) - - This request changes the geometries and positions of the DMX screen - and DMX root windows on the back-end X servers. - - The valueMask and valueList specify which attributes are to be - changed. The possible values are: - - Attribute Type - - ScreenWindowWidth CARD16 - ScreenWindowHeight CARD16 - ScreenWindowXoffset INT16 - ScreenWindowYoffset INT16 - RootWindowWidth CARD16 - RootWindowHeight CARD16 - RootWindowXoffset INT16 - RootWindowYoffset INT16 - RootWindowXorigin INT16 - RootWindowYorigin INT16 - - The attribute values have the same meaning as do the corresponding - values for DMXGetScreenAttributes. - - Non-fatal errors will be returned in status (0 otherwise): - DmxBadXinerama: Xinerama is not active - DmxBadValue: The resulting position is not allowed - (e.g., one corner is outside the bounding box) - On error, errorScreen will contain the number of the screen that - caused the first error. - - - - DMXAddScreen - displayName: STRING8 - physicalScreen: CARD32 - valueMask: CARD32 - valueList: LISTofVALUES - ==> - status: CARD32 - physicalScreen: CARD32 - - Errors: Length, Alloc, Value - - This request was first supported in version 2.2 of this protocol. - - This request re-attaches the back-end physicalScreen to the Xdmx - server. Only back-end screens that have been previously detached - with DMXRemoveScreen may be added. The name of the back-end display - is given in displayName, and this will replace the name of the - back-end screen that was detached. Both the displayName and - physicalScreen must be correct for this request to work. - - The valueMask and valueList specify the attributes to be used. The - possible values are: - - Attribute Type - - ScreenWindowWidth CARD16 - ScreenWindowHeight CARD16 - ScreenWindowXoffset INT16 - ScreenWindowYoffset INT16 - RootWindowWidth CARD16 - RootWindowHeight CARD16 - RootWindowXoffset INT16 - RootWindowYoffset INT16 - RootWindowXorigin INT16 - RootWindowYorigin INT16 - - The attribute values have the same meaning as do the corresponding - values for DMXGetScreenAttributes. - - On success, status will be 0 and physicalScreen will contain the new - screen number. On failure, status will be non-zero. The status - will be 1 if any of the following occurred: - * the -addremovescreens command-line option was not specified on - the Xdmx command line - * the value of physicalScreen is out of range - * physicalScreen has not been detached (with DMXRemoveScreen) - * displayName cannot be opened - * the visuals of displayname do not match the visuals that Xdmx - is using - * the screen data for displayName does not match the data for the - previously removed display - The status will be DmxBadValue if the attribute values are out of - range. - - - - DMXRemoveScreen - physicalScreen: CARD32 - ==> - status: CARD32 - - Errors: None - - This request was first supported in version 2.2 of this protocol. - - This request detaches the physicalScreen screen. - - On success, status will be 0. On failure, the status will 1 if any - of the following occur: - * the -addremovescreens command-line option was not specified on - the Xdmx command line - * the value of physicalScreen is out of range - * the back-end screen has already been detached. - - - - DMXGetWindowAttributes - window: CARD32 - ==> - screenCount: CARD32 - screens: LISTofCARD32 - windows: LISTofCARD32 - pos: LISTofRECTANGLE - vis: LISTofRECTANGLE - - Errors: Window, Alloc - - This request computes the return values incorrectly for version 1.0 - of this protocol. Version 1.1 of this protocol conforms to this - description. In version 2.0, the name of this request was changed - from DMXGetWindowInformation. However, since the request itself did - not change, no changes to the underlying protocol were made. - - Given a window ID on the Xdmx server, this request returns data - about how the window is represented on the back-end X servers. For - each back-end X server that displays a portion of the window, the - following information is returned: - 1) the number of the physical screen containing that portion - (which can be used with the DMXGetScreenAttributes request - to obtain more information about the screen), - 2) the window ID on the back-end X server of the window - containing that portion, - 3) the position and dimensions of the window on the back-end, in - screen coordinates, and - 4) the visible area of the window on the back-end, in - window-relative coordinates (all zeros for windows that are - not visible). - Note that DMX allows multiple back-end windows to overlap in their - view of the DMX logical window. Further, a logical window does not - have to be completely covered by back-end windows -- there may be - gaps. - - As an example, consider a 500x500 window that spans the top two - 1024x768 back-end displays (A and B) of a 2048x1536 DMX display - composed of 4 1024x768 back-end displays arranged in a cube: - A B - C D - - In this case, the DMXGetWindowAttributes call would return the - following information for the 500x500 window: - - display A: 500x500 window at 1024-250,0 (relative to back end) - with 250x500 visible at 0,0 (relative to window origin) - - display B: 500x500 window at -250,0 (relative to back end) - with 250x500 visible at 250,0 (relative to window origin) - - display C: 500x500 window at 1024-250,-768 with 0x0 visible at 0,0 - - display D: 500x500 window at -250,-768 with 0x0 visible at 0,0 - - Note that if the specified window has not yet been mapped when - DMXGetWindowAttributes is called, then a subsequent XMapWindow call - might be buffered in xlib while requests directly to the back-end X - servers are processed. This race condition can be solved by calling - DMXSync before talking directly to the back-end X servers. - - - - DMXGetDesktopAttributes - ==> - width: INT16 - height: INT16 - shiftX: INT16 - shiftY: INT16 - - Errors: None - - This request was first supported in version 2.0 of this protocol. - - This request returns the size of the bounding box of the whole - screen in width and height. The shiftX and shiftY values will - always be 0. The global bounding box is computed whether or not - Xinerama is active, and may be larger than the Xinerama screen size - because of information in the configuration file. - - - - DMXChangeDesktopAttributes - valueMask: BITMASK - valueList: LISTofVALUE - ==> - status: CARD32 - - Errors: Length, Value - - This request was first supported in version 2.0 of this protocol. - - This request resizes the bounding box of the whole screen when using - the Xinerama extension. Otherwise, it has no effect on the screen - layout. The valueMask and valueList specify which attributes are to - be changed. The possible values are: - - Attribute Type - - Width INT16 - Height INT16 - ShiftX INT16 - ShiftY INT16 - - Width and Height specify the new width and height for the bounding - box. ShiftX and ShiftY specify where the Xinerama origin will be - placed with respect to the origin of the new bounding box. This - allows the left and upper edges of the bounding box to be changed - without changing the visual position of the windows on the desktop. - If Width or Height is not specified, the current values will be - used. If ShiftX or ShiftY is not specified, 0 will be used. - - All coordinants are in the global DMX coordinant system. If - Xinerama is not active, this request is not useful. - - Non-fatal errors will be returned in status (0 otherwise): - DmxBadXinerama: Xinerama is not active - DmxBadValue: The size of the bounding box is too large - - - - DMXGetInputCount - ==> - inputCount: CARD32 - - This request was first supported in version 1.1 of this protocol. - - This request returns the number of input devices connected to the - Xdmx server. This number is the same as that returned by - XListInputDevices, but is available even when the XInput extension - is not supported. - - - - DMXGetInputAttributes - deviceId: CARD32 - ==> - inputType: CARD32 - physicalScreen: CARD32 - physicalId: CARD32 - isCore: BOOL - sendsCore: BOOL - detached: BOOL - name: STRING8 - - Errors: Value - - This request was first supported in version 1.1 of this protocol. - In version 2.0, the name of this request was changed from - DMXGetInputInformation. However, since the request itself did not - change, no changes to the underlying protocol were made. In version - 2.2, the name of detached was changed from reservation. There was - no change in underlying protocol. - - This request returns information about the specified input device - that cannot be obtained from the XListInputDeivices call. The - deviceId is the same as that used by the XListInputDevices call, and - must be in the range 0 to inputCount-1, inclusive (values outside - this range will result in a Value error). - - The value of inputType will always be valid, and will be one of the - following values: - 0 for local (and dummy) devices, - 1 for console devices, and - 2 for back-end devices. - - For local devices, all other fields returned, except isCore and - sendsCore, are invalid. - - For console devices, the physicalScreen and physicalID will be - invalid, and the name will return the name of the X server on which - the console window is displayed. - - For back-end devices, the physicalScreen will identify the back-end - display and can be used as an argument to DMXGetScreenAttributes to - obtain more information; the physicalId will be the XInput device id - on the back-end X server; and the name will be invalid (since it - does not provide any additional information that cannot be obtained - with DMXGetScreenAttributes). - - If isCore is True, then this device is active as a true core input - device and will send core events. If sendsCore is True, then this - device is an XInput extension device, but sends core events instead - of extension events. Note that this behavior is different from that - of XFree86 or Xorg, where XInput extension devices may send both - extension events and core events. - - If detached is True, then this device has been detached and is no - longer producing input events. The device may be reattached using - DMXAddInput. - - - - DMXAddInput - displayName: STRING8 - valueMask: CARD32 - valueList: LISTofVALUES - ==> - status: CARD32 - physicalId: CARD32 - - Errors: Value, Access - - This request was first supported in version 2.2 of this protocol. - - The valueMask and valueList specify the attributes to be used. The - possible values are: - - Attribute Type - - InputType CARD32 - InputPhysicalScreen CARD32 - InputSendsCore BOOL - - This request attaches an input device to the Xdmx server. The value - of inputType will be one: - 1 for console devices, and - 2 for back-end devices. - Other values of InputType will return a BadValue error. Local - devices (inputType=0 in DMXGetInputAttributes) cannot be attached or - removed. For console devices, displayName will store the name of - the display to be used. - - For back-end devices, InputPhysicalScreen will specify the screen - number. BadValue will be returned if the screen number is out of - range. BadAccess will be returned if the input has already been - attached or if the backend screen is currently detached. - - If InputSendsCore is True, the new device will be added as a true - core device. - - If a device was removed with DMXRemoveInput an attempt will be made - to reconnect the previous devices (InputSendsCore is ignored in this - case). - - - - DMXRemoveInput - physicalId: CARD32 - ==> - status: CARD32 - - Errors: Value, Access - - This request was first supported in version 2.2 of this protocol. - - This request detaches the input device with physicalId, and all - associated inputs (e.g., if the physicalId is a backend mouse, and a - keyboard is also attached to the backend, then both devices will be - detached). If the physicalId is outside the valid range (0 to one - less than the value returned by DMXInputCount), BadValue is - returned. If the physicalId has already been detached, BadAccess is - returned. The status is always 0. - - - -5. Events - - No new events are defined by this extension. - - - -6. Errors - - No new events are defined by this extension. - - - -7. Encoding - - Deprecated DMX opcodes: - DMXGetScreenInformation 2 - DMXForceWindowCreation 6 - DMXReconfigureScreen 7 - - Valid DMX opcodes: - DMXQueryVersion 0 - DMXSync 8 - DMXForceWindowCreation 9 - - DMXGetScreenCount 1 - DMXGetScreenAttributes 10 - DMXChangeScreensAttributes 11 - DMXAddScreen 12 - DMXRemoveScreen 13 - - DMXGetWindowAttributes 3 - - DMXGetDesktopAttributes 14 - DMXChangeDesktopAttributes 15 - - DMXGetInputCount 4 - DMXGetInputAttributes 5 - DMXAddInput 16 - DMXRemoveInput 17 - - DMXQueryVersion - 1 CARD8 opcode (X assigned) - 1 0 DMX opcode (X_DMXQueryVersion) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 majorVersion - 4 CARD32 minorVersion - 4 CARD32 patchVersion - 12 unused - - DMXSync - 1 CARD8 opcode (X assigned) - 1 8 DMX opcode (X_DMXSync) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 20 unused - - DMXForceWindowCreation - 1 CARD8 opcode (X assigned) - 1 9 DMX opcode (X_DMXForceWindowCreation) - 2 2 request length - 4 CARD32 window - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 20 unused - - - DMXGetScreenCount - 1 CARD8 opcode (X assigned) - 1 1 DMX opcode (X_DMXGetScreenCount) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 screenCount - 20 unused - - DMXGetScreenAttributes - 1 CARD8 opcode (X assigned) - 1 10 DMX opcode (X_DMXGetScreenAttributes) - 2 2 request length - 4 CARD32 physicalScreen - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 1+(n+p)/4 reply length - 4 n displayNameLength - 4 CARD32 logicalScreen - 2 CARD16 screenWindowWidth - 2 CARD16 screenWindowHeight - 2 INT16 screenWindowXoffset - 2 INT16 screenWindowYoffset - 2 CARD16 rootWindowWidth - 2 CARD16 rootWindowHeight - 2 INT16 rootWindowXoffset - 2 INT16 rootWindowYoffset - 2 INT16 rootWindowXorigin - 2 INT16 rootWindowYorigin - n displayName - p pad(n) - - DMXChangeScreensAttributes - 1 CARD8 opcode (X assigned) - 1 11 DMX opcode (X_DMXChangeScreenAttributes) - 2 3+s+m+n request length - 4 s screenCount - 4 m maskCount - 4s LISTofCARD32 screens - 4m LISTofCARD32 valueMasks - 4n LISTofVALUES valueList - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 4 CARD32 errorScreen - 16 unused - - - DMXAddScreen - 1 CARD8 opcode (X assigned) - 1 12 DMX opcode (X_DMXAddScreen) - 2 3+m+(n+p)/4 request length - 4 n displayNameLength - 4 CARD32 physicalScreen - 4 CARD32 valueMask - 4m LISTofVALUES valueList - n displayName - p pad(n) - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 4 CARD32 physicalScreen - 16 unused - - DMXRemoveScreen - 1 CARD8 opcode (X assigned) - 1 13 DMX opcode (X_DMXRemoveScreen) - 2 2 request length - 4 CARD32 physicalScreen - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 20 unused - - DMXGetWindowAttributes - 1 CARD8 opcode (X assigned) - 1 3 DMX opcode (X_DMXGetWindowAttributes) - 2 2 request length - 4 CARD32 window - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 n*6 reply length - 4 n screenCount - 20 unused - n*4 LISTofCARD32 screens - n*4 LISTofCARD32 windows - n*8 LISTofRECTANGLE pos - n*8 LISTofRECTANGLE vis - - DMXGetDesktopAttributes - 1 CARD8 opcode (X assigned) - 1 14 DMX opcode (X_DMXGetDesktopAttributes) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 2 INT16 width - 2 INT16 height - 2 INT16 shiftX - 2 INT16 shiftY - 16 unused - - DMXChangeDesktopAttributes - 1 CARD8 opcode (X assigned) - 1 15 DMX opcode (X_DMXChangeDesktopAttributes) - 2 2+n request length - 4 BITMASK valueMask - 4n LISTofVALUES valueList - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 20 unused - - DMXGetInputCount - 1 CARD8 opcode (X assigned) - 1 4 DMX opcode (X_DMXGetInputCount) - 2 1 request length - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 inputCount - 20 unused - - DMXGetInputAttributes - 1 CARD8 opcode (X assigned) - 1 5 DMX opcode (X_DMXGetInputAttributes) - 2 2 request length - 4 CARD32 deviceId - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 (n+p)/4 reply length - 4 CARD32 inputType - 4 CARD32 physicalScreen - 4 CARD32 physicalId - 4 n nameLength - 1 BOOL isCore - 1 BOOL sendsCore - 1 BOOL detached - 5 unused - n name - p pad(n) - - DMXAddInput - 1 CARD8 opcode (X assigned) - 1 16 DMX opcode (X_DMXAddInput) - 2 3+m+(n+p)/4 request length - 4 n displayNameLength - 4 CARD32 valueMask - 4m LISTofVALUES valueList - n displayName - p pad(n) - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 4 CARD32 physicalId - 16 unused - - DMXRemoveInput - 1 CARD8 opcode (X assigned) - 1 17 DMX opcode (X_DMXRemoveInput) - 2 3 request length - 4 CARD32 physicalId - ==> - 1 1 Reply - 1 unused - 2 CARD16 sequence number - 4 0 reply length - 4 CARD32 status - 20 unused - - -8. Changes to existing requests/replies/events - - No changes to existing requests, replies, or events are necessitated - by this extension. - - - -9. Acknowledgments - - - -10. References - - [X11R6.4] Robert W. Sheifler. X Window System Protocol, X Consortium - Standard, X Version 11, Release 6.4. Available from - xc/doc/specs/XProtocol and xc/doc/hardcopy/XProtocol. diff --git a/hw/dmx/doc/Makefile.am b/hw/dmx/doc/Makefile.am deleted file mode 100644 index 0713884cd..000000000 --- a/hw/dmx/doc/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright 2005 Red Hat, Inc. -# -# Permission to use, copy, modify, distribute, and sell this software -# and its documentation for any purpose is hereby granted without -# fee, provided that the above copyright notice appear in all copies -# and that both that copyright notice and this permission notice -# appear in supporting documentation, and that the name of Red Hat -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. Red -# Hat makes no representations about the suitability of this software -# for any purpose. It is provided "as is" without express or implied -# warranty. -# -# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN -# NO EVENT SHALL RED HAT 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. - -if ENABLE_DEVEL_DOCS -if HAVE_XMLTO - -# Main DocBook/XML files (DOCTYPE book) -docbook = dmx.xml scaled.xml - -# Generate DocBook/XML output formats with or without stylesheets -include $(top_srcdir)/devbook.am - -endif HAVE_XMLTO -endif ENABLE_DEVEL_DOCS - -EXTRA_DIST = DMXSpec.txt DMXSpec-v1.txt diff --git a/hw/dmx/doc/dmx.xml b/hw/dmx/doc/dmx.xml deleted file mode 100644 index 2f86e5d33..000000000 --- a/hw/dmx/doc/dmx.xml +++ /dev/null @@ -1,3402 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" - "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ - <!ENTITY % defs SYSTEM "/xserver/doc/xml/xserver.ent"> %defs; -]> - -<article> - - <articleinfo> - <!-- Title information --> - <title>Distributed Multihead X Design</title> - <authorgroup> - <author><firstname>Kevin E.</firstname><surname>Martin</surname></author> - <author><firstname>David H.</firstname><surname>Dawes</surname></author> - <author><firstname>Rickard E.</firstname><surname>Faith</surname></author> - </authorgroup> - <pubdate>29 June 2004 (created 25 July 2001)</pubdate> - <releaseinfo>X Server Version &xserver.version;</releaseinfo> - <abstract><para> - This document covers the motivation, background, design, and - implementation of the distributed multihead X (DMX) system. It - is a living document and describes the current design and - implementation details of the DMX system. As the project - progresses, this document will be continually updated to reflect - the changes in the code and/or design. <emphasis remap="it">Copyright 2001 by VA - Linux Systems, Inc., Fremont, California. Copyright 2001-2004 - by Red Hat, Inc., Raleigh, North Carolina</emphasis> - </para></abstract> - </articleinfo> - -<!-- Begin the document --> -<sect1> -<title>Introduction</title> - -<sect2> -<title>The Distributed Multihead X Server</title> - -<para>Current Open Source multihead solutions are limited to a single -physical machine. A single X server controls multiple display devices, -which can be arranged as independent heads or unified into a single -desktop (with Xinerama). These solutions are limited to the number of -physical devices that can co-exist in a single machine (e.g., due to the -number of AGP/PCI slots available for graphics cards). Thus, large -tiled displays are not currently possible. The work described in this -paper will eliminate the requirement that the display devices reside in -the same physical machine. This will be accomplished by developing a -front-end proxy X server that will control multiple back-end X servers -that make up the large display. -</para> - -<para>The overall structure of the distributed multihead X (DMX) project is -as follows: A single front-end X server will act as a proxy to a set of -back-end X servers, which handle all of the visible rendering. X -clients will connect to the front-end server just as they normally would -to a regular X server. The front-end server will present an abstracted -view to the client of a single large display. This will ensure that all -standard X clients will continue to operate without modification -(limited, as always, by the visuals and extensions provided by the X -server). Clients that are DMX-aware will be able to use an extension to -obtain information about the back-end servers (e.g., for placement of -pop-up windows, window alignments by the window manager, etc.). -</para> - -<para>The architecture of the DMX server is divided into two main sections: -input (e.g., mouse and keyboard events) and output (e.g., rendering and -windowing requests). Each of these are describe briefly below, and the -rest of this design document will describe them in greater detail. -</para> - -<para>The DMX server can receive input from three general types of input -devices: "local" devices that are physically attached to the machine on -which DMX is running, "backend" devices that are physically attached to -one or more of the back-end X servers (and that generate events via the -X protocol stream from the backend), and "console" devices that can be -abstracted from any non-back-end X server. Backend and console devices -are treated differently because the pointer device on the back-end X -server also controls the location of the hardware X cursor. Full -support for XInput extension devices is provided. -</para> - -<para>Rendering requests will be accepted by the front-end server; however, -rendering to visible windows will be broken down as needed and sent to -the appropriate back-end server(s) via X11 library calls for actual -rendering. The basic framework will follow a Xnest-style approach. GC -state will be managed in the front-end server and sent to the -appropriate back-end server(s) as required. Pixmap rendering will (at -least initially) be handled by the front-end X server. Windowing -requests (e.g., ordering, mapping, moving, etc.) will handled in the -front-end server. If the request requires a visible change, the -windowing operation will be translated into requests for the appropriate -back-end server(s). Window state will be mirrored in the back-end -server(s) as needed. -</para> -</sect2> - -<sect2> -<title>Layout of Paper</title> - -<para>The next section describes the general development plan that was -actually used for implementation. The final section discusses -outstanding issues at the conclusion of development. The first appendix -provides low-level technical detail that may be of interest to those -intimately familiar with the X server architecture. The final appendix -describes the four phases of development that were performed during the -first two years of development. -</para> - -<para>The final year of work was divided into 9 tasks that are not -described in specific sections of this document. The major tasks during -that time were the enhancement of the reconfiguration ability added in -Phase IV, addition of support for a dynamic number of back-end displays -(instead of a hard-coded limit), and the support for back-end display -and input removal and addition. This work is mentioned in this paper, -but is not covered in detail. -</para> -</sect2> -</sect1> - -<!-- ============================================================ --> -<sect1> -<title>Development plan</title> - -<para>This section describes the development plan from approximately June -2001 through July 2003. -</para> - -<sect2> -<title>Bootstrap code</title> - -<para>To allow for rapid development of the DMX server by multiple -developers during the first development stage, the problem will be -broken down into three tasks: the overall DMX framework, back-end -rendering services and input device handling services. However, before -the work begins on these tasks, a simple framework that each developer -could use was implemented to bootstrap the development effort. This -framework renders to a single back-end server and provides dummy input -devices (i.e., the keyboard and mouse). The simple back-end rendering -service was implemented using the shadow framebuffer support currently -available in the XFree86 environment. -</para> - -<para>Using this bootstrapping framework, each developer has been able to -work on each of the tasks listed above independently as follows: the -framework will be extended to handle arbitrary back-end server -configurations; the back-end rendering services will be transitioned to -the more efficient Xnest-style implementation; and, an input device -framework to handle various input devices via the input extension will -be developed. -</para> - -<para>Status: The boot strap code is complete. <!-- August 2001 --> -</para> - -</sect2> - -<sect2> -<title>Input device handling</title> - -<para>An X server (including the front-end X server) requires two core -input devices -- a keyboard and a pointer (mouse). These core devices -are handled and required by the core X11 protocol. Additional types of -input devices may be attached and utilized via the XInput extension. -These are usually referred to as ``XInput extension devices'', -</para> - -<para>There are some options as to how the front-end X server gets its core -input devices: - -<orderedlist> -<listitem> - <para>Local Input. The physical input devices (e.g., keyboard and - mouse) can be attached directly to the front-end X server. In this - case, the keyboard and mouse on the machine running the front-end X - server will be used. The front-end will have drivers to read the - raw input from those devices and convert it into the required X - input events (e.g., key press/release, pointer button press/release, - pointer motion). The front-end keyboard driver will keep track of - keyboard properties such as key and modifier mappings, autorepeat - state, keyboard sound and led state. Similarly the front-end - pointer driver will keep track if pointer properties such as the - button mapping and movement acceleration parameters. With this - option, input is handled fully in the front-end X server, and the - back-end X servers are used in a display-only mode. This option was - implemented and works for a limited number of Linux-specific - devices. Adding additional local input devices for other - architectures is expected to be relatively simple. -</para> - - <para>The following options are available for implementing local input - devices: - -<orderedlist> -<listitem> - <para>The XFree86 X server has modular input drivers that could - be adapted for this purpose. The mouse driver supports a wide - range of mouse types and interfaces, as well as a range of - Operating System platforms. The keyboard driver in XFree86 is - not currently as modular as the mouse driver, but could be made - so. The XFree86 X server also has a range of other input - drivers for extended input devices such as tablets and touch - screens. Unfortunately, the XFree86 drivers are generally - complex, often simultaneously providing support for multiple - devices across multiple architectures; and rely so heavily on - XFree86-specific helper-functions, that this option was not - pursued. -</para> -</listitem> - -<listitem> - <para>The <command>kdrive</command> X server in XFree86 has built-in drivers that - support PS/2 mice and keyboard under Linux. The mouse driver - can indirectly handle other mouse types if the Linux utility - <command>gpm</command> is used as to translate the native mouse protocol into - PS/2 mouse format. These drivers could be adapted and built in - to the front-end X server if this range of hardware and OS - support is sufficient. While much simpler than the XFree86 - drivers, the <command>kdrive</command> drivers were not used for the DMX - implementation. -</para> -</listitem> - -<listitem> - <para>Reimplementation of keyboard and mouse drivers from - scratch for the DMX framework. Because keyboard and mouse - drivers are relatively trivial to implement, this pathway was - selected. Other drivers in the X source tree were referenced, - and significant contributions from other drivers are noted in - the DMX source code. -</para> -</listitem> -</orderedlist> -</para> -</listitem> - -<listitem> - <para>Backend Input. The front-end can make use of the core input - devices attached to one or more of the back-end X servers. Core - input events from multiple back-ends are merged into a single input - event stream. This can work sanely when only a single set of input - devices is used at any given time. The keyboard and pointer state - will be handled in the front-end, with changes propagated to the - back-end servers as needed. This option was implemented and works - well. Because the core pointer on a back-end controls the hardware - mouse on that back-end, core pointers cannot be treated as XInput - extension devices. However, all back-end XInput extensions devices - can be mapped to either DMX core or DMX XInput extension devices. -</para> -</listitem> - -<listitem> - <para>Console Input. The front-end server could create a console - window that is displayed on an X server independent of the back-end - X servers. This console window could display things like the - physical screen layout, and the front-end could get its core input - events from events delivered to the console window. This option was - implemented and works well. To help the human navigate, window - outlines are also displayed in the console window. Further, console - windows can be used as either core or XInput extension devices. -</para> -</listitem> - -<listitem> - <para>Other options were initially explored, but they were all - partial subsets of the options listed above and, hence, are - irrelevant. -</para> -</listitem> - -</orderedlist> -</para> - -<para>Although extended input devices are not specifically mentioned in the -Distributed X requirements, the options above were all implemented so -that XInput extension devices were supported. -</para> - -<para>The bootstrap code (Xdmx) had dummy input devices, and these are -still supported in the final version. These do the necessary -initialization to satisfy the X server's requirements for core pointer -and keyboard devices, but no input events are ever generated. -</para> - -<para>Status: The input code is complete. Because of the complexity of the -XFree86 input device drivers (and their heavy reliance on XFree86 -infrastructure), separate low-level device drivers were implemented for -Xdmx. The following kinds of drivers are supported (in general, the -devices can be treated arbitrarily as "core" input devices or as XInput -"extension" devices; and multiple instances of different kinds of -devices can be simultaneously available): -<orderedlist> -<listitem> - <para> A "dummy" device drive that never generates events. -</para> -</listitem> - -<listitem> - <para> "Local" input is from the low-level hardware on which the - Xdmx binary is running. This is the only area where using the - XFree86 driver infrastructure would have been helpful, and then - only partially, since good support for generic USB devices does - not yet exist in XFree86 (in any case, XFree86 and kdrive driver - code was used where possible). Currently, the following local - devices are supported under Linux (porting to other operating - systems should be fairly straightforward): - <itemizedlist> - <listitem><para>Linux keyboard</para></listitem> - <listitem><para>Linux serial mouse (MS)</para></listitem> - <listitem><para>Linux PS/2 mouse</para></listitem> - <listitem><para>USB keyboard</para></listitem> - <listitem><para>USB mouse</para></listitem> - <listitem><para>USB generic device (e.g., joystick, gamepad, etc.)</para></listitem> - </itemizedlist> -</para> -</listitem> - -<listitem> - <para> "Backend" input is taken from one or more of the back-end - displays. In this case, events are taken from the back-end X - server and are converted to Xdmx events. Care must be taken so - that the sprite moves properly on the display from which input - is being taken. -</para> -</listitem> - -<listitem> - <para> "Console" input is taken from an X window that Xdmx - creates on the operator's display (i.e., on the machine running - the Xdmx binary). When the operator's mouse is inside the - console window, then those events are converted to Xdmx events. - Several special features are available: the console can display - outlines of windows that are on the Xdmx display (to facilitate - navigation), the cursor can be confined to the console, and a - "fine" mode can be activated to allow very precise cursor - positioning. -</para> -</listitem> -</orderedlist> - -</para> - -</sect2> - -<!-- May 2002; July 2003 --> - -<sect2> -<title>Output device handling</title> - -<para>The output of the DMX system displays rendering and windowing -requests across multiple screens. The screens are typically arranged in -a grid such that together they represent a single large display. -</para> - -<para>The output section of the DMX code consists of two parts. The first -is in the front-end proxy X server (Xdmx), which accepts client -connections, manages the windows, and potentially renders primitives but -does not actually display any of the drawing primitives. The second -part is the back-end X server(s), which accept commands from the -front-end server and display the results on their screens. -</para> - -<sect3> -<title>Initialization</title> - -<para>The DMX front-end must first initialize its screens by connecting to -each of the back-end X servers and collecting information about each of -these screens. However, the information collected from the back-end X -servers might be inconsistent. Handling these cases can be difficult -and/or inefficient. For example, a two screen system has one back-end X -server running at 16bpp while the second is running at 32bpp. -Converting rendering requests (e.g., XPutImage() or XGetImage() -requests) to the appropriate bit depth can be very time consuming. -Analyzing these cases to determine how or even if it is possible to -handle them is required. The current Xinerama code handles many of -these cases (e.g., in PanoramiXConsolidate()) and will be used as a -starting point. In general, the best solution is to use homogeneous X -servers and display devices. Using back-end servers with the same depth -is a requirement of the final DMX implementation. -</para> - -<para>Once this screen consolidation is finished, the relative position of -each back-end X server's screen in the unified screen is initialized. A -full-screen window is opened on each of the back-end X servers, and the -cursor on each screen is turned off. The final DMX implementation can -also make use of a partial-screen window, or multiple windows per -back-end screen. -</para> -</sect3> - -<sect3> -<title>Handling rendering requests</title> - -<para>After initialization, X applications connect to the front-end server. -There are two possible implementations of how rendering and windowing -requests are handled in the DMX system: - -<orderedlist> -<listitem> - <para>A shadow framebuffer is used in the front-end server as the - render target. In this option, all protocol requests are completely - handled in the front-end server. All state and resources are - maintained in the front-end including a shadow copy of the entire - framebuffer. The framebuffers attached to the back-end servers are - updated by XPutImage() calls with data taken directly from the - shadow framebuffer. -</para> - - <para>This solution suffers from two main problems. First, it does not - take advantage of any accelerated hardware available in the system. - Second, the size of the XPutImage() calls can be quite large and - thus will be limited by the bandwidth available. -</para> - - <para>The initial DMX implementation used a shadow framebuffer by - default. -</para> -</listitem> - -<listitem> - <para>Rendering requests are sent to each back-end server for - handling (as is done in the Xnest server described above). In this - option, certain protocol requests are handled in the front-end - server and certain requests are repackaged and then sent to the - back-end servers. The framebuffer is distributed across the - multiple back-end servers. Rendering to the framebuffer is handled - on each back-end and can take advantage of any acceleration - available on the back-end servers' graphics display device. State - is maintained both in the front and back-end servers. -</para> - - <para>This solution suffers from two main drawbacks. First, protocol - requests are sent to all back-end servers -- even those that will - completely clip the rendering primitive -- which wastes bandwidth - and processing time. Second, state is maintained both in the front- - and back-end servers. These drawbacks are not as severe as in - option 1 (above) and can either be overcome through optimizations or - are acceptable. Therefore, this option will be used in the final - implementation. -</para> - - <para>The final DMX implementation defaults to this mechanism, but also - supports the shadow framebuffer mechanism. Several optimizations - were implemented to eliminate the drawbacks of the default - mechanism. These optimizations are described the section below and - in Phase II of the Development Results (see appendix). -</para> -</listitem> - -</orderedlist> -</para> - -<para>Status: Both the shadow framebuffer and Xnest-style code is complete. -<!-- May 2002 --> -</para> - -</sect3> -</sect2> - -<sect2> -<title>Optimizing DMX</title> - -<para>Initially, the Xnest-style solution's performance will be measured -and analyzed to determine where the performance bottlenecks exist. -There are four main areas that will be addressed. -</para> - -<para>First, to obtain reasonable interactivity with the first development -phase, XSync() was called after each protocol request. The XSync() -function flushes any pending protocol requests. It then waits for the -back-end to process the request and send a reply that the request has -completed. This happens with each back-end server and performance -greatly suffers. As a result of the way XSync() is called in the first -development phase, the batching that the X11 library performs is -effectively defeated. The XSync() call usage will be analyzed and -optimized by batching calls and performing them at regular intervals, -except where interactivity will suffer (e.g., on cursor movements). -</para> - -<para>Second, the initial Xnest-style solution described above sends the -repackaged protocol requests to all back-end servers regardless of -whether or not they would be completely clipped out. The requests that -are trivially rejected on the back-end server wastes the limited -bandwidth available. By tracking clipping changes in the DMX X server's -windowing code (e.g., by opening, closing, moving or resizing windows), -we can determine whether or not back-end windows are visible so that -trivial tests in the front-end server's GC ops drawing functions can -eliminate these unnecessary protocol requests. -</para> - -<para>Third, each protocol request will be analyzed to determine if it is -possible to break the request into smaller pieces at display boundaries. -The initial ones to be analyzed are put and get image requests since -they will require the greatest bandwidth to transmit data between the -front and back-end servers. Other protocol requests will be analyzed -and those that will benefit from breaking them into smaller requests -will be implemented. -</para> - -<para>Fourth, an extension is being considered that will allow font glyphs to -be transferred from the front-end DMX X server to each back-end server. -This extension will permit the front-end to handle all font requests and -eliminate the requirement that all back-end X servers share the exact -same fonts as the front-end server. We are investigating the -feasibility of this extension during this development phase. -</para> - -<para>Other potential optimizations will be determined from the performance -analysis. -</para> - -<para>Please note that in our initial design, we proposed optimizing BLT -operations (e.g., XCopyArea() and window moves) by developing an -extension that would allow individual back-end servers to directly copy -pixel data to other back-end servers. This potential optimization was -in response to the simple image movement implementation that required -potentially many calls to GetImage() and PutImage(). However, the -current Xinerama implementation handles these BLT operations -differently. Instead of copying data to and from screens, they generate -expose events -- just as happens in the case when a window is moved from -off a screen to on screen. This approach saves the limited bandwidth -available between front and back-end servers and is being standardized -with Xinerama. It also eliminates the potential setup problems and -security issues resulting from having each back-end server open -connections to all other back-end servers. Therefore, we suggest -accepting Xinerama's expose event solution. -</para> - -<para>Also note that the approach proposed in the second and third -optimizations might cause backing store algorithms in the back-end to be -defeated, so a DMX X server configuration flag will be added to disable -these optimizations. -</para> - -<para>Status: The optimizations proposed above are complete. It was -determined that the using the xfs font server was sufficient and -creating a new mechanism to pass glyphs was redundant; therefore, the -fourth optimization proposed above was not included in DMX. -<!-- September 2002 --> -</para> - -</sect2> - -<sect2> -<title>DMX X extension support</title> - -<para>The DMX X server keeps track of all the windowing information on the -back-end X servers, but does not currently export this information to -any client applications. An extension will be developed to pass the -screen information and back-end window IDs to DMX-aware clients. These -clients can then use this information to directly connect to and render -to the back-end windows. Bypassing the DMX X server allows DMX-aware -clients to break up complex rendering requests on their own and send -them directly to the windows on the back-end server's screens. An -example of a client that can make effective use of this extension is -Chromium. -</para> - -<para>Status: The extension, as implemented, is fully documented in -"Client-to-Server DMX Extension to the X Protocol". Future changes -might be required based on feedback and other proposed enhancements to -DMX. Currently, the following facilities are supported: -<orderedlist> -<listitem><para> - Screen information (clipping rectangle for each screen relative - to the virtual screen) -</para></listitem> -<listitem><para> - Window information (window IDs and clipping information for each - back-end window that corresponds to each DMX window) -</para></listitem> -<listitem><para> - Input device information (mappings from DMX device IDs to - back-end device IDs) -</para></listitem> -<listitem><para> - Force window creation (so that a client can override the - server-side lazy window creation optimization) -</para></listitem> -<listitem><para> - Reconfiguration (so that a client can request that a screen - position be changed) -</para></listitem> -<listitem><para> - Addition and removal of back-end servers and back-end and - console inputs. -</para></listitem> -</orderedlist> -</para> -<!-- September 2002; July 2003 --> - -</sect2> - -<sect2> -<title>Common X extension support</title> - -<para>The XInput, XKeyboard and Shape extensions are commonly used -extensions to the base X11 protocol. XInput allows multiple and -non-standard input devices to be accessed simultaneously. These input -devices can be connected to either the front-end or back-end servers. -XKeyboard allows much better keyboard mappings control. Shape adds -support for arbitrarily shaped windows and is used by various window -managers. Nearly all potential back-end X servers make these extensions -available, and support for each one will be added to the DMX system. -</para> - -<para>In addition to the extensions listed above, support for the X -Rendering extension (Render) is being developed. Render adds digital -image composition to the rendering model used by the X Window System. -While this extension is still under development by Keith Packard of HP, -support for the current version will be added to the DMX system. -</para> - -<para>Support for the XTest extension was added during the first -development phase. -</para> - -<!-- WARNING: this list is duplicated in the Phase IV discussion --> -<para>Status: The following extensions are supported and are discussed in -more detail in Phase IV of the Development Results (see appendix): - BIG-REQUESTS, - DEC-XTRAP, - DMX, - DPMS, - Extended-Visual-Information, - GLX, - LBX, - RECORD, - RENDER, - SECURITY, - SHAPE, - SYNC, - X-Resource, - XC-APPGROUP, - XC-MISC, - XFree86-Bigfont, - XINERAMA, - XInputExtension, - XKEYBOARD, and - XTEST. -<!-- November 2002; updated February 2003, July 2003 --> -</para> -</sect2> - -<sect2> -<title>OpenGL support</title> - -<para>OpenGL support using the Mesa code base exists in XFree86 release 4 -and later. Currently, the direct rendering infrastructure (DRI) -provides accelerated OpenGL support for local clients and unaccelerated -OpenGL support (i.e., software rendering) is provided for non-local -clients. -</para> - -<para>The single head OpenGL support in XFree86 4.x will be extended to use -the DMX system. When the front and back-end servers are on the same -physical hardware, it is possible to use the DRI to directly render to -the back-end servers. First, the existing DRI will be extended to -support multiple display heads, and then to support the DMX system. -OpenGL rendering requests will be direct rendering to each back-end X -server. The DRI will request the screen layout (either from the -existing Xinerama extension or a DMX-specific extension). Support for -synchronized swap buffers will also be added (on hardware that supports -it). Note that a single front-end server with a single back-end server -on the same physical machine can emulate accelerated indirect rendering. -</para> - -<para>When the front and back-end servers are on different physical -hardware or are using non-XFree86 4.x X servers, a mechanism to render -primitives across the back-end servers will be provided. There are -several options as to how this can be implemented. -</para> - -<orderedlist> -<listitem> - <para>The existing OpenGL support in each back-end server can be - used by repackaging rendering primitives and sending them to each - back-end server. This option is similar to the unoptimized - Xnest-style approach mentioned above. Optimization of this solution - is beyond the scope of this project and is better suited to other - distributed rendering systems. -</para></listitem> - -<listitem> - <para>Rendering to a pixmap in the front-end server using the - current XFree86 4.x code, and then displaying to the back-ends via - calls to XPutImage() is another option. This option is similar to - the shadow frame buffer approach mentioned above. It is slower and - bandwidth intensive, but has the advantage that the back-end servers - are not required to have OpenGL support. -</para></listitem> -</orderedlist> - -<para>These, and other, options will be investigated in this phase of the -work. -</para> - -<para>Work by others have made Chromium DMX-aware. Chromium will use the -DMX X protocol extension to obtain information about the back-end -servers and will render directly to those servers, bypassing DMX. -</para> - -<para>Status: OpenGL support by the glxProxy extension was implemented by -SGI and has been integrated into the DMX code base. -</para> -<!-- May 2003--> -</sect2> - -</sect1> - -<!-- ============================================================ --> -<sect1> -<title>Current issues</title> - -<para>In this sections the current issues are outlined that require further -investigation. -</para> - -<sect2> -<title>Fonts</title> - -<para>The font path and glyphs need to be the same for the front-end and -each of the back-end servers. Font glyphs could be sent to the back-end -servers as necessary but this would consume a significant amount of -available bandwidth during font rendering for clients that use many -different fonts (e.g., Netscape). Initially, the font server (xfs) will -be used to provide the fonts to both the front-end and back-end servers. -Other possibilities will be investigated during development. -</para> -</sect2> - -<sect2> -<title>Zero width rendering primitives</title> - -<para>To allow pixmap and on-screen rendering to be pixel perfect, all -back-end servers must render zero width primitives exactly the same as -the front-end renders the primitives to pixmaps. For those back-end -servers that do not exactly match, zero width primitives will be -automatically converted to one width primitives. This can be handled in -the front-end server via the GC state. -</para> -</sect2> - -<sect2> -<title>Output scaling</title> - -<para>With very large tiled displays, it might be difficult to read the -information on the standard X desktop. In particular, the cursor can be -easily lost and fonts could be difficult to read. Automatic primitive -scaling might prove to be very useful. We will investigate the -possibility of scaling the cursor and providing a set of alternate -pre-scaled fonts to replace the standard fonts that many applications -use (e.g., fixed). Other options for automatic scaling will also be -investigated. -</para> -</sect2> - -<sect2> -<title>Per-screen colormaps</title> - -<para>Each screen's default colormap in the set of back-end X servers -should be able to be adjusted via a configuration utility. This support -is would allow the back-end screens to be calibrated via custom gamma -tables. On 24-bit systems that support a DirectColor visual, this type -of correction can be accommodated. One possible implementation would be -to advertise to X client of the DMX server a TrueColor visual while -using DirectColor visuals on the back-end servers to implement this type -of color correction. Other options will be investigated. -</para> -</sect2> -</sect1> - -<!-- ============================================================ --> -<appendix> -<title>Appendix</title> - -<sect1> -<title>Background</title> - -<para>This section describes the existing Open Source architectures that -can be used to handle multiple screens and upon which this development -project is based. This section was written before the implementation -was finished, and may not reflect actual details of the implementation. -It is left for historical interest only. -</para> - -<sect2> -<title>Core input device handling</title> - -<para>The following is a description of how core input devices are handled -by an X server. -</para> - -<sect3> -<title>InitInput()</title> - -<para>InitInput() is a DDX function that is called at the start of each -server generation from the X server's main() function. Its purpose is -to determine what input devices are connected to the X server, register -them with the DIX and MI layers, and initialize the input event queue. -InitInput() does not have a return value, but the X server will abort if -either a core keyboard device or a core pointer device are not -registered. Extended input (XInput) devices can also be registered in -InitInput(). -</para> - -<para>InitInput() usually has implementation specific code to determine -which input devices are available. For each input device it will be -using, it calls AddInputDevice(): - -<variablelist> -<varlistentry> -<term>AddInputDevice()</term> -<listitem><para>This DIX function allocates the device structure, -registers a callback function (which handles device init, close, on and -off), and returns the input handle, which can be treated as opaque. It -is called once for each input device. -</para></listitem> -</varlistentry> -</variablelist> -</para> - -<para>Once input handles for core keyboard and core pointer devices have -been obtained from AddInputDevice(). If both core devices are not -registered, then the X server will exit with a fatal error when it -attempts to start the input devices in InitAndStartDevices(), which is -called directly after InitInput() (see below). -</para> - -<para>The core pointer device is then registered with the miPointer code -(which does the high level cursor handling). While this registration -is not necessary for correct miPointer operation in the current XFree86 -code, it is still done mostly for compatibility reasons. -</para> - -<para><variablelist> - -<varlistentry> -<term>miRegisterPointerDevice()</term> -<listitem><para>This MI function registers the core -pointer's input handle with with the miPointer code. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>The final part of InitInput() is the initialization of the input -event queue handling. In most cases, the event queue handling provided -in the MI layer is used. The primary XFree86 X server uses its own -event queue handling to support some special cases related to the XInput -extension and the XFree86-specific DGA extension. For our purposes, the -MI event queue handling should be suitable. It is initialized by -calling mieqInit(): - -<variablelist> -<varlistentry> -<term>mieqInit()</term> -<listitem><para>This MI function initializes the MI event queue for the -core devices, and is passed the public component of the input handles -for the two core devices. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>If a wakeup handler is required to deliver synchronous input -events, it can be registered here by calling the DIX function -RegisterBlockAndWakeupHandlers(). (See the devReadInput() description -below.) -</para> -</sect3> - -<sect3> -<title>InitAndStartDevices()</title> - -<para>InitAndStartDevices() is a DIX function that is called immediately -after InitInput() from the X server's main() function. Its purpose is -to initialize each input device that was registered with -AddInputDevice(), enable each input device that was successfully -initialized, and create the list of enabled input devices. Once each -registered device is processed in this way, the list of enabled input -devices is checked to make sure that both a core keyboard device and -core pointer device were registered and successfully enabled. If not, -InitAndStartDevices() returns failure, and results in the the X server -exiting with a fatal error. -</para> - -<para>Each registered device is initialized by calling its callback -(dev->deviceProc) with the DEVICE_INIT argument: - -<variablelist> -<varlistentry> -<term>(*dev->deviceProc)(dev, DEVICE_INIT)</term> -<listitem> -<para>This function initializes the -device structs with core information relevant to the device. -</para> - -<para>For pointer devices, this means specifying the number of buttons, -default button mapping, the function used to get motion events (usually -miPointerGetMotionEvents()), the function used to change/control the -core pointer motion parameters (acceleration and threshold), and the -motion buffer size. -</para> - -<para>For keyboard devices, this means specifying the keycode range, -default keycode to keysym mapping, default modifier mapping, and the -functions used to sound the keyboard bell and modify/control the -keyboard parameters (LEDs, bell pitch and duration, key click, which -keys are auto-repeating, etc). -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>Each initialized device is enabled by calling EnableDevice(): - -<variablelist> -<varlistentry> -<term>EnableDevice()</term> -<listitem> -<para>EnableDevice() calls the device callback with -DEVICE_ON: - <variablelist> - <varlistentry> - <term>(*dev->deviceProc)(dev, DEVICE_ON)</term> - <listitem> - <para>This typically opens and - initializes the relevant physical device, and when appropriate, - registers the device's file descriptor (or equivalent) as a valid - input source. - </para></listitem></varlistentry> - </variablelist> - </para> - - <para>EnableDevice() then adds the device handle to the X server's - global list of enabled devices. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>InitAndStartDevices() then verifies that a valid core keyboard and -pointer has been initialized and enabled. It returns failure if either -are missing. -</para> -</sect3> - -<sect3> -<title>devReadInput()</title> - -<para>Each device will have some function that gets called to read its -physical input. This function should do at least two things: make sure that -input events get enqueued, and make sure that the cursor gets moved for motion -events (except if these are handled later by the driver's own event queue -processing function, which cannot be done when using the MI event queue -handling). -</para> - -<para>Events are queued by calling mieqEnqueue(): - -<variablelist> -<varlistentry> -<term>mieqEnqueue()</term> -<listitem> -<para>This MI function is used to add input events to the -event queue. It is simply passed the event to be queued. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>The cursor position should be updated when motion events are -enqueued by calling miPointerDeltaCursor(): - -<variablelist> -<varlistentry> -<term>miPointerDeltaCursor()</term> -<listitem> -<para>This MI function is used to move the cursor -relative to its current position. -</para></listitem></varlistentry> -</variablelist> -</para> -</sect3> - -<sect3> -<title>ProcessInputEvents()</title> - -<para>ProcessInputEvents() is a DDX function that is called from the X -server's main dispatch loop when new events are available in the input -event queue. It typically processes the enqueued events, and updates -the cursor/pointer position. It may also do other DDX-specific event -processing. -</para> - -<para>Enqueued events are processed by mieqProcessInputEvents() and passed -to the DIX layer for transmission to clients: - -<variablelist> -<varlistentry> -<term>mieqProcessInputEvents()</term> -<listitem> -<para>This function processes each event in the -event queue, and passes it to the device's input processing function. -The DIX layer provides default functions to do this processing, and they -handle the task of getting the events passed back to the relevant -clients. -</para></listitem></varlistentry> -<varlistentry> -<term>miPointerUpdate()</term> -<listitem> -<para>This function resynchronized the cursor position -with the new pointer position. It also takes care of moving the cursor -between screens when needed in multi-head configurations. -</para></listitem></varlistentry> -</variablelist> -</para> - -</sect3> - -<sect3> -<title>DisableDevice()</title> - -<para>DisableDevice is a DIX function that removes an input device from the -list of enabled devices. The result of this is that the device no -longer generates input events. The device's data structures are kept in -place, and disabling a device like this can be reversed by calling -EnableDevice(). DisableDevice() may be called from the DDX when it is -desirable to do so (e.g., the XFree86 server does this when VT -switching). Except for special cases, this is not normally called for -core input devices. -</para> - -<para>DisableDevice() calls the device's callback function with -<constant>DEVICE_OFF</constant>: - -<variablelist> -<varlistentry> -<term>(*dev->deviceProc)(dev, DEVICE_OFF)</term> -<listitem> -<para>This typically closes the -relevant physical device, and when appropriate, unregisters the device's -file descriptor (or equivalent) as a valid input source. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>DisableDevice() then removes the device handle from the X server's -global list of enabled devices. -</para> - -</sect3> - -<sect3> -<title>CloseDevice()</title> - -<para>CloseDevice is a DIX function that removes an input device from the -list of available devices. It disables input from the device and frees -all data structures associated with the device. This function is -usually called from CloseDownDevices(), which is called from main() at -the end of each server generation to close all input devices. -</para> - -<para>CloseDevice() calls the device's callback function with -<constant>DEVICE_CLOSE</constant>: - -<variablelist> -<varlistentry> -<term>(*dev->deviceProc)(dev, DEVICE_CLOSE)</term> -<listitem> -<para>This typically closes the -relevant physical device, and when appropriate, unregisters the device's -file descriptor (or equivalent) as a valid input source. If any device -specific data structures were allocated when the device was initialized, -they are freed here. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>CloseDevice() then frees the data structures that were allocated -for the device when it was registered/initialized. -</para> - -</sect3> - -</sect2> - -<sect2> -<title>Output handling</title> - -<para>The following sections describe the main functions required to -initialize, use and close the output device(s) for each screen in the X -server. -</para> - -<sect3> -<title>InitOutput()</title> - -<para>This DDX function is called near the start of each server generation -from the X server's main() function. InitOutput()'s main purpose is to -initialize each screen and fill in the global screenInfo structure for -each screen. It is passed three arguments: a pointer to the screenInfo -struct, which it is to initialize, and argc and argv from main(), which -can be used to determine additional configuration information. -</para> - -<para>The primary tasks for this function are outlined below: - -<orderedlist> -<listitem> - <para><emphasis remap="bf">Parse configuration info:</emphasis> The first task of InitOutput() - is to parses any configuration information from the configuration - file. In addition to the XF86Config file, other configuration - information can be taken from the command line. The command line - options can be gathered either in InitOutput() or earlier in the - ddxProcessArgument() function, which is called by - ProcessCommandLine(). The configuration information determines the - characteristics of the screen(s). For example, in the XFree86 X - server, the XF86Config file specifies the monitor information, the - screen resolution, the graphics devices and slots in which they are - located, and, for Xinerama, the screens' layout. -</para> -</listitem> - -<listitem> - <para><emphasis remap="bf">Initialize screen info:</emphasis> The next task is to initialize - the screen-dependent internal data structures. For example, part of - what the XFree86 X server does is to allocate its screen and pixmap - private indices, probe for graphics devices, compare the probed - devices to the ones listed in the XF86Config file, and add the ones that - match to the internal xf86Screens[] structure. -</para> -</listitem> - -<listitem> - <para><emphasis remap="bf">Set pixmap formats:</emphasis> The next task is to initialize the - screenInfo's image byte order, bitmap bit order and bitmap scanline - unit/pad. The screenInfo's pixmap format's depth, bits per pixel - and scanline padding is also initialized at this stage. -</para> -</listitem> - -<listitem> - <para><emphasis remap="bf">Unify screen info:</emphasis> An optional task that might be done at - this stage is to compare all of the information from the various - screens and determines if they are compatible (i.e., if the set of - screens can be unified into a single desktop). This task has - potential to be useful to the DMX front-end server, if Xinerama's - PanoramiXConsolidate() function is not sufficient. -</para> -</listitem> -</orderedlist> -</para> - -<para>Once these tasks are complete, the valid screens are known and each -of these screens can be initialized by calling AddScreen(). -</para> -</sect3> - -<sect3> -<title>AddScreen()</title> - -<para>This DIX function is called from InitOutput(), in the DDX layer, to -add each new screen to the screenInfo structure. The DDX screen -initialization function and command line arguments (i.e., argc and argv) -are passed to it as arguments. -</para> - -<para>This function first allocates a new Screen structure and any privates -that are required. It then initializes some of the fields in the Screen -struct and sets up the pixmap padding information. Finally, it calls -the DDX screen initialization function ScreenInit(), which is described -below. It returns the number of the screen that were just added, or -1 -if there is insufficient memory to add the screen or if the DDX screen -initialization fails. -</para> -</sect3> - -<sect3> -<title>ScreenInit()</title> - -<para>This DDX function initializes the rest of the Screen structure with -either generic or screen-specific functions (as necessary). It also -fills in various screen attributes (e.g., width and height in -millimeters, black and white pixel values). -</para> - -<para>The screen init function usually calls several functions to perform -certain screen initialization functions. They are described below: - -<variablelist> -<varlistentry> -<term>{mi,*fb}ScreenInit()</term> -<listitem> -<para>The DDX layer's ScreenInit() function usually -calls another layer's ScreenInit() function (e.g., miScreenInit() or -fbScreenInit()) to initialize the fallbacks that the DDX driver does not -specifically handle. -</para> - -<para>After calling another layer's ScreenInit() function, any -screen-specific functions either wrap or replace the other layer's -function pointers. If a function is to be wrapped, each of the old -function pointers from the other layer are stored in a screen private -area. Common functions to wrap are CloseScreen() and SaveScreen(). -</para></listitem></varlistentry> - -<varlistentry> -<term>miDCInitialize()</term> -<listitem> -<para>This MI function initializes the MI cursor -display structures and function pointers. If a hardware cursor is used, -the DDX layer's ScreenInit() function will wrap additional screen and -the MI cursor display function pointers. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>Another common task for ScreenInit() function is to initialize the -output device state. For example, in the XFree86 X server, the -ScreenInit() function saves the original state of the video card and -then initializes the video mode of the graphics device. -</para> -</sect3> - -<sect3> -<title>CloseScreen()</title> - -<para>This function restores any wrapped screen functions (and in -particular the wrapped CloseScreen() function) and restores the state of -the output device to its original state. It should also free any -private data it created during the screen initialization. -</para> -</sect3> - -<sect3> -<title>GC operations</title> - -<para>When the X server is requested to render drawing primitives, it does -so by calling drawing functions through the graphics context's operation -function pointer table (i.e., the GCOps functions). These functions -render the basic graphics operations such as drawing rectangles, lines, -text or copying pixmaps. Default routines are provided either by the MI -layer, which draws indirectly through a simple span interface, or by the -framebuffer layers (e.g., CFB, MFB, FB), which draw directly to a -linearly mapped frame buffer. -</para> - -<para>To take advantage of special hardware on the graphics device, -specific GCOps functions can be replaced by device specific code. -However, many times the graphics devices can handle only a subset of the -possible states of the GC, so during graphics context validation, -appropriate routines are selected based on the state and capabilities of -the hardware. For example, some graphics hardware can accelerate single -pixel width lines with certain dash patterns. Thus, for dash patterns -that are not supported by hardware or for width 2 or greater lines, the -default routine is chosen during GC validation. -</para> - -<para>Note that some pointers to functions that draw to the screen are -stored in the Screen structure. They include GetImage(), GetSpans(), -CopyWindow() and RestoreAreas(). -</para> -</sect3> - -<sect3> -<title>Xnest</title> - -<para>The Xnest X server is a special proxy X server that relays the X -protocol requests that it receives to a ``real'' X server that then -processes the requests and displays the results, if applicable. To the X -applications, Xnest appears as if it is a regular X server. However, -Xnest is both server to the X application and client of the real X -server, which will actually handle the requests. -</para> - -<para>The Xnest server implements all of the standard input and output -initialization steps outlined above. -</para> - -<para><variablelist> -<varlistentry> -<term>InitOutput()</term> -<listitem> -<para>Xnest takes its configuration information from -command line arguments via ddxProcessArguments(). This information -includes the real X server display to connect to, its default visual -class, the screen depth, the Xnest window's geometry, etc. Xnest then -connects to the real X server and gathers visual, colormap, depth and -pixmap information about that server's display, creates a window on that -server, which will be used as the root window for Xnest. -</para> - -<para>Next, Xnest initializes its internal data structures and uses the -data from the real X server's pixmaps to initialize its own pixmap -formats. Finally, it calls AddScreen(xnestOpenScreen, argc, argv) to -initialize each of its screens. -</para></listitem></varlistentry> - -<varlistentry> -<term>ScreenInit()</term> -<listitem> -<para>Xnest's ScreenInit() function is called -xnestOpenScreen(). This function initializes its screen's depth and -visual information, and then calls miScreenInit() to set up the default -screen functions. It then calls miDCInitialize() to initialize the -software cursor. -Finally, it replaces many of the screen functions with its own -functions that repackage and send the requests to the real X server to -which Xnest is attached. -</para></listitem></varlistentry> - -<varlistentry> -<term>CloseScreen()</term> -<listitem> -<para>This function frees its internal data structure -allocations. Since it replaces instead of wrapping screen functions, -there are no function pointers to unwrap. This can potentially lead to -problems during server regeneration. -</para></listitem></varlistentry> - -<varlistentry> -<term>GC operations</term> -<listitem> -<para>The GC operations in Xnest are very simple since -they leave all of the drawing to the real X server to which Xnest is -attached. Each of the GCOps takes the request and sends it to the -real X server using standard Xlib calls. For example, the X -application issues a XDrawLines() call. This function turns into a -protocol request to Xnest, which calls the xnestPolylines() function -through Xnest's GCOps function pointer table. The xnestPolylines() -function is only a single line, which calls XDrawLines() using the same -arguments that were passed into it. Other GCOps functions are very -similar. Two exceptions to the simple GCOps functions described above -are the image functions and the BLT operations. -</para> - -<para>The image functions, GetImage() and PutImage(), must use a temporary -image to hold the image to be put of the image that was just grabbed -from the screen while it is in transit to the real X server or the -client. When the image has been transmitted, the temporary image is -destroyed. -</para> - -<para>The BLT operations, CopyArea() and CopyPlane(), handle not only the -copy function, which is the same as the simple cases described above, -but also the graphics exposures that result when the GC's graphics -exposure bit is set to True. Graphics exposures are handled in a helper -function, xnestBitBlitHelper(). This function collects the exposure -events from the real X server and, if any resulting in regions being -exposed, then those regions are passed back to the MI layer so that it -can generate exposure events for the X application. -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>The Xnest server takes its input from the X server to which it is -connected. When the mouse is in the Xnest server's window, keyboard and -mouse events are received by the Xnest server, repackaged and sent back -to any client that requests those events. -</para> -</sect3> - -<sect3> -<title>Shadow framebuffer</title> - -<para>The most common type of framebuffer is a linear array memory that -maps to the video memory on the graphics device. However, accessing -that video memory over an I/O bus (e.g., ISA or PCI) can be slow. The -shadow framebuffer layer allows the developer to keep the entire -framebuffer in main memory and copy it back to video memory at regular -intervals. It also has been extended to handle planar video memory and -rotated framebuffers. -</para> - -<para>There are two main entry points to the shadow framebuffer code: - -<variablelist> -<varlistentry> -<term>shadowAlloc(width, height, bpp)</term> -<listitem> -<para>This function allocates the in -memory copy of the framebuffer of size width*height*bpp. It returns a -pointer to that memory, which will be used by the framebuffer -ScreenInit() code during the screen's initialization. -</para></listitem></varlistentry> - -<varlistentry> -<term>shadowInit(pScreen, updateProc, windowProc)</term> -<listitem> -<para>This function -initializes the shadow framebuffer layer. It wraps several screen -drawing functions, and registers a block handler that will update the -screen. The updateProc is a function that will copy the damaged regions -to the screen, and the windowProc is a function that is used when the -entire linear video memory range cannot be accessed simultaneously so -that only a window into that memory is available (e.g., when using the -VGA aperture). -</para></listitem></varlistentry> -</variablelist> -</para> - -<para>The shadow framebuffer code keeps track of the damaged area of each -screen by calculating the bounding box of all drawing operations that -have occurred since the last screen update. Then, when the block handler -is next called, only the damaged portion of the screen is updated. -</para> - -<para>Note that since the shadow framebuffer is kept in main memory, all -drawing operations are performed by the CPU and, thus, no accelerated -hardware drawing operations are possible. -</para> - -</sect3> -</sect2> - -<sect2> -<title>Xinerama</title> - -<para>Xinerama is an X extension that allows multiple physical screens -controlled by a single X server to appear as a single screen. Although -the extension allows clients to find the physical screen layout via -extension requests, it is completely transparent to clients at the core -X11 protocol level. The original public implementation of Xinerama came -from Digital/Compaq. XFree86 rewrote it, filling in some missing pieces -and improving both X11 core protocol compliance and performance. The -Xinerama extension will be passing through X.Org's standardization -process in the near future, and the sample implementation will be based -on this rewritten version. -</para> - -<para>The current implementation of Xinerama is based primarily in the DIX -(device independent) and MI (machine independent) layers of the X -server. With few exceptions the DDX layers do not need any changes to -support Xinerama. X server extensions often do need modifications to -provide full Xinerama functionality. -</para> - -<para>The following is a code-level description of how Xinerama functions. -</para> - -<para>Note: Because the Xinerama extension was originally called the -PanoramiX extension, many of the Xinerama functions still have the -PanoramiX prefix. -</para> - -<variablelist> -<varlistentry> -<term>PanoramiXExtensionInit()</term> -<listitem> - <para>PanoramiXExtensionInit() is a - device-independent extension function that is called at the start of - each server generation from InitExtensions(), which is called from - the X server's main() function after all output devices have been - initialized, but before any input devices have been initialized. - </para> - - <para>PanoramiXNumScreens is set to the number of physical screens. If - only one physical screen is present, the extension is disabled, and - PanoramiXExtensionInit() returns without doing anything else. - </para> - - <para>The Xinerama extension is registered by calling AddExtension(). - </para> - - <para>GC and Screen private - indexes are allocated, and both GC and Screen private areas are - allocated for each physical screen. These hold Xinerama-specific - per-GC and per-Screen data. Each screen's CreateGC and CloseScreen - functions are wrapped by XineramaCreateGC() and - XineramaCloseScreen() respectively. Some new resource classes are - created for Xinerama drawables and GCs, and resource types for - Xinerama windows, pixmaps and colormaps. - </para> - - <para>A region (PanoramiXScreenRegion) is - initialized to be the union of the screen regions. - The relative positioning information for the - physical screens is taken from the ScreenRec x and y members, which - the DDX layer must initialize in InitOutput(). The bounds of the - combined screen is also calculated (PanoramiXPixWidth and - PanoramiXPixHeight). - </para> - - <para>The DIX layer has a list of function pointers - (ProcVector[]) that - holds the entry points for the functions that process core protocol - requests. The requests that Xinerama must intercept and break up - into physical screen-specific requests are wrapped. The original - set is copied to SavedProcVector[]. The types of requests - intercepted are Window requests, GC requests, colormap requests, - drawing requests, and some geometry-related requests. This wrapping - allows the bulk of the protocol request processing to be handled - transparently to the DIX layer. Some operations cannot be dealt with - in this way and are handled with Xinerama-specific code within the - DIX layer. - </para> -</listitem></varlistentry> - -<varlistentry> -<term>PanoramiXConsolidate()</term> -<listitem> - <para>PanoramiXConsolidate() is a - device-independent extension function that is called directly from - the X server's main() function after extensions and input/output - devices have been initialized, and before the root windows are - defined and initialized. -</para> - - <para>This function finds the set of depths (PanoramiXDepths[]) and - visuals (PanoramiXVisuals[]) - common to all of the physical screens. - PanoramiXNumDepths is set to the number of common depths, and - PanoramiXNumVisuals is set to the number of common visuals. - Resources are created for the single root window and the default - colormap. Each of these resources has per-physical screen entries. - </para> -</listitem></varlistentry> - -<varlistentry> -<term>PanoramiXCreateConnectionBlock()</term> -<listitem> - <para>PanoramiXConsolidate() is a - device-independent extension function that is called directly from - the X server's main() function after the per-physical screen root - windows are created. It is called instead of the standard DIX - CreateConnectionBlock() function. If this function returns FALSE, - the X server exits with a fatal error. This function will return - FALSE if no common depths were found in PanoramiXConsolidate(). - With no common depths, Xinerama mode is not possible. - </para> - - <para>The connection block holds the information that clients get when - they open a connection to the X server. It includes information - such as the supported pixmap formats, number of screens and the - sizes, depths, visuals, default colormap information, etc, for each - of the screens (much of information that <command>xdpyinfo</command> shows). The - connection block is initialized with the combined single screen - values that were calculated in the above two functions. - </para> - - <para>The Xinerama extension allows the registration of connection - block callback functions. The purpose of these is to allow other - extensions to do processing at this point. These callbacks can be - registered by calling XineramaRegisterConnectionBlockCallback() from - the other extension's ExtensionInit() function. Each registered - connection block callback is called at the end of - PanoramiXCreateConnectionBlock(). - </para> -</listitem></varlistentry> -</variablelist> - -<sect3> -<title>Xinerama-specific changes to the DIX code</title> - -<para>There are a few types of Xinerama-specific changes within the DIX -code. The main ones are described here. -</para> - -<para>Functions that deal with colormap or GC -related operations outside of -the intercepted protocol requests have a test added to only do the -processing for screen numbers > 0. This is because they are handled for -the single Xinerama screen and the processing is done once for screen 0. -</para> - -<para>The handling of motion events does some coordinate translation between -the physical screen's origin and screen zero's origin. Also, motion -events must be reported relative to the composite screen origin rather -than the physical screen origins. -</para> - -<para>There is some special handling for cursor, window and event processing -that cannot (either not at all or not conveniently) be done via the -intercepted protocol requests. A particular case is the handling of -pointers moving between physical screens. -</para> -</sect3> - -<sect3> -<title>Xinerama-specific changes to the MI code</title> - -<para>The only Xinerama-specific change to the MI code is in miSendExposures() -to handle the coordinate (and window ID) translation for expose events. -</para> -</sect3> - -<sect3> -<title>Intercepted DIX core requests</title> - -<para>Xinerama breaks up drawing requests for dispatch to each physical -screen. It also breaks up windows into pieces for each physical screen. -GCs are translated into per-screen GCs. Colormaps are replicated on -each physical screen. The functions handling the intercepted requests -take care of breaking the requests and repackaging them so that they can -be passed to the standard request handling functions for each screen in -turn. In addition, and to aid the repackaging, the information from -many of the intercepted requests is used to keep up to date the -necessary state information for the single composite screen. Requests -(usually those with replies) that can be satisfied completely from this -stored state information do not call the standard request handling -functions. -</para> - -</sect3> - -</sect2> - -</sect1> - -<!-- ============================================================ --> - -<sect1> -<title>Development Results</title> - -<para>In this section the results of each phase of development are -discussed. This development took place between approximately June 2001 -and July 2003. -</para> - -<sect2> -<title>Phase I</title> - -<para>The initial development phase dealt with the basic implementation -including the bootstrap code, which used the shadow framebuffer, and the -unoptimized implementation, based on an Xnest-style implementation. -</para> - -<sect3> -<title>Scope</title> - -<para>The goal of Phase I is to provide fundamental functionality that can -act as a foundation for ongoing work: -<orderedlist> -<listitem> - <para>Develop the proxy X server - <itemizedlist> - <listitem> - <para>The proxy X server will operate on the X11 protocol and - relay requests as necessary to correctly perform the request. - </para></listitem> - <listitem> - <para>Work will be based on the existing work for Xinerama and - Xnest. - </para></listitem> - <listitem> - <para>Input events and windowing operations are handled in the - proxy server and rendering requests are repackaged and sent to - each of the back-end servers for display. - </para></listitem> - <listitem> - <para>The multiple screen layout (including support for - overlapping screens) will be user configurable via a - configuration file or through the configuration tool. - </para></listitem> - </itemizedlist> - </para></listitem> - <listitem> - <para>Develop graphical configuration tool - <itemizedlist> - <listitem> - <para>There will be potentially a large number of X servers to - configure into a single display. The tool will allow the user - to specify which servers are involved in the configuration and - how they should be laid out. - </para></listitem> - </itemizedlist> - </para></listitem> - <listitem> - <para>Pass the X Test Suite - <itemizedlist> - <listitem> - <para>The X Test Suite covers the basic X11 operations. All - tests known to succeed must correctly operate in the distributed - X environment. - </para></listitem> - </itemizedlist> - </para></listitem> -</orderedlist> - -</para> - -<para>For this phase, the back-end X servers are assumed to be unmodified X -servers that do not support any DMX-related protocol extensions; future -optimization pathways are considered, but are not implemented; and the -configuration tool is assumed to rely only on libraries in the X source -tree (e.g., Xt). -</para> -</sect3> - -<sect3> -<title>Results</title> - -<para>The proxy X server, Xdmx, was developed to distribute X11 protocol -requests to the set of back-end X servers. It opens a window on each -back-end server, which represents the part of the front-end's root -window that is visible on that screen. It mirrors window, pixmap and -other state in each back-end server. Drawing requests are sent to -either windows or pixmaps on each back-end server. This code is based -on Xnest and uses the existing Xinerama extension. -</para> - -<para>Input events can be taken from (1) devices attached to the back-end -server, (2) core devices attached directly to the Xdmx server, or (3) -from a ``console'' window on another X server. Events for these devices -are gathered, processed and delivered to clients attached to the Xdmx -server. -</para> - -<para>An intuitive configuration format was developed to help the user -easily configure the multiple back-end X servers. It was defined (see -grammar in Xdmx man page) and a parser was implemented that is used by -the Xdmx server and by a standalone xdmxconfig utility. The parsing -support was implemented such that it can be easily factored out of the X -source tree for use with other tools (e.g., vdl). Support for -converting legacy vdl-format configuration files to the DMX format is -provided by the vdltodmx utility. -</para> - -<para>Originally, the configuration file was going to be a subsection of -XFree86's XF86Config file, but that was not possible since Xdmx is a -completely separate X server. Thus, a separate config file format was -developed. In addition, a graphical configuration -tool, xdmxconfig, was developed to allow the user to create and arrange -the screens in the configuration file. The <emphasis remap="bf">-configfile</emphasis> and <emphasis remap="bf">-config</emphasis> -command-line options can be used to start Xdmx using a configuration -file. -</para> - -<para>An extension that enables remote input testing is required for the X -Test Suite to function. During this phase, this extension (XTEST) was -implemented in the Xdmx server. The results from running the X Test -Suite are described in detail below. -</para> -</sect3> - -<sect3> -<title>X Test Suite</title> - - <sect4> - <title>Introduction</title> - <para> - The X Test Suite contains tests that verify Xlib functions - operate correctly. The test suite is designed to run on a - single X server; however, since X applications will not be - able to tell the difference between the DMX server and a - standard X server, the X Test Suite should also run on the - DMX server. - </para> - <para> - The Xdmx server was tested with the X Test Suite, and the - existing failures are noted in this section. To put these - results in perspective, we first discuss expected X Test - failures and how errors in underlying systems can impact - Xdmx test results. - </para> - </sect4> - - <sect4> - <title>Expected Failures for a Single Head</title> - <para> - A correctly implemented X server with a single screen is - expected to fail certain X Test tests. The following - well-known errors occur because of rounding error in the X - server code: - <literallayout> -XDrawArc: Tests 42, 63, 66, 73 -XDrawArcs: Tests 45, 66, 69, 76 - </literallayout> - </para> - <para> - The following failures occur because of the high-level X - server implementation: - <literallayout> -XLoadQueryFont: Test 1 -XListFontsWithInfo: Tests 3, 4 -XQueryFont: Tests 1, 2 - </literallayout> - </para> - <para> - The following test fails when running the X server as root - under Linux because of the way directory modes are - interpreted: - <literallayout> -XWriteBitmapFile: Test 3 - </literallayout> - </para> - <para> - Depending on the video card used for the back-end, other - failures may also occur because of bugs in the low-level - driver implementation. Over time, failures of this kind - are usually fixed by XFree86, but will show up in Xdmx - testing until then. - </para> - </sect4> - - <sect4> - <title>Expected Failures for Xinerama</title> - <para> - Xinerama fails several X Test Suite tests because of - design decisions made for the current implementation of - Xinerama. Over time, many of these errors will be - corrected by XFree86 and the group working on a new - Xinerama implementation. Therefore, Xdmx will also share - X Suite Test failures with Xinerama. - </para> - - <para> - We may be able to fix or work-around some of these - failures at the Xdmx level, but this will require - additional exploration that was not part of Phase I. - </para> - - <para> - Xinerama is constantly improving, and the list of - Xinerama-related failures depends on XFree86 version and - the underlying graphics hardware. We tested with a - variety of hardware, including nVidia, S3, ATI Radeon, - and Matrox G400 (in dual-head mode). The list below - includes only those failures that appear to be from the - Xinerama layer, and does not include failures listed in - the previous section, or failures that appear to be from - the low-level graphics driver itself: - </para> - - <para> - These failures were noted with multiple Xinerama - configurations: - <literallayout> -XCopyPlane: Tests 13, 22, 31 (well-known Xinerama implementation issue) -XSetFontPath: Test 4 -XGetDefault: Test 5 -XMatchVisualInfo: Test 1 - </literallayout> - </para> - <para> - These failures were noted only when using one dual-head - video card with a 4.2.99.x XFree86 server: - <literallayout> -XListPixmapFormats: Test 1 -XDrawRectangles: Test 45 - </literallayout> - </para> - <para> - These failures were noted only when using two video cards - from different vendors with a 4.1.99.x XFree86 server: - <literallayout> -XChangeWindowAttributes: Test 32 -XCreateWindow: Test 30 -XDrawLine: Test 22 -XFillArc: Test 22 -XChangeKeyboardControl: Tests 9, 10 -XRebindKeysym: Test 1 - </literallayout> - </para> - </sect4> - - <sect4> - <title>Additional Failures from Xdmx</title> - - <para> - When running Xdmx, no unexpected failures were noted. - Since the Xdmx server is based on Xinerama, we expect to - have most of the Xinerama failures present in the Xdmx - server. Similarly, since the Xdmx server must rely on the - low-level device drivers on each back-end server, we also - expect that Xdmx will exhibit most of the back-end - failures. Here is a summary: - <literallayout> -XListPixmapFormats: Test 1 (configuration dependent) -XChangeWindowAttributes: Test 32 -XCreateWindow: Test 30 -XCopyPlane: Test 13, 22, 31 -XSetFontPath: Test 4 -XGetDefault: Test 5 (configuration dependent) -XMatchVisualInfo: Test 1 -XRebindKeysym: Test 1 (configuration dependent) - </literallayout> - </para> - <para> - Note that this list is shorter than the combined list for - Xinerama because Xdmx uses different code paths to perform - some Xinerama operations. Further, some Xinerama failures - have been fixed in the XFree86 4.2.99.x CVS repository. - </para> - </sect4> - - <sect4> - <title>Summary and Future Work</title> - - <para> - Running the X Test Suite on Xdmx does not produce any - failures that cannot be accounted for by the underlying - Xinerama subsystem used by the front-end or by the - low-level device-driver code running on the back-end X - servers. The Xdmx server therefore is as ``correct'' as - possible with respect to the standard set of X Test Suite - tests. - </para> - - <para> - During the following phases, we will continue to verify - Xdmx correctness using the X Test Suite. We may also use - other tests suites or write additional tests that run - under the X Test Suite that specifically verify the - expected behavior of DMX. - </para> - </sect4> -</sect3> - -<sect3> -<title>Fonts</title> - -<para>In Phase I, fonts are handled directly by both the front-end and the -back-end servers, which is required since we must treat each back-end -server during this phase as a ``black box''. What this requires is that -<emphasis remap="bf">the front- and back-end servers must share the exact same font -path</emphasis>. There are two ways to help make sure that all servers share the -same font path: - -<orderedlist> - <listitem> - <para>First, each server can be configured to use the same font - server. The font server, xfs, can be configured to serve fonts to - multiple X servers via TCP. - </para></listitem> - - <listitem> - <para>Second, each server can be configured to use the same font - path and either those font paths can be copied to each back-end - machine or they can be mounted (e.g., via NFS) on each back-end - machine. - </para></listitem> -</orderedlist> -</para> - -<para>One additional concern is that a client program can set its own font -path, and if it does so, then that font path must be available on each -back-end machine. -</para> - -<para>The -fontpath command line option was added to allow users to -initialize the font path of the front end server. This font path is -propagated to each back-end server when the default font is loaded. If -there are any problems, an error message is printed, which will describe -the problem and list the current font path. For more information about -setting the font path, see the -fontpath option description in the man -page. -</para> -</sect3> - -<sect3> -<title>Performance</title> - -<para>Phase I of development was not intended to optimize performance. Its -focus was on completely and correctly handling the base X11 protocol in -the Xdmx server. However, several insights were gained during Phase I, -which are listed here for reference during the next phase of -development. -</para> - -<orderedlist> - <listitem> - <para>Calls to XSync() can slow down rendering since it requires a - complete round trip to and from a back-end server. This is - especially problematic when communicating over long haul networks. - </para></listitem> - - <listitem> - <para>Sending drawing requests to only the screens that they overlap - should improve performance. - </para></listitem> -</orderedlist> -</sect3> - -<sect3> -<title>Pixmaps</title> - -<para>Pixmaps were originally expected to be handled entirely in the -front-end X server; however, it was found that this overly complicated -the rendering code and would have required sending potentially large -images to each back server that required them when copying from pixmap -to screen. Thus, pixmap state is mirrored in the back-end server just -as it is with regular window state. With this implementation, the same -rendering code that draws to windows can be used to draw to pixmaps on -the back-end server, and no large image transfers are required to copy -from pixmap to window. -</para> - -</sect3> - -</sect2> - -<!-- ============================================================ --> -<sect2> -<title>Phase II</title> - -<para>The second phase of development concentrates on performance -optimizations. These optimizations are documented here, with -<command>x11perf</command> data to show how the optimizations improve performance. -</para> - -<para>All benchmarks were performed by running Xdmx on a dual processor -1.4GHz AMD Athlon machine with 1GB of RAM connecting over 100baseT to -two single-processor 1GHz Pentium III machines with 256MB of RAM and ATI -Rage 128 (RF) video cards. The front end was running Linux -2.4.20-pre1-ac1 and the back ends were running Linux 2.4.7-10 and -version 4.2.99.1 of XFree86 pulled from the XFree86 CVS repository on -August 7, 2002. All systems were running Red Hat Linux 7.2. -</para> - -<sect3> -<title>Moving from XFree86 4.1.99.1 to 4.2.0.0</title> - -<para>For phase II, the working source tree was moved to the branch tagged -with dmx-1-0-branch and was updated from version 4.1.99.1 (20 August -2001) of the XFree86 sources to version 4.2.0.0 (18 January 2002). -After this update, the following tests were noted to be more than 10% -faster: -<screen> -1.13 Fill 300x300 opaque stippled trapezoid (161x145 stipple) -1.16 Fill 1x1 tiled trapezoid (161x145 tile) -1.13 Fill 10x10 tiled trapezoid (161x145 tile) -1.17 Fill 100x100 tiled trapezoid (161x145 tile) -1.16 Fill 1x1 tiled trapezoid (216x208 tile) -1.20 Fill 10x10 tiled trapezoid (216x208 tile) -1.15 Fill 100x100 tiled trapezoid (216x208 tile) -1.37 Circulate Unmapped window (200 kids) -</screen> -And the following tests were noted to be more than 10% slower: -<screen> -0.88 Unmap window via parent (25 kids) -0.75 Circulate Unmapped window (4 kids) -0.79 Circulate Unmapped window (16 kids) -0.80 Circulate Unmapped window (25 kids) -0.82 Circulate Unmapped window (50 kids) -0.85 Circulate Unmapped window (75 kids) -</screen> -</para> - -<para>These changes were not caused by any changes in the DMX system, and -may point to changes in the XFree86 tree or to tests that have more -"jitter" than most other <command>x11perf</command> tests. -</para> -</sect3> - -<sect3> -<title>Global changes</title> - -<para>During the development of the Phase II DMX server, several global -changes were made. These changes were also compared with the Phase I -server. The following tests were noted to be more than 10% faster: -<screen> -1.13 Fill 300x300 opaque stippled trapezoid (161x145 stipple) -1.15 Fill 1x1 tiled trapezoid (161x145 tile) -1.13 Fill 10x10 tiled trapezoid (161x145 tile) -1.17 Fill 100x100 tiled trapezoid (161x145 tile) -1.16 Fill 1x1 tiled trapezoid (216x208 tile) -1.19 Fill 10x10 tiled trapezoid (216x208 tile) -1.15 Fill 100x100 tiled trapezoid (216x208 tile) -1.15 Circulate Unmapped window (4 kids) -</screen> -</para> - -<para>The following tests were noted to be more than 10% slower: -<screen> -0.69 Scroll 10x10 pixels -0.68 Scroll 100x100 pixels -0.68 Copy 10x10 from window to window -0.68 Copy 100x100 from window to window -0.76 Circulate Unmapped window (75 kids) -0.83 Circulate Unmapped window (100 kids) -</screen> -</para> - -<para>For the remainder of this analysis, the baseline of comparison will -be the Phase II deliverable with all optimizations disabled (unless -otherwise noted). This will highlight how the optimizations in -isolation impact performance. -</para> -</sect3> - -<sect3> -<title>XSync() Batching</title> - -<para>During the Phase I implementation, XSync() was called after every -protocol request made by the DMX server. This provided the DMX server -with an interactive feel, but defeated X11's protocol buffering system -and introduced round-trip wire latency into every operation. During -Phase II, DMX was changed so that protocol requests are no longer -followed by calls to XSync(). Instead, the need for an XSync() is -noted, and XSync() calls are only made every 100mS or when the DMX -server specifically needs to make a call to guarantee interactivity. -With this new system, X11 buffers protocol as much as possible during a -100mS interval, and many unnecessary XSync() calls are avoided. -</para> - -<para>Out of more than 300 <command>x11perf</command> tests, 8 tests became more than 100 -times faster, with 68 more than 50X faster, 114 more than 10X faster, -and 181 more than 2X faster. See table below for summary. -</para> - -<para>The following tests were noted to be more than 10% slower with -XSync() batching on: -<screen> -0.88 500x500 tiled rectangle (161x145 tile) -0.89 Copy 500x500 from window to window -</screen> -</para> -</sect3> - -<sect3> -<title>Offscreen Optimization</title> - -<para>Windows span one or more of the back-end servers' screens; however, -during Phase I development, windows were created on every back-end -server and every rendering request was sent to every window regardless -of whether or not that window was visible. With the offscreen -optimization, the DMX server tracks when a window is completely off of a -back-end server's screen and, in that case, it does not send rendering -requests to those back-end windows. This optimization saves bandwidth -between the front and back-end servers, and it reduces the number of -XSync() calls. The performance tests were run on a DMX system with only -two back-end servers. Greater performance gains will be had as the -number of back-end servers increases. -</para> - -<para>Out of more than 300 <command>x11perf</command> tests, 3 tests were at least twice as -fast, and 146 tests were at least 10% faster. Two tests were more than -10% slower with the offscreen optimization: -<screen> -0.88 Hide/expose window via popup (4 kids) -0.89 Resize unmapped window (75 kids) -</screen> -</para> -</sect3> - -<sect3> -<title>Lazy Window Creation Optimization</title> - -<para>As mentioned above, during Phase I, windows were created on every -back-end server even if they were not visible on that back-end. With -the lazy window creation optimization, the DMX server does not create -windows on a back-end server until they are either visible or they -become the parents of a visible window. This optimization builds on the -offscreen optimization (described above) and requires it to be enabled. -</para> - -<para>The lazy window creation optimization works by creating the window -data structures in the front-end server when a client creates a window, -but delays creation of the window on the back-end server(s). A private -window structure in the DMX server saves the relevant window data and -tracks changes to the window's attributes and stacking order for later -use. The only times a window is created on a back-end server are (1) -when it is mapped and is at least partially overlapping the back-end -server's screen (tracked by the offscreen optimization), or (2) when the -window becomes the parent of a previously visible window. The first -case occurs when a window is mapped or when a visible window is copied, -moved or resized and now overlaps the back-end server's screen. The -second case occurs when starting a window manager after having created -windows to which the window manager needs to add decorations. -</para> - -<para>When either case occurs, a window on the back-end server is created -using the data saved in the DMX server's window private data structure. -The stacking order is then adjusted to correctly place the window on the -back-end and lastly the window is mapped. From this time forward, the -window is handled exactly as if the window had been created at the time -of the client's request. -</para> - -<para>Note that when a window is no longer visible on a back-end server's -screen (e.g., it is moved offscreen), the window is not destroyed; -rather, it is kept and reused later if the window once again becomes -visible on the back-end server's screen. Originally with this -optimization, destroying windows was implemented but was later rejected -because it increased bandwidth when windows were opaquely moved or -resized, which is common in many window managers. -</para> - -<para>The performance tests were run on a DMX system with only two back-end -servers. Greater performance gains will be had as the number of -back-end servers increases. -</para> - -<para>This optimization improved the following <command>x11perf</command> tests by more -than 10%: -<screen> -1.10 500x500 rectangle outline -1.12 Fill 100x100 stippled trapezoid (161x145 stipple) -1.20 Circulate Unmapped window (50 kids) -1.19 Circulate Unmapped window (75 kids) -</screen> -</para> -</sect3> - -<sect3> -<title>Subdividing Rendering Primitives</title> - -<para>X11 imaging requests transfer significant data between the client and -the X server. During Phase I, the DMX server would then transfer the -image data to each back-end server. Even with the offscreen -optimization (above), these requests still required transferring -significant data to each back-end server that contained a visible -portion of the window. For example, if the client uses XPutImage() to -copy an image to a window that overlaps the entire DMX screen, then the -entire image is copied by the DMX server to every back-end server. -</para> - -<para>To reduce the amount of data transferred between the DMX server and -the back-end servers when XPutImage() is called, the image data is -subdivided and only the data that will be visible on a back-end server's -screen is sent to that back-end server. Xinerama already implements a -subdivision algorithm for XGetImage() and no further optimization was -needed. -</para> - -<para>Other rendering primitives were analyzed, but the time required to -subdivide these primitives was a significant proportion of the time -required to send the entire rendering request to the back-end server, so -this optimization was rejected for the other rendering primitives. -</para> - -<para>Again, the performance tests were run on a DMX system with only two -back-end servers. Greater performance gains will be had as the number -of back-end servers increases. -</para> - -<para>This optimization improved the following <command>x11perf</command> tests by more -than 10%: -<screen> -1.12 Fill 100x100 stippled trapezoid (161x145 stipple) -1.26 PutImage 10x10 square -1.83 PutImage 100x100 square -1.91 PutImage 500x500 square -1.40 PutImage XY 10x10 square -1.48 PutImage XY 100x100 square -1.50 PutImage XY 500x500 square -1.45 Circulate Unmapped window (75 kids) -1.74 Circulate Unmapped window (100 kids) -</screen> -</para> - -<para>The following test was noted to be more than 10% slower with this -optimization: -<screen> -0.88 10-pixel fill chord partial circle -</screen> -</para> -</sect3> - -<sect3> -<title>Summary of x11perf Data</title> - -<para>With all of the optimizations on, 53 <command>x11perf</command> tests are more than -100X faster than the unoptimized Phase II deliverable, with 69 more than -50X faster, 73 more than 10X faster, and 199 more than twice as fast. -No tests were more than 10% slower than the unoptimized Phase II -deliverable. (Compared with the Phase I deliverable, only Circulate -Unmapped window (100 kids) was more than 10% slower than the Phase II -deliverable. As noted above, this test seems to have wider variability -than other <command>x11perf</command> tests.) -</para> - -<para>The following table summarizes relative <command>x11perf</command> test changes for -all optimizations individually and collectively. Note that some of the -optimizations have a synergistic effect when used together. -<screen> - -1: XSync() batching only -2: Off screen optimizations only -3: Window optimizations only -4: Subdivprims only -5: All optimizations - - 1 2 3 4 5 Operation ------- ---- ---- ---- ------ --------- - 2.14 1.85 1.00 1.00 4.13 Dot - 1.67 1.80 1.00 1.00 3.31 1x1 rectangle - 2.38 1.43 1.00 1.00 2.44 10x10 rectangle - 1.00 1.00 0.92 0.98 1.00 100x100 rectangle - 1.00 1.00 1.00 1.00 1.00 500x500 rectangle - 1.83 1.85 1.05 1.06 3.54 1x1 stippled rectangle (8x8 stipple) - 2.43 1.43 1.00 1.00 2.41 10x10 stippled rectangle (8x8 stipple) - 0.98 1.00 1.00 1.00 1.00 100x100 stippled rectangle (8x8 stipple) - 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (8x8 stipple) - 1.75 1.75 1.00 1.00 3.40 1x1 opaque stippled rectangle (8x8 stipple) - 2.38 1.42 1.00 1.00 2.34 10x10 opaque stippled rectangle (8x8 stipple) - 1.00 1.00 0.97 0.97 1.00 100x100 opaque stippled rectangle (8x8 stipple) - 1.00 1.00 1.00 1.00 0.99 500x500 opaque stippled rectangle (8x8 stipple) - 1.82 1.82 1.04 1.04 3.56 1x1 tiled rectangle (4x4 tile) - 2.33 1.42 1.00 1.00 2.37 10x10 tiled rectangle (4x4 tile) - 1.00 0.92 1.00 1.00 1.00 100x100 tiled rectangle (4x4 tile) - 1.00 1.00 1.00 1.00 1.00 500x500 tiled rectangle (4x4 tile) - 1.94 1.62 1.00 1.00 3.66 1x1 stippled rectangle (17x15 stipple) - 1.74 1.28 1.00 1.00 1.73 10x10 stippled rectangle (17x15 stipple) - 1.00 1.00 1.00 0.89 0.98 100x100 stippled rectangle (17x15 stipple) - 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (17x15 stipple) - 1.94 1.62 1.00 1.00 3.67 1x1 opaque stippled rectangle (17x15 stipple) - 1.69 1.26 1.00 1.00 1.66 10x10 opaque stippled rectangle (17x15 stipple) - 1.00 0.95 1.00 1.00 1.00 100x100 opaque stippled rectangle (17x15 stipple) - 1.00 1.00 1.00 1.00 0.97 500x500 opaque stippled rectangle (17x15 stipple) - 1.93 1.61 0.99 0.99 3.69 1x1 tiled rectangle (17x15 tile) - 1.73 1.27 1.00 1.00 1.72 10x10 tiled rectangle (17x15 tile) - 1.00 1.00 1.00 1.00 0.98 100x100 tiled rectangle (17x15 tile) - 1.00 1.00 0.97 0.97 1.00 500x500 tiled rectangle (17x15 tile) - 1.95 1.63 1.00 1.00 3.83 1x1 stippled rectangle (161x145 stipple) - 1.80 1.30 1.00 1.00 1.83 10x10 stippled rectangle (161x145 stipple) - 0.97 1.00 1.00 1.00 1.01 100x100 stippled rectangle (161x145 stipple) - 1.00 1.00 1.00 1.00 0.98 500x500 stippled rectangle (161x145 stipple) - 1.95 1.63 1.00 1.00 3.56 1x1 opaque stippled rectangle (161x145 stipple) - 1.65 1.25 1.00 1.00 1.68 10x10 opaque stippled rectangle (161x145 stipple) - 1.00 1.00 1.00 1.00 1.01 100x100 opaque stippled rectangle (161x145... - 1.00 1.00 1.00 1.00 0.97 500x500 opaque stippled rectangle (161x145... - 1.95 1.63 0.98 0.99 3.80 1x1 tiled rectangle (161x145 tile) - 1.67 1.26 1.00 1.00 1.67 10x10 tiled rectangle (161x145 tile) - 1.13 1.14 1.14 1.14 1.14 100x100 tiled rectangle (161x145 tile) - 0.88 1.00 1.00 1.00 0.99 500x500 tiled rectangle (161x145 tile) - 1.93 1.63 1.00 1.00 3.53 1x1 tiled rectangle (216x208 tile) - 1.69 1.26 1.00 1.00 1.66 10x10 tiled rectangle (216x208 tile) - 1.00 1.00 1.00 1.00 1.00 100x100 tiled rectangle (216x208 tile) - 1.00 1.00 1.00 1.00 1.00 500x500 tiled rectangle (216x208 tile) - 1.82 1.70 1.00 1.00 3.38 1-pixel line segment - 2.07 1.56 0.90 1.00 3.31 10-pixel line segment - 1.29 1.10 1.00 1.00 1.27 100-pixel line segment - 1.05 1.06 1.03 1.03 1.09 500-pixel line segment - 1.30 1.13 1.00 1.00 1.29 100-pixel line segment (1 kid) - 1.32 1.15 1.00 1.00 1.32 100-pixel line segment (2 kids) - 1.33 1.16 1.00 1.00 1.33 100-pixel line segment (3 kids) - 1.92 1.64 1.00 1.00 3.73 10-pixel dashed segment - 1.34 1.16 1.00 1.00 1.34 100-pixel dashed segment - 1.24 1.11 0.99 0.97 1.23 100-pixel double-dashed segment - 1.72 1.77 1.00 1.00 3.25 10-pixel horizontal line segment - 1.83 1.66 1.01 1.00 3.54 100-pixel horizontal line segment - 1.86 1.30 1.00 1.00 1.84 500-pixel horizontal line segment - 2.11 1.52 1.00 0.99 3.02 10-pixel vertical line segment - 1.21 1.10 1.00 1.00 1.20 100-pixel vertical line segment - 1.03 1.03 1.00 1.00 1.02 500-pixel vertical line segment - 4.42 1.68 1.00 1.01 4.64 10x1 wide horizontal line segment - 1.83 1.31 1.00 1.00 1.83 100x10 wide horizontal line segment - 1.07 1.00 0.96 1.00 1.07 500x50 wide horizontal line segment - 4.10 1.67 1.00 1.00 4.62 10x1 wide vertical line segment - 1.50 1.24 1.06 1.06 1.48 100x10 wide vertical line segment - 1.06 1.03 1.00 1.00 1.05 500x50 wide vertical line segment - 2.54 1.61 1.00 1.00 3.61 1-pixel line - 2.71 1.48 1.00 1.00 2.67 10-pixel line - 1.19 1.09 1.00 1.00 1.19 100-pixel line - 1.04 1.02 1.00 1.00 1.03 500-pixel line - 2.68 1.51 0.98 1.00 3.17 10-pixel dashed line - 1.23 1.11 0.99 0.99 1.23 100-pixel dashed line - 1.15 1.08 1.00 1.00 1.15 100-pixel double-dashed line - 2.27 1.39 1.00 1.00 2.23 10x1 wide line - 1.20 1.09 1.00 1.00 1.20 100x10 wide line - 1.04 1.02 1.00 1.00 1.04 500x50 wide line - 1.52 1.45 1.00 1.00 1.52 100x10 wide dashed line - 1.54 1.47 1.00 1.00 1.54 100x10 wide double-dashed line - 1.97 1.30 0.96 0.95 1.95 10x10 rectangle outline - 1.44 1.27 1.00 1.00 1.43 100x100 rectangle outline - 3.22 2.16 1.10 1.09 3.61 500x500 rectangle outline - 1.95 1.34 1.00 1.00 1.90 10x10 wide rectangle outline - 1.14 1.14 1.00 1.00 1.13 100x100 wide rectangle outline - 1.00 1.00 1.00 1.00 1.00 500x500 wide rectangle outline - 1.57 1.72 1.00 1.00 3.03 1-pixel circle - 1.96 1.35 1.00 1.00 1.92 10-pixel circle - 1.21 1.07 0.86 0.97 1.20 100-pixel circle - 1.08 1.04 1.00 1.00 1.08 500-pixel circle - 1.39 1.19 1.03 1.03 1.38 100-pixel dashed circle - 1.21 1.11 1.00 1.00 1.23 100-pixel double-dashed circle - 1.59 1.28 1.00 1.00 1.58 10-pixel wide circle - 1.22 1.12 0.99 1.00 1.22 100-pixel wide circle - 1.06 1.04 1.00 1.00 1.05 500-pixel wide circle - 1.87 1.84 1.00 1.00 1.85 100-pixel wide dashed circle - 1.90 1.93 1.01 1.01 1.90 100-pixel wide double-dashed circle - 2.13 1.43 1.00 1.00 2.32 10-pixel partial circle - 1.42 1.18 1.00 1.00 1.42 100-pixel partial circle - 1.92 1.85 1.01 1.01 1.89 10-pixel wide partial circle - 1.73 1.67 1.00 1.00 1.73 100-pixel wide partial circle - 1.36 1.95 1.00 1.00 2.64 1-pixel solid circle - 2.02 1.37 1.00 1.00 2.03 10-pixel solid circle - 1.19 1.09 1.00 1.00 1.19 100-pixel solid circle - 1.02 0.99 1.00 1.00 1.01 500-pixel solid circle - 1.74 1.28 1.00 0.88 1.73 10-pixel fill chord partial circle - 1.31 1.13 1.00 1.00 1.31 100-pixel fill chord partial circle - 1.67 1.31 1.03 1.03 1.72 10-pixel fill slice partial circle - 1.30 1.13 1.00 1.00 1.28 100-pixel fill slice partial circle - 2.45 1.49 1.01 1.00 2.71 10-pixel ellipse - 1.22 1.10 1.00 1.00 1.22 100-pixel ellipse - 1.09 1.04 1.00 1.00 1.09 500-pixel ellipse - 1.90 1.28 1.00 1.00 1.89 100-pixel dashed ellipse - 1.62 1.24 0.96 0.97 1.61 100-pixel double-dashed ellipse - 2.43 1.50 1.00 1.00 2.42 10-pixel wide ellipse - 1.61 1.28 1.03 1.03 1.60 100-pixel wide ellipse - 1.08 1.05 1.00 1.00 1.08 500-pixel wide ellipse - 1.93 1.88 1.00 1.00 1.88 100-pixel wide dashed ellipse - 1.94 1.89 1.01 1.00 1.94 100-pixel wide double-dashed ellipse - 2.31 1.48 1.00 1.00 2.67 10-pixel partial ellipse - 1.38 1.17 1.00 1.00 1.38 100-pixel partial ellipse - 2.00 1.85 0.98 0.97 1.98 10-pixel wide partial ellipse - 1.89 1.86 1.00 1.00 1.89 100-pixel wide partial ellipse - 3.49 1.60 1.00 1.00 3.65 10-pixel filled ellipse - 1.67 1.26 1.00 1.00 1.67 100-pixel filled ellipse - 1.06 1.04 1.00 1.00 1.06 500-pixel filled ellipse - 2.38 1.43 1.01 1.00 2.32 10-pixel fill chord partial ellipse - 2.06 1.30 1.00 1.00 2.05 100-pixel fill chord partial ellipse - 2.27 1.41 1.00 1.00 2.27 10-pixel fill slice partial ellipse - 1.98 1.33 1.00 0.97 1.97 100-pixel fill slice partial ellipse - 57.46 1.99 1.01 1.00 114.92 Fill 1x1 equivalent triangle - 56.94 1.98 1.01 1.00 73.89 Fill 10x10 equivalent triangle - 6.07 1.75 1.00 1.00 6.07 Fill 100x100 equivalent triangle - 51.12 1.98 1.00 1.00 102.81 Fill 1x1 trapezoid - 51.42 1.82 1.01 1.00 94.89 Fill 10x10 trapezoid - 6.47 1.80 1.00 1.00 6.44 Fill 100x100 trapezoid - 1.56 1.28 1.00 0.99 1.56 Fill 300x300 trapezoid - 51.27 1.97 0.96 0.97 102.54 Fill 1x1 stippled trapezoid (8x8 stipple) - 51.73 2.00 1.02 1.02 67.92 Fill 10x10 stippled trapezoid (8x8 stipple) - 5.36 1.72 1.00 1.00 5.36 Fill 100x100 stippled trapezoid (8x8 stipple) - 1.54 1.26 1.00 1.00 1.59 Fill 300x300 stippled trapezoid (8x8 stipple) - 51.41 1.94 1.01 1.00 102.82 Fill 1x1 opaque stippled trapezoid (8x8 stipple) - 50.71 1.95 0.99 1.00 65.44 Fill 10x10 opaque stippled trapezoid (8x8... - 5.33 1.73 1.00 1.00 5.36 Fill 100x100 opaque stippled trapezoid (8x8... - 1.58 1.25 1.00 1.00 1.58 Fill 300x300 opaque stippled trapezoid (8x8... - 51.56 1.96 0.99 0.90 103.68 Fill 1x1 tiled trapezoid (4x4 tile) - 51.59 1.99 1.01 1.01 62.25 Fill 10x10 tiled trapezoid (4x4 tile) - 5.38 1.72 1.00 1.00 5.38 Fill 100x100 tiled trapezoid (4x4 tile) - 1.54 1.25 1.00 0.99 1.58 Fill 300x300 tiled trapezoid (4x4 tile) - 51.70 1.98 1.01 1.01 103.98 Fill 1x1 stippled trapezoid (17x15 stipple) - 44.86 1.97 1.00 1.00 44.86 Fill 10x10 stippled trapezoid (17x15 stipple) - 2.74 1.56 1.00 1.00 2.73 Fill 100x100 stippled trapezoid (17x15 stipple) - 1.29 1.14 1.00 1.00 1.27 Fill 300x300 stippled trapezoid (17x15 stipple) - 51.41 1.96 0.96 0.95 103.39 Fill 1x1 opaque stippled trapezoid (17x15... - 45.14 1.96 1.01 1.00 45.14 Fill 10x10 opaque stippled trapezoid (17x15... - 2.68 1.56 1.00 1.00 2.68 Fill 100x100 opaque stippled trapezoid (17x15... - 1.26 1.10 1.00 1.00 1.28 Fill 300x300 opaque stippled trapezoid (17x15... - 51.13 1.97 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (17x15 tile) - 47.58 1.96 1.00 1.00 47.86 Fill 10x10 tiled trapezoid (17x15 tile) - 2.74 1.56 1.00 1.00 2.74 Fill 100x100 tiled trapezoid (17x15 tile) - 1.29 1.14 1.00 1.00 1.28 Fill 300x300 tiled trapezoid (17x15 tile) - 51.13 1.97 0.99 0.97 103.39 Fill 1x1 stippled trapezoid (161x145 stipple) - 45.14 1.97 1.00 1.00 44.29 Fill 10x10 stippled trapezoid (161x145 stipple) - 3.02 1.77 1.12 1.12 3.38 Fill 100x100 stippled trapezoid (161x145 stipple) - 1.31 1.13 1.00 1.00 1.30 Fill 300x300 stippled trapezoid (161x145 stipple) - 51.27 1.97 1.00 1.00 103.10 Fill 1x1 opaque stippled trapezoid (161x145... - 45.01 1.97 1.00 1.00 45.01 Fill 10x10 opaque stippled trapezoid (161x145... - 2.67 1.56 1.00 1.00 2.69 Fill 100x100 opaque stippled trapezoid (161x145.. - 1.29 1.13 1.00 1.01 1.27 Fill 300x300 opaque stippled trapezoid (161x145.. - 51.41 1.96 1.00 0.99 103.39 Fill 1x1 tiled trapezoid (161x145 tile) - 45.01 1.96 0.98 1.00 45.01 Fill 10x10 tiled trapezoid (161x145 tile) - 2.62 1.36 1.00 1.00 2.69 Fill 100x100 tiled trapezoid (161x145 tile) - 1.27 1.13 1.00 1.00 1.22 Fill 300x300 tiled trapezoid (161x145 tile) - 51.13 1.98 1.00 1.00 103.39 Fill 1x1 tiled trapezoid (216x208 tile) - 45.14 1.97 1.01 0.99 45.14 Fill 10x10 tiled trapezoid (216x208 tile) - 2.62 1.55 1.00 1.00 2.71 Fill 100x100 tiled trapezoid (216x208 tile) - 1.28 1.13 1.00 1.00 1.20 Fill 300x300 tiled trapezoid (216x208 tile) - 50.71 1.95 1.00 1.00 54.70 Fill 10x10 equivalent complex polygon - 5.51 1.71 0.96 0.98 5.47 Fill 100x100 equivalent complex polygons - 8.39 1.97 1.00 1.00 16.75 Fill 10x10 64-gon (Convex) - 8.38 1.83 1.00 1.00 8.43 Fill 100x100 64-gon (Convex) - 8.50 1.96 1.00 1.00 16.64 Fill 10x10 64-gon (Complex) - 8.26 1.83 1.00 1.00 8.35 Fill 100x100 64-gon (Complex) - 14.09 1.87 1.00 1.00 14.05 Char in 80-char line (6x13) - 11.91 1.87 1.00 1.00 11.95 Char in 70-char line (8x13) - 11.16 1.85 1.01 1.00 11.10 Char in 60-char line (9x15) - 10.09 1.78 1.00 1.00 10.09 Char16 in 40-char line (k14) - 6.15 1.75 1.00 1.00 6.31 Char16 in 23-char line (k24) - 11.92 1.90 1.03 1.03 11.88 Char in 80-char line (TR 10) - 8.18 1.78 1.00 0.99 8.17 Char in 30-char line (TR 24) - 42.83 1.44 1.01 1.00 42.11 Char in 20/40/20 line (6x13, TR 10) - 27.45 1.43 1.01 1.01 27.45 Char16 in 7/14/7 line (k14, k24) - 12.13 1.85 1.00 1.00 12.05 Char in 80-char image line (6x13) - 10.00 1.84 1.00 1.00 10.00 Char in 70-char image line (8x13) - 9.18 1.83 1.00 1.00 9.12 Char in 60-char image line (9x15) - 9.66 1.82 0.98 0.95 9.66 Char16 in 40-char image line (k14) - 5.82 1.72 1.00 1.00 5.99 Char16 in 23-char image line (k24) - 8.70 1.80 1.00 1.00 8.65 Char in 80-char image line (TR 10) - 4.67 1.66 1.00 1.00 4.67 Char in 30-char image line (TR 24) - 84.43 1.47 1.00 1.00 124.18 Scroll 10x10 pixels - 3.73 1.50 1.00 0.98 3.73 Scroll 100x100 pixels - 1.00 1.00 1.00 1.00 1.00 Scroll 500x500 pixels - 84.43 1.51 1.00 1.00 134.02 Copy 10x10 from window to window - 3.62 1.51 0.98 0.98 3.62 Copy 100x100 from window to window - 0.89 1.00 1.00 1.00 1.00 Copy 500x500 from window to window - 57.06 1.99 1.00 1.00 88.64 Copy 10x10 from pixmap to window - 2.49 2.00 1.00 1.00 2.48 Copy 100x100 from pixmap to window - 1.00 0.91 1.00 1.00 0.98 Copy 500x500 from pixmap to window - 2.04 1.01 1.00 1.00 2.03 Copy 10x10 from window to pixmap - 1.05 1.00 1.00 1.00 1.05 Copy 100x100 from window to pixmap - 1.00 1.00 0.93 1.00 1.04 Copy 500x500 from window to pixmap - 58.52 1.03 1.03 1.02 57.95 Copy 10x10 from pixmap to pixmap - 2.40 1.00 1.00 1.00 2.45 Copy 100x100 from pixmap to pixmap - 1.00 1.00 1.00 1.00 1.00 Copy 500x500 from pixmap to pixmap - 51.57 1.92 1.00 1.00 85.75 Copy 10x10 1-bit deep plane - 6.37 1.75 1.01 1.01 6.37 Copy 100x100 1-bit deep plane - 1.26 1.11 1.00 1.00 1.24 Copy 500x500 1-bit deep plane - 4.23 1.63 0.98 0.97 4.38 Copy 10x10 n-bit deep plane - 1.04 1.02 1.00 1.00 1.04 Copy 100x100 n-bit deep plane - 1.00 1.00 1.00 1.00 1.00 Copy 500x500 n-bit deep plane - 6.45 1.98 1.00 1.26 12.80 PutImage 10x10 square - 1.10 1.87 1.00 1.83 2.11 PutImage 100x100 square - 1.02 1.93 1.00 1.91 1.91 PutImage 500x500 square - 4.17 1.78 1.00 1.40 7.18 PutImage XY 10x10 square - 1.27 1.49 0.97 1.48 2.10 PutImage XY 100x100 square - 1.00 1.50 1.00 1.50 1.52 PutImage XY 500x500 square - 1.07 1.01 1.00 1.00 1.06 GetImage 10x10 square - 1.01 1.00 1.00 1.00 1.01 GetImage 100x100 square - 1.00 1.00 1.00 1.00 1.00 GetImage 500x500 square - 1.56 1.00 0.99 0.97 1.56 GetImage XY 10x10 square - 1.02 1.00 1.00 1.00 1.02 GetImage XY 100x100 square - 1.00 1.00 1.00 1.00 1.00 GetImage XY 500x500 square - 1.00 1.00 1.01 0.98 0.95 X protocol NoOperation - 1.02 1.03 1.04 1.03 1.00 QueryPointer - 1.03 1.02 1.04 1.03 1.00 GetProperty -100.41 1.51 1.00 1.00 198.76 Change graphics context - 45.81 1.00 0.99 0.97 57.10 Create and map subwindows (4 kids) - 78.45 1.01 1.02 1.02 63.07 Create and map subwindows (16 kids) - 73.91 1.01 1.00 1.00 56.37 Create and map subwindows (25 kids) - 73.22 1.00 1.00 1.00 49.07 Create and map subwindows (50 kids) - 72.36 1.01 0.99 1.00 32.14 Create and map subwindows (75 kids) - 70.34 1.00 1.00 1.00 30.12 Create and map subwindows (100 kids) - 55.00 1.00 1.00 0.99 23.75 Create and map subwindows (200 kids) - 55.30 1.01 1.00 1.00 141.03 Create unmapped window (4 kids) - 55.38 1.01 1.01 1.00 163.25 Create unmapped window (16 kids) - 54.75 0.96 1.00 0.99 166.95 Create unmapped window (25 kids) - 54.83 1.00 1.00 0.99 178.81 Create unmapped window (50 kids) - 55.38 1.01 1.01 1.00 181.20 Create unmapped window (75 kids) - 55.38 1.01 1.01 1.00 181.20 Create unmapped window (100 kids) - 54.87 1.01 1.01 1.00 182.05 Create unmapped window (200 kids) - 28.13 1.00 1.00 1.00 30.75 Map window via parent (4 kids) - 36.14 1.01 1.01 1.01 32.58 Map window via parent (16 kids) - 26.13 1.00 0.98 0.95 29.85 Map window via parent (25 kids) - 40.07 1.00 1.01 1.00 27.57 Map window via parent (50 kids) - 23.26 0.99 1.00 1.00 18.23 Map window via parent (75 kids) - 22.91 0.99 1.00 0.99 16.52 Map window via parent (100 kids) - 27.79 1.00 1.00 0.99 12.50 Map window via parent (200 kids) - 22.35 1.00 1.00 1.00 56.19 Unmap window via parent (4 kids) - 9.57 1.00 0.99 1.00 89.78 Unmap window via parent (16 kids) - 80.77 1.01 1.00 1.00 103.85 Unmap window via parent (25 kids) - 96.34 1.00 1.00 1.00 116.06 Unmap window via parent (50 kids) - 99.72 1.00 1.00 1.00 124.93 Unmap window via parent (75 kids) -112.36 1.00 1.00 1.00 125.27 Unmap window via parent (100 kids) -105.41 1.00 1.00 0.99 120.00 Unmap window via parent (200 kids) - 51.29 1.03 1.02 1.02 74.19 Destroy window via parent (4 kids) - 86.75 0.99 0.99 0.99 116.87 Destroy window via parent (16 kids) -106.43 1.01 1.01 1.01 127.49 Destroy window via parent (25 kids) -120.34 1.01 1.01 1.00 140.11 Destroy window via parent (50 kids) -126.67 1.00 0.99 0.99 145.00 Destroy window via parent (75 kids) -126.11 1.01 1.01 1.00 140.56 Destroy window via parent (100 kids) -128.57 1.01 1.00 1.00 137.91 Destroy window via parent (200 kids) - 16.04 0.88 1.00 1.00 20.36 Hide/expose window via popup (4 kids) - 19.04 1.01 1.00 1.00 23.48 Hide/expose window via popup (16 kids) - 19.22 1.00 1.00 1.00 20.44 Hide/expose window via popup (25 kids) - 17.41 1.00 0.91 0.97 17.68 Hide/expose window via popup (50 kids) - 17.29 1.01 1.00 1.01 17.07 Hide/expose window via popup (75 kids) - 16.74 1.00 1.00 1.00 16.17 Hide/expose window via popup (100 kids) - 10.30 1.00 1.00 1.00 10.51 Hide/expose window via popup (200 kids) - 16.48 1.01 1.00 1.00 26.05 Move window (4 kids) - 17.01 0.95 1.00 1.00 23.97 Move window (16 kids) - 16.95 1.00 1.00 1.00 22.90 Move window (25 kids) - 16.05 1.01 1.00 1.00 21.32 Move window (50 kids) - 15.58 1.00 0.98 0.98 19.44 Move window (75 kids) - 14.98 1.02 1.03 1.03 18.17 Move window (100 kids) - 10.90 1.01 1.01 1.00 12.68 Move window (200 kids) - 49.42 1.00 1.00 1.00 198.27 Moved unmapped window (4 kids) - 50.72 0.97 1.00 1.00 193.66 Moved unmapped window (16 kids) - 50.87 1.00 0.99 1.00 195.09 Moved unmapped window (25 kids) - 50.72 1.00 1.00 1.00 189.34 Moved unmapped window (50 kids) - 50.87 1.00 1.00 1.00 191.33 Moved unmapped window (75 kids) - 50.87 1.00 1.00 0.90 186.71 Moved unmapped window (100 kids) - 50.87 1.00 1.00 1.00 179.19 Moved unmapped window (200 kids) - 41.04 1.00 1.00 1.00 56.61 Move window via parent (4 kids) - 69.81 1.00 1.00 1.00 130.82 Move window via parent (16 kids) - 95.81 1.00 1.00 1.00 141.92 Move window via parent (25 kids) - 95.98 1.00 1.00 1.00 149.43 Move window via parent (50 kids) - 96.59 1.01 1.01 1.00 153.98 Move window via parent (75 kids) - 97.19 1.00 1.00 1.00 157.30 Move window via parent (100 kids) - 96.67 1.00 0.99 0.96 159.44 Move window via parent (200 kids) - 17.75 1.01 1.00 1.00 27.61 Resize window (4 kids) - 17.94 1.00 1.00 0.99 25.42 Resize window (16 kids) - 17.92 1.01 1.00 1.00 24.47 Resize window (25 kids) - 17.24 0.97 1.00 1.00 24.14 Resize window (50 kids) - 16.81 1.00 1.00 0.99 22.75 Resize window (75 kids) - 16.08 1.00 1.00 1.00 21.20 Resize window (100 kids) - 12.92 1.00 0.99 1.00 16.26 Resize window (200 kids) - 52.94 1.01 1.00 1.00 327.12 Resize unmapped window (4 kids) - 53.60 1.01 1.01 1.01 333.71 Resize unmapped window (16 kids) - 52.99 1.00 1.00 1.00 337.29 Resize unmapped window (25 kids) - 51.98 1.00 1.00 1.00 329.38 Resize unmapped window (50 kids) - 53.05 0.89 1.00 1.00 322.60 Resize unmapped window (75 kids) - 53.05 1.00 1.00 1.00 318.08 Resize unmapped window (100 kids) - 53.11 1.00 1.00 0.99 306.21 Resize unmapped window (200 kids) - 16.76 1.00 0.96 1.00 19.46 Circulate window (4 kids) - 17.24 1.00 1.00 0.97 16.24 Circulate window (16 kids) - 16.30 1.03 1.03 1.03 15.85 Circulate window (25 kids) - 13.45 1.00 1.00 1.00 14.90 Circulate window (50 kids) - 12.91 1.00 1.00 1.00 13.06 Circulate window (75 kids) - 11.30 0.98 1.00 1.00 11.03 Circulate window (100 kids) - 7.58 1.01 1.01 0.99 7.47 Circulate window (200 kids) - 1.01 1.01 0.98 1.00 0.95 Circulate Unmapped window (4 kids) - 1.07 1.07 1.01 1.07 1.02 Circulate Unmapped window (16 kids) - 1.04 1.09 1.06 1.05 0.97 Circulate Unmapped window (25 kids) - 1.04 1.23 1.20 1.18 1.05 Circulate Unmapped window (50 kids) - 1.18 1.53 1.19 1.45 1.24 Circulate Unmapped window (75 kids) - 1.08 1.02 1.01 1.74 1.01 Circulate Unmapped window (100 kids) - 1.01 1.12 0.98 0.91 0.97 Circulate Unmapped window (200 kids) -</screen> -</para> -</sect3> - -<sect3> -<title>Profiling with OProfile</title> - -<para>OProfile (available from http://oprofile.sourceforge.net/) is a -system-wide profiler for Linux systems that uses processor-level -counters to collect sampling data. OProfile can provide information -that is similar to that provided by <command>gprof</command>, but without the -necessity of recompiling the program with special instrumentation (i.e., -OProfile can collect statistical profiling information about optimized -programs). A test harness was developed to collect OProfile data for -each <command>x11perf</command> test individually. -</para> - -<para>Test runs were performed using the RETIRED_INSNS counter on the AMD -Athlon and the CPU_CLK_HALTED counter on the Intel Pentium III (with a -test configuration different from the one described above). We have -examined OProfile output and have compared it with <command>gprof</command> output. -This investigation has not produced results that yield performance -increases in <command>x11perf</command> numbers. -</para> - -</sect3> - -<!-- -<sect3>Retired Instructions - -<p>The initial tests using OProfile were done using the RETIRED_INSNS -counter with DMX running on the dual-processor AMD Athlon machine - the -same test configuration that was described above and that was used for -other tests. The RETIRED_INSNS counter counts retired instructions and -showed drawing, text, copying, and image tests to be dominated (> -30%) by calls to Hash(), SecurityLookupIDByClass(), -SecurityLookupIDByType(), and StandardReadRequestFromClient(). Some of -these tests also executed significant instructions in -WaitForSomething(). - -<p>In contrast, the window tests executed significant -instructions in SecurityLookupIDByType(), Hash(), -StandardReadRequestFromClient(), but also executed significant -instructions in other routines, such as ConfigureWindow(). Some time -was spent looking at Hash() function, but optimizations in this routine -did not lead to a dramatic increase in <tt/x11perf/ performance. ---> - -<!-- -<sect3>Clock Cycles - -<p>Retired instructions can be misleading because Intel/AMD instructions -execute in variable amounts of time. The OProfile tests were repeated -using the Intel CPU_CLK_HALTED counter with DMX running on the second -back-end machine. Note that this is a different test configuration that -the one described above. However, these tests show the amount of time -(as measured in CPU cycles) that are spent in each routine. Because -<tt/x11perf/ was running on the first back-end machine and because -window optimizations were on, the load on the second back-end machine -was not significant. - -<p>Using CPU_CLK_HALTED, DMX showed simple drawing -tests spending more than 10% of their time in -StandardReadRequestFromClient(), with significant time (> 20% total) -spent in SecurityLookupIDByClass(), WaitForSomething(), and Dispatch(). -For these tests, < 5% of the time was spent in Hash(), which explains -why optimizing the Hash() routine did not impact <tt/x11perf/ results. - -<p>The trapezoid, text, scrolling, copying, and image tests were -dominated by time in ProcFillPoly(), PanoramiXFillPoly(), dmxFillPolygon(), -SecurityLookupIDByClass(), SecurityLookupIDByType(), and -StandardReadRequestFromClient(). Hash() time was generally above 5% but -less than 10% of total time. ---> - -<sect3> -<title>X Test Suite</title> - -<para>The X Test Suite was run on the fully optimized DMX server using the -configuration described above. The following failures were noted: -<screen> -XListPixmapFormats: Test 1 [1] -XChangeWindowAttributes: Test 32 [1] -XCreateWindow: Test 30 [1] -XFreeColors: Test 4 [3] -XCopyArea: Test 13, 17, 21, 25, 30 [2] -XCopyPlane: Test 11, 15, 27, 31 [2] -XSetFontPath: Test 4 [1] -XChangeKeyboardControl: Test 9, 10 [1] - -[1] Previously documented errors expected from the Xinerama - implementation (see Phase I discussion). -[2] Newly noted errors that have been verified as expected - behavior of the Xinerama implementation. -[3] Newly noted error that has been verified as a Xinerama - implementation bug. -</screen> -</para> - -</sect3> - -</sect2> - -<!-- ============================================================ --> -<sect2> -<title>Phase III</title> - -<para>During the third phase of development, support was provided for the -following extensions: SHAPE, RENDER, XKEYBOARD, XInput. -</para> - -<sect3> -<title>SHAPE</title> - -<para>The SHAPE extension is supported. Test applications (e.g., xeyes and -oclock) and window managers that make use of the SHAPE extension will -work as expected. -</para> -</sect3> - -<sect3> -<title>RENDER</title> - -<para>The RENDER extension is supported. The version included in the DMX -CVS tree is version 0.2, and this version is fully supported by Xdmx. -Applications using only version 0.2 functions will work correctly; -however, some apps that make use of functions from later versions do not -properly check the extension's major/minor version numbers. These apps -will fail with a Bad Implementation error when using post-version 0.2 -functions. This is expected behavior. When the DMX CVS tree is updated -to include newer versions of RENDER, support for these newer functions -will be added to the DMX X server. -</para> -</sect3> - -<sect3> -<title>XKEYBOARD</title> - -<para>The XKEYBOARD extension is supported. If present on the back-end X -servers, the XKEYBOARD extension will be used to obtain information -about the type of the keyboard for initialization. Otherwise, the -keyboard will be initialized using defaults. Note that this departs -from older behavior: when Xdmx is compiled without XKEYBOARD support, -the map from the back-end X server will be preserved. With XKEYBOARD -support, the map is not preserved because better information and control -of the keyboard is available. -</para> -</sect3> - -<sect3> -<title>XInput</title> - -<para>The XInput extension is supported. Any device can be used as a core -device and be used as an XInput extension device, with the exception of -core devices on the back-end servers. This limitation is present -because cursor handling on the back-end requires that the back-end -cursor sometimes track the Xdmx core cursor -- behavior that is -incompatible with using the back-end pointer as a non-core device. -</para> - -<para>Currently, back-end extension devices are not available as Xdmx -extension devices, but this limitation should be removed in the future. -</para> - -<para>To demonstrate the XInput extension, and to provide more examples for -low-level input device driver writers, USB device drivers have been -written for mice (usb-mou), keyboards (usb-kbd), and -non-mouse/non-keyboard USB devices (usb-oth). Please see the man page -for information on Linux kernel drivers that are required for using -these Xdmx drivers. -</para> -</sect3> - -<sect3> -<title>DPMS</title> - -<para>The DPMS extension is exported but does not do anything at this time. -</para> - -</sect3> - -<sect3> -<title>Other Extensions</title> - -<para>The LBX, - SECURITY, - XC-APPGROUP, and - XFree86-Bigfont -extensions do not require any special Xdmx support and have been exported. -</para> - -<para>The - BIG-REQUESTS, - DEC-XTRAP, - DOUBLE-BUFFER, - Extended-Visual-Information, - FontCache, - GLX, - MIT-SCREEN-SAVER, - MIT-SHM, - MIT-SUNDRY-NONSTANDARD, - RECORD, - SECURITY, - SGI-GLX, - SYNC, - TOG-CUP, - X-Resource, - XC-MISC, - XFree86-DGA, - XFree86-DRI, - XFree86-Misc, - XFree86-VidModeExtension, and - XVideo -extensions are <emphasis remap="it">not</emphasis> supported at this time, but will be evaluated -for inclusion in future DMX releases. <emphasis remap="bf">See below for additional work -on extensions after Phase III.</emphasis> -</para> -</sect3> -</sect2> - -<sect2> -<title>Phase IV</title> - -<sect3> -<title>Moving to XFree86 4.3.0</title> - -<para>For Phase IV, the recent release of XFree86 4.3.0 (27 February 2003) -was merged onto the dmx.sourceforge.net CVS trunk and all work is -proceeding using this tree. -</para> -</sect3> - -<sect3> -<title>Extensions </title> - -<sect4> -<title>XC-MISC (supported)</title> - -<para>XC-MISC is used internally by the X library to recycle XIDs from the -X server. This is important for long-running X server sessions. Xdmx -supports this extension. The X Test Suite passed and failed the exact -same tests before and after this extension was enabled. -<!-- Tested February/March 2003 --> -</para> -</sect4> - -<sect4> -<title>Extended-Visual-Information (supported)</title> - -<para>The Extended-Visual-Information extension provides a method for an X -client to obtain detailed visual information. Xdmx supports this -extension. It was tested using the <filename>hw/dmx/examples/evi</filename> example -program. <emphasis remap="bf">Note that this extension is not Xinerama-aware</emphasis> -- it will -return visual information for each screen even though Xinerama is -causing the X server to export a single logical screen. -<!-- Tested March 2003 --> -</para> -</sect4> - -<sect4> -<title>RES (supported)</title> - -<para>The X-Resource extension provides a mechanism for a client to obtain -detailed information about the resources used by other clients. This -extension was tested with the <filename>hw/dmx/examples/res</filename> program. The -X Test Suite passed and failed the exact same tests before and after -this extension was enabled. -<!-- Tested March 2003 --> -</para> -</sect4> - -<sect4> -<title>BIG-REQUESTS (supported)</title> - -<para>This extension enables the X11 protocol to handle requests longer -than 262140 bytes. The X Test Suite passed and failed the exact same -tests before and after this extension was enabled. -<!-- Tested March 2003 --> -</para> -</sect4> - -<sect4> -<title>XSYNC (supported)</title> - -<para>This extension provides facilities for two different X clients to -synchronize their requests. This extension was minimally tested with -<command>xdpyinfo</command> and the X Test Suite passed and failed the exact same -tests before and after this extension was enabled. -<!-- Tested March 2003 --> -</para> -</sect4> - -<sect4> -<title>XTEST, RECORD, DEC-XTRAP (supported) and XTestExtension1 (not supported)</title> - -<para>The XTEST and RECORD extension were developed by the X Consortium for -use in the X Test Suite and are supported as a standard in the X11R6 -tree. They are also supported in Xdmx. When X Test Suite tests that -make use of the XTEST extension are run, Xdmx passes and fails exactly -the same tests as does a standard XFree86 X server. When the -<literal remap="tt">rcrdtest</literal> test (a part of the X Test Suite that verifies the RECORD -extension) is run, Xdmx passes and fails exactly the same tests as does -a standard XFree86 X server. <!-- Tested February/March 2003 --> -</para> - -<para>There are two older XTEST-like extensions: DEC-XTRAP and -XTestExtension1. The XTestExtension1 extension was developed for use by -the X Testing Consortium for use with a test suite that eventually -became (part of?) the X Test Suite. Unlike XTEST, which only allows -events to be sent to the server, the XTestExtension1 extension also -allowed events to be recorded (similar to the RECORD extension). The -second is the DEC-XTRAP extension that was developed by the Digital -Equipment Corporation. -</para> - -<para>The DEC-XTRAP extension is available from Xdmx and has been tested -with the <command>xtrap*</command> tools which are distributed as standard X11R6 -clients. <!-- Tested March 2003 --> -</para> - -<para>The XTestExtension1 is <emphasis>not</emphasis> supported because it does not appear -to be used by any modern X clients (the few that support it also support -XTEST) and because there are no good methods available for testing that -it functions correctly (unlike XTEST and DEC-XTRAP, the code for -XTestExtension1 is not part of the standard X server source tree, so -additional testing is important). <!-- Tested March 2003 --> -</para> - -<para>Most of these extensions are documented in the X11R6 source tree. -Further, several original papers exist that this author was unable to -locate -- for completeness and historical interest, citations are -provide: -<variablelist> -<varlistentry> -<term>XRECORD</term> -<listitem> -<para>Martha Zimet. Extending X For Recording. 8th Annual X -Technical Conference Boston, MA January 24-26, 1994. -</para></listitem></varlistentry> -<varlistentry> -<term>DEC-XTRAP</term> -<listitem> -<para>Dick Annicchiarico, Robert Chesler, Alan Jamison. XTrap -Architecture. Digital Equipment Corporation, July 1991. -</para></listitem></varlistentry> -<varlistentry> -<term>XTestExtension1</term> -<listitem> -<para>Larry Woestman. X11 Input Synthesis Extension -Proposal. Hewlett Packard, November 1991. -</para></listitem></varlistentry> -</variablelist> -</para> -</sect4> - -<sect4> -<title>MIT-MISC (not supported)</title> - -<para>The MIT-MISC extension is used to control a bug-compatibility flag -that provides compatibility with xterm programs from X11R1 and X11R2. -There does not appear to be a single client available that makes use of -this extension and there is not way to verify that it works correctly. -The Xdmx server does <emphasis>not</emphasis> support MIT-MISC. -</para> -</sect4> - -<sect4> -<title>SCREENSAVER (not supported)</title> - -<para>This extension provides special support for the X screen saver. It -was tested with beforelight, which appears to be the only client that -works with it. When Xinerama was not active, <command>beforelight</command> behaved -as expected. However, when Xinerama was active, <command>beforelight</command> did -not behave as expected. Further, when this extension is not active, -<command>xscreensaver</command> (a widely-used X screen saver program) did not behave -as expected. Since this extension is not Xinerama-aware and is not -commonly used with expected results by clients, we have left this -extension disabled at this time. -</para> -</sect4> - -<sect4> -<title>GLX (supported)</title> - -<para>The GLX extension provides OpenGL and GLX windowing support. In -Xdmx, the extension is called glxProxy, and it is Xinerama aware. It -works by either feeding requests forward through Xdmx to each of the -back-end servers or handling them locally. All rendering requests are -handled on the back-end X servers. This code was donated to the DMX -project by SGI. For the X Test Suite results comparison, see below. -</para> -</sect4> - -<sect4> -<title>RENDER (supported)</title> - -<para>The X Rendering Extension (RENDER) provides support for digital image -composition. Geometric and text rendering are supported. RENDER is -partially Xinerama-aware, with text and the most basic compositing -operator; however, its higher level primitives (triangles, triangle -strips, and triangle fans) are not yet Xinerama-aware. The RENDER -extension is still under development, and is currently at version 0.8. -Additional support will be required in DMX as more primitives and/or -requests are added to the extension. -</para> - -<para>There is currently no test suite for the X Rendering Extension; -however, there has been discussion of developing a test suite as the -extension matures. When that test suite becomes available, additional -testing can be performed with Xdmx. The X Test Suite passed and failed -the exact same tests before and after this extension was enabled. -</para> -</sect4> - -<sect4> -<title>Summary</title> - -<!-- WARNING: this list is duplicated in the "Common X extension -support" section --> -<para>To summarize, the following extensions are currently supported: - BIG-REQUESTS, - DEC-XTRAP, - DMX, - DPMS, - Extended-Visual-Information, - GLX, - LBX, - RECORD, - RENDER, - SECURITY, - SHAPE, - SYNC, - X-Resource, - XC-APPGROUP, - XC-MISC, - XFree86-Bigfont, - XINERAMA, - XInputExtension, - XKEYBOARD, and - XTEST. -</para> - -<para>The following extensions are <emphasis>not</emphasis> supported at this time: - DOUBLE-BUFFER, - FontCache, - MIT-SCREEN-SAVER, - MIT-SHM, - MIT-SUNDRY-NONSTANDARD, - TOG-CUP, - XFree86-DGA, - XFree86-Misc, - XFree86-VidModeExtension, - XTestExtensionExt1, and - XVideo. -</para> -</sect4> -</sect3> - -<sect3> -<title>Additional Testing with the X Test Suite</title> - -<sect4> -<title>XFree86 without XTEST</title> - -<para>After the release of XFree86 4.3.0, we retested the XFree86 X server -with and without using the XTEST extension. When the XTEST extension -was <emphasis>not</emphasis> used for testing, the XFree86 4.3.0 server running on our -usual test system with a Radeon VE card reported unexpected failures in -the following tests: -<literallayout> -XListPixmapFormats: Test 1 -XChangeKeyboardControl: Tests 9, 10 -XGetDefault: Test 5 -XRebindKeysym: Test 1 -</literallayout> -</para> -</sect4> - -<sect4> -<title>XFree86 with XTEST</title> - -<para>When using the XTEST extension, the XFree86 4.3.0 server reported the -following errors: -<literallayout> -XListPixmapFormats: Test 1 -XChangeKeyboardControl: Tests 9, 10 -XGetDefault: Test 5 -XRebindKeysym: Test 1 - -XAllowEvents: Tests 20, 21, 24 -XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25 -XGrabKey: Test 8 -XSetPointerMapping: Test 3 -XUngrabButton: Test 4 -</literallayout> -</para> - -<para>While these errors may be important, they will probably be fixed -eventually in the XFree86 source tree. We are particularly interested -in demonstrating that the Xdmx server does not introduce additional -failures that are not known Xinerama failures. -</para> -</sect4> - -<sect4> -<title>Xdmx with XTEST, without Xinerama, without GLX</title> - -<para>Without Xinerama, but using the XTEST extension, the following errors -were reported from Xdmx (note that these are the same as for the XFree86 -4.3.0, except that XGetDefault no longer fails): -<literallayout> -XListPixmapFormats: Test 1 -XChangeKeyboardControl: Tests 9, 10 -XRebindKeysym: Test 1 - -XAllowEvents: Tests 20, 21, 24 -XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25 -XGrabKey: Test 8 -XSetPointerMapping: Test 3 -XUngrabButton: Test 4 -</literallayout> -</para> -</sect4> - -<sect4> -<title>Xdmx with XTEST, with Xinerama, without GLX</title> - -<para>With Xinerama, using the XTEST extension, the following errors -were reported from Xdmx: -<literallayout> -XListPixmapFormats: Test 1 -XChangeKeyboardControl: Tests 9, 10 -XRebindKeysym: Test 1 - -XAllowEvents: Tests 20, 21, 24 -XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25 -XGrabKey: Test 8 -XSetPointerMapping: Test 3 -XUngrabButton: Test 4 - -XCopyPlane: Tests 13, 22, 31 (well-known XTEST/Xinerama interaction issue) -XDrawLine: Test 67 -XDrawLines: Test 91 -XDrawSegments: Test 68 -</literallayout> -Note that the first two sets of errors are the same as for the XFree86 -4.3.0 server, and that the XCopyPlane error is a well-known error -resulting from an XTEST/Xinerama interaction when the request crosses a -screen boundary. The XDraw* errors are resolved when the tests are run -individually and they do not cross a screen boundary. We will -investigate these errors further to determine their cause. -</para> -</sect4> - -<sect4> -<title>Xdmx with XTEST, with Xinerama, with GLX</title> - -<para>With GLX enabled, using the XTEST extension, the following errors -were reported from Xdmx (these results are from early during the Phase -IV development, but were confirmed with a late Phase IV snapshot): -<literallayout> -XListPixmapFormats: Test 1 -XChangeKeyboardControl: Tests 9, 10 -XRebindKeysym: Test 1 - -XAllowEvents: Tests 20, 21, 24 -XGrabButton: Tests 5, 9-12, 14, 16, 19, 21-25 -XGrabKey: Test 8 -XSetPointerMapping: Test 3 -XUngrabButton: Test 4 - -XClearArea: Test 8 -XCopyArea: Tests 4, 5, 11, 14, 17, 23, 25, 27, 30 -XCopyPlane: Tests 6, 7, 10, 19, 22, 31 -XDrawArcs: Tests 89, 100, 102 -XDrawLine: Test 67 -XDrawSegments: Test 68 -</literallayout> -Note that the first two sets of errors are the same as for the XFree86 -4.3.0 server, and that the third set has different failures than when -Xdmx does not include GLX support. Since the GLX extension adds new -visuals to support GLX's visual configs and the X Test Suite runs tests -over the entire set of visuals, additional rendering tests were run and -presumably more of them crossed a screen boundary. This conclusion is -supported by the fact that nearly all of the rendering errors reported -are resolved when the tests are run individually and they do no cross a -screen boundary. -</para> - -<para>Further, when hardware rendering is disabled on the back-end displays, -many of the errors in the third set are eliminated, leaving only: -<literallayout> -XClearArea: Test 8 -XCopyArea: Test 4, 5, 11, 14, 17, 23, 25, 27, 30 -XCopyPlane: Test 6, 7, 10, 19, 22, 31 -</literallayout> -</para> -</sect4> - -<sect4> -<title>Conclusion</title> - -<para>We conclude that all of the X Test Suite errors reported for Xdmx are -the result of errors in the back-end X server or the Xinerama -implementation. Further, all of these errors that can be reasonably -fixed at the Xdmx layer have been. (Where appropriate, we have -submitted patches to the XFree86 and Xinerama upstream maintainers.) -</para> -</sect4> -</sect3> - -<sect3> -<title>Dynamic Reconfiguration</title> - -<para>During this development phase, dynamic reconfiguration support was -added to DMX. This support allows an application to change the position -and offset of a back-end server's screen. For example, if the -application would like to shift a screen slightly to the left, it could -query Xdmx for the screen's <x,y> position and then dynamically -reconfigure that screen to be at position <x+10,y>. When a screen -is dynamically reconfigured, input handling and a screen's root window -dimensions are adjusted as needed. These adjustments are transparent to -the user. -</para> - -<sect4> -<title>Dynamic reconfiguration extension</title> - -<para>The application interface to DMX's dynamic reconfiguration is through -a function in the DMX extension library: -<programlisting> -Bool DMXReconfigureScreen(Display *dpy, int screen, int x, int y) -</programlisting> -where <parameter>dpy</parameter> is DMX server's display, <parameter>screen</parameter> is the number of the -screen to be reconfigured, and <parameter>x</parameter> and <parameter>y</parameter> are the new upper, -left-hand coordinates of the screen to be reconfigured. -</para> - -<para>The coordinates are not limited other than as required by the X -protocol, which limits all coordinates to a signed 16 bit number. In -addition, all coordinates within a screen must also be legal values. -Therefore, setting a screen's upper, left-hand coordinates such that the -right or bottom edges of the screen is greater than 32,767 is illegal. -</para> -</sect4> - -<sect4> -<title>Bounding box</title> - -<para>When the Xdmx server is started, a bounding box is calculated from -the screens' layout given either on the command line or in the -configuration file. This bounding box is currently fixed for the -lifetime of the Xdmx server. -</para> - -<para>While it is possible to move a screen outside of the bounding box, it -is currently not possible to change the dimensions of the bounding box. -For example, it is possible to specify coordinates of <-100,-100> -for the upper, left-hand corner of the bounding box, which was -previously at coordinates <0,0>. As expected, the screen is moved -down and to the right; however, since the bounding box is fixed, the -left side and upper portions of the screen exposed by the -reconfiguration are no longer accessible on that screen. Those -inaccessible regions are filled with black. -</para> - -<para>This fixed bounding box limitation will be addressed in a future -development phase. -</para> -</sect4> - -<sect4> -<title>Sample applications</title> - -<para>An example of where this extension is useful is in setting up a video -wall. It is not always possible to get everything perfectly aligned, -and sometimes the positions are changed (e.g., someone might bump into a -projector). Instead of physically moving projectors or monitors, it is -now possible to adjust the positions of the back-end server's screens -using the dynamic reconfiguration support in DMX. -</para> - -<para>Other applications, such as automatic setup and calibration tools, -can make use of dynamic reconfiguration to correct for projector -alignment problems, as long as the projectors are still arranged -rectilinearly. Horizontal and vertical keystone correction could be -applied to projectors to correct for non-rectilinear alignment problems; -however, this must be done external to Xdmx. -</para> - -<para>A sample test program is included in the DMX server's examples -directory to demonstrate the interface and how an application might use -dynamic reconfiguration. See <filename>dmxreconfig.c</filename> for details. -</para> -</sect4> - -<sect4> -<title>Additional notes</title> - -<para>In the original development plan, Phase IV was primarily devoted to -adding OpenGL support to DMX; however, SGI became interested in the DMX -project and developed code to support OpenGL/GLX. This code was later -donated to the DMX project and integrated into the DMX code base, which -freed the DMX developers to concentrate on dynamic reconfiguration (as -described above). -</para> -</sect4> -</sect3> - -<sect3> -<title>Doxygen documentation</title> - -<para>Doxygen is an open-source (GPL) documentation system for generating -browsable documentation from stylized comments in the source code. We -have placed all of the Xdmx server and DMX protocol source code files -under Doxygen so that comprehensive documentation for the Xdmx source -code is available in an easily browsable format. -</para> -</sect3> - -<sect3> -<title>Valgrind</title> - -<para>Valgrind, an open-source (GPL) memory debugger for Linux, was used to -search for memory management errors. Several memory leaks were detected -and repaired. The following errors were not addressed: -<orderedlist> - <listitem><para> - When the X11 transport layer sends a reply to the client, only - those fields that are required by the protocol are filled in -- - unused fields are left as uninitialized memory and are therefore - noted by valgrind. These instances are not errors and were not - repaired. - </para></listitem> - <listitem><para> - At each server generation, glxInitVisuals allocates memory that - is never freed. The amount of memory lost each generation - approximately equal to 128 bytes for each back-end visual. - Because the code involved is automatically generated, this bug - has not been fixed and will be referred to SGI. - </para></listitem> - <listitem><para> - At each server generation, dmxRealizeFont calls XLoadQueryFont, - which allocates a font structure that is not freed. - dmxUnrealizeFont can free the font structure for the first - screen, but cannot free it for the other screens since they are - already closed by the time dmxUnrealizeFont could free them. - The amount of memory lost each generation is approximately equal - to 80 bytes per font per back-end. When this bug is fixed in - the the X server's device-independent (dix) code, DMX will be - able to properly free the memory allocated by XLoadQueryFont. - </para></listitem> -</orderedlist> -</para> -</sect3> - -<sect3> -<title>RATS</title> - -<para>RATS (Rough Auditing Tool for Security) is an open-source (GPL) -security analysis tool that scans source code for common -security-related programming errors (e.g., buffer overflows and TOCTOU -races). RATS was used to audit all of the code in the hw/dmx directory -and all "High" notations were checked manually. The code was either -re-written to eliminate the warning, or a comment containing "RATS" was -inserted on the line to indicate that a human had checked the code. -Unrepaired warnings are as follows: -<orderedlist> - <listitem><para> - Fixed-size buffers are used in many areas, but code has been - added to protect against buffer overflows (e.g., snprintf). - The only instances that have not yet been fixed are in - config/xdmxconfig.c (which is not part of the Xdmx server) and - input/usb-common.c. - </para></listitem> - <listitem><para> - vprintf and vfprintf are used in the logging routines. In - general, all uses of these functions (e.g., dmxLog) provide a - constant format string from a trusted source, so the use is - relatively benign. - </para></listitem> - <listitem><para> - glxProxy/glxscreens.c uses getenv and strcat. The use of these - functions is safe and will remain safe as long as - ExtensionsString is longer then GLXServerExtensions (ensuring - this may not be ovious to the casual programmer, but this is in - automatically generated code, so we hope that the generator - enforces this constraint). - </para></listitem> -</orderedlist> - -</para> - -</sect3> - -</sect2> - -</sect1> - -</appendix> - - </article> - - <!-- Local Variables: --> - <!-- fill-column: 72 --> - <!-- End: --> diff --git a/hw/dmx/doc/meson.build b/hw/dmx/doc/meson.build deleted file mode 100644 index 8cdc4c004..000000000 --- a/hw/dmx/doc/meson.build +++ /dev/null @@ -1,37 +0,0 @@ - -if build_docs_devel - foreach basename : ['dmx', 'scaled'] - - input_xml = basename + '.xml' - - custom_target( - basename + '.html', - output: basename + '.html', - input: [input_xml], - command: [xmlto] + docs_xmlto_search_flags + [ - '-x', join_paths(doc_stylesheet_srcdir, 'xorg-xhtml.xsl'), - '-o', meson.current_build_dir(), - 'xhtml-nochunks', '@INPUT0@'], - build_by_default: true, - install: false, - ) - - if build_docs_pdf - foreach format : ['ps', 'pdf'] - output_fn = basename + '.' + format - custom_target( - output_fn, - output: output_fn, - input: [input_xml], - command: [xmlto] + docs_xmlto_search_flags + [ - '-x', join_paths(doc_stylesheet_srcdir, 'xorg-fo.xsl'), - '--stringparam', 'img.src.path=' + meson.current_build_dir(), - '-o', meson.current_build_dir(), - '--with-fop', format, '@INPUT0@'], - build_by_default: true, - install: false, - ) - endforeach - endif - endforeach -endif diff --git a/hw/dmx/doc/scaled.xml b/hw/dmx/doc/scaled.xml deleted file mode 100644 index 30c9b9f50..000000000 --- a/hw/dmx/doc/scaled.xml +++ /dev/null @@ -1,727 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> -<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN" - "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" [ - <!ENTITY % defs SYSTEM "/xserver/doc/xml/xserver.ent"> %defs; -]> - <article> - - <articleinfo> - <!-- Title information --> - <title>Scaled Window Support in DMX</title> - <authorgroup> - <author><firstname>Kevin E.</firstname><surname>Martin</surname></author> - <author><firstname>Rickard E.</firstname><surname>Faith</surname></author> - </authorgroup> - <pubdate>15 October 2003 (created 19 September 2003)</pubdate> - <releaseinfo>X Server Version &xserver.version;</releaseinfo> - <abstract> - <para> - This document investigates the possibility of adding scaled window - support to the DMX X server, thereby allowing a window or some - selected part of the logical DMX area to be displayed using a - scaling factor. For example, this might allow the contents of a - window to be magnified for easier viewing. In particular, scaling - for the VNC client is explored. <emphasis remap="it">Copyright 2003 - by Red Hat, Inc., Raleigh, North Carolina</emphasis> - </para> - </abstract> - </articleinfo> - - <!-- Begin the document --> - <sect1><title>Introduction</title> - <sect2><title>DMX</title> - <para> - The DMX X server (Xdmx) is a proxy server that is designed - to allow X servers on multiple machines to be combined into - a single multi-headed X server. Combined with Xinerama, - these heads can appear as a single very high-resolution - screen. Typical applications include the creation of a - video wall with 16 1280x1024 displays arranged in a - rectangle, for a total resolution of of 5120x4096. - </para> - </sect2> - <sect2><title>Problem Statement</title> - <para> - Applications displayed on a physically large video wall that - provides high pixel-resolution may be difficult to see, - especially if the application is designed for use on a - typical desktop computer with a relatively small display - located close to the human operator. The goal of this paper - is to describe and discuss solutions to this problem. - </para> - <para> - The original driving problem for this work is to provide - scaling for the <command>vncviewer</command> application when - displayed using DMX (VNC scaling is currently available only - with the Windows client, and there is no plan to extend that - capability to other clients). While this specific problem - will be addressed in this paper, the general solution space - will also be explored, since this may lead to a good - solution not only for <command>vncviewer</command> but also for - other applications. - </para> - </sect2> - <sect2><title>Task</title> - <para> - For reference, here is the original description of the task - this paper addresses: - <itemizedlist> - <listitem><para>Scaled window support (for VNC) - <itemizedlist> - <listitem><para> - Investigate possibility of implementing a "scaled - window" extension: - <itemizedlist> - <listitem><para> - Add XCreateScaledWindow call that could be used - in place of XCreateWindow - </para></listitem> - <listitem><para> - All primitives drawn to scaled window would be - scaled by appropriate (integral?) scaling factor - </para></listitem> - </itemizedlist> - </para></listitem> - <listitem><para> - Alternate approach: special case VNC support - </para></listitem> - </itemizedlist> - </para></listitem> - </itemizedlist> - </para> - </sect2> - </sect1> - - <sect1><title>Previous Work</title> - <para> - This section reviews relevant previous work. - </para> - <sect2><title>VNC</title> - <sect3><title>Scaling under VNC</title> - <para> - When using the <command>vncviewer</command> program for Windows, it - is possible to specify a scaling factor (as numerator and - denominator). When scaling is in effect, the viewer - software uses StretchBlt (instead of BitBlt) to display - the pixels for the user. When this call is made, the - viewer already has received all of the pixel information - (at full unscaled resolution). - </para> - <para> - The scaling in VNC is primitive. It does not conserve - bandwidth, it does not treat textual information - differently (i.e., by using a suitably scaled font), and - it does not provide any anti-aliasing other than that - provided by the underlying (Windows-only) system library. - </para> - </sect3> - </sect2> - <sect2><title>The X Video Extension</title> - <para> - The X Video Extension is a widely-available extension to the - X11 protocol that provides support for streaming video. - Integral to this support is the ability to arbitrarily scale - the output. In version 2.2 of the X Video specification, - support for scaled still images was provided, using both - shared memory and traditional transport. The API for this - support uses calls that are quite similar to XCreateWindow, - XPutImage, and XShmPutImage. Currently, most of the drivers - implemented in XFree86 only support data in various YUV - formats. However, several modern video adaptors support RGB - as well. - </para> - <para> - Note, though, that the target output for this scaling is an - overlay plane -- so X Video provides functionality that is - fundamentally different from that provided by the Windows - StrechBlt call. - </para> - </sect2> - </sect1> - - <sect1><title>Possible Solutions</title> - <para> - This section briefly discusses possible solutions, including - major advantages and disadvantages from both the - implementation and the end-user programmer standpoint. - </para> - <sect2><title>VNC-like Scaling</title> - <sect3><title>Software Scaling</title> - <para> - The <command>vncviewer</command> application could be modified to - provide software scaling. This is not a general solution, - but it does solve one of the goals of this work. - </para> - <para> - A prototype of this solution was implemented and a patch - against <filename>vnc-3.3.7-unixsrc</filename> is available in the - <filename>dmx/external</filename> directory. Because of limited time - available for this work, all of the edge cases were not - considered and the solution works well mainly for integer - scaling. - </para> - <para> - Currently, <command>vncviewer</command> writes to the X display - with XPutImage, XCopyArea, and XFillRectangle. All - instances of these calls have to be aware of scaling - and must round correctly. In the prototype solution, - rounding is incorrect and can cause artifacts. - </para> - <para> - A better solution would be to cache all updates to the - desktop image in <command>vncviewer</command> and only send the - damaged area to the X display with XPutImage. This would - allow the damaged area to be computed so that rounding - errors do not create artifacts. This method is probably - similar to what is used in the Window client. (The whole - VNC suite is being re-written in C++ and the forthcoming - version 4 has not been evaluated.) - </para> - </sect3> - <sect3><title>Scaling with the X Video Extension</title> - <para> - The scaling in the Windows <command>vncviewer</command> application - makes use of a scaled blit that is supplied by the - underlying system library. Several video cards currently - provide support for a scaled blit, and some X servers - (including XFree86) expose this capability to applications - via the XvPutImage interface of the X Video Extension. - The capability exposed by XvPutImage results in the scaled - image being drawn to an overlay plane. Most video cards - also provide support for a scaled blit into the normal - output planes, but this is not exposed via XvPutImage. - </para> - <para> - The <command>vncviewer</command> program could be modified to use - the X Video Extension to provide scaling under X11 that is - similar to the scaling currently provided under Windows. - Unfortunately, Xdmx does not currently export the X Video - Extension, so this would not provide an immediate solution - usable with DMX. - </para> - <para> - A very early-stage proof-of-concept prototype was - implemented and a preliminary patch against - <filename>vnc-3.3.7-unixsrc</filename> is available in the - <filename>dmx/external</filename> directory. This prototype was - implemented to better understand the problems that must be - solved to make this solution viable: - <itemizedlist> - <listitem><para> - As noted under the software scaling section above, - <command>vncviewer</command> writes to the X display with - several different calls. These calls write to the - normal output planes and are compatible with - XvPutImage, which writes to an overlay plane. To - eliminate artifacts caused by this problem, - <command>vncviewer</command> should be modified so that a cached - copy of the desktop is available, either as a - client-side image or a server-side off-screen pixmap, - so that XvPutImage would be the only method for - writing to the X display. - </para></listitem> - <listitem> - <para> - Although several modern graphics adaptors support - hardware scaling using an RGB format (e.g., ATI - Radeon, nVidia, etc.), XFree86 drivers typically - only implement YUV formats. YUV generally compress - the pixel information in some way. For example, two - commonly implemented formats, YUY2 and UYVY provide - intensity information for every RGB pixel, but only - provide chroma and luminance information for pairs - of horizontal pixels. Since VNC uses - pixel-resolution for communicating updates on the - wire, additional artifacts are introduced (because - there may not be enough information from the wire to - update a pair of pixels). - </para> - <para> - Further, the well-known problem with YUV encoding - is even more evident when the image is a desktop - instead of a movie. For example, consider a - 1-pixel-wide vertical window border. If the border - changes in color but not intensity (e.g., because a - window manager uses color to indicate focus), there - may or may not be a change in the YUY2 image, - depending on the algorithm used for RGB to YUV - conversion and on how the border pixel is ordered in - the pair of pixels used by the algorithm. - </para> - <para> - Many of these artifacts could be eliminated if - <command>vncviewer</command> cached a complete RGB image of - the desktop, and only did the conversion to YUV for - properly aligned areas of damage. The remaining artifacts - could be eliminated if an RGB format was used with X - Video (which may require the extension of existing - XFree86 drivers to support RGB). - </para> - </listitem> - <listitem><para> - Most modern video cards support exactly one overlay - plane that is suitable for use with X Video. - Therefore, only one application can use X Video at any - given time. This is a severe limitation in a desktop - environment. - </para></listitem> - </itemizedlist> - </para> - <sect4><title>Implementing the X Video Extension for DMX</title> - <para> - The user-level API for X Video is fairly simple, but the - underlying support required for the full specification - is large. However, since the API provides a method to - query supported capabilities, a usable subset of X - Video can be implemented that would support XvPutImage - and little else. This would require support for the - following: - <itemizedlist> - <listitem><para> - X Video Extension API calls, including the - following: - <itemizedlist> - <listitem><para>XvQueryExtension</para></listitem> - <listitem><para>XvQueryAdaptors</para></listitem> - <listitem><para>XvQueryPortAttributes</para></listitem> - <listitem><para>XvFreeAdaptorInfo</para></listitem> - <listitem><para>XvListImageFormats</para></listitem> - <listitem><para>XvGrabPort</para></listitem> - <listitem><para>XvCreateImage</para></listitem> - <listitem><para>XvPutImage</para></listitem> - <listitem><para>XvShmCreateImage</para></listitem> - <listitem><para>XvShmPutImage</para></listitem> - </itemizedlist> - </para></listitem> - <listitem><para> - Support for querying back-end X Video Extension - capabilities. - </para></listitem> - <listitem><para> - Support for sending the image to the back-ends. - Because X Video requires sending full images, there - may be a trade-off between bandwidth limitations and - additional complexity to divide the image up such - that is scales properly. - </para></listitem> - <listitem><para> - Possible support for a software fall-back. For - example, if all of the back-ends do not support the X - Video Extension, software scaling can be implemented - such that the image is sent to the back-end with - XPutImage. This pathway would have poor - performance. - </para></listitem> - </itemizedlist> - </para> - </sect4> - <sect4><title>Supporting RGB formats for the X Video Extension</title> - <para> - Assuming an XFree86 driver already supports the X Video - Extension, and assuming the target hardware supports an - RGB format, then adding support for that format is - relatively simple and straightforward. - </para> - </sect4> - </sect3> - <sect3><title>Scaling with an XPutImageScaled Extension</title> - <para> - Instead of (or in addition to) implementing the X Video - Extension in DMX, one obvious solution would be to - implement a new extension that provides access to - hardware-assisted scaled blits, similar to the StretchBlt - call available under Windows. This call would scale RGB - images and would not use the overlay plane (unlike the X - Video Extension). - </para> - <para> - This approach has many of the same advantages and - disadvantages as the XCopyAreaScaled Extension, discussed - in the next section. Discussion of XPutImageScaled is - deferred in favor of XCopyAreaScaled for the following - reasons: - <itemizedlist> - <listitem><para> - XPutImageScaled can be emulated with XCopyAreaScaled - by first using XPutImage to copy the image to an - off-screen pixmap, and then calling XCopyAreaScaled - between that off-screen pixmap and the target - drawable. - </para></listitem> - <listitem><para> - Since XCopyAreaScaled would copy between two areas of - on-screen or off-screen memory, it has additional uses - and can be viewed as efficiently providing a superset - of XPutImageScaled functionality. - </para></listitem> - </itemizedlist> - </para> - </sect3> - <sect3><title>Scaling with an XCopyAreaScaled Extension</title> - <para> - As noted in the previous section, because XCopyAreaScaled - provides a superset of the functionality provided by - XPutImageScaled, we will consider this extension instead. - </para> - <para> - First, XCopyAreaScaled would provide for RGB scaling - between pixmaps (i.e., on-screen or off-screen areas of - memory that reside on the video card). Unlike the X Video - Extension, which writes into an overlay plane, - XCopyAreaScaled would write into the non-overlay areas of - the screen. Key points to consider are as follows: - <itemizedlist> - <listitem><para> - Because different planes are involved, the two scaling - operations are usually implemented in hardware - differently, so an XCopyAreaScaled extension could be - added in a manner that would neither conflict with nor - interact with the X Video extension in any way. - </para></listitem> - <listitem><para> - The XCopyAreaScaled extension provides new - functionality that the X Video Extension does not - provide. Based on anecdotal feedback, we believe that - many people outside the DMX and VNC communities would - be excited about this extension. - </para></listitem> - <listitem><para> - The main drawback to this extension is that it is new - and needs to be implemented at the driver level in - XFree86 for each video card to be supported. At the - present time, it is more likely that the X Video - Extension will be implemented for a particular piece - hardware because the X Video extension has multimedia - uses. However, over time, we would expect the - XCopyAreaScaled extension to be implemented along with - the X Video extension, especially if it becomes - popular. - </para></listitem> - <listitem><para> - Another drawback is that not all modern cards provide - support for a simple scaled blit operation. However, - these cards usually do provide a 3D pipeline which - could be used to provide this functionality in a - manner that is transparent to the client application - that is using the XCopyAreaScaled extension. However, - this implementation pathway would make this extension - somewhat more difficult to implement on certain cards. - </para></listitem> - </itemizedlist> - </para> - </sect3> - <sect3><title>Scaling with OpenGL</title> - <para> - Another general solution to the scaling problem is to use - the texture scaling found in all 3D hardware. This - ability is already exposed through OpenGL and can be - exploited by clients without X server modification (i.e., - other than the ability to support OpenGL). An application - using OpenGL would transmit the non-scaled image to the X - server as a texture, and would then display a single - non-transformed rect using that texture. This also works - around the single overlay problem with the X Video - Extension as well as the need to implement additional - scaled primitive extensions. - </para> - <para> - The downside is that most OpenGL implementations require - power of 2 texture sizes and this can be very wasteful of - memory if, for example, the application needs to scale a - 1025x1025 image, which would require a 2048x2048 texture - area (even a 640x480 image would require a 1024x512 - texture). Another downside is that some OpenGL - implementations have a limited about of texture memory and - cannot handle textures that are very large. For example, - they might limit the texture size to 1024x1024. - </para> - </sect3> - </sect2> - <sect2><title>Application-transparent Scaling for DMX - </title><sect3><title>Back-end Scaling Without Disconnect/Reconnect</title> - <para> - VNC does scaling on the client side (in the - <command>vncviewer</command> application). Implementing a similar - solution for DMX would require support in the back-end X - servers and, therefore, is not a general solution. - </para> - <para> - XFree86 already implements some support for "scaling" that - could be used with DMX: if, in the XF86Config file, - multiple Modes are listed in the Display Subsection of the - Screen Section, then pressing Ctrl-Alt-Plus and - Ctrl-Alt-Minus can be used to iterate through the listed - modes. The display dimensions will change to the - dimensions in the Modes line, but the logical dimensions - of the X server (i.e., the dimensions that Xdmx knows - about) will not change. - </para> - <para> - Further, the dimensions of the XFree86 display are under - software control (via the XFree86-VidModeExtension), so - the Xdmx server could change the screen dimensions on a - per-display basis, thereby scaling the information on part - of that display. - </para> - <para> - However, this scaling appears to have limited use. For - example, assume a 4 by 4 display wall consisting of 16 - 1280x1024 displays. If all of the back-end servers were - simultaneously configured to display 640x480, the left - hand corner of each display would be magnified, but the - composite result would be unreadable. Magnifying one - display at a time could be usable, but could have limited - utility, since the result would still be no larger than a - single display. - </para> - </sect3> - <sect3><title>Back-end Scaling With Disconnect/Reconnect</title> - <para> - Disconnect and reconnect features are not currently - supported in DMX, but are scheduled to be implemented in - the future. These features, combined with the - XFree86-VidModeExtension Extension, would allow an - application to do the following: - <itemizedlist> - <listitem><para> - Disconnect a specific back-end server (via the DMX - Extension), - </para></listitem> - <listitem><para> - reconfigure the XFree86 back-end server resolution, - and - </para></listitem> - <listitem><para> - reconnect the back-end server to DMX -- at a new - origin with the new screen resolution. - </para></listitem> - </itemizedlist> - </para> - <para> - For example, consider a display wall consisting of 16 - 1280x1024 displays with a total resolution of 5120x4096. - All of the screens could be disconnected, repositioned, - and reconnected each at a resolution of 640x480. The - total resolution of the display wall would be 2560x1920, - allowing a view of a selected area approximately - one-fourth of the size of the DMX display. This change - would be completely application independent (except, - perhaps, for a DMX-aware window manager). When work at - the increased resolution was completed, the back-end - servers could be disconnected, reconfigured, and - reconnected for the original 5120x4096 view. - </para> - <para> - Support for this type of scaling can be implemented in a - DMX-aware X11 client assuming the DMX server support - arbitrary disconnect and reconnect semantics. Because - this application cannot be written before - disconnect/reconnect is implemented, this solution will - not be discussed further in this paper. - </para> - </sect3> - <sect3><title>Server-side Scaling</title> - <para> - In earlier versions of DMX, a frame buffer was maintained - on the server side, and XPutImage was used to move the - information from the server to the client (similar to some - early VNC implementations). The use of a server-side - frame buffer would allow the server to do scaling, but is - not a recommended solution because of overall performance - issues and server-side memory issues (i.e., the frame - buffer would be very large for large display walls). - </para> - <para> - Exploration of this path is not recommended. - </para> - </sect3> - </sect2> - <sect2><title>XCreateScaledWindow API</title> - <para> - The implementation of X Video Extension in DMX, and the use - of XvPutImage by applications requiring scaling requires - significant changes in DMX Further, XvPutImage is, - essentially a scaled blit, and it is only useful for - applications which are already using (or can be modified to - use) XPutImage. Therefore, a more general API will be - discussed as another possibility. - </para> - <para> - X applications typically create windows with the - XCreateWindow call. A new extension could provide an - XCreateScaledWindow call that could be used in place of the - XCreateWindow call and be otherwise transparent to the - application. This would allow applications, even those that - do not depend on XPutImage, to take advantage of window - scaling. In this section we describe how the call would - work, what transparency it provides, and how to solve the - potential problems that transparency creates. - </para> - <sect3><title>XCreateWindow</title> - <para> - The XCreateWindow call takes width and height as - parameters. An XCreateScaledWindow call could take all - the same parameters, with the addition of a scaling factor. - </para> - </sect3> - <sect3><title>XSetWindowAttributes</title> - <para> - An X11 window has several attributes that would have to be - scaled: - <itemizedlist> - <listitem><para>Background and border pixmaps</para></listitem> - <listitem><para>Border width</para></listitem> - <listitem><para>Cursor</para></listitem> - </itemizedlist> - </para> - </sect3> - <sect3><title>XGetWindowAttributes, XGetGeometry</title> - <para> - For transparency, calls that query the window attributes - should return unscaled information. This suggests that - all unscaled pixmaps and window attributes should be - cached. - </para> - <para> - Unfortunately, a window manager requires the scaled - geometry to properly decorate the window. The X server - can probably determine which client is acting as the - window manager (e.g., because that client will select - events that are used exclusively by the window manager). - However, other Scaled Window Extension aware clients may - also need to determine the scaled geometry. Therefore, at - least two additional extension calls should be - implemented: XGetScaledWindowAttributes and - XGetScaledGeometry. - </para> - </sect3> - <sect3><title>Popup and Child window positions</title> - <para> - Some applications may position popup and child windows - based on an unscaled notion of the main window geometry. - In this case, additional modifications to the client would - be required. - </para> - </sect3> - <sect3><title>Events</title> - <para> - Most events (e.g., for mouse motion) return information - about the coordinates at which the even occurred. These - coordinates would have to be modified so that unscaled - values were presented to the client. - </para> - </sect3> - <sect3><title>Implementation</title> - <para> - There are many implementation issues, some of which are - similar to the issues involved in implementing the X Video - Extension for DMX. The window contents must be scaled, - either by performing all operations to a frame buffer and - then writing the image to the display (perhaps using - hardware scaling support), or by modifying all of the - various drawing operations to perform scaling. Because of - the complexity involved, the frame buffer option is - recommended. - </para> - </sect3> - </sect2> - </sect1> - - <sect1><title>Conclusion and Recommendations - </title><para> - We recommend a three phase implementation strategy, based on - how an application could be written to take advantage of - scaling: - <orderedlist> - <listitem> - <para> - The XCopyAreaScaled extension should be implemented, since - this is the ideal solution for applications like VNC, and - since making use of this extension will require minimal - changes to applications that already use XPutImage or - XCopyArea. - </para> - <para> - The initial implementation work would include the design - of the X protocol extension, writing this up in the - usual format for extension documentation, implementation - of the protocol transport pieces in XFree86, - implementation of a software fall-back in XFree86 and - DMX, one example hardware implementation for XFree86, - and implementation of support for this extension in DMX. - </para> - <para> - We suggest implementing the extension first on the ATI - Radeon cards. However, since these cards do not provide - a 2D scaled blit primitive, the implementation would - have to make use of the 3D texture engine to emulate a - scaled blit. This is recommended, since other modern - graphics cards also do not provide a simple 2D scaled - blit operation and an example of the more difficult - implementation pathway would be helpful to others. - </para> - </listitem> - <listitem> - <para> - Until XCopyAreaScaled is widely supported, applications - that require scaling will have to fall back to another - scaling method. We suggest OpenGL as the first fall-back - method because it is widely available and supported by - DMX. - </para> - <para> - A project centered around OpenGL-based scaling would - implement this scaling in VNC as an example. This work - would include re-writing the <command>vncviewer</command> - rendering engine to cache a master copy of the desktop - image for all operations. - </para> - </listitem> - <listitem> - <para> - Since OpenGL is not implemented everywhere, and may not - provide hardware-assisted performance in every - implementation, an application that requires scaling - should also fall back to using the X Video Extension. - </para> - <para> - This project would add support for the X Video Extension - to DMX and would add support to VNC to take advantage of - this extension without introducing artifacts. This - would require modifying the <command>vncviewer</command> rendering - engine to cache a master copy of the desktop image for - all operations. This project should also add support - for the RGB format to at least one XFree86 driver (e.g., - ATI Radeon). - </para> - <para> - The X Video Extension is one of the few popular - extensions that DMX does not support. We recommend - implementing the X Video Extension even if scaling is - the specific goal of that work. - </para> - </listitem> - </orderedlist> - </para> - <para> - We do <emphasis>not</emphasis> recommend implementation of the - XCreateScaledWindow extension because of the complexity - involved. We do <emphasis>not</emphasis> recommend implementation of the - XPutImageScaled extension because it requires the same amount - of work as the XCopyAreaScaled extension, but provides less - functionality. Further, server-side scaling with a large - frame buffer is <emphasis>not</emphasis> recommended because of the - performance implications. - </para> - <para> - The back-end scaling, especially with disconnect/reconnect - support should be explored in the future after - disconnect/reconnect is implemented, but not at the present - time. - </para> - </sect1> - - </article> - <!-- Local Variables: --> - <!-- fill-column: 72 --> - <!-- End: --> diff --git a/hw/dmx/doxygen/.gitignore b/hw/dmx/doxygen/.gitignore deleted file mode 100644 index 550262f01..000000000 --- a/hw/dmx/doxygen/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -html/ -doxygen.conf diff --git a/hw/dmx/doxygen/Makefile.am b/hw/dmx/doxygen/Makefile.am deleted file mode 100644 index fe159df5c..000000000 --- a/hw/dmx/doxygen/Makefile.am +++ /dev/null @@ -1,36 +0,0 @@ -# Copyright 2005 Red Hat, Inc. -# -# Permission to use, copy, modify, distribute, and sell this software -# and its documentation for any purpose is hereby granted without -# fee, provided that the above copyright notice appear in all copies -# and that both that copyright notice and this permission notice -# appear in supporting documentation, and that the name of Red Hat -# not be used in advertising or publicity pertaining to distribution -# of the software without specific, written prior permission. Red -# Hat makes no representations about the suitability of this software -# for any purpose. It is provided "as is" without express or implied -# warranty. -# -# RED HAT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN -# NO EVENT SHALL RED HAT 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. - -if ENABLE_DEVEL_DOCS -if HAVE_DOXYGEN - -# Developers documentation is not installed -noinst_DATA = html/index.html -dist_noinst_DATA = doxygen.conf.in footer.html - -html/index.html: - $(AM_V_GEN)$(DOXYGEN) doxygen.conf - -clean-local: - $(AM_V_at)rm -fr html/ - -endif HAVE_DOXYGEN -endif ENABLE_DEVEL_DOCS diff --git a/hw/dmx/doxygen/doxygen.conf.in b/hw/dmx/doxygen/doxygen.conf.in deleted file mode 100644 index d709c9bd1..000000000 --- a/hw/dmx/doxygen/doxygen.conf.in +++ /dev/null @@ -1,2400 +0,0 @@ -# Doxyfile 1.8.10 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project. -# -# All text after a double hash (##) is considered a comment and is placed in -# front of the TAG it is preceding. -# -# All text after a single hash (#) is considered a comment and will be ignored. -# The format is: -# TAG = value [value, ...] -# For lists, items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (\" \"). - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all text -# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv -# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv -# for the list of possible encodings. -# The default value is: UTF-8. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by -# double-quotes, unless you are using Doxywizard) that should identify the -# project for which the documentation is generated. This name is used in the -# title of most generated pages and in a few other places. -# The default value is: My Project. - -PROJECT_NAME = "Distributed Multihead X" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. This -# could be handy for archiving the generated documentation or if some version -# control system is used. - -PROJECT_NUMBER = "@PACKAGE_VERSION@" - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer a -# quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = - -# With the PROJECT_LOGO tag one can specify a logo or an icon that is included -# in the documentation. The maximum height of the logo should not exceed 55 -# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy -# the logo to the output directory. - -PROJECT_LOGO = - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path -# into which the generated documentation will be written. If a relative path is -# entered, it will be relative to the location where doxygen was started. If -# left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub- -# directories (in 2 levels) under the output directory of each output format and -# will distribute the generated files over these directories. Enabling this -# option can be useful when feeding doxygen a huge amount of source files, where -# putting all generated files in the same directory would otherwise causes -# performance problems for the file system. -# The default value is: NO. - -CREATE_SUBDIRS = NO - -# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII -# characters to appear in the names of generated files. If set to NO, non-ASCII -# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode -# U+3044. -# The default value is: NO. - -ALLOW_UNICODE_NAMES = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese, -# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States), -# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian, -# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages), -# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian, -# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian, -# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish, -# Ukrainian and Vietnamese. -# The default value is: English. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member -# descriptions after the members that are listed in the file and class -# documentation (similar to Javadoc). Set to NO to disable this. -# The default value is: YES. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief -# description of a member or function before the detailed description -# -# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. -# The default value is: YES. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator that is -# used to form the text in various listings. Each string in this list, if found -# as the leading text of the brief description, will be stripped from the text -# and the result, after processing the whole list, is used as the annotated -# text. Otherwise, the brief description is used as-is. If left blank, the -# following values are used ($name is automatically replaced with the name of -# the entity):The $name class, The $name widget, The $name file, is, provides, -# specifies, contains, represents, a, an and the. - -ABBREVIATE_BRIEF = - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# doxygen will generate a detailed section even if there is only a brief -# description. -# The default value is: NO. - -ALWAYS_DETAILED_SEC = YES - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. -# The default value is: NO. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path -# before files name in the file list and in the header files. If set to NO the -# shortest path that makes the file name unique will be used -# The default value is: YES. - -FULL_PATH_NAMES = NO - -# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path. -# Stripping is only done if one of the specified strings matches the left-hand -# part of the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the path to -# strip. -# -# Note that you can specify absolute paths here, but also relative paths, which -# will be relative from the directory where doxygen is started. -# This tag requires that the tag FULL_PATH_NAMES is set to YES. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the -# path mentioned in the documentation of a class, which tells the reader which -# header file to include in order to use a class. If left blank only the name of -# the header file containing the class definition is used. Otherwise one should -# specify the list of include paths that are normally passed to the compiler -# using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but -# less readable) file names. This can be useful is your file systems doesn't -# support long names like on DOS, Mac, or CD-ROM. -# The default value is: NO. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the -# first line (until the first dot) of a Javadoc-style comment as the brief -# description. If set to NO, the Javadoc-style will behave just like regular Qt- -# style comments (thus requiring an explicit @brief command for a brief -# description.) -# The default value is: NO. - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first -# line (until the first dot) of a Qt-style comment as the brief description. If -# set to NO, the Qt-style will behave just like regular Qt-style comments (thus -# requiring an explicit \brief command for a brief description.) -# The default value is: NO. - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a -# multi-line C++ special comment block (i.e. a block of //! or /// comments) as -# a brief description. This used to be the default behavior. The new default is -# to treat a multi-line C++ comment block as a detailed description. Set this -# tag to YES if you prefer the old behavior instead. -# -# Note that setting this tag to YES also means that rational rose comments are -# not recognized any more. -# The default value is: NO. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the -# documentation from any documented member that it re-implements. -# The default value is: YES. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new -# page for each member. If set to NO, the documentation of a member will be part -# of the file/class/namespace that contains it. -# The default value is: NO. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen -# uses this value to replace tabs by spaces in code fragments. -# Minimum value: 1, maximum value: 16, default value: 4. - -TAB_SIZE = 8 - -# This tag can be used to specify a number of aliases that act as commands in -# the documentation. An alias has the form: -# name=value -# For example adding -# "sideeffect=@par Side Effects:\n" -# will allow you to put the command \sideeffect (or @sideeffect) in the -# documentation, which will result in a user-defined paragraph with heading -# "Side Effects:". You can put \n's in the value part of an alias to insert -# newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding "class=itcl::class" -# will allow you to use the command class in the itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources -# only. Doxygen will then generate output that is more tailored for C. For -# instance, some of the names that are used will be different. The list of all -# members will be omitted, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or -# Python sources only. Doxygen will then generate output that is more tailored -# for that language. For instance, namespaces will be presented as packages, -# qualified scopes will look different, etc. -# The default value is: NO. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources. Doxygen will then generate output that is tailored for Fortran. -# The default value is: NO. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for VHDL. -# The default value is: NO. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, and -# language is one of the parsers supported by doxygen: IDL, Java, Javascript, -# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran: -# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran: -# Fortran. In the later case the parser tries to guess whether the code is fixed -# or free formatted code, this is the default for Fortran type files), VHDL. For -# instance to make doxygen treat .inc files as Fortran files (default is PHP), -# and .f files as C (default is Fortran), use: inc=Fortran f=C. -# -# Note: For files without extension you can use no_extension as a placeholder. -# -# Note that for custom extensions you also need to set FILE_PATTERNS otherwise -# the files are not read by doxygen. - -EXTENSION_MAPPING = - -# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments -# according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you can -# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in -# case of backward compatibilities issues. -# The default value is: YES. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented -# classes, or namespaces to their corresponding documentation. Such a link can -# be prevented in individual cases by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. -# The default value is: YES. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should set this -# tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); -# versus func(std::string) {}). This also make the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. -# The default value is: NO. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. -# The default value is: NO. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip (see: -# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen -# will parse them like normal C++ but will assume all classes use public instead -# of private inheritance when no explicit protection keyword is present. -# The default value is: NO. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES will make -# doxygen to replace the get and set methods by a property in the documentation. -# This will only work if the methods are indeed getting or setting a simple -# type. If this is not the case, or you want to show the methods anyway, you -# should set this option to NO. -# The default value is: YES. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. -# The default value is: NO. - -DISTRIBUTE_GROUP_DOC = NO - -# If one adds a struct or class to a group and this option is enabled, then also -# any nested class or struct is added to the same group. By default this option -# is disabled and one has to add nested compounds explicitly via \ingroup. -# The default value is: NO. - -GROUP_NESTED_COMPOUNDS = NO - -# Set the SUBGROUPING tag to YES to allow class member groups of the same type -# (for instance a group of public functions) to be put as a subgroup of that -# type (e.g. under the Public Functions section). Set it to NO to prevent -# subgrouping. Alternatively, this can be done per class using the -# \nosubgrouping command. -# The default value is: YES. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions -# are shown inside the group in which they are included (e.g. using \ingroup) -# instead of on a separate page (for HTML and Man pages) or section (for LaTeX -# and RTF). -# -# Note that this feature does not work in combination with -# SEPARATE_MEMBER_PAGES. -# The default value is: NO. - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions -# with only public data fields or simple typedef fields will be shown inline in -# the documentation of the scope in which they are defined (i.e. file, -# namespace, or group documentation), provided this scope is documented. If set -# to NO, structs, classes, and unions are shown on a separate page (for HTML and -# Man pages) or section (for LaTeX and RTF). -# The default value is: NO. - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or -# enum is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically be -# useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. -# The default value is: NO. - -TYPEDEF_HIDES_STRUCT = NO - -# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This -# cache is used to resolve symbols given their name and scope. Since this can be -# an expensive process and often the same symbol appears multiple times in the -# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small -# doxygen will become slower. If the cache is too large, memory is wasted. The -# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range -# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536 -# symbols. At the end of a run doxygen will report the cache usage and suggest -# the optimal cache size from a speed point of view. -# Minimum value: 0, maximum value: 9, default value: 0. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in -# documentation are documented, even if no documentation was available. Private -# class members and static file members will be hidden unless the -# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES. -# Note: This will also disable the warnings about undocumented members that are -# normally produced when WARNINGS is set to YES. -# The default value is: NO. - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will -# be included in the documentation. -# The default value is: NO. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal -# scope will be included in the documentation. -# The default value is: NO. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be -# included in the documentation. -# The default value is: NO. - -EXTRACT_STATIC = YES - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined -# locally in source files will be included in the documentation. If set to NO, -# only classes defined in header files are included. Does not have any effect -# for Java sources. -# The default value is: YES. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. If set to YES, local methods, -# which are defined in the implementation section but not in the interface are -# included in the documentation. If set to NO, only methods in the interface are -# included. -# The default value is: NO. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base name of -# the file that contains the anonymous namespace. By default anonymous namespace -# are hidden. -# The default value is: NO. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all -# undocumented members inside documented classes or files. If set to NO these -# members will be included in the various overviews, but no documentation -# section is generated. This option has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_MEMBERS = YES - -# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. If set -# to NO, these classes will be included in the various overviews. This option -# has no effect if EXTRACT_ALL is enabled. -# The default value is: NO. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend -# (class|struct|union) declarations. If set to NO, these declarations will be -# included in the documentation. -# The default value is: NO. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any -# documentation blocks found inside the body of a function. If set to NO, these -# blocks will be appended to the function's detailed documentation block. -# The default value is: NO. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation that is typed after a -# \internal command is included. If the tag is set to NO then the documentation -# will be excluded. Set it to YES to include the internal documentation. -# The default value is: NO. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file -# names in lower-case letters. If set to YES, upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. -# The default value is: system dependent. - -CASE_SENSE_NAMES = YES - -# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with -# their full class and namespace scopes in the documentation. If set to YES, the -# scope will be hidden. -# The default value is: NO. - -HIDE_SCOPE_NAMES = NO - -# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will -# append additional text to a page's title, such as Class Reference. If set to -# YES the compound reference will be hidden. -# The default value is: NO. - -HIDE_COMPOUND_REFERENCE= NO - -# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of -# the files that are included by a file in the documentation of that file. -# The default value is: YES. - -SHOW_INCLUDE_FILES = YES - -# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each -# grouped member an include statement to the documentation, telling the reader -# which file to include in order to use the member. -# The default value is: NO. - -SHOW_GROUPED_MEMB_INC = NO - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include -# files with double quotes in the documentation rather than with sharp brackets. -# The default value is: NO. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the -# documentation for inline members. -# The default value is: YES. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the -# (detailed) documentation of file and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. -# The default value is: YES. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief -# descriptions of file, namespace and class members alphabetically by member -# name. If set to NO, the members will appear in declaration order. Note that -# this will also influence the order of the classes in the class list. -# The default value is: NO. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the -# (brief and detailed) documentation of class members so that constructors and -# destructors are listed first. If set to NO the constructors will appear in the -# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS. -# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief -# member documentation. -# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting -# detailed member documentation. -# The default value is: NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy -# of group names into alphabetical order. If set to NO the group names will -# appear in their defined order. -# The default value is: NO. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by -# fully-qualified names, including namespaces. If set to NO, the class list will -# be sorted only by class name, not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the alphabetical -# list. -# The default value is: NO. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper -# type resolution of all parameters of a function it will reject a match between -# the prototype and the implementation of a member function even if there is -# only one candidate or it is obvious which candidate to choose by doing a -# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still -# accept a match between prototype and implementation in such cases. -# The default value is: NO. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo -# list. This list is created by putting \todo commands in the documentation. -# The default value is: YES. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test -# list. This list is created by putting \test commands in the documentation. -# The default value is: YES. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug -# list. This list is created by putting \bug commands in the documentation. -# The default value is: YES. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO) -# the deprecated list. This list is created by putting \deprecated commands in -# the documentation. -# The default value is: YES. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional documentation -# sections, marked by \if <section_label> ... \endif and \cond <section_label> -# ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the -# initial value of a variable or macro / define can have for it to appear in the -# documentation. If the initializer consists of more lines than specified here -# it will be hidden. Use a value of 0 to hide initializers completely. The -# appearance of the value of individual variables and macros / defines can be -# controlled using \showinitializer or \hideinitializer command in the -# documentation regardless of this setting. -# Minimum value: 0, maximum value: 10000, default value: 30. - -MAX_INITIALIZER_LINES = 30 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at -# the bottom of the documentation of classes and structs. If set to YES, the -# list will mention the files that were used to generate the documentation. -# The default value is: YES. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This -# will remove the Files entry from the Quick Index and from the Folder Tree View -# (if specified). -# The default value is: YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces -# page. This will remove the Namespaces entry from the Quick Index and from the -# Folder Tree View (if specified). -# The default value is: YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command command input-file, where command is the value of the -# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided -# by doxygen. Whatever the program writes to standard output is used as the file -# version. For an example see the documentation. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. You can -# optionally specify a file name after the option, if omitted DoxygenLayout.xml -# will be used as the name of the layout file. -# -# Note that if you run doxygen from a directory containing a file called -# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE -# tag is left empty. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files containing -# the reference definitions. This must be a list of .bib files. The .bib -# extension is automatically appended if omitted. This requires the bibtex tool -# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info. -# For LaTeX the style of the bibliography can be controlled using -# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the -# search path. See also \cite for info how to create references. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# Configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated to -# standard output by doxygen. If QUIET is set to YES this implies that the -# messages are off. -# The default value is: NO. - -QUIET = YES - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES -# this implies that the warnings are on. -# -# Tip: Turn warnings on while writing the documentation. -# The default value is: YES. - -WARNINGS = YES - -# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate -# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag -# will automatically be disabled. -# The default value is: YES. - -WARN_IF_UNDOCUMENTED = YES - -# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some parameters -# in a documented function, or documenting parameters that don't exist or using -# markup commands wrongly. -# The default value is: YES. - -WARN_IF_DOC_ERROR = YES - -# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that -# are documented, but have no documentation for their parameters or return -# value. If set to NO, doxygen will only warn about wrong or incomplete -# parameter documentation, but not about the absence of documentation. -# The default value is: NO. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that doxygen -# can produce. The string should contain the $file, $line, and $text tags, which -# will be replaced by the file and line number from which the warning originated -# and the warning text. Optionally the format may contain $version, which will -# be replaced by the version of the file (if it could be obtained via -# FILE_VERSION_FILTER) -# The default value is: $file:$line: $text. - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning and error -# messages should be written. If left blank the output is written to standard -# error (stderr). - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# Configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag is used to specify the files and/or directories that contain -# documented source files. You may enter file names like myfile.cpp or -# directories like /usr/src/myproject. Separate the files or directories with -# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING -# Note: If this tag is empty the current directory is searched. - -INPUT = @srcdir@/.. \ - @srcdir@/../input \ - @srcdir@/../config - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses -# libiconv (or the iconv built into libc) for the transcoding. See the libiconv -# documentation (see: http://www.gnu.org/software/libiconv) for the list of -# possible encodings. -# The default value is: UTF-8. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and -# *.h) to filter out the source-files in the directories. -# -# Note that for custom extensions or not directly supported extensions you also -# need to set EXTENSION_MAPPING for the extension otherwise the files are not -# read by doxygen. -# -# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp, -# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h, -# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc, -# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.f90, *.f, *.for, *.tcl, *.vhd, -# *.vhdl, *.ucf, *.qsf, *.as and *.js. - -FILE_PATTERNS = - -# The RECURSIVE tag can be used to specify whether or not subdirectories should -# be searched for input files as well. -# The default value is: NO. - -RECURSIVE = NO - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = @srcdir@/../config/parser.c \ - @srcdir@/../config/parser.h \ - @srcdir@/../config/scanner.c - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. -# The default value is: NO. - -EXCLUDE_SYMLINKS = YES - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories for example use the pattern */test/* - -EXCLUDE_PATTERNS = atKeynames.h \ - Canvas*.* - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test -# -# Note that the wildcards are matched against the file with absolute path, so to -# exclude all test directories use the pattern */test/* - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or directories -# that contain example code fragments that are included (see the \include -# command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and -# *.h) to filter out the source-files in the directories. If left blank all -# files are included. - -EXAMPLE_PATTERNS = - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude commands -# irrespective of the value of the RECURSIVE tag. -# The default value is: NO. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or directories -# that contain images that are to be included in the documentation (see the -# \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command: -# -# <filter> <input-file> -# -# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the -# name of an input file. Doxygen will then use the output that the filter -# program writes to standard output. If FILTER_PATTERNS is specified, this tag -# will be ignored. -# -# Note that the filter must not add or remove lines; it is applied before the -# code is scanned, but not when the output code is generated. If lines are added -# or removed, the anchors will not be placed correctly. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: pattern=filter -# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how -# filters are used. If the FILTER_PATTERNS tag is empty or if none of the -# patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will also be used to filter the input files that are used for -# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES). -# The default value is: NO. - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and -# it is also possible to disable source filtering for a specific pattern using -# *.ext= (so without naming a filter). -# This tag requires that the tag FILTER_SOURCE_FILES is set to YES. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page -# (index.html). This can be useful if you have a project on for instance GitHub -# and want to reuse the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# Configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will be -# generated. Documented entities will be cross-referenced with these sources. -# -# Note: To get rid of all source code in the generated output, make sure that -# also VERBATIM_HEADERS is set to NO. -# The default value is: NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body of functions, -# classes and enums directly into the documentation. -# The default value is: NO. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any -# special comment blocks from generated source code fragments. Normal C, C++ and -# Fortran comments will always remain visible. -# The default value is: YES. - -STRIP_CODE_COMMENTS = YES - -# If the REFERENCED_BY_RELATION tag is set to YES then for each documented -# function all documented functions referencing it will be listed. -# The default value is: NO. - -REFERENCED_BY_RELATION = YES - -# If the REFERENCES_RELATION tag is set to YES then for each documented function -# all documented entities called/used by that function will be listed. -# The default value is: NO. - -REFERENCES_RELATION = YES - -# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set -# to YES then the hyperlinks from functions in REFERENCES_RELATION and -# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will -# link to the documentation. -# The default value is: YES. - -REFERENCES_LINK_SOURCE = YES - -# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the -# source code will show a tooltip with additional information such as prototype, -# brief description and links to the definition and documentation. Since this -# will make the HTML file larger and loading of large files a bit slower, you -# can opt to disable this feature. -# The default value is: YES. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -SOURCE_TOOLTIPS = YES - -# If the USE_HTAGS tag is set to YES then the references to source code will -# point to the HTML generated by the htags(1) tool instead of doxygen built-in -# source browser. The htags tool is part of GNU's global source tagging system -# (see http://www.gnu.org/software/global/global.html). You will need version -# 4.8.6 or higher. -# -# To use it do the following: -# - Install the latest version of global -# - Enable SOURCE_BROWSER and USE_HTAGS in the config file -# - Make sure the INPUT points to the root of the source tree -# - Run doxygen as normal -# -# Doxygen will invoke htags (and that will in turn invoke gtags), so these -# tools must be available from the command line (i.e. in the search path). -# -# The result: instead of the source browser generated by doxygen, the links to -# source code will now point to the output of htags. -# The default value is: NO. -# This tag requires that the tag SOURCE_BROWSER is set to YES. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a -# verbatim copy of the header file for each class for which an include is -# specified. Set to NO to disable this. -# See also: Section \class. -# The default value is: YES. - -VERBATIM_HEADERS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all -# compounds will be generated. Enable this if the project contains a lot of -# classes, structs, unions or interfaces. -# The default value is: YES. - -ALPHABETICAL_INDEX = YES - -# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in -# which the alphabetical index list will be split. -# Minimum value: 1, maximum value: 20, default value: 5. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all classes will -# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag -# can be used to specify a prefix (or a list of prefixes) that should be ignored -# while generating the index headers. -# This tag requires that the tag ALPHABETICAL_INDEX is set to YES. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output -# The default value is: YES. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_OUTPUT = html - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each -# generated HTML page (for example: .htm, .php, .asp). -# The default value is: .html. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a user-defined HTML header file for -# each generated HTML page. If the tag is left blank doxygen will generate a -# standard header. -# -# To get valid HTML the header file that includes any scripts and style sheets -# that doxygen needs, which is dependent on the configuration options used (e.g. -# the setting GENERATE_TREEVIEW). It is highly recommended to start with a -# default header using -# doxygen -w html new_header.html new_footer.html new_stylesheet.css -# YourConfigFile -# and then modify the file new_header.html. See also section "Doxygen usage" -# for information on how to generate the default header that doxygen normally -# uses. -# Note: The header is subject to change so you typically have to regenerate the -# default header when upgrading to a newer version of doxygen. For a description -# of the possible markers and block names see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_HEADER = - -# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each -# generated HTML page. If the tag is left blank doxygen will generate a standard -# footer. See HTML_HEADER for more information on how to generate a default -# footer and what special commands can be used inside the footer. See also -# section "Doxygen usage" for information on how to generate the default footer -# that doxygen normally uses. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_FOOTER = @srcdir@/footer.html - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style -# sheet that is used by each HTML page. It can be used to fine-tune the look of -# the HTML output. If left blank doxygen will generate a default style sheet. -# See also section "Doxygen usage" for information on how to generate the style -# sheet that doxygen normally uses. -# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as -# it is more robust and this tag (HTML_STYLESHEET) will in the future become -# obsolete. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# cascading style sheets that are included after the standard style sheets -# created by doxygen. Using this option one can overrule certain style aspects. -# This is preferred over using HTML_STYLESHEET since it does not replace the -# standard style sheet and is therefore more robust against future updates. -# Doxygen will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). For an example see the documentation. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that the -# files will be copied as-is; there are no commands or markers available. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen -# will adjust the colors in the style sheet and background images according to -# this color. Hue is specified as an angle on a colorwheel, see -# http://en.wikipedia.org/wiki/Hue for more information. For instance the value -# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300 -# purple, and 360 is red again. -# Minimum value: 0, maximum value: 359, default value: 220. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors -# in the HTML output. For a value of 0 the output will use grayscales only. A -# value of 255 will produce the most vivid colors. -# Minimum value: 0, maximum value: 255, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_SAT = 100 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the -# luminance component of the colors in the HTML output. Values below 100 -# gradually make the output lighter, whereas values above 100 make the output -# darker. The value divided by 100 is the actual gamma applied, so 80 represents -# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not -# change the gamma. -# Minimum value: 40, maximum value: 240, default value: 80. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting this -# to YES can help to show when doxygen was last run and thus if the -# documentation is up to date. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_TIMESTAMP = NO - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries -# shown in the various tree structured indices initially; the user can expand -# and collapse entries dynamically later on. Doxygen will expand the tree to -# such a level that at most the specified number of entries are visible (unless -# a fully collapsed tree already exceeds this amount). So setting the number of -# entries 1 will produce a full collapsed tree by default. 0 is a special value -# representing an infinite number of entries and will result in a full expanded -# tree by default. -# Minimum value: 0, maximum value: 9999, default value: 100. -# This tag requires that the tag GENERATE_HTML is set to YES. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files will be -# generated that can be used as input for Apple's Xcode 3 integrated development -# environment (see: http://developer.apple.com/tools/xcode/), introduced with -# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a -# Makefile in the HTML output directory. Running make will produce the docset in -# that directory and running make install will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at -# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_DOCSET = NO - -# This tag determines the name of the docset feed. A documentation feed provides -# an umbrella under which multiple documentation sets from a single provider -# (such as a company or product suite) can be grouped. -# The default value is: Doxygen generated docs. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# This tag specifies a string that should uniquely identify the documentation -# set bundle. This should be a reverse domain-name style string, e.g. -# com.mycompany.MyDocSet. Doxygen will append .docset to the name. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify -# the documentation publisher. This should be a reverse domain-name style -# string, e.g. com.mycompany.MyDocSet.documentation. -# The default value is: org.doxygen.Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher. -# The default value is: Publisher. -# This tag requires that the tag GENERATE_DOCSET is set to YES. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three -# additional HTML index files: index.hhp, index.hhc, and index.hhk. The -# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop -# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on -# Windows. -# -# The HTML Help Workshop contains a compiler that can convert all HTML output -# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML -# files are now used as the Windows 98 help format, and will replace the old -# Windows help format (.hlp) on all Windows platforms in the future. Compressed -# HTML files also contain an index, a table of contents, and you can search for -# words in the documentation. The HTML workshop also contains a viewer for -# compressed HTML files. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_HTMLHELP = NO - -# The CHM_FILE tag can be used to specify the file name of the resulting .chm -# file. You can add a path in front of the file if the result should not be -# written to the html output directory. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_FILE = - -# The HHC_LOCATION tag can be used to specify the location (absolute path -# including file name) of the HTML help compiler (hhc.exe). If non-empty, -# doxygen will try to run the HTML help compiler on the generated index.hhp. -# The file has to be specified with full path. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -HHC_LOCATION = - -# The GENERATE_CHI flag controls if a separate .chi index file is generated -# (YES) or that it should be included in the master .chm file (NO). -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -GENERATE_CHI = NO - -# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc) -# and project file content. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -CHM_INDEX_ENCODING = - -# The BINARY_TOC flag controls whether a binary table of contents is generated -# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it -# enables the Previous and Next buttons. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members to -# the table of contents of the HTML help documentation and to the tree view. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTMLHELP is set to YES. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that -# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help -# (.qch) of the generated HTML documentation. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify -# the file name of the resulting .qch file. The path specified is relative to -# the HTML output folder. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help -# Project output. For more information please see Qt Help Project / Namespace -# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace). -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt -# Help Project output. For more information please see Qt Help Project / Virtual -# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual- -# folders). -# The default value is: doc. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_VIRTUAL_FOLDER = doc - -# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom -# filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see Qt Help Project / Custom -# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom- -# filters). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's filter section matches. Qt Help Project / Filter Attributes (see: -# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes). -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHP_SECT_FILTER_ATTRS = - -# The QHG_LOCATION tag can be used to specify the location of Qt's -# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the -# generated .qhp file. -# This tag requires that the tag GENERATE_QHP is set to YES. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be -# generated, together with the HTML files, they form an Eclipse help plugin. To -# install this plugin and make it available under the help contents menu in -# Eclipse, the contents of the directory containing the HTML and XML files needs -# to be copied into the plugins directory of eclipse. The name of the directory -# within the plugins directory should be the same as the ECLIPSE_DOC_ID value. -# After copying Eclipse needs to be restarted before the help appears. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the Eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have this -# name. Each documentation set should have its own identifier. -# The default value is: org.doxygen.Project. -# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# If you want full control over the layout of the generated HTML pages it might -# be necessary to disable the index and replace it with your own. The -# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top -# of each HTML page. A value of NO enables the index and the value YES disables -# it. Since the tabs in the index contain the same information as the navigation -# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -DISABLE_INDEX = NO - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. If the tag -# value is set to YES, a side panel will be generated containing a tree-like -# index structure (just like the one that is generated for HTML Help). For this -# to work a browser that supports JavaScript, DHTML, CSS and frames is required -# (i.e. any modern browser). Windows users are probably better off using the -# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can -# further fine-tune the look of the index. As an example, the default style -# sheet generated by doxygen has an example that shows how to put an image at -# the root of the tree instead of the PROJECT_NAME. Since the tree basically has -# the same information as the tab index, you could consider setting -# DISABLE_INDEX to YES when enabling this option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -GENERATE_TREEVIEW = YES - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that -# doxygen will group on one line in the generated HTML documentation. -# -# Note that a value of 0 will completely suppress the enum values from appearing -# in the overview section. -# Minimum value: 0, maximum value: 20, default value: 4. -# This tag requires that the tag GENERATE_HTML is set to YES. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used -# to set the initial width (in pixels) of the frame in which the tree is shown. -# Minimum value: 0, maximum value: 1500, default value: 250. -# This tag requires that the tag GENERATE_HTML is set to YES. - -TREEVIEW_WIDTH = 250 - -# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to -# external symbols imported via tag files in a separate window. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of LaTeX formulas included as images in -# the HTML documentation. When you change the font size after a successful -# doxygen run you need to manually remove any form_*.png images from the HTML -# output directory to force them to be regenerated. -# Minimum value: 8, maximum value: 50, default value: 10. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are not -# supported properly for IE 6.0, but are supported on all modern browsers. -# -# Note that when changing this option you need to delete any form_*.png files in -# the HTML output directory before the changes have effect. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see -# http://www.mathjax.org) which uses client side Javascript for the rendering -# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX -# installed or if you want to formulas look prettier in the HTML output. When -# enabled you may also need to install MathJax separately and configure the path -# to it using the MATHJAX_RELPATH option. -# The default value is: NO. -# This tag requires that the tag GENERATE_HTML is set to YES. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# the MathJax output. See the MathJax site (see: -# http://docs.mathjax.org/en/latest/output.html) for more details. -# Possible values are: HTML-CSS (which is slower, but has the best -# compatibility), NativeMML (i.e. MathML) and SVG. -# The default value is: HTML-CSS. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the HTML -# output directory using the MATHJAX_RELPATH option. The destination directory -# should contain the MathJax.js script. For instance, if the mathjax directory -# is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax -# Content Delivery Network so you can quickly see the result without installing -# MathJax. However, it is strongly recommended to install a local copy of -# MathJax from http://www.mathjax.org before deployment. -# The default value is: http://cdn.mathjax.org/mathjax/latest. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax -# extension names that should be enabled during MathJax rendering. For example -# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_EXTENSIONS = - -# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces -# of code that will be used on startup of the MathJax code. See the MathJax site -# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an -# example see the documentation. -# This tag requires that the tag USE_MATHJAX is set to YES. - -MATHJAX_CODEFILE = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box for -# the HTML output. The underlying search engine uses javascript and DHTML and -# should work on any modern browser. Note that when using HTML help -# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET) -# there is already a search function so this one should typically be disabled. -# For large projects the javascript based search engine can be slow, then -# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to -# search using the keyboard; to jump to the search box use <access key> + S -# (what the <access key> is depends on the OS and browser, but it is typically -# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down -# key> to jump into the search results window, the results can be navigated -# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel -# the search. The filter options can be selected when the cursor is inside the -# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys> -# to select a filter and <Enter> or <escape> to activate or cancel the filter -# option. -# The default value is: YES. -# This tag requires that the tag GENERATE_HTML is set to YES. - -SEARCHENGINE = NO - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. There -# are two flavors of web server based searching depending on the EXTERNAL_SEARCH -# setting. When disabled, doxygen will generate a PHP script for searching and -# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing -# and searching needs to be provided by external tools. See the section -# "External Indexing and Searching" for details. -# The default value is: NO. -# This tag requires that the tag SEARCHENGINE is set to YES. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain the -# search results. -# -# Doxygen ships with an example indexer (doxyindexer) and search engine -# (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). -# -# See the section "External Indexing and Searching" for details. -# The default value is: NO. -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will return the search results when EXTERNAL_SEARCH is enabled. -# -# Doxygen ships with an example indexer (doxyindexer) and search engine -# (doxysearch.cgi) which are based on the open source search engine library -# Xapian (see: http://xapian.org/). See the section "External Indexing and -# Searching" for details. -# This tag requires that the tag SEARCHENGINE is set to YES. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. -# The default file is: searchdata.xml. -# This tag requires that the tag SEARCHENGINE is set to YES. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of -# to a relative location where the documentation can be found. The format is: -# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ... -# This tag requires that the tag SEARCHENGINE is set to YES. - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# Configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output. -# The default value is: YES. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: latex. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. -# -# Note that when enabling USE_PDFLATEX this option is only used for generating -# bitmaps for formulas in the HTML output, but not in the Makefile that is -# written to the output directory. -# The default file is: latex. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate -# index for LaTeX. -# The default file is: makeindex. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX -# documents. This may be useful for small projects and may help to save some -# trees in general. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used by the -# printer. -# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x -# 14 inches) and executive (7.25 x 10.5 inches). -# The default value is: a4. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -PAPER_TYPE = a4wide - -# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names -# that should be included in the LaTeX output. The package can be specified just -# by its name or with the correct syntax as to be used with the LaTeX -# \usepackage command. To get the times font for instance you can specify : -# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times} -# To use the option intlimits with the amsmath package you can specify: -# EXTRA_PACKAGES=[intlimits]{amsmath} -# If left blank no extra packages will be included. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the -# generated LaTeX document. The header should contain everything until the first -# chapter. If it is left blank doxygen will generate a standard header. See -# section "Doxygen usage" for information on how to let doxygen write the -# default header to a separate file. -# -# Note: Only use a user-defined header if you know what you are doing! The -# following commands have a special meaning inside the header: $title, -# $datetime, $date, $doxygenversion, $projectname, $projectnumber, -# $projectbrief, $projectlogo. Doxygen will replace $title with the empty -# string, for the replacement values of the other commands the user is referred -# to HTML_HEADER. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the -# generated LaTeX document. The footer should contain everything after the last -# chapter. If it is left blank doxygen will generate a standard footer. See -# LATEX_HEADER for more information on how to generate a default footer and what -# special commands can be used inside the footer. -# -# Note: Only use a user-defined footer if you know what you are doing! -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_FOOTER = - -# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined -# LaTeX style sheets that are included after the standard style sheets created -# by doxygen. Using this option one can overrule certain style aspects. Doxygen -# will copy the style sheet files to the output directory. -# Note: The order of the extra style sheet files is of importance (e.g. the last -# style sheet in the list overrules the setting of the previous ones in the -# list). -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_EXTRA_STYLESHEET = - -# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the LATEX_OUTPUT output -# directory. Note that the files will be copied as-is; there are no commands or -# markers available. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_EXTRA_FILES = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is -# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will -# contain links (just like the HTML output) instead of page references. This -# makes the output suitable for online browsing using a PDF viewer. -# The default value is: YES. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -PDF_HYPERLINKS = NO - -# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate -# the PDF file directly from the LaTeX files. Set this option to YES, to get a -# higher quality PDF documentation. -# The default value is: YES. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -USE_PDFLATEX = NO - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode -# command to the generated LaTeX files. This will instruct LaTeX to keep running -# if errors occur, instead of asking the user for help. This option is also used -# when generating formulas in HTML. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_BATCHMODE = NO - -# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the -# index chapters (such as File Index, Compound Index, etc.) in the output. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_HIDE_INDICES = NO - -# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source -# code with syntax highlighting in the LaTeX output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. See -# http://en.wikipedia.org/wiki/BibTeX and \cite for more info. -# The default value is: plain. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_BIB_STYLE = plain - -# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated -# page will contain the date and time when the page was generated. Setting this -# to NO can help when comparing the output of multiple runs. -# The default value is: NO. -# This tag requires that the tag GENERATE_LATEX is set to YES. - -LATEX_TIMESTAMP = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The -# RTF output is optimized for Word 97 and may not look too pretty with other RTF -# readers/editors. -# The default value is: NO. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: rtf. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF -# documents. This may be useful for small projects and may help to save some -# trees in general. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will -# contain hyperlink fields. The RTF file will contain links (just like the HTML -# output) instead of page references. This makes the output suitable for online -# browsing using Word or some other Word compatible readers that support those -# fields. -# -# Note: WordPad (write) and others do not support links. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_HYPERLINKS = NO - -# Load stylesheet definitions from file. Syntax is similar to doxygen's config -# file, i.e. a series of assignments. You only have to provide replacements, -# missing definitions are set to their default value. -# -# See also section "Doxygen usage" for information on how to generate the -# default style sheet that doxygen normally uses. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an RTF document. Syntax is -# similar to doxygen's config file. A template extensions file can be generated -# using doxygen -e rtf extensionFile. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_EXTENSIONS_FILE = - -# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code -# with syntax highlighting in the RTF output. -# -# Note that which sources are shown also depends on other settings such as -# SOURCE_BROWSER. -# The default value is: NO. -# This tag requires that the tag GENERATE_RTF is set to YES. - -RTF_SOURCE_CODE = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for -# classes and files. -# The default value is: NO. - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. A directory man3 will be created inside the directory specified by -# MAN_OUTPUT. -# The default directory is: man. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to the generated -# man pages. In case the manual section does not start with a number, the number -# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is -# optional. -# The default value is: .3. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_EXTENSION = .3 - -# The MAN_SUBDIR tag determines the name of the directory created within -# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by -# MAN_EXTENSION with the initial . removed. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_SUBDIR = - -# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it -# will generate one additional man file for each entity documented in the real -# man page(s). These additional files only source the real man page, but without -# them the man command would be unable to find the correct page. -# The default value is: NO. -# This tag requires that the tag GENERATE_MAN is set to YES. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that -# captures the structure of the code including all documentation. -# The default value is: NO. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a -# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of -# it. -# The default directory is: xml. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_OUTPUT = xml - -# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program -# listings (including syntax highlighting and cross-referencing information) to -# the XML output. Note that enabling this will significantly increase the size -# of the XML output. -# The default value is: YES. -# This tag requires that the tag GENERATE_XML is set to YES. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# Configuration options related to the DOCBOOK output -#--------------------------------------------------------------------------- - -# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files -# that can be used to generate PDF. -# The default value is: NO. - -GENERATE_DOCBOOK = NO - -# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in -# front of it. -# The default directory is: docbook. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_OUTPUT = docbook - -# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the -# program listings (including syntax highlighting and cross-referencing -# information) to the DOCBOOK output. Note that enabling this will significantly -# increase the size of the DOCBOOK output. -# The default value is: NO. -# This tag requires that the tag GENERATE_DOCBOOK is set to YES. - -DOCBOOK_PROGRAMLISTING = NO - -#--------------------------------------------------------------------------- -# Configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an -# AutoGen Definitions (see http://autogen.sf.net) file that captures the -# structure of the code including all documentation. Note that this feature is -# still experimental and incomplete at the moment. -# The default value is: NO. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# Configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module -# file that captures the structure of the code including all documentation. -# -# Note that this feature is still experimental and incomplete at the moment. -# The default value is: NO. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary -# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI -# output from the Perl module output. -# The default value is: NO. -# This tag requires that the tag GENERATE_PERLMOD is set to YES. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely -# formatted so it can be parsed by a human reader. This is useful if you want to -# understand what is going on. On the other hand, if this tag is set to NO, the -# size of the Perl module output will be much smaller and Perl will parse it -# just the same. -# The default value is: YES. -# This tag requires that the tag GENERATE_PERLMOD is set to YES. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file are -# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful -# so different doxyrules.make files included by the same Makefile don't -# overwrite each other's variables. -# This tag requires that the tag GENERATE_PERLMOD is set to YES. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all -# C-preprocessor directives found in the sources and include files. -# The default value is: YES. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names -# in the source code. If set to NO, only conditional compilation will be -# performed. Macro expansion can be done in a controlled way by setting -# EXPAND_ONLY_PREDEF to YES. -# The default value is: NO. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then -# the macro expansion is limited to the macros specified with the PREDEFINED and -# EXPAND_AS_DEFINED tags. -# The default value is: NO. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES, the include files in the -# INCLUDE_PATH will be searched if a #include is found. -# The default value is: YES. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by the -# preprocessor. -# This tag requires that the tag SEARCH_INCLUDES is set to YES. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will be -# used. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that are -# defined before the preprocessor is started (similar to the -D option of e.g. -# gcc). The argument of the tag is a list of macros of the form: name or -# name=definition (no spaces). If the definition and the "=" are omitted, "=1" -# is assumed. To prevent a macro definition from being undefined via #undef or -# recursively expanded use the := operator instead of the = operator. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -PREDEFINED = SHAPE \ - RENDER \ - XKB \ - XINPUT - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this -# tag can be used to specify a list of macro names that should be expanded. The -# macro definition that is found in the sources will be used. Use the PREDEFINED -# tag if you want to use a different macro definition that overrules the -# definition found in the source code. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will -# remove all references to function-like macros that are alone on a line, have -# an all uppercase name, and do not end with a semicolon. Such function macros -# are typically used for boiler-plate code, and will confuse the parser if not -# removed. -# The default value is: YES. -# This tag requires that the tag ENABLE_PREPROCESSING is set to YES. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration options related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES tag can be used to specify one or more tag files. For each tag -# file the location of the external documentation should be added. The format of -# a tag file without this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where loc1 and loc2 can be relative or absolute paths or URLs. See the -# section "Linking to external documentation" for more information about the use -# of tag files. -# Note: Each tag file must have a unique name (where the name does NOT include -# the path). If a tag file is not located in the directory in which doxygen is -# run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create a -# tag file that is based on the input files it reads. See section "Linking to -# external documentation" for more information about the usage of tag files. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES, all external class will be listed in -# the class index. If set to NO, only the inherited external classes will be -# listed. -# The default value is: NO. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will be -# listed. -# The default value is: YES. - -EXTERNAL_GROUPS = YES - -# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in -# the related pages index. If set to NO, only the current project's pages will -# be listed. -# The default value is: YES. - -EXTERNAL_PAGES = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of 'which perl'). -# The default file (with absolute path) is: /usr/bin/perl. - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram -# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to -# NO turns the diagrams off. Note that this option also works with HAVE_DOT -# disabled, but it is recommended to install and use dot, since it yields more -# powerful graphs. -# The default value is: YES. - -CLASS_DIAGRAMS = YES - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see: -# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# You can include diagrams made with dia in doxygen documentation. Doxygen will -# then run dia to produce the diagram and insert it in the documentation. The -# DIA_PATH tag allows you to specify the directory where the dia binary resides. -# If left empty dia is assumed to be found in the default search path. - -DIA_PATH = - -# If set to YES the inheritance and collaboration graphs will hide inheritance -# and usage relations if the target is undocumented or is not a class. -# The default value is: YES. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz (see: -# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent -# Bell Labs. The other options in this section have no effect if this option is -# set to NO -# The default value is: NO. - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed -# to run in parallel. When set to 0 doxygen will base this on the number of -# processors available in the system. You can set it explicitly to a value -# larger than 0 to get control over the balance between CPU load and processing -# speed. -# Minimum value: 0, maximum value: 32, default value: 0. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_NUM_THREADS = 0 - -# When you want a differently looking font in the dot files that doxygen -# generates you can specify the font name using DOT_FONTNAME. You need to make -# sure dot is able to find the font, which can be done by putting it in a -# standard location or by setting the DOTFONTPATH environment variable or by -# setting DOT_FONTPATH to the directory containing the font. -# The default value is: Helvetica. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of -# dot graphs. -# Minimum value: 4, maximum value: 24, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the default font as specified with -# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set -# the path where dot can find it using this tag. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_FONTPATH = - -# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for -# each documented class showing the direct and indirect inheritance relations. -# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a -# graph for each documented class showing the direct and indirect implementation -# dependencies (inheritance, containment, and class references variables) of the -# class with other documented classes. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for -# groups, showing the direct groups dependencies. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside the -# class node. If there are many fields or methods and many nodes the graph may -# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the -# number of items for each type to make the size more manageable. Set this to 0 -# for no limit. Note that the threshold may be exceeded by 50% before the limit -# is enforced. So when you set the threshold to 10, up to 15 fields may appear, -# but if the number exceeds 15, the total amount of fields shown is limited to -# 10. -# Minimum value: 0, maximum value: 100, default value: 10. -# This tag requires that the tag HAVE_DOT is set to YES. - -UML_LIMIT_NUM_FIELDS = 10 - -# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and -# collaboration graphs will show the relations between templates and their -# instances. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -TEMPLATE_RELATIONS = YES - -# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to -# YES then doxygen will generate a graph for each documented file showing the -# direct and indirect include dependencies of the file with other documented -# files. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -INCLUDE_GRAPH = YES - -# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are -# set to YES then doxygen will generate a graph for each documented file showing -# the direct and indirect include dependencies of the file with other documented -# files. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH tag is set to YES then doxygen will generate a call -# dependency graph for every global function or class method. -# -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable call graphs for selected -# functions only using the \callgraph command. Disabling a call graph can be -# accomplished by means of the command \hidecallgraph. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller -# dependency graph for every global function or class method. -# -# Note that enabling this option will significantly increase the time of a run. -# So in most cases it will be better to enable caller graphs for selected -# functions only using the \callergraph command. Disabling a caller graph can be -# accomplished by means of the command \hidecallergraph. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical -# hierarchy of all classes instead of a textual one. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the -# dependencies a directory has on other directories in a graphical way. The -# dependency relations are determined by the #include relations between the -# files in the directories. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. For an explanation of the image formats see the section -# output formats in the documentation of the dot tool (Graphviz (see: -# http://www.graphviz.org/)). -# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order -# to make the SVG files visible in IE 9+ (other browsers do not have this -# requirement). -# Possible values are: png, jpg, gif, svg, png:gd, png:gd:gd, png:cairo, -# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and -# png:gdiplus:gdiplus. -# The default value is: png. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_IMAGE_FORMAT = gif - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# -# Note that this requires a modern browser other than Internet Explorer. Tested -# and working are Firefox, Chrome, Safari, and Opera. -# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make -# the SVG files visible. Older versions of IE do not have SVG support. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -INTERACTIVE_SVG = NO - -# The DOT_PATH tag can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the \dotfile -# command). -# This tag requires that the tag HAVE_DOT is set to YES. - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the \mscfile -# command). - -MSCFILE_DIRS = - -# The DIAFILE_DIRS tag can be used to specify one or more directories that -# contain dia files that are included in the documentation (see the \diafile -# command). - -DIAFILE_DIRS = - -# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the -# path where java can find the plantuml.jar file. If left blank, it is assumed -# PlantUML is not used or called during a preprocessing step. Doxygen will -# generate a warning when it encounters a \startuml command in this case and -# will not generate output for the diagram. - -PLANTUML_JAR_PATH = - -# When using plantuml, the specified paths are searched for files specified by -# the !include statement in a plantuml block. - -PLANTUML_INCLUDE_PATH = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes -# that will be shown in the graph. If the number of nodes in a graph becomes -# larger than this value, doxygen will truncate the graph, which is visualized -# by representing a node as a red box. Note that doxygen if the number of direct -# children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that -# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. -# Minimum value: 0, maximum value: 10000, default value: 50. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs -# generated by dot. A depth value of 3 means that only nodes reachable from the -# root by following a path via at most 3 edges will be shown. Nodes that lay -# further from the root node will be omitted. Note that setting this option to 1 -# or 2 may greatly reduce the computation time needed for large code bases. Also -# note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. -# Minimum value: 0, maximum value: 1000, default value: 0. -# This tag requires that the tag HAVE_DOT is set to YES. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not seem -# to support this out of the box. -# -# Warning: Depending on the platform used, enabling this option may lead to -# badly anti-aliased labels on the edges of a graph (i.e. they become hard to -# read). -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) support -# this, this feature is disabled by default. -# The default value is: NO. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_MULTI_TARGETS = YES - -# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page -# explaining the meaning of the various boxes and arrows in the dot generated -# graphs. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot -# files that are used to generate the various graphs. -# The default value is: YES. -# This tag requires that the tag HAVE_DOT is set to YES. - -DOT_CLEANUP = YES diff --git a/hw/dmx/doxygen/footer.html b/hw/dmx/doxygen/footer.html deleted file mode 100644 index f80dc8269..000000000 --- a/hw/dmx/doxygen/footer.html +++ /dev/null @@ -1,4 +0,0 @@ -<hr size="1"/><address style="text-align: right;"><small> -Generated on $datetime for $projectname by <a href="http://www.doxygen.org/index.html"><img class="footer" src="doxygen.png" alt="doxygen"/></a> $doxygenversion</small></address> -</body> -</html> diff --git a/hw/dmx/examples/.gitignore b/hw/dmx/examples/.gitignore deleted file mode 100644 index 9f32fa7df..000000000 --- a/hw/dmx/examples/.gitignore +++ /dev/null @@ -1,17 +0,0 @@ -# Add & Override for this directory and its subdirectories -dmxaddinput -dmxaddscreen -dmxinfo -dmxreconfig -dmxresize -dmxrminput -dmxrmscreen -dmxwininfo -ev -evi -res -xbell -xinput -xled -xtest - diff --git a/hw/dmx/examples/Makefile.am b/hw/dmx/examples/Makefile.am deleted file mode 100644 index d055ddc71..000000000 --- a/hw/dmx/examples/Makefile.am +++ /dev/null @@ -1,70 +0,0 @@ -if DMX_BUILD_USB -# Requires <linux/input.h> -EV_PROG = ev -endif - -bin_PROGRAMS = \ - dmxinfo dmxwininfo dmxreconfig dmxresize \ - dmxaddscreen dmxrmscreen \ - dmxaddinput dmxrminput -noinst_PROGRAMS = xinput xtest evi res xled xbell $(EV_PROG) - -dmxinfo_SOURCES = dmxinfo.c -dmxinfo_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxinfo_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxwininfo_SOURCES = dmxwininfo.c -dmxwininfo_LDADD = $(DMXXMUEXAMPLES_DEP_LIBS) -dmxwininfo_CFLAGS = $(DMXXMUEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxreconfig_SOURCES = dmxreconfig.c -dmxreconfig_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxreconfig_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxresize_SOURCES = dmxresize.c -dmxresize_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxresize_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxaddscreen_SOURCES = dmxaddscreen.c -dmxaddscreen_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxaddscreen_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxrmscreen_SOURCES = dmxrmscreen.c -dmxrmscreen_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxrmscreen_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxaddinput_SOURCES = dmxaddinput.c -dmxaddinput_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxaddinput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -dmxrminput_SOURCES = dmxrminput.c -dmxrminput_LDADD = $(DMXEXAMPLES_DEP_LIBS) -dmxrminput_CFLAGS = $(DMXEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -xinput_SOURCES = xinput.c -xinput_LDADD = $(DMXXIEXAMPLES_DEP_LIBS) -xinput_CFLAGS = $(DMXXIEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -xtest_SOURCES = xtest.c -xtest_LDADD = $(XTSTEXAMPLES_DEP_LIBS) -xtest_CFLAGS = $(XTSTEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -evi_SOURCES = evi.c -evi_LDADD = $(X11EXAMPLES_DEP_LIBS) -evi_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -res_SOURCES = res.c -res_LDADD = $(XRESEXAMPLES_DEP_LIBS) -res_CFLAGS = $(XRESEXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -xled_SOURCES = xled.c -xled_LDADD = $(X11EXAMPLES_DEP_LIBS) -xled_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -xbell_SOURCES = xbell.c -xbell_LDADD = $(X11EXAMPLES_DEP_LIBS) -xbell_CFLAGS = $(X11EXAMPLES_DEP_CFLAGS) $(CWARNFLAGS) - -ev_SOURCES = ev.c -ev_LDADD = -ev_CFLAGS = diff --git a/hw/dmx/examples/dmxaddinput.c b/hw/dmx/examples/dmxaddinput.c deleted file mode 100644 index fdd09b99b..000000000 --- a/hw/dmx/examples/dmxaddinput.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 2003,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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - int id = -1; - int status; - - if (argc != 5) { - printf("Usage: %s display c|b name|screen isCore\n", argv[0]); - return -1; - } - - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - printf("DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - printf("Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - if (argv[2][0] == 'c') { - status = DMXAddConsoleInput(display, argv[3], atoi(argv[4]), &id); - } - else { - status = DMXAddBackendInput(display, atoi(argv[3]), atoi(argv[4]), &id); - } - - printf("status = %d, id = %d\n", status, id); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxaddscreen.c b/hw/dmx/examples/dmxaddscreen.c deleted file mode 100644 index 58129faa5..000000000 --- a/hw/dmx/examples/dmxaddscreen.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 2003-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> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - int screenNum; - DMXScreenAttributes attr; - unsigned int mask = 0; - - if (argc != 4 && argc != 14) { - printf - ("Usage: %s display screenNum displayName [scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy]\n", - argv[0]); - return -1; - } - - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - - screenNum = strtol(argv[2], NULL, 0); - if (argc == 14) { - mask |= (DMXScreenWindowXoffset | - DMXScreenWindowYoffset | - DMXScreenWindowWidth | DMXScreenWindowHeight); - attr.screenWindowXoffset = strtol(argv[4], NULL, 0); - attr.screenWindowYoffset = strtol(argv[5], NULL, 0); - attr.screenWindowWidth = strtol(argv[6], NULL, 0); - attr.screenWindowHeight = strtol(argv[7], NULL, 0); - - mask |= (DMXRootWindowXoffset | - DMXRootWindowYoffset | - DMXRootWindowWidth | DMXRootWindowHeight); - attr.rootWindowXoffset = strtol(argv[8], NULL, 0); - attr.rootWindowYoffset = strtol(argv[9], NULL, 0); - attr.rootWindowWidth = strtol(argv[10], NULL, 0); - attr.rootWindowHeight = strtol(argv[11], NULL, 0); - - mask |= DMXRootWindowXorigin | DMXRootWindowYorigin; - attr.rootWindowXorigin = strtol(argv[12], NULL, 0); - attr.rootWindowYorigin = strtol(argv[13], NULL, 0); - } - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - printf("DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - printf("Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - if (!DMXAddScreen(display, argv[3], mask, &attr, &screenNum)) - printf("Failed to add %s as screen #%d\n", argv[2], screenNum); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxinfo.c b/hw/dmx/examples/dmxinfo.c deleted file mode 100644 index fea94e203..000000000 --- a/hw/dmx/examples/dmxinfo.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * Copyright 2001,2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -static void -indent(int level) -{ - int i; - - for (i = 0; i < level; i++) - printf(" "); -} - -static void -print_window_id(const char *displayName, Display * display, - Window window, int level, int child) -{ - char *name; - - if (!XFetchName(display, window, &name)) - name = NULL; - indent(level); - if (child) - printf("(%d) ", child); - printf("%s window 0x%08lx: %s%s\n", - displayName, - (long unsigned) window, - name ? name : "", (window == DefaultRootWindow(display)) - ? " (DMX root window)" : ""); - if (name) - XFree(name); -} - -static void -print_info(Display * display, Window window, int level, int child) -{ - DMXWindowAttributes winfo[128]; - int count; - int i; - - if (!DMXGetWindowAttributes(display, window, &count, 128, winfo)) { - printf("Could not get window information for 0x%08lx\n", - (long unsigned) window); - exit(-2); - } - printf("\n"); - print_window_id("DMX", display, window, level, child); - for (i = 0; i < count; i++) { - DMXScreenAttributes sinfo; - Display *backend; - - /* This could also be cached -- the information doesn't change. */ - if (!DMXGetScreenAttributes(display, winfo[i].screen, &sinfo)) { - printf("Could not get screen information for screen %d\n", i); - exit(-2); - } - if (!(backend = XOpenDisplay(sinfo.displayName))) { - printf("Cannot open backend display %s\n", sinfo.displayName); - exit(-2); - } - XCloseDisplay(backend); - - indent(level + 1); - printf("%s window 0x%08lx: %dx%d%+d%+d", - sinfo.displayName, - (long unsigned) winfo[i].window, - winfo[i].pos.width, winfo[i].pos.height, - winfo[i].pos.x, winfo[i].pos.y); - if (!winfo[i].vis.width - && !winfo[i].vis.height && !winfo[i].vis.x && !winfo[i].vis.y) - printf(" not visible\n"); - else if (winfo[i].vis.width == winfo[i].pos.width - && winfo[i].vis.height == winfo[i].pos.height) { - printf(" %+d%+d\n", winfo[i].vis.x, winfo[i].vis.y); - } - else { - printf(" %dx%d%+d%+d\n", - winfo[i].vis.width, winfo[i].vis.height, - winfo[i].vis.x, winfo[i].vis.y); - } - } -} - -static void -print_tree(Display * display, Window window, int level, int child) -{ - Window root, parent; - Window *list; - unsigned int count; - unsigned int i; - - print_info(display, window, level, child); - - if (!XQueryTree(display, window, &root, &parent, &list, &count)) { - printf("Cannot query window tree for 0x%08lx\n", - (long unsigned) window); - exit(-3); - } - - if (count) { - indent(level + 1); - printf("%d child%s:\n", count, count > 1 ? "ren" : ""); - for (i = 0; i < count; i++) { - print_tree(display, list[i], level + 1, i + 1); - } - } -} - -static const char * -core(DMXInputAttributes * iinfo) -{ - if (iinfo->isCore) - return "core"; - else if (iinfo->sendsCore) - return "extension (sends core)"; - else - return "extension"; -} - -int -main(int argc, char **argv) -{ - Display *display = NULL; - Window window = 0; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - DMXScreenAttributes sinfo; - DMXInputAttributes iinfo; - int count; - int i; - - if (argc == 2 || argc == 3) { - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - if (argc == 3) - window = strtol(argv[2], NULL, 0); - } - else { - printf("Usage: %s display [windowid]\n", argv[0]); - return -1; - } - - if (!display && !(display = XOpenDisplay(NULL))) { - printf("Cannot open default display\n"); - return -1; - } - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - printf("DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - printf("Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - if (!DMXGetScreenCount(display, &count)) { - printf("Could not get screen count\n"); - return -1; - } - printf("Screen count = %d\n", count); - - for (i = 0; i < count; i++) { - if (!DMXGetScreenAttributes(display, i, &sinfo)) { - printf("Could not get screen information for %d\n", i); - return -1; - } - printf("%d: %s %ux%u+%d+%d %d @%dx%d (root: %dx%d%+d%+d)\n", - i, sinfo.displayName, - sinfo.screenWindowWidth, sinfo.screenWindowHeight, - sinfo.screenWindowXoffset, sinfo.screenWindowYoffset, - sinfo.logicalScreen, - sinfo.rootWindowXorigin, sinfo.rootWindowYorigin, - sinfo.rootWindowWidth, sinfo.rootWindowHeight, - sinfo.rootWindowXoffset, sinfo.rootWindowYoffset); - } - - if (major_version == 1 && minor_version >= 1) { - if (!DMXGetInputCount(display, &count)) { - printf("Could not get input count\n"); - return -1; - } - printf("Input count = %d\n", count); - for (i = 0; i < count; i++) { - if (!DMXGetInputAttributes(display, i, &iinfo)) { - printf("Could not get input information for id %d\n", i); - return -1; - } - switch (iinfo.inputType) { - case DMXLocalInputType: - printf(" %2d local %-20.20s %s\n", i, "", core(&iinfo)); - break; - case DMXConsoleInputType: - printf(" %2d console %-20.20s %s\n", - i, iinfo.name, core(&iinfo)); - break; - case DMXBackendInputType: - printf(" %2d backend %-20.20s id=%2d screen=%2d %s\n", - i, iinfo.name, iinfo.physicalId, iinfo.physicalScreen, - core(&iinfo)); - break; - } - } - } - - if (window) - print_info(display, window, 0, 0); - else - print_tree(display, DefaultRootWindow(display), 0, 0); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxreconfig.c b/hw/dmx/examples/dmxreconfig.c deleted file mode 100644 index 9587682db..000000000 --- a/hw/dmx/examples/dmxreconfig.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - * Copyright 2003 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> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - int screen; - DMXScreenAttributes attr; - unsigned int mask = 0; - int status; - int errorScreen; - - if (argc != 13) { - fprintf(stderr, - "Usage: %s display screen scrnx scrny scrnw scrnh rootx rooty rootw rooth originx originy\n", - argv[0]); - return -1; - } - - if (!(display = XOpenDisplay(argv[1]))) { - fprintf(stderr, "Cannot open display %s\n", argv[1]); - return -1; - } - - screen = strtol(argv[2], NULL, 0); - - mask |= (DMXScreenWindowXoffset | - DMXScreenWindowYoffset | - DMXScreenWindowWidth | DMXScreenWindowHeight); - attr.screenWindowXoffset = strtol(argv[3], NULL, 0); - attr.screenWindowYoffset = strtol(argv[4], NULL, 0); - attr.screenWindowWidth = strtol(argv[5], NULL, 0); - attr.screenWindowHeight = strtol(argv[6], NULL, 0); - - mask |= (DMXRootWindowXoffset | - DMXRootWindowYoffset | DMXRootWindowWidth | DMXRootWindowHeight); - attr.rootWindowXoffset = strtol(argv[7], NULL, 0); - attr.rootWindowYoffset = strtol(argv[8], NULL, 0); - attr.rootWindowWidth = strtol(argv[9], NULL, 0); - attr.rootWindowHeight = strtol(argv[10], NULL, 0); - - mask |= DMXRootWindowXorigin | DMXRootWindowYorigin; - attr.rootWindowXorigin = strtol(argv[11], NULL, 0); - attr.rootWindowYorigin = strtol(argv[12], NULL, 0); - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - fprintf(stderr, "DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - fprintf(stderr, "Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - if (major_version == 1 && minor_version < 3) { - fprintf(stderr, - "ReconfigureScreen not supported in this extension version\n"); - return -1; - } - - if (major_version < 2) { - fprintf(stderr, - "ChangeScreensAttributes not supported in this extension " - "version\n"); - return -1; - } - - if (!(status = DMXChangeScreensAttributes(display, 1, &screen, 1, &mask, - &attr, &errorScreen))) { - printf("Reconfigured screen #%d to " - "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n", - screen, - attr.screenWindowWidth, - attr.screenWindowHeight, - (attr.screenWindowXoffset < 0 ? "" : "+"), - attr.screenWindowXoffset, - (attr.screenWindowYoffset < 0 ? "" : "+"), - attr.screenWindowYoffset, - attr.rootWindowWidth, - attr.rootWindowHeight, - (attr.rootWindowXoffset < 0 ? "" : "+"), - attr.rootWindowXoffset, - (attr.rootWindowYoffset < 0 ? "" : "+"), - attr.rootWindowYoffset, - (attr.rootWindowXorigin < 0 ? "" : "+"), - attr.rootWindowXorigin, - (attr.rootWindowYorigin < 0 ? "" : "+"), attr.rootWindowYorigin); - } - else { - fprintf(stderr, - "Could not set screen #%d to " - "%dx%d%s%d%s%d %dx%d%s%d%s%d %s%d%s%d\n" - "[status = %d, errorScreen=%d]\n", - screen, - attr.screenWindowWidth, - attr.screenWindowHeight, - (attr.screenWindowXoffset < 0 ? "" : "+"), - attr.screenWindowXoffset, - (attr.screenWindowYoffset < 0 ? "" : "+"), - attr.screenWindowYoffset, - attr.rootWindowWidth, - attr.rootWindowHeight, - (attr.rootWindowXoffset < 0 ? "" : "+"), - attr.rootWindowXoffset, - (attr.rootWindowYoffset < 0 ? "" : "+"), - attr.rootWindowYoffset, - (attr.rootWindowXorigin < 0 ? "" : "+"), - attr.rootWindowXorigin, - (attr.rootWindowYorigin < 0 ? "" : "+"), - attr.rootWindowYorigin, status, errorScreen); - return -1; - } - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxresize.c b/hw/dmx/examples/dmxresize.c deleted file mode 100644 index fed3bd08a..000000000 --- a/hw/dmx/examples/dmxresize.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - int width, height, shiftX, shiftY, status; - DMXDesktopAttributes attr; - unsigned int mask; - - if (argc != 6) { - printf("Usage: %s display width height shiftX shiftY\n", argv[0]); - return -1; - } - - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - - width = strtol(argv[2], NULL, 0); - height = strtol(argv[3], NULL, 0); - shiftX = strtol(argv[4], NULL, 0); - shiftY = strtol(argv[5], NULL, 0); - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - printf("DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - printf("Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - mask = (DMXDesktopWidth | - DMXDesktopHeight | DMXDesktopShiftX | DMXDesktopShiftY); - attr.width = width; - attr.height = height; - attr.shiftX = shiftX; - attr.shiftY = shiftY; - switch (status = DMXChangeDesktopAttributes(display, mask, &attr)) { - case DmxBadXinerama: - printf("status = %d (No Xinerama)\n", status); - break; - case DmxBadValue: - printf("status = %d (Bad Value)\n", status); - break; - case Success: - printf("status = %d (Success)\n", status); - break; - default: - printf("status = %d (UNKNOWN ERROR *****)\n", status); - break; - } - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxrminput.c b/hw/dmx/examples/dmxrminput.c deleted file mode 100644 index 0113a7f5c..000000000 --- a/hw/dmx/examples/dmxrminput.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright 2003,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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - int status; - - if (argc != 3) { - printf("Usage: %s display id\n", argv[0]); - return -1; - } - - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - printf("DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - printf("Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - status = DMXRemoveInput(display, atoi(argv[2])); - - printf("status = %d\n", status); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxrmscreen.c b/hw/dmx/examples/dmxrmscreen.c deleted file mode 100644 index 627875bda..000000000 --- a/hw/dmx/examples/dmxrmscreen.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright 2003-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> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/dmxext.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version, patch_version; - int screenNum; - - if (argc != 3) { - printf("Usage: %s display screenNum\n", argv[0]); - return -1; - } - - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - - screenNum = strtol(argv[2], NULL, 0); - - if (!DMXQueryExtension(display, &event_base, &error_base)) { - printf("DMX extension not present\n"); - return -1; - } - printf("DMX extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - - if (!DMXQueryVersion(display, - &major_version, &minor_version, &patch_version)) { - printf("Could not get extension version\n"); - return -1; - } - printf("Extension version: %d.%d patch %d\n", - major_version, minor_version, patch_version); - - if (!DMXRemoveScreen(display, screenNum)) - printf("Failed to remove screen #%d\n", screenNum); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/dmxwininfo.c b/hw/dmx/examples/dmxwininfo.c deleted file mode 100644 index 9b1ce76b6..000000000 --- a/hw/dmx/examples/dmxwininfo.c +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Copyright (c) 2003 by the XFree86 Project, Inc. - * - * 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. - */ - -/* - * Create a window and use the DMX extension to query the window's - * back-end properties. Display the info inside the window itself. - * - * Brian Paul - * 23 Jan 2003 - */ - -#include <assert.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <X11/Xlib.h> -#include <X11/Xutil.h> -#include <X11/extensions/dmxext.h> - -static const char *FontName = "fixed"; - -static void -EventLoop(Display * dpy, Window win, GC gc) -{ - XEvent ev; - - while (1) { - XNextEvent(dpy, &ev); - switch (ev.type) { - case ReparentNotify: - break; - case MapNotify: - break; - case ConfigureNotify: - case Expose: - { - int numScreens, count, i; - DMXWindowAttributes *winInfo; - int x, y; - const char *msg = "DMX window info:"; - - DMXGetScreenCount(dpy, &numScreens); - winInfo = (DMXWindowAttributes *) - malloc(numScreens * sizeof(DMXWindowAttributes)); - assert(winInfo); - if (!DMXGetWindowAttributes(dpy, win, &count, numScreens, winInfo)) { - printf("Could not get window information for 0x%08lx\n", - (long unsigned) win); - } - x = y = 50; - XClearWindow(dpy, win); - XDrawString(dpy, win, gc, x, y, msg, strlen(msg)); - y += 20; - for (i = 0; i < count; i++) { - char str[500]; - - snprintf(str, sizeof(str), - "screen %d: pos: %dx%d+%d+%d visible: %dx%d+%d+%d", - winInfo[i].screen, - winInfo[i].pos.width, winInfo[i].pos.height, - winInfo[i].pos.x, winInfo[i].pos.y, - winInfo[i].vis.width, winInfo[i].vis.height, - winInfo[i].vis.x, winInfo[i].vis.y); - XDrawString(dpy, win, gc, x, y, str, strlen(str)); - y += 20; - } - free(winInfo); - } - break; - default: - printf("Event type 0x%x\n", ev.type); - } - } -} - -int -main(int argc, char *argv[]) -{ - const char *displayName = NULL; - Display *dpy; - int event_base, error_base; - int scr, n; - long vinfoMask, attrMask; - XVisualInfo vinfoTemp, *visInfo; - Visual *vis; - Window win, root; - XSetWindowAttributes attr; - XFontStruct *fontInfo; - GC gc; - - if (argc > 1) { - displayName = argv[1]; - } - - dpy = XOpenDisplay(displayName); - if (!dpy) { - fprintf(stderr, "Unable to open display %s\n", displayName); - return -1; - } - - if (!DMXQueryExtension(dpy, &event_base, &error_base)) { - fprintf(stderr, "DMX extension not available on this display.\n"); - return -1; - } - - scr = DefaultScreen(dpy); - root = RootWindow(dpy, scr); - vis = DefaultVisual(dpy, scr); - - vinfoMask = VisualIDMask; - vinfoTemp.visualid = vis->visualid; - visInfo = XGetVisualInfo(dpy, vinfoMask, &vinfoTemp, &n); - if (!visInfo || n != 1) { - fprintf(stderr, "Unable to get visual!\n"); - XCloseDisplay(dpy); - return -1; - } - - attr.background_pixel = 0; - attr.border_pixel = 0; - attr.colormap = XCreateColormap(dpy, root, visInfo->visual, AllocNone); - attr.event_mask = StructureNotifyMask | ExposureMask; - attrMask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; - - win = XCreateWindow(dpy, root, 500, 500, 600, 400, /* x, y, w, h */ - 0, /* border_width */ - visInfo->depth, InputOutput, - visInfo->visual, attrMask, &attr); - - if (!win) { - fprintf(stderr, "Unable to create window!\n"); - XCloseDisplay(dpy); - return -1; - } - - fontInfo = XLoadQueryFont(dpy, FontName); - if (!fontInfo) { - fprintf(stderr, "Error: font %s not found\n", FontName); - exit(0); - } - - gc = XCreateGC(dpy, win, 0, NULL); - XSetBackground(dpy, gc, BlackPixel(dpy, scr)); - XSetForeground(dpy, gc, WhitePixel(dpy, scr)); - XSetFont(dpy, gc, fontInfo->fid); - - XMapWindow(dpy, win); - - EventLoop(dpy, win, gc); - - XDestroyWindow(dpy, win); - XCloseDisplay(dpy); - return 0; -} - -#if 00 - -static void -make_window(char *title, int color_flag) -{ - int x = 10, y = 10, width = 400, height = 300; - Display *dpy; - int scr; - Window root, win; - Colormap cmap; - XColor xcolor; - int attr_flags; - XVisualInfo *visinfo; - XSetWindowAttributes attr; - XTextProperty tp; - XSizeHints sh; - XEvent e; - XMesaContext context; - XMesaVisual visual; - XMesaBuffer buffer; - - /* - * Do the usual X things to make a window. - */ - - dpy = XOpenDisplay(NULL); - if (!dpy) { - printf("Couldn't open default display!\n"); - exit(1); - } - - scr = DefaultScreen(dpy); - root = RootWindow(dpy, scr); - - /* alloc visinfo struct */ - visinfo = (XVisualInfo *) malloc(sizeof(XVisualInfo)); - - /* Get a visual and colormap */ - if (color_flag) { - /* Open TrueColor window */ - -/* - if (!XMatchVisualInfo( dpy, scr, 24, TrueColor, visinfo )) { - printf("Couldn't get 24-bit TrueColor visual!\n"); - exit(1); - } -*/ - if (!XMatchVisualInfo(dpy, scr, 8, PseudoColor, visinfo)) { - printf("Couldn't get 8-bit PseudoColor visual!\n"); - exit(1); - } - - cmap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - Black = Red = Green = Blue = 0; - } - else { - /* Open color index window */ - - if (!XMatchVisualInfo(dpy, scr, 8, PseudoColor, visinfo)) { - printf("Couldn't get 8-bit PseudoColor visual\n"); - exit(1); - } - - cmap = XCreateColormap(dpy, root, visinfo->visual, AllocNone); - - /* Allocate colors */ - xcolor.red = 0x0; - xcolor.green = 0x0; - xcolor.blue = 0x0; - xcolor.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(dpy, cmap, &xcolor)) { - printf("Couldn't allocate black!\n"); - exit(1); - } - Black = xcolor.pixel; - - xcolor.red = 0xffff; - xcolor.green = 0x0; - xcolor.blue = 0x0; - xcolor.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(dpy, cmap, &xcolor)) { - printf("Couldn't allocate red!\n"); - exit(1); - } - Red = xcolor.pixel; - - xcolor.red = 0x0; - xcolor.green = 0xffff; - xcolor.blue = 0x0; - xcolor.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(dpy, cmap, &xcolor)) { - printf("Couldn't allocate green!\n"); - exit(1); - } - Green = xcolor.pixel; - - xcolor.red = 0x0; - xcolor.green = 0x0; - xcolor.blue = 0xffff; - xcolor.flags = DoRed | DoGreen | DoBlue; - if (!XAllocColor(dpy, cmap, &xcolor)) { - printf("Couldn't allocate blue!\n"); - exit(1); - } - Blue = xcolor.pixel; - } - - /* set window attributes */ - attr.colormap = cmap; - attr.event_mask = ExposureMask | StructureNotifyMask; - attr.border_pixel = BlackPixel(dpy, scr); - attr.background_pixel = BlackPixel(dpy, scr); - attr_flags = CWColormap | CWEventMask | CWBorderPixel | CWBackPixel; - - /* Create the window */ - win = XCreateWindow(dpy, root, x, y, width, height, 0, - visinfo->depth, InputOutput, - visinfo->visual, attr_flags, &attr); - if (!win) { - printf("Couldn't open window!\n"); - exit(1); - } - - XStringListToTextProperty(&title, 1, &tp); - sh.flags = USPosition | USSize; - XSetWMProperties(dpy, win, &tp, &tp, 0, 0, &sh, 0, 0); - XMapWindow(dpy, win); - while (1) { - XNextEvent(dpy, &e); - if (e.type == MapNotify && e.xmap.window == win) { - break; - } - } - - /* - * Now do the special Mesa/Xlib stuff! - */ - - visual = XMesaCreateVisual(dpy, visinfo, (GLboolean) color_flag, GL_FALSE, /* alpha_flag */ - GL_FALSE, /* db_flag */ - GL_FALSE, /* stereo flag */ - GL_FALSE, /* ximage_flag */ - 0, /* depth size */ - 0, /* stencil size */ - 0, 0, 0, 0, /* accum_size */ - 0, /* num samples */ - 0, /* level */ - 0 /* caveat */ - ); - if (!visual) { - printf("Couldn't create Mesa/X visual!\n"); - exit(1); - } - - /* Create a Mesa rendering context */ - context = XMesaCreateContext(visual, NULL /* share_list */ - ); - if (!context) { - printf("Couldn't create Mesa/X context!\n"); - exit(1); - } - - buffer = XMesaCreateWindowBuffer(visual, win); - if (!buffer) { - printf("Couldn't create Mesa/X buffer!\n"); - exit(1); - } - - XMesaMakeCurrent(context, buffer); - - /* Ready to render! */ -} - -static void -draw_cube(void) -{ - /* X faces */ - glIndexi(Red); - glColor3f(1.0, 0.0, 0.0); - glBegin(GL_POLYGON); - glVertex3f(1.0, 1.0, 1.0); - glVertex3f(1.0, -1.0, 1.0); - glVertex3f(1.0, -1.0, -1.0); - glVertex3f(1.0, 1.0, -1.0); - glEnd(); - - glBegin(GL_POLYGON); - glVertex3f(-1.0, 1.0, 1.0); - glVertex3f(-1.0, 1.0, -1.0); - glVertex3f(-1.0, -1.0, -1.0); - glVertex3f(-1.0, -1.0, 1.0); - glEnd(); - - /* Y faces */ - glIndexi(Green); - glColor3f(0.0, 1.0, 0.0); - glBegin(GL_POLYGON); - glVertex3f(1.0, 1.0, 1.0); - glVertex3f(1.0, 1.0, -1.0); - glVertex3f(-1.0, 1.0, -1.0); - glVertex3f(-1.0, 1.0, 1.0); - glEnd(); - - glBegin(GL_POLYGON); - glVertex3f(1.0, -1.0, 1.0); - glVertex3f(-1.0, -1.0, 1.0); - glVertex3f(-1.0, -1.0, -1.0); - glVertex3f(1.0, -1.0, -1.0); - glEnd(); - - /* Z faces */ - glIndexi(Blue); - glColor3f(0.0, 0.0, 1.0); - glBegin(GL_POLYGON); - glVertex3f(1.0, 1.0, 1.0); - glVertex3f(-1.0, 1.0, 1.0); - glVertex3f(-1.0, -1.0, 1.0); - glVertex3f(1.0, -1.0, 1.0); - glEnd(); - - glBegin(GL_POLYGON); - glVertex3f(1.0, 1.0, -1.0); - glVertex3f(1.0, -1.0, -1.0); - glVertex3f(-1.0, -1.0, -1.0); - glVertex3f(-1.0, 1.0, -1.0); - glEnd(); -} - -static void -display_loop(void) -{ - GLfloat xrot, yrot, zrot; - - xrot = yrot = zrot = 0.0; - - glClearColor(0.0, 0.0, 0.0, 0.0); - glClearIndex(Black); - - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - glFrustum(-1.0, 1.0, -1.0, 1.0, 1.0, 10.0); - glTranslatef(0.0, 0.0, -5.0); - - glMatrixMode(GL_MODELVIEW); - glLoadIdentity(); - - glCullFace(GL_BACK); - glEnable(GL_CULL_FACE); - - glShadeModel(GL_FLAT); - - while (1) { - glClear(GL_COLOR_BUFFER_BIT); - glPushMatrix(); - glRotatef(xrot, 1.0, 0.0, 0.0); - glRotatef(yrot, 0.0, 1.0, 0.0); - glRotatef(zrot, 0.0, 0.0, 1.0); - - draw_cube(); - - glPopMatrix(); - glFinish(); - - xrot += 10.0; - yrot += 7.0; - zrot -= 3.0; - } - -} - -int -main(int argc, char *argv[]) -{ - int mode = 0; - - if (argc >= 2) { - if (strcmp(argv[1], "-ci") == 0) - mode = 0; - else if (strcmp(argv[1], "-rgb") == 0) - mode = 1; - else { - printf("Bad flag: %s\n", argv[1]); - printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n"); - exit(1); - } - } - else { - printf("Specify -ci for 8-bit color index or -rgb for RGB mode\n"); - printf("Defaulting to 8-bit color index\n"); - } - - make_window(argv[0], mode); - - display_loop(); - return 0; -} - -#endif diff --git a/hw/dmx/examples/ev.c b/hw/dmx/examples/ev.c deleted file mode 100644 index 09e703ce7..000000000 --- a/hw/dmx/examples/ev.c +++ /dev/null @@ -1,274 +0,0 @@ -/* - * Copyright 2002 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. - * - * This is a simple test program that reads from /dev/input/event*, - * decoding events into a human readable form. - */ - -/* - * Authors: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <string.h> -#include <sys/types.h> -#include <fcntl.h> -#include <errno.h> -#include <time.h> -#include <linux/input.h> - -struct input_event event; - -int -main(int argc, char **argv) -{ - char name[64]; /* RATS: Use ok, but could be better */ - char buf[256] = { 0, }; /* RATS: Use ok */ - unsigned char mask[EV_MAX / 8 + 1]; /* RATS: Use ok */ - int version; - int fd = 0; - int rc; - int i, j; - const char *tmp; - -#define test_bit(bit) (mask[(bit)/8] & (1 << ((bit)%8))) - - for (i = 0; i < 32; i++) { - snprintf(name, sizeof(name), "/dev/input/event%d", i); - if ((fd = open(name, O_RDONLY, 0)) >= 0) { - ioctl(fd, EVIOCGVERSION, &version); - ioctl(fd, EVIOCGNAME(sizeof(buf)), buf); - ioctl(fd, EVIOCGBIT(0, sizeof(mask)), mask); - printf("%s\n", name); - printf(" evdev version: %d.%d.%d\n", - version >> 16, (version >> 8) & 0xff, version & 0xff); - printf(" name: %s\n", buf); - printf(" features:"); - for (j = 0; j < EV_MAX; j++) { - if (test_bit(j)) { - const char *type = "unknown"; - - switch (j) { - case EV_KEY: - type = "keys/buttons"; - break; - case EV_REL: - type = "relative"; - break; - case EV_ABS: - type = "absolute"; - break; - case EV_MSC: - type = "reserved"; - break; - case EV_LED: - type = "leds"; - break; - case EV_SND: - type = "sound"; - break; - case EV_REP: - type = "repeat"; - break; - case EV_FF: - type = "feedback"; - break; - } - printf(" %s", type); - } - } - printf("\n"); - close(fd); - } - } - - if (argc > 1) { - snprintf(name, sizeof(name), "/dev/input/event%d", atoi(argv[1])); - if ((fd = open(name, O_RDWR, 0)) >= 0) { - printf("%s: open, fd = %d\n", name, fd); - for (i = 0; i < LED_MAX; i++) { - event.time.tv_sec = time(0); - event.time.tv_usec = 0; - event.type = EV_LED; - event.code = i; - event.value = 0; - write(fd, &event, sizeof(event)); - } - - while ((rc = read(fd, &event, sizeof(event))) > 0) { - printf("%-24.24s.%06lu type 0x%04x; code 0x%04x;" - " value 0x%08x; ", - ctime(&event.time.tv_sec), - event.time.tv_usec, event.type, event.code, event.value); - switch (event.type) { - case EV_KEY: - if (event.code > BTN_MISC) { - printf("Button %d %s", - event.code & 0xff, - event.value ? "press" : "release"); - } - else { - printf("Key %d (0x%x) %s", - event.code & 0xff, - event.code & 0xff, - event.value ? "press" : "release"); - } - break; - case EV_REL: - switch (event.code) { - case REL_X: - tmp = "X"; - break; - case REL_Y: - tmp = "Y"; - break; - case REL_HWHEEL: - tmp = "HWHEEL"; - break; - case REL_DIAL: - tmp = "DIAL"; - break; - case REL_WHEEL: - tmp = "WHEEL"; - break; - case REL_MISC: - tmp = "MISC"; - break; - default: - tmp = "UNKNOWN"; - break; - } - printf("Relative %s %d", tmp, event.value); - break; - case EV_ABS: - switch (event.code) { - case ABS_X: - tmp = "X"; - break; - case ABS_Y: - tmp = "Y"; - break; - case ABS_Z: - tmp = "Z"; - break; - case ABS_RX: - tmp = "RX"; - break; - case ABS_RY: - tmp = "RY"; - break; - case ABS_RZ: - tmp = "RZ"; - break; - case ABS_THROTTLE: - tmp = "THROTTLE"; - break; - case ABS_RUDDER: - tmp = "RUDDER"; - break; - case ABS_WHEEL: - tmp = "WHEEL"; - break; - case ABS_GAS: - tmp = "GAS"; - break; - case ABS_BRAKE: - tmp = "BRAKE"; - break; - case ABS_HAT0X: - tmp = "HAT0X"; - break; - case ABS_HAT0Y: - tmp = "HAT0Y"; - break; - case ABS_HAT1X: - tmp = "HAT1X"; - break; - case ABS_HAT1Y: - tmp = "HAT1Y"; - break; - case ABS_HAT2X: - tmp = "HAT2X"; - break; - case ABS_HAT2Y: - tmp = "HAT2Y"; - break; - case ABS_HAT3X: - tmp = "HAT3X"; - break; - case ABS_HAT3Y: - tmp = "HAT3Y"; - break; - case ABS_PRESSURE: - tmp = "PRESSURE"; - break; - case ABS_DISTANCE: - tmp = "DISTANCE"; - break; - case ABS_TILT_X: - tmp = "TILT_X"; - break; - case ABS_TILT_Y: - tmp = "TILT_Y"; - break; - case ABS_MISC: - tmp = "MISC"; - break; - default: - tmp = "UNKNOWN"; - break; - } - printf("Absolute %s %d", tmp, event.value); - break; - case EV_MSC: - printf("Misc"); - break; - case EV_LED: - printf("Led"); - break; - case EV_SND: - printf("Snd"); - break; - case EV_REP: - printf("Rep"); - break; - case EV_FF: - printf("FF"); - break; - break; - } - printf("\n"); - } - printf("rc = %d, (%s)\n", rc, strerror(errno)); - close(fd); - } - } - return 0; -} diff --git a/hw/dmx/examples/evi.c b/hw/dmx/examples/evi.c deleted file mode 100644 index 64dfb7eaa..000000000 --- a/hw/dmx/examples/evi.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/XEVI.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int major_version, minor_version; - ExtendedVisualInfo *evi; - int count; - int i; - - if (argc == 2) { - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - } - else { - printf("Usage: %s display\n", argv[0]); - return -1; - } - - if (!display && !(display = XOpenDisplay(NULL))) { - printf("Cannot open default display\n"); - return -1; - } - - if (!XeviQueryVersion(display, &major_version, &minor_version)) { - printf("EVI extension not present\n"); - return -1; - } - printf("EVI Extension version: %d.%d\n", major_version, minor_version); - - XeviGetVisualInfo(display, NULL, 0, &evi, &count); - - for (i = 0; i < count; i++) { - printf("%02d vid=0x%02lx screen=%d level=%d type=%u value=%u" - " min=%u max=%u conflicts=%u\n", - i, - (long unsigned) evi[i].core_visual_id, - evi[i].screen, - evi[i].level, - evi[i].transparency_type, - evi[i].transparency_value, - evi[i].min_hw_colormaps, - evi[i].max_hw_colormaps, evi[i].num_colormap_conflicts); - } - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/meson.build b/hw/dmx/examples/meson.build deleted file mode 100644 index ad0d798c3..000000000 --- a/hw/dmx/examples/meson.build +++ /dev/null @@ -1,53 +0,0 @@ -dmxexamples_dep = [ - dependency('xext'), - dependency('x11'), -] - -dmx_dep = dependency('dmx', version: '>= 1.0.99.1') - -dmx_examples = [ - ['dmxinfo', [dmx_dep]], - ['dmxwininfo', [dmx_dep, dependency('xmu')]], - ['dmxreconfig', [dmx_dep]], - ['dmxresize', [dmx_dep]], - ['dmxaddscreen', [dmx_dep]], - ['dmxrmscreen', [dmx_dep]], - ['dmxaddinput', [dmx_dep]], - ['dmxrminput', [dmx_dep]], -] - -noinst_dmx_examples = [ - ['xinput', [dmx_dep, dependency('xi')]], - ['xtest', [dependency('xtst')]], - ['evi', []], - ['xled', []], - ['xbell', []], - ['res', [dependency('xres')]], -] - -foreach ex: dmx_examples - bin = ex[0] - extra_dep = ex[1] - - executable( - bin, - bin + '.c', - dependencies: [dmxexamples_dep, extra_dep], - install: true - ) -endforeach - -foreach ex: noinst_dmx_examples - bin = ex[0] - extra_dep = ex[1] - - executable( - bin, - bin + '.c', - dependencies: [dmxexamples_dep, extra_dep], - ) -endforeach - -if cc.has_header('linux/input.h') - executable('ev', 'ev.c') -endif diff --git a/hw/dmx/examples/res.c b/hw/dmx/examples/res.c deleted file mode 100644 index 138216e4c..000000000 --- a/hw/dmx/examples/res.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/XRes.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int major_version, minor_version; - int event, error; - int count; - int i; - XResClient *clients; - - if (argc == 2) { - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - } - else { - printf("Usage: %s display\n", argv[0]); - return -1; - } - - if (!display && !(display = XOpenDisplay(NULL))) { - printf("Cannot open default display\n"); - return -1; - } - - if (!XResQueryExtension(display, &event, &error)) { - printf("X-Resource extension not present\n"); - return -1; - } - printf("X-Resource extension present: event=%d error=%d\n", event, error); - - if (!XResQueryVersion(display, &major_version, &minor_version)) { - printf("XResQueryVersion call failed\n"); - return -1; - } - printf("X-Resource extension version: %d.%d\n", - major_version, minor_version); - - XResQueryClients(display, &count, &clients); - - printf("%d clients:\n", count); - for (i = 0; i < count; i++) { - int c, j; - XResType *types; - - XResQueryClientResources(display, clients[i].resource_base, &c, &types); - printf(" %3d: base = 0x%lx, mask = 0x%lx, %d resource types:\n", - i, (long unsigned) clients[i].resource_base, - (long unsigned) clients[i].resource_mask, c); - for (j = 0; j < c; j++) { - char *name = XGetAtomName(display, types[j].resource_type); - - printf(" %2d: %s %d\n", j, name, types[j].count); - XFree(name); - } - XFree(types); - } - - XFree(clients); - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/xbell.c b/hw/dmx/examples/xbell.c deleted file mode 100644 index e64b9c90c..000000000 --- a/hw/dmx/examples/xbell.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> - -static void -pkc(XKeyboardControl * kc, unsigned long vm) -{ - if (vm & KBKeyClickPercent) - printf(" key_click_percent = %d\n", kc->key_click_percent); - if (vm & KBBellPercent) - printf(" bell_percent = %d\n", kc->bell_percent); - if (vm & KBBellPitch) - printf(" bell_pitch = %d\n", kc->bell_pitch); - if (vm & KBBellDuration) - printf(" bell_duration = %d\n", kc->bell_duration); - if (vm & KBLed) - printf(" led = 0x%x\n", kc->led); - if (vm & KBLedMode) - printf(" led_mode = %d\n", kc->led_mode); - if (vm & KBKey) - printf(" key = %d\n", kc->key); - if (vm & KBAutoRepeatMode) - printf(" auto_repeat_mode = %d\n", kc->auto_repeat_mode); -} - -static void -pks(XKeyboardState * ks) -{ - printf(" key_click_percent = %d\n", ks->key_click_percent); - printf(" bell_percent = %d\n", ks->bell_percent); - printf(" bell_pitch = %u\n", ks->bell_pitch); - printf(" bell_duration = %u\n", ks->bell_duration); - printf(" led_mask = 0x%lx\n", ks->led_mask); - printf(" global_auto_repeat = %d\n", ks->global_auto_repeat); -} - -int -main(int argc, char **argv) -{ - Display *display; - XKeyboardControl kc; - XKeyboardState ks; - unsigned long vm; - - if (argc != 5) { - printf("Usage: xbell percent baseVolume pitch duration\n"); - return 1; - } - - vm = (KBBellPercent | KBBellPitch | KBBellDuration); - kc.key_click_percent = atoi(argv[1]); - kc.bell_percent = atoi(argv[2]); - kc.bell_pitch = atoi(argv[3]); - kc.bell_duration = atoi(argv[4]); - - display = XOpenDisplay(NULL); - if (display == NULL) { - fprintf (stderr, "%s: unable to open display \"%s\".\n", - argv[0], XDisplayName (NULL)); - exit(1); - } - - printf("Setting:\n"); - pkc(&kc, vm); - XChangeKeyboardControl(display, vm, &kc); - - printf("Have:\n"); - XGetKeyboardControl(display, &ks); - pks(&ks); - - XBell(display, 100); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/xinput.c b/hw/dmx/examples/xinput.c deleted file mode 100644 index 6eddc6a67..000000000 --- a/hw/dmx/examples/xinput.c +++ /dev/null @@ -1,355 +0,0 @@ -/* - * Copyright 2001,2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <X11/Xlib.h> -#include <X11/XKBlib.h> -#include <X11/extensions/XInput.h> -#include <X11/extensions/XKB.h> -#include <X11/extensions/XKBstr.h> -#include <X11/extensions/dmxext.h> -#include <sys/time.h> - -static const char * -core(DMXInputAttributes * iinf) -{ - if (iinf->isCore) - return "core"; - else if (iinf->sendsCore) - return "extension (sends core events)"; - else - return "extension"; -} - -static void -printdmxinfo(Display * display, int id) -{ - int event_base; - int error_base; - int major_version, minor_version, patch_version; - DMXInputAttributes iinf; - Display *backend; - char *backendname = NULL; - - if (!DMXQueryExtension(display, &event_base, &error_base)) - return; - if (!DMXQueryVersion(display, &major_version, &minor_version, - &patch_version)) - return; - if (major_version == 1 && minor_version == 0) - return; /* too old */ - if (!DMXGetInputAttributes(display, id, &iinf)) - return; - - printf(" DMX Information: "); - if (iinf.detached) - printf("detached "); - else - printf("active "); - switch (iinf.inputType) { - case DMXLocalInputType: - printf("local, %s", core(&iinf)); - break; - case DMXConsoleInputType: - printf("console %s, %s", iinf.name, core(&iinf)); - break; - case DMXBackendInputType: - if (iinf.physicalId >= 0) { - if ((backend = XOpenDisplay(iinf.name))) { - XExtensionVersion *ext = XGetExtensionVersion(backend, INAME); - - if (ext && ext != (XExtensionVersion *) NoSuchExtension) { - int count, i; - XDeviceInfo *devInfo = XListInputDevices(backend, &count); - - if (devInfo) { - for (i = 0; i < count; i++) { - if ((unsigned) iinf.physicalId == devInfo[i].id - && devInfo[i].name) { - backendname = strdup(devInfo[i].name); - break; - } - } - XFreeDeviceList(devInfo); - } - } - XCloseDisplay(backend); - } - } - printf("backend o%d/%s", iinf.physicalScreen, iinf.name); - if (iinf.physicalId >= 0) - printf("/id%d", iinf.physicalId); - if (backendname) { - printf("=%s", backendname); - free(backendname); - } - printf(" %s", core(&iinf)); - break; - } - printf("\n"); -} - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int device = -1; - int newmouse = -1; - int newkbd = -1; - int count; - int i, j; - XDeviceInfo *devInfo; - XExtensionVersion *ext; - - if (argc == 2 || argc == 3 || argc == 4 || argc == 5) { - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - if (argc >= 3) - device = strtol(argv[2], NULL, 0); - if (argc >= 4) - newmouse = strtol(argv[3], NULL, 0); - if (argc >= 5) - newkbd = strtol(argv[4], NULL, 0); - } - else { - printf("Usage: %s display [device] [newmouse] [newkbd]\n", argv[0]); - return -1; - } - - if (!display && !(display = XOpenDisplay(NULL))) { - printf("Cannot open default display\n"); - return -1; - } - - ext = XGetExtensionVersion(display, INAME); - if (!ext || ext == (XExtensionVersion *) NoSuchExtension) { - printf("No XInputExtension\n"); - return -1; - } - printf("%s version %d.%d\n", INAME, ext->major_version, ext->minor_version); - - if (!(devInfo = XListInputDevices(display, &count)) || !count) { - printf("Cannot list devices\n"); - return -1; - } - - for (i = 0; i < count; i++) { - XAnyClassPtr any; - const char *kind = "Unknown"; - int has_key = 0; - - switch (devInfo[i].use) { - case IsXPointer: - kind = "XPointer"; - break; - case IsXKeyboard: - kind = "XKeyboard"; - break; - case IsXExtensionDevice: - kind = "XExtensionDevice"; - break; - } - printf("%2lu %-20.20s %-16.16s", - (long unsigned) devInfo[i].id, - devInfo[i].name ? devInfo[i].name : "", kind); - - for (j = 0, any = devInfo[i].inputclassinfo; - j < devInfo[i].num_classes; - any = (XAnyClassPtr) ((char *) any + any->length), j++) { - const char *class = "unk"; - - switch (any->class) { - case KeyClass: - class = "key"; - ++has_key; - break; - case ButtonClass: - class = "btn"; - break; - case ValuatorClass: - class = "val"; - break; - case FeedbackClass: - class = "fdb"; - break; - case ProximityClass: - class = "prx"; - break; - case FocusClass: - class = "foc"; - break; - case OtherClass: - class = "oth"; - break; - } - printf(" %s", class); - } - printf("\n"); - printdmxinfo(display, i); - - if (has_key) { - XkbDescPtr xkb; - - if ((xkb = XkbGetKeyboard(display, - XkbAllComponentsMask, devInfo[i].id))) { - printf(" Xkb Information:\n"); - printf(" Device id = %d\n", xkb->device_spec); - printf(" Min keycode = 0x%02x\n", xkb->min_key_code); - printf(" Max keycode = 0x%02x\n", xkb->max_key_code); -#define PRINTNAME(x) \ - printf(" %s = %s\n", \ - #x, xkb->names->x ? XGetAtomName(display, xkb->names->x) : "") - PRINTNAME(keycodes); - PRINTNAME(geometry); - PRINTNAME(symbols); - PRINTNAME(types); - PRINTNAME(compat); - } - } - } - - if (newmouse >= 0) { - XDevice *dev; - - printf("Trying to make device %d core mouse\n", newmouse); - dev = XOpenDevice(display, devInfo[newmouse].id); - printf("Status = %d\n", XChangePointerDevice(display, dev, 0, 1)); - return 0; - } - - if (newkbd >= 0) { - XDevice *dev; - - printf("Trying to make device %d core keyboard\n", newkbd); - dev = XOpenDevice(display, devInfo[newkbd].id); - printf("Status = %d\n", XChangeKeyboardDevice(display, dev)); - return 0; - } - - if (device >= 0) { -#define MAX_EVENTS 100 - int cnt = 0; - XDevice *dev; - XEventClass event_list[MAX_EVENTS]; - int event_type[MAX_EVENTS]; - const char *names[MAX_EVENTS]; - int total = 0; - -#define ADD(type) \ - if (cnt >= MAX_EVENTS) abort(); \ - names[cnt] = #type; \ - type(dev, event_type[cnt], event_list[cnt]); \ - if (event_type[cnt]) ++cnt - - dev = XOpenDevice(display, devInfo[device].id); - ADD(DeviceKeyPress); - ADD(DeviceKeyRelease); - ADD(DeviceButtonPress); - ADD(DeviceButtonRelease); - ADD(DeviceMotionNotify); - ADD(DeviceFocusIn); - ADD(DeviceFocusOut); - ADD(ProximityIn); - ADD(ProximityOut); - ADD(DeviceStateNotify); - ADD(DeviceMappingNotify); - ADD(ChangeDeviceNotify); - - for (i = 0; i < cnt; i++) { - printf("Waiting for %s events of type %d (%lu) on 0x%08lx\n", - names[i], - event_type[i], (unsigned long) event_list[i], - (long unsigned) DefaultRootWindow(display)); - } - XSelectExtensionEvent(display, DefaultRootWindow(display), - event_list, cnt); - - for (;;) { - XEvent event; - - XNextEvent(display, &event); - for (i = 0; i < cnt; i++) { - XDeviceMotionEvent *e = (XDeviceMotionEvent *) &event; - XDeviceButtonEvent *b = (XDeviceButtonEvent *) &event; - - if (event.type == event_type[i]) { - printf("%s id=%lu (%d @ %d,%d; s=0x%04x, d=%d, t=%lu)" - " axes_count=%d first=%d %d %d %d %d %d %d\n", - names[i], - (long unsigned) e->deviceid, - e->type, - e->x, e->y, - e->device_state, - b->button, - (long unsigned) b->time, - e->axes_count, - e->first_axis, - e->axis_data[0], - e->axis_data[1], - e->axis_data[2], - e->axis_data[3], e->axis_data[4], e->axis_data[5]); - } - } - ++total; -#if 0 - /* Used to check motion history for - * extension devices. */ - if (!(total % 10)) { - XDeviceTimeCoord *tc; - int n, m, a; - struct timeval tv; - unsigned long ms; - - gettimeofday(&tv, NULL); - ms = tv.tv_sec * 1000 + tv.tv_usec / 1000; - tc = XGetDeviceMotionEvents(display, dev, ms - 1000, ms, - &n, &m, &a); - printf("Got %d events of mode %s with %d axes\n", - n, m == Absolute ? "Absolute" : "Relative", a); - for (i = 0; i < n && i < 10; i++) { - printf(" %d: %lu %d %d\n", - i, tc[i].time, tc[i].data[0], tc[i].data[1]); - } - XFreeDeviceMotionEvents(tc); - } -#endif - } - } - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/xled.c b/hw/dmx/examples/xled.c deleted file mode 100644 index 32e8e3770..000000000 --- a/hw/dmx/examples/xled.c +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <X11/Xlib.h> -#include <X11/XKBlib.h> -#include <X11/extensions/XKB.h> -#include <X11/extensions/XKBstr.h> -#include <sys/time.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int mask = 0; - unsigned i; - XKeyboardState ks; - XKeyboardControl kc; - XkbDescPtr xkb; - int old[32]; - - if (argc == 2 || argc == 3) { - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - if (argc >= 3) - mask = strtol(argv[2], NULL, 0); - } - else { - printf("Usage: %s display [mask]\n", argv[0]); - return -1; - } - - if (!display && !(display = XOpenDisplay(NULL))) { - printf("Cannot open default display\n"); - return -1; - } - - if (!(xkb = XkbAllocKeyboard())) { - printf("Cannot allocate\n"); - return -1; - } - if (XkbGetIndicatorMap(display, XkbAllIndicatorsMask, xkb)) { - printf("Cannot Get Indicators\n"); - return -1; - } - if (XkbGetNames(display, XkbAllNamesMask, xkb)) { - printf("Cannot Get Names\n"); - return -1; - } - for (i = 0; i < XkbNumIndicators; i++) { - if (xkb->indicators->phys_indicators & (1 << i)) { - printf("led %d = %d\n", i, xkb->indicators->maps[i].flags); - old[i] = xkb->indicators->maps[i].flags; - xkb->indicators->maps[i].flags = XkbIM_NoAutomatic; - } - } - printf("XkbSetIndicatorMap = %d\n", XkbSetIndicatorMap(display, ~0, xkb)); - XkbFreeKeyboard(xkb, 0, True); - - if (!(xkb = XkbAllocKeyboard())) { - printf("Cannot allocate\n"); - return -1; - } - if (XkbGetIndicatorMap(display, XkbAllIndicatorsMask, xkb)) { - printf("Cannot Get Indicators\n"); - return -1; - } - for (i = 0; i < XkbNumIndicators; i++) { - if (xkb->indicators->phys_indicators & (1 << i)) - printf("led %d = %d\n", i, xkb->indicators->maps[i].flags); - } - - printf("XGetKeyboardControl = %d\n", XGetKeyboardControl(display, &ks)); - printf("old mask = 0x%08lx\n", ks.led_mask); - for (i = 0; i < 5; i++) { - kc.led = i + 1; - kc.led_mode = (mask & (1 << i)) ? LedModeOn : LedModeOff; - printf("XChangeKeyboardControl = %d\n", - XChangeKeyboardControl(display, KBLed | KBLedMode, &kc)); - } - printf("XGetKeyboardControl = %d\n", XGetKeyboardControl(display, &ks)); - printf("new mask = 0x%08lx\n", ks.led_mask); - - for (i = 0; i < XkbNumIndicators; i++) - if (xkb->indicators->phys_indicators & (i << 1)) - xkb->indicators->maps[i].flags = old[i]; - printf("XkbSetIndicatorMap = %d\n", XkbSetIndicatorMap(display, ~0, xkb)); - - XkbFreeKeyboard(xkb, 0, True); - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/examples/xtest.c b/hw/dmx/examples/xtest.c deleted file mode 100644 index 9ce896a29..000000000 --- a/hw/dmx/examples/xtest.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <X11/Xlib.h> -#include <X11/extensions/XTest.h> - -int -main(int argc, char **argv) -{ - Display *display = NULL; - int event_base; - int error_base; - int major_version, minor_version; - - if (argc == 2) { - if (!(display = XOpenDisplay(argv[1]))) { - printf("Cannot open display %s\n", argv[1]); - return -1; - } - } - else { - printf("Usage: %s display\n", argv[0]); - return -1; - } - - if (!display && !(display = XOpenDisplay(NULL))) { - printf("Cannot open default display\n"); - return -1; - } - - if (!XTestQueryExtension(display, &event_base, &error_base, - &major_version, &minor_version)) { - printf("XTEST extension not present\n"); - return -1; - } - printf("XTEST extension present: event_base = %d, error_base = %d\n", - event_base, error_base); - printf("Extension version: %d.%d\n", major_version, minor_version); - - XTestFakeKeyEvent(display, 30, True, 10); - XTestFakeKeyEvent(display, 30, False, 10); - - XCloseDisplay(display); - return 0; -} diff --git a/hw/dmx/glxProxy/Makefile.am b/hw/dmx/glxProxy/Makefile.am deleted file mode 100644 index c3df169e1..000000000 --- a/hw/dmx/glxProxy/Makefile.am +++ /dev/null @@ -1,42 +0,0 @@ -noinst_LIBRARIES = libglxproxy.a - -libglxproxy_a_SOURCES = compsize.c \ - compsize.h \ - g_disptab.c \ - g_disptab.h \ - global.c \ - glxcmds.c \ - glxcmds.h \ - glxcmdsswap.c \ - glxcontext.h \ - glxdrawable.h \ - glxerror.h \ - glxext.c \ - glxext.h \ - glxfbconfig.c \ - glxfbconfig.h \ - glxscreens.c \ - glxscreens.h \ - glxserver.h \ - glxsingle.c \ - glxsingle.h \ - glxswap.c \ - glxswap.h \ - glxutil.h \ - glxvendor.c \ - glxvendor.h \ - glxvisuals.c \ - glxvisuals.h \ - g_renderswap.c \ - render2swap.c \ - renderpixswap.c \ - unpack.h - -AM_CFLAGS = \ - @GLX_ARCH_DEFINES@ \ - $(DIX_CFLAGS) \ - -I$(top_srcdir)/hw/dmx \ - -I$(top_srcdir)/include \ - -DHAVE_DMX_CONFIG_H \ - @DMXMODULES_CFLAGS@ \ - -I$(top_srcdir)/hw/xfree86/os-support diff --git a/hw/dmx/glxProxy/compsize.c b/hw/dmx/glxProxy/compsize.c deleted file mode 100644 index c204d3ded..000000000 --- a/hw/dmx/glxProxy/compsize.c +++ /dev/null @@ -1,641 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include <GL/gl.h> -#include "compsize.h" - -GLint -__glFogiv_size(GLenum pname) -{ - switch (pname) { - case GL_FOG_COLOR: - return 4; - case GL_FOG_DENSITY: - return 1; - case GL_FOG_END: - return 1; - case GL_FOG_MODE: - return 1; - case GL_FOG_INDEX: - return 1; - case GL_FOG_START: - return 1; - default: - return 0; - } -} - -GLint -__glFogfv_size(GLenum pname) -{ - return __glFogiv_size(pname); -} - -GLint -__glCallLists_size(GLsizei n, GLenum type) -{ - GLint size; - - if (n < 0) - return 0; - switch (type) { - case GL_BYTE: - size = 1; - break; - case GL_UNSIGNED_BYTE: - size = 1; - break; - case GL_SHORT: - size = 2; - break; - case GL_UNSIGNED_SHORT: - size = 2; - break; - case GL_INT: - size = 4; - break; - case GL_UNSIGNED_INT: - size = 4; - break; - case GL_FLOAT: - size = 4; - break; - case GL_2_BYTES: - size = 2; - break; - case GL_3_BYTES: - size = 3; - break; - case GL_4_BYTES: - size = 4; - break; - default: - return 0; - } - return n * size; -} - -GLint -__glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h) -{ - GLint elements, esize; - - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { - return (h * ((w + 7) / 8)); - } - else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return elements * esize * w * h; -} - -GLint -__glBitmap_size(GLsizei w, GLsizei h) -{ - return __glDrawPixels_size(GL_COLOR_INDEX, GL_BITMAP, w, h); -} - -GLint -__glTexGendv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_GEN_MODE: - return 1; - case GL_OBJECT_PLANE: - case GL_EYE_PLANE: - return 4; - default: - return 0; - } -} - -GLint -__glTexGenfv_size(GLenum e) -{ - return __glTexGendv_size(e); -} - -GLint -__glTexGeniv_size(GLenum e) -{ - return __glTexGendv_size(e); -} - -GLint -__glTexParameterfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_WRAP_S: - case GL_TEXTURE_WRAP_T: - case GL_TEXTURE_WRAP_R: - case GL_TEXTURE_MIN_FILTER: - case GL_TEXTURE_MAG_FILTER: - return 1; - case GL_TEXTURE_BORDER_COLOR: - return 4; - case GL_TEXTURE_PRIORITY: - return 1; - case GL_TEXTURE_MIN_LOD: - case GL_TEXTURE_MAX_LOD: - case GL_TEXTURE_BASE_LEVEL: - case GL_TEXTURE_MAX_LEVEL: - return 1; - default: - return 0; - } -} - -GLint -__glTexParameteriv_size(GLenum e) -{ - return __glTexParameterfv_size(e); -} - -GLint -__glTexEnvfv_size(GLenum e) -{ - switch (e) { - case GL_TEXTURE_ENV_MODE: - return 1; - case GL_TEXTURE_ENV_COLOR: - return 4; - default: - return 0; - } -} - -GLint -__glTexEnviv_size(GLenum e) -{ - return __glTexEnvfv_size(e); -} - -GLint -__glTexImage1D_size(GLenum format, GLenum type, GLsizei w) -{ - GLint elements, esize; - - if (w < 0) - return 0; - switch (format) { - case GL_COLOR_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (w + 7) / 8; - } - else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return elements * esize * w; -} - -GLint -__glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h) -{ - GLint elements, esize; - - if (w < 0) - return 0; - if (h < 0) - return 0; - switch (format) { - case GL_COLOR_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (h * ((w + 7) / 8)); - } - else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return elements * esize * w * h; -} - -GLint -__glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d) -{ - GLint elements, esize; - - if (w < 0) - return 0; - if (h < 0) - return 0; - if (d < 0) - return 0; - switch (format) { - case GL_COLOR_INDEX: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - elements = 3; - break; - case GL_RGBA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return 0; - } - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX) { - return (d * (h * ((w + 7) / 8))); - } - else { - return 0; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return 0; - } - return elements * esize * w * h * d; -} - -GLint -__glLightfv_size(GLenum pname) -{ - switch (pname) { - case GL_SPOT_EXPONENT: - return 1; - case GL_SPOT_CUTOFF: - return 1; - case GL_AMBIENT: - return 4; - case GL_DIFFUSE: - return 4; - case GL_SPECULAR: - return 4; - case GL_POSITION: - return 4; - case GL_SPOT_DIRECTION: - return 3; - case GL_CONSTANT_ATTENUATION: - return 1; - case GL_LINEAR_ATTENUATION: - return 1; - case GL_QUADRATIC_ATTENUATION: - return 1; - default: - return 0; - } -} - -GLint -__glLightiv_size(GLenum pname) -{ - return __glLightfv_size(pname); -} - -GLint -__glLightModelfv_size(GLenum pname) -{ - switch (pname) { - case GL_LIGHT_MODEL_AMBIENT: - return 4; - case GL_LIGHT_MODEL_LOCAL_VIEWER: - return 1; - case GL_LIGHT_MODEL_TWO_SIDE: - return 1; - case GL_LIGHT_MODEL_COLOR_CONTROL: - return 1; - default: - return 0; - } -} - -GLint -__glLightModeliv_size(GLenum pname) -{ - return __glLightModelfv_size(pname); -} - -GLint -__glMaterialfv_size(GLenum pname) -{ - switch (pname) { - case GL_SHININESS: - return 1; - case GL_EMISSION: - return 4; - case GL_AMBIENT: - return 4; - case GL_DIFFUSE: - return 4; - case GL_SPECULAR: - return 4; - case GL_AMBIENT_AND_DIFFUSE: - return 4; - case GL_COLOR_INDEXES: - return 3; - default: - return 0; - } -} - -GLint -__glMaterialiv_size(GLenum pname) -{ - return __glMaterialfv_size(pname); -} - -GLint -__glColorTableParameterfv_size(GLenum pname) -{ - switch (pname) { - case GL_COLOR_TABLE_FORMAT: - case GL_COLOR_TABLE_WIDTH: - case GL_COLOR_TABLE_RED_SIZE: - case GL_COLOR_TABLE_GREEN_SIZE: - case GL_COLOR_TABLE_BLUE_SIZE: - case GL_COLOR_TABLE_ALPHA_SIZE: - case GL_COLOR_TABLE_LUMINANCE_SIZE: - case GL_COLOR_TABLE_INTENSITY_SIZE: - return 1; - case GL_COLOR_TABLE_SCALE: - case GL_COLOR_TABLE_BIAS: - return 4; - default: - return -1; - } -} - -GLint -__glColorTableParameteriv_size(GLenum pname) -{ - return __glColorTableParameterfv_size(pname); -} - -GLint -__glConvolutionParameterfv_size(GLenum pname) -{ - switch (pname) { - case GL_CONVOLUTION_BORDER_MODE: - return 1; - case GL_CONVOLUTION_BORDER_COLOR: - case GL_CONVOLUTION_FILTER_SCALE: - case GL_CONVOLUTION_FILTER_BIAS: - return 4; - default: /* error: bad enum value */ - return -1; - } -} - -GLint -__glConvolutionParameteriv_size(GLenum pname) -{ - return __glConvolutionParameterfv_size(pname); -} diff --git a/hw/dmx/glxProxy/compsize.h b/hw/dmx/glxProxy/compsize.h deleted file mode 100644 index 5e759b0a0..000000000 --- a/hw/dmx/glxProxy/compsize.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright 2011 Apple Inc. - * - * 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. - */ - -#ifndef __compsize_h__ -#define __compsize_h__ - -extern GLint __glColorTableParameterfv_size(GLenum pname); -extern GLint __glColorTableParameteriv_size(GLenum pname); -extern GLint __glConvolutionParameterfv_size(GLenum pname); -extern GLint __glConvolutionParameteriv_size(GLenum pname); -extern GLint __glFogfv_size(GLenum pname); -extern GLint __glFogiv_size(GLenum pname); -extern GLint __glLightModelfv_size(GLenum pname); -extern GLint __glLightModeliv_size(GLenum pname); -extern GLint __glLightfv_size(GLenum pname); -extern GLint __glLightiv_size(GLenum pname); -extern GLint __glMaterialfv_size(GLenum pname); -extern GLint __glMaterialiv_size(GLenum pname); -extern GLint __glTexEnvfv_size(GLenum e); -extern GLint __glTexEnviv_size(GLenum e); -extern GLint __glTexGendv_size(GLenum e); -extern GLint __glTexGenfv_size(GLenum e); -extern GLint __glTexGeniv_size(GLenum e); -extern GLint __glTexParameterfv_size(GLenum e); -extern GLint __glTexParameteriv_size(GLenum e); - -extern GLint __glCallLists_size(GLsizei n, GLenum type); -extern GLint __glDrawPixels_size(GLenum format, GLenum type, GLsizei w, GLsizei h); -extern GLint __glBitmap_size(GLsizei w, GLsizei h); -extern GLint __glTexImage1D_size(GLenum format, GLenum type, GLsizei w); -extern GLint __glTexImage2D_size(GLenum format, GLenum type, GLsizei w, GLsizei h); -extern GLint __glTexImage3D_size(GLenum format, GLenum type, GLsizei w, GLsizei h, GLsizei d); - -#endif /* !__compsize_h__ */ diff --git a/hw/dmx/glxProxy/g_disptab.c b/hw/dmx/glxProxy/g_disptab.c deleted file mode 100644 index 46177c4cc..000000000 --- a/hw/dmx/glxProxy/g_disptab.c +++ /dev/null @@ -1,610 +0,0 @@ -/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" -#include "glxext.h" -#include "g_disptab.h" -#include "glxsingle.h" - -__GLXdispatchSingleProcPtr __glXSingleTable[] = { - __glXNoSuchSingleOpcode, - __glXRender, - __glXRenderLarge, - __glXCreateContext, - __glXDestroyContext, - __glXMakeCurrent, - __glXIsDirect, - __glXQueryVersion, - __glXWaitGL, - __glXWaitX, - __glXCopyContext, - __glXSwapBuffers, - __glXUseXFont, - __glXCreateGLXPixmap, - __glXGetVisualConfigs, - __glXDestroyGLXPixmap, - __glXVendorPrivate, - __glXVendorPrivateWithReply, - __glXQueryExtensionsString, - __glXQueryServerString, - __glXClientInfo, - __glXGetFBConfigs, /* __glXGetFBConfigs */ - __glXCreatePixmap, /* __glXCreatePixmap, */ - __glXDestroyGLXPixmap, /* __glXDestroyPixmap, */ - __glXCreateNewContext, /* __glXCreateNewContext, */ - __glXQueryContext, /* __glXQueryContext, */ - __glXMakeContextCurrent, /* __glXMakeContextCurrent, */ - __glXCreatePbuffer, /* __glXCreatePbuffer, */ - __glXDestroyPbuffer, /* __glXDestroyPbuffer, */ - __glXGetDrawableAttributes, /* __glXGetDrawableAttributes, */ - __glXChangeDrawableAttributes, /* __glXChangeDrawableAttributes, */ - __glXCreateWindow, /* __glXCreateWindow, */ - __glXDestroyWindow, /* __glXDestroyWindow, */ - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXForwardSingleReq, /* __glXDisp_NewList, */ - __glXForwardSingleReq, /* __glXDisp_EndList, */ - __glXForwardSingleReq, /* __glXDisp_DeleteLists, */ - __glXForwardPipe0WithReply, /* __glXDisp_GenLists, */ - __glXForwardSingleReq, /* __glXDisp_FeedbackBuffer, */ - __glXForwardSingleReq, /* __glXDisp_SelectBuffer, */ - __glXForwardAllWithReply, /* __glXDisp_RenderMode, */ - __glXForwardAllWithReply, /* __glXDisp_Finish, */ - __glXForwardSingleReq, /* __glXDisp_PixelStoref, */ - __glXForwardSingleReq, /* __glXDisp_PixelStorei, */ - __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetBooleanv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetClipPlane, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetDoublev, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetError, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetFloatv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetIntegerv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetLightfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetLightiv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMapdv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMapfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMapiv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMaterialiv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapuiv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetPixelMapusv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetPolygonStipple, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetString, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnvfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexEnviv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexGendv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexGenfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexGeniv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexImage, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameterfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexParameteriv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameterfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetTexLevelParameteriv, */ - __glXForwardPipe0WithReply, /* __glXDisp_IsEnabled, */ - __glXForwardPipe0WithReply, /* __glXDisp_IsList, */ - __glXForwardSingleReq, /* __glXDisp_Flush, */ - __glXForwardPipe0WithReply, /* __glXDisp_AreTexturesResident, */ - __glXForwardSingleReq, /* __glXDisp_DeleteTextures, */ - __glXForwardAllWithReply, /* __glXDisp_GenTextures, */ - __glXForwardPipe0WithReply, /* __glXDisp_IsTexture, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetColorTable, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameterfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetColorTableParameteriv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionFilter, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameterfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetConvolutionParameteriv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetSeparableFilter, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetHistogram, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameterfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetHistogramParameteriv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMinmax, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameterfv, */ - __glXForwardPipe0WithReply, /* __glXDisp_GetMinmaxParameteriv, */ -}; - -__GLXdispatchSingleProcPtr __glXSwapSingleTable[] = { - __glXNoSuchSingleOpcode, - __glXSwapRender, - __glXSwapRenderLarge, - __glXSwapCreateContext, - __glXSwapDestroyContext, - __glXSwapMakeCurrent, - __glXSwapIsDirect, - __glXSwapQueryVersion, - __glXSwapWaitGL, - __glXSwapWaitX, - __glXSwapCopyContext, - __glXSwapSwapBuffers, - __glXSwapUseXFont, - __glXSwapCreateGLXPixmap, - __glXSwapGetVisualConfigs, - __glXSwapDestroyGLXPixmap, - __glXSwapVendorPrivate, - __glXSwapVendorPrivateWithReply, - __glXSwapQueryExtensionsString, - __glXSwapQueryServerString, - __glXSwapClientInfo, - __glXSwapGetFBConfigs, - __glXSwapCreatePixmap, - __glXSwapDestroyGLXPixmap, - __glXSwapCreateNewContext, - __glXSwapQueryContext, - __glXSwapMakeContextCurrent, - __glXSwapCreatePbuffer, - __glXSwapDestroyPbuffer, - __glXSwapGetDrawableAttributes, - __glXSwapChangeDrawableAttributes, - __glXSwapCreateWindow, - __glXSwapDestroyWindow, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXNoSuchSingleOpcode, - __glXForwardSingleReqSwap, /* __glXDisp_NewList, */ - __glXForwardSingleReqSwap, /* __glXDisp_EndList, */ - __glXForwardSingleReqSwap, /* __glXDisp_DeleteLists, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_GenLists, */ - __glXForwardSingleReqSwap, /* __glXDisp_FeedbackBuffer, */ - __glXForwardSingleReqSwap, /* __glXDisp_SelectBuffer, */ - __glXForwardAllWithReplySwapiv, /* __glXDisp_RenderMode, */ - __glXForwardAllWithReplySwap, /* __glXDisp_Finish, */ - __glXForwardSingleReqSwap, /* __glXDisp_PixelStoref, */ - __glXForwardSingleReqSwap, /* __glXDisp_PixelStorei, */ - __glXDisp_ReadPixels, /* __glXDisp_ReadPixels, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_GetBooleanv, */ - __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetClipPlane, */ - __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetDoublev, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_GetError, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetFloatv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetIntegerv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetLightiv, */ - __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetMapdv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMapiv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMaterialiv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetPixelMapuiv, */ - __glXForwardPipe0WithReplySwapsv, /* __glXDisp_GetPixelMapusv, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_GetPolygonStipple, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_GetString, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnvfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexEnviv, */ - __glXForwardPipe0WithReplySwapdv, /* __glXDisp_GetTexGendv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGenfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexGeniv, */ - __glXDispSwap_GetTexImage, /* __glXDisp_GetTexImage, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameterfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexParameteriv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameterfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetTexLevelParameteriv, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_IsEnabled, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_IsList, */ - __glXForwardSingleReqSwap, /* __glXDisp_Flush, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_AreTexturesResident, */ - __glXForwardSingleReqSwap, /* __glXDisp_DeleteTextures, */ - __glXForwardAllWithReplySwapiv, /* __glXDisp_GenTextures, */ - __glXForwardPipe0WithReplySwap, /* __glXDisp_IsTexture, */ - __glXDispSwap_GetColorTable, /* __glXDisp_GetColorTable, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameterfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetColorTableParameteriv, */ - __glXDispSwap_GetColorTable, /* __glXDisp_GetConvolutionFilter, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameterfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetConvolutionParameteriv, */ - __glXDispSwap_GetColorTable, /* __glXDisp_GetSeparableFilter, */ - __glXDispSwap_GetColorTable, /* __glXDisp_GetHistogram, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameterfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetHistogramParameteriv, */ - __glXDispSwap_GetColorTable, /* __glXDisp_GetMinmax, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameterfv, */ - __glXForwardPipe0WithReplySwapiv, /* __glXDisp_GetMinmaxParameteriv, */ -}; - -__GLXdispatchRenderProcPtr __glXSwapRenderTable[] = { - __glXNoSuchRenderOpcode, - __glXDispSwap_CallList, - __glXDispSwap_CallLists, - __glXDispSwap_ListBase, - __glXDispSwap_Begin, - __glXDispSwap_Bitmap, - __glXDispSwap_Color3bv, - __glXDispSwap_Color3dv, - __glXDispSwap_Color3fv, - __glXDispSwap_Color3iv, - __glXDispSwap_Color3sv, - __glXDispSwap_Color3ubv, - __glXDispSwap_Color3uiv, - __glXDispSwap_Color3usv, - __glXDispSwap_Color4bv, - __glXDispSwap_Color4dv, - __glXDispSwap_Color4fv, - __glXDispSwap_Color4iv, - __glXDispSwap_Color4sv, - __glXDispSwap_Color4ubv, - __glXDispSwap_Color4uiv, - __glXDispSwap_Color4usv, - __glXDispSwap_EdgeFlagv, - __glXDispSwap_End, - __glXDispSwap_Indexdv, - __glXDispSwap_Indexfv, - __glXDispSwap_Indexiv, - __glXDispSwap_Indexsv, - __glXDispSwap_Normal3bv, - __glXDispSwap_Normal3dv, - __glXDispSwap_Normal3fv, - __glXDispSwap_Normal3iv, - __glXDispSwap_Normal3sv, - __glXDispSwap_RasterPos2dv, - __glXDispSwap_RasterPos2fv, - __glXDispSwap_RasterPos2iv, - __glXDispSwap_RasterPos2sv, - __glXDispSwap_RasterPos3dv, - __glXDispSwap_RasterPos3fv, - __glXDispSwap_RasterPos3iv, - __glXDispSwap_RasterPos3sv, - __glXDispSwap_RasterPos4dv, - __glXDispSwap_RasterPos4fv, - __glXDispSwap_RasterPos4iv, - __glXDispSwap_RasterPos4sv, - __glXDispSwap_Rectdv, - __glXDispSwap_Rectfv, - __glXDispSwap_Rectiv, - __glXDispSwap_Rectsv, - __glXDispSwap_TexCoord1dv, - __glXDispSwap_TexCoord1fv, - __glXDispSwap_TexCoord1iv, - __glXDispSwap_TexCoord1sv, - __glXDispSwap_TexCoord2dv, - __glXDispSwap_TexCoord2fv, - __glXDispSwap_TexCoord2iv, - __glXDispSwap_TexCoord2sv, - __glXDispSwap_TexCoord3dv, - __glXDispSwap_TexCoord3fv, - __glXDispSwap_TexCoord3iv, - __glXDispSwap_TexCoord3sv, - __glXDispSwap_TexCoord4dv, - __glXDispSwap_TexCoord4fv, - __glXDispSwap_TexCoord4iv, - __glXDispSwap_TexCoord4sv, - __glXDispSwap_Vertex2dv, - __glXDispSwap_Vertex2fv, - __glXDispSwap_Vertex2iv, - __glXDispSwap_Vertex2sv, - __glXDispSwap_Vertex3dv, - __glXDispSwap_Vertex3fv, - __glXDispSwap_Vertex3iv, - __glXDispSwap_Vertex3sv, - __glXDispSwap_Vertex4dv, - __glXDispSwap_Vertex4fv, - __glXDispSwap_Vertex4iv, - __glXDispSwap_Vertex4sv, - __glXDispSwap_ClipPlane, - __glXDispSwap_ColorMaterial, - __glXDispSwap_CullFace, - __glXDispSwap_Fogf, - __glXDispSwap_Fogfv, - __glXDispSwap_Fogi, - __glXDispSwap_Fogiv, - __glXDispSwap_FrontFace, - __glXDispSwap_Hint, - __glXDispSwap_Lightf, - __glXDispSwap_Lightfv, - __glXDispSwap_Lighti, - __glXDispSwap_Lightiv, - __glXDispSwap_LightModelf, - __glXDispSwap_LightModelfv, - __glXDispSwap_LightModeli, - __glXDispSwap_LightModeliv, - __glXDispSwap_LineStipple, - __glXDispSwap_LineWidth, - __glXDispSwap_Materialf, - __glXDispSwap_Materialfv, - __glXDispSwap_Materiali, - __glXDispSwap_Materialiv, - __glXDispSwap_PointSize, - __glXDispSwap_PolygonMode, - __glXDispSwap_PolygonStipple, - __glXDispSwap_Scissor, - __glXDispSwap_ShadeModel, - __glXDispSwap_TexParameterf, - __glXDispSwap_TexParameterfv, - __glXDispSwap_TexParameteri, - __glXDispSwap_TexParameteriv, - __glXDispSwap_TexImage1D, - __glXDispSwap_TexImage2D, - __glXDispSwap_TexEnvf, - __glXDispSwap_TexEnvfv, - __glXDispSwap_TexEnvi, - __glXDispSwap_TexEnviv, - __glXDispSwap_TexGend, - __glXDispSwap_TexGendv, - __glXDispSwap_TexGenf, - __glXDispSwap_TexGenfv, - __glXDispSwap_TexGeni, - __glXDispSwap_TexGeniv, - __glXDispSwap_InitNames, - __glXDispSwap_LoadName, - __glXDispSwap_PassThrough, - __glXDispSwap_PopName, - __glXDispSwap_PushName, - __glXDispSwap_DrawBuffer, - __glXDispSwap_Clear, - __glXDispSwap_ClearAccum, - __glXDispSwap_ClearIndex, - __glXDispSwap_ClearColor, - __glXDispSwap_ClearStencil, - __glXDispSwap_ClearDepth, - __glXDispSwap_StencilMask, - __glXDispSwap_ColorMask, - __glXDispSwap_DepthMask, - __glXDispSwap_IndexMask, - __glXDispSwap_Accum, - __glXDispSwap_Disable, - __glXDispSwap_Enable, - __glXNoSuchRenderOpcode, - __glXDispSwap_PopAttrib, - __glXDispSwap_PushAttrib, - __glXDispSwap_Map1d, - __glXDispSwap_Map1f, - __glXDispSwap_Map2d, - __glXDispSwap_Map2f, - __glXDispSwap_MapGrid1d, - __glXDispSwap_MapGrid1f, - __glXDispSwap_MapGrid2d, - __glXDispSwap_MapGrid2f, - __glXDispSwap_EvalCoord1dv, - __glXDispSwap_EvalCoord1fv, - __glXDispSwap_EvalCoord2dv, - __glXDispSwap_EvalCoord2fv, - __glXDispSwap_EvalMesh1, - __glXDispSwap_EvalPoint1, - __glXDispSwap_EvalMesh2, - __glXDispSwap_EvalPoint2, - __glXDispSwap_AlphaFunc, - __glXDispSwap_BlendFunc, - __glXDispSwap_LogicOp, - __glXDispSwap_StencilFunc, - __glXDispSwap_StencilOp, - __glXDispSwap_DepthFunc, - __glXDispSwap_PixelZoom, - __glXDispSwap_PixelTransferf, - __glXDispSwap_PixelTransferi, - __glXDispSwap_PixelMapfv, - __glXDispSwap_PixelMapuiv, - __glXDispSwap_PixelMapusv, - __glXDispSwap_ReadBuffer, - __glXDispSwap_CopyPixels, - __glXDispSwap_DrawPixels, - __glXDispSwap_DepthRange, - __glXDispSwap_Frustum, - __glXDispSwap_LoadIdentity, - __glXDispSwap_LoadMatrixf, - __glXDispSwap_LoadMatrixd, - __glXDispSwap_MatrixMode, - __glXDispSwap_MultMatrixf, - __glXDispSwap_MultMatrixd, - __glXDispSwap_Ortho, - __glXDispSwap_PopMatrix, - __glXDispSwap_PushMatrix, - __glXDispSwap_Rotated, - __glXDispSwap_Rotatef, - __glXDispSwap_Scaled, - __glXDispSwap_Scalef, - __glXDispSwap_Translated, - __glXDispSwap_Translatef, - __glXDispSwap_Viewport, - __glXDispSwap_PolygonOffset, - __glXDispSwap_DrawArrays, - __glXDispSwap_Indexubv, - __glXDispSwap_ColorSubTable, - __glXDispSwap_CopyColorSubTable, - __glXDispSwap_ActiveTextureARB, - __glXDispSwap_MultiTexCoord1dvARB, - __glXDispSwap_MultiTexCoord1fvARB, - __glXDispSwap_MultiTexCoord1ivARB, - __glXDispSwap_MultiTexCoord1svARB, - __glXDispSwap_MultiTexCoord2dvARB, - __glXDispSwap_MultiTexCoord2fvARB, - __glXDispSwap_MultiTexCoord2ivARB, - __glXDispSwap_MultiTexCoord2svARB, - __glXDispSwap_MultiTexCoord3dvARB, - __glXDispSwap_MultiTexCoord3fvARB, - __glXDispSwap_MultiTexCoord3ivARB, - __glXDispSwap_MultiTexCoord3svARB, - __glXDispSwap_MultiTexCoord4dvARB, - __glXDispSwap_MultiTexCoord4fvARB, - __glXDispSwap_MultiTexCoord4ivARB, - __glXDispSwap_MultiTexCoord4svARB, -}; - -__GLXRenderSwapInfo __glXSwapRenderTable_EXT[] = { - {4, 4, NULL}, /* X_GLrop_BlendColorEXT */ - {4, 1, NULL}, /* X_GLrop_BlendEquationEXT */ - {4, 2, NULL}, /* X_GLrop_PolygonOffsetEXT */ - {4, 0, __glXDispSwap_TexSubImage1D}, /* X_GLrop_TexSubImage1DEXT */ - {4, 0, __glXDispSwap_TexSubImage2D}, /* X_GLrop_TexSubImage2DEXT */ - {4, 0, __glXDispSwap_ConvolutionFilter1D}, /* X_GLrop_ConvolutionFilter1DEXT */ - {4, 0, __glXDispSwap_ConvolutionFilter2D}, /* X_GLrop_ConvolutionFilter2DEXT */ - {4, 3, NULL}, /* X_GLrop_ConvolutionParameterfEXT */ - {4, 0, __glXDispSwap_ConvolutionParameterfv}, /* X_GLrop_ConvolutionParameterfvEXT */ - {4, 3, NULL}, /* X_GLrop_ConvolutionParameteriEXT */ - {4, 0, __glXDispSwap_ConvolutionParameteriv}, /* X_GLrop_ConvolutionParameterivEXT */ - {4, 0, __glXDispSwap_CopyConvolutionFilter1D}, /* X_GLrop_CopyConvolutionFilter1DEXT */ - {4, 0, __glXDispSwap_CopyConvolutionFilter2D}, /* X_GLrop_CopyConvolutionFilter2DEXT */ - {4, 0, __glXDispSwap_SeparableFilter2D}, /* X_GLrop_SeparableFilter2DEXT */ - {4, 3, NULL}, /* X_GLrop_HistogramEXT */ - {4, 2, NULL}, /* X_GLrop_MinmaxEXT */ - {4, 1, NULL}, /* X_GLrop_ResetHistogramEXT */ - {4, 1, NULL}, /* X_GLrop_ResetMinmaxEXT */ - {4, 0, __glXDispSwap_TexImage3D}, /* X_GLrop_TexImage3DEXT */ - {4, 0, __glXDispSwap_TexSubImage3D}, /* X_GLrop_TexSubImage3DEXT */ - {4, 0, __glXDispSwap_DrawArrays}, /* X_GLrop_DrawArraysEXT */ - {4, 2, NULL}, /* X_GLrop_BindTextureEXT */ - {4, 0, __glXDispSwap_PrioritizeTextures}, /* X_GLrop_PrioritizeTexturesEXT */ - {4, 0, __glXDispSwap_CopyTexImage1D}, /* X_GLrop_CopyTexImage1DEXT */ - {4, 0, __glXDispSwap_CopyTexImage2D}, /* X_GLrop_CopyTexImage2DEXT */ - {4, 0, __glXDispSwap_CopyTexSubImage1D}, /* X_GLrop_CopyTexSubImage1DEXT */ - {4, 0, __glXDispSwap_CopyTexSubImage2D}, /* X_GLrop_CopyTexSubImage2DEXT */ - {4, 0, __glXDispSwap_CopyTexSubImage3D}, /* X_GLrop_CopyTexSubImage3DEXT */ - -}; diff --git a/hw/dmx/glxProxy/g_disptab.h b/hw/dmx/glxProxy/g_disptab.h deleted file mode 100644 index 783f87a54..000000000 --- a/hw/dmx/glxProxy/g_disptab.h +++ /dev/null @@ -1,699 +0,0 @@ -/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -#ifndef _GLX_g_disptab_h_ -#define _GLX_g_disptab_h_ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -extern int __glXRender(__GLXclientState *, GLbyte *); -extern int __glXRenderLarge(__GLXclientState *, GLbyte *); -extern int __glXSendLargeCommand(__GLXclientState * cl, - GLXContextTag contextTag); -extern int __glXCreateContext(__GLXclientState *, GLbyte *); -extern int __glXCreateNewContext(__GLXclientState * cl, GLbyte * pc); -extern int __glXDestroyContext(__GLXclientState *, GLbyte *); -extern int __glXMakeCurrent(__GLXclientState *, GLbyte *); -extern int __glXMakeContextCurrent(__GLXclientState *, GLbyte *); -extern int __glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc); -extern int __glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc); -extern int __glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc); -extern int __glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc); -extern int __glXIsDirect(__GLXclientState *, GLbyte *); -extern int __glXQueryVersion(__GLXclientState *, GLbyte *); -extern int __glXWaitGL(__GLXclientState *, GLbyte *); -extern int __glXWaitX(__GLXclientState *, GLbyte *); -extern int __glXCopyContext(__GLXclientState *, GLbyte *); -extern int __glXSwapBuffers(__GLXclientState *, GLbyte *); -extern int __glXUseXFont(__GLXclientState *, GLbyte *); -extern int __glXCreateGLXPixmap(__GLXclientState *, GLbyte *); -extern int __glXCreatePixmap(__GLXclientState * cl, GLbyte * pc); -extern int __glXGetVisualConfigs(__GLXclientState *, GLbyte *); -extern int __glXDestroyGLXPixmap(__GLXclientState *, GLbyte *); -extern int __glXVendorPrivate(__GLXclientState *, GLbyte *); -extern int __glXVendorPrivateWithReply(__GLXclientState *, GLbyte *); -extern int __glXQueryExtensionsString(__GLXclientState *, GLbyte *); -extern int __glXQueryServerString(__GLXclientState *, GLbyte *); -extern int __glXClientInfo(__GLXclientState *, GLbyte *); -extern int __glXGetFBConfigs(__GLXclientState *, GLbyte *); -extern int __glXCreateWindow(__GLXclientState * cl, GLbyte * pc); -extern int __glXDestroyWindow(__GLXclientState * cl, GLbyte * pc); -extern int __glXQueryContext(__GLXclientState * cl, GLbyte * pc); -extern int __glXDisp_NewList(__GLXclientState *, GLbyte *); -extern int __glXDisp_EndList(__GLXclientState *, GLbyte *); -extern int __glXDisp_DeleteLists(__GLXclientState *, GLbyte *); -extern int __glXDisp_GenLists(__GLXclientState *, GLbyte *); -extern int __glXDisp_FeedbackBuffer(__GLXclientState *, GLbyte *); -extern int __glXDisp_SelectBuffer(__GLXclientState *, GLbyte *); -extern int __glXDisp_RenderMode(__GLXclientState *, GLbyte *); -extern int __glXDisp_Finish(__GLXclientState *, GLbyte *); -extern int __glXDisp_PixelStoref(__GLXclientState *, GLbyte *); -extern int __glXDisp_PixelStorei(__GLXclientState *, GLbyte *); -extern int __glXDisp_ReadPixels(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetBooleanv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetClipPlane(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetDoublev(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetError(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetFloatv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetIntegerv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetLightfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetLightiv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMapdv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMapfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMapiv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMaterialfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMaterialiv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetPixelMapfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetPixelMapuiv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetPixelMapusv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetPolygonStipple(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetString(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexEnvfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexEnviv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexGendv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexGenfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexGeniv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexImage(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexLevelParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetTexLevelParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDisp_IsEnabled(__GLXclientState *, GLbyte *); -extern int __glXDisp_IsList(__GLXclientState *, GLbyte *); -extern int __glXDisp_Flush(__GLXclientState *, GLbyte *); -extern int __glXDisp_AreTexturesResident(__GLXclientState *, GLbyte *); -extern int __glXDisp_DeleteTextures(__GLXclientState *, GLbyte *); -extern int __glXDisp_GenTextures(__GLXclientState *, GLbyte *); -extern int __glXDisp_IsTexture(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetColorTable(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetColorTableParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetColorTableParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetConvolutionFilter(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetConvolutionParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetConvolutionParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetSeparableFilter(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetHistogram(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetHistogramParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetHistogramParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMinmax(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMinmaxParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDisp_GetMinmaxParameteriv(__GLXclientState *, GLbyte *); - -extern void __glXDisp_CallList(GLbyte *); -extern void __glXDisp_CallLists(GLbyte *); -extern void __glXDisp_ListBase(GLbyte *); -extern void __glXDisp_Begin(GLbyte *); -extern void __glXDisp_Bitmap(GLbyte *); -extern void __glXDisp_Color3bv(GLbyte *); -extern void __glXDisp_Color3dv(GLbyte *); -extern void __glXDisp_Color3fv(GLbyte *); -extern void __glXDisp_Color3iv(GLbyte *); -extern void __glXDisp_Color3sv(GLbyte *); -extern void __glXDisp_Color3ubv(GLbyte *); -extern void __glXDisp_Color3uiv(GLbyte *); -extern void __glXDisp_Color3usv(GLbyte *); -extern void __glXDisp_Color4bv(GLbyte *); -extern void __glXDisp_Color4dv(GLbyte *); -extern void __glXDisp_Color4fv(GLbyte *); -extern void __glXDisp_Color4iv(GLbyte *); -extern void __glXDisp_Color4sv(GLbyte *); -extern void __glXDisp_Color4ubv(GLbyte *); -extern void __glXDisp_Color4uiv(GLbyte *); -extern void __glXDisp_Color4usv(GLbyte *); -extern void __glXDisp_EdgeFlagv(GLbyte *); -extern void __glXDisp_End(GLbyte *); -extern void __glXDisp_Indexdv(GLbyte *); -extern void __glXDisp_Indexfv(GLbyte *); -extern void __glXDisp_Indexiv(GLbyte *); -extern void __glXDisp_Indexsv(GLbyte *); -extern void __glXDisp_Normal3bv(GLbyte *); -extern void __glXDisp_Normal3dv(GLbyte *); -extern void __glXDisp_Normal3fv(GLbyte *); -extern void __glXDisp_Normal3iv(GLbyte *); -extern void __glXDisp_Normal3sv(GLbyte *); -extern void __glXDisp_RasterPos2dv(GLbyte *); -extern void __glXDisp_RasterPos2fv(GLbyte *); -extern void __glXDisp_RasterPos2iv(GLbyte *); -extern void __glXDisp_RasterPos2sv(GLbyte *); -extern void __glXDisp_RasterPos3dv(GLbyte *); -extern void __glXDisp_RasterPos3fv(GLbyte *); -extern void __glXDisp_RasterPos3iv(GLbyte *); -extern void __glXDisp_RasterPos3sv(GLbyte *); -extern void __glXDisp_RasterPos4dv(GLbyte *); -extern void __glXDisp_RasterPos4fv(GLbyte *); -extern void __glXDisp_RasterPos4iv(GLbyte *); -extern void __glXDisp_RasterPos4sv(GLbyte *); -extern void __glXDisp_Rectdv(GLbyte *); -extern void __glXDisp_Rectfv(GLbyte *); -extern void __glXDisp_Rectiv(GLbyte *); -extern void __glXDisp_Rectsv(GLbyte *); -extern void __glXDisp_TexCoord1dv(GLbyte *); -extern void __glXDisp_TexCoord1fv(GLbyte *); -extern void __glXDisp_TexCoord1iv(GLbyte *); -extern void __glXDisp_TexCoord1sv(GLbyte *); -extern void __glXDisp_TexCoord2dv(GLbyte *); -extern void __glXDisp_TexCoord2fv(GLbyte *); -extern void __glXDisp_TexCoord2iv(GLbyte *); -extern void __glXDisp_TexCoord2sv(GLbyte *); -extern void __glXDisp_TexCoord3dv(GLbyte *); -extern void __glXDisp_TexCoord3fv(GLbyte *); -extern void __glXDisp_TexCoord3iv(GLbyte *); -extern void __glXDisp_TexCoord3sv(GLbyte *); -extern void __glXDisp_TexCoord4dv(GLbyte *); -extern void __glXDisp_TexCoord4fv(GLbyte *); -extern void __glXDisp_TexCoord4iv(GLbyte *); -extern void __glXDisp_TexCoord4sv(GLbyte *); -extern void __glXDisp_Vertex2dv(GLbyte *); -extern void __glXDisp_Vertex2fv(GLbyte *); -extern void __glXDisp_Vertex2iv(GLbyte *); -extern void __glXDisp_Vertex2sv(GLbyte *); -extern void __glXDisp_Vertex3dv(GLbyte *); -extern void __glXDisp_Vertex3fv(GLbyte *); -extern void __glXDisp_Vertex3iv(GLbyte *); -extern void __glXDisp_Vertex3sv(GLbyte *); -extern void __glXDisp_Vertex4dv(GLbyte *); -extern void __glXDisp_Vertex4fv(GLbyte *); -extern void __glXDisp_Vertex4iv(GLbyte *); -extern void __glXDisp_Vertex4sv(GLbyte *); -extern void __glXDisp_ClipPlane(GLbyte *); -extern void __glXDisp_ColorMaterial(GLbyte *); -extern void __glXDisp_CullFace(GLbyte *); -extern void __glXDisp_Fogf(GLbyte *); -extern void __glXDisp_Fogfv(GLbyte *); -extern void __glXDisp_Fogi(GLbyte *); -extern void __glXDisp_Fogiv(GLbyte *); -extern void __glXDisp_FrontFace(GLbyte *); -extern void __glXDisp_Hint(GLbyte *); -extern void __glXDisp_Lightf(GLbyte *); -extern void __glXDisp_Lightfv(GLbyte *); -extern void __glXDisp_Lighti(GLbyte *); -extern void __glXDisp_Lightiv(GLbyte *); -extern void __glXDisp_LightModelf(GLbyte *); -extern void __glXDisp_LightModelfv(GLbyte *); -extern void __glXDisp_LightModeli(GLbyte *); -extern void __glXDisp_LightModeliv(GLbyte *); -extern void __glXDisp_LineStipple(GLbyte *); -extern void __glXDisp_LineWidth(GLbyte *); -extern void __glXDisp_Materialf(GLbyte *); -extern void __glXDisp_Materialfv(GLbyte *); -extern void __glXDisp_Materiali(GLbyte *); -extern void __glXDisp_Materialiv(GLbyte *); -extern void __glXDisp_PointSize(GLbyte *); -extern void __glXDisp_PolygonMode(GLbyte *); -extern void __glXDisp_PolygonStipple(GLbyte *); -extern void __glXDisp_Scissor(GLbyte *); -extern void __glXDisp_ShadeModel(GLbyte *); -extern void __glXDisp_TexParameterf(GLbyte *); -extern void __glXDisp_TexParameterfv(GLbyte *); -extern void __glXDisp_TexParameteri(GLbyte *); -extern void __glXDisp_TexParameteriv(GLbyte *); -extern void __glXDisp_TexImage1D(GLbyte *); -extern void __glXDisp_TexImage2D(GLbyte *); -extern void __glXDisp_TexEnvf(GLbyte *); -extern void __glXDisp_TexEnvfv(GLbyte *); -extern void __glXDisp_TexEnvi(GLbyte *); -extern void __glXDisp_TexEnviv(GLbyte *); -extern void __glXDisp_TexGend(GLbyte *); -extern void __glXDisp_TexGendv(GLbyte *); -extern void __glXDisp_TexGenf(GLbyte *); -extern void __glXDisp_TexGenfv(GLbyte *); -extern void __glXDisp_TexGeni(GLbyte *); -extern void __glXDisp_TexGeniv(GLbyte *); -extern void __glXDisp_InitNames(GLbyte *); -extern void __glXDisp_LoadName(GLbyte *); -extern void __glXDisp_PassThrough(GLbyte *); -extern void __glXDisp_PopName(GLbyte *); -extern void __glXDisp_PushName(GLbyte *); -extern void __glXDisp_DrawBuffer(GLbyte *); -extern void __glXDisp_Clear(GLbyte *); -extern void __glXDisp_ClearAccum(GLbyte *); -extern void __glXDisp_ClearIndex(GLbyte *); -extern void __glXDisp_ClearColor(GLbyte *); -extern void __glXDisp_ClearStencil(GLbyte *); -extern void __glXDisp_ClearDepth(GLbyte *); -extern void __glXDisp_StencilMask(GLbyte *); -extern void __glXDisp_ColorMask(GLbyte *); -extern void __glXDisp_DepthMask(GLbyte *); -extern void __glXDisp_IndexMask(GLbyte *); -extern void __glXDisp_Accum(GLbyte *); -extern void __glXDisp_Disable(GLbyte *); -extern void __glXDisp_Enable(GLbyte *); -extern void __glXDisp_PopAttrib(GLbyte *); -extern void __glXDisp_PushAttrib(GLbyte *); -extern void __glXDisp_Map1d(GLbyte *); -extern void __glXDisp_Map1f(GLbyte *); -extern void __glXDisp_Map2d(GLbyte *); -extern void __glXDisp_Map2f(GLbyte *); -extern void __glXDisp_MapGrid1d(GLbyte *); -extern void __glXDisp_MapGrid1f(GLbyte *); -extern void __glXDisp_MapGrid2d(GLbyte *); -extern void __glXDisp_MapGrid2f(GLbyte *); -extern void __glXDisp_EvalCoord1dv(GLbyte *); -extern void __glXDisp_EvalCoord1fv(GLbyte *); -extern void __glXDisp_EvalCoord2dv(GLbyte *); -extern void __glXDisp_EvalCoord2fv(GLbyte *); -extern void __glXDisp_EvalMesh1(GLbyte *); -extern void __glXDisp_EvalPoint1(GLbyte *); -extern void __glXDisp_EvalMesh2(GLbyte *); -extern void __glXDisp_EvalPoint2(GLbyte *); -extern void __glXDisp_AlphaFunc(GLbyte *); -extern void __glXDisp_BlendFunc(GLbyte *); -extern void __glXDisp_LogicOp(GLbyte *); -extern void __glXDisp_StencilFunc(GLbyte *); -extern void __glXDisp_StencilOp(GLbyte *); -extern void __glXDisp_DepthFunc(GLbyte *); -extern void __glXDisp_PixelZoom(GLbyte *); -extern void __glXDisp_PixelTransferf(GLbyte *); -extern void __glXDisp_PixelTransferi(GLbyte *); -extern void __glXDisp_PixelMapfv(GLbyte *); -extern void __glXDisp_PixelMapuiv(GLbyte *); -extern void __glXDisp_PixelMapusv(GLbyte *); -extern void __glXDisp_ReadBuffer(GLbyte *); -extern void __glXDisp_CopyPixels(GLbyte *); -extern void __glXDisp_DrawPixels(GLbyte *); -extern void __glXDisp_DepthRange(GLbyte *); -extern void __glXDisp_Frustum(GLbyte *); -extern void __glXDisp_LoadIdentity(GLbyte *); -extern void __glXDisp_LoadMatrixf(GLbyte *); -extern void __glXDisp_LoadMatrixd(GLbyte *); -extern void __glXDisp_MatrixMode(GLbyte *); -extern void __glXDisp_MultMatrixf(GLbyte *); -extern void __glXDisp_MultMatrixd(GLbyte *); -extern void __glXDisp_Ortho(GLbyte *); -extern void __glXDisp_PopMatrix(GLbyte *); -extern void __glXDisp_PushMatrix(GLbyte *); -extern void __glXDisp_Rotated(GLbyte *); -extern void __glXDisp_Rotatef(GLbyte *); -extern void __glXDisp_Scaled(GLbyte *); -extern void __glXDisp_Scalef(GLbyte *); -extern void __glXDisp_Translated(GLbyte *); -extern void __glXDisp_Translatef(GLbyte *); -extern void __glXDisp_Viewport(GLbyte *); -extern void __glXDisp_PolygonOffset(GLbyte *); -extern void __glXDisp_DrawArrays(GLbyte *); -extern void __glXDisp_Indexubv(GLbyte *); -extern void __glXDisp_ColorSubTable(GLbyte *); -extern void __glXDisp_CopyColorSubTable(GLbyte *); -extern void __glXDisp_ActiveTextureARB(GLbyte *); -extern void __glXDisp_MultiTexCoord1dvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord1fvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord1ivARB(GLbyte *); -extern void __glXDisp_MultiTexCoord1svARB(GLbyte *); -extern void __glXDisp_MultiTexCoord2dvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord2fvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord2ivARB(GLbyte *); -extern void __glXDisp_MultiTexCoord2svARB(GLbyte *); -extern void __glXDisp_MultiTexCoord3dvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord3fvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord3ivARB(GLbyte *); -extern void __glXDisp_MultiTexCoord3svARB(GLbyte *); -extern void __glXDisp_MultiTexCoord4dvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord4fvARB(GLbyte *); -extern void __glXDisp_MultiTexCoord4ivARB(GLbyte *); -extern void __glXDisp_MultiTexCoord4svARB(GLbyte *); - -extern int __glXSwapRender(__GLXclientState *, GLbyte *); -extern int __glXSwapRenderLarge(__GLXclientState *, GLbyte *); -extern int __glXSwapCreateContext(__GLXclientState *, GLbyte *); -extern int __glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapDestroyContext(__GLXclientState *, GLbyte *); -extern int __glXSwapMakeCurrent(__GLXclientState *, GLbyte *); -extern int __glXSwapMakeContextCurrent(__GLXclientState *, GLbyte *); -extern int __glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapChangeDrawableAttributes(__GLXclientState * cl, - GLbyte * pc); -extern int __glXSwapIsDirect(__GLXclientState *, GLbyte *); -extern int __glXSwapQueryVersion(__GLXclientState *, GLbyte *); -extern int __glXSwapWaitGL(__GLXclientState *, GLbyte *); -extern int __glXSwapWaitX(__GLXclientState *, GLbyte *); -extern int __glXSwapCopyContext(__GLXclientState *, GLbyte *); -extern int __glXSwapSwapBuffers(__GLXclientState *, GLbyte *); -extern int __glXSwapUseXFont(__GLXclientState *, GLbyte *); -extern int __glXSwapCreateGLXPixmap(__GLXclientState *, GLbyte *); -extern int __glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapGetVisualConfigs(__GLXclientState *, GLbyte *); -extern int __glXSwapDestroyGLXPixmap(__GLXclientState *, GLbyte *); -extern int __glXSwapVendorPrivate(__GLXclientState *, GLbyte *); -extern int __glXSwapVendorPrivateWithReply(__GLXclientState *, GLbyte *); -extern int __glXSwapQueryExtensionsString(__GLXclientState *, GLbyte *); -extern int __glXSwapQueryServerString(__GLXclientState *, GLbyte *); -extern int __glXSwapClientInfo(__GLXclientState *, GLbyte *); -extern int __glXSwapGetFBConfigs(__GLXclientState *, GLbyte *); -extern int __glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc); -extern int __glXDispSwap_NewList(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_EndList(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_DeleteLists(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GenLists(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_FeedbackBuffer(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_SelectBuffer(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_RenderMode(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_Finish(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_PixelStoref(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_PixelStorei(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_ReadPixels(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetBooleanv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetClipPlane(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetDoublev(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetError(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetFloatv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetIntegerv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetLightfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetLightiv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMapdv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMapfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMapiv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMaterialfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMaterialiv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetPixelMapfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetPixelMapuiv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetPixelMapusv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetPolygonStipple(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetString(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexEnvfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexEnviv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexGendv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexGenfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexGeniv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexImage(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexLevelParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetTexLevelParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_IsEnabled(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_IsList(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_Flush(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_AreTexturesResident(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_DeleteTextures(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GenTextures(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_IsTexture(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetColorTable(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetColorTableParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetColorTableParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetConvolutionFilter(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetConvolutionParameterfv(__GLXclientState *, - GLbyte *); -extern int __glXDispSwap_GetConvolutionParameteriv(__GLXclientState *, - GLbyte *); -extern int __glXDispSwap_GetSeparableFilter(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetHistogram(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetHistogramParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetHistogramParameteriv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMinmax(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMinmaxParameterfv(__GLXclientState *, GLbyte *); -extern int __glXDispSwap_GetMinmaxParameteriv(__GLXclientState *, GLbyte *); - -extern void __glXDispSwap_CallList(GLbyte *); -extern void __glXDispSwap_CallLists(GLbyte *); -extern void __glXDispSwap_ListBase(GLbyte *); -extern void __glXDispSwap_Begin(GLbyte *); -extern void __glXDispSwap_Bitmap(GLbyte *); -extern void __glXDispSwap_Color3bv(GLbyte *); -extern void __glXDispSwap_Color3dv(GLbyte *); -extern void __glXDispSwap_Color3fv(GLbyte *); -extern void __glXDispSwap_Color3iv(GLbyte *); -extern void __glXDispSwap_Color3sv(GLbyte *); -extern void __glXDispSwap_Color3ubv(GLbyte *); -extern void __glXDispSwap_Color3uiv(GLbyte *); -extern void __glXDispSwap_Color3usv(GLbyte *); -extern void __glXDispSwap_Color4bv(GLbyte *); -extern void __glXDispSwap_Color4dv(GLbyte *); -extern void __glXDispSwap_Color4fv(GLbyte *); -extern void __glXDispSwap_Color4iv(GLbyte *); -extern void __glXDispSwap_Color4sv(GLbyte *); -extern void __glXDispSwap_Color4ubv(GLbyte *); -extern void __glXDispSwap_Color4uiv(GLbyte *); -extern void __glXDispSwap_Color4usv(GLbyte *); -extern void __glXDispSwap_EdgeFlagv(GLbyte *); -extern void __glXDispSwap_End(GLbyte *); -extern void __glXDispSwap_Indexdv(GLbyte *); -extern void __glXDispSwap_Indexfv(GLbyte *); -extern void __glXDispSwap_Indexiv(GLbyte *); -extern void __glXDispSwap_Indexsv(GLbyte *); -extern void __glXDispSwap_Normal3bv(GLbyte *); -extern void __glXDispSwap_Normal3dv(GLbyte *); -extern void __glXDispSwap_Normal3fv(GLbyte *); -extern void __glXDispSwap_Normal3iv(GLbyte *); -extern void __glXDispSwap_Normal3sv(GLbyte *); -extern void __glXDispSwap_RasterPos2dv(GLbyte *); -extern void __glXDispSwap_RasterPos2fv(GLbyte *); -extern void __glXDispSwap_RasterPos2iv(GLbyte *); -extern void __glXDispSwap_RasterPos2sv(GLbyte *); -extern void __glXDispSwap_RasterPos3dv(GLbyte *); -extern void __glXDispSwap_RasterPos3fv(GLbyte *); -extern void __glXDispSwap_RasterPos3iv(GLbyte *); -extern void __glXDispSwap_RasterPos3sv(GLbyte *); -extern void __glXDispSwap_RasterPos4dv(GLbyte *); -extern void __glXDispSwap_RasterPos4fv(GLbyte *); -extern void __glXDispSwap_RasterPos4iv(GLbyte *); -extern void __glXDispSwap_RasterPos4sv(GLbyte *); -extern void __glXDispSwap_Rectdv(GLbyte *); -extern void __glXDispSwap_Rectfv(GLbyte *); -extern void __glXDispSwap_Rectiv(GLbyte *); -extern void __glXDispSwap_Rectsv(GLbyte *); -extern void __glXDispSwap_TexCoord1dv(GLbyte *); -extern void __glXDispSwap_TexCoord1fv(GLbyte *); -extern void __glXDispSwap_TexCoord1iv(GLbyte *); -extern void __glXDispSwap_TexCoord1sv(GLbyte *); -extern void __glXDispSwap_TexCoord2dv(GLbyte *); -extern void __glXDispSwap_TexCoord2fv(GLbyte *); -extern void __glXDispSwap_TexCoord2iv(GLbyte *); -extern void __glXDispSwap_TexCoord2sv(GLbyte *); -extern void __glXDispSwap_TexCoord3dv(GLbyte *); -extern void __glXDispSwap_TexCoord3fv(GLbyte *); -extern void __glXDispSwap_TexCoord3iv(GLbyte *); -extern void __glXDispSwap_TexCoord3sv(GLbyte *); -extern void __glXDispSwap_TexCoord4dv(GLbyte *); -extern void __glXDispSwap_TexCoord4fv(GLbyte *); -extern void __glXDispSwap_TexCoord4iv(GLbyte *); -extern void __glXDispSwap_TexCoord4sv(GLbyte *); -extern void __glXDispSwap_Vertex2dv(GLbyte *); -extern void __glXDispSwap_Vertex2fv(GLbyte *); -extern void __glXDispSwap_Vertex2iv(GLbyte *); -extern void __glXDispSwap_Vertex2sv(GLbyte *); -extern void __glXDispSwap_Vertex3dv(GLbyte *); -extern void __glXDispSwap_Vertex3fv(GLbyte *); -extern void __glXDispSwap_Vertex3iv(GLbyte *); -extern void __glXDispSwap_Vertex3sv(GLbyte *); -extern void __glXDispSwap_Vertex4dv(GLbyte *); -extern void __glXDispSwap_Vertex4fv(GLbyte *); -extern void __glXDispSwap_Vertex4iv(GLbyte *); -extern void __glXDispSwap_Vertex4sv(GLbyte *); -extern void __glXDispSwap_ClipPlane(GLbyte *); -extern void __glXDispSwap_ColorMaterial(GLbyte *); -extern void __glXDispSwap_CullFace(GLbyte *); -extern void __glXDispSwap_Fogf(GLbyte *); -extern void __glXDispSwap_Fogfv(GLbyte *); -extern void __glXDispSwap_Fogi(GLbyte *); -extern void __glXDispSwap_Fogiv(GLbyte *); -extern void __glXDispSwap_FrontFace(GLbyte *); -extern void __glXDispSwap_Hint(GLbyte *); -extern void __glXDispSwap_Lightf(GLbyte *); -extern void __glXDispSwap_Lightfv(GLbyte *); -extern void __glXDispSwap_Lighti(GLbyte *); -extern void __glXDispSwap_Lightiv(GLbyte *); -extern void __glXDispSwap_LightModelf(GLbyte *); -extern void __glXDispSwap_LightModelfv(GLbyte *); -extern void __glXDispSwap_LightModeli(GLbyte *); -extern void __glXDispSwap_LightModeliv(GLbyte *); -extern void __glXDispSwap_LineStipple(GLbyte *); -extern void __glXDispSwap_LineWidth(GLbyte *); -extern void __glXDispSwap_Materialf(GLbyte *); -extern void __glXDispSwap_Materialfv(GLbyte *); -extern void __glXDispSwap_Materiali(GLbyte *); -extern void __glXDispSwap_Materialiv(GLbyte *); -extern void __glXDispSwap_PointSize(GLbyte *); -extern void __glXDispSwap_PolygonMode(GLbyte *); -extern void __glXDispSwap_PolygonStipple(GLbyte *); -extern void __glXDispSwap_Scissor(GLbyte *); -extern void __glXDispSwap_ShadeModel(GLbyte *); -extern void __glXDispSwap_TexParameterf(GLbyte *); -extern void __glXDispSwap_TexParameterfv(GLbyte *); -extern void __glXDispSwap_TexParameteri(GLbyte *); -extern void __glXDispSwap_TexParameteriv(GLbyte *); -extern void __glXDispSwap_TexImage1D(GLbyte *); -extern void __glXDispSwap_TexImage2D(GLbyte *); -extern void __glXDispSwap_TexEnvf(GLbyte *); -extern void __glXDispSwap_TexEnvfv(GLbyte *); -extern void __glXDispSwap_TexEnvi(GLbyte *); -extern void __glXDispSwap_TexEnviv(GLbyte *); -extern void __glXDispSwap_TexGend(GLbyte *); -extern void __glXDispSwap_TexGendv(GLbyte *); -extern void __glXDispSwap_TexGenf(GLbyte *); -extern void __glXDispSwap_TexGenfv(GLbyte *); -extern void __glXDispSwap_TexGeni(GLbyte *); -extern void __glXDispSwap_TexGeniv(GLbyte *); -extern void __glXDispSwap_InitNames(GLbyte *); -extern void __glXDispSwap_LoadName(GLbyte *); -extern void __glXDispSwap_PassThrough(GLbyte *); -extern void __glXDispSwap_PopName(GLbyte *); -extern void __glXDispSwap_PushName(GLbyte *); -extern void __glXDispSwap_DrawBuffer(GLbyte *); -extern void __glXDispSwap_Clear(GLbyte *); -extern void __glXDispSwap_ClearAccum(GLbyte *); -extern void __glXDispSwap_ClearIndex(GLbyte *); -extern void __glXDispSwap_ClearColor(GLbyte *); -extern void __glXDispSwap_ClearStencil(GLbyte *); -extern void __glXDispSwap_ClearDepth(GLbyte *); -extern void __glXDispSwap_StencilMask(GLbyte *); -extern void __glXDispSwap_ColorMask(GLbyte *); -extern void __glXDispSwap_DepthMask(GLbyte *); -extern void __glXDispSwap_IndexMask(GLbyte *); -extern void __glXDispSwap_Accum(GLbyte *); -extern void __glXDispSwap_Disable(GLbyte *); -extern void __glXDispSwap_Enable(GLbyte *); -extern void __glXDispSwap_PopAttrib(GLbyte *); -extern void __glXDispSwap_PushAttrib(GLbyte *); -extern void __glXDispSwap_Map1d(GLbyte *); -extern void __glXDispSwap_Map1f(GLbyte *); -extern void __glXDispSwap_Map2d(GLbyte *); -extern void __glXDispSwap_Map2f(GLbyte *); -extern void __glXDispSwap_MapGrid1d(GLbyte *); -extern void __glXDispSwap_MapGrid1f(GLbyte *); -extern void __glXDispSwap_MapGrid2d(GLbyte *); -extern void __glXDispSwap_MapGrid2f(GLbyte *); -extern void __glXDispSwap_EvalCoord1dv(GLbyte *); -extern void __glXDispSwap_EvalCoord1fv(GLbyte *); -extern void __glXDispSwap_EvalCoord2dv(GLbyte *); -extern void __glXDispSwap_EvalCoord2fv(GLbyte *); -extern void __glXDispSwap_EvalMesh1(GLbyte *); -extern void __glXDispSwap_EvalPoint1(GLbyte *); -extern void __glXDispSwap_EvalMesh2(GLbyte *); -extern void __glXDispSwap_EvalPoint2(GLbyte *); -extern void __glXDispSwap_AlphaFunc(GLbyte *); -extern void __glXDispSwap_BlendFunc(GLbyte *); -extern void __glXDispSwap_LogicOp(GLbyte *); -extern void __glXDispSwap_StencilFunc(GLbyte *); -extern void __glXDispSwap_StencilOp(GLbyte *); -extern void __glXDispSwap_DepthFunc(GLbyte *); -extern void __glXDispSwap_PixelZoom(GLbyte *); -extern void __glXDispSwap_PixelTransferf(GLbyte *); -extern void __glXDispSwap_PixelTransferi(GLbyte *); -extern void __glXDispSwap_PixelMapfv(GLbyte *); -extern void __glXDispSwap_PixelMapuiv(GLbyte *); -extern void __glXDispSwap_PixelMapusv(GLbyte *); -extern void __glXDispSwap_ReadBuffer(GLbyte *); -extern void __glXDispSwap_CopyPixels(GLbyte *); -extern void __glXDispSwap_DrawPixels(GLbyte *); -extern void __glXDispSwap_DepthRange(GLbyte *); -extern void __glXDispSwap_Frustum(GLbyte *); -extern void __glXDispSwap_LoadIdentity(GLbyte *); -extern void __glXDispSwap_LoadMatrixf(GLbyte *); -extern void __glXDispSwap_LoadMatrixd(GLbyte *); -extern void __glXDispSwap_MatrixMode(GLbyte *); -extern void __glXDispSwap_MultMatrixf(GLbyte *); -extern void __glXDispSwap_MultMatrixd(GLbyte *); -extern void __glXDispSwap_Ortho(GLbyte *); -extern void __glXDispSwap_PopMatrix(GLbyte *); -extern void __glXDispSwap_PushMatrix(GLbyte *); -extern void __glXDispSwap_Rotated(GLbyte *); -extern void __glXDispSwap_Rotatef(GLbyte *); -extern void __glXDispSwap_Scaled(GLbyte *); -extern void __glXDispSwap_Scalef(GLbyte *); -extern void __glXDispSwap_Translated(GLbyte *); -extern void __glXDispSwap_Translatef(GLbyte *); -extern void __glXDispSwap_Viewport(GLbyte *); -extern void __glXDispSwap_PolygonOffset(GLbyte *); -extern void __glXDispSwap_DrawArrays(GLbyte *); -extern void __glXDispSwap_Indexubv(GLbyte *); -extern void __glXDispSwap_ColorSubTable(GLbyte *); -extern void __glXDispSwap_CopyColorSubTable(GLbyte *); -extern void __glXDispSwap_ActiveTextureARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord1dvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord1fvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord1ivARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord1svARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord2dvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord2fvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord2ivARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord2svARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord3dvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord3fvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord3ivARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord3svARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord4dvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord4fvARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord4ivARB(GLbyte *); -extern void __glXDispSwap_MultiTexCoord4svARB(GLbyte *); - -extern void __glXDispSwap_TexSubImage1D(GLbyte *); -extern void __glXDispSwap_TexSubImage2D(GLbyte *); -extern void __glXDispSwap_ConvolutionFilter1D(GLbyte *); -extern void __glXDispSwap_ConvolutionFilter2D(GLbyte *); -extern void __glXDispSwap_ConvolutionParameterfv(GLbyte *); -extern void __glXDispSwap_ConvolutionParameteriv(GLbyte *); -extern void __glXDispSwap_CopyConvolutionFilter1D(GLbyte *); -extern void __glXDispSwap_CopyConvolutionFilter2D(GLbyte *); -extern void __glXDispSwap_SeparableFilter2D(GLbyte *); -extern void __glXDispSwap_TexImage3D(GLbyte *); -extern void __glXDispSwap_TexSubImage3D(GLbyte *); -extern void __glXDispSwap_PrioritizeTextures(GLbyte *); -extern void __glXDispSwap_CopyTexImage1D(GLbyte *); -extern void __glXDispSwap_CopyTexImage2D(GLbyte *); -extern void __glXDispSwap_CopyTexSubImage1D(GLbyte *); -extern void __glXDispSwap_CopyTexSubImage2D(GLbyte *); -extern void __glXDispSwap_CopyTexSubImage3D(GLbyte *); - -extern void __glXDispSwap_BindTexture(GLbyte *); -extern void __glXDispSwap_BlendColor(GLbyte *); -extern void __glXDispSwap_BlendEquation(GLbyte *); -extern void __glXDispSwap_ColorTable(GLbyte *); -extern void __glXDispSwap_ColorTableParameterfv(GLbyte *); -extern void __glXDispSwap_ColorTableParameteriv(GLbyte *); -extern void __glXDispSwap_CopyColorTable(GLbyte *); -extern void __glXDispSwap_ConvolutionParameterf(GLbyte *); -extern void __glXDispSwap_ConvolutionParameteri(GLbyte *); -extern void __glXDispSwap_Histogram(GLbyte *); -extern void __glXDispSwap_Minmax(GLbyte *); -extern void __glXDispSwap_ResetHistogram(GLbyte *); -extern void __glXDispSwap_ResetMinmax(GLbyte *); - -extern int __glXSwapCreateContextWithConfigSGIX(__GLXclientState *, GLbyte *); -extern int __glXSwapBindSwapBarrierSGIX(__GLXclientState *, GLbyte *); -extern int __glXSwapJoinSwapGroupSGIX(__GLXclientState *, GLbyte *); -extern int __glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState *, GLbyte *); -extern int __glXSwapMakeCurrentReadSGI(__GLXclientState *, GLbyte *); - -#define __GLX_MIN_GLXCMD_OPCODE 1 -#define __GLX_MAX_GLXCMD_OPCODE 20 -#define __GLX_MIN_RENDER_OPCODE 1 -#define __GLX_MAX_RENDER_OPCODE 213 -#define __GLX_MIN_SINGLE_OPCODE 1 -#define __GLX_MAX_SINGLE_OPCODE 159 -#define __GLX_SINGLE_TABLE_SIZE 160 -#define __GLX_RENDER_TABLE_SIZE 214 - -#define __GLX_MIN_RENDER_OPCODE_EXT 4096 -#define __GLX_MAX_RENDER_OPCODE_EXT 4123 - -extern __GLXdispatchSingleProcPtr __glXSingleTable[__GLX_SINGLE_TABLE_SIZE]; -extern __GLXdispatchSingleProcPtr __glXSwapSingleTable[__GLX_SINGLE_TABLE_SIZE]; -#endif /* _GLX_g_disptab_h_ */ diff --git a/hw/dmx/glxProxy/g_renderswap.c b/hw/dmx/glxProxy/g_renderswap.c deleted file mode 100644 index ce1c609bd..000000000 --- a/hw/dmx/glxProxy/g_renderswap.c +++ /dev/null @@ -1,2663 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" -#include "glxext.h" -#include "g_disptab.h" -#include "unpack.h" -#include "compsize.h" - -void -__glXDispSwap_CallList(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_ListBase(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Begin(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Color3bv(GLbyte * pc) -{ -} - -void -__glXDispSwap_Color3dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Color3fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); -} - -void -__glXDispSwap_Color3iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Color3sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Color3ubv(GLbyte * pc) -{ -} - -void -__glXDispSwap_Color3uiv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 3); -} - -void -__glXDispSwap_Color3usv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); -} - -void -__glXDispSwap_Color4bv(GLbyte * pc) -{ -} - -void -__glXDispSwap_Color4dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 32); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); -} - -void -__glXDispSwap_Color4fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Color4iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Color4sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Color4ubv(GLbyte * pc) -{ - -} - -void -__glXDispSwap_Color4uiv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Color4usv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_EdgeFlagv(GLbyte * pc) -{ -} - -void -__glXDispSwap_End(GLbyte * pc) -{ -} - -void -__glXDispSwap_Indexdv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 8); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_Indexfv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_Indexiv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_Indexsv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_Normal3bv(GLbyte * pc) -{ -} - -void -__glXDispSwap_Normal3dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Normal3fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Normal3iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Normal3sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_RasterPos2dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 16); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_RasterPos2fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_RasterPos2iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_RasterPos2sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_RasterPos3dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_RasterPos3fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_RasterPos3iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_RasterPos3sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_RasterPos4dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 32); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_RasterPos4fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_RasterPos4iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_RasterPos4sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Rectdv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 32); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); - __GLX_SWAP_DOUBLE_ARRAY(pc + 16, 2); - -} - -void -__glXDispSwap_Rectfv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, 2); - -} - -void -__glXDispSwap_Rectiv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 2); - __GLX_SWAP_INT_ARRAY(pc + 8, 2); - -} - -void -__glXDispSwap_Rectsv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); - __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); - -} - -void -__glXDispSwap_TexCoord1dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 8); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_TexCoord1fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_TexCoord1iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_TexCoord1sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_TexCoord2dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 16); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_TexCoord2fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_TexCoord2iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_TexCoord2sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_TexCoord3dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_TexCoord3fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_TexCoord3iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_TexCoord3sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_TexCoord4dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 32); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_TexCoord4fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_TexCoord4iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_TexCoord4sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Vertex2dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 16); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_Vertex2fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_Vertex2iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_Vertex2sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_Vertex3dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Vertex3fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Vertex3iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Vertex3sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_Vertex4dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 32); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Vertex4fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Vertex4iv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_Vertex4sv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_ClipPlane(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 36); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_ColorMaterial(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_CullFace(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Fogf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_Fogfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - pname = *(GLenum *) (pc + 0); - compsize = __glFogfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); - -} - -void -__glXDispSwap_Fogi(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_Fogiv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - pname = *(GLenum *) (pc + 0); - compsize = __glFogiv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT_ARRAY(pc + 4, compsize); - -} - -void -__glXDispSwap_FrontFace(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Hint(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_Lightf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_Lightfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glLightfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_Lighti(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_Lightiv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glLightiv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_LightModelf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_LightModelfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - pname = *(GLenum *) (pc + 0); - compsize = __glLightModelfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_FLOAT_ARRAY(pc + 4, compsize); - -} - -void -__glXDispSwap_LightModeli(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_LightModeliv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - pname = *(GLenum *) (pc + 0); - compsize = __glLightModeliv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT_ARRAY(pc + 4, compsize); - -} - -void -__glXDispSwap_LineStipple(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_SHORT(pc + 4); - -} - -void -__glXDispSwap_LineWidth(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - -} - -void -__glXDispSwap_Materialf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_Materialfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glMaterialfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_Materiali(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_Materialiv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glMaterialiv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_PointSize(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - -} - -void -__glXDispSwap_PolygonMode(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_Scissor(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - -} - -void -__glXDispSwap_ShadeModel(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_TexParameterf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_TexParameterfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexParameterfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_TexParameteri(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_TexParameteriv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexParameteriv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_TexEnvf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_TexEnvfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexEnvfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_TexEnvi(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_TexEnviv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexEnviv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_TexGend(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 16); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_DOUBLE(pc + 0); - -} - -void -__glXDispSwap_TexGendv(GLbyte * pc) -{ - GLenum pname; - GLint cmdlen; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexGendv_size(pname); - if (compsize < 0) - compsize = 0; - cmdlen = __GLX_PAD(8 + compsize * 8); - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, cmdlen); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_DOUBLE_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_TexGenf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_TexGenfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexGenfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_TexGeni(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_TexGeniv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glTexGeniv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_InitNames(GLbyte * pc) -{ -} - -void -__glXDispSwap_LoadName(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_PassThrough(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - -} - -void -__glXDispSwap_PopName(GLbyte * pc) -{ -} - -void -__glXDispSwap_PushName(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_DrawBuffer(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Clear(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_ClearAccum(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 12); - -} - -void -__glXDispSwap_ClearIndex(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - -} - -void -__glXDispSwap_ClearColor(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 12); - -} - -void -__glXDispSwap_ClearStencil(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_ClearDepth(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 8); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - -} - -void -__glXDispSwap_StencilMask(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_ColorMask(GLbyte * pc) -{ -} - -void -__glXDispSwap_DepthMask(GLbyte * pc) -{ -} - -void -__glXDispSwap_IndexMask(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Accum(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_Disable(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_Enable(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_PopAttrib(GLbyte * pc) -{ -} - -void -__glXDispSwap_PushAttrib(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_MapGrid1d(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 20); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - -} - -void -__glXDispSwap_MapGrid1f(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_MapGrid2d(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 40); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_INT(pc + 36); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - -} - -void -__glXDispSwap_MapGrid2f(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_FLOAT(pc + 16); - __GLX_SWAP_FLOAT(pc + 20); - -} - -void -__glXDispSwap_EvalCoord1dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 8); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_EvalCoord1fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_EvalCoord2dv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 16); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_EvalCoord2fv(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_EvalMesh1(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_EvalPoint1(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_EvalMesh2(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - -} - -void -__glXDispSwap_EvalPoint2(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_AlphaFunc(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_BlendFunc(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_LogicOp(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_StencilFunc(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_StencilOp(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_DepthFunc(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_PixelZoom(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_PixelTransferf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_PixelTransferi(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_PixelMapfv(GLbyte * pc) -{ - GLint mapsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - mapsize = *(GLint *) (pc + 4); - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, mapsize); - -} - -void -__glXDispSwap_PixelMapuiv(GLbyte * pc) -{ - GLint mapsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - mapsize = *(GLint *) (pc + 4); - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, mapsize); - -} - -void -__glXDispSwap_PixelMapusv(GLbyte * pc) -{ - GLint mapsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - mapsize = *(GLint *) (pc + 4); - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_SHORT_ARRAY(pc + 8, mapsize); - -} - -void -__glXDispSwap_ReadBuffer(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_CopyPixels(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - -} - -void -__glXDispSwap_DepthRange(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 16); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - -} - -void -__glXDispSwap_Frustum(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 48); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_DOUBLE(pc + 32); - __GLX_SWAP_DOUBLE(pc + 40); - -} - -void -__glXDispSwap_LoadIdentity(GLbyte * pc) -{ -} - -void -__glXDispSwap_LoadMatrixf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); - -} - -void -__glXDispSwap_LoadMatrixd(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 128); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16); - -} - -void -__glXDispSwap_MatrixMode(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_MultMatrixf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_FLOAT_ARRAY(pc + 0, 16); - -} - -void -__glXDispSwap_MultMatrixd(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 128); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 16); - -} - -void -__glXDispSwap_Ortho(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 48); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_DOUBLE(pc + 32); - __GLX_SWAP_DOUBLE(pc + 40); - -} - -void -__glXDispSwap_PopMatrix(GLbyte * pc) -{ -} - -void -__glXDispSwap_PushMatrix(GLbyte * pc) -{ -} - -void -__glXDispSwap_Rotated(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 32); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - -} - -void -__glXDispSwap_Rotatef(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 12); - -} - -void -__glXDispSwap_Scaled(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - -} - -void -__glXDispSwap_Scalef(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_Translated(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 24); - pc -= 4; - } -#endif - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - -} - -void -__glXDispSwap_Translatef(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_Viewport(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - -} - -void -__glXDispSwap_PolygonOffset(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - -} - -void -__glXDispSwap_CopyTexImage1D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - __GLX_SWAP_INT(pc + 24); - -} - -void -__glXDispSwap_CopyTexImage2D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_INT(pc + 28); - -} - -void -__glXDispSwap_CopyTexSubImage1D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - -} - -void -__glXDispSwap_CopyTexSubImage2D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_INT(pc + 28); - -} - -void -__glXDispSwap_BindTexture(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_PrioritizeTextures(GLbyte * pc) -{ - GLsizei n; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - n = *(GLsizei *) (pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 4, n); - __GLX_SWAP_FLOAT_ARRAY(pc + 4 + n * 4, n); - -} - -void -__glXDispSwap_Indexubv(GLbyte * pc) -{ -} - -void -__glXDispSwap_BlendColor(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_FLOAT(pc + 0); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 12); - -} - -void -__glXDispSwap_BlendEquation(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_ColorTableParameterfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glColorTableParameterfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_ColorTableParameteriv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glColorTableParameteriv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_CopyColorTable(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - -} - -void -__glXDispSwap_CopyColorSubTable(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - -} - -void -__glXDispSwap_ConvolutionParameterf(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - -} - -void -__glXDispSwap_ConvolutionParameterfv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glConvolutionParameterfv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_ConvolutionParameteri(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_ConvolutionParameteriv(GLbyte * pc) -{ - GLenum pname; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - pname = *(GLenum *) (pc + 4); - compsize = __glConvolutionParameteriv_size(pname); - if (compsize < 0) - compsize = 0; - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 8, compsize); - -} - -void -__glXDispSwap_CopyConvolutionFilter1D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - -} - -void -__glXDispSwap_CopyConvolutionFilter2D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - -} - -void -__glXDispSwap_Histogram(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - -} - -void -__glXDispSwap_Minmax(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - -} - -void -__glXDispSwap_ResetHistogram(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_ResetMinmax(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_CopyTexSubImage3D(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_INT(pc + 28); - __GLX_SWAP_INT(pc + 32); - -} - -void -__glXDispSwap_ActiveTextureARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - -} - -void -__glXDispSwap_MultiTexCoord1dvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 12); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 8); - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 1); - -} - -void -__glXDispSwap_MultiTexCoord1fvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 4, 1); - -} - -void -__glXDispSwap_MultiTexCoord1ivARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 4, 1); - -} - -void -__glXDispSwap_MultiTexCoord1svARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_SHORT_ARRAY(pc + 4, 1); - -} - -void -__glXDispSwap_MultiTexCoord2dvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 20); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 2); - -} - -void -__glXDispSwap_MultiTexCoord2fvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 4, 2); - -} - -void -__glXDispSwap_MultiTexCoord2ivARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 4, 2); - -} - -void -__glXDispSwap_MultiTexCoord2svARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_SHORT_ARRAY(pc + 4, 2); - -} - -void -__glXDispSwap_MultiTexCoord3dvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 28); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 3); - -} - -void -__glXDispSwap_MultiTexCoord3fvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 4, 3); - -} - -void -__glXDispSwap_MultiTexCoord3ivARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 4, 3); - -} - -void -__glXDispSwap_MultiTexCoord3svARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_SHORT_ARRAY(pc + 4, 3); - -} - -void -__glXDispSwap_MultiTexCoord4dvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - -#ifdef __GLX_ALIGN64 - if ((unsigned long) (pc) & 7) { - __GLX_MEM_COPY(pc - 4, pc, 36); - pc -= 4; - } -#endif - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_DOUBLE_ARRAY(pc + 0, 4); - -} - -void -__glXDispSwap_MultiTexCoord4fvARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_FLOAT_ARRAY(pc + 4, 4); - -} - -void -__glXDispSwap_MultiTexCoord4ivARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT_ARRAY(pc + 4, 4); - -} - -void -__glXDispSwap_MultiTexCoord4svARB(GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_SHORT_ARRAY(pc + 4, 4); - -} diff --git a/hw/dmx/glxProxy/global.c b/hw/dmx/glxProxy/global.c deleted file mode 100644 index 6d4612deb..000000000 --- a/hw/dmx/glxProxy/global.c +++ /dev/null @@ -1,70 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" - -/* -** The last context used by the server. It is the context that is current -** from the server's perspective. -*/ -__GLXcontext *__glXLastContext; - -/* -** X resources. -*/ -RESTYPE __glXContextRes; -RESTYPE __glXClientRes; -RESTYPE __glXPixmapRes; -RESTYPE __glXWindowRes; -RESTYPE __glXPbufferRes; - -/* -** Error codes with the extension error base already added in. -*/ -int __glXerrorBase; -int __glXBadContext, __glXBadContextState, __glXBadDrawable, __glXBadPixmap; -int __glXBadContextTag, __glXBadCurrentWindow; -int __glXBadRenderRequest, __glXBadLargeRequest; -int __glXUnsupportedPrivateRequest; -int __glXBadFBConfig, __glXBadPbuffer; - -/* -** Reply for most singles. -*/ -xGLXSingleReply __glXReply; - -/* -** A set of state for each client. The 0th one is unused because client -** indices start at 1, not 0. -*/ -__GLXclientState *__glXClients[MAXCLIENTS + 1]; - -int __glXVersionMajor; -int __glXVersionMinor; diff --git a/hw/dmx/glxProxy/glxcmds.c b/hw/dmx/glxProxy/glxcmds.c deleted file mode 100644 index b71588678..000000000 --- a/hw/dmx/glxProxy/glxcmds.c +++ /dev/null @@ -1,3846 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" -#include "dmxfont.h" -#include "dmxsync.h" - -#include "glxserver.h" -#include "g_disptab.h" -#include <pixmapstr.h> -#include <windowstr.h> -#include "glxutil.h" -#include "glxext.h" -#include "unpack.h" - -#include "GL/glxproto.h" -#include "glxvendor.h" -#include "glxvisuals.h" -#include "glxswap.h" - -#include "glxcmds.h" - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -extern __GLXFBConfig **__glXFBConfigs; -extern int __glXNumFBConfigs; - -extern int __glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc); - -#define BE_TO_CLIENT_ERROR(x) \ - ( (x) >= __glXerrorBase ? \ - (x) - dmxScreen->glxErrorBase + __glXerrorBase \ - : (x) ) - -static __GLXFBConfig * -glxLookupFBConfig(GLXFBConfigID id) -{ - int i, j; - - for (i = 0, j = 0; i < __glXNumFBConfigs; - i++, j += (__glXNumActiveScreens + 1)) { - if (__glXFBConfigs[j]->id == id) - return __glXFBConfigs[j]; - } - - return NULL; -} - -static __GLXFBConfig * -glxLookupFBConfigByVID(VisualID vid) -{ - int i, j; - - for (i = 0, j = 0; i < __glXNumFBConfigs; - i++, j += (__glXNumActiveScreens + 1)) { - if (__glXFBConfigs[j]->associatedVisualId == vid) - return __glXFBConfigs[j]; - } - - return NULL; -} - -static __GLXFBConfig * -glxLookupBackEndFBConfig(GLXFBConfigID id, int screen) -{ - int i; - int j; - - for (i = 0, j = 0; i < __glXNumFBConfigs; - i++, j += (__glXNumActiveScreens + 1)) { - if (__glXFBConfigs[j]->id == id) - return __glXFBConfigs[j + screen + 1]; - } - - return NULL; - -} - -Display * -GetBackEndDisplay(__GLXclientState * cl, int s) -{ - if (!cl->be_displays[s]) { - cl->be_displays[s] = - XOpenDisplay(DisplayString(dmxScreens[s].beDisplay)); - } - return cl->be_displays[s]; -} - -/** - * Convert the render type bits from fbconfig into context render type. - */ -static int -renderTypeBitsToRenderTypeEnum(int fbRenderType) -{ - if (fbRenderType & GLX_RGBA_BIT) - return GLX_RGBA_TYPE; - - if (fbRenderType & GLX_COLOR_INDEX_BIT) - return GLX_COLOR_INDEX_TYPE; - - if (fbRenderType & GLX_RGBA_FLOAT_BIT_ARB) - return GLX_RGBA_FLOAT_TYPE_ARB; - - if (fbRenderType & GLX_RGBA_UNSIGNED_FLOAT_BIT_EXT) - return GLX_RGBA_UNSIGNED_FLOAT_TYPE_EXT; - - /* There's no recognized renderType in the config */ - return GLX_RGBA_TYPE; -} - -/* -** Create a GL context with the given properties. -*/ -static int -CreateContext(__GLXclientState * cl, - GLXContextID gcId, - VisualID vid, GLXFBConfigID fbconfigId, - int screen, GLXContextID shareList, int isDirect) -{ - ClientPtr client = cl->client; - xGLXCreateContextReq *be_req; - xGLXCreateNewContextReq *be_new_req; - VisualPtr pVisual; - ScreenPtr pScreen; - __GLXcontext *glxc, *shareglxc; - __GLXvisualConfig *pGlxVisual; - __GLXscreenInfo *pGlxScreen; - VisualID visual = vid; - GLint i; - int from_screen = screen; - int to_screen = screen; - DMXScreenInfo *dmxScreen; - VisualID be_vid = 0; - GLXFBConfigID be_fbconfigId = 0; - int num_be_screens; - Display *dpy; - - /* - ** Check if screen exists. - */ - if (screen >= screenInfo.numScreens) { - client->errorValue = screen; - return BadValue; - } - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - /* - ** Find the display list space that we want to share. - ** - */ - if (shareList == None) { - shareglxc = NULL; - } - else { - dixLookupResourceByType((void **) &shareglxc, shareList, - __glXContextRes, NullClient, DixUnknownAccess); - if (!shareglxc) { - client->errorValue = shareList; - return __glXBadContext; - } - } - - /* - ** Allocate memory for the new context - */ - glxc = calloc(1, sizeof(__GLXcontext)); - if (!glxc) { - return BadAlloc; - } - - pScreen = screenInfo.screens[screen]; - pGlxScreen = &__glXActiveScreens[screen]; - - if (fbconfigId != None) { - glxc->pFBConfig = glxLookupFBConfig(fbconfigId); - if (!glxc->pFBConfig) { - client->errorValue = fbconfigId; - free(glxc); - return BadValue; - } - visual = glxc->pFBConfig->associatedVisualId; - } - else { - glxc->pFBConfig = NULL; - } - - if (visual != None) { - /* - ** Check if the visual ID is valid for this screen. - */ - pVisual = pScreen->visuals; - for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { - if (pVisual->vid == visual) { - break; - } - } - if (i == pScreen->numVisuals) { - client->errorValue = visual; - free(glxc); - return BadValue; - } - - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { - /* - ** Visual not support on this screen by this OpenGL implementation. - */ - client->errorValue = visual; - free(glxc); - return BadValue; - } - - if (glxc->pFBConfig == NULL) { - glxc->pFBConfig = glxLookupFBConfigByVID(visual); - - if (glxc->pFBConfig == NULL) { - /* - * visual does not have an FBConfig ??? - client->errorValue = visual; - free( glxc ); - return BadValue; - */ - } - } - } - else { - pVisual = NULL; - pGlxVisual = NULL; - } - - glxc->pScreen = pScreen; - glxc->pGlxScreen = pGlxScreen; - glxc->pVisual = pVisual; - glxc->pGlxVisual = pGlxVisual; - - /* - * allocate memory for back-end servers info - */ - num_be_screens = to_screen - from_screen + 1; - glxc->real_ids = xallocarray(num_be_screens, sizeof(XID)); - if (!glxc->real_ids) { - free(glxc); - return BadAlloc; - } - glxc->real_vids = xallocarray(num_be_screens, sizeof(XID)); - if (!glxc->real_vids) { - free(glxc->real_ids); - free(glxc); - return BadAlloc; - } - - for (screen = from_screen; screen <= to_screen; screen++) { - int sent = 0; - - pScreen = screenInfo.screens[screen]; - pGlxScreen = &__glXActiveScreens[screen]; - dmxScreen = &dmxScreens[screen]; - - if (glxc->pFBConfig) { - __GLXFBConfig *beFBConfig = - glxLookupBackEndFBConfig(glxc->pFBConfig->id, - screen); - - be_fbconfigId = beFBConfig->id; - } - - if (pGlxVisual) { - - be_vid = glxMatchGLXVisualInConfigList(pGlxVisual, - dmxScreen->glxVisuals, - dmxScreen->numGlxVisuals); - - if (!be_vid) { - /* visual is not supported on the back-end server */ - free(glxc->real_ids); - free(glxc->real_vids); - free(glxc); - return BadValue; - } - } - - glxc->real_ids[screen - from_screen] = - XAllocID(GetBackEndDisplay(cl, screen)); - - /* send the create context request to the back-end server */ - dpy = GetBackEndDisplay(cl, screen); - if (glxc->pFBConfig) { - /* For a specific visual, multiple render types (i.e., both RGB - * and COLOR INDEX) can be accessible. The only parameter to - * choose the renderType should be the class of the colormap, - * since the first classes do not support RGB mode (only COLOR - * INDEX), and TrueColor and DirectColor do not support COLOR - * INDEX. - */ - int renderType = GLX_RGBA_TYPE; - - if (pVisual) { - switch (pVisual->class) { - case PseudoColor: - case StaticColor: - case GrayScale: - case StaticGray: - renderType = GLX_COLOR_INDEX_TYPE; - break; - case TrueColor: - case DirectColor: - default: - renderType = GLX_RGBA_TYPE; - break; - } - } else { - renderType = - renderTypeBitsToRenderTypeEnum(glxc->pFBConfig->renderType); - } - - if (__GLX_IS_VERSION_SUPPORTED(1, 3)) { - LockDisplay(dpy); - GetReq(GLXCreateNewContext, be_new_req); - be_new_req->reqType = dmxScreen->glxMajorOpcode; - be_new_req->glxCode = X_GLXCreateNewContext; - be_new_req->context = - (unsigned int) glxc->real_ids[screen - from_screen]; - be_new_req->fbconfig = (unsigned int) be_fbconfigId; - be_new_req->screen = DefaultScreen(dpy); - be_new_req->renderType = renderType; - - be_new_req->shareList = - (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0); - be_new_req->isDirect = 0; - UnlockDisplay(dpy); - glxc->real_vids[screen - from_screen] = be_fbconfigId; - sent = 1; - } - else if (glxIsExtensionSupported("GLX_SGIX_fbconfig")) { - - xGLXCreateContextWithConfigSGIXReq *ext_req; - xGLXVendorPrivateReq *vpreq; - - LockDisplay(dpy); - GetReqExtra(GLXVendorPrivate, - sz_xGLXCreateContextWithConfigSGIXReq - - sz_xGLXVendorPrivateReq, vpreq); - ext_req = (xGLXCreateContextWithConfigSGIXReq *) vpreq; - ext_req->reqType = dmxScreen->glxMajorOpcode; - ext_req->glxCode = X_GLXVendorPrivate; - ext_req->vendorCode = X_GLXvop_CreateContextWithConfigSGIX; - ext_req->context = - (unsigned int) glxc->real_ids[screen - from_screen]; - ext_req->fbconfig = (unsigned int) be_fbconfigId; - ext_req->screen = DefaultScreen(dpy); - ext_req->renderType = renderType; - ext_req->shareList = - (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0); - ext_req->isDirect = 0; - UnlockDisplay(dpy); - glxc->real_vids[screen - from_screen] = be_fbconfigId; - sent = 1; - } - } - - if (!sent) { - LockDisplay(dpy); - GetReq(GLXCreateContext, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXCreateContext; - be_req->context = - (unsigned int) glxc->real_ids[screen - from_screen]; - be_req->visual = (unsigned int) be_vid; - be_req->screen = DefaultScreen(dpy); - be_req->shareList = - (shareglxc ? shareglxc->real_ids[screen - from_screen] : 0); - be_req->isDirect = 0; - UnlockDisplay(dpy); - glxc->real_vids[screen - from_screen] = be_vid; - } - SyncHandle(); - - } - - /* - ** Register this context as a resource. - */ - if (!AddResource(gcId, __glXContextRes, (void *) glxc)) { - free(glxc->real_ids); - free(glxc->real_vids); - free(glxc); - client->errorValue = gcId; - return BadAlloc; - } - - /* - ** Finally, now that everything is working, setup the rest of the - ** context. - */ - glxc->id = gcId; - glxc->share_id = shareList; - glxc->idExists = GL_TRUE; - glxc->isCurrent = GL_FALSE; - - return Success; -} - -int -__glXCreateContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; - - return (CreateContext(cl, req->context, req->visual, None, - req->screen, req->shareList, req->isDirect)); - -} - -int -__glXCreateNewContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; - - return (CreateContext(cl, req->context, None, req->fbconfig, - req->screen, req->shareList, req->isDirect)); - -} - -int -__glXCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateContextWithConfigSGIXReq *req = - (xGLXCreateContextWithConfigSGIXReq *) pc; - - return (CreateContext(cl, req->context, None, req->fbconfig, - req->screen, req->shareList, req->isDirect)); - -} - -int -__glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXQueryMaxSwapBarriersSGIXReq *req = - (xGLXQueryMaxSwapBarriersSGIXReq *) pc; - xGLXQueryMaxSwapBarriersSGIXReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .max = QueryMaxSwapBarriersSGIX(req->screen) - }; - - if (client->swapped) { - __glXSwapQueryMaxSwapBarriersSGIXReply(client, &reply); - } - else { - WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, &reply); - } - - return Success; -} - -int -__glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; - DrawablePtr pDraw; - __GLXpixmap *pGlxPixmap = NULL; - __glXWindow *pGlxWindow = NULL; - int rc; - - rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixGetAttrAccess); - if (rc != Success) { - dixLookupResourceByType((void **) &pGlxPixmap, req->drawable, - __glXPixmapRes, NullClient, DixUnknownAccess); - if (pGlxPixmap) - pDraw = pGlxPixmap->pDraw; - } - - if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxWindow, req->drawable, - __glXWindowRes, NullClient, DixUnknownAccess); - if (pGlxWindow) - pDraw = pGlxWindow->pDraw; - } - - if (!pDraw) { - client->errorValue = req->drawable; - return __glXBadDrawable; - } - - return BindSwapBarrierSGIX(pDraw, req->barrier); -} - -int -__glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc; - DrawablePtr pDraw, pMember = NULL; - __GLXpixmap *pGlxPixmap = NULL; - __glXWindow *pGlxWindow = NULL; - int rc; - - rc = dixLookupDrawable(&pDraw, req->drawable, client, 0, DixManageAccess); - if (rc != Success) { - dixLookupResourceByType((void **) &pGlxPixmap, req->drawable, - __glXPixmapRes, NullClient, DixUnknownAccess); - if (pGlxPixmap) - pDraw = pGlxPixmap->pDraw; - } - - if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxWindow, req->drawable, - __glXWindowRes, NullClient, DixUnknownAccess); - if (pGlxWindow) - pDraw = pGlxWindow->pDraw; - } - - if (!pDraw) { - client->errorValue = req->drawable; - return __glXBadDrawable; - } - - if (req->member != None) { - rc = dixLookupDrawable(&pMember, req->member, client, 0, - DixGetAttrAccess); - if (rc != Success) { - dixLookupResourceByType((void **) &pGlxPixmap, req->member, - __glXPixmapRes, NullClient, - DixUnknownAccess); - if (pGlxPixmap) - pMember = pGlxPixmap->pDraw; - } - - if (!pMember && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxWindow, req->member, - __glXWindowRes, NullClient, - DixUnknownAccess); - if (pGlxWindow) - pMember = pGlxWindow->pDraw; - } - - if (!pMember) { - client->errorValue = req->member; - return __glXBadDrawable; - } - } - - return JoinSwapGroupSGIX(pDraw, pMember); -} - -/* -** Destroy a GL context as an X resource. -*/ -int -__glXDestroyContext(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; - xGLXDestroyContextReq *be_req; - GLXContextID gcId = req->context; - __GLXcontext *glxc; - int from_screen = 0; - int to_screen = 0; - int s; - - dixLookupResourceByType((void **) &glxc, gcId, __glXContextRes, - NullClient, DixUnknownAccess); - if (glxc) { - /* - ** Just free the resource; don't actually destroy the context, - ** because it might be in use. The - ** destroy method will be called by the resource destruction routine - ** if necessary. - */ - FreeResourceByType(gcId, __glXContextRes, FALSE); - - from_screen = to_screen = glxc->pScreen->myNum; - - } - else { - client->errorValue = gcId; - return __glXBadContext; - } - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - /* - * send DestroyContext request to all back-end servers - */ - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReq(GLXDestroyContext, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXDestroyContext; - be_req->context = glxc->real_ids[s - from_screen]; - UnlockDisplay(dpy); - SyncHandle(); - } - - return Success; -} - -/*****************************************************************************/ - -/* -** For each client, the server keeps a table of all the contexts that are -** current for that client (each thread of a client may have its own current -** context). These routines add, change, and lookup contexts in the table. -*/ - -/* -** Add a current context, and return the tag that will be used to refer to it. -*/ -static int -AddCurrentContext(__GLXclientState * cl, __GLXcontext * glxc, DrawablePtr pDraw) -{ - int i; - int num = cl->numCurrentContexts; - __GLXcontext **table = cl->currentContexts; - - if (!glxc) - return -1; - - /* - ** Try to find an empty slot and use it. - */ - for (i = 0; i < num; i++) { - if (!table[i]) { - table[i] = glxc; - return i + 1; - } - } - /* - ** Didn't find a free slot, so we'll have to grow the table. - */ - if (!num) { - table = (__GLXcontext **) malloc(sizeof(__GLXcontext *)); - cl->currentDrawables = (DrawablePtr *) malloc(sizeof(DrawablePtr)); - cl->be_currentCTag = xallocarray(screenInfo.numScreens, - sizeof(GLXContextTag)); - } - else { - table = reallocarray(table, num + 1, sizeof(__GLXcontext *)); - cl->currentDrawables = reallocarray(cl->currentDrawables, num + 1, - sizeof(DrawablePtr)); - cl->be_currentCTag = reallocarray(cl->be_currentCTag, - (num + 1) * screenInfo.numScreens, - sizeof(GLXContextTag)); - } - table[num] = glxc; - cl->currentDrawables[num] = pDraw; - cl->currentContexts = table; - cl->numCurrentContexts++; - - memset(cl->be_currentCTag + num * screenInfo.numScreens, 0, - screenInfo.numScreens * sizeof(GLXContextTag)); - - return num + 1; -} - -/* -** Given a tag, change the current context for the corresponding entry. -*/ -static void -ChangeCurrentContext(__GLXclientState * cl, __GLXcontext * glxc, - GLXContextTag tag) -{ - __GLXcontext **table = cl->currentContexts; - - table[tag - 1] = glxc; -} - -/* -** Given a tag, and back-end screen number, retrieves the current back-end -** tag. -*/ -int -GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, int s) -{ - if (tag > 0) { - return (cl->be_currentCTag[(tag - 1) * screenInfo.numScreens + s]); - } - else { - return 0; - } -} - -/* -** Given a tag, and back-end screen number, sets the current back-end -** tag. -*/ -static void -SetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, int s, - GLXContextTag be_tag) -{ - if (tag > 0) { - cl->be_currentCTag[(tag - 1) * screenInfo.numScreens + s] = be_tag; - } -} - -/* -** For this implementation we have chosen to simply use the index of the -** context's entry in the table as the context tag. A tag must be greater -** than 0. -*/ -__GLXcontext * -__glXLookupContextByTag(__GLXclientState * cl, GLXContextTag tag) -{ - int num = cl->numCurrentContexts; - - if (tag < 1 || tag > num) { - return 0; - } - else { - return cl->currentContexts[tag - 1]; - } -} - -DrawablePtr -__glXLookupDrawableByTag(__GLXclientState * cl, GLXContextTag tag) -{ - int num = cl->numCurrentContexts; - - if (tag < 1 || tag > num) { - return 0; - } - else { - return cl->currentDrawables[tag - 1]; - } -} - -/*****************************************************************************/ - -static void -StopUsingContext(__GLXcontext * glxc) -{ - if (glxc) { - if (glxc == __glXLastContext) { - /* Tell server GL library */ - __glXLastContext = 0; - } - glxc->isCurrent = GL_FALSE; - if (!glxc->idExists) { - __glXFreeContext(glxc); - } - } -} - -static void -StartUsingContext(__GLXclientState * cl, __GLXcontext * glxc) -{ - glxc->isCurrent = GL_TRUE; -} - -/*****************************************************************************/ -/* -** Make an OpenGL context and drawable current. -*/ -static int -MakeCurrent(__GLXclientState * cl, - GLXDrawable drawable, - GLXDrawable readdrawable, - GLXContextID context, GLXContextTag oldContextTag) -{ - ClientPtr client = cl->client; - DrawablePtr pDraw = NULL; - DrawablePtr pReadDraw = NULL; - xGLXMakeCurrentReadSGIReply new_reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0 - }; - xGLXMakeCurrentReq *be_req; - xGLXMakeCurrentReply be_reply; - xGLXMakeContextCurrentReq *be_new_req; - xGLXMakeContextCurrentReply be_new_reply; - GLXDrawable drawId = drawable; - GLXDrawable readId = readdrawable; - GLXContextID contextId = context; - __GLXpixmap *pGlxPixmap = 0; - __GLXpixmap *pReadGlxPixmap = 0; - __GLXcontext *glxc, *prevglxc; - GLXContextTag tag = oldContextTag; - WindowPtr pWin = NULL; - WindowPtr pReadWin = NULL; - __glXWindow *pGlxWindow = NULL; - __glXWindow *pGlxReadWindow = NULL; - __glXPbuffer *pGlxPbuffer = NULL; - __glXPbuffer *pGlxReadPbuffer = NULL; - -#ifdef PANORAMIX - PanoramiXRes *pXinDraw = NULL; - PanoramiXRes *pXinReadDraw = NULL; -#endif - int from_screen = 0; - int to_screen = 0; - int s, rc; - - /* - ** If one is None and the other isn't, it's a bad match. - */ - if ((drawId == None && contextId != None) || - (drawId != None && contextId == None)) { - return BadMatch; - } - - /* - ** Lookup old context. If we have one, it must be in a usable state. - */ - if (tag != 0) { - prevglxc = __glXLookupContextByTag(cl, tag); - if (!prevglxc) { - /* - ** Tag for previous context is invalid. - */ - return __glXBadContextTag; - } - } - else { - prevglxc = 0; - } - - /* - ** Lookup new context. It must not be current for someone else. - */ - if (contextId != None) { - dixLookupResourceByType((void **) &glxc, contextId, __glXContextRes, - NullClient, DixUnknownAccess); - if (!glxc) { - client->errorValue = contextId; - return __glXBadContext; - } - if ((glxc != prevglxc) && glxc->isCurrent) { - /* Context is current to somebody else */ - return BadAccess; - } - } - else { - /* Switching to no context. Ignore new drawable. */ - glxc = 0; - } - - if (drawId != None) { - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); - if (rc == Success) { - if (pDraw->type == DRAWABLE_WINDOW) { - /* - ** Drawable is an X Window. - */ - VisualID vid; - - pWin = (WindowPtr) pDraw; - vid = wVisual(pWin); - - new_reply.writeVid = - (glxc->pFBConfig ? glxc->pFBConfig->id : vid); - new_reply.writeType = GLX_WINDOW_TYPE; - - /* - ** Check if window and context are similar. - */ - if ((vid != glxc->pVisual->vid) || - (pWin->drawable.pScreen != glxc->pScreen)) { - client->errorValue = drawId; - return BadMatch; - } - - from_screen = to_screen = pWin->drawable.pScreen->myNum; - - } - else { - /* - ** An X Pixmap is not allowed as a parameter (a GLX Pixmap - ** is, but it must first be created with glxCreateGLXPixmap). - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - } - - if (!pDraw) { - dixLookupResourceByType((void **) &pGlxPixmap, drawId, - __glXPixmapRes, NullClient, - DixUnknownAccess); - if (pGlxPixmap) { - /* - ** Check if pixmap and context are similar. - */ - if (pGlxPixmap->pScreen != glxc->pScreen || - pGlxPixmap->pGlxVisual != glxc->pGlxVisual) { - client->errorValue = drawId; - return BadMatch; - } - pDraw = pGlxPixmap->pDraw; - - new_reply.writeVid = (glxc->pFBConfig ? glxc->pFBConfig->id : - pGlxPixmap->pGlxVisual->vid); - - new_reply.writeType = GLX_PIXMAP_TYPE; - - from_screen = to_screen = pGlxPixmap->pScreen->myNum; - - } - } - - if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxWindow, drawId, - __glXWindowRes, NullClient, - DixUnknownAccess); - if (pGlxWindow) { - /* - ** Drawable is a GLXWindow. - ** - ** Check if GLX window and context are similar. - */ - if (pGlxWindow->pScreen != glxc->pScreen || - pGlxWindow->pGlxFBConfig != glxc->pFBConfig) { - client->errorValue = drawId; - return BadMatch; - } - - pDraw = pGlxWindow->pDraw; - new_reply.writeVid = pGlxWindow->pGlxFBConfig->id; - new_reply.writeType = GLX_GLXWINDOW_TYPE; - } - - } - - if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxPbuffer, drawId, - __glXPbufferRes, NullClient, - DixUnknownAccess); - if (pGlxPbuffer) { - if (pGlxPbuffer->pScreen != glxc->pScreen || - pGlxPbuffer->pFBConfig != glxc->pFBConfig) { - client->errorValue = drawId; - return BadMatch; - } - - pDraw = (DrawablePtr) pGlxPbuffer; - new_reply.writeVid = pGlxPbuffer->pFBConfig->id; - new_reply.writeType = GLX_PBUFFER_TYPE; - } - } - - if (!pDraw) { - /* - ** Drawable is not a Window , GLXWindow or a GLXPixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - } - else { - pDraw = 0; - } - - if (readId != None && readId != drawId) { - rc = dixLookupDrawable(&pReadDraw, readId, client, 0, DixReadAccess); - if (rc == Success) { - if (pReadDraw->type == DRAWABLE_WINDOW) { - /* - ** Drawable is an X Window. - */ - VisualID vid; - - pReadWin = (WindowPtr) pDraw; - vid = wVisual(pReadWin); - - new_reply.readVid = - (glxc->pFBConfig ? glxc->pFBConfig->id : vid); - new_reply.readType = GLX_WINDOW_TYPE; - - /* - ** Check if window and context are similar. - */ - if ((vid != glxc->pVisual->vid) || - (pReadWin->drawable.pScreen != glxc->pScreen)) { - client->errorValue = readId; - return BadMatch; - } - - } - else { - - /* - ** An X Pixmap is not allowed as a parameter (a GLX Pixmap - ** is, but it must first be created with glxCreateGLXPixmap). - */ - client->errorValue = readId; - return __glXBadDrawable; - } - } - - if (!pReadDraw) { - dixLookupResourceByType((void **) &pReadGlxPixmap, readId, - __glXPixmapRes, NullClient, - DixUnknownAccess); - if (pReadGlxPixmap) { - /* - ** Check if pixmap and context are similar. - */ - if (pReadGlxPixmap->pScreen != glxc->pScreen || - pReadGlxPixmap->pGlxVisual != glxc->pGlxVisual) { - client->errorValue = readId; - return BadMatch; - } - pReadDraw = pReadGlxPixmap->pDraw; - - new_reply.readVid = (glxc->pFBConfig ? glxc->pFBConfig->id : - pReadGlxPixmap->pGlxVisual->vid); - new_reply.readType = GLX_PIXMAP_TYPE; - - } - } - - if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxReadWindow, readId, - __glXWindowRes, NullClient, - DixUnknownAccess); - if (pGlxReadWindow) { - /* - ** Drawable is a GLXWindow. - ** - ** Check if GLX window and context are similar. - */ - if (pGlxReadWindow->pScreen != glxc->pScreen || - pGlxReadWindow->pGlxFBConfig != glxc->pFBConfig) { - client->errorValue = readId; - return BadMatch; - } - - pReadDraw = pGlxReadWindow->pDraw; - new_reply.readVid = pGlxReadWindow->pGlxFBConfig->id; - new_reply.readType = GLX_GLXWINDOW_TYPE; - } - } - - if (!pReadDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxReadPbuffer, readId, - __glXPbufferRes, NullClient, - DixUnknownAccess); - if (pGlxReadPbuffer) { - if (pGlxReadPbuffer->pScreen != glxc->pScreen || - pGlxReadPbuffer->pFBConfig != glxc->pFBConfig) { - client->errorValue = drawId; - return BadMatch; - } - - pReadDraw = (DrawablePtr) pGlxReadPbuffer; - new_reply.readVid = pGlxReadPbuffer->pFBConfig->id; - new_reply.readType = GLX_PBUFFER_TYPE; - } - } - - if (!pReadDraw) { - /* - ** Drawable is neither a Window nor a GLXPixmap. - */ - client->errorValue = readId; - return __glXBadDrawable; - } - - } - else { - pReadDraw = pDraw; - pReadGlxPixmap = pGlxPixmap; - pReadWin = pWin; - new_reply.readVid = new_reply.writeVid; - new_reply.readType = new_reply.writeType; - } - - if (prevglxc) { - - if (prevglxc->pGlxPixmap) { - /* - ** The previous drawable was a glx pixmap, release it. - */ - prevglxc->pGlxPixmap->refcnt--; - __glXFreeGLXPixmap(prevglxc->pGlxPixmap); - prevglxc->pGlxPixmap = 0; - } - - if (prevglxc->pGlxReadPixmap) { - /* - ** The previous drawable was a glx pixmap, release it. - */ - prevglxc->pGlxReadPixmap->refcnt--; - __glXFreeGLXPixmap(prevglxc->pGlxReadPixmap); - prevglxc->pGlxReadPixmap = 0; - } - - if (prevglxc->pGlxWindow) { - /* - ** The previous drawable was a glx window, release it. - */ - prevglxc->pGlxWindow->refcnt--; - __glXFreeGLXWindow(prevglxc->pGlxWindow); - prevglxc->pGlxWindow = 0; - } - - if (prevglxc->pGlxReadWindow) { - /* - ** The previous drawable was a glx window, release it. - */ - prevglxc->pGlxReadWindow->refcnt--; - __glXFreeGLXWindow(prevglxc->pGlxReadWindow); - prevglxc->pGlxReadWindow = 0; - } - - if (prevglxc->pGlxPbuffer) { - /* - ** The previous drawable was a glx Pbuffer, release it. - */ - prevglxc->pGlxPbuffer->refcnt--; - __glXFreeGLXPbuffer(prevglxc->pGlxPbuffer); - prevglxc->pGlxPbuffer = 0; - } - - if (prevglxc->pGlxReadPbuffer) { - /* - ** The previous drawable was a glx Pbuffer, release it. - */ - prevglxc->pGlxReadPbuffer->refcnt--; - __glXFreeGLXPbuffer(prevglxc->pGlxReadPbuffer); - prevglxc->pGlxReadPbuffer = 0; - } - - ChangeCurrentContext(cl, glxc, tag); - ChangeCurrentContext(cl, glxc, tag); - StopUsingContext(prevglxc); - } - else { - tag = AddCurrentContext(cl, glxc, pDraw); - } - if (glxc) { - - glxc->pGlxPixmap = pGlxPixmap; - glxc->pGlxReadPixmap = pReadGlxPixmap; - glxc->pGlxWindow = pGlxWindow; - glxc->pGlxReadWindow = pGlxReadWindow; - glxc->pGlxPbuffer = pGlxPbuffer; - glxc->pGlxReadPbuffer = pGlxReadPbuffer; - - if (pGlxPixmap) { - pGlxPixmap->refcnt++; - } - - if (pReadGlxPixmap) { - pReadGlxPixmap->refcnt++; - } - - if (pGlxWindow) { - pGlxWindow->refcnt++; - } - - if (pGlxReadWindow) { - pGlxReadWindow->refcnt++; - } - - if (pGlxPbuffer) { - pGlxPbuffer->refcnt++; - } - - if (pGlxReadPbuffer) { - pGlxReadPbuffer->refcnt++; - } - - StartUsingContext(cl, glxc); - new_reply.contextTag = tag; - } - else { - new_reply.contextTag = 0; - } - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - - if (pDraw && new_reply.writeType != GLX_PBUFFER_TYPE) { - dixLookupResourceByClass((void **) &pXinDraw, - pDraw->id, XRC_DRAWABLE, - client, DixReadAccess); - } - - if (pReadDraw && pReadDraw != pDraw && - new_reply.readType != GLX_PBUFFER_TYPE) { - dixLookupResourceByClass((void **) &pXinReadDraw, - pReadDraw->id, XRC_DRAWABLE, - client, DixReadAccess); - } - else { - pXinReadDraw = pXinDraw; - } - } -#endif - - /* send the MakeCurrent request to all required - * back-end servers. - */ - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - unsigned int be_draw = None; - unsigned int be_read_draw = None; - - if (pGlxPixmap) { - be_draw = pGlxPixmap->be_xids[s]; - } - else if (pGlxPbuffer) { - be_draw = pGlxPbuffer->be_xids[s]; - } -#ifdef PANORAMIX - else if (pXinDraw) { - dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); - } -#endif - else if (pGlxWindow) { - pWin = (WindowPtr) pGlxWindow->pDraw; - } - - if (pWin && be_draw == None) { - be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - if (!be_draw) { - /* it might be that the window did not created yet on the */ - /* back-end server (lazy window creation option), force */ - /* creation of the window */ - dmxCreateAndRealizeWindow(pWin, TRUE); - be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - } - } - - /* - * Before sending the MakeCurrent request - sync the - * X11 connection to the back-end servers to make sure - * that drawable is already created - */ - dmxSync(dmxScreen, 1); - - if (drawId == readId) { - LockDisplay(dpy); - GetReq(GLXMakeCurrent, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXMakeCurrent; - be_req->drawable = be_draw; - be_req->context = - (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0); - be_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s); - if (!_XReply(dpy, (xReply *) &be_reply, 0, False)) { - - /* The make current failed */ - UnlockDisplay(dpy); - SyncHandle(); - return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code)); - } - - UnlockDisplay(dpy); - SyncHandle(); - - SetCurrentBackEndTag(cl, tag, s, be_reply.contextTag); - } - else { - - if (pReadGlxPixmap) { - be_read_draw = pReadGlxPixmap->be_xids[s]; - } - else if (pGlxReadPbuffer) { - be_read_draw = pGlxReadPbuffer->be_xids[s]; - } -#ifdef PANORAMIX - else if (pXinReadDraw) { - dixLookupWindow(&pReadWin, pXinReadDraw->info[s].id, client, - DixReadAccess); - } -#endif - else if (pGlxReadWindow) { - pReadWin = (WindowPtr) pGlxReadWindow->pDraw; - } - - if (pReadWin && be_read_draw == None) { - be_read_draw = - (unsigned int) (DMX_GET_WINDOW_PRIV(pReadWin))->window; - if (!be_read_draw) { - /* it might be that the window did not created yet on the */ - /* back-end server (lazy window creation option), force */ - /* creation of the window */ - dmxCreateAndRealizeWindow(pReadWin, TRUE); - be_read_draw = - (unsigned int) (DMX_GET_WINDOW_PRIV(pReadWin))->window; - dmxSync(dmxScreen, 1); - } - } - - if (__GLX_IS_VERSION_SUPPORTED(1, 3)) { - LockDisplay(dpy); - GetReq(GLXMakeContextCurrent, be_new_req); - be_new_req->reqType = dmxScreen->glxMajorOpcode; - be_new_req->glxCode = X_GLXMakeContextCurrent; - be_new_req->drawable = be_draw; - be_new_req->readdrawable = be_read_draw; - be_new_req->context = - (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0); - be_new_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s); - if (!_XReply(dpy, (xReply *) &be_new_reply, 0, False)) { - - /* The make current failed */ - UnlockDisplay(dpy); - SyncHandle(); - return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code)); - } - - UnlockDisplay(dpy); - SyncHandle(); - - SetCurrentBackEndTag(cl, tag, s, be_new_reply.contextTag); - } - else if (glxIsExtensionSupported("GLX_SGI_make_current_read")) { - xGLXMakeCurrentReadSGIReq *ext_req; - xGLXVendorPrivateWithReplyReq *vpreq; - xGLXMakeCurrentReadSGIReply ext_reply; - - LockDisplay(dpy); - GetReqExtra(GLXVendorPrivateWithReply, - sz_xGLXMakeCurrentReadSGIReq - - sz_xGLXVendorPrivateWithReplyReq, vpreq); - ext_req = (xGLXMakeCurrentReadSGIReq *) vpreq; - ext_req->reqType = dmxScreen->glxMajorOpcode; - ext_req->glxCode = X_GLXVendorPrivateWithReply; - ext_req->vendorCode = X_GLXvop_MakeCurrentReadSGI; - ext_req->drawable = be_draw; - ext_req->readable = be_read_draw; - ext_req->context = - (unsigned int) (glxc ? glxc->real_ids[s - from_screen] : 0); - ext_req->oldContextTag = GetCurrentBackEndTag(cl, tag, s); - if (!_XReply(dpy, (xReply *) &ext_reply, 0, False)) { - - /* The make current failed */ - UnlockDisplay(dpy); - SyncHandle(); - return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code)); - } - - UnlockDisplay(dpy); - SyncHandle(); - - SetCurrentBackEndTag(cl, tag, s, ext_reply.contextTag); - - } - else { - return BadMatch; - } - } - - XFlush(dpy); - } - - if (client->swapped) { - __glXSwapMakeCurrentReply(client, &new_reply); - } - else { - WriteToClient(client, sz_xGLXMakeContextCurrentReply, &new_reply); - } - - return Success; -} - -int -__glXMakeCurrent(__GLXclientState * cl, GLbyte * pc) -{ - xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; - - return (MakeCurrent(cl, req->drawable, req->drawable, - req->context, req->oldContextTag)); -} - -int -__glXMakeContextCurrent(__GLXclientState * cl, GLbyte * pc) -{ - xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; - - return (MakeCurrent(cl, req->drawable, req->readdrawable, - req->context, req->oldContextTag)); -} - -int -__glXMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) -{ - xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; - - return (MakeCurrent(cl, req->drawable, req->readable, - req->context, req->oldContextTag)); -} - -int -__glXIsDirect(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; - xGLXIsDirectReply reply; - __GLXcontext *glxc; - - /* - ** Find the GL context. - */ - dixLookupResourceByType((void **) &glxc, req->context, __glXContextRes, - NullClient, DixUnknownAccess); - if (!glxc) { - client->errorValue = req->context; - return __glXBadContext; - } - - reply = (xGLXIsDirectReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - .isDirect = 0 - }; - - if (client->swapped) { - __glXSwapIsDirectReply(client, &reply); - } - else { - WriteToClient(client, sz_xGLXIsDirectReply, &reply); - } - - return Success; -} - -int -__glXQueryVersion(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - -/* xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; */ - - xGLXQueryVersionReply reply = { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = 0, - /* - ** Server should take into consideration the version numbers sent by the - ** client if it wants to work with older clients; however, in this - ** implementation the server just returns its version number. - */ - .majorVersion = __glXVersionMajor, - .minorVersion = __glXVersionMinor - }; - - if (client->swapped) { - __glXSwapQueryVersionReply(client, &reply); - } - else { - WriteToClient(client, sz_xGLXQueryVersionReply, &reply); - } - return Success; -} - -int -__glXWaitGL(__GLXclientState * cl, GLbyte * pc) -{ - xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; - xGLXWaitGLReq *be_req = (xGLXWaitGLReq *) pc; - int from_screen = 0; - int to_screen = 0; - int s; - __GLXcontext *glxc = NULL; - - if (req->contextTag != 0) { - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (glxc) { - from_screen = to_screen = glxc->pScreen->myNum; - } - } - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReq(GLXWaitGL, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXWaitGL; - be_req->contextTag = - (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0); - UnlockDisplay(dpy); - SyncHandle(); - - XSync(dpy, False); - } - - return Success; -} - -int -__glXWaitX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXWaitXReq *req = (xGLXWaitXReq *) pc; - xGLXWaitXReq *be_req; - int from_screen = 0; - int to_screen = 0; - int s; - __GLXcontext *glxc = NULL; - - if (req->contextTag != 0) { - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (glxc) { - from_screen = to_screen = glxc->pScreen->myNum; - } - } - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - dmxSync(dmxScreen, 1); - - LockDisplay(dpy); - GetReq(GLXWaitX, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXWaitX; - be_req->contextTag = - (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0); - UnlockDisplay(dpy); - SyncHandle(); - - XFlush(dpy); - } - - return Success; -} - -int -__glXCopyContext(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXCopyContextReq *be_req; - xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; - GLXContextID source = req->source; - GLXContextID dest = req->dest; - GLXContextTag tag = req->contextTag; - unsigned long mask = req->mask; - __GLXcontext *src, *dst; - int s; - int from_screen = 0; - int to_screen = 0; - - /* - ** Check that each context exists. - */ - dixLookupResourceByType((void **) &src, source, __glXContextRes, - NullClient, DixUnknownAccess); - if (!src) { - client->errorValue = source; - return __glXBadContext; - } - dixLookupResourceByType((void **) &dst, dest, __glXContextRes, - NullClient, DixUnknownAccess); - if (!dst) { - client->errorValue = dest; - return __glXBadContext; - } - - /* - ** They must be in the same address space, and same screen. - */ - if (src->pGlxScreen != dst->pGlxScreen) { - client->errorValue = source; - return BadMatch; - } - - /* - ** The destination context must not be current for any client. - */ - if (dst->isCurrent) { - client->errorValue = dest; - return BadAccess; - } - - if (tag) { - __GLXcontext *tagcx = __glXLookupContextByTag(cl, tag); - - if (!tagcx) { - return __glXBadContextTag; - } - if (tagcx != src) { - /* - ** This would be caused by a faulty implementation of the client - ** library. - */ - return BadMatch; - } - } - - from_screen = to_screen = src->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReq(GLXCopyContext, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXCopyContext; - be_req->source = (unsigned int) src->real_ids[s - from_screen]; - be_req->dest = (unsigned int) dst->real_ids[s - from_screen]; - be_req->mask = mask; - be_req->contextTag = - (tag ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0); - UnlockDisplay(dpy); - SyncHandle(); - } - - return Success; -} - -int -__glXGetVisualConfigs(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; - xGLXGetVisualConfigsReply reply; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; - - screen = req->screen; - if (screen >= screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - pGlxScreen = &__glXActiveScreens[screen]; - - reply = (xGLXGetVisualConfigsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .numVisuals = pGlxScreen->numGLXVisuals, - .numProps = __GLX_TOTAL_CONFIG, - .length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2 - }; - - WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); - - for (i = 0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { - /* not a usable visual */ - continue; - } - p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; - /* - ** Add token/value pairs for extensions. - */ - buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - buf[p++] = GLX_SAMPLES_SGIS; - buf[p++] = pGlxVisual->multiSampleSize; - buf[p++] = GLX_SAMPLE_BUFFERS_SGIS; - buf[p++] = pGlxVisual->nMultiSampleBuffers; - buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX; - buf[p++] = pGlxVisual->visualSelectGroup; - - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf); - } - return Success; -} - -/* -** Create a GLX Pixmap from an X Pixmap. -*/ -static int -CreateGLXPixmap(__GLXclientState * cl, - VisualID visual, GLXFBConfigID fbconfigId, - int screenNum, XID pixmapId, XID glxpixmapId) -{ - ClientPtr client = cl->client; - xGLXCreateGLXPixmapReq *be_req; - xGLXCreatePixmapReq *be_new_req; - DrawablePtr pDraw; - ScreenPtr pScreen; - VisualPtr pVisual; - __GLXpixmap *pGlxPixmap; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - __GLXFBConfig *pFBConfig; - int i, s, rc; - int from_screen, to_screen; - -#ifdef PANORAMIX - PanoramiXRes *pXinDraw = NULL; -#endif - - rc = dixLookupDrawable(&pDraw, pixmapId, client, M_DRAWABLE_PIXMAP, - DixAddAccess); - if (rc != Success) - return rc; - - /* - ** Check if screen of visual matches screen of pixmap. - */ - pScreen = pDraw->pScreen; - if (screenNum != pScreen->myNum) { - return BadMatch; - } - - if (fbconfigId == 0 && visual == 0) { - return BadValue; - } - - if (fbconfigId != None) { - pFBConfig = glxLookupFBConfig(fbconfigId); - if (!pFBConfig) { - client->errorValue = fbconfigId; - return BadValue; - } - visual = pFBConfig->associatedVisualId; - } - else { - pFBConfig = NULL; - } - - if (visual != None) { - /* - ** Find the VisualRec for this visual. - */ - pVisual = pScreen->visuals; - for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { - if (pVisual->vid == visual) { - break; - } - } - if (i == pScreen->numVisuals) { - client->errorValue = visual; - return BadValue; - } - /* - ** Check if depth of visual matches depth of pixmap. - */ - if (pVisual->nplanes != pDraw->depth) { - client->errorValue = visual; - return BadMatch; - } - - /* - ** Get configuration of the visual. - */ - pGlxScreen = &__glXActiveScreens[screenNum]; - pGlxVisual = pGlxScreen->pGlxVisual; - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == visual) { - break; - } - } - if (i == pGlxScreen->numVisuals) { - /* - ** Visual not support on this screen by this OpenGL implementation. - */ - client->errorValue = visual; - return BadValue; - } - - /* find the FBConfig for that visual (if any) */ - if (pFBConfig == NULL) { - pFBConfig = glxLookupFBConfigByVID(visual); - - if (pFBConfig == NULL) { - /* - * visual does not have an FBConfig ??? - client->errorValue = visual; - return BadValue; - */ - } - } - } - else { - pVisual = NULL; - pGlxVisual = NULL; - pGlxScreen = &__glXActiveScreens[pDraw->pScreen->myNum]; - } - - pGlxPixmap = (__GLXpixmap *) malloc(sizeof(__GLXpixmap)); - if (!pGlxPixmap) { - return BadAlloc; - } - pGlxPixmap->be_xids = xallocarray(screenInfo.numScreens, sizeof(XID)); - if (!pGlxPixmap->be_xids) { - free(pGlxPixmap); - return BadAlloc; - } - - pGlxPixmap->pDraw = pDraw; - pGlxPixmap->pGlxScreen = pGlxScreen; - pGlxPixmap->pGlxVisual = pGlxVisual; - pGlxPixmap->pFBConfig = pFBConfig; - pGlxPixmap->pScreen = pScreen; - pGlxPixmap->idExists = True; - pGlxPixmap->refcnt = 0; - - /* - ** Bump the ref count on the X pixmap so it won't disappear. - */ - ((PixmapPtr) pDraw)->refcnt++; - - /* - * send the request to the back-end server(s) - */ - from_screen = to_screen = screenNum; -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - - dixLookupResourceByClass((void **) &pXinDraw, - pDraw->id, XRC_DRAWABLE, - client, DixReadAccess); - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - Pixmap be_pixmap; - DrawablePtr pRealDraw = pDraw; - -#ifdef PANORAMIX - if (pXinDraw) { - dixLookupDrawable(&pRealDraw, pXinDraw->info[s].id, client, 0, - DixAddAccess); - } -#endif - - be_pixmap = (DMX_GET_PIXMAP_PRIV((PixmapPtr) pRealDraw))->pixmap; - - /* make sure pixmap already created on back-end */ - dmxSync(dmxScreen, 1); - - if (pFBConfig && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - __GLXFBConfig *be_FBConfig = - glxLookupBackEndFBConfig(pFBConfig->id, s); - - LockDisplay(dpy); - pGlxPixmap->be_xids[s] = XAllocID(dpy); - GetReq(GLXCreatePixmap, be_new_req); - be_new_req->reqType = dmxScreen->glxMajorOpcode; - be_new_req->glxCode = X_GLXCreatePixmap; - be_new_req->screen = DefaultScreen(dpy); - be_new_req->fbconfig = be_FBConfig->id; - be_new_req->pixmap = (unsigned int) be_pixmap; - be_new_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s]; - be_new_req->numAttribs = 0; - UnlockDisplay(dpy); - SyncHandle(); - } - else if (pFBConfig && glxIsExtensionSupported("GLX_SGIX_fbconfig")) { - __GLXFBConfig *be_FBConfig = - glxLookupBackEndFBConfig(pFBConfig->id, s); - xGLXCreateGLXPixmapWithConfigSGIXReq *ext_req; - xGLXVendorPrivateReq *vpreq; - - LockDisplay(dpy); - pGlxPixmap->be_xids[s] = XAllocID(dpy); - GetReqExtra(GLXVendorPrivate, - sz_xGLXCreateGLXPixmapWithConfigSGIXReq - - sz_xGLXVendorPrivateReq, vpreq); - ext_req = (xGLXCreateGLXPixmapWithConfigSGIXReq *) vpreq; - ext_req->reqType = dmxScreen->glxMajorOpcode; - ext_req->glxCode = X_GLXVendorPrivate; - ext_req->vendorCode = X_GLXvop_CreateGLXPixmapWithConfigSGIX; - ext_req->screen = DefaultScreen(dpy); - ext_req->fbconfig = be_FBConfig->id; - ext_req->pixmap = (unsigned int) be_pixmap; - ext_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s]; - UnlockDisplay(dpy); - SyncHandle(); - } - else if (pGlxVisual) { - LockDisplay(dpy); - pGlxPixmap->be_xids[s] = XAllocID(dpy); - GetReq(GLXCreateGLXPixmap, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXCreateGLXPixmap; - be_req->screen = DefaultScreen(dpy); - be_req->visual = - (unsigned int) glxMatchGLXVisualInConfigList(pGlxVisual, - dmxScreen-> - glxVisuals, - dmxScreen-> - numGlxVisuals); - be_req->pixmap = (unsigned int) be_pixmap; - be_req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s]; - UnlockDisplay(dpy); - SyncHandle(); - } - else { - client->errorValue = (visual ? visual : fbconfigId); - free(pGlxPixmap->be_xids); - free(pGlxPixmap); - return BadValue; - } - - XFlush(dpy); - } - - if (!(AddResource(glxpixmapId, __glXPixmapRes, pGlxPixmap))) - return BadAlloc; - - return Success; -} - -int -__glXCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - - return (CreateGLXPixmap(cl, req->visual, None, - req->screen, req->pixmap, req->glxpixmap)); -} - -int -__glXCreatePixmap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; - - return (CreateGLXPixmap(cl, None, req->fbconfig, - req->screen, req->pixmap, req->glxpixmap)); -} - -int -__glXDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; - XID glxpixmap = req->glxpixmap; - __GLXpixmap *pGlxPixmap; - int s; - int from_screen, to_screen; - - /* - ** Check if it's a valid GLX pixmap. - */ - dixLookupResourceByType((void **) &pGlxPixmap, glxpixmap, - __glXPixmapRes, NullClient, DixUnknownAccess); - if (!pGlxPixmap) { - client->errorValue = glxpixmap; - return __glXBadPixmap; - } - FreeResource(glxpixmap, FALSE); - - /* - * destroy the pixmap on the back-end server(s). - */ - from_screen = to_screen = pGlxPixmap->pDraw->pScreen->myNum; -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - /* make sure pixmap exist in back-end */ - dmxSync(dmxScreen, 1); - - LockDisplay(dpy); - GetReq(GLXDestroyGLXPixmap, req); - req->reqType = dmxScreen->glxMajorOpcode; - req->glxCode = X_GLXDestroyGLXPixmap; - req->glxpixmap = (unsigned int) pGlxPixmap->be_xids[s]; - UnlockDisplay(dpy); - SyncHandle(); - } - - return Success; -} - -/*****************************************************************************/ - -/* -** NOTE: There is no portable implementation for swap buffers as of -** this time that is of value. Consequently, this code must be -** implemented by somebody other than SGI. -*/ -int -__glXDoSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag) -{ - ClientPtr client = cl->client; - DrawablePtr pDraw; - xGLXSwapBuffersReq *be_req; - WindowPtr pWin = NULL; - __GLXpixmap *pGlxPixmap = NULL; - __GLXcontext *glxc = NULL; - -#ifdef PANORAMIX - PanoramiXRes *pXinDraw = NULL; -#endif - __glXWindow *pGlxWindow = NULL; - int from_screen = 0; - int to_screen = 0; - int s, rc; - - /* - ** Check that the GLX drawable is valid. - */ - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); - if (rc == Success) { - from_screen = to_screen = pDraw->pScreen->myNum; - - if (pDraw->type == DRAWABLE_WINDOW) { - /* - ** Drawable is an X window. - */ - pWin = (WindowPtr) pDraw; - } - else { - /* - ** Drawable is an X pixmap, which is not allowed. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - } - - if (!pDraw) { - dixLookupResourceByType((void **) &pGlxPixmap, drawId, - __glXPixmapRes, NullClient, DixUnknownAccess); - if (pGlxPixmap) { - /* - ** Drawable is a GLX pixmap. - */ - pDraw = pGlxPixmap->pDraw; - from_screen = to_screen = pGlxPixmap->pScreen->myNum; - } - } - - if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxWindow, drawId, - __glXWindowRes, NullClient, DixUnknownAccess); - if (pGlxWindow) { - /* - ** Drawable is a GLXWindow. - */ - pDraw = pGlxWindow->pDraw; - from_screen = to_screen = pGlxWindow->pScreen->myNum; - } - } - - if (!pDraw) { - /* - ** Drawable is neither a X window nor a GLX pixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - if (tag) { - glxc = __glXLookupContextByTag(cl, tag); - if (!glxc) { - return __glXBadContextTag; - } - } - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - dixLookupResourceByClass((void **) &pXinDraw, - pDraw->id, XRC_DRAWABLE, - client, DixReadAccess); - } -#endif - - /* If requested, send a glFinish to all back-end servers before swapping. */ - if (dmxGLXFinishSwap) { - for (s = from_screen; s <= to_screen; s++) { - Display *dpy = GetBackEndDisplay(cl, s); - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - xGLXSingleReq *finishReq; - xGLXSingleReply reply; - -#define X_GLXSingle 0 /* needed by GetReq below */ - - LockDisplay(dpy); - GetReq(GLXSingle, finishReq); - finishReq->reqType = dmxScreen->glxMajorOpcode; - finishReq->glxCode = X_GLsop_Finish; - finishReq->contextTag = - (tag ? GetCurrentBackEndTag(cl, tag, s) : 0); - (void) _XReply(dpy, (xReply *) &reply, 0, False); - UnlockDisplay(dpy); - SyncHandle(); - } - } - - /* If requested, send an XSync to all back-end servers before swapping. */ - if (dmxGLXSyncSwap) { - for (s = from_screen; s <= to_screen; s++) - XSync(GetBackEndDisplay(cl, s), False); - } - - /* send the SwapBuffers request to all back-end servers */ - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - unsigned int be_draw = 0; - - if (pGlxPixmap) { - be_draw = (unsigned int) pGlxPixmap->be_xids[s]; - } -#ifdef PANORAMIX - else if (pXinDraw) { - dixLookupWindow(&pWin, pXinDraw->info[s].id, client, DixReadAccess); - } -#endif - else if (pGlxWindow) { - pWin = (WindowPtr) pGlxWindow->pDraw; - } - - if (pWin && !be_draw) { - be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - if (!be_draw) { - /* it might be that the window did not created yet on the */ - /* back-end server (lazy window creation option), force */ - /* creation of the window */ - dmxCreateAndRealizeWindow(pWin, TRUE); - be_draw = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - } - } - - dmxSync(dmxScreen, 1); - - LockDisplay(dpy); - GetReq(GLXSwapBuffers, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXSwapBuffers; - be_req->drawable = be_draw; - be_req->contextTag = (tag ? GetCurrentBackEndTag(cl, tag, s) : 0); - UnlockDisplay(dpy); - SyncHandle(); - XFlush(dpy); - } - - return Success; -} - -int -__glXSwapBuffers(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - DrawablePtr pDraw; - xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; - GLXContextTag tag = req->contextTag; - XID drawId = req->drawable; - __GLXpixmap *pGlxPixmap = NULL; - __GLXcontext *glxc = NULL; - __glXWindow *pGlxWindow = NULL; - int rc; - - /* - ** Check that the GLX drawable is valid. - */ - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixWriteAccess); - if (rc == Success) { - if (pDraw->type != DRAWABLE_WINDOW) { - /* - ** Drawable is an X pixmap, which is not allowed. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - } - - if (!pDraw) { - dixLookupResourceByType((void **) &pGlxPixmap, drawId, - __glXPixmapRes, NullClient, DixUnknownAccess); - if (pGlxPixmap) { - /* - ** Drawable is a GLX pixmap. - */ - pDraw = pGlxPixmap->pDraw; - } - } - - if (!pDraw && __GLX_IS_VERSION_SUPPORTED(1, 3)) { - dixLookupResourceByType((void **) &pGlxWindow, drawId, - __glXWindowRes, NullClient, DixUnknownAccess); - if (pGlxWindow) { - /* - ** Drawable is a GLXWindow. - */ - pDraw = pGlxWindow->pDraw; - } - } - - if (!pDraw) { - /* - ** Drawable is neither a X window nor a GLX pixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - if (tag) { - glxc = __glXLookupContextByTag(cl, tag); - if (!glxc) { - return __glXBadContextTag; - } - } - - if (pDraw && - pDraw->type == DRAWABLE_WINDOW && - DMX_GET_WINDOW_PRIV((WindowPtr) pDraw)->swapGroup) { - return SGSwapBuffers(cl, drawId, tag, pDraw); - } - - return __glXDoSwapBuffers(cl, drawId, tag); -} - -/************************************************************************/ - -/* -** Render and Renderlarge are not in the GLX API. They are used by the GLX -** client library to send batches of GL rendering commands. -*/ - -/* -** Execute all the drawing commands in a request. -*/ -int -__glXRender(__GLXclientState * cl, GLbyte * pc) -{ - xGLXRenderReq *req; - xGLXRenderReq *be_req; - int size; - __GLXcontext *glxc; - int from_screen = 0; - int to_screen = 0; - int s; - - /* - ** NOTE: much of this code also appears in the byteswapping version of this - ** routine, __glXSwapRender(). Any changes made here should also be - ** duplicated there. - */ - - req = (xGLXRenderReq *) pc; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXRenderReq; - size = (req->length << 2) - sz_xGLXRenderReq; - - /* - * just forward the request to back-end server(s) - */ - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReq(GLXRender, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXRender; - be_req->length = req->length; - be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); - _XSend(dpy, (const char *) pc, size); - UnlockDisplay(dpy); - SyncHandle(); - } - - return Success; -} - -/* -** Execute a large rendering request (one that spans multiple X requests). -*/ -int -__glXRenderLarge(__GLXclientState * cl, GLbyte * pc) -{ - xGLXRenderLargeReq *req; - xGLXRenderLargeReq *be_req; - __GLXcontext *glxc; - int from_screen = 0; - int to_screen = 0; - int s; - - /* - ** NOTE: much of this code also appears in the byteswapping version of this - ** routine, __glXSwapRenderLarge(). Any changes made here should also be - ** duplicated there. - */ - - req = (xGLXRenderLargeReq *) pc; - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXRenderLargeReq; - - /* - * just forward the request to back-end server(s) - */ - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - GetReq(GLXRenderLarge, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXRenderLarge; - be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); - be_req->length = req->length; - be_req->requestNumber = req->requestNumber; - be_req->requestTotal = req->requestTotal; - be_req->dataBytes = req->dataBytes; - Data(dpy, (const char *) pc, req->dataBytes); - UnlockDisplay(dpy); - SyncHandle(); - - } - - return Success; -} - -/************************************************************************/ - -int -__glXVendorPrivate(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req; - - req = (xGLXVendorPrivateReq *) pc; - - switch (req->vendorCode) { - - case X_GLvop_DeleteTexturesEXT: - return __glXVForwardSingleReq(cl, pc); - break; - - case X_GLXvop_SwapIntervalSGI: - if (glxIsExtensionSupported("SGI_swap_control")) { - return __glXVForwardSingleReq(cl, pc); - } - else { - return Success; - } - break; - -#if 0 /* glx 1.3 */ - case X_GLXvop_CreateGLXVideoSourceSGIX: - break; - case X_GLXvop_DestroyGLXVideoSourceSGIX: - break; - case X_GLXvop_CreateGLXPixmapWithConfigSGIX: - break; - case X_GLXvop_DestroyGLXPbufferSGIX: - break; - case X_GLXvop_ChangeDrawableAttributesSGIX: - break; -#endif - - case X_GLXvop_BindSwapBarrierSGIX: - return __glXBindSwapBarrierSGIX(cl, pc); - break; - - case X_GLXvop_JoinSwapGroupSGIX: - return __glXJoinSwapGroupSGIX(cl, pc); - break; - - case X_GLXvop_CreateContextWithConfigSGIX: - return __glXCreateContextWithConfigSGIX(cl, pc); - break; - - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; - } - - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; - -} - -int -__glXVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateWithReplyReq *req; - - req = (xGLXVendorPrivateWithReplyReq *) pc; - - switch (req->vendorCode) { - - case X_GLvop_GetConvolutionFilterEXT: - case X_GLvop_GetConvolutionParameterfvEXT: - case X_GLvop_GetConvolutionParameterivEXT: - case X_GLvop_GetSeparableFilterEXT: - case X_GLvop_GetHistogramEXT: - case X_GLvop_GetHistogramParameterivEXT: - case X_GLvop_GetMinmaxEXT: - case X_GLvop_GetMinmaxParameterfvEXT: - case X_GLvop_GetMinmaxParameterivEXT: - case X_GLvop_AreTexturesResidentEXT: - case X_GLvop_IsTextureEXT: - return (__glXVForwardPipe0WithReply(cl, pc)); - break; - - case X_GLvop_GenTexturesEXT: - return (__glXVForwardAllWithReply(cl, pc)); - break; - -#if 0 /* glx1.3 */ - case X_GLvop_GetDetailTexFuncSGIS: - case X_GLvop_GetSharpenTexFuncSGIS: - case X_GLvop_GetColorTableSGI: - case X_GLvop_GetColorTableParameterfvSGI: - case X_GLvop_GetColorTableParameterivSGI: - case X_GLvop_GetTexFilterFuncSGIS: - case X_GLvop_GetInstrumentsSGIX: - case X_GLvop_InstrumentsBufferSGIX: - case X_GLvop_PollInstrumentsSGIX: - case X_GLvop_FlushRasterSGIX: - case X_GLXvop_CreateGLXPbufferSGIX: - case X_GLXvop_GetDrawableAttributesSGIX: - case X_GLXvop_QueryHyperpipeNetworkSGIX: - case X_GLXvop_QueryHyperpipeConfigSGIX: - case X_GLXvop_HyperpipeConfigSGIX: - case X_GLXvop_DestroyHyperpipeConfigSGIX: -#endif - case X_GLXvop_QueryMaxSwapBarriersSGIX: - return (__glXQueryMaxSwapBarriersSGIX(cl, pc)); - break; - - case X_GLXvop_GetFBConfigsSGIX: - return (__glXGetFBConfigsSGIX(cl, pc)); - break; - - case X_GLXvop_MakeCurrentReadSGI: - return (__glXMakeCurrentReadSGI(cl, pc)); - break; - - case X_GLXvop_QueryContextInfoEXT: - return (__glXQueryContextInfoEXT(cl, pc)); - break; - - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; - } - -} - -int -__glXQueryExtensionsString(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; - xGLXQueryExtensionsStringReply reply; - GLint screen; - size_t length; - int len, numbytes; - char *be_buf; - -#ifdef FWD_QUERY_REQ - xGLXQueryExtensionsStringReq *be_req; - xGLXQueryExtensionsStringReply be_reply; - DMXScreenInfo *dmxScreen; - Display *dpy; -#endif - - screen = req->screen; - - /* - ** Check if screen exists. - */ - if ((screen < 0) || (screen >= screenInfo.numScreens)) { - client->errorValue = screen; - return BadValue; - } - -#ifdef FWD_QUERY_REQ - dmxScreen = &dmxScreens[screen]; - - /* Send the glXQueryServerString request */ - dpy = GetBackEndDisplay(cl, screen); - LockDisplay(dpy); - GetReq(GLXQueryExtensionsString, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXQueryServerString; - be_req->screen = DefaultScreen(dpy); - _XReply(dpy, (xReply *) &be_reply, 0, False); - len = (int) be_reply.length; - numbytes = (int) be_reply.n; - be_buf = (char *) malloc(numbytes); - if (!be_buf) { - /* Throw data on the floor */ - _XEatDataWords(dpy, len); - } - else { - _XReadPad(dpy, (char *) be_buf, numbytes); - } - UnlockDisplay(dpy); - SyncHandle(); - -#else - - be_buf = __glXGetServerString(GLX_EXTENSIONS); - numbytes = strlen(be_buf) + 1; - len = __GLX_PAD(numbytes) >> 2; - -#endif - - length = len; - reply = (xGLXQueryExtensionsStringReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = len, - .n = numbytes - }; - - if (client->swapped) { - glxSwapQueryExtensionsStringReply(client, &reply, be_buf); - } - else { - WriteToClient(client, sz_xGLXQueryExtensionsStringReply, &reply); - WriteToClient(client, (int) (length << 2), be_buf); - } - - return Success; -} - -int -__glXQueryServerString(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; - xGLXQueryServerStringReply reply; - int name; - GLint screen; - size_t length; - int len, numbytes; - char *be_buf; - -#ifdef FWD_QUERY_REQ - xGLXQueryServerStringReq *be_req; - xGLXQueryServerStringReply be_reply; - DMXScreenInfo *dmxScreen; - Display *dpy; -#endif - - name = req->name; - screen = req->screen; - /* - ** Check if screen exists. - */ - if ((screen < 0) || (screen >= screenInfo.numScreens)) { - client->errorValue = screen; - return BadValue; - } - -#ifdef FWD_QUERY_REQ - dmxScreen = &dmxScreens[screen]; - - /* Send the glXQueryServerString request */ - dpy = GetBackEndDisplay(cl, screen); - LockDisplay(dpy); - GetReq(GLXQueryServerString, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXQueryServerString; - be_req->screen = DefaultScreen(dpy); - be_req->name = name; - _XReply(dpy, (xReply *) &be_reply, 0, False); - len = (int) be_reply.length; - numbytes = (int) be_reply.n; - be_buf = (char *) malloc(numbytes); - if (!be_buf) { - /* Throw data on the floor */ - _XEatDataWords(dpy, len); - } - else { - _XReadPad(dpy, (char *) be_buf, numbytes); - } - UnlockDisplay(dpy); - SyncHandle(); - -#else - be_buf = __glXGetServerString(name); - numbytes = strlen(be_buf) + 1; - len = __GLX_PAD(numbytes) >> 2; -#endif - - length = len; - reply = (xGLXQueryServerStringReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = length, - .n = numbytes - }; - - if (client->swapped) { - glxSwapQueryServerStringReply(client, &reply, be_buf); - } - else { - WriteToClient(client, sz_xGLXQueryServerStringReply, &reply); - WriteToClient(client, (int) (length << 2), be_buf); - } - - return Success; -} - -int -__glXClientInfo(__GLXclientState * cl, GLbyte * pc) -{ - xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; - xGLXClientInfoReq *be_req; - const char *buf; - int from_screen = 0; - int to_screen = 0; - int s; - - free(cl->GLClientextensions); - buf = (const char *) (req + 1); - cl->GLClientextensions = strdup(buf); - - to_screen = screenInfo.numScreens - 1; - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReq(GLXClientInfo, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXClientInfo; - be_req->major = req->major; - be_req->minor = req->minor; - be_req->length = req->length; - be_req->numbytes = req->numbytes; - Data(dpy, buf, req->numbytes); - - UnlockDisplay(dpy); - SyncHandle(); - } - - return Success; -} - -int -__glXUseXFont(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXUseXFontReq *req; - xGLXUseXFontReq *be_req; - FontPtr pFont; - __GLXcontext *glxc = NULL; - int from_screen = 0; - int to_screen = 0; - int s; - dmxFontPrivPtr pFontPriv; - DMXScreenInfo *dmxScreen; - Display *dpy; - - req = (xGLXUseXFontReq *) pc; - - if (req->contextTag != 0) { - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (glxc) { - from_screen = to_screen = glxc->pScreen->myNum; - } - } - - /* - ** Font can actually be either the ID of a font or the ID of a GC - ** containing a font. - */ - dixLookupResourceByType((void **) &pFont, req->font, RT_FONT, - NullClient, DixUnknownAccess); - if (!pFont) { - GC *pGC; - - dixLookupResourceByType((void **) &pGC, req->font, - RT_GC, NullClient, DixUnknownAccess); - if (!pGC) { - client->errorValue = req->font; - return BadFont; - } - pFont = pGC->font; - } - - pFontPriv = FontGetPrivate(pFont, dmxFontPrivateIndex); - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - dmxScreen = &dmxScreens[s]; - dpy = GetBackEndDisplay(cl, s); - - dmxSync(dmxScreen, 1); - - LockDisplay(dpy); - GetReq(GLXUseXFont, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXUseXFont; - be_req->contextTag = - (glxc ? GetCurrentBackEndTag(cl, req->contextTag, s) : 0); - be_req->font = pFontPriv->font[s]->fid; - be_req->first = req->first; - be_req->count = req->count; - be_req->listBase = req->listBase; - UnlockDisplay(dpy); - SyncHandle(); - - XSync(dpy, False); - } - - return Success; -} - -/* - * start GLX 1.3 here - */ - -int -__glXGetFBConfigs(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; - xGLXGetFBConfigsReply reply; - __GLXFBConfig *pFBConfig; - CARD32 buf[2 * __GLX_TOTAL_FBCONFIG_PROPS]; - int numAttribs = __GLX_TOTAL_FBCONFIG_PROPS; - unsigned int screen = req->screen; - int numFBConfigs, i, p; - __GLXscreenInfo *pGlxScreen; - - if (screen >= screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - - pGlxScreen = &__glXActiveScreens[screen]; - numFBConfigs = __glXNumFBConfigs; - - reply = (xGLXGetFBConfigsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = (numFBConfigs * 2 * numAttribs * __GLX_SIZE_CARD32) >> 2, - .numFBConfigs = numFBConfigs, - .numAttribs = numAttribs - }; - - if (client->swapped) { - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - __GLX_SWAP_INT(&reply.numFBConfigs); - __GLX_SWAP_INT(&reply.numAttribs); - } - WriteToClient(client, sz_xGLXGetFBConfigsReply, &reply); - - for (i = 0; i < numFBConfigs; i++) { - int associatedVisualId = 0; - int drawableTypeIndex; - - pFBConfig = __glXFBConfigs[i * (screenInfo.numScreens + 1)]; - - p = 0; - /* core attributes */ - buf[p++] = GLX_FBCONFIG_ID; - buf[p++] = pFBConfig->id; - buf[p++] = GLX_BUFFER_SIZE; - buf[p++] = pFBConfig->indexBits; - buf[p++] = GLX_LEVEL; - buf[p++] = pFBConfig->level; - buf[p++] = GLX_DOUBLEBUFFER; - buf[p++] = pFBConfig->doubleBufferMode; - buf[p++] = GLX_STEREO; - buf[p++] = pFBConfig->stereoMode; - buf[p++] = GLX_AUX_BUFFERS; - buf[p++] = pFBConfig->maxAuxBuffers; - buf[p++] = GLX_RED_SIZE; - buf[p++] = pFBConfig->redBits; - buf[p++] = GLX_GREEN_SIZE; - buf[p++] = pFBConfig->greenBits; - buf[p++] = GLX_BLUE_SIZE; - buf[p++] = pFBConfig->blueBits; - buf[p++] = GLX_ALPHA_SIZE; - buf[p++] = pFBConfig->alphaBits; - buf[p++] = GLX_DEPTH_SIZE; - buf[p++] = pFBConfig->depthBits; - buf[p++] = GLX_STENCIL_SIZE; - buf[p++] = pFBConfig->stencilBits; - buf[p++] = GLX_ACCUM_RED_SIZE; - buf[p++] = pFBConfig->accumRedBits; - buf[p++] = GLX_ACCUM_GREEN_SIZE; - buf[p++] = pFBConfig->accumGreenBits; - buf[p++] = GLX_ACCUM_BLUE_SIZE; - buf[p++] = pFBConfig->accumBlueBits; - buf[p++] = GLX_ACCUM_ALPHA_SIZE; - buf[p++] = pFBConfig->accumAlphaBits; - buf[p++] = GLX_RENDER_TYPE; - buf[p++] = pFBConfig->renderType; - buf[p++] = GLX_DRAWABLE_TYPE; - drawableTypeIndex = p; - buf[p++] = pFBConfig->drawableType; - buf[p++] = GLX_X_VISUAL_TYPE; - buf[p++] = pFBConfig->visualType; - buf[p++] = GLX_CONFIG_CAVEAT; - buf[p++] = pFBConfig->visualCaveat; - buf[p++] = GLX_TRANSPARENT_TYPE; - buf[p++] = pFBConfig->transparentType; - buf[p++] = GLX_TRANSPARENT_RED_VALUE; - buf[p++] = pFBConfig->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE; - buf[p++] = pFBConfig->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE; - buf[p++] = pFBConfig->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE; - buf[p++] = pFBConfig->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE; - buf[p++] = pFBConfig->transparentIndex; - buf[p++] = GLX_MAX_PBUFFER_WIDTH; - buf[p++] = pFBConfig->maxPbufferWidth; - buf[p++] = GLX_MAX_PBUFFER_HEIGHT; - buf[p++] = pFBConfig->maxPbufferHeight; - buf[p++] = GLX_MAX_PBUFFER_PIXELS; - buf[p++] = pFBConfig->maxPbufferPixels; - - /* - * find the visual of the back-end server and match a visual - * on the proxy. - * do only once - if a visual is not yet associated. - */ - if (pFBConfig->associatedVisualId == (unsigned int) -1) { - DMXScreenInfo *dmxScreen = &dmxScreens[screen]; - __GLXFBConfig *be_pFBConfig = - __glXFBConfigs[i * (screenInfo.numScreens + 1) + screen + 1]; - __GLXvisualConfig *pGlxVisual = NULL; - int v; - int found = 0; - - for (v = 0; v < dmxScreen->numGlxVisuals; v++) { - if (dmxScreen->glxVisuals[v].vid == - be_pFBConfig->associatedVisualId) { - pGlxVisual = &dmxScreen->glxVisuals[v]; - break; - } - } - - if (pGlxVisual) { - for (v = 0; v < pGlxScreen->numVisuals; v++) { - if (glxVisualsMatch(&pGlxScreen->pGlxVisual[v], pGlxVisual)) { - associatedVisualId = pGlxScreen->pGlxVisual[v].vid; - found = 1; - break; - } - } - } - - if (!found) { - associatedVisualId = 0; - pFBConfig->drawableType &= ~(GLX_WINDOW_BIT); - buf[drawableTypeIndex] = pFBConfig->drawableType; - } -#ifdef PANORAMIX - else if (!noPanoramiXExtension) { - /* convert the associated visualId to the panoramix one */ - pFBConfig->associatedVisualId = - PanoramiXTranslateVisualID(screen, v); - } -#endif - } - else { - associatedVisualId = pFBConfig->associatedVisualId; - } - - buf[p++] = GLX_VISUAL_ID; - buf[p++] = associatedVisualId; - - /* SGIS_multisample attributes */ - buf[p++] = GLX_SAMPLES_SGIS; - buf[p++] = pFBConfig->multiSampleSize; - buf[p++] = GLX_SAMPLE_BUFFERS_SGIS; - buf[p++] = pFBConfig->nMultiSampleBuffers; - - /* SGIX_pbuffer specific attributes */ - buf[p++] = GLX_OPTIMAL_PBUFFER_WIDTH_SGIX; - buf[p++] = pFBConfig->optimalPbufferWidth; - buf[p++] = GLX_OPTIMAL_PBUFFER_HEIGHT_SGIX; - buf[p++] = pFBConfig->optimalPbufferHeight; - - buf[p++] = GLX_VISUAL_SELECT_GROUP_SGIX; - buf[p++] = pFBConfig->visualSelectGroup; - - if (client->swapped) { - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - __GLX_SWAP_INT_ARRAY((int *) buf, 2 * numAttribs); - } - WriteToClient(client, 2 * numAttribs * __GLX_SIZE_CARD32, buf); - } - return Success; -} - -int -__glXGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; - xGLXGetFBConfigsReq new_req; - - new_req.reqType = req->reqType; - new_req.glxCode = req->glxCode; - new_req.length = req->length; - new_req.screen = req->screen; - - return (__glXGetFBConfigs(cl, (GLbyte *) &new_req)); -} - -int -__glXCreateWindow(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; - int screen = req->screen; - GLXFBConfigID fbconfigId = req->fbconfig; - XID windowId = req->window; - XID glxwindowId = req->glxwindow; - DrawablePtr pDraw; - ScreenPtr pScreen; - __glXWindow *pGlxWindow; - __GLXFBConfig *pGlxFBConfig = NULL; - VisualPtr pVisual; - VisualID visId; - int i, rc; - void *val; - - /* - ** Check if windowId is valid - */ - rc = dixLookupDrawable(&pDraw, windowId, client, M_DRAWABLE_WINDOW, - DixAddAccess); - if (rc != Success) - return rc; - - /* - ** Check if screen of window matches screen of fbconfig. - */ - pScreen = pDraw->pScreen; - if (screen != pScreen->myNum) { - return BadMatch; - } - - /* - ** Find the FBConfigRec for this fbconfigid. - */ - if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) { - client->errorValue = fbconfigId; - return __glXBadFBConfig; - } - visId = pGlxFBConfig->associatedVisualId; - - /* - ** Check if the fbconfig supports rendering to windows - */ - if (!(pGlxFBConfig->drawableType & GLX_WINDOW_BIT)) { - return BadMatch; - } - - if (visId != None) { - /* - ** Check if the visual ID is valid for this screen. - */ - pVisual = pScreen->visuals; - for (i = 0; i < pScreen->numVisuals; i++, pVisual++) { - if (pVisual->vid == visId) { - break; - } - } - if (i == pScreen->numVisuals) { - client->errorValue = visId; - return BadValue; - } - - /* - ** Check if color buffer depth of fbconfig matches depth - ** of window. - */ - if (pVisual->nplanes != pDraw->depth) { - return BadMatch; - } - } - else - /* - ** The window was created with no visual that corresponds - ** to fbconfig - */ - return BadMatch; - - /* - ** Check if there is already a fbconfig associated with this window - */ - if (Success == dixLookupResourceByType(&val, - glxwindowId, __glXWindowRes, - NullClient, DixUnknownAccess)) { - client->errorValue = glxwindowId; - return BadAlloc; - } - - pGlxWindow = (__glXWindow *) malloc(sizeof(__glXWindow)); - if (!pGlxWindow) { - return BadAlloc; - } - - /* - ** Register this GLX window as a resource - */ - if (!(AddResource(glxwindowId, __glXWindowRes, pGlxWindow))) { - return BadAlloc; - } - - pGlxWindow->pDraw = pDraw; - pGlxWindow->type = GLX_GLXWINDOW_TYPE; - pGlxWindow->idExists = True; - pGlxWindow->refcnt = 0; - pGlxWindow->pGlxFBConfig = pGlxFBConfig; - pGlxWindow->pScreen = pScreen; - - return Success; -} - -int -__glXDestroyWindow(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; - XID glxwindow = req->glxwindow; - void *val; - - /* - ** Check if it's a valid GLX window. - */ - if (Success != dixLookupResourceByType(&val, - glxwindow, __glXWindowRes, - NullClient, DixUnknownAccess)) { - client->errorValue = glxwindow; - return __glXBadDrawable; - } - /* - ** The glx window destructor will check whether it's current before - ** freeing anything. - */ - FreeResource(glxwindow, RT_NONE); - - return Success; -} - -int -__glXQueryContext(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - __GLXcontext *ctx; - xGLXQueryContextReq *req; - xGLXQueryContextReply reply; - int nProps; - int *sendBuf, *pSendBuf; - int nReplyBytes; - - req = (xGLXQueryContextReq *) pc; - dixLookupResourceByType((void **) &ctx, req->context, __glXContextRes, - NullClient, DixUnknownAccess); - if (!ctx) { - client->errorValue = req->context; - return __glXBadContext; - } - - nProps = 3; - - reply = (xGLXQueryContextReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = nProps << 1, - .n = nProps - }; - - nReplyBytes = reply.length << 2; - sendBuf = (int *) malloc(nReplyBytes); - pSendBuf = sendBuf; - *pSendBuf++ = GLX_FBCONFIG_ID; - *pSendBuf++ = (int) (ctx->pFBConfig->id); - *pSendBuf++ = GLX_RENDER_TYPE; - *pSendBuf++ = renderTypeBitsToRenderTypeEnum(ctx->pFBConfig->renderType); - *pSendBuf++ = GLX_SCREEN; - *pSendBuf++ = (int) (ctx->pScreen->myNum); - - if (client->swapped) { - __glXSwapQueryContextReply(client, &reply, sendBuf); - } - else { - WriteToClient(client, sz_xGLXQueryContextReply, &reply); - WriteToClient(client, nReplyBytes, sendBuf); - } - free((char *) sendBuf); - - return Success; -} - -int -__glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - __GLXcontext *ctx; - xGLXQueryContextInfoEXTReq *req; - xGLXQueryContextInfoEXTReply reply; - int nProps; - int *sendBuf, *pSendBuf; - int nReplyBytes; - - req = (xGLXQueryContextInfoEXTReq *) pc; - dixLookupResourceByType((void **) &ctx, - req->context, __glXContextRes, - client, DixReadAccess); - - if (!ctx) { - client->errorValue = req->context; - return __glXBadContext; - } - - nProps = 4; - - reply = (xGLXQueryContextInfoEXTReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = nProps << 1, - .n = nProps - }; - - nReplyBytes = reply.length << 2; - sendBuf = (int *) malloc(nReplyBytes); - pSendBuf = sendBuf; - *pSendBuf++ = GLX_SHARE_CONTEXT_EXT; - *pSendBuf++ = (int) (ctx->share_id); - *pSendBuf++ = GLX_VISUAL_ID_EXT; - *pSendBuf++ = (int) (ctx->pVisual ? ctx->pVisual->vid : 0); - *pSendBuf++ = GLX_SCREEN_EXT; - *pSendBuf++ = (int) (ctx->pScreen->myNum); - *pSendBuf++ = GLX_FBCONFIG_ID; - *pSendBuf++ = (int) (ctx->pFBConfig ? ctx->pFBConfig->id : 0); - - if (client->swapped) { - __glXSwapQueryContextInfoEXTReply(client, &reply, sendBuf); - } - else { - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, &reply); - WriteToClient(client, nReplyBytes, sendBuf); - } - free((char *) sendBuf); - - return Success; -} - -int -__glXCreatePbuffer(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; - xGLXCreatePbufferReq *be_req; - int screen = req->screen; - GLXFBConfigID fbconfigId = req->fbconfig; - GLXPbuffer pbuffer = req->pbuffer; - __glXPbuffer *pGlxPbuffer; - int numAttribs = req->numAttribs; - int *attr; - ScreenPtr pScreen; - __GLXFBConfig *pGlxFBConfig; - __GLXFBConfig *be_pGlxFBConfig; - XID be_xid; - Display *dpy; - DMXScreenInfo *dmxScreen; - int s; - int from_screen, to_screen; - - /* - ** Look up screen and FBConfig. - */ - if (screen >= screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - pScreen = screenInfo.screens[screen]; - - /* - ** Find the FBConfigRec for this fbconfigid. - */ - if (!(pGlxFBConfig = glxLookupFBConfig(fbconfigId))) { - client->errorValue = fbconfigId; - return __glXBadFBConfig; - } - - /* - ** Create the GLX part of the Pbuffer. - */ - pGlxPbuffer = (__glXPbuffer *) malloc(sizeof(__glXPbuffer)); - if (!pGlxPbuffer) { - return BadAlloc; - } - - pGlxPbuffer->be_xids = xallocarray(screenInfo.numScreens, sizeof(XID)); - if (!pGlxPbuffer->be_xids) { - free(pGlxPbuffer); - return BadAlloc; - } - - /* - * Allocate an XID on the back-end server(s) and send him the request - */ - from_screen = to_screen = screen; -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - dpy = GetBackEndDisplay(cl, s); - be_xid = XAllocID(dpy); - dmxScreen = &dmxScreens[s]; - be_pGlxFBConfig = glxLookupBackEndFBConfig(pGlxFBConfig->id, s); - - attr = (int *) (req + 1); - - LockDisplay(dpy); - GetReqExtra(GLXCreatePbuffer, 2 * numAttribs * __GLX_SIZE_CARD32, - be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXCreatePbuffer; - be_req->screen = be_pGlxFBConfig->screen; - be_req->fbconfig = be_pGlxFBConfig->id; - be_req->pbuffer = be_xid; - be_req->numAttribs = numAttribs; - - /* Send attributes */ - if (attr != NULL) { - CARD32 *pca = (CARD32 *) (be_req + 1); - - while (numAttribs-- > 0) { - *pca++ = *attr++; /* token */ - *pca++ = *attr++; /* value */ - } - } - - UnlockDisplay(dpy); - SyncHandle(); - - pGlxPbuffer->be_xids[s] = be_xid; - } - - pGlxPbuffer->idExists = True; - pGlxPbuffer->refcnt = 0; - pGlxPbuffer->pFBConfig = pGlxFBConfig; - pGlxPbuffer->pScreen = pScreen; - - /* - ** Register the resource. - */ - if (!(AddResource(pbuffer, __glXPbufferRes, pGlxPbuffer))) { - return BadAlloc; - } - - return Success; - -} - -int -__glXDestroyPbuffer(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; - xGLXDestroyPbufferReq *be_req; - GLXPbuffer pbuffer = req->pbuffer; - Display *dpy; - int screen; - DMXScreenInfo *dmxScreen; - __glXPbuffer *pGlxPbuffer; - int s; - int from_screen, to_screen; - - /* - ** Check if it's a valid Pbuffer - */ - dixLookupResourceByType((void **) &pGlxPbuffer, pbuffer, - __glXPbufferRes, NullClient, DixUnknownAccess); - if (!pGlxPbuffer) { - client->errorValue = pbuffer; - return __glXBadPbuffer; - } - - screen = pGlxPbuffer->pScreen->myNum; - - from_screen = to_screen = screen; -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - for (s = from_screen; s <= to_screen; s++) { - dpy = GetBackEndDisplay(cl, s); - dmxScreen = &dmxScreens[s]; - - /* send the destroy request to the back-end server */ - LockDisplay(dpy); - GetReq(GLXDestroyPbuffer, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXDestroyPbuffer; - be_req->pbuffer = pGlxPbuffer->be_xids[s]; - UnlockDisplay(dpy); - SyncHandle(); - } - - FreeResource(pbuffer, RT_NONE); - - return Success; -} - -int -__glXGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) -{ - xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; - xGLXGetDrawableAttributesReq *be_req; - xGLXGetDrawableAttributesReply reply; - ClientPtr client = cl->client; - GLXDrawable drawId = req->drawable; - GLXDrawable be_drawable = 0; - DrawablePtr pDraw = NULL; - Display *dpy; - int screen, rc; - DMXScreenInfo *dmxScreen; - CARD32 *attribs = NULL; - int attribs_size = 0; - -#ifdef PANORAMIX - PanoramiXRes *pXinDraw = NULL; -#endif - - if (drawId != None) { - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixGetAttrAccess); - if (rc == Success && pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDraw; - - be_drawable = 0; - screen = pWin->drawable.pScreen->myNum; - } - else { - /* - ** Drawable is not a Window , GLXWindow or a GLXPixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - if (!pDraw) { - __GLXpixmap *pGlxPixmap; - - dixLookupResourceByType((void **) &pGlxPixmap, - drawId, __glXPixmapRes, - NullClient, DixUnknownAccess); - if (pGlxPixmap) { - pDraw = pGlxPixmap->pDraw; - screen = pGlxPixmap->pScreen->myNum; - be_drawable = pGlxPixmap->be_xids[screen]; - } - } - - if (!pDraw) { - __glXWindow *pGlxWindow; - - dixLookupResourceByType((void **) &pGlxWindow, - drawId, __glXWindowRes, - NullClient, DixUnknownAccess); - if (pGlxWindow) { - pDraw = pGlxWindow->pDraw; - screen = pGlxWindow->pScreen->myNum; - be_drawable = 0; - } - } - - if (!pDraw) { - __glXPbuffer *pGlxPbuffer; - - dixLookupResourceByType((void **) &pGlxPbuffer, - drawId, __glXPbufferRes, - NullClient, DixUnknownAccess); - if (pGlxPbuffer) { - pDraw = (DrawablePtr) pGlxPbuffer; - screen = pGlxPbuffer->pScreen->myNum; - be_drawable = pGlxPbuffer->be_xids[screen]; - } - } - } - - if (!pDraw) { - /* - ** Drawable is not a Window , GLXWindow or a GLXPixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - /* if the drawable is a window or GLXWindow - - * we need to find the base id on the back-end server - */ - if (!be_drawable) { - WindowPtr pWin = (WindowPtr) pDraw; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - if (Success != dixLookupResourceByClass((void **) &pXinDraw, - pDraw->id, XRC_DRAWABLE, - client, DixReadAccess)) { - client->errorValue = drawId; - return __glXBadDrawable; - } - - dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, - DixReadAccess); - } -#endif - - if (pWin) { - be_drawable = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - if (!be_drawable) { - /* it might be that the window did not created yet on the */ - /* back-end server (lazy window creation option), force */ - /* creation of the window */ - dmxCreateAndRealizeWindow(pWin, TRUE); - be_drawable = - (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - } - } - else { - client->errorValue = drawId; - return __glXBadDrawable; - } - } - - /* send the request to the back-end server */ - dpy = GetBackEndDisplay(cl, screen); - dmxScreen = &dmxScreens[screen]; - - /* make sure drawable exists on back-end */ - dmxSync(dmxScreen, 1); - - LockDisplay(dpy); - GetReq(GLXGetDrawableAttributes, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXGetDrawableAttributes; - be_req->drawable = be_drawable; - be_req->length = req->length; - if (!_XReply(dpy, (xReply *) &reply, 0, False)) { - UnlockDisplay(dpy); - SyncHandle(); - return (BE_TO_CLIENT_ERROR(dmxLastErrorEvent.error_code)); - } - - if (reply.numAttribs) { - attribs = xallocarray(reply.numAttribs, 2 * __GLX_SIZE_CARD32); - if (attribs == NULL) { - UnlockDisplay(dpy); - SyncHandle(); - return BadAlloc; - } - attribs_size = 2 * reply.numAttribs * __GLX_SIZE_CARD32; - - _XRead(dpy, (char *) attribs, attribs_size); - } - - UnlockDisplay(dpy); - SyncHandle(); - - /* send the reply back to the client */ - reply.sequenceNumber = client->sequence; - if (client->swapped) { - __glXSwapGetDrawableAttributesReply(client, &reply, (int *) attribs); - } - else { - WriteToClient(client, sz_xGLXGetDrawableAttributesReply, &reply); - WriteToClient(client, attribs_size, attribs); - } - - free(attribs); - - return Success; -} - -int -__glXChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) -{ - xGLXChangeDrawableAttributesReq *req = - (xGLXChangeDrawableAttributesReq *) pc; - xGLXChangeDrawableAttributesReq *be_req; - ClientPtr client = cl->client; - GLXDrawable drawId = req->drawable; - GLXDrawable be_drawable = 0; - DrawablePtr pDraw = NULL; - Display *dpy; - int screen, rc; - DMXScreenInfo *dmxScreen; - - if (drawId != None) { - rc = dixLookupDrawable(&pDraw, drawId, client, 0, DixSetAttrAccess); - if (rc == Success && pDraw->type == DRAWABLE_WINDOW) { - be_drawable = 0; - screen = pDraw->pScreen->myNum; - } - else { - /* - ** Drawable is not a Window , GLXWindow or a GLXPixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - if (!pDraw) { - __GLXpixmap *pGlxPixmap; - - dixLookupResourceByType((void **) &pGlxPixmap, - drawId, __glXPixmapRes, - NullClient, DixUnknownAccess); - if (pGlxPixmap) { - pDraw = pGlxPixmap->pDraw; - screen = pGlxPixmap->pScreen->myNum; - be_drawable = pGlxPixmap->be_xids[screen]; - } - } - - if (!pDraw) { - __glXWindow *pGlxWindow; - - dixLookupResourceByType((void **) &pGlxWindow, - drawId, __glXWindowRes, - NullClient, DixUnknownAccess); - if (pGlxWindow) { - pDraw = pGlxWindow->pDraw; - screen = pGlxWindow->pScreen->myNum; - be_drawable = 0; - } - } - - if (!pDraw) { - __glXPbuffer *pGlxPbuffer; - - dixLookupResourceByType((void **) &pGlxPbuffer, - drawId, __glXPbufferRes, - NullClient, DixUnknownAccess); - if (pGlxPbuffer) { - pDraw = (DrawablePtr) pGlxPbuffer; - screen = pGlxPbuffer->pScreen->myNum; - be_drawable = pGlxPbuffer->be_xids[screen]; - } - } - } - - if (!pDraw) { - /* - ** Drawable is not a Window , GLXWindow or a GLXPixmap. - */ - client->errorValue = drawId; - return __glXBadDrawable; - } - - /* if the drawable is a window or GLXWindow - - * we need to find the base id on the back-end server - */ - if (!be_drawable) { - WindowPtr pWin = (WindowPtr) pDraw; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - PanoramiXRes *pXinDraw; - - if (Success != dixLookupResourceByClass((void **) &pXinDraw, - pDraw->id, XRC_DRAWABLE, - client, DixReadAccess)) { - client->errorValue = drawId; - return __glXBadDrawable; - } - - dixLookupWindow(&pWin, pXinDraw->info[screen].id, client, - DixReadAccess); - } -#endif - - if (pWin) { - be_drawable = (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - if (!be_drawable) { - /* it might be that the window did not created yet on the */ - /* back-end server (lazy window creation option), force */ - /* creation of the window */ - dmxCreateAndRealizeWindow(pWin, TRUE); - be_drawable = - (unsigned int) (DMX_GET_WINDOW_PRIV(pWin))->window; - } - } - else { - client->errorValue = drawId; - return __glXBadDrawable; - } - } - - /* send the request to the back-end server */ - dpy = GetBackEndDisplay(cl, screen); - dmxScreen = &dmxScreens[screen]; - - /* make sure drawable exists on back-end */ - dmxSync(dmxScreen, 1); - - LockDisplay(dpy); - GetReqExtra(GLXChangeDrawableAttributes, - 2 * req->numAttribs * __GLX_SIZE_CARD32, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLXChangeDrawableAttributes; - be_req->drawable = be_drawable; - be_req->numAttribs = req->numAttribs; - be_req->length = req->length; - - UnlockDisplay(dpy); - SyncHandle(); - - return Success; -} - -int -__glXSendLargeCommand(__GLXclientState * cl, GLXContextTag contextTag) -{ - ClientPtr client = cl->client; - xGLXRenderLargeReq *req; - GLint maxSize, amount; - GLint totalRequests, requestNumber; - GLint dataLen; - GLbyte *data; - __GLXcontext *glxc; - int s; - int from_screen, to_screen; - - maxSize = cl->largeCmdMaxReqDataSize - (GLint) sizeof(xGLXRenderLargeReq); - dataLen = cl->largeCmdBytesTotal; - totalRequests = (dataLen / maxSize); - if (dataLen % maxSize) - totalRequests++; - - glxc = __glXLookupContextByTag(cl, contextTag); - if (!glxc) { - client->errorValue = contextTag; - return __glXBadContext; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - /* - ** Send enough requests until the whole array is sent. - */ - requestNumber = 1; - data = cl->largeCmdBuf; - while (dataLen > 0) { - amount = dataLen; - if (amount > maxSize) { - amount = maxSize; - } - - for (s = from_screen; s <= to_screen; s++) { - - Display *dpy = GetBackEndDisplay(cl, s); - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - - LockDisplay(dpy); - GetReq(GLXRenderLarge, req); - req->reqType = dmxScreen->glxMajorOpcode; - req->glxCode = X_GLXRenderLarge; - req->contextTag = GetCurrentBackEndTag(cl, contextTag, s); - req->length += (amount + 3) >> 2; - req->requestNumber = requestNumber++; - req->requestTotal = totalRequests; - req->dataBytes = amount; - Data(dpy, ((const char *) data), amount); - dataLen -= amount; - data = ((GLbyte *) data) + amount; - UnlockDisplay(dpy); - SyncHandle(); - } - } - - return Success; -} diff --git a/hw/dmx/glxProxy/glxcmds.h b/hw/dmx/glxProxy/glxcmds.h deleted file mode 100644 index 689e33485..000000000 --- a/hw/dmx/glxProxy/glxcmds.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2011 Apple Inc. - * - * 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. - */ - -#ifndef __GLX_cmds_h__ -#define __GLX_cmds_h__ - -extern int __glXBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc); -extern int __glXCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc); -extern int __glXJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc); -extern int __glXMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc); -extern int __glXQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc); -extern int __glXDoSwapBuffers(__GLXclientState * cl, XID drawId, - GLXContextTag tag); - -extern Display *GetBackEndDisplay(__GLXclientState * cl, int s); -extern int GetCurrentBackEndTag(__GLXclientState * cl, GLXContextTag tag, - int s); - -#endif /* !__GLX_cmds_h__ */ diff --git a/hw/dmx/glxProxy/glxcmdsswap.c b/hw/dmx/glxProxy/glxcmdsswap.c deleted file mode 100644 index b7fc1c56f..000000000 --- a/hw/dmx/glxProxy/glxcmdsswap.c +++ /dev/null @@ -1,1157 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" -#include "glxutil.h" -#include <g_disptab.h> -#include <pixmapstr.h> -#include <windowstr.h> -#include "unpack.h" -#include "glxcmds.h" -#include "glxext.h" -#include "glxvendor.h" - -int __glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc); - -/************************************************************************/ - -/* -** Byteswapping versions of GLX commands. In most cases they just swap -** the incoming arguments and then call the unswapped routine. For commands -** that have replies, a separate swapping routine for the reply is provided; -** it is called at the end of the unswapped routine. -*/ - -int -__glXSwapCreateContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateContextReq *req = (xGLXCreateContextReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->visual); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->shareList); - - return __glXCreateContext(cl, pc); -} - -int -__glXSwapCreateNewContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateNewContextReq *req = (xGLXCreateNewContextReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->shareList); - - return __glXCreateNewContext(cl, pc); -} - -int -__glXSwapCreateContextWithConfigSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateContextWithConfigSGIXReq *req = - (xGLXCreateContextWithConfigSGIXReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->shareList); - - return __glXCreateContextWithConfigSGIX(cl, pc); -} - -int -__glXSwapQueryMaxSwapBarriersSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXQueryMaxSwapBarriersSGIXReq *req = - (xGLXQueryMaxSwapBarriersSGIXReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - - return __glXQueryMaxSwapBarriersSGIX(cl, pc); -} - -int -__glXSwapBindSwapBarrierSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXBindSwapBarrierSGIXReq *req = (xGLXBindSwapBarrierSGIXReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->barrier); - - return __glXBindSwapBarrierSGIX(cl, pc); -} - -int -__glXSwapJoinSwapGroupSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXJoinSwapGroupSGIXReq *req = (xGLXJoinSwapGroupSGIXReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->member); - - return __glXJoinSwapGroupSGIX(cl, pc); -} - -int -__glXSwapDestroyContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXDestroyContextReq *req = (xGLXDestroyContextReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return __glXDestroyContext(cl, pc); -} - -int -__glXSwapMakeCurrent(__GLXclientState * cl, GLbyte * pc) -{ - xGLXMakeCurrentReq *req = (xGLXMakeCurrentReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->oldContextTag); - - return __glXMakeCurrent(cl, pc); -} - -int -__glXSwapMakeContextCurrent(__GLXclientState * cl, GLbyte * pc) -{ - xGLXMakeContextCurrentReq *req = (xGLXMakeContextCurrentReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->readdrawable); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->oldContextTag); - - return __glXMakeContextCurrent(cl, pc); -} - -int -__glXSwapMakeCurrentReadSGI(__GLXclientState * cl, GLbyte * pc) -{ - xGLXMakeCurrentReadSGIReq *req = (xGLXMakeCurrentReadSGIReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->readable); - __GLX_SWAP_INT(&req->context); - __GLX_SWAP_INT(&req->oldContextTag); - - return __glXMakeCurrentReadSGI(cl, pc); -} - -int -__glXSwapIsDirect(__GLXclientState * cl, GLbyte * pc) -{ - xGLXIsDirectReq *req = (xGLXIsDirectReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return __glXIsDirect(cl, pc); -} - -int -__glXSwapQueryVersion(__GLXclientState * cl, GLbyte * pc) -{ - xGLXQueryVersionReq *req = (xGLXQueryVersionReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->majorVersion); - __GLX_SWAP_INT(&req->minorVersion); - - return __glXQueryVersion(cl, pc); -} - -int -__glXSwapWaitGL(__GLXclientState * cl, GLbyte * pc) -{ - xGLXWaitGLReq *req = (xGLXWaitGLReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - return __glXWaitGL(cl, pc); -} - -int -__glXSwapWaitX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXWaitXReq *req = (xGLXWaitXReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - return __glXWaitX(cl, pc); -} - -int -__glXSwapCopyContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCopyContextReq *req = (xGLXCopyContextReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->source); - __GLX_SWAP_INT(&req->dest); - __GLX_SWAP_INT(&req->mask); - - return __glXCopyContext(cl, pc); -} - -int -__glXSwapGetVisualConfigs(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXGetVisualConfigsReq *req = (xGLXGetVisualConfigsReq *) pc; - xGLXGetVisualConfigsReply reply; - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - CARD32 buf[__GLX_TOTAL_CONFIG]; - unsigned int screen; - int i, p; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(&req->screen); - screen = req->screen; - if (screen >= screenInfo.numScreens) { - /* The client library must send a valid screen number. */ - client->errorValue = screen; - return BadValue; - } - pGlxScreen = &__glXActiveScreens[screen]; - - reply = (xGLXGetVisualConfigsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = (pGlxScreen->numGLXVisuals * __GLX_SIZE_CARD32 * - __GLX_TOTAL_CONFIG) >> 2, - .numVisuals = pGlxScreen->numGLXVisuals, - .numProps = __GLX_TOTAL_CONFIG - }; - - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - __GLX_SWAP_INT(&reply.numVisuals); - __GLX_SWAP_INT(&reply.numProps); - WriteToClient(client, sz_xGLXGetVisualConfigsReply, &reply); - - for (i = 0; i < pGlxScreen->numVisuals; i++) { - pGlxVisual = &pGlxScreen->pGlxVisual[i]; - if (!pGlxScreen->isGLXvis[i] || pGlxVisual->vid == 0) { - /* not a usable visual */ - continue; - } - p = 0; - buf[p++] = pGlxVisual->vid; - buf[p++] = pGlxVisual->class; - buf[p++] = pGlxVisual->rgba; - - buf[p++] = pGlxVisual->redSize; - buf[p++] = pGlxVisual->greenSize; - buf[p++] = pGlxVisual->blueSize; - buf[p++] = pGlxVisual->alphaSize; - buf[p++] = pGlxVisual->accumRedSize; - buf[p++] = pGlxVisual->accumGreenSize; - buf[p++] = pGlxVisual->accumBlueSize; - buf[p++] = pGlxVisual->accumAlphaSize; - - buf[p++] = pGlxVisual->doubleBuffer; - buf[p++] = pGlxVisual->stereo; - - buf[p++] = pGlxVisual->bufferSize; - buf[p++] = pGlxVisual->depthSize; - buf[p++] = pGlxVisual->stencilSize; - buf[p++] = pGlxVisual->auxBuffers; - buf[p++] = pGlxVisual->level; - /* - ** Add token/value pairs for extensions. - */ - buf[p++] = GLX_VISUAL_CAVEAT_EXT; - buf[p++] = pGlxVisual->visualRating; - buf[p++] = GLX_TRANSPARENT_TYPE_EXT; - buf[p++] = pGlxVisual->transparentPixel; - buf[p++] = GLX_TRANSPARENT_RED_VALUE_EXT; - buf[p++] = pGlxVisual->transparentRed; - buf[p++] = GLX_TRANSPARENT_GREEN_VALUE_EXT; - buf[p++] = pGlxVisual->transparentGreen; - buf[p++] = GLX_TRANSPARENT_BLUE_VALUE_EXT; - buf[p++] = pGlxVisual->transparentBlue; - buf[p++] = GLX_TRANSPARENT_ALPHA_VALUE_EXT; - buf[p++] = pGlxVisual->transparentAlpha; - buf[p++] = GLX_TRANSPARENT_INDEX_VALUE_EXT; - buf[p++] = pGlxVisual->transparentIndex; - - __GLX_SWAP_INT_ARRAY(buf, __GLX_TOTAL_CONFIG); - WriteToClient(client, __GLX_SIZE_CARD32 * __GLX_TOTAL_CONFIG, buf); - } - return Success; -} - -int -__glXSwapCreateGLXPixmap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateGLXPixmapReq *req = (xGLXCreateGLXPixmapReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->visual); - __GLX_SWAP_INT(&req->pixmap); - __GLX_SWAP_INT(&req->glxpixmap); - - return __glXCreateGLXPixmap(cl, pc); -} - -int -__glXSwapCreatePixmap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreatePixmapReq *req = (xGLXCreatePixmapReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->pixmap); - __GLX_SWAP_INT(&req->glxpixmap); - __GLX_SWAP_INT(&req->numAttribs); - - return __glXCreatePixmap(cl, pc); -} - -int -__glXSwapDestroyGLXPixmap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXDestroyGLXPixmapReq *req = (xGLXDestroyGLXPixmapReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->glxpixmap); - - return __glXDestroyGLXPixmap(cl, pc); -} - -int -__glXSwapSwapBuffers(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSwapBuffersReq *req = (xGLXSwapBuffersReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - __GLX_SWAP_INT(&req->drawable); - - return __glXSwapBuffers(cl, pc); -} - -int -__glXSwapUseXFont(__GLXclientState * cl, GLbyte * pc) -{ - xGLXUseXFontReq *req = (xGLXUseXFontReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - __GLX_SWAP_INT(&req->font); - __GLX_SWAP_INT(&req->first); - __GLX_SWAP_INT(&req->count); - __GLX_SWAP_INT(&req->listBase); - - return __glXUseXFont(cl, pc); -} - -int -__glXSwapQueryExtensionsString(__GLXclientState * cl, GLbyte * pc) -{ - xGLXQueryExtensionsStringReq *req = (xGLXQueryExtensionsStringReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - - return __glXQueryExtensionsString(cl, pc); -} - -int -__glXSwapQueryServerString(__GLXclientState * cl, GLbyte * pc) -{ - xGLXQueryServerStringReq *req = (xGLXQueryServerStringReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->name); - - return __glXQueryServerString(cl, pc); -} - -int -__glXSwapClientInfo(__GLXclientState * cl, GLbyte * pc) -{ - xGLXClientInfoReq *req = (xGLXClientInfoReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->major); - __GLX_SWAP_INT(&req->minor); - __GLX_SWAP_INT(&req->numbytes); - - return __glXClientInfo(cl, pc); -} - -int -__glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc) -{ - xGLXQueryContextInfoEXTReq *req = (xGLXQueryContextInfoEXTReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return __glXQueryContextInfoEXT(cl, (GLbyte *) pc); -} - -/************************************************************************/ - -/* -** Swap replies. -*/ - -void -__glXSwapMakeCurrentReply(ClientPtr client, xGLXMakeCurrentReadSGIReply * reply) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->contextTag); - __GLX_SWAP_INT(&reply->writeVid); - __GLX_SWAP_INT(&reply->writeType); - __GLX_SWAP_INT(&reply->readVid); - __GLX_SWAP_INT(&reply->readType); - WriteToClient(client, sz_xGLXMakeCurrentReadSGIReply, reply); -} - -void -__glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - WriteToClient(client, sz_xGLXIsDirectReply, reply); -} - -void -__glXSwapQueryVersionReply(ClientPtr client, xGLXQueryVersionReply * reply) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->majorVersion); - __GLX_SWAP_INT(&reply->minorVersion); - WriteToClient(client, sz_xGLXQueryVersionReply, reply); -} - -void -glxSwapQueryExtensionsStringReply(ClientPtr client, - xGLXQueryExtensionsStringReply * reply, - char *buf) -{ - int length = reply->length; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryExtensionsStringReply, reply); - __GLX_SWAP_INT_ARRAY((int *) buf, length); - WriteToClient(client, length << 2, buf); -} - -void -glxSwapQueryServerStringReply(ClientPtr client, - xGLXQueryServerStringReply * reply, char *buf) -{ - int length = reply->length; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryServerStringReply, reply); - /** no swap is needed for an array of chars **/ - /* __GLX_SWAP_INT_ARRAY((int *)buf, length); */ - WriteToClient(client, length << 2, buf); -} - -void -__glXSwapQueryContextInfoEXTReply(ClientPtr client, - xGLXQueryContextInfoEXTReply * reply, - int *buf) -{ - int length = reply->length; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextInfoEXTReply, reply); - __GLX_SWAP_INT_ARRAY((int *) buf, length); - WriteToClient(client, length << 2, buf); -} - -void -__glXSwapQueryContextReply(ClientPtr client, - xGLXQueryContextReply * reply, int *buf) -{ - int length = reply->length; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->n); - WriteToClient(client, sz_xGLXQueryContextReply, reply); - __GLX_SWAP_INT_ARRAY((int *) buf, length); - WriteToClient(client, length << 2, buf); -} - -void -__glXSwapGetDrawableAttributesReply(ClientPtr client, - xGLXGetDrawableAttributesReply * reply, - int *buf) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->numAttribs); - __GLX_SWAP_INT_ARRAY(buf, reply->length); - WriteToClient(client, sz_xGLXGetDrawableAttributesReply, reply); - WriteToClient(client, reply->length << 2, buf); -} - -void -__glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, - xGLXQueryMaxSwapBarriersSGIXReply * - reply) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->max); - WriteToClient(client, sz_xGLXQueryMaxSwapBarriersSGIXReply, reply); -} - -/************************************************************************/ - -/* -** Render and Renderlarge are not in the GLX API. They are used by the GLX -** client library to send batches of GL rendering commands. -*/ - -int -__glXSwapRender(__GLXclientState * cl, GLbyte * pc) -{ - xGLXRenderReq *req; - int left; - __GLXrenderHeader *hdr; - ClientPtr client = cl->client; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - /* - ** NOTE: much of this code also appears in the nonswapping version of this - ** routine, __glXRender(). Any changes made here should also be - ** duplicated there. - */ - - req = (xGLXRenderReq *) pc; - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - pc += sz_xGLXRenderReq; - left = (req->length << 2) - sz_xGLXRenderReq; - while (left > 0) { - void (*proc) (GLbyte *); - CARD16 opcode; - - /* - ** Verify that the header length and the overall length agree. - ** Also, each command must be word aligned. - */ - hdr = (__GLXrenderHeader *) pc; - __GLX_SWAP_SHORT(&hdr->length); - __GLX_SWAP_SHORT(&hdr->opcode); - - /* - * call the command procedure to swap any arguments - */ - opcode = hdr->opcode; - if ((opcode >= __GLX_MIN_RENDER_OPCODE) && - (opcode <= __GLX_MAX_RENDER_OPCODE)) { - proc = __glXSwapRenderTable[opcode]; -#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT - } - else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && - (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) { - int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; - __GLXRenderSwapInfo *info = &__glXSwapRenderTable_EXT[index]; - - if (info->swapfunc) { - proc = info->swapfunc; - } - else { - proc = NULL; - if (info->elem_size == 4 && info->nelems > 0) { - __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_HDR_SIZE), - info->nelems); - } - else if (info->elem_size == 2 && info->nelems > 0) { - __GLX_SWAP_SHORT_ARRAY((short *) (pc + - __GLX_RENDER_HDR_SIZE), - info->nelems); - } - else if (info->elem_size == 8 && info->nelems > 0) { - __GLX_SWAP_DOUBLE_ARRAY((double *) (pc + - __GLX_RENDER_HDR_SIZE), - info->nelems); - } - } -#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ - } - else { - client->errorValue = 0; - return __glXBadRenderRequest; - } - - if (proc != NULL) - (*proc) (pc + __GLX_RENDER_HDR_SIZE); - - /* - * proceed to the next command - */ - pc += hdr->length; - left -= hdr->length; - } - - return __glXRender(cl, (GLbyte *) req); -} - -/* -** Execute a large rendering request (one that spans multiple X requests). -*/ -int -__glXSwapRenderLarge(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXRenderLargeReq *req; - __GLXrenderLargeHeader *hdr; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - req = (xGLXRenderLargeReq *) pc; - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - __GLX_SWAP_INT(&req->dataBytes); - __GLX_SWAP_SHORT(&req->requestNumber); - __GLX_SWAP_SHORT(&req->requestTotal); - - pc += sz_xGLXRenderLargeReq; - - if (req->requestNumber == 1) { - void (*proc) (GLbyte *) = NULL; - __GLXRenderSwapInfo *info = NULL; - CARD16 opcode; - - hdr = (__GLXrenderLargeHeader *) pc; - __GLX_SWAP_INT(&hdr->length); - __GLX_SWAP_INT(&hdr->opcode); - - /* - * call the command procedure to swap any arguments - * Note that we are assuming that all arguments that needs to be - * swapped are on the first req only ! - */ - opcode = hdr->opcode; - if ((opcode >= __GLX_MIN_RENDER_OPCODE) && - (opcode <= __GLX_MAX_RENDER_OPCODE)) { - proc = __glXSwapRenderTable[opcode]; -#if __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT - } - else if ((opcode >= __GLX_MIN_RENDER_OPCODE_EXT) && - (opcode <= __GLX_MAX_RENDER_OPCODE_EXT)) { - int index = opcode - __GLX_MIN_RENDER_OPCODE_EXT; - - info = &__glXSwapRenderTable_EXT[index]; - if (info->swapfunc) { - proc = info->swapfunc; - } -#endif /* __GLX_MAX_RENDER_OPCODE_EXT > __GLX_MIN_RENDER_OPCODE_EXT */ - } - else { - client->errorValue = 0; - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - - /* - ** Make enough space in the buffer, then copy the entire request. - */ - if (cl->largeCmdBufSize < hdr->length) { - if (!cl->largeCmdBuf) { - cl->largeCmdBuf = (GLbyte *) malloc(hdr->length); - } - else { - cl->largeCmdBuf = - (GLbyte *) realloc(cl->largeCmdBuf, hdr->length); - } - if (!cl->largeCmdBuf) { - cl->largeCmdRequestsTotal = 0; - return BadAlloc; - } - cl->largeCmdBufSize = hdr->length; - } - memcpy(cl->largeCmdBuf, pc, req->dataBytes); - - cl->largeCmdBytesSoFar = req->dataBytes; - cl->largeCmdBytesTotal = hdr->length; - cl->largeCmdRequestsSoFar = 1; - cl->largeCmdRequestsTotal = req->requestTotal; - cl->largeCmdRequestsSwapProc = proc; - cl->largeCmdMaxReqDataSize = req->dataBytes; - cl->largeCmdRequestsSwap_info = info; - - return Success; - - } - else if (req->requestNumber < cl->largeCmdRequestsTotal) { - /* - * This is not the first nor last request - just copy the data - */ - if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - - memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes); - - cl->largeCmdBytesSoFar += req->dataBytes; - - if (req->dataBytes > cl->largeCmdMaxReqDataSize) - cl->largeCmdMaxReqDataSize = req->dataBytes; - - return Success; - } - else if (req->requestNumber == cl->largeCmdRequestsTotal) { - /* - * this is the last request - * copy the remainder bytes, call the procedure to swap any - * needed data, and then call to transfer the command to all - * back-end servers - */ - if (cl->largeCmdBytesSoFar + req->dataBytes > cl->largeCmdBytesTotal) { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - - memcpy(cl->largeCmdBuf + cl->largeCmdBytesSoFar, pc, req->dataBytes); - - cl->largeCmdBytesSoFar += req->dataBytes; - - if (req->dataBytes > cl->largeCmdMaxReqDataSize) - cl->largeCmdMaxReqDataSize = req->dataBytes; - - if (cl->largeCmdRequestsSwapProc != NULL) { - (*cl->largeCmdRequestsSwapProc) (cl->largeCmdBuf + - __GLX_RENDER_LARGE_HDR_SIZE); - } - else if (cl->largeCmdRequestsSwap_info && - cl->largeCmdRequestsSwap_info->nelems > 0) { - if (cl->largeCmdRequestsSwap_info->elem_size == 4) { - __GLX_SWAP_INT_ARRAY((int *) (pc + __GLX_RENDER_LARGE_HDR_SIZE), - cl->largeCmdRequestsSwap_info->nelems); - } - else if (cl->largeCmdRequestsSwap_info->elem_size == 2) { - __GLX_SWAP_SHORT_ARRAY((short *) (pc + - __GLX_RENDER_LARGE_HDR_SIZE), - cl->largeCmdRequestsSwap_info->nelems); - } - else if (cl->largeCmdRequestsSwap_info->elem_size == 8) { - __GLX_SWAP_DOUBLE_ARRAY((double *) (pc + - __GLX_RENDER_LARGE_HDR_SIZE), - cl->largeCmdRequestsSwap_info->nelems); - } - } - - cl->largeCmdRequestsTotal = 0; - return (__glXSendLargeCommand(cl, req->contextTag)); - - } - else { - cl->largeCmdRequestsTotal = 0; - return __glXBadLargeRequest; - } - -} - -/************************************************************************/ - -/* -** No support is provided for the vendor-private requests other than -** allocating these entry points in the dispatch table. -*/ - -int -__glXSwapVendorPrivate(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req; - CARD32 vendorCode; - - __GLX_DECLARE_SWAP_VARIABLES; - - req = (xGLXVendorPrivateReq *) pc; - vendorCode = req->vendorCode; - __GLX_SWAP_INT(&vendorCode); - - switch (vendorCode) { - - case X_GLvop_DeleteTexturesEXT: - return __glXVForwardSingleReqSwap(cl, pc); - break; - - case X_GLXvop_SwapIntervalSGI: - if (glxIsExtensionSupported("SGI_swap_control")) { - return __glXVForwardSingleReqSwap(cl, pc); - } - else { - return Success; - } - break; - -#if 0 /* glx 1.3 */ - case X_GLXvop_CreateGLXVideoSourceSGIX: - break; - case X_GLXvop_DestroyGLXVideoSourceSGIX: - break; - case X_GLXvop_CreateGLXPixmapWithConfigSGIX: - break; - case X_GLXvop_DestroyGLXPbufferSGIX: - break; - case X_GLXvop_ChangeDrawableAttributesSGIX: - break; -#endif - - case X_GLXvop_JoinSwapGroupSGIX: - return __glXSwapJoinSwapGroupSGIX(cl, pc); - break; - - case X_GLXvop_BindSwapBarrierSGIX: - return __glXSwapBindSwapBarrierSGIX(cl, pc); - break; - - case X_GLXvop_CreateContextWithConfigSGIX: - return __glXSwapCreateContextWithConfigSGIX(cl, pc); - break; - - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; - } - -} - -int -__glXSwapVendorPrivateWithReply(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateWithReplyReq *req; - CARD32 vendorCode; - - __GLX_DECLARE_SWAP_VARIABLES; - - req = (xGLXVendorPrivateWithReplyReq *) pc; - vendorCode = req->vendorCode; - __GLX_SWAP_INT(&vendorCode); - - switch (vendorCode) { - - case X_GLvop_GetConvolutionFilterEXT: - case X_GLvop_GetSeparableFilterEXT: - case X_GLvop_GetHistogramEXT: - case X_GLvop_GetMinmaxEXT: - return (__glXNoSuchSingleOpcode(cl, pc)); - break; - - case X_GLvop_GetConvolutionParameterfvEXT: - case X_GLvop_GetConvolutionParameterivEXT: - case X_GLvop_GetHistogramParameterivEXT: - case X_GLvop_GetMinmaxParameterfvEXT: - case X_GLvop_GetMinmaxParameterivEXT: - case X_GLvop_GenTexturesEXT: - return (__glXVForwardAllWithReplySwapiv(cl, pc)); - break; - - case X_GLvop_AreTexturesResidentEXT: - case X_GLvop_IsTextureEXT: - return (__glXVForwardPipe0WithReplySwap(cl, pc)); - break; - -#if 0 /* glx1.3 */ - case X_GLvop_GetDetailTexFuncSGIS: - case X_GLvop_GetSharpenTexFuncSGIS: - case X_GLvop_GetColorTableSGI: - case X_GLvop_GetColorTableParameterfvSGI: - case X_GLvop_GetColorTableParameterivSGI: - case X_GLvop_GetTexFilterFuncSGIS: - case X_GLvop_GetInstrumentsSGIX: - case X_GLvop_InstrumentsBufferSGIX: - case X_GLvop_PollInstrumentsSGIX: - case X_GLvop_FlushRasterSGIX: - case X_GLXvop_CreateGLXPbufferSGIX: - case X_GLXvop_GetDrawableAttributesSGIX: - case X_GLXvop_QueryHyperpipeNetworkSGIX: - case X_GLXvop_QueryHyperpipeConfigSGIX: - case X_GLXvop_HyperpipeConfigSGIX: - case X_GLXvop_DestroyHyperpipeConfigSGIX: -#endif - case X_GLXvop_QueryMaxSwapBarriersSGIX: - return (__glXSwapQueryMaxSwapBarriersSGIX(cl, pc)); - break; - - case X_GLXvop_GetFBConfigsSGIX: - return (__glXSwapGetFBConfigsSGIX(cl, pc)); - break; - - case X_GLXvop_MakeCurrentReadSGI: - return (__glXSwapMakeCurrentReadSGI(cl, pc)); - break; - - case X_GLXvop_QueryContextInfoEXT: - return (__glXSwapQueryContextInfoEXT(cl, (char *) pc)); - break; - - default: - /* - ** unsupported private request - */ - cl->client->errorValue = req->vendorCode; - return __glXUnsupportedPrivateRequest; - } - -} - -int -__glXSwapGetFBConfigs(__GLXclientState * cl, GLbyte * pc) -{ - xGLXGetFBConfigsReq *req = (xGLXGetFBConfigsReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - - return __glXGetFBConfigs(cl, pc); -} - -int -__glXSwapGetFBConfigsSGIX(__GLXclientState * cl, GLbyte * pc) -{ - xGLXGetFBConfigsSGIXReq *req = (xGLXGetFBConfigsSGIXReq *) pc; - xGLXGetFBConfigsReq new_req; - - new_req.reqType = req->reqType; - new_req.glxCode = req->glxCode; - new_req.length = req->length; - new_req.screen = req->screen; - - return (__glXSwapGetFBConfigs(cl, (GLbyte *) &new_req)); -} - -int -__glXSwapCreateWindow(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreateWindowReq *req = (xGLXCreateWindowReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->window); - __GLX_SWAP_INT(&req->glxwindow); - __GLX_SWAP_INT(&req->numAttribs); - - return (__glXCreateWindow(cl, (GLbyte *) pc)); -} - -int -__glXSwapDestroyWindow(__GLXclientState * cl, GLbyte * pc) -{ - xGLXDestroyWindowReq *req = (xGLXDestroyWindowReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->glxwindow); - - return (__glXDestroyWindow(cl, (GLbyte *) pc)); -} - -int -__glXSwapQueryContext(__GLXclientState * cl, GLbyte * pc) -{ - xGLXQueryContextReq *req = (xGLXQueryContextReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->context); - - return (__glXQueryContext(cl, (GLbyte *) pc)); - -} - -int -__glXSwapCreatePbuffer(__GLXclientState * cl, GLbyte * pc) -{ - xGLXCreatePbufferReq *req = (xGLXCreatePbufferReq *) pc; - int nattr = req->numAttribs; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->screen); - __GLX_SWAP_INT(&req->fbconfig); - __GLX_SWAP_INT(&req->pbuffer); - __GLX_SWAP_INT(&req->numAttribs); - __GLX_SWAP_INT_ARRAY((int *) (req + 1), nattr * 2); - - return (__glXCreatePbuffer(cl, pc)); -} - -int -__glXSwapDestroyPbuffer(__GLXclientState * cl, GLbyte * pc) -{ - xGLXDestroyPbufferReq *req = (xGLXDestroyPbufferReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->pbuffer); - - return (__glXDestroyPbuffer(cl, (GLbyte *) pc)); -} - -int -__glXSwapGetDrawableAttributes(__GLXclientState * cl, GLbyte * pc) -{ - xGLXGetDrawableAttributesReq *req = (xGLXGetDrawableAttributesReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - - return (__glXGetDrawableAttributes(cl, pc)); -} - -int -__glXSwapChangeDrawableAttributes(__GLXclientState * cl, GLbyte * pc) -{ - xGLXChangeDrawableAttributesReq *req = - (xGLXChangeDrawableAttributesReq *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->drawable); - __GLX_SWAP_INT(&req->numAttribs); - __GLX_SWAP_INT_ARRAY((int *) (req + 1), req->numAttribs * 2); - - return (__glXChangeDrawableAttributes(cl, pc)); -} diff --git a/hw/dmx/glxProxy/glxcontext.h b/hw/dmx/glxProxy/glxcontext.h deleted file mode 100644 index 479186ca5..000000000 --- a/hw/dmx/glxProxy/glxcontext.h +++ /dev/null @@ -1,109 +0,0 @@ -#ifndef _GLX_context_h_ -#define _GLX_context_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -typedef struct __GLXcontextRec __GLXcontext; - -struct __GLXcontextRec { - /* - ** list of context structs - */ - struct __GLXcontextRec *last; - struct __GLXcontextRec *next; - - /* - ** Pointer to screen info data for this context. This is set - ** when the context is created. - */ - ScreenPtr pScreen; - __GLXscreenInfo *pGlxScreen; - - /* - ** This context is created with respect to this visual. - */ - VisualRec *pVisual; - __GLXvisualConfig *pGlxVisual; - __GLXFBConfig *pFBConfig; - - /* - ** The XID of this context. - */ - XID id; - XID *real_ids; - - /* - ** The XID of the shareList context. - */ - XID share_id; - - /* - ** Visual id. - */ - VisualID vid; - VisualID *real_vids; - - /* - ** screen number. - */ - GLint screen; - - /* - ** Whether this context's ID still exists. - */ - GLboolean idExists; - - /* - ** Whether this context is current for some client. - */ - GLboolean isCurrent; - - /* - ** Buffers for feedback and selection. - */ - GLfloat *feedbackBuf; - GLint feedbackBufSize; /* number of elements allocated */ - GLuint *selectBuf; - GLint selectBufSize; /* number of elements allocated */ - - /* - ** Set only if current drawable is a glx pixmap. - */ - __GLXpixmap *pGlxPixmap; - __GLXpixmap *pGlxReadPixmap; - __glXWindow *pGlxWindow; - __glXWindow *pGlxReadWindow; - __glXPbuffer *pGlxPbuffer; - __glXPbuffer *pGlxReadPbuffer; - -}; - -#endif /* !__GLX_context_h__ */ diff --git a/hw/dmx/glxProxy/glxdrawable.h b/hw/dmx/glxProxy/glxdrawable.h deleted file mode 100644 index 0340896e5..000000000 --- a/hw/dmx/glxProxy/glxdrawable.h +++ /dev/null @@ -1,65 +0,0 @@ -#ifndef _GLX_drawable_h_ -#define _GLX_drawable_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -typedef struct { - - DrawablePtr pDraw; - __GLXvisualConfig *pGlxVisual; - __GLXscreenInfo *pGlxScreen; - __GLXFBConfig *pFBConfig; - ScreenPtr pScreen; - Bool idExists; - int refcnt; - XID *be_xids; - -} __GLXpixmap; - -typedef struct { - DrawablePtr pDraw; - int type; - Bool idExists; - int refcnt; /* contexts bound */ - __GLXFBConfig *pGlxFBConfig; - ScreenPtr pScreen; -} __glXWindow; - -typedef struct { - __GLXscreenInfo *pGlxScreen; - __GLXFBConfig *pFBConfig; - ScreenPtr pScreen; - Bool idExists; - int refcnt; - XID *be_xids; -} __glXPbuffer; - -#endif /* !__GLX_drawable_h__ */ diff --git a/hw/dmx/glxProxy/glxerror.h b/hw/dmx/glxProxy/glxerror.h deleted file mode 100644 index 26492d2d4..000000000 --- a/hw/dmx/glxProxy/glxerror.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef _GLX_error_h_ -#define _GLX_error_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -/* -** Error codes. These have the extension error base added to them -** when the extension initializes. -*/ -extern int __glXerrorBase; -extern int __glXBadContext; -extern int __glXBadContextState; -extern int __glXBadDrawable; -extern int __glXBadPixmap; -extern int __glXBadCurrentWindow; -extern int __glXBadContextTag; -extern int __glXBadRenderRequest; -extern int __glXBadLargeRequest; -extern int __glXUnsupportedPrivateRequest; -extern int __glXBadFBConfig; -extern int __glXBadPbuffer; - -#endif diff --git a/hw/dmx/glxProxy/glxext.c b/hw/dmx/glxProxy/glxext.c deleted file mode 100644 index ca9780f99..000000000 --- a/hw/dmx/glxProxy/glxext.c +++ /dev/null @@ -1,497 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" - -#include "glxserver.h" -#include <windowstr.h> -#include <propertyst.h> -#include <os.h> -#include "g_disptab.h" -#include "glxutil.h" -#include "glxext.h" -#include "glxvisuals.h" -#include "micmap.h" -#include "glxswap.h" -#include "extinit.h" -#include "glx_extinit.h" - -/* -** Forward declarations. -*/ -static int __glXSwapDispatch(ClientPtr); -static int __glXDispatch(ClientPtr); - -/* -** Called when the extension is reset. -*/ -static void -ResetExtension(ExtensionEntry * extEntry) -{ - __glXFlushContextCache(); - __glXScreenReset(); - SwapBarrierReset(); -} - -/* -** Initialize the per-client context storage. -*/ -static void -ResetClientState(int clientIndex) -{ - __GLXclientState *cl = __glXClients[clientIndex]; - Display **keep_be_displays; - int i; - - free(cl->returnBuf); - free(cl->currentContexts); - free(cl->currentDrawables); - free(cl->largeCmdBuf); - - for (i = 0; i < screenInfo.numScreens; i++) { - if (cl->be_displays[i]) - XCloseDisplay(cl->be_displays[i]); - } - - keep_be_displays = cl->be_displays; - memset(cl, 0, sizeof(__GLXclientState)); - cl->be_displays = keep_be_displays; - - free(cl->GLClientextensions); - - memset(cl->be_displays, 0, screenInfo.numScreens * sizeof(Display *)); -} - -/* -** This procedure is called when the client who created the context goes -** away OR when glXDestroyContext is called. In either case, all we do is -** flag that the ID is no longer valid, and (maybe) free the context. -** use. -*/ -static int -ContextGone(__GLXcontext * cx, XID id) -{ - cx->idExists = GL_FALSE; - if (!cx->isCurrent) { - __glXFreeContext(cx); - } - - return True; -} - -/* -** Free a client's state. -*/ -static int -ClientGone(int clientIndex, XID id) -{ - __GLXcontext *cx; - __GLXclientState *cl = __glXClients[clientIndex]; - int i; - - if (cl) { - /* - ** Free all the contexts that are current for this client. - */ - for (i = 0; i < cl->numCurrentContexts; i++) { - cx = cl->currentContexts[i]; - if (cx) { - cx->isCurrent = GL_FALSE; - if (!cx->idExists) { - __glXFreeContext(cx); - } - } - } - /* - ** Re-initialize the client state structure. Don't free it because - ** we'll probably get another client with this index and use the struct - ** again. There is a maximum of MAXCLIENTS of these structures. - */ - ResetClientState(clientIndex); - } - - return True; -} - -/* -** Free a GLX Pixmap. -*/ -void -__glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap) -{ - if (!pGlxPixmap->idExists && !pGlxPixmap->refcnt) { - - PixmapPtr pPixmap = (PixmapPtr) pGlxPixmap->pDraw; - - /* - ** The DestroyPixmap routine should decrement the refcount and free - ** only if it's zero. - */ - (*pGlxPixmap->pScreen->DestroyPixmap) (pPixmap); - free(pGlxPixmap->be_xids); - free(pGlxPixmap); - } - -} - -static int -PixmapGone(__GLXpixmap * pGlxPixmap, XID id) -{ - - pGlxPixmap->idExists = False; - __glXFreeGLXPixmap(pGlxPixmap); - - return True; -} - -void -__glXFreeGLXWindow(__glXWindow * pGlxWindow) -{ - if (!pGlxWindow->idExists && !pGlxWindow->refcnt) { - WindowPtr pWindow = (WindowPtr) pGlxWindow->pDraw; - WindowPtr ret; - - dixLookupResourceByType((void *) &ret, - pWindow->drawable.id, RT_WINDOW, - NullClient, DixUnknownAccess); - if (ret == pWindow) { - (*pGlxWindow->pScreen->DestroyWindow) (pWindow); - } - - free(pGlxWindow); - } -} - -static void -WindowGone(__glXWindow * pGlxWindow, XID id) -{ - pGlxWindow->idExists = False; - __glXFreeGLXWindow(pGlxWindow); -} - -void -__glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer) -{ - if (!pGlxPbuffer->idExists && !pGlxPbuffer->refcnt) { - free(pGlxPbuffer->be_xids); - free(pGlxPbuffer); - } -} - -static void -PbufferGone(__glXPbuffer * pGlxPbuffer, XID id) -{ - pGlxPbuffer->idExists = False; - __glXFreeGLXPbuffer(pGlxPbuffer); -} - -/* -** Free a context. -*/ -GLboolean -__glXFreeContext(__GLXcontext * cx) -{ - if (cx->idExists || cx->isCurrent) - return GL_FALSE; - - free(cx->feedbackBuf); - free(cx->selectBuf); - free(cx->real_ids); - free(cx->real_vids); - - if (cx->pGlxPixmap) { - /* - ** The previous drawable was a glx pixmap, release it. - */ - cx->pGlxPixmap->refcnt--; - __glXFreeGLXPixmap(cx->pGlxPixmap); - cx->pGlxPixmap = 0; - } - - if (cx->pGlxReadPixmap) { - /* - ** The previous drawable was a glx pixmap, release it. - */ - cx->pGlxReadPixmap->refcnt--; - __glXFreeGLXPixmap(cx->pGlxReadPixmap); - cx->pGlxReadPixmap = 0; - } - - if (cx->pGlxWindow) { - /* - ** The previous drawable was a glx window, release it. - */ - cx->pGlxWindow->refcnt--; - __glXFreeGLXWindow(cx->pGlxWindow); - cx->pGlxWindow = 0; - } - - if (cx->pGlxReadWindow) { - /* - ** The previous drawable was a glx window, release it. - */ - cx->pGlxReadWindow->refcnt--; - __glXFreeGLXWindow(cx->pGlxReadWindow); - cx->pGlxReadWindow = 0; - } - - free(cx); - - if (cx == __glXLastContext) { - __glXFlushContextCache(); - } - - return GL_TRUE; -} - -/* -** Initialize the GLX extension. -*/ -void -GlxExtensionInit(void) -{ - ExtensionEntry *extEntry; - int i; - int glxSupported = 1; - - /* - // do not initialize GLX extension if GLX is not supported - // by ALL back-end servers. - */ - for (i = 0; i < screenInfo.numScreens; i++) { - glxSupported &= (dmxScreens[i].glxMajorOpcode > 0); - } - - if (!glxSupported || !dmxGLXProxy) { - return; - } - - __glXContextRes = CreateNewResourceType((DeleteType) ContextGone, - "GLXContext"); - __glXClientRes = CreateNewResourceType((DeleteType) ClientGone, - "GLXClient"); - __glXPixmapRes = CreateNewResourceType((DeleteType) PixmapGone, - "GLXPixmap"); - __glXWindowRes = CreateNewResourceType((DeleteType) WindowGone, - "GLXWindow"); - __glXPbufferRes = CreateNewResourceType((DeleteType) PbufferGone, - "GLXPbuffer"); - - if (!__glXContextRes || !__glXClientRes || !__glXPixmapRes || - !__glXWindowRes || !__glXPbufferRes) - return; - - /* - ** Add extension to server extensions. - */ - extEntry = AddExtension(GLX_EXTENSION_NAME, __GLX_NUMBER_EVENTS, - __GLX_NUMBER_ERRORS, __glXDispatch, - __glXSwapDispatch, ResetExtension, - StandardMinorOpcode); - if (!extEntry) { - FatalError("__glXExtensionInit: AddExtensions failed\n"); - return; - } - - __glXerrorBase = extEntry->errorBase; - __glXBadContext = extEntry->errorBase + GLXBadContext; - __glXBadContextState = extEntry->errorBase + GLXBadContextState; - __glXBadDrawable = extEntry->errorBase + GLXBadDrawable; - __glXBadPixmap = extEntry->errorBase + GLXBadPixmap; - __glXBadContextTag = extEntry->errorBase + GLXBadContextTag; - __glXBadCurrentWindow = extEntry->errorBase + GLXBadCurrentWindow; - __glXBadRenderRequest = extEntry->errorBase + GLXBadRenderRequest; - __glXBadLargeRequest = extEntry->errorBase + GLXBadLargeRequest; - __glXUnsupportedPrivateRequest = extEntry->errorBase + - GLXUnsupportedPrivateRequest; - __glXBadFBConfig = extEntry->errorBase + GLXBadFBConfig; - __glXBadPbuffer = extEntry->errorBase + GLXBadPbuffer; - - /* - ** Initialize table of client state. There is never a client 0. - */ - for (i = 1; i <= LimitClients; i++) { - __glXClients[i] = 0; - } - - /* - ** Initialize screen specific data. - */ - __glXScreenInit(screenInfo.numScreens); - - /* - ** Initialize swap barrier support. - */ - SwapBarrierInit(); -} - -/************************************************************************/ - -Bool -__glXCoreType(void) -{ - return 0; -} - -/************************************************************************/ - -void -__glXFlushContextCache(void) -{ - __glXLastContext = 0; -} - -/************************************************************************/ - -/* -** Top level dispatcher; all commands are executed from here down. -*/ -static int -__glXDispatch(ClientPtr client) -{ - REQUEST(xGLXSingleReq); - CARD8 opcode; - int (*proc) (__GLXclientState * cl, GLbyte * pc); - __GLXclientState *cl; - - opcode = stuff->glxCode; - cl = __glXClients[client->index]; - if (!cl) { - cl = calloc(1, sizeof(__GLXclientState)); - __glXClients[client->index] = cl; - if (!cl) { - return BadAlloc; - } - - cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *)); - if (!cl->be_displays) { - free(cl); - return BadAlloc; - } - } - - if (!cl->inUse) { - /* - ** This is first request from this client. Associate a resource - ** with the client so we will be notified when the client dies. - */ - XID xid = FakeClientID(client->index); - - if (!AddResource(xid, __glXClientRes, (void *) (long) client->index)) { - return BadAlloc; - } - ResetClientState(client->index); - cl->largeCmdRequestsTotal = 0; - cl->inUse = GL_TRUE; - cl->client = client; - } - - /* - ** Check for valid opcode. - */ - if (opcode >= __GLX_SINGLE_TABLE_SIZE) { - return BadRequest; - } - - /* - ** Use the opcode to index into the procedure table. - */ - proc = __glXSingleTable[opcode]; - return (*proc) (cl, (GLbyte *) stuff); -} - -static int -__glXSwapDispatch(ClientPtr client) -{ - REQUEST(xGLXSingleReq); - CARD8 opcode; - int (*proc) (__GLXclientState * cl, GLbyte * pc); - __GLXclientState *cl; - - opcode = stuff->glxCode; - cl = __glXClients[client->index]; - if (!cl) { - cl = calloc(1, sizeof(__GLXclientState)); - __glXClients[client->index] = cl; - if (!cl) { - return BadAlloc; - } - - cl->be_displays = calloc(screenInfo.numScreens, sizeof(Display *)); - if (!cl->be_displays) { - free(cl); - return BadAlloc; - } - } - - if (!cl->inUse) { - /* - ** This is first request from this client. Associate a resource - ** with the client so we will be notified when the client dies. - */ - XID xid = FakeClientID(client->index); - - if (!AddResource(xid, __glXClientRes, (void *) (long) client->index)) { - return BadAlloc; - } - ResetClientState(client->index); - cl->inUse = GL_TRUE; - cl->client = client; - } - - /* - ** Check for valid opcode. - */ - if (opcode >= __GLX_SINGLE_TABLE_SIZE) { - return BadRequest; - } - - /* - ** Use the opcode to index into the procedure table. - */ - proc = __glXSwapSingleTable[opcode]; - return (*proc) (cl, (GLbyte *) stuff); -} - -int -__glXNoSuchSingleOpcode(__GLXclientState * cl, GLbyte * pc) -{ - return BadRequest; -} - -void -__glXNoSuchRenderOpcode(GLbyte * pc) -{ - return; -} diff --git a/hw/dmx/glxProxy/glxext.h b/hw/dmx/glxProxy/glxext.h deleted file mode 100644 index b96ebc1f4..000000000 --- a/hw/dmx/glxProxy/glxext.h +++ /dev/null @@ -1,70 +0,0 @@ -#ifndef _glxext_h_ -#define _glxext_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -/* - * Added by VA Linux for XFree86 4.0.x - */ -typedef struct { - int type; - void (*resetExtension) (void); - Bool (*initVisuals) (VisualPtr * visualp, - DepthPtr * depthp, - int *nvisualp, - int *ndepthp, - int *rootDepthp, - VisualID * defaultVisp, - unsigned long sizes, int bitsPerRGB); - void (*setVisualConfigs) (int nconfigs, - __GLXvisualConfig * configs, void **privates); -} __GLXextensionInfo; - -extern GLboolean __glXFreeContext(__GLXcontext * glxc); -extern void __glXFlushContextCache(void); - -extern void __glXFreeGLXWindow(__glXWindow * pGlxWindow); -extern void __glXFreeGLXPixmap(__GLXpixmap * pGlxPixmap); -extern void __glXFreeGLXPbuffer(__glXPbuffer * pGlxPbuffer); - -extern void __glXNoSuchRenderOpcode(GLbyte *); -extern int __glXNoSuchSingleOpcode(__GLXclientState *, GLbyte *); -extern void __glXErrorCallBack(GLenum code); -extern void __glXClearErrorOccured(void); -extern GLboolean __glXErrorOccured(void); -extern void __glXResetLargeCommandStatus(__GLXclientState *); - -extern int __glXQueryContextInfoEXT(__GLXclientState * cl, GLbyte * pc); -extern int __glXSwapQueryContextInfoEXT(__GLXclientState * cl, char *pc); - -extern Bool __glXCoreType(void); - -#endif /* _glxext_h_ */ diff --git a/hw/dmx/glxProxy/glxfbconfig.c b/hw/dmx/glxProxy/glxfbconfig.c deleted file mode 100644 index 2f46bd07a..000000000 --- a/hw/dmx/glxProxy/glxfbconfig.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxfbconfig.h" - -int -AreFBConfigsMatch(__GLXFBConfig * c1, __GLXFBConfig * c2) -{ - int match; - - match = ((c1->visualType == c2->visualType) && - (c1->transparentType == c2->transparentType) && - (c1->transparentRed == c2->transparentRed) && - (c1->transparentGreen == c2->transparentGreen) && - (c1->transparentBlue == c2->transparentBlue) && - (c1->transparentAlpha == c2->transparentAlpha) && - (c1->transparentIndex == c2->transparentIndex) && - (c1->visualCaveat == c2->visualCaveat) && - (c1->drawableType == c2->drawableType) && - (c1->renderType == c2->renderType) && -#if 0 - (c1->maxPbufferWidth == c2->maxPbufferWidth) && - (c1->maxPbufferHeight == c2->maxPbufferHeight) && - (c1->maxPbufferPixels == c2->maxPbufferPixels) && - (c1->optimalPbufferWidth == c2->optimalPbufferWidth) && - (c1->optimalPbufferHeight == c2->optimalPbufferHeight) && -#endif - (c1->visualSelectGroup == c2->visualSelectGroup) && - (c1->rgbMode == c2->rgbMode) && - (c1->colorIndexMode == c2->colorIndexMode) && - (c1->doubleBufferMode == c2->doubleBufferMode) && - (c1->stereoMode == c2->stereoMode) && - (c1->haveAccumBuffer == c2->haveAccumBuffer) && - (c1->haveDepthBuffer == c2->haveDepthBuffer) && - (c1->haveStencilBuffer == c2->haveStencilBuffer) && - (c1->accumRedBits == c2->accumRedBits) && - (c1->accumGreenBits == c2->accumGreenBits) && - (c1->accumBlueBits == c2->accumBlueBits) && - (c1->accumAlphaBits == c2->accumAlphaBits) && - (c1->depthBits == c2->depthBits) && - (c1->stencilBits == c2->stencilBits) && - (c1->indexBits == c2->indexBits) && - (c1->redBits == c2->redBits) && - (c1->greenBits == c2->greenBits) && - (c1->blueBits == c2->blueBits) && - (c1->alphaBits == c2->alphaBits) && - (c1->redMask == c2->redMask) && - (c1->greenMask == c2->greenMask) && - (c1->blueMask == c2->blueMask) && - (c1->alphaMask == c2->alphaMask) && - (c1->multiSampleSize == c2->multiSampleSize) && - (c1->nMultiSampleBuffers == c2->nMultiSampleBuffers) && - (c1->maxAuxBuffers == c2->maxAuxBuffers) && - (c1->level == c2->level) && - (c1->extendedRange == c2->extendedRange) && - (c1->minRed == c2->minRed) && - (c1->maxRed == c2->maxRed) && - (c1->minGreen == c2->minGreen) && - (c1->maxGreen == c2->maxGreen) && - (c1->minBlue == c2->minBlue) && - (c1->maxBlue == c2->maxBlue) && - (c1->minAlpha == c2->minAlpha) && (c1->maxAlpha == c2->maxAlpha) - ); - - return match; -} - -__GLXFBConfig * -FindMatchingFBConfig(__GLXFBConfig * c, __GLXFBConfig * configs, int nconfigs) -{ - int i; - - for (i = 0; i < nconfigs; i++) { - if (AreFBConfigsMatch(c, configs + i)) - return configs + i; - } - - return 0; -} diff --git a/hw/dmx/glxProxy/glxfbconfig.h b/hw/dmx/glxProxy/glxfbconfig.h deleted file mode 100644 index 6626410d9..000000000 --- a/hw/dmx/glxProxy/glxfbconfig.h +++ /dev/null @@ -1,39 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifndef _GLXFBCONFIG_H - -#include <GL/glxint.h> - -int AreFBConfigsMatch(__GLXFBConfig * c1, __GLXFBConfig * c2); -__GLXFBConfig *FindMatchingFBConfig(__GLXFBConfig * c, __GLXFBConfig * configs, - int nconfigs); - -#endif diff --git a/hw/dmx/glxProxy/glxscreens.c b/hw/dmx/glxProxy/glxscreens.c deleted file mode 100644 index 508e67ed4..000000000 --- a/hw/dmx/glxProxy/glxscreens.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxlog.h" - -#include "glxserver.h" - -#include <windowstr.h> - -#include "glxfbconfig.h" - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -__GLXscreenInfo *__glXActiveScreens; -GLint __glXNumActiveScreens; - -__GLXFBConfig **__glXFBConfigs; -int __glXNumFBConfigs; - -static char GLXServerVendorName[] = "SGI DMX/glxProxy"; -static char GLXServerVersion[64]; -static char GLXServerExtensions[] = - "GLX_EXT_visual_info " - "GLX_EXT_visual_rating " - "GLX_EXT_import_context " - "GLX_SGIX_fbconfig " "GLX_SGI_make_current_read " "GLX_SGI_swap_control "; - -static char ExtensionsString[1024]; - -static void -CalcServerVersionAndExtensions(void) -{ - int s; - char **be_extensions; - char *ext; - char *denied_extensions; - - /* - * set the server glx version to be the minimum version - * supported by all back-end servers - */ - __glXVersionMajor = 0; - __glXVersionMinor = 0; - for (s = 0; s < __glXNumActiveScreens; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = dmxScreen->beDisplay; - xGLXQueryVersionReq *req; - xGLXQueryVersionReply reply; - - /* Send the glXQueryVersion request */ - LockDisplay(dpy); - GetReq(GLXQueryVersion, req); - req->reqType = dmxScreen->glxMajorOpcode; - req->glxCode = X_GLXQueryVersion; - req->majorVersion = GLX_SERVER_MAJOR_VERSION; - req->minorVersion = GLX_SERVER_MINOR_VERSION; - _XReply(dpy, (xReply *) &reply, 0, False); - UnlockDisplay(dpy); - SyncHandle(); - - if (s == 0) { - __glXVersionMajor = reply.majorVersion; - __glXVersionMinor = reply.minorVersion; - } - else { - if (reply.majorVersion < __glXVersionMajor) { - __glXVersionMajor = reply.majorVersion; - __glXVersionMinor = reply.minorVersion; - } - else if ((reply.majorVersion == __glXVersionMajor) && - (reply.minorVersion < __glXVersionMinor)) { - __glXVersionMinor = reply.minorVersion; - } - } - - } - - if (GLX_SERVER_MAJOR_VERSION < __glXVersionMajor) { - __glXVersionMajor = GLX_SERVER_MAJOR_VERSION; - __glXVersionMinor = GLX_SERVER_MINOR_VERSION; - } - else if ((GLX_SERVER_MAJOR_VERSION == __glXVersionMajor) && - (GLX_SERVER_MINOR_VERSION < __glXVersionMinor)) { - __glXVersionMinor = GLX_SERVER_MINOR_VERSION; - } - - snprintf(GLXServerVersion, sizeof(GLXServerVersion), - "%d.%d DMX %d back-end server(s)", - __glXVersionMajor, __glXVersionMinor, __glXNumActiveScreens); - /* - * set the ExtensionsString to the minimum extensions string - */ - ExtensionsString[0] = '\0'; - - /* - * read extensions strings of all back-end servers - */ - be_extensions = xallocarray(__glXNumActiveScreens, sizeof(char *)); - if (!be_extensions) - return; - - for (s = 0; s < __glXNumActiveScreens; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = dmxScreen->beDisplay; - xGLXQueryServerStringReq *req; - xGLXQueryServerStringReply reply; - int length, numbytes; - - /* Send the glXQueryServerString request */ - LockDisplay(dpy); - GetReq(GLXQueryServerString, req); - req->reqType = dmxScreen->glxMajorOpcode; - req->glxCode = X_GLXQueryServerString; - req->screen = DefaultScreen(dpy); - req->name = GLX_EXTENSIONS; - _XReply(dpy, (xReply *) &reply, 0, False); - - length = (int) reply.length; - numbytes = (int) reply.n; - be_extensions[s] = (char *) malloc(numbytes); - if (!be_extensions[s]) { - /* Throw data on the floor */ - _XEatDataWords(dpy, length); - } - else { - _XReadPad(dpy, (char *) be_extensions[s], numbytes); - } - UnlockDisplay(dpy); - SyncHandle(); - } - - /* - * extensions string will include only extensions that our - * server supports as well as all back-end servers supports. - * extensions that are in the DMX_DENY_EXTENSIONS string will - * not be supported. - */ - denied_extensions = getenv("DMX_DENY_GLX_EXTENSIONS"); - ext = strtok(GLXServerExtensions, " "); - while (ext) { - int supported = 1; - - if (denied_extensions && strstr(denied_extensions, ext)) { - supported = 0; - } - else { - for (s = 0; s < __glXNumActiveScreens && supported; s++) { - if (!strstr(be_extensions[s], ext)) { - supported = 0; - } - } - } - - if (supported) { - strcat(ExtensionsString, ext); - strcat(ExtensionsString, " "); - } - - ext = strtok(NULL, " "); - } - - /* - * release temporary storage - */ - for (s = 0; s < __glXNumActiveScreens; s++) { - free(be_extensions[s]); - } - free(be_extensions); - - if (dmxGLXSwapGroupSupport) { - if (!denied_extensions || - !strstr(denied_extensions, "GLX_SGIX_swap_group")) { - strcat(ExtensionsString, "GLX_SGIX_swap_group"); - if (!denied_extensions || - !strstr(denied_extensions, "GLX_SGIX_swap_barrier")) { - strcat(ExtensionsString, " GLX_SGIX_swap_barrier"); - } - } - } - -} - -void -__glXScreenInit(GLint numscreens) -{ - int s; - int c; - DMXScreenInfo *dmxScreen0 = &dmxScreens[0]; - - __glXNumActiveScreens = numscreens; - - CalcServerVersionAndExtensions(); - - __glXFBConfigs = NULL; - __glXNumFBConfigs = 0; - - if ((__glXVersionMajor == 1 && __glXVersionMinor >= 3) || - (__glXVersionMajor > 1) || - (strstr(ExtensionsString, "GLX_SGIX_fbconfig"))) { - - /* - // Initialize FBConfig info. - // find the set of FBConfigs that are present on all back-end - // servers - only those configs will be supported - */ - __glXFBConfigs = - xallocarray(dmxScreen0->numFBConfigs * (numscreens + 1), - sizeof(__GLXFBConfig *)); - __glXNumFBConfigs = 0; - - for (c = 0; c < dmxScreen0->numFBConfigs; c++) { - __GLXFBConfig *cfg = NULL; - - if (numscreens > 1) { - for (s = 1; s < numscreens; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - - cfg = FindMatchingFBConfig(&dmxScreen0->fbconfigs[c], - dmxScreen->fbconfigs, - dmxScreen->numFBConfigs); - __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + s + - 1] = cfg; - if (!cfg) { - dmxLog(dmxInfo, - "screen0 FBConfig 0x%x is missing on screen#%d\n", - dmxScreen0->fbconfigs[c].id, s); - break; - } - else { - dmxLog(dmxInfo, - "screen0 FBConfig 0x%x matched to 0x%x on screen#%d\n", - dmxScreen0->fbconfigs[c].id, cfg->id, s); - } - } - } - else { - cfg = &dmxScreen0->fbconfigs[c]; - } - - if (cfg) { - - /* filter out overlay visuals */ - if (cfg->level == 0) { - __GLXFBConfig *proxy_cfg; - - __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + 1] = - &dmxScreen0->fbconfigs[c]; - - proxy_cfg = malloc(sizeof(__GLXFBConfig)); - memcpy(proxy_cfg, cfg, sizeof(__GLXFBConfig)); - proxy_cfg->id = FakeClientID(0); - /* visual will be associated later in __glXGetFBConfigs */ - proxy_cfg->associatedVisualId = (unsigned int) -1; - - __glXFBConfigs[__glXNumFBConfigs * (numscreens + 1) + 0] = - proxy_cfg; - - __glXNumFBConfigs++; - } - - } - - } - - } - -} - -void -__glXScreenReset(void) -{ - __glXNumActiveScreens = 0; -} - -char * -__glXGetServerString(unsigned int name) -{ - char *ret = NULL; - - switch (name) { - - case GLX_VENDOR: - ret = GLXServerVendorName; - break; - - case GLX_VERSION: - ret = GLXServerVersion; - break; - - case GLX_EXTENSIONS: - ret = ExtensionsString; - break; - - default: - break; - } - - return ret; - -} - -int -glxIsExtensionSupported(const char *ext) -{ - return (strstr(ExtensionsString, ext) != NULL); -} diff --git a/hw/dmx/glxProxy/glxscreens.h b/hw/dmx/glxProxy/glxscreens.h deleted file mode 100644 index 5f36b8158..000000000 --- a/hw/dmx/glxProxy/glxscreens.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef _GLX_screens_h_ -#define _GLX_screens_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -typedef struct { - - __GLXvisualConfig *pGlxVisual; - GLint numVisuals; - GLint numGLXVisuals; - GLint *isGLXvis; - - char *GLXvendor; - char *GLXextensions; - -} __GLXscreenInfo; - -extern void __glXScreenInit(GLint); -extern void __glXScreenReset(void); - -extern char *__glXGetServerString(unsigned int name); - -extern int glxIsExtensionSupported(const char *ext); - -#endif /* !__GLX_screens_h__ */ diff --git a/hw/dmx/glxProxy/glxserver.h b/hw/dmx/glxProxy/glxserver.h deleted file mode 100644 index 7aa5ad2f2..000000000 --- a/hw/dmx/glxProxy/glxserver.h +++ /dev/null @@ -1,292 +0,0 @@ -#ifndef _GLX_server_h_ -#define _GLX_server_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "dmx.h" - -#include <misc.h> -#include <dixstruct.h> -#include <pixmapstr.h> -#include <gcstruct.h> -#include <extnsionst.h> -#include <resource.h> -#include <scrnintstr.h> - -#define GL_GLEXT_PROTOTYPES /* we want prototypes */ -#include <GL/gl.h> -#include <GL/glxproto.h> -#include <GL/glxint.h> - -#include "glxscreens.h" -#include "glxdrawable.h" -#include "glxcontext.h" -#include "glxerror.h" - -#define GLX_SERVER_MAJOR_VERSION 1 -#define GLX_SERVER_MINOR_VERSION 3 - -#ifndef True -#define True 1 -#endif -#ifndef False -#define False 0 -#endif - -/* -** GLX resources. -typedef XID GLXContextID; -typedef XID GLXPixmap; -typedef XID GLXDrawable; -typedef XID GLXWindow; -typedef XID GLXPbuffer; - -typedef struct __GLXcontextRec *GLXContext; -*/ -typedef struct __GLXclientStateRec __GLXclientState; - -extern __GLXscreenInfo *__glXActiveScreens; -extern GLint __glXNumActiveScreens; - -/************************************************************************/ - -/* -** The last context used (from the server's persective) is cached. -*/ -extern __GLXcontext *__glXLastContext; -extern __GLXcontext *__glXForceCurrent(__GLXclientState *, GLXContextTag, - int *); - -/************************************************************************/ - -typedef struct { - int elem_size; /* element size in bytes */ - int nelems; /* number of elements to swap */ - void (*swapfunc) (GLbyte * pc); -} __GLXRenderSwapInfo; - -/* -** State kept per client. -*/ -struct __GLXclientStateRec { - /* - ** Whether this structure is currently being used to support a client. - */ - Bool inUse; - - /* - ** Buffer for returned data. - */ - GLbyte *returnBuf; - GLint returnBufSize; - - /* - ** Keep a list of all the contexts that are current for this client's - ** threads. - */ - __GLXcontext **currentContexts; - DrawablePtr *currentDrawables; - GLint numCurrentContexts; - - /* Back pointer to X client record */ - ClientPtr client; - - char *GLClientextensions; - - GLXContextTag *be_currentCTag; - Display **be_displays; - - /* - ** Keep track of large rendering commands, which span multiple requests. - */ - GLint largeCmdBytesSoFar; /* bytes received so far */ - GLint largeCmdBytesTotal; /* total bytes expected */ - GLint largeCmdRequestsSoFar; /* requests received so far */ - GLint largeCmdRequestsTotal; /* total requests expected */ - void (*largeCmdRequestsSwapProc) (GLbyte *); - __GLXRenderSwapInfo *largeCmdRequestsSwap_info; - GLbyte *largeCmdBuf; - GLint largeCmdBufSize; - GLint largeCmdMaxReqDataSize; - -}; - -extern __GLXclientState *__glXClients[]; - -/************************************************************************/ - -/* -** Dispatch tables. -*/ -typedef void (*__GLXdispatchRenderProcPtr) (GLbyte *); -typedef int (*__GLXdispatchSingleProcPtr) (__GLXclientState *, GLbyte *); -typedef int (*__GLXdispatchVendorPrivProcPtr) (__GLXclientState *, GLbyte *); -extern __GLXdispatchVendorPrivProcPtr __glXVendorPrivTable_EXT[]; -extern __GLXdispatchVendorPrivProcPtr __glXSwapVendorPrivTable_EXT[]; -extern __GLXdispatchRenderProcPtr __glXSwapRenderTable[]; - -extern __GLXRenderSwapInfo __glXSwapRenderTable_EXT[]; - -/* - * Dispatch for GLX commands. - */ -typedef int (*__GLXprocPtr) (__GLXclientState *, char *pc); -extern __GLXprocPtr __glXProcTable[]; - -/* - * Tables for computing the size of each rendering command. - */ -typedef struct { - int bytes; - int (*varsize) (GLbyte * pc, Bool swap); -} __GLXrenderSizeData; -extern __GLXrenderSizeData __glXRenderSizeTable[]; -extern __GLXrenderSizeData __glXRenderSizeTable_EXT[]; - -/************************************************************************/ - -/* -** X resources. -*/ -extern RESTYPE __glXContextRes; -extern RESTYPE __glXClientRes; -extern RESTYPE __glXPixmapRes; -extern RESTYPE __glXDrawableRes; -extern RESTYPE __glXWindowRes; -extern RESTYPE __glXPbufferRes; - -/************************************************************************/ - -/* -** Prototypes. -*/ - -extern char *__glXcombine_strings(const char *, const char *); - -/* -** Routines for sending swapped replies. -*/ - -extern void __glXSwapMakeCurrentReply(ClientPtr client, - xGLXMakeCurrentReadSGIReply * reply); - -extern void __glXSwapIsDirectReply(ClientPtr client, xGLXIsDirectReply * reply); -extern void __glXSwapQueryVersionReply(ClientPtr client, - xGLXQueryVersionReply * reply); -extern void __glXSwapQueryContextInfoEXTReply(ClientPtr client, - xGLXQueryContextInfoEXTReply * - reply, int *buf); -extern void glxSwapQueryExtensionsStringReply(ClientPtr client, - xGLXQueryExtensionsStringReply * - reply, char *buf); -extern void glxSwapQueryServerStringReply(ClientPtr client, - xGLXQueryServerStringReply * reply, - char *buf); -extern void __glXSwapQueryContextReply(ClientPtr client, - xGLXQueryContextReply * reply, int *buf); -extern void __glXSwapGetDrawableAttributesReply(ClientPtr client, - xGLXGetDrawableAttributesReply * - reply, int *buf); -extern void __glXSwapQueryMaxSwapBarriersSGIXReply(ClientPtr client, - xGLXQueryMaxSwapBarriersSGIXReply - * reply); - -/* - * Routines for computing the size of variably-sized rendering commands. - */ - -extern int __glXTypeSize(GLenum enm); -extern int __glXImageSize(GLenum format, GLenum type, GLsizei w, GLsizei h, - GLint rowLength, GLint skipRows, GLint alignment); -extern int __glXImage3DSize(GLenum format, GLenum type, - GLsizei w, GLsizei h, GLsizei d, - GLint imageHeight, GLint rowLength, - GLint skipImages, GLint skipRows, GLint alignment); - -extern int __glXCallListsReqSize(GLbyte * pc, Bool swap); -extern int __glXBitmapReqSize(GLbyte * pc, Bool swap); -extern int __glXFogfvReqSize(GLbyte * pc, Bool swap); -extern int __glXFogivReqSize(GLbyte * pc, Bool swap); -extern int __glXLightfvReqSize(GLbyte * pc, Bool swap); -extern int __glXLightivReqSize(GLbyte * pc, Bool swap); -extern int __glXLightModelfvReqSize(GLbyte * pc, Bool swap); -extern int __glXLightModelivReqSize(GLbyte * pc, Bool swap); -extern int __glXMaterialfvReqSize(GLbyte * pc, Bool swap); -extern int __glXMaterialivReqSize(GLbyte * pc, Bool swap); -extern int __glXTexParameterfvReqSize(GLbyte * pc, Bool swap); -extern int __glXTexParameterivReqSize(GLbyte * pc, Bool swap); -extern int __glXTexImage1DReqSize(GLbyte * pc, Bool swap); -extern int __glXTexImage2DReqSize(GLbyte * pc, Bool swap); -extern int __glXTexEnvfvReqSize(GLbyte * pc, Bool swap); -extern int __glXTexEnvivReqSize(GLbyte * pc, Bool swap); -extern int __glXTexGendvReqSize(GLbyte * pc, Bool swap); -extern int __glXTexGenfvReqSize(GLbyte * pc, Bool swap); -extern int __glXTexGenivReqSize(GLbyte * pc, Bool swap); -extern int __glXMap1dReqSize(GLbyte * pc, Bool swap); -extern int __glXMap1fReqSize(GLbyte * pc, Bool swap); -extern int __glXMap2dReqSize(GLbyte * pc, Bool swap); -extern int __glXMap2fReqSize(GLbyte * pc, Bool swap); -extern int __glXPixelMapfvReqSize(GLbyte * pc, Bool swap); -extern int __glXPixelMapuivReqSize(GLbyte * pc, Bool swap); -extern int __glXPixelMapusvReqSize(GLbyte * pc, Bool swap); -extern int __glXDrawPixelsReqSize(GLbyte * pc, Bool swap); -extern int __glXDrawArraysSize(GLbyte * pc, Bool swap); -extern int __glXPrioritizeTexturesReqSize(GLbyte * pc, Bool swap); -extern int __glXTexSubImage1DReqSize(GLbyte * pc, Bool swap); -extern int __glXTexSubImage2DReqSize(GLbyte * pc, Bool swap); -extern int __glXTexImage3DReqSize(GLbyte * pc, Bool swap); -extern int __glXTexSubImage3DReqSize(GLbyte * pc, Bool swap); -extern int __glXConvolutionFilter1DReqSize(GLbyte * pc, Bool swap); -extern int __glXConvolutionFilter2DReqSize(GLbyte * pc, Bool swap); -extern int __glXConvolutionParameterivReqSize(GLbyte * pc, Bool swap); -extern int __glXConvolutionParameterfvReqSize(GLbyte * pc, Bool swap); -extern int __glXSeparableFilter2DReqSize(GLbyte * pc, Bool swap); -extern int __glXColorTableReqSize(GLbyte * pc, Bool swap); -extern int __glXColorSubTableReqSize(GLbyte * pc, Bool swap); -extern int __glXColorTableParameterfvReqSize(GLbyte * pc, Bool swap); -extern int __glXColorTableParameterivReqSize(GLbyte * pc, Bool swap); - -/* - * Routines for computing the size of returned data. - */ -extern int __glXConvolutionParameterivSize(GLenum pname); -extern int __glXConvolutionParameterfvSize(GLenum pname); -extern int __glXColorTableParameterfvSize(GLenum pname); -extern int __glXColorTableParameterivSize(GLenum pname); - -extern int __glXVersionMajor; -extern int __glXVersionMinor; - -#define __GLX_IS_VERSION_SUPPORTED(major,minor) \ - ( (__glXVersionMajor > (major)) || \ - ((__glXVersionMajor == (major)) && (__glXVersionMinor >= (minor))) ) - -#endif /* !__GLX_server_h__ */ diff --git a/hw/dmx/glxProxy/glxsingle.c b/hw/dmx/glxProxy/glxsingle.c deleted file mode 100644 index 319da50b0..000000000 --- a/hw/dmx/glxProxy/glxsingle.c +++ /dev/null @@ -1,1067 +0,0 @@ -/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" -#include "dmxfont.h" -#include "dmxcb.h" - -#include "glxserver.h" -#include "glxext.h" -#include "g_disptab.h" -/* #include "g_disptab_EXT.h" */ -#include "unpack.h" -#include "glxutil.h" -#include "glxcmds.h" -#include "glxsingle.h" - -#include "GL/glxproto.h" - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -/* - * GetReqSingle - this is the equivalent of GetReq macro - * from Xlibint.h but it does not set the reqType field (the opcode). - * this is because the GL single opcodes has different naming convention - * the other X opcodes (ie. X_GLsop_GetFloatv). - */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define GetReqSingle(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->length = (SIZEOF(x##name##Req))>>2;\ - dpy->bufptr += SIZEOF(x##name##Req);\ - dpy->request++ - -#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ -#define GetReqSingle(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->length = (SIZEOF(x/**/name/**/Req))>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req);\ - dpy->request++ -#endif - -#define X_GLXSingle 0 /* needed by GetReqExtra */ - -static int swap_vec_element_size = 0; - -static void -SendSwappedReply(ClientPtr client, - xGLXSingleReply * reply, char *buf, int buf_size) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->retval); - __GLX_SWAP_INT(&reply->size); - - if ((buf_size == 0) && (swap_vec_element_size > 0)) { - /* - * the reply has single component - need to swap pad3 - */ - if (swap_vec_element_size == 2) { - __GLX_SWAP_SHORT(&reply->pad3); - } - else if (swap_vec_element_size == 4) { - __GLX_SWAP_INT(&reply->pad3); - __GLX_SWAP_INT(&reply->pad4); /* some requests use also pad4 - * i.e GetConvolutionFilter - */ - } - else if (swap_vec_element_size == 8) { - __GLX_SWAP_DOUBLE(&reply->pad3); - } - } - else if ((buf_size > 0) && (swap_vec_element_size > 0)) { - /* - * the reply has vector of elements which needs to be swapped - */ - int vsize = buf_size / swap_vec_element_size; - char *p = buf; - int i; - - for (i = 0; i < vsize; i++) { - if (swap_vec_element_size == 2) { - __GLX_SWAP_SHORT(p); - } - else if (swap_vec_element_size == 4) { - __GLX_SWAP_INT(p); - } - else if (swap_vec_element_size == 8) { - __GLX_SWAP_DOUBLE(p); - } - - p += swap_vec_element_size; - } - - /* - * swap pad words as well - for case that some single reply uses - * them as well - */ - __GLX_SWAP_INT(&reply->pad3); - __GLX_SWAP_INT(&reply->pad4); - __GLX_SWAP_INT(&reply->pad5); - __GLX_SWAP_INT(&reply->pad6); - - } - - WriteToClient(client, sizeof(xGLXSingleReply), reply); - if (buf_size > 0) - WriteToClient(client, buf_size, buf); - -} - -int -__glXForwardSingleReq(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - xGLXSingleReq *be_req; - __GLXcontext *glxc; - int from_screen = 0; - int to_screen = 0; - int buf_size; - int s; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXSingleReq; - buf_size = (req->length << 2) - sz_xGLXSingleReq; - - /* - * just forward the request to back-end server(s) - */ - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReqSingle(GLXSingle, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = req->glxCode; - be_req->length = req->length; - be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); - if (buf_size > 0) - _XSend(dpy, (const char *) pc, buf_size); - UnlockDisplay(dpy); - SyncHandle(); - - if (req->glxCode == X_GLsop_Flush) { - XFlush(dpy); - } - - } - - return Success; -} - -int -__glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXSingleReq *req = (xGLXSingleReq *) pc; - xGLXSingleReq *be_req; - xGLXSingleReply reply; - xGLXSingleReply be_reply; - __GLXcontext *glxc; - int buf_size; - char *be_buf = NULL; - int be_buf_size; - DMXScreenInfo *dmxScreen; - Display *dpy; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return __glXBadContext; - } - - pc += sz_xGLXSingleReq; - buf_size = (req->length << 2) - sz_xGLXSingleReq; - - dmxScreen = &dmxScreens[glxc->pScreen->myNum]; - dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum); - - /* - * send the request to the first back-end server - */ - LockDisplay(dpy); - GetReqSingle(GLXSingle, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = req->glxCode; - be_req->length = req->length; - be_req->contextTag = - GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum); - if (buf_size > 0) - _XSend(dpy, (const char *) pc, buf_size); - - /* - * get the reply from the back-end server - */ - _XReply(dpy, (xReply *) &be_reply, 0, False); - be_buf_size = be_reply.length << 2; - if (be_buf_size > 0) { - be_buf = (char *) malloc(be_buf_size); - if (be_buf) { - _XRead(dpy, be_buf, be_buf_size); - } - else { - /* Throw data on the floor */ - _XEatDataWords(dpy, be_reply.length); - return BadAlloc; - } - } - - UnlockDisplay(dpy); - SyncHandle(); - - /* - * send the reply to the client - */ - reply = (xGLXSingleReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = be_reply.length, - .retval = be_reply.retval, - .size = be_reply.size, - .pad3 = be_reply.pad3, - .pad4 = be_reply.pad4 - }; - - if (client->swapped) { - SendSwappedReply(client, &reply, be_buf, be_buf_size); - } - else { - WriteToClient(client, sizeof(xGLXSingleReply), &reply); - if (be_buf_size > 0) - WriteToClient(client, be_buf_size, be_buf); - } - - if (be_buf_size > 0) - free(be_buf); - - return Success; -} - -int -__glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXSingleReq *req = (xGLXSingleReq *) pc; - xGLXSingleReq *be_req; - xGLXSingleReply reply; - xGLXSingleReply be_reply; - __GLXcontext *glxc; - int buf_size; - char *be_buf = NULL; - int be_buf_size = 0; - int from_screen = 0; - int to_screen = 0; - int s; - - DMXScreenInfo *dmxScreen; - Display *dpy; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXSingleReq; - buf_size = (req->length << 2) - sz_xGLXSingleReq; - - /* - * send the request to the first back-end server(s) - */ - for (s = to_screen; s >= from_screen; s--) { - dmxScreen = &dmxScreens[s]; - dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReqSingle(GLXSingle, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = req->glxCode; - be_req->length = req->length; - be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); - if (buf_size > 0) - _XSend(dpy, (const char *) pc, buf_size); - - /* - * get the reply from the back-end server - */ - _XReply(dpy, (xReply *) &be_reply, 0, False); - if (s == from_screen) { - /* Save data from last reply to send on to client */ - be_buf_size = be_reply.length << 2; - if (be_buf_size > 0) { - be_buf = malloc(be_buf_size); - if (be_buf) { - _XRead(dpy, be_buf, be_buf_size); - } - else { - /* Throw data on the floor */ - _XEatDataWords(dpy, be_reply.length); - return BadAlloc; - } - } - } - else { - /* Just discard data from all replies before the last one */ - if (be_reply.length > 0) - _XEatDataWords(dpy, be_reply.length); - } - - UnlockDisplay(dpy); - SyncHandle(); - } - - /* - * send the reply to the client - */ - reply = (xGLXSingleReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = be_reply.length, - .retval = be_reply.retval, - .size = be_reply.size, - .pad3 = be_reply.pad3, - .pad4 = be_reply.pad4 - }; - - if (client->swapped) { - SendSwappedReply(client, &reply, be_buf, be_buf_size); - } - else { - WriteToClient(client, sizeof(xGLXSingleReply), &reply); - if (be_buf_size > 0) - WriteToClient(client, be_buf_size, be_buf); - } - - if (be_buf_size > 0) - free(be_buf); - - return Success; -} - -int -__glXForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 0; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardSingleReq(cl, pc)); -} - -int -__glXForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 0; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardPipe0WithReply(cl, pc)); -} - -int -__glXForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 2; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardPipe0WithReply(cl, pc)); -} - -int -__glXForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 4; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardPipe0WithReply(cl, pc)); -} - -int -__glXForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 8; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardPipe0WithReply(cl, pc)); -} - -int -__glXForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 0; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardAllWithReply(cl, pc)); -} - -int -__glXForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 2; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardAllWithReply(cl, pc)); -} - -int -__glXForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 4; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardAllWithReply(cl, pc)); -} - -int -__glXForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 8; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXSingleReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXSingleReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXForwardAllWithReply(cl, pc)); -} - -static GLint -__glReadPixels_size(GLenum format, GLenum type, GLint w, GLint h, - int *elementbits_return, int *rowbytes_return) -{ - GLint elements, esize; - GLint rowsize, padding; - - if (w < 0 || h < 0) { - return -1; - } - switch (format) { - case GL_COLOR_INDEX: - case GL_STENCIL_INDEX: - case GL_DEPTH_COMPONENT: - elements = 1; - break; - case GL_RED: - case GL_GREEN: - case GL_BLUE: - case GL_ALPHA: - case GL_LUMINANCE: - elements = 1; - break; - case GL_LUMINANCE_ALPHA: - elements = 2; - break; - case GL_RGB: - case GL_BGR: - elements = 3; - break; - case GL_RGBA: - case GL_BGRA: - case GL_ABGR_EXT: - elements = 4; - break; - default: - return -1; - } - /* - ** According to the GLX protocol, each row must be padded to a multiple of - ** 4 bytes. 4 bytes also happens to be the default alignment in the pixel - ** store modes of the GL. - */ - switch (type) { - case GL_BITMAP: - if (format == GL_COLOR_INDEX || format == GL_STENCIL_INDEX) { - rowsize = ((w * elements) + 7) / 8; - padding = rowsize % 4; - if (padding) { - rowsize += 4 - padding; - } - if (elementbits_return) - *elementbits_return = elements; - if (rowbytes_return) - *rowbytes_return = rowsize; - return rowsize * h; - } - else { - return -1; - } - case GL_BYTE: - case GL_UNSIGNED_BYTE: - esize = 1; - break; - case GL_UNSIGNED_BYTE_3_3_2: - case GL_UNSIGNED_BYTE_2_3_3_REV: - esize = 1; - elements = 1; - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - esize = 2; - break; - case GL_UNSIGNED_SHORT_5_6_5: - case GL_UNSIGNED_SHORT_5_6_5_REV: - case GL_UNSIGNED_SHORT_4_4_4_4: - case GL_UNSIGNED_SHORT_4_4_4_4_REV: - case GL_UNSIGNED_SHORT_5_5_5_1: - case GL_UNSIGNED_SHORT_1_5_5_5_REV: - esize = 2; - elements = 1; - break; - case GL_INT: - case GL_UNSIGNED_INT: - case GL_FLOAT: - esize = 4; - break; - case GL_UNSIGNED_INT_8_8_8_8: - case GL_UNSIGNED_INT_8_8_8_8_REV: - case GL_UNSIGNED_INT_10_10_10_2: - case GL_UNSIGNED_INT_2_10_10_10_REV: - esize = 4; - elements = 1; - break; - default: - return -1; - } - rowsize = w * elements * esize; - padding = rowsize % 4; - if (padding) { - rowsize += 4 - padding; - } - - if (elementbits_return) - *elementbits_return = esize * elements * 8; - if (rowbytes_return) - *rowbytes_return = rowsize; - - return rowsize * h; -} - -static int -intersectRect(int x1, int x2, int y1, int y2, - int X1, int X2, int Y1, int Y2, - int *ix1, int *ix2, int *iy1, int *iy2) -{ - int right = (x2 < X2 ? x2 : X2); - int bottom = (y2 < Y2 ? y2 : Y2); - int left = (x1 > X1 ? x1 : X1); - int top = (y1 > Y1 ? y1 : Y1); - int width = right - left + 1; - int height = bottom - top + 1; - - if ((width <= 0) || (height <= 0)) { - *ix1 = *ix2 = *iy1 = *iy2 = 0; - return 0; - } - else { - *ix1 = left; - *ix2 = right; - *iy1 = top; - *iy2 = bottom; - return width * height; - } - -} - -int -__glXDisp_ReadPixels(__GLXclientState * cl, GLbyte * pc) -{ - xGLXSingleReq *req = (xGLXSingleReq *) pc; - xGLXSingleReq *be_req; - xGLXReadPixelsReply reply; - xGLXReadPixelsReply be_reply; - GLbyte *be_pc; - GLint x, y; - GLsizei width, height; - GLenum format, type; - GLboolean swapBytes, lsbFirst; - ClientPtr client = cl->client; - DrawablePtr pDraw; - __GLXcontext *glxc; - int from_screen = 0; - int to_screen = 0; - char *buf; - int buf_size; - int s; - int win_x1, win_x2; - int win_y1, win_y2; - int ebits, rowsize; - - if (client->swapped) { - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_INT(&req->contextTag); - } - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXSingleReq; - x = *(GLint *) (pc + 0); - y = *(GLint *) (pc + 4); - width = *(GLsizei *) (pc + 8); - height = *(GLsizei *) (pc + 12); - format = *(GLenum *) (pc + 16); - type = *(GLenum *) (pc + 20); - swapBytes = *(GLboolean *) (pc + 24); - lsbFirst = *(GLboolean *) (pc + 25); - - if (client->swapped) { - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_INT(&x); - __GLX_SWAP_INT(&y); - __GLX_SWAP_INT(&width); - __GLX_SWAP_INT(&height); - __GLX_SWAP_INT(&format); - __GLX_SWAP_INT(&type); - swapBytes = !swapBytes; - } - - buf_size = - __glReadPixels_size(format, type, width, height, &ebits, &rowsize); - if (buf_size > 0) { - buf = (char *) malloc(buf_size); - if (!buf) { - return BadAlloc; - } - } - else { - buf_size = 0; - buf = NULL; - } - - if (buf_size > 0) { - /* - * Get the current drawable this context is bound to - */ - pDraw = __glXLookupDrawableByTag(cl, req->contextTag); - win_x1 = pDraw->x + x; - win_x2 = win_x1 + width - 1; - win_y1 = (dmxGlobalHeight - pDraw->y - pDraw->height) + y; - win_y2 = win_y1 + height - 1; - if (pDraw->type != DRAWABLE_WINDOW) { - from_screen = to_screen = 0; - } - - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - int scr_x1 = dmxScreen->rootXOrigin; - int scr_x2 = dmxScreen->rootXOrigin + dmxScreen->scrnWidth - 1; - int scr_y1 = dmxScreen->rootYOrigin; - int scr_y2 = dmxScreen->rootYOrigin + dmxScreen->scrnHeight - 1; - int wx1, wx2, wy1, wy2; - int sx, sy, sw, sh; - int npixels; - - /* - * find the window portion that is on the current screen - */ - if (pDraw->type == DRAWABLE_WINDOW) { - npixels = intersectRect(scr_x1, scr_x2, scr_y1, scr_y2, - win_x1, win_x2, win_y1, win_y2, - &wx1, &wx2, &wy1, &wy2); - } - else { - wx1 = win_x1; - wx2 = win_x2; - wy1 = win_y1; - wy2 = win_y2; - npixels = (wx2 - wx1 + 1) * (wy2 - wy1 + 1); - } - - if (npixels > 0) { - - /* send the request to the back-end server */ - LockDisplay(dpy); - GetReqExtra(GLXSingle, __GLX_PAD(26), be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = X_GLsop_ReadPixels; - be_req->contextTag = - GetCurrentBackEndTag(cl, req->contextTag, s); - be_pc = ((GLbyte *) (be_req) + sz_xGLXSingleReq); - - sx = wx1 - pDraw->x; - sy = wy1 - (dmxGlobalHeight - pDraw->y - pDraw->height); - sw = (wx2 - wx1 + 1); - sh = (wy2 - wy1 + 1); - - *(GLint *) (be_pc + 0) = sx; /* x */ - *(GLint *) (be_pc + 4) = sy; /* y */ - *(GLsizei *) (be_pc + 8) = sw; /* width */ - *(GLsizei *) (be_pc + 12) = sh; /* height */ - *(GLenum *) (be_pc + 16) = format; - *(GLenum *) (be_pc + 20) = type; - *(GLboolean *) (be_pc + 24) = swapBytes; - *(GLboolean *) (be_pc + 25) = lsbFirst; - - _XReply(dpy, (xReply *) &be_reply, 0, False); - - if (be_reply.length > 0) { - char *be_buf; - int be_buf_size = be_reply.length << 2; - - be_buf = (char *) malloc(be_buf_size); - if (be_buf) { - _XRead(dpy, be_buf, be_buf_size); - - /* copy pixels data to the right location of the */ - /* reply buffer */ - if (type != GL_BITMAP) { - int pbytes = ebits / 8; - char *dst = - buf + (sy - y) * rowsize + (sx - x) * pbytes; - char *src = be_buf; - int pad = (pbytes * sw) % 4; - int r; - - for (r = 0; r < sh; r++) { - memcpy(dst, src, pbytes * sw); - dst += rowsize; - src += (pbytes * sw + (pad ? 4 - pad : 0)); - } - } - else { - /* this is a GL_BITMAP pixel type, should copy bits */ - int r; - int src_rowsize = bits_to_bytes(sw * ebits); - int src_pad = src_rowsize % 4; - - if (src_pad) { - src_rowsize += (4 - src_pad); - } - - for (r = 0; r < sh; r++) { - unsigned char dst_mask = 0x80 >> (sx % 8); - unsigned char src_mask = 0x80; - char *dst = - buf + (sy - y + r) * rowsize + (sx - x) / 8; - char *src = be_buf + r * src_rowsize; - int b; - - for (b = 0; b < sw * ebits; b++) { - if (*src & src_mask) { - *dst |= dst_mask; - } - else { - *dst &= ~dst_mask; - } - - if (dst_mask > 1) - dst_mask >>= 1; - else { - dst_mask = 0x80; - dst++; - } - - if (src_mask > 1) - src_mask >>= 1; - else { - src_mask = 0x80; - src++; - } - } - } - - } - - free(be_buf); - } - else { - /* Throw data on the floor */ - _XEatDataWords(dpy, be_reply.length); - free(buf); - return BadAlloc; - } - } - - UnlockDisplay(dpy); - SyncHandle(); - - } /* of npixels > 0 */ - - } /* of for loop */ - - } /* of if buf_size > 0 */ - - reply = (xGLXReadPixelsReply) { - .type = X_Reply, - .sequenceNumber = client->sequence, - .length = buf_size >> 2 - }; - - if (client->swapped) { - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply.sequenceNumber); - __GLX_SWAP_INT(&reply.length); - } - - WriteToClient(client, sizeof(xGLXReadPixelsReply), &reply); - if (buf_size > 0) { - WriteToClient(client, buf_size, buf); - free(buf); - } - - return Success; -} - -int -__glXDispSwap_GetTexImage(__GLXclientState * cl, GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - GLbyte *lpc = pc; - - lpc += sz_xGLXSingleReq; - __GLX_SWAP_INT(lpc + 0); - __GLX_SWAP_INT(lpc + 4); - __GLX_SWAP_INT(lpc + 8); - __GLX_SWAP_INT(lpc + 12); - - /* reverse swapBytes */ - *(GLboolean *) (lpc + 16) = !*(GLboolean *) (lpc + 16); - - return (__glXForwardPipe0WithReplySwap(cl, pc)); -} - -int -__glXDispSwap_GetColorTable(__GLXclientState * cl, GLbyte * pc) -{ - __GLX_DECLARE_SWAP_VARIABLES; - GLbyte *lpc = pc; - - lpc += sz_xGLXSingleReq; - __GLX_SWAP_INT(lpc + 0); - __GLX_SWAP_INT(lpc + 4); - __GLX_SWAP_INT(lpc + 8); - - /* reverse swapBytes */ - *(GLboolean *) (lpc + 12) = !*(GLboolean *) (lpc + 12); - - return (__glXForwardPipe0WithReplySwap(cl, pc)); -} diff --git a/hw/dmx/glxProxy/glxsingle.h b/hw/dmx/glxProxy/glxsingle.h deleted file mode 100644 index 6126177fa..000000000 --- a/hw/dmx/glxProxy/glxsingle.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifndef __GLXSINGLE_H -#define __GLXSINGLE_H - -extern int __glXForwardSingleReq(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardAllWithReply(__GLXclientState * cl, GLbyte * pc); - -extern int __glXForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc); - -extern int __glXForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc); - -extern int __glXForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc); -extern int __glXForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc); - -#endif diff --git a/hw/dmx/glxProxy/glxswap.c b/hw/dmx/glxProxy/glxswap.c deleted file mode 100644 index bc18e5518..000000000 --- a/hw/dmx/glxProxy/glxswap.c +++ /dev/null @@ -1,560 +0,0 @@ -/* - * Copyright 2003 Red Hat Inc., Raleigh, 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> - * - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxwindow.h" -#include "glxserver.h" -#include "glxswap.h" -#include "glxcmds.h" - -typedef struct _SwapGroup *SwapGroupPtr; - -static Bool SwapBarrierIsReadyToSwap(GLuint barrier); -static void SwapSwapBarrier(GLuint barrier); -static void UpdateSwapBarrierList(GLuint barrier, - SwapGroupPtr pOldSwap, SwapGroupPtr pNewSwap); - -/************************************************************************ - * - * Swap Groups - * - ************************************************************************/ - -typedef struct _SwapGroup { - WindowPtr pWin; - SwapGroupPtr pNext; - - Bool swapping; - Bool sleeping; - GLuint barrier; - - XID drawable; - GLXContextTag tag; - __GLXclientState *clState; -} SwapGroupRec; - -static void -SwapSwapGroup(SwapGroupPtr pSwap) -{ - SwapGroupPtr pCur; - - /* All drawables in swap group are ready to swap, so just swap all - * drawables buffers and then wake up those clients that were - * previously sleeping */ - - for (pCur = pSwap; pCur; pCur = pCur->pNext) { - if (pCur->swapping) { - /* Swap pCur's buffers */ - __glXDoSwapBuffers(pCur->clState, pCur->drawable, pCur->tag); - pCur->swapping = FALSE; - } - - /* Wakeup client */ - if (pCur->sleeping) { - ClientWakeup(pCur->clState->client); - pCur->sleeping = FALSE; - } - } -} - -static Bool -SwapGroupIsReadyToSwap(SwapGroupPtr pSwap) -{ - Bool isReady = TRUE; - - /* The swap group is ready to swap when all drawables are ready to - * swap. NOTE: A drawable is also ready to swap if it is not - * currently mapped */ - for (; pSwap; pSwap = pSwap->pNext) { - isReady &= (pSwap->swapping || !pSwap->pWin->mapped); - /* FIXME: Should we use pSwap->pWin->mapped or ...->realized ??? */ - } - - return isReady; -} - -static Bool -SGSwapCleanup(ClientPtr client, void *closure) -{ - /* SwapGroupPtr pSwap = (SwapGroupPtr)closure; */ - - /* This should not be called unless the client has died in which - * case we should remove the buffer from the swap list */ - - return TRUE; -} - -int -SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag, - DrawablePtr pDraw) -{ - WindowPtr pWin = (WindowPtr) pDraw; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); - SwapGroupPtr pSwap = pWinPriv->swapGroup; - SwapGroupPtr pCur; - - for (pCur = pSwap; pCur && pCur->pWin != pWin; pCur = pCur->pNext); - if (!pCur) - return BadDrawable; - - pCur->clState = cl; - pCur->drawable = drawId; - pCur->tag = tag; - - /* We are now in the process of swapping */ - pCur->swapping = TRUE; - - if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) { - /* The swap group is bound to a barrier and the barrier is ready - * to swap, so swap all the swap groups that are bound to this - * group's swap barrier */ - SwapSwapBarrier(pSwap->barrier); - } - else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) { - /* Do the swap if the entire swap group is ready to swap and the - * group is not bound to a swap barrier */ - SwapSwapGroup(pSwap); - } - else { - /* The swap group/barrier is not yet ready to swap, so put - * client to sleep until the rest are ready to swap */ - ClientSleep(cl->client, SGSwapCleanup, (void *) pWin); - pCur->sleeping = TRUE; - } - - return Success; -} - -static void -SGWindowUnmapped(WindowPtr pWin) -{ - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); - SwapGroupPtr pSwap = pWinPriv->swapGroup; - - /* Now that one of the windows in the swap group has been unmapped, - * see if the entire swap group/barrier is ready to swap */ - - if (pSwap->barrier && SwapBarrierIsReadyToSwap(pSwap->barrier)) { - SwapSwapBarrier(pSwap->barrier); - } - else if (!pSwap->barrier && SwapGroupIsReadyToSwap(pSwap)) { - SwapSwapGroup(pSwap); - } -} - -static void -SGWindowDestroyed(WindowPtr pWin) -{ - JoinSwapGroupSGIX((DrawablePtr) pWin, NULL); -} - -static SwapGroupPtr -CreateSwapEntry(WindowPtr pWin) -{ - SwapGroupPtr pEntry; - - /* Allocate new swap group */ - pEntry = malloc(sizeof(*pEntry)); - if (!pEntry) - return NULL; - - /* Initialize swap group */ - pEntry->pWin = pWin; - pEntry->pNext = NULL; - pEntry->swapping = FALSE; - pEntry->sleeping = FALSE; - pEntry->barrier = 0; - /* The following are not initialized until SwapBuffers is called: - * pEntry->drawable - * pEntry->tag - * pEntry->clState - */ - - return pEntry; -} - -static void -FreeSwapEntry(SwapGroupPtr pEntry) -{ - /* Since we have removed the drawable from its previous swap group - * and it won't be added to another swap group, the only thing that - * we need to do is to make sure that the drawable's client is not - * sleeping. This could happen if one thread is sleeping, while - * another thread called glxJoinSwapGroup(). Note that all sleeping - * threads should also be swapping, but there is a small window in - * the SGSwapBuffer() logic, above, where swapping can be set but - * sleeping is not. We check both independently here just to be - * pedantic. */ - - /* Handle swap buffer request */ - if (pEntry->swapping) - __glXDoSwapBuffers(pEntry->clState, pEntry->drawable, pEntry->tag); - - /* Wake up client */ - if (pEntry->sleeping) - ClientWakeup(pEntry->clState->client); - - /* We can free the pEntry entry since it has already been removed - * from the swap group list and it won't be needed any longer */ - free(pEntry); -} - -int -JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember) -{ - if (pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDraw; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); - SwapGroupPtr pOldSwap = NULL; - SwapGroupPtr pEntry; - - /* If pDraw and pMember are already members of the same swap - * group, just return Success since there is nothing to do */ - for (pEntry = pWinPriv->swapGroup; pEntry; pEntry = pEntry->pNext) - if (pEntry->pWin == (WindowPtr) pMember) - return Success; - - /* Remove pDraw from its current swap group */ - if (pWinPriv->swapGroup) { - SwapGroupPtr pSwapGroup = pWinPriv->swapGroup; - SwapGroupPtr pPrev; - - /* Find old swap entry in swap group and save in pOldSwap - * for later use */ - for (pOldSwap = pWinPriv->swapGroup, pPrev = NULL; - pOldSwap && pOldSwap->pWin != pWin; - pPrev = pOldSwap, pOldSwap = pOldSwap->pNext); - if (!pOldSwap) - return BadDrawable; - - /* Remove pDraw's swap group entry from swap group list */ - if (pPrev) { - pPrev->pNext = pOldSwap->pNext; - } - else { - /* pWin is at the head of the swap group list, so we - * need to update all other members of this swap - * group */ - for (pEntry = pOldSwap->pNext; pEntry; pEntry = pEntry->pNext) - DMX_GET_WINDOW_PRIV(pEntry->pWin)->swapGroup - = pOldSwap->pNext; - - /* Update the barrier list as well */ - if (pOldSwap->barrier) - UpdateSwapBarrierList(pOldSwap->barrier, - pOldSwap, pOldSwap->pNext); - - /* Set pSwapGroup to point to the swap group without - * pOldSwap */ - pSwapGroup = pOldSwap->pNext; - } - - /* Check to see if current swap group can now swap since we - * know at this point that pDraw and pMember are guaranteed - * to previously be in different swap groups */ - if (pSwapGroup && SwapGroupIsReadyToSwap(pSwapGroup)) { - SwapSwapGroup(pSwapGroup); - } - - /* Make the old swap entry a standalone group */ - pOldSwap->pNext = NULL; - pOldSwap->barrier = 0; - - /* Reset pWin's swap group */ - pWinPriv->swapGroup = NULL; - pWinPriv->windowDestroyed = NULL; - pWinPriv->windowUnmapped = NULL; - } - - if (!pMember || pMember->type != DRAWABLE_WINDOW) { - /* Free old swap group since it is no longer needed */ - if (pOldSwap) - FreeSwapEntry(pOldSwap); - } - else if (pDraw == pMember && pOldSwap) { - /* Special case where pDraw was previously created and we - * are now just putting it to its own swap group */ - pWinPriv->swapGroup = pOldSwap; - pWinPriv->windowDestroyed = SGWindowDestroyed; - pWinPriv->windowUnmapped = SGWindowUnmapped; - - /* Check to see if pDraw is ready to swap */ - if (SwapGroupIsReadyToSwap(pOldSwap)) - SwapSwapGroup(pOldSwap); - } - else if (pMember->type == DRAWABLE_WINDOW) { - WindowPtr pMemberWin = (WindowPtr) pMember; - dmxWinPrivPtr pMemberPriv = DMX_GET_WINDOW_PRIV(pMemberWin); - SwapGroupPtr pMemberSwapGroup = pMemberPriv->swapGroup; - - /* Finally, how we can add pDraw to pMember's swap group */ - - /* If pMember is not currently in a swap group, then create - * one for it since we are just about to add pDraw to it. */ - if (!pMemberSwapGroup) { - /* Create new swap group */ - pMemberSwapGroup = CreateSwapEntry(pMemberWin); - if (!pMemberSwapGroup) { - if (pOldSwap) - FreeSwapEntry(pOldSwap); - return BadAlloc; - } - - /* Set pMember's swap group */ - pMemberPriv->swapGroup = pMemberSwapGroup; - pMemberPriv->windowDestroyed = SGWindowDestroyed; - pMemberPriv->windowUnmapped = SGWindowUnmapped; - } - - /* If pDraw == pMember, that means pDraw was not a member of - * a group previously (or it would have been handled by the - * special case above), so no additional work is required - * since we just created a new swap group for pMember (i.e., - * pDraw). */ - - if (pDraw != pMember) { - /* If pDraw was not previously in a swap group, then create - * an entry for it */ - if (!pOldSwap) { - /* Create new swap group */ - pOldSwap = CreateSwapEntry(pWin); - if (!pOldSwap) { - /* If we just created a swap group for pMember, we - * need to free it here */ - if (pMemberSwapGroup->pNext == NULL) { - FreeSwapEntry(pMemberSwapGroup); - pMemberPriv->swapGroup = NULL; - } - return BadAlloc; - } - } - - /* Find last entry in pMember's swap group */ - for (pEntry = pMemberSwapGroup; - pEntry->pNext; pEntry = pEntry->pNext); - - /* Add pDraw's swap group entry to pMember's swap group list */ - pEntry->pNext = pOldSwap; - - /* Add pDraw to pMember's swap barrier */ - pOldSwap->barrier = pEntry->barrier; - - /* Set pDraw's swap group */ - pWinPriv->swapGroup = pMemberSwapGroup; - pWinPriv->windowDestroyed = SGWindowDestroyed; - pWinPriv->windowUnmapped = SGWindowUnmapped; - } - } - } - - return Success; -} - -/************************************************************************ - * - * Swap Barriers - * - ************************************************************************/ - -#define GLX_MAX_SWAP_BARRIERS 10 - -typedef struct _SwapBarrier *SwapBarrierPtr; -typedef struct _SwapBarrier { - SwapGroupPtr pSwap; - SwapBarrierPtr pNext; -} SwapBarrierRec; - -static SwapBarrierPtr SwapBarrierList[GLX_MAX_SWAP_BARRIERS + 1]; - -void -SwapBarrierInit(void) -{ - int i; - - for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) - SwapBarrierList[i] = NULL; -} - -void -SwapBarrierReset(void) -{ - int i; - - for (i = 0; i <= GLX_MAX_SWAP_BARRIERS; i++) { - SwapBarrierPtr pBarrier, pNextBarrier; - - for (pBarrier = SwapBarrierList[i]; pBarrier; pBarrier = pNextBarrier) { - pNextBarrier = pBarrier->pNext; - free(pBarrier); - } - SwapBarrierList[i] = NULL; - } -} - -int -QueryMaxSwapBarriersSGIX(int screen) -{ - return GLX_MAX_SWAP_BARRIERS; -} - -static Bool -BindSwapGroupToBarrier(GLuint barrier, SwapGroupPtr pSwapGroup) -{ - SwapBarrierPtr pBarrier; - - pBarrier = malloc(sizeof(*pBarrier)); - if (!pBarrier) - return FALSE; - - /* Add the swap group to barrier's list */ - pBarrier->pSwap = pSwapGroup; - pBarrier->pNext = SwapBarrierList[barrier]; - SwapBarrierList[barrier] = pBarrier; - - return TRUE; -} - -static Bool -UnbindSwapGroupFromBarrier(GLuint barrier, SwapGroupPtr pSwapGroup) -{ - SwapBarrierPtr pBarrier, pPrevBarrier; - - /* Find the swap group in barrier's list */ - for (pBarrier = SwapBarrierList[barrier], pPrevBarrier = NULL; - pBarrier && pBarrier->pSwap != pSwapGroup; - pPrevBarrier = pBarrier, pBarrier = pBarrier->pNext); - if (!pBarrier) - return FALSE; - - /* Remove the swap group from barrier's list */ - if (pPrevBarrier) - pPrevBarrier->pNext = pBarrier->pNext; - else - SwapBarrierList[barrier] = pBarrier->pNext; - - /* Free memory */ - free(pBarrier); - - return TRUE; -} - -static void -UpdateSwapBarrierList(GLuint barrier, - SwapGroupPtr pOldSwap, SwapGroupPtr pNewSwap) -{ - SwapBarrierPtr pBarrier; - - /* If the old swap group is being destroyed, then we need to remove - * the swap group from the list entirely */ - if (!pNewSwap) { - UnbindSwapGroupFromBarrier(barrier, pOldSwap); - return; - } - - /* Otherwise, find the old swap group in the barrier list and change - * it to the new swap group */ - for (pBarrier = SwapBarrierList[barrier]; - pBarrier; pBarrier = pBarrier->pNext) { - if (pBarrier->pSwap == pOldSwap) { - pBarrier->pSwap = pNewSwap; - return; - } - } -} - -static Bool -SwapBarrierIsReadyToSwap(GLuint barrier) -{ - SwapBarrierPtr pBarrier; - Bool isReady = TRUE; - - /* The swap barier is ready to swap when swap groups that are bound - * to barrier are ready to swap */ - for (pBarrier = SwapBarrierList[barrier]; - pBarrier; pBarrier = pBarrier->pNext) - isReady &= SwapGroupIsReadyToSwap(pBarrier->pSwap); - - return isReady; -} - -static void -SwapSwapBarrier(GLuint barrier) -{ - SwapBarrierPtr pBarrier; - - /* Swap each group that is a member of this barrier */ - for (pBarrier = SwapBarrierList[barrier]; - pBarrier; pBarrier = pBarrier->pNext) - SwapSwapGroup(pBarrier->pSwap); -} - -int -BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier) -{ - /* FIXME: Check for errors when pDraw->type != DRAWABLE_WINDOW */ - - if (barrier < 0 || barrier > GLX_MAX_SWAP_BARRIERS) - return BadValue; - - if (pDraw->type == DRAWABLE_WINDOW) { - WindowPtr pWin = (WindowPtr) pDraw; - dmxWinPrivPtr pWinPriv = DMX_GET_WINDOW_PRIV(pWin); - SwapGroupPtr pSwapGroup = pWinPriv->swapGroup; - SwapGroupPtr pCur; - - if (!pSwapGroup) - return BadDrawable; - if (barrier && pSwapGroup->barrier) - return BadValue; - - /* Update the swap barrier list */ - if (barrier) { - if (!BindSwapGroupToBarrier(barrier, pSwapGroup)) - return BadAlloc; - } - else { - if (!UnbindSwapGroupFromBarrier(pSwapGroup->barrier, pSwapGroup)) - return BadDrawable; - } - - /* Set the barrier for each member of this swap group */ - for (pCur = pSwapGroup; pCur; pCur = pCur->pNext) - pCur->barrier = barrier; - } - - return Success; -} diff --git a/hw/dmx/glxProxy/glxswap.h b/hw/dmx/glxProxy/glxswap.h deleted file mode 100644 index 1e1fea14f..000000000 --- a/hw/dmx/glxProxy/glxswap.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2003 Red Hat Inc., Raleigh, 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> - * - */ - -#ifndef __GLX_swap_h__ -#define __GLX_swap_h__ - -extern int JoinSwapGroupSGIX(DrawablePtr pDraw, DrawablePtr pMember); -extern int SGSwapBuffers(__GLXclientState * cl, XID drawId, GLXContextTag tag, - DrawablePtr pDraw); - -extern void SwapBarrierInit(void); -extern void SwapBarrierReset(void); -extern int QueryMaxSwapBarriersSGIX(int screen); -extern int BindSwapBarrierSGIX(DrawablePtr pDraw, int barrier); - -#endif /* !__GLX_swap_h__ */ diff --git a/hw/dmx/glxProxy/glxutil.h b/hw/dmx/glxProxy/glxutil.h deleted file mode 100644 index 605c07b43..000000000 --- a/hw/dmx/glxProxy/glxutil.h +++ /dev/null @@ -1,39 +0,0 @@ -#ifndef _glxcmds_h_ -#define _glxcmds_h_ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -/* context helper routines */ -extern __GLXcontext *__glXLookupContextByTag(__GLXclientState *, GLXContextTag); -extern DrawablePtr __glXLookupDrawableByTag(__GLXclientState * cl, - GLXContextTag tag); - -#endif /* _glxcmds_h_ */ diff --git a/hw/dmx/glxProxy/glxvendor.c b/hw/dmx/glxProxy/glxvendor.c deleted file mode 100644 index f1d464305..000000000 --- a/hw/dmx/glxProxy/glxvendor.c +++ /dev/null @@ -1,618 +0,0 @@ -/* DO NOT EDIT - THIS FILE IS AUTOMATICALLY GENERATED */ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxwindow.h" -#include "dmxpixmap.h" -#include "dmxfont.h" - -#include "glxserver.h" -#include "glxext.h" -#include "g_disptab.h" -/* #include "g_disptab_EXT.h" */ -#include "unpack.h" -#include "glxutil.h" -#include "glxcmds.h" -#include "glxvendor.h" - -#include "GL/glxproto.h" - -#ifdef PANORAMIX -#include "panoramiXsrv.h" -#endif - -/* - * GetReqVendorPrivate - this is the equivalent of GetReq macro - * from Xlibint.h but it does not set the reqType field (the opcode). - * this is because the GL single opcodes has different naming convention - * the other X opcodes (ie. X_GLsop_GetFloatv). - */ -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define GetReqVendorPrivate(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x##name##Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x##name##Req *)(dpy->last_req = dpy->bufptr);\ - req->length = (SIZEOF(x##name##Req))>>2;\ - dpy->bufptr += SIZEOF(x##name##Req);\ - dpy->request++ - -#else /* non-ANSI C uses empty comment instead of "##" for token concatenation */ -#define GetReqVendorPrivate(name, req) \ - WORD64ALIGN\ - if ((dpy->bufptr + SIZEOF(x/**/name/**/Req)) > dpy->bufmax)\ - _XFlush(dpy);\ - req = (x/**/name/**/Req *)(dpy->last_req = dpy->bufptr);\ - req->length = (SIZEOF(x/**/name/**/Req))>>2;\ - dpy->bufptr += SIZEOF(x/**/name/**/Req);\ - dpy->request++ -#endif - -static int swap_vec_element_size = 0; - -static void -SendSwappedReply(ClientPtr client, - xGLXVendorPrivReply * reply, char *buf, int buf_size) -{ - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_SWAP_SHORT(&reply->sequenceNumber); - __GLX_SWAP_INT(&reply->length); - __GLX_SWAP_INT(&reply->retval); - __GLX_SWAP_INT(&reply->size); - - if ((buf_size == 0) && (swap_vec_element_size > 0)) { - /* - * the reply has single component - need to swap pad3 - */ - if (swap_vec_element_size == 2) { - __GLX_SWAP_SHORT(&reply->pad3); - } - else if (swap_vec_element_size == 4) { - __GLX_SWAP_INT(&reply->pad3); - __GLX_SWAP_INT(&reply->pad4); - } - else if (swap_vec_element_size == 8) { - __GLX_SWAP_DOUBLE(&reply->pad3); - } - } - else if ((buf_size > 0) && (swap_vec_element_size > 0)) { - /* - * the reply has vector of elements which needs to be swapped - */ - int vsize = buf_size / swap_vec_element_size; - char *p = buf; - int i; - - for (i = 0; i < vsize; i++) { - if (swap_vec_element_size == 2) { - __GLX_SWAP_SHORT(p); - } - else if (swap_vec_element_size == 4) { - __GLX_SWAP_INT(p); - } - else if (swap_vec_element_size == 8) { - __GLX_SWAP_DOUBLE(p); - } - - p += swap_vec_element_size; - } - - __GLX_SWAP_INT(&reply->pad3); - __GLX_SWAP_INT(&reply->pad4); - __GLX_SWAP_INT(&reply->pad5); - __GLX_SWAP_INT(&reply->pad6); - - } - - WriteToClient(client, sizeof(xGLXVendorPrivReply), reply); - if (buf_size > 0) - WriteToClient(client, buf_size, buf); - -} - -int -__glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - xGLXVendorPrivateReq *be_req; - __GLXcontext *glxc; - int from_screen = 0; - int to_screen = 0; - int buf_size; - int s; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXVendorPrivateReq; - buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; - - /* - * just forward the request to back-end server(s) - */ - for (s = from_screen; s <= to_screen; s++) { - DMXScreenInfo *dmxScreen = &dmxScreens[s]; - Display *dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReqVendorPrivate(GLXVendorPrivate, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = req->glxCode; - be_req->length = req->length; - be_req->vendorCode = req->vendorCode; - be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); - if (buf_size > 0) - _XSend(dpy, (const char *) pc, buf_size); - UnlockDisplay(dpy); - SyncHandle(); - } - - return Success; -} - -int -__glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - xGLXVendorPrivateReq *be_req; - xGLXVendorPrivReply reply; - xGLXVendorPrivReply be_reply; - __GLXcontext *glxc; - int buf_size; - char *be_buf = NULL; - int be_buf_size; - DMXScreenInfo *dmxScreen; - Display *dpy; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return __glXBadContext; - } - - pc += sz_xGLXVendorPrivateReq; - buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; - - dmxScreen = &dmxScreens[glxc->pScreen->myNum]; - dpy = GetBackEndDisplay(cl, glxc->pScreen->myNum); - - /* - * send the request to the first back-end server - */ - LockDisplay(dpy); - GetReqVendorPrivate(GLXVendorPrivate, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = req->glxCode; - be_req->length = req->length; - be_req->vendorCode = req->vendorCode; - be_req->contextTag = - GetCurrentBackEndTag(cl, req->contextTag, glxc->pScreen->myNum); - if (buf_size > 0) - _XSend(dpy, (const char *) pc, buf_size); - - /* - * get the reply from the back-end server - */ - _XReply(dpy, (xReply *) &be_reply, 0, False); - be_buf_size = be_reply.length << 2; - if (be_buf_size > 0) { - be_buf = (char *) malloc(be_buf_size); - if (be_buf) { - _XRead(dpy, be_buf, be_buf_size); - } - else { - /* Throw data on the floor */ - _XEatDataWords(dpy, be_reply.length); - return BadAlloc; - } - } - - UnlockDisplay(dpy); - SyncHandle(); - - /* - * send the reply to the client - */ - memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply); - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - - if (client->swapped) { - SendSwappedReply(client, &reply, be_buf, be_buf_size); - } - else { - WriteToClient(client, sizeof(xGLXVendorPrivReply), &reply); - if (be_buf_size > 0) - WriteToClient(client, be_buf_size, be_buf); - } - - if (be_buf_size > 0) - free(be_buf); - - return Success; -} - -int -__glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc) -{ - ClientPtr client = cl->client; - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - xGLXVendorPrivateReq *be_req; - xGLXVendorPrivReply reply; - xGLXVendorPrivReply be_reply; - __GLXcontext *glxc; - int buf_size; - char *be_buf = NULL; - int be_buf_size = 0; - int from_screen = 0; - int to_screen = 0; - int s; - - DMXScreenInfo *dmxScreen; - Display *dpy; - - glxc = __glXLookupContextByTag(cl, req->contextTag); - if (!glxc) { - return 0; - } - from_screen = to_screen = glxc->pScreen->myNum; - -#ifdef PANORAMIX - if (!noPanoramiXExtension) { - from_screen = 0; - to_screen = screenInfo.numScreens - 1; - } -#endif - - pc += sz_xGLXVendorPrivateReq; - buf_size = (req->length << 2) - sz_xGLXVendorPrivateReq; - - /* - * send the request to the first back-end server(s) - */ - for (s = to_screen; s >= from_screen; s--) { - dmxScreen = &dmxScreens[s]; - dpy = GetBackEndDisplay(cl, s); - - LockDisplay(dpy); - GetReqVendorPrivate(GLXVendorPrivate, be_req); - be_req->reqType = dmxScreen->glxMajorOpcode; - be_req->glxCode = req->glxCode; - be_req->length = req->length; - be_req->vendorCode = req->vendorCode; - be_req->contextTag = GetCurrentBackEndTag(cl, req->contextTag, s); - if (buf_size > 0) - _XSend(dpy, (const char *) pc, buf_size); - - /* - * get the reply from the back-end server - */ - _XReply(dpy, (xReply *) &be_reply, 0, False); - if (s == from_screen) { - /* Save data from last reply to send on to client */ - be_buf_size = be_reply.length << 2; - if (be_buf_size > 0) { - be_buf = malloc(be_buf_size); - if (be_buf) { - _XRead(dpy, be_buf, be_buf_size); - } - else { - /* Throw data on the floor */ - _XEatDataWords(dpy, be_reply.length); - return BadAlloc; - } - } - } - else { - /* Just discard data from all replies before the last one */ - if (be_reply.length > 0) - _XEatDataWords(dpy, be_reply.length); - } - - UnlockDisplay(dpy); - SyncHandle(); - } - - /* - * send the reply to the client - */ - memcpy(&reply, &be_reply, sz_xGLXVendorPrivReply); - reply.type = X_Reply; - reply.sequenceNumber = client->sequence; - - if (client->swapped) { - SendSwappedReply(client, &reply, be_buf, be_buf_size); - } - else { - WriteToClient(client, sizeof(xGLXVendorPrivReply), &reply); - if (be_buf_size > 0) - WriteToClient(client, be_buf_size, be_buf); - } - - if (be_buf_size > 0) - free(be_buf); - - return Success; -} - -int -__glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 0; - - return (__glXVForwardSingleReq(cl, pc)); -} - -int -__glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 0; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardPipe0WithReply(cl, pc)); -} - -int -__glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 2; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardPipe0WithReply(cl, pc)); -} - -int -__glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 4; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardPipe0WithReply(cl, pc)); -} - -int -__glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 8; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardPipe0WithReply(cl, pc)); -} - -int -__glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 0; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardAllWithReply(cl, pc)); -} - -int -__glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 2; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardAllWithReply(cl, pc)); -} - -int -__glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 4; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardAllWithReply(cl, pc)); -} - -int -__glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc) -{ - xGLXVendorPrivateReq *req = (xGLXVendorPrivateReq *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_SHORT(&req->length); - __GLX_SWAP_INT(&req->vendorCode); - __GLX_SWAP_INT(&req->contextTag); - - swap_vec_element_size = 8; - - /* - * swap extra data in request - assuming all data - * (if available) are arrays of 4 bytes components ! - */ - if (req->length > sz_xGLXVendorPrivateReq / 4) { - int *data = (int *) (req + 1); - int count = req->length - sz_xGLXVendorPrivateReq / 4; - - __GLX_SWAP_INT_ARRAY(data, count); - } - - return (__glXVForwardAllWithReply(cl, pc)); -} diff --git a/hw/dmx/glxProxy/glxvendor.h b/hw/dmx/glxProxy/glxvendor.h deleted file mode 100644 index 0d160ab9f..000000000 --- a/hw/dmx/glxProxy/glxvendor.h +++ /dev/null @@ -1,53 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifndef __GLXVENDOR_H -#define __GLXVENDOR_H - -extern int __glXVForwardSingleReq(__GLXclientState * cl, GLbyte * pc); -extern int __glXVForwardPipe0WithReply(__GLXclientState * cl, GLbyte * pc); -extern int __glXVForwardAllWithReply(__GLXclientState * cl, GLbyte * pc); - -extern int __glXVForwardSingleReqSwap(__GLXclientState * cl, GLbyte * pc); - -extern int __glXVForwardPipe0WithReplySwap(__GLXclientState * cl, GLbyte * pc); -extern int __glXVForwardPipe0WithReplySwapsv(__GLXclientState * cl, - GLbyte * pc); -extern int __glXVForwardPipe0WithReplySwapiv(__GLXclientState * cl, - GLbyte * pc); -extern int __glXVForwardPipe0WithReplySwapdv(__GLXclientState * cl, - GLbyte * pc); - -extern int __glXVForwardAllWithReplySwap(__GLXclientState * cl, GLbyte * pc); -extern int __glXVForwardAllWithReplySwapsv(__GLXclientState * cl, GLbyte * pc); -extern int __glXVForwardAllWithReplySwapiv(__GLXclientState * cl, GLbyte * pc); -extern int __glXVForwardAllWithReplySwapdv(__GLXclientState * cl, GLbyte * pc); - -#endif diff --git a/hw/dmx/glxProxy/glxvisuals.c b/hw/dmx/glxProxy/glxvisuals.c deleted file mode 100644 index 3fca04f0d..000000000 --- a/hw/dmx/glxProxy/glxvisuals.c +++ /dev/null @@ -1,158 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "glxserver.h" -#include "glxvisuals.h" - -int -glxVisualsMatch(__GLXvisualConfig * v1, __GLXvisualConfig * v2) -{ - if ((v1->class == v2->class) && - (v1->rgba == v2->rgba) && - (v1->redSize == v2->redSize) && - (v1->greenSize == v2->greenSize) && - (v1->blueSize == v2->blueSize) && - (v1->alphaSize == v2->alphaSize) && - (v1->redMask == v2->redMask) && - (v1->greenMask == v2->greenMask) && - (v1->blueMask == v2->blueMask) && - (v1->alphaMask == v2->alphaMask) && - (v1->accumRedSize == v2->accumRedSize) && - (v1->accumGreenSize == v2->accumGreenSize) && - (v1->accumBlueSize == v2->accumBlueSize) && - (v1->accumAlphaSize == v2->accumAlphaSize) && - (v1->doubleBuffer == v2->doubleBuffer) && - (v1->stereo == v2->stereo) && - (v1->bufferSize == v2->bufferSize) && - (v1->depthSize == v2->depthSize) && - (v1->stencilSize == v2->stencilSize) && - (v1->auxBuffers == v2->auxBuffers) && - (v1->level == v2->level) && - (v1->visualRating == v2->visualRating) && - (v1->transparentPixel == v2->transparentPixel) && - (v1->transparentRed == v2->transparentRed) && - (v1->transparentGreen == v2->transparentGreen) && - (v1->transparentBlue == v2->transparentBlue) && - (v1->transparentAlpha == v2->transparentAlpha) && - (v1->transparentIndex == v2->transparentIndex) && - (v1->multiSampleSize == v2->multiSampleSize) && - (v1->nMultiSampleBuffers == v2->nMultiSampleBuffers) && - (v1->visualSelectGroup == v2->visualSelectGroup)) { - - return 1; - - } - - return 0; - -} - -VisualID -glxMatchGLXVisualInConfigList(__GLXvisualConfig * pGlxVisual, - __GLXvisualConfig * configs, int nconfigs) -{ - int i; - - for (i = 0; i < nconfigs; i++) { - - if (glxVisualsMatch(pGlxVisual, &configs[i])) { - - return configs[i].vid; - - } - } - - return 0; -} - -VisualID -glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual, - __GLXvisualConfig * configs, int nconfigs) -{ - __GLXscreenInfo *pGlxScreen; - __GLXvisualConfig *pGlxVisual; - int i; - - /* check that the glx extension has been initialized */ - if (!__glXActiveScreens) - return 0; - - pGlxScreen = &__glXActiveScreens[pScreen->myNum]; - pGlxVisual = pGlxScreen->pGlxVisual; - - /* find the glx visual info for pVisual */ - for (i = 0; i < pGlxScreen->numVisuals; i++, pGlxVisual++) { - if (pGlxVisual->vid == pVisual->vid) { - break; - } - } - if (i == pGlxScreen->numVisuals) { - /* - * the visual is not supported by glx - */ - return 0; - } - - return (glxMatchGLXVisualInConfigList(pGlxVisual, configs, nconfigs)); -} - -VisualPtr -glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual, ScreenPtr pMatchScreen) -{ - __GLXscreenInfo *pGlxScreen2; - int j; - VisualID vid; - - /* check that the glx extension has been initialized */ - if (!__glXActiveScreens) - return NULL; - - pGlxScreen2 = &__glXActiveScreens[pMatchScreen->myNum]; - - vid = glxMatchVisualInConfigList(pScreen, pVisual, - pGlxScreen2->pGlxVisual, - pGlxScreen2->numVisuals); - if (vid) { - /* - * find the X visual of the matching glx visual - */ - for (j = 0; j < pMatchScreen->numVisuals; j++) { - if (vid == pMatchScreen->visuals[j].vid) { - return &pMatchScreen->visuals[j]; - } - } - } - - return 0; -} diff --git a/hw/dmx/glxProxy/glxvisuals.h b/hw/dmx/glxProxy/glxvisuals.h deleted file mode 100644 index e1e023878..000000000 --- a/hw/dmx/glxProxy/glxvisuals.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#ifndef _GLX_VISUALS_H -#define _GLX_VISUALS_H - -int glxVisualsMatch(__GLXvisualConfig * v1, __GLXvisualConfig * v2); - -VisualID glxMatchGLXVisualInConfigList(__GLXvisualConfig * pGlxVisual, - __GLXvisualConfig * configs, - int nconfigs); - -VisualID glxMatchVisualInConfigList(ScreenPtr pScreen, VisualPtr pVisual, - __GLXvisualConfig * configs, int nconfigs); - -VisualPtr glxMatchVisual(ScreenPtr pScreen, VisualPtr pVisual, - ScreenPtr pMatchScreen); - -#endif diff --git a/hw/dmx/glxProxy/meson.build b/hw/dmx/glxProxy/meson.build deleted file mode 100644 index bbb93f40a..000000000 --- a/hw/dmx/glxProxy/meson.build +++ /dev/null @@ -1,27 +0,0 @@ -srcs_dmx_glx = [ - 'compsize.c', - 'g_disptab.c', - 'global.c', - 'glxcmds.c', - 'glxcmdsswap.c', - 'glxext.c', - 'glxfbconfig.c', - 'glxscreens.c', - 'glxsingle.c', - 'glxswap.c', - 'glxvendor.c', - 'glxvisuals.c', - 'g_renderswap.c', - 'render2swap.c', - 'renderpixswap.c', -] - -dmx_glx = static_library('dmx_glx', - srcs_dmx_glx, - include_directories: [ - inc, - include_directories('../') - ], - dependencies: common_dep, - c_args: ['-DHAVE_DMX_CONFIG_H', glx_align64], -) diff --git a/hw/dmx/glxProxy/render2swap.c b/hw/dmx/glxProxy/render2swap.c deleted file mode 100644 index 146476c15..000000000 --- a/hw/dmx/glxProxy/render2swap.c +++ /dev/null @@ -1,283 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" -#include "unpack.h" -#include "g_disptab.h" - -static GLint -__glEvalComputeK(GLenum target) -{ - switch (target) { - case GL_MAP1_VERTEX_4: - case GL_MAP1_COLOR_4: - case GL_MAP1_TEXTURE_COORD_4: - case GL_MAP2_VERTEX_4: - case GL_MAP2_COLOR_4: - case GL_MAP2_TEXTURE_COORD_4: - return 4; - case GL_MAP1_VERTEX_3: - case GL_MAP1_TEXTURE_COORD_3: - case GL_MAP1_NORMAL: - case GL_MAP2_VERTEX_3: - case GL_MAP2_TEXTURE_COORD_3: - case GL_MAP2_NORMAL: - return 3; - case GL_MAP1_TEXTURE_COORD_2: - case GL_MAP2_TEXTURE_COORD_2: - return 2; - case GL_MAP1_TEXTURE_COORD_1: - case GL_MAP2_TEXTURE_COORD_1: - case GL_MAP1_INDEX: - case GL_MAP2_INDEX: - return 1; - default: - return 0; - } -} - -void -__glXDispSwap_Map1f(GLbyte * pc) -{ - GLint order, k; - GLfloat *points; - GLenum target; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - - target = *(GLenum *) (pc + 0); - order = *(GLint *) (pc + 12); - points = (GLfloat *) (pc + 16); - k = __glEvalComputeK(target); - - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } - else { - compsize = order * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - -} - -void -__glXDispSwap_Map2f(GLbyte * pc) -{ - GLint uorder, vorder, k; - GLfloat *points; - GLenum target; - GLint compsize; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 0); - __GLX_SWAP_INT(pc + 12); - __GLX_SWAP_INT(pc + 24); - __GLX_SWAP_FLOAT(pc + 4); - __GLX_SWAP_FLOAT(pc + 8); - __GLX_SWAP_FLOAT(pc + 16); - __GLX_SWAP_FLOAT(pc + 20); - - target = *(GLenum *) (pc + 0); - uorder = *(GLint *) (pc + 12); - vorder = *(GLint *) (pc + 24); - points = (GLfloat *) (pc + 28); - - k = __glEvalComputeK(target); - - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } - else { - compsize = uorder * vorder * k; - } - __GLX_SWAP_FLOAT_ARRAY(points, compsize); - -} - -void -__glXDispSwap_Map1d(GLbyte * pc) -{ - GLint order, k, compsize; - GLenum target; - GLdouble u1, u2; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_INT(pc + 16); - __GLX_SWAP_INT(pc + 20); - - target = *(GLenum *) (pc + 16); - order = *(GLint *) (pc + 20); - k = __glEvalComputeK(target); - if (order <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } - else { - compsize = order * k; - } - __GLX_GET_DOUBLE(u1, pc); - __GLX_GET_DOUBLE(u2, pc + 8); - __GLX_SWAP_DOUBLE_ARRAY(pc + 24, compsize); - pc += 24; - -#ifdef __GLX_ALIGN64 - if (((unsigned long) pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc - 4, pc, compsize * 8); - } -#endif -} - -void -__glXDispSwap_Map2d(GLbyte * pc) -{ - GLdouble u1, u2, v1, v2; - GLint uorder, vorder, k, compsize; - GLenum target; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_DOUBLE(pc + 0); - __GLX_SWAP_DOUBLE(pc + 8); - __GLX_SWAP_DOUBLE(pc + 16); - __GLX_SWAP_DOUBLE(pc + 24); - __GLX_SWAP_INT(pc + 32); - __GLX_SWAP_INT(pc + 36); - __GLX_SWAP_INT(pc + 40); - - target = *(GLenum *) (pc + 32); - uorder = *(GLint *) (pc + 36); - vorder = *(GLint *) (pc + 40); - k = __glEvalComputeK(target); - if (vorder <= 0 || uorder <= 0 || k < 0) { - /* Erroneous command. */ - compsize = 0; - } - else { - compsize = uorder * vorder * k; - } - __GLX_GET_DOUBLE(u1, pc); - __GLX_GET_DOUBLE(u2, pc + 8); - __GLX_GET_DOUBLE(v1, pc + 16); - __GLX_GET_DOUBLE(v2, pc + 24); - __GLX_SWAP_DOUBLE_ARRAY(pc + 44, compsize); - pc += 44; - -#ifdef __GLX_ALIGN64 - if (((unsigned long) pc) & 7) { - /* - ** Copy the doubles up 4 bytes, trashing the command but aligning - ** the data in the process - */ - __GLX_MEM_COPY(pc - 4, pc, compsize * 8); - } -#endif -} - -void -__glXDispSwap_CallLists(GLbyte * pc) -{ - GLenum type; - GLsizei n; - - __GLX_DECLARE_SWAP_VARIABLES; - __GLX_DECLARE_SWAP_ARRAY_VARIABLES; - - __GLX_SWAP_INT(pc + 4); - __GLX_SWAP_INT(pc + 0); - type = *(GLenum *) (pc + 4); - n = *(GLsizei *) (pc + 0); - - switch (type) { - case GL_BYTE: - case GL_UNSIGNED_BYTE: - case GL_2_BYTES: - case GL_3_BYTES: - case GL_4_BYTES: - break; - case GL_SHORT: - case GL_UNSIGNED_SHORT: - __GLX_SWAP_SHORT_ARRAY(pc + 8, n); - break; - case GL_INT: - case GL_UNSIGNED_INT: - __GLX_SWAP_INT_ARRAY(pc + 8, n); - break; - case GL_FLOAT: - __GLX_SWAP_FLOAT_ARRAY(pc + 8, n); - break; - } - -} - -void -__glXDispSwap_DrawArrays(GLbyte * pc) -{ - __GLXdispatchDrawArraysHeader *hdr = (__GLXdispatchDrawArraysHeader *) pc; - __GLXdispatchDrawArraysComponentHeader *compHeader; - int i; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT(&hdr->numVertexes); - __GLX_SWAP_INT(&hdr->numComponents); - __GLX_SWAP_INT(&hdr->primType); - - pc += sizeof(__GLXdispatchDrawArraysHeader); - compHeader = (__GLXdispatchDrawArraysComponentHeader *) pc; - - /* compute stride (same for all component arrays) */ - for (i = 0; i < hdr->numComponents; i++) { - __GLX_SWAP_INT(&compHeader[i].datatype); - __GLX_SWAP_INT(&compHeader[i].numVals); - __GLX_SWAP_INT(&compHeader[i].component); - - } - -} diff --git a/hw/dmx/glxProxy/renderpixswap.c b/hw/dmx/glxProxy/renderpixswap.c deleted file mode 100644 index 6557a8fc7..000000000 --- a/hw/dmx/glxProxy/renderpixswap.c +++ /dev/null @@ -1,403 +0,0 @@ -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#include "glxserver.h" -#include "unpack.h" -#include "g_disptab.h" - -void -__glXDispSwap_PolygonStipple(GLbyte * pc) -{ - __GLXpixelHeader *hdr = (__GLXpixelHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_Bitmap(GLbyte * pc) -{ - __GLXdispatchBitmapHeader *hdr = (__GLXdispatchBitmapHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_FLOAT((GLbyte *) &hdr->xorig); - __GLX_SWAP_FLOAT((GLbyte *) &hdr->yorig); - __GLX_SWAP_FLOAT((GLbyte *) &hdr->xmove); - __GLX_SWAP_FLOAT((GLbyte *) &hdr->ymove); - - hdr->swapBytes = !hdr->swapBytes; - -} - -void -__glXDispSwap_TexImage1D(GLbyte * pc) -{ - __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->level); - __GLX_SWAP_INT((GLbyte *) &hdr->components); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->border); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_TexImage2D(GLbyte * pc) -{ - __GLXdispatchTexImageHeader *hdr = (__GLXdispatchTexImageHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->level); - __GLX_SWAP_INT((GLbyte *) &hdr->components); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->border); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_TexImage3D(GLbyte * pc) -{ - __GLXdispatchTexImage3DHeader *hdr = (__GLXdispatchTexImage3DHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->imageHeight); - __GLX_SWAP_INT((GLbyte *) &hdr->imageDepth); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipImages); - __GLX_SWAP_INT((GLbyte *) &hdr->skipVolumes); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->level); - __GLX_SWAP_INT((GLbyte *) &hdr->internalformat); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->depth); - __GLX_SWAP_INT((GLbyte *) &hdr->size4d); - __GLX_SWAP_INT((GLbyte *) &hdr->border); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_DrawPixels(GLbyte * pc) -{ - __GLXdispatchDrawPixelsHeader *hdr = (__GLXdispatchDrawPixelsHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_TexSubImage1D(GLbyte * pc) -{ - __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->level); - __GLX_SWAP_INT((GLbyte *) &hdr->xoffset); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_TexSubImage2D(GLbyte * pc) -{ - __GLXdispatchTexSubImageHeader *hdr = (__GLXdispatchTexSubImageHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->level); - __GLX_SWAP_INT((GLbyte *) &hdr->xoffset); - __GLX_SWAP_INT((GLbyte *) &hdr->yoffset); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_TexSubImage3D(GLbyte * pc) -{ - __GLXdispatchTexSubImage3DHeader *hdr = - (__GLXdispatchTexSubImage3DHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->imageHeight); - __GLX_SWAP_INT((GLbyte *) &hdr->imageDepth); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipImages); - __GLX_SWAP_INT((GLbyte *) &hdr->skipVolumes); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->level); - __GLX_SWAP_INT((GLbyte *) &hdr->xoffset); - __GLX_SWAP_INT((GLbyte *) &hdr->yoffset); - __GLX_SWAP_INT((GLbyte *) &hdr->zoffset); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->depth); - __GLX_SWAP_INT((GLbyte *) &hdr->size4d); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_ColorTable(GLbyte * pc) -{ - __GLXdispatchColorTableHeader *hdr = (__GLXdispatchColorTableHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->internalformat); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_ColorSubTable(GLbyte * pc) -{ - __GLXdispatchColorSubTableHeader *hdr = - (__GLXdispatchColorSubTableHeader *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->start); - __GLX_SWAP_INT((GLbyte *) &hdr->count); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_ConvolutionFilter1D(GLbyte * pc) -{ - __GLXdispatchConvolutionFilterHeader *hdr = - (__GLXdispatchConvolutionFilterHeader *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->internalformat); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_ConvolutionFilter2D(GLbyte * pc) -{ - __GLXdispatchConvolutionFilterHeader *hdr = - (__GLXdispatchConvolutionFilterHeader *) pc; - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->internalformat); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} - -void -__glXDispSwap_SeparableFilter2D(GLbyte * pc) -{ - __GLXdispatchConvolutionFilterHeader *hdr = - (__GLXdispatchConvolutionFilterHeader *) pc; - - __GLX_DECLARE_SWAP_VARIABLES; - - __GLX_SWAP_INT((GLbyte *) &hdr->rowLength); - __GLX_SWAP_INT((GLbyte *) &hdr->skipRows); - __GLX_SWAP_INT((GLbyte *) &hdr->skipPixels); - __GLX_SWAP_INT((GLbyte *) &hdr->alignment); - - __GLX_SWAP_INT((GLbyte *) &hdr->target); - __GLX_SWAP_INT((GLbyte *) &hdr->internalformat); - __GLX_SWAP_INT((GLbyte *) &hdr->width); - __GLX_SWAP_INT((GLbyte *) &hdr->height); - __GLX_SWAP_INT((GLbyte *) &hdr->format); - __GLX_SWAP_INT((GLbyte *) &hdr->type); - - /* - ** Just invert swapBytes flag; the GL will figure out if it needs to swap - ** the pixel data. - */ - hdr->swapBytes = !hdr->swapBytes; -} diff --git a/hw/dmx/glxProxy/unpack.h b/hw/dmx/glxProxy/unpack.h deleted file mode 100644 index 45c27c6b9..000000000 --- a/hw/dmx/glxProxy/unpack.h +++ /dev/null @@ -1,223 +0,0 @@ -#ifndef __GLX_unpack_h__ -#define __GLX_unpack_h__ - -/* - * SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008) - * Copyright (C) 1991-2000 Silicon Graphics, Inc. All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice including the dates of first publication and - * either this permission notice or a reference to - * http://oss.sgi.com/projects/FreeB/ - * 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 - * SILICON GRAPHICS, INC. BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Silicon Graphics, Inc. - * shall not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization from - * Silicon Graphics, Inc. - */ - -#define __GLX_PAD(s) (((s)+3) & (GLuint)~3) - -/* -** Fetch the context-id out of a SingleReq request pointed to by pc. -*/ -#define __GLX_GET_SINGLE_CONTEXT_TAG(pc) (((xGLXSingleReq*)pc)->contextTag) -#define __GLX_GET_VENDPRIV_CONTEXT_TAG(pc) (((xGLXVendorPrivateReq*)pc)->contextTag) - -/* -** Fetch a double from potentially unaligned memory. -*/ -#ifdef __GLX_ALIGN64 -#define __GLX_MEM_COPY(dst,src,n) memmove(dst,src,n) -#define __GLX_GET_DOUBLE(dst,src) __GLX_MEM_COPY(&dst,src,8) -#else -#define __GLX_GET_DOUBLE(dst,src) (dst) = *((GLdouble*)(src)) -#endif - -extern void __glXMemInit(void); - -extern xGLXSingleReply __glXReply; - -#define __GLX_BEGIN_REPLY(size) \ - __glXReply.length = __GLX_PAD(size) >> 2; \ - __glXReply.type = X_Reply; \ - __glXReply.sequenceNumber = client->sequence; - -#define __GLX_SEND_HEADER() \ - WriteToClient (client, sz_xGLXSingleReply, &__glXReply); - -#define __GLX_PUT_RETVAL(a) \ - __glXReply.retval = (a); - -#define __GLX_PUT_SIZE(a) \ - __glXReply.size = (a); - -#define __GLX_PUT_RENDERMODE(m) \ - __glXReply.pad3 = (m) - -/* -** Get a buffer to hold returned data, with the given alignment. If we have -** to realloc, allocate size+align, in case the pointer has to be bumped for -** alignment. The answerBuffer should already be aligned. -** -** NOTE: the cast (long)res below assumes a long is large enough to hold a -** pointer. -*/ -#define __GLX_GET_ANSWER_BUFFER(res,cl,size,align) \ - if ((size) > sizeof(answerBuffer)) { \ - int bump; \ - if ((cl)->returnBufSize < (size)+(align)) { \ - (cl)->returnBuf = (GLbyte*)realloc((cl)->returnBuf, \ - (size)+(align)); \ - if (!(cl)->returnBuf) { \ - return BadAlloc; \ - } \ - (cl)->returnBufSize = (size)+(align); \ - } \ - res = (char*)cl->returnBuf; \ - bump = (long)(res) % (align); \ - if (bump) res += (align) - (bump); \ - } else { \ - res = (char *)answerBuffer; \ - } - -#define __GLX_PUT_BYTE() \ - *(GLbyte *)&__glXReply.pad3 = *(GLbyte *)answer - -#define __GLX_PUT_SHORT() \ - *(GLshort *)&__glXReply.pad3 = *(GLshort *)answer - -#define __GLX_PUT_INT() \ - *(GLint *)&__glXReply.pad3 = *(GLint *)answer - -#define __GLX_PUT_FLOAT() \ - *(GLfloat *)&__glXReply.pad3 = *(GLfloat *)answer - -#define __GLX_PUT_DOUBLE() \ - *(GLdouble *)&__glXReply.pad3 = *(GLdouble *)answer - -#define __GLX_SEND_BYTE_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT8), answer) - -#define __GLX_SEND_SHORT_ARRAY(len) \ - WriteToClient(client, __GLX_PAD((len)*__GLX_SIZE_INT16), answer) - -#define __GLX_SEND_INT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_INT32, answer) - -#define __GLX_SEND_FLOAT_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT32, answer) - -#define __GLX_SEND_DOUBLE_ARRAY(len) \ - WriteToClient(client, (len)*__GLX_SIZE_FLOAT64, answer) - -#define __GLX_SEND_VOID_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) -#define __GLX_SEND_UBYTE_ARRAY(len) __GLX_SEND_BYTE_ARRAY(len) -#define __GLX_SEND_USHORT_ARRAY(len) __GLX_SEND_SHORT_ARRAY(len) -#define __GLX_SEND_UINT_ARRAY(len) __GLX_SEND_INT_ARRAY(len) - -/* -** PERFORMANCE NOTE: -** Machine dependent optimizations abound here; these swapping macros can -** conceivably be replaced with routines that do the job faster. -*/ -#define __GLX_DECLARE_SWAP_VARIABLES \ - GLbyte sw - -#define __GLX_DECLARE_SWAP_ARRAY_VARIABLES \ - GLbyte *swapPC; \ - GLbyte *swapEnd - -#define __GLX_SWAP_INT(pc) \ - sw = ((GLbyte *)(pc))[0]; \ - ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ - ((GLbyte *)(pc))[3] = sw; \ - sw = ((GLbyte *)(pc))[1]; \ - ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ - ((GLbyte *)(pc))[2] = sw; - -#define __GLX_SWAP_SHORT(pc) \ - sw = ((GLbyte *)(pc))[0]; \ - ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[1]; \ - ((GLbyte *)(pc))[1] = sw; - -#define __GLX_SWAP_DOUBLE(pc) \ - sw = ((GLbyte *)(pc))[0]; \ - ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[7]; \ - ((GLbyte *)(pc))[7] = sw; \ - sw = ((GLbyte *)(pc))[1]; \ - ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[6]; \ - ((GLbyte *)(pc))[6] = sw; \ - sw = ((GLbyte *)(pc))[2]; \ - ((GLbyte *)(pc))[2] = ((GLbyte *)(pc))[5]; \ - ((GLbyte *)(pc))[5] = sw; \ - sw = ((GLbyte *)(pc))[3]; \ - ((GLbyte *)(pc))[3] = ((GLbyte *)(pc))[4]; \ - ((GLbyte *)(pc))[4] = sw; - -#define __GLX_SWAP_FLOAT(pc) \ - sw = ((GLbyte *)(pc))[0]; \ - ((GLbyte *)(pc))[0] = ((GLbyte *)(pc))[3]; \ - ((GLbyte *)(pc))[3] = sw; \ - sw = ((GLbyte *)(pc))[1]; \ - ((GLbyte *)(pc))[1] = ((GLbyte *)(pc))[2]; \ - ((GLbyte *)(pc))[2] = sw; - -#define __GLX_SWAP_INT_ARRAY(pc, count) \ - swapPC = ((GLbyte *)(pc)); \ - swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT32;\ - while (swapPC < swapEnd) { \ - __GLX_SWAP_INT(swapPC); \ - swapPC += __GLX_SIZE_INT32; \ - } - -#define __GLX_SWAP_SHORT_ARRAY(pc, count) \ - swapPC = ((GLbyte *)(pc)); \ - swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_INT16;\ - while (swapPC < swapEnd) { \ - __GLX_SWAP_SHORT(swapPC); \ - swapPC += __GLX_SIZE_INT16; \ - } - -#define __GLX_SWAP_DOUBLE_ARRAY(pc, count) \ - swapPC = ((GLbyte *)(pc)); \ - swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT64;\ - while (swapPC < swapEnd) { \ - __GLX_SWAP_DOUBLE(swapPC); \ - swapPC += __GLX_SIZE_FLOAT64; \ - } - -#define __GLX_SWAP_FLOAT_ARRAY(pc, count) \ - swapPC = ((GLbyte *)(pc)); \ - swapEnd = ((GLbyte *)(pc)) + (count)*__GLX_SIZE_FLOAT32;\ - while (swapPC < swapEnd) { \ - __GLX_SWAP_FLOAT(swapPC); \ - swapPC += __GLX_SIZE_FLOAT32; \ - } - -#define __GLX_SWAP_REPLY_HEADER() \ - __GLX_SWAP_SHORT(&__glXReply.sequenceNumber); \ - __GLX_SWAP_INT(&__glXReply.length); - -#define __GLX_SWAP_REPLY_RETVAL() \ - __GLX_SWAP_INT(&__glXReply.retval) - -#define __GLX_SWAP_REPLY_SIZE() \ - __GLX_SWAP_INT(&__glXReply.size) - -#endif /* !__GLX_unpack_h__ */ diff --git a/hw/dmx/input/ChkNotMaskEv.c b/hw/dmx/input/ChkNotMaskEv.c deleted file mode 100644 index 8411af8a7..000000000 --- a/hw/dmx/input/ChkNotMaskEv.c +++ /dev/null @@ -1,106 +0,0 @@ -/* - * Copyright 1985, 1987, 1998 The Open Group - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation. - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN - * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN - * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of The Open Group shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from The Open Group. - */ -/* $XFree86 */ - -/* - * Copyright 2002-2003 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. - */ - -/** \file - * This file provides a #XCheckNotMaskEvent function that is derived - * from the standard Xlib XCheckMaskEvent function. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "ChkNotMaskEv.h" - -extern long const _Xevent_to_mask[]; - -/** Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ -Bool -XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event) -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; prev = qelt, qelt = qelt->next) { - if (qelt->event.type >= LASTEvent - || !(_Xevent_to_mask[qelt->event.type] & mask)) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} diff --git a/hw/dmx/input/ChkNotMaskEv.h b/hw/dmx/input/ChkNotMaskEv.h deleted file mode 100644 index 78ad51f91..000000000 --- a/hw/dmx/input/ChkNotMaskEv.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for #XCheckNotMaskEvent function. \see ChkNotMaskEv.c */ - -#ifndef _CHKNOTMASKEV_H_ -#define _CHKNOTMASKEV_H_ -extern Bool XCheckNotMaskEvent(Display * dpy, long mask, XEvent * event); -#endif diff --git a/hw/dmx/input/Makefile.am b/hw/dmx/input/Makefile.am deleted file mode 100644 index 27f49d366..000000000 --- a/hw/dmx/input/Makefile.am +++ /dev/null @@ -1,56 +0,0 @@ -noinst_LIBRARIES = libdmxinput.a - -if DMX_BUILD_USB -USBSRCS = usb-keyboard.c \ - usb-keyboard.h \ - usb-mouse.c \ - usb-mouse.h \ - usb-other.c \ - usb-other.h \ - usb-common.c \ - usb-common.h \ - usb-private.h -endif - -DRVSRCS = dmxdummy.c \ - dmxdummy.h \ - dmxbackend.c \ - dmxbackend.h \ - dmxconsole.c \ - dmxconsole.h \ - dmxcommon.c \ - dmxcommon.h - -DMXSRCS = dmxinputinit.c \ - dmxinputinit.h \ - dmxarg.c \ - dmxarg.h \ - dmxevents.c \ - dmxevents.h \ - dmxxinput.c \ - dmxmotion.c \ - dmxmotion.h \ - dmxmap.c \ - dmxmap.h - - -libdmxinput_a_SOURCES = ChkNotMaskEv.c \ - ChkNotMaskEv.h \ - atKeynames.h \ - $(RAWSRCS) \ - $(USBSRCS) \ - $(DRVSRCS) \ - $(DMXSRCS) \ - $(LIBSRCS) - -if GLX -GLX_DEFS = @GL_CFLAGS@ -endif - -AM_CFLAGS = $(DIX_CFLAGS) \ - -I$(top_srcdir)/hw/dmx \ - -DHAVE_DMX_CONFIG_H \ - $(GLX_DEFS) \ - @DMXMODULES_CFLAGS@ - -EXTRA_DIST = dmxdetach.c diff --git a/hw/dmx/input/atKeynames.h b/hw/dmx/input/atKeynames.h deleted file mode 100644 index 4aabb4165..000000000 --- a/hw/dmx/input/atKeynames.h +++ /dev/null @@ -1,292 +0,0 @@ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* - * Copyright (c) 1994-2003 by The XFree86 Project, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of the copyright holder(s) - * and author(s) shall not be used in advertising or otherwise to promote - * the sale, use or other dealings in this Software without prior written - * authorization from the copyright holder(s) and author(s). - */ - -#ifndef _ATKEYNAMES_H -#define _ATKEYNAMES_H - -#define XK_TECHNICAL -#define XK_KATAKANA -#include <X11/keysym.h> -#include <X11/XF86keysym.h> - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 248 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) - -#define AltMask Mod1Mask -#define NumLockMask Mod2Mask -#define AltLangMask Mod3Mask -#define KanaMask Mod4Mask -#define ScrollLockMask Mod5Mask - -/* - * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) - * sets of scancodes. Set3 can only be generated by a MF keyboard. - * Set2 sends a makecode for keypress, and the same code prefixed by a - * F0 for keyrelease. This is a little bit ugly to handle. Thus we use - * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. - * Bit 7 is set if the key is released. The code E0 switches to a - * different meaning to add the new MF cursorkeys, while not breaking old - * applications. E1 is another special prefix. Since I assume that there - * will be further versions of PC/XT scancode compatible keyboards, we - * may be in trouble one day. - * - * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. - * 2) Use the keyboards native set and translate it to common keysyms. - */ - -/* - * definition of the AT84/MF101/MF102 Keyboard: - * ============================================================ - * Defined Key Cap Glyphs Pressed value - * Key Name Main Also (hex) (dec) - * ---------------- ---------- ------- ------ ------ - */ - -#define KEY_Escape /* Escape 0x01 */ 1 -#define KEY_1 /* 1 ! 0x02 */ 2 -#define KEY_2 /* 2 @ 0x03 */ 3 -#define KEY_3 /* 3 # 0x04 */ 4 -#define KEY_4 /* 4 $ 0x05 */ 5 -#define KEY_5 /* 5 % 0x06 */ 6 -#define KEY_6 /* 6 ^ 0x07 */ 7 -#define KEY_7 /* 7 & 0x08 */ 8 -#define KEY_8 /* 8 * 0x09 */ 9 -#define KEY_9 /* 9 ( 0x0a */ 10 -#define KEY_0 /* 0 ) 0x0b */ 11 -#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 -#define KEY_Equal /* = (Equal) + 0x0d */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 14 -#define KEY_Tab /* Tab 0x0f */ 15 -#define KEY_Q /* Q 0x10 */ 16 -#define KEY_W /* W 0x11 */ 17 -#define KEY_E /* E 0x12 */ 18 -#define KEY_R /* R 0x13 */ 19 -#define KEY_T /* T 0x14 */ 20 -#define KEY_Y /* Y 0x15 */ 21 -#define KEY_U /* U 0x16 */ 22 -#define KEY_I /* I 0x17 */ 23 -#define KEY_O /* O 0x18 */ 24 -#define KEY_P /* P 0x19 */ 25 -#define KEY_LBrace /* [ { 0x1a */ 26 -#define KEY_RBrace /* ] } 0x1b */ 27 -#define KEY_Enter /* Enter 0x1c */ 28 -#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 -#define KEY_A /* A 0x1e */ 30 -#define KEY_S /* S 0x1f */ 31 -#define KEY_D /* D 0x20 */ 32 -#define KEY_F /* F 0x21 */ 33 -#define KEY_G /* G 0x22 */ 34 -#define KEY_H /* H 0x23 */ 35 -#define KEY_J /* J 0x24 */ 36 -#define KEY_K /* K 0x25 */ 37 -#define KEY_L /* L 0x26 */ 38 -#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 -#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 -#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 -#define KEY_ShiftL /* Shift(left) 0x2a */ 42 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 -#define KEY_Z /* Z 0x2c */ 44 -#define KEY_X /* X 0x2d */ 45 -#define KEY_C /* C 0x2e */ 46 -#define KEY_V /* V 0x2f */ 47 -#define KEY_B /* B 0x30 */ 48 -#define KEY_N /* N 0x31 */ 49 -#define KEY_M /* M 0x32 */ 50 -#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 -#define KEY_Period /* . (Period) >(Greater)0x34 */ 52 -#define KEY_Slash /* / (Slash) ? 0x35 */ 53 -#define KEY_ShiftR /* Shift(right) 0x36 */ 54 -#define KEY_KP_Multiply /* * 0x37 */ 55 -#define KEY_Alt /* Alt(left) 0x38 */ 56 -#define KEY_Space /* (SpaceBar) 0x39 */ 57 -#define KEY_CapsLock /* CapsLock 0x3a */ 58 -#define KEY_F1 /* F1 0x3b */ 59 -#define KEY_F2 /* F2 0x3c */ 60 -#define KEY_F3 /* F3 0x3d */ 61 -#define KEY_F4 /* F4 0x3e */ 62 -#define KEY_F5 /* F5 0x3f */ 63 -#define KEY_F6 /* F6 0x40 */ 64 -#define KEY_F7 /* F7 0x41 */ 65 -#define KEY_F8 /* F8 0x42 */ 66 -#define KEY_F9 /* F9 0x43 */ 67 -#define KEY_F10 /* F10 0x44 */ 68 -#define KEY_NumLock /* NumLock 0x45 */ 69 -#define KEY_ScrollLock /* ScrollLock 0x46 */ 70 -#define KEY_KP_7 /* 7 Home 0x47 */ 71 -#define KEY_KP_8 /* 8 Up 0x48 */ 72 -#define KEY_KP_9 /* 9 PgUp 0x49 */ 73 -#define KEY_KP_Minus /* - (Minus) 0x4a */ 74 -#define KEY_KP_4 /* 4 Left 0x4b */ 75 -#define KEY_KP_5 /* 5 0x4c */ 76 -#define KEY_KP_6 /* 6 Right 0x4d */ 77 -#define KEY_KP_Plus /* + (Plus) 0x4e */ 78 -#define KEY_KP_1 /* 1 End 0x4f */ 79 -#define KEY_KP_2 /* 2 Down 0x50 */ 80 -#define KEY_KP_3 /* 3 PgDown 0x51 */ 81 -#define KEY_KP_0 /* 0 Insert 0x52 */ 82 -#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 -#define KEY_SysReqest /* SysReqest 0x54 */ 84 - /* NOTUSED 0x55 */ -#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 -#define KEY_F11 /* F11 0x57 */ 87 -#define KEY_F12 /* F12 0x58 */ 88 - -#define KEY_Prefix0 /* special 0x60 */ 96 -#define KEY_Prefix1 /* special 0x61 */ 97 - -/* - * The 'scancodes' below are generated by the server, because the MF101/102 - * keyboard sends them as sequence of other scancodes - */ -#define KEY_Home /* Home 0x59 */ 89 -#define KEY_Up /* Up 0x5a */ 90 -#define KEY_PgUp /* PgUp 0x5b */ 91 -#define KEY_Left /* Left 0x5c */ 92 -#define KEY_Begin /* Begin 0x5d */ 93 -#define KEY_Right /* Right 0x5e */ 94 -#define KEY_End /* End 0x5f */ 95 -#define KEY_Down /* Down 0x60 */ 96 -#define KEY_PgDown /* PgDown 0x61 */ 97 -#define KEY_Insert /* Insert 0x62 */ 98 -#define KEY_Delete /* Delete 0x63 */ 99 -#define KEY_KP_Enter /* Enter 0x64 */ 100 -#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 -#define KEY_Pause /* Pause 0x66 */ 102 -#define KEY_Print /* Print 0x67 */ 103 -#define KEY_KP_Divide /* Divide 0x68 */ 104 -#define KEY_AltLang /* AtlLang(right) 0x69 */ 105 -#define KEY_Break /* Break 0x6a */ 106 -#define KEY_LMeta /* Left Meta 0x6b */ 107 -#define KEY_RMeta /* Right Meta 0x6c */ 108 -#define KEY_Menu /* Menu 0x6d */ 109 -#define KEY_F13 /* F13 0x6e */ 110 -#define KEY_F14 /* F14 0x6f */ 111 -#define KEY_F15 /* F15 0x70 */ 112 -#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112 -#define KEY_F16 /* F16 0x71 */ 113 -#define KEY_F17 /* F17 0x72 */ 114 -#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 -#define KEY_BSlash2 /* \ _ 0x73 */ 115 -#define KEY_KP_Equal /* Equal (Keypad) 0x76 */ 118 -#define KEY_XFER /* Kanji Transfer 0x79 */ 121 -#define KEY_NFER /* No Kanji Transfer 0x7b */ 123 -#define KEY_Yen /* Yen 0x7d */ 125 - -#define KEY_Power /* Power Key 0x84 */ 132 -#define KEY_Mute /* Audio Mute 0x85 */ 133 -#define KEY_AudioLower /* Audio Lower 0x86 */ 134 -#define KEY_AudioRaise /* Audio Raise 0x87 */ 135 -#define KEY_Help /* Help 0x88 */ 136 -#define KEY_L1 /* Stop 0x89 */ 137 -#define KEY_L2 /* Again 0x8a */ 138 -#define KEY_L3 /* Props 0x8b */ 139 -#define KEY_L4 /* Undo 0x8c */ 140 -#define KEY_L5 /* Front 0x8d */ 141 -#define KEY_L6 /* Copy 0x8e */ 142 -#define KEY_L7 /* Open 0x8f */ 143 -#define KEY_L8 /* Paste 0x90 */ 144 -#define KEY_L9 /* Find 0x91 */ 145 -#define KEY_L10 /* Cut 0x92 */ 146 - -/* - * Fake 'scancodes' in the following ranges are generated for 2-byte - * codes not handled elsewhere. These correspond to most extended keys - * on so-called "Internet" keyboards: - * - * 0x79-0x93 - * 0x96-0xa1 - * 0xa3-0xac - * 0xb1-0xb4 - * 0xba-0xbd - * 0xc2 - * 0xcc-0xd2 - * 0xd6-0xf7 - */ - -/* - * Remapped 'scancodes' are generated for single-byte codes in the range - * 0x59-0x5f,0x62-0x76. These are used for some extra keys on some keyboards. - */ - -#define KEY_0x59 0x95 -#define KEY_0x5A 0xA2 -#define KEY_0x5B 0xAD -#define KEY_0x5C KEY_KP_EQUAL -#define KEY_0x5D 0xAE -#define KEY_0x5E 0xAF -#define KEY_0x5F 0xB0 -#define KEY_0x62 0xB5 -#define KEY_0x63 0xB6 -#define KEY_0x64 0xB7 -#define KEY_0x65 0xB8 -#define KEY_0x66 0xB9 -#define KEY_0x67 0xBE -#define KEY_0x68 0xBF -#define KEY_0x69 0xC0 -#define KEY_0x6A 0xC1 -#define KEY_0x6B 0xC3 -#define KEY_0x6C 0xC4 -#define KEY_0x6D 0xC5 -#define KEY_0x6E 0xC6 -#define KEY_0x6F 0xC7 -#define KEY_0x70 0xC8 -#define KEY_0x71 0xC9 -#define KEY_0x72 0xCA -#define KEY_0x73 0xCB -#define KEY_0x74 0xD3 -#define KEY_0x75 0xD4 -#define KEY_0x76 0xD5 - -/* These are for "notused" and "unknown" entries in translation maps. */ -#define KEY_NOTUSED 0 -#define KEY_UNKNOWN 255 - -#endif /* _ATKEYNAMES_H */ diff --git a/hw/dmx/input/dmxarg.c b/hw/dmx/input/dmxarg.c deleted file mode 100644 index 582ed3faa..000000000 --- a/hw/dmx/input/dmxarg.c +++ /dev/null @@ -1,177 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Generic comma-delimited argument processing. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_ARG_TEST 0 - -#include "dmx.h" -#include "dmxarg.h" -#include <stdio.h> -#include <string.h> - -#if DMX_ARG_TEST -#include <stdlib.h> -#endif - -/** Stores the parsed argument list. */ -struct _dmxArg { - int argc; /**< Number of arguments in argv */ - int argm; /**< Maximum number of arguments store-able in argv */ - const char **argv; /**< Arguments */ -}; - -/** Create an (externally opaque) \a dmxArg object. */ -dmxArg -dmxArgCreate(void) -{ - dmxArg a = malloc(sizeof(*a)); - - a->argc = 0; - a->argm = 2; - a->argv = malloc(a->argm * sizeof(*a->argv)); - a->argv[0] = NULL; - return a; -} - -/** Free the specified \a dmxArg object. */ -void -dmxArgFree(dmxArg a) -{ - int i; - - for (i = 0; i < a->argc; i++) - free((char *) a->argv[i]); - free(a->argv); - free(a); -} - -/** Add the \a string as the next argument in the \a dmxArg object. */ -void -dmxArgAdd(dmxArg a, const char *string) -{ - if (a->argm <= a->argc + 2) - a->argv = reallocarray(a->argv, (a->argm *= 2), sizeof(*a->argv)); - a->argv[a->argc++] = strdup(string); - a->argv[a->argc] = NULL; -} - -/** Return the argument number \a item in the \a dmxArg object. - * Arguments are 0 based. NULL will be returned for values less than 0 - * or equal to or greater than the number of arguments in the object. */ -const char * -dmxArgV(dmxArg a, int item) -{ - if (item < 0 || item >= a->argc) - return NULL; - return a->argv[item]; -} - -/** Return the number of arguments in the \a dmxArg object. */ -int -dmxArgC(dmxArg a) -{ - return a->argc; -} - -/** Parse a string into arguments delimited by commas. Return a new \a - * dmxArg object containing the arguments. */ -dmxArg -dmxArgParse(const char *string) -{ - int i = 0; - dmxArg a = dmxArgCreate(); - - if (!string) - return a; - - a->argv = (const char **)xstrtokenize(string, ","); - if (a->argv) - for (i = 0; a->argv[i] != NULL; i++); - a->argc = i; - - return a; -} - -#if DMX_ARG_TEST -static void -dmxArgPrint(dmxArg a) -{ - int i; - - printf(" argc = %d\n", dmxArgC(a)); - for (i = 0; i < dmxArgC(a); i++) - printf(" argv[%d] = \"%s\"\n", i, dmxArgV(a, i)); -} - -static void -dmxArgTest(const char *string) -{ - dmxArg a; - - if (!string) - printf("Testing NULL\n"); - else if (!strlen(string)) - printf("Testing (empty)\n"); - else - printf("Testing \"%s\"\n", string); - - a = dmxArgParse(string); - dmxArgPrint(a); - dmxArgFree(a); -} - -int -main(void) -{ - dmxArgTest(NULL); - dmxArgTest(""); - dmxArgTest(","); - - dmxArgTest("a"); - dmxArgTest("a,"); - dmxArgTest(",a"); - - dmxArgTest("a,b"); - dmxArgTest("a,b,"); - dmxArgTest("a,b,,"); - dmxArgTest("a,b,,c"); - - return 0; -} -#endif diff --git a/hw/dmx/input/dmxarg.h b/hw/dmx/input/dmxarg.h deleted file mode 100644 index acd8805b6..000000000 --- a/hw/dmx/input/dmxarg.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to argument handling functions. \see dmxarg.c */ - -#ifndef _DMXARG_H_ -#define _DMXARG_H_ - -typedef struct _dmxArg *dmxArg; - -extern dmxArg dmxArgCreate(void); -extern void dmxArgFree(dmxArg a); -extern void dmxArgAdd(dmxArg a, const char *string); -extern const char *dmxArgV(dmxArg a, int item); -extern int dmxArgC(dmxArg a); -extern dmxArg dmxArgParse(const char *string); - -#endif diff --git a/hw/dmx/input/dmxbackend.c b/hw/dmx/input/dmxbackend.c deleted file mode 100644 index 1c51776e7..000000000 --- a/hw/dmx/input/dmxbackend.c +++ /dev/null @@ -1,661 +0,0 @@ -/* - * Copyright 2001-2003 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * These routines support taking input from devices on the backend - * (output) displays. \see dmxcommon.c. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_BACKEND_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxbackend.h" -#include "dmxcommon.h" -#include "dmxconsole.h" -#include "dmxcursor.h" -#include "dmxprop.h" -#include "dmxsync.h" -#include "dmxcb.h" /* For dmxGlobalWidth and dmxGlobalHeight */ -#include "dmxevents.h" /* For dmxGetGlobalPosition */ -#include "ChkNotMaskEv.h" - -#include "inputstr.h" -#include "input.h" -#include <X11/keysym.h> -#include "mipointer.h" -#include "scrnintstr.h" -#include "windowstr.h" - -/* Private area for backend devices. */ -typedef struct _myPrivate { - DMX_COMMON_PRIVATE; - int myScreen; - DMXScreenInfo *grabbedScreen; - - int lastX, lastY; - int centerX, centerY; - int relative; - int newscreen; - int initialized; - DevicePtr mou, kbd; - int entered; - int offX, offY; -} myPrivate; - -#if DMX_BACKEND_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#define DMXDBG8(f,a,b,c,d,e,g,h,i) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i) -#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) dmxLog(dmxDebug,f,a,b,c,d,e,g,h,i,j) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#define DMXDBG8(f,a,b,c,d,e,g,h,i) -#define DMXDBG9(f,a,b,c,d,e,g,h,i,j) -#endif - -/** Create and return a private data structure. */ -void * -dmxBackendCreatePrivate(DeviceIntPtr pDevice) -{ - GETDMXLOCALFROMPDEVICE; - myPrivate *priv = calloc(1, sizeof(*priv)); - - priv->dmxLocal = dmxLocal; - return priv; -} - -/** Destroy the private data structure. No checking is performed to - * verify that the structure was actually created by - * #dmxBackendCreatePrivate. */ -void -dmxBackendDestroyPrivate(void *private) -{ - free(private); -} - -static void * -dmxBackendTestScreen(DMXScreenInfo * dmxScreen, void *closure) -{ - long target = (long) closure; - - if (dmxScreen->index == target) - return dmxScreen; - return NULL; -} - -/* Return non-zero if screen and priv->myScreen are on the same physical - * backend display (1 if they are the same screen, 2 if they are - * different screens). Since this is a common operation, the results - * are cached. The cache is invalidated if \a priv is NULL (this should - * be done with each server generation and reconfiguration). */ -static int -dmxBackendSameDisplay(myPrivate * priv, long screen) -{ - static myPrivate *oldpriv = NULL; - static int oldscreen = -1; - static int retcode = 0; - - if (priv == oldpriv && screen == oldscreen) - return retcode; - if (!priv) { /* Invalidate cache */ - oldpriv = NULL; - oldscreen = -1; - retcode = 0; - return 0; - } - - if (screen == priv->myScreen) - retcode = 1; - else if (screen < 0 || screen >= dmxNumScreens) - retcode = 0; - else if (dmxPropertyIterate(priv->be, - dmxBackendTestScreen, (void *) screen)) - retcode = 2; - else - retcode = 0; - - oldpriv = priv; - oldscreen = screen; - return retcode; -} - -static void * -dmxBackendTestEvents(DMXScreenInfo * dmxScreen, void *closure) -{ - XEvent *X = (XEvent *) closure; - - if (XCheckNotMaskEvent(dmxScreen->beDisplay, ExposureMask, X)) - return dmxScreen; - return NULL; -} - -static void * -dmxBackendTestMotionEvent(DMXScreenInfo * dmxScreen, void *closure) -{ - XEvent *X = (XEvent *) closure; - - if (XCheckTypedEvent(dmxScreen->beDisplay, MotionNotify, X)) - return dmxScreen; - return NULL; -} - -static DMXScreenInfo * -dmxBackendGetEvent(myPrivate * priv, XEvent * X) -{ - DMXScreenInfo *dmxScreen; - - if ((dmxScreen = dmxPropertyIterate(priv->be, dmxBackendTestEvents, X))) - return dmxScreen; - return NULL; -} - -static DMXScreenInfo * -dmxBackendPendingMotionEvent(myPrivate * priv, int save) -{ - DMXScreenInfo *dmxScreen; - XEvent N; - - if ((dmxScreen = dmxPropertyIterate(priv->be, - dmxBackendTestMotionEvent, &N))) { - if (save) - XPutBackEvent(dmxScreen->beDisplay, &N); - return dmxScreen; - } - return NULL; -} - -static void * -dmxBackendTestWindow(DMXScreenInfo * dmxScreen, void *closure) -{ - Window win = (Window) (long) closure; - - if (dmxScreen->scrnWin == win) - return dmxScreen; - return NULL; -} - -static DMXScreenInfo * -dmxBackendFindWindow(myPrivate * priv, Window win) -{ - return dmxPropertyIterate(priv->be, dmxBackendTestWindow, - (void *) (long) win); -} - -/* If the cursor is over a set of overlapping screens and one of those - * screens takes backend input, then we want that particular screen to - * be current, not one of the other ones. */ -static int -dmxBackendFindOverlapping(myPrivate * priv, int screen, int x, int y) -{ - DMXScreenInfo *start = &dmxScreens[screen]; - DMXScreenInfo *pt; - - if (!start->over) - return screen; - - for (pt = start->over; /* condition at end of loop */ ; pt = pt->over) { - if (pt->index == priv->myScreen - && dmxOnScreen(x, y, &dmxScreens[pt->index])) - return pt->index; - if (pt == start) - break; - } - return screen; -} - -/* Return non-zero if \a x and \a y are off \a screen. */ -static int -dmxBackendOffscreen(int screen, int x, int y) -{ - DMXScreenInfo *dmxScreen = &dmxScreens[screen]; - - return (!dmxOnScreen(x, y, dmxScreen)); -} - -/** This routine is called from #dmxCoreMotion for each motion - * event. \a x and \a y are global coordinants. */ -void -dmxBackendUpdatePosition(void *private, int x, int y) -{ - GETPRIVFROMPRIVATE; - int screen = miPointerGetScreen(inputInfo.pointer)->myNum; - DMXScreenInfo *dmxScreen = &dmxScreens[priv->myScreen]; - int oldRelative = priv->relative; - int topscreen = dmxBackendFindOverlapping(priv, screen, x, y); - int same = dmxBackendSameDisplay(priv, topscreen); - int offscreen = dmxBackendOffscreen(priv->myScreen, x, y); - int offthis = dmxBackendOffscreen(screen, x, y); - - DMXDBG9("dmxBackendUpdatePosition(%d,%d) my=%d mi=%d rel=%d" - " topscreen=%d same=%d offscreen=%d offthis=%d\n", - x, y, priv->myScreen, screen, priv->relative, - topscreen, same, offscreen, offthis); - - if (offscreen) { - /* If the cursor is off the input screen, it should be moving - * relative unless it is visible on a screen of the same display - * (i.e., one that shares the mouse). */ - if (same == 2 && !offthis) { - if (priv->relative) { - DMXDBG0(" Off screen, but not absolute\n"); - priv->relative = 0; - } - } - else { - if (!priv->relative) { - DMXDBG0(" Off screen, but not relative\n"); - priv->relative = 1; - } - } - } - else { - if (topscreen != screen) { - DMXDBG2(" Using screen %d instead of %d (from mi)\n", - topscreen, screen); - } - if (same) { - if (priv->relative) { - DMXDBG0(" On screen, but not absolute\n"); - priv->relative = 0; - } - } - else { - if (!priv->relative) { - DMXDBG0(" Not on screen, but not relative\n"); - priv->relative = 1; - } - } - } - - if (oldRelative != priv->relative) { - DMXDBG2(" Do switch, relative=%d same=%d\n", priv->relative, same); - /* Discard all pre-switch events */ - dmxSync(dmxScreen, TRUE); - while (dmxBackendPendingMotionEvent(priv, FALSE)); - - if (dmxInput->console && offscreen) { - /* Our special case is a console window and a backend window - * share a display. In this case, the cursor is either on - * the backend window (taking absolute input), or not (in - * which case the cursor needs to be in the console - * window). */ - if (priv->grabbedScreen) { - DMXDBG2(" *** force ungrab on %s, display=%p\n", - priv->grabbedScreen->name, - priv->grabbedScreen->beDisplay); - XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); - dmxSync(priv->grabbedScreen, TRUE); - priv->grabbedScreen = NULL; - } - DMXDBG0(" Capturing console\n"); - dmxConsoleCapture(dmxInput); - } - else { - priv->newscreen = 1; - if (priv->relative && !dmxInput->console) { - DMXDBG5(" Hide cursor; warp from %d,%d to %d,%d on %d\n", - priv->lastX, priv->lastY, priv->centerX, priv->centerY, - priv->myScreen); - dmxConsoleUncapture(dmxInput); - dmxHideCursor(dmxScreen); - priv->lastX = priv->centerX; - priv->lastY = priv->centerY; - XWarpPointer(priv->display, None, priv->window, - 0, 0, 0, 0, priv->lastX, priv->lastY); - dmxSync(dmxScreen, TRUE); - } - else { - DMXDBG0(" Check cursor\n"); - dmxCheckCursor(); - } - } - } -} - -/** Get events from the X queue on the backend servers and put the - * events into the DMX event queue. */ -void -dmxBackendCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - XEvent X; - DMXScreenInfo *dmxScreen; - int left = 0; - int entered = priv->entered; - int ignoreLeave = 0; - int v[2]; - int retcode; - - while ((dmxScreen = dmxBackendGetEvent(priv, &X))) { - switch (X.type) { - case EnterNotify: - dmxCommonSaveState(priv); - if (entered++) - continue; - priv->entered = 1; - ignoreLeave = 1; - DMXDBG5("dmxBackendCollectEvents: Enter %lu %d,%d; GRAB %s %p\n", - X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, - dmxScreen->name, dmxScreen->beDisplay); - XRaiseWindow(dmxScreen->beDisplay, dmxScreen->scrnWin); - priv->grabbedScreen = dmxScreen; - if ((retcode = XGrabPointer(dmxScreen->beDisplay, - dmxScreen->scrnWin, - True, 0, GrabModeAsync, - GrabModeAsync, None, None, - CurrentTime))) { - dmxLog(dmxError, - "XGrabPointer failed during backend enter (%d)\n", - retcode); - } - break; - case LeaveNotify: - if (ignoreLeave) { - ignoreLeave = 0; - continue; - } - dmxCommonRestoreState(priv); - if (left++) - continue; - DMXDBG7("dmxBackendCollectEvents: Leave %lu %d,%d %d %d %s %s\n", - X.xcrossing.root, X.xcrossing.x, X.xcrossing.y, - X.xcrossing.detail, X.xcrossing.focus, - priv->grabbedScreen ? "UNGRAB" : "", dmxScreen->name); - if (priv->grabbedScreen) { - XUngrabPointer(priv->grabbedScreen->beDisplay, CurrentTime); - dmxSync(priv->grabbedScreen, TRUE); - priv->grabbedScreen = NULL; - } - break; - case MotionNotify: - DMXDBG8("dmxBackendCollectEvents: MotionNotify %d/%d" - " newscreen=%d: %d %d (e=%d; last=%d,%d)\n", - dmxScreen->index, priv->myScreen, - priv->newscreen, - X.xmotion.x, X.xmotion.y, - entered, priv->lastX, priv->lastY); - if (dmxBackendPendingMotionEvent(priv, TRUE)) - continue; - if (!(dmxScreen = dmxBackendFindWindow(priv, X.xmotion.window))) - dmxLog(dmxFatal, - " Event on non-existent window %lu\n", - X.xmotion.window); - if (!priv->relative || dmxInput->console) { - int newX = X.xmotion.x - dmxScreen->rootX; - int newY = X.xmotion.y - dmxScreen->rootY; - - if (!priv->newscreen) { - int width = dmxScreen->rootWidth; - int height = dmxScreen->rootHeight; - - if (!newX) - newX = -1; - if (newX == width - 1) - newX = width; - if (!newY) - newY = -1; - if (newY == height - 1) - newY = height; - } - priv->newscreen = 0; - v[0] = dmxScreen->rootXOrigin + newX; - v[1] = dmxScreen->rootYOrigin + newY; - DMXDBG8(" Absolute move: %d,%d (r=%dx%d+%d+%d s=%dx%d)\n", - v[0], v[1], - priv->be->rootWidth, priv->be->rootHeight, - priv->be->rootX, priv->be->rootY, - priv->be->scrnWidth, priv->be->scrnHeight); - motion(priv->mou, v, 0, 2, DMX_ABSOLUTE, block); - priv->entered = 0; - } - else { - int newX = priv->lastX - X.xmotion.x; - int newY = priv->lastY - X.xmotion.y; - - priv->lastX = X.xmotion.x; - priv->lastY = X.xmotion.y; - v[0] = newX; - v[1] = newY; - DMXDBG2(" Relative move: %d, %d\n", v[0], v[1]); - motion(priv->mou, v, 0, 2, DMX_RELATIVE, block); - } - if (entered && priv->relative) { - DMXDBG4(" **** Relative %d %d instead of absolute %d %d\n", - v[0], v[1], - (dmxScreen->rootXOrigin + X.xmotion.x - - dmxScreen->rootX), - (dmxScreen->rootYOrigin + X.xmotion.y - - dmxScreen->rootY)); - } - break; - - case KeyPress: - case KeyRelease: - enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); - break; - case ButtonPress: - case ButtonRelease: - /* fall-through */ - default: - /* Pass the whole event here, because - * this may be an extension event. */ - enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); - break; - } - } -} - -/** Called after input events are processed from the DMX queue. No - * event processing actually takes place here, but this is a convenient - * place to update the pointer. */ -void -dmxBackendProcessInput(void *private) -{ - GETPRIVFROMPRIVATE; - - DMXDBG6("dmxBackendProcessInput: myScreen=%d relative=%d" - " last=%d,%d center=%d,%d\n", - priv->myScreen, priv->relative, - priv->lastX, priv->lastY, priv->centerX, priv->centerY); - - if (priv->relative - && !dmxInput->console - && (priv->lastX != priv->centerX || priv->lastY != priv->centerY)) { - DMXDBG4(" warping pointer from last=%d,%d to center=%d,%d\n", - priv->lastX, priv->lastY, priv->centerX, priv->centerY); - priv->lastX = priv->centerX; - priv->lastY = priv->centerY; - XWarpPointer(priv->display, None, priv->window, - 0, 0, 0, 0, priv->lastX, priv->lastY); - dmxSync(&dmxScreens[priv->myScreen], TRUE); - } -} - -static void -dmxBackendComputeCenter(myPrivate * priv) -{ - int centerX; - int centerY; - - centerX = priv->be->rootWidth / 2 + priv->be->rootX; - centerY = priv->be->rootHeight / 2 + priv->be->rootY; - - if (centerX > priv->be->rootWidth) - centerX = priv->be->rootWidth - 1; - if (centerY > priv->be->rootHeight) - centerY = priv->be->rootHeight - 1; - if (centerX < 1) - centerX = 1; - if (centerY < 1) - centerY = 1; - - priv->centerX = centerX; - priv->centerY = centerY; -} - -static DMXScreenInfo * -dmxBackendInitPrivate(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - DMXScreenInfo *dmxScreen; - int i; - - /* Fill in myPrivate */ - for (i = 0, dmxScreen = &dmxScreens[0]; i < dmxNumScreens; i++, dmxScreen++) { - if (dmxPropertySameDisplay(dmxScreen, dmxInput->name)) { - priv->display = dmxScreen->beDisplay; - priv->window = dmxScreen->scrnWin; - priv->be = dmxScreen; - break; - } - } - - if (i >= dmxNumScreens) - dmxLog(dmxFatal, - "%s is not an existing backend display - cannot initialize\n", - dmxInput->name); - - return dmxScreen; -} - -/** Re-initialized the backend device described by \a pDev (after a - * reconfig). */ -void -dmxBackendLateReInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - int x, y; - - dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ - dmxBackendInitPrivate(pDev); - dmxBackendComputeCenter(priv); - dmxGetGlobalPosition(&x, &y); - dmxInvalidateGlobalPosition(); /* To force event processing */ - dmxBackendUpdatePosition(priv, x, y); -} - -/** Initialized the backend device described by \a pDev. */ -void -dmxBackendInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - DMXScreenInfo *dmxScreen; - - dmxBackendSameDisplay(NULL, 0); /* Invalidate cache */ - - if (dmxLocal->type == DMX_LOCAL_MOUSE) - priv->mou = pDev; - if (dmxLocal->type == DMX_LOCAL_KEYBOARD) - priv->kbd = pDev; - if (priv->initialized++) - return; /* Only do once for mouse/keyboard pair */ - - dmxScreen = dmxBackendInitPrivate(pDev); - - /* Finish initialization using computed values or constants. */ - dmxBackendComputeCenter(priv); - priv->eventMask = (EnterWindowMask | LeaveWindowMask); - priv->myScreen = dmxScreen->index; - priv->lastX = priv->centerX; - priv->lastY = priv->centerY; - priv->relative = 0; - priv->newscreen = 0; -} - -/** Get information about the backend pointer (for initialization). */ -void -dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - const DMXScreenInfo *dmxScreen = dmxBackendInitPrivate(pDev); - - info->buttonClass = 1; - dmxCommonMouGetMap(pDev, info->map, &info->numButtons); - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->minval[1] = 0; - info->maxval[0] = dmxScreen->beWidth; - info->maxval[1] = dmxScreen->beHeight; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; -} - -/** Get information about the backend keyboard (for initialization). */ -void -dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - dmxCommonKbdGetInfo(pDev, info); - info->keyboard = 1; - info->keyClass = 1; - dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); - info->freemap = 1; - info->focusClass = 1; - info->kbdFeedbackClass = 1; -} - -/** Process #DMXFunctionType functions. The only function handled here - * is to acknowledge a pending server shutdown. */ -int -dmxBackendFunctions(void *private, DMXFunctionType function) -{ - switch (function) { - case DMX_FUNCTION_TERMINATE: - return 1; - default: - return 0; - } -} diff --git a/hw/dmx/input/dmxbackend.h b/hw/dmx/input/dmxbackend.h deleted file mode 100644 index a60857369..000000000 --- a/hw/dmx/input/dmxbackend.h +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to backend input device support. \see dmxbackend.c \see - * dmxcommon.c */ - -#ifndef _DMXBACKEND_H_ -#define _DMXBACKEND_H_ - -extern void *dmxBackendCreatePrivate(DeviceIntPtr pDevice); -extern void dmxBackendDestroyPrivate(void *private); -extern void dmxBackendInit(DevicePtr pDev); -extern void dmxBackendLateReInit(DevicePtr pDev); -extern void dmxBackendMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxBackendKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxBackendCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, - DMXBlockType block); -extern void dmxBackendProcessInput(void *private); -extern int dmxBackendFunctions(void *private, DMXFunctionType function); -extern void dmxBackendUpdatePosition(void *private, int x, int y); - -#endif diff --git a/hw/dmx/input/dmxcommon.c b/hw/dmx/input/dmxcommon.c deleted file mode 100644 index c7aed68b7..000000000 --- a/hw/dmx/input/dmxcommon.c +++ /dev/null @@ -1,702 +0,0 @@ -/* - * Copyright 2001-2003 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * - * This file implements common routines used by the backend and console - * input devices. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_STATE_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxcommon.h" -#include "dmxconsole.h" -#include "dmxprop.h" -#include "dmxsync.h" -#include "dmxmap.h" - -#include "inputstr.h" -#include "input.h" -#include <X11/keysym.h> -#include "mipointer.h" -#include "scrnintstr.h" - -#include <unistd.h> /* For usleep() */ - -#if DMX_STATE_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#else -#define DMXDBG0(f) -#endif - -/** Each device has a private area that is visible only from inside the - * driver code. */ -typedef struct _myPrivate { - DMX_COMMON_PRIVATE; -} myPrivate; - -static void -dmxCommonKbdSetAR(Display * display, unsigned char *old, unsigned char *new) -{ - XKeyboardControl kc; - XKeyboardState ks; - unsigned long mask = KBKey | KBAutoRepeatMode; - int i, j; - int minKeycode, maxKeycode; - - if (!old) { - XGetKeyboardControl(display, &ks); - old = (unsigned char *) ks.auto_repeats; - } - - XDisplayKeycodes(display, &minKeycode, &maxKeycode); - for (i = 1; i < 32; i++) { - if (!old || old[i] != new[i]) { - for (j = 0; j < 8; j++) { - if ((new[i] & (1 << j)) != (old[i] & (1 << j))) { - kc.key = i * 8 + j; - kc.auto_repeat_mode = ((new[i] & (1 << j)) - ? AutoRepeatModeOn - : AutoRepeatModeOff); - if (kc.key >= minKeycode && kc.key <= maxKeycode) - XChangeKeyboardControl(display, mask, &kc); - } - } - } - } -} - -static void -dmxCommonKbdSetLeds(Display * display, unsigned long new) -{ - int i; - XKeyboardControl kc; - - for (i = 0; i < 32; i++) { - kc.led = i + 1; - kc.led_mode = (new & (1 << i)) ? LedModeOn : LedModeOff; - XChangeKeyboardControl(display, KBLed | KBLedMode, &kc); - } -} - -static void -dmxCommonKbdSetCtrl(Display * display, KeybdCtrl * old, KeybdCtrl * new) -{ - XKeyboardControl kc; - unsigned long mask = KBKeyClickPercent | KBAutoRepeatMode; - - if (!old || old->click != new->click || old->autoRepeat != new->autoRepeat) { - - kc.key_click_percent = new->click; - kc.auto_repeat_mode = new->autoRepeat; - - XChangeKeyboardControl(display, mask, &kc); - } - - dmxCommonKbdSetLeds(display, new->leds); - dmxCommonKbdSetAR(display, old ? old->autoRepeats : NULL, new->autoRepeats); -} - -static void -dmxCommonMouSetCtrl(Display * display, PtrCtrl * old, PtrCtrl * new) -{ - Bool do_accel, do_threshold; - - if (!old - || old->num != new->num - || old->den != new->den || old->threshold != new->threshold) { - do_accel = (new->num > 0 && new->den > 0); - do_threshold = (new->threshold > 0); - if (do_accel || do_threshold) { - XChangePointerControl(display, do_accel, do_threshold, - new->num, new->den, new->threshold); - } - } -} - -/** Update the keyboard control. */ -void -dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl) -{ - GETPRIVFROMPDEV; - - if (!priv->stateSaved && priv->be) - dmxCommonSaveState(priv); - if (!priv->display || !priv->stateSaved) - return; - dmxCommonKbdSetCtrl(priv->display, - priv->kctrlset ? &priv->kctrl : NULL, ctrl); - priv->kctrl = *ctrl; - priv->kctrlset = 1; -} - -/** Update the mouse control. */ -void -dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl) -{ - GETPRIVFROMPDEV; - - /* Don't set the acceleration for the - * console, because that should be - * controlled by the X server that the - * console is running on. Otherwise, - * the acceleration for the console - * window would be unexpected for the - * scale of the window. */ - if (priv->be) { - dmxCommonMouSetCtrl(priv->display, - priv->mctrlset ? &priv->mctrl : NULL, ctrl); - priv->mctrl = *ctrl; - priv->mctrlset = 1; - } -} - -/** Sound they keyboard bell. */ -void -dmxCommonKbdBell(DevicePtr pDev, int percent, - int volume, int pitch, int duration) -{ - GETPRIVFROMPDEV; - XKeyboardControl kc; - XKeyboardState ks; - unsigned long mask = KBBellPercent | KBBellPitch | KBBellDuration; - - if (!priv->be) - XGetKeyboardControl(priv->display, &ks); - kc.bell_percent = volume; - kc.bell_pitch = pitch; - kc.bell_duration = duration; - XChangeKeyboardControl(priv->display, mask, &kc); - XBell(priv->display, percent); - if (!priv->be) { - kc.bell_percent = ks.bell_percent; - kc.bell_pitch = ks.bell_pitch; - kc.bell_duration = ks.bell_duration; - XChangeKeyboardControl(priv->display, mask, &kc); - } -} - -/** Get the keyboard mapping. */ -void -dmxCommonKbdGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - GETPRIVFROMPDEV; - int min_keycode; - int max_keycode; - int map_width; - KeySym *keyboard_mapping; - XModifierKeymap *modifier_mapping; - int i, j; - - /* Compute pKeySyms. Cast - * XGetKeyboardMapping because of - * compiler warning on 64-bit machines. - * We assume pointers to 32-bit and - * 64-bit ints are the same. */ - XDisplayKeycodes(priv->display, &min_keycode, &max_keycode); - keyboard_mapping = (KeySym *) XGetKeyboardMapping(priv->display, - min_keycode, - max_keycode - - min_keycode + 1, - &map_width); - pKeySyms->minKeyCode = min_keycode; - pKeySyms->maxKeyCode = max_keycode; - pKeySyms->mapWidth = map_width; - pKeySyms->map = keyboard_mapping; - - /* Compute pModMap */ - modifier_mapping = XGetModifierMapping(priv->display); - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = 0; - for (j = 0; j < 8; j++) { - int max_keypermod = modifier_mapping->max_keypermod; - - for (i = 0; i < max_keypermod; i++) { - CARD8 keycode = - modifier_mapping->modifiermap[j * max_keypermod + i]; - if (keycode) - pModMap[keycode] |= 1 << j; - } - } - XFreeModifiermap(modifier_mapping); -} - -/** Fill in the XKEYBOARD parts of the \a info structure for the - * specified \a pDev. */ -void -dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - char *pt; - - dmxCommonSaveState(priv); - if (priv->xkb) { -#define NAME(x) \ - priv->xkb->names->x ? XGetAtomName(priv->display,priv->xkb->names->x) : NULL - info->names.keycodes = NAME(keycodes); - info->names.types = NAME(types); - info->names.compat = NAME(compat); - info->names.symbols = NAME(symbols); - info->names.geometry = NAME(geometry); - info->freenames = 1; -#undef NAME - dmxLogInput(dmxInput, - "XKEYBOARD: keycodes = %s\n", info->names.keycodes); - dmxLogInput(dmxInput, - "XKEYBOARD: symbols = %s\n", info->names.symbols); - dmxLogInput(dmxInput, - "XKEYBOARD: geometry = %s\n", info->names.geometry); - if ((pt = strchr(info->names.keycodes, '+'))) - *pt = '\0'; - } - dmxCommonRestoreState(priv); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -dmxCommonKbdOn(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - if (priv->be) - dmxCommonSaveState(priv); - priv->eventMask |= DMX_KEYBOARD_EVENT_MASK; - XSelectInput(priv->display, priv->window, priv->eventMask); - if (priv->be) - XSetInputFocus(priv->display, priv->window, RevertToPointerRoot, - CurrentTime); - return -1; -} - -/** Turn \a pDev off. */ -void -dmxCommonKbdOff(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - priv->eventMask &= ~DMX_KEYBOARD_EVENT_MASK; - XSelectInput(priv->display, priv->window, priv->eventMask); - dmxCommonRestoreState(priv); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -dmxCommonOthOn(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - XEventClass event_list[DMX_MAX_XINPUT_EVENT_TYPES]; - int event_type[DMX_MAX_XINPUT_EVENT_TYPES]; - int count = 0; - -#define ADD(type) \ - if (count < DMX_MAX_XINPUT_EVENT_TYPES) { \ - type(priv->xi, event_type[count], event_list[count]); \ - if (event_type[count]) { \ - dmxMapInsert(dmxLocal, event_type[count], XI_##type); \ - ++count; \ - } \ - } else { \ - dmxLog(dmxWarning, "More than %d event types for %s\n", \ - DMX_MAX_XINPUT_EVENT_TYPES, dmxInput->name); \ - } - - if (!(priv->xi = XOpenDevice(priv->display, dmxLocal->deviceId))) { - dmxLog(dmxWarning, "Cannot open %s device (id=%d) on %s\n", - dmxLocal->deviceName ? dmxLocal->deviceName : "(unknown)", - (int) dmxLocal->deviceId, dmxInput->name); - return -1; - } - ADD(DeviceKeyPress); - ADD(DeviceKeyRelease); - ADD(DeviceButtonPress); - ADD(DeviceButtonRelease); - ADD(DeviceMotionNotify); - ADD(DeviceFocusIn); - ADD(DeviceFocusOut); - ADD(ProximityIn); - ADD(ProximityOut); - ADD(DeviceStateNotify); - ADD(DeviceMappingNotify); - ADD(ChangeDeviceNotify); - XSelectExtensionEvent(priv->display, priv->window, event_list, count); - - return -1; -} - -/** Turn \a pDev off. */ -void -dmxCommonOthOff(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - - if (priv->xi) - XCloseDevice(priv->display, priv->xi); - priv->xi = NULL; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - XExtensionVersion *ext; - XDeviceInfo *devices; - Display *display = priv->display; - int num; - int i, j, k; - XextErrorHandler handler; - - if (!display && !(display = XOpenDisplay(dmxInput->name))) - return; - - /* Print out information about the XInput Extension. */ - handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); - ext = XGetExtensionVersion(display, INAME); - XSetExtensionErrorHandler(handler); - - if (ext && ext != (XExtensionVersion *) NoSuchExtension) { - XFree(ext); - devices = XListInputDevices(display, &num); - for (i = 0; i < num; i++) { - if (devices[i].id == (XID) dmxLocal->deviceId) { - XAnyClassPtr any; - XKeyInfoPtr ki; - XButtonInfoPtr bi; - XValuatorInfoPtr vi; - - for (j = 0, any = devices[i].inputclassinfo; - j < devices[i].num_classes; - any = (XAnyClassPtr) ((char *) any + any->length), j++) { - switch (any->class) { - case KeyClass: - ki = (XKeyInfoPtr) any; - info->keyboard = 1; - info->keyClass = 1; - info->keySyms.minKeyCode = ki->min_keycode; - info->keySyms.maxKeyCode = ki->max_keycode; - info->kbdFeedbackClass = 1; - break; - case ButtonClass: - bi = (XButtonInfoPtr) any; - info->buttonClass = 1; - info->numButtons = bi->num_buttons; - info->ptrFeedbackClass = 1; - break; - case ValuatorClass: - /* This assume all axes are either - * Absolute or Relative. */ - vi = (XValuatorInfoPtr) any; - info->valuatorClass = 1; - if (vi->mode == Absolute) - info->numAbsAxes = vi->num_axes; - else - info->numRelAxes = vi->num_axes; - for (k = 0; k < vi->num_axes; k++) { - info->res[k] = vi->axes[k].resolution; - info->minres[k] = vi->axes[k].resolution; - info->maxres[k] = vi->axes[k].resolution; - info->minval[k] = vi->axes[k].min_value; - info->maxval[k] = vi->axes[k].max_value; - } - break; - case FeedbackClass: - /* Only keyboard and pointer feedback - * are handled at this time. */ - break; - case ProximityClass: - info->proximityClass = 1; - break; - case FocusClass: - info->focusClass = 1; - break; - case OtherClass: - break; - } - } - } - } - XFreeDeviceList(devices); - } - if (display != priv->display) - XCloseDisplay(display); -} - -/** Obtain the mouse button mapping. */ -void -dmxCommonMouGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) -{ - GETPRIVFROMPDEV; - int i; - - *nButtons = XGetPointerMapping(priv->display, map, DMX_MAX_BUTTONS); - for (i = 0; i <= *nButtons; i++) - map[i] = i; -} - -static void * -dmxCommonXSelect(DMXScreenInfo * dmxScreen, void *closure) -{ - myPrivate *priv = closure; - - XSelectInput(dmxScreen->beDisplay, dmxScreen->scrnWin, priv->eventMask); - return NULL; -} - -static void -dmxCommonFdNotify(int fd, int ready, void *data) -{ - /* This should process input on this fd, but instead all - * of that is delayed until the block and wakeup handlers are called - */ - ; -} - -static void * -dmxCommonAddEnabledDevice(DMXScreenInfo * dmxScreen, void *closure) -{ - SetNotifyFd(XConnectionNumber(dmxScreen->beDisplay), dmxCommonFdNotify, X_NOTIFY_READ, closure); - return NULL; -} - -static void * -dmxCommonRemoveEnabledDevice(DMXScreenInfo * dmxScreen, void *closure) -{ - RemoveNotifyFd(XConnectionNumber(dmxScreen->beDisplay)); - return NULL; -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -dmxCommonMouOn(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - - priv->eventMask |= DMX_POINTER_EVENT_MASK; - if (!priv->be) { - XSelectInput(priv->display, priv->window, priv->eventMask); - SetNotifyFd(XConnectionNumber(priv->display), dmxCommonFdNotify,X_NOTIFY_READ, pDev); - } - else { - dmxPropertyIterate(priv->be, dmxCommonXSelect, priv); - dmxPropertyIterate(priv->be, dmxCommonAddEnabledDevice, dmxInput); - } - - return -1; -} - -/** Turn \a pDev off. */ -void -dmxCommonMouOff(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - - priv->eventMask &= ~DMX_POINTER_EVENT_MASK; - if (!priv->be) { - RemoveNotifyFd(XConnectionNumber(priv->display)); - XSelectInput(priv->display, priv->window, priv->eventMask); - } - else { - dmxPropertyIterate(priv->be, dmxCommonRemoveEnabledDevice, dmxInput); - dmxPropertyIterate(priv->be, dmxCommonXSelect, priv); - } -} - -/** Given the global coordinates \a x and \a y, determine the screen - * with the lowest number on which those coordinates lie. If they are - * not on any screen, return -1. The number returned is an index into - * \a dmxScreenInfo and is between -1 and \a dmxNumScreens - 1, - * inclusive. */ -int -dmxFindPointerScreen(int x, int y) -{ - int i; - - for (i = 0; i < dmxNumScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - - if (x >= pScreen->x && x < pScreen->x + pScreen->width && - y >= pScreen->y && y < pScreen->y + pScreen->height) - return i; - } - return -1; -} - -/** Returns a pointer to the private area for the device that comes just - * prior to \a pDevice in the current \a dmxInput device list. This is - * used as the private area for the current device in some situations - * (e.g., when a keyboard and mouse form a pair that should share the - * same private area). If the requested private area cannot be located, - * then NULL is returned. */ -void * -dmxCommonCopyPrivate(DeviceIntPtr pDevice) -{ - GETDMXLOCALFROMPDEVICE; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - int i; - - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i] == dmxLocal && i) - return dmxInput->devs[i - 1]->private; - return NULL; -} - -/** This routine saves and resets some important state for the backend - * and console device drivers: - * - the modifier map is saved and set to 0 (so DMX controls the LEDs) - * - the key click, bell, led, and repeat masks are saved and set to the - * values that DMX claims to be using - * - * This routine and #dmxCommonRestoreState are used when the pointer - * enters and leaves the console window, or when the backend window is - * active or not active (for a full-screen window, this only happens at - * server startup and server shutdown). - */ -void -dmxCommonSaveState(void *private) -{ - GETPRIVFROMPRIVATE; - XKeyboardState ks; - unsigned long i; - XModifierKeymap *modmap; - - if (dmxInput->console) - priv = dmxInput->devs[0]->private; - if (!priv->display || priv->stateSaved) - return; - DMXDBG0("dmxCommonSaveState\n"); - if (dmxUseXKB && (priv->xkb = XkbAllocKeyboard())) { - if (XkbGetIndicatorMap(priv->display, XkbAllIndicatorsMask, priv->xkb) - || XkbGetNames(priv->display, XkbAllNamesMask, priv->xkb)) { - dmxLogInput(dmxInput, "Could not get XKB information\n"); - XkbFreeKeyboard(priv->xkb, 0, True); - priv->xkb = NULL; - } - else { - if (priv->xkb->indicators) { - priv->savedIndicators = *priv->xkb->indicators; - for (i = 0; i < XkbNumIndicators; i++) - if (priv->xkb->indicators->phys_indicators & (1 << i)) { - priv->xkb->indicators->maps[i].flags - = XkbIM_NoAutomatic; - } - XkbSetIndicatorMap(priv->display, ~0, priv->xkb); - } - } - } - - XGetKeyboardControl(priv->display, &ks); - priv->savedKctrl.click = ks.key_click_percent; - priv->savedKctrl.bell = ks.bell_percent; - priv->savedKctrl.bell_pitch = ks.bell_pitch; - priv->savedKctrl.bell_duration = ks.bell_duration; - priv->savedKctrl.leds = ks.led_mask; - priv->savedKctrl.autoRepeat = ks.global_auto_repeat; - for (i = 0; i < 32; i++) - priv->savedKctrl.autoRepeats[i] = ks.auto_repeats[i]; - - dmxCommonKbdSetCtrl(priv->display, &priv->savedKctrl, - &priv->dmxLocal->kctrl); - - priv->savedModMap = XGetModifierMapping(priv->display); - - modmap = XNewModifiermap(0); - XSetModifierMapping(priv->display, modmap); - if (dmxInput->scrnIdx != -1) - dmxSync(&dmxScreens[dmxInput->scrnIdx], TRUE); - XFreeModifiermap(modmap); - - priv->stateSaved = 1; -} - -/** This routine restores all the information saved by #dmxCommonSaveState. */ -void -dmxCommonRestoreState(void *private) -{ - GETPRIVFROMPRIVATE; - int retcode = -1; - CARD32 start; - - if (dmxInput->console) - priv = dmxInput->devs[0]->private; - if (!priv->stateSaved) - return; - priv->stateSaved = 0; - - DMXDBG0("dmxCommonRestoreState\n"); - if (priv->xkb) { - *priv->xkb->indicators = priv->savedIndicators; - XkbSetIndicatorMap(priv->display, ~0, priv->xkb); - XkbFreeKeyboard(priv->xkb, 0, True); - priv->xkb = 0; - } - - for (start = GetTimeInMillis(); GetTimeInMillis() - start < 5000;) { - CARD32 tmp; - - retcode = XSetModifierMapping(priv->display, priv->savedModMap); - if (retcode == MappingSuccess) - break; - if (retcode == MappingBusy) - dmxLogInput(dmxInput, "Keyboard busy, waiting\n"); - else - dmxLogInput(dmxInput, "Keyboard error, waiting\n"); - - /* Don't generate X11 protocol for a bit */ - for (tmp = GetTimeInMillis(); GetTimeInMillis() - tmp < 250;) { - usleep(250); /* This ends up sleeping only until - * the next key press generates an - * interruption. We make the delay - * relatively short in case the user - * pressed they keys quickly. */ - } - - } - if (retcode != MappingSuccess) - dmxLog(dmxWarning, "Unable to restore keyboard modifier state!\n"); - - XFreeModifiermap(priv->savedModMap); - priv->savedModMap = NULL; - - dmxCommonKbdSetCtrl(priv->display, NULL, &priv->savedKctrl); - priv->kctrlset = 0; /* Invalidate copy */ -} diff --git a/hw/dmx/input/dmxcommon.h b/hw/dmx/input/dmxcommon.h deleted file mode 100644 index ed04287a5..000000000 --- a/hw/dmx/input/dmxcommon.h +++ /dev/null @@ -1,124 +0,0 @@ -/* - * Copyright 2002,2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to functions used by backend and console input devices. - * \see dmxcommon.c \see dmxbackend.c \see dmxconsole.c */ - -#ifndef _DMXCOMMON_H_ -#define _DMXCOMMON_H_ - -#define DMX_COMMON_OTHER \ - Display *display; \ - Window window; \ - DMXScreenInfo *be; \ - DMXLocalInputInfoPtr dmxLocal; \ - int initPointerX; \ - int initPointerY; \ - long eventMask; \ - KeybdCtrl kctrl; \ - PtrCtrl mctrl; \ - int kctrlset; \ - int mctrlset; \ - KeybdCtrl savedKctrl; \ - XModifierKeymap *savedModMap; \ - int stateSaved - -#define DMX_COMMON_XKB \ - DMX_COMMON_OTHER; \ - XkbDescPtr xkb; \ - XkbIndicatorRec savedIndicators - -#define DMX_COMMON_PRIVATE \ - DMX_COMMON_XKB; \ - XDevice *xi - -#define GETONLYPRIVFROMPRIVATE \ - myPrivate *priv = private - -#define GETPRIVFROMPRIVATE \ - GETONLYPRIVFROMPRIVATE; \ - DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx] - -#define GETDMXLOCALFROMPDEVICE \ - DevicePtr pDev = &pDevice->public; \ - DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate - -#define GETDMXINPUTFROMPRIV \ - DMXInputInfo *dmxInput = &dmxInputs[priv->dmxLocal->inputIdx] - -#define GETDMXINPUTFROMPDEVICE \ - GETDMXLOCALFROMPDEVICE; \ - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx] - -#define GETDMXLOCALFROMPDEV \ - DMXLocalInputInfoPtr dmxLocal = pDev->devicePrivate - -#define GETDMXINPUTFROMPDEV \ - GETDMXLOCALFROMPDEV; \ - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx] - -#define GETPRIVFROMPDEV \ - GETDMXLOCALFROMPDEV; \ - myPrivate *priv = dmxLocal->private - -#define DMX_KEYBOARD_EVENT_MASK \ - (KeyPressMask | KeyReleaseMask | KeymapStateMask) - -#define DMX_POINTER_EVENT_MASK \ - (ButtonPressMask | ButtonReleaseMask | PointerMotionMask) - -extern void dmxCommonKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxCommonKbdGetMap(DevicePtr pDev, - KeySymsPtr pKeySyms, CARD8 *pModMap); -extern void dmxCommonKbdCtrl(DevicePtr pDev, KeybdCtrl * ctrl); -extern void dmxCommonKbdBell(DevicePtr pDev, int percent, - int volume, int pitch, int duration); -extern int dmxCommonKbdOn(DevicePtr pDev); -extern void dmxCommonKbdOff(DevicePtr pDev); -extern void dmxCommonMouGetMap(DevicePtr pDev, - unsigned char *map, int *nButtons); -extern void dmxCommonMouCtrl(DevicePtr pDev, PtrCtrl * ctrl); -extern int dmxCommonMouOn(DevicePtr pDev); -extern void dmxCommonMouOff(DevicePtr pDev); -extern int dmxFindPointerScreen(int x, int y); - -extern int dmxCommonOthOn(DevicePtr pDev); -extern void dmxCommonOthOff(DevicePtr pDev); -extern void dmxCommonOthGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); - - /* helper functions */ -extern void *dmxCommonCopyPrivate(DeviceIntPtr pDevice); -extern void dmxCommonSaveState(void *private); -extern void dmxCommonRestoreState(void *private); -#endif diff --git a/hw/dmx/input/dmxconsole.c b/hw/dmx/input/dmxconsole.c deleted file mode 100644 index 86f01b703..000000000 --- a/hw/dmx/input/dmxconsole.c +++ /dev/null @@ -1,1090 +0,0 @@ -/* - * Copyright 2001-2003 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: - * David H. Dawes <dawes@xfree86.org> - * Kevin E. Martin <kem@redhat.com> - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This file implements the console input devices. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_CONSOLE_DEBUG 0 -#define DMX_WINDOW_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxevents.h" -#include "dmxconsole.h" -#include "dmxcommon.h" -#include "dmxscrinit.h" -#include "dmxcb.h" -#include "dmxsync.h" - -#include "inputstr.h" -#include "input.h" -#include "mipointer.h" -#include "windowstr.h" - -#define CONSOLE_NUM 3 -#define CONSOLE_DEN 4 -#define DMX_CONSOLE_NAME "DMX Console" -#define DMX_RES_NAME "Xdmx" -#define DMX_RES_CLASS "XDmx" -#define CONSOLE_BG_COLOR "gray75" -#define CONSOLE_FG_COLOR "black" -#define CONSOLE_SCREEN_BG_COLOR "white" -#define CONSOLE_SCREEN_FG_COLOR "black" -#define CONSOLE_SCREEN_DET_COLOR "gray75" -#define CONSOLE_SCREEN_CUR_COLOR "red" - -#if DMX_CONSOLE_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#endif - -/* Private area for consoles. */ -typedef struct _myPrivate { - DMX_COMMON_PRIVATE; - int lastX; - int lastY; - int globalX; - int globalY; - int curX; - int curY; - int width; - int height; - int consWidth; - int consHeight; - double xScale; - double yScale; - XlibGC gc, gcDet, gcRev, gcCur; - int grabbed, fine, captured; - Cursor cursorNormal, cursorGrabbed, cursorEmpty; - Pixmap pixmap; - - CloseScreenProcPtr CloseScreen; - struct _myPrivate *next; /* for closing multiple consoles */ - int initialized; - DevicePtr mou, kbd; -} myPrivate; - -static int -scalex(myPrivate * priv, int x) -{ - return (int) ((x * priv->xScale) + .5); -} - -static int -scaley(myPrivate * priv, int y) -{ - return (int) ((y * priv->yScale) + .5); -} - -static int -unscalex(myPrivate * priv, int x) -{ - return (int) ((x / priv->xScale) + .5); -} - -static int -unscaley(myPrivate * priv, int y) -{ - return (int) ((y / priv->yScale) + .5); -} - -/** Create the private area for \a pDevice. */ -void * -dmxConsoleCreatePrivate(DeviceIntPtr pDevice) -{ - GETDMXLOCALFROMPDEVICE; - myPrivate *priv = calloc(1, sizeof(*priv)); - - priv->dmxLocal = dmxLocal; - return priv; -} - -/** If \a private is non-NULL, free its associated memory. */ -void -dmxConsoleDestroyPrivate(void *private) -{ - free(private); -} - -static void -dmxConsoleDrawFineCursor(myPrivate * priv, XRectangle * rect) -{ - int size = 6; - int x, y; - - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - x = scalex(priv, priv->globalX) - size, - scaley(priv, priv->globalY), - scalex(priv, priv->globalX) + size, scaley(priv, priv->globalY)); - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - scalex(priv, priv->globalX), - y = scaley(priv, priv->globalY) - size, - scalex(priv, priv->globalX), scaley(priv, priv->globalY) + size); - if (priv->grabbed) { - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - scalex(priv, priv->globalX) - (int) (size / 1.4), - scaley(priv, priv->globalY) - (int) (size / 1.4), - scalex(priv, priv->globalX) + (int) (size / 1.4), - scaley(priv, priv->globalY) + (int) (size / 1.4)); - XDrawLine(priv->display, priv->pixmap, priv->gcCur, - scalex(priv, priv->globalX) - (int) (size / 1.4), - scaley(priv, priv->globalY) + (int) (size / 1.4), - scalex(priv, priv->globalX) + (int) (size / 1.4), - scaley(priv, priv->globalY) - (int) (size / 1.4)); - } - if (rect) { - rect->x = x; - rect->y = y; - rect->width = 2 * size; - rect->height = 2 * size; - } -} - -static void -dmxConsoleDrawWindows(void *private) -{ - GETONLYPRIVFROMPRIVATE; - Display *dpy = priv->display; - int i; - Region whole, used, avail; - XRectangle rect; - - whole = XCreateRegion(); - used = XCreateRegion(); - avail = XCreateRegion(); - rect.x = 0; - rect.y = 0; - rect.width = priv->consWidth; - rect.height = priv->consHeight; - XUnionRectWithRegion(&rect, whole, whole); - - for (i = 0; i < dmxNumScreens; i++) { - ScreenPtr pScreen = screenInfo.screens[i]; - WindowPtr pRoot = pScreen->root; - WindowPtr pChild; - -#if DMX_WINDOW_DEBUG - dmxLog(dmxDebug, "%lu %p %p %p 2\n", - pRoot->drawable.id, - pRoot->parent, pRoot->firstChild, pRoot->lastChild); -#endif - - for (pChild = pRoot->firstChild; pChild; pChild = pChild->nextSib) { - if (pChild->mapped && pChild->realized) { -#if DMX_WINDOW_DEBUG - dmxLog(dmxDebug, " %p %d,%d %dx%d %d %d %d RECTS\n", - pChild, - pChild->drawable.x, - pChild->drawable.y, - pChild->drawable.width, - pChild->drawable.height, - pChild->visibility, - pChild->overrideRedirect, - RegionNumRects(&pChild->clipList)); -#endif - rect.x = scalex(priv, pChild->drawable.x + pScreen->x); - rect.y = scaley(priv, pChild->drawable.y + pScreen->y); - rect.width = scalex(priv, pChild->drawable.width); - rect.height = scaley(priv, pChild->drawable.height); - XDrawRectangle(dpy, priv->pixmap, priv->gc, - rect.x, rect.y, rect.width, rect.height); - XUnionRectWithRegion(&rect, used, used); - XSubtractRegion(whole, used, avail); - XSetRegion(dpy, priv->gc, avail); - } - } -#ifdef PANORAMIX - if (!noPanoramiXExtension) - break; /* Screen 0 valid with Xinerama */ -#endif - } - XDestroyRegion(avail); - XDestroyRegion(used); - XDestroyRegion(whole); - XSetClipMask(dpy, priv->gc, None); -} - -static void -dmxConsoleDraw(myPrivate * priv, int updateCursor, int update) -{ - GETDMXINPUTFROMPRIV; - Display *dpy = priv->display; - int i; - - XFillRectangle(dpy, priv->pixmap, priv->gc, 0, 0, - priv->consWidth, priv->consHeight); - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - XFillRectangle(dpy, priv->pixmap, - dmxScreen->beDisplay ? priv->gcRev : priv->gcDet, - scalex(priv, screenInfo.screens[i]->x), - scaley(priv, screenInfo.screens[i]->y), - scalex(priv, screenInfo.screens[i]->width), - scaley(priv, screenInfo.screens[i]->height)); - } - for (i = 0; i < dmxNumScreens; i++) { - XDrawRectangle(dpy, priv->pixmap, priv->gc, - scalex(priv, screenInfo.screens[i]->x), - scaley(priv, screenInfo.screens[i]->y), - scalex(priv, screenInfo.screens[i]->width), - scaley(priv, screenInfo.screens[i]->height)); - } - if (dmxInput->windows) - dmxConsoleDrawWindows(priv); - if (priv->fine && updateCursor) - dmxConsoleDrawFineCursor(priv, 0); - if (update) { - XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc, - 0, 0, priv->consWidth, priv->consHeight, 0, 0); - XSync(priv->display, False); /* Not a backend display */ - } -} - -static void -dmxConsoleClearCursor(myPrivate * priv, int x, int y, XRectangle * rect) -{ - int cw = 14, ch = 14; /* Clear width and height */ - - rect->x = scalex(priv, x) - cw / 2; - rect->y = scaley(priv, y) - ch / 2; - rect->width = cw; - rect->height = ch; - XSetClipRectangles(priv->display, priv->gc, 0, 0, rect, 1, Unsorted); - XSetClipRectangles(priv->display, priv->gcDet, 0, 0, rect, 1, Unsorted); - XSetClipRectangles(priv->display, priv->gcRev, 0, 0, rect, 1, Unsorted); - dmxConsoleDraw(priv, 0, 0); - XSetClipMask(priv->display, priv->gc, None); - XSetClipMask(priv->display, priv->gcDet, None); - XSetClipMask(priv->display, priv->gcRev, None); -} - -static void -dmxConsoleUpdateFineCursor(myPrivate * priv) -{ - int leave = 0; - XRectangle rects[2]; - - dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rects[0]); - if (priv->dmxLocal->sendsCore) { - dmxGetGlobalPosition(&priv->globalX, &priv->globalY); - } - else { - priv->globalX = priv->dmxLocal->lastX; - priv->globalY = priv->dmxLocal->lastY; - } - - priv->lastX = scalex(priv, priv->width / 2); - priv->lastY = scaley(priv, priv->height / 2); - - /* Compute new warp position, which may be - outside the window */ - if (priv->globalX < 1 || priv->globalX >= priv->width) { - if (priv->globalX < 1) - priv->lastX = 0; - else - priv->lastX = scalex(priv, priv->width); - priv->lastY = scaley(priv, priv->globalY); - ++leave; - } - if (priv->globalY < 1 || priv->globalY >= priv->height) { - if (priv->globalY < 1) - priv->lastY = 0; - else - priv->lastY = scaley(priv, priv->height); - priv->lastX = scalex(priv, priv->globalX); - ++leave; - } - - /* Draw pseudo cursor in window */ - dmxConsoleDrawFineCursor(priv, &rects[1]); - - XSetClipRectangles(priv->display, priv->gc, 0, 0, rects, 2, Unsorted); - XCopyArea(priv->display, priv->pixmap, priv->window, priv->gc, - 0, 0, priv->consWidth, priv->consHeight, 0, 0); - XSetClipMask(priv->display, priv->gc, None); - - DMXDBG2("dmxConsoleUpdateFineCursor: WARP %d %d\n", - priv->lastX, priv->lastY); - XWarpPointer(priv->display, priv->window, priv->window, - 0, 0, 0, 0, priv->lastX, priv->lastY); - XSync(priv->display, False); /* Not a backend display */ - - if (leave) { - XEvent X; - - while (XCheckMaskEvent(priv->display, PointerMotionMask, &X)) { - if (X.type == MotionNotify) { - if (X.xmotion.x != priv->lastX || X.xmotion.y != priv->lastY) { - DMXDBG4("Ignoring motion to %d %d after leave frm %d %d\n", - X.xmotion.x, X.xmotion.y, priv->lastX, priv->lastY); - } - } - else { - dmxLog(dmxInfo, "Ignoring event (%d): %s ****************\n", - X.type, dmxEventName(X.type)); - } - } - } - DMXDBG6("dmxConsoleUpdateFineCursor: Warp %d %d on %d %d [%d %d]\n", - priv->lastX, priv->lastY, - scalex(priv, priv->width), - scaley(priv, priv->height), priv->globalX, priv->globalY); -} - -/** Whenever the window layout (size, position, stacking order) might be - * changed, this routine is called with the \a pWindow that changed and - * the \a type of change. This routine is called in a conservative - * fashion: the actual layout of the windows of the screen might not - * have had any human-visible changes. */ -void -dmxConsoleUpdateInfo(void *private, DMXUpdateType type, WindowPtr pWindow) -{ - GETONLYPRIVFROMPRIVATE; - dmxConsoleDraw(priv, 1, 1); -} - -static void -dmxConsoleMoveAbsolute(myPrivate * priv, int x, int y, - DevicePtr pDev, dmxMotionProcPtr motion, - DMXBlockType block) -{ - int tmpX, tmpY, v[2]; - - tmpX = unscalex(priv, x); - tmpY = unscalex(priv, y); - DMXDBG6("dmxConsoleMoveAbsolute(,%d,%d) %d %d =? %d %d\n", - x, y, tmpX, tmpY, priv->curX, priv->curY); - if (tmpX == priv->curX && tmpY == priv->curY) - return; - v[0] = unscalex(priv, x); - v[1] = unscaley(priv, y); - motion(pDev, v, 0, 2, DMX_ABSOLUTE_CONFINED, block); - /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */ -} - -static void -dmxConsoleMoveRelative(myPrivate * priv, int x, int y, - DevicePtr pDev, dmxMotionProcPtr motion, - DMXBlockType block) -{ - int v[2]; - - /* Ignore the event generated from * warping back to middle */ - if (x == priv->lastX && y == priv->lastY) - return; - v[0] = priv->lastX - x; - v[1] = priv->lastY - y; - motion(pDev, v, 0, 2, DMX_RELATIVE, block); - /* dmxConsoleUpdatePosition gets called here by dmxCoreMotion */ -} - -/** This routine gets called from #dmxCoreMotion for each motion. This - * allows the console's notion of the cursor position to change when - * another input device actually caused the change. */ -void -dmxConsoleUpdatePosition(void *private, int x, int y) -{ - GETONLYPRIVFROMPRIVATE; - int tmpX, tmpY; - Display *dpy = priv->display; - static unsigned long dmxGeneration = 0; - - tmpX = scalex(priv, x); - tmpY = scaley(priv, y); - DMXDBG6("dmxConsoleUpdatePosition(,%d,%d) new=%d,%d dims=%d,%d\n", - x, y, tmpX, tmpY, priv->consWidth, priv->consHeight); - - if (priv->fine) - dmxConsoleUpdateFineCursor(priv); - if (tmpX != priv->curX || tmpY != priv->curY) { - if (tmpX < 0) - tmpX = 0; - if (tmpY < 0) - tmpY = 0; - if (tmpX >= priv->consWidth) - tmpX = priv->consWidth - 1; - if (tmpY >= priv->consHeight) - tmpY = priv->consHeight - 1; - priv->curX = tmpX; - priv->curY = tmpY; - if (!priv->fine) { - DMXDBG2(" WARP B %d %d\n", priv->curX, priv->curY); - XWarpPointer(dpy, priv->window, - priv->window, 0, 0, 0, 0, tmpX, tmpY); - XSync(dpy, False); /* Not a backend display */ - } - } - - if (dmxGeneration != serverGeneration) { - dmxGeneration = serverGeneration; - dmxConsoleDraw(priv, 1, 1); - } -} - -/** Collect all pending events from the console's display. Place these - * events on the server event queue using the \a motion and \a enqueue - * routines. The \a checkspecial routine is used to check for special - * keys that need handling. \a block tells if signals should be blocked - * when updating the event queue. */ -void -dmxConsoleCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block) -{ - GETPRIVFROMPDEV; - GETDMXINPUTFROMPRIV; - Display *dpy = priv->display; - Window win = priv->window; - int width = priv->width; - int height = priv->height; - XEvent X, N; - XSetWindowAttributes attribs; - static int rInitialized = 0; - static Region r; - XRectangle rect; - static int raising = 0, raiseX, raiseY; /* FIXME */ - - while (XPending(dpy)) { - XNextEvent(dpy, &X); - switch (X.type) { - case VisibilityNotify: - break; - case Expose: - DMXDBG5("dmxConsoleCollectEvents: Expose #%d %d %d %d %d\n", - X.xexpose.count, - X.xexpose.x, X.xexpose.y, - X.xexpose.width, X.xexpose.height); - if (!rInitialized++) - r = XCreateRegion(); - rect.x = X.xexpose.x; - rect.y = X.xexpose.y; - rect.width = X.xexpose.width; - rect.height = X.xexpose.height; - XUnionRectWithRegion(&rect, r, r); - if (X.xexpose.count == 0) { - XSetRegion(dpy, priv->gc, r); - XSetRegion(dpy, priv->gcDet, r); - XSetRegion(dpy, priv->gcRev, r); - dmxConsoleDraw(priv, 1, 1); - XSetClipMask(dpy, priv->gc, None); - XSetClipMask(dpy, priv->gcDet, None); - XSetClipMask(dpy, priv->gcRev, None); - XDestroyRegion(r); - rInitialized = 0; - } - break; - case ResizeRequest: - DMXDBG2("dmxConsoleCollectEvents: Resize %d %d\n", - X.xresizerequest.width, X.xresizerequest.height); - priv->consWidth = X.xresizerequest.width; - priv->consHeight = X.xresizerequest.height; - priv->xScale = (double) priv->consWidth / width; - priv->yScale = (double) priv->consHeight / height; - attribs.override_redirect = True; - XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs); - XResizeWindow(dpy, win, priv->consWidth, priv->consHeight); - XFreePixmap(dpy, priv->pixmap); - priv->pixmap = XCreatePixmap(dpy, - RootWindow(dpy, DefaultScreen(dpy)), - priv->consWidth, - priv->consHeight, - DefaultDepth(dpy, DefaultScreen(dpy))); - dmxConsoleDraw(priv, 1, 1); - attribs.override_redirect = False; - XChangeWindowAttributes(dpy, win, CWOverrideRedirect, &attribs); - break; - case LeaveNotify: - DMXDBG4("dmxConsoleCollectEvents: Leave @ %d,%d; r=%d f=%d\n", - X.xcrossing.x, X.xcrossing.y, raising, priv->fine); - if (!priv->captured) - dmxCommonRestoreState(priv); - else { - dmxConsoleUncapture(dmxInput); - dmxCommonRestoreState(priv); - } - break; - case EnterNotify: - DMXDBG6("dmxConsoleCollectEvents: Enter %d,%d r=%d f=%d (%d,%d)\n", - X.xcrossing.x, X.xcrossing.y, raising, priv->fine, - priv->curX, priv->curY); - dmxCommonSaveState(priv); - if (raising) { - raising = 0; - dmxConsoleMoveAbsolute(priv, raiseX, raiseY, - priv->mou, motion, block); - } - else { - if (priv->fine) { - /* The raise will generate an event near the center, - * which is not where the cursor should be. So we - * save the real position, do the raise, and move - * the cursor here again after the raise generates - * the event. */ - raising = 1; - raiseX = X.xcrossing.x; - raiseY = X.xcrossing.y; - XRaiseWindow(dpy, priv->window); - } - XSync(dpy, False); /* Not a backend display */ - if (!X.xcrossing.x && !X.xcrossing.y) - dmxConsoleMoveAbsolute(priv, priv->curX, priv->curY, - priv->mou, motion, block); - } - break; - case MotionNotify: - if (priv->curX == X.xmotion.x && priv->curY == X.xmotion.y) - continue; - if (XPending(dpy)) { /* do motion compression */ - XPeekEvent(dpy, &N); - if (N.type == MotionNotify) - continue; - } - DMXDBG2("dmxConsoleCollectEvents: Motion %d %d\n", - X.xmotion.x, X.xmotion.y); - if (raising) { - raising = 0; - dmxConsoleMoveAbsolute(priv, raiseX, raiseY, - priv->mou, motion, block); - } - else { - if (priv->fine) - dmxConsoleMoveRelative(priv, X.xmotion.x, X.xmotion.y, - priv->mou, motion, block); - else - dmxConsoleMoveAbsolute(priv, X.xmotion.x, X.xmotion.y, - priv->mou, motion, block); - } - break; - case KeyPress: - case KeyRelease: - enqueue(priv->kbd, X.type, X.xkey.keycode, 0, NULL, block); - break; - default: - /* Pass the whole event here, because - * this may be an extension event. */ - enqueue(priv->mou, X.type, X.xbutton.button, 0, &X, block); - break; - } - } -} - -static void -dmxCloseConsole(myPrivate * priv) -{ - GETDMXINPUTFROMPRIV; - dmxCommonRestoreState(priv); - if (priv->display) { - XFreeGC(priv->display, priv->gc); - XFreeGC(priv->display, priv->gcDet); - XFreeGC(priv->display, priv->gcRev); - XFreeGC(priv->display, priv->gcCur); - if (!dmxInput->console) - XCloseDisplay(priv->display); - } - priv->display = NULL; -} - -static Bool -dmxCloseConsoleScreen(ScreenPtr pScreen) -{ - myPrivate *priv, *last; - - for (last = priv = (myPrivate *) dixLookupPrivate(&pScreen->devPrivates, - dmxScreenPrivateKey); - priv; priv = priv->next) - dmxCloseConsole(last = priv); - - DMX_UNWRAP(CloseScreen, last, pScreen); - return pScreen->CloseScreen(pScreen); -} - -static Cursor -dmxConsoleCreateEmptyCursor(myPrivate * priv) -{ - char noCursorData[] = { 0, 0, 0, 0, 0, 0, 0, 0 }; - Pixmap pixmap; - Cursor cursor; - XColor color, tmpColor; - Display *dpy = priv->display; - - /* Create empty cursor for window */ - pixmap = XCreateBitmapFromData(priv->display, priv->window, - noCursorData, 8, 8); - if (!XAllocNamedColor(dpy, DefaultColormap(dpy, DefaultScreen(dpy)), - "black", &color, &tmpColor)) - dmxLog(dmxFatal, "Cannot allocate color for cursor\n"); - cursor = XCreatePixmapCursor(dpy, pixmap, pixmap, &color, &color, 0, 0); - XFreePixmap(dpy, pixmap); - return cursor; -} - -static void -dmxConsoleComputeWidthHeight(myPrivate * priv, - int *width, int *height, - double *xScale, double *yScale, - int *consWidth, int *consHeight) -{ - int screen; - Display *dpy = priv->display; - - *width = 0; - *height = 0; - *xScale = 1.0; - *yScale = 1.0; - - screen = DefaultScreen(dpy); - *consWidth = DisplayWidth(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN; - *consHeight = DisplayHeight(dpy, screen) * CONSOLE_NUM / CONSOLE_DEN; - - if (*consWidth < 1) - *consWidth = 1; - if (*consHeight < 1) - *consHeight = 1; - -#if 1 - /* Always keep the console size similar - * to the global bounding box. */ - *width = dmxGlobalWidth; - *height = dmxGlobalHeight; -#else - /* Make the console window as big as - * possible by computing the visible - * bounding box. */ - for (i = 0; i < dmxNumScreens; i++) { - if (screenInfo.screens[i]->x + screenInfo.screens[i]->width > *width) - *width = screenInfo.screens[i]->x + screenInfo.screens[i]->width; - - if (screenInfo.screens[i]->y + screenInfo.screens[i]->height > *height) - *height = screenInfo.screens[i]->y + screenInfo.screens[i]->height; - } -#endif - - if ((double) *consWidth / *width < (double) *consHeight / *height) - *xScale = *yScale = (double) *consWidth / *width; - else - *xScale = *yScale = (double) *consHeight / *height; - - *consWidth = scalex(priv, *width); - *consHeight = scaley(priv, *height); - if (*consWidth < 1) - *consWidth = 1; - if (*consHeight < 1) - *consHeight = 1; -} - -/** Re-initialized the console device described by \a pDev (after a - * reconfig). */ -void -dmxConsoleReInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - Display *dpy; - - if (!priv || !priv->initialized) - return; - dpy = priv->display; - - dmxConsoleComputeWidthHeight(priv, - &priv->width, &priv->height, - &priv->xScale, &priv->yScale, - &priv->consWidth, &priv->consHeight); - XResizeWindow(dpy, priv->window, priv->consWidth, priv->consHeight); - XFreePixmap(dpy, priv->pixmap); - priv->pixmap = XCreatePixmap(dpy, - RootWindow(dpy, DefaultScreen(dpy)), - priv->consWidth, - priv->consHeight, - DefaultDepth(dpy, DefaultScreen(dpy))); - dmxConsoleDraw(priv, 1, 1); -} - -/** Initialized the console device described by \a pDev. */ -void -dmxConsoleInit(DevicePtr pDev) -{ - GETPRIVFROMPDEV; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - int screen; - unsigned long mask; - XSetWindowAttributes attribs; - Display *dpy; - Window win; - XGCValues gcvals; - XColor color; - XClassHint class_hints; - unsigned long tmp; - - if (dmxLocal->type == DMX_LOCAL_MOUSE) - priv->mou = pDev; - if (dmxLocal->type == DMX_LOCAL_KEYBOARD) - priv->kbd = pDev; - if (priv->initialized++) - return; /* Only do once for mouse/keyboard pair */ - - if (!(dpy = priv->display = XOpenDisplay(dmxInput->name))) - dmxLog(dmxFatal, - "dmxOpenConsole: cannot open console display %s\n", - dmxInput->name); - - /* Set up defaults */ - dmxConsoleComputeWidthHeight(priv, - &priv->width, &priv->height, - &priv->xScale, &priv->yScale, - &priv->consWidth, &priv->consHeight); - - /* Private initialization using computed values or constants. */ - screen = DefaultScreen(dpy); - priv->initPointerX = scalex(priv, priv->width / 2); - priv->initPointerY = scaley(priv, priv->height / 2); - priv->eventMask = (ButtonPressMask - | ButtonReleaseMask - | PointerMotionMask - | EnterWindowMask - | LeaveWindowMask - | KeyPressMask - | KeyReleaseMask | ExposureMask | ResizeRedirectMask); - - mask = CWBackPixel | CWEventMask | CWColormap | CWOverrideRedirect; - attribs.colormap = DefaultColormap(dpy, screen); - if (XParseColor(dpy, attribs.colormap, CONSOLE_BG_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - attribs.background_pixel = color.pixel; - } - else - attribs.background_pixel = WhitePixel(dpy, screen); - - attribs.event_mask = priv->eventMask; - attribs.override_redirect = False; - - win = priv->window = XCreateWindow(dpy, - RootWindow(dpy, screen), - 0, 0, priv->consWidth, priv->consHeight, - 0, - DefaultDepth(dpy, screen), - InputOutput, - DefaultVisual(dpy, screen), - mask, &attribs); - priv->pixmap = XCreatePixmap(dpy, RootWindow(dpy, screen), - priv->consWidth, priv->consHeight, - DefaultDepth(dpy, screen)); - - /* Set up properties */ - XStoreName(dpy, win, DMX_CONSOLE_NAME); - class_hints.res_name = (char *) DMX_RES_NAME; - class_hints.res_class = (char *) DMX_RES_CLASS; - XSetClassHint(dpy, win, &class_hints); - - /* Map the window */ - XMapWindow(dpy, win); - - /* Create cursors */ - priv->cursorNormal = XCreateFontCursor(dpy, XC_circle); - priv->cursorGrabbed = XCreateFontCursor(dpy, XC_spider); - priv->cursorEmpty = dmxConsoleCreateEmptyCursor(priv); - XDefineCursor(dpy, priv->window, priv->cursorNormal); - - /* Create GC */ - mask = (GCFunction | GCPlaneMask | GCClipMask | GCForeground | - GCBackground | GCLineWidth | GCLineStyle | GCCapStyle | - GCFillStyle | GCGraphicsExposures); - gcvals.function = GXcopy; - gcvals.plane_mask = AllPlanes; - gcvals.clip_mask = None; - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_FG_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.foreground = color.pixel; - } - else - gcvals.foreground = BlackPixel(dpy, screen); - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_BG_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.background = color.pixel; - } - else - gcvals.background = WhitePixel(dpy, screen); - gcvals.line_width = 0; - gcvals.line_style = LineSolid; - gcvals.cap_style = CapNotLast; - gcvals.fill_style = FillSolid; - gcvals.graphics_exposures = False; - - priv->gc = XCreateGC(dpy, win, mask, &gcvals); - - tmp = gcvals.foreground; - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_DET_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.foreground = color.pixel; - } - else - gcvals.foreground = BlackPixel(dpy, screen); - priv->gcDet = XCreateGC(dpy, win, mask, &gcvals); - gcvals.foreground = tmp; - - tmp = gcvals.background; - gcvals.background = gcvals.foreground; - gcvals.foreground = tmp; - priv->gcRev = XCreateGC(dpy, win, mask, &gcvals); - - gcvals.background = gcvals.foreground; - if (XParseColor(dpy, attribs.colormap, CONSOLE_SCREEN_CUR_COLOR, &color) - && XAllocColor(dpy, attribs.colormap, &color)) { - gcvals.foreground = color.pixel; - } - else - gcvals.foreground = BlackPixel(dpy, screen); - priv->gcCur = XCreateGC(dpy, win, mask, &gcvals); - - dmxConsoleDraw(priv, 1, 1); - - if (dixLookupPrivate(&screenInfo.screens[0]->devPrivates, - dmxScreenPrivateKey)) - priv->next = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, - dmxScreenPrivateKey); - else - DMX_WRAP(CloseScreen, dmxCloseConsoleScreen, - priv, screenInfo.screens[0]); - dixSetPrivate(&screenInfo.screens[0]->devPrivates, dmxScreenPrivateKey, - priv); -} - -/** Fill in the \a info structure for the specified \a pDev. Only used - * for pointers. */ -void -dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIVFROMPDEV; - - info->buttonClass = 1; - dmxCommonMouGetMap(pDev, info->map, &info->numButtons); - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->minval[1] = 0; - /* max possible console window size: */ - info->maxval[0] = DisplayWidth(priv->display, DefaultScreen(priv->display)); - info->maxval[1] = - DisplayHeight(priv->display, DefaultScreen(priv->display)); - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; -} - -/** Fill in the \a info structure for the specified \a pDev. Only used - * for keyboard. */ -void -dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - dmxCommonKbdGetInfo(pDev, info); - info->keyboard = 1; - info->keyClass = 1; - dmxCommonKbdGetMap(pDev, &info->keySyms, info->modMap); - info->freemap = 1; - info->focusClass = 1; - info->kbdFeedbackClass = 1; -} - -/** Handle special console-only keys. */ -int -dmxConsoleFunctions(void *private, DMXFunctionType function) -{ - GETONLYPRIVFROMPRIVATE; - XRectangle rect; - Display *dpy = priv->display; - - switch (function) { - case DMX_FUNCTION_FINE: - if (priv->fine) { - priv->fine = 0; - dmxConsoleClearCursor(priv, priv->globalX, priv->globalY, &rect); - XSetClipRectangles(dpy, priv->gc, 0, 0, &rect, 1, Unsorted); - XCopyArea(dpy, priv->pixmap, priv->window, priv->gc, - 0, 0, priv->consWidth, priv->consHeight, 0, 0); - XSetClipMask(dpy, priv->gc, None); - - XDefineCursor(dpy, priv->window, - priv->grabbed - ? priv->cursorGrabbed : priv->cursorNormal); - XWarpPointer(dpy, priv->window, priv->window, - 0, 0, 0, 0, - scalex(priv, priv->globalX), - scaley(priv, priv->globalY)); - XSync(dpy, False); /* Not a backend display */ - } - else { - priv->fine = 1; - XRaiseWindow(dpy, priv->window); - XDefineCursor(dpy, priv->window, priv->cursorEmpty); - dmxConsoleUpdateFineCursor(priv); - } - return 1; - case DMX_FUNCTION_GRAB: - if (priv->grabbed) { - XUngrabKeyboard(dpy, CurrentTime); - XUngrabPointer(dpy, CurrentTime); - XDefineCursor(dpy, priv->window, - priv->fine ? priv->cursorEmpty : priv->cursorNormal); - } - else { - if (XGrabPointer(dpy, priv->window, True, - 0, GrabModeAsync, GrabModeAsync, priv->window, - None, CurrentTime)) { - dmxLog(dmxError, "XGrabPointer failed\n"); - return 0; - } - if (XGrabKeyboard(dpy, priv->window, True, - GrabModeAsync, GrabModeAsync, CurrentTime)) { - dmxLog(dmxError, "XGrabKeyboard failed\n"); - XUngrabPointer(dpy, CurrentTime); - return 0; - } - XDefineCursor(dpy, priv->window, - priv->fine ? priv->cursorEmpty : priv->cursorGrabbed); - } - priv->grabbed = !priv->grabbed; - if (priv->fine) - dmxConsoleUpdateFineCursor(priv); - return 1; - case DMX_FUNCTION_TERMINATE: - return 1; - default: - return 0; - } -} - -static void -dmxDump(void) -{ - int i, j; - DMXInputInfo *dmxInput; - XEvent X; - - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - myPrivate *priv = dmxLocal->private; - - while (priv - && priv->display - && XCheckTypedEvent(priv->display, MotionNotify, &X)) { - DMXDBG4("dmxDump: %s/%d threw event away %d %s\n", - dmxInput->name, j, X.type, dmxEventName(X.type)); - } - } - } -} - -/** This routine is used to warp the pointer into the console window - * from anywhere on the screen. It is used when backend and console - * input are both being taken from the same X display. */ -void -dmxConsoleCapture(DMXInputInfo * dmxInput) -{ - int i; - XEvent X; - - DMXDBG0("dmxConsoleCapture\n"); - dmxSync(NULL, TRUE); - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - myPrivate *priv = dmxLocal->private; - - if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) - continue; - if (dmxLocal->type != DMX_LOCAL_MOUSE) - continue; - if (priv->captured) - continue; - priv->captured = 2; /* Ungrab only after proximal events. */ - XRaiseWindow(priv->display, priv->window); - XSync(priv->display, False); /* Not a backend display */ - while (XCheckTypedEvent(priv->display, MotionNotify, &X)) { - DMXDBG3(" Ignoring motion to %d %d after capture on %s\n", - X.xmotion.x, X.xmotion.y, dmxInput->name); - } - XWarpPointer(priv->display, None, - priv->window, 0, 0, 0, 0, priv->curX, priv->curY); - XSync(priv->display, False); /* Not a backend display */ - dmxDump(); - if (priv->fine) - dmxConsoleUpdateFineCursor(priv); - } -} - -/** Undo the capture that was done by #dmxConsoleCapture. */ -void -dmxConsoleUncapture(DMXInputInfo * dmxInput) -{ - int i; - - DMXDBG0("dmxConsoleUncapture\n"); - dmxSync(NULL, TRUE); - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - myPrivate *priv = dmxLocal->private; - - if (dmxLocal->extType != DMX_LOCAL_TYPE_CONSOLE) - continue; - if (dmxLocal->type != DMX_LOCAL_MOUSE) - continue; - if (!priv->captured) - continue; - priv->captured = 0; - XSync(priv->display, False); /* Not a backend display */ - } -} diff --git a/hw/dmx/input/dmxconsole.h b/hw/dmx/input/dmxconsole.h deleted file mode 100644 index ea6033c3a..000000000 --- a/hw/dmx/input/dmxconsole.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for console device support. \see dmxconsole.c \see dmxcommon.c */ - -#ifndef _DMXCONSOLE_H_ -#define _DMXCONSOLE_H_ - -extern void *dmxConsoleCreatePrivate(DeviceIntPtr pDevice); -extern void dmxConsoleDestroyPrivate(void *private); -extern void dmxConsoleInit(DevicePtr pDev); -extern void dmxConsoleReInit(DevicePtr pDev); -extern void dmxConsoleMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxConsoleKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxConsoleCollectEvents(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, - DMXBlockType block); -extern int dmxConsoleFunctions(void *private, DMXFunctionType function); -extern void dmxConsoleUpdatePosition(void *private, int x, int y); -extern void dmxConsoleKbdSetCtrl(void *private, KeybdCtrl * ctrl); -extern void dmxConsoleCapture(DMXInputInfo * dmxInput); -extern void dmxConsoleUncapture(DMXInputInfo * dmxInput); -extern void dmxConsoleUpdateInfo(void *private, - DMXUpdateType, WindowPtr pWindow); - -#endif diff --git a/hw/dmx/input/dmxdetach.c b/hw/dmx/input/dmxdetach.c deleted file mode 100644 index 469f9c8d0..000000000 --- a/hw/dmx/input/dmxdetach.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright 2004 Red Hat Inc., Raleigh, 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide support and helper functions for input detach and attach. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxinputinit.h" -#include "dmxextension.h" /* For dmxInputCount */ - -/** Search for input associated with \a dmxScreen, and detach. */ -void -dmxInputDetach(DMXScreenInfo * dmxScreen, Bool reserveId) -{ - int i; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->scrnIdx == dmxScreen->index) { - dmxLogInput(dmxInput, "Detaching (%sreserved)\n", - reserveId ? "" : "not "); - dmxInput->detached = True; - return; - } - } -} diff --git a/hw/dmx/input/dmxdummy.c b/hw/dmx/input/dmxdummy.c deleted file mode 100644 index 0690177f8..000000000 --- a/hw/dmx/input/dmxdummy.c +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide mouse and keyboard that are sufficient for starting the X - * server, but that don't actually provide any events. This is useful - * for testing. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmx.h" -#include "dmxinputinit.h" -#include "dmxdummy.h" - -/** Return information about the dummy keyboard device specified in \a pDev - * into the structure pointed to by \a info. The keyboard is set up to - * have 1 valid key code that is \a NoSymbol */ -void -dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - static KeySym keyboard_mapping = NoSymbol; - - info->keyboard = 1; - info->keyClass = 1; - info->keySyms.minKeyCode = 8; - info->keySyms.maxKeyCode = 8; - info->keySyms.mapWidth = 1; - info->keySyms.map = &keyboard_mapping; - info->freemap = 0; - info->focusClass = 1; - info->kbdFeedbackClass = 1; - info->force = 1; -} - -/** Return information about the dummy mouse device specified in \a pDev - * into the structure pointed to by \a info. They mouse has 3 buttons - * and two axes. */ -void -dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - info->buttonClass = 1; - info->numButtons = 3; - info->map[0] = 1; - info->map[1] = 2; - info->map[2] = 3; - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->minval[1] = 0; - info->maxval[0] = 0; - info->maxval[1] = 0; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; -} diff --git a/hw/dmx/input/dmxdummy.h b/hw/dmx/input/dmxdummy.h deleted file mode 100644 index e3a85be95..000000000 --- a/hw/dmx/input/dmxdummy.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to dummy input device support. \see dmxdummy.c */ - -#ifndef _DMXDUMMY_H_ -#define _DMXDUMMY_H_ - -extern void dmxDummyMouGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern void dmxDummyKbdGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); - -#endif diff --git a/hw/dmx/input/dmxevents.c b/hw/dmx/input/dmxevents.c deleted file mode 100644 index a4b99cd5a..000000000 --- a/hw/dmx/input/dmxevents.c +++ /dev/null @@ -1,826 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Provide support and helper functions for enqueuing events received by - * the low-level input drivers. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_EVENTS_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxevents.h" -#include "dmxcb.h" -#include "dmxcommon.h" -#include "dmxcursor.h" -#include "dmxmotion.h" -#include "dmxmap.h" - -#include <X11/keysym.h> -#include "opaque.h" -#include "inputstr.h" -#include "inpututils.h" -#include "mipointer.h" -#include "mi.h" -#include "exglobals.h" - -#include "xkbsrv.h" -#include "XIstubs.h" - -static int dmxGlobalX, dmxGlobalY; /* Global cursor position */ -static int dmxGlobalInvalid; /* Flag indicating dmxCoreMotion - * should move the mouse anyway. */ - -#if DMX_EVENTS_DEBUG -#define DMXDBG0(f) dmxLog(dmxDebug,f) -#define DMXDBG1(f,a) dmxLog(dmxDebug,f,a) -#define DMXDBG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define DMXDBG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define DMXDBG4(f,a,b,c,d) dmxLog(dmxDebug,f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) dmxLog(dmxDebug,f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) dmxLog(dmxDebug,f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) dmxLog(dmxDebug,f,a,b,c,d,e,g,h) -#else -#define DMXDBG0(f) -#define DMXDBG1(f,a) -#define DMXDBG2(f,a,b) -#define DMXDBG3(f,a,b,c) -#define DMXDBG4(f,a,b,c,d) -#define DMXDBG5(f,a,b,c,d,e) -#define DMXDBG6(f,a,b,c,d,e,g) -#define DMXDBG7(f,a,b,c,d,e,g,h) -#endif - -static int -dmxApplyFunctions(DMXInputInfo * dmxInput, DMXFunctionType f) -{ - int i; - int rc = 0; - - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->functions) - rc += dmxInput->devs[i]->functions(dmxInput->devs[i]->private, f); - return rc; -} - -static int -dmxCheckFunctionKeys(DMXLocalInputInfoPtr dmxLocal, int type, KeySym keySym) -{ - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - -#if 1 /* hack to detect ctrl-alt-q, etc */ - static int ctrl = 0, alt = 0; - - /* keep track of ctrl/alt key status */ - if (type == KeyPress && keySym == 0xffe3) { - ctrl = 1; - } - else if (type == KeyRelease && keySym == 0xffe3) { - ctrl = 0; - } - else if (type == KeyPress && keySym == 0xffe9) { - alt = 1; - } - else if (type == KeyRelease && keySym == 0xffe9) { - alt = 0; - } - if (!ctrl || !alt) - return 0; -#else - unsigned short state = 0; - - if (dmxLocal->sendsCore) - state = dmxLocalCoreKeyboard->pDevice->key->state; - else if (dmxLocal->pDevice->key) - state = dmxLocal->pDevice->key->state; - - DMXDBG3("dmxCheckFunctionKeys: keySym=0x%04x %s state=0x%04x\n", - keySym, type == KeyPress ? "press" : "release", state); - - if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask)) - return 0; -#endif - - switch (keySym) { - case XK_g: - if (type == KeyPress) - dmxApplyFunctions(dmxInput, DMX_FUNCTION_GRAB); - return 1; - case XK_f: - if (type == KeyPress) - dmxApplyFunctions(dmxInput, DMX_FUNCTION_FINE); - return 1; - case XK_q: - if (type == KeyPress && dmxLocal->sendsCore) - if (dmxApplyFunctions(dmxInput, DMX_FUNCTION_TERMINATE)) { - dmxLog(dmxInfo, "User request for termination\n"); - dispatchException |= DE_TERMINATE; - } - return 1; - } - - return 0; -} - -DMXScreenInfo * -dmxFindFirstScreen(int x, int y) -{ - int i; - - for (i = 0; i < dmxNumScreens; i++) { - DMXScreenInfo *dmxScreen = &dmxScreens[i]; - - if (dmxOnScreen(x, y, dmxScreen)) - return dmxScreen; - } - return NULL; -} - -/** - * Enqueue a motion event. - */ -static void -enqueueMotion(DevicePtr pDev, int x, int y) -{ - GETDMXLOCALFROMPDEV; - DeviceIntPtr p = dmxLocal->pDevice; - int valuators[3]; - int detail = 0; /* XXX should this be mask of pressed buttons? */ - ValuatorMask mask; - - valuators[0] = x; - valuators[1] = y; - - valuator_mask_set_range(&mask, 0, 2, valuators); - QueuePointerEvents(p, MotionNotify, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - return; -} - -void -dmxCoreMotion(DevicePtr pDev, int x, int y, int delta, DMXBlockType block) -{ - DMXScreenInfo *dmxScreen; - DMXInputInfo *dmxInput; - ScreenPtr pScreen; - int localX; - int localY; - int i; - - if (!dmxGlobalInvalid && dmxGlobalX == x && dmxGlobalY == y) - return; - - DMXDBG5("dmxCoreMotion(%d,%d,%d) dmxGlobalX=%d dmxGlobalY=%d\n", - x, y, delta, dmxGlobalX, dmxGlobalY); - - dmxGlobalInvalid = 0; - dmxGlobalX = x; - dmxGlobalY = y; - - if (dmxGlobalX < 0) - dmxGlobalX = 0; - if (dmxGlobalY < 0) - dmxGlobalY = 0; - if (dmxGlobalX >= dmxGlobalWidth) - dmxGlobalX = dmxGlobalWidth + delta - 1; - if (dmxGlobalY >= dmxGlobalHeight) - dmxGlobalY = dmxGlobalHeight + delta - 1; - - if ((dmxScreen = dmxFindFirstScreen(dmxGlobalX, dmxGlobalY))) { - localX = dmxGlobalX - dmxScreen->rootXOrigin; - localY = dmxGlobalY - dmxScreen->rootYOrigin; - if ((pScreen = miPointerGetScreen(inputInfo.pointer)) - && pScreen->myNum == dmxScreen->index) { - /* Screen is old screen */ - if (block) - input_lock(); - if (pDev) - enqueueMotion(pDev, localX, localY); - if (block) - input_unlock(); - } - else { - /* Screen is new */ - DMXDBG4(" New screen: old=%d new=%d localX=%d localY=%d\n", - pScreen->myNum, dmxScreen->index, localX, localY); - if (block) - input_lock(); - mieqProcessInputEvents(); - miPointerSetScreen(inputInfo.pointer, dmxScreen->index, - localX, localY); - if (pDev) - enqueueMotion(pDev, localX, localY); - if (block) - input_unlock(); - } -#if 00 - miPointerGetPosition(inputInfo.pointer, &localX, &localY); - - if ((pScreen = miPointerGetScreen(inputInfo.pointer))) { - dmxGlobalX = localX + dmxScreens[pScreen->myNum].rootXOrigin; - dmxGlobalY = localY + dmxScreens[pScreen->myNum].rootYOrigin; - ErrorF("Global is now %d, %d %d, %d\n", dmxGlobalX, dmxGlobalY, - localX, localY); - DMXDBG6(" Moved to dmxGlobalX=%d dmxGlobalY=%d" - " on screen index=%d/%d localX=%d localY=%d\n", - dmxGlobalX, dmxGlobalY, - dmxScreen ? dmxScreen->index : -1, pScreen->myNum, - localX, localY); - } -#endif - } - /* Send updates down to all core input - * drivers */ - for (i = 0, dmxInput = &dmxInputs[0]; i < dmxNumInputs; i++, dmxInput++) { - int j; - - for (j = 0; j < dmxInput->numDevs; j += dmxInput->devs[j]->binding) - if (!dmxInput->detached - && dmxInput->devs[j]->sendsCore - && dmxInput->devs[j]->update_position) - dmxInput->devs[j]->update_position(dmxInput->devs[j]->private, - dmxGlobalX, dmxGlobalY); - } - if (!dmxScreen) - ProcessInputEvents(); -} - -#define DMX_MAX_AXES 32 /* Max axes reported by this routine */ -static void -dmxExtMotion(DMXLocalInputInfoPtr dmxLocal, - int *v, int firstAxis, int axesCount, - DMXMotionType type, DMXBlockType block) -{ - DeviceIntPtr pDevice = dmxLocal->pDevice; - xEvent xE[2 * DMX_MAX_AXES / 6]; - deviceKeyButtonPointer *xev = (deviceKeyButtonPointer *) xE; - deviceValuator *xv = (deviceValuator *) xev + 1; - int thisX = 0; - int thisY = 0; - int count; - ValuatorMask mask; - - memset(xE, 0, sizeof(xE)); - - if (axesCount > DMX_MAX_AXES) - axesCount = DMX_MAX_AXES; - - if ((valuator_get_mode(pDevice, 0) == Relative) && axesCount == 2) { - /* The dmx console is a relative mode - * device that sometimes reports - * absolute motion. It only has two - * axes. */ - if (type == DMX_RELATIVE) { - thisX = -v[0]; - thisY = -v[1]; - dmxLocal->lastX += thisX; - dmxLocal->lastY += thisY; - if (dmxLocal->update_position) - dmxLocal->update_position(dmxLocal->private, - dmxLocal->lastX, dmxLocal->lastY); - } - else { /* Convert to relative */ - if (dmxLocal->lastX || dmxLocal->lastY) { - thisX = v[0] - dmxLocal->lastX; - thisY = v[1] - dmxLocal->lastY; - } - dmxLocal->lastX = v[0]; - dmxLocal->lastY = v[1]; - } - v[0] = thisX; - v[1] = thisY; - } - - if (axesCount <= 6) { - /* Optimize for the common case when - * only 1 or 2 axes change. */ - xev->time = GetTimeInMillis(); - xev->type = DeviceMotionNotify; - xev->detail = 0; - xev->deviceid = pDevice->id | MORE_EVENTS; - - xv->type = DeviceValuator; - xv->deviceid = pDevice->id; - xv->num_valuators = axesCount; - xv->first_valuator = firstAxis; - switch (xv->num_valuators) { - case 6: - xv->valuator5 = v[5]; - case 5: - xv->valuator4 = v[4]; - case 4: - xv->valuator3 = v[3]; - case 3: - xv->valuator2 = v[2]; - case 2: - xv->valuator1 = v[1]; - case 1: - xv->valuator0 = v[0]; - } - count = 2; - } - else { - int i; - - for (i = 0, count = 0; i < axesCount; i += 6) { - xev->time = GetTimeInMillis(); - xev->type = DeviceMotionNotify; - xev->detail = 0; - xev->deviceid = pDevice->id | MORE_EVENTS; - xev += 2; - - xv->type = DeviceValuator; - xv->deviceid = pDevice->id; - xv->num_valuators = (i + 6 >= axesCount ? axesCount - i : 6); - xv->first_valuator = firstAxis + i; - switch (xv->num_valuators) { - case 6: - xv->valuator5 = v[i + 5]; - case 5: - xv->valuator4 = v[i + 4]; - case 4: - xv->valuator3 = v[i + 3]; - case 3: - xv->valuator2 = v[i + 2]; - case 2: - xv->valuator1 = v[i + 1]; - case 1: - xv->valuator0 = v[i + 0]; - } - xv += 2; - count += 2; - } - } - - if (block) - input_lock(); - valuator_mask_set_range(&mask, firstAxis, axesCount, v); - QueuePointerEvents(pDevice, MotionNotify, 0, POINTER_ABSOLUTE, &mask); - - if (block) - input_unlock(); -} - -static int -dmxTranslateAndEnqueueExtEvent(DMXLocalInputInfoPtr dmxLocal, - XEvent * e, DMXBlockType block) -{ - int type; - int event = -1; - XDeviceKeyEvent *ke = (XDeviceKeyEvent *) e; - XDeviceMotionEvent *me = (XDeviceMotionEvent *) e; - DeviceIntPtr pDevice = dmxLocal->pDevice; - int valuators[MAX_VALUATORS]; - ValuatorMask mask; - - if (!e) - return -1; /* No extended event passed, cannot handle */ - - if ((XID) dmxLocal->deviceId != ke->deviceid) { - /* Search for the correct dmxLocal, - * since backend and console events are - * picked up for the first device on - * that X server. */ - int i; - DMXInputInfo *dmxInput = &dmxInputs[dmxLocal->inputIdx]; - - for (i = 0; i < dmxInput->numDevs; i++) { - dmxLocal = dmxInput->devs[i]; - if ((XID) dmxLocal->deviceId == ke->deviceid) - break; - } - } - - if ((XID) dmxLocal->deviceId != ke->deviceid - || (type = dmxMapLookup(dmxLocal, e->type)) < 0) - return -1; /* No mapping, so this event is unhandled */ - - switch (type) { - case XI_DeviceValuator: - event = DeviceValuator; - break; - case XI_DeviceKeyPress: - event = KeyPress; - break; - case XI_DeviceKeyRelease: - event = KeyRelease; - break; - case XI_DeviceButtonPress: - event = ButtonPress; - break; - case XI_DeviceButtonRelease: - event = ButtonRelease; - break; - case XI_DeviceMotionNotify: - event = MotionNotify; - break; - case XI_DeviceFocusIn: - event = DeviceFocusIn; - break; - case XI_DeviceFocusOut: - event = DeviceFocusOut; - break; - case XI_ProximityIn: - event = ProximityIn; - break; - case XI_ProximityOut: - event = ProximityOut; - break; - case XI_DeviceStateNotify: - event = DeviceStateNotify; - break; - case XI_DeviceMappingNotify: - event = DeviceMappingNotify; - break; - case XI_ChangeDeviceNotify: - event = ChangeDeviceNotify; - break; - case XI_DeviceKeystateNotify: - event = DeviceStateNotify; - break; - case XI_DeviceButtonstateNotify: - event = DeviceStateNotify; - break; - } - -#define EXTRACT_VALUATORS(ke, valuators) \ - valuators[0] = ke->axis_data[0]; \ - valuators[1] = ke->axis_data[1]; \ - valuators[2] = ke->axis_data[2]; \ - valuators[3] = ke->axis_data[3]; \ - valuators[4] = ke->axis_data[4]; \ - valuators[5] = ke->axis_data[5]; \ - - switch (type) { - case XI_DeviceKeyPress: - case XI_DeviceKeyRelease: - if (block) - input_lock(); - QueueKeyboardEvents(pDevice, event, ke->keycode); - if (block) - input_unlock(); - break; - case XI_DeviceButtonPress: - case XI_DeviceButtonRelease: - EXTRACT_VALUATORS(ke, valuators); - valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, - valuators); - if (block) - input_lock(); - QueuePointerEvents(pDevice, event, ke->keycode, - POINTER_ABSOLUTE, &mask); - if (block) - input_unlock(); - break; - case XI_ProximityIn: - case XI_ProximityOut: - EXTRACT_VALUATORS(ke, valuators); - valuator_mask_set_range(&mask, ke->first_axis, ke->axes_count, - valuators); - if (block) - input_lock(); - QueueProximityEvents(pDevice, event, &mask); - if (block) - input_unlock(); - break; - - break; - - case XI_DeviceMotionNotify: - dmxExtMotion(dmxLocal, me->axis_data, me->first_axis, me->axes_count, - DMX_ABSOLUTE, block); - break; - case XI_DeviceFocusIn: - case XI_DeviceFocusOut: - case XI_DeviceStateNotify: - case XI_DeviceMappingNotify: - case XI_ChangeDeviceNotify: - case XI_DeviceKeystateNotify: - case XI_DeviceButtonstateNotify: - /* These are ignored, since DMX will - * generate its own events of these - * types, as necessary. - - * Perhaps ChangeDeviceNotify should - * generate an error, because it is - * unexpected? */ - break; - case XI_DeviceValuator: - default: - dmxLog(dmxWarning, - "XInput extension event (remote=%d -> zero-based=%d)" - " not supported yet\n", e->type, type); - return -1; - } - return 0; -} - -static int -dmxGetButtonMapping(DMXLocalInputInfoPtr dmxLocal, int button) -{ - ButtonClassPtr b = dmxLocal->pDevice->button; - - if (button > b->numButtons) { /* This shouldn't happen. */ - dmxLog(dmxWarning, "Button %d pressed, but only %d buttons?!?\n", - button, b->numButtons); - return button; - } - return b->map[button]; -} - -/** Return DMX's notion of the pointer position in the global coordinate - * space. */ -void -dmxGetGlobalPosition(int *x, int *y) -{ - *x = dmxGlobalX; - *y = dmxGlobalY; -} - -/** Invalidate the global position for #dmxCoreMotion. */ -void -dmxInvalidateGlobalPosition(void) -{ - dmxGlobalInvalid = 1; -} - -/** Enqueue a motion event for \a pDev. The \a v vector has length \a - * axesCount, and contains values for each of the axes, starting at \a - * firstAxes. - * - * The \a type of the motion may be \a DMX_RELATIVE, \a DMX_ABSOLUTE, or - * \a DMX_ABSOLUTE_CONFINED (in the latter case, the pointer will not be - * allowed to move outside the global boundaires). - * - * If \a block is set to \a DMX_BLOCK, then the input thread will be - * blocked around calls to \a enqueueMotion(). */ -void -dmxMotion(DevicePtr pDev, int *v, int firstAxes, int axesCount, - DMXMotionType type, DMXBlockType block) -{ - GETDMXLOCALFROMPDEV; - - if (!dmxLocal->sendsCore) { - dmxExtMotion(dmxLocal, v, firstAxes, axesCount, type, block); - return; - } - if (axesCount == 2) { - switch (type) { - case DMX_RELATIVE: - dmxCoreMotion(pDev, dmxGlobalX - v[0], dmxGlobalY - v[1], 0, block); - break; - case DMX_ABSOLUTE: - dmxCoreMotion(pDev, v[0], v[1], 0, block); - break; - case DMX_ABSOLUTE_CONFINED: - dmxCoreMotion(pDev, v[0], v[1], -1, block); - break; - } - } -} - -static KeySym -dmxKeyCodeToKeySym(DMXLocalInputInfoPtr dmxLocal, KeyCode keyCode) -{ - KeySym keysym = NoSymbol; - int effectiveGroup; - XkbSrvInfoPtr xkbi; - - if (!dmxLocal || !dmxLocal->pDevice || !dmxLocal->pDevice->key) - goto out; - - xkbi = dmxLocal->pDevice->key->xkbInfo; - effectiveGroup = XkbGetEffectiveGroup(xkbi, &xkbi->state, keyCode); - - if (effectiveGroup == -1) - goto out; - - keysym = XkbKeySym(xkbi->desc, keyCode, effectiveGroup); - DMXDBG2("dmxKeyCodeToKeySym: Translated keyCode=%d to keySym=0x%04x\n", - keyCode, keysym); - - out: - return keysym; -} - -static KeyCode -dmxKeySymToKeyCode(DMXLocalInputInfoPtr dmxLocal, KeySym keySym, int tryFirst) -{ - /* FIXME: this is quite ineffective, converting to a core map first and - * then extracting the info from there. It'd be better to run the actual - * xkb map */ - XkbSrvInfoPtr xkbi = dmxLocal->pDevice->key->xkbInfo; - KeySymsPtr pKeySyms = XkbGetCoreMap(dmxLocal->pDevice); - int i; - - /* Optimize for similar maps */ - if (XkbKeycodeInRange(xkbi->desc, tryFirst) - && pKeySyms->map[(tryFirst - xkbi->desc->min_key_code) - * pKeySyms->mapWidth] == keySym) - return tryFirst; - - for (i = pKeySyms->minKeyCode; i <= pKeySyms->maxKeyCode; i++) { - if (pKeySyms->map[(i - pKeySyms->minKeyCode) - * pKeySyms->mapWidth] == keySym) { - DMXDBG3("dmxKeySymToKeyCode: Translated keySym=0x%04x to" - " keyCode=%d (reverses to core keySym=0x%04x)\n", - keySym, i, dmxKeyCodeToKeySym(dmxLocalCoreKeyboard, i)); - return i; - } - } - return 0; -} - -static int -dmxFixup(DevicePtr pDev, int detail, KeySym keySym) -{ - GETDMXLOCALFROMPDEV; - int keyCode; - - if (!dmxLocal->pDevice->key) { - dmxLog(dmxWarning, "dmxFixup: not a keyboard device (%s)\n", - dmxLocal->pDevice->name); - return NoSymbol; - } - if (!keySym) - keySym = dmxKeyCodeToKeySym(dmxLocal, detail); - if (keySym == NoSymbol) - return detail; - keyCode = dmxKeySymToKeyCode(dmxLocalCoreKeyboard, keySym, detail); - - return keyCode ? keyCode : detail; -} - -/** Enqueue an event from the \a pDev device with the - * specified \a type and \a detail. If the event is a KeyPress or - * KeyRelease event, then the \a keySym is also specified. - * - * FIXME: make the code do what the comment says, or remove this comment. - * If \a block is set to \a DMX_BLOCK, then the input thread will be - * blocked around calls to dmxeqEnqueue(). */ - -void -dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, - XEvent * e, DMXBlockType block) -{ - GETDMXINPUTFROMPDEV; - DeviceIntPtr p = dmxLocal->pDevice; - int valuators[3]; - ValuatorMask mask; - - DMXDBG2("dmxEnqueue: Enqueuing type=%d detail=0x%0x\n", type, detail); - - switch (type) { - case KeyPress: - case KeyRelease: - if (!keySym) - keySym = dmxKeyCodeToKeySym(dmxLocal, detail); - if (dmxCheckFunctionKeys(dmxLocal, type, keySym)) - return; - if (dmxLocal->sendsCore && dmxLocal != dmxLocalCoreKeyboard) - detail = dmxFixup(pDev, detail, keySym); - - /*ErrorF("KEY %d sym %d\n", detail, (int) keySym); */ - QueueKeyboardEvents(p, type, detail); - return; - - case ButtonPress: - case ButtonRelease: - detail = dmxGetButtonMapping(dmxLocal, detail); - valuator_mask_zero(&mask); - QueuePointerEvents(p, type, detail, 0, &mask); - return; - - case MotionNotify: - valuators[0] = e->xmotion.x; - valuators[1] = e->xmotion.y; - valuators[2] = e->xmotion.state; /* FIXME: WTF?? */ - valuator_mask_set_range(&mask, 0, 3, valuators); - QueuePointerEvents(p, type, detail, - POINTER_ABSOLUTE | POINTER_SCREEN, &mask); - return; - - case EnterNotify: - case LeaveNotify: - case KeymapNotify: - case MappingNotify: /* This is sent because we change the - * modifier map on the backend/console - * input device so that we have complete - * control of the input device LEDs. */ - return; - default: - if (type == ProximityIn || type == ProximityOut) { - if (dmxLocal->sendsCore) - return; /* Not a core event */ - break; - } - if (type >= LASTEvent) { - if (dmxTranslateAndEnqueueExtEvent(dmxLocal, e, block)) - dmxLogInput(dmxInput, "Unhandled extension event: %d\n", type); - } - else { - dmxLogInput(dmxInput, "Unhandled event: %d (%s)\n", - type, dmxEventName(type)); - } - return; - } - -} - -/** A pointer to this routine is passed to low-level input drivers so - * that all special keychecking is unified to this file. This function - * returns 0 if no special keys have been pressed. If the user has - * requested termination of the DMX server, -1 is returned. If the user - * has requested a switch to a VT, then the (1-based) number of that VT - * is returned. */ -int -dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym) -{ - GETDMXINPUTFROMPDEV; - int vt = 0; - unsigned short state = 0; - - if (dmxLocal->sendsCore) - state = - XkbStateFieldFromRec(&dmxLocalCoreKeyboard->pDevice->key->xkbInfo-> - state); - else if (dmxLocal->pDevice->key) - state = XkbStateFieldFromRec(&dmxLocal->pDevice->key->xkbInfo->state); - - if (!dmxLocal->sendsCore) - return 0; /* Only for core devices */ - - DMXDBG2("dmxCheckSpecialKeys: keySym=0x%04x state=0x%04x\n", keySym, state); - - if ((state & (ControlMask | Mod1Mask)) != (ControlMask | Mod1Mask)) - return 0; - - switch (keySym) { - case XK_F1: - case XK_F2: - case XK_F3: - case XK_F4: - case XK_F5: - case XK_F6: - case XK_F7: - case XK_F8: - case XK_F9: - case XK_F10: - vt = keySym - XK_F1 + 1; - break; - - case XK_F11: - case XK_F12: - vt = keySym - XK_F11 + 11; - break; - - case XK_q: /* To avoid confusion */ - case XK_BackSpace: - case XK_Delete: - case XK_KP_Delete: - dmxLog(dmxInfo, "User request for termination\n"); - dispatchException |= DE_TERMINATE; - return -1; /* Terminate */ - } - - if (vt) { - dmxLog(dmxInfo, "Request to switch to VT %d\n", vt); - dmxInput->vt_switch_pending = vt; - return vt; - } - - return 0; /* Do nothing */ -} diff --git a/hw/dmx/input/dmxevents.h b/hw/dmx/input/dmxevents.h deleted file mode 100644 index 4877cf49c..000000000 --- a/hw/dmx/input/dmxevents.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright 2001 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to event processing functions. \see dmxevents.h */ - -#ifndef _DMXEVENTS_H_ -#define _DMXEVENTS_H_ - -extern void dmxMotion(DevicePtr pDev, int *v, int firstAxis, int axesCount, - DMXMotionType type, DMXBlockType block); -extern void dmxEnqueue(DevicePtr pDev, int type, int detail, KeySym keySym, - XEvent * e, DMXBlockType block); -extern int dmxCheckSpecialKeys(DevicePtr pDev, KeySym keySym); -extern void dmxInvalidateGlobalPosition(void); -#endif diff --git a/hw/dmx/input/dmxinputinit.c b/hw/dmx/input/dmxinputinit.c deleted file mode 100644 index 04e4f3d92..000000000 --- a/hw/dmx/input/dmxinputinit.c +++ /dev/null @@ -1,1350 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file provides generic input support. Functions here set up - * input and lead to the calling of low-level device drivers for - * input. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#define DMX_WINDOW_DEBUG 0 - -#include "dmxinputinit.h" -#include "dmxextension.h" /* For dmxInputCount */ - -#include "dmxdummy.h" -#include "dmxbackend.h" -#include "dmxconsole.h" -#include "dmxcommon.h" -#include "dmxevents.h" -#include "dmxmotion.h" -#include "dmxprop.h" -#include "config/dmxconfig.h" -#include "dmxcursor.h" - -#include "usb-keyboard.h" -#include "usb-mouse.h" -#include "usb-other.h" -#include "usb-common.h" - -#include "dmxarg.h" - -#include "inputstr.h" -#include "input.h" -#include "mipointer.h" -#include "windowstr.h" -#include "mi.h" -#include "xkbsrv.h" - -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "exevents.h" -#include "extinit.h" - -DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; - -static DMXLocalInputInfoRec DMXDummyMou = { - "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo -}; - -static DMXLocalInputInfoRec DMXDummyKbd = { - "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo -}; - -static DMXLocalInputInfoRec DMXBackendMou = { - "backend-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_BACKEND, 2, - dmxBackendCreatePrivate, dmxBackendDestroyPrivate, - dmxBackendInit, NULL, dmxBackendLateReInit, dmxBackendMouGetInfo, - dmxCommonMouOn, dmxCommonMouOff, dmxBackendUpdatePosition, - NULL, NULL, NULL, - dmxBackendCollectEvents, dmxBackendProcessInput, dmxBackendFunctions, NULL, - dmxCommonMouCtrl -}; - -static DMXLocalInputInfoRec DMXBackendKbd = { - "backend-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_BACKEND, - 1, /* With backend-mou or console-mou */ - dmxCommonCopyPrivate, NULL, - dmxBackendInit, NULL, NULL, dmxBackendKbdGetInfo, - dmxCommonKbdOn, dmxCommonKbdOff, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, dmxCommonKbdCtrl, dmxCommonKbdBell -}; - -static DMXLocalInputInfoRec DMXConsoleMou = { - "console-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_CONSOLE, 2, - dmxConsoleCreatePrivate, dmxConsoleDestroyPrivate, - dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleMouGetInfo, - dmxCommonMouOn, dmxCommonMouOff, dmxConsoleUpdatePosition, - NULL, NULL, NULL, - dmxConsoleCollectEvents, NULL, dmxConsoleFunctions, dmxConsoleUpdateInfo, - dmxCommonMouCtrl -}; - -static DMXLocalInputInfoRec DMXConsoleKbd = { - "console-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_CONSOLE, - 1, /* With backend-mou or console-mou */ - dmxCommonCopyPrivate, NULL, - dmxConsoleInit, dmxConsoleReInit, NULL, dmxConsoleKbdGetInfo, - dmxCommonKbdOn, dmxCommonKbdOff, NULL, - NULL, NULL, NULL, - NULL, NULL, NULL, NULL, - NULL, dmxCommonKbdCtrl, dmxCommonKbdBell -}; - -static DMXLocalInputInfoRec DMXLocalDevices[] = { - /* Dummy drivers that can compile on any OS */ -#ifdef __linux__ - /* USB drivers, currently only for - Linux, but relatively easy to port to - other OSs */ - { - "usb-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - kbdUSBInit, NULL, NULL, kbdUSBGetInfo, - kbdUSBOn, usbOff, NULL, - NULL, NULL, NULL, - kbdUSBRead, NULL, NULL, NULL, - NULL, kbdUSBCtrl}, - { - "usb-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - mouUSBInit, NULL, NULL, mouUSBGetInfo, - mouUSBOn, usbOff, NULL, - NULL, NULL, NULL, - mouUSBRead}, - { - "usb-oth", DMX_LOCAL_OTHER, DMX_LOCAL_TYPE_LOCAL, 1, - usbCreatePrivate, usbDestroyPrivate, - othUSBInit, NULL, NULL, othUSBGetInfo, - othUSBOn, usbOff, NULL, - NULL, NULL, NULL, - othUSBRead}, -#endif - { - "dummy-mou", DMX_LOCAL_MOUSE, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyMouGetInfo}, - { - "dummy-kbd", DMX_LOCAL_KEYBOARD, DMX_LOCAL_TYPE_LOCAL, 1, - NULL, NULL, NULL, NULL, NULL, dmxDummyKbdGetInfo}, - {NULL} /* Must be last */ -}; - -#if 11 /*BP*/ - void -DDXRingBell(int volume, int pitch, int duration) -{ - /* NO-OP */ -} - -/* taken from kdrive/src/kinput.c: */ -static void -dmxKbdCtrl(DeviceIntPtr pDevice, KeybdCtrl * ctrl) -{ -#if 0 - KdKeyboardInfo *ki; - - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev && ki->dixdev->id == pDevice->id) - break; - } - - if (!ki || !ki->dixdev || ki->dixdev->id != pDevice->id || !ki->driver) - return; - - KdSetLeds(ki, ctrl->leds); - ki->bellPitch = ctrl->bell_pitch; - ki->bellDuration = ctrl->bell_duration; -#endif -} - -/* taken from kdrive/src/kinput.c: */ -static void -dmxBell(int volume, DeviceIntPtr pDev, void *arg, int something) -{ -#if 0 - KeybdCtrl *ctrl = arg; - KdKeyboardInfo *ki = NULL; - - for (ki = kdKeyboards; ki; ki = ki->next) { - if (ki->dixdev && ki->dixdev->id == pDev->id) - break; - } - - if (!ki || !ki->dixdev || ki->dixdev->id != pDev->id || !ki->driver) - return; - - KdRingBell(ki, volume, ctrl->bell_pitch, ctrl->bell_duration); -#endif -} - -#endif /*BP*/ - static void -_dmxChangePointerControl(DMXLocalInputInfoPtr dmxLocal, PtrCtrl * ctrl) -{ - if (!dmxLocal) - return; - dmxLocal->mctrl = *ctrl; - if (dmxLocal->mCtrl) - dmxLocal->mCtrl(&dmxLocal->pDevice->public, ctrl); -} - -/** Change the pointer control information for the \a pDevice. If the - * device sends core events, then also change the control information - * for all of the pointer devices that send core events. */ -void -dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->detached) - continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxChangePointerControl(dmxInput->devs[j], ctrl); - } - } - else { /* Do for this device only */ - _dmxChangePointerControl(dmxLocal, ctrl); - } -} - -static void -_dmxKeyboardKbdCtrlProc(DMXLocalInputInfoPtr dmxLocal, KeybdCtrl * ctrl) -{ - dmxLocal->kctrl = *ctrl; - if (dmxLocal->kCtrl) { - dmxLocal->kCtrl(&dmxLocal->pDevice->public, ctrl); - if (dmxLocal->pDevice->kbdfeed) { - XkbEventCauseRec cause; - - XkbSetCauseUnknown(&cause); - /* Generate XKB events, as necessary */ - XkbUpdateIndicators(dmxLocal->pDevice, XkbAllIndicatorsMask, False, - NULL, &cause); - } - } -} - -/** Change the keyboard control information for the \a pDevice. If the - * device sends core events, then also change the control information - * for all of the keyboard devices that send core events. */ -void -dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->detached) - continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxKeyboardKbdCtrlProc(dmxInput->devs[j], ctrl); - } - } - else { /* Do for this device only */ - _dmxKeyboardKbdCtrlProc(dmxLocal, ctrl); - } -} - -static void -_dmxKeyboardBellProc(DMXLocalInputInfoPtr dmxLocal, int percent) -{ - if (dmxLocal->kBell) - dmxLocal->kBell(&dmxLocal->pDevice->public, - percent, - dmxLocal->kctrl.bell, - dmxLocal->kctrl.bell_pitch, - dmxLocal->kctrl.bell_duration); -} - -/** Sound the bell on the device. If the device send core events, then - * sound the bell on all of the devices that send core events. */ -void -dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - void *ctrl, int unknown) -{ - GETDMXLOCALFROMPDEVICE; - int i, j; - - if (dmxLocal->sendsCore) { /* Do for all core devices */ - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->detached) - continue; - for (j = 0; j < dmxInput->numDevs; j++) - if (dmxInput->devs[j]->sendsCore) - _dmxKeyboardBellProc(dmxInput->devs[j], percent); - } - } - else { /* Do for this device only */ - _dmxKeyboardBellProc(dmxLocal, percent); - } -} - -static void -dmxKeyboardFreeNames(XkbComponentNamesPtr names) -{ - if (names->keycodes) - XFree(names->keycodes); - if (names->types) - XFree(names->types); - if (names->compat) - XFree(names->compat); - if (names->symbols) - XFree(names->symbols); - if (names->geometry) - XFree(names->geometry); -} - -static int -dmxKeyboardOn(DeviceIntPtr pDevice, DMXLocalInitInfo * info) -{ - GETDMXINPUTFROMPDEVICE; - XkbRMLVOSet rmlvo; - - rmlvo.rules = dmxConfigGetXkbRules(); - rmlvo.model = dmxConfigGetXkbModel(); - rmlvo.layout = dmxConfigGetXkbLayout(); - rmlvo.variant = dmxConfigGetXkbVariant(); - rmlvo.options = dmxConfigGetXkbOptions(); - - XkbSetRulesDflts(&rmlvo); - if (!info->force && (dmxInput->keycodes - || dmxInput->symbols || dmxInput->geometry)) { - if (info->freenames) - dmxKeyboardFreeNames(&info->names); - info->freenames = 0; - info->names.keycodes = dmxInput->keycodes; - info->names.types = NULL; - info->names.compat = NULL; - info->names.symbols = dmxInput->symbols; - info->names.geometry = dmxInput->geometry; - - dmxLogInput(dmxInput, "XKEYBOARD: From command line: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } - else if (info->names.keycodes) { - dmxLogInput(dmxInput, "XKEYBOARD: From device: %s", - info->names.keycodes); - if (info->names.symbols && *info->names.symbols) - dmxLogInputCont(dmxInput, " %s", info->names.symbols); - if (info->names.geometry && *info->names.geometry) - dmxLogInputCont(dmxInput, " %s", info->names.geometry); - dmxLogInputCont(dmxInput, "\n"); - } - else { - dmxLogInput(dmxInput, "XKEYBOARD: Defaults: %s %s %s %s %s\n", - dmxConfigGetXkbRules(), - dmxConfigGetXkbLayout(), - dmxConfigGetXkbModel(), dmxConfigGetXkbVariant() - ? dmxConfigGetXkbVariant() : "", dmxConfigGetXkbOptions() - ? dmxConfigGetXkbOptions() : ""); - } - InitKeyboardDeviceStruct(pDevice, &rmlvo, - dmxKeyboardBellProc, dmxKeyboardKbdCtrlProc); - - if (info->freenames) - dmxKeyboardFreeNames(&info->names); - - return Success; -} - -static int -dmxDeviceOnOff(DeviceIntPtr pDevice, int what) -{ - GETDMXINPUTFROMPDEVICE; - DMXLocalInitInfo info; - int i; - Atom btn_labels[MAX_BUTTONS] = { 0 }; /* FIXME */ - Atom axis_labels[MAX_VALUATORS] = { 0 }; /* FIXME */ - - if (dmxInput->detached) - return Success; - - memset(&info, 0, sizeof(info)); - switch (what) { - case DEVICE_INIT: - if (dmxLocal->init) - dmxLocal->init(pDev); - if (dmxLocal->get_info) - dmxLocal->get_info(pDev, &info); - if (info.keyboard) { /* XKEYBOARD makes this a special case */ - dmxKeyboardOn(pDevice, &info); - break; - } - if (info.keyClass) { - XkbRMLVOSet rmlvo; - - rmlvo.rules = dmxConfigGetXkbRules(); - rmlvo.model = dmxConfigGetXkbModel(); - rmlvo.layout = dmxConfigGetXkbLayout(); - rmlvo.variant = dmxConfigGetXkbVariant(); - rmlvo.options = dmxConfigGetXkbOptions(); - - InitKeyboardDeviceStruct(pDevice, &rmlvo, dmxBell, dmxKbdCtrl); - } - if (info.buttonClass) { - InitButtonClassDeviceStruct(pDevice, info.numButtons, - btn_labels, info.map); - } - if (info.valuatorClass) { - if (info.numRelAxes && dmxLocal->sendsCore) { - InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, - axis_labels, - GetMaximumEventsNum(), Relative); - for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, axis_labels[i], - info.minval[i], info.maxval[i], - info.res[i], - info.minres[i], info.maxres[i], - Relative); - } - else if (info.numRelAxes) { - InitValuatorClassDeviceStruct(pDevice, info.numRelAxes, - axis_labels, - dmxPointerGetMotionBufferSize(), - Relative); - for (i = 0; i < info.numRelAxes; i++) - InitValuatorAxisStruct(pDevice, i, axis_labels[i], - info.minval[i], - info.maxval[i], info.res[i], - info.minres[i], info.maxres[i], - Relative); - } - else if (info.numAbsAxes) { - InitValuatorClassDeviceStruct(pDevice, info.numAbsAxes, - axis_labels, - dmxPointerGetMotionBufferSize(), - Absolute); - for (i = 0; i < info.numAbsAxes; i++) - InitValuatorAxisStruct(pDevice, i, - axis_labels[i], - info.minval[i], info.maxval[i], - info.res[i], info.minres[i], - info.maxres[i], Absolute); - } - } - if (info.focusClass) - InitFocusClassDeviceStruct(pDevice); - if (info.proximityClass) - InitProximityClassDeviceStruct(pDevice); - if (info.ptrFeedbackClass) - InitPtrFeedbackClassDeviceStruct(pDevice, dmxChangePointerControl); - if (info.intFeedbackClass || info.strFeedbackClass) - dmxLog(dmxWarning, - "Integer and string feedback not supported for %s\n", - pDevice->name); - if (!info.keyboard && (info.ledFeedbackClass || info.belFeedbackClass)) - dmxLog(dmxWarning, - "Led and bel feedback not supported for non-keyboard %s\n", - pDevice->name); - break; - case DEVICE_ON: - if (!pDev->on) { - if (dmxLocal->on) - dmxLocal->on(pDev); - pDev->on = TRUE; - } - break; - case DEVICE_OFF: - case DEVICE_CLOSE: - /* This can get called twice consecutively: once for a - * detached screen (DEVICE_OFF), and then again at server - * generation time (DEVICE_CLOSE). */ - if (pDev->on) { - if (dmxLocal->off) - dmxLocal->off(pDev); - pDev->on = FALSE; - } - break; - } - if (info.keySyms.map && info.freemap) { - XFree(info.keySyms.map); - info.keySyms.map = NULL; - } - if (info.xkb) - XkbFreeKeyboard(info.xkb, 0, True); - return Success; -} - -static void -dmxProcessInputEvents(DMXInputInfo * dmxInput) -{ - int i; - - mieqProcessInputEvents(); -#if 00 /*BP*/ - miPointerUpdate(); -#endif - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->process_input) { - dmxInput->devs[i]->process_input(dmxInput->devs[i]->private); - } - -#if 11 /*BP*/ - mieqProcessInputEvents(); -#endif -} - -static void -dmxUpdateWindowInformation(DMXInputInfo * dmxInput, - DMXUpdateType type, WindowPtr pWindow) -{ - int i; - -#ifdef PANORAMIX - if (!noPanoramiXExtension && pWindow && - pWindow->parent != screenInfo.screens[0]->root) - return; -#endif -#if DMX_WINDOW_DEBUG - { - const char *name = "Unknown"; - - switch (type) { - case DMX_UPDATE_REALIZE: - name = "Realize"; - break; - case DMX_UPDATE_UNREALIZE: - name = "Unrealize"; - break; - case DMX_UPDATE_RESTACK: - name = "Restack"; - break; - case DMX_UPDATE_COPY: - name = "Copy"; - break; - case DMX_UPDATE_RESIZE: - name = "Resize"; - break; - case DMX_UPDATE_REPARENT: - name = "Repaint"; - break; - } - dmxLog(dmxDebug, "Window %p changed: %s\n", pWindow, name); - } -#endif - - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->update_info) - dmxInput->devs[i]->update_info(dmxInput->devs[i]->private, - type, pWindow); -} - -static void -dmxCollectAll(DMXInputInfo * dmxInput) -{ - int i; - - if (dmxInput->detached) - return; - for (i = 0; i < dmxInput->numDevs; i += dmxInput->devs[i]->binding) - if (dmxInput->devs[i]->collect_events) - dmxInput->devs[i]->collect_events(&dmxInput->devs[i]->pDevice-> - public, dmxMotion, dmxEnqueue, - dmxCheckSpecialKeys, DMX_BLOCK); -} - -static void -dmxBlockHandler(void *blockData, void *timeout) -{ - DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; - static unsigned long generation = 0; - - if (generation != serverGeneration) { - generation = serverGeneration; - dmxCollectAll(dmxInput); - } -} - -static void -dmxSwitchReturn(void *p) -{ - DMXInputInfo *dmxInput = p; - int i; - - dmxLog(dmxInfo, "Returning from VT %d\n", dmxInput->vt_switched); - - if (!dmxInput->vt_switched) - dmxLog(dmxFatal, "dmxSwitchReturn called, but not switched\n"); - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i]->vt_post_switch) - dmxInput->devs[i]->vt_post_switch(dmxInput->devs[i]->private); - dmxInput->vt_switched = 0; -} - -static void -dmxWakeupHandler(void *blockData, int result) -{ - DMXInputInfo *dmxInput = &dmxInputs[(uintptr_t) blockData]; - int i; - - if (dmxInput->vt_switch_pending) { - dmxLog(dmxInfo, "Switching to VT %d\n", dmxInput->vt_switch_pending); - for (i = 0; i < dmxInput->numDevs; i++) - if (dmxInput->devs[i]->vt_pre_switch) - dmxInput->devs[i]->vt_pre_switch(dmxInput->devs[i]->private); - dmxInput->vt_switched = dmxInput->vt_switch_pending; - dmxInput->vt_switch_pending = 0; - for (i = 0; i < dmxInput->numDevs; i++) { - if (dmxInput->devs[i]->vt_switch) { - if (!dmxInput->devs[i]->vt_switch(dmxInput->devs[i]->private, - dmxInput->vt_switched, - dmxSwitchReturn, dmxInput)) - dmxSwitchReturn(dmxInput); - break; /* Only call one vt_switch routine */ - } - } - } - dmxCollectAll(dmxInput); -} - -static char * -dmxMakeUniqueDeviceName(DMXLocalInputInfoPtr dmxLocal) -{ - static int k = 0; - static int m = 0; - static int o = 0; - static unsigned long dmxGeneration = 0; - -#define LEN 32 - char *buf = malloc(LEN); - - if (dmxGeneration != serverGeneration) { - k = m = o = 0; - dmxGeneration = serverGeneration; - } - - switch (dmxLocal->type) { - case DMX_LOCAL_KEYBOARD: - snprintf(buf, LEN, "Keyboard%d", k++); - break; - case DMX_LOCAL_MOUSE: - snprintf(buf, LEN, "Mouse%d", m++); - break; - default: - snprintf(buf, LEN, "Other%d", o++); - break; - } - - return buf; -} - -static DeviceIntPtr -dmxAddDevice(DMXLocalInputInfoPtr dmxLocal) -{ - DeviceIntPtr pDevice; - Atom atom; - const char *name = NULL; - char *devname; - DMXInputInfo *dmxInput; - - if (!dmxLocal) - return NULL; - dmxInput = &dmxInputs[dmxLocal->inputIdx]; - - if (dmxLocal->sendsCore) { - if (dmxLocal->type == DMX_LOCAL_KEYBOARD && !dmxLocalCoreKeyboard) { - dmxLocal->isCore = 1; - dmxLocalCoreKeyboard = dmxLocal; - name = "keyboard"; - } - if (dmxLocal->type == DMX_LOCAL_MOUSE && !dmxLocalCorePointer) { - dmxLocal->isCore = 1; - dmxLocalCorePointer = dmxLocal; - name = "pointer"; - } - } - - if (!name) { - name = "extension"; - } - - if (!name) - dmxLog(dmxFatal, "Cannot add device %s\n", dmxLocal->name); - - pDevice = AddInputDevice(serverClient, dmxDeviceOnOff, TRUE); - if (!pDevice) { - dmxLog(dmxError, "Too many devices -- cannot add device %s\n", - dmxLocal->name); - return NULL; - } - pDevice->public.devicePrivate = dmxLocal; - dmxLocal->pDevice = pDevice; - - devname = dmxMakeUniqueDeviceName(dmxLocal); - atom = MakeAtom((char *) devname, strlen(devname), TRUE); - pDevice->type = atom; - pDevice->name = devname; - - if (dmxLocal->isCore && dmxLocal->type == DMX_LOCAL_MOUSE) { -#if 00 /*BP*/ - miRegisterPointerDevice(screenInfo.screens[0], pDevice); -#else - /* Nothing? dmxDeviceOnOff() should get called to init, right? */ -#endif - } - - if (dmxLocal->create_private) - dmxLocal->private = dmxLocal->create_private(pDevice); - - dmxLogInput(dmxInput, "Added %s as %s device called %s%s\n", - dmxLocal->name, name, devname, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore ? " [sends core events]" : "")); - - return pDevice; -} - -static DMXLocalInputInfoPtr -dmxLookupLocal(const char *name) -{ - DMXLocalInputInfoPtr pt; - - for (pt = &DMXLocalDevices[0]; pt->name; ++pt) - if (!strcmp(pt->name, name)) - return pt; /* search for device name */ - return NULL; -} - -/** Copy the local input information from \a s into a new \a devs slot - * in \a dmxInput. */ -DMXLocalInputInfoPtr -dmxInputCopyLocal(DMXInputInfo * dmxInput, DMXLocalInputInfoPtr s) -{ - DMXLocalInputInfoPtr dmxLocal = malloc(sizeof(*dmxLocal)); - - if (!dmxLocal) - dmxLog(dmxFatal, "DMXLocalInputInfoPtr: out of memory\n"); - - memcpy(dmxLocal, s, sizeof(*dmxLocal)); - dmxLocal->inputIdx = dmxInput->inputIdx; - dmxLocal->sendsCore = dmxInput->core; - dmxLocal->savedSendsCore = dmxInput->core; - dmxLocal->deviceId = -1; - - ++dmxInput->numDevs; - dmxInput->devs = reallocarray(dmxInput->devs, - dmxInput->numDevs, sizeof(*dmxInput->devs)); - dmxInput->devs[dmxInput->numDevs - 1] = dmxLocal; - - return dmxLocal; -} - -static void -dmxPopulateLocal(DMXInputInfo * dmxInput, dmxArg a) -{ - int i; - int help = 0; - DMXLocalInputInfoRec *pt; - - for (i = 1; i < dmxArgC(a); i++) { - const char *name = dmxArgV(a, i); - - if ((pt = dmxLookupLocal(name))) { - dmxInputCopyLocal(dmxInput, pt); - } - else { - if (strlen(name)) - dmxLog(dmxWarning, "Could not find a driver called %s\n", name); - ++help; - } - } - if (help) { - dmxLog(dmxInfo, "Available local device drivers:\n"); - for (pt = &DMXLocalDevices[0]; pt->name; ++pt) { - const char *type; - - switch (pt->type) { - case DMX_LOCAL_KEYBOARD: - type = "keyboard"; - break; - case DMX_LOCAL_MOUSE: - type = "pointer"; - break; - default: - type = "unknown"; - break; - } - dmxLog(dmxInfo, " %s (%s)\n", pt->name, type); - } - dmxLog(dmxFatal, "Must have valid local device driver\n"); - } -} - -int -dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, - _Xconst char *reason) -{ - return 0; -} - -static void -dmxInputScanForExtensions(DMXInputInfo * dmxInput, int doXI) -{ - XExtensionVersion *ext; - XDeviceInfo *devices; - Display *dsp; - int num; - int i, j; - XextErrorHandler handler; - - if (!(dsp = XOpenDisplay(dmxInput->name))) - return; - - /* Print out information about the XInput Extension. */ - handler = XSetExtensionErrorHandler(dmxInputExtensionErrorHandler); - ext = XGetExtensionVersion(dsp, INAME); - XSetExtensionErrorHandler(handler); - - if (!ext || ext == (XExtensionVersion *) NoSuchExtension) { - dmxLogInput(dmxInput, "%s is not available\n", INAME); - } - else { - dmxLogInput(dmxInput, "Locating devices on %s (%s version %d.%d)\n", - dmxInput->name, INAME, - ext->major_version, ext->minor_version); - devices = XListInputDevices(dsp, &num); - - XFree(ext); - ext = NULL; - - /* Print a list of all devices */ - for (i = 0; i < num; i++) { - const char *use = "Unknown"; - - switch (devices[i].use) { - case IsXPointer: - use = "XPointer"; - break; - case IsXKeyboard: - use = "XKeyboard"; - break; - case IsXExtensionDevice: - use = "XExtensionDevice"; - break; - case IsXExtensionPointer: - use = "XExtensionPointer"; - break; - case IsXExtensionKeyboard: - use = "XExtensionKeyboard"; - break; - } - dmxLogInput(dmxInput, " %2d %-10.10s %-16.16s\n", - (int) devices[i].id, - devices[i].name ? devices[i].name : "", use); - } - - /* Search for extensions */ - for (i = 0; i < num; i++) { - switch (devices[i].use) { - case IsXKeyboard: - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; - - if (dmxL->type == DMX_LOCAL_KEYBOARD && dmxL->deviceId < 0) { - dmxL->deviceId = devices[i].id; - dmxL->deviceName = (devices[i].name - ? strdup(devices[i].name) - : NULL); - } - } - break; - case IsXPointer: - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxL = dmxInput->devs[j]; - - if (dmxL->type == DMX_LOCAL_MOUSE && dmxL->deviceId < 0) { - dmxL->deviceId = devices[i].id; - dmxL->deviceName = (devices[i].name - ? xstrdup(devices[i].name) - : NULL); - } - } - break; - } - } - XFreeDeviceList(devices); - } - XCloseDisplay(dsp); -} - -/** Re-initialize all the devices described in \a dmxInput. Called from - #dmxAdjustCursorBoundaries before the cursor is redisplayed. */ -void -dmxInputReInit(DMXInputInfo * dmxInput) -{ - int i; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - if (dmxLocal->reinit) - dmxLocal->reinit(&dmxLocal->pDevice->public); - } -} - -/** Re-initialize all the devices described in \a dmxInput. Called from - #dmxAdjustCursorBoundaries after the cursor is redisplayed. */ -void -dmxInputLateReInit(DMXInputInfo * dmxInput) -{ - int i; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - if (dmxLocal->latereinit) - dmxLocal->latereinit(&dmxLocal->pDevice->public); - } -} - -/** Initialize all of the devices described in \a dmxInput. */ -void -dmxInputInit(DMXInputInfo * dmxInput) -{ - dmxArg a; - const char *name; - int i; - int doXI = 1; /* Include by default */ - int forceConsole = 0; - int doWindows = 1; /* On by default */ - int hasXkb = 0; - - a = dmxArgParse(dmxInput->name); - - name = dmxArgV(a, 0); - - if (!strcmp(name, "local")) { - dmxPopulateLocal(dmxInput, a); - } - else if (!strcmp(name, "dummy")) { - dmxInputCopyLocal(dmxInput, &DMXDummyMou); - dmxInputCopyLocal(dmxInput, &DMXDummyKbd); - dmxLogInput(dmxInput, "Using dummy input\n"); - } - else { - int found; - - for (i = 1; i < dmxArgC(a); i++) { - switch (hasXkb) { - case 1: - dmxInput->keycodes = xstrdup(dmxArgV(a, i)); - ++hasXkb; - break; - case 2: - dmxInput->symbols = xstrdup(dmxArgV(a, i)); - ++hasXkb; - break; - case 3: - dmxInput->geometry = xstrdup(dmxArgV(a, i)); - hasXkb = 0; - break; - case 0: - if (!strcmp(dmxArgV(a, i), "noxi")) - doXI = 0; - else if (!strcmp(dmxArgV(a, i), "xi")) - doXI = 1; - else if (!strcmp(dmxArgV(a, i), "console")) - forceConsole = 1; - else if (!strcmp(dmxArgV(a, i), "noconsole")) - forceConsole = 0; - else if (!strcmp(dmxArgV(a, i), "windows")) - doWindows = 1; - else if (!strcmp(dmxArgV(a, i), "nowindows")) - doWindows = 0; - else if (!strcmp(dmxArgV(a, i), "xkb")) - hasXkb = 1; - else { - dmxLog(dmxFatal, "Unknown input argument: %s\n", dmxArgV(a, i)); - } - } - } - - for (found = 0, i = 0; i < dmxNumScreens; i++) { - if (dmxPropertySameDisplay(&dmxScreens[i], name)) { - if (dmxScreens[i].shared) - dmxLog(dmxFatal, - "Cannot take input from shared backend (%s)\n", - name); - if (!dmxInput->core) { - dmxLog(dmxWarning, - "Cannot use core devices on a backend (%s)" - " as XInput devices\n", name); - } - else { - char *pt; - - for (pt = (char *) dmxInput->name; pt && *pt; pt++) - if (*pt == ',') - *pt = '\0'; - dmxInputCopyLocal(dmxInput, &DMXBackendMou); - dmxInputCopyLocal(dmxInput, &DMXBackendKbd); - dmxInput->scrnIdx = i; - dmxLogInput(dmxInput, - "Using backend input from %s\n", name); - } - ++found; - break; - } - } - if (!found || forceConsole) { - char *pt; - - if (found) - dmxInput->console = TRUE; - for (pt = (char *) dmxInput->name; pt && *pt; pt++) - if (*pt == ',') - *pt = '\0'; - dmxInputCopyLocal(dmxInput, &DMXConsoleMou); - dmxInputCopyLocal(dmxInput, &DMXConsoleKbd); - if (doWindows) { - dmxInput->windows = TRUE; - dmxInput->updateWindowInfo = dmxUpdateWindowInformation; - } - dmxLogInput(dmxInput, - "Using console input from %s (%s windows)\n", - name, doWindows ? "with" : "without"); - } - } - - dmxArgFree(a); - - /* Locate extensions we may be interested in */ - dmxInputScanForExtensions(dmxInput, doXI); - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - dmxLocal->pDevice = dmxAddDevice(dmxLocal); - } - - dmxInput->processInputEvents = dmxProcessInputEvents; - dmxInput->detached = False; - - RegisterBlockAndWakeupHandlers(dmxBlockHandler, dmxWakeupHandler, - (void *) (uintptr_t) dmxInput->inputIdx); -} - -static void -dmxInputFreeLocal(DMXLocalInputInfoRec * local) -{ - if (!local) - return; - if (local->isCore && local->type == DMX_LOCAL_MOUSE) - dmxLocalCorePointer = NULL; - if (local->isCore && local->type == DMX_LOCAL_KEYBOARD) - dmxLocalCoreKeyboard = NULL; - if (local->destroy_private) - local->destroy_private(local->private); - free(local->history); - free(local->valuators); - free((void *) local->deviceName); - local->private = NULL; - local->history = NULL; - local->deviceName = NULL; - free(local); -} - -/** Free all of the memory associated with \a dmxInput */ -void -dmxInputFree(DMXInputInfo * dmxInput) -{ - int i; - - if (!dmxInput) - return; - - free(dmxInput->keycodes); - free(dmxInput->symbols); - free(dmxInput->geometry); - - for (i = 0; i < dmxInput->numDevs; i++) { - dmxInputFreeLocal(dmxInput->devs[i]); - dmxInput->devs[i] = NULL; - } - free(dmxInput->devs); - dmxInput->devs = NULL; - dmxInput->numDevs = 0; - if (dmxInput->freename) - free((void *) dmxInput->name); - dmxInput->name = NULL; -} - -/** Log information about all of the known devices using #dmxLog(). */ -void -dmxInputLogDevices(void) -{ - int i, j; - - dmxLog(dmxInfo, "%d devices:\n", dmxGetInputCount()); - dmxLog(dmxInfo, " Id Name Classes\n"); - for (j = 0; j < dmxNumInputs; j++) { - DMXInputInfo *dmxInput = &dmxInputs[j]; - const char *pt = strchr(dmxInput->name, ','); - int len = (pt ? (size_t) (pt - dmxInput->name) - : strlen(dmxInput->name)); - - for (i = 0; i < dmxInput->numDevs; i++) { - DeviceIntPtr pDevice = dmxInput->devs[i]->pDevice; - - if (pDevice) { - dmxLog(dmxInfo, " %2d%c %-20.20s", - pDevice->id, - dmxInput->detached ? 'D' : ' ', pDevice->name); - if (pDevice->key) - dmxLogCont(dmxInfo, " key"); - if (pDevice->valuator) - dmxLogCont(dmxInfo, " val"); - if (pDevice->button) - dmxLogCont(dmxInfo, " btn"); - if (pDevice->focus) - dmxLogCont(dmxInfo, " foc"); - if (pDevice->kbdfeed) - dmxLogCont(dmxInfo, " fb/kbd"); - if (pDevice->ptrfeed) - dmxLogCont(dmxInfo, " fb/ptr"); - if (pDevice->intfeed) - dmxLogCont(dmxInfo, " fb/int"); - if (pDevice->stringfeed) - dmxLogCont(dmxInfo, " fb/str"); - if (pDevice->bell) - dmxLogCont(dmxInfo, " fb/bel"); - if (pDevice->leds) - dmxLogCont(dmxInfo, " fb/led"); - if (!pDevice->key && !pDevice->valuator && !pDevice->button - && !pDevice->focus && !pDevice->kbdfeed - && !pDevice->ptrfeed && !pDevice->intfeed - && !pDevice->stringfeed && !pDevice->bell && !pDevice->leds) - dmxLogCont(dmxInfo, " (none)"); - - dmxLogCont(dmxInfo, "\t[i%d/%*.*s", - dmxInput->inputIdx, len, len, dmxInput->name); - if (dmxInput->devs[i]->deviceId >= 0) - dmxLogCont(dmxInfo, "/id%d", (int) dmxInput->devs[i]->deviceId); - if (dmxInput->devs[i]->deviceName) - dmxLogCont(dmxInfo, "=%s", dmxInput->devs[i]->deviceName); - dmxLogCont(dmxInfo, "] %s\n", - dmxInput->devs[i]->isCore - ? "core" - : (dmxInput->devs[i]->sendsCore - ? "extension (sends core events)" : "extension")); - } - } - } -} - -/** Detach an input */ -int -dmxInputDetach(DMXInputInfo * dmxInput) -{ - int i; - - if (dmxInput->detached) - return BadAccess; - - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - dmxLogInput(dmxInput, "Detaching device id %d: %s%s\n", - dmxLocal->pDevice->id, - dmxLocal->pDevice->name, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore ? " [sends core events]" : "")); - DisableDevice(dmxLocal->pDevice, TRUE); - } - dmxInput->detached = True; - dmxInputLogDevices(); - return 0; -} - -/** Search for input associated with \a dmxScreen, and detach. */ -void -dmxInputDetachAll(DMXScreenInfo * dmxScreen) -{ - int i; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - if (dmxInput->scrnIdx == dmxScreen->index) - dmxInputDetach(dmxInput); - } -} - -/** Search for input associated with \a deviceId, and detach. */ -int -dmxInputDetachId(int id) -{ - DMXInputInfo *dmxInput = dmxInputLocateId(id); - - if (!dmxInput) - return BadValue; - - return dmxInputDetach(dmxInput); -} - -DMXInputInfo * -dmxInputLocateId(int id) -{ - int i, j; - - for (i = 0; i < dmxNumInputs; i++) { - DMXInputInfo *dmxInput = &dmxInputs[i]; - - for (j = 0; j < dmxInput->numDevs; j++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[j]; - - if (dmxLocal->pDevice->id == id) - return dmxInput; - } - } - return NULL; -} - -static int -dmxInputAttachNew(DMXInputInfo * dmxInput, int *id) -{ - dmxInputInit(dmxInput); - InitAndStartDevices(); - if (id && dmxInput->devs) - *id = dmxInput->devs[0]->pDevice->id; - dmxInputLogDevices(); - return 0; -} - -static int -dmxInputAttachOld(DMXInputInfo * dmxInput, int *id) -{ - int i; - - dmxInput->detached = False; - for (i = 0; i < dmxInput->numDevs; i++) { - DMXLocalInputInfoPtr dmxLocal = dmxInput->devs[i]; - - if (id) - *id = dmxLocal->pDevice->id; - dmxLogInput(dmxInput, - "Attaching device id %d: %s%s\n", - dmxLocal->pDevice->id, - dmxLocal->pDevice->name, - dmxLocal->isCore - ? " [core]" - : (dmxLocal->sendsCore ? " [sends core events]" : "")); - EnableDevice(dmxLocal->pDevice, TRUE); - } - dmxInputLogDevices(); - return 0; -} - -int -dmxInputAttachConsole(const char *name, int isCore, int *id) -{ - DMXInputInfo *dmxInput; - int i; - - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx == -1 - && dmxInput->detached && !strcmp(dmxInput->name, name)) { - /* Found match */ - dmxLogInput(dmxInput, "Reattaching detached console input\n"); - return dmxInputAttachOld(dmxInput, id); - } - } - - /* No match found */ - dmxInput = dmxConfigAddInput(xstrdup(name), isCore); - dmxInput->freename = TRUE; - dmxLogInput(dmxInput, "Attaching new console input\n"); - return dmxInputAttachNew(dmxInput, id); -} - -int -dmxInputAttachBackend(int physicalScreen, int isCore, int *id) -{ - DMXInputInfo *dmxInput; - DMXScreenInfo *dmxScreen; - int i; - - if (physicalScreen < 0 || physicalScreen >= dmxNumScreens) - return BadValue; - for (i = 0; i < dmxNumInputs; i++) { - dmxInput = &dmxInputs[i]; - if (dmxInput->scrnIdx != -1 && dmxInput->scrnIdx == physicalScreen) { - /* Found match */ - if (!dmxInput->detached) - return BadAccess; /* Already attached */ - dmxScreen = &dmxScreens[physicalScreen]; - if (!dmxScreen->beDisplay) - return BadAccess; /* Screen detached */ - dmxLogInput(dmxInput, "Reattaching detached backend input\n"); - return dmxInputAttachOld(dmxInput, id); - } - } - /* No match found */ - dmxScreen = &dmxScreens[physicalScreen]; - if (!dmxScreen->beDisplay) - return BadAccess; /* Screen detached */ - dmxInput = dmxConfigAddInput(dmxScreen->name, isCore); - dmxLogInput(dmxInput, "Attaching new backend input\n"); - return dmxInputAttachNew(dmxInput, id); -} diff --git a/hw/dmx/input/dmxinputinit.h b/hw/dmx/input/dmxinputinit.h deleted file mode 100644 index 27e93561e..000000000 --- a/hw/dmx/input/dmxinputinit.h +++ /dev/null @@ -1,284 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface for low-level input support. \see dmxinputinit.c */ - -#ifndef _DMXINPUTINIT_H_ -#define _DMXINPUTINIT_H_ - -#include "dmx.h" -#include "dmxinput.h" -#include "dmxlog.h" - -#define DMX_LOCAL_DEFAULT_KEYBOARD "kbd" -#define DMX_LOCAL_DEFAULT_POINTER "ps2" -#define DMX_MAX_BUTTONS 256 -#define DMX_MOTION_SIZE 256 -#define DMX_MAX_VALUATORS 32 -#define DMX_MAX_AXES 32 -#define DMX_MAX_XINPUT_EVENT_TYPES 100 -#define DMX_MAP_ENTRIES 16 /* Must be a power of 2 */ -#define DMX_MAP_MASK (DMX_MAP_ENTRIES - 1) - -typedef enum { - DMX_FUNCTION_GRAB, - DMX_FUNCTION_TERMINATE, - DMX_FUNCTION_FINE -} DMXFunctionType; - -typedef enum { - DMX_LOCAL_HIGHLEVEL, - DMX_LOCAL_KEYBOARD, - DMX_LOCAL_MOUSE, - DMX_LOCAL_OTHER -} DMXLocalInputType; - -typedef enum { - DMX_LOCAL_TYPE_LOCAL, - DMX_LOCAL_TYPE_CONSOLE, - DMX_LOCAL_TYPE_BACKEND, - DMX_LOCAL_TYPE_COMMON -} DMXLocalInputExtType; - -typedef enum { - DMX_RELATIVE, - DMX_ABSOLUTE, - DMX_ABSOLUTE_CONFINED -} DMXMotionType; - -/** Stores information from low-level device that is used to initialize - * the device at the dix level. */ -typedef struct _DMXLocalInitInfo { - int keyboard; /**< Non-zero if the device is a keyboard */ - - int keyClass; /**< Non-zero if keys are present */ - KeySymsRec keySyms; /**< Key symbols */ - int freemap; /**< If non-zero, free keySyms.map */ - CARD8 modMap[MAP_LENGTH]; /**< Modifier map */ - XkbDescPtr xkb; /**< XKB description */ - XkbComponentNamesRec names; /**< XKB component names */ - int freenames; /**< Non-zero if names should be free'd */ - int force; /**< Do not allow command line override */ - - int buttonClass; /**< Non-zero if buttons are present */ - int numButtons; /**< Number of buttons */ - unsigned char map[DMX_MAX_BUTTONS]; /**< Button map */ - - int valuatorClass; /**< Non-zero if valuators are - * present */ - int numRelAxes; /**< Number of relative axes */ - int numAbsAxes; /**< Number of absolute axes */ - int minval[DMX_MAX_AXES]; /**< Minimum values */ - int maxval[DMX_MAX_AXES]; /**< Maximum values */ - int res[DMX_MAX_AXES]; /**< Resolution */ - int minres[DMX_MAX_AXES]; /**< Minimum resolutions */ - int maxres[DMX_MAX_AXES]; /**< Maximum resolutions */ - - int focusClass; /**< Non-zero if device can - * cause focus */ - int proximityClass; /**< Non-zero if device - * causes proximity events */ - int kbdFeedbackClass; /**< Non-zero if device has - * keyboard feedback */ - int ptrFeedbackClass; /**< Non-zero if device has - * pointer feedback */ - int ledFeedbackClass; /**< Non-zero if device has - * LED indicators */ - int belFeedbackClass; /**< Non-zero if device has a - * bell */ - int intFeedbackClass; /**< Non-zero if device has - * integer feedback */ - int strFeedbackClass; /**< Non-zero if device has - * string feedback */ - - int maxSymbols; /**< Maximum symbols */ - int maxSymbolsSupported; /**< Maximum symbols supported */ - KeySym *symbols; /**< Key symbols */ -} DMXLocalInitInfo, *DMXLocalInitInfoPtr; - -typedef void *(*dmxCreatePrivateProcPtr) (DeviceIntPtr); -typedef void (*dmxDestroyPrivateProcPtr) (void *); - -typedef void (*dmxInitProcPtr) (DevicePtr); -typedef void (*dmxReInitProcPtr) (DevicePtr); -typedef void (*dmxLateReInitProcPtr) (DevicePtr); -typedef void (*dmxGetInfoProcPtr) (DevicePtr, DMXLocalInitInfoPtr); -typedef int (*dmxOnProcPtr) (DevicePtr); -typedef void (*dmxOffProcPtr) (DevicePtr); -typedef void (*dmxUpdatePositionProcPtr) (void *, int x, int y); - -typedef void (*dmxVTPreSwitchProcPtr) (void *); /* Turn I/O Off */ -typedef void (*dmxVTPostSwitchProcPtr) (void *); /* Turn I/O On */ -typedef void (*dmxVTSwitchReturnProcPtr) (void *); -typedef int (*dmxVTSwitchProcPtr) (void *, int vt, - dmxVTSwitchReturnProcPtr, void *); - -typedef void (*dmxMotionProcPtr) (DevicePtr, - int *valuators, - int firstAxis, - int axesCount, - DMXMotionType type, DMXBlockType block); -typedef void (*dmxEnqueueProcPtr) (DevicePtr, int type, int detail, - KeySym keySym, XEvent * e, - DMXBlockType block); -typedef int (*dmxCheckSpecialProcPtr) (DevicePtr, KeySym keySym); -typedef void (*dmxCollectEventsProcPtr) (DevicePtr, - dmxMotionProcPtr, - dmxEnqueueProcPtr, - dmxCheckSpecialProcPtr, DMXBlockType); -typedef void (*dmxProcessInputProcPtr) (void *); -typedef void (*dmxUpdateInfoProcPtr) (void *, DMXUpdateType, WindowPtr); -typedef int (*dmxFunctionsProcPtr) (void *, DMXFunctionType); - -typedef void (*dmxKBCtrlProcPtr) (DevicePtr, KeybdCtrl * ctrl); -typedef void (*dmxMCtrlProcPtr) (DevicePtr, PtrCtrl * ctrl); -typedef void (*dmxKBBellProcPtr) (DevicePtr, int percent, - int volume, int pitch, int duration); - -/** Stores a mapping between the device id on the remote X server and - * the id on the DMX server */ -typedef struct _DMXEventMap { - int remote; /**< Event number on remote X server */ - int server; /**< Event number (unbiased) on DMX server */ -} DMXEventMap; - -/** This is the device-independent structure used by the low-level input - * routines. The contents are not exposed to top-level .c files (except - * dmxextensions.c). \see dmxinput.h \see dmxextensions.c */ -typedef struct _DMXLocalInputInfo { - const char *name; /**< Device name */ - DMXLocalInputType type; /**< Device type */ - DMXLocalInputExtType extType; /**< Extended device type */ - int binding; /**< Count of how many consecutive - * structs are bound to the same - * device */ - - /* Low-level (e.g., keyboard/mouse drivers) */ - - dmxCreatePrivateProcPtr create_private; /**< Create - * device-dependent - * private */ - dmxDestroyPrivateProcPtr destroy_private; /**< Destroy - * device-dependent - * private */ - dmxInitProcPtr init; /**< Initialize device */ - dmxReInitProcPtr reinit; /**< Reinitialize device - * (during a - * reconfiguration) */ - dmxLateReInitProcPtr latereinit; /**< Reinitialize a device - * (called very late - * during a - * reconfiguration) */ - dmxGetInfoProcPtr get_info; /**< Get device information */ - dmxOnProcPtr on; /**< Turn device on */ - dmxOffProcPtr off; /**< Turn device off */ - dmxUpdatePositionProcPtr update_position; /**< Called when another - * device updates the - * cursor position */ - dmxVTPreSwitchProcPtr vt_pre_switch; /**< Called before a VT switch */ - dmxVTPostSwitchProcPtr vt_post_switch; /**< Called after a VT switch */ - dmxVTSwitchProcPtr vt_switch; /**< Causes a VT switch */ - - dmxCollectEventsProcPtr collect_events; /**< Collect and enqueue - * events from the - * device*/ - dmxProcessInputProcPtr process_input; /**< Process event (from - * queue) */ - dmxFunctionsProcPtr functions; - dmxUpdateInfoProcPtr update_info; /**< Update window layout - * information */ - - dmxMCtrlProcPtr mCtrl; /**< Pointer control */ - dmxKBCtrlProcPtr kCtrl; /**< Keyboard control */ - dmxKBBellProcPtr kBell; /**< Bell control */ - - void *private; /**< Device-dependent private */ - int isCore; /**< Is a DMX core device */ - int sendsCore; /**< Sends DMX core events */ - KeybdCtrl kctrl; /**< Keyboard control */ - PtrCtrl mctrl; /**< Pointer control */ - - DeviceIntPtr pDevice; /**< X-level device */ - int inputIdx; /**< High-level index */ - int lastX, lastY; /**< Last known position; - * for XInput in - * dmxevents.c */ - - int head; /**< XInput motion history - * head */ - int tail; /**< XInput motion history - * tail */ - unsigned long *history; /**< XInput motion history */ - int *valuators; /**< Cache of previous values */ - - /* for XInput ChangePointerDevice */ - int (*savedMotionProc) (DeviceIntPtr, - xTimecoord *, - unsigned long, unsigned long, ScreenPtr); - int savedMotionEvents; /**< Saved motion events */ - int savedSendsCore; /**< Saved sends-core flag */ - - DMXEventMap map[DMX_MAP_ENTRIES]; /**< XInput device id map */ - int mapOptimize; /**< XInput device id - * map - * optimization */ - - long deviceId; /**< device id on remote side, - * if any */ - const char *deviceName; /**< device name on remote - * side, if any */ -} DMXLocalInputInfoRec; - -extern DMXLocalInputInfoPtr dmxLocalCorePointer, dmxLocalCoreKeyboard; - -extern void dmxLocalInitInput(DMXInputInfo * dmxInput); -extern DMXLocalInputInfoPtr dmxInputCopyLocal(DMXInputInfo * dmxInput, - DMXLocalInputInfoPtr s); - -extern void dmxChangePointerControl(DeviceIntPtr pDevice, PtrCtrl * ctrl); -extern void dmxKeyboardKbdCtrlProc(DeviceIntPtr pDevice, KeybdCtrl * ctrl); -extern void dmxKeyboardBellProc(int percent, DeviceIntPtr pDevice, - void *ctrl, int unknown); - -extern int dmxInputExtensionErrorHandler(Display * dsp, _Xconst char *name, - _Xconst char *reason); - -extern int dmxInputDetach(DMXInputInfo * dmxInput); -extern void dmxInputDetachAll(DMXScreenInfo * dmxScreen); -extern int dmxInputDetachId(int id); -extern DMXInputInfo *dmxInputLocateId(int id); -extern int dmxInputAttachConsole(const char *name, int isCore, int *id); -extern int dmxInputAttachBackend(int physicalScreen, int isCore, int *id); - -#endif diff --git a/hw/dmx/input/dmxmap.c b/hw/dmx/input/dmxmap.c deleted file mode 100644 index 1a8d4c937..000000000 --- a/hw/dmx/input/dmxmap.c +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * - * This file implements a mapping from remote XInput event types to Xdmx - * XInput event types. - * - * The exglobals.h file defines global server-side variables with names - * Device* to be integers that hold the value of the type of the - * server-side XInput extension event. - * - * The client-side X11/extensions/XInput.h file defines macros with THE - * EXACT SAME Device* names! - * - * Using those macros to extract remote server event type values from - * the (opaque) XDevice structure is appropriate, but makes a direct - * mapping to the Device* integers impossible. So we use the normalized - * XI_Device* names for these routines. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "dmxinputinit.h" -#include "dmxmap.h" - -/** Create a mapping from \a remoteEvent to \a serverEvent. The \a - * remoteEvent is the type returned from the remote server. The \a - * serverEvent is from the XI_* list of events in - * include/extensions/XIproto.h. */ -void -dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, int remoteEvent, int serverEvent) -{ - int hash = remoteEvent & DMX_MAP_MASK; - int i; - - /* Return if this has already been mapped */ - if (dmxLocal->map[hash].remote == remoteEvent - && dmxLocal->map[hash].server == serverEvent) - return; - - if (dmxLocal->map[hash].remote) { - dmxLocal->mapOptimize = 0; - for (i = 0; i < DMX_MAP_ENTRIES; i++) { - if (!dmxLocal->map[i].remote) { - dmxLocal->map[i].remote = remoteEvent; - dmxLocal->map[i].server = serverEvent; - return; - } - } - dmxLog(dmxWarning, - "Out of map entries, cannot map remove event type %d\n", - remoteEvent); - } - else { - dmxLocal->map[hash].remote = remoteEvent; - dmxLocal->map[hash].server = serverEvent; - } -} - -/** Remove all mappings there were inserted with #dmxMapInsert. */ -void -dmxMapClear(DMXLocalInputInfoPtr dmxLocal) -{ - int i; - - for (i = 0; i < DMX_MAP_ENTRIES; i++) - dmxLocal->map[i].remote = 0; - dmxLocal->mapOptimize = 1; -} - -/** Lookup a mapping for \a remoteEvent. The \a remoteEvent is the type - * returned from the remote server. The return value is that which was - * passed into #dmxMapInsert (i.e., a value from the XI_* list in - * include/extensions/XIproto.h). If a mapping is not available, -1 is - * returned. */ -int -dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent) -{ - int hash = remoteEvent & DMX_MAP_MASK; - int serverEvent = -1; - int i; - - if (dmxLocal->mapOptimize && dmxLocal->map[hash].remote == remoteEvent) { - serverEvent = dmxLocal->map[hash].server; - } - else { - for (i = 0; i < DMX_MAP_ENTRIES; i++) - if (dmxLocal->map[i].remote == remoteEvent) { - serverEvent = dmxLocal->map[hash].server; - break; - } - } - - return serverEvent; -} diff --git a/hw/dmx/input/dmxmap.h b/hw/dmx/input/dmxmap.h deleted file mode 100644 index 62da1ed36..000000000 --- a/hw/dmx/input/dmxmap.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright 2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - */ - -/** \file - * Interface to XInput event mapping support. \see dmxmap.c */ - -#ifndef _DMXMAP_H_ -#define _DMXMAP_H_ -extern void dmxMapInsert(DMXLocalInputInfoPtr dmxLocal, - int remoteEvent, int serverEvent); -extern void dmxMapClear(DMXLocalInputInfoPtr dmxLocal); -extern int dmxMapLookup(DMXLocalInputInfoPtr dmxLocal, int remoteEvent); -#endif diff --git a/hw/dmx/input/dmxmotion.c b/hw/dmx/input/dmxmotion.c deleted file mode 100644 index 7f2cb8ed9..000000000 --- a/hw/dmx/input/dmxmotion.c +++ /dev/null @@ -1,148 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * This file provides functions similar to miPointerGetMotionEvents and - * miPointerPutMotionEvents, with the exception that devices with more - * than two axes are fully supported. These routines may be used only - * for motion buffers for extension devices, and are \a not compatible - * replacements for the mi routines. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "inputstr.h" -#include "dmxinputinit.h" -#include "dmxcommon.h" -#include "dmxmotion.h" - -#define OFFSET(offset,element) ((offset) * (numAxes + 1) + (element)) - -/** Return size of motion buffer. \see DMX_MOTION_SIZE */ -int -dmxPointerGetMotionBufferSize(void) -{ - return DMX_MOTION_SIZE; -} - -/** This routine performs the same function as \a miPointerGetMotionEvents: - * the events in the motion history that are between the start and stop - * times (in mS) are placed in the coords vector, and the count of the - * number of items so placed is returned. This routine is called from - * dix/devices.c so that coords can hold valuator->numMotionEvents - * events. This routine is called from \a Xi/gtmotion.c with coords large - * enough to hold the same number of events in a variable-length - * extended \a xTimecoord structure. This provides sufficient data for the - * \a XGetDeviceMotionEvents library call, and would be identical to - * \a miPointerGetMotionEvents for devices with only 2 axes (i.e., core - * pointers) if \a xTimecoord used 32bit integers. - * - * Because DMX uses the mi* routines for all core devices, this routine - * only has to support extension devices using the polymorphic coords. - * Because compatibility with miPointerGetMotionEvents is not possible, - * it is not provided. */ -int -dmxPointerGetMotionEvents(DeviceIntPtr pDevice, - xTimecoord * coords, - unsigned long start, - unsigned long stop, ScreenPtr pScreen) -{ - GETDMXLOCALFROMPDEVICE; - int numAxes = pDevice->valuator->numAxes; - unsigned long *c = (unsigned long *) coords; - int count = 0; - int i, j; - - if (!dmxLocal->history) - return 0; - for (i = dmxLocal->head; i != dmxLocal->tail;) { - if (dmxLocal->history[OFFSET(i, 0)] >= stop) - break; - if (dmxLocal->history[OFFSET(i, 0)] >= start) { - for (j = 0; j < numAxes + 1; j++) - c[OFFSET(count, j)] = dmxLocal->history[OFFSET(i, j)]; - ++count; - } - if (++i >= DMX_MOTION_SIZE) - i = 0; - } - return count; -} - -/** This routine adds an event to the motion history. A similar - * function is performed by miPointerMove for the mi versions of these - * routines. */ -void -dmxPointerPutMotionEvent(DeviceIntPtr pDevice, - int firstAxis, int axesCount, int *v, - unsigned long time) -{ - GETDMXLOCALFROMPDEVICE; - int numAxes = pDevice->valuator->numAxes; - int i; - - if (!dmxLocal->history) { - dmxLocal->history = xallocarray(numAxes + 1, - sizeof(*dmxLocal->history) * DMX_MOTION_SIZE); - dmxLocal->head = 0; - dmxLocal->tail = 0; - dmxLocal->valuators = calloc(sizeof(*dmxLocal->valuators), numAxes); - } - else { - if (++dmxLocal->tail >= DMX_MOTION_SIZE) - dmxLocal->tail = 0; - if (dmxLocal->head == dmxLocal->tail) - if (++dmxLocal->head >= DMX_MOTION_SIZE) - dmxLocal->head = 0; - } - - dmxLocal->history[OFFSET(dmxLocal->tail, 0)] = time; - - /* Initialize the data from the known - * values (if Absolute) or to zero (if - * Relative) */ - for (i = 0; i < numAxes; i++) { - if (pDevice->valuator->axes[i].mode == Absolute) - dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] - = dmxLocal->valuators[i]; - else - dmxLocal->history[OFFSET(dmxLocal->tail, i + 1)] = 0; - } - - for (i = firstAxis; i < axesCount; i++) { - dmxLocal->history[OFFSET(dmxLocal->tail, i + i)] - = (unsigned long) v[i - firstAxis]; - dmxLocal->valuators[i] = v[i - firstAxis]; - } -} diff --git a/hw/dmx/input/dmxmotion.h b/hw/dmx/input/dmxmotion.h deleted file mode 100644 index 5ccdbe4ad..000000000 --- a/hw/dmx/input/dmxmotion.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to functions supporting motion events. \see dmxmotion.c */ - -#ifndef _DMXMOTION_H_ -#define _DMXMOTION_H_ - -extern int dmxPointerGetMotionBufferSize(void); -extern int dmxPointerGetMotionEvents(DeviceIntPtr pDevice, - xTimecoord * coords, - unsigned long start, - unsigned long stop, ScreenPtr pScreen); -extern void dmxPointerPutMotionEvent(DeviceIntPtr pDevice, - int firstAxis, int axesCount, int *v, - unsigned long time); -#endif diff --git a/hw/dmx/input/dmxxinput.c b/hw/dmx/input/dmxxinput.c deleted file mode 100644 index fccab5ff1..000000000 --- a/hw/dmx/input/dmxxinput.c +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This file implements support required by the XINPUT extension. - */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include <X11/X.h> -#include <X11/Xproto.h> -#include "inputstr.h" -#include <X11/extensions/XI.h> -#include <X11/extensions/XIproto.h> -#include "XIstubs.h" - -#include "mipointer.h" -#include "dmxinputinit.h" -#include "exevents.h" - -/** Set device mode to \a mode. This is not implemented. */ -int -SetDeviceMode(ClientPtr client, DeviceIntPtr dev, int mode) -{ - return BadMatch; -} - -/** Set device valuators. This is not implemented. */ -int -SetDeviceValuators(ClientPtr client, - DeviceIntPtr dev, - int *valuators, int first_valuator, int num_valuators) -{ - return BadMatch; -} - -/** Change device control. This is not implemented. */ -int -ChangeDeviceControl(ClientPtr client, DeviceIntPtr dev, xDeviceCtl * control) -{ - return BadMatch; -} diff --git a/hw/dmx/input/meson.build b/hw/dmx/input/meson.build deleted file mode 100644 index cf058adfd..000000000 --- a/hw/dmx/input/meson.build +++ /dev/null @@ -1,32 +0,0 @@ -srcs_dmx_input = [ - 'dmxdummy.c', - 'dmxbackend.c', - 'dmxconsole.c', - 'dmxcommon.c', - 'dmxinputinit.c', - 'dmxarg.c', - 'dmxevents.c', - 'dmxxinput.c', - 'dmxmotion.c', - 'dmxmap.c', - 'ChkNotMaskEv.c', -] - -if cc.has_header('linux/input.h') - srcs_dmx_input += [ - 'usb-keyboard.c', - 'usb-mouse.c', - 'usb-other.c', - 'usb-common.c', - ] -endif - -dmx_input = static_library('dmx_input', - srcs_dmx_input, - include_directories: [ - inc, - include_directories('../') - ], - dependencies: common_dep, - c_args: '-DHAVE_DMX_CONFIG_H', -) diff --git a/hw/dmx/input/usb-common.c b/hw/dmx/input/usb-common.c deleted file mode 100644 index 8c62abafb..000000000 --- a/hw/dmx/input/usb-common.c +++ /dev/null @@ -1,492 +0,0 @@ -/* - * Copyright 2002-2003 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * Routines that are common between \a usb-keyboard.c, \a usb-mouse.c, and - * \a usb-other.c */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "usb-private.h" - -#define USB_COMMON_DEBUG 1 - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "usb-mouse.h" - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define GETNAME ((DMXLocalInputInfoPtr)(pDevice->public.devicePrivate)) \ - ->name - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define LOG1INPUT(p,f,a) dmxLogInput(p->dmxInput,f,a) -#define LOG3INPUT(p,f,a,b,c) dmxLogInput(p->dmxInput,f,a,b,c) -#define LOG5INPUT(p,f,a,b,c,d,e) dmxLogInput(p->dmxInput,f,a,b,c,d,e) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -/** Read an event from the \a pDev device. If the event is a motion - * event, enqueue it with the \a motion function. Otherwise, enqueue - * the event with the \a enqueue function. The \a block type is passed - * to the functions so that they may block the input thread as appropriate - * to the caller of this function. - * - * Since USB devices return EV_KEY events for buttons and keys, \a - * minButton is used to decide if a Button or Key event should be - * queued.*/ -void -usbRead(DevicePtr pDev, - MOTIONPROC motion, ENQUEUEPROC enqueue, int minButton, BLOCK block) -{ - GETPRIV; - struct input_event raw; - int v[DMX_MAX_AXES]; - int axis; - -#define PRESS(b) \ - do { \ - enqueue(pDev, ButtonPress, 0, 0, NULL, block); \ - } while (0) - -#define RELEASE(b) \ - do { \ - enqueue(pDev, ButtonRelease, 0, 0, NULL, block); \ - } while (0) - - while (read(priv->fd, &raw, sizeof(raw)) > 0) { -#if USB_COMMON_DEBUG > 1 - LOG3("USB: type = %d, code = 0x%02x, value = %d\n", - raw.type, raw.code, raw.value); -#endif - switch (raw.type) { - case EV_KEY: - /* raw.value = 1 for first, 2 for repeat */ - if (raw.code > minButton) { - if (raw.value) - PRESS((raw.code & 0x0f) + 1); - else - RELEASE((raw.code & 0x0f) + 1); - } - else { - enqueue(pDev, raw.value ? KeyPress : KeyRelease, - 0, 0, NULL, block); - } - break; - case EV_REL: - switch (raw.code) { - case REL_X: - v[0] = -raw.value; - v[1] = 0; - motion(pDev, v, 0, 2, DMX_RELATIVE, block); - break; - case REL_Y: - v[0] = 0; - v[1] = -raw.value; - motion(pDev, v, 0, 2, DMX_RELATIVE, block); - break; - case REL_WHEEL: - if ((int) raw.value > 0) { - PRESS(4); - RELEASE(4); - } - else if ((int) raw.value < 0) { - PRESS(5); - RELEASE(5); - } - break; - default: - memset(v, 0, sizeof(v)); - axis = priv->relmap[raw.code]; - v[axis] = raw.value; - motion(pDev, v, axis, 1, DMX_RELATIVE, block); - } - break; - case EV_ABS: - memset(v, 0, sizeof(v)); - axis = priv->absmap[raw.code]; - v[axis] = raw.value; - motion(pDev, v, axis, 1, DMX_ABSOLUTE, block); - break; - } - } -} - -#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8))) -#define test_bits(bit) (bits[(bit)/8] & (1 << ((bit)%8))) - -static void -usbPrint(myPrivate * priv, const char *filename, const char *devname, int fd) -{ - int j, k; - DeviceIntPtr pDevice = priv->pDevice; - unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that - * KEY_MAX is greater than - * REL_MAX, ABS_MAX, SND_MAX, and - * LED_MAX. */ - - LOG3INPUT(priv, "%s (%s) using %s\n", pDevice->name, GETNAME, filename); - LOG1INPUT(priv, " %s\n", devname); - for (j = 0; j < EV_MAX; j++) { - if (test_bit(j)) { - const char *type = "unknown"; - char extra[256]; /* FIXME: may cause buffer overflow */ - - extra[0] = '\0'; - switch (j) { - case EV_KEY: - type = "keys/buttons"; - break; - case EV_REL: - type = "relative"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits); - for (k = 0; k < REL_MAX; k++) { - if (test_bits(k)) - switch (k) { - case REL_X: - strcat(extra, " X"); - break; - case REL_Y: - strcat(extra, " Y"); - break; - case REL_Z: - strcat(extra, " Z"); - break; - case REL_HWHEEL: - strcat(extra, " HWheel"); - break; - case REL_DIAL: - strcat(extra, " Dial"); - break; - case REL_WHEEL: - strcat(extra, " Wheel"); - break; - case REL_MISC: - strcat(extra, " Misc"); - break; - } - } - break; - case EV_ABS: - type = "absolute"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); - for (k = 0; k < ABS_MAX; k++) { - if (test_bits(k)) - switch (k) { - case ABS_X: - strcat(extra, " X"); - break; - case ABS_Y: - strcat(extra, " Y"); - break; - case ABS_Z: - strcat(extra, " Z"); - break; - case ABS_RX: - strcat(extra, " RX"); - break; - case ABS_RY: - strcat(extra, " RY"); - break; - case ABS_RZ: - strcat(extra, " RZ"); - break; - case ABS_THROTTLE: - strcat(extra, " Throttle"); - break; - case ABS_RUDDER: - strcat(extra, " Rudder"); - break; - case ABS_WHEEL: - strcat(extra, " Wheel"); - break; - case ABS_GAS: - strcat(extra, " Gas"); - break; - case ABS_BRAKE: - strcat(extra, " Break"); - break; - case ABS_HAT0X: - strcat(extra, " Hat0X"); - break; - case ABS_HAT0Y: - strcat(extra, " Hat0Y"); - break; - case ABS_HAT1X: - strcat(extra, " Hat1X"); - break; - case ABS_HAT1Y: - strcat(extra, " Hat1Y"); - break; - case ABS_HAT2X: - strcat(extra, " Hat2X"); - break; - case ABS_HAT2Y: - strcat(extra, " Hat2Y"); - break; - case ABS_HAT3X: - strcat(extra, " Hat3X"); - break; - case ABS_HAT3Y: - strcat(extra, " Hat3Y"); - break; - case ABS_PRESSURE: - strcat(extra, " Pressure"); - break; - case ABS_DISTANCE: - strcat(extra, " Distance"); - break; - case ABS_TILT_X: - strcat(extra, " TiltX"); - break; - case ABS_TILT_Y: - strcat(extra, " TiltY"); - break; - case ABS_MISC: - strcat(extra, " Misc"); - break; - } - } - break; - case EV_MSC: - type = "reserved"; - break; - case EV_LED: - type = "leds"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits); - for (k = 0; k < LED_MAX; k++) { - if (test_bits(k)) - switch (k) { - case LED_NUML: - strcat(extra, " NumLock"); - break; - case LED_CAPSL: - strcat(extra, " CapsLock"); - break; - case LED_SCROLLL: - strcat(extra, " ScrlLock"); - break; - case LED_COMPOSE: - strcat(extra, " Compose"); - break; - case LED_KANA: - strcat(extra, " Kana"); - break; - case LED_SLEEP: - strcat(extra, " Sleep"); - break; - case LED_SUSPEND: - strcat(extra, " Suspend"); - break; - case LED_MUTE: - strcat(extra, " Mute"); - break; - case LED_MISC: - strcat(extra, " Misc"); - break; - } - } - break; - case EV_SND: - type = "sound"; - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_SND, sizeof(bits)), bits); - for (k = 0; k < SND_MAX; k++) { - if (test_bits(k)) - switch (k) { - case SND_CLICK: - strcat(extra, " Click"); - break; - case SND_BELL: - strcat(extra, " Bell"); - break; - } - } - break; - case EV_REP: - type = "repeat"; - break; - case EV_FF: - type = "feedback"; - break; - } - LOG5INPUT(priv, " Feature 0x%02x = %s%s%s%s\n", j, type, - extra[0] ? " [" : "", - extra[0] ? extra + 1 : "", extra[0] ? "]" : ""); - } - } -} - -/** Initialized \a pDev as a \a usbMouse, \a usbKeyboard, or \a usbOther -device. */ -void -usbInit(DevicePtr pDev, usbType type) -{ - GETPRIV; - char name[64]; /* RATS: Only used in snprintf */ - int i, j, k; - char buf[256] = { 0, }; /* RATS: Use ok */ - int version; - unsigned char bits[KEY_MAX / 8 + 1]; /* RATS: Use ok assuming that - * KEY_MAX is greater than - * REL_MAX, ABS_MAX, SND_MAX, and - * LED_MAX. */ - - if (priv->fd >= 0) - return; - - for (i = 0; i < 32; i++) { - snprintf(name, sizeof(name), "/dev/input/event%d", i); - if ((priv->fd = open(name, O_RDWR | O_NONBLOCK, 0)) >= 0) { - ioctl(priv->fd, EVIOCGVERSION, &version); - ioctl(priv->fd, EVIOCGNAME(sizeof(buf)), buf); - memset(priv->mask, 0, sizeof(priv->mask)); - ioctl(priv->fd, EVIOCGBIT(0, sizeof(priv->mask)), priv->mask); - - for (j = 0; j < EV_MAX; j++) { - if (test_bit(j)) { - switch (j) { - case EV_REL: - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_REL, sizeof(bits)), bits); - for (k = 0; k < REL_MAX; k++) { - if (test_bits(k)) { - if (k == REL_X) - priv->relmap[k] = 0; - else if (k == REL_Y) - priv->relmap[k] = 1; - else - priv->relmap[k] = 2 + priv->numAbs; - ++priv->numRel; - } - } - break; - case EV_ABS: - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_ABS, sizeof(bits)), bits); - for (k = 0; k < ABS_MAX; k++) { - if (test_bits(k)) { - priv->absmap[k] = priv->numAbs; - ++priv->numAbs; - } - } - break; - case EV_LED: - memset(bits, 0, sizeof(bits)); - ioctl(priv->fd, EVIOCGBIT(EV_LED, sizeof(bits)), bits); - for (k = 0; k < LED_MAX; k++) { - if (test_bits(k)) - ++priv->numLeds; - } - break; - } - } - } - switch (type) { - case usbMouse: - if (test_bit(EV_REL) && test_bit(EV_KEY)) - goto found; - break; - case usbKeyboard: - if (test_bit(EV_KEY) && test_bit(EV_LED) && !test_bit(EV_ABS)) - goto found; - break; - case usbOther: - if (!(test_bit(EV_REL) && test_bit(EV_KEY)) - && !(test_bit(EV_KEY) && test_bit(EV_LED) - && !test_bit(EV_ABS))) - goto found; - break; - } - close(priv->fd); - priv->fd = -1; - } - } - if (priv->fd < 0) - FATAL1("usbInit: Cannot open /dev/input/event* port (%s)\n" - " If you have not done so, you may need to:\n" - " rmmod mousedev; rmmod keybdev\n" - " modprobe evdev\n", strerror(errno)); - found: - usbPrint(priv, name, buf, priv->fd); -} - -/** Turn \a pDev off (i.e., stop taking input from \a pDev). */ -void -usbOff(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd >= 0) - close(priv->fd); - priv->fd = -1; -} - -/** Create a private structure for use within this file. */ -void * -usbCreatePrivate(DeviceIntPtr pDevice) -{ - myPrivate *priv = calloc(1, sizeof(*priv)); - - priv->fd = -1; - priv->pDevice = pDevice; - return priv; -} - -/** Destroy a private structure. */ -void -usbDestroyPrivate(void *priv) -{ - free(priv); -} diff --git a/hw/dmx/input/usb-common.h b/hw/dmx/input/usb-common.h deleted file mode 100644 index 71593765f..000000000 --- a/hw/dmx/input/usb-common.h +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to common USB support. \see usb-common.c \see usb-mouse.c - * \see usb-keyboard.c \see usb-other.c */ - -#ifndef _USB_COMMON_H_ -#define _USB_COMMON_H_ -typedef enum { - usbMouse, - usbKeyboard, - usbOther -} usbType; - -extern void *usbCreatePrivate(DeviceIntPtr pDevice); -extern void usbDestroyPrivate(void *priv); -extern void usbRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - int minButton, DMXBlockType block); -extern void usbInit(DevicePtr pDev, usbType type); -extern void usbOff(DevicePtr pDev); -#endif diff --git a/hw/dmx/input/usb-keyboard.c b/hw/dmx/input/usb-keyboard.c deleted file mode 100644 index b26c822c0..000000000 --- a/hw/dmx/input/usb-keyboard.c +++ /dev/null @@ -1,478 +0,0 @@ -/* Portions of this file were derived from the following files: - * - ********************************************************************** - * - * xfree86/common/xf86KbdLnx.c - * - * Linux version of keymapping setup. The kernel (since 0.99.14) has support - * for fully remapping the keyboard, but there are some differences between - * the Linux map and the SVR4 map (esp. in the extended keycodes). We also - * remove the restriction on what keycodes can be remapped. - * Orest Zborowski. - * - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ - -/* - * Copyright 2001,2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This code implements a low-level device driver for a USB keyboard - * under Linux. The keymap description is derived from code by Thomas - * Roell, Orest Zborowski. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "atKeynames.h" -#include "usb-private.h" - -#define USB_KEYBOARD_DEBUG 0 - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "usb-keyboard.h" -#include <xkbsrv.h> - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 248 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) - -static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { -/* Table modified from xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h */ - /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, - /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, - /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, - /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, - /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, - /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, - /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, - /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, - /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, - /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, - /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, - /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, - /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, XK_ISO_Left_Tab, NoSymbol, NoSymbol, - /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, - /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, - /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, - /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, - /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, - /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, - /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, - /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, - /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, - /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, - /* 0x1b */ XK_bracketright, XK_braceright, NoSymbol, NoSymbol, - /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, - /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, - /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, - /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, - /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, - /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, - /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, - /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, - /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, - /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, - /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, - /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, - /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, - /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, - /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, - /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, - /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, - /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, - /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, - /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, - /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, - /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, - /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, - /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, - /* 0x4c */ XK_KP_Begin, XK_KP_5, NoSymbol, NoSymbol, - /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, - /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, - /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, - /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, - /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - /* 0x59 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, - /* 0x5e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 0x61 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x62 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x63 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x64 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, - /* 0x65 */ XK_Break, NoSymbol, NoSymbol, NoSymbol, - /* 0x66 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, - /* 0x67 */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x68 */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x69 */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x6a */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ XK_End, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7a */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ XK_Super_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x7e */ XK_Super_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x7f */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, -}; - -static int -kbdUSBKeyDown(myPrivate * priv, int keyCode) -{ - CARD8 byte = keyCode >> 5; - CARD32 bit = 1 << (keyCode & 0x1f); - - if (byte > NUM_STATE_ENTRIES) - return 0; - return priv->kbdState[byte] & bit; -} - -static void -kbdUSBKeyState(myPrivate * priv, int type, int keyCode) -{ - CARD8 byte = keyCode >> 5; - CARD32 bit = 1 << (keyCode & 0x1f); - - if (byte > NUM_STATE_ENTRIES) - return; - if (type == KeyPress) - priv->kbdState[byte] |= bit; - else - priv->kbdState[byte] &= ~bit; -} - -/** Set the LEDs. */ -void -kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl) -{ - GETPRIV; - struct timeval tv; - struct input_event event; - int i, led; - - gettimeofday(&tv, NULL); - for (i = 0; i < 5; i++) { - event.time.tv_sec = tv.tv_sec; - event.time.tv_usec = tv.tv_usec; - event.type = EV_LED; - if (i == 0) - led = 1; /* LED_CAPSL == 0x01 */ - else if (i == 1) - led = 0; /* LED_NUML == 0x00 */ - else - led = i; - event.code = led; - event.value = ! !(ctrl->leds & (1 << led)); - if (write(priv->fd, &event, sizeof(event)) != sizeof(event)) - DebugF("Failed to set LEDs!\n"); - } -} - -/** Initialize \a pDev using #usbInit. */ -void -kbdUSBInit(DevicePtr pDev) -{ - usbInit(pDev, usbKeyboard); -} - -static void -kbdUSBConvert(DevicePtr pDev, - unsigned int scanCode, - int value, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - GETPRIV; - XkbSrvInfoPtr xkbi = priv->pKeyboard->key->xkbInfo; - int type; - int keyCode; - KeySym keySym = NoSymbol; - int switching; - - /* Set up xEvent information */ - type = value ? KeyPress : KeyRelease; - keyCode = (scanCode & 0xff) + MIN_KEYCODE; - - /* Handle repeats */ - - if (keyCode >= xkbi->desc->min_key_code && - keyCode <= xkbi->desc->max_key_code) { - - int effectiveGroup = XkbGetEffectiveGroup(xkbi, - &xkbi->state, - scanCode); - - keySym = XkbKeySym(xkbi->desc, scanCode, effectiveGroup); -#if 0 - switch (keySym) { - case XK_Num_Lock: - case XK_Scroll_Lock: - case XK_Shift_Lock: - case XK_Caps_Lock: - /* Ignore releases and all but first press */ - if (kbdLinuxModIgnore(priv, &xE, keySym)) - return; - if (kbdLinuxKeyDown(priv, &xE)) - xE.u.u.type = KeyRelease; - else - xE.u.u.type = KeyPress; - break; - } -#endif - - /* If key is already down, ignore or autorepeat */ - if (type == KeyPress && kbdUSBKeyDown(priv, keyCode)) { - KbdFeedbackClassRec *feed = priv->pDevice->kbdfeed; - - /* No auto-repeat? */ - if ((feed && !feed->ctrl.autoRepeat) - || priv->pDevice->key->xkbInfo->desc->map->modmap[keyCode] - || (feed && !(feed->ctrl.autoRepeats[keyCode >> 3] - & (1 << (keyCode & 7))))) - return; /* Ignore */ - - /* Do auto-repeat */ - enqueue(pDev, KeyRelease, keyCode, keySym, NULL, block); - type = KeyPress; - } - - /* If key is already up, ignore */ - if (type == KeyRelease && !kbdUSBKeyDown(priv, keyCode)) - return; - } - - switching = 0; - if (checkspecial && type == KeyPress) - switching = checkspecial(pDev, keySym); - if (!switching) { - if (enqueue) - enqueue(pDev, type, keyCode, keySym, NULL, block); - kbdUSBKeyState(priv, type, keyCode); /* Update our state bitmap */ - } -} - -/** Read an event from the \a pDev device. If the event is a motion - * event, enqueue it with the \a motion function. Otherwise, check for - * special keys with the \a checkspecial function and enqueue the event - * with the \a enqueue function. The \a block type is passed to the - * functions so that they may block the input thread as appropriate to the - * caller of this function. */ -void -kbdUSBRead(DevicePtr pDev, - MOTIONPROC motion, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - GETPRIV; - struct input_event raw; - - while (read(priv->fd, &raw, sizeof(raw)) > 0) { -#if USB_KEYBOARD_DEBUG - LOG3("KBD: type = %d, code = 0x%02x, value = %d\n", - raw.type, raw.code, raw.value); -#endif - kbdUSBConvert(pDev, raw.code, raw.value, enqueue, checkspecial, block); - } -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -kbdUSBOn(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd < 0) - kbdUSBInit(pDev); - return priv->fd; -} - -static void -kbdUSBGetMap(DevicePtr pDev, KeySymsPtr pKeySyms, CARD8 *pModMap) -{ - KeySym *k, *mapCopy; - int i; - - mapCopy = malloc(sizeof(map)); - memcpy(mapCopy, map, sizeof(map)); - - /* compute the modifier map */ - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = mapCopy, i = MIN_KEYCODE; - i < NUM_KEYCODES + MIN_KEYCODE; i++, k += 4) { - switch (*k) { - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - } - } - - pKeySyms->map = mapCopy; /* Must be XFree'able */ - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_KEYCODE; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - info->keyboard = 1; - info->keyClass = 1; - kbdUSBGetMap(pDev, &info->keySyms, info->modMap); - info->focusClass = 1; - info->kbdFeedbackClass = 1; - info->names.keycodes = strdup("powerpcps2"); - info->force = 1; -} diff --git a/hw/dmx/input/usb-keyboard.h b/hw/dmx/input/usb-keyboard.h deleted file mode 100644 index e14cca1c2..000000000 --- a/hw/dmx/input/usb-keyboard.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to USB keyboard driver. \see usb-keyboard.c \see usb-common.c */ - -#ifndef _USB_KEYBOARD_H_ -#define _USB_KEYBOARD_H_ -extern void kbdUSBInit(DevicePtr pDev); -extern void kbdUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern int kbdUSBOn(DevicePtr pDev); -extern void kbdUSBRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void kbdUSBCtrl(DevicePtr pDev, KeybdCtrl * ctrl); -#endif diff --git a/hw/dmx/input/usb-mouse.c b/hw/dmx/input/usb-mouse.c deleted file mode 100644 index 644342ee3..000000000 --- a/hw/dmx/input/usb-mouse.c +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This code implements a low-level device driver for a USB mouse. */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "usb-private.h" - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "usb-mouse.h" - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -/** Read the USB device using #usbRead. */ -void -mouUSBRead(DevicePtr pDev, - MOTIONPROC motion, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - usbRead(pDev, motion, enqueue, BTN_MISC, block); -} - -/** Initialize \a pDev using #usbInit. */ -void -mouUSBInit(DevicePtr pDev) -{ - usbInit(pDev, usbMouse); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -mouUSBOn(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd < 0) - mouUSBInit(pDev); - return priv->fd; -} - -static void -mouUSBGetMap(DevicePtr pDev, unsigned char *map, int *nButtons) -{ - int i; - - if (nButtons) - *nButtons = 5; - if (map) - for (i = 0; i <= *nButtons; i++) - map[i] = i; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - static KeySym keyboard_mapping = NoSymbol; - - info->buttonClass = 1; - mouUSBGetMap(pDev, info->map, &info->numButtons); - info->valuatorClass = 1; - info->numRelAxes = 2; - info->minval[0] = 0; - info->maxval[0] = 0; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - info->ptrFeedbackClass = 1; - - /* Some USB mice devices return key - * events from their pair'd - * keyboard... */ - info->keyClass = 1; - info->keySyms.minKeyCode = 8; - info->keySyms.maxKeyCode = 8; - info->keySyms.mapWidth = 1; - info->keySyms.map = &keyboard_mapping; -} diff --git a/hw/dmx/input/usb-mouse.h b/hw/dmx/input/usb-mouse.h deleted file mode 100644 index 91f6fcf86..000000000 --- a/hw/dmx/input/usb-mouse.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to USB mouse driver. \see usb-mouse.c \see usb-common.c */ - -#ifndef _USB_MOU_H_ -#define _USB_MOU_H_ -extern void mouUSBRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void mouUSBInit(DevicePtr pDev); -extern void mouUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern int mouUSBOn(DevicePtr pDev); -extern void mouUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl); -#endif diff --git a/hw/dmx/input/usb-other.c b/hw/dmx/input/usb-other.c deleted file mode 100644 index f24f259c1..000000000 --- a/hw/dmx/input/usb-other.c +++ /dev/null @@ -1,166 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * - * This code implements a low-level device driver for a non-keyboard, - * non-mouse USB device (e.g., a joystick or gamepad). */ - -#ifdef HAVE_DMX_CONFIG_H -#include <dmx-config.h> -#endif - -#include "usb-private.h" - -/*****************************************************************************/ -/* Define some macros to make it easier to move this file to another - * part of the Xserver tree. All calls to the dmx* layer are #defined - * here for the .c file. The .h file will also have to be edited. */ -#include "dmxinputinit.h" -#include "usb-other.h" - -#define GETPRIV myPrivate *priv \ - = ((DMXLocalInputInfoPtr)(pDev->devicePrivate))->private - -#define LOG0(f) dmxLog(dmxDebug,f) -#define LOG1(f,a) dmxLog(dmxDebug,f,a) -#define LOG2(f,a,b) dmxLog(dmxDebug,f,a,b) -#define LOG3(f,a,b,c) dmxLog(dmxDebug,f,a,b,c) -#define FATAL0(f) dmxLog(dmxFatal,f) -#define FATAL1(f,a) dmxLog(dmxFatal,f,a) -#define FATAL2(f,a,b) dmxLog(dmxFatal,f,a,b) -#define MOTIONPROC dmxMotionProcPtr -#define ENQUEUEPROC dmxEnqueueProcPtr -#define CHECKPROC dmxCheckSpecialProcPtr -#define BLOCK DMXBlockType - -/* End of interface definitions. */ -/*****************************************************************************/ - -/** Read the USB device using #usbRead. */ -void -othUSBRead(DevicePtr pDev, - MOTIONPROC motion, - ENQUEUEPROC enqueue, CHECKPROC checkspecial, BLOCK block) -{ - usbRead(pDev, motion, enqueue, 0xffff, block); -} - -/** Initialize \a pDev using #usbInit. */ -void -othUSBInit(DevicePtr pDev) -{ - usbInit(pDev, usbOther); -} - -/** Turn \a pDev on (i.e., take input from \a pDev). */ -int -othUSBOn(DevicePtr pDev) -{ - GETPRIV; - - if (priv->fd < 0) - othUSBInit(pDev); - return priv->fd; -} - -/** Fill the \a info structure with information needed to initialize \a - * pDev. */ -void -othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info) -{ - GETPRIV; - int i, j; - static KeySym keyboard_mapping = NoSymbol; - int absolute[5]; - -#define test_bit(bit) (priv->mask[(bit)/8] & (1 << ((bit)%8))) - - /* Some USB mice devices return key - * events from their pair'd - * keyboard... */ - info->keyClass = 1; - info->keySyms.minKeyCode = 8; - info->keySyms.maxKeyCode = 8; - info->keySyms.mapWidth = 1; - info->keySyms.map = &keyboard_mapping; - - for (i = 0; i < EV_MAX; i++) { - if (test_bit(i)) { - switch (i) { - case EV_KEY: - /* See above */ - break; - case EV_REL: - info->valuatorClass = 1; - if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) { - info->numRelAxes = DMX_MAX_AXES - info->numAbsAxes - 1; - dmxLog(dmxWarning, "Can only use %d relative axes\n", - info->numRelAxes); - } - else - info->numRelAxes = priv->numRel; - info->minval[0] = 0; - info->maxval[0] = 0; - info->res[0] = 1; - info->minres[0] = 0; - info->maxres[0] = 1; - break; - case EV_ABS: - info->valuatorClass = 1; - if (info->numRelAxes + info->numAbsAxes > DMX_MAX_AXES - 1) { - info->numAbsAxes = DMX_MAX_AXES - info->numRelAxes - 1; - dmxLog(dmxWarning, "Can only use %d absolute axes\n", - info->numAbsAxes); - } - else - info->numAbsAxes = priv->numAbs; - for (j = 0; j < info->numAbsAxes; j++) { - ioctl(priv->fd, EVIOCGABS(j), absolute); - info->minval[1 + j] = absolute[1]; - info->maxval[1 + j] = absolute[2]; - info->res[1 + j] = absolute[3]; - info->minres[1 + j] = absolute[3]; - info->maxres[1 + j] = absolute[3]; - } - break; - case EV_LED: - info->ledFeedbackClass = 0; /* Not supported at this time */ - break; - case EV_SND: - info->belFeedbackClass = 0; /* Not supported at this time */ - break; - } - } - } -} diff --git a/hw/dmx/input/usb-other.h b/hw/dmx/input/usb-other.h deleted file mode 100644 index 89939a0a2..000000000 --- a/hw/dmx/input/usb-other.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Interface to USB generic driver. \see usb-other.c \see usb-common.c */ - -#ifndef _USB_OTHER_H_ -#define _USB_OTHER_H_ -extern void othUSBRead(DevicePtr pDev, - dmxMotionProcPtr motion, - dmxEnqueueProcPtr enqueue, - dmxCheckSpecialProcPtr checkspecial, DMXBlockType block); -extern void othUSBInit(DevicePtr pDev); -extern void othUSBGetInfo(DevicePtr pDev, DMXLocalInitInfoPtr info); -extern int othUSBOn(DevicePtr pDev); -extern void othUSBCtrl(DevicePtr pDev, PtrCtrl * ctrl); -#endif diff --git a/hw/dmx/input/usb-private.h b/hw/dmx/input/usb-private.h deleted file mode 100644 index 2ecfdf636..000000000 --- a/hw/dmx/input/usb-private.h +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2002 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: - * Rickard E. (Rik) Faith <faith@redhat.com> - * - */ - -/** \file - * Private header file for USB support. This file provides - * Linux-specific include files and the definition of the private - * structure. \see usb-common.c \see usb-keyboard.c \see usb-mouse.c - * \see usb-other.c */ - -#ifndef _USB_PRIVATE_H_ -#define _USB_PRIVATE_H_ - -#include "dmxinputinit.h" -#include "inputstr.h" -#include <X11/Xos.h> -#include <errno.h> -#include <linux/input.h> -#include "usb-common.h" - - /* Support for force feedback was - * introduced in Linxu 2.4.10 */ -#ifndef EV_MSC -#define EV_MSC 0x04 -#endif -#ifndef EV_FF -#define EV_FF 0x15 -#endif -#ifndef LED_SLEEP -#define LED_SLEEP 0x05 -#endif -#ifndef LED_SUSPEND -#define LED_SUSPEND 0x06 -#endif -#ifndef LED_MUTE -#define LED_MUTE 0x07 -#endif -#ifndef LED_MISC -#define LED_MISC 0x08 -#endif -#ifndef BTN_DEAD -#define BTN_DEAD 0x12f -#endif -#ifndef BTN_THUMBL -#define BTN_THUMBL 0x13d -#endif -#ifndef BTN_THUMBR -#define BTN_THUMBR 0x13e -#endif -#ifndef MSC_SERIAL -#define MSC_SERIAL 0x00 -#endif -#ifndef MSC_MAX -#define MSC_MAX 0x07 -#endif - - /* Support for older kernels. */ -#ifndef ABS_WHEEL -#define ABS_WHEEL 0x08 -#endif -#ifndef ABS_GAS -#define ABS_GAS 0x09 -#endif -#ifndef ABS_BRAKE -#define ABS_BRAKE 0x0a -#endif - -#define NUM_STATE_ENTRIES (256/32) - -/* Private area for USB devices. */ -typedef struct _myPrivate { - DeviceIntPtr pDevice; /**< Device (mouse or other) */ - int fd; /**< File descriptor */ - unsigned char mask[EV_MAX / 8 + 1]; /**< Mask */ - int numRel, numAbs, numLeds; /**< Counts */ - int relmap[REL_CNT]; /**< Relative axis map */ - int absmap[ABS_CNT]; /**< Absolute axis map */ - - CARD32 kbdState[NUM_STATE_ENTRIES]; /**< Keyboard state */ - DeviceIntPtr pKeyboard; /** Keyboard device */ - - int pitch; /**< Bell pitch */ - unsigned long duration; /**< Bell duration */ - - /* FIXME: dmxInput is never initialized */ - DMXInputInfo *dmxInput; /**< For pretty-printing */ -} myPrivate; -#endif diff --git a/hw/dmx/man/Makefile.am b/hw/dmx/man/Makefile.am deleted file mode 100644 index e717aefe2..000000000 --- a/hw/dmx/man/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -include $(top_srcdir)/manpages.am -appman_PRE = Xdmx.man diff --git a/hw/dmx/man/Xdmx.man b/hw/dmx/man/Xdmx.man deleted file mode 100644 index 209c49ca6..000000000 --- a/hw/dmx/man/Xdmx.man +++ /dev/null @@ -1,732 +0,0 @@ -.\" -.\" 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. -.TH Xdmx 1 @vendorversion@ -.SH NAME -Xdmx - Distributed Multi-head X server -.SH SYNOPSIS -.B Xdmx -[:display] [option ...] -.SH DESCRIPTION -.I Xdmx -is a proxy X server that uses one or more other X servers as its display -devices. It provides multi-head X functionality for displays that might -be located on different machines. -.I Xdmx -functions as a front-end X server that acts as a proxy to a set of -back-end X servers. All of the visible rendering is passed to the -back-end X servers. Clients connect to the -.I Xdmx -front-end, and everything appears as it would in a regular multi-head -configuration. If Xinerama is enabled (e.g., with -.B +xinerama -on the command line), the clients see a single large screen. -.PP -.I Xdmx -communicates to the back-end X servers using the standard X11 protocol, -and standard and/or commonly available X server extensions. -.SH OPTIONS -In addition to the normal X server options described in the -.I Xserver(@appmansuffix@) -manual page, -.I Xdmx -accepts the following command line switches: -.TP 8 -.BI "\-display " display-name -This specifies the name(s) of the back-end X server display(s) to connect -to. This option may be specified multiple times to connect to more than -one back-end display. The first is used as screen 0, the second as screen 1, -etc. If this option is omitted, the -.B $DISPLAY -environment variable is used as the single back-end X server display. -.sp -.TP 8 -.BI "\-xinput " input-source -This specifies the source to use for XInput extension devices. The -choices are the same as for -.BR "\-input " , -described below, except that core devices on backend servers cannot be -treated as XInput extension devices. (Although extension devices on -backend and console servers are supported as extension devices under -.IR Xdmx ). -.sp -.TP 8 -.BI "\-input " input-source -This specifies the source to use for the core input devices. The choices are: -.RS -.TP 4 -.B dummy -A set of dummy core input drivers are used. These never generate any -input events. -.sp -.TP 4 -.B local -The raw keyboard and pointer from the local computer are used. A -comma-separated list of driver names can be appended. -The following drivers have been implemented for Linux: usb-mou -(a USB mouse driver), usb-kbd (a USB keyboard driver), and usb-oth (a -USB non-keyboard, non-mouse driver). Additional drivers may be -implemented in the future. Appropriate defaults will be used if no -comma-separated list is provided. -.sp -.TP 4 -.I display-name -If the display-name is a back-end server, then core input events are -taken from the server specified. Otherwise, a console window will be -opened on the specified display. -.sp -If the -.I display-name -is followed by ",xi" then XInput extension devices on the display will -be used as -.I Xdmx -XInput extension devices. If the -.I display-name -is followed by ",noxi" then XInput extension devices on the display will -.B not -be used as -.I Xdmx -XInput extension devices. Currently, the default is ",xi". -.sp -If the -.I display-name -is followed by ",console" and the -.I display-name -refers to a display that is used as a backend display, then a console -window will be opened on that display -.B and -that display will be treated as a backend display. Otherwise (or if -",noconsole" is used), the display will be treated purely as a backend -or a console display, as described above. -.sp -If the -.I display-name -is followed by ",windows", then outlines of the windows on the backend -will be displayed inside the console window. Otherwise (or if -",nowindows" is used), the console window will not display the outlines -of backend windows. (This option only applies to console input.) -.sp -If the -.I display-name -is followed by ",xkb", then the next 1 to 3 comma-separated parameters -will specify the keycodes, symbols, and geometry of the keyboard for -this input device. For example, ",xkb,xfree86,pc104" will specify that -the "xfree86" keycodes and the "pc104" symbols should be used to -initialize the keyboard. For an SGI keyboard, ",xkb,sgi/indy(pc102)" -might be useful. A list of keycodes, symbols, and geometries can be -found in -.IR @xkbdir@ . -Use of keycodes, symbols and geometries for XKB configuration is -deprecated in favor of the rules, layout, model, variant and options -settings available via the -param command line switch. -If this option is not specified, the input device will be queried, -perhaps using the XKEYBOARD extension. -.RE -.sp -.RS -If this option isn't specified, the default input source is the first -back-end server (the one used for screen 0). The console window shows -the layout of the back-end display(s) and pointer movements and key -presses within the console window will be used as core input devices. -.sp -Several special function keys are active, depending on the input -source: -.sp -.RS -.B Ctrl-Alt-q -will terminate the -.I Xdmx -server in all modes. -.sp -.B Ctrl-Alt-g -will toggle a -server grab in console mode (a special cursor, currently a spider, is -used to indicate an active server grab). -.sp -.B Ctrl-Alt-f -will toggle fine-grain motion in console mode (a special cursor, -currently a cross hair, is used to indicate this mode). If this mode is -combined with a server grab, then the cursor will have 4 lines instead -of only 2. -.sp -.BR Ctrl-Alt-F1 " through " Ctrl-Alt-F12 -will switch to another VC in local (raw) mode. -.RE -.RE -.sp -.TP 8 -.BI "-nomulticursor" -This option turns off support for displaying multiple cursors on -overlapped back-end displays. This option is available for testing and -benchmarking purposes. -.sp -.TP 8 -.BI "-fontpath" -This option sets the -.I Xdmx -server's default font path. This option can be specified multiple times -to accommodate multiple font paths. See the -.B "FONT PATHS" -section below for very important information regarding setting the -default font path. -.sp -.TP 8 -.BI "-configfile " filename -Specify the configuration file that should be read. Note that if the -.B \-display -command-line option is used, then the configuration file will be -ignored. -.sp -.TP 8 -.BI "-config " name -Specify a configuration to use. The -.I name -will be the name following the -.B virtual -keyword in the configuration file. -.sp -.TP 8 -.BI "-stat " "interval screens" -This option enables the display of performance statistics. The interval -is in seconds. The screens is a count of the number of back-end screens -for which data is printed each interval. Specifying 0 for screens will -display data for all screens. -.sp -For each screen, the following information is printed: the screen -number, an absolute count of the number of XSync() calls made -(SyncCount), the rate of these calls during the previous interval -(Sync/s), the average round-trip time (in microseconds) of the last 10 -XSync() calls (avSync), the maximum round-trip time (in microseconds) of -the last 10 XSync calls (mxSync), the average number of XSync() requests -that were pending but not yet processed for each of the last 10 -processed XSync() calls, the maximum number of XSync() requests that -were pending but not yet processed for each of the last 10 processed -XSync() calls, and a histogram showing the distribution of the times of -all of the XSync() calls that were made during the previous interval. -.sp -(The length of the moving average and the number and value of histogram -bins are configurable at compile time in the -.B dmxstat.h -header file.) -.sp -.TP 8 -.BI "-syncbatch " interval -This option sets the -.I interval -in milliseconds for XSync() batching. An -.I interval -less than or equal to 0 will disable XSync() batching. The default -.I interval -is 100 ms. -.sp -.TP 8 -.BI "-nooffscreenopt" -This option disables the offscreen optimization. Since the lazy window -creation optimization requires the offscreen optimization to be enabled, -this option will also disable the lazy window creation optimization. -.sp -.TP 8 -.BI "-nowindowopt" -This option disables the lazy window creation optimization. -.sp -.TP 8 -.BI "-nosubdivprims" -This option disables the primitive subdivision optimization. -.sp -.TP 8 -.BI "-noxkb" -Disable use of the XKB extension for communication with the back end -displays. (Combine with -.B "-kb" -to disable all use of XKB.) -.sp -.TP 8 -.BI "-depth " int -This option sets the root window's default depth. When choosing a -default visual from those available on the back-end X server, the first -visual with that matches the depth specified is used. -.sp -This option can be combined with the -.BI "-cc" -option, which specifies the default color visual class, to force the use -of a specific depth and color class for the root window. -.sp -.TP 8 -.BI "-norender" -This option disables the RENDER extension. -.sp -.TP 8 -.BI "-noglxproxy" -This option disables GLX proxy -- the built-in GLX extension -implementation that is DMX aware. -.sp -.TP 8 -.BI "-noglxswapgroup" -This option disables the swap group and swap barrier extensions in GLX -proxy. -.sp -.TP 8 -.BI "-glxsyncswap" -This option enables synchronization after a swap buffers call by waiting -until all X protocol has been processed. When a client issues a -glXSwapBuffers request, Xdmx relays that request to each back-end X -server, and those requests are buffered along with all other protocol -requests. However, in systems that have large network buffers, this -buffering can lead to the set of back-end X servers handling the swap -buffers request asynchronously. With this option, an XSync() request is -issued to each back-end X server after sending the swap buffers request. -The XSync() requests will flush all buffered protocol (including the -swap buffers requests) and wait until the back-end X servers have -processed those requests before continuing. This option does not wait -until all GL commands have been processed so there might be previously -issued commands that are still being processed in the GL pipe when the -XSync() request returns. See the -.BI "-glxfinishswap" -option below if Xdmx should wait until the GL commands have been -processed. -.sp -.TP 8 -.BI "-glxfinishswap" -This option enables synchronization after a swap buffers call by waiting -until all GL commands have been completed. It is similar to the -.BI "-glxsyncswap" -option above; however, instead of issuing an XSync(), it issues a -glFinish() request to each back-end X server after sending the swap -buffers requests. The glFinish() request will flush all buffered -protocol requests, process both X and GL requests, and wait until all -previously called GL commands are complete before returning. -.sp -.TP 8 -.BI "-ignorebadfontpaths" -This option ignores font paths that are not available on all back-end -servers by removing the bad font path(s) from the default font path -list. If no valid font paths are left after removing the bad paths, an -error to that effect is printed in the log. -.sp -.TP 8 -.BI "-addremovescreens" -This option enables the dynamic addition and removal of screens, which -is disabled by default. Note that GLXProxy and Render do not yet -support dynamic addition and removal of screens, and must be disabled -via the -.BI "-noglxproxy" -and -.BI "-norender" -command line options described above. -.sp -.TP 8 -.BI "-param" -This option specifies parameters on the command line. Currently, only -parameters dealing with XKEYBOARD configuration are supported. These -parameters apply only to the core keyboard. Parameter values are -installation-dependent. Please see -.I @xkbdir@ -or a similar directory for complete information. -.RS -.TP 8 -.B XkbRules -Defaults to "@XKB_DFLT_RULES@". Other values may include "sgi" and "sun". -.sp -.TP 8 -.B XkbModel -Defaults to "@XKB_DFLT_MODEL@". When used with "base" rules, other values -may include "pc102", "pc104", "microsoft", and many others. When -used with "sun" rules, other values may include "type4" and "type5". -.sp -.TP 8 -.B XkbLayout -Defaults to "@XKB_DFLT_LAYOUT@". Other country codes and "dvorak" are usually -available. -.sp -.TP 8 -.B XkbVariant -Defaults to "@XKB_DFLT_VARIANT@". -.sp -.TP 8 -.B XkbOptions -Defaults to "@XKB_DFLT_OPTIONS@". -.RE -.SH "CONFIGURATION FILE GRAMMAR" -The following words and tokens are reserved: -.RS -.B virtual -.B display -.B wall -.B option -.B param -.B { -.B } -.B ; -.B # -.RE -.PP -Comments start with a -.B # -mark and extend to the end of the line. They may appear anywhere. If a -configuration file is read into -.BR xdmxconfig , -the comments in that file will be preserved, but will not be editable. -.PP -The grammar is as follows: -.RS -virtual-list ::= [ virtual-list ] | virtual - -virtual ::= -.B virtual -[ name ] [ dim ] -.B { -dw-list -.B } - -dw-list ::= [ dw-list ] | dw - -dw ::= display | wall | option - -display ::= -.B display -name [ geometry ] [ / geometry ] [ origin ] -.B ; - -wall ::= -.B wall -[ dim ] [ dim ] name-list -.B ; - -option ::= -.B option -name-list -.B ; - -param ::= -.B param -name-list -.B ; - -param ::= -.B param { -param-list -.B } - -param-list ::= [ param-list ] | name-list -.B ; - -name-list ::= [ name-list ] | name - -name ::= string | double-quoted-string - -dim ::= integer -.B x -integer - -geometry ::= [ integer -.B x -integer ] [ signed-integer signed-integer ] - -origin ::= -.B @ -integer -.B x -integer -.RE -.PP -The name following -.B virtual -is used as an identifier for the configuration, and may be passed to -.B Xdmx -using the -.B \-config -command line option. The name of a display should be standard X display -name, although no checking is performed (e.g., "machine:0"). -.PP -For names, double quotes are optional unless the name is reserved or -contains spaces. -.PP -The first dimension following -.B wall -is the dimension for tiling (e.g., 2x4 or 4x4). The second dimension -following -.B wall -is the dimension of each display in the wall (e.g., 1280x1024). -.PP -The first geometry following -.B display -is the geometry of the screen window on the backend server. The second -geometry, which is always preceded by a slash, is the geometry of the -root window. By default, the root window has the same geometry as the -screen window. -.PP -The -.B option -line can be used to specify any command-line options (e.g., -.BR \-input ). -(It cannot be used to specify the name of the front-end display.) The -option line is processed once at server startup, just line command line -options. This behavior may be unexpected. -.SH "CONFIGURATION FILE EXAMPLES" -Two displays being used for a desktop may be specified in any of the -following formats: -.RS -.nf -virtual example0 { - display d0:0 1280x1024 @0x0; - display d1:0 1280x1024 @1280x0; -} -.sp -virtual example1 { - display d0:0 1280x1024; - display d1:0 @1280x0; -} -.sp -virtual example2 { - display "d0:0"; - display "d1:0" @1280x0; -} -.sp -virtual example3 { wall 2x1 d0:0 d1:0; } -.fi -.RE -A 4x4 wall of 16 total displays could be specified as follows (if no -tiling dimension is specified, an approximate square is used): -.RS -.nf -virtual example4 { - wall d0:0 d1:0 d2:0 d3:0 - d4:0 d5:0 d6:0 d7:0 - d8:0 d9:0 da:0 db:0 - dc:0 dd:0 de:0 df:0; -} -.fi -.RE -.SH "FONT PATHS" -The font path used by the -.I Xdmx -front-end server will be propagated to each back-end server,which -requires that each back-end server have access to the exact same font -paths as the front-end server. This can be most easily handled by -either using a font server (e.g., xfs) or by remotely mounting the font -paths on each back-end server, and then setting the -.I Xdmx -server's default font path with the --I "-fontpath" -command line option described above. -.PP -For example, if you specify a font path with the following command line: -.RS -Xdmx :1 -display d0:0 -fontpath /usr/fonts/75dpi/ -fontpath /usr/fonts/Type1/ +xinerama -.RE -Then, /usr/fonts/75dpi/ and /usr/fonts/Type1/ must be valid font paths -on the -.I Xdmx -server and all back-end server, which is d0 in this example. -.PP -Font servers can also be specified with the -.I "-fontpath" -option. For example, let's assume that a properly configured font -server is running on host d0. Then, the following command line -.RS -Xdmx :1 -display d0:0 -display d1:0 -fontpath tcp/d0:7100 +xinerama -.RE -will initialize the front-end -.I Xdmx -server and each of the back-end servers to use the font server on d0. -.PP -Some fonts might not be supported by either the front-end or the -back-end servers. For example, let's assume the front-end -.I Xdmx -server includes support Type1 fonts, but one of the back-end servers -does not. Let's also assume that the default font path for -.I Xdmx -includes Type1 fonts in its font path. Then, when -.I Xdmx -initializes the default font path to load the default font, the font -path that includes Type1 fonts (along with the other default font paths -that are used by the -.I Xdmx -server) is sent to the back-end server that cannot handle Type1 fonts. -That back-end server then rejects the font path and sends an error back -to the -.I Xdmx -server. -.I Xdmx -then prints an error message and exits because it failed to set the -default font path and was unable load the default font. -.PP -To fix this error, the offending font path must be removed from the -default font path by using a different -.I "-fontpath" -command line option. -.PP -The -.I "-fontpath" -option can also be added to the configuration file as described above. -.SH "COMMAND-LINE EXAMPLES" -The back-end machines are d0 and d1, core input is from the pointer and -keyboard attached to d0, clients will refer to :1 when opening windows: -.RS -Xdmx :1 -display d0:0 -display d1:0 +xinerama -.RE -.PP -As above, except with core input from d1: -.RS -Xdmx :1 -display d0:0 -display d1:0 -input d1:0 +xinerama -.RE -.PP -As above, except with core input from a console window on the local -display: -.RS -Xdmx :1 -display d0:0 -display d1:0 -input :0 +xinerama -.RE -.PP -As above, except with core input from the local keyboard and mouse: -.RS -Xdmx :1 -display d0:0 -display d1:0 -input local,usb-kbd,usb-mou +xinerama -.RE -Note that local input can be used under Linux while another X session is -running on :0 (assuming the user can access the Linux console tty and -mouse devices): a new (blank) VC will be used for keyboard input on the -local machine and the Ctrl-Alt-F* sequence will be available to change -to another VC (possibly back to another X session running on the local -machine). Using Ctrl-Alt-Backspace on the blank VC will terminate the -Xdmx session and return to the original VC. -.PP -This example uses the configuration file shown in the previous section: -.RS -Xdmx :1 -input :0 +xinerama -configfile filename -config example2 -.RE -With this configuration file line: -.RS -option -input :0 +xinerama; -.RE -the command line can be shortened to: -.RS -Xdmx :1 -configfile filename -config example2 -.RE -.SH "USING THE USB DEVICE DRIVERS" -.P -The USB device drivers use the devices called -.IR /dev/input/event0 ", " /dev/input/event1 ", etc." -under Linux. These devices are driven using the -.I evdev -Linux kernel module, which is part of the hid suite. Please note that -if you load the -.I mousedev -or -.I kbddev -Linux kernel modules, then USB devices will appear as core Linux input -devices and you will not be able to select between using the device only -as an -.I Xdmx -core device or an -.I Xdmx -XInput extension device. Further, you may be unable to unload the -.I mousedev -Linux kernel module if -.I XFree86 -is configured to use -.I /dev/input/mice -as an input device (this is quite helpful for laptop users and is set up -by default under some Linux distributions, but should be changed if USB -devices are to be used with -.IR Xdmx ). -.PP -The USB device drivers search through the Linux devices for the first -mouse, keyboard, or non-mouse-non-keyboard Linux device and use that -device. -.SH "KEYBOARD INITIALIZATION" -.PP -If -.I Xdmx -was invoked with -.I \-xkb -or was -.B not -compiled to use the XKEYBOARD extension, then a keyboard on a backend or -console will be initialized using the map that the host X server -provides. -.PP -If the XKEYBOARD extension is used for both -.I Xdmx -and the host X server for the keyboard (i.e., the backend or console X -server), then the type of the keyboard will -be obtained from the host X server and the keyboard under -.I Xdmx -will be initialized with that information. Otherwise, the default type -of keyboard will be initialized. In both cases, the map from the host X -server will -.B not -be used. This means that different initial behavior may be noted with -and without XKEYBOARD. Consistent and expected results will be obtained -by running XKEYBOARD on all servers and by avoiding the use of -.I xmodmap -on the backend or console X servers prior to starting -.IR Xdmx . -.PP -If -.I \-xkbmap -is specified on the -.I Xdmx -command line, then that map will currently be used for all keyboards. -.SH "MULTIPLE CORE KEYBOARDS" -X was not designed to support multiple core keyboards. However, -.I Xdmx -provides some support for multiple core keyboards. Best results will be -obtained if all of the keyboards are of the same type and are using the -same keyboard map. Because the X server passes raw key code information -to the X client, key symbols for keyboards with different key maps would -be different if the key code for each keyboard was sent without -translation to the client. Therefore, -.I Xdmx -will attempt to translate the key code from a core keyboard to the key -code for the key with the same key symbol of the -.B first -core keyboard that was loaded. If the key symbol appears in both maps, -the results will be expected. Otherwise, the second core keyboard will -return a NoSymbol key symbol for some keys that would have been -translated if it was the first core keyboard. -.ig -.SH ENVIRONMENT -.. -.ig -.SH FILES -.. -.SH "SEE ALSO" -.BR DMX "(@libmansuffix@), " X "(@miscmansuffix@), " -.BR Xserver "(@appmansuffix@), " xdmxconfig "(@appmansuffix@), " -.BR vdltodmx "(@appmansuffix@), " xfs "(@appmansuffix@), " -.BR xkbcomp "(@appmansuffix@), " xkeyboard-config "(@miscmansuffix@)" -.SH AUTHORS -Kevin E. Martin -.I <kem@redhat.com>, -David H. Dawes -.I <dawes@xfree86.org>, -and -Rickard E. (Rik) Faith -.IR <faith@redhat.com> . -.PP -Portions of -.I Xdmx -are based on code from The XFree86 Project -.RI ( http://www.xfree86.org ) -and X.Org -.RI ( https://www.x.org ). diff --git a/hw/dmx/meson.build b/hw/dmx/meson.build deleted file mode 100644 index c7f20c71a..000000000 --- a/hw/dmx/meson.build +++ /dev/null @@ -1,92 +0,0 @@ -srcs = [ - 'dmx.c', - 'dmxcb.c', - 'dmxcmap.c', - 'dmxcursor.c', - 'dmxdpms.c', - 'dmxextension.c', - 'dmxfont.c', - 'dmxgc.c', - 'dmxgcops.c', - 'dmxinit.c', - 'dmxinput.c', - 'dmxlog.c', - 'dmxpict.c', - 'dmxpixmap.c', - 'dmxprop.c', - 'dmxscrinit.c', - 'dmxstat.c', - 'dmxsync.c', - 'dmxvisual.c', - 'dmxwindow.c', - '../../mi/miinitext.c', - '../../mi/miinitext.h', - '../../Xext/panoramiX.c', -] - -subdir('config') -subdir('input') -subdir('examples') -subdir('doc') -# XXX: subdir('doxygen') - -install_man(configure_file( - input: 'man/Xdmx.man', - output: 'Xdmx.1', - configuration: manpage_config, -)) - -install_man(configure_file( - input: 'config/man/dmxtodmx.man', - output: 'dmxtodmx.1', - configuration: manpage_config, -)) - -install_man(configure_file( - input: 'config/man/vdltodmx.man', - output: 'vdltodmx.1', - configuration: manpage_config, -)) - -install_man(configure_file( - input: 'config/man/xdmxconfig.man', - output: 'xdmxconfig.1', - configuration: manpage_config, -)) - -dmx_dep = [ - common_dep, - dependency('dmxproto', version: '>= 2.2.99.1'), - dependency('xext', version: '>= 1.0.99.4'), - dependency('xau'), - dependency('xmuu'), - dependency('xfixes'), - dependency('xrender'), - dependency('xi', version: '>= 1.2.99.1'), - xdmcp_dep, - dl_dep, -] - -dmx_glx = [] -if build_glx - srcs += 'dmx_glxvisuals.c' - subdir('glxProxy') -endif - -executable( - 'Xdmx', - srcs, - include_directories: inc, - dependencies: dmx_dep, - link_with: [ - libxserver_main, - libxserver_fb, - libxserver, - libxserver_xkb_stubs, - dmx_input, - dmx_config, - dmx_glx, - ], - c_args: '-DHAVE_DMX_CONFIG_H', - install: true, -) diff --git a/hw/meson.build b/hw/meson.build index 96c1559c3..0f43ab6e2 100644 --- a/hw/meson.build +++ b/hw/meson.build @@ -2,10 +2,6 @@ if get_option('xephyr') subdir('kdrive') endif -if get_option('dmx') - subdir('dmx') -endif - if get_option('xvfb') subdir('vfb') endif diff --git a/man/Xserver.man b/man/Xserver.man index 31c3bd334..764bd1d90 100644 --- a/man/Xserver.man +++ b/man/Xserver.man @@ -608,7 +608,7 @@ Controlling the server once started: \fIxset\fP(1), \fIxsetroot\fP(1), \fIxhost\fP(1), \fIxinput\fP(1), \fIxrandr\fP(1) .PP Server-specific man pages: -\fIXorg\fP(1), \fIXdmx\fP(1), \fIXephyr\fP(1), \fIXnest\fP(1), +\fIXorg\fP(1), \fIXephyr\fP(1), \fIXnest\fP(1), \fIXvfb\fP(1), \fIXquartz\fP(1), \fIXWin\fP(1). .PP Server internal documentation: diff --git a/meson_options.txt b/meson_options.txt index 5977ddc13..93e13f9ef 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -10,8 +10,6 @@ option('xwayland_eglstream', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Enable EGLStream support for glamor on Xwayland') option('xnest', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', description: 'Enable Xnest nested X server') -option('dmx', type: 'boolean', value: false, - description: 'Enable DMX nested X server') option('xvfb', type: 'boolean', value: true, description: 'Enable Xvfb X server') option('xwin', type: 'combo', choices: ['true', 'false', 'auto'], value: 'auto', |