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