| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 "chrome/views/window.h" | 5 #include "chrome/views/window.h" |
| 6 | 6 |
| 7 #include "base/win_util.h" | 7 #include "base/win_util.h" |
| 8 #include "chrome/app/chrome_dll_resource.h" | 8 #include "chrome/app/chrome_dll_resource.h" |
| 9 #include "chrome/common/gfx/chrome_font.h" | 9 #include "chrome/common/gfx/chrome_font.h" |
| 10 #include "chrome/common/gfx/icon_util.h" | 10 #include "chrome/common/gfx/icon_util.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 mi.cbSize = sizeof(mi); | 76 mi.cbSize = sizeof(mi); |
| 77 ::GetMonitorInfo(current_monitor, &mi); | 77 ::GetMonitorInfo(current_monitor, &mi); |
| 78 working_rect = mi.rcWork; | 78 working_rect = mi.rcWork; |
| 79 } | 79 } |
| 80 working_rect.Inset(kMonitorEdgePadding, kMonitorEdgePadding); | 80 working_rect.Inset(kMonitorEdgePadding, kMonitorEdgePadding); |
| 81 return working_rect.size(); | 81 return working_rect.size(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void Window::Show() { | 84 void Window::Show() { |
| 85 int show_state = GetShowState(); | 85 int show_state = GetShowState(); |
| 86 bool maximized = false; | |
| 87 if (saved_maximized_state_) | 86 if (saved_maximized_state_) |
| 88 show_state = SW_SHOWMAXIMIZED; | 87 show_state = SW_SHOWMAXIMIZED; |
| 89 Show(show_state); | 88 Show(show_state); |
| 90 } | 89 } |
| 91 | 90 |
| 92 void Window::Show(int show_state) { | 91 void Window::Show(int show_state) { |
| 93 ShowWindow(show_state); | 92 ShowWindow(show_state); |
| 93 // When launched from certain programs like bash and Windows Live Messenger, |
| 94 // show_state is set to SW_HIDE, so we need to correct that condition. We |
| 95 // don't just change show_state to SW_SHOWNORMAL because MSDN says we must |
| 96 // always first call ShowWindow with the specified value from STARTUPINFO, |
| 97 // otherwise all future ShowWindow calls will be ignored (!!#@@#!). Instead, |
| 98 // we call ShowWindow again in this case. |
| 99 if (show_state == SW_HIDE) |
| 100 ShowWindow(SW_SHOWNORMAL); |
| 94 SetInitialFocus(); | 101 SetInitialFocus(); |
| 95 } | 102 } |
| 96 | 103 |
| 97 int Window::GetShowState() const { | 104 int Window::GetShowState() const { |
| 98 return SW_SHOWNORMAL; | 105 return SW_SHOWNORMAL; |
| 99 } | 106 } |
| 100 | 107 |
| 101 void Window::Activate() { | 108 void Window::Activate() { |
| 102 if (IsMinimized()) | 109 if (IsMinimized()) |
| 103 ::ShowWindow(GetHWND(), SW_RESTORE); | 110 ::ShowWindow(GetHWND(), SW_RESTORE); |
| (...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 void Window::InitClass() { | 678 void Window::InitClass() { |
| 672 static bool initialized = false; | 679 static bool initialized = false; |
| 673 if (!initialized) { | 680 if (!initialized) { |
| 674 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); | 681 nwse_cursor_ = LoadCursor(NULL, IDC_SIZENWSE); |
| 675 initialized = true; | 682 initialized = true; |
| 676 } | 683 } |
| 677 } | 684 } |
| 678 | 685 |
| 679 } // namespace views | 686 } // namespace views |
| 680 | 687 |
| OLD | NEW |