e_tizen_wl_shell: make e_tizen_wl_shell_indicator.c file 98/325598/1
authorSooChan Lim <sc1.lim@samsung.com>
Thu, 29 May 2025 11:16:12 +0000 (20:16 +0900)
committerTizen Window System <tizen.windowsystem@gmail.com>
Thu, 12 Jun 2025 10:40:32 +0000 (19:40 +0900)
Move the indicator impelementation to this e_tizen_ws_shell_indicator.c file.

Change-Id: I8e074437a1e96d26e4ad0b8466964ab89ad05d81

src/bin/Makefile.mk
src/bin/meson.build
src/bin/server/e_tizen_indicator.c
src/bin/server/e_tizen_ws_shell_manager.c
src/bin/server/e_tizen_ws_shell_manager_intern.h
src/bin/server/e_tizen_ws_shell_srv_indicator.c [new file with mode: 0644]
src/bin/server/e_tizen_ws_shell_srv_indicator_intern.h [new file with mode: 0644]
src/bin/windowmgr/e_policy.c
src/bin/windowmgr/services/e_service_indicator.c

index e562ac6629e690009b8f10bcb8609c3288c15366..85d047ac5a2dd276f02f9c43cf3bb176924a3e5f 100644 (file)
@@ -207,6 +207,7 @@ src/bin/server/e_tizen_launch_appinfo.c \
 src/bin/server/e_tizen_display_policy.c \
 src/bin/server/e_tizen_ws_shell_manager.c \
 src/bin/server/e_tizen_ws_shell_srv_cbhm.c \
+src/bin/server/e_tizen_ws_shell_srv_indicator.c \
 src/bin/server/e_tizen_indicator.c \
 src/bin/server/e_tizen_clipboard.c \
 src/bin/server/e_surface_view.c \
index c7b261260e50c4bfe5f1317491e0e344d1eff165..2592acb194a260cc8b485eb3fbf5aadd0fb98edb 100644 (file)
@@ -211,6 +211,7 @@ e_sources = [
   'server/e_tizen_display_policy.c',
   'server/e_tizen_ws_shell_manager.c',
   'server/e_tizen_ws_shell_srv_cbhm.c',
+  'server/e_tizen_ws_shell_srv_indicator.c',
   'server/e_tizen_indicator.c',
   'server/e_tizen_clipboard.c',
   'server/e_surface_view.c',
index 6c8a28e4f9ea3e0efa54133e3fa7633c7147d4ff..61be2e824464750bd55f7467da46150c2326577f 100644 (file)
@@ -1,7 +1,7 @@
 #include "e_tizen_indicator_intern.h"
 #include "e_client_intern.h"
 #include "e_policy_intern.h"
-#include "e_tizen_ws_shell_manager_intern.h"
+#include "e_tizen_ws_shell_srv_indicator_intern.h"
 #include "e_comp_wl_intern.h"
 
 #include <tizen-extension-server-protocol.h>
@@ -179,7 +179,7 @@ _indicator_client_cb_opacity_mode_set(struct wl_client *client EINA_UNUSED, stru
    if (ec->indicator.opacity_mode == op_mode) return;
 
    ec->indicator.opacity_mode = op_mode;
-   e_tizen_ws_shell_indicator_srv_property_change_send(ec, ec->e.state.rot.ang.curr);
+   e_tizen_ws_shell_srv_indicator_property_change_send(ec, ec->e.state.rot.ang.curr);
 }
 
 static void
index 8fb9949fae588cfe193cadd75529bdbed4cba2be..966056bb80a04d6f6b24d434543ce12d7afc3c04 100644 (file)
@@ -1,7 +1,6 @@
 #include "e_tizen_ws_shell_manager_intern.h"
 #include "services/e_service_quickpanel_intern.h"
 #include "services/e_service_volume_intern.h"
-#include "services/e_service_indicator_intern.h"
 #include "services/e_service_scrsaver_intern.h"
 #include "services/e_service_launcher_intern.h"
 #include "services/e_service_taskbar_intern.h"
@@ -16,9 +15,9 @@
 #include "e_privilege_intern.h"
 #include "e_magnifier_intern.h"
 #include "e_screensaver_intern.h"
-#include "e_comp_wl_subsurface_intern.h"
 #include "e_config_intern.h"
 #include "e_tizen_ws_shell_srv_cbhm_intern.h"
+#include "e_tizen_ws_shell_srv_indicator_intern.h"
 
 #include <tzsh_server.h>
 
@@ -104,7 +103,6 @@ typedef struct _E_Tzsh_QP_Event
 static E_Tizen_Ws_Shell_Manager *g_tizen_ws_shell_mgr = NULL;
 
 static struct wl_resource *_scrsaver_mng_res = NULL; // TODO
-static struct wl_resource *_indicator_srv_res = NULL;
 
 static Eina_List *handlers = NULL;
 
@@ -588,30 +586,10 @@ _tzsh_srv_iface_cb_region_set(struct wl_client *client, struct wl_resource *res_
      }
 }
 
-static void
-_tzsh_srv_indicator_cb_resource_destroy(struct wl_resource *resource)
-{
-   if (_indicator_srv_res == resource)
-     _indicator_srv_res = NULL;
-}
-
-static void
-_tzsh_srv_indicator_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
-{
-   _indicator_srv_res = NULL;
-   wl_resource_destroy(resource);
-}
-
-static const struct tws_service_indicator_interface _tzsh_srv_indicator_iface =
-{
-   _tzsh_srv_indicator_cb_destroy,
-};
-
 static void
 _tzsh_srv_iface_cb_indicator_get(struct wl_client *client, struct wl_resource *res_tzsh_srv, uint32_t id)
 {
    E_Tizen_Ws_Shell_Srv *tzsh_srv;
-   struct wl_resource *res;
 
    tzsh_srv = wl_resource_get_user_data(res_tzsh_srv);
    EINA_SAFETY_ON_NULL_RETURN(tzsh_srv);
@@ -619,16 +597,24 @@ _tzsh_srv_iface_cb_indicator_get(struct wl_client *client, struct wl_resource *r
    if (!eina_list_data_find(g_tizen_ws_shell_mgr->tzsh_srvs, tzsh_srv))
      return;
 
-   res = wl_resource_create(client, &tws_service_indicator_interface, 1, id);
-   if (!res)
+   if (tzsh_srv->role != TZSH_SRV_ROLE_INDICATOR)
      {
-        wl_client_post_no_memory(client);
+        ERR("Could not find indicator service");
+        tizen_ws_shell_send_error(res_tzsh_srv,
+                                   TIZEN_WS_SHELL_ERROR_NO_SERVICE);
         return;
      }
-   _indicator_srv_res = res;
 
-   wl_resource_set_implementation(res, &_tzsh_srv_indicator_iface, tzsh_srv,
-                                  _tzsh_srv_indicator_cb_resource_destroy);
+   tzsh_srv->client = client;
+   tzsh_srv->id = id;
+
+   if (!e_tizen_ws_shell_srv_indicator_init(tzsh_srv))
+     {
+        ERR("e_tizen_ws_shell_srv_indicator_init() failed.");
+        tizen_ws_shell_send_error(res_tzsh_srv,
+                                  TIZEN_WS_SHELL_ERROR_NOT_SUPPORTED);
+        return;
+     }
 }
 
 static void
@@ -1845,108 +1831,6 @@ err:
    E_FREE(tzsh_reg);
 }
 
-// --------------------------------------------------------
-// tizen_ws_shell_interface::indicator
-// --------------------------------------------------------
-static E_Client *
-_e_tizen_ws_shell_indicator_find_topvisible_client(E_Zone *zone)
-{
-   E_Client *ec;
-   Evas_Object *o;
-   int ex, ey, ew, eh;
-
-   o = evas_object_top_get(e_comp_evas_get());
-   for (; o; o = evas_object_below_get(o))
-     {
-        ec = evas_object_data_get(o, "E_Client");
-
-        /* check e_client and skip e_clients not intersects with zone */
-        if (!ec) continue;
-        if (e_object_is_del(E_OBJECT(ec))) continue;
-        if (e_client_util_ignored_get(ec)) continue;
-        if (!e_zone_has_ec(zone, ec)) continue;
-        if (!e_client_view_get(ec)) continue;
-
-        if (!ec->visible) continue;
-        if (ec->visibility.skip) continue;
-        if ((e_client_visibility_get(ec) != E_VISIBILITY_UNOBSCURED) &&
-            (e_client_visibility_get(ec) != E_VISIBILITY_PARTIALLY_OBSCURED) &&
-            (!eina_list_data_find(e_comp_launchscrn_list_get(), ec)))
-          continue;
-
-        if (e_comp_wl_subsurface_check(ec)) continue;
-
-        e_client_geometry_get(ec, &ex, &ey, &ew, &eh);
-        if (!E_CONTAINS(ex, ey, ew, eh, zone->x, zone->y, zone->w, zone->h))
-          continue;
-
-        return ec;
-
-     }
-
-   return NULL;
-}
-
-EINTERN void
-e_tizen_ws_shell_indicator_srv_property_change_send(E_Client *ec, int angle)
-{
-   int opacity;
-
-   if (!ec) return;
-   if (!_indicator_srv_res)
-     {
-        ELOGF("TZ_IND", "NO indicator service", NULL);
-        return;
-     }
-
-   opacity = ec->indicator.opacity_mode;
-
-   ELOGF("TZ_IND", "SEND indicator info. angle:%d, opacity:%d", ec, angle, opacity);
-   tws_service_indicator_send_property_change(_indicator_srv_res, angle, opacity);
-}
-
-EINTERN void
-e_tizen_ws_shell_indicator_srv_property_update(E_Client *ec)
-{
-   E_Client *ec_ind_owner;
-   if (!_indicator_srv_res) return;
-
-   ec_ind_owner = e_mod_indicator_owner_get();
-   if (ec != ec_ind_owner) return;
-
-   if (ec->e.state.rot.ang.next != -1)
-     e_tizen_ws_shell_indicator_srv_property_change_send(ec, ec->e.state.rot.ang.next);
-   else
-     e_tizen_ws_shell_indicator_srv_property_change_send(ec, ec->e.state.rot.ang.curr);
-}
-
-EINTERN void
-e_tizen_ws_shell_indicator_srv_ower_win_update(E_Zone *zone)
-{
-   E_Client *ec = NULL;
-   E_Client *ec_cur_owner = NULL;
-
-   if (!zone) return;
-   if (!_indicator_srv_res) return;
-
-   ec_cur_owner = e_mod_indicator_owner_get();
-   ec = _e_tizen_ws_shell_indicator_find_topvisible_client(zone);
-
-   if (ec != ec_cur_owner)
-     {
-        ELOGF("TZ_IND", "Changed OWNER. win:%zx, state:%d, opacity:%d, vtype:%d", NULL, e_client_util_win_get(ec),
-              ec ? ec->indicator.state:-1, ec ? ec->indicator.opacity_mode:-1, ec ? ec->indicator.visible_type:-1);
-        e_mod_indicator_owner_set(ec);
-
-        if (ec && !ec->e.state.rot.pending_show)
-          {
-             ELOGF("TZ_IND", "Property Update. name:%s curr:%d, next:%d", NULL, ec->icccm.name?:"NULL",
-                   ec->e.state.rot.ang.curr, ec->e.state.rot.ang.next);
-             e_tizen_ws_shell_indicator_srv_property_update(ec);
-          }
-     }
-}
-
 // --------------------------------------------------------
 // tizen_ws_shell_interface::quickpanel
 // --------------------------------------------------------
index f818a96dca07a4f980688dd7486f5e96175a2ea7..f5aa5e875a6fca02eb1e44eea1f6fc86e4423a80 100644 (file)
@@ -55,10 +55,6 @@ EINTERN void      e_tizen_ws_shell_extension_del(const char* name);
 
 EINTERN void e_tizen_ws_shell_qp_state_scrollable_update(E_Client *ec, Eina_Bool scrollable, E_Quickpanel_Type type);
 
-EINTERN void e_tizen_ws_shell_indicator_srv_property_change_send(E_Client *ec, int angle);
-EINTERN void e_tizen_ws_shell_indicator_srv_property_update(E_Client *ec);
-EINTERN void e_tizen_ws_shell_indicator_srv_ower_win_update(E_Zone *zone);
-
 EINTERN Eina_Bool e_tizen_ws_shell_shared_widget_launch_prepare_send(E_Client *callee_ec, uint32_t state, uint32_t serial);
 
 #endif
diff --git a/src/bin/server/e_tizen_ws_shell_srv_indicator.c b/src/bin/server/e_tizen_ws_shell_srv_indicator.c
new file mode 100644 (file)
index 0000000..60942be
--- /dev/null
@@ -0,0 +1,152 @@
+#include "e_tizen_ws_shell_srv_indicator_intern.h"
+#include "services/e_service_indicator_intern.h"
+#include "e_comp_wl_subsurface_intern.h"
+
+#include <tzsh_server.h>
+
+static struct wl_resource *_indicator_srv_res = NULL;
+
+static void
+_tzsh_srv_indicator_cb_resource_destroy(struct wl_resource *resource)
+{
+   if (_indicator_srv_res == resource)
+     _indicator_srv_res = NULL;
+}
+
+static void
+_tzsh_srv_indicator_cb_destroy(struct wl_client *client EINA_UNUSED, struct wl_resource *resource)
+{
+   _indicator_srv_res = NULL;
+   wl_resource_destroy(resource);
+}
+
+static const struct tws_service_indicator_interface _tzsh_srv_indicator_iface =
+{
+   _tzsh_srv_indicator_cb_destroy,
+};
+
+EINTERN Eina_Bool
+e_tizen_ws_shell_srv_indicator_init(E_Tizen_Ws_Shell_Srv *tzsh_srv)
+{
+   struct wl_client *client;
+   struct wl_resource *res;
+   uint32_t id;
+
+   EINA_SAFETY_ON_NULL_RETURN_VAL(tzsh_srv, EINA_FALSE);
+
+   client = tzsh_srv->client;
+   id = tzsh_srv->id;
+
+   res = wl_resource_create(client, &tws_service_indicator_interface, 1, id);
+   if (!res)
+     {
+        wl_client_post_no_memory(client);
+        return EINA_FALSE;
+     }
+
+   _indicator_srv_res = res;
+
+   wl_resource_set_implementation(res, &_tzsh_srv_indicator_iface, tzsh_srv,
+                                  _tzsh_srv_indicator_cb_resource_destroy);
+
+   return EINA_TRUE;
+}
+
+EINTERN void
+e_tizen_ws_shell_srv_indicator_property_change_send(E_Client *ec, int angle)
+{
+   int opacity;
+
+   if (!ec) return;
+   if (!_indicator_srv_res)
+     {
+        ELOGF("TZ_IND", "NO indicator service", NULL);
+        return;
+     }
+
+   opacity = ec->indicator.opacity_mode;
+
+   ELOGF("TZ_IND", "SEND indicator info. angle:%d, opacity:%d", ec, angle, opacity);
+   tws_service_indicator_send_property_change(_indicator_srv_res, angle, opacity);
+}
+
+EINTERN void
+e_tizen_ws_shell_srv_indicator_property_update(E_Client *ec)
+{
+   E_Client *ec_ind_owner;
+   if (!_indicator_srv_res) return;
+
+   ec_ind_owner = e_mod_indicator_owner_get();
+   if (ec != ec_ind_owner) return;
+
+   if (ec->e.state.rot.ang.next != -1)
+     e_tizen_ws_shell_srv_indicator_property_change_send(ec, ec->e.state.rot.ang.next);
+   else
+     e_tizen_ws_shell_srv_indicator_property_change_send(ec, ec->e.state.rot.ang.curr);
+}
+
+static E_Client *
+_e_tizen_ws_shell_srv_indicator_find_topvisible_client(E_Zone *zone)
+{
+   E_Client *ec;
+   Evas_Object *o;
+   int ex, ey, ew, eh;
+
+   o = evas_object_top_get(e_comp_evas_get());
+   for (; o; o = evas_object_below_get(o))
+     {
+        ec = evas_object_data_get(o, "E_Client");
+
+        /* check e_client and skip e_clients not intersects with zone */
+        if (!ec) continue;
+        if (e_object_is_del(E_OBJECT(ec))) continue;
+        if (e_client_util_ignored_get(ec)) continue;
+        if (!e_zone_has_ec(zone, ec)) continue;
+        if (!e_client_view_get(ec)) continue;
+
+        if (!ec->visible) continue;
+        if (ec->visibility.skip) continue;
+        if ((e_client_visibility_get(ec) != E_VISIBILITY_UNOBSCURED) &&
+            (e_client_visibility_get(ec) != E_VISIBILITY_PARTIALLY_OBSCURED) &&
+            (!eina_list_data_find(e_comp_launchscrn_list_get(), ec)))
+          continue;
+
+        if (e_comp_wl_subsurface_check(ec)) continue;
+
+        e_client_geometry_get(ec, &ex, &ey, &ew, &eh);
+        if (!E_CONTAINS(ex, ey, ew, eh, zone->x, zone->y, zone->w, zone->h))
+          continue;
+
+        return ec;
+
+     }
+
+   return NULL;
+}
+
+EINTERN void
+e_tizen_ws_shell_srv_indicator_ower_win_update(E_Zone *zone)
+{
+   E_Client *ec = NULL;
+   E_Client *ec_cur_owner = NULL;
+
+   if (!zone) return;
+   if (!_indicator_srv_res) return;
+
+   ec_cur_owner = e_mod_indicator_owner_get();
+   ec = _e_tizen_ws_shell_srv_indicator_find_topvisible_client(zone);
+
+   if (ec != ec_cur_owner)
+     {
+        ELOGF("TZ_IND", "Changed OWNER. win:%zx, state:%d, opacity:%d, vtype:%d", NULL, e_client_util_win_get(ec),
+              ec ? ec->indicator.state:-1, ec ? ec->indicator.opacity_mode:-1, ec ? ec->indicator.visible_type:-1);
+        e_mod_indicator_owner_set(ec);
+
+        if (ec && !ec->e.state.rot.pending_show)
+          {
+             ELOGF("TZ_IND", "Property Update. name:%s curr:%d, next:%d", NULL, ec->icccm.name?:"NULL",
+                   ec->e.state.rot.ang.curr, ec->e.state.rot.ang.next);
+             e_tizen_ws_shell_srv_indicator_property_update(ec);
+          }
+     }
+}
diff --git a/src/bin/server/e_tizen_ws_shell_srv_indicator_intern.h b/src/bin/server/e_tizen_ws_shell_srv_indicator_intern.h
new file mode 100644 (file)
index 0000000..aa943a8
--- /dev/null
@@ -0,0 +1,13 @@
+#ifndef E_TIZEN_WS_SHELL_INDICATOR_SRV_INTERN_H
+#define E_TIZEN_WS_SHELL_INDICATOR_SRV_INTERN_H
+
+#include "e_intern.h"
+#include "e_tizen_ws_shell_manager_intern.h"
+
+EINTERN Eina_Bool e_tizen_ws_shell_srv_indicator_init(E_Tizen_Ws_Shell_Srv *tzsh_srv);
+
+EINTERN void e_tizen_ws_shell_srv_indicator_property_change_send(E_Client *ec, int angle);
+EINTERN void e_tizen_ws_shell_srv_indicator_property_update(E_Client *ec);
+EINTERN void e_tizen_ws_shell_srv_indicator_ower_win_update(E_Zone *zone);
+
+#endif
index 03e6ffc68e3f43cfce9b01bf4f792347ef587ae1..8ba01c65c60b6207ccf0fb8f616e1ef4019ae447 100644 (file)
@@ -25,6 +25,7 @@
 #include "e_policy_desk_intern.h"
 #include "e_canvas_intern.h"
 #include "e_tizen_ws_shell_manager_intern.h"
+#include "e_tizen_ws_shell_srv_indicator_intern.h"
 #include "e_policy_wl_display_intern.h"
 
 E_Policy *e_policy = NULL;
@@ -998,7 +999,7 @@ _e_policy_cb_client_hide(void *data EINA_UNUSED, int type EINA_UNUSED, void *eve
    pc = eina_hash_find(hash_policy_clients, &ec);
    if (!pc) return ECORE_CALLBACK_PASS_ON;
 
-   e_tizen_ws_shell_indicator_srv_ower_win_update(pc->zone);
+   e_tizen_ws_shell_srv_indicator_ower_win_update(pc->zone);
 
    return ECORE_CALLBACK_PASS_ON;
 }
@@ -1040,7 +1041,7 @@ _e_policy_cb_idle_enterer(void *data EINA_UNUSED)
      {
         EINA_LIST_FREE(_e_pol_changed_zone, zone)
           {
-             e_tizen_ws_shell_indicator_srv_ower_win_update(zone);
+             e_tizen_ws_shell_srv_indicator_ower_win_update(zone);
           }
         _e_pol_changed_zone = NULL;
      }
@@ -2004,7 +2005,7 @@ _e_policy_client_cb_client_destroy(struct wl_listener *listener, void *data)
    ec = policy_client->ec;
 
    if (policy_client->zone)
-     e_tizen_ws_shell_indicator_srv_ower_win_update(policy_client->zone);
+     e_tizen_ws_shell_srv_indicator_ower_win_update(policy_client->zone);
 
    e_policy_wl_client_del(ec);
 
index 18b0098748cf4571ecd59282b9f3a29ec3df0a61..7e5dfe26f2b70b336edfbb009ff5064aa0c365cd 100644 (file)
@@ -1,7 +1,7 @@
 #include "services/e_service_indicator_intern.h"
 #include "e_client_intern.h"
 #include "e_policy_wl_intern.h"
-#include "e_tizen_ws_shell_manager_intern.h"
+#include "e_tizen_ws_shell_srv_indicator_intern.h"
 
 static E_Client *_ind_server = NULL;
 static E_Client *_ind_owner = NULL;
@@ -27,7 +27,7 @@ _indicator_cb_rot_begin(void *data EINA_UNUSED, int type EINA_UNUSED, void *even
           {
              ELOGF("TZ_IND", "Rotation begins.(ec:%s) Set indicator's angle to next angle:%d", ec, ec->icccm.name?:"NULL", ec->e.state.rot.ang.next);
              _ind_angle = ec->e.state.rot.ang.next;
-             e_tizen_ws_shell_indicator_srv_property_change_send(ec, ec->e.state.rot.ang.next);
+             e_tizen_ws_shell_srv_indicator_property_change_send(ec, ec->e.state.rot.ang.next);
           }
      }
 
@@ -50,7 +50,7 @@ _indicator_cb_rot_done(void *data EINA_UNUSED, int type EINA_UNUSED, void *event
           {
              ELOGF("TZ_IND", "Rotation is done.(ec:%s) Set indicator's angle to curr angle:%d", ec, ec->icccm.name?:"NULL", ec->e.state.rot.ang.curr);
              _ind_angle = ec->e.state.rot.ang.curr;
-             e_tizen_ws_shell_indicator_srv_property_change_send(ec, ec->e.state.rot.ang.curr);
+             e_tizen_ws_shell_srv_indicator_property_change_send(ec, ec->e.state.rot.ang.curr);
           }
      }