From 09be9d0d1405fd71d5bf815885934393f0613854 Mon Sep 17 00:00:00 2001 From: Stephane Lussier Date: Fri, 28 Jul 2000 22:21:19 +0000 Subject: [PATCH] Now the service thread is no more in charge of erasing the background of the Window. Service thread is doing the invalidation part, and the application thread is doing the erasing part. All this has been implemented using WM_SYNCPAINT message. --- windows/defwnd.c | 8 ++++++++ windows/x11drv/event.c | 43 +++++++++++++++++++++++++++++++----------- 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/windows/defwnd.c b/windows/defwnd.c index a1bc1f9b3f1..42cc47a17b9 100644 --- a/windows/defwnd.c +++ b/windows/defwnd.c @@ -303,6 +303,14 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT msg, WPARAM wParam, return 0; } + case WM_SYNCPAINT: + if (wndPtr->hrgnUpdate) + { + RedrawWindow ( wndPtr->hwndSelf, 0, wndPtr->hrgnUpdate, + RDW_ERASENOW | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); + } + return 0; + case WM_SETREDRAW: DEFWND_SetRedraw( wndPtr, wParam ); return 0; diff --git a/windows/x11drv/event.c b/windows/x11drv/event.c index e8511bec1ab..0c484f45440 100644 --- a/windows/x11drv/event.c +++ b/windows/x11drv/event.c @@ -629,18 +629,29 @@ WORD X11DRV_EVENT_XStateToKeyState( int state ) static void EVENT_Expose( HWND hWnd, XExposeEvent *event ) { RECT rect; + int offx = 0,offy = 0; WND *pWnd = WIN_FindWndPtr(hWnd); /* Make position relative to client area instead of window */ - rect.left = event->x - (pWnd? (pWnd->rectClient.left - pWnd->rectWindow.left) : 0); - rect.top = event->y - (pWnd? (pWnd->rectClient.top - pWnd->rectWindow.top) : 0); + offx = (pWnd? (pWnd->rectClient.left - pWnd->rectWindow.left) : 0); + offy = (pWnd? (pWnd->rectClient.top - pWnd->rectWindow.top) : 0); + + rect.left = event->x - offx; + rect.top = event->y - offy; + rect.right = rect.left + event->width; rect.bottom = rect.top + event->height; + WIN_ReleaseWndPtr(pWnd); Callout.RedrawWindow( hWnd, &rect, 0, - RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE | - (event->count ? 0 : RDW_ERASENOW) ); + RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN | RDW_ERASE ); + + /* FIXME: We should use SendNotifyMessage here, but this function is not + implemented correctly, so for now we used SendMessage */ + /*SendNotifyMessageA(hWnd,WM_SYNCPAINT, 0, 0);*/ + if (event->count == 0) + SendMessageA(hWnd,WM_SYNCPAINT, 0, 0); } @@ -653,19 +664,29 @@ static void EVENT_Expose( HWND hWnd, XExposeEvent *event ) static void EVENT_GraphicsExpose( HWND hWnd, XGraphicsExposeEvent *event ) { RECT rect; + int offx = 0,offy = 0; + WND *pWnd = WIN_FindWndPtr(hWnd); - /* Make position relative to client area instead of window */ - rect.left = event->x - (pWnd? (pWnd->rectClient.left - pWnd->rectWindow.left) : 0); - rect.top = event->y - (pWnd? (pWnd->rectClient.top - pWnd->rectWindow.top) : 0); + offx = (pWnd? (pWnd->rectClient.left - pWnd->rectWindow.left) : 0); + offy = (pWnd? (pWnd->rectClient.top - pWnd->rectWindow.top) : 0); + + rect.left = event->x - offx; + rect.top = event->y - offy; + rect.right = rect.left + event->width; rect.bottom = rect.top + event->height; - + WIN_ReleaseWndPtr(pWnd); - + Callout.RedrawWindow( hWnd, &rect, 0, - RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE | - (event->count ? 0 : RDW_ERASENOW) ); + RDW_INVALIDATE | RDW_ALLCHILDREN | RDW_ERASE ); + + /* FIXME: We should use SendNotifyMessage here, but this function is not + implemented correctly, so for now we used SendMessage */ + /*SendNotifyMessageA(hWnd,WM_SYNCPAINT, 0, 0);*/ + if (event->count == 0) + SendMessageA(hWnd,WM_SYNCPAINT, 0, 0); }