scary commit..but here goes.
[mikachu/openbox.git] / openbox / focus.c
index 6a56c2f..f867ff1 100644 (file)
@@ -1,7 +1,7 @@
 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
 
    focus.c for the Openbox window manager
-   Copyright (c) 2004        Mikael Magnusson
+   Copyright (c) 2006        Mikael Magnusson
    Copyright (c) 2003        Ben Jansens
 
    This program is free software; you can redistribute it and/or modify
@@ -87,25 +87,20 @@ void focus_startup(gboolean reconfig)
         focus_indicator.right.obwin.type = Window_Internal;
         focus_indicator.bottom.obwin.type = Window_Internal;
 
-        attr.save_under = True;
         attr.override_redirect = True;
         attr.background_pixel = BlackPixel(ob_display, ob_screen);
         focus_indicator.top.win =
             createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel | CWSaveUnder,
-                         &attr);
+                         CWOverrideRedirect | CWBackPixel, &attr);
         focus_indicator.left.win =
             createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel | CWSaveUnder,
-                         &attr);
+                         CWOverrideRedirect | CWBackPixel, &attr);
         focus_indicator.right.win =
             createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel | CWSaveUnder,
-                         &attr);
+                         CWOverrideRedirect | CWBackPixel, &attr);
         focus_indicator.bottom.win =
             createWindow(RootWindow(ob_display, ob_screen),
-                         CWOverrideRedirect | CWBackPixel | CWSaveUnder,
-                         &attr);
+                         CWOverrideRedirect | CWBackPixel, &attr);
 
         stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.top));
         stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left));
@@ -144,7 +139,7 @@ void focus_shutdown(gboolean reconfig)
         g_free(focus_order);
 
         /* reset focus to root */
-        XSetInputFocus(ob_display, PointerRoot, RevertToNone, event_lasttime);
+        XSetInputFocus(ob_display, PointerRoot, RevertToNone, CurrentTime);
 
         RrColorFree(color_white);
 
@@ -186,7 +181,7 @@ void focus_set_client(ObClient *client)
 #endif
         /* when nothing will be focused, send focus to the backup target */
         XSetInputFocus(ob_display, screen_support_win, RevertToNone,
-                       event_lasttime);
+                       event_curtime);
         XSync(ob_display, FALSE);
     }
 
@@ -318,6 +313,11 @@ ObClient* focus_fallback_target(ObFocusFallbackType type)
             if (client_normal(it->data) && client_can_focus(it->data))
                 return it->data;
 
+    /* XXX fallback to the "desktop window" if one exists ?
+       could store it while going through all the windows in the loop right
+       above this..
+    */
+
     return NULL;
 }
 
@@ -392,7 +392,7 @@ void focus_cycle_draw_indicator()
 
         wt = wl = wr = wb = MAX(3,
                                 ob_rr_theme->handle_height +
-                                ob_rr_theme->bwidth * 2);
+                                ob_rr_theme->fbwidth * 2);
 
         x = focus_cycle_target->frame->area.x;
         y = focus_cycle_target->frame->area.y;
@@ -603,7 +603,7 @@ void focus_cycle(gboolean forward, gboolean linear, gboolean interactive,
 
 done_cycle:
     if (done && focus_cycle_target)
-        client_activate(focus_cycle_target, FALSE);
+        client_activate(focus_cycle_target, FALSE, TRUE);
 
     t = NULL;
     first = NULL;
@@ -665,7 +665,7 @@ void focus_directional_cycle(ObDirection dir, gboolean interactive,
 
 done_cycle:
     if (done && focus_cycle_target)
-        client_activate(focus_cycle_target, FALSE);
+        client_activate(focus_cycle_target, FALSE, TRUE);
 
     first = NULL;
     focus_cycle_target = NULL;