]> Dogcows Code - chaz/openbox/commitdiff
fix crashing when doing a directional focus with no windows on the desktop
authorDana Jansens <danakj@orodu.net>
Mon, 15 Sep 2003 06:00:00 +0000 (06:00 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 15 Sep 2003 06:00:00 +0000 (06:00 +0000)
openbox/focus.c

index 9c29345f7c484b29ad3a87132d15ea1def95520d..0f80a58bfbd975e5b0734a7f7b64c799fe6ae046 100644 (file)
@@ -280,8 +280,12 @@ void focus_cycle(gboolean forward, gboolean linear,
         goto done_cycle;
     }
 
-    if (!first) first = focus_client;
-    if (!focus_cycle_target) focus_cycle_target = focus_client;
+    if (!focus_order[screen_desktop])
+        goto done_cycle;
+
+    if (!first) first = focus_order[screen_desktop]->data;
+    if (!focus_cycle_target) focus_cycle_target =
+                                 focus_order[screen_desktop]->data;
 
     if (linear) list = client_list;
     else        list = focus_order[screen_desktop];
@@ -352,8 +356,12 @@ void focus_directional_cycle(ObDirection dir,
         goto done_cycle;
     }
 
-    if (!first) first = focus_client;
-    if (!focus_cycle_target) focus_cycle_target = focus_client;
+    if (!focus_order[screen_desktop])
+        goto done_cycle;
+
+    if (!first) first = focus_order[screen_desktop]->data;
+    if (!focus_cycle_target) focus_cycle_target =
+                                 focus_order[screen_desktop]->data;
 
     if ((ft = client_find_directional(focus_cycle_target, dir))) {
         if (ft != focus_cycle_target) {/* prevents flicker */
This page took 0.024657 seconds and 4 git commands to generate.