mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-27 10:41:58 +02:00
Functions to get and set OS Window size
This commit is contained in:
16
kitty/glfw.c
16
kitty/glfw.c
@@ -481,6 +481,16 @@ make_os_window_context_current(OSWindow *w) {
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
get_os_window_size(OSWindow *os_window, int *w, int *h, int *fw, int *fh) {
|
||||
if (w && h) glfwGetWindowSize(os_window->handle, w, h);
|
||||
if (fw && fh) glfwGetFramebufferSize(os_window->handle, fw, fh);
|
||||
}
|
||||
|
||||
void
|
||||
set_os_window_size(OSWindow *os_window, int x, int y) {
|
||||
glfwSetWindowSize(os_window->handle, x, y);
|
||||
}
|
||||
|
||||
static inline void
|
||||
get_window_content_scale(GLFWwindow *w, float *xscale, float *yscale, double *xdpi, double *ydpi) {
|
||||
@@ -508,6 +518,11 @@ get_window_dpi(GLFWwindow *w, double *x, double *y) {
|
||||
get_window_content_scale(w, &xscale, &yscale, x, y);
|
||||
}
|
||||
|
||||
void
|
||||
get_os_window_content_scale(OSWindow *os_window, double *xdpi, double *ydpi, float *xscale, float *yscale) {
|
||||
get_window_content_scale(os_window->handle, xscale, yscale, xdpi, ydpi);
|
||||
}
|
||||
|
||||
static void
|
||||
set_os_window_dpi(OSWindow *w) {
|
||||
get_window_dpi(w->handle, &w->logical_dpi_x, &w->logical_dpi_y);
|
||||
@@ -1253,7 +1268,6 @@ cocoa_window_id(PyObject UNUSED *self, PyObject *os_wid) {
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static PyObject*
|
||||
get_primary_selection(PYNOARG) {
|
||||
if (glfwGetPrimarySelectionString) {
|
||||
|
||||
Reference in New Issue
Block a user