Merge branch 'backport' into work

This commit is contained in:
Dana Jansens 2008-03-02 15:03:10 -05:00
commit c70379fa8f
5 changed files with 49 additions and 14 deletions

View file

@ -3,10 +3,6 @@
#include "openbox/session.h" #include "openbox/session.h"
#include "gettext.h" #include "gettext.h"
#ifndef USE_SM
void action_logout_startup(void) {}
#else
typedef struct { typedef struct {
gboolean prompt; gboolean prompt;
gboolean silent; gboolean silent;
@ -38,8 +34,13 @@ static gpointer setup_func(xmlNodePtr node)
static void prompt_cb(ObPrompt *p, gint result, gpointer data) static void prompt_cb(ObPrompt *p, gint result, gpointer data)
{ {
Options *o = data; Options *o = data;
if (result) if (result) {
#ifndef USE_SM
session_request_logout(o->silent); session_request_logout(o->silent);
#else
g_message(_("The SessionLogout actions is not available since Openbox was built without session management support"));
#endif
}
g_free(o); g_free(o);
prompt_unref(p); prompt_unref(p);
} }
@ -67,5 +68,3 @@ static gboolean logout_func(ObActionsData *data, gpointer options)
return FALSE; return FALSE;
} }
#endif

View file

@ -414,6 +414,12 @@ void client_manage(Window window, ObPrompt *prompt)
activate ? "yes" : "no"); activate ? "yes" : "no");
if (activate) { if (activate) {
gboolean raise = FALSE; gboolean raise = FALSE;
gboolean relative_focused = FALSE;
relative_focused = (focus_client != NULL &&
client_search_focus_tree_full(self) != NULL &&
client_search_focus_group_full(self) != NULL);
/* This is focus stealing prevention */ /* This is focus stealing prevention */
ob_debug_type(OB_DEBUG_FOCUS, ob_debug_type(OB_DEBUG_FOCUS,
@ -444,10 +450,8 @@ void client_manage(Window window, ObPrompt *prompt)
"Not focusing the window because its on another " "Not focusing the window because its on another "
"desktop"); "desktop");
} }
/* If something is focused, and it's not our relative... */ /* If something is focused... */
else if (focus_client && client_search_focus_tree_full(self) == NULL && else if (focus_client) {
client_search_focus_group_full(self) == NULL)
{
/* If the user is working in another window right now, then don't /* If the user is working in another window right now, then don't
steal focus */ steal focus */
if (event_last_user_time && launch_time && if (event_last_user_time && launch_time &&
@ -461,8 +465,9 @@ void client_manage(Window window, ObPrompt *prompt)
"Not focusing the window because the user is " "Not focusing the window because the user is "
"working in another window"); "working in another window");
} }
/* If it's a transient (and its parents aren't focused) */ /* If the new window is a transient (and its relatives aren't
else if (client_has_parent(self)) { focused) */
else if (client_has_parent(self) && !relative_focused) {
activate = FALSE; activate = FALSE;
ob_debug_type(OB_DEBUG_FOCUS, ob_debug_type(OB_DEBUG_FOCUS,
"Not focusing the window because it is a " "Not focusing the window because it is a "
@ -488,8 +493,11 @@ void client_manage(Window window, ObPrompt *prompt)
"Not focusing the window because another window " "Not focusing the window because another window "
"would get the focus anyway"); "would get the focus anyway");
} }
/* Don't move focus if the window is not visible on the current
desktop and none of its relatives are focused */
else if (!(self->desktop == screen_desktop || else if (!(self->desktop == screen_desktop ||
self->desktop == DESKTOP_ALL)) self->desktop == DESKTOP_ALL) &&
!relative_focused)
{ {
activate = FALSE; activate = FALSE;
raise = TRUE; raise = TRUE;

View file

@ -28,6 +28,7 @@
#include "gettext.h" #include "gettext.h"
static GList *prompt_list = NULL; static GList *prompt_list = NULL;
static GList *prompt_msg_list = NULL;
/* we construct these */ /* we construct these */
static RrAppearance *prompt_a_bg; static RrAppearance *prompt_a_bg;
@ -121,6 +122,9 @@ void prompt_startup(gboolean reconfig)
void prompt_shutdown(gboolean reconfig) void prompt_shutdown(gboolean reconfig)
{ {
while (prompt_msg_list)
prompt_cancel(prompt_msg_list->data);
RrAppearanceFree(prompt_a_button); RrAppearanceFree(prompt_a_button);
RrAppearanceFree(prompt_a_focus); RrAppearanceFree(prompt_a_focus);
RrAppearanceFree(prompt_a_press); RrAppearanceFree(prompt_a_press);
@ -216,6 +220,9 @@ void prompt_unref(ObPrompt *self)
if (self && --self->ref == 0) { if (self && --self->ref == 0) {
gint i; gint i;
if (self->mapped)
prompt_hide(self);
prompt_list = g_list_remove(prompt_list, self); prompt_list = g_list_remove(prompt_list, self);
for (i = 0; i < self->n_buttons; ++i) { for (i = 0; i < self->n_buttons; ++i) {
@ -599,3 +606,21 @@ void prompt_cancel(ObPrompt *self)
if (self->func) self->func(self, self->cancel_result, self->data); if (self->func) self->func(self, self->cancel_result, self->data);
prompt_hide(self); prompt_hide(self);
} }
static void prompt_show_message_cb(ObPrompt *p, int res, gpointer data)
{
prompt_msg_list = g_list_remove(prompt_msg_list, p);
prompt_unref(p);
}
void prompt_show_message(const gchar *msg, const gchar *answer)
{
ObPrompt *p;
ObPromptAnswer ans[] = {
{ answer, 0 }
};
p = prompt_new(msg, ans, 1, 0, 0, prompt_show_message_cb, NULL);
prompt_msg_list = g_list_prepend(prompt_msg_list, p);
prompt_show(p, NULL, FALSE);
}

View file

@ -107,4 +107,6 @@ gboolean prompt_key_event(ObPrompt *self, XEvent *e);
gboolean prompt_mouse_event(ObPrompt *self, XEvent *e); gboolean prompt_mouse_event(ObPrompt *self, XEvent *e);
void prompt_cancel(ObPrompt *self); void prompt_cancel(ObPrompt *self);
void prompt_show_message(const gchar *msg, const gchar *answer);
#endif #endif

View file

@ -2,6 +2,7 @@
openbox/actions.c openbox/actions.c
openbox/actions/execute.c openbox/actions/execute.c
openbox/actions/exit.c openbox/actions/exit.c
openbox/actions/session.c
openbox/client.c openbox/client.c
openbox/client_list_combined_menu.c openbox/client_list_combined_menu.c
openbox/client_list_menu.c openbox/client_list_menu.c