]> Dogcows Code - chaz/openbox/blobdiff - openbox/screen.c
gracefully handle grabs failing when doing interactive actions
[chaz/openbox] / openbox / screen.c
index 8a9475adf57d87592bcf029076d788f090688c29..05c292a2bb9f3098177d27e30d2444008b68c97a 100644 (file)
@@ -74,6 +74,8 @@ static gboolean replace_wm()
     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",
@@ -438,16 +440,16 @@ void screen_set_desktop(guint num)
     /* 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))
@@ -457,7 +459,18 @@ void screen_set_desktop(guint num)
 
     event_ignore_queued_enters();
 
-    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)
@@ -572,7 +585,7 @@ void screen_desktop_popup(guint d, gboolean show)
 {
     Rect *a;
 
-    if (!show || !config_dialog_desktop) {
+    if (!show) {
         pager_popup_hide(desktop_cycle_popup);
     } else {
         a = screen_physical_area_monitor(0);
@@ -860,10 +873,10 @@ void screen_install_colormap(ObClient *client, gboolean install)
     XWindowAttributes wa;
 
     if (client == NULL) {
-       if (install)
-           XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
-       else
-           XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
+        if (install)
+            XInstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
+        else
+            XUninstallColormap(RrDisplay(ob_rr_inst), RrColormap(ob_rr_inst));
     } else {
         if (XGetWindowAttributes(ob_display, client->window, &wa) &&
             wa.colormap != None) {
This page took 0.025719 seconds and 4 git commands to generate.