Commit Graph

931 Commits

Author SHA1 Message Date
Elias Naur aca511f849 app/internal/window: (wasm) generate key.Events for all printable characters
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-24 19:41:11 +01:00
Larry Clapp 65bc7be256 app/internal/window: allow punctuation as keycode events
Allows things like "ctrl-{" and ".".

All punctuation is returned as-is, e.g. "!" is "!", not "shift-1", and
"{" is "{", not "shift-[".

Also add the Enter key as a known key (fn-return on my Mac).

Signed-off-by: Larry Clapp <larry@theclapp.org>
2019-11-24 19:41:11 +01:00
Elias Naur d5424ef7fc app/internal/window: replace X11 input handling with xkb
Unifies Wayland and X11 keyboard handling.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-24 19:41:11 +01:00
Elias Naur 5a34b6f2c3 app/internal/xkb: send key.Events for shifted keysyms
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-22 16:13:38 +01:00
Elias Naur 968669d39e app/internal/xkb: fix cleanup check
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-22 14:52:33 +01:00
Elias Naur 4072361fd5 app/internal/gpu: fix Pathfinder URL
Noticed by Daniel Martí.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-22 14:50:04 +01:00
Elias Naur 6a2b5a8d3b example,cmd: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-20 20:28:06 +01:00
Elias Naur f3f079df32 font/opentype: treat invalid characters less specially
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-20 20:15:31 +01:00
Elias Naur c072a7eb87 font/opentype: fix kerning
Fixes gio#69

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-20 19:57:38 +01:00
Elias Naur 76c209b594 example,cmd: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-20 18:36:34 +01:00
Elias Naur b39e4227c2 gesture,internal/fling: fix rounding
The code tried to extract a rounded whole number of pixels while preserving the
fraction. However, it failed to converge for the value 0.5, rounded to 1,
leaving -0.5, rounded to -1, leaving 0.5 and so on.

Drop the cleverness and truncate the values instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-20 18:30:01 +01:00
Elias Naur 72840d7b88 app/internal/window: delete redundant draw on WM_MAXIMIZE, WM_RESTORED
There's always a WM_PAINT after a restore or maximize message.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-20 15:19:26 +00:00
Larry Clapp f8de7545f4 several: add modifiers to mouse events and clicks
macOS only, for the os-specific bits.

Signed-off-by: Larry Clapp <larry@theclapp.org>
2019-11-18 15:38:09 +01:00
Elias Naur 26f34a3331 example,cmd: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-18 15:05:12 +01:00
Elias Naur 16cc51ee8a io/pointer: unify area ops into a single AreaOp
Make Rect and Ellipse constructors of AreaOp.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-18 15:03:11 +01:00
Elias Naur 3edd9dd8be example/gophers: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-18 14:37:14 +01:00
Elias Naur 7299d1c875 op/clip: replace Rect and RoundRect with Rect type
Remembering the order of the corners in the RoundRect is difficult,
which suggest that RoundRect should be a struct with named fields.

Do that, and make Rect the special case where corner radii are all
zero.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-18 14:33:28 +01:00
Konstantin Kulikov 101b65f4e5 app/internal/window: map window after defining WM protocols
ICCCM 4.1.2 says WMs will examine client properties every time
window is mapped. Because SetWMProtocols is called before MapWindow
some WMs (specifically taowm) never see them.

In other WMs this works because they check for WM_DELETE_WINDOW
when user tries to close window, not when window is mapped.

Signed-off-by: Konstantin Kulikov <k.kulikov2@gmail.com>
2019-11-14 10:56:49 +01:00
Denis Bernard 1bf2c7ef29 app/internal/window: (X11) Add support for UTF-8 window title.
Signed-off-by: Denis Bernard <db047h@gmail.com>
2019-11-13 00:56:26 +01:00
Elias Naur b29b1f6677 example: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-12 22:20:37 +01:00
Elias Naur 1d0a7b845e app: destroy GPU before ack'ing the DestroyEvent
The DestroyEvent ack allows the backend to release the window.
Ensure that the GPU associated with the window is done before that
happens.

Updates gio#67

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-12 22:17:29 +01:00
Elias Naur 41abb5b08d Revert "app: release GPU before processing DestroyEvent"
This reverts commit 8620b43eb3.

Releasing the GPU after ack'ing the DestroyEvent is too late.

Updates gio#67
2019-11-12 22:12:57 +01:00
Denis Bernard 2e0406802b app/internal/window: cleanup X11 initialization
Removed redundant XSelectInput and XChangeWindowAttributes as well as
obsolete screen parameter in x11DetectUIScale.

Signed-off-by: Denis Bernard <db047h@gmail.com>
2019-11-11 13:50:45 +01:00
Larry Clapp a770a2425c widget: no newline in editor on submit
When you press enter to "submit" an editor widget, don't also append the
newline to the editor text.  Enter should be "submit" or "add newline"
but not both.

Also add parens to the Enter check: x && y || z => x && (y || z).

Signed-off-by: Larry Clapp <larry@theclapp.org>
2019-11-11 00:10:09 +01:00
Elias Naur 682d2810d3 text: remove SingleLine from LayoutOptions
Low level text layout should not deal with filtering newlines.

Updates gio#61

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 20:01:40 +01:00
Elias Naur 778b7e6398 widget/material: rename material.go to theme.go
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 19:55:05 +01:00
Elias Naur d8c9cb426c example/gophers: update gio version
gofmt -w -s . as well.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 19:46:10 +01:00
Elias Naur 65c783179d clip: change Rect argument to f32.Rectangle
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 19:42:19 +01:00
Elias Naur 4f30b985eb op/clip: add RoundRect
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 19:30:07 +01:00
Elias Naur e864ac3fc3 op/clip: split clip operations into its own package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 19:07:00 +01:00
Elias Naur 560cf6054c op/paint: add note that ClipOp intersects the clip, not replace it
Updates #61

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 18:31:49 +01:00
Elias Naur 0dac972b25 app,os: update documentation to match changed API
Updates gio#61

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 18:25:28 +01:00
Elias Naur 8620b43eb3 app: release GPU before processing DestroyEvent
In fact, move the release of the GPU to a deferred function, saving
a release.

Fixes #65

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 18:17:11 +01:00
Elias Naur b950aa71e1 app/internal/window: (X11) don't destroy window on EGL destroy
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 18:05:33 +01:00
Elias Naur 0cfcf5ca2d app/internal/window: (X11) implement right and middle mouse buttons
Updates gio#60

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 17:57:20 +01:00
Elias Naur dc7f9bab23 io/pointer,gesture: report right and middle mouse button events
Updates gio#60

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 17:41:39 +01:00
Denis Bernard a0050ab79b app/internal/window: x11: fix issue with space not sending key.EditEvent
This is a general fix where keys with names differing from their UTF8
representation could not be sent as EditEvents.

Signed-off-by: Denis Bernard <db047h@gmail.com>
2019-11-09 16:06:54 +01:00
Elias Naur c8d01d99cc app/internal/xkb: translate physical "Backtab" keys to Shift-Tab
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 15:55:03 +01:00
Elias Naur dca25a7708 app/internal/window: map "Backtab" to Shift-Tab
Updates gio#62

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 15:47:06 +01:00
Elias Naur de7d6b28fa io/key: add support for the Tab and Space keys
Fixes gio#62

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 11:57:36 +01:00
Elias Naur da42412e56 README.md: add an Oxford comma to emphasize only WebAssembly is
experimental

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-09 00:42:02 +01:00
Elias Naur 9def3153de README.md: note that the WebAssembly is experimental
It's slow and syscall/js has seen incompatible changes in Go 1.13
and Go 1.14.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 22:27:06 +01:00
Elias Naur 294308d8aa example/gophers: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 22:22:41 +01:00
Elias Naur cc43588aba io/key: switch Event.Name to be a string and add function keys
Function keys don't have a natural rune representation so switch
Event.Name to be a string to fit "F1"-"F12".

Fixes gio#59

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 22:20:17 +01:00
Elias Naur c833c98fd7 io/key: add ModAlt, ModSuper
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 18:39:21 +01:00
Elias Naur c4416ffbc4 example/gophers: update gio version
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 18:04:56 +01:00
Elias Naur d293dfe604 key: add ModCtrl, ModShortcut
ModCtrl is the physical Ctrl key, ModShortcut is the virtual
"shortcut" modifier, which is Ctrl on most platforms, Command on
Apple platforms.

Updates #59

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 18:02:26 +01:00
Elias Naur 1eaa5dd15e app,app/internal/gpu: process frame in parallel
A frame ops buffers is tracersed twice: once for GPU commands,
and once for everything else. There is already a GPU goroutine for
concurrentl issuing of GPU commands; move the frame ops processing
to the goroutine as well. Both frame ops passed can then proceed
in parallel.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 13:53:11 +01:00
Elias Naur 1678f922e7 app: make CPU timings more useful
Record the time for generating a frame and submitting it as well
as the time for issuing the frame to the GPU and swapping buffers.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 13:29:35 +01:00
Elias Naur f6cdc62120 app: don't schedule a new frame for profiling events
Sometimes it's useful to profile yet not continously re-draw. If the programs
wants the old behaviour, it can issue an InvalidateOp or call
Window.Invalidate.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-11-08 13:02:19 +01:00