From: Dana Jansens Date: Tue, 8 Dec 2009 19:19:04 +0000 (-0500) Subject: Merge branch 'backport' into work X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=2f09e0ce388f63c341cb328d795766e2bd0dc24b;p=chaz%2Fopenbox Merge branch 'backport' into work Conflicts: openbox/actions/all.h openbox/actions/session.c openbox/client.c openbox/event.c openbox/grab.c --- 2f09e0ce388f63c341cb328d795766e2bd0dc24b diff --cc openbox/actions/all.h index 1f520b93,5f3f573f..6acbc9ca --- a/openbox/actions/all.h +++ b/openbox/actions/all.h @@@ -1,46 -1,43 +1,45 @@@ #ifndef __actions_all_h #define __actions_all_h -void action_all_startup(); +void action_all_startup(void); -void action_execute_startup(); -void action_debug_startup(); -void action_showmenu_startup(); -void action_showdesktop_startup(); -void action_reconfigure_startup(); -void action_exit_startup(); -void action_restart_startup(); -void action_cyclewindows_startup(); -void action_breakchroot_startup(); -void action_close_startup(); -void action_move_startup(); -void action_focus_startup(); -void action_raise_startup(); -void action_lower_startup(); -void action_raiselower_startup(); -void action_unfocus_startup(); -void action_iconify_startup(); -void action_fullscreen_startup(); -void action_maximize_startup(); -void action_moveresizeto_startup(); -void action_moverelative_startup(); -void action_shade_startup(); -void action_kill_startup(); -void action_omnipresent_startup(); -void action_directionalwindows_startup(); -void action_resize_startup(); -void action_decorations_startup(); -void action_desktop_startup(); -void action_resizerelative_startup(); -void action_addremovedesktop_startup(); -void action_dockautohide_startup(); -void action_layer_startup(); -void action_movetoedge_startup(); -void action_growtoedge_startup(); -void action_if_startup(); -void action_focustobottom_startup(); +void action_execute_startup(void); +void action_debug_startup(void); +void action_showmenu_startup(void); +void action_showdesktop_startup(void); +void action_reconfigure_startup(void); +void action_exit_startup(void); +void action_restart_startup(void); - void action_session_startup(void); +void action_cyclewindows_startup(void); +void action_breakchroot_startup(void); +void action_close_startup(void); +void action_move_startup(void); +void action_focus_startup(void); +void action_raise_startup(void); +void action_lower_startup(void); +void action_raiselower_startup(void); +void action_unfocus_startup(void); +void action_iconify_startup(void); +void action_fullscreen_startup(void); +void action_maximize_startup(void); +void action_moveresizeto_startup(void); +void action_moverelative_startup(void); +void action_shade_startup(void); +void action_kill_startup(void); +void action_omnipresent_startup(void); +void action_directionalwindows_startup(void); +void action_resize_startup(void); +void action_decorations_startup(void); +void action_desktop_startup(void); +void action_resizerelative_startup(void); +void action_addremovedesktop_startup(void); +void action_dockautohide_startup(void); +void action_layer_startup(void); +void action_movetoedge_startup(void); +void action_growtoedge_startup(void); +void action_if_startup(void); +void action_focustobottom_startup(void); +/* 3.4-compatibility */ +void action_shadelowerraise_startup(void); #endif diff --cc openbox/actions/exit.c index 4f8cce6e,567926e1..3bfebbce --- a/openbox/actions/exit.c +++ b/openbox/actions/exit.c @@@ -13,9 -14,10 +14,10 @@@ static gboolean run_func(ObActionsData void action_exit_startup(void) { actions_register("Exit", setup_func, NULL, run_func, NULL, NULL); + actions_register("SessionLogout", setup_func, NULL, run_func, NULL, NULL); } -static gpointer setup_func(ObParseInst *i, xmlDocPtr doc, xmlNodePtr node) +static gpointer setup_func(xmlNodePtr node) { xmlNodePtr n; Options *o; diff --cc openbox/client.c index fc087d44,a91b9503..50a0dbee --- a/openbox/client.c +++ b/openbox/client.c @@@ -415,124 -498,17 +417,17 @@@ void client_manage(Window window, ObPro g_free(monitor); monitor = NULL; - ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s\n", + ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s", activate ? "yes" : "no"); if (activate) { - gboolean raise = FALSE; - gboolean relative_focused; - gboolean parent_focused; - - parent_focused = (focus_client != NULL && - client_search_focus_parent(self)); - relative_focused = (focus_client != NULL && - (client_search_focus_tree_full(self) != NULL || - client_search_focus_group_full(self) != NULL)); - - /* This is focus stealing prevention */ - ob_debug_type(OB_DEBUG_FOCUS, - "Want to focus new window 0x%x at time %u " - "launched at %u (last user interaction time %u)", - self->window, map_time, launch_time, - event_last_user_time); - ob_debug_type(OB_DEBUG_FOCUS, - "Current focus_client: %s", - (focus_client ? focus_client->title : "(none)")); - ob_debug_type(OB_DEBUG_FOCUS, - "parent focused: %d relative focused: %d", - parent_focused, relative_focused); - - if (menu_frame_visible || moveresize_in_progress) { - activate = FALSE; - raise = TRUE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because the user is inside " - "an Openbox menu or is move/resizing a window and " - "we don't want to interrupt them"); - } - - /* if it's on another desktop */ - else if (!(self->desktop == screen_desktop || - self->desktop == DESKTOP_ALL) && - /* the timestamp is from before you changed desktops */ - launch_time && screen_desktop_user_time && - !event_time_after(launch_time, screen_desktop_user_time)) - { - activate = FALSE; - raise = TRUE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because its on another " - "desktop"); - } - /* If something is focused... */ - else if (focus_client) { - /* If the user is working in another window right now, then don't - steal focus */ - if (!parent_focused && - event_last_user_time && launch_time && - event_time_after(event_last_user_time, launch_time) && - event_last_user_time != launch_time && - event_time_after(event_last_user_time, - map_time - OB_EVENT_USER_TIME_DELAY)) - { - activate = FALSE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because the user is " - "working in another window that is not " - "its parent"); - } - /* If the new window is a transient (and its relatives aren't - focused) */ - else if (client_has_parent(self) && !relative_focused) { - activate = FALSE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because it is a " - "transient, and its relatives aren't focused"); - } - /* Don't steal focus from globally active clients. - I stole this idea from KWin. It seems nice. - */ - else if (!(focus_client->can_focus || - focus_client->focus_notify)) - { - activate = FALSE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because a globally " - "active client has focus"); - } - /* Don't move focus if it's not going to go to this window - anyway */ - else if (client_focus_target(self) != self) { - activate = FALSE; - raise = TRUE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because another window " - "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 || - self->desktop == DESKTOP_ALL) && - !relative_focused) - { - activate = FALSE; - raise = TRUE; - ob_debug_type(OB_DEBUG_FOCUS, - "Not focusing the window because it is on " - "another desktop and no relatives are focused "); - } - } + activate = client_can_steal_focus(self, map_time, launch_time); if (!activate) { - ob_debug_type(OB_DEBUG_FOCUS, - "Focus stealing prevention activated for %s at " - "time %u (last user interaction time %u)", - self->title, map_time, event_last_user_time); - /* if the client isn't focused, then hilite it so the user - knows it is there */ - client_hilite(self, TRUE); - /* we may want to raise it even tho we're not activating it */ - if (raise && !client_restore_session_stacking(self)) - stacking_raise(CLIENT_AS_WINDOW(self)); + /* if the client isn't stealing focus, then hilite it so the user + knows it is there, but don't do this if we're restoring from a + session */ + if (!client_restore_session_stacking(self)) + client_hilite(self, TRUE); } } else { @@@ -781,6 -759,105 +676,105 @@@ void client_fake_unmanage(ObClient *sel g_free(self); } + static gboolean client_can_steal_focus(ObClient *self, Time steal_time, + Time launch_time) + { + gboolean steal; + gboolean relative_focused; + gboolean parent_focused; + + steal = TRUE; + + parent_focused = (focus_client != NULL && + client_search_focus_parent(self)); + relative_focused = (focus_client != NULL && + (client_search_focus_tree_full(self) != NULL || + client_search_focus_group_full(self) != NULL)); + + /* This is focus stealing prevention */ + ob_debug_type(OB_DEBUG_FOCUS, + "Want to focus new window 0x%x at time %u " - "launched at %u (last user interaction time %u)\n", ++ "launched at %u (last user interaction time %u)", + self->window, steal_time, launch_time, + event_last_user_time); + + /* if it's on another desktop */ + if (!(self->desktop == screen_desktop || + self->desktop == DESKTOP_ALL) && + /* the timestamp is from before you changed desktops */ + launch_time && screen_desktop_user_time && + !event_time_after(launch_time, screen_desktop_user_time)) + { + steal = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because its on another " + "desktop\n"); + } + /* If something is focused... */ + else if (focus_client) { + /* If the user is working in another window right now, then don't + steal focus */ + if (!parent_focused && + event_last_user_time && launch_time && + event_time_after(event_last_user_time, launch_time) && + event_last_user_time != launch_time && + event_time_after(event_last_user_time, + steal_time - OB_EVENT_USER_TIME_DELAY)) + { + steal = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because the user is " + "working in another window that is not " - "its parent\n"); ++ "its parent"); + } + /* If the new window is a transient (and its relatives aren't + focused) */ + else if (client_has_parent(self) && !relative_focused) { + steal = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because it is a " - "transient, and its relatives aren't focused\n"); ++ "transient, and its relatives aren't focused"); + } + /* Don't steal focus from globally active clients. + I stole this idea from KWin. It seems nice. + */ + else if (!(focus_client->can_focus || + focus_client->focus_notify)) + { + steal = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because a globally " - "active client has focus\n"); ++ "active client has focus"); + } + /* Don't move focus if it's not going to go to this window + anyway */ + else if (client_focus_target(self) != self) { + steal = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because another window " - "would get the focus anyway\n"); ++ "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 || + self->desktop == DESKTOP_ALL) && + !relative_focused) + { + steal = FALSE; + ob_debug_type(OB_DEBUG_FOCUS, + "Not focusing the window because it is on " + "another desktop and no relatives are focused "); + } + } + + if (!steal) + ob_debug_type(OB_DEBUG_FOCUS, + "Focus stealing prevention activated for %s at " - "time %u (last user interaction time %u)\n", ++ "time %u (last user interaction time %u)", + self->title, steal_time, event_last_user_time); + return steal; + } + /*! Returns a new structure containing the per-app settings for this client. The returned structure needs to be freed with g_free. */ static ObAppSettings *client_get_settings_state(ObClient *self) @@@ -3759,9 -3872,8 +3759,7 @@@ gboolean client_focus(ObClient *self go moving on us */ event_halt_focus_delay(); - event_cancel_all_key_grabs(); - - xerror_set_ignore(TRUE); - xerror_occured = FALSE; + obt_display_ignore_errors(TRUE); if (self->can_focus) { /* This can cause a BadMatch error with CurrentTime, or if an app diff --cc openbox/event.c index 38b6bec2,e07d6a31..4ddb7ac7 --- a/openbox/event.c +++ b/openbox/event.c @@@ -1340,38 -1331,38 +1337,38 @@@ static void event_handle_client(ObClien } else ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is " - "missing source indication\n", client->title); + "missing source indication", client->title); - client_activate(client, TRUE, TRUE, TRUE, + client_activate(client, FALSE, TRUE, TRUE, (e->xclient.data.l[0] == 0 || e->xclient.data.l[0] == 2)); - } else if (msgtype == prop_atoms.net_wm_moveresize) { - ob_debug("net_wm_moveresize for 0x%lx direction %d\n", + } else if (msgtype == OBT_PROP_ATOM(NET_WM_MOVERESIZE)) { + ob_debug("net_wm_moveresize for 0x%lx direction %d", client->window, e->xclient.data.l[2]); if ((Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_topleft || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPLEFT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_top || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOP) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_topright || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_TOPRIGHT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_right || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_right || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_RIGHT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_bottomright || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMRIGHT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_bottom || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOM) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_bottomleft || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_BOTTOMLEFT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_left || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_LEFT) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_move || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_size_keyboard || + OBT_PROP_ATOM(NET_WM_MOVERESIZE_SIZE_KEYBOARD) || (Atom)e->xclient.data.l[2] == - prop_atoms.net_wm_moveresize_move_keyboard) { - + OBT_PROP_ATOM(NET_WM_MOVERESIZE_MOVE_KEYBOARD)) + { moveresize_start(client, e->xclient.data.l[0], e->xclient.data.l[1], e->xclient.data.l[3], e->xclient.data.l[2]); diff --cc openbox/focus.c index 2af0da9c,8c3bd70a..fc0fd99b --- a/openbox/focus.c +++ b/openbox/focus.c @@@ -196,10 -193,8 +192,8 @@@ void focus_nothing(void /* nothing is focused, update the colormap and _the root property_ */ focus_set_client(NULL); - event_cancel_all_key_grabs(); - /* when nothing will be focused, send focus to the backup target */ - XSetInputFocus(ob_display, screen_support_win, RevertToPointerRoot, + XSetInputFocus(obt_display, screen_support_win, RevertToPointerRoot, event_curtime); } diff --cc openbox/session.c index d1a3f99b,14018478..758e9887 --- a/openbox/session.c +++ b/openbox/session.c @@@ -159,8 -156,13 +160,13 @@@ void session_shutdown(gboolean permanen } } + gboolean session_connected(void) + { + return !!sm_conn; + } + /*! Connect to the session manager and set up our callback functions */ -static gboolean session_connect() +static gboolean session_connect(void) { SmcCallbacks cb; gchar *oldid;