Mercurial > libanimone
diff include/animone/types.h @ 25:60ded877339b
dep/animone: fix tons of issues
for example, the window ID stuff was just... completely wrong. since we're
supporting multiple different window systems, it *has* to be a union rather
than just a single integer type. HWND is also not a DWORD, it's a pointer(!),
so now it's stored as a std::uintptr_t.
(this probably breaks things)
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Thu, 20 Jun 2024 03:03:05 -0400 |
parents | 973734ebd2be |
children | 77a5ea5e996c |
line wrap: on
line diff
--- a/include/animone/types.h Wed Jun 19 23:21:19 2024 -0400 +++ b/include/animone/types.h Thu Jun 20 03:03:05 2024 -0400 @@ -1,20 +1,43 @@ #ifndef ANIMONE_ANIMONE_TYPES_H_ #define ANIMONE_ANIMONE_TYPES_H_ -/* define this as unsigned long (DWORD) on win32 so we - * don't force the user to include <windows.h> or <IntBase.h> */ -#ifdef _WIN32 -# include <cstdint> +#include <cstdint> + +/* windows is so annoying */ +#ifdef ANIMONE_STATIC +# define ANIMONE_API +#else +# ifdef _WIN32 +# ifdef DLL_EXPORT +# define ANIMONE_API __declspec(dllexport) +# else +# define ANIMONE_API __declspec(dllimport) +# endif +# else +# define ANIMONE_API +# endif +#endif + +/* FIXME configure this in autoconf */ +#ifndef _WIN32 +#include <sys/types.h> +#endif namespace animone::internal { + +#ifdef _WIN32 using pid_t = std::uint32_t; -} #else -/* <sys/types.h> shouldn't be that big, right? */ -# include <sys/types.h> -namespace animone::internal { using pid_t = ::pid_t; -} #endif +/* different window systems have different sized IDs */ +union ANIMONE_API wid_t { + std::uintptr_t win32; + std::int64_t quartz; // FIXME is this correct? + std::uint32_t x11; +}; + +} + #endif // ANIMONE_ANIMONE_TYPES_H_