+ if (!showtext) showtext = popup_get_name(c, &showtarget);
+ icon_popup_show(focus_cycle_popup, showtext,
+ client_icon(showtarget, 48, 48));
+ g_free(showtext);
+}
+
+static void focus_cycle_destructor(ObClient *client, gpointer data)
+{
+ /* end cycling if the target disappears. CurrentTime is fine, time won't
+ be used
+ */
+ if (focus_cycle_target == client)
+ focus_cycle(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE);
+}
+
+void focus_cycle_draw_indicator()
+{
+ if (!focus_cycle_target) {
+ XUnmapWindow(ob_display, focus_indicator.top.win);
+ XUnmapWindow(ob_display, focus_indicator.left.win);
+ XUnmapWindow(ob_display, focus_indicator.right.win);
+ XUnmapWindow(ob_display, focus_indicator.bottom.win);
+
+ /* kill enter events cause by this unmapping */
+ event_ignore_queued_enters();
+ } else {
+ /*
+ if (focus_cycle_target)
+ frame_adjust_focus(focus_cycle_target->frame, FALSE);
+ frame_adjust_focus(focus_cycle_target->frame, TRUE);
+ */
+ gint x, y, w, h;
+ gint wt, wl, wr, wb;
+
+ wt = wl = wr = wb = FOCUS_INDICATOR_WIDTH;
+
+ x = focus_cycle_target->frame->area.x;
+ y = focus_cycle_target->frame->area.y;
+ w = focus_cycle_target->frame->area.width;
+ h = wt;
+
+ XMoveResizeWindow(ob_display, focus_indicator.top.win,
+ x, y, w, h);
+ a_focus_indicator->texture[0].data.lineart.x1 = 0;
+ a_focus_indicator->texture[0].data.lineart.y1 = h-1;
+ a_focus_indicator->texture[0].data.lineart.x2 = 0;
+ a_focus_indicator->texture[0].data.lineart.y2 = 0;
+ a_focus_indicator->texture[1].data.lineart.x1 = 0;
+ a_focus_indicator->texture[1].data.lineart.y1 = 0;
+ a_focus_indicator->texture[1].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[1].data.lineart.y2 = 0;
+ a_focus_indicator->texture[2].data.lineart.x1 = w-1;
+ a_focus_indicator->texture[2].data.lineart.y1 = 0;
+ a_focus_indicator->texture[2].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[2].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[3].data.lineart.x1 = (wl-1);
+ a_focus_indicator->texture[3].data.lineart.y1 = h-1;
+ a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
+ a_focus_indicator->texture[3].data.lineart.y2 = h-1;
+ RrPaint(a_focus_indicator, focus_indicator.top.win,
+ w, h);
+
+ x = focus_cycle_target->frame->area.x;
+ y = focus_cycle_target->frame->area.y;
+ w = wl;
+ h = focus_cycle_target->frame->area.height;
+
+ XMoveResizeWindow(ob_display, focus_indicator.left.win,
+ x, y, w, h);
+ a_focus_indicator->texture[0].data.lineart.x1 = w-1;
+ a_focus_indicator->texture[0].data.lineart.y1 = 0;
+ a_focus_indicator->texture[0].data.lineart.x2 = 0;
+ a_focus_indicator->texture[0].data.lineart.y2 = 0;
+ a_focus_indicator->texture[1].data.lineart.x1 = 0;
+ a_focus_indicator->texture[1].data.lineart.y1 = 0;
+ a_focus_indicator->texture[1].data.lineart.x2 = 0;
+ a_focus_indicator->texture[1].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[2].data.lineart.x1 = 0;
+ a_focus_indicator->texture[2].data.lineart.y1 = h-1;
+ a_focus_indicator->texture[2].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[2].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[3].data.lineart.x1 = w-1;
+ a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
+ a_focus_indicator->texture[3].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
+ RrPaint(a_focus_indicator, focus_indicator.left.win,
+ w, h);
+
+ x = focus_cycle_target->frame->area.x +
+ focus_cycle_target->frame->area.width - wr;
+ y = focus_cycle_target->frame->area.y;
+ w = wr;
+ h = focus_cycle_target->frame->area.height ;
+
+ XMoveResizeWindow(ob_display, focus_indicator.right.win,
+ x, y, w, h);
+ a_focus_indicator->texture[0].data.lineart.x1 = 0;
+ a_focus_indicator->texture[0].data.lineart.y1 = 0;
+ a_focus_indicator->texture[0].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[0].data.lineart.y2 = 0;
+ a_focus_indicator->texture[1].data.lineart.x1 = w-1;
+ a_focus_indicator->texture[1].data.lineart.y1 = 0;
+ a_focus_indicator->texture[1].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[1].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[2].data.lineart.x1 = w-1;
+ a_focus_indicator->texture[2].data.lineart.y1 = h-1;
+ a_focus_indicator->texture[2].data.lineart.x2 = 0;
+ a_focus_indicator->texture[2].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[3].data.lineart.x1 = 0;
+ a_focus_indicator->texture[3].data.lineart.y1 = wt-1;
+ a_focus_indicator->texture[3].data.lineart.x2 = 0;
+ a_focus_indicator->texture[3].data.lineart.y2 = h - wb;
+ RrPaint(a_focus_indicator, focus_indicator.right.win,
+ w, h);
+
+ x = focus_cycle_target->frame->area.x;
+ y = focus_cycle_target->frame->area.y +
+ focus_cycle_target->frame->area.height - wb;
+ w = focus_cycle_target->frame->area.width;
+ h = wb;
+
+ XMoveResizeWindow(ob_display, focus_indicator.bottom.win,
+ x, y, w, h);
+ a_focus_indicator->texture[0].data.lineart.x1 = 0;
+ a_focus_indicator->texture[0].data.lineart.y1 = 0;
+ a_focus_indicator->texture[0].data.lineart.x2 = 0;
+ a_focus_indicator->texture[0].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[1].data.lineart.x1 = 0;
+ a_focus_indicator->texture[1].data.lineart.y1 = h-1;
+ a_focus_indicator->texture[1].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[1].data.lineart.y2 = h-1;
+ a_focus_indicator->texture[2].data.lineart.x1 = w-1;
+ a_focus_indicator->texture[2].data.lineart.y1 = h-1;
+ a_focus_indicator->texture[2].data.lineart.x2 = w-1;
+ a_focus_indicator->texture[2].data.lineart.y2 = 0;
+ a_focus_indicator->texture[3].data.lineart.x1 = wl-1;
+ a_focus_indicator->texture[3].data.lineart.y1 = 0;
+ a_focus_indicator->texture[3].data.lineart.x2 = w - wr;
+ a_focus_indicator->texture[3].data.lineart.y2 = 0;
+ RrPaint(a_focus_indicator, focus_indicator.bottom.win,
+ w, h);
+
+ XMapWindow(ob_display, focus_indicator.top.win);
+ XMapWindow(ob_display, focus_indicator.left.win);
+ XMapWindow(ob_display, focus_indicator.right.win);
+ XMapWindow(ob_display, focus_indicator.bottom.win);