Skip to content
This repository has been archived by the owner on Aug 3, 2024. It is now read-only.

ManagerHandlers should all be static #239

Closed
Timidger opened this issue Dec 27, 2018 · 0 comments
Closed

ManagerHandlers should all be static #239

Timidger opened this issue Dec 27, 2018 · 0 comments
Labels
Breaking Breaking changes

Comments

@Timidger
Copy link
Member

Timidger commented Dec 27, 2018

From the conclusion of working on #238 it's apparent that there's never a need to have dynamic allocation for the manager handlers. The state can easily be stored in the Compositor state, which is allocated once at the start of the program, and you can only ever have one variant of the manager handlers since you don't want to manage the same resource twice.

The api should change to look like this (this is xdg_shell_v6_test translated over):

let input_manager = input::Manager::builder()
    .pointer_added(pointer_added)
    .keyboard_added(keyboard_added);
let output_manager = output::Manager::builder()
    .on_frame(on_frame);
let xdg_shell_v6_manager = xdg_shell_v6::Manager::builder()
    .destroyed(xdg_shell_v6_destroyed);
compositor::Builder::new().gles2(true)
        .wl_shm(true)
        .input_manager(input_manager)
        .output_manager(output_manager)
        .xdg_shell_v6_manager(xdg_shell_v6_manager)
        .build_auto(State::new(xcursor_manager, layout, cursor));
@Timidger Timidger added the Breaking Breaking changes label Dec 27, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Breaking Breaking changes
Development

No branches or pull requests

1 participant