| 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/gfx/win/hwnd_util.h" | 5 #include "ui/gfx/win/hwnd_util.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
| 9 #include "base/win/metro.h" | 9 #include "base/win/metro.h" |
| 10 #include "base/win/win_util.h" | 10 #include "base/win/win_util.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 CrashOther(); | 200 CrashOther(); |
| 201 break; | 201 break; |
| 202 } | 202 } |
| 203 LOG_GETLASTERROR(FATAL); | 203 LOG_GETLASTERROR(FATAL); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 void ShowSystemMenu(HWND window) { | 207 void ShowSystemMenu(HWND window) { |
| 208 RECT rect; | 208 RECT rect; |
| 209 GetWindowRect(window, &rect); | 209 GetWindowRect(window, &rect); |
| 210 Point point = Point(rect.left, rect.top); | 210 Point point = Point(base::i18n::IsRTL() ? rect.right : rect.left, rect.top); |
| 211 static const int kSystemMenuOffset = 10; | 211 static const int kSystemMenuOffset = 10; |
| 212 point.Offset(kSystemMenuOffset, kSystemMenuOffset); | 212 point.Offset(base::i18n::IsRTL() ? -kSystemMenuOffset : kSystemMenuOffset, |
| 213 kSystemMenuOffset); |
| 213 ShowSystemMenuAtPoint(window, point); | 214 ShowSystemMenuAtPoint(window, point); |
| 214 } | 215 } |
| 215 | 216 |
| 216 void ShowSystemMenuAtPoint(HWND window, const Point& point) { | 217 void ShowSystemMenuAtPoint(HWND window, const Point& point) { |
| 217 // In the Metro process, we never want to show the system menu. | 218 // In the Metro process, we never want to show the system menu. |
| 218 if (base::win::IsMetroProcess()) | 219 if (base::win::IsMetroProcess()) |
| 219 return; | 220 return; |
| 220 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; | 221 UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; |
| 221 if (base::i18n::IsRTL()) | 222 if (base::i18n::IsRTL()) |
| 222 flags |= TPM_RIGHTALIGN; | 223 flags |= TPM_RIGHTALIGN; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 235 HMODULE metro = base::win::GetMetroModule(); | 236 HMODULE metro = base::win::GetMetroModule(); |
| 236 if (!metro) | 237 if (!metro) |
| 237 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; | 238 return get_real_hwnd ? ::GetDesktopWindow() : HWND_DESKTOP; |
| 238 // In windows 8 metro-mode the root window is not the desktop. | 239 // In windows 8 metro-mode the root window is not the desktop. |
| 239 RootWindow root_window = | 240 RootWindow root_window = |
| 240 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); | 241 reinterpret_cast<RootWindow>(::GetProcAddress(metro, "GetRootWindow")); |
| 241 return root_window(); | 242 return root_window(); |
| 242 } | 243 } |
| 243 | 244 |
| 244 } // namespace gfx | 245 } // namespace gfx |
| OLD | NEW |