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.
This commit is contained in:
Daniel Stone 2008-07-24 03:01:45 +03:00
parent b74927c384
commit 5c1e254cc8
58 changed files with 1 additions and 26319 deletions

View File

@ -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

View File

@ -1,4 +1,3 @@
SUBDIRS = \
gtf \
cvt \
xorgcfg
cvt

View File

@ -1,2 +0,0 @@
xorgcfg.1
xorgcfg.1x

View File

@ -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

View File

@ -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.

File diff suppressed because it is too large Load Diff

View File

@ -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);
}

View File

@ -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(&current, 1, NULL, NULL, &model, 1);
current = model;
}

View File

@ -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 */

View File

@ -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, };

View File

@ -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 "};

View File

@ -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));
}

View File

@ -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 */

View File

@ -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 "};

View File

@ -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(&current, 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);
}

View File

@ -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 */

View File

@ -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};

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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*);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -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 */

View File

@ -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, };

View File

@ -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 "};

View File

@ -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};

View File

@ -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

View File

@ -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 */

View File

@ -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

View File

@ -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(&current, 1, NULL, NULL, &layout, 1);
current = layout;
}

View File

@ -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 */

View File

@ -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, };

View File

@ -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 "};

View File

@ -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(&current, 1, NULL, NULL, &mouse_dp, 1);
current = mouse_dp;
}

View File

@ -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 */

View File

@ -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, };

View File

@ -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 "};

View File

@ -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};

View File

@ -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);
}

View File

@ -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);

View File

@ -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};

View File

@ -1,555 +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 "screen-cfg.h"
#include <X11/Xaw/Command.h>
#include <X11/Xaw/Form.h>
#include <X11/Xaw/Label.h>
#include <X11/Xaw/List.h>
#include <X11/Xaw/Toggle.h>
#include <X11/Xaw/Viewport.h>
#ifdef USE_MODULES
#include "loader.h"
#endif
#define CW 1
#define CCW -1
/*
* Prototypes
*/
static void DepthCallback(Widget, XtPointer, XtPointer);
static void SelectIndexCallback(Widget, XtPointer, XtPointer);
static void UnselectIndexCallback(Widget, XtPointer, XtPointer);
static void SelectCallback(Widget, XtPointer, XtPointer);
static void UnselectCallback(Widget, XtPointer, XtPointer);
static void MoveCallback(Widget, XtPointer, XtPointer);
static void RotateCallback(Widget, XtPointer, XtPointer);
/*
* Initialization
*/
static char *standard_modes[] = {
"640x400",
"640x480",
"800x600",
"1024x768",
"1280x960",
"1280x1024",
"320x200",
"320x240",
"400x300",
"1152x864",
"1600x1200",
"1800x1400",
"512x384",
"1400x1050",
"2048x1536",
"1920x1440",
};
static char **modes;
static int nmodes;
static int default_depth, sel_index, unsel_index;
static Widget listL, listR;
static char **defmodes;
static int ndefmodes;
static XF86ConfScreenPtr screen;
static int rotate;
/*
* Implementation
*/
XtPointer
ScreenConfig(XtPointer conf)
{
XF86ConfDisplayPtr disp;
Arg args[2];
int i, oldrotate;
screen = (XF86ConfScreenPtr)conf;
if (screen == NULL)
return (NULL);
XtSetArg(args[0], XtNstring, screen->scrn_identifier);
XtSetValues(ident_widget, args, 1);
if ((default_depth = screen->scrn_defaultdepth) <= 0)
default_depth = 8;
sel_index = unsel_index = -1;
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == screen) {
SetScreenRotate(computer.screens[i]);
rotate = computer.screens[i]->rotate;
}
oldrotate = rotate;
ndefmodes = 0;
disp = screen->scrn_display_lst;
while (disp != NULL) {
if (disp->disp_depth == default_depth) {
XF86ModePtr mod = disp->disp_mode_lst;
while (mod != NULL) {
if (ndefmodes % 16 == 0)
defmodes = (char**)
XtRealloc((XtPointer)defmodes,
(ndefmodes + 16) * sizeof(char*));
defmodes[ndefmodes++] = XtNewString(mod->mode_name);
mod = (XF86ModePtr)(mod->list.next);
}
break;
}
disp = (XF86ConfDisplayPtr)(disp->list.next);
}
if (ndefmodes == 0) {
defmodes = (char**)XtMalloc(sizeof(char*));
defmodes[0] = XtNewString("640x480");
ndefmodes = 1;
}
if (listL != NULL) {
XawListUnhighlight(listL);
XawListUnhighlight(listR);
}
xf86info.cur_list = SCREEN;
XtSetSensitive(back, xf86info.lists[SCREEN].cur_function > 0);
XtSetSensitive(next, xf86info.lists[SCREEN].cur_function <
xf86info.lists[SCREEN].num_functions - 1);
(xf86info.lists[SCREEN].functions[xf86info.lists[SCREEN].cur_function])
(&xf86info);
if (ConfigLoop(NULL) == True) {
XF86ModePtr prev = NULL, mod;
/* user may have changed the default depth, read variables again */
disp = screen->scrn_display_lst;
while (disp != NULL) {
if (disp->disp_depth == default_depth)
break;
disp = (XF86ConfDisplayPtr)(disp->list.next);
}
if (disp == NULL) {
disp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
screen->scrn_display_lst = (XF86ConfDisplayPtr)
xf86addListItem((GenericListPtr)(screen->scrn_display_lst),
(GenericListPtr)(disp));
disp->disp_depth = default_depth;
}
if (strcasecmp(screen->scrn_identifier, ident_string))
xf86renameScreen(XF86Config, screen, ident_string);
screen->scrn_defaultdepth = default_depth;
XtSetArg(args[0], XtNlist, NULL);
XtSetArg(args[1], XtNnumberStrings, 0);
XtSetValues(listL, args, 2);
XtSetArg(args[0], XtNlist, NULL);
XtSetArg(args[1], XtNnumberStrings, 0);
XtSetValues(listR, args, 2);
mod = disp->disp_mode_lst;
/* free all modes */
while (mod != NULL) {
prev = mod;
mod = (XF86ModePtr)(mod->list.next);
XtFree(prev->mode_name);
XtFree((XtPointer)prev);
}
/* readd modes */
for (i = 0; i < ndefmodes; i++) {
mod = XtNew(XF86ModeRec);
mod->mode_name = XtNewString(defmodes[i]);
XtFree(defmodes[i]);
if (i == 0)
disp->disp_mode_lst = mod;
else
prev->list.next = mod;
prev = mod;
}
if (i == 0)
disp->disp_mode_lst = NULL;
else
mod->list.next = NULL;
XtFree((XtPointer)defmodes);
defmodes = NULL;
ndefmodes = 0;
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == screen)
computer.screens[i]->rotate = rotate;
if (oldrotate != rotate) {
static char *Rotate = "Rotate";
if (screen->scrn_option_lst != NULL)
xf86removeOption(&screen->scrn_option_lst, Rotate);
if (rotate)
screen->scrn_option_lst =
xf86addNewOption(screen->scrn_option_lst,
XtNewString(Rotate),
XtNewString(rotate > 0 ? "CW" : "CCW"));
UpdateScreenUI();
AdjustScreenUI();
}
return ((XtPointer)screen);
}
XtSetArg(args[0], XtNlist, NULL);
XtSetArg(args[1], XtNnumberStrings, 0);
XtSetValues(listL, args, 2);
XtSetArg(args[0], XtNlist, NULL);
XtSetArg(args[1], XtNnumberStrings, 0);
XtSetValues(listR, args, 2);
for (i = 0; i < ndefmodes; i++)
XtFree(defmodes[i]);
XtFree((XtPointer)defmodes);
defmodes = NULL;
ndefmodes = 0;
return (NULL);
}
/*ARGSUSED*/
static void
DepthCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
if (call_data != NULL)
default_depth = (long)user_data;
}
/*ARGSUSED*/
static void
SelectIndexCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
XawListReturnStruct *info = (XawListReturnStruct *)call_data;
sel_index = info->list_index;
}
/*ARGSUSED*/
static void
UnselectIndexCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
XawListReturnStruct *info = (XawListReturnStruct *)call_data;
unsel_index = info->list_index;
}
/*ARGSUSED*/
static void
SelectCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
Arg args[2];
if (sel_index < 0 || sel_index >= nmodes)
return;
if (ndefmodes == 1 && *defmodes[0] == '\0') {
/* make sure tmp and defentries are not the same pointer */
char **tmp = defmodes;
XtFree(defmodes[0]);
defmodes = (char**)XtMalloc(sizeof(char*));
--ndefmodes;
XtFree((char*)tmp);
}
else
defmodes = (char**)XtRealloc((XtPointer)defmodes,
sizeof(char*) * (ndefmodes + 1));
defmodes[ndefmodes++] = XtNewString(modes[sel_index]);
XtSetArg(args[0], XtNlist, defmodes);
XtSetArg(args[1], XtNnumberStrings, ndefmodes);
XtSetValues(listR, args, 2);
XawListUnhighlight(listR);
if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
if (unsel_index >= ndefmodes)
unsel_index = ndefmodes - 1;
XawListHighlight(listR, unsel_index = ndefmodes - 1);
}
else
unsel_index = -1;
/* force realyout */
XtUnmanageChild(listR);
XtManageChild(listR);
}
/*ARGSUSED*/
static void
UnselectCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
Arg args[2];
char **modes;
Cardinal num_modes;
if (unsel_index < 0 || unsel_index >= ndefmodes)
return;
XawListUnhighlight(listL);
XtSetArg(args[0], XtNlist, &modes);
XtSetArg(args[1], XtNnumberStrings, &num_modes);
XtGetValues(listL, args, 2);
if (modes) {
for (sel_index = 0; sel_index < num_modes; sel_index++)
if (strcmp(defmodes[unsel_index], modes[sel_index]) == 0)
break;
if (sel_index < num_modes)
XawListHighlight(listL, sel_index);
else
sel_index = -1;
}
XtFree(defmodes[unsel_index]);
if (--ndefmodes > unsel_index)
memmove(&defmodes[unsel_index], &defmodes[unsel_index + 1],
(ndefmodes - unsel_index) * sizeof(char*));
if (ndefmodes == 0) {
char **tmp = defmodes;
defmodes = (char**)XtMalloc(sizeof(char*));
defmodes[0] = XtNewString("");
ndefmodes = 1;
XtFree((char*)tmp);
}
XtSetArg(args[0], XtNlist, defmodes);
XtSetArg(args[1], XtNnumberStrings, ndefmodes);
XtSetValues(listR, args, 2);
XawListUnhighlight(listR);
if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
if (unsel_index >= ndefmodes)
unsel_index = ndefmodes - 1;
XawListHighlight(listR, unsel_index);
}
else
unsel_index = -1;
}
/*ARGSUSED*/
static void
MoveCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
char *tmp;
Bool down = (long)user_data;
if (unsel_index < 0 || unsel_index >= ndefmodes)
return;
if ((down && unsel_index + 1 >= ndefmodes) ||
(!down && unsel_index - 1 < 0))
return;
tmp = defmodes[unsel_index];
if (down) {
defmodes[unsel_index] = defmodes[unsel_index + 1];
unsel_index++;
} else {
defmodes[unsel_index] = defmodes[unsel_index - 1];
unsel_index--;
}
defmodes[unsel_index] = tmp;
XawListUnhighlight(listR);
XawListHighlight(listR, unsel_index);
}
/*ARGSUSED*/
void
RotateCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
if (call_data != NULL)
rotate = (long)user_data;
else
rotate = 0;
}
void
ScreenDialog(XF86SetupInfo *info)
{
static Widget dialog, d1, d4, d8, d16, d24, labelRotate, cw, ccw;
Arg args[2];
XF86ConfMonitorPtr mon = screen->scrn_monitor;
XF86ConfModeLinePtr mline = mon != NULL ? mon->mon_modeline_lst : NULL;
int i;
#ifdef USE_MODULES
xf86cfgModuleOptions *drv_opts = module_options;
Bool foundRotate = False;
#endif
while (nmodes > 0)
XtFree(modes[--nmodes]);
XtFree((XtPointer)modes);
modes = NULL;
while (mline) {
if (nmodes % 16 == 0)
modes = (char**)XtRealloc((XtPointer)modes,
sizeof(char*) * (nmodes + 16));
modes[nmodes++] = XtNewString(mline->ml_identifier);
mline = (XF86ConfModeLinePtr)(mline->list.next);
}
for (i = 0; i < sizeof(standard_modes) / sizeof(standard_modes[0]); i++) {
if (nmodes % 16 == 0)
modes = (char**)XtRealloc((XtPointer)modes,
sizeof(char*) * (nmodes + 16));
modes[nmodes++] = XtNewString(standard_modes[i]);
}
if (dialog == NULL) {
Widget command, viewport;
dialog = XtCreateWidget("screenD", formWidgetClass,
configp, NULL, 0);
XtCreateManagedWidget("depthL", labelWidgetClass,
dialog, NULL, 0);
d1 = XtCreateManagedWidget("1", toggleWidgetClass, dialog, NULL, 0);
XtAddCallback(d1, XtNcallback, DepthCallback, (XtPointer)1);
d4 = XtVaCreateManagedWidget("4", toggleWidgetClass, dialog,
XtNradioGroup, d1, NULL);
XtAddCallback(d4, XtNcallback, DepthCallback, (XtPointer)4);
d8 = XtVaCreateManagedWidget("8", toggleWidgetClass, dialog,
XtNradioGroup, d4, NULL);
XtAddCallback(d8, XtNcallback, DepthCallback, (XtPointer)8);
d16 = XtVaCreateManagedWidget("16", toggleWidgetClass, dialog,
XtNradioGroup, d8, NULL);
XtAddCallback(d16, XtNcallback, DepthCallback, (XtPointer)16);
d24 = XtVaCreateManagedWidget("24", toggleWidgetClass, dialog,
XtNradioGroup, d16, NULL);
XtAddCallback(d24, XtNcallback, DepthCallback, (XtPointer)24);
XtCreateManagedWidget("modeL", labelWidgetClass, dialog, NULL, 0);
viewport = XtCreateManagedWidget("viewL", viewportWidgetClass, dialog,
NULL, 0);
listL = XtCreateManagedWidget("listLeft", listWidgetClass, viewport,
NULL, 0);
XtAddCallback(listL, XtNcallback, SelectIndexCallback, NULL);
command = XtCreateManagedWidget("select", commandWidgetClass,
dialog, NULL, 0);
XtAddCallback(command, XtNcallback, SelectCallback, NULL);
command = XtCreateManagedWidget("unselect", commandWidgetClass,
dialog, NULL, 0);
XtAddCallback(command, XtNcallback, UnselectCallback, NULL);
command = XtCreateManagedWidget("up", commandWidgetClass,
dialog, NULL, 0);
XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)False);
command = XtCreateManagedWidget("down", commandWidgetClass,
dialog, NULL, 0);
XtAddCallback(command, XtNcallback, MoveCallback, (XtPointer)True);
viewport = XtCreateManagedWidget("viewR", viewportWidgetClass, dialog,
NULL, 0);
listR = XtCreateManagedWidget("listRight", listWidgetClass, viewport,
NULL, 0);
XtAddCallback(listR, XtNcallback, UnselectIndexCallback, NULL);
labelRotate = XtCreateManagedWidget("rotate", labelWidgetClass,
dialog, NULL, 0);
cw = XtCreateManagedWidget("CW", toggleWidgetClass, dialog, NULL, 0);
XtAddCallback(cw, XtNcallback, RotateCallback, (XtPointer)CW);
ccw = XtVaCreateManagedWidget("CCW", toggleWidgetClass, dialog,
XtNradioGroup, cw, NULL);
XtAddCallback(ccw, XtNcallback, RotateCallback, (XtPointer)CCW);
XtRealizeWidget(dialog);
}
#ifdef USE_MODULES
if (!nomodules) {
while (drv_opts) {
if (drv_opts->type == VideoModule &&
strcmp(drv_opts->name, screen->scrn_device->dev_driver) == 0) {
OptionInfoPtr opts = drv_opts->option;
while (opts->name) {
if (xf86nameCompare(opts->name, "Rotate") == 0) {
foundRotate = True;
break;
}
opts++;
}
break;
}
drv_opts = drv_opts->next;
}
if (!foundRotate) {
XtUnmapWidget(labelRotate);
XtUnmapWidget(cw);
XtUnmapWidget(ccw);
}
else {
XtMapWidget(labelRotate);
XtMapWidget(cw);
XtMapWidget(ccw);
}
}
#else
(void)labelRotate;
#endif
if (rotate == CW) {
XtVaSetValues(cw, XtNstate, True, NULL);
XtVaSetValues(ccw, XtNstate, False, NULL);
}
else if (rotate == CCW) {
XtVaSetValues(cw, XtNstate, False, NULL);
XtVaSetValues(ccw, XtNstate, True, NULL);
}
else {
XtVaSetValues(cw, XtNstate, False, NULL);
XtVaSetValues(ccw, XtNstate, False, NULL);
}
XtSetArg(args[0], XtNlist, modes);
XtSetArg(args[1], XtNnumberStrings, nmodes);
XtSetValues(listL, args, 2);
XtSetArg(args[0], XtNlist, defmodes);
XtSetArg(args[1], XtNnumberStrings, ndefmodes);
XtSetValues(listR, args, 2);
XtSetArg(args[0], XtNstate, True);
XtSetValues(default_depth == 1 ? d1 :
default_depth == 4 ? d4 :
default_depth == 16 ? d16 :
default_depth == 24 ? d24 : d8, args, 1);
XtChangeManagedSet(&current, 1, NULL, NULL, &dialog, 1);
current = dialog;
}

View File

@ -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"
#include "screen.h"
#ifndef _xf86cfg_screencfg_h
#define _xf86cfg_screencfg_h
/*
* Prototypes
*/
XtPointer ScreenConfig(XtPointer);
void ScreenDialog(XF86SetupInfo*);
#endif /* _xf86cfg_screencfg_h */

View File

@ -1,983 +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/extensions/shape.h>
#include <X11/Xaw/Simple.h>
#include "screen.h"
#define CW 1
#define CCW -1
/*
* Prototypes
*/
void ReshapeScreenWidget(xf86cfgScreen*);
static int qcmp_screen(_Xconst void*, _Xconst void*);
/*
* Initialization
*/
extern Widget work;
static int rows, columns; /* number of rows/columns of monitors */
static int mon_width, mon_height;
static int *mon_widths, *mon_heights;
/*
* Implementation
*/
void
SetScreenRotate(xf86cfgScreen *screen)
{
static char *Rotate = "Rotate", *_CW = "CW", *_CCW = "CCW";
int rotate = 0;
XF86OptionPtr option, options;
/* This is the only place where xf86cfg is intrusive, and deletes options
* added by the user directly in the config file. The "Rotate" option
* will be kept in the screen section.
*/
if (screen->monitor != NULL) {
options = ((XF86ConfMonitorPtr)(screen->monitor->config))->mon_option_lst;
if ((option = xf86findOption(options, Rotate)) != NULL) {
if (option->opt_val != NULL)
rotate = strcasecmp(option->opt_val, _CW) == 0 ? CW :
strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
xf86removeOption(&((XF86ConfMonitorPtr)(screen->monitor->config))
->mon_option_lst, Rotate);
}
}
if (screen->card != NULL) {
options = ((XF86ConfDevicePtr)(screen->card->config))->dev_option_lst;
if ((option = xf86findOption(options, Rotate)) != NULL) {
if (option->opt_val != NULL)
rotate += strcasecmp(option->opt_val, _CW) == 0 ? CW :
strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
xf86removeOption(&((XF86ConfDevicePtr)(screen->card->config))
->dev_option_lst, Rotate);
}
}
options = screen->screen->scrn_option_lst;
if ((option = xf86findOption(options, Rotate)) != NULL) {
if (option->opt_val != NULL)
rotate += strcasecmp(option->opt_val, _CW) == 0 ? CW :
strcasecmp(option->opt_val, _CCW) == 0 ? CCW : 0;
xf86removeOption(&screen->screen->scrn_option_lst, Rotate);
}
rotate = rotate > 0 ? CW : rotate < 0 ? CCW : 0;
if (rotate)
screen->screen->scrn_option_lst =
xf86addNewOption(screen->screen->scrn_option_lst,
XtNewString(Rotate),
XtNewString(rotate > 0 ? _CW : _CCW));
screen->rotate = rotate;
}
void
CreateScreenWidget(xf86cfgScreen *screen)
{
Widget w = XtCreateWidget("screen", simpleWidgetClass,
XtParent(computer.cpu), NULL, 0);
SetScreenRotate(screen);
XtRealizeWidget(w);
screen->widget = w;
screen->column = screen->row = -1;
ReshapeScreenWidget(screen);
}
void
ReshapeScreenWidget(xf86cfgScreen *screen)
{
Pixmap pixmap;
XGCValues values;
GC gc;
int x = 0, y = 0, width = screen->rect.width, height = screen->rect.height;
Widget w = screen->widget;
if (screen->state == USED && screen->row >= 0) {
if (screen->column == 0)
x = w->core.width - width;
else if (screen->column == columns - 1)
x = w->core.width - mon_widths[screen->column];
else
x = (w->core.width - mon_widths[screen->column]) +
((mon_widths[screen->column] - width) >> 1);
if (screen->row == 0)
y = w->core.height - height;
else if (screen->row == rows - 1)
y = w->core.height - mon_heights[screen->row];
else
y = (w->core.height - mon_heights[screen->row]) +
((mon_heights[screen->row] - height) >> 1);
}
else if (screen->rect.width == 0) {
width = w->core.width;
height = w->core.height;
}
screen->rect.x = x;
screen->rect.y = y;
screen->rect.width = width;
screen->rect.height = height;
pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
w->core.width, w->core.height, 1);
values.foreground = 0;
values.background = 1;
gc = XCreateGC(XtDisplay(w), pixmap, GCForeground | GCBackground, &values);
XFillRectangle(XtDisplay(w), pixmap, gc, 0, 0, w->core.width, w->core.height);
XSetForeground(XtDisplay(w), gc, 1);
DrawScreenMask(XtDisplay(w), pixmap, gc, x, y, x + width, y + height,
screen->rotate);
XShapeCombineMask(XtDisplay(w), XtWindow(w), ShapeBounding,
0, 0, pixmap, ShapeSet);
/* Do not call XtSetValues, to avoid all extra code for caching pixmaps */
XFreePixmap(XtDisplay(w), pixmap);
if (XtIsRealized(w)) {
pixmap = XCreatePixmap(XtDisplay(w), XtWindow(w),
w->core.width, w->core.height,
DefaultDepthOfScreen(XtScreen(w)));
DrawScreen(XtDisplay(w), pixmap, x, y, x + width, y + height,
screen->state == USED ? True : False, screen->rotate);
XSetWindowBackgroundPixmap(XtDisplay(w), XtWindow(w), pixmap);
XClearWindow(XtDisplay(w), XtWindow(w));
XFreePixmap(XtDisplay(w), pixmap);
}
XFreeGC(XtDisplay(w), gc);
}
void
AddScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
{
int nscreens = 0;
char screen_name[48];
XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
XF86ConfAdjacencyPtr adj;
while (screen != NULL) {
++nscreens;
screen = (XF86ConfScreenPtr)(screen->list.next);
}
do {
XmuSnprintf(screen_name, sizeof(screen_name), "Screen%d",
nscreens);
++nscreens;
} while (xf86findScreen(screen_name,
XF86Config->conf_screen_lst) != NULL);
screen = (XF86ConfScreenPtr)XtCalloc(1, sizeof(XF86ConfScreenRec));
screen->scrn_identifier = XtNewString(screen_name);
screen->scrn_device_str = XtNewString(((XF86ConfDevicePtr)(dev->config))->dev_identifier);
screen->scrn_device = (XF86ConfDevicePtr)(dev->config);
screen->scrn_monitor_str = XtNewString(((XF86ConfMonitorPtr)(mon->config))->mon_identifier);
screen->scrn_monitor = (XF86ConfMonitorPtr)(mon->config);
XF86Config->conf_screen_lst =
xf86addScreen(XF86Config->conf_screen_lst, screen);
adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
adj->adj_screen = screen;
adj->adj_screen_str = XtNewString(screen_name);
if (computer.layout == NULL)
computer.layout = XF86Config->conf_layout_lst = (XF86ConfLayoutPtr)
XtCalloc(1, sizeof(XF86ConfLayoutRec));
computer.layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)
xf86addListItem((GenericListPtr)computer.layout->lay_adjacency_lst,
(GenericListPtr)adj);
computer.screens = (xf86cfgScreen**)
XtRealloc((XtPointer)computer.screens, sizeof(xf86cfgScreen*) *
(computer.num_screens + 1));
computer.screens[computer.num_screens] =
(xf86cfgScreen*)XtCalloc(1, sizeof(xf86cfgScreen));
computer.screens[computer.num_screens]->screen = screen;
computer.screens[computer.num_screens]->card = dev;
computer.screens[computer.num_screens]->monitor = mon;
++dev->refcount;
++mon->refcount;
CreateScreenWidget(computer.screens[computer.num_screens]);
computer.screens[computer.num_screens]->type = SCREEN;
SetTip((xf86cfgDevice*)computer.screens[computer.num_screens]);
++computer.num_screens;
}
void
RemoveScreen(xf86cfgDevice *mon, xf86cfgDevice *dev)
{
XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
int i;
mon->state = dev->state = UNUSED;
while (screen != NULL) {
if ((XtPointer)screen->scrn_monitor == mon->config &&
(XtPointer)screen->scrn_device == dev->config)
break;
screen = (XF86ConfScreenPtr)(screen->list.next);
}
--mon->refcount;
--dev->refcount;
for (i = 0; i < computer.num_screens; i++) {
if (computer.screens[i]->screen == screen) {
XtDestroyWidget(computer.screens[i]->widget);
if (i < --computer.num_screens)
memmove(&computer.screens[i], &computer.screens[i + 1],
(computer.num_screens - i) * sizeof(xf86cfgScreen*));
break;
}
}
xf86removeScreen(XF86Config, screen);
}
void
ChangeScreen(XF86ConfMonitorPtr mon, XF86ConfMonitorPtr oldmon,
XF86ConfDevicePtr dev, XF86ConfDevicePtr olddev)
{
int ioldm, im, ioldc, ic;
if (mon == oldmon && dev == olddev)
return;
if (mon != NULL) {
for (im = 0; im < computer.num_devices; im++)
if (computer.devices[im]->config == (XtPointer)mon)
break;
}
else
im = -1;
if (oldmon != NULL) {
for (ioldm = 0; ioldm < computer.num_devices; ioldm++)
if (computer.devices[ioldm]->config == (XtPointer)oldmon)
break;
}
else
ioldm = -1;
if (dev != NULL) {
for (ic = 0; ic < computer.num_devices; ic++)
if (computer.devices[ic]->config == (XtPointer)dev)
break;
}
else
ic = -1;
if (olddev != NULL) {
for (ioldc = 0; ioldc < computer.num_devices; ioldc++)
if (computer.devices[ioldc]->config == (XtPointer)olddev)
break;
}
else
ioldc = -1;
if (ioldm >= 0 && ioldc >= 0) {
RemoveScreen(computer.devices[ioldm], computer.devices[ioldc]);
computer.devices[ioldm]->state = UNUSED;
/* computer.devices[ioldc]->state = UNUSED;*/
}
if (im >= 0 && ic >= 0) {
AddScreen(computer.devices[im], computer.devices[ic]);
computer.devices[im]->state = USED;
/* computer.devices[ic]->state = USED;*/
}
}
/*
+------------------------------------------------+
| |
| +------------------------------------------+ |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| +------------------------------------------+ |
| |
+------------------------------------------------+
| |
+-------+ +-------+
| |
+----------------------------------------+
*/
static double oxs = 0.0, oys = 0.0, oxe = 100.0, oye = 70.0;
static double ixs = 7.0, iys = 7.0, ixe = 93.0, iye = 63.0;
static double lin[] = { 25.0, 70.0, 25.0, 75.0, 5.0, 75.0, 5.0, 80.0,
95.0, 80.0, 95.0, 75.0, 75.0, 75.0, 75.0, 70.0 };
void
DrawScreen(Display *dpy, Drawable win, int xs, int ys, int xe, int ye,
Bool active, int rotate)
{
double xfact, yfact;
XPoint points[(sizeof(lin) / sizeof(lin[0])) >> 1];
int i;
static GC gray0, gray1, gray2, black, red;
if (black == NULL) {
XColor color, exact;
XGCValues values;
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray95",
&color, &exact);
values.foreground = color.pixel;
gray0 = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray75",
&color, &exact);
values.foreground = color.pixel;
gray1 = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray60",
&color, &exact);
values.foreground = color.pixel;
gray2 = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray20",
&color, &exact);
values.foreground = color.pixel;
black = XCreateGC(XtDisplay(toplevel), win, GCForeground, &values);
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "red",
&color, &exact);
values.foreground = color.pixel;
values.line_width = 4;
values.cap_style = CapButt;
red = XCreateGC(XtDisplay(toplevel), win,
GCForeground | GCLineWidth | GCCapStyle, &values);
}
if (rotate) {
xfact = (xe - xs) / 80.0;
yfact = (ye - ys) / 100.0;
if (rotate == CW) {
/* outer rectangle */
XFillRectangle(dpy, win, gray1,
oxs * xfact + xs + .5,
oys * yfact + ys + .5,
(oye - oys) * xfact + .5,
(oxe - oxs) * yfact + .5);
XDrawLine(dpy, win, gray2,
xs, ye - 1,
70 * xfact + xs - 1 + .5, ye - 1);
XDrawLine(dpy, win, gray2,
70 * xfact + xs - 1 + .5, ye - 1,
70 * xfact + xs - 1 + .5, ys);
/* inner rectangle */
XFillRectangle(dpy, win, black,
ixs * xfact + xs + .5,
iys * yfact + ys + .5,
(iye - iys) * xfact + .5,
(ixe - ixs) * yfact + .5);
for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
points[i].x = lin[(i<<1) + 1] * xfact + xs + .5;
points[i].y = lin[(i<<1)] * yfact + ys + .5;
}
XFillPolygon(dpy, win, gray2, points, i, Convex, CoordModeOrigin);
XDrawLine(dpy, win, gray0,
(oxe - 10) * xfact + xs + .5, oys * yfact + ys + .5,
xs, oys * yfact + ys + .5);
XDrawLine(dpy, win, gray0,
xs, ys,
xs, xe);
XDrawLine(dpy, win, black,
lin[7] * xfact + xs - 1 + .5, lin[6] * yfact + ys + .5,
lin[9] * xfact + xs - 1 + .5, lin[8] * yfact + ys - 1 + .5);
XDrawLine(dpy, win, black,
lin[9] * xfact + xs - 1 + .5, lin[8] * yfact + ys - 1 + .5,
lin[11] * xfact + xs + .5, lin[10] * yfact + ys - 1 + .5);
XDrawLine(dpy, win, black,
lin[13] * xfact + xs + .5, lin[12] * yfact + ys - 1 + .5,
lin[15] * xfact + xs + .5, lin[14] * yfact + ys - 1 + .5);
if (!active) {
XDrawLine(dpy, win, red,
iys * xfact, ixs * yfact, iye * xfact, ixe * yfact);
XDrawLine(dpy, win, red,
iye * xfact, ixs * yfact, iys * xfact, ixe * yfact);
}
}
else if (rotate == CCW) {
/* outer rectangle */
XFillRectangle(dpy, win, gray1,
10 * xfact + xs + .5,
oys * yfact + ys + .5,
(oye - oys) * xfact + .5,
(oxe - oxs) * yfact + .5);
XDrawLine(dpy, win, gray2,
10 * xfact + xs + .5, ye - 1,
oxe * xfact + xs - 1 + .5, ye - 1);
XDrawLine(dpy, win, gray2,
xe - 1, ye - 1,
xe - 1, ys);
/* inner rectangle */
XFillRectangle(dpy, win, black,
(ixs + 10) * xfact + xs + .5,
iys * yfact + ys + .5,
(iye - iys) * xfact + .5,
(ixe - ixs) * yfact + .5);
for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
points[i].x = (-lin[(i<<1) + 1] + 80.0) * xfact + xs + .5;
points[i].y = lin[(i<<1)] * yfact + ys + .5;
}
XFillPolygon(dpy, win, gray2, points, i, Convex, CoordModeOrigin);
XDrawLine(dpy, win, gray0,
oxe * xfact + xs + .5, oys * yfact + ys + .5,
(oxs - 10) * xfact + xs + .5, oys * yfact + ys + .5);
XDrawLine(dpy, win, gray0,
(oxs + 10) * xfact + xs + .5, ys,
(oxs + 10) * xfact + xs + .5, xe);
XDrawLine(dpy, win, black,
xs, lin[8] * yfact - 1 + ys + .5,
4 * xfact + xs + .5, lin[8] * yfact - 1 + ys + .5);
XDrawLine(dpy, win, black,
4 * xfact + xs, lin[8] * yfact - 1 + ys + .5,
4 * xfact + xs, lin[3] * yfact - 1 + ys + .5);
XDrawLine(dpy, win, black,
4 * xfact + xs + .5, lin[3] * yfact - 1 + ys + .5,
10 * xfact + xs + .5 - 1, lin[3] * yfact - 1 + ys + .5);
XDrawLine(dpy, win, black,
4 * xfact + xs, lin[0] * yfact - 1 + ys + .5,
4 * xfact + xs, lin[4] * yfact - 1 + ys + .5);
if (!active) {
XDrawLine(dpy, win, red,
(iys + 10) * xfact, ixs * yfact,
(iye + 10) * xfact, ixe * yfact);
XDrawLine(dpy, win, red,
(iye + 10) * xfact, ixs * yfact,
(iys + 10) * xfact, ixe * yfact);
}
}
}
else {
xfact = (xe - xs) / 100.0;
yfact = (ye - ys) / 80.0;
/* outer rectangle */
XFillRectangle(dpy, win, gray1,
oxs * xfact + xs + .5,
oys * yfact + ys + .5,
(oxe - oxs) * xfact + .5,
(oye - oys) * yfact + .5);
XDrawLine(dpy, win, gray2,
oxs * xfact + xs + .5, oye * yfact + ys - 1 + .5,
oxe * xfact + xs - 1 + .5, oye * yfact + ys - 1 + .5);
XDrawLine(dpy, win, gray2,
oxe * xfact + xs - 1 + .5, oys * yfact + ys + .5,
oxe * xfact + xs - 1 + .5, oye * yfact + ys - 1 + .5);
/* inner rectangle */
XFillRectangle(dpy, win, black,
ixs * xfact + xs + .5,
iys * yfact + ys + .5,
(ixe - ixs) * xfact + .5,
(iye - iys) * yfact + .5);
for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
points[i].x = lin[i<<1] * xfact + xs + .5;
points[i].y = lin[(i<<1) + 1] * yfact + ys + .5;
}
XFillPolygon(dpy, win, gray2, points, i, Convex, CoordModeOrigin);
XDrawLine(dpy, win, black,
lin[6] * xfact + xs + .5, lin[7] * yfact + ys - 1 + .5,
lin[8] * xfact + xs - 1 + .5, lin[9] * yfact + ys - 1 + .5);
XDrawLine(dpy, win, black,
lin[8] * xfact + xs - 1 + .5, lin[9] * yfact + ys - 1 + .5,
lin[10] * xfact + xs - 1 + .5, lin[11] * yfact + ys + .5);
XDrawLine(dpy, win, black,
lin[12] * xfact + xs - 1 + .5, lin[13] * yfact + ys + .5,
lin[14] * xfact + xs - 1 + .5, lin[15] * yfact + ys + .5);
XDrawLine(dpy, win, gray0,
oxe * xfact + xs + .5, oys * yfact + ys + .5,
oxs * xfact + xs + .5, oys * yfact + ys + .5);
XDrawLine(dpy, win, gray0,
oxs * xfact + xs + .5, oys * yfact + ys + .5,
oxs * xfact + xs + .5, lin[1] * yfact + ys + .5);
if (!active) {
XDrawLine(dpy, win, red,
ixs * xfact, iys * yfact, ixe * xfact, iye * yfact);
XDrawLine(dpy, win, red,
ixe * xfact, iys * yfact, ixs * xfact, iye * yfact);
}
}
}
void
DrawScreenMask(Display *dpy, Drawable win, GC gc, int xs, int ys, int xe, int ye,
int rotate)
{
double xfact, yfact;
XPoint points[(sizeof(lin) / sizeof(lin[0])) >> 1];
int i = 0, x = 0, y = 0, width, height;
if (rotate) {
xfact = (xe - xs) / 80.0;
yfact = (ye - ys) / 100.0;
width = (oye - oys) * xfact + .5;
height = (oxe - oxs) * yfact + .5;
if (rotate == CW) {
x = oxs * xfact + xs + .5;
y = oys * yfact + ys + .5;
for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
points[i].x = lin[(i<<1) + 1] * xfact + xs + .5;
points[i].y = lin[(i<<1)] * yfact + ys + .5;
}
}
else if (rotate == CCW) {
x = 10 * xfact + xs + .5;
y = oys * yfact + ys + .5;
for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
points[i].x = (-lin[(i<<1) + 1] + 80.0) * xfact + xs + .5;
points[i].y = lin[(i<<1)] * yfact + ys + .5;
}
}
}
else {
xfact = (xe - xs) / 100.0;
yfact = (ye - ys) / 80.0;
x = oxs * xfact + xs + .5;
y = oys * yfact + ys + .5;
width = (oxe - oxs) * xfact + .5;
height = (oye - oys) * yfact + .5;
for (i = 0; i < sizeof(points) / sizeof(points[0]); i++) {
points[i].x = lin[(i<<1)] * xfact + xs + .5;
points[i].y = lin[(i<<1) + 1] * yfact + ys + .5;
}
}
/* rectangle */
XFillRectangle(dpy, win, gc, x, y, width, height);
XFillPolygon(dpy, win, gc, points, i, Convex, CoordModeOrigin);
}
void
AdjustScreenUI(void)
{
XF86ConfLayoutPtr lay = computer.layout;
XF86ConfAdjacencyPtr adj;
int i, dx, dy, x, y, w, h, base = -1;
double xf, yf;
if (lay == NULL)
return;
adj = lay->lay_adjacency_lst;
#define USED1 -USED
XtFree((XtPointer)mon_widths);
XtFree((XtPointer)mon_heights);
mon_widths = (int*)XtCalloc(1, sizeof(int) * columns);
mon_heights = (int*)XtCalloc(1, sizeof(int) * rows);
mon_width = mon_height = 0;
for (i = 0; i < computer.num_screens; i++) {
if (base == -1 && computer.screens[i]->state == USED)
base = i;
if (computer.screens[i]->screen->scrn_monitor->mon_width > mon_width)
mon_width = computer.screens[i]->screen->scrn_monitor->mon_width;
if (computer.screens[i]->screen->scrn_monitor->mon_height > mon_height)
mon_height = computer.screens[i]->screen->scrn_monitor->mon_height;
}
if (base < 0) {
for (i = 0; i < computer.num_screens; i++)
ReshapeScreenWidget(computer.screens[i]);
return;
}
if (mon_width == 0) {
mon_width = 10;
mon_height = 8;
}
XtUnmapWidget(work);
while (adj) {
xf86cfgScreen *scr = NULL,
*topscr = NULL, *botscr = NULL, *lefscr = NULL, *rigscr = NULL;
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_screen)
break;
if (i < computer.num_screens)
scr = computer.screens[i];
if (adj->adj_top != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_top)
break;
if (i < computer.num_screens)
topscr = computer.screens[i];
}
if (adj->adj_bottom != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_bottom)
break;
if (i < computer.num_screens)
botscr = computer.screens[i];
}
if (adj->adj_left != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_left)
break;
if (i < computer.num_screens)
lefscr = computer.screens[i];
}
if (adj->adj_right != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_right)
break;
if (i < computer.num_screens)
rigscr = computer.screens[i];
}
if (lefscr == NULL && rigscr == NULL && topscr == NULL && lefscr == NULL) {
XF86ConfScreenPtr s;
if (adj->adj_where >= CONF_ADJ_RIGHTOF && adj->adj_where <= CONF_ADJ_BELOW) {
s = xf86findScreen(adj->adj_refscreen, XF86Config->conf_screen_lst);
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == s)
break;
if (i < computer.num_screens) {
switch (adj->adj_where) {
case CONF_ADJ_RIGHTOF:
lefscr = computer.screens[i];
break;
case CONF_ADJ_LEFTOF:
rigscr = computer.screens[i];
break;
case CONF_ADJ_ABOVE:
botscr = computer.screens[i];
break;
case CONF_ADJ_BELOW:
topscr = computer.screens[i];
break;
}
}
}
}
XtMoveWidget(scr->widget, 0, 0);
scr->state = USED1;
if (lefscr != NULL) {
if (lefscr->state == USED1)
XtMoveWidget(scr->widget,
lefscr->widget->core.x + lefscr->widget->core.width,
lefscr->widget->core.y);
else
XtMoveWidget(lefscr->widget,
-(int)(lefscr->widget->core.width),
scr->widget->core.y);
}
if (rigscr != NULL) {
if (rigscr->state == USED1) {
dx = rigscr->widget->core.x - scr->widget->core.width - scr->widget->core.x;
dy = rigscr->widget->core.y - scr->widget->core.y;
XtMoveWidget(scr->widget, scr->widget->core.x + dx,
scr->widget->core.y + dy);
if (lefscr != NULL && lefscr->state != USED1)
XtMoveWidget(lefscr->widget, lefscr->widget->core.x + dx,
lefscr->widget->core.y + dy);
}
else
XtMoveWidget(rigscr->widget, scr->widget->core.width,
scr->widget->core.y);
}
if (topscr != NULL) {
if (topscr->state == USED1) {
dx = topscr->widget->core.x - scr->widget->core.x;
dy = topscr->widget->core.y + topscr->widget->core.height -
scr->widget->core.y;
XtMoveWidget(scr->widget, scr->widget->core.x + dx,
scr->widget->core.y + dy);
if (lefscr != NULL && lefscr->state != USED1)
XtMoveWidget(lefscr->widget, lefscr->widget->core.x + dx,
lefscr->widget->core.y + dy);
if (rigscr != NULL && rigscr->state != USED1)
XtMoveWidget(rigscr->widget, rigscr->widget->core.x + dx,
rigscr->widget->core.y + dy);
}
else
XtMoveWidget(topscr->widget, scr->widget->core.x,
scr->widget->core.y - topscr->widget->core.height);
}
if (botscr != NULL) {
if (botscr->state == USED1) {
dx = botscr->widget->core.x - scr->widget->core.x;
dy = botscr->widget->core.y - scr->widget->core.height - scr->widget->core.y;
XtMoveWidget(scr->widget, scr->widget->core.x + dx,
scr->widget->core.y + dy);
if (lefscr != NULL && lefscr->state != USED1)
XtMoveWidget(lefscr->widget, lefscr->widget->core.x + dx,
lefscr->widget->core.y + dy);
if (rigscr != NULL && rigscr->state != USED1)
XtMoveWidget(rigscr->widget, rigscr->widget->core.x + dx,
rigscr->widget->core.y + dy);
if (botscr != NULL && botscr->state != USED1)
XtMoveWidget(botscr->widget, botscr->widget->core.x + dx,
botscr->widget->core.y + dy);
}
else
XtMoveWidget(botscr->widget, scr->widget->core.x,
scr->widget->core.y + scr->widget->core.height);
}
adj = (XF86ConfAdjacencyPtr)(adj->list.next);
}
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->state == USED1)
computer.screens[i]->state = USED;
else
XLowerWindow(XtDisplay(computer.screens[i]->widget),
XtWindow(computer.screens[i]->widget));
w = work->core.width / (columns + 1) - 5;
h = work->core.height / (rows + 1) - 5;
if (w > h)
w = h;
else
h = w;
dx = (work->core.width - (columns * w)) >> 1;
dy = (work->core.height - (rows * h)) >> 1;
xf = (double)w / (double)computer.screens[0]->widget->core.width;
yf = (double)h / (double)computer.screens[0]->widget->core.height;
for (i = 0; i < computer.num_screens; i++) {
Widget z = computer.screens[i]->widget;
if (computer.screens[i]->state == USED)
XtConfigureWidget(z, z->core.x * xf + dx,
z->core.y * yf + dy, w, h, 0);
else
XtConfigureWidget(z, z->core.x, z->core.y, w, h, 0);
}
if (computer.screens[base]->row >= 0) {
double xf, yf;
int width, height;
for (i = 0; i < computer.num_screens; i++) {
width = computer.screens[i]->screen->scrn_monitor->mon_width;
height = computer.screens[i]->screen->scrn_monitor->mon_height;
if (width <= 0) {
width = mon_width;
height = mon_height;
}
if (computer.screens[i]->rotate) {
xf = (double)width / (double)mon_width * 8. / 10.;
yf = (double)height / (double)mon_height;
}
else {
xf = (double)width / (double)mon_width;
yf = (double)height / (double)mon_height * 8. / 10.;
}
width = computer.screens[i]->widget->core.width * xf;
height = computer.screens[i]->widget->core.height * yf;
if (computer.screens[i]->state == USED) {
if (mon_widths[computer.screens[i]->column] < width)
mon_widths[computer.screens[i]->column] = width;
if (mon_heights[computer.screens[i]->row] < height)
mon_heights[computer.screens[i]->row] = height;
}
/* do it here to avoid recalculation */
computer.screens[i]->rect.width = width;
computer.screens[i]->rect.height = height;
}
}
for (i = 0; i < computer.num_screens; i++)
ReshapeScreenWidget(computer.screens[i]);
/* do a new pass, to avoid gaps if the monitors have different
* sizes.
*/
if (computer.screens[base]->row >= 0) {
x = computer.screens[base]->widget->core.x;
y = computer.screens[base]->widget->core.y;
/* screens representations are already ordered */
for (i = base; i < computer.num_screens; i++) {
if (computer.screens[i]->state == UNUSED)
continue;
if (computer.screens[i]->column != 0)
x += mon_widths[computer.screens[i]->column];
else {
x = computer.screens[base]->widget->core.x;
if (i != base)
y += mon_heights[computer.screens[i]->row];
}
XtMoveWidget(computer.screens[i]->widget, x, y);
}
}
XtMapWidget(work);
}
static int
qcmp_screen(_Xconst void *a, _Xconst void *b)
{
xf86cfgScreen *s1, *s2;
s1 = *(xf86cfgScreen**)a;
s2 = *(xf86cfgScreen**)b;
if (s1->widget->core.x > s2->widget->core.x) {
if (s2->widget->core.y >=
s1->widget->core.y + (s1->widget->core.height >> 1))
return (-1);
return (1);
}
else {
if (s1->widget->core.y >=
s2->widget->core.y + (s2->widget->core.height >> 1))
return (1);
return (-1);
}
/*NOTREACHED*/
}
void
UpdateScreenUI(void)
{
XF86ConfLayoutPtr lay = computer.layout;
XF86ConfAdjacencyPtr adj, prev, left, base;
int i, p, cols, scrno;
if (lay == NULL)
return;
rows = columns = cols = 1;
qsort(computer.screens, computer.num_screens, sizeof(xf86cfgScreen*),
qcmp_screen);
adj = prev = left = base = NULL;
for (i = p = scrno = 0; i < computer.num_screens; i++) {
XF86ConfScreenPtr scr = computer.screens[i]->screen;
if (computer.screens[i]->state == UNUSED)
continue;
adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec));
adj->adj_scrnum = scrno++;
adj->adj_screen = scr;
adj->adj_screen_str = XtNewString(scr->scrn_identifier);
if (base == NULL) {
base = left = adj;
computer.screens[i]->row = computer.screens[i]->column = 0;
}
else {
int dy = computer.screens[i]->widget->core.y -
computer.screens[p]->widget->core.y;
prev->list.next = adj;
if (dy > (computer.screens[i]->widget->core.height >> 1)) {
adj->adj_where = CONF_ADJ_BELOW;
adj->adj_refscreen = XtNewString(left->adj_screen_str);
left = adj;
computer.screens[i]->row = rows;
computer.screens[i]->column = 0;
cols = 1;
++rows;
}
else {
computer.screens[i]->row = rows - 1;
computer.screens[i]->column = cols;
adj->adj_where = CONF_ADJ_RIGHTOF;
if (++cols > columns)
columns = cols;
adj->adj_refscreen = XtNewString(prev->adj_screen_str);
}
}
prev = adj;
p = i;
}
adj = lay->lay_adjacency_lst;
while (adj != NULL) {
prev = adj;
adj = (XF86ConfAdjacencyPtr)(adj->list.next);
XtFree(prev->adj_screen_str);
XtFree(prev->adj_right_str);
XtFree(prev->adj_left_str);
XtFree(prev->adj_top_str);
XtFree(prev->adj_bottom_str);
XtFree(prev->adj_refscreen);
XtFree((char*)prev);
}
lay->lay_adjacency_lst = base;
}

View File

@ -1,51 +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 "config.h"
#ifndef _xf86cfg_screen_h
#define _xf86cfg_screen_h
/*
* Prototypes
*/
void AddScreen(xf86cfgDevice*, xf86cfgDevice*);
void RemoveScreen(xf86cfgDevice*, xf86cfgDevice*);
void DrawScreen(Display*, Drawable, int, int, int, int, Bool, int);
void DrawScreenMask(Display*, Drawable, GC, int, int, int, int, int);
void CreateScreenWidget(xf86cfgScreen*);
void SetScreenRotate(xf86cfgScreen*);
void AdjustScreenUI(void);
void UpdateScreenUI(void);
#endif /* _xf86cfg_screen_h */

View File

@ -1,8 +0,0 @@
#define shorter_width 19
#define shorter_height 19
static unsigned char shorter_bits[] = {
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, 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00,
0xe0, 0x3f, 0x00, 0xf0, 0x7f, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01,
0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00};

View File

@ -1,141 +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>
/*
* Initialization
*/
static int xpid;
Display *DPY;
/*
* Implementation
*/
Bool
startx(void)
{
int timeout = 8;
if (getenv("DISPLAY") != NULL)
/* already running Xserver */
return (False);
if (XF86Config_path == NULL) {
char *home, filename[PATH_MAX];
char commandline[PATH_MAX * 4];
int c_pos;
int len;
/*
* The name of the 4.0 binary is XFree86. X might also
* be the name of the 3.3 binary. Therefore don't change
* name to 'X'.
*/
if (XFree86_path)
c_pos = XmuSnprintf(commandline, sizeof(commandline),
"%s/"__XSERVERNAME__" :8 -configure ",XFree86_path);
else
c_pos = XmuSnprintf(commandline, sizeof(commandline),
"%s/bin/"__XSERVERNAME__" :8 -configure ", XFree86Dir);
if (XF86Module_path && ((len = sizeof(commandline) - c_pos) > 0))
c_pos += XmuSnprintf(commandline + c_pos,len,
" -modulepath %s",XF86Module_path);
if (XF86Font_path && ((len = sizeof(commandline) - c_pos) > 0))
c_pos += XmuSnprintf(commandline + c_pos,len,
" -fontpath %s",XF86Font_path);
if (system(commandline) != 0) {
fprintf(stderr, "Failed to run \"X -configure\".\n");
exit(1);
}
if ((home = getenv("HOME")) == NULL)
home = "/";
XmuSnprintf(filename, sizeof(filename), "%s/"__XCONFIGFILE__".new", home);
/* this memory is never released, even if the value of XF86Config_path is
* changed.
*/
XF86Config_path = XtNewString(filename);
}
putenv("DISPLAY=:8");
switch (xpid = fork()) {
case 0: {
char path[PATH_MAX];
/* Don't change to X! see above */
if (XFree86_path)
XmuSnprintf(path, sizeof(path), "%s/"__XSERVERNAME__, XFree86_path);
else
XmuSnprintf(path, sizeof(path), "%s/bin/"__XSERVERNAME__, XFree86Dir);
execl(path, "X", ":8", /*"+xinerama",*/ "+accessx","-allowMouseOpenFail",
"-xf86config", XF86Config_path, (void *)NULL);
exit(-127);
} break;
case -1:
fprintf(stderr, "Cannot fork.\n");
exit(1);
break;
default:
break;
}
while (timeout > 0) {
int status;
sleep(timeout -= 2);
if (waitpid(xpid, &status, WNOHANG | WUNTRACED) == xpid)
break;
else {
DPY = XOpenDisplay(NULL);
if (DPY != NULL)
break;
}
}
if (DPY == NULL) {
fprintf(stderr, "Cannot connect to X server.\n");
exit(1);
}
return (True);
}
void
endx(void)
{
if (xpid != 0)
kill(xpid, SIGTERM);
}

View File

@ -1,65 +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 <string.h>
#include "stubs.h"
/*
* Implementation
*/
#if !defined(USE_MODULES)
/* these are defined in libdummy.a */
int
ErrorF(const char *fmt, ...)
{
int retval;
va_list ap;
va_start(ap, fmt);
retval = vfprintf(stderr, fmt, ap);
va_end(ap);
return (retval);
}
int
VErrorF(const char *fmt, va_list ap)
{
int retval;
retval = vfprintf(stderr, fmt, ap);
return (retval);
}
#endif /* !defined(USE_MODULES) */

View File

@ -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>
*
*/
#ifndef _xf86cfg_stubs_h
#define _xf86cfg_stubs_h
#include <stdarg.h>
int ErrorF(const char*, ...);
int VErrorF(const char*, va_list);
#if defined(USE_MODULES)
extern int xf86Verbose;
#endif
#endif /* _xf86cfg_stubs_h */

View File

@ -1,8 +0,0 @@
#define taller_width 19
#define taller_height 19
static unsigned char taller_bits[] = {
0x00, 0x02, 0x00, 0x00, 0x07, 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00,
0xe0, 0x3f, 0x00, 0xf0, 0x7f, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01,
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};

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +0,0 @@
#define up_width 19
#define up_height 19
static unsigned char up_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00,
0x00, 0x07, 0x00, 0x80, 0x0f, 0x00, 0xc0, 0x1f, 0x00, 0xe0, 0x3f, 0x00,
0xf0, 0x7f, 0x00, 0xf8, 0xff, 0x00, 0xfc, 0xff, 0x01, 0x80, 0x0f, 0x00,
0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x80, 0x0f, 0x00,
0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

File diff suppressed because it is too large Load Diff

View File

@ -1,63 +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>
*
*/
#ifndef _xf86cfg_vidmode_h
#define _xf86cfg_vidmode_h
#include "xf86config.h"
#include <X11/extensions/xf86vmode.h>
/*
* Types
*/
struct _xf86cfgVidMode {
XF86ConfMonitorPtr monitor;
int screen;
int num_infos;
XF86VidModeModeInfo **infos;
};
/*
* Prototypes
*/
Bool VideoModeInitialize(void);
void VideoModeConfigureStart(void);
void VideoModeConfigureEnd(void);
void VidmodeRestoreAction(Widget, XEvent*, String*, Cardinal*);
void CancelAddModeAction(Widget, XEvent*, String*, Cardinal*);
void CancelTestModeAction(Widget, XEvent*, String*, Cardinal*);
void InitializeVidmodes(void);
/*
* Initialization
*/
extern Widget vtune;
#endif /* _xf86cfg_vidmode_h */

View File

@ -1,8 +0,0 @@
#define wider_width 19
#define wider_height 19
static unsigned char wider_bits[] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x08, 0x00, 0xc0, 0x18, 0x00,
0xe0, 0x38, 0x00, 0xf0, 0x78, 0x00, 0xf8, 0xf8, 0x00, 0xfc, 0xff, 0x01,
0xfe, 0xff, 0x03, 0xff, 0xff, 0x07, 0xfe, 0xff, 0x03, 0xfc, 0xff, 0x01,
0xf8, 0xf8, 0x00, 0xf0, 0x78, 0x00, 0xe0, 0x38, 0x00, 0xc0, 0x18, 0x00,
0x80, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};

View File

@ -1,982 +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"
/*
* Implementation
*/
int
xf86removeOption(XF86OptionPtr *options, char *name)
{
XF86OptionPtr opt = *options, prev = opt;
while (opt) {
if (strcasecmp(opt->opt_name, name) == 0) {
XtFree(opt->opt_name);
XtFree(opt->opt_val);
XtFree(opt->opt_comment);
if (opt == prev)
*options = (XF86OptionPtr)(opt->list.next);
else
prev->list.next = opt->list.next;
XtFree((XtPointer)opt);
return (True);
}
prev = opt;
opt = (XF86OptionPtr)(opt->list.next);
}
return (False);
}
int
xf86removeInput(XF86ConfigPtr config, XF86ConfInputPtr input)
{
XF86ConfInputPtr prev, inp = config->conf_input_lst;
XF86ConfLayoutPtr lay = config->conf_layout_lst;
/* remove from main structure */
prev = inp;
while (inp != NULL) {
if (inp == input) {
if (inp == prev)
config->conf_input_lst = (XF86ConfInputPtr)(inp->list.next);
else
prev->list.next = inp->list.next;
break;
}
prev = inp;
inp = (XF86ConfInputPtr)(inp->list.next);
}
if (inp == NULL)
return (False);
/* remove references */
while (lay != NULL) {
xf86removeInputRef(lay, inp);
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
XtFree(inp->inp_identifier);
XtFree(inp->inp_driver);
XtFree(inp->inp_comment);
xf86optionListFree(inp->inp_option_lst);
XtFree((XtPointer)inp);
return (True);
}
int
xf86removeInputRef(XF86ConfLayoutPtr layout, XF86ConfInputPtr input)
{
XF86ConfInputrefPtr prev, iref = layout->lay_input_lst;
prev = iref;
while (iref != NULL) {
if (iref->iref_inputdev == input) {
XtFree(iref->iref_inputdev_str);
xf86optionListFree(iref->iref_option_lst);
if (prev == iref)
layout->lay_input_lst =
(XF86ConfInputrefPtr)(iref->list.next);
else
prev->list.next = iref->list.next;
XtFree((XtPointer)iref);
return (True);
}
prev = iref;
iref = (XF86ConfInputrefPtr)(iref->list.next);
}
return (False);
}
int
xf86removeDevice(XF86ConfigPtr config, XF86ConfDevicePtr device)
{
XF86ConfDevicePtr prev, dev = config->conf_device_lst;
XF86ConfScreenPtr psc, scr = config->conf_screen_lst;
/* remove from main structure */
prev = dev;
while (dev != NULL) {
if (dev == device) {
if (dev == prev)
config->conf_device_lst = (XF86ConfDevicePtr)(dev->list.next);
else
prev->list.next = dev->list.next;
break;
}
prev = dev;
dev = (XF86ConfDevicePtr)(dev->list.next);
}
if (dev == NULL)
return (False);
/* remove references */
psc = scr;
while (scr != NULL) {
if (scr->scrn_device == device) {
xf86removeScreen(config, scr);
if (scr == psc)
scr = psc = config->conf_screen_lst;
else
scr = psc;
continue;
}
psc = scr;
scr = (XF86ConfScreenPtr)(scr->list.next);
}
XtFree(dev->dev_identifier);
XtFree(dev->dev_vendor);
XtFree(dev->dev_board);
XtFree(dev->dev_chipset);
XtFree(dev->dev_busid);
XtFree(dev->dev_card);
XtFree(dev->dev_driver);
XtFree(dev->dev_ramdac);
XtFree(dev->dev_clockchip);
XtFree(dev->dev_comment);
xf86optionListFree(dev->dev_option_lst);
XtFree((XtPointer)dev);
return (True);
}
int
xf86removeMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr monitor)
{
XF86ConfMonitorPtr prev, mon = config->conf_monitor_lst;
XF86ConfScreenPtr psc, scr = config->conf_screen_lst;
/* remove from main structure */
prev = mon;
while (mon != NULL) {
if (mon == monitor) {
if (mon == prev)
config->conf_monitor_lst = (XF86ConfMonitorPtr)(mon->list.next);
else
prev->list.next = mon->list.next;
break;
}
prev = mon;
mon = (XF86ConfMonitorPtr)(mon->list.next);
}
if (mon == NULL)
return (False);
/* remove references */
psc = scr;
while (scr != NULL) {
if (scr->scrn_monitor == monitor) {
xf86removeScreen(config, scr);
if (scr == psc)
scr = psc = config->conf_screen_lst;
else
scr = psc;
continue;
}
psc = scr;
scr = (XF86ConfScreenPtr)(scr->list.next);
}
XtFree(mon->mon_identifier);
XtFree(mon->mon_vendor);
XtFree(mon->mon_modelname);
XtFree(mon->mon_comment);
xf86optionListFree(mon->mon_option_lst);
XtFree((XtPointer)mon);
return (True);
}
int
xf86removeScreen(XF86ConfigPtr config, XF86ConfScreenPtr screen)
{
XF86ConfScreenPtr prev, scrn;
XF86ConfLayoutPtr lay;
if (config == NULL || screen == NULL)
return (False);
lay = config->conf_layout_lst;
prev = scrn = config->conf_screen_lst;
while (scrn != NULL) {
if (scrn == screen) {
if (scrn == prev)
config->conf_screen_lst = (XF86ConfScreenPtr)(scrn->list.next);
else
prev->list.next = scrn->list.next;
break;
}
prev = scrn;
scrn = (XF86ConfScreenPtr)(scrn->list.next);
}
if (scrn == NULL)
return (False);
while (lay != NULL) {
XF86ConfAdjacencyPtr pad, ad = NULL, adj = lay->lay_adjacency_lst;
pad = adj;
while (adj) {
if (adj->adj_screen == screen)
ad = adj;
else {
if (adj->adj_top != NULL && adj->adj_top == screen) {
XtFree(adj->adj_top_str);
adj->adj_top_str = NULL;
adj->adj_top = NULL;
}
else if (adj->adj_bottom != NULL && adj->adj_bottom == screen) {
XtFree(adj->adj_bottom_str);
adj->adj_bottom_str = NULL;
adj->adj_bottom = NULL;
}
else if (adj->adj_left != NULL && adj->adj_left == screen) {
XtFree(adj->adj_left_str);
adj->adj_left_str = NULL;
adj->adj_left = NULL;
}
else if (adj->adj_right != NULL && adj->adj_right == screen) {
XtFree(adj->adj_right_str);
adj->adj_right_str = NULL;
adj->adj_right = NULL;
}
else if (adj->adj_refscreen != NULL &&
strcasecmp(scrn->scrn_identifier,
adj->adj_refscreen) == 0) {
XtFree(adj->adj_refscreen);
adj->adj_refscreen = NULL;
adj->adj_where = CONF_ADJ_ABSOLUTE;
adj->adj_x = adj->adj_y = 0;
}
}
if (ad == NULL)
pad = adj;
adj = (XF86ConfAdjacencyPtr)(adj->list.next);
}
if (ad != NULL) {
if (ad == lay->lay_adjacency_lst)
lay->lay_adjacency_lst = (XF86ConfAdjacencyPtr)(ad->list.next);
else
pad->list.next = (XF86ConfAdjacencyPtr)(ad->list.next);
XtFree(ad->adj_screen_str);
XtFree(ad->adj_top_str);
XtFree(ad->adj_bottom_str);
XtFree(ad->adj_left_str);
XtFree(ad->adj_right_str);
XtFree(ad->adj_refscreen);
XtFree((XtPointer)ad);
}
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
xf86freeAdaptorLinkList(screen->scrn_adaptor_lst);
xf86freeDisplayList(screen->scrn_display_lst);
XtFree(screen->scrn_identifier);
XtFree(screen->scrn_monitor_str);
XtFree(screen->scrn_device_str);
xf86optionListFree(screen->scrn_option_lst);
XtFree((XtPointer)screen);
return (True);
}
int
xf86removeAdjacency(XF86ConfLayoutPtr layout, XF86ConfAdjacencyPtr adjacency)
{
XF86ConfAdjacencyPtr prev, adj = layout->lay_adjacency_lst;
if (layout == NULL || adjacency == NULL)
return (False);
prev = adj;
while (adj != NULL) {
if (adj == adjacency)
break;
prev = adj;
adj = (XF86ConfAdjacencyPtr)(adj->list.next);
}
if (adj == NULL)
return (False);
XtFree(adj->adj_screen_str);
XtFree(adj->adj_top_str);
XtFree(adj->adj_bottom_str);
XtFree(adj->adj_left_str);
XtFree(adj->adj_right_str);
XtFree(adj->adj_refscreen);
if (prev == adj)
layout->lay_adjacency_lst = (XF86ConfAdjacencyPtr)(adj->list.next);
else
prev->list.next = adj->list.next;
XtFree((XtPointer)adj);
return (True);
}
int
xf86removeInactive(XF86ConfLayoutPtr layout, XF86ConfInactivePtr inactive)
{
XF86ConfInactivePtr prev, inac = layout->lay_inactive_lst;
if (layout == NULL || inactive == NULL)
return (False);
prev = inac;
while (inac != NULL) {
if (inac == inactive)
break;
prev = inac;
inac = (XF86ConfInactivePtr)(inac->list.next);
}
if (inac == NULL)
return (False);
XtFree(inac->inactive_device_str);
if (prev == inac)
layout->lay_inactive_lst = (XF86ConfInactivePtr)(inac->list.next);
else
prev->list.next = inac->list.next;
XtFree((XtPointer)inac);
return (True);
}
int
xf86removeLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout)
{
XF86ConfLayoutPtr prev, lay = config->conf_layout_lst;
XF86ConfAdjacencyPtr adj, nadj;
XF86ConfInactivePtr inac, ninac;
XF86ConfInputrefPtr iref, niref;
if (config == NULL || layout == NULL)
return (False);
prev = lay;
while (lay != NULL) {
if (lay == layout)
break;
prev = lay;
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
if (lay == NULL)
return (False);
adj = lay->lay_adjacency_lst;
while (adj != NULL) {
nadj = (XF86ConfAdjacencyPtr)(adj->list.next);
xf86removeAdjacency(lay, adj);
adj = nadj;
}
inac = lay->lay_inactive_lst;
while (inac != NULL) {
ninac = (XF86ConfInactivePtr)(inac->list.next);
xf86removeInactive(lay, inac);
inac = ninac;
}
iref = lay->lay_input_lst;
while (iref != NULL) {
niref = (XF86ConfInputrefPtr)(iref->list.next);
xf86removeInputRef(lay, iref->iref_inputdev);
iref = niref;
}
xf86optionListFree(lay->lay_option_lst);
if (prev == lay)
config->conf_layout_lst = (XF86ConfLayoutPtr)(lay->list.next);
else
prev->list.next = lay->list.next;
XtFree(lay->lay_identifier);
XtFree((XtPointer)lay);
return (True);
}
int
xf86removeModule(XF86ConfigPtr config, XF86LoadPtr load)
{
XF86LoadPtr prev, mod;
if (config == NULL || config->conf_modules == NULL ||
config->conf_modules->mod_load_lst == NULL)
return (False);
for (mod = prev = config->conf_modules->mod_load_lst;
mod != NULL; prev = mod, mod = (XF86LoadPtr)(mod->list.next))
if (load == mod) {
if (mod == prev)
config->conf_modules->mod_load_lst =
(XF86LoadPtr)(mod->list.next);
else
prev->list.next = mod->list.next;
XtFree(mod->load_name);
xf86optionListFree(mod->load_opt);
return (True);
}
return (False);
}
int
xf86removeModes(XF86ConfigPtr config, XF86ConfModesPtr modes)
{
XF86ConfModesPtr mod;
XF86ConfModeLinePtr ml, next;
XF86ConfMonitorPtr mon;
if (config == NULL || modes == NULL)
return (False);
/* check if modes is in config */
if ((mod = config->conf_modes_lst) == modes)
config->conf_modes_lst = (XF86ConfModesPtr)(mod->list.next);
else
for (; mod != NULL; mod = (XF86ConfModesPtr)(mod->list.next))
if ((XF86ConfModesPtr)(mod->list.next) == modes) {
mod->list.next = modes->list.next;
break;
}
if (mod == NULL)
return (False);
/* remove references in monitor sections */
mon = config->conf_monitor_lst;
while (mon) {
XF86ConfModesLinkPtr m, p;
m = p = mon->mon_modes_sect_lst;
while (m) {
if (m->ml_modes == modes) {
XtFree(m->ml_modes_str);
if (m == mon->mon_modes_sect_lst)
p = mon->mon_modes_sect_lst =
(XF86ConfModesLinkPtr)(m->list.next);
else {
p->list.next = m->list.next;
p = p->list.next;
}
XtFree((XtPointer)m);
m = p;
continue;
}
p = m;
m = (XF86ConfModesLinkPtr)(m->list.next);
}
mon = (XF86ConfMonitorPtr)(mon->list.next);
}
/* free modelines */
ml = modes->mon_modeline_lst;
while (ml) {
next = (XF86ConfModeLinePtr)(ml->list.next);
XtFree(ml->ml_identifier);
XtFree((XtPointer)ml);
ml = next;
}
/* free mode */
XtFree(modes->modes_identifier);
XtFree((XtPointer)modes);
return (True);
}
int
xf86removeModesModeLine(XF86ConfModesPtr modes, XF86ConfModeLinePtr modeline)
{
XF86ConfModeLinePtr ml, prev;
if (modes == NULL || modeline == NULL || modes->mon_modeline_lst == NULL)
return (False);
for (ml = prev = modes->mon_modeline_lst; ml;
prev = ml, ml = (XF86ConfModeLinePtr)(ml->list.next))
if (ml == modeline) {
if (prev == ml)
modes->mon_modeline_lst = (XF86ConfModeLinePtr)(ml->list.next);
else
prev->list.next = ml->list.next;
XtFree(modeline->ml_identifier);
XtFree((XtPointer)modeline);
return (True);
}
return (False);
}
int
xf86removeMonitorModeLine(XF86ConfMonitorPtr monitor, XF86ConfModeLinePtr modeline)
{
XF86ConfModeLinePtr ml, prev;
if (monitor == NULL || modeline == NULL || monitor->mon_modeline_lst == NULL)
return (False);
for (ml = prev = monitor->mon_modeline_lst; ml;
prev = ml, ml = (XF86ConfModeLinePtr)(ml->list.next))
if (ml == modeline) {
if (prev == ml)
monitor->mon_modeline_lst = (XF86ConfModeLinePtr)(ml->list.next);
else
prev->list.next = ml->list.next;
XtFree(modeline->ml_identifier);
XtFree((XtPointer)modeline);
return (True);
}
return (False);
}
int
xf86removeMonitorModesLink(XF86ConfMonitorPtr monitor, XF86ConfModesLinkPtr link)
{
XF86ConfModesLinkPtr lnk, prev;
if (monitor == NULL || link == NULL || monitor->mon_modes_sect_lst == NULL)
return (False);
for (lnk = prev = monitor->mon_modes_sect_lst; lnk != NULL;
prev = lnk, lnk = (XF86ConfModesLinkPtr)(lnk->list.next))
if (lnk == link) {
if (prev == lnk)
monitor->mon_modes_sect_lst = (XF86ConfModesLinkPtr)(lnk->list.next);
else
prev->list.next = lnk->list.next;
XtFree(link->ml_modes_str);
XtFree((XtPointer)link);
return (True);
}
return (False);
}
int
xf86removeScreenAdaptorLink(XF86ConfScreenPtr scrn, XF86ConfAdaptorLinkPtr link)
{
XF86ConfAdaptorLinkPtr lnk, prev;
if (scrn == NULL || link == NULL || scrn->scrn_adaptor_lst == NULL)
return (False);
for (lnk = prev = scrn->scrn_adaptor_lst; lnk != NULL;
prev = lnk, lnk = (XF86ConfAdaptorLinkPtr)(lnk->list.next))
if (lnk == link) {
if (prev == lnk)
scrn->scrn_adaptor_lst =
(XF86ConfAdaptorLinkPtr)(lnk->list.next);
else
prev->list.next = lnk->list.next;
XtFree(link->al_adaptor_str);
XtFree((XtPointer)link);
return (True);
}
return (False);
}
int
xf86removeScreenDisplay(XF86ConfScreenPtr scrn, XF86ConfDisplayPtr display)
{
XF86ConfDisplayPtr dsp, prev;
if (scrn == NULL || display == NULL || scrn->scrn_display_lst == NULL)
return (False);
for (dsp = prev = scrn->scrn_display_lst; dsp != NULL;
prev = dsp, dsp = (XF86ConfDisplayPtr)(dsp->list.next))
if (dsp == display) {
if (prev == dsp)
scrn->scrn_display_lst =
(XF86ConfDisplayPtr)(dsp->list.next);
else
prev->list.next = dsp->list.next;
xf86optionListFree(display->disp_option_lst);
XtFree((XtPointer)display->disp_visual);
xf86freeModeList(display->disp_mode_lst);
XtFree((XtPointer)display);
return (True);
}
return (False);
}
int
xf86removeVideoAdaptor(XF86ConfigPtr config, XF86ConfVideoAdaptorPtr video)
{
XF86ConfVideoAdaptorPtr vid;
XF86ConfScreenPtr scrn;
XF86ConfVideoPortPtr vp, next;
if (config == NULL || video == NULL)
return (False);
/* check if video is in config and update videoadaptor list */
if ((vid = config->conf_videoadaptor_lst) == video)
config->conf_videoadaptor_lst = (XF86ConfVideoAdaptorPtr)(vid->list.next);
else
for (; vid != NULL; vid = (XF86ConfVideoAdaptorPtr)(vid->list.next))
if ((XF86ConfVideoAdaptorPtr)(vid->list.next) == video) {
vid->list.next = video->list.next;
break;
}
if (vid == NULL)
return (False);
/* remove references in screen sections */
scrn = config->conf_screen_lst;
while (scrn) {
XF86ConfAdaptorLinkPtr v, p;
v = p = scrn->scrn_adaptor_lst;
while (v) {
if (v->al_adaptor == video) {
XtFree(v->al_adaptor_str);
if (v == scrn->scrn_adaptor_lst)
p = scrn->scrn_adaptor_lst =
(XF86ConfAdaptorLinkPtr)(v->list.next);
else {
p->list.next = v->list.next;
p = p->list.next;
}
XtFree((XtPointer)v);
v = p;
continue;
}
p = v;
v = (XF86ConfAdaptorLinkPtr)(v->list.next);
}
scrn = (XF86ConfScreenPtr)(scrn->list.next);
}
/* free videoports */
vp = video->va_port_lst;
while (vp) {
next = (XF86ConfVideoPortPtr)(vp->list.next);
XtFree(vp->vp_identifier);
xf86optionListFree(vp->vp_option_lst);
XtFree((XtPointer)vp);
vp = next;
}
/* free videoadaptor */
XtFree(video->va_identifier);
XtFree(video->va_vendor);
XtFree(video->va_board);
XtFree(video->va_busid);
XtFree(video->va_driver);
XtFree(video->va_fwdref);
xf86optionListFree(video->va_option_lst);
XtFree((XtPointer)video);
return (True);
}
int
xf86removeVideoPort(XF86ConfVideoAdaptorPtr va, XF86ConfVideoPortPtr vp)
{
XF86ConfVideoPortPtr prev;
if (va == NULL || vp == NULL)
return (False);
if ((prev = va->va_port_lst) == vp)
va->va_port_lst = (XF86ConfVideoPortPtr)(va->va_port_lst->list.next);
else {
while (prev && (XF86ConfVideoPortPtr)(prev->list.next) != vp)
prev = (XF86ConfVideoPortPtr)(prev->list.next);
if (prev == NULL)
return (False);
prev->list.next = vp->list.next;
}
xf86optionListFree(vp->vp_option_lst);
XtFree((XtPointer)vp);
return (True);
}
int
xf86removeDisplayMode(XF86ConfDisplayPtr display, XF86ModePtr mode)
{
XF86ModePtr prev;
if (display == NULL || mode == NULL)
return (False);
if ((prev = display->disp_mode_lst) == mode)
display->disp_mode_lst = (XF86ModePtr)(display->disp_mode_lst->list.next);
else {
while (prev && (XF86ModePtr)(prev->list.next) != mode)
prev = (XF86ModePtr)(prev->list.next);
if (prev == NULL)
return (False);
prev->list.next = mode->list.next;
}
XtFree((XtPointer)mode);
return (True);
}
int
xf86removeVendor(XF86ConfigPtr config, XF86ConfVendorPtr vendor)
{
XF86ConfVendorPtr prev;
if (config == NULL || vendor == NULL)
return (False);
if ((prev = config->conf_vendor_lst) == vendor)
config->conf_vendor_lst = (XF86ConfVendorPtr)(config->conf_vendor_lst->list.next);
else {
while (prev && (XF86ConfVendorPtr)(prev->list.next) != vendor)
prev = (XF86ConfVendorPtr)(prev->list.next);
if (prev == NULL)
return (False);
prev->list.next = vendor->list.next;
}
xf86optionListFree(vendor->vnd_option_lst);
xf86freeVendorSubList(vendor->vnd_sub_lst);
XtFree(vendor->vnd_identifier);
XtFree((XtPointer)vendor);
return (True);
}
int
xf86removeVendorSub(XF86ConfVendorPtr vendor, XF86ConfVendSubPtr sub)
{
XF86ConfVendSubPtr prev;
if (vendor == NULL || sub == NULL)
return (False);
if ((prev = vendor->vnd_sub_lst) == sub)
vendor->vnd_sub_lst = (XF86ConfVendSubPtr)(vendor->vnd_sub_lst->list.next);
else {
while (prev && (XF86ConfVendSubPtr)(prev->list.next) != sub)
prev = (XF86ConfVendSubPtr)(prev->list.next);
if (prev == NULL)
return (False);
prev->list.next = sub->list.next;
}
xf86optionListFree(sub->vs_option_lst);
XtFree(sub->vs_name);
XtFree(sub->vs_identifier);
XtFree((XtPointer)sub);
return (True);
}
int
xf86removeBuffers(XF86ConfDRIPtr dri, XF86ConfBuffersPtr buf)
{
XF86ConfBuffersPtr prev;
if (dri == NULL || buf == NULL)
return (False);
if ((prev = dri->dri_buffers_lst) == buf)
dri->dri_buffers_lst = (XF86ConfBuffersPtr)(dri->dri_buffers_lst->list.next);
else {
while (prev && (XF86ConfBuffersPtr)(prev->list.next) != buf)
prev = (XF86ConfBuffersPtr)(prev->list.next);
if (prev == NULL)
return (False);
prev->list.next = buf->list.next;
}
XtFree(buf->buf_flags);
XtFree((XtPointer)buf);
return (True);
}
int
xf86renameInput(XF86ConfigPtr config, XF86ConfInputPtr input, char *name)
{
XF86ConfLayoutPtr lay = config->conf_layout_lst;
if (config == NULL || input == NULL || name == NULL || *name == '\0')
return (False);
while (lay != NULL) {
XF86ConfInputrefPtr iref = lay->lay_input_lst;
while (iref != NULL) {
if (strcasecmp(input->inp_identifier, iref->iref_inputdev_str) == 0) {
XtFree(iref->iref_inputdev_str);
iref->iref_inputdev_str = XtNewString(name);
}
iref = (XF86ConfInputrefPtr)(iref->list.next);
}
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
XtFree(input->inp_identifier);
input->inp_identifier = XtNewString(name);
return (True);
}
int
xf86renameDevice(XF86ConfigPtr config, XF86ConfDevicePtr dev, char *name)
{
XF86ConfScreenPtr scr = config->conf_screen_lst;
if (config == NULL || dev == NULL || name == NULL || *name == '\0')
return (False);
while (scr != NULL) {
if (scr->scrn_device == dev) {
XtFree(scr->scrn_device_str);
scr->scrn_device_str = XtNewString(name);
}
scr = (XF86ConfScreenPtr)(scr->list.next);
}
XtFree(dev->dev_identifier);
dev->dev_identifier = XtNewString(name);
return (True);
}
int
xf86renameMonitor(XF86ConfigPtr config, XF86ConfMonitorPtr mon, char *name)
{
XF86ConfScreenPtr scr = config->conf_screen_lst;
if (config == NULL || mon == NULL || name == NULL || *name == '\0')
return (False);
while (scr != NULL) {
if (scr->scrn_monitor == mon) {
XtFree(scr->scrn_monitor_str);
scr->scrn_monitor_str = XtNewString(name);
}
scr = (XF86ConfScreenPtr)(scr->list.next);
}
XtFree(mon->mon_identifier);
mon->mon_identifier = XtNewString(name);
return (True);
}
int
xf86renameLayout(XF86ConfigPtr config, XF86ConfLayoutPtr layout, char *name)
{
if (config == NULL || layout == NULL || name == NULL || *name == '\0')
return (False);
XtFree(layout->lay_identifier);
layout->lay_identifier = XtNewString(name);
return (True);
}
int
xf86renameScreen(XF86ConfigPtr config, XF86ConfScreenPtr scrn, char *name)
{
XF86ConfLayoutPtr lay = config->conf_layout_lst;
if (config == NULL || scrn == NULL || name == NULL || *name == '\0')
return (False);
while (lay != NULL) {
XF86ConfAdjacencyPtr adj = lay->lay_adjacency_lst;
while (adj != NULL) {
if (adj->adj_screen == scrn) {
XtFree(adj->adj_screen_str);
adj->adj_screen_str = XtNewString(name);
}
else if (adj->adj_top == scrn) {
XtFree(adj->adj_top_str);
adj->adj_top_str = XtNewString(name);
}
else if (adj->adj_bottom == scrn) {
XtFree(adj->adj_bottom_str);
adj->adj_bottom_str = XtNewString(name);
}
else if (adj->adj_left == scrn) {
XtFree(adj->adj_left_str);
adj->adj_left_str = XtNewString(name);
}
else if (adj->adj_right == scrn) {
XtFree(adj->adj_right_str);
adj->adj_right_str = XtNewString(name);
}
else if (adj->adj_refscreen != NULL &&
strcasecmp(adj->adj_refscreen, name) == 0) {
XtFree(adj->adj_refscreen);
adj->adj_refscreen = XtNewString(name);
}
adj = (XF86ConfAdjacencyPtr)(adj->list.next);
}
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
XtFree(scrn->scrn_identifier);
scrn->scrn_identifier = XtNewString(name);
return (True);
}

View File

@ -1,110 +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_xf86config_h
#define _xf86cfg_xf86config_h
#define xf86addInput(head, ptr) \
(XF86ConfInputPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addInputref(head, ptr) \
(XF86ConfInputrefPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addDevice(head, ptr) \
(XF86ConfDevicePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addDisplayMode(head, ptr) \
(XF86ModePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addMonitor(head, ptr) \
(XF86ConfMonitorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addScreen(head, ptr) \
(XF86ConfScreenPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addLayout(head, ptr) \
(XF86ConfLayoutPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addModeLine(head, ptr) \
(XF86ConfModeLinePtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addModes(head, ptr) \
(XF86ConfModesPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addModesLink(head, ptr) \
(XF86ConfModesLinkPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addModule(head, ptr) \
(XF86LoadPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addScreenAdaptor(head, ptr) \
(XF86ConfAdaptorLinkPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addScreenDisplay(head, ptr) \
(XF86ConfDisplayPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addVideoAdaptor(head, ptr) \
(XF86ConfVideoAdaptorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addVideoPort(head, ptr) \
(XF86ConfVideoPortPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addAdjacency(head, ptr) \
(XF86ConfAdjacencyPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addVendor(head, ptr) \
(XF86ConfVendorPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addVendorSub(head, ptr) \
(XF86ConfVendSubPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
#define xf86addBuffers(head, ptr) \
(XF86ConfBuffersPtr)xf86addListItem((GenericListPtr)(head), (GenericListPtr)(ptr))
int xf86removeOption(XF86OptionPtr*, char*);
int xf86removeInput(XF86ConfigPtr, XF86ConfInputPtr);
int xf86removeInputRef(XF86ConfLayoutPtr, XF86ConfInputPtr);
int xf86removeDevice(XF86ConfigPtr, XF86ConfDevicePtr);
int xf86removeDisplayMode(XF86ConfDisplayPtr, XF86ModePtr);
int xf86removeMonitor(XF86ConfigPtr, XF86ConfMonitorPtr);
int xf86removeScreen(XF86ConfigPtr, XF86ConfScreenPtr);
int xf86removeAdjacency(XF86ConfLayoutPtr, XF86ConfAdjacencyPtr);
int xf86removeInactive(XF86ConfLayoutPtr, XF86ConfInactivePtr);
int xf86removeLayout(XF86ConfigPtr, XF86ConfLayoutPtr);
int xf86removeModule(XF86ConfigPtr, XF86LoadPtr);
int xf86removeModes(XF86ConfigPtr, XF86ConfModesPtr);
int xf86removeModesModeLine(XF86ConfModesPtr, XF86ConfModeLinePtr);
int xf86removeMonitorModeLine(XF86ConfMonitorPtr, XF86ConfModeLinePtr);
int xf86removeMonitorModesLink(XF86ConfMonitorPtr, XF86ConfModesLinkPtr);
int xf86removeScreenAdaptorLink(XF86ConfScreenPtr, XF86ConfAdaptorLinkPtr);
int xf86removeScreenDisplay(XF86ConfScreenPtr, XF86ConfDisplayPtr);
int xf86removeVideoAdaptor(XF86ConfigPtr, XF86ConfVideoAdaptorPtr);
int xf86removeVideoPort(XF86ConfVideoAdaptorPtr, XF86ConfVideoPortPtr);
int xf86removeVendor(XF86ConfigPtr, XF86ConfVendorPtr);
int xf86removeVendorSub(XF86ConfVendorPtr, XF86ConfVendSubPtr);
int xf86removeBuffers(XF86ConfDRIPtr, XF86ConfBuffersPtr);
int xf86renameInput(XF86ConfigPtr, XF86ConfInputPtr, char*);
int xf86renameDevice(XF86ConfigPtr, XF86ConfDevicePtr, char*);
int xf86renameMonitor(XF86ConfigPtr, XF86ConfMonitorPtr, char*);
int xf86renameLayout(XF86ConfigPtr, XF86ConfLayoutPtr, char*);
int xf86renameScreen(XF86ConfigPtr, XF86ConfScreenPtr, char*);
extern void xf86freeAdaptorLinkList(XF86ConfAdaptorLinkPtr);
extern void xf86freeDisplayList(XF86ConfDisplayPtr);
extern void xf86freeModeList(XF86ModePtr);
extern void xf86freeVendorSubList(XF86ConfVendSubPtr);
#endif /* _xf86cfg_xf86config_h */

View File

@ -1,148 +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.man,v 1.9 2002/12/30 14:34:02 herrb Exp $
.\"
.TH xorgcfg __appmansuffix__ __vendorversion__
.SH NAME
xorgcfg - Graphical configuration tool for __xservername__
.SH SYNOPSIS
.B xorgcfg
[-config \fIconfigfile\fP] [-modulepath \fImoduledir\fP]
[-fontpath \fIfontsdir\fP] [-toolkitoption ...]
.SH DESCRIPTION
.I Xorgcfg
is a tool to configure\fI __xservername__\fP, and can be used to either write the
initial configuration file or make customizations to the current configuration.
.PP
When the \fBDISPLAY\fP environment variable is not set, xorgcfg will run
the command\fI __xservername__ -configure\fP to allow the xserver to detect the
hardware in the computer, and write an initial\fI __xconfigfile__\fP file
in the user's home directory. Then, it will start
__xservername__ and allow customizations.
.PP
If the \fBDISPLAY\fP environment variable is set, xorgcfg will read the
default\fI __xconfigfile__\fP, which may or may not be the one being used by
the current server, and allow customizations.
.PP
To use an alternative location for modules or fonts the respective search
paths may be specified.
.PP
Unless there is an \fBApply\fP button in the current xorgcfg dialog, the
changes made will take place the next time\fI __xservername__\fP is started.
.PP
Xorgcfg allows addition and configuration of new devices, such as video cards,
monitors, keyboards and mouses.
.PP
Screen layout configuration for xinerama or traditional multi-head is also
available.
.PP
Modelines can be configured or optimized.
.PP
AccessX basic configurations can be made in the xorgcfg's accessx section.
.SH OPTIONS
.TP 8
.I -config
Specifies an alternate __xconfigfile__ file for configuration.
.TP 8
.I -modulepath
Specifies where xorgcfg, and the server it may start, should look for
__xservername__ modules.
.TP 8
.I -serverpath
Specifies the complete path, not including the binary name, of the
__xservername__ binary.
.TP 8
.I -fontpath
Specifies the path to the fonts that should be used by the server started
by xorgcfg.
.TP 8
.I -textmode
If xorgcfg was compiled with support for ncurses, this option makes xorgcfg
enter a text mode interface.
.TP 8
.I -nomodules
When built with support for loading modules, this options changes xorgcfg
behaviour, so that it will not load any modules, and thus start quicker.
.SH ENVIRONMENT
.TP 8
.I DISPLAY
Default host and display number.
.TP 8
.I XWINHOME
Directory where __xservername__ was installed, defaults to __projectroot__.
.TP 8
.I XENVIRONMENT
Name of a resource file that overrides the global resources
stored in the RESOURCE_MANAGER property.
.SH FILES
.TP 8
.I /etc/__xconfigfile__
Server configuration file
.TP 8
.I /etc/X11/__xconfigfile__
Server configuration file
.TP 8
.I __projectroot__/etc/__xconfigfile__
Server configuration file
.TP 8
.IR __projectroot__/lib/X11/__xconfigfile__. hostname
Server configuration file
.TP 8
.I __projectroot__/lib/X11/__xconfigfile__
Server configuration file
.TP 8
.I __projectroot__/lib/X11/app-default/XOrgCfg
Specifies xorgcfg resources
.TP 8
.I __projectroot__/lib/X11/xkb/X0-config.keyboard
Keyboard specific configuration
.SH "SEE ALSO"
.IR __xservername__ (__appmansuffix__),
.IR __xconfigfile__ (__filemansuffix__)
.SH COPYRIGHT
.TP 8
Copyright 2000, Conectiva Linux S.A.
\fIhttp://www.conectiva.com\fP
.TP 8
Copyright 2000, The XFree86 Project
\fIhttp://www.XFree86.org\fP
.SH AUTHORS
.TP 8
Paulo C\'esar Pereira de Andrade \fI<pcpa@conectiva.com.br>\fP
originally for The XFree86 Project.
.SH BUGS
Probably.