]> icculus.org git repositories - mikachu/openbox.git/blob - openbox/focus_cycle_popup.c
when scrolling, all the items need to be redrawn to make parentrelative work
[mikachu/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     }
372
373     /* get the text width */
374     textw = w - l - r;
375     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
376         /* leave space on the side for the icons */
377         textw -= list_mode_icon_column_w;
378
379     /* find the height of the dialog */
380     h = t + b + (icon_rows * MAX(HILITE_SIZE, texth));
381     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS)
382         /* in icon mode the text sits below the icons, so make some space */
383         h += OUTSIDE_BORDER + texth;
384
385     /* center the icons if there is less than one row */
386     if (icon_rows == 1)
387         icons_center_x = (w - p->n_targets * HILITE_SIZE) / 2;
388     else
389         icons_center_x = 0;
390
391     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS) {
392         /* get the position of the text */
393         icon_mode_textx = l;
394         icon_mode_texty = h - texth - b;
395     }
396
397     /* find the position for the popup (include the outer borders) */
398     x = screen_area->x + (screen_area->width -
399                           (w + ob_rr_theme->obwidth * 2)) / 2;
400     y = screen_area->y + (screen_area->height -
401                           (h + ob_rr_theme->obwidth * 2)) / 2;
402
403     /* get the dimensions of the target hilite texture */
404     rgbax = ml;
405     rgbay = mt;
406     rgbaw = w - ml - mr;
407     rgbah = h - mt - mb;
408
409     if (!p->mapped) {
410         /* position the background but don't draw it */
411         XMoveResizeWindow(obt_display, p->bg, x, y, w, h);
412
413         if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS) {
414             /* position the text */
415             XMoveResizeWindow(obt_display, p->icon_mode_text,
416                               icon_mode_textx, icon_mode_texty, textw, texth);
417             XMapWindow(obt_display, popup.icon_mode_text);
418         }
419         else
420             XUnmapWindow(obt_display, popup.icon_mode_text);
421
422         /* reset the scrolling when the dialog is first shown */
423         p->scroll = 0;
424     }
425
426     /* find the focused target */
427     newtarget = NULL;
428     for (i = 0, it = p->targets; it; ++i, it = g_list_next(it)) {
429         const ObFocusCyclePopupTarget *target = it->data;
430         if (target->client == c) {
431             /* save the target */
432             newtarget = target;
433             break;
434         }
435     }
436     selected_pos = i;
437
438     /* scroll the list if needed */
439     last_scroll = p->scroll;
440     if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST) {
441         const gint top = p->scroll + SCROLL_MARGIN;
442         const gint bottom = p->scroll + icon_rows - SCROLL_MARGIN;
443         const gint min_scroll = 0;
444         const gint max_scroll = p->n_targets - icon_rows;
445
446         if (top - selected_pos >= 0) {
447             p->scroll -= top - selected_pos + 1;
448             p->scroll = MAX(p->scroll, min_scroll);
449         }
450         else if (selected_pos - bottom >= 0) {
451             p->scroll += selected_pos - bottom + 1;
452             p->scroll = MIN(p->scroll, max_scroll);
453         }
454     }
455
456     g_assert(newtarget != NULL);
457
458     /* * * draw everything * * */
459
460     /* draw the background */
461     if (!p->mapped)
462         RrPaint(p->a_bg, p->bg, w, h);
463
464     /* draw the icons and text */
465     for (i = 0, it = p->targets; it; ++i, it = g_list_next(it)) {
466         const ObFocusCyclePopupTarget *target = it->data;
467
468         /* have to redraw the targetted icon and last targetted icon
469          * to update the hilite */
470         if (!p->mapped || newtarget == target || p->last_target == target ||
471             last_scroll != p->scroll)
472         {
473             /* row and column start from 0 */
474             const gint row = i / icons_per_row - p->scroll;
475             const gint col = i % icons_per_row;
476             const ObClientIcon *icon;
477             gint iconx, icony;
478             gint list_mode_textx, list_mode_texty;
479             RrAppearance *text;
480
481             /* find the coordinates for the icon */
482             iconx = icons_center_x + l + (col * HILITE_SIZE);
483             icony = t + (row * MAX(texth, HILITE_SIZE))
484                 + MAX(texth - HILITE_SIZE, 0) / 2;
485
486             /* find the dimensions of the text box */
487             list_mode_textx = iconx + HILITE_SIZE + TEXT_BORDER;
488             list_mode_texty = icony + HILITE_OFFSET;
489
490             /* position the icon */
491             XMoveResizeWindow(obt_display, target->iconwin,
492                               iconx, icony, HILITE_SIZE, HILITE_SIZE);
493
494             /* position the text */
495             if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
496                 XMoveResizeWindow(obt_display, target->textwin,
497                                   list_mode_textx, list_mode_texty,
498                                   textw, texth);
499
500             /* show/hide the right windows */
501             if (row >= 0 && row < icon_rows) {
502                 XMapWindow(obt_display, target->iconwin);
503                 if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
504                     XMapWindow(obt_display, target->textwin);
505                 else
506                     XUnmapWindow(obt_display, target->textwin);
507             }
508             else {
509                 XUnmapWindow(obt_display, target->textwin);
510                 if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST)
511                     XUnmapWindow(obt_display, target->iconwin);
512                 else
513                     XMapWindow(obt_display, target->iconwin);
514             }
515
516             /* get the icon from the client */
517             icon = client_icon(target->client, ICON_SIZE, ICON_SIZE);
518             p->a_icon->texture[0].data.rgba.width = icon->width;
519             p->a_icon->texture[0].data.rgba.height = icon->height;
520             p->a_icon->texture[0].data.rgba.twidth = ICON_SIZE;
521             p->a_icon->texture[0].data.rgba.theight = ICON_SIZE;
522             p->a_icon->texture[0].data.rgba.tx = HILITE_OFFSET;
523             p->a_icon->texture[0].data.rgba.ty = HILITE_OFFSET;
524             p->a_icon->texture[0].data.rgba.alpha =
525                 target->client->iconic ? OB_ICONIC_ALPHA : 0xff;
526             p->a_icon->texture[0].data.rgba.data = icon->data;
527
528             /* Draw the hilite? */
529             p->a_icon->texture[1].type = (target == newtarget) ?
530                 RR_TEXTURE_RGBA : RR_TEXTURE_NONE;
531
532             /* draw the icon */
533             p->a_icon->surface.parentx = iconx;
534             p->a_icon->surface.parenty = icony;
535             RrPaint(p->a_icon, target->iconwin, HILITE_SIZE, HILITE_SIZE);
536
537             /* draw the text */
538             if (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_LIST ||
539                 target == newtarget)
540             {
541                 text = (target == newtarget) ? p->a_hilite_text : p->a_text;
542                 text->texture[0].data.text.string = target->text;
543                 text->surface.parentx =
544                     p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ?
545                     icon_mode_textx : list_mode_textx;
546                 text->surface.parenty =
547                     p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ?
548                     icon_mode_texty : list_mode_texty;
549                 RrPaint(text,
550                         (p->mode == OB_FOCUS_CYCLE_POPUP_MODE_ICONS ?
551                          p->icon_mode_text : target->textwin),
552                         textw, texth);
553             }
554         }
555     }
556
557     p->last_target = newtarget;
558
559     g_free(screen_area);
560
561     XFlush(obt_display);
562 }
563
564 void focus_cycle_popup_show(ObClient *c, gboolean iconic_windows,
565                             gboolean all_desktops, gboolean dock_windows,
566                             gboolean desktop_windows,
567                             ObFocusCyclePopupMode mode)
568 {
569     g_assert(c != NULL);
570
571     if (mode == OB_FOCUS_CYCLE_POPUP_MODE_NONE) {
572         focus_cycle_popup_hide();
573         return;
574     }
575
576     /* do this stuff only when the dialog is first showing */
577     if (!popup.mapped) {
578         popup_setup(&popup, TRUE, iconic_windows, all_desktops, 
579                     dock_windows, desktop_windows);
580         /* this is fixed once the dialog is shown */
581         popup.mode = mode;
582     }
583     g_assert(popup.targets != NULL);
584
585     popup_render(&popup, c);
586
587     if (!popup.mapped) {
588         /* show the dialog */
589         XMapWindow(obt_display, popup.bg);
590         XFlush(obt_display);
591         popup.mapped = TRUE;
592         screen_hide_desktop_popup();
593     }
594 }
595
596 void focus_cycle_popup_hide(void)
597 {
598     gulong ignore_start;
599
600     ignore_start = event_start_ignore_all_enters();
601
602     XUnmapWindow(obt_display, popup.bg);
603     XFlush(obt_display);
604
605     event_end_ignore_all_enters(ignore_start);
606
607     popup.mapped = FALSE;
608
609     while(popup.targets) {
610         ObFocusCyclePopupTarget *t = popup.targets->data;
611
612         g_free(t->text);
613         XDestroyWindow(obt_display, t->iconwin);
614         XDestroyWindow(obt_display, t->textwin);
615         g_free(t);
616
617         popup.targets = g_list_delete_link(popup.targets, popup.targets);
618     }
619     popup.n_targets = 0;
620     popup.last_target = NULL;
621 }
622
623 void focus_cycle_popup_single_show(struct _ObClient *c,
624                                    gboolean iconic_windows,
625                                    gboolean all_desktops,
626                                    gboolean dock_windows,
627                                    gboolean desktop_windows)
628 {
629     gchar *text;
630
631     g_assert(c != NULL);
632
633     /* do this stuff only when the dialog is first showing */
634     if (!popup.mapped) {
635         Rect *a;
636
637         popup_setup(&popup, FALSE, iconic_windows, all_desktops,
638                     dock_windows, desktop_windows);
639         g_assert(popup.targets == NULL);
640
641         /* position the popup */
642         a = screen_physical_area_active();
643         icon_popup_position(single_popup, CenterGravity,
644                             a->x + a->width / 2, a->y + a->height / 2);
645         icon_popup_height(single_popup, POPUP_HEIGHT);
646         icon_popup_min_width(single_popup, POPUP_WIDTH);
647         icon_popup_max_width(single_popup, MAX(a->width/3, POPUP_WIDTH));
648         icon_popup_text_width(single_popup, popup.maxtextw);
649         g_free(a);
650     }
651
652     text = popup_get_name(c);
653     icon_popup_show(single_popup, text, client_icon(c, HILITE_SIZE,
654                                                     HILITE_SIZE));
655     g_free(text);
656     screen_hide_desktop_popup();
657 }
658
659 void focus_cycle_popup_single_hide(void)
660 {
661     icon_popup_hide(single_popup);
662 }