Example #1
0
static int
gu_start(ui_t *ui, prop_t *root, int argc, char **argv, int primary)
{
  gtk_ui_t *gu = calloc(1, sizeof(gtk_ui_t));

  XInitThreads();

  hts_mutex_init(&gu_mutex);

  g_thread_init(NULL);

  gdk_threads_set_lock_functions(gu_enter, gu_leave);

  gdk_threads_init();
  gdk_threads_enter();

  gtk_init(&argc, &argv);

  gu_pixbuf_init();

  gu->gu_pc = prop_courier_create_thread(&gu_mutex, "GU");

  gu_win_create(gu, prop_create(prop_get_global(), "nav"), 1);

  /* Init popup controller */
  gu_popup_init(gu);

  gtk_main();
  return 0;
}
void
rb_threads_init (void)
{
	GMutex *m;

	private_is_primary_thread = g_private_new (NULL);
	g_private_set (private_is_primary_thread, GUINT_TO_POINTER (1));

	g_static_rec_mutex_init (&rb_gdk_mutex);
	gdk_threads_set_lock_functions (_threads_enter, _threads_leave);
	gdk_threads_init ();

	m = g_mutex_new ();

	g_mutex_lock (m);
	mutex_recurses = g_mutex_trylock (m);
	if (mutex_recurses)
		g_mutex_unlock (m);
	g_mutex_unlock (m);
	g_mutex_free (m);

	rb_debug ("GMutex %s recursive", mutex_recurses ? "is" : "isn't");

	/* purge useless thread-pool threads occasionally */
	g_timeout_add_seconds (30, purge_useless_threads, NULL);
}
/**
 * Save a reference to the lock object on the Java side, and then register our
 * custom lock functions. This function also initializes  GLib's thread
 * mechanism; which call needs to be the _very_ first thing in a GLib program
 * these days.
 */
void
bindings_java_threads_init
(
	JNIEnv *env,
	jobject obj
)
{
	// must be first GLib call!
	g_thread_init(NULL);

	// now get about setting up GDK's threads
	lock = (*env)->NewGlobalRef(env, obj);

	gdk_threads_set_lock_functions(bindings_java_threads_lock, bindings_java_threads_unlock);
	gdk_threads_init();
}
Example #4
0
void
gu_init(int *argc, char ***argv)
{
    XInitThreads();

    hts_mutex_init(&gu_mutex);

    g_thread_init(NULL);

    gdk_threads_set_lock_functions(gu_enter, gu_leave);

    gdk_threads_init();
    gdk_threads_enter();

    gtk_init(argc, argv);

    gu_pixbuf_init();

}
Example #5
0
/**
 * Linux main
 */
int
main(int argc, char **argv)
{
    gconf.binary = argv[0];

    posix_init();

    XInitThreads();
    hts_mutex_init(&gdk_mutex);

    g_thread_init(NULL);
    gdk_threads_set_lock_functions(gdk_obtain, gdk_release);

    gdk_threads_init();
    gdk_threads_enter();
    gtk_init(&argc, &argv);

    parse_opts(argc, argv);

    linux_init();

    main_init();

    if(gconf.ui && !strcmp(gconf.ui, "gu"))
        ui_wanted = &ui_gu;

    glibcourier = glib_courier_create(g_main_context_default());

    prop_subscribe(0,
                   PROP_TAG_NAME("global", "eventSink"),
                   PROP_TAG_CALLBACK_EVENT, linux_global_eventsink, NULL,
                   PROP_TAG_COURIER, glibcourier,
                   NULL);

    add_xdg_paths();

    mainloop();

    main_fini();

    arch_exit();
}
Example #6
0
void InitGtkApp(int argc, char **argv, const char **envptr)
{
	LLOG(rmsecs() << " InitGtkApp");
#ifdef _MULTITHREADED
#if !GLIB_CHECK_VERSION(2, 32, 0)
    if(!g_thread_supported())
        g_thread_init(NULL);
#endif
	gdk_threads_set_lock_functions(EnterGuiMutex, LeaveGuiMutex);
	gdk_threads_init();
	EnterGuiMutex();
#endif
	gtk_init(&argc, &argv);
	Ctrl::GlobalBackBuffer();
	Ctrl::ReSkin();
	g_timeout_add(20, (GSourceFunc) Ctrl::TimeHandler, NULL);
	InstallPanicMessageBox(Ctrl::PanicMsgBox);
	gdk_window_add_filter(NULL, Ctrl::RootKeyFilter, NULL);
#if CATCH_ERRORS
	g_log_set_default_handler (CatchError, 0);
#endif
}