VirtualBox

source: vbox/trunk/src/VBox/Frontends/VirtualBox/src/platform/win/VBoxUtils-win.cpp@ 74942

Last change on this file since 74942 was 71784, checked in by vboxsync, 6 years ago

FE/Qt: bugref:9049: VBoxGlobal library fixes for Windows.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.4 KB
RevLine 
[26714]1/* $Id: VBoxUtils-win.cpp 71784 2018-04-09 15:56:21Z vboxsync $ */
[25177]2/** @file
[71784]3 * VBox Qt GUI - Declarations of utility classes and functions for handling Windows specific tasks.
[25177]4 */
5
6/*
[71784]7 * Copyright (C) 2010-2018 Oracle Corporation
[25177]8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
[71784]18/* GUI includes: */
[35940]19#include "VBoxUtils-win.h"
[25177]20
[71784]21
22/** Namespace for native window sub-system functions. */
[35940]23namespace NativeWindowSubsystem
[25177]24{
[71784]25 /** Enumerates visible always-on-top (top-most) windows. */
[35940]26 BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam);
[71784]27 /** Contains visible top-most-window rectangles. */
[35940]28 QList<QRect> topMostRects;
[25177]29}
30
[71784]31BOOL CALLBACK NativeWindowSubsystem::EnumWindowsProc(HWND hWnd, LPARAM)
[25177]32{
[35906]33 /* Ignore NULL HWNDs: */
34 if (!hWnd)
35 return TRUE;
36
37 /* Ignore hidden windows: */
38 if (!IsWindowVisible(hWnd))
39 return TRUE;
40
41 /* Get window style: */
42 LONG uStyle = GetWindowLong(hWnd, GWL_STYLE);
43 /* Ignore minimized windows: */
44 if (uStyle & WS_MINIMIZE)
45 return TRUE;
46
47 /* Get extended window style: */
48 LONG uExtendedStyle = GetWindowLong(hWnd, GWL_EXSTYLE);
49 /* Ignore non-top-most windows: */
50 if (!(uExtendedStyle & WS_EX_TOPMOST))
51 return TRUE;
52
53 /* Get that window rectangle: */
54 RECT rect;
55 GetWindowRect(hWnd, &rect);
[35940]56 topMostRects << QRect(QPoint(rect.left, rect.top), QPoint(rect.right - 1, rect.bottom - 1));
[35906]57
58 /* Proceed to the next window: */
59 return TRUE;
60}
61
[35940]62const QRegion NativeWindowSubsystem::areaCoveredByTopMostWindows()
[35906]63{
64 /* Prepare the top-most region: */
65 QRegion topMostRegion;
66 /* Initialize the list of the top-most rectangles: */
[35940]67 topMostRects.clear();
[35906]68 /* Populate the list of top-most rectangles: */
69 EnumWindows((WNDENUMPROC)EnumWindowsProc, 0);
70 /* Update the top-most region with top-most rectangles: */
[35940]71 for (int iRectIndex = 0; iRectIndex < topMostRects.size(); ++iRectIndex)
72 topMostRegion += topMostRects[iRectIndex];
[35906]73 /* Return top-most region: */
74 return topMostRegion;
75}
76
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use