Browse Source

ccmake: Port for LSB 4.0 (#11648)

Use getmaxyx instead of getmax[xy].  Avoid using getattrs.
Craig Scott 15 years ago
parent
commit
7d691cab9b
2 changed files with 14 additions and 6 deletions
  1. 11 5
      Source/CursesDialog/form/frm_driver.c
  2. 3 1
      Source/CursesDialog/form/frm_post.c

+ 11 - 5
Source/CursesDialog/form/frm_driver.c

@@ -357,8 +357,7 @@ static void Buffer_To_Window(const FIELD  * field, WINDOW * win)
 
   assert(win && field);
 
-  width  = getmaxx(win);
-  height = getmaxy(win);
+  getmaxyx(win, height, width);
 
   for(row=0, pBuffer=field->buf; 
       row < height; 
@@ -390,13 +389,13 @@ static void Window_To_Buffer(WINDOW * win, FIELD  * field)
   int pad;
   int len = 0;
   char *p;
-  int row, height;
+  int row, height, width;
   
   assert(win && field && field->buf );
 
   pad = field->pad;
   p = field->buf;
-  height = getmaxy(win);
+  getmaxyx(win, height, width);
 
   for(row=0; (row < height) && (row < field->drows); row++ )
     {
@@ -856,6 +855,8 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag)
 {
   WINDOW *win;
   WINDOW *fwin;
+  attr_t fwinAttrs;
+  short  fwinPair;
 
   if (!field)
     return E_SYSTEM_ERROR;
@@ -871,7 +872,12 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag)
       if (field->opts & O_VISIBLE)
         Set_Field_Window_Attributes(field,win);
       else
-        wattrset(win,getattrs(fwin));
+      {
+        /* getattrs() would be handy, but it is not part of LSB 4.0 */
+        /* wattrset(win,getattrs(fwin)); */
+        wattr_get(fwin, &fwinAttrs, &fwinPair, 0);
+        wattr_set(win, fwinAttrs, fwinPair, 0);
+      }
       werase(win);
     }
 

+ 3 - 1
Source/CursesDialog/form/frm_post.c

@@ -51,6 +51,7 @@ int post_form(FORM * form)
   WINDOW *formwin;
   int err;
   int page;
+  int height, width;
 
   if (!form)
     RETURN(E_BAD_ARGUMENT);
@@ -62,7 +63,8 @@ int post_form(FORM * form)
     RETURN(E_NOT_CONNECTED);
   
   formwin = Get_Form_Window(form);
-  if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) 
+  getmaxyx(formwin, height, width);
+  if ((form->cols > width) || (form->rows > height))
     RETURN(E_NO_ROOM);
 
   /* reset form->curpage to an invald value. This forces Set_Form_Page