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 #include "ui/ozone/platform/caca/caca_event_factory.h" | 5 #include "ui/ozone/platform/caca/caca_event_factory.h" |
6 | 6 |
7 #include <caca.h> | 7 #include <caca.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
139 CacaEventFactory::CacaEventFactory(CacaConnection* connection) | 139 CacaEventFactory::CacaEventFactory(CacaConnection* connection) |
140 : connection_(connection), | 140 : connection_(connection), |
141 weak_ptr_factory_(this), | 141 weak_ptr_factory_(this), |
142 delay_(base::TimeDelta::FromMilliseconds(10)), | 142 delay_(base::TimeDelta::FromMilliseconds(10)), |
143 modifier_flags_(0) { | 143 modifier_flags_(0) { |
144 } | 144 } |
145 | 145 |
146 CacaEventFactory::~CacaEventFactory() { | 146 CacaEventFactory::~CacaEventFactory() { |
147 } | 147 } |
148 | 148 |
149 void CacaEventFactory::StartProcessingEvents() { | |
150 ScheduleEventProcessing(); | |
151 } | |
152 | |
153 void CacaEventFactory::WarpCursorTo(gfx::AcceleratedWidget widget, | 149 void CacaEventFactory::WarpCursorTo(gfx::AcceleratedWidget widget, |
154 const gfx::PointF& location) { | 150 const gfx::PointF& location) { |
155 NOTIMPLEMENTED(); | 151 NOTIMPLEMENTED(); |
156 } | 152 } |
157 | 153 |
| 154 void CacaEventFactory::OnDispatcherListChanged() { |
| 155 ScheduleEventProcessing(); |
| 156 } |
| 157 |
158 void CacaEventFactory::ScheduleEventProcessing() { | 158 void CacaEventFactory::ScheduleEventProcessing() { |
159 // Caca uses a poll based event retrieval. Since we don't want to block we'd | 159 // Caca uses a poll based event retrieval. Since we don't want to block we'd |
160 // either need to spin up a new thread or just poll. For simplicity just poll | 160 // either need to spin up a new thread or just poll. For simplicity just poll |
161 // for a message every |delay_| time delta. | 161 // for a message every |delay_| time delta. |
162 base::MessageLoop::current()->PostDelayedTask( | 162 base::MessageLoop::current()->PostDelayedTask( |
163 FROM_HERE, | 163 FROM_HERE, |
164 base::Bind(&CacaEventFactory::TryProcessingEvent, | 164 base::Bind(&CacaEventFactory::TryProcessingEvent, |
165 weak_ptr_factory_.GetWeakPtr()), | 165 weak_ptr_factory_.GetWeakPtr()), |
166 delay_); | 166 delay_); |
167 } | 167 } |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 default: | 223 default: |
224 NOTIMPLEMENTED(); | 224 NOTIMPLEMENTED(); |
225 break; | 225 break; |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 ScheduleEventProcessing(); | 229 ScheduleEventProcessing(); |
230 } | 230 } |
231 | 231 |
232 } // namespace ui | 232 } // namespace ui |
OLD | NEW |