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 #include <wtsapi32.h> | 10 #include <wtsapi32.h> |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
861 } | 861 } |
862 | 862 |
863 void HWNDMessageHandler::SetFullscreen(bool fullscreen) { | 863 void HWNDMessageHandler::SetFullscreen(bool fullscreen) { |
864 fullscreen_handler()->SetFullscreen(fullscreen); | 864 fullscreen_handler()->SetFullscreen(fullscreen); |
865 // If we are out of fullscreen and there was a pending DWM transition for the | 865 // If we are out of fullscreen and there was a pending DWM transition for the |
866 // window, then go ahead and do it now. | 866 // window, then go ahead and do it now. |
867 if (!fullscreen && dwm_transition_desired_) | 867 if (!fullscreen && dwm_transition_desired_) |
868 PerformDwmTransition(); | 868 PerformDwmTransition(); |
869 } | 869 } |
870 | 870 |
| 871 void HWNDMessageHandler::SizeConstraintsChanged() { |
| 872 bool can_resize = delegate_->CanResize(); |
| 873 bool can_maximize = delegate_->CanMaximize(); |
| 874 LONG style = GetWindowLong(hwnd(), GWL_STYLE); |
| 875 if (can_resize && can_maximize) { |
| 876 style |= WS_MINIMIZEBOX | WS_MAXIMIZEBOX; |
| 877 } else { |
| 878 style &= ~(WS_MINIMIZEBOX | WS_MAXIMIZEBOX); |
| 879 } |
| 880 if (can_resize) { |
| 881 style |= WS_THICKFRAME; |
| 882 } else { |
| 883 style &= ~WS_THICKFRAME; |
| 884 } |
| 885 SetWindowLong(hwnd(), GWL_STYLE, style); |
| 886 } |
| 887 |
871 //////////////////////////////////////////////////////////////////////////////// | 888 //////////////////////////////////////////////////////////////////////////////// |
872 // HWNDMessageHandler, InputMethodDelegate implementation: | 889 // HWNDMessageHandler, InputMethodDelegate implementation: |
873 | 890 |
874 void HWNDMessageHandler::DispatchKeyEventPostIME(const ui::KeyEvent& key) { | 891 void HWNDMessageHandler::DispatchKeyEventPostIME(const ui::KeyEvent& key) { |
875 SetMsgHandled(delegate_->HandleKeyEvent(key)); | 892 SetMsgHandled(delegate_->HandleKeyEvent(key)); |
876 } | 893 } |
877 | 894 |
878 //////////////////////////////////////////////////////////////////////////////// | 895 //////////////////////////////////////////////////////////////////////////////// |
879 // HWNDMessageHandler, gfx::WindowImpl overrides: | 896 // HWNDMessageHandler, gfx::WindowImpl overrides: |
880 | 897 |
(...skipping 1579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2477 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
2461 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2478 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
2462 } | 2479 } |
2463 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2480 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
2464 // to notify our children too, since we can have MDI child windows who need to | 2481 // to notify our children too, since we can have MDI child windows who need to |
2465 // update their appearance. | 2482 // update their appearance. |
2466 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2483 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
2467 } | 2484 } |
2468 | 2485 |
2469 } // namespace views | 2486 } // namespace views |
OLD | NEW |