On Tue, Aug 7, 2012 at 5:34 PM, Martin Robinson <[email protected]>wrote:
> On Tue, Aug 7, 2012 at 9:20 AM, Prasanta Sadhukhan <[email protected]> > wrote: > > > I am trying in this manner as shown below on 1.8.1 webkitgtk but I am > > getting error like below and the webpage is not displayed. > > Can anyone suggest if the above scenario can be achieved OR do we need to > > load the webpage on the main window > > After a quick look at your code, it seems that you are not realizing > the offscreen window. > > Thanks for your reply.. I am new to gtk+ programming so I probably will miss some code which are obvious to gtk experts. I modified the code to include the offscreen window realizing but still it does not display the webpage. Here's the modified code snippet (other code remain same as previous mail). I tried different ways (commented out code) but still the webpage is not displayed. Can anyone suggest what else I need to do to display offscreen contents (webpage) in main window? GtkWidget* create_offscreen_window(GtkWidget *main_window) { GtkWidget *offscr = gtk_offscreen_window_new(); // gtk_window_set_default_size(offscr, 1200, 800); return offscr; } void load_webpage(GtkWidget *main_window) { GtkWidget *offscr = create_offscreen_window(main_window); // Create a browser instance WebKitWebView *webView = WEBKIT_WEB_VIEW(webkit_web_view_new()); setProxy(); // Load a web page into the browser instance webkit_web_view_load_uri(webView, "http://www.thewildernessdowntown.com/ "); // Make sure that when the browser area becomes visible, it will get mouse // and keyboard events gtk_widget_grab_focus(GTK_WIDGET(webView)); // GtkWidget *vbox = gtk_vbox_new(FALSE, 0); // gtk_box_pack_start(GTK_BOX(vbox), GTK_WIDGET(webView), TRUE, TRUE, 0); // gtk_container_add(GTK_CONTAINER(offscr), vbox); gtk_container_add(GTK_CONTAINER(offscr), GTK_WIDGET(webview)); gtk_widget_realize(offscr); gtk_widget_show_all(offscr); GdkPixmap *pixmap = gtk_offscreen_window_get_pixmap(offscr); GtkWidget *image = gtk_image_new_from_pixmap(pixmap, NULL); gtk_container_add(GTK_CONTAINER(main_window), image); //GdkPixbuf *pixbuf = gtk_offscreen_window_get_pixbuf(offscr); //gtk_container_add(GTK_CONTAINER(main_window), GTK_WIDGET(pixbuf)); // Make sure the main window and all its contents are visible gtk_widget_show_all(main_window); // Run the main GTK+ event loop gtk_main(); } int main(int argc, char* argv[]) { GtkWidget *main_window = gtk_initialize(); load_webpage(main_window); } --Martin >
_______________________________________________ webkit-gtk mailing list [email protected] http://lists.webkit.org/mailman/listinfo/webkit-gtk
