rem: D (printf ("xine_thread: open display\n"));
add: D ("xine_thread: open display\n");
context: gtk_xine_realize (GtkWidget * widget){	GtkXine *gtx;	XGCValues values;	Pixmap bm_no;	g_return_if_fail (widget != NULL);	g_return_if_fail (GTK_IS_XINE (widget));	gtx = GTK_XINE (widget);	/* set realized flag */	GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);	/* create our own video window */	gtx->priv->video_window = XCreateSimpleWindow (gdk_display,			GDK_WINDOW_XWINDOW (gtk_widget_get_parent_window (widget)),			0, 0, widget->allocation.width,			widget->allocation.height, 1,			BLACK_PIXEL, BLACK_PIXEL);	widget->window = gdk_window_foreign_new (gtx->priv->video_window);	/* prepare for fullscreen playback */	gtx->priv->fullscreen_width =	    DisplayWidth (gdk_display, gdk_x11_get_default_screen ());	gtx->priv->fullscreen_height =	    DisplayHeight (gdk_display, gdk_x11_get_default_screen ());	gtx->priv->toplevel =	    GDK_WINDOW_XWINDOW (gdk_window_get_toplevel				(gtk_widget_get_parent_window (widget)));	/* track configure events of toplevel window */	g_signal_connect (GTK_OBJECT (gtk_widget_get_toplevel (widget)),			  "configure-event",			  GTK_SIGNAL_FUNC (configure_cb), gtx);	D(g_print ("xine_thread: init threads\n"));	if (!XInitThreads ()) {		g_signal_emit (G_OBJECT (gtx),				gtx_table_signals[ERROR], 1,				_("XInitThreads failed - looks like you "					"don't have a thread-safe xlib."));		return;	}	D (printf ("xine_thread: open display\n"));	gtx->priv->display = XOpenDisplay (NULL);	if (!gtx->priv->display) {		g_signal_emit (G_OBJECT (gtx),				gtx_table_signals[ERROR], 1,				_("XOpenDisplay failed"));		return;	}	XLockDisplay (gtx->priv->display);	gtx->priv->screen = DefaultScreen (gtx->priv->display);	if (XShmQueryExtension (gtx->priv->display) == True) {		gtx->priv->completion_event =		    XShmGetEventBase (gtx->priv->display) + ShmCompletion;	} else {		gtx->priv->completion_event = -1;	}	XSelectInput (gtx->priv->display, gtx->priv->video_window,		      StructureNotifyMask | ExposureMask |		      ButtonPressMask | PointerMotionMask);	/* generate and init a config "object" */	gtx->priv->configfile =	    g_strdup_printf ("%s/.xine/config", g_get_home_dir ());	gtx->priv->config = xine_config_file_init (gtx->priv->configfile);	/* load audio, video drivers */	gtx->priv->vo_driver = load_video_out_driver (gtx);	if (!gtx->priv->vo_driver) {		g_signal_emit (G_OBJECT (gtx),				gtx_table_signals[ERROR], 1,				_("couldn't open video driver"));		return;	}	gtx->priv->ao_driver = load_audio_out_driver (gtx);	/* init xine engine */	gtx->priv->xine =	    xine_init (gtx->priv->vo_driver, gtx->priv->ao_driver,		       gtx->priv->config);	values.foreground = BLACK_PIXEL;	values.background = BLACK_PIXEL;	gtx->priv->gc =	    XCreateGC (gtx->priv->display, gtx->priv->video_window,		       (GCForeground | GCBackground), &values);	XUnlockDisplay (gtx->priv->display);	/* create mouse cursors */	bm_no = XCreateBitmapFromData (gtx->priv->display,				       gtx->priv->video_window,				       bm_no_data, 8, 8);	gtx->priv->no_cursor =	    XCreatePixmapCursor (gtx->priv->display, bm_no, bm_no,				 (XColor *) & BLACK_PIXEL,				 (XColor *) & BLACK_PIXEL, 0, 0);	/* Setup xine events */	xine_register_event_listener (gtx->priv->xine, xine_event,			(void *) gtx);	/* now, create a xine thread */	pthread_create (&gtx->priv->thread, NULL, xine_thread, gtx);	return;}