summaryrefslogtreecommitdiff
path: root/xc/programs/Xserver/hw/xfree86/xf86cfg
diff options
context:
space:
mode:
Diffstat (limited to 'xc/programs/Xserver/hw/xfree86/xf86cfg')
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile9
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/TODO33
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad14
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c13
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c310
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h21
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/config.h21
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c151
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/help.c4
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c221
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c658
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h194
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c595
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/options.c34
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/options.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c2
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c54
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c51
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c217
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h5
-rw-r--r--xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man2
22 files changed, 1867 insertions, 752 deletions
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
index 7be07bcc7..b8faa8ef7 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile
@@ -1,10 +1,10 @@
-XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.18 2001/04/22 08:36:31 herrb Exp $
+XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.20 2001/07/09 23:45:24 paulo Exp $
XCOMM CDEBUGFLAGS=-g -Wall -ansi -pedantic
#if DoLoadableServer
-LDSRCS = libc_wrapper.c loader.c
-LDOBJS = libc_wrapper.o loader.o
+LDSRCS = libc_wrapper.c loader.c loadmod.c
+LDOBJS = libc_wrapper.o loader.o loadmod.o
#endif
#if HasNCurses
@@ -83,7 +83,8 @@ AllTarget(ProgramTargetName($(PROG)))
LOADERLIB = -L../loader -lxloader -L../dummylib -ldummy
MODULEDEFINES = -DUSE_MODULES
INCLUDES = -I../common -I../loader -I$(XF86OSSRC) \
- -I$(SERVERSRC)/include -I$(XINCLUDESRC)
+ -I$(SERVERSRC)/include -I$(XINCLUDESRC) \
+ -I$(FONTLIBSRC)/include
#if !HasSnprintf
SNPRINTF_DEFS = -DNEED_SNPRINTF
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/TODO b/xc/programs/Xserver/hw/xfree86/xf86cfg/TODO
new file mode 100644
index 000000000..75fe91b95
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/TODO
@@ -0,0 +1,33 @@
+$XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/TODO,v 1.1 2001/07/04 16:09:14 paulo Exp $
+
+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 xf86cfg.
+
+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 xf86cfg 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 xf86cfg 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
+ XF86Config with a text editor.
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
index 871d7c227..615b6165d 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad
@@ -26,7 +26,7 @@
!!
!! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
!!
-!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.13 2001/05/15 18:22:23 paulo Exp $
+!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.14 2001/06/23 01:45:56 paulo Exp $
!!
*Form.background: gray85
@@ -469,6 +469,8 @@ XF86Cfg.translations: #override \
<Message>WM_PROTOCOLS: error-cancel()
.xf86cfg.force.translations: #override \
<Message>WM_PROTOCOLS: addmode-cancel()
+.xf86cfg.addMode.translations: #override \
+<Message>WM_PROTOCOLS: addmode-cancel()
.xf86cfg.accessx.translations: #override \
<Message>WM_PROTOCOLS: accessx-close()
.xf86cfg.test.translations: #override \
@@ -818,6 +820,16 @@ Press ESC if your monitor goes out of sync.
.xf86cfg.force.maxHeight: 58
.xf86cfg.force.?.label: There is already a modeline with the\n\
specified identifier. Add anyway?
+
+.xf86cfg.addMode.geometry: 350x80
+.xf86cfg.addMode.minWidth: 350
+.xf86cfg.addMode.maxWidth: 350
+.xf86cfg.addMode.minHeight: 80
+.xf86cfg.addMode.maxHeight: 80
+.xf86cfg.addMode.?.label: XF86VidModeAddModeLine returned True,\n\
+but no modeline was added to the current Screen.\n\
+Do you want to add it to the Monitor section?
+
.xf86cfg.test.?.label: \ Testing modeline...\n\n\
Press ESC or stop button to quit.
.xf86cfg.test.geometry: 250x72
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
index f50925dbc..3802131cf 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.6.2.2 2001/05/23 14:45:15 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.10 2001/07/06 19:35:10 paulo Exp $
*/
#include "xf86config.h"
@@ -266,6 +266,9 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data)
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,
@@ -307,11 +310,9 @@ CardModelCallback(Widget w, XtPointer user_data, XtPointer call_data)
first = 0;
#ifndef USE_MODULES
- if (!nomodules) {
- XtSetArg(args[0], XtNstring,
- card_entry->driver ? card_entry->driver : "vga");
- XtSetValues(driver, args, 1);
- }
+ XtSetArg(args[0], XtNstring,
+ card_entry->driver ? card_entry->driver : "vga");
+ XtSetValues(driver, args, 1);
#endif
str = XtNewString(tip);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c
index 8696dc96a..e0fbfe41a 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c
@@ -26,11 +26,14 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c,v 1.1 2000/04/04 22:36:57 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.c,v 1.10 2001/08/01 00:44:56 tsi Exp $
*/
+#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
@@ -54,6 +57,19 @@
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
@@ -66,9 +82,227 @@ int NumCardsEntry;
/*
* Implementation
*/
+#ifdef USE_MODULES
+pciVendorDeviceInfo *xf86PCIVendorInfo;
+SymTabPtr xf86PCIVendorNameInfo;
+#endif
+
+#ifdef USE_MODULES
+void
+InitializePciInfo(void)
+{
+ xf86PCIVendorInfo = xf86PCIVendorInfoData;
+ xf86PCIVendorNameInfo = xf86PCIVendorNameInfoData;
+}
+
+void
+CheckChipsets(xf86cfgModuleOptions *opts, int *err)
+{
+ int i, j, ichk, ivnd, vendor, device;
+ 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 xf86PCIVendorInfoData */
+ for (ivnd = 0; xf86PCIVendorInfoData[ivnd].VendorID; ivnd++)
+ if (vendor == xf86PCIVendorInfoData[ivnd].VendorID)
+ break;
+ if (xf86PCIVendorInfoData[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 (check[ichk].chipsets == NULL) {
+ for (j = 0; xf86PCIVendorInfoData[ivnd].Device[j].DeviceName; j++)
+ ;
+ check[ichk].chipsets = (char*)XtCalloc(1, j);
+ }
+ for (j = 0; xf86PCIVendorInfoData[ivnd].Device[j].DeviceName; j++) {
+ if (device == xf86PCIVendorInfoData[ivnd].Device[j].DeviceID) {
+ if (strcmp(chips->name, xf86PCIVendorInfoData[ivnd].Device[j].DeviceName)) {
+ CheckMsg(CHECKER_NOMATCH_CHIPSET_STRINGS,
+ "WARNING chipset strings don't match: \"%s\" \"%s\" (0x%x)\n",
+ chips->name, xf86PCIVendorInfoData[ivnd].Device[j].DeviceName,
+ device);
+ ++*err;
+ }
+ break;
+ }
+ }
+ if (!xf86PCIVendorInfoData[ivnd].Device[j].DeviceName) {
+ 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 (!check[i].chipsets[j]) {
+ CheckMsg(CHECKER_CHIPSET_NOT_SUPPORTED,
+ "NOTICE chipset \"%s\" (0x%x) not listed as supported.\n",
+ xf86PCIVendorInfoData[check[i].ivendor].Device[j].DeviceName,
+ xf86PCIVendorInfoData[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;
+
+ /* 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;
+
+ for (i = 0; xf86PCIVendorInfoData[i].VendorID; i++)
+ if (ivendor == xf86PCIVendorInfoData[i].VendorID)
+ break;
+ if (xf86PCIVendorInfoData[i].VendorID) {
+ for (j = 0; xf86PCIVendorNameInfoData[j].name; j++)
+ if (xf86PCIVendorNameInfoData[j].token == ivendor) {
+ vendor = xf86PCIVendorNameInfoData[j].name;
+ break;
+ }
+
+ for (j = 0; xf86PCIVendorInfoData[i].Device[j].DeviceName; j++)
+ if (idevice == xf86PCIVendorInfoData[i].Device[j].DeviceID)
+ break;
+
+ if (xf86PCIVendorInfoData[i].Device[j].DeviceName)
+ device = xf86PCIVendorInfoData[i].Device[j].DeviceName;
+ }
+
+ /* 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;
@@ -107,8 +341,10 @@ ReadCardsDatabase(void)
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) {
@@ -281,6 +517,36 @@ GetCardNames(int *result)
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;
@@ -414,49 +680,11 @@ ReadCardsLine(FILE *fp, char *value)
static int
CompareCards(_Xconst void *left, _Xconst void *right)
{
- return strcmp((*(CardsEntry**)left)->name, (*(CardsEntry**)right)->name);
+ return strcasecmp((*(CardsEntry**)left)->name, (*(CardsEntry**)right)->name);
}
static int
BCompareCards(_Xconst void *name, _Xconst void *card)
{
- return (strcmp((char*)name, (*(CardsEntry**)card)->name));
-}
-
-#ifdef TEST_CARDS
-int
-main(int argc, char *argv[])
-{
- int i;
-
- chdir("/usr/X11R6");
- ReadCardsDatabase();
-
- for (i = 0; i < NumCardsEntry; i++) {
- CardsEntry *entry = CardsDB[i];
-
- printf("name: %s\n", entry->name);
- if (entry->chipset)
- printf("chipset: %s\n", entry->chipset);
- if (entry->server)
- printf("server: %s\n", entry->server);
- if (entry->driver)
- printf("driver: %s\n", entry->driver);
- if (entry->ramdac)
- printf("%s\n", entry->ramdac);
- if (entry->clockchip)
- printf("%s\n", entry->clockchip);
- if (entry->dacspeed)
- printf("%s\n", entry->dacspeed);
- if (entry->flags & F_NOCLOCKPROBE)
- printf("NOCLOCKPROBE\n");
- if (entry->flags & F_UNSUPPORTED)
- printf("UNSUPPORTED\n");
- if (entry->lines)
- printf("%s\n", entry->lines);
- printf("\n");
- }
-
- return (0);
+ return (strcasecmp((char*)name, (*(CardsEntry**)card)->name));
}
-#endif /* TEST_CARDS */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h
index 51b5fb7b1..548a4eef8 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h,v 1.1 2000/04/04 22:36:57 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/cards.h,v 1.2 2001/07/06 02:04:10 paulo Exp $
*/
#include <stdio.h>
@@ -34,10 +34,24 @@
#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"
+
+#define SELF_CONTAINED_PCI_INFO
+#define INIT_PCI_VENDOR_NAME_INFO
+#define INIT_PCI_VENDOR_INFO
+#include "xf86PciInfo.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). */
@@ -69,5 +83,10 @@ void ReadCardsDatabase(void);
CardsEntry *LookupCard(char*);
char **GetCardNames(int*);
char **FilterCardNames(char*, int*);
+#ifdef USE_MODULES
+void InitializePciInfo(void);
+typedef struct _xf86cfgModuleOptions *xf86cfgModuleOptionsPtr;
+void CheckChipsets(xf86cfgModuleOptionsPtr, int*);
+#endif
#endif /* _xf86cfg_cards_h */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
index e7ef66767..f33d1b87d 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/config.h
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.10.2.1 2001/05/21 22:24:02 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.15 2001/08/17 22:08:15 tsi Exp $
*/
#include <X11/IntrinsicP.h>
@@ -37,14 +37,11 @@
#include <dirent.h>
#include <string.h>
#include <unistd.h>
+#if defined(sun) && defined(SVR4)
+#include <strings.h>
+#endif
-#if NeedVarargsPrototypes
#include <stdarg.h>
-#define Va_start(a,b) va_start(a,b)
-#else
-#include <varargs.h>
-#define Va_start(a,b) va_start(a)
-#endif
#ifdef __EMX__
#define strcasecmp stricmp
@@ -94,6 +91,12 @@
#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," \
@@ -217,6 +220,8 @@ extern xf86cfgComputer computer;
extern Atom wm_delete_window;
extern Display *DPY;
extern Pixmap menuPixmap;
-extern Bool nomodules;
+#ifdef USE_MODULES
+extern int nomodules;
+#endif
#endif /* _xf86cfg_config_h */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
index e099ca804..ba269bbbc 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c
@@ -26,15 +26,17 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.8.2.1 2001/05/21 22:24:02 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.12 2001/07/08 00:44:33 paulo Exp $
*/
#include "config.h"
#include "xf86config.h"
#include "options.h"
#include "screen.h"
+#include "vidmode.h"
#include "monitor-cfg.h"
#include <X11/Shell.h>
+#include <X11/CompositeP.h>
#include <X11/Xaw/AsciiText.h>
#include <X11/Xaw/Box.h>
#include <X11/Xaw/Command.h>
@@ -258,6 +260,7 @@ static void CreateInput(TreeNode*, XF86ConfInputPtr);
static void CreateInputField(TreeNode*, Bool);
static void InputDestroy(TreeNode*);
static void NewInputCallback(Widget, XtPointer, XtPointer);
+static void InputUpdate(TreeNode*);
static void CreateLayout(TreeNode*, XF86ConfLayoutPtr);
static void CreateLayoutField(TreeNode*, Bool);
@@ -294,14 +297,21 @@ static void BuffersDestroy(TreeNode*);
static void NewBuffersCallback(Widget, XtPointer, XtPointer);
static void BuffersUpdate(TreeNode*);
-extern void CreateOptionsShell(void);
extern void RemoveDeviceCallback(Widget, XtPointer, XtPointer);
+/* interface.c */
+extern void InitializeDevices(void);
+extern void SelectLayoutCallback(Widget, XtPointer, XtPointer);
+extern void UpdateMenuDeviceList(int);
+extern void SetConfigModeCallback(Widget, XtPointer, XtPointer);
+extern void DefaultLayoutCallback(Widget, XtPointer, XtPointer);
+extern void RemoveLayoutCallback(Widget, XtPointer, XtPointer);
+
/*
* Initialization
*/
static Widget shell, expert, tree, panner;
-extern Widget work, optionsShell, config;
+extern Widget work, optionsShell, config, layoutp, topMenu;
extern xf86cfgDevice cpu_device;
static TreeNode *mainNode, *monitorTree, *screenTree, *layoutTree;
@@ -322,35 +332,13 @@ ExpertConfigureStart(void)
void
ExpertConfigureEnd(void)
{
- int i;
+ int i, save_config_mode = config_mode;
+ Widget sme, layopt, layoutsme = NULL;
+ XF86ConfLayoutPtr lay;
XtVaSetValues(optionsShell, XtNtransientFor, toplevel, NULL, 0);
XtPopdown(shell);
- for (i = 0; i < computer.num_screens; i++) {
- XF86OptionPtr option, options;
- int rotate;
-
- options = computer.screens[i]->screen->scrn_option_lst;
- if ((option = xf86findOption(options, "Rotate")) != NULL) {
- if (option->opt_val != NULL)
- rotate = strcasecmp(option->opt_val, "CW") == 0 ? 1 :
- strcasecmp(option->opt_val, "CCW") == 0 ? -1 : 0;
- XtFree(option->opt_val);
- option->opt_val = XtNewString(rotate > 0 ? "CW" : "CCW");
- computer.screens[i]->rotate = rotate;
- }
- else
- computer.screens[i]->rotate = 0;
- UpdateScreenUI();
- AdjustScreenUI();
- SetTip((xf86cfgDevice*)computer.screens[i]);
- }
- if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst)
- SetTip(&cpu_device);
- for (i = 0; i < computer.num_devices; i++)
- SetTip(computer.devices[i]);
-
/* Need to do this to avoid all code elsewhere needing to update the
* "expert" widget tree
*/
@@ -358,6 +346,94 @@ ExpertConfigureEnd(void)
DestroyTree(mainNode);
XtDestroyWidget(shell);
expert = NULL;
+
+ if (save_config_mode != CONFIG_LAYOUT)
+ SetConfigModeCallback(topMenu, (XtPointer)CONFIG_LAYOUT, NULL);
+
+ /* Reset everything as the "expert" interface can do almost anything
+ * to the configuration.
+ */
+ for (i = 0; i < computer.num_screens; i++) {
+ XtDestroyWidget(computer.screens[i]->widget);
+ XtFree((XtPointer)computer.screens[i]);
+ }
+ XtFree((XtPointer)computer.screens);
+ computer.screens = NULL;
+ computer.num_screens = 0;
+
+ for (i = 0; i < computer.num_devices; i++) {
+ XtDestroyWidget(computer.devices[i]->widget);
+ XtFree((XtPointer)computer.devices[i]);
+ }
+ XtFree((XtPointer)computer.devices);
+ computer.devices = NULL;
+ computer.num_devices = 0;
+
+ for (i = 0; i < computer.num_layouts; i++) {
+ XtFree((XtPointer)computer.layouts[i]->position);
+ XtFree((XtPointer)computer.layouts[i]);
+ }
+ XtFree((XtPointer)computer.layouts);
+ computer.layouts = NULL;
+ computer.num_layouts = 0;
+
+ for (i = 0; i < computer.num_vidmodes; i++)
+ XtFree((XtPointer)computer.vidmodes[i]);
+ XtFree((XtPointer)computer.vidmodes);
+ computer.vidmodes = NULL;
+ computer.num_vidmodes = 0;
+
+ /* Reinitialize devices/screens */
+ InitializeDevices();
+ UpdateMenuDeviceList(MOUSE);
+ UpdateMenuDeviceList(KEYBOARD);
+ UpdateMenuDeviceList(CARD);
+ UpdateMenuDeviceList(MONITOR);
+
+ /* Update layout menu */
+ /* first entry is "New server layout" */
+ for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++)
+ XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]);
+ for (i = 0; i < layoutp->core.num_popups; i++)
+ XtDestroyWidget(layoutp->core.popup_list[i]);
+ lay = XF86Config->conf_layout_lst;
+ while (lay != NULL) {
+ sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
+ layoutp,
+ XtNlabel, lay->lay_identifier,
+ XtNmenuName, lay->lay_identifier,
+ XtNleftBitmap, menuPixmap,
+ NULL, 0);
+ XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
+ if (layoutsme == NULL)
+ layoutsme = sme;
+ layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
+ lay = (XF86ConfLayoutPtr)(lay->list.next);
+ }
+ computer.layout = NULL;
+ SelectLayoutCallback(layoutsme,
+ XF86Config->conf_layout_lst, NULL);
+
+
+ if (XF86Config->conf_flags && XF86Config->conf_flags->flg_option_lst)
+ SetTip(&cpu_device);
+ for (i = 0; i < computer.num_devices; i++)
+ SetTip(computer.devices[i]);
+
+ /* Reinitialize vidmodes */
+ InitializeVidmodes();
+
+ if (save_config_mode != CONFIG_LAYOUT)
+ SetConfigModeCallback(topMenu, (XtPointer)save_config_mode, NULL);
}
/*ARGSUSED*/
@@ -465,7 +541,7 @@ UpdateFiles(TreeNode *files)
static void
CreateFontPath(TreeNode *fontpath, char *path)
{
- TreeNode *prev, *node;
+ TreeNode *prev = NULL, *node;
Widget w;
if (path == NULL) {
@@ -642,7 +718,7 @@ FontPathCallback(Widget w, XtPointer user_data, XtPointer call_data)
static void
CreateModulePath(TreeNode *modulepath, char *path)
{
- TreeNode *prev, *node;
+ TreeNode *prev = NULL, *node;
Widget w;
if (path == NULL) {
@@ -3362,6 +3438,7 @@ CreateInput(TreeNode *parent, XF86ConfInputPtr input)
data->input.input = input;
node = NewNode(parent, NULL, NULL, parent->node, data);
node->destroy = InputDestroy;
+ node->update = InputUpdate;
CreateInputField(node, False);
if (parent->child == NULL)
parent->child = node;
@@ -3510,6 +3587,20 @@ InputDestroy(TreeNode *node)
}
}
+static void
+InputUpdate(TreeNode *node)
+{
+ char *str;
+
+ /* vendor */
+ XtVaGetValues(node->data->input.text, XtNstring, &str, NULL, 0);
+ XtFree(node->data->input.input->inp_driver);
+ if (*str)
+ node->data->input.input->inp_driver = XtNewString(str);
+ else
+ node->data->input.input->inp_driver = NULL;
+}
+
/* Layout */
static void
CreateLayout(TreeNode *parent, XF86ConfLayoutPtr lay)
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c
index 1e98306ed..8006933a8 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/help.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.4 2001/05/15 18:22:23 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.5 2001/07/25 15:05:08 dawes Exp $
*/
#include <X11/IntrinsicP.h>
@@ -42,9 +42,7 @@
#include <X11/Xaw/TextSrcP.h>
#include <X11/Xmu/SysUtil.h>
#include <X11/Xmu/Xmu.h>
-#ifndef X_NOT_STDC_ENV
#include <stdlib.h> /* for bsearch() */
-#endif
#include <ctype.h>
#include "help.h"
#include "options.h"
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
index 3489f2a04..d50f8e2eb 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.23.2.1 2001/05/21 22:24:02 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.29 2001/07/08 00:44:33 paulo Exp $
*/
#include <X11/IntrinsicP.h>
@@ -101,7 +101,7 @@ void PopdownErrorCallback(Widget, XtPointer, XtPointer);
static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*);
static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*);
static void HelpCallback(Widget, XtPointer, XtPointer);
-static void UpdateMenuDeviceList(int);
+void UpdateMenuDeviceList(int);
extern void AccessXConfigureStart(void);
extern void AccessXConfigureEnd(void);
@@ -111,10 +111,12 @@ extern void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*);
extern void TextMode(void);
#endif
+static void Usage(void);
+
/*
* Initialization
*/
-Widget toplevel, work, config, layout, layoutsme, layoutp;
+Widget toplevel, work, config, layout, layoutsme, layoutp, topMenu;
XtAppContext appcon;
Pixmap menuPixmap;
@@ -130,12 +132,16 @@ static char XF86Config_path_static[1024];
static char XkbConfig_path_static[1024];
Bool xf86config_set = False;
-Bool textmode = False, nomodules = False;
+int textmode = False;
+#ifdef USE_MODULES
+int nomodules = False;
+#endif
+int noverify = False;
xf86cfgComputer computer;
xf86cfgDevice cpu_device;
Cursor no_cursor;
-static Widget device, menu, layoutm, popup, commands;
+static Widget device, layoutm, popup, commands;
static int xpos, ypos;
int sxpos, sypos;
static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 };
@@ -145,11 +151,7 @@ static Bool config_set = False;
static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu,
cardSme, cardMenu, monitorSme, monitorMenu;
-#define CONFIG_LAYOUT 0
-#define CONFIG_SCREEN 1
-#define CONFIG_MODELINE 2
-#define CONFIG_ACCESSX 3
-static int config_mode = CONFIG_LAYOUT;
+int config_mode = CONFIG_LAYOUT;
static XtActionsRec actions[] = {
{"filter-card", CardFilterAction},
@@ -166,7 +168,7 @@ static XtActionsRec actions[] = {
{"options-cancel", OptionsCancelAction},
{"error-cancel", ErrorCancelAction},
{"quit-cancel", QuitCancelAction},
- {"addmode-cancel", CancelForceAddModeAction},
+ {"addmode-cancel", CancelAddModeAction},
{"accessx-close", CloseAccessXAction},
{"testmode-cancel", CancelTestModeAction},
{"help-close", HelpCancelAction},
@@ -198,11 +200,31 @@ static XtResource appResources[] = {
0, XtRString, "menu10"},
};
-/*
-static XrmOptionDescRec optionDescList[] = {
- {"-xf86config", "*xf86config", XrmoptionSepArg, (XtPointer)"/etc/X11/XF86Config"},
-};
-*/
+static void
+Usage(void)
+{
+ fprintf(stderr,
+"Usage:\n"
+" xf86cfg [-option ...]\n"
+"\n"
+"Options:\n"
+" -xf86config <XF86Config> Alternate configuration file.\n"
+" -modulepath <module-path> XFree86 modules location.\n"
+" -serverpath <server-path> X server to start (if $DISPLAY is not defined).\n"
+" -fontpath <font-path> Font path for fonts.\n"
+" -rgbpath <rgb-path> Where the rgb.txt file is located.\n"
+#ifdef HAS_NCURSES
+" -textmode Use this option for the text only interface.\n"
+#endif
+#ifdef USE_MODULES
+" -nomodules Use this option if xf86cfg is slow to start.\n"
+" -verbose <number> Verbosity used in the loader (default 1).\n"
+#endif
+" -noverify Do not verify modules/options integrity.\n"
+);
+
+ exit(1);
+}
/*
* Implementation
@@ -220,15 +242,15 @@ main(int argc, char *argv[])
char *menuPixmapPath = NULL;
XrmValue from, to;
-#ifdef USE_MODULES
- xf86Verbose = 1;
-#endif
-
if ((XFree86Dir = getenv("XWINHOME")) == NULL)
XFree86Dir = DefaultXFree86Dir;
chdir(XFree86Dir);
+#ifdef USE_MODULES
+ xf86Verbose = 1;
+#endif
+
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-xf86config") == 0) {
if (i + 1 < argc) {
@@ -252,8 +274,18 @@ main(int argc, char *argv[])
else if (strcmp(argv[i], "-textmode") == 0)
textmode = True;
#endif
+#ifdef USE_MODULES
else if (strcmp(argv[i], "-nomodules") == 0)
nomodules = True;
+ else if (strcmp(argv[i], "-verbose") == 0) {
+ if (i + 1 < argc)
+ xf86Verbose = atoi(argv[++i]);
+ }
+#endif
+ else if (strcmp(argv[i], "-noverify") == 0)
+ noverify = True;
+ else
+ Usage();
}
#ifdef HAS_NCURSES
@@ -269,7 +301,6 @@ main(int argc, char *argv[])
if (XkbConfig_path == NULL)
XkbConfig_path = XkbConfigDir XkbConfigFile;
toplevel = XtAppInitialize(&appcon, "XF86Cfg",
-/* optionDescList, XtNumber(optionDescList),*/
NULL, 0,
&argc, argv,
NULL, NULL, 0);
@@ -297,12 +328,12 @@ main(int argc, char *argv[])
toplevel, NULL, 0);
hpane = XtVaCreateManagedWidget("hpane", panedWidgetClass, pane,
XtNorientation, XtorientHorizontal, NULL, 0);
- menu = XtCreateManagedWidget("topM", menuButtonWidgetClass,
+ topMenu = XtCreateManagedWidget("topM", menuButtonWidgetClass,
hpane, NULL, 0);
expert = XtCreateManagedWidget("expert", commandWidgetClass, hpane, NULL, 0);
XtAddCallback(expert, XtNcallback, ExpertCallback, NULL);
popup = XtCreatePopupShell("menu", simpleMenuWidgetClass,
- menu, NULL, 0);
+ topMenu, NULL, 0);
sme = XtCreateManagedWidget("layout", smeBSBObjectClass,
popup, NULL, 0);
XtAddCallback(sme, XtNcallback, SetConfigModeCallback,
@@ -394,19 +425,8 @@ main(int argc, char *argv[])
bottom, NULL, 0);
XtAddCallback(quit, XtNcallback, QuitCallback, NULL);
- layopt = XtCreatePopupShell("options", simpleMenuWidgetClass,
- layoutp, NULL, 0);
- sme = XtCreateManagedWidget("default", smeBSBObjectClass,
- layopt, NULL, 0);
- XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
- sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
- layopt, NULL, 0);
- XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
-
- XtRealizeWidget(layopt);
-
XtRealizeWidget(toplevel);
- XtRealizeWidget(menu);
+ XtRealizeWidget(topMenu);
pixmap = XCreateBitmapFromData(XtDisplay(toplevel), XtWindow(toplevel),
no_cursor_data, 8, 8);
@@ -446,19 +466,28 @@ main(int argc, char *argv[])
UpdateMenuDeviceList(CARD);
UpdateMenuDeviceList(MONITOR);
XtSetSensitive(smemodeline, VideoModeInitialize());
- ReadCardsDatabase();
lay = XF86Config->conf_layout_lst;
while (lay != NULL) {
sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
layoutp,
XtNlabel, lay->lay_identifier,
- XtNmenuName, "options",
+ XtNmenuName, lay->lay_identifier,
XtNleftBitmap, menuPixmap,
NULL, 0);
XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
if (layoutsme == NULL)
layoutsme = sme;
+ layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
SelectLayoutCallback(layoutsme,
@@ -488,6 +517,9 @@ main(int argc, char *argv[])
LoaderInitializeOptions();
#endif
+ /* ReadCardsDatabase() must be called after LoaderInitializeOptions() */
+ ReadCardsDatabase();
+
if (!config_set && startedx) {
XtFree(XF86Config_path);
#ifdef XF86CONFIG
@@ -574,7 +606,7 @@ AskConfig(void)
else {
Arg args[2];
Cardinal num_args = 0;
- char *l, *label, *str = "";
+ char *l, *label = NULL, *str = "";
XtSetArg(args[0], XtNlabel, &l);
XtGetValues(dialog, args, 1);
@@ -747,23 +779,25 @@ InitializeDevices(void)
keyboard_y = work->core.height - DEFAULT_KEYBOARD_HEIGHT;
while (input != NULL) {
- if (strcasecmp(input->inp_driver, "mouse") == 0) {
- device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y);
- SetTip(device);
- if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) {
- if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1))
- mouse_y = work->core.height >> 1;
- mouse_x = work->core.width - (work->core.width >> 2);
+ if (input->inp_driver) {
+ if (strcasecmp(input->inp_driver, "mouse") == 0) {
+ device = AddDevice(MOUSE, (XtPointer)input, mouse_x, mouse_y);
+ SetTip(device);
+ if ((mouse_x += DEFAULT_MOUSE_WIDTH) > work->core.width) {
+ if ((mouse_y -= DEFAULT_MOUSE_HEIGHT) < (work->core.height >> 1))
+ mouse_y = work->core.height >> 1;
+ mouse_x = work->core.width - (work->core.width >> 2);
+ }
}
- }
- else if (strcasecmp(input->inp_driver, "keyboard") == 0) {
- device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y);
- SetTip(device);
- if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) >
- work->core.width - (work->core.width >> 2)) {
- if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1))
- keyboard_y = work->core.height >> 1;
- keyboard_x = 6;
+ else if (strcasecmp(input->inp_driver, "keyboard") == 0) {
+ device = AddDevice(KEYBOARD, (XtPointer)input, keyboard_x, keyboard_y);
+ SetTip(device);
+ if ((keyboard_x += DEFAULT_KEYBOARD_WIDTH) >
+ work->core.width - (work->core.width >> 2)) {
+ if ((keyboard_y -= DEFAULT_KEYBOARD_HEIGHT) < (work->core.height >> 1))
+ keyboard_y = work->core.height >> 1;
+ keyboard_x = 6;
+ }
}
}
input = (XF86ConfInputPtr)(input->list.next);
@@ -907,10 +941,15 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
XF86ConfLayoutPtr lay = (XF86ConfLayoutPtr)user_data;
XF86ConfInputrefPtr input;
XF86ConfAdjacencyPtr adj;
+ Widget sme, layopt;
Arg args[1];
char *str;
- if (lay == computer.layout)
+ /* XXX Needs to check computer.layout,
+ * because this function should also create
+ * a new layout...
+ */
+ if (lay == computer.layout && computer.layout)
return;
if (computer.layout != NULL) {
@@ -1003,8 +1042,8 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
l = (XF86ConfLayoutPtr)(l->list.next);
}
do {
- ++num_layouts;
XmuSnprintf(name, sizeof(name), "Layout%d", num_layouts);
+ ++num_layouts;
} while (xf86findLayout(name,
XF86Config->conf_layout_lst) != NULL);
l = (XF86ConfLayoutPtr)XtCalloc(1, sizeof(XF86ConfLayoutRec));
@@ -1015,11 +1054,22 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
layoutsme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
layoutp,
XtNlabel, name,
- XtNmenuName, "options",
+ XtNmenuName, l->lay_identifier,
XtNleftBitmap, menuPixmap,
NULL, 0);
XtAddCallback(layoutsme, XtNcallback,
SelectLayoutCallback, (XtPointer)l);
+
+ layopt = XtCreatePopupShell(l->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
computer.layout = l;
XtSetArg(args[0], XtNstring, name);
XtSetValues(layout, args, 1);
@@ -1082,15 +1132,14 @@ SelectLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
void
DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
- Widget sme = (Widget)(((SimpleMenuWidget)(w->core.parent->core.parent))
- ->simple_menu.entry_set);
+ Widget layopt, sme;
int i;
char *str;
- Arg args[1];
XF86ConfLayoutPtr prev, tmp, lay;
- XtSetArg(args[0], XtNlabel, &str);
- XtGetValues(sme, args, 1);
+ str = w && XtParent(w) ? XtName(XtParent(w)) : NULL;
+ if (str == NULL)
+ return;
prev = XF86Config->conf_layout_lst;
lay = xf86findLayout(str, prev);
@@ -1107,6 +1156,8 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
for (i = 1; i < ((CompositeWidget)layoutp)->composite.num_children; i++)
XtDestroyWidget(((CompositeWidget)layoutp)->composite.children[i]);
+ for (i = 0; i < layoutp->core.num_popups; i++)
+ XtDestroyWidget(layoutp->core.popup_list[i]);
prev->list.next = lay->list.next;
lay->list.next = XF86Config->conf_layout_lst;
@@ -1118,12 +1169,22 @@ DefaultLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
sme = XtVaCreateManagedWidget("sme", smeBSBObjectClass,
layoutp,
XtNlabel, lay->lay_identifier,
- XtNmenuName, "options",
+ XtNmenuName, lay->lay_identifier,
XtNleftBitmap, menuPixmap,
NULL, 0);
XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay);
if (layoutsme == NULL)
layoutsme = sme;
+ layopt = XtCreatePopupShell(lay->lay_identifier, simpleMenuWidgetClass,
+ layoutp, NULL, 0);
+ sme = XtCreateManagedWidget("default", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, DefaultLayoutCallback, NULL);
+ sme = XtCreateManagedWidget("remove", smeBSBObjectClass,
+ layopt, NULL, 0);
+ XtAddCallback(sme, XtNcallback, RemoveLayoutCallback, NULL);
+ XtRealizeWidget(layopt);
+
lay = (XF86ConfLayoutPtr)(lay->list.next);
}
SelectLayoutCallback(layoutsme,
@@ -1135,13 +1196,15 @@ void
RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
XF86ConfLayoutPtr prev, tmp, lay, rem;
- Widget sme = (Widget)(((SimpleMenuWidget)(w->core.parent->core.parent))
- ->simple_menu.entry_set);
+ Widget sme = NULL;
+ int i;
char *str;
Arg args[1];
- XtSetArg(args[0], XtNlabel, &str);
- XtGetValues(sme, args, 1);
+ str = w && XtParent(w) ? XtName(XtParent(w)) : NULL;
+ if (str == NULL)
+ return;
+
prev = XF86Config->conf_layout_lst;
lay = xf86findLayout(str, prev);
tmp = prev;
@@ -1174,8 +1237,6 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
SelectLayoutCallback(layoutsme, lay, NULL);
}
else {
- int i;
-
computer.layout = NULL;
XtSetArg(args[0], XtNstring, "");
XtSetValues(layout, args, 1);
@@ -1185,17 +1246,27 @@ RemoveLayoutCallback(Widget w, XtPointer user_data, XtPointer call_data)
DrawCables();
}
+ for (i = 0; i < ((CompositeWidget)layoutp)->composite.num_children; i++) {
+ XtSetArg(args[0], XtNlabel, &str);
+ XtGetValues(((CompositeWidget)layoutp)->composite.children[i], args, 1);
+ if (strcmp(rem->lay_identifier, str) == 0) {
+ sme = ((CompositeWidget)layoutp)->composite.children[i];
+ break;
+ }
+ }
+
xf86removeLayout(XF86Config, rem);
- XtDestroyWidget(sme);
+ if (sme)
+ XtDestroyWidget(sme);
}
void
SetTip(xf86cfgDevice *device)
{
- XF86OptionPtr option;
+ XF86OptionPtr option = NULL;
char *tip, buffer[4096];
Arg args[1];
- int len;
+ int len = 0;
XtSetArg(args[0], XtNtip, &tip);
XtGetValues(device->widget, args, 1);
@@ -1423,7 +1494,7 @@ void
OptionsCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
int i;
- XF86OptionPtr *options;
+ XF86OptionPtr *options = NULL;
#ifdef USE_MODULES
xf86cfgModuleOptions *drv_opts = NULL;
#endif
@@ -1736,7 +1807,7 @@ RemoveDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data)
}
}
-static void
+void
UpdateMenuDeviceList(int type)
{
Widget sme = NULL, menu = NULL;
@@ -2126,7 +2197,7 @@ SetConfigModeCallback(Widget w, XtPointer user_data, XtPointer call_data)
XtSetArg(args[0], XtNlabel, &ptr);
XtGetValues(w, args, 1);
XtSetArg(args[0], XtNlabel, ptr);
- XtSetValues(menu, args, 1);
+ XtSetValues(topMenu, args, 1);
if (config_mode == CONFIG_LAYOUT) {
XtSetArg(args[0], XtNheight, &height);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c
index fed6b8850..2624096d0 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c
@@ -26,373 +26,361 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.5.2.1 2001/05/28 21:36:44 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.15 2001/08/17 22:08:15 tsi Exp $
*/
-#define LOADER_PRIVATE
-#include "loader.h"
-/* XXX beware (or fix it) libc functions called here are the xf86 ones */
+#include "config.h"
+#include "cards.h"
+#include "options.h"
+#include "loader.h"
+#include "stubs.h"
+#include <X11/Xresource.h>
#ifdef USE_MODULES
-static void AddModuleOptions(char*, OptionInfoPtr);
-void xf86AddDriver(DriverPtr, void*, int);
-Bool xf86ServerIsOnlyDetecting(void);
-void xf86AddInputDriver(InputDriverPtr, pointer, int);
-void xf86AddModuleInfo(ModuleInfoPtr, void*);
-Bool xf86LoaderCheckSymbol(const char*);
-void xf86LoaderReqSymLists(const char **, ...);
-void xf86Msg(int, const char*, ...);
-
-xf86cfgModuleOptions *module_options;
-
-int xf86ShowUnresolved = 1;
-
-LOOKUP miLookupTab[] = {{0,0}};
-LOOKUP dixLookupTab[] = {{0,0}};
-LOOKUP fontLookupTab[] = {{0,0}};
-LOOKUP extLookupTab[] = {{0,0}};
-LOOKUP xfree86LookupTab[] = {
- /* Loader functions */
- SYMFUNC(LoaderDefaultFunc)
- SYMFUNC(LoadSubModule)
- SYMFUNC(DuplicateModule)
- SYMFUNC(LoaderErrorMsg)
- SYMFUNC(LoaderCheckUnresolved)
- SYMFUNC(LoadExtension)
- SYMFUNC(LoadFont)
- SYMFUNC(LoaderReqSymbols)
- SYMFUNC(LoaderReqSymLists)
- SYMFUNC(LoaderRefSymbols)
- SYMFUNC(LoaderRefSymLists)
- SYMFUNC(UnloadSubModule)
- SYMFUNC(LoaderSymbol)
- SYMFUNC(LoaderListDirs)
- SYMFUNC(LoaderFreeDirList)
- SYMFUNC(LoaderGetOS)
-
- /*
- * these here are our own interfaces to libc functions
- */
- SYMFUNC(xf86abort)
- SYMFUNC(xf86abs)
- SYMFUNC(xf86acos)
- SYMFUNC(xf86asin)
- SYMFUNC(xf86atan)
- SYMFUNC(xf86atan2)
- SYMFUNC(xf86atof)
- SYMFUNC(xf86atoi)
- SYMFUNC(xf86atol)
- SYMFUNC(xf86bsearch)
- SYMFUNC(xf86ceil)
- SYMFUNC(xf86calloc)
- SYMFUNC(xf86clearerr)
- SYMFUNC(xf86close)
- SYMFUNC(xf86cos)
- SYMFUNC(xf86exit)
- SYMFUNC(xf86exp)
- SYMFUNC(xf86fabs)
- SYMFUNC(xf86fclose)
- SYMFUNC(xf86feof)
- SYMFUNC(xf86ferror)
- SYMFUNC(xf86fflush)
- SYMFUNC(xf86fgetc)
- SYMFUNC(xf86fgetpos)
- SYMFUNC(xf86fgets)
- SYMFUNC(xf86floor)
- SYMFUNC(xf86fmod)
- SYMFUNC(xf86fopen)
- SYMFUNC(xf86fprintf)
- SYMFUNC(xf86fputc)
- SYMFUNC(xf86fputs)
- SYMFUNC(xf86fread)
- SYMFUNC(xf86free)
- SYMFUNC(xf86freopen)
- SYMFUNC(xf86frexp)
- SYMFUNC(xf86fscanf)
- SYMFUNC(xf86fseek)
- SYMFUNC(xf86fsetpos)
- SYMFUNC(xf86ftell)
- SYMFUNC(xf86fwrite)
- SYMFUNC(xf86getc)
- SYMFUNC(xf86getenv)
- SYMFUNC(xf86getpagesize)
- SYMFUNC(xf86hypot)
- SYMFUNC(xf86ioctl)
- SYMFUNC(xf86isalnum)
- SYMFUNC(xf86isalpha)
- SYMFUNC(xf86iscntrl)
- SYMFUNC(xf86isdigit)
- SYMFUNC(xf86isgraph)
- SYMFUNC(xf86islower)
- SYMFUNC(xf86isprint)
- SYMFUNC(xf86ispunct)
- SYMFUNC(xf86isspace)
- SYMFUNC(xf86isupper)
- SYMFUNC(xf86isxdigit)
- SYMFUNC(xf86labs)
- SYMFUNC(xf86ldexp)
- SYMFUNC(xf86log)
- SYMFUNC(xf86log10)
- SYMFUNC(xf86lseek)
- SYMFUNC(xf86malloc)
- SYMFUNC(xf86memchr)
- SYMFUNC(xf86memcmp)
- SYMFUNC(xf86memcpy)
-#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__)
- /*
- * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
- * structure copies. This causes a problem both here and in shared
- * libraries as there is no way to map the name of the call to the
- * correct function.
- */
- SYMFUNC(memcpy)
- /*
- * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle
- * aggregate initializations.
- */
- SYMFUNC(memset)
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <setjmp.h>
+#include <signal.h>
+
+#include <stdarg.h>
+
+#ifndef SIGNALRETURNSINT
+void sig_handler(int);
+#else
+int sig_handler(int);
+#endif /* SIGNALRETURNSINT */
+
+static Bool EnumDatabase(XrmDatabase*, XrmBindingList, XrmQuarkList,
+ XrmRepresentation*, XrmValue*, XPointer);
+extern void CheckChipsets(xf86cfgModuleOptions*, int*);
+
+static jmp_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;
+
+extern FontModule *font_module;
+extern int numFontModules;
+
+char **checkerLegend;
+int *checkerErrors;
+
+#ifndef SIGNALRETURNSINT
+void
+#else
+int
#endif
- SYMFUNC(xf86memmove)
- SYMFUNC(xf86memset)
- SYMFUNC(xf86mmap)
- SYMFUNC(xf86modf)
- SYMFUNC(xf86munmap)
- SYMFUNC(xf86open)
- SYMFUNC(xf86perror)
- SYMFUNC(xf86pow)
- SYMFUNC(xf86printf)
- SYMFUNC(xf86qsort)
- SYMFUNC(xf86read)
- SYMFUNC(xf86realloc)
- SYMFUNC(xf86remove)
- SYMFUNC(xf86rename)
- SYMFUNC(xf86rewind)
- SYMFUNC(xf86setbuf)
- SYMFUNC(xf86setvbuf)
- SYMFUNC(xf86sin)
- SYMFUNC(xf86snprintf)
- SYMFUNC(xf86sprintf)
- SYMFUNC(xf86sqrt)
- SYMFUNC(xf86sscanf)
- SYMFUNC(xf86strcat)
- SYMFUNC(xf86strcmp)
- SYMFUNC(xf86strcasecmp)
- SYMFUNC(xf86strcpy)
- SYMFUNC(xf86strcspn)
- SYMFUNC(xf86strerror)
- SYMFUNC(xf86strlen)
- SYMFUNC(xf86strncmp)
- SYMFUNC(xf86strncasecmp)
- SYMFUNC(xf86strncpy)
- SYMFUNC(xf86strpbrk)
- SYMFUNC(xf86strchr)
- SYMFUNC(xf86strrchr)
- SYMFUNC(xf86strspn)
- SYMFUNC(xf86strstr)
- SYMFUNC(xf86strtod)
- SYMFUNC(xf86strtok)
- SYMFUNC(xf86strtol)
- SYMFUNC(xf86strtoul)
- SYMFUNC(xf86tan)
- SYMFUNC(xf86tmpfile)
- SYMFUNC(xf86tolower)
- SYMFUNC(xf86toupper)
- SYMFUNC(xf86ungetc)
- SYMFUNC(xf86vfprintf)
- SYMFUNC(xf86vsnprintf)
- SYMFUNC(xf86vsprintf)
- SYMFUNC(xf86write)
-
-/* non-ANSI C functions */
- SYMFUNC(xf86opendir)
- SYMFUNC(xf86closedir)
- SYMFUNC(xf86readdir)
- SYMFUNC(xf86rewinddir)
- SYMFUNC(xf86ffs)
- SYMFUNC(xf86strdup)
- SYMFUNC(xf86bzero)
- SYMFUNC(xf86usleep)
- SYMFUNC(xf86execl)
-
- SYMFUNC(xf86getsecs)
- SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */
-
- SYMFUNC(xf86stat)
- SYMFUNC(xf86fstat)
- SYMFUNC(xf86access)
- SYMFUNC(xf86geteuid)
- SYMFUNC(xf86getegid)
- SYMFUNC(xf86getpid)
- SYMFUNC(xf86mknod)
- SYMFUNC(xf86chmod)
- SYMFUNC(xf86chown)
- SYMFUNC(xf86sleep)
- SYMFUNC(xf86mkdir)
- SYMFUNC(xf86shmget)
- SYMFUNC(xf86shmat)
- SYMFUNC(xf86shmdt)
- SYMFUNC(xf86shmctl)
- SYMFUNC(xf86setjmp)
- SYMFUNC(xf86longjmp)
-
- SYMFUNC(xf86AddDriver)
- SYMFUNC(xf86ServerIsOnlyDetecting)
- SYMFUNC(xf86AddInputDriver)
- SYMFUNC(xf86AddModuleInfo)
- SYMFUNC(xf86LoaderCheckSymbol)
-
- SYMFUNC(xf86LoaderReqSymLists)
- SYMFUNC(xf86Msg)
- SYMFUNC(ErrorF)
- {0,0}
-};
-
-static DriverPtr driver;
-static ModuleInfoPtr info;
-static ModuleType type = GenericModule;
-
-static void
-AddModuleOptions(char *name, OptionInfoPtr option)
+sig_handler(int sig)
{
- xf86cfgModuleOptions *ptr;
- OptionInfoPtr tmp;
-
- ptr = XtNew(xf86cfgModuleOptions);
- ptr->name = XtNewString(name);
- ptr->type = type;
- if (option) {
- int count;
-
- for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++)
- ;
- ++count;
- ptr->option = (XtPointer)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);
- }
+ 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;
}
- else
- ptr->option = NULL;
- ptr->next = module_options;
- module_options = ptr;
+ 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);
+ error_level += 50;
+ longjmp(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]);
+
+ option = module_options->option;
+ while (option->name) {
+ if (strcmp(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 *path = NULL, *modules = "lib/modules";
- int saveVerbose = xf86Verbose;
+ static char *modules = "lib/modules";
+ Bool options_ok = False;
+ char query[256];
+ char *type;
+ XrmValue value;
+ XrmQuark names[2];
+ XrmQuark classes[2];
+ int i;
+ static ModuleType module_types[] = {
+ GenericModule, FontRendererModule, 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", "Font Module"
+ };
if (first) {
- xf86Verbose = 10;
- LoaderInit();
+ 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 /usr/X11R6/lib/X11/Options was not found.\n"
+ "In the sources, it is at xc/programs/Xserver/hw/xfree86/Options.";
+ 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 and a font renderer\n"
+ "module did not call LoadFont. This message can also be printed if\n"
+ "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 XF86Config, 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.";
}
- xf86Verbose = saveVerbose;
if (XF86Module_path == NULL) {
- XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2);
+ XF86Module_path = malloc(strlen(XFree86Dir) + strlen(modules) + 2);
sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules);
}
- if (path == NULL || strcmp(XF86Module_path, path)) {
- char **list, **l;
- const char *subdirs[] = {
- ".",
- "drivers",
- "input",
- NULL
- };
- int errmaj, errmin;
- ModuleDescPtr module;
-
- path = strdup(XF86Module_path);
- LoaderSetPath(path);
-
- list = LoaderListDirs(subdirs, NULL);
- if (list) {
-#if 0
- if (ptr) {
- while (module_options) {
- module_options = module_options->next;
- XtFree(ptr->name);
- XtFree((XtPointer)ptr->option);
- XtFree((XtPointer)ptr);
- ptr = module_options;
- }
- }
-#endif
- for (l = list; *l; l++) {
- driver = NULL;
- info = NULL;
- type = GenericModule;
- xf86Verbose = 0;
- if ((module = LoadModule(*l, NULL, NULL, NULL, NULL,
- NULL, &errmaj, &errmin)) == NULL)
- LoaderErrorMsg(NULL, *l, errmaj, errmin);
- else if (driver && driver->AvailableOptions)
- AddModuleOptions(*l, (*driver->AvailableOptions)(-1, -1));
- else if (info && info->AvailableOptions)
- AddModuleOptions(*l, (*info->AvailableOptions)(NULL));
-
- UnloadModule(module);
- xf86Verbose = saveVerbose;
- }
- LoaderFreeDirList(list);
- }
- else {
- xf86Verbose = saveVerbose;
- return (False);
- }
+ if (loaderPath == NULL || strcmp(XF86Module_path, loaderPath))
+ loaderPath = strdup(XF86Module_path);
+ else
+ /* nothing new */
+ return (True);
+
+ if (!noverify) {
+ options_ok = InitializeOptionsDatabase();
+ InitializePciInfo();
}
- xf86Verbose = saveVerbose;
+ 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]]);
- return (True);
-}
+ if (loaderList) {
+ for (ploaderList = loaderList; *ploaderList; ploaderList++) {
+ if (!noverify) {
+ if (setjmp(jmp) == 0) {
+ int ok, nfont_modules;
-void
-xf86AddDriver(DriverPtr drv, void *module, int flags)
-{
- driver = drv;
- type = VideoModule;
-}
+ nfont_modules = numFontModules;
+ error_level = 0;
+ signal_caught = 0;
+ signal(SIGTRAP, sig_handler);
+ signal(SIGBUS, sig_handler);
+ signal(SIGSEGV, sig_handler);
+ signal(SIGILL, sig_handler);
+ signal(SIGFPE, sig_handler);
+ 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;
+ }
+ signal(SIGTRAP, SIG_DFL);
+ signal(SIGBUS, SIG_DFL);
+ signal(SIGSEGV, SIG_DFL);
+ signal(SIGILL, SIG_DFL);
+ signal(SIGFPE, SIG_DFL);
+ 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;
-Bool
-xf86ServerIsOnlyDetecting(void)
-{
- return (True);
-}
+ while (option->name) {
+ XmuSnprintf(query, sizeof(query), "%s.%s", *ploaderList, option->name);
+ if (!XrmGetResource(options_xrm, query, "Module.Option", &type, &value) ||
+ value.addr == NULL) {
+ CheckMsg(CHECKER_OPTION_DESCRIPTION_MISSING,
+ "WARNING no description for %s\n", query);
+ ++error_level;
+ }
+ ++option;
+ }
-void
-xf86AddInputDriver(InputDriverPtr inp, void *module, int flags)
-{
- type = InputModule;
-}
+ /* 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;
+ }
-void
-xf86AddModuleInfo(ModuleInfoPtr inf, void *module)
-{
- info = inf;
-}
+ 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);
+ }
+ }
-Bool
-xf86LoaderCheckSymbol(const char *symbol)
-{
- return LoaderSymbol(symbol) != NULL;
-}
+ /* font modules check */
+ if (module_type == FontRendererModule) {
+ if (strcmp(*ploaderList, font_module->name)) {
+ /* not an error */
+ ErrorF(" NOTICE FontModule->name specification mismatch: \"%s\" \"%s\"\n",
+ *ploaderList, font_module->name);
+ }
+ if (nfont_modules + 1 != numFontModules) {
+ /* not an error */
+ ErrorF(" NOTICE font module \"%s\" loaded more than one font renderer.\n",
+ *ploaderList);
+ }
+ }
+ else if (nfont_modules != numFontModules) {
+ ErrorF(" WARNING number of font modules changed from %d to %d.\n",
+ nfont_modules, numFontModules);
+ ++error_level;
+ }
+ }
+ }
+ ErrorF(" SUMMARY error_level set to %d.\n\n", error_level);
+ }
+ else
+ (void)xf86cfgCheckModule();
+ }
+ xf86cfgLoaderFreeList();
+ }
+ else
+ ErrorF(" ERROR Failed to initialize module list.\n");
+ }
-void
-xf86LoaderReqSymLists(const char **list0, ...)
-{
-}
+ 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]);
+ }
+ }
-void xf86Msg(int type, const char *format, ...)
-{
+ return (True);
}
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h
index d3d763cab..f3f8490bc 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h
@@ -26,80 +26,45 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h,v 1.4 2001/05/18 20:22:31 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h,v 1.7 2001/07/09 23:45:24 paulo Exp $
*/
+
#ifdef USE_MODULES
+#ifndef LOADER_PRIVATE
#include "config.h"
#include "stubs.h"
-#ifndef _xf86cfg_loader_h
-#define _xf86cfg_loader_h
-
-#ifdef LOADER_PRIVATE
-#include <sym.h>
+#else
#define XFree86LOADER /* not really */
+#define IN_LOADER
+
+#include "xf86.h"
+#include "xf86str.h"
+#include "xf86Opt.h"
+#include "xf86Module.h"
+
+#define XINPUT
+#include "xf86Xinput.h"
+
+#include "fontmod.h"
+#include "loaderProcs.h"
+
+#include <sym.h>
#include <xf86_ansic.h>
-/* common/xf86Module.h */
-pointer LoadModule(const char *, const char *, const char **,
- const char **, pointer, const pointer *,
- int *, int *);
-pointer LoadSubModule(pointer, const char *, const char **,
- const char **, pointer, const pointer *,
- int *, int *);
-void UnloadSubModule(pointer);
-void LoadFont(pointer);
-void UnloadModule (pointer);
-pointer LoaderSymbol(const char *);
-char **LoaderListDirs(const char **, const char **);
-void LoaderFreeDirList(char **);
-void LoaderErrorMsg(const char *, const char *, int, int);
-void LoadExtension(pointer, Bool);
-void LoaderRefSymLists(const char **, ...);
-void LoaderRefSymbols(const char *, ...);
-void LoaderReqSymLists(const char **, ...);
-void LoaderReqSymbols(const char *, ...);
-int LoaderCheckUnresolved(int);
-void LoaderGetOS(const char **name, int *major, int *minor, int *teeny);
-
-typedef pointer (*ModuleSetupProc)(pointer, pointer, int *, int *);
-typedef void (*ModuleTearDownProc)(pointer);
-
-/* loader/loader.h */
void LoaderDefaultFunc(void);
+#endif
-/* loader/loaderProcs.h */
-typedef struct module_desc {
- struct module_desc *child;
- struct module_desc *sib;
- struct module_desc *parent;
- struct module_desc *demand_next;
- char *name;
- char *filename;
- char *identifier;
- XID client_id;
- int in_use;
- int handle;
- ModuleSetupProc SetupProc;
- ModuleTearDownProc TearDownProc;
- void *TearDownData; /* returned from SetupProc */
- const char *path;
-} ModuleDesc, *ModuleDescPtr;
-
-void LoaderInit(void);
-
-ModuleDescPtr LoadDriver(const char *, const char *, int, pointer, int *,
- int *);
-ModuleDescPtr DuplicateModule(ModuleDescPtr mod, ModuleDescPtr parent);
-void UnloadDriver (ModuleDescPtr);
-void FreeModuleDesc (ModuleDescPtr mod);
-ModuleDescPtr NewModuleDesc (const char *);
-ModuleDescPtr AddSibling (ModuleDescPtr head, ModuleDescPtr new);
-void LoaderSetPath(const char *path);
-void LoaderSortExtensions(void);
-#endif /* LOADER_PRIVATE */
+#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;
@@ -138,78 +103,69 @@ typedef struct {
Bool found;
} OptionInfoRec, *OptionInfoPtr;
-#ifdef LOADER_PRIVATE
-/* common/xf86str.h */
-typedef struct _DriverRec {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- Bool (*Probe)(struct _DriverRec *drv, int flags);
- OptionInfoPtr (*AvailableOptions)(int chipid, int bustype);
- void * module;
- int refCount;
-} DriverRec, *DriverPtr;
-
-typedef struct _InputDriverRec {
- int driverVersion;
- char * driverName;
- void (*Identify)(int flags);
- struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv,
- void *dev, int flags);
- void (*UnInit)(struct _InputDriverRec *drv,
- void *pInfo,
- int flags);
- pointer module;
- int refCount;
-} InputDriverRec, *InputDriverPtr;
-
-typedef struct _loader_item *itemPtr;
-typedef struct _loader_item {
- char *name ;
- void *address ;
- itemPtr next ;
- int handle ;
- int module ;
- itemPtr exports;
-#if defined(__powerpc__)
- /*
- * PowerPC file formats require special routines in some circumstances
- * to assist in the linking process. See the specific loader for
- * more details.
- */
- union {
- unsigned short plt[8]; /* ELF */
- unsigned short glink[14]; /* XCOFF */
- } code ;
-#endif
- } itemRec ;
-
-typedef struct _ModuleInfoRec {
- int moduleVersion;
- char * moduleName;
- pointer module;
- int refCount;
- OptionInfoRec * (*AvailableOptions)(void *unused);
- pointer unused[2]; /* leave some space for more fields */
-} ModuleInfoRec, *ModuleInfoPtr;
-#endif /* LOADER_PRIVATE */
+/* fontmod.h */
+typedef void (*InitFont)(void);
+
+typedef struct {
+ InitFont initFunc;
+ char * name;
+ void *module;
+} FontModule;
+
+extern FontModule *FontModuleList;
+
+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
+ GenericModule,
+ FontRendererModule
} ModuleType;
typedef struct _xf86cfgModuleOptions {
char *name;
ModuleType type;
OptionInfoPtr option;
+ int vendor;
+ SymTabPtr chipsets;
struct _xf86cfgModuleOptions *next;
} xf86cfgModuleOptions;
extern xf86cfgModuleOptions *module_options;
-Bool LoaderInitializeOptions(void);
+/* When adding a new code to the LEGEND, also update checkerLegend
+ * in loader.c
+ */
+extern char **checkerLegend;
+extern int *checkerErrors;
+#define CHECKER_OPTIONS_FILE_MISSING 1
+#define CHECKER_OPTION_DESCRIPTION_MISSING 2
+#define CHECKER_LOAD_FAILED 3
+#define CHECKER_RECOGNIZED_AS 4
+#define CHECKER_NO_OPTIONS_AVAILABLE 5
+#define CHECKER_NO_VENDOR_CHIPSET 6
+#define CHECKER_CANNOT_VERIFY_CHIPSET 7
+#define CHECKER_OPTION_UNUSED 8
+#define CHECKER_NOMATCH_CHIPSET_STRINGS 9
+#define CHECKER_CHIPSET_NOT_LISTED 10
+#define CHECKER_CHIPSET_NOT_SUPPORTED 11
+#define CHECKER_CHIPSET_NO_VENDOR 12
+#define CHECKER_NO_CHIPSETS 13
+#define CHECKER_FILE_MODULE_NAME_MISMATCH 14
+
+#define CHECKER_LAST_MESSAGE 14
+
+extern void CheckMsg(int, char*, ...);
+
+#ifndef LOADER_PRIVATE
+int LoaderInitializeOptions(void);
+#endif
#endif /* USE_MODULES */
#endif /* _xf86cfg_loader_h */
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c
new file mode 100644
index 000000000..d1f78a64c
--- /dev/null
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/loadmod.c
@@ -0,0 +1,595 @@
+/*
+ * 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/loadmod.c,v 1.7 2001/08/01 00:44:57 tsi Exp $
+ */
+
+#ifdef USE_MODULES
+#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 xf86LoaderReqSymLists(const char **, ...);
+void xf86Msg(int, const char*, ...);
+void xf86PrintChipsets(const char*, const char*, SymTabPtr);
+void xf86ErrorFVerb(int verb, const char *format, ...);
+pciVideoPtr *xf86GetPciVideoInfo(void);
+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*, ...);
+#endif
+void *xf86GetPciConfigInfo(void);
+
+extern char *loaderPath, **loaderList, **ploaderList;
+xf86cfgModuleOptions *module_options;
+FontModule *font_module;
+int numFontModules;
+
+extern int noverify, error_level;
+
+int xf86ShowUnresolved = 1;
+
+LOOKUP miLookupTab[] = {{0,0}};
+LOOKUP dixLookupTab[] = {{0,0}};
+LOOKUP fontLookupTab[] = {{0,0}};
+LOOKUP extLookupTab[] = {{0,0}};
+LOOKUP xfree86LookupTab[] = {
+ /* Loader functions */
+ SYMFUNC(LoaderDefaultFunc)
+ SYMFUNC(LoadSubModule)
+ SYMFUNC(DuplicateModule)
+ SYMFUNC(LoaderErrorMsg)
+ SYMFUNC(LoaderCheckUnresolved)
+ SYMFUNC(LoadExtension)
+ SYMFUNC(LoadFont)
+ SYMFUNC(LoaderReqSymbols)
+ SYMFUNC(LoaderReqSymLists)
+ SYMFUNC(LoaderRefSymbols)
+ SYMFUNC(LoaderRefSymLists)
+ SYMFUNC(UnloadSubModule)
+ SYMFUNC(LoaderSymbol)
+ SYMFUNC(LoaderListDirs)
+ SYMFUNC(LoaderFreeDirList)
+ SYMFUNC(LoaderGetOS)
+
+ /*
+ * these here are our own interfaces to libc functions
+ */
+ SYMFUNC(xf86abort)
+ SYMFUNC(xf86abs)
+ SYMFUNC(xf86acos)
+ SYMFUNC(xf86asin)
+ SYMFUNC(xf86atan)
+ SYMFUNC(xf86atan2)
+ SYMFUNC(xf86atof)
+ SYMFUNC(xf86atoi)
+ SYMFUNC(xf86atol)
+ SYMFUNC(xf86bsearch)
+ SYMFUNC(xf86ceil)
+ SYMFUNC(xf86calloc)
+ SYMFUNC(xf86clearerr)
+ SYMFUNC(xf86close)
+ SYMFUNC(xf86cos)
+ SYMFUNC(xf86exit)
+ SYMFUNC(xf86exp)
+ SYMFUNC(xf86fabs)
+ SYMFUNC(xf86fclose)
+ SYMFUNC(xf86feof)
+ SYMFUNC(xf86ferror)
+ SYMFUNC(xf86fflush)
+ SYMFUNC(xf86fgetc)
+ SYMFUNC(xf86fgetpos)
+ SYMFUNC(xf86fgets)
+ SYMFUNC(xf86floor)
+ SYMFUNC(xf86fmod)
+ SYMFUNC(xf86fopen)
+ SYMFUNC(xf86fprintf)
+ SYMFUNC(xf86fputc)
+ SYMFUNC(xf86fputs)
+ SYMFUNC(xf86fread)
+ SYMFUNC(xf86free)
+ SYMFUNC(xf86freopen)
+ SYMFUNC(xf86frexp)
+ SYMFUNC(xf86fscanf)
+ SYMFUNC(xf86fseek)
+ SYMFUNC(xf86fsetpos)
+ SYMFUNC(xf86ftell)
+ SYMFUNC(xf86fwrite)
+ SYMFUNC(xf86getc)
+ SYMFUNC(xf86getenv)
+ SYMFUNC(xf86getpagesize)
+ SYMFUNC(xf86hypot)
+ SYMFUNC(xf86ioctl)
+ SYMFUNC(xf86isalnum)
+ SYMFUNC(xf86isalpha)
+ SYMFUNC(xf86iscntrl)
+ SYMFUNC(xf86isdigit)
+ SYMFUNC(xf86isgraph)
+ SYMFUNC(xf86islower)
+ SYMFUNC(xf86isprint)
+ SYMFUNC(xf86ispunct)
+ SYMFUNC(xf86isspace)
+ SYMFUNC(xf86isupper)
+ SYMFUNC(xf86isxdigit)
+ SYMFUNC(xf86labs)
+ SYMFUNC(xf86ldexp)
+ SYMFUNC(xf86log)
+ SYMFUNC(xf86log10)
+ SYMFUNC(xf86lseek)
+ SYMFUNC(xf86malloc)
+ SYMFUNC(xf86memchr)
+ SYMFUNC(xf86memcmp)
+ SYMFUNC(xf86memcpy)
+#if (defined(__powerpc__) && (defined(Lynx) || defined(linux))) || defined(__sparc__) || defined(__ia64__)
+ /*
+ * Some PPC, SPARC, and IA64 compilers generate calls to memcpy to handle
+ * structure copies. This causes a problem both here and in shared
+ * libraries as there is no way to map the name of the call to the
+ * correct function.
+ */
+ SYMFUNC(memcpy)
+ /*
+ * Some PPC, SPARC, and IA64 compilers generate calls to memset to handle
+ * aggregate initializations.
+ */
+ SYMFUNC(memset)
+#endif
+ SYMFUNC(xf86memmove)
+ SYMFUNC(xf86memset)
+ SYMFUNC(xf86mmap)
+ SYMFUNC(xf86modf)
+ SYMFUNC(xf86munmap)
+ SYMFUNC(xf86open)
+ SYMFUNC(xf86perror)
+ SYMFUNC(xf86pow)
+ SYMFUNC(xf86printf)
+ SYMFUNC(xf86qsort)
+ SYMFUNC(xf86read)
+ SYMFUNC(xf86realloc)
+ SYMFUNC(xf86remove)
+ SYMFUNC(xf86rename)
+ SYMFUNC(xf86rewind)
+ SYMFUNC(xf86setbuf)
+ SYMFUNC(xf86setvbuf)
+ SYMFUNC(xf86sin)
+ SYMFUNC(xf86snprintf)
+ SYMFUNC(xf86sprintf)
+ SYMFUNC(xf86sqrt)
+ SYMFUNC(xf86sscanf)
+ SYMFUNC(xf86strcat)
+ SYMFUNC(xf86strcmp)
+ SYMFUNC(xf86strcasecmp)
+ SYMFUNC(xf86strcpy)
+ SYMFUNC(xf86strcspn)
+ SYMFUNC(xf86strerror)
+ SYMFUNC(xf86strlen)
+ SYMFUNC(xf86strncmp)
+ SYMFUNC(xf86strncasecmp)
+ SYMFUNC(xf86strncpy)
+ SYMFUNC(xf86strpbrk)
+ SYMFUNC(xf86strchr)
+ SYMFUNC(xf86strrchr)
+ SYMFUNC(xf86strspn)
+ SYMFUNC(xf86strstr)
+ SYMFUNC(xf86strtod)
+ SYMFUNC(xf86strtok)
+ SYMFUNC(xf86strtol)
+ SYMFUNC(xf86strtoul)
+ SYMFUNC(xf86tan)
+ SYMFUNC(xf86tmpfile)
+ SYMFUNC(xf86tolower)
+ SYMFUNC(xf86toupper)
+ SYMFUNC(xf86ungetc)
+ SYMFUNC(xf86vfprintf)
+ SYMFUNC(xf86vsnprintf)
+ SYMFUNC(xf86vsprintf)
+ SYMFUNC(xf86write)
+
+/* non-ANSI C functions */
+ SYMFUNC(xf86opendir)
+ SYMFUNC(xf86closedir)
+ SYMFUNC(xf86readdir)
+ SYMFUNC(xf86rewinddir)
+ SYMFUNC(xf86ffs)
+ SYMFUNC(xf86strdup)
+ SYMFUNC(xf86bzero)
+ SYMFUNC(xf86usleep)
+ SYMFUNC(xf86execl)
+
+ SYMFUNC(xf86getsecs)
+ SYMFUNC(xf86fpossize) /* for returning sizeof(fpos_t) */
+
+ SYMFUNC(xf86stat)
+ SYMFUNC(xf86fstat)
+ SYMFUNC(xf86access)
+ SYMFUNC(xf86geteuid)
+ SYMFUNC(xf86getegid)
+ SYMFUNC(xf86getpid)
+ SYMFUNC(xf86mknod)
+ SYMFUNC(xf86chmod)
+ SYMFUNC(xf86chown)
+ SYMFUNC(xf86sleep)
+ SYMFUNC(xf86mkdir)
+ SYMFUNC(xf86shmget)
+ SYMFUNC(xf86shmat)
+ SYMFUNC(xf86shmdt)
+ SYMFUNC(xf86shmctl)
+ SYMFUNC(xf86setjmp)
+ SYMFUNC(xf86longjmp)
+
+ SYMFUNC(xf86AddDriver)
+ SYMFUNC(xf86ServerIsOnlyDetecting)
+ SYMFUNC(xf86AddInputDriver)
+ SYMFUNC(xf86AddModuleInfo)
+ SYMFUNC(xf86LoaderCheckSymbol)
+
+ SYMFUNC(xf86LoaderReqSymLists)
+ SYMFUNC(xf86Msg)
+ SYMFUNC(ErrorF)
+ SYMFUNC(xf86PrintChipsets)
+ SYMFUNC(xf86ErrorFVerb)
+ SYMFUNC(xf86GetPciVideoInfo)
+ SYMFUNC(xf86MatchDevice)
+ SYMFUNC(xf86MatchPciInstances)
+ SYMFUNC(xf86MatchIsaInstances)
+ SYMFUNC(Xfree)
+ SYMFUNC(xf86LoadDrvSubModule)
+ SYMFUNC(xf86DrvMsg)
+ SYMFUNC(xf86GetPciConfigInfo)
+ {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;
+
+ 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
+ };
+ static const char *font[] = {
+ "fonts",
+ NULL
+ };
+ const char **subdirs;
+
+ switch (type) {
+ case GenericModule:
+ subdirs = generic;
+ break;
+ case VideoModule:
+ subdirs = video;
+ break;
+ case InputModule:
+ subdirs = input;
+ break;
+ case FontRendererModule:
+ subdirs = font;
+ break;
+ default:
+ fprintf(stderr, "Invalid value passed to xf86cfgLoaderInitList.\n");
+ subdirs = generic;
+ break;
+ }
+ LoaderSetPath(loaderPath);
+ loaderList = LoaderListDirs(subdirs, NULL);
+}
+
+void
+xf86cfgLoaderFreeList(void)
+{
+ LoaderFreeDirList(loaderList);
+}
+
+int
+xf86cfgCheckModule(void)
+{
+ int errmaj, errmin;
+ ModuleDescPtr module;
+ int nfonts;
+ FontModule *fonts, *pfont_module;
+
+ driver = NULL;
+ chips = NULL;
+ info = NULL;
+ pfont_module = 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);
+ }
+
+ nfonts = numFontModules;
+ numFontModules = 0;
+ fonts = FontModuleList;
+ if (fonts) {
+ while (fonts->name) {
+ if (strcmp(fonts->name, *ploaderList) == 0)
+ pfont_module = fonts;
+ ++numFontModules;
+ ++fonts;
+ }
+ }
+ if (pfont_module)
+ module_type = FontRendererModule;
+ else if (nfonts + 1 <= numFontModules) {
+ /* loader.c will flag a warning if -noverify is not set */
+ pfont_module = &FontModuleList[nfonts];
+ module_type = FontRendererModule;
+ }
+
+ if (font_module) {
+ XtFree((XtPointer)font_module->name);
+ XtFree((XtPointer)font_module);
+ font_module = NULL;
+ }
+ if (pfont_module) {
+ font_module = XtNew(FontModule);
+ memcpy(font_module, pfont_module, sizeof(FontModule));
+ font_module->name = XtNewString(pfont_module->name);
+ }
+
+ UnloadModule(module);
+
+ return (1);
+}
+
+void
+xf86AddDriver(DriverPtr drv, void *module, int flags)
+{
+ driver = drv;
+ if (driver)
+ driver->module = module;
+ module_type = VideoModule;
+}
+
+Bool
+xf86ServerIsOnlyDetecting(void)
+{
+ return (True);
+}
+
+void
+xf86AddInputDriver(InputDriverPtr inp, void *module, int flags)
+{
+ module_type = InputModule;
+}
+
+void
+xf86AddModuleInfo(ModuleInfoPtr inf, void *module)
+{
+ info = inf;
+}
+
+Bool
+xf86LoaderCheckSymbol(const char *symbol)
+{
+ return LoaderSymbol(symbol) != NULL;
+}
+
+void
+xf86LoaderReqSymLists(const char **list0, ...)
+{
+}
+
+#if 0
+void xf86Msg(int type, const char *format, ...)
+{
+}
+#endif
+
+/*ARGSUSED*/
+void
+xf86PrintChipsets(const char *name, const char *msg, SymTabPtr chipsets)
+{
+ vendor = 0;
+ chips = chipsets;
+}
+
+pciVideoPtr *
+xf86GetPciVideoInfo(void)
+{
+ static pciVideoRec pci_video;
+ static pciVideoPtr pci_video_ptr[2] = { &pci_video };
+
+ memset(&pci_video, 0, sizeof(pciVideoRec));
+
+ return (pci_video_ptr);
+}
+
+int
+xf86MatchDevice(const char *name, GDevPtr **gdev)
+{
+ *gdev = NULL;
+
+ return (1);
+}
+
+int
+xf86MatchPciInstances(const char *name, int VendorID, SymTabPtr chipsets, PciChipsets *PCIchipsets,
+ GDevPtr *devList, int numDevs, DriverPtr drvp, int **foundEntities)
+{
+ vendor = VendorID;
+ chips = chipsets;
+ *foundEntities = NULL;
+
+ return (0);
+}
+
+int
+xf86MatchIsaInstances(const char *name, SymTabPtr chipsets, IsaChipsets *ISAchipsets, DriverPtr drvp,
+ FindIsaDevProc FindIsaDevice, GDevPtr *devList, int numDevs, int **foundEntities)
+{
+ *foundEntities = NULL;
+
+ return (0);
+}
+
+/*ARGSUSED*/
+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);
+}
+
+void *
+xf86GetPciConfigInfo(void)
+{
+ return (NULL);
+}
+#endif
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c
index 8c6f6661c..00724873c 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.6.2.2 2001/05/25 21:45:01 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.10 2001/07/06 02:04:10 paulo Exp $
*/
#include "options.h"
@@ -67,7 +67,7 @@ static Widget add, remov, update, list, name, value;
static char *option_str;
static int option_index, popped = False;
static char *Options = "lib/X11/Options";
-static XrmDatabase xrm;
+XrmDatabase options_xrm;
#ifdef USE_MODULES
static Widget modList, optList, desc, modOptionsShell, labelType;
static char *module_sel;
@@ -552,6 +552,10 @@ SelectModuleCallback(Widget w, XtPointer user_data, XtPointer call_data)
XtVaSetValues(desc, XtNstring, "", NULL);
XawListUnhighlight(optList);
+
+ /* force relayout */
+ XtUnmanageChild(optList);
+ XtManageChild(optList);
}
}
@@ -644,25 +648,35 @@ UpdateOption(Widget w, XtPointer user_data, XtPointer call_data)
XtSetSensitive(update, True);
}
-char *
-GetOptionDescription(char *module, char *option)
+Bool
+InitializeOptionsDatabase(void)
{
static int first = 1;
- char *type;
- XrmValue value;
- char query[256];
+ static Bool result = True;
if (first) {
first = 0;
XrmInitialize();
- if ((xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) {
+ if ((options_xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) {
fprintf(stderr, "Cannot open '%s' database.\n", Options);
- return (NULL);
+ return (result = False);
}
}
+ return (result);
+}
+
+char *
+GetOptionDescription(char *module, char *option)
+{
+ char *type;
+ XrmValue value;
+ char query[256];
+
+ InitializeOptionsDatabase();
+
XmuSnprintf(query, sizeof(query), "%s.%s", module, option);
- if (XrmGetResource(xrm, query, "Module.Option", &type, &value))
+ if (XrmGetResource(options_xrm, query, "Module.Option", &type, &value))
return ((char*)value.addr);
return (NULL);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h
index 6c754f86b..a90072607 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/options.h
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.4.2.1 2001/05/25 21:45:01 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.7 2001/07/06 02:04:10 paulo Exp $
*/
#include "config.h"
@@ -46,5 +46,6 @@ void OptionsPopup(XF86OptionPtr*);
void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*);
void ModuleOptionsCancelAction(Widget, XEvent*, String*, Cardinal*);
char *GetOptionDescription(char *module, char *option);
+Bool InitializeOptionsDatabase(void);
-void CreateOptionsShell(void); \ No newline at end of file
+void CreateOptionsShell(void);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
index 7a166623d..36f40828e 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.8.2.1 2001/05/21 22:24:02 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.9 2001/05/21 22:21:57 paulo Exp $
*/
#include "xf86config.h"
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
index 227701269..3b2f194f6 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.6 2001/03/24 01:17:21 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.7 2001/07/08 05:46:35 paulo Exp $
*/
#include <X11/IntrinsicP.h>
@@ -650,48 +650,46 @@ AdjustScreenUI(void)
XtUnmapWidget(work);
while (adj) {
- xf86cfgScreen *scr, *topscr, *botscr, *lefscr, *rigscr;
+ 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;
- topscr = computer.screens[i];
+ if (i < computer.num_screens)
+ topscr = computer.screens[i];
}
- else
- topscr = NULL;
if (adj->adj_bottom != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_bottom)
break;
- botscr = computer.screens[i];
+ if (i < computer.num_screens)
+ botscr = computer.screens[i];
}
- else
- botscr = NULL;
if (adj->adj_left != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_left)
break;
- lefscr = computer.screens[i];
+ if (i < computer.num_screens)
+ lefscr = computer.screens[i];
}
- else
- lefscr = NULL;
if (adj->adj_right != NULL) {
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == adj->adj_right)
break;
- rigscr = computer.screens[i];
+ if (i < computer.num_screens)
+ rigscr = computer.screens[i];
}
- else
- rigscr = NULL;
if (lefscr == NULL && rigscr == NULL && topscr == NULL && lefscr == NULL) {
XF86ConfScreenPtr s;
@@ -701,19 +699,21 @@ AdjustScreenUI(void)
for (i = 0; i < computer.num_screens; i++)
if (computer.screens[i]->screen == s)
break;
- 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;
+ 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;
+ }
}
}
}
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h
index 42d802307..d554ac17a 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h,v 1.2 2000/10/23 21:16:52 tsi Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/stubs.h,v 1.3 2001/08/01 00:44:57 tsi Exp $
*/
#ifndef _xf86cfg_stubs_h
@@ -34,10 +34,9 @@
#include <stdarg.h>
-#if !defined(USE_MODULES)
int ErrorF(const char*, ...);
int VErrorF(const char*, va_list);
-#else
+#if defined(USE_MODULES)
extern int xf86Verbose;
#endif
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c
index 0849deee5..7d0531e36 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.10.2.1 2001/05/21 22:24:02 paulo Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.13 2001/07/10 21:46:27 paulo Exp $
*/
#include <stdio.h>
@@ -40,6 +40,7 @@
#include "cards.h"
#include "config.h"
#include "xf86config.h"
+#include "loader.h"
#define XKB_RULES_DIR "/usr/X11R6/lib/X11/xkb/rules"
@@ -80,14 +81,6 @@ static XF86ConfInputrefPtr CopyInputref(XF86ConfInputrefPtr);
static XF86ConfInactivePtr CopyInactive(XF86ConfInactivePtr);
static void FreeLayout(XF86ConfLayoutPtr);
-#ifdef USE_MODULES
-extern void LoaderInit(void);
-extern void LoaderSetPath(char*);
-extern char **LoaderListDirs(char**, char**);
-
-extern int xf86Verbose;
-#endif
-
extern int string_to_parser_range(char*, parser_range*, int);
#define PARSER_RANGE_SIZE 256
/* string must have at least 256 bytes */
@@ -130,6 +123,10 @@ TextMode(void)
static int first = 1;
int i, choice = CONF_MOUSE;
+#ifdef USE_MODULES
+ if (!nomodules)
+ LoaderInitializeOptions();
+#endif
initscr();
noecho();
nonl();
@@ -656,7 +653,7 @@ KeyboardConfig(void)
refresh();
input->inp_identifier =
DialogInput("Keyboard identifier",
- "Enter an identifier for your mouse definition:",
+ "Enter an identifier for your keyboard definition:",
11, 40, label,
" Next >>", " Cancel ", 0);
if (input->inp_identifier == NULL) {
@@ -1057,13 +1054,6 @@ CardConfig(void)
CardsEntry *entry = NULL;
static char **drivers;
static int ndrivers;
-#ifdef USE_MODULES
- static char *path = NULL, *modules = "lib/modules";
- const char *subdirs[] = {
- "drivers",
- NULL
- };
-#endif
static char *xdrivers[] = {
"apm",
"ark",
@@ -1095,19 +1085,19 @@ CardConfig(void)
#ifdef USE_MODULES
if (!nomodules) {
- if (XF86Module_path == NULL) {
- XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2);
- sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules);
- }
-
- if (drivers == NULL) {
- xf86Verbose = 0;
- LoaderInit();
- path = XtNewString(XF86Module_path);
- LoaderSetPath(path);
- drivers = LoaderListDirs((char**)subdirs, NULL);
- for (; drivers[ndrivers]; ndrivers++)
- ;
+ xf86cfgModuleOptions *opts = module_options;
+
+ drivers = NULL;
+ ndrivers = 0;
+ while (opts) {
+ if (opts->chipsets) {
+ ++ndrivers;
+ drivers = (char**)XtRealloc((XtPointer)drivers,
+ ndrivers * sizeof(char*));
+ /* XXX no private copy */
+ drivers[ndrivers - 1] = opts->name;
+ }
+ opts = opts->next;
}
}
else
@@ -1240,6 +1230,7 @@ CardConfig(void)
for (i = ncards; i > 0; i--)
cards[i] = cards[i - 1];
cards[0] = "** Unlisted card **";
+ ++ncards;
}
if (device->dev_card)
entry = LookupCard(device->dev_card);
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
index 9316a5211..d28ac0899 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.4 2000/11/14 21:59:24 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.c,v 1.7 2001/07/07 23:00:43 paulo Exp $
*/
/*
@@ -118,7 +118,8 @@ static void AddModeCallback(Widget, XtPointer, XtPointer);
static void TestCallback(Widget, XtPointer, XtPointer);
static void TestTimeout(XtPointer, XtIntervalId*);
static void StopTestCallback(Widget, XtPointer, XtPointer);
-
+static int ForceAddMode(void);
+static int AddMode(void);
/*
* Initialization
*/
@@ -133,7 +134,7 @@ static Bool S3Specials;
static int invert_vclk, blank1, blank2, early_sc, screenno;
static int (*XtErrorFunc)(Display*, XErrorEvent*);
static Widget labels[VSYNC + 1], values[VSYNC + 1], repeater, monitor,
- monitorb, add, text, vesab, vesap, forceshell, testshell;
+ monitorb, add, text, vesab, vesap, forceshell, testshell, addshell;
static int MajorVersion, MinorVersion, EventBase, ErrorBase;
static XtIntervalId timeout;
@@ -442,20 +443,8 @@ VideoModeInitialize(void)
MINMAJOR, MINMINOR);
return (False);
}
- else {
- int i;
- Display *display = XtDisplay(toplevel);
-
- computer.num_vidmodes = ScreenCount(display);
- computer.vidmodes = (xf86cfgVidmode**)
- XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes);
- for (i = 0; i < computer.num_vidmodes; i++) {
-
- computer.vidmodes[i] = (xf86cfgVidmode*)
- XtCalloc(1, sizeof(xf86cfgVidmode));
- computer.vidmodes[i]->screen = i;
- }
- }
+ else
+ InitializeVidmodes();
vtune = XtCreateWidget("vidtune", formWidgetClass,
work, NULL, 0);
@@ -588,6 +577,23 @@ VideoModeInitialize(void)
}
void
+InitializeVidmodes(void)
+{
+ int i;
+ Display *display = XtDisplay(toplevel);
+
+ computer.num_vidmodes = ScreenCount(display);
+ computer.vidmodes = (xf86cfgVidmode**)
+ XtMalloc(sizeof(xf86cfgVidmode*) * computer.num_vidmodes);
+ for (i = 0; i < computer.num_vidmodes; i++) {
+
+ computer.vidmodes[i] = (xf86cfgVidmode*)
+ XtCalloc(1, sizeof(xf86cfgVidmode));
+ computer.vidmodes[i]->screen = i;
+ }
+}
+
+void
VideoModeConfigureStart(void)
{
vidtune = computer.vidmodes[screenno];
@@ -686,10 +692,14 @@ SetLabelAndModeline(void)
vidtune->monitor->mon_identifier, NULL);
XtSetSensitive(add, True);
- XmuSnprintf(string, sizeof(string), "%dx%d@%d",
- modeline.hdisplay, modeline.vdisplay,
- (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
- (double)modeline.vtotal));
+ if (modeline.htotal && modeline.vtotal)
+ XmuSnprintf(string, sizeof(string), "%dx%d@%d",
+ modeline.hdisplay, modeline.vdisplay,
+ (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
+ (double)modeline.vtotal));
+ else
+ XmuSnprintf(string, sizeof(string), "%dx%d",
+ modeline.hdisplay, modeline.vdisplay);
XtVaSetValues(text, XtNstring, string, NULL);
}
else {
@@ -715,15 +725,17 @@ VidmodeRestoreAction(Widget w, XEvent *event,
static void
UpdateSyncRates(Bool update)
{
- hsync_rate = (dot_clock * 1000) / modeline.htotal;
- vsync_rate = (hsync_rate * 1000) / modeline.vtotal;
- if (modeline.flags & V_INTERLACE)
- vsync_rate *= 2;
- else if (modeline.flags & V_DBLSCAN)
- vsync_rate /= 2;
- if (update) {
- SetLabel(HSYNC, hsync_rate);
- SetLabel(VSYNC, vsync_rate);
+ if (modeline.htotal && modeline.vtotal) {
+ hsync_rate = (dot_clock * 1000) / modeline.htotal;
+ vsync_rate = (hsync_rate * 1000) / modeline.vtotal;
+ if (modeline.flags & V_INTERLACE)
+ vsync_rate *= 2;
+ else if (modeline.flags & V_DBLSCAN)
+ vsync_rate /= 2;
+ if (update) {
+ SetLabel(HSYNC, hsync_rate);
+ SetLabel(VSYNC, vsync_rate);
+ }
}
}
@@ -988,10 +1000,14 @@ SwitchCallback(Widget w, XtPointer call_data, XtPointer client_data)
UpdateCallback(w, call_data, client_data);
- XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
- modeline.hdisplay, modeline.vdisplay,
- (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
- (double)modeline.vtotal));
+ if (modeline.htotal && modeline.vtotal)
+ XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
+ modeline.hdisplay, modeline.vdisplay,
+ (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
+ (double)modeline.vtotal));
+ else
+ XmuSnprintf(label, sizeof(label), "%dx%d",
+ modeline.hdisplay, modeline.vdisplay);
XtSetArg(args[0], XtNlabel, label);
XtSetValues(mode, args, 1);
}
@@ -1056,6 +1072,7 @@ AddVesaModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
{
xf86cfgVesaModeInfo *vesa = (xf86cfgVesaModeInfo*)call_data;
XF86VidModeModeInfo mode;
+ int num_infos = vidtune->num_infos;
memcpy(&mode, &vesa->info, sizeof(XF86VidModeModeInfo));
if (XF86VidModeAddModeLine(XtDisplay(toplevel), vidtune->screen,
@@ -1063,8 +1080,54 @@ AddVesaModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
XSync(XtDisplay(toplevel), False);
GetModes();
}
- else
- XBell(XtDisplay(w), 80);
+ else {
+ XBell(XtDisplayOfObject(w), 80);
+ return;
+ }
+
+ if (vidtune && num_infos == vidtune->num_infos) {
+ /* XF86VidModeAddModeLine returned True, but no modeline was added */
+ XBell(XtDisplayOfObject(w), 80);
+ if (vidtune->monitor && AddMode()) {
+ XF86ConfModeLinePtr mode;
+ char label[256], *ptr, *str;
+
+ XmuSnprintf(label, sizeof(label), "%s", vesa->ident);
+
+ /* format mode name to not have spaces */
+ ptr = strchr(label, ')');
+ if (ptr)
+ *++ptr = '\0';
+ ptr = str = label;
+ while (*ptr) {
+ if (*ptr != ' ')
+ *str++ = *ptr;
+ ++ptr;
+ }
+ *str = '\0';
+
+ if (xf86findModeLine(label, vidtune->monitor->mon_modeline_lst)
+ != NULL && !ForceAddMode())
+ return;
+
+ mode = (XF86ConfModeLinePtr)XtCalloc(1, sizeof(XF86ConfModeLineRec));
+ mode->ml_identifier = XtNewString(label);
+ mode->ml_clock = vesa->info.dotclock;
+ mode->ml_hdisplay = vesa->info.hdisplay;
+ mode->ml_hsyncstart = vesa->info.hsyncstart;
+ mode->ml_hsyncend = vesa->info.hsyncend;
+ mode->ml_htotal = vesa->info.htotal;
+ mode->ml_vdisplay = vesa->info.vdisplay;
+ mode->ml_vsyncstart = vesa->info.vsyncstart;
+ mode->ml_vsyncend = vesa->info.vsyncend;
+ mode->ml_vtotal = vesa->info.vtotal;
+/* mode->ml_vscan = ???;*/
+ mode->ml_flags = vesa->info.flags;
+ mode->ml_hskew = vesa->info.hskew;
+ vidtune->monitor->mon_modeline_lst =
+ xf86addModeLine(vidtune->monitor->mon_modeline_lst, mode);
+ }
+ }
}
static void
@@ -1089,21 +1152,31 @@ GetModes(void)
for (i = 0; i < vidtune->num_infos; i++) {
Widget sme;
- XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
- vidtune->infos[i]->hdisplay,
- vidtune->infos[i]->vdisplay,
- (int)((double)vidtune->infos[i]->dotclock /
- (double)vidtune->infos[i]->htotal * 1000.0 /
- (double)vidtune->infos[i]->vtotal));
+ if ((double)vidtune->infos[i]->htotal &&
+ (double)vidtune->infos[i]->vtotal)
+ XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
+ vidtune->infos[i]->hdisplay,
+ vidtune->infos[i]->vdisplay,
+ (int)((double)vidtune->infos[i]->dotclock /
+ (double)vidtune->infos[i]->htotal * 1000.0 /
+ (double)vidtune->infos[i]->vtotal));
+ else
+ XmuSnprintf(label, sizeof(label), "%dx%d",
+ vidtune->infos[i]->hdisplay,
+ vidtune->infos[i]->vdisplay);
sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0);
XtAddCallback(sme, XtNcallback, SelectCallback,
(XtPointer)vidtune->infos[i]);
}
- XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
- modeline.hdisplay, modeline.vdisplay,
- (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
- (double)modeline.vtotal));
+ if (modeline.htotal && modeline.vtotal)
+ XmuSnprintf(label, sizeof(label), "%dx%d @ %d Hz",
+ modeline.hdisplay, modeline.vdisplay,
+ (int)((double)dot_clock / (double)modeline.htotal * 1000.0 /
+ (double)modeline.vtotal));
+ else
+ XmuSnprintf(label, sizeof(label), "%dx%d",
+ modeline.hdisplay, modeline.vdisplay);
XtSetArg(args[0], XtNlabel, label);
XtSetValues(mode, args, 1);
}
@@ -1118,13 +1191,6 @@ PopdownForce(Widget w, XtPointer user_data, XtPointer call_data)
do_force = (long)user_data;
}
-void
-CancelForceAddModeAction(Widget w, XEvent *event,
- String *params, Cardinal *num_params)
-{
- PopdownForce(w, (XtPointer)False, NULL);
-}
-
static int
ForceAddMode(void)
{
@@ -1150,6 +1216,51 @@ ForceAddMode(void)
return (do_force);
}
+static int do_add, asking_add;
+
+static void
+PopdownAdd(Widget w, XtPointer user_data, XtPointer call_data)
+{
+ asking_add = 0;
+ XtPopdown(addshell);
+ do_add = (long)user_data;
+}
+
+void
+CancelAddModeAction(Widget w, XEvent *event,
+ String *params, Cardinal *num_params)
+{
+ if (asking_force)
+ PopdownForce(w, (XtPointer)False, NULL);
+ else if (asking_add)
+ PopdownAdd(w, (XtPointer)False, NULL);
+}
+
+static int
+AddMode(void)
+{
+ if (addshell == NULL) {
+ Widget dialog;
+
+ addshell = XtCreatePopupShell("addMode", transientShellWidgetClass,
+ toplevel, NULL, 0);
+ dialog = XtVaCreateManagedWidget("dialog", dialogWidgetClass,
+ addshell, XtNvalue, NULL, NULL, 0);
+ XawDialogAddButton(dialog, "yes", PopdownAdd, (XtPointer)True);
+ XawDialogAddButton(dialog, "no", PopdownAdd, (XtPointer)False);
+ XtRealizeWidget(addshell);
+ XSetWMProtocols(DPY, XtWindow(addshell), &wm_delete_window, 1);
+ }
+
+ asking_add = 1;
+
+ XtPopup(addshell, XtGrabExclusive);
+ while (asking_add)
+ XtAppProcessEvent(XtWidgetToApplicationContext(addshell), XtIMAll);
+
+ return (do_add);
+}
+
/*ARGSUSED*/
static void
AddModeCallback(Widget w, XtPointer call_data, XtPointer client_data)
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h
index 325e62f2d..e445517cd 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h
@@ -26,7 +26,7 @@
*
* Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
*
- * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h,v 1.1 2000/05/18 16:30:00 dawes Exp $
+ * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/vidmode.h,v 1.3 2001/07/07 23:00:43 paulo Exp $
*/
#ifndef _xf86cfg_vidmode_h
@@ -52,8 +52,9 @@ Bool VideoModeInitialize(void);
void VideoModeConfigureStart(void);
void VideoModeConfigureEnd(void);
void VidmodeRestoreAction(Widget, XEvent*, String*, Cardinal*);
-void CancelForceAddModeAction(Widget, XEvent*, String*, Cardinal*);
+void CancelAddModeAction(Widget, XEvent*, String*, Cardinal*);
void CancelTestModeAction(Widget, XEvent*, String*, Cardinal*);
+void InitializeVidmodes(void);
/*
* Initialization
diff --git a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man
index 0a16cb385..95d6fddbc 100644
--- a/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man
+++ b/xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man
@@ -26,7 +26,7 @@
.\"
.\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br>
.\"
-.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.6.2.1 2001/05/21 22:24:02 paulo Exp $
+.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.7 2001/05/21 22:21:57 paulo Exp $
.\"
.TH xf86cfg 1 __vendorversion__
.SH NAME