Skip to content

Improve libservo API (WindowMethods and WindowEvent) #15645

Closed

Description

@paulrouget

This issue is part of an effort to improve Servo's embedding story. See https://github.com/paulrouget/servoshell/projects/2

As of now, the embedder must implement the WindowMethods trait.

I would split these methods in 4 groups:

  • asking the embedder to perform an action
    • prepare_for_composite
    • create_compositor_channel
    • present
  • asking the embedder about the geometry of the viewport
    • scale_factor
    • framebuffer_size
    • size
    • client_window
  • asking the embedder about capabilities
    • supports_clipboard
  • events. Notifying the embedder of a change. Up to the embedder to honour them:
    • set_inner_size
    • set_position
    • set_fullscreen_state
    • set_page_title
    • set_page_url
    • status
    • load_start
    • load_end
    • load_error
    • head_parsed
    • set_cursor
    • set_favicon
    • handle_key

I think we can offer a better API:

  • create_compositor_channel: this could be a clonable object passed to Browser::new()
  • geometry related methods could be removed, and instead, the browser object would have a updateGeometry(AGeometryStruct) method. AGeometryStruct would include the scale factor, the inner size and the window position.
  • capability methods would be regular callbacks
  • present and prepare_for_composite, and all the other events as events. (browser.getEvents()).

As for browser.handle_events, it accepts WindowEvent. Not everything is a window event. We need a better semantic here. Maybe ServoCommand.

Activity

  1. changed the title [-]Improve libservo API[/-] [+]Improve libservo API (WindowMethods)[/+] on Feb 19, 2017
  2. changed the title [-]Improve libservo API (WindowMethods)[/-] [+]Improve libservo API (WindowMethods and WindowEvent)[/+] on Feb 23, 2017
  3. paulrouget commented on Mar 14, 2017

    @paulrouget
    ContributorAuthor

    Superseded by #15934

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions