ivi-layout-private.h 6 KB
Newer Older
1 2 3
/*
 * Copyright (C) 2014 DENSO CORPORATION
 *
4 5 6 7 8 9 10
 * Permission is hereby granted, free of charge, to any person obtaining
 * a copy of this software and associated documentation files (the
 * "Software"), to deal in the Software without restriction, including
 * without limitation the rights to use, copy, modify, merge, publish,
 * distribute, sublicense, and/or sell copies of the Software, and to
 * permit persons to whom the Software is furnished to do so, subject to
 * the following conditions:
11
 *
12 13 14 15 16 17 18 19 20 21 22 23
 * The above copyright notice and this permission notice (including the
 * next paragraph) shall be included in all copies or substantial
 * portions of the Software.
 *
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
 * NONINFRINGEMENT.  IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 * SOFTWARE.
24 25 26 27 28
 */

#ifndef _ivi_layout_PRIVATE_H_
#define _ivi_layout_PRIVATE_H_

29 30
#include <stdint.h>

31
#include <libweston/libweston.h>
32
#include "ivi-layout-export.h"
Pekka Paalanen's avatar
Pekka Paalanen committed
33
#include <libweston-desktop/libweston-desktop.h>
34

eucan's avatar
eucan committed
35 36 37 38 39 40 41 42 43 44 45 46 47
struct ivi_layout_view {
	struct wl_list link;	/* ivi_layout::view_list */
	struct wl_list surf_link;	/*ivi_layout_surface::view_list */
	struct wl_list pending_link;	/* ivi_layout_layer::pending.view_list */
	struct wl_list order_link;	/* ivi_layout_layer::order.view_list */

	struct weston_view *view;
	struct weston_transform transform;

	struct ivi_layout_surface *ivisurf;
	struct ivi_layout_layer *on_layer;
};

48
struct ivi_layout_surface {
49
	struct wl_list link;	/* ivi_layout::surface_list */
50 51 52 53 54 55
	struct wl_signal property_changed;
	int32_t update_count;
	uint32_t id_surface;

	struct ivi_layout *layout;
	struct weston_surface *surface;
56
	struct weston_desktop_surface *weston_desktop_surface;
57 58 59 60 61 62 63

	struct ivi_layout_surface_properties prop;

	struct {
		struct ivi_layout_surface_properties prop;
	} pending;

eucan's avatar
eucan committed
64
	struct wl_list view_list;	/* ivi_layout_view::surf_link */
65 66 67
};

struct ivi_layout_layer {
68
	struct wl_list link;	/* ivi_layout::layer_list */
69 70 71 72
	struct wl_signal property_changed;
	uint32_t id_layer;

	struct ivi_layout *layout;
eucan's avatar
eucan committed
73
	struct ivi_layout_screen *on_screen;
74 75 76 77 78

	struct ivi_layout_layer_properties prop;

	struct {
		struct ivi_layout_layer_properties prop;
eucan's avatar
eucan committed
79
		struct wl_list view_list;	/* ivi_layout_view::pending_link */
80
		struct wl_list link;	/* ivi_layout_screen::pending.layer_list */
81 82 83
	} pending;

	struct {
84
		int dirty;
eucan's avatar
eucan committed
85
		struct wl_list view_list;	/* ivi_layout_view::order_link */
86
		struct wl_list link;	/* ivi_layout_screen::order.layer_list */
87
	} order;
88 89

	int32_t ref_count;
90 91 92 93 94
};

struct ivi_layout {
	struct weston_compositor *compositor;

95 96 97
	struct wl_list surface_list;	/* ivi_layout_surface::link */
	struct wl_list layer_list;	/* ivi_layout_layer::link */
	struct wl_list screen_list;	/* ivi_layout_screen::link */
eucan's avatar
eucan committed
98
	struct wl_list view_list;	/* ivi_layout_view::link */
99 100 101 102 103 104 105 106 107 108

	struct {
		struct wl_signal created;
		struct wl_signal removed;
	} layer_notification;

	struct {
		struct wl_signal created;
		struct wl_signal removed;
		struct wl_signal configure_changed;
109
		struct wl_signal configure_desktop_changed;
110 111 112 113 114
	} surface_notification;

	struct weston_layer layout_layer;

	struct ivi_layout_transition_set *transitions;
115
	struct wl_list pending_transition_list;	/* transition_node::link */
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162
};

struct ivi_layout *get_instance(void);

struct ivi_layout_transition;

struct ivi_layout_transition_set {
	struct wl_event_source  *event_source;
	struct wl_list          transition_list;
};

typedef void (*ivi_layout_transition_destroy_user_func)(void *user_data);

struct ivi_layout_transition_set *
ivi_layout_transition_set_create(struct weston_compositor *ec);

void
ivi_layout_transition_move_resize_view(struct ivi_layout_surface *surface,
				       int32_t dest_x, int32_t dest_y,
				       int32_t dest_width, int32_t dest_height,
				       uint32_t duration);

void
ivi_layout_transition_visibility_on(struct ivi_layout_surface *surface,
				    uint32_t duration);

void
ivi_layout_transition_visibility_off(struct ivi_layout_surface *surface,
				     uint32_t duration);


void
ivi_layout_transition_move_layer(struct ivi_layout_layer *layer,
				 int32_t dest_x, int32_t dest_y,
				 uint32_t duration);

void
ivi_layout_transition_fade_layer(struct ivi_layout_layer *layer,
				 uint32_t is_fade_in,
				 double start_alpha, double end_alpha,
				 void *user_data,
				 ivi_layout_transition_destroy_user_func destroy_func,
				 uint32_t duration);

int32_t
is_surface_transition(struct ivi_layout_surface *surface);

163 164 165
void
ivi_layout_remove_all_surface_transitions(struct ivi_layout_surface *surface);

166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191
/**
 * methods of interaction between transition animation with ivi-layout
 */
int32_t
ivi_layout_commit_changes(void);
uint32_t
ivi_layout_get_id_of_surface(struct ivi_layout_surface *ivisurf);
int32_t
ivi_layout_surface_set_destination_rectangle(struct ivi_layout_surface *ivisurf,
					     int32_t x, int32_t y,
					     int32_t width, int32_t height);
int32_t
ivi_layout_surface_set_opacity(struct ivi_layout_surface *ivisurf,
			       wl_fixed_t opacity);
int32_t
ivi_layout_surface_set_visibility(struct ivi_layout_surface *ivisurf,
				  bool newVisibility);
struct ivi_layout_surface *
ivi_layout_get_surface_from_id(uint32_t id_surface);
int32_t
ivi_layout_layer_set_opacity(struct ivi_layout_layer *ivilayer,
			     wl_fixed_t opacity);
int32_t
ivi_layout_layer_set_visibility(struct ivi_layout_layer *ivilayer,
				bool newVisibility);
int32_t
192 193 194
ivi_layout_layer_set_destination_rectangle(struct ivi_layout_layer *ivilayer,
					   int32_t x, int32_t y,
					   int32_t width, int32_t height);
195 196 197 198 199 200
int32_t
ivi_layout_layer_set_render_order(struct ivi_layout_layer *ivilayer,
				  struct ivi_layout_surface **pSurface,
				  int32_t number);
void
ivi_layout_transition_move_layer_cancel(struct ivi_layout_layer *layer);
201

202
#endif