converted function wf_on_param_change to new PubSub_ system. The function was not called anymore, which caused a refresh problem when changing Smart Sizing during a session.
This commit is contained in:
parent
173fede474
commit
46c06b5081
@ -10,7 +10,7 @@
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@ -332,7 +332,7 @@ BOOL wf_post_connect(freerdp* instance)
|
||||
rdpContext* context;
|
||||
WCHAR lpWindowName[64];
|
||||
rdpSettings* settings;
|
||||
EmbedWindowEventArgs e;
|
||||
EmbedWindowEventArgs e;
|
||||
|
||||
settings = instance->settings;
|
||||
context = instance->context;
|
||||
@ -390,9 +390,9 @@ BOOL wf_post_connect(freerdp* instance)
|
||||
else
|
||||
_snwprintf(lpWindowName, ARRAYSIZE(lpWindowName), L"FreeRDP: %S:%d", settings->ServerHostname, settings->ServerPort);
|
||||
|
||||
if (settings->EmbeddedWindow)
|
||||
settings->Decorations = FALSE;
|
||||
|
||||
if (settings->EmbeddedWindow)
|
||||
settings->Decorations = FALSE;
|
||||
|
||||
if (!settings->Decorations)
|
||||
dwStyle = WS_CHILD | WS_BORDER;
|
||||
else
|
||||
@ -403,7 +403,7 @@ BOOL wf_post_connect(freerdp* instance)
|
||||
wfc->hwnd = CreateWindowEx((DWORD) NULL, wfc->wndClassName, lpWindowName, dwStyle,
|
||||
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);
|
||||
@ -413,11 +413,11 @@ BOOL wf_post_connect(freerdp* instance)
|
||||
BitBlt(wfc->primary->hdc, 0, 0, wfc->width, wfc->height, NULL, 0, 0, BLACKNESS);
|
||||
wfc->drawing = wfc->primary;
|
||||
|
||||
EventArgsInit(&e, "wfreerdp");
|
||||
e.embed = FALSE;
|
||||
e.handle = (void*) wfc->hwnd;
|
||||
PubSub_OnEmbedWindow(context->pubSub, context, &e);
|
||||
|
||||
EventArgsInit(&e, "wfreerdp");
|
||||
e.embed = FALSE;
|
||||
e.handle = (void*) wfc->hwnd;
|
||||
PubSub_OnEmbedWindow(context->pubSub, context, &e);
|
||||
|
||||
ShowWindow(wfc->hwnd, SW_SHOWNORMAL);
|
||||
UpdateWindow(wfc->hwnd);
|
||||
|
||||
@ -774,8 +774,8 @@ int freerdp_client_focus_out(wfContext* wfc)
|
||||
|
||||
int freerdp_client_set_window_size(wfContext* wfc, int width, int height)
|
||||
{
|
||||
fprintf(stderr, "freerdp_client_set_window_size %d, %d", width, height);
|
||||
|
||||
fprintf(stderr, "freerdp_client_set_window_size %d, %d", width, height);
|
||||
|
||||
if ((width != wfc->client_width) || (height != wfc->client_height))
|
||||
{
|
||||
PostThreadMessage(wfc->mainThreadId, WM_SIZE, SIZE_RESTORED, ((UINT) height << 16) | (UINT) width);
|
||||
@ -784,19 +784,19 @@ int freerdp_client_set_window_size(wfContext* wfc, int width, int height)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void wf_on_param_change(freerdp* instance, int id)
|
||||
void wf_ParamChangeEventHandler(rdpContext* context, ParamChangeEventArgs* e)
|
||||
{
|
||||
RECT rect;
|
||||
HMENU hMenu;
|
||||
wfContext* wfc = (wfContext*) instance->context;
|
||||
wfContext* wfc = (wfContext*) context;
|
||||
|
||||
// specific processing here
|
||||
switch (id)
|
||||
switch (e->id)
|
||||
{
|
||||
case FreeRDP_SmartSizing:
|
||||
fprintf(stderr, "SmartSizing changed.\n");
|
||||
|
||||
if (!instance->settings->SmartSizing && (wfc->client_width > instance->settings->DesktopWidth || wfc->client_height > instance->settings->DesktopHeight))
|
||||
if (!context->settings->SmartSizing && (wfc->client_width > context->settings->DesktopWidth || wfc->client_height > context->settings->DesktopHeight))
|
||||
{
|
||||
GetWindowRect(wfc->hwnd, &rect);
|
||||
SetWindowPos(wfc->hwnd, HWND_TOP, 0, 0, MIN(wfc->client_width + wfc->offset_x, rect.right - rect.left), MIN(wfc->client_height + wfc->offset_y, rect.bottom - rect.top), SWP_NOMOVE | SWP_FRAMECHANGED);
|
||||
@ -804,7 +804,7 @@ void wf_on_param_change(freerdp* instance, int id)
|
||||
}
|
||||
|
||||
hMenu = GetSystemMenu(wfc->hwnd, FALSE);
|
||||
CheckMenuItem(hMenu, SYSCOMMAND_ID_SMARTSIZING, instance->settings->SmartSizing);
|
||||
CheckMenuItem(hMenu, SYSCOMMAND_ID_SMARTSIZING, context->settings->SmartSizing);
|
||||
wf_size_scrollbars(wfc, wfc->client_width, wfc->client_height);
|
||||
GetClientRect(wfc->hwnd, &rect);
|
||||
InvalidateRect(wfc->hwnd, &rect, TRUE);
|
||||
@ -1034,6 +1034,8 @@ int wfreerdp_client_new(freerdp* instance, rdpContext* context)
|
||||
wfc->instance = instance;
|
||||
context->channels = freerdp_channels_new();
|
||||
|
||||
PubSub_SubscribeParamChange(context->pubSub, wf_ParamChangeEventHandler);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user