diff options
author | Daniel Stone <daniel@fooishbar.org> | 2008-07-24 03:01:45 +0300 |
---|---|---|
committer | Daniel Stone <daniel@fooishbar.org> | 2008-07-24 03:01:45 +0300 |
commit | 5c1e254cc85e9ad409b0217780545c29f62d5feb (patch) | |
tree | 395781a512a05380f1ab1324a8c86381abb34444 | |
parent | b74927c3844bc2650d95f604fe782d95ade067f1 (diff) |
Remove xorgcfg
Us shipping a GUI configuration utility (especially as part of the
server!) was pretty pointless. There was pretty much nothing it could
configure which wasn't already runtime adjustable: if you could get a
server up with functioning input and output, there wasn't much xorgcfg
could do for you.
Au revoir.
58 files changed, 1 insertions, 26319 deletions
diff --git a/configure.ac b/configure.ac index 9007f5aeb..13ca802de 100644 --- a/configure.ac +++ b/configure.ac @@ -1784,28 +1784,6 @@ AC_TRY_COMPILE([ AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix]) -dnl xorgcfg GUI configuration utility -AC_ARG_ENABLE(xorgcfg, AS_HELP_STRING([--enable-xorgcfg], - [Build xorgcfg GUI configuration utility (default: no)]), - [XORGCFG=$enableval],[XORGCFG=no]) -if test x$XORGCFG = xyes ; then - PKG_CHECK_MODULES([XORGCFG_DEP], - [xkbui >= 1.0.2 xkbfile xxf86vm xaw7 xmu xt xpm xext x11]) - XORGCFG_DEP_CFLAGS="$XORGCFG_DEP_CFLAGS" - AC_CHECK_LIB([curses],[waddstr], - [XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lcurses"; CURSES=yes], - AC_CHECK_LIB([ncurses],[waddstr], - [XORGCFG_DEP_LIBS="$XORGCFG_DEP_LIBS -lncurses" ; CURSES=yes], - [CURSES=no])) - AC_SUBST(XORGCFG_DEP_CFLAGS) - AC_SUBST(XORGCFG_DEP_LIBS) - - APPDEFAULTDIR=$(pkg-config --variable=appdefaultdir xt) - AC_SUBST(APPDEFAULTDIR) -fi -AM_CONDITIONAL(BUILD_XORGCFG, [test x$XORGCFG = xyes]) -AM_CONDITIONAL(USE_CURSES, [test x$CURSES = xyes]) - BUILD_DATE="$(date +'%Y%m%d')" AC_SUBST([BUILD_DATE]) BUILD_TIME="$(date +'1%H%M%S')" @@ -1888,7 +1866,6 @@ hw/xfree86/xf8_16bpp/Makefile hw/xfree86/utils/Makefile hw/xfree86/utils/cvt/Makefile hw/xfree86/utils/gtf/Makefile -hw/xfree86/utils/xorgcfg/Makefile hw/dmx/config/Makefile hw/dmx/doc/Makefile hw/dmx/examples/Makefile diff --git a/hw/xfree86/utils/Makefile.am b/hw/xfree86/utils/Makefile.am index 655c447b7..d27861b03 100644 --- a/hw/xfree86/utils/Makefile.am +++ b/hw/xfree86/utils/Makefile.am @@ -1,4 +1,3 @@ SUBDIRS = \ gtf \ - cvt \ - xorgcfg + cvt diff --git a/hw/xfree86/utils/xorgcfg/.gitignore b/hw/xfree86/utils/xorgcfg/.gitignore deleted file mode 100644 index 378869b1c..000000000 --- a/hw/xfree86/utils/xorgcfg/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -xorgcfg.1 -xorgcfg.1x diff --git a/hw/xfree86/utils/xorgcfg/Makefile.am b/hw/xfree86/utils/xorgcfg/Makefile.am deleted file mode 100644 index 31d1b3f00..000000000 --- a/hw/xfree86/utils/xorgcfg/Makefile.am +++ /dev/null @@ -1,164 +0,0 @@ -# Copyright 2005 Sun Microsystems, 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, and/or sell copies of the Software, and to permit persons -# to whom the Software is furnished to do so, provided that the above -# copyright notice(s) and this permission notice appear in all copies of -# the Software and that both the above copyright notice(s) and this -# permission notice appear in supporting documentation. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -# OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -# OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -# HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL -# INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING -# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, -# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION -# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -# -# Except as contained in this notice, the name of a copyright holder -# shall not be used in advertising or otherwise to promote the sale, use -# or other dealings in this Software without prior written authorization -# of the copyright holder. -# - -if BUILD_XORGCFG -bin_PROGRAMS = xorgcfg - -INCLUDES = $(XORG_INCS) -I$(top_srcdir)/hw/xfree86/parser - -OPTIONSPATH=$(libdir)/X11 - -xorgcfg_CFLAGS = $(DIX_CFLAGS) $(XORG_CFLAGS) $(CURSESDEFINES) \ - $(XORGCFG_DEP_CFLAGS) -DXKB_RULES_DIR=\"$(XKB_BASE_DIRECTORY)/rules\" \ - -DPROJECT_ROOT=\"$(PROJECTROOT)\" -DOPTIONSPATH=\"$(OPTIONSPATH)\" -xorgcfg_LDADD = $(XORGCFG_DEP_LIBS) ../../parser/libxf86config.a $(LOADERLIB) \ - ../../os-support/libxorgos.la ../../dummylib/libdummy-nonserver.a \ - ${SYS_LIBS} - -#if DoLoadableServer -LDSRCS = \ - loader.c loadmod.c -LOADERLIB = ../../loader/libloader.a -#endif - -if USE_CURSES -TEXTSRC = text-mode.c -TEXTOBJ = text-mode.o -CURSESDEFINES = -DHAS_NCURSES -endif - -if NEED_STRLCAT -STRL_SRCS = $(top_srcdir)/os/strlcat.c $(top_srcdir)/os/strlcpy.c -endif -endif BUILD_XORGCFG - -xorgcfg_SOURCES = \ - accessx.c \ - card-cfg.c \ - cards.c \ - config.c \ - expert.c \ - help.c \ - interface.c \ - keyboard-cfg.c \ - $(LDSRCS) \ - monitor-cfg.c \ - mouse-cfg.c \ - options.c \ - screen-cfg.c \ - screen.c \ - $(SNPRINTFSRCS) \ - startx.c \ - $(STRLSRCS) \ - stubs.c \ - $(TEXTSRC) \ - vidmode.c \ - xf86config.c \ - card-cfg.h \ - cards.h \ - config.h \ - help.h \ - keyboard-cfg.h \ - loader.h \ - monitor-cfg.h \ - mouse-cfg.h \ - options.h \ - screen-cfg.h \ - screen.h \ - stubs.h \ - vidmode.h \ - xf86config.h \ - $(STRL_SRCS) - -BITMAPS = \ - card.xbm \ - keyboard.xbm \ - monitor.xbm \ - mouse.xbm \ - left.xbm \ - right.xbm \ - up.xbm \ - down.xbm \ - wider.xbm \ - narrower.xbm \ - shorter.xbm \ - taller.xbm - -PIXMAPS = \ - card.xpm \ - computer.xpm \ - keyboard.xpm \ - monitor.xpm \ - mouse.xpm - -# Rules needed to cpp man page & app-defaults -include $(top_srcdir)/cpprules.in - -if BUILD_XORGCFG -XBMdir = $(includedir)/X11/bitmaps -XPMdir = $(includedir)/X11/pixmaps - -XBM_DATA = $(BITMAPS) -XPM_DATA = $(PIXMAPS) - -# App default files (*.ad) - -appdefaultdir = @APPDEFAULTDIR@ - -APPDEFAULTFILES = XOrgCfg - -appdefault_DATA = $(APPDEFAULTFILES) - -CPP_FILES_FLAGS = -D__VENDORNAME__="@VENDOR_STRING_SHORT@" \ - -D__VENDORVERS__="@VENDOR_MAN_VERSION@" - -# dear automake: it would be really nice if you would actually put things into -# .SUFFIXES so i wouldnt' have to do this. -XOrgCfg: XOrgCfg.pre - $(RAWCPP) $(RAWCPPFLAGS) $(CPP_FILES_FLAGS) < XOrgCfg.pre | $(CPP_SED_MAGIC) > $@ - -# Man page -appmandir = $(APP_MAN_DIR) - -appman_PRE = xorgcfg.man -appman_DATA = $(appman_PRE:man=@APP_MAN_SUFFIX@) - -all-local: $(appman_PRE) $(appman_DATA) - -BUILT_SOURCES = $(appman_PRE) -CLEANFILES = $(APPDEFAULTFILES) $(BUILT_SOURCES) $(appman_DATA) - -SUFFIXES += .$(APP_MAN_SUFFIX) .man - -.man.$(APP_MAN_SUFFIX): - -rm -f $@ - $(LN_S) $< $@ - -endif BUILD_XORGCFG - -EXTRA_DIST = $(BITMAPS) $(PIXMAPS) XOrgCfg.pre xorgcfg.man.pre diff --git a/hw/xfree86/utils/xorgcfg/TODO b/hw/xfree86/utils/xorgcfg/TODO deleted file mode 100644 index d8d1cd5ee..000000000 --- a/hw/xfree86/utils/xorgcfg/TODO +++ /dev/null @@ -1,33 +0,0 @@ -$XFree86$ - -o Have code to fetch the SymTabRec chipset list from a video driver. - This is mostly useful for the testing tool/interface, so that the - Cards file "uptodate" state can also be verified. - Probably it is better to forgot about the Cards file, and - either parse the output of scanpci, or link libscanpci.a - (and whatever else be required) in xorgcfg. - -o Check if a module is "certified", there was some talk about a - certification process in the past. - -o Rewrite mouse driver to use the same code as video drivers, so that - it is possible to store all available options in a single place. - This would also require rewriting all existing input device modules. - (Probably most of this can be made with cpp macros). - -o Create a protocol to allow 3rd part xorgcfg modules. - -o Write an interface for testing extensions/accel, maybe a frontend to - xdpyinfo, x11perf, glxinfo, etc. - -o Write a "wizard" mode, as several users find the graphical interface - too complicated, but find the text one easier to user. - -o Write code to use a Monitors database, either update the old Monitors - file or use RedHat MonitorsDB. - Chris Morgan is writting code to use MonitorsDB. - If xorgcfg could be changed to ddcprobe (in all supported platforms), - it would be even be a better solution than using a database. - -o Add interface to allow changing comments without the need of editing - config file with a text editor. diff --git a/hw/xfree86/utils/xorgcfg/XOrgCfg.pre b/hw/xfree86/utils/xorgcfg/XOrgCfg.pre deleted file mode 100644 index 0e7148de6..000000000 --- a/hw/xfree86/utils/xorgcfg/XOrgCfg.pre +++ /dev/null @@ -1,1852 +0,0 @@ -!! $XdotOrg: $ -!! -!! Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) -!! -!! 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 -!! CONECTIVA LINUX 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 Conectiva Linux shall -!! not be used in advertising or otherwise to promote the sale, use or other -!! dealings in this Software without prior written authorization from -!! Conectiva Linux. -!! -!! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> -!! -!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.13 2001/05/15 18:22:23 paulo Exp $ -!! - -*Form.background: gray85 -*Label.background: gray85 -!! keyboard -*Core.background: gray85 -*Label.foreground: gray20 -*Command.background: gray80 -*Command.foreground: gray20 -*Command.borderWidth: 0 -*Command.displayList:\ -foreground gray60;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray90;\ -lines -1,0,0,0,0,-1 - -*Text.?.foreground: gray20 -*Text.borderWidth: 0 -*Text.background: gray96 -*Text.?.cursorColor: rgb:d/5/5 -*Text.displayList:\ -foreground white;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray40;\ -lines -1,0,0,0,0,-1 - -*baseTranslations: #override \ -<Key>Escape: vidmode-restore() - -*List.background: gray96 -*List.foreground: gray20 -*Viewport.borderColor: gray40 -*List.borderColor: gray40 - -*MenuButton.background: gray80 -*MenuButton.foreground: gray20 -*MenuButton.borderWidth: 0 -*MenuButton.displayList:\ -line-style solid;\ -foreground gray40;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray90;\ -lines -1,0,0,0,0,-1;\ -line-style onoffdash;\ -foreground gray80;\ -draw-rect 1,1,-2,-2 - -*SimpleMenu.background: gray80 -*SimpleMenu.?.foreground: gray20 -*SimpleMenu.borderWidth: 0 -*SimpleMenu.displayList:\ -foreground gray40;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray90;\ -lines -1,0,0,0,0,-1 - -*Dialog.displayList:\ -foreground gray40;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray90;\ -lines -1,0,0,0,0,-1 - -*Toggle.background: gray80 -*Toggle.foreground: gray20 -*Toggle.borderWidth: 0 -*Toggle.displayList:\ -foreground gray90;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray40;\ -lines -1,0,0,0,0,-1 - -*mouse.bitmap: mouse.xbm -*keyboard.bitmap: keyboard.xbm -*card.bitmap: card.xbm -*monitor.bitmap: monitor.xbm - -*Label.borderWidth: 0 -*Viewport.forceBars: True -*Viewport.allowVert: True -*Viewport.useRight: True - -.xorgcfg.geometry: 320x400 -.xorgcfg.minWidth: 320 -.xorgcfg.minHeight: 400 -.xorgcfg.maxWidth: 320 -.xorgcfg.maxHeight: 400 - -.xorgcfg.config.geometry: 320x369 -.xorgcfg.config.minWidth: 320 -.xorgcfg.config.maxWidth: 320 -.xorgcfg.config.minHeight: 369 -.xorgcfg.config.maxHeight: 369 - -*work.width: 320 -*work.height: 240 - -*error.label.label:\ -Not all required fields\n\ -were filled, or the specified\n\ -identifier is duplicated. -*error.label.vertDistance: 30 -*error.label.borderWidth: 0 -*error.label.leftBitmap: Excl -*error.command.fromVert: label -*error.command.label: Ok -*error.command.vertDistance: 20 - -*Scrollbar.translations:\ -<BtnDown>: StartScroll(Continuous) MoveThumb() NotifyThumb()\n\ -<BtnMotion>: MoveThumb() NotifyThumb()\n\ -<BtnUp>: NotifyScroll(Proportional) EndScroll() - -*Scrollbar.background: gray80 -*Scrollbar.foreground: rgb:a/5/5 -*Scrollbar.borderWidth: 0 -*Scrollbar.thumb: vlines2 -*Scrollbar.displayList:\ -foreground gray90;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray40;\ -lines -1,0,0,0,0,-1 - -*Text.Translations: #override \ -<Enter>: no-op()\n\ -<Leave>: no-op()\n\ -<Btn1Down>: set-keyboard-focus() select-start() - -*top.identifier.Translations: #override \ -<Enter>: no-op()\n\ -<Leave>: no-op()\n\ -<Key>Return: no-op()\n\ -<Btn1Down>: set-keyboard-focus() select-start() - -*List.showCurrent: True -*Tip.timeout: 100 -*Tip.background: rgb:f/f/8 -*Tip.foreground: gray20 -*Tip.borderWidth: 0 -*Tip.displayList:\ -foreground rgb:8/8/4;\ -lines 1,-1,-1,-1,-1,1;\ -foreground rgb:f/f/c;\ -lines -1,0,0,0,0,-1 - -*Toggle.internalHeight: 2 -*Toggle.internalWidth: 2 -*mouse.label: Mouse -*keyboard.label: Keyboard -*card.label: Card -*monitor.label: Monitor - -*commands.borderWidth: 0 -*commands.defaultDistance: 2 -*commands.?.bottom: chainTop -*commands.height: 50 - -*commands.keyboard.fromHoriz: mouse -*card.fromHoriz: keyboard -*monitor.fromHoriz: card - -*commands.mouse*new.label: Add new mouse -*commands.keyboard*new.label: Add new keyboard -*commands.card*new.label: Add new video card -*commands.monitor*new.label: Add new monitor -*commands.mouse*configure.label: Configure mouse(s) -*commands.keyboard*configure.label: Configure keyboard(s) -*commands.card*configure.label: Configure video card(s) -*commands.monitor*configure.label: Configure monitor(s) -*commands.mouse*SimpleMenu*newMouse.label: New mouse -*commands.keyboard*SimpleMenu*newKeyboard.label:New keyboard -*commands.card*SimpleMenu*newcard.label: New card -*commands.monitor*SimpleMenu*newMonitor.label: New monitor - -*commands.MenuButton.translations: \ -<Enter>: highlight()\n\ -<Leave>: reset()\n\ -Any<BtnDown>: highlight() set() PopupMenu() - -*hpane.showGrip: False -*hpane.expert.label: Expert Mode -*topM.min: 200 -*topM.max: 200 -*topM.justify: left -*topM.label: Configure Layout -*topM*layout.label: Configure Layout -*topM*screen.label: Configure Screen -*topM*modeline.label: Configure Modeline -*topM*accessx.label: Configure AccessX -*topM.showGrip: False -*work.showGrip: False - -*MenuButton.leftBitmap: menu10 -*SmeBSB.HorizontalMargins: 18 - -*back.label: << Back -*next.label: Next >> -*ok.label: Ok -*cancel.label: Cancel -*yes.label: Yes -*no.label: No - -*help.label: Help -*quit.label: Quit -*next.fromHoriz: back -*config*ok.fromHoriz: next -*bottom*cancel.fromHoriz: ok -*top.displayList:\ -foreground gray60;\ -lines 1,-1,-1,-1,-1,1;\ -foreground white;\ -lines -1,0,0,0,0,-1 -*bottom.displayList:\ -foreground gray60;\ -lines 1,-1,-1,-1,-1,1;\ -foreground white;\ -lines -1,0,0,0,0,-1 -*work.displayList:\ -foreground gray60;\ -lines 1,-1,-1,-1,-1,1;\ -foreground white;\ -lines -1,0,0,0,0,-1 -*options.pane.Form.displayList:\ -foreground gray60;\ -lines 1,-1,-1,-1,-1,1;\ -foreground white;\ -lines -1,0,0,0,0,-1 - -*top.label.label: Identifier: -*top.label.borderWidth: 0 -*top.identifier.fromHoriz: label -*top.label.internalHeight: 3 -*top.label.justify: left -*top.label.left: chainLeft -*top.label.right: chainLeft -*top.identifier.left: chainLeft -*top.identifier.right: chainRight - -*bottom.layout.translations: #override \ -<Key>Return: rename-layout() -*bottom.layout.label: New server layout -*bottom.layout.tip: Type a text and press Return to rename this layout -*bottom.Command.height: 19 -*bottom.Text.height: 19 -*bottom.MenuButton.height: 19 -*bottom*new.label: New server layout -*layout.fromHoriz: select -*help.fromHoriz: layout -*bottom.layout.justify: left -*bottom.select.label: Layout -*bottom.select.left: chainLeft -*bottom.select.right: chainLeft -*bottom.layout.left: chainLeft -*quit.fromHoriz: help -*bottom.?.left: chainRight -*bottom.?.right: chainRight -*bottom.?.top: chainBottom -*bottom.?.bottom: chainBottom - -*pane.bottom.min: 30 -*pane.bottom.max: 30 -*pane.bottom.showGrip: False -*pane.bottom.defaultDistance: 5 - -!! Wellcome message -*work.wellcome.borderWidth: 0 -*work.wellcome.label: Welcome to __VENDORNAME__ __VENDORVERS__ setup program -*work.?.borderWidth: 0 -!*work.?.width: 310 -*work.?.height: 290 - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! mouseDP widget -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*mouseDP*Label.internalHeight: 0 -*mouseDP*Label.borderWidth: 0 -*mouseDP.labelD.vertDistance: 0 -*mouseDP.labelD.label: Select mouse device -*mouseDP.device.fromVert: labelD -*mouseDP.viewportD.fromVert: device -*mouseDP.device.width: 302 -*mouseDP.viewportD.vertDistance: 2 -*mouseDP.viewportD.listD.longest: 135 -*mouseDP.viewportD.width: 302 -*mouseDP.viewportD.height: 87 -*mouseDP.labelP.label: Select mouse protocol -*mouseDP.labelP.vertDistance: 10 -*mouseDP.labelP.fromVert: viewportD -*mouseDP.viewportP.fromVert: labelP -*mouseDP.viewportP.forceBars: True -*mouseDP.viewportP.allowVert: True -*mouseDP.viewportP.useRight: True -*mouseDP.viewportP.listP.longest: 135 -*mouseDP.viewportP.width: 302 -*mouseDP.viewportP.height: 110 -*mouseDP.viewportP.vertDistance: 6 -*mouseDP*List.verticalList: True -*mouseDP.emulate3.fromVert: viewportP -*mouseDP.emulate3.width: 180 -*mouseDP.apply.label: Apply changes -*mouseDP.apply.fromVert: viewportP -*mouseDP.apply.fromHoriz: emulate3 -*mouseDP.apply.width: 116 -*mouseDP.emulate3.vertDistance: 10 -*mouseDP.apply.vertDistance: 10 -*mouseDP.emulate3.label: Emulate 3 buttons -*mouseDP.emulate3.tip: Select if your mouse has only two buttons - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! keyboardML widget -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*keyboardML.Label.vertDistance: 8 -*keyboardML.MenuButton.vertDistance: 8 -*keyboardML.keyboard.vertDistance: 10 -*keyboardML.Label.borderWidth: 0 -*keyboardML.Label.width: 115 -*keyboardML.MenuButton.width: 185 -*keyboardML.MenuButton.justify: left -*keyboardML.Label.internalWidth: 0 -*keyboardML.Label.justify: right -*keyboardML.labelR.label: Xkb rules: -*keyboardML.rules.left: chainRight -*keyboardML.rules.right: chainRight -*keyboardML.rules.fromHoriz: labelR -*keyboardML.model.fromVert: rules -*keyboardML.labelM.fromVert: rules -*keyboardML.model.left: chainRight -*keyboardML.model.right: chainRight -*keyboardML.model.fromHoriz: labelM -*keyboardML.labelM.label: Keyboard model: -*keyboardML.layout.left: chainRight -*keyboardML.layout.right: chainRight -*keyboardML.layout.fromVert: model -*keyboardML.labelL.fromVert: model -*keyboardML.layout.fromHoriz: labelL -*keyboardML.labelL.label: Keyboard layout: -*keyboardML.variant.fromVert: labelL -*keyboardML.variant.fromHoriz: labelV -*keyboardML.labelV.fromVert: labelL -*keyboardML.labelV.label: Xkb variant: -*keyboardML.options.fromVert: labelV -*keyboardML.options.fromHoriz: labelO -*keyboardML.labelO.fromVert: labelV -*keyboardML.labelO.label: Xkb options: -*keyboardML.keyboard.fromVert: labelO -*keyboardML.keyboard.borderWidth: 0 -*keyboardML.keyboard.width: 305 -*keyboardML.keyboard.height: 121 -*keyboardML.apply.vertDistance: 16 -*keyboardML.apply.fromVert: keyboard -*keyboardML.apply.label: Apply changes - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! cardModel widget -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*cardModel.label.internalHeight: 0 -*cardModel.keyboard.borderWidth: 0 -*cardModel.label.label: Card model filter -*cardModel.label.internalHeight: 2 -*cardModel.label.borderWidth: 0 -*cardModel.viewport.vertDistance: 2 -*cardModel.viewport.fromVert: filter -*cardModel.filter.fromHoriz: label -*cardModel.filter.width: 171 -*cardModel.viewport.width: 302 -*cardModel.viewport.height: 212 -*cardModel.driver.justify: left -*cardModel.driverL.label: Driver -*cardModel.driverL.fromVert: viewport -*cardModel.driverL.width: 50 -*cardModel.driverL.justify: right -*cardModel.driver.fromVert: viewport -*cardModel.driver.fromHoriz: driverL -*cardModel.driver.width: 250 -*cardModel.driver.left: chainRight -*cardModel.driver.right: chainRight -*cardModel.busidL.label: BusID -*cardModel.busidL.fromVert: driver -*cardModel.busidL.width: 50 -*cardModel.busidL.justify: right -*cardModel.busid.fromVert: driver -*cardModel.busid.fromHoriz: busidL -*cardModel.busid.width: 250 -*cardModel.busid.left: chainRight -*cardModel.busid.right: chainRight -*cardModel.viewport.forceBars: True -*cardModel.viewport.allowVert: True -*cardModel.viewport.useRight: True -*cardModel.viewport.list.longest: 277 -*cardModel.filter.tip: Type name or vendor of your card and press enter -*cardModel.filter.translations: #override \ -<Key>Return: filter-card() - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! main widget -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*work.cpu.backgroundPixmap: computer.xpm -*work.mouse.backgroundPixmap: mouse.xpm -*work.keyboard.backgroundPixmap: keyboard.xpm -*work.card.backgroundPixmap: card.xpm -*work.monitor.backgroundPixmap: monitor.xpm - -*work.cpu.x: 130 -*work.cpu.y: 160 -*work.cpu.width: 30 -*work.cpu.height: 50 -*work.mouse.width: 26 -*work.mouse.height: 35 -*work.keyboard.width: 60 -*work.keyboard.height: 28 -*work.card.width: 41 -*work.card.height: 40 -*work.monitor.width: 47 -*work.monitor.height: 40 - -.xorgcfg.pane.work.Simple.borderWidth: 1 -.xorgcfg.pane.work.Simple.translations:\ -Any<Btn1Down>: select-device()\n\ -Any<Btn1Motion>: move-device()\n\ -Any<Btn1Up>: unselect-device()\n\ -Any<Btn3Down>: device-popup()\n\ -Any<Btn3Up>: device-popdown() - -.xorgcfg.pane.work.screen.translations:\ -Any<Btn1Down>: select-device()\n\ -Any<Btn1Motion>: move-device()\n\ -Any<Btn1Up>: unselect-device()\n\ -Any<Btn3Down>: device-popup()\n\ -Any<Btn3Up>: device-popdown() - -Xorgcfg.translations: #override \ -<Message>WM_PROTOCOLS: quit() -.xorgcfg.config.translations: #override \ -<Message>WM_PROTOCOLS: config-cancel() -.xorgcfg.options.translations: #override \ -<Message>WM_PROTOCOLS: options-cancel() -.xorgcfg.quit.translations: #override \ -<Message>WM_PROTOCOLS: quit-cancel() -.xorgcfg.error.translations: #override \ -<Message>WM_PROTOCOLS: error-cancel() -.xorgcfg.force.translations: #override \ -<Message>WM_PROTOCOLS: addmode-cancel() -.xorgcfg.addMode.translations: #override \ -<Message>WM_PROTOCOLS: addmode-cancel() -.xorgcfg.accessx.translations: #override \ -<Message>WM_PROTOCOLS: accessx-close() -.xorgcfg.test.translations: #override \ -<Message>WM_PROTOCOLS: testmode-cancel() -.xorgcfg.Expert.translations: #override \ -<Message>WM_PROTOCOLS: expert-close() -.xorgcfg.options.moduleOptions.translations: #override \ -<Message>WM_PROTOCOLS: module-options-close() - - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! Options -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -.xorgcfg.options.geometry: 400x176 -.xorgcfg.options.minWidth: 400 -.xorgcfg.options.maxWidth: 400 -.xorgcfg.options.minHeight: 176 -.xorgcfg.options.maxHeight: 176 - -*options*commands.remove.fromHoriz: add -*options*commands.update.fromHoriz: remove -*options*commands.help.fromHoriz: update -*options*commands.min: 30 -*options*commands.max: 30 -*options*commands.showGrip: False -*options*commands.defaultDistance: 4 -*options*commands.?.width: 100 -*options*commands.?.height: 20 - -*options*name.fromHoriz: label1 -*options*label2.fromHoriz: name -*options*value.fromHoriz: label2 -*options*label3.fromHoriz: value -*options*viewport.fromVert: name -*options*Label.borderWidth: 0 -*options.pane.form.Label.internalWidth: 0 -*options.pane.form.Label.height: 21 -*options.pane.form.Text.height: 19 -*options.pane.form.Label.top: chainTop -*options.pane.form.Text.top: chainTop -*options.pane.form.Label.bottom: chainTop -*options.pane.form.Text.bottom: chainTop -*options.pane.form.Label.horizDistance: 0 -*options.pane.form.Text.horizDistance: 0 -*options.pane.form.Label.vertDistance: 8 -*options.pane.form.Text.vertDistance: 8 -*options.pane.form.Text.width: 147 -*options*viewport.width: 390 -*options*viewport.height: 50 - -*options*viewport.horizDistance: 7 -*options*label1.horizDistance: 5 -*options*viewport.left: chainLeft -*options*viewport.right: chainRight -*options*list.longest: 376 - -*options*driverOpts.label: Options for module -*options*driverOpts.justify: left -*options*driverOpts.width: 278 -*options*popdown.label: Popdown dialog -*options*driverOpts.tip: This menu shows:\n\ - o option name\n\ - o option type - -.xorgcfg*options.moduleOptions.geometry: 360x245 -.xorgcfg*options.moduleOptions.minWidth: 360 -.xorgcfg*options.moduleOptions.maxWidth: 360 -.xorgcfg*options.moduleOptions.minHeight: 245 -.xorgcfg*options.moduleOptions.maxHeight: 245 -*options.moduleOptions*descriptions*labelType.label: Select option -*options.moduleOptions*descriptions*labelType.width: 348 -*options.moduleOptions*descriptions*module.fromVert: labelType -*options.moduleOptions*descriptions*module.label: Module -*options.moduleOptions*descriptions*Label.horizDistance: 8 -*options.moduleOptions*descriptions*option.fromVert: labelType -*options.moduleOptions*descriptions*option.label: Option -*options.moduleOptions*descriptions*option.fromHoriz: viewM -*options.moduleOptions*descriptions*viewM.fromVert: module -*options.moduleOptions*descriptions*viewM.width: 120 -*options.moduleOptions*descriptions*viewM.height: 94 -*options.moduleOptions*descriptions*modL.longest: 100 -*options.moduleOptions*descriptions*viewO.fromHoriz: viewM -*options.moduleOptions*descriptions*viewO.fromVert: option -*options.moduleOptions*descriptions*viewO.width: 220 -*options.moduleOptions*descriptions*viewO.height: 94 -*options.moduleOptions*descriptions*optL.longest: 220 -*options.moduleOptions*descriptions*desc.horizDistance: 4 -*options.moduleOptions*descriptions*desc.fromVert: viewM -*options.moduleOptions*descriptions*desc.width: 348 -*options.moduleOptions*descriptions*desc.height: 62 -*options.moduleOptions*descriptions*desc.wrap: word -*options.moduleOptions*descriptions*desc.scrollVertical: Always -*options.moduleOptions*descriptions*desc.Scrollbar.foreground: rgb:a/5/5 -*options.moduleOptions*descriptions*desc.Scrollbar.borderWidth: 1 -*options.moduleOptions*descriptions*desc.Scrollbar.borderColor: gray60 -*options.moduleOptions*descriptions.showGrip: False -*options.moduleOptions*popdown.label: Popdown dialog - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! monitor -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*monitorl*Viewport.width: 302 -*monitorl*Text.width: 160 -*monitorl*Text.tip:\ -Select standard value from the list\n\ -below, or enter specific value here. - -*monitorl*hlabel.justify: right -*monitorl*hlabel.width: 138 -*monitorl*hlabel.label: Horizontal sync -*monitorl*hsync.fromHoriz: hlabel -*monitorl*hviewport.fromVert: hsync -*monitorl*hviewport.height: 156 -*monitorl*hlist.longest: 288 - -*monitorl*vlabel.justify: right -*monitorl*vlabel.width: 138 -*monitorl*vlabel.vertDistance: 12 -*monitorl*vsync.vertDistance: 12 -*monitorl*vlabel.fromVert: hviewport -*monitorl*vsync.fromVert: hviewport -*monitorl*vlabel.label: Vertical sync -*monitorl*vsync.fromHoriz: vlabel -*monitorl*vviewport.fromVert: vsync -*monitorl*vviewport.height: 20 -*monitorl*vlist.longest: 64 - -*monitorl*clabel.vertDistance: 12 -*monitorl*clabel.fromVert: vviewport -*monitorl*clabel.label: Select card connected to monitor -*monitorl*cmenu.fromVert: clabel -*monitorl*cmenu.width: 302 -*monitorl*cmenu.justify: left -*monitorl*none.label: None - -!! vidtune -*vidtune.Repeater.borderWidth: 1 -*vidtune.Repeater.borderColor: gray90 -*vidtune.Repeater.shapeStyle: ellipse -*vidtune.Repeater.foreground: gray30 -*vidtune.Repeater.background: gray80 -*vidtune.Repeater.width: 31 -*vidtune.Repeater.height: 29 -*vidtune.Repeater.repeatDelay: 200 -*vidtune.Repeater.decay: 0 -*vidtune.Repeater.displayList:\ -line-width 2;\ -foreground gray65;\ -draw-arc 0,0,-0,-0,230,180;\ -foreground gray95;\ -draw-arc 0,0,-0,-0,40,180;\ -foreground gray80;\ -draw-arc 0,0,-0,-0,220,10;\ -draw-arc 0,0,-0,-0,40,10 -*vidtune.Repeater.translations:\ -<Enter>: set-values(1, borderColor, gray50)\n\ -<Leave>: set-values(1, borderColor, gray90)\n\ -<Btn1Down>: set-values(1, borderColor, gray90) set() start()\n\ -<Btn1Up>: stop() unset() -*vidtune.left.bitmap: left.xbm -*vidtune.right.bitmap: right.xbm -*vidtune.up.bitmap: up.xbm -*vidtune.down.bitmap: down.xbm -*vidtune.wider.bitmap: wider.xbm -*vidtune.narrower.bitmap: narrower.xbm -*vidtune.shorter.bitmap: shorter.xbm -*vidtune.taller.bitmap: taller.xbm - -*vidtune.vesaB.label: Add standard VESA mode to current screen -*vidtune.vesaB.width: 312 - -*vidtune.screenB.fromVert: mode -*vidtune.screenB.width: 160 -*vidtune.screenB.horizDistance: 80 -*vidtune.prev.fromVert: vesaB -*vidtune.mode.fromVert: vesaB -*vidtune.next.fromVert: vesaB -*vidtune.prev.horizDistance: 54 -*vidtune.prev.label: << -*vidtune.mode.fromHoriz: prev -*vidtune.mode.width: 160 -*vidtune.next.label: >> -*vidtune.next.fromHoriz: mode - -*vidtune.up.fromVert: screenB -*vidtune.up.horizDistance: 143 -*vidtune.left.horizDistance: 98 -*vidtune.left.vertDistance: 16 -*vidtune.left.fromVert: up -*vidtune.monitor.fromVert: up -*vidtune.monitor.vertDistance: 0 -*vidtune.monitor.fromHoriz: left -*vidtune.right.vertDistance: 16 -*vidtune.right.fromVert: up -*vidtune.right.fromHoriz: monitor -*vidtune.down.horizDistance: 143 -*vidtune.down.fromVert: monitor -*vidtune.wider.fromVert: left -*vidtune.wider.horizDistance: 91 -*vidtune.narrower.fromVert: down -*vidtune.narrower.fromHoriz: wider -*vidtune.shorter.fromVert: down -*vidtune.shorter.fromHoriz: narrower -*vidtune.taller.fromVert: right -*vidtune.taller.fromHoriz: shorter -*vidtune.monitor.width: 47 -*vidtune.monitor.height: 40 -*vidtune.monitor.backgroundPixmap: monitor.xpm -*vidtune.narrower.horizDistance: 0 -*vidtune.shorter.horizDistance: 2 -*vidtune.taller.horizDistance: 0 -*vidtune.wider.vertDistance: 20 -*vidtune.taller.vertDistance: 20 -*vidtune.narrower.vertDistance: 0 -*vidtune.shorter.vertDistance: 0 -*vidtune.down.vertDistance: 0 - -*vidtune.monitor.tip:\ -\ WARNING\n\ -\ Using the controls here may damage your\n\ -monitor. You can safely skip this section\n\ -of the configuration process.\n\ -\n\ -Press ESC if your monitor goes out of sync. - -*vidtune.background: white -*vidtune.form.borderWidth: 0 -*vidtune.form.background: white -*vidtune.form.defaultDistance: 0 -*vidtune.form.vertDistance: 3 -*vidtune.form.horizDistance: 4 -*vidtune.form.Label.foreground: gray20 -*vidtune.form.Label.background: white -*vidtune.form.Label.font: -*-fixed-*-*-*-*-10-*-*-*-*-*-*-1 -*vidtune.form.Label.vertDistance: 0 -*vidtune*Label.justify: right - -*vidtune.form.fromVert: auto -*vidtune*hsyncstart.label: HSyncStart: -*vidtune*hsyncstart.width: 95 -*vidtune*v-hsyncstart.width: 40 -*vidtune*v-hsyncstart.fromHoriz: hsyncstart -*vidtune*vsyncstart.fromHoriz: v-hsyncstart -*vidtune*v-vsyncstart.fromHoriz: vsyncstart -*vidtune*vsyncstart.label: VSyncStart: -*vidtune*vsyncstart.width: 95 -*vidtune*v-vsyncstart.width: 40 -*vidtune*hsyncend.label: HSyncEnd: -*vidtune*hsyncend.width: 95 -*vidtune*v-hsyncend.width: 40 -*vidtune*v-hsyncend.fromHoriz: hsyncend -*vidtune*hsyncend.fromVert: hsyncstart -*vidtune*v-hsyncend.fromVert: v-hsyncstart -*vidtune*vsyncend.label: VSyncEnd: -*vidtune*vsyncend.width: 95 -*vidtune*v-vsyncend.width: 40 -*vidtune*vsyncend.fromHoriz: v-hsyncend -*vidtune*v-vsyncend.fromHoriz: vsyncend -*vidtune*vsyncend.fromVert: hsyncstart -*vidtune*v-vsyncend.fromVert: v-vsyncstart -*vidtune*htotal.label: HTotal: -*vidtune*htotal.width: 95 -*vidtune*v-htotal.width: 40 -*vidtune*v-htotal.fromHoriz: htotal -*vidtune*htotal.fromVert: hsyncend -*vidtune*v-htotal.fromVert: v-hsyncend -*vidtune*vtotal.label: VTotal: -*vidtune*vtotal.width: 95 -*vidtune*v-vtotal.width: 40 -*vidtune*vtotal.fromHoriz: v-htotal -*vidtune*v-vtotal.fromHoriz: vtotal -*vidtune*vtotal.fromVert: vsyncend -*vidtune*v-vtotal.fromVert: v-vsyncend -*vidtune*flags.label: Flags: -*vidtune*flags.width: 142 -*vidtune*v-flags.width: 156 -*vidtune*v-flags.justify: left -*vidtune*v-flags.fromHoriz: flags -*vidtune*flags.fromVert: vtotal -*vidtune*v-flags.fromVert: v-vtotal -*vidtune*clock.label: Pixel Clock (MHz): -*vidtune*clock.width: 142 -*vidtune*v-clock.width: 48 -*vidtune*v-clock.fromHoriz: clock -*vidtune*clock.fromVert: flags -*vidtune*v-clock.fromVert: v-flags -*vidtune*hsync.label: Horizontal Sync (kHz): -*vidtune*hsync.width: 142 -*vidtune*v-hsync.width: 48 -*vidtune*v-hsync.fromHoriz: hsync -*vidtune*hsync.fromVert: clock -*vidtune*v-hsync.fromVert: v-clock -*vidtune*vsync.label: Vertical Sync (Hz): -*vidtune*vsync.width: 142 -*vidtune*v-vsync.width: 48 -*vidtune*v-vsync.fromHoriz: vsync -*vidtune*vsync.fromVert: hsync -*vidtune*v-vsync.fromVert: v-hsync - -*vidtune.auto.horizDistance: 43 -*vidtune.auto.fromVert: narrower -*vidtune.auto.label: Auto -!*vidtune.auto.state: True -*vidtune.apply.fromVert: narrower -*vidtune.apply.fromHoriz: auto -*vidtune.apply.label: Apply -*vidtune.restore.fromHoriz: apply -*vidtune.restore.horizDistance: 4 -*vidtune.restore.fromVert: narrower -*vidtune.restore.label: Restore -*vidtune.update.fromVert: narrower -*vidtune.update.fromHoriz: restore -*vidtune.update.label: Update -*vidtune.test.fromVert: narrower -*vidtune.test.fromHoriz: update -*vidtune.test.label: Test - -*vidtune.Label.background: white -*vidtune.addto.vertDistance: 4 -*vidtune.addto.fromHoriz: add -*vidtune.addto.fromVert: form -*vidtune.addto.label: mode to -*vidtune.addto.horizDistance: 0 -*vidtune.ident.vertDistance: 4 -*vidtune.ident.horizDistance: 0 -*vidtune.ident.fromVert: form -*vidtune.ident.fromHoriz: addto -*vidtune.ident.width: 98 -*vidtune.ident.justify: left -*vidtune.as.vertDistance: 4 -*vidtune.as.horizDistance: 0 -*vidtune.as.fromVert: form -*vidtune.as.fromHoriz: ident -*vidtune.as.label: as: -*vidtune.text.vertDistance: 4 -*vidtune.text.horizDistance: 0 -*vidtune.text.fromVert: form -*vidtune.text.fromHoriz: as -*vidtune.text.width: 98 -*vidtune.add.vertDistance: 4 -*vidtune.add.fromVert: form -*vidtune.add.label: Add -.xorgcfg.force.geometry: 268x58 -.xorgcfg.force.minWidth: 268 -.xorgcfg.force.maxWidth: 268 -.xorgcfg.force.minHeight: 58 -.xorgcfg.force.maxHeight: 58 -.xorgcfg.force.?.label: There is already a modeline with the\n\ -specified identifier. Add anyway? - -.xorgcfg.addMode.geometry: 350x80 -.xorgcfg.addMode.minWidth: 350 -.xorgcfg.addMode.maxWidth: 350 -.xorgcfg.addMode.minHeight: 80 -.xorgcfg.addMode.maxHeight: 80 -.xorgcfg.addMode.?.label: XF86VidModeAddModeLine returned True,\n\ -but no modeline was added to the current Screen.\n\ -Do you want to add it to the Monitor section? - -.xorgcfg.test.?.label: \ Testing modeline...\n\n\ -Press ESC or stop button to quit. -.xorgcfg.test.geometry: 250x72 -.xorgcfg.test.minWidth: 250 -.xorgcfg.test.maxWidth: 250 -.xorgcfg.test.minHeight: 72 -.xorgcfg.test.maxHeight: 72 - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! screen -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*screenD*depthL.label: Default color depth: -*screenD*depthL.height: 20 -*screenD*1.fromHoriz: depthL -*screenD*4.fromHoriz: 1 -*screenD*8.fromHoriz: 4 -*screenD*16.fromHoriz: 8 -*screenD*24.fromHoriz: 16 -*screenD*1.width: 24 -*screenD*4.width: 24 -*screenD*8.width: 24 -*screenD*16.width: 24 -*screenD*24.width: 24 -*screenD*1.horizDistance: 5 -*screenD*4.horizDistance: 5 -*screenD*8.horizDistance: 5 -*screenD*16.horizDistance: 5 -*screenD*24.horizDistance: 5 -*screenD*modeL.fromVert: depthL -*screenD*modeL.vertDistance: 14 -*screenD*modeL.label: Select resolution(s): -*screenD*viewL.fromVert: modeL -*screenD*select.fromHoriz: viewL -*screenD*unselect.fromHoriz: viewL -*screenD*select.fromVert: modeL -*screenD*unselect.fromVert: select -*screenD*up.fromHoriz: viewL -*screenD*down.fromHoriz: viewL -*screenD*up.fromVert: unselect -*screenD*down.fromVert: up -*screenD*viewR.fromHoriz: select -*screenD*viewR.fromVert: modeL -*screenD*select.bitmap: right.xbm -*screenD*unselect.bitmap: left.xbm -*screenD*up.bitmap: up.xbm -*screenD*down.bitmap: down.xbm -*screenD*viewL.width: 133 -*screenD*viewR.width: 133 -*screenD*viewL.height: 184 -*screenD*viewR.height: 184 -*screenD*listLeft.longest: 128 -*screenD*listRight.longest: 128 -*screenD*rotate.tip: Don't select any option if\n\ -your monitor is not rotated. -*screenD*rotate.vertDistance: 14 -*screenD*rotate.fromVert: viewL -*screenD*rotate.label: Rotate screen: -*screenD*CW.tip: Clock wise -*screenD*CW.vertDistance: 14 -*screenD*CW.fromVert: viewL -*screenD*CW.fromHoriz: rotate -*screenD*CW.label: CW -*screenD*CW.width: 40 -*screenD*CCW.tip: Counter-clock wise -*screenD*CCW.vertDistance: 14 -*screenD*CCW.fromVert: viewL -*screenD*CCW.fromHoriz: CW -*screenD*CCW.label: CCW -*screenD*CCW.width: 40 - -*work.screen.width: 100 -*work.screen.height: 80 - - -*Dialog.background: gray85 -*quit.ask.label: Write configuration to -*quit.ask.value.translations: #override \ -<Key>Return: write-config() -*quit.ask.label.justify: left -*quit.ask.value.width: 222 -*quit.ask.icon: Excl -.xorgcfg.quit.geometry: 230x92 -.xorgcfg.quit.minWidth: 230 -.xorgcfg.quit.maxWidth: 230 -.xorgcfg.quit.minHeight: 92 -.xorgcfg.quit.maxHeight: 92 - -*error.notice.label: Failed to write configuration file. -.xorgcfg.error.geometry: 280x50 -.xorgcfg.error.minWidth: 260 -.xorgcfg.error.maxWidth: 260 -.xorgcfg.error.minHeight: 50 -.xorgcfg.error.maxHeight: 50 - -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -!! accessx -!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*Accessx*Label.font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-1 -*Accessx.Form.Toggle.font: -*-fixed-medium-r-*-*-13-*-*-*-*-*-iso8859-1 -*Accessx*Label.background: white -*Accessx*Label.justify: left -*Accessx*Label.internalHeight: 0 -*Accessx*Label.internalWidth: 0 -*Accessx*Label.foreground: gray35 -*Accessx*Toggle.internalHeight: 0 -*Accessx.Toggle.internalWidth: 18 -*Accessx.Toggle.justify: left -*Accessx.Toggle.foreground: gray30 -*Accessx.Toggle.background: white -*Accessx*Toggle.highlightThickness: 0 -*Accessx.Toggle.foreground: rgb:f/7/7 -*Accessx.Toggle.displayList:\ -foreground white;\ -points 0,0,-1,0;\ -foreground rgb:f/7/7;\ -fill-poly 0,2,0,-3,8,6 -*Accessx.Toggle.translations: \ -<Btn1Down>,<Btn1Up>: toggle() notify()\n\ -<Enter>: set-values(1, displayList, "foreground white;points 0,0,-1,0;fill-poly 0,1,10,6,0,-2;foreground rgb:7/7/f;fill-poly 0,2,0,-3,8,6")\n\ -<Leave>: set-values(1, displayList, "foreground white;points 0,0,-1,0;foreground rgb:f/7/7;fill-poly 0,2,0,-3,8,6") -*Accessx.Form.borderWidth: 1 -*Accessx.Form.borderColor: rgb:f/a/a -*Accessx.Form.vertDistance: 0 -*Accessx.Form.defaultDistance: 2 -*Accessx.borderWidth: 0 -*accessxForm.background: white -*Accessx*Form.background: white -*Accessx.background: white -*accessxForm.enable.label: Enable AccessX -*accessxForm.enable.width: 208 -*accessxForm.apply.fromHoriz: enable -*accessxForm.apply.label: Apply changes -*accessxForm.Accessx.fromVert: enable -*Accessx.timeoutToggle.background: white -*Accessx.timeoutToggle.foreground: rgb:7/7/f -*Accessx.timeoutToggle.displayList:\ -foreground rgb:a/a/f;\ -lines 1,-1,-1,-1,-1,1;\ -foreground rgb:2/2/a;\ -lines -1,0,0,0,0,-1 - -*Accessx.Form.Toggle.background: white -*Accessx.Form.Toggle.foreground: rgb:7/7/f -*Accessx.Form.Toggle.displayList:\ -foreground rgb:a/a/f;\ -lines 1,-1,-1,-1,-1,1;\ -foreground rgb:2/2/a;\ -lines -1,0,0,0,0,-1 -*Accessx.Form.Toggle.translations: \ -<Btn1Down>,<Btn1Up>: toggle() notify()\n\ -<Enter>: set-values(1, displayList, "foreground rgb:a/a/f;lines 1,-1,-1,-1,-1,1;foreground rgb:2/2/a;lines -1,0,0,0,0,-1;foreground rgb:f/7/7;draw-rect 1,1,-2,-2")\n\ -<Leave>: set-values(1, displayList, "foreground rgb:a/a/f;lines 1,-1,-1,-1,-1,1;foreground rgb:2/2/a;lines -1,0,0,0,0,-1") - -*Accessx.timeoutToggle.internalWidth: 4 -*Accessx.timeoutToggle.translations:\ -<Btn1Down>,<Btn1Up>: toggle() notify() -*Accessx.timeoutToggle.internalWidth: 4 -*Accessx.timeoutToggle.internalHeight: 1 -*Accessx.timeoutToggle.vertDistance: 6 -*Accessx.timeoutToggle.label: Time Out -*Accessx.timeoutLabel.fromHoriz: timeoutToggle -*Accessx.timeoutLabel.vertDistance: 7 -*Accessx.timeoutLabel.label: Time (min) -*Accessx.Label.background: white -*Accessx.timeoutNumber.vertDistance: 1 -*Accessx.timeoutNumber.fromHoriz: timeoutLabel -*Accessx.timeoutNumber.font: 6x9 -*Accessx.timeoutNumber.label: ?? -*Accessx.timeoutScroller.fromVert: timeoutNumber -*Accessx.timeoutScroller.fromHoriz: timeoutLabel -*Accessx.timeoutScroller.width: 133 -*Accessx.timeoutScroller.horizDistance: 31 -*Accessx*Scrollbar.vertDistance: 0 -*Accessx*Scrollbar.orientation: horizontal -*Accessx*Scrollbar.thumb: black -*Accessx*Scrollbar.height: 8 -*Accessx*Scrollbar.minimumThumb: 5 -*Accessx*Scrollbar.borderWidth: 1 -*Accessx*Scrollbar.borderColor: white -*Accessx*Scrollbar.foreground: rgb:f/7/7 -*Accessx*Scrollbar.background: gray95 -*Accessx*Scrollbar.displayList:\ -foreground gray80;\ -lines 1,-1,-1,-1,-1,1;\ -foreground gray90;\ -lines -1,0,0,0,0,-1 -*Accessx.sticky.fromVert: timeoutToggle -*Accessx.sticky.vertDistance: 6 -*Accessx.sticky.label: Enable StickyKeys -*Accessx.sticky.width: 304 -*Accessx.stickyForm.fromVert: sticky -*Accessx.stickyForm.Toggle.width: 148 -*Accessx.stickyForm.Toggle.internalHeight: 1 -*Accessx.stickyForm.auto.label: Auto off -*Accessx.stickyForm.beep.fromHoriz: auto -*Accessx.stickyForm.beep.label: Modifiers beep -*Accessx.mouseKeys.fromVert: stickyForm -*Accessx.mouseKeys.width: 304 -*Accessx.mouseKeys.vertDistance: 6 -*Accessx.mouseKeys.label: Enable MouseKeys -*Accessx.mouseForm.fromVert: mouseKeys -*Accessx.mouseForm.speedLabel.vertDistance: 7 -*Accessx.mouseForm.speedLabel.label: Peak speed (pixels/sec) -*Accessx.mouseForm.speedNumber.fromHoriz: speedLabel -*Accessx.mouseForm.speedNumber.font: 6x9 -*Accessx.mouseForm.speedNumber.label: ??? -*Accessx.mouseForm.speedScroller.fromHoriz: speedLabel -*Accessx.mouseForm.speedScroller.fromVert: speedNumber -*Accessx.mouseForm.speedScroller.width: 133 -*Accessx.mouseForm.timeLabel.fromVert: speedScroller -*Accessx.mouseForm.timeLabel.label: Time to peak (sec) -*Accessx.mouseForm.timeLabel.vertDistance: 7 -*Accessx.mouseForm.timeNumber.label: ??? -*Accessx.mouseForm.timeNumber.fromVert: speedScroller -*Accessx.mouseForm.timeNumber.fromHoriz: timeLabel -*Accessx.mouseForm.timeNumber.font: 6x9 -*Accessx.mouseForm.timeScroller.fromHoriz: timeLabel -*Accessx.mouseForm.timeScroller.fromVert: timeNumber -*Accessx.mouseForm.timeScroller.width: 133 -*Accessx.mouseForm.timeScroller.horizDistance: 37 -*Accessx.mouseForm.delayLabel.fromVert: timeScroller -*Accessx.mouseForm.delayLabel.label: Motion delay (sec) -*Accessx.mouseForm.delayLabel.tip:\ -Time between the initial key press\n\ -and the first repeated motion event -*Accessx.mouseForm.delayLabel.vertDistance: 7 -*Accessx.mouseForm.delayNumber.label: ??? -*Accessx.mouseForm.delayNumber.fromVert: timeScroller -*Accessx.mouseForm.delayNumber.fromHoriz: delayLabel -*Accessx.mouseForm.delayNumber.font: 6x9 -*Accessx.mouseForm.delayScroller.fromHoriz: delayLabel -*Accessx.mouseForm.delayScroller.fromVert: delayNumber -*Accessx.mouseForm.delayScroller.width: 133 -*Accessx.mouseForm.delayScroller.horizDistance: 37 -*Accessx.repeatKeys.fromVert: mouseForm -*Accessx.repeatKeys.width: 304 -*Accessx.repeatKeys.vertDistance: 6 -*Accessx.repeatKeys.label: Enable RepeatKeys -*Accessx.repeatForm.fromVert: repeatKeys -*Accessx.repeatForm.rateLabel.vertDistance: 7 -*Accessx.repeatForm.rateLabel.label: Repeat rate (sec/key) -*Accessx.repeatForm.rateNumber.fromHoriz: rateLabel -*Accessx.repeatForm.rateNumber.font: 6x9 -*Accessx.repeatForm.rateNumber.label: ???? -*Accessx.repeatForm.rateScroller.fromHoriz: rateLabel -*Accessx.repeatForm.rateScroller.fromVert: rateNumber -*Accessx.repeatForm.rateScroller.width: 133 -*Accessx.repeatForm.rateScroller.horizDistance: 16 -*Accessx.repeatForm.delayLabel.fromVert: rateScroller -*Accessx.repeatForm.delayLabel.label: Repeat delay (sec) -*Accessx.repeatForm.delayLabel.vertDistance: 7 -*Accessx.repeatForm.delayNumber.label: ???? -*Accessx.repeatForm.delayNumber.fromVert: rateScroller -*Accessx.repeatForm.delayNumber.fromHoriz: delayLabel -*Accessx.repeatForm.delayNumber.font: 6x9 -*Accessx.repeatForm.delayScroller.fromHoriz: delayLabel -*Accessx.repeatForm.delayScroller.fromVert: delayNumber -*Accessx.repeatForm.delayScroller.width: 133 -*Accessx.repeatForm.delayScroller.horizDistance: 37 -*Accessx.slow.fromVert: repeatForm -*Accessx.slow.vertDistance: 6 -*Accessx.slow.label: Enable SlowKeys -*Accessx.slow.width: 304 -*Accessx.slowForm.fromVert: slow -*Accessx.slowForm.Toggle.horizDistance: 4 -*Accessx.slowForm.Toggle.internalWidth: 4 -*Accessx.slowForm.Toggle.internalHeight: 1 -*Accessx.slowForm.beep.label: Beep when key is -*Accessx.slowForm.beep.vertDistance: 3 -*Accessx.slowForm.pressed.fromHoriz: beep -*Accessx.slowForm.pressed.label: pressed -*Accessx.slowForm.accepted.fromHoriz: pressed -*Accessx.slowForm.accepted.label: accepted -*Accessx.slowForm.slowLabel.fromVert: accepted -*Accessx.slowForm.slowLabel.label: Key delay (sec) -*Accessx.slowForm.slowLabel.vertDistance: 7 -*Accessx.slowForm.slowNumber.label: ??? -*Accessx.slowForm.slowNumber.fromVert: accepted -*Accessx.slowForm.slowNumber.fromHoriz: slowLabel -*Accessx.slowForm.slowNumber.font: 6x9 -*Accessx.slowForm.slowScroller.fromHoriz: slowLabel -*Accessx.slowForm.slowScroller.fromVert: slowNumber -*Accessx.slowForm.slowScroller.width: 133 -*Accessx.slowForm.slowScroller.horizDistance: 58 -*Accessx.bounce.fromVert: slowForm -*Accessx.bounce.vertDistance: 6 -*Accessx.bounce.label: Enable BounceKeys -*Accessx.bounce.width: 304 -*Accessx.bounceForm.fromVert: bounce -*Accessx.bounceForm.bounceLabel.label: Debounce time (sec) -*Accessx.bounceForm.bounceLabel.vertDistance: 7 -*Accessx.bounceForm.bounceNumber.label: ??? -*Accessx.bounceForm.bounceNumber.fromHoriz: bounceLabel -*Accessx.bounceForm.bounceNumber.font: 6x9 -*Accessx.bounceForm.bounceScroller.fromHoriz: bounceLabel -*Accessx.bounceForm.bounceScroller.fromVert: bounceNumber -*Accessx.bounceForm.bounceScroller.width: 133 -*Accessx.bounceForm.bounceScroller.horizDistance: 30 - -*accessx.geometry: 220x253 -*accessx.minWidth: 220 -*accessx.maxWidth: 220 -*accessx.minHeight: 253 -*accessx.maxHeight: 253 -*accessx*lock.fromVert: label -*accessx*div.fromVert: label -*accessx*div.fromHoriz: lock -*accessx*mul.fromVert: label -*accessx*mul.fromHoriz: div -*accessx*minus.fromVert: label -*accessx*minus.fromHoriz: mul -*accessx*7.fromVert: lock -*accessx*8.fromVert: div -*accessx*8.fromHoriz: 7 -*accessx*9.fromVert: mul -*accessx*9.fromHoriz: 8 -*accessx*plus.fromVert: minus -*accessx*plus.fromHoriz: 9 -*accessx*4.fromVert: 7 -*accessx*5.fromVert: 8 -*accessx*5.fromHoriz: 4 -*accessx*6.fromVert: 9 -*accessx*6.fromHoriz: 5 -*accessx*1.fromVert: 4 -*accessx*2.fromVert: 5 -*accessx*2.fromHoriz: 1 -*accessx*3.fromVert: 6 -*accessx*3.fromHoriz: 2 -*accessx*enter.fromVert: plus -*accessx*enter.fromHoriz: 3 -*accessx*0.fromVert: 2 -*accessx*del.fromVert: 3 -*accessx*del.fromHoriz: 0 -*accessx.form.background: gray80 -*accessx*Label.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1 -*accessx*label.font: fixed -*accessx*Label.font: -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1 -*accessx*Label.width: 50 -*accessx*Label.height: 35 -*accessx*label.width: 212 -*accessx*label.height: 50 -*accessx*plus.height: 74 -*accessx*enter.height: 74 -*accessx*0.width: 104 -*accessx*lock.label: Num\nLock -*accessx*div.label: /\n -*accessx*mul.label: *\n -*accessx*minus.label: -\n -*accessx*7.label: 7\n -*accessx*8.label: 8\n -*accessx*9.label: 9\n -*accessx*plus.label: +\n\ \n\ \n\ \n -*accessx*4.label: 4\n -*accessx*5.label: 5\n -*accessx*6.label: 6\n -*accessx*1.label: 1\n -*accessx*2.label: 2\n -*accessx*3.label: 3\n -*accessx*enter.label: Enter\n\ \n\ \n\ \n -*accessx*0.label: 0\n -*accessx*del.label: .\n\ \n -*accessx*label.displayList:\ -foreground white;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground gray20;\ -lines -1,0,0,0,0,-1 -*accessx*label.label:\ -If your mouse does not work, use\n\ -the numeric keypad, following\n\ -the diagram bellow. -*accessx*div.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\ -draw-string 4,30, "Button 1" -*accessx*mul.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\ -draw-string 4,30, "Button 2" -*accessx*minus.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\ -draw-string 4,30, "Button 3" -*accessx*7.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 20,20,20,30,30,20 -*accessx*8.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 30,20,20,30,40,30 -*accessx*9.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 20,20,30,30,30,20 -*accessx*plus.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\ -draw-string 9,46, "Double";\ -draw-string 14,60, "Click" -*accessx*4.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 22,22,30,30,30,14 -*accessx*5.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10*-*-*-*-*-*-1;\ -draw-string 14,30, "Click" -*accessx*6.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 30,22,22,30,22,14 -*accessx*1.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 20,20,20,30,30,30 -*accessx*2.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 28,30,20,22,36,22 -*accessx*3.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -fill-poly 20,30,30,30,30,20 -*accessx*enter.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\ -draw-string 9,46, "Toggle";\ -draw-string 10,60, "Speed" -*accessx*0.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-10-*-*-*-*-*-*-1;\ -draw-string 26,30, "Button Lock" -*accessx*del.displayList:\ -foreground gray20;\ -lines +1,-1,-1,-1,-1,+1;\ -foreground white;\ -lines -1,0,0,0,0,-1;\ -foreground red;\ -font -*-helvetica-bold-o-*-*-8-*-*-*-*-*-*-1;\ -draw-string 12,21, "Button";\ -draw-string 9,30, "Release" - -*panner.width: 100 -*panner.height: 100 - -*help*text.properties:\ -default?family=Times&weight=Medium&slant=R&pixelsize=12®istry=ISO8859&encoding=1,\ -b?weight=Bold,\ -strong?weight=Bold,\ -i?slant=I,\ -em?slant=I,\ -address?slant=I,\ -h1?pixelsize=24&weight=Bold,\ -h2?pixelsize=20&weight=Bold,\ -h3?pixelsize=17&weight=Bold,\ -h4?pixelsize=14&weight=Bold,\ -h5?pixelsize=12&weight=Bold,\ -h6?pixelsize=10&weight=Bold,\ -pre?family=Courier&pixelsize=10,\ -kbd?family=Courier&pixelsize=10,\ -code?family=Courier&pixelsize=10,\ -samp?family=Courier&pixelsize=10,\ -tt?family=Courier&pixelsize=10 -*help*commands.min: 22 -*help*commands.max: 22 -*help*commands.showGrip:False -*help*wrap: word -*help*commands.close.label: Close -.xorgcfg.help.geometry: 320x369 -.xorgcfg.help.minWidth: 320 -.xorgcfg.help.maxWidth: 320 -.xorgcfg.help.minHeight: 369 -.xorgcfg.help.maxHeight: 369 -.xorgcfg.help.translations: #override \ -<Message>WM_PROTOCOLS: help-close() -*help*text.translations:\ -<Key>Up: scroll-one-line-down()\n\ -<Key>Down: scroll-one-line-up()\n\ -<Key>Next: next-page()\n\ -<Key>Prior: previous-page()\n\ -<Key>space: next-page()\n\ -<Key>BackSpace: previous-page()\n\ -<Key>Home: beginning-of-file()\n\ -<Key>End: end-of-file() -*help*text*displayCaret: False -*help*text.leftMargin: 10 -*help*text.rightMargin: 10 - -*help.helpDevices:\ -<h2>Configuring devices</h2>\ -You can arrange the icons pressing the <i>left mouse button</i> \ -and dragging them.\ -<p>\ -To configure a device, press the <i>right mouse button</i> and choose the \ -<tt>configure</tt> option.\ - -*help.helpScreen:\ -<h2>Configuring screens</h2>\ -You can drag the monitors to set the screen layout form <b>Xinerama</b> \ -pressing the <i>left mouse button</i> and moving them.\ -<p>\ -Press the <i>right mouse button</i> to set configure or set options for \ -the given screen. - -*help.helpModeline:\ -<h2>Configuring modelines</h2>\ -<b><font size=+1 color=red>The controls here may damage your \ -monitor.</font></b> \ -<p>\ -You can safelly skip this stage of the configuration process.\ -<p>\ -When not running in <b>Xinerama</b> mode, you can configure modelines \ -for every configured monitor. Set the <b>Auto</b> toggle to see the changes \ -while the <i>control buttons</i> are pressed.\ -<p>\ -Note that the <i>arrow</i> buttons are repeaters. Press they only once \ -and they will show the changes in the <i>text labels</i>.\ -<p>\ -<font color=forestgreen>Press <b>ESC</b> if the monitor goes out of sync.</font> - -*help.helpAccessX:\ -<h2>Configuring accessx</h2>\ -This interface is expected to allow customizing most of the <b>accessx</b> \ -options.\ -<p>\ -Press in the <b>Enable ???</b> label to set specific options.\ -<p>\ -<font color=red>Note</font>: currently, if you press the \ -<tt><b>Apply changes</b></tt> button there is no way to undo your changes.</font> - - -*Expert.geometry: 640x460 -*Expert*vpane.min: 64 -*Expert*vpane.max: 64 -*Expert*vpane.showGrip: False -*Expert*vpane.close.showGrip: False -*Expert*vpane.close.min: 26 -*Expert*vpane.close.max: 26 -*panner.internalSpace: 1 -*panner.shadowThickness: 0 -*panner.shadowColor: gray60 -*panner.backgroundStipple: black -*panner.borderColor: gray40 - -*expert*tree.hSpace: 12 -*expert*tree*Box.hSpace: 4 -*expert*tree*vSpace: 4 -*expert*tree*LogFile.Text.width: 192 -*expert*tree*RgbPath.Text.width: 192 -*expert*tree*ModulePath.Text.width: 192 - -*expert*tree*Form.defaultDistance: 4 - -*expert*tree.backgroundPixmap: xlogo64?foreground=gray90&background=gray92 -*expert*tree.foreground: gray45 - -*expert*tree*Label.backgroundPixmap: ParentRelative - -*expert*tree*Box.backgroundPixmap: gradient:vertical?dimension=3&start=gray85&end=gray95 -*expert*tree*Box.borderWidth: 0 -*expert*tree*Box.background: gray85 -*expert*Box.displayList:\ -foreground gray40;\ -lines 1,-1,-1,-1,-1,1;\ -foreground white;\ -lines -1,0,0,0,0,-1 - -*expert*tree*Form.backgroundPixmap: gradient:vertical?dimension=3&start=gray85&end=gray95 -*expert*tree*Form.borderWidth: 0 -*expert*tree*Form.background: gray85 -*expert*Form.displayList:\ -foreground gray40;\ -lines 1,-1,-1,-1,-1,1;\ -foreground white;\ -lines -1,0,0,0,0,-1 - -*expert*tree*Text.width: 160 - -*expert*tree*fontpath.Text.width: 228 -*expert*tree*fontpath.up.fromHoriz: remove -*expert*tree*fontpath.down.fromHoriz: up -*expert*tree*fontpath.value.fromVert: remove -*expert*tree*fontpath.valueNew.fromVert: new - -*expert*tree*modulepath.Text.width: 228 -*expert*tree*modulepath.value.fromVert: remove -*expert*tree*modulepath.valueNew.fromVert: new - -*expert*tree*module.options.fromHoriz: remove -*expert*tree*module.label.fromVert: remove -*expert*tree*module.value.fromHoriz: new -*expert*tree*module.value.width: 78 - -*expert*tree*video*Label.justify: left -*expert*tree*video.options.fromHoriz: remove -*expert*tree*video.adaptor.fromHoriz: options -*expert*tree*video.vendorL.width: 78 -*expert*tree*video.vendorL.label: VendorName -*expert*tree*video.vendorL.fromVert: remove -*expert*tree*video.vendor.fromVert: remove -*expert*tree*video.vendor.fromHoriz: vendorL -*expert*tree*video.boardL.width: 78 -*expert*tree*video.boardL.label: BoardName -*expert*tree*video.boardL.fromVert: vendor -*expert*tree*video.board.fromVert: vendor -*expert*tree*video.board.fromHoriz: boardL -*expert*tree*video.busidL.width: 78 -*expert*tree*video.busidL.label: BusID -*expert*tree*video.busidL.fromVert: board -*expert*tree*video.busid.fromVert: board -*expert*tree*video.busid.fromHoriz: busidL -*expert*tree*video.driverL.width: 78 -*expert*tree*video.driverL.label: Driver -*expert*tree*video.driverL.fromVert: busid -*expert*tree*video.driver.fromVert: busid -*expert*tree*video.driver.fromHoriz: driverL -*expert*tree*video.value.fromHoriz: new -*expert*tree*video.value.width: 78 -*expert*tree*VideoPort.fromVert: driver -*expert*tree*VideoPort.horizDistance: 120 -*expert*tree*video.value.width: 149 - -*expert*tree*port.value.fromHoriz: new -*expert*tree*port.options.fromHoriz: remove -*expert*tree*port.label.fromVert: remove -*expert*tree*port.value.width: 78 - -*expert*tree*modes.mode.fromHoriz: remove -*expert*tree*modes.value.fromHoriz: new -*expert*tree*modes.value.width: 78 - -*expert*tree*modeline.label.fromHoriz: remove -*expert*tree*modeline.modeline.fromVert: remove -*expert*tree*modeline.modeline.width: 480 -*expert*tree*modeline.value.fromHoriz: new -*expert*tree*modeline.value.width: 120 -*expert*tree*modeline.modelineNew.fromVert: value -*expert*tree*modeline.modelineNew.width: 480 - -*expert*tree*monitor.options.fromHoriz: remove -*expert*tree*monitor.label.fromHoriz: options - -*expert*tree*monitor.Label.justify: left -*expert*tree*monitor.Text.width: 120 -*expert*tree*monitor.vendorL.width: 100 -*expert*tree*monitor.vendorL.label: VendorName -*expert*tree*monitor.vendorL.fromVert: remove -*expert*tree*monitor.vendor.fromVert: remove -*expert*tree*monitor.vendor.fromHoriz: vendorL -*expert*tree*monitor.modelnameL.width: 100 -*expert*tree*monitor.modelnameL.label: ModelName -*expert*tree*monitor.modelnameL.fromVert: vendor -*expert*tree*monitor.modelname.fromVert: vendor -*expert*tree*monitor.modelname.fromHoriz: modelnameL -*expert*tree*monitor.widthL.width: 100 -*expert*tree*monitor.widthL.label: Width (mm) -*expert*tree*monitor.widthL.fromVert: modelname -*expert*tree*monitor.width.fromVert: modelname -*expert*tree*monitor.width.fromHoriz: widthL -*expert*tree*monitor.heightL.width: 100 -*expert*tree*monitor.heightL.label: Height (mm) -*expert*tree*monitor.heightL.fromVert: width -*expert*tree*monitor.height.fromVert: width -*expert*tree*monitor.height.fromHoriz: heightL -*expert*tree*monitor.hsyncL.width: 100 -*expert*tree*monitor.hsyncL.label: Hsync -*expert*tree*monitor.hsyncL.fromVert: heightL -*expert*tree*monitor.hsync.fromVert: height -*expert*tree*monitor.hsync.fromHoriz: hsyncL -*expert*tree*monitor.vrefreshL.width: 100 -*expert*tree*monitor.vrefreshL.label: Vrefresh -*expert*tree*monitor.vrefreshL.fromVert: hsync -*expert*tree*monitor.vrefresh.fromVert: hsync -*expert*tree*monitor.vrefresh.fromHoriz: vrefreshL -*expert*tree*monitor.gammaRedL.width: 100 -*expert*tree*monitor.gammaRedL.label: Gamma (red) -*expert*tree*monitor.gammaRedL.fromVert: vrefresh -*expert*tree*monitor.gammaRed.fromVert: vrefresh -*expert*tree*monitor.gammaRed.fromHoriz: gammaRedL -*expert*tree*monitor.gammaGreenL.width: 100 -*expert*tree*monitor.gammaGreenL.label: Gamma (green) -*expert*tree*monitor.gammaGreenL.fromVert: gammaRed -*expert*tree*monitor.gammaGreen.fromVert: gammaRed -*expert*tree*monitor.gammaGreen.fromHoriz: gammaGreenL -*expert*tree*monitor.gammaBlueL.width: 100 -*expert*tree*monitor.gammaBlueL.label: Gamma (blue) -*expert*tree*monitor.gammaBlueL.fromVert: gammaGreen -*expert*tree*monitor.gammaBlue.fromVert: gammaGreen -*expert*tree*monitor.gammaBlue.fromHoriz: gammaBlueL -*expert*tree*monitor.value.width: 191 -*expert*tree*monitor.value.fromHoriz: new - -*expert*tree*device.Label.justify: left -*expert*tree*device.options.fromHoriz: remove -*expert*tree*device.label.fromHoriz: options -*expert*tree*device.vendorL.label: VendorName -*expert*tree*device.vendorL.width: 100 -*expert*tree*device.vendorL.fromVert: remove -*expert*tree*device.vendor.fromVert: remove -*expert*tree*device.vendor.fromHoriz: vendorL -*expert*tree*device.boardL.label: BoardName -*expert*tree*device.boardL.width: 100 -*expert*tree*device.boardL.fromVert: vendor -*expert*tree*device.board.fromVert: vendor -*expert*tree*device.board.fromHoriz: boardL -*expert*tree*device.chipsetL.label: Chipset -*expert*tree*device.chipsetL.width: 100 -*expert*tree*device.chipsetL.fromVert: board -*expert*tree*device.chipset.fromVert: board -*expert*tree*device.chipset.fromHoriz: chipsetL -*expert*tree*device.busidL.label: BusID -*expert*tree*device.busidL.width: 100 -*expert*tree*device.busidL.fromVert: chipset -*expert*tree*device.busid.fromVert: chipset -*expert*tree*device.busid.fromHoriz: chipsetL -*expert*tree*device.cardL.label: Card -*expert*tree*device.cardL.width: 100 -*expert*tree*device.cardL.fromVert: busid -*expert*tree*device.card.fromVert: busid -*expert*tree*device.card.fromHoriz: cardL -*expert*tree*device.driverL.label: Driver -*expert*tree*device.driverL.width: 100 -*expert*tree*device.driverL.fromVert: card -*expert*tree*device.driver.fromVert: card -*expert*tree*device.driver.fromHoriz: driverL -*expert*tree*device.ramdacL.label: Ramdac -*expert*tree*device.ramdacL.width: 100 -*expert*tree*device.ramdacL.fromVert: driverL -*expert*tree*device.ramdac.fromVert: driver -*expert*tree*device.ramdac.fromHoriz: ramdacL -*expert*tree*device.dacSpeedL.label: DacSpeed -*expert*tree*device.dacSpeedL.width: 100 -*expert*tree*device.dacSpeedL.fromVert: ramdac -*expert*tree*device.dacSpeed.fromVert: ramdac -*expert*tree*device.dacSpeed.fromHoriz: dacSpeedL -*expert*tree*device.videoRamL.label: VideoRam -*expert*tree*device.videoRamL.width: 100 -*expert*tree*device.videoRamL.fromVert: dacSpeed -*expert*tree*device.videoRam.fromVert: dacSpeed -*expert*tree*device.videoRam.fromHoriz: videoRamL -*expert*tree*device.textClockFreqL.label: TextClockFreq -*expert*tree*device.textClockFreqL.width: 100 -*expert*tree*device.textClockFreqL.fromVert: videoRam -*expert*tree*device.textClockFreq.fromVert: videoRam -*expert*tree*device.textClockFreq.fromHoriz: textClockFreqL -*expert*tree*device.biosBaseL.label: BiosBase -*expert*tree*device.biosBaseL.width: 100 -*expert*tree*device.biosBaseL.fromVert: textClockFreq -*expert*tree*device.biosBase.fromVert: textClockFreq -*expert*tree*device.biosBase.fromHoriz: biosBaseL -*expert*tree*device.memBaseL.label: MemBase -*expert*tree*device.memBaseL.width: 100 -*expert*tree*device.memBaseL.fromVert: biosBase -*expert*tree*device.memBase.fromVert: biosBase -*expert*tree*device.memBase.fromHoriz: memBaseL -*expert*tree*device.ioBaseL.label: IOBase -*expert*tree*device.ioBaseL.width: 100 -*expert*tree*device.ioBaseL.fromVert: memBase -*expert*tree*device.ioBase.fromVert: memBase -*expert*tree*device.ioBase.fromHoriz: ioBaseL -*expert*tree*device.clockChipL.label: ClockChip -*expert*tree*device.clockChipL.width: 100 -*expert*tree*device.clockChipL.fromVert: ioBase -*expert*tree*device.clockChip.fromVert: ioBase -*expert*tree*device.clockChip.fromHoriz: clockChipL -*expert*tree*device.devClockL.label: Clocks -*expert*tree*device.devClockL.width: 100 -*expert*tree*device.devClockL.fromVert: clockChip -*expert*tree*device.devClock.fromVert: clockChip -*expert*tree*device.devClock.fromHoriz: devClockL -*expert*tree*device.chipIdL.label: ChipId -*expert*tree*device.chipIdL.width: 100 -*expert*tree*device.chipIdL.fromVert: devClock -*expert*tree*device.chipId.fromVert: devClock -*expert*tree*device.chipId.fromHoriz: chipIdL -*expert*tree*device.chipRevL.label: ChipRev -*expert*tree*device.chipRevL.width: 100 -*expert*tree*device.chipRevL.fromVert: chipId -*expert*tree*device.chipRev.fromVert: chipId -*expert*tree*device.chipRev.fromHoriz: chipRevL -*expert*tree*device.irqL.label: IRQ -*expert*tree*device.irqL.width: 100 -*expert*tree*device.irqL.fromVert: chipRev -*expert*tree*device.irq.fromVert: chipRev -*expert*tree*device.irq.fromHoriz: irqL -*expert*tree*device.screenL.label: Screen -*expert*tree*device.screenL.width: 100 -*expert*tree*device.screenL.fromVert: irq -*expert*tree*device.screen.fromVert: irq -*expert*tree*device.screen.fromHoriz: screenL -*expert*tree*device.value.fromHoriz: new - -*expert*tree*screen.Label.justify: left -*expert*tree*screen.options.fromHoriz: remove -*expert*tree*screen.label.fromHoriz: options -*expert*tree*screen.defaultDepthL.label: DefaultDepth -*expert*tree*screen.defaultDepthL.width: 92 -*expert*tree*screen.defaultDepthL.fromVert: remove -*expert*tree*screen.defaultDepth.fromVert: remove -*expert*tree*screen.defaultDepth.fromHoriz: defaultDepthL -*expert*tree*screen.defaultBppL.label: DefaultBpp -*expert*tree*screen.defaultBppL.width: 92 -*expert*tree*screen.defaultBppL.fromVert: defaultDepth -*expert*tree*screen.defaultBpp.fromVert: defaultDepth -*expert*tree*screen.defaultBpp.fromHoriz: defaultBppL -*expert*tree*screen.defaultFbBppL.label: DefaultFbBpp -*expert*tree*screen.defaultFbBppL.width: 92 -*expert*tree*screen.defaultFbBppL.fromVert: defaultBpp -*expert*tree*screen.defaultFbBpp.fromVert: defaultBpp -*expert*tree*screen.defaultFbBpp.fromHoriz: defaultFbBppL -*expert*tree*screen.monitorL.label: Monitor -*expert*tree*screen.monitorL.width: 92 -*expert*tree*screen.monitorL.fromVert: defaultFbBpp -*expert*tree*screen.monitor.fromVert: defaultFbBpp -*expert*tree*screen.monitor.fromHoriz: monitorL -*expert*tree*screen.deviceL.label: Device -*expert*tree*screen.deviceL.width: 92 -*expert*tree*screen.deviceL.fromVert: monitor -*expert*tree*screen.device.fromVert: monitor -*expert*tree*screen.device.fromHoriz: deviceL -*expert*tree*screen.value.fromHoriz: new - -*expert*tree*adaptor.label.fromHoriz: remove - -*expert*tree*display.Label.width: 64 -*expert*tree*display.Label.justify: left -*expert*tree*display.options.fromHoriz: remove -*expert*tree*display.viewportL.label: Viewport -*expert*tree*display.viewportL.fromVert: remove -*expert*tree*display.viewport.fromVert: remove -*expert*tree*display.viewport.fromHoriz: viewportL -*expert*tree*display.virtualL.label: Virtual -*expert*tree*display.virtualL.fromVert: viewport -*expert*tree*display.virtual.fromVert: viewport -*expert*tree*display.virtual.fromHoriz: virtualL -*expert*tree*display.depthL.label: Depth -*expert*tree*display.depthL.fromVert: virtual -*expert*tree*display.depth.fromVert: virtual -*expert*tree*display.depth.fromHoriz: depthL -*expert*tree*display.bppL.label: FbBPP -*expert*tree*display.bppL.fromVert: depth -*expert*tree*display.bpp.fromVert: depth -*expert*tree*display.bpp.fromHoriz: bppL -*expert*tree*display.visualL.label: Visual -*expert*tree*display.visualL.fromVert: bpp -*expert*tree*display.visual.fromVert: bpp -*expert*tree*display.visual.fromHoriz: visualL -*expert*tree*display.weightL.label: Weight -*expert*tree*display.weightL.fromVert: visual -*expert*tree*display.weight.fromVert: visual -*expert*tree*display.weight.fromHoriz: weightL -*expert*tree*display.blackL.label: Black -*expert*tree*display.blackL.fromVert: weight -*expert*tree*display.black.fromVert: weight -*expert*tree*display.black.fromHoriz: blackL -*expert*tree*display.whiteL.label: White -*expert*tree*display.whiteL.fromVert: black -*expert*tree*display.white.fromVert: black -*expert*tree*display.white.fromHoriz: whiteL - -*expert*tree*mode.label.fromHoriz: remove -*expert*tree*mode.value.fromHoriz: new -*expert*tree*mode.value.width: 100 - -*expert*tree*input.options.fromHoriz: remove -*expert*tree*input.label.fromHoriz: options -*expert*tree*input.driverL.label: Driver -*expert*tree*input.driverL.fromVert: remove -*expert*tree*input.driver.fromVert: remove -*expert*tree*input.driver.fromHoriz: driverL -*expert*tree*input.value.fromHoriz: new - -*expert*tree*layout.options.fromHoriz: remove -*expert*tree*layout.label.fromHoriz: options -*expert*tree*layout.value.fromHoriz: new - -*expert*tree*adjacency.Text.width: 46 -*expert*tree*adjacency.MenuButton.width: 122 -*expert*tree*adjacency.label.fromHoriz: remove -*expert*tree*adjacency.scrnumL.label: Screen number -*expert*tree*adjacency.scrnumL.horizDistance: 50 -*expert*tree*adjacency.scrnum.width: 32 -*expert*tree*adjacency.scrnumL.fromVert: remove -*expert*tree*adjacency.scrnum.fromVert: remove -*expert*tree*adjacency.scrnum.fromHoriz: scrnumL -*expert*tree*adjacency.above.label: Above -*expert*tree*adjacency.above.fromVert: scrnumL -*expert*tree*adjacency.above.vertDistance: 20 -*expert*tree*adjacency.above.horizDistance: 96 -*expert*tree*adjacency.below.label: Below -*expert*tree*adjacency.below.horizDistance: 96 -*expert*tree*adjacency.leftOf.label: LeftOf -*expert*tree*adjacency.leftOf.fromVert: above -*expert*tree*adjacency.screen.fromVert: above -*expert*tree*adjacency.screen.fromHoriz: leftOf -*expert*tree*adjacency.rightOf.label: RightOf -*expert*tree*adjacency.rightOf.fromVert: above -*expert*tree*adjacency.rightOf.fromHoriz: screen -*expert*tree*adjacency.below.fromVert: screen -*expert*tree*adjacency.relative.label: Relative -*expert*tree*adjacency.relative.horizDistance: 53 -*expert*tree*adjacency.relative.fromVert: below -*expert*tree*adjacency.absolute.fromVert: below -*expert*tree*adjacency*absolute.label: Absolute -*expert*tree*adjacency*absolute.fromHoriz: relative -*expert*tree*adjacency*adjxL.label: X -*expert*tree*adjacency*adjxL.horizDistance: 42 -*expert*tree*adjacency*adjxL.fromVert: absolute -*expert*tree*adjacency*adjx.fromVert: absolute -*expert*tree*adjacency*adjx.fromHoriz: adjxL -*expert*tree*adjacency*adjyL.label: Y -*expert*tree*adjacency*adjyL.horizDistance: 12 -*expert*tree*adjacency*adjyL.fromVert: absolute -*expert*tree*adjacency*adjyL.fromHoriz: adjx -*expert*tree*adjacency*adjy.fromVert: absolute -*expert*tree*adjacency*adjy.fromHoriz: adjyL - -*expert*tree*inputref.options.fromHoriz: remove -*expert*tree*inputref.label.fromHoriz: options - -*expert*tree*vendor.Text.width: 100 -*expert*tree*vendor.options.fromHoriz: remove -*expert*tree*vendor.label.fromHoriz: options -*expert*tree*vendor.value.fromHoriz: new - -*expert*tree*vendorSub.Text.width: 140 -*expert*tree*vendorSub.options.fromHoriz: remove -*expert*tree*vendorSub.label.fromHoriz: options -*expert*tree*vendorSub.nameL.label: Name -*expert*tree*vendorSub.nameL.fromVert: remove -*expert*tree*vendorSub.name.fromVert: remove -*expert*tree*vendorSub.name.fromHoriz: nameL -*expert*tree*vendorSub.value.fromHoriz: new - -*expert*tree*dri.Text.width: 100 -*expert*tree*dri.Label.width: 78 -*expert*tree*dri.Label.justify: left -*expert*tree*dri.nameL.label: Group name -*expert*tree*dri.name.fromHoriz: nameL -*expert*tree*dri.groupL.label: Group -*expert*tree*dri.groupL.fromVert: name -*expert*tree*dri.group.fromVert: name -*expert*tree*dri.group.fromHoriz: groupL -*expert*tree*dri.modeL.label: Mode -*expert*tree*dri.modeL.fromVert: group -*expert*tree*dri.mode.fromVert: group -*expert*tree*dri.mode.fromHoriz: modeL - -*expert*tree*buffers.Label.width: 50 -*expert*tree*buffers.Text.width: 100 -*expert*tree*buffers.countL.label: Count -*expert*tree*buffers.countL.fromVert: remove -*expert*tree*buffers.count.fromVert: remove -*expert*tree*buffers.count.fromHoriz: countL -*expert*tree*buffers.sizeL.label: Size -*expert*tree*buffers.sizeL.fromVert: count -*expert*tree*buffers.size.fromVert: count -*expert*tree*buffers.size.fromHoriz: sizeL -*expert*tree*buffers.flagsL.label: Flags -*expert*tree*buffers.flagsL.fromVert: size -*expert*tree*buffers.flags.fromVert: size -*expert*tree*buffers.flags.fromHoriz: flagsL -*Expert*close.label: Close diff --git a/hw/xfree86/utils/xorgcfg/accessx.c b/hw/xfree86/utils/xorgcfg/accessx.c deleted file mode 100644 index 38bda383a..000000000 --- a/hw/xfree86/utils/xorgcfg/accessx.c +++ /dev/null @@ -1,681 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" -#include <sys/types.h> -#include <sys/wait.h> -#include <signal.h> -#include <X11/XKBlib.h> -#include <X11/Shell.h> -#include <X11/Xaw/Command.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/Scrollbar.h> -#include <X11/Xaw/Toggle.h> -#include "keyboard-cfg.h" - -#define MAX_TIMEOUT 20 -#define MAX_MOUSE_SPEED 500 -#define MAX_MOUSE_TIME 4 -#define MAX_MOUSE_DELAY 2.09 -#define MAX_REPEAT_RATE 8.04 -#define MAX_REPEAT_DELAY 6.04 -#define MAX_SLOW_TIME 4 -#define MAX_BOUNCE_TIME 4 - -/* - * Types - */ -typedef struct { - Widget label, number, scroller; - double min, max, value, resolution; - Bool integer; -} Scale; - -/* - * Initialization - */ -static Widget shell, accessx, enable, timeoutToggle, form, apply; -static Widget sticky, stickyAuto, stickyBeep; -static Widget mouse; -static Widget repeat; -static Widget slowToggle, slowPressed, slowAccepted; -static Widget bounceToggle; -static Scale *timeout, *mouseSpeed, *mouseTime, *mouseDelay, *slow, - *repeatRate, *repeatDelay, *bounce; -extern Widget work; - -/* - * Prototypes - */ -static void CreateAccessXHelpDialog(void); -static void EnableCallback(Widget, XtPointer, XtPointer); -static void ScaleEnableCallback(Widget, XtPointer, XtPointer); -static void ScaleJumpCallback(Widget, XtPointer, XtPointer); - -static void ApplyCallback(Widget, XtPointer, XtPointer); -static void AccessXInitialize(void); - -void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*); -void AccessXConfigureStart(void); -void AccessXConfigureEnd(void); - -/* - * Implementation - */ -void -startaccessx(void) -{ - InitializeKeyboard(); - - if (xkb_info->xkb) { - XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - if (xkb_info->xkb->ctrls == NULL) - xkb_info->xkb->ctrls = (XkbControlsPtr) - XtCalloc(1, sizeof(XkbControlsRec)); - - xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask | - XkbMouseKeysAccelMask; - xkb_info->xkb->ctrls->mk_delay = 40; - xkb_info->xkb->ctrls->mk_interval = 10; - xkb_info->xkb->ctrls->mk_time_to_max = 1000; - xkb_info->xkb->ctrls->mk_max_speed = 500; - xkb_info->xkb->ctrls->mk_curve = 0; - XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - (void)UpdateKeyboard(True); - CreateAccessXHelpDialog(); - } -} - -void -CreateAccessXHelpDialog() -{ - Widget form; - - shell = XtVaCreatePopupShell("accessx", transientShellWidgetClass, toplevel, - XtNx, toplevel->core.x + toplevel->core.width, - XtNy, toplevel->core.y, NULL); - form = XtCreateManagedWidget("form", formWidgetClass, shell, NULL, 0); - XtCreateManagedWidget("label", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("lock", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("div", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("mul", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("minus", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("7", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("8", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("9", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("plus", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("4", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("5", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("6", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("1", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("2", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("3", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("enter", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("0", labelWidgetClass, form, NULL, 0); - XtCreateManagedWidget("del", labelWidgetClass, form, NULL, 0); - - XtRealizeWidget(shell); - XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); - XtPopup(shell, XtGrabNone); -} - -/*ARGSUSED*/ -void -CloseAccessXAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - XtPopdown(shell); -} - -static void -AccessXInitialize(void) -{ - static int first = 1; - Arg args[1]; - Boolean state; - Widget stickyForm, mouseForm, repeatForm, slowForm, bounceForm; - float val, tmp; - - if (!first) - return; - first = 0; - - InitializeKeyboard(); - - XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - if (xkb_info->xkb->ctrls == NULL) - xkb_info->xkb->ctrls = (XkbControlsPtr) - XtCalloc(1, sizeof(XkbControlsRec)); - - timeout = XtNew(Scale); - accessx = XtCreateWidget("accessxForm", formWidgetClass, work, NULL, 0); - enable = XtVaCreateManagedWidget("enable", toggleWidgetClass, accessx, - XtNstate, - (xkb_info->xkb->ctrls->enabled_ctrls & - (XkbAccessXKeysMask | XkbStickyKeysMask | - XkbSlowKeysMask | XkbBounceKeysMask)) != 0, NULL); - - apply = XtCreateManagedWidget("apply", commandWidgetClass, accessx, NULL, 0); - XtAddCallback(apply, XtNcallback, ApplyCallback, NULL); - - form = XtCreateManagedWidget("Accessx", formWidgetClass, accessx, NULL, 0); - timeoutToggle = XtVaCreateManagedWidget("timeoutToggle", toggleWidgetClass, - form, XtNstate, - xkb_info->xkb->ctrls->ax_timeout > 60 - && xkb_info->xkb->ctrls->ax_timeout - < 30000, NULL); - XtAddCallback(timeoutToggle, XtNcallback, ScaleEnableCallback, - (XtPointer)timeout); - timeout->label = XtCreateManagedWidget("timeoutLabel", labelWidgetClass, - form, NULL, 0); - timeout->number = XtCreateManagedWidget("timeoutNumber", labelWidgetClass, - form, NULL, 0); - timeout->scroller = XtCreateManagedWidget("timeoutScroller", - scrollbarWidgetClass, - form, NULL, 0); - XtAddCallback(timeout->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)timeout); - timeout->min = 1; - timeout->max = MAX_TIMEOUT; - timeout->resolution = 1; - timeout->integer = True; - - sticky = XtVaCreateManagedWidget("sticky", toggleWidgetClass, form, - XtNstate, - (xkb_info->xkb->ctrls->enabled_ctrls & - XkbStickyKeysMask) != 0, NULL); - stickyForm = XtCreateManagedWidget("stickyForm", formWidgetClass, - form, NULL, 0); - XtAddCallback(sticky, XtNcallback, EnableCallback, (XtPointer)stickyForm); - stickyAuto = XtVaCreateManagedWidget("auto", toggleWidgetClass, stickyForm, - XtNstate, - (xkb_info->xkb->ctrls->ax_options & - XkbAX_LatchToLockMask) == 0, NULL); - stickyBeep = XtVaCreateManagedWidget("beep", toggleWidgetClass, stickyForm, - XtNstate, - (xkb_info->xkb->ctrls->ax_options & - XkbAX_StickyKeysFBMask) != 0, NULL); - - mouse = XtVaCreateManagedWidget("mouseKeys", toggleWidgetClass, form, - XtNstate, - (xkb_info->xkb->ctrls->enabled_ctrls & - (XkbMouseKeysMask | XkbMouseKeysAccelMask)) - != 0, NULL); - mouseForm = XtCreateManagedWidget("mouseForm", formWidgetClass, - form, NULL, 0); - XtAddCallback(mouse, XtNcallback, EnableCallback, (XtPointer)mouseForm); - mouseSpeed = XtNew(Scale); - mouseSpeed->label = XtCreateManagedWidget("speedLabel", labelWidgetClass, - mouseForm, NULL, 0); - mouseSpeed->number = XtCreateManagedWidget("speedNumber", labelWidgetClass, - mouseForm, NULL, 0); - mouseSpeed->scroller = XtCreateManagedWidget("speedScroller", - scrollbarWidgetClass, - mouseForm, NULL, 0); - XtAddCallback(mouseSpeed->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)mouseSpeed); - mouseSpeed->min = 10; - mouseSpeed->max = MAX_MOUSE_SPEED; - mouseSpeed->resolution = 10; - mouseSpeed->integer = True; - mouseTime = XtNew(Scale); - mouseTime->label = XtCreateManagedWidget("timeLabel", labelWidgetClass, - mouseForm, NULL, 0); - mouseTime->number = XtCreateManagedWidget("timeNumber", labelWidgetClass, - mouseForm, NULL, 0); - mouseTime->scroller = XtCreateManagedWidget("timeScroller", - scrollbarWidgetClass, - mouseForm, NULL, 0); - XtAddCallback(mouseTime->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)mouseTime); - mouseTime->min = .1; - mouseTime->max = MAX_MOUSE_TIME; - mouseTime->resolution = .1; - mouseTime->integer = False; - mouseDelay = XtNew(Scale); - mouseDelay->label = XtCreateManagedWidget("delayLabel", labelWidgetClass, - mouseForm, NULL, 0); - mouseDelay->number = XtCreateManagedWidget("delayNumber", labelWidgetClass, - mouseForm, NULL, 0); - mouseDelay->scroller = XtCreateManagedWidget("delayScroller", - scrollbarWidgetClass, - mouseForm, NULL, 0); - XtAddCallback(mouseDelay->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)mouseDelay); - mouseDelay->min = .1; - mouseDelay->max = MAX_MOUSE_DELAY; - mouseDelay->resolution = .1; - mouseDelay->integer = False; - - repeat = XtVaCreateManagedWidget("repeatKeys", toggleWidgetClass, form, - XtNstate, - (xkb_info->xkb->ctrls->enabled_ctrls & - XkbRepeatKeysMask) != 0, NULL); - repeatForm = XtCreateManagedWidget("repeatForm", formWidgetClass, - form, NULL, 0); - XtAddCallback(repeat, XtNcallback, EnableCallback, (XtPointer)repeatForm); - repeatRate = XtNew(Scale); - repeatRate->label = XtCreateManagedWidget("rateLabel", labelWidgetClass, - repeatForm, NULL, 0); - repeatRate->number = XtCreateManagedWidget("rateNumber", labelWidgetClass, - repeatForm, NULL, 0); - repeatRate->scroller = XtCreateManagedWidget("rateScroller", - scrollbarWidgetClass, - repeatForm, NULL, 0); - XtAddCallback(repeatRate->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)repeatRate); - repeatRate->min = .05; - repeatRate->max = MAX_REPEAT_RATE; - repeatRate->resolution = .05; - repeatRate->integer = False; - repeatDelay = XtNew(Scale); - repeatDelay->label = XtCreateManagedWidget("delayLabel", labelWidgetClass, - repeatForm, NULL, 0); - repeatDelay->number = XtCreateManagedWidget("delayNumber", labelWidgetClass, - repeatForm, NULL, 0); - repeatDelay->scroller = XtCreateManagedWidget("delayScroller", - scrollbarWidgetClass, - repeatForm, NULL, 0); - XtAddCallback(repeatDelay->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)repeatDelay); - repeatDelay->min = .05; - repeatDelay->max = MAX_REPEAT_DELAY; - repeatDelay->resolution = .05; - repeatDelay->integer = False; - - slowToggle = XtVaCreateManagedWidget("slow", toggleWidgetClass, - form, XtNstate, - (xkb_info->xkb->ctrls->enabled_ctrls & - XkbSlowKeysMask) != 0, NULL); - slowForm = XtCreateManagedWidget("slowForm", formWidgetClass, - form, NULL, 0); - XtAddCallback(slowToggle, XtNcallback, EnableCallback, (XtPointer)slowForm); - XtCreateManagedWidget("beep", labelWidgetClass, slowForm, NULL, 0); - slowPressed = XtVaCreateManagedWidget("pressed", toggleWidgetClass, - slowForm, XtNstate, - (xkb_info->xkb->ctrls->ax_options & - XkbAX_SKPressFBMask) != 0, - NULL); - slowAccepted = XtVaCreateManagedWidget("accepted", toggleWidgetClass, - slowForm, XtNstate, - (xkb_info->xkb->ctrls->ax_options & - XkbAX_SKAcceptFBMask) != 0, - NULL); - slow = XtNew(Scale); - slow->label = XtCreateManagedWidget("slowLabel", labelWidgetClass, - slowForm, NULL, 0); - slow->number = XtCreateManagedWidget("slowNumber", labelWidgetClass, - slowForm, NULL, 0); - slow->scroller = XtCreateManagedWidget("slowScroller", - scrollbarWidgetClass, - slowForm, NULL, 0); - XtAddCallback(slow->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)slow); - slow->min = 0.1; - slow->max = MAX_SLOW_TIME; - slow->resolution = 0.1; - slow->integer = False; - - bounceToggle = XtVaCreateManagedWidget("bounce", toggleWidgetClass, - form, XtNstate, - (xkb_info->xkb->ctrls->enabled_ctrls & - XkbBounceKeysMask) != 0, - NULL); - bounceForm = XtCreateManagedWidget("bounceForm", formWidgetClass, - form, NULL, 0); - XtAddCallback(bounceToggle, XtNcallback, EnableCallback, (XtPointer)bounceForm); - bounce = XtNew(Scale); - bounce->label = XtCreateManagedWidget("bounceLabel", labelWidgetClass, - bounceForm, NULL, 0); - bounce->number = XtCreateManagedWidget("bounceNumber", labelWidgetClass, - bounceForm, NULL, 0); - bounce->scroller = XtCreateManagedWidget("bounceScroller", - scrollbarWidgetClass, - bounceForm, NULL, 0); - XtAddCallback(bounce->scroller, XtNjumpProc, ScaleJumpCallback, - (XtPointer)bounce); - bounce->min = 0.1; - bounce->max = MAX_BOUNCE_TIME; - bounce->resolution = 0.1; - bounce->integer = False; - - XtRealizeWidget(accessx); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(timeoutToggle, args, 1); - ScaleEnableCallback(enable, (XtPointer)timeout, (XtPointer)(long)state); - if (xkb_info->xkb->ctrls->ax_timeout > 60) - val = (float)(xkb_info->xkb->ctrls->ax_timeout - 60) / - (float)(MAX_TIMEOUT * 60); - else - val = 0; - ScaleJumpCallback(timeout->scroller, (XtPointer)timeout, (XtPointer)&val); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(sticky, args, 1); - EnableCallback(sticky, (XtPointer)stickyForm, (XtPointer)(long)state); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(mouse, args, 1); - EnableCallback(mouse, (XtPointer)mouseForm, (XtPointer)(long)state); - if (xkb_info->xkb->ctrls->mk_time_to_max > 10) - val = (float)((xkb_info->xkb->ctrls->mk_time_to_max * (40. / 10.))) / - (float)(MAX_MOUSE_TIME * 100); - else - val = 10.0 / (float)(MAX_MOUSE_TIME * 100); - ScaleJumpCallback(mouseTime->scroller, (XtPointer)mouseTime, - (XtPointer)&val); - tmp = mouseTime->value; - if (xkb_info->xkb->ctrls->mk_max_speed != 0) - val = (float)(xkb_info->xkb->ctrls->mk_max_speed / tmp - 10) / - (float)MAX_MOUSE_SPEED; - else - val = 10.0 / (float)MAX_MOUSE_SPEED; - ScaleJumpCallback(mouseSpeed->scroller, (XtPointer)mouseSpeed, - (XtPointer)&val); - if (xkb_info->xkb->ctrls->mk_delay > 10) - val = (float)(xkb_info->xkb->ctrls->mk_delay - 10) / - (float)(MAX_MOUSE_DELAY * 100); - else - val = 10.0 / (float)(MAX_MOUSE_DELAY * 100); - ScaleJumpCallback(mouseDelay->scroller, (XtPointer)mouseDelay, - (XtPointer)&val); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(repeat, args, 1); - EnableCallback(repeat, (XtPointer)repeatForm, (XtPointer)(long)state); - if (xkb_info->xkb->ctrls->repeat_interval > 5) - val = (float)(xkb_info->xkb->ctrls->repeat_interval - 5) / - (float)(MAX_REPEAT_RATE * 1000); - else - val = 5.0 / (float)(MAX_REPEAT_RATE * 1000); - ScaleJumpCallback(repeatRate->scroller, (XtPointer)repeatRate, - (XtPointer)&val); - if (xkb_info->xkb->ctrls->repeat_delay > 5) - val = (float)(xkb_info->xkb->ctrls->repeat_delay - 5) / - (float)(MAX_REPEAT_DELAY * 1000); - else - val = 5.0 / (float)(MAX_REPEAT_DELAY * 1000); - ScaleJumpCallback(repeatDelay->scroller, (XtPointer)repeatDelay, - (XtPointer)&val); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(slowToggle, args, 1); - EnableCallback(slowToggle, (XtPointer)slowForm, (XtPointer)(long)state); - if (xkb_info->xkb->ctrls->slow_keys_delay > 10) - val = (float)(xkb_info->xkb->ctrls->repeat_delay - 10) / - (float)(MAX_SLOW_TIME * 1000); - else - val = 10.0 / (float)(MAX_SLOW_TIME * 1000); - ScaleJumpCallback(slow->scroller, (XtPointer)slow, (XtPointer)&val); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(bounceToggle, args, 1); - EnableCallback(bounceToggle, (XtPointer)bounceForm, (XtPointer)(long)state); - if (xkb_info->xkb->ctrls->debounce_delay > 10) - val = (float)(xkb_info->xkb->ctrls->debounce_delay - 10) / - (float)(MAX_BOUNCE_TIME * 1000); - else - val = 10.0 / (float)(MAX_BOUNCE_TIME * 1000); - ScaleJumpCallback(bounce->scroller, (XtPointer)bounce, (XtPointer)&val); - - XtSetArg(args[0], XtNstate, &state); - XtGetValues(enable, args, 1); -} - -void -AccessXConfigureStart(void) -{ - AccessXInitialize(); - - XtMapWidget(accessx); -} - -void -AccessXConfigureEnd(void) -{ - XtUnmapWidget(accessx); -} - -/*ARGSUSED*/ -static void -EnableCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtSetSensitive((Widget)user_data, (long)call_data); -} - -/*ARGSUSED*/ -static void -ScaleEnableCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Scale *scale = (Scale*)user_data; - - XtSetSensitive(scale->label, (long)call_data); - XtSetSensitive(scale->number, (long)call_data); - XtSetSensitive(scale->scroller, (long)call_data); -} - -static void -ScaleJumpCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Scale *scale = (Scale*)user_data; - float percent = *(float *)call_data, timeout = percent * scale->max; - int x; - char str[8]; - Arg args[1]; - - if (timeout >= scale->max - scale->min) - timeout = scale->max - scale->min; - - if (scale->integer) { - int tm = timeout + scale->min; - - tm -= tm % (int)scale->resolution; - XmuSnprintf(str, sizeof(str), "%i", tm); - scale->value = tm; - } - else { - long tm = (timeout + scale->min) * 1e+6; - - tm -= tm % (long)(scale->resolution * 1e+6); - scale->value = (double)tm / 1e+6; - XmuSnprintf(str, sizeof(str), "%f", scale->value); - } - - XtSetArg(args[0], XtNlabel, str); - XtSetValues(scale->number, args, 1); - x = w->core.x + w->core.border_width; - x += ((double)(w->core.width - scale->number->core.width) / scale->max) * timeout; - XtMoveWidget(scale->number, x, scale->number->core.y); - XawScrollbarSetThumb(w, timeout / (scale->max - scale->min), - scale->resolution / (scale->max - scale->min)); -} - -/*ARGSUSED*/ -static void -ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - Boolean state; - - XkbGetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - - /* Enable AccessX */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(enable, args, 1); - if (state) { - xkb_info->config.initial_ctrls |= XkbAccessXKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls |= XkbAccessXKeysMask; - } - else { - xkb_info->config.initial_ctrls &= ~XkbAccessXKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbAccessXKeysMask; - } - - /* Timeout */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(timeoutToggle, args, 1); - if (state) - xkb_info->config.ax_timeout = - xkb_info->xkb->ctrls->ax_timeout = timeout->value * 60; - else - xkb_info->config.ax_timeout = - xkb_info->xkb->ctrls->ax_timeout = 65535; - - /* Enable StickyKeys */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(sticky, args, 1); - if (state) { - xkb_info->config.initial_ctrls |= XkbStickyKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls |= XkbStickyKeysMask; - } - else { - xkb_info->config.initial_ctrls &= ~XkbStickyKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbStickyKeysMask; - } - XtSetArg(args[0], XtNstate, &state); - XtGetValues(stickyAuto, args, 1); - if (state) { - xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask; - xkb_info->config.initial_opts &= ~XkbAX_LatchToLockMask; - xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask; - xkb_info->xkb->ctrls->ax_options &= ~XkbAX_LatchToLockMask; - } - else { - xkb_info->config.initial_opts &= ~XkbAX_TwoKeysMask; - xkb_info->config.initial_opts |= XkbAX_LatchToLockMask; - xkb_info->xkb->ctrls->ax_options &= ~XkbAX_TwoKeysMask; - xkb_info->xkb->ctrls->ax_options |= XkbAX_LatchToLockMask; - } - XtSetArg(args[0], XtNstate, &state); - XtGetValues(stickyBeep, args, 1); - if (state) { - xkb_info->config.initial_opts |= XkbAX_StickyKeysFBMask; - xkb_info->xkb->ctrls->ax_options |= XkbAX_StickyKeysFBMask; - } - else { - xkb_info->config.initial_opts &= ~XkbAX_StickyKeysFBMask; - xkb_info->xkb->ctrls->ax_options &= ~XkbAX_StickyKeysFBMask; - } - - /* Enable MouseKeys */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(mouse, args, 1); - if (state) { - xkb_info->config.initial_ctrls |= XkbMouseKeysAccelMask; - xkb_info->xkb->ctrls->enabled_ctrls |= XkbMouseKeysMask | - XkbMouseKeysAccelMask; - xkb_info->config.mk_delay = - xkb_info->xkb->ctrls->mk_delay = mouseDelay->value * 100; - xkb_info->config.mk_interval = - xkb_info->xkb->ctrls->mk_interval = 40; - xkb_info->config.mk_time_to_max = - xkb_info->xkb->ctrls->mk_time_to_max = - (mouseTime->value * 1000) / xkb_info->xkb->ctrls->mk_interval; - xkb_info->config.mk_max_speed = - xkb_info->xkb->ctrls->mk_max_speed = - mouseSpeed->value * mouseTime->value; - xkb_info->config.mk_curve = xkb_info->xkb->ctrls->mk_curve = 0; - } - else { - xkb_info->config.initial_ctrls &= ~(XkbMouseKeysMask | - XkbMouseKeysAccelMask); - xkb_info->xkb->ctrls->enabled_ctrls &= ~(XkbMouseKeysMask | - XkbMouseKeysAccelMask); - } - - /* Enable RepeatKeys */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(repeat, args, 1); - if (state) { - xkb_info->config.initial_ctrls |= XkbRepeatKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls |= XkbRepeatKeysMask; - xkb_info->config.repeat_interval = - xkb_info->xkb->ctrls->repeat_interval = repeatRate->value * 1000; - xkb_info->config.repeat_delay = - xkb_info->xkb->ctrls->repeat_delay = repeatDelay->value * 1000; - } - else { - xkb_info->config.initial_ctrls &= ~XkbRepeatKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbRepeatKeysMask; - } - - /* Enable SlowKeys */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(slowToggle, args, 1); - if (state) { - xkb_info->config.initial_ctrls |= XkbSlowKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls |= XkbSlowKeysMask; - xkb_info->config.slow_keys_delay = - xkb_info->xkb->ctrls->slow_keys_delay = slow->value * 1000; - } - else { - xkb_info->config.initial_ctrls &= ~XkbSlowKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbSlowKeysMask; - } - XtSetArg(args[0], XtNstate, &state); - XtGetValues(slowPressed, args, 1); - if (state) { - xkb_info->config.initial_opts |= XkbAX_SKPressFBMask; - xkb_info->xkb->ctrls->ax_options |= XkbAX_SKPressFBMask; - } - else { - xkb_info->config.initial_opts &= ~XkbAX_SKPressFBMask; - xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKPressFBMask; - } - XtSetArg(args[0], XtNstate, &state); - XtGetValues(slowAccepted, args, 1); - if (state) { - xkb_info->config.initial_opts |= XkbAX_SKAcceptFBMask; - xkb_info->xkb->ctrls->ax_options |= XkbAX_SKAcceptFBMask; - } - else { - xkb_info->config.initial_opts &= ~XkbAX_SKAcceptFBMask; - xkb_info->xkb->ctrls->ax_options &= ~XkbAX_SKAcceptFBMask; - } - - /* Enable BounceKeys */ - XtSetArg(args[0], XtNstate, &state); - XtGetValues(bounceToggle, args, 1); - if (state) { - xkb_info->config.initial_ctrls |= XkbBounceKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls |= XkbBounceKeysMask; - xkb_info->config.debounce_delay = - xkb_info->xkb->ctrls->debounce_delay = bounce->value * 1000; - } - else { - xkb_info->config.initial_ctrls &= ~XkbBounceKeysMask; - xkb_info->xkb->ctrls->enabled_ctrls &= ~XkbBounceKeysMask; - } - - XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - XSync(DPY, False); - (void)UpdateKeyboard(True); -} diff --git a/hw/xfree86/utils/xorgcfg/card-cfg.c b/hw/xfree86/utils/xorgcfg/card-cfg.c deleted file mode 100644 index 1f3b7555e..000000000 --- a/hw/xfree86/utils/xorgcfg/card-cfg.c +++ /dev/null @@ -1,433 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "xf86config.h" -#include "mouse-cfg.h" -#include "cards.h" -#include "card-cfg.h" -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/List.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/SmeBSB.h> -#include <X11/Xaw/SimpleMenu.h> -#include <X11/Xaw/Viewport.h> -#ifdef USE_MODULES -#include "loader.h" -#endif - -/* - * Prototypes - */ -static Bool CardConfigCheck(void); -static void CardModelCallback(Widget, XtPointer, XtPointer); -#ifdef USE_MODULES -static void DriverCallback(Widget, XtPointer, XtPointer); -#endif - -/* - * Initialization - */ -static CardsEntry *card_entry; -static XF86ConfDevicePtr current_device; -static Widget filter, list, driver, busid; -static char **cards = NULL; -static int ncards; -#ifdef USE_MODULES -static char *driver_str; -#endif - -/* - * Implementation - */ -/*ARGSUSED*/ -XtPointer -CardConfig(XtPointer config) -{ - XF86ConfDevicePtr card = (XF86ConfDevicePtr)config; -/* XF86OptionPtr option;*/ - char card_name[32]; - Arg args[1]; - char *bus, *drv_nam; - - xf86info.cur_list = CARD; - XtSetSensitive(back, xf86info.lists[CARD].cur_function > 0); - XtSetSensitive(next, xf86info.lists[CARD].cur_function < - xf86info.lists[CARD].num_functions - 1); - (xf86info.lists[CARD].functions[xf86info.lists[CARD].cur_function]) - (&xf86info); - - card_entry = NULL; - current_device = card; - XawListUnhighlight(list); - XtSetArg(args[0], XtNstring, ""); - XtSetValues(filter, args, 1); - - if (card != NULL) { - if (card->dev_card != NULL) { - int i; - - for (i = 0; i < ncards; i++) { - if (strcasecmp(cards[i], card->dev_card) == 0) { - card_entry = LookupCard(cards[i]); - XawListHighlight(list, i); - XtSetArg(args[0], XtNstring, cards[i]); - XtSetValues(filter, args, 1); - break; - } - } - } - XtSetArg(args[0], XtNstring, card->dev_identifier); - XtSetValues(ident_widget, args, 1); - XtSetArg(args[0], XtNstring, card->dev_busid); - XtSetValues(busid, args, 1); -#ifdef USE_MODULES - if (!nomodules) - XtSetArg(args[0], XtNlabel, driver_str = XtNewString(card->dev_driver)); - else -#endif - XtSetArg(args[0], XtNstring, card->dev_driver); - XtSetValues(driver, args, 1); - } - else { - XF86ConfDevicePtr device = XF86Config->conf_device_lst; - int ndevices = 0; - - while (device != NULL) { - ++ndevices; - device = (XF86ConfDevicePtr)(device->list.next); - } - do { - XmuSnprintf(card_name, sizeof(card_name), "Card%d", ndevices); - ++ndevices; - } while (xf86findDevice(card_name, - XF86Config->conf_device_lst)); - - XtSetArg(args[0], XtNstring, card_name); - XtSetValues(ident_widget, args, 1); - XtSetArg(args[0], XtNstring, ""); - XtSetValues(busid, args, 1); -#ifdef USE_MODULES - if (!nomodules) - XtSetArg(args[0], XtNlabel, driver_str = XtNewString("vga")); - else -#endif - XtSetArg(args[0], XtNstring, "vga"); - XtSetValues(driver, args, 1); - } - - if (ConfigLoop(CardConfigCheck) == True) { - if (card_entry != NULL && card_entry->driver == NULL) { - fprintf(stderr, "No driver field in Cards database.\n" - "Please make sure you have the correct files installed.\n"); - exit(1); - } - if (card == NULL) { - card = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec)); - card->dev_identifier = XtNewString(ident_string); - if (card_entry) { - card->dev_driver = XtNewString(card_entry->driver); - card->dev_card = XtNewString(card_entry->name); - if (card_entry->chipset) - card->dev_chipset = XtNewString(card_entry->chipset); - if (card_entry->ramdac) - card->dev_ramdac = XtNewString(card_entry->ramdac); - if (card_entry->clockchip) - card->dev_clockchip = XtNewString(card_entry->clockchip); - } - /* else will fallback to "vga" */ - } - else if (card_entry != NULL) { - XtFree(card->dev_driver); - card->dev_driver = XtNewString(card_entry->driver); - if (card_entry->chipset) { - XtFree(card->dev_chipset); - card->dev_chipset = XtNewString(card_entry->chipset); - } - if (card_entry->ramdac) { - XtFree(card->dev_ramdac); - card->dev_ramdac = XtNewString(card_entry->ramdac); - } - if (card_entry->clockchip) { - XtFree(card->dev_clockchip); - card->dev_clockchip = XtNewString(card_entry->clockchip); - } - } - if (strcasecmp(card->dev_identifier, ident_string)) - xf86renameDevice(XF86Config, card, ident_string); - XtSetArg(args[0], XtNstring, &bus); - XtGetValues(busid, args, 1); - XtFree(card->dev_busid); - card->dev_busid = XtNewString(bus); - -#ifdef USE_MODULES - if (!nomodules) - drv_nam = driver_str; - else -#endif - { - XtSetArg(args[0], XtNstring, &drv_nam); - XtGetValues(driver, args, 1); - } - - XtFree(card->dev_driver); - card->dev_driver = XtNewString(drv_nam); - -#ifdef USE_MODULES - if (!nomodules) - XtFree(driver_str); -#endif - - return ((XtPointer)card); - } -#ifdef USE_MODULES - if (!nomodules) - XtFree(driver_str); -#endif - - return (NULL); -} - -static Bool -CardConfigCheck(void) -{ - XF86ConfDevicePtr device = XF86Config->conf_device_lst; - char *drv_nam; - -#ifdef USE_MODULES - if (!nomodules) - drv_nam = driver_str; - else -#endif - { - Arg args[1]; - - XtSetArg(args[0], XtNstring, &drv_nam); - XtGetValues(driver, args, 1); - } - - if (ident_string == NULL || strlen(ident_string) == 0 || -#if 0 - /* not all available cards are in the Cards database */ - (current_device == NULL && card_entry == NULL) || -#endif - drv_nam == NULL || *drv_nam == '\0') - return (False); - - while (device != NULL) { - if (device != current_device && - strcasecmp(ident_string, device->dev_identifier) == 0) - return (False); - device = (XF86ConfDevicePtr)(device->list.next); - } - - return (True); -} - -static void -CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - char tip[4096]; - int len; - - XtSetArg(args[0], XtNstring, info->string); - XtSetValues(filter, args, 1); - card_entry = LookupCard(info->string); - - if (card_entry == NULL) - return; - - len = XmuSnprintf(tip, sizeof(tip), "Name: %s\n", card_entry->name); - if (card_entry->flags & F_UNSUPPORTED) - len += XmuSnprintf(tip + len, sizeof(tip) - len, - "**THIS CARD IS UNSUPPORTED**\n"); - if (card_entry->chipset != NULL) - len += XmuSnprintf(tip + len, sizeof(tip) - len, - "Chipset: %s\n", card_entry->chipset); - if (card_entry->driver != NULL) { -#ifdef USE_MODULES - if (!nomodules) { - XtFree(driver_str); - driver_str = XtNewString(card_entry->driver); - XtVaSetValues(driver, XtNlabel, driver_str, NULL); - } -#endif - len += XmuSnprintf(tip + len, sizeof(tip) - len, - "Driver: %s\n", card_entry->driver); - } - if (card_entry->ramdac != NULL) - len += XmuSnprintf(tip + len, sizeof(tip), - "Ramdac: %s\n", card_entry->ramdac); - if (card_entry->clockchip != NULL) - len += XmuSnprintf(tip + len, sizeof(tip) - len, - "Clockchip: %s\n", card_entry->clockchip); - if (card_entry->dacspeed != NULL) - len += XmuSnprintf(tip + len, sizeof(tip) - len, - "Dacspeed: %s\n", card_entry->dacspeed); - if (card_entry->lines != NULL) - len += XmuSnprintf(tip + len, sizeof(tip) - len, - "\n%s\n", card_entry->lines); - -#ifndef USE_MODULES - XtSetArg(args[0], XtNstring, - card_entry->driver ? card_entry->driver : "vga"); - XtSetValues(driver, args, 1); -#endif - - XtSetArg(args[0], XtNtip, tip); - XtSetValues(filter, args, 1); -} - -/*ARGSUSED*/ -void -CardFilterAction(Widget w, XEvent *ev, String *params, Cardinal *num_params) -{ - char **cards, *pattern, **old_cards; - int ncards, old_ncards; - Arg args[2]; - - XtSetArg(args[0], XtNstring, &pattern); - XtGetValues(w, args, 1); - - XtSetArg(args[0], XtNlist, &old_cards); - XtSetArg(args[1], XtNnumberStrings, &old_ncards); - XtGetValues(list, args, 2); - - cards = FilterCardNames(pattern, &ncards); - - if (ncards == 0) { - cards = (char**)XtMalloc(sizeof(char*)); - cards[0] = XtNewString(""); - ncards = 1; - } - - XtSetArg(args[0], XtNlist, cards); - XtSetArg(args[1], XtNnumberStrings, ncards); - XtSetValues(list, args, 2); - - if (old_ncards > 1 || (XtName(list) != old_cards[0])) { - while (--old_ncards > -1) - XtFree(old_cards[old_ncards]); - XtFree((char*)old_cards); - } - - /* force relayout */ - XtUnmanageChild(list); - XtManageChild(list); -} - -#ifdef USE_MODULES -/*ARGSUSED*/ -static void -DriverCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - - XtFree(driver_str); - driver_str = XtNewString(XtName(w)); - XtSetArg(args[0], XtNlabel, driver_str); - XtSetValues(driver, args, 1); -} -#endif - -void -CardModel(XF86SetupInfo *info) -{ - static int first = 1; - static Widget model; - - if (first) { - Widget viewport; - - first = 0; - - cards = GetCardNames(&ncards); - - model = XtCreateWidget("cardModel", formWidgetClass, - configp, NULL, 0); - (void) XtCreateManagedWidget("label", labelWidgetClass, - model, NULL, 0); - filter = XtVaCreateManagedWidget("filter", asciiTextWidgetClass, - model, - XtNeditType, XawtextEdit, - NULL); - viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, - model, NULL, 0); - list = XtVaCreateManagedWidget("list", listWidgetClass, - viewport, - XtNlist, cards, - XtNnumberStrings, ncards, - NULL); - XtAddCallback(list, XtNcallback, CardModelCallback, - (XtPointer)info); - XtCreateManagedWidget("driverL", labelWidgetClass, model, NULL, 0); -#ifdef USE_MODULES - if (!nomodules) { - driver = XtVaCreateManagedWidget("driver", menuButtonWidgetClass, - model, - XtNmenuName, "driverM", - NULL); - { - Widget menu, sme; - xf86cfgModuleOptions *opts = module_options; - - menu = XtCreatePopupShell("driverM", simpleMenuWidgetClass, - driver, NULL, 0); - while (opts) { - if (opts->type == VideoModule) { - sme = XtCreateManagedWidget(opts->name, smeBSBObjectClass, - menu, NULL, 0); - XtAddCallback(sme, XtNcallback, DriverCallback, NULL); - } - opts = opts->next; - } - } - } - else -#endif - driver = XtVaCreateManagedWidget("driver", asciiTextWidgetClass, - model, - XtNeditType, XawtextEdit, - NULL); - - XtCreateManagedWidget("busidL", labelWidgetClass, model, NULL, 0); - busid = XtVaCreateManagedWidget("busid", asciiTextWidgetClass, - model, - XtNeditType, XawtextEdit, - NULL); - - XtRealizeWidget(model); - } - XtChangeManagedSet(¤t, 1, NULL, NULL, &model, 1); - current = model; -} diff --git a/hw/xfree86/utils/xorgcfg/card-cfg.h b/hw/xfree86/utils/xorgcfg/card-cfg.h deleted file mode 100644 index fbb02a7ab..000000000 --- a/hw/xfree86/utils/xorgcfg/card-cfg.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" - -#ifndef _xf86cfg_card_h -#define _xf86cfg_card_h - -/* - * Prototypes - */ -XtPointer CardConfig(XtPointer); -void CardModel(XF86SetupInfo*); -void CardFilterAction(Widget, XEvent*, String*, Cardinal*); - -#endif /* _xf86cfg_card_h */ diff --git a/hw/xfree86/utils/xorgcfg/card.xbm b/hw/xfree86/utils/xorgcfg/card.xbm deleted file mode 100644 index aad07a90a..000000000 --- a/hw/xfree86/utils/xorgcfg/card.xbm +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -#define card_width 50 -#define card_height 44 -static unsigned char card_bits[] = { - 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfd, 0xff, 0xff, 0xff, 0x07, - 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x80, 0x07, 0x00, 0x00, - 0x00, 0x1c, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x80, 0x01, - 0x00, 0x00, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0x00, 0x00, 0xf8, 0x19, 0x00, - 0x80, 0xf9, 0xf8, 0x7f, 0x98, 0x19, 0x00, 0x80, 0x01, 0xf8, 0x7f, 0x98, - 0x19, 0x00, 0x80, 0x01, 0x18, 0x60, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0x18, - 0x60, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0x18, 0x60, 0x00, 0x18, 0x00, 0x80, - 0x01, 0x18, 0x60, 0xf8, 0x19, 0x00, 0x80, 0x01, 0x18, 0x60, 0xf8, 0x19, - 0x00, 0x80, 0xf9, 0x18, 0x60, 0x98, 0x19, 0x00, 0x80, 0xf9, 0x18, 0x60, - 0x98, 0x19, 0x00, 0x80, 0x01, 0x18, 0x60, 0xf8, 0x19, 0x00, 0x80, 0x01, - 0xf8, 0x7f, 0xf8, 0x19, 0x00, 0x80, 0xf9, 0xf8, 0x7f, 0x00, 0x18, 0x00, - 0x80, 0xf9, 0x00, 0x00, 0xf8, 0x19, 0x00, 0x80, 0x01, 0x00, 0x00, 0xf8, - 0x19, 0x00, 0x80, 0x01, 0x30, 0x33, 0x98, 0x19, 0x00, 0x80, 0xf9, 0x30, - 0x33, 0x98, 0x19, 0x00, 0x80, 0xf9, 0x30, 0x33, 0xf8, 0x19, 0x00, 0x80, - 0x01, 0x30, 0x33, 0xf8, 0x19, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x80, 0xff, 0x07, 0x00, - 0x80, 0x0f, 0x00, 0x80, 0xfd, 0x0f, 0x00, 0xc0, 0x07, 0x00, 0x80, 0x01, - 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x80, 0x01, 0xcc, 0xcc, 0xcc, 0x00, 0x00, - 0x80, 0x01, 0xcc, 0xcc, 0xcc, 0x00, 0x00, 0x80, 0x01, 0xcc, 0xcc, 0xcc, - 0x00, 0x00, 0x80, 0x01, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x80, 0x01, 0xf8, - 0xff, 0x7f, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/hw/xfree86/utils/xorgcfg/card.xpm b/hw/xfree86/utils/xorgcfg/card.xpm deleted file mode 100644 index 32bccb689..000000000 --- a/hw/xfree86/utils/xorgcfg/card.xpm +++ /dev/null @@ -1,81 +0,0 @@ -/* XPM */ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -static char * card_xpm[] = { -"41 40 8 1", -" c none", -"A c #B6DABAEAB6DA", -"X c #0000AAAA0000", -"o c #000071C60000", -"O c #000041030000", -"+ c #618561856185", -"@ c #186118611861", -"# c #CF3CA2892081", -"AAA ", -" A ", -" A ", -" A ", -" A ", -" A ", -" A ", -" AXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX ", -" AooooooooooooooooooooooooooooooooooooO", -" AooooooooooooooooooooooooooooooooooooO", -" AooooooooooooooooooooooooooooooooooooO", -" AooooooooooooooooooooooooOOOOOOOOOOOOO", -" AooooooooooooooooooAoAoAoAooAAAAAAA+oO", -" AooooooooooooooooooAoAoAoAooA++++++@oO", -" AooooooooooooooooooAoAoAoAooA+oooo+@oO", -" AoooooooooooooooooooooooooooA+AAAA+@oO", -" AoooooooooooooooooooooooooooA+oooo+@oO", -" AoooooooooooooooooooooooooooA++++++@oO", -" Aooooooooooooooooooooooooooo+@@@@@@@oO", -" AooooooooooooooooooooooooooooooooooooO", -" AoooooooooooooooooooooooooooAAAAAAA+oO", -" +AoooooooooooooooooAAAAAAAA@oA++++++@oO", -" AoooooooooooooooooA+++++++@oA+oooo+@oO", -" AoooooooooooooooooA+++++++@oA+AAAA+@oO", -" ++AoooooooooooooooooA+++++++@oA+oooo+@oO", -" ++AoooooooooooooooooA+++++++@oA++++++@oO", -" ++Aooooooooooooooooo@@@@@@@@@o+@@@@@@@oO", -" ++AooooooooooooooooooooooooooooooooooooO", -" AooooooooooooooooooooooooooooooooooooO", -" AooooooooooooooooooooooooooooooooooooO", -" +AooooooooooooooooooooooooooooooooooooO", -" AooooooooooooooooooooooooooooooooooooO", -" AoooOOOOooooooooooooooooooooOoooooOOO ", -" AooO X#o#o#o#o#o#o#o#o#oO X#o#O ", -" AOO X#o#o#o#o#o#o#o#o#oO X#o#O ", -" A X#o#o#o#o#o#o#o#o#oO X#o#O ", -" A X#o#o#o#o#o#o#o#o#oO X#o#O ", -" A OOOOOOOOOOOOOOOOOO OOO ", -" A ", -" A "}; diff --git a/hw/xfree86/utils/xorgcfg/cards.c b/hw/xfree86/utils/xorgcfg/cards.c deleted file mode 100644 index dcd5828cb..000000000 --- a/hw/xfree86/utils/xorgcfg/cards.c +++ /dev/null @@ -1,695 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#define CARDS_PRIVATE -#include "cards.h" - -#undef SERVER /* defined in config.h, but of no use here */ - -/* return values from ReadCardsLine. */ -#define ERROR -3 -#define UNKNOWN -2 -#define END -1 -#define NOTUSEFUL 0 -#define NAME 1 -#define CHIPSET 2 -#define SERVER 3 -#define DRIVER 4 -#define RAMDAC 5 -#define CLOCKCHIP 6 -#define DACSPEED 7 -#define NOCLOCKPROBE 8 -#define UNSUPPORTED 9 -#define SEE 10 -#define LINE 11 - -/* - * Prototypes - */ -static int ReadCardsLine(FILE*, char*); /* must have 256 bytes */ -static int CompareCards(_Xconst void *left, _Xconst void *right); -static int BCompareCards(_Xconst void *left, _Xconst void *right); -static void DoReadCardsDatabase(void); -static char **DoFilterCardNames(char *pattern, int *result); - -#ifdef USE_MODULES - -typedef struct { - int ivendor; - unsigned short vendor; - unsigned short valid_vendor; - char *chipsets; - int num_chipsets; -} chipset_check; -#endif - -/* - * Initialization - */ -static int linenum = 0; -static char *Cards = "lib/X11/Cards"; -CardsEntry **CardsDB; -int NumCardsEntry; - -/* - * Implementation - */ -#ifdef USE_MODULES -const pciVendorInfo *xf86PCIVendorInfo; -#endif - -#ifdef USE_MODULES -void -InitializePciInfo(void) -{ - xf86PCIVendorInfo = pciVendorInfoList; -} - -void -CheckChipsets(xf86cfgModuleOptions *opts, int *err) -{ - int i, j, ichk, ivnd = 0, vendor = -1, device; - const pciDeviceInfo **pDev; - SymTabPtr chips = opts->chipsets; - chipset_check *check = NULL; - int num_check = 0; - - if (!chips) { - CheckMsg(CHECKER_NO_CHIPSETS, "WARNING No chipsets specified.\n"); - ++*err; - return; - } - - while (chips->name) { - device = chips->token & 0xffff; - vendor = (chips->token & 0xffff0000) >> 16; - if (vendor == 0) - vendor = opts->vendor; - - for (ichk = 0; ichk < num_check; ichk++) - if (check[ichk].vendor == vendor) - break; - if (ichk >= num_check) { - check = (chipset_check*) - XtRealloc((XtPointer)check, - sizeof(chipset_check) * (num_check + 1)); - check[num_check].vendor = vendor; - memset(&check[num_check], 0, sizeof(chipset_check)); - ++num_check; - } - - /* Search for vendor in xf86PCIVendorInfo */ - if (xf86PCIVendorInfo) { - for (ivnd = 0; xf86PCIVendorInfo[ivnd].VendorID; ivnd++) - if (vendor == xf86PCIVendorInfo[ivnd].VendorID) - break; - } - if (xf86PCIVendorInfo && xf86PCIVendorInfo[ivnd].VendorID) { - check[ichk].valid_vendor = 1; - check[ichk].ivendor = ivnd; - } - else { - CheckMsg(CHECKER_CANNOT_VERIFY_CHIPSET, - "WARNING Cannot verify chipset \"%s\" (0x%x)\n", - chips->name, device); - ++*err; - ++chips; - continue; - } - - if (xf86PCIVendorInfo && - (pDev = xf86PCIVendorInfo[ivnd].Device) != NULL) { - if (check[ichk].chipsets == NULL) { - for (j = 0; pDev[j]; j++) - ; - check[ichk].chipsets = (char*)XtCalloc(1, j); - } - for (j = 0; pDev[j]; j++) { - if (device == pDev[j]->DeviceID) { - if (strcmp(chips->name, pDev[j]->DeviceName)) { - CheckMsg(CHECKER_NOMATCH_CHIPSET_STRINGS, - "WARNING chipset strings don't match: \"%s\" \"%s\" (0x%x)\n", - chips->name, xf86PCIVendorInfo[ivnd].Device[j]->DeviceName, - device); - ++*err; - } - break; - } - } - if (!pDev[j]) { - CheckMsg(CHECKER_CHIPSET_NOT_LISTED, - "WARNING chipset \"%s\" (0x%x) not in list.\n", chips->name, device); - ++*err; - } - else - check[ichk].chipsets[j] = 1; - } - ++chips; - } - - for (i = 0; i < num_check; i++) { - if (!check[i].valid_vendor) { - CheckMsg(CHECKER_CHIPSET_NO_VENDOR, - "WARNING No such vendor 0x%x\n", vendor); - ++*err; - } - for (j = 0; j < check[i].num_chipsets; j++) { - if (xf86PCIVendorInfo && !check[i].chipsets[j]) { - CheckMsg(CHECKER_CHIPSET_NOT_SUPPORTED, - "NOTICE chipset \"%s\" (0x%x) not listed as supported.\n", - xf86PCIVendorInfo[check[i].ivendor].Device[j]->DeviceName, - xf86PCIVendorInfo[check[i].ivendor].Device[j]->DeviceID); - } - } - XtFree(check[i].chipsets); - } - - XtFree((XtPointer)check); -} -#endif - -void -ReadCardsDatabase(void) -{ -#ifdef USE_MODULES - if (!nomodules) { - int i, j, ivendor, idevice; - char name[256]; - _Xconst char *vendor, *device; - CardsEntry *entry = NULL, *tmp; - xf86cfgModuleOptions *opts = module_options; - const pciDeviceInfo **pDev; - - /* Only list cards that have a driver installed */ - while (opts) { - if (opts->chipsets) { - SymTabPtr chips = opts->chipsets; - - while (chips->name) { - vendor = opts->name; - device = chips->name; - ivendor = (chips->token & 0xffff0000) >> 16; - idevice = chips->token & 0xffff0; - if (ivendor == 0) - ivendor = opts->vendor; - - if (xf86PCIVendorInfo) { - for (i = 0; xf86PCIVendorInfo[i].VendorName; i++) - if (ivendor == xf86PCIVendorInfo[i].VendorID) { - vendor = xf86PCIVendorInfo[i].VendorName; - break; - } - if (xf86PCIVendorInfo[i].VendorName) { - if ((pDev = xf86PCIVendorInfo[i].Device)) { - for (j = 0; pDev[j]; j++) - if (idevice == pDev[j]->DeviceID) { - device = pDev[j]->DeviceName; - break; - } - } - } - } - - /* Since frequently there is more than one driver for a - * single vendor, it is required to avoid duplicates. - */ - XmuSnprintf(name, sizeof(name), "%s %s", vendor, device); - tmp = LookupCard(name); - - if (tmp == NULL || strcmp(tmp->chipset, chips->name) || - strcmp(tmp->driver, opts->name)) { - entry = (CardsEntry*)XtCalloc(1, sizeof(CardsEntry)); - if (NumCardsEntry % 16 == 0) { - CardsDB = (CardsEntry**)XtRealloc((XtPointer)CardsDB, - sizeof(CardsEntry*) * (NumCardsEntry + 16)); - } - CardsDB[NumCardsEntry++] = entry; - entry->name = XtNewString(name); - - /* XXX no private copy of strings */ - entry->chipset = (char*)chips->name; - entry->driver = opts->name; - - /* better than linear searchs to find duplicates */ - qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), - CompareCards); - } - ++chips; - } - } - opts = opts->next; - } - - /* fix entries with the same name */ - for (i = 0; i < NumCardsEntry - 2;) { - for (j = i + 1; j < NumCardsEntry - 1 && - strcmp(CardsDB[i]->name, CardsDB[j]->name) == 0; j++) - ; - - if (i + 1 != j) { - while (i < j) { - char *str; - - if (strcmp(CardsDB[i]->chipset, CardsDB[j]->chipset)) - str = CardsDB[i]->chipset; - else - str = CardsDB[i]->driver; - - XmuSnprintf(name, sizeof(name), "%s (%s)", - CardsDB[i]->name, str); - XtFree(CardsDB[i]->name); - CardsDB[i]->name = XtNewString(name); - - ++i; - } - } - else - ++i; - } - - /* make sure data is valid to bsearch in */ - qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), CompareCards); - } - else -#endif - DoReadCardsDatabase(); -} - -static void -DoReadCardsDatabase(void) -{ - char buffer[256]; - FILE *fp = fopen(Cards, "r"); - int i, result; - CardsEntry *entry = NULL; - static char *CardsError = "Error reading Cards database, at line %d (%s).\n"; - - if (fp == NULL) { - fprintf(stderr, "Cannot open Cards database.\n"); - exit(1); - } - - while ((result = ReadCardsLine(fp, buffer)) != END) { - switch (result) { - case ERROR: - fprintf(stderr, CardsError, linenum, buffer); - break; - case UNKNOWN: - fprintf(stderr, - "Unknown field type in Cards database, at line %d (%s).\n", - linenum, buffer); - break; - case NAME: - entry = calloc(1, sizeof(CardsEntry)); - if (NumCardsEntry % 16 == 0) { - CardsDB = realloc(CardsDB, sizeof(CardsEntry*) * - (NumCardsEntry + 16)); - if (CardsDB == NULL) { - fprintf(stderr, "Out of memory reading Cards database.\n"); - exit(1); - } - } - CardsDB[NumCardsEntry++] = entry; - entry->name = strdup(buffer); - break; - case CHIPSET: - if (entry == NULL || entry->chipset != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } -#if 0 - else - entry->chipset = strdup(buffer); -#endif - break; - case SERVER: - if (entry == NULL || entry->server != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->server = strdup(buffer); - break; - case DRIVER: - if (entry == NULL || entry->driver != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->driver = strdup(buffer); - break; - case RAMDAC: - if (entry == NULL || entry->ramdac != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->ramdac = strdup(buffer); - break; - case CLOCKCHIP: - if (entry == NULL || entry->clockchip != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->clockchip = strdup(buffer); - break; - case DACSPEED: - if (entry == NULL || entry->dacspeed != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->dacspeed = strdup(buffer); - break; - case NOCLOCKPROBE: - if (entry == NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->flags |= F_NOCLOCKPROBE; - break; - case UNSUPPORTED: - if (entry == NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->flags |= F_UNSUPPORTED; - break; - case SEE: - if (entry == NULL || entry->see != NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else - entry->see = strdup(buffer); - break; - case LINE: - if (entry == NULL) { - fprintf(stderr, CardsError, linenum, buffer); - } - else if (entry->lines == NULL) - entry->lines = strdup(buffer); - else { - char *str = malloc(strlen(entry->lines) + strlen(buffer) + 2); - - sprintf(str, "%s\n%s", entry->lines, buffer); - free(entry->lines); - entry->lines = str; - } - break; - } - } - - fclose(fp); - - qsort(CardsDB, NumCardsEntry, sizeof(CardsEntry*), CompareCards); - -#ifdef DEBUG - for (i = 0; i < NumCardsEntry - 1; i++) { - if (strcmp(CardsDB[i]->name, CardsDB[i+1]->name) == 0) - fprintf(stderr, "Duplicate entry in Cards database: (%s).\n", - CardsDB[i]->name); - } -#endif - - for (i = 0; i < NumCardsEntry - 1; i++) { - if (CardsDB[i]->see != NULL) { - if ((entry = LookupCard(CardsDB[i]->see)) == NULL) { - fprintf(stderr, "Cannot find card '%s' for filling defaults.\n", - CardsDB[i]->see); - continue; - } - if (CardsDB[i]->chipset == NULL && entry->chipset != NULL) - CardsDB[i]->chipset = strdup(entry->chipset); - if (CardsDB[i]->server == NULL && entry->server != NULL) - CardsDB[i]->server = strdup(entry->server); - if (CardsDB[i]->driver == NULL && entry->driver != NULL) - CardsDB[i]->driver = strdup(entry->driver); - if (CardsDB[i]->ramdac == NULL && entry->ramdac != NULL) - CardsDB[i]->ramdac = strdup(entry->ramdac); - if (CardsDB[i]->clockchip == NULL && entry->clockchip != NULL) - CardsDB[i]->clockchip = strdup(entry->clockchip); - if (CardsDB[i]->dacspeed == NULL && entry->dacspeed != NULL) - CardsDB[i]->dacspeed = strdup(entry->dacspeed); - if (CardsDB[i]->flags & F_NOCLOCKPROBE) - CardsDB[i]->flags |= F_NOCLOCKPROBE; - if (CardsDB[i]->flags & F_UNSUPPORTED) - CardsDB[i]->flags |= F_UNSUPPORTED; - if (entry->lines != NULL) { - if (CardsDB[i]->lines == NULL) - CardsDB[i]->lines = strdup(entry->lines); - else { - char *str = malloc(strlen(entry->lines) + - strlen(CardsDB[i]->lines) + 2); - - sprintf(str, "%s\n%s", CardsDB[i]->lines, entry->lines); - free(CardsDB[i]->lines); - CardsDB[i]->lines = str; - } - } - if (entry->see != NULL) { -#ifdef DEBUG - fprintf(stderr, "Nested SEE entry: %s -> %s -> %s\n", - CardsDB[i]->name, CardsDB[i]->see, entry->see); -#endif - CardsDB[i]->see = strdup(entry->see); - --i; - continue; - } - free(CardsDB[i]->see); - CardsDB[i]->see = NULL; - } - } -} - -CardsEntry * -LookupCard(char *name) -{ - CardsEntry **ptr; - - if (NumCardsEntry == 0 || CardsDB == 0) - return NULL; - - ptr = (CardsEntry**)bsearch(name, CardsDB, NumCardsEntry, - sizeof(CardsEntry*), BCompareCards); - - return (ptr != NULL ? *ptr : NULL); -} - -char ** -GetCardNames(int *result) -{ - char **cards = NULL; - int ncards; - - for (ncards = 0; ncards < NumCardsEntry; ncards++) { - if (ncards % 16 == 0) { - if ((cards = (char**)realloc(cards, sizeof(char*) * - (ncards + 16))) == NULL) { - fprintf(stderr, "Out of memory.\n"); - exit(1); - } - } - cards[ncards] = strdup(CardsDB[ncards]->name); - } - - *result = ncards; - - return (cards); -} - -char ** -FilterCardNames(char *pattern, int *result) -{ -#ifdef USE_MODULES - if (!nomodules) { - char **cards = NULL; - int i, ncards = 0; - - for (i = 0; i < NumCardsEntry; i++) { - if (strstr(CardsDB[i]->name, pattern) == NULL) - continue; - if (ncards % 16 == 0) { - if ((cards = (char**)realloc(cards, sizeof(char*) * - (ncards + 16))) == NULL) { - fprintf(stderr, "Out of memory.\n"); - exit(1); - } - } - cards[ncards] = strdup(CardsDB[i]->name); - ++ncards; - } - - *result = ncards; - - return (cards); - } -#endif - return (DoFilterCardNames(pattern, result)); -} - -static char ** -DoFilterCardNames(char *pattern, int *result) -{ - FILE *fp; - char **cards = NULL; - int len, ncards = 0; - char *cmd, *ptr, buffer[256]; - - cmd = malloc(32 + (strlen(pattern) * 2) + strlen(Cards)); - - strcpy(cmd, "egrep -i '^NAME\\ .*"); - len = strlen(cmd); - ptr = pattern; - while (*ptr) { - if (!isalnum(*ptr)) { - cmd[len++] = '\\'; - } - cmd[len++] = *ptr++; - } - cmd[len] = '\0'; - strcat(cmd, ".*$' "); - strcat(cmd, Cards); - strcat(cmd, " | sort"); - /*sprintf(cmd, "egrep -i '^NAME\\ .*%s.*$' %s | sort", pattern, Cards);*/ - - if ((fp = popen(cmd, "r")) == NULL) { - fprintf(stderr, "Cannot read Cards database.\n"); - exit(1); - } - while (fgets(buffer, sizeof(buffer), fp) != NULL) { - ptr = buffer + strlen(buffer) - 1; - while (isspace(*ptr) && ptr > buffer) - --ptr; - if (!isspace(*ptr) && ptr > buffer) - ptr[1] = '\0'; - ptr = buffer; - while (!isspace(*ptr) && *ptr) /* skip NAME */ - ++ptr; - while (isspace(*ptr) && *ptr) - ++ptr; - if (ncards % 16 == 0) { - if ((cards = (char**)realloc(cards, sizeof(char*) * - (ncards + 16))) == NULL) { - fprintf(stderr, "Out of memory.\n"); - exit(1); - } - } - cards[ncards++] = strdup(ptr); - } - free(cmd); - - *result = ncards; - - return (cards); -} - -static int -ReadCardsLine(FILE *fp, char *value) -{ - char name[32], buffer[256], *ptr, *end; - int result = NOTUSEFUL; - - ++linenum; - - if (fgets(buffer, sizeof(buffer), fp) == NULL) - return (END); - - ptr = buffer; - /* skip initial spaces; should'nt bother about this.. */ - while (isspace(*ptr) && *ptr) - ++ptr; - - if (*ptr == '#' || *ptr == '\0') - return (NOTUSEFUL); - - end = ptr; - while (!isspace(*end) && *end) - ++end; - if (end - ptr > sizeof(buffer) - 1) { - strncpy(value, buffer, 255); - value[255] = '\0'; - return (ERROR); - } - strncpy(name, ptr, end - ptr); - name[end - ptr] = '\0'; - - /* read the optional arguments */ - ptr = end; - while (isspace(*ptr) && *ptr) - ++ptr; - - end = ptr + strlen(ptr) - 1; - while (isspace(*end) && end > ptr) - --end; - if (!isspace(*end)) - ++end; - *end = '\0'; - - if (strcmp(name, "NAME") == 0) - result = NAME; - else if (strcmp(name, "CHIPSET") == 0) - result = CHIPSET; - else if (strcmp(name, "SERVER") == 0) - result = SERVER; - else if (strcmp(name, "DRIVER") == 0) - result = DRIVER; - else if (strcmp(name, "RAMDAC") == 0) - result = RAMDAC; - else if (strcmp(name, "CLOCKCHIP") == 0) - result = CLOCKCHIP; - else if (strcmp(name, "DACSPEED") == 0) - result = DACSPEED; - else if (strcmp(name, "NOCLOCKPROBE") == 0) - result = NOCLOCKPROBE; - else if (strcmp(name, "UNSUPPORTED") == 0) - result = UNSUPPORTED; - else if (strcmp(name, "SEE") == 0) - result = SEE; - else if (strcmp(name, "LINE") == 0) - result = LINE; - else if (strcmp(name, "END") == 0) - result = END; - else { - strcpy(value, name); - return (UNKNOWN); - } - - /* value *must* have at least 256 bytes */ - strcpy(value, ptr); - - return (result); -} - -static int -CompareCards(_Xconst void *left, _Xconst void *right) -{ - return strcasecmp((*(CardsEntry**)left)->name, (*(CardsEntry**)right)->name); -} - -static int -BCompareCards(_Xconst void *name, _Xconst void *card) -{ - return (strcasecmp((char*)name, (*(CardsEntry**)card)->name)); -} diff --git a/hw/xfree86/utils/xorgcfg/cards.h b/hw/xfree86/utils/xorgcfg/cards.h deleted file mode 100644 index 8557e96df..000000000 --- a/hw/xfree86/utils/xorgcfg/cards.h +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <X11/Xfuncproto.h> -#include <X11/Xmd.h> -#include <X11/Intrinsic.h> -#include <X11/Xmu/SysUtil.h> - -#ifndef _xf86cfg_cards_h -#define _xf86cfg_cards_h - -#ifdef USE_MODULES -#ifdef CARDS_PRIVATE -#include "loader.h" - -#include "xf86PciStr.h" -#include "xf86PciIds.h" -#endif /* CARDS_PRIVATE */ -#endif /* USE_MODULES */ - -/* Flags in CardsEntry */ -#define F_NOCLOCKPROBE 0x1 /* Never probe clocks of the card. */ -#define F_UNSUPPORTED 0x2 /* Card is not supported (only VGA). */ - -/* - * Types - */ -typedef struct { - char *name; /* Name of the card. */ - char *chipset; /* Chipset (decriptive). */ - char *server; /* Server identifier. */ - char *driver; /* Driver identifier. */ - char *ramdac; /* Ramdac identifier. */ - char *clockchip; /* Clockchip identifier. */ - char *dacspeed; /* DAC speed rating. */ - int flags; - char *lines; /* Additional Device section lines. */ - char *see; /* Must resolve in a last step. - * Allow more than one SEE entry? */ -} CardsEntry; - -extern CardsEntry **CardsDB; -extern int NumCardsEntry; - -/* - * Prototypes - */ -void ReadCardsDatabase(void); -CardsEntry *LookupCard(char*); -char **GetCardNames(int*); -char **FilterCardNames(char*, int*); -#ifdef USE_MODULES -void InitializePciInfo(void); -typedef struct _xf86cfgModuleOptions *xf86cfgModuleOptionsPtr; -void CheckChipsets(xf86cfgModuleOptionsPtr, int*); -#endif - -#endif /* _xf86cfg_cards_h */ diff --git a/hw/xfree86/utils/xorgcfg/computer.xpm b/hw/xfree86/utils/xorgcfg/computer.xpm deleted file mode 100644 index 9167e3eaf..000000000 --- a/hw/xfree86/utils/xorgcfg/computer.xpm +++ /dev/null @@ -1,91 +0,0 @@ -/* XPM */ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -static char * computer_xpm[] = { -"30 50 8 1", -" c none", -". c #CF3CCF3CCF3C", -"X c #B6DABAEAB6DA", -"o c #8E388E388E38", -"O c #FFFFFFFFFFFF", -"+ c #FFFF00000000", -"@ c #514451445144", -"# c #0000FFFF0000", -" ............................ ", -"..XXXXXXXXXXXXXXXXXXXXXXXXXXXo", -".XXXXXXXXXXXXXXXXXXXXXXXXXXXXo", -".XXooooooooooooooooooooooooXXo", -".XXo.......................XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XX....XXXXXXXXXXXOoXo.XXo", -".XXo.XXooooXXXXXXXXXXXooXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.......................XXo", -".XXooooooooooooooooooooooooXXo", -".XXo.......................XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXooooooooooooooooooooooo.XXo", -".XXo.......................XXo", -".XXoooooooooooooo.XXXXXXXo.XXo", -".XXo..............XXXXXXXo.XXo", -".XXo.XXXXXXXXXXXX.XX.O.XXo.XXo", -".XXo.oooooooooooX.XXO+OXXo.XXo", -".XXo.XXXXXXXXXOOX.XX.O.XXo.XXo", -".XXo.XXXXXXXXXXXX.XXXXXXXo.XXo", -".XXo..............XXXXXXXo.XXo", -".XXooooooooooooooooooooooo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXX@@@@@@@@@XXX...XXo.XXo", -".XXo.XX@@+@@@@@#@@X.OXXoXo.XXo", -".XXo.XXX@@@@@@@@@XXXoooXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXX..XXXo.XXo", -".XXo.XXXXXXXXXXXXXX.OXoXXo.XXo", -".XXo.XXXXXXXXXXXXXXXooXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXo.XXXXXXXXXXXXXXXXXXXXo.XXo", -".XXXo.XXXXXXXXXXXXXXXXXXo.XXXo", -".XXXo.XXXXXXXXXXXXXXXXXXo.XXXo", -".XXXo.XXXXXXXXXXXXXXXXXXo.XXXo", -".XXXo.oXXXoXXXoXXXoXXXoXo.XXXo", -".XXXXo.XXXXXXXXXXXXXXXXo.XXXXo", -".XXXXo..oXXXoXXXoXXoXXoo.XXXXo", -".XXXXXoo..XXXXXXXXXXoo..XXXXXo", -".XXXXXXXoo......oooo..XXXXXXXo", -".XXXXXXXXXoooooo....XXXXXXXXXo", -".XXXXXXXXXXXXXXXXXXXXXXXXXXXXo", -".XXXXXXXXXXXXXXXXXXXXXXXXXXXoo", -" oooooooooooooooooooooooooooo "}; diff --git a/hw/xfree86/utils/xorgcfg/config.c b/hw/xfree86/utils/xorgcfg/config.c deleted file mode 100644 index 8c985bf34..000000000 --- a/hw/xfree86/utils/xorgcfg/config.c +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" -#include "mouse-cfg.h" -#include "keyboard-cfg.h" -#include "card-cfg.h" -#include "monitor-cfg.h" -#include "screen-cfg.h" -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/Paned.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/Command.h> -#include <X11/Shell.h> - -/* - * Prototypes - */ -void BackCallback(Widget, XtPointer, XtPointer); -void NextCallback(Widget, XtPointer, XtPointer); -void ApplyCallback(Widget, XtPointer, XtPointer); -void CloseCallback(Widget, XtPointer, XtPointer); -void ErrorCallback(Widget, XtPointer, XtPointer); - -/* - * Initialization - */ -XF86SetupFunction mouse_functions[] = { - MouseDeviceAndProtocol, -}; - -XF86SetupFunction keyboard_functions[] = { - KeyboardModelAndLayout, -}; - -XF86SetupFunction card_functions[] = { - CardModel, -}; - -XF86SetupFunction monitor_functions[] = { - MonitorLayout, -}; - -XF86SetupFunction screen_functions[] = { - ScreenDialog, -}; - -XF86SetupFunctionList function_lists[] = { - {mouse_functions, sizeof(mouse_functions) / sizeof(mouse_functions[0]),}, - {keyboard_functions, sizeof(keyboard_functions) / sizeof(keyboard_functions[0]),}, - {card_functions, sizeof(card_functions) / sizeof(card_functions[0]),}, - {monitor_functions, sizeof(monitor_functions) / sizeof(monitor_functions[0]),}, - {screen_functions, sizeof(screen_functions) / sizeof(screen_functions[0]),}, -}; - -XF86SetupInfo xf86info = { - sizeof(function_lists) / sizeof(function_lists[0]), - MOUSE, - function_lists, -}; - -Widget configp, current, ok, back, next; -static Widget shell, errcurrent, oldcurrent; - -static int config_status, config_popped; - -static ConfigCheckFunction config_function; - -Widget ident_widget; -char *ident_string; -XF86ConfigPtr XF86Config; - -/* - * Implementation - */ -void -StartConfig(void) -{ - static int first = 1; - Widget pane, top, bottom, cancel; - const char *filename; - - if (!first) - return; - first = 0; - - /* Read initial configuration */ - if ((filename = xf86openConfigFile(getuid() == 0 ? CONFPATH : USER_CONFPATH, - XF86Config_path, NULL)) == NULL) { - int length = XF86Config_path ? strlen(XF86Config_path) : -1; - - if (length > 2 && - XF86Config_path[length - 2] == '-' && - XF86Config_path[length - 1] == '4') { - XF86Config_path[length - 2] = '\0'; - filename = xf86openConfigFile(getuid() == 0 ? - CONFPATH : USER_CONFPATH, - XF86Config_path, NULL); - } - - if (filename == NULL) { - fprintf(stderr, "Cannot open config file.\n"); - exit(1); - } - } - XF86Config_path = (char *)filename; - if ((XF86Config = xf86readConfigFile()) == NULL) { - fprintf(stderr, "Problem when parsing config file\n"); - exit(1); - } - - shell = XtCreatePopupShell("config", transientShellWidgetClass, - toplevel, NULL, 0); - pane = XtCreateManagedWidget("pane", panedWidgetClass, - shell, NULL, 0); - top = XtCreateManagedWidget("top", formWidgetClass, - pane, NULL, 0); - (void) XtCreateManagedWidget("label", labelWidgetClass, - top, NULL, 0); - ident_widget = XtVaCreateManagedWidget("identifier", asciiTextWidgetClass, - top, - XtNeditType, XawtextEdit, - NULL); - configp = XtCreateManagedWidget("work", formWidgetClass, - pane, NULL, 0); - current = XtCreateManagedWidget("wellcome", labelWidgetClass, - configp, NULL, 0); - bottom = XtCreateManagedWidget("bottom", formWidgetClass, - pane, NULL, 0); - back = XtCreateManagedWidget("back", commandWidgetClass, - bottom, NULL, 0); - XtAddCallback(back, XtNcallback, BackCallback, (XtPointer)&xf86info); - next = XtCreateManagedWidget("next", commandWidgetClass, - bottom, NULL, 0); - XtAddCallback(next, XtNcallback, NextCallback, (XtPointer)&xf86info); - ok = XtCreateManagedWidget("ok", commandWidgetClass, - bottom, NULL, 0); - XtAddCallback(ok, XtNcallback, ApplyCallback, (XtPointer)NULL); - cancel = XtCreateManagedWidget("cancel", commandWidgetClass, - bottom, NULL, 0); - XtAddCallback(cancel, XtNcallback, CloseCallback, (XtPointer)NULL); - - XtRealizeWidget(shell); - - XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); -} - -/*ARGSUSED*/ -Bool -ConfigLoop(ConfigCheckFunction config_fn) -{ - Arg args[1]; - config_popped = True; - XtPopup(shell, XtGrabExclusive); - - config_function = config_fn; - while (config_popped) - XtAppProcessEvent(XtWidgetToApplicationContext(shell), XtIMAll); - - XtSetArg(args[0], XtNstring, &ident_string); - XtGetValues(ident_widget, args, 1); - - return (config_status); -} - -/*ARGSUSED*/ -void -ConfigError(void) -{ - static int first = 1; - - if (first) { - Widget command; - - errcurrent = XtCreateWidget("error", formWidgetClass, - configp, NULL, 0); - (void) XtCreateManagedWidget("label", labelWidgetClass, - errcurrent, NULL, 0); - command = XtCreateManagedWidget("command", commandWidgetClass, - errcurrent, NULL, 0); - XtAddCallback(command, XtNcallback, ErrorCallback, NULL); - - XtRealizeWidget(errcurrent); - } - - oldcurrent = current; - XtChangeManagedSet(¤t, 1, NULL, NULL, &errcurrent, 1); - current = errcurrent; - - XtSetSensitive(ok, False); -} - -/*ARGSUSED*/ -void -ErrorCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtChangeManagedSet(&errcurrent, 1, NULL, NULL, &oldcurrent, 1); - current = oldcurrent; - - XtSetSensitive(ok, True); -} - -/*ARGSUSED*/ -void -BackCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XF86SetupInfo *info = (XF86SetupInfo*)user_data; - int idx = info->lists[info->cur_list].cur_function - 1; - - if (idx >= 0 && info->lists[info->cur_list].num_functions > 0) { - info->lists[info->cur_list].cur_function = idx; - if (idx - 1 == -1) - XtSetSensitive(back, False); - if (!XtIsSensitive(next)) - XtSetSensitive(next, True); - (info->lists[info->cur_list].functions[idx])(info); - } -} - -/*ARGSUSED*/ -void -NextCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XF86SetupInfo *info = (XF86SetupInfo*)user_data; - int idx = info->lists[info->cur_list].cur_function + 1; - - if (idx < info->lists[info->cur_list].num_functions) { - info->lists[info->cur_list].cur_function = idx; - if (idx + 1 == info->lists[info->cur_list].num_functions) - XtSetSensitive(next, False); - if (!XtIsSensitive(back)) - XtSetSensitive(back, True); - (info->lists[info->cur_list].functions[idx])(info); - } -} - -/*ARGSUSED*/ -void -CloseCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtPopdown(shell); - config_popped = False; - config_status = False; - /* make sure it is sensitive */ - XtSetSensitive(ok, True); - xf86info.lists[xf86info.cur_list].cur_function = 0; -} - -/*ARGSUSED*/ -void -ApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - - XtSetArg(args[0], XtNstring, &ident_string); - XtGetValues(ident_widget, args, 1); - - if (config_function == NULL || (*config_function)()) { - XtPopdown(shell); - config_popped = False; - config_status = True; - xf86info.lists[xf86info.cur_list].cur_function = 0; - } - else - ConfigError(); -} - -/*ARGSUSED*/ -void -ConfigCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - CloseCallback(w, NULL, NULL); -} diff --git a/hw/xfree86/utils/xorgcfg/config.h b/hw/xfree86/utils/xorgcfg/config.h deleted file mode 100644 index ddbb05514..000000000 --- a/hw/xfree86/utils/xorgcfg/config.h +++ /dev/null @@ -1,227 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#ifdef HAVE_CONFIG_H -# include "xorg-config.h" -#endif - -#include <X11/IntrinsicP.h> -#include <X11/StringDefs.h> -#include <X11/Xmu/SysUtil.h> -#include <X11/Xos.h> -#include <stdio.h> -#include <stdlib.h> -#include <dirent.h> -#include <string.h> -#ifdef sun -#undef index -#undef rindex -#include <strings.h> -#endif -#include <unistd.h> - -#include <stdarg.h> - -/* Get PATH_MAX */ -#ifndef PATH_MAX -# if defined(_POSIX_SOURCE) -# include <limits.h> -# else -# define _POSIX_SOURCE -# include <limits.h> -# undef _POSIX_SOURCE -# endif -# ifndef PATH_MAX -# ifdef MAXPATHLEN -# define PATH_MAX MAXPATHLEN -# else -# define PATH_MAX 1024 -# endif -# endif -#endif - -#include <xf86Parser.h> -#include <X11/XKBlib.h> -#include <X11/extensions/XKBgeom.h> -#include <X11/extensions/XKM.h> -#include <X11/extensions/XKBfile.h> -#include <X11/extensions/XKBui.h> -#include <X11/extensions/XKBrules.h> -#include <X11/extensions/xf86misc.h> - -#ifndef _xf86cfg_config_h -#define _xf86cfg_config_h - -/* Must match the offset in the xf86info structure at config.c, - * and is used also by interface.c - */ -#define MOUSE 0 -#define KEYBOARD 1 -#define CARD 2 -#define MONITOR 3 -#define SCREEN 4 -#define SERVER 5 - -#define UNUSED 0 -#define USED 1 - -#define CONFIG_LAYOUT 0 -#define CONFIG_SCREEN 1 -#define CONFIG_MODELINE 2 -#define CONFIG_ACCESSX 3 -extern int config_mode; - -#define CONFPATH "%A," "%R," \ - "/etc/X11/%R," "%P/etc/X11/%R," \ - "%E," "%F," \ - "/etc/X11/%F," "%P/etc/X11/%F," \ - "/etc/X11/%X-%M," "/etc/X11/%X," "/etc/%X," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" -#define USER_CONFPATH "/etc/X11/%S," "%P/etc/X11/%S," \ - "/etc/X11/%G," "%P/etc/X11/%G," \ - "%P/etc/X11/%X.%H," "%P/etc/X11/%X-%M," \ - "%P/etc/X11/%X," \ - "%P/lib/X11/%X.%H," "%P/lib/X11/%X-%M," \ - "%P/lib/X11/%X" - -/* - * Types - */ -typedef struct _XF86SetupInfo XF86SetupInfo; -typedef void (*XF86SetupFunction)(XF86SetupInfo*); - -typedef struct _XF86SetupFunctionList { - XF86SetupFunction *functions; - int num_functions; - int cur_function; -} XF86SetupFunctionList; - -struct _XF86SetupInfo { - int num_lists; - int cur_list; - XF86SetupFunctionList *lists; -}; - -typedef Bool (*ConfigCheckFunction)(void); - -typedef struct _xf86cfgDevice xf86cfgDevice; - -struct _xf86cfgDevice { - XtPointer config; - Widget widget; - int type, state, refcount; -}; - -typedef struct { - XF86ConfScreenPtr screen; - Widget widget; - int type, state, refcount; - xf86cfgDevice *card; - xf86cfgDevice *monitor; - short row, column; - XRectangle rect; - short rotate; -} xf86cfgScreen; - -/* this structure is used just to restore - properly the monitors layout in the - screen window configuration. - */ -typedef struct { - XF86ConfLayoutPtr layout; - xf86cfgScreen **screen; - XPoint *position; - int num_layouts; -} xf86cfgLayout; - -/* The vidmode extension usage is controlled by this structure. - * The information is read at startup, and added monitors cannot - * be configured, since they are not attached to a particular screen. - */ -typedef struct _xf86cfgVidMode xf86cfgVidmode; - -typedef struct { - XF86ConfLayoutPtr layout; /* current layout */ - Widget cpu; - xf86cfgLayout **layouts; - Cardinal num_layouts; - xf86cfgScreen **screens; - Cardinal num_screens; - xf86cfgDevice **devices; - Cardinal num_devices; - xf86cfgVidmode **vidmodes; - Cardinal num_vidmodes; -} xf86cfgComputer; - -/* - * Prototypes - */ -void StartConfig(void); -Bool ConfigLoop(ConfigCheckFunction); -void ConfigError(void); -void ChangeScreen(XF86ConfMonitorPtr, XF86ConfMonitorPtr, - XF86ConfDevicePtr, XF86ConfDevicePtr); -void SetTip(xf86cfgDevice*); -Bool startx(void); -void endx(void); -void startaccessx(void); -void ConfigCancelAction(Widget, XEvent*, String*, Cardinal*); -void ExpertConfigureStart(void); -void ExpertConfigureEnd(void); -void ExpertCloseAction(Widget, XEvent*, String*, Cardinal*); -void ExpertCallback(Widget, XtPointer, XtPointer); - -/* - * Initialization - */ -extern Widget toplevel, configp, current, back, next; -extern XtAppContext appcon; -extern XF86SetupInfo xf86info; -extern Widget ident_widget; -extern char *ident_string; -extern XF86ConfigPtr XF86Config; -extern char *XF86Config_path; -extern char *XF86Module_path; -extern char *XFree86_path; -extern char *XF86Font_path; -extern char *XF86RGB_path; -extern char *XFree86Dir; -extern xf86cfgComputer computer; -extern Atom wm_delete_window; -extern Display *DPY; -extern Pixmap menuPixmap; -#ifdef USE_MODULES -extern int nomodules; -#endif - -#endif /* _xf86cfg_config_h */ diff --git a/hw/xfree86/utils/xorgcfg/down.xbm b/hw/xfree86/utils/xorgcfg/down.xbm deleted file mode 100644 index 742adf202..000000000 --- a/hw/xfree86/utils/xorgcfg/down.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define down_width 19 -#define down_height 19 -static unsigned char down_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x0f, 0x00, - 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, - 0x80, 0x0f, 0x00, 0xfc, 0xff, 0x01, 0xf8, 0xff, 0x00, 0xf0, 0x7f, 0x00, - 0xe0, 0x3f, 0x00, 0xc0, 0x1f, 0x00, 0x80, 0x0f, 0x00, 0x00, 0x07, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/hw/xfree86/utils/xorgcfg/expert.c b/hw/xfree86/utils/xorgcfg/expert.c deleted file mode 100644 index 484c2ec4b..000000000 --- a/hw/xfree86/utils/xorgcfg/expert.c +++ /dev/null @@ -1,4857 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" -#include "xf86config.h" -#include "options.h" -#include "screen.h" -#include "vidmode.h" -#include "monitor-cfg.h" -#include <X11/Shell.h> -#include <X11/CompositeP.h> -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/Box.h> -#include <X11/Xaw/Command.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/Paned.h> -#include <X11/Xaw/Panner.h> -#include <X11/Xaw/Porthole.h> -#include <X11/Xaw/SimpleMenu.h> -#include <X11/Xaw/SmeBSB.h> -#include <X11/Xaw/Toggle.h> -#include <X11/Xaw/Tree.h> -#include <ctype.h> - -/* - * Types - */ -typedef struct _TreeNode TreeNode; -typedef union _TreeData TreeData; -typedef void (*NodeDeleteFunc)(TreeNode*); -typedef void (*NodeUpdateFunc)(TreeNode*); - -union _TreeData { - struct { - Widget text; - } files; - struct { - Widget text; - XF86LoadPtr load; - } module; - struct { - Widget text; - XF86ConfModesPtr modes; - } modes; - struct { - Widget text, value; - XF86ConfModeLinePtr modeline; - } modeline; - struct { - Widget text, vendor, board, busid, driver; - XF86ConfVideoAdaptorPtr video; - } video; - struct { - Widget text; - XF86ConfVideoPortPtr port; - } port; - struct { - Widget text, vendor, model, width, height, hsync, vrefresh, - gammaRed, gammaGreen, gammaBlue; - XF86ConfMonitorPtr monitor; - } monitor; - struct { - Widget menu; - XF86ConfModesLinkPtr modeslink; - } modeslink; - struct { - Widget text, vendor, board, chipset, busid, card, driver, ramdac, - dacSpeed, videoRam, textClockFreq, biosBase, memBase, ioBase, - clockChip, devClock, chipId, chipRev, irq, screen; - XF86ConfDevicePtr device; - } device; - struct { - Widget text, defaultDepth, defaultBpp, defaultFbBpp, - monitor, device; - XF86ConfScreenPtr screen; - } screen; - struct { - Widget menu; - XF86ConfAdaptorLinkPtr adaptorlink; - } adaptorlink; - struct { - Widget viewport, c_virtual, depth, bpp, visual, weight, black, white; - XF86ConfDisplayPtr display; - } display; - struct { - Widget text; - XF86ModePtr mode; - } mode; - struct { - Widget text; - XF86ConfInputPtr input; - } input; - struct { - Widget text; - XF86ConfLayoutPtr layout; - } layout; - struct { - Widget menu, button, scrnum, adjx, adjy; - XF86ConfScreenPtr screen; - XF86ConfAdjacencyPtr adjacency; - } adjacency; - struct { - Widget menu; - XF86ConfInputrefPtr inputref; - } inputref; - struct { - Widget text; - XF86ConfVendorPtr vendor; - } vendor; - struct { - Widget text; - XF86ConfVendSubPtr vendsub; - } vendsub; - struct { - Widget name, group, mode; - XF86ConfDRIPtr dri; - } dri; - struct { - Widget count, size, flags; - XF86ConfBuffersPtr buffers; - } buffers; -}; - -struct _TreeNode { - Widget node, toggle, treeParent; - TreeNode *parent, *child, *next; - TreeData *data; - NodeDeleteFunc destroy; - NodeUpdateFunc update; -}; - -/* - * Prototypes - */ -static Bool ExpertInitialize(void); -static TreeNode *NewNode(TreeNode*, Widget, Widget, Widget, TreeData*); -static void DeleteNode(TreeNode*); -static void DestroyCallback(Widget, XtPointer, XtPointer); -static void PannerCallback(Widget, XtPointer, XtPointer); -static void PortholeCallback(Widget, XtPointer, XtPointer); -static void ToggleCallback(Widget, XtPointer, XtPointer); -static void ToggleNode(TreeNode*, Bool); -static void ToggleNodeRecursive(TreeNode*); -static void OptionsCallback(Widget, XtPointer, XtPointer); -static void RelayoutTree(void); -static void PopdownCallback(Widget, XtPointer, XtPointer); -static void UpdateConfig(TreeNode*); -static void DestroyTree(TreeNode*); - -static void CreateFiles(TreeNode*); -static void CreateFilesField(TreeNode*, char*, char*); -static void UpdateFiles(TreeNode*); - -static void CreateFontPath(TreeNode*, char*); -static Widget CreateFontPathField(TreeNode*, char*, Bool); -static void FontPathChanged(TreeNode*); -static void NewFontPathCallback(Widget, XtPointer, XtPointer); -static void FontPathCallback(Widget, XtPointer, XtPointer); - -static void CreateModulePath(TreeNode*, char*); -static Widget CreateModulePathField(TreeNode*, char*, Bool); -static void ModulePathChanged(TreeNode*); -static void NewModulePathCallback(Widget, XtPointer, XtPointer); - -static void CreateModule(TreeNode*, XF86LoadPtr); -static void CreateModuleField(TreeNode*, Bool); -static void ModuleDestroy(TreeNode*); -static void NewModuleCallback(Widget, XtPointer, XtPointer); - -static void CreateModes(TreeNode*, XF86ConfModesPtr); -static void CreateModesField(TreeNode*, Bool); -static void ModesDestroy(TreeNode*); -static void NewModesCallback(Widget, XtPointer, XtPointer); -static void CreateModesModeLine(TreeNode*, XF86ConfModeLinePtr); -static void ModesModeLineDestroy(TreeNode*); -static void NewModesModeLineCallback(Widget, XtPointer, XtPointer); - -static void CreateModeLineField(TreeNode*, Bool, Bool); -static XF86ConfModeLinePtr ParseModeLine(char*, char*); - -static void CreateVideoAdaptor(TreeNode*, XF86ConfVideoAdaptorPtr); -static void CreateVideoAdaptorField(TreeNode*, Bool); -static void VideoAdaptorDestroy(TreeNode*); -static void NewVideoAdaptorCallback(Widget, XtPointer, XtPointer); -static void VideoAdaptorUpdate(TreeNode*); -static void CreateVideoPort(TreeNode*, XF86ConfVideoPortPtr); -static void CreateVideoPortField(TreeNode*, Bool); -static void VideoPortDestroy(TreeNode*); -static void NewVideoPortCallback(Widget, XtPointer, XtPointer); - -static void CreateMonitor(TreeNode*, XF86ConfMonitorPtr); -static void CreateMonitorField(TreeNode*, Bool); -static void MonitorDestroy(TreeNode*); -static void NewMonitorCallback(Widget, XtPointer, XtPointer); -static void MonitorUpdate(TreeNode*); -static void CreateMonitorModeLine(TreeNode*, XF86ConfModeLinePtr); -static void MonitorModeLineDestroy(TreeNode*); -static void NewMonitorModeLineCallback(Widget, XtPointer, XtPointer); -static void CreateMonitorModes(TreeNode*, XF86ConfModesLinkPtr); -static void CreateMonitorModesField(TreeNode*, Bool); -static void MonitorModesLinkDestroy(TreeNode*); -static void NewMonitorModesCallback(Widget, XtPointer, XtPointer); - -static void CreateDevice(TreeNode*, XF86ConfDevicePtr); -static void CreateDeviceField(TreeNode*, Bool); -static void NewDeviceCallback(Widget, XtPointer, XtPointer); -static void DeviceDestroy(TreeNode*); -static void DeviceUpdate(TreeNode*); - -static void CreateScreen(TreeNode*, XF86ConfScreenPtr); -static void CreateScreenField(TreeNode*, Bool); -static void NewScreenCallback(Widget, XtPointer, XtPointer); -static void ScreenDestroy(TreeNode*); -static void ScreenUpdate(TreeNode*); -static void CreateScreenAdaptor(TreeNode*, XF86ConfAdaptorLinkPtr); -static void CreateScreenAdaptorField(TreeNode*, Bool); -static void NewScreenAdaptorCallback(Widget, XtPointer, XtPointer); -static void ScreenAdaptorDestroy(TreeNode*); -static void CreateScreenDisplay(TreeNode*, XF86ConfDisplayPtr); -static void CreateScreenDisplayField(TreeNode*, Bool); -static void NewScreenDisplayCallback(Widget, XtPointer, XtPointer); -static void ScreenDisplayDestroy(TreeNode*); -static void ScreenDisplayUpdate(TreeNode*); -static void CreateDisplayMode(TreeNode*, XF86ModePtr); -static void CreateDisplayModeField(TreeNode*, Bool); -static void NewDisplayModeCallback(Widget, XtPointer, XtPointer); -static void DisplayModeDestroy(TreeNode*); - -static void CreateInput(TreeNode*, XF86ConfInputPtr); -static void CreateInputField(TreeNode*, Bool); -static void InputDestroy(TreeNode*); -static void NewInputCallback(Widget, XtPointer, XtPointer); -static void InputUpdate(TreeNode*); - -static void CreateLayout(TreeNode*, XF86ConfLayoutPtr); -static void CreateLayoutField(TreeNode*, Bool); -static void LayoutDestroy(TreeNode*); -static void NewLayoutCallback(Widget, XtPointer, XtPointer); -static void CreateAdjacency(TreeNode*, XF86ConfAdjacencyPtr); -static void CreateAdjacencyField(TreeNode*, Bool); -static void AdjacencyDestroy(TreeNode*); -static void NewAdjacencyCallback(Widget, XtPointer, XtPointer); -static void AdjacencyMenuCallback(Widget, XtPointer, XtPointer); -static void AdjacencyToggleCallback(Widget, XtPointer, XtPointer); -static void CreateInputref(TreeNode*, XF86ConfInputrefPtr); -static void CreateInputrefField(TreeNode*, Bool); -static void InputrefDestroy(TreeNode*); -static void NewInputrefCallback(Widget, XtPointer, XtPointer); - -static void CreateVendor(TreeNode*, XF86ConfVendorPtr); -static void CreateVendorField(TreeNode*, Bool); -static void VendorDestroy(TreeNode*); -static void NewVendorCallback(Widget, XtPointer, XtPointer); -static void CreateVendorSub(TreeNode*, XF86ConfVendSubPtr); -static void CreateVendorSubField(TreeNode*, Bool); -static void NewVendorSubCallback(Widget, XtPointer, XtPointer); -static void VendorSubDestroy(TreeNode*); -static void VendorSubUpdate(TreeNode*); - -static void CreateDRI(TreeNode*, XF86ConfDRIPtr); -static void CreateDRIField(TreeNode*); -static void DRIUpdate(TreeNode*); - -static void CreateBuffers(TreeNode*, XF86ConfBuffersPtr); -static void CreateBuffersField(TreeNode*, Bool); -static void BuffersDestroy(TreeNode*); -static void NewBuffersCallback(Widget, XtPointer, XtPointer); -static void BuffersUpdate(TreeNode*); - -extern void RemoveDeviceCallback(Widget, XtPointer, XtPointer); - -/* interface.c */ -extern void InitializeDevices(void); -extern void SelectLayoutCallback(Widget, XtPointer, XtPointer); -extern void UpdateMenuDeviceList(int); -extern void SetConfigModeCallback(Widget, XtPointer, XtPointer); -extern void DefaultLayoutCallback(Widget, XtPointer, XtPointer); -extern void RemoveLayoutCallback(Widget, XtPointer, XtPointer); - -/* - * Initialization - */ -static Widget shell, expert, tree, panner; -extern Widget work, optionsShell, config, layoutp, topMenu; -extern xf86cfgDevice cpu_device; -static TreeNode *mainNode, *monitorTree, *screenTree, *layoutTree; - -/* - * Implementation - */ -void -ExpertConfigureStart(void) -{ - ExpertInitialize(); - - XtPopup(shell, XtGrabExclusive); - if (optionsShell == NULL) - CreateOptionsShell(); - XtVaSetValues(optionsShell, XtNtransientFor, shell, NULL); -} - -void -ExpertConfigureEnd(void) -{ - int i, save_config_mode = config_mode; - Widget sme, layopt, layoutsme = NULL; - XF86ConfLayoutPtr lay; - - XtVaSetValues(optionsShell, XtNtransientFor, toplevel, NULL); - XtPopdown(shell); - - /* Need to do this to avoid all code elsewhere needing to update the - * "expert" widget tree - */ - UpdateConfig(mainNode); - DestroyTree(mainNode); - XtDestroyWidget(shell); - expert = NULL; - - if (save_config_mode != CONFIG_LAYOUT) - SetConfigModeCallback(topMenu, (XtPointer)CONFIG_LAYOUT, NULL); - - /* Reset everything as the "expert" interface can do almost anything - * to the configuration. - */ - for (i = 0; i < computer.num_screens; i++) { - XtDestroyWidget(computer.screens[i]->widget); - XtFree((XtPointer)computer.screens[i]); - } - XtFree((XtPointer)computer.screens); - computer.screens = NULL; - computer.num_screens = 0; - - for (i = 0; i < computer.num_devices; i++) { - XtDestroyWidget(computer.devices[i]->widget); - XtFree((XtPointer)computer.devices[i]); - } - XtFree((XtPointer)computer.devices); - computer.devices = NULL; - computer.num_devices = 0; - - for (i = 0; i < computer.num_layouts; i++) { - XtFree((XtPointer)computer.layouts[i]->position); - XtFree((XtPointer)computer.layouts[i]); - } - XtFree((XtPointer)computer.layouts); - computer.layouts = NULL; - computer.num_layouts = 0; - - for (i = 0; i < computer.num_vidmodes; i++) - XtFree((XtPointer)computer.vidmodes[i]); - XtFree((XtPointer)computer.vidmodes); - computer.vidmodes = NULL; - computer.num_vidmodes = 0; - - /* Reinitialize devices/screens */ - InitializeDevices(); - UpdateMenuDeviceList(MOUSE); - UpdateMenuDeviceList(KEYBOARD); - UpdateMenuDeviceList(CARD); - UpdateMenuDeviceList(MONITOR); - - /* Update layout menu */ - /* first entry is "New server layout" */ - for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++) - XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]); - for (i = 0; i < layoutp->core.num_popups; i++) - XtDestroyWidget(layoutp->core.popup_list[i]); - lay = XF86Config->conf_layout_lst; - while (lay != NULL) { - sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, - layoutp, - XtNlabel, lay->lay_identifier, - XtNmenuName, lay->lay_identifier, - XtNleftBitmap, menuPixmap, - NULL); - XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); - if (layoutsme == NULL) - layoutsme = sme; - layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, - layoutp, NULL, 0); - sme = XtCreateManagedWidget("default", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); - sme = XtCreateManagedWidget("remove", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); - XtRealizeWidget(layopt); - - lay = (XF86ConfLayoutPtr)(lay->list.next); - } - computer.layout = NULL; - SelectLayoutCallback(layoutsme, - XF86Config->conf_layout_lst, NULL); - - - if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst) - SetTip(&cpu_device); - for (i = 0; i < computer.num_devices; i++) - SetTip(computer.devices[i]); - - /* Reinitialize vidmodes */ - InitializeVidmodes(); - - if (save_config_mode != CONFIG_LAYOUT) - SetConfigModeCallback(topMenu, (XtPointer)(long)save_config_mode, NULL); -} - -/*ARGSUSED*/ -void -ExpertCloseAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - ExpertConfigureEnd(); -} - -/*ARGSUSED*/ -void -ExpertCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - ExpertConfigureStart(); -} - -/*ARGSUSED*/ -static void -PopdownCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - ExpertConfigureEnd(); -} - -/* Files */ -static void -CreateFiles(TreeNode *files) -{ - XF86ConfFilesPtr file = XF86Config->conf_files; - TreeNode *node, *fontpath, *modulepath; - Widget w; - char *value; - - value = (file && file->file_logfile) ? file->file_logfile : ""; - node = NewNode(files, NULL, NULL, files->node, - (TreeData*)XtCalloc(1, sizeof(TreeData))); - CreateFilesField(node, "LogFile", value); - files->child = node; - files->update = UpdateFiles; - - w = XtVaCreateManagedWidget("ModulePath", toggleWidgetClass, tree, - XtNtreeParent, files->node, NULL); - node->next = modulepath = NewNode(files, w, w, files->node, NULL); - node = node->next; - CreateModulePath(modulepath, NULL); - - w = XtVaCreateManagedWidget("FontPath", toggleWidgetClass, tree, - XtNtreeParent, files->node, NULL); - node->next = fontpath = NewNode(files, w, w, files->node, NULL); - node = node->next; - CreateFontPath(fontpath, NULL); -} - -static void -CreateFilesField(TreeNode *node, char *name, char *value) -{ - Widget box, text; - - box = XtVaCreateManagedWidget(name, boxWidgetClass, tree, - XtNtreeParent, node->node, NULL); - node->node = box; - (void) XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, name, NULL); - text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, value, - NULL); - node->data->files.text = text; -} - -static void -UpdateFiles(TreeNode *files) -{ - char *str; - - /* LogFile */ - files = files->child; - XtVaGetValues(files->data->files.text, XtNstring, &str, NULL); - if (XF86Config->conf_files && XF86Config->conf_files->file_logfile) - XtFree(XF86Config->conf_files->file_logfile); - if (*str) { - if (XF86Config->conf_files == NULL) - XF86Config->conf_files = XtCalloc(1, sizeof(XF86ConfFilesRec)); - XF86Config->conf_files->file_logfile = XtNewString(str); - } - else if (XF86Config->conf_files) - XF86Config->conf_files->file_logfile = NULL; -} - -/* FontPath */ -/* Don't need to set the update tree field, as it is already set - * as the destroy field */ -static void -CreateFontPath(TreeNode *fontpath, char *path) -{ - TreeNode *prev = NULL, *node; - - if (path == NULL) { - if (XF86Font_path) { - path = XtNewString(XF86Font_path); - if (XF86Config->conf_files && XF86Config->conf_files->file_fontpath) - XtFree(XF86Config->conf_files->file_fontpath); - if (XF86Config->conf_files == NULL) - XF86Config->conf_files = XtCalloc(1, sizeof(XF86ConfFilesRec)); - XF86Config->conf_files->file_fontpath = XtNewString(path); - } - else if (XF86Config->conf_files && XF86Config->conf_files->file_fontpath) - path = XtNewString(XF86Config->conf_files->file_fontpath); - } - else { - path = XtNewString(path); - if ((prev = fontpath->child) != NULL) - while (prev->next) - prev = prev->next; - } - - if (path) { - char *s; - - for (s = strtok(path, ","); s != NULL; s = strtok(NULL, ",")) { - node = NewNode(fontpath, NULL, NULL, fontpath->node, NULL); - node->destroy = FontPathChanged; - (void) CreateFontPathField(node, s, False); - if (fontpath->child == NULL) - fontpath->child = node; - else - prev->next = node; - prev = node; - } - XtFree(path); - } - - node = NewNode(fontpath, NULL, NULL, fontpath->node, NULL); - (void) CreateFontPathField(node, "", True); - if (fontpath->child == NULL) - fontpath->child = node; - else - prev->next = node; -} - -static Widget -CreateFontPathField(TreeNode *fontpath, char *value, Bool addnew) -{ - Widget box, command, text; - TreeData *data; - - box = XtVaCreateWidget("fontpath", formWidgetClass, tree, - XtNtreeParent, fontpath->treeParent, NULL); - fontpath->node = box; - if (!addnew) { - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, - (XtPointer)fontpath); - command = XtCreateManagedWidget("up", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, FontPathCallback, - (XtPointer)fontpath); - command = XtCreateManagedWidget("down", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, FontPathCallback, - (XtPointer)fontpath); - text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, value, NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, NewFontPathCallback, - (XtPointer)fontpath); - text = XtVaCreateManagedWidget("valueNew", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, value, NULL); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->files.text = text; - fontpath->data = data; - - if (fontpath->treeParent && XtIsRealized(fontpath->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); - - return (box); -} - -static void -FontPathChanged(TreeNode *node) -{ - TreeNode *parent = node->parent; - char *fontpath = NULL, *str; - Arg args[1]; - int pos = 0, len; - - /* last node is the "new" */ - for (node = parent->child; node->next != NULL; node = node->next) { - if (pos) - fontpath[pos++] = ','; - XtSetArg(args[0], XtNstring, &str); - XtGetValues(node->data->files.text, args, 1); - len = strlen(str) + 2; - fontpath = XtRealloc(fontpath, pos + len); - strcpy(fontpath + pos, str); - pos += len - 2; - } - - if (XF86Config->conf_files) { - if (XF86Config->conf_files->file_fontpath) - XtFree(XF86Config->conf_files->file_fontpath); - } - else if (fontpath) - XF86Config->conf_files = XtCalloc(1, sizeof(XF86ConfFilesRec)); - if (XF86Config->conf_files) - XF86Config->conf_files->file_fontpath = fontpath; -} - -static void -NewFontPathCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *fontpath, *node = (TreeNode*)user_data; - Arg args[1]; - char *str; - - XtSetArg(args[0], XtNstring, &str); - XtGetValues(node->data->files.text, args, 1); - if (*str == '\0') - return; - - fontpath = node->parent; - DeleteNode(node); - CreateFontPath(fontpath, str); - - FontPathChanged(fontpath->child); - RelayoutTree(); -} - -/*ARGSUSED*/ -static void -FontPathCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node, *fontpath = (TreeNode*)user_data; - char *t1, *t2; - Widget w1, w2; - - parent = fontpath->parent; - node = parent->child; - if (!node->next->next) - return; - if (strcmp(XtName(w), "up") == 0) { - if (node == fontpath) - while (node->next->next) - node = node->next; - else - while (node && node->next != fontpath) - node = node->next; - } - else { - if (fontpath->next->next) - node = fontpath->next; - /* else is already correct */ - } - - w1 = node->data->files.text; - w2 = fontpath->data->files.text; - - XtVaGetValues(w1, XtNstring, &t1, NULL); - XtVaGetValues(w2, XtNstring, &t2, NULL); - t1 = XtNewString(t1); - XtVaSetValues(w1, XtNstring, t2, NULL); - XtVaSetValues(w2, XtNstring, t1, NULL); - XtFree(t1); -} - - -/* ModulePath */ -/* Don't need to set the update tree field, as it is already set - * as the destroy field */ -static void -CreateModulePath(TreeNode *modulepath, char *path) -{ - TreeNode *prev = NULL, *node; - - if (path == NULL) { - if (XF86Module_path) { - path = XtNewString(XF86Module_path); - if (XF86Config->conf_files == NULL) - XF86Config->conf_files = XtCalloc(1, sizeof(XF86ConfFilesRec)); - else if (XF86Config->conf_files->file_modulepath) - XtFree(XF86Config->conf_files->file_modulepath); - XF86Config->conf_files->file_modulepath = XtNewString(path); - } - else if (XF86Config->conf_files && XF86Config->conf_files->file_modulepath) - path = XtNewString(XF86Config->conf_files->file_modulepath); - } - else { - path = XtNewString(path); - if ((prev = modulepath->child) != NULL) - while (prev->next) - prev = prev->next; - } - - if (path) { - char *s; - - for (s = strtok(path, ","); s != NULL; s = strtok(NULL, ",")) { - node = NewNode(modulepath, NULL, NULL, modulepath->node, NULL); - node->destroy = ModulePathChanged; - (void) CreateModulePathField(node, s, False); - if (modulepath->child == NULL) - modulepath->child = node; - else - prev->next = node; - prev = node; - } - XtFree(path); - } - - node = NewNode(modulepath, NULL, NULL, modulepath->node, NULL); - (void) CreateModulePathField(node, "", True); - if (modulepath->child == NULL) - modulepath->child = node; - else - prev->next = node; -} - -static Widget -CreateModulePathField(TreeNode *modulepath, char *value, Bool addnew) -{ - Widget box, command, text; - TreeData *data; - - box = XtVaCreateWidget("modulepath", formWidgetClass, tree, - XtNtreeParent, modulepath->treeParent, NULL); - modulepath->node = box; - if (!addnew) { - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, - (XtPointer)modulepath); - text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, value, NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, NewModulePathCallback, - (XtPointer)modulepath); - text = XtVaCreateManagedWidget("valueNew", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, value, NULL); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->files.text = text; - modulepath->data = data; - - if (modulepath->treeParent && XtIsRealized(modulepath->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); - - return (box); -} - -static void -ModulePathChanged(TreeNode *node) -{ - TreeNode *parent = node->parent; - char *modulepath = NULL, *str; - Arg args[1]; - int pos = 0, len; - - /* last node is the "new" */ - for (node = parent->child; node->next != NULL; node = node->next) { - if (pos) - modulepath[pos++] = ','; - XtSetArg(args[0], XtNstring, &str); - XtGetValues(node->data->files.text, args, 1); - len = strlen(str) + 2; - modulepath = XtRealloc(modulepath, pos + len); - strcpy(modulepath + pos, str); - pos += len - 2; - } - - if (XF86Config->conf_files) { - if (XF86Config->conf_files->file_modulepath) - XtFree(XF86Config->conf_files->file_modulepath); - } - else if (modulepath) - XF86Config->conf_files = XtCalloc(1, sizeof(XF86ConfFilesRec)); - if (XF86Config->conf_files) - XF86Config->conf_files->file_modulepath = modulepath; -} - -static void -NewModulePathCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *modulepath, *node = (TreeNode*)user_data; - Arg args[1]; - char *str; - - XtSetArg(args[0], XtNstring, &str); - XtGetValues(node->data->files.text, args, 1); - if (*str == '\0') - return; - - modulepath = node->parent; - DeleteNode(node); - CreateModulePath(modulepath, str); - - ModulePathChanged(modulepath->child); - RelayoutTree(); -} - -/* Module */ -static void -CreateModule(TreeNode *module, XF86LoadPtr load) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = module->child) != NULL) - while (prev->next) - prev = prev->next; - - while (load) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->module.load = load; - node = NewNode(module, NULL, NULL, module->node, data); - node->destroy = ModuleDestroy; - CreateModuleField(node, False); - if (module->child == NULL) - module->child = node; - else - prev->next = node; - prev = node; - load = (XF86LoadPtr)(load->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(module, NULL, NULL, module->node, data); - CreateModuleField(node, True); - if (module->child == NULL) - module->child = node; - else - prev->next = node; -} - -static void -CreateModuleField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("module", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86OptionPtr *options; - XF86LoadPtr load = node->data->module.load; - - options = &(load->load_opt); - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - label = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, load->load_name, NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewModuleCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->module.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -ModuleDestroy(TreeNode *node) -{ - if (node->data->module.load) - xf86removeModule(XF86Config, node->data->module.load); -} - -/*ARGSUSED*/ -static void -NewModuleCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *module, *node = (TreeNode*)user_data; - XF86LoadPtr load; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->module.text, args, 1); - if (*label == '\0') - return; - - module = node->parent; - DeleteNode(node); - load = (XF86LoadPtr)XtCalloc(1, sizeof(XF86LoadRec)); - load->load_name = XtNewString(label); - if (XF86Config->conf_modules == NULL) - XF86Config->conf_modules = XtCalloc(1, sizeof(XF86ConfModuleRec)); - XF86Config->conf_modules->mod_load_lst = - xf86addModule(XF86Config->conf_modules->mod_load_lst, load); - - CreateModule(module, load); - RelayoutTree(); -} - -/* Modes */ -static void -CreateModes(TreeNode *parent, XF86ConfModesPtr modes) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (modes) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->modes.modes = modes; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = ModesDestroy; - CreateModesField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - - modes = (XF86ConfModesPtr)(modes->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateModesField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateModesField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("modes", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86ConfModesPtr modes = node->data->modes.modes; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("mode", toggleWidgetClass, box, - XtNlabel, modes->modes_identifier, - XtNstate, True, - NULL); - node->toggle = label; - XtAddCallback(label, XtNcallback, ToggleCallback, (XtPointer)node); - CreateModesModeLine(node, node->data->modes.modes->mon_modeline_lst); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewModesCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->modes.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -ModesDestroy(TreeNode *node) -{ - if (node->data->modes.modes) { - int i; - TreeNode *mon = monitorTree->child; - - /* last one is the "new" entry */ - while (mon && mon->next) { - /* UseModes is the second entry */ - TreeNode *mod = mon->child->next->child; - CompositeWidget composite; - - while (mod && mod->next) { - TreeNode *next = mod->next; - - if (mod && strcmp(mod->data->modeslink.modeslink->ml_modes_str, - node->data->modes.modes->modes_identifier) == 0) - /* Needs to do string comparison because may be deleting - * a "test" Modes section, with no Modelines. - */ - DeleteNode(mod); - mod = next; - } - composite = (CompositeWidget)mod->data->modeslink.menu; - - for (i = 0; i < composite->composite.num_children; ++i) - if (strcmp(XtName(composite->composite.children[i]), - node->data->modes.modes->modes_identifier) == 0) - XtDestroyWidget(composite->composite.children[i]); - - mon = mon->next; - } - - xf86removeModes(XF86Config, node->data->modes.modes); - } -} - -/*ARGSUSED*/ -static void -NewModesCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfModesPtr modes; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->modes.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - modes = (XF86ConfModesPtr)XtCalloc(1, sizeof(XF86ConfModesRec)); - modes->modes_identifier = XtNewString(label); - XF86Config->conf_modes_lst = - xf86addModes(XF86Config->conf_modes_lst, modes); - - { - TreeNode *mon = monitorTree->child; - Widget sme; - - /* last one is the "new" entry */ - while (mon && mon->next) { - /* UseModes is the second entry */ - TreeNode *mod = mon->child->next->child; - - while (mod && mod->next) - mod = mod->next; - - sme = XtCreateManagedWidget(modes->modes_identifier, - smeBSBObjectClass, - mod->data->modeslink.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, NewMonitorModesCallback, - (XtPointer)mod); - - mon = mon->next; - } - } - - CreateModes(parent, modes); - RelayoutTree(); -} - -static void -CreateModesModeLine(TreeNode *parent, XF86ConfModeLinePtr modeline) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (modeline) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->modeline.modeline = modeline; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = ModesModeLineDestroy; - CreateModeLineField(node, False, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - modeline = (XF86ConfModeLinePtr)(modeline->list.next); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - CreateModeLineField(node, True, False); -} - -/* This function should allow creating modelines for the - Mode and Monitor section */ -static void -CreateModeLineField(TreeNode *node, Bool addnew, Bool monitor) -{ - Widget box, command; - char buf[512], tmp[32]; - - box = XtVaCreateWidget("modeline", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86ConfModeLinePtr mod = node->data->modeline.modeline; - - command = XtCreateManagedWidget("remove", commandWidgetClass, - box, NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, mod->ml_identifier, NULL); - - XmuSnprintf(buf, sizeof(buf), "%g %d %d %d %d %d %d %d %d", - mod->ml_clock / 1000., mod->ml_hdisplay, mod->ml_hsyncstart, - mod->ml_hsyncend, mod->ml_htotal, mod->ml_vdisplay, - mod->ml_vsyncstart, mod->ml_vsyncend, mod->ml_vtotal); - if (mod->ml_flags & XF86CONF_INTERLACE) - strcat(buf, " interlace"); - if (mod->ml_flags & XF86CONF_PHSYNC) - strcat(buf, " +hsync"); - if (mod->ml_flags & XF86CONF_NHSYNC) - strcat(buf, " -hsync"); - if (mod->ml_flags & XF86CONF_PVSYNC) - strcat(buf, " +vsync"); - if (mod->ml_flags & XF86CONF_NVSYNC) - strcat(buf, " -vsync"); - if (mod->ml_flags & XF86CONF_CSYNC) - strcat(buf, " composite"); - if (mod->ml_flags & XF86CONF_PCSYNC) - strcat(buf, " +csync"); - if (mod->ml_flags & XF86CONF_NCSYNC) - strcat(buf, " -csync"); - if (mod->ml_flags & XF86CONF_DBLSCAN) - strcat(buf, " doublescan"); - if (mod->ml_flags & XF86CONF_BCAST) - strcat(buf, " bcast"); - if (mod->ml_flags & XF86CONF_HSKEW) { - XmuSnprintf(tmp, sizeof(tmp), " hskew %d", mod->ml_hskew); - strcat(buf, tmp); - } - if (mod->ml_flags & XF86CONF_VSCAN) { - XmuSnprintf(tmp, sizeof(tmp), " vscan %d", mod->ml_vscan); - strcat(buf, tmp); - } - if (mod->ml_flags & XF86CONF_CUSTOM) - strcat(buf, " custom"); - node->data->modeline.value = - XtVaCreateManagedWidget("modeline", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - } - else { - *buf = '\0'; - command = XtCreateManagedWidget("new", commandWidgetClass, - box, NULL, 0); - XtAddCallback(command, XtNcallback, monitor ? - NewMonitorModeLineCallback : NewModesModeLineCallback, - (XtPointer)node); - node->data->modeline.text = - XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, NULL); - node->data->modeline.value = - XtVaCreateManagedWidget("modelineNew", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, NULL); - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -ModesModeLineDestroy(TreeNode *node) -{ - if (node->data->modeline.modeline) - xf86removeModesModeLine(node->parent->data->modes.modes, - node->data->modeline.modeline); -} - -/*ARGSUSED*/ -static void -NewModesModeLineCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfModeLinePtr modeline; - Arg args[1]; - char *ident, *value; - - XtSetArg(args[0], XtNstring, &ident); - XtGetValues(node->data->modeline.text, args, 1); - XtSetArg(args[0], XtNstring, &value); - XtGetValues(node->data->modeline.value, args, 1); - if (*ident == '\0' || *value == '\0') - return; - - parent = node->parent; - DeleteNode(node); - modeline = ParseModeLine(ident, value); - parent->data->modes.modes->mon_modeline_lst = - xf86addModeLine(parent->data->modes.modes->mon_modeline_lst, modeline); - - CreateModesModeLine(parent, modeline); - RelayoutTree(); -} - -static XF86ConfModeLinePtr -ParseModeLine(char *identifier, char *modeline) -{ - XF86ConfModeLinePtr ml = (XF86ConfModeLinePtr) - XtCalloc(1, sizeof(XF86ConfModeLineRec)); - char *s, *ptr = modeline; - - /* Identifier */ - ml->ml_identifier = XtNewString(identifier); - - ml->ml_clock = (int)(strtod(ptr, &ptr) * 1000.0 + 0.5); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_hdisplay = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_hsyncstart = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_hsyncend = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_htotal = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_vdisplay = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_vsyncstart = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_vsyncend = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - ml->ml_vtotal = strtol(ptr, &ptr, 10); - while (*ptr && isspace(*ptr)) ++ptr; - - s = ptr; - while (*s) { - *s = tolower(*s); - ++s; - } - s = ptr; - - while (*ptr) { - while (*s && isspace(*s)) - s++; - ptr = s; - while (*s && !isspace(*s)) - s++; - - if (s != ptr) { - Bool done = *s == '\0'; - - *s = '\0'; - if (strcmp(ptr, "interlace") == 0) - ml->ml_flags |= XF86CONF_INTERLACE; - else if (strcmp(ptr, "+hsync") == 0) - ml->ml_flags |= XF86CONF_PHSYNC; - else if (strcmp(ptr, "-hsync") == 0) - ml->ml_flags |= XF86CONF_NHSYNC; - else if (strcmp(ptr, "+vsync") == 0) - ml->ml_flags |= XF86CONF_PVSYNC; - else if (strcmp(ptr, "-vsync") == 0) - ml->ml_flags |= XF86CONF_NVSYNC; - else if (strcmp(ptr, "composite") == 0) - ml->ml_flags |= XF86CONF_CSYNC; - else if (strcmp(ptr, "+csync") == 0) - ml->ml_flags |= XF86CONF_PCSYNC; - else if (strcmp(ptr, "-csync") == 0) - ml->ml_flags |= XF86CONF_NCSYNC; - else if (strcmp(ptr, "doublescan") == 0) - ml->ml_flags |= XF86CONF_DBLSCAN; - else if (strcmp(ptr, "bcast") == 0) - ml->ml_flags |= XF86CONF_BCAST; - else if (strcmp(ptr, "hskew") == 0) { - ++s; - while (*s && isspace(*s)) - ++s; - ptr = s; - while (*s && !isspace(*s)) - ++s; - if (ptr != s) { - ml->ml_hskew = strtol(ptr, &s, 10); - ml->ml_flags |= XF86CONF_HSKEW; - --s; - } - } - else if (strcmp(ptr, "vscan") == 0) { - ++s; - while (*s && isspace(*s)) - ++s; - ptr = s; - while (*s && !isspace(*s)) - ++s; - if (ptr != s) { - ml->ml_vscan = strtol(ptr, &s, 10); - ml->ml_flags |= XF86CONF_VSCAN; - --s; - } - } - else if (strcmp(ptr, "custom") == 0) - ml->ml_flags |= XF86CONF_CUSTOM; - ++s; - if (done) - break; - ptr = s; - } - } - - return (ml); -} - -/* VideoAdpator */ -static void -CreateVideoAdaptor(TreeNode *parent, XF86ConfVideoAdaptorPtr video) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (video) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->video.video = video; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = VideoAdaptorDestroy; - node->update = VideoAdaptorUpdate; - CreateVideoAdaptorField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - - video = (XF86ConfVideoAdaptorPtr)(video->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateVideoAdaptorField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateVideoAdaptorField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("video", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - char *str; - TreeNode *port; - XF86ConfVideoAdaptorPtr video = node->data->video.video; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, - (XtPointer)&(video->va_option_lst)); - label = XtVaCreateManagedWidget("adaptor", labelWidgetClass, box, - XtNlabel, video->va_identifier, - NULL); - - XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0); - str = video->va_vendor ? video->va_vendor : ""; - node->data->video.vendor = - XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("boardL", labelWidgetClass, box, NULL, 0); - str = video->va_board ? video->va_board : ""; - node->data->video.board = - XtVaCreateManagedWidget("board", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("busidL", labelWidgetClass, box, NULL, 0); - str = video->va_busid ? video->va_busid : ""; - node->data->video.busid = - XtVaCreateManagedWidget("busid", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0); - str = video->va_driver ? video->va_driver : ""; - node->data->video.driver = - XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - label = XtVaCreateManagedWidget("VideoPort", toggleWidgetClass, tree, - XtNstate, True, - XtNtreeParent, box, - NULL); - port = NewNode(node, label, label, node->node, NULL); - node->child = port; - CreateVideoPort(port, video->va_port_lst); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewVideoAdaptorCallback, - (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->video.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -VideoAdaptorDestroy(TreeNode *node) -{ - if (node->data->video.video) { - int i; - TreeNode *scrn = screenTree->child; - - /* last one is the "new" entry */ - while (scrn && scrn->next) { - /* VideoAdator is the first entry */ - TreeNode *ad = scrn->child->child; - CompositeWidget composite; - - while (ad && ad->next) { - TreeNode *next = ad->next; - - if (ad && strcmp(ad->data->adaptorlink.adaptorlink->al_adaptor_str, - node->data->video.video->va_identifier) == 0) - DeleteNode(ad); - ad = next; - } - composite = (CompositeWidget)ad->data->adaptorlink.menu; - - for (i = 0; i < composite->composite.num_children; ++i) - if (strcmp(XtName(composite->composite.children[i]), - node->data->video.video->va_identifier) == 0) - XtDestroyWidget(composite->composite.children[i]); - - scrn = scrn->next; - } - - xf86removeVideoAdaptor(XF86Config, node->data->video.video); - } -} - -/*ARGSUSED*/ -static void -NewVideoAdaptorCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfVideoAdaptorPtr video; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->video.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - video = (XF86ConfVideoAdaptorPtr) - XtCalloc(1, sizeof(XF86ConfVideoAdaptorRec)); - video->va_identifier = XtNewString(label); - XF86Config->conf_videoadaptor_lst = - xf86addVideoAdaptor(XF86Config->conf_videoadaptor_lst, video); - - { - TreeNode *scrn = screenTree->child; - Widget sme; - - /* last one is the "new" entry */ - while (scrn && scrn->next) { - /* VideoAdaptor is the first entry */ - TreeNode *ad = scrn->child->child; - - while (ad && ad->next) - ad = ad->next; - - sme = XtCreateManagedWidget(video->va_identifier, - smeBSBObjectClass, - ad->data->adaptorlink.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, NewScreenAdaptorCallback, - (XtPointer)ad); - - scrn = scrn->next; - } - } - - CreateVideoAdaptor(parent, video); - RelayoutTree(); -} - -static void -VideoAdaptorUpdate(TreeNode *node) -{ - char *str; - - /* vendor */ - XtVaGetValues(node->data->video.vendor, XtNstring, &str, NULL); - XtFree(node->data->video.video->va_vendor); - if (*str) - node->data->video.video->va_vendor = XtNewString(str); - else - node->data->video.video->va_vendor = NULL; - - /* board */ - XtVaGetValues(node->data->video.board, XtNstring, &str, NULL); - XtFree(node->data->video.video->va_board); - if (*str) - node->data->video.video->va_board = XtNewString(str); - else - node->data->video.video->va_board = NULL; - - /* busid */ - XtVaGetValues(node->data->video.busid, XtNstring, &str, NULL); - XtFree(node->data->video.video->va_busid); - if (*str) - node->data->video.video->va_busid = XtNewString(str); - else - node->data->video.video->va_busid = NULL; - - /* driver */ - XtVaGetValues(node->data->video.driver, XtNstring, &str, NULL); - XtFree(node->data->video.video->va_driver); - if (*str) - node->data->video.video->va_driver = XtNewString(str); - else - node->data->video.video->va_driver = NULL; -} - -static void -CreateVideoPort(TreeNode *parent, XF86ConfVideoPortPtr port) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (port) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->port.port = port; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = VideoPortDestroy; - CreateVideoPortField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - port = (XF86ConfVideoPortPtr)(port->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateVideoPortField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateVideoPortField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("port", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86OptionPtr *options; - XF86ConfVideoPortPtr port = node->data->port.port; - - options = &(port->vp_option_lst); - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - label = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, port->vp_identifier, NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewVideoPortCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->port.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -VideoPortDestroy(TreeNode *node) -{ - if (node->data->port.port) - xf86removeVideoPort(node->parent->parent->data->video.video, - node->data->port.port); -} - -/*ARGSUSED*/ -static void -NewVideoPortCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *video, *node = (TreeNode*)user_data; - XF86ConfVideoPortPtr port; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->port.text, args, 1); - if (*label == '\0') - return; - - video = node->parent->parent; - DeleteNode(node); - port = (XF86ConfVideoPortPtr)XtCalloc(1, sizeof(XF86ConfVideoPortRec)); - port->vp_identifier = XtNewString(label); - video->data->video.video->va_port_lst = - xf86addVideoPort(video->data->video.video->va_port_lst, port); - - CreateVideoPort(video, port); - RelayoutTree(); -} - -/* Monitor */ -static void -CreateMonitor(TreeNode *parent, XF86ConfMonitorPtr mon) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (mon) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->monitor.monitor = mon; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = MonitorDestroy; - node->update = MonitorUpdate; - CreateMonitorField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - mon = (XF86ConfMonitorPtr)(mon->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateMonitorField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateMonitorField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("monitor", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - char *str, buf[256]; - XF86OptionPtr *options; - XF86ConfMonitorPtr mon = node->data->monitor.monitor; - Widget useModes; - TreeNode *modeline, *modes, *prev; - - options = &(mon->mon_option_lst); - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - label = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, mon->mon_identifier, NULL); - - XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0); - str = mon->mon_vendor ? mon->mon_vendor : ""; - node->data->monitor.vendor = - XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("modelnameL", labelWidgetClass, box, NULL, 0); - str = mon->mon_modelname ? mon->mon_modelname : ""; - node->data->monitor.model = - XtVaCreateManagedWidget("modelname", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("widthL", labelWidgetClass, box, NULL, 0); - if (mon->mon_width) - XmuSnprintf(buf, sizeof(buf), "%d", mon->mon_width); - else - *buf = '\0'; - node->data->monitor.width = - XtVaCreateManagedWidget("width", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("heightL", labelWidgetClass, box, NULL, 0); - if (mon->mon_height) - XmuSnprintf(buf, sizeof(buf), "%d", mon->mon_height); - else - *buf = '\0'; - node->data->monitor.height = - XtVaCreateManagedWidget("height", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("hsyncL", labelWidgetClass, box, NULL, 0); - if (mon->mon_n_hsync > 0) - parser_range_to_string(buf, &(mon->mon_hsync[0]), - mon->mon_n_hsync); - else - *buf = '\0'; - node->data->monitor.hsync = - XtVaCreateManagedWidget("hsync", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("vrefreshL", labelWidgetClass, box, NULL, 0); - if (mon->mon_n_vrefresh > 0) - parser_range_to_string(buf, &(mon->mon_vrefresh[0]), - mon->mon_n_vrefresh); - else - *buf = '\0'; - node->data->monitor.vrefresh = - XtVaCreateManagedWidget("vrefresh", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("gammaRedL", labelWidgetClass, box, NULL, 0); - if (mon->mon_gamma_red) - XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_red); - else - *buf = '\0'; - node->data->monitor.gammaRed = - XtVaCreateManagedWidget("gammaRed", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("gammaGreenL", labelWidgetClass, box, NULL, 0); - if (mon->mon_gamma_green) - XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_green); - else - *buf = '\0'; - node->data->monitor.gammaGreen = - XtVaCreateManagedWidget("gammaGreen", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("gammaBlueL", labelWidgetClass, box, NULL, 0); - if (mon->mon_gamma_blue) - XmuSnprintf(buf, sizeof(buf), "%g", mon->mon_gamma_blue); - else - *buf = '\0'; - node->data->monitor.gammaBlue = - XtVaCreateManagedWidget("gammaBlue", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - if ((prev = node->child) != NULL) - while (prev->next) - prev = prev->next; - command = XtVaCreateManagedWidget("ModeLine", toggleWidgetClass, tree, - XtNstate, True, - XtNtreeParent, box, NULL); - modeline = NewNode(node, command, command, node->node, NULL); - CreateMonitorModeLine(modeline, - node->data->monitor.monitor->mon_modeline_lst); - if (prev == NULL) - prev = node->child = modeline; - else { - prev->next = modeline; - prev = prev->next; - } - - useModes = XtVaCreateManagedWidget("UseModes", toggleWidgetClass, tree, - XtNstate, True, - XtNtreeParent, box, NULL); - prev->next = modes = NewNode(node, useModes, useModes, node->node, NULL); - CreateMonitorModes(modes, - node->data->monitor.monitor->mon_modes_sect_lst); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewMonitorCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->monitor.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -MonitorDestroy(TreeNode *node) -{ - int i; - TreeNode *sc = screenTree; - - for (i = 0; i < computer.num_devices; i++) - if ((XF86ConfMonitorPtr)(computer.devices[i]->config) == - node->data->monitor.monitor) { - config = computer.devices[i]->widget; - RemoveDeviceCallback(NULL, NULL, NULL); - } - - if (sc) { - TreeNode *prev; - - sc = prev = sc->child; - while (sc->next) { - TreeNode *next = sc->next; - - if (sc->data->screen.screen->scrn_monitor == - node->data->monitor.monitor) { - XtDestroyWidget(sc->node); - - if (sc->child) - DestroyTree(sc->child); - if (sc->data) - XtFree((XtPointer)sc->data); - XtFree((XtPointer)sc); - - if (sc == screenTree->child) - sc = prev = next = screenTree->child = next; - else - prev->next = sc = next; - continue; - } - prev = sc; - sc = next; - } - } -} - -static void -NewMonitorCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfMonitorPtr mon; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->monitor.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - mon = (XF86ConfMonitorPtr)XtCalloc(1, sizeof(XF86ConfMonitorRec)); - mon->mon_identifier = XtNewString(label); - XF86Config->conf_monitor_lst = - xf86addMonitor(XF86Config->conf_monitor_lst, mon); - - CreateMonitor(parent, mon); - - RelayoutTree(); -} - -static void -MonitorUpdate(TreeNode *node) -{ - char *str; - - /* vendor */ - XtVaGetValues(node->data->monitor.vendor, XtNstring, &str, NULL); - XtFree(node->data->monitor.monitor->mon_vendor); - if (*str) - node->data->monitor.monitor->mon_vendor = XtNewString(str); - else - node->data->monitor.monitor->mon_vendor = NULL; - - /* model */ - XtVaGetValues(node->data->monitor.model, XtNstring, &str, NULL); - XtFree(node->data->monitor.monitor->mon_modelname); - if (*str) - node->data->monitor.monitor->mon_modelname = XtNewString(str); - else - node->data->monitor.monitor->mon_modelname = NULL; - - /* width */ - XtVaGetValues(node->data->monitor.width, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_width = strtoul(str, NULL, 0); - - /* height */ - XtVaGetValues(node->data->monitor.height, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_height = strtoul(str, NULL, 0); - - /* hsync */ - XtVaGetValues(node->data->monitor.hsync, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_n_hsync = - string_to_parser_range(str, - &(node->data->monitor.monitor->mon_hsync[0]), - CONF_MAX_HSYNC); - - /* vrefresh */ - XtVaGetValues(node->data->monitor.vrefresh, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_n_vrefresh = - string_to_parser_range(str, - &(node->data->monitor.monitor->mon_vrefresh[0]), - CONF_MAX_VREFRESH); - - /* gammaRed */ - XtVaGetValues(node->data->monitor.gammaRed, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_gamma_red = strtod(str, NULL); - - /* gammaGreen */ - XtVaGetValues(node->data->monitor.gammaGreen, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_gamma_green = strtod(str, NULL); - - /* gammaBlue */ - XtVaGetValues(node->data->monitor.gammaBlue, XtNstring, &str, NULL); - node->data->monitor.monitor->mon_gamma_blue = strtod(str, NULL); -} - -static void -CreateMonitorModeLine(TreeNode *parent, XF86ConfModeLinePtr modeline) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (modeline) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->modeline.modeline = modeline; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = MonitorModeLineDestroy; - CreateModeLineField(node, False, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - modeline = (XF86ConfModeLinePtr)(modeline->list.next); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - CreateModeLineField(node, True, True); -} - -/*ARGUSED*/ -static void -MonitorModeLineDestroy(TreeNode *node) -{ - if (node->data->modeline.modeline) - xf86removeMonitorModeLine(node->parent->parent->data->monitor.monitor, - node->data->modeline.modeline); -} - -/*ARGSUSED*/ -static void -NewMonitorModeLineCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfModeLinePtr modeline; - Arg args[1]; - char *ident, *value; - - XtSetArg(args[0], XtNstring, &ident); - XtGetValues(node->data->modeline.text, args, 1); - XtSetArg(args[0], XtNstring, &value); - XtGetValues(node->data->modeline.value, args, 1); - if (*ident == '\0' || *value == '\0') - return; - - parent = node->parent; - DeleteNode(node); - modeline = ParseModeLine(ident, value); - parent->parent->data->monitor.monitor->mon_modeline_lst = - xf86addModeLine(parent->parent->data->monitor.monitor->mon_modeline_lst, - modeline); - - CreateMonitorModeLine(parent, modeline); - RelayoutTree(); -} - -static void -CreateMonitorModes(TreeNode *parent, XF86ConfModesLinkPtr lnk) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (lnk) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->modeslink.modeslink = lnk; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = MonitorModesLinkDestroy; - CreateMonitorModesField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - lnk = (XF86ConfModesLinkPtr)(lnk->list.next); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - CreateMonitorModesField(node, True); -} - -static void -CreateMonitorModesField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("modes", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86ConfModesLinkPtr lnk = node->data->modeslink.modeslink; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - (void) XtVaCreateManagedWidget("mode", labelWidgetClass, box, - XtNlabel, lnk->ml_modes_str, NULL); - } - else { - Widget sme; - XF86ConfModesPtr ptr = XF86Config->conf_modes_lst; - - command = XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, - XtNmenuName, "modesMenu", NULL); - node->data->modeslink.menu = - XtVaCreatePopupShell("modesMenu", simpleMenuWidgetClass, box, - XtNleftMargin, 1, XtNrightMargin, 1, - XtNtopMargin, 1, XtNbottomMargin, 1, - NULL); - while (ptr) { - sme = XtCreateManagedWidget(ptr->modes_identifier, smeBSBObjectClass, - node->data->modeslink.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, NewMonitorModesCallback, - (XtPointer)node); - ptr = (XF86ConfModesPtr)(ptr->list.next); - } - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -MonitorModesLinkDestroy(TreeNode *node) -{ - if (node->data->modeslink.modeslink) - xf86removeMonitorModesLink(node->parent->parent->data->monitor.monitor, - node->data->modeslink.modeslink); -} - -/*ARGSUSED*/ -static void -NewMonitorModesCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfModesLinkPtr link; - char *ident = XtName(w); - - parent = node->parent; - DeleteNode(node); - link = (XF86ConfModesLinkPtr)XtCalloc(1, sizeof(XF86ConfModesLinkRec)); - link->ml_modes_str = XtNewString(ident); - parent->parent->data->monitor.monitor->mon_modes_sect_lst = - xf86addModesLink(parent->parent->data->monitor.monitor->mon_modes_sect_lst, - link); - - CreateMonitorModes(parent, link); - RelayoutTree(); -} - -/* Device */ -static void -CreateDevice(TreeNode *parent, XF86ConfDevicePtr dev) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (dev) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->device.device = dev; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = DeviceDestroy; - node->update = DeviceUpdate; - CreateDeviceField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - dev = (XF86ConfDevicePtr)(dev->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateDeviceField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateDeviceField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("device", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - int i, tmp, len; - char buf[1024], *str; - XF86OptionPtr *options; - XF86ConfDevicePtr dev = node->data->device.device; - - options = &(dev->dev_option_lst); - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - label = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, dev->dev_identifier, NULL); - - XtCreateManagedWidget("vendorL", labelWidgetClass, box, NULL, 0); - str = dev->dev_vendor ? dev->dev_vendor : ""; - node->data->device.vendor = - XtVaCreateManagedWidget("vendor", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("boardL", labelWidgetClass, box, NULL, 0); - str = dev->dev_board ? dev->dev_board : ""; - node->data->device.board = - XtVaCreateManagedWidget("board", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("chipsetL", labelWidgetClass, box, NULL, 0); - str = dev->dev_chipset ? dev->dev_chipset : ""; - node->data->device.chipset = - XtVaCreateManagedWidget("chipset", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("busidL", labelWidgetClass, box, NULL, 0); - str = dev->dev_busid ? dev->dev_busid : ""; - node->data->device.busid = - XtVaCreateManagedWidget("busid", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("cardL", labelWidgetClass, box, NULL, 0); - str = dev->dev_card ? dev->dev_card : ""; - node->data->device.card = - XtVaCreateManagedWidget("card", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0); - str = dev->dev_driver ? dev->dev_driver : ""; - node->data->device.driver = - XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("ramdacL", labelWidgetClass, box, NULL, 0); - str = dev->dev_ramdac ? dev->dev_ramdac : ""; - node->data->device.ramdac = - XtVaCreateManagedWidget("ramdac", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("dacSpeedL", labelWidgetClass, box, NULL, 0); - if (dev->dev_dacSpeeds[0] > 0) { - for (i = len = 0; i < CONF_MAXDACSPEEDS && - dev->dev_dacSpeeds[i] > 0; i++) { - tmp = XmuSnprintf(buf + len, sizeof(buf) - len, "%g ", - dev->dev_dacSpeeds[i] / 1000.); - len += tmp; - } - } - else - *buf = '\0'; - node->data->device.dacSpeed = - XtVaCreateManagedWidget("dacSpeed", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("videoRamL", labelWidgetClass, box, NULL, 0); - if (dev->dev_videoram) - XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_videoram); - else - *buf = '\0'; - node->data->device.videoRam = - XtVaCreateManagedWidget("videoRam", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("textClockFreqL", labelWidgetClass, box, NULL, 0); - if (dev->dev_textclockfreq) - XmuSnprintf(buf, sizeof(buf), "%.1f", - (double)dev->dev_textclockfreq / 1000.0); - else - *buf = '\0'; - node->data->device.textClockFreq = - XtVaCreateManagedWidget("textClockFreq", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("biosBaseL", labelWidgetClass, box, NULL, 0); - if (dev->dev_bios_base) - XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_bios_base); - else - *buf = '\0'; - node->data->device.biosBase = - XtVaCreateManagedWidget("biosBase", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("memBaseL", labelWidgetClass, box, NULL, 0); - if (dev->dev_mem_base) - XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_mem_base); - else - *buf = '\0'; - node->data->device.memBase = - XtVaCreateManagedWidget("memBase", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("ioBaseL", labelWidgetClass, box, NULL, 0); - if (dev->dev_io_base) - XmuSnprintf(buf, sizeof(buf), "0x%lx", dev->dev_io_base); - else - *buf = '\0'; - node->data->device.ioBase = - XtVaCreateManagedWidget("ioBase", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("clockChipL", labelWidgetClass, box, NULL, 0); - str = dev->dev_clockchip ? dev->dev_clockchip : ""; - node->data->device.clockChip = - XtVaCreateManagedWidget("clockChip", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - *buf = '\0'; - for (i = len = 0; i < dev->dev_clocks; i++) { - tmp = XmuSnprintf(buf + len, sizeof(buf) - len, "%.1f ", - (double)dev->dev_clock[i] / 1000.0); - len += tmp; - } - XtCreateManagedWidget("devClockL", labelWidgetClass, box, NULL, 0); - node->data->device.devClock = - XtVaCreateManagedWidget("devClock", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("chipIdL", labelWidgetClass, box, NULL, 0); - if (dev->dev_chipid != -1) - XmuSnprintf(buf, sizeof(buf), "0x%x", dev->dev_chipid); - else - *buf = '\0'; - node->data->device.chipId = - XtVaCreateManagedWidget("chipId", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("chipRevL", labelWidgetClass, box, NULL, 0); - if (dev->dev_chiprev != -1) - XmuSnprintf(buf, sizeof(buf), "0x%x", dev->dev_chiprev); - else - *buf = '\0'; - node->data->device.chipRev = - XtVaCreateManagedWidget("chipRev", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("irqL", labelWidgetClass, box, NULL, 0); - if (dev->dev_irq != -1) - XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_irq); - else - *buf = '\0'; - node->data->device.irq = - XtVaCreateManagedWidget("irq", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("screenL", labelWidgetClass, box, NULL, 0); - if (dev->dev_screen > 0) - XmuSnprintf(buf, sizeof(buf), "%d", dev->dev_screen); - else - *buf = '\0'; - node->data->device.screen = - XtVaCreateManagedWidget("screen", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewDeviceCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->device.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -NewDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfDevicePtr dev; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->device.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - dev = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec)); - dev->dev_identifier = XtNewString(label); - dev->dev_chipid = -1; - dev->dev_chiprev = -1; - dev->dev_irq = -1; - - XF86Config->conf_device_lst = - xf86addDevice(XF86Config->conf_device_lst, dev); - - CreateDevice(parent, dev); - - RelayoutTree(); -} - -static void -DeviceDestroy(TreeNode *node) -{ - int i; - TreeNode *sc = screenTree; - - for (i = 0; i < computer.num_devices; i++) - if ((XF86ConfDevicePtr)(computer.devices[i]->config) == - node->data->device.device) { - config = computer.devices[i]->widget; - RemoveDeviceCallback(NULL, NULL, NULL); - } - - if (sc) { - TreeNode *prev; - - sc = prev = sc->child; - while (sc->next) { - TreeNode *next = sc->next; - - if (sc->data->screen.screen->scrn_monitor == - node->data->monitor.monitor) { - XtDestroyWidget(sc->node); - - if (sc->child) - DestroyTree(sc->child); - if (sc->data) - XtFree((XtPointer)sc->data); - XtFree((XtPointer)sc); - - if (sc == screenTree->child) - sc = prev = next = screenTree->child = next; - else - prev->next = sc = next; - continue; - } - prev = sc; - sc = next; - } - } -} - -static void -DeviceUpdate(TreeNode *node) -{ - int i; - char *str, *tmp; - - /* vendor */ - XtVaGetValues(node->data->device.vendor, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_vendor); - if (*str) - node->data->device.device->dev_vendor = XtNewString(str); - else - node->data->device.device->dev_vendor = NULL; - - /* board */ - XtVaGetValues(node->data->device.board, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_board); - if (*str) - node->data->device.device->dev_board = XtNewString(str); - else - node->data->device.device->dev_board = NULL; - - /* chipset */ - XtVaGetValues(node->data->device.chipset, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_chipset); - if (*str) - node->data->device.device->dev_chipset = XtNewString(str); - else - node->data->device.device->dev_chipset = NULL; - - /* busid */ - XtVaGetValues(node->data->device.busid, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_busid); - if (*str) - node->data->device.device->dev_busid = XtNewString(str); - else - node->data->device.device->dev_busid = NULL; - - /* card */ - XtVaGetValues(node->data->device.card, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_card); - if (*str) - node->data->device.device->dev_card = XtNewString(str); - else - node->data->device.device->dev_card = NULL; - - /* driver */ - XtVaGetValues(node->data->device.driver, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_driver); - if (*str) - node->data->device.device->dev_driver = XtNewString(str); - else - node->data->device.device->dev_driver = NULL; - - /* ramdac */ - XtVaGetValues(node->data->device.ramdac, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_ramdac); - if (*str) - node->data->device.device->dev_ramdac = XtNewString(str); - else - node->data->device.device->dev_ramdac = NULL; - - /* dacSpeed */ - tmp = NULL; - XtVaGetValues(node->data->device.dacSpeed, XtNstring, &str, NULL); - for (i = 0; i < CONF_MAXDACSPEEDS && str != tmp; i++) { - if ((node->data->device.device->dev_dacSpeeds[i] = - (strtod(str, &tmp) * 1000. + .5)) == 0) - break; - str = tmp; - while (isspace(*str)) - ++str; - } - - /* videoRam */ - XtVaGetValues(node->data->device.videoRam, XtNstring, &str, NULL); - node->data->device.device->dev_videoram = strtoul(str, NULL, 0); - - /* textClockFreq */ - XtVaGetValues(node->data->device.textClockFreq, XtNstring, &str, NULL); - node->data->device.device->dev_textclockfreq = - strtod(str, NULL) * 1000. + .5; - - /* biosBase */ - XtVaGetValues(node->data->device.biosBase, XtNstring, &str, NULL); - node->data->device.device->dev_bios_base = strtoul(str, NULL, 0); - - /* memBase */ - XtVaGetValues(node->data->device.memBase, XtNstring, &str, NULL); - node->data->device.device->dev_mem_base = strtoul(str, NULL, 0); - - /* ioBase */ - XtVaGetValues(node->data->device.ioBase, XtNstring, &str, NULL); - node->data->device.device->dev_io_base = strtoul(str, NULL, 0); - - /* clockChip */ - XtVaGetValues(node->data->device.clockChip, XtNstring, &str, NULL); - XtFree(node->data->device.device->dev_clockchip); - if (*str) - node->data->device.device->dev_clockchip = XtNewString(str); - else - node->data->device.device->dev_clockchip = NULL; - - /* devSpeed */ - tmp = NULL; - XtVaGetValues(node->data->device.devClock, XtNstring, &str, NULL); - for (i = 0; i < CONF_MAXCLOCKS && str != tmp; i++) { - if ((node->data->device.device->dev_clock[i] = - (strtod(str, &tmp) * 1000. + .5)) == 0) - break; - str = tmp; - while (isspace(*str)) - ++str; - } - node->data->device.device->dev_clocks = i; - - /* chipId */ - XtVaGetValues(node->data->device.chipId, XtNstring, &str, NULL); - if (*str) - node->data->device.device->dev_chipid = strtoul(str, NULL, 0); - else - node->data->device.device->dev_chipid = -1; - - /* chipRev */ - XtVaGetValues(node->data->device.chipRev, XtNstring, &str, NULL); - if (*str) - node->data->device.device->dev_chiprev = strtoul(str, NULL, 0); - else - node->data->device.device->dev_chiprev = -1; - - /* irq */ - XtVaGetValues(node->data->device.irq, XtNstring, &str, NULL); - if (*str) - node->data->device.device->dev_irq = strtoul(str, NULL, 0); - else - node->data->device.device->dev_irq = -1; - - /* screen */ - XtVaGetValues(node->data->device.screen, XtNstring, &str, NULL); - if (*str) - node->data->device.device->dev_screen = strtoul(str, NULL, 0); - else - node->data->device.device->dev_screen = -1; -} - -/* Screen */ -static void -CreateScreen(TreeNode *parent, XF86ConfScreenPtr scrn) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (scrn) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->screen.screen = scrn; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = ScreenDestroy; - node->update = ScreenUpdate; - CreateScreenField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - scrn = (XF86ConfScreenPtr)(scrn->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateScreenField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateScreenField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("screen", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - char buf[256], *str; - XF86OptionPtr *options; - TreeNode *adaptor, *display; - XF86ConfScreenPtr scrn = node->data->screen.screen; - - options = &(scrn->scrn_option_lst); - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - label = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, scrn->scrn_identifier, NULL); - - XtCreateManagedWidget("defaultDepthL", labelWidgetClass, box, NULL, 0); - if (scrn->scrn_defaultdepth) - XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultdepth); - else - *buf = '\0'; - node->data->screen.defaultDepth = - XtVaCreateManagedWidget("defaultDepth", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("defaultBppL", labelWidgetClass, box, NULL, 0); - if (scrn->scrn_defaultbpp) - XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultbpp); - else - *buf = '\0'; - node->data->screen.defaultBpp = - XtVaCreateManagedWidget("defaultBpp", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("defaultFbBppL", labelWidgetClass, box, NULL, 0); - if (scrn->scrn_defaultfbbpp) - XmuSnprintf(buf, sizeof(buf), "%d", scrn->scrn_defaultfbbpp); - else - *buf = '\0'; - node->data->screen.defaultFbBpp = - XtVaCreateManagedWidget("defaultFbBpp", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, - NULL); - - XtCreateManagedWidget("monitorL", labelWidgetClass, box, NULL, 0); - str = scrn->scrn_monitor_str ? scrn->scrn_monitor_str : ""; - node->data->screen.monitor = - XtVaCreateManagedWidget("monitor", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - XtCreateManagedWidget("deviceL", labelWidgetClass, box, NULL, 0); - str = scrn->scrn_device_str ? scrn->scrn_device_str : ""; - node->data->screen.device = - XtVaCreateManagedWidget("device", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, - NULL); - - command = XtVaCreateManagedWidget("videoAdaptor", toggleWidgetClass, - tree, XtNstate, True, - XtNtreeParent, box, NULL); - adaptor = NewNode(node, command, command, node->node, NULL); - CreateScreenAdaptor(adaptor, scrn->scrn_adaptor_lst); - node->child = adaptor; - - command = XtVaCreateManagedWidget("Display", toggleWidgetClass, - tree, XtNstate, True, - XtNtreeParent, box, NULL); - display = NewNode(node, command, command, node->node, NULL); - CreateScreenDisplay(display, scrn->scrn_display_lst); - adaptor->next = display; - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewScreenCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->screen.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -NewScreenCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfScreenPtr scrn; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->screen.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - scrn = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec)); - scrn->scrn_identifier = XtNewString(label); - XF86Config->conf_screen_lst = - xf86addScreen(XF86Config->conf_screen_lst, scrn); - - { - TreeNode *lay = layoutTree->child; - Widget sme; - - /* last one is the "new" entry */ - while (lay && lay->next != NULL) { - /* Adjacency is the first entry */ - TreeNode *adj = lay->child->child; - - while (adj != NULL) { - sme = XtCreateManagedWidget(label, smeBSBObjectClass, - adj->data->adjacency.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, adj->next != NULL ? - AdjacencyMenuCallback : NewAdjacencyCallback, - (XtPointer)adj); - adj = adj->next; - } - lay = lay->next; - } - } - - CreateScreen(parent, scrn); - - RelayoutTree(); -} - -static void -ScreenDestroy(TreeNode *node) -{ - if (node->data->screen.screen) { - int i; - TreeNode *lay = layoutTree->child; - - /* last one is the "new" entry */ - while (lay && lay->next) { - /* Adjacency is the first entry */ - TreeNode *adj = lay->child->child; - CompositeWidget composite; - - while (adj) { - TreeNode *next = adj->next; - - composite = (CompositeWidget)adj->data->adjacency.menu; - - for (i = 0; i < composite->composite.num_children; ++i) - if (strcmp(XtName(composite->composite.children[i]), - node->data->screen.screen->scrn_identifier) == 0) { - XtDestroyWidget(composite->composite.children[i]); - break; - } - - if (adj->data->adjacency.screen == node->data->screen.screen) - DeleteNode(adj); - - adj = next; - } - - lay = lay->next; - } - - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->screen == node->data->screen.screen) { - config = computer.screens[i]->widget; - RemoveDeviceCallback(NULL, NULL, NULL); - } - - /* for the case of screens added and removed in the expert dialog */ - xf86removeScreen(XF86Config, node->data->screen.screen); - } -} - -static void -ScreenUpdate(TreeNode *node) -{ - char *str; - - /* defautDepth */ - XtVaGetValues(node->data->screen.defaultDepth, XtNstring, &str, NULL); - node->data->screen.screen->scrn_defaultdepth = strtoul(str, NULL, 0); - - /* defautBpp */ - XtVaGetValues(node->data->screen.defaultBpp, XtNstring, &str, NULL); - node->data->screen.screen->scrn_defaultbpp = strtoul(str, NULL, 0); - - /* defautFbBpp */ - XtVaGetValues(node->data->screen.defaultFbBpp, XtNstring, &str, NULL); - node->data->screen.screen->scrn_defaultfbbpp = strtoul(str, NULL, 0); - - - /* XXX Monitor and Device should be changed to a menu interface */ - /* monitor */ - XtVaGetValues(node->data->screen.monitor, XtNstring, &str, NULL); - XtFree(node->data->screen.screen->scrn_monitor_str); - if (*str) - node->data->screen.screen->scrn_monitor_str = XtNewString(str); - else - node->data->screen.screen->scrn_monitor_str = NULL; - - /* XXX Monitor and Device should be changed to a menu interface */ - /* device */ - XtVaGetValues(node->data->screen.device, XtNstring, &str, NULL); - XtFree(node->data->screen.screen->scrn_device_str); - if (*str) - node->data->screen.screen->scrn_device_str = XtNewString(str); - else - node->data->screen.screen->scrn_device_str = NULL; -} - -static void -CreateScreenAdaptor(TreeNode *parent, XF86ConfAdaptorLinkPtr lnk) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (lnk) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->adaptorlink.adaptorlink = lnk; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = ScreenAdaptorDestroy; - CreateScreenAdaptorField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - lnk = (XF86ConfAdaptorLinkPtr)(lnk->list.next); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - CreateScreenAdaptorField(node, True); -} - -static void -CreateScreenAdaptorField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("adaptor", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86ConfAdaptorLinkPtr lnk = node->data->adaptorlink.adaptorlink; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - (void) XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, lnk->al_adaptor_str, NULL); - } - else { - Widget sme; - XF86ConfVideoAdaptorPtr ptr = XF86Config->conf_videoadaptor_lst; - - command = XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, - XtNmenuName, "adaptorMenu", NULL); - node->data->adaptorlink.menu = - XtVaCreatePopupShell("adaptorMenu", simpleMenuWidgetClass, box, - XtNleftMargin, 1, XtNrightMargin, 1, - XtNtopMargin, 1, XtNbottomMargin, 1, - NULL); - while (ptr) { - sme = XtCreateManagedWidget(ptr->va_identifier, smeBSBObjectClass, - node->data->adaptorlink.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, NewScreenAdaptorCallback, - (XtPointer)node); - ptr = (XF86ConfVideoAdaptorPtr)(ptr->list.next); - } - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGSUSED*/ -static void -NewScreenAdaptorCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfAdaptorLinkPtr link; - char *ident = XtName(w); - - parent = node->parent; - DeleteNode(node); - link = (XF86ConfAdaptorLinkPtr)XtCalloc(1, sizeof(XF86ConfAdaptorLinkRec)); - link->al_adaptor_str = XtNewString(ident); - parent->parent->data->screen.screen->scrn_adaptor_lst = - xf86addScreenAdaptor(parent->parent->data->screen.screen->scrn_adaptor_lst, - link); - - CreateScreenAdaptor(parent, link); - RelayoutTree(); -} - -/*ARGUSED*/ -static void -ScreenAdaptorDestroy(TreeNode *node) -{ - if (node->data->adaptorlink.adaptorlink) - xf86removeScreenAdaptorLink(node->parent->parent->data->screen.screen, - node->data->adaptorlink.adaptorlink); -} - -static void -CreateScreenDisplay(TreeNode *parent, XF86ConfDisplayPtr dsp) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (dsp) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->display.display = dsp; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = ScreenDisplayDestroy; - node->update = ScreenDisplayUpdate; - CreateScreenDisplayField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - dsp = (XF86ConfDisplayPtr)(dsp->list.next); - } - node = NewNode(parent, NULL, NULL, parent->node, NULL); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - CreateScreenDisplayField(node, True); -} - -static void -CreateScreenDisplayField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("display", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - char *str, buf[256]; - XF86OptionPtr *options; - XF86ConfDisplayPtr dsp = node->data->display.display; - TreeNode *modes; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - options = &(dsp->disp_option_lst); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - - XtCreateManagedWidget("viewportL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_frameX0 != 0 || dsp->disp_frameY0 != 0) - XmuSnprintf(buf, sizeof(buf), "%d %d", dsp->disp_frameX0, dsp->disp_frameY0); - else - *buf = '\0'; - node->data->display.viewport = - XtVaCreateManagedWidget("viewport", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("virtualL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_virtualX != 0 || dsp->disp_virtualY != 0) - XmuSnprintf(buf, sizeof(buf), "%d %d", dsp->disp_virtualX, dsp->disp_virtualY); - else - *buf = '\0'; - node->data->display.c_virtual = - XtVaCreateManagedWidget("virtual", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("depthL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_depth != 0) - XmuSnprintf(buf, sizeof(buf), "%d", dsp->disp_depth); - else - *buf = '\0'; - node->data->display.depth = - XtVaCreateManagedWidget("depth", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("bppL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_bpp != 0) - XmuSnprintf(buf, sizeof(buf), "%d", dsp->disp_bpp); - else - *buf = '\0'; - node->data->display.bpp = - XtVaCreateManagedWidget("bpp", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("visualL", labelWidgetClass, box, NULL, 0); - str = dsp->disp_visual != NULL ? dsp->disp_visual : ""; - node->data->display.visual = - XtVaCreateManagedWidget("visual", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, NULL); - - XtCreateManagedWidget("weightL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_weight.red > 0) - XmuSnprintf(buf, sizeof(buf), "%d %d %d", - dsp->disp_weight.red, dsp->disp_weight.green, dsp->disp_weight.blue); - else - *buf = '\0'; - node->data->display.weight = - XtVaCreateManagedWidget("weight", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("blackL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_black.red >= 0) - XmuSnprintf(buf, sizeof(buf), "0x%04x 0x%04x 0x%04x", - dsp->disp_black.red, dsp->disp_black.green, dsp->disp_black.blue); - else - *buf = '\0'; - node->data->display.black = - XtVaCreateManagedWidget("black", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("whiteL", labelWidgetClass, box, NULL, 0); - if (dsp->disp_white.red >= 0) - XmuSnprintf(buf, sizeof(buf), "0x%04x 0x%04x 0x%04x", - dsp->disp_white.red, dsp->disp_white.green, dsp->disp_white.blue); - else - *buf = '\0'; - node->data->display.white = - XtVaCreateManagedWidget("white", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - command = XtVaCreateManagedWidget("Modes", toggleWidgetClass, tree, - XtNstate, True, XtNtreeParent, box, - NULL); - modes = NewNode(node, command, command, node->node, NULL); - node->child = modes; - CreateDisplayMode(modes, dsp->disp_mode_lst); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, NewScreenDisplayCallback, - (XtPointer)node); - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGSUSED*/ -static void -NewScreenDisplayCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfDisplayPtr dsp; - - parent = node->parent; - DeleteNode(node); - dsp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec)); - dsp->disp_black.red = dsp->disp_black.green = dsp->disp_black.blue = - dsp->disp_white.red = dsp->disp_white.green = dsp->disp_white.blue = -1; - parent->parent->data->screen.screen->scrn_display_lst = - xf86addScreenDisplay(parent->parent->data->screen.screen->scrn_display_lst, - dsp); - - CreateScreenDisplay(parent, dsp); - RelayoutTree(); -} - -static void -ScreenDisplayDestroy(TreeNode *node) -{ - if (node->data->display.display) - xf86removeScreenDisplay(node->parent->parent->data->screen.screen, - node->data->display.display); -} - -static void -ScreenDisplayUpdate(TreeNode *node) -{ - char *str, *tmp; - int x, y; - - /* viewport */ - XtVaGetValues(node->data->display.viewport, XtNstring, &str, NULL); - if (sscanf(str, "%d %d", &x, &y) == 2) { - node->data->display.display->disp_frameX0 = x; - node->data->display.display->disp_frameY0 = y; - } - - /* virtual */ - XtVaGetValues(node->data->display.c_virtual, XtNstring, &str, NULL); - if (sscanf(str, "%d %d", &x, &y) == 2) { - node->data->display.display->disp_virtualX = x; - node->data->display.display->disp_virtualY = y; - } - - /* depth */ - XtVaGetValues(node->data->display.depth, XtNstring, &str, NULL); - node->data->display.display->disp_depth = strtoul(str, NULL, 0); - - /* bpp */ - XtVaGetValues(node->data->display.bpp, XtNstring, &str, NULL); - node->data->display.display->disp_bpp = strtoul(str, NULL, 0); - - /* visual */ - XtVaGetValues(node->data->display.visual, XtNstring, &str, NULL); - XtFree(node->data->display.display->disp_visual); - if (*str) - node->data->display.display->disp_visual = XtNewString(str); - else - node->data->display.display->disp_visual = NULL; - - /* weight */ - XtVaGetValues(node->data->display.weight, XtNstring, &str, NULL); - node->data->display.display->disp_weight.red = strtoul(str, &tmp, 0); - if (str == tmp) - node->data->display.display->disp_weight.red = 0; - else { - str = tmp; - while (isspace(*str)) - ++str; - node->data->display.display->disp_weight.green = strtoul(str, &tmp, 0); - if (str != tmp) { - str = tmp; - while (isspace(*str)) - ++str; - node->data->display.display->disp_weight.blue = strtoul(str, &tmp, 0); - } - } - - /* black */ - XtVaGetValues(node->data->display.black, XtNstring, &str, NULL); - node->data->display.display->disp_black.red = strtoul(str, &tmp, 0); - if (str == tmp) - node->data->display.display->disp_black.red = -1; - else { - str = tmp; - while (isspace(*str)) - ++str; - node->data->display.display->disp_black.green = strtoul(str, &tmp, 0); - if (str != tmp) { - str = tmp; - while (isspace(*str)) - ++str; - node->data->display.display->disp_black.blue = strtoul(str, &tmp, 0); - } - } - - /* white */ - XtVaGetValues(node->data->display.white, XtNstring, &str, NULL); - node->data->display.display->disp_white.red = strtoul(str, &tmp, 0); - if (str == tmp) - node->data->display.display->disp_white.red = -1; - else { - str = tmp; - while (isspace(*str)) - ++str; - node->data->display.display->disp_white.green = strtoul(str, &tmp, 0); - if (str != tmp) { - str = tmp; - while (isspace(*str)) - ++str; - node->data->display.display->disp_white.blue = strtoul(str, &tmp, 0); - } - } -} - -static void -CreateDisplayMode(TreeNode *parent, XF86ModePtr modes) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (modes) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->mode.mode = modes; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = DisplayModeDestroy; - CreateDisplayModeField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - modes = (XF86ModePtr)(modes->list.next); - } - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - CreateDisplayModeField(node, True); -} - -static void -CreateDisplayModeField(TreeNode *node, Bool addnew) -{ - Widget box, command, text; - - box = XtVaCreateWidget("mode", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - if (!addnew) { - XF86ModePtr mode = node->data->mode.mode; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, - (XtPointer)node); - text = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, mode->mode_name, NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, NewDisplayModeCallback, - (XtPointer)node); - text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, NULL); - } - node->data->mode.text = text; - if (node->treeParent && XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGSUSED*/ -static void -NewDisplayModeCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ModePtr mode; - Arg args[1]; - char *ident; - - XtSetArg(args[0], XtNstring, &ident); - XtGetValues(node->data->mode.text, args, 1); - if (*ident == '\0') - return; - - parent = node->parent; - DeleteNode(node); - mode = (XF86ModePtr)XtCalloc(1, sizeof(XF86ModeRec)); - mode->mode_name = XtNewString(ident); - parent->parent->data->display.display->disp_mode_lst = - xf86addDisplayMode(parent->parent->data->display.display->disp_mode_lst, - mode); - - CreateDisplayMode(parent, mode); - RelayoutTree(); -} - -/*ARGUSED*/ -static void -DisplayModeDestroy(TreeNode *node) -{ - if (node->data->mode.mode) - xf86removeDisplayMode(node->parent->parent->data->display.display, - node->data->mode.mode); -} - -/* Input */ -static void -CreateInput(TreeNode *parent, XF86ConfInputPtr input) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (input) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->input.input = input; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = InputDestroy; - node->update = InputUpdate; - CreateInputField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - input = (XF86ConfInputPtr)(input->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateInputField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateInputField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("input", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - char *str; - XF86OptionPtr *options; - XF86ConfInputPtr inp = node->data->input.input; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - options = &(inp->inp_option_lst); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, inp->inp_identifier, NULL); - - XtCreateManagedWidget("driverL", labelWidgetClass, box, NULL, 0); - str = inp->inp_driver != NULL ? inp->inp_driver : ""; - node->data->input.text = - XtVaCreateManagedWidget("driver", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, str, NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, NULL, 0); - XtAddCallback(command, XtNcallback, NewInputCallback, - (XtPointer)node); - node->data->input.text = - XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, NULL); - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGSUSED*/ -static void -NewInputCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfInputPtr input; - Arg args[1]; - char *ident; - - XtSetArg(args[0], XtNstring, &ident); - XtGetValues(node->data->input.text, args, 1); - if (*ident == '\0') - return; - - parent = node->parent; - DeleteNode(node); - input = (XF86ConfInputPtr)XtCalloc(1, sizeof(XF86ConfInputRec)); - input->inp_identifier = XtNewString(ident); - XF86Config->conf_input_lst = - xf86addInput(XF86Config->conf_input_lst, input); - - { - TreeNode *lay = layoutTree->child; - Widget sme; - - /* last one is the "new" entry */ - while (lay && lay->next != NULL) { - /* Inputref is the second entry */ - TreeNode *iref = lay->child->next->child; - - while (iref && iref->next) - iref = iref->next; - sme = XtCreateManagedWidget(ident, smeBSBObjectClass, - iref->data->inputref.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, NewInputrefCallback, - (XtPointer)iref); - lay = lay->next; - } - } - - CreateInput(parent, input); - RelayoutTree(); -} - -/*ARGUSED*/ -static void -InputDestroy(TreeNode *node) -{ - if (node->data->input.input) { - int i; - TreeNode *lay = layoutTree->child; - - /* last one is the "new" entry */ - while (lay && lay->next) { - /* Inputref is the second entry */ - TreeNode *iref = lay->child->next->child; - CompositeWidget composite; - - while (iref && iref->next) { - TreeNode *next = iref->next; - - if (iref && strcmp(iref->data->inputref.inputref->iref_inputdev_str, - node->data->input.input->inp_identifier) == 0) - DeleteNode(iref); - iref = next; - } - - composite = (CompositeWidget)iref->data->inputref.menu; - - for (i = 0; i < composite->composite.num_children; ++i) - if (strcmp(XtName(composite->composite.children[i]), - node->data->input.input->inp_identifier) == 0) - XtDestroyWidget(composite->composite.children[i]); - - lay = lay->next; - } - - for (i = 0; i < computer.num_devices; i++) - if ((XF86ConfInputPtr)(computer.devices[i]->config) == - node->data->input.input) { - config = computer.devices[i]->widget; - RemoveDeviceCallback(NULL, NULL, NULL); - } - } -} - -static void -InputUpdate(TreeNode *node) -{ - char *str; - - /* vendor */ - XtVaGetValues(node->data->input.text, XtNstring, &str, NULL); - XtFree(node->data->input.input->inp_driver); - if (*str) - node->data->input.input->inp_driver = XtNewString(str); - else - node->data->input.input->inp_driver = NULL; -} - -/* Layout */ -static void -CreateLayout(TreeNode *parent, XF86ConfLayoutPtr lay) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (lay) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->layout.layout = lay; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = LayoutDestroy; - CreateLayoutField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - lay = (XF86ConfLayoutPtr)(lay->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateLayoutField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateLayoutField(TreeNode *node, Bool addnew) -{ - Widget box, command, label; - - box = XtVaCreateWidget("layout", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - TreeNode *adjacency, *inputref; - XF86OptionPtr *options; - XF86ConfLayoutPtr lay = node->data->layout.layout; - - options = &(lay->lay_option_lst); - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - label = XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, lay->lay_identifier, NULL); - - command = XtVaCreateManagedWidget("Adjacency", toggleWidgetClass, tree, - XtNstate, True, XtNtreeParent, box, - NULL); - adjacency = NewNode(node, command, command, box, NULL); - node->child = adjacency; - CreateAdjacency(adjacency, lay->lay_adjacency_lst); - - command = XtVaCreateManagedWidget("Inputref", toggleWidgetClass, tree, - XtNstate, True, XtNtreeParent, box, - NULL); - inputref = NewNode(node, command, command, box, NULL); - adjacency->next = inputref; - CreateInputref(inputref, lay->lay_input_lst); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewLayoutCallback, (XtPointer)node); - label = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - NULL); - node->data->layout.text = label; - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -LayoutDestroy(TreeNode *node) -{ - if (node->data->layout.layout) - xf86removeLayout(XF86Config, node->data->layout.layout); -} - -/*ARGSUSED*/ -static void -NewLayoutCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfLayoutPtr lay; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->layout.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - lay = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec)); - lay->lay_identifier = XtNewString(label); - XF86Config->conf_layout_lst = xf86addLayout(XF86Config->conf_layout_lst, lay); - - CreateLayout(parent, lay); - RelayoutTree(); -} - -static void -CreateAdjacency(TreeNode *parent, XF86ConfAdjacencyPtr adj) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (adj) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->adjacency.screen = adj ? adj->adj_screen : NULL; - data->adjacency.adjacency = adj; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = AdjacencyDestroy; - CreateAdjacencyField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - adj = (XF86ConfAdjacencyPtr)(adj->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateAdjacencyField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateAdjacencyField(TreeNode *node, Bool addnew) -{ - Widget box, command, sme; - XF86ConfScreenPtr ptr = XF86Config->conf_screen_lst; - - box = XtVaCreateWidget("adjacency", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - node->data->adjacency.menu = - XtVaCreatePopupShell("screenMenu", simpleMenuWidgetClass, box, - XtNleftMargin, 1, XtNrightMargin, 1, - XtNtopMargin, 1, XtNbottomMargin, 1, - NULL); - while (ptr) { - sme = XtCreateManagedWidget(ptr->scrn_identifier, smeBSBObjectClass, - node->data->adjacency.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, !addnew ? - AdjacencyMenuCallback : NewAdjacencyCallback, - (XtPointer)node); - ptr = (XF86ConfScreenPtr)(ptr->list.next); - } - - if (!addnew) { - char buf[32]; - Cardinal width, height; - Widget left, right, above, below, relative, absolute; - XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - (void) XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, adj->adj_screen->scrn_identifier, - NULL); - - XtCreateManagedWidget("scrnumL", labelWidgetClass, box, NULL, 0); - if (adj->adj_scrnum >= 0) - XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_scrnum); - else - *buf = 0; - node->data->adjacency.scrnum = - XtVaCreateManagedWidget("scrnum", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - above = XtVaCreateManagedWidget("above", toggleWidgetClass, box, - XtNstate, adj->adj_where == CONF_ADJ_ABOVE ? - True : False, NULL); - XtAddCallback(above, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); - left = XtVaCreateManagedWidget("leftOf", toggleWidgetClass, box, - XtNradioGroup, above, - XtNstate, adj->adj_where == CONF_ADJ_LEFTOF ? - True : False, NULL); - XtAddCallback(left, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); - - node->data->adjacency.button = - XtVaCreateManagedWidget("screen", menuButtonWidgetClass, box, - XtNmenuName, "screenMenu", NULL); - - right = XtVaCreateManagedWidget("rightOf", toggleWidgetClass, box, - XtNradioGroup, left, - XtNstate, adj->adj_where == CONF_ADJ_RIGHTOF ? - True : False, NULL); - XtAddCallback(right, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); - below = XtVaCreateManagedWidget("below", toggleWidgetClass, box, - XtNradioGroup, right, - XtNstate, adj->adj_where == CONF_ADJ_BELOW ? - True : False, NULL); - XtAddCallback(below, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); - relative = XtVaCreateManagedWidget("relative", toggleWidgetClass, box, - XtNradioGroup, below, - XtNstate, adj->adj_where == CONF_ADJ_RELATIVE ? - True : False, NULL); - XtAddCallback(relative, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); - absolute = XtVaCreateManagedWidget("absolute", toggleWidgetClass, box, - XtNradioGroup, relative, - XtNstate, adj->adj_where == CONF_ADJ_ABSOLUTE ? - True : False, NULL); - XtAddCallback(absolute, XtNcallback, AdjacencyToggleCallback, (XtPointer)node); - - XtCreateManagedWidget("adjxL", labelWidgetClass, box, NULL, 0); - XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_x); - node->data->adjacency.adjx = - XtVaCreateManagedWidget("adjx", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtCreateManagedWidget("adjyL", labelWidgetClass, box, NULL, 0); - XmuSnprintf(buf, sizeof(buf), "%d", adj->adj_y); - node->data->adjacency.adjy = - XtVaCreateManagedWidget("adjy", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, - XtNstring, buf, NULL); - - XtVaGetValues(node->data->adjacency.button, XtNwidth, &width, - XtNheight, &height, NULL); - if (adj->adj_where > CONF_ADJ_ABSOLUTE && - adj->adj_where <= CONF_ADJ_RELATIVE) - XtVaSetValues(node->data->adjacency.button, XtNlabel, - adj->adj_refscreen, XtNwidth, width, - XtNheight, height, NULL); - else - XtVaSetValues(node->data->adjacency.button, XtNlabel, "", - XtNwidth, width, XtNheight, height, NULL); - } - else - XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, - XtNmenuName, "screenMenu", NULL); - - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -AdjacencyDestroy(TreeNode *node) -{ - if (node->data->adjacency.adjacency) - xf86removeAdjacency(node->parent->parent->data->layout.layout, - node->data->adjacency.adjacency); -} - -/*ARGSUSED*/ -static void -NewAdjacencyCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfAdjacencyPtr adj; - char *ident = XtName(w); - - parent = node->parent; - DeleteNode(node); - adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec)); - adj->adj_screen = xf86findScreen(ident, XF86Config->conf_screen_lst); - if (adj->adj_screen) - adj->adj_screen_str = XtNewString(adj->adj_screen->scrn_identifier); - parent->parent->data->layout.layout->lay_adjacency_lst = - xf86addAdjacency(parent->parent->data->layout.layout->lay_adjacency_lst, - adj); - - CreateAdjacency(parent, adj); - RelayoutTree(); -} - -/*ARGUSED*/ -static void -AdjacencyMenuCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *node = (TreeNode*)user_data; - XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; - - XtFree(adj->adj_refscreen); - adj->adj_refscreen = XtNewString(XtName(w)); - XtVaSetValues(node->data->adjacency.button, XtNlabel, XtName(w), NULL); -} - -static void -AdjacencyToggleCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *node = (TreeNode*)user_data; - XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; - char *x, *y; - - if ((Bool)(long)call_data == False) - return; - - XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL); - XtVaGetValues(node->data->adjacency.adjy, XtNstring, &y, NULL); - - adj->adj_x = strtol(x, NULL, 0); - adj->adj_y = strtol(y, NULL, 0); - - if (strcmp(XtName(w), "absolute") == 0) { - XtVaSetValues(node->data->adjacency.button, XtNlabel, "", NULL); - adj->adj_where = CONF_ADJ_ABSOLUTE; - return; - } - if (strcmp(XtName(w), "relative") == 0) - adj->adj_where = CONF_ADJ_RELATIVE; - else if (strcmp(XtName(w), "leftOf") == 0) - adj->adj_where = CONF_ADJ_LEFTOF; - else if (strcmp(XtName(w), "rightOf") == 0) - adj->adj_where = CONF_ADJ_RIGHTOF; - else if (strcmp(XtName(w), "above") == 0) - adj->adj_where = CONF_ADJ_ABOVE; - else if (strcmp(XtName(w), "below") == 0) - adj->adj_where = CONF_ADJ_BELOW; -} - -/* Inputref */ -static void -CreateInputref(TreeNode *parent, XF86ConfInputrefPtr input) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (input) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->inputref.inputref = input; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = InputrefDestroy; - CreateInputrefField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - input = (XF86ConfInputrefPtr)(input->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateInputrefField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateInputrefField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("inputref", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86OptionPtr *options; - XF86ConfInputrefPtr inp = node->data->inputref.inputref; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - options = &(inp->iref_option_lst); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, inp->iref_inputdev_str, NULL); - } - else { - Widget sme; - XF86ConfInputPtr ptr = XF86Config->conf_input_lst; - - XtVaCreateManagedWidget("new", menuButtonWidgetClass, box, - XtNmenuName, "inputMenu", NULL); - node->data->inputref.menu = - XtVaCreatePopupShell("inputMenu", simpleMenuWidgetClass, box, - XtNleftMargin, 1, XtNrightMargin, 1, - XtNtopMargin, 1, XtNbottomMargin, 1, - NULL); - - while (ptr) { - sme = XtCreateManagedWidget(ptr->inp_identifier, smeBSBObjectClass, - node->data->inputref.menu, NULL, 0); - XtAddCallback(sme, XtNcallback, NewInputrefCallback, - (XtPointer)node); - ptr = (XF86ConfInputPtr)(ptr->list.next); - } - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGSUSED*/ -static void -NewInputrefCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfInputrefPtr input; - char *ident = XtName(w); - - parent = node->parent; - DeleteNode(node); - input = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec)); - input->iref_inputdev_str = XtNewString(ident); - parent->parent->data->layout.layout->lay_input_lst = - xf86addInputref(parent->parent->data->layout.layout->lay_input_lst, input); - - CreateInputref(parent, input); - RelayoutTree(); -} - -/*ARGUSED*/ -static void -InputrefDestroy(TreeNode *node) -{ - if (node->data->inputref.inputref) - xf86removeInputRef(node->parent->parent->data->layout.layout, node->data->inputref.inputref->iref_inputdev); -} - -/* Vendor */ -static void -CreateVendor(TreeNode *parent, XF86ConfVendorPtr vendor) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (vendor) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->vendor.vendor = vendor; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = VendorDestroy; - CreateVendorField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - vendor = (XF86ConfVendorPtr)(vendor->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateVendorField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateVendorField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("vendor", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - TreeNode *sub; - XF86OptionPtr *options; - XF86ConfVendorPtr vendor = node->data->vendor.vendor; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - options = &(vendor->vnd_option_lst); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, vendor->vnd_identifier, NULL); - - command = XtVaCreateManagedWidget("VendSub", toggleWidgetClass, tree, - XtNstate, True, - XtNtreeParent, box, - NULL); - sub = NewNode(node, command, command, box, NULL); - node->child = sub; - CreateVendorSub(sub, vendor->vnd_sub_lst); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewVendorCallback, (XtPointer)node); - node->data->vendor.text = - XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, NULL); - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -VendorDestroy(TreeNode *node) -{ - if (node->data->vendor.vendor) - xf86removeVendor(XF86Config, node->data->vendor.vendor); -} - -static void -NewVendorCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfVendorPtr vnd; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->vendor.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - vnd = (XF86ConfVendorPtr)XtCalloc(1, sizeof(XF86ConfVendorRec)); - vnd->vnd_identifier = XtNewString(label); - XF86Config->conf_vendor_lst = xf86addVendor(XF86Config->conf_vendor_lst, vnd); - - CreateVendor(parent, vnd); - RelayoutTree(); -} - -/* VendorSub */ -static void -CreateVendorSub(TreeNode *parent, XF86ConfVendSubPtr vendor) -{ - TreeNode *prev, *node; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (vendor) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->vendsub.vendsub = vendor; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = VendorSubDestroy; - node->update = VendorSubUpdate; - CreateVendorSubField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - vendor = (XF86ConfVendSubPtr)(vendor->list.next); - } - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - node = NewNode(parent, NULL, NULL, parent->node, data); - CreateVendorSubField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateVendorSubField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("vendorSub", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - XF86OptionPtr *options; - XF86ConfVendSubPtr vendor = node->data->vendsub.vendsub; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - options = &(vendor->vs_option_lst); - command = XtCreateManagedWidget("options", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, OptionsCallback, (XtPointer)options); - XtVaCreateManagedWidget("label", labelWidgetClass, box, - XtNlabel, vendor->vs_identifier, NULL); - - XtCreateManagedWidget("nameL", labelWidgetClass, box, NULL, 0); - node->data->vendsub.text = - XtVaCreateManagedWidget("name", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, - vendor->vs_name ? vendor->vs_name : "", - NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewVendorSubCallback, (XtPointer)node); - node->data->vendsub.text = - XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, NULL); - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -VendorSubDestroy(TreeNode *node) -{ - if (node->data->vendsub.vendsub) - xf86removeVendorSub(node->parent->parent->data->vendor.vendor, - node->data->vendsub.vendsub); -} - -static void -VendorSubUpdate(TreeNode *node) -{ - char *str; - - XtVaGetValues(node->data->vendsub.text, XtNstring, &str, NULL); - XtFree(node->data->vendsub.vendsub->vs_name); - if (*str) - node->data->vendsub.vendsub->vs_name = XtNewString(str); - else - node->data->vendsub.vendsub->vs_name = NULL; -} - -static void -NewVendorSubCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfVendSubPtr vnd; - Arg args[1]; - char *label; - - XtSetArg(args[0], XtNstring, &label); - XtGetValues(node->data->vendsub.text, args, 1); - if (*label == '\0') - return; - - parent = node->parent; - DeleteNode(node); - vnd = (XF86ConfVendSubPtr)XtCalloc(1, sizeof(XF86ConfVendSubRec)); - vnd->vs_identifier = XtNewString(label); - parent->parent->data->vendor.vendor->vnd_sub_lst = - xf86addVendorSub(parent->parent->data->vendor.vendor->vnd_sub_lst, vnd); - - CreateVendorSub(parent, vnd); - RelayoutTree(); -} - -/* DRI */ -static void -CreateDRI(TreeNode *parent, XF86ConfDRIPtr dri) -{ - TreeNode *node; - TreeData *data; - - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->dri.dri = dri; - node = NewNode(parent, NULL, NULL, parent->node, data); - parent->child = node; - node->update = DRIUpdate; - CreateDRIField(node); -} - -static void -CreateDRIField(TreeNode *node) -{ - Widget box, toggle; - XF86ConfDRIPtr dri = node->data->dri.dri; - TreeNode *buffers; - char buf[32]; - - box = XtVaCreateWidget("dri", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - XtCreateManagedWidget("nameL", labelWidgetClass, box, NULL, 0); - node->data->dri.name = - XtVaCreateManagedWidget("name", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, - dri->dri_group_name ? dri->dri_group_name : "", - NULL); - - XtCreateManagedWidget("groupL", labelWidgetClass, box, NULL, 0); - if (dri->dri_group >= 0) - XmuSnprintf(buf, sizeof(buf), "%d", dri->dri_group); - else - *buf = '\0'; - node->data->dri.group = - XtVaCreateManagedWidget("group", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, buf, - NULL); - - XtCreateManagedWidget("modeL", labelWidgetClass, box, NULL, 0); - if (dri->dri_mode > 0) - XmuSnprintf(buf, sizeof(buf), "0%o", dri->dri_mode); - else - *buf = '\0'; - node->data->dri.mode = - XtVaCreateManagedWidget("mode", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, buf, - NULL); - - toggle = XtVaCreateManagedWidget("Buffers", toggleWidgetClass, tree, - XtNstate, True, XtNtreeParent, box, - NULL); - buffers = NewNode(node, toggle, toggle, box, NULL); - node->child = buffers; - CreateBuffers(buffers, dri->dri_buffers_lst); - - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -static void -DRIUpdate(TreeNode *node) -{ - char *str; - - /* name */ - XtVaGetValues(node->data->dri.name, XtNstring, &str, NULL); - XtFree(node->data->dri.dri->dri_group_name); - if (*str) - node->data->dri.dri->dri_group_name = XtNewString(str); - else - node->data->dri.dri->dri_group_name = NULL; - - /* group */ - XtVaGetValues(node->data->dri.group, XtNstring, &str, NULL); - if (*str) - node->data->dri.dri->dri_group = strtoul(str, NULL, 0); - else - node->data->dri.dri->dri_group = -1; - - /* mode */ - XtVaGetValues(node->data->dri.mode, XtNstring, &str, NULL); - node->data->dri.dri->dri_mode = strtoul(str, NULL, 0); -} - -/* Buffers */ -static void -CreateBuffers(TreeNode *parent, XF86ConfBuffersPtr buf) -{ - TreeNode *node, *prev; - TreeData *data; - - if ((prev = parent->child) != NULL) - while (prev->next) - prev = prev->next; - - while (buf) { - data = (TreeData*)XtCalloc(1, sizeof(TreeData)); - data->buffers.buffers = buf; - node = NewNode(parent, NULL, NULL, parent->node, data); - node->destroy = BuffersDestroy; - node->update = BuffersUpdate; - CreateBuffersField(node, False); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; - prev = node; - - buf = (XF86ConfBuffersPtr)(buf->list.next); - } - node = NewNode(parent, NULL, NULL, parent->node, NULL); - CreateBuffersField(node, True); - if (parent->child == NULL) - parent->child = node; - else - prev->next = node; -} - -static void -CreateBuffersField(TreeNode *node, Bool addnew) -{ - Widget box, command; - - box = XtVaCreateWidget("buffers", formWidgetClass, tree, - XtNtreeParent, node->treeParent, NULL); - node->node = box; - - if (!addnew) { - char str[32]; - XF86ConfBuffersPtr buf = node->data->buffers.buffers; - - command = XtCreateManagedWidget("remove", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)node); - - XtCreateManagedWidget("countL", labelWidgetClass, box, NULL, 0); - XmuSnprintf(str, sizeof(str), "%d", buf->buf_count); - node->data->buffers.count = - XtVaCreateManagedWidget("count", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, str, - NULL); - - XtCreateManagedWidget("sizeL", labelWidgetClass, box, NULL, 0); - XmuSnprintf(str, sizeof(str), "%d", buf->buf_size); - node->data->buffers.size = - XtVaCreateManagedWidget("size", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, str, - NULL); - - XtCreateManagedWidget("flagsL", labelWidgetClass, box, NULL, 0); - node->data->buffers.flags = - XtVaCreateManagedWidget("flags", asciiTextWidgetClass, box, - XtNeditType, XawtextEdit, XtNstring, - buf->buf_flags ? buf->buf_flags : "", - NULL); - } - else { - command = XtCreateManagedWidget("new", commandWidgetClass, box, - NULL, 0); - XtAddCallback(command, XtNcallback, NewBuffersCallback, (XtPointer)node); - } - if (XtIsRealized(node->treeParent)) - XtRealizeWidget(box); - XtManageChild(box); -} - -/*ARGUSED*/ -static void -BuffersDestroy(TreeNode *node) -{ - if (node->data->buffers.buffers) - xf86removeBuffers(XF86Config->conf_dri, node->data->buffers.buffers); -} - -/*ARGSUSED*/ -static void -NewBuffersCallback(Widget unused, XtPointer user_data, XtPointer call_data) -{ - TreeNode *parent, *node = (TreeNode*)user_data; - XF86ConfBuffersPtr buf; - - parent = node->parent; - DeleteNode(node); - buf = (XF86ConfBuffersPtr)XtCalloc(1, sizeof(XF86ConfBuffersRec)); - XF86Config->conf_dri->dri_buffers_lst = - xf86addBuffers(XF86Config->conf_dri->dri_buffers_lst, buf); - - CreateBuffers(parent, buf); - RelayoutTree(); -} - -static void -BuffersUpdate(TreeNode *node) -{ - char *str; - - /* count */ - XtVaGetValues(node->data->buffers.count, XtNstring, &str, NULL); - node->data->buffers.buffers->buf_count = strtoul(str, NULL, 0); - - /* size */ - XtVaGetValues(node->data->buffers.size, XtNstring, &str, NULL); - node->data->buffers.buffers->buf_size = strtoul(str, NULL, 0); - - /* flags */ - XtVaGetValues(node->data->buffers.flags, XtNstring, &str, NULL); - if (*str) - node->data->buffers.buffers->buf_flags = XtNewString(str); - else - node->data->buffers.buffers->buf_flags = NULL; -} - -static TreeNode * -NewNode(TreeNode *parent, Widget node, Widget toggle, Widget treeParent, - TreeData *data) -{ - TreeNode *tree = (TreeNode*)XtCalloc(1, sizeof(TreeNode)); - - tree->parent = parent; - tree->node = node; - if ((tree->toggle = toggle) != NULL) - XtAddCallback(toggle, XtNcallback, ToggleCallback, (XtPointer)tree); - tree->treeParent = treeParent; - tree->data = data; - - return (tree); -} - -static void -DeleteNode(TreeNode *node) -{ - TreeNode *ptr = node->child; - - while (ptr != NULL) { - TreeNode *next = ptr->next; - - DeleteNode(ptr); - ptr = next; - } - - if (node->parent && node->parent->child == node) - node->parent->child = node->next; - else if (node->parent) { - for (ptr = node->parent->child; ptr && ptr->next != node; - ptr = ptr->next) - ; - if (ptr) - ptr->next = node->next; - } - - if (node->destroy) - (node->destroy)(node); - if (node->data) - XtFree((XtPointer)node->data); - - /* sets treeParent to NULL so that RelayoutTree works correctly, - * as the tree will properly calculate it's new size. - */ - XtVaSetValues(node->node, XtNtreeParent, NULL, NULL); - - XtDestroyWidget(node->node); - XtFree((XtPointer)node); -} - -/*ARGUSED*/ -static void -DestroyCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *node = (TreeNode*)user_data; - - DeleteNode(node); - RelayoutTree(); -} - -static void -ToggleNodeRecursive(TreeNode *node) -{ - while (node) { - if (!XtIsRealized(node->node)) - XtRealizeWidget(node->node); - XtVaSetValues(node->node, XtNtreeParent, node->treeParent, NULL); - XtManageChild(node->node); - - if (node->child && !node->toggle) - ToggleNodeRecursive(node->child); - - node = node->next; - } -} - -static void -ToggleNode(TreeNode *node, Bool toggle) -{ - while (node) { - if (toggle) { - if (!XtIsRealized(node->node)) - XtRealizeWidget(node->node); - XtVaSetValues(node->node, XtNtreeParent, node->treeParent, NULL); - XtManageChild(node->node); - - if (node->child && !node->toggle) - ToggleNodeRecursive(node->child); - } - else { - if (node->child) - ToggleNode(node->child, False); - XtVaSetValues(node->node, XtNtreeParent, NULL, NULL); - XtUnmanageChild(node->node); - if (node->toggle) - XtVaSetValues(node->toggle, XtNstate, False, NULL); - } - node = node->next; - } -} - -/* - * XXX This callback can show side effects in the way it is called. If - * the structure holding the XF86OptionPtr is reallocated, a bogus pointer - * will be passed to this callback. - */ -static void -OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XF86OptionPtr *options = (XF86OptionPtr*)user_data; - -#ifdef USE_MODULES - OptionsPopup(options, NULL, NULL); -#else - OptionsPopup(options); -#endif -} - -static void -RelayoutTree(void) -{ - Arg args[4]; - Dimension sliderWidth, sliderHeight, canvasWidth, canvasHeight; - - XtSetArg(args[0], XtNwidth, &sliderWidth); - XtSetArg(args[1], XtNheight, &sliderHeight); - XtGetValues(shell, args, 2); - - XtSetArg(args[2], XtNwidth, &canvasWidth); - XtSetArg(args[3], XtNheight, &canvasHeight); - XtGetValues(tree, args + 2, 2); - - XtSetArg(args[0], XtNsliderWidth, sliderWidth); - XtSetArg(args[1], XtNsliderHeight, sliderHeight); - XtSetArg(args[2], XtNcanvasWidth, canvasWidth); - XtSetArg(args[3], XtNcanvasHeight, canvasHeight); - XtSetValues(panner, args, 4); -} - -static void -ToggleCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - TreeNode *nodeParent = (TreeNode*)user_data; - - if (nodeParent->child) { - if (XtIsRealized(tree)) - XtUnmapWidget(tree); - ToggleNode(nodeParent->child, (Bool)(long)call_data); - RelayoutTree(); - if (XtIsRealized(tree)) - XtMapWidget(tree); - } -} - -/*ARGSUSED*/ -static void -PannerCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[2]; - XawPannerReport *rep = (XawPannerReport *)call_data; - - XtSetArg (args[0], XtNx, -rep->slider_x); - XtSetArg (args[1], XtNy, -rep->slider_y); - XtSetValues(tree, args, 2); -} - -/*ARGSUSED*/ -static void -PortholeCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XawPannerReport *rep = (XawPannerReport*)call_data; - Arg args[6]; - Cardinal n = 2; - - XtSetArg (args[0], XtNsliderX, rep->slider_x); - XtSetArg (args[1], XtNsliderY, rep->slider_y); - if (rep->changed != (XawPRSliderX | XawPRSliderY)) { - XtSetArg (args[2], XtNsliderWidth, rep->slider_width); - XtSetArg (args[3], XtNsliderHeight, rep->slider_height); - XtSetArg (args[4], XtNcanvasWidth, rep->canvas_width); - XtSetArg (args[5], XtNcanvasHeight, rep->canvas_height); - n = 6; - } - XtSetValues(panner, args, n); -} - -static void -DestroyTree(TreeNode *node) -{ - while (node) { - TreeNode *next = node->next; - if (node->child) - DestroyTree(node->child); - - if (node->data) - XtFree((XtPointer)node->data); - XtFree((XtPointer)node); - - node = next; - } -} - -static void -UpdateConfig(TreeNode *node) -{ - while (node) { - if (node->child) - UpdateConfig(node->child); - if (node->update) - (node->update)(node); - node = node->next; - } -} - -static Bool -ExpertInitialize(void) -{ - Widget paned, vpane, close, config, files, modules, flags, video, modes, - monitor, device, screen, input, layout, vendor, dri; - Arg args[4]; - Dimension width, height, canvasWidth, canvasHeight; - TreeNode *node; - - if (expert != NULL) - return (False); - - shell = XtCreatePopupShell("Expert", transientShellWidgetClass, - toplevel, NULL, 0); - paned = XtVaCreateManagedWidget("paned", panedWidgetClass, shell, - XtNorientation, XtorientHorizontal, NULL); - vpane = XtCreateManagedWidget("vpane", panedWidgetClass, paned, NULL, 0); - panner = XtCreateManagedWidget ("panner", pannerWidgetClass, vpane, NULL, 0); - close = XtCreateManagedWidget("close", commandWidgetClass, vpane, NULL, 0); - XtAddCallback(close, XtNcallback, PopdownCallback, NULL); - - expert = XtCreateManagedWidget("expert", portholeWidgetClass, paned, NULL, 0); - XtAddCallback(expert, XtNreportCallback, PortholeCallback, NULL); - XtAddCallback(panner, XtNreportCallback, PannerCallback, NULL); - tree = XtCreateManagedWidget("tree", treeWidgetClass, expert, NULL, 0); - - config = XtVaCreateManagedWidget(__XCONFIGFILE__, toggleWidgetClass, tree, - XtNstate, True, NULL); - mainNode = NewNode(NULL, config, config, NULL, NULL); - - files = XtVaCreateManagedWidget("Files", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node = NewNode(mainNode, files, files, config, NULL); - mainNode->child = node; - CreateFiles(node); - - modules = XtVaCreateManagedWidget("Module", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, modules, modules, config, NULL); - node = node->next; - CreateModule(node, XF86Config->conf_modules ? - XF86Config->conf_modules->mod_load_lst : NULL); - - flags = XtVaCreateManagedWidget("ServerFlags", commandWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, flags, NULL, config, NULL); - node = node->next; - if (XF86Config->conf_flags == NULL) - XF86Config->conf_flags = (XF86ConfFlagsPtr) - XtCalloc(1, sizeof(XF86ConfFlagsRec)); - XtAddCallback(flags, XtNcallback, OptionsCallback, - (XtPointer)&(XF86Config->conf_flags->flg_option_lst)); - - video = XtVaCreateManagedWidget("VideoAdaptor", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, video, video, config, NULL); - node = node->next; - CreateVideoAdaptor(node, XF86Config->conf_videoadaptor_lst); - - modes = XtVaCreateManagedWidget("Mode", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, modes, modes, config, NULL); - node = node->next; - CreateModes(node, XF86Config->conf_modes_lst); - - monitor = XtVaCreateManagedWidget("Monitor", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, monitor, monitor, config, NULL); - node = node->next; - CreateMonitor(monitorTree = node, XF86Config->conf_monitor_lst); - - device = XtVaCreateManagedWidget("Device", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, device, device, config, NULL); - node = node->next; - CreateDevice(node, XF86Config->conf_device_lst); - - screen = XtVaCreateManagedWidget("Screen", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, screen, screen, config, NULL); - node = node->next; - CreateScreen(screenTree = node, XF86Config->conf_screen_lst); - - input = XtVaCreateManagedWidget("Input", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, input, input, config, NULL); - node = node->next; - CreateInput(node, XF86Config->conf_input_lst); - - layout = XtVaCreateManagedWidget("Layout", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, layout, layout, config, NULL); - node = node->next; - CreateLayout(layoutTree = node, XF86Config->conf_layout_lst); - - vendor = XtVaCreateManagedWidget("Vendor", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, vendor, vendor, config, NULL); - node = node->next; - CreateVendor(node, XF86Config->conf_vendor_lst); - - dri = XtVaCreateManagedWidget("DRI", toggleWidgetClass, tree, - XtNtreeParent, config, NULL); - node->next = NewNode(mainNode, dri, dri, config, NULL); - node = node->next; - if (XF86Config->conf_dri == NULL) - XF86Config->conf_dri = (XF86ConfDRIPtr) - XtCalloc(1, sizeof(XF86ConfDRIRec)); - CreateDRI(node, XF86Config->conf_dri); - - XtRealizeWidget(shell); - - XtSetArg(args[0], XtNwidth, &width); - XtSetArg(args[1], XtNheight, &height); - XtGetValues(shell, args, 2); - XtSetArg(args[0], XtNwidth, width); - XtSetArg(args[1], XtNheight, height); - XtSetValues(expert, args, 2); - - XtSetArg(args[0], XtNsliderWidth, width); - XtSetArg(args[1], XtNsliderHeight, height); - XtSetArg(args[2], XtNwidth, &canvasWidth); - XtSetArg(args[3], XtNheight, &canvasHeight); - XtGetValues(tree, args + 2, 2); - XtSetArg(args[2], XtNcanvasWidth, canvasWidth); - XtSetArg(args[3], XtNcanvasHeight, canvasHeight); - XtSetValues(panner, args, 4); - - /* needs to do the apparently NOP code bellow to correctly layout the - * tree widget */ - - /* close all open entries */ - ToggleCallback(config, mainNode, (XtPointer)0); - /* open first level */ - ToggleCallback(config, mainNode, (XtPointer)1); - - XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); - - return (True); -} diff --git a/hw/xfree86/utils/xorgcfg/help.c b/hw/xfree86/utils/xorgcfg/help.c deleted file mode 100644 index cd5c2c2f4..000000000 --- a/hw/xfree86/utils/xorgcfg/help.c +++ /dev/null @@ -1,1785 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include <X11/IntrinsicP.h> -#include <X11/StringDefs.h> -#include <X11/Shell.h> -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/Command.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Paned.h> - -#include <X11/Xaw/Text.h> -#include <X11/Xaw/TextSinkP.h> -#include <X11/Xaw/TextSrcP.h> -#include <X11/Xmu/SysUtil.h> -#include <X11/Xmu/Xmu.h> -#include <stdlib.h> /* for bsearch() */ -#include <ctype.h> -#include "help.h" -#include "options.h" - -/* - * Prototypes - */ -static void CloseCallback(Widget, XtPointer, XtPointer); -static void StartHelp(void); -void Html_ModeStart(Widget); - -/* - * Initialization - */ -static Widget shell, text; -static Bool popped_up = False; - -/* - * Implementation - */ -void -Help(char *topic) -{ - Widget source; - char *str = NULL; - Bool error = False; - static char *def_text = "<h2>Help Error</h2>" - "No help available for the topic <b>%s</b>."; - XtResource resource = { - NULL, "HelpMessage", XtRString, sizeof(char*), - 0, XtRString, NULL - }; - - StartHelp(); - source = XawTextGetSource(text); - XawTextSourceClearEntities(source, 0, - XawTextSourceScan(source, 0, XawstAll, - XawsdRight, 1, True)); - if (topic != NULL) { - resource.resource_name = topic; - XtGetApplicationResources(shell, (XtPointer)&str, - &resource, 1, NULL, 0); - } - if (str == NULL) { - int len; - - error = True; - if (topic == NULL) - topic = "(null argument)"; - str = XtMalloc(len = strlen(topic) + strlen(def_text) + 1); - XmuSnprintf(str, len, def_text, topic); - } - XtVaSetValues(text, XtNstring, str, NULL); - if (error) - XtFree(str); - - Html_ModeStart(source); - _XawTextBuildLineTable((TextWidget)text, - XawTextTopPosition(text), True); - XawTextDisplay(text); - if (popped_up == False) { - popped_up = True; - XtPopup(shell, XtGrabNone); - XtSetKeyboardFocus(shell, text); - } -} - -static void -StartHelp(void) -{ - static XtResource resource = { - "properties", "Properties", XtRString, sizeof(char*), - 0, XtRString, NULL - }; - - if (shell == NULL) { - Widget pane, commands, close; - char *props; - XawTextPropertyList *propl; - - shell = XtCreatePopupShell("help", transientShellWidgetClass, - toplevel, NULL, 0); - pane = XtCreateManagedWidget("pane", panedWidgetClass, - shell, NULL, 0); - text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, - pane, XtNeditType, XawtextRead, NULL); - commands = XtCreateManagedWidget("commands", formWidgetClass, pane, - NULL, 0); - close = XtCreateManagedWidget("close", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(close, XtNcallback, CloseCallback, NULL); - XtRealizeWidget(shell); - XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); - XtGetApplicationResources(text, (XtPointer)&props, - &resource, 1, NULL, 0); - propl = XawTextSinkConvertPropertyList("html", props, - toplevel->core.screen, - toplevel->core.colormap, - toplevel->core.depth); - XtVaSetValues(XawTextGetSink(text), XawNtextProperties, propl, NULL); - } -} - -/*ARGSUSED*/ -static void -CloseCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtPopdown(shell); - popped_up = False; -} - -/*ARGSUSED*/ -void -HelpCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - CloseCallback(w, NULL, NULL); -} - - -/* bellow is a modified version of the html-mode.c I wrote for xedit - * (at least) temporarily dead. - */ - -/* - * Copyright (c) 1999 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 XFREE86 PROJECT 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 XFree86 Project 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 - * XFree86 Project. - * - * Author: Paulo César Pereira de Andrade - */ - -#define Html_Peek(parser) ((parser)->next) - -/* - * Types - */ -typedef struct _Html_Parser Html_Parser; -typedef struct _Html_Item Html_Item; - -typedef struct _Html_TagInfo { - char *name; - unsigned int entity : 1; /* it changes the type of the text */ - unsigned int nest : 1; /* does not close tags automatically */ - unsigned int end : 1; /* need a close markup */ - unsigned int adnl : 1; /* add newline before/after tag contents */ - unsigned int para : 1; /* changes the paragraph formatting */ - unsigned long mask; /* enforce use of attributes of this tag-info */ - unsigned long xlfd_mask; - void (*parse_args)(Html_Parser*, Html_Item*); - XawTextProperty *override; - XrmQuark ident; -} Html_TagInfo; - -struct _Html_Item { - XrmQuark ident; - XawTextPosition start, end; - Html_TagInfo *info; - - XawTextProperty *combine; - Bool override; - int li; - - XtPointer replace; - - Html_Item *parent, *child, *next; -}; - -struct _Html_Parser { - Widget source; - XawTextBlock block, replace; - XawTextPosition position, offset, start, end, last; - XrmQuark quark; - int i, ch, next; - Html_Item *item, *head; - XmuScanline *mask; - int space, pre, adnl, list, desc, column; - Bool spc; - XawTextBlock *entity; - - Pixel alink; -}; - -typedef struct _Html_SourceInfo Html_SourceInfo; -struct _Html_SourceInfo { - Widget source; - XawTextBlock block; - XawTextPosition last; - Html_SourceInfo *next; -}; - -/* - * Proptotypes - */ -void Html_ModeEnd(Widget); -static void Html_ModeInit(void); -static void Html_ParseCallback(Widget, XtPointer, XtPointer); -static Html_TagInfo *Html_GetInfo(char*); -static int Html_Get(Html_Parser*); -static int Html_Parse1(Html_Parser*); -static int Html_Parse2(Html_Parser*); -static void Html_ParseTag(Html_Parser*); -static void Html_Commit(Html_Parser*); -static void Html_AddEntities(Html_Parser*, Html_Item*); - -static int Html_Put(Html_Parser*, int); -static void Html_Puts(Html_Parser*, char*); -static int Html_Format1(Html_Parser*); -static int Html_Format2(Html_Parser*); -static int Html_Format3(Html_Parser*); -static void Html_FormatTag(Html_Parser*); - -static void Html_AArgs(Html_Parser*, Html_Item*); -static void Html_FontArgs(Html_Parser*, Html_Item*); - -/* - * Initialization - */ -static XrmQuark - Qbr, - Qdefault, - Qdd, - Qdl, - Qdt, - Qentity, - Qetag, - Qhide, - Qli, - Qol, - Qp, - Qpre, - Qspace, - Qtag, - Qul; - -static Html_TagInfo tag_info[] = { - {"a", 1, 0, 1, 0, 0, - 0, 0, - Html_AArgs}, - {"address", 1, 0, 1, 0, 0, - 0, XAW_TPROP_SLANT, - }, - {"b", 1, 0, 1, 0, 0, - 0, XAW_TPROP_WEIGHT, - }, - {"blockquote", 0, 1, 1, 1, 1, - 0, 0, - }, - {"body", 0, 0, 1, 0, 0, - 0, 0, - }, - {"br", 0, 0, 0, 0, 0, - }, - {"code", 1, 0, 1, 0, 0, - 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE, - }, - {"dd", 0, 1, 1, 0, 1, - 0, 0}, - {"dl", 0, 1, 1, 0, 0, - 0, 0, - }, - {"dt", 0, 0, 1, 0, 0, - 0, 0}, - {"em", 1, 0, 1, 0, 0, - 0, XAW_TPROP_SLANT, - }, - {"font", 1, 1, 1, 0, 0, - 0, 0, - Html_FontArgs}, - {"h1", 1, 0, 1, 1, 0, - 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE, - }, - {"h2", 1, 0, 1, 1, 0, - 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE, - }, - {"h3", 1, 0, 1, 1, 0, - 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE, - }, - {"h4", 1, 0, 1, 1, 0, - 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE, - }, - {"h5", 1, 0, 1, 1, 0, - 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE, - }, - {"h6", 1, 0, 1, 1, 0, - 0, XAW_TPROP_WEIGHT | XAW_TPROP_PIXELSIZE, - }, - {"head", 0, 0, 1, 0, 0, - 0, 0, - }, - {"html", 0, 0, 1, 0, 0, - 0, 0, - }, - {"i", 1, 0, 1, 0, 0, - 0, XAW_TPROP_SLANT, - }, - {"kbd", 1, 0, 1, 0, 0, - 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE, - }, - {"li", 0, 0, 0, 0, 0, - 0, 0}, - {"ol", 0, 1, 1, 0, 1, - 0, 0, - }, - {"p", 0, 0, 0, 1, 0, - }, - {"pre", 1, 0, 1, 1, 0, - 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE, - }, - {"samp", 1, 0, 1, 0, 0, - 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE, - }, - {"strong", 1, 0, 1, 0, 0, - 0, XAW_TPROP_WEIGHT, - }, - {"tt", 1, 0, 1, 0, 0, - 0, XAW_TPROP_FAMILY | XAW_TPROP_PIXELSIZE, - }, - {"ul", 0, 1, 1, 0, 1, - 0, 0, - }, -}; - -static char *pnl = "<p>\n", *nlpnl = "\n<p>\n"; -static Html_SourceInfo *source_info; - -/* - * Implementation - */ -static char * -Html_GetText(Widget src, XawTextPosition position) -{ - char *result, *tempResult; - XawTextPosition offset = 0; - XawTextBlock text; - - tempResult = result = XtMalloc((unsigned)(position + 1)); - - while (offset < position) { - offset = XawTextSourceRead(src, offset, &text, position - offset); - if (!text.length) - break; - memcpy(tempResult, text.ptr, (unsigned)text.length); - tempResult += text.length; - } - - *tempResult = '\0'; - - return (result); -} - -void -Html_ModeStart(Widget src) -{ - Html_Parser *parser = XtNew(Html_Parser); - Html_Item *next, *item; - XColor color, exact; - Html_SourceInfo *info = XtNew(Html_SourceInfo); - - if (XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, - "blue", &color, &exact)) - parser->alink = color.pixel; - else - parser->alink = 0L; - - XtVaSetValues(src, XtNeditType, XawtextEdit, NULL); - - Html_ModeInit(); - - /* initialize parser state */ - parser->source = src; - parser->position = XawTextSourceRead(parser->source, 0, - &parser->block, 4096); - parser->replace.ptr = NULL; - parser->replace.firstPos = 0; - parser->replace.length = 0; - parser->replace.format = FMT8BIT; - parser->offset = -1; - parser->quark = NULLQUARK; - parser->i = 0; - parser->i = parser->ch = parser->next = 0; - parser->last = XawTextSourceScan(src, 0, XawstAll, XawsdRight, 1, 1); - if (parser->block.length == 0) - parser->ch = parser->next = EOF; - else - (void)Html_Get(parser); - parser->pre = 0; - parser->adnl = 1; - parser->list = parser->desc = parser->column = 0; - parser->spc = True; - - info->source = src; - info->block.ptr = Html_GetText(src, parser->last); - info->block.length = parser->last; - info->block.format = FMT8BIT; - info->block.firstPos = 0; - info->next = NULL; - if (source_info == NULL) - source_info = info; - else { - Html_SourceInfo *tmp = source_info; - - while (tmp->next) - tmp = tmp->next; - tmp->next = info; - } - - while (Html_Format1(parser) != EOF) - ; - XawTextSourceReplace(parser->source, 0, parser->last, &parser->replace); - XtFree(parser->replace.ptr); - - /* re-initialize parser state */ - parser->position = XawTextSourceRead(parser->source, 0, - &parser->block, 4096); - parser->offset = -1; - parser->quark = NULLQUARK; - parser->i = parser->ch = parser->next = 0; - parser->last = XawTextSourceScan(src, 0, XawstAll, XawsdRight, 1, 1); - info->last = parser->last; - if (parser->block.length == 0) - parser->ch = parser->next = EOF; - else - (void)Html_Get(parser); - parser->adnl = 1; - parser->list = parser->desc = parser->column = 0; - parser->spc = True; - parser->head = parser->item = NULL; - - parser->mask = XmuNewScanline(0, 0, 0); - - /* build html structure information */ - while (Html_Parse1(parser) != EOF) - ; - - /* create top level entity mask */ - (void)XmuScanlineNot(parser->mask, 0, parser->last); - - item = parser->item; - while (item) { - next = item->next; - Html_AddEntities(parser, item); - if (item->combine) - XtFree((XtPointer)item->combine); - XtFree((XtPointer)item); - item = next; - } - XmuDestroyScanline(parser->mask); - - XtVaSetValues(src, XtNeditType, XawtextRead, NULL); - - XtFree((XtPointer)parser); - - /* add callbacks for interactive changes */ - XtAddCallback(src, XtNpropertyCallback, Html_ParseCallback, NULL); -} - -void -Html_ModeEnd(Widget src) -{ - Html_SourceInfo *info, *pinfo; - - XtRemoveCallback(src, XtNpropertyCallback, Html_ParseCallback, NULL); - for (pinfo = info = source_info; info; pinfo = info, info = info->next) - if (info->source == src) - break; - - if (info == NULL) - return; - - XawTextSourceClearEntities(src, 0, info->last); - XtVaSetValues(src, XtNeditType, XawtextEdit, NULL); - XawTextSourceReplace(src, 0, info->last, &info->block); - XtVaSetValues(src, XtNeditType, XawtextRead, NULL); - - if (info == source_info) - source_info = source_info->next; - else - pinfo->next = info->next; - XtFree(info->block.ptr); - XtFree((XtPointer)info); -} - -static void -Html_ParseCallback(Widget w, XtPointer client_data, XtPointer call_data) -{ -} - -static int -bcmp_tag_info(_Xconst void *left, _Xconst void *right) -{ - return (strcmp((char*)left, ((Html_TagInfo*)right)->name)); -} - -static Html_TagInfo * -Html_GetInfo(char *name) -{ - return (bsearch(name, tag_info, sizeof(tag_info) / sizeof(tag_info[0]), - sizeof(Html_TagInfo), bcmp_tag_info)); -} - -static int -Html_Get(Html_Parser *parser) -{ - if (parser->ch == EOF) - return (EOF); - if (parser->i >= parser->block.length) { - parser->i = 0; - parser->position = XawTextSourceRead(parser->source, parser->position, - &parser->block, 4096); - } - parser->ch = parser->next; - if (parser->block.length == 0) - parser->next = EOF; - else - parser->next = (unsigned char)parser->block.ptr[parser->i++]; - parser->offset++; - - return (parser->ch); -} - -static void -Html_ModeInit(void) -{ - static int initialized; - int i; - - if (initialized) - return; - - Qbr = XrmPermStringToQuark("br"); - Qdd = XrmPermStringToQuark("dd"); - Qdefault = XrmPermStringToQuark("default"); - Qdl = XrmPermStringToQuark("dl"); - Qdt = XrmPermStringToQuark("dt"); - Qentity = XrmPermStringToQuark("entity"); - Qetag = XrmPermStringToQuark("/tag"); - Qhide = XrmPermStringToQuark("hide"); - Qli = XrmPermStringToQuark("li"); - Qol = XrmPermStringToQuark("ol"); - Qp = XrmPermStringToQuark("p"); - Qpre = XrmPermStringToQuark("pre"); - Qspace = XrmPermStringToQuark("space"); - Qtag = XrmPermStringToQuark("tag"); - Qul = XrmPermStringToQuark("ul"); - - for (i = 0; i < sizeof(tag_info) / sizeof(tag_info[0]); i++) - tag_info[i].ident = XrmPermStringToQuark(tag_info[i].name); - - initialized = True; -} - -/************************************************************************/ -/* PARSE */ -/************************************************************************/ -static void -Html_AddEntities(Html_Parser *parser, Html_Item *item) -{ - Html_Item *parent, *next, *child = item->child; - XmuSegment segment, *ent; - XmuScanline *mask = XmuNewScanline(0, 0, 0); - XawTextProperty *tprop, *property = NULL; - Widget sink; - Bool changed = False; - - /* combine properties */ - if (item->info && - (item->info->entity || - (item->parent && item->parent->ident != item->parent->info->ident))) { - sink = XawTextGetSink(text); - parent = item->parent; - property = XawTextSinkCopyProperty(sink, item->ident); - property->mask = item->info->mask; - property->xlfd_mask = item->info->xlfd_mask; - if (parent) { - (void)XawTextSinkCombineProperty(sink, property, - XawTextSinkGetProperty(sink, parent->ident), False); - if (item->combine && parent->combine) - (void)XawTextSinkCombineProperty(sink, item->combine, - parent->combine, - item->override); - } - if (item->combine) - XawTextSinkCombineProperty(sink, property, item->combine, True); - tprop = property; - property = XawTextSinkAddProperty(sink, property); - XtFree((XtPointer)tprop); - if (property && item->ident != property->identifier) { - item->ident = property->identifier; - changed = True; - } - } - - if (item->end < 0) { - if (item->next) - item->end = item->next->start; - else if (item->parent) - item->end = item->parent->end; - else - item->end = parser->last; - } - - while (child) { - next = child->next; - segment.x1 = child->start; - segment.x2 = child->end; - (void)XmuScanlineOrSegment(mask, &segment); - Html_AddEntities(parser, child); - if (child->combine) - XtFree((XtPointer)child->combine); - XtFree((XtPointer)child); - child = next; - } - - /* build entity mask */ - (void)XmuScanlineNot(mask, item->start, item->end); - (void)XmuScanlineAnd(mask, parser->mask); - - /* add entities */ - if (item->info && changed) { - for (ent = mask->segment; ent; ent = ent->next) - (void)XawTextSourceAddEntity(parser->source, 0, 0, NULL, ent->x1, - ent->x2 - ent->x1, item->ident); - } - else if (item->info == NULL) - (void)XawTextSourceAddEntity(parser->source, 0, - XAW_TENTF_READ | XAW_TENTF_REPLACE, - item->replace, item->start, - item->end - item->start, - item->parent->ident); - - /* set mask for parent entities */ - (void)XmuScanlineOr(parser->mask, mask); - XmuDestroyScanline(mask); - -#if 0 - if (item->info && item->info->para) { - XawTextSourceSetParagraph(parser->source, item->start, item->end, - 40, /* arbitrary value, for testing */ - 0, 0); - } -#endif -} - -static void -Html_Commit(Html_Parser *parser) -{ - XawTextPosition position; - int length; - - position = parser->start; - length = parser->end - parser->start; - if (position < 0) { - length += position; - position = 0; - } - if (position + length > parser->last + 1) - length -= (position + length) - parser->last + 1; - - if (parser->quark != Qdefault && parser->quark != NULLQUARK && length > 0) { - XmuSegment segment; - Html_Item *head = parser->head; - XrmQuark quark = parser->quark; - - parser->quark = Qdefault; - - if (quark == Qli && head && - (head->info->ident == Qol || head->info->ident == Qul)) { - if (parser->head == NULL || head->info->ident != Qol) - XawTextSourceAddEntity(parser->source, 0, /*XAW_TENT_BULLET,*/ - XAW_TENTF_HIDE, NULL, - position, length, Qli); - else - XawTextSourceAddEntity(parser->source, 0, /*XAW_TENT_LITEM,*/ - XAW_TENTF_HIDE, - (XtPointer)(long)head->li++, - position, length, Qli); - } - else if (quark == Qhide) - XawTextSourceAddEntity(parser->source, 0, XAW_TENTF_HIDE, NULL, - position, length, quark); - else if (quark == Qentity) { - if (head && head->end == -1) { - Html_Item *item, *it; - - item = XtNew(Html_Item); - item->ident = Qentity; - item->start = position; - item->end = position + length; - item->info = NULL; - item->combine = NULL; - item->override = False; - item->replace = (XtPointer)parser->entity; - item->child = item->next = NULL; - - it = head->child; - - item->parent = head; - if (it == NULL) - head->child = item; - else { - while (it->next) - it = it->next; - it->next = item; - } - - return; - } - XawTextSourceAddEntity(parser->source, 0, - XAW_TENTF_READ | XAW_TENTF_REPLACE, - (XtPointer)parser->entity, - position, length, Qentity); - } - - segment.x1 = position; - segment.x2 = position + length; - (void)XmuScanlineOrSegment(parser->mask, &segment); - } -} - -static void -Html_ParseTag(Html_Parser *parser) -{ - int ch, sz; - char buf[32]; - Html_TagInfo *info; - Html_Item *item = NULL; - XawTextPosition offset = parser->offset - 1; - - switch (Html_Peek(parser)) { - case '!': - (void)Html_Get(parser); /* eat `!' */ - if (Html_Peek(parser) == '-') { - /* comment */ - (void)Html_Get(parser); /* eat `-' */ - if (Html_Peek(parser) == '-') { - int count = 0; - - (void)Html_Get(parser); - while ((ch = Html_Peek(parser)) != EOF) { - if (ch == '>' && count >= 2) - break; - else if (ch == '-') - ++count; - else - count = 0; - (void)Html_Get(parser); - } - } - } - break; - case '?': - break; - case '/': - (void)Html_Get(parser); /* eat `/' */ - sz = 0; - while (isalnum(Html_Peek(parser)) && - ((sz + 1) < sizeof(buf))) - buf[sz++] = tolower(Html_Get(parser)); - buf[sz] = '\0'; - if ((info = Html_GetInfo(buf)) != NULL) { - if (parser->head) { - Html_Item *it = parser->head; - - while (it) { - if (it->info == info) - break; - it = it->parent; - } - - if (it) { - if (it == parser->head) - parser->head->end = offset; - else { - it->end = offset; - do { - parser->head->end = offset; - parser->head = parser->head->parent; - } while (parser->head != it); - } - if (parser->head->parent) - parser->head = parser->head->parent; - else - parser->head = parser->item; - } - } - } - break; - default: - sz = 0; - while (isalnum(Html_Peek(parser)) && - ((sz + 1) < sizeof(buf))) - buf[sz++] = tolower(Html_Get(parser)); - buf[sz] = '\0'; - if ((info = Html_GetInfo(buf)) != NULL) { - if (info->end == False) { - if (info->ident == Qli) - parser->quark = Qli; - if (!info->para) - break; /* no more processing required */ - } - item = XtNew(Html_Item); - item->info = info; - item->ident = item->info->ident; - item->combine = NULL; - item->override = False; - item->start = item->end = -1; - if (info->ident == Qol) - item->li = 1; - else - item->li = 0; - item->parent = item->child = item->next = NULL; - if (parser->item == NULL) - parser->item = parser->head = item; - else if (parser->head->end == -1) { - if (parser->head->info != item->info || info->nest) { - Html_Item *it = parser->head; - - /* first, see if we need to close a long list of tags */ - if (info->ident == Qdd) { - if (parser->head && - parser->head->info->ident == Qdt) { - parser->head->end = offset; - parser->head = parser->head->parent; - } - } - else if (info->ident == Qdt) { - if (parser->head && - parser->head->info->ident == Qdd) { - parser->head->end = offset; - parser->head = parser->head->parent; - } - } - else if (!info->nest) { - while (it) { - if (it->info == info || it->info->end) - break; - it = it->parent; - } - if (it) { - /* close the items */ - while (parser->head != it) { - if (parser->head->info->ident == Qpre) - --parser->pre; - parser->head->end = offset; - parser->head = parser->head->parent; - } - } - } - - /* add child item */ - it = parser->head->child; - - item->parent = parser->head; - if (it == NULL) - parser->head->child = item; - else { - while (it->next) - it = it->next; - it->next = item; - } - parser->head = item; - } - else { - /* close the `head' item and start a new one */ - Html_Item *it; - - parser->head->end = offset; - if (parser->head->parent) - parser->head = parser->head->parent; - else - parser->head = parser->item; - - if ((it = parser->head->child) != NULL) { - item->parent = parser->head; - while (it->next) - it = it->next; - it->next = item; - parser->head = item; - } - else { - parser->head->child = item; - parser->head = item; - } - } - } - else { - /* this is not common, but handle it */ - Html_Item *it = parser->item; - - while (it->next) - it = it->next; - it->next = item; - parser->head = item; - } - if (info->parse_args) - (info->parse_args)(parser, item); - } - break; - } - - /* skip anything not processed */ - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) - (void)Html_Get(parser); - if (item && item->start == -1) - item->start = parser->offset + 1; -} - -/* tags */ -static int -Html_Parse2(Html_Parser *parser) -{ - int ch; - - for (;;) { - if ((ch = Html_Get(parser)) == '<') { - parser->end = parser->offset - 1; - Html_Commit(parser); - parser->quark = Qhide; - parser->start = parser->end; - - Html_ParseTag(parser); - - (void)Html_Get(parser); /* eat `>' */ - parser->end = parser->offset; - Html_Commit(parser); - } - else - return (ch); - } - /*NOTREACHED*/ -} - -/* entities */ -static int -Html_Parse1(Html_Parser *parser) -{ - static XawTextBlock *entities[256]; - static char chars[256]; - int ch; - - for (;;) { - if ((ch = Html_Parse2(parser)) == EOF) - return (EOF); - - if (ch == '&') { - unsigned char idx = '?'; - char buf[32]; - int sz = 0; - - /* the string comparisons need a big optmization! */ - parser->end = parser->offset - 1; - Html_Commit(parser); - parser->start = parser->end; - while ((ch = Html_Peek(parser)) != ';' - && ch != EOF && !isspace(ch)) { - ch = Html_Get(parser); - if (sz + 1 < sizeof(buf)) - buf[sz++] = ch; - } - buf[sz] = '\0'; - if (ch == ';') - (void)Html_Get(parser); - if (sz == 0) - idx = '&'; - else if (strcasecmp(buf, "lt") == 0) - idx = '<'; - else if (strcasecmp(buf, "gt") == 0) - idx = '>'; - else if (strcasecmp(buf, "nbsp") == 0) - idx = ' '; - else if (strcasecmp(buf, "amp") == 0) - idx = '&'; - else if (strcasecmp(buf, "quot") == 0) - idx = '"'; - else if (*buf == '#') { - if (sz == 1) - idx = '#'; - else { - char *tmp; - - idx = strtol(buf + 1, &tmp, 10); - if (*tmp) - idx = '?'; - } - } - else if (strcmp(buf + 1, "acute") == 0) { - switch (*buf) { - case 'a': idx = 0xe1; break; case 'e': idx = 0xe9; break; - case 'i': idx = 0xed; break; case 'o': idx = 0xf3; break; - case 'u': idx = 0xfa; break; case 'A': idx = 0xc1; break; - case 'E': idx = 0xc9; break; case 'I': idx = 0xcd; break; - case 'O': idx = 0xd3; break; case 'U': idx = 0xda; break; - case 'y': idx = 0xfd; break; case 'Y': idx = 0xdd; break; - } - } - else if (strcmp(buf + 1, "grave") == 0) { - switch (*buf) { - case 'a': idx = 0xe0; break; case 'e': idx = 0xe8; break; - case 'i': idx = 0xec; break; case 'o': idx = 0xf2; break; - case 'u': idx = 0xf9; break; case 'A': idx = 0xc0; break; - case 'E': idx = 0xc8; break; case 'I': idx = 0xcc; break; - case 'O': idx = 0xd2; break; case 'U': idx = 0xd9; break; - } - } - else if (strcmp(buf + 1, "tilde") == 0) { - switch (*buf) { - case 'a': idx = 0xe3; break; case 'o': idx = 0xf5; break; - case 'n': idx = 0xf1; break; case 'A': idx = 0xc3; break; - case 'O': idx = 0xd5; break; case 'N': idx = 0xd1; break; - } - } - else if (strcmp(buf + 1, "circ") == 0) { - switch (*buf) { - case 'a': idx = 0xe2; break; case 'e': idx = 0xea; break; - case 'i': idx = 0xee; break; case 'o': idx = 0xf4; break; - case 'u': idx = 0xfb; break; case 'A': idx = 0xc2; break; - case 'E': idx = 0xca; break; case 'I': idx = 0xce; break; - case 'O': idx = 0xd4; break; case 'U': idx = 0xdb; break; - } - } - else if (strcmp(buf + 1, "uml") == 0) { - switch (*buf) { - case 'a': idx = 0xe4; break; case 'e': idx = 0xeb; break; - case 'i': idx = 0xef; break; case 'o': idx = 0xf6; break; - case 'u': idx = 0xfc; break; case 'A': idx = 0xc4; break; - case 'E': idx = 0xcb; break; case 'I': idx = 0xfc; break; - case 'O': idx = 0xd6; break; case 'U': idx = 0xdc; break; - case 'y': idx = 0xff; break; - } - } - else if (strcmp(buf + 1, "cedil") == 0) { - switch (*buf) { - case 'c': idx = 0xe7; break; case 'C': idx = 0xc7; break; - } - } - else if (strcmp(buf + 1, "slash") == 0) { - switch (*buf) { - case 'o': idx = 0xf8; break; case 'O': idx = 0xd8; break; - } - } - else if (strcmp(buf + 1, "ring") == 0) { - switch (*buf) { - case 'a': idx = 0xe5; break; case 'A': idx = 0xc5; break; - } - } - else if (strcasecmp(buf, "iexcl") == 0) - idx = 0xa1; - else if (strcasecmp(buf, "cent") == 0) - idx = 0xa2; - else if (strcasecmp(buf, "pound") == 0) - idx = 0xa3; - else if (strcasecmp(buf, "curren") == 0) - idx = 0xa4; - else if (strcasecmp(buf, "yen") == 0) - idx = 0xa5; - else if (strcasecmp(buf, "brvbar") == 0) - idx = 0xa6; - else if (strcasecmp(buf, "sect") == 0) - idx = 0xa7; - else if (strcasecmp(buf, "uml") == 0) - idx = 0xa8; - else if (strcasecmp(buf, "copy") == 0) - idx = 0xa9; - else if (strcasecmp(buf, "ordf") == 0) - idx = 0xaa; - else if (strcasecmp(buf, "laquo") == 0) - idx = 0xab; - else if (strcasecmp(buf, "not") == 0) - idx = 0xac; - else if (strcasecmp(buf, "shy") == 0) - idx = 0xad; - else if (strcasecmp(buf, "reg") == 0) - idx = 0xae; - else if (strcasecmp(buf, "macr") == 0) - idx = 0xaf; - else if (strcasecmp(buf, "deg") == 0) - idx = 0xb0; - else if (strcasecmp(buf, "plusmn") == 0) - idx = 0xb1; - else if (strcasecmp(buf, "sup2") == 0) - idx = 0xb2; - else if (strcasecmp(buf, "sup3") == 0) - idx = 0xb3; - else if (strcasecmp(buf, "acute") == 0) - idx = 0xb4; - else if (strcasecmp(buf, "micro") == 0) - idx = 0xb5; - else if (strcasecmp(buf, "para") == 0) - idx = 0xb6; - else if (strcasecmp(buf, "middot") == 0) - idx = 0xb7; - else if (strcasecmp(buf, "cedil") == 0) - idx = 0xb8; - else if (strcasecmp(buf, "supl") == 0) - idx = 0xb9; - else if (strcasecmp(buf, "ordm") == 0) - idx = 0xba; - else if (strcasecmp(buf, "raquo") == 0) - idx = 0xbb; - else if (strcasecmp(buf, "frac14") == 0) - idx = 0xbc; - else if (strcasecmp(buf, "frac12") == 0) - idx = 0xbd; - else if (strcasecmp(buf, "frac34") == 0) - idx = 0xbe; - else if (strcasecmp(buf, "iquest") == 0) - idx = 0xbf; - else if (strcasecmp(buf, "AElig") == 0) - idx = 0xc6; - else if (strcasecmp(buf, "ETH") == 0) - idx = 0xd0; - else if (strcasecmp(buf, "THORN") == 0) - idx = 0xde; - else if (strcasecmp(buf, "szlig") == 0) - idx = 0xdf; - else if (strcasecmp(buf, "aelig") == 0) - idx = 0xe6; - else if (strcasecmp(buf, "eth") == 0) - idx = 0xf0; - else if (strcasecmp(buf, "thorn") == 0) - idx = 0xfe; - - parser->quark = Qentity; - if (entities[idx] == NULL) { - entities[idx] = XtNew(XawTextBlock); - entities[idx]->firstPos = 0; - entities[idx]->length = 1; - entities[idx]->ptr = chars + idx; - entities[idx]->format = FMT8BIT; - chars[idx] = idx; - } - parser->entity = entities[idx]; - parser->end = parser->offset; - Html_Commit(parser); - parser->start = parser->end; - } - } - /*NOTREACHED*/ -} - -/************************************************************************/ -/* FORMAT */ -/************************************************************************/ -static int -Html_Put(Html_Parser *parser, int ch) -{ - if (ch != '\r') { - if (parser->replace.length % 4096 == 0) - parser->replace.ptr = XtRealloc(parser->replace.ptr, - parser->replace.length + 4096); - parser->replace.ptr[parser->replace.length++] = ch; - } - - return (ch); -} - -static void -Html_Puts(Html_Parser *parser, char *str) -{ - int len = strlen(str); - - if (parser->replace.length % 4096 == 0 || - parser->replace.length + len > parser->replace.length + - (4096 - (parser->replace.length % 4096))) - parser->replace.ptr = XtRealloc(parser->replace.ptr, - parser->replace.length + 4096); - memcpy(parser->replace.ptr + parser->replace.length, str, len); - parser->replace.length += len; -} - -static void -Html_FormatTag(Html_Parser *parser) -{ - int ch = 0, sz = 0; - char buf[32]; - Html_TagInfo *info = NULL; - - switch (Html_Peek(parser)) { - case '!': - Html_Put(parser, '<'); - Html_Put(parser, Html_Get(parser)); /* eat `!' */ - if (Html_Peek(parser) == '-') { - /* comment */ - Html_Put(parser, Html_Get(parser)); /* eat `-' */ - if (Html_Peek(parser) == '-') { - int count = 0; - - Html_Put(parser, Html_Get(parser)); - while ((ch = Html_Peek(parser)) != EOF) { - if (ch == '>' && count >= 2) - break; - else if (ch == '-') - ++count; - else - count = 0; - Html_Put(parser, Html_Get(parser)); - } - (void)Html_Get(parser); /* eat `>' */ - Html_Put(parser, '>'); - return; - } - } - break; - case '?': - Html_Put(parser, '<'); - break; - case '/': - (void)Html_Get(parser); /* eat `/' */ - while (isalnum(Html_Peek(parser)) && - ((sz + 1) < sizeof(buf))) - buf[sz++] = ch = tolower(Html_Get(parser)); - buf[sz] = '\0'; - if ((info = Html_GetInfo(buf)) != NULL && info->adnl) { - if (info->ident == Qpre && parser->pre) { - if (--parser->pre == 0) - parser->column = 0; - } - parser->quark = Qetag; - parser->spc = True; - if (info->ident == Qp) { - while ((ch = Html_Peek(parser) != '>' && ch != EOF)) - (void)Html_Get(parser); - (void)Html_Get(parser); /* eat '>' */ - return; - } - } - else if (info) { - if (info->ident == Qol || info->ident == Qul) { - if (parser->list && --parser->list == 0 && - parser->desc == 0) { - parser->quark = Qetag; - Html_Put(parser, '\n'); - ++parser->adnl; - parser->column = 0; - } - } - else if (info->ident == Qdl) { - if (parser->desc && --parser->desc == 0 && - parser->list == 0) { - parser->quark = Qetag; - Html_Put(parser, '\n'); - ++parser->adnl; - parser->column = 0; - } - } - } - Html_Puts(parser, "</"); - Html_Puts(parser, buf); - break; - default: - while (isalnum(Html_Peek(parser)) && - ((sz + 1) < sizeof(buf))) - buf[sz++] = tolower(Html_Get(parser)); - buf[sz] = '\0'; - if ((info = Html_GetInfo(buf)) != NULL && info->adnl) { - if (info->ident == Qpre) - ++parser->pre; - if (parser->quark != Qtag) { - if (parser->adnl < 2) { - Html_Puts(parser, parser->adnl ? pnl : nlpnl); - parser->adnl = 2; - parser->spc = True; - parser->column = 0; - } - } - parser->quark = Qtag; - if (info->ident == Qp) { - while ((ch = Html_Peek(parser) != '>' && ch != EOF)) - (void)Html_Get(parser); - (void)Html_Get(parser); /* eat '>' */ - return; - } - } - else if (info) { - if (info->ident == Qol || info->ident == Qul) { - if (++parser->list == 1 && !parser->desc) { - if (parser->adnl < 2) { - Html_Puts(parser, parser->adnl ? pnl : nlpnl); - parser->adnl = 2; - parser->column = 0; - } - } - else if (parser->adnl == 0) { - Html_Put(parser, '\n'); - parser->adnl = 1; - parser->column = 0; - } - parser->spc = True; - } - else if (info->ident == Qli) { - if (parser->adnl == 0) { - Html_Put(parser, '\n'); - parser->adnl = 1; - parser->column = 0; - } - } - - else if (info->ident == Qdl) { - if (++parser->desc == 1 && !parser->list) { - if (parser->adnl < 2) { - Html_Puts(parser, parser->adnl ? pnl : nlpnl); - parser->adnl = 2; - parser->column = 0; - } - } - else if (parser->adnl == 0) { - Html_Put(parser, '\n'); - parser->adnl = 1; - parser->column = 0; - } - parser->spc = True; - } - else if (info->ident == Qdd) { - if (parser->desc == 0) { - if (parser->adnl < 2) { - Html_Puts(parser, parser->adnl ? pnl : nlpnl); - parser->adnl = 2; - parser->column = 0; - } - } - else if (parser->adnl == 0) { - Html_Put(parser, '\n'); - parser->adnl = 1; - parser->column = 0; - } - parser->spc = True; - } - else if (info->ident == Qdt) { - if (parser->adnl == 0) { - Html_Put(parser, '\n'); - parser->adnl = 1; - parser->spc = True; - parser->column = 0; - } - } - } - Html_Put(parser, '<'); - Html_Puts(parser, buf); - break; - } - - sz = 0; - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) { - if (isspace(ch)) { - (void)Html_Get(parser); - ++sz; - continue; - } - else if (sz) { - Html_Put(parser, ' '); - sz = 0; - } - Html_Put(parser, Html_Get(parser)); - } - Html_Put(parser, Html_Get(parser)); /* eat `>' */ - if (info && info->ident == Qbr) { - ++parser->adnl; - parser->spc = True; - Html_Put(parser, '\n'); - parser->quark = info->ident; - parser->column = 0; - } -} - -/* tags */ -static int -Html_Format3(Html_Parser *parser) -{ - int ch; - - for (;;) { - if ((ch = Html_Get(parser)) == '<') { - if (parser->quark == Qspace && parser->spc == False) { - Html_Put(parser, ' '); - parser->spc = True; - } - -/* parser->quark = Qhide;*/ - Html_FormatTag(parser); - } - else - return (ch); - } - /*NOTREACHED*/ -} - -/* entities */ -static int -Html_Format2(Html_Parser *parser) -{ - int ch; - - for (ch = Html_Format3(parser); ch == '&'; ch = Html_Format3(parser)) { - Html_Put(parser, '&'); - while ((ch = Html_Peek(parser)) != ';') { - if (isspace(ch) || ch == EOF) - break; - Html_Put(parser, Html_Get(parser)); - } - if (ch != EOF) - Html_Put(parser, Html_Get(parser)); - else - break; - if (parser->pre) - ++parser->column; - } - - return (ch); -} - -/* spaces */ -static int -Html_Format1(Html_Parser *parser) -{ - int ch; - - for (;;) { - if ((ch = Html_Format2(parser)) == EOF) - return (ch); - - if (parser->quark == Qetag) { - if (parser->adnl < 2) { - Html_Puts(parser, parser->adnl ? pnl : nlpnl); - parser->adnl = 2; - parser->spc = True; - } - } - else if (parser->quark == Qspace && parser->spc == False) { - Html_Put(parser, ' '); - parser->spc = True; - } - - if (!parser->pre && isspace(ch)) - parser->quark = Qspace; - else { - if (parser->pre) { - if (parser->spc) { - /* did not yet see any non space character */ - if (isspace(ch)) { - if (ch == '\n') { - parser->column = 0; - parser->spc = False; - parser->adnl = 1; - } - else if (ch == '\t') - parser->column += 8 - (parser->column % 8); - else - ++parser->column; - continue; - } - else { - int column = parser->column; - - while (column-- > 0) - Html_Put(parser, ' '); - parser->spc = False; - parser->adnl = 0; - } - } - else if (ch == '\n') { - ++parser->adnl; - parser->column = 0; - } - else if (ch == '\t') { - int column = parser->column + (8 - (parser->column % 8)); - - parser->adnl = 0; - while (parser->column < column) { - Html_Put(parser, ' '); - ++parser->column; - } - continue; - } - else { - parser->adnl = 0; - ++parser->column; - } - } - else - parser->adnl = 0; - Html_Put(parser, ch); - parser->quark = Qdefault; - parser->spc = False; - } - } -} - -/************************************************************************/ -/* ARGUMENTS */ -/************************************************************************/ -static void -Html_AArgs(Html_Parser *parser, Html_Item *item) -{ - int ch, sz; - char buf[32]; - - /*CONSTCOND*/ - while (True) { - sz = 0; - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) { - if (isalnum(ch)) - break; - else - (void)Html_Get(parser); - } - - if (ch == '>' || ch == EOF) - return; - buf[sz++] = tolower(Html_Get(parser)); - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) - if (isalnum(ch)) - buf[sz++] = tolower(Html_Get(parser)); - else - break; - buf[sz] = '\0'; - if (strcmp(buf, "href") == 0) { - item->combine = XawTextSinkCopyProperty(XawTextGetSink(text), - item->info->ident); - item->override = True; - item->combine->xlfd_mask = 0L; - item->combine->mask = XAW_TPROP_UNDERLINE | XAW_TPROP_FOREGROUND; - item->combine->foreground = parser->alink; - return; - } - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) { - if (isspace(ch)) - break; - else - (void)Html_Get(parser); - } - } -} - -static void -Html_FontArgs(Html_Parser *parser, Html_Item *item) -{ - int ch, sz; - char name[32], value[256], xlfd[128]; - - item->combine = XawTextSinkCopyProperty(XawTextGetSink(text), - Qdefault); - item->override = True; - item->combine->mask = item->combine->xlfd_mask = 0L; - - /*CONSTCOND*/ - while (True) { - /* skip white spaces */ - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) { - if (isalnum(ch)) - break; - else - (void)Html_Get(parser); - } - - if (ch == '>' || ch == EOF) - return; - - /* read option name */ - sz = 0; - name[sz++] = tolower(Html_Get(parser)); - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) - if (isalnum(ch) && (sz + 1 < sizeof(name))) - name[sz++] = tolower(Html_Get(parser)); - else - break; - name[sz] = '\0'; - - if (ch != '=') - continue; - (void)Html_Get(parser); /* skip `=' */ - if (Html_Peek(parser) == '"') - (void)Html_Get(parser); - - sz = 0; - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) { - if (!isspace(ch) && (sz + 1 < sizeof(value))) - value[sz++] = Html_Get(parser); - else - break; - } - value[sz] = '\0'; - if (sz > 0 && value[sz - 1] == '"') - value[--sz] = '\0'; - - if (strcmp(name, "color") == 0) { - XColor color, exact; - - if (XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, - value, &color, &exact)) { - item->combine->mask |= XAW_TPROP_FOREGROUND; - item->combine->foreground = color.pixel; - } - } - else if (strcmp(name, "face") == 0) { - int count = 0; - char *ptr, *family, **font_list; - - ptr = value; - do { - family = ptr; - ptr = strchr(ptr, ','); - if (ptr) - *ptr++ = '\0'; - XmuSnprintf(xlfd, sizeof(xlfd), "-*-%s-*-*-*-*-*-*-*-*-*-*-*-*", - family); - font_list = XListFonts(XtDisplay(toplevel), xlfd, 1, &count); - if (font_list) - XFreeFontNames(font_list); - if (count) - break; - } while (ptr); - if (count) { - item->combine->xlfd_mask |= XAW_TPROP_FAMILY; - item->combine->family = XrmStringToQuark(family); - } - } - else if (strcmp(name, "size") == 0) { - int size, sign = 0; - - if (isalnum(*value)) { - size = atoi(value); - sign = 0; - } - else { - char *str = XrmQuarkToString(item->combine->pixel_size); - - size = str ? atoi(str) : 12; - if (*value == '+') { - size += atoi(value + 1); - sign = 1; - } - else if (*value == '-') { - size -= atoi(value + 1); - sign = -1; - } - } - - if (item->combine->xlfd != NULLQUARK) { - int count, ucount, dcount, usize, dsize; - char **current, **result, **up, **down; - - current = result = up = down = NULL; - /* try to load an appropriate font */ - XmuSnprintf(value, sizeof(value), - "-*-%s-%s-%s-*--%%d-*-*-*-*-*-%s-%s", - XrmQuarkToString(item->combine->family), - XrmQuarkToString(item->combine->weight), - XrmQuarkToString(item->combine->slant), - XrmQuarkToString(item->combine->registry), - XrmQuarkToString(item->combine->encoding)); - XmuSnprintf(xlfd, sizeof(xlfd), value, - atoi(XrmQuarkToString(item->combine->pixel_size))); - current = XListFonts(XtDisplay(toplevel), xlfd, 1, &count); - if (count) { - ucount = dcount = usize = dsize = 0; - - XmuSnprintf(xlfd, sizeof(xlfd), value, size); - result = XListFonts(XtDisplay(toplevel), xlfd, 1, &count); - if (count == 0 || strstr(*result, "-0-")) { - if (sign <= 0) { - sz = dsize = size; - while (dcount == 0 && --sz > size - 8 && sz > 1) { - XmuSnprintf(xlfd, sizeof(xlfd), value, sz); - down = XListFonts(XtDisplay(toplevel), xlfd, - 1, &dcount); - if (dcount && strstr(*down, "-0-") != NULL) { - XFreeFontNames(down); - down = NULL; - dcount = 0; - } - } - if (dcount) - dsize = sz; - } - if (sign >= 0) { - sz = usize = size; - while (ucount == 0 && ++sz < size + 8) { - XmuSnprintf(xlfd, sizeof(xlfd), value, sz); - up = XListFonts(XtDisplay(toplevel), xlfd, - 1, &ucount); - if (ucount && strstr(*up, "-0-") != NULL) { - XFreeFontNames(up); - up = NULL; - ucount = 0; - } - } - if (ucount) - usize = sz; - } - if (ucount && dcount) - size = size - dsize < usize - size ? dsize : usize; - else if (ucount) - size = usize; - else if (dcount) - size = dsize; - } - if (current) - XFreeFontNames(current); - if (result) - XFreeFontNames(result); - if (up) - XFreeFontNames(up); - if (down) - XFreeFontNames(down); - } - } - - XmuSnprintf(value, sizeof(value), "%d", size); - item->combine->xlfd_mask |= XAW_TPROP_PIXELSIZE; - item->combine->pixel_size = XrmStringToQuark(value); - } - - while ((ch = Html_Peek(parser)) != '>' && ch != EOF) { - if (isspace(ch)) - break; - else - (void)Html_Get(parser); - } - } -} diff --git a/hw/xfree86/utils/xorgcfg/help.h b/hw/xfree86/utils/xorgcfg/help.h deleted file mode 100644 index 141f50402..000000000 --- a/hw/xfree86/utils/xorgcfg/help.h +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - */ - -/* help string definitions */ -#define HELP_DEVICES "helpDevices" /* Configure Layout */ -#define HELP_SCREEN "helpScreen" /* Configure Screen */ -#define HELP_MODELINE "helpModeline" /* Configure Modeline */ -#define HELP_ACCESSX "helpAccessX" /* Configure AccessX */ - -/* - * Prototypes - */ -void Help(char*); -void HelpCancelAction(Widget, XEvent*, String*, Cardinal*); diff --git a/hw/xfree86/utils/xorgcfg/interface.c b/hw/xfree86/utils/xorgcfg/interface.c deleted file mode 100644 index cb39624ca..000000000 --- a/hw/xfree86/utils/xorgcfg/interface.c +++ /dev/null @@ -1,2278 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include <X11/IntrinsicP.h> -#include <X11/StringDefs.h> -#include <X11/Composite.h> -#include <X11/Shell.h> -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/Simple.h> -#include <X11/Xaw/Paned.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Command.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/SmeBSB.h> -#include <X11/Xaw/SmeLine.h> -#include <X11/Xaw/SimpleMenP.h> -#include <X11/Xaw/Dialog.h> -#include <stdio.h> -#include <stdlib.h> -#include <unistd.h> -#include <time.h> -#include "xf86config.h" -#include "mouse-cfg.h" -#include "keyboard-cfg.h" -#include "card-cfg.h" -#include "monitor-cfg.h" -#include "screen-cfg.h" -#include "screen.h" -#include "cards.h" -#include "options.h" -#include "vidmode.h" -#include "help.h" -#include "stubs.h" - -#define randomize() srand((unsigned)time((time_t*)NULL)) -#ifdef PROJECT_ROOT -#define DefaultXFree86Dir PROJECT_ROOT -#else -#define DefaultXFree86Dir "/usr" -#endif - -#define IS_KBDDRIV(S) ((strcasecmp((S),"kbd") == 0)) - -/* - * Prototypes - */ -void DrawCables(void); -static void DrawCable(Display*, Window, int, int, int, int); -static void ComputerEventHandler(Widget, XtPointer, XEvent*, Boolean*); -void SelectDeviceAction(Widget, XEvent*, String*, Cardinal*); -void MoveDeviceAction(Widget, XEvent*, String*, Cardinal*); -void UnselectDeviceAction(Widget, XEvent*, String*, Cardinal*); -void RenameLayoutAction(Widget, XEvent*, String*, Cardinal*); -void DevicePopupMenu(Widget, XEvent*, String*, Cardinal*); -void DevicePopdownMenu(Widget, XEvent*, String*, Cardinal*); -void AddDeviceCallback(Widget, XtPointer, XtPointer); -void QuitCallback(Widget, XtPointer, XtPointer); -void SmeConfigureDeviceCallback(Widget, XtPointer, XtPointer); -void ConfigureDeviceCallback(Widget, XtPointer, XtPointer); -void EnableDeviceCallback(Widget, XtPointer, XtPointer); -void DisableDeviceCallback(Widget, XtPointer, XtPointer); -void RemoveDeviceCallback(Widget, XtPointer, XtPointer); -void InitializeDevices(void); -void SetConfigModeCallback(Widget, XtPointer, XtPointer); -void SelectLayoutCallback(Widget, XtPointer, XtPointer); -void DefaultLayoutCallback(Widget, XtPointer, XtPointer); -void RemoveLayoutCallback(Widget, XtPointer, XtPointer); -void OptionsCallback(Widget, XtPointer, XtPointer); -xf86cfgDevice *AddDevice(int, XtPointer, int, int); -static Bool AskConfig(void); -void WriteConfigAction(Widget, XEvent*, String*, Cardinal*); -static void ScreenSetup(Bool); -void QuitAction(Widget, XEvent*, String*, Cardinal*); -void PopdownErrorCallback(Widget, XtPointer, XtPointer); -static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*); -static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*); -static void HelpCallback(Widget, XtPointer, XtPointer); -void UpdateMenuDeviceList(int); - -extern void AccessXConfigureStart(void); -extern void AccessXConfigureEnd(void); -extern void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*); - -#ifdef HAS_NCURSES -extern void TextMode(void); -#endif - -static void Usage(void); - -/* - * Initialization - */ -Widget toplevel, work, config, layout, layoutsme, layoutp, topMenu; -XtAppContext appcon; - -Pixmap menuPixmap; - -char *XF86Config_path = NULL; -char *XF86Module_path = NULL; -char *XFree86_path = NULL; -char *XF86Font_path = NULL; -char *XF86RGB_path = NULL; -char *XkbConfig_path = NULL; -char *XFree86Dir; -static char XF86Config_path_static[1024]; -static char XkbConfig_path_static[1024]; -Bool xf86config_set = False; - -int textmode = False; -#ifdef USE_MODULES -int nomodules = False; -#endif -int noverify = False; - -xf86cfgComputer computer; -xf86cfgDevice cpu_device; -Cursor no_cursor; -static Widget device, layoutm, popup, commands; -static int xpos, ypos; -int sxpos, sypos; -static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; -static GC cablegc, cablegcshadow; -Atom wm_delete_window; -static Bool config_set = False; -static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu, - cardSme, cardMenu, monitorSme, monitorMenu; - -int config_mode = CONFIG_LAYOUT; - -static XtActionsRec actions[] = { - {"filter-card", CardFilterAction}, - {"select-device", SelectDeviceAction}, - {"move-device", MoveDeviceAction}, - {"unselect-device", UnselectDeviceAction}, - {"device-popup", DevicePopupMenu}, - {"device-popdown", DevicePopdownMenu}, - {"rename-layout", RenameLayoutAction}, - {"write-config", WriteConfigAction}, - {"quit", QuitAction}, - {"vidmode-restore", VidmodeRestoreAction}, - {"config-cancel", ConfigCancelAction}, - {"options-cancel", OptionsCancelAction}, - {"error-cancel", ErrorCancelAction}, - {"quit-cancel", QuitCancelAction}, - {"addmode-cancel", CancelAddModeAction}, - {"accessx-close", CloseAccessXAction}, - {"testmode-cancel", CancelTestModeAction}, - {"help-close", HelpCancelAction}, - {"expert-close", ExpertCloseAction}, -#ifdef USE_MODULES - {"module-options-close", ModuleOptionsCancelAction}, -#endif -}; - -static char *device_names[] = { -/* MOUSE */ - "mouse", -/* KEYBOARD */ - "keyboard", -/* CARD */ - "card", -/* MONITOR */ - "monitor", -/* SCREEN */ - "screen", -}; - -static XtResource appResources[] = { -#if 0 - {"config", __XCONFIGFILE__, XtRString, sizeof(char*), - 0, XtRString, "/etc/X11/"__XCONFIGFILE__}, -#endif - {"menuBitmap", "MenuBitmap", XtRString, sizeof(char*), - 0, XtRString, "menu10"}, -}; - -static void -Usage(void) -{ - fprintf(stderr, -"Usage:\n" -" xorgcfg [-option ...]\n" -"\n" -"Options:\n" -" -config <"__XCONFIGFILE__"> Alternate configuration file.\n" -" -modulepath <module-path> "__XSERVERNAME__" modules location.\n" -" -serverpath <server-path> X server to start (if $DISPLAY is not defined).\n" -" -fontpath <font-path> Font path for fonts.\n" -#ifdef HAS_NCURSES -" -textmode Use this option for the text only interface.\n" -#endif -#ifdef USE_MODULES -" -nomodules Use this option if xorgcfg is slow to start.\n" -" -verbose <number> Verbosity used in the loader (default 1).\n" -#endif -" -verify Verify modules/options integrity.\n" -); - - exit(1); -} - -/* - * Implementation - */ -int -main(int argc, char *argv[]) -{ - Widget pane, hpane, expert, popup, mouse, keyboard, card, monitor; - Widget bottom, sme, smemodeline, help, quit, layopt; - XColor color, tmp; - Pixmap pixmap; - XGCValues values; - XF86ConfLayoutPtr lay; - int i, startedx; - char *menuPixmapPath = NULL; - XrmValue from, to; - - if ((XFree86Dir = getenv("XWINHOME")) == NULL) - XFree86Dir = DefaultXFree86Dir; - - chdir(XFree86Dir); - -#ifdef USE_MODULES - xf86Verbose = 1; -#endif - noverify = True; - - for (i = 1; i < argc; i++) { - if (strcmp(argv[i], "-config") == 0 || - strcmp(argv[i], "-xorgconfig") == 0 || - strcmp(argv[i], "-xf86config") == 0) { - if (i + 1 < argc) { - XF86Config_path = argv[++i]; - config_set = True; - } - } else if (strcmp(argv[i], "-modulepath") == 0) { - if (i + 1 < argc) - XF86Module_path = argv[++i]; - } else if (strcmp(argv[i], "-serverpath") == 0) { - if (i + 1 < argc) - XFree86_path = argv[++i]; - } else if (strcmp(argv[i], "-fontpath") == 0) { - if (i + 1 < argc) - XF86Font_path = argv[++i]; - } -#ifdef HAS_NCURSES - else if (strcmp(argv[i], "-textmode") == 0) - textmode = True; -#endif -#ifdef USE_MODULES - else if (strcmp(argv[i], "-nomodules") == 0) - nomodules = True; - else if (strcmp(argv[i], "-verbose") == 0) { - if (i + 1 < argc) - xf86Verbose = atoi(argv[++i]); - } -#endif - else if (strcmp(argv[i], "-verify") == 0) - noverify = False; - else - Usage(); - } - -#ifdef HAS_NCURSES - if (textmode) { - TextMode(); - exit(0); - } -#endif - - startedx = startx(); - if (XF86Config_path == NULL) - XF86Config_path = XtNewString(__XCONFIGFILE__); - if (XkbConfig_path == NULL) { - XmuSnprintf(XkbConfig_path_static, sizeof(XkbConfig_path_static), - "%s/%s%s", XFree86Dir, XkbConfigDir, XkbConfigFile); - XkbConfig_path = XkbConfig_path_static; - } - toplevel = XtAppInitialize(&appcon, "XOrgCfg", - NULL, 0, - &argc, argv, - NULL, NULL, 0); - if (DPY == NULL) - DPY = XtDisplay(toplevel); - - XtGetApplicationResources(toplevel, (XtPointer)&menuPixmapPath, - appResources, XtNumber(appResources), NULL, 0); - if (menuPixmapPath && strlen(menuPixmapPath)) { - from.size = strlen(menuPixmapPath); - from.addr = menuPixmapPath; - to.size = sizeof(Pixmap); - to.addr = (XtPointer)&(menuPixmap); - XtConvertAndStore(toplevel, XtRString, &from, XtRBitmap, &to); - } - - XtAppAddActions(appcon, actions, XtNumber(actions)); - - XawSimpleMenuAddGlobalActions(appcon); - XtRegisterGrabAction(DevicePopupMenu, True, - ButtonPressMask | ButtonReleaseMask, - GrabModeAsync, GrabModeAsync); - - pane = XtCreateManagedWidget("pane", panedWidgetClass, - toplevel, NULL, 0); - hpane = XtVaCreateManagedWidget("hpane", panedWidgetClass, pane, - XtNorientation, XtorientHorizontal, NULL); - topMenu = XtCreateManagedWidget("topM", menuButtonWidgetClass, - hpane, NULL, 0); - expert = XtCreateManagedWidget("expert", commandWidgetClass, hpane, NULL, 0); - XtAddCallback(expert, XtNcallback, ExpertCallback, NULL); - popup = XtCreatePopupShell("menu", simpleMenuWidgetClass, - topMenu, NULL, 0); - sme = XtCreateManagedWidget("layout", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, SetConfigModeCallback, - (XtPointer)CONFIG_LAYOUT); - sme = XtCreateManagedWidget("screen", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, SetConfigModeCallback, - (XtPointer)CONFIG_SCREEN); - smemodeline = XtCreateManagedWidget("modeline", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(smemodeline, XtNcallback, SetConfigModeCallback, - (XtPointer)CONFIG_MODELINE); - sme = XtCreateManagedWidget("accessx", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, SetConfigModeCallback, - (XtPointer)CONFIG_ACCESSX); - - commands = XtCreateManagedWidget("commands", formWidgetClass, - pane, NULL, 0); - - mouse = XtVaCreateManagedWidget("mouse", menuButtonWidgetClass, - commands, XtNmenuName, "mouseP", NULL); - popup = XtCreatePopupShell("mouseP", simpleMenuWidgetClass, - mouse, NULL, 0); - sme = XtCreateManagedWidget("new", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE); - mouseSme = XtCreateManagedWidget("configure", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(mouseSme, XtNcallback, SmeConfigureDeviceCallback, - (XtPointer)MOUSE); - - keyboard = XtVaCreateManagedWidget("keyboard", menuButtonWidgetClass, - commands, XtNmenuName, "keyboardP", NULL); - popup = XtCreatePopupShell("keyboardP", simpleMenuWidgetClass, - keyboard, NULL, 0); - sme = XtCreateManagedWidget("new", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD); - keyboardSme = XtCreateManagedWidget("configure", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(keyboardSme, XtNcallback, SmeConfigureDeviceCallback, - (XtPointer)KEYBOARD); - - card = XtVaCreateManagedWidget("card", menuButtonWidgetClass, - commands, XtNmenuName, "cardP", NULL); - popup = XtCreatePopupShell("cardP", simpleMenuWidgetClass, - card, NULL, 0); - sme = XtCreateManagedWidget("new", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)CARD); - cardSme = XtCreateManagedWidget("configure", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(cardSme, XtNcallback, SmeConfigureDeviceCallback, - (XtPointer)CARD); - - monitor = XtVaCreateManagedWidget("monitor", menuButtonWidgetClass, - commands, XtNmenuName, "monitorP", NULL); - popup = XtCreatePopupShell("monitorP", simpleMenuWidgetClass, - monitor, NULL, 0); - sme = XtCreateManagedWidget("new", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR); - monitorSme = XtCreateManagedWidget("configure", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(monitorSme, XtNcallback, SmeConfigureDeviceCallback, - (XtPointer)MONITOR); - - work = XtCreateManagedWidget("work", compositeWidgetClass, - pane, NULL, 0); - - bottom = XtCreateManagedWidget("bottom", formWidgetClass, - pane, NULL, 0); - layoutm = XtCreateManagedWidget("select", menuButtonWidgetClass, - bottom, NULL, 0); - layout = XtVaCreateManagedWidget("layout", asciiTextWidgetClass, - bottom, - XtNeditType, XawtextEdit, - NULL); - layoutp = XtCreatePopupShell("menu", simpleMenuWidgetClass, - bottom, NULL, 0); - sme = XtCreateManagedWidget("new", smeBSBObjectClass, layoutp, - NULL, 0); - XtAddCallback(sme, XtNcallback, SelectLayoutCallback, NULL); - help = XtCreateManagedWidget("help", commandWidgetClass, - bottom, NULL, 0); - XtAddCallback(help, XtNcallback, HelpCallback, NULL); - quit = XtCreateManagedWidget("quit", commandWidgetClass, - bottom, NULL, 0); - XtAddCallback(quit, XtNcallback, QuitCallback, NULL); - - XtRealizeWidget(toplevel); - XtRealizeWidget(topMenu); - - pixmap = XCreateBitmapFromData(XtDisplay(toplevel), XtWindow(toplevel), - no_cursor_data, 8, 8); - XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "black", - &color, &tmp); - no_cursor = XCreatePixmapCursor(XtDisplay(toplevel), pixmap, pixmap, - &color, &color, 0, 0); - - XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray55", - &color, &tmp); - values.line_width = 3; - values.foreground = color.pixel; - cablegcshadow = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel), - GCForeground | GCLineWidth, &values); - XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray85", - &color, &tmp); - values.line_width = 1; - values.foreground = color.pixel; - cablegc = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel), - GCForeground | GCLineWidth, &values); - - computer.cpu = XtCreateManagedWidget("cpu", simpleWidgetClass, - work, NULL, 0); - cpu_device.widget = computer.cpu; - cpu_device.type = SERVER; - - XtAddEventHandler(work, ExposureMask, False, - ComputerEventHandler, (XtPointer)NULL); - - wm_delete_window = XInternAtom(DPY, "WM_DELETE_WINDOW", False); - XSetWMProtocols(DPY, XtWindow(toplevel), &wm_delete_window, 1); - - StartConfig(); - InitializeDevices(); - UpdateMenuDeviceList(MOUSE); - UpdateMenuDeviceList(KEYBOARD); - UpdateMenuDeviceList(CARD); - UpdateMenuDeviceList(MONITOR); - XtSetSensitive(smemodeline, VideoModeInitialize()); - - lay = XF86Config->conf_layout_lst; - while (lay != NULL) { - sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, - layoutp, - XtNlabel, lay->lay_identifier, - XtNmenuName, lay->lay_identifier, - XtNleftBitmap, menuPixmap, - NULL); - XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); - if (layoutsme == NULL) - layoutsme = sme; - layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, - layoutp, NULL, 0); - sme = XtCreateManagedWidget("default", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); - sme = XtCreateManagedWidget("remove", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); - XtRealizeWidget(layopt); - - lay = (XF86ConfLayoutPtr)(lay->list.next); - } - SelectLayoutCallback(layoutsme, - XF86Config->conf_layout_lst, NULL); - - startaccessx(); - if (startedx) { - switch (fork()) { - case 0: { - char path[PATH_MAX]; - - XmuSnprintf(path, sizeof(path), "%s/bin/twm", XFree86Dir); - execl(path, "twm", (void *)NULL); - exit(-127); - } break; - case -1: - fprintf(stderr, "Cannot fork.\n"); - exit(1); - break; - default: - break; - } - } - -#ifdef USE_MODULES - if (!nomodules) - LoaderInitializeOptions(); -#endif - - /* ReadCardsDatabase() must be called after LoaderInitializeOptions() */ - ReadCardsDatabase(); - - if (!config_set && startedx) { - XtFree(XF86Config_path); -#ifndef XF86CONFIG -# define XF86CONFIG __XCONFIGFILE__ -#endif -#ifdef XF86CONFIGDIR - XF86Config_path = XtNewString(XF86CONFIGDIR "/" XF86CONFIG); -#else - XF86Config_path = XtNewString("/etc/X11/" XF86CONFIG); -#endif - } - XtAppMainLoop(appcon); - if (startedx) - endx(); - - return (0); -} - -static Widget shell_cf; -static int write_cf, asking_cf; -static int cf_state = 0; -#define CF_XF86Config 1 -#define CF_XKBConfig 2 -#define CF_First CF_XF86Config -#define CF_Last CF_XKBConfig - -/*ARGSUSED*/ -static void -WriteConfig(Widget w, XtPointer user_data, XtPointer call_data) -{ - asking_cf = 0; - XtPopdown(shell_cf); - write_cf = (long)user_data; -} - -/*ARGSUSED*/ -void -QuitCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - WriteConfig(w, (XtPointer)-1, NULL); -} - -/*ARGSUSED*/ -void -WriteConfigAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - WriteConfig(w, (XtPointer)True, NULL); -} - -static Bool -AskConfig(void) -{ - static Widget dialog; - - if (shell_cf == NULL) { - Arg args[1]; - char *l, *label; - int len; - - shell_cf = XtCreatePopupShell("quit", transientShellWidgetClass, - toplevel, NULL, 0); - dialog = XtVaCreateManagedWidget("ask", dialogWidgetClass, shell_cf, - XtNvalue, XF86Config_path, NULL); - XawDialogAddButton(dialog, "yes", WriteConfig, (XtPointer)1); - XawDialogAddButton(dialog, "no", WriteConfig, (XtPointer)0); - XawDialogAddButton(dialog, "cancel", WriteConfig, (XtPointer)-1); - XtRealizeWidget(shell_cf); - XSetWMProtocols(DPY, XtWindow(shell_cf), &wm_delete_window, 1); - XtSetArg(args[0], XtNlabel, &l); - XtGetValues(dialog, args, 1); - label = XtMalloc(len = (strlen(l) + strlen(XF86CONFIG) + 2)); - XmuSnprintf(label, len, "%s\n", XF86CONFIG); - strcat(label, l); - XtSetArg(args[0], XtNlabel, label); - XtSetValues(dialog, args, 1); - XtFree(label); - } - else { - Arg args[2]; - Cardinal num_args = 0; - char *l, *label = NULL, *str = ""; - - XtSetArg(args[0], XtNlabel, &l); - XtGetValues(dialog, args, 1); - switch (cf_state) { - case CF_XF86Config: - str = XF86CONFIG; - XtSetArg(args[num_args], XtNvalue, XF86Config_path); - ++num_args; - break; - case CF_XKBConfig: - str = "XKB"; - XtSetArg(args[num_args], XtNvalue, XkbConfig_path); - ++num_args; - break; - } - l = strchr(l, '\n'); - if (l != NULL) { - label = XtMalloc(strlen(str) + strlen(l) + 1); - strcpy(label, str); - strcat(label, l); - XtSetArg(args[num_args], XtNlabel, label); - ++num_args; - } - XtSetValues(dialog, args, num_args); - if (l != NULL) - XtFree(label); - } - - asking_cf = 1; - - XtPopup(shell_cf, XtGrabExclusive); - while (asking_cf) - XtAppProcessEvent(XtWidgetToApplicationContext(shell_cf), XtIMAll); - - if (write_cf > 0) { - switch (cf_state) { - case CF_XF86Config: - XF86Config_path = XawDialogGetValueString(dialog); - XmuSnprintf(XF86Config_path_static, - sizeof(XF86Config_path_static), - "%s", XF86Config_path); - XF86Config_path = XF86Config_path_static; - break; - case CF_XKBConfig: - XkbConfig_path = XawDialogGetValueString(dialog); - XmuSnprintf(XkbConfig_path_static, - sizeof(XkbConfig_path_static), - "%s", XkbConfig_path); - XkbConfig_path = XkbConfig_path_static; - break; - } - } - - return (write_cf); -} - -/*ARGSUSED*/ -void -PopdownErrorCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtPopdown((Widget)user_data); -} - -/*ARGSUSED*/ -void -ErrorCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - XtPopdown((Widget)w); -} - -/*ARGSUSED*/ -void -QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - QuitCallback(w, NULL, NULL); -} - -/*ARGSUSED*/ -void -QuitCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - for (cf_state = CF_First; cf_state <= CF_Last; cf_state++) { - if (cf_state == CF_XKBConfig && xkb_info == NULL) - continue; - - switch (AskConfig()) { - case 0: - break; - case 1: - if ((cf_state == CF_XF86Config && - !xf86writeConfigFile(XF86Config_path, XF86Config)) || - (cf_state == CF_XKBConfig && - !WriteXKBConfiguration(XkbConfig_path, - &xkb_info->config))) { - static Widget shell; - - if (shell == NULL) { - Widget dialog; - - shell = XtCreatePopupShell("error", - transientShellWidgetClass, - toplevel, NULL, 0); - dialog = XtVaCreateManagedWidget("notice", - dialogWidgetClass, - shell, XtNvalue, NULL, - NULL); - XawDialogAddButton(dialog, "ok", PopdownErrorCallback, - (XtPointer)shell); - XtRealizeWidget(shell); - XSetWMProtocols(DPY, XtWindow(shell), - &wm_delete_window, 1); - } - XtPopup(shell, XtGrabExclusive); - return; - } - break; - default: - return; - } - } - - endx(); - exit(0); -} - -void -InitializeDevices(void) -{ - xf86cfgDevice *device; - int mouse_x, mouse_y, keyboard_x, keyboard_y, - card_x, card_y, monitor_x, monitor_y, len; - XF86ConfInputPtr input = XF86Config->conf_input_lst; - XF86ConfDevicePtr card = XF86Config->conf_device_lst; - XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst; - XF86OptionPtr flags = NULL; - char buffer[4096], *tip; - Arg args[1]; - - if (XF86Config->conf_flags != NULL) - flags = XF86Config->conf_flags->flg_option_lst; - - len = 0; - while (flags && len < sizeof(buffer) - 1) { - len += XmuSnprintf(buffer + len, sizeof(buffer) - len, - "Option \"%s\"", - flags->opt_name); - if (flags->opt_val != NULL) - len += XmuSnprintf(buffer + len, sizeof(buffer) - len, - " \"%s\"\n", - flags->opt_val); - else - len += XmuSnprintf(buffer + len, sizeof(buffer) - len, - "%s", "\n"); - flags = (XF86OptionPtr)(flags->list.next); - } - - if (len) { - tip = XtNewString(buffer); - XtSetArg(args[0], XtNtip, tip); - XtSetValues(computer.cpu, args, 1); - } - -#define DEFAULT_MOUSE_WIDTH 30 -#define DEFAULT_MOUSE_HEIGHT 40 -#define DEFAULT_KEYBOARD_WIDTH 48 -#define DEFAULT_KEYBOARD_HEIGHT 36 - mouse_x = work->core.width - (work->core.width >> 2); - mouse_y = work->core.height - DEFAULT_MOUSE_HEIGHT; - keyboard_x = 6; - keyboard_y = work->core.height - DEFAULT_KEYBOARD_HEIGHT; - - while (input != NULL) { - if (input->inp_driver) { - if (strcasecmp(input->inp_driver, "mouse") == 0) { - device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y); - SetTip(device); - if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) { - if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1)) - mouse_y = work->core.height >> 1; - mouse_x = work->core.width - (work->core.width >> 2); - } - } - else if (IS_KBDDRIV(input->inp_driver)) { - device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y); - SetTip(device); - if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) > - work->core.width - (work->core.width >> 2)) { - if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1)) - keyboard_y = work->core.height >> 1; - keyboard_x = 6; - } - } - } - input = (XF86ConfInputPtr)(input->list.next); - } - -#define DEFAULT_CARD_WIDTH 45 -#define DEFAULT_CARD_HEIGHT 46 - card_x = 6; - card_y = (work->core.height >> 1) - 20 - DEFAULT_CARD_HEIGHT; - while (card != NULL) { - device = AddDevice(CARD, (XtPointer)card, card_x, card_y); - SetTip(device); - if ((card_x += DEFAULT_CARD_WIDTH) > work->core.width) { - if ((card_y -= DEFAULT_CARD_HEIGHT) < (work->core.height >> 2)) - card_y = work->core.height >> 2; - card_x = 6; - } - card = (XF86ConfDevicePtr)(card->list.next); - } - -#define DEFAULT_MONITOR_WIDTH 48 -#define DEFAULT_MONITOR_HEIGHT 48 - monitor_x = 6; - monitor_y = 6; - while (monitor != NULL) { - XF86ConfScreenPtr screen = XF86Config->conf_screen_lst; - - device = AddDevice(MONITOR, (XtPointer)monitor, monitor_x, monitor_y); - SetTip(device); - if ((monitor_x += DEFAULT_MONITOR_WIDTH) > work->core.width) { - if ((monitor_y += DEFAULT_MONITOR_HEIGHT) > - (work->core.height >> 2) - DEFAULT_MONITOR_HEIGHT) - monitor_y = (work->core.height >> 2) - DEFAULT_MONITOR_HEIGHT; - monitor_x = 6; - } - - while (screen != NULL) { - if (screen->scrn_monitor == monitor) { - card = XF86Config->conf_device_lst; - while (card != NULL) { - if (screen->scrn_device == card) { - xf86cfgScreen *scr = (xf86cfgScreen*) - XtCalloc(1, sizeof(xf86cfgScreen)); - int i; - - for (i = 0; i < computer.num_devices; i++) - if ((XF86ConfDevicePtr)(computer.devices[i]->config) - == card) - break; - scr->screen = screen; - scr->card = computer.devices[i]; - scr->monitor = device; - scr->refcount = 0; - ++scr->card->refcount; - ++scr->monitor->refcount; - computer.screens = (xf86cfgScreen**) - XtRealloc((XtPointer)computer.screens, - sizeof(xf86cfgScreen*) * - (computer.num_screens + 1)); - CreateScreenWidget(scr); - scr->type = SCREEN; - computer.screens[computer.num_screens++] = scr; - SetTip((xf86cfgDevice*)scr); - break; - } - card = (XF86ConfDevicePtr)(card->list.next); - } - device->state = USED; - } - screen = (XF86ConfScreenPtr)(screen->list.next); - } - - monitor = (XF86ConfMonitorPtr)(monitor->list.next); - } -} - -xf86cfgDevice * -AddDevice(int type, XtPointer config, int x, int y) -{ - switch (type) { - case MOUSE: - case KEYBOARD: - case CARD: - case MONITOR: - computer.devices = (xf86cfgDevice**) - XtRealloc((XtPointer)computer.devices, - sizeof(xf86cfgDevice*) * (computer.num_devices + 1)); - computer.devices[computer.num_devices] = (xf86cfgDevice*) - XtCalloc(1, sizeof(xf86cfgDevice)); - computer.devices[computer.num_devices]->config = config; - computer.devices[computer.num_devices]->widget = - XtVaCreateManagedWidget(device_names[type], simpleWidgetClass, - work, - XtNx, x, - XtNy, y, - XtNtip, NULL, - NULL); - computer.devices[computer.num_devices]->type = type; - computer.devices[computer.num_devices]->state = UNUSED; - computer.devices[computer.num_devices]->refcount = 0; - ++computer.num_devices; - break; - default: - fprintf(stderr, "Bad argument to AddDevice.\n"); - exit(1); - return (NULL); - } - - UpdateMenuDeviceList(type); - - return (computer.devices[computer.num_devices - 1]); -} - -/*ARGSUSED*/ -static void -HelpCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - char *topic = NULL; - - switch (config_mode) { - case CONFIG_LAYOUT: - topic = HELP_DEVICES; - break; - case CONFIG_SCREEN: - topic = HELP_SCREEN; - break; - case CONFIG_MODELINE: - topic = HELP_MODELINE; - break; - case CONFIG_ACCESSX: - topic = HELP_ACCESSX; - break; - } - Help(topic); -} - -void -SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i, j; - XF86ConfLayoutPtr lay = (XF86ConfLayoutPtr)user_data; - XF86ConfInputrefPtr input; - XF86ConfAdjacencyPtr adj; - Widget sme, layopt; - Arg args[1]; - char *str; - - /* XXX Needs to check computer.layout, - * because this function should also create - * a new layout... - */ - if (lay == computer.layout && computer.layout) - return; - - if (computer.layout != NULL) { - for (i = 0; i < computer.num_layouts; i++) { - if (computer.layouts[i]->layout == computer.layout) - break; - } - if (i < computer.num_layouts) { - XtFree((XtPointer)computer.layouts[i]->screen); - XtFree((XtPointer)computer.layouts[i]->position); - } - else { - computer.layouts = (xf86cfgLayout**) - XtRealloc((XtPointer)computer.layouts, sizeof(xf86cfgLayout*) * - (computer.num_layouts + 1)); - ++computer.num_layouts; - } - computer.layouts[i] = (xf86cfgLayout*)XtCalloc(1, sizeof(xf86cfgLayout)); - computer.layouts[i]->layout = computer.layout; - computer.layouts[i]->num_layouts = computer.num_screens; - computer.layouts[i]->screen = (xf86cfgScreen**) - XtMalloc(sizeof(xf86cfgScreen*) * computer.num_screens); - computer.layouts[i]->position = (XPoint*) - XtMalloc(sizeof(XPoint) * computer.num_screens); - for (j = 0; j < computer.num_screens; j++) { - computer.layouts[i]->screen[j] = computer.screens[j]; - computer.layouts[i]->position[j].x = computer.screens[j]->widget->core.x; - computer.layouts[i]->position[j].y = computer.screens[j]->widget->core.y; - } - } - - if (lay != NULL) { - for (i = 0; i < computer.num_layouts; i++) - if (computer.layouts[i]->layout == lay) { - for (j = 0; j < computer.layouts[i]->num_layouts; j++) { - int k; - - for (k = 0; k < computer.num_screens; k++) - if (computer.screens[k] == computer.layouts[i]->screen[j]) { - XtMoveWidget(computer.screens[k]->widget, - computer.layouts[i]->position[j].x, - computer.layouts[i]->position[j].y); - } - } - break; - } - - layoutsme = w; - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(w, args, 1); - XtSetArg(args[0], XtNstring, str); - XtSetValues(layout, args, 1); - } - - computer.layout = lay; - - for (i = 0; i < computer.num_devices; i++) - computer.devices[i]->state = UNUSED; - for (i = 0; i < computer.num_screens; i++) - computer.screens[i]->state = UNUSED; - - if (lay == NULL) { - char name[64]; - XF86ConfLayoutPtr l; - int num_layouts = 0; - - l = XF86Config->conf_layout_lst; - while (l != NULL) { - if (l->lay_adjacency_lst == NULL && - l->lay_inactive_lst == NULL && - l->lay_input_lst == NULL && - l->lay_option_lst == NULL && - l->lay_comment == NULL) { - for (i = 0; - i < ((CompositeWidget)layout)->composite.num_children; i++) - if (strcmp(XtName(((CompositeWidget)layout)->composite. - children[i]), l->lay_identifier) == 0) { - layoutsme = ((CompositeWidget)layout)->composite.children[i]; - } - computer.layout = l; - XtSetArg(args[0], XtNstring, l->lay_identifier); - XtSetValues(layout, args, 1); - if (config_mode == CONFIG_LAYOUT) - DrawCables(); - if (config_mode == CONFIG_SCREEN) - ScreenSetup(True); - return; - } - ++num_layouts; - l = (XF86ConfLayoutPtr)(l->list.next); - } - do { - XmuSnprintf(name, sizeof(name), "Layout%d", num_layouts); - ++num_layouts; - } while (xf86findLayout(name, - XF86Config->conf_layout_lst) != NULL); - l = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec)); - - l->lay_identifier = XtNewString(name); - XF86Config->conf_layout_lst = - xf86addLayout(XF86Config->conf_layout_lst, l); - layoutsme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, - layoutp, - XtNlabel, name, - XtNmenuName, l->lay_identifier, - XtNleftBitmap, menuPixmap, - NULL); - XtAddCallback(layoutsme, XtNcallback, - SelectLayoutCallback, (XtPointer)l); - - layopt = XtCreatePopupShell(l->lay_identifier, simpleMenuWidgetClass, - layoutp, NULL, 0); - sme = XtCreateManagedWidget("default", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); - sme = XtCreateManagedWidget("remove", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); - XtRealizeWidget(layopt); - - computer.layout = l; - XtSetArg(args[0], XtNstring, name); - XtSetValues(layout, args, 1); - if (config_mode == CONFIG_LAYOUT) - DrawCables(); - if (config_mode == CONFIG_SCREEN) - ScreenSetup(True); - return; - } - - input = lay->lay_input_lst; - adj = lay->lay_adjacency_lst; - - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->config != NULL && - (computer.devices[i]->type == MOUSE || - computer.devices[i]->type == KEYBOARD)) { - while (input != NULL) { - if (strcmp(input->iref_inputdev_str, ((XF86ConfInputPtr) - (computer.devices[i]->config))->inp_identifier) == 0) { - computer.devices[i]->state = USED; - break; - } - input = (XF86ConfInputrefPtr)(input->list.next); - } - input = lay->lay_input_lst; - } - - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->type == CARD) { - while (adj != NULL) { - XF86ConfScreenPtr screen = adj->adj_screen; - - if (computer.devices[i]->config != NULL && - strcmp(screen->scrn_device_str, ((XF86ConfDevicePtr) - (computer.devices[i]->config))->dev_identifier) == 0) { - int j; - - for (j = 0; j < computer.num_screens; j++) - if (computer.screens[j]->card == computer.devices[i]) - break; - computer.screens[j]->card->state = USED; - if (computer.screens[j]->monitor != NULL) - computer.screens[j]->monitor->state = USED; - computer.screens[j]->state = USED; - } - - adj = (XF86ConfAdjacencyPtr)(adj->list.next); - } - adj = lay->lay_adjacency_lst; - } - - if (config_mode == CONFIG_LAYOUT) - DrawCables(); - else if (config_mode == CONFIG_SCREEN) - ScreenSetup(True); -} - -/*ARGSUSED*/ -void -DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Widget layopt, sme; - int i; - char *str; - XF86ConfLayoutPtr prev, tmp, lay; - - str = w && XtParent(w) ? XtName(XtParent(w)) : NULL; - if (str == NULL) - return; - - prev = XF86Config->conf_layout_lst; - lay = xf86findLayout(str, prev); - if (prev == lay) - return; - - tmp = prev; - while (tmp != NULL) { - if (tmp == lay) - break; - prev = tmp; - tmp = (XF86ConfLayoutPtr)(tmp->list.next); - } - - for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++) - XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]); - for (i = 0; i < layoutp->core.num_popups; i++) - XtDestroyWidget(layoutp->core.popup_list[i]); - - prev->list.next = lay->list.next; - lay->list.next = XF86Config->conf_layout_lst; - XF86Config->conf_layout_lst = lay; - - layoutsme = NULL; - lay = XF86Config->conf_layout_lst; - while (lay != NULL) { - sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass, - layoutp, - XtNlabel, lay->lay_identifier, - XtNmenuName, lay->lay_identifier, - XtNleftBitmap, menuPixmap, - NULL); - XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); - if (layoutsme == NULL) - layoutsme = sme; - layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass, - layoutp, NULL, 0); - sme = XtCreateManagedWidget("default", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL); - sme = XtCreateManagedWidget("remove", smeBSBObjectClass, - layopt, NULL, 0); - XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL); - XtRealizeWidget(layopt); - - lay = (XF86ConfLayoutPtr)(lay->list.next); - } - SelectLayoutCallback(layoutsme, - XF86Config->conf_layout_lst, NULL); -} - -/*ARGSUSED*/ -void -RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XF86ConfLayoutPtr prev, tmp, lay, rem; - Widget sme = NULL; - int i; - char *str; - Arg args[1]; - - str = w && XtParent(w) ? XtName(XtParent(w)) : NULL; - if (str == NULL) - return; - - prev = XF86Config->conf_layout_lst; - lay = xf86findLayout(str, prev); - tmp = prev; - while (tmp != NULL) { - if (tmp == lay) - break; - prev = tmp; - tmp = (XF86ConfLayoutPtr)(tmp->list.next); - } - - rem = lay; - if (tmp != NULL) - lay = (XF86ConfLayoutPtr)(tmp->list.next); - if (lay == NULL && prev != tmp) - lay = prev; - - if (lay != NULL) { - int i; - - for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children; - i++) { - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(((CompositeWidget)layoutp)->composite.children[i], - args, 1); - if (strcmp(lay->lay_identifier, str) == 0) { - layoutsme = ((CompositeWidget)layoutp)->composite.children[i]; - break; - } - } - SelectLayoutCallback(layoutsme, lay, NULL); - } - else { - computer.layout = NULL; - XtSetArg(args[0], XtNstring, ""); - XtSetValues(layout, args, 1); - - for (i = 0; i < computer.num_devices; i++) - computer.devices[i]->state = UNUSED; - DrawCables(); - } - - for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children; i++) { - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(((CompositeWidget)layoutp)->composite.children[i], args, 1); - if (strcmp(rem->lay_identifier, str) == 0) { - sme = ((CompositeWidget)layoutp)->composite.children[i]; - break; - } - } - - xf86removeLayout(XF86Config, rem); - if (sme) - XtDestroyWidget(sme); -} - -void -SetTip(xf86cfgDevice *device) -{ - XF86OptionPtr option = NULL; - char *tip, buffer[4096]; - Arg args[1]; - int len = 0; - - XtSetArg(args[0], XtNtip, &tip); - XtGetValues(device->widget, args, 1); - - switch (device->type) { - case MOUSE: { - XF86ConfInputPtr mouse = (XF86ConfInputPtr)device->config; - - if (mouse == NULL) - return; - len = XmuSnprintf(buffer, sizeof(buffer), - "Identifier \"%s\"\n" - "Driver \"mouse\"\n", - mouse->inp_identifier); - option = mouse->inp_option_lst; - } break; - case KEYBOARD: { - XF86ConfInputPtr keyboard = (XF86ConfInputPtr)device->config; - - if (keyboard == NULL) - return; - len = XmuSnprintf(buffer, sizeof(buffer), - "Identifier \"%s\"\n" - "Driver \"keyboard\"\n", - keyboard->inp_identifier); - option = keyboard->inp_option_lst; - } break; - case CARD: { - XF86ConfDevicePtr card = (XF86ConfDevicePtr)device->config; - - if (card == NULL) - return; - len = XmuSnprintf(buffer, sizeof(buffer), - "Identifier \"%s\"\n" - "Driver \"%s\"\n", - card->dev_identifier, - card->dev_driver); - option = card->dev_option_lst; - } break; - case MONITOR: { - XF86ConfMonitorPtr monitor = (XF86ConfMonitorPtr)device->config; - - if (monitor == NULL) - return; - if (monitor->mon_vendor != NULL) - len = XmuSnprintf(buffer, sizeof(buffer), - "Identifier \"%s\"\n" - "Vendor \"%s\"\n", - monitor->mon_identifier, - monitor->mon_vendor); - else - len = XmuSnprintf(buffer, sizeof(buffer), - "Identifier \"%s\"\n", - monitor->mon_identifier); - option = monitor->mon_option_lst; - } break; - case SCREEN: { - XF86ConfScreenPtr screen = (XF86ConfScreenPtr)device->config; - - if (screen == NULL) - return; - len = XmuSnprintf(buffer, sizeof(buffer), - "Identifier \"%s\"\n", - screen->scrn_identifier); - if (screen->scrn_device_str != NULL) - len += XmuSnprintf(buffer + len, sizeof(buffer), - "Device \"%s\"\n", - screen->scrn_device_str); - if (screen->scrn_monitor_str != NULL) - len += XmuSnprintf(buffer + len, sizeof(buffer), - "Monitor \"%s\"\n", - screen->scrn_monitor_str); - option = screen->scrn_option_lst; - } break; - case SERVER: { - len = XmuSnprintf(buffer, sizeof(buffer), - "%s\n", "Server Flags"); - option = XF86Config->conf_flags->flg_option_lst; - } break; - } - - while (option && len < sizeof(buffer) - 1) { - len += XmuSnprintf(buffer + len, sizeof(buffer) - len, - "Option \"%s\"", - option->opt_name); - if (option->opt_val != NULL) - len += XmuSnprintf(buffer + len, sizeof(buffer) - len, - " \"%s\"\n", - option->opt_val); - else - len += XmuSnprintf(buffer + len, sizeof(buffer) - len, - "%s", "\n"); - option = (XF86OptionPtr)(option->list.next); - } - - tip = buffer; - XtSetArg(args[0], XtNtip, tip); - XtSetValues(device->widget, args, 1); -} - -/*ARGSUSED*/ -void -AddDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - AddDevice((long)user_data, NULL, 6, 6); -} - -void -SmeConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i; - - switch ((long)user_data) { - case MOUSE: - case KEYBOARD: - case CARD: - case MONITOR: - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->type == (long)user_data) { - config = computer.devices[i]->widget; - ConfigureDeviceCallback(w, NULL, NULL); - } - break; - - /* hack for newly added devices */ - case -(MOUSE + 100): - case -(KEYBOARD + 100): - case -(CARD + 100): - case -(MONITOR + 100): - for (i = 0; i < computer.num_devices; i++) - if (-(computer.devices[i]->type + 100) == (long)user_data && - computer.devices[i]->config == NULL) { - config = computer.devices[i]->widget; - ConfigureDeviceCallback(w, NULL, NULL); - } - break; - - default: - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->config == user_data) { - config = computer.devices[i]->widget; - ConfigureDeviceCallback(w, NULL, NULL); - } - break; - } -} - -void -ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i, j; - - if (config_mode == CONFIG_LAYOUT) { - for (i = 0; i < computer.num_devices; i++) { - if (computer.devices[i]->widget == config) { - switch (computer.devices[i]->type) { - case MOUSE: { - XF86ConfInputPtr mouse = - MouseConfig(computer.devices[i]->config); - - if (mouse != NULL && computer.devices[i]->config == NULL) { - XF86Config->conf_input_lst = - xf86addInput(XF86Config->conf_input_lst, - mouse); - computer.devices[i]->config = (XtPointer)mouse; - } - SetTip(computer.devices[i]); - } break; - case KEYBOARD: { - XF86ConfInputPtr keyboard = - KeyboardConfig(computer.devices[i]->config); - - if (keyboard != NULL && computer.devices[i]->config == NULL) { - XF86Config->conf_input_lst = - xf86addInput(XF86Config->conf_input_lst, - keyboard); - computer.devices[i]->config = (XtPointer)keyboard; - } - SetTip(computer.devices[i]); - } break; - case CARD: { - XF86ConfDevicePtr card = - CardConfig(computer.devices[i]->config); - - if (card != NULL && computer.devices[i]->config == NULL) { - XF86Config->conf_device_lst = - xf86addDevice(XF86Config->conf_device_lst, - card); - computer.devices[i]->config = (XtPointer)card; - } - SetTip(computer.devices[i]); - for (j = 0; j < computer.num_screens; j++) - if (computer.screens[j]->card->widget == config) - SetTip((xf86cfgDevice*)computer.screens[j]); - } break; - case MONITOR: { - XF86ConfMonitorPtr monitor = - MonitorConfig(computer.devices[i]->config); - - if (monitor != NULL && computer.devices[i]->config == NULL) { - XF86Config->conf_monitor_lst = - xf86addMonitor(XF86Config->conf_monitor_lst, - monitor); - computer.devices[i]->config = (XtPointer)monitor; - } - SetTip(computer.devices[i]); - for (j = 0; j < computer.num_screens; j++) - if (computer.screens[j]->monitor->widget == config) - SetTip((xf86cfgDevice*)computer.screens[j]); - } break; - } - /* Need to update because it may have been renamed */ - UpdateMenuDeviceList(computer.devices[i]->type); - break; - } - } - } - else if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == config) { - if (ScreenConfig(computer.screens[i]->screen) != NULL) - SetTip((xf86cfgDevice*)computer.screens[i]); - } - } -} - -void -OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i; - XF86OptionPtr *options = NULL; -#ifdef USE_MODULES - xf86cfgModuleOptions *drv_opts = NULL; -#endif - - if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == config) { - options = &(computer.screens[i]->screen->scrn_option_lst); - break; - } - } - else { - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->widget == config) - break; - - if (i >= computer.num_devices) { - if (XF86Config->conf_flags == NULL) - XF86Config->conf_flags = (XF86ConfFlagsPtr) - XtCalloc(1, sizeof(XF86ConfFlagsRec)); - options = &(XF86Config->conf_flags->flg_option_lst); - } - else { - switch (computer.devices[i]->type) { - case MOUSE: - case KEYBOARD: - options = (XF86OptionPtr*)&(((XF86ConfInputPtr) - (computer.devices[i]->config))->inp_option_lst); -#ifdef USE_MODULES - if (!nomodules) { - char *drv = ((XF86ConfInputPtr) - (computer.devices[i]->config))->inp_driver; - - if (drv) { - drv_opts = module_options; - while (drv_opts) { - if (drv_opts->type == InputModule && - strcmp(drv_opts->name, drv) == 0) - break; - drv_opts = drv_opts->next; - } - } - } -#endif - - break; - case CARD: - options = (XF86OptionPtr*)&(((XF86ConfDevicePtr) - (computer.devices[i]->config))->dev_option_lst); -#ifdef USE_MODULES - if (!nomodules) { - char *drv = ((XF86ConfDevicePtr) - (computer.devices[i]->config))->dev_driver; - - if (drv) { - drv_opts = module_options; - while (drv_opts) { - if (drv_opts->type == VideoModule && - strcmp(drv_opts->name, drv) == 0) - break; - drv_opts = drv_opts->next; - } - } - } -#endif - break; - case MONITOR: - options = (XF86OptionPtr*)&(((XF86ConfMonitorPtr) - (computer.devices[i]->config))->mon_option_lst); - break; - } - } - } - -#ifdef USE_MODULES - OptionsPopup(options, drv_opts ? drv_opts->name : NULL, - drv_opts ? drv_opts->option : NULL); -#else - OptionsPopup(options); -#endif - if (config_mode == CONFIG_SCREEN) { - XF86OptionPtr option, options; - int rotate = 0; - - options = computer.screens[i]->screen->scrn_option_lst; - if ((option = xf86findOption(options, "Rotate")) != NULL) { - if (option->opt_val != NULL) - rotate = strcasecmp(option->opt_val, "CW") == 0 ? 1 : - strcasecmp(option->opt_val, "CCW") == 0 ? -1 : 0; - XtFree(option->opt_val); - option->opt_val = XtNewString(rotate > 0 ? "CW" : "CCW"); - computer.screens[i]->rotate = rotate; - } - else - computer.screens[i]->rotate = 0; - UpdateScreenUI(); - AdjustScreenUI(); - SetTip((xf86cfgDevice*)computer.screens[i]); - } - else { - if (i >= computer.num_devices) - SetTip(&cpu_device); - else - SetTip(computer.devices[i]); - } -} - -void -EnableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i; - - if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == config) { - computer.screens[i]->state = USED; - computer.screens[i]->card->state = USED; - ScreenSetup(False); - return; - } - } - - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->widget == config) { - if (computer.devices[i]->state == USED) - return; - computer.devices[i]->state = USED; - DrawCables(); - break; - } - if (i >= computer.num_devices || computer.layout == NULL) - return; - switch (computer.devices[i]->type) { - case MOUSE: - case KEYBOARD: { - int nmouses = 0, nkeyboards = 0; - XF86ConfInputPtr input = (XF86ConfInputPtr) - (computer.devices[i]->config); - XF86ConfInputrefPtr nex, iref = computer.layout->lay_input_lst; - XF86OptionPtr option; - - nex = iref; - while (nex != NULL) { - if (strcasecmp(nex->iref_inputdev->inp_driver, "mouse") == 0) - ++nmouses; - else if (IS_KBDDRIV(nex->iref_inputdev->inp_driver)) - ++nkeyboards; - iref = nex; - nex = (XF86ConfInputrefPtr)(nex->list.next); - } - nex = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec)); - nex->list.next = NULL; - nex->iref_inputdev = input; - nex->iref_inputdev_str = XtNewString(input->inp_identifier); - if (nmouses == 0 && computer.devices[i]->type == MOUSE) - option = xf86newOption(XtNewString("CorePointer"), NULL); - else if (nkeyboards == 0 && computer.devices[i]->type == KEYBOARD) - option = xf86newOption(XtNewString("CoreKeyboard"), NULL); - else - option = xf86newOption(XtNewString("SendCoreEvents"), NULL); - nex->iref_option_lst = option; - computer.layout->lay_input_lst = - xf86addInputref(computer.layout->lay_input_lst, nex); - } break; - case CARD: - for (i = 0; i < computer.num_screens; i++) { - if (computer.screens[i]->card->widget == config && - computer.screens[i]->state != USED) { - XF86ConfAdjacencyPtr adj; - - adj = (XF86ConfAdjacencyPtr) - XtCalloc(1, sizeof(XF86ConfAdjacencyRec)); - adj->adj_screen = computer.screens[i]->screen; - adj->adj_screen_str = XtNewString(computer.screens[i]-> - screen->scrn_identifier); - computer.layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr) - xf86addListItem((GenericListPtr)computer.layout-> - lay_adjacency_lst, (GenericListPtr)adj); - computer.screens[i]->state = USED; - } - } - break; - case MONITOR: - break; - } -} - -void -DisableDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i; - - if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == config) { - computer.screens[i]->state = UNUSED; - computer.screens[i]->card->state = UNUSED; - ScreenSetup(False); - return; - } - } - - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->widget == config) { - if (computer.devices[i]->state == UNUSED) - return; - computer.devices[i]->state = UNUSED; - DrawCables(); - break; - } - if (i >= computer.num_devices || computer.layout == NULL) - return; - switch (computer.devices[i]->type) { - case MOUSE: - case KEYBOARD: - xf86removeInputRef(computer.layout, - (XF86ConfInputPtr)(computer.devices[i]->config)); - break; - case CARD: { - XF86ConfAdjacencyPtr adj; - int j; - - if (computer.layout == NULL) - break; - for (j = 0; j < computer.num_screens; j++) - if (computer.screens[j]->card->widget == config) { - adj = computer.layout->lay_adjacency_lst; - while (adj != NULL) { - if (adj->adj_screen == computer.screens[j]->screen) { - xf86removeAdjacency(computer.layout, adj); - break; - } - adj = (XF86ConfAdjacencyPtr)(adj->list.next); - } - computer.screens[j]->state = UNUSED; - break; - } - } break; - case MONITOR: - break; - } -} - -/* ARGSUSED */ -void -RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i, j; - - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == config) { - RemoveScreen(computer.screens[i]->monitor, - computer.screens[i]->card); - ScreenSetup(False); - return; - } - - for (i = 0; i < computer.num_devices; i++) { - if (computer.devices[i]->widget == config) { - switch (computer.devices[i]->type) { - case MOUSE: - case KEYBOARD: - xf86removeInput(XF86Config, - (XF86ConfInputPtr)(computer.devices[i]->config)); - break; - case CARD: - case MONITOR: - break; - } - - if (computer.devices[i]->type == CARD) { - for (j = 0; j < computer.num_screens; j++) - if (computer.screens[j]->card == computer.devices[i]) { - RemoveScreen(computer.screens[j]->monitor, - computer.devices[i]); - --j; - } - if (computer.devices[i]->refcount <= 0) - xf86removeDevice(XF86Config, - (XF86ConfDevicePtr)(computer.devices[i]->config)); - } - else if (computer.devices[i]->type == MONITOR) { - for (j = 0; j < computer.num_screens; j++) - if (computer.screens[j]->monitor == computer.devices[i]) { - RemoveScreen(computer.devices[i], - computer.screens[j]->card); - --j; - } - if (computer.devices[i]->refcount <= 0) - xf86removeMonitor(XF86Config, - (XF86ConfMonitorPtr)(computer.devices[i]->config)); - } - - if (computer.devices[i]->refcount <= 0) { - int type = computer.devices[i]->type; - - XtDestroyWidget(computer.devices[i]->widget); - XtFree((XtPointer)computer.devices[i]); - if (--computer.num_devices > i) - memmove(&computer.devices[i], &computer.devices[i + 1], - (computer.num_devices - i) * sizeof(xf86cfgDevice*)); - - DrawCables(); - UpdateMenuDeviceList(type); - } - - break; - } - } -} - -void -UpdateMenuDeviceList(int type) -{ - Widget sme = NULL, menu = NULL; - int i, count; - static char *mouseM = "mouseM", *keyboardM = "keyboardM", - *cardM = "cardM", *monitorM = "monitorM"; - - for (i = count = 0; i < computer.num_devices; i++) - if (computer.devices[i]->type == type) - ++count; - - switch (type) { - case MOUSE: - sme = mouseSme; - menu = mouseMenu; - break; - case KEYBOARD: - sme = keyboardSme; - menu = keyboardMenu; - break; - case CARD: - sme = cardSme; - menu = cardMenu; - break; - case MONITOR: - sme = monitorSme; - menu = monitorMenu; - break; - } - - if (menu) - for (i = ((CompositeWidget)menu)->composite.num_children - 1; i >= 0; i--) - XtDestroyWidget(((CompositeWidget)menu)->composite.children[i]); - - if (count < 2) { - XtVaSetValues(sme, XtNmenuName, NULL, XtNleftBitmap, None, NULL); - return; - } - - switch (type) { - case MOUSE: - if (mouseMenu == NULL) - menu = mouseMenu = - XtCreatePopupShell(mouseM, simpleMenuWidgetClass, - XtParent(mouseSme), NULL, 0); - XtVaSetValues(mouseSme, XtNmenuName, mouseM, - XtNleftBitmap, menuPixmap, NULL); - break; - case KEYBOARD: - if (keyboardMenu == NULL) - menu = keyboardMenu = - XtCreatePopupShell(keyboardM, simpleMenuWidgetClass, - XtParent(keyboardSme), NULL, 0); - XtVaSetValues(keyboardSme, XtNmenuName, keyboardM, - XtNleftBitmap, menuPixmap, NULL); - break; - case CARD: - if (cardMenu == NULL) - menu = cardMenu = - XtCreatePopupShell(cardM, simpleMenuWidgetClass, - XtParent(cardSme), NULL, 0); - XtVaSetValues(cardSme, XtNmenuName, cardM, - XtNleftBitmap, menuPixmap, NULL); - break; - case MONITOR: - if (monitorMenu == NULL) - menu = monitorMenu = - XtCreatePopupShell(monitorM, simpleMenuWidgetClass, - XtParent(monitorSme), NULL, 0); - XtVaSetValues(monitorSme, XtNmenuName, monitorM, - XtNleftBitmap, menuPixmap, NULL); - break; - } - - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->type == type) { - char *label = NULL; - - if (computer.devices[i]->config) { - switch (type) { - case MOUSE: - case KEYBOARD: - label = ((XF86ConfInputPtr)computer.devices[i]->config) - ->inp_identifier; - break; - case CARD: - label = ((XF86ConfDevicePtr)computer.devices[i]->config) - ->dev_identifier; - break; - case MONITOR: - label = ((XF86ConfMonitorPtr)computer.devices[i]->config) - ->mon_identifier; - break; - } - } - else { - switch (type) { - case MOUSE: - label = "newMouse"; - break; - case KEYBOARD: - label = "newKeyboard"; - break; - case CARD: - label = "newCard"; - break; - case MONITOR: - label = "newMonitor"; - break; - } - } - - sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0); - XtAddCallback(sme, XtNcallback, SmeConfigureDeviceCallback, - computer.devices[i]->config ? - computer.devices[i]->config : - (XtPointer) (-((long)type + 100))); - } -} - -/*ARGSUSED*/ -void -SelectDeviceAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - device = w; - xpos = event->xbutton.x_root; - ypos = event->xbutton.y_root; - XDefineCursor(XtDisplay(device), XtWindow(device), no_cursor); - - if (config_mode == CONFIG_SCREEN) { - sxpos = device->core.x; - sypos = device->core.y; - } -} - -/*ARGSUSED*/ -void -MoveDeviceAction(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - int dx, dy, x, y, oldx, oldy; - - if (device == NULL || device != w) - return; - - dx = event->xbutton.x_root - xpos; - dy = event->xbutton.y_root - ypos; - - oldx = device->core.x; - oldy = device->core.y; - x = device->core.x + dx; - y = device->core.y + dy; - - if (x < 0) - x = 0; - else if (x + device->core.width > XtParent(device)->core.width) - x = XtParent(device)->core.width - device->core.width; - if (y < 0) - y = 0; - else if (y + device->core.height > XtParent(device)->core.height) - y = XtParent(device)->core.height - device->core.height; - - dx = x - oldx; - dy = y - oldy; - - XRaiseWindow(XtDisplay(device), XtWindow(device)); - XtMoveWidget(device, x, y); - - xpos += dx; - ypos += dy; -} - -/*ARGSUSED*/ -void -UnselectDeviceAction(Widget w, XEvent *ev, String *params, Cardinal *num_params) -{ - if (device != NULL) { - XUndefineCursor(XtDisplay(device), XtWindow(device)); - - if (config_mode == CONFIG_SCREEN) - ScreenSetup(False); - device = NULL; - } -} - -/*ARGSUSED*/ -void -DevicePopupMenu(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - static Widget configure, options, enable, disable, remove; - static int first = 1; - int i; - xf86cfgDevice *dev; - - if (first) { - first = 0; - - popup = XtCreatePopupShell("popup", simpleMenuWidgetClass, - toplevel, NULL, 0); - configure = XtCreateManagedWidget("configure", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(configure, XtNcallback, ConfigureDeviceCallback, NULL); - options = XtCreateManagedWidget("options", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(options, XtNcallback, OptionsCallback, NULL); - XtCreateManagedWidget("line", smeLineObjectClass, - popup, NULL, 0); - enable = XtCreateManagedWidget("enable", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(enable, XtNcallback, EnableDeviceCallback, NULL); - disable = XtCreateManagedWidget("disable", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(disable, XtNcallback, DisableDeviceCallback, NULL); - XtCreateManagedWidget("line", smeLineObjectClass, - popup, NULL, 0); - remove = XtCreateManagedWidget("remove", smeBSBObjectClass, - popup, NULL, 0); - XtAddCallback(remove, XtNcallback, RemoveDeviceCallback, NULL); - - XtRealizeWidget(popup); - } - - dev = NULL; - if (config_mode == CONFIG_LAYOUT) { - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->widget == w) { - dev = computer.devices[i]; - break; - } - if (i >= computer.num_devices && strcmp(XtName(w), "cpu")) - return; - if (dev == NULL) - dev = &cpu_device; - } - else if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - if (computer.screens[i]->widget == w) { - dev = (xf86cfgDevice*)computer.screens[i]; - break; - } - } - if (dev == NULL) - return; - - config = w; - - if (dev->type != SERVER) { - XtSetSensitive(configure, True); - XtSetSensitive(remove, True); - XtSetSensitive(options, dev->config != NULL); - if (computer.layout == NULL || dev->config == NULL || - dev->type == MONITOR) { - XtSetSensitive(enable, False); - XtSetSensitive(disable, False); - } - else if (dev->state == USED) { - XtSetSensitive(enable, False); - XtSetSensitive(disable, True); - } - else { - XtSetSensitive(enable, True); - XtSetSensitive(disable, False); - } - } - else { - XtSetSensitive(configure, False); - XtSetSensitive(options, True); - XtSetSensitive(enable, False); - XtSetSensitive(disable, False); - XtSetSensitive(remove, False); - } - - XtMoveWidget(popup, event->xbutton.x_root, event->xbutton.y_root); - XtPopup(popup, XtGrabNone); -} - -/*ARGSUSED*/ -void -DevicePopdownMenu(Widget w, XEvent *event, String *params, Cardinal *num_params) -{ - if (popup && XtIsRealized(popup)) - XtPopdown(popup); -} - -void RenameLayoutAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - XF86ConfLayoutPtr lay = XF86Config->conf_layout_lst; - Arg args[1]; - char *name; - - XtSetArg(args[0], XtNstring, &name); - XtGetValues(layout, args, 1); - - if (computer.layout == NULL || (computer.layout && - strcasecmp(name, computer.layout->lay_identifier)) == 0) - return; - - if (name == NULL && *name == '\0') { - /* tell user about error */ - return; - } - - while (lay) { - if (strcasecmp(name, lay->lay_identifier) == 0) - /* tell user about error */ - return; - lay = (XF86ConfLayoutPtr)(lay->list.next); - } - - XtSetArg(args[0], XtNlabel, name); - XtSetValues(layoutsme, args, 1); - xf86renameLayout(XF86Config, computer.layout, name); -} - -/*ARGSUSED*/ -static void -ComputerEventHandler(Widget w, XtPointer closure, - XEvent *event, Boolean *continue_to_dispatch) -{ - if (event->xexpose.count > 1) - return; - - if (config_mode == CONFIG_LAYOUT) - DrawCables(); -} - -void -DrawCables(void) -{ - Display *display; - Window window; - int ox, oy, i; - xf86cfgScreen **scr = computer.screens; - - if (config_mode != CONFIG_LAYOUT) - return; - - ox = computer.cpu->core.x + (computer.cpu->core.width >> 1); - oy = computer.cpu->core.y + (computer.cpu->core.height >> 1); - - display = XtDisplay(work); - window = XtWindow(work); - XClearWindow(display, window); - - for (i = 0; i < computer.num_devices; i++) { - if (computer.devices[i]->state == USED && - computer.devices[i]->type != MONITOR) - DrawCable(display, window, ox, oy, - computer.devices[i]->widget->core.x + - (computer.devices[i]->widget->core.width>>1), - computer.devices[i]->widget->core.y + - (computer.devices[i]->widget->core.height>>1)); - - } - for (i = 0; i < computer.num_screens; i++) { - if (scr[i]->monitor != NULL) - DrawCable(display, window, - scr[i]->card->widget->core.x + - (scr[i]->card->widget->core.width>>1), - scr[i]->card->widget->core.y + - (scr[i]->card->widget->core.height>>1), - scr[i]->monitor->widget->core.x + - (scr[i]->monitor->widget->core.width>>1), - scr[i]->monitor->widget->core.y + - (scr[i]->monitor->widget->core.height>>1)); - } -} - -static void -DrawCable(Display *display, Window window, int o_x, int o_y, int d_x, int d_y) -{ - XDrawLine(display, window, cablegcshadow, o_x, o_y, d_x, d_y); - XDrawLine(display, window, cablegc, o_x, o_y, d_x, d_y); -} - -/*ARGSUSED*/ -void -SetConfigModeCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i, mode = (long)user_data; - Arg args[3]; - char *ptr; - static Dimension height; - - if (mode == config_mode) - return; - XtSetArg(args[0], XtNlabel, &ptr); - XtGetValues(w, args, 1); - XtSetArg(args[0], XtNlabel, ptr); - XtSetValues(topMenu, args, 1); - - if (config_mode == CONFIG_LAYOUT) { - XtSetArg(args[0], XtNheight, &height); - XtGetValues(commands, args, 1); - for (i = 0; i < computer.num_devices; i++) - XtUnmapWidget(computer.devices[i]->widget); - XtUnmapWidget(commands); - XtUnmapWidget(computer.cpu); - XtSetSensitive(commands, False); - XtSetArg(args[0], XtNheight, 1); - XtSetArg(args[1], XtNmin, 1); - XtSetArg(args[2], XtNmax, 1); - XtSetValues(commands, args, 3); - } - else if (config_mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - XtUnmapWidget(computer.screens[i]->widget); - } - else if (config_mode == CONFIG_MODELINE) { - VideoModeConfigureEnd(); - XtSetSensitive(layout, True); - XtSetSensitive(layoutm, True); - } - else if (config_mode == CONFIG_ACCESSX) { - AccessXConfigureEnd(); - XtSetSensitive(layout, True); - XtSetSensitive(layoutm, True); - } - - config_mode = mode; - XClearWindow(XtDisplay(work), XtWindow(work)); - if (mode == CONFIG_LAYOUT) { - for (i = 0; i < computer.num_devices; i++) - XtMapWidget(computer.devices[i]->widget); - XtSetArg(args[0], XtNheight, height); - XtSetArg(args[1], XtNmin, height); - XtSetArg(args[2], XtNmax, height); - XtSetValues(commands, args, 3); - XtMapWidget(commands); - XtMapWidget(computer.cpu); - XtSetSensitive(commands, True); - DrawCables(); - } - else if (mode == CONFIG_SCREEN) { - for (i = 0; i < computer.num_screens; i++) - XtMapWidget(computer.screens[i]->widget); - ScreenSetup(True); - } - else if (mode == CONFIG_MODELINE) { - VideoModeConfigureStart(); - XtSetSensitive(layout, False); - XtSetSensitive(layoutm, False); - } - else if (mode == CONFIG_ACCESSX) { - AccessXConfigureStart(); - XtSetSensitive(layout, False); - XtSetSensitive(layoutm, False); - } -} - -static void -ScreenSetup(Bool check) -{ - if (check) { - int i; - - for (i = 0; i < computer.num_layouts; i++) - if (computer.layouts[i]->layout == computer.layout) - break; - - /* Just to put the screens in the correct positions */ - if (i >= computer.num_layouts) - AdjustScreenUI(); - } - - UpdateScreenUI(); - AdjustScreenUI(); -} diff --git a/hw/xfree86/utils/xorgcfg/keyboard-cfg.c b/hw/xfree86/utils/xorgcfg/keyboard-cfg.c deleted file mode 100644 index 545a67067..000000000 --- a/hw/xfree86/utils/xorgcfg/keyboard-cfg.c +++ /dev/null @@ -1,1378 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "xf86config.h" -#include "keyboard-cfg.h" -#include <X11/Xaw/Command.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/SimpleMenu.h> -#include <X11/Xaw/SmeBSB.h> - -#define IS_KBDDRIV(X) ((strcasecmp((X),"kbd") == 0)) - -/* - * Types - */ -typedef struct { - char *rules; - XkbRF_RulesPtr list; - XF86XkbDescInfo model; - XF86XkbDescInfo layout; - XF86XkbDescInfo variant; - XF86XkbDescInfo option; -} XF86XkbRulesDescInfo; - -/* - * Prototypes - */ -static void KeyboardRulesCallback(Widget, XtPointer, XtPointer); -static void KeyboardModelCallback(Widget, XtPointer, XtPointer); -static void KeyboardLayoutCallback(Widget, XtPointer, XtPointer); -static void KeyboardVariantCallback(Widget, XtPointer, XtPointer); -static void KeyboardOptionsCallback(Widget, XtPointer, XtPointer); -static void KeyboardApplyCallback(Widget, XtPointer, XtPointer); -static Bool KeyboardConfigCheck(void); -static void XkbUIEventHandler(Widget, XtPointer, XEvent*, Boolean*); -static XF86XkbRulesDescInfo *GetXkbRulesDesc(char*); -static void UpdateRulesPopups(void); - -/* - * Initialization - */ -static XF86XkbRulesDescInfo **xkb_desc, *xkb_rules; -static int num_xkb_desc; -static char *XkbRulesDir = "share/X11/xkb/rules/"; -#ifdef XFREE98_XKB -static char *XkbRulesFile = "xfree98"; -#else -static char *XkbRulesFile = __XKBDEFRULES__; -#endif -static XF86ConfInputPtr current_input; - -static char *rules, *model, *layout, *variant, *options; -static Widget kbd, rulesb, modelb, layoutb, variantb, optionsb, - modelp, layoutp, variantp, optionsp; -static XkbInfo **xkb_infos; -static int num_xkb_infos; -XkbInfo *xkb_info; - -static Widget apply; - -/* - * Implementation - */ -/*ARGSUSED*/ -XtPointer -KeyboardConfig(XtPointer config) -{ - XF86ConfInputPtr keyboard = (XF86ConfInputPtr)config; - XF86OptionPtr option; - Arg args[1]; - static char *XkbRules = "XkbRules", *XkbModel = "XkbModel", - *XkbLayout = "XkbLayout", *XkbVariant = "XkbVariant", - *XkbOptions = "XkbOptions"; - XF86XkbRulesDescInfo *info; - char *omodel, *olayout, *ovariant, *ooptions; - - InitializeKeyboard(); - rules = xkb_rules->rules; - if (xkb_info->config.rules_file == NULL) - xkb_info->config.rules_file = rules; - - if (options) - XtFree(options); - options = NULL; - - if (xkb_info->conf == NULL) - xkb_info->conf = keyboard; - - if (xkb_info->conf != keyboard) { - int i; - - for (i = 0; i < num_xkb_infos; i++) - if (xkb_infos[i]->conf == keyboard) { - xkb_info = xkb_infos[i]; - break; - } - - if (i >= num_xkb_infos) { - int timeout = 10; - - xkb_info = (XkbInfo*)XtCalloc(1, sizeof(XkbInfo)); - xkb_info->conf = keyboard; - xkb_infos = (XkbInfo**) - XtRealloc((XtPointer)xkb_infos, sizeof(XkbInfo*) * - (num_xkb_infos + 1)); - xkb_infos[num_xkb_infos++] = xkb_info; - - xkb_info->conf = keyboard; - bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); - while (timeout > 0) { - xkb_info->xkb = - XkbGetKeyboard(XtDisplay(configp), - XkbGBN_AllComponentsMask, XkbUseCoreKbd); - if (xkb_info->xkb == NULL) { - timeout -= 1; - sleep(1); - } - else - break; - } - if (timeout <= 0) { - fprintf(stderr, "Couldn't get keyboard\n"); - } - if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom && - xkb_info->xkb->names->geometry == 0) - xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name; - } - - /* check for removed devices */ - for (i = 0; i < num_xkb_infos; i++) { - XF86ConfInputPtr key = XF86Config->conf_input_lst; - - while (key != NULL) { - if (IS_KBDDRIV(key->inp_driver) && xkb_infos[i]->conf == key) - break; - key = (XF86ConfInputPtr)(key->list.next); - } - if (xkb_infos[i]->conf != NULL && key == NULL) { - XkbFreeKeyboard(xkb_infos[i]->xkb, 0, False); - XtFree((XtPointer)xkb_infos[i]); - if (--num_xkb_infos > i) - memmove(&xkb_infos[i], &xkb_infos[i + 1], - (num_xkb_infos - i) * sizeof(XkbInfo*)); - } - } - } - - current_input = keyboard; - - if (keyboard != NULL) { - if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) != NULL) { - if (strcmp(rules, option->opt_val)) { - XF86XkbRulesDescInfo *info = GetXkbRulesDesc(option->opt_val); - - if (info) { - rules = info->rules; - UpdateRulesPopups(); - } - } - } - if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL) - xkb_info->defs.model = model = option->opt_val; - else - xkb_info->defs.model = model = xkb_rules->model.name[0]; - if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) != NULL) - xkb_info->defs.layout = layout = option->opt_val; - else - xkb_info->defs.layout = layout = xkb_rules->layout.name[0]; - if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) != NULL) - xkb_info->defs.variant = variant = option->opt_val; - else - xkb_info->defs.variant = variant = NULL; - - if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) != NULL) - xkb_info->defs.options = options = XtNewString(option->opt_val); - else - xkb_info->defs.options = options = NULL; - - XtSetArg(args[0], XtNstring, keyboard->inp_identifier); - XtSetValues(ident_widget, args, 1); - - (void)UpdateKeyboard(False); - } - else { - XF86ConfInputPtr input = XF86Config->conf_input_lst; - char keyboard_name[48]; - int nkeyboards = 0; - - while (input != NULL) { - if (IS_KBDDRIV(input->inp_driver)) - ++nkeyboards; - input = (XF86ConfInputPtr)(input->list.next); - } - do { - XmuSnprintf(keyboard_name, sizeof(keyboard_name), - "Keyboard%d", nkeyboards); - ++nkeyboards; - } while (xf86findInput(keyboard_name, - XF86Config->conf_input_lst)); - - model = xkb_rules->model.name[0]; - layout = xkb_rules->layout.name[0]; - variant = ""; - options = XtNewString(""); - XtSetArg(args[0], XtNstring, keyboard_name); - XtSetValues(ident_widget, args, 1); - } - - info = xkb_rules; - omodel = model; - olayout = layout; - ovariant = variant; - ooptions = options ? XtNewString(options) : NULL; - - xf86info.cur_list = KEYBOARD; - XtSetSensitive(back, xf86info.lists[KEYBOARD].cur_function > 0); - XtSetSensitive(next, xf86info.lists[KEYBOARD].cur_function < - xf86info.lists[KEYBOARD].num_functions - 1); - (xf86info.lists[KEYBOARD].functions[xf86info.lists[KEYBOARD].cur_function]) - (&xf86info); - - if (ConfigLoop(KeyboardConfigCheck) == True) { - if (keyboard == NULL) { - keyboard = XtNew(XF86ConfInputRec); - keyboard->list.next = NULL; - keyboard->inp_identifier = XtNewString(ident_string); - keyboard->inp_driver = XtNewString("kbd"); - keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules), - XtNewString(rules)); - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbModel), XtNewString(model)); - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbLayout), XtNewString(layout)); - if (variant && *variant) - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbVariant), XtNewString(variant)); - if (options && *options) { - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbOptions), options); - options = NULL; - } - keyboard->inp_comment = NULL; - } - else { - int i; - char *str; - - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(modelb, args, 1); - for (i = 0; i < xkb_rules->model.nelem; i++) - if (strcmp(xkb_rules->model.desc[i], str) == 0) { - model = xkb_rules->model.name[i]; - break; - } - - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(layoutb, args, 1); - for (i = 0; i < xkb_rules->layout.nelem; i++) - if (strcmp(xkb_rules->layout.desc[i], str) == 0) { - layout = xkb_rules->layout.name[i]; - break; - } - - if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) - != NULL) { - XtFree(option->opt_val); - option->opt_val = XtNewString(rules); - XtFree(option->opt_comment); - option->opt_comment = NULL; - } - else - keyboard->inp_option_lst = - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbRules), XtNewString(rules)); - - if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) - != NULL) { - XtFree(option->opt_val); - option->opt_val = XtNewString(model); - XtFree(option->opt_comment); - option->opt_comment = NULL; - } - else - keyboard->inp_option_lst = - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbModel), XtNewString(model)); - XtFree(xkb_info->config.model); - xkb_info->config.model = XtNewString(model); - - if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) - != NULL) { - XtFree(option->opt_val); - option->opt_val = XtNewString(layout); - } - else - keyboard->inp_option_lst = - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbLayout), XtNewString(layout)); - XtFree(xkb_info->config.layout); - xkb_info->config.layout = XtNewString(layout); - - if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) - != NULL) { - if (variant && *variant) { - XtFree(option->opt_val); - option->opt_val = XtNewString(variant); - } - else - xf86removeOption(&keyboard->inp_option_lst, XkbVariant); - } - else if (variant && *variant) - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbVariant), XtNewString(variant)); - XtFree(xkb_info->config.variant); - xkb_info->config.variant = variant && *variant ? - XtNewString(variant) : NULL; - - XtFree(xkb_info->config.options); - xkb_info->config.options = options && *options ? - XtNewString(options) : NULL; - if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) - != NULL) { - if (options && *options) { - XtFree(option->opt_val); - option->opt_val = options; - options = NULL; - } - else - xf86removeOption(&keyboard->inp_option_lst, XkbOptions); - } - else if (options && *options) { - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbOptions), options); - options = NULL; - } - } - if (strcasecmp(keyboard->inp_identifier, ident_string)) - xf86renameInput(XF86Config, keyboard, ident_string); - - xkb_info->conf = keyboard; - xkb_info->config.rules_file = rules; - - return ((XtPointer)keyboard); - } - - xkb_rules = info; - rules = info->rules; - model = omodel; - layout = olayout; - variant = ovariant; - XtFree(options); - options = ooptions; - - return (NULL); -} - -static Bool -KeyboardConfigCheck(void) -{ - XF86ConfInputPtr keyboard = XF86Config->conf_input_lst; - - while (keyboard != NULL) { - if (keyboard != current_input && - strcasecmp(ident_string, keyboard->inp_identifier) == 0) - return (False); - keyboard = (XF86ConfInputPtr)(keyboard->list.next); - } - - return (True); -} - -/*ARGSUSED*/ -static void -XkbUIEventHandler(Widget w, XtPointer closure, - XEvent *event, Boolean *continue_to_dispatch) -{ - XkbUI_ViewOptsRec opts; - XkbUI_ViewPtr view; - int width, height, bd; - - if (event->xexpose.count > 1) - return; - - bzero((char *)&opts, sizeof(opts)); - bd = 1; - opts.present = XkbUI_SizeMask | XkbUI_ColormapMask | - XkbUI_MarginMask | XkbUI_OffsetMask; - opts.margin_width = opts.margin_height = 0; - opts.viewport.x = opts.viewport.y = bd; - width = opts.viewport.width = w->core.width - 2 * bd; - height = opts.viewport.height = w->core.height - 2 * bd; - opts.cmap = w->core.colormap; - - if ((view = XkbUI_Init(XtDisplay(w), XtWindow(w), width, height, - xkb_info->xkb, &opts)) != NULL) { - XkbUI_DrawRegion(view, NULL); - free(view); - } -} - -void -InitializeKeyboard(void) -{ - int major, minor, op, event, error; - static int first = 1; - int timeout = 5; - XF86ConfInputPtr keyboard = XF86Config->conf_input_lst; - XF86OptionPtr option; - char name[PATH_MAX]; - FILE *file; - - if (!first) - return; - first = 0; - - major = XkbMajorVersion; - minor = XkbMinorVersion; - if (XkbQueryExtension(DPY, &op, &event, &error, &major, &minor) == 0) { - fprintf(stderr, "Unable to initialize XKEYBOARD extension"); - exit(1); - } - - xkb_info = (XkbInfo *)XtCalloc(1, sizeof(XkbInfo)); - xkb_info->conf = NULL; - xkb_infos = (XkbInfo**)XtCalloc(1, sizeof(XkbInfo*)); - num_xkb_infos = 1; - xkb_infos[0] = xkb_info; - bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); - - while (timeout > 0) { - xkb_info->xkb = - XkbGetKeyboard(DPY, XkbGBN_AllComponentsMask, XkbUseCoreKbd); - if (xkb_info->xkb == NULL) { - timeout -= 1; - sleep(1); - } - else - break; - } - if (timeout <= 0) { - fprintf(stderr, "Couldn't get keyboard\n"); - } - if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom && - xkb_info->xkb->names->geometry == 0) - xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name; - - /* Load configuration */ - XmuSnprintf(name, sizeof(name), "%s%s", XkbConfigDir, XkbConfigFile); - file = fopen(name, "r"); - if (file != NULL) { - if (XkbCFParse(file, XkbCFDflts, xkb_info->xkb, &xkb_info->config) == 0) { - fprintf(stderr, "Error parsing config file: "); - XkbCFReportError(stderr, name, xkb_info->config.error, - xkb_info->config.line); - } - fclose(file); - } - - xkb_rules = GetXkbRulesDesc(xkb_info->config.rules_file != NULL ? - xkb_info->config.rules_file : XkbRulesFile); - if (xkb_rules == NULL) - /* error message was printed */ - exit(1); - - /* XXX Assumes the first keyboard is the core keyboard */ - while (keyboard != NULL) { - if (IS_KBDDRIV(keyboard->inp_driver)) - break; - keyboard = (XF86ConfInputPtr)(keyboard->list.next); - } - if (keyboard == NULL) - return; - - if (xkb_info->config.rules_file != NULL) - rules = xkb_info->config.rules_file; - else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbRules")) - != NULL) - rules = option->opt_val; - else - rules = XkbRulesFile; - - if (strcmp(rules, xkb_rules->rules)) { - xkb_rules = GetXkbRulesDesc(rules); - if (xkb_rules == NULL) - /* error message was printed */ - exit(1); - } - { - FILE *fp; - char filename[1024]; - - XmuSnprintf(filename, sizeof(filename), "%s%s", - XkbRulesDir, xkb_rules->rules); - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "Can't open rules file\n"); - exit(1); - } - - if (!XkbRF_LoadRules(fp, xkb_rules->list)) { - fclose(fp); - fprintf(stderr, "Can't load rules\n"); - exit(1); - } - fclose(fp); - } - - if (xkb_info->config.rules_file == NULL) - xkb_info->config.rules_file = xkb_rules->rules; - - if (xkb_info->config.model != NULL) - xkb_info->defs.model = xkb_info->config.model; - else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbModel")) - != NULL) - xkb_info->defs.model = option->opt_val; - else - xkb_info->defs.model = xkb_rules->model.name[0]; - - if (xkb_info->config.layout != NULL) - xkb_info->defs.layout = xkb_info->config.layout; - else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbLayout")) - != NULL) - xkb_info->defs.layout = option->opt_val; - else - xkb_info->defs.layout = xkb_rules->layout.name[0]; - - if (xkb_info->config.variant != NULL) - xkb_info->defs.variant = xkb_info->config.variant; - else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbVariant")) - != NULL) - xkb_info->defs.variant = option->opt_val; - else - xkb_info->defs.variant = NULL; - - if (xkb_info->config.options != NULL) - xkb_info->defs.options = xkb_info->config.options; - else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbOptions")) - != NULL) - xkb_info->defs.options = option->opt_val; - else - xkb_info->defs.options = NULL; - - if (xkb_info->xkb == NULL) { - /* Try again */ - XkbComponentNamesRec comps; - - bzero((char*)&comps, sizeof(XkbComponentNamesRec)); - XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps); - - xkb_info->xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps, - XkbGBN_AllComponentsMask, 0, 0); - } -} - -static XF86XkbRulesDescInfo * -GetXkbRulesDesc(char *rules) -{ - int i; - XkbRF_RulesPtr list; - char filename[1024]; - XF86XkbRulesDescInfo *info; - - if (rules == NULL) - return (NULL); - - for (i = 0; i < num_xkb_desc; i++) - if (strcmp(rules, xkb_desc[i]->rules) == 0) - return (xkb_desc[i]); - - XmuSnprintf(filename, sizeof(filename), "%s%s", XkbRulesDir, rules); - if ((list = XkbRF_Create(0, 0)) == NULL || - !XkbRF_LoadDescriptionsByName(filename, NULL, list)) { - fprintf(stderr, "Can't create rules structure\n"); - return (NULL); - } - - info = (XF86XkbRulesDescInfo*)XtCalloc(1, sizeof(XF86XkbRulesDescInfo)); - xkb_desc = (XF86XkbRulesDescInfo**) - XtRealloc((XtPointer)xkb_desc, - sizeof(XF86XkbRulesDescInfo*) * (num_xkb_desc + 1)); - xkb_desc[num_xkb_desc++] = info; - info->rules = XtNewString(rules); - for (i = 0; i < list->models.num_desc; i++) { - if (i % 16 == 0) { - info->model.name = (char**)XtRealloc((XtPointer)info->model.name, - (i + 16) * sizeof(char*)); - info->model.desc = (char**)XtRealloc((XtPointer)info->model.desc, - (i + 16) * sizeof(char*)); - } - info->model.name[i] = XtNewString(list->models.desc[i].name); - info->model.desc[i] = XtNewString(list->models.desc[i].desc); - } - info->model.nelem = i; - - for (i = 0; i < list->layouts.num_desc; i++) { - if (i % 16 == 0) { - info->layout.name = (char**)XtRealloc((XtPointer)info->layout.name, - (i + 16) * sizeof(char*)); - info->layout.desc = (char**)XtRealloc((XtPointer)info->layout.desc, - (i + 16) * sizeof(char*)); - } - info->layout.name[i] = XtNewString(list->layouts.desc[i].name); - info->layout.desc[i] = XtNewString(list->layouts.desc[i].desc); - } - info->layout.nelem = i; - - for (i = 0; i < list->variants.num_desc; i++) { - if (i % 16 == 0) { - info->variant.name = (char**)XtRealloc((XtPointer)info->variant.name, - (i + 16) * sizeof(char*)); - info->variant.desc = (char**)XtRealloc((XtPointer)info->variant.desc, - (i + 16) * sizeof(char*)); - } - info->variant.name[i] = XtNewString(list->variants.desc[i].name); - info->variant.desc[i] = XtNewString(list->variants.desc[i].desc); - } - info->variant.nelem = i; - - for (i = 0; i < list->options.num_desc; i++) { - if (i % 16 == 0) { - info->option.name = (char**)XtRealloc((XtPointer)info->option.name, - (i + 16) * sizeof(char*)); - info->option.desc = (char**)XtRealloc((XtPointer)info->option.desc, - (i + 16) * sizeof(char*)); - } - info->option.name[i] = XtNewString(list->options.desc[i].name); - info->option.desc[i] = XtNewString(list->options.desc[i].desc); - } - info->option.nelem = i; - info->list = list; - - return (info); -} - -static xf86ConfigSymTabRec ax_controls[] = -{ - {XkbRepeatKeysMask, "RepeatKeys"}, - {XkbSlowKeysMask, "SlowKeys"}, - {XkbBounceKeysMask, "BounceKeys"}, - {XkbStickyKeysMask, "StickyKeys"}, - {XkbMouseKeysMask, "MouseKeys"}, - {XkbMouseKeysAccelMask, "MouseKeysAccel"}, - {XkbAccessXKeysMask, "AccessxKeys"}, - {XkbAccessXTimeoutMask, "AccessxTimeout"}, - {XkbAccessXFeedbackMask, "AccessxFeedback"}, - {XkbAudibleBellMask, "AudibleBell"}, - {XkbOverlay1Mask, "Overlay1"}, - {XkbOverlay2Mask, "Overlay2"}, - {XkbIgnoreGroupLockMask, "IgnoreGroupLock"}, - {-1, ""}, -}; - -static xf86ConfigSymTabRec ax_feedback[] = -{ - {XkbAX_SKPressFBMask, "SlowKeysPress"}, - {XkbAX_SKAcceptFBMask, "SlowKeysAccept"}, - {XkbAX_FeatureFBMask, "Feature"}, - {XkbAX_SlowWarnFBMask, "SlowWarn"}, - {XkbAX_IndicatorFBMask, "Indicator"}, - {XkbAX_StickyKeysFBMask, "StickyKeys"}, - {XkbAX_TwoKeysMask, "TwoKeys"}, - {XkbAX_LatchToLockMask, "LatchToLock"}, - {XkbAX_SKReleaseFBMask, "SlowKeysRelease"}, - {XkbAX_SKRejectFBMask, "SlowkeysReject"}, - {XkbAX_BKRejectFBMask, "BounceKeysReject"}, - {XkbAX_DumbBellFBMask, "DumbBell"}, - {-1, ""}, -}; - -Bool -WriteXKBConfiguration(char *filename, XkbConfigRtrnPtr conf) -{ - FILE *fp; - int i, count; - - if (filename == NULL || conf == NULL || - (fp = fopen(filename, "w")) == NULL) - return (False); - - if (conf->rules_file != NULL) - fprintf(fp, "Rules = \"%s\"\n", - conf->rules_file); - if (conf->model != NULL) - fprintf(fp, "Model = \"%s\"\n", - conf->model); - if (conf->layout != NULL) - fprintf(fp, "Layout = \"%s\"\n", - conf->layout); - if (conf->variant != NULL) - fprintf(fp, "Variant = \"%s\"\n", - conf->variant); - if (conf->options != NULL) - fprintf(fp, "Options = \"%s\"\n", - conf->options); - if (conf->keymap != NULL) - fprintf(fp, "Keymap = %s\n", - conf->keymap); - if (conf->keycodes != NULL) - fprintf(fp, "Keycodes = %s\n", - conf->keycodes); - if (conf->geometry != NULL) - fprintf(fp, "Geometry = %s\n", - conf->geometry); - if (conf->phys_symbols != NULL) - fprintf(fp, "RealSymbols = %s\n", - conf->phys_symbols); - if (conf->symbols != NULL) - fprintf(fp, "Symbols = %s\n", - conf->symbols); - if (conf->types != NULL) - fprintf(fp, "Types = %s\n", - conf->types); - if (conf->compat != NULL) - fprintf(fp, "Compat = %s\n", - conf->compat); - - if (conf->click_volume > 0) - fprintf(fp, "ClickVolume = %d\n", - conf->click_volume); - if (conf->bell_volume > 0) - fprintf(fp, "BellVolume = %d\n", - conf->bell_volume); - if (conf->bell_pitch > 0) - fprintf(fp, "BellPitch = %d\n", - conf->bell_pitch); - if (conf->bell_duration > 0) - fprintf(fp, "BellDuration = %d\n", - conf->bell_duration); - - if (conf->repeat_delay > 0) - fprintf(fp, "RepeatDelay = %d\n", - conf->repeat_delay); - if (conf->repeat_interval > 0) - fprintf(fp, "RepeatInterval = %d\n", - conf->repeat_interval); - - if (conf->slow_keys_delay > 0) - fprintf(fp, "SlowKeysDelay = %d\n", - conf->slow_keys_delay); - - if (conf->debounce_delay > 0) - fprintf(fp, "DebounceDelay = %d\n", - conf->debounce_delay); - - if (conf->mk_delay > 0) - fprintf(fp, "MouseKeysDelay = %d\n", - conf->mk_delay); - if (conf->mk_interval > 0) - fprintf(fp, "MouseKeysInterval = %d\n", - conf->mk_interval); - if (conf->mk_time_to_max > 0) - fprintf(fp, "MouseKeysTimeToMax = %d\n", - conf->mk_time_to_max); - if (conf->mk_max_speed > 0) - fprintf(fp, "MouseKeysMaxSpeed = %d\n", - conf->mk_max_speed); - fprintf(fp, "MouseKeysCurve = %d\n", conf->mk_curve); - - if (conf->ax_timeout) - fprintf(fp, "AccessXTimeout = %d\n", - conf->ax_timeout); - if (conf->initial_ctrls != 0) { - fprintf(fp, "Controls %c= ", - conf->replace_initial_ctrls ? ' ' : '+'); - for (i = count = 0; *ax_controls[i].name; i++) - if ((conf->initial_ctrls & ax_controls[i].token) - == ax_controls[i].token) - fprintf(fp, "%s%s", count++ ? " + " : "", - ax_controls[i].name); - fprintf(fp, "\n"); - } - if (conf->axt_ctrls_on != 0) { - fprintf(fp, "AcessXTimeoutCtrlsOn %c= ", - conf->replace_axt_ctrls_on ? ' ' : '+'); - for (i = count = 0; *ax_controls[i].name; i++) - if ((conf->axt_ctrls_on & ax_controls[i].token) - == ax_controls[i].token) - fprintf(fp, "%s%s", count++ ? " + " : "", - ax_controls[i].name); - fprintf(fp, "\n"); - } - if (conf->axt_ctrls_off != 0) { - fprintf(fp, "AcessXTimeoutCtrlsOff %c= ", - conf->replace_axt_ctrls_off ? ' ' : '-'); - for (i = count = 0; *ax_controls[i].name; i++) - if ((conf->axt_ctrls_off & ax_controls[i].token) - == ax_controls[i].token) - fprintf(fp, "%s%s", count++ ? " + " : "", - ax_controls[i].name); - fprintf(fp, "\n"); - } - - if (conf->initial_opts != 0) { - fprintf(fp, "Feedback %c= ", - conf->replace_initial_opts ? ' ' : '+'); - for (i = count = 0; *ax_feedback[i].name; i++) - if ((conf->initial_opts & ax_feedback[i].token) - == ax_feedback[i].token) - fprintf(fp, "%s%s", count++ ? " + " : "", - ax_feedback[i].name); - fprintf(fp, "\n"); - } - if (conf->axt_opts_on != 0) { - fprintf(fp, "AcessXTimeoutFeedbackOn %c= ", - conf->replace_axt_opts_on ? ' ' : '+'); - for (i = count = 0; *ax_controls[i].name; i++) - if ((conf->axt_opts_on & ax_feedback[i].token) - == ax_feedback[i].token) - fprintf(fp, "%s%s", count++ ? " + " : "", - ax_feedback[i].name); - fprintf(fp, "\n"); - } - if (conf->axt_opts_off != 0) { - fprintf(fp, "AcessXTimeoutFeedbackOff%c= ", - conf->replace_axt_opts_off ? ' ' : '-'); - for (i = count = 0; *ax_feedback[i].name; i++) - if ((conf->axt_opts_off & ax_feedback[i].token) - == ax_feedback[i].token) - fprintf(fp, "%s%s", count++ ? " + " : "", - ax_feedback[i].name); - fprintf(fp, "\n"); - } - - fclose(fp); - - return (True); -} - -Bool -UpdateKeyboard(Bool load) -{ - XkbComponentNamesRec comps; - XkbDescPtr xkb; - - bzero((char*)&comps, sizeof(XkbComponentNamesRec)); - XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps); - - xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps, - XkbGBN_AllComponentsMask, 0, load); - - if (xkb == NULL || xkb->geom == NULL) { - fprintf(stderr, "Couldn't get keyboard\n"); - return (False); - } - if (xkb_info->xkb && xkb_info->xkb->names && xkb_info->xkb->geom && - xkb_info->xkb->names->geometry == 0) - xkb_info->xkb->names->geometry = xkb_info->xkb->geom->name; - - XkbFreeKeyboard(xkb_info->xkb, 0, False); - - xkb_info->xkb = xkb; - - XtFree(comps.keymap); - XtFree(comps.keycodes); - XtFree(comps.compat); - XtFree(comps.types); - XtFree(comps.symbols); - XtFree(comps.geometry); - - if (kbd != NULL) - XClearArea(XtDisplay(configp), XtWindow(kbd), 0, 0, 0, 0, True); - - return (True); -} - -static void -KeyboardRulesCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - int i; - FILE *fp; - Arg args[1]; - char filename[1024], *omodel, *olayout, *ovariant, *ooptions, - *dmodel, *dlayout, *dvariant; - XF86XkbRulesDescInfo *oxkb_rules, *info = GetXkbRulesDesc(XtName(w)); - - if (strcmp(XtName(w), rules) == 0 || info == NULL) - /* a error message was printed */ - return; - - XmuSnprintf(filename, sizeof(filename), "%s%s", - XkbRulesDir, info->rules); - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "Can't open rules file\n"); - return; - } - - if (!XkbRF_LoadRules(fp, info->list)) { - fclose(fp); - fprintf(stderr, "Can't load rules\n"); - return; - } - fclose(fp); - - oxkb_rules = xkb_rules; - omodel = xkb_info->defs.model; - olayout = xkb_info->defs.layout; - ovariant = xkb_info->defs.variant; - ooptions = xkb_info->defs.options; - - if (omodel) { - for (i = 0; i < info->model.nelem; i++) { - if (strcmp(omodel, info->model.name[i]) == 0) - break; - } - } - else - i = 0; - model = xkb_info->defs.model = info->model.name - [i < info->model.nelem ? i : 0]; - dmodel = info->model.desc[i < info->model.nelem ? i : 0]; - - if (olayout) { - for (i = 0; i < info->layout.nelem; i++) { - if (strcmp(olayout, info->layout.name[i]) == 0) - break; - } - } - else - i = 0; - layout = xkb_info->defs.layout = info->layout.name - [i < info->layout.nelem ? i : 0]; - dlayout = info->layout.desc[i < info->layout.nelem ? i : 0]; - - if (ovariant) { - for (i = 0; i < info->variant.nelem; i++) { - if (strcmp(ovariant, info->variant.name[i]) == 0) - break; - } - } - else - i = info->variant.nelem; - variant = xkb_info->defs.variant = i < info->variant.nelem ? - info->variant.name[i] : NULL; - dvariant = i < info->variant.nelem ? - info->variant.desc[i] : NULL; - - if (ooptions) { - char *ptr, *tmp = XtNewString(options); - - for (ptr = strtok(tmp, ","); ptr != NULL; ptr = strtok(NULL, ",")) { - if (strchr(ptr, ':') == NULL) - continue; - - for (i = 0; i < xkb_rules->option.nelem; i++) - if (strcmp(xkb_rules->option.name[i], ptr) == 0) - break; - - if (i == xkb_rules->option.nelem) { - XtFree(options); - options = NULL; - /* no option with the same name */ - break; - } - } - XtFree(tmp); - } - else { - XtFree(options); - options = NULL; - } - - oxkb_rules = xkb_rules; - xkb_rules = info; - rules = info->rules; - - if (!UpdateKeyboard(False)) { - model = xkb_info->defs.model = omodel; - layout = xkb_info->defs.layout = olayout; - variant = xkb_info->defs.variant = ovariant; - options = XtNewString(xkb_info->defs.options = ooptions); - xkb_rules = oxkb_rules; - rules = xkb_rules->rules; - - XmuSnprintf(filename, sizeof(filename), "%s%s", - XkbRulesDir, rules); - if ((fp = fopen(filename, "r")) == NULL) { - fprintf(stderr, "Can't open rules file\n"); - return; - } - - if (!XkbRF_LoadRules(fp, xkb_rules->list)) { - fprintf(stderr, "Can't load rules\n"); - } - fclose(fp); - - return; - } - - UpdateRulesPopups(); - - XtSetArg(args[0], XtNlabel, rules); - XtSetValues(rulesb, args, 1); - - XtSetArg(args[0], XtNlabel, dmodel); - XtSetValues(modelb, args, 1); - - XtSetArg(args[0], XtNlabel, dlayout); - XtSetValues(layoutb, args, 1); - - XtSetArg(args[0], XtNlabel, dvariant ? dvariant : ""); - XtSetValues(variantb, args, 1); - - XtSetArg(args[0], XtNlabel, options ? options : ""); - XtSetValues(variantb, args, 1); -} - -static void -KeyboardModelCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - int i; - char *oldval = xkb_info->defs.model; - - for (i = 0; i < xkb_rules->model.nelem; i++) - if (strcmp(XtName(w), xkb_rules->model.name[i]) == 0) - break; - model = xkb_info->defs.model = xkb_rules->model.name[i]; - if (!UpdateKeyboard(False)) - model = xkb_info->defs.model = oldval; - else { - XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]); - XtSetValues(modelb, args, 1); - } -} - -static void -KeyboardLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - int i; - char *oldval = xkb_info->defs.layout; - - for (i = 0; i < xkb_rules->layout.nelem; i++) - if (strcmp(XtName(w), xkb_rules->layout.name[i]) == 0) - break; - layout = xkb_info->defs.layout = xkb_rules->layout.name[i]; - if (!UpdateKeyboard(False)) - layout = xkb_info->defs.layout = oldval; - else { - XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]); - XtSetValues(layoutb, args, 1); - } -} - -static void -KeyboardVariantCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - int i; - char *label, *oldval = xkb_info->defs.variant; - - for (i = 0; i < xkb_rules->variant.nelem; i++) - if (strcmp(XtName(w), xkb_rules->variant.name[i]) == 0) - break; - variant = i < xkb_rules->variant.nelem ? xkb_rules->variant.name[i] : ""; - xkb_info->defs.variant = variant && *variant ? variant : NULL; - - if (!UpdateKeyboard(False)) - xkb_info->defs.variant = variant = oldval; - else { - label = i < xkb_rules->variant.nelem ? xkb_rules->variant.desc[i] : ""; - XtSetArg(args[0], XtNlabel, label); - XtSetValues(variantb, args, 1); - } -} - -static void -KeyboardOptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - int i; - - for (i = 0; i < xkb_rules->option.nelem; i++) - if (strcmp(XtName(w), xkb_rules->option.name[i]) == 0) - break; - - if (i < xkb_rules->option.nelem) { - char *delim, *ptr, str[256]; - - /* remove old string, don't check if the same */ - if ((delim = strchr(XtName(w), ':')) != NULL) { - if (delim - XtName(w) >= sizeof(str) - 2) - return; - strncpy(str, XtName(w), delim - XtName(w) + 1); - str[delim - XtName(w) + 1] = '\0'; - } - else - XmuSnprintf(str, sizeof(str), "%s:", XtName(w)); - if (options && (delim = strstr(options, str)) != NULL) { - if ((ptr = strchr(delim, ',')) != NULL) { - *delim = *ptr = '\0'; - XmuSnprintf(str, sizeof(str), "%s%s", options, ptr + 1); - XtFree(options); - options = XtNewString(str); - } - else { - if (delim > options) - delim[-1] = '\0'; - else - delim[0] = '\0'; - } - } - - /* update string, if required */ - if ((delim = strchr(XtName(w), ':')) != NULL) { - if (options && *options) - XmuSnprintf(str, sizeof(str), "%s,%s", options, XtName(w)); - else - XmuSnprintf(str, sizeof(str), "%s", XtName(w)); - XtFree(options); - options = XtNewString(str); - } - } - else { - XtFree(options); - options = XtNewString(""); - } - - if (options == NULL) - options = XtNewString(""); - - xkb_info->defs.options = options; - if (!UpdateKeyboard(False)) { - *options = '\0'; - xkb_info->defs.options = NULL; - } - XtSetArg(args[0], XtNlabel, options); - XtSetValues(optionsb, args, 1); - XtSetArg(args[0], XtNtip, options); - XtSetValues(optionsb, args, 1); -} - -/*ARGSUSED*/ -static void -KeyboardApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - (void)UpdateKeyboard(True); -} - -static void -UpdateRulesPopups(void) -{ - int i; - char *optname; - Widget sme, optpopup = NULL, optparent; - - /* MODEL */ - if (modelp) - XtDestroyWidget(modelp); - modelp = XtCreatePopupShell("modelP", simpleMenuWidgetClass, - modelb, NULL, 0); - for (i = 0; i < xkb_rules->model.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_rules->model.name[i], smeBSBObjectClass, - modelp, - XtNlabel, xkb_rules->model.desc[i], - NULL); - XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL); - } - - /* LAYOUT */ - if (layoutp) - XtDestroyWidget(layoutp); - layoutp = XtCreatePopupShell("layoutP", simpleMenuWidgetClass, - layoutb, NULL, 0); - for (i = 0; i < xkb_rules->layout.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_rules->layout.name[i], smeBSBObjectClass, - layoutp, - XtNlabel, xkb_rules->layout.desc[i], - NULL); - XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL); - } - - /* VARIANT */ - if (variantp) - XtDestroyWidget(variantp); - variantp = XtCreatePopupShell("variantP", simpleMenuWidgetClass, - variantb, NULL, 0); - sme = XtVaCreateManagedWidget("None", smeBSBObjectClass, - variantp, - XtNlabel, "None", - NULL); - XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL); - for (i = 0; i < xkb_rules->variant.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_rules->variant.name[i], smeBSBObjectClass, - variantp, - XtNlabel, xkb_rules->variant.desc[i], - NULL); - XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL); - } - - /* OPTIONS */ - if (optionsp) - XtDestroyWidget(optionsp); - optionsp = XtCreatePopupShell("optionsP", simpleMenuWidgetClass, - optionsb, NULL, 0); - sme = XtVaCreateManagedWidget("None", smeBSBObjectClass, - optionsp, - XtNlabel, "None", - NULL); - XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); - optparent = optionsp; - optname = NULL; - for (i = 0; i < xkb_rules->option.nelem; i++) { - if (!strchr(xkb_rules->option.name[i], ':')) { - optpopup = - XtCreatePopupShell(optname = xkb_rules->option.desc[i], - simpleMenuWidgetClass, - optparent = optionsp, NULL, 0); - sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], - smeBSBObjectClass, - optpopup, - XtNlabel, "None", - NULL); - XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); - } - else { - optparent = optpopup; - optname = NULL; - } - sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], smeBSBObjectClass, - optparent, - XtNlabel, xkb_rules->option.desc[i], - XtNmenuName, optname, - XtNleftBitmap, optname ? menuPixmap : None, - NULL); - if (optparent != optionsp) - XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); - } -} - -void -KeyboardModelAndLayout(XF86SetupInfo *info) -{ - static int first = 1; - static Widget kbdml; - Arg args[1]; - int i; - - if (first) { - Widget popup, sme; - - first = 0; - - kbdml = XtCreateWidget("keyboardML", formWidgetClass, - configp, NULL, 0); - - /* RULES */ - XtCreateManagedWidget("labelR", labelWidgetClass, kbdml, NULL, 0); - rulesb = XtVaCreateManagedWidget("rules", menuButtonWidgetClass, kbdml, - XtNmenuName, "rulesP", - NULL); - popup = XtCreatePopupShell("rulesP", simpleMenuWidgetClass, - rulesb, NULL, 0); - { - struct dirent *ent; - DIR *dir; - - if ((dir = opendir(XkbRulesDir)) != NULL) { - (void)readdir(dir); - (void)readdir(dir); - while ((ent = readdir(dir)) != NULL) { - if (strchr(ent->d_name, '.')) - continue; - - sme = XtVaCreateManagedWidget(ent->d_name, smeBSBObjectClass, - popup, - XtNlabel, ent->d_name, - NULL); - XtAddCallback(sme, XtNcallback, KeyboardRulesCallback, NULL); - } - closedir(dir); - } - } - - /* MODEL */ - XtCreateManagedWidget("labelM", labelWidgetClass, kbdml, NULL, 0); - modelb = XtVaCreateManagedWidget("model", menuButtonWidgetClass, kbdml, - XtNmenuName, "modelP", - NULL); - - /* LAYOUT */ - XtCreateManagedWidget("labelL", labelWidgetClass, kbdml, NULL, 0); - layoutb = XtVaCreateManagedWidget("layout", menuButtonWidgetClass, kbdml, - XtNmenuName, "layoutP", - XtNlabel, xkb_rules->layout.desc[0], - NULL); - - /* VARIANT */ - XtCreateManagedWidget("labelV", labelWidgetClass, kbdml, NULL, 0); - variantb = XtVaCreateManagedWidget("variant", menuButtonWidgetClass, kbdml, - XtNmenuName, "variantP", - XtNlabel, "", - NULL); - - /* OPTIONS */ - XtCreateManagedWidget("labelO", labelWidgetClass, kbdml, NULL, 0); - optionsb = XtVaCreateManagedWidget("options", menuButtonWidgetClass, kbdml, - XtNmenuName, "optionsP", - XtNlabel, "", - NULL); - - UpdateRulesPopups(); - - kbd = XtCreateManagedWidget("keyboard", coreWidgetClass, - kbdml, NULL, 0); - - apply = XtCreateManagedWidget("apply", commandWidgetClass, - kbdml, NULL, 0); - XtAddCallback(apply, XtNcallback, KeyboardApplyCallback, NULL); - - XtRealizeWidget(kbdml); - - XtAddEventHandler(kbd, ExposureMask, False, XkbUIEventHandler, NULL); - /* Force the first update */ - XClearArea(XtDisplay(kbd), XtWindow(kbd), 0, 0, 0, 0, True); - } - - XtSetArg(args[0], XtNlabel, xkb_rules->rules); - XtSetValues(rulesb, args, 1); - - for (i = 0; i < xkb_rules->model.nelem; i++) - if (strcmp(model, xkb_rules->model.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]); - XtSetValues(modelb, args, 1); - break; - } - - for (i = 0; i < xkb_rules->layout.nelem; i++) - if (strcmp(layout, xkb_rules->layout.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]); - XtSetValues(layoutb, args, 1); - break; - } - - if (variant) - for (i = 0; i < xkb_rules->variant.nelem; i++) - if (strcmp(variant, xkb_rules->variant.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_rules->variant.desc[i]); - XtSetValues(variantb, args, 1); - break; - } - - if (options) { - XtSetArg(args[0], XtNlabel, options); - XtSetValues(optionsb, args, 1); - } - - XtChangeManagedSet(¤t, 1, NULL, NULL, &kbdml, 1); - current = kbdml; -} diff --git a/hw/xfree86/utils/xorgcfg/keyboard-cfg.h b/hw/xfree86/utils/xorgcfg/keyboard-cfg.h deleted file mode 100644 index 512a19d7a..000000000 --- a/hw/xfree86/utils/xorgcfg/keyboard-cfg.h +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" -#include <X11/extensions/XKBconfig.h> - -#ifndef _xf86cfg_keyboard_h -#define _xf86cfg_keyboard_h - -/* - * All file names are from XProjectRoot or XWINHOME environment variable. - */ -#define XkbConfigDir "share/X11/xkb/" -#define XkbConfigFile "X0-config.keyboard" - -/* - * Types - */ -typedef struct { - char **name; - char **desc; - int nelem; -} XF86XkbDescInfo; - -typedef struct { - XF86ConfInputPtr conf; - XkbDescPtr xkb; - XkbRF_VarDefsRec defs; - XkbConfigRtrnRec config; -} XkbInfo; - -/* - * Prototypes - */ -XtPointer KeyboardConfig(XtPointer); -void KeyboardModelAndLayout(XF86SetupInfo*); -void InitializeKeyboard(void); -Bool UpdateKeyboard(Bool); -Bool WriteXKBConfiguration(char*, XkbConfigRtrnPtr); - -/* - * Initialization - */ -extern XkbInfo *xkb_info; - -#endif /* _xf86cfg_keyboard_h */ diff --git a/hw/xfree86/utils/xorgcfg/keyboard.xbm b/hw/xfree86/utils/xorgcfg/keyboard.xbm deleted file mode 100644 index 0346a8ccd..000000000 --- a/hw/xfree86/utils/xorgcfg/keyboard.xbm +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -#define keyboard_width 50 -#define keyboard_height 44 -static unsigned char keyboard_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0xe0, 0xff, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x78, 0x00, 0x00, 0x00, 0x00, 0x78, 0x00, 0x78, 0x9e, - 0xe7, 0x3d, 0xef, 0x79, 0x00, 0x18, 0x9a, 0xa6, 0x35, 0xad, 0x61, 0x00, - 0x18, 0x9e, 0xe7, 0x3d, 0xef, 0x61, 0x00, 0x18, 0x9e, 0xe7, 0x3d, 0xef, - 0x61, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x60, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x98, - 0xd6, 0x5a, 0x6b, 0x2d, 0x66, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x66, - 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x66, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x80, 0x66, 0x00, 0x98, 0xdf, 0x7b, 0xef, 0xbd, 0x66, 0x00, 0x98, 0x58, - 0x6b, 0xad, 0xb5, 0x66, 0x00, 0x98, 0xdf, 0x7b, 0xef, 0xbd, 0x67, 0x00, - 0x98, 0xdf, 0x7b, 0xef, 0xbd, 0x67, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x60, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x98, 0xd6, 0x5a, - 0x6b, 0x2d, 0x66, 0x00, 0x98, 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x98, - 0xf7, 0xde, 0x7b, 0xef, 0x67, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x60, - 0x00, 0x98, 0xf7, 0xfd, 0xf7, 0xbd, 0x67, 0x00, 0x98, 0x96, 0x05, 0x96, - 0xb5, 0x66, 0x00, 0x98, 0xf7, 0xfd, 0xf7, 0xbd, 0x67, 0x00, 0x98, 0xf7, - 0xfd, 0xf7, 0xbd, 0x67, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, - 0x38, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, - 0x3f, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/hw/xfree86/utils/xorgcfg/keyboard.xpm b/hw/xfree86/utils/xorgcfg/keyboard.xpm deleted file mode 100644 index 200ba7f42..000000000 --- a/hw/xfree86/utils/xorgcfg/keyboard.xpm +++ /dev/null @@ -1,66 +0,0 @@ -/* XPM */ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -static char * card_xpm[] = { -"60 28 5 1", -" c none", -". c #AEBAAEBAAEBA", -"X c #CF3CCF3CCF3C", -"o c #8E388A288E38", -"O c #69A671C669A6", -" ........................ ", -" .............................XXXXXXXXXXXXXXXXXXXXXXXX..... ", -".XXXXXXXXXXXXXXXXXXXXXXXXXXXXX........................XXXXoO", -".X........................................................oO", -".X........................................................oO", -".X.Xo..Xo.Xo.Xo..Xo.Xo.Xo.Xo.Xo.Xo..Xo.Xo.Xo..ooooooooooo.oO", -".X.oo..oo.oo.oo..oo.oo.oo.oo.oo.oo..oo.oo.oo..XXXXXXXXXXX.oO", -".X........................................................oO", -".X........................................................oO", -".X.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.o..Xo.Xo.Xo..Xo.Xo.Xo.Xo.oO", -".X.oo.oo.oo.oo.oo.oo.oo.oo.oo.oo.o..oo.oo.oo..oo.oo.oo.oo.oO", -".X........................................................oO", -".X.XXo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.oXo..Xo.Xo.Xo..Xo.Xo.Xo.Xo.oO", -".X.ooo.oo.oo.oo.oo.oo.oo.oo.oo..Xo..oo.oo.oo..oo.oo.oo.Xo.oO", -".X..............................Xo.....................Xo.oO", -".X.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.XXXo..Xo.Xo.Xo..Xo.Xo.Xo.Xo.oO", -".X.oo.oo.oo.oo.oo.oo.oo.oo.oo.oooo..oo.oo.oo..oo.oo.oo.oo.oO", -".X........................................................oO", -".X.XXo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.Xo.XXo.....Xo.....Xo.Xo.Xo.Xo.oO", -".X.ooo.oo.oo.oo.oo.oo.oo.oo.oo.ooo.....oo.....oo.oo.oo.Xo.oO", -".X.....................................................Xo.oO", -".X.Xo.Xo.Xo.XXXXXXXXXXXXo.Xo.Xo.Xo..Xo.Xo.Xo..XXXXo.Xo.Xo.oO", -".X.oo.oo.oo.ooooooooooooo.oo.oo.oo..oo.oo.oo..ooooo.oo.oo.oO", -".X........................................................oO", -".X........................................................oO", -".Xooooo.......................oooooooooooooooooooooooooooooO", -" XOOOOOoooooooooooooooooooooooOOOOOOOOOOOOOOOOOOOOOOOOOOOOO ", -" OOOOOOOOOOOOOOOOOOOOOOO "}; diff --git a/hw/xfree86/utils/xorgcfg/left.xbm b/hw/xfree86/utils/xorgcfg/left.xbm deleted file mode 100644 index bfb8f3ba8..000000000 --- a/hw/xfree86/utils/xorgcfg/left.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define left_width 19 -#define left_height 19 -static unsigned char left_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x07, 0x00, 0x80, 0x07, 0x00, 0xc0, 0x07, 0x00, 0xe0, 0xff, 0x01, - 0xf0, 0xff, 0x01, 0xf8, 0xff, 0x01, 0xf0, 0xff, 0x01, 0xe0, 0xff, 0x01, - 0xc0, 0x07, 0x00, 0x80, 0x07, 0x00, 0x00, 0x07, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/hw/xfree86/utils/xorgcfg/loader.c b/hw/xfree86/utils/xorgcfg/loader.c deleted file mode 100644 index 35a03e7cd..000000000 --- a/hw/xfree86/utils/xorgcfg/loader.c +++ /dev/null @@ -1,381 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" -#include "cards.h" -#include "options.h" -#include "loader.h" -#include "stubs.h" -#include <X11/Xresource.h> -#include <X11/Xos.h> - -#ifdef USE_MODULES -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#if defined(X_POSIX_C_SOURCE) -#define _POSIX_C_SOURCE X_POSIX_C_SOURCE -#include <setjmp.h> -#undef _POSIX_C_SOURCE -#else -#include <setjmp.h> -#endif -#include <signal.h> -#include <ctype.h> - -#include <stdarg.h> - -#ifndef OPTIONSPATH -#define OPTIONSPATH "/usr/lib/X11" -#endif - -#ifndef SIGNALRETURNSINT -void sig_handler(int); -#else -int sig_handler(int); -#endif /* SIGNALRETURNSINT */ - -static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList, - XrmRepresentation*, XrmValue*, XPointer); - -static sigjmp_buf jmp; -int signal_caught; -int error_level; -char *loaderPath, **loaderList, **ploaderList; -extern XrmDatabase options_xrm; -extern int noverify; -extern ModuleType module_type; -static OptionInfoPtr option; - -char **checkerLegend; -int *checkerErrors; - -#ifndef SIGNALRETURNSINT -void -#else -int -#endif -sig_handler(int sig) -{ - char *str; - - switch (sig) { - case SIGTRAP: - str = "TRAP"; - break; - case SIGBUS: - str = "BUS"; - break; - case SIGSEGV: - str = "SEGV"; - break; - case SIGILL: - str = "ILL"; - break; - case SIGFPE: - str = "FPE"; - break; - default: - str = "???"; - break; - } - - if (signal_caught == 1) { - ErrorF(" ERROR I am dead.\n"); - exit(1); - } - else if (signal_caught == 2) - abort(); - ++signal_caught; - ErrorF(" ERROR SIG%s caught!\n", str); - if (!noverify) - error_level += 50; - siglongjmp(jmp, 1); - /*NOTREACHED*/ -} - -void -CheckMsg(int code, char *fmt, ...) -{ - va_list ap; - - ++checkerErrors[code]; - ErrorF("%3d ", code); - - va_start(ap, fmt); - VErrorF(fmt, ap); - va_end(ap); -} - -static Bool -EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, - XrmRepresentation *type, XrmValue *value, XPointer closure) -{ - char *res = XrmQuarkToString(quarks[1]); - - if (res) { - option = module_options->option; - while (option->name) { - if (strcasecmp(option->name, res) == 0) - return (False); - ++option; - } - CheckMsg(CHECKER_OPTION_UNUSED, - "WARNING %s.%s is not used\n", - XrmQuarkToString(quarks[0]), res); - ++error_level; - } - - return (False); -} - -Bool -LoaderInitializeOptions(void) -{ - static int first = 1; - static char *modules = "lib/modules"; - volatile Bool options_ok = False; - char *ptr, query[256]; - char *ptr2, query2[256]; - char *type; - XrmValue value; - XrmQuark names[2]; - XrmQuark classes[2]; - volatile int i; - static ModuleType module_types[] = { - GenericModule, InputModule, VideoModule, NullModule - }; - - /* The offset in this vector must match loader.h:enum ModuleType values */ - static char *module_strs[] = { - "Null Module", "Video Module", "Input Module", "Generic Module", - }; - - if (first) { - checkerLegend = (char**) - XtCalloc(1, sizeof(char*) * (CHECKER_LAST_MESSAGE + 1)); - checkerErrors = (int*) - XtCalloc(1, sizeof(int) * (CHECKER_LAST_MESSAGE + 1)); - xf86cfgLoaderInit(); - first = 0; - - checkerLegend[CHECKER_OPTIONS_FILE_MISSING] = - "The Options file, normally " OPTIONSPATH "/Options was not found.\n"; - checkerLegend[CHECKER_OPTION_DESCRIPTION_MISSING] = - "No description for the module option. The description should be in\n" - "in the Options file, and using the sintax:\n" - "Module.Option: any text describing the option"; - checkerLegend[CHECKER_LOAD_FAILED] = - "Failed to load the module. Usually the loader will print a complete\n" - "description for the reason the module was not loaded. Use the -verbose\n" - "command line option if it is not printing any messages."; - checkerLegend[CHECKER_RECOGNIZED_AS] = - "This message means the module code did not follow what was expected\n" - "by the checker. For video drivers, it did not call xf86AddDriver,\n" - "a input module did not call xf86AddInputDriver. This message can\n" - "also be printed if the module is in the incorrect directory."; - checkerLegend[CHECKER_NO_OPTIONS_AVAILABLE] = - "The driver does not have an AvailableOptions function, or that\n" - "function is returning NULL. If the driver is returning NULL, and\n" - "really does not need any options from "__XCONFIGFILE__", than the message\n" - "can be ignored."; - checkerLegend[CHECKER_NO_VENDOR_CHIPSET] = - "The checker could not fetch the PCI chipset/vendor information from\n" - "the module. The checker currently wraps xf86PrintChipsets and\n" - "xf86MatchPciInstances to read the information from the module."; - checkerLegend[CHECKER_CANNOT_VERIFY_CHIPSET] = - "The vendor id was not found, so it is not possible to search the list\n" - "of chipsets."; - checkerLegend[CHECKER_OPTION_UNUSED] = - "The option description is defined in the Options file, but the option\n" - "was name not retrieved when calling the module AvailableOptions."; - checkerLegend[CHECKER_NOMATCH_CHIPSET_STRINGS] = - "The string specified in the module does not match the one in\n" - "common/xf86PciInfo.h"; - checkerLegend[CHECKER_CHIPSET_NOT_LISTED] = - "This means that common/xf86PciInfo.h does not have an entry for the\n" - "given vendor and id."; - checkerLegend[CHECKER_CHIPSET_NOT_SUPPORTED] = - "The chipset is listed in common/xf86PciInfo.h, but the driver does\n" - "not support it, or does not list it in the chipsets fetched by the checker."; - checkerLegend[CHECKER_CHIPSET_NO_VENDOR] = - "The vendor id specified to xf86MatchPciInstances is not defined in\n" - "common/xf86PciInfo.h"; - checkerLegend[CHECKER_NO_CHIPSETS] = - "No chipsets were passed to xf86MatchPciIntances."; - checkerLegend[CHECKER_FILE_MODULE_NAME_MISMATCH] = - "The module name string does not match the the modname field of the\n" - "XF86ModuleVersionInfo structure. This generally is not an error, but\n" - "to may be a good idea to use the same string to avoid confusion."; - } - - if (XF86Module_path == NULL) { - XF86Module_path = malloc(strlen(XFree86Dir) + strlen(modules) + 2); - sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); - } - - if (loaderPath == NULL || strcmp(XF86Module_path, loaderPath)) - loaderPath = strdup(XF86Module_path); - else - /* nothing new */ - return (True); - - if (!noverify) { - options_ok = InitializeOptionsDatabase(); - InitializePciInfo(); - } - - for (i = 0; module_types[i] != NullModule; i++) { - xf86cfgLoaderInitList(module_types[i]); - if (!noverify) - ErrorF("================= Checking modules of type \"%s\" =================\n", - module_strs[module_types[i]]); - - if (loaderList) { - for (ploaderList = loaderList; *ploaderList; ploaderList++) { - signal_caught = 0; - signal(SIGTRAP, sig_handler); - signal(SIGBUS, sig_handler); - signal(SIGSEGV, sig_handler); - signal(SIGILL, sig_handler); - signal(SIGFPE, sig_handler); - if (sigsetjmp(jmp, 1) == 0) { - if (!noverify) { - int ok; - - error_level = 0; - ErrorF("CHECK MODULE %s\n", *ploaderList); - if ((ok = xf86cfgCheckModule()) == 0) { - CheckMsg(CHECKER_LOAD_FAILED, - "ERROR Failed to load module.\n"); - error_level += 50; - } - else if (module_type != module_types[i]) { - CheckMsg(CHECKER_RECOGNIZED_AS, - "WARNING %s recognized as a \"%s\"\n", *ploaderList, - module_strs[module_type]); - ++error_level; - } - if (ok) { - if (options_ok) { - if ((module_options == NULL || module_options->option == NULL) && - module_type != GenericModule) { - CheckMsg(CHECKER_NO_OPTIONS_AVAILABLE, - "WARNING Not a generic module, but no options available.\n"); - ++error_level; - } - else if (module_options && strcmp(module_options->name, *ploaderList) == 0) { - ErrorF(" CHECK OPTIONS\n"); - option = module_options->option; - - while (option->name) { - XmuSnprintf(query, sizeof(query), "%s.%s", *ploaderList, option->name); - for (ptr = query, ptr2 = query2; *ptr; ptr++) { - if (*ptr != '_' && *ptr != ' ' && *ptr != '\t') - *ptr2 = tolower(*ptr); - } - *ptr2 = '\0'; - /* all resources are in lowercase */ - if (!XrmGetResource(options_xrm, query2, "Module.Option", &type, &value) || - value.addr == NULL) { - CheckMsg(CHECKER_OPTION_DESCRIPTION_MISSING, - "WARNING no description for %s\n", query); - ++error_level; - } - ++option; - } - - /* now do a linear search for Options file entries that are not - * in the driver. - */ - names[0] = XrmPermStringToQuark(module_options->name); - classes[0] = XrmPermStringToQuark("Option"); - names[1] = classes[1] = NULLQUARK; - (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, (XrmClassList)&classes, - XrmEnumOneLevel, EnumDatabase, NULL); - } - } - else { - CheckMsg(CHECKER_OPTIONS_FILE_MISSING, - "ERROR Options file missing.\n"); - error_level += 10; - } - - if (module_type == VideoModule && - (module_options == NULL || module_options->vendor < 0 || - module_options->chipsets == NULL)) { - CheckMsg(CHECKER_NO_VENDOR_CHIPSET, - "WARNING No vendor/chipset information available.\n"); - ++error_level; - } - else if (module_type == VideoModule) { - if (module_options == NULL) { - /* No description for this, if this happen, - * something really strange happened. */ - ErrorF(" ERROR No module_options!?!\n"); - error_level += 50; - } - else { - ErrorF(" CHECK CHIPSETS\n"); - CheckChipsets(module_options, &error_level); - } - } - } - ErrorF(" SUMMARY error_level set to %d.\n\n", error_level); - } - else - (void)xf86cfgCheckModule(); - } - signal(SIGTRAP, SIG_DFL); - signal(SIGBUS, SIG_DFL); - signal(SIGSEGV, SIG_DFL); - signal(SIGILL, SIG_DFL); - signal(SIGFPE, SIG_DFL); - } - xf86cfgLoaderFreeList(); - } - else - ErrorF(" ERROR Failed to initialize module list.\n"); - } - - if (!noverify) { - ErrorF("===================================== LEGEND ===============================\n"); - ErrorF("NOTICE lines are just informative.\n"); - ErrorF("WARNING lines add 1 to error_level.\n"); - ErrorF("ERROR lines add 2 or more (based on the severity of the error) to error_level.\n\n"); - for (i = 0; i <= CHECKER_LAST_MESSAGE; i++) - if (checkerErrors[i]) { - ErrorF("%3d\n%s\n\n", i, checkerLegend[i]); - } - } - - return (True); -} -#endif diff --git a/hw/xfree86/utils/xorgcfg/loader.h b/hw/xfree86/utils/xorgcfg/loader.h deleted file mode 100644 index 5affada84..000000000 --- a/hw/xfree86/utils/xorgcfg/loader.h +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#ifdef USE_MODULES -#ifndef LOADER_PRIVATE -#include "config.h" -#include "stubs.h" - -#else - -#define IN_LOADER - -#include "xf86.h" -#include "xf86str.h" -#include "xf86Opt.h" -#include "xf86Module.h" - -#ifndef XINPUT -#define XINPUT -#endif -#include "xf86Xinput.h" - -#include "loaderProcs.h" - -#include <sym.h> - -void LoaderDefaultFunc(void); -#endif - -#ifndef _xf86cfg_loader_h -#define _xf86cfg_loader_h - -void xf86cfgLoaderInit(void); -void xf86cfgLoaderInitList(int); -void xf86cfgLoaderFreeList(void); -int xf86cfgCheckModule(void); - -#ifndef LOADER_PRIVATE -/* common/xf86Opt.h */ -typedef struct { - double freq; - int units; -} OptFrequency; - -typedef union { - unsigned long num; - char * str; - double realnum; - Bool xbool; - OptFrequency freq; -} ValueUnion; - -typedef enum { - OPTV_NONE = 0, - OPTV_INTEGER, - OPTV_STRING, /* a non-empty string */ - OPTV_ANYSTR, /* Any string, including an empty one */ - OPTV_REAL, - OPTV_BOOLEAN, - OPTV_FREQ -} OptionValueType; - -typedef enum { - OPTUNITS_HZ = 1, - OPTUNITS_KHZ, - OPTUNITS_MHZ -} OptFreqUnits; - -typedef struct { - int token; - const char* name; - OptionValueType type; - ValueUnion value; - Bool found; -} OptionInfoRec, *OptionInfoPtr; - -typedef struct { - int token; /* id of the token */ - const char * name; /* token name */ -} SymTabRec, *SymTabPtr; -#endif /* !LOADER_PRIVATE */ - -typedef enum { - NullModule = 0, - VideoModule, - InputModule, - GenericModule, -} ModuleType; - -typedef struct _xf86cfgModuleOptions { - char *name; - ModuleType type; - OptionInfoPtr option; - int vendor; - SymTabPtr chipsets; - struct _xf86cfgModuleOptions *next; -} xf86cfgModuleOptions; - -extern xf86cfgModuleOptions *module_options; - -/* When adding a new code to the LEGEND, also update checkerLegend - * in loader.c - */ -extern char **checkerLegend; -extern int *checkerErrors; -#define CHECKER_OPTIONS_FILE_MISSING 1 -#define CHECKER_OPTION_DESCRIPTION_MISSING 2 -#define CHECKER_LOAD_FAILED 3 -#define CHECKER_RECOGNIZED_AS 4 -#define CHECKER_NO_OPTIONS_AVAILABLE 5 -#define CHECKER_NO_VENDOR_CHIPSET 6 -#define CHECKER_CANNOT_VERIFY_CHIPSET 7 -#define CHECKER_OPTION_UNUSED 8 -#define CHECKER_NOMATCH_CHIPSET_STRINGS 9 -#define CHECKER_CHIPSET_NOT_LISTED 10 -#define CHECKER_CHIPSET_NOT_SUPPORTED 11 -#define CHECKER_CHIPSET_NO_VENDOR 12 -#define CHECKER_NO_CHIPSETS 13 -#define CHECKER_FILE_MODULE_NAME_MISMATCH 14 - -#define CHECKER_LAST_MESSAGE 14 - -extern void CheckMsg(int, char*, ...); - -#ifndef LOADER_PRIVATE -int LoaderInitializeOptions(void); -#endif -#endif /* USE_MODULES */ - -#endif /* _xf86cfg_loader_h */ diff --git a/hw/xfree86/utils/xorgcfg/loadmod.c b/hw/xfree86/utils/xorgcfg/loadmod.c deleted file mode 100644 index 809a51a03..000000000 --- a/hw/xfree86/utils/xorgcfg/loadmod.c +++ /dev/null @@ -1,425 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#ifdef USE_MODULES -#include <setjmp.h> - -#ifndef HAS_GLIBC_SIGSETJMP -#if defined(setjmp) && defined(__GNU_LIBRARY__) && \ - (!defined(__GLIBC__) || (__GLIBC__ < 2) || \ - ((__GLIBC__ == 2) && (__GLIBC_MINOR__ < 3))) -#define HAS_GLIBC_SIGSETJMP 1 -#endif -#endif - -#define LOADER_PRIVATE -#include "loader.h" - -#define True 1 -#define False 0 -#define XtPointer char* -#define XtMalloc malloc -#define XtCalloc calloc -#define XtRealloc realloc -#define XtFree free -#define XtNew(t) malloc(sizeof(t)) -#define XtNewString(s) ((s) ? strdup(s) : NULL) - -#define pointer void* - -/* XXX beware (or fix it) libc functions called here are the xf86 ones */ - -static void AddModuleOptions(char*, const OptionInfoRec*); -#if 0 -void xf86AddDriver(DriverPtr, void*, int); -Bool xf86ServerIsOnlyDetecting(void); -void xf86AddInputDriver(InputDriverPtr, pointer, int); -void xf86AddModuleInfo(ModuleInfoPtr, void*); -Bool xf86LoaderCheckSymbol(const char*); -void xf86LoaderRefSymLists(const char **, ...); -void xf86LoaderReqSymLists(const char **, ...); -void xf86Msg(int, const char*, ...); -void xf86MsgVerb(int, int, const char*, ...); -void xf86PrintChipsets(const char*, const char*, SymTabPtr); -void xf86ErrorFVerb(int verb, const char *format, ...); -int xf86MatchDevice(const char*, GDevPtr**); -int xf86MatchPciInstances(const char*, int, SymTabPtr, PciChipsets*, GDevPtr*, int, DriverPtr,int**); -int xf86MatchIsaInstances(const char*, SymTabPtr, pointer*, DriverPtr, pointer, GDevPtr*, int, int**); -void *xf86LoadDrvSubModule(DriverPtr drv, const char*); -void xf86DrvMsg(int, int, const char*, ...); -Bool xf86IsPrimaryPci(pcVideoPtr*); -Bool xf86CheckPciSlot( const struct pci_device * ); -#endif - -extern char *loaderPath, **loaderList, **ploaderList; -xf86cfgModuleOptions *module_options; - -extern int noverify, error_level; - -int xf86ShowUnresolved = 1; - -LOOKUP miLookupTab[] = {{0,0}}; -LOOKUP dixLookupTab[] = {{0,0}}; -LOOKUP extLookupTab[] = {{0,0}}; -LOOKUP xfree86LookupTab[] = { - /* Loader functions */ - SYMFUNC(LoaderDefaultFunc) - SYMFUNC(LoadSubModule) - SYMFUNC(DuplicateModule) - SYMFUNC(LoaderErrorMsg) - SYMFUNC(LoaderCheckUnresolved) - SYMFUNC(LoadExtension) - SYMFUNC(LoaderReqSymbols) - SYMFUNC(LoaderReqSymLists) - SYMFUNC(LoaderRefSymbols) - SYMFUNC(LoaderRefSymLists) - SYMFUNC(UnloadSubModule) - SYMFUNC(LoaderSymbol) - SYMFUNC(LoaderListDirs) - SYMFUNC(LoaderFreeDirList) - SYMFUNC(LoaderGetOS) - - SYMFUNC(xf86AddDriver) - SYMFUNC(xf86ServerIsOnlyDetecting) - SYMFUNC(xf86AddInputDriver) - SYMFUNC(xf86AddModuleInfo) - SYMFUNC(xf86LoaderCheckSymbol) - - SYMFUNC(xf86LoaderRefSymLists) - SYMFUNC(xf86LoaderReqSymLists) - SYMFUNC(xf86Msg) - SYMFUNC(xf86MsgVerb) - SYMFUNC(ErrorF) - SYMFUNC(xf86PrintChipsets) - SYMFUNC(xf86ErrorFVerb) - SYMFUNC(xf86MatchDevice) - SYMFUNC(xf86MatchPciInstances) - SYMFUNC(xf86MatchIsaInstances) - SYMFUNC(Xfree) - SYMFUNC(xf86LoadDrvSubModule) - SYMFUNC(xf86DrvMsg) - SYMFUNC(xf86IsPrimaryPci) - SYMFUNC(xf86CheckPciSlot) - SYMFUNC(XNFalloc) - SYMFUNC(XNFrealloc) - SYMFUNC(XNFcalloc) - {0,0} -}; - -static DriverPtr driver; -static ModuleInfoPtr info; -static SymTabPtr chips; -static int vendor; -ModuleType module_type = GenericModule; - -static void -AddModuleOptions(char *name, const OptionInfoRec *option) -{ - xf86cfgModuleOptions *ptr; - const OptionInfoRec *tmp; - SymTabPtr ctmp; - int count; - - /* XXX If the module is already in the list, then it means that - * it is now being properly loaded by xf86cfg and the "fake" entry - * added in xf86cfgLoaderInitList() isn't required anymore. - * Currently: - * ati and vmware are known to fail. */ - for (ptr = module_options; ptr; ptr = ptr->next) - if (strcmp(name, ptr->name) == 0) { - fprintf(stderr, "Module %s already in list!\n", name); - return; - } - - ptr = XtNew(xf86cfgModuleOptions); - ptr->name = XtNewString(name); - ptr->type = module_type; - if (option) { - for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++) - ; - ++count; - ptr->option = XtCalloc(1, count * sizeof(OptionInfoRec)); - for (count = 0, tmp = option; tmp->name != NULL; count++, tmp++) { - memcpy(&ptr->option[count], tmp, sizeof(OptionInfoRec)); - ptr->option[count].name = XtNewString(tmp->name); - if (tmp->type == OPTV_STRING || tmp->type == OPTV_ANYSTR) - ptr->option[count].value.str = XtNewString(tmp->value.str); - } - } - else - ptr->option = NULL; - if (vendor != -1 && chips) { - ptr->vendor = vendor; - for (count = 0, ctmp = chips; ctmp->name; ctmp++, count++) - ; - ++count; - ptr->chipsets = XtCalloc(1, count * sizeof(SymTabRec)); - for (count = 0, ctmp = chips; ctmp->name != NULL; count++, ctmp++) { - memcpy(&ptr->chipsets[count], ctmp, sizeof(SymTabRec)); - ptr->chipsets[count].name = XtNewString(ctmp->name); - } - } - else - ptr->chipsets = NULL; - - ptr->next = module_options; - module_options = ptr; -} - -extern void xf86WrapperInit(void); - -void -xf86cfgLoaderInit(void) -{ - LoaderInit(); - xf86WrapperInit(); -} - -void -xf86cfgLoaderInitList(int type) -{ - static const char *generic[] = { - ".", - NULL - }; - static const char *video[] = { - "drivers", - NULL - }; - static const char *input[] = { - "input", - NULL - }; - const char **subdirs; - - switch (type) { - case GenericModule: - subdirs = generic; - break; - case VideoModule: - subdirs = video; - break; - case InputModule: - subdirs = input; - break; - default: - fprintf(stderr, "Invalid value passed to xf86cfgLoaderInitList.\n"); - subdirs = generic; - break; - } - LoaderSetPath(loaderPath); - loaderList = LoaderListDirs(subdirs, NULL); - - /* XXX Xf86cfg isn't able to provide enough wrapper functions - * to these drivers. Maybe the drivers could also be changed - * to work better when being loaded "just for testing" */ - if (type == VideoModule) { - module_type = VideoModule; - AddModuleOptions("vmware", NULL); - AddModuleOptions("ati", NULL); - module_type = NullModule; - } -} - -void -xf86cfgLoaderFreeList(void) -{ - LoaderFreeDirList(loaderList); -} - -int -xf86cfgCheckModule(void) -{ - int errmaj, errmin; - ModuleDescPtr module; - - driver = NULL; - chips = NULL; - info = NULL; - vendor = -1; - module_type = GenericModule; - - if ((module = LoadModule(*ploaderList, NULL, NULL, NULL, NULL, - NULL, &errmaj, &errmin)) == NULL) { - LoaderErrorMsg(NULL, *ploaderList, errmaj, errmin); - return (0); - } - else if (driver && driver->AvailableOptions) { - /* at least fbdev does not call xf86MatchPciInstances in Probe */ - if (driver->Identify) - (*driver->Identify)(-1); - if (driver->Probe) - (*driver->Probe)(driver, PROBE_DETECT); - AddModuleOptions(*ploaderList, (*driver->AvailableOptions)(-1, -1)); - } - else if (info && info->AvailableOptions) - AddModuleOptions(*ploaderList, (*info->AvailableOptions)(NULL)); - - if (!noverify) { - XF86ModuleData *initdata = NULL; - char *p; - - p = XtMalloc(strlen(*ploaderList) + strlen("ModuleData") + 1); - strcpy(p, *ploaderList); - strcat(p, "ModuleData"); - initdata = LoaderSymbol(p); - if (initdata) { - XF86ModuleVersionInfo *vers; - - vers = initdata->vers; - if (vers && strcmp(*ploaderList, vers->modname)) { - /* This was a problem at some time for some video drivers */ - CheckMsg(CHECKER_FILE_MODULE_NAME_MISMATCH, - "WARNING file/module name mismatch: \"%s\" \"%s\"\n", - *ploaderList, vers->modname); - ++error_level; - } - } - XtFree(p); - } - - UnloadModule(module); - - return (1); -} - -_X_EXPORT void -xf86AddDriver(DriverPtr drv, void *module, int flags) -{ - driver = drv; - if (driver) - driver->module = module; - module_type = VideoModule; -} - -_X_EXPORT Bool -xf86ServerIsOnlyDetecting(void) -{ - return (True); -} - -_X_EXPORT void -xf86AddInputDriver(InputDriverPtr inp, void *module, int flags) -{ - module_type = InputModule; -} - -_X_EXPORT void -xf86AddModuleInfo(ModuleInfoPtr inf, void *module) -{ - info = inf; -} - -_X_EXPORT Bool -xf86LoaderCheckSymbol(const char *symbol) -{ - return LoaderSymbol(symbol) != NULL; -} - -_X_EXPORT void -xf86LoaderRefSymLists(const char **list0, ...) -{ -} - -_X_EXPORT void -xf86LoaderReqSymLists(const char **list0, ...) -{ -} - -#if 0 -void xf86Msg(int type, const char *format, ...) -{ -} -#endif - -/*ARGSUSED*/ -_X_EXPORT void -xf86PrintChipsets(const char *name, const char *msg, SymTabPtr chipsets) -{ - vendor = 0; - chips = chipsets; -} - -_X_EXPORT int -xf86MatchDevice(const char *name, GDevPtr **gdev) -{ - *gdev = NULL; - - return (1); -} - -_X_EXPORT int -xf86MatchPciInstances(const char *name, int VendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets, - GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities) -{ - vendor = VendorID; - if (chips == NULL) - chips = chipsets; - *foundEntities = NULL; - - return (0); -} - -_X_EXPORT int -xf86MatchIsaInstances(const char *name, SymTabPtr chipsets, IsaChipsets *ISAchipsets, DriverPtr drvp, - FindIsaDevProc FindIsaDevice, GDevPtr *devList, int numDevs, int **foundEntities) -{ - *foundEntities = NULL; - - return (0); -} - -/*ARGSUSED*/ -_X_EXPORT void * -xf86LoadDrvSubModule(DriverPtr drv, const char *name) -{ - pointer ret; - int errmaj = 0, errmin = 0; - - ret = LoadSubModule(drv->module, name, NULL, NULL, NULL, NULL, - &errmaj, &errmin); - if (!ret) - LoaderErrorMsg(NULL, name, errmaj, errmin); - return (ret); -} - -_X_EXPORT Bool -xf86IsPrimaryPci(pciVideoPtr pPci) -{ - return (True); -} - -_X_EXPORT Bool -xf86CheckPciSlot( const struct pci_device * d ) -{ - (void) d; - return (False); -} -#endif diff --git a/hw/xfree86/utils/xorgcfg/monitor-cfg.c b/hw/xfree86/utils/xorgcfg/monitor-cfg.c deleted file mode 100644 index a443c54c2..000000000 --- a/hw/xfree86/utils/xorgcfg/monitor-cfg.c +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "xf86config.h" -#include "monitor-cfg.h" -#include "screen.h" -#include <X11/extensions/xf86vmode.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Simple.h> - -#include <ctype.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/List.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/Viewport.h> -#include <X11/Xaw/SimpleMenu.h> -#include <X11/Xaw/SmeBSB.h> - -/* - * Prototypes - */ -static Bool MonitorConfigCheck(void); -static void MonitorHsyncCallback(Widget, XtPointer, XtPointer); -static void MonitorVsyncCallback(Widget, XtPointer, XtPointer); -static void MonitorSelectCardCallback(Widget, XtPointer, XtPointer); - -extern void DrawCables(void); - -/* - * Initialization - */ -static char *hmodes[] = { - "Standard VGA, 640x480 @ 60 Hz", - "Super VGA, 800x600 @ 56 Hz", - "1024x768 @ 87 Hz int. (no 800x600)", - "1024x768 @ 87 Hz int., 800x600 @ 56 Hz", - "800x600 @ 60 Hz, 640x480 @ 72 Hz", - "1024x768 @ 60 Hz, 800x600 @ 72 Hz", - "High Frequency SVGA, 1024x768 @ 70 Hz", - "Monitor that can do 1280x1024 @ 60 Hz", - "Monitor that can do 1280x1024 @ 74 Hz", - "Monitor that can do 1280x1024 @ 76 Hz", - "Monitor that can do 1280x1024 @ 85 Hz", - "Monitor that can do 1600x1200 @ 85 Hz", - "Monitor that can do 1920x1440 @ 85 Hz", - "Monitor that can do 2048x1536 @ 85 Hz" -}; - -static char *hmodes_trans[] = { - "31.5", - "31.5 - 35.1", - "31.5, 35.5", - "31.5, 35.15, 35.5", - "31.5 - 37.9", - "31.5 - 48.5", - "31.5 - 57.0", - "31.5 - 64.3", - "31.5 - 79.0", - "31.5 - 82.0", - "31.5 - 92.0", - "31.5 - 108.0", - "31.5 - 128.5", - "31.5 - 137.0" -}; - -static char *vmodes [] = { "50 - 70", "50 - 90", "50 - 100", "40 - 150", }; - -extern Widget config; -static Widget hsync, vsync, hlist, vlist, cmenu; - -static parser_range mon_hsync[CONF_MAX_HSYNC]; -static parser_range mon_vrefresh[CONF_MAX_VREFRESH]; -static int mon_n_hsync, mon_n_vrefresh; -static XF86ConfDevicePtr oldcard, card; -static XF86ConfMonitorPtr current_monitor; - -/* - * Implementation - */ -XtPointer -MonitorConfig(XtPointer conf) -{ - XF86ConfMonitorPtr monitor = (XF86ConfMonitorPtr)conf; - char monitor_name[48]; - Arg args[1]; - - current_monitor = monitor; - - xf86info.cur_list = MONITOR; - XtSetSensitive(back, xf86info.lists[MONITOR].cur_function > 0); - XtSetSensitive(next, xf86info.lists[MONITOR].cur_function < - xf86info.lists[MONITOR].num_functions - 1); - (xf86info.lists[MONITOR].functions[xf86info.lists[MONITOR].cur_function]) - (&xf86info); - - XawListUnhighlight(hlist); - XawListUnhighlight(vlist); - - if (monitor != NULL) { - XF86ConfScreenPtr screen = XF86Config->conf_screen_lst; - char str[PARSER_RANGE_SIZE]; - - XtSetArg(args[0], XtNstring, monitor->mon_identifier); - XtSetValues(ident_widget, args, 1); - - while (screen != NULL) { - if (screen->scrn_monitor == monitor) - break; - - screen = (XF86ConfScreenPtr)(screen->list.next); - } - if (screen != NULL) { - oldcard = card = screen->scrn_device; - XtSetArg(args[0], XtNlabel, card->dev_identifier); - } - else { - oldcard = card = NULL; - XtSetArg(args[0], XtNlabel, ""); - } - XtSetValues(cmenu, args, 1); - - mon_n_hsync = monitor->mon_n_hsync; - memcpy(mon_hsync, monitor->mon_hsync, - sizeof(parser_range) * mon_n_hsync); - *str = '\0'; - parser_range_to_string(str, mon_hsync, mon_n_hsync); - XtSetArg(args[0], XtNstring, str); - XtSetValues(hsync, args, 1); - - mon_n_vrefresh = monitor->mon_n_vrefresh; - memcpy(mon_vrefresh, monitor->mon_vrefresh, - sizeof(parser_range) * mon_n_vrefresh); - *str = '\0'; - parser_range_to_string(str, mon_vrefresh, mon_n_vrefresh); - XtSetArg(args[0], XtNstring, str); - XtSetValues(vsync, args, 1); - } - else { - XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst; - int nmonitors = 0; - - oldcard = card = NULL; - while (monitor != NULL) { - ++nmonitors; - monitor = (XF86ConfMonitorPtr)(monitor->list.next); - } - do { - XmuSnprintf(monitor_name, sizeof(monitor_name), - "Monitor%d", nmonitors); - ++nmonitors; - } while (xf86findMonitor(monitor_name, - XF86Config->conf_monitor_lst)); - - XtSetArg(args[0], XtNstring, monitor_name); - XtSetValues(ident_widget, args, 1); - - XtSetArg(args[0], XtNstring, ""); - XtSetValues(hsync, args, 1); - XtSetValues(vsync, args, 1); - - XtSetArg(args[0], XtNlabel, ""); - XtSetValues(cmenu, args, 1); - } - - if (ConfigLoop(MonitorConfigCheck) == True) { - if (monitor == NULL) { - monitor = (XF86ConfMonitorPtr) - XtCalloc(1, sizeof(XF86ConfMonitorRec)); - monitor->mon_identifier = XtNewString(ident_string); - } - - memcpy(monitor->mon_hsync, mon_hsync, sizeof(parser_range) * - (monitor->mon_n_hsync = mon_n_hsync)); - memcpy(monitor->mon_vrefresh, mon_vrefresh, sizeof(parser_range) * - (monitor->mon_n_vrefresh = mon_n_vrefresh)); - - if (strcasecmp(monitor->mon_identifier, ident_string)) - xf86renameMonitor(XF86Config, monitor, ident_string); - - if (oldcard != card) { - int i; - - for (i = 0; i < computer.num_devices; i++) - if (computer.devices[i]->widget == config) - break; - if (computer.devices[i]->config == NULL) - XF86Config->conf_monitor_lst = - xf86addMonitor(XF86Config->conf_monitor_lst, - monitor); - computer.devices[i]->config = (XtPointer)monitor; - ChangeScreen(monitor, monitor, card, oldcard); - DrawCables(); - } - - return (monitor); - } - - return (NULL); -} - -static Bool -MonitorConfigCheck(void) -{ - char *str; - Arg args[1]; - XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst; - - if (ident_string == NULL || strlen(ident_string) == 0) - return (False); - - bzero(mon_hsync, sizeof(parser_range) * CONF_MAX_HSYNC); - bzero(mon_vrefresh, sizeof(parser_range) * CONF_MAX_VREFRESH); - - XtSetArg(args[0], XtNstring, &str); - XtGetValues(hsync, args, 1); - if ((mon_n_hsync = string_to_parser_range(str, mon_hsync, - CONF_MAX_HSYNC)) <= 0) - return (False); - - XtSetArg(args[0], XtNstring, &str); - XtGetValues(vsync, args, 1); - if ((mon_n_vrefresh = string_to_parser_range(str, mon_vrefresh, - CONF_MAX_VREFRESH)) <= 0) - return (False); - - while (monitor != NULL) { - if (monitor != current_monitor && - strcasecmp(ident_string, monitor->mon_identifier) == 0) - return (False); - monitor = (XF86ConfMonitorPtr)(monitor->list.next); - } - - return (True); -} - -int -string_to_parser_range(char *str, parser_range *range, int nrange) -{ - double val; - int i = 0; - - if (str == NULL || *str == '\0' || range == NULL || nrange == 0) - return (0); - - while (*str) { - while (*str && isspace(*str)) - ++str; - if (!isdigit(*str)) { - ++str; - continue; - } - val = strtod(str, &str); - while (*str && isspace(*str)) - ++str; - if (*str == ',' || *str == '\0') { - if (*str) - ++str; - range[i].lo = range[i].hi = val; - if (++i >= nrange || *str == '\0') - break; - continue; - } - else if (*str != '-') - return (0); - ++str; - range[i].lo = val; - while (*str && isspace(*str)) - ++str; - if ((range[i].hi = strtod(str, &str)) < range[i].lo) - return (0); - if (++i >= nrange) - break; - } - - return (i); -} - -int -parser_range_to_string(char *str, parser_range *range, int nrange) -{ - int i, len; - - if (str == NULL || range == NULL || nrange <= 0) - return (0); - - for (i = len = 0; i < nrange; i++) { - if (i > 0) - len += XmuSnprintf(str + len, PARSER_RANGE_SIZE - len, "%s", - ", "); - if (range[i].lo == range[i].hi) - len += XmuSnprintf(str + len, PARSER_RANGE_SIZE - len, "%g", - range[i].lo); - else if (range[i].lo < range[i].hi) - len += XmuSnprintf(str + len, PARSER_RANGE_SIZE - len, "%g - %g", - range[i].lo, range[i].hi); - else - return (0); - } - - return (i); -} - -/*ARGSUSED*/ -static void -MonitorHsyncCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - Arg args[1]; - - XtSetArg(args[0], XtNstring, hmodes_trans[info->list_index]); - XtSetValues(hsync, args, 1); -} - -/*ARGSUSED*/ -static void -MonitorVsyncCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - Arg args[1]; - - XtSetArg(args[0], XtNstring, info->string); - XtSetValues(vsync, args, 1); -} - -/*ARGSUSED*/ -static void -MonitorSelectCardCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - - card = (XF86ConfDevicePtr)user_data; - XtSetArg(args[0], XtNlabel, card != NULL ? card->dev_identifier : ""); - XtSetValues(cmenu, args, 1); -} - -void -MonitorLayout(XF86SetupInfo *info) -{ - static int first = 1, men; - static Widget layout, menu; - XF86ConfDevicePtr device = XF86Config->conf_device_lst; - Widget sme; - Arg args[1]; - char *menuname; - - if (first) { - Widget viewport; - - first = 0; - - layout = XtCreateWidget("monitorl", formWidgetClass, - configp, NULL, 0); - XtCreateManagedWidget("hlabel", labelWidgetClass, layout, NULL, 0); - hsync = XtVaCreateManagedWidget("hsync", asciiTextWidgetClass, layout, - XtNeditType, XawtextEdit, - NULL); - viewport = XtCreateManagedWidget("hviewport", viewportWidgetClass, - layout, NULL, 0); - hlist = XtVaCreateManagedWidget("hlist", listWidgetClass, viewport, - XtNlist, hmodes, - XtNnumberStrings, sizeof(hmodes) / - sizeof(hmodes[0]), NULL); - XtAddCallback(hlist, XtNcallback, MonitorHsyncCallback, NULL); - - XtCreateManagedWidget("vlabel", labelWidgetClass, layout, NULL, 0); - vsync = XtVaCreateManagedWidget("vsync", asciiTextWidgetClass, layout, - XtNeditType, XawtextEdit, - NULL); - viewport = XtCreateManagedWidget("vviewport", viewportWidgetClass, - layout, NULL, 0); - vlist = XtVaCreateManagedWidget("vlist", listWidgetClass, viewport, - XtNlist, vmodes, - XtNnumberStrings, sizeof(vmodes) / - sizeof(vmodes[0]), NULL); - XtAddCallback(vlist, XtNcallback, MonitorVsyncCallback, NULL); - - XtCreateManagedWidget("clabel", labelWidgetClass, layout, NULL, 0); - cmenu = XtCreateManagedWidget("cmenu", menuButtonWidgetClass, - layout, NULL, 0); - - XtRealizeWidget(layout); - } - - if (menu != NULL) - XtDestroyWidget(menu); - - /* - * swaps names because XtDestroyWidget will only really destroy it - * when the code returns to XtAppMainLoop - */ - menuname = men & 1 ? "mena" : "menb"; - menu = XtCreatePopupShell(menuname, simpleMenuWidgetClass, - cmenu, NULL, 0); - XtSetArg(args[0], XtNmenuName, menuname); - XtSetValues(cmenu, args, 1); - ++men; - sme = XtVaCreateManagedWidget("none", smeBSBObjectClass, menu, - NULL); - XtAddCallback(sme, XtNcallback, MonitorSelectCardCallback, NULL); - - while (device != NULL) { - XF86ConfScreenPtr screen = XF86Config->conf_screen_lst; - Widget sme; - Bool sensitive = True; - - while (screen != NULL) { - if (screen->scrn_device == device) { - sensitive = screen->scrn_monitor == NULL || - screen->scrn_monitor == current_monitor; - break; - } - screen = (XF86ConfScreenPtr)(screen->list.next); - } - sme = XtCreateManagedWidget(device->dev_identifier, - smeBSBObjectClass, menu, - NULL, 0); - if (sensitive) - XtAddCallback(sme, XtNcallback, MonitorSelectCardCallback, device); - XtSetSensitive(sme, sensitive); - - device = (XF86ConfDevicePtr)(device->list.next); - } - - XtRealizeWidget(menu); - - XtChangeManagedSet(¤t, 1, NULL, NULL, &layout, 1); - current = layout; -} diff --git a/hw/xfree86/utils/xorgcfg/monitor-cfg.h b/hw/xfree86/utils/xorgcfg/monitor-cfg.h deleted file mode 100644 index 48fc804bf..000000000 --- a/hw/xfree86/utils/xorgcfg/monitor-cfg.h +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" - -#ifndef _xf86cfg_monitor_h -#define _xf86cfg_monitor_h - -/* - * Prototypes - */ -XtPointer MonitorConfig(XtPointer); -void MonitorLayout(XF86SetupInfo*); -void MonitorVidtune(XF86SetupInfo*); -int string_to_parser_range(char*, parser_range*, int); -#define PARSER_RANGE_SIZE 256 -/* string must have at least 256 bytes */ -int parser_range_to_string(char*, parser_range*, int); - -#endif /* _xf86cfg_monitor_h */ diff --git a/hw/xfree86/utils/xorgcfg/monitor.xbm b/hw/xfree86/utils/xorgcfg/monitor.xbm deleted file mode 100644 index a2d4c6863..000000000 --- a/hw/xfree86/utils/xorgcfg/monitor.xbm +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -#define monitor_width 50 -#define monitor_height 44 -static unsigned char monitor_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, - 0x03, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0xe0, 0x01, 0x00, - 0x00, 0x00, 0x1e, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x70, - 0xfc, 0xff, 0xff, 0xff, 0x38, 0x00, 0x30, 0xfe, 0xff, 0xff, 0xff, 0x31, - 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, - 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, - 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, - 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, - 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, - 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, - 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, - 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, - 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, - 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, - 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, - 0x33, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, 0x33, 0x00, 0x30, 0xfe, 0xff, - 0xff, 0xff, 0x31, 0x00, 0x70, 0xfc, 0xff, 0xff, 0xff, 0x38, 0x00, 0x60, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x1e, - 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xe0, 0x0f, 0x00, 0x00, 0xff, 0xff, 0xff, - 0xff, 0x03, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xc0, 0x0f, - 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x30, 0x00, - 0x00, 0x30, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, - 0xf8, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x3f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/hw/xfree86/utils/xorgcfg/monitor.xpm b/hw/xfree86/utils/xorgcfg/monitor.xpm deleted file mode 100644 index e647e3cc1..000000000 --- a/hw/xfree86/utils/xorgcfg/monitor.xpm +++ /dev/null @@ -1,79 +0,0 @@ -/* XPM */ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -static char * monitor_xpm[] = { -"47 40 6 1", -" c none", -"Z c #DF7DE38DDF7D", -". c #BEFBBEFBBEFB", -"X c #9E799A699E79", -"o c #30C230C230C2", -"O c #96589E799658", -"ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ..", -"Z..............................................", -"Z.............................................X", -"Z.............................................X", -"Z...XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.....X", -"Z...Xooooooooooooooooooooooooooooooooooooo....X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z...XoooooooooooooooooooooooooooooooooooooZ...X", -"Z....oooooooooooooooooooooooooooooooooooooZ...X", -"Z.....ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ...X", -"Z.............................................X", -"Z.............................................X", -"..............................................X", -"..XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", -" OOOOOOOOOOOOOOOOOOOOOOOOOo ", -" XXXXXXXXXXXXXXXXXXXXXXXXXX ", -" OOOOOOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo. ", -" XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXo ", -" ooooooooooooooooooooooooooooooooooooooo "}; diff --git a/hw/xfree86/utils/xorgcfg/mouse-cfg.c b/hw/xfree86/utils/xorgcfg/mouse-cfg.c deleted file mode 100644 index d74321e58..000000000 --- a/hw/xfree86/utils/xorgcfg/mouse-cfg.c +++ /dev/null @@ -1,417 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "xf86config.h" -#include "mouse-cfg.h" -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/Label.h> -#include <X11/Xaw/List.h> -#include <X11/Xaw/Form.h> -#include <X11/Xaw/Toggle.h> -#include <X11/Xaw/Viewport.h> - -/* - * Prototypes - */ -static void MouseDeviceCallback(Widget, XtPointer, XtPointer); -static void MouseProtocolCallback(Widget, XtPointer, XtPointer); -static void MouseEmulateCallback(Widget, XtPointer, XtPointer); -static Bool MouseConfigCheck(void); - -/* - * Initialization - */ -static struct MouseProtocol { - char *name; - int type; -} protocols[] = { -#ifdef __SCO__ - {"OsMouse", MTYPE_AUTOMOUSE}, -#endif -#ifdef WSCONS_SUPPORT - {"wsmouse", MTYPE_AUTOMOUSE}, -#endif - {"Auto", MTYPE_AUTOMOUSE}, - {"SysMouse", MTYPE_SYSMOUSE}, - {"MouseSystems", MTYPE_MOUSESYS}, - {"BusMouse", MTYPE_BUSMOUSE}, - {"PS/2", MTYPE_PS_2}, - {"Microsoft", MTYPE_MICROSOFT}, -#ifndef __FreeBSD__ - {"ImPS/2", MTYPE_IMPS2}, - {"ExplorerPS/2", MTYPE_EXPPS2}, - {"GlidePointPS/2", MTYPE_GLIDEPOINTPS2}, - {"MouseManPlusPS/2", MTYPE_MMANPLUSPS2}, - {"NetMousePS/2", MTYPE_NETPS2}, - {"NetScrollPS/2", MTYPE_NETSCROLLPS2}, - {"ThinkingMousePS/2", MTYPE_THINKINGPS2}, -#endif - {"AceCad", MTYPE_ACECAD}, - {"GlidePoint", MTYPE_GLIDEPOINT}, - {"IntelliMouse", MTYPE_IMSERIAL}, - {"Logitech", MTYPE_LOGITECH}, - {"MMHitTab", MTYPE_MMHIT}, - {"MMSeries", MTYPE_MMSERIES}, - {"MouseMan", MTYPE_LOGIMAN}, - {"ThinkingMouse", MTYPE_THINKING}, -}; - -static Widget text; -static char *device, *protocol; -static Bool emulate; -static XF86ConfInputPtr current_input; - -/* - * Implementation - */ -/*ARGSUSED*/ -XtPointer -MouseConfig(XtPointer config) -{ - XF86ConfInputPtr mouse = (XF86ConfInputPtr)config; - XF86OptionPtr option; - char mouse_name[32]; - Arg args[1]; - - static char *Device = "Device", *Protocol = "Protocol", - *Emulate3Buttons = "Emulate3Buttons", - *Emulate3Timeout = "Emulate3Timeout"; - - current_input = mouse; - - if (mouse != NULL) { - emulate = xf86findOption(mouse->inp_option_lst, - Emulate3Buttons) != NULL; - if ((option = xf86findOption(mouse->inp_option_lst, Device)) != NULL) - device = option->opt_val; - else - device = NULL; - if ((option = xf86findOption(mouse->inp_option_lst, Protocol)) != NULL) - protocol = option->opt_val; - else - protocol = NULL; - - XtSetArg(args[0], XtNstring, mouse->inp_identifier); - XtSetValues(ident_widget, args, 1); - } - else { - XF86ConfInputPtr input = XF86Config->conf_input_lst; - int nmouses = 0; - - while (input != NULL) { - if (strcasecmp(input->inp_driver, "mouse") == 0) - ++nmouses; - input = (XF86ConfInputPtr)(input->list.next); - } - do { - XmuSnprintf(mouse_name, sizeof(mouse_name), "Mouse%d", nmouses); - ++nmouses; - } while (xf86findInput(mouse_name, - XF86Config->conf_input_lst)); - - XtSetArg(args[0], XtNstring, mouse_name); - XtSetValues(ident_widget, args, 1); - - emulate = True; - device = NULL; - protocol = NULL; - } - - xf86info.cur_list = MOUSE; - XtSetSensitive(back, xf86info.lists[MOUSE].cur_function > 0); - XtSetSensitive(next, xf86info.lists[MOUSE].cur_function < - xf86info.lists[MOUSE].num_functions - 1); - (xf86info.lists[MOUSE].functions[xf86info.lists[MOUSE].cur_function]) - (&xf86info); - - if (ConfigLoop(MouseConfigCheck) == True) { - XtSetArg(args[0], XtNstring, &device); - XtGetValues(text, args, 1); - if (mouse == NULL) { - mouse = XtNew(XF86ConfInputRec); - mouse->list.next = NULL; - mouse->inp_identifier = XtNewString(ident_string); - mouse->inp_driver = XtNewString("mouse"); - mouse->inp_option_lst = xf86newOption(XtNewString(Device), - XtNewString(device)); - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Protocol), XtNewString(protocol)); - if (emulate) { - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Emulate3Buttons), NULL); - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Emulate3Timeout), - XtNewString("50")); - } - mouse->inp_comment = NULL; - } - else { - if ((option = xf86findOption(mouse->inp_option_lst, Device)) != NULL) { - XtFree(option->opt_val); - option->opt_val = XtNewString(device); - XtFree(option->opt_comment); - } - else { - if (mouse->inp_option_lst == NULL) - mouse->inp_option_lst = xf86newOption(XtNewString(Device), - XtNewString(device)); - else - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Device), XtNewString(device)); - } - - if ((option = xf86findOption(mouse->inp_option_lst, Protocol)) != NULL) { - XtFree(option->opt_val); - option->opt_val = XtNewString(protocol); - XtFree(option->opt_comment); - } - else - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Protocol), XtNewString(protocol)); - - if (emulate == False) { - xf86removeOption(&(mouse->inp_option_lst), Emulate3Buttons); - xf86removeOption(&(mouse->inp_option_lst), Emulate3Timeout); - } - else if (emulate) { - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Emulate3Buttons), NULL); - xf86addNewOption(mouse->inp_option_lst, - XtNewString(Emulate3Timeout), XtNewString("50")); - } - } - if (strcasecmp(mouse->inp_identifier, ident_string)) - xf86renameInput(XF86Config, mouse, ident_string); - - return ((XtPointer)mouse); - } - - return (NULL); -} - -static Bool -MouseConfigCheck(void) -{ - Arg args[1]; - XF86ConfInputPtr mouse = XF86Config->conf_input_lst; - - XtSetArg(args[0], XtNstring, &device); - XtGetValues(text, args, 1); - - if (ident_string == NULL || strlen(ident_string) == 0 || - device == NULL || strlen(device) == 0 || protocol == NULL) - return (False); - while (mouse != NULL) { - if (mouse != current_input && - strcasecmp(ident_string, mouse->inp_identifier) == 0) - return (False); - mouse = (XF86ConfInputPtr)(mouse->list.next); - } - - return (True); -} - -static void -MouseDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - Arg args[1]; - - XtSetArg(args[0], XtNstring, info->string); - XtSetValues((Widget)user_data, args, 1); - XawTextSetInsertionPoint((Widget)user_data, strlen(info->string)); -} - -static void -MouseProtocolCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - - protocol = info->string; -} - -static void -MouseEmulateCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - emulate = (Bool)(long)call_data; -} - -void -MouseDeviceAndProtocol(XF86SetupInfo *info) -{ - static int first = 1, ndevices; - static Widget mouse_dp, listD, listP, emul3, apply; - static char **devices; - static char *dirs[] = { - "/dev", -#ifdef __linux__ - "/dev/input" -#endif - }; - static char *patterns[] = { -#ifdef WSCONS_SUPPORT - "wsmouse", -#endif - "cuaa", - "mice", - "mouse", - "ps", - "sysmouse", - "ttyS", - }; - Arg args[2]; - int i; - - if (first) { - Widget viewport; - struct dirent *ent; - DIR *dir; - char **list; - int count; - - first = 0; - - mouse_dp = XtCreateWidget("mouseDP", formWidgetClass, - configp, NULL, 0); - - /* DEVICE */ - for (count = 0; count < sizeof(dirs) / sizeof(dirs[0]); count++) { - if ((dir = opendir(dirs[count])) != NULL) { - int i, len, xlen = strlen(dirs[count]) + 2; - - (void)readdir(dir); - (void)readdir(dir); - while ((ent = readdir(dir)) != NULL) { - for (i = 0; i < sizeof(patterns) / sizeof(patterns[0]); i++) { - len = strlen(patterns[i]); - - if (strncmp(patterns[i], ent->d_name, len) == 0) { - len = strlen(ent->d_name) + xlen; - - devices = (char**)XtRealloc((XtPointer)devices, - sizeof(char*) * ++ndevices); - devices[ndevices - 1] = XtMalloc(len); - XmuSnprintf(devices[ndevices - 1], len, "%s/%s", - dirs[count], ent->d_name); - } - } - } - closedir(dir); - } - } - - (void) XtCreateManagedWidget("labelD", labelWidgetClass, - mouse_dp, NULL, 0); - text = XtVaCreateManagedWidget("device", asciiTextWidgetClass, - mouse_dp, - XtNeditType, XawtextEdit, - NULL); - viewport = XtCreateManagedWidget("viewportD", viewportWidgetClass, - mouse_dp, NULL, 0); - - listD = XtVaCreateManagedWidget("listD", listWidgetClass, - viewport, - XtNlist, devices, - XtNnumberStrings, ndevices, - NULL); - XtAddCallback(listD, XtNcallback, MouseDeviceCallback, (XtPointer)text); - - /* PROTOCOL */ - (void) XtCreateManagedWidget("labelP", labelWidgetClass, - mouse_dp, NULL, 0); - viewport = XtCreateManagedWidget("viewportP", viewportWidgetClass, - mouse_dp, NULL, 0); - - list = (char**)XtMalloc(sizeof(char*) * - sizeof(protocols)/sizeof(protocols[0])); - for (count = 0; count < sizeof(protocols)/sizeof(protocols[0]); count++) - list[count] = XtNewString(protocols[count].name); - listP = XtVaCreateManagedWidget("listP", listWidgetClass, - viewport, - XtNlist, list, - XtNnumberStrings, count, - NULL); - XtAddCallback(listP, XtNcallback, MouseProtocolCallback, NULL); - - emul3 = XtVaCreateManagedWidget("emulate3", toggleWidgetClass, - mouse_dp, XtNstate, True, NULL); - XtAddCallback(emul3, XtNcallback, MouseEmulateCallback, NULL); - apply = XtCreateManagedWidget("apply", commandWidgetClass, - mouse_dp, NULL, 0); - - XtRealizeWidget(mouse_dp); - } - - if (device != NULL) { - for (i = 0; i < ndevices; i++) - if (strcmp(device, devices[i]) == 0) { - XtSetArg(args[0], XtNstring, device); - XtSetValues(text, args, 1); - XawListHighlight(listD, i); - break; - } - - if (i >= ndevices) { - devices = (char**)XtRealloc((XtPointer)devices, - sizeof(char*) * ++ndevices); - devices[ndevices - 1] = XtNewString(device); - XawListHighlight(listD, ndevices - 1); - XtSetArg(args[0], XtNlist, devices); - XtSetArg(args[1], XtNnumberStrings, ndevices); - XtSetValues(listD, args, 2); - } - device = devices[i]; - } - else { - XtSetArg(args[0], XtNstring, ""); - XtSetValues(text, args, 1); - XawListUnhighlight(listD); - } - - if (protocol != NULL) { - for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++) - if (strcasecmp(protocol, protocols[i].name) == 0) { - protocol = protocols[i].name; - XawListHighlight(listP, i); - break; - } - } - else { - /* "Auto" is the default */ - protocol = protocols[0].name; - XawListHighlight(listP, 0); - } - - XtSetArg(args[0], XtNstate, emulate); - XtSetValues(emul3, args, 1); - - XtChangeManagedSet(¤t, 1, NULL, NULL, &mouse_dp, 1); - current = mouse_dp; -} diff --git a/hw/xfree86/utils/xorgcfg/mouse-cfg.h b/hw/xfree86/utils/xorgcfg/mouse-cfg.h deleted file mode 100644 index 90e5980e6..000000000 --- a/hw/xfree86/utils/xorgcfg/mouse-cfg.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - */ - -#include "config.h" - -#ifndef _xf86cfg_mouse_h -#define _xf86cfg_mouse_h - -/* - * Prototypes - */ -XtPointer MouseConfig(XtPointer); -void MouseDeviceAndProtocol(XF86SetupInfo*); - -#endif /* _xf86cfg_mouse_h */ - diff --git a/hw/xfree86/utils/xorgcfg/mouse.xbm b/hw/xfree86/utils/xorgcfg/mouse.xbm deleted file mode 100644 index dce92d24a..000000000 --- a/hw/xfree86/utils/xorgcfg/mouse.xbm +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -#define mouse_width 50 -#define mouse_height 44 -static unsigned char mouse_bits[] = { - 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xcf, 0x03, 0x00, - 0x00, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0xe0, 0x79, 0x78, - 0x1e, 0x00, 0x00, 0x00, 0x60, 0x38, 0x70, 0x18, 0x00, 0x00, 0x00, 0x70, - 0x30, 0x30, 0x38, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, - 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, - 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, - 0x30, 0x30, 0x00, 0x00, 0x00, 0x30, 0x30, 0x30, 0x30, 0x00, 0x00, 0x00, - 0xf0, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0x3f, 0x00, - 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, - 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, - 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, - 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, - 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, - 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, - 0x00, 0x30, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x38, - 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0xe0, 0x01, - 0x00, 0x1e, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, }; diff --git a/hw/xfree86/utils/xorgcfg/mouse.xpm b/hw/xfree86/utils/xorgcfg/mouse.xpm deleted file mode 100644 index ea157c266..000000000 --- a/hw/xfree86/utils/xorgcfg/mouse.xpm +++ /dev/null @@ -1,76 +0,0 @@ -/* XPM */ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - * $XFree86$ - */ -static char * mouse_xpm[] = { -"26 35 8 1", -" c none", -". c #E79DE79DE79D", -"X c #CF3CCF3CCF3C", -"o c #BEFBBAEABEFB", -"O c #8E3896588E38", -"+ c #AEBAAAAAAEBA", -"@ c #9E79AAAA9E79", -"# c #A699A289A699", -" .....XXXX. ", -" X..o.XXXXXXXo... ", -" X..XXo.XXXXXXXo.XX.X ", -" X.XXXXo.XXXXXXXo.XXX.X ", -" .XXXXXo.XXXXXXXo.XXXXoo ", -" X.XXXXXo.XXXoXXXo.XXXXoXo", -"oX.XXXXXo.XXXXXXXo.XXXXXoo", -"oX.XoXoXo.XXoXoXXo.XXXXXoO", -"oX.XXXXXo.XXXXXXXo.XXoXX+O", -"oX.XXXoXo.XXoXoXXo.XXXXX+O", -"oX.XXXXXo.XXXXXXXo.XX...+O", -"ooooo...o........oooo@@@OO", -"oX.XX#@@@@@@@@@@@@@@@XXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXXX+O", -"oX.XXXXXXXXXXXXXXXXXXXX+oO", -" #X.XXXXXXXXXXXXXXXXXXooO ", -" #X.XXXXXXXXXXXXXXXXXXooO ", -" #X.XXXXXXXXXXXXXXXXXX+oO ", -" #X.XXXXXXXXXXXXXXXXXX+oO ", -" #.XXXXXXXXXXXXXXXXX++O ", -" #X..XXXXXXXXXXXXXXX+oO ", -" #X.XXXXXXXXXXXXXX+oO ", -" #.XXXXXXXXXXXXXX+O ", -" #X..XXXXXXXXXo++oO ", -" #XX..XXXXXoo+ooO ", -" ##XXooooo+ooOO ", -" ooooooooOO ", -" oOOOOO "}; diff --git a/hw/xfree86/utils/xorgcfg/narrower.xbm b/hw/xfree86/utils/xorgcfg/narrower.xbm deleted file mode 100644 index 0649ef8b4..000000000 --- a/hw/xfree86/utils/xorgcfg/narrower.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define narrower_width 19 -#define narrower_height 19 -static unsigned char narrower_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0x00, 0x18, 0xc0, 0x00, - 0x38, 0xe0, 0x00, 0x78, 0xf0, 0x00, 0xf8, 0xf8, 0x00, 0xff, 0xfd, 0x07, - 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xff, 0x07, 0xff, 0xfd, 0x07, - 0xf8, 0xf8, 0x00, 0x78, 0xf0, 0x00, 0x38, 0xe0, 0x00, 0x18, 0xc0, 0x00, - 0x08, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/hw/xfree86/utils/xorgcfg/options.c b/hw/xfree86/utils/xorgcfg/options.c deleted file mode 100644 index d229bb17f..000000000 --- a/hw/xfree86/utils/xorgcfg/options.c +++ /dev/null @@ -1,787 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "options.h" -#include "xf86config.h" -#include <X11/Xresource.h> -#include <X11/Shell.h> -#include <X11/Xaw/AsciiText.h> -#include <X11/Xaw/List.h> -#include <X11/Xaw/Command.h> -#include <X11/Xaw/MenuButton.h> -#include <X11/Xaw/Paned.h> -#include <X11/Xaw/SimpleMenP.h> -#include <X11/Xaw/SmeBSB.h> -#include <X11/Xaw/Viewport.h> -#include <ctype.h> - -/* - * Prototypes - */ -static void PopdownCallback(Widget, XtPointer, XtPointer); -static void SelectOptionCallback(Widget, XtPointer, XtPointer); -static void AddOption(Widget, XtPointer, XtPointer); -static void RemoveOption(Widget, XtPointer, XtPointer); -static void UpdateOption(Widget, XtPointer, XtPointer); -static void UpdateOptionList(void); -#ifdef USE_MODULES -static void AddDriverOption(Widget, XtPointer, XtPointer); -static void SelectModuleCallback(Widget, XtPointer, XtPointer); -static void SelectModuleOptionCallback(Widget, XtPointer, XtPointer); -static void ModuleOptionsPopdown(Widget, XtPointer, XtPointer); -#endif -static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList, - XrmRepresentation*, XrmValue*, XPointer); - -/* - * Initialization - */ -Widget optionsShell; -static XF86OptionPtr *options; -static Widget add, remov, update, list, name, value; -static char *option_str; -static int option_index, popped = False; -static char *Options = "lib/X11/Options"; -XrmDatabase options_xrm; -struct { - char *string; - int offset; -} rebuild_xrm; -#ifdef USE_MODULES -static Widget modList, optList, desc, modOptionsShell, labelType; -static char *module_sel; -static char *types[] = { - "none", "integer", "(non null) string", "string", "real", - "boolean", "frequency", -}; -#endif - -/* - * Implementation - */ -#ifdef USE_MODULES -static int -qcmp_str(_Xconst void *a, _Xconst void *b) -{ - return (strcmp(*(char**)a, *(char**)b)); -} - -void -ModuleOptionsPopup(Widget w, XtPointer user_data, XtPointer call_data) -{ - xf86cfgModuleOptions *info = module_options; - - if (modOptionsShell == NULL) { - char **ops; - int nops; - Widget pane, form, viewport, bottom, popdown; - - modOptionsShell = XtCreatePopupShell("moduleOptions", - transientShellWidgetClass, - optionsShell, NULL, 0); - - pane = XtCreateManagedWidget("pane", panedWidgetClass, - modOptionsShell, NULL, 0); - - form = XtCreateManagedWidget("descriptions", formWidgetClass, - pane, NULL, 0); - labelType = XtCreateManagedWidget("labelType", labelWidgetClass, - form, NULL, 0); - XtCreateManagedWidget("module", labelWidgetClass, form, NULL, 0); - viewport = XtCreateManagedWidget("viewM", viewportWidgetClass, - form, NULL, 0); - ops = NULL; - nops = 0; - while (info) { - ++nops; - ops = (char**)XtRealloc((XtPointer)ops, sizeof(char*) * nops); - ops[nops - 1] = XtNewString(info->name); - info = info->next; - } - if (nops == 0) { - ops = (char**)XtMalloc(sizeof(char*)); - ops[0] = XtNewString(""); - nops = 1; - } - else - qsort(ops, nops, sizeof(char*), qcmp_str); - modList = XtVaCreateManagedWidget("modL", listWidgetClass, - viewport, XtNlist, ops, - XtNnumberStrings, nops, - NULL); - XtAddCallback(modList, XtNcallback, SelectModuleCallback, NULL); - XtCreateManagedWidget("option", labelWidgetClass, form, NULL, 0); - viewport = XtCreateManagedWidget("viewO", viewportWidgetClass, - form, NULL, 0); - ops = (char**)XtMalloc(sizeof(char*)); - ops[0] = XtNewString(""); - optList = XtVaCreateManagedWidget("optL", listWidgetClass, - viewport, XtNlist, ops, - XtNnumberStrings, 1, NULL); - XtAddCallback(optList, XtNcallback, SelectModuleOptionCallback, NULL); - desc = XtVaCreateManagedWidget("desc", asciiTextWidgetClass, - form, XtNeditType, XawtextRead, - NULL); - - bottom = XtCreateManagedWidget("bottom", formWidgetClass, - pane, NULL, 0); - popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass, - bottom, NULL); - XtAddCallback(popdown, XtNcallback, ModuleOptionsPopdown, NULL); - XtRealizeWidget(modOptionsShell); - XSetWMProtocols(DPY, XtWindow(modOptionsShell), &wm_delete_window, 1); - - info = module_options; - } - - if (module_sel && *module_sel) { - XawListReturnStruct list; /* hack to call ballbacks */ - char **strs; - int nstrs, idx = 0; - - XtVaGetValues(modList, XtNlist, &strs, XtNnumberStrings, &nstrs, NULL); - for (idx = nstrs - 1; idx > 0; idx--) - if (strcmp(module_sel, strs[idx]) == 0) - break; - while (info) { - if (strcmp(module_sel, info->name) == 0) - break; - info = info->next; - } - if (info) { - list.string = info->name; - list.list_index = idx; - XawListHighlight(modList, idx); - SelectModuleCallback(modList, NULL, (XtPointer)&list); - } - if (option_str && *option_str) { - OptionInfoPtr opts = info->option; - - idx = 0; - while (opts && opts->name) { - if (strcmp(opts->name, option_str) == 0) - break; - ++idx; - ++opts; - } - - if (opts && opts->name) { - list.string = (char *)opts->name; - list.list_index = idx; - XawListHighlight(optList, idx); - SelectModuleOptionCallback(optList, NULL, (XtPointer)&list); - } - } - } - XtPopup(modOptionsShell, XtGrabNone); -} - -/*ARGSUSED*/ -static void -ModuleOptionsPopdown(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtPopdown(modOptionsShell); -} - -/*ARGSUSED*/ -void -ModuleOptionsCancelAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - ModuleOptionsPopdown(w, NULL, NULL); -} -#endif - -void -CreateOptionsShell(void) -{ - optionsShell = XtCreatePopupShell("options", transientShellWidgetClass, - toplevel, NULL, 0); -} - -#ifdef USE_MODULES -void -OptionsPopup(XF86OptionPtr *opts, char *driver, OptionInfoPtr drv_opts) -#else -void -OptionsPopup(XF86OptionPtr *opts) -#endif -{ - static int first = 1; -#ifdef USE_MODULES - static Widget button, menu; - static char label[256], menuName[16]; - Widget sme; - char buf[256]; - int i = 0; - Arg args[1]; - static int menuN; -#endif - - option_str = NULL; - options = opts; - if (first) { - Widget pane, form, viewport, bottom, popdown; - - first = 0; - - if (optionsShell == NULL) - CreateOptionsShell(); - pane = XtCreateManagedWidget("pane", panedWidgetClass, - optionsShell, NULL, 0); - - form = XtCreateManagedWidget("commands", formWidgetClass, - pane, NULL, 0); - add = XtCreateManagedWidget("add", commandWidgetClass, - form, NULL, 0); - XtAddCallback(add, XtNcallback, AddOption, NULL); - remov = XtCreateManagedWidget("remove", commandWidgetClass, - form, NULL, 0); - XtAddCallback(remov, XtNcallback, RemoveOption, NULL); - update = XtCreateManagedWidget("update", commandWidgetClass, - form, NULL, 0); - XtAddCallback(update, XtNcallback, UpdateOption, NULL); -#ifdef USE_MODULES - if (!nomodules) { - Widget command; - - command = XtCreateManagedWidget("help", commandWidgetClass, - form, NULL, 0); - XtAddCallback(command, XtNcallback, ModuleOptionsPopup, NULL); - } -#endif - form = XtCreateManagedWidget("form", formWidgetClass, - pane, NULL, 0); - XtVaCreateManagedWidget("label1", labelWidgetClass, form, - XtNlabel, " Option \"", - NULL); - name = XtVaCreateManagedWidget("name", asciiTextWidgetClass, form, - XtNeditType, XawtextEdit, - NULL); - XtVaCreateManagedWidget("label2", labelWidgetClass, - form, - XtNlabel, "\" \"", - NULL); - value = XtVaCreateManagedWidget("value", asciiTextWidgetClass, form, - XtNeditType, XawtextEdit, - NULL); - XtVaCreateManagedWidget("label3", labelWidgetClass, form, - XtNlabel, "\" ", - NULL); - viewport = XtCreateManagedWidget("viewport", viewportWidgetClass, - form, NULL, 0); - list = XtCreateManagedWidget("list", listWidgetClass, - viewport, NULL, 0); - XtAddCallback(list, XtNcallback, SelectOptionCallback, NULL); - bottom = XtCreateManagedWidget("bottom", formWidgetClass, - pane, NULL, 0); -#ifdef USE_MODULES - if (!nomodules) - button = XtCreateManagedWidget("driverOpts", menuButtonWidgetClass, - bottom, NULL, 0); -#endif - popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass, - bottom, NULL); -#ifdef USE_MODULES - if (!nomodules) - XtVaSetValues(popdown, XtNfromHoriz, button, NULL); -#endif - - XtAddCallback(popdown, XtNcallback, PopdownCallback, NULL); - XtRealizeWidget(optionsShell); - XSetWMProtocols(DPY, XtWindow(optionsShell), &wm_delete_window, 1); - -#ifdef USE_MODULES - if (!nomodules) { - char *str; - - XtSetArg(args[0], XtNlabel, &str); - XtGetValues(button, args, 1); - XmuSnprintf(label, sizeof(label), "%s", str); - } -#endif - } - -#ifdef USE_MODULES - if (!nomodules) { - if (menu) - XtDestroyWidget(menu); - XmuSnprintf(menuName, sizeof(menuName), "optionM%d", menuN); - menuN = !menuN; - menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, button, - NULL, 0); - XtVaSetValues(button, XtNmenuName, menuName, NULL); - if (drv_opts) { - int len, longest = 0; - char fmt[32]; - - for (i = 0; drv_opts[i].name != NULL; i++) { - len = strlen(drv_opts[i].name); - if (len > longest) - longest = len; - } - XmuSnprintf(fmt, sizeof(fmt), "%c-%ds %%s", '%', longest); - for (; drv_opts->name != NULL; drv_opts++) { - char *type; - - if (drv_opts->type >= OPTV_NONE && drv_opts->type <= OPTV_FREQ) - type = types[drv_opts->type]; - else - type = "UNKNOWN"; - - XmuSnprintf(buf, sizeof(buf), fmt, drv_opts->name, type); - sme = XtVaCreateManagedWidget(drv_opts->name, smeBSBObjectClass, - menu, XtNlabel, buf, NULL); - XtAddCallback(sme, XtNcallback, AddDriverOption, (XtPointer)drv_opts); - } - } - if (i) { - xf86cfgModuleOptions *mod = module_options; - - while (mod) { - if (strcmp(mod->name, driver) == 0) { - /* don't assign to driver, as it may be a temp string */ - module_sel = mod->name; - break; - } - mod = mod->next; - } - XmuSnprintf(buf, sizeof(buf), "%s%s", label, driver); - XtSetArg(args[0], XtNlabel, buf); - XtSetValues(button, args, 1); - XtMapWidget(button); - } - else - XtUnmapWidget(button); - } -#endif - - UpdateOptionList(); - popped = True; - XtPopup(optionsShell, XtGrabExclusive); - - while (popped) - XtAppProcessEvent(XtWidgetToApplicationContext(optionsShell), XtIMAll); -} - -static void -UpdateOptionList(void) -{ - Arg args[2]; - char **ops, **oldops; - int nops, oldnops; - XF86OptionPtr opt; - - ops = NULL; - nops = 0; - XawListUnhighlight(list); - XtSetArg(args[0], XtNlist, &oldops); - XtSetArg(args[1], XtNnumberStrings, &oldnops); - XtGetValues(list, args, 2); - opt = *options; - while (opt != NULL) { - if (nops % 16 == 0) - ops = (char**)XtRealloc((XtPointer)ops, (nops + 16) * - sizeof(char*)); - ops[nops++] = XtNewString(opt->opt_name); - opt = (XF86OptionPtr)(opt->list.next); - } - if (nops == 0) { - ops = (char**)XtMalloc(sizeof(char*)); - ops[0] = XtNewString(""); - nops = 1; - } - XtSetArg(args[0], XtNlist, ops); - XtSetArg(args[1], XtNnumberStrings, nops); - XtSetValues(list, args, 2); - if (oldnops > 0 && - (oldnops != 1 || XtName(list) != oldops[0])) { - while (--oldnops >= 0) - XtFree(oldops[oldnops]); - XtFree((XtPointer)oldops); - } - - XtSetArg(args[0], XtNstring, ""); - XtSetValues(name, args, 1); - XtSetValues(value, args, 1); - - /* force relayout */ - XtUnmanageChild(list); - XtManageChild(list); - - XtSetSensitive(remov, False); - XtSetSensitive(update, False); -} - -/*ARGSUSED*/ -static void -PopdownCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - XtPopdown(optionsShell); - popped = False; -} - -/*ARGSUSED*/ -void -OptionsCancelAction(Widget w, XEvent *event, - String *params, Cardinal *num_params) -{ - PopdownCallback(w, NULL, NULL); -} - -/*ARGSUSED*/ -static void -SelectOptionCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - XF86OptionPtr option; - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - - option_str = info->string; - option_index = info->list_index; - if ((option = xf86findOption(*options, info->string)) != NULL) { - XtSetArg(args[0], XtNstring, option->opt_name); - XtSetValues(name, args, 1); - XtSetArg(args[0], XtNstring, - option->opt_val != NULL ? option->opt_val : ""); - XtSetValues(value, args, 1); - } - XtSetSensitive(remov, True); - XtSetSensitive(update, True); -} - -/*ARGSUSED*/ -static void -AddOption(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - char *nam, *val; - - XtSetArg(args[0], XtNstring, &nam); - XtGetValues(name, args, 1); - XtSetArg(args[0], XtNstring, &val); - XtGetValues(value, args, 1); - if (xf86findOption(*options, nam) != NULL || strlen(nam) == 0) - /* XXX xf86addNewOption will trash the option linked list if - * the options being added already exists. - */ - return; - *options = xf86addNewOption(*options, XtNewString(nam), - val && strlen(val) ? XtNewString(val) : NULL); - UpdateOptionList(); -} - -#ifdef USE_MODULES -/*ARGSUSED*/ -static void -AddDriverOption(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - OptionInfoPtr opt = (OptionInfoPtr)user_data; - XF86OptionPtr option; - - option_str = (char *)opt->name; - XtSetArg(args[0], XtNstring, opt->name); - XtSetValues(name, args, 1); - if ((option = xf86findOption(*options, opt->name)) == NULL) - XtSetArg(args[0], XtNstring, ""); - else - XtSetArg(args[0], XtNstring, option->opt_val); - XtSetValues(value, args, 1); -} - -/*ARGSUSED*/ -static void -SelectModuleCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - xf86cfgModuleOptions *mod = module_options; - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - - while (mod) { - if (strcmp(mod->name, info->string) == 0) - break; - mod = mod->next; - } - - if (mod) { - Arg args[2]; - char **list = NULL, **old; - OptionInfoPtr opts = mod->option; - int num = 0, oldnum; - - module_sel = mod->name; - XtSetArg(args[0], XtNlist, &old); - XtSetArg(args[1], XtNnumberStrings, &oldnum); - XtGetValues(optList, args, 2); - while (opts && opts->name) { - ++num; - list = (char**)XtRealloc((XtPointer)list, sizeof(char*) * num); - list[num - 1] = XtNewString(opts->name); - ++opts; - } - if (num == 0) { - list = (char**)XtMalloc(sizeof(char*)); - list[0] = XtNewString(""); - num = 1; - } - XtSetArg(args[0], XtNlist, list); - XtSetArg(args[1], XtNnumberStrings, num); - XtSetValues(optList, args, 2); - while (--oldnum >= 0) - XtFree(old[oldnum]); - XtFree((XtPointer)old); - - XtVaSetValues(desc, XtNstring, "", NULL); - XawListUnhighlight(optList); - - /* force relayout */ - XtUnmanageChild(optList); - XtManageChild(optList); - } -} - -static void -SelectModuleOptionCallback(Widget w, XtPointer user_data, XtPointer call_data) -{ - xf86cfgModuleOptions *mod = module_options; - XawListReturnStruct *info = (XawListReturnStruct *)call_data; - char *description = NULL, *type = "undefined"; - char label[256]; - - if (module_sel && info->string) - description = GetOptionDescription(module_sel, info->string); - if (description == NULL) - description = "** NO DESCRIPTION AVAILABLE **"; - - XtVaSetValues(desc, XtNstring, description, NULL); - - while (mod) { - if (strcmp(module_sel, mod->name) == 0) - break; - mod = mod->next; - } - if (mod) { - OptionInfoPtr opts = mod->option; - - while (opts && opts->name) { - if (strcasecmp(opts->name, info->string) == 0) - break; - ++opts; - } - if (opts && opts->name && opts->type >= OPTV_NONE && - opts->type <= OPTV_FREQ) - type = types[opts->type]; - } - - XmuSnprintf(label, sizeof(label), "%s.%s (%s)", module_sel, info->string, - type); - XtVaSetValues(labelType, XtNlabel, label, NULL); -} -#endif - -/*ARGSUSED*/ -static void -RemoveOption(Widget w, XtPointer user_data, XtPointer call_data) -{ - Arg args[1]; - char *str; - - XtSetArg(args[0], XtNstring, &str); - XtGetValues(name, args, 1); - xf86removeOption(options, str); - UpdateOptionList(); -} - -/*ARGSUSED*/ -static void -UpdateOption(Widget w, XtPointer user_data, XtPointer call_data) -{ -/* xf86removeOption(options, option_str); - AddOption(w, user_data, call_data); - UpdateOptionList();*/ - - Arg args[1]; - char *nam, *val; - XF86OptionPtr option; - - XtSetArg(args[0], XtNstring, &nam); - XtGetValues(name, args, 1); - XtSetArg(args[0], XtNstring, &val); - XtGetValues(value, args, 1); - if ((option = xf86findOption(*options, option_str)) == NULL) - return; - XtFree(option->opt_name); - option->opt_name = option_str = XtNewString(nam); - XtFree(option->opt_val); - if (val && strlen(val)) - option->opt_val = XtNewString(val); - else - option->opt_val = NULL; - - UpdateOptionList(); - XawListHighlight(list, option_index); - XtSetArg(args[0], XtNstring, option->opt_name); - XtSetValues(name, args, 1); - XtSetArg(args[0], XtNstring, option->opt_val); - XtSetValues(value, args, 1); - - XtSetSensitive(remov, True); - XtSetSensitive(update, True); -} - -/*ARGUSED*/ -static Bool -EnumDatabase(XrmDatabase *db, XrmBindingList bindings, XrmQuarkList quarks, - XrmRepresentation *type, XrmValue *value, XPointer closure) -{ - char *module = XrmQuarkToString(quarks[0]), - *option = XrmQuarkToString(quarks[1]); - - /* handle *.Option: value */ - if (module && option == NULL) { - option = module; - module = "*"; - } - - /* - * NOTE: If the Options file is changed to support any other format than - * - * Module.Option: description text - * - * this code will also need to be updated. - */ - - if (module) { - XrmValue xrm; - char *type, *value, query[256]; - - XmuSnprintf(query, sizeof(query), "%s.%s", module, option); - if (XrmGetResource(options_xrm, query, "Module.Option", &type, &xrm)) - value = (char*)xrm.addr; - else - value = NULL; - - if (value) { - char *norm; - unsigned char *ptr; - int position; - int length = strlen(module) + strlen(option) + strlen(value) + 4; - - rebuild_xrm.string = XtRealloc(rebuild_xrm.string, - rebuild_xrm.offset + length); - position = rebuild_xrm.offset + - sprintf(rebuild_xrm.string + rebuild_xrm.offset, "%s.%s:", - module, option); - - /* removes underlines and spaces */ - norm = strchr(rebuild_xrm.string + rebuild_xrm.offset, '.') + 1; - for (; *norm; norm++) { - if (*norm == '_' || *norm == ' ' || *norm == '\t') { - memmove(norm, norm + 1, strlen(norm) + 1); - --position; - --length; - } - } - - for (ptr = (unsigned char*)rebuild_xrm.string + rebuild_xrm.offset; - *ptr; ptr++) - *ptr = tolower(*ptr); - sprintf(rebuild_xrm.string + position, "%s\n", value); - rebuild_xrm.offset += length - 1; - } - } - - return (False); -} - -Bool -InitializeOptionsDatabase(void) -{ - static int first = 1; - static Bool result = True; - - if (first) { - XrmQuark names[2]; - XrmQuark classes[2]; - - first = 0; - XrmInitialize(); - if ((options_xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) { - fprintf(stderr, "Cannot open '%s' database.\n", Options); - return (False); - } - - /* rebuild database, using only lowercase characters */ - names[0] = classes[0] = names[1] = classes[1] = NULLQUARK; - (void)XrmEnumerateDatabase(options_xrm, (XrmNameList)&names, - (XrmClassList)&classes, XrmEnumAllLevels, - EnumDatabase, NULL); - - /* free previous database, as it is not guaranteed to be - * "case insensitive" */ - XrmDestroyDatabase(options_xrm); - - /* create case insensitive database by making everything lowercase */ - if (rebuild_xrm.string == NULL || - (options_xrm = XrmGetStringDatabase(rebuild_xrm.string)) == - (XrmDatabase)0) { - fprintf(stderr, "Cannot rebuild '%s' database.\n", Options); - XtFree(rebuild_xrm.string); - return (False); - } - XtFree(rebuild_xrm.string); - } - - return (result); -} - -char * -GetOptionDescription(char *module, char *option) -{ - char *type; - XrmValue value; - char query[256]; - unsigned char *ptr; - - InitializeOptionsDatabase(); - - XmuSnprintf(query, sizeof(query), "%s.%s", module, option); - ptr = (unsigned char*)strchr(query, '.') + 1; - for (; *ptr; ptr++) { - if (*ptr == '_' || *ptr == ' ' || *ptr == '\t') - memmove(ptr, ptr + 1, strlen((char*)ptr) + 1); - } - for (ptr = (unsigned char*)query; *ptr; ptr++) - *ptr = tolower(*ptr); - if (XrmGetResource(options_xrm, query, "Module.Option", &type, &value)) - return ((char*)value.addr); - - return (NULL); -} diff --git a/hw/xfree86/utils/xorgcfg/options.h b/hw/xfree86/utils/xorgcfg/options.h deleted file mode 100644 index 2d08ca448..000000000 --- a/hw/xfree86/utils/xorgcfg/options.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) - * - * 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 - * CONECTIVA LINUX 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 Conectiva Linux shall - * not be used in advertising or otherwise to promote the sale, use or other - * dealings in this Software without prior written authorization from - * Conectiva Linux. - * - * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> - * - */ - -#include "config.h" -#ifdef USE_MODULES -#include "loader.h" -#endif - -/* - * Prototypes - */ -#ifdef USE_MODULES -void OptionsPopup(XF86OptionPtr*, char*, OptionInfoPtr); -void ModuleOptionsPopup(Widget, XtPointer, XtPointer); -#else -void OptionsPopup(XF86OptionPtr*); -#endif -void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*); -void ModuleOptionsCancelAction(Widget, XEvent*, String*, Cardinal*); -char *GetOptionDescription(char *module, char *option); -Bool InitializeOptionsDatabase(void); - -void CreateOptionsShell(void); diff --git a/hw/xfree86/utils/xorgcfg/right.xbm b/hw/xfree86/utils/xorgcfg/right.xbm deleted file mode 100644 index a2f2ce2d1..000000000 --- a/hw/xfree86/utils/xorgcfg/right.xbm +++ /dev/null @@ -1,8 +0,0 @@ -#define right_width 19 -#define right_height 19 -static unsigned char right_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x0e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x3e, 0x00, 0xf8, 0x7f, 0x00, - 0xf8, 0xff, 0x00, 0xf8, 0xff, 0x01, 0xf8, 0xff, 0x00, 0xf8, 0x7f, 0x00, - 0x00, 0x3e, 0x00, 0x00, 0x1e, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/hw/xfree86/utils/xorgcfg/screen-cfg.c b/hw/xfree86/utils/xorgcfg/screen-cfg.c deleted file mode 100644 index 4c67d |