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

linux: setup with new object system #1319

Merged
merged 6 commits into from
Dec 24, 2024
Merged

Conversation

joshua-holmes
Copy link
Contributor

@joshua-holmes joshua-holmes commented Dec 7, 2024

  • Setup Wayland to use new mach object system

    • In listeners, such as wl_registry_add_listener, rather than sharing a pointer to an instance of Linux with the Wayland server, pass the mach object system window id.
    • Store a pointer to Core in the global scope of Wayland so that listeners can use the provided window id and pointer to Core to lookup the data for that window, modify it, and save it directly in the handler function. See registryHandleGlobal() definition for an example.
    • Handle some errors that were previously unhandled
    • Handle getting and setting the state of windows when needed. Previously a step that wasn't done because we only had 1 state to manage, now we have 2: state in the local scope, and state in the mach object system (core.windows)
  • Setup X11 to use new mach object system

    • Store native state in new Native struct
    • Store a pointer to Core in the global scope. I think this can be avoided. Not sure if it's a good idea for X11
  • Setup logs to appropriately explain the current status of the X11 implementation, which is not functional

Both X11 and Wayland work at runtime

  • 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.

@joshua-holmes
Copy link
Contributor Author

Started working on X11. Will probably just put it in this PR if it's not merged by then.

@joshua-holmes joshua-holmes changed the title wayland: setup with new object system linux: setup with new object system Dec 20, 2024
This is because something is not working with the new Mach Object system. It should be able to be fixed after messing around with it.
@joshua-holmes
Copy link
Contributor Author

X11 now builds and runs

@joshua-holmes
Copy link
Contributor Author

Setting title now works on both backends. It does this by checking if the window.title field has been updated every tick, if it has, update the window to reflect that.

@@ -204,6 +187,17 @@ pub fn setCursorShape(_: *Linux, _: CursorShape) void {
return;
}

/// Checks for updates in mach object fields. Does nothing if window is not initialized.
fn check_for_mach_updates(core: *Core, window_id: mach.ObjectID) void {
Copy link
Member

Choose a reason for hiding this comment

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

we should remove this function and inline this functionality where written

@emidoots emidoots merged commit 9a4ae36 into hexops:main Dec 24, 2024
2 of 3 checks passed
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