| 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_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_ | 5 #ifndef UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_ |
| 6 #define UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_ | 6 #define UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_ |
| 7 | 7 |
| 8 #include <caca.h> |
| 9 |
| 8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| 9 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 10 #include "ui/events/platform/platform_event_source.h" | 12 #include "ui/events/platform/platform_event_source.h" |
| 13 #include "ui/events/platform/scoped_event_dispatcher.h" |
| 11 #include "ui/gfx/geometry/point_f.h" | 14 #include "ui/gfx/geometry/point_f.h" |
| 12 #include "ui/ozone/public/event_factory_ozone.h" | 15 #include "ui/ozone/public/event_factory_ozone.h" |
| 13 | 16 |
| 14 namespace ui { | 17 namespace ui { |
| 15 | 18 |
| 16 class CacaConnection; | 19 class CacaWindow; |
| 17 | 20 |
| 18 class CacaEventFactory : public EventFactoryOzone, | 21 class CacaEventFactory : public EventFactoryOzone, |
| 19 public PlatformEventSource { | 22 public PlatformEventSource { |
| 20 public: | 23 public: |
| 21 CacaEventFactory(CacaConnection* connection); | 24 CacaEventFactory(); |
| 22 virtual ~CacaEventFactory(); | 25 virtual ~CacaEventFactory(); |
| 23 | 26 |
| 24 // ui::EventFactoryOzone: | 27 // ui::EventFactoryOzone: |
| 25 virtual void WarpCursorTo(gfx::AcceleratedWidget widget, | 28 virtual void WarpCursorTo(gfx::AcceleratedWidget widget, |
| 26 const gfx::PointF& location) OVERRIDE; | 29 const gfx::PointF& location) OVERRIDE; |
| 27 | 30 |
| 31 // Poll for an event on a particular window. Input events will be |
| 32 // dispatched on the given dispatcher. |
| 33 void TryProcessingEvent(CacaWindow* window, |
| 34 PlatformEventDispatcher* dispatcher); |
| 35 |
| 36 // Process an input event on a particular window. |
| 37 void OnInputEvent(caca_event_t* event, CacaWindow* window); |
| 38 |
| 28 private: | 39 private: |
| 29 // PlatformEventSource: | |
| 30 virtual void OnDispatcherListChanged() OVERRIDE; | |
| 31 | |
| 32 void ScheduleEventProcessing(); | |
| 33 | |
| 34 void TryProcessingEvent(); | |
| 35 | |
| 36 CacaConnection* connection_; // Not owned. | |
| 37 | |
| 38 base::WeakPtrFactory<CacaEventFactory> weak_ptr_factory_; | |
| 39 | |
| 40 // Delay between event polls. | |
| 41 base::TimeDelta delay_; | |
| 42 | |
| 43 // Keep track of last cursor position to dispatch correct mouse push/release | 40 // Keep track of last cursor position to dispatch correct mouse push/release |
| 44 // events. | 41 // events. |
| 45 gfx::PointF last_cursor_location_; | 42 gfx::PointF last_cursor_location_; |
| 46 | 43 |
| 47 int modifier_flags_; | 44 int modifier_flags_; |
| 48 | 45 |
| 49 DISALLOW_COPY_AND_ASSIGN(CacaEventFactory); | 46 DISALLOW_COPY_AND_ASSIGN(CacaEventFactory); |
| 50 }; | 47 }; |
| 51 | 48 |
| 52 } // namespace ui | 49 } // namespace ui |
| 53 | 50 |
| 54 #endif // UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_ | 51 #endif // UI_OZONE_PLATFORM_CACA_CACA_EVENT_FACTORY_H_ |
| OLD | NEW |