X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;ds=sidebyside;f=openbox%2Fclient.c;h=013836d11cf47c0a478cb1a64f7988dcbd7bf616;hb=f999797f01755dcb5de3db010ad282feb8e3ac37;hp=76db97bc82b0da54721fe384e795f9123796b6d2;hpb=7e0d660b8b5dcf5764f43efe8e0d277f4203ba63;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index 76db97bc..013836d1 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -41,6 +41,10 @@ #include "mouse.h" #include "render/render.h" +#ifdef HAVE_UNISTD_H +# include +#endif + #include #include @@ -70,6 +74,7 @@ static void client_get_layer(ObClient *self); static void client_get_shaped(ObClient *self); static void client_get_mwm_hints(ObClient *self); static void client_get_gravity(ObClient *self); +static void client_get_client_machine(ObClient *self); static void client_change_allowed_actions(ObClient *self); static void client_change_state(ObClient *self); static void client_change_wm_state(ObClient *self); @@ -511,9 +516,8 @@ void client_unmanage(ObClient *self) XSelectInput(ob_display, self->window, NoEventMask); frame_hide(self->frame); - /* sync to send the hide to the server quickly, and to get back the enter - events */ - XSync(ob_display, FALSE); + /* flush to send the hide to the server quickly */ + XFlush(ob_display); if (focus_client == self) { /* ignore enter events from the unmap so it doesnt mess with the focus @@ -625,6 +629,7 @@ void client_unmanage(ObClient *self) g_free(self->name); g_free(self->class); g_free(self->role); + g_free(self->client_machine); g_free(self->sm_client_id); g_free(self); @@ -934,6 +939,7 @@ static void client_get_all(ObClient *self) (min/max sizes), so we're ready to set up the decorations/functions */ client_setup_decor_and_functions(self); + client_get_client_machine(self); client_update_title(self); client_update_class(self); client_update_sm_client_id(self); @@ -1642,6 +1648,7 @@ void client_update_wmhints(ObClient *self) void client_update_title(ObClient *self) { gchar *data = NULL; + gchar *visible = NULL; g_free(self->title); @@ -1661,8 +1668,14 @@ void client_update_title(ObClient *self) } } - PROP_SETS(self->window, net_wm_visible_name, data); - self->title = data; + if (self->client_machine) { + visible = g_strdup_printf("%s (%s)", data, self->client_machine); + g_free(data); + } else + visible = data; + + PROP_SETS(self->window, net_wm_visible_name, visible); + self->title = visible; if (self->frame) frame_adjust_title(self->frame); @@ -1861,6 +1874,21 @@ void client_update_user_time(ObClient *self) } } +static void client_get_client_machine(ObClient *self) +{ + gchar *data = NULL; + gchar localhost[128]; + + g_free(self->client_machine); + + if (PROP_GETS(self->window, wm_client_machine, locale, &data)) { + gethostname(localhost, 127); + localhost[127] = '\0'; + if (strcmp(localhost, data)) + self->client_machine = data; + } +} + static void client_change_wm_state(ObClient *self) { gulong state[2];