Make :winpos measure Y coordinates from top

This is to make :winpos consistent with other ports where Y coordinates
are measured from the top instead of the bottom of the screen.
This commit is contained in:
Janusz Bossy
2011-02-23 15:47:58 +01:00
committed by Bjorn Winckler
parent 088d1203b0
commit cebfc0471f
2 changed files with 12 additions and 2 deletions
+4
View File
@@ -851,6 +851,10 @@ static BOOL isUnsafeMessage(int msgid);
int x = *((int*)bytes); bytes += sizeof(int);
int y = *((int*)bytes); bytes += sizeof(int);
// NOTE: Vim measures Y-coordinates from top of screen.
NSRect frame = [[[windowController window] screen] frame];
y = NSMaxY(frame) - y;
[windowController setTopLeft:NSMakePoint(x,y)];
} else if (SetTooltipMsgID == msgid) {
id textView = [[windowController vimView] textView];
+8 -2
View File
@@ -874,7 +874,10 @@
// NOTE: This method is called when the user drags the window, but not when
// the top left point changes programmatically.
int pos[2] = { (int)topLeft.x, (int)topLeft.y };
// NOTE 2: Vim counts Y-coordinates from the top of the screen.
int pos[2] = {
(int)topLeft.x,
(int)(NSMaxY([[decoratedWindow screen] frame]) - topLeft.y) };
NSData *data = [NSData dataWithBytes:pos length:2*sizeof(int)];
[vimController sendMessage:SetWindowPositionMsgID data:data];
}
@@ -1062,7 +1065,10 @@
// NOTE: The window top left position may change due to the window
// being moved e.g. when the tabline is shown so we must tell Vim what
// the new window position is here.
int pos[2] = { (int)newTopLeft.x, (int)newTopLeft.y };
// NOTE 2: Vim measures Y-coordinates from top of screen.
int pos[2] = {
(int)newTopLeft.x,
(int)(NSMaxY([[decoratedWindow screen] frame]) - newTopLeft.y) };
NSData *data = [NSData dataWithBytes:pos length:2*sizeof(int)];
[vimController sendMessage:SetWindowPositionMsgID data:data];
}