WIP put width/height in surface
This commit is contained in:
parent
53af3af200
commit
4806cff440
2 changed files with 10 additions and 9 deletions
16
wayland.c
16
wayland.c
|
|
@ -3,6 +3,9 @@
|
|||
#include <stdlib.h>
|
||||
#include "wayland.h"
|
||||
|
||||
/// Starting values.
|
||||
int width = 700, height = 700;
|
||||
|
||||
static void wl_buffer_release(void *data, struct wl_buffer *wl_buffer) {
|
||||
/* Sent by the compositor when it's no longer using this buffer */
|
||||
wl_buffer_destroy(wl_buffer);
|
||||
|
|
@ -38,12 +41,12 @@ static void xdg_toplevel_configure (
|
|||
) {
|
||||
|
||||
struct client_state *state = data;
|
||||
state->width = width;
|
||||
state->height = height;
|
||||
// resize egl window
|
||||
struct surface_list *next = state->surface_list;
|
||||
|
||||
while (next->data.xdg_toplevel != xdg_toplevel) { next = next->next; }
|
||||
next->data.width = width;
|
||||
next->data.height = height;
|
||||
wl_egl_window_resize(next->data.egl_window, width, height, 0, 0);
|
||||
}
|
||||
|
||||
|
|
@ -67,10 +70,10 @@ static const struct xdg_toplevel_listener xdg_toplevel_listener = {
|
|||
|
||||
static void zwlr_layer_surface_v1_configure(void *data, struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1, uint32_t serial, uint32_t width, uint32_t height) {
|
||||
struct client_state *state = data;
|
||||
state->width = width;
|
||||
state->height = height;
|
||||
struct surface_list *next = state->surface_list;
|
||||
while (next->data.zwlr_layer_surface_v1 != zwlr_layer_surface_v1) { next = next->next; }
|
||||
next->data.width = width;
|
||||
next->data.height = height;
|
||||
wl_egl_window_resize(next->data.egl_window, width, height, 0, 0);
|
||||
zwlr_layer_surface_v1_ack_configure(zwlr_layer_surface_v1, serial);
|
||||
}
|
||||
|
|
@ -251,7 +254,7 @@ static void egl_init(struct client_state *state) {
|
|||
struct surface_list *next = state->surface_list;
|
||||
while (next != NULL) {
|
||||
next->data.egl_window = wl_egl_window_create(next->data.wl_surface,
|
||||
state->width, state->height);
|
||||
next->data.width, next->data.height);
|
||||
if (next->data.egl_window == EGL_NO_SURFACE) {
|
||||
fprintf(stderr, "Can't create egl window\n");
|
||||
exit(1);
|
||||
|
|
@ -277,9 +280,6 @@ static void egl_init(struct client_state *state) {
|
|||
|
||||
/// Initializes wayland and creates an opengl context
|
||||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue