| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_X11_H | 5 #ifndef ASH_DISPLAY_DISPLAY_UTIL_X11_H_ |
| 6 #define ASH_DISPLAY_DISPLAY_CHANGE_OBSERVER_X11_H | 6 #define ASH_DISPLAY_DISPLAY_UTIL_X11_H_ |
| 7 | 7 |
| 8 #include <X11/Xlib.h> | 8 #include <vector> |
| 9 | |
| 10 // Xlib.h defines RootWindow. | |
| 11 #undef RootWindow | |
| 12 | 9 |
| 13 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 14 #include "ash/shell_observer.h" | 11 #include "ash/display/display_info.h" |
| 15 #include "base/basictypes.h" | 12 |
| 16 #include "chromeos/display/output_configurator.h" | 13 struct _XRRScreenResources; |
| 14 typedef _XRRScreenResources XRRScreenResources; |
| 15 struct _XRROutputInfo; |
| 16 typedef _XRROutputInfo XRROutputInfo; |
| 17 | 17 |
| 18 namespace ash { | 18 namespace ash { |
| 19 namespace internal { | 19 namespace internal { |
| 20 | 20 struct Resolution; |
| 21 // An object that observes changes in display configuration and | |
| 22 // update DisplayManagers. | |
| 23 class DisplayChangeObserverX11 | |
| 24 : public chromeos::OutputConfigurator::StateController, | |
| 25 public chromeos::OutputConfigurator::Observer, | |
| 26 public ShellObserver { | |
| 27 public: | |
| 28 DisplayChangeObserverX11(); | |
| 29 virtual ~DisplayChangeObserverX11(); | |
| 30 | |
| 31 // chromeos::OutputConfigurator::StateController overrides: | |
| 32 virtual chromeos::OutputState GetStateForDisplayIds( | |
| 33 const std::vector<int64>& outputs) const OVERRIDE; | |
| 34 | |
| 35 // Overriden from chromeos::OutputConfigurator::Observer: | |
| 36 virtual void OnDisplayModeChanged() OVERRIDE; | |
| 37 | |
| 38 // Overriden from ShellObserver: | |
| 39 virtual void OnAppTerminating() OVERRIDE; | |
| 40 | |
| 41 private: | |
| 42 Display* xdisplay_; | |
| 43 | |
| 44 ::Window x_root_window_; | |
| 45 | |
| 46 int xrandr_event_base_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(DisplayChangeObserverX11); | |
| 49 }; | |
| 50 | 21 |
| 51 // Returns true if the size info in the output_info isn't valid | 22 // Returns true if the size info in the output_info isn't valid |
| 52 // and should be ignored. This is exposed for testing. | 23 // and should be ignored. This is exposed for testing. |
| 53 // |mm_width| and |mm_height| are given in millimeters. | 24 // |mm_width| and |mm_height| are given in millimeters. |
| 54 ASH_EXPORT bool ShouldIgnoreSize(unsigned long mm_width, | 25 ASH_EXPORT bool ShouldIgnoreSize(unsigned long mm_width, |
| 55 unsigned long mm_height); | 26 unsigned long mm_height); |
| 56 | 27 |
| 28 // Returns the resolution list. |
| 29 ASH_EXPORT std::vector<Resolution> GetResolutionList( |
| 30 XRRScreenResources* screen_resources, |
| 31 XRROutputInfo* output_info); |
| 32 |
| 57 } // namespace internal | 33 } // namespace internal |
| 58 } // namespace ash | 34 } // namespace ash |
| 59 | 35 |
| 60 #endif // ASH_DISPLAY_AURA_DISPLAY_CHANGE_OBSERVER_X11_H | 36 #endif // ASH_DISPLAY_DISPLAY_UTIL_X11_H_ |
| OLD | NEW |