bool AbstractFloatItem::eventFilter( QObject *object, QEvent *e ) { if ( !enabled() || !visible() ) { return false; } if( e->type() == QEvent::ContextMenu ) { QWidget *widget = dynamic_cast<QWidget *>( object ); QContextMenuEvent *menuEvent = dynamic_cast<QContextMenuEvent *> ( e ); if( widget != NULL && menuEvent != NULL && contains( menuEvent->pos() ) ) { contextMenuEvent( widget, menuEvent ); return true; } return false; } else if( e->type() == QEvent::ToolTip ) { QHelpEvent *helpEvent = dynamic_cast<QHelpEvent *>( e ); if( helpEvent != NULL && contains( helpEvent->pos() ) ) { toolTipEvent( helpEvent ); return true; } return false; } else return ScreenGraphicsItem::eventFilter( object, e ); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tDataSourcesDialog::ShowContextMenu() { QPoint menuPos = m_pTreeView->visualRect( m_pTreeView->currentIndex() ).bottomLeft() + QPoint( 10, 0 ); menuPos = m_pTreeView->viewport()->mapTo( this, menuPos ); QContextMenuEvent menuEvent = QContextMenuEvent( QContextMenuEvent::Other, menuPos ); contextMenuEvent( &menuEvent ); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tWorkProfilesDialog::ShowContextMenu() { QPoint menuPos = m_pProfilesTable->visualItemRect( m_pProfilesTable->currentItem() ).bottomLeft() + QPoint( 10, 0 ); menuPos = m_pProfilesTable->viewport()->mapTo( this, menuPos ); QContextMenuEvent menuEvent = QContextMenuEvent( QContextMenuEvent::Other, menuPos ); contextMenuEvent( &menuEvent ); }
void OverviewErrorsWidget::ErrorLogCustomContextMenuEvent(const QPoint &pPos) { QContextMenuEvent *tEvent = new QContextMenuEvent(QContextMenuEvent::Mouse, pPos, QCursor::pos()); contextMenuEvent(tEvent); delete tEvent; }
void QDateEdit_QtDShell::__override_contextMenuEvent(QContextMenuEvent* event0, bool static_call) { if (static_call) { QAbstractSpinBox::contextMenuEvent((QContextMenuEvent* )event0); } else { contextMenuEvent((QContextMenuEvent* )event0); } }
void QGraphicsEllipseItem_QtDShell::__override_contextMenuEvent(QGraphicsSceneContextMenuEvent* event0, bool static_call) { if (static_call) { QGraphicsItem::contextMenuEvent((QGraphicsSceneContextMenuEvent* )event0); } else { contextMenuEvent((QGraphicsSceneContextMenuEvent* )event0); } }
void QStatusBar_QtDShell::__override_contextMenuEvent(QContextMenuEvent* arg__1, bool static_call) { if (static_call) { QWidget::contextMenuEvent((QContextMenuEvent* )arg__1); } else { contextMenuEvent((QContextMenuEvent* )arg__1); } }
void QFontComboBox_QtDShell::__override_contextMenuEvent(QContextMenuEvent* e0, bool static_call) { if (static_call) { QComboBox::contextMenuEvent((QContextMenuEvent* )e0); } else { contextMenuEvent((QContextMenuEvent* )e0); } }
void QAbstractPageSetupDialog_QtDShell::__override_contextMenuEvent(QContextMenuEvent* arg__1, bool static_call) { if (static_call) { QDialog::contextMenuEvent((QContextMenuEvent* )arg__1); } else { contextMenuEvent((QContextMenuEvent* )arg__1); } }
void CpaperWidget::tapAndHold(QMouseEvent * event) { #ifdef Q_OS_ANDROIS QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse,QPoint(0,0),QPoint(0,0)); #else QContextMenuEvent *cme = new QContextMenuEvent(QContextMenuEvent::Mouse,event->pos(),event->globalPos()); #endif contextMenuEvent(cme); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tOP40ConfigurationDialog::ShowContextMenu() { int i; if( SelectedWidgetIndex( i ) ) { QPoint menuPos = m_pSelWidget[i]->rect().topRight(); menuPos = m_pSelWidget[i]->mapTo( this, menuPos ); QContextMenuEvent menuEvent = QContextMenuEvent( QContextMenuEvent::Other, menuPos ); contextMenuEvent( &menuEvent ); } }
void MediaView::touchEvent(QTouchEvent *e) { switch (e->type()) { case QEvent::TouchBegin: if (_touchPress || e->touchPoints().isEmpty()) return; _touchTimer.start(QApplication::startDragTime()); _touchPress = true; _touchMove = _touchRightButton = false; _touchStart = e->touchPoints().cbegin()->screenPos().toPoint(); break; case QEvent::TouchUpdate: if (!_touchPress || e->touchPoints().isEmpty()) return; if (!_touchMove && (e->touchPoints().cbegin()->screenPos().toPoint() - _touchStart).manhattanLength() >= QApplication::startDragDistance()) { _touchMove = true; } break; case QEvent::TouchEnd: if (!_touchPress) return; if (!_touchMove && App::wnd()) { Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton); QPoint mapped(mapFromGlobal(_touchStart)), winMapped(App::wnd()->mapFromGlobal(_touchStart)); QMouseEvent pressEvent(QEvent::MouseButtonPress, mapped, winMapped, _touchStart, btn, Qt::MouseButtons(btn), Qt::KeyboardModifiers()); pressEvent.accept(); mousePressEvent(&pressEvent); QMouseEvent releaseEvent(QEvent::MouseButtonRelease, mapped, winMapped, _touchStart, btn, Qt::MouseButtons(btn), Qt::KeyboardModifiers()); mouseReleaseEvent(&releaseEvent); if (_touchRightButton) { QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart); contextMenuEvent(&contextEvent); } } else if (_touchMove) { if ((!_leftNavVisible || !_leftNav.contains(mapFromGlobal(_touchStart))) && (!_rightNavVisible || !_rightNav.contains(mapFromGlobal(_touchStart)))) { QPoint d = (e->touchPoints().cbegin()->screenPos().toPoint() - _touchStart); if (d.x() * d.x() > d.y() * d.y() && (d.x() > st::medviewSwipeDistance || d.x() < -st::medviewSwipeDistance)) { moveToPhoto(d.x() > 0 ? -1 : 1); } } } _touchTimer.stop(); _touchPress = _touchMove = _touchRightButton = false; break; case QEvent::TouchCancel: _touchPress = false; _touchTimer.stop(); break; } }
bool GoForwardActionWidget::eventFilter(QObject *object, QEvent *event) { if (event->type() == QEvent::ContextMenu) { QContextMenuEvent *contextMenuEvent(dynamic_cast<QContextMenuEvent*>(event)); if (contextMenuEvent) { QAction *action(menu()->activeAction()); if (action && action->data().type() == QVariant::Int) { QMenu contextMenu(menu()); QAction *removeEntryAction(contextMenu.addAction(tr("Remove Entry"), NULL, NULL, QKeySequence(Qt::Key_Delete))); QAction *purgeEntryAction(contextMenu.addAction(tr("Purge Entry"), NULL, NULL, QKeySequence(Qt::ShiftModifier | Qt::Key_Delete))); QAction *selectedAction(contextMenu.exec(contextMenuEvent->globalPos())); if (selectedAction == removeEntryAction) { menu()->close(); getWindow()->getContentsWidget()->removeHistoryIndex(action->data().toInt()); } else if (selectedAction == purgeEntryAction) { menu()->close(); getWindow()->getContentsWidget()->removeHistoryIndex(action->data().toInt(), true); } } } } else if (event->type() == QEvent::KeyPress) { QKeyEvent *keyEvent(dynamic_cast<QKeyEvent*>(event)); if (keyEvent && keyEvent->key() == Qt::Key_Delete && getWindow()) { QAction *action(menu()->activeAction()); if (action && action->data().type() == QVariant::Int) { menu()->close(); getWindow()->getContentsWidget()->removeHistoryIndex(action->data().toInt(), keyEvent->modifiers().testFlag(Qt::ShiftModifier)); } } } return QObject::eventFilter(object, event); }
int Tiled::Internal::CommandTreeView::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QTreeView::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: contextMenuEvent((*reinterpret_cast< QContextMenuEvent*(*)>(_a[1]))); break; case 1: handleRowsRemoved((*reinterpret_cast< const QModelIndex(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break; case 2: removeSelectedCommands(); break; default: ; } _id -= 3; } return _id; }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tPageBase::ShowContextMenu() { if ( m_pAppState ) { m_pAppState->PushDisplayState( tInstrumentState::DISPLAY_STATE_PAGE_MENU ); } QPoint menuPos = QPoint( 10, 10 ); QContextMenuEvent menuEvent = QContextMenuEvent( QContextMenuEvent::Other, menuPos ); contextMenuEvent( &menuEvent ); if ( m_pAppState ) { m_pAppState->PopDisplayState(); } }
void FlatTextarea::touchEvent(QTouchEvent *e) { switch (e->type()) { case QEvent::TouchBegin: if (_touchPress || e->touchPoints().isEmpty()) return; _touchTimer.start(QApplication::startDragTime()); _touchPress = true; _touchMove = _touchRightButton = false; _touchStart = e->touchPoints().cbegin()->screenPos().toPoint(); break; case QEvent::TouchUpdate: if (!_touchPress || e->touchPoints().isEmpty()) return; if (!_touchMove && (e->touchPoints().cbegin()->screenPos().toPoint() - _touchStart).manhattanLength() >= QApplication::startDragDistance()) { _touchMove = true; } break; case QEvent::TouchEnd: if (!_touchPress) return; if (!_touchMove && window()) { Qt::MouseButton btn(_touchRightButton ? Qt::RightButton : Qt::LeftButton); QPoint mapped(mapFromGlobal(_touchStart)), winMapped(window()->mapFromGlobal(_touchStart)); if (_touchRightButton) { QContextMenuEvent contextEvent(QContextMenuEvent::Mouse, mapped, _touchStart); contextMenuEvent(&contextEvent); } } _touchTimer.stop(); _touchPress = _touchMove = _touchRightButton = false; break; case QEvent::TouchCancel: _touchPress = false; _touchTimer.stop(); break; } }
void DhQGroupBox::DvhcontextMenuEvent(QContextMenuEvent* x1) { return contextMenuEvent(x1); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tSonarPlayer::ShowContextMenu() { QPoint menuPos = QPoint( 10, 10 ); QContextMenuEvent menuEvent = QContextMenuEvent( QContextMenuEvent::Other, menuPos ); contextMenuEvent( &menuEvent ); }
bool GoForwardActionWidget::event(QEvent *event) { if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonDblClick || event->type() == QEvent::Wheel) { QList<GesturesManager::GesturesContext> contexts; contexts << GesturesManager::ToolBarGesturesContext << GesturesManager::GenericGesturesContext; if (GesturesManager::startGesture(this, event, contexts)) { return true; } } if (event->type() == QEvent::ContextMenu) { QContextMenuEvent *contextMenuEvent(static_cast<QContextMenuEvent*>(event)); if (contextMenuEvent) { if (contextMenuEvent->reason() == QContextMenuEvent::Mouse) { contextMenuEvent->accept(); return true; } event->accept(); Window *window(getWindow()); QMenu menu(this); menu.addAction(window ? window->getContentsWidget()->getAction(ActionsManager::ClearTabHistoryAction) : ActionsManager::getAction(ActionsManager::ClearTabHistoryAction, this)); menu.addAction(window ? window->getContentsWidget()->getAction(ActionsManager::PurgeTabHistoryAction) : ActionsManager::getAction(ActionsManager::PurgeTabHistoryAction, this)); ToolBarWidget *toolBar = qobject_cast<ToolBarWidget*>(parentWidget()); if (toolBar) { menu.addSeparator(); menu.addActions(ToolBarWidget::createCustomizationMenu(toolBar->getIdentifier(), QList<QAction*>(), &menu)->actions()); } menu.exec(contextMenuEvent->globalPos()); return true; } return false; } if (event->type() == QEvent::ToolTip) { QHelpEvent *helpEvent(dynamic_cast<QHelpEvent*>(event)); if (helpEvent) { const QVector<QKeySequence> shortcuts(ActionsManager::getActionDefinition(ActionsManager::GoForwardAction).shortcuts); QString toolTip(text() + (shortcuts.isEmpty() ? QString() : QLatin1String(" (") + shortcuts.at(0).toString(QKeySequence::NativeText) + QLatin1Char(')'))); if (getWindow()) { const WindowHistoryInformation history(getWindow()->getContentsWidget()->getHistory()); if (!history.entries.isEmpty() && history.index < (history.entries.count() - 1)) { QString title(history.entries.at(history.index + 1).title); title = (title.isEmpty() ? tr("(Untitled)") : title.replace(QLatin1Char('&'), QLatin1String("&&"))); toolTip = title + QLatin1String(" (") + text() + (shortcuts.isEmpty() ? QString() : QLatin1String(" - ") + shortcuts.at(0).toString(QKeySequence::NativeText)) + QLatin1Char(')'); } } QToolTip::showText(helpEvent->globalPos(), toolTip); } return true; } return ActionWidget::event(event); }
void DhQGraphicsItemGroup::DvhcontextMenuEvent(QGraphicsSceneContextMenuEvent* x1) { return contextMenuEvent(x1); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tWeatherTextViewerDialog::ShowContextMenu() { QContextMenuEvent menuEvent = QContextMenuEvent(QContextMenuEvent::Other, mapToGlobal(pos())); contextMenuEvent(&menuEvent); }
void DhQScrollArea::DvhcontextMenuEvent(QContextMenuEvent* x1) { return contextMenuEvent(x1); }
void DhQAbstractSpinBox::DvhcontextMenuEvent(QContextMenuEvent* x1) { return contextMenuEvent(x1); }
//----------------------------------------------------------------------------- //! //----------------------------------------------------------------------------- void tTripDialog::ShowContextMenu() { QPoint menuPos = QPoint( 10, 10 ); QContextMenuEvent menuEvent = QContextMenuEvent( QContextMenuEvent::Other, menuPos ); contextMenuEvent( &menuEvent ); }
void DhQGraphicsEllipseItem::DvhcontextMenuEvent(QGraphicsSceneContextMenuEvent* x1) { return contextMenuEvent(x1); }
// Handle events on behalf of the text area. bool QsciScintillaBase::eventFilter(QObject *o, QEvent *e) { if (o != txtarea) return QWidget::eventFilter(o, e); bool used = true; switch (e->type()) { case QEvent::ContextMenu: contextMenuEvent(static_cast<QContextMenuEvent *>(e)); break; case QEvent::DragEnter: dragEnterEvent(static_cast<QDragEnterEvent *>(e)); break; case QEvent::DragLeave: dragLeaveEvent(static_cast<QDragLeaveEvent *>(e)); break; case QEvent::DragMove: dragMoveEvent(static_cast<QDragMoveEvent *>(e)); break; case QEvent::Drop: dropEvent(static_cast<QDropEvent *>(e)); break; case QEvent::MouseButtonDblClick: mouseDoubleClickEvent(static_cast<QMouseEvent *>(e)); break; case QEvent::MouseButtonPress: mousePressEvent(static_cast<QMouseEvent *>(e)); break; case QEvent::MouseButtonRelease: mouseReleaseEvent(static_cast<QMouseEvent *>(e)); break; case QEvent::MouseMove: mouseMoveEvent(static_cast<QMouseEvent *>(e)); break; case QEvent::Paint: paintEvent(static_cast<QPaintEvent *>(e)); break; case QEvent::Resize: resizeEvent(static_cast<QResizeEvent *>(e)); break; case QEvent::Wheel: { QWheelEvent *we = static_cast<QWheelEvent *>(e); setFocus(); if (we->orientation() == Horizontal || we->state() & ShiftButton) QApplication::sendEvent(hsb, we); else if (we->orientation() == Vertical) QApplication::sendEvent(vsb, we); break; } default: used = false; } return used; }
void DhQPushButton::DvhcontextMenuEvent(QContextMenuEvent* x1) { return contextMenuEvent(x1); }
void DhQSlider::DvhcontextMenuEvent(QContextMenuEvent* x1) { return contextMenuEvent(x1); }
void DhQGLWidget::DvhcontextMenuEvent(QContextMenuEvent* x1) { return contextMenuEvent(x1); }
// used only once inline PRBool nsWidget::HandleEvent( PtWidget_t *widget, PtCallbackInfo_t* aCbInfo ) { PRBool result = PR_TRUE; // call the default nsWindow proc PhEvent_t* event = aCbInfo->event; static int prevx=-1, prevy=-1, left_button_down, kwww_outbound_valid; if (event->processing_flags & Ph_CONSUMED) return PR_TRUE; switch ( event->type ) { case Ph_EV_PTR_MOTION_NOBUTTON: { PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); if( ptrev ) { if( ptrev->flags & Ph_PTR_FLAG_Z_ONLY ) break; // sometimes z presses come out of nowhere */ ///* ATENTIE */ printf( "Ph_EV_PTR_MOTION_NOBUTTON (%d %d)\n", ptrev->pos.x, ptrev->pos.y ); ScreenToWidgetPos( ptrev->pos ); InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); } } break; case Ph_EV_BUT_PRESS: { PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); /* there should be no reason to do this - mozilla should figure out how to call SetFocus */ /* this though fixes the problem with the plugins capturing the focus */ PtWidget_t *disjoint = PtFindDisjoint( widget ); if( PtWidgetIsClassMember( disjoint, PtServer ) || //mozserver PtWidgetIsClassMember( disjoint, PtContainer ) ) //TestPhEmbed PtContainerGiveFocus( widget, aCbInfo->event ); if( ptrev ) { prevx = ptrev->pos.x; prevy = ptrev->pos.y; ScreenToWidgetPos( ptrev->pos ); if( ptrev->buttons & Ph_BUTTON_SELECT ) { // Normally the left mouse button InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_DOWN ); left_button_down = 1; } else if( ptrev->buttons & Ph_BUTTON_MENU ) // the right button InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_RIGHT_BUTTON_DOWN ); else // middle button InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MIDDLE_BUTTON_DOWN ); //printf("*** Button down\n"); result = DispatchMouseEvent(theMouseEvent); // if we're a right-button-down we're trying to popup a context menu. send that event to gecko also if( ptrev->buttons & Ph_BUTTON_MENU ) { nsMouseEvent contextMenuEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); InitMouseEvent( ptrev, this, contextMenuEvent, NS_CONTEXTMENU ); result = DispatchMouseEvent( contextMenuEvent ); } } } break; case Ph_EV_BUT_RELEASE: { PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); // Update the current input group for clipboard mouse events // (mozilla only). Note that for mozserver the mouse based // (eg. Edit->Copy/Paste menu) events don't come through here. // They are sent by the voyager client app via libPtWeb.so to // do_command() in mozserver.cpp. if (sClipboard) sClipboard->SetInputGroup(event->input_group); if (event->subtype==Ph_EV_RELEASE_REAL || event->subtype==Ph_EV_RELEASE_PHANTOM) { if (ptrev) { ScreenToWidgetPos( ptrev->pos ); if ( ptrev->buttons & Ph_BUTTON_SELECT ) { // Normally the left mouse button InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP ); kwww_outbound_valid = 0; // // To be clean, let's not send multiple left button up // events. // if (!left_button_down) break; //case left_button_down = 0; } else if( ptrev->buttons & Ph_BUTTON_MENU ) // the right button InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_RIGHT_BUTTON_UP ); else // middle button InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MIDDLE_BUTTON_UP ); //printf("*** Button up %s\n", event->subtype==Ph_EV_RELEASE_PHANTOM ? "(phantom)" : ""); result = DispatchMouseEvent(theMouseEvent); } } else if (event->subtype==Ph_EV_RELEASE_OUTBOUND) { PhRect_t rect = {{0,0},{0,0}}; PhRect_t boundary = {{-10000,-10000},{10000,10000}}; //printf("*** OUTBOUND\n"); if (__progname && strcmp(__progname, "kwww") == 0) { // // In kscope we only use dragging to scroll the view. So // we don't want Mozilla to do any special drag processing, // and fake this out by immediately doing a left-button-up. // We do it at (999999,999999) so any control or link under // the pointer doesn't get activated. // ptrev->pos.x = ptrev->pos.y = 999999; InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP ); result = DispatchMouseEvent(theMouseEvent); InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); left_button_down = 0; kwww_outbound_valid = 1; // // In case we activated a combo box, do another down/up // Sending an Esc key also works. Which is better? // The mouse button method may prevent drag initiation // within (multiline?) input fields. // #if 0 InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_DOWN ); result = DispatchMouseEvent(theMouseEvent); InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP ); result = DispatchMouseEvent(theMouseEvent); #else PhKeyEvent_t kev; memset( &kev, 0, sizeof(kev) ); kev.key_cap = kev.key_sym = Pk_Escape; kev.key_flags = Pk_KF_Key_Down | Pk_KF_Cap_Valid | Pk_KF_Sym_Valid; DispatchKeyEvent( &kev, 1 ); memset( &kev, 0, sizeof(kev) ); kev.key_cap = Pk_Escape; kev.key_flags = Pk_KF_Cap_Valid; DispatchKeyEvent( &kev, 1 ); #endif } PhInitDrag( PtWidgetRid(mWidget), ( Ph_DRAG_KEY_MOTION | Ph_DRAG_TRACK | Ph_TRACK_DRAG),&rect, &boundary, aCbInfo->event->input_group , NULL, NULL, NULL, NULL, NULL); } } break; case Ph_EV_PTR_MOTION_BUTTON: { PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); if( ptrev ) { if( ptrev->flags & Ph_PTR_FLAG_Z_ONLY ) break; // sometimes z presses come out of nowhere */ #ifdef PHOTON_DND if( sDragService ) { nsDragService *d; nsIDragService *s = sDragService; d = ( nsDragService * )s; d->SetNativeDndData( widget, event ); } #endif if (!__progname || strcmp(__progname, "kwww") != 0) { // // We don't send these events in kscope. Dragging is devoted to // scrolling. // ScreenToWidgetPos( ptrev->pos ); InitMouseEvent(ptrev, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); } } } break; case Ph_EV_KEY: // Update the current input group for clipboard key events. This // covers both mozserver and mozilla. if (sClipboard) sClipboard->SetInputGroup(event->input_group); result = DispatchKeyEvent( (PhKeyEvent_t*) PhGetData( event ), 0 ); break; case Ph_EV_DRAG: { nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); switch(event->subtype) { static int is_kwww=-1; case Ph_EV_DRAG_COMPLETE: { nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event ); //printf("*** Drag complete\n"); if (is_kwww) { // Already did the button up kwww_outbound_valid = 0; prevx = prevy = -1; } else { ScreenToWidgetPos( ptrev2->pos ); InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_LEFT_BUTTON_UP ); result = DispatchMouseEvent(theMouseEvent); left_button_down = 0; } } break; case Ph_EV_DRAG_MOTION_EVENT: { PhPointerEvent_t* ptrev2 = (PhPointerEvent_t*) PhGetData( event ); //printf("*** Drag motion\n"); if (is_kwww == -1) { is_kwww = 0; if (__progname && strcmp(__progname, "kwww") == 0) is_kwww = 1; } if (is_kwww) { nsIWidget *nsw = this; nsIWidget *top_widget = nsw; if (!kwww_outbound_valid) { struct dragevent { PhEvent_t hdr; PhDragEvent_t drag; } ev; // // If the user does a drag where he releases the left mouse // button almost right away, then we will start getting // drag events even though the mouse button is not pressed! // Work around this Photon bug by cancelling the drag // ourselves. In 6.4.0 we can use PhCancelDrag() to do this. // //printf("*** CANCELLING DRAG!\n"); memset( &ev, 0, sizeof(ev) ); ev.hdr.type = Ph_EV_DRAG; ev.hdr.emitter.rid = Ph_DEV_RID; ev.hdr.flags = Ph_EVENT_INCLUSIVE | Ph_EMIT_TOWARD; ev.hdr.data_len = sizeof( ev.drag ); ev.hdr.subtype = Ph_EV_DRAG_COMPLETE; ev.hdr.input_group = aCbInfo->event->input_group; ev.drag.rid = PtWidgetRid(mWidget); ev.drag.flags = 0; PhEmit( &ev.hdr, NULL, &ev.drag ); break; //case } while (nsw) { top_widget = nsw; nsw = nsw->GetParent(); } try_again: nsIView *view = nsToolkit::GetViewFor(top_widget); if (view) { nsIViewManager* vm = view->GetViewManager(); if (vm) { nsIScrollableView* scrollView = nsnull; vm->GetRootScrollableView(&scrollView); if (scrollView) { if (prevx != -1 || prevy != -1) { // // The -1 check is to handle prevx and prevy not set // to the button press location, which happens when // you click on flash. // nsresult rc = ((nsIScrollableView_MOZILLA_1_8_BRANCH*)scrollView)->ScrollByPixels(prevx - ptrev2->pos.x, prevy - ptrev2->pos.y); //printf("*** rc %d from ScrollByPixels\n"); } } else if (top_widget != this) { // // There is no scrollable view for the top level widget. // See if there is one for the original widget. // top_widget = this; goto try_again; } } } prevx = ptrev2->pos.x; prevy = ptrev2->pos.y; } else { ScreenToWidgetPos( ptrev2->pos ); InitMouseEvent(ptrev2, this, theMouseEvent, NS_MOUSE_MOVE ); result = DispatchMouseEvent(theMouseEvent); } } break; } } break; case Ph_EV_BOUNDARY: PRUint32 evtype; switch( event->subtype ) { case Ph_EV_PTR_ENTER: case Ph_EV_PTR_ENTER_FROM_CHILD: evtype = NS_MOUSE_ENTER; break; case Ph_EV_PTR_LEAVE_TO_CHILD: case Ph_EV_PTR_LEAVE: evtype = NS_MOUSE_EXIT; break; default: evtype = 0; break; } if( evtype != 0 ) { PhPointerEvent_t* ptrev = (PhPointerEvent_t*) PhGetData( event ); nsMouseEvent theMouseEvent(PR_TRUE, 0, nsnull, nsMouseEvent::eReal); ScreenToWidgetPos( ptrev->pos ); InitMouseEvent( ptrev, this, theMouseEvent, evtype ); result = DispatchMouseEvent( theMouseEvent ); } break; } return result; }