[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[linrad] Re: xlinrad 02.05 : conversion of x keycodes to ascii
- Subject: [linrad] Re: xlinrad 02.05 : conversion of x keycodes to ascii
- From: Robert McGwier <comcast.net; rwmcgwier@xxxxxxxxxxxxxxxx>
- Date: Sun, 16 Apr 2006 10:24:01 -0400
Pierre Vanhoucke wrote:
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 ***************************
While it is strictly a programming style issue, this would be easier to
read if it were done
switch (chr) {
case 0: // comment about this case
store_in_kbdbuf(chr);
break;
case 0xff9c: // comment about this case
chr = '1';
store_in_kbdbuf(chr);
ETC.
default: // If it does not meet any of these cases, here you
can put error handling, etc.
break;
}
Now it will be somewhat more complicated than this if you wish to handle
locale information in interpreting the keys struck and have different
settings dependent on different areas of the world or your personal tastes.
Then the
case 0:
might read
case Zero_in_My_Locale:
etc. and make those changes where appropriate. This would
necessitate a "locale" handling function that fills in Zero_In_My_Locale
in the setup some place to do it effectively and for everyone.
Bob
if(chr == 0xff9e )
{
chr ='0';
store_in_kbdbuf(chr);
break;
}
/
--
AMSAT VP Engineering. Member: ARRL, AMSAT-DL, TAPR, Packrats,
NJQRP/AMQRP, QRP ARCI, QCWA, FRC. ARRL SDR Wrk Grp Chairman
Laziness is the number one inspiration for ingenuity. Guilty as charged!
#############################################################
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