mirror of
https://github.com/macvim-dev/macvim.git
synced 2026-06-11 15:37:29 +02:00
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:
committed by
Bjorn Winckler
parent
088d1203b0
commit
cebfc0471f
@@ -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];
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user