summaryrefslogtreecommitdiffstats
path: root/ui/views
diff options
context:
space:
mode:
authorjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 05:18:48 +0000
committerjianli@chromium.org <jianli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 05:18:48 +0000
commit180abf94120eb21b3e7386752bddf3c0c58d4e5f (patch)
tree1d889cb6f6af7fe9902d2a18b4e9d962a155fd8b /ui/views
parent807799f42d884e334c5fe9dbd0e4fa504eb6ff29 (diff)
downloadchromium_src-180abf94120eb21b3e7386752bddf3c0c58d4e5f.zip
chromium_src-180abf94120eb21b3e7386752bddf3c0c58d4e5f.tar.gz
chromium_src-180abf94120eb21b3e7386752bddf3c0c58d4e5f.tar.bz2
HWNDMessageHandler::OnNCActivate should clear high word of wparam before converting it to BOOL.
It is found out that high word of wparam could be set when the window is minimized or restored. We should clear wparam's high word before converting it to BOOL. BUG=244986 TEST=Manual test by following repro steps as in the bug Review URL: https://chromiumcodereview.appspot.com/17283013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207714 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views')
-rw-r--r--ui/views/win/hwnd_message_handler.cc12
-rw-r--r--ui/views/win/hwnd_message_handler.h8
2 files changed, 17 insertions, 3 deletions
diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc
index 6e1ac3e..b9133fa 100644
--- a/ui/views/win/hwnd_message_handler.cc
+++ b/ui/views/win/hwnd_message_handler.cc
@@ -1557,7 +1557,17 @@ void HWNDMessageHandler::OnMoving(UINT param, const RECT* new_bounds) {
delegate_->HandleMove();
}
-LRESULT HWNDMessageHandler::OnNCActivate(BOOL active) {
+LRESULT HWNDMessageHandler::OnNCActivate(UINT message,
+ WPARAM w_param,
+ LPARAM l_param) {
+ // Per MSDN, w_param is either TRUE or FALSE. However, MSDN also hints that:
+ // "If the window is minimized when this message is received, the application
+ // should pass the message to the DefWindowProc function."
+ // It is found out that the high word of w_param might be set when the window
+ // is minimized or restored. To handle this, w_param's high word should be
+ // cleared before it is converted to BOOL.
+ BOOL active = static_cast<BOOL>(LOWORD(w_param));
+
if (delegate_->CanActivate())
delegate_->HandleActivationChanged(!!active);
diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
index 4f1e283..beb5ee5 100644
--- a/ui/views/win/hwnd_message_handler.h
+++ b/ui/views/win/hwnd_message_handler.h
@@ -272,6 +272,11 @@ class VIEWS_EXPORT HWNDMessageHandler :
// Touch Events.
MESSAGE_HANDLER_EX(WM_TOUCH, OnTouchEvent)
+ // Uses the general handler macro since the specific handler macro
+ // MSG_WM_NCACTIVATE would convert WPARAM type to BOOL type. The high
+ // word of WPARAM could be set when the window is minimized or restored.
+ MESSAGE_HANDLER_EX(WM_NCACTIVATE, OnNCActivate)
+
// This list is in _ALPHABETICAL_ order! OR I WILL HURT YOU.
MSG_WM_ACTIVATEAPP(OnActivateApp)
MSG_WM_APPCOMMAND(OnAppCommand)
@@ -291,7 +296,6 @@ class VIEWS_EXPORT HWNDMessageHandler :
MSG_WM_KILLFOCUS(OnKillFocus)
MSG_WM_MOVE(OnMove)
MSG_WM_MOVING(OnMoving)
- MSG_WM_NCACTIVATE(OnNCActivate)
MSG_WM_NCCALCSIZE(OnNCCalcSize)
MSG_WM_NCHITTEST(OnNCHitTest)
MSG_WM_NCPAINT(OnNCPaint)
@@ -338,7 +342,7 @@ class VIEWS_EXPORT HWNDMessageHandler :
LRESULT OnMouseRange(UINT message, WPARAM w_param, LPARAM l_param);
void OnMove(const CPoint& point);
void OnMoving(UINT param, const RECT* new_bounds);
- LRESULT OnNCActivate(BOOL active);
+ LRESULT OnNCActivate(UINT message, WPARAM w_param, LPARAM l_param);
LRESULT OnNCCalcSize(BOOL mode, LPARAM l_param);
LRESULT OnNCHitTest(const CPoint& point);
void OnNCPaint(HRGN rgn);