X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fprompt.c;h=0278757eadbf29fd9e9f0768abc45c207dd63af2;hb=4d098217301086d5ab142d6c4184f01d18c8b329;hp=b964de29669f2ea35c3dd246ebcdee0d1acfffce;hpb=cd3aa44b6a78e84e75420d6cca2c32f117a096a4;p=chaz%2Fopenbox diff --git a/openbox/prompt.c b/openbox/prompt.c index b964de29..0278757e 100644 --- a/openbox/prompt.c +++ b/openbox/prompt.c @@ -21,6 +21,7 @@ #include "screen.h" #include "openbox.h" #include "client.h" +#include "group.h" #include "prop.h" #include "modkeys.h" #include "event.h" @@ -263,7 +264,6 @@ static void prompt_layout(ObPrompt *self) self->button[i].width = bw; self->button[i].height = bh; RrMinSize(prompt_a_focus, &bw, &bh); - g_print("button w %d h %d\n", bw, bh); self->button[i].width = MAX(self->button[i].width, bw); self->button[i].height = MAX(self->button[i].height, bh); RrMinSize(prompt_a_press, &bw, &bh); @@ -351,14 +351,10 @@ static void prompt_resize(ObPrompt *self, gint w, gint h) static void setup_button_focus_tex(ObPromptElement *e, RrAppearance *a, gboolean on) { - gint l, r, t, b; - - if (!on) { - gint i; + gint i, l, r, t, b; - for (i = 1; i < 5; ++i) - a->texture[i].type = on ? RR_TEXTURE_LINE_ART : RR_TEXTURE_NONE; - } + for (i = 1; i < 5; ++i) + a->texture[i].type = on ? RR_TEXTURE_LINE_ART : RR_TEXTURE_NONE; if (!on) return; @@ -391,8 +387,6 @@ static void setup_button_focus_tex(ObPromptElement *e, RrAppearance *a, a->texture[4].data.lineart.x2 = e->width - r - 1; a->texture[4].data.lineart.y1 = t; a->texture[4].data.lineart.y2 = e->height - b - 1; - - g_print("setting x2 %d\n", e->width - r - 1); } static void render_button(ObPrompt *self, ObPromptElement *e) @@ -439,7 +433,7 @@ static void render_all(ObPrompt *self) render_button(self, &self->button[i]); } -void prompt_show(ObPrompt *self, ObClient *parent) +void prompt_show(ObPrompt *self, ObClient *parent, gboolean modal) { gint i; @@ -461,8 +455,33 @@ void prompt_show(ObPrompt *self, ObClient *parent) break; } - XSetTransientForHint(ob_display, self->super.window, - (parent ? parent->window : 0)); + if (parent) { + Atom states[1]; + gint nstates; + Window p; + XWMHints h; + + if (parent->group) { + /* make it transient for the window's group */ + h.flags = WindowGroupHint; + h.window_group = parent->group->leader; + p = RootWindow(ob_display, ob_screen); + } + else { + /* make it transient for the window directly */ + h.flags = 0; + p = parent->window; + } + + XSetWMHints(ob_display, self->super.window, &h); + PROP_SET32(self->super.window, wm_transient_for, window, p); + + states[0] = prop_atoms.net_wm_state_modal; + nstates = (modal ? 1 : 0); + PROP_SETA32(self->super.window, net_wm_state, atom, states, nstates); + } + else + PROP_ERASE(self->super.window, wm_transient_for); /* set up the dialog and render it */ prompt_layout(self); @@ -486,8 +505,6 @@ gboolean prompt_key_event(ObPrompt *self, XEvent *e) if (e->type != KeyPress) return FALSE; - g_print("key 0x%x 0x%x\n", e->xkey.keycode, ob_keycode(OB_KEY_TAB)); - shift_mask = modkeys_key_to_mask(OB_MODKEY_KEY_SHIFT); shift = !!(e->xkey.state & shift_mask);