discomfitor pushed a commit to branch master.

http://git.enlightenment.org/core/elementary.git/commit/?id=4624a897e9a796a69a7dc3e1172ad01e1cbbd262

commit 4624a897e9a796a69a7dc3e1172ad01e1cbbd262
Author: Mike Blumenkrantz <zm...@osg.samsung.com>
Date:   Mon Jul 20 17:35:00 2015 -0400

    win: redo wayland opaque region setting
    
    * convert opaque region theme part to SPACER
      - add rels for shaded/maximized state
    * namespace opaque region theme part
    * update opaque region only on pre-render
      - fixes race condition between render size and opaque size
    
    ref T2575
---
 data/themes/edc/elm/border.edc | 14 ++++++++--
 src/lib/elm_win.c              | 62 +++++++++++++++++++++++++++++-------------
 2 files changed, 54 insertions(+), 22 deletions(-)

diff --git a/data/themes/edc/elm/border.edc b/data/themes/edc/elm/border.edc
index 6f516f0..37a9f4e 100644
--- a/data/themes/edc/elm/border.edc
+++ b/data/themes/edc/elm/border.edc
@@ -797,12 +797,16 @@ group { name: "elm/border/base/default";
    images.image: "win_shadow.png" COMP;
    data.item: "shadow" "1";
    parts {
-      part { name: "opaque_region"; type: RECT; mouse_events: 0;
-         description { state: "default";
+      spacer { "elm.spacer.opaque";
+         desc {
             rel1.to: "top";
             rel2.to: "bottom";
-            color: 0 0 0 0;
          }
+         desc { "shaded";
+            rel1.to: "top";
+            rel2.to: "elm.swallow.client";
+         }
+         desc { "max"; inherit: "shaded"; }
       }
       part { name: "shadow_clip"; type: RECT; mouse_events: 0;
          description { state: "default";
@@ -1448,6 +1452,7 @@ group { name: "elm/border/base/default";
 //         signal: "elm,state,shading"; source: "elm";
          action: STATE_SET "shaded" 0.0;
          target: "elm.swallow.client";
+         target: "elm.spacer.opaque";
          target: "bottom";
          target: "bevel2";
          target: "elm.event.resize.bl";
@@ -1458,6 +1463,7 @@ group { name: "elm/border/base/default";
          signal: "elm,state,unshading"; source: "elm";
          action: STATE_SET "default" 0.0;
          target: "bottom";
+         target: "elm.spacer.opaque";
          target: "bevel2";
          target: "elm.event.resize.bl";
          target: "elm.event.resize.b";
@@ -1488,6 +1494,7 @@ group { name: "elm/border/base/default";
          signal: "elm,state,maximize*"; source: "elm";
          action: STATE_SET "max" 0.0;
          target: "elm.swallow.client";
+         target: "elm.spacer.opaque";
          target: "bottom";
          target: "bevel2";
          target: "shadow_spacer";
@@ -1499,6 +1506,7 @@ group { name: "elm/border/base/default";
          signal: "elm,state,unmaximize*"; source: "elm";
          action: STATE_SET "default" 0.0;
          target: "elm.swallow.client";
+         target: "elm.spacer.opaque";
          target: "bottom";
          target: "bevel2";
          target: "shadow_spacer";
diff --git a/src/lib/elm_win.c b/src/lib/elm_win.c
index 5c70a99..4c99337 100644
--- a/src/lib/elm_win.c
+++ b/src/lib/elm_win.c
@@ -115,6 +115,7 @@ struct _Elm_Win_Data
    struct
    {
       Ecore_Wl_Window *win;
+      Eina_Bool opaque_dirty : 1;
    } wl;
 #endif
 
@@ -1226,40 +1227,45 @@ _elm_win_profile_update(Elm_Win_Data *sd)
    eo_do(sd->obj, eo_event_callback_call(ELM_WIN_EVENT_PROFILE_CHANGED, NULL));
 }
 
+#ifdef HAVE_ELEMENTARY_WAYLAND
 static void
-_elm_win_frame_obj_update(Elm_Win_Data *sd)
+_elm_win_opaque_update(Elm_Win_Data *sd)
 {
-   int fx, fy, fw, fh;
    int ox, oy, ow, oh;
-   int x, y, w, h;
 
    if (sd->fullscreen)
      {
-        evas_output_framespace_set(sd->evas, 0, 0, 0, 0);
-#ifdef HAVE_ELEMENTARY_WAYLAND
         ecore_evas_geometry_get(sd->ee, NULL, NULL, &ow, &oh);
         ecore_wl_window_opaque_region_set(sd->wl.win, 0, 0, ow, oh);
         return;
-#endif
      }
 
-   evas_object_geometry_get(sd->frame_obj, &fx, &fy, &fw, &fh);
-   evas_object_geometry_get(sd->client_obj, &ox, &oy, &ow, &oh);
-   evas_output_framespace_get(sd->evas, &x, &y, &w, &h);
+   edje_object_part_geometry_get(sd->frame_obj, "elm.spacer.opaque",
+                                 &ox, &oy, &ow, &oh);
+   DBG("Opaque: %d %d %d %d", ox, oy, ow, oh);
+   ecore_wl_window_opaque_region_set(sd->wl.win, ox, oy, ow - 50, oh);//ow - 
ox, oh - oy);
+}
+#endif
 
-   if ((x != (ox - fx)) || (y != (oy - fy)) ||
-       (w != (fw - ow)) || (h != (fh - oh)))
-     {
-        evas_output_framespace_set(sd->evas, (ox - fx), (oy - fy),
-                                   (fw - ow), (fh - oh));
-     }
+static void
+_elm_win_frame_obj_update(Elm_Win_Data *sd)
+{
+   int fx, fy, fw, fh;
+   int ox, oy, ow, oh;
 
 #ifdef HAVE_ELEMENTARY_WAYLAND
-   edje_object_part_geometry_get(sd->frame_obj, "opaque_region",
-                                 &ox, &oy, &ow, &oh);
-   DBG("Opaque: %d %d %d %d", ox, oy, ow, oh);
-   ecore_wl_window_opaque_region_set(sd->wl.win, ox, oy, ow, oh);//ow - ox, oh 
- oy);
+   sd->wl.opaque_dirty = 1;
 #endif
+   if (sd->fullscreen)
+     {
+        evas_output_framespace_set(sd->evas, 0, 0, 0, 0);
+        return;
+     }
+
+   evas_object_geometry_get(sd->frame_obj, &fx, &fy, &fw, &fh);
+   evas_object_geometry_get(sd->client_obj, &ox, &oy, &ow, &oh);
+
+   evas_output_framespace_set(sd->evas, (ox - fx), (oy - fy), (fw - ow), (fh - 
oh));
 }
 
 static void
@@ -2854,6 +2860,18 @@ _elm_win_frame_cb_close(void *data,
    evas_object_unref(win);
 }
 
+#ifdef HAVE_ELEMENTARY_WAYLAND
+static void
+_elm_win_frame_pre_render(void *data, Evas *e EINA_UNUSED, void *ev 
EINA_UNUSED)
+{
+   Elm_Win_Data *sd = data;
+
+   if (sd->wl.opaque_dirty)
+     _elm_win_opaque_update(sd);
+   sd->wl.opaque_dirty = 0;
+}
+#endif
+
 static void
 _elm_win_frame_add(Elm_Win_Data *sd,
                    const char *style)
@@ -2902,6 +2920,9 @@ _elm_win_frame_add(Elm_Win_Data *sd,
      (sd->frame_obj, EVAS_CALLBACK_MOVE, _elm_win_frame_obj_move, sd);
    evas_object_event_callback_add
      (sd->frame_obj, EVAS_CALLBACK_RESIZE, _elm_win_frame_obj_resize, sd);
+#ifdef HAVE_ELEMENTARY_WAYLAND
+   evas_event_callback_add(sd->evas, EVAS_CALLBACK_RENDER_PRE, 
_elm_win_frame_pre_render, sd);
+#endif
 
    /* NB: Do NOT remove these calls !! Needed to calculate proper
     * framespace on inital show of the window */
@@ -2957,6 +2978,9 @@ _elm_win_frame_del(Elm_Win_Data *sd)
           (sd->frame_obj, EVAS_CALLBACK_MOVE, _elm_win_frame_obj_move, sd);
         evas_object_event_callback_del_full
           (sd->frame_obj, EVAS_CALLBACK_RESIZE, _elm_win_frame_obj_resize, sd);
+#ifdef HAVE_ELEMENTARY_WAYLAND
+        evas_event_callback_del_full(sd->evas, EVAS_CALLBACK_RENDER_PRE, 
_elm_win_frame_pre_render, sd);
+#endif
 
         edje_object_signal_callback_del
           (sd->frame_obj, "elm,action,move,start", "elm",

-- 


Reply via email to