| 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/window_win.h" | 5 #include "chrome/views/window/window_win.h" |
| 6 | 6 |
| 7 #include <shellapi.h> | 7 #include <shellapi.h> |
| 8 | 8 |
| 9 #include "base/win_util.h" | 9 #include "base/win_util.h" |
| 10 #include "chrome/app/chrome_dll_resource.h" | 10 #include "chrome/app/chrome_dll_resource.h" |
| (...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 486 saved_window_placement.length = sizeof(WINDOWPLACEMENT); | 486 saved_window_placement.length = sizeof(WINDOWPLACEMENT); |
| 487 GetWindowPlacement(GetNativeView(), &saved_window_placement); | 487 GetWindowPlacement(GetNativeView(), &saved_window_placement); |
| 488 Hide(); | 488 Hide(); |
| 489 | 489 |
| 490 // Important step: restore the window first, since our hiding hack doesn't | 490 // Important step: restore the window first, since our hiding hack doesn't |
| 491 // work for maximized windows! We tell the frame not to allow itself to be | 491 // work for maximized windows! We tell the frame not to allow itself to be |
| 492 // made visible though, which removes the brief flicker. | 492 // made visible though, which removes the brief flicker. |
| 493 force_hidden_ = true; | 493 force_hidden_ = true; |
| 494 ::ShowWindow(GetNativeView(), SW_RESTORE); | 494 ::ShowWindow(GetNativeView(), SW_RESTORE); |
| 495 force_hidden_ = false; | 495 force_hidden_ = false; |
| 496 | 496 |
| 497 // We respond to this in response to WM_DWMCOMPOSITIONCHANGED since that is | 497 // We respond to this in response to WM_DWMCOMPOSITIONCHANGED since that is |
| 498 // the only thing we care about - we don't actually respond to WM_THEMECHANGED | 498 // the only thing we care about - we don't actually respond to WM_THEMECHANGED |
| 499 // messages. | 499 // messages. |
| 500 non_client_view_->SetUseNativeFrame(win_util::ShouldUseVistaFrame()); | 500 non_client_view_->SetUseNativeFrame(win_util::ShouldUseVistaFrame()); |
| 501 | 501 |
| 502 // Now that we've updated the frame, we'll want to restore our saved placement | 502 // Now that we've updated the frame, we'll want to restore our saved placement |
| 503 // since the display should have settled down and we can be properly rendered. | 503 // since the display should have settled down and we can be properly rendered. |
| 504 SetWindowPlacement(GetNativeView(), &saved_window_placement); | 504 SetWindowPlacement(GetNativeView(), &saved_window_placement); |
| 505 | 505 |
| 506 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 506 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
| (...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 | 1203 |
| 1204 void WindowWin::ProcessNCMousePress(const CPoint& point, int flags) { | 1204 void WindowWin::ProcessNCMousePress(const CPoint& point, int flags) { |
| 1205 CPoint temp = point; | 1205 CPoint temp = point; |
| 1206 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1); | 1206 MapWindowPoints(HWND_DESKTOP, GetNativeView(), &temp, 1); |
| 1207 UINT message_flags = 0; | 1207 UINT message_flags = 0; |
| 1208 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) | 1208 if ((GetKeyState(VK_CONTROL) & 0x80) == 0x80) |
| 1209 message_flags |= MK_CONTROL; | 1209 message_flags |= MK_CONTROL; |
| 1210 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) | 1210 if ((GetKeyState(VK_SHIFT) & 0x80) == 0x80) |
| 1211 message_flags |= MK_SHIFT; | 1211 message_flags |= MK_SHIFT; |
| 1212 message_flags |= flags; | 1212 message_flags |= flags; |
| 1213 ProcessMousePressed(temp, message_flags, false); | 1213 ProcessMousePressed(temp, message_flags, false, false); |
| 1214 } | 1214 } |
| 1215 | 1215 |
| 1216 LRESULT WindowWin::CallDefaultNCActivateHandler(BOOL active) { | 1216 LRESULT WindowWin::CallDefaultNCActivateHandler(BOOL active) { |
| 1217 // The DefWindowProc handling for WM_NCACTIVATE renders the classic-look | 1217 // The DefWindowProc handling for WM_NCACTIVATE renders the classic-look |
| 1218 // window title bar directly, so we need to use a redraw lock here to prevent | 1218 // window title bar directly, so we need to use a redraw lock here to prevent |
| 1219 // it from doing so. | 1219 // it from doing so. |
| 1220 ScopedRedrawLock lock(this); | 1220 ScopedRedrawLock lock(this); |
| 1221 return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); | 1221 return DefWindowProc(GetNativeView(), WM_NCACTIVATE, active, 0); |
| 1222 } | 1222 } |
| 1223 | 1223 |
| 1224 void WindowWin::InitClass() { | 1224 void WindowWin::InitClass() { |
| 1225 static bool initialized = false; | 1225 static bool initialized = false; |
| 1226 if (!initialized) { | 1226 if (!initialized) { |
| 1227 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); | 1227 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); |
| 1228 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); | 1228 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); |
| 1229 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); | 1229 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); |
| 1230 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); | 1230 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); |
| 1231 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); | 1231 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); |
| 1232 initialized = true; | 1232 initialized = true; |
| 1233 } | 1233 } |
| 1234 } | 1234 } |
| 1235 | 1235 |
| 1236 } // namespace views | 1236 } // namespace views |
| OLD | NEW |