e_xdg_shell_v6: use e_client_cdata_get 18/247618/1
authorSooChan Lim <sc1.lim@samsung.com>
Wed, 11 Nov 2020 03:19:10 +0000 (12:19 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Thu, 12 Nov 2020 23:21:57 +0000 (08:21 +0900)
Change-Id: Iecee71a1e1e27a99dd7897569bf8edab57f26df8

src/bin/e_xdg_shell_v6.c

index 6cb31e889c9c012cd75c3f1753f42b509fa919d9..d1f4ff1f0616fc7b08a2299c668028f387816b0a 100644 (file)
@@ -144,10 +144,13 @@ static Eina_Rectangle   _e_xdg_positioner_geometry_get(E_Xdg_Positioner *p);
 static Eina_Bool
 _e_client_shsurface_assignable_check(E_Client *ec)
 {
+   E_Comp_Wl_Client_Data *cdata;
+
    if (!e_shell_e_client_shell_assignable_check(ec))
      {
         ERR("Could not assign shell", ec);
-        wl_resource_post_error(ec->comp_data->surface,
+        cdata = e_client_cdata_get(ec);
+        wl_resource_post_error(cdata->surface,
                                WL_DISPLAY_ERROR_INVALID_OBJECT,
                                "Could not assign shell surface to wl_surface");
         return EINA_FALSE;
@@ -159,7 +162,8 @@ _e_client_shsurface_assignable_check(E_Client *ec)
 static Eina_Bool
 _e_client_xdg_shell_v6_assigned_check(E_Client *ec)
 {
-   return !!ec->comp_data->sh_v6.res_role;
+   E_Comp_Wl_Client_Data *cdata = e_client_cdata_get(ec);
+   return !!cdata->sh_v6.res_role;
 }
 
 static void
@@ -167,17 +171,27 @@ _e_client_xdg_shell_v6_assign(E_Client *ec,
                               struct wl_resource *resource,
                               E_Comp_Wl_Sh_Surf_Role role)
 {
-   if ((!ec) || (!ec->comp_data) || (e_object_is_del(E_OBJECT(ec))))
-     return;
-   ec->comp_data->sh_v6.res_role = resource;
-   ec->comp_data->sh_v6.role = role;
+   E_Comp_Wl_Client_Data *cdata;
+
+   if (!ec) return;
+   if (e_object_is_del(E_OBJECT(ec))) return;
+   cdata = e_client_cdata_get(ec);
+   if (!cdata) return;
+
+   cdata->sh_v6.res_role = resource;
+   cdata->sh_v6.role = role;
 }
 
 static void
 _e_client_xdg_shell_v6_role_assingment_unset(E_Client *ec)
 {
-   if ((!ec) || (!ec->comp_data) || (e_object_is_del(E_OBJECT(ec))))
-     return;
+   E_Comp_Wl_Client_Data *cdata;
+
+   if (!ec) return;
+   if (e_object_is_del(E_OBJECT(ec))) return;
+   cdata = e_client_cdata_get(ec);
+   if (!cdata) return;
+
    _e_client_xdg_shell_v6_assign(ec, NULL, E_COMP_WL_SH_SURF_ROLE_NONE);
 }
 
@@ -204,9 +218,13 @@ _e_xdg_popup_positioner_apply(E_Xdg_Popup *popup, E_Xdg_Positioner *pos)
 static void
 _e_xdg_popup_parent_set(E_Xdg_Popup *popup, E_Xdg_Surface *parent)
 {
+   E_Comp_Wl_Client_Data *parent_cdata;
+
    popup->parent = parent;
+   parent_cdata = e_client_cdata_get(parent->ec);
+
    /* set this client as a transient for parent */
-   e_shell_e_client_parent_set(popup->base.ec, parent->ec->comp_data->surface);
+   e_shell_e_client_parent_set(popup->base.ec, parent_cdata->surface);
 }
 
 static void
@@ -297,6 +315,7 @@ static void
 _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel)
 {
    E_Client *ec;
+   E_Comp_Wl_Client_Data *cdata;
    int pw, ph;
 
    ec = toplevel->base.ec;
@@ -306,9 +325,10 @@ _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel)
         return;
      }
 
-   if (!ec->comp_data)
+   cdata = e_client_cdata_get(ec);
+   if (!cdata)
      {
-        ERR("E_Client must have E_Comp_Client_Data", ec);
+        ERR("E_Client must have E_Comp_Wl_Client_Data", ec);
         return;
      }
 
@@ -327,8 +347,8 @@ _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel)
    e_pixmap_size_get(ec->pixmap, &pw, &ph);
 
    if ((toplevel->next.state.maximized || toplevel->next.state.fullscreen) &&
-        (toplevel->next.size.w != ec->comp_data->shell.window.w ||
-        toplevel->next.size.h != ec->comp_data->shell.window.h ||
+        (toplevel->next.size.w != cdata->shell.window.w ||
+        toplevel->next.size.h != cdata->shell.window.h ||
         toplevel->next.size.w != pw ||
         toplevel->next.size.h != ph))
      {
@@ -338,7 +358,7 @@ _e_xdg_toplevel_committed(E_Xdg_Toplevel *toplevel)
             toplevel->next.state.maximized,
             toplevel->next.state.fullscreen,
             toplevel->next.size.w, toplevel->next.size.h,
-            ec->comp_data->shell.window.w, ec->comp_data->shell.window.h,
+            cdata->shell.window.w, cdata->shell.window.h,
             pw, ph);
         /* TODO Disable this part for now, but need to consider enabling it later.
          * To enable this part, we first need to ensure that do not send configure
@@ -570,6 +590,7 @@ _e_xdg_toplevel_cb_parent_set(struct wl_client *client,
 {
    E_Xdg_Toplevel *toplevel, *parent;
    E_Client *pc;
+   E_Comp_Wl_Client_Data *pc_cdata;
    struct wl_resource *parent_wsurface = NULL;
 
    toplevel = wl_resource_get_user_data(resource);
@@ -599,9 +620,10 @@ _e_xdg_toplevel_cb_parent_set(struct wl_client *client,
              return;
           }
 
-        if (!pc->comp_data) return;
+        pc_cdata = e_client_cdata_get(pc);
+        if (!pc_cdata) return;
 
-        parent_wsurface = pc->comp_data->surface;
+        parent_wsurface = pc_cdata->surface;
      }
 
    /* set this client as a transient for parent */
@@ -1107,7 +1129,7 @@ _e_xdg_surface_cb_configure_send(void *data)
 
    EINA_SAFETY_ON_NULL_GOTO(exsurf, end);
    EINA_SAFETY_ON_NULL_GOTO(exsurf->ec, end);
-   EINA_SAFETY_ON_NULL_GOTO(exsurf->ec->comp_data, end);
+   EINA_SAFETY_ON_NULL_GOTO(e_client_cdata_get(exsurf->ec), end);
    EINA_SAFETY_ON_NULL_GOTO(exsurf->resource, end);
 
    if (e_object_is_del(E_OBJECT(exsurf->ec)))
@@ -1588,6 +1610,7 @@ _e_xdg_surface_cb_commit(void *data, int type, void *event)
 {
    E_Xdg_Surface *exsurf;
    E_Event_Client *ev;
+   E_Comp_Wl_Client_Data *exsurf_cdata;
 
    exsurf = (E_Xdg_Surface *)data;
    ev = (E_Event_Client *)event;
@@ -1607,7 +1630,8 @@ _e_xdg_surface_cb_commit(void *data, int type, void *event)
    if (exsurf->has_window_geometry)
      {
         exsurf->has_window_geometry = EINA_FALSE;
-        EINA_RECTANGLE_SET(&exsurf->ec->comp_data->shell.window,
+        exsurf_cdata = e_client_cdata_get(exsurf->ec);
+        EINA_RECTANGLE_SET(&exsurf_cdata->shell.window,
                            exsurf->window_geometry.x,
                            exsurf->window_geometry.y,
                            exsurf->window_geometry.w,