summaryrefslogtreecommitdiff
path: root/src/wayland/internal.h
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-11 23:40:57 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-11 23:40:57 +0300
commit6eac0a5f2c552728efca420b1129fae7d4fea773 (patch)
tree27fc9dc013de80787525696897771acec22c0f0c /src/wayland/internal.h
parent8d9f7c7cb39359d62bf28ef1775b944a7dddd6fb (diff)
feat: backend selection (Wayland, X11, Cocoa)
Diffstat (limited to 'src/wayland/internal.h')
-rw-r--r--src/wayland/internal.h114
1 files changed, 58 insertions, 56 deletions
diff --git a/src/wayland/internal.h b/src/wayland/internal.h
index dc85943..6b9001f 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;
@@ -104,7 +104,7 @@ struct conn_drag {
#define SEAT_TOUCH_POINTS 10
struct touch_point {
- struct yasl_surface *surface;
+ struct wayland_surface *surface;
int32_t id;
double x, y;
bool active;
@@ -112,7 +112,7 @@ struct touch_point {
};
struct seat {
- struct yasl_display *conn;
+ struct wayland_display *conn;
struct seat *next;
struct wl_seat *proxy;
uint32_t name;
@@ -140,14 +140,14 @@ struct seat {
uint32_t repeat_key;
bool repeat_held;
- 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 wayland_surface *pointer_focus;
+ struct wayland_surface *keyboard_focus;
+ struct wayland_surface *tablet_focus;
+ struct wayland_surface *ime_focus;
+ struct wayland_surface *focus_leaving;
uint32_t input_serial;
uint32_t press_serial;
- struct yasl_surface *press_surface;
+ struct wayland_surface *press_surface;
uint32_t pointer_serial;
int cursor_shape;
@@ -161,7 +161,7 @@ struct seat {
bool axis_smooth;
bool motion_pending;
struct press_queue ptr_presses;
- struct yasl_surface *ptr_left;
+ struct wayland_surface *ptr_left;
struct yasl_vector2i ptr_left_pos;
bool ptr_left_motion;
@@ -210,7 +210,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;
struct wl_display *wl;
struct wl_registry *registry;
struct wl_compositor *compositor;
@@ -244,20 +245,21 @@ struct yasl_display {
bool pres_clock_known;
struct xdg_toplevel_drag_manager_v1 *toplevel_drag_mgr;
struct conn_drag drag;
- struct yasl_surface *surfaces;
- struct yasl_surface *paste_target;
+ struct wayland_surface *surfaces;
+ struct wayland_surface *paste_target;
int watch;
int depth;
- struct yasl_surface *dead;
+ struct wayland_surface *dead;
bool reading;
bool lost;
};
-struct yasl_surface {
- struct yasl_display *conn;
- struct yasl_surface *conn_next;
- struct yasl_surface *dead_next;
- struct yasl_surface *parent;
+struct wayland_surface {
+ struct yasl_surface base;
+ 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;
@@ -325,12 +327,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)
@@ -345,8 +347,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)
{
@@ -354,65 +356,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