ping stuff now can emit a hung/unhung signal to window borders and delete of

windows if hung will revert to a kill of the pid if it can (or the client) if
the app gets hung after 10 secs of waiting (should make this a config option
though)


SVN revision: 15477
This commit is contained in:
Carsten Haitzler 2005-06-22 06:28:46 +00:00
parent 0188539a18
commit ff50a472a4
3 changed files with 66 additions and 16 deletions

6
TODO
View File

@ -153,6 +153,7 @@ These are in no particular order:
radio etc. not massive menus)
* remove module config menus (make them part of the module control panel and
as separate executables)
* actuallly break out ipc and config to set bg per desktop (per zone)
2. fixes
@ -184,7 +185,6 @@ These are in no particular order:
3. cleanups
* actuallly break out ipc and config to set bg per desktop (per zone)
* make it easy for modules to hook into ipc and extend it for themselves
* re-implement all ipc to go via e_ipc_handlers.h and e_ipc_codec.[ch]
* gadman needs some changes to virtualise the canvas/container the gadget
@ -209,10 +209,6 @@ These are in no particular order:
5. nice to have features
* "run command" typebuffer thing
* use ecore_x_netwm_ping_send() to windows that suport it regularly to see if
they are dead or not (do this all the time - like every few seconds) to be
able to inform users of dead applications about the time they die, not some
time afterwards. (also ask if u want to kill the process then)
* icons should be able to be overidden from the theme (eapp and menu stuff
etc.)
* setup configs for gnome and kde (as options) if they are installed (eg

View File

@ -79,6 +79,7 @@ static void _e_border_cb_border_menu_end(void *data, E_Menu *m);
static void _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key);
static void _e_border_menu_cb_close(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_iconify(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_kill(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_maximize(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_shade(void *data, E_Menu *m, E_Menu_Item *mi);
static void _e_border_menu_cb_icon_edit(void *data, E_Menu *m, E_Menu_Item *mi);
@ -117,6 +118,7 @@ static void _e_border_move_update(E_Border *bd);
static int _e_border_cb_focus_fix(void *data);
static int _e_border_cb_ping_timer(void *data);
static int _e_border_cb_kill_timer(void *data);
static char *_e_border_winid_str_get(Ecore_X_Window win);
@ -1668,9 +1670,16 @@ e_border_act_close_begin(E_Border *bd)
void
e_border_act_kill_begin(E_Border *bd)
{
ecore_x_kill(bd->client.win);
if (bd->client.netwm.pid != 0)
{
kill(bd->client.netwm.pid, SIGINT);
bd->kill_timer = ecore_timer_add(10.0, _e_border_cb_kill_timer, bd);
}
else
{
ecore_x_kill(bd->client.win);
}
e_border_hide(bd, 0);
e_object_del(E_OBJECT(bd));
}
/* FIXME: Prefer app icon or own icon? */
@ -1815,6 +1824,11 @@ _e_border_free(E_Border *bd)
ecore_timer_del(bd->dangling_ref_check);
bd->dangling_ref_check = NULL;
}
if (bd->kill_timer)
{
ecore_timer_del(bd->kill_timer);
bd->kill_timer = NULL;
}
if (bd->ping_timer)
{
ecore_timer_del(bd->ping_timer);
@ -4628,6 +4642,16 @@ _e_border_menu_show(E_Border *bd, Evas_Coord x, Evas_Coord y, int key)
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Kill"));
e_menu_item_callback_set(mi, _e_border_menu_cb_kill, bd);
e_menu_item_icon_edje_set(mi,
(char *)e_theme_edje_file_get("base/theme/borders",
"widgets/border/default/kill"),
"widgets/border/default/kill");
mi = e_menu_item_new(m);
e_menu_item_separator_set(mi, 1);
mi = e_menu_item_new(m);
e_menu_item_label_set(mi, _("Shaded"));
e_menu_item_check_set(mi, 1);
@ -4768,6 +4792,15 @@ _e_border_menu_cb_iconify(void *data, E_Menu *m, E_Menu_Item *mi)
else e_border_iconify(bd);
}
static void
_e_border_menu_cb_kill(void *data, E_Menu *m, E_Menu_Item *mi)
{
E_Border *bd;
bd = data;
e_border_act_kill_begin(bd);
}
static void
_e_border_menu_cb_maximize(void *data, E_Menu *m, E_Menu_Item *mi)
{
@ -5264,24 +5297,43 @@ _e_border_cb_ping_timer(void *data)
bd = data;
if (bd->ping_ok)
{
/* FIXME: if hung, reset hung state to normal */
e_border_ping(bd);
if (bd->hung)
{
bd->hung = 0;
edje_object_signal_emit(bd->bg_object, "unhung", "");
}
}
else
{
/* FIXME: if !hung, set hung state then... */
if (!bd->hung)
{
bd->hung = 1;
edje_object_signal_emit(bd->bg_object, "hung", "");
/* if dialog is up - hide it now */
}
if (bd->delete_requested)
{
/* FIXME: pop up dialog saying app is hung - kill client, or pid */
printf("DELETE REQ HUNG: BORDER %p [%s] not responding to ping!!!!\n",
bd, bd->client.icccm.title);
}
else
{
printf("HUNG APP: BORDER %p [%s] not responding to ping!!!!\n",
bd, bd->client.icccm.title);
e_border_act_kill_begin(bd);
}
}
return 1;
bd->ping_timer = NULL;
e_border_ping(bd);
return 0;
}
static int
_e_border_cb_kill_timer(void *data)
{
E_Border *bd;
bd = data;
if (bd->client.netwm.pid != 0)
kill(bd->client.netwm.pid, SIGKILL);
bd->kill_timer = NULL;
return 0;
}
static char *

View File

@ -274,6 +274,7 @@ struct _E_Border
unsigned int button_grabbed : 1;
unsigned int delete_requested : 1;
unsigned int ping_ok : 1;
unsigned int hung : 1;
E_Maximize maximized;
double ping;
@ -322,6 +323,7 @@ struct _E_Border
E_Action *cur_mouse_action;
Ecore_Timer *raise_timer;
Ecore_Timer *ping_timer;
Ecore_Timer *kill_timer;
Ecore_Timer *dangling_ref_check;
};