📄 events.c
字号:
/* 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
* This function is used forc executes current exit func handler.
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
extern void UI_common_screen_exit(void);
extern void UI_common_screen_pre_exit(void);
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
* This function is used for sets current new screen handlers.
* PARAMETERS
* scrnID [IN] The screen ID.
* exitFuncPtr [IN] The exit handler.
* entryFuncPtr [IN] The entry handler.
* 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
* This function is used for enter the new screen. When the applications call
* this function, it executes the previous screen's exit handler, and adds the
* previous screen in the history, then clears the key handlers and entries the
* new screen with the parameter setting. After the applications call
* EntryNewScreen(), they can draw the specified category screen.
* PARAMETERS
* newscrnID [IN] The new screen ID will enter.
* newExitHandler [IN] The exit handler of the new screen. It could be NULL.
* newEntryHandler [IN] The entry handler of the new screen. It could be NULL.
* flag [IN] flag parameters.
* RETURNS
* MMI_TRUE - enter the new screen succeed.
* MMI_FALSE - enter the new screen failed.
*****************************************************************************/
U8 EntryNewScreen(U16 newscrnID, FuncPtr newExitHandler, FuncPtr newEntryHandler, void *flag)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
/* store the current Top entry screen */
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_ENTRYSCR_HDLR, newscrnID, newExitHandler, newEntryHandler));
currTopScrnID = newscrnID;
/* entry the new screen */
if (!mmi_is_orderly_exit_screen ||!IsMainLCDHistoryBack())
{
/* disable small screen flatten for full-screen APPs */
if (flag == MMI_FULL_SCREEN)
{
dm_disable_small_screen_flatten();
}
else
{
dm_enable_small_screen_flatten();
}
PRINT_INFORMATION(("[History] mmi_is_orderly_exit_screen"));
ExecuteCurrExitHandler();
}
/* store the exit current Top entry screen */
currExitScrnID = newscrnID;
if ((newExitHandler != NULL) || (newEntryHandler != NULL))
{
SetGenericExitHandler(newscrnID, newExitHandler, newEntryHandler);
}
mmi_frm_dump_screen_id();
mmi_is_orderly_exit_screen = MMI_FALSE;
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* EntryNewScreen_Ext
* DESCRIPTION
* The behavior is the same with EntryNewScreen(), but this function doesn't
* clear the key handlers.
* PARAMETERS
* newscrnID [IN] The new screen ID will enter.
* newExitHandler [IN] The exit handler of the new screen. It could be NULL.
* newEntryHandler [IN] The entry handler of the new screen. It could be NULL.
* peerBuf [IN] Reserved.
* RETURNS
* MMI_TRUE - enter the new screen succeed.
* MMI_FALSE - enter the new screen failed.
*****************************************************************************/
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);
}
mmi_frm_dump_screen_id();
return MMI_TRUE;
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrExitHandler_Ext
* DESCRIPTION
* This function is used for executes current exit func handler without clear keys.
* 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
* This function is used for check if framework executes the screen's exit
* handler.
* PARAMETERS
* void
* RETURNS
* MMI_BOOL
*****************************************************************************/
MMI_BOOL mmi_execute_scrn_exit_func(void)
{
return mmu_frm_execute_scrn_exit_handler;
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrHiliteHandler
* DESCRIPTION
* This function finds out the current highlight menu item's handler and
* executes it with clear KEY_RIGHT_ARROW key handler. Sometimes the sub menu
* items may be hidden and the sub menu item index will be different. This
* function also handle this case.
* PARAMETERS
* hiliteid [IN] ID of the item for which highlight handler needs to
* be executed.
* 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
* ExecuteCurrHiliteHandler_Ext
* DESCRIPTION
* This function finds out the current highlight menu item's handler and
* executes it without clear KEY_RIGHT_ARROW key handler. Sometimes the sub
* menu items may be hidden and the sub menu item index will be different.
* This function also handle this case.
* PARAMETERS
* hiliteid [IN] ID of the item for which highlight handler needs to
* be executed.
* RETURNS
* void
*****************************************************************************/
void ExecuteCurrHiliteHandler_Ext(S32 hiliteid)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
FuncPtr currFuncPtr = NULL;
S32 hiliteItemID;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
currHiliteID = (U16) hiliteid;
if (currParentID == 0)
{
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_ERROR_EVENT_EXECURHILIHTE_HDLR));
return;
}
/* check if menuitem is hidden */
hiliteItemID = GetSeqItemId_Ext((U16) currParentID, (S16) hiliteid);
currFuncPtr = maxHiliteInfo[hiliteItemID].entryFuncPtr;
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_INFO_EVENT_EXECURHILIHTE_HDLR, hiliteItemID, currFuncPtr));
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -