Merge pull request #1499 from elupus/fullscreen

Fullscreen & MouseWheel
This commit is contained in:
Marc-André Moreau 2013-09-23 13:46:43 -07:00
commit 5020996ead
2 changed files with 44 additions and 34 deletions

View File

@ -138,8 +138,22 @@ struct rgba_data
e.embed = TRUE;
e.handle = (void*) self;
PubSub_OnEmbedWindow(context->pubSub, context, &e);
NSScreen *screen = [[NSScreen screens] objectAtIndex:0];
NSRect screenFrame = [screen frame];
if(instance->settings->Fullscreen)
{
instance->settings->DesktopWidth = screenFrame.size.width;
instance->settings->DesktopHeight = screenFrame.size.height;
}
[self setViewSize :instance->settings->DesktopWidth :instance->settings->DesktopHeight];
if(instance->settings->Fullscreen)
[[self window] toggleFullScreen:nil];
mfc->thread = CreateThread(NULL, 0, mac_client_thread, (void*) context, 0, &mfc->mainThreadId);
return 0;
@ -477,15 +491,18 @@ DWORD mac_client_thread(void* param)
flags = PTR_FLAGS_WHEEL;
if ([event deltaY] < 0)
flags |= PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
else
flags |= 0x0078;
/* 1 event = 120 units */
int units = [event deltaY] * 120;
x += (int) [event deltaX];
y += (int) [event deltaY];
/* send out all accumulated rotations */
while(units != 0)
{
/* limit to maximum value in WheelRotationMask (9bit signed value) */
int step = MIN(MAX(-256, units), 255);
instance->input->MouseEvent(instance->input, flags, x, y);
instance->input->MouseEvent(instance->input, flags | ((UINT16)step & WheelRotationMask), x, y);
units -= step;
}
}
/** *********************************************************************
@ -749,33 +766,24 @@ DWORD mac_client_thread(void* param)
width = w;
height = h;
// compute difference between window and client area
NSRect outerRect = [[self window] frame];
NSRect innerRect = [self frame];
int widthDiff = outerRect.size.width - innerRect.size.width;
int heightDiff = outerRect.size.height - innerRect.size.height;
// we are not in RemoteApp mode, disable resizing
outerRect.size.width = w + widthDiff;
outerRect.size.height = h + heightDiff;
[[self window] setMaxSize:outerRect.size];
[[self window] setMinSize:outerRect.size];
@try
{
[[self window] setFrame:outerRect display:YES];
}
@catch (NSException * e) {
NSLog(@"Exception: %@", e);
}
@finally {
}
// set client area to specified dimensions
NSRect innerRect;
innerRect.origin.x = 0;
innerRect.origin.y = 0;
innerRect.size.width = w;
innerRect.size.height = h;
[self setFrame:innerRect];
// calculate window of same size, but keep position
NSRect outerRect = [[self window] frame];
outerRect.size = [[self window] frameRectForContentRect:innerRect].size;
// we are not in RemoteApp mode, disable larger than resolution
[[self window] setContentMaxSize:innerRect.size];
// set window to given area
[[self window] setFrame:outerRect display:YES];
}
/************************************************************************

View File

@ -9,6 +9,7 @@
#import "AppDelegate.h"
#import "MacFreeRDP/mfreerdp.h"
#import "MacFreeRDP/mf_client.h"
#import <freerdp/client/cmdline.h>
static AppDelegate* _singleDelegate = nil;
void AppDelegate_EmbedWindowEventHandler(void* context, EmbedWindowEventArgs* e);
@ -90,6 +91,7 @@ void AppDelegate_ErrorInfoEventHandler(void* ctx, ErrorInfoEventArgs* e);
}
status = freerdp_client_parse_command_line(context, argc, argv);
status = freerdp_client_command_line_status_print(context->argc, context->argv, context->settings, status);
return status;
}