Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make all public structs opaque #15

Closed
mcatanzaro opened this issue Apr 12, 2018 · 4 comments
Closed

Make all public structs opaque #15

mcatanzaro opened this issue Apr 12, 2018 · 4 comments

Comments

@mcatanzaro
Copy link
Contributor

We should make structs in the public API opaque in order to make it possible to add new members without breaking the ABI. E.g.:

struct wpe_input_keyboard_event {
    uint32_t time;
    uint32_t keyCode;
    uint32_t unicode;
    bool pressed;
    uint8_t modifiers;
};

Instead of exposing the contents of the struct, we would expose getter and setter functions: wpe_input_keyboard_event_get_time(), wpe_input_keyboard_event_set_time(), etc.

Since this is a bigger change, I don't think it has to block the first release, but we should do it before a 1.0 release IMO.

@mcatanzaro
Copy link
Contributor Author

Since this is a bigger change, I don't think it has to block the first release, but we should do it before a 1.0 release IMO.

Discussed this with Zan. We won't do it for the 0.1 API. Consider again before releasing a 1.0 API version.

@mcatanzaro mcatanzaro reopened this May 11, 2018
@aperezdc aperezdc added this to the Version 1.0.0 milestone Jul 25, 2018
@aperezdc aperezdc removed this from the Version 1.0.0 milestone Aug 7, 2018
@aperezdc
Copy link
Contributor

aperezdc commented Aug 7, 2018

After another round of discussion between myself and @carlosgcampos the conclusion is that doing this would prevent allocating event structs in the stack (which is fast and convenient) and would incur hitting dynamic allocation every time an event is passed around.

We won't be doing this for the time being.

@aperezdc aperezdc closed this as completed Aug 7, 2018
@carlosgcampos
Copy link
Contributor

That's actually @zdobersek reasoning, not mine. I still think structs should be opaque to ensure we can modify them in the future without breaking the API/ABI. I'm not opposed to close this anyway, hopefully we won't need to add more fields to events.

@aperezdc
Copy link
Contributor

aperezdc commented Aug 7, 2018

We can always reopen this later if needed, of course.

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

No branches or pull requests

3 participants