Re: [maemo-developers] gtk, gstreamer movie window = problem
Hi! I tried to solve this problem but still the same happens. I'm running program from xterm so I think I don't need osso_initialize(), and on console I don't get any error messages. This is code I'm using (I'm out of ideas what can be wrong): //main gui function gui(){ HildonProgram *app; /* Create the hildon application and setup the title */ app = HILDON_PROGRAM (hildon_program_get_instance ()); g_set_application_name (Menu Example App); /* Create HildonAppView and set it to HildonApp */ appview = HILDON_WINDOW (hildon_window_new ()); hildon_program_add_window (app, appview); /* Create menu for view */ create_menu (appview); ///box1 = gtk_hbox_new (FALSE, 0); ///box2 = gtk_vbox_new (homogeneous, spacing); ///label = gtk_label_new (Volume:); ///gtk_misc_set_alignment (GTK_MISC (label), 0, 0); ///gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0); ///gtk_widget_show (label); ///adj1 = gtk_adjustment_new (1.0, 0.0, 4.0, 0.1, 1.0, 1.0); ///g_signal_connect (G_OBJECT (adj1), value_changed,G_CALLBACK (cb_digits_scale), NULL); ///scale = gtk_vscrollbar_new (GTK_ADJUSTMENT (adj1)); ///gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0); ///gtk_box_pack_start (GTK_BOX (box1), box2, expand, fill, padding); content = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (appview), content); GstBus *bus; bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, NULL); gst_object_unref (bus); g_signal_connect (content, expose-event, G_CALLBACK (cb_expose), videosink); //gtk_box_pack_start (GTK_BOX (box1), content, TRUE, TRUE, padding); ///gtk_container_add (GTK_CONTAINER (appview), box1); ///gtk_widget_show (box1); gtk_widget_show_all (appview); g_signal_connect(G_OBJECT(appview), delete_event, G_CALLBACK(item_close_cb), NULL); } //callback functins static GstBusSyncReply create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) { XGCValues values; if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT) return GST_BUS_PASS; if (!gst_structure_has_name (message-structure, prepare-xwindow-id)) return GST_BUS_PASS; // ignore anything but 'prepare-xwindow-id' element messages content = gtk_event_box_new (); gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), content-window); return GST_BUS_DROP; } cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e) { if (GST_IS_X_OVERLAY (e) !GTK_WIDGET_NO_WINDOW (w) GTK_WIDGET_REALIZED (w)) { gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e), GDK_WINDOW_XWINDOW (w-window)); } } As described in http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gst-plugins-base-libs-gstxoverlay.html#desc you need to set it in a message handler in order to set it at the right time. This sounds indeed like the element creates the window itself instead of using the one you want. -- Kalle Vahlman, [EMAIL PROTECTED] Powered by http://movial.fi Interesting stuff at http://syslog.movial.fi -- Regards, -= Bartosz Put =- ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
Re: [maemo-developers] gtk, gstreamer movie window = problem
2006/10/26, cmonst [EMAIL PROTECTED]: Hi! I tried to solve this problem but still the same happens. I'm running program from xterm so I think I don't need osso_initialize(), and on console I don't get any error messages. Depends, if you a) have a .desktop file for it b) define a service there then you need to call it, otherwise it won't matter I guess... (in the will it be killed context). This is code I'm using (I'm out of ideas what can be wrong): //main gui function gui(){ HildonProgram *app; /* Create the hildon application and setup the title */ app = HILDON_PROGRAM (hildon_program_get_instance ()); g_set_application_name (Menu Example App); /* Create HildonAppView and set it to HildonApp */ appview = HILDON_WINDOW (hildon_window_new ()); hildon_program_add_window (app, appview); /* Create menu for view */ create_menu (appview); ///box1 = gtk_hbox_new (FALSE, 0); ///box2 = gtk_vbox_new (homogeneous, spacing); ///label = gtk_label_new (Volume:); ///gtk_misc_set_alignment (GTK_MISC (label), 0, 0); ///gtk_box_pack_start (GTK_BOX (box2), label, FALSE, FALSE, 0); ///gtk_widget_show (label); ///adj1 = gtk_adjustment_new (1.0, 0.0, 4.0, 0.1, 1.0, 1.0); ///g_signal_connect (G_OBJECT (adj1), value_changed,G_CALLBACK (cb_digits_scale), NULL); ///scale = gtk_vscrollbar_new (GTK_ADJUSTMENT (adj1)); ///gtk_box_pack_start (GTK_BOX (box2), scale, TRUE, TRUE, 0); ///gtk_box_pack_start (GTK_BOX (box1), box2, expand, fill, padding); content = gtk_event_box_new (); gtk_container_add (GTK_CONTAINER (appview), content); GstBus *bus; bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline)); gst_bus_set_sync_handler (bus, (GstBusSyncHandler) create_window, NULL); gst_object_unref (bus); g_signal_connect (content, expose-event, G_CALLBACK (cb_expose), videosink); //gtk_box_pack_start (GTK_BOX (box1), content, TRUE, TRUE, padding); ///gtk_container_add (GTK_CONTAINER (appview), box1); ///gtk_widget_show (box1); gtk_widget_show_all (appview); g_signal_connect(G_OBJECT(appview), delete_event, G_CALLBACK(item_close_cb), NULL); } //callback functins static GstBusSyncReply create_window (GstBus * bus, GstMessage * message, GstPipeline * pipeline) { XGCValues values; if (GST_MESSAGE_TYPE (message) != GST_MESSAGE_ELEMENT) return GST_BUS_PASS; if (!gst_structure_has_name (message-structure, prepare-xwindow-id)) return GST_BUS_PASS; // ignore anything but 'prepare-xwindow-id' element messages content = gtk_event_box_new (); You are creating this again here ;) gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (GST_MESSAGE_SRC (message)), content-window); You are giving the window pointer to the function, instead of the X id of it. Use the GDK_WINDOW_XID() macro to get the X window id for the window. You also need to be sure the GdkWindow of the event box is already created when you set it (otherwise the window pointer might be NULL or whatever), this can be done by calling gtk_widget_realize() on the event box. I suggest doing it just before entering the gtk main loop. cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e) { if (GST_IS_X_OVERLAY (e) !GTK_WIDGET_NO_WINDOW (w) GTK_WIDGET_REALIZED (w)) { gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e), GDK_WINDOW_XWINDOW (w-window)); } } This should be removed too, as it may conflict with the setting above (and the call to gst_x_overlay_set_xwindow_id() should happen exactly once AFAIK). -- Kalle Vahlman, [EMAIL PROTECTED] Powered by http://movial.fi Interesting stuff at http://syslog.movial.fi ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers
[maemo-developers] gtk, gstreamer movie window = problem
Hi! In my gstreamer movie player I have connected gstreamer movie window with gtk menu (gstreamer window is inside gtk app window) using this code: static void cb_expose (GtkWidget * w, GdkEventExpose * ev, GstElement * e) { if (GST_IS_X_OVERLAY (e) !GTK_WIDGET_NO_WINDOW (w) GTK_WIDGET_REALIZED (w)) { gst_x_overlay_set_xwindow_id (GST_X_OVERLAY (e), GDK_WINDOW_XWINDOW (w-window)); } } (...) g_signal_connect (content, expose-event, G_CALLBACK (cb_expose),videosink ); Everything is ok when I start app (movie window is in right place in app window) but when I click on some item on maemo system menu (right top border of the screen ) eg. volume control and I click back on my app, window with my gtk elements disappears (probably is killed) and gstreamer movie window is the only window left from my app (it looks like when you start raw pipeline with some movie, without any additional gtk elements). Do you have any ideas??? Please help me. Bart ___ maemo-developers mailing list maemo-developers@maemo.org https://maemo.org/mailman/listinfo/maemo-developers