They now match the alphabetical order in testdata/README.
Change-Id: I03688c5a29c42e2a4683331fe97f72ed9828af0f
Reviewed-on: https://go-review.googlesource.com/32135
Reviewed-by: David Crawshaw <crawshaw@golang.org>
The existing compare-to-golden reference renderings no longer matched
the actual output after the vector renderer changed in
https://golang.org/cl/31532 "vector: change ϕ from 10 to 9".
Change-Id: Iea1980065eee30c3e46927eac7dff65ac2d7c51e
Reviewed-on: https://go-review.googlesource.com/31545
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Tested on linux/386.
Change-Id: I9a3a2744a0b057e258189780ca29f4bf2a72deb8
Reviewed-on: https://go-review.googlesource.com/31652
Run-TryBot: Minux Ma <minux@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Some variables had been deprected since macOS, so we should use the new recommend one
and declare them on older OS X releases using Conditional compilation.
Fixesgolang/go#17413.
Change-Id: Ib7e92e7e9bddb8d7940bd85e1f3db4535fcdbef0
Reviewed-on: https://go-review.googlesource.com/31543
Reviewed-by: David Crawshaw <crawshaw@golang.org>
There's now also an example/icongallery.
Change-Id: Id677877a76d1d529c377d52385d643597badaf08
Reviewed-on: https://go-review.googlesource.com/31590
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reason for revert: constants not available on older OS X releases
Original issue's description:
> shiny/driver: repace style mask and event constants deprecated since OSX 10.12
>
> Fixesgolang/go#17413.
>
> Change-Id: I4cc8a980fc1d6a45ceef48b282baa7a94663ae10
> Reviewed-on: https://go-review.googlesource.com/31539
> Reviewed-by: David Crawshaw <crawshaw@golang.org>
>
Change-Id: I35bd4301ebf63689d6b7bb49a29b9ef85657ba1e
Reviewed-on: https://go-review.googlesource.com/31613
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also fix a Rasterizer.AbsArcTo bug. The testdata/arcs example, based on
the examples from the SVG spec, only uses RelArcTo.
Change-Id: Iad94323eedfdf40938543692cdf3faf0731796bf
Reviewed-on: https://go-review.googlesource.com/31372
Reviewed-by: David Crawshaw <crawshaw@golang.org>
They should also be affected by Encoder.HighResolutionCoordinates.
Change-Id: I14c3fb56bddd6684dc59f947201774c1f4e58ead
Reviewed-on: https://go-review.googlesource.com/31373
Reviewed-by: David Crawshaw <crawshaw@golang.org>
On the full Material Design icon set, the 950 or so icons take up around
40% more bytes (172K vs 123K) at high resolution.
Change-Id: I6bd59c3aa75f7fc251c4283a0b244c656f1f9b86
Reviewed-on: https://go-review.googlesource.com/31111
Reviewed-by: David Crawshaw <crawshaw@golang.org>
On Windows mobile/gl uses ANGLE for EGL. ANGLE has multiple backends
and for some graphics cards one of these may work better than other.
Automatically try to choose the next platform when initialization fails:
1. Default
2. Direct3D 11
3. Direct3D 9
4. Direct3D 11 with WARP
Change-Id: Ief0911574afaf4ded3f578a1cd7b9639828f3486
Reviewed-on: https://go-review.googlesource.com/30754
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
There are two new encodings, direct and indirect.
The indirect encoding, or at least some way to water down a custom palette
color, is necessary for icons like
https://raw.githubusercontent.com/google/material-design-icons/master/device/svg/production/ic_signal_wifi_2_bar_48px.svg
which say `<path fill-opacity=".3" d="etc">`. Rendering such icons need a
partially transparent version of a custom palette color, e.g. the theme
foreground color, which could be black for a traditional theme or white for a
dark theme.
The direct encoding doesn't offer anything beyond the existing 4 byte encoding,
other than being a shorter encoding. It could come up relatively often, though,
if e.g. the suggested palette's elements are all fully opaque. Reserved styling
opcodes aren't particularly scarce, so I think it's a win overall. I think we
might as well add it now, if we're adding the 3 byte indirect encoding, and
avoid re-basing the other opcodes again if we added it separately.
Also fix some opcode typos in encode.go, with TODOs for more tests.
Change-Id: I0dd004b8ccbeab77dbb6a954f650e7b470ef9af7
Reviewed-on: https://go-review.googlesource.com/29451
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Docs only in this commit. Future commits will add code.
Change-Id: Ifb191dacdb317f565cb1b4a343c37941a6b05ec1
Reviewed-on: https://go-review.googlesource.com/28991
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This will be needed for scrollable Sheets, where the parent (the Sheet)
should be laid out at a smaller size than its child.
Change-Id: Iacf69c90f263f24f9fd149f3864d23737c1593a8
Reviewed-on: https://go-review.googlesource.com/28345
Reviewed-by: David Crawshaw <crawshaw@golang.org>
That constant value had a typo. Its value (defined in
/usr/include/linux/ipc.h) is in octal, not hexadecimal.
"man shmget" suggests that the IPC_CREAT flag isn't necessary if the key
is IPC_PRIVATE, as has proven in practice by the current code passing
the wrong flag bit all along.
The best fix, for the Go code, is to delete all mentions of ipcCreat.
Change-Id: I1ec701b3069c35445058c1149f2e9d15bbf4cf4c
Reviewed-on: https://go-review.googlesource.com/28012
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also split the example/textedit UI into a header and body.
Change-Id: Id95cf599de35ce8a86cf50d9b3ed744b2ab23d6e
Reviewed-on: https://go-review.googlesource.com/25471
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also introduce the Sheet widget.
Follow-up changes will implement smooth scrolling, where cached textures
are simply re-drawn at different offsets, instead of a window-sized
buffer being drawn on and uploaded from scratch on every paint cycle.
Change-Id: Iea291a064200cb658004846cd6cf075131644464
Reviewed-on: https://go-review.googlesource.com/25321
Reviewed-by: David Crawshaw <crawshaw@golang.org>
The X11 gldriver doesn't set this, but it should, to be consistent with
Mac and Windows.
Change-Id: If64a65ba2efde9ecc90a5d1b0289441f6724005f
Reviewed-on: https://go-review.googlesource.com/25322
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This should have been updated in f677a3c4 but was missed.
Change-Id: I6e5561af7ededd6c69d0f880c8c53432b3dbae83
Reviewed-on: https://go-review.googlesource.com/25160
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This matches the x11driver.
Change-Id: I73cfc9e97a2291ff6c81f554268173838b0cd663
Reviewed-on: https://go-review.googlesource.com/24922
Reviewed-by: Andrew Gerrand <adg@golang.org>
Use //go:uintptrescapes for SendMessage and SendScreenMessage
to force its parameters to be stored on the heap.
Fixesgolang/go#16341.
Change-Id: Idf12c75d0690a91f97448a6af42a048bdf7854a0
Reviewed-on: https://go-review.googlesource.com/24921
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This lets us use a Uniform to fill a background color for other widgets.
Change-Id: I5f062296a0441ceb371d5ea94d6db7f4dab8f94c
Reviewed-on: https://go-review.googlesource.com/24872
Reviewed-by: David Crawshaw <crawshaw@golang.org>
An upcoming change will distinguish between 'base' and 'top' paint
passes.
Change-Id: I8e2fcc97c1b7d90302c8f8ad8b3b89ab3bfc0e11
Reviewed-on: https://go-review.googlesource.com/24873
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also remove the size fields from a Uniform.
Change-Id: I468eedeb5bc004f0f8caaadba146972c2e0c1e9f
Reviewed-on: https://go-review.googlesource.com/24871
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This matches gldriver (X11) and x11driver.
Change-Id: I9a6271b5f2a3725f74ef1c0f1f4f6c2bfc666782
Reviewed-on: https://go-review.googlesource.com/24636
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This matches gldriver (X11) and x11driver.
Change-Id: I3236cd6459e9fc148f07c16557f83d741ad04edd
Reviewed-on: https://go-review.googlesource.com/24637
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also handle mouse.ButtonWheel{Up|Down} for the gldriver X11 flavor.
Change-Id: Ib2fd8ae4ae3ea93a37b0ae1ea40594ce1c3c9b46
Reviewed-on: https://go-review.googlesource.com/24635
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Add an imageutil.Border function, for drawing outlined-but-not-filled
rectangles, such as widget borders, checkboxes, table cells, etc.
Change-Id: I1e55e5fe492a5d2bb4df6f03ab8d14c9cb9db67d
Reviewed-on: https://go-review.googlesource.com/24632
Reviewed-by: David Crawshaw <crawshaw@golang.org>
A *glwidget.GL renders OpenGL calls into a shiny widget.
It is analogous to NSOpenGLView or GLSurfaceView.
This first version is extremely inefficient, it copies the pixels back
from the GL view to main memory, and then lets the gldriver copy it
again to a texture. But it gets the separate context concept clear,
and efficient rendering can be done in a later CL when the Paint method
has some reasonable way of accessing a Window's underlying GL texture.
It is in its own package to avoid adding a gldriver and cgo dependency
to the widget package.
This CL only contains X11 support, OS X will follow later.
Change-Id: Ib5044b62950eee070cd8b7729250e9c026b24b9f
Reviewed-on: https://go-review.googlesource.com/24300
Reviewed-by: Nigel Tao <nigeltao@golang.org>
MouseWheel{Down, Up} are actions for software to respond to, not
faithful retellings of what the physical device did. So in OS X's
default "natural scrolling" mode moving down the trackpad should
report MouseWheelUp.
Fixesgolang/go#16020
Change-Id: Ia10aaef1f2c36b16646ff50ba3923685310d1a23
Reviewed-on: https://go-review.googlesource.com/24360
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This sets us up for event filters such as gesture recognition, which generate
new events based on the most recent event.
Change-Id: I1aca2e4b1efb6846cd620ffef5b41b32e8cf7dd6
Reviewed-on: https://go-review.googlesource.com/24160
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Lots of TODOs. This is just a first step.
Change-Id: I94890970913e5b915de4bad56cfd23e62f9dcd03
Reviewed-on: https://go-review.googlesource.com/24022
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Also rename AppendChild and RemoveChild to Insert and Remove.
Change-Id: I4a2200054ddae0d2174943c7a0d5da2a084cb451
Reviewed-on: https://go-review.googlesource.com/23743
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This can simplify building the widget tree, as demonstrated by the
example/layout program.
Also add the widget.WithLayoutData function to facilitate this.
Change-Id: Ia41555ab4d68f0f1057698d637115a80e5d4df3c
Reviewed-on: https://go-review.googlesource.com/23530
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This is for gldriver and x11driver. I don't know if the windriver does
the right thing if you pass e.g. dp = image.Pt(-64, 0) or sr =
image.Rect(-64, 0, 256, 128) to the Upload or Draw calls in
example/basic.
Also fix gldriver's Texture.Upload when the srcRect width is less than
the texture width.
Also fix gldriver's Window.Upload then the dstPoint is non-zero.
Also zero-initialize the x11driver's texture's pixels, as the X11 server
doesn't do this automatically.
Change-Id: Ifb6f93e2bea635977bc1ee911457af74acde658f
Reviewed-on: https://go-review.googlesource.com/23469
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This means that out-of-bound texture reads return the in-bound edge
values instead of returning zero. Since the picture filter is
"bilinear", this is noticeable when scaling the entirety of the texture
(when srcRect = tex.Bounds()), such as in the example/fluid program.
Before this commit, the edges in the destination window were feathered.
After this commit, they are crisp, the same as the gldriver.
See section 9 "Source and Mask Transformations" of
https://www.x.org/releases/current/doc/renderproto/renderproto.txt
Change-Id: I4e4827d35311790bac0cd092fecb3953707976cb
Reviewed-on: https://go-review.googlesource.com/23500
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Switch to rounding pixels to the closest integer to match Chrome's
output.
Change-Id: I94fea521e3ac40ba642bf5013f3cd48d477581b6
Reviewed-on: https://go-review.googlesource.com/23018
Reviewed-by: Nigel Tao <nigeltao@golang.org>
Covers sections 9.3, 9.4, and implements a decent chunk of the sizing
described in section 9.7.
Change-Id: Ia3b24c2b568ef94a3ae779525971f29d61c39fe9
Reviewed-on: https://go-review.googlesource.com/23016
Reviewed-by: Nigel Tao <nigeltao@golang.org>
The small piece of JavaScript prints the test result table so that it
can be copied directly into flex_test.go.
Change-Id: I8c6cb7f07b2f40b7028cf87c42db77b6924627ff
Reviewed-on: https://go-review.googlesource.com/23015
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This make the output match gldriver when op == draw.Src even if the
texture itself isn't fully opaque.
Change-Id: Ib2aba62e68da71f32d876def1e1d672c3403d441
Reviewed-on: https://go-review.googlesource.com/23190
Reviewed-by: David Crawshaw <crawshaw@golang.org>
At this moment mouse events are only sent when any mouse
button is down. Change this to always send mouse event.
Suggested by Nigel.
Change-Id: I42fe1cb3e7eeecc7eec96bc9356711167e1f5658
Reviewed-on: https://go-review.googlesource.com/23120
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This CL contains a new package, with a Node implementation that will lay
out its children following the CSS flexible layout algorithm.
The algorithm will follow in a subsequent CL.
Change-Id: I9c1af5f9b4b9c6346722b98c48eca521d7c4563d
Reviewed-on: https://go-review.googlesource.com/22683
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This adds a new shiny/driver/internal/lifecycler package, to share code
across the various drivers.
Also remove the X11 gldriver's ButtonMotionMask event subscription, just
like the x11driver. It is redundant with PointerMotionMask.
Also fix an off-by-one error in the X11 "is a window visible"
calcuation. A 10 pixel wide window located at X == -10 will not be
visible, as the (x+width) upper bound is exclusive, not inclusive.
Change-Id: I0ded722160588e30d1e323a283a0d396ffd398a5
Reviewed-on: https://go-review.googlesource.com/23079
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
This fixes the example/fluid program.
Change-Id: Ia97bcb3db8f856f31ba39a2ce9649f6dabb27166
Reviewed-on: https://go-review.googlesource.com/23113
Reviewed-by: David Crawshaw <crawshaw@golang.org>
FooEmbed receivers go from e to m. Event args go from ev to e.
Using e for events is consistent with other shiny code, such as
widget.go.
Change-Id: I4a33534616514ee8086896aff79d7c9a9c79a99d
Reviewed-on: https://go-review.googlesource.com/23075
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
There is no longer both Button and buttonClass types. There is now only one
type: Button.
In the shiny/widget/node package, the abstract and concrete types have been
renamed from Class and Node to Node and Embed.
Change-Id: I659edd23f40b8d2b3838e32cec542a5b8d1d5190
Reviewed-on: https://go-review.googlesource.com/22991
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This de-clutters the top-level widget package, and focuses its package godoc
more for those using widgets and less for those implementing custom widgets.
The former should be the more common case.
Change-Id: I7e955a1b0aa59d05128fef83903f2d6cc138be68
Reviewed-on: https://go-review.googlesource.com/22934
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>
Remove outdated documentation.
Add some references to articles demonstrating how
to create GUI on Windows.
Also change mkbitmap to accept image.Point.
Change-Id: I2170047262d2ee1b0fab61b4d356da4c7f6153f4
Reviewed-on: https://go-review.googlesource.com/22913
Reviewed-by: Nigel Tao <nigeltao@golang.org>
This eliminates the ".Node" in a number of "foo.Node" expressions.
Change-Id: I1e6c72a9e3244c7f2731ed4b6180316b53ce43f3
Reviewed-on: https://go-review.googlesource.com/22828
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Reviewed-by: Andrew Gerrand <adg@golang.org>