From d886171d244e2c245128a15b363e53471ba1f8c8 Mon Sep 17 00:00:00 2001 From: "Jerry.Kirk%Nexwarecorp.com" Date: Tue, 21 Sep 1999 13:12:00 +0000 Subject: [PATCH] Adding more debug and hacks for Photon UI to try to get drawing of the preference dialog working. git-svn-id: svn://10.0.0.236/trunk@48568 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/widget/src/photon/nsLookAndFeel.cpp | 5 +- mozilla/widget/src/photon/nsLookAndFeel.h | 4 +- mozilla/widget/src/photon/nsScrollbar.cpp | 67 ++------ mozilla/widget/src/photon/nsScrollbar.h | 6 +- mozilla/widget/src/photon/nsWidget.cpp | 170 ++++++++++++-------- mozilla/widget/src/photon/nsWidget.h | 2 +- mozilla/widget/src/photon/nsWindow.cpp | 88 +++++----- 7 files changed, 172 insertions(+), 170 deletions(-) diff --git a/mozilla/widget/src/photon/nsLookAndFeel.cpp b/mozilla/widget/src/photon/nsLookAndFeel.cpp index ce90052b685..ffc4d82acbf 100644 --- a/mozilla/widget/src/photon/nsLookAndFeel.cpp +++ b/mozilla/widget/src/photon/nsLookAndFeel.cpp @@ -21,8 +21,7 @@ #include "nsFont.h" #include "nsPhWidgetLog.h" -NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); -NS_IMPL_ISUPPORTS(nsLookAndFeel,kILookAndFeelIID); +NS_IMPL_ISUPPORTS1(nsLookAndFeel, nsILookAndFeel) nsLookAndFeel::nsLookAndFeel() : nsILookAndFeel() { @@ -39,7 +38,7 @@ NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor) { nsresult res = NS_OK; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsLookAndFeel::GetColor mRefCnt=<%d>\n", mRefCnt)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsLookAndFeel::GetColor this=<%p> mRefCnt=<%d>\n", this, mRefCnt)); switch( aID ) { diff --git a/mozilla/widget/src/photon/nsLookAndFeel.h b/mozilla/widget/src/photon/nsLookAndFeel.h index 00319a973a6..900358f1f39 100644 --- a/mozilla/widget/src/photon/nsLookAndFeel.h +++ b/mozilla/widget/src/photon/nsLookAndFeel.h @@ -21,12 +21,12 @@ #include "nsILookAndFeel.h" class nsLookAndFeel: public nsILookAndFeel { + NS_DECL_ISUPPORTS + public: nsLookAndFeel(); virtual ~nsLookAndFeel(); - NS_DECL_ISUPPORTS - NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor); NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric); NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric); diff --git a/mozilla/widget/src/photon/nsScrollbar.cpp b/mozilla/widget/src/photon/nsScrollbar.cpp index 16ba583f4c7..4d03b7aa417 100644 --- a/mozilla/widget/src/photon/nsScrollbar.cpp +++ b/mozilla/widget/src/photon/nsScrollbar.cpp @@ -25,8 +25,9 @@ #include "nsUnitConversion.h" -NS_IMPL_ADDREF (nsScrollbar); -NS_IMPL_RELEASE (nsScrollbar); +NS_IMPL_ADDREF_INHERITED(nsScrollbar, nsWidget) +NS_IMPL_RELEASE_INHERITED(nsScrollbar, nsWidget) +NS_IMPL_QUERY_INTERFACE2(nsScrollbar, nsIScrollbar, nsIWidget) //------------------------------------------------------------------------- // @@ -47,7 +48,7 @@ nsScrollbar::nsScrollbar (PRBool aIsVertical):nsWidget (), nsIScrollbar () //------------------------------------------------------------------------- nsScrollbar::~nsScrollbar () { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::~nsScrollbar - Not Implemented.\n")); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::~nsScrollbar\n")); } //------------------------------------------------------------------------- @@ -62,12 +63,13 @@ NS_METHOD nsScrollbar::CreateNative (PtWidget_t * parentWindow) PhDim_t dim; PtArg_t arg[5]; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::CreateNative\n")); - pos.x = mBounds.x; pos.y = mBounds.y; dim.w = mBounds.width; dim.h = mBounds.height; + + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::CreateNative at (%d,%d) w,h=(%d,%d)\n", + mBounds.x, mBounds.y, mBounds.width, mBounds.height)); PtSetArg( &arg[0], Pt_ARG_ORIENTATION, mOrientation, 0 ); PtSetArg( &arg[1], Pt_ARG_POS, &pos, 0 ); @@ -84,25 +86,6 @@ NS_METHOD nsScrollbar::CreateNative (PtWidget_t * parentWindow) return res; } -//------------------------------------------------------------------------- -// -// Query interface implementation -// -//------------------------------------------------------------------------- -nsresult nsScrollbar::QueryInterface (const nsIID & aIID, void **aInstancePtr) -{ - nsresult result = nsWidget::QueryInterface(aIID, aInstancePtr); - - static NS_DEFINE_IID(kInsScrollbarIID, NS_ISCROLLBAR_IID); - if (result == NS_NOINTERFACE && aIID.Equals(kInsScrollbarIID)) { - *aInstancePtr = (void*) ((nsIScrollbar*)this); - NS_ADDREF_THIS(); - result = NS_OK; - } - - return result; -} - //------------------------------------------------------------------------- // // Define the range settings @@ -345,27 +328,6 @@ NS_METHOD nsScrollbar::SetParameters (PRUint32 aMaxRange, PRUint32 aThumbSize, return res; } - -//------------------------------------------------------------------------- -// -// paint message. Don't send the paint out -// -//------------------------------------------------------------------------- -PRBool nsScrollbar::OnPaint (nsPaintEvent & aEvent) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::OnPaint - Not Implemented\n")); - - return PR_FALSE; -} - - -PRBool nsScrollbar::OnResize(nsSizeEvent &aEvent) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::OnResize - Not Implemented\n")); - - return PR_FALSE; -} - //------------------------------------------------------------------------- // // Deal with scrollbar messages (actually implemented only in nsScrollbar) @@ -374,18 +336,9 @@ PRBool nsScrollbar::OnResize(nsSizeEvent &aEvent) PRBool nsScrollbar::OnScroll (nsScrollbarEvent & aEvent, PRUint32 cPos) { PRBool result = PR_TRUE; - float newPosition; +// float newPosition; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::OnScroll cPos=<%d>\n", cPos)); - -#if 0 - /* I should look at the theScrollbarCallback->action and do something */ - switch (aEvent.message) - { - default: - break; - } -#endif + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::OnScroll cPos=<%d> aEvent.message=<%d>\n", cPos, aEvent.message)); if (mEventCallback) { @@ -393,7 +346,7 @@ PRBool nsScrollbar::OnScroll (nsScrollbarEvent & aEvent, PRUint32 cPos) aEvent.position = cPos; result = ConvertStatus((*mEventCallback)(&aEvent)); - newPosition = aEvent.position; +// newPosition = aEvent.position; } else PR_LOG(PhWidLog, PR_LOG_ERROR, ("nsScrollbar::OnScroll Error no mEventCallback defined\n")); diff --git a/mozilla/widget/src/photon/nsScrollbar.h b/mozilla/widget/src/photon/nsScrollbar.h index 2cb61f24991..5a123d6c7f4 100644 --- a/mozilla/widget/src/photon/nsScrollbar.h +++ b/mozilla/widget/src/photon/nsScrollbar.h @@ -35,9 +35,7 @@ public: virtual ~nsScrollbar(); // nsISupports - NS_IMETHOD_(nsrefcnt) AddRef(); - NS_IMETHOD_(nsrefcnt) Release(); - NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); + NS_DECL_ISUPPORTS_INHERITED // nsIScrollBar implementation NS_IMETHOD SetMaxRange(PRUint32 aEndRange); @@ -52,9 +50,7 @@ public: PRUint32 aPosition, PRUint32 aLineIncrement); - virtual PRBool OnPaint(nsPaintEvent & aEvent); virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos); - virtual PRBool OnResize(nsSizeEvent &aEvent); protected: NS_IMETHOD CreateNative(PtWidget_t *parentWindow); diff --git a/mozilla/widget/src/photon/nsWidget.cpp b/mozilla/widget/src/photon/nsWidget.cpp index c2f935161a5..317c1fef2b6 100644 --- a/mozilla/widget/src/photon/nsWidget.cpp +++ b/mozilla/widget/src/photon/nsWidget.cpp @@ -39,7 +39,8 @@ static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID); nsILookAndFeel *nsWidget::sLookAndFeel = nsnull; PRUint32 nsWidget::sWidgetCount = 0; -//#define DBG 1 +/* Enable this to queue widget damage, this should be ON by default */ +#define ENABLE_DAMAGE_QUEUE DamageQueueEntry *nsWidget::mDmgQueue = nsnull; PtWorkProcId_t *nsWidget::mWorkProcID = nsnull; @@ -661,7 +662,7 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor) NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate %p\n", this )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate this=<%p> IsSynch=<%d>\n", this, aIsSynchronous)); if( mWidget ) { @@ -672,11 +673,12 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous) if( rect.width && rect.height ) { - /* Damage has to be releative Parent */ + /* Damage has to be relative Parent */ mUpdateArea.SetRect( rect.x - mBounds.x, rect.y - mBounds.y, rect.width, rect.height ); PR_LOG(PhWidLog, PR_LOG_DEBUG, (" rect=(%i,%i,%i,%i)\n", rect.x - mBounds.x, rect.y - mBounds.y, rect.width, rect.height )); +#ifdef ENABLE_DAMAGE_QUEUE if (aIsSynchronous) { UpdateWidgetDamage(); @@ -685,6 +687,9 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous) { QueueWidgetDamage(); } +#else + UpdateWidgetDamage(); +#endif } } else @@ -696,7 +701,7 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous) NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate %p (%ld,%ld,%ld,%ld)\n", this, aRect.x, aRect.y, aRect.width, aRect.height )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Invalidate this=<%p> rect=(%ld,%ld,%ld,%ld) IsSync=<%d>\n", this, aRect.x, aRect.y, aRect.width, aRect.height, aIsSynchronous )); if( mWidget ) { @@ -728,6 +733,7 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous) mUpdateArea.UnionRect( mUpdateArea, rect ); +#ifdef ENABLE_DAMAGE_QUEUE if( aIsSynchronous) { UpdateWidgetDamage(); @@ -736,6 +742,9 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous) { QueueWidgetDamage(); } +#else + UpdateWidgetDamage(); +#endif } } else @@ -850,7 +859,14 @@ NS_METHOD nsWidget::Update(void) { PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Update\n" )); - UpdateWidgetDamage(); +#if 0 + /* Force every widget and draw itself */ + if (mWidget) + PtDamageWidget(mWidget); +#else + /* if the widget has been invalidated or damaged then re-draw it */ + UpdateWidgetDamage(); +#endif return NS_OK; } @@ -1410,58 +1426,63 @@ nsWidget* nsWidget::GetInstance( PtWidget_t * pWidget ) // Input keysym is in gtk format; output is in NS_VK format -PRUint32 nsWidget::nsConvertKey(unsigned long keysym) +PRUint32 nsWidget::nsConvertKey(unsigned long keysym, PRBool *aIsChar ) { struct nsKeyConverter { PRUint32 vkCode; // Platform independent key code unsigned long keysym; // Photon key_sym key code + PRBool isChar; }; struct nsKeyConverter nsKeycodes[] = { - { NS_VK_CANCEL, Pk_Cancel }, - { NS_VK_BACK, Pk_BackSpace }, - { NS_VK_TAB, Pk_Tab }, - { NS_VK_CLEAR, Pk_Clear }, - { NS_VK_RETURN, Pk_Return }, - { NS_VK_SHIFT, Pk_Shift_L }, - { NS_VK_SHIFT, Pk_Shift_R }, - { NS_VK_CONTROL, Pk_Control_L }, - { NS_VK_CONTROL, Pk_Control_R }, - { NS_VK_ALT, Pk_Alt_L }, - { NS_VK_ALT, Pk_Alt_R }, - { NS_VK_PAUSE, Pk_Pause }, - { NS_VK_CAPS_LOCK, Pk_Caps_Lock }, - { NS_VK_ESCAPE, Pk_Escape }, - { NS_VK_SPACE, Pk_space }, - { NS_VK_PAGE_UP, Pk_Pg_Up }, - { NS_VK_PAGE_DOWN, Pk_Pg_Down }, - { NS_VK_END, Pk_End }, - { NS_VK_HOME, Pk_Home }, - { NS_VK_LEFT, Pk_Left }, - { NS_VK_UP, Pk_Up }, - { NS_VK_RIGHT, Pk_Right }, - { NS_VK_DOWN, Pk_Down }, - { NS_VK_PRINTSCREEN, Pk_Print }, - { NS_VK_INSERT, Pk_Insert }, - { NS_VK_DELETE, Pk_Delete }, - { NS_VK_MULTIPLY, Pk_KP_Multiply }, - { NS_VK_ADD, Pk_KP_Add }, - { NS_VK_SEPARATOR, Pk_KP_Separator }, - { NS_VK_SUBTRACT, Pk_KP_Subtract }, - { NS_VK_DECIMAL, Pk_KP_Decimal }, - { NS_VK_DIVIDE, Pk_KP_Divide }, - { NS_VK_RETURN, Pk_KP_Enter }, - { NS_VK_COMMA, Pk_comma }, - { NS_VK_PERIOD, Pk_period }, - { NS_VK_SLASH, Pk_slash }, - { NS_VK_OPEN_BRACKET, Pk_bracketleft }, - { NS_VK_CLOSE_BRACKET, Pk_bracketright }, - { NS_VK_QUOTE, Pk_quotedbl } + { NS_VK_CANCEL, Pk_Cancel, PR_FALSE }, + { NS_VK_BACK, Pk_BackSpace, PR_TRUE }, + { NS_VK_TAB, Pk_Tab, PR_TRUE }, + { NS_VK_CLEAR, Pk_Clear, PR_FALSE }, + { NS_VK_RETURN, Pk_Return, PR_TRUE }, + { NS_VK_SHIFT, Pk_Shift_L, PR_FALSE }, + { NS_VK_SHIFT, Pk_Shift_R, PR_FALSE }, + { NS_VK_CONTROL, Pk_Control_L, PR_FALSE }, + { NS_VK_CONTROL, Pk_Control_R, PR_FALSE }, + { NS_VK_ALT, Pk_Alt_L, PR_FALSE }, + { NS_VK_ALT, Pk_Alt_R, PR_FALSE }, + { NS_VK_PAUSE, Pk_Pause, PR_FALSE }, + { NS_VK_CAPS_LOCK, Pk_Caps_Lock, PR_FALSE }, + { NS_VK_ESCAPE, Pk_Escape, PR_FALSE }, + { NS_VK_SPACE, Pk_space, PR_TRUE }, + { NS_VK_PAGE_UP, Pk_Pg_Up, PR_FALSE }, + { NS_VK_PAGE_DOWN, Pk_Pg_Down, PR_FALSE }, + { NS_VK_END, Pk_End, PR_FALSE }, + { NS_VK_HOME, Pk_Home, PR_FALSE }, + { NS_VK_LEFT, Pk_Left, PR_FALSE }, + { NS_VK_UP, Pk_Up, PR_FALSE }, + { NS_VK_RIGHT, Pk_Right, PR_FALSE }, + { NS_VK_DOWN, Pk_Down, PR_FALSE }, + { NS_VK_PRINTSCREEN, Pk_Print, PR_FALSE }, + { NS_VK_INSERT, Pk_Insert, PR_FALSE }, + { NS_VK_DELETE, Pk_Delete, PR_FALSE }, + { NS_VK_MULTIPLY, Pk_KP_Multiply, PR_FALSE }, + { NS_VK_ADD, Pk_KP_Add, PR_FALSE }, + { NS_VK_SEPARATOR, Pk_KP_Separator, PR_FALSE }, + { NS_VK_SUBTRACT, Pk_KP_Subtract, PR_FALSE }, + { NS_VK_DECIMAL, Pk_KP_Decimal, PR_FALSE }, + { NS_VK_DIVIDE, Pk_KP_Divide, PR_FALSE }, + { NS_VK_RETURN, Pk_KP_Enter, PR_TRUE }, + { NS_VK_COMMA, Pk_comma, PR_TRUE }, + { NS_VK_PERIOD, Pk_period, PR_TRUE }, + { NS_VK_SLASH, Pk_slash, PR_TRUE }, + { NS_VK_OPEN_BRACKET, Pk_bracketleft, PR_TRUE }, + { NS_VK_CLOSE_BRACKET, Pk_bracketright, PR_TRUE }, + { NS_VK_QUOTE, Pk_quotedbl, PR_TRUE } }; const int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter); - + if (aIsChar) + { + *aIsChar = PR_TRUE; + } + // First, try to handle alphanumeric input, not listed in nsKeycodes: if (keysym >= Pk_a && keysym <= Pk_z) return keysym - Pk_a + NS_VK_A; @@ -1482,7 +1503,9 @@ PRUint32 nsWidget::nsConvertKey(unsigned long keysym) if (nsKeycodes[i].keysym == keysym) { printf("nsWidget::nsConvertKey - Converted <%x> to <%x>\n", keysym, nsKeycodes[i].vkCode); - return(nsKeycodes[i].vkCode); + if (aIsChar) + *aIsChar = (nsKeycodes[i].isChar); + return (nsKeycodes[i].vkCode); } } @@ -1505,13 +1528,24 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, if (aPhKeyEvent != nsnull) { - anEvent.keyCode = (nsConvertKey(aPhKeyEvent->key_cap) & 0x00FF); + PRBool IsChar; + + anEvent.keyCode = (nsConvertKey(aPhKeyEvent->key_cap, &IsChar) & 0x00FF); + if (aEventType == NS_KEY_PRESS) { - printf("nsWidget::InitKeyEvent key_sym=<%lu> converted=<%lu>\n", - aPhKeyEvent->key_sym, nsConvertKey(aPhKeyEvent->key_cap)); + printf("nsWidget::InitKeyEvent key_sym=<%lu> converted=<%lu> IsChar=<%d>\n", + aPhKeyEvent->key_sym, nsConvertKey(aPhKeyEvent->key_cap), IsChar); - anEvent.charCode = aPhKeyEvent->key_sym; + if (IsChar == PR_TRUE) + { + //anEvent.keyCode = 0; /* I think the spec says this should be 0 */ + anEvent.charCode = aPhKeyEvent->key_sym; + } + else + { + anEvent.charCode = 0; + } } else anEvent.charCode = 0; @@ -1528,8 +1562,6 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, PRBool nsWidget::DispatchKeyEvent(PhKeyEvent_t *aPhKeyEvent) { // PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::DispatchEvent Got a Key Event aPhEkyEvent->key_mods:<%x> aPhEkyEvent->key_flags:<%x> aPhEkyEvent->key_sym=<%x> aPhEkyEvent->key_caps=<%x>\n",aPhKeyEvent->key_mods, aPhKeyEvent->key_flags, aPhKeyEvent->key_sym, aPhKeyEvent->key_cap)); - static int counter=0; - NS_ASSERTION(aPhKeyEvent, "nsWidget::DispatchKeyEvent a NULL PhKeyEvent was passed in"); nsKeyEvent keyEvent; @@ -1561,23 +1593,20 @@ printf("nsWidget::DispatchKeyEvent KeyEvent Info: key_flags=<%lu> key_mods=<%lu> if (PkIsFirstDown(aPhKeyEvent->key_flags)) { + printf("nsWidget::DispatchKeyEvent Before Key Down \n"); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_DOWN); result = w->OnKey(keyEvent); - printf("nsWidget::DispatchKeyEvent Key Down counter=<%d>\n", counter++); -// if (aPhKeyEvent->key_cap < 0xF000) - { - InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS); - result = w->OnKey(keyEvent); - printf("nsWidget::DispatchKeyEvent Key Press counter=<%d>\n", counter++); - } + printf("nsWidget::DispatchKeyEvent Before Key Press\n"); + InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS); + result = w->OnKey(keyEvent); } else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0) { + printf("nsWidget::DispatchKeyEvent Before Key Up\n"); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_UP); result = w->OnKey(keyEvent); - printf("nsWidget::DispatchKeyEvent Key Up counter=<%d>\n", counter++); } printf("nsWidget::DispatchKeyEvent after events result=<%d>\n", result); @@ -1729,8 +1758,10 @@ void nsWidget::InitDamageQueue() mWorkProcID = PtAppAddWorkProc( nsnull, WorkProc, &mDmgQueue ); if( mWorkProcID ) { + int Global_Widget_Hold_Count; mDmgQueueInited = PR_TRUE; - PtHold(); + Global_Widget_Hold_Count = PtHold(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::InitDamageQueue PtHold Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); } else { @@ -1791,6 +1822,9 @@ void nsWidget::QueueWidgetDamage() //--------------------------------------------------------------------------- void nsWidget::UpdateWidgetDamage() { + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged mWidget=<%p> mUpdateArea=(%d,%d)\n", + mWidget, mUpdateArea.width, mUpdateArea.height )); + if( mWidget ) { RemoveDamagedWidget( mWidget ); @@ -1862,7 +1896,11 @@ void nsWidget::RemoveDamagedWidget(PtWidget_t *aWidget) if( nsnull == mDmgQueue ) { mDmgQueueInited = PR_FALSE; - PtRelease(); + + int Global_Widget_Hold_Count; + Global_Widget_Hold_Count = PtRelease(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::RemoveDamagedWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + if( mWorkProcID ) PtAppRemoveWorkProc( nsnull, mWorkProcID ); } @@ -1909,7 +1947,11 @@ int nsWidget::WorkProc( void *data ) *dq = nsnull; mDmgQueueInited = PR_FALSE; - PtRelease(); + + int Global_Widget_Hold_Count; + Global_Widget_Hold_Count = PtRelease(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::WorkProc PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, NULL)); + PtFlush(); } diff --git a/mozilla/widget/src/photon/nsWidget.h b/mozilla/widget/src/photon/nsWidget.h index c4b0e57ffb2..0979da8c54c 100644 --- a/mozilla/widget/src/photon/nsWidget.h +++ b/mozilla/widget/src/photon/nsWidget.h @@ -131,7 +131,7 @@ class nsWidget : public nsBaseWidget PRBool ConvertStatus(nsEventStatus aStatus); /* Convert Photon key codes to Mozilla key codes */ - PRUint32 nsConvertKey(unsigned long keysym); + PRUint32 nsConvertKey(unsigned long keysym, PRBool *aIsChar = nsnull); void InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, nsWidget *aWidget, nsKeyEvent &aKeyEvent, PRUint32 aEventType); diff --git a/mozilla/widget/src/photon/nsWindow.cpp b/mozilla/widget/src/photon/nsWindow.cpp index f97748c19ac..b7cb545392b 100644 --- a/mozilla/widget/src/photon/nsWindow.cpp +++ b/mozilla/widget/src/photon/nsWindow.cpp @@ -38,11 +38,8 @@ #include "nsIMenuItem.h" #include "nsIMenuListener.h" - -//static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); -//static NS_DEFINE_IID(kRenderingContextIID, NS_IRENDERING_CONTEXT_IID); -//static NS_DEFINE_IID(kRenderingContextPhIID, NS_IRENDERING_CONTEXT_PH_IID); - +/* Turn this on to disable Resize queueing */ +//#define DRAW_EVERYTHING PRBool nsWindow::mResizeQueueInited = PR_FALSE; DamageQueueEntry *nsWindow::mResizeQueue = nsnull; @@ -98,7 +95,6 @@ nsWindow::~nsWindow() PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::~nsWindow (%p) - Not Implemented.\n", this )); #if 1 - mIsDestroyingWindow = PR_TRUE; if ( (mWindowType == eWindowType_dialog) || @@ -679,6 +675,7 @@ PRBool nsWindow::OnPaint(nsPaintEvent &event) NS_METHOD nsWindow::BeginResizingChildren(void) { PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::BeginResizingChildren.\n")); + /* PtHold() */ return NS_OK; } @@ -732,7 +729,7 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) PtArg_t arg; PhDim_t dim = { aWidth, aHeight }; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow(%p)::Resize (%i,%i,%i)\n", this, aWidth, aHeight, aRepaint )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow(%p)::Resize w/h=(%i,%i) Repaint=<%i)\n", this, aWidth, aHeight, aRepaint )); mBounds.width = aWidth; mBounds.height = aHeight; @@ -752,11 +749,15 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) EnableDamage( mWidget, PR_TRUE ); - Invalidate( aRepaint ); +// kirk Hack, taking this out to see what happens! +// Invalidate( aRepaint ); if (aRepaint) { // REVISIT - Do nothing, resize handler will cause a redraw + + // Hack - Added this to see if it helps + Invalidate( aRepaint ); } } else @@ -765,20 +766,6 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) return NS_OK; } - -#if 0 -NS_METHOD nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, - PRInt32 aHeight, PRBool aRepaint) -{ - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::Resize Combination Resize and Move\n")); - - Resize(aWidth,aHeight,aRepaint); - Move(aX,aY); - return NS_OK; -} -#endif - - NS_METHOD nsWindow::SetMenuBar( nsIMenuBar * aMenuBar ) { nsresult res = NS_ERROR_FAILURE; @@ -1011,21 +998,25 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::RawDrawFunc for %p\n", pWin )); - if( !pWin ) + if ( !pWin ) { PR_LOG(PhWidLog, PR_LOG_DEBUG, (" aborted because instance is NULL!\n")); return; } -#if 1 - if( /*pWin->mCreateHold || pWin->mHold ||*/ pWin->mIsResizing ) +#ifndef DRAW_EVERYTHING +// This prevents redraws while any window is resizing, ie there are +// windows in the resize queue + + if ( /*pWin->mCreateHold || pWin->mHold ||*/ pWin->mIsResizing ) { PR_LOG(PhWidLog, PR_LOG_DEBUG, (" aborted due to hold-off!\n")); return; } + #endif - if( pWin->mEventCallback ) + if ( pWin->mEventCallback ) { PhRect_t rect; PhArea_t area; @@ -1071,7 +1062,9 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) pev.rect = &nsDmg; pev.eventStructType = NS_PAINT_EVENT; - PtHold(); + int Global_Widget_Hold_Count; + Global_Widget_Hold_Count = PtHold(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RawDrawFunc PtHold Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, pWin)); #if 1 // call the event callback @@ -1107,7 +1100,9 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage ) } #endif - PtRelease(); + Global_Widget_Hold_Count = PtRelease(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,(" nsWindow::RawDrawFunc PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, pWin)); + //Kirk took this out look at OnDrawSignal in GTK //NS_RELEASE(pev.widget); } @@ -1388,7 +1383,7 @@ int nsWindow::ResizeHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *c nsWindow *someWindow = (nsWindow *) GetInstance(widget); nsRect rect; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHandler for %p\n", someWindow )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHandler for someWindow=<%p>\n", someWindow)); if( someWindow ) { @@ -1397,16 +1392,16 @@ int nsWindow::ResizeHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *c rect.width = extents->lr.x - rect.x + 1; rect.height = extents->lr.y - rect.y + 1; - someWindow->ResizeHoldOff(); +#ifndef DRAW_EVERYTHING + /* This enables the resize holdoff */ +// someWindow->ResizeHoldOff(); +#endif someWindow->OnResize( rect ); } return( Pt_CONTINUE ); } - -//void nsWindow::StartResizeHoldOff( PtWidget_t *widget ) - void nsWindow::ResizeHoldOff() { if( !mWidget ) @@ -1414,8 +1409,12 @@ void nsWindow::ResizeHoldOff() return; } + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Entering this=<%p>\n", this )); + if( PR_FALSE == mResizeQueueInited ) { + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Initing Queue this=<%p>\n", this )); + // This is to guarantee that the Invalidation work-proc is in place prior to the // Resize work-proc. if( !mDmgQueueInited ) @@ -1425,9 +1424,12 @@ void nsWindow::ResizeHoldOff() PtWidget_t *top = PtFindDisjoint( mWidget ); - if(( mResizeProcID = PtAppAddWorkProc( nsnull, ResizeWorkProc, top )) != nsnull ) + if ( (mResizeProcID = PtAppAddWorkProc( nsnull, ResizeWorkProc, top )) != nsnull ) { - PtHold(); + int Global_Widget_Hold_Count; + Global_Widget_Hold_Count = PtHold(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::ResizeHoldOff PtHold Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + mResizeQueueInited = PR_TRUE; } else @@ -1447,6 +1449,8 @@ void nsWindow::ResizeHoldOff() { if( dqe->widget == mWidget ) { + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Widget already in Queue this=<%p>\n", this )); + found = PR_TRUE; break; } @@ -1458,12 +1462,13 @@ void nsWindow::ResizeHoldOff() dqe = new DamageQueueEntry; if( dqe ) { + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Adding widget to Queue this=<%p>\n", this )); + mIsResizing = PR_TRUE; dqe->widget = mWidget; dqe->inst = this; dqe->next = mResizeQueue; mResizeQueue = dqe; -// NS_ADDREF_THIS(); } } } @@ -1505,7 +1510,11 @@ void nsWindow::RemoveResizeWidget() { mResizeQueueInited = PR_FALSE; PtWidget_t *top = PtFindDisjoint( mWidget ); - PtRelease(); + + int Global_Widget_Hold_Count; + Global_Widget_Hold_Count = PtRelease(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::RemoveResizeWidget PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, this)); + if( mResizeProcID ) PtAppRemoveWorkProc( nsnull, mResizeProcID ); } @@ -1534,7 +1543,10 @@ int nsWindow::ResizeWorkProc( void *data ) nsWindow::mResizeQueue = nsnull; nsWindow::mResizeQueueInited = PR_FALSE; - PtRelease(); + int Global_Widget_Hold_Count; + Global_Widget_Hold_Count = PtRelease(); + PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWindow::ResizeWorkProc PtHold/PtRelease Global_Widget_Hold_Count=<%d> this=<%p>\n", Global_Widget_Hold_Count, dqe->widget)); + } return Pt_END; }