]> Dogcows Code - chaz/openbox/commitdiff
if a prompt is already showing and you try show it again, then make it active. in...
authorDana Jansens <danakj@orodu.net>
Thu, 7 Feb 2008 06:03:05 +0000 (01:03 -0500)
committerDana Jansens <danakj@orodu.net>
Thu, 14 Feb 2008 19:24:36 +0000 (14:24 -0500)
openbox/client.c
openbox/client.h
openbox/prompt.c

index 98ad7de292b2b5ca9d83bd1bfc092955d49a6853..44e027f899a1ab9b4eaf2297feb3c955e8fe9ebc 100644 (file)
@@ -820,6 +820,7 @@ void client_unmanage(ObClient *self)
     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);
@@ -1974,6 +1975,7 @@ void client_update_title(ObClient *self)
     gchar *visible = NULL;
 
     g_free(self->title);
+    g_free(self->original_title);
 
     /* try netwm */
     if (!PROP_GETS(self->window, net_wm_name, utf8, &data)) {
@@ -1990,6 +1992,7 @@ void client_update_title(ObClient *self)
                 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);
@@ -3398,26 +3401,26 @@ static void client_kill_requested(ObPrompt *p, gint result, gpointer data)
 
 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)
index 4e19bdf8353489d5d513ffbf3a6959f6e2c83c7c..197fb061a3d4ebaa8e6e43bc2d5a65148a5f521a 100644 (file)
@@ -120,6 +120,8 @@ struct _ObClient
     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. */
index 080dc9a8b4d54632af2c8ad7e00648d9d21df66e..1c7e2261e25bc20f1ceae2e6dda97216f3751868 100644 (file)
@@ -23,6 +23,7 @@
 #include "client.h"
 #include "prop.h"
 #include "modkeys.h"
+#include "event.h"
 #include "gettext.h"
 
 static GList *prompt_list = NULL;
@@ -332,7 +333,15 @@ void prompt_show(ObPrompt *self, ObClient *parent)
     XSizeHints hints;
     gint i;
 
-    if (self->mapped) return;
+    if (self->mapped) {
+        /* activate the prompt */
+        PROP_MSG(self->super.window, net_active_window,
+                 1, /* from an application.. */
+                 event_curtime,
+                 0,
+                 0);
+        return;
+    }
 
     /* set the focused button (if not found then the first button is used) */
     self->focus = &self->button[0];
@@ -421,7 +430,7 @@ gboolean prompt_mouse_event(ObPrompt *self, XEvent *e)
     ObPromptElement *but;
 
     if (e->type != ButtonPress && e->type != ButtonRelease &&
-        e->type != MotionNotify) return;
+        e->type != MotionNotify) return FALSE;
 
     /* find the button */
     but = NULL;
This page took 0.034871 seconds and 4 git commands to generate.