Commit graph

4925 commits

Author SHA1 Message Date
Simon Hausmann
ccb2e23cf5 Fix GL texture not freeing its texture id
Similar to the shaders, keep a reference count on the resource itself and
keep the context around for convenient deletion.

Fixes: #3
2020-08-10 11:20:58 +02:00
Simon Hausmann
6faf7439c2 Delete GL shader programs automatically
We already keep the context in an RC, might as well keep another copy :-)

This re-applies commit 9b0dfa14b5 but
replaces the Clone trait on Shader, which would lead to duplicate and
too early program deletion, with an Rc<Shader>.
2020-08-10 11:20:58 +02:00
Olivier Goffart
36243ccdf7 Traverse item front to back for input events 2020-08-10 10:45:02 +02:00
Simon Hausmann
d9c776eb57 Revert "Delete GL shader programs automatically"
This reverts commit 9b0dfa14b5 as there's
an issue with webgl and everything disappearing.
2020-08-10 09:50:04 +02:00
Olivier Goffart
cc5d5cc92b C++: Fix input event within repeater 2020-08-10 08:55:42 +02:00
Simon Hausmann
9b0dfa14b5 Delete GL shader programs automatically
We already keep the context in an RC, might as well keep another copy :-)
2020-08-08 13:31:37 +02:00
Olivier Goffart
2ba40ebc96 Printerdemo: small effect on press
It works now that we have a grabbed item.
2020-08-07 16:32:49 +02:00
Simon Hausmann
05d1edbaef Fix caching of fonts by family
Avoid querying coretext/font-config for every lookup
2020-08-07 16:23:24 +02:00
Olivier Goffart
5de801d023 C++: grabbed mouse input 2020-08-07 16:06:49 +02:00
Olivier Goffart
b4684cc1f5 C++: put thre item_tree in a separate function.
We'll need that for the input event
2020-08-07 16:06:49 +02:00
Olivier Goffart
1ee313c643 C++: separate the declaration and the definition of functions
We already did it manually for some functions. But more functions are
about to require the full definition of the other classes
2020-08-07 16:06:49 +02:00
Olivier Goffart
2c276bba63 Handle grabbing in the interpreter 2020-08-07 16:06:49 +02:00
Olivier Goffart
0a56912d0f Mouse grab in rust 2020-08-07 16:06:49 +02:00
Olivier Goffart
5aa7ee86fe Use a newtype for VisitChildrenResult instead of just isize
Makes the code easier to unserstand
2020-08-07 16:06:49 +02:00
Olivier Goffart
55ec533c40 WIP input events
Compile and passes tests. But the mouse event are currently not working
2020-08-07 16:06:49 +02:00
Simon Hausmann
829990f9b1 WIP
Co-authored-by: Olivier Goffart <ogoffart@woboq.com>
2020-08-07 16:06:49 +02:00
Simon Hausmann
8b74381097 Some work on the copy page 2020-08-07 15:53:59 +02:00
Simon Hausmann
f86f8360b2 Fix rendering of text with spaces
Don't waste glyphs and potential pixels from the rasterizer for space --
merely use the advance.
2020-08-07 15:32:59 +02:00
Simon Hausmann
a6c7dd1610 Add placeholder pages for copy/fax/settings 2020-08-07 13:49:24 +02:00
Simon Hausmann
5b9c41b76b Add referenced image resources to the dependencies for the rust build 2020-08-07 13:35:44 +02:00
Simon Hausmann
fcc819e395 Add support for enums to the compiler
This replaces the duplicated text alignment enums
2020-08-07 13:15:43 +02:00
Simon Hausmann
1ba3b848fd Fix default font size for the page buttons
Bigger looks better :-)
2020-08-07 10:37:29 +02:00
Simon Hausmann
aecf6a8878 Center text in buttons in the demo and gallery
This adds horizontal_alignment/vertical_alignment properties, along with
width/height to Text.

This still uses a hard-coded enumeration in the compiler, which is meant
to go away in favor of general enum support.
2020-08-07 10:02:52 +02:00
Simon Hausmann
7ad693da60 Make window state handling more robust
Replace the three (ref)cells in the window with one refcell to an enum that
determines that the window is either unmapped (with a factory available)
or mapped (we have a graphics backend and rendering cache).
2020-08-06 16:57:19 +02:00
Simon Hausmann
99d1000749 Change interior mutability of GraphicsWindow
The interior mutability was visible to the outside via new() returning a
Rc<RefCell<..>>.

When doing deep recursions during rendering for example, that window is
mutably borrowed. That in turn prevents us from adding further members
such as window scale properties, etc. that may be read *during* that
traversal as they'd require an immutable refernce to a already mutably
borrowed refcell contents.

So instead, make the individual fields refcells.
2020-08-06 16:56:49 +02:00
Simon Hausmann
3323aa08b1 Provide more detailed commit messages in the pushes to the www repo 2020-08-06 13:48:07 +02:00
Simon Hausmann
710ce2b4ed Try to cache the npm package sources as per upstream github action docs
Don't glob for all package.json files though, as neon leaves some around
in the target/ folder, which is persisted through the cache.

This should reduce the dependency to npmjs.com being up and running.
2020-08-06 13:43:32 +02:00
Simon Hausmann
76b1abce25 Try to install wasm-pack from pre-compiled binaries 2020-08-06 12:29:38 +02:00
Simon Hausmann
77009c010e Install wasm-pack "by hand"
As sometimes the github action gives a 404
2020-08-06 12:21:09 +02:00
Olivier Goffart
571e74d2ce Handle Touch event 2020-08-06 11:41:49 +02:00
Simon Hausmann
137ddb9bb8 Create missing dirs 2020-08-06 09:32:07 +02:00
Simon Hausmann
c5e31ebbd3 Try publishing the demo binaries 2020-08-06 09:11:21 +02:00
Simon Hausmann
7f8ab09f5a Do a full wasm-pack/webpack build of the gallery and printer demo in the CI 2020-08-06 08:51:02 +02:00
Olivier Goffart
479173c22f Implement spacing in GridLayout 2020-08-05 15:42:38 +02:00
Simon Hausmann
5e6bc55fe6 Reduce precision for the cubic easing curve
As suggested by Olivier. Also added another test.
2020-08-05 15:41:30 +02:00
Simon Hausmann
00b05bf891 Fix easing curves once more
Olivier is right, mixing t and x like that is not correct. Revert to the
previous formula with increased precision.
2020-08-05 15:32:58 +02:00
Simon Hausmann
3596059eab Add wasm build for the printer demo 2020-08-05 15:02:36 +02:00
Simon Hausmann
87cac657b2 Scale the icon size with the size of the window 2020-08-05 14:55:59 +02:00
Simon Hausmann
99c71cca05 Avoid jumps when using cubic easing curves
solve_t_for_x uses newton's method or binary search with the provided
tolerance to find t. The default tolerance is 0.1 and our control points
are between 0.1, so the resulting t is not very fine grained.

Instead, first go from t to x and then x becomes the new t for y.

The included but commented out test can be used to verify that the
curves are correct.
2020-08-05 14:51:07 +02:00
Simon Hausmann
f755518dd5 Fix value of width/height on the root item if not specified
Fixes the broken gallery :-)
2020-08-05 13:33:05 +02:00
Olivier Goffart
d43fcfe3ea Remove stray dbg! 2020-08-05 13:28:20 +02:00
Simon Hausmann
5dfb9aa875 Fix initialize size of printer demo
Map it to 800x600 logical pixels for a better initial look.

This implements respecting the initial values for width/height and tries
to apply them to the window begin created.

The PinnedOptionalProp wrapper is needed because while cbindgen mapped
the previous Option<&...> to a raw pointer, the new Option<Pin<&...>> is
not detected as a pointer.
2020-08-05 13:22:53 +02:00
Olivier Goffart
1741b90b4e Implement a SIXTYFPS_SLOW_ANIMATIONS env variable
that can be set to a factor to reduce the speed of animations
2020-08-05 13:21:29 +02:00
Olivier Goffart
121a6ba57d Try to re-enable Qt on the CI
Since there is more code, it probably will change the alignment of the metadata
2020-08-05 12:57:35 +02:00
Olivier Goffart
2dd3cecc5a Add a SpinBox 2020-08-05 12:56:13 +02:00
Olivier Goffart
6d0591a6f2 Add a helper function to add native types 2020-08-05 11:26:15 +02:00
Simon Hausmann
b6a5810bdc Fix wasm build 2020-08-05 11:10:39 +02:00
Olivier Goffart
38cd9158ac Report the error while building the Document node
Instead of panicking in later phase.

Use the same function in the syntax_tests that the one we use in the different
compiler frontend so that the problems would also be shown in the tests
2020-08-05 10:54:59 +02:00
Olivier Goffart
9bb6a1f2a1 Remove useless debug output 2020-08-05 10:54:59 +02:00
Simon Hausmann
fb763eeb8e Fix initial icon sizes
Now that the scale factor is initialized, these need adjusting.
2020-08-05 10:51:40 +02:00