X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=openbox%2Ffocus_cycle_indicator.c;h=7c5d5290539cb46c38d1bd95760e0ad59d3c7671;hb=e5f21a4a87509da1d807350e01d2052e16a47152;hp=790713145d09a540e5c4f9a94b40e2593f06dd25;hpb=77baf26a7f2f64ddf1274035fd4991ab17345904;p=chaz%2Fopenbox diff --git a/openbox/focus_cycle_indicator.c b/openbox/focus_cycle_indicator.c index 79071314..7c5d5290 100644 --- a/openbox/focus_cycle_indicator.c +++ b/openbox/focus_cycle_indicator.c @@ -18,6 +18,7 @@ */ #include "focus_cycle.h" +#include "focus_cycle_indicator.h" #include "client.h" #include "openbox.h" #include "frame.h" @@ -29,7 +30,7 @@ #define FOCUS_INDICATOR_WIDTH 6 -struct +static struct { InternalWindow top; InternalWindow left; @@ -39,6 +40,7 @@ struct static RrAppearance *a_focus_indicator; static RrColor *color_white; +static gboolean visible; static Window create_window(Window parent, gulong mask, XSetWindowAttributes *attrib) @@ -53,6 +55,8 @@ void focus_cycle_indicator_startup(gboolean reconfig) { XSetWindowAttributes attr; + visible = FALSE; + if (reconfig) return; focus_indicator.top.obwin.type = Window_Internal; @@ -79,6 +83,14 @@ void focus_cycle_indicator_startup(gboolean reconfig) stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.left)); stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.right)); stacking_add(INTERNAL_AS_WINDOW(&focus_indicator.bottom)); + g_hash_table_insert(window_map, &focus_indicator.top.win, + &focus_indicator.top); + g_hash_table_insert(window_map, &focus_indicator.left.win, + &focus_indicator.left); + g_hash_table_insert(window_map, &focus_indicator.right.win, + &focus_indicator.right); + g_hash_table_insert(window_map, &focus_indicator.bottom.win, + &focus_indicator.bottom); color_white = RrColorNew(ob_rr_inst, 0xff, 0xff, 0xff); @@ -105,6 +117,11 @@ void focus_cycle_indicator_shutdown(gboolean reconfig) RrAppearanceFree(a_focus_indicator); + g_hash_table_remove(window_map, &focus_indicator.top.win); + g_hash_table_remove(window_map, &focus_indicator.left.win); + g_hash_table_remove(window_map, &focus_indicator.right.win); + g_hash_table_remove(window_map, &focus_indicator.bottom.win); + stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.top)); stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.left)); stacking_remove(INTERNAL_AS_WINDOW(&focus_indicator.right)); @@ -118,7 +135,7 @@ void focus_cycle_indicator_shutdown(gboolean reconfig) void focus_cycle_draw_indicator(ObClient *c) { - if (!c) { + if (!c && visible) { gulong ignore_start; /* kill enter events cause by this unmapping */ @@ -130,7 +147,10 @@ void focus_cycle_draw_indicator(ObClient *c) XUnmapWindow(ob_display, focus_indicator.bottom.win); event_end_ignore_all_enters(ignore_start); - } else { + + visible = FALSE; + } + else if (c) { /* if (c) frame_adjust_focus(c->frame, FALSE); @@ -138,6 +158,7 @@ void focus_cycle_draw_indicator(ObClient *c) */ gint x, y, w, h; gint wt, wl, wr, wb; + gulong ignore_start; wt = wl = wr = wb = FOCUS_INDICATOR_WIDTH; @@ -146,6 +167,9 @@ void focus_cycle_draw_indicator(ObClient *c) w = c->frame->area.width; h = wt; + /* kill enter events cause by this moving */ + ignore_start = event_start_ignore_all_enters(); + XMoveResizeWindow(ob_display, focus_indicator.top.win, x, y, w, h); a_focus_indicator->texture[0].data.lineart.x1 = 0; @@ -249,5 +273,9 @@ void focus_cycle_draw_indicator(ObClient *c) XMapWindow(ob_display, focus_indicator.left.win); XMapWindow(ob_display, focus_indicator.right.win); XMapWindow(ob_display, focus_indicator.bottom.win); + + event_end_ignore_all_enters(ignore_start); + + visible = TRUE; } }