X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus.c;h=de98d63bacea38b3667f9e2177dd8e6d8ebab500;hb=754391ea4d3db7564a39d561d9b50191a56ed751;hp=2ee2cf2f6037cb8f48f7ab30713c0faf7356f5c2;hpb=d5eacc5642ad8f5611f7c946d734863bc8898513;p=chaz%2Fopenbox diff --git a/openbox/focus.c b/openbox/focus.c index 2ee2cf2f..de98d63b 100644 --- a/openbox/focus.c +++ b/openbox/focus.c @@ -1,5 +1,6 @@ #include "event.h" #include "openbox.h" +#include "grab.h" #include "framerender.h" #include "client.h" #include "config.h" @@ -9,7 +10,6 @@ #include "prop.h" #include "dispatch.h" #include "focus.h" -#include "parse.h" #include "stacking.h" #include "popup.h" @@ -40,8 +40,7 @@ void focus_startup() -100, -100, 1, 1, 0, CopyFromParent, InputOutput, CopyFromParent, CWOverrideRedirect, &attrib); - XMapWindow(ob_display, focus_backup); - stacking_raise_internal(focus_backup); + XMapRaised(ob_display, focus_backup); /* start with nothing focused */ focus_set_client(NULL); @@ -81,6 +80,10 @@ void focus_set_client(Client *client) Window active; Client *old; +#ifdef DEBUG_FOCUS + g_message("focus_set_client 0x%lx", client ? client->window : 0); +#endif + /* uninstall the old colormap, and install the new one */ screen_install_colormap(focus_client, FALSE); screen_install_colormap(client, TRUE); @@ -122,13 +125,17 @@ static gboolean focus_under_pointer() if (ob_pointer_pos(&x, &y)) { for (it = stacking_list; it != NULL; it = it->next) { - Client *c = it->data; - if (c->desktop == screen_desktop && - RECT_CONTAINS(c->frame->area, x, y)) - break; + if (WINDOW_IS_CLIENT(it->data)) { + Client *c = WINDOW_AS_CLIENT(it->data); + if (c->desktop == screen_desktop && + RECT_CONTAINS(c->frame->area, x, y)) + break; + } } - if (it != NULL) + if (it != NULL) { + g_assert(WINDOW_IS_CLIENT(it->data)); return client_normal(it->data) && client_focus(it->data); + } } return FALSE; } @@ -215,7 +222,8 @@ void focus_fallback(FallbackType type) if (type != Fallback_Unfocusing || it->data != old) if (client_normal(it->data) && /* dont fall back to 'anonymous' fullscreen windows. theres no - checks for this is in transient/group fallbacks. */ + checks for this is in transient/group fallbacks, so they can + be fallback targets there. */ !((Client*)it->data)->fullscreen && client_focus(it->data)) return; @@ -261,7 +269,6 @@ Client *focus_cycle(gboolean forward, gboolean linear, gboolean done, Client *ft; if (cancel) { - /*if (first) client_focus(first); XXX*/ if (focus_cycle_target) frame_adjust_focus(focus_cycle_target->frame, FALSE); if (focus_client) @@ -272,6 +279,9 @@ Client *focus_cycle(gboolean forward, gboolean linear, gboolean done, client_activate(focus_cycle_target); goto done_cycle; } + if (!first) + grab_pointer(TRUE, None); + if (!first) first = focus_client; if (!focus_cycle_target) focus_cycle_target = focus_client; @@ -313,7 +323,10 @@ done_cycle: focus_cycle_target = NULL; g_list_free(order); order = NULL; + popup_cycle(ft, FALSE); + grab_pointer(FALSE, None); + return NULL; }