Always compile w32image.c on MinGW (Bug#80924)

This enables features unrelated to native image APIs, such as
'w32-export-frame' and 'yank-media', which need to call GDI+
functions.
* configure.ac (HAVE_W32) [!CYGWIN]: Always include w32image.o in
W32_OBJ.
* etc/NEWS: Drop 'yank-media' '--without-native-image-api' caveat.
* src/emacs.c (main):
* src/w32select.c (convert_dibv5_to_png):
* src/w32term.c (w32_draw_image_foreground): Replace
HAVE_NATIVE_IMAGE_API with WINDOWSNT.
* src/w32.c (term_ntproc): Remove redundant HAVE_NATIVE_IMAGE_API guard.
* src/w32fns.c (Fw32_export_frame) [!WINDOWSNT]: Return nil on Cygwin.
This commit is contained in:
Randy Taylor
2026-04-29 22:18:13 -04:00
committed by Eli Zaretskii
parent b4e128b0cb
commit edc19c3536
7 changed files with 12 additions and 12 deletions

View File

@@ -3079,14 +3079,13 @@ if test "${HAVE_W32}" = "yes"; then
# the rc file), not a linker script.
W32_RES_LINK="-Wl,emacs.res"
else
W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32inevt.o w32proc.o"
W32_OBJ="$W32_OBJ w32.o w32console.o w32heap.o w32image.o w32inevt.o w32proc.o"
dnl FIXME: This should probably be supported for Cygwin/w32 as
dnl well, but the Cygwin build needs to link against -lgdiplus
if test "${with_native_image_api}" = yes; then
AC_DEFINE([HAVE_NATIVE_IMAGE_API], [1],
[Define to use native OS APIs for images.])
NATIVE_IMAGE_API="yes (w32)"
W32_OBJ="$W32_OBJ w32image.o"
fi
W32_LIBS="$W32_LIBS -lwinmm -lgdi32 -lcomdlg32"
W32_LIBS="$W32_LIBS -lmpr -lwinspool -lole32 -lcomctl32"

View File

@@ -4681,9 +4681,7 @@ color Emoji font installed on your system for the 'emoji' script.
+++
** Emacs on MS-Windows now supports 'yank-media'.
This command inserts clipboard data of different formats into the
current buffer, if the major mode supports it. (Support for
'yank-media' will be unavailable on MS-Windows if Emacs was configured
'--without-native-image-api'.)
current buffer, if the major mode supports it.
---
** Emacs on MS-Windows now supports up to 1024 sub-processes.

View File

@@ -2362,7 +2362,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
syms_of_fringe ();
syms_of_image ();
#ifdef HAVE_NTGUI
# if HAVE_NATIVE_IMAGE_API
# if WINDOWSNT
syms_of_w32image ();
# endif
#endif /* HAVE_NTGUI */
@@ -2504,7 +2504,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem
globals_of_w32font ();
globals_of_w32fns ();
globals_of_w32menu ();
# if HAVE_NATIVE_IMAGE_API
# if WINDOWSNT
globals_of_w32image ();
# endif
#endif /* HAVE_NTGUI */

View File

@@ -10548,9 +10548,8 @@ term_ntproc (int ignored)
term_w32select ();
/* Exit all worker threads of sys_select if necessary. */
free_wait_pool ();
#if HAVE_NATIVE_IMAGE_API
w32_gdiplus_shutdown ();
#endif
}
void

View File

@@ -11469,6 +11469,7 @@ Optional arg TYPE should be either `jpeg' (default), `bmp', `png',
Value is non-nil if FRAME was successfully exported, nil otherwise. */)
(Lisp_Object frame, Lisp_Object file, Lisp_Object type)
{
#ifdef WINDOWSNT
struct frame *f = decode_live_frame (frame);
if (NILP (type))
@@ -11494,6 +11495,9 @@ Value is non-nil if FRAME was successfully exported, nil otherwise. */)
unblock_input ();
return result >= 0 ? Qt : Qnil;
#else /* !WINDOWSNT */
return Qnil;
#endif
}

View File

@@ -825,7 +825,7 @@ static const char *stdfmt_name[] = {
static bool
convert_dibv5_to_png (char *data, int size, char *temp_file)
{
#ifdef HAVE_NATIVE_IMAGE_API
#ifdef WINDOWSNT
CLSID clsid_png;
if (!w32_gdiplus_startup ()
@@ -859,7 +859,7 @@ convert_dibv5_to_png (char *data, int size, char *temp_file)
if (status != Ok)
return false;
return true;
#else /* !HAVE_NATIVE_IMAGE_API */
#else /* !WINDOWSNT */
return false;
#endif
}

View File

@@ -2109,7 +2109,7 @@ w32_draw_image_foreground (struct glyph_string *s)
compat_hdc, s->slice.x, s->slice.y, SRCCOPY);
else
{
#ifdef HAVE_NATIVE_IMAGE_API
#ifdef WINDOWSNT
if (s->img->smoothing && w32_gdiplus_startup ())
{
GpGraphics *graphics;