xserver

xserver with xephyr scale patch
git clone https://git.neptards.moe/u3shit/xserver.git
Log | Files | Refs | README | LICENSE

winvalargs.c (6087B)


      1 /*
      2  *Copyright (C) 2003-2004 Harold L Hunt II All Rights Reserved.
      3  *
      4  *Permission is hereby granted, free of charge, to any person obtaining
      5  * a copy of this software and associated documentation files (the
      6  *"Software"), to deal in the Software without restriction, including
      7  *without limitation the rights to use, copy, modify, merge, publish,
      8  *distribute, sublicense, and/or sell copies of the Software, and to
      9  *permit persons to whom the Software is furnished to do so, subject to
     10  *the following conditions:
     11  *
     12  *The above copyright notice and this permission notice shall be
     13  *included in all copies or substantial portions of the Software.
     14  *
     15  *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
     16  *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
     17  *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
     18  *NONINFRINGEMENT. IN NO EVENT SHALL HAROLD L HUNT II BE LIABLE FOR
     19  *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
     20  *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
     21  *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
     22  *
     23  *Except as contained in this notice, the name of Harold L Hunt II
     24  *shall not be used in advertising or otherwise to promote the sale, use
     25  *or other dealings in this Software without prior written authorization
     26  *from Harold L Hunt II.
     27  *
     28  * Authors:	Harold L Hunt II
     29  */
     30 
     31 #ifdef HAVE_XWIN_CONFIG_H
     32 #include <xwin-config.h>
     33 #endif
     34 #include "win.h"
     35 #include "winmsg.h"
     36 
     37 /*
     38  * Verify all screens have been explicitly specified
     39  */
     40 static BOOL
     41 isEveryScreenExplicit(void)
     42 {
     43     int i;
     44 
     45     for (i = 0; i < g_iNumScreens; i++)
     46         if (!g_ScreenInfo[i].fExplicitScreen)
     47             return FALSE;
     48 
     49     return TRUE;
     50 }
     51 
     52 /*
     53  * winValidateArgs - Look for invalid argument combinations
     54  */
     55 
     56 Bool
     57 winValidateArgs(void)
     58 {
     59     int i;
     60     BOOL fHasNormalScreen0 = FALSE;
     61 
     62     /*
     63      * Check for a malformed set of -screen parameters.
     64      * Examples of malformed parameters:
     65      *    XWin -screen 1
     66      *    XWin -screen 0 -screen 2
     67      *    XWin -screen 1 -screen 2
     68      */
     69     if (!isEveryScreenExplicit()) {
     70         ErrorF("winValidateArgs - Malformed set of screen parameter(s).  "
     71                "Screens must be specified consecutively starting with "
     72                "screen 0.  That is, you cannot have only a screen 1, nor "
     73                "could you have screen 0 and screen 2.  You instead must "
     74                "have screen 0, or screen 0 and screen 1, respectively.  "
     75                "You can specify as many screens as you want.\n");
     76         return FALSE;
     77     }
     78 
     79     /* Loop through all screens */
     80     for (i = 0; i < g_iNumScreens; ++i) {
     81         /*
     82          * Check for any combination of
     83          * -multiwindow and -rootless.
     84          */
     85         {
     86             int iCount = 0;
     87 
     88             /* Count conflicting options */
     89             if (g_ScreenInfo[i].fMultiWindow)
     90                 ++iCount;
     91 
     92             if (g_ScreenInfo[i].fRootless)
     93                 ++iCount;
     94 
     95             /* Check if the first screen is without rootless and multiwindow */
     96             if (iCount == 0 && i == 0)
     97                 fHasNormalScreen0 = TRUE;
     98 
     99             /* Fail if two or more conflicting options */
    100             if (iCount > 1) {
    101                 ErrorF("winValidateArgs - Only one of -multiwindow "
    102                        "and -rootless can be specific at a time.\n");
    103                 return FALSE;
    104             }
    105         }
    106 
    107         /* Check for -multiwindow and Xdmcp */
    108         /* allow xdmcp if screen 0 is normal. */
    109         if (g_fXdmcpEnabled && !fHasNormalScreen0 && (FALSE
    110                                                       || g_ScreenInfo[i].
    111                                                       fMultiWindow
    112 
    113             )
    114             ) {
    115             ErrorF("winValidateArgs - Xdmcp (-query, -broadcast, or -indirect) "
    116                    "is invalid with -multiwindow.\n");
    117             return FALSE;
    118         }
    119 
    120         /* Check for -multiwindow or -rootless and -fullscreen */
    121         if (g_ScreenInfo[i].fFullScreen && (FALSE
    122                                             || g_ScreenInfo[i].fMultiWindow
    123                                             || g_ScreenInfo[i].fRootless)
    124             ) {
    125             ErrorF("winValidateArgs - -fullscreen is invalid with "
    126                    "-multiwindow or -rootless.\n");
    127             return FALSE;
    128         }
    129 
    130         /* Check for -multiwindow or -rootless and -nodecoration */
    131         if (!g_ScreenInfo[i].fDecoration && (FALSE
    132                                             || g_ScreenInfo[i].fMultiWindow
    133                                             || g_ScreenInfo[i].fRootless)
    134             ) {
    135             ErrorF("winValidateArgs - -nodecoration is invalid with "
    136                    "-multiwindow or -rootless.\n");
    137             return FALSE;
    138         }
    139 
    140         /* Check for !fullscreen and any fullscreen-only parameters */
    141         if (!g_ScreenInfo[i].fFullScreen
    142             && (g_ScreenInfo[i].dwRefreshRate != WIN_DEFAULT_REFRESH
    143                 || g_ScreenInfo[i].dwBPP != WIN_DEFAULT_BPP)) {
    144             ErrorF("winValidateArgs - -refresh and -depth are only valid "
    145                    "with -fullscreen.\n");
    146             return FALSE;
    147         }
    148 
    149         /* Check for fullscreen and any non-fullscreen parameters */
    150         if (g_ScreenInfo[i].fFullScreen
    151             && ((g_ScreenInfo[i].iResizeMode != resizeNotAllowed)
    152                 || !g_ScreenInfo[i].fDecoration
    153                 || g_ScreenInfo[i].fLessPointer)) {
    154             ErrorF("winValidateArgs - -fullscreen is invalid with "
    155                    "-scrollbars, -resize, -nodecoration, or -lesspointer.\n");
    156             return FALSE;
    157         }
    158 
    159         /* Ignore -swcursor if -multiwindow -compositewm is requested */
    160         if (g_ScreenInfo[i].fMultiWindow && g_ScreenInfo[i].fCompositeWM) {
    161             if (g_fSoftwareCursor) {
    162                 g_fSoftwareCursor = FALSE;
    163                 winMsg(X_WARNING, "Ignoring -swcursor due to -compositewm\n");
    164             }
    165         }
    166     }
    167 
    168     winDebug("winValidateArgs - Returning.\n");
    169 
    170     return TRUE;
    171 }