Adding more debug and hacks for Photon UI to try to get drawing of

the preference dialog working.
This commit is contained in:
Jerry.Kirk%Nexwarecorp.com 1999-09-21 13:12:00 +00:00
Родитель 55dd5c3658
Коммит 3689b9be81
7 изменённых файлов: 172 добавлений и 170 удалений

Просмотреть файл

@ -21,8 +21,7 @@
#include "nsFont.h" #include "nsFont.h"
#include "nsPhWidgetLog.h" #include "nsPhWidgetLog.h"
NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID); NS_IMPL_ISUPPORTS1(nsLookAndFeel, nsILookAndFeel)
NS_IMPL_ISUPPORTS(nsLookAndFeel,kILookAndFeelIID);
nsLookAndFeel::nsLookAndFeel() : nsILookAndFeel() nsLookAndFeel::nsLookAndFeel() : nsILookAndFeel()
{ {
@ -39,7 +38,7 @@ NS_IMETHODIMP nsLookAndFeel::GetColor(const nsColorID aID, nscolor &aColor)
{ {
nsresult res = NS_OK; 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 ) switch( aID )
{ {

Просмотреть файл

@ -21,12 +21,12 @@
#include "nsILookAndFeel.h" #include "nsILookAndFeel.h"
class nsLookAndFeel: public nsILookAndFeel { class nsLookAndFeel: public nsILookAndFeel {
NS_DECL_ISUPPORTS
public: public:
nsLookAndFeel(); nsLookAndFeel();
virtual ~nsLookAndFeel(); virtual ~nsLookAndFeel();
NS_DECL_ISUPPORTS
NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor); NS_IMETHOD GetColor(const nsColorID aID, nscolor &aColor);
NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric); NS_IMETHOD GetMetric(const nsMetricID aID, PRInt32 & aMetric);
NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric); NS_IMETHOD GetMetric(const nsMetricFloatID aID, float & aMetric);

Просмотреть файл

@ -25,8 +25,9 @@
#include "nsUnitConversion.h" #include "nsUnitConversion.h"
NS_IMPL_ADDREF (nsScrollbar); NS_IMPL_ADDREF_INHERITED(nsScrollbar, nsWidget)
NS_IMPL_RELEASE (nsScrollbar); 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 () 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; PhDim_t dim;
PtArg_t arg[5]; PtArg_t arg[5];
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::CreateNative\n"));
pos.x = mBounds.x; pos.x = mBounds.x;
pos.y = mBounds.y; pos.y = mBounds.y;
dim.w = mBounds.width; dim.w = mBounds.width;
dim.h = mBounds.height; 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[0], Pt_ARG_ORIENTATION, mOrientation, 0 );
PtSetArg( &arg[1], Pt_ARG_POS, &pos, 0 ); PtSetArg( &arg[1], Pt_ARG_POS, &pos, 0 );
@ -84,25 +86,6 @@ NS_METHOD nsScrollbar::CreateNative (PtWidget_t * parentWindow)
return res; 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 // Define the range settings
@ -345,27 +328,6 @@ NS_METHOD nsScrollbar::SetParameters (PRUint32 aMaxRange, PRUint32 aThumbSize,
return res; 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) // 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 nsScrollbar::OnScroll (nsScrollbarEvent & aEvent, PRUint32 cPos)
{ {
PRBool result = PR_TRUE; PRBool result = PR_TRUE;
float newPosition; // float newPosition;
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::OnScroll cPos=<%d>\n", cPos)); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsScrollbar::OnScroll cPos=<%d> aEvent.message=<%d>\n", cPos, aEvent.message));
#if 0
/* I should look at the theScrollbarCallback->action and do something */
switch (aEvent.message)
{
default:
break;
}
#endif
if (mEventCallback) if (mEventCallback)
{ {
@ -393,7 +346,7 @@ PRBool nsScrollbar::OnScroll (nsScrollbarEvent & aEvent, PRUint32 cPos)
aEvent.position = cPos; aEvent.position = cPos;
result = ConvertStatus((*mEventCallback)(&aEvent)); result = ConvertStatus((*mEventCallback)(&aEvent));
newPosition = aEvent.position; // newPosition = aEvent.position;
} }
else else
PR_LOG(PhWidLog, PR_LOG_ERROR, ("nsScrollbar::OnScroll Error no mEventCallback defined\n")); PR_LOG(PhWidLog, PR_LOG_ERROR, ("nsScrollbar::OnScroll Error no mEventCallback defined\n"));

Просмотреть файл

@ -35,9 +35,7 @@ public:
virtual ~nsScrollbar(); virtual ~nsScrollbar();
// nsISupports // nsISupports
NS_IMETHOD_(nsrefcnt) AddRef(); NS_DECL_ISUPPORTS_INHERITED
NS_IMETHOD_(nsrefcnt) Release();
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr);
// nsIScrollBar implementation // nsIScrollBar implementation
NS_IMETHOD SetMaxRange(PRUint32 aEndRange); NS_IMETHOD SetMaxRange(PRUint32 aEndRange);
@ -52,9 +50,7 @@ public:
PRUint32 aPosition, PRUint32 aLineIncrement); PRUint32 aPosition, PRUint32 aLineIncrement);
virtual PRBool OnPaint(nsPaintEvent & aEvent);
virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos); virtual PRBool OnScroll(nsScrollbarEvent & aEvent, PRUint32 cPos);
virtual PRBool OnResize(nsSizeEvent &aEvent);
protected: protected:
NS_IMETHOD CreateNative(PtWidget_t *parentWindow); NS_IMETHOD CreateNative(PtWidget_t *parentWindow);

Просмотреть файл

@ -39,7 +39,8 @@ static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
nsILookAndFeel *nsWidget::sLookAndFeel = nsnull; nsILookAndFeel *nsWidget::sLookAndFeel = nsnull;
PRUint32 nsWidget::sWidgetCount = 0; 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; DamageQueueEntry *nsWidget::mDmgQueue = nsnull;
PtWorkProcId_t *nsWidget::mWorkProcID = nsnull; PtWorkProcId_t *nsWidget::mWorkProcID = nsnull;
@ -661,7 +662,7 @@ NS_METHOD nsWidget::SetCursor(nsCursor aCursor)
NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous) 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 ) if( mWidget )
{ {
@ -672,11 +673,12 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous)
if( rect.width && rect.height ) 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 ); 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 )); 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) if (aIsSynchronous)
{ {
UpdateWidgetDamage(); UpdateWidgetDamage();
@ -685,6 +687,9 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous)
{ {
QueueWidgetDamage(); QueueWidgetDamage();
} }
#else
UpdateWidgetDamage();
#endif
} }
} }
else else
@ -696,7 +701,7 @@ NS_METHOD nsWidget::Invalidate(PRBool aIsSynchronous)
NS_METHOD nsWidget::Invalidate(const nsRect & aRect, 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 ) if( mWidget )
{ {
@ -728,6 +733,7 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
mUpdateArea.UnionRect( mUpdateArea, rect ); mUpdateArea.UnionRect( mUpdateArea, rect );
#ifdef ENABLE_DAMAGE_QUEUE
if( aIsSynchronous) if( aIsSynchronous)
{ {
UpdateWidgetDamage(); UpdateWidgetDamage();
@ -736,6 +742,9 @@ NS_METHOD nsWidget::Invalidate(const nsRect & aRect, PRBool aIsSynchronous)
{ {
QueueWidgetDamage(); QueueWidgetDamage();
} }
#else
UpdateWidgetDamage();
#endif
} }
} }
else else
@ -850,7 +859,14 @@ NS_METHOD nsWidget::Update(void)
{ {
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Update\n" )); 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; 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 // 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 { struct nsKeyConverter {
PRUint32 vkCode; // Platform independent key code PRUint32 vkCode; // Platform independent key code
unsigned long keysym; // Photon key_sym key code unsigned long keysym; // Photon key_sym key code
PRBool isChar;
}; };
struct nsKeyConverter nsKeycodes[] = { struct nsKeyConverter nsKeycodes[] = {
{ NS_VK_CANCEL, Pk_Cancel }, { NS_VK_CANCEL, Pk_Cancel, PR_FALSE },
{ NS_VK_BACK, Pk_BackSpace }, { NS_VK_BACK, Pk_BackSpace, PR_TRUE },
{ NS_VK_TAB, Pk_Tab }, { NS_VK_TAB, Pk_Tab, PR_TRUE },
{ NS_VK_CLEAR, Pk_Clear }, { NS_VK_CLEAR, Pk_Clear, PR_FALSE },
{ NS_VK_RETURN, Pk_Return }, { NS_VK_RETURN, Pk_Return, PR_TRUE },
{ NS_VK_SHIFT, Pk_Shift_L }, { NS_VK_SHIFT, Pk_Shift_L, PR_FALSE },
{ NS_VK_SHIFT, Pk_Shift_R }, { NS_VK_SHIFT, Pk_Shift_R, PR_FALSE },
{ NS_VK_CONTROL, Pk_Control_L }, { NS_VK_CONTROL, Pk_Control_L, PR_FALSE },
{ NS_VK_CONTROL, Pk_Control_R }, { NS_VK_CONTROL, Pk_Control_R, PR_FALSE },
{ NS_VK_ALT, Pk_Alt_L }, { NS_VK_ALT, Pk_Alt_L, PR_FALSE },
{ NS_VK_ALT, Pk_Alt_R }, { NS_VK_ALT, Pk_Alt_R, PR_FALSE },
{ NS_VK_PAUSE, Pk_Pause }, { NS_VK_PAUSE, Pk_Pause, PR_FALSE },
{ NS_VK_CAPS_LOCK, Pk_Caps_Lock }, { NS_VK_CAPS_LOCK, Pk_Caps_Lock, PR_FALSE },
{ NS_VK_ESCAPE, Pk_Escape }, { NS_VK_ESCAPE, Pk_Escape, PR_FALSE },
{ NS_VK_SPACE, Pk_space }, { NS_VK_SPACE, Pk_space, PR_TRUE },
{ NS_VK_PAGE_UP, Pk_Pg_Up }, { NS_VK_PAGE_UP, Pk_Pg_Up, PR_FALSE },
{ NS_VK_PAGE_DOWN, Pk_Pg_Down }, { NS_VK_PAGE_DOWN, Pk_Pg_Down, PR_FALSE },
{ NS_VK_END, Pk_End }, { NS_VK_END, Pk_End, PR_FALSE },
{ NS_VK_HOME, Pk_Home }, { NS_VK_HOME, Pk_Home, PR_FALSE },
{ NS_VK_LEFT, Pk_Left }, { NS_VK_LEFT, Pk_Left, PR_FALSE },
{ NS_VK_UP, Pk_Up }, { NS_VK_UP, Pk_Up, PR_FALSE },
{ NS_VK_RIGHT, Pk_Right }, { NS_VK_RIGHT, Pk_Right, PR_FALSE },
{ NS_VK_DOWN, Pk_Down }, { NS_VK_DOWN, Pk_Down, PR_FALSE },
{ NS_VK_PRINTSCREEN, Pk_Print }, { NS_VK_PRINTSCREEN, Pk_Print, PR_FALSE },
{ NS_VK_INSERT, Pk_Insert }, { NS_VK_INSERT, Pk_Insert, PR_FALSE },
{ NS_VK_DELETE, Pk_Delete }, { NS_VK_DELETE, Pk_Delete, PR_FALSE },
{ NS_VK_MULTIPLY, Pk_KP_Multiply }, { NS_VK_MULTIPLY, Pk_KP_Multiply, PR_FALSE },
{ NS_VK_ADD, Pk_KP_Add }, { NS_VK_ADD, Pk_KP_Add, PR_FALSE },
{ NS_VK_SEPARATOR, Pk_KP_Separator }, { NS_VK_SEPARATOR, Pk_KP_Separator, PR_FALSE },
{ NS_VK_SUBTRACT, Pk_KP_Subtract }, { NS_VK_SUBTRACT, Pk_KP_Subtract, PR_FALSE },
{ NS_VK_DECIMAL, Pk_KP_Decimal }, { NS_VK_DECIMAL, Pk_KP_Decimal, PR_FALSE },
{ NS_VK_DIVIDE, Pk_KP_Divide }, { NS_VK_DIVIDE, Pk_KP_Divide, PR_FALSE },
{ NS_VK_RETURN, Pk_KP_Enter }, { NS_VK_RETURN, Pk_KP_Enter, PR_TRUE },
{ NS_VK_COMMA, Pk_comma }, { NS_VK_COMMA, Pk_comma, PR_TRUE },
{ NS_VK_PERIOD, Pk_period }, { NS_VK_PERIOD, Pk_period, PR_TRUE },
{ NS_VK_SLASH, Pk_slash }, { NS_VK_SLASH, Pk_slash, PR_TRUE },
{ NS_VK_OPEN_BRACKET, Pk_bracketleft }, { NS_VK_OPEN_BRACKET, Pk_bracketleft, PR_TRUE },
{ NS_VK_CLOSE_BRACKET, Pk_bracketright }, { NS_VK_CLOSE_BRACKET, Pk_bracketright, PR_TRUE },
{ NS_VK_QUOTE, Pk_quotedbl } { NS_VK_QUOTE, Pk_quotedbl, PR_TRUE }
}; };
const int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter); const int length = sizeof(nsKeycodes) / sizeof(struct nsKeyConverter);
if (aIsChar)
{
*aIsChar = PR_TRUE;
}
// First, try to handle alphanumeric input, not listed in nsKeycodes: // First, try to handle alphanumeric input, not listed in nsKeycodes:
if (keysym >= Pk_a && keysym <= Pk_z) if (keysym >= Pk_a && keysym <= Pk_z)
return keysym - Pk_a + NS_VK_A; return keysym - Pk_a + NS_VK_A;
@ -1482,7 +1503,9 @@ PRUint32 nsWidget::nsConvertKey(unsigned long keysym)
if (nsKeycodes[i].keysym == keysym) if (nsKeycodes[i].keysym == keysym)
{ {
printf("nsWidget::nsConvertKey - Converted <%x> to <%x>\n", keysym, nsKeycodes[i].vkCode); 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) 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) if (aEventType == NS_KEY_PRESS)
{ {
printf("nsWidget::InitKeyEvent key_sym=<%lu> converted=<%lu>\n", printf("nsWidget::InitKeyEvent key_sym=<%lu> converted=<%lu> IsChar=<%d>\n",
aPhKeyEvent->key_sym, nsConvertKey(aPhKeyEvent->key_cap)); 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 else
anEvent.charCode = 0; anEvent.charCode = 0;
@ -1528,8 +1562,6 @@ void nsWidget::InitKeyEvent(PhKeyEvent_t *aPhKeyEvent,
PRBool nsWidget::DispatchKeyEvent(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)); // 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"); NS_ASSERTION(aPhKeyEvent, "nsWidget::DispatchKeyEvent a NULL PhKeyEvent was passed in");
nsKeyEvent keyEvent; nsKeyEvent keyEvent;
@ -1561,23 +1593,20 @@ printf("nsWidget::DispatchKeyEvent KeyEvent Info: key_flags=<%lu> key_mods=<%lu>
if (PkIsFirstDown(aPhKeyEvent->key_flags)) if (PkIsFirstDown(aPhKeyEvent->key_flags))
{ {
printf("nsWidget::DispatchKeyEvent Before Key Down \n");
InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_DOWN); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_DOWN);
result = w->OnKey(keyEvent); result = w->OnKey(keyEvent);
printf("nsWidget::DispatchKeyEvent Key Down counter=<%d>\n", counter++);
// if (aPhKeyEvent->key_cap < 0xF000) printf("nsWidget::DispatchKeyEvent Before Key Press\n");
{ InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS);
InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_PRESS); result = w->OnKey(keyEvent);
result = w->OnKey(keyEvent);
printf("nsWidget::DispatchKeyEvent Key Press counter=<%d>\n", counter++);
}
} }
else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0) else if (PkIsKeyDown(aPhKeyEvent->key_flags) == 0)
{ {
printf("nsWidget::DispatchKeyEvent Before Key Up\n");
InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_UP); InitKeyEvent(aPhKeyEvent, this, keyEvent, NS_KEY_UP);
result = w->OnKey(keyEvent); result = w->OnKey(keyEvent);
printf("nsWidget::DispatchKeyEvent Key Up counter=<%d>\n", counter++);
} }
printf("nsWidget::DispatchKeyEvent after events result=<%d>\n", result); printf("nsWidget::DispatchKeyEvent after events result=<%d>\n", result);
@ -1729,8 +1758,10 @@ void nsWidget::InitDamageQueue()
mWorkProcID = PtAppAddWorkProc( nsnull, WorkProc, &mDmgQueue ); mWorkProcID = PtAppAddWorkProc( nsnull, WorkProc, &mDmgQueue );
if( mWorkProcID ) if( mWorkProcID )
{ {
int Global_Widget_Hold_Count;
mDmgQueueInited = PR_TRUE; 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 else
{ {
@ -1791,6 +1822,9 @@ void nsWidget::QueueWidgetDamage()
//--------------------------------------------------------------------------- //---------------------------------------------------------------------------
void nsWidget::UpdateWidgetDamage() void nsWidget::UpdateWidgetDamage()
{ {
PR_LOG(PhWidLog, PR_LOG_DEBUG,("nsWidget::UpdateWidgetDamaged mWidget=<%p> mUpdateArea=(%d,%d)\n",
mWidget, mUpdateArea.width, mUpdateArea.height ));
if( mWidget ) if( mWidget )
{ {
RemoveDamagedWidget( mWidget ); RemoveDamagedWidget( mWidget );
@ -1862,7 +1896,11 @@ void nsWidget::RemoveDamagedWidget(PtWidget_t *aWidget)
if( nsnull == mDmgQueue ) if( nsnull == mDmgQueue )
{ {
mDmgQueueInited = PR_FALSE; 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 ) if( mWorkProcID )
PtAppRemoveWorkProc( nsnull, mWorkProcID ); PtAppRemoveWorkProc( nsnull, mWorkProcID );
} }
@ -1909,7 +1947,11 @@ int nsWidget::WorkProc( void *data )
*dq = nsnull; *dq = nsnull;
mDmgQueueInited = PR_FALSE; 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(); PtFlush();
} }

Просмотреть файл

@ -131,7 +131,7 @@ class nsWidget : public nsBaseWidget
PRBool ConvertStatus(nsEventStatus aStatus); PRBool ConvertStatus(nsEventStatus aStatus);
/* Convert Photon key codes to Mozilla key codes */ /* 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, void InitKeyEvent(PhKeyEvent_t *aPhKeyEvent, nsWidget *aWidget,
nsKeyEvent &aKeyEvent, PRUint32 aEventType); nsKeyEvent &aKeyEvent, PRUint32 aEventType);

Просмотреть файл

@ -38,11 +38,8 @@
#include "nsIMenuItem.h" #include "nsIMenuItem.h"
#include "nsIMenuListener.h" #include "nsIMenuListener.h"
/* Turn this on to disable Resize queueing */
//static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID); //#define DRAW_EVERYTHING
//static NS_DEFINE_IID(kRenderingContextIID, NS_IRENDERING_CONTEXT_IID);
//static NS_DEFINE_IID(kRenderingContextPhIID, NS_IRENDERING_CONTEXT_PH_IID);
PRBool nsWindow::mResizeQueueInited = PR_FALSE; PRBool nsWindow::mResizeQueueInited = PR_FALSE;
DamageQueueEntry *nsWindow::mResizeQueue = nsnull; DamageQueueEntry *nsWindow::mResizeQueue = nsnull;
@ -98,7 +95,6 @@ nsWindow::~nsWindow()
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::~nsWindow (%p) - Not Implemented.\n", this )); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::~nsWindow (%p) - Not Implemented.\n", this ));
#if 1 #if 1
mIsDestroyingWindow = PR_TRUE; mIsDestroyingWindow = PR_TRUE;
if ( (mWindowType == eWindowType_dialog) || if ( (mWindowType == eWindowType_dialog) ||
@ -679,6 +675,7 @@ PRBool nsWindow::OnPaint(nsPaintEvent &event)
NS_METHOD nsWindow::BeginResizingChildren(void) NS_METHOD nsWindow::BeginResizingChildren(void)
{ {
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::BeginResizingChildren.\n")); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::BeginResizingChildren.\n"));
/* PtHold() */
return NS_OK; return NS_OK;
} }
@ -732,7 +729,7 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
PtArg_t arg; PtArg_t arg;
PhDim_t dim = { aWidth, aHeight }; 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.width = aWidth;
mBounds.height = aHeight; mBounds.height = aHeight;
@ -752,11 +749,15 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
EnableDamage( mWidget, PR_TRUE ); EnableDamage( mWidget, PR_TRUE );
Invalidate( aRepaint ); // kirk Hack, taking this out to see what happens!
// Invalidate( aRepaint );
if (aRepaint) if (aRepaint)
{ {
// REVISIT - Do nothing, resize handler will cause a redraw // REVISIT - Do nothing, resize handler will cause a redraw
// Hack - Added this to see if it helps
Invalidate( aRepaint );
} }
} }
else else
@ -765,20 +766,6 @@ NS_METHOD nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint)
return NS_OK; 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 ) NS_METHOD nsWindow::SetMenuBar( nsIMenuBar * aMenuBar )
{ {
nsresult res = NS_ERROR_FAILURE; 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 )); 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")); PR_LOG(PhWidLog, PR_LOG_DEBUG, (" aborted because instance is NULL!\n"));
return; return;
} }
#if 1 #ifndef DRAW_EVERYTHING
if( /*pWin->mCreateHold || pWin->mHold ||*/ pWin->mIsResizing ) // 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")); PR_LOG(PhWidLog, PR_LOG_DEBUG, (" aborted due to hold-off!\n"));
return; return;
} }
#endif #endif
if( pWin->mEventCallback ) if ( pWin->mEventCallback )
{ {
PhRect_t rect; PhRect_t rect;
PhArea_t area; PhArea_t area;
@ -1071,7 +1062,9 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
pev.rect = &nsDmg; pev.rect = &nsDmg;
pev.eventStructType = NS_PAINT_EVENT; 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 #if 1
// call the event callback // call the event callback
@ -1107,7 +1100,9 @@ void nsWindow::RawDrawFunc( PtWidget_t * pWidget, PhTile_t * damage )
} }
#endif #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 //Kirk took this out look at OnDrawSignal in GTK
//NS_RELEASE(pev.widget); //NS_RELEASE(pev.widget);
} }
@ -1388,7 +1383,7 @@ int nsWindow::ResizeHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t *c
nsWindow *someWindow = (nsWindow *) GetInstance(widget); nsWindow *someWindow = (nsWindow *) GetInstance(widget);
nsRect rect; 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 ) 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.width = extents->lr.x - rect.x + 1;
rect.height = extents->lr.y - rect.y + 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 ); someWindow->OnResize( rect );
} }
return( Pt_CONTINUE ); return( Pt_CONTINUE );
} }
//void nsWindow::StartResizeHoldOff( PtWidget_t *widget )
void nsWindow::ResizeHoldOff() void nsWindow::ResizeHoldOff()
{ {
if( !mWidget ) if( !mWidget )
@ -1414,8 +1409,12 @@ void nsWindow::ResizeHoldOff()
return; return;
} }
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Entering this=<%p>\n", this ));
if( PR_FALSE == mResizeQueueInited ) 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 // This is to guarantee that the Invalidation work-proc is in place prior to the
// Resize work-proc. // Resize work-proc.
if( !mDmgQueueInited ) if( !mDmgQueueInited )
@ -1425,9 +1424,12 @@ void nsWindow::ResizeHoldOff()
PtWidget_t *top = PtFindDisjoint( mWidget ); 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; mResizeQueueInited = PR_TRUE;
} }
else else
@ -1447,6 +1449,8 @@ void nsWindow::ResizeHoldOff()
{ {
if( dqe->widget == mWidget ) if( dqe->widget == mWidget )
{ {
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Widget already in Queue this=<%p>\n", this ));
found = PR_TRUE; found = PR_TRUE;
break; break;
} }
@ -1458,12 +1462,13 @@ void nsWindow::ResizeHoldOff()
dqe = new DamageQueueEntry; dqe = new DamageQueueEntry;
if( dqe ) if( dqe )
{ {
PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::ResizeHoldOff Adding widget to Queue this=<%p>\n", this ));
mIsResizing = PR_TRUE; mIsResizing = PR_TRUE;
dqe->widget = mWidget; dqe->widget = mWidget;
dqe->inst = this; dqe->inst = this;
dqe->next = mResizeQueue; dqe->next = mResizeQueue;
mResizeQueue = dqe; mResizeQueue = dqe;
// NS_ADDREF_THIS();
} }
} }
} }
@ -1505,7 +1510,11 @@ void nsWindow::RemoveResizeWidget()
{ {
mResizeQueueInited = PR_FALSE; mResizeQueueInited = PR_FALSE;
PtWidget_t *top = PtFindDisjoint( mWidget ); 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 ) if( mResizeProcID )
PtAppRemoveWorkProc( nsnull, mResizeProcID ); PtAppRemoveWorkProc( nsnull, mResizeProcID );
} }
@ -1534,7 +1543,10 @@ int nsWindow::ResizeWorkProc( void *data )
nsWindow::mResizeQueue = nsnull; nsWindow::mResizeQueue = nsnull;
nsWindow::mResizeQueueInited = PR_FALSE; 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; return Pt_END;
} }