mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-16 13:34:48 +02:00
float conversion fixes for macOS
This commit is contained in:
@@ -573,17 +573,17 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
|
||||
if (fbRect.size.width != window->ns.fbWidth ||
|
||||
fbRect.size.height != window->ns.fbHeight)
|
||||
{
|
||||
window->ns.fbWidth = fbRect.size.width;
|
||||
window->ns.fbHeight = fbRect.size.height;
|
||||
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
||||
window->ns.fbWidth = (int)fbRect.size.width;
|
||||
window->ns.fbHeight = (int)fbRect.size.height;
|
||||
_glfwInputFramebufferSize(window, (int)fbRect.size.width, (int)fbRect.size.height);
|
||||
}
|
||||
|
||||
if (contentRect.size.width != window->ns.width ||
|
||||
contentRect.size.height != window->ns.height)
|
||||
{
|
||||
window->ns.width = contentRect.size.width;
|
||||
window->ns.height = contentRect.size.height;
|
||||
_glfwInputWindowSize(window, contentRect.size.width, contentRect.size.height);
|
||||
window->ns.width = (int)contentRect.size.width;
|
||||
window->ns.height = (int)contentRect.size.height;
|
||||
_glfwInputWindowSize(window, (int)contentRect.size.width, (int)contentRect.size.height);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -961,9 +961,9 @@ static GLFWapplicationshouldhandlereopenfun handle_reopen_callback = NULL;
|
||||
if (fbRect.size.width != window->ns.fbWidth ||
|
||||
fbRect.size.height != window->ns.fbHeight)
|
||||
{
|
||||
window->ns.fbWidth = fbRect.size.width;
|
||||
window->ns.fbHeight = fbRect.size.height;
|
||||
_glfwInputFramebufferSize(window, fbRect.size.width, fbRect.size.height);
|
||||
window->ns.fbWidth = (int)fbRect.size.width;
|
||||
window->ns.fbHeight = (int)fbRect.size.height;
|
||||
_glfwInputFramebufferSize(window, (int)fbRect.size.width, (int)fbRect.size.height);
|
||||
}
|
||||
|
||||
const float xscale = fbRect.size.width / contentRect.size.width;
|
||||
@@ -1748,9 +1748,9 @@ void _glfwPlatformGetWindowPos(_GLFWwindow* window, int* xpos, int* ypos)
|
||||
[window->ns.object contentRectForFrameRect:[window->ns.object frame]];
|
||||
|
||||
if (xpos)
|
||||
*xpos = contentRect.origin.x;
|
||||
*xpos = (int)contentRect.origin.x;
|
||||
if (ypos)
|
||||
*ypos = _glfwTransformYNS(contentRect.origin.y + contentRect.size.height - 1);
|
||||
*ypos = (int)_glfwTransformYNS(contentRect.origin.y + contentRect.size.height - 1);
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowPos(_GLFWwindow* window, int x, int y)
|
||||
@@ -1766,9 +1766,9 @@ void _glfwPlatformGetWindowSize(_GLFWwindow* window, int* width, int* height)
|
||||
const NSRect contentRect = [window->ns.view frame];
|
||||
|
||||
if (width)
|
||||
*width = contentRect.size.width;
|
||||
*width = (int)contentRect.size.width;
|
||||
if (height)
|
||||
*height = contentRect.size.height;
|
||||
*height = (int)contentRect.size.height;
|
||||
}
|
||||
|
||||
void _glfwPlatformSetWindowSize(_GLFWwindow* window, int width, int height)
|
||||
@@ -1831,15 +1831,15 @@ void _glfwPlatformGetWindowFrameSize(_GLFWwindow* window,
|
||||
const NSRect frameRect = [window->ns.object frameRectForContentRect:contentRect];
|
||||
|
||||
if (left)
|
||||
*left = contentRect.origin.x - frameRect.origin.x;
|
||||
*left = (int)(contentRect.origin.x - frameRect.origin.x);
|
||||
if (top)
|
||||
*top = frameRect.origin.y + frameRect.size.height -
|
||||
contentRect.origin.y - contentRect.size.height;
|
||||
*top = (int)(frameRect.origin.y + frameRect.size.height -
|
||||
contentRect.origin.y - contentRect.size.height);
|
||||
if (right)
|
||||
*right = frameRect.origin.x + frameRect.size.width -
|
||||
contentRect.origin.x - contentRect.size.width;
|
||||
*right = (int)(frameRect.origin.x + frameRect.size.width -
|
||||
contentRect.origin.x - contentRect.size.width);
|
||||
if (bottom)
|
||||
*bottom = contentRect.origin.y - frameRect.origin.y;
|
||||
*bottom = (int)(contentRect.origin.y - frameRect.origin.y);
|
||||
}
|
||||
|
||||
void _glfwPlatformGetWindowContentScale(_GLFWwindow* window,
|
||||
|
||||
Reference in New Issue
Block a user