Esempio n. 1
0
void LCUI_InitKeyboard(void)
{
	LCUIMutex_Init(&self.mutex);
	RBTree_Init(&self.state_tree);
	RBTree_OnDestroy(&self.state_tree, free);
	LCUI_BindEvent(LCUI_KEYDOWN, OnKeyboardEvent, NULL, NULL);
	LCUI_BindEvent(LCUI_KEYUP, OnKeyboardEvent, NULL, NULL);
}
Esempio n. 2
0
/** 初始化键盘输入模块 */
int LCUI_InitKeyboard( void )
{
	int ret;
	LCUIMutex_Init( &record_mutex );
	LinkedList_Init( &key_state_record, sizeof(KeyState) );
	nobuff_printf("[keyboard] set event ... ");
	ret = LCUI_AddEvent( "keydown", LCUI_KEYDOWN );
	ret |= LCUI_AddEvent( "keyup", LCUI_KEYUP );
	ret |= LCUI_BindEvent( "keydown", OnKeyboardEvent, NULL, NULL );
	ret |= LCUI_BindEvent( "keyup", OnKeyboardEvent, NULL, NULL );
	nobuff_printf(ret < 0 ? "failed\n":"ok\n");
#ifdef LCUI_KEYBOARD_DRIVER_LINUX
	ret |= LCUIDevice_Add( LCUIKeyboard_Init, LCUIKeyboard_Proc, LCUIKeyboard_Exit );
#endif
	return ret;
}
Esempio n. 3
0
/** 初始化鼠标输入模块 */
int LCUI_InitMouse( void )
{
	int ret;
#ifdef LCUI_MOUSE_DRIVER_LINUX
	mouse.fd = -1;
	mouse.state = STATE_REMOVE;	/* 鼠标为移除状态 */
#endif
	nobuff_printf("[mouse] set event ... ");
	ret = LCUI_AddEvent( "mousedown", LCUI_MOUSEDOWN );
	ret |= LCUI_AddEvent( "mouseup", LCUI_MOUSEUP );
	ret |= LCUI_AddEvent( "mousemove", LCUI_MOUSEMOVE );
	ret |= LCUI_BindEvent( "mousedown", OnMouseButtonEvent, NULL, NULL );
	ret |= LCUI_BindEvent( "mouseup", OnMouseButtonEvent, NULL, NULL );
	nobuff_printf(ret < 0 ? "failed\n":"ok\n");
	ret |= LCUIDevice_Add( MouseInit, MouseProc, MouseExit );
	return ret;
}
Esempio n. 4
0
static void start_test( void *arg )
{
	test_move_widget( NULL, NULL );
	LCUI_BindEvent( LCUI_PAINT, check_widget_rect, NULL, NULL );
}