X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fprompt.c;h=9e91d249416e4a5a3416b8f3b86975986ae2b5a3;hb=26cc41f6c6187dabd5c7ee4365c8fa44751009e5;hp=3328a1b231f749fddc1dcf122cff7824c751aeb2;hpb=91a9000d166606fc322186b24f4f105fa9a53394;p=chaz%2Fopenbox diff --git a/openbox/prompt.c b/openbox/prompt.c index 3328a1b2..9e91d249 100644 --- a/openbox/prompt.c +++ b/openbox/prompt.c @@ -20,6 +20,7 @@ #include "openbox.h" #include "screen.h" #include "client.h" +#include "group.h" #include "event.h" #include "obt/display.h" #include "obt/keyboard.h" @@ -349,14 +350,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; + gint i, l, r, t, b; - if (!on) { - gint i; - - 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; @@ -437,7 +434,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; @@ -459,8 +456,34 @@ void prompt_show(ObPrompt *self, ObClient *parent) break; } - XSetTransientForHint(obt_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 = obt_root(ob_screen); + } + else { + /* make it transient for the window directly */ + h.flags = 0; + p = parent->window; + } + + XSetWMHints(obt_display, self->super.window, &h); + OBT_PROP_SET32(self->super.window, WM_TRANSIENT_FOR, WINDOW, p); + + states[0] = OBT_PROP_ATOM(NET_WM_STATE_MODAL); + nstates = (modal ? 1 : 0); + OBT_PROP_SETA32(self->super.window, NET_WM_STATE, ATOM, + states, nstates); + } + else + OBT_PROP_ERASE(self->super.window, WM_TRANSIENT_FOR); /* set up the dialog and render it */ prompt_layout(self);