| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef UI_AURA_MONITOR_CHANGE_OBSERVER_H | 5 #ifndef ASH_MONITOR_MONITOR_CHANGE_OBSERVER_X11_H |
| 6 #define UI_AURA_MONITOR_CHANGE_OBSERVER_H | 6 #define ASH_MONITOR_MONITOR_CHANGE_OBSERVER_X11_H |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <X11/Xlib.h> | 9 #include <X11/Xlib.h> |
| 10 | 10 |
| 11 // Xlib.h defines RootWindow. | 11 // Xlib.h defines RootWindow. |
| 12 #undef RootWindow | 12 #undef RootWindow |
| 13 | 13 |
| 14 #include "base/basictypes.h" | 14 #include "base/basictypes.h" |
| 15 #include "base/message_loop.h" |
| 15 #include "ui/aura/aura_export.h" | 16 #include "ui/aura/aura_export.h" |
| 16 | 17 |
| 17 namespace aura { | 18 namespace ash { |
| 19 namespace internal { |
| 18 | 20 |
| 19 // An object that observes changes in monitor configuration and | 21 // An object that observes changes in monitor configuration and |
| 20 // update MonitorManagers. | 22 // update MonitorManagers. |
| 21 class AURA_EXPORT MonitorChangeObserverX11 { | 23 class MonitorChangeObserverX11 : public MessageLoop::Dispatcher { |
| 22 public: | 24 public: |
| 23 MonitorChangeObserverX11(); | 25 MonitorChangeObserverX11(); |
| 24 ~MonitorChangeObserverX11(); | 26 ~MonitorChangeObserverX11(); |
| 25 | 27 |
| 26 bool Dispatch(const XEvent* event); | 28 // Overridden from Dispatcher overrides: |
| 29 virtual base::MessagePumpDispatcher::DispatchStatus Dispatch( |
| 30 XEvent* xev) OVERRIDE; |
| 27 | 31 |
| 28 // Reads monitor configurations from the system and notifies | 32 // Reads monitor configurations from the system and notifies |
| 29 // |monitor_manager_| about the change. | 33 // |monitor_manager_| about the change. |
| 30 void NotifyMonitorChange(); | 34 void NotifyMonitorChange(); |
| 31 | 35 |
| 32 private: | 36 private: |
| 33 Display* xdisplay_; | 37 Display* xdisplay_; |
| 34 | 38 |
| 35 ::Window x_root_window_; | 39 ::Window x_root_window_; |
| 36 | 40 |
| 37 int xrandr_event_base_; | 41 int xrandr_event_base_; |
| 38 | 42 |
| 39 DISALLOW_COPY_AND_ASSIGN(MonitorChangeObserverX11); | 43 DISALLOW_COPY_AND_ASSIGN(MonitorChangeObserverX11); |
| 40 }; | 44 }; |
| 41 | 45 |
| 46 } // namespace internal |
| 42 } // namespace aura | 47 } // namespace aura |
| 43 | 48 |
| 44 #endif // UI_AURA_MONITOR_CHANGE_OBSERVER_H | 49 #endif // ASH_MONITOR_MONITOR_CHANGE_OBSERVER_X11_H |
| OLD | NEW |