Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: ui/gfx/win/hwnd_util.cc

Issue 134553002: [Win] alt + space opens system menu at wrong position in RTL ui. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698