mfreerdp: fix dynamic desktop resize
This commit is contained in:
parent
1b5f574711
commit
5350d8e7c6
@ -1267,6 +1267,7 @@ BOOL mac_end_paint(rdpContext* context)
|
|||||||
|
|
||||||
BOOL mac_desktop_resize(rdpContext* context)
|
BOOL mac_desktop_resize(rdpContext* context)
|
||||||
{
|
{
|
||||||
|
ResizeWindowEventArgs e;
|
||||||
mfContext* mfc = (mfContext*) context;
|
mfContext* mfc = (mfContext*) context;
|
||||||
MRDPView* view = (MRDPView*) mfc->view;
|
MRDPView* view = (MRDPView*) mfc->view;
|
||||||
rdpSettings* settings = context->settings;
|
rdpSettings* settings = context->settings;
|
||||||
@ -1288,8 +1289,21 @@ BOOL mac_desktop_resize(rdpContext* context)
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
view->bitmap_context = mac_create_bitmap_context(context);
|
view->bitmap_context = mac_create_bitmap_context(context);
|
||||||
|
|
||||||
if (!view->bitmap_context)
|
if (!view->bitmap_context)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
mfc->client_width = mfc->width;
|
||||||
|
mfc->client_height = mfc->height;
|
||||||
|
|
||||||
|
[view setFrameSize:NSMakeSize(mfc->width, mfc->height)];
|
||||||
|
|
||||||
|
EventArgsInit(&e, "mfreerdp");
|
||||||
|
e.width = settings->DesktopWidth;
|
||||||
|
e.height = settings->DesktopHeight;
|
||||||
|
|
||||||
|
PubSub_OnResizeWindow(context->pubSub, context, &e);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
#import <freerdp/client/cmdline.h>
|
#import <freerdp/client/cmdline.h>
|
||||||
|
|
||||||
static AppDelegate* _singleDelegate = nil;
|
static AppDelegate* _singleDelegate = nil;
|
||||||
void AppDelegate_EmbedWindowEventHandler(void* context, EmbedWindowEventArgs* e);
|
|
||||||
void AppDelegate_ConnectionResultEventHandler(void* context, ConnectionResultEventArgs* e);
|
void AppDelegate_ConnectionResultEventHandler(void* context, ConnectionResultEventArgs* e);
|
||||||
void AppDelegate_ErrorInfoEventHandler(void* ctx, ErrorInfoEventArgs* e);
|
void AppDelegate_ErrorInfoEventHandler(void* ctx, ErrorInfoEventArgs* e);
|
||||||
|
void AppDelegate_EmbedWindowEventHandler(void* context, EmbedWindowEventArgs* e);
|
||||||
|
void AppDelegate_ResizeWindowEventHandler(void* context, ResizeWindowEventArgs* e);
|
||||||
void mac_set_view_size(rdpContext* context, MRDPView* view);
|
void mac_set_view_size(rdpContext* context, MRDPView* view);
|
||||||
|
|
||||||
@implementation AppDelegate
|
@implementation AppDelegate
|
||||||
@ -52,6 +53,7 @@ void mac_set_view_size(rdpContext* context, MRDPView* view);
|
|||||||
PubSub_SubscribeConnectionResult(context->pubSub, AppDelegate_ConnectionResultEventHandler);
|
PubSub_SubscribeConnectionResult(context->pubSub, AppDelegate_ConnectionResultEventHandler);
|
||||||
PubSub_SubscribeErrorInfo(context->pubSub, AppDelegate_ErrorInfoEventHandler);
|
PubSub_SubscribeErrorInfo(context->pubSub, AppDelegate_ErrorInfoEventHandler);
|
||||||
PubSub_SubscribeEmbedWindow(context->pubSub, AppDelegate_EmbedWindowEventHandler);
|
PubSub_SubscribeEmbedWindow(context->pubSub, AppDelegate_EmbedWindowEventHandler);
|
||||||
|
PubSub_SubscribeResizeWindow(context->pubSub, AppDelegate_ResizeWindowEventHandler);
|
||||||
|
|
||||||
freerdp_client_start(context);
|
freerdp_client_start(context);
|
||||||
}
|
}
|
||||||
@ -171,24 +173,6 @@ void mac_set_view_size(rdpContext* context, MRDPView* view);
|
|||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
void AppDelegate_EmbedWindowEventHandler(void* ctx, EmbedWindowEventArgs* e)
|
|
||||||
{
|
|
||||||
rdpContext* context = (rdpContext*) ctx;
|
|
||||||
|
|
||||||
if (_singleDelegate)
|
|
||||||
{
|
|
||||||
mfContext* mfc = (mfContext*) context;
|
|
||||||
_singleDelegate->mrdpView = mfc->view;
|
|
||||||
|
|
||||||
if (_singleDelegate->window)
|
|
||||||
{
|
|
||||||
[[_singleDelegate->window contentView] addSubview:mfc->view];
|
|
||||||
}
|
|
||||||
|
|
||||||
mac_set_view_size(context, mfc->view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** *********************************************************************
|
/** *********************************************************************
|
||||||
* On connection error, display message and quit application
|
* On connection error, display message and quit application
|
||||||
***********************************************************************/
|
***********************************************************************/
|
||||||
@ -232,6 +216,37 @@ void AppDelegate_ErrorInfoEventHandler(void* ctx, ErrorInfoEventArgs* e)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AppDelegate_EmbedWindowEventHandler(void* ctx, EmbedWindowEventArgs* e)
|
||||||
|
{
|
||||||
|
rdpContext* context = (rdpContext*) ctx;
|
||||||
|
|
||||||
|
if (_singleDelegate)
|
||||||
|
{
|
||||||
|
mfContext* mfc = (mfContext*) context;
|
||||||
|
_singleDelegate->mrdpView = mfc->view;
|
||||||
|
|
||||||
|
if (_singleDelegate->window)
|
||||||
|
{
|
||||||
|
[[_singleDelegate->window contentView] addSubview:mfc->view];
|
||||||
|
}
|
||||||
|
|
||||||
|
mac_set_view_size(context, mfc->view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AppDelegate_ResizeWindowEventHandler(void* ctx, ResizeWindowEventArgs* e)
|
||||||
|
{
|
||||||
|
rdpContext* context = (rdpContext*) ctx;
|
||||||
|
|
||||||
|
fprintf(stderr, "ResizeWindowEventHandler: %d %d\n", e->width, e->height);
|
||||||
|
|
||||||
|
if (_singleDelegate)
|
||||||
|
{
|
||||||
|
mfContext* mfc = (mfContext*) context;
|
||||||
|
mac_set_view_size(context, mfc->view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void mac_set_view_size(rdpContext* context, MRDPView* view)
|
void mac_set_view_size(rdpContext* context, MRDPView* view)
|
||||||
{
|
{
|
||||||
// set client area to specified dimensions
|
// set client area to specified dimensions
|
||||||
|
Loading…
Reference in New Issue
Block a user