| 1 | #include <PrecompiledHeaders.h>
|
|---|
| 2 | #include "../Common.h"
|
|---|
| 3 |
|
|---|
| 4 | namespace i3 {
|
|---|
| 5 |
|
|---|
| 6 | int global_loop() {
|
|---|
| 7 | MSG msg = {};
|
|---|
| 8 | for (;;) {
|
|---|
| 9 | BOOL result = GetMessage(&msg, NULL, 0, 0);
|
|---|
| 10 | if (!result) {
|
|---|
| 11 | break;
|
|---|
| 12 | } else if (result == -1) {
|
|---|
| 13 | halt << msg.message;
|
|---|
| 14 | break;
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | TranslateMessage(&msg);
|
|---|
| 18 | DispatchMessage(&msg);
|
|---|
| 19 | }
|
|---|
| 20 | return (int)msg.wParam;
|
|---|
| 21 | }
|
|---|
| 22 | void alert(string message) {
|
|---|
| 23 | MessageBox(NULL, message.c_str(), _("info"), MB_OK);
|
|---|
| 24 | }
|
|---|
| 25 |
|
|---|
| 26 | int init_gui_global_data(int argc, char** argv) {
|
|---|
| 27 | #if defined(ENABLE_NLS) && (defined(UNICODE) || defined(_UNICODE))
|
|---|
| 28 | bind_textdomain_codeset(PACKAGE_NAME, "UTF-16LE");
|
|---|
| 29 | #endif
|
|---|
| 30 |
|
|---|
| 31 | if (!i3::hInstance) {
|
|---|
| 32 | i3::hInstance = GetModuleHandle(NULL);
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | InitCommonControls();
|
|---|
| 36 |
|
|---|
| 37 | #ifndef _WIN32_WCE
|
|---|
| 38 | #define SET_DLL_ADDRESS(module, name) \
|
|---|
| 39 | *(uintptr_t*)(&i3::dll.dll_##name) = (uintptr_t)GetProcAddress(module, #name);
|
|---|
| 40 | #else
|
|---|
| 41 | #define SET_DLL_ADDRESS(module, name) \
|
|---|
| 42 | *(uintptr_t*)(&i3::dll.dll_##name) = (uintptr_t)GetProcAddress(module, _T(#name));
|
|---|
| 43 | #endif
|
|---|
| 44 |
|
|---|
| 45 | HMODULE dwmapi_dll = LoadLibrary(_T("dwmapi.dll"));
|
|---|
| 46 | if (dwmapi_dll) {
|
|---|
| 47 | dll.have_dwmapi_dll = true;
|
|---|
| 48 | SET_DLL_ADDRESS(dwmapi_dll, DwmExtendFrameIntoClientArea);
|
|---|
| 49 | SET_DLL_ADDRESS(dwmapi_dll, DwmIsCompositionEnabled);
|
|---|
| 50 | SET_DLL_ADDRESS(dwmapi_dll, DwmEnableBlurBehindWindow);
|
|---|
| 51 | SET_DLL_ADDRESS(dwmapi_dll, DwmGetColorizationColor);
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | HMODULE user32_dll = LoadLibrary(_T("user32.dll"));
|
|---|
| 55 | if (user32_dll) {
|
|---|
| 56 | SET_DLL_ADDRESS(user32_dll, SetLayeredWindowAttributes);
|
|---|
| 57 | }
|
|---|
| 58 |
|
|---|
| 59 | return 0;
|
|---|
| 60 | }
|
|---|
| 61 | }
|
|---|
| 62 |
|
|---|