| OLD | NEW |
| 1 // Copyright (c) 2013 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 UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ | 5 #ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ |
| 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ | 6 #define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ |
| 7 | 7 |
| 8 #include "base/observer_list.h" | |
| 9 #include "base/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 10 #include "ui/events/platform/platform_event_dispatcher.h" | 9 #include "ui/events/platform/platform_event_dispatcher.h" |
| 11 #include "ui/gfx/screen.h" | 10 #include "ui/gfx/screen.h" |
| 11 #include "ui/gfx/screen_display_observer_delegate.h" |
| 12 #include "ui/views/views_export.h" | 12 #include "ui/views/views_export.h" |
| 13 | 13 |
| 14 namespace gfx { | 14 namespace gfx { |
| 15 class Display; | 15 class Display; |
| 16 } | 16 } |
| 17 | 17 |
| 18 typedef unsigned long XID; | 18 typedef unsigned long XID; |
| 19 typedef XID Window; | 19 typedef XID Window; |
| 20 typedef struct _XDisplay Display; | 20 typedef struct _XDisplay Display; |
| 21 | 21 |
| 22 namespace views { | 22 namespace views { |
| 23 class DesktopScreenX11Test; | 23 class DesktopScreenX11Test; |
| 24 | 24 |
| 25 // Our singleton screen implementation that talks to xrandr. | 25 // Our singleton screen implementation that talks to xrandr. |
| 26 class VIEWS_EXPORT DesktopScreenX11 : public gfx::Screen, | 26 class VIEWS_EXPORT DesktopScreenX11 : public gfx::Screen, |
| 27 public ui::PlatformEventDispatcher { | 27 public ui::PlatformEventDispatcher { |
| 28 public: | 28 public: |
| 29 DesktopScreenX11(); | 29 DesktopScreenX11(); |
| 30 | 30 |
| 31 virtual ~DesktopScreenX11(); | 31 virtual ~DesktopScreenX11(); |
| 32 | 32 |
| 33 // Takes a set of displays and dispatches the screen change events to | |
| 34 // listeners. Exposed for testing. | |
| 35 void ProcessDisplayChange(const std::vector<gfx::Display>& displays); | |
| 36 | |
| 37 // Overridden from gfx::Screen: | 33 // Overridden from gfx::Screen: |
| 38 virtual bool IsDIPEnabled() OVERRIDE; | 34 virtual bool IsDIPEnabled() OVERRIDE; |
| 39 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; | 35 virtual gfx::Point GetCursorScreenPoint() OVERRIDE; |
| 40 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; | 36 virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE; |
| 41 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) | 37 virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) |
| 42 OVERRIDE; | 38 OVERRIDE; |
| 43 virtual int GetNumDisplays() const OVERRIDE; | 39 virtual int GetNumDisplays() const OVERRIDE; |
| 44 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; | 40 virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE; |
| 45 virtual gfx::Display GetDisplayNearestWindow( | 41 virtual gfx::Display GetDisplayNearestWindow( |
| 46 gfx::NativeView window) const OVERRIDE; | 42 gfx::NativeView window) const OVERRIDE; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 79 // decoding events regarding output add/remove. | 75 // decoding events regarding output add/remove. |
| 80 int xrandr_event_base_; | 76 int xrandr_event_base_; |
| 81 | 77 |
| 82 // The display objects we present to chrome. | 78 // The display objects we present to chrome. |
| 83 std::vector<gfx::Display> displays_; | 79 std::vector<gfx::Display> displays_; |
| 84 | 80 |
| 85 // The timer to delay configuring outputs. See also the comments in | 81 // The timer to delay configuring outputs. See also the comments in |
| 86 // Dispatch(). | 82 // Dispatch(). |
| 87 scoped_ptr<base::OneShotTimer<DesktopScreenX11> > configure_timer_; | 83 scoped_ptr<base::OneShotTimer<DesktopScreenX11> > configure_timer_; |
| 88 | 84 |
| 89 ObserverList<gfx::DisplayObserver> observer_list_; | 85 ScreenDisplayObserverDelegate observer_delegate_; |
| 90 | 86 |
| 91 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); | 87 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); |
| 92 }; | 88 }; |
| 93 | 89 |
| 94 } // namespace views | 90 } // namespace views |
| 95 | 91 |
| 96 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ | 92 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ |
| OLD | NEW |