зеркало из https://github.com/mozilla/gecko-dev.git
Bug 79017: Implement ScrollWheel and tab cleanup, r=timeless [BeOS Port Only]
This commit is contained in:
Родитель
01f516cbd2
Коммит
ca76fa63ce
|
@ -391,18 +391,14 @@ NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus
|
||||||
{
|
{
|
||||||
aStatus = nsEventStatus_eIgnore;
|
aStatus = nsEventStatus_eIgnore;
|
||||||
|
|
||||||
//if (nsnull != mMenuListener)
|
nsCOMPtr <nsIWidget> mWidget = event->widget;
|
||||||
// aStatus = mMenuListener->MenuSelected(*event);
|
|
||||||
if (nsnull != mEventCallback) {
|
if (mEventCallback)
|
||||||
aStatus = (*mEventCallback)(event);
|
aStatus = (*mEventCallback)(event);
|
||||||
}
|
|
||||||
|
|
||||||
// Dispatch to event listener if event was not consumed
|
if ((aStatus != nsEventStatus_eIgnore) && (mEventListener))
|
||||||
if ((aStatus != nsEventStatus_eIgnore) && (nsnull != mEventListener)) {
|
|
||||||
aStatus = mEventListener->ProcessEvent(*event);
|
aStatus = mEventListener->ProcessEvent(*event);
|
||||||
}
|
|
||||||
// YK990522 was unused
|
|
||||||
// nsWindow * thisPtr = this;
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1571,156 +1567,198 @@ NS_METHOD nsWindow::Scroll(PRInt32 aDx, PRInt32 aDy, nsRect *aClipRect)
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
bool nsWindow::CallMethod(MethodInfo *info)
|
bool nsWindow::CallMethod(MethodInfo *info)
|
||||||
{
|
{
|
||||||
bool bRet = TRUE;
|
bool bRet = TRUE;
|
||||||
|
|
||||||
switch (info->methodId) {
|
switch (info->methodId)
|
||||||
case nsWindow::CREATE:
|
{
|
||||||
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
|
case nsWindow::CREATE:
|
||||||
Create((nsIWidget*)(info->args[0]),
|
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
|
||||||
(nsRect&)*(nsRect*)(info->args[1]),
|
Create((nsIWidget*)(info->args[0]),
|
||||||
(EVENT_CALLBACK)(info->args[2]),
|
(nsRect&)*(nsRect*)(info->args[1]),
|
||||||
(nsIDeviceContext*)(info->args[3]),
|
(EVENT_CALLBACK)(info->args[2]),
|
||||||
(nsIAppShell *)(info->args[4]),
|
(nsIDeviceContext*)(info->args[3]),
|
||||||
(nsIToolkit*)(info->args[5]),
|
(nsIAppShell *)(info->args[4]),
|
||||||
(nsWidgetInitData*)(info->args[6]));
|
(nsIToolkit*)(info->args[5]),
|
||||||
break;
|
(nsWidgetInitData*)(info->args[6]));
|
||||||
|
break;
|
||||||
|
|
||||||
case nsWindow::CREATE_NATIVE:
|
case nsWindow::CREATE_NATIVE:
|
||||||
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
|
||||||
Create((nsNativeWidget)(info->args[0]),
|
Create((nsNativeWidget)(info->args[0]),
|
||||||
(nsRect&)*(nsRect*)(info->args[1]),
|
(nsRect&)*(nsRect*)(info->args[1]),
|
||||||
(EVENT_CALLBACK)(info->args[2]),
|
(EVENT_CALLBACK)(info->args[2]),
|
||||||
(nsIDeviceContext*)(info->args[3]),
|
(nsIDeviceContext*)(info->args[3]),
|
||||||
(nsIAppShell *)(info->args[4]),
|
(nsIAppShell *)(info->args[4]),
|
||||||
(nsIToolkit*)(info->args[5]),
|
(nsIToolkit*)(info->args[5]),
|
||||||
(nsWidgetInitData*)(info->args[6]));
|
(nsWidgetInitData*)(info->args[6]));
|
||||||
return TRUE;
|
break;
|
||||||
|
|
||||||
case nsWindow::DESTROY:
|
case nsWindow::DESTROY:
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
Destroy();
|
Destroy();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsWindow::CLOSEWINDOW :
|
case nsWindow::CLOSEWINDOW :
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
DispatchStandardEvent(NS_DESTROY);
|
DispatchStandardEvent(NS_DESTROY);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsWindow::SET_FOCUS:
|
case nsWindow::SET_FOCUS:
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
SetFocus(PR_FALSE);
|
SetFocus(PR_FALSE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsWindow::GOT_FOCUS:
|
case nsWindow::GOT_FOCUS:
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
DispatchFocus(NS_GOTFOCUS);
|
DispatchFocus(NS_GOTFOCUS);
|
||||||
//if(gJustGotActivate) {
|
//if(gJustGotActivate) {
|
||||||
// gJustGotActivate = PR_FALSE;
|
// gJustGotActivate = PR_FALSE;
|
||||||
DispatchFocus(NS_ACTIVATE);
|
DispatchFocus(NS_ACTIVATE);
|
||||||
//}
|
//}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsWindow::KILL_FOCUS:
|
case nsWindow::KILL_FOCUS:
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
DispatchFocus(NS_LOSTFOCUS);
|
DispatchFocus(NS_LOSTFOCUS);
|
||||||
//if(gJustGotDeactivate) {
|
//if(gJustGotDeactivate) {
|
||||||
// gJustGotDeactivate = PR_FALSE;
|
// gJustGotDeactivate = PR_FALSE;
|
||||||
DispatchFocus(NS_DEACTIVATE);
|
DispatchFocus(NS_DEACTIVATE);
|
||||||
//}
|
//}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case nsWindow::ONMOUSE :
|
case nsWindow::ONMOUSE :
|
||||||
{
|
{
|
||||||
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
|
||||||
// close popup when clicked outside of the popup window
|
// close popup when clicked outside of the popup window
|
||||||
// TODO: wheel mouse
|
uint32 eventID = ((int32 *)info->args)[0];
|
||||||
uint32 eventID = ((int32 *)info->args)[0];
|
bool rollup = false;
|
||||||
bool rollup = false;
|
|
||||||
|
|
||||||
if ((eventID == NS_MOUSE_LEFT_BUTTON_DOWN ||
|
if ((eventID == NS_MOUSE_LEFT_BUTTON_DOWN ||
|
||||||
eventID == NS_MOUSE_RIGHT_BUTTON_DOWN ||
|
eventID == NS_MOUSE_RIGHT_BUTTON_DOWN ||
|
||||||
eventID == NS_MOUSE_MIDDLE_BUTTON_DOWN) &&
|
eventID == NS_MOUSE_MIDDLE_BUTTON_DOWN) &&
|
||||||
mView && mView->LockLooper()) {
|
mView && mView->LockLooper())
|
||||||
|
{
|
||||||
BPoint p(((int32 *)info->args)[1], ((int32 *)info->args)[2]);
|
BPoint p(((int32 *)info->args)[1], ((int32 *)info->args)[2]);
|
||||||
mView->ConvertToScreen(&p);
|
mView->ConvertToScreen(&p);
|
||||||
if (DealWithPopups(nsWindow::ONMOUSE, nsPoint(p.x, p.y)))
|
if (DealWithPopups(nsWindow::ONMOUSE, nsPoint(p.x, p.y)))
|
||||||
rollup = true;
|
rollup = true;
|
||||||
mView->UnlockLooper();
|
mView->UnlockLooper();
|
||||||
}
|
}
|
||||||
if (rollup) break;
|
if (rollup)
|
||||||
|
break;
|
||||||
|
|
||||||
DispatchMouseEvent(((int32 *)info->args)[0],
|
DispatchMouseEvent(((int32 *)info->args)[0],
|
||||||
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
|
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
|
||||||
((int32 *)info->args)[3],
|
((int32 *)info->args)[3],
|
||||||
((int32 *)info->args)[4]);
|
((int32 *)info->args)[4]);
|
||||||
|
|
||||||
if (((int32 *)info->args)[0] == NS_MOUSE_RIGHT_BUTTON_DOWN) {
|
if (((int32 *)info->args)[0] == NS_MOUSE_RIGHT_BUTTON_DOWN)
|
||||||
DispatchMouseEvent (NS_CONTEXTMENU,
|
{
|
||||||
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
|
DispatchMouseEvent (NS_CONTEXTMENU,
|
||||||
((int32 *)info->args)[3],
|
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
|
||||||
((int32 *)info->args)[4]);
|
((int32 *)info->args)[3],
|
||||||
}
|
((int32 *)info->args)[4]);
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nsWindow::ONWHEEL :
|
||||||
|
{
|
||||||
|
NS_ASSERTION(info->nArgs == 1, "Wrong number of arguments to CallMethod");
|
||||||
|
|
||||||
|
nsMouseScrollEvent scrollEvent;
|
||||||
|
|
||||||
|
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
|
||||||
|
|
||||||
case nsWindow::ONKEY :
|
scrollEvent.delta = (info->args)[0];
|
||||||
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
|
|
||||||
if (((int32 *)info->args)[0] == NS_KEY_DOWN) {
|
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
|
||||||
OnKeyDown(((int32 *)info->args)[0],
|
scrollEvent.message = NS_MOUSE_SCROLL;
|
||||||
(const char *)(&((uint32 *)info->args)[1]), ((int32 *)info->args)[2],
|
scrollEvent.nativeMsg = nsnull;
|
||||||
((uint32 *)info->args)[3], ((uint32 *)info->args)[4]);
|
scrollEvent.widget = this;
|
||||||
} else
|
scrollEvent.time = PR_IntervalNow();
|
||||||
if (((int32 *)info->args)[0] == NS_KEY_UP) {
|
|
||||||
OnKeyUp(((int32 *)info->args)[0],
|
|
||||||
(const char *)(&((uint32 *)info->args)[1]), ((int32 *)info->args)[2],
|
|
||||||
((uint32 *)info->args)[3], ((uint32 *)info->args)[4]);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case nsWindow::ONPAINT :
|
// XXX implement these items?
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
scrollEvent.point.x = 100;
|
||||||
if(mView && mView->LockLooper())
|
scrollEvent.point.y = 100;
|
||||||
{
|
|
||||||
nsRect r;
|
// we don't use the mIsXDown bools because
|
||||||
nsViewBeOS *bv = dynamic_cast<nsViewBeOS *>(mView);
|
// they get reset on Gecko reload (makes it harder
|
||||||
if(bv && bv->GetPaintRect(r))
|
// to use stuff like Alt+Wheel)
|
||||||
OnPaint(r);
|
uint32 mod (modifiers());
|
||||||
mView->UnlockLooper();
|
|
||||||
}
|
scrollEvent.isControl = mod & B_CONTROL_KEY;
|
||||||
break;
|
scrollEvent.isShift = mod & B_SHIFT_KEY;
|
||||||
|
scrollEvent.isAlt = mod & B_COMMAND_KEY;
|
||||||
|
scrollEvent.isMeta = PR_FALSE;
|
||||||
|
|
||||||
|
nsEventStatus rv;
|
||||||
|
DispatchEvent (&scrollEvent, rv);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case nsWindow::ONKEY :
|
||||||
|
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
|
||||||
|
if (((int32 *)info->args)[0] == NS_KEY_DOWN)
|
||||||
|
{
|
||||||
|
OnKeyDown(((int32 *)info->args)[0],
|
||||||
|
(const char *)(&((uint32 *)info->args)[1]), ((int32 *)info->args)[2],
|
||||||
|
((uint32 *)info->args)[3], ((uint32 *)info->args)[4]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (((int32 *)info->args)[0] == NS_KEY_UP)
|
||||||
|
{
|
||||||
|
OnKeyUp(((int32 *)info->args)[0],
|
||||||
|
(const char *)(&((uint32 *)info->args)[1]), ((int32 *)info->args)[2],
|
||||||
|
((uint32 *)info->args)[3], ((uint32 *)info->args)[4]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case nsWindow::ONRESIZE :
|
case nsWindow::ONPAINT :
|
||||||
{
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
NS_ASSERTION(info->nArgs == 2, "Wrong number of arguments to CallMethod");
|
if(mView && mView->LockLooper())
|
||||||
|
{
|
||||||
|
nsRect r;
|
||||||
|
nsViewBeOS *bv = dynamic_cast<nsViewBeOS *>(mView);
|
||||||
|
if(bv && bv->GetPaintRect(r))
|
||||||
|
OnPaint(r);
|
||||||
|
mView->UnlockLooper();
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
nsRect r;
|
case nsWindow::ONRESIZE :
|
||||||
r.width=(nscoord)info->args[0];
|
{
|
||||||
r.height=(nscoord)info->args[1];
|
NS_ASSERTION(info->nArgs == 2, "Wrong number of arguments to CallMethod");
|
||||||
|
|
||||||
OnResize(r);
|
nsRect r;
|
||||||
}
|
r.width=(nscoord)info->args[0];
|
||||||
break;
|
r.height=(nscoord)info->args[1];
|
||||||
|
|
||||||
case nsWindow::ONSCROLL:
|
OnResize(r);
|
||||||
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
}
|
||||||
OnScroll();
|
break;
|
||||||
break;
|
|
||||||
|
|
||||||
case nsWindow::BTNCLICK :
|
case nsWindow::ONSCROLL:
|
||||||
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
|
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
|
||||||
DispatchMouseEvent(((int32 *)info->args)[0],
|
OnScroll();
|
||||||
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
|
break;
|
||||||
((int32 *)info->args)[3],
|
|
||||||
((int32 *)info->args)[4]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
case nsWindow::BTNCLICK :
|
||||||
bRet = FALSE;
|
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
|
||||||
break;
|
DispatchMouseEvent(((int32 *)info->args)[0],
|
||||||
}
|
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
|
||||||
|
((int32 *)info->args)[3],
|
||||||
|
((int32 *)info->args)[4]);
|
||||||
|
break;
|
||||||
|
|
||||||
return bRet;
|
default:
|
||||||
|
bRet = FALSE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -2458,7 +2496,7 @@ PRBool nsWindow::OnResize(nsRect &aWindowRect)
|
||||||
if(mView && mView->LockLooper())
|
if(mView && mView->LockLooper())
|
||||||
{
|
{
|
||||||
BRect r = mView->Bounds();
|
BRect r = mView->Bounds();
|
||||||
event.mWinWidth = r.IntegerWidth()+1;
|
event.mWinWidth = r.IntegerWidth()+1;
|
||||||
event.mWinHeight = r.IntegerHeight()+1;
|
event.mWinHeight = r.IntegerHeight()+1;
|
||||||
mView->UnlockLooper();
|
mView->UnlockLooper();
|
||||||
} else {
|
} else {
|
||||||
|
@ -2719,24 +2757,25 @@ bool nsWindowBeOS::QuitRequested( void )
|
||||||
|
|
||||||
void nsWindowBeOS::MessageReceived(BMessage *msg)
|
void nsWindowBeOS::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
switch(msg->what)
|
switch (msg->what)
|
||||||
{
|
{
|
||||||
case 'RESZ':
|
case 'RESZ':
|
||||||
{
|
{
|
||||||
//this is the message generated by the resizeRunner - it
|
// this is the message generated by the resizeRunner - it
|
||||||
//has now served its purpose
|
// has now served its purpose
|
||||||
delete resizeRunner;
|
delete resizeRunner;
|
||||||
resizeRunner=NULL;
|
resizeRunner=NULL;
|
||||||
|
|
||||||
//kick off the xp resizing stuff
|
|
||||||
DoFrameResized();
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default :
|
//kick off the xp resizing stuff
|
||||||
BWindow::MessageReceived(msg);
|
DoFrameResized();
|
||||||
break;
|
}
|
||||||
}
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
BWindow::MessageReceived(msg);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsWindowBeOS::FrameResized(float width, float height)
|
void nsWindowBeOS::FrameResized(float width, float height)
|
||||||
|
@ -2953,20 +2992,50 @@ void nsViewBeOS::MouseUp(BPoint point)
|
||||||
|
|
||||||
void nsViewBeOS::MessageReceived(BMessage *msg)
|
void nsViewBeOS::MessageReceived(BMessage *msg)
|
||||||
{
|
{
|
||||||
switch(msg->what)
|
switch(msg->what)
|
||||||
{
|
{
|
||||||
case B_UNMAPPED_KEY_DOWN:
|
case B_UNMAPPED_KEY_DOWN:
|
||||||
//printf("unmapped_key_down\n");
|
//printf("unmapped_key_down\n");
|
||||||
this->KeyDown(NULL, 0);
|
this->KeyDown(NULL, 0);
|
||||||
break;
|
break;
|
||||||
case B_UNMAPPED_KEY_UP:
|
|
||||||
//printf("unmapped_key_up\n");
|
case B_UNMAPPED_KEY_UP:
|
||||||
this->KeyUp(NULL, 0);
|
//printf("unmapped_key_up\n");
|
||||||
break;
|
this->KeyUp(NULL, 0);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case B_MOUSE_WHEEL_CHANGED:
|
||||||
|
{
|
||||||
|
float wheel_y;
|
||||||
|
|
||||||
|
msg->FindFloat ("be:wheel_delta_y", &wheel_y);
|
||||||
|
|
||||||
|
// make sure there *was* movement on the y axis
|
||||||
|
if(wheel_y == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
nsWindow *w = (nsWindow *)GetMozillaWidget();
|
||||||
|
nsToolkit *t;
|
||||||
|
|
||||||
|
if(w && (t = w->GetToolkit()) != 0)
|
||||||
|
{
|
||||||
|
uint32 args[1];
|
||||||
|
if (wheel_y > 0)
|
||||||
|
args[0] = (uint32)3;
|
||||||
|
else
|
||||||
|
args[0] = (uint32)-3;
|
||||||
|
|
||||||
|
MethodInfo *info = new MethodInfo(w, w, nsWindow::ONWHEEL, 1, args);
|
||||||
|
t->CallMethodAsync(info);
|
||||||
|
NS_RELEASE(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
default :
|
default :
|
||||||
BView::MessageReceived(msg);
|
BView::MessageReceived(msg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void nsViewBeOS::KeyDown(const char *bytes, int32 numBytes)
|
void nsViewBeOS::KeyDown(const char *bytes, int32 numBytes)
|
||||||
|
|
|
@ -239,6 +239,7 @@ public: // public on BeOS to allow BViews to access it
|
||||||
SET_CURSOR,
|
SET_CURSOR,
|
||||||
CREATE_HACK,
|
CREATE_HACK,
|
||||||
ONMOUSE,
|
ONMOUSE,
|
||||||
|
ONWHEEL,
|
||||||
ONPAINT,
|
ONPAINT,
|
||||||
ONSCROLL,
|
ONSCROLL,
|
||||||
ONRESIZE,
|
ONRESIZE,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче