|
version 1.1, 2000/04/04 22:36:58
|
version 1.2, 2000/05/18 16:29:59
|
|
|
|
| * | * |
| * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> | * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> |
| * | * |
| * $XFree86$ |
* $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.1 2000/04/04 22:36:58 dawes Exp $ |
| */ | */ |
| | |
| #include <X11/IntrinsicP.h> | #include <X11/IntrinsicP.h> |
|
|
|
| #include "screen.h" | #include "screen.h" |
| #include "cards.h" | #include "cards.h" |
| #include "options.h" | #include "options.h" |
| |
#include "vidmode.h" |
| | |
| #define randomize() srand((unsigned)time((time_t*)NULL)) | #define randomize() srand((unsigned)time((time_t*)NULL)) |
| #define DefaultXFree86Dir "/usr/X11R6" | #define DefaultXFree86Dir "/usr/X11R6" |
|
|
|
| void DefaultLayoutCallback(Widget, XtPointer, XtPointer); | void DefaultLayoutCallback(Widget, XtPointer, XtPointer); |
| void RemoveLayoutCallback(Widget, XtPointer, XtPointer); | void RemoveLayoutCallback(Widget, XtPointer, XtPointer); |
| void OptionsCallback(Widget, XtPointer, XtPointer); | void OptionsCallback(Widget, XtPointer, XtPointer); |
| void DrawScreenAction(Widget, XEvent*, String*, Cardinal*); |
|
| xf86cfgDevice *AddDevice(int, XtPointer, int, int); | xf86cfgDevice *AddDevice(int, XtPointer, int, int); |
| static Bool AskXF86Config(void); | static Bool AskXF86Config(void); |
| static void ScreenSetup(Bool, Bool); |
void WriteXF86ConfigAction(Widget, XEvent*, String*, Cardinal*); |
| |
static void ScreenSetup(Bool); |
| void QuitAction(Widget, XEvent*, String*, Cardinal*); | void QuitAction(Widget, XEvent*, String*, Cardinal*); |
| |
static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*); |
| |
static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*); |
| |
|
| |
extern void CloseAccessXAction(Widget, XEvent*, String*, Cardinal*); |
| | |
| /* | /* |
| * Initialization | * Initialization |
|
|
|
| xf86cfgComputer computer; | xf86cfgComputer computer; |
| xf86cfgDevice cpu_device; | xf86cfgDevice cpu_device; |
| Cursor no_cursor; | Cursor no_cursor; |
| static Widget device, menu, popup, commands; |
static Widget device, menu, layoutm, popup, commands; |
| static int xpos, ypos; | static int xpos, ypos; |
| int sxpos, sypos; | int sxpos, sypos; |
| static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; | static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; |
| static GC cablegc; |
static GC cablegc, cablegcshadow; |
| Atom wm_delete_window; | Atom wm_delete_window; |
| | |
| #define CONFIG_LAYOUT 0 | #define CONFIG_LAYOUT 0 |
| #define CONFIG_SCREEN 1 | #define CONFIG_SCREEN 1 |
| |
#define CONFIG_MODELINE 2 |
| static int config_mode = CONFIG_LAYOUT; | static int config_mode = CONFIG_LAYOUT; |
| | |
| static XtActionsRec actions[] = { | static XtActionsRec actions[] = { |
|
|
|
| {"device-popup", DevicePopupMenu}, | {"device-popup", DevicePopupMenu}, |
| {"device-popdown", DevicePopdownMenu}, | {"device-popdown", DevicePopdownMenu}, |
| {"rename-layout", RenameLayoutAction}, | {"rename-layout", RenameLayoutAction}, |
| {"draw-screen", DrawScreenAction}, |
{"write-config", WriteXF86ConfigAction}, |
| {"quit", QuitAction}, | {"quit", QuitAction}, |
| |
{"vidmode-restore", VidmodeRestoreAction}, |
| |
{"config-cancel", ConfigCancelAction}, |
| |
{"options-cancel", OptionsCancelAction}, |
| |
{"error-cancel", ErrorCancelAction}, |
| |
{"quit-cancel", QuitCancelAction}, |
| |
{"addmode-cancel", CancelForceAddModeAction}, |
| |
{"accessx-close", CloseAccessXAction}, |
| |
{"testmode-cancel", CancelTestModeAction}, |
| }; | }; |
| | |
| static char *device_names[] = { | static char *device_names[] = { |
|
|
|
| main(int argc, char *argv[]) | main(int argc, char *argv[]) |
| { | { |
| Widget pane, popup, mouse, keyboard, card, monitor; | Widget pane, popup, mouse, keyboard, card, monitor; |
| Widget bottom, sel, sme, help, quit, layopt; |
Widget bottom, sme, smemodeline, help, quit, layopt; |
| XColor color, tmp; | XColor color, tmp; |
| Pixmap pixmap; | Pixmap pixmap; |
| XGCValues values; | XGCValues values; |
|
|
|
| | |
| pane = XtCreateManagedWidget("pane", panedWidgetClass, | pane = XtCreateManagedWidget("pane", panedWidgetClass, |
| toplevel, NULL, 0); | toplevel, NULL, 0); |
| menu = XtCreateManagedWidget("top", menuButtonWidgetClass, |
menu = XtCreateManagedWidget("topM", menuButtonWidgetClass, |
| pane, NULL, 0); | pane, NULL, 0); |
| popup = XtCreatePopupShell("menu", simpleMenuWidgetClass, | popup = XtCreatePopupShell("menu", simpleMenuWidgetClass, |
| menu, NULL, 0); | menu, NULL, 0); |
|
|
|
| popup, NULL, 0); | popup, NULL, 0); |
| XtAddCallback(sme, XtNcallback, SetConfigModeCallback, | XtAddCallback(sme, XtNcallback, SetConfigModeCallback, |
| (XtPointer)CONFIG_SCREEN); | (XtPointer)CONFIG_SCREEN); |
| |
smemodeline = XtCreateManagedWidget("modeline", smeBSBObjectClass, |
| |
popup, NULL, 0); |
| |
XtAddCallback(smemodeline, XtNcallback, SetConfigModeCallback, |
| |
(XtPointer)CONFIG_MODELINE); |
| | |
| commands = XtCreateManagedWidget("commands", formWidgetClass, | commands = XtCreateManagedWidget("commands", formWidgetClass, |
| pane, NULL, 0); | pane, NULL, 0); |
|
|
|
| | |
| bottom = XtCreateManagedWidget("bottom", formWidgetClass, | bottom = XtCreateManagedWidget("bottom", formWidgetClass, |
| pane, NULL, 0); | pane, NULL, 0); |
| sel = XtCreateManagedWidget("select", menuButtonWidgetClass, |
layoutm = XtCreateManagedWidget("select", menuButtonWidgetClass, |
| bottom, NULL, 0); | bottom, NULL, 0); |
| layout = XtVaCreateManagedWidget("layout", asciiTextWidgetClass, | layout = XtVaCreateManagedWidget("layout", asciiTextWidgetClass, |
| bottom, | bottom, |
|
|
|
| &color, &tmp); | &color, &tmp); |
| no_cursor = XCreatePixmapCursor(XtDisplay(toplevel), pixmap, pixmap, | no_cursor = XCreatePixmapCursor(XtDisplay(toplevel), pixmap, pixmap, |
| &color, &color, 0, 0); | &color, &color, 0, 0); |
| values.line_width = 2; |
|
| |
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray55", |
| |
&color, &tmp); |
| |
values.line_width = 3; |
| |
values.foreground = color.pixel; |
| |
cablegcshadow = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel), |
| |
GCForeground | GCLineWidth, &values); |
| |
XAllocNamedColor(XtDisplay(toplevel), toplevel->core.colormap, "gray85", |
| |
&color, &tmp); |
| |
values.line_width = 1; |
| values.foreground = color.pixel; | values.foreground = color.pixel; |
| cablegc = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel), | cablegc = XCreateGC(XtDisplay(toplevel), XtWindow(toplevel), |
| GCForeground | GCLineWidth, &values); | GCForeground | GCLineWidth, &values); |
|
|
|
| XtAddEventHandler(work, ExposureMask, False, | XtAddEventHandler(work, ExposureMask, False, |
| ComputerEventHandler, (XtPointer)NULL); | ComputerEventHandler, (XtPointer)NULL); |
| | |
| |
wm_delete_window = XInternAtom(DPY, "WM_DELETE_WINDOW", False); |
| |
XSetWMProtocols(DPY, XtWindow(toplevel), &wm_delete_window, 1); |
| |
|
| StartConfig(); | StartConfig(); |
| InitializeDevices(); | InitializeDevices(); |
| |
XtSetSensitive(smemodeline, VideoModeInitialize()); |
| ReadCardsDatabase(); | ReadCardsDatabase(); |
| | |
| lay = XF86Config->conf_layout_lst; | lay = XF86Config->conf_layout_lst; |
|
|
|
| } | } |
| } | } |
| | |
| wm_delete_window = XInternAtom(DPY, "WM_DELETE_WINDOW", False); |
|
| XSetWMProtocols(DPY, XtWindow(toplevel), &wm_delete_window, 1); |
|
| |
|
| XtAppMainLoop(appcon); | XtAppMainLoop(appcon); |
| if (startedx) | if (startedx) |
| endx(); | endx(); |
|
|
|
| write_xf = (int)user_data; | write_xf = (int)user_data; |
| } | } |
| | |
| |
/*ARGSUSED*/ |
| |
void |
| |
QuitCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params) |
| |
{ |
| |
WriteXF86Config(w, (XtPointer)-1, NULL); |
| |
} |
| |
|
| |
/*ARGSUSED*/ |
| |
void |
| |
WriteXF86ConfigAction(Widget w, XEvent *event, |
| |
String *params, Cardinal *num_params) |
| |
{ |
| |
WriteXF86Config(w, (XtPointer)True, NULL); |
| |
} |
| |
|
| static Bool | static Bool |
| AskXF86Config(void) | AskXF86Config(void) |
| { | { |
|
|
|
| XawDialogAddButton(dialog, "no", WriteXF86Config, (XtPointer)0); | XawDialogAddButton(dialog, "no", WriteXF86Config, (XtPointer)0); |
| XawDialogAddButton(dialog, "cancel", WriteXF86Config, (XtPointer)-1); | XawDialogAddButton(dialog, "cancel", WriteXF86Config, (XtPointer)-1); |
| XtRealizeWidget(shell_xf); | XtRealizeWidget(shell_xf); |
| |
XSetWMProtocols(DPY, XtWindow(shell_xf), &wm_delete_window, 1); |
| } | } |
| | |
| asking_xf = 1; | asking_xf = 1; |
|
|
|
| | |
| /*ARGSUSED*/ | /*ARGSUSED*/ |
| void | void |
| |
ErrorCancelAction(Widget w, XEvent *event, String *params, Cardinal *num_params) |
| |
{ |
| |
XtPopdown((Widget)w); |
| |
} |
| |
|
| |
/*ARGSUSED*/ |
| |
void |
| QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) | QuitAction(Widget w, XEvent *event, String *params, Cardinal *num_params) |
| { | { |
| QuitCallback(w, NULL, NULL); | QuitCallback(w, NULL, NULL); |
|
|
|
| XawDialogAddButton(dialog, "ok", PopdownErrorCallback, | XawDialogAddButton(dialog, "ok", PopdownErrorCallback, |
| (XtPointer)shell); | (XtPointer)shell); |
| XtRealizeWidget(shell); | XtRealizeWidget(shell); |
| |
XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); |
| } | } |
| XtPopup(shell, XtGrabExclusive); | XtPopup(shell, XtGrabExclusive); |
| return; | return; |
|
|
|
| card = XF86Config->conf_device_lst; | card = XF86Config->conf_device_lst; |
| while (card != NULL) { | while (card != NULL) { |
| if (screen->scrn_device == card) { | if (screen->scrn_device == card) { |
| xf86cfgScreen *scr = XtNew(xf86cfgScreen); |
xf86cfgScreen *scr = (xf86cfgScreen*) |
| |
XtCalloc(1, sizeof(xf86cfgScreen)); |
| int i; | int i; |
| | |
| for (i = 0; i < computer.num_devices; i++) | for (i = 0; i < computer.num_devices; i++) |
|
|
|
| scr->screen = screen; | scr->screen = screen; |
| scr->card = computer.devices[i]; | scr->card = computer.devices[i]; |
| scr->monitor = device; | scr->monitor = device; |
| |
scr->refcount = 0; |
| |
++scr->card->refcount; |
| |
++scr->monitor->refcount; |
| computer.screens = (xf86cfgScreen**) | computer.screens = (xf86cfgScreen**) |
| XtRealloc((XtPointer)computer.screens, | XtRealloc((XtPointer)computer.screens, |
| sizeof(xf86cfgScreen*) * | sizeof(xf86cfgScreen*) * |
| (computer.num_screens + 1)); | (computer.num_screens + 1)); |
| scr->widget = CreateScreenWidget(); |
CreateScreenWidget(scr); |
| scr->type = SCREEN; | scr->type = SCREEN; |
| computer.screens[computer.num_screens++] = scr; | computer.screens[computer.num_screens++] = scr; |
| SetTip((xf86cfgDevice*)scr); | SetTip((xf86cfgDevice*)scr); |
|
|
|
| card = (XF86ConfDevicePtr)(card->list.next); | card = (XF86ConfDevicePtr)(card->list.next); |
| } | } |
| device->state = USED; | device->state = USED; |
| break; |
|
| } | } |
| screen = (XF86ConfScreenPtr)(screen->list.next); | screen = (XF86ConfScreenPtr)(screen->list.next); |
| } | } |
|
|
|
| computer.devices = (xf86cfgDevice**) | computer.devices = (xf86cfgDevice**) |
| XtRealloc((XtPointer)computer.devices, | XtRealloc((XtPointer)computer.devices, |
| sizeof(xf86cfgDevice*) * (computer.num_devices + 1)); | sizeof(xf86cfgDevice*) * (computer.num_devices + 1)); |
| computer.devices[computer.num_devices] = XtNew(xf86cfgDevice); |
computer.devices[computer.num_devices] = (xf86cfgDevice*) |
| |
XtCalloc(1, sizeof(xf86cfgDevice)); |
| computer.devices[computer.num_devices]->config = config; | computer.devices[computer.num_devices]->config = config; |
| computer.devices[computer.num_devices]->widget = | computer.devices[computer.num_devices]->widget = |
| XtVaCreateManagedWidget(device_names[type], simpleWidgetClass, | XtVaCreateManagedWidget(device_names[type], simpleWidgetClass, |
|
|
|
| NULL, 0); | NULL, 0); |
| computer.devices[computer.num_devices]->type = type; | computer.devices[computer.num_devices]->type = type; |
| computer.devices[computer.num_devices]->state = UNUSED; | computer.devices[computer.num_devices]->state = UNUSED; |
| |
computer.devices[computer.num_devices]->refcount = 0; |
| ++computer.num_devices; | ++computer.num_devices; |
| break; | break; |
| default: | default: |
|
|
|
| if (config_mode == CONFIG_LAYOUT) | if (config_mode == CONFIG_LAYOUT) |
| DrawCables(); | DrawCables(); |
| if (config_mode == CONFIG_SCREEN) | if (config_mode == CONFIG_SCREEN) |
| ScreenSetup(True, True); |
ScreenSetup(True); |
| return; | return; |
| } | } |
| ++num_layouts; | ++num_layouts; |
|
|
|
| if (config_mode == CONFIG_LAYOUT) | if (config_mode == CONFIG_LAYOUT) |
| DrawCables(); | DrawCables(); |
| if (config_mode == CONFIG_SCREEN) | if (config_mode == CONFIG_SCREEN) |
| ScreenSetup(True, True); |
ScreenSetup(True); |
| return; | return; |
| } | } |
| | |
|
|
|
| if (config_mode == CONFIG_LAYOUT) | if (config_mode == CONFIG_LAYOUT) |
| DrawCables(); | DrawCables(); |
| else if (config_mode == CONFIG_SCREEN) | else if (config_mode == CONFIG_SCREEN) |
| ScreenSetup(True, True); |
ScreenSetup(True); |
| } | } |
| | |
| /*ARGSUSED*/ | /*ARGSUSED*/ |
|
|
|
| int i; | int i; |
| XF86OptionPtr *options; | XF86OptionPtr *options; |
| | |
| |
if (config_mode == CONFIG_SCREEN) { |
| |
for (i = 0; i < computer.num_screens; i++) |
| |
if (computer.screens[i]->widget == config) { |
| |
options = &(computer.screens[i]->screen->scrn_option_lst); |
| |
break; |
| |
} |
| |
} |
| |
else { |
| for (i = 0; i < computer.num_devices; i++) | for (i = 0; i < computer.num_devices; i++) |
| if (computer.devices[i]->widget == config) | if (computer.devices[i]->widget == config) |
| break; | break; |
|
|
|
| break; | break; |
| } | } |
| } | } |
| |
} |
| | |
| OptionsPopup(options); | OptionsPopup(options); |
| if (i >= computer.num_devices) | if (i >= computer.num_devices) |
|
|
|
| if (computer.screens[i]->widget == config) { | if (computer.screens[i]->widget == config) { |
| computer.screens[i]->state = USED; | computer.screens[i]->state = USED; |
| computer.screens[i]->card->state = USED; | computer.screens[i]->card->state = USED; |
| ScreenSetup(False, True); |
ScreenSetup(False); |
| return; | return; |
| } | } |
| } | } |
|
|
|
| iref = nex; | iref = nex; |
| nex = (XF86ConfInputrefPtr)(nex->list.next); | nex = (XF86ConfInputrefPtr)(nex->list.next); |
| } | } |
| nex = XtNew(XF86ConfInputrefRec); |
nex = (XF86ConfInputrefPtr)XtCalloc(1, sizeof(XF86ConfInputrefRec)); |
| nex->list.next = NULL; | nex->list.next = NULL; |
| nex->iref_inputdev = input; | nex->iref_inputdev = input; |
| nex->iref_inputdev_str = XtNewString(input->inp_identifier); | nex->iref_inputdev_str = XtNewString(input->inp_identifier); |
|
|
|
| if (computer.screens[i]->widget == config) { | if (computer.screens[i]->widget == config) { |
| computer.screens[i]->state = UNUSED; | computer.screens[i]->state = UNUSED; |
| computer.screens[i]->card->state = UNUSED; | computer.screens[i]->card->state = UNUSED; |
| ScreenSetup(False, True); |
ScreenSetup(False); |
| return; | return; |
| } | } |
| } | } |
|
|
|
| | |
| RemoveScreen(mon = computer.screens[i]->monitor, | RemoveScreen(mon = computer.screens[i]->monitor, |
| dev = computer.screens[i]->card); | dev = computer.screens[i]->card); |
| |
|
| |
/* |
| for (j = 0; j < computer.num_devices; j++) { | for (j = 0; j < computer.num_devices; j++) { |
| if (computer.devices[j] == mon || | if (computer.devices[j] == mon || |
| computer.devices[j] == dev) { | computer.devices[j] == dev) { |
| |
if (--computer.devices[j]->refcount <= 0) { |
| XtDestroyWidget(computer.devices[j]->widget); | XtDestroyWidget(computer.devices[j]->widget); |
| XtFree((XtPointer)computer.devices[j]); | XtFree((XtPointer)computer.devices[j]); |
| if (--computer.num_devices > j) | if (--computer.num_devices > j) |
|
|
|
| --j; | --j; |
| } | } |
| } | } |
| ScreenSetup(False, True); |
} |
| |
*/ |
| |
|
| |
ScreenSetup(False); |
| } | } |
| return; | return; |
| } | } |
|
|
|
| if (computer.screens[j]->card == computer.devices[i]) { | if (computer.screens[j]->card == computer.devices[i]) { |
| RemoveScreen(computer.screens[j]->monitor, | RemoveScreen(computer.screens[j]->monitor, |
| computer.devices[i]); | computer.devices[i]); |
| break; |
--j; |
| } | } |
| |
if (computer.devices[i]->refcount <= 0) |
| xf86RemoveDevice(XF86Config, | xf86RemoveDevice(XF86Config, |
| (XF86ConfDevicePtr)(computer.devices[i]->config)); | (XF86ConfDevicePtr)(computer.devices[i]->config)); |
| } | } |
|
|
|
| if (computer.screens[j]->monitor == computer.devices[i]) { | if (computer.screens[j]->monitor == computer.devices[i]) { |
| RemoveScreen(computer.devices[i], | RemoveScreen(computer.devices[i], |
| computer.screens[j]->card); | computer.screens[j]->card); |
| break; |
--j; |
| } | } |
| |
if (computer.devices[i]->refcount <= 0) |
| |
xf86RemoveMonitor(XF86Config, |
| |
(XF86ConfMonitorPtr)(computer.devices[i]->config)); |
| } | } |
| | |
| |
if (computer.devices[i]->refcount <= 0) { |
| XtDestroyWidget(computer.devices[i]->widget); | XtDestroyWidget(computer.devices[i]->widget); |
| XtFree((XtPointer)computer.devices[i]); | XtFree((XtPointer)computer.devices[i]); |
| if (--computer.num_devices > i) | if (--computer.num_devices > i) |
|
|
|
| | |
| DrawCables(); | DrawCables(); |
| } | } |
| |
|
| |
break; |
| |
} |
| } | } |
| } | } |
| | |
|
|
|
| XUndefineCursor(XtDisplay(device), XtWindow(device)); | XUndefineCursor(XtDisplay(device), XtWindow(device)); |
| | |
| if (config_mode == CONFIG_SCREEN) | if (config_mode == CONFIG_SCREEN) |
| ScreenSetup(False, False); |
ScreenSetup(False); |
| device = NULL; | device = NULL; |
| } | } |
| } | } |
|
|
|
| DrawCables(); | DrawCables(); |
| } | } |
| | |
| /*ARGSUSED*/ |
|
| void |
|
| DrawScreenAction(Widget w, XEvent *ev, String *p, Cardinal *np) |
|
| { |
|
| int i; |
|
| |
|
| for (i = 0; i < computer.num_screens; i++) |
|
| if (computer.screens[i]->widget == w) |
|
| break; |
|
| |
|
| DrawScreen(XtDisplay(w), XtWindow(w), DefaultGC(XtDisplay(w), 0), |
|
| 0, 0, w->core.width, w->core.height, |
|
| i < computer.num_screens && computer.screens[i]->state == USED ? |
|
| True : False); |
|
| } |
|
| |
|
| void | void |
| DrawCables(void) | DrawCables(void) |
| { | { |
|
|
|
| static void | static void |
| DrawCable(Display *display, Window window, int o_x, int o_y, int d_x, int d_y) | DrawCable(Display *display, Window window, int o_x, int o_y, int d_x, int d_y) |
| { | { |
| |
XDrawLine(display, window, cablegcshadow, o_x, o_y, d_x, d_y); |
| XDrawLine(display, window, cablegc, o_x, o_y, d_x, d_y); | XDrawLine(display, window, cablegc, o_x, o_y, d_x, d_y); |
| } | } |
| | |
|
|
|
| XtGetValues(w, args, 1); | XtGetValues(w, args, 1); |
| XtSetArg(args[0], XtNlabel, ptr); | XtSetArg(args[0], XtNlabel, ptr); |
| XtSetValues(menu, args, 1); | XtSetValues(menu, args, 1); |
| |
|
| |
if (config_mode == CONFIG_LAYOUT) { |
| |
XtSetArg(args[0], XtNheight, &height); |
| |
XtGetValues(commands, args, 1); |
| |
for (i = 0; i < computer.num_devices; i++) |
| |
XtUnmapWidget(computer.devices[i]->widget); |
| |
XtUnmapWidget(commands); |
| |
XtUnmapWidget(computer.cpu); |
| |
XtSetSensitive(commands, False); |
| |
XtSetArg(args[0], XtNheight, 1); |
| |
XtSetArg(args[1], XtNmin, 1); |
| |
XtSetArg(args[2], XtNmax, 1); |
| |
XtSetValues(commands, args, 3); |
| |
} |
| |
else if (config_mode == CONFIG_SCREEN) { |
| |
for (i = 0; i < computer.num_screens; i++) |
| |
XtUnmapWidget(computer.screens[i]->widget); |
| |
} |
| |
else if (config_mode == CONFIG_MODELINE) { |
| |
VideoModeConfigureEnd(); |
| |
XtSetSensitive(layout, True); |
| |
XtSetSensitive(layoutm, True); |
| |
} |
| |
|
| config_mode = mode; | config_mode = mode; |
| XClearWindow(XtDisplay(work), XtWindow(work)); | XClearWindow(XtDisplay(work), XtWindow(work)); |
| if (mode == CONFIG_LAYOUT) { | if (mode == CONFIG_LAYOUT) { |
| for (i = 0; i < computer.num_devices; i++) | for (i = 0; i < computer.num_devices; i++) |
| XtMapWidget(computer.devices[i]->widget); | XtMapWidget(computer.devices[i]->widget); |
| for (i = 0; i < computer.num_screens; i++) |
|
| XtUnmapWidget(computer.screens[i]->widget); |
|
| XtSetArg(args[0], XtNheight, height); | XtSetArg(args[0], XtNheight, height); |
| XtSetArg(args[1], XtNmin, height); | XtSetArg(args[1], XtNmin, height); |
| XtSetArg(args[2], XtNmax, height); | XtSetArg(args[2], XtNmax, height); |
|
|
|
| DrawCables(); | DrawCables(); |
| } | } |
| else if (mode == CONFIG_SCREEN) { | else if (mode == CONFIG_SCREEN) { |
| XtSetArg(args[0], XtNheight, &height); |
|
| XtGetValues(commands, args, 1); |
|
| for (i = 0; i < computer.num_devices; i++) |
|
| XtUnmapWidget(computer.devices[i]->widget); |
|
| for (i = 0; i < computer.num_screens; i++) | for (i = 0; i < computer.num_screens; i++) |
| XtMapWidget(computer.screens[i]->widget); | XtMapWidget(computer.screens[i]->widget); |
| XtUnmapWidget(commands); |
ScreenSetup(True); |
| XtUnmapWidget(computer.cpu); |
} |
| XtSetSensitive(commands, False); |
else if (mode == CONFIG_MODELINE) { |
| XtSetArg(args[0], XtNheight, 1); |
VideoModeConfigureStart(); |
| XtSetArg(args[1], XtNmin, 1); |
XtSetSensitive(layout, False); |
| XtSetArg(args[2], XtNmax, 1); |
XtSetSensitive(layoutm, False); |
| XtSetValues(commands, args, 3); |
|
| ScreenSetup(True, False); |
|
| } | } |
| } | } |
| | |
| static void | static void |
| ScreenSetup(Bool check, Bool clear) |
ScreenSetup(Bool check) |
| { | { |
| if (check) { | if (check) { |
| int i; | int i; |
|
|
|
| AdjustScreenUI(); | AdjustScreenUI(); |
| } | } |
| | |
| if (clear) |
|
| ClearScreenUI(); |
|
| UpdateScreenUI(); | UpdateScreenUI(); |
| AdjustScreenUI(); | AdjustScreenUI(); |
| } | } |