about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-04-15 23:53:54 +0100
committerJames Booth <boothj5@gmail.com>2012-04-15 23:53:54 +0100
commita9a3a951be0630648df84d42986df46ab5693c73 (patch)
treee8cdf02f5b6df0a1c61da70b54e03cbf57608ad7
parent0557f78d36572562cfec38042dbc50fa1bc90a20 (diff)
downloadprofani-tty-a9a3a951be0630648df84d42986df46ab5693c73.tar.gz
Basic resize of bars
-rw-r--r--input_win.c49
-rw-r--r--windows.c8
-rw-r--r--windows.h1
3 files changed, 36 insertions, 22 deletions
diff --git a/input_win.c b/input_win.c
index 34a67ac5..8cd1c3cd 100644
--- a/input_win.c
+++ b/input_win.c
@@ -87,29 +87,34 @@ void inp_get_char(int *ch, char *input, int *size)
     noecho();
     *ch = wgetch(inp_win);
 
-    // if it wasn't an arrow key etc
-    if (!_handle_edit(*ch, input, size)) {
-        if (_printable(*ch)) {
-            getyx(inp_win, inp_y, inp_x);
-           
-            // handle insert if not at end of input
-            if (inp_x <= *size) {
-                winsch(inp_win, *ch);
-                wmove(inp_win, inp_y, inp_x+1);
-
-                for (i = *size; i > inp_x -1; i--)
-                    input[i] = input[i-1];
-                input[inp_x -1] = *ch;
-
-                (*size)++;
-
-            // otherwise just append
-            } else {
-                waddch(inp_win, *ch);
-                input[(*size)++] = *ch;
+    if (*ch == KEY_RESIZE) {
+        cons_show("REZISE SIGNAL");
+        win_resize();
+    } else {
+        // if it wasn't an arrow key etc
+        if (!_handle_edit(*ch, input, size)) {
+            if (_printable(*ch)) {
+                getyx(inp_win, inp_y, inp_x);
+               
+                // handle insert if not at end of input
+                if (inp_x <= *size) {
+                    winsch(inp_win, *ch);
+                    wmove(inp_win, inp_y, inp_x+1);
+
+                    for (i = *size; i > inp_x -1; i--)
+                        input[i] = input[i-1];
+                    input[inp_x -1] = *ch;
+
+                    (*size)++;
+
+                // otherwise just append
+                } else {
+                    waddch(inp_win, *ch);
+                    input[(*size)++] = *ch;
+                }
+
+                reset_search_attempts();
             }
-
-            reset_search_attempts();
         }
     }
 
diff --git a/windows.c b/windows.c
index ad0c0fb1..b0ddb570 100644
--- a/windows.c
+++ b/windows.c
@@ -88,6 +88,14 @@ void gui_init(void)
     dirty = TRUE;
 }
 
+void win_resize(void)
+{
+    create_title_bar();
+    create_status_bar();
+    create_input_window();
+    dirty = TRUE;
+}
+
 void gui_refresh(void)
 {
     title_bar_refresh();
diff --git a/windows.h b/windows.h
index de72a23e..01be6951 100644
--- a/windows.h
+++ b/windows.h
@@ -37,6 +37,7 @@ struct prof_win {
 void gui_init(void);
 void gui_refresh(void);
 void gui_close(void);
+void win_resize(void);
 
 // create windows
 void create_title_bar(void);