Commit graph

903 commits

Author SHA1 Message Date
Olivier Goffart
18ce1087d5 Hardcode the Qt license
Because the install qt github action does not install the documentation
2021-10-22 14:32:17 +02:00
Olivier Goffart
38c726ad4f We need to enable the png feature in the test backend 2021-10-21 13:10:22 +02:00
Olivier Goffart
68797dd0d4 Make sure to specify a high enough version for the rgb crate
There were security issues reported in previous version
2021-10-21 12:44:06 +02:00
Olivier Goffart
cc1205742d Move the image dependency down in the dependency tree
Corelib only need the image crate for doc test
the Qt bakcned don't use the image crate
2021-10-21 12:42:04 +02:00
Olivier Goffart
56d592100e Update a few dependencies 2021-10-21 12:24:48 +02:00
Simon Hausmann
dec6c6ca51 Work around crash in Qt mac style when drawing scrollbars with invalid size
Fixes #595
2021-10-19 12:36:26 +02:00
Olivier Goffart
4436b422e5 Fix LineEdit.has-focus witht he native style
The property had the wrong name.

Also it is not a native-output
2021-10-14 15:34:25 +02:00
Simon Hausmann
e305f0e61c Fix sixtyfps::quit_event_loop() not exiting the event loop with Qt 6 on macOS
As per commit 0c02f133f3daee146b805149e69bba8cee6727b2 in qtbase (qt6),
quit() on QCoreApplication on macOS calls [NSApp terminate], which will
not return to main. The latter however is documented behavior, and
sixtyfps-viewer for example relies on it.
2021-10-11 16:55:32 +02:00
Robert Broketa
52ff84c0a1 Add changelog entry and move no-frame logic to cpp closure 2021-10-11 10:21:21 +02:00
Robert Broketa
938252d740 Not set bordeless/frameless mode if fullscreen 2021-10-11 10:21:21 +02:00
Robert Broketa
c3c7765f80 Add no-frame property for a borderless/frameless window 2021-10-11 10:21:21 +02:00
Olivier Goffart
b0c87cb089 Fix the middle mouse button with Qt 2021-10-08 17:30:15 +02:00
Philipp Gesang
f916ca4124 Bound Text contents width
The contents of a Text would wander to the left with center and
right alignment because some size calculations don't take the
maximum available width into account.
2021-10-08 08:05:42 +02:00
ogoffart
77fcd5221b Bump version number to 0.1.4 2021-10-07 09:36:43 +00:00
Simon Hausmann
7aa6545046 Enable support for gzipped SVG
usvg detects gzipped SVG by looking at the first bytes, and Qt supports it as well.
2021-10-06 21:24:44 +02:00
Simon Hausmann
7102f9b997 Fix standard button OK text
Ok -> OK
2021-10-06 16:16:39 +02:00
Simon Hausmann
6dce5ab32e Fix rendering of push buttons with QStyle on macOS
The button bevel was rendered upside down, which happens due to some
weird double y-axis inversion, which goes away when passing the QWidget
pointer to the style. When using the Qt backend, we can do that.
2021-10-06 14:39:56 +02:00
Olivier Goffart
db10bf2187 Fix embedded window icon with the Qt backend
Also add a window icon to the gallery
2021-10-06 12:39:22 +02:00
Simon Hausmann
4c6c8233c0 Qt style: Improve default layout spacing on macOS
When the PM_LayoutHorizontalSpacing pixel metric is negative, we're supposed to call
layoutSpacing() on the style. Until we have a detailed
overview over the controls, a default spacing is better than -1 :-)
2021-10-06 11:10:58 +02:00
Olivier Goffart
a1b27c47ae Small cleanup
The is_standard_button is alays true because the None path returns a few line before
2021-10-06 10:53:30 +02:00
Simon Hausmann
d43e0a1c83 Qt style: Only show icons in standard buttons if the style permits 2021-10-06 10:45:31 +02:00
Olivier Goffart
aa05e96d22 Native style: properly initialize the layout padding 2021-10-06 10:43:32 +02:00
Simon Hausmann
30e79d3ea2 Fix panic with GL backend when using non-existent font families
The database is not empty, as the changed expect() suggests, but instead
it just means that the family could not be found. This can happen for
example with something like this:

export App := Window {
    Text {
        text: "Ok";
        font-family: "Non-existent";
    }
}

or it can also happen when loading the printer demo in the online
editor, where a custom font is supposed to be available but that's not
implemented for wasm builds.

So instead of panicing, fall back to querying for a last-resort
sans-serif family.

For Linux, we register fontconfig's choice for sans-serif, otherwise
fontdb has defaults for macOS and Windows, and for wasm we register our
copy of DejaVu. So that cannot really fail....
2021-10-05 14:03:17 +02:00
Simon Hausmann
05b7d3e2ee Avoid over-eager animation ticks
Only update animations on input events and when the windowing system requests a redraw.
2021-10-05 12:43:11 +02:00
Simon Hausmann
e987a4aba3 Fix granularity of run-time borrows in GL backend window handling
When processing window specific events, or generally when accessing
the ALL_WINDOWS refcell, keep the time for borrow to an absolute
miniumum. That way any subsequent method calls may further acquire the
refcell.

This patch re-organizes the entire deeply nested window event handling
in a function with slightly less indentation.

Fixes a panic when calling hide on a Window from within a callback
handler.

Fixes #539
2021-10-05 12:43:11 +02:00
ogoffart
8b9717633e Bump version number to 0.1.3 2021-10-05 10:31:45 +00:00
Simon Hausmann
0e8efea2ff Further speed up font handling in the GL backend
Use the new fontdb API:

* When registering embedded fonts, we don't need to make a copy of the
  embedded font data anymore.
* We don't have to mmap the font files ourselves anymore, fontdb can
  do this now for us.
2021-10-04 15:11:55 +02:00
Olivier Goffart
2716e4b4dd TouchArea: add the pointer-event callback
... instead of `pressed-changed`

This allows to see what mouse button was pressed.

Closes #535
2021-10-04 14:39:49 +02:00
Simon Hausmann
137ad32886 Fix abrupt process abort when showing a window with constraints in Weston/Wayland
Don't apply constraints to the winit window if we're in fullscreen mode,
as that might result in us allocating a surface that's bigger than the
screen, which in turn may result in the process exiting right away.

Fixes #532
2021-10-02 09:07:57 +02:00
Olivier Goffart
dc10916129 Attempt to improve a bit the look of the native scrollbar
This tries to adjust the position of the scrollbar depending of the value of
SH_ScrollView_FrameOnlyAroundContents
2021-10-01 12:58:00 +02:00
Olivier Goffart
e858b3e8d5 Fix TabWidget drawing with the Qt Fusion style
- The Tab must be drawn before the contents, because the style draws something under the active tab,
   outside of its region
 - Also set the QStyleOptionTab::HasFrame flag since we are in the equivalent of a QTabWidget
2021-09-30 19:43:53 +02:00
Olivier Goffart
5935b99c73 Fix indentation 2021-09-30 19:11:40 +02:00
Olivier Goffart
c7227f35cc Native style: Fix size of button with icon
Some styles recompute the size based on the contents given in the QStyleOptionButton,
Some styles need to be given the icon in their content size. And this was not done properly
2021-09-30 19:10:00 +02:00
Simon Hausmann
f6f06a8ccb Fix compilation with Qt 6.2.0 and MSVC
Apply the same fix as woboq/qmetaobject-rs@fb6e8cda64
2021-09-30 15:45:14 +02:00
Simon Hausmann
4bda3c16db Bump GL backend dependencies
Various third-party bumps and femtovg bumped to include a fix for exact
GLES 2.0 detection. Glutin may give us a 3.x GLES context even if we ask
for 2.0 (https://github.com/rust-windowing/glutin/issues/1282) and I can
reproduce that for example on Raspbian with MESA. But femtovg should
work with both, hence the update.
2021-09-30 14:40:19 +02:00
Simon Hausmann
87dc98b5d9 GL backend: Fix rendering of SVGs with text inside
It works with the Qt backend, and it should work with the GL backend as
well. usvg supports it, uses the same underlying shaper and the API even
allows sharing the font database.
2021-09-30 14:32:46 +02:00
Olivier Goffart
33e0512448 Qt backend: Fix drawing of the TextInput with vertical alignement
This aligns the text properly in the LineEdit
2021-09-30 13:17:16 +02:00
Olivier Goffart
a72c442b58 Native style: use the QPalette for the placeholder color in a LineEdit 2021-09-30 12:50:30 +02:00
Olivier Goffart
465857c42e Handle the Keypad Enter as Return
Fixes #525 : LineEdit::accepted doesn't react on numpad Enter
2021-09-30 11:48:09 +02:00
Simon Hausmann
684fcc8dff Fix support for OpenGL ES 2.0
We default to querying GlLatest from glutin, which might run into a code
path in glutin's `bind_and_get_api` in `egl/mod.rs` that will return
None as version and pass that to `choose_fbconfig`. That function will
panic with unimplemented() if the bound API is GLES, because we need to
know which version of GLES. The bound API in turn might be GLES if
desktop GL is not supported.

To accomodate for this situation, this patch changes the GL context
creation logic to first try explicitly GLES 2.0 and then fall back to
the GlLatest variants.

In addition this pulls in a newer version of femtovg to fix FBO
rendering with stencil with GLES 2.0.
2021-09-30 11:10:42 +02:00
Simon Hausmann
001d8442a8 Remove unnecessary glow dependency
We depend on glow through femtovg, but we don't use any APIs of it anymore.
2021-09-30 10:58:48 +02:00
Simon Hausmann
dd92c84ea2 Apply suggestions from code review
* Remove stray debug statement
* Fix typo

Co-authored-by: Olivier Goffart <ogoffart@sixtyfps.io>
2021-09-29 17:03:46 +02:00
Simon Hausmann
91ffb4d41f Initial support for mmapping fonts directly into femtovg
This version doesn't require the change to fontdb yet, but uses the new
femtovg API to allow feeding in shared (mmapped) font data. On macOS
this saves 4-5 MB of ram just for the gallery, on my default Ubuntu it's
roughly ~40MB.
2021-09-29 17:03:46 +02:00
Olivier Goffart
671df0f24f New widget: StandardButton 2021-09-29 16:25:44 +02:00
Olivier Goffart
3f13c69ca8 Hide the cursor of the disabled TextEdit
Fixes #513
2021-09-23 12:39:57 +02:00
Simon Hausmann
7edf19d5b2 Fix GL backend build without x11
Copypasta's wayland clipboard requires a different API that we don't cater to yet, so
for now to fix the build, disable the clipboard (use in-app nop).
2021-09-22 11:52:42 +02:00
Simon Hausmann
043c1932ad Make it possible to disable x11 support
The GL backend defaults to enabling X11. The default crate depends on
the GL backend but it doesn't specify default-features = false,
therefore x11 is basically always enabled.

In line with commit 1fd8c7236a, this
change makes sure that the defaults are defined in the tree entry
points: The Rust API crate, the interpreter crate and the CMake project
define the defaults. The latter already enabled X11 by default, but the
first two did not.
2021-09-22 11:32:51 +02:00
Simon Hausmann
8fea1bf52e GL backend: Fix missing glyphs in the slide puzzle demo
The checkmark and reload have always been missing in some circumstances.
The recent fixes with glyph coverage check helped, but they do not account for the fact that
characters like the check mark map to the same script (Common). So for these scripts
we need to perform an exact glyph coverage check.
2021-09-21 14:12:44 +02:00
Simon Hausmann
1214e444f0 GL backend: minor speed up for font fallback handling
Avoid the dance of using font-kit to re-discover the same .ttf file and
read it all into memory every time we need to render text where the primary font
provides insufficient coverage.
2021-09-21 11:09:37 +02:00
Simon Hausmann
b5de610eb6 GL backend: minor speed up in text rendering
Only query fallback fonts from the system if we really need to.
2021-09-21 10:50:09 +02:00