all repos — openbox @ 7ecfa01df81fcce628fbb354cc0c4faaddfb5c84

openbox fork - make it a bit more like ryudo

if a prompt is already showing and you try show it again, then make it active.  in the "kill this?" prompt use the window's original title without any of the openbox-appended-ness
Dana Jansens danakj@orodu.net
commit

7ecfa01df81fcce628fbb354cc0c4faaddfb5c84

parent

95ee6b103f116e34062bf5e1ad1cb8b0f23e7231

3 files changed, 32 insertions(+), 18 deletions(-)

jump to
M openbox/client.copenbox/client.c

@@ -737,6 +737,7 @@ g_free(self->startup_id);

g_free(self->wm_command); g_free(self->title); g_free(self->icon_title); + g_free(self->original_title); g_free(self->name); g_free(self->class); g_free(self->role);

@@ -1892,6 +1893,7 @@ gchar *data = NULL;

gchar *visible = NULL; g_free(self->title); + g_free(self->original_title); /* try netwm */ if (!OBT_PROP_GETS(self->window, NET_WM_NAME, utf8, &data)) {

@@ -1908,6 +1910,7 @@ } else

data = g_strdup("Unnamed Window"); } } + self->original_title = g_strdup(data); if (self->client_machine) { visible = g_strdup_printf("%s (%s)", data, self->client_machine);

@@ -3306,26 +3309,26 @@ }

static void client_prompt_kill(ObClient *self) { - ObPromptAnswer answers[] = { - { _("No"), OB_KILL_RESULT_NO }, - { _("Yes"), OB_KILL_RESULT_YES } - }; - gchar *m; - /* check if we're already prompting */ - if (self->kill_prompt) return; + if (!self->kill_prompt) { + ObPromptAnswer answers[] = { + { _("No"), OB_KILL_RESULT_NO }, + { _("Yes"), OB_KILL_RESULT_YES } + }; + gchar *m; - m = g_strdup_printf - (_("The window \"%s\" does not seem to be responding. Do you want to force it to exit?"), self->title); + m = g_strdup_printf + (_("The window \"%s\" does not seem to be responding. Do you want to force it to exit?"), self->original_title); - self->kill_prompt = prompt_new(m, answers, - sizeof(answers)/sizeof(answers[0]), - OB_KILL_RESULT_NO, /* default = no */ - OB_KILL_RESULT_NO, /* cancel = no */ - client_kill_requested, self); - prompt_show(self->kill_prompt, self); + self->kill_prompt = prompt_new(m, answers, + sizeof(answers)/sizeof(answers[0]), + OB_KILL_RESULT_NO, /* default = no */ + OB_KILL_RESULT_NO, /* cancel = no */ + client_kill_requested, self); + g_free(m); + } - g_free(m); + prompt_show(self->kill_prompt, self); } void client_kill(ObClient *self)
M openbox/client.hopenbox/client.h

@@ -120,6 +120,8 @@ /*! Normal window title */

gchar *title; /*! Window title when iconified */ gchar *icon_title; + /*! The title as requested by the client, without any of our own changes */ + gchar *original_title; /*! Hostname of machine running the client */ gchar *client_machine; /*! The command used to run the program. Pre-XSMP window identification. */
M openbox/prompt.copenbox/prompt.c

@@ -20,6 +20,7 @@ #include "prompt.h"

#include "openbox.h" #include "screen.h" #include "client.h" +#include "event.h" #include "obt/display.h" #include "obt/keyboard.h" #include "obt/prop.h"

@@ -330,7 +331,15 @@ {

XSizeHints hints; gint i; - if (self->mapped) return; + if (self->mapped) { + /* activate the prompt */ + OBT_PROP_MSG(ob_screen, self->super.window, NET_ACTIVE_WINDOW, + 1, /* from an application.. */ + event_curtime, + 0, + 0, 0); + return; + } /* set the focused button (if not found then the first button is used) */ self->focus = &self->button[0];

@@ -417,7 +426,7 @@ gint i;

ObPromptElement *but; if (e->type != ButtonPress && e->type != ButtonRelease && - e->type != MotionNotify) return; + e->type != MotionNotify) return FALSE; /* find the button */ but = NULL;