use MSG_TIMEOUT instead of MSG_TIMER for desktop

This commit is contained in:
Vincent Wei
2021-05-03 21:26:42 +08:00
parent 0ea195a7a2
commit 4ebd23bf56
9 changed files with 28 additions and 60 deletions

View File

@@ -368,23 +368,19 @@ sock_error:
static void check_live (void)
{
static DWORD last_ticks;
REQUEST req;
#if 0 /* deprecated code */
/* Since 5.0.0, call __mg_update_tick_count instead */
if (__mg_tick_counter != SHAREDRES_TIMER_COUNTER) {
AlertDesktopTimerEvent ();
__mg_tick_counter = SHAREDRES_TIMER_COUNTER;
}
#endif /* deprecated code */
__mg_update_tick_count (NULL);
/* Tell server that I am live */
req.id = REQID_IAMLIVE;
req.data = &__mg_tick_counter;
req.len_data = sizeof (unsigned int);
ClientRequest (&req, NULL, 0);
// Since 5.0.6, only send IAMLIVE if the current ticks > (last_ticks + 100)
if (__mg_tick_counter > last_ticks + 100) {
/* Tell server that I am live */
req.id = REQID_IAMLIVE;
req.data = &__mg_tick_counter;
req.len_data = sizeof (unsigned int);
ClientRequest (&req, NULL, 0);
}
}
BOOL client_IdleHandler4Client (PMSGQUEUE msg_queue, BOOL wait)
@@ -440,7 +436,7 @@ BOOL client_IdleHandler4Client (PMSGQUEUE msg_queue, BOOL wait)
Msg.wParam = (WPARAM)__mg_tick_counter;
Msg.lParam = 0;
Msg.time = __mg_tick_counter;
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message any more.
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message here.
// kernel_QueueMessage (msg_queue, &Msg);
old_timer = __mg_tick_counter;

View File

@@ -1868,7 +1868,7 @@ void GUIAPI DesktopUpdateAllWindow(void)
SendMessage(HWND_DESKTOP, MSG_PAINT, 0, 0);
}
static void dskOnTimer (void)
static void dskOnTimeout (void)
{
static DWORD uCounter = 0;
static DWORD blink_counter = 0;
@@ -2150,7 +2150,10 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
break;
#endif
/* Since 5.0.6, the desktop handles caret blinking in MSG_TIMEOUT
message, and the interval for this message changes to about 0.05s. */
case MSG_TIMEOUT:
dskOnTimeout ();
// Since 5.0.0: MSG_IDLE messages will be generated by PeekMessage.
// BroadcastMessageInThisThread (MSG_IDLE, wParam, 0);
break;
@@ -2184,12 +2187,6 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
dsk_ops->mouse_handler(dt_context, message, wParam, lParam);
break;
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMER
message, and the interval for this MSG_TIMER changes to about 0.05s. */
case MSG_TIMER:
dskOnTimer ();
break;
default:
break;
}

View File

@@ -4207,7 +4207,7 @@ static int srvSesseionMessageHandler (int message, WPARAM wParam, LPARAM lParam)
}
/* Since 5.0.0, we handle caret blink and auto repeat message here */
static void dskOnTimer (void)
static void dskOnTimeout (void)
{
static UINT uCounter = 0;
static UINT blink_counter = 0;
@@ -4372,11 +4372,6 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
break;
}
case MSG_TIMEOUT:
// Since 5.0.0: MSG_IDLE messages will be generated by PeekMessage.
// BroadcastMessageInThisThread (MSG_IDLE, wParam, 0);
break;
case MSG_SRVNOTIFY: {
MSG msg = {0, MSG_SRVNOTIFY, wParam, lParam};
dskBroadcastMessage (&msg);
@@ -4488,32 +4483,12 @@ static LRESULT DesktopWinProc (HWND hWnd, UINT message,
case MSG_BROADCASTMSG:
return dskBroadcastMessage ((PMSG)lParam);
case MSG_TIMER:
#if 0 /* deprecated code */
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMER
message, and the interval for this MSG_TIMER changes to about 0.05s. */
if (__mg_quiting_stage < 0) {
if (__mg_quiting_stage > _MG_QUITING_STAGE_FORCE &&
__mg_quiting_stage <= _MG_QUITING_STAGE_START) {
__mg_quiting_stage--;
/* printf("try to quit %d\n", __mg_quiting_stage); */
}
else if (__mg_quiting_stage <= _MG_QUITING_STAGE_FORCE) {
/* printf("force to quit !!!\n"); */
}
if (__mg_quiting_stage > _MG_QUITING_STAGE_DESKTOP
&& (mgIsServer ? SERVER_HAS_NO_MAINWINDOW() :
CLIENT_HAS_NO_MAINWINDOW())) {
__mg_quiting_stage = _MG_QUITING_STAGE_DESKTOP;
}
else if (__mg_quiting_stage <= _MG_QUITING_STAGE_DESKTOP) {
PostMessage (HWND_DESKTOP, MSG_ENDSESSION, 0, 0);
}
}
#endif /* deprecated code */
dskOnTimer ();
case MSG_TIMEOUT:
/* Since 5.0.6, the desktop only handles caret blinking in MSG_TIMEOUT
message, and the interval for this message changes to about 0.05s. */
// Since 5.0.0: MSG_IDLE messages will be generated by PeekMessage.
// BroadcastMessageInThisThread (MSG_IDLE, wParam, 0);
dskOnTimeout ();
break;
}

View File

@@ -112,7 +112,7 @@ static void ParseEvent (PLWEVENT lwe)
Msg.message = MSG_TIMEOUT;
Msg.wParam = (WPARAM)lwe->count;
Msg.lParam = 0;
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message any more.
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message here.
// QueueDeskMessage (&Msg);
}
else if (lwe->type == LWETYPE_KEY) {

View File

@@ -860,7 +860,7 @@ checkagain:
/* handle desktop timer here */
if (pMsgQueue == __mg_dsk_msg_queue && pMsgQueue->dwState & QS_DESKTIMER) {
pMsg->hwnd = HWND_DESKTOP;
pMsg->message = MSG_TIMER;
pMsg->message = MSG_TIMEOUT;
pMsg->wParam = 0;
pMsg->lParam = 0;

View File

@@ -94,7 +94,7 @@ void __mg_update_tick_count (void *data)
__mg_tick_counter = __mg_os_get_time_ticks ();
#endif /* not defined _MGRM_PROCESSES */
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMER
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMEOUT
message, and the interval for the timer of desktop changes to 0.05s. */
if (__mg_tick_counter >
__mg_dsk_msg_queue->last_ticks_desktop + DESKTOP_TIMER_INERTVAL) {
@@ -129,7 +129,7 @@ void __mg_update_tick_count (void *data)
__mg_tick_counter += elapsed_ticks;
#endif /* not defined _MGRM_PROCESSES */
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMER
/* Since 5.0.0, the desktop only handles caret blinking in MSG_TIMEOUT
message, and the interval for the timer of desktop changes to 0.05s. */
if (__mg_tick_counter >
__mg_dsk_msg_queue->last_ticks_desktop + DESKTOP_TIMER_INERTVAL) {

View File

@@ -1266,7 +1266,7 @@ void GUIAPI BitBlt (HDC hsdc, int sx, int sy, int sw, int sh,
src.x = sx; src.y = sy; src.w = sw; src.h = sh;
dst.x = dx; dst.y = dy; dst.w = sw; dst.h = sh;
GAL_BlitSurface (psdc->surface, &src, pddc->surface, &dst);
GAL_UpperBlit (psdc->surface, &src, pddc->surface, &dst, dwRop);
}
cliprect = cliprect->next;
}

View File

@@ -125,7 +125,7 @@ static void ParseEvent (PMSGQUEUE msg_que, int event)
Msg.wParam = (WPARAM)lwe.count;
Msg.lParam = 0;
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message any more.
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message here.
// kernel_QueueMessage (msg_que, &Msg);
}
else if (lwe.type == LWETYPE_KEY) {

View File

@@ -107,7 +107,7 @@ static void ParseEvent (PMSGQUEUE msg_que, int event)
Msg.wParam = (WPARAM)lwe.count;
Msg.lParam = 0;
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message any more.
// Since 5.0.0, we do not genenrate MSG_TIMEOUT message here.
// kernel_QueueMessage (msg_que, &Msg);
}
else if (lwe.type == LWETYPE_KEY) {