mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-02-07 02:52:42 +08:00
tune code for virtual window
This commit is contained in:
@@ -96,6 +96,13 @@ tab2space() {
|
||||
|
||||
# sed -i 's/\<pMessages\>/pMsgQueue/g' `grep pMessages -rl src/`
|
||||
|
||||
sed -i 's/\<mg_InitMsgQueueThisThread\>/mg_AllocMsgQueueThisThread/g' `grep mg_InitMsgQueueThisThread -rl include/ src/`
|
||||
# sed -i 's/\<mg_InitMsgQueueThisThread\>/mg_AllocMsgQueueThisThread/g' `grep mg_InitMsgQueueThisThread -rl include/ src/`
|
||||
|
||||
# sed -i 's/\<mg_AllocMsgQueueThisThread\>/mg_AllocMsgQueueForThisThread/g' `grep mg_AllocMsgQueueThisThread -rl src/`
|
||||
# sed -i 's/\<mg_FreeMsgQueueThisThread\>/mg_FreeMsgQueueForThisThread/g' `grep mg_FreeMsgQueueThisThread -rl src/`
|
||||
|
||||
# sed -i 's/\<GetMsgQueueThisThread\>/mg_GetMsgQueueForThisThread/g' `grep GetMsgQueueThisThread -rl src/`
|
||||
|
||||
sed -i 's/\<kernel_GetMsgQueue\>/getMsgQueue/g' `grep kernel_GetMsgQueue -rl src/`
|
||||
|
||||
exit 0
|
||||
|
||||
@@ -508,9 +508,6 @@ PMAINWIN gui_CheckAndGetMainWindowPtr (HWND hWnd);
|
||||
|
||||
PMAINWIN gui_GetMainWindowPtrUnderPoint (int x, int y);
|
||||
|
||||
/* return message queue of window. */
|
||||
PMSGQUEUE kernel_GetMsgQueue (HWND hWnd);
|
||||
|
||||
/* return the next window need to repaint. */
|
||||
HWND kernel_CheckInvalidRegion (PMAINWIN pWin);
|
||||
|
||||
@@ -594,6 +591,17 @@ static inline PMAINWIN getMainWindowPtr (HWND hWnd)
|
||||
return pWin->pMainWin;
|
||||
}
|
||||
|
||||
/* Get message queue by window handle.
|
||||
Note that hWnd may belong to a different thread. */
|
||||
static inline PMSGQUEUE getMsgQueue (HWND hWnd)
|
||||
{
|
||||
PMAINWIN pWin;
|
||||
pWin = getMainWindowPtr (hWnd);
|
||||
if (pWin)
|
||||
return pWin->pMsgQueue;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#ifdef _MGHAVE_VIRTUAL_WINDOW
|
||||
|
||||
/* Be careful: does not check validity of hWnd */
|
||||
@@ -610,8 +618,9 @@ static inline BOOL BE_THIS_THREAD (HWND hWnd)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
MSGQUEUE* mg_AllocMsgQueueThisThread (void);
|
||||
void mg_FreeMsgQueueThisThread (void);
|
||||
MSGQUEUE* mg_AllocMsgQueueForThisThread (void);
|
||||
void mg_FreeMsgQueueForThisThread (void);
|
||||
MSGQUEUE* mg_GetMsgQueueForThisThread (BOOL alloc);
|
||||
|
||||
extern pthread_key_t __mg_threadinfo_key;
|
||||
|
||||
@@ -627,21 +636,7 @@ static inline void deleteThreadInfoKey (void)
|
||||
pthread_key_delete (__mg_threadinfo_key);
|
||||
}
|
||||
|
||||
static inline MSGQUEUE* getMsgQueueThisThread (void)
|
||||
{
|
||||
MSGQUEUE* pMsgQueue;
|
||||
|
||||
pMsgQueue = (MSGQUEUE*)pthread_getspecific (__mg_threadinfo_key);
|
||||
#ifdef __VXWORKS__
|
||||
if (pMsgQueue == (void *)-1) {
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
return pMsgQueue;
|
||||
}
|
||||
|
||||
#endif /* defined _MGRM_THREADS */
|
||||
#endif /* defined _MGHAVE_VIRTUAL_WINDOW */
|
||||
|
||||
#ifndef _MGRM_THREADS
|
||||
static inline void SetDesktopTimerFlag (void)
|
||||
|
||||
@@ -2457,7 +2457,7 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
|
||||
pWin = (PMAINWIN)(nodes[fixed_slots[slot]].hwnd);
|
||||
if (pWin && (pWin->WinType != TYPE_CONTROL) &&
|
||||
(pWin->pHosting == NULL)) {
|
||||
if ((pMsgQueue = kernel_GetMsgQueue((HWND)pWin))) {
|
||||
if ((pMsgQueue = getMsgQueue((HWND)pWin))) {
|
||||
POST_MSGQ(pMsgQueue);
|
||||
}
|
||||
}
|
||||
@@ -2469,7 +2469,7 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
|
||||
pWin = (PMAINWIN)(nodes[slot].hwnd);
|
||||
if (pWin && (pWin->WinType != TYPE_CONTROL) &&
|
||||
(pWin->pHosting == NULL)) {
|
||||
if ((pMsgQueue = kernel_GetMsgQueue((HWND)pWin))) {
|
||||
if ((pMsgQueue = getMsgQueue((HWND)pWin))) {
|
||||
POST_MSGQ(pMsgQueue);
|
||||
}
|
||||
}
|
||||
@@ -2480,7 +2480,7 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
|
||||
pWin = (PMAINWIN)(nodes[slot].hwnd);
|
||||
if (pWin && (pWin->WinType == TYPE_MAINWIN) &&
|
||||
(pWin->pHosting == NULL)){
|
||||
if ((pMsgQueue = kernel_GetMsgQueue((HWND)pWin))) {
|
||||
if ((pMsgQueue = getMsgQueue((HWND)pWin))) {
|
||||
POST_MSGQ(pMsgQueue);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,8 +145,8 @@ void* __kernel_desktop_main (void* data)
|
||||
MSG Msg;
|
||||
|
||||
/* init message queue of desktop thread */
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueThisThread ()) ) {
|
||||
_WRN_PRINTF ("KERNEL>Desktop: mg_AllocMsgQueueThisThread failure!\n");
|
||||
if (!(__mg_dsk_msg_queue = mg_AllocMsgQueueForThisThread ()) ) {
|
||||
_WRN_PRINTF ("KERNEL>Desktop: mg_AllocMsgQueueForThisThread failure!\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -257,7 +257,7 @@ ndef __USE_TIMER_THREAD
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* The following function is moved to src/include/internals.h as inline functions.
|
||||
/* The following functions were moved to src/include/internals.h as inline.
|
||||
static inline BOOL createThreadInfoKey (void)
|
||||
{
|
||||
if (pthread_key_create (&__mg_threadinfo_key, NULL))
|
||||
@@ -270,7 +270,7 @@ static inline void deleteThreadInfoKey (void)
|
||||
pthread_key_delete (__mg_threadinfo_key);
|
||||
}
|
||||
|
||||
MSGQUEUE* GetMsgQueueThisThread (void)
|
||||
MSGQUEUE* mg_GetMsgQueueForThisThread (void)
|
||||
{
|
||||
return (MSGQUEUE*) pthread_getspecific (__mg_threadinfo_key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user