Applied patch from <lupus@lettere.unipd.it> which adds

Sat Jan 17 13:26:15 CST 1998 Shawn T. Amundson <amundson@gimp.org>

        * gtk/gtkentry.[ch]:  Applied patch from <lupus@lettere.unipd.it>
          which adds gtk_entry_set_max_length function.  This was
          part of gtk-lupus-970112-0.

        * gtk/testgtk.c: Applied gtk-wille-980113-0 which fixes
          a problem with a shaped widget keeping grab forever
          when double clicked.

        * docs/gtk.texi: patch from Gregory McLean <gregm@randomc.com>
          to add some on aspect_frame, button_box, and color_selection
          widgets
This commit is contained in:
CST 1998 Shawn T. Amundson
1998-01-17 22:48:31 +00:00
committed by Shawn Amundson
parent 8d721e5b75
commit 2e99581612
13 changed files with 561 additions and 24 deletions

View File

@ -1764,7 +1764,7 @@ gtk_real_entry_insert_text (GtkEntry *entry,
new_text_length = entry->text_max_length - entry->text_length;
/* Don't insert anything, if there was nothing to insert. */
if (new_text_length == 0)
if (new_text_length <= 0)
return;
start_pos = *position;
@ -2109,3 +2109,12 @@ gtk_entry_paste_clipboard (GtkEntry *entry, GdkEventKey *event)
gtk_selection_convert (GTK_WIDGET(entry),
clipboard_atom, ctext_atom, event->time);
}
void
gtk_entry_set_max_length (GtkEntry *entry, guint16 max)
{
g_return_if_fail (entry != NULL);
g_return_if_fail (GTK_IS_ENTRY (entry));
entry->text_max_length = max;
}

View File

@ -97,6 +97,10 @@ void gtk_entry_set_visibility (GtkEntry *entry,
void gtk_entry_set_editable (GtkEntry *entry,
gboolean editable);
/* If entry->text is already > max it's up to you to change it */
void gtk_entry_set_max_length (GtkEntry *entry,
guint16 max);
#ifdef __cplusplus
}

View File

@ -2736,12 +2736,17 @@ static GtkWidget *rings = NULL;
typedef struct _cursoroffset {gint x,y;} CursorOffset;
static void
shape_pressed (GtkWidget *widget)
shape_pressed (GtkWidget *widget, GdkEventButton *event)
{
CursorOffset *p;
/* ignore double and triple click */
if (event->type != GDK_BUTTON_PRESS)
return;
p = gtk_object_get_user_data (GTK_OBJECT(widget));
gtk_widget_get_pointer (widget, &(p->x), &(p->y));
p->x = (int) event->x;
p->y = (int) event->y;
gtk_grab_add (widget);
gdk_pointer_grab (widget->window, TRUE,