summaryrefslogtreecommitdiff
path: root/src/common/backend.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/backend.h')
-rw-r--r--src/common/backend.h28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/common/backend.h b/src/common/backend.h
index b111d3e..7633609 100644
--- a/src/common/backend.h
+++ b/src/common/backend.h
@@ -23,11 +23,18 @@ struct yasl_private_display {
/* Set by the backend while a native modal loop (macOS live resize) blocks the
* event loop; refresh callbacks run only then. */
bool modal;
- struct yasl_private_loop *loop;
+ struct yasl_loop *loop;
/* Backend's copy of yasl_private_display_spec.app_id, or NULL; for desktop services. */
const char *app_id;
struct yasl_private_event_state *events;
struct yasl_surface *surfaces;
+ /* Set by the backend: a lost connection comes back (Wayland). */
+ bool reconnects;
+ /* Set by the public layer, or NULL. pending: an event is ready that the
+ * queue does not hold, such as an owed REFRESH. deliver: hand queued events
+ * to the application during the loop step. */
+ bool (*pending)(struct yasl_private_display *d);
+ void (*deliver)(struct yasl_private_display *d);
};
struct yasl_surface {
@@ -43,6 +50,11 @@ struct yasl_surface {
struct yasl_private_vector2i reported_size;
uint32_t reported_scale_120, reported_state;
bool refresh_owed;
+ /* yasl_surface_request_frame waits for the frame in flight. */
+ bool frame_requested;
+ /* Written by GL presents on a rendering thread. */
+ _Atomic uint64_t presented_ns;
+ yasl_private_timer_id frame_timer;
void (*refresh)(struct yasl_surface *);
bool text_input_active;
unsigned text_purpose;
@@ -89,6 +101,8 @@ bool yasl_private_events_push(struct yasl_private_display *d, struct yasl_surfac
const struct yasl_private_event *event);
void yasl_private_surface_notify_configure(struct yasl_surface *s, struct yasl_private_geometry geometry);
void yasl_private_surface_notify_refresh(struct yasl_surface *s);
+/* The system showed the surface's last frame; answers a pending frame request. */
+void yasl_private_surface_notify_frame_shown(struct yasl_surface *s);
void yasl_private_surface_notify_close(struct yasl_surface *s);
void yasl_private_surface_notify_state(struct yasl_surface *s, uint32_t state);
void yasl_private_surface_notify_drag(struct yasl_surface *s, enum yasl_private_drag_event ev, struct yasl_private_vector2i pos);
@@ -132,10 +146,15 @@ struct yasl_private_backend_ops {
bool (*surface_update_text_input)(struct yasl_surface *);
enum yasl_private_backend type;
- struct yasl_private_display *(*display_open)(struct yasl_private_loop *loop, const struct yasl_private_display_spec *spec);
+ struct yasl_private_display *(*display_open)(struct yasl_loop *loop, const struct yasl_private_display_spec *spec);
void (*display_close)(struct yasl_private_display *d);
uint32_t (*display_caps)(const struct yasl_private_display *d);
- int (*display_dispatch_timeout)(struct yasl_private_display *d, int timeout_ms);
+ /* The loop driver hooks; see struct yasl_private_loop_driver. prepare and
+ * check are required. wait is optional, for platforms whose events do not
+ * arrive on a descriptor. */
+ bool (*display_prepare)(struct yasl_private_display *d);
+ int (*display_wait)(struct yasl_private_display *d, int timeout_ms);
+ void (*display_check)(struct yasl_private_display *d);
void (*display_flush)(struct yasl_private_display *d);
int (*display_modifiers)(const struct yasl_private_display *d);
/* Optional; returns zero or less when the system reports no interval. */
@@ -161,6 +180,9 @@ struct yasl_private_backend_ops {
void (*surface_set_callbacks)(struct yasl_surface *s, const struct yasl_private_window_cbs *cbs, void *ud);
void (*surface_set_title)(struct yasl_surface *s, const char *title);
void (*surface_schedule_redraw)(struct yasl_surface *s);
+ /* Optional; true while the system has not yet shown the last presented
+ * frame. Without it, frame requests are paced by the refresh interval. */
+ bool (*surface_frame_in_flight)(const struct yasl_surface *s);
bool (*surface_present)(struct yasl_surface *s, const struct yasl_private_framebuffer *fb, const struct yasl_private_damage_list *damage);
/* Optional; NULL means only YASL_PRIVATE_POINTER_NORMAL is supported. Backends that
* implement RELATIVE push POINTER_MOTION with delta set and pos frozen. */