test: winloop2.c Source File

Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

# winloop2.c

Go to the documentation of this file.

    00001 /*
    00002 * Copyright (c) 1985 - 1999, Microsoft Corporation
    00003 */
    00004
    00005 #include "precomp.h"
    00006 #pragma hdrstop
    00007
    00008 // ----------------------------------------------------------------------------
    00009 //
    00010 //  IsVSlick() -
    00011 //
    00012 //  TRUE if window is positioned at +100,+100 from bottom right of screen --
    00013 //  probably VSlick -- which has two Tray Windows, one is unowned but off the
    00014 //  screen....we want the owned one since its on the screen
    00015 //
    00016 // ----------------------------------------------------------------------------
    00017 BOOL IsVSlick(PWND pwnd)
    00018 {
    00019     if (gpDispInfo->cMonitors == 1 &&
    00020         ((unsigned) pwnd->rcWindow.left > (unsigned) gpDispInfo->rcScreen.right ) &&
    00021         ((unsigned) pwnd->rcWindow.top  > (unsigned) gpDispInfo->rcScreen.bottom) &&
    00022         (pwnd->rcWindow.top == (gpDispInfo->rcScreen.bottom+100)) &&
    00023         (pwnd->rcWindow.left == (gpDispInfo->rcScreen.right+100)))
    00024     {
    00025         // MUST BE THE ONE AND ONLY V-SLICK
    00026         return(TRUE);
    00027     }
    00028
    00029     return(FALSE);
    00030 }
    00031
    00032 // ----------------------------------------------------------------------------
    00033 //
    00034 //  Is31TrayWindow() -
    00035 //
    00036 //  extra grilling required for 3.1 and earlier apps before letting 'em in the
    00037 //  tray -- trust me, you DON'T want to change this code. -- JEFFBOG 11/10/94
    00038 //
    00039 // ----------------------------------------------------------------------------
    00040 BOOL Is31TrayWindow(PWND pwnd)
    00041 {
    00042     PWND pwnd2;
    00043
    00044     if (!(pwnd2 = pwnd->spwndOwner))
    00045         return (!IsVSlick(pwnd)); // unowned -- do we want you?
    00046
    00047     if (TestWF(pwnd2, WEFTOOLWINDOW))
    00048         return(FALSE); // owned by a tool window -- we don't want
    00049
    00050     return((FHas31TrayStyles(pwnd2) ? (IsVSlick(pwnd2)) : TRUE));
    00051 }
    00052
    00053
    00054 // ----------------------------------------------------------------------------
    00055 //
    00056 //  IsTrayWindow() -
    00057 //
    00058 //  TRUE if the window passes all the necessary checks -- making it a window
    00059 //  that should appear in the tray.
    00060 //
    00061 // ----------------------------------------------------------------------------
    00062 BOOL IsTrayWindow(PWND pwnd)
    00063 {
    00064     if ((pwnd==NULL) || !(FDoTray() && (FCallHookTray() || FPostTray(pwnd->head.rpdesk))) ||
    00065             !FTopLevel(pwnd))
    00066         return(FALSE);
    00067
    00068     // Check for WS_EX_APPWINDOW or WS_EX_TOOLWINDOW "overriding" bits
    00069     if (TestWF(pwnd, WEFAPPWINDOW))
    00070         return(TRUE);
    00071
    00072     if (TestWF(pwnd, WEFTOOLWINDOW))
    00073         return(FALSE);
    00074
    00075     if (TestWF(pwnd, WEFNOACTIVATE)) {
    00076         return FALSE;
    00077     }
    00078
    00079     if (TestWF(pwnd, WFWIN40COMPAT)) {
    00080         if (pwnd->spwndOwner == NULL)
    00081             return(TRUE);
    00082         if (TestWF(pwnd->spwndOwner, WFWIN40COMPAT))
    00083             return(FALSE);
    00084         // if this window is owned by a 3.1 window, check it like a 3.1 window
    00085     }
    00086
    00087     if (!FHas31TrayStyles(pwnd))
    00088         return(FALSE);
    00089
    00090     return(Is31TrayWindow(pwnd));
    00091 }
    00092
    00093 /***************************************************************************\
    00094 * xxxSetTrayWindow
    00095 *
    00096 * History:
    00097 * 11-Dec-1996 adams     Created.
    00098 \***************************************************************************/
    00099
    00100 void xxxSetTrayWindow(PDESKTOP pdesk, PWND pwnd, PMONITOR pMonitor)
    00101 {
    00102     HWND hwnd;
    00103
    00104     CheckLock(pMonitor);
    00105
    00106     if (pwnd == STW_SAME) {
    00107         pwnd = pdesk->spwndTray;
    00108         hwnd = PtoH(pwnd);
    00109     } else {
    00110         CheckLock(pwnd);
    00111         hwnd = PtoH(pwnd);
    00112         Lock(&(pdesk->spwndTray), pwnd);
    00113     }
    00114
    00115     if (!pMonitor) {
    00116         if (pwnd) {
    00117             pMonitor = _MonitorFromWindow(pwnd, MONITOR_DEFAULTTOPRIMARY);
    00118         } else {
    00119             pMonitor = GetPrimaryMonitor();
    00120         }
    00121     }
    00122
    00123     if ( FPostTray(pdesk)) {
    00124         PostShellHookMessages(
    00125                 pMonitor->cFullScreen ?
    00126                         HSHELL_RUDEAPPACTIVATED : HSHELL_WINDOWACTIVATED,
    00127                 (LPARAM) hwnd);
    00128     }
    00129
    00130     if ( FCallHookTray() ) {
    00131         xxxCallHook(
    00132                 HSHELL_WINDOWACTIVATED,
    00133                 (WPARAM) hwnd,
    00134                 (pMonitor->cFullScreen ? 1 : 0),
    00135                 WH_SHELL);
    00136     }
    00137 }
    00138
    00139
    00140
    00141 /***************************************************************************\
    00142 * xxxAddFullScreen
    00143 *
    00144 * Adds an app to the fullscreen list and moves the tray if it is
    00145 * the first fullscreen app.
    00146 *
    00147 * History:
    00148 * 27-Feb-1997 adams     Commented.
    00149 \***************************************************************************/
    00150
    00151 BOOL xxxAddFullScreen(PWND pwnd, PMONITOR pMonitor)
    00152 {
    00153     BOOL    fYielded;
    00154
    00155     PDESKTOP pdesk = pwnd->head.rpdesk;
    00156
    00157     CheckLock(pwnd);
    00158     CheckLock(pMonitor);
    00159
    00160     if (pdesk == NULL)
    00161         return FALSE;
    00162
    00163     fYielded = FALSE;
    00164     if (!TestWF(pwnd, WFFULLSCREEN) && FCallTray(pdesk))
    00165     {
    00166         SetWF(pwnd, WFFULLSCREEN);
    00167
    00168         if (pMonitor->cFullScreen++ == 0) {
    00169             xxxSetTrayWindow(pdesk, STW_SAME, pMonitor);
    00170             fYielded = TRUE;
    00171         }
    00172
    00173         pwnd = pwnd->spwndOwner;
    00174         if (    pwnd &&
    00175                 !TestWF(pwnd, WFCHILD) &&
    00176                 pwnd->rcWindow.right == 0 &&
    00177                 pwnd->rcWindow.left == 0 &&
    00178                 !TestWF(pwnd, WFVISIBLE)) {
    00179
    00180             TL tlpwnd;
    00181             ThreadLock(pwnd, &tlpwnd);
    00182             if (xxxAddFullScreen(pwnd, pMonitor)) {
    00183                 fYielded = TRUE;
    00184             }
    00185
    00186             ThreadUnlock(&tlpwnd);
    00187         }
    00188     }
    00189
    00190     return fYielded;
    00191 }
    00192
    00193
    00194
    00195 /***************************************************************************\
    00196 * xxxRemoveFullScreen
    00197 *
    00198 * Adds an app to the fullscreen list and moves the tray if there
    00199 * are no more fullscreen apps.
    00200 *
    00201 * History:
    00202 * 27-Feb-1997 adams     Commented.
    00203 \***************************************************************************/
    00204
    00205 BOOL xxxRemoveFullScreen(PWND pwnd, PMONITOR pMonitor)
    00206 {
    00207     PDESKTOP pdesk = pwnd->head.rpdesk;
    00208     BOOL    fYielded;
    00209
    00210     CheckLock(pwnd);
    00211     CheckLock(pMonitor);
    00212
    00213     if (pdesk == NULL)
    00214         return FALSE;
    00215
    00216     fYielded = FALSE;
    00217     if (TestWF(pwnd, WFFULLSCREEN) && FCallTray(pdesk)) {
    00218         ClrWF(pwnd, WFFULLSCREEN);
    00219
    00220         if (--pMonitor->cFullScreen == 0) {
    00221             xxxSetTrayWindow(pdesk, STW_SAME, pMonitor);
    00222             fYielded = TRUE;
    00223         }
    00224
    00225         /*
    00226          * (adams): Remove this assertion temporarily while I work on
    00227          * a fix for the problem.
    00228          *
    00229          * UserAssert(pMonitor->cFullScreen >= 0);
    00230          */
    00231     }
    00232
    00233     return fYielded;
    00234 }