From d14d10a3d6e714dc312fd2d629d352b423623f7d Mon Sep 17 00:00:00 2001 From: jstebbins Date: Wed, 21 Apr 2010 18:40:13 +0000 Subject: LinGui: fix possible live preview failure with gtk 2.18 according to the doc's you must call gdk_window_ensure_native() before getting the X11 XID for the window. this is the only way to guarantee that the window is native and has an XID. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3249 b64f7644-9d1e-0410-96f1-a4d463321fa5 --- gtk/src/preview.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'gtk') diff --git a/gtk/src/preview.c b/gtk/src/preview.c index 4ed717bb1..fc713f6d2 100644 --- a/gtk/src/preview.c +++ b/gtk/src/preview.c @@ -164,6 +164,18 @@ ghb_preview_init(signal_user_data_t *ud) GstBus *bus; GstElement *xover; +#if GTK_CHECK_VERSION(2,18,0) + if (!gdk_window_ensure_native(ud->preview->view->window)) + { + g_message("Couldn't create native window for GstXOverlay. Disabling live preview."); + GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box"); + gtk_widget_hide (widget); + widget = GHB_WIDGET(ud->builder, "live_preview_duration_box"); + gtk_widget_hide (widget); + return; + } +#endif + #if !defined(_WIN32) ud->preview->xid = GDK_DRAWABLE_XID(ud->preview->view->window); #else @@ -175,6 +187,7 @@ ghb_preview_init(signal_user_data_t *ud) xover = gst_element_factory_make("gconfvideosink", "xover"); if (ud->preview->play == NULL || xover == NULL) { + g_message("Couldn't initialize gstreamer. Disabling live preview."); GtkWidget *widget = GHB_WIDGET(ud->builder, "live_preview_box"); gtk_widget_hide (widget); widget = GHB_WIDGET(ud->builder, "live_preview_duration_box"); -- cgit v1.2.3