pidgin/win32/gtkwin32dep.c

changeset 39999
2f878969929d
parent 39333
2da5959eb42c
child 40001
a63721e6215f
equal deleted inserted replaced
39998:15488497cd1a 39999:2f878969929d
488 static DwmGetWindowAttributeFunction DwmGetWindowAttribute = NULL; 488 static DwmGetWindowAttributeFunction DwmGetWindowAttribute = NULL;
489 #ifndef DWMWA_EXTENDED_FRAME_BOUNDS 489 #ifndef DWMWA_EXTENDED_FRAME_BOUNDS
490 # define DWMWA_EXTENDED_FRAME_BOUNDS 9 490 # define DWMWA_EXTENDED_FRAME_BOUNDS 9
491 #endif 491 #endif
492 492
493 static RECT 493 static void
494 get_actualWindowRect(HWND hwnd) 494 get_actualWindowRect(HWND hwnd, RECT *winR)
495 { 495 {
496 RECT winR; 496 GetWindowRect(hwnd, winR);
497
498 GetWindowRect(hwnd, &winR);
499 497
500 if (dwmapi_module == NULL) { 498 if (dwmapi_module == NULL) {
501 dwmapi_module = GetModuleHandleW(L"dwmapi.dll"); 499 dwmapi_module = GetModuleHandleW(L"dwmapi.dll");
502 if (dwmapi_module != NULL) { 500 if (dwmapi_module != NULL) {
503 DwmIsCompositionEnabled = (DwmIsCompositionEnabledFunction) GetProcAddress(dwmapi_module, "DwmIsCompositionEnabled"); 501 DwmIsCompositionEnabled = (DwmIsCompositionEnabledFunction) GetProcAddress(dwmapi_module, "DwmIsCompositionEnabled");
508 if (DwmIsCompositionEnabled != NULL && DwmGetWindowAttribute != NULL) { 506 if (DwmIsCompositionEnabled != NULL && DwmGetWindowAttribute != NULL) {
509 BOOL pfEnabled; 507 BOOL pfEnabled;
510 if (SUCCEEDED(DwmIsCompositionEnabled(&pfEnabled))) { 508 if (SUCCEEDED(DwmIsCompositionEnabled(&pfEnabled))) {
511 RECT tempR; 509 RECT tempR;
512 if (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &tempR, sizeof(tempR)))) { 510 if (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &tempR, sizeof(tempR)))) {
513 winR = tempR; 511 *winR = tempR;
514 } 512 }
515 } 513 }
516 } 514 }
517
518 return winR;
519 } 515 }
520 516
521 void winpidgin_ensure_onscreen(GtkWidget *win) { 517 void winpidgin_ensure_onscreen(GtkWidget *win) {
522 RECT winR, wAR, intR; 518 RECT winR, wAR, intR;
523 HWND hwnd = GDK_WINDOW_HWND(gtk_widget_get_window(win)); 519 HWND hwnd = GDK_WINDOW_HWND(gtk_widget_get_window(win));
524 520
525 g_return_if_fail(hwnd != NULL); 521 g_return_if_fail(hwnd != NULL);
526 winR = get_actualWindowRect(hwnd); 522 get_actualWindowRect(hwnd, &winR);
527 523
528 purple_debug_info("win32placement", 524 purple_debug_info("win32placement",
529 "Window RECT: L:%ld R:%ld T:%ld B:%ld\n", 525 "Window RECT: L:%ld R:%ld T:%ld B:%ld\n",
530 winR.left, winR.right, 526 winR.left, winR.right,
531 winR.top, winR.bottom); 527 winR.top, winR.bottom);

mercurial