bug-ncurses
[Top][All Lists]
Advanced

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

Advice on mouse handling


From: Bryan Christ
Subject: Advice on mouse handling
Date: Fri, 5 Jul 2019 12:47:04 -0500

Thomas,

I've read the xterm documentation you authored and have reviewed the code in lib_mouse.c in order to add VT200 mouse support to my emulator.  The following code works well on the first mouse click, but subsequent mouse clicks don't seem to work at all.  After putting some debug code inside the conditional, I can see that each click is indeed firing and the x and y coords are updating.  I'm at a loss as to why writing that string to the underlying pty works fine once but not thereafter.  The guest application is built on ncurses so it would seem that if the sequence was decoded once correctly it should be again subsequent times. 

case KEY_MOUSE:
{
  if(has_mouse() == TRUE && vterm->mouse == VTERM_MOUSE_VT200)        
  {                                                                  
    if(getmouse(&mouse_event) == OK)                                
    {                                                              
      if(mouse_event.bstate & BUTTON1_CLICKED)                    
      {                                                          
        dynbuf = strdup_printf("\e[M%c%c%c\e[M%c%c%c",          
          (char)(32 + 0 + 0),                                
          (char)(32 + mouse_event.x),                        
          (char)(32 + mouse_event.y),                        
          (char)(32 + 0 + 0x40),                              
          (char)(32 + mouse_event.x),                        
          (char)(32 + mouse_event.y));                        
        }
                                                          
        buffer = dynbuf;                                            
      }                                                              
    }                                                                  
    break;                


--
Bryan
<><

reply via email to

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