ecore_wl2: add user width and height for ignoring unexpected configure event.
[platform/upstream/efl.git] / src / lib / ecore_wl2 / ecore_wl2_private.h
1 #ifndef _ECORE_WL2_PRIVATE_H
2 # define _ECORE_WL2_PRIVATE_H
3
4 # include <unistd.h>
5 # include "Ecore_Wl2.h"
6 # include "Ecore_Input.h"
7 # include <xkbcommon/xkbcommon-compose.h>
8 # include "www-client-protocol.h"
9 # include "ecore_wl2_internal.h"
10
11 # define EFL_TEAMWORK_VERSION 2
12 # include "teamwork-client-protocol.h"
13
14 # include "session-recovery-client-protocol.h"
15
16 # include "xdg-shell-client-protocol.h"
17 # include "xdg-shell-unstable-v6-client-protocol.h"
18 # include "efl-aux-hints-client-protocol.h"
19
20 // TIZEN_ONLY : To use tizen protocols
21 # include <wayland-extension/tizen-extension-client-protocol.h>
22 # include "tizen-policy-ext-client-protocol.h"
23 //
24
25 // TIZEN_ONLY(20171226) : evas tbm_buf backend
26 #include <tbm_bufmgr.h>
27 #include <tbm_surface.h>
28 #include <tbm_surface_queue.h>
29 //
30
31 // TIZEN_ONLY(20190430) : support client appinfo
32 #include <wayland-extension/tizen-launch-client-protocol.h>
33 //
34
35 // TIZEN_ONLY(20190807): Support for wl_egl interface
36 #include "wayland-egl.h"
37 #include "wayland-egl-tizen.h"
38 //
39
40 extern int _ecore_wl2_log_dom;
41 extern Eina_Bool no_session_recovery;
42
43 # ifdef EAPI
44 #  undef EAPI
45 # endif
46
47 # ifdef __GNUC__
48 #  if __GNUC__ >= 4
49 #   define EAPI __attribute__ ((visibility("default")))
50 #  else
51 #   define EAPI
52 #  endif
53 # else
54 #  define EAPI
55 # endif
56
57 # ifdef ECORE_WL2_DEFAULT_LOG_COLOR
58 #  undef ECORE_WL2_DEFAULT_LOG_COLOR
59 # endif
60 # define ECORE_WL2_DEFAULT_LOG_COLOR EINA_COLOR_BLUE
61
62 # ifdef ERR
63 #  undef ERR
64 # endif
65 # define ERR(...) EINA_LOG_DOM_ERR(_ecore_wl2_log_dom, __VA_ARGS__)
66
67 # ifdef DBG
68 #  undef DBG
69 # endif
70 # define DBG(...) EINA_LOG_DOM_DBG(_ecore_wl2_log_dom, __VA_ARGS__)
71
72 # ifdef INF
73 #  undef INF
74 # endif
75 # define INF(...) EINA_LOG_DOM_INFO(_ecore_wl2_log_dom, __VA_ARGS__)
76
77 # ifdef WRN
78 #  undef WRN
79 # endif
80 # define WRN(...) EINA_LOG_DOM_WARN(_ecore_wl2_log_dom, __VA_ARGS__)
81
82 # ifdef CRI
83 #  undef CRI
84 # endif
85 # define CRI(...) EINA_LOG_DOM_CRIT(_ecore_wl2_log_dom, __VA_ARGS__)
86
87 typedef struct _Ecore_Wl2_Input_Devices
88 {
89    Eo *pointer_dev;
90    Eo *keyboard_dev;
91    Eo *touch_dev;
92    Eo *seat_dev;
93    int window_id;
94 } Ecore_Wl2_Input_Devices;
95
96 struct _Ecore_Wl2_Display
97 {
98    int refs;
99    char *name;
100    pid_t pid;
101
102    struct
103      {
104         struct wl_display *display;
105         struct wl_registry *registry;
106         struct wl_compositor *compositor;
107         struct wl_subcompositor *subcompositor;
108         struct wl_data_device_manager *data_device_manager;
109         int data_device_manager_version;
110         struct wl_shm *shm;
111         struct zwp_linux_dmabuf_v1 *dmabuf;
112         struct zxdg_shell_v6 *zxdg_shell;
113         struct xdg_wm_base *xdg_wm_base;
114         struct www *www;
115         struct zwp_e_session_recovery *session_recovery;
116         struct efl_aux_hints *efl_aux_hints;
117         struct zwp_teamwork *teamwork;
118         struct efl_hints *efl_hints;
119         // TIZEN_ONLY : To use tizen protocols
120         struct tizen_policy *tz_policy;
121         struct tizen_policy_ext *tz_policy_ext;
122         struct tizen_surface *tz_surf;
123         struct tizen_effect *tz_effect;
124         struct tizen_indicator *tz_indicator;
125         struct tizen_clipboard *tz_clipboard;
126         struct tizen_keyrouter *tz_keyrouter;
127         struct tizen_input_device_manager *tz_input_device_manager;
128         //
129         //TIZEN_ONLY(20171115): support output transform
130         struct tizen_screen_rotation *tz_screen_rotation;
131         //
132         //TIZEN_ONLY(20180810): support client demand move resize
133         struct tizen_move_resize *tz_moveresize;
134         //
135         // TIZEN_ONLY(20190430): support client appinfo
136         struct tizen_launch_appinfo *tz_appinfo;
137         //
138         // TIZEN_ONLY(20200601): support sync between ui and video
139         struct tizen_video *tz_video;
140         //
141         // TIZEN_ONLY(20200601): support tizen_renderer
142         struct tizen_renderer *tz_renderer;
143         //
144         //TIZEN_ONLY(20210503): support foreign shell
145         struct wtz_exporter *fs_exporter;
146         //
147
148         int compositor_version;
149      } wl;
150
151    uint32_t serial;
152
153    struct xkb_context *xkb_context;
154
155    Ecore_Idle_Enterer *idle_enterer;
156    Ecore_Fd_Handler *fd_hdl;
157
158    Eina_Hash *globals;
159    Ecore_Timer *recovery_timer;
160
161    Eina_Inlist *windows;
162    Eina_Inlist *outputs;
163    Eina_Inlist *inputs;
164    Eina_Inlist *seats;
165
166    int syncs;
167
168    Eina_Bool sync_done : 1;
169    Eina_Bool shell_done : 1;
170    Eina_Bool recovering : 1;
171
172 // TIZEN_ONLY(20171107): support a tizen_keyrouter interface
173    int sync_ref_count;
174 //
175 // TIZEN_ONLY(20171114): active angle
176    int active_angle;
177 //
178 // TIZEN_ONLY(20171129): thread-safety for wl
179    Eina_Bool prepare_read;
180 // End of TIZEN_ONLY(20171129)
181 };
182
183 struct _Ecore_Wl2_Subsurface
184 {
185    EINA_INLIST;
186
187    int x, y;
188
189    Ecore_Wl2_Window *parent;
190
191    struct
192      {
193         struct wl_surface *surface;
194         struct wl_subsurface *subsurface;
195
196         // TIZEN_ONLY(20201022): support restack video
197         struct tizen_viewport *viewport;
198         tbm_surface_h tbm_surface;
199         struct wl_buffer *wl_buffer;
200         //
201
202         //TIZEN_ONLY(20210503): support foreign shell
203         struct wtz_exported_shell *fs;
204         char *fs_handle;
205         //
206      } wl;
207
208    // TIZEN_ONLY(20201022): support restack video
209    Eina_Bool video : 1;
210    //
211
212    Eina_Bool sync : 1;
213 };
214
215 struct _Ecore_Wl2_Aux_Hint
216 {
217    EINA_INLIST;
218
219    int id;
220    const char *hint, *val;
221 };
222
223 struct _Ecore_Wl2_Frame_Cb_Handle
224 {
225    EINA_INLIST;
226    Ecore_Wl2_Window *win;
227    Ecore_Wl2_Frame_Cb cb;
228    void *data;
229 };
230
231 typedef struct _Ecore_Wl2_Window_Configure_State
232 {
233    uint32_t serial;
234    Eina_Rectangle geometry;
235    Eina_Bool minimized : 1;
236    Eina_Bool maximized : 1;
237    Eina_Bool fullscreen : 1;
238    Eina_Bool focused : 1;
239    Eina_Bool resizing : 1;
240 } Ecore_Wl2_Window_Configure_State;
241
242 struct _Ecore_Wl2_Window
243 {
244    EINA_INLIST;
245
246    Ecore_Wl2_Display *display;
247
248    Ecore_Wl2_Window *parent;
249    Ecore_Wl2_Input *grab;
250
251    Ecore_Wl2_Surface *wl2_surface;
252
253    int id, rotation, surface_id;
254    const char *title;
255    const char *class;
256    const char *role;
257
258    struct wl_surface *surface;
259    void *buffer;
260    struct wl_callback *callback;
261    struct www_surface *www_surface;
262    struct xdg_surface *xdg_surface;
263    struct xdg_toplevel *xdg_toplevel;
264    struct xdg_popup *xdg_popup;
265
266    struct zxdg_surface_v6 *zxdg_surface;
267    struct zxdg_toplevel_v6 *zxdg_toplevel;
268    struct zxdg_popup_v6 *zxdg_popup;
269
270    // TIZEN_ONLY(20150424) : tizen_visibility
271    struct tizen_visibility *tz_visibility;
272    struct tizen_position *tz_position;
273    struct tizen_rotation *tz_rotation;
274    struct tizen_resource *tz_resource;
275    unsigned int resource_id;
276    //
277
278    void (*cb_close) (void *data, Ecore_Wl2_Window *win);
279    void  *cb_close_data;
280
281    Eina_Stringshare *uuid;
282
283    void (*xdg_configure_ack)(struct xdg_surface *surface, uint32_t serial);
284    void (*xdg_set_min_size)(struct xdg_toplevel *toplevel, int32_t w, int32_t h);
285    void (*xdg_set_max_size)(struct xdg_toplevel *toplevel, int32_t w, int32_t h);
286
287    void (*zxdg_configure_ack)(struct zxdg_surface_v6 *surface, uint32_t serial);
288    void (*zxdg_set_min_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h);
289    void (*zxdg_set_max_size)(struct zxdg_toplevel_v6 *toplevel, int32_t w, int32_t h);
290
291    Eina_Rectangle saved;
292    Eina_Rectangle opaque;
293    Eina_Rectangle input_rect;
294    // TIZEN_ONLY(20160201) : support to handle input rectangle
295    struct wl_region *input_region;
296    //
297
298    Ecore_Wl2_Window_Type type;
299
300    struct
301    {
302       int w, h;
303       unsigned int aspect;
304       Eina_Bool set : 1;
305    } aspect;
306
307    struct
308    {
309       int w, h;
310       Eina_Bool set : 1;
311    } weight;
312
313    Eina_Inlist *subsurfs;
314    Eina_List *supported_aux_hints;
315    Eina_Inlist *frame_callbacks;
316
317    Eina_List *outputs;
318
319    Ecore_Wl2_Window_Configure_State set_config;
320    Ecore_Wl2_Window_Configure_State req_config;
321    Ecore_Wl2_Window_Configure_State def_config;
322
323    //TIZEN_ONLY(20171115): support output transform
324    Eina_Bool ignore_output_transform : 1;
325    //
326    //TODO: move the iconified into the Ecore_Wl2_Window_Configure_State structure.
327    // TIZEN_ONLY(20150822)
328    Eina_Bool iconified : 1;
329    //
330
331    Eina_Bool alpha : 1;
332    Eina_Bool transparent : 1;
333
334    Eina_Bool input_set : 1;
335    Eina_Bool opaque_set : 1;
336
337    Eina_Bool focus_skip : 1;
338    Eina_Bool floating : 1;
339
340    // TIZEN_ONLY(20150703) : support conformant
341    Eina_Bool conformant : 1;
342    //
343
344    Eina_Bool commit_pending : 1;
345
346    struct
347      {
348         int configure_event;
349         int user_w, user_h;
350         Eina_Bool configure : 1;
351         Eina_Bool min : 1;
352         Eina_Bool max : 1;
353         Eina_Bool geom : 1;
354         Eina_Bool opaque : 1;
355         Eina_Bool input : 1;
356         Eina_Bool fullscreen : 1;
357         Eina_Bool maximized : 1;
358         Eina_Bool user_resize : 1;
359      } pending;
360
361    struct
362      {
363         Eina_Bool supported : 1;
364         Eina_Bool app_set : 1;
365         int preferred_rot;
366         int *available_rots;
367         unsigned int count;
368         // TIZEN_ONLY
369         unsigned int serial;
370         struct
371           {
372              int x, y, w, h;
373              Eina_Bool valid : 1;
374           } geometry_hints[4];
375         //
376      } wm_rot;
377    Eina_Bool has_buffer : 1;
378    Eina_Bool updating : 1;
379    Eina_Bool visible : 1;
380
381    // TIZEN_ONLY(20171108) : indicator information
382    struct
383      {
384         int x, y, w, h;
385         Ecore_Wl2_Indicator_State state;
386         Ecore_Wl2_Indicator_Opacity_Mode mode;
387         Ecore_Wl2_Indicator_Visible_Type type;
388      } indicator;
389    //
390
391    // TIZEN_ONLY(20171108) : clipboard information
392    struct
393      {
394         int x, y, w, h;
395         Ecore_Wl2_Clipboard_State state;
396      } clipboard;
397    //
398
399    // TIZEN_ONLY(20171108) : keyboard information
400    struct
401      {
402         int x, y, w, h;
403         Ecore_Wl2_Virtual_Keyboard_State state;
404      } keyboard;
405    //
406
407    // TIZEN_ONLY(20161228) : tizen_rotation v2
408    void (*cb_rot_changed)(Ecore_Wl2_Window *win, int rot, Eina_Bool resize, int w, int h, void *data);
409    void *cb_rot_changed_data;
410    //
411
412    void (*cb_visibility) (void *data, Ecore_Wl2_Window *win, Eina_Bool visibility);
413    void *cb_visibility_data;
414
415    // TIZEN_ONLY(20171207): add functions to set client's custom cursors
416    struct
417      {
418         struct wl_surface *surface;
419         int hot_x, hot_y;
420         Eina_Bool set : 1;
421         Ecore_Wl2_Input *device;
422         const char *cursor_name;
423      } pointer;
424    //
425
426    // TIZEN_ONLY(20190807): Support for wl_egl interface
427    Ecore_Wl2_Egl_Window *egl_win;
428    //
429
430    // TIZEN_ONLY(20200601): support sync between ui and video
431    struct
432      {
433         struct wl_surface *surface;
434         struct wl_subsurface *subsurface;
435         struct tizen_viewport *viewport;
436         tbm_surface_h tbm_surface;
437         struct wl_buffer *wl_buffer;
438         Eina_Bool sync : 1;
439      } video;
440
441    /* no need to be a member of video struct,
442       because no need to init more than one */
443    struct wayland_tbm_client *tbm_client;
444    //
445
446    // TIZEN_ONLY(20200601): support tizen_renderer_surface
447    struct tizen_renderer_surface *tz_renderer_surface;
448    //
449
450    // TIZEN_ONLY(20210330): for maintain internal aux hint list
451    Eina_List *aux_hints;
452    //
453
454    // TIZEN_ONLY(20210903): for transient_for below
455    Eina_Bool below_child;
456    //
457
458    // TIZEN_ONLY(20221121): for maximize direction
459    Ecore_Wl2_Maximize_Direction maximize_direction;
460    //
461 };
462
463 struct _Ecore_Wl2_Output
464 {
465    EINA_INLIST;
466
467    Ecore_Wl2_Display *display;
468    struct wl_output *wl_output;
469
470    int mw, mh, transform;
471    const char *make, *model;
472    Eina_Rectangle geometry;
473 };
474
475 typedef struct _Ecore_Wl2_Dnd_Source
476 {
477    Ecore_Wl2_Input *input;
478
479    int x, y;
480    Ecore_Fd_Handler *fdh;
481
482    struct wl_data_offer *offer;
483    struct wl_array types;
484    uint32_t dnd_action;
485    uint32_t source_actions;
486    Ecore_Wl2_Selection_Type sel_type;
487    Eina_Bool active_read;
488    void *read_data;
489    unsigned int len;
490 } Ecore_Wl2_Dnd_Source;
491
492 // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
493 struct _Ecore_Wl2_Tizen_Input_Eo_Device
494 {
495    int window_id;
496    Eo *eo_dev;
497 };
498
499 struct _Ecore_Wl2_Tizen_Input_Device
500 {
501    struct tizen_input_device *tz_device;
502    Ecore_Wl2_Input *input;
503    const char *name;
504    const char *identifier;
505    Ecore_Device_Class clas;
506    Ecore_Device_Subclass subclas;
507    struct wl_seat *seat;
508    Ecore_Device *device;
509 };
510
511 typedef struct _Ecore_Wl2_Touch_Axis
512 {
513    double radius_x;
514    double radius_y;
515    double pressure;
516    double angle;
517 } Ecore_Wl2_Touch_Axis;
518
519 //
520
521 /** TODO: Refactor ALL Input code :(
522  *
523  * wl_seat is a GROUP of Input Devices (such as):
524  *      keyboards, pointers, touch devices
525  */
526 struct _Ecore_Wl2_Pointer
527 {
528    EINA_INLIST;
529
530    Ecore_Wl2_Seat *seat;
531
532    double sx, sy;
533    unsigned int button;
534    unsigned int enter_serial;
535
536    struct
537      {
538         unsigned int button, count, timestamp;
539         Ecore_Wl2_Window *window;
540      } grab;
541
542    Ecore_Wl2_Window *focus;
543
544    Eina_List *resources;
545 };
546
547 struct _Ecore_Wl2_Keyboard
548 {
549    EINA_INLIST;
550
551    Ecore_Wl2_Seat *seat;
552
553    unsigned int modifiers;
554
555    struct
556      {
557         struct xkb_keymap *keymap;
558         struct xkb_state *state;
559         xkb_mod_mask_t control_mask;
560         xkb_mod_mask_t alt_mask;
561         xkb_mod_mask_t shift_mask;
562         xkb_mod_mask_t win_mask;
563         xkb_mod_mask_t scroll_mask;
564         xkb_mod_mask_t num_mask;
565         xkb_mod_mask_t caps_mask;
566         xkb_mod_mask_t altgr_mask;
567         unsigned int mods_depressed;
568         unsigned int mods_latched;
569         unsigned int mods_locked;
570         unsigned int mods_group;
571      } xkb;
572
573    struct
574      {
575         Ecore_Timer *tmr;
576         unsigned int sym, key, time;
577         double rate, delay;
578         Eina_Bool enabled : 1;
579      } repeat;
580
581    struct
582      {
583         unsigned int button, count, timestamp;
584         Ecore_Wl2_Window *window;
585      } grab;
586
587    Ecore_Wl2_Window *focus;
588
589    Eina_List *resources;
590 };
591
592 struct _Ecore_Wl2_Touch
593 {
594    EINA_INLIST;
595
596    struct
597      {
598         unsigned int button, count, timestamp;
599         Ecore_Wl2_Window *window;
600      } grab;
601 };
602
603 struct _Ecore_Wl2_Seat
604 {
605    EINA_INLIST;
606
607    uint32_t id;
608    uint32_t version;
609    const char *name;
610    struct wl_global *global;
611    const struct wl_seat_interface *implementation;
612
613    struct
614      {
615         struct wl_global *global;
616         struct wl_resource *resource;
617      } im;
618
619    Ecore_Wl2_Bind_Cb bind_cb;
620    Ecore_Wl2_Unbind_Cb unbind_cb;
621
622    Ecore_Wl2_Pointer *pointer;
623    int pointer_count;
624
625    Ecore_Wl2_Keyboard *keyboard;
626    int keyboard_count;
627
628    Ecore_Wl2_Touch *touch;
629    int touch_count;
630
631    Eina_List *resources;
632 };
633
634 struct _Ecore_Wl2_Input
635 {
636    EINA_INLIST;
637
638    Ecore_Wl2_Display *display;
639
640    unsigned int timestamp;
641
642    struct
643      {
644         struct wl_seat *seat;
645         struct wl_pointer *pointer;
646         struct wl_keyboard *keyboard;
647         struct wl_touch *touch;
648      } wl;
649
650    struct
651      {
652         struct wl_data_device *device;
653         struct
654         {
655            struct wl_data_source *source;
656            struct wl_array types;
657            uint32_t serial;
658         } selection;
659         struct
660         {
661            struct wl_data_source *source;
662            struct wl_array types;
663            uint32_t action;
664            uint32_t serial;
665         } drag;
666      } data;
667
668    struct
669      {
670         const char *name;
671         unsigned int size;
672         struct wl_surface *surface;
673         int hot_x, hot_y;
674         // TIZEN_ONLY(20171207): add functions to set client's custom cursors
675         struct wl_cursor *cursor;
676         struct wl_callback *frame_cb;
677         Ecore_Timer *timer;
678         unsigned int current_index;
679         const char *theme_name;
680         struct wl_cursor_theme *theme;
681         //
682      } cursor;
683
684    struct
685      {
686         double sx, sy;
687         unsigned int button;
688         unsigned int enter_serial;
689      } pointer;
690
691    struct
692      {
693         unsigned int modifiers;
694      } keyboard;
695
696    struct
697      {
698         Ecore_Wl2_Window *pointer;
699         Ecore_Wl2_Window *prev_pointer;
700         Ecore_Wl2_Window *keyboard;
701         Ecore_Wl2_Window *touch;
702      } focus;
703
704    struct
705      {
706         unsigned int button, count, timestamp;
707         Ecore_Wl2_Window *window;
708         unsigned int touch_count;
709      } grab;
710
711    struct
712      {
713         struct xkb_keymap *keymap;
714         struct xkb_state *state;
715         struct xkb_state *maskless_state;
716         struct xkb_compose_table *compose_table;
717         struct xkb_compose_state *compose_state;
718         xkb_mod_mask_t control_mask;
719         xkb_mod_mask_t alt_mask;
720         xkb_mod_mask_t shift_mask;
721         xkb_mod_mask_t win_mask;
722         xkb_mod_mask_t scroll_mask;
723         xkb_mod_mask_t num_mask;
724         xkb_mod_mask_t caps_mask;
725         xkb_mod_mask_t altgr_mask;
726         unsigned int mods_depressed;
727         unsigned int mods_latched;
728         unsigned int mods_locked;
729         unsigned int mods_group;
730      } xkb;
731
732    struct
733      {
734         Ecore_Timer *timer;
735         unsigned int sym, sym_name, key, time;
736         double rate, delay;
737         double intime; //next repeat is expected in the time. (+ 0.0166 for 1 frame variable capacity)
738         Eina_Bool enabled : 1;
739         Eina_Bool repeating : 1;
740         Eina_Bool changed : 1;
741      } repeat;
742
743    struct
744    {
745       Ecore_Wl2_Offer *offer;
746       uint32_t enter_serial;
747       Ecore_Window window_id;
748    } drag, selection;
749 // TIZEN_ONLY(20170227) : tizen clipboard v2
750    Eina_Bool is_data_only;
751 //
752
753    unsigned int seat_version;
754    unsigned int id;
755    Eina_Stringshare *name;
756
757    Ecore_Event_Handler *dev_add_handler;
758    Ecore_Event_Handler *dev_remove_handler;
759    Eina_List *devices_list;
760
761 // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
762    Ecore_Event_Handler *tzdev_add_handler;
763    Ecore_Event_Handler *tzdev_remove_handler;
764    struct
765      {
766         Eina_List *devices;
767         Ecore_Wl2_Tizen_Input_Device *last_device_ptr;
768         Ecore_Wl2_Tizen_Input_Device *last_device_touch;
769         Ecore_Wl2_Tizen_Input_Device *last_device_kbd;
770      } devmgr;
771    struct
772      {
773         Ecore_Wl2_Touch_Axis *touch_axis;
774         Ecore_Wl2_Touch_Axis last_touch_axis;
775         int max_count;
776      } touch;
777 //
778
779 // TIZEN_ONLY(20171107): support a tizen_keyrouter interface
780    Eina_Bool caps_update;
781 //
782
783 // TIZEN_ONLY(20180404): support a tizen_keyrouter event surface event
784    Ecore_Wl2_Window *key_win;
785    Ecore_Wl2_Window *repeat_win;
786    int key_mode;
787 //
788 };
789
790 typedef struct Ecore_Wl2_Event_Window_WWW
791 {
792    unsigned int window;
793    int x_rel;
794    int y_rel;
795    uint32_t timestamp;
796 } Ecore_Wl2_Event_Window_WWW;
797
798 typedef struct Ecore_Wl2_Event_Window_WWW_Drag
799 {
800    unsigned int window;
801    Eina_Bool dragging;
802 } Ecore_Wl2_Event_Window_WWW_Drag;
803
804 typedef struct _Buffer_Handle Buffer_Handle;
805 typedef struct _Ecore_Wl2_Buffer
806 {
807    struct wl_buffer *wl_buffer;
808    // TIZEN_ONLY(20171226) : evas tbm_buf backend
809    struct wl_display *wl_display;
810    struct wl_surface *wl_surface;
811    struct wl_registry *registry;
812    struct wayland_tbm_client *tbm_client;
813    tbm_surface_h tbm_surface;
814    tbm_surface_info_s tbm_info;
815    void *tbm_queue;
816    int wait_release;
817    Eina_Bool resize : 1;
818    int compositor_version;
819    int frame_age;
820    // TIZEN_ONLY(20171226) : evas tbm_buf backend
821
822    int size;
823    int w, h;
824    int age;
825    unsigned long stride;
826    Buffer_Handle *bh;
827    int fd;
828    void *mapping;
829
830    int index;
831    Eina_Bool locked : 1;
832    Eina_Bool busy : 1;
833    Eina_Bool orphaned : 1;
834    Eina_Bool alpha : 1;
835 } Ecore_Wl2_Buffer;
836
837 typedef struct _Ecore_Wl2_Surface
838 {
839    void *private_data;
840    Ecore_Wl2_Window *wl2_win;
841
842    int w, h;
843    Ecore_Wl2_Surface_Interface *funcs;
844    Ecore_Event_Handler *offscreen_handler;
845    Eina_Bool alpha : 1;
846    unsigned int frame_age;  // TIZEN_ONLY(20171226) : evas tbm_buf backend
847 } Ecore_Wl2_Surface;
848
849 // TIZEN_ONLY(20190807): Support for wl_egl interface
850 struct _Ecore_Wl2_Egl_Window
851 {
852    Ecore_Wl2_Window *win;
853    struct wl_egl_window *native_win;
854    int dx, dy, w, h;
855    Eina_Bool support_pre_rotation;
856
857    struct
858    {
859       uint32_t serial;
860       int w, h;
861    } sync_geom;
862
863    struct
864    {
865       int buffer; /* angle of buffer_transform: screen rotation + window rotation */
866       int win;    /* angle of window_transform: window rotation only */
867    } rot;
868 };
869 //
870
871 EAPI extern int _ecore_wl2_event_window_www;
872 EAPI extern int _ecore_wl2_event_window_www_drag;
873
874 Ecore_Wl2_Window *_ecore_wl2_display_window_surface_find(Ecore_Wl2_Display *display, struct wl_surface *wl_surface);
875 void _display_event_free(void *d, void *event EINA_UNUSED);
876
877 void _ecore_wl2_output_add(Ecore_Wl2_Display *display, unsigned int id);
878 void _ecore_wl2_output_del(Ecore_Wl2_Output *output);
879
880 void _ecore_wl2_input_add(Ecore_Wl2_Display *display, unsigned int id, unsigned int version);
881 void _ecore_wl2_input_del(Ecore_Wl2_Input *input);
882
883 void _ecore_wl2_input_ungrab(Ecore_Wl2_Input *input);
884 void _ecore_wl2_input_grab(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, unsigned int button);
885
886 void _ecore_wl2_input_cursor_set(Ecore_Wl2_Input *input, const char *cursor);
887 Eina_Bool _ecore_wl2_input_cursor_update(void *data);
888 void _ecore_wl2_input_window_remove(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window);
889
890 void _ecore_wl2_dnd_add(Ecore_Wl2_Input *input, struct wl_data_offer *offer);
891 void _ecore_wl2_dnd_enter(Ecore_Wl2_Input *input, struct wl_data_offer *offer, struct wl_surface *surface, int x, int y, uint32_t serial);
892 void _ecore_wl2_dnd_leave(Ecore_Wl2_Input *input);
893 void _ecore_wl2_dnd_motion(Ecore_Wl2_Input *input, int x, int y, uint32_t serial);
894 void _ecore_wl2_dnd_drop(Ecore_Wl2_Input *input);
895 void _ecore_wl2_dnd_selection(Ecore_Wl2_Input *input, struct wl_data_offer *offer);
896 void _ecore_wl2_dnd_del(Ecore_Wl2_Dnd_Source *source);
897
898 void _ecore_wl2_subsurf_unmap(Ecore_Wl2_Subsurface *subsurf);
899 void _ecore_wl2_subsurf_free(Ecore_Wl2_Subsurface *subsurf);
900
901 void _ecore_wl2_window_surface_create(Ecore_Wl2_Window *window);
902 void _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window);
903 void _ecore_wl2_window_www_surface_init(Ecore_Wl2_Window *window);
904 void _ecore_wl2_window_semi_free(Ecore_Wl2_Window *window);
905
906 void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer);
907 Eina_Bool _ecore_wl2_display_sync_get(void);
908
909 void _ecore_wl2_buffer_test(Ecore_Wl2_Display *ewd);
910
911 EAPI void ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h);
912
913 Ecore_Wl2_Output *_ecore_wl2_output_find(Ecore_Wl2_Display *dsp, struct wl_output *op);
914
915 // TIZEN_ONLY(20171107): support a tizen_keyrouter interface
916 int ecore_wl2_input_keycode_from_keysym(struct xkb_keymap *keymap, xkb_keysym_t keysym, xkb_keycode_t **keycodes);
917 void _ecore_wl2_keyrouter_setup(Ecore_Wl2_Display *ewd, unsigned int id, unsigned int version);
918 Eina_Hash *_ecore_wl2_keygrab_hash_get(void);
919 //
920
921 // TIZEN_ONLY(20171109): support a tizen_input_device_manager interface
922 void _ecore_wl2_input_device_manager_setup(Ecore_Wl2_Display *ewd, unsigned int id, unsigned int version);
923 //
924 // TIZEN_ONLY(20180125): generate Ecore_Device_Add/Del events
925 void _ecore_wl2_input_devices_send(Ecore_Wl2_Input *input, Ecore_Wl2_Window *win);
926 //
927
928 //TIZEN_ONLY(20171115): support output transform
929 void _ecore_wl2_window_ignore_output_transform_set(Ecore_Wl2_Window *window, Eina_Bool ignore);
930 //
931
932 //TIZEN_ONLY(20171216): add ecore_wl2_window_find
933 void _ecore_wl2_window_init(void);
934 void _ecore_wl2_window_shutdown(void);
935 //
936
937 // TIZEN_ONLY(20180125): generate Ecore_Device_Add/Del events
938 Eina_Hash *_ecore_wl2_window_hash_get(void);
939 //
940
941 // TIZEN_ONLY(20201022): support restack video
942 Eina_Bool buffer_fill_zero(tbm_surface_h surface);
943 //
944
945 // TIZEN_ONLY(20221208): support default cursor configuration
946 void _ecore_wl2_cursor_config_init(void);
947 void _ecore_wl2_cursor_config_shutdown(void);
948 void _ecore_wl2_cursor_config_reload(void);
949 const char * _ecore_wl2_cursor_config_name_get(void);
950 Eina_Bool _ecore_wl2_cursor_config_save(void);
951 //
952
953 #endif