Merge lp:~mardy/unity-2d/menu-handling into lp:unity-2d

Proposed by Alberto Mardegan
Status: Merged
Approved by: Florian Boucault
Approved revision: 659
Merged at revision: 661
Proposed branch: lp:~mardy/unity-2d/menu-handling
Merge into: lp:unity-2d
Diff against target: 35 lines (+24/-1)
1 file modified
libunity-2d-private/src/indicatorsmanager.cpp (+24/-1)
To merge this branch: bzr merge lp:~mardy/unity-2d/menu-handling
Reviewer Review Type Date Requested Status
Florian Boucault (community) Approve
Review via email: mp+72574@code.launchpad.net

Description of the change

[panel] IndicatorsManager: deliver synthetic mouse motion events to Qt

By feeding mouse motion events to Qt while the panel-service is grabbing the
mouse, we ensure that Qt can generate correct enter/leave events for the panel
widgets (and especially for the IndicatorEntry widgets).

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

Fixes all 4 bugs as advertised.
Great job!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libunity-2d-private/src/indicatorsmanager.cpp'
2--- libunity-2d-private/src/indicatorsmanager.cpp 2011-08-22 09:17:03 +0000
3+++ libunity-2d-private/src/indicatorsmanager.cpp 2011-08-23 13:48:43 +0000
4@@ -124,7 +124,30 @@
5 {
6 // Called by m_mouseTrackerTimer to implement mouse scrubbing
7 // (Assuming item A menu is opened, move mouse over item B => item B menu opens)
8- QWidget* widget = QApplication::widgetAt(QCursor::pos());
9+ // Also, delivers motion events to Qt, which will generate correct
10+ // enter/leave events for IndicatorEntry widgets.
11+ QPoint pos = QCursor::pos();
12+ QWidget* widget = QApplication::widgetAt(pos);
13+ Display* display = QX11Info::display();
14+
15+ QPoint relPos = widget != 0 ? widget->mapFromGlobal(pos) : pos;
16+ XMotionEvent event = {
17+ MotionNotify,
18+ 0,
19+ False,
20+ display,
21+ widget != 0 ? widget->effectiveWinId() : 0,
22+ widget != 0 ? RootWindow(display, widget->x11Info().screen()) : 0,
23+ 0,
24+ CurrentTime,
25+ pos.x(), pos.y(),
26+ relPos.x(), relPos.y(),
27+ 0,
28+ False,
29+ True
30+ };
31+ qApp->x11ProcessEvent(reinterpret_cast<XEvent*>(&event));
32+
33 IndicatorEntryWidget* entryWidget = qobject_cast<IndicatorEntryWidget*>(widget);
34 if (!entryWidget) {
35 return;

Subscribers

People subscribed via source and target branches