]> Dogcows Code - chaz/openbox/blobdiff - openbox/prompt.c
Update latvian translation.
[chaz/openbox] / openbox / prompt.c
index e57b141099654f898602d31bcc1cc79522e7ea62..bef06a74f217ce0569952e8bde00215bd7705c2d 100644 (file)
@@ -140,7 +140,7 @@ void prompt_shutdown(gboolean reconfig)
     RrAppearanceFree(prompt_a_msg);
 }
 
-ObPrompt* prompt_new(const gchar *msg,
+ObPrompt* prompt_new(const gchar *msg, const gchar *title,
                      const ObPromptAnswer *answers, gint n_answers,
                      gint default_result, gint cancel_result,
                      ObPromptCallback func, ObPromptCleanup cleanup,
@@ -172,6 +172,10 @@ ObPrompt* prompt_new(const gchar *msg,
     PROP_SET32(self->super.window, net_wm_window_type, atom,
                prop_atoms.net_wm_window_type_dialog);
 
+    /* set the window's title */
+    if (title)
+        PROP_SETS(self->super.window, net_wm_name, title);
+
     /* listen for key presses on the window */
     self->event_mask = KeyPressMask;
 
@@ -290,7 +294,6 @@ static void prompt_layout(ObPrompt *self)
         self->button[i].width = MAX(self->button[i].width, bw);
         self->button[i].height = MAX(self->button[i].height, bh);
 
-
         self->button[i].width += BUTTON_HMARGIN * 2;
         self->button[i].height += BUTTON_VMARGIN * 2;
 
@@ -529,23 +532,23 @@ gboolean prompt_key_event(ObPrompt *self, XEvent *e)
     if (e->xkey.state != 0 && e->xkey.state != shift_mask)
         return FALSE;
 
-    if (e->xkey.keycode == ob_keycode(OB_KEY_ESCAPE))
+    if (ob_keycode_match(e->xkey.keycode, OB_KEY_ESCAPE))
         prompt_cancel(self);
-    else if (e->xkey.keycode == ob_keycode(OB_KEY_RETURN) ||
-             e->xkey.keycode == ob_keycode(OB_KEY_SPACE))
+    else if (ob_keycode_match(e->xkey.keycode, OB_KEY_RETURN) ||
+             ob_keycode_match(e->xkey.keycode, OB_KEY_SPACE))
     {
         prompt_run_callback(self, self->focus->result);
     }
-    else if (e->xkey.keycode == ob_keycode(OB_KEY_TAB) ||
-             e->xkey.keycode == ob_keycode(OB_KEY_LEFT) ||
-             e->xkey.keycode == ob_keycode(OB_KEY_RIGHT))
+    else if (ob_keycode_match(e->xkey.keycode, OB_KEY_TAB) ||
+             ob_keycode_match(e->xkey.keycode, OB_KEY_LEFT) ||
+             ob_keycode_match(e->xkey.keycode, OB_KEY_RIGHT))
     {
         gint i;
         gboolean left;
         ObPromptElement *oldfocus;
 
-        left = e->xkey.keycode == ob_keycode(OB_KEY_LEFT) ||
-            (e->xkey.keycode == ob_keycode(OB_KEY_TAB) && shift);
+        left = ob_keycode_match(e->xkey.keycode, OB_KEY_LEFT) ||
+            (ob_keycode_match(e->xkey.keycode, OB_KEY_TAB) && shift);
         oldfocus = self->focus;
 
         for (i = 0; i < self->n_buttons; ++i)
@@ -624,16 +627,18 @@ static void prompt_show_message_cleanup(ObPrompt *p, gpointer data)
     prompt_unref(p);
 }
 
-void prompt_show_message(const gchar *msg, const gchar *answer)
+ObPrompt* prompt_show_message(const gchar *msg, const gchar *title,
+                              const gchar *answer)
 {
     ObPrompt *p;
     ObPromptAnswer ans[] = {
         { answer, 0 }
     };
 
-    p = prompt_new(msg, ans, 1, 0, 0,
+    p = prompt_new(msg, title, ans, 1, 0, 0,
                    prompt_show_message_cb, prompt_show_message_cleanup, NULL);
     prompt_show(p, NULL, FALSE);
+    return p;
 }
 
 static void prompt_run_callback(ObPrompt *self, gint result)
This page took 0.023847 seconds and 4 git commands to generate.