1 #ifndef _ECORE_WL2_INTERNAL_H
2 # define _ECORE_WL2_INTERNAL_H
3 
4 # ifdef EAPI
5 #  undef EAPI
6 # endif
7 
8 # ifdef _WIN32
9 #  ifdef EFL_BUILD
10 #   ifdef DLL_EXPORT
11 #    define EAPI __declspec(dllexport)
12 #   else
13 #    define EAPI
14 #   endif
15 #  else
16 #   define EAPI __declspec(dllimport)
17 #  endif
18 # else
19 #  ifdef __GNUC__
20 #   if __GNUC__ >= 4
21 #    define EAPI __attribute__ ((visibility("default")))
22 #   else
23 #    define EAPI
24 #   endif
25 #  else
26 #   define EAPI
27 #  endif
28 # endif
29 
30 EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE; /** @since 1.20 */
31 EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_PREPARE_DONE; /** @since 1.20 */
32 EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_REQUEST; /** @since 1.20 */
33 EAPI extern int ECORE_WL2_EVENT_WINDOW_ROTATION_CHANGE_DONE; /** @since 1.20 */
34 
35 EAPI void ecore_wl2_window_rotation_change_prepare_send(Ecore_Wl2_Window *window, int rot, int w, int h, Eina_Bool resize);
36 EAPI void ecore_wl2_window_rotation_change_prepare_done_send(Ecore_Wl2_Window *window, int rot);
37 EAPI void ecore_wl2_window_rotation_change_request_send(Ecore_Wl2_Window *window, int rot);
38 EAPI void ecore_wl2_window_rotation_change_done_send(Ecore_Wl2_Window *window, int rot, int w, int h);
39 
40 EAPI void ecore_wl2_window_false_commit(Ecore_Wl2_Window *window);
41 EAPI Eina_Bool ecore_wl2_buffer_fit(Ecore_Wl2_Buffer *b, int w, int h);
42 
43 EAPI void ecore_wl2_window_damage(Ecore_Wl2_Window *window, Eina_Rectangle *rects, unsigned int count);
44 EAPI Eina_Bool ecore_wl2_buffer_init(Ecore_Wl2_Display *ewd, Ecore_Wl2_Buffer_Type types);
45 EAPI Ecore_Wl2_Buffer *ecore_wl2_buffer_create(Ecore_Wl2_Display *ewd, int w, int h, Eina_Bool alpha);
46 EAPI void ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b);
47 EAPI struct wl_buffer *ecore_wl2_buffer_wl_buffer_get(Ecore_Wl2_Buffer *buf);
48 EAPI void *ecore_wl2_buffer_map(Ecore_Wl2_Buffer *buf, int *w, int *h, int *stride);
49 EAPI void ecore_wl2_buffer_unmap(Ecore_Wl2_Buffer *buf);
50 EAPI void ecore_wl2_buffer_discard(Ecore_Wl2_Buffer *buf);
51 EAPI void ecore_wl2_buffer_lock(Ecore_Wl2_Buffer *b);
52 EAPI void ecore_wl2_buffer_unlock(Ecore_Wl2_Buffer *b);
53 EAPI void ecore_wl2_buffer_destroy(Ecore_Wl2_Buffer *b);
54 EAPI Eina_Bool ecore_wl2_buffer_busy_get(Ecore_Wl2_Buffer *buffer);
55 EAPI void ecore_wl2_buffer_busy_set(Ecore_Wl2_Buffer *buffer);
56 EAPI int ecore_wl2_buffer_age_get(Ecore_Wl2_Buffer *buffer);
57 EAPI void ecore_wl2_buffer_age_set(Ecore_Wl2_Buffer *buffer, int age);
58 EAPI void ecore_wl2_buffer_age_inc(Ecore_Wl2_Buffer *buffer);
59 
60 EAPI Ecore_Wl2_Surface *ecore_wl2_surface_create(Ecore_Wl2_Window *win, Eina_Bool alpha);
61 EAPI void ecore_wl2_surface_destroy(Ecore_Wl2_Surface *surface);
62 EAPI void ecore_wl2_surface_reconfigure(Ecore_Wl2_Surface *surface, int w, int h, uint32_t flags, Eina_Bool alpha);
63 EAPI void *ecore_wl2_surface_data_get(Ecore_Wl2_Surface *surface, int *w, int *h);
64 EAPI int  ecore_wl2_surface_assign(Ecore_Wl2_Surface *surface);
65 EAPI void ecore_wl2_surface_post(Ecore_Wl2_Surface *surface, Eina_Rectangle *rects, unsigned int count);
66 EAPI void ecore_wl2_surface_flush(Ecore_Wl2_Surface *surface, Eina_Bool purge);
67 EAPI void ecore_wl2_window_surface_flush(Ecore_Wl2_Window *window, Eina_Bool purge);
68 EAPI Ecore_Wl2_Buffer *ecore_wl2_surface_buffer_create(Ecore_Wl2_Surface *surface);
69 EAPI int ecore_wl2_surface_manager_add(Ecore_Wl2_Surface_Interface *intf);
70 EAPI void ecore_wl2_surface_manager_del(Ecore_Wl2_Surface_Interface *intf);
71 EAPI Ecore_Wl2_Window *ecore_wl2_surface_window_get(Ecore_Wl2_Surface *surface);
72 EAPI Eina_Bool ecore_wl2_surface_alpha_get(Ecore_Wl2_Surface *surface);
73 
74 /**
75  * Attach a buffer to a window
76  *
77  * Note that the GL stack my attach buffers to a surface - we should call this
78  * function at that time (with a NULL buffer) to track whether a surface
79  * has a valid buffer.  That is, call with implicit true and buffer NULL at
80  * the time of glSwapBuffers.
81  *
82  * @param window The target window
83  * @param buffer The buffer to attach
84  * @param x X offset from corner
85  * @param y Y offset from corner
86  * @param implicit True if an external library is doing the actual attaching
87  *
88  * @since 1.21
89  */
90 EAPI void ecore_wl2_window_buffer_attach(Ecore_Wl2_Window *win, void *buffer, int x, int y, Eina_Bool implicit);
91 
92 /**
93  * Set a buffer transform on a given window
94  *
95  * @param window The window on which to set the buffer transform
96  * @param transform The buffer transform being requested
97  *
98  * @ingroup Ecore_Wl2_Window_Group
99  * @since 1.20
100  */
101 EAPI void ecore_wl2_window_buffer_transform_set(Ecore_Wl2_Window *window, int transform);
102 
103 /**
104  * Iconify a window
105  *
106  * @param window The window to iconifiy
107  * @param iconified The new iconified state to set
108  *
109  * @ingroup Ecore_Wl2_Window_Group
110  * @since 1.17
111  */
112 EAPI void ecore_wl2_window_iconified_set(Ecore_Wl2_Window *window, Eina_Bool iconified);
113 
114 /**
115  * Check if a wayland window's surface is in the pending state.
116  *
117  * A surface is pending if it's been commit but we haven't received a
118  * frame callback for it yet.  This mean's we're not ready to draw yet.
119  *
120  * @param window The window whose surface we want to check
121  *
122  * @return whether the window's surface is pending or not.
123  *
124  * @since 1.21
125  */
126 EAPI Eina_Bool ecore_wl2_window_pending_get(Ecore_Wl2_Window *window);
127 
128 /**
129  * @defgroup Ecore_Wl2_Dnd_Group Wayland Library Drag-n-Drop Functions
130  * @ingroup Ecore_Wl2_Group
131  *
132  * Functions that deal with creating, destroying, or interacting with
133  * Wayland Drag-n-Drop
134  */
135 
136 /**
137  * Set the types which are supported by a possible drag and drop operation.
138  * This call initializes a data source and offeres the given mimetypes
139  *
140  * @param input the input where to add on the data source
141  * @param types a null-terminated array of mimetypes
142  *
143  * @ingroup Ecore_Wl2_Dnd_Group
144  * @since 1.17
145  */
146 EAPI void ecore_wl2_dnd_drag_types_set(Ecore_Wl2_Input *input, const char **types);
147 
148 /**
149  * Start a drag on the given input
150  *
151  * @param input the input to use
152  * @param window the window which is the origin of the drag operation
153  * @param drag_window the window which is used as window of the visible hint.
154  *
155  * @return The serial for the start_drag request
156  *
157  * @ingroup Ecore_Wl2_Dnd_Group
158  * @since 1.17
159  */
160 EAPI uint32_t ecore_wl2_dnd_drag_start(Ecore_Wl2_Input *input, Ecore_Wl2_Window *window, Ecore_Wl2_Window *drag_window);
161 
162 /**
163  * Call wl_data_source.set_actions on an existing source
164  *
165  * @param input the input to use
166  *
167  * @see ecore_wl2_dnd_drag_start for a more useful function.
168  *
169  * @ingroup Ecore_Wl2_Dnd_Group
170  * @since 1.20
171  */
172 EAPI void ecore_wl2_dnd_set_actions(Ecore_Wl2_Input *input);
173 
174 /**
175  * End a drag started by a call to ecore_wl2_dnd_drag_start
176  *
177  * @param input the input object on which the drag was started
178  *
179  * @ingroup Ecore_Wl2_Dnd_Group
180  * @since 1.17
181  */
182 EAPI void ecore_wl2_dnd_drag_end(Ecore_Wl2_Input *input);
183 
184 /**
185  * Get the offer which is currently resposible for the clipboard
186  *
187  * @param input the input object to use
188  *
189  * @ingroup Ecore_Wl2_Dnd_Group
190  * @since 1.19
191  */
192 EAPI Ecore_Wl2_Offer* ecore_wl2_dnd_selection_get(Ecore_Wl2_Input *input);
193 
194 /**
195  * Set the types which are available from this client
196  * Later the event ECORE_WL2_EVENT_DATA_SOURCE_SEND is emitted,
197  * where the caller of this api must write the data (encoded in the given mimetype) to the fd
198  *
199  * @param input the input to provice this types on
200  * @param types a null-terminated array of mimetypes supported by the client
201  *
202  * @return serial of request on success, 0 on failure
203  *
204  * @ingroup Ecore_Wl2_Dnd_Group
205  * @since 1.17
206  */
207 EAPI uint32_t ecore_wl2_dnd_selection_set(Ecore_Wl2_Input *input, const char **types);
208 
209 /**
210  * Clear the selection currently setted on this input.
211  *
212  * @param input the input to clear
213  *
214  * @return serial of request on success, 0 on failure
215  *
216  * @ingroup Ecore_Wl2_Dnd_Group
217  * @since 1.17
218  */
219 EAPI uint32_t ecore_wl2_dnd_selection_clear(Ecore_Wl2_Input *input);
220 
221 /**
222  * Get the actions available from the data source
223  *
224  * @param offer Offer object to use
225  *
226  * @return or´ed values from Ecore_Wl2_Drag_Action which are describing the available actions
227  *
228  * @ingroup Ecore_Wl2_Dnd_Group
229  * @since 1.19
230  */
231 EAPI Ecore_Wl2_Drag_Action ecore_wl2_offer_actions_get(Ecore_Wl2_Offer *offer);
232 
233 /**
234  * Set the actions which are supported by you
235  *
236  * @param offer Offer object to use
237  * @param actions A or´ed value of mutliple Ecore_Wl2_Drag_Action values
238  * @param action the preferred action out of the actions
239  *
240  * @ingroup Ecore_Wl2_Dnd_Group
241  * @since 1.19
242  */
243 EAPI void ecore_wl2_offer_actions_set(Ecore_Wl2_Offer *offer, Ecore_Wl2_Drag_Action actions, Ecore_Wl2_Drag_Action action);
244 
245 /**
246  * Get action which is set by either the data source or in the last call of actions_set
247  *
248  * @param offer Offer object to use
249  *
250  * @return the preferred action
251  *
252  * @ingroup Ecore_Wl2_Dnd_Group
253  * @since 1.19
254  */
255 EAPI Ecore_Wl2_Drag_Action ecore_wl2_offer_action_get(Ecore_Wl2_Offer *offer);
256 
257 /**
258  * Get the mime types which are given by the source
259  *
260  * @param offer the offer to query
261  *
262  * @return a eina array of strdup´ed strings, this array must NOT be changed or freed
263  *
264  * @ingroup Ecore_Wl2_Dnd_Group
265  * @since 1.19
266  */
267 EAPI Eina_Array* ecore_wl2_offer_mimes_get(Ecore_Wl2_Offer *offer);
268 
269 /**
270  * Set mimetypes you are accepting under this offer
271  *
272  * @param offer the offer to use
273  *
274  * @ingroup Ecore_Wl2_Dnd_Group
275  * @since 1.19
276  */
277 EAPI void ecore_wl2_offer_mimes_set(Ecore_Wl2_Offer *offer, Eina_Array *mimes);
278 
279 /**
280  * Accept a single mime type for an offer
281  *
282  * @param offer the offer to use
283  * @param mime_type the mime type
284  *
285  * @ingroup Ecore_Wl2_Dnd_Group
286  * @since 1.20
287  */
288 EAPI void ecore_wl2_offer_accept(Ecore_Wl2_Offer *offer, const char *mime_type);
289 
290 /**
291  * Request the data from this offer.
292  * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available.
293  * There offer will be not destroyed as long as requested data is not emitted by the event.
294  *
295  * @param offer the offer to use
296  * @param mime the mimetype to receive
297  *
298  * @ingroup Ecore_Wl2_Dnd_Group
299  * @since 1.19
300  */
301 EAPI void ecore_wl2_offer_receive(Ecore_Wl2_Offer *offer, char *mime);
302 
303 /**
304  * Request the data from this offer on an externally managed fd.
305  * The event ECORE_WL2_EVENT_OFFER_DATA_READY is called when the data is available.
306  * There offer will be not destroyed as long as requested data is not emitted by the event.
307  *
308  * @param offer the offer to use
309  * @param mime the mimetype to receive
310  * @param fd the fd to pass for receiving
311  *
312  * @ingroup Ecore_Wl2_Dnd_Group
313  * @since 1.20
314  */
315 EAPI void ecore_wl2_offer_proxy_receive(Ecore_Wl2_Offer *offer, const char *mime, int fd);
316 
317 /**
318  * End the use of a proxy received offer. This may invalidate the offer object
319  *
320  * @param offer the offer
321  *
322  * @ingroup Ecore_Wl2_Dnd_Group
323  * @since 1.20
324  */
325 EAPI void ecore_wl2_offer_proxy_receive_end(Ecore_Wl2_Offer *offer);
326 
327 /**
328  * Check if the given offer supports the given mimetype
329  *
330  * @param offer the offer to use
331  * @param mime the mimetype to check
332  *
333  * @return Returns true if the mimetype is supported by this offer, false if not
334  *
335  * @ingroup Ecore_Wl2_Dnd_Group
336  * @since 1.19
337  */
338 EAPI Eina_Bool ecore_wl2_offer_supports_mime(Ecore_Wl2_Offer *offer, const char *mime);
339 
340 /**
341  * Mark this offer as finished
342  * This will call the dnd_finished event on the source of the sender.
343  *
344  * @param offer the offer to use
345  *
346  * @ingroup Ecore_Wl2_Dnd_Group
347  * @since 1.19
348  */
349 EAPI void ecore_wl2_offer_finish(Ecore_Wl2_Offer *offer);
350 
351 /**
352  * @defgroup Ecore_Wl2_Subsurface_Group Functions to manipulate subsurfaces.
353  * @ingroup Ecore_Wl2_Group
354  *
355  * Functions to manipulate wayland subsurfaces, using Ecore_Wl2_Subsurface.
356  *
357  * This API is intended to expose Wayland subsurface functionality, although it
358  * should not be necessary for most applications to use it, as soon as we have
359  * means to make Evas automatically switch Evas images to use subsurfaces.
360  *
361  * It can/should be used, for instance, when subsurfaces are needed to be not
362  * in sync with the main window surface.
363  */
364 
365 /**
366  * Create and return a new subsurface.
367  *
368  * Create a new surface (and subsurface interface), with the parent surface
369  * being the one associated with the given window.
370  *
371  * @param window The window. It must be visible, otherwise there will be no surface created
372  * for it yet.
373  *
374  * @return the allocated and initialized Ecore_Wl2_Subsurface object, or
375  * NULL on failure
376  *
377  * @ingroup Ecore_Wl2_Subsurface_Group
378  * @since 1.17
379  */
380 EAPI Ecore_Wl2_Subsurface *ecore_wl2_subsurface_new(Ecore_Wl2_Window *window);
381 
382 /**
383  * Destroy the given subsurface, as well as the surface associated with it.
384  *
385  * @param subsurface the subsurface
386  *
387  * @ingroup Ecore_Wl2_Subsurface_Group
388  * @since 1.17
389  */
390 EAPI void ecore_wl2_subsurface_del(Ecore_Wl2_Subsurface *subsurface);
391 
392 /**
393  * Get the wl_surface for this subsurface
394  *
395  * @param subsurface the subsurface
396  *
397  * @return the wl_surface associated with this subsurface, or NULL on failure
398  *
399  * @ingroup Ecore_Wl2_Subsurface_Group
400  * @since 1.17
401  */
402 EAPI struct wl_surface *ecore_wl2_subsurface_surface_get(Ecore_Wl2_Subsurface *subsurface);
403 
404 /**
405  * Set the position of this subsurface, relative to its parent surface.
406  * If subsurface is defined and the x, y coordinates differ from the currently
407  * tracked position, this also schedules a sub-surface position change.
408  *
409  * @param subsurface the subsurface
410  * @param x coordinate in the parent surface
411  * @param y coordinate in the parent surface
412  *
413  * @ingroup Ecore_Wl2_Subsurface_Group
414  * @since 1.17
415  */
416 EAPI void ecore_wl2_subsurface_position_set(Ecore_Wl2_Subsurface *subsurface, int x, int y);
417 
418 /**
419  * Get the position of this subsurface, relative to its parent surface.
420  * Coordinates will be returned in x and y if non-NULL.
421  *
422  * @param subsurface the subsurface
423  * @param x coordinate in the parent surface, or NULL to ignore
424  * @param y coordinate in the parent surface, or NULL to ignore
425  *
426  * @ingroup Ecore_Wl2_Subsurface_Group
427  * @since 1.17
428  */
429 EAPI void ecore_wl2_subsurface_position_get(Ecore_Wl2_Subsurface *subsurface, int *x, int *y);
430 
431 /**
432  * Place subsurface on layer above a reference surface
433  *
434  * Moves the subsurface to just above the reference surface,
435  * changing the z-order.  The reference surface must
436  * be either a sibling or parent surface, else a protocol error will
437  * be generated.
438  *
439  * @param subsurface the subsurface
440  * @param surface the sibling reference surface
441  *
442  * @ingroup Ecore_Wl2_Subsurface_Group
443  * @since 1.17
444  */
445 EAPI void ecore_wl2_subsurface_place_above(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface);
446 
447 /**
448  * Place subsurface on layer below a reference surface
449  *
450  * See ecore_wl2_subsurface_place_above.
451  *
452  * @param subsurface the subsurface
453  * @param surface the sibling reference surface
454  *
455  * @ingroup Ecore_Wl2_Subsurface_Group
456  * @since 1.17
457  */
458 EAPI void ecore_wl2_subsurface_place_below(Ecore_Wl2_Subsurface *subsurface, struct wl_surface *surface);
459 
460 /**
461  * Enables or disables sub-surface synchronization
462  *
463  * When synchronization is enabled, surface commits on the subsurface
464  * will be cached and only applied when the parent surface's state is
465  * applied.  This ensures atomic updates of the parent and all of its
466  * synchronized sub-surfaces.
467  *
468  * When synchronization is disabled, commits will apply to the pending
469  * state directly without caching, just like a normal wl_surface.  If
470  * there are already cached events when this is set, those events are
471  * applied simultaneously with the desync event.
472  *
473  * Attempting to enable synchronization when the subsurface already
474  * thinks it's sync'd, or desync when it believes its desync'd, will
475  * be trivially ignored and will not generate a Wayland event.
476  *
477  * See Wayland's set_desync documentation for further details and
478  * exceptional cases.
479  *
480  * @param subsurface the subsurface
481  * @param sync true to enable synchronization, false to desynchronize
482  *
483  * @ingroup Ecore_Wl2_Subsurface_Group
484  * @since 1.17
485  */
486 EAPI void ecore_wl2_subsurface_sync_set(Ecore_Wl2_Subsurface *subsurface, Eina_Bool sync);
487 
488 /**
489  * Set an opaque region for the given subsurface.
490  *
491  * This is an optimization hint to the compositor to allow it avoid
492  * redrawing content unnecessarily.  Note that marking transparent
493  * content as opaque will cause repaint artifacts.
494  *
495  * Use a 0x0 region size to unset the opaque region.
496  *
497  * @param subsurface the subsurface
498  * @param x coordinate in the parent surface
499  * @param y coordinate in the parent surface
500  * @param w width to set as opaque
501  * @param h height to set as opaque
502  *
503  * @ingroup Ecore_Wl2_Subsurface_Group
504  * @since 1.17
505  */
506 EAPI void ecore_wl2_subsurface_opaque_region_set(Ecore_Wl2_Subsurface *subsurface, int x, int y, int w, int h);
507 
508 /**
509  * Get list of supported auxiliary window hints
510  *
511  * @param window
512  *
513  * @return An Eina_List of supported auxiliary hints, or NULL otherwise
514  *
515  * @ingroup Ecore_Wl2_Window_Group
516  * @since 1.20
517  */
518 EAPI Eina_List *ecore_wl2_window_aux_hints_supported_get(Ecore_Wl2_Window *window);
519 
520 /**
521  * Add a supported auxiliary hint to a given window
522  *
523  * @param window
524  * @param id
525  * @param hint
526  * @param val
527  *
528  * @ingroup Ecore_Wl2_Window_Group
529  * @since 1.20
530  */
531 EAPI void ecore_wl2_window_aux_hint_add(Ecore_Wl2_Window *window, int id, const char *hint, const char *val);
532 
533 /**
534  * Change an auxiliary hint on a given window
535  *
536  * @param window
537  * @param id
538  * @param val
539  *
540  * @ingroup Ecore_Wl2_Window_Group
541  * @since 1.20
542  */
543 EAPI void ecore_wl2_window_aux_hint_change(Ecore_Wl2_Window *window, int id, const char *val);
544 
545 /**
546  * Delete an auxiliary hint on a given window
547  *
548  * @param window
549  * @param id
550  *
551  * @ingroup Ecore_Wl2_Window_Group
552  * @since 1.20
553  */
554 EAPI void ecore_wl2_window_aux_hint_del(Ecore_Wl2_Window *window, int id);
555 
556 /**
557  * Terminate a Wayland display's main loop
558  *
559  * @brief This function is typically used by servers to terminate the
560  * Wayland display main loop. This is usually only called when a server
561  * encounters an error.
562  *
563  * @param display The Ecore_Wl2_Display to terminate
564  *
565  * @ingroup Ecore_Wl2_Display_Group
566  * @since 1.17
567  */
568 EAPI void ecore_wl2_display_terminate(Ecore_Wl2_Display *display);
569 
570 # undef EAPI
571 # define EAPI
572 
573 #endif
574