--Boundary-00=_gCeZCMJ+Z909Rge Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline On Tuesday 19 April 2005 10:20 pm, George Staikos wrote: > On Tuesday 19 April 2005 15:33, Maksim Orlovich wrote: > > > CVS commit by pletourn: > > > > > > Don't relay the mouse release event to QPopupMenu when a context menu > > > is shown > > > > Hi... Is this attempting to fix the right-click-"oops, it got executed > > stuff"? Does this work with the hold-and-release mode? > > I had a patch for Qt for that, which TT didn't understand, it used a > > timeout; but perhaps a similar fix can be pushed into KPopupMenu > > Please, just someone, fix this already!!! It drives me crazy. Please see the attached for my old Qt patch. Don't have time ATM to apply it to qt-copy or port to kpopupmenu, though... --Boundary-00=_gCeZCMJ+Z909Rge Content-Type: text/x-diff; charset="iso-8859-1"; name="qmenu_click.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="qmenu_click.diff" --- qpopupmenu.cpp.orig 2004-05-25 12:47:30.946107720 -0400 +++ qpopupmenu.cpp 2004-05-25 12:50:29.703932400 -0400 @@ -253,6 +253,8 @@ public: } scroll; QSize calcSize; QRegion mouseMoveBuffer; + bool firstReleaseSinceShow; + QTime showTime; }; static QPopupMenu* active_popup_menu = 0; @@ -269,6 +271,7 @@ QPopupMenu::QPopupMenu( QWidget *parent, : QFrame( parent, name, WType_Popup | WNoAutoErase ) { d = new QPopupMenuPrivate; + d->firstReleaseSinceShow = FALSE; d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0; d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone; d->scroll.scrolltimer = 0; @@ -645,6 +648,8 @@ void QPopupMenu::popup( const QPoint &po #if defined(QT_ACCESSIBILITY_SUPPORT) QAccessible::updateAccessibility( this, 0, QAccessible::PopupMenuStart ); #endif + d->showTime = QTime::currentTime(); + d->firstReleaseSinceShow = TRUE; } /*! @@ -1586,6 +1591,8 @@ void QPopupMenu::closeEvent( QCloseEvent void QPopupMenu::mousePressEvent( QMouseEvent *e ) { + d->firstReleaseSinceShow = FALSE; + int sh = style().pixelMetric(QStyle::PM_PopupMenuScrollerHeight, this); if (rect().contains(e->pos()) && ((d->scroll.scrollable & QPopupMenuPrivate::Scroll::ScrollUp && e->pos().y() <= sh) || //up @@ -1631,6 +1638,16 @@ void QPopupMenu::mouseReleaseEvent( QMou // the user moved the mouse significantly if ( !parentMenu && !mouseBtDn && actItem < 0 && motion < 6 ) return; + + // if we got a release right after being shown, without getting a click, + // ignore, until enough time has passed for user to have moved the mouse + if ( d->firstReleaseSinceShow && d->showTime.elapsed() < QApplication::doubleClickInterval()/2 ) + { + d->firstReleaseSinceShow = FALSE; + return; + } + + d->firstReleaseSinceShow = FALSE; mouseBtDn = FALSE; --Boundary-00=_gCeZCMJ+Z909Rge--