summaryrefslogtreecommitdiffstats
path: root/ui/aura/monitor_change_observer_x11.h
blob: 416086043b3e9ff193999d933a7be946dad9b5b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_AURA_MONITOR_CHANGE_OBSERVER_X11_H
#define UI_AURA_MONITOR_CHANGE_OBSERVER_X11_H
#pragma once

#include <X11/Xlib.h>

// Xlib.h defines RootWindow.
#undef RootWindow

#include "base/basictypes.h"
#include "base/message_loop.h"

namespace aura {
namespace internal {

// An object that observes changes in monitor configuration and
// update MonitorManagers.
class MonitorChangeObserverX11 : public MessageLoop::Dispatcher {
 public:
  MonitorChangeObserverX11();
  virtual ~MonitorChangeObserverX11();

  // Overridden from Dispatcher overrides:
  virtual bool Dispatch(const base::NativeEvent& xev) OVERRIDE;

  // Reads display configurations from the system and notifies
  // |monitor_manager_| about the change.
  void NotifyDisplayChange();

 private:
  Display* xdisplay_;

  ::Window x_root_window_;

  int xrandr_event_base_;

  DISALLOW_COPY_AND_ASSIGN(MonitorChangeObserverX11);
};

}  // namespace internal
}  // namespace aura

#endif  // UI_AURA_MONITOR_CHANGE_OBSERVER_X11_H