when focussing the widget, select the palette's first entry if none is

2005-08-17  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimppaletteview.c (gimp_palette_view_focus): when
	focussing the widget, select the palette's first entry if none is
	selected. Enables cursor navigation after tabbing in.
This commit is contained in:
Michael Natterer 2005-08-17 01:25:20 +00:00 committed by Michael Natterer
parent 95e014f514
commit 047a01e24f
2 changed files with 13 additions and 3 deletions

View File

@ -1,3 +1,9 @@
2005-08-17 Michael Natterer <mitch@gimp.org>
* app/widgets/gimppaletteview.c (gimp_palette_view_focus): when
focussing the widget, select the palette's first entry if none is
selected. Enables cursor navigation after tabbing in.
2005-08-17 Sven Neumann <sven@gimp.org> 2005-08-17 Sven Neumann <sven@gimp.org>
* plug-ins/common/deinterlace.c: fixed boundary conditions. * plug-ins/common/deinterlace.c: fixed boundary conditions.

View File

@ -315,10 +315,17 @@ gimp_palette_view_focus (GtkWidget *widget,
GtkDirectionType direction) GtkDirectionType direction)
{ {
GimpPaletteView *view = GIMP_PALETTE_VIEW (widget); GimpPaletteView *view = GIMP_PALETTE_VIEW (widget);
GimpPalette *palette;
palette = GIMP_PALETTE (GIMP_VIEW (view)->renderer->viewable);
if (GTK_WIDGET_CAN_FOCUS (widget) && ! GTK_WIDGET_HAS_FOCUS (widget)) if (GTK_WIDGET_CAN_FOCUS (widget) && ! GTK_WIDGET_HAS_FOCUS (widget))
{ {
gtk_widget_grab_focus (widget); gtk_widget_grab_focus (widget);
if (! view->selected && palette->colors)
gimp_palette_view_select_entry (view, palette->colors->data);
return TRUE; return TRUE;
} }
@ -351,12 +358,9 @@ gimp_palette_view_focus (GtkWidget *widget,
if (skip != 0) if (skip != 0)
{ {
GimpPalette *palette;
GimpPaletteEntry *entry; GimpPaletteEntry *entry;
gint position; gint position;
palette = GIMP_PALETTE (GIMP_VIEW (view)->renderer->viewable);
position = view->selected->position + skip; position = view->selected->position + skip;
entry = g_list_nth_data (palette->colors, position); entry = g_list_nth_data (palette->colors, position);