tune the implementation of tracing message

This commit is contained in:
VincentWei
2018-01-21 18:09:51 +08:00
parent 75764eecb4
commit 6290779a02
9 changed files with 54 additions and 47 deletions
+3 -3
View File
@@ -561,9 +561,9 @@ extern "C" {
*/
#define DEF_INTERVAL_TIME 200
extern unsigned int __mg_key_longpress_time;
extern unsigned int __mg_key_alwayspress_time;
extern unsigned int __mg_interval_time;
extern DWORD __mg_key_longpress_time;
extern DWORD __mg_key_alwayspress_time;
extern DWORD __mg_interval_time;
/**
* \def SetKeyLongPressTime(time)
+5 -3
View File
@@ -3,7 +3,7 @@
**
** msgstr.h: the text name of all messages.
**
** Copyright (C) 2003 ~ 2007 Feynman Software.
** Copyright (C) 2003 ~ 2018 FMSoft
** Copyright (C) 1999 ~ 2002 Wei Yongming.
**
** Create date: 1999/01/03
@@ -201,9 +201,9 @@ char * __mg_msgstr2 [] =
"", // 0x00DB
"", // 0x00DC
"", // 0x00DD
"MSG_ERASEDESKTOP ", // 0x00DE
"MSG_PAINTDESKTOP ", // 0x00DF
"MSG_DT_LBUTTONDOWN ", // 0x00E0
"MSG_DT_LBUTTONUP ", // 0x00E1
"MSG_DT_LBUTTONDBLCLK ", // 0x00E2
@@ -237,6 +237,7 @@ char * __mg_msgstr2 [] =
"MSG_SCROLLMAINWIN ", // 0x00FD
"MSG_CARET_CREATE ", // 0x00FE
"MSG_CARET_DESTROY ", // 0x00FF
"MSG_ENABLEMAINWIN ", // 0x0100
"MSG_ISENABLED ", // 0x0101
"MSG_SETWINCURSOR", // 0x0102
@@ -284,7 +285,8 @@ char * __mg_msgstr3 [] =
"", // 0x0136
"", // 0x0137
"", // 0x0138
"", // 0x0139 "", // 0x013A
"", // 0x0139
"", // 0x013A
"", // 0x013B
"", // 0x013C
"", // 0x013D
+1 -1
View File
@@ -33,7 +33,7 @@ typedef TIMER* PTIMER;
BOOL mg_InitTimer (void);
void mg_TerminateTimer (void);
void mg_dispatch_timer_message (unsigned int inter);
void mg_dispatch_timer_message (DWORD inter);
void mg_remove_timers_by_msg_queue (const MSGQUEUE* msg_que);
TIMER* __mg_get_timer (int slot);
+3 -3
View File
@@ -2198,10 +2198,10 @@ LRESULT DesktopWinProc (HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
case MSG_TIMER: // per 0.01s
{
static UINT uCounter = 0;
static DWORD uCounter = 0;
#ifndef _MGRM_THREADS
static UINT blink_counter = 0;
static UINT sg_old_counter = 0;
static DWORD blink_counter = 0;
static DWORD sg_old_counter = 0;
if (sg_old_counter == 0)
sg_old_counter = __mg_timer_counter;
+10 -8
View File
@@ -125,12 +125,12 @@ void* DesktopMain (void* data)
LRESULT lRet = 0;
#ifdef _MGHAVE_TRACE_MSG
fprintf (stderr, "Message, %s: hWnd: %p, wP: %p, lP: %p. %s\n",
Message2Str (Msg.message),
Msg.hwnd,
(PVOID)Msg.wParam,
(PVOID)Msg.lParam,
Msg.pAdd?"Sync":"Normal");
if (Msg.message != MSG_TIMEOUT && Msg.message != MSG_TIMER) {
fprintf (stderr, "Message %u (%s): hWnd: HWND_DESKTOP, wP: %p, lP: %p, tick: %u; %s\n",
Msg.message, Message2Str (Msg.message),
(PVOID)Msg.wParam, (PVOID)Msg.lParam, (UINT)Msg.time,
Msg.pAdd?"Sync":"Normal");
}
#endif
lRet = DesktopWinProc (HWND_DESKTOP,
@@ -144,8 +144,10 @@ void* DesktopMain (void* data)
}
#ifdef _MGHAVE_TRACE_MSG
fprintf (stderr, "Message, %s done, return value: %p\n",
Message2Str (Msg.message), (PVOID)lRet);
if (Msg.message != MSG_TIMEOUT && Msg.message != MSG_TIMER) {
fprintf (stderr, "Message %u (%s) done, return value: %p\n",
Msg.message, Message2Str (Msg.message), (PVOID)lRet);
}
#endif
}
+15 -15
View File
@@ -54,9 +54,9 @@ static int repeatusec;
static int dblclicktime;
#ifndef _MGRM_THREADS
static unsigned int timeout_threshold;
static unsigned int repeat_threshold;
static unsigned int timeout_count;
static DWORD timeout_threshold;
static DWORD repeat_threshold;
static DWORD timeout_count;
#endif
static void GetDblclickTime(void)
@@ -100,11 +100,11 @@ static void GetTimeout (void)
/* Mouse event parameters. */
static int oldbutton = 0;
static unsigned int time1;
static unsigned int time2;
static DWORD time1;
static DWORD time2;
/* Key event parameters. */
static unsigned int ke_time;
static DWORD ke_time;
#ifndef _MGRM_PROCESSES
static unsigned char oldkeystate [MGUI_NR_KEYS + 1];
#endif
@@ -180,15 +180,15 @@ static void ResetKeyEvent(void)
* default long pressed and always pressed value
* The default long press handling disabled at startup.
*/
unsigned int __mg_key_longpress_time = 0;
unsigned int __mg_key_alwayspress_time = DEF_APRESS_TIME;
unsigned int __mg_interval_time = DEF_INTERVAL_TIME;
DWORD __mg_key_longpress_time = 0;
DWORD __mg_key_alwayspress_time = DEF_APRESS_TIME;
DWORD __mg_interval_time = DEF_INTERVAL_TIME;
static void treat_longpress (PKEYEVENT ke, unsigned int interval)
static void treat_longpress (PKEYEVENT ke, DWORD interval)
{
static unsigned int starttime;
static DWORD starttime;
static int flag1 = 0, flag2 = 1; /*flag1: longpress flags*/
unsigned int maxctime;
DWORD maxctime;
maxctime = (__mg_key_longpress_time < __mg_key_alwayspress_time)
? __mg_key_longpress_time : __mg_key_alwayspress_time;
@@ -256,12 +256,12 @@ static void treat_longpress (PKEYEVENT ke, unsigned int interval)
BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
{
static LWEVENT old_lwe = {0, 0};
unsigned int interval;
int button;
DWORD interval;
PMOUSEEVENT me = &(lwe->data.me);
PKEYEVENT ke = &(lwe->data.ke);
const char* keystate;
int i;
int button;
int make; /* 0 = release, 1 = presse */
if (event == 0) {
@@ -516,7 +516,7 @@ BOOL kernel_GetLWEvent (int event, PLWEVENT lwe)
static LWEVENT old_lwe = {0, 0};
int nr_keys = 0;
unsigned int interval;
DWORD interval;
int button;
PMOUSEEVENT me = &(lwe->data.me);
PKEYEVENT ke = &(lwe->data.ke);
+13 -10
View File
@@ -1029,12 +1029,11 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
LICENSE_MODIFY_MESSAGE(pMsg);
#ifdef _MGHAVE_TRACE_MSG
fprintf (stderr, "Message, %s: hWnd: %p, wP: %p, lP: %p. %s\n",
Message2Str (pMsg->message),
pMsg->hwnd,
(PVOID)pMsg->wParam,
(PVOID)pMsg->lParam,
SYNMSGNAME);
if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) {
fprintf (stderr, "Message %u (%s): hWnd: %p, wP: %p, lP: %p. %s\n",
pMsg->message, Message2Str (pMsg->message),
pMsg->hwnd, (PVOID)pMsg->wParam, (PVOID)pMsg->lParam, SYNMSGNAME);
}
#endif
if (pMsg->hwnd == HWND_INVALID) {
@@ -1047,8 +1046,10 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
#endif
#ifdef _MGHAVE_TRACE_MSG
fprintf (stderr, "Message have been thrown away: %s\n",
Message2Str (pMsg->message));
if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) {
fprintf (stderr, "Message %u (%s) has been thrown away.\n",
pMsg->message, Message2Str (pMsg->message));
}
#endif
return -1;
}
@@ -1071,8 +1072,10 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg)
#endif
#ifdef _MGHAVE_TRACE_MSG
fprintf (stderr, "Message, %s done, return value: %p\n",
Message2Str (pMsg->message), (PVOID)lRet);
if (pMsg->message != MSG_TIMEOUT && pMsg->message != MSG_CARETBLINK) {
fprintf (stderr, "Message %u (%s) done, return value: %p\n",
pMsg->message, Message2Str (pMsg->message), (PVOID)lRet);
}
#endif
return lRet;
+2 -2
View File
@@ -54,7 +54,7 @@ static pthread_mutex_t timerLock;
#ifdef _MGGAL_S3C6410
# define _MG_USE_BETTER_TIMER
#endif /* __NOUNIX__ */
#endif /* _MGGAL_S3C6410 */
#ifdef _MG_USE_BETTER_TIMER
#include <sys/times.h>
@@ -255,7 +255,7 @@ void mg_TerminateTimer (void)
}
/************************* Functions run in desktop thread *******************/
void mg_dispatch_timer_message (unsigned int inter)
void mg_dispatch_timer_message (DWORD inter)
{
int i;
+2 -2
View File
@@ -38,8 +38,8 @@
#include "menu.h"
#include "ourhdr.h"
extern unsigned int __mg_timer_counter;
static unsigned int old_timer_counter = 0;
extern DWORD __mg_timer_counter;
static DWORD old_timer_counter = 0;
static SRVEVTHOOK srv_evt_hook = NULL;