📄 events.c
字号:
/* If KEY_EVENT_UP in 2-stage full-pressed key, need call KEY_HALF_PRESS_UP handler first */
currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP] ();
}
/* special handling for single-key mode */
mmi_frm_reset_internal_key_contex();
}
}
if (currFuncPtr)
{
#ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_TRUE;
#endif
MMI_TRACE( (MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURKEY_KEYCODE_HDLR,currFuncPtr, keyCode, keyType));
(*currFuncPtr)();
}
}
else
{
gEmerencyNoDialed = 0;
}
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrProtocolHandler
* DESCRIPTION
* executes current protocol func handler
*
* This is used to executes current protocol func handler
* PARAMETERS
* eventID [IN]
* MsgStruct [IN]
* mod_src [IN]
* peerBuf [IN]
* RETURNS
* void
*****************************************************************************/
void ExecuteCurrProtocolHandler(U16 eventID, void *MsgStruct, int mod_src, void *peerBuf)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 count = 0;
/* PsExtFuncPtr currFuncPtr = NULL; */
PsExtPeerFuncPtr currFuncPtr = NULL;
PsIntFuncPtr IntFunc = NULL, PostIntFunc = NULL;
PsExtPeerIntFuncPtr currInterruptFuncPtr = NULL, currPostInterruptFuncPtr = NULL;
U8 interrup_result = MMI_FALSE; /* False not handle interrupt, True will handle */
#if defined (MMI_EVENT_PROFILING)
kal_uint32 start_tick, end_tick;
static kal_uint32 accu_ticks = 0;
static U32 accu_count = 0;
#endif /* defined (MMI_EVENT_PROFILING) */
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#if defined (MMI_EVENT_PROFILING)
kal_get_time(&start_tick);
#endif
/* Search events in protocol event handler table */
for (count = 0; count < maxProtocolEvent; count++)
{
if (protocolEventHandler[count].eventID == eventID)
{
currFuncPtr = (PsExtPeerFuncPtr) protocolEventHandler[count].entryFuncPtr;
if (count > 0)
{ /* improve the search efficiently */
protocolEventHandler[count].eventID = protocolEventHandler[count - 1].eventID;
protocolEventHandler[count].entryFuncPtr = protocolEventHandler[count - 1].entryFuncPtr;
protocolEventHandler[count - 1].eventID = eventID;
protocolEventHandler[count - 1].entryFuncPtr = (PsFuncPtr) currFuncPtr;
}
break;
}
}
#if defined (MMI_EVENT_PROFILING)
PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler count = %d", count));
accu_count += count;
#endif /* defined (MMI_EVENT_PROFILING) */
/* Search events in interrupt event handler table */
QueryInterruptHandler(eventID, &IntFunc, &PostIntFunc);
currInterruptFuncPtr = (PsExtPeerIntFuncPtr) IntFunc;
currPostInterruptFuncPtr = (PsExtPeerIntFuncPtr) PostIntFunc;
if (currInterruptFuncPtr)
{
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURPTO_INTP_HDLR, eventID));
interrup_result = (*currInterruptFuncPtr) (MsgStruct, mod_src, peerBuf);
}
/* if(currFuncPtr) */
if ((currFuncPtr) && (!interrup_result))
{
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURPTO_HDLR, eventID));
/* (*currFuncPtr)(MsgStruct,mod_src); */
(*currFuncPtr) (MsgStruct, mod_src, peerBuf);
}
else
{
MMI_TRACE((MMI_TRACE_WARNING, MMI_FRM_INFO_EVENT_EXECURPTO_NO_HDLR, eventID));
}
if (currPostInterruptFuncPtr)
{
(*currPostInterruptFuncPtr) (MsgStruct, mod_src, peerBuf);
}
#if defined (MMI_EVENT_PROFILING)
kal_get_time(&end_tick);
accu_ticks += (end_tick - start_tick);
PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler accu_count = %d", accu_count));
PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler accu_ticks = %d", accu_ticks));
PRINT_INFORMATION_2((MMI_TRACE_G1_FRM, "ExecuteCurrProtocolHandler maxProtocolEvent = %d", maxProtocolEvent));
#endif /* defined (MMI_EVENT_PROFILING) */
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrExitHandler
* DESCRIPTION
* executes current exit func handler
*
* This is used to executes current exit func handler
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
extern void UI_common_screen_exit(void);
extern void UI_common_screen_pre_exit(void);
static void ExecuteCurrExitHandler(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* MTK added by JL 040115 for create a new function without key clear if need. */
ExecuteCurrExitHandler_Ext();
/* it clears all the key handlers, registered by the current screen */
ClearInputEventHandler(MMI_DEVICE_KEY);
#ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
mmi_tm_reset_imageid_image_header_pool();
#ifdef __MMI_DLT_CACHE_SUPPORT__
mmi_tm_clear_ondemand_cache();
#endif
#endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */
/* MTK end */
#if defined(__MMI_RESOURCE_ENFB_SUPPORT__)
mmi_frm_resmem_reset(MMI_FRM_RESMEM_TYPE_LOD_ON_DEMAND);
#endif /* __MMI_RESOURCE_ENFB_SUPPORT__ */
}
/*****************************************************************************
* FUNCTION
* ReplaceNewScreenHandler
* DESCRIPTION
* Replace current new screen handler
*
* This is used to sets current new screen handlers
* PARAMETERS
* scrnID [IN]
* exitFuncPtr [IN]
* entryFuncPtr [IN]
* RETURNS
* void
*****************************************************************************/
void ReplaceNewScreenHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_SETEXIT_HDLR, scrnID));
currExitScrnID = scrnID;
currExitFuncPtr = exitFuncPtr;
currEntryFuncPtr = entryFuncPtr;
}
/*****************************************************************************
* FUNCTION
* EntryNewScreen
* DESCRIPTION
* To set the current topest screen ID for entry screen function
*
* This is used to executes current exit func handler
* PARAMETERS
* newscrnID [IN]
* newExitHandler [IN]
* newEntryHandler [IN]
* peerBuf [IN]
* RETURNS
* void
*****************************************************************************/
U8 EntryNewScreen(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *peerBuf)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* store the current Top entry screen */
currTopScrnID = newscrnID;
/* entry the new screen */
ExecuteCurrExitHandler();
/* store the exit current Top entry screen */
currExitScrnID = newscrnID;
if ((newExitHandler != NULL) || (newEntryHandler != NULL))
{
SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* EntryNewScreen_Ext
* DESCRIPTION
* To set the current topest screen ID for entry screen function, without clear keyhandler
*
* This is used to executes current exit func handler
* PARAMETERS
* newscrnID [IN]
* newExitHandler [IN]
* newEntryHandler [IN]
* peerBuf [IN]
* RETURNS
* void
*****************************************************************************/
U8 EntryNewScreen_Ext(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *peerBuf)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* store the current Top entry screen */
currTopScrnID = newscrnID;
/* entry the new screen */
ExecuteCurrExitHandler_Ext();
/* store the exit current Top entry screen */
currExitScrnID = newscrnID;
if ((newExitHandler != NULL) || (newEntryHandler != NULL))
{
SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
}
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrExitHandler_Ext
* DESCRIPTION
* executes current exit func handler without clear keys
*
* This is used to executes current exit func handler
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
/* MTK added by JL for keypad without clearall requirement */
void ExecuteCurrExitHandler_Ext(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U8 count = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
#ifdef __MMI_SUPPORT_DUMP_SCREEN_STRING__
/* Clear g_mmi_frm_cntx.dump_screen_info.backup_string */
g_mmi_frm_cntx.dump_screen_info.backup_string[0] = 0;
g_mmi_frm_cntx.dump_screen_info.backup_string[1] = 0;
g_mmi_frm_cntx.dump_screen_info.allow_dump_screen_str = MMI_TRUE;
#endif
/* Failsafe common function before exit screen */
UI_common_screen_pre_exit();
for (count = 0; count < MAX_SUB_MENUS; count++)
{
subMenuDataPtrs[count] = subMenuData[count];
}
if (currEntryFuncPtr || currExitFuncPtr)
{
ClearAllInterruptEventHandler();
}
/* call GenericExitScreen if currEntryFuncPtr is not NULL */
if (currEntryFuncPtr)
{
GenericExitScreen(currExitScrnID, currEntryFuncPtr);
}
if (currExitFuncPtr)
{
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXIT_HDLR));
mmu_frm_execute_scrn_exit_handler = MMI_TRUE;
(*currExitFuncPtr) ();
mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
}
currEntryFuncPtr = NULL;
currExitFuncPtr = NULL;
/* Failsafe common screen exit function */
UI_common_screen_exit();
/* it clears all the key handlers, registered by the current screen */
IsBackHistory = FALSE;
/* To dump the history memory */
HistoryDump();
}
/*****************************************************************************
* FUNCTION
* mmi_execute_scrn_exit_func
* DESCRIPTION
* check if framework executes the screen's exit handler
*
* This is used to executes current exit func handler
* PARAMETERS
* void
* RETURNS
* MMI_BOOL
*****************************************************************************/
MMI_BOOL mmi_execute_scrn_exit_func(void)
{
return mmu_frm_execute_scrn_exit_handler;
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrHiliteHandler
* DESCRIPTION
* executes current hilite func handler
*
* This is used to executes current hilite func handler
* PARAMETERS
* hiliteid [IN]
* RETURNS
* void
*****************************************************************************/
void ExecuteCurrHiliteHandler(S32 hiliteid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* To avoid the arrow left key to entry unexpected function, while other APP need they shall register again as BY request. */
ClearKeyHandler(KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
ExecuteCurrHiliteHandler_Ext(hiliteid);
}
/*****************************************************************************
* FUNCTION
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -