Commit graph

948 commits

Author SHA1 Message Date
Simon Hausmann
aafb96cb93 Get rid of abi::datastructures::WindowProperties
Instead, pass a reference to the root item when mapping the window,
at which point we can downcast to the new Window item. If we have one,
then we'll read its width/height (for initial values) and install
bindings to keep them up-to-date.
2020-08-12 09:44:42 +02:00
Simon Hausmann
3d5d112deb Fix paths to logos 2020-08-11 16:57:04 +02:00
Simon Hausmann
9fd7d35b0d Remove stray scale_factor properties 2020-08-11 15:10:43 +02:00
Simon Hausmann
02b1d49fa4 Remove old test programs
I haven't used graphicstest in a long time to debug something and
rustwasmtest is superseeded by the shinier and prettier gallery and
printer demos.
2020-08-11 14:42:19 +02:00
Simon Hausmann
3b6a1085ac Fix published demos with parcel
Don't load off of /, use relative paths.
2020-08-11 14:36:27 +02:00
Simon Hausmann
50eafc3fd7 Simplify wasm builds
Replace webpack, which needs a configuration file, etc. with parcel,
which requires none. Just "parcel index.html" and it'll figure out the
rest :-)
2020-08-11 14:22:52 +02:00
Simon Hausmann
c1f91e38ca Move the window scale factor into GraphicsWindow 2020-08-11 13:42:51 +02:00
Simon Hausmann
f2eec61968 Add a window to the top-level component
This means that we always have a window and for the C++
API we don't require this ComponentWindow use anymore.
2020-08-11 13:38:38 +02:00
Simon Hausmann
5b90f3edf5 Unmap the window after running the component
This gives a timing wise clearly controlled shutdown of the GL context.
2020-08-11 13:27:31 +02:00
Olivier Goffart
b5c9bf5d10 Settings page for the printer demo
Fix the text maximum size so it can be put in a layout
2020-08-11 12:08:44 +02:00
Olivier Goffart
d43b5fb6f9 Fix offset of the mouse event when the mouse is grabbed 2020-08-11 11:49:02 +02:00
Olivier Goffart
e013ea6c50 Refactor the interpreter by trying to use FieldOffset insdead of usize for offsets
Give a unique identifier lifetime to instance so that they cannot be mixed safely
2020-08-11 10:22:16 +02:00
Simon Hausmann
0fb6eef939 Fix build with Apple clang
The compiler complains that intptr_t is not the same type as "long long".
The "long long" originates from "pub struct VisitChildrenResult(i64);"
and I suppose the compiler is right for potential 32-bit architectures. So
let's use int64_t as counter-part to i64.
2020-08-11 10:16:37 +02:00
Simon Hausmann
667563ad98 Added a basic logo 2020-08-11 09:03:56 +02:00
Simon Hausmann
7807631ba0 Fix leaking texture atlas allocations
When a rendering primitive holding a reference into a texture atlas
allocation is dropped, we should free that area for future re-use.
2020-08-10 17:30:41 +02:00
Olivier Goffart
23fe57827d Fix event handling in interpreter
The type was not right
2020-08-10 17:25:35 +02:00
Olivier Goffart
681f304768 Add a few Debug impl 2020-08-10 17:25:15 +02:00
Olivier Goffart
3651d77a06 Qt Style: Leak the QApplication to avoid crash at exit
==1118823== Invalid read of size 8
==1118823==    at 0x5334491: QFontDatabase::removeAllApplicationFonts() (in /usr/lib/libQt5Gui.so.5.15.0)
==1118823==    by 0x523D67B: QGuiApplication::~QGuiApplication() (in /usr/lib/libQt5Gui.so.5.15.0)
==1118823==    by 0x5ED7C56: __run_exit_handlers (in /usr/lib/libc-2.31.so)
==1118823==    by 0x5ED7DFD: exit (in /usr/lib/libc-2.31.so)
==1118823==    by 0x5EC0008: (below main) (in /usr/lib/libc-2.31.so)
==1118823==  Address 0x30 is not stack'd, malloc'd or (recently) free'd

The QFontDatabase is stored in a Q_GLOBAL_STATIC, so by storing the QApplication
in a static, it is going to be destroyed after the QFontDatabase
2020-08-10 16:15:23 +02:00
Olivier Goffart
9af5c0b69d Slider in Qt style 2020-08-10 16:01:06 +02:00
Simon Hausmann
d6ef7c31a8 Fix rendering artifacts when scaling
The use of the texture atlas may result in pixels from adjacent textures
bleeding into the currently rendered texture. The standard technique appears to be
to add a padding around each image.
2020-08-10 15:53:44 +02:00
Olivier Goffart
35cb14b2e6 Slider 2020-08-10 14:58:13 +02:00
Olivier Goffart
f0511c9210 Fix javascript from last commit 2020-08-10 14:11:33 +02:00
Olivier Goffart
f4cce26d51 Test the mouse click 2020-08-10 12:54:29 +02:00
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