diff options
| author | Dana Jansens <danakj@orodu.net> | 2003-09-21 21:25:23 +0000 |
|---|---|---|
| committer | Dana Jansens <danakj@orodu.net> | 2003-09-21 21:25:23 +0000 |
| commit | 6538a5ccb2199d518b854baa6d790387b448484e (patch) | |
| tree | 8cd8a4bf416122a5692b3f276536a2fe44564a9b | |
| parent | 6675b28dede3e0581a1b1bfb73fb0dd3b5dd1863 (diff) | |
move the code to find the window under the pointer out of focus.c to client.c
| -rw-r--r-- | openbox/client.c | 21 | ||||
| -rw-r--r-- | openbox/client.h | 2 | ||||
| -rw-r--r-- | openbox/focus.c | 19 |
3 files changed, 26 insertions, 16 deletions
diff --git a/openbox/client.c b/openbox/client.c index 3d51a78e..c4b106be 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -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; +} diff --git a/openbox/client.h b/openbox/client.h index 69b09d5e..e3769ea4 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -519,4 +519,6 @@ guint client_monitor(ObClient *self); void client_update_sm_client_id(ObClient *self); +ObClient* client_under_pointer(); + #endif diff --git a/openbox/focus.c b/openbox/focus.c index 523c7b5d..22036917 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -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; } |
