1
/*****************************************************************************
3
* utouch-frame - Touch Frame Library
5
* Copyright (C) 2011 Canonical Ltd.
7
* This program is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation, either version 3 of the License, or (at your
10
* option) any later version.
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
17
* You should have received a copy of the GNU General Public License along
18
* with this program. If not, see <http://www.gnu.org/licenses/>.
20
****************************************************************************/
30
UFEvent::UFEvent(UFEventType type, const Value* data, uint64_t time)
34
value = new Value(type);
35
InsertProperty(UFEventPropertyType, value);
38
case UFEventTypeDeviceAdded:
39
case UFEventTypeDeviceRemoved:
40
InsertProperty(UFEventPropertyDevice, data);
43
case UFEventTypeFrame:
44
InsertProperty(UFEventPropertyFrame, data);
48
value = new Value(time);
49
InsertProperty(UFEventPropertyTime, value);
56
void UFEvent::Unref() {
65
if (GetProperty(UFEventPropertyFrame, &frame) == UFStatusSuccess)
66
static_cast<utouch::frame::UFFrame*>(frame)->ReleasePreviousFrame();
74
void frame_event_ref(UFEvent event) {
75
static_cast<utouch::frame::UFEvent*>(event)->Ref();
78
void frame_event_unref(UFEvent event) {
79
static_cast<utouch::frame::UFEvent*>(event)->Unref();
82
UFStatus frame_event_get_property(UFEvent event, UFEventProperty property,
84
return static_cast<const utouch::frame::UFEvent*>(event)->GetProperty(property,
88
UFEventType frame_event_get_type(UFEvent event) {
90
const utouch::frame::UFEvent* ufevent =
91
static_cast<const utouch::frame::UFEvent*>(event);
92
UFStatus status = ufevent->GetProperty(UFEventPropertyType, &type);
93
assert(status == UFStatusSuccess);
97
uint64_t frame_event_get_time(UFEvent event) {
99
const utouch::frame::UFEvent* ufevent =
100
static_cast<const utouch::frame::UFEvent*>(event);
101
UFStatus status = ufevent->GetProperty(UFEventPropertyTime, &time);
102
assert(status == UFStatusSuccess);