win: Fix (hack around) E internal windows in Wayland

My previous patches have broken E Wayland internal windows, as
the compositor wants to create Server-Side Decorations[1] but
based on some mysterious heuristics, E will decide to show or
not SSD. It seems the surface geometry, window geometry,
input region and maybe opaque region need to all match. There
was a pixel difference in the theme which broke everything,
also CSD shadows must be turned off in that case.

This also fixes inputs as for some reason a mismatching input
region vs window geometry would break pointer move/up/down in
those internal windows.

[1] I believe this is not a great idea and E should never draw
    any server-side decorations in Wayland. Wayland was supposed
    to mean only CSD, no more SSD.
This commit is contained in:
Jean-Philippe Andre 2016-11-24 11:28:05 +09:00
parent 4584fe5721
commit 246023d1b3
2 changed files with 18 additions and 21 deletions

View File

@ -34,8 +34,8 @@ group { name: "elm/border/base/default";
/* opaque region of the window, to inform the compositor */
spacer { "elm.spacer.opaque";
desc {
rel1.to: "top_clip";
rel2.to: "bottom_clip";
rel1.offset: 0 0;
rel2.offset: -1 -1;
}
desc { "max"; inherit: "default"; }
}

View File

@ -3248,8 +3248,10 @@ _elm_win_xwin_update(Efl_Ui_Win_Data *sd)
ecore_evas_wm_rotation_preferred_rotation_set(sd->ee,
sd->wm_rot.preferred_rot);
if (sd->csd.need)
#ifdef HAVE_ELEMENTARY_X
if (sd->csd.need && sd->x.xwin)
TRAP(sd, borderless_set, EINA_TRUE);
#endif
}
#endif
@ -4153,14 +4155,6 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
sd->csd.need_menu = EINA_FALSE;
}
/* TEMPORARY HACK FOR E WAYLAND
* Hiding the shadows makes the input region (elm.spacer.opaque) have the
* same geometry as the surface itself. This fixes inputs in E Wayland
* internal windows. FIXME FIXME FIXME.
*/
if (sd->csd.wayland)
sd->csd.need_shadow = EINA_FALSE;
borderless = sd->csd.need_borderless || (!sd->csd.need) || sd->fullscreen;
maximized = sd->maximized;
shadow = sd->csd.need_shadow && (!sd->fullscreen) && (!sd->maximized);
@ -4169,6 +4163,14 @@ _elm_win_frame_style_update(Efl_Ui_Win_Data *sd, Eina_Bool force_emit, Eina_Bool
unresizable = sd->csd.need_unresizable;
menu = sd->csd.need_menu;
/* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME
* At the moment, E Wayland uses SSD for its internal windows. Which means
* we must hide the shadow if the borderless flag is set. "trap" here means
* we are likely to be running inside E compositor.
* FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME FIXME */
if (trap && sd->csd.wayland && sd->csd.need_borderless)
shadow = 0;
#define STATE_SET(state, s1, s2) do { \
if (force_emit || (state != sd->csd.cur_##state)) \
{ \
@ -5240,18 +5242,13 @@ EOLIAN static void
_efl_ui_win_borderless_set(Eo *obj, Efl_Ui_Win_Data *sd, Eina_Bool borderless)
{
sd->csd.need_borderless = borderless ? 1 : 0;
/* TEMPORARY HACK FOR E WAYLAND
* E Wayland sets the borderless flag on its internal windows, even though
* it actually expects to "see" borders. Not sure who is supposed to create
* them (E comp or the window).
*/
if (trap && trap->borderless_set && sd->csd.wayland)
sd->csd.need_borderless = 0;
_elm_win_frame_style_update(sd, 0, 1);
TRAP(sd, borderless_set, borderless);
#ifdef HAVE_ELEMENTARY_X
if (!sd->x.xwin || !sd->csd.need)
#endif
TRAP(sd, borderless_set, borderless);
_elm_win_resize_objects_eval(obj);
#ifdef HAVE_ELEMENTARY_X
_elm_win_xwin_update(sd);