# HG changeset patch # User leo_sobral # Date 1187274241 -3600 # Node ID 215c45290ce3bb45040768e57857f0761b7c725f # Parent add4025ca67811e32178614334c12faee7409eae [svn r814] Added x error handling to playbin maemo diff -r add4025ca678 -r 215c45290ce3 gst-gmyth/playbinmaemo/gstplaybinmaemo.c --- a/gst-gmyth/playbinmaemo/gstplaybinmaemo.c Thu Aug 16 14:46:11 2007 +0100 +++ b/gst-gmyth/playbinmaemo/gstplaybinmaemo.c Thu Aug 16 15:24:01 2007 +0100 @@ -89,6 +89,8 @@ static gboolean add_element (GstPlayBinMaemo *pbm, GstElement *child); static void clear_elements (GstPlayBinMaemo *pbm); +static int x_error_handler (Display *display, + XErrorEvent *event); GST_BOILERPLATE(GstPlayBinMaemo, gst_play_bin_maemo, GstPipeline, GST_TYPE_PIPELINE) @@ -874,12 +876,12 @@ if ((pbm->video_sink != NULL) && (pbm->xid != -1) && (GST_IS_X_OVERLAY (pbm->video_sink))) { - Display *display; g_object_set (G_OBJECT (pbm->video_sink), "force-aspect-ratio", TRUE, NULL); display = XOpenDisplay(NULL); XMapRaised(display, pbm->xid); + XSetErrorHandler(x_error_handler); XSync (display, FALSE); gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (pbm->video_sink), @@ -887,6 +889,28 @@ } } +static int +x_error_handler(Display *display, XErrorEvent *event) +{ + g_debug ("In x error handler:"); + + switch (event->error_code) { + case BadWindow: + g_debug ("got bad window"); + break; + case BadDrawable: + g_debug ("got bad drawable"); + break; + case BadGC: + g_debug ("got bad gc"); + break; + default: + g_debug ("unhandled x error = %d", event->error_code); + } + + return 0; +} + static gboolean add_element (GstPlayBinMaemo *pbm, GstElement *child)