g_free(wm_sn);
current_wm_sn_owner = XGetSelectionOwner(ob_display, wm_sn_atom);
+ if (current_wm_sn_owner == screen_support_win)
+ current_wm_sn_owner = None;
if (current_wm_sn_owner) {
if (!ob_replace_wm) {
g_warning("A window manager is already running on screen %d",
/* show windows before hiding the rest to lessen the enter/leave events */
/* show windows from top to bottom */
- for (it = stacking_list; it != NULL; it = it->next) {
+ for (it = stacking_list; it; it = g_list_next(it)) {
if (WINDOW_IS_CLIENT(it->data)) {
ObClient *c = it->data;
- if (!c->frame->visible && client_should_show(c))
+ if (client_should_show(c))
frame_show(c->frame);
}
}
/* hide windows from bottom to top */
- for (it = g_list_last(stacking_list); it != NULL; it = it->prev) {
+ for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) {
if (WINDOW_IS_CLIENT(it->data)) {
ObClient *c = it->data;
if (c->frame->visible && !client_should_show(c))
event_ignore_queued_enters();
- /*!
- When this focus_client check is not used, you can end up with races, as
- demonstrated with gnome-panel, sometmies the window you click on on
- another desktop ends up losing focus cuz of the fallback.
- */
- if (!focus_client)
- focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);
+ focus_hilite = focus_fallback_target(OB_FOCUS_FALLBACK_NOFOCUS);
+ if (focus_hilite) {
+ frame_adjust_focus(focus_hilite->frame, TRUE);
+
+ /*!
+ When this focus_client check is not used, you can end up with races,
+ as demonstrated with gnome-panel, sometmies the window you click on
+ another desktop ends up losing focus cuz of the focus change here.
+ */
+ /*if (!focus_client)*/
+ client_focus(focus_hilite);
+ }
}
static void get_row_col(guint d, guint *r, guint *c)
case OB_DIRECTION_EAST:
++c;
if (c >= screen_desktop_layout.columns) {
- if (!wrap) return d = screen_desktop;
- c = 0;
+ if (wrap) {
+ c = 0;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
d = translate_row_col(r, c);
if (d >= screen_num_desktops) {
- if (!wrap) return d = screen_desktop;
- ++c;
+ if (wrap) {
+ ++c;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
break;
case OB_DIRECTION_WEST:
--c;
if (c >= screen_desktop_layout.columns) {
- if (!wrap) return d = screen_desktop;
- c = screen_desktop_layout.columns - 1;
+ if (wrap) {
+ c = screen_desktop_layout.columns - 1;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
d = translate_row_col(r, c);
if (d >= screen_num_desktops) {
- if (!wrap) return d = screen_desktop;
- --c;
+ if (wrap) {
+ --c;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
break;
case OB_DIRECTION_SOUTH:
++r;
if (r >= screen_desktop_layout.rows) {
- if (!wrap) return d = screen_desktop;
- r = 0;
+ if (wrap) {
+ r = 0;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
d = translate_row_col(r, c);
if (d >= screen_num_desktops) {
- if (!wrap) return d = screen_desktop;
- ++r;
+ if (wrap) {
+ ++r;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
break;
case OB_DIRECTION_NORTH:
--r;
if (r >= screen_desktop_layout.rows) {
- if (!wrap) return d = screen_desktop;
- r = screen_desktop_layout.rows - 1;
+ if (wrap) {
+ r = screen_desktop_layout.rows - 1;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
d = translate_row_col(r, c);
if (d >= screen_num_desktops) {
- if (!wrap) return d = screen_desktop;
- --r;
+ if (wrap) {
+ --r;
+ } else {
+ d = screen_desktop;
+ goto show_cycle_dialog;
+ }
}
break;
default:
d = translate_row_col(r, c);
}
+show_cycle_dialog:
if (dialog) {
screen_desktop_popup(d, TRUE);
return d;