X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Fprompt.c;h=7c19bcb1976cb73978b0de0cc8b69814bc3bdd97;hb=9676757a08b3e2e508c47f7795326bda8e54dc53;hp=df36c8c3127e9b49cbb489db30a6cce1a1f4c0ff;hpb=3263845459d15da683b7cab92fb856acbdf2800e;p=chaz%2Fopenbox diff --git a/openbox/prompt.c b/openbox/prompt.c index df36c8c3..7c19bcb1 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" @@ -261,7 +262,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); @@ -385,8 +385,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) @@ -433,7 +431,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; @@ -455,8 +453,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);