1// Copyright 2014 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef UI_DISPLAY_CHROMEOS_X11_DISPLAY_SNAPSHOT_X11_H_
6#define UI_DISPLAY_CHROMEOS_X11_DISPLAY_SNAPSHOT_X11_H_
7
8#include "ui/display/display_export.h"
9#include "ui/display/types/display_snapshot.h"
10
11// Forward declare from Xlib and Xrandr.
12typedef unsigned long XID;
13typedef XID RROutput;
14typedef XID RRCrtc;
15
16namespace ui {
17
18class DISPLAY_EXPORT DisplaySnapshotX11 : public DisplaySnapshot {
19 public:
20  DisplaySnapshotX11(int64_t display_id,
21                     bool has_proper_display_id,
22                     const gfx::Point& origin,
23                     const gfx::Size& physical_size,
24                     DisplayConnectionType type,
25                     bool is_aspect_preserving_scaling,
26                     bool has_overscan,
27                     std::string display_name,
28                     const std::vector<const DisplayMode*>& modes,
29                     const DisplayMode* current_mode,
30                     const DisplayMode* native_mode,
31                     RROutput output,
32                     RRCrtc crtc,
33                     int index);
34  virtual ~DisplaySnapshotX11();
35
36  RROutput output() const { return output_; }
37  RRCrtc crtc() const { return crtc_; }
38  int index() const { return index_; }
39
40  // DisplaySnapshot overrides:
41  virtual std::string ToString() const OVERRIDE;
42
43 private:
44  RROutput output_;
45
46  // CRTC that should be used for this output. Not necessarily the CRTC
47  // that XRandR reports is currently being used.
48  RRCrtc crtc_;
49
50  // This output's index in the array returned by XRandR. Stable even as
51  // outputs are connected or disconnected.
52  int index_;
53
54  DISALLOW_COPY_AND_ASSIGN(DisplaySnapshotX11);
55};
56
57}  // namespace ui
58
59#endif  // UI_DISPLAY_CHROMEOS_X11_DISPLAY_SNAPSHOT_X11_H_
60