# HG changeset patch # User Matti Hamalainen # Date 1520182905 -7200 # Node ID 28978fd4c26382630e058b944d13a7693a0a6786 # Parent 45f1c76fd78b9c40dcd4d3812f25d2daa99874ac# Parent cff064279094f01d6ade64562de8dde95d8f599c Merge. diff -r 45f1c76fd78b -r 28978fd4c263 doc/docbook/GuideReferenceCommandLine.xml --- a/doc/docbook/GuideReferenceCommandLine.xml Thu Mar 01 22:57:28 2018 +0200 +++ b/doc/docbook/GuideReferenceCommandLine.xml Sun Mar 04 19:01:45 2018 +0200 @@ -223,6 +223,11 @@ + --pixel-info + Print X, Y and RGB of mouse pointer on current image + + + view:<file> Open new window containing <file> diff -r 45f1c76fd78b -r 28978fd4c263 geeqie.1 --- a/geeqie.1 Thu Mar 01 22:57:28 2018 +0200 +++ b/geeqie.1 Sun Mar 04 19:01:45 2018 +0200 @@ -168,6 +168,10 @@ Print filename of current image. .br .B +.IP \-\-pixel\-info +Print X, Y and RGB of mouse pointer on current image. +.br +.B .IP \-\-view: Open FILE in new window. .br diff -r 45f1c76fd78b -r 28978fd4c263 src/layout.c --- a/src/layout.c Thu Mar 01 22:57:28 2018 +0200 +++ b/src/layout.c Sun Mar 04 19:01:45 2018 +0200 @@ -234,6 +234,7 @@ { if ((!lw->dir_fd || strcmp(lw->dir_fd->path, buf) != 0) && layout_set_path(lw, buf)) { + gtk_widget_grab_focus(GTK_WIDGET(lw->path_entry)); gint pos = -1; /* put the G_DIR_SEPARATOR back, if we are in tab completion for a dir and result was path change */ gtk_editable_insert_text(GTK_EDITABLE(lw->path_entry), G_DIR_SEPARATOR_S, -1, &pos); diff -r 45f1c76fd78b -r 28978fd4c263 src/remote.c --- a/src/remote.c Thu Mar 01 22:57:28 2018 +0200 +++ b/src/remote.c Sun Mar 04 19:01:45 2018 +0200 @@ -30,6 +30,7 @@ #include "layout.h" #include "layout_image.h" #include "misc.h" +#include "pixbuf-renderer.h" #include "slideshow.h" #include "ui_fileops.h" #include "rcfile.h" @@ -608,6 +609,51 @@ gr_raise(text, channel, data); } +static void gr_pixel_info(const gchar *text, GIOChannel *channel, gpointer data) +{ + gchar *pixel_info; + gint x_pixel, y_pixel; + gint width, height; + gint r_mouse, g_mouse, b_mouse; + PixbufRenderer *pr; + LayoutWindow *lw = NULL; + + if (!layout_valid(&lw)) return; + + pr = (PixbufRenderer*)lw->image->pr; + + if (pr) + { + pixbuf_renderer_get_image_size(pr, &width, &height); + if (width < 1 || height < 1) return; + + pixbuf_renderer_get_mouse_position(pr, &x_pixel, &y_pixel); + + if (x_pixel >= 0 && y_pixel >= 0) + { + pixbuf_renderer_get_pixel_colors(pr, x_pixel, y_pixel, + &r_mouse, &g_mouse, &b_mouse); + + pixel_info = g_strdup_printf(_("[%d,%d]: RGB(%3d,%3d,%3d)"), + x_pixel, y_pixel, + r_mouse, g_mouse, b_mouse); + + g_io_channel_write_chars(channel, pixel_info, -1, NULL, NULL); + g_io_channel_write_chars(channel, "\n", -1, NULL, NULL); + + g_free(pixel_info); + } + else + { + return; + } + } + else + { + return; + } +} + static void gr_file_tell(const gchar *text, GIOChannel *channel, gpointer data) { LayoutWindow *lw = NULL; /* NULL to force layout_valid() to do some magic */ @@ -798,6 +844,7 @@ { NULL, "file:", gr_file_load, TRUE, FALSE, N_(""), N_("open FILE, bring Geeqie window to the top") }, { NULL, "File:", gr_file_load_no_raise, TRUE, FALSE, N_(""), N_("open FILE, do not bring Geeqie window to the top") }, { NULL, "--tell", gr_file_tell, FALSE, FALSE, NULL, N_("print filename of current image") }, + { NULL, "--pixel-info", gr_pixel_info, FALSE, FALSE, NULL, N_("print pixel info of mouse pointer on current image") }, { NULL, "view:", gr_file_view, TRUE, FALSE, N_(""), N_("open FILE in new window") }, { NULL, "--list-clear", gr_list_clear, FALSE, FALSE, NULL, N_("clear command line collection list") }, { NULL, "--list-add:", gr_list_add, TRUE, FALSE, N_(""), N_("add FILE to command line collection list") }, diff -r 45f1c76fd78b -r 28978fd4c263 web/help/GuideReferenceCommandLine.html --- a/web/help/GuideReferenceCommandLine.html Thu Mar 01 22:57:28 2018 +0200 +++ b/web/help/GuideReferenceCommandLine.html Sun Mar 04 19:01:45 2018 +0200 @@ -675,50 +675,55 @@ +--pixel-info +Print X, Y and RGB of mouse pointer on current image + + + view:<file> Open new window containing <file> - + --list-clear Clear command line collection list - + --list-add:<file> Add <file> to command line collection list - + raise Bring the geeqie window to the top - + -ct:clear|clean --cache-thumbs:clear|clean clear or clean thumbnail cache - + -cs:clear|clean --cache-shared:clear|clean clear or clean shared thumbnail cache - + -cm --cache-metadata clean the metadata cache - + -cr:<folder> --cache-render:<folder> render thumbnails - + -crr:<folder> --cache-render-recurse:<folder> render thumbnails recursively - + -crs:<folder> --cache-render-shared:<folder> @@ -726,12 +731,12 @@ 2 - + -crsr:<folder> --cache-render-shared-recurse:<folder> render thumbnails recursively - + --lua:<file>,<lua script> run lua script on file