this code does not change window background when key press

/* 8 . ent e r the event loop */
index = 0 ;
done = 0 ;
while ( done == 0 ) {
XNextEvent (mydisplay , &baseEvent ) ;
switch ( baseEvent . type ) {
case Expose :
break ;
case KeyPress :
count = XLookupString(&baseEvent . xkey , bytes , 3 , &character , &cs ) ;
index = 0 ;
for ( i =0; i <4; i ++)
if ( win [i] . id == baseEvent . xkey .window ) index = i ;
switch ( count ) {
case 0 : /* Control cha r a c t e r */
switch ( character ) {
case XK_Up: /* Up arrow key */
case XK_KP_Up:
XSetWindowBackground(mydisplay , win[index].id, 0xff00FF00) ;
index--;
XSetWindowBackground(mydisplay , win[index].id, 0xFF0000FF) ;
if ( index < 0 ) index = 3 ;

XWarpPointer (mydisplay , None , win [ index ] . id , 0 , 0 , 0 , 0 , win [ index ] . last * charinc , 10 ) ;
break ;
case XK_Down: /* Down arrow key */
case XK_KP_Down:
XSetWindowBackground(mydisplay , win[index].id, 0xff00FF00) ;
index++;
XSetWindowBackground(mydisplay , win[index].id, 0xFF0000FF) ;
if ( index > 3 ) index = 0 ;
XWarpPointer (mydisplay , None , win [ index ] . id , 0 , 0 , 0 , 0 , win [ index ] . last * charinc , 10 ) ;
break ;
}
break ;
case 1 : /* Pr int abl e cha r a c t e r */
win [ index ] . array [ win [ index ] . last ] = bytes [ 0 ] ;
XDrawString (mydisplay , win [ index ] . id , mygc , win [ index ] . last * charinc , 15 , bytes , 1 ) ;
win [ index ] . last ++;
break ;
}
break ;
}
}

}

Dear hitlar,
Could you clarify more on what you want to achieve?
Topic archived. No new replies allowed.