Fix 256 color mapping in rxvt.el
[bpt/emacs.git] / lisp / term / w32-win.el
index cbd08e6..af1a351 100644 (file)
   (let ((f (if (eq system-type 'cygwin)
                (cygwin-convert-file-name-from-windows file-name t)
              (subst-char-in-string ?\\ ?/ file-name)))
-        (coding (or file-name-coding-system
-                    default-file-name-coding-system)))
+        (coding (if (eq system-type 'windows-nt)
+                   ;; Native w32 build pretends that its file names
+                   ;; are encoded in UTF-8, and converts to the
+                   ;; appropriate encoding internally.
+                   'utf-8
+                 (or file-name-coding-system
+                     default-file-name-coding-system))))
 
     (setq file-name
           (mapconcat 'url-hexify-string
@@ -216,20 +221,49 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
        ;; the version we were compiled against.  (If we were compiled
        ;; without PNG support, libpng-version's value is -1.)
        (if (>= libpng-version 10400)
-          ;; libpng14-14.dll is libpng 1.4.3 from GTK+
-          '(png "libpng14-14.dll" "libpng14.dll")
+          (let ((major (/ libpng-version 10000))
+                (minor (mod (/ libpng-version 100) 10)))
+            (list 'png
+                  ;; libpngXY.dll is the default name when building
+                  ;; with CMake or from a lpngXYY tarball on w32,
+                  ;; libpngXY-XY.dll is the DLL name when building
+                  ;; with libtool / autotools
+                  (format "libpng%d%d.dll" major minor)
+                  (format "libpng%d%d-%d%d.dll" major minor major minor)))
         '(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll"
               ;; these are libpng 1.2.8 from GTK+
               "libpng13d.dll" "libpng13.dll"))
-       '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
-       '(tiff "libtiff3.dll" "libtiff.dll")
-       '(gif "giflib4.dll" "libungif4.dll" "libungif.dll")
+       '(tiff "libtiff-5.dll" "libtiff3.dll" "libtiff.dll")
+       (if (> libjpeg-version 62)
+          ;; Versions of libjpeg after 6b are incompatible with
+          ;; earlier versions, and each of versions 7, 8, and 9 is
+          ;; also incompatible with the preceding ones (the core data
+          ;; structures used for communications with the library
+          ;; gained additional members with each new version).  So we
+          ;; must use only the version of the library which Emacs was
+          ;; compiled against.
+          (list 'jpeg (format "libjpeg-%d.dll" (/ libjpeg-version 10)))
+        '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll"))
+       ;; Versions of giflib 5.0.0 and later changed signatures of
+       ;; several functions used by Emacs, which makes those versions
+       ;; incompatible with previous ones.  We select the correct
+       ;; libraries according to the version of giflib we were
+       ;; compiled against.  (If we were compiled without GIF support,
+       ;; libgif-version's value is -1.)
+       (if (>= libgif-version 50000)
+          ;; Yes, giflib 5.x uses 6 as the major version of the API,
+          ;; thus "libgif-6.dll" below (giflib 4.x used 5 as the
+          ;; major API version).
+          ;; giflib5.dll is from the lua-files project.
+          '(gif "libgif-6.dll" "giflib5.dll")
+        '(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll"))
        '(svg "librsvg-2-2.dll")
        '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
        '(glib "libglib-2.0-0.dll")
        '(gobject "libgobject-2.0-0.dll")
        '(gnutls "libgnutls-28.dll" "libgnutls-26.dll")
-       '(libxml2 "libxml2-2.dll" "libxml2.dll")))
+       '(libxml2 "libxml2-2.dll" "libxml2.dll")
+       '(zlib "zlib1.dll" "libz-1.dll")))
 
 ;;; multi-tty support
 (defvar w32-initialized nil
@@ -237,6 +271,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 
 (declare-function x-open-connection "w32fns.c"
                   (display &optional xrm-string must-succeed))
+(declare-function create-default-fontset "fontset" ())
 (declare-function create-fontset-from-fontset-spec "fontset"
                   (fontset-spec &optional style-variant noerror))
 (declare-function create-fontset-from-x-resource "fontset" ())
@@ -246,7 +281,7 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
 (declare-function x-parse-geometry "frame.c" (string))
 (defvar x-command-line-resources)
 
-(defun w32-initialize-window-system ()
+(defun w32-initialize-window-system (&optional _display)
   "Initialize Emacs for W32 GUI frames."
   (cl-assert (not w32-initialized))