From 36bf4cbc4e23724c4010d6cbbfa75c8091c1f5f5 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 20 Oct 2017 13:23:12 -0400 Subject: [PATCH] wayland: expand efl-hints protocol to work for all types of xdg shell surfaces --- src/lib/ecore_wl2/ecore_wl2_display.c | 12 +++++++++--- src/lib/ecore_wl2/ecore_wl2_window.c | 25 +++++++++++++++---------- src/wayland_protocol/efl-hints.xml | 4 ++-- 3 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/lib/ecore_wl2/ecore_wl2_display.c b/src/lib/ecore_wl2/ecore_wl2_display.c index db7f47999a..1a2a24ef55 100644 --- a/src/lib/ecore_wl2/ecore_wl2_display.c +++ b/src/lib/ecore_wl2/ecore_wl2_display.c @@ -332,9 +332,15 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, MIN(version, 2)); EINA_INLIST_FOREACH(ewd->windows, window) - if (window->zxdg_toplevel && window->aspect.set) - efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, - window->aspect.w, window->aspect.h, window->aspect.aspect); + { + if (!window->zxdg_surface) continue; + if (window->aspect.set) + efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_surface, + window->aspect.w, window->aspect.h, window->aspect.aspect); + if (window->weight.set) + efl_hints_set_weight(window->display->wl.efl_hints, + window->zxdg_surface, window->weight.w, window->weight.h); + } } event: diff --git a/src/lib/ecore_wl2/ecore_wl2_window.c b/src/lib/ecore_wl2/ecore_wl2_window.c index c6cd35135a..f2a2131e3a 100644 --- a/src/lib/ecore_wl2/ecore_wl2_window.c +++ b/src/lib/ecore_wl2/ecore_wl2_window.c @@ -323,6 +323,15 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window) window->zxdg_configure_ack = zxdg_surface_v6_ack_configure; window->pending.configure = EINA_TRUE; + if (window->display->wl.efl_hints) + { + if (window->aspect.set) + efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_surface, + window->aspect.w, window->aspect.h, window->aspect.aspect); + if (window->weight.set) + efl_hints_set_weight(window->display->wl.efl_hints, window->zxdg_surface, + window->weight.w, window->weight.h); + } if (window->type == ECORE_WL2_WINDOW_TYPE_MENU) _ecore_wl2_window_zxdg_popup_create(window); @@ -355,12 +364,6 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window) if (window->set_config.fullscreen) zxdg_toplevel_v6_set_fullscreen(window->zxdg_toplevel, NULL); - if (window->aspect.set && window->display->wl.efl_hints) - efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel, - window->aspect.w, window->aspect.h, window->aspect.aspect); - if (window->weight.set && window->display->wl.efl_hints) - efl_hints_set_weight(window->display->wl.efl_hints, window->zxdg_toplevel, - window->weight.w, window->weight.h); } ecore_wl2_window_commit(window, EINA_TRUE); @@ -1342,9 +1345,10 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int window->aspect.h = h; window->aspect.aspect = aspect; window->aspect.set = 1; - if (window->display->wl.efl_hints && window->zxdg_toplevel) + if (!window->display->wl.efl_hints) return; + if (window->zxdg_surface) efl_hints_set_aspect(window->display->wl.efl_hints, - window->zxdg_toplevel, w, h, aspect); + window->zxdg_surface, w, h, aspect); } EAPI void @@ -1362,9 +1366,10 @@ ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h) window->weight.w = ww; window->weight.h = hh; window->weight.set = 1; - if (window->display->wl.efl_hints && window->zxdg_toplevel) + if (!window->display->wl.efl_hints) return; + if (window->zxdg_surface) efl_hints_set_weight(window->display->wl.efl_hints, - window->zxdg_toplevel, ww, hh); + window->zxdg_surface, ww, hh); } static void diff --git a/src/wayland_protocol/efl-hints.xml b/src/wayland_protocol/efl-hints.xml index 64a40a8804..9f2b775dda 100644 --- a/src/wayland_protocol/efl-hints.xml +++ b/src/wayland_protocol/efl-hints.xml @@ -9,13 +9,13 @@ - + - +