X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=c4b106beaef6b2232041d08bcb2e005e8587bdb3;hb=d9e08487dffd010f4434d24b98a3a571b2e5a600;hp=e63f78678018361bd346a493d32cfd9408fc1be7;hpb=19e48200739dc95f9b0079a25849e7e06c99302c;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index e63f7867..c4b106be 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -2594,11 +2594,12 @@ gboolean client_focus(ObClient *self) void client_unfocus(ObClient *self) { - g_assert(focus_client == self); + if (focus_client == self) { #ifdef DEBUG_FOCUS - ob_debug("client_unfocus for %lx\n", self->window); + ob_debug("client_unfocus for %lx\n", self->window); #endif - focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); + focus_fallback(OB_FOCUS_FALLBACK_UNFOCUSING); + } } void client_activate(ObClient *self, gboolean here) @@ -3016,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; +}