| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ |
| 6 #define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ | 6 #define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
| 15 #include "base/event_types.h" | 15 #include "base/event_types.h" |
| 16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
| 17 #include "base/memory/scoped_vector.h" | 17 #include "base/memory/scoped_vector.h" |
| 18 #include "base/observer_list.h" | 18 #include "base/observer_list.h" |
| 19 #include "ui/display/display_export.h" | 19 #include "ui/display/display_export.h" |
| 20 #include "ui/display/types/native_display_delegate.h" | 20 #include "ui/display/types/native_display_delegate.h" |
| 21 #include "ui/gfx/geometry/point.h" | 21 #include "ui/gfx/geometry/point.h" |
| 22 #include "ui/gfx/geometry/size.h" | 22 #include "ui/gfx/geometry/size.h" |
| 23 #include "ui/gfx/x/x11_types.h" |
| 23 | 24 |
| 24 // Forward declarations for Xlib and Xrandr. | 25 // Forward declarations for Xlib and Xrandr. |
| 25 // This is so unused X definitions don't pollute the namespace. | 26 // This is so unused X definitions don't pollute the namespace. |
| 26 typedef unsigned long XID; | |
| 27 typedef XID RROutput; | 27 typedef XID RROutput; |
| 28 typedef XID RRCrtc; | 28 typedef XID RRCrtc; |
| 29 typedef XID RRMode; | 29 typedef XID RRMode; |
| 30 typedef XID Window; | 30 typedef XID Window; |
| 31 | 31 |
| 32 struct _XDisplay; | |
| 33 typedef struct _XDisplay Display; | |
| 34 struct _XRROutputInfo; | 32 struct _XRROutputInfo; |
| 35 typedef _XRROutputInfo XRROutputInfo; | 33 typedef _XRROutputInfo XRROutputInfo; |
| 36 struct _XRRScreenResources; | 34 struct _XRRScreenResources; |
| 37 typedef _XRRScreenResources XRRScreenResources; | 35 typedef _XRRScreenResources XRRScreenResources; |
| 38 struct _XRRCrtcGamma; | 36 struct _XRRCrtcGamma; |
| 39 typedef _XRRCrtcGamma XRRCrtcGamma; | 37 typedef _XRRCrtcGamma XRRCrtcGamma; |
| 40 | 38 |
| 39 extern "C" { |
| 40 void XRRFreeScreenResources(XRRScreenResources* resources); |
| 41 } |
| 42 |
| 41 namespace ui { | 43 namespace ui { |
| 42 | 44 |
| 43 class DisplayModeX11; | 45 class DisplayModeX11; |
| 44 class DisplaySnapshotX11; | 46 class DisplaySnapshotX11; |
| 45 class NativeDisplayEventDispatcherX11; | 47 class NativeDisplayEventDispatcherX11; |
| 46 | 48 |
| 47 class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { | 49 class DISPLAY_EXPORT NativeDisplayDelegateX11 : public NativeDisplayDelegate { |
| 48 public: | 50 public: |
| 49 // Helper class that allows NativeDisplayEventDispatcherX11 and | 51 // Helper class that allows NativeDisplayEventDispatcherX11 and |
| 50 // NativeDisplayDelegateX11::PlatformEventObserverX11 to interact with this | 52 // NativeDisplayDelegateX11::PlatformEventObserverX11 to interact with this |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 bool IsOutputAspectPreservingScaling(RROutput id); | 123 bool IsOutputAspectPreservingScaling(RROutput id); |
| 122 | 124 |
| 123 // Creates the gamma ramp for |new_profile|, or NULL if it doesn't exist. | 125 // Creates the gamma ramp for |new_profile|, or NULL if it doesn't exist. |
| 124 // The caller should take the ownership. | 126 // The caller should take the ownership. |
| 125 XRRCrtcGamma* CreateGammaRampForProfile( | 127 XRRCrtcGamma* CreateGammaRampForProfile( |
| 126 const DisplaySnapshotX11& x11_output, | 128 const DisplaySnapshotX11& x11_output, |
| 127 ColorCalibrationProfile new_profile); | 129 ColorCalibrationProfile new_profile); |
| 128 | 130 |
| 129 void DrawBackground(); | 131 void DrawBackground(); |
| 130 | 132 |
| 131 Display* display_; | 133 XDisplay* display_; |
| 132 Window window_; | 134 Window window_; |
| 133 | 135 |
| 134 // Initialized when the server is grabbed and freed when it's ungrabbed. | 136 // Initialized when the server is grabbed and freed when it's ungrabbed. |
| 135 XRRScreenResources* screen_; | 137 gfx::XScopedPtr< |
| 138 XRRScreenResources, |
| 139 gfx::XObjectDeleter<XRRScreenResources, void, XRRFreeScreenResources>> |
| 140 screen_; |
| 136 | 141 |
| 137 std::map<RRMode, DisplayModeX11*> modes_; | 142 std::map<RRMode, DisplayModeX11*> modes_; |
| 138 | 143 |
| 139 // Every time GetOutputs() is called we cache the updated list of outputs in | 144 // Every time GetOutputs() is called we cache the updated list of outputs in |
| 140 // |cached_outputs_| so that we can check for duplicate events rather than | 145 // |cached_outputs_| so that we can check for duplicate events rather than |
| 141 // propagate them. | 146 // propagate them. |
| 142 ScopedVector<DisplaySnapshot> cached_outputs_; | 147 ScopedVector<DisplaySnapshot> cached_outputs_; |
| 143 | 148 |
| 144 scoped_ptr<HelperDelegate> helper_delegate_; | 149 scoped_ptr<HelperDelegate> helper_delegate_; |
| 145 | 150 |
| 146 // Processes X11 display events associated with the root window and notifies | 151 // Processes X11 display events associated with the root window and notifies |
| 147 // |observers_| when a display change has occurred. | 152 // |observers_| when a display change has occurred. |
| 148 scoped_ptr<NativeDisplayEventDispatcherX11> platform_event_dispatcher_; | 153 scoped_ptr<NativeDisplayEventDispatcherX11> platform_event_dispatcher_; |
| 149 | 154 |
| 150 // List of observers waiting for display configuration change events. | 155 // List of observers waiting for display configuration change events. |
| 151 ObserverList<NativeDisplayObserver> observers_; | 156 ObserverList<NativeDisplayObserver> observers_; |
| 152 | 157 |
| 153 // A background color used during boot time + multi displays. | 158 // A background color used during boot time + multi displays. |
| 154 uint32_t background_color_argb_; | 159 uint32_t background_color_argb_; |
| 155 | 160 |
| 156 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateX11); | 161 DISALLOW_COPY_AND_ASSIGN(NativeDisplayDelegateX11); |
| 157 }; | 162 }; |
| 158 | 163 |
| 159 } // namespace ui | 164 } // namespace ui |
| 160 | 165 |
| 161 #endif // UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ | 166 #endif // UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_DELEGATE_X11_H_ |
| OLD | NEW |