summaryrefslogtreecommitdiff
path: root/src/common/desktop.c
diff options
context:
space:
mode:
authorBerke Güzel <wenekar1@gmail.com>2026-10-13 23:41:31 +0300
committerBerke Güzel <wenekar1@gmail.com>2026-10-13 23:41:31 +0300
commit76073fe5fad8799e5850805f2f090af2cb62c741 (patch)
tree9658019babe4760a3634bdab4da0731a10e42e68 /src/common/desktop.c
parentdd1775a9927922c14f8679ccbc4d3ca8d5917e20 (diff)
Simplify the public event and CPU API
Applications now need far less ceremony: hello.c is a 20-line loop that handles REFRESH, CLOSE and QUIT and draws into the surface's own pixels. - Fold GEOMETRY, STATE and FOCUS into one WINDOW event carrying size, scale and state; unchanged values send nothing. - Guarantee REFRESH once a window has a size and after every resize, never at size zero. - Merge DROP_HOVER into DROP with over/leave/data actions and give drag and drop actions enums. - Keep event strings valid until the next wait and drop yasl_event_release; empty or failed waits report NONE. - Replace copy-in presentation with a lent pixel buffer: yasl_cpu_pixels and yasl_cpu_present. - Remove yasl_poll_event, yasl_cpu_read_pixels, unused event fields and comments that restated names. - Wayland: resize floating windows in request_size instead of reporting it unsupported, and stop marking new GPU surfaces as Vulkan so yasl_vulkan_create_surface no longer fails with NATIVE_WINDOW_IN_USE. Also includes the in-progress public API refactor that was uncommitted in the tree (removal of the app/loop layer, new surface, GL and Vulkan entry points). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Diffstat (limited to 'src/common/desktop.c')
-rw-r--r--src/common/desktop.c30
1 files changed, 22 insertions, 8 deletions
diff --git a/src/common/desktop.c b/src/common/desktop.c
index 23c62d7..5045604 100644
--- a/src/common/desktop.c
+++ b/src/common/desktop.c
@@ -1,4 +1,4 @@
-#include "yasl/desktop.h"
+#include "common/private_desktop.h"
#include "common/backend.h"
#include "common/desktop.h"
@@ -36,46 +36,60 @@ static size_t copy_out(char *out, size_t cap, const char *s, size_t len)
return len;
}
-bool yasl_display_open_uri(struct yasl_display *d, const char *uri)
+bool yasl_private_display_open_uri(struct yasl_private_display *d, const char *uri)
{
if (!d || !uri || !uri_valid(uri)) return false;
return desktop_open_uri(uri);
}
-bool yasl_display_notify(struct yasl_display *d, const char *title, const char *body)
+bool yasl_private_display_notify(struct yasl_private_display *d, const char *title, const char *body)
{
if (!d || !title) return false;
return desktop_notify(d->app_id, title, body ? body : "");
}
-uint32_t yasl_display_appearance(struct yasl_display *d)
+uint32_t yasl_private_display_appearance(struct yasl_private_display *d)
{
return d ? desktop_appearance() : 0;
}
-bool yasl_surface_bell(struct yasl_surface *s)
+bool yasl_private_surface_bell(struct yasl_surface *s)
{
if (!s || !s->display->ops->surface_bell) return false;
return s->display->ops->surface_bell(s);
}
-size_t yasl_executable_path(char *out, size_t cap)
+size_t yasl_private_executable_path(char *out, size_t cap)
{
if (!out && cap) return 0;
char buf[DESKTOP_STR_MAX];
return copy_out(out, cap, buf, desktop_executable_path(buf, sizeof(buf)));
}
-size_t yasl_resource_dir(char *out, size_t cap)
+size_t yasl_private_resource_dir(char *out, size_t cap)
{
if (!out && cap) return 0;
char buf[DESKTOP_STR_MAX];
return copy_out(out, cap, buf, desktop_resource_dir(buf, sizeof(buf)));
}
-size_t yasl_default_locale(char *out, size_t cap)
+size_t yasl_private_default_locale(char *out, size_t cap)
{
if (!out && cap) return 0;
char buf[DESKTOP_STR_MAX];
return copy_out(out, cap, buf, desktop_default_locale(buf, sizeof(buf)));
}
+
+#include "public_internal.h"
+#include "yasl/desktop.h"
+#include <errno.h>
+bool yasl_open_uri(const char *uri)
+{ if(!uri||!uri_valid(uri))return yasl_public_fail(EINVAL);errno=0;return desktop_open_uri(uri)||yasl_public_fail(errno); }
+bool yasl_notify(const char *title,const char *body)
+{ if(!yasl_public_owner())return false;errno=0;return yasl_private_display_notify(yasl_public_display(),title,body)||yasl_public_fail(errno); }
+unsigned yasl_appearance(void) { return yasl_private_display_appearance(yasl_public_display()); }
+bool yasl_surface_bell(yasl_surface *s)
+{ if(!yasl_public_surface(s,false))return false;errno=0;return yasl_private_surface_bell(s)||yasl_public_fail(errno); }
+size_t yasl_executable_path(char *out,size_t cap) { return yasl_private_executable_path(out,cap); }
+size_t yasl_resource_dir(char *out,size_t cap) { return yasl_private_resource_dir(out,cap); }
+size_t yasl_default_locale(char *out,size_t cap) { return yasl_private_default_locale(out,cap); }