summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-09 23:22:24 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-12-09 23:22:24 +0000
commit44675d23f7f38785e959fe29eefcaf0688a4d1c1 (patch)
tree620a6387ec2b65ba11f80fe65445332bf531e6eb
parent8bfa6948bd9c3dc0e8028e593bf2f97617e1d7a8 (diff)
downloadchromium_src-44675d23f7f38785e959fe29eefcaf0688a4d1c1.zip
chromium_src-44675d23f7f38785e959fe29eefcaf0688a4d1c1.tar.gz
chromium_src-44675d23f7f38785e959fe29eefcaf0688a4d1c1.tar.bz2
Merge 238462 "Ensure that reposting mouse events on Windows post..."
> Ensure that reposting mouse events on Windows posts the message natively via the PostMessage API. > > The current code posts the events via the Aura code path which does not work on Windows with the glass theme for the system > menu buttons (Min/Max/Restore). These are part of the non client area of the Window and rely on the WM_NCLBUTTONDOWN message > to be defproced which eventually posts a WM_SYSCOMMAND message for the corresponding operation. > > Fix is to check if the NativeWindow doing a repost is in the Metro environment for Windows. If yes we continue the current logic > of reposting the events via Aura. If not we post the message natively. The RepostLocatedEvent function internally calls > the RepostLocatedEventWin function to post the function natively. The functionality to check if a window is in metro > has been added to the ViewsDelegate interface and is implemented by Chrome. > > Fixes bug https://code.google.com/p/chromium/issues/detail?id=323105 > > BUG=323105 > R=sky@chromium.org > > Review URL: https://codereview.chromium.org/100303005 TBR=ananta@chromium.org Review URL: https://codereview.chromium.org/99303008 git-svn-id: svn://svn.chromium.org/chrome/branches/1700/src@239597 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.cc4
-rw-r--r--chrome/browser/ui/views/chrome_views_delegate.h1
-rw-r--r--ui/views/event_utils.h6
-rw-r--r--ui/views/event_utils_aura.cc8
-rw-r--r--ui/views/event_utils_win.cc7
-rw-r--r--ui/views/test/test_views_delegate.h4
-rw-r--r--ui/views/views.gyp1
-rw-r--r--ui/views/views_delegate.h3
8 files changed, 33 insertions, 1 deletions
diff --git a/chrome/browser/ui/views/chrome_views_delegate.cc b/chrome/browser/ui/views/chrome_views_delegate.cc
index 3e7cabe..ea539f5 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.cc
+++ b/chrome/browser/ui/views/chrome_views_delegate.cc
@@ -151,6 +151,10 @@ void ChromeViewsDelegate::NotifyMenuItemFocused(const string16& menu_name,
HICON ChromeViewsDelegate::GetDefaultWindowIcon() const {
return GetAppIcon();
}
+
+bool ChromeViewsDelegate::IsWindowInMetro(gfx::NativeWindow window) const {
+ return chrome::IsNativeViewInAsh(window);
+}
#endif
views::NonClientFrameView* ChromeViewsDelegate::CreateDefaultNonClientFrameView(
diff --git a/chrome/browser/ui/views/chrome_views_delegate.h b/chrome/browser/ui/views/chrome_views_delegate.h
index 9d5df1b..59bebcd 100644
--- a/chrome/browser/ui/views/chrome_views_delegate.h
+++ b/chrome/browser/ui/views/chrome_views_delegate.h
@@ -36,6 +36,7 @@ class ChromeViewsDelegate : public views::ViewsDelegate {
#if defined(OS_WIN)
virtual HICON GetDefaultWindowIcon() const OVERRIDE;
+ virtual bool IsWindowInMetro(gfx::NativeWindow window) const OVERRIDE;
#endif
virtual views::NonClientFrameView* CreateDefaultNonClientFrameView(
views::Widget* widget) OVERRIDE;
diff --git a/ui/views/event_utils.h b/ui/views/event_utils.h
index 3527c50..095487b 100644
--- a/ui/views/event_utils.h
+++ b/ui/views/event_utils.h
@@ -20,6 +20,12 @@ namespace views {
VIEWS_EXPORT bool RepostLocatedEvent(gfx::NativeWindow window,
const ui::LocatedEvent& event);
+#if defined(OS_WIN) && defined(USE_AURA)
+// Reposts a located event to the HWND passed in.
+VIEWS_EXPORT bool RepostLocatedEventWin(HWND window,
+ const ui::LocatedEvent& event);
+#endif
+
} // namespace views
#endif // UI_VIEWS_EVENT_UTILS_H_
diff --git a/ui/views/event_utils_aura.cc b/ui/views/event_utils_aura.cc
index 9a42656..e3d07d9 100644
--- a/ui/views/event_utils_aura.cc
+++ b/ui/views/event_utils_aura.cc
@@ -10,6 +10,7 @@
#include "ui/aura/root_window.h"
#include "ui/events/event.h"
#include "ui/gfx/point.h"
+#include "ui/views/views_delegate.h"
using aura::client::ScreenPositionClient;
@@ -20,6 +21,13 @@ bool RepostLocatedEvent(gfx::NativeWindow window,
if (!window)
return false;
+#if defined(OS_WIN)
+ if (ViewsDelegate::views_delegate &&
+ !ViewsDelegate::views_delegate->IsWindowInMetro(window)) {
+ return RepostLocatedEventWin(
+ window->GetDispatcher()->host()->GetAcceleratedWidget(), event);
+ }
+#endif
aura::Window* root_window = window->GetRootWindow();
gfx::Point root_loc(event.location());
diff --git a/ui/views/event_utils_win.cc b/ui/views/event_utils_win.cc
index 38c05c9..0640675 100644
--- a/ui/views/event_utils_win.cc
+++ b/ui/views/event_utils_win.cc
@@ -13,8 +13,13 @@
namespace views {
-bool RepostLocatedEvent(gfx::NativeWindow window,
+#if defined(USE_AURA)
+bool RepostLocatedEventWin(HWND window,
+ const ui::LocatedEvent& event) {
+#else
+bool RepostLocatedEvent(gfx::NativeWindow window
const ui::LocatedEvent& event) {
+#endif
if (!window)
return false;
diff --git a/ui/views/test/test_views_delegate.h b/ui/views/test/test_views_delegate.h
index b5c35d3..e9947a5 100644
--- a/ui/views/test/test_views_delegate.h
+++ b/ui/views/test/test_views_delegate.h
@@ -50,6 +50,10 @@ class TestViewsDelegate : public ViewsDelegate {
virtual HICON GetDefaultWindowIcon() const OVERRIDE {
return NULL;
}
+
+ virtual bool IsWindowInMetro(gfx::NativeWindow window) const {
+ return false;
+ }
#endif
virtual NonClientFrameView* CreateDefaultNonClientFrameView(
Widget* widget) OVERRIDE;
diff --git a/ui/views/views.gyp b/ui/views/views.gyp
index 5969c05..6b5463b 100644
--- a/ui/views/views.gyp
+++ b/ui/views/views.gyp
@@ -499,6 +499,7 @@
['include', 'controls/menu/native_menu_win.h'],
['include', 'corewm/tooltip_win.cc'],
['include', 'corewm/tooltip_win.h'],
+ ['include', 'event_utils_win.cc'],
['include', 'widget/desktop_aura/desktop_screen_win.cc'],
['include', 'widget/desktop_aura/desktop_drag_drop_client_win.cc'],
['include', 'widget/desktop_aura/desktop_drop_target_win.cc'],
diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h
index 4acb774..fb7b0a3 100644
--- a/ui/views/views_delegate.h
+++ b/ui/views/views_delegate.h
@@ -88,6 +88,9 @@ class VIEWS_EXPORT ViewsDelegate {
#if defined(OS_WIN)
// Retrieves the default window icon to use for windows if none is specified.
virtual HICON GetDefaultWindowIcon() const = 0;
+ // Returns true if the window passed in is in the Windows 8 metro
+ // environment.
+ virtual bool IsWindowInMetro(gfx::NativeWindow window) const = 0;
#endif
// Creates a default NonClientFrameView to be used for windows that don't