Commit graph

231 commits

Author SHA1 Message Date
Olivier Goffart
0c19751a1e Qt: do not wrap QPainter directly, but use a unique_ptr instead
Because QPainter can't be relocated.

Fixes #1230
2022-05-05 13:50:26 +02:00
ogoffart
6395cdfc09 Bump version number to 0.2.3 2022-05-04 12:32:58 +00:00
Lukas Jung
d648862589 Make window.hide() respect the set EventLoopQuitBehavior 2022-05-04 09:16:13 +02:00
Tobias Hunger
11f23cbbdb
Hack to make Qt not close newly opened popups when running on Windows (#1227)
* Hack to make Qt not close newly opened popups when running on Windows

Windows sends a mouse release event after the close event when running
on windows. This confuses our hack to close popups!

So hack around the problem by ignoring any mouse button release event
that does not follow a mouse button press event. I hope this will
not couse too many side effects.

Fixes: #1211

* Update internal/backends/qt/qt_window.rs

Co-authored-by: Olivier Goffart <olivier@woboq.com>

Co-authored-by: Olivier Goffart <olivier@woboq.com>
2022-05-03 18:46:53 +02:00
Olivier Goffart
931838e2ce Qt: quit the application when calling hide() on the last window
Fixes the todo example not exiting when clicking on "yes" in
the close popup

cc #1212
2022-05-03 17:20:41 +02:00
Olivier Goffart
1b9917db37 Fix PopupMenu showing in a wrong place from qt_viewer
qt_viewer reparent the window so we need to use mapToGlobal to compute
the popup position

Fixes #1219
2022-05-03 11:54:53 +02:00
Olivier Goffart
723f89d342 Fix changing the size of contrained window on x11
Changing the constraint doesn't work on non-rezsizable window.
So first set the window as resizeable, then change the constraints, then
maybe remove the resizable flag
2022-04-29 11:54:31 +02:00
Olivier Goffart
1104ab73a0 Fix compilation with integer coordinate 2022-04-28 18:58:11 +02:00
Olivier Goffart
5a9c70307a MCU: properly round the image source rect
to avoid artifacts with different (frational) clipping
2022-04-28 17:45:47 +02:00
Olivier Goffart
ad1936d2d2 Remove new_scene_rectangle indirection 2022-04-27 09:23:10 +02:00
Olivier Goffart
fc65809b9d stm32h735: cleanup after review 2022-04-27 09:00:52 +02:00
Olivier Goffart
c658792c1e stm32h735g: cleanup 2022-04-27 09:00:52 +02:00
Olivier Goffart
846ae7cd43 stm32h735g: Instructions in readme 2022-04-27 09:00:52 +02:00
Olivier Goffart
5c507ab86c stm32h735g: Touch support 2022-04-27 09:00:52 +02:00
Olivier Goffart
199dc1fb18 upgrade stm32h7xx-hal 2022-04-27 09:00:52 +02:00
Olivier Goffart
e41c15aef9 stm32h735g: Add support for double frame buffer and timing 2022-04-27 09:00:52 +02:00
Olivier Goffart
a81d8b7ba4 stm32h735g: The screen actually show the UI now 2022-04-27 09:00:52 +02:00
Olivier Goffart
4755f57fb2 stm32h735g: The screen now show something 2022-04-27 09:00:52 +02:00
Olivier Goffart
0e0526912d WIP: attempt to get the display working on stm32h735g
(doesn't work, the screen is plain white)
2022-04-27 09:00:52 +02:00
Olivier Goffart
df95ee79ba WIP: setup OCTOSPI2 ram 2022-04-27 09:00:52 +02:00
Olivier Goffart
cc98d53b28 WIP: more work on stm32h735g 2022-04-27 09:00:52 +02:00
Olivier Goffart
703cffd444 WIP: STM32H735G support 2022-04-27 09:00:52 +02:00
Olivier Goffart
9ec6ed0406 wasm: fix tab and back tab
The situation differs depending if the widget show the virtual keyboard or not:
For widget that don't show the virtual keyboard, we rely on the winit events,
but for some reason we don't recieve WindowEvent::ModifiersChanged events with
wasm. Since the event handling in winit is about to be rewriten, I did not
bother reporting the bug upstream, but just work around by using the deprecated
API. So that way shift + tab will no longer be understood as just tab.

For widget using the virtual keyboard, then the event handling is in
wasm_input_helper.rs.  There is a couple of issues:

 - We must map shift+tab to backtab.
 - We need to prevent the default events to trigger, so that tab and other
   shortcuts don't take effect on the browser. Winit already inhibit these
   events so we must do the same otherwise tab and shift+tab would change the
   html focus.
 - By luck, tab used to give the focus back to the canvas before (see previous
   point) and that's why it worked. But now that we don't do that anymore,
   hiding the virtual keyboard should actually re-focus the canvas
 - That will cause the focus event to be intercepted by winit, and will cause
   recursions and borrow error, so we make sure that we do not recurse when
   getting the focus event
2022-04-22 13:58:37 +02:00
Simon Hausmann
eb3ceb54bd janitor: Move the GL renderer into a separate module 2022-04-20 17:41:53 +02:00
Tobias Hunger
9ef1f08163 Take alignment from QStyle infos into account when rendering the TabBar 2022-04-20 15:19:16 +02:00
Tobias Hunger
6c10edc957 Draw focus rect on focused tabs 2022-04-20 15:19:16 +02:00
Olivier Goffart
f117cb77cc NativeSpinBox: Handle the key press in native code 2022-04-19 11:27:19 +02:00
Tobias Hunger
df9f86ba4a janitor: cspell fixes 2022-04-13 14:42:32 +02:00
Tobias Hunger
2c82fd7618 Tab: Make tab accept keyboard 2022-04-13 14:42:32 +02:00
Simon Hausmann
a881922dd2 Replace touch point workaround with winit patch
Commit c85e1b6d25 added a workaround for a
winit issue, which has been fixed upstream. Until a new release is
available, let's patch in winit from a branch that has the fix
cherry-picked.

This way we don't have to remember to remove the workaround with the
next update and this has been verified on the device.
2022-04-13 11:43:24 +02:00
Olivier Goffart
f5baef4262 MCU: fix drawing of clipped rounded rectangle with border 2022-04-12 16:15:33 +02:00
Olivier Goffart
cc1aad8ce9 MCU: fix panic in the renderer
Sometimes, BorderRectangle clips can get negative if the intersection
of two rectangle leads to a rectangle that is smaller than the previous
rectangle, but because of floating point error while computing the max
position, the resulting clip may still be negative.
Add a small value to compensate that error
2022-04-12 16:12:41 +02:00
Olivier Goffart
8327ab3e52 MCU renderer: query the geometry of items we do not support
So that we can register dependencies and refresh when it moves, even
if we don't draw anything for them
2022-04-12 13:02:58 +02:00
Olivier Goffart
1b91158b46 corelib: allow to use i32 for coordinate instead of f32 2022-04-11 17:46:50 +02:00
Simon Hausmann
c85e1b6d25 Fix touch position reported on touch release with wayland
Work around https://github.com/rust-windowing/winit/issues/1996 by tracking
touch positions ourselves
2022-04-11 15:56:34 +02:00
Olivier Goffart
14d251e63a winit backend: preserve the value of the scale_factor set programmatically 2022-04-11 14:23:28 +02:00
Simon Hausmann
56ead8689c Enable dark-light mode detection for WASM builds
The new dark-light release supports it
2022-04-10 10:45:58 +02:00
Simon Hausmann
afb59cba29 mcu: fix popups not visibly closing
When closing a popup, notify the platform window, so that the mcu
backend can remember that region and start the dirty region with it.

Also, free all the rendering cache items of deleted items, to avoid accidental re-use
when re-opening a popup.
2022-04-08 19:32:33 +02:00
Simon Hausmann
db54da2064 mcu: Don't panic when opening popups
Implement popups as inline components. The dirty region handling however
is still missing when closing a popup.
2022-04-08 16:46:12 +02:00
Simon Hausmann
70f3f50359 mcu: Add support for automatic font size detection
Continue to support specififying logical font sizes in the compile step
via SLINT_FONT_SIZES, but additionally look for Text/TextInput/Window elements
and extract any constant font sizes
found.

This makes it work out of the box with the printer demo.
2022-04-08 15:11:26 +02:00
Tobias Hunger
57e120509d qt: Handle focus in checkbox 2022-04-08 08:32:05 +02:00
Tobias Hunger
70cfc33659 qt: Handle focus in native button 2022-04-08 08:32:05 +02:00
Simon Hausmann
335502be3f Upgrade to femtovg 0.3.4
The GL optimizations are in this release now and this also fixes #843
2022-04-07 13:56:23 +02:00
Simon Hausmann
063a292327 GL backend: add shortcut for zero opacity
If the global opacity is zero, we don't need to paint rectangles, etc.

This shortcut is a compromise between opting out much later on femtovg
level and too early before querying properties of the rectangle.  We
still want to do the latter as somebody might depend on that.
2022-04-07 11:37:51 +02:00
Simon Hausmann
206b765d5d Remove font-kit dependency on Windows
Use directwrite APIs directly to determine the font fallbacks for a given piece of text.
2022-04-06 17:30:30 +02:00
Simon Hausmann
d29f834e57 GL backend: minor optimization for image rendering
When colorizing or drawing images, it's not necessary to apply the extra edge anti-aliasing.
2022-04-06 11:33:18 +02:00
Simon Hausmann
6116bcb35d Minor memory usage optimization for clip layers in the GL backend
If a clipped rectangle transitions from having a border radius to none, then we can
delete the clip layer.
2022-04-06 11:32:57 +02:00
Simon Hausmann
f836322ca1 Speed up rendering of clip elements
When a clip element is enabled and it does not intersect with the current clip region,
then we don't even have to bother rendering any child elements.
2022-04-06 11:32:44 +02:00
Simon Hausmann
e06e99a4b9 GL backend: avoid triangle strip for stroke when filling plain rectangles
Similar to commit a329f052ea, we can apply the same
optimization to rectangles.
2022-04-06 11:32:23 +02:00
Simon Hausmann
a87f2abfd3 Fix font fallback determination on Windows with the GL backend
IDWriteFontFallback::MapCharacters only returns one single font that tries to cover
as much of the input string as possible. We need to continue processing the remaining parts of the text,
in order to get a complete list for all fonts we need.

Fixes #1139
2022-04-05 13:14:33 +02:00