Commit Graph

30 Commits

Author SHA1 Message Date
Elias Naur b53c2a7c9d app/internal/window: introduce and use nilEGLDisplay
Updates gio#52

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-30 20:41:20 +01:00
Elias Naur 3425b25ecc app/internal: add FreeBSD support
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-30 14:01:02 +01:00
Elias Naur 1cc1fb1c72 app/internal/window: replace ppoll with poll
We're about to add FreeBSD where ppoll is not supported.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-30 13:44:59 +01:00
Denis Bernard e834a78ab2 app/internal/window: X11 fix black window on Xephyr
On Xephyr, when fitst entering x11Window.loop(), syscall.Ppoll would
block forever while XPending() would still return a non zero value.
This commit refactors the loop so that XPending() gets called first,
then fallback to waiting in ppoll if there are no pending draw events.

This has the added benefit of reducing the number of calls to ppoll when
receiving a lot of events.

Signed-off-by: Denis Bernard <db047h@gmail.com>
2019-10-29 14:04:20 +01:00
Elias Naur a7ae8b6e3d app/internal/window: move -Werror from LDFLAGS to CFLAGS
Discovered by the builders, yay:

+ gogio -target android ./kitchen
gogio: go build -ldflags=-w -s  -buildmode=c-shared -o /tmp/gogio-485830478/jni/arm64-v8a/libgio.so ./kitchen failed: go build gioui.org/app/internal/window: invalid flag in #cgo LDFLAGS: -Werror

(https://builds.sr.ht/~eliasnaur/job/101366)

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-29 01:35:39 +01:00
Elias Naur 3f66d34599 app/internal/window: (Wayland) handle EAGAIN from wl_display_flush
Fixes gio#50

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-28 22:36:08 +01:00
Elias Naur 7115b448e8 app/internal/window: don't use module imports in framework header
Using the module import syntax "@import UIKit" results in a complaint
from the compiler:

> warning: use of '@import' in framework header is discouraged,
> including this header requires -fmodules [-Watimport-in-framework-header]

Use the regular #include syntax instead.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-28 18:26:07 +01:00
Elias Naur 439d3e652c app/internal: consolidate CFLAGS and move -Werror to #cgo directives
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-28 13:30:51 +01:00
Elias Naur 4a26bdad5d cmd/gogio: build for iOS/macOS without -fmodules and -fobjc-arc
The `gogio` tool adds the `-fmodules -fobjc-arc` flags to the Cgo
C flags. Unfortunately, that masks problems where Cgo packages
accidentally didn't have the flags in their #cgo directives such
as package log.

Move the flags so they're only explicitly mentioned when `gogio`
invokes the host compiler to build the `main.m` shim.

Fix package log to include the missing flags.

While we're here, silence OpenGL ES deprecation warnings on iOS, just
as we do for macOS. The warnings are normally not visible because
the gogio tool suppress output from the go tool.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-28 11:40:53 +01:00
Denis Bernard 547ff2e484 app/internal/window: x11 driver
This driver still lacks fling support and dp/sp configuration.

By default, linux builds will try to use the Wayland driver then
fallback to X11 if it fails. Drivers can be disabled by using either the
nowayland or nox11 build tags.

Signed-off-by: Denis Bernard <db047h@gmail.com>
2019-10-27 15:06:53 +01:00
Denis Bernard b78d144119 app/internal/window: add needVSync() to eglDriver interface
This enables calling eglSwapInterval with an interval value of 0 or 1
on a per driver basis.

Signed-off-by: Denis Bernard <db047h@gmail.com>
2019-10-26 15:45:03 +02:00
Elias Naur fff9293c9b app/internal/window: work around missing MESA_EGL_NO_X11_HEADERS support
Some versions of eglplatform.h don't support the MESA_EGL_NO_X11_HEADER
define for cross-platform definitions of the EGL types. Remove the
define and use an explicit cast instead.

Fixes gio#46

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-26 11:37:06 +02:00
Greg Pomerantz 5ef176af81 app: add Handle type and PlatformHandle()
On Android, allow access to JVM and Application context.

Signed-off-by: Greg Pomerantz <gmp.gio@wow.st>
2019-10-18 20:16:17 +02:00
Elias Naur 42d2c98455 app/internal/gpu: clip in floating point
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-17 15:30:37 +02:00
Elias Naur 0c75e7c605 app/internal/gpu: don't apply gamma linearization to alpha values
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-17 14:35:10 +02:00
Elias Naur b3c0eaac80 app/internal/window: fix Windows build
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-17 14:18:46 +02:00
Elias Naur 1d47f0c5d8 app/internal/window: fall back to OpenGL ES 2 if 3 is unavailable
Systems that only support ES 2 are unlikely to have the required
extensions available. But we'll get a better exit error in that case.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-15 17:59:23 +02:00
Elias Naur 88208891de op/paint,app/internal/gpu: post-process paths during GPU upload
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 22:51:52 +02:00
Elias Naur 74407a50d5 op/paint: add NewImageOp, unexport ImageOp fields
With public ImageOp fields there was no way to mark an image.Image as modified.
Replace them with NewImageOp that always make a copy, and use the opportunity
to ensure the copy is ready to upload to a GPU texture.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 18:06:50 +02:00
Elias Naur b30bf3cef8 app/internal/log: extract log setup to separate package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:39:32 +02:00
Elias Naur 10c1b2cb8d app,internal/window: extract native window code to separate package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 16:39:32 +02:00
Elias Naur 52fedc27a2 app/internal/xkb: extra XKB interface to internal package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-14 11:50:44 +02:00
Elias Naur e1de1ba591 io/pointer: delete Foremost priority
It wasn't used, and it's not clear that it is useful at all in its current
form. For example, a single control with multiple handler keys (say, one for
scrolling and one for clicking) will only receive priority Foremost for one of
them.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 16:31:23 +02:00
Elias Naur e49df512f6 app/internal/input: remove event delivery tracking field
The "hadEvents" field of handlerEvents is enough to track event
delivery.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur ff4fa71738 app/internal/input: really reset dropped handlers
First, let the handlers know they're dropping with a cancel event.

Second, reset the grab flag of dropped handlers.

Fixes issues when drag-scrolling and then clicking and another with two nested
drag gestures where the grab flag is kept for the second handler even after it
is pushed out by the first handler grabbing.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-10-12 14:01:46 +02:00
Elias Naur beaec661d2 op/paint: move paint package below the op package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur 8cf35a1f97 op: add package op for operations
Extract operation types from package ui into package op.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 16:55:47 +02:00
Elias Naur e7a97bf176 io/event: move event types from package ui to its own package
Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 15:18:08 +02:00
Elias Naur 7a259e68f7 io: give event packages a common prefix
Packages that provide support for external events such as pointer, key and
system are only the beginning. Future packages are expected for clipboard
access, drag and drop, gps positions and so on.

To keep the number of top-level packages under control, move such I/O packages
to the new `io` directory.

The `system` package name was the previous solution to keeping the number of
top-level packages under control: I named it `system` instead of the narrower
`profile` because I expected to put all the less common events into it, turning
`system` into a "package util" smell.

With `io`, package system can be renamed to `profile`.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 14:50:55 +02:00
Elias Naur 22cd88df9f all: rename the gioui.org/ui module to gioui.org
The "ui" is redundant and stutters.

Signed-off-by: Elias Naur <mail@eliasnaur.com>
2019-09-30 12:37:06 +02:00