Mercurial > geeqie.yaz
changeset 1481:96897bd5f6cd
active image follows keyboard focus
author | nadvornik |
---|---|
date | Sat, 28 Mar 2009 15:31:04 +0000 |
parents | 077924265c28 |
children | dac747d99394 |
files | src/image.c src/image.h src/layout_image.c src/typedefs.h |
diffstat | 4 files changed, 33 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/image.c Sat Mar 28 15:09:09 2009 +0000 +++ b/src/image.c Sat Mar 28 15:31:04 2009 +0000 @@ -867,6 +867,11 @@ GTK_WIDGET_SET_FLAGS(imd->widget, GTK_HAS_FOCUS); image_focus_paint(imd, TRUE, NULL); + if (imd->func_focus_in) + { + imd->func_focus_in(imd, imd->data_focus_in); + } + return TRUE; } @@ -974,6 +979,14 @@ imd->data_scroll_notify = data; } +void image_set_focus_in_func(ImageWindow *imd, + void (*func)(ImageWindow *, gpointer), + gpointer data) +{ + imd->func_focus_in = func; + imd->data_focus_in = data; +} + /* path, name */ const gchar *image_get_path(ImageWindow *imd)
--- a/src/image.h Sat Mar 28 15:09:09 2009 +0000 +++ b/src/image.h Sat Mar 28 15:31:04 2009 +0000 @@ -33,6 +33,9 @@ void image_set_scroll_func(ImageWindow *imd, void (*func)(ImageWindow *, GdkEventScroll *event, gpointer), gpointer data); +void image_set_focus_in_func(ImageWindow *imd, + void (*func)(ImageWindow *, gpointer), + gpointer data); void image_set_scroll_notify_func(ImageWindow *imd, void (*func)(ImageWindow *imd, gint x, gint y, gint width, gint height, gpointer data), gpointer data);
--- a/src/layout_image.c Sat Mar 28 15:09:09 2009 +0000 +++ b/src/layout_image.c Sat Mar 28 15:31:04 2009 +0000 @@ -1331,6 +1331,19 @@ return -1; } +static void layout_image_focus_in_cb(ImageWindow *imd, gpointer data) +{ + LayoutWindow *lw = data; + + gint i = image_idx(lw, imd); + + if (i != -1) + { + DEBUG_1("image activate focus_in %d", i); + layout_image_activate(lw, i); + } +} + static void layout_image_button_cb(ImageWindow *imd, GdkEventButton *event, gpointer data) { @@ -1604,6 +1617,8 @@ gtk_size_group_add_widget(lw->split_image_sizegroup, lw->split_images[i]->widget); gtk_widget_set_size_request(lw->split_images[i]->widget, IMAGE_MIN_WIDTH, -1); + image_set_focus_in_func(lw->split_images[i], layout_image_focus_in_cb, lw); + } return lw->split_images[i]->widget;
--- a/src/typedefs.h Sat Mar 28 15:09:09 2009 +0000 +++ b/src/typedefs.h Sat Mar 28 15:31:04 2009 +0000 @@ -394,10 +394,12 @@ void (*func_button)(ImageWindow *, GdkEventButton *event, gpointer); void (*func_drag)(ImageWindow *, GdkEventButton *event, gdouble dx, gdouble dy, gpointer); void (*func_scroll)(ImageWindow *, GdkEventScroll *event, gpointer); + void (*func_focus_in)(ImageWindow *, gpointer); gpointer data_button; gpointer data_drag; gpointer data_scroll; + gpointer data_focus_in; /* scroll notification (for scroll bar implementation) */ void (*func_scroll_notify)(ImageWindow *, gint x, gint y, gint width, gint height, gpointer);