]> ncurses.scripts.mit.edu Git - ncurses.git/blobdiff - ncurses/base/resizeterm.c
ncurses 5.7 - patch 20090905
[ncurses.git] / ncurses / base / resizeterm.c
index cf99ad0d3b2fbb4d199a8cac59a2b131e740753e..5ec3df6b35e4bf78ae810fe4315ffe1787d49fa7 100644 (file)
@@ -28,6 +28,7 @@
 
 /****************************************************************************
  *  Author: Thomas E. Dickey                                                *
 
 /****************************************************************************
  *  Author: Thomas E. Dickey                                                *
+ *     and: Juergen Pfeifer                                                 *
  ****************************************************************************/
 
 /*
  ****************************************************************************/
 
 /*
  */
 
 #include <curses.priv.h>
  */
 
 #include <curses.priv.h>
-#include <term.h>
 
 #ifndef CUR
 
 #ifndef CUR
-#define CUR SP_TERMTYPE 
+#define CUR SP_TERMTYPE
 #endif
 
 #endif
 
-MODULE_ID("$Id: resizeterm.c,v 1.39 2009/05/10 00:48:29 tom Exp $")
-
-#define stolen_lines (screen_lines - SP->_lines_avail)
+MODULE_ID("$Id: resizeterm.c,v 1.41 2009/08/30 16:18:58 tom Exp $")
 
 /*
  * If we're trying to be reentrant, do not want any local statics.
 
 /*
  * If we're trying to be reentrant, do not want any local statics.
@@ -121,7 +119,7 @@ ripped_window(WINDOW *win)
     ripoff_t *rop;
 
     if (win != 0) {
     ripoff_t *rop;
 
     if (win != 0) {
-#if NCURSES_SP_FUNCS
+#ifdef USE_SP_RIPOFF
        SCREEN *sp = _nc_screen_of(win);
 #endif
        for (each_ripoff(rop)) {
        SCREEN *sp = _nc_screen_of(win);
 #endif
        for (each_ripoff(rop)) {
@@ -145,7 +143,7 @@ ripped_bottom(WINDOW *win)
     ripoff_t *rop;
 
     if (win != 0) {
     ripoff_t *rop;
 
     if (win != 0) {
-#if NCURSES_SP_FUNCS
+#ifdef USE_SP_RIPOFF
        SCREEN *sp = _nc_screen_of(win);
 #endif
        for (each_ripoff(rop)) {
        SCREEN *sp = _nc_screen_of(win);
 #endif
        for (each_ripoff(rop)) {
@@ -169,7 +167,7 @@ child_depth(WINDOW *cmp)
     int depth = 0;
 
     if (cmp != 0) {
     int depth = 0;
 
     if (cmp != 0) {
-#if NCURSES_SP_FUNCS
+#ifdef USE_SP_WINDOWLIST
        SCREEN *sp = _nc_screen_of(cmp);
 #endif
        WINDOWLIST *wp;
        SCREEN *sp = _nc_screen_of(cmp);
 #endif
        WINDOWLIST *wp;
@@ -229,6 +227,12 @@ adjust_window(WINDOW *win, int ToLines, int ToCols, int stolen EXTRA_DCLS)
         * move it to the same relative position.
         */
        win->_begy = ToLines - ripped_bottom(win) - 0 - win->_yoffset;
         * move it to the same relative position.
         */
        win->_begy = ToLines - ripped_bottom(win) - 0 - win->_yoffset;
+       if (rop->hook == _nc_slk_initialize)
+           _nc_format_slks(
+#if NCURSES_SP_FUNCS
+                              _nc_screen_of(win),
+#endif
+                              ToCols);
     } else if (win->_begy >= bottom) {
        /*
         * If it is below the bottom of the new screen, move up by the same
     } else if (win->_begy >= bottom) {
        /*
         * If it is below the bottom of the new screen, move up by the same
@@ -347,7 +351,7 @@ NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
        returnCode(ERR);
     }
 
        returnCode(ERR);
     }
 
-    _nc_lock_global(curses);
+    _nc_nonsp_lock_global(curses);
 
     was_stolen = (screen_lines(SP_PARM) - SP_PARM->_lines_avail);
     if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) {
 
     was_stolen = (screen_lines(SP_PARM) - SP_PARM->_lines_avail);
     if (NCURSES_SP_NAME(is_term_resized) (NCURSES_SP_ARGx ToLines, ToCols)) {
@@ -379,10 +383,17 @@ NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
            decrease_size(NCURSES_SP_ARGx ToLines, ToCols, was_stolen EXTRA_ARGS);
        }
 
            decrease_size(NCURSES_SP_ARGx ToLines, ToCols, was_stolen EXTRA_ARGS);
        }
 
-       screen_lines(SP_PARM) = lines = ToLines;
-       screen_columns(SP_PARM) = columns = ToCols;
+       screen_lines(SP_PARM) = ToLines;
+       screen_columns(SP_PARM) = ToCols;
 
 
-       SP_PARM->_lines_avail = lines - was_stolen;
+#ifdef USE_TERM_DRIVER
+       CallDriver_2(SP_PARM, setsize, ToLines, ToCols);
+#else
+       lines = ToLines;
+       columns = ToCols;
+#endif
+
+       SP_PARM->_lines_avail = ToLines - was_stolen;
 
        if (SP_PARM->oldhash) {
            FreeAndNull(SP_PARM->oldhash);
 
        if (SP_PARM->oldhash) {
            FreeAndNull(SP_PARM->oldhash);
@@ -407,7 +418,7 @@ NCURSES_SP_NAME(resize_term) (NCURSES_SP_DCLx int ToLines, int ToCols)
     SET_LINES(ToLines - was_stolen);
     SET_COLS(ToCols);
 
     SET_LINES(ToLines - was_stolen);
     SET_COLS(ToCols);
 
-    _nc_unlock_global(curses);
+    _nc_nonsp_unlock_global(curses);
 
     returnCode(result);
 }
 
     returnCode(result);
 }
@@ -417,9 +428,9 @@ NCURSES_EXPORT(int)
 resize_term(int ToLines, int ToCols)
 {
     int res = ERR;
 resize_term(int ToLines, int ToCols)
 {
     int res = ERR;
-    _nc_lock_global(curses);
+    _nc_sp_lock_global(curses);
     res = NCURSES_SP_NAME(resize_term) (CURRENT_SCREEN, ToLines, ToCols);
     res = NCURSES_SP_NAME(resize_term) (CURRENT_SCREEN, ToLines, ToCols);
-    _nc_unlock_global(curses);
+    _nc_sp_unlock_global(curses);
     return (res);
 }
 #endif
     return (res);
 }
 #endif