aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
diff options
context:
space:
mode:
Diffstat (limited to 'libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h')
-rw-r--r--libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h271
1 files changed, 226 insertions, 45 deletions
diff --git a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
index fdf6314..7dab37c 100644
--- a/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
+++ b/libraries/ecore/src/lib/ecore_wayland/Ecore_Wayland.h
@@ -1,8 +1,13 @@
1#ifndef _ECORE_WAYLAND_H_ 1#ifndef _ECORE_WAYLAND_H_
2# define _ECORE_WAYLAND_H_ 2# define _ECORE_WAYLAND_H_
3 3
4# define GL_GLEXT_PROTOTYPES
5
4# include <Eina.h> 6# include <Eina.h>
5# include <wayland-client.h> 7# include <wayland-client.h>
8# include <wayland-egl.h> // NB: already includes wayland-client.h
9# include <EGL/egl.h>
10# include <EGL/eglext.h>
6 11
7# ifdef EAPI 12# ifdef EAPI
8# undef EAPI 13# undef EAPI
@@ -18,71 +23,233 @@
18# define EAPI 23# define EAPI
19# endif 24# endif
20 25
26typedef enum _Ecore_Wl_Window_Type Ecore_Wl_Window_Type;
27typedef enum _Ecore_Wl_Window_Buffer_Type Ecore_Wl_Window_Buffer_Type;
28
29typedef struct _Ecore_Wl_Display Ecore_Wl_Display;
30typedef struct _Ecore_Wl_Output Ecore_Wl_Output;
31typedef struct _Ecore_Wl_Input Ecore_Wl_Input;
32# ifndef _ECORE_WAYLAND_WINDOW_PREDEF
33typedef struct _Ecore_Wl_Window Ecore_Wl_Window;
34# endif
35typedef struct _Ecore_Wl_Dnd_Source Ecore_Wl_Dnd_Source;
36typedef struct _Ecore_Wl_Dnd_Target Ecore_Wl_Dnd_Target;
37
21typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In; 38typedef struct _Ecore_Wl_Event_Mouse_In Ecore_Wl_Event_Mouse_In;
22typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out; 39typedef struct _Ecore_Wl_Event_Mouse_Out Ecore_Wl_Event_Mouse_Out;
23typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In; 40typedef struct _Ecore_Wl_Event_Focus_In Ecore_Wl_Event_Focus_In;
24typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out; 41typedef struct _Ecore_Wl_Event_Focus_Out Ecore_Wl_Event_Focus_Out;
42typedef struct _Ecore_Wl_Event_Window_Configure Ecore_Wl_Event_Window_Configure;
43typedef struct _Ecore_Wl_Event_Dnd_Enter Ecore_Wl_Event_Dnd_Enter;
44typedef struct _Ecore_Wl_Event_Dnd_Position Ecore_Wl_Event_Dnd_Position;
45typedef struct _Ecore_Wl_Event_Dnd_Leave Ecore_Wl_Event_Dnd_Leave;
46typedef struct _Ecore_Wl_Event_Dnd_Drop Ecore_Wl_Event_Dnd_Drop;
47typedef struct _Ecore_Wl_Event_Interfaces_Bound Ecore_Wl_Event_Interfaces_Bound;
25 48
26typedef struct _Ecore_Wl_Drag_Source Ecore_Wl_Drag_Source; 49enum _Ecore_Wl_Window_Type
50{
51 ECORE_WL_WINDOW_TYPE_TOPLEVEL,
52 ECORE_WL_WINDOW_TYPE_FULLSCREEN,
53 ECORE_WL_WINDOW_TYPE_MAXIMIZED,
54 ECORE_WL_WINDOW_TYPE_TRANSIENT,
55 ECORE_WL_WINDOW_TYPE_MENU,
56 ECORE_WL_WINDOW_TYPE_CUSTOM
57};
27 58
28typedef struct _Ecore_Wl_Event_Drag_Start Ecore_Wl_Event_Drag_Start; 59enum _Ecore_Wl_Window_Buffer_Type
29typedef struct _Ecore_Wl_Event_Drag_Stop Ecore_Wl_Event_Drag_Stop; 60{
61 ECORE_WL_WINDOW_BUFFER_TYPE_EGL_WINDOW,
62 ECORE_WL_WINDOW_BUFFER_TYPE_EGL_IMAGE,
63 ECORE_WL_WINDOW_BUFFER_TYPE_SHM
64};
30 65
31struct _Ecore_Wl_Event_Mouse_In 66struct _Ecore_Wl_Display
32{ 67{
33 int modifiers; 68 struct
34 int x, y; 69 {
70 struct wl_display *display;
71 struct wl_compositor *compositor;
72 struct wl_shell *shell;
73 struct wl_shm *shm;
74 struct wl_data_device_manager *data_device_manager;
75 } wl;
35 76
36 struct 77 struct
37 { 78 {
38 int x, y; 79 EGLDisplay display;
39 } root; 80 EGLConfig rgb_config;
81 EGLConfig argb_config;
82 EGLContext rgb_context;
83 EGLContext argb_context;
84 } egl;
85
86 int fd;
87 unsigned int mask;
88 Ecore_Fd_Handler *fd_hdl;
89
90 struct wl_list inputs;
91 struct wl_list outputs;
92
93 struct xkb_desc *xkb;
94
95 Ecore_Wl_Output *output;
96
97 PFNEGLCREATEIMAGEKHRPROC create_image;
98 PFNEGLDESTROYIMAGEKHRPROC destroy_image;
99
100 void (*output_configure)(Ecore_Wl_Output *output, void *data);
101 void *data;
102};
103
104struct _Ecore_Wl_Output
105{
106 Ecore_Wl_Display *display;
107 struct wl_output *output;
108 Eina_Rectangle allocation;
109 struct wl_list link;
110
111 void (*destroy) (Ecore_Wl_Output *output, void *data);
112 void *data;
113};
114
115struct _Ecore_Wl_Input
116{
117 Ecore_Wl_Display *display;
118 struct wl_input_device *input_device;
119 struct wl_data_device *data_device;
120
121 Ecore_Wl_Window *pointer_focus;
122 Ecore_Wl_Window *keyboard_focus;
123
124 unsigned int button;
125 unsigned int timestamp;
126 unsigned int modifiers;
127 int sx, sy;
128
129 struct wl_list link;
130
131 /* TODO: grab */
132 unsigned int grab_button;
133
134 Ecore_Wl_Dnd_Source *drag_source;
135 Ecore_Wl_Dnd_Source *selection_source;
136};
40 137
41 unsigned int window; 138struct _Ecore_Wl_Window
139{
140 Ecore_Wl_Display *display;
141 Ecore_Wl_Window *parent;
142
143 struct wl_surface *surface;
144 struct wl_shell_surface *shell_surface;
145
146 int id;
147 int x, y;
148 int edges;
149
150 Eina_Rectangle allocation, pending_allocation;
151 Eina_Rectangle saved_allocation, server_allocation;
42 152
43 unsigned int time; 153 /* Eina_Bool redraw_scheduled : 1; */
154 /* Eina_Bool resize_scheduled : 1; */
155 Eina_Bool transparent : 1;
156
157 Ecore_Wl_Window_Type type;
158 Ecore_Wl_Window_Buffer_Type buffer_type;
159
160 Ecore_Wl_Input *pointer_device;
161 Ecore_Wl_Input *keyboard_device;
162
163 void *data;
44}; 164};
45 165
46struct _Ecore_Wl_Event_Mouse_Out 166struct _Ecore_Wl_Event_Mouse_In
47{ 167{
48 int modifiers; 168 int modifiers;
49 int x, y; 169 int x, y;
170 struct
171 {
172 int x, y;
173 } root;
174 unsigned int win;
175 unsigned int event_win;
176 unsigned int root_win;
177 unsigned int timestamp;
178};
50 179
180struct _Ecore_Wl_Event_Mouse_Out
181{
182 int modifiers;
183 int x, y;
51 struct 184 struct
52 { 185 {
53 int x, y; 186 int x, y;
54 } root; 187 } root;
188 unsigned int win;
189 unsigned int event_win;
190 unsigned int root_win;
191 unsigned int timestamp;
192};
55 193
56 unsigned int window; 194struct _Ecore_Wl_Event_Focus_In
195{
196 unsigned int win;
197 unsigned int timestamp;
198};
57 199
58 unsigned int time; 200struct _Ecore_Wl_Event_Focus_Out
201{
202 unsigned int win;
203 unsigned int timestamp;
59}; 204};
60 205
61struct _Ecore_Wl_Event_Focus_In 206struct _Ecore_Wl_Event_Window_Configure
62{ 207{
63 unsigned int window; 208 unsigned int win;
64 /* TODO: mode & detail */ 209 unsigned int event_win;
65 unsigned int time; 210 int x, y, w, h;
211 unsigned int timestamp;
66}; 212};
67 213
68struct _Ecore_Wl_Event_Focus_Out 214struct _Ecore_Wl_Event_Dnd_Enter
69{ 215{
70 unsigned int window; 216 unsigned int win, source;
71 /* TODO: mode & detail */ 217 char **types;
72 unsigned int time; 218 int num_types;
219 struct
220 {
221 int x, y;
222 } position;
73}; 223};
74 224
75struct _Ecore_Wl_Event_Drag_Start 225struct _Ecore_Wl_Event_Dnd_Position
76{ 226{
77 struct wl_data_device *device; 227 unsigned int win, source;
78 struct wl_surface *surface; 228 struct
79 const char *mime_type; 229 {
80 uint32_t timestamp; 230 int x, y;
231 } position;
81}; 232};
82 233
83struct _Ecore_Wl_Event_Drag_Stop 234struct _Ecore_Wl_Event_Dnd_Leave
84{ 235{
236 unsigned int win, source;
237};
85 238
239struct _Ecore_Wl_Event_Dnd_Drop
240{
241 unsigned int win, source;
242 struct
243 {
244 int x, y;
245 } position;
246};
247
248struct _Ecore_Wl_Event_Interfaces_Bound
249{
250 Eina_Bool compositor : 1;
251 Eina_Bool shm : 1;
252 Eina_Bool shell : 1;
86}; 253};
87 254
88/** 255/**
@@ -92,32 +259,46 @@ struct _Ecore_Wl_Event_Drag_Stop
92 * Ecore_Wl provides a wrapper and convenience functions for using the 259 * Ecore_Wl provides a wrapper and convenience functions for using the
93 * Wayland window system. Function groups for this part of the library 260 * Wayland window system. Function groups for this part of the library
94 * include the following: 261 * include the following:
262 *
95 * @li @ref Ecore_Wl_Init_Group 263 * @li @ref Ecore_Wl_Init_Group
264 * @li @ref Ecore_Wl_Display_Group
265 * @li @ref Ecore_Wl_Flush_Group
266 * @li @ref Ecore_Wl_Window_Group
96 */ 267 */
97 268
269EAPI extern int ECORE_WL_EVENT_MOUSE_IN;
270EAPI extern int ECORE_WL_EVENT_MOUSE_OUT;
271EAPI extern int ECORE_WL_EVENT_FOCUS_IN;
272EAPI extern int ECORE_WL_EVENT_FOCUS_OUT;
273EAPI extern int ECORE_WL_EVENT_WINDOW_CONFIGURE;
274EAPI extern int ECORE_WL_EVENT_DND_ENTER;
275EAPI extern int ECORE_WL_EVENT_DND_POSITION;
276EAPI extern int ECORE_WL_EVENT_DND_LEAVE;
277EAPI extern int ECORE_WL_EVENT_DND_DROP;
278EAPI extern int ECORE_WL_EVENT_INTERFACES_BOUND;
279
98EAPI int ecore_wl_init(const char *name); 280EAPI int ecore_wl_init(const char *name);
99EAPI int ecore_wl_shutdown(void); 281EAPI int ecore_wl_shutdown(void);
100
101EAPI struct wl_display *ecore_wl_display_get(void);
102EAPI struct wl_shm *ecore_wl_shm_get(void);
103EAPI struct wl_compositor *ecore_wl_compositor_get(void);
104EAPI struct wl_shell *ecore_wl_shell_get(void);
105EAPI struct wl_input_device *ecore_wl_input_device_get(void);
106EAPI void ecore_wl_screen_size_get(int *w, int *h);
107EAPI unsigned int ecore_wl_format_get(void);
108EAPI void ecore_wl_flush(void); 282EAPI void ecore_wl_flush(void);
109EAPI void ecore_wl_sync(void); 283EAPI void ecore_wl_sync(void);
284EAPI struct wl_shm *ecore_wl_shm_get(void);
285EAPI struct wl_display *ecore_wl_display_get(void);
286EAPI void ecore_wl_screen_size_get(int *w, int *h);
110EAPI void ecore_wl_pointer_xy_get(int *x, int *y); 287EAPI void ecore_wl_pointer_xy_get(int *x, int *y);
111 288
112EAPI Ecore_Wl_Drag_Source *ecore_wl_drag_source_create(int hotspot_x, int hotspot_y, int offset_x, int offset_y, const char *mimetype, unsigned int timestamp, void *data); 289EAPI Ecore_Wl_Window *ecore_wl_window_new(Ecore_Wl_Window *parent, int x, int y, int w, int h, int buffer_type);
113EAPI void ecore_wl_drag_start(Ecore_Wl_Drag_Source *source, struct wl_surface *surface, struct wl_buffer *buffer); 290EAPI void ecore_wl_window_free(Ecore_Wl_Window *win);
114EAPI void ecore_wl_drag_stop(void); 291EAPI void ecore_wl_window_move(Ecore_Wl_Window *win, int x, int y);
115 292EAPI void ecore_wl_window_resize(Ecore_Wl_Window *win, int w, int h, int location);
116EAPI extern int ECORE_WL_EVENT_MOUSE_IN; 293EAPI void ecore_wl_window_damage(Ecore_Wl_Window *win, int x, int y, int w, int h);
117EAPI extern int ECORE_WL_EVENT_MOUSE_OUT; 294EAPI void ecore_wl_window_buffer_attach(Ecore_Wl_Window *win, struct wl_buffer *buffer, int x, int y);
118EAPI extern int ECORE_WL_EVENT_FOCUS_IN; 295EAPI void ecore_wl_window_show(Ecore_Wl_Window *win);
119EAPI extern int ECORE_WL_EVENT_FOCUS_OUT; 296EAPI void ecore_wl_window_hide(Ecore_Wl_Window *win);
120EAPI extern int ECORE_WL_EVENT_DRAG_START; 297EAPI void ecore_wl_window_raise(Ecore_Wl_Window *win);
121EAPI extern int ECORE_WL_EVENT_DRAG_STOP; 298EAPI void ecore_wl_window_maximized_set(Ecore_Wl_Window *win, Eina_Bool maximized);
299EAPI void ecore_wl_window_fullscreen_set(Ecore_Wl_Window *win, Eina_Bool fullscreen);
300EAPI void ecore_wl_window_update_size(Ecore_Wl_Window *win, int w, int h);
301EAPI struct wl_surface *ecore_wl_window_surface_get(Ecore_Wl_Window *win);
302EAPI Ecore_Wl_Window *ecore_wl_window_find(unsigned int id);
122 303
123#endif 304#endif