X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=0a0d1ffc6765f886a6a78ab85f8e817798942330;hb=6a8a8531bad25c148b4c62263d16c0996a21ca6e;hp=d768ecc1ff1e06c17f545e7df19affcba45a3ee9;hpb=e6d33facc8f02a068f62b4f60c2872589b620dab;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index d768ecc1..0a0d1ffc 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -24,6 +24,7 @@ #include "xerror.h" #include "screen.h" #include "moveresize.h" +#include "ping.h" #include "place.h" #include "prop.h" #include "extensions.h" @@ -79,6 +80,10 @@ static void client_get_state(ObClient *self); static void client_get_shaped(ObClient *self); static void client_get_mwm_hints(ObClient *self); static void client_get_colormap(ObClient *self); +static void client_set_desktop_recursive(ObClient *self, + guint target, + gboolean donthide, + gboolean dontraise); static void client_change_allowed_actions(ObClient *self); static void client_change_state(ObClient *self); static void client_change_wm_state(ObClient *self); @@ -308,7 +313,7 @@ void client_manage(Window window) client_setup_decor_and_functions(self, FALSE); /* tell startup notification that this app started */ - launch_time = sn_app_started(self->startup_id, self->class); + launch_time = sn_app_started(self->startup_id, self->class, self->name); /* do this after we have a frame.. it uses the frame to help determine the WM_STATE to apply. */ @@ -602,6 +607,15 @@ void client_manage(Window window) /* update the list hints */ client_set_list(); + /* watch for when the application stops responding. only do this for + normal windows, i.e. windows which have titlebars and close buttons + and things like that. + we don't need to stop pinging on unmanage, because it will be handled + automatically by the destroy callback! + */ + if (self->ping && client_normal(self)) + ping_start(self, client_ping_event); + /* free the ObAppSettings shallow copy */ g_free(settings); @@ -1541,7 +1555,7 @@ void client_update_sync_request_counter(ObClient *self) } #endif -void client_get_colormap(ObClient *self) +static void client_get_colormap(ObClient *self) { XWindowAttributes wa; @@ -1955,7 +1969,10 @@ void client_update_title(ObClient *self) if (self->not_responding) { data = visible; - visible = g_strdup_printf("%s - [%s]", data, _("Not Responding")); + if (self->close_tried_term) + visible = g_strdup_printf("%s - [%s]", data, _("Killing...")); + else + visible = g_strdup_printf("%s - [%s]", data, _("Not Responding")); g_free(data); } @@ -1984,7 +2001,10 @@ void client_update_title(ObClient *self) if (self->not_responding) { data = visible; - visible = g_strdup_printf("%s - [%s]", data, _("Not Responding")); + if (self->close_tried_term) + visible = g_strdup_printf("%s - [%s]", data, _("Killing...")); + else + visible = g_strdup_printf("%s - [%s]", data, _("Not Responding")); g_free(data); } @@ -3194,6 +3214,12 @@ static void client_ping_event(ObClient *self, gboolean dead) { self->not_responding = dead; client_update_title(self); + + if (!dead) { + /* try kill it nicely the first time again, if it started responding + at some point */ + self->close_tried_term = FALSE; + } } void client_close(ObClient *self) @@ -3208,26 +3234,31 @@ void client_close(ObClient *self) XKillClient(ob_display, self->window); else if (self->not_responding) client_kill(self); - else { + else + /* request the client to close with WM_DELETE_WINDOW */ PROP_MSG_TO(self->window, self->window, wm_protocols, prop_atoms.wm_delete_window, event_curtime, 0, 0, 0, NoEventMask); - - if (self->ping) - ping_start(self, client_ping_event); - } } void client_kill(ObClient *self) { if (!self->client_machine && self->pid) { /* running on the local host */ - if (!self->kill_tried_term) { + if (!self->close_tried_term) { + ob_debug("killing window 0x%x with pid %lu, with SIGTERM\n", + self->window, self->pid); kill(self->pid, SIGTERM); - self->kill_tried_term = TRUE; + self->close_tried_term = TRUE; + + /* show that we're trying to kill it */ + client_update_title(self); } - else + else { + ob_debug("killing window 0x%x with pid %lu, with SIGKILL\n", + self->window, self->pid); kill(self->pid, SIGKILL); /* kill -9 */ + } } else XKillClient(ob_display, self->window); @@ -3249,10 +3280,10 @@ void client_hilite(ObClient *self, gboolean hilite) } } -void client_set_desktop_recursive(ObClient *self, - guint target, - gboolean donthide, - gboolean dontraise) +static void client_set_desktop_recursive(ObClient *self, + guint target, + gboolean donthide, + gboolean dontraise) { guint old; GSList *it;