We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
/*===-- wtk/app.h -------------------------------------------*- mode: C -*-===*\ |* *| |* _ _ *| |* _ _ _| |_| |_ *| |* | | | | _| '_| *| |* |_____|_| |_,_| *| |* *| |* This file is distributed under the terms described in LICENSE. *| |* *| |*===----------------------------------------------------------------------===*| |* *| |* *| |* *| \*===----------------------------------------------------------------------===*/ #ifndef _WTK_APP_H_ #define _WTK_APP_H_ /* #include "" */ WTK_BEGIN_EXTERN_C /* { */ /*! \copydoc wtk_app */ typedef struct wtk_app wtk_app_t; /*! */ typedef (*wtk_app_on_quit_fn)(struct wtk_app *app); /*! */ struct wtk_app { /*! \copydoc wtk_app_on_quit_fn */ wtk_app_on_quit_fn on_quit; }; /*! */ extern WTK_PUBLIC void wtk_app_init(struct wtk_app *app); /*! */ extern WTK_PUBLIC void wtk_app_run(struct wtk_app *app); /*! */ extern WTK_PUBLIC void wtk_app_quit(struct wtk_app *app); WTK_END_EXTERN_C /* } */ #endif /* _WTK_APP_H_ */ /*===-- wtk/app.c -------------------------------------------*- mode: C -*-===*\ |* *| |* _ _ *| |* _ _ _| |_| |_ *| |* | | | | _| '_| *| |* |_____|_| |_,_| *| |* *| |* This file is distributed under the terms described in LICENSE. *| |* *| |*===----------------------------------------------------------------------===*| |* *| |* *| |* *| \*===----------------------------------------------------------------------===*/ #include "wtk/app.h" #if WTK_PLATFORM == WTK_PLATFORM_WINDOWS # pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #endif WTK_BEGIN_EXTERN_C /* { */ static void _def_on_quit_handler(struct wtk_app *app) { wtk_assert_debug(app != (struct wtk_app *)NULL); exit(EXIT_SUCCESS); } void wtk_app_init(struct wtk_app *app) { wtk_assert_debug(app != (struct wtk_app *)NULL); app->on_quit = &_def_on_quit_handler; #if WTK_PLATFORM == WTK_PLATFORM_WINDOWS /* Enable visual styles on Windows XP and later. */ { const DWORD dwVersion = GetVersion(); const DWORD dwMinorVersion = (DWORD)(HIBYTE(LOWORD(dwVersion))); const DWORD dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); if ((dwMajorVersion > 5) || ((dwMajorVersion == 5) && (dwMinorVersion >= 1))) { static const INITCOMMONCONTROLSEX iccx = { sizeof(INITCOMMONCONTROLSEX), ICC_BAR_CLASSES | ICC_HOTKEY_CLASS | ICC_INTERNET_CLASSES | ICC_LINK_CLASS | ICC_LISTVIEW_CLASSES | ICC_PROGRESS_CLASS | ICC_STANDARD_CLASSES | ICC_TAB_CLASSES | ICC_TREEVIEW_CLASSES }; InitCommonControlsEx(&iccx); } } #elif WTK_PLATFORM == WTK_PLATFORM_MAC_OS_X #elif WTK_PLATFORM == WTK_PLATFORM_LINUX #endif } void wtk_app_run(struct wtk_app *app) { wtk_assert_debug(app != (struct wtk_app *)NULL); #if WTK_PLATFORM == WTK_PLATFORM_WINDOWS MSG msg; for (;;) { while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) { if (msg.message == WM_QUIT) app->on_quit(app); TranslateMessage(&msg); DispatchMessage(&msg); } } #elif WTK_PLATFORM == WTK_PLATFORM_MAC_OS_X #elif WTK_PLATFORM == WTK_PLATFORM_LINUX #endif } void wtk_app_quit(struct wtk_app *app) { wtk_assert_debug(app != (struct wtk_app *)NULL); wtk_assert_debug(app->on_quit != (wtk_app_on_quit_fn)NULL); #if WTK_PLATFORM == WTK_PLATFORM_WINDOWS PostQuitMessage(0); #elif WTK_PLATFORM == WTK_PLATFORM_MAC_OS_X #elif WTK_PLATFORM == WTK_PLATFORM_LINUX #endif } WTK_END_EXTERN_C /* } */
The text was updated successfully, but these errors were encountered:
We'll want to move off of the "duck typing" used for arguments. Rather, a fixed API should be provided.
Sorry, something went wrong.
mtwilliams
No branches or pull requests
The text was updated successfully, but these errors were encountered: