e_client: add __cplusplus define at usage of class keyword 12/249512/4
authorSooChan Lim <sc1.lim@samsung.com>
Mon, 14 Dec 2020 06:50:16 +0000 (15:50 +0900)
committerSooChan Lim <sc1.lim@samsung.com>
Tue, 15 Dec 2020 00:26:06 +0000 (09:26 +0900)
The class keyword make compile-error when enlightenment builds with c++ compiler.

Change-Id: I399c45847cf8d27197020668d9cf8cf6720f8844

src/bin/e_client.c
src/bin/e_client.h
src/bin/e_comp.c
src/bin/e_comp_object.c
src/bin/e_comp_wl_rsm.c
src/bin/e_comp_wl_shell.c
src/bin/e_policy.c

index cb08878..c6da549 100644 (file)
@@ -1189,7 +1189,11 @@ _e_client_free(E_Client *ec)
    eina_stringshare_replace(&ec->border.name, NULL);
    eina_stringshare_replace(&ec->bordername, NULL);
    eina_stringshare_replace(&ec->icccm.name, NULL);
+#if defined(__cplusplus) || defined(c_plusplus)
+   eina_stringshare_replace(&ec->icccm.cpp_class, NULL);
+#else
    eina_stringshare_replace(&ec->icccm.class, NULL);
+#endif
    eina_stringshare_replace(&ec->icccm.title, NULL);
    eina_stringshare_replace(&ec->icccm.icon_name, NULL);
    eina_stringshare_replace(&ec->icccm.machine, NULL);
@@ -3081,9 +3085,15 @@ _e_client_type_match(E_Client *ec, E_Config_Client_Type *m)
    if ((int)ec->netwm.type != m->window_type)
      return EINA_FALSE;
 
+#if defined(__cplusplus) || defined(c_plusplus)
+   if (((m->clas) && (!ec->icccm.cpp_class)) ||
+       ((ec->icccm.cpp_class) && (m->clas) && (!e_util_glob_match(ec->icccm.cpp_class, m->clas))))
+     return EINA_FALSE;
+#else
    if (((m->clas) && (!ec->icccm.class)) ||
        ((ec->icccm.class) && (m->clas) && (!e_util_glob_match(ec->icccm.class, m->clas))))
      return EINA_FALSE;
+#endif
 
    if (((m->name) && (!ec->icccm.name)) ||
        ((ec->icccm.name) && (m->name) && (!e_util_glob_match(ec->icccm.name, m->name))))
@@ -4343,7 +4353,11 @@ e_client_new(E_Pixmap *cp, int first_map, int internal)
 
    ec->icccm.title = NULL;
    ec->icccm.name = NULL;
+#if defined(__cplusplus) || defined(c_plusplus)
+   ec->icccm.cpp_class = NULL;
+#else
    ec->icccm.class = NULL;
+#endif
    ec->icccm.icon_name = NULL;
    ec->icccm.machine = NULL;
    ec->icccm.min_w = 1;
index e636838..43fcf39 100644 (file)
@@ -455,7 +455,11 @@ struct E_Client
    {
       Eina_Stringshare        *title;
       Eina_Stringshare        *name;
+#if defined(__cplusplus) || defined(c_plusplus)
+      Eina_Stringshare        *cpp_class; /* for C++ TODO: change the implementation for this */
+#else
       Eina_Stringshare        *class;
+#endif
       Eina_Stringshare        *icon_name;
       Eina_Stringshare        *machine;
       int                       min_w, min_h;
index e06c07d..c507041 100644 (file)
@@ -639,10 +639,16 @@ e_comp_util_wins_print(void)
         evas_object_geometry_get(o, &x, &y, &w, &h);
         fprintf(stderr, "LAYER %d  ", evas_object_layer_get(o));
         if (ec)
+#if defined(__cplusplus) || defined(c_plusplus)
+          fprintf(stderr, "EC%s%s:  %p - '%s:%s' || %d,%d @ %dx%d\n",
+                  ec->override ? "O" : "", ec->focused ? "*" : "", ec,
+                  e_client_util_name_get(ec) ?: ec->icccm.name, ec->icccm.cpp_class, x, y, w, h);
+#else
           fprintf(stderr, "EC%s%s:  %p - '%s:%s' || %d,%d @ %dx%d\n",
                   ec->override ? "O" : "", ec->focused ? "*" : "", ec,
                   e_client_util_name_get(ec) ?: ec->icccm.name, ec->icccm.class, x, y, w, h);
-        else
+#endif
+       else
           fprintf(stderr, "OBJ: %p - %s || %d,%d @ %dx%d\n", o, evas_object_name_get(o), x, y, w, h);
         o = evas_object_below_get(o);
      }
index 8ffebbd..a224ade 100644 (file)
@@ -891,10 +891,17 @@ _e_comp_object_shadow_client_match(const E_Client *ec, E_Comp_Match *m)
    if (((m->title) && (!ec->netwm.name)) ||
        ((ec->netwm.name) && (m->title) && (!e_util_glob_match(ec->netwm.name, m->title))))
      return EINA_FALSE;
+#if defined(__cplusplus) || defined(c_plusplus)
+   if (((m->clas) && (!ec->icccm.cpp_class)) ||
+       ((ec->icccm.cpp_class) && (m->clas) && (!e_util_glob_match(ec->icccm.cpp_class, m->clas))))
+     return EINA_FALSE;
+#else
    if (((m->clas) && (!ec->icccm.class)) ||
        ((ec->icccm.class) && (m->clas) && (!e_util_glob_match(ec->icccm.class, m->clas))))
      return EINA_FALSE;
-   if (((m->role) && (!ec->icccm.window_role)) ||
+#endif
+
+  if (((m->role) && (!ec->icccm.window_role)) ||
        ((ec->icccm.window_role) && (m->role) && (!e_util_glob_match(ec->icccm.window_role, m->role))))
      return EINA_FALSE;
    if (m->primary_type)
index 6f8e283..8d23269 100644 (file)
@@ -3370,6 +3370,16 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
 
         if (!ec) continue;
 
+#if defined(__cplusplus) || defined(c_plusplus)
+        snprintf(info_str, sizeof(info_str),
+                 "%10s [%d] %8p win(0x%08zx) res(%d) pid(%d) vis(%d) name(%s)",
+                 "PROVIDER", idx++, provider,
+                 e_client_util_win_get(ec),
+                 e_pixmap_res_id_get(ec->pixmap),
+                 ec->netwm.pid,
+                 provider->vis_ref,
+                 e_client_util_name_get(ec)?:ec->icccm.cpp_class?:"NO NAME");
+#else
         snprintf(info_str, sizeof(info_str),
                  "%10s [%d] %8p win(0x%08zx) res(%d) pid(%d) vis(%d) name(%s)",
                  "PROVIDER", idx++, provider,
@@ -3378,6 +3388,7 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
                  ec->netwm.pid,
                  provider->vis_ref,
                  e_client_util_name_get(ec)?:ec->icccm.class?:"NO NAME");
+#endif
         eldbus_message_iter_basic_append(line_array, 's', info_str);
 
         if (provider->common.surfaces)
@@ -3407,6 +3418,18 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
              if ((eina_list_last(provider->common.surfaces) == l))
                  is_last = EINA_TRUE;
 
+#if defined(__cplusplus) || defined(c_plusplus)
+             snprintf(info_str, sizeof(info_str),
+                      "%10s CONSUMER [%d] %8p ec(%8p) win(0x%08zx) pid(%d) vis(%d) redirected(%d) name(%s)",
+                      is_last? "└─" : "├─", s_idx++, remote_surface,
+                      consumer ? consumer : NULL,
+                      consumer ? e_client_util_win_get(consumer) : 0,
+                      pid,
+                      remote_surface->visible,
+                      remote_surface->redirect,
+                      consumer? e_client_util_name_get(consumer)?:consumer->icccm.cpp_class?:"NO NAME":"NO CONSUMER"
+                      );
+#else
              snprintf(info_str, sizeof(info_str),
                       "%10s CONSUMER [%d] %8p ec(%8p) win(0x%08zx) pid(%d) vis(%d) redirected(%d) name(%s)",
                       is_last? "└─" : "├─", s_idx++, remote_surface,
@@ -3417,6 +3440,7 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
                       remote_surface->redirect,
                       consumer? e_client_util_name_get(consumer)?:consumer->icccm.class?:"NO NAME":"NO CONSUMER"
                       );
+#endif
              eldbus_message_iter_basic_append(line_array, 's', info_str);
           }
         eldbus_message_iter_basic_append(line_array, 's', "");
@@ -3433,6 +3457,16 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
         Eina_List *l;
 
         if (!ec) continue;
+#if defined(__cplusplus) || defined(c_plusplus)
+        snprintf(info_str, sizeof(info_str),
+                 "%10s [%d] %8p win(0x%08zx) res(%d) pid(%d) offscreen(%d) name(%s)",
+                 "SOURCE", idx++, source,
+                 e_client_util_win_get(ec),
+                 e_pixmap_res_id_get(ec->pixmap),
+                 ec->netwm.pid,
+                 source->offscreen_ref,
+                 e_client_util_name_get(ec)?:ec->icccm.cpp_class?:"NO NAME");
+#else
         snprintf(info_str, sizeof(info_str),
                  "%10s [%d] %8p win(0x%08zx) res(%d) pid(%d) offscreen(%d) name(%s)",
                  "SOURCE", idx++, source,
@@ -3441,7 +3475,8 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
                  ec->netwm.pid,
                  source->offscreen_ref,
                  e_client_util_name_get(ec)?:ec->icccm.class?:"NO NAME");
-        eldbus_message_iter_basic_append(line_array, 's', info_str);
+#endif
+       eldbus_message_iter_basic_append(line_array, 's', info_str);
 
         if (source->common.surfaces)
           {
@@ -3470,6 +3505,18 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
              if ((eina_list_last(source->common.surfaces) == l))
                is_last = EINA_TRUE;
 
+#if defined(__cplusplus) || defined(c_plusplus)
+             snprintf(info_str, sizeof(info_str),
+                      "%10s CONSUMER [%d] %8p ec(%8p) win(0x%08zx) pid(%d) vis(%d) redirected(%d) name(%s)",
+                      is_last? "└─" : "├─", s_idx++, remote_surface,
+                      consumer ? consumer : NULL,
+                      consumer ? e_client_util_win_get(consumer) : 0,
+                      pid,
+                      remote_surface->visible,
+                      remote_surface->redirect,
+                      consumer? e_client_util_name_get(consumer)?:consumer->icccm.cpp_class?:"NO NAME":"NO CONSUMER"
+                     );
+#else
              snprintf(info_str, sizeof(info_str),
                       "%10s CONSUMER [%d] %8p ec(%8p) win(0x%08zx) pid(%d) vis(%d) redirected(%d) name(%s)",
                       is_last? "└─" : "├─", s_idx++, remote_surface,
@@ -3480,7 +3527,8 @@ e_comp_wl_remote_surface_debug_info_get(Eldbus_Message_Iter *iter)
                       remote_surface->redirect,
                       consumer? e_client_util_name_get(consumer)?:consumer->icccm.class?:"NO NAME":"NO CONSUMER"
                      );
-             eldbus_message_iter_basic_append(line_array, 's', info_str);
+#endif
+            eldbus_message_iter_basic_append(line_array, 's', info_str);
           }
         eldbus_message_iter_basic_append(line_array, 's', "");
      }
index 71afc7e..402258a 100644 (file)
@@ -132,7 +132,11 @@ e_shell_e_client_popup_set(E_Client *ec)
    ec->lock_border = EINA_TRUE;
    if (!ec->internal)
      ec->border.changed = ec->changes.border = !ec->borderless;
+#if defined(__cplusplus) || defined(c_plusplus)
+   ec->changes.icon = !!ec->icccm.cpp_class;
+#else
    ec->changes.icon = !!ec->icccm.class;
+#endif
    ec->netwm.type = E_WINDOW_TYPE_POPUP_MENU;
    ec->comp_data->set_win_type = EINA_TRUE;
    e_client_layer_set(ec, E_LAYER_CLIENT_POPUP);
@@ -251,9 +255,14 @@ e_shell_e_client_app_id_set(E_Client *ec, const char *app_id)
    EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE);
 
    /* set class */
+#if defined(__cplusplus) || defined(c_plusplus)
+   eina_stringshare_replace(&ec->icccm.cpp_class, app_id);
+   ec->changes.icon = !!ec->icccm.cpp_class;
+#else
    eina_stringshare_replace(&ec->icccm.class, app_id);
    ec->changes.icon = !!ec->icccm.class;
-   EC_CHANGED(ec);
+#endif
+  EC_CHANGED(ec);
 
    return EINA_TRUE;
 }
@@ -574,7 +583,11 @@ _e_shell_surface_cb_popup_set(struct wl_client *client EINA_UNUSED, struct wl_re
    ec->lock_border = EINA_TRUE;
    if (!ec->internal)
      ec->border.changed = ec->changes.border = !ec->borderless;
+#if defined(__cplusplus) || defined(c_plusplus)
+   ec->changes.icon = !!ec->icccm.cpp_class;
+#else
    ec->changes.icon = !!ec->icccm.class;
+#endif
    ec->netwm.type = E_WINDOW_TYPE_POPUP_MENU;
    if (ec->comp_data)
      ec->comp_data->set_win_type = EINA_TRUE;
@@ -649,8 +662,13 @@ _e_shell_surface_cb_class_set(struct wl_client *client EINA_UNUSED, struct wl_re
    wl_client_get_credentials(client, &ec->netwm.pid, NULL, NULL);
 
    /* set class */
+#if defined(__cplusplus) || defined(c_plusplus)
+   eina_stringshare_replace(&ec->icccm.cpp_class, clas);
+   ec->changes.icon = !!ec->icccm.cpp_class;
+#else
    eina_stringshare_replace(&ec->icccm.class, clas);
    ec->changes.icon = !!ec->icccm.class;
+#endif
    EC_CHANGED(ec);
 }
 
index 7969f12..750dde2 100644 (file)
@@ -102,10 +102,15 @@ _e_policy_client_launcher_set(E_Policy_Client *pc)
    if (pc->ec->netwm.type != e_config->launcher.type)
      return;
 
+#if defined(__cplusplus) || defined(c_plusplus)
+   if (e_util_strcmp(pc->ec->icccm.cpp_class,
+                     e_config->launcher.clas))
+     return;
+#else
    if (e_util_strcmp(pc->ec->icccm.class,
                      e_config->launcher.clas))
      return;
-
+#endif
 
    if (e_util_strcmp(pc->ec->icccm.title,
                      e_config->launcher.title))
@@ -1900,9 +1905,13 @@ e_policy_client_is_toast_popup(E_Client *ec)
    E_OBJECT_CHECK_RETURN(ec, EINA_FALSE);
    E_OBJECT_TYPE_CHECK_RETURN(ec, E_CLIENT_TYPE, EINA_FALSE);
 
+#if defined(__cplusplus) || defined(c_plusplus)
+   if (!e_util_strcmp("TOAST_POPUP", ec->icccm.cpp_class))
+     return EINA_TRUE;
+#else
    if (!e_util_strcmp("TOAST_POPUP", ec->icccm.class))
      return EINA_TRUE;
-
+#endif
    if (!e_util_strcmp("toast_popup", ec->icccm.window_role))
      return EINA_TRUE;
 
@@ -1952,10 +1961,16 @@ e_policy_client_is_keyboard_sub(E_Client *ec)
 
    if (ec->vkbd.vkbd) return EINA_FALSE;
 
+#if defined(__cplusplus) || defined(c_plusplus)
+   if ((ec->icccm.cpp_class) &&
+       (!strcmp(ec->icccm.cpp_class, "ISF")))
+     return EINA_TRUE;
+#else
    if ((ec->icccm.class) &&
        (!strcmp(ec->icccm.class, "ISF")))
      return EINA_TRUE;
-   if ((ec->icccm.title) &&
+#endif
+  if ((ec->icccm.title) &&
        ((!strcmp(ec->icccm.title, "ISF Popup")) || (!strcmp(ec->icccm.title, "ISF Magnifier"))))
      return EINA_TRUE;