diff options
Diffstat (limited to '')
-rw-r--r-- | libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c index 0a523b9..b1e0622 100644 --- a/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c +++ b/libraries/ecore/src/lib/ecore_x/xcb/ecore_xcb_netwm.c | |||
@@ -838,6 +838,56 @@ ecore_x_netwm_icon_name_set(Ecore_X_Window win, | |||
838 | ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); | 838 | ecore_x_window_prop_string_set(win, ECORE_X_ATOM_NET_WM_ICON_NAME, name); |
839 | } | 839 | } |
840 | 840 | ||
841 | EAPI void | ||
842 | ecore_x_netwm_icons_set(Ecore_X_Window win, | ||
843 | Ecore_X_Icon *icon, | ||
844 | int num) | ||
845 | { | ||
846 | unsigned int *data, *p, *p2; | ||
847 | unsigned int i, size, x, y; | ||
848 | |||
849 | LOGFN(__FILE__, __LINE__, __FUNCTION__); | ||
850 | size = 0; | ||
851 | for (i = 0; i < (unsigned int)num; i++) | ||
852 | { | ||
853 | size += 2 + (icon[i].width * icon[i].height); | ||
854 | } | ||
855 | data = malloc(size * sizeof(unsigned int)); | ||
856 | if (!data) return; | ||
857 | p = data; | ||
858 | for (i = 0; i < (unsigned int)num; i++) | ||
859 | { | ||
860 | p[0] = icon[i].width; | ||
861 | p[1] = icon[i].height; | ||
862 | p += 2; | ||
863 | p2 = icon[i].data; | ||
864 | for (y = 0; y < icon[i].height; y++) | ||
865 | { | ||
866 | for (x = 0; x < icon[i].width; x++) | ||
867 | { | ||
868 | unsigned int r, g, b, a; | ||
869 | |||
870 | a = (*p2 >> 24) & 0xff; | ||
871 | r = (*p2 >> 16) & 0xff; | ||
872 | g = (*p2 >> 8 ) & 0xff; | ||
873 | b = (*p2 ) & 0xff; | ||
874 | if ((a > 0) && (a < 255)) | ||
875 | { | ||
876 | r = (r * 255) / a; | ||
877 | g = (g * 255) / a; | ||
878 | b = (b * 255) / a; | ||
879 | } | ||
880 | *p = (a << 24) | (r << 16) | (g << 8) | b; | ||
881 | p++; | ||
882 | p2++; | ||
883 | } | ||
884 | } | ||
885 | } | ||
886 | ecore_x_window_prop_card32_set(win, ECORE_X_ATOM_NET_WM_ICON, | ||
887 | data, size); | ||
888 | free(data); | ||
889 | } | ||
890 | |||
841 | EAPI Eina_Bool | 891 | EAPI Eina_Bool |
842 | ecore_x_netwm_icons_get(Ecore_X_Window win, | 892 | ecore_x_netwm_icons_get(Ecore_X_Window win, |
843 | Ecore_X_Icon **icon, | 893 | Ecore_X_Icon **icon, |