| 455 |
455 |
| 456 CopyRect(workingAreaRc, &(info.rcWork)); |
456 CopyRect(workingAreaRc, &(info.rcWork)); |
| 457 return TRUE; |
457 return TRUE; |
| 458 } |
458 } |
| 459 |
459 |
| |
460 typedef HRESULT (WINAPI* DwmIsCompositionEnabledFunction)(BOOL*); |
| |
461 typedef HRESULT (WINAPI* DwmGetWindowAttributeFunction)(HWND, DWORD, PVOID, DWORD); |
| |
462 static HMODULE dwmapi_module = NULL; |
| |
463 static DwmIsCompositionEnabledFunction DwmIsCompositionEnabled = NULL; |
| |
464 static DwmGetWindowAttributeFunction DwmGetWindowAttribute = NULL; |
| |
465 #ifndef DWMWA_EXTENDED_FRAME_BOUNDS |
| |
466 # define DWMWA_EXTENDED_FRAME_BOUNDS 9 |
| |
467 #endif |
| |
468 |
| |
469 static RECT |
| |
470 get_actualWindowRect(HWND hwnd) |
| |
471 { |
| |
472 RECT winR; |
| |
473 |
| |
474 GetWindowRect(hwnd, &winR); |
| |
475 |
| |
476 if (dwmapi_module == NULL) { |
| |
477 dwmapi_module = GetModuleHandleW(L"dwmapi.dll"); |
| |
478 if (dwmapi_module != NULL) { |
| |
479 DwmIsCompositionEnabled = (DwmIsCompositionEnabledFunction) GetProcAddress(dwmapi_module, "DwmIsCompositionEnabled"); |
| |
480 DwmGetWindowAttribute = (DwmGetWindowAttributeFunction) GetProcAddress(dwmapi_module, "DwmGetWindowAttribute"); |
| |
481 } |
| |
482 } |
| |
483 |
| |
484 if (DwmIsCompositionEnabled != NULL && DwmGetWindowAttribute != NULL) { |
| |
485 BOOL pfEnabled; |
| |
486 if (SUCCEEDED(DwmIsCompositionEnabled(&pfEnabled))) { |
| |
487 RECT tempR; |
| |
488 if (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &tempR, sizeof(tempR)))) { |
| |
489 winR = tempR; |
| |
490 } |
| |
491 } |
| |
492 } |
| |
493 |
| |
494 return winR; |
| |
495 } |
| |
496 |
| 460 void winpidgin_ensure_onscreen(GtkWidget *win) { |
497 void winpidgin_ensure_onscreen(GtkWidget *win) { |
| 461 RECT winR, wAR, intR; |
498 RECT winR, wAR, intR; |
| 462 HWND hwnd = GDK_WINDOW_HWND(gtk_widget_get_window(win)); |
499 HWND hwnd = GDK_WINDOW_HWND(gtk_widget_get_window(win)); |
| 463 |
500 |
| 464 g_return_if_fail(hwnd != NULL); |
501 g_return_if_fail(hwnd != NULL); |
| 465 GetWindowRect(hwnd, &winR); |
502 winR = get_actualWindowRect(hwnd); |
| 466 |
503 |
| 467 purple_debug_info("win32placement", |
504 purple_debug_info("win32placement", |
| 468 "Window RECT: L:%ld R:%ld T:%ld B:%ld\n", |
505 "Window RECT: L:%ld R:%ld T:%ld B:%ld\n", |
| 469 winR.left, winR.right, |
506 winR.left, winR.right, |
| 470 winR.top, winR.bottom); |
507 winR.top, winR.bottom); |