wayland: Move initialization to the Rust side

This will help make the init procedure safer, by limiting the number of Rust objects that need to be carried to the C side and may be mangled on the way there.

The second benefit is that it allows outputs to become part of new state management.
This commit is contained in:
Dorota Czaplejewicz
2022-01-23 17:12:33 +00:00
parent 1b72cbdfaa
commit f4f44a49ae
9 changed files with 148 additions and 91 deletions

View File

@ -10,27 +10,18 @@
#include "outputs.h"
struct squeek_wayland {
// globals
struct zwlr_layer_shell_v1 *layer_shell;
struct zwp_virtual_keyboard_manager_v1 *virtual_keyboard_manager;
struct zwp_input_method_manager_v2 *input_method_manager;
struct squeek_outputs *outputs;
struct wl_seat *seat;
// objects
struct zwp_input_method_v2 *input_method;
struct zwp_virtual_keyboard_v1 *virtual_keyboard;
};
extern struct squeek_wayland *squeek_wayland;
static inline void squeek_wayland_init(struct squeek_wayland *wayland) {
wayland->outputs = squeek_outputs_new();
}
static inline void squeek_wayland_set_global(struct squeek_wayland *wayland) {
squeek_wayland = wayland;
}
static inline void squeek_wayland_deinit(struct squeek_wayland *wayland) {
squeek_outputs_free(wayland->outputs);
}
#endif // WAYLAND_H