2 * Copyright (C) 2013 Canonical Ltd
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 * Authored by: Thomas Voß <thomas.voss@canonical.com>
17 * Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
20 #include <hybris/input/input_stack_compatibility_layer.h>
22 #include <gtest/gtest.h>
23 #include <utils/threads.h>
32 void signal_handler(int)
37 void on_new_event(Event
* event
, void* context
)
39 printf("%s", __PRETTY_FUNCTION__
);
41 printf("\tEventType: %d \n", event
->type
);
42 printf("\tdevice_id: %d \n", event
->device_id
);
43 printf("\tsource_id: %d \n", event
->source_id
);
44 printf("\taction: %d \n", event
->action
);
45 printf("\tflags: %d \n", event
->flags
);
46 printf("\tmeta_state: %d \n", event
->meta_state
);
48 switch (event
->type
) {
49 case MOTION_EVENT_TYPE
:
50 printf("\tdetails.motion.event_time: %lld\n",
51 event
->details
.motion
.event_time
);
52 printf("\tdetails.motion.pointer_coords.x: %f\n",
53 event
->details
.motion
.pointer_coordinates
[0].x
);
54 printf("\tdetails.motion.pointer_coords.y: %f\n",
55 event
->details
.motion
.pointer_coordinates
[0].y
);
64 int main(int argc
, char** argv
)
67 signal(SIGINT
, signal_handler
);
69 AndroidEventListener listener
;
70 listener
.on_new_event
= on_new_event
;
71 listener
.context
= NULL
;
73 InputStackConfiguration config
= {
74 enable_touch_point_visualization
: true,
75 default_layer_for_touch_point_visualization
: 10000,
76 input_area_width
: 1024,
77 input_area_height
: 1024
80 android_input_stack_initialize(&listener
, &config
);
81 android_input_stack_start_waiting_for_flag(&g_stop
);
83 android_input_stack_stop();
84 android_input_stack_shutdown();