Ticket #3208: mc-gpm-fix.patch

File mc-gpm-fix.patch, 1.6 KB (added by mikulas, 5 years ago)

Here I'm submitting a patch for this bug

  • lib/tty/key.c

    Hi
    
    I am sending this patch that fixes GPM bug.
    
    How to reproduce the bug:
    
    * compile mc with gpm support
    * run the gpm daemon on the console
    * login to the machine with ssh from console on another machine
    * run mc
    
    At this situation, keyboard response will be sluggish and mc will consume
    CPU time when idle. The reason is that mc is trying to reopen the Gpm
    connection over and over again and gpm will try to close the connection
    over and over again (because the user is not on the local console).
    
    Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
    
    ---
     lib/tty/key.c |    5 ++---
     1 file changed, 2 insertions(+), 3 deletions(-)
    
    old new tty_get_event (struct Gpm_Event *event, 
    20912091                        *event = ev; 
    20922092                        return EV_MOUSE; 
    20932093                    } 
    2094                     else if (status == 0)       /* connection closed; -1 == error */ 
     2094                    else if (status <= 0)       /* connection closed; -1 == error */ 
    20952095                    { 
    20962096                        if (mouse_fd >= 0 && FD_ISSET (mouse_fd, &select_set)) 
    20972097                            FD_CLR (mouse_fd, &select_set); 
    20982098 
    2099                         /* Try to reopen gpm_mouse connection */ 
    21002099                        disable_mouse (); 
    2101                         enable_mouse (); 
     2100                        return EV_NONE; 
    21022101                    } 
    21032102                } 
    21042103            }