From 246023d1b324cebe4d5bd0057b62951de785839e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Thu, 24 Nov 2016 11:28:05 +0900 Subject: [PATCH] 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. --- data/elementary/themes/edc/elm/border.edc | 4 +-- src/lib/elementary/efl_ui_win.c | 35 +++++++++++------------ 2 files changed, 18 insertions(+), 21 deletions(-) diff --git a/data/elementary/themes/edc/elm/border.edc b/data/elementary/themes/edc/elm/border.edc index 5b2b6bce22..ad1cfec7b3 100644 --- a/data/elementary/themes/edc/elm/border.edc +++ b/data/elementary/themes/edc/elm/border.edc @@ -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"; } } diff --git a/src/lib/elementary/efl_ui_win.c b/src/lib/elementary/efl_ui_win.c index 9eb043c3ad..9c52d23a06 100644 --- a/src/lib/elementary/efl_ui_win.c +++ b/src/lib/elementary/efl_ui_win.c @@ -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);