diff options
| author | Karoly Lorentey | 2004-06-15 16:45:35 +0000 |
|---|---|---|
| committer | Karoly Lorentey | 2004-06-15 16:45:35 +0000 |
| commit | 933d4afdc9f1ac208cdf1f676a86cb471b450272 (patch) | |
| tree | a8ca26636b947f10a44f7f87ce2686d984f460df /src | |
| parent | 987a34896f0f07c76a87314ee444467903632aeb (diff) | |
| parent | 910dc292aa21fb21807009ffebda111a363ec438 (diff) | |
| download | emacs-933d4afdc9f1ac208cdf1f676a86cb471b450272.tar.gz emacs-933d4afdc9f1ac208cdf1f676a86cb471b450272.zip | |
Merged in changes from CVS trunk.
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-408
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-200
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 44 | ||||
| -rw-r--r-- | src/dispextern.h | 3 | ||||
| -rw-r--r-- | src/gtkutil.c | 115 | ||||
| -rw-r--r-- | src/image.c | 229 | ||||
| -rw-r--r-- | src/xdisp.c | 9 | ||||
| -rw-r--r-- | src/xterm.h | 2 |
6 files changed, 292 insertions, 110 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 5104ca9545c..e4bcca81ede 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,9 +1,51 @@ | |||
| 1 | 2004-06-14 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> | ||
| 2 | |||
| 3 | * gtkutil.c (xg_get_image_for_pixmap): New function. | ||
| 4 | (xg_get_gdk_pixmap_and_mask): Removed. | ||
| 5 | (update_frame_tool_bar): Call xg_get_image_for_pixmap instead of | ||
| 6 | xg_get_gdk_pixmap_and_mask. | ||
| 7 | |||
| 8 | * xterm.h (struct x_display_info): Typo in comment fixed. | ||
| 9 | |||
| 10 | 2004-06-14 Juanma Barranquero <lektu@terra.es> | ||
| 11 | |||
| 12 | * dispextern.h (Vimage_types): Make it conditional on | ||
| 13 | HAVE_WINDOW_SYSTEM. | ||
| 14 | |||
| 15 | * image.c (Vimage_types): Move from xdisp.c. | ||
| 16 | (Vimage_type_cache): New variable. | ||
| 17 | (define_image_type): New argument indicating whether an image | ||
| 18 | library was loaded; cache loaded status and return t on success, | ||
| 19 | nil otherwise. | ||
| 20 | (CACHE_IMAGE_TYPE, ADD_IMAGE_TYPE): New macros. | ||
| 21 | (w32_delayed_load): New function to load an image library from a | ||
| 22 | list of possible filenames. | ||
| 23 | (init_xpm_functions, init_png_functions, init_jpeg_functions) | ||
| 24 | (init_tiff_functions, init_gif_functions): Use `w32_delayed_load'. | ||
| 25 | (CHECK_LIB_AVAILABLE): Call `define_image_library' with new | ||
| 26 | argument. | ||
| 27 | (Finit_image_library): New function, extracted from `init_image'. | ||
| 28 | Try to initialize an image library on demand and cache whether we | ||
| 29 | were successful or not. | ||
| 30 | (syms_of_image): Initialize `Vimage_types' and | ||
| 31 | `Vimage_type_cache'. Add recognized image types to Vimage_types. | ||
| 32 | Export `init-image-library'. | ||
| 33 | (init_image): Remove initialization of all image types, except xbm | ||
| 34 | and pbm. | ||
| 35 | |||
| 36 | * xdisp.c (Vimage_types): Delete (moved to image.c). | ||
| 37 | |||
| 38 | 2004-06-14 Andreas Schwab <schwab@suse.de> | ||
| 39 | |||
| 40 | * minibuf.c (Ftry_completion, Fall_completions, Ftest_completion): | ||
| 41 | Avoid calling specbind when completion-regexp-list is empty. | ||
| 42 | |||
| 1 | 2004-06-13 Richard M. Stallman <rms@gnu.org> | 43 | 2004-06-13 Richard M. Stallman <rms@gnu.org> |
| 2 | 44 | ||
| 3 | * regex.h (CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t) | 45 | * regex.h (CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t) |
| 4 | (re_wctype, re_iswctype, re_wctype_to_bit): | 46 | (re_wctype, re_iswctype, re_wctype_to_bit): |
| 5 | Non-function definitions moved here from regex.c. | 47 | Non-function definitions moved here from regex.c. |
| 6 | 48 | ||
| 7 | * regex.c (re_wctype, re_iswctype): Function defs longer static. | 49 | * regex.c (re_wctype, re_iswctype): Function defs longer static. |
| 8 | (CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t) | 50 | (CHAR_CLASS_MAX_LENGTH, re_wctype_t, re_wchar_t) |
| 9 | (re_wctype, re_iswctype, re_wctype_to_bit): | 51 | (re_wctype, re_iswctype, re_wctype_to_bit): |
diff --git a/src/dispextern.h b/src/dispextern.h index 8a56e1dcc28..2b9ef2adbf0 100644 --- a/src/dispextern.h +++ b/src/dispextern.h | |||
| @@ -2560,7 +2560,6 @@ extern Lisp_Object Qtool_bar; | |||
| 2560 | extern Lisp_Object Vshow_trailing_whitespace; | 2560 | extern Lisp_Object Vshow_trailing_whitespace; |
| 2561 | extern int mode_line_in_non_selected_windows; | 2561 | extern int mode_line_in_non_selected_windows; |
| 2562 | extern int redisplaying_p; | 2562 | extern int redisplaying_p; |
| 2563 | extern Lisp_Object Vimage_types; | ||
| 2564 | extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object)); | 2563 | extern void add_to_log P_ ((char *, Lisp_Object, Lisp_Object)); |
| 2565 | extern int help_echo_showing_p; | 2564 | extern int help_echo_showing_p; |
| 2566 | extern int current_mode_line_height, current_header_line_height; | 2565 | extern int current_mode_line_height, current_header_line_height; |
| @@ -2646,6 +2645,8 @@ void w32_reset_fringes P_ ((void)); | |||
| 2646 | 2645 | ||
| 2647 | #ifdef HAVE_WINDOW_SYSTEM | 2646 | #ifdef HAVE_WINDOW_SYSTEM |
| 2648 | 2647 | ||
| 2648 | extern Lisp_Object Vimage_types; | ||
| 2649 | |||
| 2649 | extern int x_bitmap_height P_ ((struct frame *, int)); | 2650 | extern int x_bitmap_height P_ ((struct frame *, int)); |
| 2650 | extern int x_bitmap_width P_ ((struct frame *, int)); | 2651 | extern int x_bitmap_width P_ ((struct frame *, int)); |
| 2651 | extern int x_bitmap_pixmap P_ ((struct frame *, int)); | 2652 | extern int x_bitmap_pixmap P_ ((struct frame *, int)); |
diff --git a/src/gtkutil.c b/src/gtkutil.c index 82d5135d2bc..84aa9f46d4d 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c | |||
| @@ -229,23 +229,100 @@ xg_create_default_cursor (dpy) | |||
| 229 | return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); | 229 | return gdk_cursor_new_for_display (gdpy, GDK_LEFT_PTR); |
| 230 | } | 230 | } |
| 231 | 231 | ||
| 232 | /* For the image defined in IMG, make and return a GdkPixmap for | 232 | /* For the image defined in IMG, make and return a GtkImage. For displays with |
| 233 | the pixmap in *GPIX, and a GdkBitmap for the mask in *GMASK. | 233 | 8 planes or less we must make a GdkPixbuf and apply the mask manually. |
| 234 | If IMG has no mask, *GMASK is set to NULL. | 234 | Otherwise the highlightning and dimming the tool bar code in GTK does |
| 235 | The image is defined on the display where frame F is. */ | 235 | will look bad. For display with more than 8 planes we just use the |
| 236 | static void | 236 | pixmap and mask directly. For monochrome displays, GTK doesn't seem |
| 237 | xg_get_gdk_pixmap_and_mask (f, img, gpix, gmask) | 237 | able to use external pixmaps, it looks bad whatever we do. |
| 238 | The image is defined on the display where frame F is. | ||
| 239 | WIDGET is used to find the GdkColormap to use for the GdkPixbuf. | ||
| 240 | If OLD_WIDGET is NULL, a new widget is constructed and returned. | ||
| 241 | If OLD_WIDGET is not NULL, that widget is modified. */ | ||
| 242 | static GtkWidget * | ||
| 243 | xg_get_image_for_pixmap (f, img, widget, old_widget) | ||
| 238 | FRAME_PTR f; | 244 | FRAME_PTR f; |
| 239 | struct image *img; | 245 | struct image *img; |
| 240 | GdkPixmap **gpix; | 246 | GtkWidget *widget; |
| 241 | GdkBitmap **gmask; | 247 | GtkImage *old_widget; |
| 242 | { | 248 | { |
| 249 | GdkPixmap *gpix; | ||
| 250 | GdkPixmap *gmask; | ||
| 243 | GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); | 251 | GdkDisplay *gdpy = gdk_x11_lookup_xdisplay (FRAME_X_DISPLAY (f)); |
| 244 | 252 | ||
| 245 | *gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); | 253 | gpix = gdk_pixmap_foreign_new_for_display (gdpy, img->pixmap); |
| 246 | *gmask = img->mask ? | 254 | gmask = img->mask ? gdk_pixmap_foreign_new_for_display (gdpy, img->mask) : 0; |
| 247 | (GdkBitmap*) gdk_pixmap_foreign_new_for_display (gdpy, img->mask) | 255 | |
| 248 | : 0; | 256 | if (x_screen_planes (f) > 8 || x_screen_planes (f) == 1) |
| 257 | { | ||
| 258 | if (! old_widget) | ||
| 259 | old_widget = GTK_IMAGE (gtk_image_new_from_pixmap (gpix, gmask)); | ||
| 260 | else | ||
| 261 | gtk_image_set_from_pixmap (old_widget, gpix, gmask); | ||
| 262 | } | ||
| 263 | else | ||
| 264 | { | ||
| 265 | int x, y, width, height, rowstride, mask_rowstride; | ||
| 266 | GdkPixbuf *icon_buf, *tmp_buf; | ||
| 267 | guchar *pixels; | ||
| 268 | guchar *mask_pixels; | ||
| 269 | |||
| 270 | gdk_drawable_get_size (gpix, &width, &height); | ||
| 271 | tmp_buf = gdk_pixbuf_get_from_drawable (NULL, | ||
| 272 | gpix, | ||
| 273 | gtk_widget_get_colormap (widget), | ||
| 274 | 0, 0, 0, 0, width, height); | ||
| 275 | icon_buf = gdk_pixbuf_add_alpha (tmp_buf, FALSE, 0, 0, 0); | ||
| 276 | g_object_unref (G_OBJECT (tmp_buf)); | ||
| 277 | |||
| 278 | if (gmask) | ||
| 279 | { | ||
| 280 | GdkPixbuf *mask_buf = gdk_pixbuf_get_from_drawable (NULL, | ||
| 281 | gmask, | ||
| 282 | NULL, | ||
| 283 | 0, 0, 0, 0, | ||
| 284 | width, height); | ||
| 285 | guchar *pixels = gdk_pixbuf_get_pixels (icon_buf); | ||
| 286 | guchar *mask_pixels = gdk_pixbuf_get_pixels (mask_buf); | ||
| 287 | int rowstride = gdk_pixbuf_get_rowstride (icon_buf); | ||
| 288 | int mask_rowstride = gdk_pixbuf_get_rowstride (mask_buf); | ||
| 289 | int y; | ||
| 290 | |||
| 291 | for (y = 0; y < height; ++y) | ||
| 292 | { | ||
| 293 | guchar *iconptr, *maskptr; | ||
| 294 | int x; | ||
| 295 | |||
| 296 | iconptr = pixels + y * rowstride; | ||
| 297 | maskptr = mask_pixels + y * mask_rowstride; | ||
| 298 | |||
| 299 | for (x = 0; x < width; ++x) | ||
| 300 | { | ||
| 301 | /* In a bitmap, RGB is either 255/255/255 or 0/0/0. Checking | ||
| 302 | just R is sufficient. */ | ||
| 303 | if (maskptr[0] == 0) | ||
| 304 | iconptr[3] = 0; /* 0, 1, 2 is R, G, B. 3 is alpha. */ | ||
| 305 | |||
| 306 | iconptr += rowstride/width; | ||
| 307 | maskptr += mask_rowstride/width; | ||
| 308 | } | ||
| 309 | } | ||
| 310 | |||
| 311 | g_object_unref (G_OBJECT (gmask)); | ||
| 312 | g_object_unref (G_OBJECT (mask_buf)); | ||
| 313 | } | ||
| 314 | |||
| 315 | g_object_unref (G_OBJECT (gpix)); | ||
| 316 | |||
| 317 | if (! old_widget) | ||
| 318 | old_widget = GTK_IMAGE (gtk_image_new_from_pixbuf (icon_buf)); | ||
| 319 | else | ||
| 320 | gtk_image_set_from_pixbuf (old_widget, icon_buf); | ||
| 321 | |||
| 322 | g_object_unref (G_OBJECT (icon_buf)); | ||
| 323 | } | ||
| 324 | |||
| 325 | return GTK_WIDGET (old_widget); | ||
| 249 | } | 326 | } |
| 250 | 327 | ||
| 251 | 328 | ||
| @@ -3205,12 +3282,8 @@ update_frame_tool_bar (f) | |||
| 3205 | 3282 | ||
| 3206 | if (! wicon) | 3283 | if (! wicon) |
| 3207 | { | 3284 | { |
| 3208 | GdkPixmap *gpix; | 3285 | GtkWidget *w = xg_get_image_for_pixmap (f, img, x->widget, NULL); |
| 3209 | GdkBitmap *gmask; | ||
| 3210 | GtkWidget *w; | ||
| 3211 | 3286 | ||
| 3212 | xg_get_gdk_pixmap_and_mask (f, img, &gpix, &gmask); | ||
| 3213 | w = gtk_image_new_from_pixmap (gpix, gmask); | ||
| 3214 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), | 3287 | gtk_toolbar_append_item (GTK_TOOLBAR (x->toolbar_widget), |
| 3215 | 0, 0, 0, | 3288 | 0, 0, 0, |
| 3216 | w, | 3289 | w, |
| @@ -3267,13 +3340,7 @@ update_frame_tool_bar (f) | |||
| 3267 | g_list_free (chlist); | 3340 | g_list_free (chlist); |
| 3268 | 3341 | ||
| 3269 | if (old_img != img->pixmap) | 3342 | if (old_img != img->pixmap) |
| 3270 | { | 3343 | (void) xg_get_image_for_pixmap (f, img, x->widget, wimage); |
| 3271 | GdkPixmap *gpix; | ||
| 3272 | GdkBitmap *gmask; | ||
| 3273 | |||
| 3274 | xg_get_gdk_pixmap_and_mask (f, img, &gpix, &gmask); | ||
| 3275 | gtk_image_set_from_pixmap (wimage, gpix, gmask); | ||
| 3276 | } | ||
| 3277 | 3344 | ||
| 3278 | g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, | 3345 | g_object_set_data (G_OBJECT (wimage), XG_TOOL_BAR_IMAGE_DATA, |
| 3279 | (gpointer)img->pixmap); | 3346 | (gpointer)img->pixmap); |
diff --git a/src/image.c b/src/image.c index 41762030b9e..3eccf0f001e 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -606,6 +606,14 @@ x_create_bitmap_mask (f, id) | |||
| 606 | 606 | ||
| 607 | static struct image_type *image_types; | 607 | static struct image_type *image_types; |
| 608 | 608 | ||
| 609 | /* A list of symbols, one for each supported image type. */ | ||
| 610 | |||
| 611 | Lisp_Object Vimage_types; | ||
| 612 | |||
| 613 | /* Cache for delayed-loading image types. */ | ||
| 614 | |||
| 615 | static Lisp_Object Vimage_type_cache; | ||
| 616 | |||
| 609 | /* The symbol `xbm' which is used as the type symbol for XBM images. */ | 617 | /* The symbol `xbm' which is used as the type symbol for XBM images. */ |
| 610 | 618 | ||
| 611 | Lisp_Object Qxbm; | 619 | Lisp_Object Qxbm; |
| @@ -630,7 +638,7 @@ Lisp_Object Vimage_cache_eviction_delay; | |||
| 630 | 638 | ||
| 631 | /* Function prototypes. */ | 639 | /* Function prototypes. */ |
| 632 | 640 | ||
| 633 | static void define_image_type P_ ((struct image_type *type)); | 641 | static Lisp_Object define_image_type P_ ((struct image_type *type, int loaded)); |
| 634 | static struct image_type *lookup_image_type P_ ((Lisp_Object symbol)); | 642 | static struct image_type *lookup_image_type P_ ((Lisp_Object symbol)); |
| 635 | static void image_error P_ ((char *format, Lisp_Object, Lisp_Object)); | 643 | static void image_error P_ ((char *format, Lisp_Object, Lisp_Object)); |
| 636 | static void x_laplace P_ ((struct frame *, struct image *)); | 644 | static void x_laplace P_ ((struct frame *, struct image *)); |
| @@ -638,21 +646,37 @@ static void x_emboss P_ ((struct frame *, struct image *)); | |||
| 638 | static int x_build_heuristic_mask P_ ((struct frame *, struct image *, | 646 | static int x_build_heuristic_mask P_ ((struct frame *, struct image *, |
| 639 | Lisp_Object)); | 647 | Lisp_Object)); |
| 640 | 648 | ||
| 649 | #define CACHE_IMAGE_TYPE(type, status) \ | ||
| 650 | do { Vimage_type_cache = Fcons (Fcons (type, status), Vimage_type_cache); } while (0) | ||
| 651 | |||
| 652 | #define ADD_IMAGE_TYPE(type) \ | ||
| 653 | do { Vimage_types = Fcons (type, Vimage_types); } while (0) | ||
| 641 | 654 | ||
| 642 | /* Define a new image type from TYPE. This adds a copy of TYPE to | 655 | /* Define a new image type from TYPE. This adds a copy of TYPE to |
| 643 | image_types and adds the symbol *TYPE->type to Vimage_types. */ | 656 | image_types and caches the loading status of TYPE. */ |
| 644 | 657 | ||
| 645 | static void | 658 | static Lisp_Object |
| 646 | define_image_type (type) | 659 | define_image_type (type, loaded) |
| 647 | struct image_type *type; | 660 | struct image_type *type; |
| 661 | int loaded; | ||
| 648 | { | 662 | { |
| 649 | /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. | 663 | Lisp_Object success; |
| 650 | The initialized data segment is read-only. */ | 664 | |
| 651 | struct image_type *p = (struct image_type *) xmalloc (sizeof *p); | 665 | if (!loaded) |
| 652 | bcopy (type, p, sizeof *p); | 666 | success = Qnil; |
| 653 | p->next = image_types; | 667 | else |
| 654 | image_types = p; | 668 | { |
| 655 | Vimage_types = Fcons (*p->type, Vimage_types); | 669 | /* Make a copy of TYPE to avoid a bus error in a dumped Emacs. |
| 670 | The initialized data segment is read-only. */ | ||
| 671 | struct image_type *p = (struct image_type *) xmalloc (sizeof *p); | ||
| 672 | bcopy (type, p, sizeof *p); | ||
| 673 | p->next = image_types; | ||
| 674 | image_types = p; | ||
| 675 | success = Qt; | ||
| 676 | } | ||
| 677 | |||
| 678 | CACHE_IMAGE_TYPE(*type->type, success); | ||
| 679 | return success; | ||
| 656 | } | 680 | } |
| 657 | 681 | ||
| 658 | 682 | ||
| @@ -1789,6 +1813,33 @@ forall_images_in_image_cache (f, fn) | |||
| 1789 | if (!fn_##func) return 0; \ | 1813 | if (!fn_##func) return 0; \ |
| 1790 | } | 1814 | } |
| 1791 | 1815 | ||
| 1816 | /* Load a DLL implementing an image type. | ||
| 1817 | The `image-library-alist' variable associates a symbol, | ||
| 1818 | identifying an image type, to a list of possible filenames. | ||
| 1819 | The function returns NULL if no library could be loaded for | ||
| 1820 | the given image type, or if the library was previously loaded; | ||
| 1821 | else the handle of the DLL. */ | ||
| 1822 | static HMODULE | ||
| 1823 | w32_delayed_load (Lisp_Object libraries, Lisp_Object type) | ||
| 1824 | { | ||
| 1825 | HMODULE library = NULL; | ||
| 1826 | |||
| 1827 | if (CONSP (libraries) && NILP (Fassq (type, Vimage_type_cache))) | ||
| 1828 | { | ||
| 1829 | Lisp_Object dlls = Fassq (type, libraries); | ||
| 1830 | |||
| 1831 | if (CONSP (dlls)) | ||
| 1832 | for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) | ||
| 1833 | { | ||
| 1834 | CHECK_STRING_CAR (dlls); | ||
| 1835 | if (library = LoadLibrary (SDATA (XCAR (dlls)))) | ||
| 1836 | break; | ||
| 1837 | } | ||
| 1838 | } | ||
| 1839 | |||
| 1840 | return library; | ||
| 1841 | } | ||
| 1842 | |||
| 1792 | #endif /* HAVE_NTGUI */ | 1843 | #endif /* HAVE_NTGUI */ |
| 1793 | 1844 | ||
| 1794 | static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int, | 1845 | static int x_create_x_image_and_pixmap P_ ((struct frame *, int, int, int, |
| @@ -3489,13 +3540,12 @@ DEF_IMGLIB_FN (XpmCreateImageFromBuffer); | |||
| 3489 | DEF_IMGLIB_FN (XpmReadFileToImage); | 3540 | DEF_IMGLIB_FN (XpmReadFileToImage); |
| 3490 | DEF_IMGLIB_FN (XImageFree); | 3541 | DEF_IMGLIB_FN (XImageFree); |
| 3491 | 3542 | ||
| 3492 | |||
| 3493 | static int | 3543 | static int |
| 3494 | init_xpm_functions (void) | 3544 | init_xpm_functions (Lisp_Object libraries) |
| 3495 | { | 3545 | { |
| 3496 | HMODULE library; | 3546 | HMODULE library; |
| 3497 | 3547 | ||
| 3498 | if (!(library = LoadLibrary ("libXpm.dll"))) | 3548 | if (!(library = w32_delayed_load (libraries, Qxpm))) |
| 3499 | return 0; | 3549 | return 0; |
| 3500 | 3550 | ||
| 3501 | LOAD_IMGLIB_FN (library, XpmFreeAttributes); | 3551 | LOAD_IMGLIB_FN (library, XpmFreeAttributes); |
| @@ -5589,21 +5639,12 @@ DEF_IMGLIB_FN (png_read_end); | |||
| 5589 | DEF_IMGLIB_FN (png_error); | 5639 | DEF_IMGLIB_FN (png_error); |
| 5590 | 5640 | ||
| 5591 | static int | 5641 | static int |
| 5592 | init_png_functions (void) | 5642 | init_png_functions (Lisp_Object libraries) |
| 5593 | { | 5643 | { |
| 5594 | HMODULE library; | 5644 | HMODULE library; |
| 5595 | 5645 | ||
| 5596 | /* Ensure zlib is loaded. Try debug version first. */ | ||
| 5597 | if (!LoadLibrary ("zlibd.dll") | ||
| 5598 | && !LoadLibrary ("zlib.dll")) | ||
| 5599 | return 0; | ||
| 5600 | |||
| 5601 | /* Try loading libpng under probable names. */ | 5646 | /* Try loading libpng under probable names. */ |
| 5602 | if (!(library = LoadLibrary ("libpng13d.dll")) | 5647 | if (!(library = w32_delayed_load (libraries, Qpng))) |
| 5603 | && !(library = LoadLibrary ("libpng13.dll")) | ||
| 5604 | && !(library = LoadLibrary ("libpng12d.dll")) | ||
| 5605 | && !(library = LoadLibrary ("libpng12.dll")) | ||
| 5606 | && !(library = LoadLibrary ("libpng.dll"))) | ||
| 5607 | return 0; | 5648 | return 0; |
| 5608 | 5649 | ||
| 5609 | LOAD_IMGLIB_FN (library, png_get_io_ptr); | 5650 | LOAD_IMGLIB_FN (library, png_get_io_ptr); |
| @@ -6247,13 +6288,11 @@ DEF_IMGLIB_FN (jpeg_std_error); | |||
| 6247 | DEF_IMGLIB_FN (jpeg_resync_to_restart); | 6288 | DEF_IMGLIB_FN (jpeg_resync_to_restart); |
| 6248 | 6289 | ||
| 6249 | static int | 6290 | static int |
| 6250 | init_jpeg_functions (void) | 6291 | init_jpeg_functions (Lisp_Object libraries) |
| 6251 | { | 6292 | { |
| 6252 | HMODULE library; | 6293 | HMODULE library; |
| 6253 | 6294 | ||
| 6254 | if (!(library = LoadLibrary ("libjpeg.dll")) | 6295 | if (!(library = w32_delayed_load (libraries, Qjpeg))) |
| 6255 | && !(library = LoadLibrary ("jpeg-62.dll")) | ||
| 6256 | && !(library = LoadLibrary ("jpeg.dll"))) | ||
| 6257 | return 0; | 6296 | return 0; |
| 6258 | 6297 | ||
| 6259 | LOAD_IMGLIB_FN (library, jpeg_finish_decompress); | 6298 | LOAD_IMGLIB_FN (library, jpeg_finish_decompress); |
| @@ -6684,11 +6723,11 @@ DEF_IMGLIB_FN (TIFFReadRGBAImage); | |||
| 6684 | DEF_IMGLIB_FN (TIFFClose); | 6723 | DEF_IMGLIB_FN (TIFFClose); |
| 6685 | 6724 | ||
| 6686 | static int | 6725 | static int |
| 6687 | init_tiff_functions (void) | 6726 | init_tiff_functions (Lisp_Object libraries) |
| 6688 | { | 6727 | { |
| 6689 | HMODULE library; | 6728 | HMODULE library; |
| 6690 | 6729 | ||
| 6691 | if (!(library = LoadLibrary ("libtiff.dll"))) | 6730 | if (!(library = w32_delayed_load (libraries, Qtiff))) |
| 6692 | return 0; | 6731 | return 0; |
| 6693 | 6732 | ||
| 6694 | LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); | 6733 | LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); |
| @@ -7104,11 +7143,11 @@ DEF_IMGLIB_FN (DGifOpen); | |||
| 7104 | DEF_IMGLIB_FN (DGifOpenFileName); | 7143 | DEF_IMGLIB_FN (DGifOpenFileName); |
| 7105 | 7144 | ||
| 7106 | static int | 7145 | static int |
| 7107 | init_gif_functions (void) | 7146 | init_gif_functions (Lisp_Object libraries) |
| 7108 | { | 7147 | { |
| 7109 | HMODULE library; | 7148 | HMODULE library; |
| 7110 | 7149 | ||
| 7111 | if (!(library = LoadLibrary ("libungif.dll"))) | 7150 | if (!(library = w32_delayed_load (libraries, Qgif))) |
| 7112 | return 0; | 7151 | return 0; |
| 7113 | 7152 | ||
| 7114 | LOAD_IMGLIB_FN (library, DGifCloseFile); | 7153 | LOAD_IMGLIB_FN (library, DGifCloseFile); |
| @@ -7881,9 +7920,81 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") | |||
| 7881 | Initialization | 7920 | Initialization |
| 7882 | ***********************************************************************/ | 7921 | ***********************************************************************/ |
| 7883 | 7922 | ||
| 7923 | #ifdef HAVE_NTGUI | ||
| 7924 | /* Image types that rely on external libraries are loaded dynamically | ||
| 7925 | if the library is available. */ | ||
| 7926 | #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn) \ | ||
| 7927 | define_image_type (image_type, init_lib_fn (libraries)) | ||
| 7928 | #else | ||
| 7929 | #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn) \ | ||
| 7930 | define_image_type (image_type, TRUE) | ||
| 7931 | #endif /* HAVE_NTGUI */ | ||
| 7932 | |||
| 7933 | DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, | ||
| 7934 | doc: /* Initialize image library implementing image type TYPE. | ||
| 7935 | Return non-nil if TYPE is a supported image type. | ||
| 7936 | |||
| 7937 | Image types pbm and xbm are prebuilt; other types are loaded here. | ||
| 7938 | Libraries to load are specified in alist LIBRARIES (usually, the value | ||
| 7939 | of `image-library-alist', which see. */) | ||
| 7940 | (type, libraries) | ||
| 7941 | { | ||
| 7942 | Lisp_Object tested; | ||
| 7943 | |||
| 7944 | /* Don't try to reload the library. */ | ||
| 7945 | tested = Fassq (type, Vimage_type_cache); | ||
| 7946 | if (CONSP (tested)) | ||
| 7947 | return XCDR (tested); | ||
| 7948 | |||
| 7949 | #if defined (HAVE_XPM) || defined (MAC_OS) | ||
| 7950 | if (EQ (type, Qxpm)) | ||
| 7951 | return CHECK_LIB_AVAILABLE(&xpm_type, init_xpm_functions); | ||
| 7952 | #endif | ||
| 7953 | |||
| 7954 | #if defined (HAVE_JPEG) || defined (MAC_OS) | ||
| 7955 | if (EQ (type, Qjpeg)) | ||
| 7956 | return CHECK_LIB_AVAILABLE(&jpeg_type, init_jpeg_functions); | ||
| 7957 | #endif | ||
| 7958 | |||
| 7959 | #if defined (HAVE_TIFF) || defined (MAC_OS) | ||
| 7960 | if (EQ (type, Qtiff)) | ||
| 7961 | return CHECK_LIB_AVAILABLE(&tiff_type, init_tiff_functions); | ||
| 7962 | #endif | ||
| 7963 | |||
| 7964 | #if defined (HAVE_GIF) || defined (MAC_OS) | ||
| 7965 | if (EQ (type, Qgif)) | ||
| 7966 | return CHECK_LIB_AVAILABLE(&gif_type, init_gif_functions); | ||
| 7967 | #endif | ||
| 7968 | |||
| 7969 | #if defined (HAVE_PNG) || defined (MAC_OS) | ||
| 7970 | if (EQ (type, Qpng)) | ||
| 7971 | return CHECK_LIB_AVAILABLE(&png_type, init_png_functions); | ||
| 7972 | #endif | ||
| 7973 | |||
| 7974 | #ifdef HAVE_GHOSTSCRIPT | ||
| 7975 | if (EQ (type, Qpostscript)) | ||
| 7976 | return CHECK_LIB_AVAILABLE(&gs_type, init_gs_functions); | ||
| 7977 | #endif | ||
| 7978 | |||
| 7979 | /* If the type is not recognized, avoid testing it ever again. */ | ||
| 7980 | CACHE_IMAGE_TYPE(type, Qnil); | ||
| 7981 | return Qnil; | ||
| 7982 | } | ||
| 7983 | |||
| 7884 | void | 7984 | void |
| 7885 | syms_of_image () | 7985 | syms_of_image () |
| 7886 | { | 7986 | { |
| 7987 | /* Must be defined now becase we're going to update it below, while | ||
| 7988 | defining the supported image types. */ | ||
| 7989 | DEFVAR_LISP ("image-types", &Vimage_types, | ||
| 7990 | doc: /* List of potentially supported image types. | ||
| 7991 | Each element of the list is a symbol for a image type, like 'jpeg or 'png. | ||
| 7992 | To check whether it is really supported, use `image-type-available-p'. */); | ||
| 7993 | Vimage_types = Qnil; | ||
| 7994 | |||
| 7995 | Vimage_type_cache = Qnil; | ||
| 7996 | staticpro (&Vimage_type_cache); | ||
| 7997 | |||
| 7887 | QCascent = intern (":ascent"); | 7998 | QCascent = intern (":ascent"); |
| 7888 | staticpro (&QCascent); | 7999 | staticpro (&QCascent); |
| 7889 | QCmargin = intern (":margin"); | 8000 | QCmargin = intern (":margin"); |
| @@ -7917,6 +8028,7 @@ syms_of_image () | |||
| 7917 | Qpostscript = intern ("postscript"); | 8028 | Qpostscript = intern ("postscript"); |
| 7918 | staticpro (&Qpostscript); | 8029 | staticpro (&Qpostscript); |
| 7919 | #ifdef HAVE_GHOSTSCRIPT | 8030 | #ifdef HAVE_GHOSTSCRIPT |
| 8031 | ADD_IMAGE_TYPE(Qpostscript); | ||
| 7920 | QCloader = intern (":loader"); | 8032 | QCloader = intern (":loader"); |
| 7921 | staticpro (&QCloader); | 8033 | staticpro (&QCloader); |
| 7922 | QCbounding_box = intern (":bounding-box"); | 8034 | QCbounding_box = intern (":bounding-box"); |
| @@ -7929,35 +8041,43 @@ syms_of_image () | |||
| 7929 | 8041 | ||
| 7930 | Qpbm = intern ("pbm"); | 8042 | Qpbm = intern ("pbm"); |
| 7931 | staticpro (&Qpbm); | 8043 | staticpro (&Qpbm); |
| 8044 | ADD_IMAGE_TYPE(Qpbm); | ||
| 7932 | 8045 | ||
| 7933 | Qxbm = intern ("xbm"); | 8046 | Qxbm = intern ("xbm"); |
| 7934 | staticpro (&Qxbm); | 8047 | staticpro (&Qxbm); |
| 8048 | ADD_IMAGE_TYPE(Qxbm); | ||
| 7935 | 8049 | ||
| 7936 | #if defined (HAVE_XPM) || defined (MAC_OS) | 8050 | #if defined (HAVE_XPM) || defined (MAC_OS) |
| 7937 | Qxpm = intern ("xpm"); | 8051 | Qxpm = intern ("xpm"); |
| 7938 | staticpro (&Qxpm); | 8052 | staticpro (&Qxpm); |
| 8053 | ADD_IMAGE_TYPE(Qxpm); | ||
| 7939 | #endif | 8054 | #endif |
| 7940 | 8055 | ||
| 7941 | #if defined (HAVE_JPEG) || defined (MAC_OS) | 8056 | #if defined (HAVE_JPEG) || defined (MAC_OS) |
| 7942 | Qjpeg = intern ("jpeg"); | 8057 | Qjpeg = intern ("jpeg"); |
| 7943 | staticpro (&Qjpeg); | 8058 | staticpro (&Qjpeg); |
| 8059 | ADD_IMAGE_TYPE(Qjpeg); | ||
| 7944 | #endif | 8060 | #endif |
| 7945 | 8061 | ||
| 7946 | #if defined (HAVE_TIFF) || defined (MAC_OS) | 8062 | #if defined (HAVE_TIFF) || defined (MAC_OS) |
| 7947 | Qtiff = intern ("tiff"); | 8063 | Qtiff = intern ("tiff"); |
| 7948 | staticpro (&Qtiff); | 8064 | staticpro (&Qtiff); |
| 8065 | ADD_IMAGE_TYPE(Qtiff); | ||
| 7949 | #endif | 8066 | #endif |
| 7950 | 8067 | ||
| 7951 | #if defined (HAVE_GIF) || defined (MAC_OS) | 8068 | #if defined (HAVE_GIF) || defined (MAC_OS) |
| 7952 | Qgif = intern ("gif"); | 8069 | Qgif = intern ("gif"); |
| 7953 | staticpro (&Qgif); | 8070 | staticpro (&Qgif); |
| 8071 | ADD_IMAGE_TYPE(Qgif); | ||
| 7954 | #endif | 8072 | #endif |
| 7955 | 8073 | ||
| 7956 | #if defined (HAVE_PNG) || defined (MAC_OS) | 8074 | #if defined (HAVE_PNG) || defined (MAC_OS) |
| 7957 | Qpng = intern ("png"); | 8075 | Qpng = intern ("png"); |
| 7958 | staticpro (&Qpng); | 8076 | staticpro (&Qpng); |
| 8077 | ADD_IMAGE_TYPE(Qpng); | ||
| 7959 | #endif | 8078 | #endif |
| 7960 | 8079 | ||
| 8080 | defsubr (&Sinit_image_library); | ||
| 7961 | defsubr (&Sclear_image_cache); | 8081 | defsubr (&Sclear_image_cache); |
| 7962 | defsubr (&Simage_size); | 8082 | defsubr (&Simage_size); |
| 7963 | defsubr (&Simage_mask_p); | 8083 | defsubr (&Simage_mask_p); |
| @@ -7985,52 +8105,13 @@ meaning don't clear the cache. */); | |||
| 7985 | Vimage_cache_eviction_delay = make_number (30 * 60); | 8105 | Vimage_cache_eviction_delay = make_number (30 * 60); |
| 7986 | } | 8106 | } |
| 7987 | 8107 | ||
| 7988 | |||
| 7989 | #ifdef HAVE_NTGUI | ||
| 7990 | /* Image types that rely on external libraries are loaded dynamically | ||
| 7991 | if the library is available. */ | ||
| 7992 | #define IF_LIB_AVAILABLE(init_lib_fn) if (init_lib_fn()) | ||
| 7993 | #else | ||
| 7994 | #define IF_LIB_AVAILABLE(init_func) /* Load unconditionally */ | ||
| 7995 | #endif /* HAVE_NTGUI */ | ||
| 7996 | |||
| 7997 | void | 8108 | void |
| 7998 | init_image () | 8109 | init_image () |
| 7999 | { | 8110 | { |
| 8000 | image_types = NULL; | 8111 | image_types = NULL; |
| 8001 | Vimage_types = Qnil; | ||
| 8002 | 8112 | ||
| 8003 | define_image_type (&xbm_type); | 8113 | define_image_type (&xbm_type, TRUE); |
| 8004 | define_image_type (&pbm_type); | 8114 | define_image_type (&pbm_type, TRUE); |
| 8005 | |||
| 8006 | #if defined (HAVE_XPM) || defined (MAC_OS) | ||
| 8007 | IF_LIB_AVAILABLE(init_xpm_functions) | ||
| 8008 | define_image_type (&xpm_type); | ||
| 8009 | #endif | ||
| 8010 | |||
| 8011 | #if defined (HAVE_JPEG) || defined (MAC_OS) | ||
| 8012 | IF_LIB_AVAILABLE(init_jpeg_functions) | ||
| 8013 | define_image_type (&jpeg_type); | ||
| 8014 | #endif | ||
| 8015 | |||
| 8016 | #if defined (HAVE_TIFF) || defined (MAC_OS) | ||
| 8017 | IF_LIB_AVAILABLE(init_tiff_functions) | ||
| 8018 | define_image_type (&tiff_type); | ||
| 8019 | #endif | ||
| 8020 | |||
| 8021 | #if defined (HAVE_GIF) || defined (MAC_OS) | ||
| 8022 | IF_LIB_AVAILABLE(init_gif_functions) | ||
| 8023 | define_image_type (&gif_type); | ||
| 8024 | #endif | ||
| 8025 | |||
| 8026 | #if defined (HAVE_PNG) || defined (MAC_OS) | ||
| 8027 | IF_LIB_AVAILABLE(init_png_functions) | ||
| 8028 | define_image_type (&png_type); | ||
| 8029 | #endif | ||
| 8030 | |||
| 8031 | #ifdef HAVE_GHOSTSCRIPT | ||
| 8032 | define_image_type (&gs_type); | ||
| 8033 | #endif | ||
| 8034 | 8115 | ||
| 8035 | #ifdef MAC_OS | 8116 | #ifdef MAC_OS |
| 8036 | /* Animated gifs use QuickTime Movie Toolbox. So initialize it here. */ | 8117 | /* Animated gifs use QuickTime Movie Toolbox. So initialize it here. */ |
diff --git a/src/xdisp.c b/src/xdisp.c index 67049a151cc..d2410aa82bb 100644 --- a/src/xdisp.c +++ b/src/xdisp.c | |||
| @@ -670,10 +670,6 @@ EMACS_INT hscroll_margin; | |||
| 670 | /* How much to scroll horizontally when point is inside the above margin. */ | 670 | /* How much to scroll horizontally when point is inside the above margin. */ |
| 671 | Lisp_Object Vhscroll_step; | 671 | Lisp_Object Vhscroll_step; |
| 672 | 672 | ||
| 673 | /* A list of symbols, one for each supported image type. */ | ||
| 674 | |||
| 675 | Lisp_Object Vimage_types; | ||
| 676 | |||
| 677 | /* The variable `resize-mini-windows'. If nil, don't resize | 673 | /* The variable `resize-mini-windows'. If nil, don't resize |
| 678 | mini-windows. If t, always resize them to fit the text they | 674 | mini-windows. If t, always resize them to fit the text they |
| 679 | display. If `grow-only', let mini-windows grow only until they | 675 | display. If `grow-only', let mini-windows grow only until they |
| @@ -22259,11 +22255,6 @@ Note that the lower bound for automatic hscrolling specified by `scroll-left' | |||
| 22259 | and `scroll-right' overrides this variable's effect. */); | 22255 | and `scroll-right' overrides this variable's effect. */); |
| 22260 | Vhscroll_step = make_number (0); | 22256 | Vhscroll_step = make_number (0); |
| 22261 | 22257 | ||
| 22262 | DEFVAR_LISP ("image-types", &Vimage_types, | ||
| 22263 | doc: /* List of supported image types. | ||
| 22264 | Each element of the list is a symbol for a supported image type. */); | ||
| 22265 | Vimage_types = Qnil; | ||
| 22266 | |||
| 22267 | DEFVAR_BOOL ("message-truncate-lines", &message_truncate_lines, | 22258 | DEFVAR_BOOL ("message-truncate-lines", &message_truncate_lines, |
| 22268 | doc: /* If non-nil, messages are truncated instead of resizing the echo area. | 22259 | doc: /* If non-nil, messages are truncated instead of resizing the echo area. |
| 22269 | Bind this around calls to `message' to let it take effect. */); | 22260 | Bind this around calls to `message' to let it take effect. */); |
diff --git a/src/xterm.h b/src/xterm.h index 56c1d059ac3..a71bd275e6f 100644 --- a/src/xterm.h +++ b/src/xterm.h | |||
| @@ -167,7 +167,7 @@ struct x_display_info | |||
| 167 | /* The colormap being used. */ | 167 | /* The colormap being used. */ |
| 168 | Colormap cmap; | 168 | Colormap cmap; |
| 169 | 169 | ||
| 170 | /* Number of panes on this screen. */ | 170 | /* Number of planes on this screen. */ |
| 171 | int n_planes; | 171 | int n_planes; |
| 172 | 172 | ||
| 173 | /* Dimensions of this screen. */ | 173 | /* Dimensions of this screen. */ |