bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: BUG ncurses with use kdbg


From: igor . bujna
Subject: Re: BUG ncurses with use kdbg
Date: Tue, 30 Mar 2010 12:30:53 +0200 (CEST)


------------ Původní zpráva ------------
Od: Thomas Dickey <address@hidden>
Předmět: Re: BUG ncurses with use kdbg
Datum: 30.3.2010 11:31:14
----------------------------------------
On Tue, 30 Mar 2010, address@hidden wrote:

>
>> ------------ Původní zpráva ------------
>> Od: Thomas Dickey <address@hidden>
>> Předmět: Re: BUG ncurses with use kdbg
>> Datum: 30.3.2010 02:14:04
>> ----------------------------------------
>> On Tue, 30 Mar 2010, address@hidden wrote:
>>
>> >> Perhaps kdbg is setting LINES/COLUMNS
>> >>
>> >> I see that it is setting xterm's -geometry option.
>> >> Do the values for that correspond to the LINES/COLUMNS values?
>> >
>> > This is problem, xterm has properly size as you can see on picture >
>> kdbg-ncurses-BAD.jpg in my first post.
>> > But ncurses get this COLS=80 & LINES=24. When i try debug, this values is
>> > receiving via _nc_getenv_num() for LINES and COLUMNS. There is problem.

There are perhaps two bugs (I had not noticed reports against konsole for
this problem).  In some cases, the information for xterm's screensize
doesn't get updated (it's due to a problem negotiating screensize with
the window manager).

However, for this case, if your application clears the $LINES and $COLUMNS
values, it should fall-through to the logic that obtains the actual
screensize as you intended.

In my aplication i put this function and call before run function initscr() to 
change properly this values, but i think it's better aply patch which i send in 
my first post.
Which read this values from enviroment, but when is defined HAVE_SIZECHANGE try 
read sie of window from ioctl and compare this new value with enviroments value 
and if this is possible to change to properly values. This is simply hack in 
fuction _nc_get_screensize().
---------------------------------------------------------------------------
static void
_get_screen_size (void)
{
 int r = 0, c = 0;
 char s[20];
#define set_env_num(name, num)  {sprintf(s,"%d", num);setenv(name, s, 1);}

#if HAVE_SIZECHANGE
 STRUCT_WINSIZE size;

 do
   {
     if ((ioctl (1, IOCTL_WINSIZE, &size) == 0)
         || (ioctl (0, IOCTL_WINSIZE, &size) == 0)
         || (ioctl (2, IOCTL_WINSIZE, &size) == 0))
       {
         c = WINSIZE_COLS (size);;
         r = WINSIZE_ROWS (size);
         break;
       }
   }
 while (errno == EINTR);
#endif

 if (r <= 0)
   {
     char *s = getenv ("LINES");
     if (s != NULL)
       r = atoi (s);
   }

 if (c <= 0)
   {
     char *s = getenv ("COLUMNS");
     if (s != NULL)
       c = atoi (s);
   }

 if (r > 0 && r != LINES)
   {
     LINES = r;
     set_env_num ("LINES", LINES);
   }
 if (c > 0 && c != COLS)
   {
     COLS = c;
     set_env_num ("COLUMNS", COLS);
   }
}
--------------------------------------------------------------------------------------
>> In
>> > getting this enviroment values. If I read values from ioctl there is
>> every
>> > OK.
>>
>> Then you're working around a bug in kdbg.  You could add these calls to
>> unset the values:
>>
>>        unsetenv("LINES");
>>        unsetenv("COLUMNS");
>
> In kdbg proces xterm is opening in fifo and i try too put yours lines and
> nothing changed.
> Now i found, and problem is in xterm.
> 1) start xterm with this "xterm -geometry 130x30" in this opened xterm  i put

> "echo $LINES - $COLUMNS" and show properly values
> 2) now i start xterm with program "xterm -geometry 130x30 -e sh -c 'echo
> $LINES - $COLUMNS;sleep 20'" and a i didn't get any values. Parameter LINES &

> COLUMNS now not setting. Same problem is in konsole with this "konsole -e sh
> -c 'echo $LINES - $COLUMNS;sleep 20'"
>
>> --
>> Thomas E. Dickey
>> http://invisible-island.net
>> ftp://invisible-island.net
>>
>>
>>
>
>
> _______________________________________________
> Bug-ncurses mailing list
> address@hidden
> http://lists.gnu.org/mailman/listinfo/bug-ncurses
>

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net






reply via email to

[Prev in Thread] Current Thread [Next in Thread]