int xf86validateScreen(XF86ConfigPtr p) { XF86ConfScreenPtr screen = p->conf_screen_lst; XF86ConfMonitorPtr monitor; XF86ConfAdaptorLinkPtr adaptor; while (screen) { if (screen->scrn_obso_driver && !screen->scrn_identifier) screen->scrn_identifier = screen->scrn_obso_driver; monitor = xf86findMonitor(screen->scrn_monitor_str, p->conf_monitor_lst); if (screen->scrn_monitor_str) { if (monitor) { screen->scrn_monitor = monitor; if (!xf86validateMonitor(p, screen)) return FALSE; } } screen->scrn_device = xf86findDevice(screen->scrn_device_str, p->conf_device_lst); adaptor = screen->scrn_adaptor_lst; while (adaptor) { adaptor->al_adaptor = xf86findVideoAdaptor(adaptor->al_adaptor_str, p->conf_videoadaptor_lst); if (!adaptor->al_adaptor) { xf86validationError(UNDEFINED_ADAPTOR_MSG, adaptor->al_adaptor_str, screen->scrn_identifier); return FALSE; } else if (adaptor->al_adaptor->va_fwdref) { xf86validationError(ADAPTOR_REF_TWICE_MSG, adaptor->al_adaptor_str, adaptor->al_adaptor->va_fwdref); return FALSE; } adaptor->al_adaptor->va_fwdref = strdup(screen->scrn_identifier); adaptor = adaptor->list.next; } screen = screen->list.next; } return TRUE; }
/* * 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); }