diff options
author | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-10 04:11:46 +0000 |
---|---|---|
committer | ananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-07-10 04:11:46 +0000 |
commit | c91581907ea1161c3c98726908c39992acbf1e5d (patch) | |
tree | a3c5e0fc51152a44f43013d8dba76325cfa17970 | |
parent | 479c03a6ca0472bfb9bff9f213da6ef99d804096 (diff) | |
download | chromium_src-c91581907ea1161c3c98726908c39992acbf1e5d.zip chromium_src-c91581907ea1161c3c98726908c39992acbf1e5d.tar.gz chromium_src-c91581907ea1161c3c98726908c39992acbf1e5d.tar.bz2 |
Remove the WM_SYSCOMMAND handling from the LegacyRenderWidgetHostHWND class.
This handler was added to forward the message to the parent window for cases where the size of the
parent and the LegacyRenderWidgetHostHWND window were the same.
We can directly call DefWindowProc on the parent window for non client mouse messages which generates
WM_SYSCOMMAND for the parent window.
This simplifies the LegacyRenderWidgetHostHWND class and also fixes bugs with WM_SYSCOMMAND messages not
getting generated correctly due to missing styles on the LegacyRenderWidgetHostHWND hwnd which does not have
the same styles as the parent.
BUG=377367
Review URL: https://codereview.chromium.org/374283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@282248 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | content/browser/renderer_host/legacy_render_widget_host_win.cc | 23 | ||||
-rw-r--r-- | content/browser/renderer_host/legacy_render_widget_host_win.h | 1 | ||||
-rw-r--r-- | ui/base/win/window_event_target.h | 11 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.cc | 10 | ||||
-rw-r--r-- | ui/views/win/hwnd_message_handler.h | 5 |
5 files changed, 9 insertions, 41 deletions
diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.cc b/content/browser/renderer_host/legacy_render_widget_host_win.cc index d060419..9c2e1a2 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.cc +++ b/content/browser/renderer_host/legacy_render_widget_host_win.cc @@ -224,6 +224,15 @@ LRESULT LegacyRenderWidgetHostHWND::OnMouseRange(UINT message, ret = GetWindowEventTarget(GetParent())->HandleMouseMessage( message, w_param, l_param, &msg_handled); handled = msg_handled; + // If the parent did not handle non client mouse messages, we call + // DefWindowProc on the message with the parent window handle. This + // ensures that WM_SYSCOMMAND is generated for the parent and we are + // out of the picture. + if (!handled && + (message >= WM_NCMOUSEMOVE && message <= WM_NCXBUTTONDBLCLK)) { + ret = ::DefWindowProc(GetParent(), message, w_param, l_param); + handled = TRUE; + } } return ret; } @@ -362,18 +371,4 @@ LRESULT LegacyRenderWidgetHostHWND::OnSize(UINT message, return 0; } -LRESULT LegacyRenderWidgetHostHWND::OnSysCommand(UINT message, - WPARAM w_param, - LPARAM l_param) { - LRESULT ret = 0; - if (GetWindowEventTarget(GetParent())) { - bool msg_handled = false; - ret = GetWindowEventTarget( - GetParent())->HandleSysCommand(message, w_param, l_param, - &msg_handled); - SetMsgHandled(msg_handled); - } - return ret; -} - } // namespace content diff --git a/content/browser/renderer_host/legacy_render_widget_host_win.h b/content/browser/renderer_host/legacy_render_widget_host_win.h index ecd1c94..eb7d832 100644 --- a/content/browser/renderer_host/legacy_render_widget_host_win.h +++ b/content/browser/renderer_host/legacy_render_widget_host_win.h @@ -83,7 +83,6 @@ class CONTENT_EXPORT LegacyRenderWidgetHostHWND OnMouseRange) MESSAGE_HANDLER_EX(WM_NCCALCSIZE, OnNCCalcSize) MESSAGE_HANDLER_EX(WM_SIZE, OnSize) - MESSAGE_HANDLER_EX(WM_SYSCOMMAND, OnSysCommand) END_MSG_MAP() HWND hwnd() { return m_hWnd; } diff --git a/ui/base/win/window_event_target.h b/ui/base/win/window_event_target.h index 2c74522..e8e7d83 100644 --- a/ui/base/win/window_event_target.h +++ b/ui/base/win/window_event_target.h @@ -74,17 +74,6 @@ class UI_BASE_EXPORT WindowEventTarget { WPARAM w_param, LPARAM l_param, bool* handled) = 0; - - // Handles the WM_SYSCOMMAND message - // The |message| parameter identifies the message. - // The |w_param| and |l_param| values are as per MSDN docs. - // The |handled| parameter is an output parameter which when set to false - // indicates that the message should be DefProc'ed. - // Returns the result of processing the message. - virtual LRESULT HandleSysCommand(unsigned int message, - WPARAM w_param, - LPARAM l_param, - bool* handled) = 0; protected: WindowEventTarget(); virtual ~WindowEventTarget(); diff --git a/ui/views/win/hwnd_message_handler.cc b/ui/views/win/hwnd_message_handler.cc index cc2ea86..f8b7f86a 100644 --- a/ui/views/win/hwnd_message_handler.cc +++ b/ui/views/win/hwnd_message_handler.cc @@ -981,16 +981,6 @@ LRESULT HWNDMessageHandler::HandleNcHitTestMessage(unsigned int message, return ret; } -LRESULT HWNDMessageHandler::HandleSysCommand(unsigned int message, - WPARAM w_param, - LPARAM l_param, - bool* handled) { - OnSysCommand(static_cast<UINT>(w_param), - gfx::Point(CR_GET_X_LPARAM(l_param), CR_GET_Y_LPARAM(l_param))); - *handled = IsMsgHandled(); - return 0; -} - //////////////////////////////////////////////////////////////////////////////// // HWNDMessageHandler, private: diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h index 9e42ef9..972670f 100644 --- a/ui/views/win/hwnd_message_handler.h +++ b/ui/views/win/hwnd_message_handler.h @@ -239,11 +239,6 @@ class VIEWS_EXPORT HWNDMessageHandler : LPARAM l_param, bool* handled) OVERRIDE; - virtual LRESULT HandleSysCommand(unsigned int message, - WPARAM w_param, - LPARAM l_param, - bool* handled); - // Returns the auto-hide edges of the appbar. See // ViewsDelegate::GetAppbarAutohideEdges() for details. If the edges change, // OnAppbarAutohideEdgesChanged() is called. |