Commit 8f5209c8 authored by oshima@chromium.org's avatar oshima@chromium.org

Remove dispatcher when shutting down RootWindowController

Resurrecting PrepareForShutdown as it can be implemented onl in ash.

BUG=None

Review URL: https://codereview.chromium.org/294073006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@272308 0039d316-1c4b-4281-b951-d872f2087c98
parent 78cd68e0
......@@ -210,13 +210,6 @@ void MouseCursorEventFilter::OnDisplayConfigurationChanged() {
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) {
scale_when_drag_started_ = ui::GetDeviceScaleFactor(target->layer());
......
......@@ -235,12 +235,11 @@ gfx::Display ScreenAsh::GetDisplayNearestWindow(gfx::NativeView window) const {
if (!root_window)
return GetPrimaryDisplay();
const RootWindowSettings* rws = GetRootWindowSettings(root_window);
if (rws->shutdown)
return GetPrimaryDisplay();
int64 id = rws->display_id;
// if id is |kInvaildDisplayID|, it's being deleted.
DCHECK(id != gfx::Display::kInvalidDisplayID);
if (id == gfx::Display::kInvalidDisplayID)
return GetPrimaryDisplay();
DisplayManager* display_manager = GetDisplayManager();
// RootWindow needs Display to determine its device scale factor
......
......@@ -53,7 +53,10 @@ class ASH_EXPORT AshWindowTreeHost {
// mode dual monitors case). If the root window is only associated with one
// display id, then the other id should be set to
// gfx::Display::kInvalidDisplayID.
virtual void UpdateDisplayID(int64 id1, int64 id2) {};
virtual void UpdateDisplayID(int64 id1, int64 id2) {}
// Stop listening for events in preparation for shutdown.
virtual void PrepareForShutdown() {}
};
} // namespace ash
......
......@@ -19,9 +19,11 @@
#include "ui/aura/client/screen_position_client.h"
#include "ui/aura/env.h"
#include "ui/aura/window.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/base/x/x11_util.h"
#include "ui/events/event.h"
#include "ui/events/event_utils.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/x/device_data_manager.h"
#include "ui/events/x/device_list_cache_x.h"
#include "ui/events/x/touch_factory_x11.h"
......@@ -129,6 +131,11 @@ void AshWindowTreeHostX11::UpdateDisplayID(int64 id1, int64 id2) {
display_ids_.second = id2;
}
void AshWindowTreeHostX11::PrepareForShutdown() {
if (ui::PlatformEventSource::GetInstance())
ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
}
void AshWindowTreeHostX11::SetBounds(const gfx::Rect& bounds) {
WindowTreeHostX11::SetBounds(bounds);
if (pointer_barriers_) {
......
......@@ -33,6 +33,7 @@ class ASH_EXPORT AshWindowTreeHostX11 : public AshWindowTreeHost,
virtual gfx::Insets GetHostInsets() const OVERRIDE;
virtual aura::WindowTreeHost* AsWindowTreeHost() OVERRIDE;
virtual void UpdateDisplayID(int64 id1, int64 id2) OVERRIDE;
virtual void PrepareForShutdown() OVERRIDE;
// aura::WindowTreehost:
virtual void SetBounds(const gfx::Rect& bounds) OVERRIDE;
......
......@@ -423,7 +423,7 @@ void RootWindowController::Shutdown() {
// ends up with invalid display.
GetRootWindowSettings(root_window)->display_id =
gfx::Display::kInvalidDisplayID;
GetRootWindowSettings(root_window)->shutdown = true;
ash_host_->PrepareForShutdown();
system_background_.reset();
aura::client::SetScreenPositionClient(root_window, NULL);
......
......@@ -17,8 +17,7 @@ DEFINE_OWNED_WINDOW_PROPERTY_KEY(RootWindowSettings,
RootWindowSettings::RootWindowSettings()
: display_id(gfx::Display::kInvalidDisplayID),
controller(NULL),
shutdown(false) {
controller(NULL) {
}
RootWindowSettings* InitRootWindowSettings(aura::Window* root) {
......
......@@ -28,9 +28,6 @@ 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|.
......
......@@ -32,10 +32,7 @@ aura::Window* GetRootWindowMatching(const gfx::Rect& rect) {
}
void ConvertPointToScreen(const aura::Window* window, gfx::Point* point) {
// It is possible for the root window to not have a screen position client
// when switching multi-monitor mode from extended to mirror.
if (!aura::client::GetScreenPositionClient(window->GetRootWindow()))
return;
CHECK(aura::client::GetScreenPositionClient(window->GetRootWindow()));
aura::client::GetScreenPositionClient(window->GetRootWindow())->
ConvertPointToScreen(window, point);
}
......
......@@ -6,7 +6,6 @@
#include "ash/desktop_background/desktop_background_widget_controller.h"
#include "ash/root_window_controller.h"
#include "ash/root_window_settings.h"
#include "ui/aura/window_event_dispatcher.h"
#include "ui/compositor/layer.h"
#include "ui/views/widget/widget.h"
......@@ -28,10 +27,6 @@ RootWindowLayoutManager::~RootWindowLayoutManager() {
// RootWindowLayoutManager, aura::LayoutManager implementation:
void RootWindowLayoutManager::OnWindowResized() {
// X event may arrive during shutdown.
if (GetRootWindowSettings(owner_->GetRootWindow())->shutdown)
return;
gfx::Rect fullscreen_bounds =
gfx::Rect(owner_->bounds().width(), owner_->bounds().height());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment