home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 May / Chip_2000-05_cd2.bin / suse / inst-sys / lib / YaST2 / clients / inst_config_x11.ycp < prev    next >
Encoding:
Text File  |  2000-03-30  |  19.5 KB  |  716 lines

  1. /**
  2.  *
  3.  * $Id: inst_config_x11.ycp,v 1.21 2000/03/09 09:06:41 kkaempf Exp $
  4.  *
  5.  * Module:        inst_config_x11.ycp
  6.  *
  7.  * Author:        Stefan Hundhammer <sh@suse.de>
  8.  *            Stefan Schubert <schubi@suse.de>
  9.  *
  10.  * Purpose:        Let the user choose screen resolution and color depth.
  11.  *            Optionally select "No X11 configuration".
  12.  *            Additionally toggle 3D acceleration.
  13.  *            Branch into X11 test (xfine).
  14.  *
  15.  * user_settings:    monitor ( have the same format as SCR-output )
  16.  *                      monitor_auto_probed
  17.  */
  18. {
  19.    boolean test_mode    = lookup ( user_settings, "test_mode", false );
  20.  
  21.    // allow going back only if monitor wasn't autoprobed
  22.    boolean allow_back   = ( lookup( user_settings, "monitor_auto_probed", false ) == false );
  23.  
  24.    if ( ! lookup(user_settings,"have_x11",true ) )
  25.    {
  26.     // Doing nothing cause there was no X-Server installed
  27.     return `next;
  28.    }
  29.  
  30.    // evaluate monitor and display settings and ask the user if it
  31.    // would be needed.
  32.  
  33.    map monitor = lookup ( user_settings, "monitor", $[] );
  34.  
  35.    any video_ret = `again;
  36.  
  37.    if ( size ( monitor ) <= 0 || allow_back )
  38.    {
  39.        // check only, if monitor is not set.
  40.        video_ret = CallFunction( `inst_video_data( false, true ) );
  41.  
  42.        if ( video_ret == `no_x11 )
  43.        {
  44.        // Doing nothing cause user didn't want X11 to be configured
  45.        Shell("rm /etc/XF86Config");
  46.        Shell("rm /var/X11R6/bin/X");
  47.        return `next;
  48.        }
  49.  
  50.        monitor = lookup ( user_settings, "monitor", $[] );
  51.    }
  52.  
  53.    
  54.    list all_resolutions =
  55.       [
  56.        $[ `x:  640,    `y:  480 ],
  57.        $[ `x:  800,    `y:  600 ],
  58.        $[ `x: 1024,    `y:  768 ],
  59.        $[ `x: 1152,    `y:  864 ],
  60.        $[ `x: 1280,    `y:  960 ],
  61.        $[ `x: 1280,    `y: 1024 ],
  62.        $[ `x: 1600,    `y: 1200 ]
  63.       ];
  64.  
  65.    list rev_all_resolutions =
  66.       [
  67.        $[ `x: 1600,    `y: 1200 ],
  68.        $[ `x: 1280,    `y: 1024 ],
  69.        $[ `x: 1280,    `y:  960 ],
  70.        $[ `x: 1152,    `y:  864 ],
  71.        $[ `x: 1024,    `y:  768 ],
  72.        $[ `x:  800,    `y:  600 ],
  73.        $[ `x:  640,    `y:  480 ]
  74.       ];
  75.  
  76.   list vga = SCR(`Read(.probe.bios_video) );
  77.   map display = select ( vga, 0 ); // first entry
  78.  
  79.   list resolution_list = lookup ( lookup ( monitor, "resource", $[] ),
  80.                              "monitor_resol", [] );
  81.   string  video_card_name       = lookup ( display ,"sub_vendor", "" ) +
  82.         " " + lookup ( display ,"sub_device", "" );
  83.   string  x_server_name        = lookup ( user_settings, "xservername","SVGA");
  84.   boolean have_3d_accel        = false;
  85.  
  86.   list allVga = SCR(`Read(.probe.display));
  87.  
  88.   y2log(.milestone, "inst_config_x11", 5,sformat("all vga cards: %1", allVga ));
  89.  
  90.   foreach ( `display, allVga, ``{
  91.       map x11 = lookup ( display , "x11", $[] );
  92.     list x3d = lookup ( x11, "x3d", [] );
  93.  
  94.     if ( size(x3d) > 0 )
  95.     {
  96.         have_3d_accel = true;
  97.     }
  98.     });
  99.  
  100.  
  101.  
  102.   //
  103.   // Get the width of the selected screen-resolution
  104.   //
  105.   define getCurrentWidth( )
  106.      ``{
  107.       integer ret = 0;
  108.       foreach ( `resolution, all_resolutions, ``{
  109.           string res_id = sformat ( "%1 x %2",
  110.                 lookup ( resolution, `x ),
  111.                 lookup ( resolution, `y ) );
  112.            if ( UI(`QueryWidget(`id( res_id ), `Value)) )
  113.            {
  114.            //entry found
  115.            ret =  lookup ( resolution, `x );
  116.                }
  117.  
  118.             });
  119.             return(ret);
  120.    };
  121.  
  122.  
  123.   //
  124.   // Get the height of the selected screen-resolution
  125.   //
  126.   define getCurrentHeight( )
  127.      ``{
  128.       integer ret = 0;
  129.       foreach ( `resolution, all_resolutions, ``{
  130.           string res_id = sformat ( "%1 x %2",
  131.                 lookup ( resolution, `x ),
  132.                 lookup ( resolution, `y ) );
  133.            if ( UI(`QueryWidget(`id( res_id ), `Value)) )
  134.            {
  135.            //entry found
  136.            ret = lookup ( resolution, `y );
  137.                }
  138.  
  139.             });
  140.             return(ret);
  141.    };
  142.  
  143.   //
  144.   // Get the selected color-depth
  145.   //
  146.   define getCurrentColorDepth( )
  147.      ``{
  148.  
  149.         if ( UI(`QueryWidget(`id( `depth8 ), `Value)) )
  150.         {
  151.         return ( 8 );
  152.         }
  153.         if ( UI(`QueryWidget(`id( `depth16 ), `Value)) )
  154.         {
  155.         return ( 16 );
  156.         }
  157.         if ( UI(`QueryWidget(`id( `depth24 ), `Value)) )
  158.         {
  159.         return ( 24 );
  160.         }
  161.         if ( UI(`QueryWidget(`id( `depth32 ), `Value)) )
  162.         {
  163.         return ( 32 );
  164.         }
  165.          return ( 0 );
  166.    };
  167.  
  168.  
  169.   //
  170.   // Get the frequency
  171.   //
  172.   define getCurrentFrequency( )
  173.      ``{
  174.           integer max_frequency = 0;
  175.           integer height = getCurrentHeight();
  176.           integer width = getCurrentWidth();
  177.  
  178.           foreach ( `monitor_resolution, resolution_list, ``{
  179.         // find maximal frequency for this resolution
  180.                  if ( width == lookup ( monitor_resolution, "width",0 ) &&
  181.              height == lookup ( monitor_resolution, "height",0 ) )
  182.         {
  183.             integer frequency = lookup ( monitor_resolution, "vfreq", 0 );
  184.             if ( max_frequency < frequency )
  185.             {
  186.                 max_frequency = frequency;
  187.             }
  188.         }
  189.           });
  190.  
  191.           return ( max_frequency );
  192.    };
  193.  
  194.  
  195.   //
  196.   // Disable color-depth and resolution input
  197.   //
  198.   define disableX11Input( )
  199.      ``{
  200.  
  201.       UI( `ChangeWidget(`id(`depth8), `Enabled, false));
  202.       UI( `ChangeWidget(`id(`depth16), `Enabled, false));
  203.       UI( `ChangeWidget(`id(`depth24), `Enabled, false));
  204.       UI( `ChangeWidget(`id(`depth32), `Enabled, false));
  205.  
  206.       foreach ( `resolution, all_resolutions, ``{
  207.               string res_id = sformat ( "%1 x %2",
  208.                 lookup ( resolution, `x ),
  209.                 lookup ( resolution, `y ) );
  210.            UI( `ChangeWidget(`id(res_id), `Enabled, false));
  211.       });
  212.       UI( `ChangeWidget(`id(`use_3D_accel), `Enabled, false));
  213.       UI( `ChangeWidget(`id(`test_X11), `Enabled, false));
  214.    };
  215.  
  216.   //
  217.   // Check, if the resolution-input is valid. If not, setting a valid value automatically.
  218.   //
  219.   define checkResolutionInput( )
  220.      ``{
  221.       boolean wrongEntry = false;
  222.       boolean firstValidEntry = false;
  223.       foreach ( `resolution, rev_all_resolutions, ``{
  224.               string res_id = sformat ( "%1 x %2",
  225.                 lookup ( resolution, `x ),
  226.                 lookup ( resolution, `y ) );
  227.            if ( ! UI( `QueryWidget(`id(res_id), `Enabled)) &&
  228.                  UI(`QueryWidget(`id( res_id ), `Value)) )
  229.            {
  230.             // wrong entry found
  231.             wrongEntry = true;
  232.            }
  233.            if ( wrongEntry &&
  234.             UI( `QueryWidget(`id(res_id), `Enabled)) )
  235.            {
  236.             // setting new entry
  237.             if ( ! firstValidEntry )
  238.             {
  239.                 // take the second valid entry
  240.                 firstValidEntry = true;
  241.             }
  242.             else
  243.             {
  244.                 // set entry
  245.                 UI( `ChangeWidget( `id( res_id ), `Value, true ) );
  246.                 firstValidEntry = false;
  247.                 wrongEntry = false;
  248.                 monitor = add ( monitor,"currentWidth",lookup ( resolution, `x ) );
  249.                 monitor = add ( monitor,"currentHeight", lookup ( resolution, `y ));
  250.             }
  251.             }
  252.       });
  253.       if ( wrongEntry )
  254.       {
  255.         // set minimal resolution
  256.         UI( `ChangeWidget( `id( "640 x 480" ), `Value, true ));
  257.         monitor = add ( monitor,"currentWidth", 640);
  258.         monitor = add ( monitor,"currentHeight", 480);
  259.       }
  260.    };
  261.  
  262.  
  263.   //
  264.   // Enable color-depth and resolution input and set the previous user-settings
  265.   //
  266.   define enableX11Input( )
  267.      ``{
  268.     // Get user_settings values
  269.     integer height = lookup ( monitor, "currentHeight", 0 );
  270.     integer width = lookup ( monitor, "currentWidth", 0 );
  271.  
  272.     if ( height > 0 && width > 0 )
  273.     {
  274.            string res_monitor = sformat ( "%1 x %2",
  275.                 width,
  276.                 height );
  277.         UI( `ChangeWidget( `id( res_monitor ), `Value, true ) );
  278.     }
  279.     else
  280.     {
  281.         // Select a default resolution
  282.          UI( `ChangeWidget( `id( "1280 x 960" ), `Value, true ) );
  283.         monitor = add ( monitor,"currentWidth", 1280);
  284.         monitor = add ( monitor,"currentHeight", 960);
  285.     }
  286.  
  287.  
  288.         integer colorDepth = lookup ( monitor, "currentColorDepth", 0);
  289.     if ( UI(`QueryWidget(`id(`use_3D_accel), `Value)))
  290.     {
  291.         // 3d selected --> depth 16
  292.         UI( `ChangeWidget( `id( `depth16 ), `Value, true ) );
  293.         monitor = add ( monitor,"currentColorDepth",
  294.                 16);
  295.         colorDepth = 16;
  296.     }
  297.     else
  298.     {
  299.         if ( colorDepth > 0 )
  300.         {
  301.             if ( colorDepth == 8 )
  302.             {
  303.                 UI( `ChangeWidget( `id( `depth8 ), `Value, true ) );
  304.             }
  305.             else if ( colorDepth == 16 )
  306.             {
  307.                 UI( `ChangeWidget( `id( `depth16 ), `Value, true ) );
  308.             }
  309.             else if ( colorDepth == 24 )
  310.             {
  311.                 UI( `ChangeWidget( `id( `depth24 ), `Value, true ) );
  312.             }
  313.             else if ( colorDepth == 32 )
  314.             {
  315.                 UI( `ChangeWidget( `id( `depth32 ), `Value, true ) );
  316.             }
  317.         }
  318.         else
  319.         {
  320.             // Select a default color depth
  321.             UI( `ChangeWidget( `id( `depth16 ), `Value, true ) );
  322.             monitor = add ( monitor,"currentColorDepth",
  323.                 16);
  324.             colorDepth = 16;
  325.         }
  326.     }
  327.  
  328.     // 3d support ?
  329.  
  330.     UI(`ChangeWidget(`id(`use_3D_accel),`Value, lookup( monitor,"3dSelected",false) ));
  331.  
  332.  
  333.     // Evaluate all possible settings for screen resolution
  334.     if ( size ( resolution_list ) > 0 )
  335.       {
  336.              // hidden all entries in the screen resolution
  337.              foreach ( `resolution, all_resolutions, ``{
  338.                   string res_id = sformat ( "%1 x %2",
  339.                 lookup ( resolution, `x ),
  340.                 lookup ( resolution, `y ) );
  341.                UI( `ChangeWidget(`id(res_id), `Enabled, false));
  342.                 });
  343.  
  344.                 // enable if supported
  345.                 foreach ( `monitor_resolution, resolution_list, ``{
  346.                  string res_monitor = sformat ( "%1 x %2",
  347.                 lookup ( monitor_resolution, "width" ),
  348.                 lookup ( monitor_resolution, "height" ) );
  349.             integer color = lookup ( monitor_resolution, "color", 0 );
  350.  
  351.                foreach ( `resolution, all_resolutions, ``{
  352.                    string res_id = sformat ( "%1 x %2",
  353.                     lookup ( resolution, `x ),
  354.                     lookup ( resolution, `y ) );
  355.                    if ( res_id == res_monitor && color == colorDepth)
  356.                    {
  357.                           UI( `ChangeWidget(`id(res_id), `Enabled, true));
  358.                     }
  359.                     });
  360.                 });
  361.       }
  362.  
  363.       map x11 = lookup ( display , "x11", $[] );
  364.  
  365.     // check if the color depth is supported by the video-card
  366.     if ( UI(`QueryWidget(`id(`use_3D_accel), `Value)))
  367.     {
  368.         //3d supported --> only depth 16 is valid
  369.         UI( `ChangeWidget(`id(`depth8), `Enabled, false ));
  370.           UI( `ChangeWidget(`id(`depth16), `Enabled, true ));
  371.         UI( `ChangeWidget(`id(`depth24), `Enabled, false ));
  372.           UI( `ChangeWidget(`id(`depth32), `Enabled, false ));
  373.     }
  374.     else
  375.     {
  376.             if ( size( x11 ) > 0 )
  377.         {
  378.               UI( `ChangeWidget(`id(`depth8), `Enabled, lookup ( x11, "c8", true )));
  379.               UI( `ChangeWidget(`id(`depth16), `Enabled, lookup ( x11, "c16", true )));
  380.               UI( `ChangeWidget(`id(`depth24), `Enabled, lookup ( x11, "c24", true )));
  381.               UI( `ChangeWidget(`id(`depth32), `Enabled, lookup ( x11, "c32", true )));
  382.         }
  383.         else
  384.         {
  385.               UI( `ChangeWidget(`id(`depth8), `Enabled, true ));
  386.               UI( `ChangeWidget(`id(`depth16), `Enabled, true ));
  387.               UI( `ChangeWidget(`id(`depth24), `Enabled, true ));
  388.               UI( `ChangeWidget(`id(`depth32), `Enabled, true ));
  389.         }
  390.     }
  391.  
  392.     if ( have_3d_accel )
  393.     {
  394.         UI( `ChangeWidget(`id(`use_3D_accel), `Enabled, true));
  395.     }
  396.     else
  397.     {
  398.         UI( `ChangeWidget(`id(`use_3D_accel), `Enabled, false));
  399.         UI( `ChangeWidget(`id(`use_3D_accel), `Value, false));
  400.     }
  401.     UI( `ChangeWidget(`id(`test_X11), `Enabled, true));
  402.  
  403.     // Check, if the resolution-input is valid. If not, setting a valid value automatically.
  404.     checkResolutionInput();
  405.  
  406.    };
  407.  
  408.  
  409.  
  410.  
  411.   string video_card_info =    sformat (
  412.                      // Video card information string:
  413.                      // %1 will be substituted with the name of the video card
  414.                      // (e.g. "Hyper VGA DeLuxe Pro"),
  415.                      // %2 with the amount of video memory (+MB etc.).
  416.                      UI( _( "%1 " ) ),
  417.                      video_card_name );
  418.  
  419.   string x_server_info =    sformat(
  420.                     // X server information string:
  421.                     // %1 will be substituted with the name of the X server to use
  422.                     // (e.g. "SVGA").
  423.                     UI( _( "X server: %1" ) ), x_server_name );
  424.  
  425.  
  426.   // Create radio box for screen resolution
  427.  
  428.   term resolution_radio_buttons  = `VBox();
  429.  
  430.   foreach ( `resolution, all_resolutions, ``{
  431.       string res_id = sformat ( "%1 x %2",
  432.                 lookup ( resolution, `x ),
  433.                 lookup ( resolution, `y ) );
  434.       resolution_radio_buttons = add ( resolution_radio_buttons,
  435.                        `Left( `RadioButton( `id( res_id ), `opt(`notify),res_id ) ) );
  436.  
  437.   });
  438.  
  439.  
  440.  
  441.  
  442.   // Create radio box for color depth
  443.  
  444.   term color_depth_radio_buttons =
  445.       `VBox(
  446.         // Radio button for 8 bit color depth
  447.         `Left( `RadioButton( `id( `depth8  ),`opt(`notify), _( "256 colors (8 bpp)"    ) ) ),
  448.  
  449.         // Radio button for 16 bit color depth
  450.         `Left( `RadioButton( `id( `depth16 ),`opt(`notify), _( "65K colors (16 bpp)"   ) ) ),
  451.  
  452.         // Radio button for 24 bit color depth
  453.         `Left( `RadioButton( `id( `depth24 ),`opt(`notify), _( "16.7M colors (24 bpp)" ) ) ),
  454.  
  455.         // Radio button for 32 bit color depth
  456.         `Left( `RadioButton( `id( `depth32 ),`opt(`notify), _( "16.7M colors (32 bpp)" ) ) )
  457.         );
  458.  
  459.  
  460.   // Build window contents
  461.  
  462.   term contents = `HBox(
  463.             `HWeight( 3, `HStretch() ),
  464.             `HWeight( 100, `VBox( `Left( `Label ( video_card_info ) ),
  465.                           `Left( `Label ( x_server_info   ) ),
  466.                           `Label( " " ),
  467.  
  468.                           // Check box to skip X configuration alltogether
  469.                           // (will disable all other settings in this dialog when checked)
  470.                           `Left( `CheckBox ( `id( `no_X11 ),`opt(`notify), _( "No X11 configuration" ) ) ),
  471.                           `Label( " " ),
  472.  
  473.                           `HBox(
  474.                             `HWeight( 45, `Top(
  475.                                        `Frame(
  476.                                           // Frame title for screen resolution radio box
  477.                                           _( "Resolution" ),
  478.                                           `RadioButtonGroup( resolution_radio_buttons )
  479.                                           )
  480.                                        )
  481.                                   ),
  482.                             `HWeight( 3, `HStretch() ),
  483.                             `HWeight( 55, `VBox(
  484.                                     `Top(
  485.                                          `Frame(
  486.                                             // Frame title for color depth radio box
  487.                                             _( "Colors" ),
  488.                                             `RadioButtonGroup( color_depth_radio_buttons )
  489.                                             )
  490.                                          ),
  491.  
  492.                                     // Check box to enable/disable 3D graphics acceleration
  493.                                     `VCenter(
  494.                                          `Left(
  495.                                                `CheckBox( `id( `use_3D_accel ),`opt(`notify), _("Use 3D acceleration") )
  496.                                                )
  497.                                          )
  498.                                     )
  499.                                   )
  500.                             ),
  501.  
  502.                           // Push button to test the selected settings:
  503.                           // starts the selected X server and 'xfine'
  504.                           `PushButton( `id( `test_X11 ),`opt(`notify), _( "&Test" ) )
  505.                           )
  506.                   ),
  507.             `HWeight( 3, `HStretch() )
  508.             );
  509.  
  510.   // Help text for inst_config_x11.ycp: The user selects video resulution and color depth.
  511.   // Window layout:
  512.   //
  513.   // <Information about automatically detected video card and its amount of memory>
  514.   // <Information about what X server to use (depends on the video card)>
  515.   //
  516.   // <Check box "No X11 configuration">
  517.   //
  518.   // <Radio box for screen resolutions>   <Radio box for color depth>
  519.   //
  520.   //                                      <Check box "Use 3D acceleration">
  521.   //
  522.   //                           <Push button "Test">
  523.   //
  524.   //
  525.   // "No X11 configuration" will disable most the other items in this
  526.   // window, if checked.
  527.   //
  528.   // "Use 3D acceleration" specifies whether or not to use hardware
  529.   // accelerated 3D graphics (e.g. Voodoo- and TNT-based video cards).
  530.   //
  531.   // The "Test" button will start the appropriate X server and "xfine"
  532.   // to let the user fine-tune the video settings (horizontal/vertical
  533.   // sizes and positions).
  534.   //
  535.   // Help text (HTML-like) START
  536.   string help_text = UI( _( "<p>
  537. Please select the <b>Desktop Settings</b> to use for the X Window System (X11).
  538. </p>" ) );
  539.  
  540.   // Help text (HTML-like) continued
  541.   help_text = help_text + UI( _( "<p>
  542. The video card shown has automatically been detected.
  543. The appropriate X server for this video card has been chosen accordingly.
  544. </p>" ) );
  545.  
  546.   // Help text (HTML-like) continued
  547.   help_text = help_text + UI( _( "<p>
  548. Select <b>No X11 configuration</b> to skip X Window configuration.
  549. You can configure X11 manually later (using <b><i>sax</i></b>) if you wish.
  550. </p>" ) );
  551.  
  552.   // Help text (HTML-like) continued
  553.   help_text = help_text + UI( _( "<p>
  554. Select one of the possible screen <b>Resolutions</b> from the box on
  555. the left side and one of the possible <b>Color</b> settings from the
  556. box on the right side.
  557. </p>" ) );
  558.  
  559.   // Help text (HTML-like) continued
  560.   help_text = help_text + UI( _( "<p>
  561. Please notice that not all combinations of colors and resolution may
  562. be valid with your video card; this depends on the amount of memory
  563. (shown above) on  the card.
  564. The higher the resolution and the number of colors, the more memory is required.
  565. </p>" ) );
  566.  
  567.   // Help text (HTML-like) continued
  568.   help_text = help_text + UI( _( "<p>
  569. Select <b>Use 3D acceleration</b> to enable hardware accelerated 3D graphics.
  570. Not all video cards are capable of using this feature.
  571. </p>" ) );
  572.  
  573.   // Help text (HTML-like) continued
  574.   help_text = help_text + UI( _( "<p>
  575. When you are satisfied with your selections, make sure to select
  576. <b>Test</b> to check the settings.
  577. </p>" ) );
  578.  
  579.   // Help text (HTML-like) END
  580.   //
  581.   // The screen that is being referred to is 'xfine' - a tool that
  582.   // displays a full screen image and some arrow buttons to adjust image
  583.   // sizes and position.
  584.   help_text = help_text + UI( _( "<p>
  585. Adjust the horizontal and vertical sizes and positions
  586. of the screen image that is displayed when you press that button.
  587. </p>" ) );
  588.  
  589.   UI(`SetWizardContents(
  590.             // Headline for X11 configuration screen:
  591.             // The user selects screen resolution and color depth.
  592.             _("Desktop Settings"),
  593.             contents,
  594.             help_text,
  595.             ( Args(0) && allow_back ),    // have_back_button
  596.             Args(1)                      // have_next_button
  597.             )
  598.      );
  599.  
  600.  
  601.  
  602.   if ( ! lookup(monitor,"no_x11_selected",false ) )
  603.   {
  604.     UI(`ChangeWidget(`id(`no_X11 ), `Value, false));
  605.     enableX11Input();
  606.   }
  607.   else
  608.   {
  609.     UI(`ChangeWidget(`id(`no_X11 ), `Value, true));
  610.     disableX11Input();
  611.   }
  612.  
  613.  
  614.   // Event loop
  615.  
  616.   any ret = nil;
  617.   boolean asked = false;
  618.  
  619.   repeat
  620.       {
  621.       ret = UI(`UserInput());
  622.  
  623.       if ( ret == `cancel )
  624.         break;
  625.       if ( ret == `next )
  626.       {
  627.             if ( ! test_mode &&
  628.              ! lookup ( monitor, "settingsChecked", false ) &&
  629.              ! lookup( monitor,"no_x11_selected",false ) )
  630.         {
  631.             UI(`DisplayMessage(_("Please test your selected video mode first.")));
  632.         }
  633.         else
  634.         {
  635.             break;
  636.         }
  637.       }
  638.  
  639.       if ( UI(`QueryWidget(`id(`no_X11 ), `Value)))
  640.           {
  641.         // no server settings
  642.         disableX11Input();
  643.         monitor = add ( monitor,"no_x11_selected", true );
  644.         user_settings = add ( user_settings, "monitor", monitor );
  645.       }
  646.       else
  647.       {
  648.         monitor = add ( monitor,"no_x11_selected", false );
  649.         monitor = add ( monitor,"currentWidth",getCurrentWidth());
  650.         monitor = add ( monitor,"currentHeight",getCurrentHeight());
  651.         monitor = add ( monitor,"currentFrquency",
  652.                 getCurrentFrequency());
  653.         monitor = add ( monitor,"currentColorDepth",
  654.                 getCurrentColorDepth());
  655.         monitor = add ( monitor,"3dSelected",
  656.             UI(`QueryWidget(`id(`use_3D_accel),`Value )));
  657.         enableX11Input();
  658.         user_settings = add ( user_settings, "monitor", monitor );
  659.  
  660.         // testing settings
  661.         if ( ret == `test_X11 )
  662.         {
  663.             if (    asked  ||
  664.                 UI(`ContinueCancel( _(
  665. // Warning message dialog before starting 'xfine'
  666. "The selected video mode will now be tested.
  667. If you do not see the test picture, press the
  668. ESC key to return to this screen immediately."),
  669.                             // Continue button in xfine warning dialog -> xfine will be started
  670.                             _("C&ontinue"),
  671.                             
  672.                             // Cancel button in xfine warning dialog -> xfine will not be started
  673.                             _("&Cancel") ) ) )
  674.             {
  675.                 any ret = `next; UI(`NormalCursor());
  676.                 ret = CallFunction( `inst_xf86config( true, true ) );
  677.                 UI(`NormalCursor()); // shouldn't be neccessary, but unfortunately, it is :-((
  678.  
  679.                 if ( ret == `next )
  680.                 {
  681.                 monitor = add ( monitor, "settingsChecked", true );
  682.                 }
  683.                 else
  684.                 {
  685.                 monitor = add ( monitor, "settingsChecked", false );
  686.                 }
  687.                 asked = true;
  688.             }
  689.             else
  690.             {
  691.                 monitor = add ( monitor, "settingsChecked", false );
  692.                 asked = false;
  693.             }
  694.         }
  695.         else
  696.         {
  697.             monitor = add ( monitor, "settingsChecked", false );
  698.         }
  699.       }
  700.       } until ( ret == `back);
  701.  
  702.   user_settings = add ( user_settings, "monitor", monitor );
  703.  
  704.   // delete X11 files if X11 is not selected
  705.   if ( lookup( monitor, "no_x11_selected", false) && ret == `next )
  706.   {
  707.       Shell("rm /etc/XF86Config");
  708.       Shell("rm /var/X11R6/bin/X");
  709.   }
  710.   
  711.   // if monitor was selected manually allow going back to this screen
  712.   if ( ret == `back && allow_back ) ret = `again;
  713.   
  714.   return ret;
  715. }
  716.