Example #1
0
/*!
 * \brief Determines if a key is pressed
 * \return Key scan code, KM_NO_KEY otherwise
 */
static int KeyIsKeyPressed(void) {
  if (KeyGetCol()!=0) {  /* is there a key pressed? */
    return KeyDecode();  /* yes, return scan code */
  } else {
    return KM_NO_KEY;  /* no key pressed */
  }
}
Example #2
0
void PlayerEvt(XEvent& e)
{	
	if (e.type == ClientMessage)
	{
		unsigned int msg = (unsigned int)e.xclient.data.l[0];
		if (msg == PSEUDO_WM_INIT) 
		{
			//init
			CommonWindowInit("Mediacenter - player control", win, gc);
			PlayerCommand('i');
			return;
		}
		
		if (msg == PSEUDO_WM_ACTIVATE)  
		{ 
			PlayerCommand('a');
			return; 
		}
		
		if (msg == PSEUDO_WM_DEACTIVATE)  
		{ 
			//PlayerCommand('d'); //other windows need to hide player
			return; 
		}

		if (msg == PSEUDO_WM_QUIT) 
		{ 
			PlayerCommand('q');
			XDestroyWindow(dpy, win); 
			return; 
		}
	}
	
	if (e.type == Expose && e.xexpose.count == 0) {}


	if (e.type == KeyPress)
	{
		KeySym keysym; unsigned int state; char ch; KeyDecode(e, keysym, state, ch);
		
		if (keysym==XK_o) { PlayerCommand('o',"/home/s0/_/prj/src/linuxc/mediacenter/test.mpg"); }
		if (keysym==XK_s) { PlayerCommand('s'); }
		if (keysym==XK_p) { PlayerCommand('p'); }
		if (keysym==XK_space) { PlayerCommand('u'); }
		if (keysym==XK_Insert) { PlayerCommand('r'); }
		if (keysym==XK_Delete) { PlayerCommand('f'); }
		
		if (ch>='0' && ch<='9') { DispatcherActivateFrame( ChanWin ); }
	}
	
}