summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-08-04 16:17:53 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-08-04 16:15:43 -0400
commit9a189d29d0ebae79e645101b1fb0fbe5611e5a09 (patch)
tree830425b058b5f534c4ad4c1541eb5d76b98b1375 /src/lib/ecore_wl2
parenta454c91dbe82d1acd0aa7a05aca16551ffa335d5 (diff)
wayland: add efl-hints protocol for setting aspect on surfaces
@feature
Diffstat (limited to 'src/lib/ecore_wl2')
-rw-r--r--src/lib/ecore_wl2/Ecore_Wl2.h7
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c12
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h8
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c21
4 files changed, 48 insertions, 0 deletions
diff --git a/src/lib/ecore_wl2/Ecore_Wl2.h b/src/lib/ecore_wl2/Ecore_Wl2.h
index 81084e1975..eab1bfe3e7 100644
--- a/src/lib/ecore_wl2/Ecore_Wl2.h
+++ b/src/lib/ecore_wl2/Ecore_Wl2.h
@@ -737,6 +737,13 @@ EAPI struct wl_surface *ecore_wl2_window_surface_get(Ecore_Wl2_Window *window);
737EAPI int ecore_wl2_window_surface_id_get(Ecore_Wl2_Window *window); 737EAPI int ecore_wl2_window_surface_id_get(Ecore_Wl2_Window *window);
738 738
739/** 739/**
740 * @see evas_object_size_hint_aspect_set
741 * @ingroup Ecore_Wl2_Window_Group
742 * @since 1.21
743 */
744EAPI void ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int aspect);
745
746/**
740 * Show a given Ecore_Wl2_Window 747 * Show a given Ecore_Wl2_Window
741 * 748 *
742 * @param window The Ecore_Wl2_Window to show 749 * @param window The Ecore_Wl2_Window to show
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 48c62e5545..63c79f9d07 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -5,6 +5,7 @@
5#include "ecore_wl2_private.h" 5#include "ecore_wl2_private.h"
6 6
7#include "linux-dmabuf-unstable-v1-client-protocol.h" 7#include "linux-dmabuf-unstable-v1-client-protocol.h"
8#include "efl-hints-client-protocol.h"
8 9
9static Eina_Hash *_server_displays = NULL; 10static Eina_Hash *_server_displays = NULL;
10static Eina_Hash *_client_displays = NULL; 11static Eina_Hash *_client_displays = NULL;
@@ -336,6 +337,16 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
336 _ecore_wl2_output_add(ewd, id); 337 _ecore_wl2_output_add(ewd, id);
337 else if (!strcmp(interface, "wl_seat")) 338 else if (!strcmp(interface, "wl_seat"))
338 _ecore_wl2_input_add(ewd, id, version); 339 _ecore_wl2_input_add(ewd, id, version);
340 else if (!strcmp(interface, "efl_hints"))
341 {
342 Ecore_Wl2_Window *window;
343
344 ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, 1);
345 EINA_INLIST_FOREACH(ewd->windows, window)
346 if (window->zxdg_toplevel && window->aspect.set)
347 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
348 window->aspect.w, window->aspect.h, window->aspect.aspect);
349 }
339 350
340event: 351event:
341 /* allocate space for event structure */ 352 /* allocate space for event structure */
@@ -437,6 +448,7 @@ _ecore_wl2_display_globals_cleanup(Ecore_Wl2_Display *ewd)
437 if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor); 448 if (ewd->wl.subcompositor) wl_subcompositor_destroy(ewd->wl.subcompositor);
438 if (ewd->wl.dmabuf) zwp_linux_dmabuf_v1_destroy(ewd->wl.dmabuf); 449 if (ewd->wl.dmabuf) zwp_linux_dmabuf_v1_destroy(ewd->wl.dmabuf);
439 if (ewd->wl.efl_aux_hints) efl_aux_hints_destroy(ewd->wl.efl_aux_hints); 450 if (ewd->wl.efl_aux_hints) efl_aux_hints_destroy(ewd->wl.efl_aux_hints);
451 if (ewd->wl.efl_hints) efl_hints_destroy(ewd->wl.efl_hints);
440 452
441 if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry); 453 if (ewd->wl.registry) wl_registry_destroy(ewd->wl.registry);
442} 454}
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index 3569db9f39..e857bbdec4 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -96,6 +96,7 @@ struct _Ecore_Wl2_Display
96 struct zwp_e_session_recovery *session_recovery; 96 struct zwp_e_session_recovery *session_recovery;
97 struct efl_aux_hints *efl_aux_hints; 97 struct efl_aux_hints *efl_aux_hints;
98 struct zwp_teamwork *teamwork; 98 struct zwp_teamwork *teamwork;
99 struct efl_hints *efl_hints;
99 int compositor_version; 100 int compositor_version;
100 } wl; 101 } wl;
101 102
@@ -180,6 +181,13 @@ struct _Ecore_Wl2_Window
180 181
181 Ecore_Wl2_Window_Type type; 182 Ecore_Wl2_Window_Type type;
182 183
184 struct
185 {
186 int w, h;
187 unsigned int aspect;
188 Eina_Bool set : 1;
189 } aspect;
190
183 Eina_Inlist *subsurfs; 191 Eina_Inlist *subsurfs;
184 Eina_List *supported_aux_hints; 192 Eina_List *supported_aux_hints;
185 193
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index 78f6129af0..bb5196f474 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -3,6 +3,7 @@
3#endif 3#endif
4 4
5#include "ecore_wl2_private.h" 5#include "ecore_wl2_private.h"
6#include "efl-hints-client-protocol.h"
6 7
7void 8void
8_ecore_wl2_window_semi_free(Ecore_Wl2_Window *window) 9_ecore_wl2_window_semi_free(Ecore_Wl2_Window *window)
@@ -472,6 +473,9 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
472 473
473 if (window->fullscreen) 474 if (window->fullscreen)
474 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); 475 zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL);
476 if (window->aspect.set && window->display->wl.efl_hints)
477 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
478 window->aspect.w, window->aspect.h, window->aspect.aspect);
475 479
476 wl_surface_commit(window->surface); 480 wl_surface_commit(window->surface);
477 } 481 }
@@ -1535,3 +1539,20 @@ ecore_wl2_window_floating_mode_get(Ecore_Wl2_Window *window)
1535 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE); 1539 EINA_SAFETY_ON_NULL_RETURN_VAL(window, EINA_FALSE);
1536 return window->floating; 1540 return window->floating;
1537} 1541}
1542
1543EAPI void
1544ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int aspect)
1545{
1546 EINA_SAFETY_ON_NULL_RETURN(window);
1547 EINA_SAFETY_ON_TRUE_RETURN(w < 1);
1548 EINA_SAFETY_ON_TRUE_RETURN(h < 1);
1549 if ((window->aspect.aspect == aspect) &&
1550 (window->aspect.w == w) &&
1551 (window->aspect.h == h)) return;
1552 window->aspect.w = w;
1553 window->aspect.h = h;
1554 window->aspect.aspect = aspect;
1555 window->aspect.set = 1;
1556 if (window->display->wl.efl_hints && window->zxdg_toplevel)
1557 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, w, h, aspect);
1558}