Mercurial > libanimone
comparison 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 |
comparison
equal
deleted
inserted
replaced
24:f1b9adaa41b3 | 25:60ded877339b |
---|---|
1 #ifndef ANIMONE_ANIMONE_TYPES_H_ | 1 #ifndef ANIMONE_ANIMONE_TYPES_H_ |
2 #define ANIMONE_ANIMONE_TYPES_H_ | 2 #define ANIMONE_ANIMONE_TYPES_H_ |
3 | 3 |
4 /* define this as unsigned long (DWORD) on win32 so we | 4 #include <cstdint> |
5 * don't force the user to include <windows.h> or <IntBase.h> */ | 5 |
6 #ifdef _WIN32 | 6 /* windows is so annoying */ |
7 # include <cstdint> | 7 #ifdef ANIMONE_STATIC |
8 # define ANIMONE_API | |
9 #else | |
10 # ifdef _WIN32 | |
11 # ifdef DLL_EXPORT | |
12 # define ANIMONE_API __declspec(dllexport) | |
13 # else | |
14 # define ANIMONE_API __declspec(dllimport) | |
15 # endif | |
16 # else | |
17 # define ANIMONE_API | |
18 # endif | |
19 #endif | |
20 | |
21 /* FIXME configure this in autoconf */ | |
22 #ifndef _WIN32 | |
23 #include <sys/types.h> | |
24 #endif | |
8 | 25 |
9 namespace animone::internal { | 26 namespace animone::internal { |
27 | |
28 #ifdef _WIN32 | |
10 using pid_t = std::uint32_t; | 29 using pid_t = std::uint32_t; |
11 } | |
12 #else | 30 #else |
13 /* <sys/types.h> shouldn't be that big, right? */ | |
14 # include <sys/types.h> | |
15 namespace animone::internal { | |
16 using pid_t = ::pid_t; | 31 using pid_t = ::pid_t; |
17 } | |
18 #endif | 32 #endif |
19 | 33 |
34 /* different window systems have different sized IDs */ | |
35 union ANIMONE_API wid_t { | |
36 std::uintptr_t win32; | |
37 std::int64_t quartz; // FIXME is this correct? | |
38 std::uint32_t x11; | |
39 }; | |
40 | |
41 } | |
42 | |
20 #endif // ANIMONE_ANIMONE_TYPES_H_ | 43 #endif // ANIMONE_ANIMONE_TYPES_H_ |