static gint pre_initialized = FALSE;
static gint gtk_initialized = FALSE;
static GList *current_events = NULL;
+static GThread *initialized_thread = NULL;
static GSList *main_loops = NULL; /* stack of currently executing main loops */
do_pre_parse_initialization ();
do_post_parse_initialization ();
+ initialized_thread = g_thread_self ();
+
ret = gdk_display_open_default () != NULL;
if (ret && (gtk_get_debug_flags () & GTK_DEBUG_INTERACTIVE))
return gtk_initialized;
}
+/**
+ * gtk_get_main_thread:
+ *
+ * Get the thread from which GTK+ was initialized.
+ *
+ * Returns: (transfer none): The #GThread initialized for GTK+, must not be freed
+ */
+GThread *
+gtk_get_main_thread (void)
+{
+ return initialized_thread;
+}
+
+
/**
* gtk_get_locale_direction:
*
GDK_AVAILABLE_IN_ALL
gboolean gtk_is_initialized (void);
+GDK_AVAILABLE_IN_ALL
+GThread * gtk_get_main_thread (void);
+
#ifdef G_OS_WIN32
/* Variants that are used to check for correct struct packing
static void
test_init (void)
{
+ GThread *self = g_thread_self ();
+
g_assert (gtk_is_initialized () == FALSE);
+ g_assert (gtk_get_main_thread () == NULL);
+
g_assert (gtk_init_check ());
g_assert (gtk_is_initialized () == TRUE);
+
+ g_assert (gtk_get_main_thread () == self);
}
int