Mercurial > audlegacy
changeset 2948:830fdbec31be trunk
introduce scroll_dummy to stop scrolling when it reaches end
author | Tomasz Mon <desowin@gmail.com> |
---|---|
date | Sun, 01 Jul 2007 13:31:07 +0200 |
parents | 13591e28d89e |
children | 7a88f6d9cd92 |
files | src/audacious/ui_skinned_textbox.c src/audacious/ui_skinned_textbox.h |
diffstat | 2 files changed, 16 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/src/audacious/ui_skinned_textbox.c Sun Jul 01 12:52:58 2007 +0200 +++ b/src/audacious/ui_skinned_textbox.c Sun Jul 01 13:31:07 2007 +0200 @@ -64,6 +64,7 @@ gint pixmap_width; GdkPixmap *pixmap; gboolean scroll_allowed, scroll_enabled; + gint scroll_dummy; }; @@ -275,6 +276,7 @@ priv->nominal_y = y; priv->nominal_height = textbox->height; priv->scroll_timeout = 0; + priv->scroll_dummy = 0; priv->fixed = fixed; priv->double_size = FALSE; @@ -584,21 +586,22 @@ UiSkinnedTextboxPrivate *priv = UI_SKINNED_TEXTBOX_GET_PRIVATE (data); if (!priv->is_dragging) { - if (priv->scroll_back) priv->offset -= 1; - else priv->offset += 1; + if (priv->scroll_dummy < TEXTBOX_SCROLL_WAIT) priv->scroll_dummy++; + else { + if (priv->scroll_back) priv->offset -= 1; + else priv->offset += 1; - if (priv->offset >= (priv->pixmap_width - textbox->width)) { - priv->scroll_back = TRUE; - /* There are 1 million microseconds per second */ - //g_usleep(1000000); + if (priv->offset >= (priv->pixmap_width - textbox->width)) { + priv->scroll_back = TRUE; + priv->scroll_dummy = 0; + } + if (priv->offset <= 0) { + priv->scroll_back = FALSE; + priv->scroll_dummy = 0; + } + ui_skinned_textbox_redraw(textbox); } - if (priv->offset <= 0) { - priv->scroll_back = FALSE; - //g_usleep(1000000); - } - ui_skinned_textbox_redraw(textbox); } - return TRUE; }
--- a/src/audacious/ui_skinned_textbox.h Sun Jul 01 12:52:58 2007 +0200 +++ b/src/audacious/ui_skinned_textbox.h Sun Jul 01 13:31:07 2007 +0200 @@ -24,8 +24,8 @@ #include <gtk/gtkenums.h> #include "widgets/skin.h" -#define TEXTBOX_SCROLL_TIMEOUT 200 #define TEXTBOX_SCROLL_SMOOTH_TIMEOUT 30 +#define TEXTBOX_SCROLL_WAIT 80 #define UI_TYPE_SKINNED_TEXTBOX (ui_skinned_textbox_get_type()) #define UI_SKINNED_TEXTBOX(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UI_TYPE_SKINNED_TEXTBOX, UiSkinnedTextbox))