1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
|
# Migrating pre-release applications
YASL 0.1 has no stable source or binary compatibility promise. Rebuild all
consumers against matching public headers and the library after updating.
See the [application guide](guide.md) for the full window and input workflow.
## Application callbacks
All examples now use `<yasl/app.h>` and `yasl_run()`. Move window creation to
`yasl_app_desc.init`, input handling to `.event`, and drawing to `.frame`.
Replace manual dispatch/poll/flush loops with the runner and request redraws with
`yasl_surface_request_frame()`. Present the frame context with
`yasl_frame_present_cpu()`; the runner destroys remaining surfaces on exit.
Unified pointer button and motion events retain `device` and tablet axes.
Handle `YASL_EVENT_INPUT_RESET` by clearing held input and active strokes, just
as for the core API's `YASL_INPUT_RESET`. Window state remains a `YASL_STATE_*`
bitmask; `YASL_STATE_TILED` is reported for tiled Wayland toplevels.
## Window creation
Rename `struct yasl_surface_spec` to `struct yasl_window_spec` and
`struct yasl_surface_cbs` to `struct yasl_window_cbs`. Surface handles and
functions retain their names. Supply the window's callback table in `spec.cbs`
and its userdata in `spec.ud` when calling `yasl_surface_create_toplevel()` or
`yasl_surface_create_native()`. Callback tables are copied, and userdata is
borrowed. The new window's callbacks cannot run before creation returns; read
initial geometry with `yasl_surface_geometry()` and request the first redraw
after initializing application state.
`yasl_surface_set_callbacks()` remains available to replace callbacks after
creation and to configure popups. A NULL `spec.cbs` creates a window without
callbacks. Displays owned by `yasl_run()` use the runner's callbacks instead;
provide application notifications through `yasl_app_desc.event` and `.frame`.
## Keyboard events
| Previous use | Replacement |
| --- | --- |
| Linux keysym or Cocoa virtual keycode in `key.key` | Portable physical `YASL_KEY_*` identity |
| `key.base` | `key.native_code`, with explicit backend-specific encoding |
| `key.keypad` | Distinct `YASL_KEY_KP_*` identities |
| Advisory `key.text` character | `YASL_INPUT_TEXT` UTF-8 payload for insertion |
| Layout label from a keysym | Optional `key.codepoint` and `key.shifted` Unicode scalars |
Replace magic numbers and X11 symbols with named keys. For example, a quit
command checks `key.key == YASL_KEY_ESCAPE` on a press. `YASL_KEY_A` means the
US A position on every layout; use layout labels when a command should follow
the printed letter instead. Do not cast key identities to characters. Keypad
Enter and ordinary Enter now have distinct identities without a separate flag.
Text comes only from `YASL_INPUT_TEXT`. Handle its byte length, copy it when
retaining it after the next successful poll, and allow multiple characters per
commit. Cocoa sends key events through its text input manager; Wayland emits
ordinary XKB text and locale compose results in addition to IME commits.
## Scroll events
Replace `scroll_lines`, `scroll_delta`, and scroll button numbers with
`mouse.scroll.x` and `.y` when `mouse.kind == YASL_PTR_SCROLL`. These double
values are fractional line offsets, positive right/down on every backend.
Do not infer scroll direction from `button`. One event may include both axes.
Remove backend-specific sign inversions and whole-line casts; multiply the
offset by your application's preferred pixels per line instead.
X11 still supplies whole wheel steps. Wayland high-resolution wheels and smooth
offsets, and Cocoa precise scrolling, preserve fractions. Device acceleration
and system preferences still affect the native offsets.
|