diff options
author | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-18 22:45:36 +0000 |
---|---|---|
committer | oshima@google.com <oshima@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-18 22:45:36 +0000 |
commit | b5a1864ef483aa39010642f471715eeb041bbe0a (patch) | |
tree | 8eff137402c359edda3e8998764cb65c2fa0c59d /ui/aura | |
parent | 3b73f52789e3132d2ac063c7ec8c6ee4e62db36f (diff) | |
download | chromium_src-b5a1864ef483aa39010642f471715eeb041bbe0a.zip chromium_src-b5a1864ef483aa39010642f471715eeb041bbe0a.tar.gz chromium_src-b5a1864ef483aa39010642f471715eeb041bbe0a.tar.bz2 |
Send fake event when event_type is set to exit menu so that
nested loop can exit.
BUG=104684
TEST=BrowserTest.CloseWithAppMenuOpen passes on aura build
Review URL: http://codereview.chromium.org/8597010
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110774 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/aura')
-rw-r--r-- | ui/aura/desktop.cc | 4 | ||||
-rw-r--r-- | ui/aura/desktop.h | 3 | ||||
-rw-r--r-- | ui/aura/desktop_host.h | 3 | ||||
-rw-r--r-- | ui/aura/desktop_host_linux.cc | 10 | ||||
-rw-r--r-- | ui/aura/desktop_host_win.cc | 5 | ||||
-rw-r--r-- | ui/aura/desktop_host_win.h | 1 |
6 files changed, 26 insertions, 0 deletions
diff --git a/ui/aura/desktop.cc b/ui/aura/desktop.cc index dab97c7..8e73cfa 100644 --- a/ui/aura/desktop.cc +++ b/ui/aura/desktop.cc @@ -413,6 +413,10 @@ bool Desktop::IsMouseButtonDown() const { return mouse_button_flags_ != 0; } +void Desktop::PostNativeEvent(const base::NativeEvent& native_event) { + host_->PostNativeEvent(native_event); +} + void Desktop::SetCapture(Window* window) { if (capture_window_ == window) return; diff --git a/ui/aura/desktop.h b/ui/aura/desktop.h index 10e7f64..43f2e5d 100644 --- a/ui/aura/desktop.h +++ b/ui/aura/desktop.h @@ -125,6 +125,9 @@ class AURA_EXPORT Desktop : public ui::CompositorDelegate, // Are any mouse buttons currently down? bool IsMouseButtonDown() const; + // Posts |native_event| to the platform's event queue. + void PostNativeEvent(const base::NativeEvent& native_event); + // Capture ------------------------------------------------------------------- // Sets capture to the specified window. diff --git a/ui/aura/desktop_host.h b/ui/aura/desktop_host.h index 06f6fe3..b276dea 100644 --- a/ui/aura/desktop_host.h +++ b/ui/aura/desktop_host.h @@ -58,6 +58,9 @@ class DesktopHost : public MessageLoop::Dispatcher { // You should probably call Desktop::last_mouse_location() instead; this // method can be expensive. virtual gfx::Point QueryMouseLocation() = 0; + + // Posts |native_event| to the platform's event queue. + virtual void PostNativeEvent(const base::NativeEvent& native_event) = 0; }; } // namespace aura diff --git a/ui/aura/desktop_host_linux.cc b/ui/aura/desktop_host_linux.cc index e20b1c57..2de31e6 100644 --- a/ui/aura/desktop_host_linux.cc +++ b/ui/aura/desktop_host_linux.cc @@ -240,6 +240,7 @@ class DesktopHostLinux : public DesktopHost { virtual void SetSize(const gfx::Size& size) OVERRIDE; virtual void SetCursor(gfx::NativeCursor cursor_type) OVERRIDE; virtual gfx::Point QueryMouseLocation() OVERRIDE; + virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; // Returns true if there's an X window manager present... in most cases. Some // window managers (notably, ion3) don't implement enough of ICCCM for us to @@ -481,6 +482,15 @@ gfx::Point DesktopHostLinux::QueryMouseLocation() { max(0, min(size_.height(), win_y_return))); } +void DesktopHostLinux::PostNativeEvent(const base::NativeEvent& native_event) { + DCHECK(xwindow_); + DCHECK(xdisplay_); + XEvent xevent = *native_event; + xevent.xany.display = xdisplay_; + xevent.xany.window = xwindow_; + ::XPutBackEvent(xdisplay_, &xevent); +} + bool DesktopHostLinux::IsWindowManagerPresent() { // Per ICCCM 2.8, "Manager Selections", window managers should take ownership // of WM_Sn selections (where n is a screen number). diff --git a/ui/aura/desktop_host_win.cc b/ui/aura/desktop_host_win.cc index c491ac1..36399e2 100644 --- a/ui/aura/desktop_host_win.cc +++ b/ui/aura/desktop_host_win.cc @@ -225,6 +225,11 @@ gfx::Point DesktopHostWin::QueryMouseLocation() { max(0, min(size.height(), static_cast<int>(pt.y)))); } +void DesktopHostWin::PostNativeEvent(const base::NativeEvent& native_event) { + ::PostMessage( + hwnd(), native_event.message, native_event.wParam, native_event.lParam); +} + void DesktopHostWin::OnClose() { // TODO: this obviously shouldn't be here. MessageLoopForUI::current()->Quit(); diff --git a/ui/aura/desktop_host_win.h b/ui/aura/desktop_host_win.h index 201f89f..9309d2b 100644 --- a/ui/aura/desktop_host_win.h +++ b/ui/aura/desktop_host_win.h @@ -29,6 +29,7 @@ class DesktopHostWin : public DesktopHost, public ui::WindowImpl { virtual void SetSize(const gfx::Size& size) OVERRIDE; virtual void SetCursor(gfx::NativeCursor cursor) OVERRIDE; virtual gfx::Point QueryMouseLocation() OVERRIDE; + virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; private: BEGIN_MSG_MAP_EX(DesktopHostWin) |