Permalink
Browse files

Fix some more problems associated with keymapping

  • Loading branch information...
1 parent 4aeb0cd commit 8a8c47f324e22d929d41678c68f840e362b89fd6 ec429 committed Feb 29, 2012
Showing with 181 additions and 169 deletions.
  1. +2 −5 README
  2. +1 −1 genkeymap.c
  3. +4 −5 input.c
  4. +127 −119 keymap.c
  5. +28 −24 keymod.h
  6. +16 −12 keys
  7. +1 −0 quirc.c
  8. +2 −3 readme.htm
View
@@ -278,11 +278,8 @@ and rxvt. However, this mapping can be changed with a file /home/
username/.quirc/keys.
To change key mappings, add lines of the form MODNAME hex. The MODNAMEs
expected are those which appear in the "keys" file in the quIRC source
-directory; at present, these are:
-BS, UP, DOWN, LEFT, RIGHT, HOME, END, DELETE, PGUP, PGDN, CUP, AUP, CDOWN,
-ADOWN, CLEFT, ALEFT, CRIGHT, ARIGHT, CHOME, AHOME, CEND, AEND, CPGUP, APGUP,
-CPGDN, APGDN, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, and F12.
-The prefix 'C' refers to Ctrl, and 'A' to Alt.
+directory.
+The prefix 'C' refers to Ctrl, 'S' to Shift, and 'A' to Alt.
If, for instance, your terminal sends Ctrl-Left as ^[OD, you would add the
following line:
CLEFT 1b4f44
View
@@ -94,7 +94,7 @@ int main(int argc, char **argv)
{
printf("\tkmap[%d].name=\"%s\";\n", i, keys[i].name);
if(keys[i].mod[0]==':')
- printf("\tif(key_%s) kmap[%d].mod=key_%s; else kmap[%d].mod=\"\";\n", keys[i].mod+1, i, keys[i].mod+1, i);
+ printf("\tif(%s) kmap[%d].mod=%s; else kmap[%d].mod=\"\";\n", keys[i].mod+1, i, keys[i].mod+1, i);
else
{
printf("\tkmap[%d].mod=malloc(%zu);\n", i, strlen(keys[i].mod)+1);
View
@@ -10,7 +10,6 @@
int inputchar(iline *inp, int *state)
{
- //printf("\010\010\010" CLA);
int c=getchar();
if((c==0)||(c==EOF)) // stdin is set to non-blocking, so this may happen
return(0);
@@ -349,12 +348,12 @@ int inputchar(iline *inp, int *state)
ifree(inp);
}
}
- else if((mod==KEY_CLEFT)||(mod==KEY_ALEFT))
+ else if((mod==KEY_SLEFT)||(mod==KEY_CLEFT)||(mod==KEY_ALEFT))
{
cbuf=max(cbuf-1, 0);
if(force_redraw<3) redraw_buffer();
}
- else if((mod==KEY_CRIGHT)||(mod==KEY_ARIGHT))
+ else if((mod==KEY_SRIGHT)||(mod==KEY_CRIGHT)||(mod==KEY_ARIGHT))
{
cbuf=min(cbuf+1, nbufs-1);
if(force_redraw<3) redraw_buffer();
@@ -369,13 +368,13 @@ int inputchar(iline *inp, int *state)
bufs[cbuf].ascroll++;
if(force_redraw<3) redraw_buffer();
}
- else if((mod==KEY_CHOME)||(mod==KEY_AHOME))
+ else if((mod==KEY_SHOME)||(mod==KEY_CHOME)||(mod==KEY_AHOME))
{
bufs[cbuf].scroll=bufs[cbuf].filled?(bufs[cbuf].ptr+1)%bufs[cbuf].nlines:0;
bufs[cbuf].ascroll=0;
if(force_redraw<3) redraw_buffer();
}
- else if((mod==KEY_CEND)||(mod==KEY_AEND))
+ else if((mod==KEY_SEND)||(mod==KEY_CEND)||(mod==KEY_AEND))
{
bufs[cbuf].scroll=bufs[cbuf].ptr;
bufs[cbuf].ascroll=0;
View
@@ -2,7 +2,7 @@
int initkeys(void)
{
- nkeys=38;
+ nkeys=42;
kmap=malloc(nkeys*sizeof(keymod));
if(!kmap) return(1);
kmap[0].name="BS";
@@ -61,201 +61,209 @@ int initkeys(void)
kmap[13].mod[4]=51;
kmap[13].mod[5]=66;
kmap[13].mod[6]=0;
- kmap[14].name="CLEFT";
- kmap[14].mod=malloc(7);
- kmap[14].mod[0]=27;
- kmap[14].mod[1]=91;
- kmap[14].mod[2]=49;
- kmap[14].mod[3]=59;
- kmap[14].mod[4]=53;
- kmap[14].mod[5]=68;
- kmap[14].mod[6]=0;
- kmap[15].name="ALEFT";
+ kmap[14].name="SLEFT";
+ if(key_sleft) kmap[14].mod=key_sleft; else kmap[14].mod="";
+ kmap[15].name="CLEFT";
kmap[15].mod=malloc(7);
kmap[15].mod[0]=27;
kmap[15].mod[1]=91;
kmap[15].mod[2]=49;
kmap[15].mod[3]=59;
- kmap[15].mod[4]=51;
+ kmap[15].mod[4]=53;
kmap[15].mod[5]=68;
kmap[15].mod[6]=0;
- kmap[16].name="CRIGHT";
+ kmap[16].name="ALEFT";
kmap[16].mod=malloc(7);
kmap[16].mod[0]=27;
kmap[16].mod[1]=91;
kmap[16].mod[2]=49;
kmap[16].mod[3]=59;
- kmap[16].mod[4]=53;
- kmap[16].mod[5]=67;
+ kmap[16].mod[4]=51;
+ kmap[16].mod[5]=68;
kmap[16].mod[6]=0;
- kmap[17].name="ARIGHT";
- kmap[17].mod=malloc(7);
- kmap[17].mod[0]=27;
- kmap[17].mod[1]=91;
- kmap[17].mod[2]=49;
- kmap[17].mod[3]=59;
- kmap[17].mod[4]=51;
- kmap[17].mod[5]=67;
- kmap[17].mod[6]=0;
- kmap[18].name="CHOME";
+ kmap[17].name="SRIGHT";
+ if(key_sright) kmap[17].mod=key_sright; else kmap[17].mod="";
+ kmap[18].name="CRIGHT";
kmap[18].mod=malloc(7);
kmap[18].mod[0]=27;
kmap[18].mod[1]=91;
kmap[18].mod[2]=49;
kmap[18].mod[3]=59;
kmap[18].mod[4]=53;
- kmap[18].mod[5]=72;
+ kmap[18].mod[5]=67;
kmap[18].mod[6]=0;
- kmap[19].name="AHOME";
+ kmap[19].name="ARIGHT";
kmap[19].mod=malloc(7);
kmap[19].mod[0]=27;
kmap[19].mod[1]=91;
kmap[19].mod[2]=49;
kmap[19].mod[3]=59;
kmap[19].mod[4]=51;
- kmap[19].mod[5]=72;
+ kmap[19].mod[5]=67;
kmap[19].mod[6]=0;
- kmap[20].name="CEND";
- kmap[20].mod=malloc(7);
- kmap[20].mod[0]=27;
- kmap[20].mod[1]=91;
- kmap[20].mod[2]=49;
- kmap[20].mod[3]=59;
- kmap[20].mod[4]=53;
- kmap[20].mod[5]=70;
- kmap[20].mod[6]=0;
- kmap[21].name="AEND";
+ kmap[20].name="SHOME";
+ if(key_shome) kmap[20].mod=key_shome; else kmap[20].mod="";
+ kmap[21].name="CHOME";
kmap[21].mod=malloc(7);
kmap[21].mod[0]=27;
kmap[21].mod[1]=91;
kmap[21].mod[2]=49;
kmap[21].mod[3]=59;
- kmap[21].mod[4]=51;
- kmap[21].mod[5]=70;
+ kmap[21].mod[4]=53;
+ kmap[21].mod[5]=72;
kmap[21].mod[6]=0;
- kmap[22].name="CPGUP";
+ kmap[22].name="AHOME";
kmap[22].mod=malloc(7);
kmap[22].mod[0]=27;
kmap[22].mod[1]=91;
- kmap[22].mod[2]=53;
+ kmap[22].mod[2]=49;
kmap[22].mod[3]=59;
- kmap[22].mod[4]=53;
- kmap[22].mod[5]=126;
+ kmap[22].mod[4]=51;
+ kmap[22].mod[5]=72;
kmap[22].mod[6]=0;
- kmap[23].name="APGUP";
- kmap[23].mod=malloc(7);
- kmap[23].mod[0]=27;
- kmap[23].mod[1]=91;
- kmap[23].mod[2]=53;
- kmap[23].mod[3]=59;
- kmap[23].mod[4]=51;
- kmap[23].mod[5]=126;
- kmap[23].mod[6]=0;
- kmap[24].name="CPGDN";
+ kmap[23].name="SEND";
+ if(key_send) kmap[23].mod=key_send; else kmap[23].mod="";
+ kmap[24].name="CEND";
kmap[24].mod=malloc(7);
kmap[24].mod[0]=27;
kmap[24].mod[1]=91;
- kmap[24].mod[2]=54;
+ kmap[24].mod[2]=49;
kmap[24].mod[3]=59;
kmap[24].mod[4]=53;
- kmap[24].mod[5]=126;
+ kmap[24].mod[5]=70;
kmap[24].mod[6]=0;
- kmap[25].name="APGDN";
+ kmap[25].name="AEND";
kmap[25].mod=malloc(7);
kmap[25].mod[0]=27;
kmap[25].mod[1]=91;
- kmap[25].mod[2]=54;
+ kmap[25].mod[2]=49;
kmap[25].mod[3]=59;
kmap[25].mod[4]=51;
- kmap[25].mod[5]=126;
+ kmap[25].mod[5]=70;
kmap[25].mod[6]=0;
- kmap[26].name="F1";
- kmap[26].mod=malloc(4);
+ kmap[26].name="CPGUP";
+ kmap[26].mod=malloc(7);
kmap[26].mod[0]=27;
- kmap[26].mod[1]=79;
- kmap[26].mod[2]=80;
- kmap[26].mod[3]=0;
- kmap[27].name="F2";
- kmap[27].mod=malloc(4);
+ kmap[26].mod[1]=91;
+ kmap[26].mod[2]=53;
+ kmap[26].mod[3]=59;
+ kmap[26].mod[4]=53;
+ kmap[26].mod[5]=126;
+ kmap[26].mod[6]=0;
+ kmap[27].name="APGUP";
+ kmap[27].mod=malloc(7);
kmap[27].mod[0]=27;
- kmap[27].mod[1]=79;
- kmap[27].mod[2]=81;
- kmap[27].mod[3]=0;
- kmap[28].name="F3";
- kmap[28].mod=malloc(4);
+ kmap[27].mod[1]=91;
+ kmap[27].mod[2]=53;
+ kmap[27].mod[3]=59;
+ kmap[27].mod[4]=51;
+ kmap[27].mod[5]=126;
+ kmap[27].mod[6]=0;
+ kmap[28].name="CPGDN";
+ kmap[28].mod=malloc(7);
kmap[28].mod[0]=27;
- kmap[28].mod[1]=79;
- kmap[28].mod[2]=82;
- kmap[28].mod[3]=0;
- kmap[29].name="F4";
- kmap[29].mod=malloc(4);
+ kmap[28].mod[1]=91;
+ kmap[28].mod[2]=54;
+ kmap[28].mod[3]=59;
+ kmap[28].mod[4]=53;
+ kmap[28].mod[5]=126;
+ kmap[28].mod[6]=0;
+ kmap[29].name="APGDN";
+ kmap[29].mod=malloc(7);
kmap[29].mod[0]=27;
- kmap[29].mod[1]=79;
- kmap[29].mod[2]=83;
- kmap[29].mod[3]=0;
- kmap[30].name="F5";
- kmap[30].mod=malloc(6);
+ kmap[29].mod[1]=91;
+ kmap[29].mod[2]=54;
+ kmap[29].mod[3]=59;
+ kmap[29].mod[4]=51;
+ kmap[29].mod[5]=126;
+ kmap[29].mod[6]=0;
+ kmap[30].name="F1";
+ kmap[30].mod=malloc(4);
kmap[30].mod[0]=27;
- kmap[30].mod[1]=91;
- kmap[30].mod[2]=49;
- kmap[30].mod[3]=53;
- kmap[30].mod[4]=126;
- kmap[30].mod[5]=0;
- kmap[31].name="F6";
- kmap[31].mod=malloc(6);
+ kmap[30].mod[1]=79;
+ kmap[30].mod[2]=80;
+ kmap[30].mod[3]=0;
+ kmap[31].name="F2";
+ kmap[31].mod=malloc(4);
kmap[31].mod[0]=27;
- kmap[31].mod[1]=91;
- kmap[31].mod[2]=49;
- kmap[31].mod[3]=55;
- kmap[31].mod[4]=126;
- kmap[31].mod[5]=0;
- kmap[32].name="F7";
- kmap[32].mod=malloc(6);
+ kmap[31].mod[1]=79;
+ kmap[31].mod[2]=81;
+ kmap[31].mod[3]=0;
+ kmap[32].name="F3";
+ kmap[32].mod=malloc(4);
kmap[32].mod[0]=27;
- kmap[32].mod[1]=91;
- kmap[32].mod[2]=49;
- kmap[32].mod[3]=56;
- kmap[32].mod[4]=126;
- kmap[32].mod[5]=0;
- kmap[33].name="F8";
- kmap[33].mod=malloc(6);
+ kmap[32].mod[1]=79;
+ kmap[32].mod[2]=82;
+ kmap[32].mod[3]=0;
+ kmap[33].name="F4";
+ kmap[33].mod=malloc(4);
kmap[33].mod[0]=27;
- kmap[33].mod[1]=91;
- kmap[33].mod[2]=49;
- kmap[33].mod[3]=57;
- kmap[33].mod[4]=126;
- kmap[33].mod[5]=0;
- kmap[34].name="F9";
+ kmap[33].mod[1]=79;
+ kmap[33].mod[2]=83;
+ kmap[33].mod[3]=0;
+ kmap[34].name="F5";
kmap[34].mod=malloc(6);
kmap[34].mod[0]=27;
kmap[34].mod[1]=91;
- kmap[34].mod[2]=50;
- kmap[34].mod[3]=48;
+ kmap[34].mod[2]=49;
+ kmap[34].mod[3]=53;
kmap[34].mod[4]=126;
kmap[34].mod[5]=0;
- kmap[35].name="F10";
+ kmap[35].name="F6";
kmap[35].mod=malloc(6);
kmap[35].mod[0]=27;
kmap[35].mod[1]=91;
- kmap[35].mod[2]=50;
- kmap[35].mod[3]=49;
+ kmap[35].mod[2]=49;
+ kmap[35].mod[3]=55;
kmap[35].mod[4]=126;
kmap[35].mod[5]=0;
- kmap[36].name="F11";
+ kmap[36].name="F7";
kmap[36].mod=malloc(6);
kmap[36].mod[0]=27;
kmap[36].mod[1]=91;
- kmap[36].mod[2]=50;
- kmap[36].mod[3]=51;
+ kmap[36].mod[2]=49;
+ kmap[36].mod[3]=56;
kmap[36].mod[4]=126;
kmap[36].mod[5]=0;
- kmap[37].name="F12";
+ kmap[37].name="F8";
kmap[37].mod=malloc(6);
kmap[37].mod[0]=27;
kmap[37].mod[1]=91;
- kmap[37].mod[2]=50;
- kmap[37].mod[3]=52;
+ kmap[37].mod[2]=49;
+ kmap[37].mod[3]=57;
kmap[37].mod[4]=126;
kmap[37].mod[5]=0;
+ kmap[38].name="F9";
+ kmap[38].mod=malloc(6);
+ kmap[38].mod[0]=27;
+ kmap[38].mod[1]=91;
+ kmap[38].mod[2]=50;
+ kmap[38].mod[3]=48;
+ kmap[38].mod[4]=126;
+ kmap[38].mod[5]=0;
+ kmap[39].name="F10";
+ kmap[39].mod=malloc(6);
+ kmap[39].mod[0]=27;
+ kmap[39].mod[1]=91;
+ kmap[39].mod[2]=50;
+ kmap[39].mod[3]=49;
+ kmap[39].mod[4]=126;
+ kmap[39].mod[5]=0;
+ kmap[40].name="F11";
+ kmap[40].mod=malloc(6);
+ kmap[40].mod[0]=27;
+ kmap[40].mod[1]=91;
+ kmap[40].mod[2]=50;
+ kmap[40].mod[3]=51;
+ kmap[40].mod[4]=126;
+ kmap[40].mod[5]=0;
+ kmap[41].name="F12";
+ kmap[41].mod=malloc(6);
+ kmap[41].mod[0]=27;
+ kmap[41].mod[1]=91;
+ kmap[41].mod[2]=50;
+ kmap[41].mod[3]=52;
+ kmap[41].mod[4]=126;
+ kmap[41].mod[5]=0;
return(0);
}
Oops, something went wrong. Retry.

0 comments on commit 8a8c47f

Please sign in to comment.