diff --git a/src/stacking.c b/src/stacking.c
index df8f584c0a8ffba0d1318a5480b89147402eaf2a..4d841e604e785e3a3deeb195fa02e1fb477146e9 100644
--- a/src/stacking.c
+++ b/src/stacking.c
@@ -245,14 +245,15 @@ clientAtPosition (ScreenInfo *screen_info, int x, int y, Client * exclude)
     for (index = g_list_last (screen_info->windows_stack); index; index = g_list_previous (index))
     {
         c2 = (Client *) index->data;
-        if (clientSelectMask (c2, 0, WINDOW_NORMAL | WINDOW_DIALOG | WINDOW_MODAL_DIALOG) && (c2 != exclude))
+        if ((frameX (c2) < x) && (frameX (c2) + frameWidth (c2) > x)
+            && (frameY (c2) < y) && (frameY (c2) + frameHeight (c2) > y))
         {
-            if ((frameX (c2) < x) && (frameX (c2) + frameWidth (c2) > x)
-                && (frameY (c2) < y) && (frameY (c2) + frameHeight (c2) > y))
+            if (clientSelectMask (c2, 0, WINDOW_REGULAR_FOCUSABLE) 
+                && (c2 != exclude))
             {
                 c = c2;
-                break;
             }
+            break;
         }
     }