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

@@ -81,10 +81,24 @@ is_ascii_control_char(char c) {
return c == 0 || (1 <= c && c <= 31) || c == 127;
}
static inline bool
handle_resize_key(int key, int action, int mods) {
if (action == GLFW_RELEASE) return true;
if (key == GLFW_KEY_T || key == GLFW_KEY_S || key == GLFW_KEY_W || key == GLFW_KEY_N || key == GLFW_KEY_0) {
call_boss(handle_resize_keypress, "iiKKK", key, mods, global_state.currently_resizing.os_window_id, global_state.currently_resizing.tab_id, global_state.currently_resizing.window_id);
return true;
}
return false;
}
void
on_key_input(int key, int scancode, int action, int mods, const char* text, int state UNUSED) {
Window *w = active_window();
if (!w) return;
if (global_state.currently_resizing.os_window_id) {
if (handle_resize_key(key, action, mods)) return;
terminate_resize_mode();
}
if (global_state.in_sequence_mode) {
if (
action != GLFW_RELEASE &&