window sizing now possible in interaction functions

This commit is contained in:
nova
2025-06-26 23:52:04 +02:00
parent f2eaeee9ea
commit aedfdd1ed5
3 changed files with 16 additions and 18 deletions

View File

@ -7,9 +7,6 @@
#define STATUS_UPDATE_SCREEN_RESIZE 16
#define STATUS_UPDATE_SCREEN_RELOAD_FULL 32
#define STATUS_USER_ROOT 64
#define STATUS_INTERACTIONS_MASK 384
#define STATUS_INTERACTIONS_OPEN_WITH 128
#define STATUS_INTERACTIONS_RENAME 256
#define SETTINGS_HAS_COLOR 1

View File

@ -19,6 +19,9 @@ extern file *lft_content;
extern file *rgt_content;
extern file file_current;
extern unsigned int terminal_height;
extern unsigned int terminal_width;
extern WINDOW *win_b;
extern char *rgt_buffer;
@ -145,7 +148,11 @@ int read_string(WINDOW *win, int y, int x, char *str){
void open_with(){
btm_buffer = concat("open \"", file_current.file_name);
btm_buffer = concat(btm_buffer, "\" with:");
status |= (STATUS_UPDATE_SCREEN_0 | STATUS_INTERACTIONS_OPEN_WITH);
status = STATUS_UPDATE_SCREEN_0;
werase(win_b);
mvwin(win_b, terminal_height-6, 0);
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
render_pass();
unsigned long local_width;
@ -171,7 +178,6 @@ void open_with(){
}
status &= ~(STATUS_INTERACTIONS_MASK);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
free(str);
@ -181,7 +187,11 @@ void rename_hovered(){
btm_buffer = concat("rename \"", file_current.file_name);
btm_buffer = concat(btm_buffer, "\" to:");
status |= (STATUS_UPDATE_SCREEN_0 | STATUS_INTERACTIONS_RENAME);
status = STATUS_UPDATE_SCREEN_0;
werase(win_b);
mvwin(win_b, terminal_height-6, 0);
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
render_pass();
@ -205,7 +215,6 @@ void rename_hovered(){
btm_buffer = cmd;
}
status &= ~(STATUS_INTERACTIONS_MASK);
status |= (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY | STATUS_UPDATE_SCREEN_RELOAD_FULL);
free(btm_buffer);

14
main.c
View File

@ -119,7 +119,7 @@ int main(){
void render_pass(){
if (status & (STATUS_UPDATE_SCREEN_RESIZE | STATUS_INTERACTIONS_MASK)) {
if (status & STATUS_UPDATE_SCREEN_RESIZE) {
if (status & STATUS_UPDATE_SCREEN_RELOAD_FULL) {
clear();
status &= ~STATUS_UPDATE_SCREEN_RELOAD_FULL;
@ -137,22 +137,14 @@ void render_pass(){
wresize(win_l, terminal_height-2, terminal_width/8);
wresize(win_m, terminal_height-2, (terminal_width/2)-(terminal_width/8));
wresize(win_r, terminal_height-2, terminal_width/2);
if(status & STATUS_INTERACTIONS_MASK) {
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
} else {
wresize(win_b, 1, terminal_width);
}
wresize(win_b, 1, terminal_width);
mvwin(win_t, 0, 0);
mvwin(win_l, 1, 0);
mvwin(win_m, 1, (terminal_width/8));
mvwin(win_r, 1, ((terminal_width/2)));
if(status & STATUS_INTERACTIONS_MASK) {
mvwin(win_b, terminal_height-6, 0);
} else {
mvwin(win_b, terminal_height-1, 0);
}
mvwin(win_b, terminal_height-1, 0);
status |= STATUS_UPDATE_SCREEN_0;