diff --git a/mozilla/widget/src/photon/nsWidget.cpp b/mozilla/widget/src/photon/nsWidget.cpp index 561a9de5992..283c08376cd 100644 --- a/mozilla/widget/src/photon/nsWidget.cpp +++ b/mozilla/widget/src/photon/nsWidget.cpp @@ -249,7 +249,7 @@ void nsWidget::OnDestroy() NS_ADDREF_THIS(); DispatchStandardEvent(NS_DESTROY); - NS_ADDREF_THIS(); + NS_RELEASE_THIS(); } //------------------------------------------------------------------------- @@ -338,21 +338,8 @@ the PtRealizeWidget functions */ PtSetArg(&arg, Pt_ARG_FLAGS, 0, Pt_DELAY_REALIZE); PtSetResources(mWidget, 1, &arg); -#if 1 /* Always add it to the Widget Damage Queue when it gets realized */ QueueWidgetDamage(); - -#else - if (!mUpdateArea->IsEmpty()) - { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show mUpdateArea not empty adding to Damage Queue this=<%p>\n", this)); - QueueWidgetDamage(); - } - else - { - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Show mUpdateArea is empty this=<%p>\n", this)); - } -#endif } else { @@ -414,14 +401,55 @@ NS_METHOD nsWidget::IsVisible(PRBool &aState) NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY) { PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move (%p) from (%ld,%ld) to (%ld,%ld)\n", this, mBounds.x, mBounds.y, aX, aY )); + //printf("nsWidget::Move (%p) from (%ld,%ld) to (%ld,%ld)\n", this, mBounds.x, mBounds.y, aX, aY ); - if(( mBounds.x == aX ) && ( mBounds.y == aY )) + if (( mBounds.x == aX ) && ( mBounds.y == aY )) { - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" already there.\n" )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move already there.\n" )); return NS_OK; } - PR_LOG(PhWidLog, PR_LOG_DEBUG, (" was at (%i,%i)\n", mBounds.x, mBounds.y )); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move was at (%i,%i)\n", mBounds.x, mBounds.y )); + + /* Get the offset for Pop-up's such as Combo-Boxes */ + PtArg_t arg; + PhArea_t *area; + PtWidget_t *parent; + PhPoint_t offset; + nsRect rect2; + PtWidget_t *disjoint = PtFindDisjoint( mWidget ); + + rect2.x = rect2.y = 0; + + if (mWidget) + { + parent = PtWidgetParent( mWidget ); + if (parent) + { + PtSetArg( &arg, Pt_ARG_AREA, &area, 0 ); + if( PtGetResources( parent, 1, &arg ) == 0 ) + { + if ( (parent == disjoint) || (PtWidgetIsClass(parent, PtWindow)) + || (PtWidgetIsClass(parent, PtRegion)) ) + { + rect2.x = rect2.y = 0; + } + else + { + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::Move Getting offeset for type=<%s>\n", mWidget->class_rec )); + printf ("nsWidget::Move type: %p\n",mWidget->class_rec); + + PtWidgetOffset( parent, &offset ); + if (PtWidgetIsClass(mWidget,PtRegion)) + { + printf ("nsWidget::Move offset: %d %d\n",offset.x,offset.y); + rect2.x = offset.x; + rect2.y = offset.y; + } + } + } + } +} mBounds.x = aX; mBounds.y = aY; @@ -430,7 +458,10 @@ NS_METHOD nsWidget::Move(PRInt32 aX, PRInt32 aY) { PtArg_t arg; PhPoint_t *oldpos; - PhPoint_t pos = {aX, aY}; + PhPoint_t pos; + + pos.x = aX+rect2.x; + pos.y = aY+rect2.y; EnableDamage( mWidget, PR_FALSE ); @@ -487,11 +518,13 @@ NS_METHOD nsWidget::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) EnableDamage( mWidget, PR_TRUE ); } + #if 0 /* GTK Does not bother doing this... */ if (mShown) Invalidate( aRepaint ); #endif + } else { @@ -1938,7 +1971,7 @@ int nsWidget::RawEventHandler( PtWidget_t *widget, void *data, PtCallbackInfo_t (someWidget->HandleEvent( cbinfo )) ) { - return( Pt_END ); // Event was consumed + return( Pt_END ); // Event was consumed } return( Pt_CONTINUE ); @@ -1950,12 +1983,55 @@ PRBool nsWidget::HandleEvent( PtCallbackInfo_t* aCbInfo ) { PRBool result = PR_TRUE; // call the default nsWindow proc int err; + char EventName[50]; + PhEvent_t* event = aCbInfo->event; + EventName[0] = NULL; -//printf("nsWidget::HandleEvent entering...\n"); +#if defined(DEBUG) && 1 + switch ( event->type ) + { + case Ph_EV_KEY: + strcpy(EventName, "Ph_EV_KEY"); + break; + case Ph_EV_DRAG: + strcpy(EventName, "Ph_EV_DRAG"); + break; + case Ph_EV_PTR_MOTION_BUTTON: + strcpy(EventName, "Ph_EV_BUTTON"); + break; + case Ph_EV_PTR_MOTION_NOBUTTON: + strcpy(EventName, "Ph_EV_NOBUTTON"); + break; + case Ph_EV_BUT_PRESS: + strcpy(EventName, "Ph_EV_BUT_PRESS"); + break; + case Ph_EV_BUT_RELEASE: + strcpy(EventName, "Ph_EV_BUT_RELEASE"); + break; + case Ph_EV_BOUNDARY: + strcpy(EventName, "Ph_EV_BOUNDARY"); + break; + case Ph_EV_WM: + strcpy(EventName, "Ph_EV_WM"); + break; + case Ph_EV_EXPOSE: + strcpy(EventName, "Ph_EV_EXPOSE"); + break; + default: + strcpy(EventName, "UNKNOWN"); + break; + } +#endif -#if defined(PHOTON2_ONLY) +printf("nsWidget::HandleEvent entering this=<%p> mWidget=<%p> Event Consumed=<%d> Event=<%s>\n", + this, mWidget, (event->processing_flags & Ph_CONSUMED), EventName ); + +PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWidget::HandleEvent entering this=<%p> mWidget=<%p> Event Consumed=<%d> Event=<%s>\n", + this, mWidget, (event->processing_flags & Ph_CONSUMED), EventName )); + +#if defined(PHOTON2_ONLY) && 1 /* Photon 2 added a Consumed flag which indicates a previous receiver of the */ /* event has processed it */ if (event->processing_flags & Ph_CONSUMED) diff --git a/mozilla/widget/src/photon/nsWindow.cpp b/mozilla/widget/src/photon/nsWindow.cpp index 6e0abb7ea52..c69702c958d 100644 --- a/mozilla/widget/src/photon/nsWindow.cpp +++ b/mozilla/widget/src/photon/nsWindow.cpp @@ -338,7 +338,7 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, if (aDoCapture) { -// printf("grabbing widget\n"); + printf("nsWindow::CaptureRollupEventsgrabbing widget\n"); /* Create a pointer region */ mIsGrabbing = PR_TRUE; @@ -351,7 +351,7 @@ NS_IMETHODIMP nsWindow::CaptureRollupEvents(nsIRollupListener * aListener, } else { -// printf("ungrabbing widget\n"); + printf("nsWindow::CaptureRollupEvents ungrabbing widget\n"); // make sure that the grab window is marked as released if (mGrabWindow == this) @@ -777,10 +777,6 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) #else #endif - // Did KEDL add this to fix the rip in the upper right hand corner? - mFrameLeft=2; - mFrameRight=2; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative Frame size L,T,R,B=(%d,%d,%d,%d)\n", mFrameLeft, mFrameTop, mFrameRight, mFrameBottom )); } @@ -791,26 +787,6 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) PtSetArg( &arg[arg_count++], Pt_ARG_RESIZE_FLAGS, 0, Pt_RESIZE_XY_BITS ); PtSetArg( &arg[arg_count++], Pt_ARG_WINDOW_RENDER_FLAGS, render_flags, 0xFFFFFFFF ); -#if 0 - /* Create Pop-ups as a PtWindow, this has many problems and is */ - /* only being kept here for a little longer to make sure there are */ - /* no problems in the PtRegion code. */ - - if( mWindowType == eWindowType_popup ) - { - PtSetArg( &arg[arg_count++], Pt_ARG_FLAGS, 0, (Pt_HIGHLIGHTED | Pt_GETS_FOCUS)); - } - - if( parentWidget ) - { - mWidget = PtCreateWidget( PtWindow, parentWidget, arg_count, arg ); - } - else - { - PtSetParentWidget( nsnull ); - mWidget = PtCreateWidget( PtWindow, nsnull, arg_count, arg ); - } -#else /* Create Pop-up Menus as a PtRegion */ if (!parentWidget) @@ -823,7 +799,7 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) Ph_REGION_EV_SENSE|Ph_REGION_EV_OPAQUE |Ph_REGION_RECT; - int sense = Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_BUT_REPEAT; + int sense = Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE | Ph_EV_BUT_REPEAT | Ph_EV_KEY; PtRawCallback_t callback; callback.event_mask = sense; @@ -839,6 +815,7 @@ NS_METHOD nsWindow::CreateNative(PtWidget_t *parentWidget) PhArea_t area; area.pos = region.origin; + area.size.w = rect.lr.x - rect.ul.x + 1; area.size.h = rect.lr.y - rect.ul.y + 1; @@ -866,12 +843,10 @@ printf("nsWindow::CreateNative 1st region area=(%d,%d,%d,%d)\n", area.pos.x, are PtSetArg( &arg[arg_count++], Pt_ARG_REGION_PARENT, mMenuRegion->rid, 0 ); PtSetArg( &arg[arg_count++], Pt_ARG_REGION_FIELDS, fields, fields ); PtSetArg( &arg[arg_count++], Pt_ARG_REGION_FLAGS, Ph_FORCE_FRONT, Ph_FORCE_FRONT ); -// PtSetArg( &arg[arg_count++], Pt_ARG_REGION_SENSE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_BUT_RELEASE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_BUT_RELEASE ); -// PtSetArg( &arg[arg_count++], Pt_ARG_REGION_OPAQUE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_BUT_RELEASE|Ph_EV_DRAW, sense |Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_BUT_RELEASE|Ph_EV_DRAW); PtSetArg( &arg[arg_count++], Pt_ARG_REGION_SENSE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE); PtSetArg( &arg[arg_count++], Pt_ARG_REGION_OPAQUE, sense | Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_DRAW, sense |Ph_EV_DRAG|Ph_EV_EXPOSE|Ph_EV_DRAW); - +//printf ("create region.................................................. %p\n",parentWidget); mWidget = PtCreateWidget( PtRegion, parentWidget, arg_count, arg); PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::CreateNative PtRegion = <%p>\n", mWidget)); @@ -885,13 +860,12 @@ printf("nsWindow::CreateNative 1st region area=(%d,%d,%d,%d)\n", area.pos.x, are PtSetParentWidget( nsnull ); mWidget = PtCreateWidget( PtWindow, nsnull, arg_count, arg ); #else + // KEDL WHY did you do this?? PtSetArg( &arg[arg_count++], Pt_ARG_FILL_COLOR, Pg_BLUE, 0 ); mWidget = PtCreateWidget( PtWindow, parentWidget, arg_count, arg ); #endif } -#endif - // Must also create the client-area widget if( mWidget ) { @@ -921,11 +895,18 @@ printf("nsWindow::CreateNative 1st region area=(%d,%d,%d,%d)\n", area.pos.x, are #else PtSetArg( &arg[arg_count++], Pt_ARG_FILL_COLOR, Pg_TRANSPARENT, 0 ); #endif - mClientWidget = PtCreateWidget( PtContainer, mWidget,arg_count, arg ); + +#if 0 + /* Kedl and I think this is an extra unnecsaary widget.. we are taking it out for now */ + mClientWidget = PtCreateWidget( PtContainer, mWidget,arg_count, arg ); + mClientWidget=0; +#endif } // Create a region that is opaque to draw events and place behind // the client widget. +#if 0 + /* Removing support for Extra widget that we no longer create right above this */ if( !mClientWidget ) { PtDestroyWidget( mWidget ); @@ -933,6 +914,7 @@ printf("nsWindow::CreateNative 1st region area=(%d,%d,%d,%d)\n", area.pos.x, are NS_ASSERTION(0,"nsWindow::CreateNative Error creating Client Widget\n"); abort(); } +#endif } } @@ -987,8 +969,15 @@ printf("nsWindow::CreateNative 1st region area=(%d,%d,%d,%d)\n", area.pos.x, are } else if ( !parentWidget ) { - PtAddCallback(mClientWidget, Pt_CB_RESIZE, ResizeHandler, nsnull ); - PtAddCallback(mWidget, Pt_CB_WINDOW_CLOSING, WindowCloseHandler, this ); + if (mClientWidget) + { + PtAddCallback(mClientWidget, Pt_CB_RESIZE, ResizeHandler, nsnull ); + } + else + { + PtAddCallback(mWidget, Pt_CB_RESIZE, ResizeHandler, nsnull ); + PtAddCallback(mWidget, Pt_CB_WINDOW_CLOSING, WindowCloseHandler, this ); + } } // call the event callback to notify about creation @@ -1393,8 +1382,14 @@ NS_IMETHODIMP nsWindow::Resize(PRInt32 aWidth, PRInt32 aHeight, PRBool aRepaint) sevent.message = NS_SIZE; sevent.widget = this; sevent.eventStructType = NS_SIZE_EVENT; - sevent.windowSize = new nsRect (0, 0, aWidth+2, aHeight); // kedl1, fix so throbber area is right - // size; only works first time though... + +#if 0 + /* KEDL: fix so throbber area is right size; only works first time though... */ + sevent.windowSize = new nsRect (0, 0, aWidth+2, aHeight); +#else + sevent.windowSize = new nsRect (0, 0, aWidth, aHeight); +#endif + sevent.point.x = 0; sevent.point.y = 0; sevent.mWinWidth = aWidth; @@ -1935,6 +1930,7 @@ NS_METHOD nsWindow::GetFrameSize(int *FrameLeft, int *FrameRight, int *FrameTop, +/* Only called by nsWidget::Scroll */ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctiles ) { nsresult res = NS_ERROR_FAILURE; @@ -1992,6 +1988,10 @@ NS_METHOD nsWindow::GetSiblingClippedRegion( PhTile_t **btiles, PhTile_t **ctile } } +//KEDL, HACK!! to get scrolling to work with widgets again +// KIRK whats really going on here? Aren't you just skipping this section?? +*ctiles=0; + if( *ctiles ) { // We have siblings... now clip'em @@ -2798,29 +2798,72 @@ int nsWindow::MenuRegionCallback( PtWidget_t *widget, ApInfo_t *apinfo, PtCallba /* eliminate 'unreferenced' warnings */ widget = widget, apinfo = apinfo, cbinfo = cbinfo; - PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p>\n", pWin, widget, apinfo)); + + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p> mMenuRegion=<%p>\n", pWin, widget, apinfo, pWin->mMenuRegion)); #if defined(DEBUG) && 1 -// printf("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p> pWin2=<%p>\n", pWin, widget, apinfo, pWin2); -// printf("nsWindow::MenuRegionCallback cbinfo->reason=<%d>\n", cbinfo->reason); -// printf("nsWindow::MenuRegionCallback cbinfo->subtype=<%d>\n", cbinfo->reason_subtype); -// printf("nsWindow::MenuRegionCallback cbinfo->cbdata=<%d>\n", cbinfo->cbdata); -// printf("nsWindow::MenuRegionCallback event->type=<%d>\n", event->type); + char EventName[50]; + + EventName[0] = NULL; + switch ( event->type ) + { + case Ph_EV_KEY: + strcpy(EventName, "Ph_EV_KEY"); + break; + case Ph_EV_DRAG: + strcpy(EventName, "Ph_EV_DRAG"); + break; + case Ph_EV_PTR_MOTION_BUTTON: + strcpy(EventName, "Ph_EV_BUTTON"); + break; + case Ph_EV_PTR_MOTION_NOBUTTON: + strcpy(EventName, "Ph_EV_NOBUTTON"); + break; + case Ph_EV_BUT_PRESS: + strcpy(EventName, "Ph_EV_BUT_PRESS"); + break; + case Ph_EV_BUT_RELEASE: + strcpy(EventName, "Ph_EV_BUT_RELEASE"); + break; + case Ph_EV_BOUNDARY: + strcpy(EventName, "Ph_EV_BOUNDARY"); + break; + case Ph_EV_WM: + strcpy(EventName, "Ph_EV_WM"); + break; + case Ph_EV_EXPOSE: + strcpy(EventName, "Ph_EV_EXPOSE"); + break; + default: + strcpy(EventName, "UNKNOWN"); + break; + } + + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback this=<%p> widget=<%p> apinfo=<%p> pWin2=<%p> EventName=<%s>\n", pWin, widget, apinfo, pWin2, EventName)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->reason=<%d>\n", cbinfo->reason)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->subtype=<%d>\n", cbinfo->reason_subtype)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback cbinfo->cbdata=<%d>\n", cbinfo->cbdata)); + PR_LOG(PhWidLog, PR_LOG_DEBUG, ("nsWindow::MenuRegionCallback event->type=<%d>\n", event->type)); #endif +#if 1 + return (Pt_CONTINUE); + //return RawEventHandler(widget, apinfo, cbinfo); +#else if ( (event->type == Ph_EV_BUT_PRESS) || (event->type == Ph_EV_KEY) ) { -// printf("nsWindow::MenuRegionCallback event is Ph_EV_BUT_PRESS | Ph_EV_KEY\n"); -// printf("nsWindow::MenuRegionCallback pWin->gRollupWidget=<%p> pWin->gRollupListener=<%p>\n", pWin->gRollupWidget, pWin->gRollupListener); + printf("nsWindow::MenuRegionCallback event is Ph_EV_BUT_PRESS | Ph_EV_KEY\n"); + printf("nsWindow::MenuRegionCallback pWin->gRollupWidget=<%p> pWin->gRollupListener=<%p>\n", pWin->gRollupWidget, pWin->gRollupListener); if (pWin->gRollupWidget && pWin->gRollupListener) { /* Close the Window */ - //pWin->gRollupListener->Rollup(); + pWin->gRollupListener->Rollup(); } } return (Pt_CONTINUE); +#endif } NS_METHOD nsWindow::GetAttention()