diff options
| author | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-12 00:04:07 +0000 |
|---|---|---|
| committer | beng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-12 00:04:07 +0000 |
| commit | 4c3c971f9fabbf9d1a83d58794b0e940e794b259 (patch) | |
| tree | 719a2a81631b18e7f4b238e4d426dd47b6a7ef33 /chrome | |
| parent | f5ed8349d2e0d6ceeb31d5e7598abb808a9e2ae5 (diff) | |
| download | chromium_src-4c3c971f9fabbf9d1a83d58794b0e940e794b259.zip chromium_src-4c3c971f9fabbf9d1a83d58794b0e940e794b259.tar.gz chromium_src-4c3c971f9fabbf9d1a83d58794b0e940e794b259.tar.bz2 | |
Prevent window caption flashing in the magic frames by handling undocumented windows messages that get sent to caption'ed windows.
B=1031854
Review URL: http://codereview.chromium.org/1965
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@2105 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
| -rw-r--r-- | chrome/views/custom_frame_window.cc | 18 | ||||
| -rw-r--r-- | chrome/views/custom_frame_window.h | 2 | ||||
| -rw-r--r-- | chrome/views/hwnd_view_container.h | 25 |
3 files changed, 45 insertions, 0 deletions
diff --git a/chrome/views/custom_frame_window.cc b/chrome/views/custom_frame_window.cc index 2f00a88..12d0a5b 100644 --- a/chrome/views/custom_frame_window.cc +++ b/chrome/views/custom_frame_window.cc @@ -1105,6 +1105,24 @@ void CustomFrameWindow::OnNCLButtonDown(UINT ht_component, } } +LRESULT CustomFrameWindow::OnNCUAHDrawCaption(UINT msg, WPARAM w_param, + LPARAM l_param) { + // See comment in hwnd_view_container.h at the definition of + // WM_NCUAHDRAWCAPTION for an explanation about why we need to handle this + // message. + SetMsgHandled(TRUE); + return 0; +} + +LRESULT CustomFrameWindow::OnNCUAHDrawFrame(UINT msg, WPARAM w_param, + LPARAM l_param) { + // See comment in hwnd_view_container.h at the definition of + // WM_NCUAHDRAWCAPTION for an explanation about why we need to handle this + // message. + SetMsgHandled(TRUE); + return 0; +} + LRESULT CustomFrameWindow::OnSetCursor(HWND window, UINT hittest_code, UINT message) { int index = RC_NORMAL; diff --git a/chrome/views/custom_frame_window.h b/chrome/views/custom_frame_window.h index d014c91..c8015f1 100644 --- a/chrome/views/custom_frame_window.h +++ b/chrome/views/custom_frame_window.h @@ -56,6 +56,8 @@ class CustomFrameWindow : public Window { virtual LRESULT OnNCMouseMove(UINT flags, const CPoint& point); virtual void OnNCPaint(HRGN rgn); virtual void OnNCLButtonDown(UINT ht_component, const CPoint& point); + virtual LRESULT OnNCUAHDrawCaption(UINT msg, WPARAM w_param, LPARAM l_param); + virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param); virtual LRESULT OnSetCursor(HWND window, UINT hittest_code, UINT message); virtual void OnSize(UINT param, const CSize& size); diff --git a/chrome/views/hwnd_view_container.h b/chrome/views/hwnd_view_container.h index 0249183..7cfb000 100644 --- a/chrome/views/hwnd_view_container.h +++ b/chrome/views/hwnd_view_container.h @@ -35,6 +35,17 @@ RootView* GetRootViewForHWND(HWND hwnd); // lParam - Pointer to MSG struct containing the original message. static const int kReflectedMessage = WM_APP + 3; +// These two messages aren't defined in winuser.h, but they are sent to windows +// with captions. They appear to paint the window caption and frame. +// Unfortunately if you override the standard non-client rendering as we do +// with CustomFrameWindow, sometimes Windows (not deterministically +// reproducibly but definitely frequently) will send these messages to the +// window and paint the standard caption/title over the top of the custom one. +// So we need to handle these messages in CustomFrameWindow to prevent this +// from happening. +static const int WM_NCUAHDRAWCAPTION = 0xAE; +static const int WM_NCUAHDRAWFRAME = 0xAF; + /////////////////////////////////////////////////////////////////////////////// // // FillLayout @@ -159,6 +170,10 @@ class HWNDViewContainer : public ViewContainer, // Reflected message handler MESSAGE_HANDLER_EX(kReflectedMessage, OnReflectedMessage) + + // CustomFrameWindow hacks + MESSAGE_HANDLER_EX(WM_NCUAHDRAWCAPTION, OnNCUAHDrawCaption) + MESSAGE_HANDLER_EX(WM_NCUAHDRAWFRAME, OnNCUAHDrawFrame) // Non-atlcrack.h handlers MESSAGE_HANDLER_EX(WM_GETOBJECT, OnGetObject) @@ -377,6 +392,16 @@ class HWNDViewContainer : public ViewContainer, virtual void OnNCRButtonDblClk(UINT flags, const CPoint& point); virtual void OnNCRButtonDown(UINT flags, const CPoint& point); virtual void OnNCRButtonUp(UINT flags, const CPoint& point); + virtual LRESULT OnNCUAHDrawCaption(UINT msg, + WPARAM w_param, + LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; + } + virtual LRESULT OnNCUAHDrawFrame(UINT msg, WPARAM w_param, LPARAM l_param) { + SetMsgHandled(FALSE); + return 0; + } virtual LRESULT OnNotify(int w_param, NMHDR* l_param); virtual void OnPaint(HDC dc); virtual LRESULT OnPowerBroadcast(DWORD power_event, DWORD data) { |
