/pidgin/main: fa3c41b69e47: win32: Fix window placement on Windo...
Eion Robb <[email protected]>
| Newsgroups | gmane.comp.gnome.gaim.cvs |
|---|---|
| Message-ID | <[email protected]> |
Changeset: fa3c41b69e47ded8e0214d5e8c8ffc689a8fe051 Author: Eion Robb <[email protected]> Date: 2016-02-03 15:56 -0500 Branch: release-2.x.y URL: https://hg.pidgin.im/pidgin/main/rev/fa3c41b69e47 Description: win32: Fix window placement on Windows >= Vista. Fixes #16830 diffstat: pidgin/win32/gtkwin32dep.c | 39 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 1 deletions(-) diffs (51 lines): diff --git a/pidgin/win32/gtkwin32dep.c b/pidgin/win32/gtkwin32dep.c --- a/pidgin/win32/gtkwin32dep.c +++ b/pidgin/win32/gtkwin32dep.c @@ -468,9 +468,46 @@ get_WorkingAreaRectForWindow(HWND hwnd, void winpidgin_ensure_onscreen(GtkWidget *win) { RECT winR, wAR, intR; HWND hwnd = GDK_WINDOW_HWND(win->window); +typedef HRESULT (WINAPI* DwmIsCompositionEnabledFunction)(BOOL*); +typedef HRESULT (WINAPI* DwmGetWindowAttributeFunction)(HWND, DWORD, PVOID, DWORD); +static HMODULE dwmapi_module = NULL; +static DwmIsCompositionEnabledFunction DwmIsCompositionEnabled = NULL; +static DwmGetWindowAttributeFunction DwmGetWindowAttribute = NULL; +#ifndef DWMWA_EXTENDED_FRAME_BOUNDS +# define DWMWA_EXTENDED_FRAME_BOUNDS 9 +#endif + +static RECT +get_actualWindowRect(HWND hwnd) +{ + RECT winR; + + GetWindowRect(hwnd, &winR); + + if (dwmapi_module == NULL) { + dwmapi_module = GetModuleHandleW(L"dwmapi.dll"); + if (dwmapi_module != NULL) { + DwmIsCompositionEnabled = (DwmIsCompositionEnabledFunction) GetProcAddress(dwmapi_module, "DwmIsCompositionEnabled"); + DwmGetWindowAttribute = (DwmGetWindowAttributeFunction) GetProcAddress(dwmapi_module, "DwmGetWindowAttribute"); + } + } + + if (DwmIsCompositionEnabled != NULL && DwmGetWindowAttribute != NULL) { + BOOL pfEnabled; + if (SUCCEEDED(DwmIsCompositionEnabled(&pfEnabled))) { + RECT tempR; + if (SUCCEEDED(DwmGetWindowAttribute(hwnd, DWMWA_EXTENDED_FRAME_BOUNDS, &tempR, sizeof(tempR)))) { + winR = tempR; + } + } + } + + return winR; +} + g_return_if_fail(hwnd != NULL); - GetWindowRect(hwnd, &winR); + winR = get_actualWindowRect(hwnd); purple_debug_info("win32placement", "Window RECT: L:%ld R:%ld T:%ld B:%ld\n", _______________________________________________ Commits mailing list [email protected] https://pidgin.im/cgi-bin/mailman/listinfo/commits