From 21a107015aab3ebfd1b326cb85656390fa902373 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Tue, 19 Mar 2013 13:17:30 -0400 Subject: [PATCH] wfreerdp: add parent window handle parameter --- client/Windows/cli/wfreerdp.c | 2 +- client/Windows/wf_interface.c | 17 ++++++++++------- client/Windows/wf_interface.h | 3 ++- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/client/Windows/cli/wfreerdp.c b/client/Windows/cli/wfreerdp.c index 19a2b2412..00920d926 100644 --- a/client/Windows/cli/wfreerdp.c +++ b/client/Windows/cli/wfreerdp.c @@ -49,7 +49,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine wf_global_init(); - wfi = wf_new(hInstance, __argc, __argv); + wfi = wf_new(hInstance, NULL, __argc, __argv); status = wf_start(wfi); diff --git a/client/Windows/wf_interface.c b/client/Windows/wf_interface.c index 71b2fdb94..87dbb73e6 100644 --- a/client/Windows/wf_interface.c +++ b/client/Windows/wf_interface.c @@ -307,7 +307,7 @@ BOOL wf_post_connect(freerdp* instance) wfInfo* wfi; rdpCache* cache; wfContext* context; - WCHAR win_title[64]; + WCHAR lpWindowName[64]; rdpSettings* settings; settings = instance->settings; @@ -354,20 +354,22 @@ BOOL wf_post_connect(freerdp* instance) } if (settings->NSCodec) + { wfi->nsc_context = nsc_context_new(); + } } if (settings->WindowTitle != NULL) - _snwprintf(win_title, ARRAYSIZE(win_title), L"%S", settings->WindowTitle); + _snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"%S", settings->WindowTitle); else if (settings->ServerPort == 3389) - _snwprintf(win_title, ARRAYSIZE(win_title), L"FreeRDP: %S", settings->ServerHostname); + _snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S", settings->ServerHostname); else - _snwprintf(win_title, ARRAYSIZE(win_title), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort); + _snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort); if (!wfi->hwnd) { - wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, win_title, - 0, 0, 0, 0, 0, NULL, NULL, wfi->hInstance, NULL); + wfi->hwnd = CreateWindowEx((DWORD) NULL, wfi->wndClassName, lpWindowName, + 0, 0, 0, 0, 0, wfi->hWndParent, NULL, wfi->hInstance, NULL); SetWindowLongPtr(wfi->hwnd, GWLP_USERDATA, (LONG_PTR) wfi); } @@ -710,7 +712,7 @@ int wf_global_uninit() return 0; } -wfInfo* wf_new(HINSTANCE hInstance, int argc, char** argv) +wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv) { wfInfo* wfi; freerdp* instance; @@ -736,6 +738,7 @@ wfInfo* wf_new(HINSTANCE hInstance, int argc, char** argv) instance->context->argc = argc; instance->context->argv = argv; + wfi->hWndParent = hWndParent; wfi->hInstance = hInstance; wfi->cursor = LoadCursor(NULL, IDC_ARROW); wfi->icon = LoadIcon(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_ICON1)); diff --git a/client/Windows/wf_interface.h b/client/Windows/wf_interface.h index 2385fc058..44d47f783 100644 --- a/client/Windows/wf_interface.h +++ b/client/Windows/wf_interface.h @@ -80,6 +80,7 @@ struct wf_info HANDLE keyboardThread; HICON icon; + HWND hWndParent; HINSTANCE hInstance; WNDCLASSEX wndClass; LPCTSTR wndClassName; @@ -112,7 +113,7 @@ FREERDP_API int wf_global_uninit(); FREERDP_API int wf_start(wfInfo* wfi); FREERDP_API int wf_stop(wfInfo* wfi); -FREERDP_API wfInfo* wf_new(HINSTANCE hInstance, int argc, char** argv); +FREERDP_API wfInfo* wf_new(HINSTANCE hInstance, HWND hWndParent, int argc, char** argv); FREERDP_API int wf_free(wfInfo* wfi); #endif