diff --git a/src/client.c b/src/client.c
index a97f11d113ad72882486bfb69086a1b92a8abd79..5617a3d34442464f8551f18be0ea4c7fcd9b9473 100644
--- a/src/client.c
+++ b/src/client.c
@@ -1978,7 +1978,8 @@ clientGetTopMostFocusable (int layer, Client * exclude)
         {
             if ((c->win_layer <= layer) && clientAcceptFocus (c)
                 && FLAG_TEST (c->flags, CLIENT_FLAG_VISIBLE)
-                && !(c->type & (WINDOW_DESKTOP | WINDOW_DOCK)))
+                && !(c->type & (WINDOW_DESKTOP | WINDOW_DOCK))
+                && clientSelectMask (c, 0))
             {
                 top = c;
             }
@@ -3819,7 +3820,7 @@ clientPassFocus (Client * c)
     Client *c2;
     Window dr, window;
     int rx, ry, wx, wy;
-    unsigned int i, mask;
+    unsigned int mask;
     int look_in_layer = (c ? c->win_layer : WIN_LAYER_NORMAL);
 
     TRACE ("entering clientPassFocus");