Mac: test commit, EOL white space removal
This commit is contained in:
parent
a76b6087c1
commit
418ac24764
@ -19,20 +19,20 @@ extern struct kkey g_keys[];
|
||||
boolean moveWindow = NO;
|
||||
NSRect srcRectOuter;
|
||||
NSRect destRectOuter;
|
||||
|
||||
|
||||
rdpGdi * gdi;
|
||||
|
||||
|
||||
if ((context == 0) || (context->gdi == 0))
|
||||
return;
|
||||
|
||||
|
||||
if (context->gdi->primary->hdc->hwnd->invalid->null)
|
||||
return;
|
||||
|
||||
|
||||
if (context->gdi->drawing != context->gdi->primary)
|
||||
return;
|
||||
|
||||
|
||||
gdi = context->gdi;
|
||||
|
||||
|
||||
srcRectOuter = NSMakeRect(0, 0, self->width, self->height);
|
||||
destRectOuter = [[self window] frame];
|
||||
|
||||
@ -42,15 +42,15 @@ extern struct kkey g_keys[];
|
||||
destRectOuter.size.width = screenSize.size.width;
|
||||
moveWindow = YES;
|
||||
}
|
||||
|
||||
|
||||
if (destRectOuter.size.height > screenSize.size.height) {
|
||||
destRectOuter.size.height = screenSize.size.height;
|
||||
moveWindow = YES;
|
||||
moveWindow = YES;
|
||||
}
|
||||
|
||||
|
||||
if (destRectOuter.origin.x + destRectOuter.size.width > width)
|
||||
destRectOuter.size.width = width - destRectOuter.origin.x;
|
||||
|
||||
|
||||
[self setupBmiRep:destRectOuter.size.width :destRectOuter.size.height];
|
||||
|
||||
if (moveWindow) {
|
||||
@ -61,12 +61,12 @@ extern struct kkey g_keys[];
|
||||
//skipMoveWindowOnce = TRUE;
|
||||
//mac_send_rail_client_event(g_mrdpRailView->rdp_instance->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &newWndLoc);
|
||||
}
|
||||
|
||||
|
||||
destRectOuter.origin.y = height - destRectOuter.origin.y - destRectOuter.size.height;
|
||||
rail_convert_color_space(pixelData, (char *) gdi->primary_buffer,
|
||||
rail_convert_color_space(pixelData, (char *) gdi->primary_buffer,
|
||||
&destRectOuter, self->width, self->height);
|
||||
|
||||
if (moveWindow)
|
||||
|
||||
if (moveWindow)
|
||||
[self setNeedsDisplayInRect:destRectOuter];
|
||||
else
|
||||
[self setNeedsDisplayInRect:[self frame]];
|
||||
@ -81,7 +81,7 @@ extern struct kkey g_keys[];
|
||||
- (void) drawRect:(NSRect)dirtyRect
|
||||
{
|
||||
[bmiRep drawInRect:dirtyRect fromRect:dirtyRect operation:NSCompositeCopy fraction:1.0 respectFlipped:NO hints:nil];
|
||||
|
||||
|
||||
if (pixelData) {
|
||||
free(pixelData);
|
||||
pixelData = NULL;
|
||||
@ -93,19 +93,19 @@ extern struct kkey g_keys[];
|
||||
* become first responder so we can get keyboard and mouse events
|
||||
***********************************************************************/
|
||||
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
/** *********************************************************************
|
||||
* called when a mouse move event occurrs
|
||||
*
|
||||
*
|
||||
* ideally we want to be called when the mouse moves over NSView client area,
|
||||
* but in reality we get called any time the mouse moves anywhere on the screen;
|
||||
* we could use NSTrackingArea class to handle this but this class is available
|
||||
* on Mac OS X v10.5 and higher; since we want to be compatible with older
|
||||
* versions, we do this manually.
|
||||
* versions, we do this manually.
|
||||
*
|
||||
* TODO: here is how it can be done using legacy methods
|
||||
* http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/MouseTrackingEvents/MouseTrackingEvents.html#//apple_ref/doc/uid/10000060i-CH11-SW1
|
||||
@ -114,15 +114,15 @@ extern struct kkey g_keys[];
|
||||
- (void) mouseMoved:(NSEvent *)event
|
||||
{
|
||||
[super mouseMoved:event];
|
||||
|
||||
|
||||
NSRect winFrame = [[self window] frame];
|
||||
NSPoint loc = [event locationInWindow];
|
||||
|
||||
|
||||
int x = (int) (winFrame.origin.x + loc.x);
|
||||
int y = (int) (winFrame.origin.y + loc.y);
|
||||
|
||||
|
||||
y = height - y;
|
||||
|
||||
|
||||
// send mouse motion event to RDP server
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y);
|
||||
}
|
||||
@ -146,12 +146,12 @@ extern struct kkey g_keys[];
|
||||
|
||||
if ((yPos >= 4) && (yPos <= 20))
|
||||
titleBarClicked = YES;
|
||||
else
|
||||
else
|
||||
titleBarClicked = NO;
|
||||
|
||||
|
||||
savedDragLocation.x = loc.x;
|
||||
savedDragLocation.y = loc.y;
|
||||
|
||||
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_DOWN | PTR_FLAGS_BUTTON1, x, y);
|
||||
}
|
||||
|
||||
@ -168,7 +168,7 @@ extern struct kkey g_keys[];
|
||||
int x = (int) (winFrame.origin.x + loc.x);
|
||||
int y = (int) (winFrame.origin.y + loc.y);
|
||||
y = height - y;
|
||||
|
||||
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON1, x, y);
|
||||
titleBarClicked = NO;
|
||||
}
|
||||
@ -203,7 +203,7 @@ extern struct kkey g_keys[];
|
||||
int x = (int) (winFrame.origin.x + loc.x);
|
||||
int y = (int) (winFrame.origin.y + loc.y);
|
||||
y = height - y;
|
||||
|
||||
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON2, x, y);
|
||||
}
|
||||
|
||||
@ -237,22 +237,22 @@ extern struct kkey g_keys[];
|
||||
int x = (int) (winFrame.origin.x + loc.x);
|
||||
int y = (int) (winFrame.origin.y + loc.y);
|
||||
y = height - y;
|
||||
|
||||
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_BUTTON3, x, y);
|
||||
}
|
||||
|
||||
- (void) scrollWheel:(NSEvent *)event
|
||||
{
|
||||
uint16 flags;
|
||||
|
||||
|
||||
[super scrollWheel:event];
|
||||
|
||||
|
||||
NSRect winFrame = [[self window] frame];
|
||||
NSPoint loc = [event locationInWindow];
|
||||
int x = (int) (winFrame.origin.x + loc.x);
|
||||
int y = (int) (winFrame.origin.y + loc.y);
|
||||
y = height - y;
|
||||
|
||||
|
||||
flags = PTR_FLAGS_WHEEL;
|
||||
if ([event scrollingDeltaY] < 0) {
|
||||
flags |= PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
|
||||
@ -262,7 +262,7 @@ extern struct kkey g_keys[];
|
||||
}
|
||||
x += (int) [event scrollingDeltaX];
|
||||
y += (int) [event scrollingDeltaY];
|
||||
|
||||
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, flags, x, y);
|
||||
}
|
||||
|
||||
@ -273,7 +273,7 @@ extern struct kkey g_keys[];
|
||||
- (void) mouseDragged:(NSEvent *)event
|
||||
{
|
||||
[super mouseDragged:event];
|
||||
|
||||
|
||||
NSRect winFrame = [[self window] frame];
|
||||
NSPoint loc = [event locationInWindow];
|
||||
int x = (int) loc.x;
|
||||
@ -283,13 +283,13 @@ extern struct kkey g_keys[];
|
||||
// window is being dragged to a new location
|
||||
int newX = x - savedDragLocation.x;
|
||||
int newY = y - savedDragLocation.y;
|
||||
|
||||
|
||||
if ((newX == 0) && (newY == 0))
|
||||
return;
|
||||
|
||||
|
||||
winFrame.origin.x += newX;
|
||||
winFrame.origin.y += newY;
|
||||
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
@ -299,7 +299,7 @@ extern struct kkey g_keys[];
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
if (diff == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.x -= diff;
|
||||
@ -309,7 +309,7 @@ extern struct kkey g_keys[];
|
||||
winFrame.origin.x += diff;
|
||||
winFrame.size.width -= diff;
|
||||
}
|
||||
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
@ -319,10 +319,10 @@ extern struct kkey g_keys[];
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
if (diff == 0)
|
||||
return;
|
||||
|
||||
|
||||
savedDragLocation.x = loc.x;
|
||||
savedDragLocation.y = loc.y;
|
||||
|
||||
|
||||
winFrame.size.width += diff;
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
@ -333,21 +333,21 @@ extern struct kkey g_keys[];
|
||||
int diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff == 0)
|
||||
return;
|
||||
|
||||
|
||||
savedDragLocation.x = loc.x;
|
||||
savedDragLocation.y = loc.y;
|
||||
|
||||
|
||||
winFrame.size.height += diff;
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_BOTTOM) {
|
||||
// bottom border resize taking place
|
||||
int diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff == 0)
|
||||
return;
|
||||
|
||||
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.y -= diff;
|
||||
@ -357,11 +357,11 @@ extern struct kkey g_keys[];
|
||||
winFrame.origin.y += diff;
|
||||
winFrame.size.height -= diff;
|
||||
}
|
||||
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_TOPLEFT) {
|
||||
// top left border resize taking place
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
@ -382,7 +382,7 @@ extern struct kkey g_keys[];
|
||||
savedDragLocation.y = loc.y;
|
||||
winFrame.size.height += diff;
|
||||
}
|
||||
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
@ -393,7 +393,7 @@ extern struct kkey g_keys[];
|
||||
if (diff != 0) {
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
winFrame.size.height += diff;
|
||||
@ -405,7 +405,7 @@ extern struct kkey g_keys[];
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_BOTTOMLEFT) {
|
||||
// bottom left border resize taking place
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
@ -420,7 +420,7 @@ extern struct kkey g_keys[];
|
||||
winFrame.size.width -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
if (diff < 0) {
|
||||
@ -433,11 +433,11 @@ extern struct kkey g_keys[];
|
||||
winFrame.size.height -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_BOTTOMRIGHT) {
|
||||
// bottom right border resize taking place
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
@ -446,7 +446,7 @@ extern struct kkey g_keys[];
|
||||
//savedDragLocation.y = loc.y;
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
if (diff < 0) {
|
||||
@ -459,15 +459,15 @@ extern struct kkey g_keys[];
|
||||
winFrame.size.height -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
x = (int) (winFrame.origin.x + loc.x);
|
||||
y = (int) (winFrame.origin.y + loc.y);
|
||||
y = height - y;
|
||||
|
||||
|
||||
// send mouse motion event to RDP server
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, PTR_FLAGS_MOVE, x, y);
|
||||
}
|
||||
@ -479,7 +479,7 @@ extern struct kkey g_keys[];
|
||||
- (void) keyDown:(NSEvent *) event
|
||||
{
|
||||
int key;
|
||||
|
||||
|
||||
key = [event keyCode];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, g_keys[key].flags | KBD_FLAGS_DOWN, g_keys[key].key_code);
|
||||
}
|
||||
@ -503,7 +503,7 @@ extern struct kkey g_keys[];
|
||||
- (void) flagsChanged:(NSEvent *) event
|
||||
{
|
||||
NSUInteger mf = [event modifierFlags];
|
||||
|
||||
|
||||
// caps lock
|
||||
if (mf == 0x10100) {
|
||||
printf("TODO: caps lock is on\n");
|
||||
@ -524,7 +524,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x2a);
|
||||
kdlshift = 0;
|
||||
}
|
||||
|
||||
|
||||
// right shift
|
||||
if ((kdrshift == 0) && ((mf & 4) != 0)) {
|
||||
// right shift went down
|
||||
@ -536,7 +536,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x36);
|
||||
kdrshift = 0;
|
||||
}
|
||||
|
||||
|
||||
// left ctrl
|
||||
if ((kdlctrl == 0) && ((mf & 1) != 0)) {
|
||||
// left ctrl went down
|
||||
@ -548,7 +548,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x1d);
|
||||
kdlctrl = 0;
|
||||
}
|
||||
|
||||
|
||||
// right ctrl
|
||||
if ((kdrctrl == 0) && ((mf & 0x2000) != 0)) {
|
||||
// right ctrl went down
|
||||
@ -560,7 +560,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x1d);
|
||||
kdrctrl = 0;
|
||||
}
|
||||
|
||||
|
||||
// left alt
|
||||
if ((kdlalt == 0) && ((mf & 0x20) != 0)) {
|
||||
// left alt went down
|
||||
@ -572,7 +572,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, KBD_FLAGS_RELEASE, 0x38);
|
||||
kdlalt = 0;
|
||||
}
|
||||
|
||||
|
||||
// right alt
|
||||
if ((kdralt == 0) && ((mf & 0x40) != 0)) {
|
||||
// right alt went down
|
||||
@ -584,7 +584,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x38);
|
||||
kdralt = 0;
|
||||
}
|
||||
|
||||
|
||||
// left meta
|
||||
if ((kdlmeta == 0) && ((mf & 0x08) != 0)) {
|
||||
// left meta went down
|
||||
@ -596,7 +596,7 @@ extern struct kkey g_keys[];
|
||||
rdp_instance->input->KeyboardEvent(rdp_instance->input, 1 | KBD_FLAGS_RELEASE, 0x5b);
|
||||
kdlmeta = 0;
|
||||
}
|
||||
|
||||
|
||||
// right meta
|
||||
if ((kdrmeta == 0) && ((mf & 0x10) != 0)) {
|
||||
// right meta went down
|
||||
@ -617,15 +617,15 @@ extern struct kkey g_keys[];
|
||||
width = w;
|
||||
height = h;
|
||||
savedWindowId = windowID;
|
||||
|
||||
|
||||
NSRect tr = NSMakeRect(0, 0,
|
||||
[[NSScreen mainScreen] frame].size.width,
|
||||
[[NSScreen mainScreen] frame].size.width,
|
||||
[[NSScreen mainScreen] frame].size.height);
|
||||
|
||||
|
||||
NSTrackingArea * trackingArea = [[NSTrackingArea alloc] initWithRect:tr options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingCursorUpdate | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveAlways owner:self userInfo:nil];
|
||||
|
||||
|
||||
[self addTrackingArea:trackingArea];
|
||||
|
||||
|
||||
g_mrdpRailView = self;
|
||||
|
||||
[self becomeFirstResponder];
|
||||
@ -640,10 +640,10 @@ extern struct kkey g_keys[];
|
||||
char blue;
|
||||
char alpha;
|
||||
};
|
||||
|
||||
|
||||
if (pixelData)
|
||||
free(pixelData);
|
||||
|
||||
|
||||
pixelData = (char *) malloc(frameWidth * frameHeight * sizeof(struct rgba_data));
|
||||
bmiRep = [[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **) &pixelData
|
||||
pixelsWide:frameWidth
|
||||
@ -665,7 +665,7 @@ void rail_cvt_from_rect(char *dest, char *src, NSRect destRect, int destWidth, i
|
||||
/** *********************************************************************
|
||||
* color space conversion used specifically in RAIL
|
||||
***********************************************************************/
|
||||
void rail_convert_color_space(char *destBuf, char * srcBuf,
|
||||
void rail_convert_color_space(char *destBuf, char * srcBuf,
|
||||
NSRect * destRect, int width, int height)
|
||||
{
|
||||
int i;
|
||||
@ -681,10 +681,10 @@ void rail_convert_color_space(char *destBuf, char * srcBuf,
|
||||
int pixel2;
|
||||
int * src32;
|
||||
int * dest32;
|
||||
|
||||
|
||||
int destWidth = destRect->size.width;
|
||||
int destHeight = destRect->size.height;
|
||||
|
||||
|
||||
if ((!destBuf) || (!srcBuf)) {
|
||||
return;
|
||||
}
|
||||
@ -696,12 +696,12 @@ void rail_convert_color_space(char *destBuf, char * srcBuf,
|
||||
srcY = destRect->origin.y;
|
||||
destX = 0;
|
||||
destY = 0;
|
||||
|
||||
|
||||
for (i = 0; i < numRows; i++)
|
||||
{
|
||||
src32 = (int *) (srcBuf + ((srcY + i) * width + srcX) * 4);
|
||||
dest32 = (int *) (destBuf + ((destY + i) * destWidth + destX) * 4);
|
||||
|
||||
|
||||
for (j = 0; j < pixelsPerRow; j++)
|
||||
{
|
||||
pixel = *src32;
|
||||
@ -715,7 +715,7 @@ void rail_convert_color_space(char *destBuf, char * srcBuf,
|
||||
dest32++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
destRect->origin.y = destHeight - destRect->origin.y - destRect->size.height;
|
||||
return;
|
||||
}
|
||||
@ -729,12 +729,12 @@ void rail_MoveWindow(rdpRail * rail, rdpWindow * window)
|
||||
if (g_mrdpRailView->isMoveSizeInProgress) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (g_mrdpRailView->skipMoveWindowOnce) {
|
||||
g_mrdpRailView->skipMoveWindowOnce = NO;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// this rect is based on Windows co-ordinates...
|
||||
NSRect r;
|
||||
r.origin.x = window->windowOffsetX;
|
||||
@ -747,4 +747,3 @@ void rail_MoveWindow(rdpRail * rail, rdpWindow * window)
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user