VirtualBox

Ignore:
Timestamp:
Jul 21, 2016 3:08:00 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
108955
Message:

3D: Skipping guest windows having class 'ApplicationFrameWindow' which occupy all Desktop in Win10. bugref:8496

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Additions/WINNT/VBoxTray/VBoxSeamless.cpp

    r62135 r62405  
    197197    dwStyle   = GetWindowLong(hwnd, GWL_STYLE);
    198198    dwExStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
    199     if (   !(dwStyle & WS_VISIBLE)
    200         || (dwStyle & WS_CHILD))
     199
     200    if ( !(dwStyle & WS_VISIBLE) || (dwStyle & WS_CHILD))
    201201        return TRUE;
    202202
    203     Log(("VBoxTray: VBoxEnumFunc %x\n", hwnd));
     203    LogFlow(("VBoxTray: VBoxEnumFunc %x\n", hwnd));
    204204    /* Only visible windows that are present on the desktop are interesting here */
    205     if (GetWindowRect(hwnd, &rectWindow))
    206     {
    207         char szWindowText[256];
    208         szWindowText[0] = 0;
    209         OSVERSIONINFO OSinfo;
    210         HWND hStart = NULL;
    211         GetWindowText(hwnd, szWindowText, sizeof(szWindowText));
    212         OSinfo.dwOSVersionInfoSize = sizeof (OSinfo);
    213         GetVersionEx (&OSinfo);
    214         if (OSinfo.dwMajorVersion >= 6)
    215         {
    216             hStart = ::FindWindowEx(GetDesktopWindow(), NULL, "Button", "Start");
    217             if (  hwnd == hStart && szWindowText != NULL
    218                 && !(strcmp(szWindowText, "Start"))
    219                )
    220             {
    221                 /* for vista and above. To solve the issue of small bar above
    222                  * the Start button when mouse is hovered over the start button in seamless mode.
    223                  * Difference of 7 is observed in Win 7 platform between the dimensionsof rectangle with Start title and its shadow.
    224                  */
    225                 rectWindow.top += 7;
    226                 rectWindow.bottom -=7;
    227             }
    228         }
    229         rectVisible = rectWindow;
    230 
    231 #ifdef LOG_ENABLED
    232         DWORD pid = 0;
    233         DWORD tid = GetWindowThreadProcessId(hwnd, &pid);
    234 #endif
    235 
    236         /* Filter out Windows XP shadow windows */
    237         /** @todo still shows inside the guest */
    238         if (   szWindowText[0] == 0
    239             && (
    240                     (dwStyle == (WS_POPUP|WS_VISIBLE|WS_CLIPSIBLINGS)
    241                             && dwExStyle == (WS_EX_LAYERED|WS_EX_TOOLWINDOW|WS_EX_TRANSPARENT|WS_EX_TOPMOST))
    242                  || (dwStyle == (WS_POPUP|WS_VISIBLE|WS_DISABLED|WS_CLIPSIBLINGS|WS_CLIPCHILDREN)
    243                             && dwExStyle == (WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE))
    244                  || (dwStyle == (WS_POPUP|WS_VISIBLE|WS_CLIPSIBLINGS|WS_CLIPCHILDREN)
    245                                        && dwExStyle == (WS_EX_TOOLWINDOW))
    246                             ))
    247         {
    248             Log(("VBoxTray: Filter out shadow window style=%x exstyle=%x\n", dwStyle, dwExStyle));
    249             Log(("VBoxTray: Enum hwnd=%x rect (%d,%d) (%d,%d) (filtered)\n", hwnd, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom));
    250             Log(("VBoxTray: title=%s style=%x exStyle=%x\n", szWindowText, dwStyle, dwExStyle));
    251             Log(("VBoxTray: pid=%d tid=%d\n", pid, tid));
    252             return TRUE;
    253         }
    254 
    255         /** @todo will this suffice? The Program Manager window covers the whole screen */
    256         if (strcmp(szWindowText, "Program Manager"))
    257         {
    258             Log(("VBoxTray: Enum hwnd=%x rect (%d,%d) (%d,%d) (applying)\n", hwnd, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom));
    259             Log(("VBoxTray: title=%s style=%x exStyle=%x\n", szWindowText, dwStyle, dwExStyle));
    260             Log(("VBoxTray: pid=%d tid=%d\n", pid, tid));
    261 
    262             HRGN hrgn = CreateRectRgn(0,0,0,0);
    263 
    264             int ret = GetWindowRgn(hwnd, hrgn);
    265 
    266             if (ret == ERROR)
    267             {
    268                 Log(("VBoxTray: GetWindowRgn failed with rc=%d\n", GetLastError()));
    269                 SetRectRgn(hrgn, rectVisible.left, rectVisible.top, rectVisible.right, rectVisible.bottom);
    270             }
    271             else
    272             {
    273                 /* this region is relative to the window origin instead of the desktop origin */
    274                 OffsetRgn(hrgn, rectWindow.left, rectWindow.top);
    275             }
    276             if (lpParam->hrgn)
    277             {
    278                 /* create a union of the current visible region and the visible rectangle of this window. */
    279                 CombineRgn(lpParam->hrgn, lpParam->hrgn, hrgn, RGN_OR);
    280                 DeleteObject(hrgn);
    281             }
    282             else
    283                 lpParam->hrgn = hrgn;
     205    if (!GetWindowRect(hwnd, &rectWindow))
     206    {
     207        return TRUE;
     208    }
     209
     210    char szWindowText[256];
     211    char szWindowClass[256];
     212    OSVERSIONINFO OSinfo;
     213    HWND hStart = NULL;
     214
     215    szWindowText[0] = 0;
     216    szWindowClass[0] = 0;
     217
     218    GetWindowText(hwnd, szWindowText, sizeof(szWindowText));
     219    GetClassName(hwnd, szWindowClass, sizeof(szWindowClass));
     220
     221    OSinfo.dwOSVersionInfoSize = sizeof (OSinfo);
     222    GetVersionEx (&OSinfo);
     223
     224    if (OSinfo.dwMajorVersion >= 6)
     225    {
     226        hStart = ::FindWindowEx(GetDesktopWindow(), NULL, "Button", "Start");
     227
     228        if ( hwnd == hStart && !strcmp(szWindowText, "Start") )
     229        {
     230            /* for vista and above. To solve the issue of small bar above
     231             * the Start button when mouse is hovered over the start button in seamless mode.
     232             * Difference of 7 is observed in Win 7 platform between the dimensions of rectangle with Start title and its shadow.
     233            */
     234            rectWindow.top += 7;
     235            rectWindow.bottom -=7;
     236        }
     237    }
     238
     239    rectVisible = rectWindow;
     240
     241    /* Filter out Windows XP shadow windows
     242    /** @todo still shows inside the guest */
     243    if ( szWindowText[0] == 0 &&
     244            (dwStyle == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS)
     245                && dwExStyle == (WS_EX_LAYERED | WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_TOPMOST))
     246            || (dwStyle == (WS_POPUP | WS_VISIBLE | WS_DISABLED | WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
     247                && dwExStyle == (WS_EX_TOOLWINDOW | WS_EX_TRANSPARENT | WS_EX_LAYERED | WS_EX_NOACTIVATE))
     248            || (dwStyle == (WS_POPUP | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN)
     249                && dwExStyle == (WS_EX_TOOLWINDOW)) )
     250    {
     251        Log(("VBoxTray: Filter out shadow window style=%x exstyle=%x\n", dwStyle, dwExStyle));
     252        Log(("VBoxTray: Enum hwnd=%x rect (%d,%d) (%d,%d) (filtered)\n", hwnd, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom));
     253        Log(("VBoxTray: title=%s style=%x exStyle=%x\n", szWindowText, dwStyle, dwExStyle));
     254        return TRUE;
     255    }
     256
     257    /** Such a windows covers the whole screen making desktop background*/
     258    if (strcmp(szWindowText, "Program Manager") && strcmp(szWindowClass, "ApplicationFrameWindow"))
     259    {
     260        Log(("VBoxTray: Enum hwnd=%x rect (%d,%d)-(%d,%d) [%d x %d](applying)\n", hwnd,
     261            rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom,
     262            rectWindow.left - rectWindow.right, rectWindow.bottom - rectWindow.top));
     263        Log(("VBoxTray: title=%s style=%x exStyle=%x\n", szWindowText, dwStyle, dwExStyle));
     264
     265        HRGN hrgn = CreateRectRgn(0, 0, 0, 0);
     266
     267        int ret = GetWindowRgn(hwnd, hrgn);
     268
     269        if (ret == ERROR)
     270        {
     271            Log(("VBoxTray: GetWindowRgn failed with rc=%d, adding antire rect\n", GetLastError()));
     272            SetRectRgn(hrgn, rectVisible.left, rectVisible.top, rectVisible.right, rectVisible.bottom);
    284273        }
    285274        else
    286275        {
    287             Log(("VBoxTray: Enum hwnd=%x rect (%d,%d) (%d,%d) (ignored)\n", hwnd, rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom));
    288             Log(("VBoxTray: title=%s style=%x\n", szWindowText, dwStyle));
    289             Log(("VBoxTray: pid=%d tid=%d\n", pid, tid));
    290         }
    291     }
     276            /* this region is relative to the window origin instead of the desktop origin */
     277            OffsetRgn(hrgn, rectWindow.left, rectWindow.top);
     278        }
     279
     280        if (lpParam->hrgn)
     281        {
     282            /* create a union of the current visible region and the visible rectangle of this window. */
     283            CombineRgn(lpParam->hrgn, lpParam->hrgn, hrgn, RGN_OR);
     284            DeleteObject(hrgn);
     285        }
     286        else
     287            lpParam->hrgn = hrgn;
     288    }
     289    else
     290    {
     291        Log(("VBoxTray: Enum hwnd=%x rect (%d,%d)-(%d,%d) [%d x %d](ignored)\n", hwnd,
     292            rectWindow.left, rectWindow.top, rectWindow.right, rectWindow.bottom,
     293            rectWindow.left - rectWindow.right, rectWindow.bottom - rectWindow.top));
     294        Log(("VBoxTray: title=%s style=%x exStyle=%x\n", szWindowText, dwStyle, dwExStyle));
     295    }
     296
    292297    return TRUE; /* continue enumeration */
    293298}
     
    320325                lpEscapeData->escapeCode = VBOXESC_SETVISIBLEREGION;
    321326                LPRGNDATA lpRgnData = VBOXDISPIFESCAPE_DATA(lpEscapeData, RGNDATA);
     327
    322328                memset(lpRgnData, 0, cbSize);
    323329                cbSize = GetRegionData(param.hrgn, cbSize, lpRgnData);
     330
    324331                if (cbSize)
    325332                {
    326 #ifdef DEBUG
    327333                    RECT *lpRect = (RECT *)&lpRgnData->Buffer[0];
    328                     Log(("VBoxTray: New visible region: \n"));
    329 
    330                     for (DWORD i=0;i<lpRgnData->rdh.nCount;i++)
     334                    LogRel(("VBoxTray: New visible region: \n"));
     335
     336                    for (DWORD i = 0; i < lpRgnData->rdh.nCount; i++)
    331337                    {
    332                         Log(("VBoxTray: visible rect (%d,%d)(%d,%d)\n", lpRect[i].left, lpRect[i].top, lpRect[i].right, lpRect[i].bottom));
     338                        LogRel(("VBoxTray: visible rect (%d,%d)(%d,%d)\n", lpRect[i].left, lpRect[i].top, lpRect[i].right, lpRect[i].bottom));
    333339                    }
    334 #endif
     340
    335341                    LPRGNDATA lpCtxRgnData = VBOXDISPIFESCAPE_DATA(pCtx->lpEscapeData, RGNDATA);
     342
    336343                    if (fForce
    337344                        ||  !pCtx->lpEscapeData
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette