dtcm: Coverity 89287
[oweals/cde.git] / cde / programs / dtwm / WmFunction.c
index c8e9b5b3360e0aa91aba71e95b95b2025fe280f6..1f9c50daa190b695a98599766f1db0d5e6d0056f 100644 (file)
@@ -16,7 +16,7 @@
  * details.
  *
  * You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  * Floor, Boston, MA 02110-1301 USA
  */
 */ 
 /* 
  * Motif Release 1.2.4
-*/ 
-#ifdef REV_INFO
-#ifndef lint
-static char rcsid[] = "$TOG: WmFunction.c /main/19 1998/04/20 13:00:48 mgreess $"
-#endif
-#endif
+*/
 /*
  * (c) Copyright 1987, 1988, 1989, 1990, 1993, 1994 HEWLETT-PACKARD COMPANY 
  * (c) Copyright 1993, 1994 International Business Machines Corp.
@@ -44,48 +39,36 @@ static char rcsid[] = "$TOG: WmFunction.c /main/19 1998/04/20 13:00:48 mgreess $
  */
 
 #include "WmGlobal.h"
-#ifndef WSM
-#include <signal.h>
-#endif
 #include <stdio.h>
 #include <X11/Xos.h>
 #include "WmICCC.h"
-#ifdef WSM
 #include "WmWrkspace.h"  /* for ClientInWorkspace() test */
 #include <Dt/EnvControlP.h>  /* for restoring **environ before an exec() */
 #include "WmResNames.h"
 #include <Dt/Message.h>
 #include <Dt/Help.h>
-#endif /* WSM */
-#ifdef PANELIST
 #include <Dt/DtStrDefs.h>
 #include "WmPanelP.h"
 #include "WmSignal.h"
-#endif /* PANELIST */
+#include "WmManage.h"
 
 /*
  * include extern functions
  */
 #include "WmFunction.h"
 #include "WmCEvent.h"
-#ifdef WSM
 #include "WmHelp.h"
-#endif /* WSM */
 #include "WmCDInfo.h"
 #include "WmColormap.h"
 #include "WmError.h"
 #include "WmEvent.h"
 #include "WmFeedback.h"
-#ifdef WSM
 #include "WmIPC.h"
-#endif /* WSM */
 #include "WmIPlace.h"
 #include "WmIconBox.h"
 #include "WmKeyFocus.h"
 #include "WmMenu.h"
-#ifdef WSM
 #include "WmPresence.h"
-#endif /* WSM */
 #include "WmProperty.h"
 #include "WmProtocol.h"
 #include "WmResParse.h"
@@ -106,15 +89,12 @@ extern pid_t vfork();
 
 static unsigned int GetEventInverseMask(XEvent *event);
 
-#ifdef WSM
-
-#if (defined(USL) || defined(__uxp__) || defined(linux)) && !defined(_NFILE)
+#if (defined(__linux__) || defined(sun) || defined(CSRG_BASED)) && !defined(_NFILE)
 #define _NFILE FOPEN_MAX
 #endif
 #define CLOSE_FILES_ON_EXEC() \
 {int ifx; for (ifx=3; ifx < _NFILE; ifx++) (void) fcntl (ifx, F_SETFD, 1);}
 
-#endif /* WSM */
 /*
  * Global Variables:
  */
@@ -126,8 +106,6 @@ static unsigned int GetEventInverseMask(XEvent *event);
 static ClientData *dirtyStackEntry = NULL;
 static ClientData *dirtyLeader = NULL;
 
-#ifdef WSM
-\f
 /***********************<->*************************************
  *
  *  F_Action (args, pCD, event)
@@ -192,9 +170,7 @@ F_Action (String actionName, ClientData *pCD, XEvent *event)
     return (True);
     
 } /* END OF FUNCTION F_Action */
-#endif /* WSM */
 
-\f
 /******************************<->*************************************
  *
  *  F_Beep (args, pCD, event)
@@ -242,8 +218,7 @@ Boolean F_Beep (String args, ClientData *pCD, XEvent *event)
  * is to restack the dirty transient relative to the second to the
  * top transient.  This function is used to support freeFamily stacking.
  */
-ClientData * FindSecondToTopTransient (pcd)
-ClientData *pcd;
+ClientData * FindSecondToTopTransient (ClientData *pcd)
 {
     ClientData *pcdNext;
     static ClientData *second;
@@ -280,7 +255,6 @@ Boolean ForceLowerWindow (ClientData *pcd)
 #endif
     XWindowChanges changes;
     Boolean restack = False;
-#ifdef WSM
     Window stackWindow;
     WmScreenData *pSD = (ACTIVE_WS)->pSD;
     unsigned int mask;
@@ -322,7 +296,6 @@ Boolean ForceLowerWindow (ClientData *pcd)
            pCLE = pCLE->prevSibling;
        }
     }
-#endif /* WSM */
 #if 0
     if (pSD->lastClient->type == MINIMIZED_STATE)
     {
@@ -335,15 +308,10 @@ Boolean ForceLowerWindow (ClientData *pcd)
 #endif
 
     changes.stack_mode = Below;
-#ifdef WSM
     if (mask)
     {
        XConfigureWindow (DISPLAY, pcd->clientFrameWin, mask, &changes);
     }
-#else /* WSM */
-    XConfigureWindow (DISPLAY, pcd->clientFrameWin, CWStackMode,
-                     &changes);
-#endif /* WSM */
 
     return (restack);
 }
@@ -385,9 +353,7 @@ Boolean F_Lower (String args, ClientData *pCD, XEvent *event)
     ClientListEntry *pStackEntry;
     String string = args;
     int flags = STACK_NORMAL;
-#ifdef WSM
     WmWorkspaceData *pWS = ACTIVE_WS;
-#endif /* WSM */
 
     if (string)
     {
@@ -404,15 +370,11 @@ Boolean F_Lower (String args, ClientData *pCD, XEvent *event)
                                                        string, F_GROUP_ALL)))
            {
                pNextEntry = pEntry->prevSibling;
-#ifdef WSM
                if (ClientInWorkspace (pWS, pEntry->pCD))
                {
-#endif /* WSM */
                Do_Lower (pEntry->pCD, pStackEntry, STACK_NORMAL);
                pStackEntry = pEntry;
-#ifdef WSM
                }
-#endif /* WSM */
            }
        }
        /* process family stacking stuff */
@@ -436,26 +398,18 @@ Boolean F_Lower (String args, ClientData *pCD, XEvent *event)
                }
                index += len;
            }
-#ifdef WSM
            if (ClientInWorkspace (pWS, pCD))
            {
-#endif /* WSM */
            Do_Lower (pCD, (ClientListEntry *) NULL, flags);
-#ifdef WSM
            }
-#endif /* WSM */
        }
     }
     else if (pCD)
     {
-#ifdef WSM
            if (ClientInWorkspace (pWS, pCD))
            {
-#endif /* WSM */
        Do_Lower (pCD, (ClientListEntry *) NULL, STACK_NORMAL);
-#ifdef WSM
            }
-#endif /* WSM */
     }
 
     /*
@@ -499,11 +453,8 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
     Boolean restackTransients;
     ClientData *pcdLeader;
     WmWorkspaceData *pWS = ACTIVE_WS;
-#ifdef WSM
     Boolean bLeaderRestacked;
-#endif /* WSM */
 
-#ifdef PANELIST
     if (pCD->pECD)
     {
        /*
@@ -513,9 +464,6 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
        return;
     }
     else 
-#else /* PANELIST */
-#endif /* PANELIST */
-#ifdef WSM
     if (ClientInWorkspace(pWS, pCD)  && 
        (!pStackEntry || ClientInWorkspace (pWS, pStackEntry->pCD)))
     {
@@ -537,7 +485,6 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
         */
        return;
     }
-#endif /* WSM */
 
     pcdLeader = (pCD->transientLeader) ? FindTransientTreeLeader (pCD) : pCD;
 
@@ -583,7 +530,6 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
     }
     else /* NORMAL_STATE, MAXIMIZED_STATE, adoption */
     {
-#ifdef WSM
         /*
         * Handle restacking of primary/secondary windows
         * within the transient window tree.
@@ -628,7 +574,7 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
            }
 
        }
-#endif /* WSM */
+
        /*
         * If this is a transient window then put it below its
         * sibling transient windows.
@@ -710,11 +656,7 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
                MoveEntryInList (pWS, &pcdLeader->clientEntry, True /*above*/,
                    pStackEntry);
            }
-#ifdef WSM
            else if ((restackTransients) || (bLeaderRestacked))
-#else /* WSM */
-           else if (restackTransients)
-#endif /* WSM */
            {
                RestackTransients (pCD);
            }
@@ -731,11 +673,7 @@ void Do_Lower (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
                MoveEntryInList (pWS, &pcdLeader->clientEntry,
                    False /*on bottom*/, (ClientListEntry *) NULL);
            }
-#ifdef WSM
            else if ((restackTransients) || (bLeaderRestacked))
-#else /* WSM */
-           else if (restackTransients)
-#endif /* WSM */
            {
                RestackTransients (pCD);
            }
@@ -822,13 +760,9 @@ Boolean F_Circle_Down (String args, ClientData *pCD, XEvent *event)
                     * on the screen.  Lower the window.
                     */
 
-#ifdef WSM
                    wmGD.bSuspendSecondaryRestack = True;
-#endif /* WSM */
                    F_Lower (NULL, pcdNext, (XEvent *) NULL);
-#ifdef WSM
                    wmGD.bSuspendSecondaryRestack = False;
-#endif /* WSM */
                    break;
                }
            }
@@ -918,13 +852,9 @@ Boolean F_Circle_Up (String args, ClientData *pCD, XEvent *event)
                     * window on the screen.  Raise the window.
                     */
 
-#ifdef WSM
                    wmGD.bSuspendSecondaryRestack = True;
-#endif /* WSM */
                    F_Raise (NULL, pcdNext, (XEvent *) NULL);
-#ifdef WSM
                    wmGD.bSuspendSecondaryRestack = False;
-#endif /* WSM */
                    break;
                }
            }
@@ -994,13 +924,7 @@ Boolean F_Focus_Color (String args, ClientData *pCD, XEvent *event)
 
 Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
 {
-    int   status;
     int   pid;
-    int   w;
-#ifndef WSM
-    void (*intStat) ();
-    void (*quitStat) ();
-#endif /* WSM */
     char *shell;
     char *shellname;
 
@@ -1011,7 +935,6 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
        putenv(wmGD.pActiveSD->displayString);
       }
     
-#ifdef PANELIST
     if (wmGD.dtSD)
     {
        /*
@@ -1020,7 +943,6 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
         */
        WmFrontPanelSetBusy (True);
     }
-#endif /* PANELIST */
 
     /*
      * Fork a process to exec a shell to run the specified command:
@@ -1034,7 +956,7 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
     {
 
 #ifndef NO_SETPGRP
-#if defined(SVR4) || defined(__OSF1__) || defined(__osf__) || defined(linux)
+#if defined(SVR4) || defined(__linux__)
        setsid();
 #else
 #ifdef SYSV
@@ -1047,7 +969,7 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
 #endif /* SYSV */
 #endif /* SVR4 */
 #endif /* NO_SETPGRP */
-#ifdef WSM 
+
        /*
         * Clean up window manager resources.
         * The X file descriptor should be automatically closed.
@@ -1066,7 +988,6 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
         _DtEnvControl(DT_ENV_RESTORE_PRE_DT);
 
         CLOSE_FILES_ON_EXEC();
-#endif /* WSM */
 
        /*
         * Exec the command using $MWMSHELL if set or 
@@ -1087,12 +1008,12 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
                directory, then we must call execlp and not execl
                */
                shellname = shell;
-               execlp (shell, shellname, "-c", args, 0);
+               execlp (shell, shellname, "-c", args, NULL);
            }
            else
            {
                shellname++;
-               execl (shell, shellname, "-c", args, 0);
+               execl (shell, shellname, "-c", args, NULL);
            }
        }
 
@@ -1101,9 +1022,9 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
         * Try /bin/sh .
         */
 #ifdef SVR4
-        execl ("/usr/bin/sh", "sh", "-c", args, 0);
+        execl ("/usr/bin/sh", "sh", "-c", args, NULL);
 #else
-        execl ("/bin/sh", "sh", "-c", args, 0);
+        execl ("/bin/sh", "sh", "-c", args, NULL);
 #endif
 
 
@@ -1121,28 +1042,10 @@ Boolean F_Exec (String args, ClientData *pCD, XEvent *event)
      * Have the window manager wait for the shell to complete.
      */
 
-#ifndef WSM
-    intStat = (void (*)())signal (SIGINT, SIG_IGN);
-    quitStat = (void (*)())signal (SIGQUIT, SIG_IGN);
-#endif /* WSM */
-
-#ifdef WSM
     /*
      * Don't need to wait because WSM sets SIGCLD handler
      */
-#else /* WSM */
-    while ((w = wait (&status)) != pid && (w != -1));
-
-    if (w == -1)
-    {
-       status = -1;
-    }
-#endif /* WSM */
 
-#ifndef WSM
-    signal (SIGINT, intStat);
-    signal (SIGQUIT, quitStat);
-#endif /* WSM */
 
     /*
      * Restore original DISPLAY environment variable value
@@ -1223,9 +1126,7 @@ void Do_Quit_Mwm (Boolean diedOnRestart)
        {
            if (wmGD.Screens[scr].managed)
            {
-#ifdef WSM
                SaveResources(&wmGD.Screens[scr]);
-#endif /* WSM */
                pNextEntry = wmGD.Screens[scr].lastClient;
                while (pNextEntry)
                {
@@ -1239,20 +1140,12 @@ void Do_Quit_Mwm (Boolean diedOnRestart)
                    }
                    pNextEntry = pNextEntry->prevSibling;
                }
-#if defined(PANELIST)
                UnParentControls (&wmGD.Screens[scr], False);
-#endif /* PANELIST */
 
-#ifndef WSM
-               XDeleteProperty(DISPLAY, wmGD.Screens[scr].rootWindow,
-                               wmGD.xa_MWM_INFO);
-#endif /* WSM */
            }
        }
-#ifdef WSM
        /* shut down the messaging connection */
        dtCloseIPC();
-#endif /* WSM */
        ResignFromSM();
         XSync (DISPLAY, False);
         XCloseDisplay (DISPLAY);
@@ -1299,14 +1192,9 @@ void ReBorderClient (ClientData *pCD, Boolean reMapClient)
            (!(reMapClient)))
         {
            XUnmapWindow (DISPLAY, pCD->iconWindow);
-#ifdef WSM
            XReparentWindow (DISPLAY, pCD->iconWindow, 
                ROOT_FOR_CLIENT(pCD), pCD->pWsList->iconX, 
                pCD->pWsList->iconY);
-#else /* WSM */
-           XReparentWindow (DISPLAY, pCD->iconWindow, 
-               ROOT_FOR_CLIENT(pCD), pCD->iconX, pCD->iconY);
-#endif /* WSM */
         }
 
        if (!(reMapClient))
@@ -1442,9 +1330,7 @@ static Window FindSomeReasonableClient(void)
        {
            if ((pNextEntry->type != MINIMIZED_STATE) &&
                (pCD->clientState != MINIMIZED_STATE) &&
-#ifdef WSM
                 (ClientInWorkspace (ACTIVE_WS, pCD)) &&
-#endif /* WSM */
                (pCD != pcdNoFocus))
            {
                if (pCD->transientChildren)
@@ -1470,12 +1356,8 @@ static Window FindSomeReasonableClient(void)
      * Set the focus window if one is found
      */
 
-#ifdef WSM
     if (pcdLastFocus && 
        ClientInWorkspace (ACTIVE_WS, pcdLastFocus))
-#else /* WSM */
-    if (pcdLastFocus)
-#endif /* WSM */
       focusWindow = pcdLastFocus->client;
 
     /*
@@ -1491,19 +1373,15 @@ static Window FindSomeReasonableClient(void)
        {
            pCD = pNextEntry->pCD;
 
-#ifdef WSM
           if (ClientInWorkspace (ACTIVE_WS, pCD))
          {
-#endif /* WSM */
            if ((pNextEntry->type == MINIMIZED_STATE) ||
                (pCD->clientState == MINIMIZED_STATE))
            {
                focusWindow = ICON_FRAME_WIN(pCD);
                break;
            }
-#ifdef WSM
          }
-#endif /* WSM */
            pNextEntry = pNextEntry->nextSibling;
        }
     }
@@ -1546,15 +1424,11 @@ void Do_Focus_Key (ClientData *pCD, Time focusTime, long flags)
     wmGD.replayEnterEvent = False;
 
     pcdFocus = pCD;
-#ifdef WSM
     /* 
      * Make sure the client is in the current workspace
      */
     if ((pCD) &&
        (ClientInWorkspace (ACTIVE_WS, pCD)))
-#else /* WSM */
-    if (pCD)
-#endif /* WSM */
     {
        if (pCD->clientState == MINIMIZED_STATE)
        {
@@ -1800,8 +1674,6 @@ void Do_Focus_Key (ClientData *pCD, Time focusTime, long flags)
 } /* END OF FUNCTION Do_Focus_Key */
 
 
-#ifdef WSM
-\f
 /***********************<->*************************************
  *
  *  F_Goto_Workspace (args, pCD, event)
@@ -1864,10 +1736,7 @@ F_Goto_Workspace (String args, ClientData *pCD, XEvent *event)
     return (False);
 }  /* END OF FUNCTION F_Goto_Workspace */
 
-#endif /* WSM */
 
-#ifdef WSM
-\f
 /******************************<->*************************************
  *
  *  Boolean F_Help (String args, ClientData *pCD, XEvent *event)
@@ -1893,14 +1762,10 @@ F_Goto_Workspace (String args, ClientData *pCD, XEvent *event)
 Boolean
 F_Help (String args, ClientData *pCD, XEvent *event)
 {
-#ifdef PANELIST
     Boolean rval;
 
     rval = WmDtHelp(args);
     return (rval);
-#endif /* PANELIST */    
-    
-
 }  /* END OF FUNCTION F_Help */
 
 \f
@@ -1929,7 +1794,6 @@ F_Help (String args, ClientData *pCD, XEvent *event)
 Boolean
 F_Help_Mode (String args, ClientData *pCD, XEvent *event)
 {
-#ifdef PANELIST
     /*
      * Help mode event processing interferes
      * with slide up windows. Don't continue
@@ -1940,12 +1804,9 @@ F_Help_Mode (String args, ClientData *pCD, XEvent *event)
        (void) WmDtHelpMode();
     }
     return (False);
-#endif /* PANELIST */    
-
 }  /* END OF FUNCTION F_Help_Mode */
 
-#endif /* WSM */
-\f
+
 /******************************<->*************************************
  *
  *  F_Next_Key (args, pCD, event)
@@ -2104,8 +1965,6 @@ Boolean F_Prev_Key (String args, ClientData *pCD, XEvent *event)
 
 } /* END OF FUNCTION F_Prev_Key */
 
-#ifdef PANELIST
-\f
 /***********************<->*************************************
  *
  *  F_Post_FpMenu (args, pCD, event)
@@ -2254,13 +2113,9 @@ F_Push_Recall (String args, ClientData *pCD, XEvent *event)
            }
 
            /* Make this client visible */
-#ifdef WSM
                    wmGD.bSuspendSecondaryRestack = True;
-#endif /* WSM */
            F_Normalize_And_Raise (NULL, pPRCD->pCD, event);
-#ifdef WSM
                    wmGD.bSuspendSecondaryRestack = False;
-#endif /* WSM */
        }
        else 
        {
@@ -2283,7 +2138,7 @@ F_Push_Recall (String args, ClientData *pCD, XEvent *event)
 
            if (!bWaiting)
            {
-               long clientTimeout;
+               long clientTimeout = 0;
                Arg al[5];
                int ac;
                WmPanelistObject  pPanelist;
@@ -2321,7 +2176,6 @@ F_Push_Recall (String args, ClientData *pCD, XEvent *event)
     return (True);
 
 } /* END OF FUNCTION F_Push_Recall */
-#endif /* PANELIST */
 
 \f
 /*************************************<->*************************************
@@ -2344,11 +2198,7 @@ F_Push_Recall (String args, ClientData *pCD, XEvent *event)
  *
  *************************************<->***********************************/
 
-Boolean F_Pass_Key (args, pCD, event)
-    String args;
-    ClientData *pCD;
-    XEvent *event;
-
+Boolean F_Pass_Key (String args, ClientData *pCD, XEvent *event)
 {
     if (wmGD.passKeysActive)
     {
@@ -2436,7 +2286,6 @@ Boolean F_Menu (String args, ClientData *pCD, XEvent *event)
        {
            flags |= POST_TRAVERSAL_ON;
        }
-#ifdef WSM
        /*
         * Root menu, if posted with button press, then 
         * set up to handle root menu click to make the menu
@@ -2456,7 +2305,6 @@ Boolean F_Menu (String args, ClientData *pCD, XEvent *event)
            wmGD.hotspotRectangle.width = wmGD.moveThreshold;
            wmGD.hotspotRectangle.height = wmGD.moveThreshold;
        }
-#endif /* WSM */
     }
     else if (event && 
        ((event->type == KeyPress) || (event->type == KeyRelease)))
@@ -2701,7 +2549,6 @@ Boolean F_Normalize (String args, ClientData *pCD, XEvent *event)
 
 Boolean F_Normalize_And_Raise (String args, ClientData *pCD, XEvent *event)
 {
-#ifdef PANELIST
     WmScreenData       *pSD;
     WmWorkspaceData    *pWS;
 
@@ -2727,7 +2574,7 @@ Boolean F_Normalize_And_Raise (String args, ClientData *pCD, XEvent *event)
            return (False);
        }
     }
-#endif /* PANELIST */
+
     if (pCD)
     {
         if (pCD->clientState == MINIMIZED_STATE)
@@ -2748,13 +2595,9 @@ Boolean F_Normalize_And_Raise (String args, ClientData *pCD, XEvent *event)
                                GetEventInverseMask(event));
 
             /* Raise the window and set the keyboard focus to the window */
-#ifdef WSM
            wmGD.bSuspendSecondaryRestack = True;
-#endif /* WSM */
             F_Raise (NULL, pCD, (XEvent *)NULL);
-#ifdef WSM
            wmGD.bSuspendSecondaryRestack = False;
-#endif /* WSM */
            if (wmGD.raiseKeyFocus)
            {
                F_Focus_Key (NULL, pCD,
@@ -2868,13 +2711,9 @@ Boolean F_Restore_And_Raise (String args, ClientData *pCD, XEvent *event)
            F_Restore (NULL, pCD, event);
 
             /* Raise the window and set the keyboard focus to the window */
-#ifdef WSM
            wmGD.bSuspendSecondaryRestack = True;
-#endif /* WSM */
             F_Raise (NULL, pCD, (XEvent *)NULL);
-#ifdef WSM
            wmGD.bSuspendSecondaryRestack = False;
-#endif /* WSM */
            if (wmGD.raiseKeyFocus)
            {
                F_Focus_Key (NULL, pCD,
@@ -2947,64 +2786,6 @@ Boolean F_Pack_Icons (String args, ClientData *pCD, XEvent *event)
 
 } /* END OF FUNCTION F_Pack_Icons */
 
-\f
-#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL))
-/*************************************<->*************************************
- *
- *  F_Post_RMenu (args, pCD, event)
- *
- *
- *  Description:
- *  -----------
- *  This is the window manager function handler for posting the
- *  root window menu.
- *  This function can only be invoked by a key event.
- *
- *************************************<->***********************************/
-
-Boolean F_Post_RMenu (String args, ClientData *pCD, XEvent *event)
-{
-    MenuSpec    *rootMenu;
-    unsigned int button = NoButton;
-    int          x, y;
-    long         flags = POST_AT_XY;
-    Window       rwin, cwin;
-    int          winx, winy;
-    unsigned int mask;
-
-
-    if ((event->type == KeyPress) || (event->type == KeyRelease))
-      {
-
-       /* Find the root menu spec */
-       for (rootMenu = ACTIVE_PSD->menuSpecs;
-            rootMenu != (MenuSpec *) NULL;
-            rootMenu = rootMenu->nextMenuSpec)
-         {
-           if (strcmp(rootMenu->name, ACTIVE_PSD->rootMenu) == 0)
-             break;
-         }
-    
-       /* If we couldn't find the root menu, then do nothing. */
-       if (rootMenu == (MenuSpec *) NULL)
-         return (False);
-
-       else
-         {
-           XQueryPointer(DISPLAY, ACTIVE_ROOT,
-                         &rwin, &cwin, &x, &y, &winx, &winy, &mask);
-
-           PostMenu (rootMenu, NULL, x, y, NoButton, F_CONTEXT_ROOT,
-                     flags, event);
-         }
-      }
-
-    return (False);
-
-} /* END OF FUNCTION F_Post_RMenu */
-#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */
-
-\f
 /*************************************<->*************************************
  *
  *  F_Post_SMenu (args, pCD, event)
@@ -3085,7 +2866,6 @@ Boolean F_Post_SMenu (String args, ClientData *pCD, XEvent *event)
        }
        else if (event->type == ButtonPress)
        {
-#ifdef WSM
            /*
             * Root menu, if posted with button press, then 
             * set up to handle root menu click to make the menu
@@ -3101,7 +2881,6 @@ Boolean F_Post_SMenu (String args, ClientData *pCD, XEvent *event)
                wmGD.hotspotRectangle.width = wmGD.moveThreshold;
                wmGD.hotspotRectangle.height = wmGD.moveThreshold;
            }
-#endif /* WSM */
            PostMenu (pCD->systemMenuSpec, pCD, 
                event->xbutton.x_root, event->xbutton.y_root,
                event->xbutton.button, menuContext, POST_AT_XY, event);
@@ -3142,7 +2921,6 @@ Boolean F_Kill (String args, ClientData *pCD, XEvent *event)
        Boolean do_save_yourself =
                pCD->protocolFlags & PROTOCOL_WM_SAVE_YOURSELF;
 
-#ifdef PANELIST
        if (pCD->dtwmBehaviors & DtWM_BEHAVIOR_SUBPANEL)
        {
            Widget              wPanel;
@@ -3171,9 +2949,7 @@ Boolean F_Kill (String args, ClientData *pCD, XEvent *event)
                IconBoxPopUp (pCD->pSD->pActiveWS, False);
            }
        }
-       else
-#endif /* PANELIST */
-       if (!do_delete_window && !do_save_yourself)
+       else if (!do_delete_window && !do_save_yourself)
        {
            XKillClient (DISPLAY, pCD->client);
        }
@@ -3188,7 +2964,6 @@ Boolean F_Kill (String args, ClientData *pCD, XEvent *event)
                SendClientMsg (pCD->client, (long) wmGD.xa_WM_PROTOCOLS,
                    (long) wmGD.xa_WM_DELETE_WINDOW, CurrentTime, NULL, 0);
            }
-#ifdef WSM
            /*
             * HP does not want to send a client message for both
             * delete_window AND save_yourself.  The current OSF
@@ -3196,9 +2971,6 @@ Boolean F_Kill (String args, ClientData *pCD, XEvent *event)
             * to the behavior of dt 2.01
             */
             else if (do_save_yourself)
-#else /* WSM */
-           if (do_save_yourself)
-#endif /* WSM */
            {
                /*
                 * Send a WM_SAVE_YOURSELF message and wait for a change to
@@ -3226,8 +2998,6 @@ Boolean F_Kill (String args, ClientData *pCD, XEvent *event)
 
 } /* END OF FUNCTION F_Kill */
 
-#ifdef WSM
-\f
 /*************************************<->*************************************
  *
  *  F_Marquee_Selection (args, pCD, event)
@@ -3294,7 +3064,6 @@ RefreshByClearing (Window win)
            XFree((char *)winChildren);
     }
 }
-#endif /* WSM */
 
 \f
 /*************************************<->*************************************
@@ -3313,14 +3082,12 @@ Boolean F_Refresh (String args, ClientData *pCD, XEvent *event)
 {
     Window win;
 
-#ifdef WSM
     if (wmGD.refreshByClearing)
     {
        RefreshByClearing (ACTIVE_ROOT);
     }
     else
     {
-#endif /* WSM */
                         /* default background_pixmap is None */
     win = XCreateWindow (DISPLAY,
                         ACTIVE_ROOT, 0, 0,
@@ -3337,9 +3104,7 @@ Boolean F_Refresh (String args, ClientData *pCD, XEvent *event)
 
     XMapWindow (DISPLAY, win);
     XDestroyWindow (DISPLAY, win);
-#ifdef WSM 
     }
-#endif /* WSM */
     XFlush (DISPLAY);
 
     return (True);
@@ -3389,14 +3154,11 @@ Boolean F_Resize (String args, ClientData *pCD, XEvent *event)
 
 Boolean F_Restart (String args, ClientData *pCD, XEvent *event)
 {
-#ifdef WSM
     if (args && *args && !strcmp (args, DTWM_REQP_NO_CONFIRM))
     {
        RestartWm (MWM_INFO_STARTUP_CUSTOM);
     }
-    else
-#endif /* WSM */
-    if (wmGD.showFeedback & WM_SHOW_FB_RESTART)
+    else if (wmGD.showFeedback & WM_SHOW_FB_RESTART)
     {
        ConfirmAction (ACTIVE_PSD, RESTART_ACTION);
     }
@@ -3462,9 +3224,7 @@ void RestartWm (long startupFlags)
             */
            
            SetMwmInfo (wmGD.Screens[scr].rootWindow, startupFlags, 0);
-#ifdef WSM
            SaveResources(&wmGD.Screens[scr]);
-#endif /* WSM */
            /*
             * Unmap client windows and reparent them to the root window.
             */
@@ -3489,17 +3249,13 @@ void RestartWm (long startupFlags)
                }
                pNextEntry = pNextEntry->prevSibling;
            }
-#if defined(PANELIST)
            UnParentControls (&wmGD.Screens[scr], True);
-#endif /* PANELIST */
        }
        
     }
     
-#ifdef WSM
     /* shut down the messaging connection */
     dtCloseIPC();
-#endif /* WSM */
     ResignFromSM();
 
     /*
@@ -3512,10 +3268,8 @@ void RestartWm (long startupFlags)
     XSetInputFocus (DISPLAY, PointerRoot, RevertToPointerRoot, CurrentTime);
     XSync (DISPLAY, False);
 
-#ifdef WSM
     CLOSE_FILES_ON_EXEC();
     _DtEnvControl(DT_ENV_RESTORE_PRE_DT); 
-#endif /* WSM */
     /*
      * Restart the window manager with the initial arguments plus
      * the restart settings.
@@ -3523,13 +3277,9 @@ void RestartWm (long startupFlags)
 
     execvp (*(wmGD.argv), wmGD.argv);
 
-#ifdef WSM
     Warning (((char *)GETMESSAGE(26, 1, 
 "The window manager restart failed. The window manager program could not \
 be found or could not be executed.")));
-#else /* WSM */
-    Warning ("Cannot restart the window manager");
-#endif /* WSM */
     Do_Quit_Mwm (True);
 
 
@@ -3571,14 +3321,9 @@ void DeFrameClient (ClientData *pCD)
         {
            XUnmapWindow (DISPLAY, pCD->iconWindow);
            XRemoveFromSaveSet (DISPLAY, pCD->iconWindow);
-#ifdef WSM
            XReparentWindow (DISPLAY, pCD->iconWindow, 
                ROOT_FOR_CLIENT(pCD), pCD->pWsList->iconX, 
                pCD->pWsList->iconY);
-#else /* WSM */
-           XReparentWindow (DISPLAY, pCD->iconWindow, 
-               ROOT_FOR_CLIENT(pCD), pCD->iconX, pCD->iconY);
-#endif /* WSM */
         }
 
         if (pCD->maxConfig)
@@ -3639,8 +3384,6 @@ void DeFrameClient (ClientData *pCD)
 
 } /* END OF FUNCTION DeFrameClient */
 
-#if defined(PANELIST)
-\f
 /******************************<->*************************************
  *
  *  F_Toggle_Front_Panel (args, pCD, event)
@@ -3738,7 +3481,6 @@ F_Version (String args, ClientData *pCD, XEvent *event)
     return (True);
 
 }  /* END OF FUNCTION F_Version */
-#endif /* PANELIST */
 
 \f
 /******************************<->*************************************
@@ -3765,7 +3507,7 @@ F_Version (String args, ClientData *pCD, XEvent *event)
 
 Boolean F_Send_Msg (String args, ClientData *pCD, XEvent *event)
 {
-    register int i;
+    int i;
 
 
     if (pCD && pCD->mwmMessagesCount)
@@ -3863,9 +3605,7 @@ Boolean F_Raise (String args, ClientData *pCD, XEvent *event)
     ClientListEntry *pStackEntry;
     String string = args;
     int flags = STACK_NORMAL;
-#ifdef WSM
        WmWorkspaceData *pWS = ACTIVE_WS;
-#endif /* WSM */
 
     if (string)
     {
@@ -3882,15 +3622,11 @@ Boolean F_Raise (String args, ClientData *pCD, XEvent *event)
                                                  F_GROUP_ALL)))
            {
                pNextEntry = pEntry->nextSibling;
-#ifdef WSM
                if (ClientInWorkspace (pWS, pEntry->pCD))
                {
-#endif /* WSM */
                Do_Raise (pEntry->pCD, pStackEntry, STACK_NORMAL);
                pStackEntry = pEntry;
-#ifdef WSM
                }
-#endif /* WSM */
            }
        }
        /* process family stacking stuff */
@@ -3914,26 +3650,18 @@ Boolean F_Raise (String args, ClientData *pCD, XEvent *event)
                }
                index += len;
            }
-#ifdef WSM
            if (ClientInWorkspace (pWS, pCD))
            {
-#endif /* WSM */
            Do_Raise (pCD, (ClientListEntry *) NULL, flags);
-#ifdef WSM
            }
-#endif /* WSM */
        }
     }
     else if (pCD)
     {
-#ifdef WSM
        if (ClientInWorkspace (pWS, pCD))
        {
-#endif /* WSM */
        Do_Raise (pCD, (ClientListEntry *) NULL, STACK_NORMAL);
-#ifdef WSM
        }
-#endif /* WSM */
     }
 
     return (True);
@@ -3968,11 +3696,8 @@ void Do_Raise (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
     Boolean restackTransients;
     ClientData *pcdLeader;
     WmWorkspaceData *pWS = ACTIVE_WS;
-#ifdef WSM
     Boolean bLeaderRestacked;
-#endif /* WSM */
 
-#ifdef PANELIST
     if (pCD->pECD)
     {
        /*
@@ -3981,11 +3706,7 @@ void Do_Raise (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
         */
        return;
     }
-    else 
-#else /* PANELIST */
-#endif /* PANELIST */
-#ifdef WSM
-    if (ClientInWorkspace(pWS, pCD)  && 
+    else if (ClientInWorkspace(pWS, pCD)  && 
        (!pStackEntry || ClientInWorkspace (pWS, pStackEntry->pCD)))
     {
        /* 
@@ -4006,7 +3727,6 @@ void Do_Raise (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
         */
        return;
     }
-#endif /* WSM */
 
     pcdLeader = (pCD->transientLeader) ? FindTransientTreeLeader (pCD) : pCD;
 
@@ -4059,7 +3779,6 @@ void Do_Raise (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
     }
     else /* NORMAL_STATE, MAXIMIZED_STATE, adoption */
     {
-#ifdef WSM
         /*
         * Handle restacking of primary/secondary windows
         * within the transient window tree. Don't raise this
@@ -4100,7 +3819,7 @@ void Do_Raise (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
            }
 
        }
-#endif /* WSM */
+
        /*
         * If this is a transient window then put it on top of its
         * sibling transient windows.
@@ -4205,11 +3924,7 @@ void Do_Raise (ClientData *pCD, ClientListEntry *pStackEntry, int flags)
   
         /* Restack the transients if needed */
   
-#ifdef WSM
         if ((restackTransients) || (bLeaderRestacked))
-#else /* WSM */
-        if (restackTransients)
-#endif /* WSM */
         {
            RestackTransients (pCD);
        }
@@ -4251,11 +3966,7 @@ Boolean F_Raise_Lower (String args, ClientData *pCD, XEvent *event)
             * The window is obscured by another window, raise the window.
             */
 
-#ifdef WSM
            F_Raise (NULL, pCD, (XEvent *)NULL);
-#else /* WSM */
-           F_Raise (NULL, pcdLeader, (XEvent *)NULL);
-#endif /* WSM */
        }
        else if (CheckIfClientObscuringAny (pcdLeader) &&
                !(wmGD.systemModalActive &&
@@ -4267,7 +3978,6 @@ Boolean F_Raise_Lower (String args, ClientData *pCD, XEvent *event)
             */
 
            F_Lower (NULL, pcdLeader, (XEvent *)NULL);
-#ifdef WSM
            if ((pcdLeader->secondariesOnTop == False) &&
                (pCD->transientLeader != NULL) &&
                (!IS_APP_MODALIZED(pcdLeader)))
@@ -4276,9 +3986,7 @@ Boolean F_Raise_Lower (String args, ClientData *pCD, XEvent *event)
                (void) BumpPrimaryToTop (pcdLeader);
                RestackTransients (pcdLeader);
            }
-#endif /* WSM */
        }
-#ifdef WSM
         else if ((pcdLeader->secondariesOnTop == False) &&
                 (pcdLeader->transientChildren != NULL) &&
                 (!wmGD.systemModalActive) &&
@@ -4298,7 +4006,6 @@ Boolean F_Raise_Lower (String args, ClientData *pCD, XEvent *event)
                RestackTransients (pcdLeader);
            }
        }
-#endif /* WSM */
     }
 
     return (True);
@@ -4338,14 +4045,12 @@ Boolean F_Refresh_Win (String args, ClientData *pCD, XEvent *event)
            h = (unsigned int) pCD->maxHeight;
        }
 
-#ifdef WSM
         if (wmGD.refreshByClearing)
        {
            RefreshByClearing (pCD->clientFrameWin);
        }
        else
        {
-#endif /* WSM */
                         /* default background_pixmap is None */
         win = XCreateWindow (DISPLAY,
                         pCD->clientBaseWin,
@@ -4361,9 +4066,7 @@ Boolean F_Refresh_Win (String args, ClientData *pCD, XEvent *event)
 
         XMapWindow (DISPLAY, win);
         XDestroyWindow (DISPLAY, win);
-#ifdef WSM
        }
-#endif /* WSM */
         XFlush (DISPLAY);
     }
 
@@ -4434,8 +4137,6 @@ void Do_Set_Behavior (Boolean dummy)
 
 } /* END OF FUNCTION Do_Set_Behavior */
 
-#ifdef WSM
-\f
 /*************************************<->*************************************
  *
  *  F_Set_Context (args, pCD, event)
@@ -4455,7 +4156,6 @@ Boolean F_Set_Context (String args, ClientData *pCD, XEvent *event)
     return (True);
 
 } /* END OF FUNCTION F_Set_Context */
-#endif /* WSM */
 
 \f
 /*************************************<->*************************************
@@ -4589,41 +4289,6 @@ Boolean F_Screen (String args, ClientData *pCD, XEvent *event)
 }
 
 
-\f
-#if ((!defined(WSM)) || defined(MWM_QATS_PROTOCOL))
-/*************************************<->*************************************
- *
- *  F_InvokeCommand (args, pCD, event)
- *
- *
- *  Description:
- *  -----------
- *  This is the window manager function for invoking client inserted menu
- *  commands.
- *
- *************************************<->***********************************/
-
-Boolean F_InvokeCommand (String args, ClientData *pCD, XEvent *event)
-{
-    CARD32 commandID, clientWindow;
-    Atom notifySelection;
-
-    if (args == (String) NULL) return(FALSE);
-
-    if (sscanf(args, "%d %d %ld", &commandID, &clientWindow,
-              &notifySelection) != 3)
-      return(FALSE);
-
-    SendInvokeMessage(commandID,
-                     (pCD == (ClientData *) NULL ? 0 : pCD->client),
-                     notifySelection,
-                     LastTime());
-
-    return (True);
-} /* END OF FUNCTION F_InvokeCommand */
-#endif /* !defined(WSM) || defined(MWM_QATS_PROTOCOL) */
-
-\f
 /*************************************<->*************************************
  *
  *  GetFunctionTimestamp (pEvent)
@@ -4717,7 +4382,7 @@ void ClearDirtyStackEntry (ClientData *pCD)
       dirtyLeader = NULL;
     }
 }
-#if defined(DEBUG) && defined(WSM)
+#if defined(DEBUG)
 \f
 /***********************<->*************************************
  *
@@ -4779,8 +4444,6 @@ F_ZZ_Debug (String subFcn, ClientData *pCD, XEvent *event)
 }
 #endif /* DEBUG */
 
-#ifdef WSM
-\f
 /*************************************<->*************************************
  *
  *  F_Next_Workspace (args, pCD, event)
@@ -4917,7 +4580,3 @@ DumpWindowList ()
 }
 #endif /* DEBUG */
 
-#endif /* WSM */
-
-
-