summaryrefslogtreecommitdiffstats
path: root/opensuse/core/qt3/0059-qpopup_has_mouse.patch
blob: 18ae0081d8c8a82cca5bfdf82e873b52ed46dde8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
qt-bugs@ issue : 49417
bugs.kde.org number : 58719
applied: no
author: Lubos Lunak <l.lunak@kde.org>

Hello,

 please consider applying the two attached QPopupMenu patches fixing KDE bugs 
 #58719 and #74778 (http://bugs.kde.org/show_bug.cgi?id=58719, 
 http://bugs.kde.org/show_bug.cgi?id=74778), which complain about keyboard 
 navigation in popup menus being very uncomfortable because of being affected 
 by mouse position despite mouse not being used at all.
 
 - hasmouse.patch - (#58719) - use keyboard to open and navigate in any popup 
 menu and "accidentally" hit your mouse. Depending on the mouse cursor 
 position either no popup entry is selected or the random popup entry 
 happening to be at the cursor position becomes highlighted. The patch 
 basically copies the 'hasmouse' code from QMenuBar which prevents the mouse 
 having any effect on the popup if it's outside the popup geometry.

 [ ... #74778 ... ] 
 
================================================================================
--- src/widgets/qpopupmenu.cpp
+++ src/widgets/qpopupmenu.cpp
@@ -253,6 +253,7 @@
     } scroll;
     QSize calcSize;
     QRegion mouseMoveBuffer;
+    uint hasmouse : 1;
 };
 
 static QPopupMenu* active_popup_menu = 0;
@@ -272,6 +273,7 @@
     d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0;
     d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone;
     d->scroll.scrolltimer = 0;
+    d->hasmouse = 0;
     isPopupMenu	  = TRUE;
 #ifndef QT_NO_ACCEL
     autoaccel	  = 0;
@@ -1741,6 +1743,11 @@
 
     int	 item = itemAtPos( e->pos() );
     if ( item == -1 ) {				// no valid item
+        if( !d->hasmouse ) {
+            tryMenuBar( e );
+            return;
+        }
+        d->hasmouse = 0;
 	int lastActItem = actItem;
 	actItem = -1;
 	if ( lastActItem >= 0 )
@@ -1752,6 +1759,7 @@
 	}
     } else {					// mouse on valid item
 	// but did not register mouse press
+        d->hasmouse = 1;
 	if ( (e->state() & Qt::MouseButtonMask) && !mouseBtDn )
 	    mouseBtDn = TRUE; // so mouseReleaseEvent will pop down
 
@@ -2160,6 +2168,7 @@
 */
 void QPopupMenu::leaveEvent( QEvent * )
 {
+    d->hasmouse = 0;
     if ( testWFlags( WStyle_Tool ) && style().styleHint(QStyle::SH_PopupMenu_MouseTracking, this) ) {
 	int lastActItem = actItem;
 	actItem = -1;