WIP: Wayland: window resize #1441

Draft
fnzr wants to merge 4 commits from fnzr/wayland-resize into main
fnzr commented 2026-01-10 13:41:04 +00:00 (Migrated from github.com)

This is more of a proof of concept implementation, because I need to clarify a couple things first:

  1. I moved waiting for wayland events to after try core.initWindow(window_id); call. Otherwise, the resizing logic tries to swap the framebuffer before it's ready, crashing the program.

I don't know if this is a viable solution, but if not, we need another way to check if core.initWindow was already called.

  1. I'm not sure how to provide the initial window size, so currently the window size is defined solely by the compositor (i think that's standard on wayland?) I don't see examples of it in the examples directory, so I'm not sure if this is a library limitation, wayland limitation, or me limitation.

Working example, there's no changes required on userland:

https://github.com/user-attachments/assets/83e24b20-99a6-4081-bbc7-177a764ffc5f

  • By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
This is more of a proof of concept implementation, because I need to clarify a couple things first: 1. I moved waiting for wayland events to after `try core.initWindow(window_id);` call. Otherwise, the resizing logic tries to swap the framebuffer before it's ready, crashing the program. I don't know if this is a viable solution, but if not, we need another way to check if `core.initWindow` was already called. 2. I'm not sure how to provide the initial window size, so currently the window size is defined solely by the compositor (i think that's standard on wayland?) I don't see examples of it in the examples directory, so I'm not sure if this is a library limitation, wayland limitation, or me limitation. Working example, there's no changes required on userland: https://github.com/user-attachments/assets/83e24b20-99a6-4081-bbc7-177a764ffc5f - [x] By selecting this checkbox, I agree to license my contributions to this project under the license(s) described in the LICENSE file, and I have the right to do so or have received permission to do so by an employer or client I am producing work for whom has this right.
fnzr commented 2026-01-10 19:36:44 +00:00 (Migrated from github.com)

Moved the c.xdg_toplevel_set_title(wl.toplevel, @ptrCast(core_window.title)); call to before the first commit of surface. This allows the window to have a title in creation, allowing compositor to match window rules immediately. This fixes the initial window size problem I was having.

Also added the app_id field on the window, allowing the user to provide a XDG application id to the window. I only made it work on Wayland. I can create a different PR with this feature only if more appropriate.

Moved the ` c.xdg_toplevel_set_title(wl.toplevel, @ptrCast(core_window.title));` call to before the first commit of surface. This allows the window to have a title in creation, allowing compositor to match window rules immediately. This fixes the initial window size problem I was having. Also added the app_id field on the window, allowing the user to provide a XDG application id to the window. I only made it work on Wayland. I can create a different PR with this feature only if more appropriate.
This pull request is broken due to missing fork information.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin fnzr/wayland-resize:fnzr/wayland-resize
git switch fnzr/wayland-resize

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch main
git merge --no-ff fnzr/wayland-resize
git switch fnzr/wayland-resize
git rebase main
git switch main
git merge --ff-only fnzr/wayland-resize
git switch fnzr/wayland-resize
git rebase main
git switch main
git merge --no-ff fnzr/wayland-resize
git switch main
git merge --squash fnzr/wayland-resize
git switch main
git merge --ff-only fnzr/wayland-resize
git switch main
git merge fnzr/wayland-resize
git push origin main
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
hexops/mach!1441
No description provided.