Implement resizing of individual windows in a layout

See the Layouts section in the README for details. Fixes #362

Note that it is only implemented for the Tall layout currently. Other
layouts to follow. The implementation might also be refined in the
future.
This commit is contained in:
Kovid Goyal
2018-05-17 15:09:41 +05:30
parent e429b8484c
commit e053d1f566
11 changed files with 184 additions and 12 deletions

View File

@@ -268,6 +268,14 @@ os_window_regions(OSWindow *os_window, Region *central, Region *tab_bar) {
}
}
void
terminate_resize_mode() {
global_state.currently_resizing.os_window_id = 0;
global_state.currently_resizing.tab_id = 0;
global_state.currently_resizing.window_id = 0;
}
// Python API {{{
#define PYWRAP0(name) static PyObject* py##name(PYNOARG)
@@ -586,6 +594,14 @@ PYWRAP1(set_display_state) {
Py_RETURN_NONE;
}
PYWRAP1(enter_resize_mode) {
global_state.currently_resizing.os_window_id = 0;
global_state.currently_resizing.tab_id = 0;
global_state.currently_resizing.window_id = 0;
PA("|KKK", &global_state.currently_resizing.os_window_id, &global_state.currently_resizing.tab_id, &global_state.currently_resizing.window_id);
Py_RETURN_NONE;
}
THREE_ID_OBJ(update_window_title)
THREE_ID(remove_window)
PYWRAP1(resolve_key_mods) { int mods; PA("ii", &kitty_mod, &mods); return PyLong_FromLong(resolve_mods(mods)); }
@@ -632,6 +648,7 @@ static PyMethodDef module_methods[] = {
MW(update_window_visibility, METH_VARARGS),
MW(set_boss, METH_O),
MW(set_display_state, METH_VARARGS),
MW(enter_resize_mode, METH_VARARGS),
MW(destroy_global_data, METH_NOARGS),
{NULL, NULL, 0, NULL} /* Sentinel */