Merge lp:~unity-team/unity/show-menu-later into lp:unity

Proposed by Neil J. Patel
Status: Merged
Merged at revision: 633
Proposed branch: lp:~unity-team/unity/show-menu-later
Merge into: lp:unity
Diff against target: 91 lines (+52/-15)
1 file modified
src/IndicatorObjectFactoryRemote.cpp (+52/-15)
To merge this branch: bzr merge lp:~unity-team/unity/show-menu-later
Reviewer Review Type Date Requested Status
Jason Smith (community) Approve
Review via email: mp+41858@code.launchpad.net

Description of the change

Due to timing issues on slower systems, the current way of relying on one XFlush to make sure X honors our ungrab pointer request isn't good enough. This update pushes the calling of the dbus method to the end of the main iteration, and gives us a chance to XFlush twice, which works on those systems (tested on two affected systems: netbook (njpatel) and desktop (didrocks)).

Main thing to test here is that it hasn't broken opening menus for you. There are no tests because we can't test something like this right now.

To post a comment you must log in.
Revision history for this message
Jason Smith (jassmith) wrote :

+1, works here

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/IndicatorObjectFactoryRemote.cpp'
--- src/IndicatorObjectFactoryRemote.cpp 2010-11-17 20:12:42 +0000
+++ src/IndicatorObjectFactoryRemote.cpp 2010-11-25 13:10:03 +0000
@@ -33,8 +33,17 @@
33#define S_PATH "/com/canonical/Unity/Panel/Service"33#define S_PATH "/com/canonical/Unity/Panel/Service"
34#define S_IFACE "com.canonical.Unity.Panel.Service"34#define S_IFACE "com.canonical.Unity.Panel.Service"
3535
3636typedef struct
37// Enums37{
38 GDBusProxy *proxy;
39 gchar *entry_id;
40 int x;
41 int y;
42 guint timestamp;
43 guint32 button;
44
45} ShowEntryData;
46
3847
39// Forwards48// Forwards
40static void on_proxy_ready_cb (GObject *source,49static void on_proxy_ready_cb (GObject *source,
@@ -125,6 +134,35 @@
125 this);134 this);
126}135}
127136
137static gboolean
138send_show_entry (ShowEntryData *data)
139{
140 g_return_val_if_fail (data != NULL, FALSE);
141 g_return_val_if_fail (G_IS_DBUS_PROXY (data->proxy), FALSE);
142
143 /* Re-flush 'cos X is crap like that */
144 Display* d = nux::GetThreadGLWindow()->GetX11Display();
145 XFlush (d);
146
147 g_dbus_proxy_call (data->proxy,
148 "ShowEntry",
149 g_variant_new ("(suiii)",
150 data->entry_id,
151 0,
152 data->x,
153 data->y,
154 data->button),
155 G_DBUS_CALL_FLAGS_NONE,
156 -1,
157 NULL,
158 NULL,
159 NULL);
160
161 g_free (data->entry_id);
162 g_slice_free (ShowEntryData, data);
163 return FALSE;
164}
165
128void166void
129IndicatorObjectFactoryRemote::OnShowMenuRequestReceived (const char *entry_id,167IndicatorObjectFactoryRemote::OnShowMenuRequestReceived (const char *entry_id,
130 int x,168 int x,
@@ -136,19 +174,18 @@
136 XUngrabPointer(d, CurrentTime);174 XUngrabPointer(d, CurrentTime);
137 XFlush (d);175 XFlush (d);
138176
139 g_dbus_proxy_call (_proxy,177 // We have to do this because on certain systems X won't have time to
140 "ShowEntry",178 // respond to our request for XUngrabPointer and this will cause the
141 g_variant_new ("(suiii)",179 // menu not to show
142 entry_id,180 ShowEntryData *data = g_slice_new0 (ShowEntryData);
143 0,181 data->proxy = _proxy;
144 x,182 data->entry_id = g_strdup (entry_id);
145 y,183 data->x = x;
146 button),184 data->y = y;
147 G_DBUS_CALL_FLAGS_NONE,185 data->timestamp = timestamp;
148 -1,186 data->button = button;
149 NULL,187
150 NULL,188 g_timeout_add (0, (GSourceFunc)send_show_entry, data);
151 NULL);
152189
153 // --------------------------------------------------------------------------190 // --------------------------------------------------------------------------
154 // FIXME: This is a workaround until the non-paired events issue is fixed in191 // FIXME: This is a workaround until the non-paired events issue is fixed in