| 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/timer/timer.h" | 8 #include "base/timer/timer.h" |
| 9 #include "ui/events/platform/platform_event_dispatcher.h" | 9 #include "ui/events/platform/platform_event_dispatcher.h" |
| 10 #include "ui/gfx/display_change_notifier.h" | 10 #include "ui/gfx/display_change_notifier.h" |
| 11 #include "ui/gfx/screen.h" | 11 #include "ui/gfx/screen.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 namespace test { |
| 26 class DesktopScreenX11TestApi; |
| 27 } |
| 28 |
| 25 // Our singleton screen implementation that talks to xrandr. | 29 // Our singleton screen implementation that talks to xrandr. |
| 26 class VIEWS_EXPORT DesktopScreenX11 : public gfx::Screen, | 30 class VIEWS_EXPORT DesktopScreenX11 : public gfx::Screen, |
| 27 public ui::PlatformEventDispatcher { | 31 public ui::PlatformEventDispatcher { |
| 28 public: | 32 public: |
| 29 DesktopScreenX11(); | 33 DesktopScreenX11(); |
| 30 | 34 |
| 31 ~DesktopScreenX11() override; | 35 ~DesktopScreenX11() override; |
| 32 | 36 |
| 33 // Overridden from gfx::Screen: | 37 // Overridden from gfx::Screen: |
| 34 gfx::Point GetCursorScreenPoint() override; | 38 gfx::Point GetCursorScreenPoint() override; |
| 35 gfx::NativeWindow GetWindowUnderCursor() override; | 39 gfx::NativeWindow GetWindowUnderCursor() override; |
| 36 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; | 40 gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) override; |
| 37 int GetNumDisplays() const override; | 41 int GetNumDisplays() const override; |
| 38 std::vector<gfx::Display> GetAllDisplays() const override; | 42 std::vector<gfx::Display> GetAllDisplays() const override; |
| 39 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override; | 43 gfx::Display GetDisplayNearestWindow(gfx::NativeView window) const override; |
| 40 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; | 44 gfx::Display GetDisplayNearestPoint(const gfx::Point& point) const override; |
| 41 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; | 45 gfx::Display GetDisplayMatching(const gfx::Rect& match_rect) const override; |
| 42 gfx::Display GetPrimaryDisplay() const override; | 46 gfx::Display GetPrimaryDisplay() const override; |
| 43 void AddObserver(gfx::DisplayObserver* observer) override; | 47 void AddObserver(gfx::DisplayObserver* observer) override; |
| 44 void RemoveObserver(gfx::DisplayObserver* observer) override; | 48 void RemoveObserver(gfx::DisplayObserver* observer) override; |
| 45 | 49 |
| 46 // ui::PlatformEventDispatcher: | 50 // ui::PlatformEventDispatcher: |
| 47 bool CanDispatchEvent(const ui::PlatformEvent& event) override; | 51 bool CanDispatchEvent(const ui::PlatformEvent& event) override; |
| 48 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; | 52 uint32_t DispatchEvent(const ui::PlatformEvent& event) override; |
| 49 | 53 |
| 50 static void UpdateDeviceScaleFactorForTest(); | |
| 51 | |
| 52 private: | 54 private: |
| 53 friend class DesktopScreenX11Test; | 55 friend class DesktopScreenX11Test; |
| 56 friend class test::DesktopScreenX11TestApi; |
| 54 | 57 |
| 55 // Constructor used in tests. | 58 // Constructor used in tests. |
| 56 DesktopScreenX11(const std::vector<gfx::Display>& test_displays); | 59 DesktopScreenX11(const std::vector<gfx::Display>& test_displays); |
| 57 | 60 |
| 58 // Builds a list of displays from the current screen information offered by | 61 // Builds a list of displays from the current screen information offered by |
| 59 // the X server. | 62 // the X server. |
| 60 std::vector<gfx::Display> BuildDisplaysFromXRandRInfo(); | 63 std::vector<gfx::Display> BuildDisplaysFromXRandRInfo(); |
| 61 | 64 |
| 62 // We delay updating the display so we can coalesce events. | 65 // We delay updating the display so we can coalesce events. |
| 63 void ConfigureTimerFired(); | 66 void ConfigureTimerFired(); |
| (...skipping 16 matching lines...) Expand all Loading... |
| 80 scoped_ptr<base::OneShotTimer> configure_timer_; | 83 scoped_ptr<base::OneShotTimer> configure_timer_; |
| 81 | 84 |
| 82 gfx::DisplayChangeNotifier change_notifier_; | 85 gfx::DisplayChangeNotifier change_notifier_; |
| 83 | 86 |
| 84 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); | 87 DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11); |
| 85 }; | 88 }; |
| 86 | 89 |
| 87 } // namespace views | 90 } // namespace views |
| 88 | 91 |
| 89 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ | 92 #endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_SCREEN_X11_H_ |
| OLD | NEW |