1 #ifndef _ECORE_WAYLAND_PRIVATE_H 2 # define _ECORE_WAYLAND_PRIVATE_H 3 4 # include <limits.h> 5 # include <unistd.h> 6 # include <uuid/uuid.h> 7 8 # include "Ecore.h" 9 # include "Ecore_Input.h" 10 # include "Ecore_Wayland.h" 11 # ifdef USE_IVI_SHELL 12 # include "ivi-application-client-protocol.h" 13 # define IVI_SURFACE_ID 6000 14 # endif 15 16 //# define LOGFNS 1 17 18 # ifdef LOGFNS 19 # include <stdio.h> 20 # define LOGFN printf("-ECORE-WL: %25s: %5i - %s\n", __FILE__, __LINE__, __func__) 21 # else 22 # define LOGFN 23 # endif 24 25 extern int _ecore_wl_log_dom; 26 extern Eina_Bool _ecore_wl_server_mode; 27 28 # ifdef ECORE_WL_DEFAULT_LOG_COLOR 29 # undef ECORE_WL_DEFAULT_LOG_COLOR 30 # endif 31 # define ECORE_WL_DEFAULT_LOG_COLOR EINA_COLOR_BLUE 32 33 # ifdef ERR 34 # undef ERR 35 # endif 36 # define ERR(...) EINA_LOG_DOM_ERR(_ecore_wl_log_dom, __VA_ARGS__) 37 38 # ifdef DBG 39 # undef DBG 40 # endif 41 # define DBG(...) EINA_LOG_DOM_DBG(_ecore_wl_log_dom, __VA_ARGS__) 42 43 # ifdef INF 44 # undef INF 45 # endif 46 # define INF(...) EINA_LOG_DOM_INFO(_ecore_wl_log_dom, __VA_ARGS__) 47 48 # ifdef WRN 49 # undef WRN 50 # endif 51 # define WRN(...) EINA_LOG_DOM_WARN(_ecore_wl_log_dom, __VA_ARGS__) 52 53 # ifdef CRI 54 # undef CRI 55 # endif 56 # define CRI(...) EINA_LOG_DOM_CRIT(_ecore_wl_log_dom, __VA_ARGS__) 57 58 # ifdef ECORE_WL_DEFAULT_CURSOR_SIZE 59 # undef ECORE_WL_DEFAULT_CURSOR_SIZE 60 # endif 61 # define ECORE_WL_DEFAULT_CURSOR_SIZE 32 62 63 typedef struct _Ecore_Wl_Display Ecore_Wl_Display; 64 65 struct _Ecore_Wl_Display 66 { 67 struct 68 { 69 struct wl_display *display; 70 struct wl_registry *registry; 71 struct wl_compositor *compositor; 72 struct wl_subcompositor *subcompositor; 73 struct wl_shell *shell; 74 struct xdg_shell *xdg_shell; 75 struct wl_shell *desktop_shell; 76 struct zwp_e_session_recovery *session_recovery; 77 # ifdef USE_IVI_SHELL 78 struct ivi_application *ivi_application; 79 # endif 80 struct wl_shm *shm; 81 struct wl_data_device_manager *data_device_manager; 82 } wl; 83 84 int fd; 85 unsigned int mask; 86 unsigned int serial; 87 int sync_ref_count; 88 Ecore_Fd_Handler *fd_hdl; 89 Ecore_Idle_Enterer *idle_enterer; 90 91 Eina_Inlist *inputs; 92 Eina_Inlist *outputs; 93 Eina_Inlist *globals; /** @since 1.7.6 */ 94 95 Eina_Bool init_done; 96 97 struct 98 { 99 struct xkb_context *context; 100 } xkb; 101 102 struct wl_cursor_theme *cursor_theme; 103 104 Ecore_Wl_Output *output; 105 Ecore_Wl_Input *input; 106 107 void (*output_configure)(Ecore_Wl_Output *output, void *data); 108 void *data; 109 }; 110 111 struct _Ecore_Wl_Window 112 { 113 Ecore_Wl_Display *display; 114 Ecore_Wl_Window *parent; 115 116 struct wl_surface *surface; 117 struct wl_shell_surface *shell_surface; 118 # ifdef USE_IVI_SHELL 119 struct ivi_surface *ivi_surface; 120 int ivi_surface_id; 121 # endif 122 123 struct xdg_surface *xdg_surface; 124 struct xdg_popup *xdg_popup; 125 Eina_Bool focused : 1; 126 Eina_Bool resizing : 1; 127 128 Eina_Bool fullscreen : 1; 129 Eina_Bool maximized : 1; 130 Eina_Bool minimized : 1; 131 132 struct 133 { 134 struct wl_surface *surface; 135 int hot_x, hot_y; 136 Eina_Bool set : 1; 137 } pointer; 138 139 int id, surface_id; 140 int rotation; 141 142 const char *title; 143 const char *class_name; 144 145 Eina_Rectangle allocation; 146 147 struct 148 { 149 int w, h; 150 } saved; 151 152 struct 153 { 154 int x, y, w, h; 155 } opaque, input; 156 157 /* Eina_Bool redraw_scheduled : 1; */ 158 /* Eina_Bool resize_scheduled : 1; */ 159 Eina_Bool alpha : 1; 160 Eina_Bool transparent : 1; 161 Eina_Bool has_buffer : 1; 162 163 Ecore_Wl_Window_Type type; 164 Ecore_Wl_Window_Buffer_Type buffer_type; 165 166 Ecore_Wl_Input *pointer_device; 167 Ecore_Wl_Input *keyboard_device; 168 169 Eina_Bool anim_pending : 1; 170 struct wl_callback *anim_callback; 171 172 const char *cursor_name; 173 174 Ecore_Wl_Subsurf *subsurfs; 175 176 void *data; 177 178 uuid_t uuid; 179 }; 180 181 struct _Ecore_Wl_Input 182 { 183 EINA_INLIST; 184 Ecore_Wl_Display *display; 185 struct wl_seat *seat; 186 struct wl_pointer *pointer; 187 struct wl_keyboard *keyboard; 188 189 struct wl_touch *touch; 190 191 const char *cursor_name; 192 struct wl_cursor *cursor; 193 struct wl_surface *cursor_surface; 194 struct wl_callback *cursor_frame_cb; 195 Ecore_Timer *cursor_timer; 196 unsigned int cursor_current_index; 197 unsigned int cursor_size; 198 const char *cursor_theme_name; 199 200 struct wl_data_device *data_device; 201 struct wl_data_source *data_source; 202 struct wl_array data_types; 203 204 Ecore_Wl_Window *pointer_focus; 205 Ecore_Wl_Window *keyboard_focus; 206 Ecore_Wl_Window *touch_focus; 207 208 unsigned int button; 209 unsigned int timestamp; 210 unsigned int modifiers; 211 unsigned int pointer_enter_serial; 212 int sx, sy; 213 214 Ecore_Wl_Window *grab; 215 unsigned int grab_button; 216 unsigned int grab_timestamp; 217 unsigned int grab_count; 218 219 Ecore_Wl_Dnd_Source *drag_source; 220 Ecore_Wl_Dnd_Source *selection_source; 221 222 struct 223 { 224 struct xkb_keymap *keymap; 225 struct xkb_state *state; 226 xkb_mod_mask_t control_mask; 227 xkb_mod_mask_t alt_mask; 228 xkb_mod_mask_t shift_mask; 229 xkb_mod_mask_t win_mask; 230 xkb_mod_mask_t scroll_mask; 231 xkb_mod_mask_t num_mask; 232 xkb_mod_mask_t caps_mask; 233 xkb_mod_mask_t altgr_mask; 234 unsigned int mods_depressed; 235 unsigned int mods_latched; 236 unsigned int mods_locked; 237 unsigned int mods_group; 238 } xkb; 239 240 struct 241 { 242 Ecore_Timer *tmr; 243 unsigned int sym, key, time; 244 double rate, delay; 245 Eina_Bool enabled : 1; 246 } repeat; 247 }; 248 249 struct _Ecore_Wl_Output 250 { 251 EINA_INLIST; 252 Ecore_Wl_Display *display; 253 struct wl_output *output; 254 Eina_Rectangle allocation; 255 int mw, mh; 256 int transform; 257 258 void (*destroy) (Ecore_Wl_Output *output, void *data); 259 void *data; 260 }; 261 262 struct _Ecore_Wl_Dnd 263 { 264 Ecore_Wl_Display *ewd; 265 Ecore_Wl_Input *input; 266 }; 267 268 struct _Ecore_Wl_Dnd_Source 269 { 270 Ecore_Wl_Input *input; 271 272 struct wl_data_offer *data_offer; 273 struct wl_array types; 274 275 int refcount; 276 int fd; 277 int x, y; 278 }; 279 280 struct _Ecore_Wl_Dnd_Target 281 { 282 Ecore_Wl_Dnd_Source *source; 283 }; 284 285 extern Ecore_Wl_Display *_ecore_wl_disp; 286 287 void _ecore_wl_window_init(void); 288 void _ecore_wl_window_shutdown(void); 289 Eina_Hash *_ecore_wl_window_hash_get(void); 290 void _ecore_wl_window_shell_surface_init(Ecore_Wl_Window *win); 291 292 void _ecore_wl_output_add(Ecore_Wl_Display *ewd, unsigned int id); 293 void _ecore_wl_output_del(Ecore_Wl_Output *output); 294 295 void _ecore_wl_input_setup(Ecore_Wl_Input *input); 296 void _ecore_wl_input_add(Ecore_Wl_Display *ewd, unsigned int id); 297 void _ecore_wl_input_del(Ecore_Wl_Input *input); 298 void _ecore_wl_input_pointer_xy_get(int *x, int *y); 299 void _ecore_wl_input_grab_release(Ecore_Wl_Input *input, Ecore_Wl_Window *win); 300 301 void _ecore_wl_dnd_add(Ecore_Wl_Input *input, struct wl_data_device *data_device, struct wl_data_offer *offer); 302 void _ecore_wl_dnd_enter(void *data, struct wl_data_device *data_device, unsigned int timestamp, struct wl_surface *surface, int x, int y, struct wl_data_offer *offer); 303 void _ecore_wl_dnd_leave(void *data, struct wl_data_device *data_device); 304 void _ecore_wl_dnd_motion(void *data, struct wl_data_device *data_device, unsigned int timestamp, int x, int y); 305 void _ecore_wl_dnd_drop(void *data, struct wl_data_device *data_device); 306 void _ecore_wl_dnd_selection(void *data, struct wl_data_device *data_device, struct wl_data_offer *offer); 307 void _ecore_wl_dnd_del(Ecore_Wl_Dnd_Source *source); 308 309 void _ecore_wl_events_init(void); 310 void _ecore_wl_events_shutdown(void); 311 312 void _ecore_wl_subsurfs_del_all(Ecore_Wl_Window *win); 313 314 struct wl_compositor *_ecore_wl_compositor_get(void); 315 struct wl_subcompositor *_ecore_wl_subcompositor_get(void); 316 317 #endif 318