mirror of https://github.com/FreeRDP/FreeRDP
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
|
@ -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