2 typedef struct _E_Comp_Wl_Hook E_Comp_Wl_Hook;
3 typedef struct _E_Comp_Wl_Pid_Hook E_Comp_Wl_Pid_Hook;
8 /* NB: Turn off shadow warnings for Wayland includes */
9 # pragma GCC diagnostic push
10 # pragma GCC diagnostic ignored "-Wshadow"
11 # define WL_HIDE_DEPRECATED
12 # include <wayland-server.h>
13 # pragma GCC diagnostic pop
15 # include <xkbcommon/xkbcommon.h>
18 # include <linux/input.h>
20 # define BTN_LEFT 0x110
21 # define BTN_RIGHT 0x111
22 # define BTN_MIDDLE 0x112
23 # define BTN_SIDE 0x113
24 # define BTN_EXTRA 0x114
25 # define BTN_FORWARD 0x115
26 # define BTN_BACK 0x116
29 # define container_of(ptr, type, member) \
31 const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
32 (type *)( (char *)__mptr - offsetof(type,member) ); \
35 #include <tbm_surface.h>
37 typedef struct _E_Comp_Wl_Aux_Hint E_Comp_Wl_Aux_Hint;
38 typedef struct _E_Comp_Wl_Buffer E_Comp_Wl_Buffer;
39 typedef struct _E_Comp_Wl_Buffer_Ref E_Comp_Wl_Buffer_Ref;
40 typedef struct _E_Comp_Wl_Buffer_Viewport E_Comp_Wl_Buffer_Viewport;
41 typedef struct _E_Comp_Wl_Subsurf_Data E_Comp_Wl_Subsurf_Data;
42 typedef struct _E_Comp_Wl_Surface_State E_Comp_Wl_Surface_State;
43 typedef struct _E_Comp_Wl_Data E_Comp_Wl_Data;
44 typedef struct _E_Comp_Wl_Output E_Comp_Wl_Output;
45 typedef struct _E_Comp_Wl_Intercept_Hook E_Comp_Wl_Intercept_Hook;
46 typedef struct _E_Comp_Wl_Evas_Gl E_Comp_Wl_Evas_Gl;
47 typedef struct _E_Comp_Wl_Seat E_Comp_Wl_Seat;
49 typedef enum _E_Comp_Wl_Buffer_Type
51 E_COMP_WL_BUFFER_TYPE_NONE = 0,
52 E_COMP_WL_BUFFER_TYPE_SHM = 1,
53 E_COMP_WL_BUFFER_TYPE_NATIVE = 2,
54 E_COMP_WL_BUFFER_TYPE_VIDEO = 3,
55 E_COMP_WL_BUFFER_TYPE_TBM = 4,
56 } E_Comp_Wl_Buffer_Type;
58 typedef enum _E_Comp_Wl_Hook_Point
60 E_COMP_WL_HOOK_SHELL_SURFACE_READY,
61 E_COMP_WL_HOOK_SUBSURFACE_CREATE,
62 E_COMP_WL_HOOK_SUBSURFACE_COMMIT_TO_CACHE,
63 E_COMP_WL_HOOK_SUBSURFACE_SYNCHRONIZED_COMMIT,
64 E_COMP_WL_HOOK_BUFFER_CHANGE,
65 E_COMP_WL_HOOK_CLIENT_REUSE,
66 E_COMP_WL_HOOK_BUFFER_SIZE_CHANGE,
68 E_COMP_WL_HOOK_CLIENT_ALPHA_CHANGE,
69 E_COMP_WL_HOOK_CLIENT_SURFACE_COMMIT,
71 } E_Comp_Wl_Hook_Point;
73 typedef enum _E_Comp_Wl_Pid_Hook_Point
75 E_COMP_WL_PID_HOOK_CONNECTED_CLIENT_CREATE,
76 E_COMP_WL_PID_HOOK_LAST,
77 } E_Comp_Wl_Pid_Hook_Point;
79 typedef enum _E_Comp_Wl_Sh_Surf_Role
81 E_COMP_WL_SH_SURF_ROLE_NONE = 0,
82 E_COMP_WL_SH_SURF_ROLE_TOPLV = 1,
83 E_COMP_WL_SH_SURF_ROLE_POPUP = 2,
84 } E_Comp_Wl_Sh_Surf_Role;
86 typedef enum _E_Comp_Wl_Intercept_Hook_Point
88 E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_IN,
89 E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_OUT,
90 E_COMP_WL_INTERCEPT_HOOK_CURSOR_TIMER_MOUSE_MOVE,
91 E_COMP_WL_INTERCEPT_HOOK_LAST,
92 } E_Comp_Wl_Intercept_Hook_Point;
94 typedef void (*E_Comp_Wl_Hook_Cb) (void *data, E_Client *ec);
95 typedef void (*E_Comp_Wl_Pid_Hook_Cb) (void *data, pid_t pid);
96 typedef Eina_Bool (*E_Comp_Wl_Intercept_Hook_Cb) (void *data, E_Client *ec);
98 struct _E_Comp_Wl_Aux_Hint
107 struct _E_Comp_Wl_Buffer
109 E_Comp_Wl_Buffer_Type type;
110 struct wl_resource *resource;
111 struct wl_signal destroy_signal;
112 struct wl_listener destroy_listener;
113 struct wl_shm_buffer *shm_buffer;
114 tbm_surface_h tbm_surface;
117 Eina_Stringshare *owner_name;
122 int transform; // the value of wl_tbm.set_buffer_transform
125 E_Explicit_Sync_Buffer_Release *buffer_release;
128 struct _E_Comp_Wl_Buffer_Ref
130 E_Comp_Wl_Buffer *buffer;
131 struct wl_listener destroy_listener;
132 Eina_Bool destroy_listener_usable;
135 struct _E_Comp_Wl_Buffer_Viewport {
138 uint32_t transform; /* wl_surface.set_buffer_transform */
139 int32_t scale; /* wl_surface.set_scaling_factor */
141 /* If src_width != wl_fixed_from_int(-1), then and only then src_* are used. */
142 wl_fixed_t src_x, src_y;
143 wl_fixed_t src_width, src_height;
148 /* If width == -1, the size is inferred from the buffer. */
149 int32_t width, height;
154 /* When screen or window is rotated, a transformed buffer could be
155 * attached after attaching a few buffers. So to detect when the transformed
156 * buffer exactly, we need to know the status of waiting the transformed buffer.
158 uint32_t wait_for_transform_change;
161 struct _E_Comp_Wl_Surface_State
165 E_Comp_Wl_Buffer *buffer;
166 struct wl_listener buffer_destroy_listener;
167 Eina_List *damages, *buffer_damages, *frames;
168 Eina_Tiler *input, *opaque;
169 E_Comp_Wl_Buffer_Viewport buffer_viewport;
170 Eina_Bool new_attach : 1;
171 Eina_Bool has_data : 1;
173 E_Presentation_Time_Container presentation_container;
176 struct _E_Comp_Wl_Subsurf_Data
178 struct wl_resource *resource;
188 E_Comp_Wl_Surface_State cached;
189 E_Comp_Wl_Buffer_Ref cached_buffer_ref;
191 Eina_Bool synchronized;
192 Eina_Bool stand_alone;
196 E_Client *offscreen_parent;
200 struct _E_Comp_Wl_Data
204 struct wl_display *disp;
205 struct wl_event_loop *loop;
210 Eina_List *resources;
212 Eina_Bool enabled : 1;
213 xkb_mod_index_t mod_shift, mod_caps;
214 xkb_mod_index_t mod_ctrl, mod_alt;
215 xkb_mod_index_t mod_super;
216 xkb_mod_mask_t mod_depressed, mod_latched, mod_locked;
217 xkb_layout_index_t mod_group;
218 struct wl_array keys;
219 struct wl_array routed_keys;
220 struct wl_resource *focus;
224 unsigned int num_devices;
229 Eina_List *resources;
231 wl_fixed_t grab_x, grab_y;
233 Ecore_Timer *hide_tmr;
235 Eina_Bool enabled : 1;
236 unsigned int num_devices;
241 Eina_List *resources;
242 Eina_Bool enabled : 1;
243 unsigned int num_devices;
244 unsigned int pressed;
250 struct wl_global *global;
251 Eina_List *resources;
257 struct wl_global *global;
258 struct wl_resource *resource;
264 struct wl_global *global;
265 struct wl_resource *resource;
266 Eina_Hash *data_resources;
273 struct wl_signal signal;
274 struct wl_listener data_source_listener;
277 struct wl_resource *cbhm;
278 Eina_List *data_only_list;
284 struct wl_listener listener;
293 struct wl_signal signal;
294 struct wl_listener data_source_listener;
295 struct wl_client *client;
296 struct wl_resource *focus;
297 Eina_Bool enabled : 1;
302 struct wl_resource *resource;
308 struct xkb_keymap *keymap;
309 struct xkb_context *context;
310 struct xkb_state *state;
320 } available_hw_accel;
329 struct wl_global *global;
330 struct wl_client *client;
335 struct wl_global *global;
340 struct wl_global *global;
345 Ecore_Fd_Handler *fd_hdlr;
348 struct wl_client *xwl_client;
349 Eina_List *xwl_pending;
352 E_Client *drag_client;
356 E_Comp_Wl_Evas_Gl *evas_gl;
359 struct _E_Comp_Wl_Client_Data
361 struct wl_resource *wl_surface;
363 Ecore_Timer *on_focus_timer;
367 E_Comp_Wl_Subsurf_Data *data;
370 Eina_List *list_pending;
371 Eina_Bool list_changed : 1;
373 Eina_List *below_list;
374 Eina_List *below_list_pending;
375 Evas_Object *below_obj;
376 E_Map *below_obj_map;
377 E_Client_Hook *below_obj_map_transform_hook;
378 E_Comp_Wl_Hook *comp_wl_del_hook;
380 Eina_Bool restacking : 1;
382 struct wl_resource *watcher;
385 /* regular surface resource (wl_compositor_create_surface) */
386 struct wl_resource *surface;
387 struct wl_signal destroy_signal;
388 struct wl_signal apply_viewport_signal;
392 /* shell surface resource */
393 struct wl_resource *surface;
395 void (*configure_send)(struct wl_resource *resource, uint32_t edges, int32_t width, int32_t height);
396 void (*configure)(struct wl_resource *resource, Evas_Coord x, Evas_Coord y, Evas_Coord w, Evas_Coord h);
397 void (*ping)(struct wl_resource *resource);
398 void (*map)(struct wl_resource *resource);
399 void (*unmap)(struct wl_resource *resource);
400 Eina_Rectangle window;
403 E_Comp_Wl_Buffer_Ref buffer_ref;
404 E_Comp_Wl_Surface_State pending;
407 E_Presentation_Time_Container presentation_container;
416 struct wl_resource *viewport;
417 E_Comp_Wl_Buffer_Viewport buffer_viewport;
422 Eina_Bool enabled : 1;
425 unsigned int scount, stime;
427 int prev_degree, cur_degree;
432 Eina_Bool changed : 1;
434 Eina_Bool use_msg : 1;
437 /* before applying viewport */
438 int width_from_buffer;
439 int height_from_buffer;
441 /* after applying viewport */
442 int width_from_viewport;
443 int height_from_viewport;
445 Eina_Bool keep_buffer : 1;
446 Eina_Bool mapped : 1;
447 Eina_Bool has_extern_parent : 1;
448 Eina_Bool change_icon : 1;
449 Eina_Bool need_reparent : 1;
450 Eina_Bool reparented : 1;
451 Eina_Bool evas_init : 1;
452 Eina_Bool first_damage : 1;
453 Eina_Bool set_win_type : 1;
454 Eina_Bool frame_update : 1;
455 Eina_Bool maximize_pre : 1;
456 Eina_Bool focus_update : 1;
457 Eina_Bool opaque_state : 1;
458 Eina_Bool video_client : 1; // Deprecated
459 Eina_Bool has_video_client : 1;
460 Eina_Bool never_hwc : 1; // force window not to do hwc
461 Eina_Bool first_commit : 1; // TRUE : once client committed
462 unsigned char accepts_focus : 1;
463 unsigned char conformant : 1;
464 E_Window_Type win_type;
469 unsigned char win_type : 1;
470 unsigned char layer : 1;
473 E_Devicemgr_Input_Device *last_device_ptr;
474 E_Devicemgr_Input_Device *last_device_touch;
475 E_Devicemgr_Input_Device *last_device_kbd;
477 E_Util_Transform *viewport_transform;
481 E_Client *onscreen_parent;
482 Eina_List *regions; //list of onscreen region (Eina_Rectangle *)
485 /* xdg shell v6 resource: it should be moved to member of struct shell */
488 E_Comp_Wl_Sh_Surf_Role role;
489 struct wl_resource *res_role; /* zxdg_toplevel_v6 or zxdg_popup_v6 */
492 const char *role_name;
495 struct _E_Comp_Wl_Output
497 struct wl_global *global;
498 Eina_List *resources;
499 const char *id, *make, *model;
501 int phys_width, phys_height;
502 unsigned int refresh;
503 unsigned int subpixel;
504 unsigned int transform;
507 /* added for screenshot ability */
508 struct wl_output *wl_output;
509 struct wl_buffer *buffer;
513 struct _E_Comp_Wl_Hook
516 E_Comp_Wl_Hook_Point hookpoint;
517 E_Comp_Wl_Hook_Cb func;
519 unsigned char delete_me : 1;
522 struct _E_Comp_Wl_Pid_Hook
525 E_Comp_Wl_Pid_Hook_Point hookpoint;
526 E_Comp_Wl_Pid_Hook_Cb func;
528 unsigned char delete_me : 1;
531 struct _E_Comp_Wl_Intercept_Hook
534 E_Comp_Wl_Intercept_Hook_Point hookpoint;
535 E_Comp_Wl_Intercept_Hook_Cb func;
537 unsigned char delete_me : 1;
540 struct _E_Comp_Wl_Seat
542 Eina_Bool is_first_resource : 1;
545 EINTERN Eina_Bool e_comp_wl_init(void);
546 EINTERN void e_comp_wl_shutdown(void);
548 EINTERN void e_comp_wl_deferred_job(void);
550 EINTERN void e_comp_wl_surface_destroy(struct wl_resource *resource);
551 EINTERN void e_comp_wl_surface_attach(E_Client *ec, E_Comp_Wl_Buffer *buffer);
552 E_API Eina_Bool e_comp_wl_surface_commit(E_Client *ec);
553 E_API void e_comp_wl_buffer_reference(E_Comp_Wl_Buffer_Ref *ref, E_Comp_Wl_Buffer *buffer);
554 EINTERN E_Comp_Wl_Buffer *e_comp_wl_buffer_get(struct wl_resource *resource, E_Client *ec);
556 E_API Eina_Bool e_comp_wl_output_init(const char *id, const char *make, const char *model, int x, int y, int w, int h, int pw, int ph, unsigned int refresh, unsigned int subpixel, unsigned int transform);
557 E_API void e_comp_wl_output_remove(const char *id);
559 EINTERN Eina_Bool e_comp_wl_key_down(Ecore_Event_Key *ev);
560 EINTERN Eina_Bool e_comp_wl_key_up(Ecore_Event_Key *ev);
561 EINTERN Eina_Bool e_comp_wl_evas_handle_mouse_button(E_Client *ec, uint32_t timestamp, uint32_t button_id, uint32_t state);
562 E_API void e_comp_wl_touch_cancel(void);
564 E_API E_Comp_Wl_Hook *e_comp_wl_hook_add(E_Comp_Wl_Hook_Point hookpoint, E_Comp_Wl_Hook_Cb func, const void *data);
565 E_API void e_comp_wl_hook_del(E_Comp_Wl_Hook *ch);
567 E_API E_Comp_Wl_Pid_Hook *e_comp_wl_pid_hook_add(E_Comp_Wl_Pid_Hook_Point hookpoint, E_Comp_Wl_Pid_Hook_Cb func, const void *data);
568 E_API void e_comp_wl_pid_hook_del(E_Comp_Wl_Pid_Hook *ch);
570 E_API E_Comp_Wl_Intercept_Hook *e_comp_wl_intercept_hook_add(E_Comp_Wl_Intercept_Hook_Point hookpoint, E_Comp_Wl_Intercept_Hook_Cb func, const void *data);
571 E_API void e_comp_wl_intercept_hook_del(E_Comp_Wl_Intercept_Hook *ch);
573 EINTERN void e_comp_wl_shell_surface_ready(E_Client *ec);
575 E_API E_Client* e_comp_wl_topmost_parent_get(E_Client *ec);
577 EINTERN enum wl_output_transform e_comp_wl_output_pending_buffer_transform_get(E_Client *ec);
578 E_API enum wl_output_transform e_comp_wl_output_buffer_transform_get(E_Client *ec);
579 E_API void e_comp_wl_map_size_cal_from_buffer(E_Client *ec);
580 E_API void e_comp_wl_map_size_cal_from_viewport(E_Client *ec);
581 E_API void e_comp_wl_map_apply(E_Client *ec);
583 EINTERN void e_comp_wl_map_inv_coord_get(E_Client *ec, int x, int y, int *mx, int *my);
585 E_API void e_comp_wl_input_cursor_timer_enable_set(Eina_Bool enabled);
586 EINTERN void e_comp_wl_send_event_device(struct wl_client *wc, uint32_t timestamp, Ecore_Device *dev, uint32_t serial);
588 EINTERN Eina_Bool e_comp_wl_key_send(E_Client *ec, int keycode, Eina_Bool pressed, Ecore_Device *dev, uint32_t time);
589 EINTERN Eina_Bool e_comp_wl_key_cancel(E_Client *ec, int keycode, Ecore_Device *dev, uint32_t time);
590 EINTERN Eina_Bool e_comp_wl_touch_send(E_Client *ec, int idx, int x, int y, Eina_Bool pressed, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, uint32_t time);
591 EINTERN Eina_Bool e_comp_wl_touch_update_send(E_Client *ec, int idx, int x, int y, Ecore_Device *dev, double radius_x, double radius_y, double pressure, double angle, uint32_t time);
592 EINTERN Eina_Bool e_comp_wl_touch_cancel_send(E_Client *ec);
593 EINTERN Eina_Bool e_comp_wl_mouse_button_send(E_Client *ec, int buttons, Eina_Bool pressed, Ecore_Device *dev, uint32_t time);
594 EINTERN Eina_Bool e_comp_wl_mouse_move_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time);
595 EINTERN Eina_Bool e_comp_wl_mouse_wheel_send(E_Client *ec, int direction, int z, Ecore_Device *dev, uint32_t time);
596 EINTERN Eina_Bool e_comp_wl_mouse_in_send(E_Client *ec, int x, int y, Ecore_Device *dev, uint32_t time);
597 EINTERN Eina_Bool e_comp_wl_mouse_out_send(E_Client *ec, Ecore_Device *dev, uint32_t time);
598 EINTERN void e_comp_wl_mouse_in_renew(E_Client *ec, int buttons, int x, int y, void *data, Evas_Modifier *modifiers, Evas_Lock *locks, unsigned int timestamp, Evas_Event_Flags event_flags, Evas_Device *dev, Evas_Object *event_src);
599 EINTERN void e_comp_wl_mouse_out_renew(E_Client *ec, int buttons, int x, int y, void *data, Evas_Modifier *modifiers, Evas_Lock *locks, unsigned int timestamp, Evas_Event_Flags event_flags, Evas_Device *dev, Evas_Object *event_src);
600 EINTERN Eina_Bool e_comp_wl_key_process(Ecore_Event_Key *ev, int type);
602 EINTERN Eina_Bool e_comp_wl_cursor_hide(E_Client *ec);
604 EINTERN void e_comp_wl_pos_convert(int width, int height, int transform, int scale, int sx, int sy, int *bx, int *by);
605 EINTERN void e_comp_wl_pos_convert_inverse(int width, int height, int transform, int scale, int bx, int by, int *sx, int *sy);
606 EINTERN void e_comp_wl_rect_convert(int width, int height, int transform, int scale, int sx, int sy, int sw, int sh, int *bx, int *by, int *bw, int *bh);
607 EINTERN void e_comp_wl_rect_convert_inverse(int width, int height, int transform, int scale, int bx, int by, int bw, int bh, int *sx, int *sy, int *sw, int *sh);
608 EINTERN E_Comp_Wl_Output* e_comp_wl_output_find(E_Client *ec);
610 EINTERN void e_comp_wl_feed_focus_in(E_Client *ec);
612 EINTERN extern int E_EVENT_WAYLAND_GLOBAL_ADD;
614 EINTERN Eina_Bool e_comp_wl_commit_sync_client_geometry_add(E_Client *ec, E_Client_Demand_Geometry mode, uint32_t serial, int32_t x, int32_t y, int32_t w, int32_t h);
615 EINTERN void e_comp_wl_trace_serial_debug(Eina_Bool on);
616 EINTERN Eina_Bool e_comp_wl_commit_sync_configure(E_Client *ec);
618 EINTERN Eina_Bool e_comp_wl_pid_output_configured_resolution_send(pid_t pid, int w, int h);
620 EINTERN void e_comp_wl_surface_state_init(E_Comp_Wl_Surface_State *state, int w, int h);
621 EINTERN void e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state);
622 EINTERN void e_comp_wl_hook_call(E_Comp_Wl_Hook_Point hookpoint, E_Client *ec);
623 EINTERN void e_comp_wl_surface_state_finish(E_Comp_Wl_Surface_State *state);
624 EINTERN void e_comp_wl_surface_state_buffer_set(E_Comp_Wl_Surface_State *state, E_Comp_Wl_Buffer *buffer);
626 EINTERN Eina_Bool e_comp_wl_surface_viewport_get(E_Client *ec, Eina_Rectangle *buffer_viewport, Eina_Rectangle *output_viewport, unsigned int *transform);
628 EINTERN Eina_Bool e_comp_wl_surface_role_set(E_Client *ec, const char *role_name, struct wl_resource *error_resource, uint32_t error_code);
629 EINTERN const char *e_comp_wl_surface_role_get(E_Client *ec);