From bd00c682ded6f4b142e0797ec4cab0e678815b83 Mon Sep 17 00:00:00 2001 From: Carsten Haitzler Date: Sun, 20 Mar 2005 11:49:32 +0000 Subject: [PATCH] handle iconify, de-iconify handle icon changes... SVN revision: 13799 --- src/bin/e_border.c | 21 +++++++++++ src/bin/e_border.h | 8 +++++ src/modules/pager/e_mod_main.c | 80 ++++++++++++++++++++++++++++++++++++++++-- src/modules/pager/e_mod_main.h | 1 + 4 files changed, 107 insertions(+), 3 deletions(-) diff --git a/src/bin/e_border.c b/src/bin/e_border.c index cf425c6..1a2195d 100644 --- a/src/bin/e_border.c +++ b/src/bin/e_border.c @@ -79,6 +79,7 @@ static void _e_border_event_border_zone_set_free(void *data, void *ev); static void _e_border_event_border_desk_set_free(void *data, void *ev); static void _e_border_event_border_raise_free(void *data, void *ev); static void _e_border_event_border_lower_free(void *data, void *ev); +static void _e_border_event_border_icon_change_free(void *data, void *ev); static void _e_border_event_border_resize_free(void *data, void *ev); static void _e_border_event_border_move_free(void *data, void *ev); static void _e_border_event_border_show_free(void *data, void *ev); @@ -120,6 +121,7 @@ int E_EVENT_BORDER_STICK = 0; int E_EVENT_BORDER_UNSTICK = 0; int E_EVENT_BORDER_RAISE = 0; int E_EVENT_BORDER_LOWER = 0; +int E_EVENT_BORDER_ICON_CHANGE = 0; #define GRAV_SET(bd, grav) \ printf("GRAV TO %i\n", grav); \ @@ -163,6 +165,7 @@ e_border_init(void) E_EVENT_BORDER_UNSTICK = ecore_event_type_new(); E_EVENT_BORDER_RAISE = ecore_event_type_new(); E_EVENT_BORDER_LOWER = ecore_event_type_new(); + E_EVENT_BORDER_ICON_CHANGE = ecore_event_type_new(); return 1; } @@ -2343,6 +2346,14 @@ _e_border_eval(E_Border *bd) } } } + { + E_Event_Border_Icon_Change *ev; + + ev = calloc(1, sizeof(E_Event_Border_Icon_Change)); + ev->border = bd; + e_object_ref(E_OBJECT(bd)); + ecore_event_add(E_EVENT_BORDER_ICON_CHANGE, ev, _e_border_event_border_icon_change_free, NULL); + } } bd->client.icccm.fetch.name_class = 0; } @@ -3477,6 +3488,16 @@ _e_border_event_border_lower_free(void *data, void *ev) free(e); } +static void +_e_border_event_border_icon_change_free(void *data, void *ev) +{ + E_Event_Border_Icon_Change *e; + + e = ev; + e_object_unref(E_OBJECT(e->border)); + free(e); +} + static void _e_border_zone_update(E_Border *bd) diff --git a/src/bin/e_border.h b/src/bin/e_border.h index e2c8bda..db73d37 100644 --- a/src/bin/e_border.h +++ b/src/bin/e_border.h @@ -35,6 +35,7 @@ typedef struct _E_Event_Border_Zone_Set E_Event_Border_Zone_Set; typedef struct _E_Event_Border_Desk_Set E_Event_Border_Desk_Set; typedef struct _E_Event_Border_Raise E_Event_Border_Raise; typedef struct _E_Event_Border_Lower E_Event_Border_Lower; +typedef struct _E_Event_Border_Icon_Change E_Event_Border_Icon_Change; #else #ifndef E_BORDER_H @@ -285,6 +286,12 @@ struct _E_Event_Border_Lower E_Border *border, *below; }; +struct _E_Event_Border_Icon_Change +{ + E_Border *border; +}; + + EAPI int e_border_init(void); EAPI int e_border_shutdown(void); @@ -334,6 +341,7 @@ extern EAPI int E_EVENT_BORDER_ZONE_SET; extern EAPI int E_EVENT_BORDER_DESK_SET; extern EAPI int E_EVENT_BORDER_RAISE; extern EAPI int E_EVENT_BORDER_LOWER; +extern EAPI int E_EVENT_BORDER_ICON_CHANGE; #endif #endif diff --git a/src/modules/pager/e_mod_main.c b/src/modules/pager/e_mod_main.c index cb74556..f46dac4 100644 --- a/src/modules/pager/e_mod_main.c +++ b/src/modules/pager/e_mod_main.c @@ -46,6 +46,7 @@ static int _pager_face_cb_event_border_unstick(void *data, int type, voi static int _pager_face_cb_event_border_desk_set(void *data, int type, void *event); static int _pager_face_cb_event_border_raise(void *data, int type, void *event); static int _pager_face_cb_event_border_lower(void *data, int type, void *event); +static int _pager_face_cb_event_border_icon_change(void *data, int type, void *event); static int _pager_face_cb_event_zone_desk_count_set(void *data, int type, void *event); static int _pager_face_cb_event_desk_show(void *data, int type, void *event); static void _pager_face_cb_menu_enabled(void *data, E_Menu *m, E_Menu_Item *mi); @@ -311,6 +312,9 @@ _pager_face_new(E_Zone *zone) face->ev_handler_border_desk_set = ecore_event_handler_add(E_EVENT_BORDER_LOWER, _pager_face_cb_event_border_lower, face); + face->ev_handler_border_icon_change = + ecore_event_handler_add(E_EVENT_BORDER_ICON_CHANGE, + _pager_face_cb_event_border_icon_change, face); face->ev_handler_zone_desk_count_set = ecore_event_handler_add(E_EVENT_ZONE_DESK_COUNT_SET, _pager_face_cb_event_zone_desk_count_set, face); @@ -374,6 +378,9 @@ _pager_face_free(Pager_Face *face) ecore_event_handler_del(face->ev_handler_border_stick); ecore_event_handler_del(face->ev_handler_border_unstick); ecore_event_handler_del(face->ev_handler_border_desk_set); + ecore_event_handler_del(face->ev_handler_border_raise); + ecore_event_handler_del(face->ev_handler_border_lower); + ecore_event_handler_del(face->ev_handler_border_icon_change); ecore_event_handler_del(face->ev_handler_zone_desk_count_set); ecore_event_handler_del(face->ev_handler_desk_show); @@ -589,7 +596,7 @@ _pager_window_new(Pager_Desk *pd, E_Border *border) o = edje_object_add(pd->face->evas); pw->icon_object = o; edje_object_file_set(o, app->path, "icon"); - if (visible) evas_object_show(o); + evas_object_show(o); edje_object_part_swallow(pw->window_object, "icon", o); } @@ -851,8 +858,11 @@ _pager_face_cb_event_border_hide(void *data, int type, void *event) pw = _pager_desk_border_find(pd, ev->border); if (pw) { - if (ev->border->desk->visible) - evas_object_hide(pw->window_object); + if (ev->border->desk->visible) + { + pd->wins = evas_list_remove(pd->wins, pw); + _pager_window_free(pw); + } } } return 1; @@ -880,6 +890,27 @@ _pager_face_cb_event_border_show(void *data, int type, void *event) if (ev->border->desk->visible) evas_object_show(pw->window_object); } + else + { + if (ev->border->sticky) + { + /* create it and add it */ + pw = _pager_window_new(pd, ev->border); + if (pw) + pd->wins = evas_list_append(pd->wins, pw); + } + else + { + if (ev->border->desk == pd->desk) + { + Pager_Win *pw; + + pw = _pager_window_new(pd, ev->border); + if (pw) + pd->wins = evas_list_append(pd->wins, pw); + } + } + } } return 1; } @@ -1122,6 +1153,49 @@ _pager_face_cb_event_border_lower(void *data, int type, void *event) } static int +_pager_face_cb_event_border_icon_change(void *data, int type, void *event) +{ + E_Event_Border_Icon_Change *ev; + Pager_Face *face; + Evas_List *l; + + face = data; + ev = event; + if (face->zone != ev->border->zone) return 1; + for (l = face->desks; l; l = l->next) + { + Pager_Desk *pd; + Pager_Win *pw, *pw2 = NULL; + + pd = l->data; + pw = _pager_desk_border_find(pd, ev->border); + if (pw) + { + E_App *app; + + if (pw->icon_object) + { + evas_object_del(pw->icon_object); + pw->icon_object = NULL; + } + app = e_app_window_name_class_find(ev->border->client.icccm.name, + ev->border->client.icccm.class); + if (app) + { + Evas_Object *o; + + o = edje_object_add(pd->face->evas); + pw->icon_object = o; + edje_object_file_set(o, app->path, "icon"); + evas_object_show(o); + edje_object_part_swallow(pw->window_object, "icon", o); + } + } + } + return 1; +} + +static int _pager_face_cb_event_zone_desk_count_set(void *data, int type, void *event) { E_Event_Zone_Desk_Count_Set *ev; diff --git a/src/modules/pager/e_mod_main.h b/src/modules/pager/e_mod_main.h index 62e3fac..6086bf7 100644 --- a/src/modules/pager/e_mod_main.h +++ b/src/modules/pager/e_mod_main.h @@ -70,6 +70,7 @@ struct _Pager_Face Ecore_Event_Handler *ev_handler_border_desk_set; Ecore_Event_Handler *ev_handler_border_raise; Ecore_Event_Handler *ev_handler_border_lower; + Ecore_Event_Handler *ev_handler_border_icon_change; Ecore_Event_Handler *ev_handler_zone_desk_count_set; Ecore_Event_Handler *ev_handler_desk_show; }; -- 2.7.4