Merge lp:~3v1n0/unity/quicklist-activate-timestamp into lp:unity

Proposed by Marco Trevisan (Treviño)
Status: Merged
Approved by: Andrea Azzarone
Approved revision: no longer in the source branch.
Merged at revision: 3209
Proposed branch: lp:~3v1n0/unity/quicklist-activate-timestamp
Merge into: lp:unity
Diff against target: 41 lines (+14/-3)
2 files modified
launcher/QuicklistMenuItem.cpp (+2/-1)
tests/test_quicklist_menu_item.cpp (+12/-2)
To merge this branch: bzr merge lp:~3v1n0/unity/quicklist-activate-timestamp
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Andrea Azzarone (community) Approve
Review via email: mp+152917@code.launchpad.net

Commit message

QuicklistMenuItem: pass the event timestamp on activate

Description of the change

When activating a quicklist we should pass the event timestamp to the clients (i.e. nautilus needs this to present the progress window properly).

Test won't pass until lp:~3v1n0/nux/buttonpress-x11-timestamp/+merge/152915 is landed

To post a comment you must log in.
Revision history for this message
Andrea Azzarone (azzar1) wrote :

LGTM.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/QuicklistMenuItem.cpp'
2--- launcher/QuicklistMenuItem.cpp 2013-02-08 14:33:35 +0000
3+++ launcher/QuicklistMenuItem.cpp 2013-03-12 14:18:22 +0000
4@@ -134,7 +134,8 @@
5 if (!_menu_item || !GetSelectable())
6 return;
7
8- dbusmenu_menuitem_handle_event(_menu_item, "clicked", nullptr, 0);
9+ auto event_time = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;
10+ dbusmenu_menuitem_handle_event(_menu_item, "clicked", nullptr, event_time);
11
12 if (!IsOverlayQuicklist())
13 {
14
15=== modified file 'tests/test_quicklist_menu_item.cpp'
16--- tests/test_quicklist_menu_item.cpp 2013-02-08 14:33:35 +0000
17+++ tests/test_quicklist_menu_item.cpp 2013-03-12 14:18:22 +0000
18@@ -164,12 +164,22 @@
19 dbusmenu_menuitem_property_set(item, DBUSMENU_MENUITEM_PROP_LABEL, "Label");
20 dbusmenu_menuitem_property_set_bool(item, DBUSMENU_MENUITEM_PROP_ENABLED, true);
21
22+ XEvent xevent;
23+ xevent.type = ButtonPress;
24+ xevent.xany.display = nux::GetGraphicsDisplay()->GetX11Display();
25+ xevent.xbutton.time = g_random_int();
26+ nux::GetGraphicsDisplay()->ProcessXEvent(xevent, true);
27+
28+ auto event_time = nux::GetGraphicsDisplay()->GetCurrentEvent().x11_timestamp;
29+ ASSERT_EQ(xevent.xbutton.time, event_time);
30+
31 nux::ObjectPtr<QuicklistMenuItemLabel> qlitem(new QuicklistMenuItemLabel(item));
32
33 bool item_activated = false;
34- glib::Signal<void, DbusmenuMenuitem*, int> signal(item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
35- [&] (DbusmenuMenuitem* menu_item, int time) {
36+ glib::Signal<void, DbusmenuMenuitem*, unsigned> signal(item, DBUSMENU_MENUITEM_SIGNAL_ITEM_ACTIVATED,
37+ [this, event_time, &item_activated] (DbusmenuMenuitem* menu_item, unsigned time) {
38 EXPECT_EQ(menu_item, item);
39+ EXPECT_EQ(time, event_time);
40 item_activated = true;
41 });
42