updates.
[silc.git] / apps / irssi / src / fe-text / term.c
index cc49103f16a8240a124f2faa72a57e9de794dee0..03004b10a9e741dfe6812f8482a88991e49a96e1 100644 (file)
@@ -47,12 +47,34 @@ int term_type;
 static int force_colors;
 static int resize_dirty;
 
-/* Resize the terminal if needed */
-void term_resize_dirty(void)
+int term_get_size(int *width, int *height)
 {
 #ifdef TIOCGWINSZ
        struct winsize ws;
+
+       /* Get new window size */
+       if (ioctl(0, TIOCGWINSZ, &ws) < 0)
+               return FALSE;
+
+       if (ws.ws_row == 0 && ws.ws_col == 0)
+               return FALSE;
+
+       *width = ws.ws_col;
+        *height = ws.ws_row;
+
+       if (*width < MIN_SCREEN_WIDTH)
+               *width = MIN_SCREEN_WIDTH;
+       if (*height < 1)
+                *height = 1;
+       return TRUE;
+#else
+        return FALSE;
 #endif
+}
+
+/* Resize the terminal if needed */
+void term_resize_dirty(void)
+{
         int width, height;
 
        if (!resize_dirty)
@@ -60,27 +82,14 @@ void term_resize_dirty(void)
 
         resize_dirty = FALSE;
 
-#ifdef TIOCGWINSZ
-       /* Get new window size */
-       if (ioctl(0, TIOCGWINSZ, &ws) < 0)
-               return;
+       if (!term_get_size(&width, &height))
+               width = height = -1;
 
-       if (ws.ws_row == term_height && ws.ws_col == term_width) {
-               /* Same size, abort. */
-               return;
+       if (height != term_height || width != term_width) {
+               term_resize(width, height);
+               mainwindows_resize(term_width, term_height);
+               term_resize_final(width, height);
        }
-
-       if (ws.ws_col < MIN_SCREEN_WIDTH)
-               ws.ws_col = MIN_SCREEN_WIDTH;
-
-       width = ws.ws_col;
-        height = ws.ws_row;
-#else
-        width = height = -1;
-#endif
-        term_resize(width, height);
-       mainwindows_resize(term_width, term_height);
-        term_resize_final(width, height);
 }
 
 #ifdef SIGWINCH
@@ -138,6 +147,7 @@ void term_common_init(void)
        settings_add_bool("lookandfeel", "colors", TRUE);
        settings_add_bool("lookandfeel", "term_force_colors", FALSE);
         settings_add_bool("lookandfeel", "term_auto_detach", FALSE);
+        settings_add_bool("lookandfeel", "mirc_blink_fix", FALSE);
         settings_add_str("lookandfeel", "term_type", "8bit");
 
        force_colors = FALSE;