diff options
author | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-10-15 02:33:21 (GMT) |
---|---|---|
committer | Marco Pesenti Gritti <mpgritti@gmail.com> | 2008-10-15 02:33:21 (GMT) |
commit | fe68d402ad560edd6bdb265a14cbd80b5f281ca7 (patch) | |
tree | 4d93a16ab81ac808742301c0bafedd063f10e53e /src/hulahop-web-view.cpp | |
parent | d3fd80482ca4807c911173c50cc7b8ad2917fa4a (diff) |
Better way to map from dom window to view.
Give up on trying to allow to user the view before
it's realized, it's just not possible to do it with
current mozilla implementation.
Diffstat (limited to 'src/hulahop-web-view.cpp')
-rw-r--r-- | src/hulahop-web-view.cpp | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/src/hulahop-web-view.cpp b/src/hulahop-web-view.cpp index eee333d..2317823 100644 --- a/src/hulahop-web-view.cpp +++ b/src/hulahop-web-view.cpp @@ -123,9 +123,12 @@ hulahop_web_view_realize(GtkWidget *widget) widget->style = gtk_style_attach (widget->style, widget->window); gtk_style_set_background(widget->style, widget->window, GTK_STATE_NORMAL); - g_assert(GTK_IS_WIDGET(web_view->mozilla_widget)); - - gtk_widget_reparent(web_view->mozilla_widget, widget); + if (web_view->mozilla_widget) { + gtk_widget_reparent(web_view->mozilla_widget, widget); + } else { + web_view->base_window->Create(); + web_view->mozilla_widget = GTK_BIN(web_view)->child; + } g_signal_connect_object(web_view->mozilla_widget, "focus-in-event", @@ -248,9 +251,9 @@ hulahop_web_view_init(HulahopWebView *web_view) web_view->base_window = do_QueryInterface(web_view->browser); - rv = web_view->base_window->InitWindow(web_view->offscreen_window, - nsnull, 0, 0, 100, 100); - g_assert(NS_SUCCEEDED(rv)); + rv = web_view->base_window->InitWindow(web_view, nsnull, 0, 0, 100, 100); + + GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(web_view), GTK_NO_WINDOW); } PyObject * @@ -281,19 +284,6 @@ hulahop_web_view_get_window_root(HulahopWebView *web_view) } void -hulahop_web_view_create_window(HulahopWebView *web_view) -{ - nsresult rv; - - rv = web_view->base_window->Create(); - g_assert(NS_SUCCEEDED(rv)); - - web_view->mozilla_widget = GTK_BIN(web_view->offscreen_window)->child; - - GTK_WIDGET_UNSET_FLAGS(GTK_WIDGET(web_view), GTK_NO_WINDOW); -} - -void hulahop_web_view_grab_focus(HulahopWebView *web_view) { if (web_view->mozilla_widget) { |