[glib] W32: eliminate busy cursor when a rundll32-hosted child runs



commit 74b1dd87b5ff10ded5a09a10c36722aa5548ad63
Author: Руслан Ижбулатов <lrn1986 gmail com>
Date:   Fri Jan 15 22:25:32 2016 +0000

    W32: eliminate busy cursor when a rundll32-hosted child runs
    
    Even though GetStartupInfo() in g_win32_run_session_bus() would
    tell us that STARTF_FORCEONFEEDBACK flag is not set, it still
    affects the rundll32 process for some reason.
    
    This means that Windows WM changes mouse cursor to IDC_APPSTARTING for
    a few seconds when rundll32 runs g_win32_run_session_bus(). Since
    g_win32_run_session_bus() never satisfies the conditions set by
    STARTF_FORCEONFEEDBACK, the busy cursor only goes away after a
    timeout.
    
    Fix this by explicitly running GetMessage(). To ensure that GetMessage()
    doesn't block, post a quit message immediately before calling it.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=760694

 gio/gdbusaddress.c |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)
---
diff --git a/gio/gdbusaddress.c b/gio/gdbusaddress.c
index 3901b95..7c294f7 100644
--- a/gio/gdbusaddress.c
+++ b/gio/gdbusaddress.c
@@ -1355,6 +1355,25 @@ idle_timeout_cb (GDBusDaemon *daemon, gpointer user_data)
   g_main_loop_quit (loop);
 }
 
+/* Satisfies STARTF_FORCEONFEEDBACK */
+static void
+turn_off_the_starting_cursor (void)
+{
+  MSG msg;
+  BOOL bRet;
+
+  PostQuitMessage (0);
+
+  while ((bRet = GetMessage (&msg, 0, 0, 0)) != 0)
+    {
+      if (bRet == -1)
+        continue;
+
+      TranslateMessage (&msg);
+      DispatchMessage (&msg);
+    }
+}
+
 __declspec(dllexport) void CALLBACK g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int 
nCmdShow);
 
 __declspec(dllexport) void CALLBACK
@@ -1365,6 +1384,8 @@ g_win32_run_session_bus (HWND hwnd, HINSTANCE hinst, char *cmdline, int nCmdShow
   const char *address;
   GError *error = NULL;
 
+  turn_off_the_starting_cursor ();
+
   if (g_getenv ("GDBUS_DAEMON_DEBUG") != NULL)
     open_console_window ();
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]