call SyncUpdateDC or GAL_SyncUpdate for cursor and dc_desktop

This commit is contained in:
Vincent Wei
2020-02-12 23:23:10 +08:00
parent 22b9609a8a
commit d136f23dc4
4 changed files with 37 additions and 11 deletions

View File

@@ -395,6 +395,7 @@ BOOL kernel_RefreshCursor (int* x, int* y, int* button)
if (nShowCount >= 0 && pCurCsr) {
hidecursor ();
showcursor ();
GAL_SyncUpdate (__gal_screen);
}
#endif /* _MGHAVE_CURSOR */
@@ -434,6 +435,7 @@ HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL setdef)
if (pCurCsr && nShowCount >= 0)
showcursor();
GAL_SyncUpdate (__gal_screen);
return (HCURSOR) old;
}
@@ -447,9 +449,11 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
prc = &cur_pdc->rc_output;
if (cur_pdc->surface != __gal_screen) {
if (fShow)
if (fShow) {
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
GAL_SyncUpdate (cur_pdc->surface);
}
}
else {
csrleft = boxleft();
@@ -463,9 +467,11 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
intbottom = (csrbottom < prc->bottom) ? csrbottom : prc->bottom;
if (intleft >= intright || inttop >= intbottom) {
if (fShow)
if (fShow) {
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
GAL_SyncUpdate (cur_pdc->surface);
}
return;
}
@@ -476,8 +482,10 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
hidecursor();
}
if (fShow)
if (fShow) {
GAL_UpdateRect (cur_pdc->surface, prc->left, prc->top, RECTWP(prc), RECTHP(prc));
GAL_SyncUpdate (cur_pdc->surface);
}
}
}
@@ -494,6 +502,7 @@ int GUIAPI ShowCursor (BOOL fShow)
hidecursor();
}
GAL_SyncUpdate (__gal_screen);
return nShowCount;
}

View File

@@ -446,13 +446,17 @@ HCURSOR GUIAPI SetCursorEx (HCURSOR hcsr, BOOL setdef)
pcsr = (PCURSOR)hcsr;
if (nShowCount >= 0 && pCurCsr)
if (nShowCount >= 0 && pCurCsr) {
hidecursor();
GAL_SyncUpdate (__gal_screen);
}
pCurCsr = pcsr;
if (nShowCount >= 0 && pCurCsr)
if (nShowCount >= 0 && pCurCsr) {
showcursor();
GAL_SyncUpdate (__gal_screen);
}
pthread_mutex_unlock(&__mg_mouselock);
pthread_mutex_unlock(&__mg_gdilock);
@@ -472,6 +476,7 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
if (fShow) {
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
GAL_SyncUpdate (cur_pdc->surface);
}
}
else {
@@ -508,6 +513,8 @@ void kernel_ShowCursorForGDI (BOOL fShow, void *pdc)
GAL_UpdateRect (cur_pdc->surface,
prc->left, prc->top, RECTWP(prc), RECTHP(prc));
pthread_mutex_unlock(&__mg_mouselock);
GAL_SyncUpdate (__gal_screen);
}
}
}
@@ -519,15 +526,19 @@ int GUIAPI ShowCursor(BOOL fShow)
pthread_mutex_lock (&__mg_gdilock);
pthread_mutex_lock (&__mg_mouselock);
if(fShow) {
if (fShow) {
nShowCount++;
if (nShowCount == 0 && pCurCsr)
if (nShowCount == 0 && pCurCsr) {
showcursor();
GAL_SyncUpdate (__gal_screen);
}
}
else {
nShowCount--;
if (nShowCount == -1 && pCurCsr)
if (nShowCount == -1 && pCurCsr) {
hidecursor();
GAL_SyncUpdate (__gal_screen);
}
}
count = nShowCount;
@@ -556,7 +567,6 @@ void kernel_ShowCursorForGDI (BOOL fShow, void* pdc)
BOOL mg_InitCursor (void)
{
__mg_cursor_x=0, __mg_cursor_y=0;
oldx = -1, oldy=-1;
memset(&cliprc,0,sizeof(RECT));
@@ -589,9 +599,10 @@ BOOL kernel_RefreshCursor(int* x, int* y, int* button)
*button = IAL_GetMouseButton ();
if (oldx != __mg_cursor_x || oldy != __mg_cursor_y) {
#ifdef _MGHAVE_CURSOR
if(nShowCount >= 0 && pCurCsr) {
if (nShowCount >= 0 && pCurCsr) {
hidecursor();
showcursor();
GAL_SyncUpdate (__gal_screen);
}
#endif
oldx = __mg_cursor_x;
@@ -630,6 +641,7 @@ void GUIAPI SetCursorPos(int x, int y)
if(nShowCount >= 0 && pCurCsr) {
hidecursor();
showcursor();
GAL_SyncUpdate (__gal_screen);
}
#endif
oldx = __mg_cursor_x;

View File

@@ -1324,6 +1324,7 @@ static int dskStartDragWindow (PMAINWIN pWin, const DRAGINFO* drag_info)
SetPenColor (HDC_SCREEN_SYS, PIXEL_lightwhite);
FocusRect (HDC_SCREEN_SYS, _dd_info.rc.left, _dd_info.rc.top,
_dd_info.rc.right, _dd_info.rc.bottom);
SyncUpdateDC (HDC_SCREEN_SYS);
return 0;
}
@@ -1352,6 +1353,7 @@ static int do_drag_drop_window (UINT msg, int x, int y)
SetPenColor (HDC_SCREEN_SYS, PIXEL_lightwhite);
FocusRect (HDC_SCREEN_SYS, _dd_info.rc.left, _dd_info.rc.top,
_dd_info.rc.right, _dd_info.rc.bottom);
SyncUpdateDC (HDC_SCREEN_SYS);
switch (_dd_info.location) {
case HT_CAPTION:
@@ -1403,6 +1405,7 @@ static int do_drag_drop_window (UINT msg, int x, int y)
FocusRect (HDC_SCREEN_SYS, _dd_info.rc.left, _dd_info.rc.top,
_dd_info.rc.right, _dd_info.rc.bottom);
SyncUpdateDC (HDC_SCREEN_SYS);
_dd_info.last_x = x;
_dd_info.last_y = y;
@@ -1413,6 +1416,7 @@ static int do_drag_drop_window (UINT msg, int x, int y)
SetPenColor (HDC_SCREEN_SYS, PIXEL_lightwhite);
FocusRect (HDC_SCREEN_SYS, _dd_info.rc.left, _dd_info.rc.top,
_dd_info.rc.right, _dd_info.rc.bottom);
SyncUpdateDC (HDC_SCREEN_SYS);
/* post MSG_WINDOWDROPPED to the target window */
SendNotifyMessage (_dd_info.hwnd, MSG_WINDOWDROPPED,

View File

@@ -2187,7 +2187,6 @@ static int AllocZOrderNodeEx (ZORDERINFO* zi, int cli, HWND hwnd, HWND main_win,
}
#else
nodes[free_slot].caption = strdup (caption);
_MG_PRINTF("Caption of ZNODE: %s\n", caption);
#endif
}
else {
@@ -3620,6 +3619,7 @@ static int dskMoveWindow (int cli, int idx_znode, HDC memdc, const RECT* rcWin)
MIN (RECTWP (rcWin), RECTW (rcOld)),
MIN (RECTHP (rcWin), RECTH (rcOld)),
HDC_SCREEN_SYS, rcWin->left, rcWin->top, 0);
SyncUpdateDC (HDC_SCREEN_SYS);
/* Restore the clip region of HDC_SCREEN_SYS */
SelectClipRect (HDC_SCREEN_SYS, &rcScr);
@@ -3794,6 +3794,7 @@ def_paint_desktop (void* context, HDC dc_desktop, const RECT* inv_rc)
bg_bmp->bmWidth, bg_bmp->bmHeight, bg_bmp);
}
SyncUpdateDC (dc_desktop);
}
static void def_keyboard_handler(void* context, int message,