Beispiel #1
0
/*ARGSUSED*/
static void
UnselectCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
    Arg args[2];
    char **modes;
    Cardinal num_modes;

    if (unsel_index < 0 || unsel_index >= ndefmodes)
	return;

    XawListUnhighlight(listL);
    XtSetArg(args[0], XtNlist, &modes);
    XtSetArg(args[1], XtNnumberStrings, &num_modes);
    XtGetValues(listL, args, 2);
    if (modes) {
	for (sel_index = 0; sel_index < num_modes; sel_index++)
	    if (strcmp(defmodes[unsel_index], modes[sel_index]) == 0)
		break;
	if (sel_index < num_modes)
	    XawListHighlight(listL, sel_index);
	else
	    sel_index = -1;
    }

    XtFree(defmodes[unsel_index]);
    if (--ndefmodes > unsel_index)
	memmove(&defmodes[unsel_index], &defmodes[unsel_index + 1],
		(ndefmodes - unsel_index) * sizeof(char*));
    if (ndefmodes == 0) {
	char **tmp = defmodes;

	defmodes = (char**)XtMalloc(sizeof(char*));
	defmodes[0] = XtNewString("");
	ndefmodes = 1;
	XtFree((char*)tmp);
    }

    XtSetArg(args[0], XtNlist, defmodes);
    XtSetArg(args[1], XtNnumberStrings, ndefmodes);
    XtSetValues(listR, args, 2);

    XawListUnhighlight(listR);
    if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
	if (unsel_index >= ndefmodes)
	    unsel_index = ndefmodes - 1;
	XawListHighlight(listR, unsel_index);
    }
    else
	unsel_index = -1;
}
Beispiel #2
0
/*ARGSUSED*/
static void
MoveCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
    char *tmp;
    Bool down = (long)user_data;

    if (unsel_index < 0 || unsel_index >= ndefmodes)
	return;

    if ((down && unsel_index + 1 >= ndefmodes) ||
	(!down && unsel_index - 1 < 0))
	return;

    tmp = defmodes[unsel_index];
    if (down) {
	defmodes[unsel_index] = defmodes[unsel_index + 1];
	unsel_index++;
    } else {
	defmodes[unsel_index] = defmodes[unsel_index - 1];
	unsel_index--;
    }
    defmodes[unsel_index] = tmp;

    XawListUnhighlight(listR);
    XawListHighlight(listR, unsel_index);
}
Beispiel #3
0
Datei: List.c Projekt: aosm/X11
/*ARGSUSED*/
static void
Notify(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    ListWidget lw = (ListWidget)w;
    int item, item_len;
    XawListReturnStruct ret_value;

    /*
     * Find item and if out of range then unhighlight and return
     * 
     * If the current item is unhighlighted then the user has aborted the
     * notify, so unhighlight and return
     */
    if ((CvtToItem(w, event->xbutton.x, event->xbutton.y, &item) == OUT_OF_RANGE)
	|| lw->list.highlight != item) {
#ifndef OLDXAW
	if (!lw->list.show_current || lw->list.selected == NO_HIGHLIGHT)
	    XawListUnhighlight(w);
	else
	    XawListHighlight(w, lw->list.selected);
#else
	XawListUnhighlight(w);
#endif
	return;
    }

    item_len = strlen(lw->list.list[item]);

    if (lw->list.paste)		/* if XtNpasteBuffer set then paste it */
	XStoreBytes(XtDisplay(w), lw->list.list[item], item_len);

#ifndef OLDXAW
    lw->list.selected = item;
#endif
    /*
     * Call Callback function
     */
    ret_value.string = lw->list.list[item];
    ret_value.list_index = item;
    
    XtCallCallbacks(w, XtNcallback, (XtPointer)&ret_value);
}
Beispiel #4
0
Datei: List.c Projekt: aosm/X11
/*ARGSUSED*/
static void
Set(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    int item;
    ListWidget lw = (ListWidget)w;

#ifndef OLDXAW
    lw->list.selected = lw->list.highlight;
#endif
    if (CvtToItem(w, event->xbutton.x, event->xbutton.y, &item) == OUT_OF_RANGE)
	XawListUnhighlight(w);			/* Unhighlight current item */
    else if (lw->list.is_highlighted != item)	/* If this item is not */
	XawListHighlight(w, item);		/* highlighted then do it */
}
Beispiel #5
0
/*ARGSUSED*/
static void
SelectModuleCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
    xf86cfgModuleOptions *mod = module_options;
    XawListReturnStruct *info = (XawListReturnStruct *)call_data;

    while (mod) {
	if (strcmp(mod->name, info->string) == 0)
	    break;
	mod = mod->next;
    }

    if (mod) {
	Arg args[2];
	char **list = NULL, **old;
	OptionInfoPtr opts = mod->option;
	int num = 0, oldnum;

	module_sel = mod->name;
	XtSetArg(args[0], XtNlist, &old);
	XtSetArg(args[1], XtNnumberStrings, &oldnum);
	XtGetValues(optList, args, 2);
	while (opts && opts->name) {
	    ++num;
	    list = (char**)XtRealloc((XtPointer)list, sizeof(char*) * num);
	    list[num - 1] = XtNewString(opts->name);
	    ++opts;
	}
	if (num == 0) {
	    list = (char**)XtMalloc(sizeof(char*));
	    list[0] = XtNewString("");
	    num = 1;
	}
	XtSetArg(args[0], XtNlist, list);
	XtSetArg(args[1], XtNnumberStrings, num);
	XtSetValues(optList, args, 2);
	while (--oldnum >= 0)
	    XtFree(old[oldnum]);
	XtFree((XtPointer)old);

	XtVaSetValues(desc, XtNstring, "", NULL);
	XawListUnhighlight(optList);

	/* force relayout */
	XtUnmanageChild(optList);
	XtManageChild(optList);
    }
}
Beispiel #6
0
static void
UpdateOptionList(void)
{
    Arg args[2];
    char **ops, **oldops;
    int nops, oldnops;
    XF86OptionPtr opt;

    ops = NULL;
    nops = 0;
    XawListUnhighlight(list);
    XtSetArg(args[0], XtNlist, &oldops);
    XtSetArg(args[1], XtNnumberStrings, &oldnops);
    XtGetValues(list, args, 2);
    opt = *options;
    while (opt != NULL) {
	if (nops % 16 == 0)
	    ops = (char**)XtRealloc((XtPointer)ops, (nops + 16) *
				    sizeof(char*));
	ops[nops++] = XtNewString(opt->opt_name);
	opt = (XF86OptionPtr)(opt->list.next);
    }
    if (nops == 0) {
	ops = (char**)XtMalloc(sizeof(char*));
	ops[0] = XtNewString("");
	nops = 1;
    }
    XtSetArg(args[0], XtNlist, ops);
    XtSetArg(args[1], XtNnumberStrings, nops);
    XtSetValues(list, args, 2);
    if (oldnops > 0 &&
	(oldnops != 1 || XtName(list) != oldops[0])) {
	while (--oldnops >= 0)
	    XtFree(oldops[oldnops]);
	XtFree((XtPointer)oldops);
    }

    XtSetArg(args[0], XtNstring, "");
    XtSetValues(name, args, 1);
    XtSetValues(value, args, 1);

    /* force relayout */
    XtUnmanageChild(list);
    XtManageChild(list);

    XtSetSensitive(remov, False);
    XtSetSensitive(update, False);
}
Beispiel #7
0
Datei: xaw.c Projekt: aosm/X11
LispObj *
Lisp_XawListUnhighlight(LispBuiltin *builtin)
/*
 xaw-list-unhighlight widget
 */
{
    LispObj *owidget;

    owidget = ARGUMENT(0);

    if (!CHECKO(owidget, xawWidget_t))
	LispDestroy("%s: cannot convert %s to Widget",
		    STRFUN(builtin), STROBJ(owidget));

    XawListUnhighlight((Widget)(owidget->data.opaque.data));

    return (NIL);
}
Beispiel #8
0
static FILE *
DoManualSearch(ManpageGlobals * man_globals, char *string)
{
    int e_num = NO_ENTRY;
    int i;

/* search current section first. */

    i = man_globals->current_directory;
    e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries);

/* search other sections. */

    if (e_num == NO_ENTRY) {
        i = 0;                  /* At the exit of the loop i needs to
                                   be the one we used. */
        while (TRUE) {
            if (i == man_globals->current_directory)
                if (++i >= sections)
                    return (NULL);
            e_num = BEntrySearch(string, manual[i].entries, manual[i].nentries);
            if (e_num != NO_ENTRY)
                break;
            if (++i >= sections)
                return (NULL);
        }

/*
 * Manual page found in some other section, unhighlight the current one.
 */
        if (man_globals->manpagewidgets.box != NULL)
            XawListUnhighlight(man_globals->manpagewidgets.
                               box[man_globals->current_directory]);
    }
    else {
        /*
         * Highlight the element we are searching for if it is in the directory
         * listing currently being shown.
         */
        if (man_globals->manpagewidgets.box != NULL)
            XawListHighlight(man_globals->manpagewidgets.box[i], e_num);
    }
    return (FindManualFile(man_globals, i, e_num));
}
Beispiel #9
0
/*ARGSUSED*/
static void
SelectCallback(Widget w, XtPointer user_data, XtPointer call_data)
{
    Arg args[2];

    if (sel_index < 0 || sel_index >= nmodes)
	return;

    if (ndefmodes == 1 && *defmodes[0] == '\0') {
	/* make sure tmp and defentries are not the same pointer */
	char **tmp = defmodes;

	XtFree(defmodes[0]);
	defmodes = (char**)XtMalloc(sizeof(char*));
	--ndefmodes;
	XtFree((char*)tmp);
    }
    else
	defmodes = (char**)XtRealloc((XtPointer)defmodes,
				     sizeof(char*) * (ndefmodes + 1));
    defmodes[ndefmodes++] = XtNewString(modes[sel_index]);

    XtSetArg(args[0], XtNlist, defmodes);
    XtSetArg(args[1], XtNnumberStrings, ndefmodes);
    XtSetValues(listR, args, 2);

    XawListUnhighlight(listR);
    if (ndefmodes > 1 || (ndefmodes == 1 && *defmodes[0] != '\0')) {
	if (unsel_index >= ndefmodes)
	    unsel_index = ndefmodes - 1;
	XawListHighlight(listR, unsel_index = ndefmodes - 1);
    }
    else
	unsel_index = -1;

    /* force realyout */
    XtUnmanageChild(listR);
    XtManageChild(listR);
}
Beispiel #10
0
/*ARGSUSED*/
void
DirPopupCallback(Widget w, XtPointer pointer, XtPointer junk)
{
  ManpageGlobals * man_globals; 
  MenuStruct * menu_struct;
  Widget parent;
  int number;
  int current_box;

  menu_struct = (MenuStruct *) pointer;
  man_globals = (ManpageGlobals *) menu_struct->data;

  number = menu_struct->number;
  current_box = man_globals->current_directory;

  /* We have used this guy, pop down the menu. */
  
  if (number != current_box) {
    /* This is the only one that we know has a parent. */
    parent = XtParent(man_globals->manpagewidgets.box[INITIAL_DIR]);

    MakeDirectoryBox(man_globals, parent,
		     man_globals->manpagewidgets.box + number, number);
    XtUnmanageChild(man_globals->manpagewidgets.box[current_box]);
    XtManageChild(man_globals->manpagewidgets.box[number]);

    XawListUnhighlight(man_globals->manpagewidgets.box[current_box]);
    ChangeLabel(man_globals->label, man_globals->section_name[number]);
    man_globals->current_directory = number;
  }

  /* put up directory. */
  if (!man_globals->both_shown) {
    XtUnmanageChild(man_globals->manpagewidgets.manpage);
    XtManageChild(man_globals->manpagewidgets.directory);
  }
}
Beispiel #11
0
Datei: List.c Projekt: aosm/X11
/*ARGSUSED*/
static void
Unset(Widget w, XEvent *event, String *params, Cardinal *num_params)
{
    XawListUnhighlight(w);
}
Beispiel #12
0
/*
 * Implementation
 */
XtPointer
MonitorConfig(XtPointer conf)
{
    XF86ConfMonitorPtr monitor = (XF86ConfMonitorPtr)conf;
    char monitor_name[48];
    Arg args[1];

    current_monitor = monitor;

    xf86info.cur_list = MONITOR;
    XtSetSensitive(back, xf86info.lists[MONITOR].cur_function > 0);
    XtSetSensitive(next, xf86info.lists[MONITOR].cur_function <
			 xf86info.lists[MONITOR].num_functions - 1);
    (xf86info.lists[MONITOR].functions[xf86info.lists[MONITOR].cur_function])
	(&xf86info);

    XawListUnhighlight(hlist);
    XawListUnhighlight(vlist);

    if (monitor != NULL) {
	XF86ConfScreenPtr screen = XF86Config->conf_screen_lst;
	char str[PARSER_RANGE_SIZE];

	XtSetArg(args[0], XtNstring, monitor->mon_identifier);
	XtSetValues(ident_widget, args, 1);

	while (screen != NULL) {
	    if (screen->scrn_monitor == monitor)
		break;

	    screen = (XF86ConfScreenPtr)(screen->list.next);
	}
	if (screen != NULL) {
	    oldcard = card = screen->scrn_device;
	    XtSetArg(args[0], XtNlabel, card->dev_identifier);
	}
	else {
	    oldcard = card = NULL;
	    XtSetArg(args[0], XtNlabel, "");
	}
	XtSetValues(cmenu, args, 1);

	mon_n_hsync = monitor->mon_n_hsync;
	memcpy(mon_hsync, monitor->mon_hsync,
	       sizeof(parser_range) * mon_n_hsync);
	*str = '\0';
	parser_range_to_string(str, mon_hsync, mon_n_hsync);
	XtSetArg(args[0], XtNstring, str);
	XtSetValues(hsync, args, 1);

	mon_n_vrefresh = monitor->mon_n_vrefresh;
	memcpy(mon_vrefresh, monitor->mon_vrefresh,
	       sizeof(parser_range) * mon_n_vrefresh);
	*str = '\0';
	parser_range_to_string(str, mon_vrefresh, mon_n_vrefresh);
	XtSetArg(args[0], XtNstring, str);
	XtSetValues(vsync, args, 1);
    }
    else {
	XF86ConfMonitorPtr monitor = XF86Config->conf_monitor_lst;
	int nmonitors = 0;

	oldcard = card = NULL;
	while (monitor != NULL) {
		++nmonitors;
	    monitor = (XF86ConfMonitorPtr)(monitor->list.next);
	}
	do {
	    XmuSnprintf(monitor_name, sizeof(monitor_name),
			"Monitor%d", nmonitors);
	    ++nmonitors;
	} while (xf86findMonitor(monitor_name,
		 XF86Config->conf_monitor_lst));

	XtSetArg(args[0], XtNstring, monitor_name);
	XtSetValues(ident_widget, args, 1);

	XtSetArg(args[0], XtNstring, "");
	XtSetValues(hsync, args, 1);
	XtSetValues(vsync, args, 1);

	XtSetArg(args[0], XtNlabel, "");
	XtSetValues(cmenu, args, 1);
    }

    if (ConfigLoop(MonitorConfigCheck) == True) {
	if (monitor == NULL) {
	    monitor = (XF86ConfMonitorPtr)
		XtCalloc(1, sizeof(XF86ConfMonitorRec));
	    monitor->mon_identifier = XtNewString(ident_string);
	}

	memcpy(monitor->mon_hsync, mon_hsync, sizeof(parser_range) *
	       (monitor->mon_n_hsync = mon_n_hsync));
	memcpy(monitor->mon_vrefresh, mon_vrefresh, sizeof(parser_range) *
	       (monitor->mon_n_vrefresh = mon_n_vrefresh));

	if (strcasecmp(monitor->mon_identifier, ident_string))
	    xf86renameMonitor(XF86Config, monitor, ident_string);

	if (oldcard != card) {
	    int i;

	    for (i = 0; i < computer.num_devices; i++)
		if (computer.devices[i]->widget == config)
		    break;
	    if (computer.devices[i]->config == NULL)
		XF86Config->conf_monitor_lst =
				xf86addMonitor(XF86Config->conf_monitor_lst,
					       monitor);
	    computer.devices[i]->config = (XtPointer)monitor;
	    ChangeScreen(monitor, monitor, card, oldcard);
	    DrawCables();
	}

	return (monitor);
    }

    return (NULL);
}
Beispiel #13
0
void
MouseDeviceAndProtocol(XF86SetupInfo *info)
{
    static int first = 1, ndevices;
    static Widget mouse_dp, listD, listP, emul3, apply;
    static char **devices;
    static char *dirs[] = {
	"/dev",
#ifdef __linux__
	"/dev/input"
#endif
    };
    static char *patterns[] = {
#ifdef WSCONS_SUPPORT
	"wsmouse",
#endif
	"cuaa",
	"mice",
	"mouse",
	"ps",
	"sysmouse",
	"ttyS",
    };
    Arg args[2];
    int i;

    if (first) {
	Widget label, viewport;
	struct dirent *ent;
	DIR *dir;
	char **list;
	int count;

	first = 0;

	mouse_dp = XtCreateWidget("mouseDP", formWidgetClass,
				  configp, NULL, 0);

	/* DEVICE */
	for (count = 0; count < sizeof(dirs) / sizeof(dirs[0]); count++) {
	    if ((dir = opendir(dirs[count])) != NULL) {
		int i, len, xlen = strlen(dirs[count]) + 2;

		(void)readdir(dir);
		(void)readdir(dir);
		while ((ent = readdir(dir)) != NULL) {
		    for (i = 0; i < sizeof(patterns) / sizeof(patterns[0]); i++) {
			len = strlen(patterns[i]);

			if (strncmp(patterns[i], ent->d_name, len) == 0) {
			    len = strlen(ent->d_name) + xlen;

			    devices = (char**)XtRealloc((XtPointer)devices,
							sizeof(char*) * ++ndevices);
			    devices[ndevices - 1] = XtMalloc(len);
			    XmuSnprintf(devices[ndevices - 1], len, "%s/%s",
					dirs[count], ent->d_name);
			}
		    }
		}
		closedir(dir);
	    }
	}

	label = XtCreateManagedWidget("labelD", labelWidgetClass,
				      mouse_dp, NULL, 0);
	text = XtVaCreateManagedWidget("device", asciiTextWidgetClass,
				       mouse_dp,
				       XtNeditType, XawtextEdit,
				       NULL, 0);
	viewport = XtCreateManagedWidget("viewportD", viewportWidgetClass,
					 mouse_dp, NULL, 0);

	listD = XtVaCreateManagedWidget("listD", listWidgetClass,
					viewport,
					XtNlist, devices,
					XtNnumberStrings, ndevices,
					NULL, 0);
	XtAddCallback(listD, XtNcallback, MouseDeviceCallback, (XtPointer)text);

	/* PROTOCOL */
	label = XtCreateManagedWidget("labelP", labelWidgetClass,
				      mouse_dp, NULL, 0);
	viewport = XtCreateManagedWidget("viewportP", viewportWidgetClass,
					 mouse_dp, NULL, 0);

	list = (char**)XtMalloc(sizeof(char*) *
				sizeof(protocols)/sizeof(protocols[0]));
	for (count = 0; count < sizeof(protocols)/sizeof(protocols[0]); count++)
	    list[count] = XtNewString(protocols[count].name);
	listP = XtVaCreateManagedWidget("listP", listWidgetClass,
					viewport,
					XtNlist, list,
					XtNnumberStrings, count,
					NULL, 0);
	XtAddCallback(listP, XtNcallback, MouseProtocolCallback, NULL);

	emul3 = XtVaCreateManagedWidget("emulate3", toggleWidgetClass,
					mouse_dp, XtNstate, True, NULL, 0);
	XtAddCallback(emul3, XtNcallback, MouseEmulateCallback, NULL);
	apply = XtCreateManagedWidget("apply", commandWidgetClass,
				      mouse_dp, NULL, 0);
	XtAddCallback(apply, XtNcallback, MouseApplyCallback, NULL);

	XtRealizeWidget(mouse_dp);
    }

    if (device != NULL) {
	for (i = 0; i < ndevices; i++)
	    if (strcmp(device, devices[i]) == 0) {
		XtSetArg(args[0], XtNstring, device);
		XtSetValues(text, args, 1);
		XawListHighlight(listD, i);
		break;
	    }

	if (i >= ndevices) {
	    devices = (char**)XtRealloc((XtPointer)devices,
					sizeof(char*) * ++ndevices);
	    devices[ndevices - 1] = XtNewString(device);
	    XawListHighlight(listD, ndevices - 1);
	    XtSetArg(args[0], XtNlist, devices);
	    XtSetArg(args[1], XtNnumberStrings, ndevices);
	    XtSetValues(listD, args, 2);
	}
	device = devices[i];
    }
    else {
	XtSetArg(args[0], XtNstring, "");
	XtSetValues(text, args, 1);
	XawListUnhighlight(listD);
    }

    if (protocol != NULL) {
	for (i = 0; i < sizeof(protocols) / sizeof(protocols[0]); i++)
	    if (strcasecmp(protocol, protocols[i].name) == 0) {
		protocol = protocols[i].name;
		XawListHighlight(listP, i);
		break;
	    }
    }
    else {
	/* "Auto" is the default */
	protocol = protocols[0].name;
	XawListHighlight(listP, 0);
    }

    XtSetArg(args[0], XtNstate, emulate);
    XtSetValues(emul3, args, 1);

    XtChangeManagedSet(&current, 1, NULL, NULL, &mouse_dp, 1);
    current = mouse_dp;
}
Beispiel #14
0
/*
 * Implementation
 */
XtPointer
ScreenConfig(XtPointer conf)
{
    XF86ConfDisplayPtr disp;
    Arg args[2];
    int i, oldrotate;

    screen = (XF86ConfScreenPtr)conf;
    if (screen == NULL)
	return (NULL);

    XtSetArg(args[0], XtNstring, screen->scrn_identifier);
    XtSetValues(ident_widget, args, 1);
    if ((default_depth = screen->scrn_defaultdepth) <= 0)
	default_depth = 8;
    sel_index = unsel_index = -1;
    for (i = 0; i < computer.num_screens; i++)
	if (computer.screens[i]->screen == screen) {
	    SetScreenRotate(computer.screens[i]);
	    rotate = computer.screens[i]->rotate;
    }
    oldrotate = rotate;

    ndefmodes = 0;
    disp = screen->scrn_display_lst;
    while (disp != NULL) {
	if (disp->disp_depth == default_depth) {
	    XF86ModePtr mod = disp->disp_mode_lst;

	    while (mod != NULL) {
		if (ndefmodes % 16 == 0)
		    defmodes = (char**)
			XtRealloc((XtPointer)defmodes,
				  (ndefmodes + 16) * sizeof(char*));
		defmodes[ndefmodes++] = XtNewString(mod->mode_name);
		mod = (XF86ModePtr)(mod->list.next);
	    }
	    break;
	}
	disp = (XF86ConfDisplayPtr)(disp->list.next);
    }
    if (ndefmodes == 0) {
	defmodes = (char**)XtMalloc(sizeof(char*));
	defmodes[0] = XtNewString("640x480");
	ndefmodes = 1;
    }

    if (listL != NULL) {
	XawListUnhighlight(listL);
	XawListUnhighlight(listR);
    }

    xf86info.cur_list = SCREEN;
    XtSetSensitive(back, xf86info.lists[SCREEN].cur_function > 0);
    XtSetSensitive(next, xf86info.lists[SCREEN].cur_function <
			 xf86info.lists[SCREEN].num_functions - 1);
    (xf86info.lists[SCREEN].functions[xf86info.lists[SCREEN].cur_function])
	(&xf86info);

    if (ConfigLoop(NULL) == True) {
	XF86ModePtr prev = NULL, mod;

	/* user may have changed the default depth, read variables again */
	disp = screen->scrn_display_lst;
	while (disp != NULL) {
	    if (disp->disp_depth == default_depth)
		break;
	    disp = (XF86ConfDisplayPtr)(disp->list.next);
	}

	if (disp == NULL) {
	    disp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec));
	    screen->scrn_display_lst = (XF86ConfDisplayPtr)
		xf86addListItem((GenericListPtr)(screen->scrn_display_lst),
			    (GenericListPtr)(disp));
	    disp->disp_depth = default_depth;
	}

	if (strcasecmp(screen->scrn_identifier, ident_string))
	    xf86renameScreen(XF86Config, screen, ident_string);

	screen->scrn_defaultdepth = default_depth;

	XtSetArg(args[0], XtNlist, NULL);
	XtSetArg(args[1], XtNnumberStrings, 0);
	XtSetValues(listL, args, 2);

	XtSetArg(args[0], XtNlist, NULL);
	XtSetArg(args[1], XtNnumberStrings, 0);
	XtSetValues(listR, args, 2);

	mod = disp->disp_mode_lst;
	/* free all modes */
	while (mod != NULL) {
	    prev = mod;
	    mod = (XF86ModePtr)(mod->list.next);
	    XtFree(prev->mode_name);
	    XtFree((XtPointer)prev);
	}
	/* readd modes */
	for (i = 0; i < ndefmodes; i++) {
	    mod = XtNew(XF86ModeRec);
	    mod->mode_name = XtNewString(defmodes[i]);
	    XtFree(defmodes[i]);
	    if (i == 0)
		disp->disp_mode_lst = mod;
	    else
		prev->list.next = mod;
	    prev = mod;
	}
	if (i == 0)
	    disp->disp_mode_lst = NULL;
	else
	    mod->list.next = NULL;

	XtFree((XtPointer)defmodes);
	defmodes = NULL;
	ndefmodes = 0;

	for (i = 0; i < computer.num_screens; i++)
	    if (computer.screens[i]->screen == screen)
		computer.screens[i]->rotate = rotate;

	if (oldrotate != rotate) {
	    static char *Rotate = "Rotate";

	    if (screen->scrn_option_lst != NULL)
		xf86removeOption(&screen->scrn_option_lst, Rotate);
	    if (rotate)
		screen->scrn_option_lst =
		    xf86addNewOption(screen->scrn_option_lst,
				     XtNewString(Rotate),
				     XtNewString(rotate > 0 ? "CW" : "CCW"));
	    UpdateScreenUI();
	    AdjustScreenUI();
	}

	return ((XtPointer)screen);
    }

    XtSetArg(args[0], XtNlist, NULL);
    XtSetArg(args[1], XtNnumberStrings, 0);
    XtSetValues(listL, args, 2);

    XtSetArg(args[0], XtNlist, NULL);
    XtSetArg(args[1], XtNnumberStrings, 0);
    XtSetValues(listR, args, 2);

    for (i = 0; i < ndefmodes; i++)
	XtFree(defmodes[i]);
    XtFree((XtPointer)defmodes);
    defmodes = NULL;
    ndefmodes = 0;

    return (NULL);
}