summaryrefslogtreecommitdiff
path: root/gtk/gtkentry.c
diff options
context:
space:
mode:
authorOwen Taylor <owt1@cornell.edu>1998-03-05 06:32:42 +0000
committerOwen Taylor <otaylor@src.gnome.org>1998-03-05 06:32:42 +0000
commitba55b3f94ba99f24b424c879eaeafe47b932f189 (patch)
tree279b8b989d63267fa2290262bff6d97289a21512 /gtk/gtkentry.c
parent793a130520350f91d3b2c42956b596eb13824f41 (diff)
downloadgtk+-ba55b3f94ba99f24b424c879eaeafe47b932f189.tar.gz
Unset allocation on unparent, to force reallocation if we get adding back
Thu Mar 5 01:22:06 1998 Owen Taylor <owt1@cornell.edu> * gtk/gtkwidget.c (gtk_widget_unparent): Unset allocation on unparent, to force reallocation if we get adding back to a new parent which is already size-allocated. * gtk/gtktreeitem.c: Keep track of separate +/- pixmaps for each colormap, removed the idle hack. * gdk/gdk.c: Don't warn when unable to open XIM method, since X11R5 apparently has no default method. * gtk/gtkwidget.c (gtk_widget_set_style_internal): Don't call size_request on initial emission - since the widget size isn't set yet, it can't change. * gtk/Makefile.am: New rules 'test' and 'test-debug' to run testgtk with the correct working directory. * gtk/gtkentry.c (gtk_move_forward_word): Check for position at end of line. * gtk/gtkinputdialog.h (struct _GtkInputDialogClass): removed 'gpointer data' arguments from default handler structures.
Diffstat (limited to 'gtk/gtkentry.c')
-rw-r--r--gtk/gtkentry.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index c970a0c4ad..a504240ec2 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -731,6 +731,9 @@ gtk_entry_button_press (GtkWidget *widget,
gtk_grab_add (widget);
tmp_pos = gtk_entry_position (entry, event->x + entry->scroll_offset);
+ /* Set it now, so we display things right. We'll unset it
+ * later if things don't work out */
+ editable->has_selection = TRUE;
gtk_entry_set_selection (editable, tmp_pos, tmp_pos);
editable->current_pos = editable->selection_start_pos;
break;
@@ -749,7 +752,7 @@ gtk_entry_button_press (GtkWidget *widget,
}
else if (event->type == GDK_BUTTON_PRESS)
{
- if (event->button == 2)
+ if ((event->button == 2) && editable->editable)
{
if (editable->selection_start_pos == editable->selection_end_pos ||
editable->has_selection)
@@ -765,6 +768,9 @@ gtk_entry_button_press (GtkWidget *widget,
gtk_entry_set_selection (editable, tmp_pos, tmp_pos);
editable->has_selection = FALSE;
editable->current_pos = editable->selection_start_pos;
+
+ if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
+ gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, event->time);
}
}
@@ -795,10 +801,9 @@ gtk_entry_button_release (GtkWidget *widget,
if (gtk_selection_owner_set (widget,
GDK_SELECTION_PRIMARY,
event->time))
- {
- editable->has_selection = TRUE;
- gtk_entry_queue_draw (entry);
- }
+ editable->has_selection = TRUE;
+ else
+ gtk_entry_queue_draw (entry);
}
else
{
@@ -809,8 +814,6 @@ gtk_entry_button_release (GtkWidget *widget,
else if (event->button == 3)
{
gtk_grab_remove (widget);
- if (gdk_selection_owner_get (GDK_SELECTION_PRIMARY) == widget->window)
- gtk_selection_owner_set (NULL, GDK_SELECTION_PRIMARY, event->time);
}
return FALSE;
@@ -1577,7 +1580,7 @@ gtk_move_forward_word (GtkEntry *entry)
GtkEditable *editable;
editable = GTK_EDITABLE (entry);
- if (entry->text)
+ if (entry->text && (editable->current_pos < entry->text_length))
{
text = entry->text;
i = editable->current_pos;