lynx-dev
[Top][All Lists]
Advanced

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

Re: LYNX-DEV How to change screen size??


From: John E. Davis
Subject: Re: LYNX-DEV How to change screen size??
Date: Wed, 29 Oct 1997 14:18:59 -0500

On Wed, 29 Oct 97 17:12:07 GMT, address@hidden (Alex Lyons  AEA Technology 
Winfrith) said:
>Resizing of the lynx display window (xterm or Sun's shelltool)
>didn't seem to work properly, at least when using ordinary curses,
>and particularly if you tried to make the display larger.

I do not know how the curses version works but the slang version will
correctly redraw the screen upon the next keypress.  I agree that it
should happen automatically but the problem is with the way lynx
handles events.  In my opinion, the best way to handle it is to have a
separate function for redrawing the screen:

    int Lynx_Need_Redraw;
    int lynx_redraw (void)
    {
         .
         /* redraw screen */
         .
       Lynx_Need_Redraw = 0;
    }
    
Then the SIGWINCH handler should do nothing more than:

   void sigwinch_handler (int sig)
   {
       Lynx_Need_Redraw = 1;
       lynx_get_screen_size ();
   }

All system calls should be set up to NOT restart.  Instead do:

   while (-1 == some_system_system ())
     {
       if (errno == EINTR)
         {
            lynx_handle_interrupt ();
            continue;
         }
       
       /* Otherwise system call failed for some other reason */
            .
            .
     }
       
The function lynx_handle_interrupt would look like:

   void lynx_handle_interrupt (void)
   {
       block_signals ();

       if (Lynx_Need_Redraw)
         {
            lynx_redraw ();
            Lynx_Need_Redraw = 0;
         }

       unblock_signals ();
   }
             
The role of the block/unblock_signals functions should be rather
obvious.  

I think that this approach is clean and safe.  The slang library
provides functions for all of this.

--John
;
; To UNSUBSCRIBE:  Send a mail message to address@hidden
;                  with "unsubscribe lynx-dev" (without the
;                  quotation marks) on a line by itself.
;

reply via email to

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