27
#include <oif/frame_backend.h>
29
oif::frame::UFTouch* UFBackendTouch_::GetModifiableTouch() {
30
if (shared_ptr.unique()) {
31
return static_cast<oif::frame::UFTouch*>(shared_ptr.get());
33
/* Make a hard-copy. We don't want other holders of that UFTouch (like frames
34
from previous but still existing events) to get the changes about to be
35
made through this UFBackendTouch. */
36
oif::frame::UFTouch *old_touch =
37
static_cast<oif::frame::UFTouch*>(shared_ptr.get());
38
oif::frame::UFTouch *new_touch = new oif::frame::UFTouch(*old_touch);
39
shared_ptr.reset(new_touch);
48
: state_(UFTouchStateBegin) {
51
value = new Value(state_);
52
InsertProperty(UFTouchPropertyState, value);
30
55
UFTouch::UFTouch(UFTouchState state, UFTouchId id, float x, float y,
205
230
return start_time;
233
UFBackendTouch frame_backend_touch_new()
235
return new UFBackendTouch_(new oif::frame::UFTouch);
238
UFTouch frame_backend_touch_get_touch(UFBackendTouch touch)
240
return touch->shared_ptr.get();
243
void frame_backend_touch_set_id(UFBackendTouch touch_backend, UFTouchId id)
245
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
247
touch->InsertProperty(UFTouchPropertyId, new oif::frame::Value(id));
251
void frame_backend_touch_set_ended(UFBackendTouch touch_backend)
253
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
255
touch->InsertProperty(UFTouchPropertyState, new oif::frame::Value(UFTouchStateEnd));
256
touch->SetState(UFTouchStateEnd);
259
void frame_backend_touch_set_window_pos(UFBackendTouch touch_backend, float x, float y)
261
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
263
touch->InsertProperty(UFTouchPropertyWindowX, new oif::frame::Value(x));
264
touch->InsertProperty(UFTouchPropertyWindowY, new oif::frame::Value(y));
267
void frame_backend_touch_set_time(UFBackendTouch touch_backend, uint64_t time)
269
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
271
touch->InsertProperty(UFTouchPropertyTime, new oif::frame::Value(time));
274
void frame_backend_touch_set_start_time(UFBackendTouch touch_backend,
277
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
279
touch->InsertProperty(UFTouchPropertyStartTime, new oif::frame::Value(start_time));
282
void frame_backend_touch_set_owned(UFBackendTouch touch_backend, int owned)
284
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
286
touch->InsertProperty(UFTouchPropertyOwned, new oif::frame::Value(owned));
289
void frame_backend_touch_set_pending_end(UFBackendTouch touch_backend, int pending_end)
291
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
293
touch->InsertProperty(UFTouchPropertyPendingEnd, new oif::frame::Value(pending_end));
296
void frame_backend_touch_set_value(UFBackendTouch touch_backend,
297
UFAxisType type, float value)
299
oif::frame::UFTouch *touch = touch_backend->GetModifiableTouch();
301
touch->SetValue(type, value);