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

Unified Diff: ui/views/controls/menu/menu_controller.cc

Issue 341763002: Ensure that mouse events on Windows reposted by the menu_controller are converted to pixel. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed code Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/menu/menu_controller.cc
diff --git a/ui/views/controls/menu/menu_controller.cc b/ui/views/controls/menu/menu_controller.cc
index 87e7ad2ab088321e93ec1edbbb41730936419c88..9c40021e34db17df17cd4a385126dc8f61106bcc 100644
--- a/ui/views/controls/menu/menu_controller.cc
+++ b/ui/views/controls/menu/menu_controller.cc
@@ -39,6 +39,7 @@
#if defined(OS_WIN)
#include "ui/base/win/internal_constants.h"
+#include "ui/gfx/win/dpi.h"
#include "ui/views/win/hwnd_util.h"
#endif
@@ -2052,6 +2053,10 @@ void MenuController::RepostEvent(SubmenuView* source,
gfx::NativeWindow window = screen->GetWindowAtScreenPoint(screen_loc);
sky 2014/06/18 13:15:59 Move this so that we only call GetWindowAtScreenPo
ananta 2014/06/18 18:53:40 Added a function PlatformGetWindowAtLocation in th
#if defined(OS_WIN)
+ // While posting messages natively on Windows we need to convert the
+ // coordinates to pixel to ensure that they get posted to the correct window.
+ screen_loc = gfx::win::DIPToScreenPoint(screen_loc);
+ window = screen->GetWindowAtScreenPoint(screen_loc);
// PostMessage() to metro windows isn't allowed (access will be denied). Don't
// try to repost with Win32 if the window under the mouse press is in metro.
if (!ViewsDelegate::views_delegate ||
@@ -2068,7 +2073,6 @@ void MenuController::RepostEvent(SubmenuView* source,
// else double events can occur and lead to bad behavior.
return;
}
-
// Determine whether the click was in the client area or not.
// NOTE: WM_NCHITTEST coordinates are relative to the screen.
LPARAM coords = MAKELPARAM(screen_loc.x(), screen_loc.y());
« 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