summaryrefslogtreecommitdiffstats
path: root/opensuse/core/qt3/0060-qpopup_ignore_mousepos.patch
blob: 50d48bd35eb9a975afce71e30966f4ce23e43a25 (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
qt-bugs@ issue : 49417
bugs.kde.org number : 74778
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.

  [... #58719 ... ]
  
  - ignoremousepos.patch - (#74778) - use keyboard to open some popup which 
  doesn't show up at mouse position (e.g. Alt+F3 with KWin or the context menu 
  key with some file selected in Konqueror). If the mouse is positioned in the 
  area where the popup shows, the random entry happening to be at the cursor 
  position becomes highlighted.
  The patch fixes this by ignoring mouse events that happen at mouse position 
  which was current when the popup was shown, i.e. all mouse move events that 
  actually aren't triggered by mouse move are ignored. I first wanted to ignore 
  only the very first mouse move event (which should be caused by EnterNotify 
  for the popup) but I realized that Qt's event handling causes the popup to 
  possibly get more than just one initial move event, caused by LeaveNotify 
  events for normal widgets being transformed to mouse move events for the 
  popup, so I have no better idea how to solve this problem.
   
================================================================================
--- src/widgets/qpopupmenu.cpp
+++ src/widgets/qpopupmenu.cpp
@@ -254,6 +254,7 @@
     QSize calcSize;
     QRegion mouseMoveBuffer;
     uint hasmouse : 1;
+    QPoint ignoremousepos;
 };
 
 static QPopupMenu* active_popup_menu = 0;
@@ -1356,6 +1357,7 @@
     popupActive = -1;
     if(style().styleHint(QStyle::SH_PopupMenu_SubMenuPopupDelay, this))
 	d->mouseMoveBuffer = QRegion();
+    d->ignoremousepos = QCursor::pos();
 }
 
 /*!
@@ -1703,6 +1705,11 @@
 
 void QPopupMenu::mouseMoveEvent( QMouseEvent *e )
 {
+    if( e->globalPos() == d->ignoremousepos ) {
+        return;
+    }
+    d->ignoremousepos = QPoint();
+
     motion++;
 
     if ( parentMenu && parentMenu->isPopupMenu ) {