GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit c3a4205c authored by Owen Taylor's avatar Owen Taylor Committed by Owen Taylor

Moved entry->visible into editable class. (Leave it behind deprecated for

Tue Feb  9 19:39:32 1999  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
	  entry->visible into editable class. (Leave it
	  behind deprecated for compatibility)

	* gtk/gtkeditable.c: If not editable->visible,
	  return *'s for clipboard and selection.
parent 72d58438
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
Tue Feb 9 19:39:32 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkentry.[ch] gtk/gtkeditable.h: Moved
entry->visible into editable class. (Leave it
behind deprecated for compatibility)
* gtk/gtkeditable.c: If not editable->visible,
return *'s for clipboard and selection.
Tue Feb 9 19:11:43 1999 Owen Taylor <otaylor@redhat.com>
* gtk/gtkstyle.c (gtk_style_new): If we can't find
......
......@@ -75,6 +75,9 @@ static void gtk_editable_set_arg (GtkObject *object,
static void gtk_editable_get_arg (GtkObject *object,
GtkArg *arg,
guint arg_id);
static void *gtk_editable_get_public_chars (GtkEditable *editable,
gint start,
gint end);
static gint gtk_editable_selection_clear (GtkWidget *widget,
GdkEventSelection *event);
static void gtk_editable_selection_get (GtkWidget *widget,
......@@ -382,6 +385,7 @@ gtk_editable_init (GtkEditable *editable)
editable->selection_end_pos = 0;
editable->has_selection = FALSE;
editable->editable = 1;
editable->visible = 1;
editable->clipboard_text = NULL;
#ifdef USE_XIM
......@@ -473,6 +477,35 @@ gtk_editable_get_chars (GtkEditable *editable,
return klass->get_chars (editable, start, end);
}
/*
* Like gtk_editable_get_chars, but if the editable is not
* visible, return asterisks
*/
static void *
gtk_editable_get_public_chars (GtkEditable *editable,
gint start,
gint end)
{
if (editable->visible)
return gtk_editable_get_chars (editable, start, end);
else
{
gint i;
gint nchars = end - start;
gchar *str;
if (nchars < 0)
nchars = -nchars;
str = g_new (gchar, nchars + 1);
for (i = 0; i<nchars; i++)
str[i] = '*';
str[i] = '\0';
return str;
}
}
static void
gtk_editable_set_selection (GtkEditable *editable,
gint start_pos,
......@@ -568,9 +601,9 @@ gtk_editable_selection_get (GtkWidget *widget,
{
selection_start_pos = MIN (editable->selection_start_pos, editable->selection_end_pos);
selection_end_pos = MAX (editable->selection_start_pos, editable->selection_end_pos);
str = gtk_editable_get_chars(editable,
selection_start_pos,
selection_end_pos);
str = gtk_editable_get_public_chars(editable,
selection_start_pos,
selection_end_pos);
if (!str)
return; /* Refuse */
length = strlen (str);
......@@ -890,9 +923,9 @@ gtk_editable_real_copy_clipboard (GtkEditable *editable)
if (gtk_selection_owner_set (GTK_WIDGET (editable),
clipboard_atom,
time))
editable->clipboard_text = gtk_editable_get_chars (editable,
selection_start_pos,
selection_end_pos);
editable->clipboard_text = gtk_editable_get_public_chars (editable,
selection_start_pos,
selection_end_pos);
}
}
......
......@@ -51,6 +51,7 @@ struct _GtkEditable
guint selection_end_pos;
guint has_selection : 1;
guint editable : 1;
guint visible : 1;
GdkIC *ic;
GdkICAttr *ic_attr;
......
......@@ -326,7 +326,7 @@ gtk_entry_get_arg (GtkObject *object,
GTK_VALUE_UINT (*arg) = entry->text_max_length;
break;
case ARG_VISIBILITY:
GTK_VALUE_BOOL (*arg) = entry->visible;
GTK_VALUE_BOOL (*arg) = GTK_EDITABLE (entry)->visible;
break;
default:
arg->type = GTK_TYPE_INVALID;
......@@ -460,7 +460,8 @@ gtk_entry_set_visibility (GtkEntry *entry,
g_return_if_fail (entry != NULL);
g_return_if_fail (GTK_IS_ENTRY (entry));
entry->visible = visible;
entry->visible = visible ? TRUE : FALSE;
GTK_EDITABLE (entry)->visible = visible ? TRUE : FALSE;
gtk_entry_recompute_offsets (entry);
gtk_widget_queue_draw (GTK_WIDGET (entry));
}
......@@ -1344,8 +1345,8 @@ gtk_entry_draw_text (GtkEntry *entry)
selection_end_xoffset =
entry->char_offset[selection_end_pos] -entry->scroll_offset;
/* if entry->visible, print a bunch of stars. If not, print the standard text. */
if (entry->visible)
/* if editable->visible, print a bunch of stars. If not, print the standard text. */
if (editable->visible)
{
toprint = entry->text + start_pos;
}
......@@ -1391,7 +1392,7 @@ gtk_entry_draw_text (GtkEntry *entry)
toprint + selection_end_pos - start_pos,
end_pos - selection_end_pos);
/* free the space allocated for the stars if it's neccessary. */
if (!entry->visible)
if (!editable->visible)
g_free (toprint);
if (editable->editable)
......@@ -1725,7 +1726,7 @@ gtk_entry_insert_text (GtkEditable *editable,
for (i=start_pos; i<end_pos; i++)
{
entry->char_offset[i] = entry->char_offset[start_pos] + offset;
if (entry->visible)
if (editable->visible)
{
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
entry->text[i]);
......@@ -1756,7 +1757,7 @@ gtk_entry_recompute_offsets (GtkEntry *entry)
for (i=0; i<entry->text_length; i++)
{
entry->char_offset[i] = offset;
if (entry->visible)
if (GTK_EDITABLE (entry)->visible)
{
offset += gdk_char_width_wc (GTK_WIDGET (entry)->style->font,
entry->text[i]);
......
......@@ -52,7 +52,7 @@ struct _GtkEntry
guint16 text_length; /* length in use */
guint16 text_max_length;
gint scroll_offset;
guint visible : 1;
guint visible : 1; /* deprecated - see editable->visible */
guint32 timer;
guint button;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment