static gboolean clutter_event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { ClutterBackend *backend = ((ClutterEventSource *) source)->backend; ClutterEvent *event; clutter_threads_enter (); /* Grab the event(s), translate and figure out double click. * The push onto queue (stack) if valid. */ events_queue (backend); /* Pop an event off the queue if any */ event = clutter_event_get (); if (event) { /* forward the event into clutter for emission etc. */ clutter_do_event (event); clutter_event_free (event); } clutter_threads_leave (); return TRUE; }
static gboolean clutter_event_dispatch (GSource *source, GSourceFunc callback, gpointer user_data) { ClutterBackendX11 *backend = ((ClutterEventSource *) source)->backend; ClutterEvent *event; _clutter_threads_acquire_lock (); /* Grab the event(s), translate and figure out double click. * The push onto queue (stack) if valid. */ events_queue (backend); /* Pop an event off the queue if any */ event = clutter_event_get (); if (event != NULL) { /* forward the event into clutter for emission etc. */ _clutter_stage_queue_event (event->any.stage, event, FALSE); } _clutter_threads_release_lock (); return TRUE; }
void *events_clientize(void *param) { logprintf(LOG_STACK, "%s(...)", __FUNCTION__); unsigned int failures = 0; while(loop && failures <= 5) { struct ssdp_list_t *ssdp_list = NULL; int standalone = 0; settings_find_number("standalone", &standalone); if(ssdp_seek(&ssdp_list) == -1 || standalone == 1) { logprintf(LOG_DEBUG, "no pilight ssdp connections found"); char server[16] = "127.0.0.1"; if((sockfd = socket_connect(server, (unsigned short)socket_get_port())) == -1) { logprintf(LOG_DEBUG, "could not connect to pilight-daemon"); failures++; continue; } } else { if((sockfd = socket_connect(ssdp_list->ip, ssdp_list->port)) == -1) { logprintf(LOG_DEBUG, "could not connect to pilight-daemon"); failures++; continue; } } if(ssdp_list) { ssdp_free(ssdp_list); } struct JsonNode *jclient = json_mkobject(); struct JsonNode *joptions = json_mkobject(); json_append_member(jclient, "action", json_mkstring("identify")); json_append_member(joptions, "config", json_mknumber(1, 0)); json_append_member(jclient, "options", joptions); json_append_member(jclient, "media", json_mkstring("all")); char *out = json_stringify(jclient, NULL); socket_write(sockfd, out); json_free(out); json_delete(jclient); if(socket_read(sockfd, &recvBuff, 0) != 0 || strcmp(recvBuff, "{\"status\":\"success\"}") != 0) { failures++; continue; } failures = 0; while(loop) { if(socket_read(sockfd, &recvBuff, 0) != 0) { break; } else { events_queue(recvBuff); } } } if(recvBuff) { FREE(recvBuff); recvBuff = NULL; } socket_close(sockfd); return 0; }