How to redraw the blanked section of a widget after a expose-event?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi experts,

I am using GTK+ and gstreamer to capture and show the video frames, I created a drawable widget using gtk_drawing_area_new() and using xvimage element of gstreamer to render the video, I also connected them by a gstreamer function gst_x_overlay_set_xwindow_id(), so the video frames rendered  by xvimage can show in the widget, now it works well.

But I encounter a problem that if part of the drawable widget being covered by a menu or something, when the menu disappears, the covered section keeps blank, even other part of the widget still show the video.

I try to write a function expose_cb() and connect it with the signal "expose-event", in that function I call gst_x_overlay_set_xwindow_id()
again and also gtk_widget_show_all(), but it seems still not work. cos it's showing a video so I cannot save some image and redraw it again
after it exposes.

Anyone can help me? how should I do in the expose_cb or something else?
Thanks a lot
below is part of the source code
-----------------------------------------------------------------------------------------
static gboolean expose_cb(GtkWidget * widget, GdkEventExpose * event, gpointer data)
{
    gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(data),
                                  GDK_WINDOW_XWINDOW(widget->window));
    gtk_widget_show_all(widget);
}

int main()
{
...
  gstreamer_main_video_image = gtk_drawing_area_new();
...
  screen_sink = gst_bin_get_by_name (GST_BIN (appdata.bin), "screensink");
...
  gst_x_overlay_set_xwindow_id(GST_X_OVERLAY(screen_sink),
    GDK_WINDOW_XWINDOW(gstreamer_main_video_image->window));
   g_signal_connect(gstreamer_main_video_image, "expose-event", G_CALLBACK(expose_cb),
                             screen_sink);
  gtk_widget_show_all(gstreamer_window);
...
}
------------------------------------------------------------
Krist.

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux