changeset 1482:dac747d99394

fixed keyboard focus on start-up https://sourceforge.net/tracker/?func=detail&aid=2707025&group_id=222125&atid=1054680
author nadvornik
date Sat, 28 Mar 2009 15:51:21 +0000
parents 96897bd5f6cd
children 7cb24fdf07c0
files src/image.c src/image.h src/layout.c
diffstat 3 files changed, 16 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/image.c	Sat Mar 28 15:31:04 2009 +0000
+++ b/src/image.c	Sat Mar 28 15:51:21 2009 +0000
@@ -1555,6 +1555,19 @@
 	gtk_container_set_border_width(GTK_CONTAINER(imd->frame), selectable ? 4 : 0);
 }
 
+void image_grab_focus(ImageWindow *imd)
+{
+	if (imd->has_frame)
+		{
+		gtk_widget_grab_focus(imd->frame);
+		}
+	else
+		{
+		gtk_widget_grab_focus(imd->widget);
+		}
+}
+
+
 /*
  *-------------------------------------------------------------------
  * prefs sync
--- a/src/image.h	Sat Mar 28 15:31:04 2009 +0000
+++ b/src/image.h	Sat Mar 28 15:51:21 2009 +0000
@@ -49,6 +49,7 @@
 void image_select(ImageWindow *imd, gboolean select);
 void image_set_selectable(ImageWindow *imd, gboolean selectable);
 
+void image_grab_focus(ImageWindow *imd);
 /* path, name */
 const gchar *image_get_path(ImageWindow *imd);
 const gchar *image_get_name(ImageWindow *imd);
--- a/src/layout.c	Sat Mar 28 15:31:04 2009 +0000
+++ b/src/layout.c	Sat Mar 28 15:51:21 2009 +0000
@@ -1683,7 +1683,7 @@
 
 		layout_tools_setup(lw, tools, files);
 
-		gtk_widget_grab_focus(lw->image->widget);
+		image_grab_focus(lw->image);
 
 		return;
 		}
@@ -1750,7 +1750,7 @@
 	gtk_paned_set_position(GTK_PANED(lw->h_pane), lw->options.main_window.hdivider_pos);
 	gtk_paned_set_position(GTK_PANED(lw->v_pane), lw->options.main_window.vdivider_pos);
 
-	gtk_widget_grab_focus(lw->image->widget);
+	image_grab_focus(lw->image);
 }
 
 void layout_style_set(LayoutWindow *lw, gint style, const gchar *order)