Commit graph

1507 commits

Author SHA1 Message Date
Olivier Goffart
8287ed4b9e Some more simplifications of the PlatformWindow and Backend trait 2022-07-25 14:51:03 +02:00
Olivier Goffart
a4b859f12c Fix clearing up of caches with the simulator 2022-07-25 12:04:34 +02:00
Olivier Goffart
f7637b521f More PlatformWindow trait simplification: Component registation optional
Forward the free graphics resource to the renderer by default
2022-07-25 12:04:34 +02:00
Olivier Goffart
74c041010e Move the text functions out of the Window, into the Renderer trait 2022-07-25 12:04:34 +02:00
Olivier Goffart
653e3dff70 Revert "janitor: Remove the FemtoVG prefix from Renderer and Canvas inside the femtovg module"
This reverts commit e63da79308.

Otherwise it would have the same name as the trait
2022-07-25 12:04:34 +02:00
Simon Hausmann
e63da79308 janitor: Remove the FemtoVG prefix from Renderer and Canvas inside the femtovg module 2022-07-23 13:29:40 +02:00
Simon Hausmann
d6b4ff5cb2 Fix warning about unused import 2022-07-23 13:27:00 +02:00
Simon Hausmann
f0faa8aaca Simplify code reading properties from the Window item
Use the new getter in WindowInner.
2022-07-23 13:25:44 +02:00
Simon Hausmann
6e483a9b21 Fix tracking of background property changes in the GL renderer
Make sure to query the background property from within the draw_contents callback, so
that it's tracked by the redraw tracker.
2022-07-23 13:18:12 +02:00
Simon Hausmann
598a50c72d Simplify callback signature 2022-07-23 13:16:09 +02:00
Simon Hausmann
eefce428ec Minor cleanup
Avoid calling a function when we have a member :)
2022-07-23 13:16:09 +02:00
Simon Hausmann
9e030fcdec Move the item rendering into the femtovg renderer
This way the renderer's public interface uses one less private type (the component list).
2022-07-23 13:16:09 +02:00
Simon Hausmann
f11d21b361 Move the rendering metrics collector into the femtovg canvas
This further reduces the "render" callback (to be moved next).
2022-07-23 13:16:09 +02:00
Simon Hausmann
b12d6095e4 Let the renderer create the canvas
This will allow passing information from the renderer to the canvas later.
2022-07-23 13:16:09 +02:00
Simon Hausmann
cf4b796c96 Start to re-organize the order of callbacks between GLWindow and FemtoVGRenderer
Pull the draw_contents() part into the callback, to be
later moved into the renderer.
2022-07-23 13:16:09 +02:00
Simon Hausmann
d05f30489e Remove unnecessary pub member of GLItemRenderer 2022-07-23 13:16:09 +02:00
Simon Hausmann
ad0a14b623 Remove unnecessary scale_factor parameter from femtovg render 2022-07-23 13:16:09 +02:00
Simon Hausmann
6849bd2974 Remove GLWindow dependency from FemtoVGRenderer
Instead, give it a Weak<Window>.
2022-07-23 13:16:09 +02:00
Simon Hausmann
b754d17718 Further encapsulate the FemtoVG renderer within its module
* Move the text related functions entirely into the femtovg renderer
* Separate out the renderer state that is only available when we have a
  window into a FemtoVGCanvas object
2022-07-23 13:16:09 +02:00
Simon Hausmann
58f74ba441 Clean up the background color handling in the GL backend
Just like the software renderer, query the background color when rendering
and use it as clear color.

In the simulator this was an unused field (because the sw renderer already does the right thing).
2022-07-22 23:15:35 +02:00
Simon Hausmann
0ab71ec503 Perform resolution of font properties against the window defaults in the core library
This simplifies the renderer handling - the FontRequest arriving there
will always be resolved.

And this reduces the amount of property dependencies: If a Text elements
specifies a font-family, no dependency to the window's
default-font-family is created.
2022-07-22 23:09:08 +02:00
Olivier Goffart
dd081758b0 Upgrade to lyon 1.0 2022-07-22 19:27:49 +02:00
Olivier Goffart
9794a4dfad Simplification of the PlatformWindow trait 2022-07-22 18:12:00 +02:00
Olivier Goffart
6de5a42ab2 Use the public Window as a result of the create_popup function 2022-07-22 18:12:00 +02:00
Olivier Goffart
c2fe06d82d Use the public api::Window for the interface of the software renderer 2022-07-22 18:12:00 +02:00
Olivier Goffart
29404e3f2c Rename i_slint_core:🪟:Window into WindowInner
We already have `api::Window` and also the Window element (`WindowItem`),
So rename the inner part to avoid confusion
2022-07-22 18:12:00 +02:00
Simon Hausmann
c494861ddd Change set_clipboard_set to take a &str instead of a String
Every backend will do something different with the string that needs to go into the clipboard.

Qt will convert it to a QString, copypasta to a String, in theory it could be written
directly to a socket.

Given that we don't know what the perfect representation on the backend side is, passing
a string slice avoids any immediate conversions.
2022-07-22 15:21:21 +02:00
Simon Hausmann
e5e7c61414 Simplify the rendering metrics collector API
Instead of a new() function and a start() and no stop() function, create the collector
when we want to measure and drop it when we're done.

This will also make it possible to move the collector into the renderer
in the future.
2022-07-22 15:18:13 +02:00
Olivier Goffart
ac4f3e97ad Change slint enum values to be PascalCase in rust
... while still being kebab-case in .slint

Some enums might become public API and we want to have them as
PascalCase to respect the rust conventions
2022-07-22 12:23:52 +02:00
Simon Hausmann
caad768564 Make the item renderer a private module
It's not accessed from the outside anymore.
2022-07-22 11:11:57 +02:00
Simon Hausmann
ee18236053 Remove unnecessary cfg guards 2022-07-22 08:10:44 +02:00
Simon Hausmann
c2773da9f5 Fix compiler warning in non-wayland build 2022-07-22 08:10:44 +02:00
Simon Hausmann
67926f6422 Add support for the clipboard on Wayland 2022-07-22 08:10:44 +02:00
Simon Hausmann
52ddee3968 GL backend: make the clipboard a member of the mapped window
... in preparation for wayland support
2022-07-22 08:10:44 +02:00
Simon Hausmann
8a3ff06eb5 Move the clipboard handling from the Backend trait into PlatformWindow
Access to the clipboard implies access to the windowing system.
2022-07-22 08:10:44 +02:00
Simon Hausmann
acaf0c3fe2 janitor: remove unecessary .rs file for module 2022-07-21 14:48:49 +02:00
Simon Hausmann
f4421116a4 Remove all femtovg specific code from the OpenGLContext type
This also removes a bunch of setup code from the GL window.

This will make it easier to use the OpenGLContext with other renderers such as Skia.
2022-07-21 14:48:49 +02:00
Simon Hausmann
a901668122 Move all use of CanvasRc from GLWindow into FemtovgRenderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
da63468c22 Move the femtovg Canvas into the femtovg renderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
38454dd26e Furhter improve GL renderer encapsulation
Don't access the texture/graphics cache from the item renderer through the GLWindow
but borrow them from the FemtoVG renderer directly.
2022-07-21 14:48:49 +02:00
Simon Hausmann
edfe1958e8 Add a lifetime to the GL item renderer
This allows avoiding extra RC clones.
2022-07-21 14:48:49 +02:00
Simon Hausmann
b37c995916 Move the item graphics cache to the femtovg renderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
160b37cb3c Begin hiding internals of the Femtovg renderer 2022-07-21 14:48:49 +02:00
Simon Hausmann
c55878ae49 Begin separate the femtovg renderer into a module of its own 2022-07-21 14:48:49 +02:00
Olivier Goffart
c41749fc12 Rename PropertyChangeHandler to PropertyDirtyHandler
The handler is called whenever the properties it depends on becomes dirty,
not when it changes.

This has caused confusion before, so rename it
2022-07-21 13:16:40 +02:00
Olivier Goffart
7ccd36f7f2 Simplify PopupWindow handling
When the popup is implemented as an overlay on the window, no need
for the backend to do anything
2022-07-21 12:36:53 +02:00
Olivier Goffart
847a532732 Move the SVG rendering to a buffer in core 2022-07-20 12:57:37 +02:00
Olivier Goffart
ed88f75862 Remove unneeded dependencies from the gl backend
Since image rendering is now done in core
2022-07-20 12:57:37 +02:00
Simon Hausmann
4b8432c5f5 Remove unused by_address dependency 2022-07-20 12:57:37 +02:00
Simon Hausmann
5619abb878 Move ImageCacheKey into the image module
That way it'll be eaiser to deal with the code with image-decoders disabled
2022-07-20 12:57:37 +02:00