From a1d592e0735b6e5fe7848ae1a692f8c8bd14a4a8 Mon Sep 17 00:00:00 2001 From: sebastid Date: Fri, 3 Jun 2005 06:43:23 +0000 Subject: [PATCH] _NET_WM_ICON, isn't finished. SVN revision: 15079 --- netwm.txt | 2 +- src/bin/e_border.c | 48 ++++++++++++++++++++++++++++++++++++++++++++ src/bin/e_border.h | 11 +++++++++- src/bin/e_hints.c | 8 ++++++++ src/bin/e_icon.c | 28 ++++++++++++++++++++++++++ src/bin/e_icon.h | 3 +++ src/preload/e_hack.c | 22 ++++++++++---------- 7 files changed, 109 insertions(+), 13 deletions(-) diff --git a/netwm.txt b/netwm.txt index fd4c7d40d..f95dcd482 100644 --- a/netwm.txt +++ b/netwm.txt @@ -39,7 +39,7 @@ _NET_WM_ACTION_STICK [ ] _NET_WM_ALLOWED_ACTIONS [ ] _NET_WM_DESKTOP [?] /* Remove this property on unmap */ _NET_WM_HANDLED_ICONS [ ] -_NET_WM_ICON [ ] +_NET_WM_ICON [X] _NET_WM_ICON_GEOMETRY [ ] _NET_WM_ICON_NAME [X] _NET_WM_MOVERESIZE [ ] diff --git a/src/bin/e_border.c b/src/bin/e_border.c index aadeda706..d119c3caa 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -351,6 +351,10 @@ e_border_new(E_Container *con, Ecore_X_Window win, int first_map) bd->client.icccm.fetch.icon_name = 0; bd->client.netwm.fetch.icon_name = 1; } + else if (atoms[i] == ECORE_X_ATOM_NET_WM_ICON) + { + bd->client.netwm.fetch.icon = 1; + } } free(atoms); } @@ -1426,6 +1430,10 @@ e_border_act_kill_begin(E_Border *bd) e_object_del(E_OBJECT(bd)); } +void e_border_icon_add(E_Border *bd, Evas *e) +{ +} + void e_border_button_bindings_ungrab_all(void) { @@ -1930,6 +1938,13 @@ _e_border_cb_window_property(void *data, int ev_type, void *ev) bd->client.icccm.fetch.window_role = 1; bd->changed = 1; } + /* + else if (e->atom == ECORE_X_ATOM_NET_WM_ICON) + { + bd->client.netwm.fetch.icon = 1; + bd->changed = 1; + } + */ return 1; } @@ -2928,6 +2943,39 @@ _e_border_eval(E_Border *bd) bd->client.netwm.fetch.icon_name = 0; } + /* + if (bd->client.netwm.fetch.icon) + { + if (bd->client.netwm.icon.data) free(bd->client.netwm.icon.data); + if (!ecore_x_netwm_icon_get(bd->client.win, + &bd->client.netwm.icon.width, &bd->client.netwm.icon.height, + &bd->client.netwm.icon.data, &bd->client.netwm.icon.size)) + printf("ERROR: Fetch icon from client\n"); + else + { + if (bd->icon_object) + { + evas_object_del(bd->icon_object); + bd->icon_object = NULL; + } + bd->icon_object = e_icon_add(bd->bg_evas); + e_icon_data_set(bd->icon_object, bd->client.netwm.icon.data, + bd->client.netwm.icon.width, bd->client.netwm.icon.height); + e_icon_alpha_set(bd->icon_object, 1); + + if (bd->bg_object) + { + evas_object_show(bd->icon_object); + edje_object_part_swallow(bd->bg_object, "icon_swallow", bd->icon_object); + } + else + { + evas_object_hide(bd->icon_object); + } + } + bd->client.netwm.fetch.icon = 0; + } + */ if (bd->client.icccm.fetch.machine) { if (bd->client.icccm.machine) free(bd->client.icccm.machine); diff --git a/src/bin/e_border.h b/src/bin/e_border.h index 1e82c2e50..af1ffffa7 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -162,6 +162,12 @@ struct _E_Border unsigned int desktop; char *name; char *icon_name; + struct { + unsigned int *data; + int width; + int height; + int size; + } icon; /* NetWM Window state */ struct { @@ -181,6 +187,8 @@ struct _E_Border struct { unsigned char name : 1; + unsigned char icon_name : 1; + unsigned char icon : 1; /* No, fetch on new_client, shouldn't be changed after map. unsigned char pid : 1; */ @@ -190,7 +198,6 @@ struct _E_Border /* No, fetch on new_client, shouldn't be changed after map. unsigned char type : 1; */ - unsigned char icon_name : 1; /* No, don't fetch state, update on client message unsigned char state : 1; */ @@ -401,6 +408,8 @@ EAPI void e_border_act_menu_begin(E_Border *bd, Ecore_X_Event_Mouse_Button_Down EAPI void e_border_act_close_begin(E_Border *bd); EAPI void e_border_act_kill_begin(E_Border *bd); +EAPI void e_border_icon_add(E_Border *bd, Evas *e); + EAPI void e_border_button_bindings_ungrab_all(void); EAPI void e_border_button_bindings_grab_all(void); diff --git a/src/bin/e_hints.c b/src/bin/e_hints.c index 6913c95a9..ad371d2b8 100644 --- a/src/bin/e_hints.c +++ b/src/bin/e_hints.c @@ -51,7 +51,12 @@ e_hints_init(void) ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_SUPPORTING_WM_CHECK, 1); ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_VIRTUAL_ROOTS, 1); + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_ICON, 1); + + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_ICON_NAME, 1); + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_NAME, 1); + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_PID, 1); ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE, 1); ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE_STICKY, 1); @@ -63,6 +68,9 @@ e_hints_init(void) ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE_ABOVE, 1); ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_STATE_BELOW, 1); + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_VISIBLE_ICON_NAME, 1); + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_VISIBLE_NAME, 1); + ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_WINDOW_TYPE, 1); ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DESKTOP, 1); ecore_x_netwm_supported(roots[i], ECORE_X_ATOM_NET_WM_WINDOW_TYPE_DOCK, 1); diff --git a/src/bin/e_icon.c b/src/bin/e_icon.c index ef113a25a..d731c3fbb 100644 --- a/src/bin/e_icon.c +++ b/src/bin/e_icon.c @@ -81,6 +81,24 @@ e_icon_smooth_scale_get(Evas_Object *obj) return evas_object_image_smooth_scale_get(sd->obj); } +void +e_icon_alpha_set(Evas_Object *obj, int alpha) +{ + E_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + evas_object_image_alpha_set(sd->obj, alpha); +} + +int +e_icon_alpha_get(Evas_Object *obj) +{ + E_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + return evas_object_image_alpha_get(sd->obj); +} + void e_icon_size_get(Evas_Object *obj, int *w, int *h) { @@ -112,6 +130,16 @@ e_icon_fill_inside_set(Evas_Object *obj, int fill_inside) _e_icon_smart_reconfigure(sd); } +void +e_icon_data_set(Evas_Object *obj, void *data, int w, int h) +{ + E_Smart_Data *sd; + + sd = evas_object_smart_data_get(obj); + evas_object_image_size_set(sd->obj, w, h); + evas_object_image_data_copy_set(sd->obj, data); +} + /* local subsystem globals */ static void _e_icon_smart_reconfigure(E_Smart_Data *sd) diff --git a/src/bin/e_icon.h b/src/bin/e_icon.h index 11a45b759..c544bc743 100644 --- a/src/bin/e_icon.h +++ b/src/bin/e_icon.h @@ -11,9 +11,12 @@ EAPI void e_icon_file_set (Evas_Object *obj, const char *file); EAPI const char *e_icon_file_get (Evas_Object *obj); EAPI void e_icon_smooth_scale_set (Evas_Object *obj, int smooth); EAPI int e_icon_smooth_scale_get (Evas_Object *obj); +EAPI void e_icon_alpha_set (Evas_Object *obj, int smooth); +EAPI int e_icon_alpha_get (Evas_Object *obj); EAPI void e_icon_size_get (Evas_Object *obj, int *w, int *h); EAPI int e_icon_fill_inside_get (Evas_Object *obj); EAPI void e_icon_fill_inside_set (Evas_Object *obj, int fill_inside); +EAPI void e_icon_data_set (Evas_Object *obj, void *data, int w, int h); #endif #endif diff --git a/src/preload/e_hack.c b/src/preload/e_hack.c index a21ed19c8..357df1410 100644 --- a/src/preload/e_hack.c +++ b/src/preload/e_hack.c @@ -35,7 +35,7 @@ __e_hack_set_properties(Display *display, Window window) if (!a_manager) a_manager = XInternAtom(display, "_E_HACK_MANAGER", False); if ((env = getenv("E_LAUNCH_ID"))) - XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, env, strlen(env)); + XChangeProperty(display, window, a_launch_id, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env)); { uid_t uid; pid_t pid, ppid; @@ -47,29 +47,29 @@ __e_hack_set_properties(Display *display, Window window) ppid = getppid(); snprintf(buf, sizeof(buf), "%i", uid); - XChangeProperty(display, window, a_user_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + XChangeProperty(display, window, a_user_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf)); snprintf(buf, sizeof(buf), "%i", pid); - XChangeProperty(display, window, a_process_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + XChangeProperty(display, window, a_process_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf)); snprintf(buf, sizeof(buf), "%i", ppid); - XChangeProperty(display, window, a_p_process_id, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + XChangeProperty(display, window, a_p_process_id, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf)); if (!uname(&ubuf)) { snprintf(buf, sizeof(buf), "%s", ubuf.nodename); - XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, buf, strlen(buf)); + XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, (unsigned char *)buf, strlen(buf)); } else - XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, " ", 1); + XChangeProperty(display, window, a_machine_name, XA_STRING, 8, PropModeReplace, (unsigned char *)" ", 1); } if ((env = getenv("USER"))) - XChangeProperty(display, window, a_user_name, XA_STRING, 8, PropModeReplace, env, strlen(env)); + XChangeProperty(display, window, a_user_name, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env)); if ((env = getenv("E_DESK"))) - XChangeProperty(display, window, a_desk, XA_STRING, 8, PropModeReplace, env, strlen(env)); + XChangeProperty(display, window, a_desk, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env)); if ((env = getenv("E_ZONE"))) - XChangeProperty(display, window, a_zone, XA_STRING, 8, PropModeReplace, env, strlen(env)); + XChangeProperty(display, window, a_zone, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env)); if ((env = getenv("E_CONTAINER"))) - XChangeProperty(display, window, a_container, XA_STRING, 8, PropModeReplace, env, strlen(env)); + XChangeProperty(display, window, a_container, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env)); if ((env = getenv("E_MANAGER"))) - XChangeProperty(display, window, a_manager, XA_STRING, 8, PropModeReplace, env, strlen(env)); + XChangeProperty(display, window, a_manager, XA_STRING, 8, PropModeReplace, (unsigned char *)env, strlen(env)); } /* XCreateWindow intercept hack */