make sure the alttab list-mode has at least 1 row
[dana/openbox.git] / openbox / focus_cycle_popup.c
1 /* -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*-
2
3    focus_cycle_popup.c for the Openbox window manager
4    Copyright (c) 2006        Mikael Magnusson
5    Copyright (c) 2003-2007   Dana Jansens
6
7    This program is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License as published by
9    the Free Software Foundation; either version 2 of the License, or
10    (at your option) any later version.
11
12    This program is distributed in the hope that it will be useful,
13    but WITHOUT ANY WARRANTY; without even the implied warranty of
14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15    GNU General Public License for more details.
16
17    See the COPYING file for a copy of the GNU General Public License.
18 */
19
20 #include "focus_cycle_popup.h"
21 #include "popup.h"
22 #include "client.h"
23 #include "screen.h"
24 #include "focus.h"
25 #include "openbox.h"
26 #include "window.h"
27 #include "event.h"
28 #include "render/render.h"
29
30 #include <X11/Xlib.h>
31 #include <glib.h>
32
33 /* Size of the hilite box around a window's icon */
34 #define HILITE_SIZE 40
35 /* Width of the outer ring around the hilite box */
36 #define HILITE_WIDTH 2
37 /* Space between the outer ring around the hilite box and the icon inside it */
38 #define HILITE_MARGIN 1
39 /* Total distance from the edge of the hilite box to the icon inside it */
40 #define HILITE_OFFSET (HILITE_WIDTH + HILITE_MARGIN)
41 /* Size of the icons, which can appear inside or outside of a hilite box */
42 #define ICON_SIZE (HILITE_SIZE - 2*HILITE_OFFSET)
43 /* Margin area around the outside of the dialog */
44 #define OUTSIDE_BORDER 3
45 /* Margin area around the text */
46 #define TEXT_BORDER 2
47 /* Scroll the list-mode list when the cursor gets within this many rows of the
48    top or bottom */
49 #define SCROLL_MARGIN 4
50
51 typedef struct _ObFocusCyclePopup       ObFocusCyclePopup;
52 typedef struct _ObFocusCyclePopupTarget ObFocusCyclePopupTarget;
53
54 struct _ObFocusCyclePopupTarget
55 {
56     ObClient *client;
57     gchar *text;
58     Window iconwin;
59     /* This is used when the popup is in list mode */
60     Window textwin;
61 };
62
63 struct _ObFocusCyclePopup
64 {
65     ObWindow obwin;
66     Window bg;
67
68     /* This is used when the popup is in icon mode */
69     Window icon_mode_text;
70
71     GList *targets;
72     gint n_targets;
73
74     const ObFocusCyclePopupTarget *last_target;
75
76     gint maxtextw;
77
78     /* How are the list is scrolled, in scroll mode */
79     gint scroll;
80
81     RrAppearance *a_bg;
82     RrAppearance *a_text;
83     RrAppearance *a_hilite_text;
84     RrAppearance *a_icon;
85
86     gboolean mapped;
87     ObFocusCyclePopupMode mode;
88 };
89
90 /*! This popup shows all possible windows */
91 static ObFocusCyclePopup popup;
92 /*! This popup shows a single window */
93 static ObIconPopup *single_popup;
94
95 static gchar *popup_get_name (ObClient *c);
96 static void   popup_setup    (ObFocusCyclePopup *p,
97                               gboolean create_targets,
98                               gboolean iconic_windows,
99                               gboolean all_desktops,
100                               gboolean dock_windows,
101                               gboolean desktop_windows);
102 static void   popup_render   (ObFocusCyclePopup *p,
103                               const ObClient *c);
104
105 static Window create_window(Window parent, guint bwidth, gulong mask,
106                             XSetWindowAttributes *attr)
107 {
108     return XCreateWindow(obt_display, parent, 0, 0, 1, 1, bwidth,
109                          RrDepth(ob_rr_inst), InputOutput,
110                          RrVisual(ob_rr_inst), mask, attr);
111 }
112
113 void focus_cycle_popup_startup(gboolean reconfig)
114 {
115     XSetWindowAttributes attrib;
116     RrPixel32 *p;
117
118     single_popup = icon_popup_new();
119
120     popup.obwin.type = OB_WINDOW_CLASS_INTERNAL;
121     popup.a_bg = RrAppearanceCopy(ob_rr_theme->osd_hilite_bg);
122     popup.a_hilite_text = RrAppearanceCopy(ob_rr_theme->osd_hilite_label);
123     popup.a_text = RrAppearanceCopy(ob_rr_theme->a_unfocused_label);
124     popup.a_icon = RrAppearanceCopy(ob_rr_theme->a_clear);
125
126     popup.a_hilite_text->surface.parent = popup.a_bg;
127     popup.a_text->surface.parent = popup.a_bg;
128     popup.a_icon->surface.parent = popup.a_bg;
129
130     popup.a_text->texture[0].data.text.justify = RR_JUSTIFY_LEFT;
131     popup.a_hilite_text->texture[0].data.text.justify = RR_JUSTIFY_LEFT;
132
133     /* 2 textures. texture[0] is the icon.  texture[1] is the hilight, and
134        may or may not be used */
135     RrAppearanceAddTextures(popup.a_icon, 2);
136
137     popup.a_icon->texture[0].type = RR_TEXTURE_RGBA;
138
139     attrib.override_redirect = True;
140     attrib.border_pixel=RrColorPixel(ob_rr_theme->osd_border_color);
141     popup.bg = create_window(obt_root(ob_screen), ob_rr_theme->obwidth,
142                              CWOverrideRedirect | CWBorderPixel, &attrib);
143
144     /* create the text window used for the icon-mode popup */
145     popup.icon_mode_text = create_window(popup.bg, 0, 0, NULL);
146
147     popup.targets = NULL;
148     popup.n_targets = 0;
149     popup.last_target = NULL;
150
151     /* set up the hilite texture for the icon */
152     popup.a_icon->texture[1].data.rgba.width = HILITE_SIZE;
153     popup.a_icon->texture[1].data.rgba.height = HILITE_SIZE;
154     popup.a_icon->texture[1].data.rgba.alpha = 0xff;
155     p = g_new(RrPixel32, HILITE_SIZE * HILITE_SIZE);
156     popup.a_icon->texture[1].data.rgba.data = p;
157
158     /* create the hilite under the target icon */
159     {
160         RrPixel32 color;
161         gint x, y, o;
162
163         color = ((ob_rr_theme->osd_color->r & 0xff) << RrDefaultRedOffset) +
164             ((ob_rr_theme->osd_color->g & 0xff) << RrDefaultGreenOffset) +
165             ((ob_rr_theme->osd_color->b & 0xff) << RrDefaultBlueOffset);
166
167         o = 0;
168         for (x = 0; x < HILITE_SIZE; x++)
169             for (y = 0; y < HILITE_SIZE; y++) {
170                 guchar a;
171
172                 if (x < HILITE_WIDTH ||
173                     x >= HILITE_SIZE - HILITE_WIDTH ||
174                     y < HILITE_WIDTH ||
175                     y >= HILITE_SIZE - HILITE_WIDTH)
176                 {
177                     /* the border of the target */
178                     a = 0x88;
179                 }
180                 else {
181                     /* the background of the target */
182                     a = 0x22;
183                 }
184
185                 p[o++] = color + (a << RrDefaultAlphaOffset);
186             }
187     }
188
189     stacking_add(INTERNAL_AS_WINDOW(&popup));
190     window_add(&popup.bg, INTERNAL_AS_WINDOW(&popup));
191 }
192
193 void focus_cycle_popup_shutdown(gboolean reconfig)
194 {
195     icon_popup_free(single_popup);
196
197     window_remove(popup.bg);
198     stacking_remove(INTERNAL_AS_WINDOW(&popup));
199
200     while(popup.targets) {
201         ObFocusCyclePopupTarget *t = popup.targets->data;
202
203         g_free(t->text);
204         XDestroyWindow(obt_display, t->iconwin);
205         XDestroyWindow(obt_display, t->textwin);
206
207         popup.targets = g_list_delete_link(popup.targets, popup.targets);
208     }
209
210     g_free(popup.a_icon->texture[1].data.rgba.data);
211     popup.a_icon->texture[1].data.rgba.data = NULL;
212
213     XDestroyWindow(obt_display, popup.icon_mode_text);
214     XDestroyWindow(obt_display, popup.bg);
215
216     RrAppearanceFree(popup.a_icon);
217     RrAppearanceFree(popup.a_hilite_text);
218     RrAppearanceFree(popup.a_text);
219     RrAppearanceFree(popup.a_bg);
220 }
221
222 static void popup_setup(ObFocusCyclePopup *p, gboolean create_targets,
223                         gboolean iconic_windows, gboolean all_desktops,
224                         gboolean dock_windows, gboolean desktop_windows)
225 {
226     gint maxwidth, n;
227     GList *it;
228
229     g_assert(p->targets == NULL);
230     g_assert(p->n_targets == 0);
231
232     /* make its width to be the width of all the possible titles */
233
234     /* build a list of all the valid focus targets and measure their strings,
235        and count them */
236     maxwidth = 0;
237     n = 0;
238     for (it = g_list_last(focus_order); it; it = g_list_previous(it)) {
239         ObClient *ft = it->data;
240
241         if (focus_valid_target(ft, TRUE,
242                                iconic_windows,
243                                all_desktops,
244                                dock_windows,
245                                desktop_windows))
246         {
247             gchar *text = popup_get_name(ft);
248
249             /* measure */
250             p->a_text->texture[0].data.text.string = text;
251             maxwidth = MAX(maxwidth, RrMinWidth(p->a_text));
252
253             if (!create_targets)
254                 g_free(text);
255             else {
256                 ObFocusCyclePopupTarget *t = g_new(ObFocusCyclePopupTarget, 1);
257
258                 t->client = ft;
259                 t->text = text;
260                 t->iconwin = create_window(p->bg, 0, 0, NULL);
261                 t->textwin = create_window(p->bg, 0, 0, NULL);
262
263                 p->targets = g_list_prepend(p->targets, t);
264                 ++n;
265             }
266         }
267     }
268
269     p->n_targets = n;
270     p->maxtextw = maxwidth;
271 }
272
273 static gchar *popup_get_name(ObClient *c)
274 {
275     ObClient *p;
276     gchar *title;
277     const gchar *desk = NULL;
278     gchar *ret;
279
280     /* find our highest direct parent */
281     p = client_search_top_direct_parent(c);
282
283     if (c->desktop != DESKTOP_ALL && c->desktop != screen_desktop)
284         desk = screen_desktop_names[c->desktop];
285
286     title = c->iconic ? c->icon_title : c->title;
287
288     /* use the transient's parent's title/icon if we don't have one */
289     if (p != c && title[0] == '\0')
290         title = p->iconic ? p->icon_title : p->title;
291
292     if (desk)
293         ret = g_strdup_printf("%s [%s]", title, desk);
294     else
295         ret = g_strdup(title);
296
297     return ret;
298 }
299
300 static void popup_render(ObFocusCyclePopup *p, const ObClient *c)
301 {
302     gint ml, mt, mr, mb;
303     gint l, t, r, b;
304     gint x, y, w, h;
305     Rect *screen_area = NULL;
306     gint rgbax, rgbay, rgbaw, rgbah;
307     gint i;
308     GList *it;
309     const ObFocusCyclePopupTarget *newtarget;
310     gint icons_per_row;
311     gint icon_rows;
312     gint textw, texth;
313     gint selected_pos;
314     gint last_scroll;
315
316     /* vars for icon mode */
317     gint icon_mode_textx;
318     gint icon_mode_texty;
319     gint icons_center_x;
320
321     /* vars for list mode */
322     gint list_mode_icon_column_w = HILITE_SIZE + OUTSIDE_BORDER;
323
324     g_assert(p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ||
325              p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST);
326
327     screen_area = screen_physical_area_active();
328
329     /* get the outside margins */
330     RrMargins(p->a_bg, &ml, &mt, &mr, &mb);
331
332     /* get our outside borders */
333     l = ml + OUTSIDE_BORDER;
334     r = mr + OUTSIDE_BORDER;
335     t = mt + OUTSIDE_BORDER;
336     b = mb + OUTSIDE_BORDER;
337
338     /* get the width from the text and keep it within limits */
339     w = l + r + p->maxtextw;
340     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
341         /* when in list mode, there are icons down the side */
342         w += list_mode_icon_column_w;
343     w = MIN(w, MAX(screen_area->width/3, POPUP_WIDTH)); /* max width */
344     w = MAX(w, POPUP_WIDTH); /* min width */
345
346     /* get the text height */
347     texth = RrMinHeight(p->a_hilite_text);
348     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
349         texth = MAX(MAX(texth, RrMinHeight(p->a_text)), ICON_SIZE);
350     else
351         texth += TEXT_BORDER * 2;
352
353     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS) {
354         /* how many icons will fit in that row? make the width fit that */
355         w -= l + r;
356         icons_per_row = (w + HILITE_SIZE - 1) / HILITE_SIZE;
357         w = icons_per_row * HILITE_SIZE + l + r;
358
359         /* how many rows do we need? */
360         icon_rows = (p->n_targets-1) / icons_per_row + 1;
361
362     }
363     else {
364         /* in list mode, there is one column of icons.. */
365         icons_per_row = 1;
366         /* maximum is 80% of the screen height */
367         icon_rows = MIN(p->n_targets,
368                         (4*screen_area->height/5) /* 80% of the screen */
369                         /
370                         MAX(HILITE_SIZE, texth)); /* height of each row */
371         /* but make sure there is always one */
372         icon_rows = MAX(icon_rows, 1);
373     }
374
375     /* get the text width */
376     textw = w - l - r;
377     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
378         /* leave space on the side for the icons */
379         textw -= list_mode_icon_column_w;
380
381     /* find the height of the dialog */
382     h = t + b + (icon_rows * MAX(HILITE_SIZE, texth));
383     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS)
384         /* in icon mode the text sits below the icons, so make some space */
385         h += OUTSIDE_BORDER + texth;
386
387     /* center the icons if there is less than one row */
388     if (icon_rows == 1)
389         icons_center_x = (w - p->n_targets * HILITE_SIZE) / 2;
390     else
391         icons_center_x = 0;
392
393     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS) {
394         /* get the position of the text */
395         icon_mode_textx = l;
396         icon_mode_texty = h - texth - b;
397     }
398
399     /* find the position for the popup (include the outer borders) */
400     x = screen_area->x + (screen_area->width -
401                           (w + ob_rr_theme->obwidth * 2)) / 2;
402     y = screen_area->y + (screen_area->height -
403                           (h + ob_rr_theme->obwidth * 2)) / 2;
404
405     /* get the dimensions of the target hilite texture */
406     rgbax = ml;
407     rgbay = mt;
408     rgbaw = w - ml - mr;
409     rgbah = h - mt - mb;
410
411     if (!p->mapped) {
412         /* position the background but don't draw it */
413         XMoveResizeWindow(obt_display, p->bg, x, y, w, h);
414
415         if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS) {
416             /* position the text */
417             XMoveResizeWindow(obt_display, p->icon_mode_text,
418                               icon_mode_textx, icon_mode_texty, textw, texth);
419             XMapWindow(obt_display, popup.icon_mode_text);
420         }
421         else
422             XUnmapWindow(obt_display, popup.icon_mode_text);
423
424         /* reset the scrolling when the dialog is first shown */
425         p->scroll = 0;
426     }
427
428     /* find the focused target */
429     newtarget = NULL;
430     for (i = 0, it = p->targets; it; ++i, it = g_list_next(it)) {
431         const ObFocusCyclePopupTarget *target = it->data;
432         if (target->client == c) {
433             /* save the target */
434             newtarget = target;
435             break;
436         }
437     }
438     selected_pos = i;
439
440     /* scroll the list if needed */
441     last_scroll = p->scroll;
442     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST) {
443         const gint top = p->scroll + SCROLL_MARGIN;
444         const gint bottom = p->scroll + icon_rows - SCROLL_MARGIN;
445         const gint min_scroll = 0;
446         const gint max_scroll = p->n_targets - icon_rows;
447
448         if (top - selected_pos >= 0) {
449             p->scroll -= top - selected_pos + 1;
450             p->scroll = MAX(p->scroll, min_scroll);
451         }
452         else if (selected_pos - bottom >= 0) {
453             p->scroll += selected_pos - bottom + 1;
454             p->scroll = MIN(p->scroll, max_scroll);
455         }
456     }
457
458     g_assert(newtarget != NULL);
459
460     /* * * draw everything * * */
461
462     /* draw the background */
463     if (!p->mapped)
464         RrPaint(p->a_bg, p->bg, w, h);
465
466     /* draw the icons and text */
467     for (i = 0, it = p->targets; it; ++i, it = g_list_next(it)) {
468         const ObFocusCyclePopupTarget *target = it->data;
469
470         /* have to redraw the targetted icon and last targetted icon
471          * to update the hilite */
472         if (!p->mapped || newtarget == target || p->last_target == target ||
473             last_scroll != p->scroll)
474         {
475             /* row and column start from 0 */
476             const gint row = i / icons_per_row - p->scroll;
477             const gint col = i % icons_per_row;
478             const ObClientIcon *icon;
479             gint iconx, icony;
480             gint list_mode_textx, list_mode_texty;
481             RrAppearance *text;
482
483             /* find the coordinates for the icon */
484             iconx = icons_center_x + l + (col * HILITE_SIZE);
485             icony = t + (row * MAX(texth, HILITE_SIZE))
486                 + MAX(texth - HILITE_SIZE, 0) / 2;
487
488             /* find the dimensions of the text box */
489             list_mode_textx = iconx + HILITE_SIZE + TEXT_BORDER;
490             list_mode_texty = icony + HILITE_OFFSET;
491
492             /* position the icon */
493             XMoveResizeWindow(obt_display, target->iconwin,
494                               iconx, icony, HILITE_SIZE, HILITE_SIZE);
495
496             /* position the text */
497             if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
498                 XMoveResizeWindow(obt_display, target->textwin,
499                                   list_mode_textx, list_mode_texty,
500                                   textw, texth);
501
502             /* show/hide the right windows */
503             if (row >= 0 && row < icon_rows) {
504                 XMapWindow(obt_display, target->iconwin);
505                 if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
506                     XMapWindow(obt_display, target->textwin);
507                 else
508                     XUnmapWindow(obt_display, target->textwin);
509             }
510             else {
511                 XUnmapWindow(obt_display, target->textwin);
512                 if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
513                     XUnmapWindow(obt_display, target->iconwin);
514                 else
515                     XMapWindow(obt_display, target->iconwin);
516             }
517
518             /* get the icon from the client */
519             icon = client_icon(target->client, ICON_SIZE, ICON_SIZE);
520             p->a_icon->texture[0].data.rgba.width = icon->width;
521             p->a_icon->texture[0].data.rgba.height = icon->height;
522             p->a_icon->texture[0].data.rgba.twidth = ICON_SIZE;
523             p->a_icon->texture[0].data.rgba.theight = ICON_SIZE;
524             p->a_icon->texture[0].data.rgba.tx = HILITE_OFFSET;
525             p->a_icon->texture[0].data.rgba.ty = HILITE_OFFSET;
526             p->a_icon->texture[0].data.rgba.alpha =
527                 target->client->iconic ? OB_ICONIC_ALPHA : 0xff;
528             p->a_icon->texture[0].data.rgba.data = icon->data;
529
530             /* Draw the hilite? */
531             p->a_icon->texture[1].type = (target == newtarget) ?
532                 RR_TEXTURE_RGBA : RR_TEXTURE_NONE;
533
534             /* draw the icon */
535             p->a_icon->surface.parentx = iconx;
536             p->a_icon->surface.parenty = icony;
537             RrPaint(p->a_icon, target->iconwin, HILITE_SIZE, HILITE_SIZE);
538
539             /* draw the text */
540             if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST ||
541                 target == newtarget)
542             {
543                 text = (target == newtarget) ? p->a_hilite_text : p->a_text;
544                 text->texture[0].data.text.string = target->text;
545                 text->surface.parentx =
546                     p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ?
547                     icon_mode_textx : list_mode_textx;
548                 text->surface.parenty =
549                     p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ?
550                     icon_mode_texty : list_mode_texty;
551                 RrPaint(text,
552                         (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ?
553                          p->icon_mode_text : target->textwin),
554                         textw, texth);
555             }
556         }
557     }
558
559     p->last_target = newtarget;
560
561     g_free(screen_area);
562
563     XFlush(obt_display);
564 }
565
566 void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows,
567                             gboolean all_desktops, gboolean dock_windows,
568                             gboolean desktop_windows,
569                             ObFocusCyclePopupMode mode)
570 {
571     g_assert(c != NULL);
572
573     if (mode == OB_FOCUS_CYCLE_POPUP_MODE_NONE) {
574         focus_cycle_popup_hide();
575         return;
576     }
577
578     /* do this stuff only when the dialog is first showing */
579     if (!popup.mapped) {
580         popup_setup(&popup, TRUE, iconic_windows, all_desktops, 
581                     dock_windows, desktop_windows);
582         /* this is fixed once the dialog is shown */
583         popup.mode = mode;
584     }
585     g_assert(popup.targets != NULL);
586
587     popup_render(&popup, c);
588
589     if (!popup.mapped) {
590         /* show the dialog */
591         XMapWindow(obt_display, popup.bg);
592         XFlush(obt_display);
593         popup.mapped = TRUE;
594         screen_hide_desktop_popup();
595     }
596 }
597
598 void focus_cycle_popup_hide(void)
599 {
600     gulong ignore_start;
601
602     ignore_start = event_start_ignore_all_enters();
603
604     XUnmapWindow(obt_display, popup.bg);
605     XFlush(obt_display);
606
607     event_end_ignore_all_enters(ignore_start);
608
609     popup.mapped = FALSE;
610
611     while(popup.targets) {
612         ObFocusCyclePopupTarget *t = popup.targets->data;
613
614         g_free(t->text);
615         XDestroyWindow(obt_display, t->iconwin);
616         XDestroyWindow(obt_display, t->textwin);
617         g_free(t);
618
619         popup.targets = g_list_delete_link(popup.targets, popup.targets);
620     }
621     popup.n_targets = 0;
622     popup.last_target = NULL;
623 }
624
625 void focus_cycle_popup_single_show(struct _ObClient *c,
626                                    gboolean iconic_windows,
627                                    gboolean all_desktops,
628                                    gboolean dock_windows,
629                                    gboolean desktop_windows)
630 {
631     gchar *text;
632
633     g_assert(c != NULL);
634
635     /* do this stuff only when the dialog is first showing */
636     if (!popup.mapped) {
637         Rect *a;
638
639         popup_setup(&popup, FALSE, iconic_windows, all_desktops,
640                     dock_windows, desktop_windows);
641         g_assert(popup.targets == NULL);
642
643         /* position the popup */
644         a = screen_physical_area_active();
645         icon_popup_position(single_popup, CenterGravity,
646                             a->x + a->width / 2, a->y + a->height / 2);
647         icon_popup_height(single_popup, POPUP_HEIGHT);
648         icon_popup_min_width(single_popup, POPUP_WIDTH);
649         icon_popup_max_width(single_popup, MAX(a->width/3, POPUP_WIDTH));
650         icon_popup_text_width(single_popup, popup.maxtextw);
651         g_free(a);
652     }
653
654     text = popup_get_name(c);
655     icon_popup_show(single_popup, text, client_icon(c, HILITE_SIZE,
656                                                     HILITE_SIZE));
657     g_free(text);
658     screen_hide_desktop_popup();
659 }
660
661 void focus_cycle_popup_single_hide(void)
662 {
663     icon_popup_hide(single_popup);
664 }