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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
408 non_client_view_->GetPreferredSize().ToSIZE(), | 408 non_client_view_->GetPreferredSize().ToSIZE(), |
409 false); | 409 false); |
410 } | 410 } |
411 | 411 |
412 void WindowWin::RunSystemMenu(const gfx::Point& point) { | 412 void WindowWin::RunSystemMenu(const gfx::Point& point) { |
413 // We need to reset and clean up any currently created system menu objects. | 413 // We need to reset and clean up any currently created system menu objects. |
414 // We need to call this otherwise there's a small chance that we aren't going | 414 // We need to call this otherwise there's a small chance that we aren't going |
415 // to get a system menu. We also can't take the return value of this | 415 // to get a system menu. We also can't take the return value of this |
416 // function. We need to call it *again* to get a valid HMENU. | 416 // function. We need to call it *again* to get a valid HMENU. |
417 //::GetSystemMenu(GetNativeView(), TRUE); | 417 //::GetSystemMenu(GetNativeView(), TRUE); |
| 418 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; |
| 419 if (l10n_util::GetTextDirection() == l10n_util::RIGHT_TO_LEFT) |
| 420 flags |= TPM_RIGHTALIGN; |
418 HMENU system_menu = ::GetSystemMenu(GetNativeView(), FALSE); | 421 HMENU system_menu = ::GetSystemMenu(GetNativeView(), FALSE); |
419 int id = ::TrackPopupMenu(system_menu, | 422 int id = ::TrackPopupMenu(system_menu, flags, |
420 TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD, | |
421 point.x(), point.y(), 0, GetNativeView(), NULL); | 423 point.x(), point.y(), 0, GetNativeView(), NULL); |
422 ExecuteSystemMenuCommand(id); | 424 ExecuteSystemMenuCommand(id); |
423 } | 425 } |
424 | 426 |
425 /////////////////////////////////////////////////////////////////////////////// | 427 /////////////////////////////////////////////////////////////////////////////// |
426 // WindowWin, WidgetWin overrides: | 428 // WindowWin, WidgetWin overrides: |
427 | 429 |
428 void WindowWin::OnActivate(UINT action, BOOL minimized, HWND window) { | 430 void WindowWin::OnActivate(UINT action, BOOL minimized, HWND window) { |
429 if (action == WA_INACTIVE) | 431 if (action == WA_INACTIVE) |
430 SaveWindowPosition(); | 432 SaveWindowPosition(); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 saved_window_placement.length = sizeof(WINDOWPLACEMENT); | 488 saved_window_placement.length = sizeof(WINDOWPLACEMENT); |
487 GetWindowPlacement(GetNativeView(), &saved_window_placement); | 489 GetWindowPlacement(GetNativeView(), &saved_window_placement); |
488 Hide(); | 490 Hide(); |
489 | 491 |
490 // Important step: restore the window first, since our hiding hack doesn't | 492 // 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 | 493 // work for maximized windows! We tell the frame not to allow itself to be |
492 // made visible though, which removes the brief flicker. | 494 // made visible though, which removes the brief flicker. |
493 force_hidden_ = true; | 495 force_hidden_ = true; |
494 ::ShowWindow(GetNativeView(), SW_RESTORE); | 496 ::ShowWindow(GetNativeView(), SW_RESTORE); |
495 force_hidden_ = false; | 497 force_hidden_ = false; |
496 | 498 |
497 // We respond to this in response to WM_DWMCOMPOSITIONCHANGED since that is | 499 // 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 | 500 // the only thing we care about - we don't actually respond to WM_THEMECHANGED |
499 // messages. | 501 // messages. |
500 non_client_view_->SetUseNativeFrame(win_util::ShouldUseVistaFrame()); | 502 non_client_view_->SetUseNativeFrame(win_util::ShouldUseVistaFrame()); |
501 | 503 |
502 // Now that we've updated the frame, we'll want to restore our saved placement | 504 // 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. | 505 // since the display should have settled down and we can be properly rendered. |
504 SetWindowPlacement(GetNativeView(), &saved_window_placement); | 506 SetWindowPlacement(GetNativeView(), &saved_window_placement); |
505 | 507 |
506 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 508 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); | 1229 resize_cursors_[RC_NORMAL] = LoadCursor(NULL, IDC_ARROW); |
1228 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); | 1230 resize_cursors_[RC_VERTICAL] = LoadCursor(NULL, IDC_SIZENS); |
1229 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); | 1231 resize_cursors_[RC_HORIZONTAL] = LoadCursor(NULL, IDC_SIZEWE); |
1230 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); | 1232 resize_cursors_[RC_NESW] = LoadCursor(NULL, IDC_SIZENESW); |
1231 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); | 1233 resize_cursors_[RC_NWSE] = LoadCursor(NULL, IDC_SIZENWSE); |
1232 initialized = true; | 1234 initialized = true; |
1233 } | 1235 } |
1234 } | 1236 } |
1235 | 1237 |
1236 } // namespace views | 1238 } // namespace views |
OLD | NEW |