Commit graph

668 commits

Author SHA1 Message Date
Simon Hausmann
155b1443e2 Add support for reacting to dark/light mode theme changes with winit
On macOS and Windows, use winit's `Window::theme()` instead of
dark-light, to detect the theme.

Always react to WindowEvent::ThemeChange. It's delivered on macOS,
Windows, and the web.
2023-02-17 16:11:44 +01:00
Simon Hausmann
c3c98d928c Fix panic when minimizing window on Windows with winit
Fixes #2197
2023-02-17 15:59:02 +01:00
Olivier Goffart
ed51f6b7b6 Femtovg backend: fix text_input_cursor_rect_for_byte_offset for the last glyph
It was on the wrong line if not a \n, and on the wrong position if a \n
2023-02-17 15:51:14 +01:00
Simon Hausmann
3c686047cd Silence debug output on macOS and Windows when selecting text
Use a truly silent no-op clipboard context.
2023-02-17 15:27:12 +01:00
Olivier Goffart
ca7b2e0bb8 Harmonize style properties 2023-02-10 16:49:25 +01:00
Olivier Goffart
fb8a7fb1e5 winit backend: fix compilation with wayland but not x11 2023-02-10 11:18:05 +01:00
Olivier Goffart
6889dfa5f5 Rust: Make new(), run() and show() report errors from the backend
Fixes #2198
2023-02-10 05:00:03 +01:00
Simon Hausmann
59e0723793 Improved fix for panic when using OpenGL with the winit backend on Linux
Replace the patch with use of the glutin API as advised upstream (and
also implemented in glutin-winit).

Closes #2215
2023-02-09 16:16:36 +01:00
Simon Hausmann
476300ded7 Prospective fix for preview panicing on Linux v2
Avoid unwrap in the display/context selection try function.
2023-02-09 14:24:20 +01:00
Simon Hausmann
e8439061e8 Prospective fix for vscode extension preview not working on Linux
The CI build vsix panics on line 84 in glcontext.rs. There's no unwrap()
there but there's one nearby. I wasn't able to reproduce this with a
local build, so this is a prospective attempt, assuming that this is due
to the attempt of glx-over-egl display configuration finding.
2023-02-09 09:45:54 +01:00
Olivier Goffart
a19efc30db
Replace the MAX_BUFFER_AGE const generic with a runtime enum
Having a const generic for that didn't turn to be a good API.
Also made the C++ side more difficult

(Also renamed buffer_stride to pixel_stride)

Closes #2135
2023-02-08 14:44:01 +01:00
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