(p->iconic ? p->icon_title : p->title),
NULL);
*/
- icon_popup_show(focus_cycle_popup,
- (title ? title :
- (c->iconic ? c->icon_title : c->title)),
- client_icon(p, 48, 48));
+ icon_popup_delay_show(focus_cycle_popup, G_USEC_PER_SEC/12,
+ (title ? title :
+ (c->iconic ? c->icon_title : c->title)),
+ client_icon(p, 48, 48));
g_free(title);
}
}
return FALSE; /* don't repeat */
}
-static gboolean popup_show_timeout(gpointer data)
-{
- gchar *text = data;
- popup_show(popup, text);
-
- return FALSE; /* don't repeat */
-}
-
static void set_curpos(KeyBindingTree *newpos)
{
grab_keys(FALSE);
}
popup_position(popup, NorthWestGravity, 10, 10);
- if (popup->mapped) {
- popup_show_timeout(text);
- g_free(text);
- } else {
- ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout);
- /* 1 second delay for the popup to show */
- ob_main_loop_timeout_add(ob_main_loop, G_USEC_PER_SEC,
- popup_show_timeout, text,
- g_direct_equal, g_free);
- }
+ /* 1 second delay for the popup to show */
+ popup_delay_show(popup, G_USEC_PER_SEC, text);
+ g_free(text);
} else {
popup_hide(popup);
- ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout);
}
}
interactive_states = NULL;
ob_main_loop_timeout_remove(ob_main_loop, chain_timeout);
- ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout);
keyboard_unbind_all();
set_curpos(NULL);
#include "stacking.h"
#include "event.h"
#include "screen.h"
+#include "mainloop.h"
#include "render/render.h"
#include "render/theme.h"
+static gboolean popup_show_timeout(gpointer data)
+{
+ ObPopup *self = data;
+
+ XMapWindow(ob_display, self->bg);
+ stacking_raise(INTERNAL_AS_WINDOW(self));
+ self->mapped = TRUE;
+ self->delay_mapped = FALSE;
+
+ return FALSE; /* don't repeat */
+}
+
ObPopup *popup_new(gboolean hasicon)
{
XSetWindowAttributes attrib;
self->a_text->texture[0].data.text.justify = align;
}
-void popup_show(ObPopup *self, gchar *text)
+void popup_delay_show(ObPopup *self, gulong usec, gchar *text)
{
gint l, t, r, b;
gint x, y, w, h;
iconw, texth, self->draw_icon_data);
}
+ /* do the actual showing */
if (!self->mapped) {
- XMapWindow(ob_display, self->bg);
- stacking_raise(INTERNAL_AS_WINDOW(self));
- self->mapped = TRUE;
+ if (usec) {
+ /* don't kill previous show timers */
+ if (!self->delay_mapped) {
+ ob_main_loop_timeout_add(ob_main_loop, usec,
+ popup_show_timeout, self,
+ g_direct_equal, NULL);
+ self->delay_mapped = TRUE;
+ }
+ } else {
+ popup_show_timeout(self);
+ }
}
}
/* kill enter events cause by this unmapping */
event_ignore_queued_enters();
+ } else if (self->delay_mapped) {
+ ob_main_loop_timeout_remove(ob_main_loop, popup_show_timeout);
+ self->delay_mapped = FALSE;
}
}
}
}
-void icon_popup_show(ObIconPopup *self,
- gchar *text, const ObClientIcon *icon)
+void icon_popup_delay_show(ObIconPopup *self, gulong usec,
+ gchar *text, const ObClientIcon *icon)
{
if (icon) {
self->a_icon->texture[0].type = RR_TEXTURE_RGBA;
} else
self->a_icon->texture[0].type = RR_TEXTURE_NONE;
- popup_show(self->popup, text);
+ popup_delay_show(self->popup, usec, text);
}
static void pager_popup_draw_icon(gint px, gint py, gint w, gint h,
}
}
-void pager_popup_show(ObPagerPopup *self, gchar *text, guint desk)
+void pager_popup_delay_show(ObPagerPopup *self, gulong usec,
+ gchar *text, guint desk)
{
guint i;
self->desks = screen_num_desktops;
self->curdesk = desk;
- popup_show(self->popup, text);
+ popup_delay_show(self->popup, usec, text);
}
gint w;
gint h;
gboolean mapped;
+ gboolean delay_mapped;
void (*draw_icon)(gint x, gint y, gint w, gint h, gpointer data);
gpointer draw_icon_data;
void popup_set_text_align(ObPopup *self, RrJustify align);
-void popup_show(ObPopup *self, gchar *text);
+#define popup_show(s, t) popup_delay_show((s),0,(t))
+void popup_delay_show(ObPopup *self, gulong usec, gchar *text);
void popup_hide(ObPopup *self);
RrAppearance *popup_icon_appearance(ObPopup *self);
ObIconPopup *icon_popup_new();
void icon_popup_free(ObIconPopup *self);
-void icon_popup_show(ObIconPopup *self,
- gchar *text, const struct _ObClientIcon *icon);
+#define icon_popup_show(s, t, i) icon_popup_delay_show((s),0,(t),(i))
+void icon_popup_delay_show(ObIconPopup *self, gulong usec,
+ gchar *text, const struct _ObClientIcon *icon);
#define icon_popup_hide(p) popup_hide((p)->popup)
#define icon_popup_position(p, g, x, y) popup_position((p)->popup,(g),(x),(y))
#define icon_popup_width(p, w) popup_width((p)->popup,(w))
ObPagerPopup *pager_popup_new();
void pager_popup_free(ObPagerPopup *self);
-void pager_popup_show(ObPagerPopup *self, gchar *text, guint desk);
+#define pager_popup_show(s, t, d) paper_popup_delay_show((s),0,(t),(d;2D))
+void pager_popup_delay_show(ObPagerPopup *self, gulong usec,
+ gchar *text, guint desk);
#define pager_popup_hide(p) popup_hide((p)->popup)
#define pager_popup_position(p, g, x, y) popup_position((p)->popup,(g),(x),(y))
#define pager_popup_width(p, w) popup_width((p)->popup,(w))
pager_popup_width(desktop_cycle_popup, MAX(a->width/3, POPUP_WIDTH));
pager_popup_height(desktop_cycle_popup, POPUP_HEIGHT);
- pager_popup_show(desktop_cycle_popup, screen_desktop_names[d], d);
+ pager_popup_delay_show(desktop_cycle_popup, G_USEC_PER_SEC/12,
+ screen_desktop_names[d], d);
}
}