📄 events.c
字号:
MSG_ID_FMT_MMI_CARD_PLUG_OUT_IND,
0 /* end at 0 */
}
}
#endif /* __MMI_FILE_MANAGER__ */
};
static U16 currMaxHiliteInfo; /* currently max hilite info */
static U16 maxProtocolEvent;
static U16 usedProtocolEvent;
static U16 maxInterruptEvent;
static U16 currParentID; /* current parent item id */
static U16 currKeyCode;
static U16 currKeyType;
static U16 currHiliteID;
static FuncPtr currEntryFuncPtr;
static U16 currExitScrnID, currTopScrnID; /* curr exit func ptr with scrn id */
static FuncPtr currExitFuncPtr;
static PseventInfo protocolEventHandler[MAX_PROTOCOL_EVENT];
static PsInteventInfo interruptEventHandler[MAX_INTERRUPT_EVENT];
static MMI_BOOL mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
/*
* Local Functions
*/
static void ExecuteCurrExitHandler(void); /* execute current exit func handler, before execute current event handler */
static void ExecuteCurrExitHandler_Ext(void); /* execute current exit func handler, before execute current event handler */
static void SetGenericExitHandler(U16 scrnID, FuncPtr exitFuncPtr, FuncPtr entryFuncPtr);
static MMI_BOOL QueryInterruptHandler(U16 eventID, PsIntFuncPtr *funcPtr, PsIntFuncPtr *postfuncPtr);
/* 090404 MTK Calvin removed */
/* static void SetExitHandler(U16 scrnID, FuncPtr exitFuncPtr); */
/* 090404 MTK Calvin end */
/*
* Global Functions
*/
extern void EmergencyCallCheck(S16 keyCode, S16 keyType);
extern void InitKeypadBeforePWRON(void);
extern U16 GetTotalCallCount(void);
#ifdef __MMI_SCREEN_SNAPSHOT__
extern void mmi_camera_scr_snapshot(void);
#endif
/*****************************************************************************
* FUNCTION
* InitEvents
* DESCRIPTION
* Initialization
*
* This is used to Initialize event handlers
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void InitEvents(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 keyCode = 0;
U16 keyType = 0;
U16 count = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_INIT));
for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
{
for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
{
currKeyFuncPtrs[keyCode][keyType] = NULL;
}
}
currEntryFuncPtr = NULL;
currExitScrnID = 0;
currTopScrnID = 0;
currExitFuncPtr = NULL;
mmu_frm_execute_scrn_exit_handler = MMI_FALSE;
/* JL remove to outside init InitHistory(); */
currMaxHiliteInfo = 0;
currParentID = 0;
maxProtocolEvent = 0;
usedProtocolEvent = 0;
/* MTK added by JL for PS interrupt */
maxInterruptEvent = 0;
/* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
{
protocolEventHandler[count].eventID = 0;
protocolEventHandler[count].entryFuncPtr = NULL;
}
for (count = 0; count < MAX_HILITE_HANDLER; count++)
{
maxHiliteInfo[count].entryFuncPtr = NULL;
maxHiliteInfo[count].hintFuncPtr = NULL;
}
for (count = 0; count < MAX_SUB_MENUS; count++)
{
subMenuDataPtrs[count] = subMenuData[count];
}
/* MTK added by JL for PS interrupt */
for (count = 0; count < MAX_INTERRUPT_EVENT; count++)
{
interruptEventHandler[count].eventID = (U16) NULL;
interruptEventHandler[count].entryIntFuncPtr = NULL;
interruptEventHandler[count].postIntFuncPtr = NULL;
}
/* ////////////////////////////////////////////////////////////////////////////////////// */
}
/*****************************************************************************
* FUNCTION
* DeInitFramework_KeyAndEventHandler
* DESCRIPTION
* DeInitialization
*
* Deinitialize key and event handlers
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void DeInitFramework_KeyAndEventHandler(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
U16 keyCode = 0;
U16 keyType = 0;
U16 count = 0;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_KEY_EVENT));
for (keyCode = 0; keyCode < MAX_KEYS; keyCode++)
{
for (keyType = 0; keyType < MAX_KEY_TYPE; keyType++)
{
currKeyFuncPtrs[keyCode][keyType] = NULL;
}
}
currEntryFuncPtr = NULL;
currExitScrnID = 0;
currTopScrnID = 0;
currExitFuncPtr = NULL;
currMaxHiliteInfo = 0;
currParentID = 0;
maxProtocolEvent = 0;
usedProtocolEvent = 0;
/* //////// initilaize the timer, protocol & hardware events with func ptrs /////// */
for (count = 0; count < MAX_PROTOCOL_EVENT; count++)
{
protocolEventHandler[count].eventID = 0;
protocolEventHandler[count].entryFuncPtr = NULL;
}
for (count = 0; count < MAX_HILITE_HANDLER; count++)
{
maxHiliteInfo[count].entryFuncPtr = NULL;
maxHiliteInfo[count].hintFuncPtr = NULL;
}
}
/*****************************************************************************
* FUNCTION
* DeInitFramework_History
* DESCRIPTION
* DeInitialization
*
* Deinitialize History
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void DeInitFramework_History(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT_HISTORY));
#ifndef MMI_ON_WIN32
/* to handle key events before finish power off */
InitKeypadBeforePWRON();
#endif /* MMI_ON_WIN32 */
DinitHistory();
DinitSubLCDHistory();
}
/*****************************************************************************
* FUNCTION
* DeInitFramework
* DESCRIPTION
* DeInitialization
*
* This is used to De-initialize history & event handlers
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void DeInitFramework(void)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
MMI_TRACE((MMI_TRACE_G1_FRM, MMI_FRM_FUN_EVENT_DEINIT));
DeInitFramework_KeyAndEventHandler();
DeInitFramework_History();
}
/*****************************************************************************
* FUNCTION
* mmi_frm_reset_internal_key_contex
* DESCRIPTION
* Reset internal key contex
*
* This is used to De-initialize history & event handlers
* PARAMETERS
* void
* RETURNS
* void
*****************************************************************************/
void mmi_frm_reset_internal_key_contex()
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
pressKey = 0;
processUpRepeatKey = 0;
}
/*****************************************************************************
* FUNCTION
* ExecuteCurrKeyHandler
* DESCRIPTION
* executes current key func handler
*
* This is used to executes current key func handler
* PARAMETERS
* keyCode [IN]
* keyType [IN]
* RETURNS
* void
*****************************************************************************/
void ExecuteCurrKeyHandler(S16 keyCode, S16 keyType)
{
/*----------------------------------------------------------------*/
/* Local Variables */
/*----------------------------------------------------------------*/
FuncPtr currFuncPtr = NULL;
/*----------------------------------------------------------------*/
/* Code Body */
/*----------------------------------------------------------------*/
mmi_idle_restart_keypad_lock_timer(); /* 2006/01/16 Restart keypad lock timer if any key is pressed in idle screen */
currKeyCode = keyCode;
currKeyType = keyType;
/* Added for Help */
/*
* if(gIsHelpEnabled != 0)
* {
* StopTimer(HELP_APPLICATION_TIMER);
* StartTimer(HELP_APPLICATION_TIMER,HELP_APPLICATION_TIMEOUT,ShowHelp);
* }
*/
if (!gEmerencyNoDialed)
{
if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
{
/* special handling for single-key mode */
switch (keyType)
{
case KEY_HALF_PRESS_DOWN:
pressKey = 1; /* 0- full up, 1- half down, 2- full down */
break;
case KEY_EVENT_DOWN:
/*
* The application may call ExecuteCurrKeyHandler() directly
* MMI framework use KEY_HALF_PRESS_DOWN or KEY_FULL_PRESS_DOWN only
*/
pressKey = 2; /* 0- full up, 1- half down, 2- full down */
processUpRepeatKey = 1;
break;
case KEY_REPEAT:
if (!processUpRepeatKey)
{
return;
}
break;
case KEY_EVENT_UP:
if (pressKey == 0)
{
/* processUpRepeatKey=0; */
mmi_frm_reset_internal_key_contex();
return;
}
break;
}
}
currFuncPtr = currKeyFuncPtrs[keyCode][keyType];
/* MTK Leo add, if there is no handler for center key(KEY_ENTER) registered by APP, use LSK function. */
if (keyCode == KEY_ENTER && currFuncPtr == NULL)
{
/* If any one type of the key eventis registered by APP, we assume APP want to control this key by itself. */
if (currKeyFuncPtrs[KEY_ENTER][KEY_EVENT_UP] == NULL &&
currKeyFuncPtrs[KEY_ENTER][KEY_EVENT_DOWN] == NULL &&
currKeyFuncPtrs[KEY_ENTER][KEY_HALF_PRESS_DOWN] == NULL &&
currKeyFuncPtrs[KEY_ENTER][KEY_REPEAT] == NULL && currKeyFuncPtrs[KEY_ENTER][KEY_LONG_PRESS] == NULL)
{
currFuncPtr = currKeyFuncPtrs[KEY_LSK][keyType];
}
}
/* MTK Leo end. */
if ((keyType == KEY_REPEAT) && (currFuncPtr == NULL) && (keyCode != KEY_RSK) && (keyCode != KEY_LSK)) /* 20040906 Disable repeat for LSK and RSK */
{
currFuncPtr = currKeyFuncPtrs[keyCode][KEY_EVENT_DOWN];
}
#ifdef __MMI_WGUI_MINI_TAB_BAR__
if (wgui_if_mini_tab_bar_enable() == MMI_TRUE && keyCode == KEY_LEFT_ARROW && keyType == KEY_EVENT_DOWN)
{
currFuncPtr = wgui_mini_tab_bar_goto_prev;
}
if (wgui_if_mini_tab_bar_enable() == MMI_TRUE && keyCode == KEY_RIGHT_ARROW && keyType == KEY_EVENT_DOWN)
{
currFuncPtr = wgui_mini_tab_bar_goto_next;
}
#endif /* __MMI_WGUI_MINI_TAB_BAR__ */
#ifdef __MMI_SCREEN_SNAPSHOT__
if ((keyType == KEY_LONG_PRESS) && (keyCode == KEY_CAMERA) && (currFuncPtr == NULL))
{
currFuncPtr = mmi_camera_scr_snapshot;
}
#endif /* __MMI_SCREEN_SNAPSHOT__ */
if (mmi_kbd_get_concurrent_mode() == MMI_FALSE)
{
if (keyType == KEY_EVENT_UP)
{
/* release the key */
if (pressKey == 1) /* 0- full up, 1- half down, 2- full down */
{
currFuncPtr = currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP];
}
else if ((pressKey == 2) && (currKeyFuncPtrs[keyCode][KEY_HALF_PRESS_UP] != NULL))
{
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -