1 /*
2 * Copyright (C) 2017 Advanced Driver Information Technology Joint Venture GmbH
3 *
4 * Permission to use, copy, modify, distribute, and sell this software and
5 * its documentation for any purpose is hereby granted without fee, provided
6 * that the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of the copyright holders not be used in
9 * advertising or publicity pertaining to distribution of the software
10 * without specific, written prior permission. The copyright holders make
11 * no representations about the suitability of this software for any
12 * purpose. It is provided "as is" without express or implied warranty.
13 *
14 * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
15 * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
16 * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
17 * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
18 * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
19 * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
20 * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 */
22
23 #ifndef WESTON_IVI_SHELL_SRC_IVI_CONTROLLER_H_
24 #define WESTON_IVI_SHELL_SRC_IVI_CONTROLLER_H_
25
26 #include "ivi-wm-server-protocol.h"
27 #include <ivi-layout-export.h>
28
29 /* Convert timespec to milliseconds
30 *
31 * \param a timespec
32 * \return milliseconds
33 *
34 * Rounding to integer milliseconds happens always down (floor()).
35 */
36 static inline int64_t
timespec_to_msec(const struct timespec * a)37 timespec_to_msec(const struct timespec *a)
38 {
39 return (int64_t)a->tv_sec * 1000 + a->tv_nsec / 1000000;
40 }
41
42 struct ivisurface {
43 struct wl_list link;
44 struct ivishell *shell;
45 uint32_t update_count;
46 struct ivi_layout_surface *layout_surface;
47 const struct ivi_layout_surface_properties *prop;
48 struct wl_listener property_changed;
49 struct wl_listener surface_destroy_listener;
50 struct wl_listener committed;
51 struct wl_list notification_list;
52 enum ivi_wm_surface_type type;
53 uint32_t frame_count;
54 struct wl_list accepted_seat_list;
55 };
56
57 struct ivishell {
58 struct weston_compositor *compositor;
59 const struct ivi_layout_interface *interface;
60
61 struct wl_list list_surface;
62 struct wl_list list_layer;
63 struct wl_list list_screen;
64
65 struct wl_list list_controller;
66
67 struct wl_signal ivisurface_created_signal;
68 struct wl_signal ivisurface_removed_signal;
69
70 struct wl_listener surface_created;
71 struct wl_listener surface_removed;
72 struct wl_listener surface_configured;
73
74 struct wl_listener layer_created;
75 struct wl_listener layer_removed;
76
77 struct wl_listener output_created;
78 struct wl_listener output_destroyed;
79 struct wl_listener output_resized;
80
81 struct wl_listener destroy_listener;
82
83 struct wl_listener client_destroy_listener;
84
85 struct wl_array screen_ids;
86 uint32_t screen_id_offset;
87
88 int32_t bkgnd_surface_id;
89 uint32_t bkgnd_color;
90 uint8_t enable_cursor;
91 struct ivisurface *bkgnd_surface;
92 struct weston_layer bkgnd_layer;
93 struct weston_view *bkgnd_view;
94 struct weston_transform bkgnd_transform;
95
96 struct wl_client *client;
97 char *ivi_client_name;
98 char *debug_scopes;
99 };
100
101 #endif /* WESTON_IVI_SHELL_SRC_IVI_CONTROLLER_H_ */
102