Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(398)

Side by Side Diff: views/widget/native_widget_win.cc

Issue 8133009: Avoid DefWindowProc non-client rendering over our custom frame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "views/widget/native_widget_win.h" 5 #include "views/widget/native_widget_win.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 1168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1179 void NativeWidgetWin::OnActivate(UINT action, BOOL minimized, HWND window) { 1179 void NativeWidgetWin::OnActivate(UINT action, BOOL minimized, HWND window) {
1180 SetMsgHandled(FALSE); 1180 SetMsgHandled(FALSE);
1181 } 1181 }
1182 1182
1183 void NativeWidgetWin::OnActivateApp(BOOL active, DWORD thread_id) { 1183 void NativeWidgetWin::OnActivateApp(BOOL active, DWORD thread_id) {
1184 if (GetWidget()->non_client_view() && !active && 1184 if (GetWidget()->non_client_view() && !active &&
1185 thread_id != GetCurrentThreadId()) { 1185 thread_id != GetCurrentThreadId()) {
1186 // Another application was activated, we should reset any state that 1186 // Another application was activated, we should reset any state that
1187 // disables inactive rendering now. 1187 // disables inactive rendering now.
1188 delegate_->EnableInactiveRendering(); 1188 delegate_->EnableInactiveRendering();
1189 // Update the native frame too, since it could be rendering the non-client 1189 // Also update the native frame if it is rendering the non-client area.
1190 // area. 1190 if (GetWidget()->ShouldUseNativeFrame())
1191 DefWindowProcWithRedrawLock(WM_NCACTIVATE, FALSE, 0); 1191 DefWindowProcWithRedrawLock(WM_NCACTIVATE, FALSE, 0);
1192 } 1192 }
1193 } 1193 }
1194 1194
1195 LRESULT NativeWidgetWin::OnAppCommand(HWND window, 1195 LRESULT NativeWidgetWin::OnAppCommand(HWND window,
1196 short app_command, 1196 short app_command,
1197 WORD device, 1197 WORD device,
1198 int keystate) { 1198 int keystate) {
1199 // We treat APPCOMMAND ids as an extension of our command namespace, and just 1199 // We treat APPCOMMAND ids as an extension of our command namespace, and just
1200 // let the delegate figure out what to do... 1200 // let the delegate figure out what to do...
1201 SetMsgHandled(GetWidget()->widget_delegate() && 1201 SetMsgHandled(GetWidget()->widget_delegate() &&
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
1619 RDW_NOCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW); 1619 RDW_NOCHILDREN | RDW_INVALIDATE | RDW_UPDATENOW);
1620 EnumChildWindows(GetNativeView(), EnumChildWindowsForRedraw, NULL); 1620 EnumChildWindows(GetNativeView(), EnumChildWindowsForRedraw, NULL);
1621 } 1621 }
1622 1622
1623 // If we're active again, we should be allowed to render as inactive, so 1623 // If we're active again, we should be allowed to render as inactive, so
1624 // tell the non-client view. 1624 // tell the non-client view.
1625 bool inactive_rendering_disabled = delegate_->IsInactiveRenderingDisabled(); 1625 bool inactive_rendering_disabled = delegate_->IsInactiveRenderingDisabled();
1626 if (IsActive()) 1626 if (IsActive())
1627 delegate_->EnableInactiveRendering(); 1627 delegate_->EnableInactiveRendering();
1628 1628
1629 // Avoid DefWindowProc non-client rendering over our custom frame.
1630 if (!GetWidget()->ShouldUseNativeFrame()) {
1631 SetMsgHandled(TRUE);
1632 return TRUE;
1633 }
1634
1629 return DefWindowProcWithRedrawLock(WM_NCACTIVATE, 1635 return DefWindowProcWithRedrawLock(WM_NCACTIVATE,
1630 inactive_rendering_disabled || active, 0); 1636 inactive_rendering_disabled || active, 0);
1631 } 1637 }
1632 1638
1633 LRESULT NativeWidgetWin::OnNCCalcSize(BOOL mode, LPARAM l_param) { 1639 LRESULT NativeWidgetWin::OnNCCalcSize(BOOL mode, LPARAM l_param) {
1634 // We only override the default handling if we need to specify a custom 1640 // We only override the default handling if we need to specify a custom
1635 // non-client edge width. Note that in most cases "no insets" means no 1641 // non-client edge width. Note that in most cases "no insets" means no
1636 // custom width, but in fullscreen mode we want a custom width of 0. 1642 // custom width, but in fullscreen mode we want a custom width of 0.
1637 gfx::Insets insets = GetClientAreaInsets(); 1643 gfx::Insets insets = GetClientAreaInsets();
1638 if (insets.empty() && !IsFullscreen()) { 1644 if (insets.empty() && !IsFullscreen()) {
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
2607 return (GetKeyState(VK_LBUTTON) & 0x80) || 2613 return (GetKeyState(VK_LBUTTON) & 0x80) ||
2608 (GetKeyState(VK_RBUTTON) & 0x80) || 2614 (GetKeyState(VK_RBUTTON) & 0x80) ||
2609 (GetKeyState(VK_MBUTTON) & 0x80) || 2615 (GetKeyState(VK_MBUTTON) & 0x80) ||
2610 (GetKeyState(VK_XBUTTON1) & 0x80) || 2616 (GetKeyState(VK_XBUTTON1) & 0x80) ||
2611 (GetKeyState(VK_XBUTTON2) & 0x80); 2617 (GetKeyState(VK_XBUTTON2) & 0x80);
2612 } 2618 }
2613 2619
2614 } // namespace internal 2620 } // namespace internal
2615 2621
2616 } // namespace views 2622 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698