Ivan Vučica avatar Ivan Vučica committed 7e86c9d Draft

Functional X11 mainloop.

Comments (0)

Files changed (1)

 
 typedef struct _MdmEventSource
 {
+  /* 'subclassing' GSource: include everything from source */
   GSource source;
 
+  /* Also include GPollFD */
   GPollFD event_poll_fd;
 } MdmEventSource;
 
 mdm_event_source_prepare (GSource *source,
 			  gint    *timeout)
 {
-	return TRUE;
+	printf("%s\n", __PRETTY_FUNCTION__);
+		return FALSE;
 }
 static gboolean
 mdm_event_source_check (GSource *gsource)
 static void
 mdm_event_source_finalize (GSource *source)
 {
+	printf("%s\n", __PRETTY_FUNCTION__);
 }
 
-static GSourceFuncs event_funcs = {
+static GSourceFuncs mdm_event_funcs = {
   mdm_event_source_prepare,
   mdm_event_source_check,
   mdm_event_source_dispatch,
 
 	// Add X11 events into the event loop
 	//http://git.gnome.org/browse/gtk+/tree/gdk/x11/gdkeventsource.c
-#if 0
-	GSource *gsource = g_source_new(&event_funcs, sizeof(MdmEventSource));
+#if 1
+	GSource *gsource = g_source_new(&mdm_event_funcs, sizeof(MdmEventSource));
 	MdmEventSource * source = (MdmEventSource*)gsource;
 	char *name = g_strdup_printf("MDM X11 Event source (%p)", display);
+	printf("Source name: %s\n", name);
 	g_source_set_name (gsource, name);
 	g_free(name);
 
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.