1 #ifdef HAVE_CONFIG_H 2 # include <config.h> 3 #endif 4 5 #include <Eet.h> 6 #include <Evas.h> 7 #include <Elementary.h> 8 9 typedef struct 10 { 11 Eina_Debug_Session *session; 12 int srcid; 13 void *buffer; 14 unsigned int size; 15 } _Main_Loop_Info; 16 17 #define WRAPPER_TO_XFER_MAIN_LOOP(foo) \ 18 static void \ 19 _intern_main_loop ## foo(void *data) \ 20 { \ 21 _Main_Loop_Info *info = data; \ 22 _main_loop ## foo(info->session, info->srcid, info->buffer, info->size); \ 23 free(info->buffer); \ 24 free(info); \ 25 } \ 26 static Eina_Bool \ 27 foo(Eina_Debug_Session *session, int srcid, void *buffer, int size) \ 28 { \ 29 _Main_Loop_Info *info = calloc(1, sizeof(*info)); \ 30 info->session = session; \ 31 info->srcid = srcid; \ 32 info->size = size; \ 33 if (info->size) \ 34 { \ 35 info->buffer = malloc(info->size); \ 36 memcpy(info->buffer, buffer, info->size); \ 37 } \ 38 ecore_main_loop_thread_safe_call_async(_intern_main_loop ## foo, info); \ 39 return EINA_TRUE; \ 40 } 41 42 #ifndef WORDS_BIGENDIAN 43 #define SWAP_64(x) x 44 #define SWAP_32(x) x 45 #define SWAP_16(x) x 46 #define SWAP_DBL(x) x 47 #else 48 #define SWAP_64(x) eina_swap64(x) 49 #define SWAP_32(x) eina_swap32(x) 50 #define SWAP_16(x) eina_swap16(x) 51 #define SWAP_DBL(x) SWAP_64(x) 52 #endif 53 54 #define EXTRACT_INT(_buf) \ 55 ({ \ 56 int __i; \ 57 memcpy(&__i, _buf, sizeof(int)); \ 58 _buf += sizeof(int); \ 59 SWAP_32(__i); \ 60 }) 61 62 #define EXTRACT_DOUBLE(_buf) \ 63 ({ \ 64 double __d; \ 65 memcpy(&__d, _buf, sizeof(double)); \ 66 _buf += sizeof(double); \ 67 SWAP_DBL(__d); \ 68 }) 69 70 #define EXTRACT_STRING(_buf) \ 71 ({ \ 72 char *__s = _buf ? strdup(_buf) : NULL; \ 73 int __len = (__s ? strlen(__s) : 0) + 1; \ 74 _buf += __len; \ 75 __s; \ 76 }) 77 78 #define STORE_INT(_buf, __i) \ 79 ({ \ 80 int __si = SWAP_32(__i); \ 81 memcpy(_buf, &__si, sizeof(int)); \ 82 _buf += sizeof(int); \ 83 }) 84 85 #define STORE_DOUBLE(_buf, __d) \ 86 { \ 87 double __d2 = SWAP_DBL(__d); \ 88 memcpy(_buf, &__d2, sizeof(double)); \ 89 _buf += sizeof(double); \ 90 } 91 92 #define STORE_STRING(_buf, __s) \ 93 { \ 94 int __len = (__s ? strlen(__s) : 0) + 1; \ 95 if (__s) memcpy(_buf, __s, __len); \ 96 else *_buf = '\0'; \ 97 _buf += __len; \ 98 } 99 100 #define SHOT_DELIMITER '+' 101 102 /** 103 * The type values for an Exactness action. 104 */ 105 typedef enum 106 { 107 EXACTNESS_ACTION_UNKNOWN = 0, 108 EXACTNESS_ACTION_MOUSE_IN, 109 EXACTNESS_ACTION_MOUSE_OUT, 110 EXACTNESS_ACTION_MOUSE_WHEEL, 111 EXACTNESS_ACTION_MULTI_DOWN, 112 EXACTNESS_ACTION_MULTI_UP, 113 EXACTNESS_ACTION_MULTI_MOVE, 114 EXACTNESS_ACTION_KEY_DOWN, 115 EXACTNESS_ACTION_KEY_UP, 116 EXACTNESS_ACTION_TAKE_SHOT, 117 EXACTNESS_ACTION_EFL_EVENT, 118 EXACTNESS_ACTION_CLICK_ON, 119 EXACTNESS_ACTION_STABILIZE, 120 EXACTNESS_ACTION_LAST = EXACTNESS_ACTION_STABILIZE 121 /* Add any supported actions here and update _LAST */ 122 } Exactness_Action_Type; 123 124 /** 125 * The type for the Exactness Mouse Wheel action. 126 */ 127 typedef struct 128 { 129 int direction; 130 int z; 131 } Exactness_Action_Mouse_Wheel; 132 133 /** 134 * The type for the Exactness Key Down Up action. 135 */ 136 typedef struct 137 { 138 const char *keyname; 139 const char *key; 140 const char *string; 141 const char *compose; 142 unsigned int keycode; 143 } Exactness_Action_Key_Down_Up; 144 145 /** 146 * The type for the Exactness Multi Event action. 147 */ 148 typedef struct 149 { 150 int d; 151 int b; /* In case of simple mouse down/up, corresponds to the button */ 152 int x; 153 int y; 154 double rad; 155 double radx; 156 double rady; 157 double pres; 158 double ang; 159 double fx; 160 double fy; 161 Evas_Button_Flags flags; 162 } Exactness_Action_Multi_Event; 163 164 /** 165 * The type for the Exactness Multi Move action. 166 */ 167 typedef struct 168 { 169 int d; 170 int x; 171 int y; 172 double rad; 173 double radx; 174 double rady; 175 double pres; 176 double ang; 177 double fx; 178 double fy; 179 } Exactness_Action_Multi_Move; 180 181 /** 182 * The type for the Exactness EFL Event action. 183 */ 184 typedef struct 185 { 186 char *wdg_name; /**< Name of the widget */ 187 char *event_name; /**< Name of the event */ 188 } Exactness_Action_Efl_Event; 189 190 /** 191 * The type for the Exactness Click on (widget) action. 192 */ 193 typedef struct 194 { 195 char *wdg_name; /**< Name of the widget */ 196 } Exactness_Action_Click_On; 197 198 /** 199 * The type for the Exactness action. 200 */ 201 typedef struct 202 { 203 Exactness_Action_Type type; /**< The action type */ 204 unsigned int n_evas; /**< The evas number on which the action has to be applied */ 205 unsigned int delay_ms; /**< The delay (in ms) to wait for this action */ 206 void *data; /**< The specific action data */ 207 } Exactness_Action; 208 209 /** 210 * The type for the Exactness object. 211 */ 212 typedef struct 213 { 214 long long id; /**< The Eo pointer */ 215 long long parent_id; /**< The Eo parent pointer */ 216 const char *kl_name; /**< The class name */ 217 218 Eina_List *children; /* NOT EET */ 219 220 /* Evas stuff */ 221 int x; /**< The X coordinate */ 222 int y; /**< The Y coordinate */ 223 int w; /**< The object width */ 224 int h; /**< The object height */ 225 } Exactness_Object; 226 227 /** 228 * The type for the Exactness objects list. 229 */ 230 typedef struct 231 { 232 Eina_List *objs; /**< List of all the objects */ 233 /* main_objs not in EET */ 234 Eina_List *main_objs; /**< List of the main objects */ 235 } Exactness_Objects; 236 237 /** 238 * The type for the Exactness Image. 239 */ 240 typedef struct 241 { 242 unsigned int w; /**< Width of the image */ 243 unsigned int h; /**< Height of the image */ 244 void *pixels; /**< Pixels of the image */ 245 } Exactness_Image; 246 247 /** 248 * An Exactness test unit, including the list of tested actions and produced images. 249 */ 250 typedef struct 251 { 252 Eina_List *actions; /**< List of Exactness_Action */ 253 /* imgs not in EET */ 254 Eina_List *imgs; /**< List of Exactness_Image */ 255 Eina_List *objs; /**< List of Exactness_Objects */ 256 const char *fonts_path; /**< Path to the fonts to use, relative to the fonts dir given in parameter to the player/recorder */ 257 int nb_shots; /**< The number of shots present in the unit */ 258 } Exactness_Unit; 259 260 const char *_exactness_action_type_to_string_get(Exactness_Action_Type type); 261 262 Eina_Bool ex_is_original_app(void); 263 void ex_set_original_envvar(void); 264 Eina_Bool exactness_image_compare(Exactness_Image *img1, Exactness_Image *img2, Exactness_Image **diff_img); 265 Exactness_Unit *exactness_unit_file_read(const char *filename); 266 Eina_Bool exactness_unit_file_write(Exactness_Unit *unit, const char *filename); 267 void exactness_image_free(Exactness_Image *img); 268 269 void ex_prepare_elm_overlay(void); 270