diff --git a/src/gui/window.c b/src/gui/window.c index 6a8dbe6b..f1fe91ed 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -5748,6 +5748,7 @@ HDC GUIAPI BeginPaint (HWND hWnd) void GUIAPI EndPaint (HWND hWnd, HDC hdc) { + BOOL synced = FALSE; PMAINWIN pWin; MG_CHECK (MG_IS_NORMAL_WINDOW(hWnd)); @@ -5761,6 +5762,8 @@ void GUIAPI EndPaint (HWND hWnd, HDC hdc) __mg_update_secondary_dc (pWin, hdc, real_dc, &pWin->pMainWin->update_rc, HT_CLIENT); ReleaseDC (real_dc); + SyncUpdateDC (real_dc); + synced = TRUE; } } @@ -5790,6 +5793,9 @@ void GUIAPI EndPaint (HWND hWnd, HDC hdc) ShowCaretEx (hWnd, FALSE); } #endif + + if (!synced) + SyncUpdateDC (hdc); } BOOL RegisterWindowClass (PWNDCLASS pWndClass) diff --git a/src/include/dc.h b/src/include/dc.h index 8e166e64..08f8f1cd 100644 --- a/src/include/dc.h +++ b/src/include/dc.h @@ -157,10 +157,11 @@ typedef BOOL (* CB_BITMAP_SCALER_FUNC )( /* Device Context */ struct tagDC { - short DataType; /* the data type, always be TYPE_HDC */ - short DCType; /* the dc type */ + unsigned char DataType; /* the data type, always be TYPE_HDC */ + unsigned char DCType; /* the dc type */ + unsigned char inuse; + unsigned char bIsClient; - BOOL inuse; HWND hwnd; /* surface of this DC */ @@ -258,7 +259,6 @@ struct tagDC CLIPRGN ecrgn; /* device rect */ - BOOL bIsClient; RECT DevRC; #ifndef _MGSCHEMA_COMPOSITING @@ -697,9 +697,8 @@ static inline void release_valid_dc (PMAINWIN pWin, HDC hdc) ReleaseSecondarySubDC (hdc); } else { - if (pWin->privCDC != hdc) { + if (pWin->privCDC != hdc) ReleaseDC (hdc); - } } } diff --git a/src/newgdi/gdi.c b/src/newgdi/gdi.c index ec2ba83d..06667511 100644 --- a/src/newgdi/gdi.c +++ b/src/newgdi/gdi.c @@ -2289,14 +2289,13 @@ void GUIAPI ReleaseDC (HDC hDC) pdc = dc_HDC2PDC(hDC); - if (pdc->alpha_pixel_format) { - GAL_FreeFormat (pdc->alpha_pixel_format); - pdc->alpha_pixel_format = NULL; + /* Call SyncUpdateDC at the end of EndPaint to elimiate flickers. + if (pdc->bIsClient) { + LOCK (&__mg_gdilock); + GAL_SyncUpdate (pdc->surface); + UNLOCK (&__mg_gdilock); } - - LOCK (&__mg_gdilock); - GAL_SyncUpdate (pdc->surface); - UNLOCK (&__mg_gdilock); + */ pWin = (PMAINWIN)(pdc->hwnd); if (pWin && pWin->privCDC == hDC) { @@ -2375,6 +2374,12 @@ void GUIAPI ReleaseDC (HDC hDC) #endif /* not defined _MGSCHEMA_COMPOSITING */ } else { + /* since 5.0.0, only free pixel format for dc from slots */ + if (pdc->alpha_pixel_format) { + GAL_FreeFormat (pdc->alpha_pixel_format); + pdc->alpha_pixel_format = NULL; + } + EmptyClipRgn (&pdc->lcrgn); MAKE_REGION_INFINITE(&pdc->lcrgn); EmptyClipRgn (&pdc->ecrgn);