1 /************************************************************************** 2 * 3 * Copyright (C) 2013 DENSO CORPORATION 4 * 5 * Licensed under the Apache License, Version 2.0 (the "License"); 6 * you may not use this file except in compliance with the License. 7 * You may obtain a copy of the License at 8 * 9 * http://www.apache.org/licenses/LICENSE-2.0 10 * 11 * Unless required by applicable law or agreed to in writing, software 12 * distributed under the License is distributed on an "AS IS" BASIS, 13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 * See the License for the specific language governing permissions and 15 * limitations under the License. 16 * 17 ****************************************************************************/ 18 #ifndef _ILM_CONTROL_PLATFORM_H_ 19 #define _ILM_CONTROL_PLATFORM_H_ 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif /* __cplusplus */ 24 25 #include <pthread.h> 26 #include <stdbool.h> 27 28 #include "ilm_common.h" 29 #include "wayland-util.h" 30 31 struct wayland_context { 32 struct wl_display *display; 33 struct wl_registry *registry; 34 struct wl_event_queue *queue; 35 struct wl_compositor *compositor; 36 37 struct ivi_wm *controller; 38 39 struct wl_list list_surface; 40 struct wl_list list_layer; 41 struct wl_list list_screen; 42 struct wl_list list_seat; 43 notificationFunc notification; 44 void *notification_user_data; 45 46 ilmErrorTypes error_flag; 47 48 struct ivi_input *input_controller; 49 }; 50 51 struct ilm_control_context { 52 struct wayland_context wl; 53 bool initialized; 54 55 uint32_t internal_id_layer; 56 57 pthread_t thread; 58 pthread_mutex_t mutex; 59 int shutdown_fd; 60 uint32_t internal_id_surface; 61 62 shutdownNotificationFunc notification; 63 void *notification_user_data; 64 }; 65 66 struct seat_context { 67 struct wl_list link; 68 char *seat_name; 69 ilmInputDevice capabilities; 70 }; 71 72 struct accepted_seat { 73 struct wl_list link; 74 char *seat_name; 75 }; 76 77 struct surface_context { 78 struct wl_list link; 79 80 t_ilm_uint id_surface; 81 struct ilmSurfaceProperties prop; 82 struct wl_list list_accepted_seats; 83 surfaceNotificationFunc notification; 84 85 struct wayland_context *ctx; 86 }; 87 88 ilmErrorTypes impl_sync_and_acquire_instance(struct ilm_control_context *ctx); 89 90 void release_instance(void); 91 92 #define sync_and_acquire_instance() ({ \ 93 struct ilm_control_context *ctx = &ilm_context; \ 94 { \ 95 ilmErrorTypes status = impl_sync_and_acquire_instance(ctx); \ 96 if (status != ILM_SUCCESS) { \ 97 return status; \ 98 } \ 99 } \ 100 ctx; \ 101 }) 102 103 #ifdef __cplusplus 104 } /**/ 105 #endif /* __cplusplus */ 106 107 #endif /* _ILM_CONTROL_PLATFORM_H_ */ 108