summaryrefslogtreecommitdiff
path: root/src/image.c
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>2007-05-24 02:14:22 +0000
committerMiles Bader <miles@gnu.org>2007-05-24 02:14:22 +0000
commit24236bd83e64a3cfa96f01af3b2a925dd234612d (patch)
tree77873f1d6ae4b869cc4264a9e113977cad7ac592 /src/image.c
parentf9263a779af1a6436e05c87756747eb13883593b (diff)
parent698c8370d994f75b78ca711a3144f18b0a26ca89 (diff)
downloademacs-24236bd83e64a3cfa96f01af3b2a925dd234612d.tar.gz
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 762-764) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 22-23) - Update from CVS Revision: emacs@sv.gnu.org/emacs--multi-tty--0--patch-15
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/image.c b/src/image.c
index 5243778526e..dbe200195d0 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1631,6 +1631,27 @@ make_image_cache ()
}
+/* Search frame F for an images with spec SPEC, and free it. */
+
+static void
+uncache_image (f, spec)
+ struct frame *f;
+ Lisp_Object spec;
+{
+ struct image_cache *c = FRAME_X_IMAGE_CACHE (f);
+ struct image *img = IMAGE_FROM_ID (f, lookup_image (f, spec));
+ unsigned hash = sxhash (spec, 0);
+ int i = hash % IMAGE_CACHE_BUCKETS_SIZE;
+
+ for (img = c->buckets[i]; img; img = img->next)
+ if (img->hash == hash && !NILP (Fequal (img->spec, spec)))
+ {
+ free_image (f, img);
+ break;
+ }
+}
+
+
/* Free image cache of frame F. Be aware that X frames share images
caches. */
@@ -1741,6 +1762,36 @@ FRAME t means clear the image caches of all frames. */)
}
+DEFUN ("image-refresh", Fimage_refresh, Simage_refresh,
+ 1, 2, 0,
+ doc: /* Refresh the image with specification SPEC on frame FRAME.
+If SPEC specifies an image file, the displayed image is updated with
+the current contents of that file.
+FRAME nil or omitted means use the selected frame.
+FRAME t means refresh the image on all frames. */)
+ (spec, frame)
+ Lisp_Object spec, frame;
+{
+ if (!valid_image_p (spec))
+ error ("Invalid image specification");
+
+ if (EQ (frame, Qt))
+ {
+ Lisp_Object tail;
+ FOR_EACH_FRAME (tail, frame)
+ {
+ struct frame *f = XFRAME (frame);
+ if (FRAME_WINDOW_P (f))
+ uncache_image (f, spec);
+ }
+ }
+ else
+ uncache_image (check_x_frame (frame), spec);
+
+ return Qnil;
+}
+
+
/* Compute masks and transform image IMG on frame F, as specified
by the image's specification, */
@@ -8662,6 +8713,7 @@ non-numeric, there is no explicit limit on the size of images. */);
defsubr (&Sinit_image_library);
defsubr (&Sclear_image_cache);
+ defsubr (&Simage_refresh);
defsubr (&Simage_size);
defsubr (&Simage_mask_p);
defsubr (&Simage_extension_data);