void gst_gl_window_send_key_event_async (GstGLWindow * window, const char *event_type, const char *key_str) { KeyEventData *key_data = g_new0 (KeyEventData, 1); key_data->window = window; key_data->key_str = key_str; key_data->event_type = event_type; g_main_context_invoke_full (window->priv->navigation_context, G_PRIORITY_DEFAULT, (GSourceFunc) gst_gl_window_key_event_cb, key_data, (GDestroyNotify) g_free); }
void gtk_gst_paintable_queue_set_texture (GtkGstPaintable *self, GdkTexture *texture) { SetTextureInvocation *invoke; invoke = g_slice_new0 (SetTextureInvocation); invoke->paintable = g_object_ref (self); invoke->texture = g_object_ref (texture); g_main_context_invoke_full (NULL, G_PRIORITY_DEFAULT, gtk_gst_paintable_set_texture_invoke, invoke, (GDestroyNotify) set_texture_invocation_free); }
void gst_gl_window_send_mouse_event_async (GstGLWindow * window, const char *event_type, int button, double posx, double posy) { MouseEventData *mouse_data = g_new0 (MouseEventData, 1); mouse_data->window = window; mouse_data->event_type = event_type; mouse_data->button = button; mouse_data->posx = posx; mouse_data->posy = posy; g_main_context_invoke_full (window->priv->navigation_context, G_PRIORITY_DEFAULT, (GSourceFunc) gst_gl_window_mouse_event_cb, mouse_data, (GDestroyNotify) g_free); }
static void on_client_vanished (GDBusConnection *connection, const gchar *name, gpointer user_data) { InvocationClient *client; g_mutex_lock (&inv.mutex); client = g_hash_table_lookup (inv.clients, name); if (client) g_hash_table_steal (inv.clients, name); g_mutex_unlock (&inv.mutex); if (client) { g_main_context_invoke_full (NULL, G_PRIORITY_DEFAULT, on_invoke_client_disappeared, g_strdup (name), g_free); invocation_client_unref (client); } }
static void invocation_client_create (GDBusConnection *connection, const gchar *bus_name) { InvocationClient *client; g_mutex_lock (&inv.mutex); client = g_hash_table_lookup (inv.clients, bus_name); g_mutex_unlock (&inv.mutex); if (client != NULL) return; /* * Each time we see an incoming function call, keep the service alive for * that client, and each invocation of the client * * We would also like to get client credentials here and not pass client * messages into the rest of the machinery until that has completed. * Unfortunately the necessary patch in gio has not yet been merged. * * So we do an async call and if it hasn't completed by the time we need * the caller credentials, then we block and wait for it. Since it's the * system bus responding, it should respond pretty quickly. * * See invocation_client_lookup() for the waiting side of things. */ client = g_new0 (InvocationClient, 1); client->bus_name = g_strdup (bus_name); client->subject = polkit_system_bus_name_new (bus_name); client->refs = 1; client->uid_peer = ~0; client->uid_state = UID_LOADING; client->watch = g_bus_watch_name_on_connection (connection, bus_name, G_BUS_NAME_WATCHER_FLAGS_NONE, NULL, on_client_vanished, NULL, NULL); g_debug ("GetConnectionUnixUser('%s') ...", bus_name); /* * This async call in the GDBusWorker thread main context will not * be blocked by the daemon main context blocking. */ g_dbus_connection_call (connection, "org.freedesktop.DBus", /* bus name */ "/org/freedesktop/DBus", /* object path */ "org.freedesktop.DBus", /* interface */ "GetConnectionUnixUser", /* method */ g_variant_new ("(s)", bus_name), G_VARIANT_TYPE ("(u)"), G_DBUS_CALL_FLAGS_NONE, -1, /* timeout_msec */ NULL, on_get_connection_unix_user, g_strdup (bus_name)); g_mutex_lock (&inv.mutex); if (!g_hash_table_lookup (inv.clients, bus_name)) { g_hash_table_replace (inv.clients, client->bus_name, client); client = NULL; } g_mutex_unlock (&inv.mutex); if (client) { invocation_client_unref (client); } else { g_main_context_invoke_full (NULL, G_PRIORITY_DEFAULT, on_invoke_client_appeared, g_strdup (bus_name), g_free); } }