| 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_EVENT_DISPATCHER_X11_H_ | 5 #ifndef UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_ |
| 6 #define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_ | 6 #define UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_ |
| 7 | 7 |
| 8 #include "base/time/tick_clock.h" | 8 #include "base/time/tick_clock.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" | 10 #include "ui/display/chromeos/x11/native_display_delegate_x11.h" |
| 11 #include "ui/events/platform/platform_event_dispatcher.h" | 11 #include "ui/events/platform/platform_event_dispatcher.h" |
| 12 | 12 |
| 13 namespace ui { | 13 namespace ui { |
| 14 | 14 |
| 15 // The implementation is interested in the cases of RRNotify events which | 15 // The implementation is interested in the cases of RRNotify events which |
| 16 // correspond to output add/remove events. Note that Output add/remove events | 16 // correspond to output add/remove events. Note that Output add/remove events |
| 17 // are sent in response to our own reconfiguration operations so spurious events | 17 // are sent in response to our own reconfiguration operations so spurious events |
| 18 // are common. Spurious events will have no effect. | 18 // are common. Spurious events will have no effect. |
| 19 class DISPLAY_EXPORT NativeDisplayEventDispatcherX11 | 19 class DISPLAY_EXPORT NativeDisplayEventDispatcherX11 |
| 20 : public ui::PlatformEventDispatcher { | 20 : public ui::PlatformEventDispatcher { |
| 21 public: | 21 public: |
| 22 NativeDisplayEventDispatcherX11( | 22 NativeDisplayEventDispatcherX11( |
| 23 NativeDisplayDelegateX11::HelperDelegate* delegate, | 23 NativeDisplayDelegateX11::HelperDelegate* delegate, |
| 24 int xrandr_event_base); | 24 int xrandr_event_base); |
| 25 virtual ~NativeDisplayEventDispatcherX11(); | 25 virtual ~NativeDisplayEventDispatcherX11(); |
| 26 | 26 |
| 27 // ui::PlatformEventDispatcher: | 27 // ui::PlatformEventDispatcher: |
| 28 virtual bool CanDispatchEvent(const PlatformEvent& event) override; | 28 virtual bool CanDispatchEvent(const PlatformEvent& event) override; |
| 29 virtual uint32_t DispatchEvent(const PlatformEvent& event) override; | 29 virtual ui::PostDispatchAction DispatchEvent( |
| 30 const PlatformEvent& event) override; |
| 30 | 31 |
| 31 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); | 32 void SetTickClockForTest(scoped_ptr<base::TickClock> tick_clock); |
| 32 | 33 |
| 33 // How long the cached output is valid after startup. | 34 // How long the cached output is valid after startup. |
| 34 static const int kUseCacheAfterStartupMs; | 35 static const int kUseCacheAfterStartupMs; |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 NativeDisplayDelegateX11::HelperDelegate* delegate_; // Not owned. | 38 NativeDisplayDelegateX11::HelperDelegate* delegate_; // Not owned. |
| 38 | 39 |
| 39 // The base of the event numbers used to represent XRandr events used in | 40 // The base of the event numbers used to represent XRandr events used in |
| 40 // decoding events regarding output add/remove. | 41 // decoding events regarding output add/remove. |
| 41 int xrandr_event_base_; | 42 int xrandr_event_base_; |
| 42 | 43 |
| 43 base::TimeTicks startup_time_; | 44 base::TimeTicks startup_time_; |
| 44 | 45 |
| 45 scoped_ptr<base::TickClock> tick_clock_; | 46 scoped_ptr<base::TickClock> tick_clock_; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(NativeDisplayEventDispatcherX11); | 48 DISALLOW_COPY_AND_ASSIGN(NativeDisplayEventDispatcherX11); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 } // namespace ui | 51 } // namespace ui |
| 51 | 52 |
| 52 #endif // UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_ | 53 #endif // UI_DISPLAY_CHROMEOS_X11_NATIVE_DISPLAY_EVENT_DISPATCHER_X11_H_ |
| OLD | NEW |