Let ObPrompts be modal dialogs, and when they are transient for a window, make it transient for its entire group, so it can be stacked at the highest level above other transients
This commit is contained in:
parent
c49c2a8e40
commit
cd4f325ee7
5 changed files with 33 additions and 5 deletions
|
@ -3442,7 +3442,7 @@ static void client_prompt_kill(ObClient *self)
|
||||||
g_free(m);
|
g_free(m);
|
||||||
}
|
}
|
||||||
|
|
||||||
prompt_show(self->kill_prompt, self);
|
prompt_show(self->kill_prompt, self, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void client_kill(ObClient *self)
|
void client_kill(ObClient *self)
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "openbox.h"
|
#include "openbox.h"
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
|
#include "group.h"
|
||||||
#include "prop.h"
|
#include "prop.h"
|
||||||
#include "modkeys.h"
|
#include "modkeys.h"
|
||||||
#include "event.h"
|
#include "event.h"
|
||||||
|
@ -435,7 +436,7 @@ static void render_all(ObPrompt *self)
|
||||||
render_button(self, &self->button[i]);
|
render_button(self, &self->button[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void prompt_show(ObPrompt *self, ObClient *parent)
|
void prompt_show(ObPrompt *self, ObClient *parent, gboolean modal)
|
||||||
{
|
{
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
|
@ -457,8 +458,33 @@ void prompt_show(ObPrompt *self, ObClient *parent)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
XSetTransientForHint(ob_display, self->super.window,
|
if (parent) {
|
||||||
(parent ? parent->window : 0));
|
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 */
|
/* set up the dialog and render it */
|
||||||
prompt_layout(self);
|
prompt_layout(self);
|
||||||
|
|
|
@ -100,7 +100,7 @@ void prompt_ref(ObPrompt *self);
|
||||||
void prompt_unref(ObPrompt *self);
|
void prompt_unref(ObPrompt *self);
|
||||||
|
|
||||||
/*! Show the prompt. It will be centered within the given area rectangle */
|
/*! Show the prompt. It will be centered within the given area rectangle */
|
||||||
void prompt_show(ObPrompt *self, struct _ObClient *parent);
|
void prompt_show(ObPrompt *self, struct _ObClient *parent, gboolean modal);
|
||||||
void prompt_hide(ObPrompt *self);
|
void prompt_hide(ObPrompt *self);
|
||||||
|
|
||||||
gboolean prompt_key_event(ObPrompt *self, XEvent *e);
|
gboolean prompt_key_event(ObPrompt *self, XEvent *e);
|
||||||
|
|
|
@ -51,6 +51,7 @@ void prop_startup(void)
|
||||||
CREATE(wm_client_machine, "WM_CLIENT_MACHINE");
|
CREATE(wm_client_machine, "WM_CLIENT_MACHINE");
|
||||||
CREATE(wm_command, "WM_COMMAND");
|
CREATE(wm_command, "WM_COMMAND");
|
||||||
CREATE(wm_client_leader, "WM_CLIENT_LEADER");
|
CREATE(wm_client_leader, "WM_CLIENT_LEADER");
|
||||||
|
CREATE(wm_transient_for, "WM_TRANSIENT_FOR");
|
||||||
CREATE(motif_wm_hints, "_MOTIF_WM_HINTS");
|
CREATE(motif_wm_hints, "_MOTIF_WM_HINTS");
|
||||||
|
|
||||||
CREATE(sm_client_id, "SM_CLIENT_ID");
|
CREATE(sm_client_id, "SM_CLIENT_ID");
|
||||||
|
|
|
@ -53,6 +53,7 @@ typedef struct Atoms {
|
||||||
Atom wm_client_machine;
|
Atom wm_client_machine;
|
||||||
Atom wm_command;
|
Atom wm_command;
|
||||||
Atom wm_client_leader;
|
Atom wm_client_leader;
|
||||||
|
Atom wm_transient_for;
|
||||||
Atom motif_wm_hints;
|
Atom motif_wm_hints;
|
||||||
|
|
||||||
/* SM atoms */
|
/* SM atoms */
|
||||||
|
|
Loading…
Reference in a new issue