[webkit-gtk] rendering browser on offscreen surface/window
psadhukhan at gmail.com
Wed Aug 8 01:48:37 PDT 2012
On Tue, Aug 7, 2012 at 5:34 PM, Martin Robinson <mrobinson at webkit.org>wrote:
> On Tue, Aug 7, 2012 at 9:20 AM, Prasanta Sadhukhan <psadhukhan at gmail.com>
> > 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);
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());
// Load a web page into the browser instance
// Make sure that when the browser area becomes visible, it will get
// and keyboard events
// 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);
GdkPixmap *pixmap = gtk_offscreen_window_get_pixmap(offscr);
GtkWidget *image = gtk_image_new_from_pixmap(pixmap, NULL);
//GdkPixbuf *pixbuf = gtk_offscreen_window_get_pixbuf(offscr);
// Make sure the main window and all its contents are visible
// Run the main GTK+ event loop
int main(int argc, char* argv)
GtkWidget *main_window = gtk_initialize();
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-gtk