summaryrefslogtreecommitdiff
path: root/openbox/prompt.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2008-02-06 23:44:15 -0500
committerDana Jansens <danakj@orodu.net>2008-02-14 14:24:07 -0500
commitdeca45dadad1e0e1d5183341a601267f2deb1aa5 (patch)
tree0524ad0e4058eeb316ab817a2f5e7ca17ee923f5 /openbox/prompt.c
parenta5005506a89ecffe13e04cbcda5c20a2fa6ba25d (diff)
key input works for ObPrompt windows now
Diffstat (limited to 'openbox/prompt.c')
-rw-r--r--openbox/prompt.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/openbox/prompt.c b/openbox/prompt.c
index a72b6a44..73f0ba33 100644
--- a/openbox/prompt.c
+++ b/openbox/prompt.c
@@ -63,6 +63,10 @@ void prompt_startup(gboolean reconfig)
prompt_a_focus->texture[0] = ob_rr_theme->osd_hilite_label->texture[0];
prompt_a_press->texture[0] = ob_rr_theme->osd_hilite_label->texture[0];
+ prompt_a_button->texture[0].data.text.justify = RR_JUSTIFY_CENTER;
+ prompt_a_focus->texture[0].data.text.justify = RR_JUSTIFY_CENTER;
+ prompt_a_press->texture[0].data.text.justify = RR_JUSTIFY_CENTER;
+
prompt_a_button->texture[0].data.text.color = c_button;
prompt_a_focus->texture[0].data.text.color = c_focus;
prompt_a_press->texture[0].data.text.color = c_press;
@@ -113,6 +117,9 @@ ObPrompt* prompt_new(const gchar *msg, const gchar *const *answers)
PROP_SET32(self->super.window, net_wm_window_type, atom,
prop_atoms.net_wm_window_type_dialog);
+ /* listen for key presses on the window */
+ self->event_mask = KeyPressMask;
+
self->a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
self->msg.text = g_strdup(msg);
@@ -200,6 +207,8 @@ static void prompt_layout(ObPrompt *self)
const gint OUTSIDE_MARGIN = 4;
const gint MSG_BUTTON_SEPARATION = 4;
const gint BUTTON_SEPARATION = 4;
+ const gint BUTTON_VMARGIN = 4;
+ const gint BUTTON_HMARGIN = 12;
const gint MAX_WIDTH = 600;
RrMargins(self->a_bg, &l, &t, &r, &b);
@@ -232,6 +241,9 @@ 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;
+
allbuttonsw += self->button[i].width + (i > 0 ? BUTTON_SEPARATION : 0);
allbuttonsh = MAX(allbuttonsh, self->button[i].height);
}
@@ -280,7 +292,7 @@ static void render_button(ObPrompt *self, ObPromptElement *e)
RrAppearance *a;
if (e->pressed) a = prompt_a_press;
- else if (self->focus == e) a = prompt_a_focus, g_print("focus!\n");
+ else if (self->focus == e) a = prompt_a_focus;
else a = prompt_a_button;
a->surface.parent = self->a_bg;