Граф коммитов

332 Коммитов

Автор SHA1 Сообщение Дата
Alex Brainman d9f7a4f94a shiny/driver/windriver: sort //sys lines in syscall_windows.go
Change-Id: I5f00c02b108b3a5f2bacbcf59bd7fd223762e247
Reviewed-on: https://go-review.googlesource.com/19948
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-03-03 08:15:23 +00:00
Alex Brainman 6b3e1e8b13 shiny/driver/windriver: implement texture
This also adds new functionality to shiny/driver/internal/win32
to be able add custom message handlers to screen window procedure,
and also call new handlers.

Change-Id: I84855db483290de5eed2c82c191be43365dd5f65
Reviewed-on: https://go-review.googlesource.com/19326
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-02-28 01:46:39 +00:00
Alessandro Arzilli 6322a217d3 exp/shiny/x11driver: Correctly convert mousewheel events
Change-Id: I4672445bd38c7622be085688020209e898581d38
Reviewed-on: https://go-review.googlesource.com/19893
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-02-26 23:15:09 +00:00
Nigel Tao 3b75128ce7 shiny/text: fix prev pointer when breaking a Paragraph's last Line.
Change-Id: Icde3ad4e06fe460b72d02342e9d61d03fba772fc
Reviewed-on: https://go-review.googlesource.com/19407
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-11 21:00:43 +00:00
Nigel Tao caf1b44a5e shiny/text: implement relayout.
This introduces a free list for Paragraphs, Lines and Boxes.

Also test some Frame / Paragraph / Line / Box invariants.

Change-Id: I764538fda1b2e733e1e62821512ebbb4e5305ebf
Reviewed-on: https://go-review.googlesource.com/19247
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-09 23:36:33 +00:00
Nigel Tao 8bfb3371cd shiny/text: implement WriteXxx.
Change-Id: Ib47e0be2e39fce0d3b2c44db3f6e548c5a75260e
Reviewed-on: https://go-review.googlesource.com/19321
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-09 23:05:50 +00:00
Nigel Tao 696a535e31 shiny/driver/x11driver: allow 0-width and 0-height buffers and textures.
Change-Id: I5b3e4cf6fe07ca9ccd9e5d30dca356bdca3c595f
Reviewed-on: https://go-review.googlesource.com/19322
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-09 23:04:04 +00:00
Nigel Tao 4c7e289c67 shiny/driver/x11driver: remove no-longer-used arg.
The screen.Uploader arg is no longer used, once we got rid of the
screen.UploadedEvent type.

Change-Id: I0fbeb863ec010c3d9b8e79f754a6060361cc719a
Reviewed-on: https://go-review.googlesource.com/19323
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-09 01:45:01 +00:00
Fabian Wickborn 8f78588f42 x/exp/shiny/driver/internal/win32: Use screen.NewWindowOptions
Change-Id: I882c521a8f1671b38b66b971b2dc3edbc9752421
Reviewed-on: https://go-review.googlesource.com/19262
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2016-02-07 09:11:54 +00:00
Nigel Tao de526538b9 shiny: catch invalid modifications to a Buffer's RGBA.
A Buffer is essentially an *image.RGBA, but not all *image.RGBAs are
valid Buffers. This change detects invalid attempts to pass arbitrary
*image.RGBAs as Buffers. Prior to this change, this would 'work' for the
gldriver but not other drivers.

Fixes .

Change-Id: I8b0d7f0861dc69b93d332bd0ba26a70326e16c7b
Reviewed-on: https://go-review.googlesource.com/19211
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-05 01:46:39 +00:00
Nigel Tao 9f12c88e90 shiny/driver/x11driver: add more context to shm error messages.
Change-Id: Ie9ab42dcfce200e202ac4e11dfa24b743f12e649
Reviewed-on: https://go-review.googlesource.com/19215
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-05 01:43:34 +00:00
Nigel Tao 08d934c41d shiny/text: distinguish the way leaning a Caret can fail.
Upcoming code would like to lean forwards or backwards without requiring
that the Caret is at the end or beginning of a Box.

Change-Id: I2312850b26681df034e9e8fc7835e073fab384eb
Reviewed-on: https://go-review.googlesource.com/19243
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-05 01:42:42 +00:00
Nigel Tao f067b7a915 shiny/text: implement Caret.Seek.
Also enforce an int32 max length of a Frame's text buffer.

Change-Id: I7b179395b2e72016d02819e568f088755c04792d
Reviewed-on: https://go-review.googlesource.com/19214
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-04 23:49:52 +00:00
Nigel Tao ad7d0ec8a3 shiny: add canonical import paths.
Fixes .

Change-Id: Id293dbaf1934fc63e31f1e1d26d1b2a7502fc512
Reviewed-on: https://go-review.googlesource.com/19210
Reviewed-by: David Symonds <dsymonds@golang.org>
2016-02-03 22:27:00 +00:00
Nigel Tao efa3f21b09 shiny/text: implement ReadXxx.
Change-Id: Ide648c2ed487a318f293e8e73e287538ba3e40e3
Reviewed-on: https://go-review.googlesource.com/19113
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-03 22:07:37 +00:00
Nigel Tao 731fba202d shiny/driver/x11driver: remove obsolete reusable field.
It was obsoleted by https://go-review.googlesource.com/#/c/17272/

Change-Id: I4b57f101410a32238dedc5e3c07f35b03876da85
Reviewed-on: https://go-review.googlesource.com/19112
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-02-03 22:06:15 +00:00
Nigel Tao 3cceb04554 shiny/text: treat maxWidth <= 0 as infinite, as per the docs.
Change-Id: I02d8d68c672f0152460a1e069eeb59eacf2c284f
Reviewed-on: https://go-review.googlesource.com/19114
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-02-03 22:05:16 +00:00
Nigel Tao 7897c52f86 shiny/text: implement layout (soft returns).
Change-Id: Ieb8ae20255bfc798f7b8d77f481a4055afdc489b
Reviewed-on: https://go-review.googlesource.com/19111
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-30 00:02:07 +00:00
Nigel Tao 8df4de2131 text/shiny: start implementing Caret.WriteString.
Change-Id: If88e86f95232bc24b11e58c3715281566f54a011
Reviewed-on: https://go-review.googlesource.com/19032
Reviewed-by: Andrew Gerrand <adg@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-28 23:46:30 +00:00
Nigel Tao 8f91cc95a8 shiny/text: add SetFace and SetMaxWidth.
Change-Id: Ie9df2b656843de1bf9ed66d6751bccb5a0622d79
Reviewed-on: https://go-review.googlesource.com/18958
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-28 05:49:00 +00:00
Nigel Tao 0e12372a22 shiny/text: new package for laying out paragraphs of text.
Change-Id: Ib54a6622ecdca49bb86fda1151b425e60d365a22
Reviewed-on: https://go-review.googlesource.com/18881
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-25 07:09:16 +00:00
Nigel Tao 9706ab35f5 shiny/font: delete deprecated packages.
As font.go and plan9font.go say:
// TODO: delete this package. It was deprecated on 2015-09-01.

Change-Id: Ia1ad45238e1718a3071405e4e2310aa5f54d38cb
Reviewed-on: https://go-review.googlesource.com/18795
Reviewed-by: Andrew Gerrand <adg@golang.org>
2016-01-22 00:47:27 +00:00
Nigel Tao 588410a478 shiny/driver/gldriver: don't accept arbitrary Buffer implementations.
This makes gldriver behave the same as windriver and x11driver,
making it less likely for an app to 'work' on one driver but not
another.

Updates .

Change-Id: Id795f6b9f43a67faa954653404a23ae5783f8261
Reviewed-on: https://go-review.googlesource.com/18791
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-21 23:18:16 +00:00
Nigel Tao b56856e1eb shiny/screen: make Copy and Scale methods, not functions.
This differs from e.g. the standard library's clear separation between
io.ReadFull (a function) and io.Reader.Read (a method), but it makes the
calling code a little nicer (see the main.go edits).

Change-Id: I10d03e398e881cf045aa0bd3d8729558768ff871
Reviewed-on: https://go-review.googlesource.com/18659
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-21 03:28:27 +00:00
Nigel Tao 92eb926168 shiny/driver/internal/pump: delete obsolete package.
Change-Id: Ib0bce7f23f27fdae39057451784c6d5734ffeff1
Reviewed-on: https://go-review.googlesource.com/18655
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-15 23:32:39 +00:00
Nigel Tao 1c09de08ef shiny/driver/gldriver: honor the draw.Op.
Change-Id: I2fc55e63809bd46b1b95d525ab70b2ccfc22111f
Reviewed-on: https://go-review.googlesource.com/18654
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-15 23:25:26 +00:00
Nigel Tao aa3b3b34eb shiny: replace Events channel with NextEvent method.
This allows Windows to provide state-dependent methods (such as the
window size) that are co-ordinated with the most recent event processed,
as we now track when events are received, not just when they are sent.

Change-Id: I3394bce32923b506c93f151afeb143a8798e4b21
Reviewed-on: https://go-review.googlesource.com/18652
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-15 00:51:50 +00:00
Andrew Gerrand 642356e895 shiny/driver/gldriver: fix cocoa build
Change-Id: Ia549c5bda913b79753c984c25fb61ae14defa6e6
Reviewed-on: https://go-review.googlesource.com/18651
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-14 04:21:20 +00:00
David Crawshaw f2a7dfa6b2 shiny/driver/gldriver: windows support
For 

Change-Id: Ib6a7b23288bebebb5e1d53917d67af72692187b0
Reviewed-on: https://go-review.googlesource.com/17677
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2016-01-12 22:15:03 +00:00
Jeremy Jackins 014a3b14e7 shiny/driver/gldriver: use makeFirstResponder
Set view as the first responder via makeFirstResponder, rather
than setting window.nextResponder to view. This prevents a
segmentation fault when handling mouse events. I am not a cocoa
expert and I don't know why this fixes the problem, but it does
(at least in my tests) and after reviewing the docs it seems
to be what we should have been doing in the first place.

Fixes .

Change-Id: Idfba7515dd26b66320c42c8e91a104138ec833eb
Reviewed-on: https://go-review.googlesource.com/18424
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-10 23:48:30 +00:00
Nigel Tao 3f93181081 shiny/driver/x11driver: implement lifecycle events.
Change-Id: I5f35b6e7ea7a74ad78ea5f016c052666cf591a1f
Reviewed-on: https://go-review.googlesource.com/18401
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-08 07:33:34 +00:00
Alex Brainman 7a07d40244 shiny/driver/internal/win32: skip key.go on non-windows (fixes build)
Also drop executable bit on some source files.

Change-Id: I08b2db47c8750bb554cfae6b9e78211b2e72718f
Reviewed-on: https://go-review.googlesource.com/18272
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-08 05:41:28 +00:00
Jeremy Jackins c5da6cf9a3 shiny/driver/gldriver: scrollwheel events for cocoa
This change does not attempt to handle horizontal scroll events.
Scroll events with a deltaY of > 1 are sent as multiple window events.

Change-Id: Ie77444384cba5e9deec45fba1bfb062b17f115d7
Reviewed-on: https://go-review.googlesource.com/17995
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 20:32:21 +00:00
Jeremy Jackins bb8214f629 shiny/driver/gldriver: fix erroneous double-use of sr when uploading to Window
In (w *windowImpl) Upload, the sr parameter is used to calculate a
sub-image of src when uploading src to a temporary texture, t.
The bounding rectangle of t is then (0,0)-(sr.Dx(),sr.Dy()). The same
sr is then used as the sr parameter to w.Draw when drawing the
temporary texture to the window. However, in the case that sr.Min is
not (0,0), this means that t is incorrectly clipped, and the effect
is that part of the image that was inteded to be uploaded to the
window is missing.

Instead, use t.Bounds() as the sr parameter to w.Draw.

Change-Id: Ib526db0c66856c9ffdd939c943dc9063ffc47c25
Reviewed-on: https://go-review.googlesource.com/18113
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 20:13:57 +00:00
Jeremy Jackins bb37e7df9a shiny/driver/gldriver: fix handling of escape and tab keys
In order to handle the escape and tab keys correctly, key event
handling needs to be moved from an NSResponder implementation
to the NSOpenGLView implementation, and handled with the
performKeyEquivalent method. Without this change, pressing escape
triggers the system beep rather than a keyDown event, and the tab
key yields a keyUp event but no keyDown event.

Change-Id: Ieb28274338249352d08325c0f6eac1d4a4a1c98e
Reviewed-on: https://go-review.googlesource.com/18270
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2016-01-07 18:34:15 +00:00
David Crawshaw d32b4cf3c6 x11driver: fix build
Change-Id: I961bb5dbaf6bbac70b597dace2c5c22ddd750f50
Reviewed-on: https://go-review.googlesource.com/17978
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-19 15:03:19 +00:00
David Crawshaw 86bcdadde7 gldriver: bind vertex buffer on thread switch
It appears that the vertex array buffer is very occasionally becoming
unbound as the OpenGL context is passed between threads. This is
causing shiny apps to occasionally start with a blank window.

I have no theory as to why this happens, this was determined
empirically. Rebind the vertex array after drawLoop starts.

While here, ensure that Cocoa has completed running prepareOpenGL
before making any GL calls from another thread. Do this by starting
drawLoop at the end of prepareOpenGL.

Change-Id: Iede19969a7e532e97b67b8ef42b77f05242cc50f
Reviewed-on: https://go-review.googlesource.com/17865
Reviewed-by: Rob Pike <r@golang.org>
2015-12-18 20:31:29 +00:00
David Crawshaw 2f88a76d2e driver/gldriver: El Capitan bug fixes
- Have Publish block until it is complete.

- Do not block showWindow on makeKeyAndOrderFront, which now blocks
until drawRect is complete. (This deadlocked, as drawRect waited on
code started after showWindow.)

- Always send the window visible lifecycle event when a drawRect
request comes in, as sometimes it hasn't triggered DidExpose yet
which means the initial paint.Event was lost.

- Mark external paint events.

- Avoid using __block where it is not needed to keep the GCD code
easy to reason about.

Change-Id: I2cf652c98835b3ae569d304fa14760271d270d08
Reviewed-on: https://go-review.googlesource.com/17861
Reviewed-by: Rob Pike <r@golang.org>
2015-12-18 20:31:19 +00:00
Jeremy Jackins 4169c3ff09 shiny/driver/gldriver: keyboard events for cocoa
Change-Id: I320d8475bfbf163c5b1e472af01500010bc7303a
Reviewed-on: https://go-review.googlesource.com/17881
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-12-18 20:29:23 +00:00
David Crawshaw 33ebb895ba shiny: have Upload block until complete
Removes the need for UploadedEvent. Callers who want concurrent
uploads can use goroutines.

Change-Id: I83dae13fd4ac5059606b1084ed5918857dfeefa8
Reviewed-on: https://go-review.googlesource.com/17272
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-12-15 18:38:41 +00:00
David Crawshaw 7ee4134c09 win32: keyboard support
For 

Change-Id: I2e4029e261307e08748b7088c495512247f10d21
Reviewed-on: https://go-review.googlesource.com/17722
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-11 15:07:11 +00:00
David Crawshaw fb8fbd2b13 win32: mouse drag and wheel support
For 

Change-Id: Ib6a7b23288bebebb5e111221338323a2692187b0
Reviewed-on: https://go-review.googlesource.com/17721
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-11 14:51:01 +00:00
David Crawshaw ad41026854 shiny/driver/windriver: factor out a win32 package
A Windows version of the gldriver shares a lot of common code with
the existing windriver. This CL factors it out into a new internal
pacakge, win32.

For 

Change-Id: If602bb42946f1df662b2529d5b277257ae7706d3
Reviewed-on: https://go-review.googlesource.com/17676
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
2015-12-11 14:25:18 +00:00
David Crawshaw 48f611b013 shiny/example/goban: update for new paint model
Change-Id: Iaefb4ce6f590b1935f19c370513b8fb178daef80
Reviewed-on: https://go-review.googlesource.com/16900
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-18 15:48:29 +00:00
David Crawshaw cc3419d713 shiny/driver/gldriver: remove display link timer
This is the shiny equivalent to https://golang.org/cl/15470

Change-Id: If2136919d3c532fca38e8cc8ecdb97266094c81f
Reviewed-on: https://go-review.googlesource.com/16879
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 13:54:12 +00:00
David Crawshaw 1a86d4ce64 shiny/driver/gldriver: plumb lifecycle events
Change-Id: I66ea06155f17b124a939ad1db26aeddfab194d96
Reviewed-on: https://go-review.googlesource.com/16878
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
2015-11-17 12:57:51 +00:00
David Crawshaw a1747b8cb1 shiny/driver/gldriver: remove outdated TODO
Each window has its own gl.Context.

Change-Id: I33ee97dc8f5d8a8b6e511297880c3b5069736065
Reviewed-on: https://go-review.googlesource.com/16877
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-11-13 09:16:01 +00:00
Daniel Skinner fa44da8ac9 exp/shiny: correct cast for vendored xproto
Change-Id: Iaabc9136debfffc64ccb8b93f2a303baa6de23c0
Reviewed-on: https://go-review.googlesource.com/16552
Reviewed-by: Sebastien Binet <seb.binet@gmail.com>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-11-04 19:48:28 +00:00
Mateusz Czapliński d4ff832f35 shiny/driver/windriver: implement Window.Upload
Change-Id: Ibe7e51472c8a950f726a9ceeaa9257edfbcd8e0f
Reviewed-on: https://go-review.googlesource.com/15687
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-10-19 23:26:32 +00:00
Jeremy Jackins 6f42ea8722 shiny/screen: add width and height options to NewWindowOptions
With this change, gldriver and x11driver will parse new Width and
Height variables in NewWindowOptions. The change does not implement
parsing of the options in windriver.

Change-Id: I7c23f3b0b580ac9d4cf1d3a31b48fbc2d16046ad
Reviewed-on: https://go-review.googlesource.com/16031
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-10-19 03:53:40 +00:00
Nigel Tao e1277ea40c shiny/driver/x11driver: optimize simple copies and scales.
Change-Id: Ia4c8cf18e813953ee38becaa8af24fe663097e8b
Reviewed-on: https://go-review.googlesource.com/16030
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-18 23:53:02 +00:00
Nigel Tao b19ee779d7 shiny/driver/x11driver: add a mutex for groups of render operations.
Change-Id: I05222f93c77aea566a238c15afb49c2a2abdab2d
Reviewed-on: https://go-review.googlesource.com/16032
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-18 23:49:18 +00:00
Mateusz Czapliński 0ec29dd69a shiny/driver/windriver: Buffer & dummy Texture
Add Buffer implementation wrapping image.RGBA, and a dummy
implementation of a Texture. This allows to run shiny/example/basic on
Windows without early failure. This makes it easier to visually verify
implementation of further windriver methods in future.

Also, rename windriver types to screenImpl and windowImpl to match
naming convention used in x11driver.

Change-Id: I30b464e58ac3e973fd98344d221505980de7d5bd
Reviewed-on: https://go-review.googlesource.com/15686
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-10-14 23:46:21 +00:00
Nigel Tao 254723012c shiny/driver/x11driver: tidy up inverse affine calculation.
Change-Id: I5d975979c8e595febbfecb0cd87f0db4f0243aa3
Reviewed-on: https://go-review.googlesource.com/15676
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-14 09:42:18 +00:00
Nigel Tao ea837427ff exp/shiny/screen: clarify that Upload is implicitly draw.Src.
Change-Id: I202834764e1a0e8bc509716fee15633ad8ca99e7
Reviewed-on: https://go-review.googlesource.com/15679
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-14 09:41:08 +00:00
Nigel Tao e3f60d2295 shiny/driver/x11driver: fix the draw.Src operator.
This fixes example/tile, in that the output is now correct. That app now
flickers, but that will be fixed by either the TODO to recognize simple copies
or scales and the TODO to implement double-buffering.

Change-Id: I53ddd680243255dc116370d18490ff879ed9e5e2
Reviewed-on: https://go-review.googlesource.com/15674
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-10-12 22:45:46 +00:00
David Crawshaw 7c2630d4d1 shiny/driver/x11driver: support affine transforms
Fixes 

Change-Id: I54c3b3562cf09310e405efb154569c2e376806aa
Reviewed-on: https://go-review.googlesource.com/14970
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-25 13:59:31 +00:00
David Crawshaw b80da08bb8 shiny/driver/gldriver: per-window GL mutexes
Also fixed the X11 GL driver.

Change-Id: Ie0504d28e35850f98de24477fcf362c4148c82f3
Reviewed-on: https://go-review.googlesource.com/14940
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-24 16:16:36 +00:00
Nigel Tao 8fada217b1 shiny/driver/internal/swizzle: detect SSSE3 capable CPUs.
Benchmark numbers for the various implementations, on my amd64 machine:
BenchmarkBGRA-8             3000        498914 ns/op // bgra16
BenchmarkBGRA-8             1000       1702449 ns/op // bgra4
BenchmarkBGRA-8              500       3396861 ns/op // pure Go

Fixes 

Change-Id: I5570b0daeaae431c6beecd6e0ab832e7bc2c11ec
Reviewed-on: https://go-review.googlesource.com/14931
Reviewed-by: Aaron Jacobs <jacobsa@google.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-24 03:47:18 +00:00
David Crawshaw 82ea2f5ebe driver/gldriver: adjust cocoa flavor for gl.Context
Still need to change the X11 implementation. (A separate CL?)

Change-Id: Idf4febe691d3bbba2a0dab27f7a92b2d4ce61db3
Reviewed-on: https://go-review.googlesource.com/14910
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-24 02:08:25 +00:00
Nigel Tao a9b7e1855f shiny/driver: handle X11 expose events.
Change-Id: I16c5b5a9643884bba2de856683ea48defc0146ad
Reviewed-on: https://go-review.googlesource.com/14863
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 05:26:04 +00:00
Nigel Tao 2832b823b1 shiny/driver/gldriver: add a mutex for groups of OpenGL operations.
Methods like Texture.Upload or Window.Draw are conceptually one
operation but are implemented by multiple OpenGL calls. OpenGL is a
stateful API, so interleaving OpenGL calls from separate higher-level
operations causes inconsistencies.

Change-Id: I66ccf8844d276b82586620c5bfeadb50ba0f5bef
Reviewed-on: https://go-review.googlesource.com/14861
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 04:49:49 +00:00
Nigel Tao b96b24b8ec shiny/driver/gldriver: implement mouse events for X11/GL.
Change-Id: I46570c5b2239ef4b88412862b1076114ad2a3668
Reviewed-on: https://go-review.googlesource.com/14843
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 04:18:24 +00:00
Nigel Tao ef4b22d624 shiny/driver/x11driver: don't unswizzle buffers that aren't re-used.
It's just needless work.

Change-Id: I60821b51391bf9392ef1b015cd4524d8ad1bf93c
Reviewed-on: https://go-review.googlesource.com/14841
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 04:16:59 +00:00
Nigel Tao 1eff713ba9 shiny/driver/x11driver: fix a buffer TOCTTOU race.
Previously, bufferImpl's swizzling and clean-up were done outside of
holding the b.mu lock. One goroutine could call b.postUpload and another
call b.Release, and race so that the first goroutine would check
b.released (and see false), release the b.mu lock, and call swizzle.RGBA
(as b.released was false at the time of check). Concurrently, the second
goroutine would now acquire b.mu, set b.released to true, release b.mu,
and then call b.cleanUp. The swizzle and the clean-up don't play well
together.

The fix is hold the mutex for the entirety of the Release, preUpload and
postUpload methods.

Change-Id: Ic40a918cad48a1f2159da7b3410a77faf68cef06
Reviewed-on: https://go-review.googlesource.com/14819
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 00:33:19 +00:00
Nigel Tao a29910ee26 shiny/driver/x11driver: fix SHM completion race.
Previously, bufferImpl's upload method was was:

----
// LINE A.
cookie := shm.PutImage(etc)

// LINE B.
b.s.mu.Lock()

// LINE C.
b.s.uploads[cookie.Sequence] = etc

// LINE D.
b.s.mu.Unlock()
----

The race was that the PutImage call could complete, and be processed by
the X11 event goroutine, after LINE A and before LINE B, so that
screenImpl's handleCompletion would find nothing in the s.uploads map,
and log "no matching upload for a SHM completion event", leaking the
screen.Buffer.

The fix is to increment a counter before LINE A and decrement it after
LINE C, so that the s.uploads map isn't inspected while we're just about
to add something to it.

Change-Id: Ief1cb40129f16dd3fc2ba008c9d1b9be1db05a6d
Reviewed-on: https://go-review.googlesource.com/14818
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 00:30:59 +00:00
Nigel Tao fb403ed5bb shiny/example/tile: new example program.
Change-Id: Iaee19ee35179a46239f0e2b52a5621b816a4df03
Reviewed-on: https://go-review.googlesource.com/14817
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 00:29:03 +00:00
Nigel Tao 821a4b7128 shiny/driver/gldriver: allow Upload with a nil Sender.
Change-Id: I011a27acb95c3ba2d32355e503f0390b776e3213
Reviewed-on: https://go-review.googlesource.com/14816
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 00:25:17 +00:00
Nigel Tao f03601cb49 shiny/screen: implement Copy and Scale.
Change-Id: Ida224c985f14218914aeebfe8515da55048a9c18
Reviewed-on: https://go-review.googlesource.com/14815
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-23 00:24:57 +00:00
Nigel Tao 987576e7e4 shiny/driver/gldriver: respect the draw transform.
Prior to this change, all textures were drawn 1:1 axis-aligned starting
at the top-left corner, regardless of the arguments to Draw.

Change-Id: I3d0cf025eb556f9a3cde56f5cda06415dbb12503
Reviewed-on: https://go-review.googlesource.com/14812
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-22 01:41:17 +00:00
David Crawshaw 7064a852e1 shiny/driver/gldriver: delay showWindow call
This change snuck into cl/14743 and breaks drawing on OS X.

Change-Id: I6ead61b68a1a98959e646c29a2a7f61768001b18
Reviewed-on: https://go-review.googlesource.com/14791
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-22 00:02:24 +00:00
Nigel Tao 5e964d4b8b shiny/driver/gldriver: fix bad merge.
https://go-review.googlesource.com/14743 introduced x11.go, a new file.
https://go-review.googlesource.com/14302 renamed EndPaint to Publish.

Change-Id: If5773dc99e3b06f8ea6d9ad3cebe62a254a100b1
Reviewed-on: https://go-review.googlesource.com/14748
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-21 00:44:46 +00:00
Nigel Tao 08cd98e40f shiny/driver/gldriver: implement an X11 backend.
Plenty of new TODOs, and there's probably some refactoring with the
Cocoa gldriver implementation we could do, but I've tried to make the
non-X11-specific changes as small as possible in this CL.

With any refactoring, there's also the (existing) "TODO(crawshaw): there
are several problematic issues around having a draw loop per [Cocoa]
window..." in cocoa.go to think about.

That's all out of scope of this initial CL, which is to land a working
checkpoint.

Change-Id: I11faa749db35b7153385d3a647bc9c6aacd17667
Reviewed-on: https://go-review.googlesource.com/14743
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-21 00:18:07 +00:00
Nigel Tao a6fcb33ec1 shiny/example/goban: remove y-inversion workaround.
Also remove a redundant fill-with-dark-blue that is immediately
overwritten by the buffer upload.

Also remove an unnecessary size.Event local variable.

Change-Id: I23b5618ce0c93c48d661e08b9d43797cf6c78750
Reviewed-on: https://go-review.googlesource.com/14672
Reviewed-by: Rob Pike <r@golang.org>
2015-09-18 00:02:13 +00:00
Nigel Tao 746b559abc shiny/screen: change EndPaint to Publish.
The motivation is the same as for a similar change to the
golang.org/x/mobile/app package. See
https://go-review.googlesource.com/#/c/14300/

Change-Id: Idb6da17ec360df338d32c53c6f73b7a02b005090
Reviewed-on: https://go-review.googlesource.com/14302
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-17 10:16:27 +00:00
David Crawshaw 310833d072 shiny/driver/gldriver: flip y for mouse events
Cocoa uses the bottom-left as the origin.
Shiny uses the top-left as the origin.
Convert from one to the other when sending mouse events.

Fixes 

Change-Id: I462e813e260ec365c978624f9454e7ede0da833d
Reviewed-on: https://go-review.googlesource.com/13917
Reviewed-by: Rob Pike <r@golang.org>
2015-09-14 19:18:44 +00:00
Alex Brainman ed327bb5bf shiny/driver/windriver: convert remaining C into Go
Change-Id: I3f5ba4205f27dfde685fd36c35398a5ed6d146a5
Reviewed-on: https://go-review.googlesource.com/14573
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-14 05:44:26 +00:00
Alex Brainman 69150ad8d8 shiny/driver/windriver: convert windraw.c to Go
Change-Id: Ifd300c420ec52d8c036750597c7a140dcd4038f7
Reviewed-on: https://go-review.googlesource.com/14572
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-14 04:17:19 +00:00
Alex Brainman c770fc0f3e shiny/driver/windriver: convert windows.c and windriver.c to Go
Change-Id: Id3b38e7cf0aec2590146f8a6457ae319d4437e45
Reviewed-on: https://go-review.googlesource.com/14481
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-11 05:42:37 +00:00
Nigel Tao a45df42e78 shiny/example/font: delete this example.
It has been superseded by golang.org/x/image/example/font

Change-Id: Id60514c13a8ffae8bad0f12e14992a719ed7e548
Reviewed-on: https://go-review.googlesource.com/14303
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-09-07 00:20:23 +00:00
Nigel Tao 41bb8dc7b4 shiny/driver/gldriver: fold cocoa.h into cocoa.go.
The .h file is only included in one place. We might as well inline it.

Change-Id: I69726ffb89c45a8a9b1b3db1e462fa3021121cd5
Reviewed-on: https://go-review.googlesource.com/14230
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-09-03 23:20:05 +00:00
David Crawshaw a98c9eb64b shiny/driver/gldriver: mouse event modifier keys
Fixes .

Change-Id: I7be92caff9bab08781b9c632edd9a801500e2ecc
Reviewed-on: https://go-review.googlesource.com/14273
Reviewed-by: Rob Pike <r@golang.org>
2015-09-03 21:21:28 +00:00
Pietro Gagliardi 2cf1b0fc7c shiny/driver/windriver: rename the utility window to the Screen window and rewrite it in Go
Because SendMessage on Windows switches to the thread the
target window is associated with to send the message, we can
safely send messages to windows across threads. As such,
methods on a screen.Window can be implemented by sending
messages to that window directly. This laves the so-called
"utility window" only managing the screen.Screen methods.
Therefore, we rename it to the "Screen window" here, as that
is its function now: providing a thread-safe way to call
screen.Screen methods.

The Go rewrite has the side effect of simplifying the error handling
of Windows API calls a bit.

Some common data-related routines have also been added.

The actual work of creating a window is still done by C.
That will be addressed in the next CL.

Change-Id: Ibe46a57891c34da0e9534d5ab6d19aeb6076e638
Reviewed-on: https://go-review.googlesource.com/13963
Reviewed-by: Alex Brainman <alex.brainman@gmail.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-09-02 03:03:27 +00:00
Nigel Tao 0e69480b4b shiny/font: deprecate the font package.
It now lives at x/image/font, not x/exp/shiny/font.

Change-Id: I65f61ec4ce680f42981016e09c36cd04e140861d
Reviewed-on: https://go-review.googlesource.com/14149
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-09-01 05:21:30 +00:00
Nigel Tao f3c629011f shiny/font/plan9font: add an example test.
The testdata/fixed font files come from the Plan 9 Port, and were all
marked as public domain. The total size of the new testdata is 112K.

Change-Id: I8cf5de4e5abd1aec7e6550d330271f2acdc12402
Reviewed-on: https://go-review.googlesource.com/13888
Reviewed-by: Rob Pike <r@golang.org>
2015-09-01 04:36:16 +00:00
Nigel Tao 1bde0b540f shiny/font: have Face.Glyph return an advance width, not a new dot.
This is consistent with Face.GlyphBounds and Face.GlyphAdvance.

Change-Id: I9da6b4f2fdb8f093fc9567c717e8fbbecc624e30
Reviewed-on: https://go-review.googlesource.com/14090
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-08-31 01:31:05 +00:00
Rob Pike 574adff158 shiny/example/goban: example program: Go board
This is an example, still rudimentary, of shiny graphics in action.
This commit has the basic geometry, images, and rendering, but
is missing all the game logic, resizing the board on demand, and
so on, but one can actually play a game using it if one wants.
It has all the built-in computing power of a physical Go board.

Drawings by Renee French. The grid will become a hand drawing
too, soon.

A simple checkpoint.

Change-Id: Id235fa677c59d18cfee0dd96380a0cbca2232c29
Reviewed-on: https://go-review.googlesource.com/14002
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-28 06:51:00 +00:00
Pietro Gagliardi c4523b0285 shiny/driver/windriver: implement Window.Fill.
We draw in real time using GetDC. WM_PAINT is only used to
send a paint.Event. To ensure all calls to GetDC only occur on
the main thread, the painting is done using window messages.

Hopefully the code is somewhat self-explanatory. The actual
GDI muckery may appear foreign, but that's GDI for you :/

This will be the last commit that introduces new C code.
Past experience has shown that working with GDI exposes
edge cases in the Go syscall implementation, so I wanted
to get at least Window.Fill working in C so I have a known
good point to work off of. If someone doesn't beat me to it,
I'll start converting the code to pure Go tomorrow.

This introduces the condition that all drawing must be done in
response to a paint.Event. If this is not desired, it can be changed
after the C -> Go conversion.

Change-Id: Ic02669d5f7281fac3c11951ce6a590f9d23dd0a1
Reviewed-on: https://go-review.googlesource.com/13740
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-27 05:38:01 +00:00
David Crawshaw cfc9162ad3 shiny/driver/gldriver: Cocoa multi-screen support
Use the current screen housing the window to calculate scaling
factor and mouse events. Listen for when windows change screen
and update the geometry to match.

Change-Id: I3f05a17be16286e4c8c913cf9662899bf9c2ceaa
Reviewed-on: https://go-review.googlesource.com/13960
Reviewed-by: Rob Pike <r@golang.org>
2015-08-26 23:50:30 +00:00
David Crawshaw b8e2a32799 shiny/driver/gldriver: treat pixels as real pixels
While I don't expect window size to be expressed in NewWindowOptions
as pixels, right now the window displayed on OS X is 1024x768 scaled
pixels, which doesn't really fit with shiny's use of pixels.

Change-Id: I30608fb3c608e17de40ff72feec1d4b74f53c769
Reviewed-on: https://go-review.googlesource.com/13916
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-26 01:18:14 +00:00
David Crawshaw ecb579683b shiny/driver/gldriver: implement close
The WindowResponder was being used after free because the autorelease
pool lifecycle didn't match the window cycle. Release it manually on
window being closed. While here, wire up the close logic.

Removing TODO about managing NSWindow, as the Cocoa docs say that by
default it is released when closed.

Not wiring closing into the paint loop until my other inflight paint
cycle CLs are addressed.

Fixes 

Change-Id: I5eb692c2dd5b302a608d0535ef191dc01e538c7f
Reviewed-on: https://go-review.googlesource.com/13871
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-25 15:23:18 +00:00
Nigel Tao bf77ffa395 shiny/font: add per-glyph metrics.
Change-Id: Ie5c7e29b4eb7bd87b8e99de941f2f94b042e268f
Reviewed-on: https://go-review.googlesource.com/13827
Reviewed-by: Rob Pike <r@golang.org>
2015-08-24 05:53:06 +00:00
David Crawshaw a5b2ce41f7 shiny/driver/gldriver: care for NSWindow lifetime
Two changes. First, create the NSWindow on the main application
thread. I have not found any Cocoa documentation that says this is
necessary, but when in doubt in Cocoa do it on the main thread.

Second, avoid autoreleasing the NSWindow. We are not maintaining any
strong references to it (only the reference from inside the NSView),
so cleaning up the memory is our job. Added a TODO, as when Shiny has
a concept of closing windows, we should free the NSWindow.

Fixes 

Change-Id: I28098228fd1ab89c263634b1903a34571ea2d595
Reviewed-on: https://go-review.googlesource.com/13741
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-21 08:34:00 +00:00
Yasuhiro Matsumoto d9b722afdd shiny/driver/windriver: fix build on windows
Change-Id: I6aa0c2333f0b5a459fe087f5bca24be290663236
Reviewed-on: https://go-review.googlesource.com/13782
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-21 02:51:26 +00:00
Nigel Tao ffc5391bef shiny/driver/internal/errscreen: factor out a common stub.
Change-Id: Id4677d80dad0a6f4ac0c070b765ccd0d1ec39ffc
Reviewed-on: https://go-review.googlesource.com/13718
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-21 01:24:49 +00:00
Nigel Tao 364f9171d4 shiny/example/basic: use key.Event's String method.
Change-Id: Ia73705a6bc8f83de7c0855d534049bbcd4ea4dc2
Reviewed-on: https://go-review.googlesource.com/13734
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-21 01:21:46 +00:00
Rob Pike 669d8ecb1f shiny/driver/gldriver: send UploadedEvents in GL
Was a TODO, now addressed.

Change-Id: Ib383251d781f126d789050d8f68f4a7e9f73d1ae
Reviewed-on: https://go-review.googlesource.com/13732
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-20 05:22:42 +00:00
Rob Pike a1b22e8073 driver/gldriver: fix compilation error on mac
Cocoa support needed some conversions.

Change-Id: I6e01c17cee1fafe9edce1c08391f1eb93491ecd5
Reviewed-on: https://go-review.googlesource.com/13730
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-20 04:22:01 +00:00
Alex Brainman b4b413dd27 shiny/driver/windriver: reimplement mainMessagePump in Go
Change-Id: I65065c922cc67be013c1dd9ef38ff57e0b0cf427
Reviewed-on: https://go-review.googlesource.com/13717
Reviewed-by: Pietro Gagliardi <pietro10@mac.com>
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-20 03:06:01 +00:00
Nigel Tao 8ee28c2c18 shiny/font: add Hinting, Stretch, Style and Weight option types.
These will be used by other vector font packages, such as the truetype
package, to select specific faces.

Change-Id: I3db8c97335089c2076811e8f85d9a8868fc900bd
Reviewed-on: https://go-review.googlesource.com/13714
Reviewed-by: Rob Pike <r@golang.org>
2015-08-20 02:16:59 +00:00
Nigel Tao 83e87dc1dc shiny/driver/x11driver: implement key events.
Change-Id: I6adba113086ab6436e5f01a1d4b49ca731f22f3f
Reviewed-on: https://go-review.googlesource.com/13713
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-20 01:15:38 +00:00
Nigel Tao 01fa66802f shiny/driver/windriver: make the package buildable on non-windows.
Change-Id: Ic5204ac3917da487632e95a0731403005ce98ca8
Reviewed-on: https://go-review.googlesource.com/13710
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-20 00:54:43 +00:00
Nigel Tao f1453fdc6d shiny/driver/gldriver: make the package buildable on non-darwin.
After this CL, the only source files with build tags are cocoa.* and
other.go:

$ ls
buffer.go
cocoa.go
cocoa.h
cocoa.m
gldriver.go
other.go
screen.go
texture.go
window.go
$ grep --files-with-matches build *
cocoa.go
cocoa.m
other.go

Change-Id: I202c2629e506bb3834d88cc6c8c2e087d8aa0792
Reviewed-on: https://go-review.googlesource.com/13659
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-19 23:58:57 +00:00
Pietro Gagliardi d13386972a shiny/driver/windriver: implement mouse and resize events
The mouse wheel is not handled yet; I'm not sure how to translate
WM_MOUSEWHEEL to a "click" in the X11 sense yet. I'll find that out
and write that part of the code.

Also I'm not sure if you want Meta to be the Windows key; once I get
confirmation about that I'll add that in too.

For size events, I assume you want to take the device's DPI value as
the PixelsPerPt. I can do that, but Windows has a separate DPI in both
directions; do I only use the one in the Y direction? We'll then need to
handle DPI changes; I can do that too, once I can confirm that
WM_DPICHANGED can be safely included in the switch statement for
window messages on platforms before Windows 8.1.

For paint events, I'll need to figure out how to carry a PAINTSTRUCT
and a DC around. I'll read the examples again and see what I can do.
This will affect the design of Buffer and Texture.

For key events, I just need to know if keys like key.CodeA map to
where the A key is on a US keyboard or on whatever keyboard the
user happens to use (positional or virtual?).

Change-Id: Id8351d197c70715f62a204659349c1692fdec1a3
Reviewed-on: https://go-review.googlesource.com/13670
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-19 10:55:34 +00:00
Nigel Tao 063a7c878b shiny/font/plan9font: implement ParseFont.
Also delete font.MultiFace. We can resurrect a font.MultiFace type if we
need it in the future, but for now, it's simpler if it lives in the
plan9font package.

Change-Id: I1493b47696c323424e7d91cb7fac15505bfdd023
Reviewed-on: https://go-review.googlesource.com/13520
Reviewed-by: Rob Pike <r@golang.org>
2015-08-19 04:10:22 +00:00
Pietro Gagliardi a2565c808c shiny/driver/windriver: new package providing a Windows driver
This provides the initial implementation of a Windows driver for shiny.
It will only open a window and wait for you to close it; Buffer and
Texture will come next, when I figure out how they will work.

I tried to lay down the design of the package in doc.go. If you are still
confused, I'll be glad to rewrite or expand it.

Currently this uses cgo.

Patch set 2 changes the C formatting to match the Go sourcce tree's.
It also includes a quick change to driver_fallback.go.

Patch set 3 rewrites doc.go, hopefully to be clearer.

Patch set 4 implements changes suggested in code review and
removes a block of comments that was accidentally left in
when doc.go was written.

Patch set 5 formats this commit message.

Change-Id: I2b060455243f445dd0f4c62f6f0c346768491547
Reviewed-on: https://go-review.googlesource.com/13617
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-15 23:49:05 +00:00
Nigel Tao 277e85e199 shiny: rename config.Event to size.Event.
Change-Id: I804aed414c9a3ef7183490c1711aab8dfd2e6de2
Reviewed-on: https://go-review.googlesource.com/13602
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-13 13:31:12 +00:00
Nigel Tao 62925c13e0 shiny/font: new package for drawing text on an image.
Package font defines an interface for font faces.

Other packages provide font face implementations. For example, a
truetype package (not part of this CL) would provide one based on .ttf
font files.

This CL also introduces the golang.org/x/exp/shiny/font/plan9font
package, a concrete implementation of the font.Face interface for the
Plan 9 bitmap font format.

Change-Id: Iead8914caaa58c7562b18a86b45002ae47486903
Reviewed-on: https://go-review.googlesource.com/13463
Reviewed-by: Rob Pike <r@golang.org>
2015-08-11 05:46:15 +00:00
David Crawshaw 6a40f1c6ad shiny/driver/gldriver: use cocoa button property
Change-Id: I42b53ea13d4032d7c96e44b7c50db8f67cfb37ab
Reviewed-on: https://go-review.googlesource.com/13362
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-10 12:43:38 +00:00
David Crawshaw 8c4b135485 shiny/driver/gldriver: use pump package
Change-Id: I236d0f9ad34e9cddf58e53987f3c8b3ccab267c4
Reviewed-on: https://go-review.googlesource.com/13360
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-07 13:18:28 +00:00
David Crawshaw 81b818820c shiny/driver/gldriver: wire up cocoa mouse events
Change-Id: If07a33f5e8f2e35e43698422d40c8cc446fa3ba0
Reviewed-on: https://go-review.googlesource.com/13325
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-07 09:55:11 +00:00
David Crawshaw 990a229c0c shiny/driver/gldriver: implement fill
Change-Id: I56e8a20e1a28ab424b0ed6503fd6e48d9a75e5cb
Reviewed-on: https://go-review.googlesource.com/13322
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-07 09:16:34 +00:00
Nigel Tao 19c7ad9bc4 shiny/driver/x11driver: send mouse events.
Change-Id: Ic4bdf4a42a620666bd3a66ac9d02b9ea383fb39c
Reviewed-on: https://go-review.googlesource.com/13291
Reviewed-by: Rob Pike <r@golang.org>
2015-08-06 04:30:38 +00:00
Nigel Tao fbcf60fd56 shiny/driver/x11driver: send config events.
Also fix support for the ICCCM WM_TAKE_FOCUS protocol:
https://tronche.com/gui/x/icccm/sec-4.html#s-4.1.7

Change-Id: Ic41fa71d6f2f78b82d9b7a8a0459561a99b4304f
Reviewed-on: https://go-review.googlesource.com/13210
Reviewed-by: Rob Pike <r@golang.org>
2015-08-06 03:27:20 +00:00
Nigel Tao 099e33c228 shiny/screen: add a Fill method.
Change-Id: Ia3621cdb70707e5727902ef0b53b4041daac9a1a
Reviewed-on: https://go-review.googlesource.com/13190
Reviewed-by: Rob Pike <r@golang.org>
2015-08-05 05:15:56 +00:00
David Crawshaw 6d4148dd10 shiny/driver/gldriver: texture drawing
Adapted from x/mobile/exp/gl/glutil. As shiny.Drawer takes a affine
transform, I've semi-reverted to an earlier version of the glimage
logic that was based on affine transforms. I believe this is correct
(and it can draw the basics on the screen), but it needs more robust
experimentation and testing.

Change-Id: Icc77de0343fe7965b21d6cb4923f521986e088af
Reviewed-on: https://go-review.googlesource.com/13040
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-05 01:37:00 +00:00
Nigel Tao 875bd9fc4a shiny/vendor: update README.vendor for a manual patch.
The previous patch is
https://go-review.googlesource.com/#/c/12765/

Change-Id: I95ec56c4420408fb7bb7cc45edd1ff691fa65e95
Reviewed-on: https://go-review.googlesource.com/13122
Reviewed-by: David Symonds <dsymonds@golang.org>
2015-08-05 01:04:34 +00:00
Brad Fitzpatrick b77eeee4c6 shiny/vendor: make BurntSushi/xgb/xproto tests skip when $DISPLAY is empty
The builders don't have X. (notably Darwin)

Perhaps the Linux ones should. Or some should. Please file a separate bug for that.

Somebody else might want to upstream this fix to BurntSushi.

Updates 

Change-Id: I6d270a83fc59a3923723b5bfbd0b92057a484a1c
Reviewed-on: https://go-review.googlesource.com/12765
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-04 06:11:14 +00:00
Nigel Tao e0ea89aab9 shiny/screen: add Bounds convenience methods.
Change-Id: I995c7b5b3ae341a849521e77fad5a38a8864ac94
Reviewed-on: https://go-review.googlesource.com/13057
Reviewed-by: Rob Pike <r@golang.org>
2015-08-04 02:54:19 +00:00
Nigel Tao 5670e61a0f shiny/driver/x11driver: basic NewTexture implementation.
Change-Id: Iec939a7b120f46ced99dbb21632e3fe96ee31f57
Reviewed-on: https://go-review.googlesource.com/13039
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-04 00:51:08 +00:00
Nigel Tao 0b91815c1d shiny/driver/internal/swizzle: new package.
On my amd64 desktop machine:
BenchmarkBGRA-8      	    3000	    469214 ns/op
BenchmarkPureGoBGRA-8	     500	   3267103 ns/op

When swizzling a 1920x1080 RGBA pixel buffer, there's a 7x difference
between 3.27ms and 0.47ms, and that 3-ish milliseconds difference is a
noticable fraction of the 16.67ms that a 60Hz refresh rate gives you.

Thanks to Aaron Jacobs for his help with SIMD assembly.

Change-Id: I8c1a50cc3f038824e07442492f8f0f6b22c83728
Reviewed-on: https://go-review.googlesource.com/13003
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-04 00:33:53 +00:00
Nigel Tao d913a7f2ed shiny/driver/gldriver: make the default window size consistent with x11.
Change-Id: Ib67ee4e5aefb4aab8fc376b81accca4799542f0e
Reviewed-on: https://go-review.googlesource.com/13060
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-03 11:56:23 +00:00
David Crawshaw cbe5cbf51e screen: update EndPaint with generation number
Matches x/mobile change in http://golang.org/cl/12841.

Change-Id: If06e8addb126666820b02d2f2f34737204fbf281
Reviewed-on: https://go-review.googlesource.com/12925
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-08-03 10:32:25 +00:00
Nigel Tao 87eea2f5e5 shiny/driver/internal/pump: new package.
Also have x11driver's Window implement Send, Events and Release.

Change-Id: Ie6c05ca7769937bd6f796e0317cfbc58836f9813
Reviewed-on: https://go-review.googlesource.com/13001
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-08-02 11:03:11 +00:00
David Crawshaw cabcb38b5c shiny/driver/gldriver: new package
Beginning of OS X implementation. Can open windows and receive paint
events timed to the physical display's vsync.

Based on x/mobile/app, but with significant modifications to support
opening more than one window.

Implementation of screen.Texture to follow in a later CL.

Change-Id: I84ffad4d636324fa42799cc3bc0079b8b8607162
Reviewed-on: https://go-review.googlesource.com/12927
Reviewed-by: Nigel Tao <nigeltao@golang.org>
2015-07-31 14:03:52 +00:00
Nigel Tao efb6a4976c shiny/screen: add a Sender argument to Upload.
Change-Id: I23e31162e13a532fb4409060c22a756435e16aa0
Reviewed-on: https://go-review.googlesource.com/12862
Reviewed-by: Rob Pike <r@golang.org>
2015-07-30 05:02:44 +00:00
Nigel Tao 434f3b3f7a shiny/driver/x11driver: implement Window.Upload.
Change-Id: Ied861c23f3828b57a79425d0f76e49d2dd40adbb
Reviewed-on: https://go-review.googlesource.com/12816
Reviewed-by: Rob Pike <r@golang.org>
2015-07-29 22:17:48 +00:00
Nigel Tao 4654408686 shiny: vendor github.com/BurntSushi/xgb/...
As the README.vendor file says:

----

This is a fork-and-subset of github.com/BurntSushi/xgb at git revision
3ac861bb (2015-04-26).

The subset consists of these directories:
github.com/BurntSushi/xgb
github.com/BurntSushi/xgb/render
github.com/BurntSushi/xgb/shm
github.com/BurntSushi/xgb/xproto

Other directories in the original github.com/BurntSushi/xgb repository
are not used by golang.org/x/exp/shiny, and were not copied to the
vendor tree here:
github.com/BurntSushi/xgb/bigreq
github.com/BurntSushi/xgb/composite
etc
github.com/BurntSushi/xgb/xvmc

----

Change-Id: I7702bd31443239269b7218c368e27802fbfed78a
Reviewed-on: https://go-review.googlesource.com/12814
Reviewed-by: Andrew Gerrand <adg@golang.org>
2015-07-29 02:50:22 +00:00
Nigel Tao 779564eb77 shiny/driver/x11driver: basic NewBuffer implementation.
Change-Id: Ib153696194d21bd3f8148c37ed660ee251336d46
Reviewed-on: https://go-review.googlesource.com/12770
Reviewed-by: Rob Pike <r@golang.org>
2015-07-29 02:13:20 +00:00
Nigel Tao b8be2db7e4 shiny/driver/x11driver: basic NewWindow implementation.
This introduces a new dependency on third-party libraries:
github.com/BurntSushi/xgb/...

Change-Id: Ibe6e8422b356b9225ef0a44d0f42b34fd2cda61d
Reviewed-on: https://go-review.googlesource.com/12668
Reviewed-by: Rob Pike <r@golang.org>
2015-07-28 03:18:16 +00:00
Nigel Tao 15905dc0da shiny/driver: new package.
Change-Id: Ieb0fe3bde687c640244dd67467c8a47710a3421c
Reviewed-on: https://go-review.googlesource.com/12627
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: David Crawshaw <crawshaw@golang.org>
2015-07-27 01:24:08 +00:00
Nigel Tao e4db9e6264 shiny/screen: new package.
Change-Id: Ib0a6296b9c117d64fc76fc6abe59ccb7da3bbae1
Reviewed-on: https://go-review.googlesource.com/12568
Reviewed-by: Rob Pike <r@golang.org>
2015-07-24 06:42:10 +00:00