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,
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;
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;
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)
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)