Skip to content

Commit

Permalink
wfreerdp: add parent window handle parameter
Browse files Browse the repository at this point in the history
awakecoding committed Mar 19, 2013
1 parent 1123adc commit 21a1070
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion client/Windows/cli/wfreerdp.c
Original file line number Diff line number Diff line change
@@ -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);

17 changes: 10 additions & 7 deletions client/Windows/wf_interface.c
Original file line number Diff line number Diff line change
@@ -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));
3 changes: 2 additions & 1 deletion client/Windows/wf_interface.h
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 21a1070

Please sign in to comment.