[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    Re: kdelibs/kdeui
From:       Maks Orlovich <mo85 () cornell ! edu>
Date:       2005-04-20 4:54:55
Message-ID: 200504200054.56035.mo85 () cornell ! edu
[Download RAW message or body]

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...


["qmenu_click.diff" (text/x-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;
 


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic