Changeset 32306 for lang/objective-cplusplus
- Timestamp:
- 04/12/09 15:33:54 (4 years ago)
- Location:
- lang/objective-cplusplus/i3/trunk/src/gui-windows
- Files:
-
- 3 modified
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-cplusplus/i3/trunk/src/gui-windows/Gui.cpp
r32299 r32306 5 5 { 6 6 7 HRESULT (*dll_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset) = NULL; 8 HRESULT (*dll_DwmIsCompositionEnabled)(BOOL *pfEnabled) = NULL; 9 HRESULT (*dll_DwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind) = NULL; 7 dll_ dll = {}; 8 OSVERSIONINFO version_info = {}; 10 9 11 10 int global_loop() … … 39 38 init_hInstance(); 40 39 40 version_info.dwOSVersionInfoSize = sizeof(version_info); 41 BOOL result = GetVersionEx(&version_info); 41 42 42 #define SET_DLL_ADDRESS(dll, name) dll_##name = (decltype(dll_##name))GetProcAddress(dll, #name); 43 if (version_info.dwMajorVersion >= 6) { 43 44 44 HMODULE dwmapi_dll = LoadLibrary(_T("dwmapi.dll")); 45 if (dwmapi_dll) { 46 SET_DLL_ADDRESS(dwmapi_dll, DwmExtendFrameIntoClientArea); 47 SET_DLL_ADDRESS(dwmapi_dll, DwmIsCompositionEnabled); 48 SET_DLL_ADDRESS(dwmapi_dll, DwmEnableBlurBehindWindow); 45 #define SET_DLL_ADDRESS(module, name) i3::dll.dll_##name = (decltype(i3::dll.dll_##name))GetProcAddress(module, #name); 46 47 HMODULE dwmapi_dll = LoadLibrary(_T("dwmapi.dll")); 48 if (dwmapi_dll) { 49 dll.have_dwmapi_dll = true; 50 SET_DLL_ADDRESS(dwmapi_dll, DwmExtendFrameIntoClientArea); 51 SET_DLL_ADDRESS(dwmapi_dll, DwmIsCompositionEnabled); 52 SET_DLL_ADDRESS(dwmapi_dll, DwmEnableBlurBehindWindow); 53 } 49 54 } 50 55 return 0; -
lang/objective-cplusplus/i3/trunk/src/gui-windows/Gui.h
r32300 r32306 47 47 typedef boost::basic_format<TCHAR> format; 48 48 49 extern HRESULT (*dll_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset); 50 extern HRESULT (*dll_DwmIsCompositionEnabled)(BOOL *pfEnabled); 51 extern HRESULT (*dll_DwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind); 49 extern struct dll_ { 50 bool have_dwmapi_dll; 51 HRESULT (*dll_DwmExtendFrameIntoClientArea)(HWND hWnd, const MARGINS *pMarInset); 52 HRESULT (*dll_DwmIsCompositionEnabled)(BOOL *pfEnabled); 53 HRESULT (*dll_DwmEnableBlurBehindWindow)(HWND hWnd, const DWM_BLURBEHIND *pBlurBehind); 54 } dll; 52 55 53 56 } -
lang/objective-cplusplus/i3/trunk/src/gui-windows/InputWindowPlatform.cpp
r32299 r32306 264 264 HDC hdc = BeginPaint(hwnd , &ps); 265 265 266 FillRect(ps.hdc, &ps.rcPaint, (HBRUSH)GetStockObject(BLACK_BRUSH)); 266 if (dll.have_dwmapi_dll) { 267 FillRect(ps.hdc, &ps.rcPaint, (HBRUSH)GetStockObject(BLACK_BRUSH)); 268 } 267 269 268 270 //HBRUSH hBrushYellow = NULL; … … 280 282 } 281 283 282 EndPaint(hwnd , &ps);284 EndPaint(hwnd, &ps); 283 285 SetMsgHandled(false); 284 286 } … … 345 347 346 348 int richedit_style = WS_CHILD | WS_VISIBLE; 347 if (!dll _DwmExtendFrameIntoClientArea) {349 if (!dll.dll_DwmExtendFrameIntoClientArea) { 348 350 richedit_style |= WS_BORDER; 349 351 } … … 411 413 SetWindowPos(hEdit, 0, edit_height, 0, DEFAULT_WINDOW_WIDTH - nc_width - edit_height, edit_height, SWP_NOACTIVATE | SWP_NOREDRAW | SWP_NOOWNERZORDER | SWP_NOZORDER); 412 414 413 414 LRESULT dwEvent = SendMessage(hEdit, EM_GETEVENTMASK, 0, 0);415 dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE;416 SendMessage(hEdit, EM_SETEVENTMASK, 0, (LPARAM)dwEvent);417 418 InvalidateRect(w, NULL, FALSE);419 UpdateWindow(w);420 ShowWindow(w, nCmdShow);421 SetFocus(hEdit);422 423 //SetLayeredWindowAttributes(w, 0, 200, LWA_ALPHA);424 425 // �^�X�N�g���C�p�̃A�C�R���̍쐬426 NOTIFYICONDATA connectingIcon = {};427 connectingIcon.cbSize = sizeof(connectingIcon);428 connectingIcon.hIcon = LoadIcon(get_hInstance(), _T("IDI_ICON1"));429 connectingIcon.hWnd = w;430 connectingIcon.uCallbackMessage = WM_USER + 10;431 connectingIcon.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP;432 _tcscpy_s(connectingIcon.szTip, _T(""));433 Shell_NotifyIcon(NIM_ADD, &connectingIcon);434 435 415 setWindow(w); 436 416 wndproc.set(w); 437 417 438 418 // f 439 if (dll_DwmIsCompositionEnabled && 440 dll_DwmExtendFrameIntoClientArea && 441 dll_DwmEnableBlurBehindWindow) { 419 if (dll.have_dwmapi_dll) { 442 420 BOOL enabled = FALSE; 443 HRESULT hr = dll _DwmIsCompositionEnabled(&enabled);421 HRESULT hr = dll.dll_DwmIsCompositionEnabled(&enabled); 444 422 if (SUCCEEDED(hr) && enabled) { 445 423 HRESULT hr = S_OK; … … 455 433 //SendMessage(hEdit, EM_SETBKGNDCOLOR, (WPARAM)0, (LPARAM)RGB(0, 0, 0)); 456 434 MARGINS margins = {edit_height, 0, 0, 0}; 457 hr = dll_DwmExtendFrameIntoClientArea(w,&margins); 458 } 459 } 435 hr = dll.dll_DwmExtendFrameIntoClientArea(w,&margins); 436 } 437 } 438 //InvalidateRect(w, NULL, FALSE); 439 UpdateWindow(w); 440 ShowWindow(w, nCmdShow); 441 //UpdateWindow(hEdit); 442 SetFocus(hEdit); 443 444 445 // ------------------------------------------------------------- 446 // lazy init 447 448 LRESULT dwEvent = SendMessage(hEdit, EM_GETEVENTMASK, 0, 0); 449 dwEvent |= ENM_MOUSEEVENTS | ENM_KEYEVENTS | ENM_CHANGE; 450 SendMessage(hEdit, EM_SETEVENTMASK, 0, (LPARAM)dwEvent); 451 452 //SetLayeredWindowAttributes(w, 0, 200, LWA_ALPHA); 453 454 // �^�X�N�g���C�p�̃A�C�R���̍쐬 455 NOTIFYICONDATA connectingIcon = {}; 456 connectingIcon.cbSize = sizeof(connectingIcon); 457 connectingIcon.hIcon = LoadIcon(get_hInstance(), _T("IDI_ICON1")); 458 connectingIcon.hWnd = w; 459 connectingIcon.uCallbackMessage = WM_USER + 10; 460 connectingIcon.uFlags = NIF_MESSAGE | NIF_ICON | NIF_TIP; 461 _tcscpy_s(connectingIcon.szTip, _T("")); 462 Shell_NotifyIcon(NIM_ADD, &connectingIcon); 460 463 } 461 464
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)