elm win + ecore evas - fix csd stuff like base size and min sizing

this fixes a lot that was broken with csd... but not everything.

@fix
This commit is contained in:
Carsten Haitzler 2020-01-17 22:24:26 +00:00
parent 28aa1a65b6
commit de4a698c96
3 changed files with 66 additions and 40 deletions

View File

@ -210,6 +210,7 @@ struct _Efl_Ui_Win_Data
int norender;
int modal_count;
int response;
int ignore_frame_resize;
Eina_Bool req_wh : 1;
Eina_Bool req_xy : 1;
@ -1558,16 +1559,25 @@ _elm_win_frame_geometry_adjust(Efl_Ui_Win_Data *sd)
{
int fw, fh, ox, oy, ow, oh;
evas_object_geometry_get(sd->frame_obj, NULL, NULL, &fw, &fh);
sd->ignore_frame_resize++;
evas_object_resize(sd->frame_obj, 1000, 1000);
if (elm_widget_is_legacy(sd->obj))
edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
&ox, &oy, &ow, &oh);
else
edje_object_part_geometry_get(sd->frame_obj, "efl.spacer.opaque",
&ox, &oy, &ow, &oh);
evas_object_resize(sd->frame_obj, fw, fh);
sd->ignore_frame_resize--;
fw = 1000; fh = 1000;
l = ox;
t = oy;
r = fw - ow - l;
b = fh - oh - t;
if (l < 0) l = 0;
if (r < 0) r = 0;
if (t < 0) t = 0;
if (b < 0) b = 0;
}
ecore_evas_shadow_geometry_set(sd->ee, l, r, t, b);
}
@ -1590,17 +1600,22 @@ _elm_win_frame_obj_update(Efl_Ui_Win_Data *sd, Eina_Bool force)
int ox, oy, ow, oh;
int cx, cy, cw, ch;
int w, h;
int l, r, t, b;
if (!sd->frame_obj) return;
if (!sd->csd.need) return;
_elm_win_frame_geometry_adjust(sd);
ecore_evas_shadow_geometry_get(sd->ee, &l, &r, &t, &b);
sd->ignore_frame_resize++;
evas_object_geometry_get(sd->frame_obj, &ox, &oy, &ow, &oh);
evas_object_resize(sd->frame_obj, 1000, 1000);
if (elm_widget_is_legacy(sd->obj))
edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.content", &cx, &cy, &cw, &ch);
else
edje_object_part_geometry_get(sd->frame_obj, "efl.spacer.content", &cx, &cy, &cw, &ch);
if (!_elm_win_framespace_set(sd, cx, cy, ow - cw, oh - ch) && (!force)) return;
evas_object_resize(sd->frame_obj, ow, oh);
sd->ignore_frame_resize--;
if (!_elm_win_framespace_set(sd, cx, cy, 1000 - cw, 1000 - ch) && (!force)) return;
_elm_win_frame_geometry_adjust(sd);
if (!sd->first_draw) return;
@ -3733,10 +3748,10 @@ _elm_win_resize_objects_eval(Evas_Object *obj, Eina_Bool force_resize)
int fw, fh;
evas_output_framespace_get(sd->evas, NULL, NULL, &fw, &fh);
minw += fw;
minh += fh;
maxw += fw;
maxh += fh;
// minw += fw;
// minh += fh;
// maxw += fw;
// maxh += fh;
}
sd->tmp_updating_hints = 1;
@ -4215,6 +4230,7 @@ _elm_win_frame_obj_resize(void *data,
if (!(sd = data)) return;
if (!sd->legacy.edje) return;
if (sd->ignore_frame_resize > 0) return;
_elm_win_frame_obj_update(sd, 0);
}

View File

@ -313,7 +313,7 @@ static void
_ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
{
Ecore_Evas_Engine_Wl_Data *wdata;
int ow, oh, ew, eh;
int ow, oh, ew, eh, fw, fh;
int diff = 0;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -326,6 +326,8 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
ee->req.w = w;
ee->req.h = h;
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
/* TODO: wayland client can resize the ecore_evas directly.
* In the future, we will remove ee->req value in wayland backend */
ew = ee->w;
@ -335,55 +337,52 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
{
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w, ee->prop.min.h);
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
wdata->win->pending.min = 0;
}
if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
{
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w, ee->prop.max.h);
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
wdata->win->pending.max = 0;
}
if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
{
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h);
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
wdata->win->pending.min = 0;
}
if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max)
{
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w, ee->prop.max.h);
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
wdata->win->pending.max = 0;
}
if (!ee->prop.fullscreen)
{
int fw = 0, fh = 0;
int maxw = 0, maxh = 0;
int minw = 0, minh = 0;
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if (ECORE_EVAS_PORTRAIT(ee))
{
if (ee->prop.min.w > 0)
minw = (ee->prop.min.w - fw);
minw = (ee->prop.min.w);
if (ee->prop.min.h > 0)
minh = (ee->prop.min.h - fh);
minh = (ee->prop.min.h);
if (ee->prop.max.w > 0)
maxw = (ee->prop.max.w + fw);
maxw = (ee->prop.max.w);
if (ee->prop.max.h > 0)
maxh = (ee->prop.max.h + fh);
maxh = (ee->prop.max.h);
}
else
{
if (ee->prop.min.w > 0)
minw = (ee->prop.min.w - fh);
minw = (ee->prop.min.w);
if (ee->prop.min.h > 0)
minh = (ee->prop.min.h - fw);
minh = (ee->prop.min.h);
if (ee->prop.max.w > 0)
maxw = (ee->prop.max.w + fh);
maxw = (ee->prop.max.w);
if (ee->prop.max.h > 0)
maxh = (ee->prop.max.h + fw);
maxh = (ee->prop.max.h);
}
if ((maxw > 0) && (w > maxw))
@ -401,13 +400,13 @@ _ecore_evas_wl_common_resize(Ecore_Evas *ee, int w, int h)
/* calc new size using base size & step size */
if (ee->prop.step.w > 1)
{
int bw = ee->prop.base.w ?: minw;
int bw = ee->prop.base.w;
w = (bw + (((w - bw) / ee->prop.step.w) * ee->prop.step.w));
}
if (ee->prop.step.h > 1)
{
int bh = ee->prop.base.h ?: minh;
int bh = ee->prop.base.h;
h = (bh + (((h - bh) / ee->prop.step.h) * ee->prop.step.h));
}
@ -1671,6 +1670,7 @@ _ecore_evas_wl_common_name_class_set(Ecore_Evas *ee, const char *n, const char *
static void
_ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
{
int fw, fh;
Ecore_Evas_Engine_Wl_Data *wdata;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -1682,14 +1682,15 @@ _ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
ee->prop.min.w = w;
ee->prop.min.h = h;
wdata = ee->engine.data;
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel)
{
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, w, h);
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, w + fw, h + fh);
wdata->win->pending.min = 0;
}
if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel)
{
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w, h);
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, w + fw, h + fh);
wdata->win->pending.min = 0;
}
else
@ -1700,6 +1701,7 @@ _ecore_evas_wl_common_size_min_set(Ecore_Evas *ee, int w, int h)
static void
_ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h)
{
int fw, fh;
Ecore_Evas_Engine_Wl_Data *wdata;
LOGFN(__FILE__, __LINE__, __FUNCTION__);
@ -1710,14 +1712,15 @@ _ecore_evas_wl_common_size_max_set(Ecore_Evas *ee, int w, int h)
ee->prop.max.w = w;
ee->prop.max.h = h;
wdata = ee->engine.data;
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel)
{
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, w, h);
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, w + fw, h + fh);
wdata->win->pending.max = 0;
}
if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel)
{
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w, h);
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, w + fw, h + fh);
wdata->win->pending.max = 0;
}
else
@ -2153,31 +2156,30 @@ _ecore_evas_wl_common_show(Ecore_Evas *ee)
{
int fw, fh;
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
if (wdata->win->xdg_set_min_size && wdata->win->xdg_toplevel && wdata->win->pending.min)
{
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w, ee->prop.min.h);
wdata->win->xdg_set_min_size(wdata->win->xdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
wdata->win->pending.min = 0;
}
if (wdata->win->xdg_set_max_size && wdata->win->xdg_toplevel && wdata->win->pending.max)
{
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w, ee->prop.max.h);
wdata->win->xdg_set_max_size(wdata->win->xdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
wdata->win->pending.max = 0;
}
if (wdata->win->zxdg_set_min_size && wdata->win->zxdg_toplevel && wdata->win->pending.min)
{
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w, ee->prop.min.h);
wdata->win->zxdg_set_min_size(wdata->win->zxdg_toplevel, ee->prop.min.w + fw, ee->prop.min.h + fh);
wdata->win->pending.min = 0;
}
if (wdata->win->zxdg_set_max_size && wdata->win->zxdg_toplevel && wdata->win->pending.max)
{
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w, ee->prop.max.h);
wdata->win->zxdg_set_max_size(wdata->win->zxdg_toplevel, ee->prop.max.w + fw, ee->prop.max.h + fh);
wdata->win->pending.max = 0;
}
_ecore_evas_wayland_window_update(ee, wdata, ee->alpha);
evas_output_framespace_get(ee->evas, NULL, NULL, &fw, &fh);
ecore_wl2_window_show(wdata->win);
einfo = (Evas_Engine_Info_Wayland *)evas_engine_info_get(ee->evas);
if (einfo)

View File

@ -1534,6 +1534,8 @@ _ecore_evas_x_shadow_update(Ecore_Evas *ee)
ECORE_X_ATOM_CARDINAL, 32, shadow, 4);
}
static void _ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee);
static Eina_Bool
_ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSED, void *event)
{
@ -1672,6 +1674,8 @@ _ecore_evas_x_event_window_configure(void *data EINA_UNUSED, int type EINA_UNUSE
}
}
}
if (framespace_resized)
_ecore_evas_x_size_pos_hints_update(ee);
}
return ECORE_CALLBACK_PASS_ON;
}
@ -1763,15 +1767,19 @@ _ecore_evas_x_event_window_hide(void *data EINA_UNUSED, int type EINA_UNUSED, vo
static void
_ecore_evas_x_size_pos_hints_update(Ecore_Evas *ee)
{
int fw, fh;
fw = ee->framespace.w;
fh = ee->framespace.h;
ecore_x_icccm_size_pos_hints_set(ee->prop.window,
ee->prop.request_pos /*request_pos */,
ECORE_X_GRAVITY_NW /* gravity */,
ee->prop.min.w /* min_w */,
ee->prop.min.h /* min_h */,
ee->prop.max.w /* max_w */,
ee->prop.max.h /* max_h */,
ee->prop.base.w /* base_w */,
ee->prop.base.h /* base_h */,
ee->prop.min.w + fw /* min_w */,
ee->prop.min.h + fh /* min_h */,
ee->prop.max.w + fw /* max_w */,
ee->prop.max.h + fh /* max_h */,
ee->prop.base.w + fw /* base_w */,
ee->prop.base.h + fh /* base_h */,
ee->prop.step.w /* step_x */,
ee->prop.step.h /* step_y */,
ee->prop.aspect /* min_aspect */,