summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wl2
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2017-10-19 13:26:51 -0400
committerMike Blumenkrantz <zmike@osg.samsung.com>2017-10-25 10:44:16 -0400
commited30f41de82515d130f0d861e922f9e3f45a7aaf (patch)
treecaee7f914d44a8f00f2bed6ea9f9c5433bcbb02a /src/lib/ecore_wl2
parente9572a653742f0e613905e47767ae116297928d3 (diff)
wayland: add support for efl weight hint propagation from elm_win to efl_wl
@feature
Diffstat (limited to 'src/lib/ecore_wl2')
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_display.c2
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_private.h8
-rw-r--r--src/lib/ecore_wl2/ecore_wl2_window.c23
3 files changed, 32 insertions, 1 deletions
diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c
index 1780371524..db7f47999a 100644
--- a/src/lib/ecore_wl2/ecore_wl2_display.c
+++ b/src/lib/ecore_wl2/ecore_wl2_display.c
@@ -330,7 +330,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
330 { 330 {
331 Ecore_Wl2_Window *window; 331 Ecore_Wl2_Window *window;
332 332
333 ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, 1); 333 ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, MIN(version, 2));
334 EINA_INLIST_FOREACH(ewd->windows, window) 334 EINA_INLIST_FOREACH(ewd->windows, window)
335 if (window->zxdg_toplevel && window->aspect.set) 335 if (window->zxdg_toplevel && window->aspect.set)
336 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, 336 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
diff --git a/src/lib/ecore_wl2/ecore_wl2_private.h b/src/lib/ecore_wl2/ecore_wl2_private.h
index e8e95b6a57..dc345bce7a 100644
--- a/src/lib/ecore_wl2/ecore_wl2_private.h
+++ b/src/lib/ecore_wl2/ecore_wl2_private.h
@@ -199,6 +199,12 @@ struct _Ecore_Wl2_Window
199 Eina_Bool set : 1; 199 Eina_Bool set : 1;
200 } aspect; 200 } aspect;
201 201
202 struct
203 {
204 int w, h;
205 Eina_Bool set : 1;
206 } weight;
207
202 Eina_Inlist *subsurfs; 208 Eina_Inlist *subsurfs;
203 Eina_List *supported_aux_hints; 209 Eina_List *supported_aux_hints;
204 Eina_List *frame_callbacks; 210 Eina_List *frame_callbacks;
@@ -549,6 +555,8 @@ void _ecore_wl2_window_semi_free(Ecore_Wl2_Window *window);
549void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer); 555void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer);
550Eina_Bool _ecore_wl2_display_sync_get(void); 556Eina_Bool _ecore_wl2_display_sync_get(void);
551 557
558EAPI void ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h);
559
552EAPI extern int _ecore_wl2_event_window_www; 560EAPI extern int _ecore_wl2_event_window_www;
553EAPI extern int _ecore_wl2_event_window_www_drag; 561EAPI extern int _ecore_wl2_event_window_www_drag;
554 562
diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c
index b33e4240d0..c6cd35135a 100644
--- a/src/lib/ecore_wl2/ecore_wl2_window.c
+++ b/src/lib/ecore_wl2/ecore_wl2_window.c
@@ -358,6 +358,9 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
358 if (window->aspect.set && window->display->wl.efl_hints) 358 if (window->aspect.set && window->display->wl.efl_hints)
359 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, 359 efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
360 window->aspect.w, window->aspect.h, window->aspect.aspect); 360 window->aspect.w, window->aspect.h, window->aspect.aspect);
361 if (window->weight.set && window->display->wl.efl_hints)
362 efl_hints_set_weight(window->display->wl.efl_hints, window->zxdg_toplevel,
363 window->weight.w, window->weight.h);
361 } 364 }
362 365
363 ecore_wl2_window_commit(window, EINA_TRUE); 366 ecore_wl2_window_commit(window, EINA_TRUE);
@@ -1344,6 +1347,26 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int
1344 window->zxdg_toplevel, w, h, aspect); 1347 window->zxdg_toplevel, w, h, aspect);
1345} 1348}
1346 1349
1350EAPI void
1351ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h)
1352{
1353 int ww, hh;
1354 EINA_SAFETY_ON_NULL_RETURN(window);
1355
1356 ww = lround(w * 100);
1357 hh = lround(h * 100);
1358
1359 if ((window->weight.w == ww) && (window->weight.h == hh))
1360 return;
1361
1362 window->weight.w = ww;
1363 window->weight.h = hh;
1364 window->weight.set = 1;
1365 if (window->display->wl.efl_hints && window->zxdg_toplevel)
1366 efl_hints_set_weight(window->display->wl.efl_hints,
1367 window->zxdg_toplevel, ww, hh);
1368}
1369
1347static void 1370static void
1348_frame_cb(void *data, struct wl_callback *callback, uint32_t timestamp) 1371_frame_cb(void *data, struct wl_callback *callback, uint32_t timestamp)
1349{ 1372{