forked from enlightenment/efl
wayland: add support for efl weight hint propagation from elm_win to efl_wl
@feature
This commit is contained in:
parent
e9572a6537
commit
ed30f41de8
|
@ -330,7 +330,7 @@ _cb_global_add(void *data, struct wl_registry *registry, unsigned int id, const
|
||||||
{
|
{
|
||||||
Ecore_Wl2_Window *window;
|
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)
|
EINA_INLIST_FOREACH(ewd->windows, window)
|
||||||
if (window->zxdg_toplevel && window->aspect.set)
|
if (window->zxdg_toplevel && window->aspect.set)
|
||||||
efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
|
efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
|
||||||
|
|
|
@ -199,6 +199,12 @@ struct _Ecore_Wl2_Window
|
||||||
Eina_Bool set : 1;
|
Eina_Bool set : 1;
|
||||||
} aspect;
|
} aspect;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int w, h;
|
||||||
|
Eina_Bool set : 1;
|
||||||
|
} weight;
|
||||||
|
|
||||||
Eina_Inlist *subsurfs;
|
Eina_Inlist *subsurfs;
|
||||||
Eina_List *supported_aux_hints;
|
Eina_List *supported_aux_hints;
|
||||||
Eina_List *frame_callbacks;
|
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);
|
void _ecore_wl2_offer_unref(Ecore_Wl2_Offer *offer);
|
||||||
Eina_Bool _ecore_wl2_display_sync_get(void);
|
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;
|
||||||
EAPI extern int _ecore_wl2_event_window_www_drag;
|
EAPI extern int _ecore_wl2_event_window_www_drag;
|
||||||
|
|
||||||
|
|
|
@ -358,6 +358,9 @@ _ecore_wl2_window_shell_surface_init(Ecore_Wl2_Window *window)
|
||||||
if (window->aspect.set && window->display->wl.efl_hints)
|
if (window->aspect.set && window->display->wl.efl_hints)
|
||||||
efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
|
efl_hints_set_aspect(window->display->wl.efl_hints, window->zxdg_toplevel,
|
||||||
window->aspect.w, window->aspect.h, window->aspect.aspect);
|
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);
|
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);
|
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
|
static void
|
||||||
_frame_cb(void *data, struct wl_callback *callback, uint32_t timestamp)
|
_frame_cb(void *data, struct wl_callback *callback, uint32_t timestamp)
|
||||||
{
|
{
|
||||||
|
|
|
@ -326,6 +326,7 @@ struct Comp_Surface
|
||||||
Eina_Bool dead : 1;
|
Eina_Bool dead : 1;
|
||||||
Eina_Bool commit : 1;
|
Eina_Bool commit : 1;
|
||||||
Eina_Bool extracted : 1;
|
Eina_Bool extracted : 1;
|
||||||
|
Eina_Bool hint_set_weight : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Comp_Subsurface
|
struct Comp_Subsurface
|
||||||
|
@ -4997,9 +4998,18 @@ hints_set_aspect(struct wl_client *client, struct wl_resource *resource, struct
|
||||||
shell_surface_aspect_update(cs);
|
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 =
|
static const struct efl_hints_interface hints_interface =
|
||||||
{
|
{
|
||||||
hints_set_aspect,
|
hints_set_aspect,
|
||||||
|
hints_set_weight,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
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)
|
efl_wl_global_add(Evas_Object *obj, const void *interface, uint32_t version, void *data, void *bind_cb)
|
||||||
{
|
{
|
||||||
Comp *c;
|
Comp *c;
|
||||||
|
@ -5543,7 +5553,7 @@ extracted_changed(void *data, Evas *e EINA_UNUSED, Evas_Object *obj, void *event
|
||||||
shell_surface_send_configure(data);
|
shell_surface_send_configure(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
EAPI Eina_Bool
|
Eina_Bool
|
||||||
efl_wl_surface_extract(Evas_Object *surface)
|
efl_wl_surface_extract(Evas_Object *surface)
|
||||||
{
|
{
|
||||||
Comp_Surface *cs;
|
Comp_Surface *cs;
|
||||||
|
|
|
@ -5976,6 +5976,17 @@ _efl_ui_win_efl_gfx_size_hint_hint_aspect_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Da
|
||||||
#endif
|
#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
|
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)
|
_efl_ui_win_efl_gfx_size_hint_hint_base_set(Eo *obj EINA_UNUSED, Efl_Ui_Win_Data *sd, Eina_Size2D sz)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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_base { get; set; }
|
||||||
Efl.Gfx.Size.Hint.hint_step { get; set; }
|
Efl.Gfx.Size.Hint.hint_step { get; set; }
|
||||||
Efl.Gfx.Size.Hint.hint_aspect { set; }
|
Efl.Gfx.Size.Hint.hint_aspect { set; }
|
||||||
|
Efl.Gfx.Size.Hint.hint_weight { set; }
|
||||||
Efl.Gfx.Size.Hint.hint_max { set; }
|
Efl.Gfx.Size.Hint.hint_max { set; }
|
||||||
Efl.Text.text { get; set; }
|
Efl.Text.text { get; set; }
|
||||||
Efl.Canvas.pointer_position { get; }
|
Efl.Canvas.pointer_position { get; }
|
||||||
|
|
|
@ -14,6 +14,11 @@
|
||||||
<arg name="height" type="uint"/>
|
<arg name="height" type="uint"/>
|
||||||
<arg name="aspect" type="uint" enum="aspect"/>
|
<arg name="aspect" type="uint" enum="aspect"/>
|
||||||
</request>
|
</request>
|
||||||
|
<request name="set_weight">
|
||||||
|
<arg name="surface" type="object" interface="zxdg_toplevel_v6"/>
|
||||||
|
<arg name="width" type="int"/>
|
||||||
|
<arg name="height" type="int"/>
|
||||||
|
</request>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
</protocol>
|
</protocol>
|
||||||
|
|
Loading…
Reference in New Issue