Merge branch 'boss-window-args' of https://github.com/ad-chaos/kitty

This commit is contained in:
Kovid Goyal 2024-01-19 07:46:36 +05:30
commit 4a64f812ad
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
4 changed files with 40 additions and 0 deletions

View file

@ -1396,6 +1396,12 @@ def get_os_window_size(os_window_id: int) -> Optional[OSWindowSize]:
pass
def get_os_window_pos(os_window_id: int) -> Tuple[int, int]:
pass
def set_os_window_pos(os_window_id: int, x: int, y: int) -> None:
pass
def get_all_processes() -> Tuple[int, ...]:
pass

View file

@ -805,6 +805,16 @@ set_os_window_size(OSWindow *os_window, int x, int y) {
glfwSetWindowSize(os_window->handle, x, y);
}
void
get_os_window_pos(OSWindow *os_window, int *x, int *y) {
glfwGetWindowPos(os_window->handle, x, y);
}
void
set_os_window_pos(OSWindow *os_window, int x, int y) {
glfwSetWindowPos(os_window->handle, x, y);
}
static void
get_window_content_scale(GLFWwindow *w, float *xscale, float *yscale, double *xdpi, double *ydpi) {
// if you change this function also change createSurface() in wl_window.c

View file

@ -1071,6 +1071,26 @@ PYWRAP1(get_os_window_size) {
Py_RETURN_NONE;
}
PYWRAP1(get_os_window_pos) {
id_type os_window_id;
PA("K", &os_window_id);
WITH_OS_WINDOW(os_window_id)
int x, y;
get_os_window_pos(os_window, &x, &y);
return Py_BuildValue("ii", x, y);
END_WITH_OS_WINDOW
Py_RETURN_NONE;
}
PYWRAP1(set_os_window_pos) {
id_type os_window_id;
int x, y;
PA("Kii", &os_window_id, &x, &y);
WITH_OS_WINDOW(os_window_id)
set_os_window_pos(os_window, x, y);
END_WITH_OS_WINDOW
Py_RETURN_NONE;
}
PYWRAP1(set_boss) {
Py_CLEAR(global_state.boss);
@ -1393,6 +1413,8 @@ static PyMethodDef module_methods[] = {
MW(sync_os_window_title, METH_VARARGS),
MW(get_os_window_title, METH_VARARGS),
MW(set_os_window_title, METH_VARARGS),
MW(get_os_window_pos, METH_VARARGS),
MW(set_os_window_pos, METH_VARARGS),
MW(global_font_size, METH_VARARGS),
MW(set_background_image, METH_VARARGS),
MW(os_window_font_size, METH_VARARGS),

View file

@ -288,6 +288,8 @@ bool remove_os_window(id_type os_window_id);
void* make_os_window_context_current(OSWindow *w);
void set_os_window_size(OSWindow *os_window, int x, int y);
void get_os_window_size(OSWindow *os_window, int *w, int *h, int *fw, int *fh);
void get_os_window_pos(OSWindow *os_window, int *x, int *y);
void set_os_window_pos(OSWindow *os_window, int x, int y);
void get_os_window_content_scale(OSWindow *os_window, double *xdpi, double *ydpi, float *xscale, float *yscale);
void update_os_window_references(void);
void mark_os_window_for_close(OSWindow* w, CloseRequest cr);