qulogic/libgnt

5cc64b114060
propagate from branch 'im.pidgin.pidgin' (head 2a5f6005c519698a2626c2dd7e82415f8d5511e4)
to branch 'im.pidgin.pidgin.next.minor' (head 19e122d383fef04728de2f71503a049d37590c34)
  • +2 -0
    Makefile.am
  • +4 -4
    configure.ac
  • +4 -0
    gnt.h
  • +9 -5
    gntbox.c
  • +3 -2
    gntcheckbox.c
  • +2 -1
    gntcombobox.c
  • +4 -2
    gntentry.c
  • +1 -1
    gntkeys.c
  • +1 -0
    gntkeys.h
  • +253 -0
    gntprogressbar.c
  • +132 -0
    gntprogressbar.h
  • +2 -1
    gnttextview.c
  • +14 -4
    gnttree.c
  • +21 -7
    gntwm.c
  • --- a/Makefile.am Mon Mar 02 04:18:40 2009 +0000
    +++ b/Makefile.am Wed Aug 19 00:46:04 2009 +0000
    @@ -28,6 +28,7 @@
    gntmenu.c \
    gntmenuitem.c \
    gntmenuitemcheck.c \
    + gntprogressbar.c \
    gntslider.c \
    gntstyle.c \
    gnttextview.c \
    @@ -56,6 +57,7 @@
    gntmenu.h \
    gntmenuitem.h \
    gntmenuitemcheck.h \
    + gntprogressbar.h \
    gntslider.h \
    gntstyle.h \
    gnttextview.h \
    --- a/configure.ac Mon Mar 02 04:18:40 2009 +0000
    +++ b/configure.ac Wed Aug 19 00:46:04 2009 +0000
    @@ -24,11 +24,11 @@
    # Make sure to update ../../configure.ac with libgnt version changes.
    #
    -m4_define([gnt_lt_current], [5])
    +m4_define([gnt_lt_current], [6])
    m4_define([gnt_major_version], [2])
    -m4_define([gnt_minor_version], [5])
    -m4_define([gnt_micro_version], [0])
    -m4_define([gnt_version_suffix], [])
    +m4_define([gnt_minor_version], [6])
    +m4_define([gnt_micro_version], [2])
    +m4_define([gnt_version_suffix], [devel])
    m4_define([gnt_version],
    [gnt_major_version.gnt_minor_version.gnt_micro_version])
    m4_define([gnt_display_version], gnt_version[]m4_ifdef([gnt_version_suffix],[gnt_version_suffix]))
    --- a/gnt.h Mon Mar 02 04:18:40 2009 +0000
    +++ b/gnt.h Wed Aug 19 00:46:04 2009 +0000
    @@ -48,6 +48,10 @@
    #define G_PARAM_STATIC_BLURB G_PARAM_PRIVATE
    #endif
    +#if !GLIB_CHECK_VERSION(2,14,0)
    + #define g_timeout_add_seconds(time, callback, data) g_timeout_add(time * 1000, callback, data)
    +#endif
    +
    /**
    * Initialize GNT.
    */
    --- a/gntbox.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntbox.c Wed Aug 19 00:46:04 2009 +0000
    @@ -78,13 +78,11 @@
    g_list_foreach(box->list, (GFunc)gnt_widget_draw, NULL);
    - gnt_box_sync_children(box);
    -
    if (box->title && !GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
    {
    int pos, right;
    char *title = g_strdup(box->title);
    -
    +
    get_title_thingies(box, title, &pos, &right);
    if (gnt_widget_has_focus(widget))
    @@ -96,8 +94,8 @@
    mvwaddch(widget->window, 0, right, ACS_LTEE | gnt_color_pair(GNT_COLOR_NORMAL));
    g_free(title);
    }
    -
    - GNTDEBUG;
    +
    + gnt_box_sync_children(box);
    }
    static void
    @@ -723,6 +721,9 @@
    if (GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_NO_BORDER))
    pos = 0;
    + if (!box->active)
    + find_focusable_widget(box);
    +
    for (iter = box->list; iter; iter = iter->next)
    {
    GntWidget *w = GNT_WIDGET(iter->data);
    @@ -764,6 +765,9 @@
    copywin(w->window, widget->window, 0, 0,
    y, x, y + height - 1, x + width - 1, FALSE);
    gnt_widget_set_position(w, x + widget->priv.x, y + widget->priv.y);
    + if (w == box->active) {
    + wmove(widget->window, y + getcury(w->window), x + getcurx(w->window));
    + }
    }
    }
    --- a/gntcheckbox.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntcheckbox.c Wed Aug 19 00:46:04 2009 +0000
    @@ -42,7 +42,7 @@
    type = GNT_COLOR_HIGHLIGHT;
    else
    type = GNT_COLOR_NORMAL;
    -
    +
    wbkgdset(widget->window, '\0' | gnt_color_pair(type));
    text = g_strdup_printf("[%c]", cb->checked ? 'X' : ' ');
    @@ -51,7 +51,8 @@
    wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_NORMAL));
    mvwaddstr(widget->window, 0, 4, GNT_BUTTON(cb)->priv->text);
    -
    + wmove(widget->window, 0, 1);
    +
    GNTDEBUG;
    }
    --- a/gntcombobox.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntcombobox.c Wed Aug 19 00:46:04 2009 +0000
    @@ -73,7 +73,7 @@
    char *text = NULL, *s;
    GntColorType type;
    int len;
    -
    +
    if (box->dropdown && box->selected)
    text = gnt_tree_get_selection_text(GNT_TREE(box->dropdown));
    @@ -94,6 +94,7 @@
    whline(widget->window, ' ' | gnt_color_pair(type), widget->priv.width - 4 - len);
    mvwaddch(widget->window, 1, widget->priv.width - 3, ACS_VLINE | gnt_color_pair(GNT_COLOR_NORMAL));
    mvwaddch(widget->window, 1, widget->priv.width - 2, ACS_DARROW | gnt_color_pair(GNT_COLOR_NORMAL));
    + wmove(widget->window, 1, 1);
    g_free(text);
    GNTDEBUG;
    --- a/gntentry.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntentry.c Wed Aug 19 00:46:04 2009 +0000
    @@ -271,6 +271,7 @@
    GntEntry *entry = GNT_ENTRY(widget);
    int stop;
    gboolean focus;
    + int curpos;
    if ((focus = gnt_widget_has_focus(widget)))
    wbkgdset(widget->window, '\0' | gnt_color_pair(GNT_COLOR_TEXT_NORMAL));
    @@ -289,9 +290,10 @@
    if (stop < widget->priv.width)
    mvwhline(widget->window, 0, stop, ENTRY_CHAR, widget->priv.width - stop);
    + curpos = gnt_util_onscreen_width(entry->scroll, entry->cursor);
    if (focus)
    - mvwchgat(widget->window, 0, gnt_util_onscreen_width(entry->scroll, entry->cursor),
    - 1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
    + mvwchgat(widget->window, 0, curpos, 1, A_REVERSE, GNT_COLOR_TEXT_NORMAL, NULL);
    + wmove(widget->window, 0, curpos);
    GNTDEBUG;
    }
    --- a/gntkeys.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntkeys.c Wed Aug 19 00:46:04 2009 +0000
    @@ -166,7 +166,7 @@
    strstr(term, "xterm") == term ||
    strstr(term, "vt100") == term)
    *(text + 1) = 'O';
    - } else if (*(unsigned char*)text == 195) {
    + } else if (g_utf8_get_char(text) == 195) {
    if (*(text + 2) == 0 && strstr(term, "xterm") == term) {
    *(text) = 27;
    *(text + 1) -= 64; /* Say wha? */
    --- a/gntkeys.h Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntkeys.h Wed Aug 19 00:46:04 2009 +0000
    @@ -165,5 +165,6 @@
    #undef lines
    #undef buttons
    #undef newline
    +#undef set_clock
    #endif
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gntprogressbar.c Wed Aug 19 00:46:04 2009 +0000
    @@ -0,0 +1,253 @@
    +/**
    + * GNT - The GLib Ncurses Toolkit
    + *
    + * GNT is the legal property of its developers, whose names are too numerous
    + * to list here. Please refer to the COPYRIGHT file distributed with this
    + * source distribution.
    + *
    + * This library is free software; you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation; either version 2 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program; if not, write to the Free Software
    + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
    + **/
    +
    +#include "gntprogressbar.h"
    +#include "gntutils.h"
    +
    +#include <string.h>
    +
    +typedef struct _GntProgressBarPrivate
    +{
    + gdouble fraction;
    + gboolean show_value;
    + GntProgressBarOrientation orientation;
    +} GntProgressBarPrivate;
    +
    +struct _GntProgressBar
    +{
    + GntWidget parent;
    +#if !GLIB_CHECK_VERSION(2,4,0)
    + GntProgressBarPrivate priv;
    +#endif
    +};
    +
    +#if GLIB_CHECK_VERSION(2,4,0)
    +#define GNT_PROGRESS_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarPrivate))
    +#else
    +#define GNT_PROGRESS_BAR_GET_PRIVATE(o) &(GNT_PROGRESS_BAR(o)->priv)
    +#endif
    +
    +static GntWidgetClass *parent_class = NULL;
    +
    +
    +static void
    +gnt_progress_bar_draw (GntWidget *widget)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (GNT_PROGRESS_BAR (widget));
    + gchar progress[8];
    + gint start, end, i, pos;
    + int color;
    +
    + g_snprintf (progress, sizeof (progress), "%.1f%%", priv->fraction * 100);
    + color = gnt_color_pair(GNT_COLOR_NORMAL);
    +
    + switch (priv->orientation) {
    + case GNT_PROGRESS_LEFT_TO_RIGHT:
    + case GNT_PROGRESS_RIGHT_TO_LEFT:
    + start = (priv->orientation == GNT_PROGRESS_LEFT_TO_RIGHT ? 0 : (1.0 - priv->fraction) * widget->priv.width);
    + end = (priv->orientation == GNT_PROGRESS_LEFT_TO_RIGHT ? widget->priv.width * priv->fraction : widget->priv.width);
    +
    + /* background */
    + for (i = 0; i < widget->priv.height; i++)
    + mvwhline (widget->window, i, 0, ' ' | color, widget->priv.width);
    +
    + /* foreground */
    + for (i = 0; i < widget->priv.height; i++)
    + mvwhline (widget->window, i, start, ACS_CKBOARD | color | A_REVERSE, end);
    +
    + /* text */
    + if (priv->show_value) {
    + pos = widget->priv.width / 2 - strlen (progress) / 2;
    + for (i = 0; i < progress[i]; i++, pos++) {
    + wattrset (widget->window, color | ((pos < start || pos > end) ? A_NORMAL : A_REVERSE));
    + mvwprintw (widget->window, widget->priv.height / 2, pos, "%c", progress[i]);
    + }
    + wattrset (widget->window, color);
    + }
    +
    + break;
    + case GNT_PROGRESS_TOP_TO_BOTTOM:
    + case GNT_PROGRESS_BOTTOM_TO_TOP:
    + start = (priv->orientation == GNT_PROGRESS_TOP_TO_BOTTOM ? 0 : (1.0 - priv->fraction) * widget->priv.height);
    + end = (priv->orientation == GNT_PROGRESS_TOP_TO_BOTTOM ? widget->priv.height * priv->fraction : widget->priv.height);
    +
    + /* background */
    + for (i = 0; i < widget->priv.width; i++)
    + mvwvline (widget->window, 0, i, ' ' | color, widget->priv.height);
    +
    + /* foreground */
    + for (i = 0; i < widget->priv.width; i++)
    + mvwvline (widget->window, start, i, ACS_CKBOARD | color | A_REVERSE, end);
    +
    + /* text */
    + if (priv->show_value) {
    + pos = widget->priv.height / 2 - strlen (progress) / 2;
    + for (i = 0; i < progress[i]; i++, pos++) {
    + wattrset (widget->window, color | ((pos < start || pos > end) ? A_NORMAL : A_REVERSE));
    + mvwprintw (widget->window, pos, widget->priv.width / 2, "%c\n", progress[i]);
    + }
    + wattrset (widget->window, color);
    + }
    +
    + break;
    + default:
    + g_assert_not_reached ();
    + }
    +}
    +
    +static void
    +gnt_progress_bar_size_request (GntWidget *widget)
    +{
    + gnt_widget_set_size (widget, widget->priv.minw, widget->priv.minh);
    +}
    +
    +static void
    +gnt_progress_bar_class_init (gpointer klass, gpointer class_data)
    +{
    + GObjectClass *g_class = G_OBJECT_CLASS (klass);
    +
    + parent_class = GNT_WIDGET_CLASS (klass);
    +
    +#if GLIB_CHECK_VERSION(2,4,0)
    + g_type_class_add_private (g_class, sizeof (GntProgressBarPrivate));
    +#endif
    +
    + parent_class->draw = gnt_progress_bar_draw;
    + parent_class->size_request = gnt_progress_bar_size_request;
    +}
    +
    +static void
    +gnt_progress_bar_init (GTypeInstance *instance, gpointer g_class)
    +{
    + GntWidget *widget = GNT_WIDGET (instance);
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (GNT_PROGRESS_BAR (widget));
    +
    + gnt_widget_set_take_focus (widget, FALSE);
    + GNT_WIDGET_SET_FLAGS (widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW | GNT_WIDGET_GROW_X);
    +
    + widget->priv.minw = 8;
    + widget->priv.minh = 1;
    +
    + priv->show_value = TRUE;
    +}
    +
    +GType
    +gnt_progress_bar_get_type (void)
    +{
    + static GType type = 0;
    +
    + if (type == 0) {
    + static const GTypeInfo info = {
    + sizeof (GntProgressBarClass),
    + NULL, /* base_init */
    + NULL, /* base_finalize */
    + gnt_progress_bar_class_init, /* class_init */
    + NULL, /* class_finalize */
    + NULL, /* class_data */
    + sizeof (GntProgressBar),
    + 0, /* n_preallocs */
    + gnt_progress_bar_init, /* instance_init */
    + NULL /* value_table */
    + };
    +
    + type = g_type_register_static (GNT_TYPE_WIDGET, "GntProgressBar", &info, 0);
    + }
    +
    + return type;
    +}
    +
    +GntWidget *
    +gnt_progress_bar_new (void)
    +{
    + GntWidget *widget = g_object_new (GNT_TYPE_PROGRESS_BAR, NULL);
    + return widget;
    +}
    +
    +void
    +gnt_progress_bar_set_fraction (GntProgressBar *pbar, gdouble fraction)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar);
    +
    + if (fraction > 1.0)
    + priv->fraction = 1.0;
    + else if (fraction < 0.0)
    + priv->fraction = 0.0;
    + else
    + priv->fraction = fraction;
    +
    + if ((GNT_WIDGET_FLAGS(pbar) & GNT_WIDGET_MAPPED))
    + gnt_widget_draw(GNT_WIDGET(pbar));
    +}
    +
    +void
    +gnt_progress_bar_set_orientation (GntProgressBar *pbar,
    + GntProgressBarOrientation orientation)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar);
    + GntWidget *widget = GNT_WIDGET(pbar);
    +
    + priv->orientation = orientation;
    + if (orientation == GNT_PROGRESS_LEFT_TO_RIGHT ||
    + orientation == GNT_PROGRESS_RIGHT_TO_LEFT) {
    + GNT_WIDGET_SET_FLAGS(pbar, GNT_WIDGET_GROW_X);
    + GNT_WIDGET_UNSET_FLAGS(pbar, GNT_WIDGET_GROW_Y);
    + widget->priv.minw = 8;
    + widget->priv.minh = 1;
    + } else {
    + GNT_WIDGET_UNSET_FLAGS(pbar, GNT_WIDGET_GROW_X);
    + GNT_WIDGET_SET_FLAGS(pbar, GNT_WIDGET_GROW_Y);
    + widget->priv.minw = 1;
    + widget->priv.minh = 8;
    + }
    +
    + if ((GNT_WIDGET_FLAGS(pbar) & GNT_WIDGET_MAPPED))
    + gnt_widget_draw(GNT_WIDGET(pbar));
    +}
    +
    +void
    +gnt_progress_bar_set_show_progress (GntProgressBar *pbar, gboolean show)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar);
    + priv->show_value = show;
    +}
    +
    +gdouble
    +gnt_progress_bar_get_fraction (GntProgressBar *pbar)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar);
    + return priv->fraction;
    +}
    +
    +GntProgressBarOrientation
    +gnt_progress_bar_get_orientation (GntProgressBar *pbar)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar);
    + return priv->orientation;
    +}
    +
    +gboolean
    +gnt_progress_bar_get_show_progress (GntProgressBar *pbar)
    +{
    + GntProgressBarPrivate *priv = GNT_PROGRESS_BAR_GET_PRIVATE (pbar);
    + return priv->show_value;
    +}
    +
    --- /dev/null Thu Jan 01 00:00:00 1970 +0000
    +++ b/gntprogressbar.h Wed Aug 19 00:46:04 2009 +0000
    @@ -0,0 +1,132 @@
    +/**
    + * @file gntprogressbar.h Progress Bar API
    + * @ingroup gnt
    + */
    +/*
    + * GNT - The GLib Ncurses Toolkit
    + *
    + * GNT is the legal property of its developers, whose names are too numerous
    + * to list here. Please refer to the COPYRIGHT file distributed with this
    + * source distribution.
    + *
    + * This library is free software; you can redistribute it and/or modify
    + * it under the terms of the GNU General Public License as published by
    + * the Free Software Foundation; either version 2 of the License, or
    + * (at your option) any later version.
    + *
    + * This program is distributed in the hope that it will be useful,
    + * but WITHOUT ANY WARRANTY; without even the implied warranty of
    + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    + * GNU General Public License for more details.
    + *
    + * You should have received a copy of the GNU General Public License
    + * along with this program; if not, write to the Free Software
    + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
    + */
    +
    +#ifndef GNT_PROGRESS_BAR_H
    +#define GNT_PROGRESS_BAR_H
    +
    +#include "gnt.h"
    +#include "gntwidget.h"
    +
    +#define GNT_TYPE_PROGRESS_BAR (gnt_progress_bar_get_type ())
    +#define GNT_PROGRESS_BAR(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBar))
    +#define GNT_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass))
    +#define GNT_IS_PROGRESS_BAR(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNT_TYPE_PROGRESS_BAR))
    +#define GNT_IS_PROGRESS_BAR_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNT_TYPE_PROGRESS_BAR))
    +#define GNT_PROGRESS_BAR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNT_TYPE_PROGRESS_BAR, GntProgressBarClass))
    +
    +typedef enum _GntProgressBarOrientation
    +{
    + GNT_PROGRESS_LEFT_TO_RIGHT,
    + GNT_PROGRESS_RIGHT_TO_LEFT,
    + GNT_PROGRESS_BOTTOM_TO_TOP,
    + GNT_PROGRESS_TOP_TO_BOTTOM,
    +} GntProgressBarOrientation;
    +
    +typedef struct _GntProgressBar GntProgressBar;
    +
    +typedef struct _GntProgressBarClass
    +{
    + GntWidgetClass parent;
    +
    + void (*gnt_reserved1)(void);
    + void (*gnt_reserved2)(void);
    + void (*gnt_reserved3)(void);
    + void (*gnt_reserved4)(void);
    +} GntProgressBarClass;
    +
    +G_BEGIN_DECLS
    +
    +/**
    + * Get the GType for GntProgressBar
    + * @return The GType for GntProrgressBar
    + **/
    +GType
    +gnt_progress_bar_get_type (void);
    +
    +/**
    + * Create a new GntProgressBar
    + * @return The new GntProgressBar
    + **/
    +GntWidget *
    +gnt_progress_bar_new (void);
    +
    +/**
    + * Set the progress for a progress bar
    + *
    + * @param pbar The GntProgressBar
    + * @param fraction The value between 0 and 1 to display
    + **/
    +void
    +gnt_progress_bar_set_fraction (GntProgressBar *pbar, gdouble fraction);
    +
    +/**
    + * Set the orientation for a progress bar
    + *
    + * @param pbar The GntProgressBar
    + * @param orientation The orientation to use
    + **/
    +void
    +gnt_progress_bar_set_orientation (GntProgressBar *pbar, GntProgressBarOrientation orientation);
    +
    +/**
    + * Controls whether the progress value is shown
    + *
    + * @param pbar The GntProgressBar
    + * @param show A boolean indicating if the value is shown
    + **/
    +void
    +gnt_progress_bar_set_show_progress (GntProgressBar *pbar, gboolean show);
    +
    +/**
    + * Get the progress that is displayed
    + *
    + * @param pbar The GntProgressBar
    + * @return The progress displayed as a value between 0 and 1
    + **/
    +gdouble
    +gnt_progress_bar_get_fraction (GntProgressBar *pbar);
    +
    +/**
    + * Get the orientation for the progress bar
    + *
    + * @param pbar The GntProgressBar
    + * @return The current orientation of the progress bar
    + **/
    +GntProgressBarOrientation
    +gnt_progress_bar_get_orientation (GntProgressBar *pbar);
    +
    +/**
    + * Get a boolean describing if the progress value is shown
    + *
    + * @param pbar The GntProgressBar
    + * @return A boolean @c true if the progress value is shown, @c false otherwise.
    + **/
    +gboolean
    +gnt_progress_bar_get_show_progress (GntProgressBar *pbar);
    +
    +G_END_DECLS
    +
    +#endif /* GNT_PROGRESS_BAR_H */
    --- a/gnttextview.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gnttextview.c Wed Aug 19 00:46:04 2009 +0000
    @@ -177,7 +177,7 @@
    gnt_color_pair(GNT_COLOR_HIGHLIGHT_D));
    }
    - GNTDEBUG;
    + wmove(widget->window, 0, 0);
    }
    static void
    @@ -799,6 +799,7 @@
    break;
    }
    }
    + gnt_widget_draw(GNT_WIDGET(view));
    return count;
    }
    --- a/gnttree.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gnttree.c Wed Aug 19 00:46:04 2009 +0000
    @@ -28,7 +28,7 @@
    #include <string.h>
    #include <ctype.h>
    -#define SEARCH_TIMEOUT 4000 /* 4 secs */
    +#define SEARCH_TIMEOUT_S 4 /* 4 secs */
    #define SEARCHING(tree) (tree->priv->search && tree->priv->search->len > 0)
    #define COLUMN_INVISIBLE(tree, index) (tree->columns[index].flags & GNT_TREE_COLUMN_INVISIBLE)
    @@ -420,6 +420,7 @@
    GntTreeRow *row;
    int pos, up, down = 0;
    int rows, scrcol;
    + int current = 0;
    if (!GNT_WIDGET_IS_FLAG_SET(GNT_WIDGET(tree), GNT_WIDGET_MAPPED))
    return;
    @@ -431,7 +432,7 @@
    if (tree->top == NULL)
    tree->top = tree->root;
    - if (tree->current == NULL) {
    + if (tree->current == NULL && tree->root != NULL) {
    tree->current = tree->root;
    tree_selection_changed(tree, NULL, tree->current);
    }
    @@ -490,6 +491,13 @@
    tree->top = get_next(tree->top);
    row = tree->top;
    scrcol = widget->priv.width - 1 - 2 * pos; /* exclude the borders and the scrollbar */
    +
    + if (tree->current && !row_matches_search(tree->current)) {
    + GntTreeRow *old = tree->current;
    + tree->current = tree->top;
    + tree_selection_changed(tree, old, tree->current);
    + }
    +
    for (i = start + pos; row && i < widget->priv.height - pos;
    i++, row = get_next(row))
    {
    @@ -518,6 +526,7 @@
    if (row == tree->current)
    {
    + current = i;
    attr |= A_BOLD;
    if (gnt_widget_has_focus(widget))
    attr |= gnt_color_pair(GNT_COLOR_HIGHLIGHT);
    @@ -606,6 +615,7 @@
    mvwaddnstr(widget->window, widget->priv.height - pos - 1, pos,
    tree->priv->search->str, str - tree->priv->search->str);
    }
    + wmove(widget->window, current, pos);
    gnt_widget_queue_update(widget);
    }
    @@ -818,7 +828,7 @@
    gnt_bindable_perform_action_key(GNT_BINDABLE(tree), text);
    }
    g_source_remove(tree->priv->search_timeout);
    - tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree);
    + tree->priv->search_timeout = g_timeout_add_seconds(SEARCH_TIMEOUT_S, search_timeout, tree);
    return TRUE;
    } else if (text[0] == ' ' && text[1] == 0) {
    /* Space pressed */
    @@ -930,7 +940,7 @@
    return FALSE;
    GNT_WIDGET_SET_FLAGS(GNT_WIDGET(tree), GNT_WIDGET_DISABLE_ACTIONS);
    tree->priv->search = g_string_new(NULL);
    - tree->priv->search_timeout = g_timeout_add(SEARCH_TIMEOUT, search_timeout, tree);
    + tree->priv->search_timeout = g_timeout_add_seconds(SEARCH_TIMEOUT_S, search_timeout, tree);
    return TRUE;
    }
    --- a/gntwm.c Mon Mar 02 04:18:40 2009 +0000
    +++ b/gntwm.c Wed Aug 19 00:46:04 2009 +0000
    @@ -135,6 +135,17 @@
    src = widget->window;
    dst = node->window;
    copywin(src, dst, node->scroll, 0, 0, 0, getmaxy(dst) - 1, getmaxx(dst) - 1, 0);
    +
    + /* Update the hardware cursor */
    + if (GNT_IS_WINDOW(widget) || GNT_IS_BOX(widget)) {
    + GntWidget *active = GNT_BOX(widget)->active;
    + if (active) {
    + int curx = active->priv.x + getcurx(active->window);
    + int cury = active->priv.y + getcury(active->window);
    + if (wmove(node->window, cury - widget->priv.y, curx - widget->priv.x) != OK)
    + wmove(node->window, 0, 0);
    + }
    + }
    }
    /**
    @@ -397,7 +408,7 @@
    wm->positions = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
    if (gnt_style_get_bool(GNT_STYLE_REMPOS, TRUE))
    read_window_positions(wm);
    - g_timeout_add(IDLE_CHECK_INTERVAL * 1000, check_idle, NULL);
    + g_timeout_add_seconds(IDLE_CHECK_INTERVAL, check_idle, NULL);
    time(&last_active_time);
    gnt_wm_switch_workspace(wm, 0);
    }
    @@ -1101,8 +1112,8 @@
    g_hash_table_foreach(wm->nodes, (GHFunc)refresh_node, GINT_TO_POINTER(TRUE));
    g_signal_emit(wm, signals[SIG_TERMINAL_REFRESH], 0);
    + gnt_ws_draw_taskbar(wm->cws, TRUE);
    update_screen(wm);
    - gnt_ws_draw_taskbar(wm->cws, TRUE);
    curs_set(0); /* endwin resets the cursor to normal */
    return TRUE;
    @@ -1872,8 +1883,8 @@
    }
    }
    + gnt_ws_draw_taskbar(wm->cws, FALSE);
    update_screen(wm);
    - gnt_ws_draw_taskbar(wm->cws, FALSE);
    }
    void gnt_wm_window_decorate(GntWM *wm, GntWidget *widget)
    @@ -1885,6 +1896,7 @@
    {
    GntWS *s;
    int pos;
    + gboolean transient = !!GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT);
    s = gnt_wm_widget_find_workspace(wm, widget);
    @@ -1908,10 +1920,12 @@
    if (s->ordered && wm->cws == s)
    gnt_wm_raise_window(wm, s->ordered->data);
    }
    + } else if (transient && wm->cws && wm->cws->ordered) {
    + gnt_wm_update_window(wm, wm->cws->ordered->data);
    }
    + gnt_ws_draw_taskbar(wm->cws, FALSE);
    update_screen(wm);
    - gnt_ws_draw_taskbar(wm->cws, FALSE);
    }
    time_t gnt_wm_get_idle_time()
    @@ -2119,7 +2133,7 @@
    if (write_timeout) {
    g_source_remove(write_timeout);
    }
    - write_timeout = g_timeout_add(10000, write_already, wm);
    + write_timeout = g_timeout_add_seconds(10, write_already, wm);
    }
    void gnt_wm_move_window(GntWM *wm, GntWidget *widget, int x, int y)
    @@ -2181,8 +2195,8 @@
    GntNode *nd = g_hash_table_lookup(wm->nodes, wm->_list.window);
    top_panel(nd->panel);
    }
    + gnt_ws_draw_taskbar(wm->cws, FALSE);
    update_screen(wm);
    - gnt_ws_draw_taskbar(wm->cws, FALSE);
    }
    void gnt_wm_update_window(GntWM *wm, GntWidget *widget)
    @@ -2207,8 +2221,8 @@
    if (ws == wm->cws || GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_TRANSIENT)) {
    gnt_wm_copy_win(widget, node);
    + gnt_ws_draw_taskbar(wm->cws, FALSE);
    update_screen(wm);
    - gnt_ws_draw_taskbar(wm->cws, FALSE);
    } else if (ws && ws != wm->cws && GNT_WIDGET_IS_FLAG_SET(widget, GNT_WIDGET_URGENT)) {
    if (!act || (act && !g_list_find(act, ws)))
    act = g_list_prepend(act, ws);