X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus.c;h=22036917a85a2719fc9de5701db976b8c7599af5;hb=2612dbf0504c9e35171248b44a2b58b63a80b624;hp=36ccbea30281fe820bab29e3b26282511249fcbd;hpb=16f46c296d1fcd3f27fc62a18e71c55fb3fd3e88;p=chaz%2Fopenbox diff --git a/openbox/focus.c b/openbox/focus.c index 36ccbea3..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; } @@ -398,11 +385,14 @@ void focus_directional_cycle(ObDirection dir, focus_cycle_target = ft; frame_adjust_focus(focus_cycle_target->frame, TRUE); } - popup_cycle(ft, dialog); + } + if (focus_cycle_target) { + popup_cycle(focus_cycle_target, dialog); if (dialog) return; } + done_cycle: if (done && focus_cycle_target) client_activate(focus_cycle_target, FALSE);