Index: ui/base/win/hwnd_util.cc |
diff --git a/ui/base/win/hwnd_util.cc b/ui/base/win/hwnd_util.cc |
index 923c85cbf4de24f3a41d693cce7267a59da9ecfe..58dbff2d02bb28393467978afde1aaefe70ef4e3 100644 |
--- a/ui/base/win/hwnd_util.cc |
+++ b/ui/base/win/hwnd_util.cc |
@@ -4,6 +4,7 @@ |
#include "ui/base/win/hwnd_util.h" |
+#include "base/i18n/rtl.h" |
#include "base/string_util.h" |
#include "ui/gfx/rect.h" |
#include "ui/gfx/size.h" |
@@ -174,4 +175,15 @@ void CheckWindowCreated(HWND hwnd) { |
LOG_GETLASTERROR(FATAL); |
} |
+void ShowSystemMenu(HWND window, int screen_x, int screen_y) { |
+ UINT flags = TPM_LEFTBUTTON | TPM_RIGHTBUTTON | TPM_RETURNCMD; |
+ if (base::i18n::IsRTL()) |
+ flags |= TPM_RIGHTALIGN; |
+ HMENU system_menu = GetSystemMenu(window, FALSE); |
+ int command = TrackPopupMenu(system_menu, flags, screen_x, screen_y, 0, |
+ window, NULL); |
+ if (command) |
+ SendMessage(window, WM_SYSCOMMAND, command, 0); |
+} |
+ |
} // namespace ui |