all repos — openbox @ 6538a5ccb2199d518b854baa6d790387b448484e

openbox fork - make it a bit more like ryudo

move the code to find the window under the pointer out of focus.c to client.c
Dana Jansens danakj@orodu.net
commit

6538a5ccb2199d518b854baa6d790387b448484e

parent

6675b28dede3e0581a1b1bfb73fb0dd3b5dd1863

3 files changed, 26 insertions(+), 16 deletions(-)

jump to
M openbox/client.copenbox/client.c

@@ -3017,3 +3017,24 @@ g_assert_not_reached();

} 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; +}
M openbox/client.hopenbox/client.h

@@ -519,4 +519,6 @@ guint client_monitor(ObClient *self);

void client_update_sm_client_id(ObClient *self); +ObClient* client_under_pointer(); + #endif
M openbox/focus.copenbox/focus.c

@@ -119,23 +119,10 @@ }

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; }