### Class

# WPEPlatform View

#### Description

    abstract class WPEPlatform.View : GObject.Object
    {
      WPEViewPrivate* priv
    }

No description available.

#### Ancestors

- GObject

#### Constructors

###### wpe_view_new

Create a new `WPEView` for `display`.

#### Instance methods

###### wpe_view_buffer_released

Emit `WPEView::buffer-released` signal to notify that `buffer` is no longer used and can be destroyed or reused.

###### wpe_view_buffer_rendered

Emit `WPEView::buffer-rendered` signal to notify that `buffer` has been rendered.

###### wpe_view_closed

Emit `WPEView::closed` signal if `view` is not already closed.

###### wpe_view_compute_press_count

Compute the number of presses for a button press event.

###### wpe_view_event

Emit `WPEView::event` signal to notify about `event`.

###### wpe_view_focus_in

Make `view` gain the keyboard focus.

###### wpe_view_focus_out

Make `view` lose the keyboard focus.

###### wpe_view_get_accessible

Get the `WPEViewAccessible` of `view`.

###### wpe_view_get_display

Get the `WPEDisplay` of `view`.

###### wpe_view_get_gesture_controller

Get the `WPEGestureController` of `view`.

###### wpe_view_get_has_focus

Get whether `view` has the keyboard focus.

###### wpe_view_get_height

Get the `view` height in logical coordinates.

###### wpe_view_get_mapped

Get whether `view` is mapped. A `WPEView` isa mapped if `WPEView:visible` is `TRUE` and it’s not hidden for other reasons, like for example when its toplevel is minimized. You can connect to notify::mapped signal of `view` to monitor the visibility.

###### wpe_view_get_preferred_dma_buf_formats

Get the list of preferred DMA-BUF buffer formats for `view`.

###### wpe_view_get_scale

Get the `view` scale.

###### wpe_view_get_screen

Get current `WPEScreen` of `view`.

###### wpe_view_get_toplevel

Get the `WPEToplevel` of `view`.

###### wpe_view_get_toplevel_state

Get the current state of `view`‘s toplevel.

###### wpe_view_get_visible

Get the visibility of `view`. This might return `TRUE` even if the view is not mapped, for example when it’s minimized.

###### wpe_view_get_width

Get the `view` width in logical coordinates.

###### wpe_view_lock_pointer

Disable the movements of the pointer in `view`, locking it to a particular area; while the pointer is locked, mouse events are relative instead of absolute motions.

###### wpe_view_map

Make `view` to be mapped. If `WPEView:visible` is `TRUE` and the view can be shown (determined by `WPEViewClass::can_be_mapped`) `WPEView:mapped` will be set to `TRUE`.

###### wpe_view_render_buffer

Render the given `buffer` into `view`. If this function returns `TRUE` you must call `wpe_view_buffer_rendered()` when the buffer is rendered and `wpe_view_buffer_released()` when it’s no longer used by the view.

###### wpe_view_resized

Update `view` size and emit `WPEView::resized` if size changed.

###### wpe_view_set_cursor_from_bytes

Set the `view` cursor from the given `bytes`. Pixel format must be `WPE_PIXEL_FORMAT_ARGB8888`.

###### wpe_view_set_cursor_from_name

Set the `view` cursor by looking up `name` in the current cursor theme.

###### wpe_view_set_gesture_controller

Set `controller` as `WPEGestureController` of `view`. When supplied with `NULL`, the default `WPEGestureController` will be removed and thus default gesture handling will be disabled for the `view`.

###### wpe_view_set_opaque_rectangles

Set the rectangles of `view` that contain opaque content. This is an optimization hint that is automatically set by WebKit when the web view background color is opaque.

###### wpe_view_set_toplevel

Set the current toplevel of `view`. If `toplevel` has already reached the maximum number of views (see wpe_toplevel_get_max_views()) this function does nothing.

###### wpe_view_set_visible

Set the visibility of `view`. See `WPEView:visible` property for more information.

###### wpe_view_unlock_pointer

Unlock the pointer in `view` if it has been locked.

###### wpe_view_unmap

Make `view` to be unmapped. This always sets the `WPEView:mapped` property to `FALSE` and the `view` is considered to be hidden even if `WPEView:visible` is `TRUE`.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### WPEPlatform.View:display

The `WPEDisplay` of the view.

###### WPEPlatform.View:has-focus

Whether the view has the keyboard focus.

###### WPEPlatform.View:height

The view height in logical coordinates.

###### WPEPlatform.View:mapped

Whether the view is mapped or not. A view is mapped when `WPEView:visible` is `TRUE` and it’s not hidden for other reasons, like for example when its toplevel is minimized. This is a readonly property that can be used to monitor when a `WPEView` is shown or hidden.

###### WPEPlatform.View:scale

The view scale.

###### WPEPlatform.View:screen

The current `WPEScreen` of the view.

###### WPEPlatform.View:toplevel

The `WPEToplevel` of the view.

###### WPEPlatform.View:toplevel-state

The view’s toplevel state.

###### WPEPlatform.View:visible

Whether the view should be visible or not. This property can be used to show or hide a view, but setting to `TRUE` (which is the default) doesn’t mean it will always be shown, because the visbility also depends on the status of its toplevel (for example if the toplevel is minimized the view will be hidden). To know whether the view is actually visible, you can check `WPEView:mapped` property.

###### WPEPlatform.View:width

The view width in logical coordinates.

#### Signals

###### WPEPlatform.View::buffer-released

Emitted to notify that the buffer is no longer used by the view and can be destroyed or reused.

###### WPEPlatform.View::buffer-rendered

Emitted to notify that the buffer has been rendered in the view.

###### WPEPlatform.View::closed

Emitted when `view` has been closed.

###### WPEPlatform.View::event

Emitted when an input event is received on `view`.

###### WPEPlatform.View::preferred-dma-buf-formats-changed

Emitted when the list of preferred DMA-BUF formats has changed. This can happen whe the `view` becomes a candidate for scanout.

###### WPEPlatform.View::resized

Emitted when `view` is resized.

###### WPEPlatform.View::toplevel-state-changed

Emitted when `view`‘s toplevel state changes.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct WPEPlatformViewClass {
      GObjectClass parent_class;
      gboolean (* render_buffer) (
        WPEView* view,
        WPEBuffer* buffer,
        const WPERectangle* damage_rects,
        guint n_damage_rects,
        GError** error
      );
      gboolean (* lock_pointer) (
        WPEView* view
      );
      gboolean (* unlock_pointer) (
        WPEView* view
      );
      void (* set_cursor_from_name) (
        WPEView* view,
        const char* name
      );
      void (* set_cursor_from_bytes) (
        WPEView* view,
        GBytes* bytes,
        guint width,
        guint height,
        guint stride,
        guint hotspot_x,
        guint hotspot_y
      );
      void (* set_opaque_rectangles) (
        WPEView* view,
        WPERectangle* rects,
        guint n_rects
      );
      gboolean (* can_be_mapped) (
        WPEView* view
      );
      WPEViewAccessible* (* get_accessible) (
        WPEView* view
      );
      gpointer padding;

    }

No description available.

###### Class members

`parent_class: GObjectClass`

  No description available.

`render_buffer: gboolean (* render_buffer) ( WPEView* view, WPEBuffer* buffer, const WPERectangle* damage_rects, guint n_damage_rects, GError** error )`

  No description available.

`lock_pointer: gboolean (* lock_pointer) ( WPEView* view )`

  No description available.

`unlock_pointer: gboolean (* unlock_pointer) ( WPEView* view )`

  No description available.

`set_cursor_from_name: void (* set_cursor_from_name) ( WPEView* view, const char* name )`

  No description available.

`set_cursor_from_bytes: void (* set_cursor_from_bytes) ( WPEView* view, GBytes* bytes, guint width, guint height, guint stride, guint hotspot_x, guint hotspot_y )`

  No description available.

`set_opaque_rectangles: void (* set_opaque_rectangles) ( WPEView* view, WPERectangle* rects, guint n_rects )`

  No description available.

`can_be_mapped: gboolean (* can_be_mapped) ( WPEView* view )`

  No description available.

`get_accessible: WPEViewAccessible* (* get_accessible) ( WPEView* view )`

  No description available.

`padding: gpointer`

  No description available.

#### Virtual methods

###### WPEPlatform.ViewClass.can_be_mapped

No description available.

###### WPEPlatform.ViewClass.get_accessible

Get the `WPEViewAccessible` of `view`.

###### WPEPlatform.ViewClass.lock_pointer

Disable the movements of the pointer in `view`, locking it to a particular area; while the pointer is locked, mouse events are relative instead of absolute motions.

###### WPEPlatform.ViewClass.render_buffer

Render the given `buffer` into `view`. If this function returns `TRUE` you must call `wpe_view_buffer_rendered()` when the buffer is rendered and `wpe_view_buffer_released()` when it’s no longer used by the view.

###### WPEPlatform.ViewClass.set_cursor_from_bytes

Set the `view` cursor from the given `bytes`. Pixel format must be `WPE_PIXEL_FORMAT_ARGB8888`.

###### WPEPlatform.ViewClass.set_cursor_from_name

Set the `view` cursor by looking up `name` in the current cursor theme.

###### WPEPlatform.ViewClass.set_opaque_rectangles

Set the rectangles of `view` that contain opaque content. This is an optimization hint that is automatically set by WebKit when the web view background color is opaque.

###### WPEPlatform.ViewClass.unlock_pointer

Unlock the pointer in `view` if it has been locked.