Bug 79017: Implement ScrollWheel and tab cleanup, r=timeless [BeOS Port Only]

This commit is contained in:
guru%startrek.com 2001-05-07 03:30:40 +00:00
Родитель 01f516cbd2
Коммит ca76fa63ce
2 изменённых файлов: 239 добавлений и 169 удалений

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

@ -391,18 +391,14 @@ NS_IMETHODIMP nsWindow::DispatchEvent(nsGUIEvent* event, nsEventStatus & aStatus
{
aStatus = nsEventStatus_eIgnore;
//if (nsnull != mMenuListener)
// aStatus = mMenuListener->MenuSelected(*event);
if (nsnull != mEventCallback) {
aStatus = (*mEventCallback)(event);
}
nsCOMPtr <nsIWidget> mWidget = event->widget;
// Dispatch to event listener if event was not consumed
if ((aStatus != nsEventStatus_eIgnore) && (nsnull != mEventListener)) {
if (mEventCallback)
aStatus = (*mEventCallback)(event);
if ((aStatus != nsEventStatus_eIgnore) && (mEventListener))
aStatus = mEventListener->ProcessEvent(*event);
}
// YK990522 was unused
// nsWindow * thisPtr = this;
return NS_OK;
}
@ -1573,7 +1569,8 @@ bool nsWindow::CallMethod(MethodInfo *info)
{
bool bRet = TRUE;
switch (info->methodId) {
switch (info->methodId)
{
case nsWindow::CREATE:
NS_ASSERTION(info->nArgs == 7, "Wrong number of arguments to CallMethod");
Create((nsIWidget*)(info->args[0]),
@ -1594,7 +1591,7 @@ bool nsWindow::CallMethod(MethodInfo *info)
(nsIAppShell *)(info->args[4]),
(nsIToolkit*)(info->args[5]),
(nsWidgetInitData*)(info->args[6]));
return TRUE;
break;
case nsWindow::DESTROY:
NS_ASSERTION(info->nArgs == 0, "Wrong number of arguments to CallMethod");
@ -1633,29 +1630,30 @@ bool nsWindow::CallMethod(MethodInfo *info)
{
NS_ASSERTION(info->nArgs == 5, "Wrong number of arguments to CallMethod");
// close popup when clicked outside of the popup window
// TODO: wheel mouse
uint32 eventID = ((int32 *)info->args)[0];
bool rollup = false;
if ((eventID == NS_MOUSE_LEFT_BUTTON_DOWN ||
eventID == NS_MOUSE_RIGHT_BUTTON_DOWN ||
eventID == NS_MOUSE_MIDDLE_BUTTON_DOWN) &&
mView && mView->LockLooper()) {
mView && mView->LockLooper())
{
BPoint p(((int32 *)info->args)[1], ((int32 *)info->args)[2]);
mView->ConvertToScreen(&p);
if (DealWithPopups(nsWindow::ONMOUSE, nsPoint(p.x, p.y)))
rollup = true;
mView->UnlockLooper();
}
if (rollup) break;
if (rollup)
break;
DispatchMouseEvent(((int32 *)info->args)[0],
nsPoint(((int32 *)info->args)[1], ((int32 *)info->args)[2]),
((int32 *)info->args)[3],
((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]),
((int32 *)info->args)[3],
@ -1664,18 +1662,58 @@ bool nsWindow::CallMethod(MethodInfo *info)
}
break;
case nsWindow::ONWHEEL :
{
NS_ASSERTION(info->nArgs == 1, "Wrong number of arguments to CallMethod");
nsMouseScrollEvent scrollEvent;
scrollEvent.scrollFlags = nsMouseScrollEvent::kIsVertical;
scrollEvent.delta = (info->args)[0];
scrollEvent.eventStructType = NS_MOUSE_SCROLL_EVENT;
scrollEvent.message = NS_MOUSE_SCROLL;
scrollEvent.nativeMsg = nsnull;
scrollEvent.widget = this;
scrollEvent.time = PR_IntervalNow();
// XXX implement these items?
scrollEvent.point.x = 100;
scrollEvent.point.y = 100;
// we don't use the mIsXDown bools because
// they get reset on Gecko reload (makes it harder
// to use stuff like Alt+Wheel)
uint32 mod (modifiers());
scrollEvent.isControl = mod & B_CONTROL_KEY;
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) {
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) {
}
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::ONPAINT :
@ -2719,15 +2757,16 @@ bool nsWindowBeOS::QuitRequested( void )
void nsWindowBeOS::MessageReceived(BMessage *msg)
{
switch(msg->what)
switch (msg->what)
{
case 'RESZ':
{
//this is the message generated by the resizeRunner - it
//has now served its purpose
// this is the message generated by the resizeRunner - it
// has now served its purpose
delete resizeRunner;
resizeRunner=NULL;
//kick off the xp resizing stuff
DoFrameResized();
}
@ -2959,10 +2998,40 @@ void nsViewBeOS::MessageReceived(BMessage *msg)
//printf("unmapped_key_down\n");
this->KeyDown(NULL, 0);
break;
case B_UNMAPPED_KEY_UP:
//printf("unmapped_key_up\n");
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 :
BView::MessageReceived(msg);
break;

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

@ -239,6 +239,7 @@ public: // public on BeOS to allow BViews to access it
SET_CURSOR,
CREATE_HACK,
ONMOUSE,
ONWHEEL,
ONPAINT,
ONSCROLL,
ONRESIZE,