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

[linrad] Re: xlinrad 02.05 : conversion of x keycodes to ascii



Hi Leif,

On Sunday 16 April 2006 14:06, Leif Asbrink wrote:

> I want key-presses to be sent to Linrad one by one so action
> can be taken on single presses. Presumably that is what
> you already done with patches. Can you send something that works
> on your computer?

This is the modification I made to  xmain.c :

  case KeyPress:
  chr = XKeycodeToKeysym(xdis, ev.xkey.keycode, 0);
  if(chr == X_ESC_SYM)
    {
// The ESC key was pressed. Exit from Linrad NOW!    
    lir_status=LIR_END_PROGRAM;
    if(lir_errcod!=0)break;
    kill_all_flag=1;
    sem_post(&sem_kill_all);
    store_in_kbdbuf(255);
    break;
    }    
  if(chr == X_SHIFT_SYM_L || chr == X_SHIFT_SYM_L )
    {
    shift_key_status=1;
    break;
    }
  if(chr >= 'a' && chr <='z' && shift_key_status == 1)chr-=32;
  if(chr == 7 && shift_key_status == 1)chr='/';
  if(chr <= 'z')
    {
    store_in_kbdbuf(chr);
    break;
    }
// ************** Start mod ***************************
   if(chr == 0xff9e )
    {
    chr ='0';
    store_in_kbdbuf(chr);
    break;
    }

   if(chr == 0xff9c )
    {
    chr ='1';
    store_in_kbdbuf(chr);
    break;
    }
   if(chr == 0xff99 )
    {
    chr ='2';
    store_in_kbdbuf(chr);
    break;
    }

   if(chr == 0xff9b )
    {
    chr ='3';
    store_in_kbdbuf(chr);
    break;
    }
  if(chr == 0xff96 )
    {
    chr ='4';
    store_in_kbdbuf(chr);
    break;
    }

   if(chr == 0xff9d )
    {
    chr ='5';
    store_in_kbdbuf(chr);
    break;
    }
   if(chr == 0xff98 )
    {
    chr ='6';
    store_in_kbdbuf(chr);
    break;
    }

   if(chr == 0xff95 )
    {
    chr ='7';
    store_in_kbdbuf(chr);
    break;
    }
 if(chr == 0xff97 )
    {
    chr ='8';
    store_in_kbdbuf(chr);
    break;
    }

   if(chr == 0xff9a )
    {
    chr ='9';
    store_in_kbdbuf(chr);
    break;
    }


// ************** End  mod ***************************

The relationship between the chr values in the if statements and the 
corresponding ascii codes was found by tracing the values of chr when I was 
hitting the different  keys of the numeric keypad on my keyboard.
In case it matters, Suse tells me that my keyboard is a Generic 104-key PC 
keyboard , with layout= Belgium.

I will  search the internet to find out if there is a better way to handle 
this.

Best 73,

Pierre / ON5GN




#############################################################
This message is sent to you because you are subscribed to
  the mailing list <linrad@xxxxxxxxxxxxxxxxxxxxx>.
To unsubscribe, E-mail to: <linrad-off@xxxxxxxxxxxxxxxxxxxxx>
To switch to the DIGEST mode, E-mail to <linrad-digest@xxxxxxxxxxxxxxxxxxxxx>
To switch to the INDEX mode, E-mail to <linrad-index@xxxxxxxxxxxxxxxxxxxxx>
Send administrative queries to  <linrad-request@xxxxxxxxxxxxxxxxxxxxx>

LINRADDARNIL