5th of September 2022 to 11th of September 2022

Slint UI Library

New features and user-visible Changes

  • Redo the Online Editor (#1593)

    Our online editor got a major overhaul! Try out the new snapshot!

  • API: Return an error from invoke_from_event_loop and quit_event_loop (#1602)
  • Provide an error enum for the error case of slint::platform::set_platform (#1597)

    cc #1502

  • Make VecModel::remove() return the removed value like Vec (#1592)

    Fixes #1221

Fixes

  • winit: Work around request_redraw() not always resulting in a Event::RedrawRequested (#1613)

    The old workaround doesn't work anymore (commit 575665 removed the redraw_all_windows() but that was correct as well). Instead we take an approach that is hopefully more idiomatic to winit:

    The winit documentation suggests two methods: For continuously repainting windows, we can just draw in MainEventsCleared. Otherwise call request_redraw() and wait for Event::RedrawRequested(id).

    In practice sometimes a call to request_redraw() from within the input event processing results right away in a Event::RedrawRequested (observed on Windows). Sometimes a request_redraw() results in waking up with NewEvents() but no Event::RedrawRequested, and then in the next iteration a new request_redraw() is included (observed on Windows).

    We will continue to issue request_redraw() but for any windows that haven't received Event::RedrawRequested() we will just draw. This still allows the windowing system to compress / combine paint events.

    If during draw(), request_redraw() is called, we assume that the application wants to redraw ASAP and we fall back to Poll. This was previously the workaround in corelib that's now only in the winit code.

    Fixes #1574

  • femtovg backend: fix the cursor position when the text ends with '\n' (#1608)

    Fixes #1318

  • Fix partial renderer not rendering some dirty area that were clipped (#1614)

    During the rendering, if an area is clipped, it will render and therefore won't be rendered as a dependency either.

    Consider this example:

    
      HorizontalBox {
        Rectangle {
          TouchArea {
            Rectangle { background: parent.pressed ? red : blue; }
          }
        }
        Rectangle {
          clip: true;
          TouchArea {
            Rectangle { background: parent.pressed ? red: blue; }
          }
        }
      }
            

    Clicking on the first rectangle will make that area dirty and it case a redraw. Since the second one is clipped away, the renderer will not visit the child items. And clicking on the second rectangle will not make it redraw.

    This patch makes sure we re-adjust the dependency of the window tracker the non-dirty areas

    This fix the printerdemo_mcu stopping to render in some cases

  • Support drawing embedded textures with the non-software renderers (#1611)
  • Fix software renderer line breaker without the Unicode feature (#1606)

    This change makes the test pass without the Unicode feature.

    Note that it's not possible to run the test without the Unicode feature unless one changes the Cargo.toml, so I did that locally to run the tests

  • Fix GL context leaks in online editor and VSCode plugin ( #1603, #1607 )

    There's a memory leak that causes the created canvas elements not be deleted. I've tried a few thing such as explicitly hiding the window (destroying the canvas element instance refs and gl resources we keep in Rust), but it's not enough - somewhere there remains a circular reference. Possibly between some of the closures installed in Rust and DOM elements they are installed on as event handlers.

    I also tried using the wasm-bindgen support for weak refs, but no luck.

    So instead, to plug the leak, this patch introduces the re-use of the HTML canvas element in a way that is similar to how the preview works in vs code's live preview.

    I verified that no GL resources or new canvas elements are leaked in Chrome's heap profiler via snapshot comparison and filtering for the corresponding DOM element types.

  • Fix non-SVG images with transparency being rendered incorrectly in WASM builds (#1604)

    Commit 05b16b introduced an exception for SVGs images to treat them as premultiplied, but commit 3ef35c accidentally applied the flag to all HTML images, which is wrong.

  • winit: Enforce the min/max size in the WindowBuilder and set size again for wasm (#1595)

    In previous version, we were setting the constraint with WASM after the window was shown, but this is no longer the case because we delay the window creation by an iteration of the event loop. Now should apply the constraint before showing the window.

    But on wasm, we also must manually enforce these constraint because the size given to the WindowBuilder is not applied

  • Fix "glyph box" in text with \n with the software renderer (#1590)

    This patch explicitly excludes glyph clusters from text fragments that feed into lines that originate from one of the three valid separators: ASCII newline, Unicode paragraph and Unicode line separators.

  • Fix the way the window resizes (#1589)
    • We must first set change the constraints before changing the size otherwise the new size might not be in the old constraint and the change might not take effect.
    • We must update the WindowItem's size even if the size of the window doesn't change. This happens when a component is set on a window that that doesn't change it size (eg, preview) but for which we need to set the geometry on the window

Build System

  • Bump version number to 0.3.0 (#1594)
  • Rename the compat-0-2-0 feature to compat-0.3.0 (#1605)

    But keep a compat-0-2-0 for compatibility

  • Rename the backend cargo features (#1609)

    Rename the renderer features to backend to better reflect what they are doing. This does not impact all users running with the default features.

Janitor work

PRs: #1591, #1598, #1599, #1600, #1601, #1610, #1612, #1619

Statistics

97 patches committed in 30 pull requests by 3 authors.

← Next : 12th of September 2022 to 18th of September 2022 | Previous : 29th of August 2022 to 4th of September 2022


Slint is a declarative GUI toolkit to build native user interfaces for desktop and embedded applications written in Rust, C++, JavaScript, and Python. Find more information at https://slint.dev/ or check out the source code at https://github.com/slint-ui/slint