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

Unified Diff: ash/monitor/monitor_change_observer_x11.cc

Issue 9808010: Keep the mouse cursor within desktop (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 9 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
Index: ash/monitor/monitor_change_observer_x11.cc
diff --git a/ui/aura/monitor_change_observer_x11.cc b/ash/monitor/monitor_change_observer_x11.cc
similarity index 83%
rename from ui/aura/monitor_change_observer_x11.cc
rename to ash/monitor/monitor_change_observer_x11.cc
index 3dc0716509fd67e8b0bd1c45829b6ba024e04dfe..32c7cb54ad6e0becd88ea62697024ac331034c7a 100644
--- a/ui/aura/monitor_change_observer_x11.cc
+++ b/ash/monitor/monitor_change_observer_x11.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ui/aura/monitor_change_observer_x11.h"
+#include "ash/monitor/monitor_change_observer_x11.h"
#include <algorithm>
#include <map>
@@ -14,10 +14,15 @@
#include "base/message_pump_x.h"
#include "base/stl_util.h"
#include "ui/aura/env.h"
+#include "ui/aura/dispatcher_linux.h"
#include "ui/aura/monitor.h"
#include "ui/aura/monitor_manager.h"
-namespace aura {
+namespace ash {
+namespace internal {
+
+using aura::Monitor;
+
namespace {
XRRModeInfo* FindMode(XRRScreenResources* screen_resources, XID current_mode) {
for (int m = 0; m < screen_resources->nmode; m++) {
@@ -32,7 +37,7 @@ bool CompareMonitorY(const Monitor* lhs, const Monitor* rhs) {
return lhs->bounds().y() < rhs->bounds().y();
}
-} // namespace internal
+} // namespace
MonitorChangeObserverX11::MonitorChangeObserverX11()
: xdisplay_(base::MessagePumpX::GetDefaultXDisplay()),
@@ -42,21 +47,29 @@ MonitorChangeObserverX11::MonitorChangeObserverX11()
int error_base_ignored;
XRRQueryExtension(xdisplay_, &xrandr_event_base_, &error_base_ignored);
NotifyMonitorChange();
+
+ static_cast<aura::DispatcherLinux*>(
+ aura::Env::GetInstance()->GetDispatcher())->
+ WindowDispatcherCreated(x_root_window_, this);
}
MonitorChangeObserverX11::~MonitorChangeObserverX11() {
+ static_cast<aura::DispatcherLinux*>(
+ aura::Env::GetInstance()->GetDispatcher())->
+ WindowDispatcherDestroying(x_root_window_);
}
-bool MonitorChangeObserverX11::Dispatch(const XEvent* event) {
+base::MessagePumpDispatcher::DispatchStatus
+MonitorChangeObserverX11::Dispatch(XEvent* event) {
if (event->type - xrandr_event_base_ == RRScreenChangeNotify) {
NotifyMonitorChange();
- return true;
+ return base::MessagePumpDispatcher::EVENT_PROCESSED;
}
- return false;
+ return base::MessagePumpDispatcher::EVENT_IGNORED;
}
void MonitorChangeObserverX11::NotifyMonitorChange() {
- if (!MonitorManager::use_fullscreen_host_window())
+ if (!aura::MonitorManager::use_fullscreen_host_window())
return; // Use the default monitor that monitor manager determined.
XRRScreenResources* screen_resources =
@@ -114,4 +127,5 @@ void MonitorChangeObserverX11::NotifyMonitorChange() {
STLDeleteContainerPointers(monitors.begin(), monitors.end());
}
+} // namespace internal
} // namespace aura

Powered by Google App Engine
This is Rietveld 408576698