comparison dep/animia/src/win.cc @ 198:bc1ae1810855

dep/animia: switch from using classes to global functions the old idea was ok, but sort of hackish; this method doesn't use classes at all, and this way (especially important!) we can do wayland stuff AND x11 at the same time, which wasn't really possible without stupid workarounds in the other method
author Paper <mrpapersonic@gmail.com>
date Sun, 24 Dec 2023 02:59:42 -0500
parents 2d5823df870f
children 9f3534f6b8c4
comparison
equal deleted inserted replaced
197:c4ca035c565d 198:bc1ae1810855
1 #include "animia/win.h" 1 #include "animia/win.h"
2 2
3 #ifdef WIN32 3 #ifdef WIN32
4 # include "animia/win/win32.h" 4 # include "animia/win/win32.h"
5 #elif defined(MACOSX) 5 #endif
6
7 #ifdef MACOSX
6 # include "animia/win/quartz.h" 8 # include "animia/win/quartz.h"
7 #elif defined(X11) 9 #endif
10
11 #ifdef X11
8 # include "animia/win/x11.h" 12 # include "animia/win/x11.h"
9 #endif 13 #endif
10 14
11 namespace animia::internal { 15 namespace animia::internal {
12 16
17 bool EnumerateWindows(window_proc_t window_proc) {
18 bool success = false;
19
13 #ifdef WIN32 20 #ifdef WIN32
14 win32::Win32WinTools os_win; 21 success ^= win32::EnumerateWindows(window_proc);
15 #elif defined(MACOSX)
16 quartz::QuartzWinTools os_win;
17 #elif defined(X11)
18 x11::X11WinTools os_win;
19 #else
20 BaseWinTools os_win;
21 #endif 22 #endif
22 23
23 BaseWinTools& win = os_win; 24 #ifdef MACOSX
25 success ^= quartz::EnumerateWindows(window_proc);
26 #endif
27
28 #ifdef X11
29 success ^= x11::EnumerateWindows(window_proc);
30 #endif
31
32 return success;
33 }
24 34
25 } // namespace animia::internal 35 } // namespace animia::internal