Re: Win32 - handling mainloop while showing modal comon controls




On Apr 13, 2006, at 3:59 AM, Alexander Larsson wrote:

On Wed, 12 Apr 2006, muppet wrote:


Alexander Larsson wrote:
Its easy to post this event to the hidden window, and to catch it in the window process for gdk, but this isn't really getting us anywhere, as we were already in the window process. The problem is that we can't really call the gtk mainloop (gtk_main_iteration) from the gdk code, because gdk
doesn't link to gtk+.

That's not actually a problem.  gtk_main_iteration() is just a thin
compatibility wrapper around g_main_context_iteration(). GDK does have access
to GLib.

I guess gtk_events_pending() is the real problem.

Again, not actually a problem, as gtk_events_pending() is implemented entirely in terms of GDK_THREADS_(ENTER|LEAVE) and g_main_context_pending(), both of which you have access to in something that knows only GDK:

  gboolean
  gtk_events_pending (void)
  {
    gboolean result;

    GDK_THREADS_LEAVE ();
    result = g_main_context_pending (NULL);
    GDK_THREADS_ENTER ();

    return result;
  }

As i recall, this works because gdk events show up in the main loop from a GSource installed when GDK initializes. See gtk+/gtk/gtkmain.c.

--
Jolt is my co-pilot.
  -- Slogan on a giant paper airplane hung in Lobby 7 at MIT.
     http://hacks.mit.edu/




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