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 { Ecore_Wl2_Window *window; - ewd->wl.efl_hints = wl_registry_bind(registry, id, &efl_hints_interface, 1); + 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, 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 Eina_Bool set : 1; } aspect; + struct + { + int w, h; + Eina_Bool set : 1; + } weight; + Eina_Inlist *subsurfs; Eina_List *supported_aux_hints; Eina_List *frame_callbacks; @@ -549,6 +555,8 @@ void _ecore_wl2_window_semi_free(Ecore_Wl2_Window *window); void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer); Eina_Bool _ecore_wl2_display_sync_get(void); +EAPI void ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h); + EAPI extern int _ecore_wl2_event_window_www; EAPI extern int _ecore_wl2_event_window_www_drag; 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) 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); @@ -1344,6 +1347,26 @@ ecore_wl2_window_aspect_set(Ecore_Wl2_Window *window, int w, int h, unsigned int window->zxdg_toplevel, w, h, aspect); } +EAPI void +ecore_wl2_window_weight_set(Ecore_Wl2_Window *window, double w, double h) +{ + int ww, hh; + EINA_SAFETY_ON_NULL_RETURN(window); + + ww = lround(w * 100); + hh = lround(h * 100); + + if ((window->weight.w == ww) && (window->weight.h == hh)) + return; + + window->weight.w = ww; + window->weight.h = hh; + window->weight.set = 1; + if (window->display->wl.efl_hints && window->zxdg_toplevel) + efl_hints_set_weight(window->display->wl.efl_hints, + window->zxdg_toplevel, ww, hh); +} + static void _frame_cb(void *data, struct wl_callback *callback, uint32_t timestamp) { diff --git a/src/lib/efl_wl/efl_wl.c b/src/lib/efl_wl/efl_wl.c index 7e76d2a765..de86613a9f 100644 --- a/src/lib/efl_wl/efl_wl.c +++ b/src/lib/efl_wl/efl_wl.c @@ -326,6 +326,7 @@ struct Comp_Surface Eina_Bool dead : 1; Eina_Bool commit : 1; Eina_Bool extracted : 1; + Eina_Bool hint_set_weight : 1; }; struct Comp_Subsurface @@ -4997,9 +4998,18 @@ hints_set_aspect(struct wl_client *client, struct wl_resource *resource, struct shell_surface_aspect_update(cs); } +static void +hints_set_weight(struct wl_client *client, struct wl_resource *resource, struct wl_resource *surface, int w, int h) +{ + Comp_Surface *cs = wl_resource_get_user_data(surface); + cs->hint_set_weight = 1; + evas_object_size_hint_weight_set(cs->obj, w / 100., h / 100.); +} + static const struct efl_hints_interface hints_interface = { hints_set_aspect, + hints_set_weight, }; static void @@ -5496,7 +5506,7 @@ efl_wl_minmax_set(Evas_Object *obj, Eina_Bool set) } } -EAPI void * +void * efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t version, void *data, void *bind_cb) { Comp *c; @@ -5543,7 +5553,7 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event shell_surface_send_configure(data); } -EAPI Eina_Bool +Eina_Bool efl_wl_surface_extract(Evas_Object *surface) { Comp_Surface *cs; diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 77205592c1..09615f78f8 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -5976,6 +5976,17 @@ _efl_ui_win_efl_gfx_size_hint_hint_aspect_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Da #endif } +EOLIAN static void +_efl_ui_win_efl_gfx_size_hint_hint_weight_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *pd, + double w, double h) +{ + efl_gfx_size_hint_weight_set(efl_super(obj, MY_CLASS), w, h); +#ifdef HAVE_ELEMENTARY_WL2 + if (pd->wl.win) + ecore_wl2_window_weight_set(pd->wl.win, w, h); +#endif +} + EOLIAN static void _efl_ui_win_efl_gfx_size_hint_hint_base_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Size2D sz) { diff --git a/src/lib/elementary/efl_ui_win.eo b/src/lib/elementary/efl_ui_win.eo index d194dd294d..b7b7213e26 100644 --- a/src/lib/elementary/efl_ui_win.eo +++ b/src/lib/elementary/efl_ui_win.eo @@ -843,6 +843,7 @@ class Efl.Ui.Win (Elm.Widget, Efl.Canvas, Efl.Access.Window, Efl.Gfx.Size.Hint.hint_base { get; set; } Efl.Gfx.Size.Hint.hint_step { get; set; } Efl.Gfx.Size.Hint.hint_aspect { set; } + Efl.Gfx.Size.Hint.hint_weight { set; } Efl.Gfx.Size.Hint.hint_max { set; } Efl.Text.text { get; set; } Efl.Canvas.pointer_position { get; } diff --git a/src/wayland_protocol/efl-hints.xml b/src/wayland_protocol/efl-hints.xml index 51689d780c..64a40a8804 100644 --- a/src/wayland_protocol/efl-hints.xml +++ b/src/wayland_protocol/efl-hints.xml @@ -14,6 +14,11 @@ + + + + +