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

API to enable creating winit Windows with Slint's event loop #7227

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

npwoods
Copy link
Contributor

@npwoods npwoods commented Dec 28, 2024

In winit, it is not possible to instantiate a new window without access to the winit event loop, which Slint manages. With this change, there is now a create_winit_window call on Slint's winitback end that will enable creatingwinit` windows using existing functionality.

Of course, the utility of these windows is limited without access to winit event handling, but there are applications for which simply creating a window and instructing an external program to write into it (by passing the HWND on Windows or the XId on X11) is useful.

…t's event loop

In `winit`, it is not possible to instantiate a new window without access to the `winit` event loop, which Slint manages.  With this change, there is now a `create_winit_window` call on Slint's winit` back end that will enable creating `winit` windows using existing functionality.

Of course, the utility of these windows is limited without access to `winit` event handling, but there are applications for which simply creating a window and instructing an external program to write into it (by passing the `HWND` on Windows or the `XId` on X11) is useful.
@ogoffart ogoffart changed the title ChangeLog: Creating an API to enable creating winit Windows with Slint's event loop API to enable creating winit Windows with Slint's event loop Dec 30, 2024
@ogoffart
Copy link
Member

Thanks for the PR.

In principle, I have nothing against adding private API if that can be useful. (But this is private API so it may not stay compatible)

I wonder if it would not be more useful to somehow make with_window_target accessible. And also allow to intercept events for such windows.

Copy link
Member

@tronical tronical left a comment

Choose a reason for hiding this comment

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

I agree. This will get a bit more complicated in the next winit version, we’ll have to change this api then. But until then this looks good to me, too.

I think eventually we might want to permit providing an ApplicationHandler that we proxy through.

@tronical tronical merged commit cfc52c3 into slint-ui:master Jan 2, 2025
37 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.

3 participants