Index: ui/views/win/hwnd_message_handler.h |
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h |
index 8a114ebee1be90095386ac833f8c4b6937830880..8ca2b1231be5950bc23daf29ae6b1c111ee21592 100644 |
--- a/ui/views/win/hwnd_message_handler.h |
+++ b/ui/views/win/hwnd_message_handler.h |
@@ -8,6 +8,7 @@ |
#include <windows.h> |
#include <stddef.h> |
+#include <map> |
#include <memory> |
#include <set> |
#include <vector> |
@@ -105,6 +106,14 @@ const int WM_NCUAHDRAWFRAME = 0xAF; |
switch(dwMsgMapID) { \ |
case 0: |
+// This message is posted when our window is activated on the monitor |
+// where there is a fullscreen window owned by us. The handler for |
+// this message reduces the size of the fullscreen window by 1 px. This is |
+// to workaround a bug in the taskbar where it treats all windows owned by |
+// a thread on a monitor as fullscreen windows if one of the windows in there |
+// is a full screen window. The bug does not occur across monitors. |
+const int WM_CUSTOM_MESSAGE_HANDLE_BACKGROUND_FULLSCREEN = WM_USER + 1; |
+ |
// An object that handles messages for a HWND that implements the views |
// "Custom Frame" look. The purpose of this class is to isolate the windows- |
// specific message handling from the code that wraps it. It is intended to be |
@@ -368,6 +377,9 @@ class VIEWS_EXPORT HWNDMessageHandler : |
// word of WPARAM could be set when the window is minimized or restored. |
CR_MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate) |
+ CR_MESSAGE_HANDLER_EX(WM_CUSTOM_MESSAGE_HANDLE_BACKGROUND_FULLSCREEN, |
+ OnBackgroundFullscreen) |
+ |
// This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU. |
CR_MSG_WM_ACTIVATEAPP(OnActivateApp) |
CR_MSG_WM_APPCOMMAND(OnAppCommand) |
@@ -459,6 +471,7 @@ class VIEWS_EXPORT HWNDMessageHandler : |
LRESULT OnTouchEvent(UINT message, WPARAM w_param, LPARAM l_param); |
void OnWindowPosChanging(WINDOWPOS* window_pos); |
void OnWindowPosChanged(WINDOWPOS* window_pos); |
+ LRESULT OnBackgroundFullscreen(UINT message, WPARAM w_param, LPARAM l_param); |
// Receives Windows Session Change notifications. |
void OnSessionChange(WPARAM status_code); |
@@ -517,6 +530,12 @@ class VIEWS_EXPORT HWNDMessageHandler : |
void SetBoundsInternal(const gfx::Rect& bounds_in_pixels, |
bool force_size_changed); |
+ // Checks if there is a full screen window on the same monitor as the |
+ // |window| which is becoming active. If yes then we reduce the size of the |
+ // fullscreen window by 1 px to ensure that maximized windows on the same |
+ // monitor don't draw over the taskbar. |
+ void CheckAndHandleBackgroundFullscreenOnMonitor(HWND window); |
+ |
HWNDMessageHandlerDelegate* delegate_; |
std::unique_ptr<FullscreenHandler> fullscreen_handler_; |
@@ -660,6 +679,12 @@ class VIEWS_EXPORT HWNDMessageHandler : |
// The factory used with BEGIN_SAFE_MSG_MAP_EX. |
base::WeakPtrFactory<HWNDMessageHandler> weak_factory_; |
+ // This is a map of the HMONITOR to full screeen window handle. |
+ typedef std::map<HMONITOR, HWND> FullscreenWindowMonitorMap; |
+ static FullscreenWindowMonitorMap* fullscreen_monitor_map_; |
+ // This holds the number of HWNDMessageHandler instances currently active. |
+ static int32_t instance_count_; |
+ |
DISALLOW_COPY_AND_ASSIGN(HWNDMessageHandler); |
}; |