add a slight delay to the focus/desktop switch dialogs. so if you hit the key really fast there is no flicker. of course if you hit it fast but not fast enough there is still flicker. is this cool or does this make it feel bad? i dunno. we'll see..

make the keychain popup use the new delay popup facilities
This commit is contained in:
Dana Jansens 2007-05-02 00:59:07 +00:00
parent 66d6e1120e
commit 0da9aa2660
5 changed files with 53 additions and 38 deletions

View file

@ -318,10 +318,10 @@ static void popup_cycle(ObClient *c, gboolean show)
(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);
}
}

View file

@ -75,14 +75,6 @@ static gboolean chain_timeout(gpointer data)
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);
@ -103,19 +95,11 @@ static void set_curpos(KeyBindingTree *newpos)
}
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);
}
}
@ -362,7 +346,6 @@ void keyboard_shutdown(gboolean reconfig)
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);

View file

@ -25,9 +25,22 @@
#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;
@ -128,7 +141,7 @@ void popup_set_text_align(ObPopup *self, RrJustify align)
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;
@ -230,10 +243,19 @@ void popup_show(ObPopup *self, gchar *text)
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);
}
}
}
@ -245,6 +267,9 @@ void popup_hide(ObPopup *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;
}
}
@ -288,8 +313,8 @@ void icon_popup_free(ObIconPopup *self)
}
}
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;
@ -299,7 +324,7 @@ void icon_popup_show(ObIconPopup *self,
} 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,
@ -448,7 +473,8 @@ void pager_popup_free(ObPagerPopup *self)
}
}
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;
@ -475,5 +501,5 @@ void pager_popup_show(ObPagerPopup *self, gchar *text, guint desk)
self->desks = screen_num_desktops;
self->curdesk = desk;
popup_show(self->popup, text);
popup_delay_show(self->popup, usec, text);
}

View file

@ -48,6 +48,7 @@ struct _ObPopup
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;
@ -91,7 +92,8 @@ void popup_width_to_strings(ObPopup *self, gchar **strings, gint max);
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);
@ -100,8 +102,9 @@ 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))
@ -115,7 +118,9 @@ void icon_popup_show(ObIconPopup *self,
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))

View file

@ -601,7 +601,8 @@ void screen_desktop_popup(guint d, gboolean show)
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);
}
}