e_comp_wl: use cdata instead of ec->comp_data at _e_comp_wl_surface_state_commit... 65/249465/3
authorSooChan Lim <sc1.lim@samsung.com>
Sat, 12 Dec 2020 06:05:00 +0000 (15:05 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Mon, 14 Dec 2020 08:23:38 +0000 (08:23 +0000)
Change-Id: Ib7220c67826dcb104bcd7bea658de32b4915643a

src/bin/e_comp_wl.c

index d760afa80d766192a79d0ad471428ff864844edc..61b1cdfb8b8f9ed4e26a814ed3b1d6dfe4162365 100644 (file)
@@ -2413,12 +2413,13 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
    E_Comp_Wl_Buffer *buffer;
    struct wl_resource *cb;
    Eina_List *l, *ll;
-   E_Comp_Wl_Buffer_Viewport *vp = &ec->comp_data->scaler.buffer_viewport;
+   E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
+   E_Comp_Wl_Buffer_Viewport *vp = &cdata->scaler.buffer_viewport;
 
    if (ec->ignored)
      {
         if ((ec->internal) ||
-            (ec->comp_data->shell.surface && state->new_attach))
+            (cdata->shell.surface && state->new_attach))
           {
              EC_CHANGED(ec);
              ec->new_client = 1;
@@ -2428,6 +2429,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
           }
      }
 
+   /* buffer transform */
    if (vp->buffer.transform != state->buffer_viewport.buffer.transform)
      {
         E_Output *eout;
@@ -2457,7 +2459,8 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
           }
      }
 
-   ec->comp_data->scaler.buffer_viewport = state->buffer_viewport;
+   /* assign a new buffer_vieport to cdata->scaler.buffer_viewport */
+   cdata->scaler.buffer_viewport = state->buffer_viewport;
 
    if (state->new_attach)
      {
@@ -2466,8 +2469,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
      }
 
    /* emit a apply_viewport signal when the information of viewport and buffer is ready */
-   wl_signal_emit(&ec->comp_data->apply_viewport_signal,
-                  &ec->comp_data->surface);
+   wl_signal_emit(&cdata->apply_viewport_signal, &cdata->surface);
 
    _e_comp_wl_surface_state_buffer_set(state, NULL);
 
@@ -2477,6 +2479,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
         _e_comp_wl_surface_state_size_update(ec, state);
         e_comp_wl_map_size_cal_from_viewport(ec);
 
+        /* update the position */
         if (ec->changes.pos)
           {
              e_comp_object_frame_xy_unadjust(ec->frame,
@@ -2523,10 +2526,10 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
    if (!e_pixmap_usable_get(ec->pixmap))
      {
         /* unmap ec */
-        if (ec->comp_data->mapped)
+        if (cdata->mapped)
           {
-             if ((ec->comp_data->shell.surface) &&
-                 (ec->comp_data->shell.unmap))
+             if ((cdata->shell.surface) &&
+                 (cdata->shell.unmap))
                {
                   ELOGF("COMP", "Try to unmap. Call shell.unmap.", ec);
                   if (ec->show_pending.count > 0)
@@ -2542,37 +2545,37 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
                          }
                        ec->show_pending.running = EINA_FALSE;
                     }
-                  ec->comp_data->shell.unmap(ec->comp_data->shell.surface);
+                  cdata->shell.unmap(cdata->shell.surface);
                }
              else if ((ec->internal) ||
-                      (ec->comp_data->sub.data) ||
+                      (cdata->sub.data) ||
                       (ec == e_comp_wl->drag_client))
                {
                   ELOGF("COMP", "Try to unmap. Hide window. internal:%d, sub:%p, drag:%d",
-                        ec, ec->internal, ec->comp_data->sub.data, (ec == e_comp_wl->drag_client));
+                        ec, ec->internal, cdata->sub.data, (ec == e_comp_wl->drag_client));
                   ec->visible = EINA_FALSE;
                   evas_object_hide(ec->frame);
-                  ec->comp_data->mapped = 0;
+                  cdata->mapped = 0;
                }
           }
 
-        if ((ec->comp_data->sub.below_obj) &&
-            (evas_object_visible_get(ec->comp_data->sub.below_obj)))
+        if ((cdata->sub.below_obj) &&
+            (evas_object_visible_get(cdata->sub.below_obj)))
           {
-             evas_object_hide(ec->comp_data->sub.below_obj);
+             evas_object_hide(cdata->sub.below_obj);
           }
      }
    else
      {
         /* map ec */
-        if (!ec->comp_data->mapped)
+        if (!cdata->mapped)
           {
-             if ((ec->comp_data->shell.surface) &&
-                 (ec->comp_data->shell.map) &&
+             if ((cdata->shell.surface) &&
+                 (cdata->shell.map) &&
                  (!ec->ignored))
                {
                   ELOGF("COMP", "Try to map. Call shell.map.", ec);
-                  ec->comp_data->shell.map(ec->comp_data->shell.surface);
+                  cdata->shell.map(cdata->shell.surface);
                }
              else if ((ec->internal) ||
                       (e_comp_wl_subsurface_can_show(ec)) ||
@@ -2583,23 +2586,23 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
                   ec->visible = EINA_TRUE;
                   ec->ignored = 0;
                   evas_object_show(ec->frame);
-                  ec->comp_data->mapped = 1;
+                  cdata->mapped = 1;
                }
           }
 
-        if ((ec->comp_data->sub.below_obj) &&
-            (!evas_object_visible_get(ec->comp_data->sub.below_obj)) &&
+        if ((cdata->sub.below_obj) &&
+            (!evas_object_visible_get(cdata->sub.below_obj)) &&
             (evas_object_visible_get(ec->frame)))
           {
-             evas_object_show(ec->comp_data->sub.below_obj);
+             evas_object_show(cdata->sub.below_obj);
           }
      }
 
    if ((state->new_attach) ||
        (state->buffer_viewport.changed))
      {
-        if ((ec->comp_data->shell.surface) &&
-            (ec->comp_data->shell.configure))
+        if ((cdata->shell.surface) &&
+            (cdata->shell.configure))
           {
              e_comp_wl_commit_sync_configure(ec);
           }
@@ -2632,7 +2635,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
           }
      }
 
-   if (ec->comp_data->scaler.buffer_viewport.changed)
+   if (cdata->scaler.buffer_viewport.changed)
      {
         if (e_comp_wl->touch.pressed && !e_policy_client_is_keyboard_sub(ec))
           e_comp_wl_touch_cancel();
@@ -2648,7 +2651,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
    state->sy = 0;
    state->new_attach = EINA_FALSE;
 
-   EINA_LIST_FOREACH_SAFE(ec->comp_data->frames, l, ll, cb)
+   EINA_LIST_FOREACH_SAFE(cdata->frames, l, ll, cb)
      {
         wl_callback_send_done(cb, (unsigned int)(ecore_loop_time_get() * 1000));
         wl_resource_destroy(cb);
@@ -2656,12 +2659,12 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
 
    /* insert state frame callbacks into comp_data->frames
     * NB: This clears state->frames list */
-   ec->comp_data->frames = eina_list_merge(ec->comp_data->frames,
+   cdata->frames = eina_list_merge(cdata->frames,
                                            state->frames);
    state->frames = NULL;
 
-   e_presentation_time_container_feedback_discard(&ec->comp_data->presentation_container);
-   e_presentation_time_container_feedback_merge(&ec->comp_data->presentation_container,
+   e_presentation_time_container_feedback_discard(&cdata->presentation_container);
+   e_presentation_time_container_feedback_merge(&cdata->presentation_container,
                                                 &state->presentation_container);
 
    buffer = e_pixmap_resource_get(ec->pixmap);
@@ -2672,14 +2675,14 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
         /* FIXME: workaround for bad wayland egl driver which doesn't send damage request */
         if (!eina_list_count(state->damages) && !eina_list_count(state->buffer_damages))
           {
-             if ((ec->comp_data->buffer_ref.buffer) &&
-                 ((ec->comp_data->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) ||
-                  (ec->comp_data->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_TBM)))
+             if ((cdata->buffer_ref.buffer) &&
+                 ((cdata->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_NATIVE) ||
+                  (cdata->buffer_ref.buffer->type == E_COMP_WL_BUFFER_TYPE_TBM)))
                {
                   e_comp_object_damage(ec->frame,
                                        0, 0,
-                                       ec->comp_data->buffer_ref.buffer->w,
-                                       ec->comp_data->buffer_ref.buffer->h);
+                                       cdata->buffer_ref.buffer->w,
+                                       cdata->buffer_ref.buffer->h);
                }
           }
         else
@@ -2788,7 +2791,7 @@ _e_comp_wl_surface_state_commit(E_Client *ec, E_Comp_Wl_Surface_State *state)
 
    e_comp_wl_subsurface_check_below_bg_rectangle(ec);
 
-   if ((ec->comp_data->video_client) &&
+   if ((cdata->video_client) &&
        ((buffer) &&
         (buffer->type == E_COMP_WL_BUFFER_TYPE_VIDEO)) &&
        (e_comp->wl_comp_data->available_hw_accel.underlay))