From 82b0c0ce13ee4e696c9bd6ccc35383f7ea326d67 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Mon, 18 Mar 2024 10:49:05 +0900 Subject: [PATCH] e_client: add e_client_icccm_name/title_set API Change-Id: I83be6b28d7c561598bbe48e1e8716fef6f84b54c Signed-off-by: Jihoon Kim --- src/bin/e_client.c | 54 +++++++++++++++++++++++++++++++++++++++++++++-- src/bin/e_comp_wl_data.c | 2 +- src/bin/e_comp_wl_input.c | 2 +- src/bin/e_comp_wl_shell.c | 8 ++----- src/bin/e_info_server.c | 6 +++--- src/bin/e_policy_wl.c | 6 +++--- src/include/e_client.h | 9 ++++++++ 7 files changed, 71 insertions(+), 16 deletions(-) diff --git a/src/bin/e_client.c b/src/bin/e_client.c index 2a427ff..eab87a6 100644 --- a/src/bin/e_client.c +++ b/src/bin/e_client.c @@ -1013,9 +1013,9 @@ _e_client_free(E_Client *ec) #else eina_stringshare_replace(&ec->icccm.class, NULL); #endif - eina_stringshare_replace(&ec->icccm.title, NULL); + e_client_icccm_title_set(ec, NULL); eina_stringshare_replace(&ec->icccm.window_role, NULL); - eina_stringshare_replace(&ec->netwm.name, NULL); + e_client_netwm_name_set(ec, NULL); E_FREE_FUNC(ec->frame, evas_object_del); @@ -7357,6 +7357,56 @@ e_client_shell_ping(E_Client *ec) ec->comp_data->shell.ping(ec->comp_data->shell.surface); } +EINTERN void +e_client_icccm_name_set(E_Client *ec, const char *name) +{ + EINA_SAFETY_ON_NULL_RETURN(ec); + + if (eina_stringshare_replace(&ec->icccm.name, name)) + ec->changes.title = EINA_TRUE; +} + +E_API Eina_Stringshare * +e_client_icccm_name_get(E_Client *ec) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); + + return ec->icccm.name; +} + +EINTERN void +e_client_netwm_name_set(E_Client *ec, const char *name) +{ + EINA_SAFETY_ON_NULL_RETURN(ec); + + eina_stringshare_replace(&ec->netwm.name, name); +} + +E_API Eina_Stringshare * +e_client_netwm_name_get(E_Client *ec) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); + + return ec->netwm.name; +} + +EINTERN void +e_client_icccm_title_set(E_Client *ec, const char *title) +{ + EINA_SAFETY_ON_NULL_RETURN(ec); + + if (eina_stringshare_replace(&ec->icccm.title, title)) + ec->changes.title = EINA_TRUE; +} + +E_API Eina_Stringshare * +e_client_icccm_title_get(E_Client *ec) +{ + EINA_SAFETY_ON_NULL_RETURN_VAL(ec, NULL); + + return ec->icccm.title; +} + static void _e_client_shell_map(E_Client *ec) { diff --git a/src/bin/e_comp_wl_data.c b/src/bin/e_comp_wl_data.c index 4f95263..54a7793 100644 --- a/src/bin/e_comp_wl_data.c +++ b/src/bin/e_comp_wl_data.c @@ -947,7 +947,7 @@ _e_comp_wl_data_device_cb_drag_start(struct wl_client *client, struct wl_resourc drag_icon_ec->new_client = 1; drag_icon_ec->lock_focus_out = drag_icon_ec->override = 1; - drag_icon_ec->icccm.title = eina_stringshare_add("noshadow"); + e_client_icccm_title_set(drag_icon_ec, "noshadow"); e_client_layer_set(drag_icon_ec, E_LAYER_CLIENT_DRAG); drag_icon_ec->netwm.type = E_WINDOW_TYPE_DND; EC_CHANGED(drag_icon_ec); diff --git a/src/bin/e_comp_wl_input.c b/src/bin/e_comp_wl_input.c index 9d91a0f..2c7389e 100644 --- a/src/bin/e_comp_wl_input.c +++ b/src/bin/e_comp_wl_input.c @@ -190,7 +190,7 @@ _e_comp_wl_input_pointer_cb_cursor_set(struct wl_client *client, struct wl_resou ELOGF("COMP", "Cursor Set. show_cursor: false", ec); ec->override = 1; } - ec->icccm.title = eina_stringshare_add("Cursor"); + e_client_icccm_title_set(ec, "Cursor"); e_client_window_role_set(ec, "wl_pointer-cursor"); evas_object_pass_events_set(ec->frame, 1); /* wl_pointer-cursor surface is always alpha window */ diff --git a/src/bin/e_comp_wl_shell.c b/src/bin/e_comp_wl_shell.c index ed76cda..6772535 100644 --- a/src/bin/e_comp_wl_shell.c +++ b/src/bin/e_comp_wl_shell.c @@ -208,15 +208,11 @@ e_shell_e_client_name_title_set(E_Client *ec, const char *name, const char *titl EINA_SAFETY_ON_NULL_RETURN_VAL(ec, EINA_FALSE); if (name) - { - if (eina_stringshare_replace(&ec->icccm.name, name)) - ec->changes.title = EINA_TRUE; - } + e_client_icccm_name_set(ec, name); if (title) { - if (eina_stringshare_replace(&ec->icccm.title, title)) - ec->changes.title = EINA_TRUE; + e_client_icccm_title_set(ec, title); if (ec->frame) e_comp_object_frame_title_set(ec->frame, title); diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index ec59ab7..5bae956 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -2087,11 +2087,11 @@ _set_win_prop_Window_Name(Evas_Object *evas_obj, const char *prop_value) /* TODO: I ain't sure it's a proper order */ if (ec->netwm.name) - eina_stringshare_replace(&ec->netwm.name, prop_value); + e_client_netwm_name_set(ec, prop_value); else if (ec->icccm.title) - eina_stringshare_replace(&ec->icccm.title, prop_value); + e_client_icccm_title_set(ec, prop_value); else - eina_stringshare_replace(&ec->netwm.name, prop_value); + e_client_netwm_name_set(ec, prop_value); return NULL; } diff --git a/src/bin/e_policy_wl.c b/src/bin/e_policy_wl.c index 42dc330..293f5fa 100644 --- a/src/bin/e_policy_wl.c +++ b/src/bin/e_policy_wl.c @@ -7071,7 +7071,7 @@ _tzlaunch_splash_iface_cb_owner(struct wl_client *client EINA_UNUSED, struct wl_ ELOGF("COMP", "Set argb:%d", new_ec, new_ec->argb); new_ec->effect_type = old_ec->effect_type; new_ec->use_splash = EINA_TRUE; - new_ec->icccm.title = eina_stringshare_add("launchscreen"); + e_client_icccm_title_set(new_ec, "launchscreen"); e_comp->launchscrns = eina_list_append(e_comp->launchscrns, new_ec); @@ -7215,8 +7215,8 @@ _tzlaunch_splash_add(struct wl_resource *res_tzlaunch_effect, struct wl_resource tzlaunch_splash->ec = e_client_new(tzlaunch_splash->ep, 0, 1); EINA_SAFETY_ON_NULL_GOTO(tzlaunch_splash->ec, error); - tzlaunch_splash->ec->icccm.title = eina_stringshare_add("Launchscreen"); - tzlaunch_splash->ec->icccm.name = eina_stringshare_add("Launchscreen"); + e_client_icccm_title_set(tzlaunch_splash->ec, "Launchscreen"); + e_client_icccm_name_set(tzlaunch_splash->ec, "Launchscreen"); tzlaunch_splash->ec->ignored = EINA_TRUE; e_comp->launchscrns = eina_list_append(e_comp->launchscrns, tzlaunch_splash->ec); diff --git a/src/include/e_client.h b/src/include/e_client.h index 5d2967a..b328153 100644 --- a/src/include/e_client.h +++ b/src/include/e_client.h @@ -1170,6 +1170,15 @@ typedef Eina_Bool (*E_Client_Surface_Tree_Foreach)(void *data, E_Client *ec); */ E_API void e_client_surface_tree_foreach(E_Client *ec, E_Client_Surface_Tree_Foreach func, void *data); +EINTERN void e_client_icccm_name_set(E_Client *ec, const char *name); +E_API Eina_Stringshare * e_client_icccm_name_get(E_Client *ec); + +EINTERN void e_client_icccm_title_set(E_Client *ec, const char *title); +E_API Eina_Stringshare * e_client_icccm_title_get(E_Client *ec); + +EINTERN void e_client_netwm_name_set(E_Client *ec, const char *name); +E_API Eina_Stringshare * e_client_netwm_name_get(E_Client *ec); + /** * Move window to coordinates that do not account client decorations yet. * -- 2.7.4