moved things around
This commit is contained in:
parent
7e2171681d
commit
35d8ca7358
3 changed files with 45 additions and 10 deletions
30
wayland.c
30
wayland.c
|
|
@ -71,12 +71,28 @@ registry_handle_global(void *data, struct wl_registry *registry,
|
|||
if (strcmp(interface, wl_compositor_interface.name) == 0) {
|
||||
state->wl_compositor = wl_registry_bind(
|
||||
registry, name, &wl_compositor_interface, 4);
|
||||
// Set up wl_surface
|
||||
state->wl_surface = wl_compositor_create_surface(state->wl_compositor);
|
||||
}
|
||||
if (strcmp(interface, xdg_wm_base_interface.name) == 0) {
|
||||
state->xdg_wm_base = wl_registry_bind(
|
||||
registry, name, &xdg_wm_base_interface, 1);
|
||||
xdg_wm_base_add_listener(state->xdg_wm_base,
|
||||
&xdg_wm_base_listener, state);
|
||||
|
||||
state->xdg_surface = xdg_wm_base_get_xdg_surface(
|
||||
state->xdg_wm_base, state->wl_surface);
|
||||
xdg_surface_add_listener(state->xdg_surface, &xdg_surface_listener, state);
|
||||
state->xdg_toplevel = xdg_surface_get_toplevel(state->xdg_surface);
|
||||
xdg_toplevel_set_title(state->xdg_toplevel, "GLONKERS! 🕴️");
|
||||
xdg_toplevel_add_listener(state->xdg_toplevel, &xdg_toplevel_listener, state);
|
||||
}
|
||||
if (strcmp(interface, zwlr_layer_shell_v1_interface.name) == 0) {
|
||||
state->zwlr_layer_shell_v1 = wl_registry_bind(registry, name, &zwlr_layer_shell_v1_interface, 4);
|
||||
}
|
||||
if (strcmp(interface, wl_output_interface.name) == 0) {
|
||||
state->wl_output = wl_registry_bind(
|
||||
registry, name, &wl_output_interface, 4);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -180,23 +196,21 @@ static void egl_init(struct client_state *state) {
|
|||
}
|
||||
|
||||
/// Initializes wayland and creates an opengl context
|
||||
void wayland_init(struct client_state *state) {
|
||||
void wayland_init(struct client_state *state, int output_type) {
|
||||
int width = 700, height = 700;
|
||||
state->width = width;
|
||||
state->height = height;
|
||||
state->running = 1;
|
||||
state->output_type = output_type;
|
||||
state->wl_display = wl_display_connect(NULL);
|
||||
state->wl_registry = wl_display_get_registry(state->wl_display);
|
||||
wl_registry_add_listener(state->wl_registry, &wl_registry_listener, state);
|
||||
wl_display_roundtrip(state->wl_display);
|
||||
|
||||
state->wl_surface = wl_compositor_create_surface(state->wl_compositor);
|
||||
state->xdg_surface = xdg_wm_base_get_xdg_surface(
|
||||
state->xdg_wm_base, state->wl_surface);
|
||||
xdg_surface_add_listener(state->xdg_surface, &xdg_surface_listener, state);
|
||||
state->xdg_toplevel = xdg_surface_get_toplevel(state->xdg_surface);
|
||||
xdg_toplevel_set_title(state->xdg_toplevel, "GLONKERS! 🕴️");
|
||||
xdg_toplevel_add_listener(state->xdg_toplevel, &xdg_toplevel_listener, state);
|
||||
// wlr_layer_shell
|
||||
//int layer = ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND;
|
||||
//struct zwlr_layer_surface_v1 *zwlr_layer_surface = zwlr_layer_shell_v1_get_layer_surface(state->zwlr_layer_shell_v1, state->wl_surface, state->wl_output, layer, "wallpaper");
|
||||
// toplevel
|
||||
wl_surface_commit(state->wl_surface);
|
||||
|
||||
egl_init(state);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue