made pointers in wayland.h opaque
This commit is contained in:
parent
60f8b89c2b
commit
bb63b49155
2 changed files with 61 additions and 56 deletions
58
wayland.c
58
wayland.c
|
|
@ -2,8 +2,66 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#include <EGL/egl.h>
|
||||||
|
#include <wayland-egl.h>
|
||||||
|
#include <wayland-cursor.h>
|
||||||
|
#include "xdg-shell-protocol.h"
|
||||||
|
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||||
|
|
||||||
#include "wayland.h"
|
#include "wayland.h"
|
||||||
|
|
||||||
|
struct surface {
|
||||||
|
int width, height;
|
||||||
|
|
||||||
|
/// Wating to be redrawn.
|
||||||
|
bool dirty;
|
||||||
|
|
||||||
|
struct wl_surface *wl_surface;
|
||||||
|
struct xdg_surface *xdg_surface;
|
||||||
|
struct xdg_toplevel *xdg_toplevel;
|
||||||
|
struct wl_egl_window *egl_window;
|
||||||
|
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1;
|
||||||
|
struct wl_output *wl_output;
|
||||||
|
|
||||||
|
EGLSurface egl_surface;
|
||||||
|
|
||||||
|
/// We need a back-pointer for callbacks.
|
||||||
|
struct client_state *state;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct surface_list {
|
||||||
|
struct surface data;
|
||||||
|
struct surface_list *next;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct client_state {
|
||||||
|
bool running;
|
||||||
|
int output_type;
|
||||||
|
/* Globals */
|
||||||
|
struct wl_display *wl_display;
|
||||||
|
struct wl_registry *wl_registry;
|
||||||
|
struct wl_compositor *wl_compositor;
|
||||||
|
struct wl_shm *wl_shm;
|
||||||
|
struct xdg_wm_base *xdg_wm_base;
|
||||||
|
struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1;
|
||||||
|
struct wl_seat *wl_seat;
|
||||||
|
struct wl_pointer *wl_pointer;
|
||||||
|
|
||||||
|
// Cursor
|
||||||
|
struct wl_surface *cursor_surface;
|
||||||
|
struct wl_cursor_image *wl_cursor_image;
|
||||||
|
|
||||||
|
struct surface_list *surface_list;
|
||||||
|
/// Next in queue to check if it wants to be rendered.
|
||||||
|
struct surface_list *surface_list_next;
|
||||||
|
|
||||||
|
EGLDisplay egl_display;
|
||||||
|
EGLConfig egl_config;
|
||||||
|
EGLContext egl_context;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/// Starting values.
|
/// Starting values.
|
||||||
int width = 700, height = 700;
|
int width = 700, height = 700;
|
||||||
|
|
||||||
|
|
|
||||||
59
wayland.h
59
wayland.h
|
|
@ -1,9 +1,3 @@
|
||||||
#include <EGL/egl.h>
|
|
||||||
#include <wayland-egl.h>
|
|
||||||
#include <wayland-cursor.h>
|
|
||||||
#include "xdg-shell-protocol.h"
|
|
||||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
|
||||||
|
|
||||||
/// A normal window
|
/// A normal window
|
||||||
#define OUTPUT_WINDOW 0
|
#define OUTPUT_WINDOW 0
|
||||||
/// A desktop layer (wallpaper)
|
/// A desktop layer (wallpaper)
|
||||||
|
|
@ -15,55 +9,9 @@
|
||||||
|
|
||||||
struct client_state;
|
struct client_state;
|
||||||
|
|
||||||
struct surface {
|
struct surface;
|
||||||
int width, height;
|
struct surface_list;
|
||||||
|
struct client_state;
|
||||||
/// Wating to be redrawn.
|
|
||||||
bool dirty;
|
|
||||||
|
|
||||||
struct wl_surface *wl_surface;
|
|
||||||
struct xdg_surface *xdg_surface;
|
|
||||||
struct xdg_toplevel *xdg_toplevel;
|
|
||||||
struct wl_egl_window *egl_window;
|
|
||||||
struct zwlr_layer_surface_v1 *zwlr_layer_surface_v1;
|
|
||||||
struct wl_output *wl_output;
|
|
||||||
|
|
||||||
EGLSurface egl_surface;
|
|
||||||
|
|
||||||
/// We need a back-pointer for callbacks.
|
|
||||||
struct client_state *state;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct surface_list {
|
|
||||||
struct surface data;
|
|
||||||
struct surface_list *next;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct client_state {
|
|
||||||
bool running;
|
|
||||||
int output_type;
|
|
||||||
/* Globals */
|
|
||||||
struct wl_display *wl_display;
|
|
||||||
struct wl_registry *wl_registry;
|
|
||||||
struct wl_compositor *wl_compositor;
|
|
||||||
struct wl_shm *wl_shm;
|
|
||||||
struct xdg_wm_base *xdg_wm_base;
|
|
||||||
struct zwlr_layer_shell_v1 *zwlr_layer_shell_v1;
|
|
||||||
struct wl_seat *wl_seat;
|
|
||||||
struct wl_pointer *wl_pointer;
|
|
||||||
|
|
||||||
// Cursor
|
|
||||||
struct wl_surface *cursor_surface;
|
|
||||||
struct wl_cursor_image *wl_cursor_image;
|
|
||||||
|
|
||||||
struct surface_list *surface_list;
|
|
||||||
/// Next in queue to check if it wants to be rendered.
|
|
||||||
struct surface_list *surface_list_next;
|
|
||||||
|
|
||||||
EGLDisplay egl_display;
|
|
||||||
EGLConfig egl_config;
|
|
||||||
EGLContext egl_context;
|
|
||||||
};
|
|
||||||
|
|
||||||
#define EVENT_NONE 0
|
#define EVENT_NONE 0
|
||||||
#define EVENT_DRAW 1
|
#define EVENT_DRAW 1
|
||||||
|
|
@ -82,7 +30,6 @@ struct event {
|
||||||
|
|
||||||
void wayland_init(struct client_state *state, int output_type);
|
void wayland_init(struct client_state *state, int output_type);
|
||||||
void commit(struct client_state *state);
|
void commit(struct client_state *state);
|
||||||
/// Provide pointer to be filled.
|
|
||||||
struct event wait_for_event(struct client_state *state);
|
struct event wait_for_event(struct client_state *state);
|
||||||
void swap_buffers(struct client_state *state, struct surface *surface);
|
void swap_buffers(struct client_state *state, struct surface *surface);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue