Fixed following issues in RAIL mode
+ tool tips are now correctly positioned + window dragging bug has been fixed + resize after window drag was not working - fixed + implemented local resizing
This commit is contained in:
parent
7bade10982
commit
28c4203649
@ -13,6 +13,7 @@
|
||||
NSPoint savedDragLocation;
|
||||
char * pixelData;
|
||||
boolean mouseInClientArea;
|
||||
boolean titleBarClicked;
|
||||
int width;
|
||||
int height;
|
||||
int savedWindowId;
|
||||
@ -32,6 +33,7 @@
|
||||
boolean isMoveSizeInProgress;
|
||||
boolean saveInitialDragLoc;
|
||||
boolean skipMoveWindowOnce;
|
||||
int localMoveType;
|
||||
}
|
||||
|
||||
- (void) updateDisplay;
|
||||
|
@ -117,6 +117,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;
|
||||
@ -152,6 +153,7 @@ extern struct kkey g_keys[];
|
||||
|
||||
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);
|
||||
|
||||
@ -173,7 +175,18 @@ extern struct kkey g_keys[];
|
||||
NSPoint loc = [event locationInWindow];
|
||||
int x = (int) (winFrame.origin.x + loc.x);
|
||||
int y = (int) (winFrame.origin.y + loc.y);
|
||||
int yPos = (int) (winFrame.size.height - loc.y);
|
||||
|
||||
y = height - y;
|
||||
|
||||
|
||||
if ((yPos >= 4) && (yPos <= 20))
|
||||
titleBarClicked = YES;
|
||||
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);
|
||||
}
|
||||
@ -191,8 +204,9 @@ 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;
|
||||
}
|
||||
|
||||
/** *********************************************************************
|
||||
@ -291,11 +305,214 @@ extern struct kkey g_keys[];
|
||||
* called when mouse is moved with left button pressed
|
||||
* note: invocation order is: mouseDown, mouseDragged, mouseUp
|
||||
***********************************************************************/
|
||||
|
||||
- (void) mouseDragged:(NSEvent *)event
|
||||
{
|
||||
[super mouseDragged:event];
|
||||
|
||||
NSRect winFrame = [[self window] frame];
|
||||
NSPoint loc = [event locationInWindow];
|
||||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
if (titleBarClicked) {
|
||||
// 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;
|
||||
}
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_LEFT) {
|
||||
// left border resize taking place
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
if (diff == 0)
|
||||
return;
|
||||
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.x -= diff;
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
else {
|
||||
winFrame.origin.x += diff;
|
||||
winFrame.size.width -= diff;
|
||||
}
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_RIGHT) {
|
||||
// right border resize taking place
|
||||
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;
|
||||
}
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_TOP) {
|
||||
// top border resize taking place
|
||||
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;
|
||||
winFrame.size.height += diff;
|
||||
}
|
||||
else {
|
||||
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);
|
||||
if (diff != 0) {
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.x -= diff;
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
else {
|
||||
winFrame.origin.x += diff;
|
||||
winFrame.size.width -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
savedDragLocation.y = loc.y;
|
||||
winFrame.size.height += diff;
|
||||
}
|
||||
|
||||
[[self window] setFrame:winFrame display:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
if (localMoveType == RAIL_WMSZ_TOPRIGHT) {
|
||||
// top right border resize taking place
|
||||
int diff = (int) (loc.x - savedDragLocation.x);
|
||||
if (diff != 0) {
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
winFrame.size.height += diff;
|
||||
}
|
||||
|
||||
savedDragLocation.x = loc.x;
|
||||
savedDragLocation.y = loc.y;
|
||||
|
||||
[[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);
|
||||
if (diff != 0) {
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.x -= diff;
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
else {
|
||||
winFrame.origin.x += diff;
|
||||
winFrame.size.width -= diff;
|
||||
}
|
||||
}
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.y -= diff;
|
||||
winFrame.size.height += diff;
|
||||
}
|
||||
else {
|
||||
winFrame.origin.y += diff;
|
||||
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);
|
||||
if (diff != 0) {
|
||||
savedDragLocation.x = loc.x;
|
||||
//savedDragLocation.y = loc.y;
|
||||
winFrame.size.width += diff;
|
||||
}
|
||||
|
||||
diff = (int) (loc.y - savedDragLocation.y);
|
||||
if (diff != 0) {
|
||||
if (diff < 0) {
|
||||
diff = abs(diff);
|
||||
winFrame.origin.y -= diff;
|
||||
winFrame.size.height += diff;
|
||||
}
|
||||
else {
|
||||
winFrame.origin.y += diff;
|
||||
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);
|
||||
}
|
||||
|
||||
// RAIL_TODO delete this
|
||||
- (void) __mouseDragged:(NSEvent *)event
|
||||
{
|
||||
[super mouseDragged:event];
|
||||
|
||||
NSPoint loc = [event locationInWindow];
|
||||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
@ -18,14 +18,17 @@
|
||||
* - all funcs same as above
|
||||
* - PolygonSc seems to create a transparent rect
|
||||
* - ensure mouse cursor changes are working ok after moving to NSTracking area
|
||||
* - when we move the window to a 2nd monitor, display stops working
|
||||
* - RAIL:
|
||||
* -
|
||||
* -
|
||||
* - tool tips to be correctly positioned
|
||||
* - dragging is slightly of
|
||||
* - resize after dragging not working
|
||||
* - done - tool tips to be correctly positioned
|
||||
* - done - dragging is slightly of
|
||||
* - done - resize after dragging not working
|
||||
* - dragging app from macbook to monitor gives exec/access err
|
||||
* - unable to drag rect out of monitor boundaries
|
||||
* - two finger scroll
|
||||
* - moving scroll bar does a window resize instead of a scroll
|
||||
* -
|
||||
* -
|
||||
* -
|
||||
@ -266,7 +269,7 @@ struct kkey g_keys[256] =
|
||||
// setup a mouse tracking area
|
||||
NSTrackingArea * trackingArea = [[NSTrackingArea alloc] initWithRect:[self visibleRect] options:NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved | NSTrackingCursorUpdate | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveWhenFirstResponder owner:self userInfo:nil];
|
||||
|
||||
//[self addTrackingArea:trackingArea];
|
||||
[self addTrackingArea:trackingArea];
|
||||
|
||||
// windows in RemoteApp (RAIL) mode cannot have title bars
|
||||
NSArray * args = [[NSProcessInfo processInfo] arguments];
|
||||
@ -282,6 +285,8 @@ struct kkey g_keys[256] =
|
||||
[self addTrackingArea:trackingArea];
|
||||
|
||||
mouseInClientArea = YES;
|
||||
|
||||
printScreenInfo();
|
||||
}
|
||||
|
||||
/** *********************************************************************
|
||||
@ -486,7 +491,9 @@ struct kkey g_keys[256] =
|
||||
int x = (int) loc.x;
|
||||
int y = (int) loc.y;
|
||||
|
||||
// RAIL_TODO delete this if not reqd
|
||||
// RAIL_TODO delete this if not reqd
|
||||
#if 0
|
||||
|
||||
if ((isRemoteApp) && (isMoveSizeInProgress)) {
|
||||
if (saveInitialDragLoc) {
|
||||
saveInitialDragLoc = NO;
|
||||
@ -503,7 +510,8 @@ struct kkey g_keys[256] =
|
||||
r.origin.y += newY;
|
||||
[[g_mrdpview window] setFrame:r display:YES];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
y = height - y;
|
||||
|
||||
// send mouse motion event to RDP server
|
||||
@ -936,35 +944,6 @@ struct kkey g_keys[256] =
|
||||
// RAIL_TODO is this func required
|
||||
- (void) windowDidResize:(NSNotification *) notification
|
||||
{
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
|
||||
printf("RAIL_TODO: MRDPView: windowDidResize() - not yet implemented\n");
|
||||
|
||||
return;
|
||||
|
||||
// window resize valid only in RemoteApp mode
|
||||
if (!g_mrdpview->isRemoteApp)
|
||||
return;
|
||||
|
||||
// window has resized, let server know
|
||||
|
||||
NSRect r = [[g_mrdpview window] frame];
|
||||
printf("----- LK_TODO: MRDPView:windowDidResize (%d,%d %dx%d)\n",
|
||||
(int) r.origin.x, (int) r.origin.y,
|
||||
(int) r.size.width, (int) r.size.height);
|
||||
|
||||
|
||||
windowMove.windowId = [currentWindow windowID];
|
||||
|
||||
windowMove.left = (uint16) r.origin.x; // x-cordinate of top left corner
|
||||
windowMove.right = (uint16) (windowMove.left + r.size.width); // x-cordinate of bottom right corner
|
||||
windowMove.top = (uint16) r.origin.y; // y-cordinate of top left corner
|
||||
windowMove.bottom = (uint16) (windowMove.top + r.size.height); // y-cordinate of bottom right corner
|
||||
|
||||
printf("----- LK_TODO: MRDPView:windowDidResize windowID=%d left=%d top=%d right=%d bottom=x%d width=%f height=%f\n",
|
||||
[currentWindow windowID], windowMove.left, windowMove.top, windowMove.right, windowMove.bottom, r.size.width, r.size.height);
|
||||
|
||||
//mac_send_rail_client_event(g_mrdpview->rdp_instance->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
|
||||
}
|
||||
|
||||
/************************************************************************
|
||||
@ -1122,7 +1101,7 @@ boolean mac_pre_connect(freerdp *inst)
|
||||
g_mrdpview->argv[i++] = cptr;
|
||||
|
||||
cptr = (char *)malloc(80);
|
||||
strcpy(cptr, "lk");
|
||||
strcpy(cptr, "jay");
|
||||
g_mrdpview->argv[i++] = cptr;
|
||||
|
||||
cptr = (char *)malloc(80);
|
||||
@ -1130,7 +1109,7 @@ boolean mac_pre_connect(freerdp *inst)
|
||||
g_mrdpview->argv[i++] = cptr;
|
||||
|
||||
cptr = (char *)malloc(80);
|
||||
strcpy(cptr, "abc@@@123");
|
||||
strcpy(cptr, "tucker");
|
||||
g_mrdpview->argv[i++] = cptr;
|
||||
|
||||
#if 1
|
||||
@ -1162,7 +1141,11 @@ boolean mac_pre_connect(freerdp *inst)
|
||||
#endif
|
||||
|
||||
cptr = (char *)malloc(80);
|
||||
strcpy(cptr, "192.168.1.69:45990");
|
||||
#if 0
|
||||
strcpy(cptr, "mousey.homeip.net:45990");
|
||||
#else
|
||||
strcpy(cptr, "192.168.168.227");
|
||||
#endif
|
||||
g_mrdpview->argv[i++] = cptr;
|
||||
|
||||
g_mrdpview->argc = i;
|
||||
@ -1937,6 +1920,9 @@ void mac_rail_CreateWindow(rdpRail *rail, rdpWindow *window)
|
||||
if ((window->extendedStyle & WS_EX_TOPMOST) || (window->extendedStyle & WS_EX_TOOLWINDOW)) {
|
||||
[g_mrdpview->currentWindow view]->skipMoveWindowOnce = TRUE;
|
||||
moveWindow = YES;
|
||||
|
||||
// convert from windows to Mac cords
|
||||
window->windowOffsetY = g_mrdpview->height - window->windowOffsetY - window->windowHeight;
|
||||
}
|
||||
else if (window->style & WS_POPUP) {
|
||||
centerWindow = YES;
|
||||
@ -2171,39 +2157,38 @@ void mac_process_rail_server_minmaxinfo_event(rdpChannels* channels, RDP_EVENT*
|
||||
void mac_process_rail_server_localmovesize_event(freerdp *inst, RDP_EVENT *event)
|
||||
{
|
||||
RAIL_LOCALMOVESIZE_ORDER * moveSize = (RAIL_LOCALMOVESIZE_ORDER *) event->user_data;
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
|
||||
switch (moveSize->moveSizeType) {
|
||||
case RAIL_WMSZ_LEFT:
|
||||
printf("!!!! RAIL_WMSZ_LEFT\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_LEFT;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_RIGHT:
|
||||
printf("!!!! RAIL_WMSZ_RIGHT\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_RIGHT;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_TOP:
|
||||
printf("!!!! RAIL_WMSZ_TOP\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_TOP;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_TOPLEFT:
|
||||
printf("!!!! RAIL_WMSZ_TOPLEFT\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_TOPLEFT;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_TOPRIGHT:
|
||||
printf("!!!! RAIL_WMSZ_TOPRIGHT\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_TOPRIGHT;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_BOTTOM:
|
||||
printf("!!!! RAIL_WMSZ_BOTTOM\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_BOTTOM;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_BOTTOMLEFT:
|
||||
printf("!!!! RAIL_WMSZ_BOTTOMLEFT\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_BOTTOMLEFT;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_BOTTOMRIGHT:
|
||||
printf("!!!! RAIL_WMSZ_BOTTOMRIGHT\n");
|
||||
[g_mrdpview->currentWindow view]->localMoveType = RAIL_WMSZ_BOTTOMRIGHT;
|
||||
break;
|
||||
|
||||
case RAIL_WMSZ_MOVE:
|
||||
@ -2220,13 +2205,12 @@ void mac_process_rail_server_localmovesize_event(freerdp *inst, RDP_EVENT *event
|
||||
[g_mrdpview->currentWindow view]->saveInitialDragLoc = NO;
|
||||
|
||||
//NSRect rect = [[g_mrdpview->currentWindow view] frame];
|
||||
NSRect rect = [[[g_mrdpview->currentWindow view] window] frame];
|
||||
NSRect r = [[[g_mrdpview->currentWindow view] window] frame];
|
||||
|
||||
// let RDP server know where this window is located
|
||||
RAIL_WINDOW_MOVE_ORDER windowMove;
|
||||
apple_to_windowMove(&r, &windowMove);
|
||||
mac_send_rail_client_event(inst->context->channels, RDP_EVENT_TYPE_RAIL_CLIENT_WINDOW_MOVE, &windowMove);
|
||||
|
||||
// the event we just sent will cause an extra MoveWindow() to be invoked which we need to ignore
|
||||
[g_mrdpview->currentWindow view]->skipMoveWindowOnce = YES;
|
||||
|
||||
break;
|
||||
|
||||
@ -2311,4 +2295,20 @@ void apple_to_windowMove(NSRect * r, RAIL_WINDOW_MOVE_ORDER * windowMove)
|
||||
windowMove->bottom = (uint16) (windowMove->top + r->size.height); // y-cord of bottom right corner
|
||||
}
|
||||
|
||||
void printScreenInfo()
|
||||
{
|
||||
|
||||
int count = [[NSScreen screens] count];
|
||||
|
||||
for (int i = 0; i< count; i++)
|
||||
{
|
||||
NSRect r = [[[NSScreen screens] objectAtIndex:i] frame];
|
||||
|
||||
printf("screen %d: rect(%d,%d %dx%d)\n",
|
||||
i, (int) r.origin.x, (int) r.origin.y,
|
||||
(int) r.size.width, (int) r.size.height);
|
||||
}
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
@end
|
||||
|
Loading…
Reference in New Issue
Block a user