Commit graph

1507 commits

Author SHA1 Message Date
Simon Hausmann
860f318f7c
Bump femtovg, rustybuzz, ttf-parser, and fontdb dependencies (#2191)
Mostly bugfix changes upstream with some minor API changes. FemtoVG is
no more limited to 24 gradient stops for the paint.
2023-02-08 09:56:53 +01:00
Simon Hausmann
ed8ea3c85c Prospective fix for Linux systems that don't support EGL with X11
As the surface creation may fail with Egl later, then display preference
EglThenGlx is not sufficient and we need to completely re-do the glutin
initialization and try with GLX.

cc #2162
2023-02-03 17:12:59 +01:00
Olivier Goffart
33dc95f165 Update winit 2023-02-03 13:36:36 +01:00
ogoffart
e7f48512ee Bump version number to 1.0.0 2023-02-03 11:07:15 +01:00
Olivier Goffart
8e0a8ca5cf Qt: use the double click interval from the platform 2023-02-03 08:48:49 +01:00
Olivier Goffart
f34b1bda2e Add primary keyboard support on unix (selection copy, middle click paste)
Closes #2146
2023-01-31 16:39:22 +01:00
Simon Hausmann
32d2ba70ca
Change WindowEvent::KeyPressed/Released to use a SharedString instead of a char (#2148)
Also, `WindowEvent` is not `Copy` anymore.

Closes #1749
2023-01-31 15:44:54 +01:00
Florian Blasius
d84de623b4
TextEdit select text with double and dribble click (#2088)
* Select word in `TextEdit` by double click
* Select paragraph in `TextEdit` by dribble click
2023-01-31 15:04:19 +01:00
Simon Hausmann
8c807cb1da
Remove slint::Image::stride() (#2147)
cc #2138
2023-01-30 13:59:31 +01:00
Simon Hausmann
04ceb63433 Update to FemtoVG 4.0
Not big changes, just API and Cargo feature cleanups
2023-01-27 12:03:33 +01:00
Olivier Goffart
ae20ec59c8 Rename PointerEventButton::None to PointerEventButton::Other
And mark the enum non_exhaustive

closes #1903
2023-01-26 13:36:54 +01:00
Olivier Goffart
a0fb8bc771 Remove support of old SIXTYFPS_ env variable, and sixtyfps_widgets.60 2023-01-26 13:36:38 +01:00
Simon Hausmann
52fb1ab9fe Fix signature of get_proc_address in Rust GraphicsAPI
Use a CStr instead of str, to avoid an extra CString allocation. The underlying operating system API for
this expects a zero terminated C String.

Fixes #1943
2023-01-26 11:55:10 +01:00
Olivier Goffart
f4fca41173 Compile the winit backend's with RUSTFLAGS='--cfg slint_int_coord'
(at least the swrenderer part)
2023-01-24 15:52:49 +01:00
Olivier Goffart
0aeb4d2aec Qt: fix clipping of itemview when not using the Qt backend
In that case, the clip is null which means no clip (as opposed as "clip
everything")
2023-01-23 16:26:49 +01:00
Olivier Goffart
66b848227b StandardTableView resizable columns 2023-01-23 16:26:49 +01:00
Olivier Goffart
fabebaa009 Adjust the look of the native StandatdTableView
- The header should be within the frame
 - Use the NativeStandardListViewItem so we have the right alternative
   row coloring and hover
2023-01-23 16:26:49 +01:00
Simon Hausmann
5ff0278185 Simplify path event extraction
Return the path events for rendering as an Option, so that if the path is empty,
we simply return.

This avoids a double property dependency in the (likely) event the path is not empty.
2023-01-21 13:10:19 +01:00
Olivier Goffart
d6b66a0690 Skia/femtfovg rectangle with transluscent border: set minimum radius
Set the minimum radius of the background to limit the artifact when
drawing the border
2023-01-20 14:12:43 +01:00
Simon Hausmann
911d0e42a9 Fix FemtoVG's drawing of the border rectangle with non-opaque borders (#2079)
Also fix the border radius to be the outer radius of the rectangle

FemtoVG renderer part of #1988 (minus clipping)
2023-01-19 12:13:11 +01:00
Simon Hausmann
b6b2a0e555 Fix rendering of #1988's testcase with Qt
Don't rely on the pen not being set when drawing the background of a rectangle
with transparent border. On my machine with the test case the pen has some other
color from previous drawing (or Qt internal?).
2023-01-18 18:05:53 +01:00
Olivier Goffart
4bc7571506
Qt backend: Fix drawing of the border rectangle with non-opaque borders (#2079)
Also fix the border radius to be the outer radius of the rectangle

Qt renderer part of #1988  (minus clipping)
2023-01-18 14:05:12 +01:00
Olivier Goffart
dab95b4220 Native button: highlight on mouse over 2023-01-16 03:12:35 -08:00
Olivier Goffart
00de1867ae Janitor: deps upgrade 2023-01-16 10:47:55 +01:00
Florian Blasius
f2aab576f4
Add StandardTableView widget (#2032)
* Text only StandardTableView with column and rows
* Text editing of cells
* Sort by column ascending and descending
* Variants of the TableView for native, fluent and material
2023-01-12 19:41:12 +01:00
Florian Blasius
ed67f3aabb
bump soft-buffer to 0.2 (#2038) 2023-01-09 09:08:59 +01:00
Simon Hausmann
09659eaa42 Improve Qt input event handling
As suggested by @wengxt, we should always clear the preedit when instructed by the IME (via
an empty preedit string). We do that with winit, too.

Relates to #1925
2022-12-22 10:31:01 +01:00
Simon Hausmann
9b2726f0eb Further cleanups in Femtovg renderer's GL context handling
Make with_graphics_api robus by ensuring that the context is always current (similar to commit a124f4b8fe)
and remove the with_current_context boilerplate.
2022-12-22 09:15:47 +01:00
Simon Hausmann
1505826e7d Simplify glutin context handling in the femtovg renderer
Similar to commit a124f4b8fe,
always use a PossiblyCurrentContext
and use glutin's interior mutability to ensure that the context is current.
2022-12-22 09:15:47 +01:00
Simon Hausmann
4c1eff5812 Move the glutin context wrapper into the femtovg renderer
It's only needed there.
2022-12-22 09:15:47 +01:00
Olivier Goffart
5cd38adb14 Move the colorize property to the Image item
Instead of the ClippedImage. Because we use the colorize property more
often than the source property, and these are soon going to be even more
expensive
2022-12-20 08:42:47 -08:00
Simon Hausmann
dee1b11a83 Initial support for truetype fonts in the software renderer
This works, but it's super slow as for every glyph the font is loaded
again and the glyphs are rasterized every time they're drawn.
2022-12-16 18:20:12 +01:00
ogoffart
ce07d078ce Bump version number to 0.3.4 2022-12-16 09:36:15 +00:00
Olivier Goffart
80a834f489 Janitor: fix warning about unusd function
Move the function in the module that uses it (which can be disabled with
features)
2022-12-15 15:15:04 +01:00
Simon Hausmann
aea216fb49 Fix rendering of border widths with FemtoVG and Skia
Commit f66a2a5775 and dc048a11db introduced
the regression of issue #1985 where in adjust_rect_and_border_for_inner_drawing
instead of subtracting the entire border width from the size,
only half of it was subtracted,
leaving an inner area of the rectangle visible.

Fixes #1985
2022-12-14 15:32:53 +01:00
Olivier Goffart
11022b01f3 Fix winit not taking the original size of the canvas into account
We need to check the original size of the canvas before winit override it

The previous code didn't work for two reason
 - It was done after winit had reset the size of the canvas to the
   default size
 - It just calls set_inner_size on the winit Window, which is not what we want,
   we want to call the api::Window::set_size funciton so it can keep all
   different sizes in sync
2022-12-14 14:03:26 +01:00
Simon Hausmann
14350a970b Cleanup: consume the original pixel buffer in the conversion for softbuffer 2022-12-13 16:51:26 +01:00
Simon Hausmann
64a42ca97d Remove unnecessary import of the old raw-window-handle trait 2022-12-13 16:51:26 +01:00
Simon Hausmann
5820db6088 Remove the OpenGL dependency for renderer-winit-software
Use softbuffer to bring pixels produced by the software renderer to the screen.
2022-12-13 16:51:26 +01:00
Simon Hausmann
4883786546 Try to clean up the workaround for the window resizing bug on Windows
Use a dedicated cell and clean up the comments.
2022-12-13 16:50:35 +01:00
Simon Hausmann
f45ab26efe Fix endless window resize on Windows with winit
Restore the resize_event recursion guard accidentally removed in commit 06f7f76b69
2022-12-13 13:31:35 +01:00
Simon Hausmann
8e3df98ffe Minor cleanup
Replace indirect access to the window field with direct access.
2022-12-12 14:24:55 +01:00
Simon Hausmann
a4e4863669 Fix SkiaRenderer::new to take the window adapter weak by value
... for consistency with the software renderer API.
2022-12-12 12:01:12 +01:00
Simon Hausmann
7b4a3cd29a Improve the safety of the skia renderer API
Claim a strong reference (ownership or RC) on the value that provides the raw window handle.
2022-12-12 11:59:50 +01:00
Florian Blasius
501c6af746
Add swr render test and driver (#1955)
* add test-driver-screenshots
* add screenshot based software renderer testing
* create reference screenshots for testing with  test-driver-screenshots
* add documentation to testing `README.md`
2022-12-12 11:23:27 +01:00
Simon Hausmann
01d2efce4e Move the Skia renderer into a separate crate
The crate is an internal crate until the API has been polished and
documented, after which we can call slint-renderer-skia for example.

This also duplicates a little bit of the glutin setup code, because
that would otherwise have to go into another shared crate.
2022-12-09 17:04:54 +01:00
Simon Hausmann
b2ebac63c2 Remove component_destroyed from winit's internal renderer interface
The default impl of unregister_component in WindowAdapterSealed would call free_graphics_resources
on the rendere. Any re-implementation would have to do the same,
which the winit backend forwarded through
the winit backend specific internal renderer interface.

Instead, the original call site for unregister_component now calls
free_graphics_resources and unregister_component (for accessibility tree dirty notification).
2022-12-09 09:03:27 +01:00
Simon Hausmann
f5bbca9fce Remove default_font_size() from internal winit renderer interface
Replace register_root_component in the WindowAdapterSealed altogether with
a default font size getter on the renderer.

This is overall simpler and allows removing the doc-hidden getter in the software renderer.
2022-12-09 09:03:27 +01:00
Simon Hausmann
06f7f76b69 Reduce the renderer interface further in the winit backend
Move the canvas into the renderer entirely as interior state.

This complicates the implementation but paves the way for an easy-to-use API.
2022-12-09 09:03:27 +01:00
Simon Hausmann
6c22af4247 Wrap the software renderer into a struct
This is in preparation for internalizing the canvas state.
2022-12-09 09:03:27 +01:00