From 40b5c7d03a1004506c324b6af69f84b1a381f471 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Fri, 22 Sep 2023 14:33:02 +1000 Subject: [PATCH] Remove meaning for str2 arg to Draw:image and Draw:image-size The 'str2' arg is passed to the command when the image name start "comm:". However this was never use and it is not clear that the caller could ever have a useful string to pass. All details of how to find the images can be encoded in the command name. So drop all use for str2 in Draw:image and Draw:image-size handlers. Signed-off-by: NeilBrown --- DOC/Calls | 5 ++--- display-ncurses.c | 4 ++-- display-x11-xcb.c | 4 ++-- python/display-pygtk.py | 8 ++++---- 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/DOC/Calls b/DOC/Calls index 3a033a89..db194877 100644 --- a/DOC/Calls +++ b/DOC/Calls @@ -118,9 +118,8 @@ comm2 as the (x,y) pair. Draw an image on the pane (or ancestor which as been cleared). - str1 identifies the images, either "file:FILENAME" or "comm:COMMAND". - If "comm:" the command is run with 'str2' passed as arg 'str1', and - result should be returned as 'bytes' (comm2 called with ->str1 as - array of bytes, ->num1 as length). + If "comm:" the command is run and result should be returned as 'bytes' + (comm2 called with ->str1 as array of bytes, ->num1 as length). - num is the 'or' of the following bit flags: - 16 stretch image to exactly fit pane. If set, lower bits are ignored. Otherwise image will fill the pane in one dimension, and be positioning diff --git a/display-ncurses.c b/display-ncurses.c index 07c3dab5..5449a084 100644 --- a/display-ncurses.c +++ b/display-ncurses.c @@ -1034,7 +1034,7 @@ DEF_CMD(nc_draw_image) } else if (strstarts(ci->str, "comm:")) { struct call_return cr; wd = NewMagickWand(); - cr = call_ret(bytes, ci->str+5, ci->focus, 0, NULL, ci->str2); + cr = call_ret(bytes, ci->str+5, ci->focus); if (!cr.s) { DestroyMagickWand(wd); return Efail; @@ -1168,7 +1168,7 @@ DEF_CMD(nc_image_size) } else if (strstarts(ci->str, "comm:")) { struct call_return cr; wd = NewMagickWand(); - cr = call_ret(bytes, ci->str+5, ci->focus, 0, NULL, ci->str2); + cr = call_ret(bytes, ci->str+5, ci->focus); if (!cr.s) { DestroyMagickWand(wd); return Efail; diff --git a/display-x11-xcb.c b/display-x11-xcb.c index 817989b2..55e631fa 100644 --- a/display-x11-xcb.c +++ b/display-x11-xcb.c @@ -854,7 +854,7 @@ DEF_CMD(xcb_draw_image) } else if (strstarts(ci->str, "comm:")) { struct call_return cr; wd = NewMagickWand(); - cr = call_ret(bytes, ci->str+5, ci->focus, 0, NULL, ci->str2); + cr = call_ret(bytes, ci->str+5, ci->focus); if (!cr.s) { DestroyMagickWand(wd); return Efail; @@ -949,7 +949,7 @@ DEF_CMD(xcb_image_size) } else if (strstarts(ci->str, "comm:")) { struct call_return cr; wd = NewMagickWand(); - cr = call_ret(bytes, ci->str+5, ci->focus, 0, NULL, ci->str2); + cr = call_ret(bytes, ci->str+5, ci->focus); if (!cr.s) { DestroyMagickWand(wd); return Efail; diff --git a/python/display-pygtk.py b/python/display-pygtk.py index b979ac6b..fa9499cf 100644 --- a/python/display-pygtk.py +++ b/python/display-pygtk.py @@ -276,7 +276,7 @@ class EdDisplay(edlib.Pane): return True - def handle_image(self, key, num, focus, str, str2, xy, **a): + def handle_image(self, key, num, focus, str, xy, **a): "handle:Draw:image" self.damaged(edlib.DAMAGED_POSTORDER) # 'str' identifies the image. Options are: @@ -302,7 +302,7 @@ class EdDisplay(edlib.Pane): if str.startswith("file:"): pb = GdkPixbuf.Pixbuf.new_from_file(str[5:]) elif str.startswith("comm:"): - img = focus.call(str[5:], str2, ret='bytes') + img = focus.call(str[5:], ret='bytes') io = Gio.MemoryInputStream.new_from_data(img) pb = GdkPixbuf.Pixbuf.new_from_stream(io) else: @@ -344,7 +344,7 @@ class EdDisplay(edlib.Pane): cr.stroke() return True - def handle_image_size(self, key, focus, str1, str2, comm2, **a): + def handle_image_size(self, key, focus, str1, comm2, **a): "handle:Draw:image-size" if not str1 or not comm2: return edlib.Enoarg @@ -352,7 +352,7 @@ class EdDisplay(edlib.Pane): if str1.startswith("file:"): pb = GdkPixbuf.Pixbuf.new_from_file(str1[5:]) elif str1.startswith("comm:"): - img = focus.call(str1[5:], str2, ret='bytes') + img = focus.call(str1[5:], ret='bytes') io = Gio.MemoryInputStream.new_from_data(img) pb = GdkPixbuf.Pixbuf.new_from_stream(io) else: -- 2.39.5