1.50 <WebKitWindowProperties>

Class: <WebKitWindowProperties>

It derives from <GObject>.

Window properties of a <WebKitWebView>.

The content of a <WebKitWebView> can request to change certain properties of the window containing the view. This can include the x, y position of the window, the width and height but also if a toolbar, scrollbar, statusbar, locationbar should be visible to the user, and the request to show the <WebKitWebView> fullscreen.

The web-view:ready-to-show signal handler is the proper place to apply the initial window properties. Then you can monitor the <WebKitWindowProperties> by connecting to ::notify signal.

static void ready_to_show_cb (WebKitWebView *web_view, gpointer user_data)
{
    GtkWidget *window;
    WebKitWindowProperties *window_properties;
    gboolean visible;

    // Create the window to contain the WebKitWebView.
    window = browser_window_new ();
    gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (web_view));
    gtk_widget_show (GTK_WIDGET (web_view));

    // Get the WebKitWindowProperties of the web view and monitor it.
    window_properties = webkit_web_view_get_window_properties (web_view);
    g_signal_connect (window_properties, "notify::geometry",
                      G_CALLBACK (window_geometry_changed), window);
    g_signal_connect (window_properties, "notify::toolbar-visible",
                      G_CALLBACK (window_toolbar_visibility_changed), window);
    g_signal_connect (window_properties, "notify::menubar-visible",
                      G_CALLBACK (window_menubar_visibility_changed), window);

    // Apply the window properties before showing the window.
    visible = webkit_window_properties_get_toolbar_visible (window_properties);
    browser_window_set_toolbar_visible (BROWSER_WINDOW (window), visible);
    visible = webkit_window_properties_get_menubar_visible (window_properties);
    browser_window_set_menubar_visible (BROWSER_WINDOW (window), visible);

    if (webkit_window_properties_get_fullscreen (window_properties)) {
        gtk_window_fullscreen (GTK_WINDOW (window));
    } else {
        GdkRectangle geometry;

        gtk_window_set_resizable (GTK_WINDOW (window),
                                  webkit_window_properties_get_resizable (window_properties));
        webkit_window_properties_get_geometry (window_properties, &geometry);
        gtk_window_move (GTK_WINDOW (window), geometry.x, geometry.y);
        gtk_window_resize (GTK_WINDOW (window), geometry.width, geometry.height);
    }

    gtk_widget_show (window);
}

Properties

Property: window-properties:fullscreen self

Whether window will be displayed fullscreen.

Its value is a boolean.

It can only be set when the object is made, with #:fullscreen.

Property: window-properties:geometry self

The size and position of the window on the screen.

Its value is a <GdkRectangle>, or #f.

It can only be set when the object is made, with #:geometry.

Property: window-properties:locationbar-visible self

Whether the locationbar should be visible for the window.

Its value is a boolean.

It can only be set when the object is made, with #:locationbar-visible.

Property: window-properties:menubar-visible self

Whether the menubar should be visible for the window.

Its value is a boolean.

It can only be set when the object is made, with #:menubar-visible.

Property: window-properties:resizable self

Whether the window can be resized.

Its value is a boolean.

It can only be set when the object is made, with #:resizable.

Property: window-properties:scrollbars-visible self

Whether the scrollbars should be visible for the window.

Its value is a boolean.

It can only be set when the object is made, with #:scrollbars-visible.

Property: window-properties:statusbar-visible self

Whether the statusbar should be visible for the window.

Its value is a boolean.

It can only be set when the object is made, with #:statusbar-visible.

Property: window-properties:toolbar-visible self

Whether the toolbar should be visible for the window.

Its value is a boolean.

It can only be set when the object is made, with #:toolbar-visible.

Procedures

Method: window-properties:get-fullscreen? self ⇒ %return
Method: get-fullscreen? self ⇒ %return

Get whether the window should be shown in fullscreen state or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if the window should be fullscreen or #f otherwise.

Method: window-properties:get-geometry! self geometry ⇒ geometry
Method: get-geometry! self geometry ⇒ geometry

Get the geometry the window should have on the screen when shown.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

geometry

Passed, filled in, and returned: a <GdkRectangle>.

return location for the window geometry

Method: window-properties:get-locationbar-visible? self ⇒ %return
Method: get-locationbar-visible? self ⇒ %return

Get whether the window should have the locationbar visible or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if locationbar should be visible or #f otherwise.

Method: window-properties:get-menubar-visible? self ⇒ %return
Method: get-menubar-visible? self ⇒ %return

Get whether the window should have the menubar visible or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if menubar should be visible or #f otherwise.

Method: window-properties:get-resizable? self ⇒ %return
Method: get-resizable? self ⇒ %return

Get whether the window should be resizable by the user or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if the window should be resizable or #f otherwise.

Method: window-properties:get-scrollbars-visible? self ⇒ %return
Method: get-scrollbars-visible? self ⇒ %return

Get whether the window should have the scrollbars visible or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if scrollbars should be visible or #f otherwise.

Method: window-properties:get-statusbar-visible? self ⇒ %return
Method: get-statusbar-visible? self ⇒ %return

Get whether the window should have the statusbar visible or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if statusbar should be visible or #f otherwise.

Method: window-properties:get-toolbar-visible? self ⇒ %return
Method: get-toolbar-visible? self ⇒ %return

Get whether the window should have the toolbar visible or not.

self

Passed: a <WebKitWindowProperties>.

a <WebKitWindowProperties>

%return

Returned: a boolean.

#t if toolbar should be visible or #f otherwise.