diff options
24 files changed, 21 insertions, 53 deletions
diff --git a/ash/display/mouse_cursor_event_filter.cc b/ash/display/mouse_cursor_event_filter.cc index 3710d73..a91fc64 100644 --- a/ash/display/mouse_cursor_event_filter.cc +++ b/ash/display/mouse_cursor_event_filter.cc @@ -8,6 +8,7 @@ #include "ash/display/display_controller.h" #include "ash/display/display_manager.h" #include "ash/display/shared_display_edge_indicator.h" +#include "ash/root_window_controller.h" #include "ash/screen_util.h" #include "ash/shell.h" #include "ash/wm/coordinate_conversion.h" @@ -75,8 +76,16 @@ void MouseCursorEventFilter::HideSharedEdgeIndicator() { } void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { + aura::Window* target = static_cast<aura::Window*>(event->target()); + RootWindowController* rwc = GetRootWindowController(target->GetRootWindow()); + // The root window controller is removed during the shutting down + // RootWindow, so don't process events futher. + if (!rwc) { + event->StopPropagation(); + return; + } + if (event->type() == ui::ET_MOUSE_PRESSED) { - aura::Window* target = static_cast<aura::Window*>(event->target()); scale_when_drag_started_ = ui::GetDeviceScaleFactor(target->layer()); } else if (event->type() == ui::ET_MOUSE_RELEASED) { scale_when_drag_started_ = 1.0f; @@ -96,7 +105,6 @@ void MouseCursorEventFilter::OnMouseEvent(ui::MouseEvent* event) { } gfx::Point point_in_screen(event->location()); - aura::Window* target = static_cast<aura::Window*>(event->target()); wm::ConvertPointToScreen(target, &point_in_screen); if (WarpMouseCursorIfNecessary(target->GetRootWindow(), point_in_screen)) event->StopPropagation(); diff --git a/ash/display/screen_ash.cc b/ash/display/screen_ash.cc index 9bdb920..182557b 100644 --- a/ash/display/screen_ash.cc +++ b/ash/display/screen_ash.cc @@ -232,7 +232,11 @@ gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const { const aura::Window* root_window = window->GetRootWindow(); if (!root_window) return GetPrimaryDisplay(); - int64 id = internal::GetRootWindowSettings(root_window)->display_id; + const internal::RootWindowSettings* rws = + internal::GetRootWindowSettings(root_window); + if (rws->shutdown) + return gfx::Display(); + int64 id = rws->display_id; // if id is |kInvaildDisplayID|, it's being deleted. DCHECK(id != gfx::Display::kInvalidDisplayID); diff --git a/ash/root_window_controller.cc b/ash/root_window_controller.cc index 3982ad7..ba8eb3f 100644 --- a/ash/root_window_controller.cc +++ b/ash/root_window_controller.cc @@ -354,8 +354,7 @@ void RootWindowController::Shutdown() { // ends up with invalid display. internal::GetRootWindowSettings(root_window())->display_id = gfx::Display::kInvalidDisplayID; - // And this root window should no longer process events. - host()->dispatcher()->PrepareForShutdown(); + internal::GetRootWindowSettings(root_window())->shutdown = true; system_background_.reset(); aura::client::SetScreenPositionClient(root_window(), NULL); diff --git a/ash/root_window_settings.cc b/ash/root_window_settings.cc index f3df896..9f51bd9 100644 --- a/ash/root_window_settings.cc +++ b/ash/root_window_settings.cc @@ -18,7 +18,8 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(RootWindowSettings, RootWindowSettings::RootWindowSettings() : display_id(gfx::Display::kInvalidDisplayID), - controller(NULL) { + controller(NULL), + shutdown(false) { } RootWindowSettings* InitRootWindowSettings(aura::Window* root) { diff --git a/ash/root_window_settings.h b/ash/root_window_settings.h index f187949..3f497fc 100644 --- a/ash/root_window_settings.h +++ b/ash/root_window_settings.h @@ -29,6 +29,9 @@ struct RootWindowSettings { // RootWindowController for the root window. This may be NULL // for the root window used for mirroring. RootWindowController* controller; + + // True if the root window has already been shutdown. + bool shutdown; }; // Initializes and returns RootWindowSettings for |root|. diff --git a/mojo/examples/aura_demo/window_tree_host_mojo.cc b/mojo/examples/aura_demo/window_tree_host_mojo.cc index 815cce66..b032323 100644 --- a/mojo/examples/aura_demo/window_tree_host_mojo.cc +++ b/mojo/examples/aura_demo/window_tree_host_mojo.cc @@ -128,10 +128,6 @@ void WindowTreeHostMojo::OnDeviceScaleFactorChanged(float device_scale_factor) { NOTIMPLEMENTED(); } -void WindowTreeHostMojo::PrepareForShutdown() { - NOTIMPLEMENTED(); -} - void WindowTreeHostMojo::SetCursorNative(gfx::NativeCursor cursor) { NOTIMPLEMENTED(); } diff --git a/mojo/examples/aura_demo/window_tree_host_mojo.h b/mojo/examples/aura_demo/window_tree_host_mojo.h index fd146d2..79dd9db3 100644 --- a/mojo/examples/aura_demo/window_tree_host_mojo.h +++ b/mojo/examples/aura_demo/window_tree_host_mojo.h @@ -49,7 +49,6 @@ class WindowTreeHostMojo : public aura::WindowTreeHost, virtual void UnConfineCursor() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; diff --git a/ui/aura/remote_window_tree_host_win.cc b/ui/aura/remote_window_tree_host_win.cc index 17ef1b2..19715ba 100644 --- a/ui/aura/remote_window_tree_host_win.cc +++ b/ui/aura/remote_window_tree_host_win.cc @@ -485,9 +485,6 @@ void RemoteWindowTreeHostWin::OnDeviceScaleFactorChanged( NOTIMPLEMENTED(); } -void RemoteWindowTreeHostWin::PrepareForShutdown() { -} - ui::EventProcessor* RemoteWindowTreeHostWin::GetEventProcessor() { return dispatcher(); } diff --git a/ui/aura/remote_window_tree_host_win.h b/ui/aura/remote_window_tree_host_win.h index ab03b26..c873963 100644 --- a/ui/aura/remote_window_tree_host_win.h +++ b/ui/aura/remote_window_tree_host_win.h @@ -232,7 +232,6 @@ class AURA_EXPORT RemoteWindowTreeHostWin virtual void UnConfineCursor() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; diff --git a/ui/aura/window_event_dispatcher.cc b/ui/aura/window_event_dispatcher.cc index 22471b4..82d1ef6 100644 --- a/ui/aura/window_event_dispatcher.cc +++ b/ui/aura/window_event_dispatcher.cc @@ -92,12 +92,6 @@ WindowEventDispatcher::~WindowEventDispatcher() { ui::GestureRecognizer::Get()->RemoveGestureEventHelper(this); } -void WindowEventDispatcher::PrepareForShutdown() { - host_->PrepareForShutdown(); - // discard synthesize event request as well. - synthesize_mouse_move_ = false; -} - void WindowEventDispatcher::RepostEvent(const ui::LocatedEvent& event) { DCHECK(event.type() == ui::ET_MOUSE_PRESSED || event.type() == ui::ET_GESTURE_TAP_DOWN); diff --git a/ui/aura/window_event_dispatcher.h b/ui/aura/window_event_dispatcher.h index 7ea3d60..2130774 100644 --- a/ui/aura/window_event_dispatcher.h +++ b/ui/aura/window_event_dispatcher.h @@ -65,9 +65,6 @@ class AURA_EXPORT WindowEventDispatcher : public ui::EventProcessor, Window* mouse_pressed_handler() { return mouse_pressed_handler_; } Window* mouse_moved_handler() { return mouse_moved_handler_; } - // Stop listening events in preparation for shutdown. - void PrepareForShutdown(); - // Repost event for re-processing. Used when exiting context menus. // We only support the ET_MOUSE_PRESSED and ET_GESTURE_TAP_DOWN event // types (although the latter is currently a no-op). diff --git a/ui/aura/window_tree_host.h b/ui/aura/window_tree_host.h index 3986453..ca4a164 100644 --- a/ui/aura/window_tree_host.h +++ b/ui/aura/window_tree_host.h @@ -163,9 +163,6 @@ class AURA_EXPORT WindowTreeHost { // Called when the device scale factor of the root window has chagned. virtual void OnDeviceScaleFactorChanged(float device_scale_factor) = 0; - // Stop listening events in preparation for shutdown. - virtual void PrepareForShutdown() = 0; - protected: friend class TestScreen; // TODO(beng): see if we can remove/consolidate. diff --git a/ui/aura/window_tree_host_mac.h b/ui/aura/window_tree_host_mac.h index cdce4db..8650981 100644 --- a/ui/aura/window_tree_host_mac.h +++ b/ui/aura/window_tree_host_mac.h @@ -49,7 +49,6 @@ class AURA_EXPORT WindowTreeHostMac : public WindowTreeHost { virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; private: base::scoped_nsobject<NSWindow> window_; diff --git a/ui/aura/window_tree_host_mac.mm b/ui/aura/window_tree_host_mac.mm index e75875b..dbfa8bb 100644 --- a/ui/aura/window_tree_host_mac.mm +++ b/ui/aura/window_tree_host_mac.mm @@ -100,10 +100,6 @@ void WindowTreeHostMac::OnDeviceScaleFactorChanged(float device_scale_factor) { NOTIMPLEMENTED(); } -void WindowTreeHostMac::PrepareForShutdown() { - NOTIMPLEMENTED(); -} - // static WindowTreeHost* WindowTreeHost::Create(const gfx::Rect& bounds) { return new WindowTreeHostMac(bounds); diff --git a/ui/aura/window_tree_host_ozone.cc b/ui/aura/window_tree_host_ozone.cc index cb3ddb9..cec4708 100644 --- a/ui/aura/window_tree_host_ozone.cc +++ b/ui/aura/window_tree_host_ozone.cc @@ -96,8 +96,6 @@ void WindowTreeHostOzone::OnDeviceScaleFactorChanged( NOTIMPLEMENTED(); } -void WindowTreeHostOzone::PrepareForShutdown() { NOTIMPLEMENTED(); } - void WindowTreeHostOzone::SetCursorNative(gfx::NativeCursor cursor) { ui::CursorFactoryOzone::GetInstance()->SetCursor(GetAcceleratedWidget(), cursor.platform()); diff --git a/ui/aura/window_tree_host_ozone.h b/ui/aura/window_tree_host_ozone.h index 4f4c709..dadae63c 100644 --- a/ui/aura/window_tree_host_ozone.h +++ b/ui/aura/window_tree_host_ozone.h @@ -44,7 +44,6 @@ class WindowTreeHostOzone : public WindowTreeHost, virtual void UnConfineCursor() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; diff --git a/ui/aura/window_tree_host_win.cc b/ui/aura/window_tree_host_win.cc index d20d2ce..28bd77d 100644 --- a/ui/aura/window_tree_host_win.cc +++ b/ui/aura/window_tree_host_win.cc @@ -225,10 +225,6 @@ void WindowTreeHostWin::OnDeviceScaleFactorChanged( NOTIMPLEMENTED(); } -void WindowTreeHostWin::PrepareForShutdown() { - NOTIMPLEMENTED(); -} - ui::EventProcessor* WindowTreeHostWin::GetEventProcessor() { return dispatcher(); } diff --git a/ui/aura/window_tree_host_win.h b/ui/aura/window_tree_host_win.h index 4c8d4ce..1d2f256 100644 --- a/ui/aura/window_tree_host_win.h +++ b/ui/aura/window_tree_host_win.h @@ -39,7 +39,6 @@ class WindowTreeHostWin : public WindowTreeHost, virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; // ui::EventSource: virtual ui::EventProcessor* GetEventProcessor() OVERRIDE; diff --git a/ui/aura/window_tree_host_x11.cc b/ui/aura/window_tree_host_x11.cc index efb0a6b..4048a5d 100644 --- a/ui/aura/window_tree_host_x11.cc +++ b/ui/aura/window_tree_host_x11.cc @@ -699,10 +699,6 @@ void WindowTreeHostX11::OnDeviceScaleFactorChanged( float device_scale_factor) { } -void WindowTreeHostX11::PrepareForShutdown() { - base::MessagePumpX11::Current()->RemoveDispatcherForWindow(xwindow_); -} - void WindowTreeHostX11::SetCursorNative(gfx::NativeCursor cursor) { if (cursor == current_cursor_) return; diff --git a/ui/aura/window_tree_host_x11.h b/ui/aura/window_tree_host_x11.h index 4ba1b46..a54b3903 100644 --- a/ui/aura/window_tree_host_x11.h +++ b/ui/aura/window_tree_host_x11.h @@ -61,7 +61,6 @@ class AURA_EXPORT WindowTreeHostX11 : public WindowTreeHost, virtual void UnConfineCursor() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; virtual void SetCursorNative(gfx::NativeCursor cursor_type) OVERRIDE; virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc index bbf72fe..47bd630 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.cc @@ -551,9 +551,6 @@ void DesktopWindowTreeHostWin::OnDeviceScaleFactorChanged( float device_scale_factor) { } -void DesktopWindowTreeHostWin::PrepareForShutdown() { -} - void DesktopWindowTreeHostWin::SetCursorNative(gfx::NativeCursor cursor) { ui::CursorLoaderWin cursor_loader; cursor_loader.SetPlatformCursor(&cursor); diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h index 8e67548..a510ed3 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_win.h @@ -122,7 +122,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostWin virtual void UnConfineCursor() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc index 1060282c..41b4b50 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc @@ -903,9 +903,6 @@ void DesktopWindowTreeHostX11::OnDeviceScaleFactorChanged( float device_scale_factor) { } -void DesktopWindowTreeHostX11::PrepareForShutdown() { -} - //////////////////////////////////////////////////////////////////////////////// // DesktopWindowTreeHostX11, ui::EventSource implementation: diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h index 53406d9..1537a69 100644 --- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h +++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h @@ -145,7 +145,6 @@ class VIEWS_EXPORT DesktopWindowTreeHostX11 : virtual void UnConfineCursor() OVERRIDE; virtual void PostNativeEvent(const base::NativeEvent& native_event) OVERRIDE; virtual void OnDeviceScaleFactorChanged(float device_scale_factor) OVERRIDE; - virtual void PrepareForShutdown() OVERRIDE; virtual void SetCursorNative(gfx::NativeCursor cursor) OVERRIDE; virtual void MoveCursorToNative(const gfx::Point& location) OVERRIDE; virtual void OnCursorVisibilityChangedNative(bool show) OVERRIDE; |