packaging: bump version to 0.9.23, update changelog
[profile/ivi/ico-uxf-homescreen.git] / tool / ico_clear_screen.h
1 /*
2  * Copyright (c) 2013, TOYOTA MOTOR CORPORATION.
3  *
4  * This program is licensed under the terms and conditions of the
5  * Apache License, version 2.0.  The full text of the Apache License is at
6  * http://www.apache.org/licenses/LICENSE-2.0
7  *
8  */
9 /**
10  * @brief   Display screen clear tool
11  *
12  * @date    Sep-30-2013
13  */
14
15 #ifndef _CLEAR_SCREEN_H_
16 #define _CLEAR_SCREEN_H_
17
18 #include <sys/ioctl.h>
19 #include <GLES2/gl2.h>
20 #include <EGL/egl.h>
21 #include <wayland-client.h>
22 #include <wayland-client-protocol.h>
23 #include <wayland-egl.h>
24 #include <wayland-util.h>
25 #include <poll.h>
26 #include <assert.h>
27
28 #define MAX_CON_NAME 127
29 #define MAX_DISPLAY 4
30 #define MAX_SURFACE 4
31
32 struct display {
33     struct wl_display *display;
34     struct wl_registry *registry;
35     struct wl_compositor *compositor;
36     struct wl_shell *shell;
37     struct ico_window_mgr *ico_window_mgr;
38     struct ico_exinput *ico_exinput;
39     struct input *input;
40     int num_output;
41     struct output *output[MAX_DISPLAY];
42     int num_surface;
43     struct surface *surface[MAX_SURFACE];
44     unsigned int init_color;
45     int init_width;
46     int init_height;
47     int init_layer;
48     int displayno;
49     int init_posx;
50     int init_posy;
51     char animation[64];
52     int animatime;
53     char connect[MAX_CON_NAME + 1];
54 };
55
56 struct input {
57     struct display *display;
58     struct wl_seat *seat;
59     struct wl_pointer *pointer;
60     struct wl_keyboard *keyboard;
61     float x, y;
62     uint32_t button_mask;
63     struct surface *pointer_focus;
64     struct surface *keyboard_focus;
65     uint32_t last_key, last_key_state;
66 };
67
68 struct output {
69     struct display *display;
70     struct wl_output *output;
71     int x, y;
72     int width, height;
73     int trans;
74 };
75
76 struct surface {
77     struct display *display;
78     struct wl_surface *surface;
79     struct wl_shell_surface *shell_surface;
80     struct output *output;
81     EGLDisplay dpy;
82     EGLConfig conf;
83     EGLContext ctx;
84     EGLSurface egl_surface;
85 };
86
87 void wayland_dispatch_nonblock(struct wl_display *display);
88 void sleep_with_wayland(struct wl_display *display, int msec);
89 void wait_with_wayland(struct wl_display *display, int msec, int *endflag);
90 int sec_str_2_value(const char *ssec);
91 EGLDisplay opengl_init(struct wl_display *display, EGLConfig *rconf, EGLContext *rctx);
92 EGLSurface opengl_create_window(struct display *display, struct wl_surface *surface,
93                                 EGLDisplay dpy, EGLConfig conf, EGLContext ctx,
94                                 const int width, const int height, const unsigned int color,
95                                 const int displayno, const int posx, const int posy);
96 void opengl_clear_window(const unsigned int color);
97 void opengl_swap_buffer(struct wl_display *display, EGLDisplay dpy, EGLSurface egl_surface);
98 void create_surface(struct display *display, const char *title);
99 void clear_surface(struct surface *surface);
100 void shell_surface_ping(void *data, struct wl_shell_surface *wl_shell_surface, uint32_t serial);
101 void shell_surface_configure(void *data, struct wl_shell_surface *wl_shell_surface,
102                              uint32_t edges, int32_t width, int32_t height);
103 void shell_surface_popup_done(void *data, struct wl_shell_surface *wl_shell_surface);
104 void output_handle_geometry(void *data, struct wl_output *wl_output, int x, int y,
105                             int physical_width, int physical_height, int subpixel,
106                             const char *make, const char *model, int32_t transform);
107 void output_handle_mode(void *data, struct wl_output *wl_output, uint32_t flags,
108                         int width, int height, int refresh);
109 void handle_global(void *data, struct wl_registry *registry, uint32_t id,
110                    const char *interface, uint32_t version);
111 void surface_enter(void *data, struct wl_surface *wl_surface, struct wl_output *output);
112 void surface_leave(void *data, struct wl_surface *wl_surface, struct wl_output *output);
113
114 const struct wl_shell_surface_listener shell_surface_listener = {
115     shell_surface_ping,
116     shell_surface_configure,
117     shell_surface_popup_done
118 };
119
120 const struct wl_output_listener output_listener = {
121     output_handle_geometry,
122     output_handle_mode
123 };
124
125 const struct wl_registry_listener registry_listener = {
126     handle_global
127 };
128
129 const struct wl_surface_listener surface_listener = {
130     surface_enter,
131     surface_leave
132 };
133
134 #endif  /*_CLEAR_SCREEN_H_*/