wf_interface: added function wf_set_window_size

windows: triggering OnEmbedWindow event
This commit is contained in:
Benoît LeBlanc 2013-10-03 17:09:53 -04:00
parent d274363b1a
commit 77c260da14
2 changed files with 12 additions and 1 deletions

View File

@ -49,6 +49,7 @@
#include <freerdp/client/cmdline.h> #include <freerdp/client/cmdline.h>
#include <freerdp/client/channels.h> #include <freerdp/client/channels.h>
#include <freerdp/channels/channels.h> #include <freerdp/channels/channels.h>
#include <freerdp/event.h>
#include "wf_gdi.h" #include "wf_gdi.h"
#include "wf_graphics.h" #include "wf_graphics.h"
@ -331,6 +332,7 @@ BOOL wf_post_connect(freerdp* instance)
rdpContext* context; rdpContext* context;
WCHAR lpWindowName[64]; WCHAR lpWindowName[64];
rdpSettings* settings; rdpSettings* settings;
EmbedWindowEventArgs e;
settings = instance->settings; settings = instance->settings;
context = instance->context; context = instance->context;
@ -401,7 +403,7 @@ BOOL wf_post_connect(freerdp* instance)
wfc->hwnd = CreateWindowEx((DWORD) NULL, wfc->wndClassName, lpWindowName, dwStyle, wfc->hwnd = CreateWindowEx((DWORD) NULL, wfc->wndClassName, lpWindowName, dwStyle,
0, 0, 0, 0, wfc->hWndParent, NULL, wfc->hInstance, NULL); 0, 0, 0, 0, wfc->hWndParent, NULL, wfc->hInstance, NULL);
SetWindowLongPtr(wfc->hwnd, GWLP_USERDATA, (LONG_PTR) wfc); SetWindowLongPtr(wfc->hwnd, GWLP_USERDATA, (LONG_PTR) wfc);
} }
wf_resize_window(wfc); wf_resize_window(wfc);
@ -411,6 +413,11 @@ BOOL wf_post_connect(freerdp* instance)
BitBlt(wfc->primary->hdc, 0, 0, wfc->width, wfc->height, NULL, 0, 0, BLACKNESS); BitBlt(wfc->primary->hdc, 0, 0, wfc->width, wfc->height, NULL, 0, 0, BLACKNESS);
wfc->drawing = wfc->primary; wfc->drawing = wfc->primary;
EventArgsInit(&e, "wfreerdp");
e.embed = FALSE;
e.handle = (void*) wfc->hwnd;
PubSub_OnEmbedWindow(context->pubSub, context, &e);
ShowWindow(wfc->hwnd, SW_SHOWNORMAL); ShowWindow(wfc->hwnd, SW_SHOWNORMAL);
UpdateWindow(wfc->hwnd); UpdateWindow(wfc->hwnd);
@ -767,6 +774,8 @@ int freerdp_client_focus_out(wfContext* wfc)
int freerdp_client_set_window_size(wfContext* wfc, int width, int height) int freerdp_client_set_window_size(wfContext* wfc, int width, int height)
{ {
fprintf(stderr, "freerdp_client_set_window_size %d, %d", width, height);
if ((width != wfc->client_width) || (height != wfc->client_height)) if ((width != wfc->client_width) || (height != wfc->client_height))
{ {
PostThreadMessage(wfc->mainThreadId, WM_SIZE, SIZE_RESTORED, ((UINT) height << 16) | (UINT) width); PostThreadMessage(wfc->mainThreadId, WM_SIZE, SIZE_RESTORED, ((UINT) height << 16) | (UINT) width);

View File

@ -138,6 +138,8 @@ typedef struct wf_context wfContext;
*/ */
FREERDP_API int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints); FREERDP_API int RdpClientEntry(RDP_CLIENT_ENTRY_POINTS* pEntryPoints);
FREERDP_API int freerdp_client_set_window_size(wfContext* wfc, int width, int height);
#ifdef __cplusplus #ifdef __cplusplus
} }