Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement version 0.7.5 of Glk spec #65

Merged
merged 9 commits into from
Jan 2, 2024
Merged

Implement version 0.7.5 of Glk spec #65

merged 9 commits into from
Jan 2, 2024

Conversation

ptomato
Copy link
Member

@ptomato ptomato commented Nov 5, 2023

Most of this is actually either copying the changes in the specification text and the platform-independent blorb/dispatch layers, or improvements to the mechanisms we have for testing. There was not that much to change inside the library:

  • character input for graphics windows
  • silence a warning when opening a nonexistent file
  • don't allocate size to a Glk window when it has zero height or width

Stubs for the documentation of giblorb_load_image_info() and
giblorb_image_info_t because they are not described in the Glk spec yet.
The new symbols are marked as unstable in the docs.
For gidispatch_set_autorestore_registry, include a stub.

The new symbols are marked as unstable in the docs because they are not
mentioned in any version of the Glk specification yet.
The new glk.h header file adds __attribute__((noreturn)) to glk_exit().
However, g_thread_exit() does not have this annotation, so indicate to the
compiler that the function really can never return.

See https://gitlab.gnome.org/GNOME/glib/-/merge_requests/3562
The Glk specification 0.7.5 clarifies that this is supposed to return NULL
silently, and not abort as some early Glk libraries did. We already
returned NULL, but not silently, so it's a good opportunity to include a
test.
In Glk 0.7.5, Unicode file streams written in text mode are required to
be written out with UTF-8 encoding. We already did this, but add some
tests exercising each of the glk_put_... functions that check that the
file is written using UTF-8 encoding.
Character input in graphics windows is new in version 0.7.5 of the Glk
specification. It's relatively easy to enable; add key presses to the
events accepted by the graphics window's GtkDrawingArea, and allow the
graphics window to have the input focus.

Add a test, for which we also have to give glkunit-runner the ability to
send character input to the Glk program.
New in the 0.7.5 Glk spec is a note about zero-size windows. They should
disappear completely, including any borders that they have. This change
makes the size allocation code ignore zero-size windows, and in the case
of a pair window that is going to allocate zero size to one of its
children, it should instead give the entire space to its other child,
eliminating the border.

This is an interesting problem to test, but it can be done by testing
against a reference image. This mechanism might be useful for writing more
tests in the future, so we add a reftest runner (and image diffing code
copied from GTK's reftest suite.)
@ptomato ptomato merged commit 92235eb into main Jan 2, 2024
4 checks passed
@ptomato ptomato deleted the glk-0.7.5 branch January 2, 2024 21:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant