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

Side by Side Diff: ui/views/win/hwnd_message_handler.cc

Issue 14312007: Don't release capture when this window doesn't already have it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/views/win/hwnd_message_handler.h" 5 #include "ui/views/win/hwnd_message_handler.h"
6 6
7 #include <dwmapi.h> 7 #include <dwmapi.h>
8 #include <shellapi.h> 8 #include <shellapi.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 void HWNDMessageHandler::ClearNativeFocus() { 713 void HWNDMessageHandler::ClearNativeFocus() {
714 ::SetFocus(hwnd()); 714 ::SetFocus(hwnd());
715 } 715 }
716 716
717 void HWNDMessageHandler::SetCapture() { 717 void HWNDMessageHandler::SetCapture() {
718 DCHECK(!HasCapture()); 718 DCHECK(!HasCapture());
719 ::SetCapture(hwnd()); 719 ::SetCapture(hwnd());
720 } 720 }
721 721
722 void HWNDMessageHandler::ReleaseCapture() { 722 void HWNDMessageHandler::ReleaseCapture() {
723 ::ReleaseCapture(); 723 if (HasCapture())
724 ::ReleaseCapture();
724 } 725 }
725 726
726 bool HWNDMessageHandler::HasCapture() const { 727 bool HWNDMessageHandler::HasCapture() const {
727 return ::GetCapture() == hwnd(); 728 return ::GetCapture() == hwnd();
728 } 729 }
729 730
730 void HWNDMessageHandler::SetVisibilityChangedAnimationsEnabled(bool enabled) { 731 void HWNDMessageHandler::SetVisibilityChangedAnimationsEnabled(bool enabled) {
731 if (base::win::GetVersion() >= base::win::VERSION_VISTA) { 732 if (base::win::GetVersion() >= base::win::VERSION_VISTA) {
732 int dwm_value = enabled ? FALSE : TRUE; 733 int dwm_value = enabled ? FALSE : TRUE;
733 DwmSetWindowAttribute( 734 DwmSetWindowAttribute(
(...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after
2107 DwmExtendFrameIntoClientArea(hwnd(), &m); 2108 DwmExtendFrameIntoClientArea(hwnd(), &m);
2108 } 2109 }
2109 if (window_pos->flags & SWP_SHOWWINDOW) 2110 if (window_pos->flags & SWP_SHOWWINDOW)
2110 delegate_->HandleVisibilityChanged(true); 2111 delegate_->HandleVisibilityChanged(true);
2111 else if (window_pos->flags & SWP_HIDEWINDOW) 2112 else if (window_pos->flags & SWP_HIDEWINDOW)
2112 delegate_->HandleVisibilityChanged(false); 2113 delegate_->HandleVisibilityChanged(false);
2113 SetMsgHandled(FALSE); 2114 SetMsgHandled(FALSE);
2114 } 2115 }
2115 2116
2116 } // namespace views 2117 } // 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