diff options
| author | Daniel Colascione | 2012-09-17 03:55:02 -0800 |
|---|---|---|
| committer | Daniel Colascione | 2012-09-17 03:55:02 -0800 |
| commit | 0fda9b750e337d876c9461db7d4426a3f0b81482 (patch) | |
| tree | 1e1659bfa590cd8375c564c6fb5c3bafa65e06c0 /src/image.c | |
| parent | 8b33967313f09a736a833816d32fd52e10640969 (diff) | |
| download | emacs-0fda9b750e337d876c9461db7d4426a3f0b81482.tar.gz emacs-0fda9b750e337d876c9461db7d4426a3f0b81482.zip | |
Implement cygw32
Here, we use the generic window-system configuration system we just
implemented to support the w32 window-system in the mainline build
under Cygwin. (Previously, the w32 window system could only be
compiled as part of the NT-native Emacs build process.)
The changes in this patch need to be applied atomically in order to
avoid breaking Emacs. The changes include:
- Changes throughout the Lisp and C code to not assume that
NT Emacs and the w32 window system are synonymous.
- Wiring up the regular select(2) event loop to Windows messages
- Cleaning up the w32 drag-and-drop receiving code.
- Exposing Cygwin path conversion functions to elisp.
- Unicode file dialog support when compiling for Cygwin.
- Splitting the w32 term lisp initialization code into code
applicable to any w32 window-system and code specific to
system-type windows-nt.
- Integrating the old and new w32 code into the build system.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 62 |
1 files changed, 40 insertions, 22 deletions
diff --git a/src/image.c b/src/image.c index d4e78d41000..b5a2e0328eb 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -76,7 +76,11 @@ typedef struct x_bitmap_record Bitmap_Record; | |||
| 76 | #endif /* HAVE_X_WINDOWS */ | 76 | #endif /* HAVE_X_WINDOWS */ |
| 77 | 77 | ||
| 78 | #ifdef HAVE_NTGUI | 78 | #ifdef HAVE_NTGUI |
| 79 | #include "w32.h" | 79 | # ifdef WINDOWSNT |
| 80 | /* We only need (or want) w32.h when we're _not_ | ||
| 81 | * compiling for Cygwin */ | ||
| 82 | # include "w32.h" | ||
| 83 | # endif /* WINDOWSNT */ | ||
| 80 | /* W32_TODO : Color tables on W32. */ | 84 | /* W32_TODO : Color tables on W32. */ |
| 81 | #undef COLOR_TABLE_SUPPORT | 85 | #undef COLOR_TABLE_SUPPORT |
| 82 | 86 | ||
| @@ -569,13 +573,14 @@ static void x_laplace (struct frame *, struct image *); | |||
| 569 | static void x_emboss (struct frame *, struct image *); | 573 | static void x_emboss (struct frame *, struct image *); |
| 570 | static int x_build_heuristic_mask (struct frame *, struct image *, | 574 | static int x_build_heuristic_mask (struct frame *, struct image *, |
| 571 | Lisp_Object); | 575 | Lisp_Object); |
| 572 | #ifdef HAVE_NTGUI | 576 | #ifdef WINDOWSNT |
| 573 | extern Lisp_Object Vlibrary_cache, QCloaded_from; | 577 | extern Lisp_Object Vlibrary_cache; |
| 578 | |||
| 574 | #define CACHE_IMAGE_TYPE(type, status) \ | 579 | #define CACHE_IMAGE_TYPE(type, status) \ |
| 575 | do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) | 580 | do { Vlibrary_cache = Fcons (Fcons (type, status), Vlibrary_cache); } while (0) |
| 576 | #else | 581 | #else |
| 577 | #define CACHE_IMAGE_TYPE(type, status) | 582 | #define CACHE_IMAGE_TYPE(type, status) |
| 578 | #endif | 583 | #endif /* WINDOWSNT */ |
| 579 | 584 | ||
| 580 | #define ADD_IMAGE_TYPE(type) \ | 585 | #define ADD_IMAGE_TYPE(type) \ |
| 581 | do { Vimage_types = Fcons (type, Vimage_types); } while (0) | 586 | do { Vimage_types = Fcons (type, Vimage_types); } while (0) |
| @@ -1861,7 +1866,7 @@ mark_image_cache (struct image_cache *c) | |||
| 1861 | X / NS / W32 support code | 1866 | X / NS / W32 support code |
| 1862 | ***********************************************************************/ | 1867 | ***********************************************************************/ |
| 1863 | 1868 | ||
| 1864 | #ifdef HAVE_NTGUI | 1869 | #ifdef WINDOWSNT |
| 1865 | 1870 | ||
| 1866 | /* Macro for defining functions that will be loaded from image DLLs. */ | 1871 | /* Macro for defining functions that will be loaded from image DLLs. */ |
| 1867 | #define DEF_IMGLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args | 1872 | #define DEF_IMGLIB_FN(rettype,func,args) static rettype (FAR CDECL *fn_##func)args |
| @@ -1872,7 +1877,7 @@ mark_image_cache (struct image_cache *c) | |||
| 1872 | if (!fn_##func) return 0; \ | 1877 | if (!fn_##func) return 0; \ |
| 1873 | } | 1878 | } |
| 1874 | 1879 | ||
| 1875 | #endif /* HAVE_NTGUI */ | 1880 | #endif /* WINDOWSNT */ |
| 1876 | 1881 | ||
| 1877 | static int x_create_x_image_and_pixmap (struct frame *, int, int, int, | 1882 | static int x_create_x_image_and_pixmap (struct frame *, int, int, int, |
| 1878 | XImagePtr *, Pixmap *); | 1883 | XImagePtr *, Pixmap *); |
| @@ -2935,7 +2940,7 @@ xbm_load (struct frame *f, struct image *img) | |||
| 2935 | else | 2940 | else |
| 2936 | bits = (char *) XBOOL_VECTOR (data)->data; | 2941 | bits = (char *) XBOOL_VECTOR (data)->data; |
| 2937 | 2942 | ||
| 2938 | #ifdef WINDOWSNT | 2943 | #ifdef HAVE_NTGUI |
| 2939 | { | 2944 | { |
| 2940 | char *invertedBits; | 2945 | char *invertedBits; |
| 2941 | int nbytes, i; | 2946 | int nbytes, i; |
| @@ -3243,7 +3248,7 @@ xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void * | |||
| 3243 | #endif /* ALLOC_XPM_COLORS */ | 3248 | #endif /* ALLOC_XPM_COLORS */ |
| 3244 | 3249 | ||
| 3245 | 3250 | ||
| 3246 | #ifdef HAVE_NTGUI | 3251 | #ifdef WINDOWSNT |
| 3247 | 3252 | ||
| 3248 | /* XPM library details. */ | 3253 | /* XPM library details. */ |
| 3249 | 3254 | ||
| @@ -3269,8 +3274,15 @@ init_xpm_functions (Lisp_Object libraries) | |||
| 3269 | return 1; | 3274 | return 1; |
| 3270 | } | 3275 | } |
| 3271 | 3276 | ||
| 3272 | #endif /* HAVE_NTGUI */ | 3277 | #endif /* WINDOWSNT */ |
| 3273 | 3278 | ||
| 3279 | #ifdef HAVE_NTGUI | ||
| 3280 | /* Glue for code below */ | ||
| 3281 | #define fn_XpmReadFileToImage XpmReadFileToImage | ||
| 3282 | #define fn_XpmCreateImageFromBuffer XpmCreateImageFromBuffer | ||
| 3283 | #define fn_XImageFree XImageFree | ||
| 3284 | #define fn_XpmFreeAttributes XpmFreeAttributes | ||
| 3285 | #endif /* HAVE_NTGUI */ | ||
| 3274 | 3286 | ||
| 3275 | /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list | 3287 | /* Value is non-zero if COLOR_SYMBOLS is a valid color symbols list |
| 3276 | for XPM images. Such a list must consist of conses whose car and | 3288 | for XPM images. Such a list must consist of conses whose car and |
| @@ -5414,7 +5426,7 @@ png_image_p (Lisp_Object object) | |||
| 5414 | 5426 | ||
| 5415 | #ifdef HAVE_PNG | 5427 | #ifdef HAVE_PNG |
| 5416 | 5428 | ||
| 5417 | #ifdef HAVE_NTGUI | 5429 | #ifdef WINDOWSNT |
| 5418 | /* PNG library details. */ | 5430 | /* PNG library details. */ |
| 5419 | 5431 | ||
| 5420 | DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp)); | 5432 | DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp)); |
| @@ -5514,7 +5526,7 @@ init_png_functions (Lisp_Object libraries) | |||
| 5514 | #define fn_png_set_longjmp_fn png_set_longjmp_fn | 5526 | #define fn_png_set_longjmp_fn png_set_longjmp_fn |
| 5515 | #endif /* libpng version >= 1.5 */ | 5527 | #endif /* libpng version >= 1.5 */ |
| 5516 | 5528 | ||
| 5517 | #endif /* HAVE_NTGUI */ | 5529 | #endif /* WINDOWSNT */ |
| 5518 | 5530 | ||
| 5519 | 5531 | ||
| 5520 | #if (PNG_LIBPNG_VER < 10500) | 5532 | #if (PNG_LIBPNG_VER < 10500) |
| @@ -6045,14 +6057,20 @@ jpeg_image_p (Lisp_Object object) | |||
| 6045 | #define __WIN32__ 1 | 6057 | #define __WIN32__ 1 |
| 6046 | #endif | 6058 | #endif |
| 6047 | 6059 | ||
| 6060 | /* Work around conflict between jpeg boolean and rpcndr.h | ||
| 6061 | under Windows. */ | ||
| 6062 | #define boolean jpeg_boolean | ||
| 6048 | #include <jpeglib.h> | 6063 | #include <jpeglib.h> |
| 6049 | #include <jerror.h> | 6064 | #include <jerror.h> |
| 6050 | 6065 | ||
| 6066 | /* Don't undefine boolean --- use the JPEG boolean | ||
| 6067 | through the rest of the file. */ | ||
| 6068 | |||
| 6051 | #ifdef HAVE_STLIB_H_1 | 6069 | #ifdef HAVE_STLIB_H_1 |
| 6052 | #define HAVE_STDLIB_H 1 | 6070 | #define HAVE_STDLIB_H 1 |
| 6053 | #endif | 6071 | #endif |
| 6054 | 6072 | ||
| 6055 | #ifdef HAVE_NTGUI | 6073 | #ifdef WINDOWSNT |
| 6056 | 6074 | ||
| 6057 | /* JPEG library details. */ | 6075 | /* JPEG library details. */ |
| 6058 | DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); | 6076 | DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); |
| @@ -6102,7 +6120,7 @@ jpeg_resync_to_restart_wrapper (j_decompress_ptr cinfo, int desired) | |||
| 6102 | #define fn_jpeg_std_error jpeg_std_error | 6120 | #define fn_jpeg_std_error jpeg_std_error |
| 6103 | #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart | 6121 | #define jpeg_resync_to_restart_wrapper jpeg_resync_to_restart |
| 6104 | 6122 | ||
| 6105 | #endif /* HAVE_NTGUI */ | 6123 | #endif /* WINDOWSNT */ |
| 6106 | 6124 | ||
| 6107 | struct my_jpeg_error_mgr | 6125 | struct my_jpeg_error_mgr |
| 6108 | { | 6126 | { |
| @@ -6583,7 +6601,7 @@ tiff_image_p (Lisp_Object object) | |||
| 6583 | 6601 | ||
| 6584 | #include <tiffio.h> | 6602 | #include <tiffio.h> |
| 6585 | 6603 | ||
| 6586 | #ifdef HAVE_NTGUI | 6604 | #ifdef WINDOWSNT |
| 6587 | 6605 | ||
| 6588 | /* TIFF library details. */ | 6606 | /* TIFF library details. */ |
| 6589 | DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler)); | 6607 | DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler)); |
| @@ -6627,7 +6645,7 @@ init_tiff_functions (Lisp_Object libraries) | |||
| 6627 | #define fn_TIFFReadRGBAImage TIFFReadRGBAImage | 6645 | #define fn_TIFFReadRGBAImage TIFFReadRGBAImage |
| 6628 | #define fn_TIFFClose TIFFClose | 6646 | #define fn_TIFFClose TIFFClose |
| 6629 | #define fn_TIFFSetDirectory TIFFSetDirectory | 6647 | #define fn_TIFFSetDirectory TIFFSetDirectory |
| 6630 | #endif /* HAVE_NTGUI */ | 6648 | #endif /* WINDOWSNT */ |
| 6631 | 6649 | ||
| 6632 | 6650 | ||
| 6633 | /* Reading from a memory buffer for TIFF images Based on the PNG | 6651 | /* Reading from a memory buffer for TIFF images Based on the PNG |
| @@ -7056,7 +7074,7 @@ gif_image_p (Lisp_Object object) | |||
| 7056 | #endif /* HAVE_NTGUI */ | 7074 | #endif /* HAVE_NTGUI */ |
| 7057 | 7075 | ||
| 7058 | 7076 | ||
| 7059 | #ifdef HAVE_NTGUI | 7077 | #ifdef WINDOWSNT |
| 7060 | 7078 | ||
| 7061 | /* GIF library details. */ | 7079 | /* GIF library details. */ |
| 7062 | DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); | 7080 | DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); |
| @@ -7086,7 +7104,7 @@ init_gif_functions (Lisp_Object libraries) | |||
| 7086 | #define fn_DGifOpen DGifOpen | 7104 | #define fn_DGifOpen DGifOpen |
| 7087 | #define fn_DGifOpenFileName DGifOpenFileName | 7105 | #define fn_DGifOpenFileName DGifOpenFileName |
| 7088 | 7106 | ||
| 7089 | #endif /* HAVE_NTGUI */ | 7107 | #endif /* WINDOWSNT */ |
| 7090 | 7108 | ||
| 7091 | /* Reading a GIF image from memory | 7109 | /* Reading a GIF image from memory |
| 7092 | Based on the PNG memory stuff to a certain extent. */ | 7110 | Based on the PNG memory stuff to a certain extent. */ |
| @@ -8075,7 +8093,7 @@ svg_image_p (Lisp_Object object) | |||
| 8075 | 8093 | ||
| 8076 | #include <librsvg/rsvg.h> | 8094 | #include <librsvg/rsvg.h> |
| 8077 | 8095 | ||
| 8078 | #ifdef HAVE_NTGUI | 8096 | #ifdef WINDOWSNT |
| 8079 | 8097 | ||
| 8080 | /* SVG library functions. */ | 8098 | /* SVG library functions. */ |
| 8081 | DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new); | 8099 | DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new); |
| @@ -8153,7 +8171,7 @@ init_svg_functions (Lisp_Object libraries) | |||
| 8153 | #define fn_g_type_init g_type_init | 8171 | #define fn_g_type_init g_type_init |
| 8154 | #define fn_g_object_unref g_object_unref | 8172 | #define fn_g_object_unref g_object_unref |
| 8155 | #define fn_g_error_free g_error_free | 8173 | #define fn_g_error_free g_error_free |
| 8156 | #endif /* !HAVE_NTGUI */ | 8174 | #endif /* !WINDOWSNT */ |
| 8157 | 8175 | ||
| 8158 | /* Load SVG image IMG for use on frame F. Value is non-zero if | 8176 | /* Load SVG image IMG for use on frame F. Value is non-zero if |
| 8159 | successful. this function will go into the svg_type structure, and | 8177 | successful. this function will go into the svg_type structure, and |
| @@ -8701,7 +8719,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") | |||
| 8701 | Initialization | 8719 | Initialization |
| 8702 | ***********************************************************************/ | 8720 | ***********************************************************************/ |
| 8703 | 8721 | ||
| 8704 | #ifdef HAVE_NTGUI | 8722 | #ifdef WINDOWSNT |
| 8705 | /* Image types that rely on external libraries are loaded dynamically | 8723 | /* Image types that rely on external libraries are loaded dynamically |
| 8706 | if the library is available. */ | 8724 | if the library is available. */ |
| 8707 | #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ | 8725 | #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ |
| @@ -8709,7 +8727,7 @@ DEFUN ("lookup-image", Flookup_image, Slookup_image, 1, 1, 0, "") | |||
| 8709 | #else | 8727 | #else |
| 8710 | #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ | 8728 | #define CHECK_LIB_AVAILABLE(image_type, init_lib_fn, libraries) \ |
| 8711 | define_image_type (image_type, 1) | 8729 | define_image_type (image_type, 1) |
| 8712 | #endif /* HAVE_NTGUI */ | 8730 | #endif /* WINDOWSNT */ |
| 8713 | 8731 | ||
| 8714 | DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, | 8732 | DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, |
| 8715 | doc: /* Initialize image library implementing image type TYPE. | 8733 | doc: /* Initialize image library implementing image type TYPE. |
| @@ -8720,7 +8738,7 @@ Libraries to load are specified in alist LIBRARIES (usually, the value | |||
| 8720 | of `dynamic-library-alist', which see). */) | 8738 | of `dynamic-library-alist', which see). */) |
| 8721 | (Lisp_Object type, Lisp_Object libraries) | 8739 | (Lisp_Object type, Lisp_Object libraries) |
| 8722 | { | 8740 | { |
| 8723 | #ifdef HAVE_NTGUI | 8741 | #ifdef WINDOWSNT |
| 8724 | /* Don't try to reload the library. */ | 8742 | /* Don't try to reload the library. */ |
| 8725 | Lisp_Object tested = Fassq (type, Vlibrary_cache); | 8743 | Lisp_Object tested = Fassq (type, Vlibrary_cache); |
| 8726 | if (CONSP (tested)) | 8744 | if (CONSP (tested)) |