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