Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 | 10 |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 634 | 634 |
| 635 void HWNDMessageHandler::Hide() { | 635 void HWNDMessageHandler::Hide() { |
| 636 if (IsWindow(hwnd())) { | 636 if (IsWindow(hwnd())) { |
| 637 // NOTE: Be careful not to activate any windows here (for example, calling | 637 // NOTE: Be careful not to activate any windows here (for example, calling |
| 638 // ShowWindow(SW_HIDE) will automatically activate another window). This | 638 // ShowWindow(SW_HIDE) will automatically activate another window). This |
| 639 // code can be called while a window is being deactivated, and activating | 639 // code can be called while a window is being deactivated, and activating |
| 640 // another window will screw up the activation that is already in progress. | 640 // another window will screw up the activation that is already in progress. |
| 641 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, | 641 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, |
| 642 SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | | 642 SWP_HIDEWINDOW | SWP_NOACTIVATE | SWP_NOMOVE | |
| 643 SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); | 643 SWP_NOREPOSITION | SWP_NOSIZE | SWP_NOZORDER); |
| 644 | |
| 645 if (direct_manipulation_helper_) | |
| 646 direct_manipulation_helper_->Deactivate(hwnd()); | |
| 644 } | 647 } |
| 645 } | 648 } |
| 646 | 649 |
| 647 void HWNDMessageHandler::Maximize() { | 650 void HWNDMessageHandler::Maximize() { |
| 648 ExecuteSystemMenuCommand(SC_MAXIMIZE); | 651 ExecuteSystemMenuCommand(SC_MAXIMIZE); |
| 649 } | 652 } |
| 650 | 653 |
| 651 void HWNDMessageHandler::Minimize() { | 654 void HWNDMessageHandler::Minimize() { |
| 652 ExecuteSystemMenuCommand(SC_MINIMIZE); | 655 ExecuteSystemMenuCommand(SC_MINIMIZE); |
| 653 delegate_->HandleNativeBlur(NULL); | 656 delegate_->HandleNativeBlur(NULL); |
| (...skipping 1845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2499 } | 2502 } |
| 2500 | 2503 |
| 2501 if (window_pos->flags & SWP_SHOWWINDOW) | 2504 if (window_pos->flags & SWP_SHOWWINDOW) |
| 2502 delegate_->HandleVisibilityChanging(true); | 2505 delegate_->HandleVisibilityChanging(true); |
| 2503 else if (window_pos->flags & SWP_HIDEWINDOW) | 2506 else if (window_pos->flags & SWP_HIDEWINDOW) |
| 2504 delegate_->HandleVisibilityChanging(false); | 2507 delegate_->HandleVisibilityChanging(false); |
| 2505 | 2508 |
| 2506 SetMsgHandled(FALSE); | 2509 SetMsgHandled(FALSE); |
| 2507 } | 2510 } |
| 2508 | 2511 |
| 2509 void HWNDMessageHandler::OnWindowPosChanged(WINDOWPOS* window_pos) { | 2512 void HWNDMessageHandler::OnWindowPosChanged(WINDOWPOS* window_pos) { |
|
sky
2015/08/14 14:55:26
Wouldn't it be safer to do the Activate/Deactivate
ananta
2015/08/14 18:39:02
It shouldn't matter I think. We are calling Activa
sky
2015/08/14 20:03:36
Yes, but might the system hide/show a window behin
ananta
2015/08/14 20:33:47
Fair enough. Done
| |
| 2510 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. | 2513 // TODO(vadimt): Remove ScopedTracker below once crbug.com/440919 is fixed. |
| 2511 tracked_objects::ScopedTracker tracking_profile( | 2514 tracked_objects::ScopedTracker tracking_profile( |
| 2512 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 2515 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 2513 "440919 HWNDMessageHandler::OnWindowPosChanged")); | 2516 "440919 HWNDMessageHandler::OnWindowPosChanged")); |
| 2514 | 2517 |
| 2515 if (DidClientAreaSizeChange(window_pos)) | 2518 if (DidClientAreaSizeChange(window_pos)) |
| 2516 ClientAreaSizeChanged(); | 2519 ClientAreaSizeChanged(); |
| 2517 if (remove_standard_frame_ && window_pos->flags & SWP_FRAMECHANGED && | 2520 if (remove_standard_frame_ && window_pos->flags & SWP_FRAMECHANGED && |
| 2518 ui::win::IsAeroGlassEnabled() && | 2521 ui::win::IsAeroGlassEnabled() && |
| 2519 (window_ex_style() & WS_EX_COMPOSITED) == 0) { | 2522 (window_ex_style() & WS_EX_COMPOSITED) == 0) { |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2779 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2782 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
| 2780 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2783 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
| 2781 } | 2784 } |
| 2782 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2785 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
| 2783 // to notify our children too, since we can have MDI child windows who need to | 2786 // to notify our children too, since we can have MDI child windows who need to |
| 2784 // update their appearance. | 2787 // update their appearance. |
| 2785 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2788 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
| 2786 } | 2789 } |
| 2787 | 2790 |
| 2788 } // namespace views | 2791 } // namespace views |
| OLD | NEW |