console enhancements: mouse events etc

Thomas Wolff towo@towo.net
Wed Dec 16 15:14:00 GMT 2009


Corinna Vinschen wrote:
> On Dec 16 10:48, Thomas Wolff wrote:
>   
>> 	* fhandler_console.cc (read): Detect and handle mouse wheel scrolling 
>> 	...
>>     
> Thank you.  Applied with two changes:
>
>   
>> @@ -362,9 +405,12 @@ fhandler_console::read (void *pv, size_t
>>  	      /* Determine if the keystroke is modified by META.  The tricky
>>  		 part is to distinguish whether the right Alt key should be
>>  		 recognized as Alt, or as AltGr. */
>> -	      bool meta;
>> -	      meta = (control_key_state & ALT_PRESSED) != 0
>> +	      bool meta =
>> +		     /* Alt but not AltGr (= left ctrl + right alt)? */
>> +		     (control_key_state & ALT_PRESSED) != 0
>>  		     && ((control_key_state & CTRL_PRESSED) == 0
>> +			    /* but also allow Alt-AltGr: */
>> +			 || (control_key_state & ALT_PRESSED) == ALT_PRESSED
>>  			 || (wch <= 0x1f || wch == 0x7f));
>>  	      if (!meta)
>>  		{
>>     
> This hunk apparently belongs to another part of the patch and isn't
> mentioned in the ChangeLog.  I removed it for now.
>   
Yes, sorry, I forgot to add it to the ChangeLog.

>> @@ -400,10 +446,18 @@ fhandler_console::read (void *pv, size_t
>>  	  break;
>>  
>>  	case MOUSE_EVENT:
>> -	  send_winch_maybe ();
>> -	  if (dev_state->use_mouse)
>> +	 send_winch_maybe ();
>> +	 {
>> [...]
>>     
> The above and the followup hunks within the MOUSE_EVENT case were not
> correctly indented.  I fixed that.
>   
That's fine. I just didn't want to change the indentation of all lines, 
but sure it's better to do it.

>> +	case 1000: /* Mouse tracking */
>> +	  dev_state->use_mouse = (c == 'h') ? 1 : 0;
>> +	  syscall_printf ("mouse support set to mode %d", dev_state->use_mouse);
>> +	  break;
>> +
>> +	case 1002: /* Mouse button event tracking */
>>     
> Just curious:  Is there a 1001 control sequence as well?
>   
Yes, with xterm. It's "Highlight mouse tracking mode" with implicit text 
highlighting while moving the mouse, and it's interacting with the 
application. So it's quite tricky to implement for the terminal and 
error-prone for the application because if it does not cooperate 
properly the terminal will hang. I'm currently using it for mined (in 
xterm) but I'll drop it for the next release in favour of my own 
highlighting. The mode provides more trouble than benefit and I also 
discouraged Andy from doing it for mintty.

Thomas



More information about the Cygwin-patches mailing list