Skip to content

Commit 8ca051c

Browse files
evertonsepsxdev
authored andcommitted
[rcore]: Issue an warning instead of an error when checking SUPPORT_CLIPBOARD_IMAGE necessary support detection (raysan5#4477)
1 parent d71675d commit 8ca051c

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

src/rcore.c

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -527,10 +527,27 @@ const char *TextFormat(const char *text, ...); // Formatting of tex
527527
#define PLATFORM_DESKTOP_GLFW
528528
#endif
529529

530+
// We're using `#pragma message` because `#warning` is not adopted by MSVC.
530531
#if defined(SUPPORT_CLIPBOARD_IMAGE)
531-
#if !defined(SUPPORT_FILEFORMAT_BMP) || !defined(STBI_REQUIRED) || !defined(SUPPORT_MODULE_RTEXTURES)
532-
#error "To enabled SUPPORT_CLIPBOARD_IMAGE, it also needs SUPPORT_FILEFORMAT_BMP, SUPPORT_MODULE_RTEXTURES and STBI_REQUIRED to be defined. It should have been defined earlier"
532+
#if !defined(SUPPORT_MODULE_RTEXTURES)
533+
#pragma message ("Warning: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_MODULE_RTEXTURES to work properly")
533534
#endif
535+
536+
// It's nice to have support Bitmap on Linux as well, but not as necessary as Windows
537+
#if !defined(SUPPORT_FILEFORMAT_BMP) && defined(_WIN32)
538+
#pragma message ("Warning: Enabling SUPPORT_CLIPBOARD_IMAGE requires SUPPORT_FILEFORMAT_BMP, specially on Windows")
539+
#endif
540+
541+
// From what I've tested applications on Wayland saves images on clipboard as PNG.
542+
#if (!defined(SUPPORT_FILEFORMAT_PNG) || !defined(SUPPORT_FILEFORMAT_JPG)) && !defined(_WIN32)
543+
#pragma message ("Warning: Getting image from the clipboard might not work without SUPPORT_FILEFORMAT_PNG or SUPPORT_FILEFORMAT_JPG")
544+
#endif
545+
546+
// Not needed because `rtexture.c` will automatically defined STBI_REQUIRED when any SUPPORT_FILEFORMAT_* is defined.
547+
// #if !defined(STBI_REQUIRED)
548+
// #pragma message ("Warning: "STBI_REQUIRED is not defined, that means we can't load images from clipbard"
549+
// #endif
550+
534551
#endif // SUPPORT_CLIPBOARD_IMAGE
535552

536553
// Include platform-specific submodules

0 commit comments

Comments
 (0)