diff --git a/legacy/ecore/src/lib/ecore_x/Ecore_X.h b/legacy/ecore/src/lib/ecore_x/Ecore_X.h index 41208525f0..a1e7fad32f 100644 --- a/legacy/ecore/src/lib/ecore_x/Ecore_X.h +++ b/legacy/ecore/src/lib/ecore_x/Ecore_X.h @@ -1100,6 +1100,9 @@ EAPI int ecore_x_icccm_protocol_isset(Ecore_X_Window win, EAPI void ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c); +EAPI void ecore_x_icccm_name_class_get(Ecore_X_Window win, + char **n, + char **c); EAPI char *ecore_x_icccm_client_machine_get(Ecore_X_Window win); EAPI void ecore_x_icccm_command_set(Ecore_X_Window win, int argc, char **argv); EAPI void ecore_x_icccm_command_get(Ecore_X_Window win, int *argc, char ***argv); diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c b/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c index d14ce11b58..9328c78ede 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_icccm.c @@ -662,6 +662,36 @@ ecore_x_icccm_name_class_set(Ecore_X_Window win, const char *n, const char *c) XFree(xch); } +/** + * Get a window name & class. + * @param win The window + * @param n The name string + * @param c The class string + * + * Get a window name * class + */ +void +ecore_x_icccm_name_class_get(Ecore_X_Window win, char **n, char **c) +{ + XClassHint xch; + + if (n) *n = NULL; + if (c) *c = NULL; + if (XGetClassHint(_ecore_x_disp, win, &xch)) + { + if (n) + { + if (xch.res_name) *n = strdup(xch.res_name); + } + if (c) + { + if (xch.res_class) *c = strdup(xch.res_class); + } + XFree(xch.res_name); + XFree(xch.res_class); + } +} + /** * Get a window client machine string. * @param win The window diff --git a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c index 83d7a7d87c..84ac691de4 100644 --- a/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c +++ b/legacy/ecore/src/lib/ecore_x/ecore_x_window_prop.c @@ -454,6 +454,7 @@ ecore_x_window_prop_name_class_set(Ecore_X_Window win, const char *n, const char * * Get a windows name and class property. strings must be free'd when done * with. + * DEPRECATED. Please use ecore_x_icccm_name_class_get() instead. */ void ecore_x_window_prop_name_class_get(Ecore_X_Window win, char **n, char **c)