Skip to content

Conversation

@bmansurov
Copy link

Here you can see how the demos look after the refactor: https://www.youtube.com/watch?v=PPpZDB61oxs

Issue: #186

- Make menu font larger if a larger font exists;
- Don't block the main menu rendering;
- Move demos to spearate files;
- Simplify demo registration code;
- Fix issues where nothing shows up in some demos;
- Add standalone demos to the main demo interface;
- Fix the related issues in the manual;
- Allow opening multiple instances of individual demos;
- Get rid of modelines in some files as modern editors are smart enough;
- Disable some demos and test code until they are fixed.

Recommended future improvements:
- Recording and playing the history on window remap. This is not
  essential for demos that clear the window before drawing the next
  frame, but the demos like Plaid don't look quite nice without this
  enhancement.

Issue: sharplispers#186
@bmansurov bmansurov force-pushed the issue-186 branch 2 times, most recently from 4980b41 to 064295e Compare October 1, 2025 01:37
Fix the following:
- Image test
- Trapezoid
- Clipboard
- Bezier (The original code seemed to be using a now-defunct
  experimental X11 Bezier extension. Replace it with a new
  implmentation.)

The two remaining demos (gl-test and mandel) don't run at all. Need to
get them working in a future patch before refactoring. I've re-enabled
them for now.

Issue: sharplispers#186
@bmansurov
Copy link
Author

I think the PR is ready for a review.

Copy link
Member

@dkochmanski dkochmanski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please split this pull request into more commits, that's too big as it is for me to review, i.e


Commit:
- Make menu font larger if a larger font exists;
- Don't block the main menu rendering;
- Simplify demo registration code;
- Get rid of modelines in some files as modern editors are smart enough;

Commit:
- Allow opening multiple instances of individual demos;

Commit:
- Move demos to spearate files;

Commit:
- Disable some demos and test code until they are fixed.
- Add standalone demos to the main demo interface;

Commit:
- Fix issues where nothing shows up in some demos;

Commit:
- Fix the related issues in the manual;

I've also noticed, that clx crashes my lisp instance when I close a window, but I've verified that this issue is already present in master. Is this the same for you?


;;; X11 Context Management

(defmacro with-x11-context (&body body)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This macro is defined and used wrong.

i.e

(with-x11-context ()
    (let ((menu (create-demo-menu)))
      (handle-events menu)))

will expand to

(unwind-protect nil
  (let ((menu (create-demo-menu)))
      (handle-events menu)))
  (xlib:close-display *display*))

@bmansurov
Copy link
Author

bmansurov commented Oct 27, 2025

@dkochmanski thanks for the review. I'll make the changes.

I've also noticed, that clx crashes my lisp instance when I close a window.

No, I haven't seen this bug. I'm using SBCL. What Lisp are you using? What window manager?

@dkochmanski
Copy link
Member

dkochmanski commented Oct 28, 2025

thanks for conformiation. I've actually tried to debug it and it led me to sbcl internals where it waits for fd being available (using posix subsystem). Going any deeper was unfeasible.

I've formulated the following hypothesis: when we don't handle "close" event in demos, wayland (I'm using on this computer x11 compatibility layer) closes the fd, and when sbcl tries to fiddle with it, then the operating system kills sbcl for accessing unavailable resource. It does not happen on my other computer where I'm using "normal" x11.

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.

2 participants