From 533b497a4d4cdff270f65d52b1a93d2ef727b095 Mon Sep 17 00:00:00 2001 From: kmcclusk Date: Tue, 28 Apr 1998 19:24:52 +0000 Subject: [PATCH] Fixed textwidget refresh problem. Added AutoErase method to nsWindow.cpp, nsTextHelper.cpp and nsListBox.cpp git-svn-id: svn://10.0.0.236/trunk@785 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/windows/nsListBox.cpp | 11 +++++++++++ mozilla/widget/src/windows/nsListBox.h | 5 ++++- mozilla/widget/src/windows/nsTextHelper.cpp | 11 +++++++++++ mozilla/widget/src/windows/nsTextHelper.h | 4 ++-- mozilla/widget/src/windows/nsWindow.cpp | 16 ++++++++++++---- mozilla/widget/src/windows/nsWindow.h | 1 + mozilla/widget/tests/windows/winmain.cpp | 2 +- 7 files changed, 42 insertions(+), 8 deletions(-) diff --git a/mozilla/widget/src/windows/nsListBox.cpp b/mozilla/widget/src/windows/nsListBox.cpp index 7419d01669e..ac82f13afba 100644 --- a/mozilla/widget/src/windows/nsListBox.cpp +++ b/mozilla/widget/src/windows/nsListBox.cpp @@ -291,4 +291,15 @@ DWORD nsListBox::WindowExStyle() return 0; } +//------------------------------------------------------------------------- +// +// Clear window before paint +// +//------------------------------------------------------------------------- + +PRBool nsListBox::AutoErase() +{ + return(PR_TRUE); +} + diff --git a/mozilla/widget/src/windows/nsListBox.h b/mozilla/widget/src/windows/nsListBox.h index 564e2241bbd..308d01a0956 100644 --- a/mozilla/widget/src/windows/nsListBox.h +++ b/mozilla/widget/src/windows/nsListBox.h @@ -46,7 +46,7 @@ public: // nsIWidget interface BASE_IWIDGET_IMPL - // nsIListBox part + // nsIListBox interface void SetMultipleSelection(PRBool aMultipleSelections); void AddItemAt(nsString &aItem, PRInt32 aPosition); PRInt32 FindItem(nsString &aItem, PRInt32 aStartPos); @@ -61,6 +61,9 @@ public: void SelectItem(PRInt32 aPosition); void Deselect() ; virtual void PreCreateWidget(void *aInitData); + + // nsWindow interface + virtual PRBool AutoErase(); protected: PRBool mMultiSelect; virtual LPCTSTR WindowClass(); diff --git a/mozilla/widget/src/windows/nsTextHelper.cpp b/mozilla/widget/src/windows/nsTextHelper.cpp index e979f7aea41..0521e463993 100644 --- a/mozilla/widget/src/windows/nsTextHelper.cpp +++ b/mozilla/widget/src/windows/nsTextHelper.cpp @@ -168,4 +168,15 @@ DWORD nsTextHelper::WindowExStyle() return 0; } +//------------------------------------------------------------------------- +// +// Clear window before paint +// +//------------------------------------------------------------------------- + +PRBool nsTextHelper::AutoErase() +{ + return(PR_TRUE); +} + diff --git a/mozilla/widget/src/windows/nsTextHelper.h b/mozilla/widget/src/windows/nsTextHelper.h index 85ea1d2e08f..6c5c687afeb 100644 --- a/mozilla/widget/src/windows/nsTextHelper.h +++ b/mozilla/widget/src/windows/nsTextHelper.h @@ -47,8 +47,8 @@ public: virtual PRUint32 GetCaretPosition(); virtual LPCTSTR WindowClass(); virtual DWORD WindowStyle(); - - virtual void PreCreateWidget(void *aInitData); + virtual void PreCreateWidget(void *aInitData); + virtual PRBool AutoErase(); protected: diff --git a/mozilla/widget/src/windows/nsWindow.cpp b/mozilla/widget/src/windows/nsWindow.cpp index f6323e84b8d..ea2f15c000c 100644 --- a/mozilla/widget/src/windows/nsWindow.cpp +++ b/mozilla/widget/src/windows/nsWindow.cpp @@ -1078,10 +1078,13 @@ PRBool nsWindow::ProcessMessage(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT result = OnKey(NS_KEY_DOWN, wParam); break; - // say we've dealt with erase background - case WM_ERASEBKGND: - *aRetValue = 1; - result = PR_TRUE; + // say we've dealt with erase background if widget does + // not need auto-erasing + case WM_ERASEBKGND: + if (! AutoErase()) { + *aRetValue = 1; + result = PR_TRUE; + } break; case WM_MOUSEMOVE: @@ -1709,5 +1712,10 @@ void nsWindow::AddEventListener(nsIEventListener * aListener) mEventListener = aListener; } +PRBool nsWindow::AutoErase() +{ + return(PR_FALSE); +} + diff --git a/mozilla/widget/src/windows/nsWindow.h b/mozilla/widget/src/windows/nsWindow.h index a3641e5d269..7fb5f99061d 100644 --- a/mozilla/widget/src/windows/nsWindow.h +++ b/mozilla/widget/src/windows/nsWindow.h @@ -119,6 +119,7 @@ public: WNDPROC GetPrevWindowProc() { return mPrevWndProc; } virtual PRBool DispatchMouseEvent(PRUint32 aEventType); + virtual PRBool AutoErase(); protected: diff --git a/mozilla/widget/tests/windows/winmain.cpp b/mozilla/widget/tests/windows/winmain.cpp index 939eb1029d5..78ddff36fe0 100644 --- a/mozilla/widget/tests/windows/winmain.cpp +++ b/mozilla/widget/tests/windows/winmain.cpp @@ -77,7 +77,7 @@ char * gFailedMsg = NULL; #define WIDGET_DLL "raptorwidget.dll" #define GFXWIN_DLL "raptorgfxwin.dll" -#define DEBUG_MOUSE 1 +#define DEBUG_MOUSE 0 #define NUM_COMBOBOX_ITEMS 8 #define kSetCaret "Set Caret"