remove the reset of first_sel_changed, as after the first popup the

Mon Oct 13 21:01:43 2003  Kristian Rietveld  <kris@gtk.org>

	* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
	the reset of first_sel_changed, as after the first popup the treeview
	will always have a row selected and will thus not focus_to_cursor.

	* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
	whether the keyval should move the completion selection cursor (used
	to avoid ending up with extreme cluttered code), also added
	all KP_ equivalents of the keys here,
	(gtk_entry_completion_key_press): Keynav tweaks based on comments
	from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
	as possible current selection, implement Home/End keys, modified
	the down key to stop cycling. Maybe page up/down should be implemented
	at some later time.
This commit is contained in:
Kristian Rietveld 2003-10-13 19:07:34 +00:00 committed by Kristian Rietveld
parent 2baa63a100
commit 027d69003e
7 changed files with 114 additions and 9 deletions

View File

@ -1,3 +1,19 @@
Mon Oct 13 21:01:43 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
the reset of first_sel_changed, as after the first popup the treeview
will always have a row selected and will thus not focus_to_cursor.
* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
whether the keyval should move the completion selection cursor (used
to avoid ending up with extreme cluttered code), also added
all KP_ equivalents of the keys here,
(gtk_entry_completion_key_press): Keynav tweaks based on comments
from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
as possible current selection, implement Home/End keys, modified
the down key to stop cycling. Maybe page up/down should be implemented
at some later time.
Mon Oct 13 20:58:07 2003 Matthias Clasen <maclas@gmx.de>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work

View File

@ -1,3 +1,19 @@
Mon Oct 13 21:01:43 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
the reset of first_sel_changed, as after the first popup the treeview
will always have a row selected and will thus not focus_to_cursor.
* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
whether the keyval should move the completion selection cursor (used
to avoid ending up with extreme cluttered code), also added
all KP_ equivalents of the keys here,
(gtk_entry_completion_key_press): Keynav tweaks based on comments
from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
as possible current selection, implement Home/End keys, modified
the down key to stop cycling. Maybe page up/down should be implemented
at some later time.
Mon Oct 13 20:58:07 2003 Matthias Clasen <maclas@gmx.de>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work

View File

@ -1,3 +1,19 @@
Mon Oct 13 21:01:43 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
the reset of first_sel_changed, as after the first popup the treeview
will always have a row selected and will thus not focus_to_cursor.
* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
whether the keyval should move the completion selection cursor (used
to avoid ending up with extreme cluttered code), also added
all KP_ equivalents of the keys here,
(gtk_entry_completion_key_press): Keynav tweaks based on comments
from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
as possible current selection, implement Home/End keys, modified
the down key to stop cycling. Maybe page up/down should be implemented
at some later time.
Mon Oct 13 20:58:07 2003 Matthias Clasen <maclas@gmx.de>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work

View File

@ -1,3 +1,19 @@
Mon Oct 13 21:01:43 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
the reset of first_sel_changed, as after the first popup the treeview
will always have a row selected and will thus not focus_to_cursor.
* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
whether the keyval should move the completion selection cursor (used
to avoid ending up with extreme cluttered code), also added
all KP_ equivalents of the keys here,
(gtk_entry_completion_key_press): Keynav tweaks based on comments
from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
as possible current selection, implement Home/End keys, modified
the down key to stop cycling. Maybe page up/down should be implemented
at some later time.
Mon Oct 13 20:58:07 2003 Matthias Clasen <maclas@gmx.de>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work

View File

@ -1,3 +1,19 @@
Mon Oct 13 21:01:43 2003 Kristian Rietveld <kris@gtk.org>
* gtk/gtkentrycompletion.c (gtk_entry_completion_popup): remove
the reset of first_sel_changed, as after the first popup the treeview
will always have a row selected and will thus not focus_to_cursor.
* gtk/gtkentry.c (keyval_is_cursor_move): new function to determine
whether the keyval should move the completion selection cursor (used
to avoid ending up with extreme cluttered code), also added
all KP_ equivalents of the keys here,
(gtk_entry_completion_key_press): Keynav tweaks based on comments
from Dave Bordoley and Marco Pesenti Gritti; add the -1 state
as possible current selection, implement Home/End keys, modified
the down key to stop cycling. Maybe page up/down should be implemented
at some later time.
Mon Oct 13 20:58:07 2003 Matthias Clasen <maclas@gmx.de>
* gdk/x11/gdkwindow-x11.c (gdk_window_set_icon): Make it work

View File

@ -4511,6 +4511,24 @@ gtk_entry_completion_timeout (gpointer data)
return FALSE;
}
static inline gboolean
keyval_is_cursor_move (guint keyval)
{
if (keyval == GDK_Up || keyval == GDK_KP_Up)
return TRUE;
if (keyval == GDK_Down || keyval == GDK_KP_Down)
return TRUE;
if (keyval == GDK_Home || keyval == GDK_KP_Home)
return TRUE;
if (keyval == GDK_End || keyval == GDK_KP_End)
return TRUE;
return FALSE;
}
static gboolean
gtk_entry_completion_key_press (GtkWidget *widget,
GdkEventKey *event,
@ -4527,24 +4545,33 @@ gtk_entry_completion_key_press (GtkWidget *widget,
if (completion->priv->actions)
actions = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->actions), NULL);
if (event->keyval == GDK_Up || event->keyval == GDK_Down)
if (keyval_is_cursor_move (event->keyval))
{
GtkTreePath *path = NULL;
if (event->keyval == GDK_Up)
if (event->keyval == GDK_Up || event->keyval == GDK_KP_Up)
{
completion->priv->current_selected--;
if (completion->priv->current_selected < 0)
completion->priv->current_selected = 0;
if (completion->priv->current_selected < -1)
completion->priv->current_selected = -1;
}
else
else if (event->keyval == GDK_Down || event->keyval == GDK_KP_Down)
{
completion->priv->current_selected++;
if (completion->priv->current_selected >= matches + actions)
completion->priv->current_selected = 0;
completion->priv->current_selected = matches + actions;
}
else if (event->keyval == GDK_Home || event->keyval == GDK_KP_Home)
completion->priv->current_selected = -1;
else if (event->keyval == GDK_End || event->keyval == GDK_KP_End)
completion->priv->current_selected = matches + actions - 1;
if (completion->priv->current_selected < matches)
if (completion->priv->current_selected < 0)
{
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->tree_view)));
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)));
}
else if (completion->priv->current_selected < matches)
{
gtk_tree_selection_unselect_all (gtk_tree_view_get_selection (GTK_TREE_VIEW (completion->priv->action_view)));

View File

@ -1040,8 +1040,6 @@ _gtk_entry_completion_popup (GtkEntryCompletion *completion)
if (GTK_WIDGET_MAPPED (completion->priv->popup_window))
return;
completion->priv->first_sel_changed = TRUE;
gtk_widget_show_all (completion->priv->vbox);
gdk_window_get_origin (completion->priv->entry->window, &x, &y);