]> Dogcows Code - chaz/openbox/commitdiff
move the code to find the window under the pointer out of focus.c to client.c
authorDana Jansens <danakj@orodu.net>
Sun, 21 Sep 2003 21:25:23 +0000 (21:25 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 21 Sep 2003 21:25:23 +0000 (21:25 +0000)
openbox/client.c
openbox/client.h
openbox/focus.c

index 3d51a78e622e74212e8e724eeda74851d776cfe6..c4b106beaef6b2232041d08bcb2e005e8587bdb3 100644 (file)
@@ -3017,3 +3017,24 @@ int client_directional_edge_search(ObClient *c, ObDirection dir)
     }
     return dest;
 }
+
+ObClient* client_under_pointer()
+{
+    int x, y;
+    GList *it;
+    ObClient *ret = NULL;
+
+    if (screen_pointer_pos(&x, &y)) {
+        for (it = stacking_list; it != NULL; it = it->next) {
+            if (WINDOW_IS_CLIENT(it->data)) {
+                ObClient *c = WINDOW_AS_CLIENT(it->data);
+                if (c->desktop == screen_desktop &&
+                    RECT_CONTAINS(c->frame->area, x, y)) {
+                    ret = c;
+                    break;
+                }
+            }
+        }
+    }
+    return ret;
+}
index 69b09d5e288e23696239108354e462a29c2a224e..e3769ea44f2f906aca3d175d78485549967f942b 100644 (file)
@@ -519,4 +519,6 @@ guint client_monitor(ObClient *self);
 
 void client_update_sm_client_id(ObClient *self);
 
+ObClient* client_under_pointer();
+
 #endif
index 523c7b5d057cf262181a65f38bffe2f20c71475a..22036917a85a2719fc9de5701db976b8c7599af5 100644 (file)
@@ -119,23 +119,10 @@ void focus_set_client(ObClient *client)
 
 static gboolean focus_under_pointer()
 {
-    int x, y;
-    GList *it;
+    ObClient *c;
 
-    if (screen_pointer_pos(&x, &y)) {
-        for (it = stacking_list; it != NULL; it = it->next) {
-            if (WINDOW_IS_CLIENT(it->data)) {
-                ObClient *c = WINDOW_AS_CLIENT(it->data);
-                if (c->desktop == screen_desktop &&
-                    RECT_CONTAINS(c->frame->area, x, y))
-                    break;
-            }
-        }
-        if (it != NULL) {
-            g_assert(WINDOW_IS_CLIENT(it->data));
-            return client_normal(it->data) && client_focus(it->data);
-        }
-    }
+    if ((c = client_under_pointer()))
+        return client_normal(c) && client_focus(c);
     return FALSE;
 }
 
This page took 0.02893 seconds and 4 git commands to generate.