diff options
Diffstat (limited to 'src/platform/wayland/internal.h')
| -rw-r--r-- | src/platform/wayland/internal.h | 70 |
1 files changed, 49 insertions, 21 deletions
diff --git a/src/platform/wayland/internal.h b/src/platform/wayland/internal.h index 34d4133..a479e2b 100644 --- a/src/platform/wayland/internal.h +++ b/src/platform/wayland/internal.h @@ -1,5 +1,5 @@ -#ifndef YASL_WAYLAND_INTERNAL_H -#define YASL_WAYLAND_INTERNAL_H +#ifndef YASL_PRIVATE_WAYLAND_INTERNAL_H +#define YASL_PRIVATE_WAYLAND_INTERNAL_H #define _GNU_SOURCE @@ -10,6 +10,11 @@ #include <wayland-client.h> #include <wayland-cursor.h> +#if YASL_HAS_EGL +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <wayland-egl.h> +#endif #include "protocols/xdg-shell-client-protocol.h" #include "protocols/xdg-decoration-client-protocol.h" #include "protocols/cursor-shape-v1-client-protocol.h" @@ -73,7 +78,7 @@ struct wl_conn_output { struct pending_press { struct wayland_surface *surface; - struct yasl_vector2i pos; + struct yasl_private_vector2i pos; int button; bool release; }; @@ -105,7 +110,7 @@ struct conn_drag { struct wl_data_source *source; struct xdg_toplevel_drag_v1 *toplevel; struct drag_icon icon; - struct yasl_drag_listener listener; + struct yasl_private_drag_listener listener; void *ud; struct seat *seat; uint32_t scale_120; @@ -160,15 +165,20 @@ struct seat { uint64_t pointer_buttons; uint64_t tool_buttons; double axis[2], axis_value120[2]; + double axis_pixels[2]; int64_t axis_discrete[2]; + uint32_t axis_source; + bool scroll_gesture, axis_stop_pending; + unsigned axis_phase; + bool ime_enabled; bool axis_has_value120[2], axis_has_discrete[2]; double touch_scroll_y; /* Embedded structs */ xkb_mod_mask_t input_mod_masks[8]; - struct yasl_vector2i pointer_pos; - struct yasl_vector2i ptr_left_pos; - struct yasl_vector2i tool_pos; + struct yasl_private_vector2i pointer_pos; + struct yasl_private_vector2i ptr_left_pos; + struct yasl_private_vector2i tool_pos; struct touch_point touch_points[SEAT_TOUCH_POINTS]; struct press_queue ptr_presses; struct press_queue tool_presses; @@ -183,7 +193,7 @@ struct seat { uint32_t press_serial; uint32_t pointer_serial; int cursor_shape; - struct yasl_pointer_pen pen; + struct yasl_private_pointer_pen pen; int tool_wheel; /* 1-byte booleans grouped tightly */ @@ -199,9 +209,14 @@ struct seat { #include "common/input.h" struct wayland_display { - struct yasl_display base; + struct yasl_private_display base; /* 8-byte pointers & 64-bit masks */ struct wl_display *wl; +#if YASL_HAS_EGL + EGLDisplay egl_display; + EGLint egl_api; + bool egl_initialized; +#endif struct wl_registry *registry; struct wl_compositor *compositor; struct wl_shm *shm; @@ -228,8 +243,8 @@ struct wayland_display { struct wp_fifo_manager_v1 *fifo_mgr; struct wp_commit_timing_manager_v1 *commit_timing_mgr; struct xkb_context *xkb_ctx; - struct yasl_loop *loop; - const struct yasl_display_cbs *cbs; + struct yasl_private_loop *loop; + const struct yasl_private_display_cbs *cbs; void *ud; char *app_id; struct xdg_toplevel_drag_manager_v1 *toplevel_drag_mgr; @@ -243,6 +258,7 @@ struct wayland_display { clockid_t pres_clock; int watch; int depth; + uint64_t next_tool_id; /* 1-byte booleans */ bool owns_loop; @@ -266,6 +282,12 @@ struct wayland_surface { struct wayland_surface *dead_next; struct wayland_surface *parent; struct wl_surface *surface; +#if YASL_HAS_EGL + struct wl_egl_window *egl_window; + EGLSurface egl_surface; + EGLContext egl_context; + EGLConfig egl_config; +#endif struct xdg_surface *xdg_surface; struct xdg_toplevel *toplevel; struct xdg_popup *popup; @@ -276,6 +298,8 @@ struct wayland_surface { char *ime_commit; char *ime_shown; struct seat *ime_seat; + size_t ime_delete_begin, ime_delete_end; + uint64_t ime_delete_revision, ime_delete_generation; struct wp_tearing_control_v1 *tearing_control; struct latency_feedback *latency_feedbacks; struct latency_feedback latency_pool[8]; @@ -285,24 +309,24 @@ struct wayland_surface { /* Persistent lock held while relative; lock_seat owns the locked wl_pointer. */ struct zwp_locked_pointer_v1 *pointer_lock; struct seat *lock_seat; - const struct yasl_window_cbs *cbs; + const struct yasl_private_window_cbs *cbs; void *ud; uint64_t frames_skipped; uint64_t outputs; double scale_factor; /* Sub-structures */ - struct yasl_rect2i ime_caret; - struct yasl_rect2i content; - struct yasl_frame_clock clock; + struct yasl_private_rect2i ime_caret; + struct yasl_private_rect2i content; + struct yasl_private_frame_clock clock; struct buffer buffers[NBUF]; - struct yasl_frame frame; - struct yasl_damage_list damage; + struct yasl_private_frame frame; + struct yasl_private_damage_list damage; int ime_cursor_begin; struct input_queue input; /* 4-byte integers */ - enum yasl_cursor cursor; + enum yasl_private_cursor cursor; int ime_cursor_end; int ime_shown_begin, ime_shown_end; int floating_width, floating_height; @@ -331,6 +355,7 @@ struct wayland_surface { bool want_draw; bool relative; bool pointer_locked; + bool ime_delete_pending; }; @@ -343,7 +368,7 @@ int buffer_prepare(struct wayland_surface *w, struct buffer *b, int width, int const struct wl_buffer_listener *listener); int apply_pending_geometry(struct wayland_surface *w); -static inline void wl_damage_list(struct wl_surface *s, const struct yasl_damage_list *d) +static inline void wl_damage_list(struct wl_surface *s, const struct yasl_private_damage_list *d) { if (d->n < 0) { wl_surface_damage_buffer(s, d->bounds.x, d->bounds.y, @@ -365,6 +390,7 @@ 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 wayland_surface_arm_frame(struct wayland_surface *w); void surface_fail(struct wayland_surface *w); void display_leave(struct wayland_display *c); @@ -376,9 +402,9 @@ static inline struct wayland_surface *surface_root(struct wayland_surface *w) } void conn_drag_end(struct wayland_display *c); -void conn_drop_target(struct wayland_display *c, enum yasl_drop_event ev, +void conn_drop_target(struct wayland_display *c, enum yasl_private_drop_event ev, struct wl_surface *on, double x, double y); -void conn_drag_target(struct wayland_display *c, enum yasl_drag_event ev, +void conn_drag_target(struct wayland_display *c, enum yasl_private_drag_event ev, struct wl_surface *on, double x, double y); void seat_bind(struct wayland_display *c, struct wl_registry *registry, @@ -386,6 +412,7 @@ void seat_bind(struct wayland_display *c, struct wl_registry *registry, bool seat_remove(struct wayland_display *c, uint32_t name); void seat_destroy(struct seat *s); void seat_note_input(struct seat *s, uint32_t serial); +void seat_ensure_text_input(struct seat *s); void seat_forget_surface(struct seat *s, struct wayland_surface *w); void seat_clipboard_ensure(struct seat *s); int display_input_init(struct wayland_display *c); @@ -409,6 +436,7 @@ extern const struct zwp_text_input_v3_listener text_input_listener; void ime_reset(struct wayland_surface *w); void keyboard_text_reset(struct seat *s); void ime_send_caret(struct wayland_surface *w); +bool wayland_surface_update_text_input(struct wayland_surface *w); int surface_init_shell(struct wayland_surface *w, const char *title); extern const struct xdg_surface_listener shell_surface_listener; |
