client/Mac: changes from LK2000
This commit is contained in:
parent
a14930f091
commit
790bf99f3b
@ -87,23 +87,19 @@ if(APPLE)
|
||||
endif()
|
||||
|
||||
# OS X Interface Builder files
|
||||
set (MacFreeRDP_XIBS
|
||||
MainMenu.xib
|
||||
Credits.rtf
|
||||
file (GLOB MacFreeRDP_XIBS
|
||||
*.xib
|
||||
)
|
||||
|
||||
# Headers
|
||||
set (MacFreeRDP_Headers
|
||||
MRDPCursor.h
|
||||
MRDPView.h
|
||||
AppDelegate.h)
|
||||
file (GLOB MacFreeRDP_Headers
|
||||
*.h
|
||||
)
|
||||
|
||||
# Source
|
||||
set (MacFreeRDP_Source
|
||||
MRDPCursor.m
|
||||
MRDPView.m
|
||||
AppDelegate.m
|
||||
main.m)
|
||||
file (GLOB MacFreeRDP_Source
|
||||
*.m
|
||||
)
|
||||
|
||||
add_executable(MacFreeRDP
|
||||
${APP_TYPE}
|
||||
@ -147,3 +143,4 @@ target_link_libraries(MacFreeRDP ${CMAKE_SOURCE_DIR}/../../xcode/libfreerdp-cach
|
||||
target_link_libraries(MacFreeRDP ${CMAKE_SOURCE_DIR}/../../xcode/libfreerdp-gdi/Debug/libfreerdp-gdi.dylib)
|
||||
target_link_libraries(MacFreeRDP ${CMAKE_SOURCE_DIR}/../../xcode/libfreerdp-utils/Debug/libfreerdp-utils.dylib)
|
||||
target_link_libraries(MacFreeRDP ${CMAKE_SOURCE_DIR}/../../xcode/libfreerdp-codec/Debug/libfreerdp-codec.dylib)
|
||||
target_link_libraries(MacFreeRDP ${CMAKE_SOURCE_DIR}/../../xcode/libfreerdp-rail/Debug/libfreerdp-rail.dylib)
|
||||
|
@ -4,6 +4,7 @@
|
||||
|
||||
#import "freerdp/gdi/gdi.h"
|
||||
#import "freerdp/rail/rail.h"
|
||||
#import "MRDPRailWindow.h"
|
||||
|
||||
@interface MRDPRailView : NSView
|
||||
{
|
||||
@ -14,9 +15,11 @@
|
||||
char * pixelData;
|
||||
boolean mouseInClientArea;
|
||||
boolean titleBarClicked;
|
||||
boolean gestureEventInProgress;
|
||||
int width;
|
||||
int height;
|
||||
int savedWindowId;
|
||||
int scrollWheelCount;
|
||||
|
||||
// store state info for some keys
|
||||
int kdlshift;
|
||||
@ -36,16 +39,23 @@
|
||||
int localMoveType;
|
||||
}
|
||||
|
||||
@property (assign) MRDPRailWindow * mrdpRailWindow;
|
||||
@property (assign) int windowIndex;
|
||||
@property (assign) boolean activateWindow;
|
||||
|
||||
- (void) windowDidMove:(NSNotification *) notification;
|
||||
- (void) updateDisplay;
|
||||
- (void) setRdpInstance:(freerdp *) instance width:(int) w andHeight:(int) h windowID:(int) windowID;
|
||||
- (BOOL) eventIsInClientArea :(NSEvent *) event :(int *) xptr :(int *) yptr;
|
||||
- (void) setupBmiRep:(int) width :(int) height;
|
||||
- (void) releaseResources;
|
||||
|
||||
void mac_rail_MoveWindow(rdpRail *rail, rdpWindow *window);
|
||||
void apple_to_windowMove(NSRect * r, RAIL_WINDOW_MOVE_ORDER * windowMove);
|
||||
void mac_send_rail_client_event(rdpChannels *channels, uint16 event_type, void *param);
|
||||
void windows_to_apple_cords(NSRect * r);
|
||||
void rail_MoveWindow(rdpRail * rail, rdpWindow * window);
|
||||
void mac_rail_send_activate(int window_id);
|
||||
|
||||
@end
|
||||
|
||||
|
@ -4,6 +4,8 @@
|
||||
|
||||
@implementation MRDPRailView
|
||||
|
||||
@synthesize mrdpRailWindow, windowIndex, activateWindow;
|
||||
|
||||
MRDPRailView * g_mrdpRailView;
|
||||
|
||||
struct kkey
|
||||
@ -98,6 +100,11 @@ extern struct kkey g_keys[];
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (BOOL)acceptsFirstMouse:(NSEvent *)theEvent
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
/** *********************************************************************
|
||||
* called when a mouse move event occurrs
|
||||
*
|
||||
@ -247,23 +254,23 @@ extern struct kkey g_keys[];
|
||||
|
||||
[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;
|
||||
// we get more two finger trackpad scroll events
|
||||
// than scrollWheel events, so we drop some
|
||||
|
||||
if (gestureEventInProgress) {
|
||||
scrollWheelCount++;
|
||||
if (scrollWheelCount % 8 != 0)
|
||||
return;
|
||||
}
|
||||
|
||||
flags = PTR_FLAGS_WHEEL;
|
||||
if ([event scrollingDeltaY] < 0) {
|
||||
flags |= PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
|
||||
flags = PTR_FLAGS_WHEEL | PTR_FLAGS_WHEEL_NEGATIVE | 0x0088;
|
||||
}
|
||||
else {
|
||||
flags |= 0x0078;
|
||||
flags = PTR_FLAGS_WHEEL | 0x78;
|
||||
}
|
||||
x += (int) [event scrollingDeltaX];
|
||||
y += (int) [event scrollingDeltaY];
|
||||
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, flags, x, y);
|
||||
rdp_instance->input->MouseEvent(rdp_instance->input, flags, 0, 0);
|
||||
}
|
||||
|
||||
/** *********************************************************************
|
||||
@ -629,6 +636,16 @@ extern struct kkey g_keys[];
|
||||
g_mrdpRailView = self;
|
||||
|
||||
[self becomeFirstResponder];
|
||||
[self setAcceptsTouchEvents:YES];
|
||||
|
||||
// we want to be notified when window resizes....
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidResize:) name:NSWindowDidResizeNotification object:nil];
|
||||
|
||||
// ...moves
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidMove:) name:NSWindowDidMoveNotification object:nil];
|
||||
|
||||
// ...and becomes the key window
|
||||
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeKey:) name:NSWindowDidBecomeKeyNotification object:nil];
|
||||
}
|
||||
|
||||
- (void) setupBmiRep:(int) frameWidth :(int) frameHeight
|
||||
@ -657,6 +674,85 @@ extern struct kkey g_keys[];
|
||||
bytesPerRow:frameWidth * sizeof(struct rgba_data)
|
||||
bitsPerPixel:0];
|
||||
}
|
||||
- (void) beginGestureWithEvent:(NSEvent *)event
|
||||
{
|
||||
gestureEventInProgress = YES;
|
||||
}
|
||||
|
||||
- (void) endGestureWithEvent:(NSEvent *)event
|
||||
{
|
||||
gestureEventInProgress = NO;
|
||||
}
|
||||
|
||||
/**
|
||||
* called when a bordered window changes size
|
||||
*/
|
||||
|
||||
- (void) windowDidResize:(NSNotification *) notification
|
||||
{
|
||||
// if we are not the source of this notification, just return
|
||||
if ([notification object] != [self mrdpRailWindow])
|
||||
return;
|
||||
|
||||
// let RDP server know that window has moved
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
NSRect r = [[self window] frame];
|
||||
|
||||
int diffInHeight = [[self window] frame].size.height - [self frame].size.height;
|
||||
r.size.height -= diffInHeight;
|
||||
|
||||
apple_to_windowMove(&r, &windowMove);
|
||||
windowMove.windowId = self->savedWindowId;
|
||||
mac_send_rail_client_event(self->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
|
||||
}
|
||||
|
||||
/**
|
||||
* called when user moves a bordered window
|
||||
*/
|
||||
|
||||
- (void) windowDidMove:(NSNotification *) notification
|
||||
{
|
||||
// if we are not the source of this notification, just return
|
||||
if ([notification object] != [self mrdpRailWindow])
|
||||
return;
|
||||
|
||||
// let RDP server know that window has moved
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
NSRect r = [[self window] frame];
|
||||
|
||||
int diffInHeight = [[self window] frame].size.height - [self frame].size.height;
|
||||
r.size.height -= diffInHeight;
|
||||
|
||||
apple_to_windowMove(&r, &windowMove);
|
||||
windowMove.windowId = self->savedWindowId;
|
||||
mac_send_rail_client_event(self->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
|
||||
}
|
||||
|
||||
/**
|
||||
* called when a NSWindow becomes the key window
|
||||
*/
|
||||
|
||||
- (void) windowDidBecomeKey:(NSNotification *) notification
|
||||
{
|
||||
// if we are not the source of this notification, just return
|
||||
if ([notification object] != [self mrdpRailWindow])
|
||||
return;
|
||||
|
||||
if (![self activateWindow])
|
||||
return;
|
||||
|
||||
[[self window] setAcceptsMouseMovedEvents: YES];
|
||||
|
||||
//if ([self activateWindow])
|
||||
mac_rail_send_activate(savedWindowId);
|
||||
|
||||
set_current_window(windowIndex);
|
||||
}
|
||||
|
||||
- (void) releaseResources
|
||||
{
|
||||
[[NSNotificationCenter defaultCenter] removeObserver:self];
|
||||
}
|
||||
|
||||
void rail_cvt_from_rect(char *dest, char *src, NSRect destRect, int destWidth, int destHeight, NSRect srcRect)
|
||||
{
|
||||
@ -746,4 +842,16 @@ void rail_MoveWindow(rdpRail * rail, rdpWindow * window)
|
||||
[[g_mrdpRailView window] setFrame:r display:YES];
|
||||
}
|
||||
|
||||
|
||||
void mac_rail_send_activate(int window_id)
|
||||
{
|
||||
RAIL_ACTIVATE_ORDER activate;
|
||||
|
||||
activate.windowId = window_id;
|
||||
activate.enabled = 1;
|
||||
|
||||
mac_send_rail_client_event(g_mrdpRailView->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_ACTIVATE, &activate);
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
@ -34,8 +34,7 @@
|
||||
#import "MRDPView.h"
|
||||
#import "MRDPCursor.h"
|
||||
|
||||
// Should be defined in Makefile
|
||||
// #define RUN_IN_XCODE
|
||||
#define RUN_IN_XCODE
|
||||
|
||||
// LK_TODO
|
||||
#define GOT_HERE //printf("### got here: %s : %s() : %d\n", __FILE__, __func__, __LINE__)
|
||||
@ -1870,6 +1869,7 @@ void cliprdr_send_supported_format_list(freerdp *inst)
|
||||
freerdp_channels_send_event(inst->context->channels, (RDP_EVENT*) event);
|
||||
}
|
||||
|
||||
<<<<<<< HEAD
|
||||
/****************************************************************************************
|
||||
* *
|
||||
* *
|
||||
|
@ -8,4 +8,3 @@
|
||||
@synthesize view;
|
||||
|
||||
@end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user