Rust Winit
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Write
        • Owners
        • Signed-in users
        • Everyone
        Owners Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Help
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Write
Owners
  • Owners
  • Signed-in users
  • Everyone
Owners Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Winit meeting Date: 2024-01-26T14:00:00Z (UTC) Attended: @madsmtm, @daxpedda, @kchibisov Last meeting notes: <https://hackmd.io/vvcTgQEmTIa8nyPR8vxJ_w> ## Organizational Make these HackMDs public, at least post on Matrix? Should we keep a historic account of meeting notes? @madsmtm has created an account, so they're at least stored there now (also, you don't seem to be able to change the title without an account). - Should we even use HackMD? Are there better tools for this kind of stuff? Google Docs? - How much should we use Discord? (Ideally not for anything other than the call, ) - Conclusion: Post HackMDs on Matrix before the call. - (Optional?) Post summary on github discussions in a thread for meetings. How are the meeting notes as laid out here? Are they fine, or should we do something else? - They're fine. Move more discussion to GitHub, but inside `winit` repo, not `winit-next`. - Communicate [upgrade plan](https://hackmd.io/vvcTgQEmTIa8nyPR8vxJ_w#Upgrade-plan) for everyone to follow along, probably on <https://github.com/rust-windowing/winit/issues/3367>. - Document weekly meetings and core team _somewhere_. Communicate bigger changes in changelog. - Example of how docs are done right https://docs.rs/winnow/ - Move changelog to docs.rs (cargo doc as well)? Are GitHub Discussions worth it? To me, it just seems like two places to have issues... - Useful for user questions. - Maybe move user questions inside issues to discussions? - Postponed to later ## User communication What's the best way to communicate why `v0.30` changes are to be had? A new GitHub issue/discussion that outlines the reasoning and migration steps, and then users can comment there why their use-case doesn't work with the new design? Or note this in the changelog, and encourage users to open new issues for each complaint? I think having an existing issue is lower-friction for feedback. - Open issue for 0.30 planning and pin it(and make it accesible for maintainers only, how it was done for 0.29), and also link to discussion thread for users to ask/complain. Draft text for the trait rework at the bottom, other big changes will need a similar thing. ## Event handling and hooks `tracing-subscriber` and why that doesn't work? <https://matrix.to/#/!DGpLzJTRzBDTwZiogk:matrix.org/$M2KtcQIpR0OMKpf_Z2HiTFbei-VgoRuwMrxhfXereoc?via=matrix.org&via=ralith.com&via=mozilla.org> Maybe trait that is used both for users and subscribers. ```rust impl ApplicationHandler for EguiContext { ... } impl ApplicationHandler for App { ... } let mut state = ...; event_loop.run(|runner| { // This closure is run on every event. // subscriber if runner.run(&mut state.egui_context) { // event was consumed return } // user runner.run(&mut state.app); }); // Internally struct BackendState { winit: Winit, runner: Box<Fn(Runner)> } // Called when I get an event from Wayland connection. fn resize(&mut self, window_id: WindowId, new_size: Size) { user_state = &mut state.app; user_state.resize(&mut state.winit, window_id, new_size); // Push back to event_sink: Vec<Event>. let mut new_size = None; self.runner.call(|app: &mut dyn ApplicationHandler| { new_size = Some(app.resize(window_id)); }); } ``` Make sure you can always just not return anything, and just have some default behaviour? Are there methods that will be required? Events with special default behaviour: - CloseRequested: Deny closing? - Scaling Wayland: ? #### Meeting stopped around here #### <hr> Other idea: ```rust // (ab)use type-system magic to use closures and avoid implementing a trait struct App { // ... state } event_loop .with_state(App { ... }) .on_wakeup(|state, active, start_cause| { match start_cause { // ... } }) .on_window_event(|state, active, window_id, event| { match event { // ... } }) .run()?; ``` ## Dropping `Window` [#3317](https://github.com/rust-windowing/winit/issues/3317) ## @madsmtm's GitHub nitpicking Get rid of the [Testers and Contributors table](https://github.com/rust-windowing/winit/wiki/Testers-and-Contributors), and the wiki in general. Get rid of `FEATURES.md`, replace with a section in the `README.md` that documents the intended scope only. Add [issue templates](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates) so we don't have to waste time asking users which platform they're using. --- --- Will need to be adjusted once [#3386](https://github.com/rust-windowing/winit/pull/3386) lands. # We're changing Winit's event loop callback Hey everyone! There are some big changes in Winit `v0.30` that are going to affect you. In particular, we're changing the event loop callback from a closure to a trait-based system. This is done in anticipation of [further design changes](https://github.com/rust-windowing/winit/issues/3367), but will primarily enable you to return values back to the event loop - which in turn will allow us to correctly implement oft-requested features like clipboard access, drag and drop, better IME, and so on. ## Migration The migration _should_ be fairly straightforward, although it will probably take a bit of time and manual work. The key change is that instead of `event_loop.run` taking a closure, you must now create a new type that implements the `ApplicationHandler` trait, and which contains the state that was previously implicit in the closure, see the following code example. ```rust // Before let mut click_counter = 0; let mut window = None; event_loop.run(|event, window_target| { dbg!(event); match event { Event::NewEvents(StartCause::Init) => { window = Some(Window::new().build(window_target)); } Event::WindowEvent { event, window_id } => { match event { WindowEvent::MouseInput { state: ElementState::Pressed, button: MouseButton::Left, .. } => { self.click_counter += 1; if let Some(window) = window.as_ref() { window.set_title(format!("clicked {click_counter} times")); } } _ => { // .. handle other window events } } } _ => { // .. handle other events } } })?; // After struct App { my_counter: i32, window: Option<Window>, } impl App for ApplicationHandler { fn all_events_hook(&mut self, active: ActiveEventLoop<'_>, event: &Event) { dbg!(event); } fn wakeup(&mut self, active: ActiveEventLoop<'_>, start_cause: StartCause) { if let StartCause::Init = start_cause { self.window = Some(active.create_window(WindowAttributes::new())); } } fn window_event( &mut self, active: ActiveEventLoop<'_>, window_id: WindowId, event: WindowEvent, ) { match event { WindowEvent::MouseInput { state: ElementState::Pressed, button: MouseButton::Left, .. } => { self.click_counter += 1; if let Some(window) = self.window.as_ref() { window.set_title(format!("clicked {} times", self.click_counter)); } } _ => { // .. handle other window events } } } // .. handle other events } event_loop.run(App { click_counter: 0, window: None, })?; ``` ## Feedback If you run into any problems with migrating, please feel free to submit feedback on this issue, especially if you have use-cases that are not possible, or are more difficult to do with the new design.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully