зеркало из https://github.com/mozilla/gecko-dev.git
fixed some offset bugs
This commit is contained in:
Родитель
05adbb04da
Коммит
eaf1d9324c
|
@ -202,13 +202,19 @@ PRBool result;
|
|||
result = nsWindow::DispatchMouseEvent(aEvent);
|
||||
break;
|
||||
case NS_MOUSE_EXIT:
|
||||
DrawWidget(PR_FALSE);
|
||||
mWidgetArmed = PR_FALSE;
|
||||
//if(mMouseDownInButton)
|
||||
{
|
||||
DrawWidget(PR_FALSE);
|
||||
mWidgetArmed = PR_FALSE;
|
||||
}
|
||||
result = nsWindow::DispatchMouseEvent(aEvent);
|
||||
break;
|
||||
case NS_MOUSE_ENTER:
|
||||
DrawWidget(PR_TRUE);
|
||||
mWidgetArmed = PR_TRUE;
|
||||
//if(mMouseDownInButton)
|
||||
{
|
||||
DrawWidget(PR_TRUE);
|
||||
mWidgetArmed = PR_TRUE;
|
||||
}
|
||||
result = nsWindow::DispatchMouseEvent(aEvent);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -132,9 +132,6 @@ unsigned char evtype;
|
|||
evtype = (unsigned char) (theevent.message>>24)&0x00ff;
|
||||
switch(evtype)
|
||||
{
|
||||
//case MOUSEMOVEDMESSAGE:
|
||||
//DoMouseMove(&theevent);
|
||||
//break;
|
||||
case SUSPENDRESUMEMESSAGE:
|
||||
if(theevent.message&0x00000001)
|
||||
{
|
||||
|
@ -509,7 +506,7 @@ nsRefData *theRefData;
|
|||
|
||||
//=================================================================
|
||||
/* Turns a null event into a raptor mousemove event
|
||||
* @update dc 08/31/98
|
||||
* @update dc 10/02/98
|
||||
* @param aTheEvent -- A pointer to a Macintosh EventRecord
|
||||
* @return NONE
|
||||
*/
|
||||
|
@ -553,9 +550,10 @@ nsRefData *theRefData;
|
|||
}
|
||||
|
||||
|
||||
// the mouse is down, and moving
|
||||
if(gGrabWindow)
|
||||
{
|
||||
if( /*(gGrabWindow==thewindow) ||*/ thewindow==lastwindow)
|
||||
if(thewindow==lastwindow)
|
||||
{
|
||||
// JUST A MOUSE MOVE
|
||||
mouseevent.message = NS_MOUSE_MOVE;
|
||||
|
@ -598,67 +596,67 @@ nsRefData *theRefData;
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
//partcode = FindWindow(aTheEvent->where,&whichwindow);
|
||||
switch(partcode)
|
||||
{
|
||||
case inContent:
|
||||
if(thewindow)
|
||||
{
|
||||
if(lastwindow == nsnull || thewindow != lastwindow)
|
||||
else
|
||||
{
|
||||
if(whichwindow)
|
||||
switch(partcode)
|
||||
{
|
||||
case inContent:
|
||||
if(thewindow)
|
||||
{
|
||||
// mouseexit
|
||||
if(lastwindow != nsnull)
|
||||
if(lastwindow == nsnull || thewindow != lastwindow)
|
||||
{
|
||||
mouseevent.message = NS_MOUSE_EXIT;
|
||||
mouseevent.widget = (nsWindow *) lastwindow;
|
||||
// mouseexit
|
||||
if(lastwindow != nsnull)
|
||||
{
|
||||
mouseevent.message = NS_MOUSE_EXIT;
|
||||
mouseevent.widget = (nsWindow *) lastwindow;
|
||||
hitPoint = aTheEvent->where;
|
||||
GlobalToLocal(&hitPoint);
|
||||
mouseevent.point.x = hitPoint.h;
|
||||
mouseevent.point.y = hitPoint.v;
|
||||
lastwindow->DispatchMouseEvent(mouseevent);
|
||||
}
|
||||
|
||||
// mouseenter
|
||||
this->SetCurrentWindow(thewindow);
|
||||
mouseevent.message = NS_MOUSE_ENTER;
|
||||
mouseevent.widget = (nsWindow *) thewindow;
|
||||
hitPoint = aTheEvent->where;
|
||||
GlobalToLocal(&hitPoint);
|
||||
mouseevent.point.x = hitPoint.h;
|
||||
mouseevent.point.y = hitPoint.v;
|
||||
lastwindow->DispatchMouseEvent(mouseevent);
|
||||
thewindow->DispatchMouseEvent(mouseevent);
|
||||
}
|
||||
|
||||
// mouseenter
|
||||
this->SetCurrentWindow(thewindow);
|
||||
mouseevent.message = NS_MOUSE_ENTER;
|
||||
mouseevent.widget = (nsWindow *) thewindow;
|
||||
else
|
||||
{
|
||||
// mousedown inside the content region
|
||||
mouseevent.message = NS_MOUSE_MOVE;
|
||||
mouseevent.widget = (nsWindow *) thewindow;
|
||||
hitPoint = aTheEvent->where;
|
||||
GlobalToLocal(&hitPoint);
|
||||
mouseevent.point.x = hitPoint.h;
|
||||
mouseevent.point.y = hitPoint.v;
|
||||
thewindow->DispatchMouseEvent(mouseevent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(lastwindow != nsnull)
|
||||
{
|
||||
this->SetCurrentWindow(nsnull);
|
||||
mouseevent.message = NS_MOUSE_EXIT;
|
||||
mouseevent.widget = (nsWindow *) lastwindow;
|
||||
hitPoint = aTheEvent->where;
|
||||
GlobalToLocal(&hitPoint);
|
||||
mouseevent.point.x = hitPoint.h;
|
||||
mouseevent.point.y = hitPoint.v;
|
||||
thewindow->DispatchMouseEvent(mouseevent);
|
||||
lastwindow->DispatchMouseEvent(mouseevent);
|
||||
}
|
||||
else
|
||||
{
|
||||
// mousedown inside the content region
|
||||
mouseevent.message = NS_MOUSE_MOVE;
|
||||
mouseevent.widget = (nsWindow *) thewindow;
|
||||
hitPoint = aTheEvent->where;
|
||||
GlobalToLocal(&hitPoint);
|
||||
mouseevent.point.x = hitPoint.h;
|
||||
mouseevent.point.y = hitPoint.v;
|
||||
thewindow->DispatchMouseEvent(mouseevent);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
if(lastwindow != nsnull)
|
||||
{
|
||||
this->SetCurrentWindow(nsnull);
|
||||
mouseevent.message = NS_MOUSE_EXIT;
|
||||
mouseevent.widget = (nsWindow *) lastwindow;
|
||||
hitPoint = aTheEvent->where;
|
||||
GlobalToLocal(&hitPoint);
|
||||
mouseevent.point.x = hitPoint.h;
|
||||
mouseevent.point.y = hitPoint.v;
|
||||
lastwindow->DispatchMouseEvent(mouseevent);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//=================================================================
|
||||
|
|
|
@ -124,9 +124,9 @@ PRInt32 offx,offy;
|
|||
destRect = viewRect;
|
||||
::GetPort(&curport);
|
||||
::SetPort(mWindowPtr);
|
||||
::SetOrigin(-offx,-offy);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
WENew(&destRect,&viewRect,teFlags,&mTE_Data);
|
||||
::SetOrigin(0,0);
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(curport);
|
||||
|
||||
InitDeviceContext(mContext, (nsNativeWidget)mWindowPtr);
|
||||
|
@ -206,7 +206,7 @@ RgnHandle thergn;
|
|||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
::SetOrigin(-offx,-offy);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
GetBounds(therect);
|
||||
nsRectToMacRect(therect,macrect);
|
||||
thergn = ::NewRgn();
|
||||
|
@ -217,7 +217,7 @@ RgnHandle thergn;
|
|||
::PenSize(1,1);
|
||||
::FrameRect(¯ect);
|
||||
::SetClip(thergn);
|
||||
::SetOrigin(0,0);
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(theport);
|
||||
|
||||
return PR_FALSE;
|
||||
|
@ -236,7 +236,7 @@ PRInt32 offx,offy;
|
|||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
::SetOrigin(-offx,-offy);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
|
||||
GetBounds(therect);
|
||||
nsRectToMacRect(therect,macrect);
|
||||
|
@ -245,7 +245,7 @@ PRInt32 offx,offy;
|
|||
::ClipRect(¯ect);
|
||||
WEKey(aKey,aModifiers,mTE_Data);
|
||||
::SetClip(thergn);
|
||||
::SetOrigin(0,0);
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(theport);
|
||||
|
||||
}
|
||||
|
@ -256,26 +256,29 @@ PRInt32 offx,offy;
|
|||
PRBool
|
||||
nsTextWidget::DispatchMouseEvent(nsMouseEvent &aEvent)
|
||||
{
|
||||
PRBool result=PR_TRUE;
|
||||
Point mouseLoc;
|
||||
PRInt16 modifiers=0;
|
||||
nsRect therect;
|
||||
Rect macrect;
|
||||
PRInt32 offx,offy;
|
||||
PRBool result=PR_TRUE;
|
||||
Point mouseLoc;
|
||||
PRInt16 modifiers=0;
|
||||
nsRect therect;
|
||||
Rect macrect;
|
||||
PRInt32 offx,offy;
|
||||
GrafPtr theport;
|
||||
|
||||
switch (aEvent.message)
|
||||
{
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
::SetOrigin(-offx,-offy);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
GetBounds(therect);
|
||||
nsRectToMacRect(therect,macrect);
|
||||
::ClipRect(¯ect);
|
||||
mouseLoc.h = aEvent.point.x;
|
||||
mouseLoc.v = aEvent.point.y;
|
||||
WEClick(mouseLoc,modifiers,aEvent.time,mTE_Data);
|
||||
::SetOrigin(0,0);
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(theport);
|
||||
result = PR_FALSE;
|
||||
break;
|
||||
case NS_MOUSE_LEFT_BUTTON_UP:
|
||||
|
@ -450,6 +453,7 @@ LongRect macRect;
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------
|
||||
PRUint32 nsTextWidget::SetText(const nsString& aText, PRUint32& aSize)
|
||||
{
|
||||
|
@ -461,7 +465,7 @@ GrafPtr theport;
|
|||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
::SetOrigin(-offx,-offy);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
|
||||
this->RemoveText();
|
||||
aText.ToCString(buffer,255);
|
||||
|
@ -470,6 +474,7 @@ GrafPtr theport;
|
|||
WEInsert(buffer,len,0,0,mTE_Data);
|
||||
|
||||
aSize = len;
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(theport);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -482,16 +487,17 @@ PRInt32 len;
|
|||
PRInt32 offx,offy;
|
||||
GrafPtr theport;
|
||||
|
||||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
::SetOrigin(-offx,-offy);
|
||||
CalcOffset(offx,offy);
|
||||
::GetPort(&theport);
|
||||
::SetPort(mWindowPtr);
|
||||
//::SetOrigin(-offx,-offy);
|
||||
|
||||
aText.ToCString(buffer,255);
|
||||
len = strlen(buffer);
|
||||
|
||||
WEInsert(buffer,len,0,0,mTE_Data);
|
||||
aSize = len;
|
||||
//::SetOrigin(0,0);
|
||||
::SetPort(theport);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -70,8 +70,8 @@ public:
|
|||
NS_IMETHOD GetSelection(PRUint32 *aStartSel, PRUint32 *aEndSel);
|
||||
NS_IMETHOD SetCaretPosition(PRUint32 aPosition);
|
||||
NS_IMETHOD GetCaretPosition(PRUint32& aPosition);
|
||||
NS_IMETHOD Resize(PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRUint32 aX, PRUint32 aY,PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint);
|
||||
NS_IMETHOD Resize(PRUint32 aX, PRUint32 aY,PRUint32 aWidth,PRUint32 aHeight, PRBool aRepaint);
|
||||
|
||||
|
||||
virtual PRBool OnPaint(nsPaintEvent & aEvent);
|
||||
|
|
|
@ -506,8 +506,6 @@ NS_IMETHODIMP nsWindow::Resize(PRUint32 aWidth, PRUint32 aHeight, PRBool aRepain
|
|||
{
|
||||
nsSizeEvent event;
|
||||
|
||||
if (DBG) printf("$$$$$$$$$ %s::Resize %d %d Repaint: %s\n",
|
||||
gInstanceClassName, aWidth, aHeight, (aRepaint?"true":"false"));
|
||||
mBounds.width = aWidth;
|
||||
mBounds.height = aHeight;
|
||||
|
||||
|
@ -517,10 +515,10 @@ nsSizeEvent event;
|
|||
SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height);
|
||||
|
||||
if (aRepaint)
|
||||
{
|
||||
{
|
||||
UpdateVisibilityFlag();
|
||||
UpdateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
event.message = NS_SIZE;
|
||||
event.point.x = 0;
|
||||
|
@ -552,10 +550,10 @@ nsSizeEvent event;
|
|||
SetRectRgn(mWindowRegion,mBounds.x,mBounds.y,mBounds.x+mBounds.width,mBounds.y+mBounds.height);
|
||||
|
||||
if (aRepaint)
|
||||
{
|
||||
{
|
||||
UpdateVisibilityFlag();
|
||||
UpdateDisplay();
|
||||
}
|
||||
}
|
||||
|
||||
event.message = NS_SIZE;
|
||||
event.point.x = 0;
|
||||
|
@ -1057,7 +1055,6 @@ nsRect rr;
|
|||
RGBColor redcolor = {0xff00,0,0};
|
||||
RGBColor greencolor = {0,0xff00,0};
|
||||
|
||||
event.renderingContext->Init(mContext, this);
|
||||
|
||||
CalcOffset(offx,offy);
|
||||
GetPort(&theport);
|
||||
|
@ -1091,10 +1088,12 @@ nsRect rr;
|
|||
::FrameRect(¯ect);
|
||||
}
|
||||
|
||||
result = DispatchEvent(&event);
|
||||
NS_RELEASE(event.renderingContext);
|
||||
SetOrigin(0,0);
|
||||
SetPort(theport);
|
||||
|
||||
event.renderingContext->Init(mContext, this);
|
||||
result = DispatchEvent(&event);
|
||||
NS_RELEASE(event.renderingContext);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1353,16 +1352,10 @@ void nsWindow::MacRectToNSRect(const Rect& aMacRect, nsRect& aRect) const
|
|||
nsWindow*
|
||||
nsWindow::FindWidgetHit(Point aThePoint)
|
||||
{
|
||||
//PRInt32 xOff,yOff;
|
||||
nsWindow *child = this;
|
||||
nsWindow *deeperWindow;
|
||||
nsRect rect;
|
||||
|
||||
//<<<<<<< nsWindow.cpp
|
||||
// if this is a main window, then map this point to this windows coordinate space
|
||||
//=======
|
||||
//::GlobalToLocal(&aThePoint);
|
||||
//>>>>>>> 1.26
|
||||
if (this->PtInWindow(aThePoint.h,aThePoint.v))
|
||||
{
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче