diff options
Diffstat (limited to 'src/wayland/internal.h')
| -rw-r--r-- | src/wayland/internal.h | 114 |
1 files changed, 58 insertions, 56 deletions
diff --git a/src/wayland/internal.h b/src/wayland/internal.h index 79fd88d..cba5096 100644 --- a/src/wayland/internal.h +++ b/src/wayland/internal.h @@ -3,7 +3,7 @@ #define _GNU_SOURCE -#include "yasl/yasl.h" +#include "api.h" #include "yasl/timing.h" #include "clipboard.h" @@ -41,13 +41,13 @@ #define NBUF 3 -struct yasl_surface; +struct wayland_surface; struct tablet_tool; struct tablet_device; struct tablet_pad; struct buffer { - struct yasl_surface *owner; + struct wayland_surface *owner; struct wl_shm_pool *pool; struct wl_buffer *proxy; uint32_t *pixels; @@ -58,7 +58,7 @@ struct buffer { }; struct wl_conn_output { - struct yasl_display *conn; + struct wayland_display *conn; struct wl_output *proxy; struct wl_conn_output *next; uint64_t mask; @@ -68,7 +68,7 @@ struct wl_conn_output { }; struct pending_press { - struct yasl_surface *surface; + struct wayland_surface *surface; struct yasl_vector2i pos; int button; bool release; @@ -111,7 +111,7 @@ struct conn_drag { #define SEAT_TOUCH_POINTS 10 struct touch_point { - struct yasl_surface *surface; + struct wayland_surface *surface; double x, y; int32_t id; bool active; @@ -122,7 +122,7 @@ struct touch_point { struct seat { /* 8-byte aligned pointers and 64-bit values */ - struct yasl_display *conn; + struct wayland_display *conn; struct seat *next; struct wl_seat *proxy; struct wl_keyboard *keyboard; @@ -140,13 +140,13 @@ struct seat { struct xkb_keymap *xkb_keymap; struct xkb_state *xkb_state; uint64_t repeat_started_ns; - struct yasl_surface *pointer_focus; - struct yasl_surface *keyboard_focus; - struct yasl_surface *tablet_focus; - struct yasl_surface *ime_focus; - struct yasl_surface *focus_leaving; - struct yasl_surface *press_surface; - struct yasl_surface *ptr_left; + struct wayland_surface *pointer_focus; + struct wayland_surface *keyboard_focus; + struct wayland_surface *tablet_focus; + struct wayland_surface *ime_focus; + struct wayland_surface *focus_leaving; + struct wayland_surface *press_surface; + struct wayland_surface *ptr_left; struct tablet_tool *tool; struct touch_point *touch_primary; uint64_t pointer_buttons; @@ -223,7 +223,8 @@ static inline void input_queue_clear(struct input_queue *q) q->head = q->tail = q->count = 0; } -struct yasl_display { +struct wayland_display { + struct yasl_display base; /* 8-byte pointers & 64-bit masks */ struct wl_display *wl; struct wl_registry *registry; @@ -255,9 +256,9 @@ struct yasl_display { char *app_id; struct xdg_toplevel_drag_manager_v1 *toplevel_drag_mgr; struct conn_drag drag; - struct yasl_surface *surfaces; - struct yasl_surface *paste_target; - struct yasl_surface *dead; + struct wayland_surface *surfaces; + struct wayland_surface *paste_target; + struct wayland_surface *dead; /* 4-byte integers */ int cursor_size; @@ -273,12 +274,13 @@ struct yasl_display { bool lost; }; -struct yasl_surface { +struct wayland_surface { + struct yasl_surface base; /* 8-byte pointers & 64-bit values */ - struct yasl_display *conn; - struct yasl_surface *conn_next; - struct yasl_surface *dead_next; - struct yasl_surface *parent; + struct wayland_display *conn; + struct wayland_surface *conn_next; + struct wayland_surface *dead_next; + struct wayland_surface *parent; struct wl_surface *surface; struct xdg_surface *xdg_surface; struct xdg_toplevel *toplevel; @@ -348,12 +350,12 @@ bool yasl_utf8_validate(const char *str, size_t len); int device_px(int logical, uint32_t scale_120); bool buffer_size(int width, int height, size_t *bytes); -int buffer_reserve(struct yasl_surface *w, struct buffer *b, size_t needed); +int buffer_reserve(struct wayland_surface *w, struct buffer *b, size_t needed); void buffer_destroy(struct buffer *b); int buffer_pick_free_index(const struct buffer *bufs, int cur); -int buffer_prepare(struct yasl_surface *w, struct buffer *b, int width, int height, +int buffer_prepare(struct wayland_surface *w, struct buffer *b, int width, int height, const struct wl_buffer_listener *listener); -int apply_pending_geometry(struct yasl_surface *w); +int apply_pending_geometry(struct wayland_surface *w); int logical_px_ceil(int device, uint32_t scale_120); static inline void wl_damage_list(struct wl_surface *s, const struct yasl_damage_list *d) @@ -368,8 +370,8 @@ static inline void wl_damage_list(struct wl_surface *s, const struct yasl_damage d->rects[i].width, d->rects[i].height); } -void surface_update_opaque_region(struct yasl_surface *w); -int surface_init_scaling(struct yasl_surface *w); +void surface_update_opaque_region(struct wayland_surface *w); +int surface_init_scaling(struct wayland_surface *w); static inline bool surface_gets_preferred_scale(struct wl_surface *s) { @@ -377,65 +379,65 @@ static inline bool surface_gets_preferred_scale(struct wl_surface *s) WL_SURFACE_PREFERRED_BUFFER_SCALE_SINCE_VERSION; } -uint64_t conn_output_mask(const struct yasl_display *c, const struct wl_output *proxy); -uint32_t conn_output_scale_120(const struct yasl_display *c, uint64_t outputs); -void conn_destroy_outputs(struct yasl_display *c); -void surface_follow_outputs(struct yasl_surface *w); -uint64_t conn_pres_to_mono(const struct yasl_display *c, uint64_t ns); -uint64_t conn_mono_to_pres(const struct yasl_display *c, uint64_t ns); -void surface_draw_frame(struct yasl_surface *w); -void surface_fail(struct yasl_surface *w); -void display_enter(struct yasl_display *c); -void display_leave(struct yasl_display *c); +uint64_t conn_output_mask(const struct wayland_display *c, const struct wl_output *proxy); +uint32_t conn_output_scale_120(const struct wayland_display *c, uint64_t outputs); +void conn_destroy_outputs(struct wayland_display *c); +void surface_follow_outputs(struct wayland_surface *w); +uint64_t conn_pres_to_mono(const struct wayland_display *c, uint64_t ns); +uint64_t conn_mono_to_pres(const struct wayland_display *c, uint64_t ns); +void surface_draw_frame(struct wayland_surface *w); +void surface_fail(struct wayland_surface *w); +void display_enter(struct wayland_display *c); +void display_leave(struct wayland_display *c); -struct yasl_surface *conn_surface_for(struct yasl_display *c, struct wl_surface *s); +struct wayland_surface *conn_surface_for(struct wayland_display *c, struct wl_surface *s); -static inline struct yasl_surface *surface_root(struct yasl_surface *w) +static inline struct wayland_surface *surface_root(struct wayland_surface *w) { while (w && w->parent) w = w->parent; return w; } -void conn_drag_end(struct yasl_display *c); -void conn_drop_target(struct yasl_display *c, enum yasl_drop_event ev, +void conn_drag_end(struct wayland_display *c); +void conn_drop_target(struct wayland_display *c, enum yasl_drop_event ev, struct wl_surface *on, double x, double y); -void conn_drag_target(struct yasl_display *c, enum yasl_drag_event ev, +void conn_drag_target(struct wayland_display *c, enum yasl_drag_event ev, struct wl_surface *on, double x, double y); -void seat_bind(struct yasl_display *c, struct wl_registry *registry, +void seat_bind(struct wayland_display *c, struct wl_registry *registry, uint32_t name, uint32_t version); -bool seat_remove(struct yasl_display *c, uint32_t name); +bool seat_remove(struct wayland_display *c, uint32_t name); void seat_destroy(struct seat *s); -struct seat *conn_active_seat(const struct yasl_display *c); +struct seat *conn_active_seat(const struct wayland_display *c); void seat_note_input(struct seat *s, uint32_t serial); -void seat_forget_surface(struct seat *s, struct yasl_surface *w); +void seat_forget_surface(struct seat *s, struct wayland_surface *w); void seat_clipboard_ensure(struct seat *s); -int display_input_init(struct yasl_display *c); +int display_input_init(struct wayland_display *c); extern const struct wl_seat_listener seat_listener; void keyboard_repeat_stop(struct seat *s); void keyboard_repeat_sync(struct seat *s); int keyboard_repeat_init(struct seat *s); -void keyboard_settle_focus(struct yasl_display *c); -bool conn_keyboard_on(const struct yasl_display *c, const struct yasl_surface *w, +void keyboard_settle_focus(struct wayland_display *c); +bool conn_keyboard_on(const struct wayland_display *c, const struct wayland_surface *w, const struct seat *except); extern const struct wl_keyboard_listener keyboard_listener; int seat_modifiers(const struct seat *s); -void surface_init_cursor(struct yasl_display *c); +void surface_init_cursor(struct wayland_display *c); void seat_destroy_tablet(struct seat *s); void seat_pointer_reset(struct seat *s); extern const struct zwp_text_input_v3_listener text_input_listener; -void ime_reset(struct yasl_surface *w); -void ime_send_caret(struct yasl_surface *w); +void ime_reset(struct wayland_surface *w); +void ime_send_caret(struct wayland_surface *w); -int surface_init_shell(struct yasl_surface *w, const char *title); +int surface_init_shell(struct wayland_surface *w, const char *title); extern const struct xdg_surface_listener shell_surface_listener; extern const struct wl_registry_listener registry_listener; -void surface_feedback_destroy(struct yasl_surface *w); -void surface_request_presentation_feedback(struct yasl_surface *w); +void surface_feedback_destroy(struct wayland_surface *w); +void surface_request_presentation_feedback(struct wayland_surface *w); #endif |
